diff -Nru a/CREDITS b/CREDITS
--- a/CREDITS	2005-02-21 06:30:58 -08:00
+++ b/CREDITS	2005-03-08 16:26:50 -08:00
@@ -841,6 +841,11 @@
 W: http://www.fsmlabs.com/linuxppcbk.html
 D: PowerPC
 
+N: Daniel Drake
+E: dsd@gentoo.org
+D: USBAT02 CompactFlash support in usb-storage
+S: UK
+
 N: Oleg Drokin
 E: green@ccssu.crimea.ua
 W: http://www.ccssu.crimea.ua/~green
@@ -1095,7 +1100,7 @@
 
 N: Kumar Gala
 E: kumar.gala@freescale.com
-D: Embedded PowerPC 6xx/7xx/74xx/82xx/85xx support
+D: Embedded PowerPC 6xx/7xx/74xx/82xx/83xx/85xx support
 S: Austin, Texas 78729
 S: USA
 
@@ -3351,10 +3356,11 @@
 S: USA
 
 N: Matthias Urlichs
-E: urlichs@noris.de
-E: urlichs@smurf.sub.org
+E: smurf@smurf.noris.de
+E: smurf@debian.org
+E: matthias@urlichs.de
 D: Consultant, developer, kernel hacker
-D: Playing with Streams, ISDN, and BSD networking code for Linux
+D: In a previous life, worked on Streams/ISDN/BSD networking code for Linux
 S: Schleiermacherstrasse 12
 S: 90491 Nuernberg
 S: Germany
@@ -3426,6 +3432,7 @@
 E: pe1rxq@amsat.org
 W: http://www.chello.nl/~j.vreeken/
 D: SE401 usb webcam driver
+D: ZD1201 usb wireless lan driver
 S: Maastrichterweg 63
 S: 5554 GG Valkenswaard
 S: The Netherlands
diff -Nru a/Documentation/BK-usage/bksend b/Documentation/BK-usage/bksend
--- a/Documentation/BK-usage/bksend	2002-03-20 04:23:57 -08:00
+++ b/Documentation/BK-usage/bksend	2005-03-07 20:41:41 -08:00
@@ -27,7 +27,7 @@
 
 SEP="\n===================================================================\n\n"
 echo -e $SEP
-bk changes -r$REV
+env PAGER=/bin/cat bk changes -r$REV
 echo
 bk export -tpatch -du -h -r$REV | diffstat
 echo; echo
diff -Nru a/Documentation/Changes b/Documentation/Changes
--- a/Documentation/Changes	2005-01-07 15:19:23 -08:00
+++ b/Documentation/Changes	2005-02-18 14:45:14 -08:00
@@ -339,7 +339,7 @@
 
 JFSutils
 --------
-o  <http://oss.software.ibm.com/jfs>
+o  <http://jfs.sourceforge.net/>
 
 Reiserfsprogs
 -------------
diff -Nru a/Documentation/IPMI.txt b/Documentation/IPMI.txt
--- a/Documentation/IPMI.txt	2004-08-23 01:15:22 -07:00
+++ b/Documentation/IPMI.txt	2005-03-07 20:41:43 -08:00
@@ -342,6 +342,7 @@
        irqs=<irq1>,<irq2>... trydefaults=[0|1]
        regspacings=<sp1>,<sp2>,... regsizes=<size1>,<size2>,...
        regshifts=<shift1>,<shift2>,...
+       slave_addrs=<addr1>,<addr2>,...
 
 Each of these except si_trydefaults is a list, the first item for the
 first interface, second item for the second interface, etc.
@@ -383,6 +384,10 @@
 be in the lower 8 bits.  The regshifts parameter give the amount to shift
 the data to get to the actual IPMI data.
 
+The slave_addrs specifies the IPMI address of the local BMC.  This is
+usually 0x20 and the driver defaults to that, but in case it's not, it
+can be specified when the driver starts up.
+
 When compiled into the kernel, the addresses can be specified on the
 kernel command line as:
 
@@ -392,6 +397,7 @@
        ipmi_si.regspacings=<sp1>,<sp2>,...
        ipmi_si.regsizes=<size1>,<size2>,...
        ipmi_si.regshifts=<shift1>,<shift2>,...
+       ipmi_si.slave_addrs=<addr1>,<addr2>,...
 
 It works the same as the module parameters of the same names.
 
diff -Nru a/Documentation/aoe/aoe.txt b/Documentation/aoe/aoe.txt
--- a/Documentation/aoe/aoe.txt	2005-01-14 11:21:17 -08:00
+++ b/Documentation/aoe/aoe.txt	2005-03-09 09:05:27 -08:00
@@ -6,9 +6,16 @@
 
 CREATING DEVICE NODES
 
-  Users of udev should find device nodes created automatically.  Two
-  scripts are provided in Documentation/aoe as examples of static
-  device node creation for using the aoe driver.
+  Users of udev should find the block device nodes created
+  automatically, but to create all the necessary device nodes, use the
+  udev configuration rules provided in udev.txt (in this directory).
+
+  There is a udev-install.sh script that shows how to install these
+  rules on your system.
+
+  If you are not using udev, two scripts are provided in
+  Documentation/aoe as examples of static device node creation for
+  using the aoe driver.
 
     rm -rf /dev/etherd
     sh Documentation/aoe/mkdevs.sh /dev/etherd
diff -Nru a/Documentation/aoe/status.sh b/Documentation/aoe/status.sh
--- a/Documentation/aoe/status.sh	2005-01-14 11:21:17 -08:00
+++ b/Documentation/aoe/status.sh	2005-03-09 09:05:15 -08:00
@@ -4,10 +4,13 @@
 set -e
 format="%8s\t%8s\t%8s\n"
 me=`basename $0`
+sysd=${sysfs_dir:-/sys}
 
 # printf "$format" device mac netif state
 
-test -z "`mount | grep sysfs`" && {
+# Suse 9.1 Pro doesn't put /sys in /etc/mtab
+#test -z "`mount | grep sysfs`" && {
+test ! -d "$sysd/block" && {
 	echo "$me Error: sysfs is not mounted" 1>&2
 	exit 1
 }
@@ -16,7 +19,7 @@
 	exit 1
 }
 
-for d in `ls -d /sys/block/etherd* 2>/dev/null | grep -v p` end; do
+for d in `ls -d $sysd/block/etherd* 2>/dev/null | grep -v p` end; do
 	# maybe ls comes up empty, so we use "end"
 	test $d = end && continue
 
diff -Nru a/Documentation/aoe/udev-install.sh b/Documentation/aoe/udev-install.sh
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/Documentation/aoe/udev-install.sh	2005-03-09 09:05:23 -08:00
@@ -0,0 +1,26 @@
+# install the aoe-specific udev rules from udev.txt into 
+# the system's udev configuration
+# 
+
+me="`basename $0`"
+
+# find udev.conf, often /etc/udev/udev.conf
+# (or environment can specify where to find udev.conf)
+#
+if test -z "$conf"; then
+	if test -r /etc/udev/udev.conf; then
+		conf=/etc/udev/udev.conf
+	else
+		conf="`find /etc -type f -name udev.conf 2> /dev/null`"
+		if test -z "$conf" || test ! -r "$conf"; then
+			echo "$me Error: no udev.conf found" 1>&2
+			exit 1
+		fi
+	fi
+fi
+
+# find the directory where udev rules are stored, often
+# /etc/udev/rules.d
+#
+rules_d="`sed -n '/^udev_rules=/{ s!udev_rules=!!; s!\"!!g; p; }' $conf`"
+test "$rules_d" && sh -xc "cp `dirname $0`/udev.txt $rules_d/60-aoe.rules"
diff -Nru a/Documentation/aoe/udev.txt b/Documentation/aoe/udev.txt
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/Documentation/aoe/udev.txt	2005-03-09 09:05:27 -08:00
@@ -0,0 +1,23 @@
+# These rules tell udev what device nodes to create for aoe support.
+# They may be installed along the following lines (adjusted to what
+# you see on your system).
+# 
+#   ecashin@makki ~$ su
+#   Password:
+#   bash# find /etc -type f -name udev.conf
+#   /etc/udev/udev.conf
+#   bash# grep udev_rules= /etc/udev/udev.conf
+#   udev_rules="/etc/udev/rules.d/"
+#   bash# ls /etc/udev/rules.d/
+#   10-wacom.rules  50-udev.rules
+#   bash# cp /path/to/linux-2.6.xx/Documentation/aoe/udev.txt \
+#           /etc/udev/rules.d/60-aoe.rules
+#  
+
+# aoe char devices
+SUBSYSTEM="aoe", KERNEL="discover",	NAME="etherd/%k", GROUP="disk", MODE="0220"
+SUBSYSTEM="aoe", KERNEL="err",		NAME="etherd/%k", GROUP="disk", MODE="0440"
+SUBSYSTEM="aoe", KERNEL="interfaces",	NAME="etherd/%k", GROUP="disk", MODE="0220"
+
+# aoe block devices     
+KERNEL="etherd*",       NAME="%k", GROUP="disk"
diff -Nru a/Documentation/arm/IXP2000 b/Documentation/arm/IXP2000
--- a/Documentation/arm/IXP2000	2004-10-07 11:19:53 -07:00
+++ b/Documentation/arm/IXP2000	2005-03-02 04:41:08 -08:00
@@ -45,7 +45,7 @@
 
 4. Usage Notes
 
-- The IXP2000 platforms ususally have rather complex PCI bus topologies
+- The IXP2000 platforms usually have rather complex PCI bus topologies
   with large memory space requirements. In addition, b/c of the way the
   Intel SDK is designed, devices are enumerated in a very specific
   way. B/c of this this, we use "pci=firmware" option in the kernel
diff -Nru a/Documentation/arm/Samsung-S3C24XX/H1940.txt b/Documentation/arm/Samsung-S3C24XX/H1940.txt
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/Documentation/arm/Samsung-S3C24XX/H1940.txt	2005-02-25 04:45:38 -08:00
@@ -0,0 +1,40 @@
+		HP IPAQ H1940
+		=============
+
+http://www.handhelds.org/projects/h1940.html
+
+Introduction
+------------
+
+  The HP H1940 is a S3C2410 based handheld device, with
+  bluetooth connectivity.
+
+
+Support
+-------
+
+  A variety of information is available
+
+  handhelds.org project page:
+
+    http://www.handhelds.org/projects/h1940.html
+
+  handhelds.org wiki page:
+
+    http://handhelds.org/moin/moin.cgi/HpIpaqH1940
+
+  Herbert Pötzl pages:
+
+    http://vserver.13thfloor.at/H1940/
+
+
+Maintainers
+-----------
+
+  This project is being maintained and developed by a variety
+  of people, including Ben Dooks, Arnaud Patard, and Herbert Pötzl.
+
+  Thanks to the many others who have also provided support.
+
+
+(c) 2005 Ben Dooks
\ No newline at end of file
diff -Nru a/Documentation/arm/Samsung-S3C24XX/Overview.txt b/Documentation/arm/Samsung-S3C24XX/Overview.txt
--- a/Documentation/arm/Samsung-S3C24XX/Overview.txt	2005-01-20 10:33:51 -08:00
+++ b/Documentation/arm/Samsung-S3C24XX/Overview.txt	2005-03-09 12:48:01 -08:00
@@ -7,8 +7,8 @@
 ------------
 
   The Samsung S3C24XX range of ARM9 System-on-Chip CPUs are supported
-  by the 's3c2410' architecture of ARM Linux. Currently the S3C2410 is
-  the only supported CPU in this range.
+  by the 's3c2410' architecture of ARM Linux. Currently the S3C2410 and
+  the S3C2440 are supported CPUs.
 
 
 Configuration
@@ -36,6 +36,10 @@
 
     Samsung's own development board, geared for PDA work.
 
+  Samsung/Meritech SMDK2440
+
+    The S3C2440 compatible version of the SMDK2440
+
   Thorcom VR1000
 
     Custom embedded board
@@ -44,12 +48,41 @@
 
     Handheld (IPAQ), available in several varieties
 
-
   HP iPAQ rx3715
 
     S3C2440 based IPAQ, with a number of variations depending on
     features shipped.
 
+  Acer N30
+
+    A S3C2410 based PDA from Acer.  There is a Wiki page at
+    http://handhelds.org/moin/moin.cgi/AcerN30Documentation .
+
+
+Adding New Machines
+-------------------
+
+  The archicture has been designed to support as many machines as can
+  be configured for it in one kernel build, and any future additions
+  should keep this in mind before altering items outside of their own
+  machine files.
+
+  Machine definitions should be kept in linux/arch/arm/mach-s3c2410,
+  and there are a number of examples that can be looked at.
+
+  Read the kernel patch submission policies as well as the
+  Documentation/arm directory before submitting patches. The
+  ARM kernel series is managed by Russell King, and has a patch system
+  located at http://www.arm.linux.org.uk/developer/patches/
+  as well as mailing lists that can be found from the same site.
+
+  As a courtesy, please notify <ben-linux@fluff.org> of any new
+  machines or other modifications.
+
+  Any large scale modifications, or new drivers should be discussed
+  on the ARM kernel mailing list (linux-arm-kernel) before being
+  attempted.
+
 
 NAND
 ----
@@ -98,6 +131,9 @@
   Klaus Fetscher
   Dimitry Andric
   Shannon Holland
+  Guillaume Gourat (NexVision)
+  Christer Weinigel (wingel) (Acer N30)
+  Lucas Correia Villa Real (S3C2400 port)
 
 
 Document Changes
@@ -108,6 +144,11 @@
   25 Oct 2004 - BJD - Added Dimitry Andric to list of contributors
   25 Oct 2004 - BJD - Updated the MTD from the 2.6.9 merge
   21 Jan 2005 - BJD - Added rx3715, added Shannon to contributors
+  10 Feb 2005 - BJD - Added Guillaume Gourat to contributors
+  02 Mar 2005 - BJD - Added SMDK2440 to list of machines
+  06 Mar 2005 - BJD - Added Christer Weinigel
+  08 Mar 2005 - BJD - Added LCVR to list of people, updated introduction
+  08 Mar 2005 - BJD - Added section on adding machines
 
 Document Author
 ---------------
diff -Nru a/Documentation/arm/Samsung-S3C24XX/SMDK2440.txt b/Documentation/arm/Samsung-S3C24XX/SMDK2440.txt
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/Documentation/arm/Samsung-S3C24XX/SMDK2440.txt	2005-03-03 02:30:16 -08:00
@@ -0,0 +1,56 @@
+		Samsung/Meritech SMDK2440
+		=========================
+
+Introduction
+------------
+
+  The SMDK2440 is a two part evaluation board for the Samsung S3C2440
+  processor. It includes support for LCD, SmartMedia, Audio, SD and
+  10MBit Ethernet, and expansion headers for various signals, including
+  the camera and unused GPIO.
+
+
+Configuration
+-------------
+
+  To set the default configuration, use `make smdk2440_defconfig` which
+  will configure the common features of this board, or use
+  `make s3c2410_config` to include support for all s3c2410/s3c2440 machines
+
+
+Support
+-------
+
+  Ben Dooks' SMDK2440 site at http://www.fluff.org/ben/smdk2440/ which
+  includes linux based USB download tools.
+
+  Some of the h1940 patches that can be found from the H1940 project
+  site at http://www.handhelds.org/projects/h1940.html can also be
+  applied to this board.
+
+
+Peripherals
+-----------
+
+  There is no current support for any of the extra peripherals on the
+  base-board itself.
+
+
+MTD
+---
+
+  The NAND flash should be supported by the in kernel MTD NAND support,
+  NOR flash will be added later.
+
+
+Maintainers
+-----------
+
+  This board is being maintained by Ben Dooks, for more info, see
+  http://www.fluff.org/ben/smdk2440/
+
+  Many thanks to Dimitry Andric of TomTom for the loan of the SMDK2440,
+  and to Simtec Electronics for allowing me time to work on this.
+
+
+(c) 2004 Ben Dooks
\ No newline at end of file
diff -Nru a/Documentation/cachetlb.txt b/Documentation/cachetlb.txt
--- a/Documentation/cachetlb.txt	2004-09-17 06:50:31 -07:00
+++ b/Documentation/cachetlb.txt	2005-02-25 16:35:19 -08:00
@@ -155,7 +155,7 @@
 	   change_range_of_page_tables(mm, start, end);
 	   flush_tlb_range(vma, start, end);
 
-	3) flush_cache_page(vma, addr);
+	3) flush_cache_page(vma, addr, pfn);
 	   set_pte(pte_pointer, new_pte_val);
 	   flush_tlb_page(vma, addr);
 
@@ -203,7 +203,7 @@
 	call flush_cache_page (see below) for each entry which may be
 	modified.
 
-3) void flush_cache_page(struct vm_area_struct *vma, unsigned long addr)
+3) void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn)
 
 	This time we need to remove a PAGE_SIZE sized range
 	from the cache.  The 'vma' is the backing structure used by
@@ -213,8 +213,14 @@
 	executable (and thus could be in the 'instruction cache' in
 	"Harvard" type cache layouts).
 
+	The 'pfn' indicates the physical page frame (shift this value
+	left by PAGE_SHIFT to get the physical address) that 'addr'
+	translates to.  It is this mapping which should be removed from
+	the cache.
+
 	After running, there will be no entries in the cache for
-	'vma->vm_mm' for virtual address 'addr'.
+	'vma->vm_mm' for virtual address 'addr' which translates
+	to 'pfn'.
 
 	This is used primarily during fault processing.
 
diff -Nru a/Documentation/crypto/api-intro.txt b/Documentation/crypto/api-intro.txt
--- a/Documentation/crypto/api-intro.txt	2004-11-09 15:21:35 -08:00
+++ b/Documentation/crypto/api-intro.txt	2005-02-24 11:24:22 -08:00
@@ -234,6 +234,9 @@
 Anubis algorithm contributors:
   Aaron Grothe
 
+Tiger algorithm contributors:
+  Aaron Grothe
+
 Generic scatterwalk code by Adam J. Richter <adam@yggdrasil.com>
 
 Please send any credits updates or corrections to:
diff -Nru a/Documentation/devices.txt b/Documentation/devices.txt
--- a/Documentation/devices.txt	2005-01-30 22:33:45 -08:00
+++ b/Documentation/devices.txt	2005-03-07 20:41:37 -08:00
@@ -2754,6 +2754,8 @@
 		 50 = /dev/ttyIOC40		Altix serial card
 		    ...
 		 81 = /dev/ttyIOC431		Altix serial card
+		 82 = /dev/ttyVR0               NEC VR4100 series SIU
+		 83 = /dev/ttyVR1               NEC VR4100 series DSIU
 
 205 char	Low-density serial ports (alternate device)
 		  0 = /dev/culu0		Callout device for ttyLU0
@@ -2788,6 +2790,8 @@
 		 50 = /dev/cuioc40		Callout device for ttyIOC40
 		    ...
 		 81 = /dev/cuioc431		Callout device for ttyIOC431
+		 82 = /dev/cuvr0                Callout device for ttyVR0
+		 83 = /dev/cuvr1                Callout device for ttyVR1
 
 
 206 char	OnStream SC-x0 tape devices
diff -Nru a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
--- a/Documentation/feature-removal-schedule.txt	2005-01-14 13:22:44 -08:00
+++ b/Documentation/feature-removal-schedule.txt	2005-03-09 09:05:48 -08:00
@@ -15,3 +15,20 @@
 	against the LSB, and can be replaced by using udev.
 Who:	Greg Kroah-Hartman <greg@kroah.com>
 
+---------------------------
+
+What:	/proc/sys/cpu/*, sysctl and /proc/cpufreq interfaces to cpufreq (2.4.x interfaces)
+When:	January 2005
+Files:	drivers/cpufreq/: cpufreq_userspace.c, proc_intf.c
+Why:	/proc/sys/cpu/* has been deprecated since inclusion of cpufreq into
+	the main kernel tree. It bloats /proc/ unnecessarily and doesn't work
+	well with the "governor"-based design of cpufreq.
+	/proc/cpufreq/* has also been deprecated for a long time and was only
+	meant for usage during 2.5. until the new sysfs-based interface became
+	ready. It has an inconsistent interface which doesn't work well with
+	userspace setting the frequency. The output from /proc/cpufreq/* can
+	be emulated using "cpufreq-info --proc" (cpufrequtils).
+	Both interfaces are superseded by the cpufreq interface in
+	/sys/devices/system/cpu/cpu%n/cpufreq/.
+Who:	Dominik Brodowski <linux@brodo.de>
+
diff -Nru a/Documentation/filesystems/jfs.txt b/Documentation/filesystems/jfs.txt
--- a/Documentation/filesystems/jfs.txt	2004-02-12 07:23:49 -08:00
+++ b/Documentation/filesystems/jfs.txt	2005-02-18 14:41:05 -08:00
@@ -1,13 +1,6 @@
 IBM's Journaled File System (JFS) for Linux
 
-JFS Homepage:  http://oss.software.ibm.com/jfs/
-
-Team members
-------------
-Dave Kleikamp      shaggy@austin.ibm.com  
-Dave Blaschke      blaschke@us.ibm.com
-Steve Best         sbest@us.ibm.com
-Barry Arndt        barndt@us.ibm.com
+JFS Homepage:  http://jfs.sourceforge.net/
 
 The following mount options are supported:
 
@@ -15,6 +8,7 @@
 		ASCII.  The default is to do no conversion.  Use
 		iocharset=utf8 for UTF8 translations.  This requires
 		CONFIG_NLS_UTF8 to be set in the kernel .config file.
+		iocharset=none specifies the default behavior explicitly.
 
 resize=value	Resize the volume to <value> blocks.  JFS only supports
 		growing a volume, not shrinking it.  This option is only
@@ -38,4 +32,4 @@
 Please send bugs, comments, cards and letters to shaggy@austin.ibm.com.
 
 The JFS mailing list can be subscribed to by using the link labeled
-"Mail list Subscribe" at our web page http://oss.software.ibm.com/jfs/.
+"Mail list Subscribe" at our web page http://jfs.sourceforge.net/
diff -Nru a/Documentation/i2c/porting-clients b/Documentation/i2c/porting-clients
--- a/Documentation/i2c/porting-clients	2004-05-09 10:05:17 -07:00
+++ b/Documentation/i2c/porting-clients	2005-03-02 10:00:42 -08:00
@@ -49,9 +49,8 @@
   static void lm75_update_client(struct i2c_client *client);
 
 * [Sysctl] All sysctl stuff is of course gone (defines, ctl_table
-  and functions). Instead, right after the static id definition
-  line, you have to define show and set functions for each sysfs
-  file. Only define set for writable values. Take a look at an
+  and functions). Instead, you have to define show and set functions for
+  each sysfs file. Only define set for writable values. Take a look at an
   existing 2.6 driver for details (lm78 for example). Don't forget
   to define the attributes for each file (this is that step that
   links callback functions). Use the file names specified in
@@ -86,6 +85,7 @@
   Replace the sysctl directory registration by calls to
   device_create_file. Move the driver initialization before any
   sysfs file creation.
+  Drop client->id.
 
 * [Init] Limits must not be set by the driver (can be done later in
   user-space). Chip should not be reset default (although a module
diff -Nru a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
--- a/Documentation/i2c/writing-clients	2004-11-15 12:50:03 -08:00
+++ b/Documentation/i2c/writing-clients	2005-03-02 09:55:02 -08:00
@@ -344,9 +344,6 @@
 
 For now, you can ignore the `flags' parameter. It is there for future use.
 
-  /* Unique ID allocation */
-  static int foo_id = 0;
-
   int foo_detect_client(struct i2c_adapter *adapter, int address, 
                         unsigned short flags, int kind)
   {
@@ -482,7 +479,6 @@
     data->type = kind;
     /* SENSORS ONLY END */
 
-    new_client->id = foo_id++; /* Automatically unique */
     data->valid = 0; /* Only if you use this field */
     init_MUTEX(&data->update_lock); /* Only if you use this field */
 
@@ -642,7 +638,7 @@
 parameter contains the bytes the read/write, the third the length of the
 buffer. Returned is the actual number of bytes read/written.
   
-  extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],
+  extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msg,
                           int num);
 
 This sends a series of messages. Each message can be a read or write,
diff -Nru a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
--- a/Documentation/kernel-parameters.txt	2005-02-02 22:19:14 -08:00
+++ b/Documentation/kernel-parameters.txt	2005-03-07 20:41:42 -08:00
@@ -634,6 +634,20 @@
 	logibm.irq=	[HW,MOUSE] Logitech Bus Mouse Driver
 			Format: <irq>
 
+	loglevel=	All Kernel Messages with a loglevel smaller than the
+			console loglevel will be printed to the console. It can
+			also be changed with klogd or other programs. The
+			loglevels are defined as follows:
+
+			0 (KERN_EMERG)		system is unusable
+			1 (KERN_ALERT)		action must be taken immediately
+			2 (KERN_CRIT)		critical conditions
+			3 (KERN_ERR)		error conditions
+			4 (KERN_WARNING)	warning conditions
+			5 (KERN_NOTICE)		normal but significant condition
+			6 (KERN_INFO)		informational
+			7 (KERN_DEBUG)		debug-level messages
+
 	log_buf_len=n	Sets the size of the printk ring buffer, in bytes.
 			Format is n, nk, nM.  n must be a power of two.  The
 			default is set in kernel config.
@@ -1355,6 +1369,8 @@
 
 	thash_entries=	[KNL,NET]
 			Set number of hash buckets for TCP connection
+
+	time		Show timing data prefixed to each printk message line
 
 	tipar.timeout=	[HW,PPT]
 			Set communications timeout in tenths of a second
diff -Nru a/Documentation/keys.txt b/Documentation/keys.txt
--- a/Documentation/keys.txt	2004-10-19 02:40:15 -07:00
+++ b/Documentation/keys.txt	2005-03-07 20:41:42 -08:00
@@ -606,8 +606,12 @@
 due to two different users opening the same file is left to the filesystem
 author to solve.
 
-When accessing a key's payload data, the key->lock should be at least read
-locked, or else the data may be changed by update during the access.
+When accessing a key's payload data, key->lock should be at least read locked,
+or else the data may be changed by an update being performed from userspace
+whilst the driver or filesystem is trying to access it. If no update method is
+supplied, then the key's payload may be accessed without holding a lock as
+there is no way to change it, provided it can be guaranteed that the key's
+type definition won't go away.
 
 (*) To search for a key, call:
 
@@ -719,13 +723,19 @@
 
  (*) int (*instantiate)(struct key *key, const void *data, size_t datalen);
 
-     This method is called to attach a payload to a key during
-     construction. The payload attached need not bear any relation to the data
-     passed to this function.
+     This method is called to attach a payload to a key during construction.
+     The payload attached need not bear any relation to the data passed to
+     this function.
 
      If the amount of data attached to the key differs from the size in
      keytype->def_datalen, then key_payload_reserve() should be called.
 
+     This method does not have to lock the key in order to attach a payload.
+     The fact that KEY_FLAG_INSTANTIATED is not set in key->flags prevents
+     anything else from gaining access to the key.
+
+     This method may sleep if it wishes.
+
 
  (*) int (*duplicate)(struct key *key, const struct key *source);
 
@@ -734,8 +744,8 @@
      the new key. The data length on the new key will have been updated and
      the quota adjusted already.
 
-     The source key will be locked against change on the source->sem, so it is
-     safe to sleep here.
+     This method will be called with the source key's semaphore read-locked to
+     prevent its payload from being changed. It is safe to sleep here.
 
 
  (*) int (*update)(struct key *key, const void *data, size_t datalen);
@@ -749,30 +759,47 @@
      type is committed to changing the key because it's already been altered,
      so all memory allocation must be done first.
 
-     The key will be locked against other changers on key->sem, so it is safe
-     to sleep here.
-
      key_payload_reserve() should be called with the key->lock write locked,
      and the changes to the key's attached payload should be made before the
      key is locked.
 
+     The key will have its semaphore write-locked before this method is
+     called. Any changes to the key should be made with the key's rwlock
+     write-locked also. It is safe to sleep here.
+
 
  (*) int (*match)(const struct key *key, const void *desc);
 
      This method is called to match a key against a description. It should
      return non-zero if the two match, zero if they don't.
 
+     This method should not need to lock the key in any way. The type and
+     description can be considered invariant, and the payload should not be
+     accessed (the key may not yet be instantiated).
+
+     It is not safe to sleep in this method; the caller may hold spinlocks.
+
 
  (*) void (*destroy)(struct key *key);
 
      This method is optional. It is called to discard the payload data on a
      key when it is being destroyed.
 
+     This method does not need to lock the key; it can consider the key as
+     being inaccessible. Note that the key's type may have changed before this
+     function is called.
+
+     It is not safe to sleep in this method; the caller may hold spinlocks.
+
 
  (*) void (*describe)(const struct key *key, struct seq_file *p);
 
      This method is optional. It is called during /proc/keys reading to
-     summarise a key in text form.
+     summarise a key's description and payload in text form.
+
+     This method will be called with the key's rwlock read-locked. This will
+     prevent the key's payload and state changing; also the description should
+     not change. This also means it is not safe to sleep in this method.
 
 
  (*) long (*read)(const struct key *key, char __user *buffer, size_t buflen);
@@ -784,6 +811,12 @@
 
      If successful, the blob size that could be produced should be returned
      rather than the size copied.
+
+     This method will be called with the key's semaphore read-locked. This
+     will prevent the key's payload changing. It is not necessary to also
+     read-lock key->lock when accessing the key's payload. It is safe to sleep
+     in this method, such as might happen when the userspace buffer is
+     accessed.
 
 
 ============================
diff -Nru a/Documentation/networking/bonding.txt b/Documentation/networking/bonding.txt
--- a/Documentation/networking/bonding.txt	2004-03-18 22:04:54 -08:00
+++ b/Documentation/networking/bonding.txt	2005-02-11 01:44:37 -08:00
@@ -1,5 +1,5 @@
 
-                   Linux Ethernet Bonding Driver mini-howto
+                   Linux Ethernet Bonding Driver HOWTO
 
 Initial release : Thomas Davis <tadavis at lbl.gov>
 Corrections, HA extensions : 2000/10/03-15 :
@@ -9,8 +9,11 @@
   - Janice Girouard <girouard at us dot ibm dot com>
   - Jay Vosburgh <fubar at us dot ibm dot com>
 
+Reorganized and updated Feb 2005 by Jay Vosburgh
+
 Note :
 ------
+	
 The bonding driver originally came from Donald Becker's beowulf patches for
 kernel 2.0. It has changed quite a bit since, and the original tools from
 extreme-linux and beowulf sites will not work with this version of the driver.
@@ -18,218 +21,190 @@
 For new versions of the driver, patches for older kernels and the updated
 userspace tools, please follow the links at the end of this file.
 
-
 Table of Contents
 =================
 
-Installation
-Bond Configuration
-Module Parameters
-Configuring Multiple Bonds
-Switch Configuration
-Verifying Bond Configuration
-Frequently Asked Questions
-High Availability
-Promiscuous Sniffing notes
-8021q VLAN support
-Limitations
-Resources and Links
-
-
-Installation
-============
-
-1) Build kernel with the bonding driver
----------------------------------------
-For the latest version of the bonding driver, use kernel 2.4.12 or above
-(otherwise you will need to apply a patch).
-
-Configure kernel with `make menuconfig/xconfig/config', and select "Bonding
-driver support" in the "Network device support" section. It is recommended
-to configure the driver as module since it is currently the only way to
-pass parameters to the driver and configure more than one bonding device.
-
-Build and install the new kernel and modules.
-
-2) Get and install the userspace tools
---------------------------------------
-This version of the bonding driver requires updated ifenslave program. The
-original one from extreme-linux and beowulf will not work. Kernels 2.4.12
-and above include the updated version of ifenslave.c in
-Documentation/networking directory. For older kernels, please follow the
-links at the end of this file.
-
-IMPORTANT!!!  If you are running on Redhat 7.1 or greater, you need
-to be careful because /usr/include/linux is no longer a symbolic link
-to /usr/src/linux/include/linux.  If you build ifenslave while this is
-true, ifenslave will appear to succeed but your bond won't work.  The purpose
-of the -I option on the ifenslave compile line is to make sure it uses
-/usr/src/linux/include/linux/if_bonding.h instead of the version from
-/usr/include/linux.
-
-To install ifenslave.c, do:
-    # gcc -Wall -Wstrict-prototypes -O -I/usr/src/linux/include ifenslave.c -o ifenslave
-    # cp ifenslave /sbin/ifenslave
+1. Bonding Driver Installation
 
+2. Bonding Driver Options
 
-Bond Configuration
-==================
+3. Configuring Bonding Devices
+3.1	Configuration with sysconfig support
+3.2	Configuration with initscripts support
+3.3	Configuring Bonding Manually
+3.4	Configuring Multiple Bonds
 
-You will need to add at least the following line to /etc/modprobe.conf
-so the bonding driver will automatically load when the bond0 interface is
-configured. Refer to the modprobe.conf manual page for specific modprobe.conf
-syntax details. The Module Parameters section of this document describes each
-bonding driver parameter.
-
-	alias bond0 bonding
-
-Use standard distribution techniques to define the bond0 network interface. For
-example, on modern Red Hat distributions, create an ifcfg-bond0 file in
-the /etc/sysconfig/network-scripts directory that resembles the following:
+5. Querying Bonding Configuration
+5.1	Bonding Configuration
+5.2	Network Configuration
 
-DEVICE=bond0
-IPADDR=192.168.1.1
-NETMASK=255.255.255.0
-NETWORK=192.168.1.0
-BROADCAST=192.168.1.255
-ONBOOT=yes
-BOOTPROTO=none
-USERCTL=no
+6. Switch Configuration
 
-(use appropriate values for your network above)
+7. 802.1q VLAN Support
 
-All interfaces that are part of a bond should have SLAVE and MASTER
-definitions. For example, in the case of Red Hat, if you wish to make eth0 and
-eth1 a part of the bonding interface bond0, their config files (ifcfg-eth0 and
-ifcfg-eth1) should resemble the following:
+8. Link Monitoring
+8.1	ARP Monitor Operation
+8.2	Configuring Multiple ARP Targets
+8.3	MII Monitor Operation
 
-DEVICE=eth0
-USERCTL=no
-ONBOOT=yes
-MASTER=bond0
-SLAVE=yes
-BOOTPROTO=none
+9. Potential Trouble Sources
+9.1	Adventures in Routing
+9.2	Ethernet Device Renaming
+9.3	Painfully Slow Or No Failed Link Detection By Miimon
 
-Use DEVICE=eth1 in the ifcfg-eth1 config file. If you configure a second
-bonding interface (bond1), use MASTER=bond1 in the config file to make the
-network interface be a slave of bond1.
-
-Restart the networking subsystem or just bring up the bonding device if your
-administration tools allow it. Otherwise, reboot. On Red Hat distros you can
-issue `ifup bond0' or `/etc/rc.d/init.d/network restart'.
-
-If the administration tools of your distribution do not support
-master/slave notation in configuring network interfaces, you will need to
-manually configure the bonding device with the following commands:
-
-    # /sbin/ifconfig bond0 192.168.1.1 netmask 255.255.255.0 \
-      broadcast 192.168.1.255 up
-
-    # /sbin/ifenslave bond0 eth0
-    # /sbin/ifenslave bond0 eth1
-
-(use appropriate values for your network above)
-
-You can then create a script containing these commands and place it in the
-appropriate rc directory.
-
-If you specifically need all network drivers loaded before the bonding driver,
-adding the following line to modprobe.conf will cause the network driver for
-eth0 and eth1 to be loaded before the bonding driver.
-
-install bond0 /sbin/modprobe -a eth0 eth1 && /sbin/modprobe bonding
-
-Be careful not to reference bond0 itself at the end of the line, or modprobe
-will die in an endless recursive loop.
-
-If running SNMP agents, the bonding driver should be loaded before any network
-drivers participating in a bond. This requirement is due to the the interface
-index (ipAdEntIfIndex) being associated to the first interface found with a
-given IP address. That is, there is only one ipAdEntIfIndex for each IP
-address. For example, if eth0 and eth1 are slaves of bond0 and the driver for
-eth0 is loaded before the bonding driver, the interface for the IP address
-will be associated with the eth0 interface. This configuration is shown below,
-the IP address 192.168.1.1 has an interface index of 2 which indexes to eth0
-in the ifDescr table (ifDescr.2).
+10. SNMP agents
 
-     interfaces.ifTable.ifEntry.ifDescr.1 = lo
-     interfaces.ifTable.ifEntry.ifDescr.2 = eth0
-     interfaces.ifTable.ifEntry.ifDescr.3 = eth1
-     interfaces.ifTable.ifEntry.ifDescr.4 = eth2
-     interfaces.ifTable.ifEntry.ifDescr.5 = eth3
-     interfaces.ifTable.ifEntry.ifDescr.6 = bond0
-     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 5
-     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
-     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 4
-     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
+11. Promiscuous mode
 
-This problem is avoided by loading the bonding driver before any network
-drivers participating in a bond. Below is an example of loading the bonding
-driver first, the IP address 192.168.1.1 is correctly associated with
-ifDescr.2.
+12. High Availability Information
+12.1	High Availability in a Single Switch Topology
+12.1.1		Bonding Mode Selection for Single Switch Topology
+12.1.2		Link Monitoring for Single Switch Topology
+12.2	High Availability in a Multiple Switch Topology
+12.2.1		Bonding Mode Selection for Multiple Switch Topology
+12.2.2		Link Monitoring for Multiple Switch Topology
+12.3	Switch Behavior Issues for High Availability
 
-     interfaces.ifTable.ifEntry.ifDescr.1 = lo
-     interfaces.ifTable.ifEntry.ifDescr.2 = bond0
-     interfaces.ifTable.ifEntry.ifDescr.3 = eth0
-     interfaces.ifTable.ifEntry.ifDescr.4 = eth1
-     interfaces.ifTable.ifEntry.ifDescr.5 = eth2
-     interfaces.ifTable.ifEntry.ifDescr.6 = eth3
-     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 6
-     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
-     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 5
-     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
+13. Hardware Specific Considerations
+13.1	IBM BladeCenter
 
-While some distributions may not report the interface name in ifDescr,
-the association between the IP address and IfIndex remains and SNMP
-functions such as Interface_Scan_Next will report that association.
+14. Frequently Asked Questions
 
+15. Resources and Links
 
-Module Parameters
-=================
 
-Optional parameters for the bonding driver can be supplied as command line
-arguments to the insmod command. Typically, these parameters are specified in
-the file /etc/modprobe.conf (see the manual page for modprobe.conf). The
-available bonding driver parameters are listed below. If a parameter is not
-specified the default value is used. When initially configuring a bond, it
-is recommended "tail -f /var/log/messages" be run in a separate window to
-watch for bonding driver error messages.
-
-It is critical that either the miimon or arp_interval and arp_ip_target
-parameters be specified, otherwise serious network degradation will occur
-during link failures.
+1. Bonding Driver Installation
+==============================
+
+	Most popular distro kernels ship with the bonding driver
+already available as a module and the ifenslave user level control
+program installed and ready for use. If your distro does not, or you
+have need to compile bonding from source (e.g., configuring and
+installing a mainline kernel from kernel.org), you'll need to perform
+the following steps:
+
+1.1 Configure and build the kernel with bonding
+-----------------------------------------------
+
+	The latest version of the bonding driver is available in the
+drivers/net/bonding subdirectory of the most recent kernel source
+(which is available on http://kernel.org).
+
+	Prior to the 2.4.11 kernel, the bonding driver was maintained
+largely outside the kernel tree; patches for some earlier kernels are
+available on the bonding sourceforge site, although those patches are
+still several years out of date.  Most users will want to use either
+the most recent kernel from kernel.org or whatever kernel came with
+their distro.
+
+	Configure kernel with "make menuconfig" (or "make xconfig" or
+"make config"), then select "Bonding driver support" in the "Network
+device support" section.  It is recommended that you configure the
+driver as module since it is currently the only way to pass parameters
+to the driver or configure more than one bonding device.
+
+	Build and install the new kernel and modules, then proceed to
+step 2.
+
+1.2 Install ifenslave Control Utility
+-------------------------------------
+
+	The ifenslave user level control program is included in the
+kernel source tree, in the file Documentation/networking/ifenslave.c.
+It is generally recommended that you use the ifenslave that
+corresponds to the kernel that you are using (either from the same
+source tree or supplied with the distro), however, ifenslave
+executables from older kernels should function (but features newer
+than the ifenslave release are not supported).  Running an ifenslave
+that is newer than the kernel is not supported, and may or may not
+work.
+
+	To install ifenslave, do the following:
+
+# gcc -Wall -O -I/usr/src/linux/include ifenslave.c -o ifenslave
+# cp ifenslave /sbin/ifenslave
+
+	If your kernel source is not in "/usr/src/linux," then replace
+"/usr/src/linux/include" in the above with the location of your kernel
+source include directory.
+
+	You may wish to back up any existing /sbin/ifenslave, or, for
+testing or informal use, tag the ifenslave to the kernel version
+(e.g., name the ifenslave executable /sbin/ifenslave-2.6.10).
+
+IMPORTANT NOTE:
+
+	If you omit the "-I" or specify an incorrect directory, you
+may end up with an ifenslave that is incompatible with the kernel
+you're trying to build it for.  Some distros (e.g., Red Hat from 7.1
+onwards) do not have /usr/include/linux symbolically linked to the
+default kernel source include directory.
+
+
+2. Bonding Driver Options
+=========================
+
+	Options for the bonding driver are supplied as parameters to
+the bonding module at load time.  They may be given as command line
+arguments to the insmod or modprobe command, but are usually specified
+in either the /etc/modprobe.conf configuration file, or in a
+distro-specific configuration file (some of which are detailed in the
+next section).
+
+	The available bonding driver parameters are listed below. If a
+parameter is not specified the default value is used.  When initially
+configuring a bond, it is recommended "tail -f /var/log/messages" be
+run in a separate window to watch for bonding driver error messages.
+
+	It is critical that either the miimon or arp_interval and
+arp_ip_target parameters be specified, otherwise serious network
+degradation will occur during link failures.  Very few devices do not
+support at least miimon, so there is really no reason not to use it.
+
+	Options with textual values will accept either the text name
+	or, for backwards compatibility, the option value.  E.g.,
+	"mode=802.3ad" and "mode=4" set the same mode.
+
+	The parameters are as follows:
 
 arp_interval
 
-        Specifies the ARP monitoring frequency in milli-seconds.
-        If ARP monitoring is used in a load-balancing mode (mode 0 or 2), the
-        switch should be configured in a mode that evenly distributes packets
-        across all links - such as round-robin. If the switch is configured to
-        distribute the packets in an XOR fashion, all replies from the ARP
-        targets will be received on the same link which could cause the other
-        team members to fail. ARP monitoring should not be used in conjunction
-        with miimon. A value of 0 disables ARP monitoring. The default value
-        is 0.
+	Specifies the ARP monitoring frequency in milli-seconds. If
+	ARP monitoring is used in a load-balancing mode (mode 0 or 2),
+	the switch should be configured in a mode that evenly
+	distributes packets across all links - such as round-robin. If
+	the switch is configured to distribute the packets in an XOR
+	fashion, all replies from the ARP targets will be received on
+	the same link which could cause the other team members to
+	fail. ARP monitoring should not be used in conjunction with
+	miimon. A value of 0 disables ARP monitoring. The default
+	value is 0.
 
 arp_ip_target
 
-	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 seperated 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.
+	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
+	seperated by a comma.  At least one IP address must be given
+	for ARP monitoring to function.  The maximum number of targets
+	that can be specified is 16.  The default value is no IP
+	addresses.
 
 downdelay
 
-        Specifies the delay time in milli-seconds to disable a link after a
-        link failure has been detected. This should be a multiple of miimon
-        value, otherwise the value will be rounded. The default value is 0.
+	Specifies the time, in milliseconds, to wait before disabling
+	a slave after a link failure has been detected.  This option
+	is only valid for the miimon link monitor.  The downdelay
+	value should be a multiple of the miimon value; if not, it
+	will be rounded down to the nearest multiple.  The default
+	value is 0.
 
 lacp_rate
 
-        Option specifying the rate in which we'll ask our link partner to
-	transmit LACPDU packets in 802.3ad mode.  Possible values are:
+	Option specifying the rate in which we'll ask our link partner
+	to transmit LACPDU packets in 802.3ad mode.  Possible values
+	are:
 
 	slow or 0
 		Request partner to transmit LACPDUs every 30 seconds (default)
@@ -246,69 +221,76 @@
 
 miimon
 
-        Specifies the frequency in milli-seconds that MII link monitoring
-        will occur. A value of zero disables MII link monitoring. A value
-        of 100 is a good starting point. See High Availability section for
-        additional information. The default value is 0.
+	Specifies the frequency in milli-seconds that MII link
+	monitoring will occur.  A value of zero disables MII link
+	monitoring.  A value of 100 is a good starting point.  The
+	use_carrier option, below, affects how the link state is
+	determined.  See the High Availability section for additional
+	information.  The default value is 0.
 
 mode
 
 	Specifies one of the bonding policies. The default is
-	round-robin (balance-rr).  Possible values are (you can use
-	either the text or numeric option):
+	balance-rr (round robin).  Possible values are:
 
 	balance-rr or 0
 
-		Round-robin policy: Transmit in a sequential order
-		from the first available slave through the last. This
-		mode provides load balancing and fault tolerance.
+		Round-robin policy: Transmit packets in sequential
+		order from the first available slave through the
+		last.  This mode provides load balancing and fault
+		tolerance.
 
 	active-backup or 1
 
 		Active-backup policy: Only one slave in the bond is
-		active. A different slave becomes active if, and only
-		if, the active slave fails. The bond's MAC address is
+		active.  A different slave becomes active if, and only
+		if, the active slave fails.  The bond's MAC address is
 		externally visible on only one port (network adapter)
 		to avoid confusing the switch.  This mode provides
-		fault tolerance.
+		fault tolerance.  The primary option affects the
+		behavior of this mode.
 
 	balance-xor or 2
 
 		XOR policy: Transmit based on [(source MAC address
-		XOR'd with destination MAC address) modula slave
-		count]. This selects the same slave for each
-		destination MAC address. This mode provides load
+		XOR'd with destination MAC address) modulo slave
+		count].  This selects the same slave for each
+		destination MAC address.  This mode provides load
 		balancing and fault tolerance.
 
 	broadcast or 3
 
 		Broadcast policy: transmits everything on all slave
-		interfaces. This mode provides fault tolerance.
+		interfaces.  This mode provides fault tolerance.
 
 	802.3ad or 4
 
-		IEEE 802.3ad Dynamic link aggregation. Creates aggregation
-		groups that share the same speed and duplex settings.
-		Transmits and receives on all slaves in the active
-		aggregator.
+		IEEE 802.3ad Dynamic link aggregation.  Creates
+		aggregation groups that share the same speed and
+		duplex settings.  Utilizes all slaves in the active
+		aggregator according to the 802.3ad specification.
 
 		Pre-requisites:
 
-		1. Ethtool support in the base drivers for retrieving the
-		speed and duplex of each slave.
+		1. Ethtool support in the base drivers for retrieving
+		the speed and duplex of each slave.
 
 		2. A switch that supports IEEE 802.3ad Dynamic link
 		aggregation.
 
+		Most switches will require some type of configuration
+		to enable 802.3ad mode.
+
 	balance-tlb or 5
 
-		Adaptive transmit load balancing: channel bonding that does
-		not require any special switch support. The outgoing
-		traffic is distributed according to the current load
-		(computed relative to the speed) on each slave. Incoming
-		traffic is received by the current slave. If the receiving
-		slave fails, another slave takes over the MAC address of
-		the failed receiving slave.
+		Adaptive transmit load balancing: channel bonding that
+		does not require any special switch support.  The
+		outgoing traffic is distributed according to the
+		current load (computed relative to the speed) on each
+		slave.  Incoming traffic is received by the current
+		slave.  If the receiving slave fails, another slave
+		takes over the MAC address of the failed receiving
+		slave.
 
 		Prerequisite:
 
@@ -317,205 +299,452 @@
 
 	balance-alb or 6
 
-		Adaptive load balancing: includes balance-tlb + receive
-		load balancing (rlb) for IPV4 traffic and does not require
-		any special switch support. The receive load balancing is
-		achieved by ARP negotiation. The bonding driver intercepts
-		the ARP Replies sent by the server on their way out and
-		overwrites the src hw address with the unique hw address of
-		one of the slaves in the bond such that different clients
-		use different hw addresses for the server.
-
-		Receive traffic from connections created by the server is
-		also balanced. When the server sends an ARP Request the
-		bonding driver copies and saves the client's IP information
-		from the ARP. When the ARP Reply arrives from the client,
-		its hw address is retrieved and the bonding driver
-		initiates an ARP reply to this client assigning it to one
-		of the slaves in the bond. A problematic outcome of using
-		ARP negotiation for balancing is that each time that an ARP
-		request is broadcasted it uses the hw address of the
-		bond. Hence, clients learn the hw address of the bond and
-		the balancing of receive traffic collapses to the current
-		salve. This is handled by sending updates (ARP Replies) to
-		all the clients with their assigned hw address such that
-		the traffic is redistributed. Receive traffic is also
-		redistributed when a new slave is added to the bond and
-		when an inactive slave is re-activated. The receive load is
-		distributed sequentially (round robin) among the group of
-		highest speed slaves in the bond.
-
-		When a link is reconnected or a new slave joins the bond
-		the receive traffic is redistributed among all active
-		slaves in the bond by intiating ARP Replies with the
-		selected mac address to each of the clients. The updelay
-		modeprobe parameter must be set to a value equal or greater
-		than the switch's forwarding delay so that the ARP Replies
-		sent to the clients will not be blocked by the switch.
+		Adaptive load balancing: includes balance-tlb plus
+		receive load balancing (rlb) for IPV4 traffic, and
+		does not require any special switch support.  The
+		receive load balancing is achieved by ARP negotiation.
+		The bonding driver intercepts the ARP Replies sent by
+		the local system on their way out and overwrites the
+		source hardware address with the unique hardware
+		address of one of the slaves in the bond such that
+		different peers use different hardware addresses for
+		the server.
+
+		Receive traffic from connections created by the server
+		is also balanced.  When the local system sends an ARP
+		Request the bonding driver copies and saves the peer's
+		IP information from the ARP packet.  When the ARP
+		Reply arrives from the peer, its hardware address is
+		retrieved and the bonding driver initiates an ARP
+		reply to this peer assigning it to one of the slaves
+		in the bond.  A problematic outcome of using ARP
+		negotiation for balancing is that each time that an
+		ARP request is broadcast it uses the hardware address
+		of the bond.  Hence, peers learn the hardware address
+		of the bond and the balancing of receive traffic
+		collapses to the current slave.  This is handled by
+		sending updates (ARP Replies) to all the peers with
+		their individually assigned hardware address such that
+		the traffic is redistributed.  Receive traffic is also
+		redistributed when a new slave is added to the bond
+		and when an inactive slave is re-activated.  The
+		receive load is distributed sequentially (round robin)
+		among the group of highest speed slaves in the bond.
+
+		When a link is reconnected or a new slave joins the
+		bond the receive traffic is redistributed among all
+		active slaves in the bond by intiating ARP Replies
+		with the selected mac address to each of the
+		clients. The updelay parameter (detailed below) must
+		be set to a value equal or greater than the switch's
+		forwarding delay so that the ARP Replies sent to the
+		peers will not be blocked by the switch.
 
 		Prerequisites:
 
-		1. Ethtool support in the base drivers for retrieving the
-		speed of each slave.
+		1. Ethtool support in the base drivers for retrieving
+		the speed of each slave.
 
-		2. Base driver support for setting the hw address of a
-		device also when it is open. This is required so that there
-		will always be one slave in the team using the bond hw
-		address (the curr_active_slave) while having a unique hw
-		address for each slave in the bond. If the curr_active_slave
-		fails it's hw address is swapped with the new curr_active_slave
-		that was chosen.
+		2. Base driver support for setting the hardware
+		address of a device while it is open.  This is
+		required so that there will always be one slave in the
+		team using the bond hardware address (the
+		curr_active_slave) while having a unique hardware
+		address for each slave in the bond.  If the
+		curr_active_slave fails its hardware address is
+		swapped with the new curr_active_slave that was
+		chosen.
 
 primary
 
-        A string (eth0, eth2, etc) to equate to a primary device. If this
-        value is entered, and the device is on-line, it will be used first
-        as the output media. Only when this device is off-line, will
-        alternate devices be used. Otherwise, once a failover is detected
-        and a new default output is chosen, it will remain the output media
-        until it too fails. This is useful when one slave was preferred
-        over another, i.e. when one slave is 1000Mbps and another is
-        100Mbps. If the 1000Mbps slave fails and is later restored, it may
-        be preferred the faster slave gracefully become the active slave -
-        without deliberately failing the 100Mbps slave. Specifying a
-        primary is only valid in active-backup mode.
+	A string (eth0, eth2, etc) specifying which slave is the
+	primary device.  The specified device will always be the
+	active slave while it is available.  Only when the primary is
+	off-line will alternate devices be used.  This is useful when
+	one slave is preferred over another, e.g., when one slave has
+	higher throughput than another.
+
+	The primary option is only valid for active-backup mode.
 
 updelay
 
-        Specifies the delay time in milli-seconds to enable a link after a
-        link up status has been detected. This should be a multiple of miimon
-        value, otherwise the value will be rounded. The default value is 0.
+	Specifies the time, in milliseconds, to wait before enabling a
+	slave after a link recovery has been detected.  This option is
+	only valid for the miimon link monitor.  The updelay value
+	should be a multiple of the miimon value; if not, it will be
+	rounded down to the nearest multiple.  The default value is 0.
 
 use_carrier
 
-        Specifies whether or not miimon should use MII or ETHTOOL
-        ioctls vs. netif_carrier_ok() to determine the link status.
-        The MII or ETHTOOL ioctls are less efficient and utilize a
-        deprecated calling sequence within the kernel.  The
-        netif_carrier_ok() relies on the device driver to maintain its
-        state with netif_carrier_on/off; at this writing, most, but
-        not all, device drivers support this facility.
-
-        If bonding insists that the link is up when it should not be,
-        it may be that your network device driver does not support
-        netif_carrier_on/off.  This is because the default state for
-        netif_carrier is "carrier on." In this case, disabling
-        use_carrier will cause bonding to revert to the MII / ETHTOOL
-        ioctl method to determine the link state.
-
-        A value of 1 enables the use of netif_carrier_ok(), a value of
-        0 will use the deprecated MII / ETHTOOL ioctls.  The default
-        value is 1.
-
-
-Configuring Multiple Bonds
-==========================
-
-If several bonding interfaces are required, either specify the max_bonds
-parameter (described above), or load the driver multiple times.  Using
-the max_bonds parameter is less complicated, but has the limitation that
-all bonding instances created will have the same options.  Loading the
-driver multiple times allows each instance of the driver to have differing
-options.
-
-For example, to configure two bonding interfaces, one with mii link
-monitoring performed every 100 milliseconds, and one with ARP link
-monitoring performed every 200 milliseconds, the /etc/conf.modules should
-resemble the following:
+	Specifies whether or not miimon should use MII or ETHTOOL
+	ioctls vs. netif_carrier_ok() to determine the link
+	status. The MII or ETHTOOL ioctls are less efficient and
+	utilize a deprecated calling sequence within the kernel.  The
+	netif_carrier_ok() relies on the device driver to maintain its
+	state with netif_carrier_on/off; at this writing, most, but
+	not all, device drivers support this facility.
+
+	If bonding insists that the link is up when it should not be,
+	it may be that your network device driver does not support
+	netif_carrier_on/off.  The default state for netif_carrier is
+	"carrier on," so if a driver does not support netif_carrier,
+	it will appear as if the link is always up.  In this case,
+	setting use_carrier to 0 will cause bonding to revert to the
+	MII / ETHTOOL ioctl method to determine the link state.
+
+	A value of 1 enables the use of netif_carrier_ok(), a value of
+	0 will use the deprecated MII / ETHTOOL ioctls.  The default
+	value is 1.
+
+
+
+3. Configuring Bonding Devices
+==============================
+
+	There are, essentially, two methods for configuring bonding:
+with support from the distro's network initialization scripts, and
+without.  Distros generally use one of two packages for the network
+initialization scripts: initscripts or sysconfig.  Recent versions of
+these packages have support for bonding, while older versions do not.
+
+	We will first describe the options for configuring bonding for
+distros using versions of initscripts and sysconfig with full or
+partial support for bonding, then provide information on enabling
+bonding without support from the network initialization scripts (i.e.,
+older versions of initscripts or sysconfig).
+
+	If you're unsure whether your distro uses sysconfig or
+initscripts, or don't know if it's new enough, have no fear.
+Determining this is fairly straightforward.
+
+	First, issue the command:
+
+$ rpm -qf /sbin/ifup
+
+	It will respond with a line of text starting with either
+"initscripts" or "sysconfig," followed by some numbers.  This is the
+package that provides your network initialization scripts.
+
+	Next, to determine if your installation supports bonding,
+issue the command:
+
+$ grep ifenslave /sbin/ifup
+
+	If this returns any matches, then your initscripts or
+sysconfig has support for bonding.
+
+3.1 Configuration with sysconfig support
+----------------------------------------
+
+	This section applies to distros using a version of sysconfig
+with bonding support, for example, SuSE Linux Enterprise Server 9.
+
+	SuSE SLES 9's networking configuration system does support
+bonding, however, at this writing, the YaST system configuration
+frontend does not provide any means to work with bonding devices.
+Bonding devices can be managed by hand, however, as follows.
+
+	First, if they have not already been configured, configure the
+slave devices.  On SLES 9, this is most easily done by running the
+yast2 sysconfig configuration utility.  The goal is for to create an
+ifcfg-id file for each slave device.  The simplest way to accomplish
+this is to configure the devices for DHCP.  The name of the
+configuration file for each device will be of the form:
+
+ifcfg-id-xx:xx:xx:xx:xx:xx
+
+	Where the "xx" portion will be replaced with the digits from
+the device's permanent MAC address.
+
+	Once the set of ifcfg-id-xx:xx:xx:xx:xx:xx files has been
+created, it is necessary to edit the configuration files for the slave
+devices (the MAC addresses correspond to those of the slave devices).
+Before editing, the file will contain muliple lines, and will look
+something like this:
+
+BOOTPROTO='dhcp'
+STARTMODE='on'
+USERCTL='no'
+UNIQUE='XNzu.WeZGOGF+4wE'
+_nm_name='bus-pci-0001:61:01.0'
+
+	Change the BOOTPROTO and STARTMODE lines to the following:
+
+BOOTPROTO='none'
+STARTMODE='off'
+
+	Do not alter the UNIQUE or _nm_name lines.  Remove any other
+lines (USERCTL, etc).
+
+	Once the ifcfg-id-xx:xx:xx:xx:xx:xx files have been modified,
+it's time to create the configuration file for the bonding device
+itself.  This file is named ifcfg-bondX, where X is the number of the
+bonding device to create, starting at 0.  The first such file is
+ifcfg-bond0, the second is ifcfg-bond1, and so on.  The sysconfig
+network configuration system will correctly start multiple instances
+of bonding.
+
+	The contents of the ifcfg-bondX file is as follows:
+
+BOOTPROTO="static"
+BROADCAST="10.0.2.255"
+IPADDR="10.0.2.10"
+NETMASK="255.255.0.0"
+NETWORK="10.0.2.0"
+REMOTE_IPADDR=""
+STARTMODE="onboot"
+BONDING_MASTER="yes"
+BONDING_MODULE_OPTS="mode=active-backup miimon=100"
+BONDING_SLAVE0="eth0"
+BONDING_SLAVE1="eth1"
+
+	Replace the sample BROADCAST, IPADDR, NETMASK and NETWORK
+values with the appropriate values for your network.
+
+	Note that configuring the bonding device with BOOTPROTO='dhcp'
+does not work; the scripts attempt to obtain the device address from
+DHCP prior to adding any of the slave devices.  Without active slaves,
+the DHCP requests are not sent to the network.
+
+	The STARTMODE specifies when the device is brought online.
+The possible values are:
+
+	onboot:	 The device is started at boot time.  If you're not
+		 sure, this is probably what you want.
+
+	manual:	 The device is started only when ifup is called
+		 manually.  Bonding devices may be configured this
+		 way if you do not wish them to start automatically
+		 at boot for some reason.
+
+	hotplug: The device is started by a hotplug event.  This is not
+		 a valid choice for a bonding device.
+
+	off or ignore: The device configuration is ignored.
+
+	The line BONDING_MASTER='yes' indicates that the device is a
+bonding master device.  The only useful value is "yes."
+
+	The contents of BONDING_MODULE_OPTS are supplied to the
+instance of the bonding module for this device.  Specify the options
+for the bonding mode, link monitoring, and so on here.  Do not include
+the max_bonds bonding parameter; this will confuse the configuration
+system if you have multiple bonding devices.
+
+	Finally, supply one BONDING_SLAVEn="ethX" for each slave,
+where "n" is an increasing value, one for each slave, and "ethX" is
+the name of the slave device (eth0, eth1, etc).
+
+	When all configuration files have been modified or created,
+networking must be restarted for the configuration changes to take
+effect.  This can be accomplished via the following:
+
+# /etc/init.d/network restart
+
+	Note that the network control script (/sbin/ifdown) will
+remove the bonding module as part of the network shutdown processing,
+so it is not necessary to remove the module by hand if, e.g., the
+module paramters have changed.
+
+	Also, at this writing, YaST/YaST2 will not manage bonding
+devices (they do not show bonding interfaces on its list of network
+devices).  It is necessary to edit the configuration file by hand to
+change the bonding configuration.
+
+	Additional general options and details of the ifcfg file
+format can be found in an example ifcfg template file:
+
+/etc/sysconfig/network/ifcfg.template
+
+	Note that the template does not document the various BONDING_
+settings described above, but does describe many of the other options.
+
+3.2 Configuration with initscripts support
+------------------------------------------
+
+	This section applies to distros using a version of initscripts
+with bonding support, for example, Red Hat Linux 9 or Red Hat
+Enterprise Linux version 3.  On these systems, the network
+initialization scripts have some knowledge of bonding, and can be
+configured to control bonding devices.
+
+	These distros will not automatically load the network adapter
+driver unless the ethX device is configured with an IP address.
+Because of this constraint, users must manually configure a
+network-script file for all physical adapters that will be members of
+a bondX link.  Network script files are located in the directory:
+
+/etc/sysconfig/network-scripts
+
+	The file name must be prefixed with "ifcfg-eth" and suffixed
+with the adapter's physical adapter number.  For example, the script
+for eth0 would be named /etc/sysconfig/network-scripts/ifcfg-eth0.
+Place the following text in the file:
 
-alias bond0 bonding
-alias bond1 bonding
+DEVICE=eth0
+USERCTL=no
+ONBOOT=yes
+MASTER=bond0
+SLAVE=yes
+BOOTPROTO=none
 
-options bond0 miimon=100
-options bond1 -o bonding1 arp_interval=200 arp_ip_target=10.0.0.1
+	The DEVICE= line will be different for every ethX device and
+must correspond with the name of the file, i.e., ifcfg-eth1 must have
+a device line of DEVICE=eth1.  The setting of the MASTER= line will
+also depend on the final bonding interface name chosen for your bond.
+As with other network devices, these typically start at 0, and go up
+one for each device, i.e., the first bonding instance is bond0, the
+second is bond1, and so on.
+
+	Next, create a bond network script.  The file name for this
+script will be /etc/sysconfig/network-scripts/ifcfg-bondX where X is
+the number of the bond.  For bond0 the file is named "ifcfg-bond0",
+for bond1 it is named "ifcfg-bond1", and so on.  Within that file,
+place the following text:
 
-Configuring Multiple ARP Targets
-================================
+DEVICE=bond0
+IPADDR=192.168.1.1
+NETMASK=255.255.255.0
+NETWORK=192.168.1.0
+BROADCAST=192.168.1.255
+ONBOOT=yes
+BOOTPROTO=none
+USERCTL=no
 
-While ARP monitoring can be done with just one target, it can be useful
-in a High Availability setup to have several targets to monitor. In the
-case of just one target,  the target itself may go down or have a problem
-making it unresponsive to ARP requests. Having an additional target (or
-several) increases the reliability of the ARP monitoring.
+	Be sure to change the networking specific lines (IPADDR,
+NETMASK, NETWORK and BROADCAST) to match your network configuration.
 
-Multiple ARP targets must be seperated by commas as follows:
+	Finally, it is necessary to edit /etc/modules.conf to load the
+bonding module when the bond0 interface is brought up.  The following
+sample lines in /etc/modules.conf will load the bonding module, and
+select its options:
 
-# example options for ARP monitoring with three targets
 alias bond0 bonding
-options bond0 arp_interval=60 arp_ip_target=192.168.0.1,192.168.0.3,192.168.0.9
+options bond0 mode=balance-alb miimon=100
 
-For just a single target the options would resemble:
+	Replace the sample parameters with the appropriate set of
+options for your configuration.
 
-# example options for ARP monitoring with one target
+	Finally run "/etc/rc.d/init.d/network restart" as root.  This
+will restart the networking subsystem and your bond link should be now
+up and running.
+
+
+3.3 Configuring Bonding Manually
+--------------------------------
+
+	This section applies to distros whose network initialization
+scripts (the sysconfig or initscripts package) do not have specific
+knowledge of bonding.  One such distro is SuSE Linux Enterprise Server
+version 8.
+
+	The general methodology for these systems is to place the
+bonding module parameters into /etc/modprobe.conf, then add modprobe
+and/or ifenslave commands to the system's global init script.  The
+name of the global init script differs; for sysconfig, it is
+/etc/init.d/boot.local and for initscripts it is /etc/rc.d/rc.local.
+
+	For example, if you wanted to make a simple bond of two e100
+devices (presumed to be eth0 and eth1), and have it persist across
+reboots, edit the appropriate file (/etc/init.d/boot.local or
+/etc/rc.d/rc.local), and add the following:
+
+modprobe bonding -obond0 mode=balance-alb miimon=100
+modprobe e100
+ifconfig bond0 192.168.1.1 netmask 255.255.255.0 up
+ifenslave bond0 eth0
+ifenslave bond0 eth1
+
+	Replace the example bonding module parameters and bond0
+network configuration (IP address, netmask, etc) with the appropriate
+values for your configuration.  The above example loads the bonding
+module with the name "bond0," this simplifies the naming if multiple
+bonding modules are loaded (each successive instance of the module is
+given a different name, and the module instance names match the
+bonding interface names).
+
+	Unfortunately, this method will not provide support for the
+ifup and ifdown scripts on the bond devices.  To reload the bonding
+configuration, it is necessary to run the initialization script, e.g.,
+
+# /etc/init.d/boot.local
+
+	or
+
+# /etc/rc.d/rc.local
+
+	It may be desirable in such a case to create a separate script
+which only initializes the bonding configuration, then call that
+separate script from within boot.local.  This allows for bonding to be
+enabled without re-running the entire global init script.
+
+	To shut down the bonding devices, it is necessary to first
+mark the bonding device itself as being down, then remove the
+appropriate device driver modules.  For our example above, you can do
+the following:
+
+# ifconfig bond0 down
+# rmmod bond0
+# rmmod e100
+
+	Again, for convenience, it may be desirable to create a script
+with these commands.
+
+
+3.4 Configuring Multiple Bonds
+------------------------------
+
+	This section contains information on configuring multiple
+bonding devices with differing options.  If you require multiple
+bonding devices, but all with the same options, see the "max_bonds"
+module paramter, documented above.
+
+	To create multiple bonding devices with differing options, it
+is necessary to load the bonding driver multiple times.  Note that
+current versions of the sysconfig network initialization scripts
+handle this automatically; if your distro uses these scripts, no
+special action is needed.  See the section Configuring Bonding
+Devices, above, if you're not sure about your network initialization
+scripts.
+
+	To load multiple instances of the module, it is necessary to
+specify a different name for each instance (the module loading system
+requires that every loaded module, even multiple instances of the same
+module, have a unique name).  This is accomplished by supplying
+multiple sets of bonding options in /etc/modprobe.conf, for example:
+	
 alias bond0 bonding
-options bond0 arp_interval=60 arp_ip_target=192.168.0.100
-
-Potential Problems When Using ARP Monitor
-=========================================
+options bond0 -o bond0 mode=balance-rr miimon=100
 
-1. Driver support
-
-The ARP monitor relies on the network device driver to maintain two
-statistics: the last receive time (dev->last_rx), and the last
-transmit time (dev->trans_start).  If the network device driver does
-not update one or both of these, then the typical result will be that,
-upon startup, all links in the bond will immediately be declared down,
-and remain that way.  A network monitoring tool (tcpdump, e.g.) will
-show ARP requests and replies being sent and received on the bonding
-device.
-
-The possible resolutions for this are to (a) fix the device driver, or
-(b) discontinue the ARP monitor (using miimon as an alternative, for
-example).
-
-2. Adventures in Routing
-
-When bonding is set up with the ARP monitor, it is important that the
-slave devices not have routes that supercede routes of the master (or,
-generally, not have routes at all).  For example, suppose the bonding
-device bond0 has two slaves, eth0 and eth1, and the routing table is
-as follows:
-
-Kernel IP routing table
-Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
-10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 eth0
-10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 eth1
-10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 bond0
-127.0.0.0       0.0.0.0         255.0.0.0       U        40 0          0 lo
+alias bond1 bonding
+options bond1 -o bond1 mode=balance-alb miimon=50
 
-In this case, the ARP monitor (and ARP itself) may become confused,
-because ARP requests will be sent on one interface (bond0), but the
-corresponding reply will arrive on a different interface (eth0).  This
-reply looks to ARP as an unsolicited ARP reply (because ARP matches
-replies on an interface basis), and is discarded.  This will likely
-still update the receive/transmit times in the driver, but will lose
-packets.
-
-The resolution here is simply to insure that slaves do not have routes
-of their own, and if for some reason they must, those routes do not
-supercede routes of their master.  This should generally be the case,
-but unusual configurations or errant manual or automatic static route
-additions may cause trouble.
+	will load the bonding module two times.  The first instance is
+named "bond0" and creates the bond0 device in balance-rr mode with an
+miimon of 100.  The second instance is named "bond1" and creates the
+bond1 device in balance-alb mode with an miimon of 50.
 
-Switch Configuration
-====================
+	This may be repeated any number of times, specifying a new and
+unique name in place of bond0 or bond1 for each instance.
 
-While the switch does not need to be configured when the active-backup,
-balance-tlb or balance-alb policies (mode=1,5,6) are used, it does need to
-be configured for the round-robin, XOR, broadcast, or 802.3ad policies
-(mode=0,2,3,4).
+	When the appropriate module paramters are in place, then
+configure bonding according to the instructions for your distro.
 
+5. Querying Bonding Configuration 
+=================================
 
-Verifying Bond Configuration
-============================
+5.1 Bonding Configuration
+-------------------------
 
-1) Bonding information files
-----------------------------
-The bonding driver information files reside in the /proc/net/bonding directory.
+	Each bonding device has a read-only file residing in the
+/proc/net/bonding directory.  The file contents include information
+about the bonding configuration, options and state of each slave.
 
-Sample contents of /proc/net/bonding/bond0 after the driver is loaded with
-parameters of mode=0 and miimon=1000 is shown below.
+	For example, the contents of /proc/net/bonding/bond0 after the
+driver is loaded with parameters of mode=0 and miimon=1000 is
+generally as follows:
 
+	Ethernet Channel Bonding Driver: 2.6.1 (October 29, 2004)
         Bonding Mode: load balancing (round-robin)
         Currently Active Slave: eth0
         MII Status: up
@@ -531,15 +760,23 @@
         MII Status: up
         Link Failure Count: 1
 
-2) Network verification
------------------------
-The network configuration can be verified using the ifconfig command. In
-the example below, the bond0 interface is the master (MASTER) while eth0 and
-eth1 are slaves (SLAVE). Notice all slaves of bond0 have the same MAC address
-(HWaddr) as bond0 for all modes except TLB and ALB that require a unique MAC
-address for each slave.
+	The precise format and contents will change depending upon the
+bonding configuration, state, and version of the bonding driver.
+
+5.2 Network configuration
+-------------------------
+
+	The network configuration can be inspected using the ifconfig
+command.  Bonding devices will have the MASTER flag set; Bonding slave
+devices will have the SLAVE flag set.  The ifconfig output does not
+contain information on which slaves are associated with which masters.
+
+	In the example below, the bond0 interface is the master
+(MASTER) while eth0 and eth1 are slaves (SLAVE). Notice all slaves of
+bond0 have the same MAC address (HWaddr) as bond0 for all modes except
+TLB and ALB that require a unique MAC address for each slave.
 
-[root]# /sbin/ifconfig
+# /sbin/ifconfig
 bond0     Link encap:Ethernet  HWaddr 00:C0:F0:1F:37:B4
           inet addr:XXX.XXX.XXX.YYY  Bcast:XXX.XXX.XXX.255  Mask:255.255.252.0
           UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1
@@ -563,430 +800,819 @@
           collisions:0 txqueuelen:100
           Interrupt:9 Base address:0x1400
 
+6. Switch Configuration
+=======================
 
-Frequently Asked Questions
-==========================
+	For this section, "switch" refers to whatever system the
+bonded devices are directly connected to (i.e., where the other end of
+the cable plugs into).  This may be an actual dedicated switch device,
+or it may be another regular system (e.g., another computer running
+Linux),
+
+	The active-backup, balance-tlb and balance-alb modes do not
+require any specific configuration of the switch.
+
+	The 802.3ad mode requires that the switch have the appropriate
+ports configured as an 802.3ad aggregation.  The precise method used
+to configure this varies from switch to switch, but, for example, a
+Cisco 3550 series switch requires that the appropriate ports first be
+grouped together in a single etherchannel instance, then that
+etherchannel is set to mode "lacp" to enable 802.3ad (instead of
+standard EtherChannel).
+
+	The balance-rr, balance-xor and broadcast modes generally
+require that the switch have the appropriate ports grouped together.
+The nomenclature for such a group differs between switches, it may be
+called an "etherchannel" (as in the Cisco example, above), a "trunk
+group" or some other similar variation.  For these modes, each switch
+will also have its own configuration options for the switch's transmit
+policy to the bond.  Typical choices include XOR of either the MAC or
+IP addresses.  The transmit policy of the two peers does not need to
+match.  For these three modes, the bonding mode really selects a
+transmit policy for an EtherChannel group; all three will interoperate
+with another EtherChannel group.
+
+
+7. 802.1q VLAN Support
+======================
+
+	It is possible to configure VLAN devices over a bond interface
+using the 8021q driver.  However, only packets coming from the 8021q
+driver and passing through bonding will be tagged by default.  Self
+generated packets, for example, bonding's learning packets or ARP
+packets generated by either ALB mode or the ARP monitor mechanism, are
+tagged internally by bonding itself.  As a result, bonding must
+"learn" the VLAN IDs configured above it, and use those IDs to tag
+self generated packets.
+
+	For reasons of simplicity, and to support the use of adapters
+that can do VLAN hardware acceleration offloding, the bonding
+interface declares itself as fully hardware offloaing capable, it gets
+the add_vid/kill_vid notifications to gather the necessary
+information, and it propagates those actions to the slaves.  In case
+of mixed adapter types, hardware accelerated tagged packets that
+should go through an adapter that is not offloading capable are
+"un-accelerated" by the bonding driver so the VLAN tag sits in the
+regular location.
+
+	VLAN interfaces *must* be added on top of a bonding interface
+only after enslaving at least one slave.  The bonding interface has a
+hardware address of 00:00:00:00:00:00 until the first slave is added.
+If the VLAN interface is created prior to the first enslavement, it
+would pick up the all-zeroes hardware address.  Once the first slave
+is attached to the bond, the bond device itself will pick up the
+slave's hardware address, which is then available for the VLAN device.
+
+	Also, be aware that a similar problem can occur if all slaves
+are released from a bond that still has one or more VLAN interfaces on
+top of it.  When a new slave is added, the bonding interface will
+obtain its hardware address from the first slave, which might not
+match the hardware address of the VLAN interfaces (which was
+ultimately copied from an earlier slave).
+
+	There are two methods to insure that the VLAN device operates
+with the correct hardware address if all slaves are removed from a
+bond interface:
+
+	1. Remove all VLAN interfaces then recreate them
+
+	2. Set the bonding interface's hardware address so that it
+matches the hardware address of the VLAN interfaces.
+
+	Note that changing a VLAN interface's HW address would set the
+underlying device -- i.e. the bonding interface -- to promiscouos
+mode, which might not be what you want.
 
-1.  Is it SMP safe?
-
-	Yes. The old 2.0.xx channel bonding patch was not SMP safe.
-	The new driver was designed to be SMP safe from the start.
 
-2.  What type of cards will work with it?
-
-	Any Ethernet type cards (you can even mix cards - a Intel
-	EtherExpress PRO/100 and a 3com 3c905b, for example).
-	You can even bond together Gigabit Ethernet cards!
+8. Link Monitoring
+==================
 
-3.  How many bonding devices can I have?
+	The bonding driver at present supports two schemes for
+monitoring a slave device's link state: the ARP monitor and the MII
+monitor.
+
+	At the present time, due to implementation restrictions in the
+bonding driver itself, it is not possible to enable both ARP and MII
+monitoring simultaneously.
+
+8.1 ARP Monitor Operation
+-------------------------
+
+	The ARP monitor operates as its name suggests: it sends ARP
+queries to one or more designated peer systems on the network, and
+uses the response as an indication that the link is operating.  This
+gives some assurance that traffic is actually flowing to and from one
+or more peers on the local network.
+
+	The ARP monitor relies on the device driver itself to verify
+that traffic is flowing.  In particular, the driver must keep up to
+date the last receive time, dev->last_rx, and transmit start time,
+dev->trans_start.  If these are not updated by the driver, then the
+ARP monitor will immediately fail any slaves using that driver, and
+those slaves will stay down.  If networking monitoring (tcpdump, etc)
+shows the ARP requests and replies on the network, then it may be that
+your device driver is not updating last_rx and trans_start.
 
-	There is no limit.
+8.2 Configuring Multiple ARP Targets
+------------------------------------
 
-4.  How many slaves can a bonding device have?
+	While ARP monitoring can be done with just one target, it can
+be useful in a High Availability setup to have several targets to
+monitor.  In the case of just one target, the target itself may go
+down or have a problem making it unresponsive to ARP requests.  Having
+an additional target (or several) increases the reliability of the ARP
+monitoring.
 
-	Limited by the number of network interfaces Linux supports and/or the
-	number of network cards you can place in your system.
+	Multiple ARP targets must be seperated by commas as follows:
 
-5.  What happens when a slave link dies?
+# example options for ARP monitoring with three targets
+alias bond0 bonding
+options bond0 arp_interval=60 arp_ip_target=192.168.0.1,192.168.0.3,192.168.0.9
 
-	If your ethernet cards support MII or ETHTOOL link status monitoring
-        and the MII monitoring has been enabled in the driver (see description
-        of module parameters), there will be no adverse consequences. This
-        release of the bonding driver knows how to get the MII information and
-	enables or disables its slaves according to their link status.
-	See section on High Availability for additional information.
-
-	For ethernet cards not supporting MII status, the arp_interval and
-        arp_ip_target parameters must be specified for bonding to work
-        correctly. If packets have not been sent or received during the
-        specified arp_interval duration, an ARP request is sent to the
-        targets to generate send and receive traffic. If after this
-        interval, either the successful send and/or receive count has not
-        incremented, the next slave in the sequence will become the active
-        slave.
-
-	If neither mii_monitor and arp_interval is configured, the bonding
-	driver will not handle this situation very well. The driver will
-	continue to send packets but some packets will be lost. Retransmits
-	will cause serious degradation of performance (in the case when one
-	of two slave links fails, 50% packets will be lost, which is a serious
-	problem for both TCP and UDP).
+	For just a single target the options would resemble:
 
-6.  Can bonding be used for High Availability?
+# example options for ARP monitoring with one target
+alias bond0 bonding
+options bond0 arp_interval=60 arp_ip_target=192.168.0.100
 
-        Yes, if you use MII monitoring and ALL your cards support MII link
-        status reporting. See section on High Availability for more
-        information.
 
-7.  Which switches/systems does it work with?
+8.3 MII Monitor Operation
+-------------------------
 
-	In round-robin and XOR mode, it works with systems that support
-	trunking:
+	The MII monitor monitors only the carrier state of the local
+network interface.  It accomplishes this in one of three ways: by
+depending upon the device driver to maintain its carrier state, by
+querying the device's MII registers, or by making an ethtool query to
+the device.
+
+	If the use_carrier module parameter is 1 (the default value),
+then the MII monitor will rely on the driver for carrier state
+information (via the netif_carrier subsystem).  As explained in the
+use_carrier parameter information, above, if the MII monitor fails to
+detect carrier loss on the device (e.g., when the cable is physically
+disconnected), it may be that the driver does not support
+netif_carrier.
+
+	If use_carrier is 0, then the MII monitor will first query the
+device's (via ioctl) MII registers and check the link state.  If that
+request fails (not just that it returns carrier down), then the MII
+monitor will make an ethtool ETHOOL_GLINK request to attempt to obtain
+the same information.  If both methods fail (i.e., the driver either
+does not support or had some error in processing both the MII register
+and ethtool requests), then the MII monitor will assume the link is
+up.
 
-	* Many Cisco switches and routers (look for EtherChannel support).
-	* SunTrunking software.
-	* Alteon AceDirector switches / WebOS (use Trunks).
-	* BayStack Switches (trunks must be explicitly configured). Stackable
-	  models (450) can define trunks between ports on different physical
-	  units.
-	* Linux bonding, of course !
-
-	In 802.3ad mode, it works with with systems that support IEEE 802.3ad
-	Dynamic Link Aggregation:
-
-	* Extreme networks Summit 7i (look for link-aggregation).
-	* Many Cisco switches and routers (look for LACP support; this may
-	  require an upgrade to your IOS software; LACP support was added
-	  by Cisco in late 2002).
-	* Foundry Big Iron 4000
+9. Potential Sources of Trouble
+===============================
 
-        In active-backup, balance-tlb and balance-alb modes, it should work
-        with any Layer-II switch.
+9.1 Adventures in Routing
+-------------------------
 
+	When bonding is configured, it is important that the slave
+devices not have routes that supercede routes of the master (or,
+generally, not have routes at all).  For example, suppose the bonding
+device bond0 has two slaves, eth0 and eth1, and the routing table is
+as follows:
 
-8.  Where does a bonding device get its MAC address from?
+Kernel IP routing table
+Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
+10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 eth0
+10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 eth1
+10.0.0.0        0.0.0.0         255.255.0.0     U        40 0          0 bond0
+127.0.0.0       0.0.0.0         255.0.0.0       U        40 0          0 lo
 
-	If not explicitly configured with ifconfig, the MAC address of the
-	bonding device is taken from its first slave device. This MAC address
-	is then passed to all following slaves and remains persistent (even if
-	the the first slave is removed) until the bonding device is brought
-	down or reconfigured.
+	This routing configuration will likely still update the
+receive/transmit times in the driver (needed by the ARP monitor), but
+may bypass the bonding driver (because outgoing traffic to, in this
+case, another host on network 10 would use eth0 or eth1 before bond0).
+
+	The ARP monitor (and ARP itself) may become confused by this
+configuration, because ARP requests (generated by the ARP monitor)
+will be sent on one interface (bond0), but the corresponding reply
+will arrive on a different interface (eth0).  This reply looks to ARP
+as an unsolicited ARP reply (because ARP matches replies on an
+interface basis), and is discarded.  The MII monitor is not affected
+by the state of the routing table.
+
+	The solution here is simply to insure that slaves do not have
+routes of their own, and if for some reason they must, those routes do
+not supercede routes of their master.  This should generally be the
+case, but unusual configurations or errant manual or automatic static
+route additions may cause trouble.
 
-	If you wish to change the MAC address, you can set it with ifconfig:
+9.2 Ethernet Device Renaming
+----------------------------
 
-	  # ifconfig bond0 hw ether 00:11:22:33:44:55
+	On systems with network configuration scripts that do not
+associate physical devices directly with network interface names (so
+that the same physical device always has the same "ethX" name), it may
+be necessary to add some special logic to either /etc/modules.conf or
+/etc/modprobe.conf (depending upon which is installed on the system).
 
-	The MAC address can be also changed by bringing down/up the device
-	and then changing its slaves (or their order):
+	For example, given a modules.conf containing the following:
 
-	  # ifconfig bond0 down ; modprobe -r bonding
-	  # ifconfig bond0 .... up
-	  # ifenslave bond0 eth...
+alias bond0 bonding
+options bond0 mode=some-mode miimon=50
+alias eth0 tg3
+alias eth1 tg3
+alias eth2 e1000
+alias eth3 e1000
+
+	If neither eth0 and eth1 are slaves to bond0, then when the
+bond0 interface comes up, the devices may end up reordered.  This
+happens because bonding is loaded first, then its slave device's
+drivers are loaded next.  Since no other drivers have been loaded,
+when the e1000 driver loads, it will receive eth0 and eth1 for its
+devices, but the bonding configuration tries to enslave eth2 and eth3
+(which may later be assigned to the tg3 devices).
+
+	Adding the following:
+
+add above bonding e1000 tg3
+
+	causes modprobe to load e1000 then tg3, in that order, when
+bonding is loaded.  This command is fully documented in the
+modules.conf manual page.
+
+	On systems utilizing modprobe.conf (or modprobe.conf.local),
+an equivalent problem can occur.  In this case, the following can be
+added to modprobe.conf (or modprobe.conf.local, as appropriate), as
+follows (all on one line; it has been split here for clarity):
+
+install bonding /sbin/modprobe tg3; /sbin/modprobe e1000;
+	/sbin/modprobe --ignore-install bonding
+
+	This will, when loading the bonding module, rather than
+performing the normal action, instead execute the provided command.
+This command loads the device drivers in the order needed, then calls
+modprobe with --ingore-install to cause the normal action to then take
+place.  Full documentation on this can be found in the modprobe.conf
+and modprobe manual pages.
+
+9.3. Painfully Slow Or No Failed Link Detection By Miimon
+---------------------------------------------------------
+
+	By default, bonding enables the use_carrier option, which
+instructs bonding to trust the driver to maintain carrier state.
+
+	As discussed in the options section, above, some drivers do
+not support the netif_carrier_on/_off link state tracking system.
+With use_carrier enabled, bonding will always see these links as up,
+regardless of their actual state.
+
+	Additionally, other drivers do support netif_carrier, but do
+not maintain it in real time, e.g., only polling the link state at
+some fixed interval.  In this case, miimon will detect failures, but
+only after some long period of time has expired.  If it appears that
+miimon is very slow in detecting link failures, try specifying
+use_carrier=0 to see if that improves the failure detection time.  If
+it does, then it may be that the driver checks the carrier state at a
+fixed interval, but does not cache the MII register values (so the
+use_carrier=0 method of querying the registers directly works).  If
+use_carrier=0 does not improve the failover, then the driver may cache
+the registers, or the problem may be elsewhere.
+
+	Also, remember that miimon only checks for the device's
+carrier state.  It has no way to determine the state of devices on or
+beyond other ports of a switch, or if a switch is refusing to pass
+traffic while still maintaining carrier on.
+
+10. SNMP agents
+===============
+
+	If running SNMP agents, the bonding driver should be loaded
+before any network drivers participating in a bond.  This requirement
+is due to the the interface index (ipAdEntIfIndex) being associated to
+the first interface found with a given IP address.  That is, there is
+only one ipAdEntIfIndex for each IP address.  For example, if eth0 and
+eth1 are slaves of bond0 and the driver for eth0 is loaded before the
+bonding driver, the interface for the IP address will be associated
+with the eth0 interface.  This configuration is shown below, the IP
+address 192.168.1.1 has an interface index of 2 which indexes to eth0
+in the ifDescr table (ifDescr.2).
 
-	This method will automatically take the address from the next slave
-	that will be added.
+     interfaces.ifTable.ifEntry.ifDescr.1 = lo
+     interfaces.ifTable.ifEntry.ifDescr.2 = eth0
+     interfaces.ifTable.ifEntry.ifDescr.3 = eth1
+     interfaces.ifTable.ifEntry.ifDescr.4 = eth2
+     interfaces.ifTable.ifEntry.ifDescr.5 = eth3
+     interfaces.ifTable.ifEntry.ifDescr.6 = bond0
+     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 5
+     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
+     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 4
+     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
 
-	To restore your slaves' MAC addresses, you need to detach them
-	from the bond (`ifenslave -d bond0 eth0'). The bonding driver will then
-	restore the MAC addresses that the slaves had before they were enslaved.
+	This problem is avoided by loading the bonding driver before
+any network drivers participating in a bond.  Below is an example of
+loading the bonding driver first, the IP address 192.168.1.1 is
+correctly associated with ifDescr.2.
 
-9.  Which transmit polices can be used?
+     interfaces.ifTable.ifEntry.ifDescr.1 = lo
+     interfaces.ifTable.ifEntry.ifDescr.2 = bond0
+     interfaces.ifTable.ifEntry.ifDescr.3 = eth0
+     interfaces.ifTable.ifEntry.ifDescr.4 = eth1
+     interfaces.ifTable.ifEntry.ifDescr.5 = eth2
+     interfaces.ifTable.ifEntry.ifDescr.6 = eth3
+     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.10.10.10 = 6
+     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.192.168.1.1 = 2
+     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.10.74.20.94 = 5
+     ip.ipAddrTable.ipAddrEntry.ipAdEntIfIndex.127.0.0.1 = 1
 
-	Round-robin, based on the order of enslaving, the output device
-	is selected base on the next available slave. Regardless of
-	the source and/or destination of the packet.
+	While some distributions may not report the interface name in
+ifDescr, the association between the IP address and IfIndex remains
+and SNMP functions such as Interface_Scan_Next will report that
+association.
 
-	Active-backup policy that ensures that one and only one device will
-	transmit at any given moment. Active-backup policy is useful for
-	implementing high availability solutions using two hubs (see
-	section on High Availability).
+11. Promiscuous mode
+====================
 
-	XOR, based on (src hw addr XOR dst hw addr) % slave count. This
-	policy selects the same slave for each destination hw address.
+	When running network monitoring tools, e.g., tcpdump, it is
+common to enable promiscuous mode on the device, so that all traffic
+is seen (instead of seeing only traffic destined for the local host).
+The bonding driver handles promiscuous mode changes to the bonding
+master device (e.g., bond0), and propogates the setting to the slave
+devices.
+
+	For the balance-rr, balance-xor, broadcast, and 802.3ad modes,
+the promiscuous mode setting is propogated to all slaves.
+
+	For the active-backup, balance-tlb and balance-alb modes, the
+promiscuous mode setting is propogated only to the active slave.
+
+	For balance-tlb mode, the active slave is the slave currently
+receiving inbound traffic.
+
+	For balance-alb mode, the active slave is the slave used as a
+"primary."  This slave is used for mode-specific control traffic, for
+sending to peers that are unassigned or if the load is unbalanced.
+
+	For the active-backup, balance-tlb and balance-alb modes, when
+the active slave changes (e.g., due to a link failure), the
+promiscuous setting will be propogated to the new active slave.
+
+12. High Availability Information
+=================================
+
+	High Availability refers to configurations that provide
+maximum network availability by having redundant or backup devices,
+links and switches between the host and the rest of the world.
+
+	There are currently two basic methods for configuring to
+maximize availability. They are dependent on the network topology and
+the primary goal of the configuration, but in general, a configuration
+can be optimized for maximum available bandwidth, or for maximum
+network availability.
+
+12.1 High Availability in a Single Switch Topology
+--------------------------------------------------
+
+	If two hosts (or a host and a switch) are directly connected
+via multiple physical links, then there is no network availability
+penalty for optimizing for maximum bandwidth: there is only one switch
+(or peer), so if it fails, you have no alternative access to fail over
+to.
 
-	Broadcast policy transmits everything on all slave interfaces.
+Example 1 : host to switch (or other host)
 
-	802.3ad, based on XOR but distributes traffic among all interfaces
-	in the active aggregator.
+          +----------+                          +----------+
+          |          |eth0                  eth0|  switch  |
+          | Host A   +--------------------------+    or    |
+          |          +--------------------------+  other   |
+          |          |eth1                  eth1|  host    |
+          +----------+                          +----------+
 
-	Transmit load balancing (balance-tlb) balances the traffic
-	according to the current load on each slave. The balancing is
-	clients based and the least loaded slave is selected for each new
-	client. The load of each slave is calculated relative to its speed
-	and enables load balancing in mixed speed teams.
 
-	Adaptive load balancing (balance-alb) uses the Transmit load
-	balancing for the transmit load. The receive load is balanced only
-	among the group of highest speed active slaves in the bond. The
-	load is distributed with round-robin i.e. next available slave in
-	the high speed group of active slaves.
+12.1.1 Bonding Mode Selection for single switch topology
+--------------------------------------------------------
 
-High Availability
-=================
+	This configuration is the easiest to set up and to understand,
+although you will have to decide which bonding mode best suits your
+needs.  The tradeoffs for each mode are detailed below:
+
+balance-rr: This mode is the only mode that will permit a single
+	TCP/IP connection to stripe traffic across multiple
+	interfaces. It is therefore the only mode that will allow a
+	single TCP/IP stream to utilize more than one interface's
+	worth of throughput.  This comes at a cost, however: the
+	striping often results in peer systems receiving packets out
+	of order, causing TCP/IP's congestion control system to kick
+	in, often by retransmitting segments.
+
+	It is possible to adjust TCP/IP's congestion limits by
+	altering the net.ipv4.tcp_reordering sysctl parameter.  The
+	usual default value is 3, and the maximum useful value is 127.
+	For a four interface balance-rr bond, expect that a single
+	TCP/IP stream will utilize no more than approximately 2.3
+	interface's worth of throughput, even after adjusting
+	tcp_reordering.
+
+	If you are utilizing protocols other than TCP/IP, UDP for
+	example, and your application can tolerate out of order
+	delivery, then this mode can allow for single stream datagram
+	performance that scales near linearly as interfaces are added
+	to the bond.
+
+	This mode requires the switch to have the appropriate ports
+	configured for "etherchannel" or "trunking."
+
+active-backup: There is not much advantage in this network topology to
+	the active-backup mode, as the inactive backup devices are all
+	connected to the same peer as the primary.  In this case, a
+	load balancing mode (with link monitoring) will provide the
+	same level of network availability, but with increased
+	available bandwidth.  On the plus side, it does not require
+	any configuration of the switch.
+
+balance-xor: This mode will limit traffic such that packets destined
+	for specific peers will always be sent over the same
+	interface.  Since the destination is determined by the MAC
+	addresses involved, this may be desirable if you have a large
+	network with many hosts.  It is likely to be suboptimal if all
+	your traffic is passed through a single router, however.  As
+	with balance-rr, the switch ports need to be configured for
+	"etherchannel" or "trunking."
+
+broadcast: Like active-backup, there is not much advantage to this
+	mode in this type of network topology.
+
+802.3ad: This mode can be a good choice for this type of network
+	topology.  The 802.3ad mode is an IEEE standard, so all peers
+	that implement 802.3ad should interoperate well.  The 802.3ad
+	protocol includes automatic configuration of the aggregates,
+	so minimal manual configuration of the switch is needed
+	(typically only to designate that some set of devices is
+	usable for 802.3ad).  The 802.3ad standard also mandates that
+	frames be delivered in order (within certain limits), so in
+	general single connections will not see misordering of
+	packets.  The 802.3ad mode does have some drawbacks: the
+	standard mandates that all devices in the aggregate operate at
+	the same speed and duplex.  Also, as with all bonding load
+	balance modes other than balance-rr, no single connection will
+	be able to utilize more than a single interface's worth of
+	bandwidth.  Additionally, the linux bonding 802.3ad
+	implementation distributes traffic by peer (using an XOR of
+	MAC addresses), so in general all traffic to a particular
+	destination will use the same interface.  Finally, the 802.3ad
+	mode mandates the use of the MII monitor, therefore, the ARP
+	monitor is not available in this mode.
+
+balance-tlb: This mode is also a good choice for this type of
+	topology.  It has no special switch configuration
+	requirements, and balances outgoing traffic by peer, in a
+	vaguely intelligent manner (not a simple XOR as in balance-xor
+	or 802.3ad mode), so that unlucky MAC addresses will not all
+	"bunch up" on a single interface.  Interfaces may be of
+	differing speeds.  On the down side, in this mode all incoming
+	traffic arrives over a single interface, this mode requires
+	certain ethtool support in the network device driver of the
+	slave interfaces, and the ARP monitor is not available.
+
+balance-alb: This mode is everything that balance-tlb is, and more. It
+	has all of the features (and restrictions) of balance-tlb, and
+	will also balance incoming traffic from peers (as described in
+	the Bonding Module Options section, above).  The only extra
+	down side to this mode is that the network device driver must
+	support changing the hardware address while the device is
+	open.
+
+12.1.2 Link Monitoring for Single Switch Topology
+-------------------------------------------------
+
+	The choice of link monitoring may largely depend upon which
+mode you choose to use.  The more advanced load balancing modes do not
+support the use of the ARP monitor, and are thus restricted to using
+the MII monitor (which does not provide as high a level of assurance
+as the ARP monitor).
+
+
+12.2 High Availability in a Multiple Switch Topology
+----------------------------------------------------
+
+	With multiple switches, the configuration of bonding and the
+network changes dramatically.  In multiple switch topologies, there is
+a tradeoff between network availability and usable bandwidth.
 
-To implement high availability using the bonding driver, the driver needs to be
-compiled as a module, because currently it is the only way to pass parameters
-to the driver. This may change in the future.
-
-High availability is achieved by using MII or ETHTOOL status reporting. You
-need to verify that all your interfaces support MII or ETHTOOL link status
-reporting.  On Linux kernel 2.2.17, all the 100 Mbps capable drivers and
-yellowfin gigabit driver support MII. To determine if ETHTOOL link reporting
-is available for interface eth0, type "ethtool eth0" and the "Link detected:"
-line should contain the correct link status. If your system has an interface
-that does not support MII or ETHTOOL status reporting, a failure of its link
-will not be detected! A message indicating MII and ETHTOOL is not supported by
-a network driver is logged when the bonding driver is loaded with a non-zero
-miimon value.
-
-The bonding driver can regularly check all its slaves links using the ETHTOOL
-IOCTL (ETHTOOL_GLINK command) or by checking the MII status registers. The
-check interval is specified by the module argument "miimon" (MII monitoring).
-It takes an integer that represents the checking time in milliseconds. It
-should not come to close to (1000/HZ) (10 milli-seconds on i386) because it
-may then reduce the system interactivity. A value of 100 seems to be a good
-starting point. It means that a dead link will be detected at most 100
-milli-seconds after it goes down.
-
-Example:
-
-   # modprobe bonding miimon=100
-
-Or, put the following line in /etc/modprobe.conf:
-
-   options bond0 miimon=100
-
-There are currently two policies for high availability. They are dependent on
-whether:
-
-   a) hosts are connected to a single host or switch that support trunking
-
-   b) hosts are connected to several different switches or a single switch that
-      does not support trunking
-
-
-1) High Availability on a single switch or host - load balancing
-----------------------------------------------------------------
-It is the easiest to set up and to understand. Simply configure the
-remote equipment (host or switch) to aggregate traffic over several
-ports (Trunk, EtherChannel, etc.) and configure the bonding interfaces.
-If the module has been loaded with the proper MII option, it will work
-automatically. You can then try to remove and restore different links
-and see in your logs what the driver detects. When testing, you may
-encounter problems on some buggy switches that disable the trunk for a
-long time if all ports in a trunk go down. This is not Linux, but really
-the switch (reboot it to ensure).
+	Below is a sample network, configured to maximize the
+availability of the network:
 
-Example 1 : host to host at twice the speed
+                |                                     |
+                |port3                           port3|
+          +-----+----+                          +-----+----+
+          |          |port2       ISL      port2|          |
+          | switch A +--------------------------+ switch B |
+          |          |                          |          |
+          +-----+----+                          +-----++---+
+                |port1                           port1|
+                |             +-------+               |
+                +-------------+ host1 +---------------+
+                         eth0 +-------+ eth1
 
-          +----------+                          +----------+
-          |          |eth0                  eth0|          |
-          | Host A   +--------------------------+  Host B  |
-          |          +--------------------------+          |
-          |          |eth1                  eth1|          |
-          +----------+                          +----------+
+	In this configuration, there is a link between the two
+switches (ISL, or inter switch link), and multiple ports connecting to
+the outside world ("port3" on each switch).  There is no technical
+reason that this could not be extended to a third switch.
+
+12.2.1 Bonding Mode Selection for Multiple Switch Topology
+----------------------------------------------------------
+
+	In a topology such as this, the active-backup and broadcast
+modes are the only useful bonding modes; the other modes require all
+links to terminate on the same peer for them to behave rationally.
+
+active-backup: This is generally the preferred mode, particularly if
+	the switches have an ISL and play together well.  If the
+	network configuration is such that one switch is specifically
+	a backup switch (e.g., has lower capacity, higher cost, etc),
+	then the primary option can be used to insure that the
+	preferred link is always used when it is available.
+
+broadcast: This mode is really a special purpose mode, and is suitable
+	only for very specific needs.  For example, if the two
+	switches are not connected (no ISL), and the networks beyond
+	them are totally independant.  In this case, if it is
+	necessary for some specific one-way traffic to reach both
+	independent networks, then the broadcast mode may be suitable.
+
+12.2.2 Link Monitoring Selection for Multiple Switch Topology
+-------------------------------------------------------------
+
+	The choice of link monitoring ultimately depends upon your
+switch.  If the switch can reliably fail ports in response to other
+failures, then either the MII or ARP monitors should work.  For
+example, in the above example, if the "port3" link fails at the remote
+end, the MII monitor has no direct means to detect this.  The ARP
+monitor could be configured with a target at the remote end of port3,
+thus detecting that failure without switch support.
+
+	In general, however, in a multiple switch topology, the ARP
+monitor can provide a higher level of reliability in detecting link
+failures.  Additionally, it should be configured with multiple targets
+(at least one for each switch in the network).  This will insure that,
+regardless of which switch is active, the ARP monitor has a suitable
+target to query.
+
+
+12.3 Switch Behavior Issues for High Availability
+-------------------------------------------------
+
+	You may encounter issues with the timing of link up and down
+reporting by the switch.
+
+	First, when a link comes up, some switches may indicate that
+the link is up (carrier available), but not pass traffic over the
+interface for some period of time.  This delay is typically due to
+some type of autonegotiation or routing protocol, but may also occur
+during switch initialization (e.g., during recovery after a switch
+failure).  If you find this to be a problem, specify an appropriate
+value to the updelay bonding module option to delay the use of the
+relevant interface(s).
+
+	Second, some switches may "bounce" the link state one or more
+times while a link is changing state.  This occurs most commonly while
+the switch is initializing.  Again, an appropriate updelay value may
+help, but note that if all links are down, then updelay is ignored
+when any link becomes active (the slave closest to completing its
+updelay is chosen).
+
+	Note that when a bonding interface has no active links, the
+driver will immediately reuse the first link that goes up, even if
+updelay parameter was specified.  If there are slave interfaces
+waiting for the updelay timeout to expire, the interface that first
+went into that state will be immediately reused.  This reduces down
+time of the network if the value of updelay has been overestimated.
+
+	In addition to the concerns about switch timings, if your
+switches take a long time to go into backup mode, it may be desirable
+to not activate a backup interface immediately after a link goes down.
+Failover may be delayed via the downdelay bonding module option.
+
+13. Hardware Specific Considerations
+====================================
+
+	This section contains additional information for configuring
+bonding on specific hardware platforms, or for interfacing bonding
+with particular switches or other devices.
+
+13.1 IBM BladeCenter
+--------------------
+
+	This applies to the JS20 and similar systems.
+
+	On the JS20 blades, the bonding driver supports only
+balance-rr, active-backup, balance-tlb and balance-alb modes.  This is
+largely due to the network topology inside the BladeCenter, detailed
+below.
+
+JS20 network adapter information
+--------------------------------
+
+	All JS20s come with two Broadcom Gigabit Ethernet ports
+integrated on the planar.  In the BladeCenter chassis, the eth0 port
+of all JS20 blades is hard wired to I/O Module #1; similarly, all eth1
+ports are wired to I/O Module #2.  An add-on Broadcom daughter card
+can be installed on a JS20 to provide two more Gigabit Ethernet ports.
+These ports, eth2 and eth3, are wired to I/O Modules 3 and 4,
+respectively.
+
+	Each I/O Module may contain either a switch or a passthrough
+module (which allows ports to be directly connected to an external
+switch).  Some bonding modes require a specific BladeCenter internal
+network topology in order to function; these are detailed below.
 
-  On each host :
-     # modprobe bonding miimon=100
-     # ifconfig bond0 addr
-     # ifenslave bond0 eth0 eth1
+	Additional BladeCenter-specific networking information can be
+found in two IBM Redbooks (www.ibm.com/redbooks):
 
-Example 2 : host to switch at twice the speed
+"IBM eServer BladeCenter Networking Options"
+"IBM eServer BladeCenter Layer 2-7 Network Switching"
 
-          +----------+                          +----------+
-          |          |eth0                 port1|          |
-          | Host A   +--------------------------+  switch  |
-          |          +--------------------------+          |
-          |          |eth1                 port2|          |
-          +----------+                          +----------+
+BladeCenter networking configuration
+------------------------------------
 
-  On host A :                             On the switch :
-     # modprobe bonding miimon=100           # set up a trunk on port1
-     # ifconfig bond0 addr                     and port2
-     # ifenslave bond0 eth0 eth1
+	Because a BladeCenter can be configured in a very large number
+of ways, this discussion will be confined to describing basic
+configurations.
+
+	Normally, Ethernet Switch Modules (ESM) are used in I/O
+modules 1 and 2.  In this configuration, the eth0 and eth1 ports of a
+JS20 will be connected to different internal switches (in the
+respective I/O modules).
+
+	An optical passthru module (OPM) connects the I/O module
+directly to an external switch.  By using OPMs in I/O module #1 and
+#2, the eth0 and eth1 interfaces of a JS20 can be redirected to the
+outside world and connected to a common external switch.
+
+	Depending upon the mix of ESM and OPM modules, the network
+will appear to bonding as either a single switch topology (all OPM
+modules) or as a multiple switch topology (one or more ESM modules,
+zero or more OPM modules).  It is also possible to connect ESM modules
+together, resulting in a configuration much like the example in "High
+Availability in a multiple switch topology."
+
+Requirements for specifc modes
+------------------------------
+
+	The balance-rr mode requires the use of OPM modules for
+devices in the bond, all connected to an common external switch.  That
+switch must be configured for "etherchannel" or "trunking" on the
+appropriate ports, as is usual for balance-rr.
+
+	The balance-alb and balance-tlb modes will function with
+either switch modules or passthrough modules (or a mix).  The only
+specific requirement for these modes is that all network interfaces
+must be able to reach all destinations for traffic sent over the
+bonding device (i.e., the network must converge at some point outside
+the BladeCenter).
+
+	The active-backup mode has no additional requirements.
+
+Link monitoring issues
+----------------------
+
+	When an Ethernet Switch Module is in place, only the ARP
+monitor will reliably detect link loss to an external switch.  This is
+nothing unusual, but examination of the BladeCenter cabinet would
+suggest that the "external" network ports are the ethernet ports for
+the system, when it fact there is a switch between these "external"
+ports and the devices on the JS20 system itself.  The MII monitor is
+only able to detect link failures between the ESM and the JS20 system.
+
+	When a passthrough module is in place, the MII monitor does
+detect failures to the "external" port, which is then directly
+connected to the JS20 system.
+
+Other concerns
+--------------
+
+	The Serial Over LAN link is established over the primary
+ethernet (eth0) only, therefore, any loss of link to eth0 will result
+in losing your SoL connection.  It will not fail over with other
+network traffic.
+
+	It may be desirable to disable spanning tree on the switch
+(either the internal Ethernet Switch Module, or an external switch) to
+avoid fail-over delays issues when using bonding.
+
+	
+14. Frequently Asked Questions
+==============================
 
+1.  Is it SMP safe?
 
-2) High Availability on two or more switches (or a single switch without
-   trunking support)
----------------------------------------------------------------------------
-This mode is more problematic because it relies on the fact that there
-are multiple ports and the host's MAC address should be visible on one
-port only to avoid confusing the switches.
+	Yes. The old 2.0.xx channel bonding patch was not SMP safe.
+The new driver was designed to be SMP safe from the start.
 
-If you need to know which interface is the active one, and which ones are
-backup, use ifconfig. All backup interfaces have the NOARP flag set.
+2.  What type of cards will work with it?
 
-To use this mode, pass "mode=1" to the module at load time :
+	Any Ethernet type cards (you can even mix cards - a Intel
+EtherExpress PRO/100 and a 3com 3c905b, for example).  They need not
+be of the same speed.
 
-    # modprobe bonding miimon=100 mode=active-backup
+3.  How many bonding devices can I have?
 
-	or:
+	There is no limit.
 
-    # modprobe bonding miimon=100 mode=1
+4.  How many slaves can a bonding device have?
 
-Or, put in your /etc/modprobe.conf :
+	This is limited only by the number of network interfaces Linux
+supports and/or the number of network cards you can place in your
+system.
 
-    options bond0 miimon=100 mode=active-backup
+5.  What happens when a slave link dies?
 
-Example 1: Using multiple host and multiple switches to build a "no single
-point of failure" solution.
+	If link monitoring is enabled, then the failing device will be
+disabled.  The active-backup mode will fail over to a backup link, and
+other modes will ignore the failed link.  The link will continue to be
+monitored, and should it recover, it will rejoin the bond (in whatever
+manner is appropriate for the mode). See the section on High
+Availability for additional information.
+	
+	Link monitoring can be enabled via either the miimon or
+arp_interval paramters (described in the module paramters section,
+above).  In general, miimon monitors the carrier state as sensed by
+the underlying network device, and the arp monitor (arp_interval)
+monitors connectivity to another host on the local network.
+
+	If no link monitoring is configured, the bonding driver will
+be unable to detect link failures, and will assume that all links are
+always available.  This will likely result in lost packets, and a
+resulting degredation of performance.  The precise performance loss
+depends upon the bonding mode and network configuration.
 
+6.  Can bonding be used for High Availability?
 
-                |                                     |
-                |port3                           port3|
-          +-----+----+                          +-----+----+
-          |          |port7       ISL      port7|          |
-          | switch A +--------------------------+ switch B |
-          |          +--------------------------+          |
-          |          |port8                port8|          |
-          +----++----+                          +-----++---+
-          port2||port1                           port1||port2
-               ||             +-------+               ||
-               |+-------------+ host1 +---------------+|
-               |         eth0 +-------+ eth1           |
-               |                                       |
-               |              +-------+                |
-               +--------------+ host2 +----------------+
-                         eth0 +-------+ eth1
+	Yes.  See the section on High Availability for details.
 
-In this configuration, there is an ISL - Inter Switch Link (could be a trunk),
-several servers (host1, host2 ...) attached to both switches each, and one or
-more ports to the outside world (port3...). One and only one slave on each host
-is active at a time, while all links are still monitored (the system can
-detect a failure of active and backup links).
-
-Each time a host changes its active interface, it sticks to the new one until
-it goes down. In this example, the hosts are negligibly affected by the
-expiration time of the switches' forwarding tables.
-
-If host1 and host2 have the same functionality and are used in load balancing
-by another external mechanism, it is good to have host1's active interface
-connected to one switch and host2's to the other. Such system will survive
-a failure of a single host, cable, or switch. The worst thing that may happen
-in the case of a switch failure is that half of the hosts will be temporarily
-unreachable until the other switch expires its tables.
+7.  Which switches/systems does it work with?
 
-Example 2: Using multiple ethernet cards connected to a switch to configure
-           NIC failover (switch is not required to support trunking).
+	The full answer to this depends upon the desired mode.
 
+	In the basic balance modes (balance-rr and balance-xor), it
+works with any system that supports etherchannel (also called
+trunking).  Most managed switches currently available have such
+support, and many unmananged switches as well.
+
+	The advanced balance modes (balance-tlb and balance-alb) do
+not have special switch requirements, but do need device drivers that
+support specific features (described in the appropriate section under
+module paramters, above).
+
+	In 802.3ad mode, it works with with systems that support IEEE
+802.3ad Dynamic Link Aggregation.  Most managed and many unmanaged
+switches currently available support 802.3ad.
 
-          +----------+                          +----------+
-          |          |eth0                 port1|          |
-          | Host A   +--------------------------+  switch  |
-          |          +--------------------------+          |
-          |          |eth1                 port2|          |
-          +----------+                          +----------+
+        The active-backup mode should work with any Layer-II switch.
 
-  On host A :                                 On the switch :
-     # modprobe bonding miimon=100 mode=1     # (optional) minimize the time
-     # ifconfig bond0 addr                    # for table expiration
-     # ifenslave bond0 eth0 eth1
+8.  Where does a bonding device get its MAC address from?
 
-Each time the host changes its active interface, it sticks to the new one until
-it goes down. In this example, the host is strongly affected by the expiration
-time of the switch forwarding table.
+	If not explicitly configured with ifconfig, the MAC address of
+the bonding device is taken from its first slave device. This MAC
+address is then passed to all following slaves and remains persistent
+(even if the the first slave is removed) until the bonding device is
+brought down or reconfigured.
+
+	If you wish to change the MAC address, you can set it with
+ifconfig:
+
+# ifconfig bond0 hw ether 00:11:22:33:44:55
+
+	The MAC address can be also changed by bringing down/up the
+device and then changing its slaves (or their order):
+
+# ifconfig bond0 down ; modprobe -r bonding
+# ifconfig bond0 .... up
+# ifenslave bond0 eth...
 
+	This method will automatically take the address from the next
+slave that is added.
 
-3) Adapting to your switches' timing
-------------------------------------
-If your switches take a long time to go into backup mode, it may be
-desirable not to activate a backup interface immediately after a link goes
-down. It is possible to delay the moment at which a link will be
-completely disabled by passing the module parameter "downdelay" (in
-milliseconds, must be a multiple of miimon).
-
-When a switch reboots, it is possible that its ports report "link up" status
-before they become usable. This could fool a bond device by causing it to
-use some ports that are not ready yet. It is possible to delay the moment at
-which an active link will be reused by passing the module parameter "updelay"
-(in milliseconds, must be a multiple of miimon).
-
-A similar situation can occur when a host re-negotiates a lost link with the
-switch (a case of cable replacement).
-
-A special case is when a bonding interface has lost all slave links. Then the
-driver will immediately reuse the first link that goes up, even if updelay
-parameter was specified. (If there are slave interfaces in the "updelay" state,
-the interface that first went into that state will be immediately reused.) This
-allows to reduce down-time if the value of updelay has been overestimated.
-
-Examples :
-
-    # modprobe bonding miimon=100 mode=1 downdelay=2000 updelay=5000
-    # modprobe bonding miimon=100 mode=balance-rr downdelay=0 updelay=5000
-
-
-Promiscuous Sniffing notes
-==========================
-
-If you wish to bond channels together for a network sniffing
-application --- you wish to run tcpdump, or ethereal, or an IDS like
-snort, with its input aggregated from multiple interfaces using the
-bonding driver --- then you need to handle the Promiscuous interface
-setting by hand. Specifically, when you "ifconfing bond0 up" you
-must add the promisc flag there; it will be propagated down to the
-slave interfaces at ifenslave time; a full example might look like:
-
-   ifconfig bond0 promisc up
-   for if in eth1 eth2 ...;do
-       ifconfig $if up
-       ifenslave bond0 $if
-   done
-   snort ... -i bond0 ...
-
-Ifenslave also wants to propagate addresses from interface to
-interface, appropriately for its design functions in HA and channel
-capacity aggregating; but it works fine for unnumbered interfaces;
-just ignore all the warnings it emits.
+	To restore your slaves' MAC addresses, you need to detach them
+from the bond (`ifenslave -d bond0 eth0'). The bonding driver will
+then restore the MAC addresses that the slaves had before they were
+enslaved.
 
+15. Resources and Links
+=======================
 
-8021q VLAN support
-==================
+The latest version of the bonding driver can be found in the latest
+version of the linux kernel, found on http://kernel.org
 
-It is possible to configure VLAN devices over a bond interface using the 8021q
-driver. However, only packets coming from the 8021q driver and passing through
-bonding will be tagged by default. Self generated packets, like bonding's
-learning packets or ARP packets generated by either ALB mode or the ARP
-monitor mechanism, are tagged internally by bonding itself. As a result,
-bonding has to "learn" what VLAN IDs are configured on top of it, and it uses
-those IDs to tag self generated packets.
-
-For simplicity reasons, and to support the use of adapters that can do VLAN
-hardware acceleration offloding, the bonding interface declares itself as
-fully hardware offloaing capable, it gets the add_vid/kill_vid notifications
-to gather the necessary information, and it propagates those actions to the
-slaves.
-In case of mixed adapter types, hardware accelerated tagged packets that should
-go through an adapter that is not offloading capable are "un-accelerated" by the
-bonding driver so the VLAN tag sits in the regular location.
-
-VLAN interfaces *must* be added on top of a bonding interface only after
-enslaving at least one slave. This is because until the first slave is added the
-bonding interface has a HW address of 00:00:00:00:00:00, which will be copied by
-the VLAN interface when it is created.
-
-Notice that a problem would occur if all slaves are released from a bond that
-still has VLAN interfaces on top of it. When later coming to add new slaves, the
-bonding interface would get a HW address from the first slave, which might not
-match that of the VLAN interfaces. It is recommended that either all VLANs are
-removed and then re-added, or to manually set the bonding interface's HW
-address so it matches the VLAN's. (Note: changing a VLAN interface's HW address
-would set the underlying device -- i.e. the bonding interface -- to promiscouos
-mode, which might not be what you want).
-
-
-Limitations
-===========
-The main limitations are :
-  - only the link status is monitored. If the switch on the other side is
-    partially down (e.g. doesn't forward anymore, but the link is OK), the link
-    won't be disabled. Another way to check for a dead link could be to count
-    incoming frames on a heavily loaded host. This is not applicable to small
-    servers, but may be useful when the front switches send multicast
-    information on their links (e.g. VRRP), or even health-check the servers.
-    Use the arp_interval/arp_ip_target parameters to count incoming/outgoing
-    frames.
+Discussions regarding the bonding driver take place primarily on the
+bonding-devel mailing list, hosted at sourceforge.net.  If you have
+questions or problems, post them to the list.
 
+bonding-devel@lists.sourceforge.net
 
+https://lists.sourceforge.net/lists/listinfo/bonding-devel
 
-Resources and Links
-===================
+There is also a project site on sourceforge.
 
-Current development on this driver is posted to:
- - http://www.sourceforge.net/projects/bonding/
+http://www.sourceforge.net/projects/bonding
 
 Donald Becker's Ethernet Drivers and diag programs may be found at :
  - http://www.scyld.com/network/
 
-You will also find a lot of information regarding Ethernet, NWay, MII, etc. at
-www.scyld.com.
-
-Patches for 2.2 kernels are at Willy Tarreau's site :
- - http://wtarreau.free.fr/pub/bonding/
- - http://www-miaif.lip6.fr/~tarreau/pub/bonding/
-
-To get latest informations about Linux Kernel development, please consult
-the Linux Kernel Mailing List Archives at :
-   http://www.ussg.iu.edu/hypermail/linux/kernel/
+You will also find a lot of information regarding Ethernet, NWay, MII,
+etc. at www.scyld.com.
 
 -- END --
diff -Nru a/Documentation/networking/e100.txt b/Documentation/networking/e100.txt
--- a/Documentation/networking/e100.txt	2005-01-06 11:01:18 -08:00
+++ b/Documentation/networking/e100.txt	2005-03-02 20:57:20 -08:00
@@ -140,8 +140,7 @@
   NAPI
   ----
 
-  NAPI (Rx polling mode) is supported in the e100 driver. NAPI is enabled
-  or disabled based on the configuration of the kernel. 
+  NAPI (Rx polling mode) is supported in the e100 driver.
 
   See www.cyberus.ca/~hadi/usenix-paper.tgz for more information on NAPI.
 
diff -Nru a/Documentation/networking/ixgb.txt b/Documentation/networking/ixgb.txt
--- a/Documentation/networking/ixgb.txt	2004-10-07 15:51:47 -07:00
+++ b/Documentation/networking/ixgb.txt	2005-03-02 20:47:54 -08:00
@@ -1,7 +1,7 @@
 Linux* Base Driver for the Intel(R) PRO/10GbE Family of Adapters
 ================================================================
 
-September 13, 2004
+November 17, 2004
 
 
 Contents
@@ -18,8 +18,7 @@
 ===============
 
 This file describes the Linux* Base Driver for the Intel(R) PRO/10GbE Family 
-of Adapters, version 1.0.x.  This driver includes support for Itanium(TM)2 and
-EM64T systems.
+of Adapters, version 1.0.x.  
 
 For questions related to hardware requirements, refer to the documentation 
 supplied with your Intel PRO/10GbE adapter. All hardware requirements listed 
@@ -71,8 +70,8 @@
     Ethernet PAUSE frames.
 
 RxDescriptors
-Valid Range: 64-4096
-Default Value: 1024
+Valid Range: 64-512
+Default Value: 512
     This value is the number of receive descriptors allocated by the driver. 
     Increasing this value allows the driver to buffer more incoming packets. 
     Each descriptor is 16 bytes.  A receive buffer is also allocated for 
diff -Nru a/Documentation/pci.txt b/Documentation/pci.txt
--- a/Documentation/pci.txt	2004-11-18 01:09:06 -08:00
+++ b/Documentation/pci.txt	2005-02-07 13:58:21 -08:00
@@ -99,10 +99,10 @@
 Users need pass only as many fields as necessary; vendor, device,
 subvendor, and subdevice fields default to PCI_ANY_ID (FFFFFFFF),
 class and classmask fields default to 0, and driver_data defaults to
-0UL.  Device drivers must call
-   pci_dynids_set_use_driver_data(pci_driver *, 1)
-in order for the driver_data field to get passed to the driver.
-Otherwise, only a 0 is passed in that field.
+0UL.  Device drivers must initialize use_driver_data in the dynids struct
+in their pci_driver struct prior to calling pci_register_driver in order
+for the driver_data field to get passed to the driver. Otherwise, only a
+0 is passed in that field.
 
 When the driver exits, it just calls pci_unregister_driver() and the PCI layer
 automatically calls the remove hook for all devices handled by the driver.
diff -Nru a/Documentation/power/video.txt b/Documentation/power/video.txt
--- a/Documentation/power/video.txt	2004-10-18 22:26:46 -07:00
+++ b/Documentation/power/video.txt	2005-03-07 20:41:32 -08:00
@@ -1,7 +1,7 @@
 
 		Video issues with S3 resume
 		~~~~~~~~~~~~~~~~~~~~~~~~~~~
-		  2003-2004, Pavel Machek
+		  2003-2005, Pavel Machek
 
 During S3 resume, hardware needs to be reinitialized. For most
 devices, this is easy, and kernel driver knows how to do
@@ -11,33 +11,160 @@
 driver -- vesafb and vgacon are widely used).
 
 This is not problem for swsusp, because during swsusp resume, BIOS is
-run normally so video card is normally initialized.
+run normally so video card is normally initialized. S3 has absolutely
+no chance of working with SMP/HT. Be sure it to turn it off before
+testing (swsusp should work ok, OTOH).
 
-There are three types of systems where video works after S3 resume:
+There are a few types of systems where video works after S3 resume:
 
-* systems where video state is preserved over S3. (Athlon HP Omnibook xe3s)
+(1) systems where video state is preserved over S3.
 
-* systems where it is possible to call video bios during S3
-  resume. Unfortunately, it is not correct to call video BIOS at that
-  point, but it happens to work on some machines. Use
-  acpi_sleep=s3_bios (Athlon64 desktop system)
+(2) systems where it is possible to call the video BIOS during S3
+  resume. Unfortunately, it is not correct to call the video BIOS at
+  that point, but it happens to work on some machines. Use
+  acpi_sleep=s3_bios.
 
-* systems that initialize video card into vga text mode and where BIOS
-  works well enough to be able to set video mode. Use
-  acpi_sleep=s3_mode on these. (Toshiba 4030cdt)
+(3) systems that initialize video card into vga text mode and where
+  the BIOS works well enough to be able to set video mode. Use
+  acpi_sleep=s3_mode on these.
 
-* on some systems s3_bios kicks video into text mode, and
-  acpi_sleep=s3_bios,s3_mode is needed (Toshiba Satellite P10-554)
+(4) on some systems s3_bios kicks video into text mode, and
+  acpi_sleep=s3_bios,s3_mode is needed.
 
-* radeon systems, where X can soft-boot your video card. You'll need
+(5) radeon systems, where X can soft-boot your video card. You'll need
   patched X, and plain text console (no vesafb or radeonfb), see
-  http://www.doesi.gmxhome.de/linux/tm800s3/s3.html. (Acer TM 800)
+  http://www.doesi.gmxhome.de/linux/tm800s3/s3.html. Actually you
+  should probably use vbetool (6) instead.
+
+(6) other radeon systems, where vbetool is enough to bring system back
+  to life. It needs text console to be working. Do vbetool vbestate
+  save > /tmp/delme; echo 3 > /proc/acpi/sleep; vbetool post; vbetool
+  vbestate restore < /tmp/delme; setfont <whatever>, and your video
+  should work.
+
+(7) on some systems, it is possible to boot most of kernel, and then
+  POSTing bios works. Ole Rohne has patch to do just that at
+  http://dev.gentoo.org/~marineam/patch-radeonfb-2.6.11-rc2-mm2.
 
 Now, if you pass acpi_sleep=something, and it does not work with your
-bios, you'll get hard crash during resume. Be carefull.
+bios, you'll get a hard crash during resume. Be careful. Also it is
+safest to do your experiments with plain old VGA console. The vesafb
+and radeonfb (etc) drivers have a tendency to crash the machine during
+resume.
 
-You may have system where none of above works. At that point you
+You may have a system where none of above works. At that point you
 either invent another ugly hack that works, or write proper driver for
 your video card (good luck getting docs :-(). Maybe suspending from X
 (proper X, knowing your hardware, not XF68_FBcon) might have better
 chance of working.
+
+Table of known working systems:
+
+Model                           hack (or "how to do it")
+------------------------------------------------------------------------------
+Acer Aspire 1406LC		ole's late BIOS init (7), turn off DRI
+Acer TM 242FX			vbetool (6)
+Acer TM 4052LCi		        s3_bios (2)
+Acer TM 636Lci			s3_bios vga=normal (2)
+Acer TM 650 (Radeon M7)		vga=normal plus boot-radeon (5) gets text console back
+Acer TM 660			??? (*)
+Acer TM 800			vga=normal, X patches, see webpage (5)
+Arima W730a			vbetool needed (6)
+Asus L2400D                     s3_mode (3)(***) (S1 also works OK)
+Asus L3800C (Radeon M7)		s3_bios (2) (S1 also works OK)
+Asus M6NE			??? (*)
+Athlon64 desktop prototype	s3_bios (2)
+Compal CL-50			??? (*)
+Compaq Armada E500 - P3-700     none (1) (S1 also works OK)
+Dell 600m, ATI R250 Lf		none (1), but needs xorg-x11-6.8.1.902-1
+Dell D600, ATI RV250            vga=normal (**), or try vbestate (6)
+Dell Inspiron 4000		??? (*)
+Dell Inspiron 500m		??? (*)
+Dell Inspiron 600m		??? (*)
+Dell Inspiron 8200		??? (*)
+Dell Inspiron 8500		??? (*)
+Dell Inspiron 8600		??? (*)
+eMachines athlon64 machines	vbetool needed (6) (someone please get me model #s)
+HP NC6000			s3_bios, may not use radeonfb (2)
+HP NX7000			??? (*)
+HP Pavilion ZD7000		vbetool post needed, need open-source nv driver for X
+HP Omnibook XE3	athlon version	none (1)
+HP Omnibook XE3GC w/S3 Savage/IX-MV  none (1)
+IBM TP A31 / Type 2652-M5G      s3_mode (3) [works ok with BIOS 1.04 2002-08-23, but not at all with BIOS 1.11 2004-11-05 :-(]
+IBM TP R32 / Type 2658-MMG      none (1)
+IBM TP R40 2722B3G		??? (*)
+IBM TP R50p / Type 1832-22U     s3_bios (2)
+IBM TP R51			??? (*)
+IBM TP T30	236681A		??? (*)
+IBM TP T40 / Type 2373-MU4      none (1)
+IBM TP T40p			??? (*)
+IBM TP T41p			none (1)
+IBM TP T42			??? (*)
+IBM ThinkPad T42p (2373-GTG)	s3_bios (2)
+IBM TP X20			??? (*)
+IBM TP X30			??? (*)
+IBM TP X31 / Type 2672-XXH      none (1), use radeontool (http://fdd.com/software/radeon/) to turn off backlight.
+IBM TP X40			??? (*)
+Medion MD4220			??? (*)
+Samsung P35			vbetool needed (6)
+Sharp PC-AR10 (ATI rage)	none (1)
+Sony Vaio PCG-F403		??? (*)
+Sony Vaio PCG-N505SN		??? (*)
+Sony Vaio vgn-s260		X or boot-radeon can init it (5)
+Toshiba Satellite 4030CDT	s3_mode (3)
+Toshiba Satellite 4080XCDT      s3_mode (3)
+Toshiba Satellite 4090XCDT      ??? (*)
+Toshiba Satellite P10-554       s3_bios,s3_mode (4)(****)
+Uniwill 244IIO			??? (*)
+
+
+(*) from http://www.ubuntulinux.org/wiki/HoaryPMResults, not sure
+    which options to use. If you know, please tell me.
+
+(**) Text console is "strange" after resume. Backlight is switched on again
+     by the X server. X server is:
+     | X Window System Version 6.8.1.904 (6.8.2 RC 4)
+     | Release Date: 2 February 2005
+     | X Protocol Version 11, Revision 0, Release 6.8.1.904
+     | Build Operating System: SuSE Linux [ELF] SuSE
+     as present in SUSE 9.3preview3.
+
+(***) To be tested with a newer kernel.
+
+(****) Not with SMP kernel, UP only.
+
+VBEtool details
+~~~~~~~~~~~~~~~
+(with thanks to Carl-Daniel Hailfinger)
+
+First, boot into X and run the following script ONCE:
+#!/bin/bash
+statedir=/root/s3/state
+mkdir -p $statedir
+chvt 2
+sleep 1
+vbetool vbestate save >$statedir/vbe
+
+
+To suspend and resume properly, call the following script as root:
+#!/bin/bash
+statedir=/root/s3/state
+curcons=`fgconsole`
+fuser /dev/tty$curcons 2>/dev/null|xargs ps -o comm= -p|grep -q X && chvt 2
+cat /dev/vcsa >$statedir/vcsa
+sync
+echo 3 >/proc/acpi/sleep
+sync
+vbetool post
+vbetool vbestate restore <$statedir/vbe
+cat $statedir/vcsa >/dev/vcsa
+rckbd restart
+chvt $[curcons%6+1]
+chvt $curcons
+
+
+Unless you change your graphics card or other hardware configuration,
+the state once saved will be OK for every resume afterwards.
+NOTE: The "rckbd restart" command may be different for your
+distribution. Simply replace it with the command you would use to
+set the fonts on screen.
diff -Nru a/Documentation/tty.txt b/Documentation/tty.txt
--- a/Documentation/tty.txt	2004-10-21 10:03:21 -07:00
+++ b/Documentation/tty.txt	2005-03-05 07:30:59 -08:00
@@ -93,6 +93,11 @@
 			ldisc must be careful about setting order and to
 			handle unexpected calls. Must not sleep.
 
+			The driver is forbidden from calling this directly
+			from the ->write call from the ldisc as the ldisc
+			is permitted to call the driver write method from
+			this function. In such a situation defer it.
+
 
 Locking
 
diff -Nru a/Documentation/usb/error-codes.txt b/Documentation/usb/error-codes.txt
--- a/Documentation/usb/error-codes.txt	2005-01-14 16:01:20 -08:00
+++ b/Documentation/usb/error-codes.txt	2005-03-07 20:42:36 -08:00
@@ -23,6 +23,9 @@
 
 -ENODEV		specified USB-device or bus doesn't exist
 
+-ENOENT		specified interface or endpoint does not exist or
+		is not enabled
+
 -ENXIO		host controller driver does not support queuing of this type
 		of urb.  (treat as a host controller bug.)
 
@@ -88,13 +91,19 @@
 			   prescribed bus turn-around time
 			c) unknown USB error 
 
-			In cases b) and c) either -EPROTO or -EILSEQ
-			may be returned.  Note that often the controller
-			hardware does not distinguish among cases a),
-			b), and c), so a driver cannot tell whether
-			there was a protocol error, a failure to respond
-			(often caused by device disconnect), or some
-			other fault.
+			Note that often the controller hardware does not
+			distinguish among cases a), b), and c), so a
+			driver cannot tell whether there was a protocol
+			error, a failure to respond (often caused by
+			device disconnect), or some other fault.
+
+-ETIMEDOUT (**)		No response packet received within the prescribed
+			bus turn-around time.  This error may instead be
+			reported as -EPROTO or -EILSEQ.
+
+			Note that the synchronous USB message functions
+			also use this code to indicate timeout expired
+			before the transfer completed.
 
 -EPIPE (**)		Endpoint stalled.  For non-control endpoints,
 			reset this status with usb_clear_halt().
@@ -152,4 +161,7 @@
 usb_get_*/usb_set_*():
 usb_control_msg():
 usb_bulk_msg():
--ETIMEDOUT		timeout expired before the transfer completed
+-ETIMEDOUT		Timeout expired before the transfer completed.
+			In the future this code may change to -ETIME,
+			whose definition is a closer match to this sort
+			of error.
diff -Nru a/Documentation/usb/sn9c102.txt b/Documentation/usb/sn9c102.txt
--- a/Documentation/usb/sn9c102.txt	2005-01-14 16:01:37 -08:00
+++ b/Documentation/usb/sn9c102.txt	2005-03-07 20:52:05 -08:00
@@ -210,8 +210,8 @@
 SN9C10x bridge, while the other two control the sensor chip. "reg" and
 "i2c_reg" hold the values of the current register index where the following
 reading/writing operations are addressed at through "val" and "i2c_val". Their
-use is not intended for end-users. Note that "i2c_reg" and "i2c_val" won't be
-created if the sensor does not actually support the standard I2C protocol or
+use is not intended for end-users. Note that "i2c_reg" and "i2c_val" will not
+be created if the sensor does not actually support the standard I2C protocol or
 its registers are not 8-bit long. Also, remember that you must be logged in as
 root before writing to them.
 
@@ -341,15 +341,8 @@
 All the available control settings of each image sensor are supported through
 the V4L2 interface.
 
-If you think your camera is based on the above hardware and is not actually
-listed in the above table, you may try to add the specific USB VendorID and
-ProductID identifiers to the sn9c102_id_table[] in the file "sn9c102_sensor.h";
-then compile, load the module again and look at the kernel output.
-If this works, please send an email to the author reporting the kernel
-messages, so that a new entry in the list of supported devices can be added.
-
 Donations of new models for further testing and support would be much
-appreciated. Non-available hardware won't be supported by the author of this
+appreciated. Non-available hardware will not be supported by the author of this
 driver.
 
 
diff -Nru a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS	2005-02-04 09:47:42 -08:00
+++ b/MAINTAINERS	2005-03-08 16:26:50 -08:00
@@ -457,6 +457,11 @@
 M:	marcel@holtmann.org
 S:	Maintained
 
+BLUETOOTH HCI BPA10X DRIVER
+P:	Marcel Holtmann
+M:	marcel@holtmann.org
+S:	Maintained
+
 BLUETOOTH HCI BFUSB DRIVER
 P:	Marcel Holtmann
 M:	marcel@holtmann.org
@@ -596,11 +601,10 @@
 S:	Maintained
 
 CRYPTO API
-P:	James Morris
-M:	jmorris@redhat.com
+P:	Herbert Xu
+M:	herbert@gondor.apana.org.au
 P:	David S. Miller
 M:	davem@davemloft.net
-W	http://samba.org/~jamesm/crypto/
 L:	linux-kernel@vger.kernel.org
 S:	Maintained
 
@@ -910,10 +914,17 @@
 W:	http://www.icp-vortex.com/
 S:	Supported
 
-GENERIC HDLC DRIVER, N2 AND C101 DRIVERS
+GENERIC HDLC DRIVER, N2, C101, PCI200SYN and WANXL DRIVERS
 P:	Krzysztof Halasa
 M:	khc@pm.waw.pl
-W:	http://hq.pm.waw.pl/hdlc/
+W:	http://www.kernel.org/pub/linux/utils/net/hdlc/
+S:	Maintained
+
+HARMONY SOUND DRIVER
+P:	Kyle McMartin
+M:	kyle@parisc-linux.org
+W:	http://www.parisc-linux.org/~kyle/harmony/
+L:	parisc-linux@lists.parisc-linux.org
 S:	Maintained
 
 HAYES ESP SERIAL DRIVER
@@ -991,8 +1002,8 @@
 I2C AND SENSORS DRIVERS
 P:	Greg Kroah-Hartman
 M:	greg@kroah.com
-P:	Philip Edelbrock
-M:	phil@netroedge.com
+P:	Jean Delvare
+M:	khali@linux-fr.org
 L:	sensors@stimpy.netroedge.com
 W:	http://www.lm-sensors.nu/
 S:	Maintained
@@ -1082,9 +1093,21 @@
 L:	linux-kernel@vger.kernel.org
 S:	Maintained
 
+IEEE 1394 ETHERNET (eth1394)
+L:	linux1394-devel@lists.sourceforge.net
+W:	http://www.linux1394.org/
+S:	Orphan
+
+IEEE 1394 SBP2
+L:	linux1394-devel@lists.sourceforge.net
+W:	http://www.linux1394.org/
+S:	Orphan
+
 IEEE 1394 SUBSYSTEM
 P:	Ben Collins
 M:	bcollins@debian.org
+P:	Jody McIntyre
+M:	scjody@steamballoon.com
 L:	linux1394-devel@lists.sourceforge.net
 W:	http://www.linux1394.org/
 S:	Maintained
@@ -1092,13 +1115,15 @@
 IEEE 1394 OHCI DRIVER
 P:	Ben Collins
 M:	bcollins@debian.org
+P:	Jody McIntyre
+M:	scjody@steamballoon.com
 L:	linux1394-devel@lists.sourceforge.net
 W:	http://www.linux1394.org/
 S:	Maintained
 
 IEEE 1394 PCILYNX DRIVER
-P:	Andreas Bombe
-M:	andreas.bombe@munich.netsurf.de
+P:	Jody McIntyre
+M:	scjody@steamballoon.com
 L:	linux1394-devel@lists.sourceforge.net
 W:	http://www.linux1394.org/
 S:	Maintained
@@ -1106,6 +1131,8 @@
 IEEE 1394 RAW I/O DRIVER
 P:	Ben Collins
 M:	bcollins@debian.org
+P:	Dan Dennedy
+M:	dan@dennedy.org
 L:	linux1394-devel@lists.sourceforge.net
 W:	http://www.linux1394.org/
 S:	Maintained
@@ -1247,8 +1274,8 @@
 JFS FILESYSTEM
 P:	Dave Kleikamp
 M:	shaggy@austin.ibm.com
-L:	jfs-discussion@oss.software.ibm.com
-W:	http://oss.software.ibm.com/jfs/
+L:	jfs-discussion@lists.sourceforge.net
+W:	http://jfs.sourceforge.net/
 S:	Supported
 
 KCONFIG
@@ -1372,7 +1399,7 @@
 L:	linuxppc-embedded@ozlabs.org
 S:	Maintained
 
-LINUX FOR POWERPC EMBEDDED PPC85XX
+LINUX FOR POWERPC EMBEDDED PPC83XX AND PPC85XX
 P:     Kumar Gala
 M:     kumar.gala@freescale.com
 W:     http://www.penguinppc.org/
@@ -2028,6 +2055,12 @@
 W:	http://www.winischhofer.net/linuxsisvga.shtml
 S:	Maintained	
 
+SIS USB2VGA DRIVER
+P:	Thomas Winischhofer
+M:	thomas@winischhofer.net
+W:	http://www.winischhofer.at/linuxsisusbvga.shtml
+S:	Maintained
+
 SMSC47M1 HARDWARE MONITOR DRIVER
 P:	Jean Delvare
 M:	khali@linux-fr.org
@@ -2162,9 +2195,10 @@
 P:	Paul Mundt
 M:	lethal@linux-sh.org
 P:	Richard Curnow
-M:	richard.curnow@superh.com
+M:	rc@rc0.org.uk
 L:	linuxsh-shmedia-dev@lists.sourceforge.net
 W:	http://www.linux-sh.org
+W:	http://www.rc0.org.uk/sh64
 S:	Maintained
 
 SUN3/3X
@@ -2376,6 +2410,12 @@
 W:	http://www.chello.nl/~j.vreeken/se401/
 S:	Maintained
 
+USB SERIAL CYBERJACK DRIVER
+P:	Matthias Bruestle and Harald Welte
+M:	support@reiner-sct.com
+W:	http://www.reiner-sct.de/support/treiber_cyberjack.php
+S:	Maintained
+
 USB SERIAL DIGI ACCELEPORT DRIVER
 P:	Peter Berger and Al Borchers
 M:	pberger@brimson.com
@@ -2475,6 +2515,14 @@
 M:	luca.risolia@studio.unibo.it
 L:	linux-usb-devel@lists.sourceforge.net
 W:	http://www.linux-projects.org
+S:	Maintained
+
+USB ZD1201 DRIVER
+P:	Jeroen Vreeken
+M:	pe1rxq@amsat.org
+L:	linux-usb-users@lists.sourceforge.net
+L:	linux-usb-devel@lists.sourceforge.net
+W:	http://linux-lc100020.sourceforge.net
 S:	Maintained
 
 USER-MODE LINUX
diff -Nru a/Makefile b/Makefile
--- a/Makefile	2005-03-01 23:35:07 -08:00
+++ b/Makefile	2005-03-10 04:44:55 -08:00
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 11
-EXTRAVERSION =
+EXTRAVERSION = -bk6
 NAME=Woozy Numbat
 
 # *DOCUMENTATION*
diff -Nru a/arch/arm/Kconfig b/arch/arm/Kconfig
--- a/arch/arm/Kconfig	2005-01-17 16:00:00 -08:00
+++ b/arch/arm/Kconfig	2005-03-02 16:00:00 -08:00
@@ -231,7 +231,7 @@
 
 config SHARP_LOCOMO
 	bool
-	depends on SA1100_COLLIE
+	depends on SA1100_COLLIE || MACH_POODLE
 	default y
 
 config SHARP_SCOOP
diff -Nru a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
--- a/arch/arm/common/locomo.c	2005-01-10 17:29:25 -08:00
+++ b/arch/arm/common/locomo.c	2005-03-01 16:00:00 -08:00
@@ -34,11 +34,33 @@
 
 #include <asm/hardware/locomo.h>
 
+/* M62332 output channel selection */
+#define M62332_EVR_CH	1	/* M62332 volume channel number  */
+				/*   0 : CH.1 , 1 : CH. 2        */
+/* DAC send data */
+#define	M62332_SLAVE_ADDR	0x4e	/* Slave address  */
+#define	M62332_W_BIT		0x00	/* W bit (0 only) */
+#define	M62332_SUB_ADDR		0x00	/* Sub address    */
+#define	M62332_A_BIT		0x00	/* A bit (0 only) */
+
+/* DAC setup and hold times (expressed in us) */
+#define DAC_BUS_FREE_TIME	5	/*   4.7 us */
+#define DAC_START_SETUP_TIME	5	/*   4.7 us */
+#define DAC_STOP_SETUP_TIME	4	/*   4.0 us */
+#define DAC_START_HOLD_TIME	5	/*   4.7 us */
+#define DAC_SCL_LOW_HOLD_TIME	5	/*   4.7 us */
+#define DAC_SCL_HIGH_HOLD_TIME	4	/*   4.0 us */
+#define DAC_DATA_SETUP_TIME	1	/*   250 ns */
+#define DAC_DATA_HOLD_TIME	1	/*   300 ns */
+#define DAC_LOW_SETUP_TIME	1	/*   300 ns */
+#define DAC_HIGH_SETUP_TIME	1	/*  1000 ns */
+
 /* the following is the overall data for the locomo chip */
 struct locomo {
 	struct device *dev;
 	unsigned long phys;
 	unsigned int irq;
+	spinlock_t lock;
 	void *base;
 };
 
@@ -50,7 +72,57 @@
 	const char *	name;
 };
 
+/* All the locomo devices.  If offset is non-zero, the mapbase for the
+ * locomo_dev will be set to the chip base plus offset.  If offset is
+ * zero, then the mapbase for the locomo_dev will be set to zero.  An
+ * offset of zero means the device only uses GPIOs or other helper
+ * functions inside this file */
 static struct locomo_dev_info locomo_devices[] = {
+	{
+		.devid 		= LOCOMO_DEVID_KEYBOARD,
+		.irq = {
+			IRQ_LOCOMO_KEY,
+		},
+		.name		= "locomo-keyboard",
+		.offset		= LOCOMO_KEYBOARD,
+		.length		= 16,
+	},
+	{
+		.devid		= LOCOMO_DEVID_FRONTLIGHT,
+		.irq		= {},
+		.name		= "locomo-frontlight",
+		.offset		= LOCOMO_FRONTLIGHT,
+		.length		= 8,
+
+	},
+	{
+		.devid		= LOCOMO_DEVID_BACKLIGHT,
+		.irq		= {},
+		.name		= "locomo-backlight",
+		.offset		= LOCOMO_BACKLIGHT,
+		.length		= 8,
+	},
+	{
+		.devid		= LOCOMO_DEVID_AUDIO,
+		.irq		= {},
+		.name		= "locomo-audio",
+		.offset		= LOCOMO_AUDIO,
+		.length		= 4,
+	},
+	{
+		.devid		= LOCOMO_DEVID_LED,
+		.irq 		= {},
+		.name		= "locomo-led",
+		.offset		= LOCOMO_LED,
+		.length		= 8,
+	},
+	{
+		.devid		= LOCOMO_DEVID_UART,
+		.irq		= {},
+		.name		= "locomo-uart",
+		.offset		= 0,
+		.length		= 0,
+	},
 };
 
 
@@ -146,7 +218,7 @@
 	struct irqdesc *d;
 	void *mapbase = get_irq_chipdata(irq);
 
-	if (locomo_readl(mapbase + LOCOMO_KIC) & 0x0001) {
+	if (locomo_readl(mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC) & 0x0001) {
 		d = irq_desc + LOCOMO_IRQ_KEY_START;
 		d->handle(LOCOMO_IRQ_KEY_START, d, regs);
 	}
@@ -156,27 +228,27 @@
 {
 	void *mapbase = get_irq_chipdata(irq);
 	unsigned int r;
-	r = locomo_readl(mapbase + LOCOMO_KIC);
+	r = locomo_readl(mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
 	r &= ~(0x0100 << (irq - LOCOMO_IRQ_KEY_START));
-	locomo_writel(r, mapbase + LOCOMO_KIC);
+	locomo_writel(r, mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
 }
 
 static void locomo_key_mask_irq(unsigned int irq)
 {
 	void *mapbase = get_irq_chipdata(irq);
 	unsigned int r;
-	r = locomo_readl(mapbase + LOCOMO_KIC);
+	r = locomo_readl(mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
 	r &= ~(0x0010 << (irq - LOCOMO_IRQ_KEY_START));
-	locomo_writel(r, mapbase + LOCOMO_KIC);
+	locomo_writel(r, mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
 }
 
 static void locomo_key_unmask_irq(unsigned int irq)
 {
 	void *mapbase = get_irq_chipdata(irq);
 	unsigned int r;
-	r = locomo_readl(mapbase + LOCOMO_KIC);
+	r = locomo_readl(mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
 	r |= (0x0010 << (irq - LOCOMO_IRQ_KEY_START));
-	locomo_writel(r, mapbase + LOCOMO_KIC);
+	locomo_writel(r, mapbase + LOCOMO_KEYBOARD + LOCOMO_KIC);
 }
 
 static struct irqchip locomo_key_chip = {
@@ -421,13 +493,11 @@
 {
 	struct locomo_dev *dev = LOCOMO_DEV(_dev);
 
-	release_resource(&dev->res);
 	kfree(dev);
 }
 
 static int
-locomo_init_one_child(struct locomo *lchip, struct resource *parent,
-		      struct locomo_dev_info *info)
+locomo_init_one_child(struct locomo *lchip, struct locomo_dev_info *info)
 {
 	struct locomo_dev *dev;
 	int ret;
@@ -454,25 +524,17 @@
 	dev->dev.bus     = &locomo_bus_type;
 	dev->dev.release = locomo_dev_release;
 	dev->dev.coherent_dma_mask = lchip->dev->coherent_dma_mask;
-	dev->res.start   = lchip->phys + info->offset;
-	dev->res.end     = dev->res.start + info->length;
-	dev->res.name    = dev->dev.bus_id;
-	dev->res.flags   = IORESOURCE_MEM;
-	dev->mapbase     = lchip->base + info->offset;
-	memmove(dev->irq, info->irq, sizeof(dev->irq));
 
-	if (info->length) {
-		ret = request_resource(parent, &dev->res);
-		if (ret) {
-			printk("LoCoMo: failed to allocate resource for %s\n",
-				dev->res.name);
-			goto out;
-		}
-	}
+	if (info->offset)
+		dev->mapbase = lchip->base + info->offset;
+	else
+		dev->mapbase = 0;
+	dev->length = info->length;
+
+	memmove(dev->irq, info->irq, sizeof(dev->irq));
 
 	ret = device_register(&dev->dev);
 	if (ret) {
-		release_resource(&dev->res);
  out:
 		kfree(dev);
 	}
@@ -504,6 +566,8 @@
 
 	memset(lchip, 0, sizeof(struct locomo));
 
+	spin_lock_init(&lchip->lock);
+
 	lchip->dev = me;
 	dev_set_drvdata(lchip->dev, lchip);
 
@@ -523,7 +587,7 @@
 	/* locomo initialize */
 	locomo_writel(0, lchip->base + LOCOMO_ICR);
 	/* KEYBOARD */
-	locomo_writel(0, lchip->base + LOCOMO_KIC);
+	locomo_writel(0, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
 
 	/* GPIO */
 	locomo_writel(0, lchip->base + LOCOMO_GPO);
@@ -534,8 +598,8 @@
 	locomo_writel(0, lchip->base + LOCOMO_GIE);
 
 	/* FrontLight */
-	locomo_writel(0, lchip->base + LOCOMO_ALS);
-	locomo_writel(0, lchip->base + LOCOMO_ALD);
+	locomo_writel(0, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
+	locomo_writel(0, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALD);
 	/* Longtime timer */
 	locomo_writel(0, lchip->base + LOCOMO_LTINT);
 	/* SPI */
@@ -578,7 +642,7 @@
 		locomo_setup_irq(lchip);
 
 	for (i = 0; i < ARRAY_SIZE(locomo_devices); i++)
-		locomo_init_one_child(lchip, mem, &locomo_devices[i]);
+		locomo_init_one_child(lchip, &locomo_devices[i]);
 
 	return 0;
 
@@ -654,6 +718,238 @@
 	return (struct locomo *)dev_get_drvdata(ldev->dev.parent);
 }
 
+void locomo_gpio_set_dir(struct locomo_dev *ldev, unsigned int bits, unsigned int dir)
+{
+	struct locomo *lchip = locomo_chip_driver(ldev);
+	unsigned long flags;
+	unsigned int r;
+
+	spin_lock_irqsave(&lchip->lock, flags);
+
+	r = locomo_readl(lchip->base + LOCOMO_GPD);
+	r &= ~bits;
+	locomo_writel(r, lchip->base + LOCOMO_GPD);
+
+	r = locomo_readl(lchip->base + LOCOMO_GPE);
+	if (dir)
+		r |= bits;
+	else
+		r &= ~bits;
+	locomo_writel(r, lchip->base + LOCOMO_GPE);
+
+	spin_unlock_irqrestore(&lchip->lock, flags);
+}
+
+unsigned int locomo_gpio_read_level(struct locomo_dev *ldev, unsigned int bits)
+{
+	struct locomo *lchip = locomo_chip_driver(ldev);
+	unsigned long flags;
+	unsigned int ret;
+
+	spin_lock_irqsave(&lchip->lock, flags);
+	ret = locomo_readl(lchip->base + LOCOMO_GPL);
+	spin_unlock_irqrestore(&lchip->lock, flags);
+
+	ret &= bits;
+	return ret;
+}
+
+unsigned int locomo_gpio_read_output(struct locomo_dev *ldev, unsigned int bits)
+{
+	struct locomo *lchip = locomo_chip_driver(ldev);
+	unsigned long flags;
+	unsigned int ret;
+
+	spin_lock_irqsave(&lchip->lock, flags);
+	ret = locomo_readl(lchip->base + LOCOMO_GPO);
+	spin_unlock_irqrestore(&lchip->lock, flags);
+
+	ret &= bits;
+	return ret;
+}
+
+void locomo_gpio_write(struct locomo_dev *ldev, unsigned int bits, unsigned int set)
+{
+	struct locomo *lchip = locomo_chip_driver(ldev);
+	unsigned long flags;
+	unsigned int r;
+
+	spin_lock_irqsave(&lchip->lock, flags);
+
+	r = locomo_readl(lchip->base + LOCOMO_GPO);
+	if (set)
+		r |= bits;
+	else
+		r &= ~bits;
+	locomo_writel(r, lchip->base + LOCOMO_GPO);
+
+	spin_unlock_irqrestore(&lchip->lock, flags);
+}
+
+static void locomo_m62332_sendbit(void *mapbase, int bit)
+{
+	unsigned int r;
+
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SCLOEB);
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	udelay(DAC_DATA_HOLD_TIME);	/* 300 nsec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SCLOEB);
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
+
+	if (bit & 1) {
+		r = locomo_readl(mapbase + LOCOMO_DAC);
+		r |=  LOCOMO_DAC_SDAOEB;
+		locomo_writel(r, mapbase + LOCOMO_DAC);
+		udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	} else {
+		r = locomo_readl(mapbase + LOCOMO_DAC);
+		r &=  ~(LOCOMO_DAC_SDAOEB);
+		locomo_writel(r, mapbase + LOCOMO_DAC);
+		udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	}
+
+	udelay(DAC_DATA_SETUP_TIME);	/* 250 nsec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB;
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/*  4.0 usec */
+}
+
+void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel)
+{
+	struct locomo *lchip = locomo_chip_driver(ldev);
+	int i;
+	unsigned char data;
+	unsigned int r;
+	void *mapbase = lchip->base;
+	unsigned long flags;
+
+	spin_lock_irqsave(&lchip->lock, flags);
+
+	/* Start */
+	udelay(DAC_BUS_FREE_TIME);	/* 5.0 usec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB | LOCOMO_DAC_SDAOEB;
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4.0 usec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SDAOEB);
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_START_HOLD_TIME);	/* 5.0 usec */
+	udelay(DAC_DATA_HOLD_TIME);	/* 300 nsec */
+
+	/* Send slave address and W bit (LSB is W bit) */
+	data = (M62332_SLAVE_ADDR << 1) | M62332_W_BIT;
+	for (i = 1; i <= 8; i++) {
+		locomo_m62332_sendbit(mapbase, data >> (8 - i));
+	}
+
+	/* Check A bit */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SCLOEB);
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SDAOEB);
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB;
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4.7 usec */
+	if (locomo_readl(mapbase + LOCOMO_DAC) & LOCOMO_DAC_SDAOEB) {	/* High is error */
+		printk(KERN_WARNING "locomo: m62332_senddata Error 1\n");
+		return;
+	}
+
+	/* Send Sub address (LSB is channel select) */
+	/*    channel = 0 : ch1 select              */
+	/*            = 1 : ch2 select              */
+	data = M62332_SUB_ADDR + channel;
+	for (i = 1; i <= 8; i++) {
+		locomo_m62332_sendbit(mapbase, data >> (8 - i));
+	}
+
+	/* Check A bit */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SCLOEB);
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SDAOEB);
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB;
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4.7 usec */
+	if (locomo_readl(mapbase + LOCOMO_DAC) & LOCOMO_DAC_SDAOEB) {	/* High is error */
+		printk(KERN_WARNING "locomo: m62332_senddata Error 2\n");
+		return;
+	}
+
+	/* Send DAC data */
+	for (i = 1; i <= 8; i++) {
+		locomo_m62332_sendbit(mapbase, dac_data >> (8 - i));
+	}
+
+	/* Check A bit */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SCLOEB);
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SDAOEB);
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB;
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4.7 usec */
+	if (locomo_readl(mapbase + LOCOMO_DAC) & LOCOMO_DAC_SDAOEB) {	/* High is error */
+		printk(KERN_WARNING "locomo: m62332_senddata Error 3\n");
+		return;
+	}
+
+	/* stop */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r &=  ~(LOCOMO_DAC_SCLOEB);
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_LOW_SETUP_TIME);	/* 300 nsec */
+	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB;
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4 usec */
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SDAOEB;
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_HIGH_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_HIGH_HOLD_TIME);	/* 4 usec */
+
+	r = locomo_readl(mapbase + LOCOMO_DAC);
+	r |=  LOCOMO_DAC_SCLOEB | LOCOMO_DAC_SDAOEB;
+	locomo_writel(r, mapbase + LOCOMO_DAC);
+	udelay(DAC_LOW_SETUP_TIME);	/* 1000 nsec */
+	udelay(DAC_SCL_LOW_HOLD_TIME);	/* 4.7 usec */
+
+	spin_unlock_irqrestore(&lchip->lock, flags);
+}
+
 /*
  *	LoCoMo "Register Access Bus."
  *
@@ -755,3 +1051,8 @@
 
 EXPORT_SYMBOL(locomo_driver_register);
 EXPORT_SYMBOL(locomo_driver_unregister);
+EXPORT_SYMBOL(locomo_gpio_set_dir);
+EXPORT_SYMBOL(locomo_gpio_read_level);
+EXPORT_SYMBOL(locomo_gpio_read_output);
+EXPORT_SYMBOL(locomo_gpio_write);
+EXPORT_SYMBOL(locomo_m62332_senddata);
diff -Nru a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c
--- a/arch/arm/common/rtctime.c	2005-01-20 21:02:14 -08:00
+++ b/arch/arm/common/rtctime.c	2005-03-08 15:19:23 -08:00
@@ -94,24 +94,29 @@
 EXPORT_SYMBOL(rtc_time_to_tm);
 
 /*
- * Convert Gregorian date to seconds since 01-01-1970 00:00:00.
+ * Does the rtc_time represent a valid date/time?
  */
-int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time)
+int rtc_valid_tm(struct rtc_time *tm)
 {
-	unsigned int yrs = tm->tm_year + 1900;
-
-	*time = 0;
-
-	if (yrs < 1970 ||
+	if (tm->tm_year < 70 ||
 	    tm->tm_mon >= 12 ||
 	    tm->tm_mday < 1 ||
-	    tm->tm_mday > month_days(tm->tm_mon, yrs) ||
+	    tm->tm_mday > month_days(tm->tm_mon, tm->tm_year + 1900) ||
 	    tm->tm_hour >= 24 ||
 	    tm->tm_min >= 60 ||
 	    tm->tm_sec >= 60)
 		return -EINVAL;
 
-	*time = mktime(yrs, tm->tm_mon + 1, tm->tm_mday,
+	return 0;
+}
+EXPORT_SYMBOL(rtc_valid_tm);
+
+/*
+ * Convert Gregorian date to seconds since 01-01-1970 00:00:00.
+ */
+int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time)
+{
+	*time = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
 		       tm->tm_hour, tm->tm_min, tm->tm_sec);
 
 	return 0;
@@ -144,7 +149,13 @@
 
 static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm)
 {
-	return ops->set_time(tm);
+	int ret;
+
+	ret = rtc_valid_tm(tm);
+	if (ret == 0)
+		ret = ops->set_time(tm);
+
+	return ret;
 }
 
 static inline int rtc_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
@@ -412,7 +423,6 @@
 	struct rtc_wkalrm alrm;
 	struct rtc_time tm;
 	char *p = page;
-	int len;
 
 	rtc_read_time(ops, &tm);
 
@@ -461,13 +471,7 @@
 	if (ops->proc)
 		p += ops->proc(p);
 
-	len = (p - page) - off;
-	if (len < 0)
-		len = 0;
-	*eof = len <= count;
-	*start = page + off;
-
-	return len;
+	return p - page;
 }
 
 int register_rtc(struct rtc_ops *ops)
diff -Nru a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
--- a/arch/arm/common/scoop.c	2005-01-20 21:02:14 -08:00
+++ b/arch/arm/common/scoop.c	2005-03-05 15:21:53 -08:00
@@ -15,47 +15,52 @@
 #include <asm/io.h>
 #include <asm/hardware/scoop.h>
 
-static void __iomem *scoop_io_base;
+#define SCOOP_REG(d,adr) (*(volatile unsigned short*)(d +(adr)))
 
-#define SCOOP_REG(adr) (*(volatile unsigned short*)(scoop_io_base+(adr)))
+struct  scoop_dev {
+	void  *base;
+	spinlock_t scoop_lock;
+	u32 scoop_gpwr;
+};
 
-void reset_scoop(void)
+void reset_scoop(struct device *dev)
 {
-	SCOOP_REG(SCOOP_MCR) = 0x0100;	// 00
-	SCOOP_REG(SCOOP_CDR) = 0x0000;  // 04
-	SCOOP_REG(SCOOP_CPR) = 0x0000;  // 0C
-	SCOOP_REG(SCOOP_CCR) = 0x0000;  // 10
-	SCOOP_REG(SCOOP_IMR) = 0x0000;  // 18
-	SCOOP_REG(SCOOP_IRM) = 0x00FF;  // 14
-	SCOOP_REG(SCOOP_ISR) = 0x0000;  // 1C
-	SCOOP_REG(SCOOP_IRM) = 0x0000;
-}
+	struct scoop_dev *sdev = dev_get_drvdata(dev);
 
-static DEFINE_SPINLOCK(scoop_lock);
-static u32 scoop_gpwr;
+	SCOOP_REG(sdev->base,SCOOP_MCR) = 0x0100;  // 00
+	SCOOP_REG(sdev->base,SCOOP_CDR) = 0x0000;  // 04
+	SCOOP_REG(sdev->base,SCOOP_CPR) = 0x0000;  // 0C
+	SCOOP_REG(sdev->base,SCOOP_CCR) = 0x0000;  // 10
+	SCOOP_REG(sdev->base,SCOOP_IMR) = 0x0000;  // 18
+	SCOOP_REG(sdev->base,SCOOP_IRM) = 0x00FF;  // 14
+	SCOOP_REG(sdev->base,SCOOP_ISR) = 0x0000;  // 1C
+	SCOOP_REG(sdev->base,SCOOP_IRM) = 0x0000;
+}
 
-unsigned short set_scoop_gpio(unsigned short bit)
+unsigned short set_scoop_gpio(struct device *dev, unsigned short bit)
 {
 	unsigned short gpio_bit;
 	unsigned long flag;
+	struct scoop_dev *sdev = dev_get_drvdata(dev);
 
-	spin_lock_irqsave(&scoop_lock, flag);
-	gpio_bit = SCOOP_REG(SCOOP_GPWR) | bit;
-	SCOOP_REG(SCOOP_GPWR) = gpio_bit;
-	spin_unlock_irqrestore(&scoop_lock, flag);
+	spin_lock_irqsave(&sdev->scoop_lock, flag);
+	gpio_bit = SCOOP_REG(sdev->base, SCOOP_GPWR) | bit;
+	SCOOP_REG(sdev->base, SCOOP_GPWR) = gpio_bit;
+	spin_unlock_irqrestore(&sdev->scoop_lock, flag);
 
 	return gpio_bit;
 }
 
-unsigned short reset_scoop_gpio(unsigned short bit)
+unsigned short reset_scoop_gpio(struct device *dev, unsigned short bit)
 {
 	unsigned short gpio_bit;
 	unsigned long flag;
+	struct scoop_dev *sdev = dev_get_drvdata(dev);
 
-	spin_lock_irqsave(&scoop_lock, flag);
-	gpio_bit = SCOOP_REG(SCOOP_GPWR) & ~bit;
-	SCOOP_REG(SCOOP_GPWR) = gpio_bit;
-	spin_unlock_irqrestore(&scoop_lock, flag);
+	spin_lock_irqsave(&sdev->scoop_lock, flag);
+	gpio_bit = SCOOP_REG(sdev->base, SCOOP_GPWR) & ~bit;
+	SCOOP_REG(sdev->base,SCOOP_GPWR) = gpio_bit;
+	spin_unlock_irqrestore(&sdev->scoop_lock, flag);
 
 	return gpio_bit;
 }
@@ -63,25 +68,30 @@
 EXPORT_SYMBOL(set_scoop_gpio);
 EXPORT_SYMBOL(reset_scoop_gpio);
 
-unsigned short read_scoop_reg(unsigned short reg)
+unsigned short read_scoop_reg(struct device *dev, unsigned short reg)
 {
-	return SCOOP_REG(reg);
+	struct scoop_dev *sdev = dev_get_drvdata(dev);
+	return SCOOP_REG(sdev->base,reg);
 }
 
-void write_scoop_reg(unsigned short reg, unsigned short data)
+void write_scoop_reg(struct device *dev, unsigned short reg, unsigned short data)
 {
-	SCOOP_REG(reg)=data;
+	struct scoop_dev *sdev = dev_get_drvdata(dev);
+	SCOOP_REG(sdev->base,reg)=data;
 }
 
 EXPORT_SYMBOL(reset_scoop);
 EXPORT_SYMBOL(read_scoop_reg);
 EXPORT_SYMBOL(write_scoop_reg);
 
+#ifdef CONFIG_PM
 static int scoop_suspend(struct device *dev, uint32_t state, uint32_t level)
 {
 	if (level == SUSPEND_POWER_DOWN) {
-		scoop_gpwr = SCOOP_REG(SCOOP_GPWR);
-		SCOOP_REG(SCOOP_GPWR) = 0;
+		struct scoop_dev *sdev = dev_get_drvdata(dev);
+
+		sdev->scoop_gpwr = SCOOP_REG(sdev->base,SCOOP_GPWR);
+		SCOOP_REG(sdev->base,SCOOP_GPWR) = 0;
 	}
 	return 0;
 }
@@ -89,13 +99,20 @@
 static int scoop_resume(struct device *dev, uint32_t level)
 {
 	if (level == RESUME_POWER_ON) {
-		SCOOP_REG(SCOOP_GPWR) = scoop_gpwr;
+		struct scoop_dev *sdev = dev_get_drvdata(dev);
+
+		SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
 	}
 	return 0;
 }
+#else
+#define scoop_suspend	NULL
+#define scoop_resume	NULL
+#endif
 
 int __init scoop_probe(struct device *dev)
 {
+	struct scoop_dev *devptr;
 	struct scoop_config *inf;
 	struct platform_device *pdev = to_platform_device(dev);
 	struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -103,25 +120,50 @@
 	if (!mem)
 		return -EINVAL;
 
+	devptr = kmalloc(sizeof(struct scoop_dev), GFP_KERNEL);
+
+	if (!devptr)
+		return  -ENOMEM;
+
+	memset(devptr, 0, sizeof(struct scoop_dev));
+	spin_lock_init(&devptr->scoop_lock);
+
 	inf = dev->platform_data;
-	scoop_io_base = ioremap(mem->start, 0x1000);
-	if (!scoop_io_base)
+	devptr->base = ioremap(mem->start, mem->end - mem->start + 1);
+
+	if (!devptr->base) {
+		kfree(devptr);
 		return -ENOMEM;
+	}
 
-	SCOOP_REG(SCOOP_MCR) = 0x0140;
+	dev_set_drvdata(dev, devptr);
 
-	reset_scoop();
+	printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base);
 
-	SCOOP_REG(SCOOP_GPCR) = inf->io_dir & 0xffff;
-	SCOOP_REG(SCOOP_GPWR) = inf->io_out & 0xffff;
+	SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140;
+	reset_scoop(dev);
+	SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff;
+	SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff;
 
 	return 0;
 }
 
+static int scoop_remove(struct device *dev)
+{
+	struct scoop_dev *sdev = dev_get_drvdata(dev);
+	if (sdev) {
+		iounmap(sdev->base);
+		kfree(sdev);
+		dev_set_drvdata(dev, NULL);
+	}
+	return 0;
+}
+
 static struct device_driver scoop_driver = {
 	.name		= "sharp-scoop",
 	.bus		= &platform_bus_type,
 	.probe		= scoop_probe,
+	.remove 	= scoop_remove,
 	.suspend	= scoop_suspend,
 	.resume		= scoop_resume,
 };
diff -Nru a/arch/arm/configs/pxa255-idp_defconfig b/arch/arm/configs/pxa255-idp_defconfig
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/arm/configs/pxa255-idp_defconfig	2005-02-16 08:52:21 -08:00
@@ -0,0 +1,765 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-rc3
+# Fri Feb 11 16:53:43 2005
+#
+CONFIG_ARM=y
+CONFIG_MMU=y
+CONFIG_UID16=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_IOMAP=y
+
+#
+# Code maturity level options
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_CLEAN_COMPILE=y
+CONFIG_BROKEN_ON_SMP=y
+
+#
+# General setup
+#
+CONFIG_LOCALVERSION=""
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_HOTPLUG=y
+CONFIG_KOBJECT_UEVENT=y
+# CONFIG_IKCONFIG is not set
+# CONFIG_EMBEDDED is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
+
+#
+# Loadable module support
+#
+CONFIG_MODULES=y
+# CONFIG_MODULE_UNLOAD is not set
+CONFIG_OBSOLETE_MODPARM=y
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+# CONFIG_KMOD is not set
+
+#
+# System Type
+#
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CO285 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_CAMELOT is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_IOP3XX is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_L7200 is not set
+CONFIG_ARCH_PXA=y
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_OMAP is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_H720X is not set
+
+#
+# Intel PXA2xx Implementations
+#
+# CONFIG_ARCH_LUBBOCK is not set
+# CONFIG_MACH_MAINSTONE is not set
+CONFIG_ARCH_PXA_IDP=y
+# CONFIG_PXA_SHARPSL is not set
+CONFIG_PXA25x=y
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_XSCALE=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5T=y
+CONFIG_CPU_CACHE_VIVT=y
+CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_MINICACHE=y
+
+#
+# Processor Features
+#
+# CONFIG_ARM_THUMB is not set
+CONFIG_XSCALE_PMU=y
+
+#
+# General setup
+#
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZBOOT_ROM_BSS=0x0
+# CONFIG_XIP_KERNEL is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# At least one math emulation must be selected
+#
+CONFIG_FPE_NWFPE=y
+# CONFIG_FPE_NWFPE_XP is not set
+# CONFIG_FPE_FASTFPE is not set
+CONFIG_BINFMT_ELF=y
+# CONFIG_BINFMT_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_PM is not set
+# CONFIG_PREEMPT is not set
+# CONFIG_ARTHUR is not set
+CONFIG_CMDLINE="root=/dev/nfs ip=dhcp console=ttyS0,115200 mem=64M"
+CONFIG_LEDS=y
+CONFIG_LEDS_TIMER=y
+CONFIG_LEDS_CPU=y
+CONFIG_ALIGNMENT_TRAP=y
+
+#
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Memory Technology Devices (MTD)
+#
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+# CONFIG_MTD_AFS_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+CONFIG_MTD_CFI_GEOMETRY=y
+# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_2 is not set
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+# CONFIG_MTD_CFI_I1 is not set
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+# CONFIG_MTD_XIP is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+# CONFIG_MTD_EDB7312 is not set
+# CONFIG_MTD_SHARP_SL is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLKMTD is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+# CONFIG_MTD_NAND is not set
+
+#
+# Plug and Play support
+#
+
+#
+# Block devices
+#
+# CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+# CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_RAM is not set
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
+
+#
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# Networking support
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+# CONFIG_PACKET is not set
+# CONFIG_NETLINK_DEV is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETFILTER is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_NET_DIVERT is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+
+#
+# Ethernet (10 or 100Mbit)
+#
+CONFIG_NET_ETHERNET=y
+CONFIG_MII=y
+CONFIG_SMC91X=y
+
+#
+# Ethernet (1000 Mbit)
+#
+
+#
+# Ethernet (10000 Mbit)
+#
+
+#
+# Token Ring devices
+#
+
+#
+# Wireless LAN (non-hamradio)
+#
+# CONFIG_NET_RADIO is not set
+
+#
+# Wan interfaces
+#
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+
+#
+# ATA/ATAPI/MFM/RLL support
+#
+CONFIG_IDE=y
+CONFIG_BLK_DEV_IDE=y
+
+#
+# Please see Documentation/ide.txt for help/info on IDE drives
+#
+# CONFIG_BLK_DEV_IDE_SATA is not set
+CONFIG_BLK_DEV_IDEDISK=y
+# CONFIG_IDEDISK_MULTI_MODE is not set
+# CONFIG_BLK_DEV_IDECD is not set
+# CONFIG_BLK_DEV_IDETAPE is not set
+# CONFIG_BLK_DEV_IDEFLOPPY is not set
+# CONFIG_IDE_TASK_IOCTL is not set
+
+#
+# IDE chipset support/bugfixes
+#
+# CONFIG_IDE_GENERIC is not set
+# CONFIG_IDE_ARM is not set
+# CONFIG_BLK_DEV_IDEDMA is not set
+# CONFIG_IDEDMA_AUTO is not set
+# CONFIG_BLK_DEV_HD is not set
+
+#
+# SCSI device support
+#
+# CONFIG_SCSI is not set
+
+#
+# Fusion MPT device support
+#
+
+#
+# IEEE 1394 (FireWire) support
+#
+
+#
+# I2O device support
+#
+
+#
+# ISDN subsystem
+#
+# CONFIG_ISDN is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+CONFIG_SERIO=y
+# CONFIG_SERIO_SERPORT is not set
+# CONFIG_SERIO_CT82C710 is not set
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_PXA=y
+CONFIG_SERIAL_PXA_CONSOLE=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+# CONFIG_NVRAM is not set
+# CONFIG_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+
+#
+# Ftape, the floppy tape device driver
+#
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
+
+#
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_JBD is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+CONFIG_MSDOS_FS=y
+# CONFIG_VFAT_FS is not set
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+# CONFIG_TMPFS is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS_FS is not set
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+# CONFIG_JFFS2_FS_NAND is not set
+# CONFIG_JFFS2_FS_NOR_ECC is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=y
+# CONFIG_NFS_V3 is not set
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFS_DIRECTIO is not set
+# CONFIG_NFSD is not set
+CONFIG_ROOT_NFS=y
+CONFIG_LOCKD=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+# CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+
+#
+# Native Language Support
+#
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+# CONFIG_NLS_CODEPAGE_437 is not set
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+# CONFIG_NLS_ASCII is not set
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_UTF8 is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Graphics support
+#
+CONFIG_FB=y
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+CONFIG_FB_PXA=y
+# CONFIG_FB_PXA_PARAMETERS is not set
+# CONFIG_FB_VIRTUAL is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+
+#
+# Logo configuration
+#
+CONFIG_LOGO=y
+CONFIG_LOGO_LINUX_MONO=y
+CONFIG_LOGO_LINUX_VGA16=y
+CONFIG_LOGO_LINUX_CLUT224=y
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# Misc devices
+#
+
+#
+# USB support
+#
+# CONFIG_USB is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# Kernel hacking
+#
+CONFIG_DEBUG_KERNEL=y
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_FS is not set
+CONFIG_FRAME_POINTER=y
+CONFIG_DEBUG_USER=y
+# CONFIG_DEBUG_WAITQ is not set
+CONFIG_DEBUG_ERRORS=y
+CONFIG_DEBUG_LL=y
+# CONFIG_DEBUG_ICEDCC is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Hardware crypto devices
+#
+
+#
+# Library routines
+#
+# CONFIG_CRC_CCITT is not set
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
diff -Nru a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
--- a/arch/arm/configs/s3c2410_defconfig	2005-01-18 03:37:19 -08:00
+++ b/arch/arm/configs/s3c2410_defconfig	2005-03-06 07:10:38 -08:00
@@ -86,7 +86,9 @@
 #
 CONFIG_ARCH_BAST=y
 CONFIG_ARCH_H1940=y
+CONFIG_MACH_N30=y
 CONFIG_ARCH_SMDK2410=y
+CONFIG_ARCH_S3C2440=y
 CONFIG_MACH_VR1000=y
 CONFIG_MACH_RX3715=y
 CONFIG_CPU_S3C2410=y
diff -Nru a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
--- a/arch/arm/kernel/calls.S	2005-02-02 16:00:00 -08:00
+++ b/arch/arm/kernel/calls.S	2005-03-02 07:05:14 -08:00
@@ -1,7 +1,7 @@
 /*
  *  linux/arch/arm/kernel/calls.S
  *
- *  Copyright (C) 1995-2004 Russell King
+ *  Copyright (C) 1995-2005 Russell King
  *
  * 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
@@ -10,7 +10,7 @@
  *  This file is included twice in entry-common.S
  */
 #ifndef NR_syscalls
-#define NR_syscalls 288
+#define NR_syscalls 320
 #else
 
 __syscall_start:
@@ -295,6 +295,37 @@
 		.long	sys_mq_notify
 		.long	sys_mq_getsetattr
 /* 280 */	.long	sys_waitid
+		.long	sys_socket
+		.long	sys_bind
+		.long	sys_connect
+		.long	sys_listen
+/* 285 */	.long	sys_accept
+		.long	sys_getsockname
+		.long	sys_getpeername
+		.long	sys_socketpair
+		.long	sys_send
+/* 290 */	.long	sys_sendto
+		.long	sys_recv
+		.long	sys_recvfrom
+		.long	sys_shutdown
+		.long	sys_setsockopt
+/* 295 */	.long	sys_getsockopt
+		.long	sys_sendmsg
+		.long	sys_recvmsg
+		.long	sys_semop
+		.long	sys_semget
+/* 300 */	.long	sys_semctl
+		.long	sys_msgsnd
+		.long	sys_msgrcv
+		.long	sys_msgget
+		.long	sys_msgctl
+/* 305 */	.long	sys_shmat
+		.long	sys_shmdt
+		.long	sys_shmget
+		.long	sys_shmctl
+		.long	sys_add_key
+/* 310 */	.long	sys_request_key
+		.long	sys_keyctl
 __syscall_end:
 
 		.rept	NR_syscalls - (__syscall_end - __syscall_start) / 4
diff -Nru a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
--- a/arch/arm/kernel/ecard.c	2004-11-14 08:16:11 -08:00
+++ b/arch/arm/kernel/ecard.c	2005-03-02 14:16:28 -08:00
@@ -85,27 +85,21 @@
 };
 
 asmlinkage extern int
-ecard_loader_reset(volatile unsigned char *pa, loader_t loader);
+ecard_loader_reset(unsigned long base, loader_t loader);
 asmlinkage extern int
-ecard_loader_read(int off, volatile unsigned char *pa, loader_t loader);
+ecard_loader_read(int off, unsigned long base, loader_t loader);
 
-static const struct ecard_id *
-ecard_match_device(const struct ecard_id *ids, struct expansion_card *ec);
-
-static inline unsigned short
-ecard_getu16(unsigned char *v)
+static inline unsigned short ecard_getu16(unsigned char *v)
 {
 	return v[0] | v[1] << 8;
 }
 
-static inline signed long
-ecard_gets24(unsigned char *v)
+static inline signed long ecard_gets24(unsigned char *v)
 {
 	return v[0] | v[1] << 8 | v[2] << 16 | ((v[2] & 0x80) ? 0xff000000 : 0);
 }
 
-static inline ecard_t *
-slot_to_ecard(unsigned int slot)
+static inline ecard_t *slot_to_ecard(unsigned int slot)
 {
 	return slot < MAX_ECARDS ? slot_to_expcard[slot] : NULL;
 }
@@ -122,26 +116,31 @@
  * From a security standpoint, we trust the card vendors.  This
  * may be a misplaced trust.
  */
-#define BUS_ADDR(x) ((((unsigned long)(x)) << 2) + IO_BASE)
-#define POD_INT_ADDR(x)	((volatile unsigned char *)\
-			 ((BUS_ADDR((x)) - IO_BASE) + IO_START))
-
 static void ecard_task_reset(struct ecard_request *req)
 {
 	struct expansion_card *ec = req->ec;
-	if (ec->loader)
-		ecard_loader_reset(POD_INT_ADDR(ec->podaddr), ec->loader);
+	struct resource *res;
+
+	res = ec->slot_no == 8
+		? &ec->resource[ECARD_RES_MEMC]
+		: ec->type == ECARD_EASI
+		  ? &ec->resource[ECARD_RES_EASI]
+		  : &ec->resource[ECARD_RES_IOCSYNC];
+
+	ecard_loader_reset(res->start, ec->loader);
 }
 
 static void ecard_task_readbytes(struct ecard_request *req)
 {
-	unsigned char *buf = (unsigned char *)req->buffer;
-	volatile unsigned char *base_addr =
-		(volatile unsigned char *)POD_INT_ADDR(req->ec->podaddr);
+	struct expansion_card *ec = req->ec;
+	unsigned char *buf = req->buffer;
 	unsigned int len = req->length;
 	unsigned int off = req->address;
 
-	if (req->ec->slot_no == 8) {
+	if (ec->slot_no == 8) {
+		void __iomem *base = (void __iomem *)
+				ec->resource[ECARD_RES_MEMC].start;
+
 		/*
 		 * The card maintains an index which increments the address
 		 * into a 4096-byte page on each access.  We need to keep
@@ -161,7 +160,7 @@
 		 * greater than the offset, reset the hardware index counter.
 		 */
 		if (off == 0 || index > off) {
-			*base_addr = 0;
+			writeb(0, base);
 			index = 0;
 		}
 
@@ -170,21 +169,24 @@
 		 * required offset.  The read bytes are discarded.
 		 */
 		while (index < off) {
-			unsigned char byte;
-			byte = base_addr[page];
+			readb(base + page);
 			index += 1;
 		}
 
 		while (len--) {
-			*buf++ = base_addr[page];
+			*buf++ = readb(base + page);
 			index += 1;
 		}
 	} else {
+		unsigned long base = (ec->type == ECARD_EASI
+			 ? &ec->resource[ECARD_RES_EASI]
+			 : &ec->resource[ECARD_RES_IOCSYNC])->start;
+		void __iomem *pbase = (void __iomem *)base;
 
-		if (!req->use_loader || !req->ec->loader) {
+		if (!req->use_loader || !ec->loader) {
 			off *= 4;
 			while (len--) {
-				*buf++ = base_addr[off];
+				*buf++ = readb(pbase + off);
 				off += 4;
 			}
 		} else {
@@ -194,8 +196,8 @@
 				 * expansion card loader programs.
 				 */
 				*(unsigned long *)0x108 = 0;
-				*buf++ = ecard_loader_read(off++, base_addr,
-							   req->ec->loader);
+				*buf++ = ecard_loader_read(off++, base,
+							   ec->loader);
 			}
 		}
 	}
@@ -406,7 +408,7 @@
 
 static int ecard_def_irq_pending(ecard_t *ec)
 {
-	return !ec->irqmask || ec->irqaddr[0] & ec->irqmask;
+	return !ec->irqmask || readb(ec->irqaddr) & ec->irqmask;
 }
 
 static void ecard_def_fiq_enable(ecard_t *ec, int fiqnr)
@@ -421,7 +423,7 @@
 
 static int ecard_def_fiq_pending(ecard_t *ec)
 {
-	return !ec->fiqmask || ec->fiqaddr[0] & ec->fiqmask;
+	return !ec->fiqmask || readb(ec->fiqaddr) & ec->fiqmask;
 }
 
 static expansioncard_ops_t ecard_default_ops = {
@@ -522,7 +524,7 @@
 			       ec->ops->irqpending(ec) ? "" : "not ");
 		else
 			printk("irqaddr %p, mask = %02X, status = %02X\n",
-			       ec->irqaddr, ec->irqmask, *ec->irqaddr);
+			       ec->irqaddr, ec->irqmask, readb(ec->irqaddr));
 	}
 }
 
@@ -675,7 +677,7 @@
 #define IO_EC_MEMC8_BASE 0
 #endif
 
-unsigned int ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
+unsigned int __ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
 {
 	unsigned long address = 0;
 	int slot = ec->slot_no;
@@ -779,55 +781,89 @@
 		get_ecard_dev_info);
 }
 
-#define ec_set_resource(ec,nr,st,sz,flg)			\
+#define ec_set_resource(ec,nr,st,sz)				\
 	do {							\
 		(ec)->resource[nr].name = ec->dev.bus_id;	\
 		(ec)->resource[nr].start = st;			\
 		(ec)->resource[nr].end = (st) + (sz) - 1;	\
-		(ec)->resource[nr].flags = flg;			\
+		(ec)->resource[nr].flags = IORESOURCE_MEM;	\
 	} while (0)
 
-static void __init ecard_init_resources(struct expansion_card *ec)
+static void __init ecard_free_card(struct expansion_card *ec)
+{
+	int i;
+
+	for (i = 0; i < ECARD_NUM_RESOURCES; i++)
+		if (ec->resource[i].flags)
+			release_resource(&ec->resource[i]);
+
+	kfree(ec);
+}
+
+static struct expansion_card *__init ecard_alloc_card(int type, int slot)
 {
-	unsigned long base = PODSLOT_IOC4_BASE;
-	unsigned int slot = ec->slot_no;
+	struct expansion_card *ec;
+	unsigned long base;
 	int i;
 
+	ec = kmalloc(sizeof(ecard_t), GFP_KERNEL);
+	if (!ec) {
+		ec = ERR_PTR(-ENOMEM);
+		goto nomem;
+	}
+
+	memset(ec, 0, sizeof(ecard_t));
+
+	ec->slot_no = slot;
+	ec->type = type;
+	ec->irq = NO_IRQ;
+	ec->fiq = NO_IRQ;
+	ec->dma = NO_DMA;
+	ec->ops = &ecard_default_ops;
+
+	snprintf(ec->dev.bus_id, sizeof(ec->dev.bus_id), "ecard%d", slot);
+	ec->dev.parent = NULL;
+	ec->dev.bus = &ecard_bus_type;
+	ec->dev.dma_mask = &ec->dma_mask;
+	ec->dma_mask = (u64)0xffffffff;
+
 	if (slot < 4) {
 		ec_set_resource(ec, ECARD_RES_MEMC,
 				PODSLOT_MEMC_BASE + (slot << 14),
-				PODSLOT_MEMC_SIZE, IORESOURCE_MEM);
-		base = PODSLOT_IOC0_BASE;
-	}
+				PODSLOT_MEMC_SIZE);
+		base = PODSLOT_IOC0_BASE + (slot << 14);
+	} else
+		base = PODSLOT_IOC4_BASE + ((slot - 4) << 14);
 
 #ifdef CONFIG_ARCH_RPC
 	if (slot < 8) {
 		ec_set_resource(ec, ECARD_RES_EASI,
 				PODSLOT_EASI_BASE + (slot << 24),
-				PODSLOT_EASI_SIZE, IORESOURCE_MEM);
+				PODSLOT_EASI_SIZE);
 	}
 
 	if (slot == 8) {
-		ec_set_resource(ec, ECARD_RES_MEMC, NETSLOT_BASE,
-				NETSLOT_SIZE, IORESOURCE_MEM);
+		ec_set_resource(ec, ECARD_RES_MEMC, NETSLOT_BASE, NETSLOT_SIZE);
 	} else
 #endif
 
-	for (i = 0; i <= ECARD_RES_IOCSYNC - ECARD_RES_IOCSLOW; i++) {
+	for (i = 0; i <= ECARD_RES_IOCSYNC - ECARD_RES_IOCSLOW; i++)
 		ec_set_resource(ec, i + ECARD_RES_IOCSLOW,
-				base + (slot << 14) + (i << 19),
-				PODSLOT_IOC_SIZE, IORESOURCE_MEM);
-	}
+				base + (i << 19), PODSLOT_IOC_SIZE);
 
 	for (i = 0; i < ECARD_NUM_RESOURCES; i++) {
-		if (ec->resource[i].start &&
+		if (ec->resource[i].flags &&
 		    request_resource(&iomem_resource, &ec->resource[i])) {
 			printk(KERN_ERR "%s: resource(s) not available\n",
 				ec->dev.bus_id);
 			ec->resource[i].end -= ec->resource[i].start;
 			ec->resource[i].start = 0;
+			ec->resource[i].flags = 0;
 		}
 	}
+
+ nomem:
+	return ec;
 }
 
 static ssize_t ecard_show_irq(struct device *dev, char *buf)
@@ -836,16 +872,12 @@
 	return sprintf(buf, "%u\n", ec->irq);
 }
 
-static DEVICE_ATTR(irq, S_IRUGO, ecard_show_irq, NULL);
-
 static ssize_t ecard_show_dma(struct device *dev, char *buf)
 {
 	struct expansion_card *ec = ECARD_DEV(dev);
 	return sprintf(buf, "%u\n", ec->dma);
 }
 
-static DEVICE_ATTR(dma, S_IRUGO, ecard_show_dma, NULL);
-
 static ssize_t ecard_show_resources(struct device *dev, char *buf)
 {
 	struct expansion_card *ec = ECARD_DEV(dev);
@@ -861,23 +893,33 @@
 	return str - buf;
 }
 
-static DEVICE_ATTR(resource, S_IRUGO, ecard_show_resources, NULL);
-
 static ssize_t ecard_show_vendor(struct device *dev, char *buf)
 {
 	struct expansion_card *ec = ECARD_DEV(dev);
 	return sprintf(buf, "%u\n", ec->cid.manufacturer);
 }
 
-static DEVICE_ATTR(vendor, S_IRUGO, ecard_show_vendor, NULL);
-
 static ssize_t ecard_show_device(struct device *dev, char *buf)
 {
 	struct expansion_card *ec = ECARD_DEV(dev);
 	return sprintf(buf, "%u\n", ec->cid.product);
 }
 
-static DEVICE_ATTR(device, S_IRUGO, ecard_show_device, NULL);
+static ssize_t ecard_show_type(struct device *dev, char *buf)
+{
+	struct expansion_card *ec = ECARD_DEV(dev);
+	return sprintf(buf, "%s\n", ec->type == ECARD_EASI ? "EASI" : "IOC");
+}
+
+static struct device_attribute ecard_dev_attrs[] = {
+	__ATTR(device,   S_IRUGO, ecard_show_device,    NULL),
+	__ATTR(dma,      S_IRUGO, ecard_show_dma,       NULL),
+	__ATTR(irq,      S_IRUGO, ecard_show_irq,       NULL),
+	__ATTR(resource, S_IRUGO, ecard_show_resources, NULL),
+	__ATTR(type,     S_IRUGO, ecard_show_type,      NULL),
+	__ATTR(vendor,   S_IRUGO, ecard_show_vendor,    NULL),
+	__ATTR_NULL,
+};
 
 
 int ecard_request_resources(struct expansion_card *ec)
@@ -927,21 +969,13 @@
 	ecard_t **ecp;
 	ecard_t *ec;
 	struct ex_ecid cid;
-	int i, rc = -ENOMEM;
+	int i, rc;
 
-	ec = kmalloc(sizeof(ecard_t), GFP_KERNEL);
-	if (!ec)
+	ec = ecard_alloc_card(type, slot);
+	if (IS_ERR(ec)) {
+		rc = PTR_ERR(ec);
 		goto nomem;
-
-	memset(ec, 0, sizeof(ecard_t));
-
-	ec->slot_no	= slot;
-	ec->type	= type;
-	ec->irq		= NO_IRQ;
-	ec->fiq		= NO_IRQ;
-	ec->dma		= NO_DMA;
-	ec->card_desc	= NULL;
-	ec->ops		= &ecard_default_ops;
+	}
 
 	rc = -ENODEV;
 	if ((ec->podaddr = ecard_address(ec, type, ECARD_SYNC)) == 0)
@@ -964,7 +998,7 @@
 	ec->cid.fiqmask = cid.r_fiqmask;
 	ec->cid.fiqoff  = ecard_gets24(cid.r_fiqoff);
 	ec->fiqaddr	=
-	ec->irqaddr	= (unsigned char *)ioaddr(ec->podaddr);
+	ec->irqaddr	= (void __iomem *)ioaddr(ec->podaddr);
 
 	if (ec->cid.is) {
 		ec->irqmask = ec->cid.irqmask;
@@ -983,14 +1017,6 @@
 			break;
 		}
 
-	snprintf(ec->dev.bus_id, sizeof(ec->dev.bus_id), "ecard%d", slot);
-	ec->dev.parent = NULL;
-	ec->dev.bus    = &ecard_bus_type;
-	ec->dev.dma_mask = &ec->dma_mask;
-	ec->dma_mask = (u64)0xffffffff;
-
-	ecard_init_resources(ec);
-
 	/*
 	 * hook the interrupt handlers
 	 */
@@ -1017,17 +1043,12 @@
 	slot_to_expcard[slot] = ec;
 
 	device_register(&ec->dev);
-	device_create_file(&ec->dev, &dev_attr_dma);
-	device_create_file(&ec->dev, &dev_attr_irq);
-	device_create_file(&ec->dev, &dev_attr_resource);
-	device_create_file(&ec->dev, &dev_attr_vendor);
-	device_create_file(&ec->dev, &dev_attr_device);
 
 	return 0;
 
-nodev:
-	kfree(ec);
-nomem:
+ nodev:
+	ecard_free_card(ec);
+ nomem:
 	return rc;
 }
 
@@ -1128,9 +1149,15 @@
 	if (drv->shutdown)
 		drv->shutdown(ec);
 	ecard_release(ec);
-	req.fn = ecard_task_reset;
-	req.ec = ec;
-	ecard_call(&req);
+
+	/*
+	 * If this card has a loader, call the reset handler.
+	 */
+	if (ec->loader) {
+		req.fn = ecard_task_reset;
+		req.ec = ec;
+		ecard_call(&req);
+	}
 }
 
 int ecard_register_driver(struct ecard_driver *drv)
@@ -1164,8 +1191,9 @@
 }
 
 struct bus_type ecard_bus_type = {
-	.name	= "ecard",
-	.match	= ecard_match,
+	.name		= "ecard",
+	.dev_attrs	= ecard_dev_attrs,
+	.match		= ecard_match,
 };
 
 static int ecard_bus_init(void)
@@ -1176,7 +1204,7 @@
 postcore_initcall(ecard_bus_init);
 
 EXPORT_SYMBOL(ecard_readchunk);
-EXPORT_SYMBOL(ecard_address);
+EXPORT_SYMBOL(__ecard_address);
 EXPORT_SYMBOL(ecard_register_driver);
 EXPORT_SYMBOL(ecard_remove_driver);
 EXPORT_SYMBOL(ecard_bus_type);
diff -Nru a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c
--- a/arch/arm/kernel/fiq.c	2005-01-23 05:41:53 -08:00
+++ b/arch/arm/kernel/fiq.c	2005-03-02 07:26:19 -08:00
@@ -46,12 +46,6 @@
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-#warning This file requires GCC 3.3.x or older to build.  Alternatively,
-#warning please talk to GCC people to resolve the issues with the
-#warning assembly clobber list.
-#endif
-
 static unsigned long no_fiq_insn;
 
 /* Default reacquire function
@@ -91,44 +85,43 @@
 
 /*
  * Taking an interrupt in FIQ mode is death, so both these functions
- * disable irqs for the duration. 
+ * disable irqs for the duration.  Note - these functions are almost
+ * entirely coded in assembly.
  */
-void set_fiq_regs(struct pt_regs *regs)
+void __attribute__((naked)) set_fiq_regs(struct pt_regs *regs)
 {
 	register unsigned long tmp;
-	__asm__ volatile (
-	"mrs	%0, cpsr\n\
+	asm volatile (
+	"mov	ip, sp\n\
+	stmfd	sp!, {fp, ip, lr, pc}\n\
+	sub	fp, ip, #4\n\
+	mrs	%0, cpsr\n\
 	msr	cpsr_c, %2	@ select FIQ mode\n\
 	mov	r0, r0\n\
 	ldmia	%1, {r8 - r14}\n\
 	msr	cpsr_c, %0	@ return to SVC mode\n\
-	mov	r0, r0"
+	mov	r0, r0\n\
+	ldmea	fp, {fp, sp, pc}"
 	: "=&r" (tmp)
-	: "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)
-	/* These registers aren't modified by the above code in a way
-	   visible to the compiler, but we mark them as clobbers anyway
-	   so that GCC won't put any of the input or output operands in
-	   them.  */
-	: "r8", "r9", "r10", "r11", "r12", "r13", "r14");
+	: "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE));
 }
 
-void get_fiq_regs(struct pt_regs *regs)
+void __attribute__((naked)) get_fiq_regs(struct pt_regs *regs)
 {
 	register unsigned long tmp;
-	__asm__ volatile (
-	"mrs	%0, cpsr\n\
+	asm volatile (
+	"mov	ip, sp\n\
+	stmfd	sp!, {fp, ip, lr, pc}\n\
+	sub	fp, ip, #4\n\
+	mrs	%0, cpsr\n\
 	msr	cpsr_c, %2	@ select FIQ mode\n\
 	mov	r0, r0\n\
 	stmia	%1, {r8 - r14}\n\
 	msr	cpsr_c, %0	@ return to SVC mode\n\
-	mov	r0, r0"
+	mov	r0, r0\n\
+	ldmea	fp, {fp, sp, pc}"
 	: "=&r" (tmp)
-	: "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)
-	/* These registers aren't modified by the above code in a way
-	   visible to the compiler, but we mark them as clobbers anyway
-	   so that GCC won't put any of the input or output operands in
-	   them.  */
-	: "r8", "r9", "r10", "r11", "r12", "r13", "r14");
+	: "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE));
 }
 
 int claim_fiq(struct fiq_handler *f)
diff -Nru a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
--- a/arch/arm/kernel/irq.c	2005-01-20 21:02:14 -08:00
+++ b/arch/arm/kernel/irq.c	2005-03-04 02:08:06 -08:00
@@ -56,6 +56,13 @@
 void (*init_arch_irq)(void) __initdata = NULL;
 
 /*
+ * No architecture-specific irq_finish function defined in arm/arch/irqs.h.
+ */
+#ifndef irq_finish
+#define irq_finish(irq) do { } while (0)
+#endif
+
+/*
  * Dummy mask/unmask handler
  */
 void dummy_mask_unmask_irq(unsigned int irq)
@@ -531,6 +538,8 @@
 	 */
 	if (!list_empty(&irq_pending))
 		do_pending_irqs(regs);
+
+	irq_finish(irq);
 
 	spin_unlock(&irq_controller_lock);
 	irq_exit();
diff -Nru a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
--- a/arch/arm/kernel/sys_arm.c	2005-02-14 08:55:24 -08:00
+++ b/arch/arm/kernel/sys_arm.c	2005-03-02 07:05:14 -08:00
@@ -230,6 +230,18 @@
 	}
 }
 
+asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg,
+			  unsigned long __user *addr)
+{
+	unsigned long ret;
+	long err;
+
+	err = do_shmat(shmid, shmaddr, shmflg, &ret);
+	if (err == 0)
+		err = put_user(ret, addr);
+	return err;
+}
+
 /* Fork a new task - this creates a new program thread.
  * This is called indirectly via a small wrapper
  */
diff -Nru a/arch/arm/mach-ebsa110/io.c b/arch/arm/mach-ebsa110/io.c
--- a/arch/arm/mach-ebsa110/io.c	2004-10-30 06:49:38 -07:00
+++ b/arch/arm/mach-ebsa110/io.c	2005-03-05 06:25:03 -08:00
@@ -153,9 +153,9 @@
 	 * The SuperIO registers use sane addressing techniques...
 	 */
 	if (SUPERIO_PORT(port))
-		ret = __raw_readb(ISAIO_BASE + (port << 2));
+		ret = __raw_readb((void __iomem *)ISAIO_BASE + (port << 2));
 	else {
-		void __iomem *a = ISAIO_BASE + ((port & ~1) << 1);
+		void __iomem *a = (void __iomem *)ISAIO_BASE + ((port & ~1) << 1);
 
 		/*
 		 * Shame nothing else does
@@ -174,45 +174,33 @@
  */
 u8 __inb16(unsigned int port)
 {
-	u32 ret;
+	unsigned int offset;
 
 	/*
 	 * The SuperIO registers use sane addressing techniques...
 	 */
 	if (SUPERIO_PORT(port))
-		ret = __raw_readb(ISAIO_BASE + (port << 2));
-	else {
-		void __iomem *a = ISAIO_BASE + ((port & ~1) << 1);
+		offset = port << 2;
+	else
+		offset = (port & ~1) << 1 | (port & 1);
 
-		/*
-		 * Shame nothing else does
-		 */
-		ret = __raw_readb(a + (port & 1));
-	}
-	return ret;
+	return __raw_readb((void __iomem *)ISAIO_BASE + offset);
 }
 
 u16 __inw(unsigned int port)
 {
-	u32 ret;
+	unsigned int offset;
 
 	/*
 	 * The SuperIO registers use sane addressing techniques...
 	 */
 	if (SUPERIO_PORT(port))
-		ret = __raw_readw(ISAIO_BASE + (port << 2));
+		offset = port << 2;
 	else {
-		void __iomem *a = ISAIO_BASE + ((port & ~1) << 1);
-
-		/*
-		 * Shame nothing else does
-		 */
-		if (port & 1)
-			BUG();
-
-		ret = __raw_readw(a);
+		offset = port << 1;
+		BUG_ON(port & 1);
 	}
-	return ret;
+	return __raw_readw((void __iomem *)ISAIO_BASE + offset);
 }
 
 /*
@@ -225,7 +213,7 @@
 	if (SUPERIO_PORT(port) || port & 3)
 		BUG();
 
-	a = ISAIO_BASE + (port << 1);
+	a = (void __iomem *)ISAIO_BASE + ((port & ~1) << 1);
 
 	return __raw_readw(a) | __raw_readw(a + 4) << 16;
 }
@@ -241,9 +229,9 @@
 	 * The SuperIO registers use sane addressing techniques...
 	 */
 	if (SUPERIO_PORT(port))
-		__raw_writeb(val, ISAIO_BASE + (port << 2));
+		__raw_writeb(val, (void __iomem *)ISAIO_BASE + (port << 2));
 	else {
-		void __iomem *a = ISAIO_BASE + ((port & ~1) << 1);
+		void __iomem *a = (void __iomem *)ISAIO_BASE + ((port & ~1) << 1);
 
 		/*
 		 * Shame nothing else does
@@ -257,37 +245,33 @@
 
 void __outb16(u8 val, unsigned int port)
 {
+	unsigned int offset;
+
 	/*
 	 * The SuperIO registers use sane addressing techniques...
 	 */
 	if (SUPERIO_PORT(port))
-		__raw_writeb(val, ISAIO_BASE + (port << 2));
-	else {
-		void __iomem *a = ISAIO_BASE + ((port & ~1) << 1);
+		offset = port << 2;
+	else
+		offset = (port & ~1) << 1 | (port & 1);
 
-		/*
-		 * Shame nothing else does
-		 */
-		__raw_writeb(val, a + (port & 1));
-	}
+	__raw_writeb(val, (void __iomem *)ISAIO_BASE + offset);
 }
 
 void __outw(u16 val, unsigned int port)
 {
-	u32 off;
+	unsigned int offset;
 
 	/*
 	 * The SuperIO registers use sane addressing techniques...
 	 */
 	if (SUPERIO_PORT(port))
-		off = port << 2;
+		offset = port << 2;
 	else {
-		off = port << 1;
-		if (port & 1)
-			BUG();
-
+		offset = port << 1;
+		BUG_ON(port & 1);
 	}
-	__raw_writew(val, ISAIO_BASE + off);
+	__raw_writew(val, (void __iomem *)ISAIO_BASE + offset);
 }
 
 void __outl(u32 val, unsigned int port)
@@ -300,13 +284,6 @@
 EXPORT_SYMBOL(__outw);
 EXPORT_SYMBOL(__outl);
 
-extern void __arch_writesb(unsigned long virt, const void *from, int len);
-extern void __arch_writesw(unsigned long virt, const void *from, int len);
-extern void __arch_writesl(unsigned long virt, const void *from, int len);
-extern void __arch_readsb(unsigned long virt, void *from, int len);
-extern void __arch_readsw(unsigned long virt, void *from, int len);
-extern void __arch_readsl(unsigned long virt, void *from, int len);
-
 void outsb(unsigned int port, const void *from, int len)
 {
 	u32 off;
@@ -319,7 +296,7 @@
 			BUG();
 	}
 
-	__raw_writesb(ISAIO_BASE + off, from, len);
+	__raw_writesb((void __iomem *)ISAIO_BASE + off, from, len);
 }
 
 void insb(unsigned int port, void *from, int len)
@@ -334,7 +311,7 @@
 			BUG();
 	}
 
-	__raw_readsb(ISAIO_BASE + off, from, len);
+	__raw_readsb((void __iomem *)ISAIO_BASE + off, from, len);
 }
 
 EXPORT_SYMBOL(outsb);
@@ -352,7 +329,7 @@
 			BUG();
 	}
 
-	__raw_writesw(ISAIO_BASE + off, from, len);
+	__raw_writesw((void __iomem *)ISAIO_BASE + off, from, len);
 }
 
 void insw(unsigned int port, void *from, int len)
@@ -367,7 +344,7 @@
 			BUG();
 	}
 
-	__raw_readsw(ISAIO_BASE + off, from, len);
+	__raw_readsw((void __iomem *)ISAIO_BASE + off, from, len);
 }
 
 EXPORT_SYMBOL(outsw);
@@ -384,7 +361,7 @@
 	if (SUPERIO_PORT(port) || port & 3)
 		BUG();
 
-	__raw_writesw(ISAIO_BASE + off, from, len << 1);
+	__raw_writesw((void __iomem *)ISAIO_BASE + off, from, len << 1);
 }
 
 void insl(unsigned int port, void *from, int len)
@@ -394,7 +371,7 @@
 	if (SUPERIO_PORT(port) || port & 3)
 		BUG();
 
-	__raw_readsw(ISAIO_BASE + off, from, len << 1);
+	__raw_readsw((void __iomem *)ISAIO_BASE + off, from, len << 1);
 }
 
 EXPORT_SYMBOL(outsl);
diff -Nru a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
--- a/arch/arm/mach-ixp2000/core.c	2005-02-17 09:48:07 -08:00
+++ b/arch/arm/mach-ixp2000/core.c	2005-02-16 15:50:16 -08:00
@@ -79,31 +79,11 @@
 /*************************************************************************
  * Chip specific mappings shared by all IXP2000 systems
  *************************************************************************/
-static struct map_desc ixp2000_small_io_desc[] __initdata = {
+static struct map_desc ixp2000_io_desc[] __initdata = {
 	{
-		.virtual	= IXP2000_GLOBAL_REG_VIRT_BASE,
-		.physical	= IXP2000_GLOBAL_REG_PHYS_BASE,
-		.length		= IXP2000_GLOBAL_REG_SIZE,
-		.type		= MT_DEVICE
-	}, {
-		.virtual	= IXP2000_GPIO_VIRT_BASE,
-		.physical	= IXP2000_GPIO_PHYS_BASE,
-		.length		= IXP2000_GPIO_SIZE,
-		.type		= MT_DEVICE
-	}, {
-		.virtual	= IXP2000_TIMER_VIRT_BASE,
-		.physical	= IXP2000_TIMER_PHYS_BASE,
-		.length		= IXP2000_TIMER_SIZE,
-		.type		= MT_DEVICE
-	}, {
-		.virtual	= IXP2000_UART_VIRT_BASE,
-		.physical	= IXP2000_UART_PHYS_BASE,
-		.length		= IXP2000_UART_SIZE,
-		.type		= MT_DEVICE
-	}, {
-		.virtual	= IXP2000_SLOWPORT_CSR_VIRT_BASE,
-		.physical	= IXP2000_SLOWPORT_CSR_PHYS_BASE,
-		.length		= IXP2000_SLOWPORT_CSR_SIZE,
+		.virtual	= IXP2000_CAP_VIRT_BASE,
+		.physical	= IXP2000_CAP_PHYS_BASE,
+		.length		= IXP2000_CAP_SIZE,
 		.type		= MT_DEVICE
 	}, {
 		.virtual	= IXP2000_INTCTL_VIRT_BASE,
@@ -115,11 +95,7 @@
 		.physical	= IXP2000_PCI_CREG_PHYS_BASE,
 		.length		= IXP2000_PCI_CREG_SIZE,
 		.type		= MT_DEVICE
-	}
-};
-
-static struct map_desc ixp2000_large_io_desc[] __initdata = {
-	{
+	}, {
 		.virtual	= IXP2000_PCI_CSR_VIRT_BASE,
 		.physical	= IXP2000_PCI_CSR_PHYS_BASE,
 		.length		= IXP2000_PCI_CSR_SIZE,
@@ -157,8 +133,7 @@
 
 void __init ixp2000_map_io(void)
 {
-	iotable_init(ixp2000_small_io_desc, ARRAY_SIZE(ixp2000_small_io_desc));
-	iotable_init(ixp2000_large_io_desc, ARRAY_SIZE(ixp2000_large_io_desc));
+	iotable_init(ixp2000_io_desc, ARRAY_SIZE(ixp2000_io_desc));
 	early_serial_setup(&ixp2000_serial_port);
 
 	/* Set slowport to 8-bit mode.  */
diff -Nru a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c
--- a/arch/arm/mach-ixp2000/enp2611.c	2005-02-15 13:37:32 -08:00
+++ b/arch/arm/mach-ixp2000/enp2611.c	2005-03-02 04:41:38 -08:00
@@ -6,7 +6,7 @@
  * Created 2004 by Lennert Buytenhek from the ixdp2x01 code.  The
  * original version carries the following notices:
  *
- * Original Author: Andrzej Mialwoski <andrzej.mialwoski@intel.com>
+ * Original Author: Andrzej Mialkowski <andrzej.mialkowski@intel.com>
  * Maintainer: Deepak Saxena <dsaxena@plexity.net>
  *
  * Copyright (C) 2002-2003 Intel Corp.
diff -Nru a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c
--- a/arch/arm/mach-ixp2000/ixdp2x01.c	2004-09-22 17:49:41 -07:00
+++ b/arch/arm/mach-ixp2000/ixdp2x01.c	2005-03-02 04:41:08 -08:00
@@ -3,7 +3,7 @@
  *
  * Code common to Intel IXDP2401 and IXDP2801 platforms
  *
- * Original Author: Andrzej Mialwoski <andrzej.mialwoski@intel.com>
+ * Original Author: Andrzej Mialkowski <andrzej.mialkowski@intel.com>
  * Maintainer: Deepak Saxena <dsaxena@plexity.net>
  *
  * Copyright (C) 2002-2003 Intel Corp.
diff -Nru a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile
--- a/arch/arm/mach-ixp4xx/Makefile	2005-01-23 14:58:55 -08:00
+++ b/arch/arm/mach-ixp4xx/Makefile	2005-02-02 09:59:45 -08:00
@@ -7,6 +7,5 @@
 obj-$(CONFIG_ARCH_IXDP4XX)	+= ixdp425-pci.o ixdp425-setup.o
 obj-$(CONFIG_MACH_IXDPG425)	+= ixdpg425-pci.o coyote-setup.o
 obj-$(CONFIG_ARCH_ADI_COYOTE)	+= coyote-pci.o coyote-setup.o
-obj-$(CONFIG_ARCH_PRPMC1100)	+= prpmc1100-pci.o prpmc1100-setup.o
 obj-$(CONFIG_MACH_GTWX5715)	+= gtwx5715-pci.o gtwx5715-setup.o
 
diff -Nru a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
--- a/arch/arm/mach-ixp4xx/coyote-setup.c	2005-01-11 12:56:10 -08:00
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c	2005-02-02 10:10:13 -08:00
@@ -3,7 +3,7 @@
  *
  * Board setup for ADI Engineering and IXDGP425 boards
  *
- * Copyright (C) 2003-2004 MontaVista Software, Inc.
+ * Copyright (C) 2003-2005 MontaVista Software, Inc.
  *
  * Author: Deepak Saxena <dsaxena@plexity.net>
  */
@@ -13,7 +13,7 @@
 #include <linux/device.h>
 #include <linux/serial.h>
 #include <linux/tty.h>
-#include <linux/serial_core.h>
+#include <linux/serial_8250.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
@@ -24,39 +24,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
-#ifdef	__ARMEB__
-#define	REG_OFFSET	3
-#else
-#define	REG_OFFSET	0
-#endif
-
-/*
- * Only one serial port is connected on the Coyote & IXDPG425
- */
-static struct uart_port coyote_serial_port = {
-	.membase	= (char*)(IXP4XX_UART2_BASE_VIRT + REG_OFFSET),
-	.mapbase	= (IXP4XX_UART2_BASE_PHYS),
-	.irq		= IRQ_IXP4XX_UART2,
-	.flags		= UPF_SKIP_TEST,
-	.iotype		= UPIO_MEM,	
-	.regshift	= 2,
-	.uartclk	= IXP4XX_UART_XTAL,
-	.line		= 0,
-	.type		= PORT_XSCALE,
-	.fifosize	= 32
-};
-
 void __init coyote_map_io(void)
 {
-	if (machine_is_ixdpg425()) {
-		coyote_serial_port.membase =
-			(char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
-		coyote_serial_port.mapbase = IXP4XX_UART1_BASE_PHYS;
-		coyote_serial_port.irq = IRQ_IXP4XX_UART1;
-	}
-
-	early_serial_setup(&coyote_serial_port);
-
 	ixp4xx_map_io();
 }
 
@@ -81,14 +50,49 @@
 	.resource	= &coyote_flash_resource,
 };
 
+static struct resource coyote_uart_resource = {
+	.start	= IXP4XX_UART2_BASE_PHYS,
+	.end	= IXP4XX_UART2_BASE_PHYS + 0x0fff,
+	.flags	= IORESOURCE_MEM,
+};
+
+static struct plat_serial8250_port coyote_uart_data = {
+	.mapbase	= IXP4XX_UART2_BASE_PHYS,
+	.membase	= (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+	.irq		= IRQ_IXP4XX_UART2,
+	.flags		= UPF_BOOT_AUTOCONF,
+	.iotype		= UPIO_MEM,
+	.regshift	= 2,
+	.uartclk	= IXP4XX_UART_XTAL,
+};
+
+static struct platform_device coyote_uart = {
+	.name		= "serial8250",
+	.id		= 0,
+	.dev			= {
+		.platform_data	= &coyote_uart_data,
+	},
+	.num_resources	= 1,
+	.resource	= &coyote_uart_resource,
+};
+
 static struct platform_device *coyote_devices[] __initdata = {
-	&coyote_flash
+	&coyote_flash,
+	&coyote_uart
 };
 
 static void __init coyote_init(void)
 {
 	*IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
 	*IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
+
+	if (machine_is_ixdpg425()) {
+		coyote_uart_data.membase =
+			(char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
+		coyote_uart_data.mapbase = IXP4XX_UART1_BASE_PHYS;
+		coyote_uart_data.irq = IRQ_IXP4XX_UART1;
+	}
+
 
 	ixp4xx_sys_init();
 	platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
diff -Nru a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c	2005-01-11 12:56:17 -08:00
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c	2005-02-02 10:10:24 -08:00
@@ -3,7 +3,7 @@
  *
  * IXDP425/IXCDP1100 board-setup 
  *
- * Copyright (C) 2003-2004 MontaVista Software, Inc.
+ * Copyright (C) 2003-2005 MontaVista Software, Inc.
  *
  * Author: Deepak Saxena <dsaxena@plexity.net>
  */
@@ -13,7 +13,7 @@
 #include <linux/device.h>
 #include <linux/serial.h>
 #include <linux/tty.h>
-#include <linux/serial_core.h>
+#include <linux/serial_8250.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
@@ -24,46 +24,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/flash.h>
 
-#ifdef	__ARMEB__
-#define	REG_OFFSET	3
-#else
-#define	REG_OFFSET	0
-#endif
-
-/*
- * IXDP425 uses both chipset serial ports
- */
-static struct uart_port ixdp425_serial_ports[] = {
-	{
-		.membase	= (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET),
-		.mapbase	= (IXP4XX_UART1_BASE_PHYS),
-		.irq		= IRQ_IXP4XX_UART1,
-		.flags		= UPF_SKIP_TEST,
-		.iotype		= UPIO_MEM,	
-		.regshift	= 2,
-		.uartclk	= IXP4XX_UART_XTAL,
-		.line		= 0,
-		.type		= PORT_XSCALE,
-		.fifosize	= 32
-	} , {
-		.membase	= (char*)(IXP4XX_UART2_BASE_VIRT + REG_OFFSET),
-		.mapbase	= (IXP4XX_UART2_BASE_PHYS),
-		.irq		= IRQ_IXP4XX_UART2,
-		.flags		= UPF_SKIP_TEST,
-		.iotype		= UPIO_MEM,	
-		.regshift	= 2,
-		.uartclk	= IXP4XX_UART_XTAL,
-		.line		= 1,
-		.type		= PORT_XSCALE,
-		.fifosize	= 32
-	}
-};
-
 void __init ixdp425_map_io(void) 
 {
-	early_serial_setup(&ixdp425_serial_ports[0]);
-	early_serial_setup(&ixdp425_serial_ports[1]);
-
 	ixp4xx_map_io();
 }
 
@@ -102,10 +64,54 @@
 	.num_resources	= 0
 };
 
+static struct resource ixdp425_uart_resources[] = {
+	{
+		.start		= IXP4XX_UART1_BASE_PHYS,
+		.end		= IXP4XX_UART1_BASE_PHYS + 0x0fff,
+		.flags		= IORESOURCE_MEM
+	},
+	{
+		.start		= IXP4XX_UART2_BASE_PHYS,
+		.end		= IXP4XX_UART2_BASE_PHYS + 0x0fff,
+		.flags		= IORESOURCE_MEM
+	}
+};
+
+static struct plat_serial8250_port ixdp425_uart_data[] = {
+	{
+		.mapbase	= IXP4XX_UART1_BASE_PHYS,
+		.membase	= (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
+		.irq		= IRQ_IXP4XX_UART1,
+		.flags		= UPF_BOOT_AUTOCONF,
+		.iotype		= UPIO_MEM,
+		.regshift	= 2,
+		.uartclk	= IXP4XX_UART_XTAL,
+	},
+	{
+		.mapbase	= IXP4XX_UART2_BASE_PHYS,
+		.membase	= (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
+		.irq		= IRQ_IXP4XX_UART1,
+		.flags		= UPF_BOOT_AUTOCONF,
+		.iotype		= UPIO_MEM,
+		.regshift	= 2,
+		.uartclk	= IXP4XX_UART_XTAL,
+	}
+};
+
+static struct platform_device ixdp425_uart = {
+	.name			= "serial8250",
+	.id			= 0,
+	.dev.platform_data	= ixdp425_uart_data,
+	.num_resources		= 2,
+	.resource		= ixdp425_uart_resources
+};
+
 static struct platform_device *ixdp425_devices[] __initdata = {
 	&ixdp425_i2c_controller,
-	&ixdp425_flash
+	&ixdp425_flash,
+	&ixdp425_uart
 };
+
 
 static void __init ixdp425_init(void)
 {
diff -Nru a/arch/arm/mach-ixp4xx/prpmc1100-pci.c b/arch/arm/mach-ixp4xx/prpmc1100-pci.c
--- a/arch/arm/mach-ixp4xx/prpmc1100-pci.c	2005-01-11 12:56:24 -08:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,120 +0,0 @@
-/*
- * arch/arm/mach-ixp4xx/prpmc1100-pci.c 
- *
- * PrPMC1100 PCI initialization
- *
- * Copyright (C) 2003-2004 MontaVista Sofwtare, Inc. 
- * Based on IXDP425 code originally (C) Intel Corporation
- *
- * Author: Deepak Saxena <dsaxena@plexity.net>
- *
- * PrPMC1100 PCI init code.  GPIO usage is similar to that on 
- * IXDP425, but the IRQ routing is completely different and
- * depends on what carrier you are using. This code is written
- * to work on the Motorola PrPMC800 ATX carrier board.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/config.h>
-#include <linux/pci.h>
-#include <linux/init.h>
-
-#include <asm/mach-types.h>
-#include <asm/irq.h>
-#include <asm/hardware.h>
-
-#include <asm/mach/pci.h>
-
-
-void __init prpmc1100_pci_preinit(void)
-{
-	gpio_line_config(PRPMC1100_PCI_INTA_PIN, 
-				IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
-	gpio_line_config(PRPMC1100_PCI_INTB_PIN, 
-				IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
-	gpio_line_config(PRPMC1100_PCI_INTC_PIN, 
-				IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
-	gpio_line_config(PRPMC1100_PCI_INTD_PIN, 
-				IXP4XX_GPIO_IN | IXP4XX_GPIO_ACTIVE_LOW);
-
-	gpio_line_isr_clear(PRPMC1100_PCI_INTA_PIN);
-	gpio_line_isr_clear(PRPMC1100_PCI_INTB_PIN);
-	gpio_line_isr_clear(PRPMC1100_PCI_INTC_PIN);
-	gpio_line_isr_clear(PRPMC1100_PCI_INTD_PIN);
-
-	ixp4xx_pci_preinit();
-}
-
-
-static int __init prpmc1100_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
-{
-	int irq = -1;
-
-	static int pci_irq_table[][4] = { 
-		{	/* IDSEL 16 - PMC A1 */
-			IRQ_PRPMC1100_PCI_INTD, 
-			IRQ_PRPMC1100_PCI_INTA, 
-			IRQ_PRPMC1100_PCI_INTB, 
-			IRQ_PRPMC1100_PCI_INTC
-		}, {	/* IDSEL 17 - PRPMC-A-B */
-			IRQ_PRPMC1100_PCI_INTD, 
-			IRQ_PRPMC1100_PCI_INTA, 
-			IRQ_PRPMC1100_PCI_INTB, 
-			IRQ_PRPMC1100_PCI_INTC
-		}, { 	/* IDSEL 18 - PMC A1-B */
-			IRQ_PRPMC1100_PCI_INTA, 
-			IRQ_PRPMC1100_PCI_INTB, 
-			IRQ_PRPMC1100_PCI_INTC, 
-			IRQ_PRPMC1100_PCI_INTD
-		}, {	/* IDSEL 19 - Unused */
-			0, 0, 0, 0 
-		}, {	/* IDSEL 20 - P2P Bridge */
-			IRQ_PRPMC1100_PCI_INTA, 
-			IRQ_PRPMC1100_PCI_INTB, 
-			IRQ_PRPMC1100_PCI_INTC, 
-			IRQ_PRPMC1100_PCI_INTD
-		}, {	/* IDSEL 21 - PMC A2 */
-			IRQ_PRPMC1100_PCI_INTC, 
-			IRQ_PRPMC1100_PCI_INTD, 
-			IRQ_PRPMC1100_PCI_INTA, 
-			IRQ_PRPMC1100_PCI_INTB
-		}, {	/* IDSEL 22 - PMC A2-B */
-			IRQ_PRPMC1100_PCI_INTD, 
-			IRQ_PRPMC1100_PCI_INTA, 
-			IRQ_PRPMC1100_PCI_INTB, 
-			IRQ_PRPMC1100_PCI_INTC
-		},
-	};
-
-	if (slot >= PRPMC1100_PCI_MIN_DEVID && slot <= PRPMC1100_PCI_MAX_DEVID 
-		&& pin >= 1 && pin <= PRPMC1100_PCI_IRQ_LINES) {
-		irq = pci_irq_table[slot - PRPMC1100_PCI_MIN_DEVID][pin - 1];
-	}
-
-	return irq;
-}
-
-
-struct hw_pci prpmc1100_pci __initdata = {
-	.nr_controllers = 1,
-	.preinit =	  prpmc1100_pci_preinit,
-	.swizzle =	  pci_std_swizzle,
-	.setup =	  ixp4xx_setup,
-	.scan =		  ixp4xx_scan_bus,
-	.map_irq =	  prpmc1100_map_irq,
-};
-
-int __init prpmc1100_pci_init(void)
-{
-	if (machine_is_prpmc1100())
-		pci_common_init(&prpmc1100_pci);
-	return 0;
-}
-
-subsys_initcall(prpmc1100_pci_init);
-
diff -Nru a/arch/arm/mach-ixp4xx/prpmc1100-setup.c b/arch/arm/mach-ixp4xx/prpmc1100-setup.c
--- a/arch/arm/mach-ixp4xx/prpmc1100-setup.c	2005-01-11 12:56:29 -08:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,98 +0,0 @@
-/*
- * arch/arm/mach-ixp4xx/prpmc1100-setup.c
- *
- * Motorola PrPMC1100 board setup
- *
- * Copyright (C) 2003-2004 MontaVista Software, Inc.
- *
- * Author: Deepak Saxena <dsaxena@plexity.net>
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/serial.h>
-#include <linux/tty.h>
-#include <linux/serial_core.h>
-
-#include <asm/types.h>
-#include <asm/setup.h>
-#include <asm/memory.h>
-#include <asm/hardware.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/flash.h>
-
-#ifdef	__ARMEB__
-#define	REG_OFFSET	3
-#else
-#define	REG_OFFSET	0
-#endif
-
-/*
- * Only one serial port is connected on the PrPMC1100
- */
-static struct uart_port prpmc1100_serial_port = {
-	.membase	= (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET),
-	.mapbase	= (IXP4XX_UART1_BASE_PHYS),
-	.irq		= IRQ_IXP4XX_UART1,
-	.flags		= UPF_SKIP_TEST,
-	.iotype		= UPIO_MEM,	
-	.regshift	= 2,
-	.uartclk	= IXP4XX_UART_XTAL,
-	.line		= 0,
-	.type		= PORT_XSCALE,
-	.fifosize	= 32
-};
-
-void __init prpmc1100_map_io(void)
-{
-	early_serial_setup(&prpmc1100_serial_port);
-
-	ixp4xx_map_io();
-}
-
-static struct flash_platform_data prpmc1100_flash_data = {
-	.map_name	= "cfi_probe",
-	.width		= 2,
-};
-
-static struct resource prpmc1100_flash_resource = {
-	.start		= PRPMC1100_FLASH_BASE,
-	.end		= PRPMC1100_FLASH_BASE + PRPMC1100_FLASH_SIZE,
-	.flags		= IORESOURCE_MEM,
-};
-
-static struct platform_device prpmc1100_flash = {
-	.name		= "IXP4XX-Flash",
-	.id		= 0,
-	.dev		= {
-		.platform_data = &prpmc1100_flash_data,
-	},
-	.num_resources	= 1,
-	.resource	= &prpmc1100_flash_resource,
-};
-
-static struct platform_device *prpmc1100_devices[] __initdata = {
-	&prpmc1100_flash
-};
-
-static void __init prpmc1100_init(void)
-{
-	ixp4xx_sys_init();
-
-	platform_add_devices(prpmc1100_devices, ARRAY_SIZE(prpmc1100_devices));
-}
-
-MACHINE_START(PRPMC1100, "Motorola PrPMC1100")
-        MAINTAINER("MontaVista Software, Inc.")
-        BOOT_MEM(PHYS_OFFSET, IXP4XX_PERIPHERAL_BASE_PHYS,
-                IXP4XX_PERIPHERAL_BASE_VIRT)
-        MAPIO(prpmc1100_map_io)
-        INITIRQ(ixp4xx_init_irq)
-	.timer		= &ixp4xx_timer,
-        BOOT_PARAMS(0x0100)
-	INIT_MACHINE(prpmc1100_init)
-MACHINE_END
-
diff -Nru a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
--- a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c	2004-12-04 13:01:02 -08:00
+++ b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c	2005-03-03 16:00:00 -08:00
@@ -157,8 +157,6 @@
 	.unmask	= lh7a40x_unmask_cpld_irq,
 };
 
-#define IRQ_DISPATCH(irq) irq_desc[irq].handle ((irq), &irq_desc[irq], regs)
-
 static void lpd7a40x_cpld_handler (unsigned int irq, struct irqdesc *desc,
 				  struct pt_regs *regs)
 {
diff -Nru a/arch/arm/mach-lh7a40x/common.h b/arch/arm/mach-lh7a40x/common.h
--- a/arch/arm/mach-lh7a40x/common.h	2004-12-04 23:10:02 -08:00
+++ b/arch/arm/mach-lh7a40x/common.h	2005-03-03 16:00:00 -08:00
@@ -12,3 +12,5 @@
 
 extern void lh7a400_init_irq (void);
 extern void lh7a404_init_irq (void);
+
+#define IRQ_DISPATCH(irq) irq_desc[irq].handle ((irq), &irq_desc[irq], regs)
diff -Nru a/arch/arm/mach-lh7a40x/irq-lpd7a40x.c b/arch/arm/mach-lh7a40x/irq-lpd7a40x.c
--- a/arch/arm/mach-lh7a40x/irq-lpd7a40x.c	2004-05-08 17:00:00 -07:00
+++ b/arch/arm/mach-lh7a40x/irq-lpd7a40x.c	2005-03-03 16:00:00 -08:00
@@ -55,8 +55,6 @@
 	.unmask	= lh7a40x_unmask_cpld_irq,
 };
 
-#define IRQ_DISPATCH(irq) irq_desc[irq].handle ((irq), &irq_desc[irq], regs)
-
 static void lh7a40x_cpld_handler (unsigned int irq, struct irqdesc *desc,
 				  struct pt_regs *regs)
 {
diff -Nru a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
--- a/arch/arm/mach-omap/Kconfig	2004-11-05 08:00:11 -08:00
+++ b/arch/arm/mach-omap/Kconfig	2005-02-02 18:17:13 -08:00
@@ -113,6 +113,38 @@
 	  printed, it's safe to deselect OMAP_MUX for your product.
 
 choice
+        prompt "System timer"
+	default OMAP_MPU_TIMER
+
+config OMAP_MPU_TIMER
+	bool "Use mpu timer"
+	help
+	  Select this option if you want to use the OMAP mpu timer. This
+	  timer provides more intra-tick resolution than the 32KHz timer,
+	  but consumes more power.
+
+config OMAP_32K_TIMER
+	bool "Use 32KHz timer"
+	depends on ARCH_OMAP16XX
+	help
+	  Select this option if you want to enable the OMAP 32KHz timer.
+	  This timer saves power compared to the OMAP_MPU_TIMER, and has
+	  support for no tick during idle. The 32KHz timer provides less
+	  intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is
+	  currently only available for OMAP-16xx.
+
+endchoice
+
+config OMAP_32K_TIMER_HZ
+       int "Kernel internal timer frequency for 32KHz timer"
+       range 32 1024
+       depends on OMAP_32K_TIMER
+       default "128"
+       help
+	  Kernel internal timer frequency should be a divisor of 32768,
+	  such as 64 or 128.
+
+choice
 	prompt "Low-level debug console UART"
 	depends on ARCH_OMAP
 	default OMAP_LL_DEBUG_UART1
diff -Nru a/arch/arm/mach-omap/time.c b/arch/arm/mach-omap/time.c
--- a/arch/arm/mach-omap/time.c	2004-12-01 08:14:10 -08:00
+++ b/arch/arm/mach-omap/time.c	2005-02-02 18:17:13 -08:00
@@ -51,6 +51,8 @@
 
 struct sys_timer omap_timer;
 
+#ifdef CONFIG_OMAP_MPU_TIMER
+
 /*
  * ---------------------------------------------------------------------------
  * MPU timer
@@ -67,6 +69,36 @@
 #define MPU_TIMER_AR			(1 << 1)
 #define MPU_TIMER_ST			(1 << 0)
 
+/* cycles to nsec conversions taken from arch/i386/kernel/timers/timer_tsc.c,
+ * converted to use kHz by Kevin Hilman */
+/* convert from cycles(64bits) => nanoseconds (64bits)
+ *  basic equation:
+ *		ns = cycles / (freq / ns_per_sec)
+ *		ns = cycles * (ns_per_sec / freq)
+ *		ns = cycles * (10^9 / (cpu_khz * 10^3))
+ *		ns = cycles * (10^6 / cpu_khz)
+ *
+ *	Then we use scaling math (suggested by george at mvista.com) to get:
+ *		ns = cycles * (10^6 * SC / cpu_khz / SC
+ *		ns = cycles * cyc2ns_scale / SC
+ *
+ *	And since SC is a constant power of two, we can convert the div
+ *  into a shift.
+ *			-johnstul at us.ibm.com "math is hard, lets go shopping!"
+ */
+static unsigned long cyc2ns_scale;
+#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
+
+static inline void set_cyc2ns_scale(unsigned long cpu_khz)
+{
+	cyc2ns_scale = (1000000 << CYC2NS_SCALE_FACTOR)/cpu_khz;
+}
+
+static inline unsigned long long cycles_2_ns(unsigned long long cyc)
+{
+	return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
+}
+
 /*
  * MPU_TICKS_PER_SEC must be an even number, otherwise machinecycles_to_usecs
  * will break. On P2, the timer count rate is 6.5 MHz after programming PTV
@@ -112,8 +144,10 @@
 
 unsigned long omap_mpu_timer_ticks_to_usecs(unsigned long nr_ticks)
 {
-	/* Round up to nearest usec */
-	return ((nr_ticks * 1000) / (MPU_TICKS_PER_SEC / 2 / 1000) + 1) >> 1;
+	unsigned long long nsec;
+
+	nsec = cycles_2_ns((unsigned long long)nr_ticks);
+	return (unsigned long)nsec / 1000;
 }
 
 /*
@@ -158,22 +192,190 @@
 	.handler	= omap_mpu_timer_interrupt
 };
 
+static unsigned long omap_mpu_timer1_overflows;
+static irqreturn_t omap_mpu_timer1_interrupt(int irq, void *dev_id,
+					     struct pt_regs *regs)
+{
+	omap_mpu_timer1_overflows++;
+	return IRQ_HANDLED;
+}
+
+static struct irqaction omap_mpu_timer1_irq = {
+	.name		= "mpu timer1 overflow",
+	.flags		= SA_INTERRUPT,
+	.handler	= omap_mpu_timer1_interrupt
+};
+
 static __init void omap_init_mpu_timer(void)
 {
+	set_cyc2ns_scale(MPU_TICKS_PER_SEC / 1000);
 	omap_timer.offset = omap_mpu_timer_gettimeoffset;
+	setup_irq(INT_TIMER1, &omap_mpu_timer1_irq);
 	setup_irq(INT_TIMER2, &omap_mpu_timer_irq);
 	omap_mpu_timer_start(0, 0xffffffff);
 	omap_mpu_timer_start(1, MPU_TIMER_TICK_PERIOD);
 }
 
 /*
+ * Scheduler clock - returns current time in nanosec units.
+ */
+unsigned long long sched_clock(void)
+{
+	unsigned long ticks = 0 - omap_mpu_timer_read(0);
+	unsigned long long ticks64;
+
+	ticks64 = omap_mpu_timer1_overflows;
+	ticks64 <<= 32;
+	ticks64 |= ticks;
+
+	return cycles_2_ns(ticks64);
+}
+#endif	/* CONFIG_OMAP_MPU_TIMER */
+
+#ifdef CONFIG_OMAP_32K_TIMER
+
+#ifdef CONFIG_ARCH_OMAP1510
+#error OMAP 32KHz timer does not currently work on 1510!
+#endif
+
+/*
+ * ---------------------------------------------------------------------------
+ * 32KHz OS timer
+ *
+ * This currently works only on 16xx, as 1510 does not have the continuous
+ * 32KHz synchronous timer. The 32KHz synchronous timer is used to keep track
+ * of time in addition to the 32KHz OS timer. Using only the 32KHz OS timer
+ * on 1510 would be possible, but the timer would not be as accurate as
+ * with the 32KHz synchronized timer.
+ * ---------------------------------------------------------------------------
+ */
+#define OMAP_32K_TIMER_BASE		0xfffb9000
+#define OMAP_32K_TIMER_CR		0x08
+#define OMAP_32K_TIMER_TVR		0x00
+#define OMAP_32K_TIMER_TCR		0x04
+
+#define OMAP_32K_TICKS_PER_HZ		(32768 / HZ)
+
+/*
+ * TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1
+ * so with HZ = 100, TVR = 327.68.
+ */
+#define OMAP_32K_TIMER_TICK_PERIOD	((32768 / HZ) - 1)
+#define MAX_SKIP_JIFFIES		25
+#define TIMER_32K_SYNCHRONIZED		0xfffbc410
+
+#define JIFFIES_TO_HW_TICKS(nr_jiffies, clock_rate)			\
+				(((nr_jiffies) * (clock_rate)) / HZ)
+
+static inline void omap_32k_timer_write(int val, int reg)
+{
+	omap_writew(val, reg + OMAP_32K_TIMER_BASE);
+}
+
+static inline unsigned long omap_32k_timer_read(int reg)
+{
+	return omap_readl(reg + OMAP_32K_TIMER_BASE) & 0xffffff;
+}
+
+/*
+ * The 32KHz synchronized timer is an additional timer on 16xx.
+ * It is always running.
+ */
+static inline unsigned long omap_32k_sync_timer_read(void)
+{
+	return omap_readl(TIMER_32K_SYNCHRONIZED);
+}
+
+static inline void omap_32k_timer_start(unsigned long load_val)
+{
+	omap_32k_timer_write(load_val, OMAP_32K_TIMER_TVR);
+	omap_32k_timer_write(0x0f, OMAP_32K_TIMER_CR);
+}
+
+static inline void omap_32k_timer_stop(void)
+{
+	omap_32k_timer_write(0x0, OMAP_32K_TIMER_CR);
+}
+
+/*
+ * Rounds down to nearest usec
+ */
+static inline unsigned long omap_32k_ticks_to_usecs(unsigned long ticks_32k)
+{
+	return (ticks_32k * 5*5*5*5*5*5) >> 9;
+}
+
+static unsigned long omap_32k_last_tick = 0;
+
+/*
+ * Returns elapsed usecs since last 32k timer interrupt
+ */
+static unsigned long omap_32k_timer_gettimeoffset(void)
+{
+	unsigned long now = omap_32k_sync_timer_read();
+	return omap_32k_ticks_to_usecs(now - omap_32k_last_tick);
+}
+
+/*
+ * Timer interrupt for 32KHz timer. When dynamic tick is enabled, this
+ * function is also called from other interrupts to remove latency
+ * issues with dynamic tick. In the dynamic tick case, we need to lock
+ * with irqsave.
+ */
+static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id,
+					    struct pt_regs *regs)
+{
+	unsigned long flags;
+	unsigned long now;
+
+	write_seqlock_irqsave(&xtime_lock, flags);
+	now = omap_32k_sync_timer_read();
+
+	while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) {
+		omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ;
+		timer_tick(regs);
+	}
+
+	/* Restart timer so we don't drift off due to modulo or dynamic tick.
+	 * By default we program the next timer to be continuous to avoid
+	 * latencies during high system load. During dynamic tick operation the
+	 * continuous timer can be overridden from pm_idle to be longer.
+	 */
+	omap_32k_timer_start(omap_32k_last_tick + OMAP_32K_TICKS_PER_HZ - now);
+	write_sequnlock_irqrestore(&xtime_lock, flags);
+
+	return IRQ_HANDLED;
+}
+
+static struct irqaction omap_32k_timer_irq = {
+	.name		= "32KHz timer",
+	.flags		= SA_INTERRUPT,
+	.handler	= omap_32k_timer_interrupt
+};
+
+static __init void omap_init_32k_timer(void)
+{
+	setup_irq(INT_OS_TIMER, &omap_32k_timer_irq);
+	omap_timer.offset  = omap_32k_timer_gettimeoffset;
+	omap_32k_last_tick = omap_32k_sync_timer_read();
+	omap_32k_timer_start(OMAP_32K_TIMER_TICK_PERIOD);
+}
+#endif	/* CONFIG_OMAP_32K_TIMER */
+
+/*
  * ---------------------------------------------------------------------------
  * Timer initialization
  * ---------------------------------------------------------------------------
  */
 void __init omap_timer_init(void)
 {
+#if defined(CONFIG_OMAP_MPU_TIMER)
 	omap_init_mpu_timer();
+#elif defined(CONFIG_OMAP_32K_TIMER)
+	omap_init_32k_timer();
+#else
+#error No system timer selected in Kconfig!
+#endif
 }
 
 struct sys_timer omap_timer = {
diff -Nru a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
--- a/arch/arm/mach-pxa/Kconfig	2005-01-09 16:00:00 -08:00
+++ b/arch/arm/mach-pxa/Kconfig	2005-03-02 16:00:00 -08:00
@@ -19,28 +19,36 @@
 	select PXA25x
 
 config PXA_SHARPSL
-	bool "SHARP SL-C7xx Models (Corgi, Shepherd and Husky)"
+	bool "SHARP SL-5600 and SL-C7xx Models"
 	select PXA25x
 	help
 	  Say Y here if you intend to run this kernel on a
-	  Sharp SL-C700 (Corgi), SL-C750 (Shepherd) or a
-	  Sharp SL-C760 (Husky) handheld computer.
+	  Sharp SL-5600 (Poodle), Sharp SL-C700 (Corgi),
+	  SL-C750 (Shepherd) or a Sharp SL-C760 (Husky)
+	  handheld computer.
 
 endchoice
 
 endmenu
 
+config MACH_POODLE
+	bool "Enable Sharp SL-5600 (Poodle) Support"
+	depends PXA_SHARPSL
+
 config MACH_CORGI
 	bool "Enable Sharp SL-C700 (Corgi) Support"
 	depends PXA_SHARPSL
+	select PXA_SHARP_C7xx
 
 config MACH_SHEPHERD
 	bool "Enable Sharp SL-C750 (Shepherd) Support"
 	depends PXA_SHARPSL
+	select PXA_SHARP_C7xx
 
 config MACH_HUSKY
 	bool "Enable Sharp SL-C760 (Husky) Support"
 	depends PXA_SHARPSL
+	select PXA_SHARP_C7xx
 
 config PXA25x
 	bool
@@ -56,5 +64,10 @@
 	bool
 	help
 	  Enable support for iWMMXt
+
+config PXA_SHARP_C7xx
+	bool
+	help
+	  Enable support for all Sharp C7xx models
 
 endif
diff -Nru a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
--- a/arch/arm/mach-pxa/Makefile	2005-01-11 16:00:00 -08:00
+++ b/arch/arm/mach-pxa/Makefile	2005-03-02 16:00:00 -08:00
@@ -11,7 +11,8 @@
 obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
 obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
 obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
-obj-$(CONFIG_PXA_SHARPSL)	+= corgi.o corgi_ssp.o ssp.o
+obj-$(CONFIG_PXA_SHARP_C7xx)	+= corgi.o corgi_ssp.o ssp.o
+obj-$(CONFIG_MACH_POODLE)	+= poodle.o
 
 # Support for blinky lights
 led-y := leds.o
diff -Nru a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
--- a/arch/arm/mach-pxa/corgi.c	2005-01-20 13:58:51 -08:00
+++ b/arch/arm/mach-pxa/corgi.c	2005-03-06 12:23:56 -08:00
@@ -59,7 +59,7 @@
 	.io_out		= CORGI_SCOOP_IO_OUT,
 };
 
-static struct platform_device corgiscoop_device = {
+struct platform_device corgiscoop_device = {
 	.name		= "sharp-scoop",
 	.id		= -1,
 	.dev		= {
diff -Nru a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c
--- a/arch/arm/mach-pxa/idp.c	2004-10-09 09:28:21 -07:00
+++ b/arch/arm/mach-pxa/idp.c	2005-02-16 08:52:21 -08:00
@@ -10,13 +10,16 @@
  *  2001-09-13: Cliff Brake <cbrake@accelent.com>
  *              Initial code
  *
- * Expected command line: mem=32M initrd=0xa1000000,4M root=/dev/ram ramdisk=8192
+ *  2005-02-15: Cliff Brake <cliff.brake@gmail.com>
+ *  		<http://www.vibren.com> <http://bec-systems.com>
+ *              Updated for 2.6 kernel
+ *
  */
-#include <linux/kernel.h>
+
 #include <linux/init.h>
-#include <linux/major.h>
-#include <linux/fs.h>
 #include <linux/interrupt.h>
+#include <linux/device.h>
+#include <linux/fb.h>
 
 #include <asm/setup.h>
 #include <asm/memory.h>
@@ -29,68 +32,133 @@
 
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/idp.h>
+#include <asm/arch/pxafb.h>
+#include <asm/arch/bitfield.h>
+#include <asm/arch/mmc.h>
 
 #include "generic.h"
 
-#ifndef PXA_IDP_REV02
-/* shadow registers for write only registers */
-unsigned int idp_cpld_led_control_shadow = 0x1;
-unsigned int idp_cpld_periph_pwr_shadow = 0xd;
-unsigned int ipd_cpld_cir_shadow = 0;
-unsigned int idp_cpld_kb_col_high_shadow = 0;
-unsigned int idp_cpld_kb_col_low_shadow = 0;
-unsigned int idp_cpld_pccard_en_shadow = 0xC3;
-unsigned int idp_cpld_gpioh_dir_shadow = 0;
-unsigned int idp_cpld_gpioh_value_shadow = 0;
-unsigned int idp_cpld_gpiol_dir_shadow = 0;
-unsigned int idp_cpld_gpiol_value_shadow = 0;
-
-/*
- * enable all LCD signals -- they should still be on
- * write protect flash
- * enable all serial port transceivers
+/* TODO:
+ * - add pxa2xx_audio_ops_t device structure
+ * - Ethernet interrupt
  */
 
-unsigned int idp_control_port_shadow = ((0x7 << 21) | 		/* LCD power */
-					(0x1 << 19) |		/* disable flash write enable */
-					(0x7 << 9));		/* enable serial port transeivers */
+static struct resource smc91x_resources[] = {
+	[0] = {
+		.start	= (IDP_ETH_PHYS + 0x300),
+		.end	= (IDP_ETH_PHYS + 0xfffff),
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= IRQ_GPIO(4),
+		.end	= IRQ_GPIO(4),
+		.flags	= IORESOURCE_IRQ,
+	}
+};
+
+static struct platform_device smc91x_device = {
+	.name		= "smc91x",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(smc91x_resources),
+	.resource	= smc91x_resources,
+};
+
+static void idp_backlight_power(int on)
+{
+	if (on) {
+		IDP_CPLD_LCD |= (1<<1);
+	} else {
+		IDP_CPLD_LCD &= ~(1<<1);
+	}
+}
+
+static void idp_vlcd(int on)
+{
+	if (on) {
+		IDP_CPLD_LCD |= (1<<2);
+	} else {
+		IDP_CPLD_LCD &= ~(1<<2);
+	}
+}
+
+static void idp_lcd_power(int on)
+{
+	if (on) {
+		IDP_CPLD_LCD |= (1<<0);
+	} else {
+		IDP_CPLD_LCD &= ~(1<<0);
+	}
+
+	/* call idp_vlcd for now as core driver does not support
+	 * both power and vlcd hooks.  Note, this is not technically
+	 * the correct sequence, but seems to work.  Disclaimer:
+	 * this may eventually damage the display.
+	 */
+
+	idp_vlcd(on);
+}
+
+static struct pxafb_mach_info sharp_lm8v31 __initdata = {
+	.pixclock	= 270000,
+	.xres		= 640,
+	.yres		= 480,
+	.bpp		= 16,
+	.hsync_len	= 1,
+	.left_margin	= 3,
+	.right_margin	= 3,
+	.vsync_len	= 1,
+	.upper_margin	= 0,
+	.lower_margin	= 0,
+	.sync		= FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+	.cmap_greyscale	= 0,
+	.cmap_inverse	= 0,
+	.cmap_static	= 0,
+	.lccr0		= LCCR0_SDS,
+	.lccr3		= LCCR3_PCP | LCCR3_Acb(255),
+	.pxafb_backlight_power = &idp_backlight_power,
+	.pxafb_lcd_power = &idp_lcd_power
+};
+
+static int idp_mci_init(struct device *dev, irqreturn_t (*idp_detect_int)(int, void *, struct pt_regs *), void *data)
+{
+	/* setup GPIO for PXA25x MMC controller	*/
+	pxa_gpio_mode(GPIO6_MMCCLK_MD);
+	pxa_gpio_mode(GPIO8_MMCCS0_MD);
+
+	return 0;
+}
 
-#endif
+static struct pxamci_platform_data idp_mci_platform_data = {
+	.ocr_mask	= MMC_VDD_32_33|MMC_VDD_33_34,
+	.init 		= idp_mci_init,
+};
 
 static void __init idp_init(void)
 {
 	printk("idp_init()\n");
+
+	platform_device_register(&smc91x_device);
+	//platform_device_register(&mst_audio_device);
+	set_pxa_fb_info(&sharp_lm8v31);
+	pxa_set_mci_info(&idp_mci_platform_data);
 }
 
 static void __init idp_init_irq(void)
 {
+
 	pxa_init_irq();
+
+	set_irq_type(TOUCH_PANEL_IRQ, TOUCH_PANEL_IRQ_EDGE);
 }
 
 static struct map_desc idp_io_desc[] __initdata = {
  /* virtual     physical    length      type */
 
-
-#ifndef PXA_IDP_REV02
-  { IDP_CTRL_PORT_BASE,
-    IDP_CTRL_PORT_PHYS,
-    IDP_CTRL_PORT_SIZE,
-    MT_DEVICE },
-#endif
-
-  { IDP_IDE_BASE,
-    IDP_IDE_PHYS,
-    IDP_IDE_SIZE,
-    MT_DEVICE },
-  { IDP_ETH_BASE,
-    IDP_ETH_PHYS,
-    IDP_ETH_SIZE,
-    MT_DEVICE },
-  { IDP_COREVOLT_BASE,
+  { IDP_COREVOLT_VIRT,
     IDP_COREVOLT_PHYS,
     IDP_COREVOLT_SIZE,
     MT_DEVICE },
-  { IDP_CPLD_BASE,
+  { IDP_CPLD_VIRT,
     IDP_CPLD_PHYS,
     IDP_CPLD_SIZE,
     MT_DEVICE }
@@ -101,8 +169,6 @@
 	pxa_map_io();
 	iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc));
 
-	set_irq_type(TOUCH_PANEL_IRQ, TOUCH_PANEL_IRQ_EDGE);
-
 	// serial ports 2 & 3
 	pxa_gpio_mode(GPIO42_BTRXD_MD);
 	pxa_gpio_mode(GPIO43_BTTXD_MD);
@@ -114,8 +180,8 @@
 }
 
 
-MACHINE_START(PXA_IDP, "Accelent Xscale IDP")
-	MAINTAINER("Accelent Systems Inc.")
+MACHINE_START(PXA_IDP, "Vibren PXA255 IDP")
+	MAINTAINER("Vibren Technologies")
 	BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
 	MAPIO(idp_map_io)
 	INITIRQ(idp_init_irq)
diff -Nru a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
--- a/arch/arm/mach-pxa/irq.c	2004-09-28 11:30:40 -07:00
+++ b/arch/arm/mach-pxa/irq.c	2005-03-02 13:35:46 -08:00
@@ -97,23 +97,23 @@
 		type = __IRQT_RISEDGE | __IRQT_FALEDGE;
 	}
 
-	printk(KERN_DEBUG "IRQ%d (GPIO%d): ", irq, gpio);
+	/* printk(KERN_DEBUG "IRQ%d (GPIO%d): ", irq, gpio); */
 
 	pxa_gpio_mode(gpio | GPIO_IN);
 
 	if (type & __IRQT_RISEDGE) {
-		printk("rising ");
+		/* printk("rising "); */
 		__set_bit (gpio, GPIO_IRQ_rising_edge);
 	} else
 		__clear_bit (gpio, GPIO_IRQ_rising_edge);
 
 	if (type & __IRQT_FALEDGE) {
-		printk("falling ");
+		/* printk("falling "); */
 		__set_bit (gpio, GPIO_IRQ_falling_edge);
 	} else
 		__clear_bit (gpio, GPIO_IRQ_falling_edge);
 
-	printk("edges\n");
+	/* printk("edges\n"); */
 
 	GRER(gpio) = GPIO_IRQ_rising_edge[idx] & GPIO_IRQ_mask[idx];
 	GFER(gpio) = GPIO_IRQ_falling_edge[idx] & GPIO_IRQ_mask[idx];
diff -Nru a/arch/arm/mach-pxa/leds-idp.c b/arch/arm/mach-pxa/leds-idp.c
--- a/arch/arm/mach-pxa/leds-idp.c	2004-06-03 10:51:42 -07:00
+++ b/arch/arm/mach-pxa/leds-idp.c	2005-02-16 08:52:21 -08:00
@@ -19,6 +19,7 @@
 #include <asm/leds.h>
 #include <asm/system.h>
 
+#include <asm/arch/pxa-regs.h>
 #include <asm/arch/idp.h>
 
 #include "leds.h"
diff -Nru a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
--- a/arch/arm/mach-pxa/lubbock.c	2005-02-06 14:53:57 -08:00
+++ b/arch/arm/mach-pxa/lubbock.c	2005-02-23 21:12:31 -08:00
@@ -138,6 +138,7 @@
 
 static struct resource smc91x_resources[] = {
 	[0] = {
+		.name	= "smc91x-regs",
 		.start	= 0x0c000000,
 		.end	= 0x0c0fffff,
 		.flags	= IORESOURCE_MEM,
@@ -148,6 +149,7 @@
 		.flags	= IORESOURCE_IRQ,
 	},
 	[2] = {
+		.name	= "smc91x-attrib",
 		.start	= 0x0e000000,
 		.end	= 0x0e0fffff,
 		.flags	= IORESOURCE_MEM,
diff -Nru a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
--- a/arch/arm/mach-pxa/mainstone.c	2005-01-24 16:00:00 -08:00
+++ b/arch/arm/mach-pxa/mainstone.c	2005-03-03 16:00:00 -08:00
@@ -295,6 +295,15 @@
 {
 	pxa_map_io();
 	iotable_init(mainstone_io_desc, ARRAY_SIZE(mainstone_io_desc));
+
+	/* initialize sleep mode regs (wake-up sources, etc) */
+	PGSR0 = 0x00008800;
+	PGSR1 = 0x00000002;
+	PGSR2 = 0x0001FC00;
+	PGSR3 = 0x00001F81;
+	PWER  = 0xC0000002;
+	PRER  = 0x00000002;
+	PFER  = 0x00000002;
 }
 
 MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
diff -Nru a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
--- a/arch/arm/mach-pxa/pm.c	2004-10-29 01:13:37 -07:00
+++ b/arch/arm/mach-pxa/pm.c	2005-03-03 16:00:00 -08:00
@@ -47,12 +47,18 @@
  */
 enum {	SLEEP_SAVE_START = 0,
 
-	SLEEP_SAVE_GPLR0, SLEEP_SAVE_GPLR1, SLEEP_SAVE_GPLR2,
-	SLEEP_SAVE_GPDR0, SLEEP_SAVE_GPDR1, SLEEP_SAVE_GPDR2,
-	SLEEP_SAVE_GRER0, SLEEP_SAVE_GRER1, SLEEP_SAVE_GRER2,
-	SLEEP_SAVE_GFER0, SLEEP_SAVE_GFER1, SLEEP_SAVE_GFER2,
-	SLEEP_SAVE_GAFR0_L, SLEEP_SAVE_GAFR1_L, SLEEP_SAVE_GAFR2_L,
-	SLEEP_SAVE_GAFR0_U, SLEEP_SAVE_GAFR1_U, SLEEP_SAVE_GAFR2_U,
+	SLEEP_SAVE_GPLR0, SLEEP_SAVE_GPLR1, SLEEP_SAVE_GPLR2, SLEEP_SAVE_GPLR3,
+	SLEEP_SAVE_GPDR0, SLEEP_SAVE_GPDR1, SLEEP_SAVE_GPDR2, SLEEP_SAVE_GPDR3,
+	SLEEP_SAVE_GRER0, SLEEP_SAVE_GRER1, SLEEP_SAVE_GRER2, SLEEP_SAVE_GRER3,
+	SLEEP_SAVE_GFER0, SLEEP_SAVE_GFER1, SLEEP_SAVE_GFER2, SLEEP_SAVE_GFER3,
+	SLEEP_SAVE_PGSR0, SLEEP_SAVE_PGSR1, SLEEP_SAVE_PGSR2, SLEEP_SAVE_PGSR3,
+
+	SLEEP_SAVE_GAFR0_L, SLEEP_SAVE_GAFR0_U,
+	SLEEP_SAVE_GAFR1_L, SLEEP_SAVE_GAFR1_U,
+	SLEEP_SAVE_GAFR2_L, SLEEP_SAVE_GAFR2_U,
+	SLEEP_SAVE_GAFR3_L, SLEEP_SAVE_GAFR3_U,
+
+	SLEEP_SAVE_PSTR,
 
 	SLEEP_SAVE_ICMR,
 	SLEEP_SAVE_CKEN,
@@ -73,6 +79,11 @@
 	if (state != PM_SUSPEND_MEM)
 		return -EINVAL;
 
+#ifdef CONFIG_IWMMXT
+	/* force any iWMMXt context to ram **/
+	iwmmxt_task_disable(NULL);
+#endif
+
 	/* preserve current time */
 	rtc.tv_sec = RCNR;
 	rtc.tv_nsec = 0;
@@ -82,20 +93,32 @@
 	SAVE(GPDR0); SAVE(GPDR1); SAVE(GPDR2);
 	SAVE(GRER0); SAVE(GRER1); SAVE(GRER2);
 	SAVE(GFER0); SAVE(GFER1); SAVE(GFER2);
+	SAVE(PGSR0); SAVE(PGSR1); SAVE(PGSR2);
+
 	SAVE(GAFR0_L); SAVE(GAFR0_U);
 	SAVE(GAFR1_L); SAVE(GAFR1_U);
 	SAVE(GAFR2_L); SAVE(GAFR2_U);
 
+#ifdef CONFIG_PXA27x
+	SAVE(GPLR3); SAVE(GPDR3); SAVE(GRER3); SAVE(GFER3); SAVE(PGSR3);
+	SAVE(GAFR3_L); SAVE(GAFR3_U);
+#endif
+
 	SAVE(ICMR);
 	ICMR = 0;
 
 	SAVE(CKEN);
 	CKEN = 0;
 
+	SAVE(PSTR);
+
 	/* Note: wake up source are set up in each machine specific files */
 
 	/* clear GPIO transition detect  bits */
 	GEDR0 = GEDR0; GEDR1 = GEDR1; GEDR2 = GEDR2;
+#ifdef CONFIG_PXA27x
+	GEDR3 = GEDR3;
+#endif
 
 	/* Clear sleep reset status */
 	RCSR = RCSR_SMR;
@@ -121,7 +144,8 @@
 #ifdef CONFIG_ARCH_LUBBOCK
 		LUB_HEXLED = 0xbadbadc5;
 #endif
-		while (1);
+		while (1)
+			pxa_cpu_suspend();
 	}
 
 	/* ensure not to come back here if it wasn't intended */
@@ -135,6 +159,12 @@
 	RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2);
 	RESTORE(GRER0); RESTORE(GRER1); RESTORE(GRER2);
 	RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2);
+	RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2);
+
+#ifdef CONFIG_PXA27x
+	RESTORE(GAFR3_L); RESTORE(GAFR3_U); RESTORE_GPLEVEL(3);
+	RESTORE(GPDR3); RESTORE(GRER3); RESTORE(GFER3); RESTORE(PGSR3);
+#endif
 
 	PSSR = PSSR_RDH | PSSR_PH;
 
@@ -143,6 +173,8 @@
 	ICLR = 0;
 	ICCR = 1;
 	RESTORE(ICMR);
+
+	RESTORE(PSTR);
 
 	/* restore current time */
 	rtc.tv_sec = RCNR;
diff -Nru a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/arm/mach-pxa/poodle.c	2005-03-06 12:25:13 -08:00
@@ -0,0 +1,181 @@
+/*
+ * linux/arch/arm/mach-pxa/poodle.c
+ *
+ *  Support for the SHARP Poodle Board.
+ *
+ * Based on:
+ *  linux/arch/arm/mach-pxa/lubbock.c Author:	Nicolas Pitre
+ *
+ *  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.
+ *
+ * Change Log
+ *  12-Dec-2002 Sharp Corporation for Poodle
+ *  John Lenz <lenz@cs.wisc.edu> updates to 2.6
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/fb.h>
+
+#include <asm/hardware.h>
+#include <asm/mach-types.h>
+#include <asm/irq.h>
+#include <asm/setup.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/irq.h>
+#include <asm/arch/poodle.h>
+#include <asm/arch/pxafb.h>
+
+#include <asm/hardware/scoop.h>
+#include <asm/hardware/locomo.h>
+
+#include "generic.h"
+
+static struct resource poodle_scoop_resources[] = {
+	[0] = {
+		.start		= 0x10800000,
+		.end		= 0x10800fff,
+		.flags		= IORESOURCE_MEM,
+	},
+};
+
+static struct scoop_config poodle_scoop_setup = {
+	.io_dir		= POODLE_SCOOP_IO_DIR,
+	.io_out		= POODLE_SCOOP_IO_OUT,
+};
+
+struct platform_device poodle_scoop_device = {
+	.name		= "sharp-scoop",
+	.id		= -1,
+	.dev		= {
+		.platform_data	= &poodle_scoop_setup,
+	},
+	.num_resources	= ARRAY_SIZE(poodle_scoop_resources),
+	.resource	= poodle_scoop_resources,
+};
+
+
+/* LoCoMo device */
+static struct resource locomo_resources[] = {
+	[0] = {
+		.start		= 0x10000000,
+		.end		= 0x10001fff,
+		.flags		= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start		= IRQ_GPIO(10),
+		.end		= IRQ_GPIO(10),
+		.flags		= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device locomo_device = {
+	.name		= "locomo",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(locomo_resources),
+	.resource	= locomo_resources,
+};
+
+/* PXAFB device */
+static struct pxafb_mach_info poodle_fb_info __initdata = {
+	.pixclock	= 144700,
+
+	.xres		= 320,
+	.yres		= 240,
+	.bpp		= 16,
+
+	.hsync_len	= 7,
+	.left_margin	= 11,
+	.right_margin	= 30,
+
+	.vsync_len	= 2,
+	.upper_margin	= 2,
+	.lower_margin	= 0,
+	.sync		= FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+
+	.lccr0		= LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
+	.lccr3		= 0,
+
+	.pxafb_backlight_power	= NULL,
+	.pxafb_lcd_power	= NULL,
+};
+
+static struct platform_device *devices[] __initdata = {
+	&locomo_device,
+	&poodle_scoop_device,
+};
+
+static void __init poodle_init(void)
+{
+	int ret = 0;
+
+	/* cpu initialize */
+	/* Pgsr Register */
+  	PGSR0 = 0x0146dd80;
+  	PGSR1 = 0x03bf0890;
+  	PGSR2 = 0x0001c000;
+
+	/* Alternate Register */
+  	GAFR0_L = 0x01001000;
+  	GAFR0_U = 0x591a8010;
+  	GAFR1_L = 0x900a8451;
+  	GAFR1_U = 0xaaa5aaaa;
+  	GAFR2_L = 0x8aaaaaaa;
+  	GAFR2_U = 0x00000002;
+
+	/* Direction Register */
+  	GPDR0 = 0xd3f0904c;
+  	GPDR1 = 0xfcffb7d3;
+  	GPDR2 = 0x0001ffff;
+
+	/* Output Register */
+  	GPCR0 = 0x00000000;
+  	GPCR1 = 0x00000000;
+  	GPCR2 = 0x00000000;
+
+  	GPSR0 = 0x00400000;
+  	GPSR1 = 0x00000000;
+        GPSR2 = 0x00000000;
+
+	set_pxa_fb_info(&poodle_fb_info);
+
+	ret = platform_add_devices(devices, ARRAY_SIZE(devices));
+	if (ret) {
+		printk(KERN_WARNING "poodle: Unable to register LoCoMo device\n");
+	}
+}
+
+static struct map_desc poodle_io_desc[] __initdata = {
+ /* virtual     physical    length                   */
+  { 0xef800000, 0x00000000, 0x00800000, MT_DEVICE }, /* Boot Flash */
+};
+
+static void __init poodle_map_io(void)
+{
+	pxa_map_io();
+	iotable_init(poodle_io_desc, ARRAY_SIZE(poodle_io_desc));
+
+	/* setup sleep mode values */
+	PWER  = 0x00000002;
+	PFER  = 0x00000000;
+	PRER  = 0x00000002;
+	PGSR0 = 0x00008000;
+	PGSR1 = 0x003F0202;
+	PGSR2 = 0x0001C000;
+	PCFR |= PCFR_OPDE;
+}
+
+MACHINE_START(POODLE, "SHARP Poodle")
+	BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
+	MAPIO(poodle_map_io)
+	INITIRQ(pxa_init_irq)
+	.timer = &pxa_timer,
+	.init_machine = poodle_init,
+MACHINE_END
diff -Nru a/arch/arm/mach-s3c2410/Kconfig b/arch/arm/mach-s3c2410/Kconfig
--- a/arch/arm/mach-s3c2410/Kconfig	2005-01-15 14:31:06 -08:00
+++ b/arch/arm/mach-s3c2410/Kconfig	2005-03-06 07:03:11 -08:00
@@ -19,6 +19,14 @@
 
 	  <http://www.handhelds.org/projects/h1940.html>.
 
+config MACH_N30
+	bool "Acer N30"
+	select CPU_S3C2410
+	help
+	  Say Y here if you are using the Acer N30
+
+	  <http://zoo.weinigel.se/n30>.
+
 config ARCH_SMDK2410
 	bool "SMDK2410/A9M2410"
 	select CPU_S3C2410
@@ -26,6 +34,12 @@
 	   Say Y here if you are using the SMDK2410 or the derived module A9M2410
            <http://www.fsforth.de>
 
+config ARCH_S3C2440
+	bool "SMDK2440"
+	select CPU_S3C2440
+	help
+	  Say Y here if you are using the SMDK2440.
+
 config MACH_VR1000
 	bool "Thorcom VR1000"
 	select CPU_S3C2410
@@ -58,6 +72,26 @@
 	depends on ARCH_S3C2410
 	help
 	  Support for S3C2440 Samsung Mobile CPU based systems.
+
+comment "S3C2410 Boot"
+
+config S3C2410_BOOT_WATCHDOG
+	bool "S3C2410 Initialisation watchdog"
+	depends on ARCH_S3C2410 && S3C2410_WATCHDOG
+	help
+	  Say y to enable the watchdog during the kernel decompression
+	  stage. If the kernel fails to uncompress, then the watchdog
+	  will trigger a reset and the system should restart.
+
+	  Although this uses the same hardware unit as the kernel watchdog
+	  driver, it is not a replacement for it. If you use this option,
+	  you will have to use the watchdg driver to either stop the timeout
+	  or restart it. If you do not, then your kernel will reboot after
+	  startup.
+
+	  The driver uses a fixed timeout value, so the exact time till the
+	  system resets depends on the value of PCLK. The timeout on an
+	  200MHz s3c2410 should be about 30 seconds.
 
 comment "S3C2410 Setup"
 
diff -Nru a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
--- a/arch/arm/mach-s3c2410/Makefile	2004-11-12 15:19:30 -08:00
+++ b/arch/arm/mach-s3c2410/Makefile	2005-03-06 07:03:11 -08:00
@@ -27,6 +27,8 @@
 
 obj-$(CONFIG_ARCH_BAST)		+= mach-bast.o usb-simtec.o
 obj-$(CONFIG_ARCH_H1940)	+= mach-h1940.o
+obj-$(CONFIG_MACH_N30)		+= mach-n30.o
 obj-$(CONFIG_ARCH_SMDK2410)	+= mach-smdk2410.o
+obj-$(CONFIG_ARCH_S3C2440)	+= mach-smdk2440.o
 obj-$(CONFIG_MACH_VR1000)	+= mach-vr1000.o usb-simtec.o
 obj-$(CONFIG_MACH_RX3715)	+= mach-rx3715.o
diff -Nru a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c
--- a/arch/arm/mach-s3c2410/clock.c	2005-01-14 05:03:13 -08:00
+++ b/arch/arm/mach-s3c2410/clock.c	2005-02-28 16:29:07 -08:00
@@ -1,7 +1,7 @@
 /* linux/arch/arm/mach-s3c2410/clock.c
  *
- * Copyright (c) 2004 Simtec Electronics
- * Ben Dooks <ben@simtec.co.uk>
+ * Copyright (c) 2004-2005 Simtec Electronics
+ *	Ben Dooks <ben@simtec.co.uk>
  *
  * S3C2410 Clock control support
  *
@@ -33,6 +33,7 @@
 #include <linux/errno.h>
 #include <linux/err.h>
 #include <linux/device.h>
+#include <linux/sysdev.h>
 
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
@@ -46,18 +47,13 @@
 #include <asm/arch/regs-clock.h>
 
 #include "clock.h"
+#include "cpu.h"
 
 /* clock information */
 
-unsigned long s3c24xx_xtal = 12*1000*1000;	/* default 12MHz */
-unsigned long s3c24xx_fclk;
-unsigned long s3c24xx_hclk;
-unsigned long s3c24xx_pclk;
-
 static LIST_HEAD(clocks);
 static DECLARE_MUTEX(clocks_sem);
 
-
 /* old functions */
 
 void inline s3c24xx_clk_enable(unsigned int clocks, unsigned int enable)
@@ -206,6 +202,14 @@
 
 /* base clocks */
 
+static struct clk clk_xtal = {
+	.name		= "xtal",
+	.id		= -1,
+	.rate		= 0,
+	.parent		= NULL,
+	.ctrlbit	= 0,
+};
+
 static struct clk clk_f = {
 	.name		= "fclk",
 	.id		= -1,
@@ -286,6 +290,7 @@
 	  .ctrlbit = S3C2410_CLKCON_USBD
 	},
 	{ .name    = "timers",
+	  .id	   = -1,
 	  .parent  = &clk_p,
 	  .enable  = s3c24xx_clkcon_enable,
 	  .ctrlbit = S3C2410_CLKCON_PWMT
@@ -378,19 +383,24 @@
 
 /* initalise all the clocks */
 
-int __init s3c24xx_setup_clocks(void)
+int __init s3c24xx_setup_clocks(unsigned long xtal,
+				unsigned long fclk,
+				unsigned long hclk,
+				unsigned long pclk)
 {
 	struct clk *clkp = init_clocks;
 	int ptr;
 	int ret;
 
-	printk(KERN_INFO "S3C2410 Clock control, (c) 2004 Simtec Electronics\n");
+	printk(KERN_INFO "S3C2410 Clocks, (c) 2004 Simtec Electronics\n");
 
 	/* initialise the main system clocks */
 
-	clk_h.rate = s3c24xx_hclk;
-	clk_p.rate = s3c24xx_pclk;
-	clk_f.rate = s3c24xx_fclk;
+	clk_xtal.rate = xtal;
+
+	clk_h.rate = hclk;
+	clk_p.rate = pclk;
+	clk_f.rate = fclk;
 
 	/* it looks like just setting the register here is not good
 	 * enough, and causes the odd hang at initial boot time, so
@@ -414,6 +424,9 @@
 
 	/* register our clocks */
 
+	if (s3c24xx_register_clock(&clk_xtal) < 0)
+		printk(KERN_ERR "failed to register master xtal\n");
+
 	if (s3c24xx_register_clock(&clk_f) < 0)
 		printk(KERN_ERR "failed to register cpu fclk\n");
 
@@ -423,6 +436,8 @@
 	if (s3c24xx_register_clock(&clk_p) < 0)
 		printk(KERN_ERR "failed to register cpu pclk\n");
 
+	/* register clocks from clock array */
+
 	for (ptr = 0; ptr < ARRAY_SIZE(init_clocks); ptr++, clkp++) {
 		ret = s3c24xx_register_clock(clkp);
 		if (ret < 0) {
@@ -434,4 +449,59 @@
 	return 0;
 }
 
+/* S3C2440 extended clock support */
+
+#ifdef CONFIG_CPU_S3C2440
+
+static struct clk s3c2440_clk_upll = {
+	.name		= "upll",
+	.id		= -1,
+};
+
+static struct clk s3c2440_clk_cam = {
+	.name		= "camif",
+	.parent		= &clk_h,
+	.id		= -1,
+	.enable		= s3c24xx_clkcon_enable,
+	.ctrlbit	= S3C2440_CLKCON_CAMERA,
+};
+
+static struct clk s3c2440_clk_ac97 = {
+	.name		= "ac97",
+	.parent		= &clk_p,
+	.id		= -1,
+	.enable		= s3c24xx_clkcon_enable,
+	.ctrlbit	= S3C2440_CLKCON_CAMERA,
+};
+
+static int s3c2440_clk_add(struct sys_device *sysdev)
+{
+	unsigned long upllcon = __raw_readl(S3C2410_UPLLCON);
+
+	s3c2440_clk_upll.rate = s3c2410_get_pll(upllcon, clk_xtal.rate) * 2;
+
+	printk("S3C2440: Clock Support, UPLL %ld.%03ld MHz\n",
+	       print_mhz(s3c2440_clk_upll.rate));
+
+	s3c24xx_register_clock(&s3c2440_clk_ac97);
+	s3c24xx_register_clock(&s3c2440_clk_cam);
+	s3c24xx_register_clock(&s3c2440_clk_upll);
+
+	clk_disable(&s3c2440_clk_ac97);
+	clk_disable(&s3c2440_clk_cam);
+
+	return 0;
+}
+
+static struct sysdev_driver s3c2440_clk_driver = {
+	.add	= s3c2440_clk_add,
+};
+
+static int s3c24xx_clk_driver(void)
+{
+	return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_clk_driver);
+}
+
+arch_initcall(s3c24xx_clk_driver);
 
+#endif /* CONFIG_CPU_S3C2440 */
diff -Nru a/arch/arm/mach-s3c2410/clock.h b/arch/arm/mach-s3c2410/clock.h
--- a/arch/arm/mach-s3c2410/clock.h	2005-01-14 05:01:50 -08:00
+++ b/arch/arm/mach-s3c2410/clock.h	2005-02-28 16:29:07 -08:00
@@ -1,7 +1,8 @@
 /*
  * linux/arch/arm/mach-s3c2410/clock.h
  *
- * Copyright (c) 2004 Simtec Electronics
+ * Copyright (c) 2004-2005 Simtec Electronics
+ *	http://www.simtec.co.uk/products/SWLINUX/
  *	Written by Ben Dooks, <ben@simtec.co.uk>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -29,13 +30,6 @@
 extern struct clk s3c24xx_clkout1;
 extern struct clk s3c24xx_uclk;
 
-/* processor clock settings, in Hz */
-
-extern unsigned long s3c24xx_xtal;
-extern unsigned long s3c24xx_pclk;
-extern unsigned long s3c24xx_hclk;
-extern unsigned long s3c24xx_fclk;
-
 /* exports for arch/arm/mach-s3c2410
  *
  * Please DO NOT use these outside of arch/arm/mach-s3c2410
@@ -44,4 +38,7 @@
 extern int s3c24xx_clkcon_enable(struct clk *clk, int enable);
 extern int s3c24xx_register_clock(struct clk *clk);
 
-extern int s3c24xx_setup_clocks(void);
+extern int s3c24xx_setup_clocks(unsigned long xtal,
+				unsigned long fclk,
+				unsigned long hclk,
+				unsigned long pclk);
diff -Nru a/arch/arm/mach-s3c2410/cpu.c b/arch/arm/mach-s3c2410/cpu.c
--- a/arch/arm/mach-s3c2410/cpu.c	2005-01-14 05:11:04 -08:00
+++ b/arch/arm/mach-s3c2410/cpu.c	2005-02-28 16:29:07 -08:00
@@ -1,7 +1,8 @@
 /* linux/arch/arm/mach-s3c2410/cpu.c
  *
- * Copyright (c) 2004 Simtec Electronics
- * Ben Dooks <ben@simtec.co.uk>
+ * Copyright (c) 2004-2005 Simtec Electronics
+ *	http://www.simtec.co.uk/products/SWLINUX/
+ *	Ben Dooks <ben@simtec.co.uk>
  *
  * S3C24XX CPU Support
  *
@@ -181,8 +182,8 @@
 
 void __init s3c24xx_init_clocks(int xtal)
 {
-	if (xtal != 0)
-		s3c24xx_xtal = xtal;
+	if (xtal == 0)
+		xtal = 12*1000*1000;
 
 	if (cpu == NULL)
 		panic("s3c24xx_init_clocks: no cpu setup?\n");
diff -Nru a/arch/arm/mach-s3c2410/cpu.h b/arch/arm/mach-s3c2410/cpu.h
--- a/arch/arm/mach-s3c2410/cpu.h	2005-01-14 04:45:33 -08:00
+++ b/arch/arm/mach-s3c2410/cpu.h	2005-02-28 16:29:07 -08:00
@@ -27,6 +27,7 @@
 
 /* forward declaration */
 struct s3c2410_uartcfg;
+struct map_desc;
 
 /* core initialisation functions */
 
@@ -58,3 +59,7 @@
 
 struct sys_timer;
 extern struct sys_timer s3c24xx_timer;
+
+/* system device classes */
+
+extern struct sysdev_class s3c2440_sysclass;
diff -Nru a/arch/arm/mach-s3c2410/devs.c b/arch/arm/mach-s3c2410/devs.c
--- a/arch/arm/mach-s3c2410/devs.c	2004-11-12 07:42:34 -08:00
+++ b/arch/arm/mach-s3c2410/devs.c	2005-02-10 09:39:56 -08:00
@@ -10,6 +10,7 @@
  * published by the Free Software Foundation.
  *
  * Modifications:
+ *     10-Feb-2005 BJD  Added camera from guillaume.gourat@nexvision.tv
  *     29-Aug-2004 BJD  Added timers 0 through 3
  *     29-Aug-2004 BJD  Changed index of devices we only have one of to -1
  *     21-Aug-2004 BJD  Added IRQ_TICK to RTC resources
@@ -446,3 +447,38 @@
 };
 
 EXPORT_SYMBOL(s3c_device_timer3);
+
+#ifdef CONFIG_CPU_S3C2440
+
+/* Camif Controller */
+
+static struct resource s3c_camif_resource[] = {
+	[0] = {
+		.start = S3C2440_PA_CAMIF,
+		.end   = S3C2440_PA_CAMIF + S3C2440_SZ_CAMIF,
+		.flags = IORESOURCE_MEM,
+	},
+	[1] = {
+		.start = IRQ_CAM,
+		.end   = IRQ_CAM,
+		.flags = IORESOURCE_IRQ,
+	}
+
+};
+
+static u64 s3c_device_camif_dmamask = 0xffffffffUL;
+
+struct platform_device s3c_device_camif = {
+	.name		  = "s3c2440-camif",
+	.id		  = -1,
+	.num_resources	  = ARRAY_SIZE(s3c_camif_resource),
+	.resource	  = s3c_camif_resource,
+	.dev              = {
+		.dma_mask = &s3c_device_camif_dmamask,
+		.coherent_dma_mask = 0xffffffffUL
+	}
+};
+
+EXPORT_SYMBOL(s3c_device_camif);
+
+#endif // CONFIG_CPU_S32440
diff -Nru a/arch/arm/mach-s3c2410/devs.h b/arch/arm/mach-s3c2410/devs.h
--- a/arch/arm/mach-s3c2410/devs.h	2004-09-05 09:56:00 -07:00
+++ b/arch/arm/mach-s3c2410/devs.h	2005-02-10 09:40:27 -08:00
@@ -12,7 +12,11 @@
  * Modifications:
  *      18-Aug-2004 BJD  Created initial version
  *	27-Aug-2004 BJD  Added timers 0 through 3
+ *	10-Feb-2005 BJD	 Added camera from guillaume.gourat@nexvision.tv
 */
+#include <linux/config.h>
+
+extern struct platform_device *s3c24xx_uart_devs[];
 
 extern struct platform_device s3c_device_usb;
 extern struct platform_device s3c_device_lcd;
@@ -34,3 +38,11 @@
 extern struct platform_device s3c_device_timer3;
 
 extern struct platform_device s3c_device_usbgadget;
+
+/* s3c2440 specific devices */
+
+#ifdef CONFIG_CPU_S3C2440
+
+extern struct platform_device s3c_device_camif;
+
+#endif
diff -Nru a/arch/arm/mach-s3c2410/dma.c b/arch/arm/mach-s3c2410/dma.c
--- a/arch/arm/mach-s3c2410/dma.c	2005-01-16 16:55:08 -08:00
+++ b/arch/arm/mach-s3c2410/dma.c	2005-02-28 04:57:12 -08:00
@@ -1,6 +1,6 @@
 /* linux/arch/arm/mach-bast/dma.c
  *
- * (c) 2003,2004 Simtec Electronics
+ * (c) 2003-2005 Simtec Electronics
  *	Ben Dooks <ben@simtec.co.uk>
  *
  * S3C2410 DMA core
@@ -12,6 +12,7 @@
  * published by the Free Software Foundation.
  *
  * Changelog:
+ *  27-Feb-2005 BJD  Added kmem cache for dma descriptors
  *  18-Nov-2004 BJD  Removed error for loading onto stopped channel
  *  10-Nov-2004 BJD  Ensure all external symbols exported for modules
  *  10-Nov-2004 BJD  Use sys_device and sysdev_class for power management
@@ -57,6 +58,7 @@
 
 /* io map for dma */
 static void __iomem *dma_base;
+static kmem_cache_t *dma_kmem;
 
 /* dma channel state information */
 s3c2410_dma_chan_t s3c2410_chans[S3C2410_DMA_CHANNELS];
@@ -432,7 +434,7 @@
 	pr_debug("%s: id=%p, data=%08x, size=%d\n",
 		 __FUNCTION__, id, (unsigned int)data, size);
 
-	buf = (s3c2410_dma_buf_t *)kmalloc(sizeof(*buf), GFP_ATOMIC);
+	buf = kmem_cache_alloc(dma_kmem, GFP_ATOMIC);
 	if (buf == NULL) {
 		pr_debug("%s: out of memory (%d alloc)\n",
 			 __FUNCTION__, sizeof(*buf));
@@ -511,7 +513,7 @@
 	buf->magic = -1;
 
 	if (magicok) {
-		kfree(buf);
+		kmem_cache_free(dma_kmem, buf);
 	} else {
 		printk("s3c2410_dma_freebuf: buff %p with bad magic\n", buf);
 	}
@@ -1128,6 +1130,14 @@
 	.resume		= s3c2410_dma_resume,
 };
 
+/* kmem cache implementation */
+
+static void s3c2410_dma_cache_ctor(void *p, kmem_cache_t *c, unsigned long f)
+{
+	memset(p, 0, sizeof(s3c2410_dma_buf_t));
+}
+
+
 /* initialisation code */
 
 static int __init s3c2410_init_dma(void)
@@ -1150,6 +1160,16 @@
 		goto err;
 	}
 
+	dma_kmem = kmem_cache_create("dma_desc", sizeof(s3c2410_dma_buf_t), 0,
+				     SLAB_HWCACHE_ALIGN,
+				     s3c2410_dma_cache_ctor, NULL);
+
+	if (dma_kmem == NULL) {
+		printk(KERN_ERR "dma failed to make kmem cache\n");
+		ret = -ENOMEM;
+		goto err;
+	}
+
 	for (channel = 0; channel < S3C2410_DMA_CHANNELS; channel++) {
 		cp = &s3c2410_chans[channel];
 
@@ -1181,6 +1201,7 @@
 	return 0;
 
  err:
+	kmem_cache_destroy(dma_kmem);
 	iounmap(dma_base);
 	dma_base = NULL;
 	return ret;
diff -Nru a/arch/arm/mach-s3c2410/irq.c b/arch/arm/mach-s3c2410/irq.c
--- a/arch/arm/mach-s3c2410/irq.c	2005-01-11 02:04:01 -08:00
+++ b/arch/arm/mach-s3c2410/irq.c	2005-02-28 17:02:28 -08:00
@@ -57,6 +57,7 @@
 #include <asm/arch/regs-irq.h>
 #include <asm/arch/regs-gpio.h>
 
+#include "cpu.h"
 #include "pm.h"
 
 #define irqdbf(x...)
@@ -628,6 +629,7 @@
 	s3c_irq_demux_uart(IRQ_S3CUART_RX2, regs);
 }
 
+
 /* s3c24xx_init_irq
  *
  * Initialise S3C2410 IRQ system
@@ -771,3 +773,174 @@
 
 	irqdbf("s3c2410: registered interrupt handlers\n");
 }
+
+/* s3c2440 irq code
+*/
+
+#ifdef CONFIG_CPU_S3C2440
+
+/* WDT/AC97 */
+
+static void s3c_irq_demux_wdtac97(unsigned int irq,
+				  struct irqdesc *desc,
+				  struct pt_regs *regs)
+{
+	unsigned int subsrc, submsk;
+	struct irqdesc *mydesc;
+
+	/* read the current pending interrupts, and the mask
+	 * for what it is available */
+
+	subsrc = __raw_readl(S3C2410_SUBSRCPND);
+	submsk = __raw_readl(S3C2410_INTSUBMSK);
+
+	subsrc &= ~submsk;
+	subsrc >>= 13;
+	subsrc &= 3;
+
+	if (subsrc != 0) {
+		if (subsrc & 1) {
+			mydesc = irq_desc + IRQ_S3C2440_WDT;
+			mydesc->handle( IRQ_S3C2440_WDT, mydesc, regs);
+		}
+		if (subsrc & 2) {
+			mydesc = irq_desc + IRQ_S3C2440_AC97;
+			mydesc->handle(IRQ_S3C2440_AC97, mydesc, regs);
+		}
+	}
+}
+
+
+#define INTMSK_WDT	 (1UL << (IRQ_WDT - IRQ_EINT0))
+
+static void
+s3c_irq_wdtac97_mask(unsigned int irqno)
+{
+	s3c_irqsub_mask(irqno, INTMSK_WDT, 3<<13);
+}
+
+static void
+s3c_irq_wdtac97_unmask(unsigned int irqno)
+{
+	s3c_irqsub_unmask(irqno, INTMSK_WDT);
+}
+
+static void
+s3c_irq_wdtac97_ack(unsigned int irqno)
+{
+	s3c_irqsub_maskack(irqno, INTMSK_WDT, 3<<13);
+}
+
+static struct irqchip s3c_irq_wdtac97 = {
+	.mask	    = s3c_irq_wdtac97_mask,
+	.unmask	    = s3c_irq_wdtac97_unmask,
+	.ack	    = s3c_irq_wdtac97_ack,
+};
+
+/* camera irq */
+
+static void s3c_irq_demux_cam(unsigned int irq,
+			      struct irqdesc *desc,
+			      struct pt_regs *regs)
+{
+	unsigned int subsrc, submsk;
+	struct irqdesc *mydesc;
+
+	/* read the current pending interrupts, and the mask
+	 * for what it is available */
+
+	subsrc = __raw_readl(S3C2410_SUBSRCPND);
+	submsk = __raw_readl(S3C2410_INTSUBMSK);
+
+	subsrc &= ~submsk;
+	subsrc >>= 11;
+	subsrc &= 3;
+
+	if (subsrc != 0) {
+		if (subsrc & 1) {
+			mydesc = irq_desc + IRQ_S3C2440_CAM_C;
+			mydesc->handle( IRQ_S3C2440_WDT, mydesc, regs);
+		}
+		if (subsrc & 2) {
+			mydesc = irq_desc + IRQ_S3C2440_CAM_P;
+			mydesc->handle(IRQ_S3C2440_AC97, mydesc, regs);
+		}
+	}
+}
+
+#define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0))
+
+static void
+s3c_irq_cam_mask(unsigned int irqno)
+{
+	s3c_irqsub_mask(irqno, INTMSK_CAM, 3<<11);
+}
+
+static void
+s3c_irq_cam_unmask(unsigned int irqno)
+{
+	s3c_irqsub_unmask(irqno, INTMSK_CAM);
+}
+
+static void
+s3c_irq_cam_ack(unsigned int irqno)
+{
+	s3c_irqsub_maskack(irqno, INTMSK_CAM, 3<<11);
+}
+
+static struct irqchip s3c_irq_cam = {
+	.mask	    = s3c_irq_cam_mask,
+	.unmask	    = s3c_irq_cam_unmask,
+	.ack	    = s3c_irq_cam_ack,
+};
+
+static int s3c2440_irq_add(struct sys_device *sysdev)
+{
+	unsigned int irqno;
+
+	printk("S3C2440: IRQ Support\n");
+
+	set_irq_chip(IRQ_NFCON, &s3c_irq_level_chip);
+	set_irq_handler(IRQ_NFCON, do_level_IRQ);
+	set_irq_flags(IRQ_NFCON, IRQF_VALID);
+
+	/* add new chained handler for wdt, ac7 */
+
+	set_irq_chip(IRQ_WDT, &s3c_irq_level_chip);
+	set_irq_handler(IRQ_WDT, do_level_IRQ);
+	set_irq_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97);
+
+	for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) {
+		set_irq_chip(irqno, &s3c_irq_wdtac97);
+		set_irq_handler(irqno, do_level_IRQ);
+		set_irq_flags(irqno, IRQF_VALID);
+	}
+
+	/* add chained handler for camera */
+
+	set_irq_chip(IRQ_CAM, &s3c_irq_level_chip);
+	set_irq_handler(IRQ_CAM, do_level_IRQ);
+	set_irq_chained_handler(IRQ_CAM, s3c_irq_demux_cam);
+
+	for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) {
+		set_irq_chip(irqno, &s3c_irq_cam);
+		set_irq_handler(irqno, do_level_IRQ);
+		set_irq_flags(irqno, IRQF_VALID);
+	}
+
+	return 0;
+}
+
+static struct sysdev_driver s3c2440_irq_driver = {
+	.add	= s3c2440_irq_add,
+};
+
+static int s3c24xx_irq_driver(void)
+{
+	return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_irq_driver);
+}
+
+arch_initcall(s3c24xx_irq_driver);
+
+#endif /* CONFIG_CPU_S3C2440 */
+
diff -Nru a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
--- a/arch/arm/mach-s3c2410/mach-bast.c	2005-01-17 06:19:02 -08:00
+++ b/arch/arm/mach-s3c2410/mach-bast.c	2005-03-03 06:11:23 -08:00
@@ -23,6 +23,7 @@
  *     04-Jan-2005 BJD  New uart init call
  *     10-Jan-2005 BJD  Removed include of s3c2410.h
  *     14-Jan-2005 BJD  Add support for muitlple NAND devices
+ *     03-Mar-2005 BJD  Ensured that bast-cpld.h is included
 */
 
 #include <linux/kernel.h>
@@ -39,6 +40,7 @@
 
 #include <asm/arch/bast-map.h>
 #include <asm/arch/bast-irq.h>
+#include <asm/arch/bast-cpld.h>
 
 #include <asm/hardware.h>
 #include <asm/io.h>
diff -Nru a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/arm/mach-s3c2410/mach-n30.c	2005-03-06 07:16:42 -08:00
@@ -0,0 +1,155 @@
+/* linux/arch/arm/mach-s3c2410/mach-n30.c
+ *
+ * Copyright (c) 2003-2005 Simtec Electronics
+ *	Ben Dooks <ben@simtec.co.uk>
+ *
+ * Copyright (c) 2005 Christer Weinigel <christer@weinigel.se>
+ *
+ * There is a wiki with more information about the n30 port at
+ * http://handhelds.org/moin/moin.cgi/AcerN30Documentation .
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/kthread.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/hardware.h>
+#include <asm/hardware/iomd.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+#include <asm/arch/regs-serial.h>
+#include <asm/arch/regs-gpio.h>
+#include <asm/arch/iic.h>
+
+#include <linux/serial_core.h>
+
+#include "s3c2410.h"
+#include "clock.h"
+#include "devs.h"
+#include "cpu.h"
+
+static struct map_desc n30_iodesc[] __initdata = {
+	/* nothing here yet */
+};
+
+static struct s3c2410_uartcfg n30_uartcfgs[] = {
+	/* Normal serial port */
+	[0] = {
+		.hwport	     = 0,
+		.flags	     = 0,
+		.ucon	     = 0x2c5,
+		.ulcon	     = 0x03,
+		.ufcon	     = 0x51,
+	},
+	/* IR port */
+	[1] = {
+		.hwport	     = 1,
+		.flags	     = 0,
+		.uart_flags  = UPF_CONS_FLOW,
+		.ucon	     = 0x2c5,
+		.ulcon	     = 0x43,
+		.ufcon	     = 0x51,
+	},
+	/* The BlueTooth controller is connected to port 2 */
+	[2] = {
+		.hwport	     = 2,
+		.flags	     = 0,
+		.ucon	     = 0x2c5,
+		.ulcon	     = 0x03,
+		.ufcon	     = 0x51,
+	},
+};
+
+static struct platform_device *n30_devices[] __initdata = {
+	&s3c_device_usb,
+	&s3c_device_lcd,
+	&s3c_device_wdt,
+	&s3c_device_i2c,
+	&s3c_device_iis,
+	&s3c_device_usbgadget,
+};
+
+static struct s3c2410_platform_i2c n30_i2ccfg = {
+	.flags		= 0,
+	.slave_addr	= 0x10,
+	.bus_freq	= 10*1000,
+	.max_freq	= 10*1000,
+};
+
+static struct s3c24xx_board n30_board __initdata = {
+	.devices       = n30_devices,
+	.devices_count = ARRAY_SIZE(n30_devices)
+};
+
+void __init n30_map_io(void)
+{
+	s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
+	s3c24xx_init_clocks(0);
+	s3c24xx_init_uarts(n30_uartcfgs, ARRAY_SIZE(n30_uartcfgs));
+	s3c24xx_set_board(&n30_board);
+}
+
+void __init n30_init_irq(void)
+{
+	s3c24xx_init_irq();
+}
+
+
+static int n30_usbstart_thread(void *unused)
+{
+	/* Turn off suspend on both USB ports, and switch the
+	 * selectable USB port to USB device mode. */
+	writel(readl(S3C2410_MISCCR) & ~0x00003008, S3C2410_MISCCR);
+
+	/* Turn off the D+ pull up for 3 seconds so that the USB host
+	 * at the other end will do a rescan of the USB bus.  */
+	s3c2410_gpio_setpin(S3C2410_GPB3, 0);
+
+	msleep_interruptible(3*HZ);
+
+	s3c2410_gpio_setpin(S3C2410_GPB3, 1);
+
+	return 0;
+}
+
+
+void __init n30_init(void)
+{
+	s3c_device_i2c.dev.platform_data = &n30_i2ccfg;
+
+	kthread_run(n30_usbstart_thread, NULL, "n30_usbstart");
+}
+
+MACHINE_START(N30, "Acer-N30")
+     MAINTAINER("Christer Weinigel <christer@weinigel.se>, Ben Dooks <ben-linux@fluff.org>")
+     BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, S3C2410_VA_UART)
+     BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
+
+	.timer		= &s3c24xx_timer,
+	.init_machine	= n30_init,
+	.init_irq	= n30_init_irq,
+	.map_io		= n30_map_io,
+MACHINE_END
+
+/*
+    Local variables:
+        compile-command: "make ARCH=arm CROSS_COMPILE=/usr/local/arm/3.3.2/bin/arm-linux- -k -C ../../.."
+        c-basic-offset: 8
+    End:
+*/
diff -Nru a/arch/arm/mach-s3c2410/mach-smdk2440.c b/arch/arm/mach-s3c2410/mach-smdk2440.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/arm/mach-s3c2410/mach-smdk2440.c	2005-03-03 02:30:16 -08:00
@@ -0,0 +1,133 @@
+/* linux/arch/arm/mach-s3c2410/mach-smdk2440.c
+ *
+ * Copyright (c) 2004,2005 Simtec Electronics
+ *	Ben Dooks <ben@simtec.co.uk>
+ *
+ * http://www.fluff.org/ben/smdk2440/
+ *
+ * Thanks to Dimity Andric and TomTom for the loan of an SMDK2440.
+ *
+ * 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.
+ *
+ * Modifications:
+ *	01-Nov-2004 BJD Initial version
+ *	12-Nov-2004 BJD Updated for release
+ *	04-Jan-2005 BJD Fixes for pre-release
+ *	22-Feb-2005 BJD Updated for 2.6.11-rc5 relesa
+*/
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/interrupt.h>
+#include <linux/list.h>
+#include <linux/timer.h>
+#include <linux/init.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/hardware.h>
+#include <asm/hardware/iomd.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/mach-types.h>
+
+//#include <asm/debug-ll.h>
+#include <asm/arch/regs-serial.h>
+#include <asm/arch/regs-gpio.h>
+#include <asm/arch/idle.h>
+
+#include "s3c2410.h"
+#include "s3c2440.h"
+#include "clock.h"
+#include "devs.h"
+#include "cpu.h"
+#include "pm.h"
+
+static struct map_desc smdk2440_iodesc[] __initdata = {
+	/* ISA IO Space map (memory space selected by A24) */
+
+	{ S3C2410_VA_ISA_WORD, S3C2410_CS2, SZ_16M, MT_DEVICE },
+	{ S3C2410_VA_ISA_BYTE, S3C2410_CS2, SZ_16M, MT_DEVICE },
+};
+
+#define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
+#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
+#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
+
+static struct s3c2410_uartcfg smdk2440_uartcfgs[] = {
+	[0] = {
+		.hwport	     = 0,
+		.flags	     = 0,
+		.ucon	     = 0x3c5,
+		.ulcon	     = 0x03,
+		.ufcon	     = 0x51,
+	},
+	[1] = {
+		.hwport	     = 1,
+		.flags	     = 0,
+		.ucon	     = 0x3c5,
+		.ulcon	     = 0x03,
+		.ufcon	     = 0x51,
+	},
+	/* IR port */
+	[2] = {
+		.hwport	     = 2,
+		.flags	     = 0,
+		.ucon	     = 0x3c5,
+		.ulcon	     = 0x43,
+		.ufcon	     = 0x51,
+	}
+};
+
+static struct platform_device *smdk2440_devices[] __initdata = {
+	&s3c_device_usb,
+	&s3c_device_lcd,
+	&s3c_device_wdt,
+	&s3c_device_i2c,
+	&s3c_device_iis,
+};
+
+static struct s3c24xx_board smdk2440_board __initdata = {
+	.devices       = smdk2440_devices,
+	.devices_count = ARRAY_SIZE(smdk2440_devices)
+};
+
+void __init smdk2440_map_io(void)
+{
+	s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
+	s3c24xx_init_clocks(16934400);
+	s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
+	s3c24xx_set_board(&smdk2440_board);
+}
+
+void __init smdk2440_machine_init(void)
+{
+	/* Configure the LEDs (even if we have no LED support)*/
+
+	s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_OUTP);
+	s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
+	s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_OUTP);
+	s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_OUTP);
+
+	s3c2410_gpio_setpin(S3C2410_GPF4, 0);
+	s3c2410_gpio_setpin(S3C2410_GPF5, 0);
+	s3c2410_gpio_setpin(S3C2410_GPF6, 0);
+	s3c2410_gpio_setpin(S3C2410_GPF7, 0);
+
+	s3c2410_pm_init();
+}
+
+MACHINE_START(S3C2440, "SMDK2440")
+	MAINTAINER("Ben Dooks <ben@fluff.org>")
+	BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, S3C2410_VA_UART)
+	BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
+
+	.init_irq	= s3c24xx_init_irq,
+	.map_io		= smdk2440_map_io,
+	.init_machine	= smdk2440_machine_init,
+	.timer		= &s3c24xx_timer,
+MACHINE_END
diff -Nru a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
--- a/arch/arm/mach-s3c2410/mach-vr1000.c	2005-01-20 03:42:52 -08:00
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c	2005-02-10 07:03:12 -08:00
@@ -24,6 +24,7 @@
  *     14-Jan-2005 BJD  Added clock init
  *     15-Jan-2005 BJD  Add serial port device definition
  *     20-Jan-2005 BJD  Use UPF_IOREMAP for ports
+ *     10-Feb-2005 BJD  Added power-off capability
 */
 
 #include <linux/kernel.h>
@@ -52,8 +53,8 @@
 #include <asm/irq.h>
 #include <asm/mach-types.h>
 
-//#include <asm/debug-ll.h>
 #include <asm/arch/regs-serial.h>
+#include <asm/arch/regs-gpio.h>
 
 #include "clock.h"
 #include "devs.h"
@@ -269,6 +270,11 @@
 	.clocks_count  = ARRAY_SIZE(vr1000_clocks),
 };
 
+static void vr1000_power_off(void)
+{
+	s3c2410_gpio_cfgpin(S3C2410_GPB9, S3C2410_GPB9_OUTP);
+	s3c2410_gpio_setpin(S3C2410_GPB9, 1);
+}
 
 void __init vr1000_map_io(void)
 {
@@ -284,6 +290,8 @@
 	s3c24xx_clkout1.parent  = &s3c24xx_dclk1;
 
 	s3c24xx_uclk.parent  = &s3c24xx_clkout1;
+
+	pm_power_off = vr1000_power_off;
 
 	s3c24xx_init_io(vr1000_iodesc, ARRAY_SIZE(vr1000_iodesc));
 	s3c24xx_init_clocks(0);
diff -Nru a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
--- a/arch/arm/mach-s3c2410/s3c2410.c	2005-01-14 05:10:26 -08:00
+++ b/arch/arm/mach-s3c2410/s3c2410.c	2005-02-28 16:29:07 -08:00
@@ -17,7 +17,7 @@
  *     21-Aug-2004 BJD  Added new struct s3c2410_board handler
  *     28-Sep-2004 BJD  Updates for new serial port bits
  *     04-Nov-2004 BJD  Updated UART configuration process
- *     10-Jan-2004 BJD  Removed s3c2410_clock_tick_rate
+ *     10-Jan-2005 BJD  Removed s3c2410_clock_tick_rate
 */
 
 #include <linux/kernel.h>
@@ -164,31 +164,32 @@
 void __init s3c2410_init_clocks(int xtal)
 {
 	unsigned long tmp;
+	unsigned long fclk;
+	unsigned long hclk;
+	unsigned long pclk;
 
 	/* now we've got our machine bits initialised, work out what
 	 * clocks we've got */
 
-	s3c24xx_fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON),
-				       s3c24xx_xtal);
+	fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON), xtal);
 
 	tmp = __raw_readl(S3C2410_CLKDIVN);
 
 	/* work out clock scalings */
 
-	s3c24xx_hclk = s3c24xx_fclk / ((tmp & S3C2410_CLKDIVN_HDIVN) ? 2 : 1);
-	s3c24xx_pclk = s3c24xx_hclk / ((tmp & S3C2410_CLKDIVN_PDIVN) ? 2 : 1);
+	hclk = fclk / ((tmp & S3C2410_CLKDIVN_HDIVN) ? 2 : 1);
+	pclk = hclk / ((tmp & S3C2410_CLKDIVN_PDIVN) ? 2 : 1);
 
 	/* print brieft summary of clocks, etc */
 
 	printk("S3C2410: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
-	       print_mhz(s3c24xx_fclk), print_mhz(s3c24xx_hclk),
-	       print_mhz(s3c24xx_pclk));
+	       print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
 
 	/* initialise the clocks here, to allow other things like the
 	 * console to use them
 	 */
 
-	s3c24xx_setup_clocks();
+	s3c24xx_setup_clocks(xtal, fclk, hclk, pclk);
 }
 
 int __init s3c2410_init(void)
diff -Nru a/arch/arm/mach-s3c2410/s3c2440.c b/arch/arm/mach-s3c2410/s3c2440.c
--- a/arch/arm/mach-s3c2410/s3c2440.c	2005-01-14 05:08:57 -08:00
+++ b/arch/arm/mach-s3c2410/s3c2440.c	2005-02-28 16:41:52 -08:00
@@ -109,7 +109,6 @@
 	.resource	  = s3c_uart0_resource,
 };
 
-
 static struct platform_device s3c_uart1 = {
 	.name		  = "s3c2440-uart",
 	.id		  = 1,
@@ -149,19 +148,6 @@
 	s3c2440_uart_count = uart;
 }
 
-/* s3c2440 specific clock sources */
-
-static struct clk s3c2440_clk_cam = {
-	.name		= "camera",
-	.enable		= s3c24xx_clkcon_enable,
-	.ctrlbit	= S3C2440_CLKCON_CAMERA
-};
-
-static struct clk s3c2440_clk_ac97 = {
-	.name		= "ac97",
-	.enable		= s3c24xx_clkcon_enable,
-	.ctrlbit	= S3C2440_CLKCON_CAMERA
-};
 
 #ifdef CONFIG_PM
 
@@ -190,7 +176,7 @@
 #define s3c2440_resume  NULL
 #endif
 
-static struct sysdev_class s3c2440_sysclass = {
+struct sysdev_class s3c2440_sysclass = {
 	set_kset_name("s3c2440-core"),
 	.suspend	= s3c2440_suspend,
 	.resume		= s3c2440_resume
@@ -209,19 +195,24 @@
 	/* rename any peripherals used differing from the s3c2410 */
 
 	s3c_device_i2c.name = "s3c2440-i2c";
+
+	/* change irq for watchdog */
+
+	s3c_device_wdt.resource[1].start = IRQ_S3C2440_WDT;
+	s3c_device_wdt.resource[1].end   = IRQ_S3C2440_WDT;
 }
 
 void __init s3c2440_init_clocks(int xtal)
 {
 	unsigned long clkdiv;
 	unsigned long camdiv;
-	int s3c2440_hdiv = 1;
+	unsigned long hclk, fclk, pclk;
+	int hdiv = 1;
 
 	/* now we've got our machine bits initialised, work out what
 	 * clocks we've got */
 
-	s3c24xx_fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON),
-				       s3c24xx_xtal) * 2;
+	fclk = s3c2410_get_pll(__raw_readl(S3C2410_MPLLCON), xtal) * 2;
 
 	clkdiv = __raw_readl(S3C2410_CLKDIVN);
 	camdiv = __raw_readl(S3C2440_CAMDIVN);
@@ -230,63 +221,60 @@
 
 	switch (clkdiv & S3C2440_CLKDIVN_HDIVN_MASK) {
 	case S3C2440_CLKDIVN_HDIVN_1:
-		s3c2440_hdiv = 1;
+		hdiv = 1;
 		break;
 
 	case S3C2440_CLKDIVN_HDIVN_2:
-		s3c2440_hdiv = 1;
+		hdiv = 1;
 		break;
 
 	case S3C2440_CLKDIVN_HDIVN_4_8:
-		s3c2440_hdiv = (camdiv & S3C2440_CAMDIVN_HCLK4_HALF) ? 8 : 4;
+		hdiv = (camdiv & S3C2440_CAMDIVN_HCLK4_HALF) ? 8 : 4;
 		break;
 
 	case S3C2440_CLKDIVN_HDIVN_3_6:
-		s3c2440_hdiv = (camdiv & S3C2440_CAMDIVN_HCLK3_HALF) ? 6 : 3;
+		hdiv = (camdiv & S3C2440_CAMDIVN_HCLK3_HALF) ? 6 : 3;
 		break;
 	}
 
-	s3c24xx_hclk = s3c24xx_fclk / s3c2440_hdiv;
-	s3c24xx_pclk = s3c24xx_hclk / ((clkdiv & S3C2440_CLKDIVN_PDIVN)? 2:1);
+	hclk = fclk / hdiv;
+	pclk = hclk / ((clkdiv & S3C2440_CLKDIVN_PDIVN)? 2:1);
 
 	/* print brief summary of clocks, etc */
 
 	printk("S3C2440: core %ld.%03ld MHz, memory %ld.%03ld MHz, peripheral %ld.%03ld MHz\n",
-	       print_mhz(s3c24xx_fclk), print_mhz(s3c24xx_hclk),
-	       print_mhz(s3c24xx_pclk));
+	       print_mhz(fclk), print_mhz(hclk), print_mhz(pclk));
 
 	/* initialise the clocks here, to allow other things like the
 	 * console to use them, and to add new ones after the initialisation
 	 */
 
-	s3c24xx_setup_clocks();
-
-	/* add s3c2440 specific clocks */
-
-	s3c2440_clk_cam.parent = clk_get(NULL, "hclk");
-	s3c2440_clk_ac97.parent = clk_get(NULL, "pclk");
+	s3c24xx_setup_clocks(xtal, fclk, hclk, pclk);
+}
 
-	s3c24xx_register_clock(&s3c2440_clk_ac97);
-	s3c24xx_register_clock(&s3c2440_clk_cam);
+/* need to register class before we actually register the device, and
+ * we also need to ensure that it has been initialised before any of the
+ * drivers even try to use it (even if not on an s3c2440 based system)
+ * as a driver which may support both 2410 and 2440 may try and use it.
+*/
 
-	clk_disable(&s3c2440_clk_ac97);
-	clk_disable(&s3c2440_clk_cam);
+int __init s3c2440_core_init(void)
+{
+	return sysdev_class_register(&s3c2440_sysclass);
 }
 
+core_initcall(s3c2440_core_init);
+
 int __init s3c2440_init(void)
 {
 	int ret;
 
 	printk("S3C2440: Initialising architecture\n");
 
-	ret = sysdev_class_register(&s3c2440_sysclass);
-	if (ret == 0)
-		ret = sysdev_register(&s3c2440_sysdev);
-
+	ret = sysdev_register(&s3c2440_sysdev);
 	if (ret != 0)
 		printk(KERN_ERR "failed to register sysdev for s3c2440\n");
-
-	if (ret == 0)
+	else
 		ret = platform_add_devices(s3c24xx_uart_devs, s3c2440_uart_count);
 
 	return ret;
diff -Nru a/arch/arm/mach-s3c2410/time.c b/arch/arm/mach-s3c2410/time.c
--- a/arch/arm/mach-s3c2410/time.c	2005-01-11 02:04:01 -08:00
+++ b/arch/arm/mach-s3c2410/time.c	2005-02-28 16:29:07 -08:00
@@ -1,6 +1,6 @@
 /* linux/arch/arm/mach-s3c2410/time.c
  *
- * Copyright (C) 2003,2004 Simtec Electronics
+ * Copyright (C) 2003-2005 Simtec Electronics
  *	Ben Dooks, <ben@simtec.co.uk>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -23,6 +23,8 @@
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/err.h>
+
 #include <asm/system.h>
 #include <asm/leds.h>
 #include <asm/mach-types.h>
@@ -33,6 +35,7 @@
 #include <asm/arch/regs-timer.h>
 #include <asm/arch/regs-irq.h>
 #include <asm/mach/time.h>
+#include <asm/hardware/clock.h>
 
 #include "clock.h"
 
@@ -169,6 +172,9 @@
 		tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
 		tcfg1 |= S3C2410_TCFG1_MUX4_TCLK1;
 	} else {
+		unsigned long pclk;
+		struct clk *clk;
+
 		/* for the h1940 (and others), we use the pclk from the core
 		 * to generate the timer values. since values around 50 to
 		 * 70MHz are not values we can directly generate the timer
@@ -180,7 +186,18 @@
 
 		/* this is used as default if no other timer can be found */
 
-		timer_usec_ticks = timer_mask_usec_ticks(6, s3c24xx_pclk);
+		clk = clk_get(NULL, "timers");
+		if (IS_ERR(clk))
+			panic("failed to get clock for system timer");
+
+		clk_use(clk);
+		clk_enable(clk);
+
+		pclk = clk_get_rate(clk);
+
+		/* configure clock tick */
+
+		timer_usec_ticks = timer_mask_usec_ticks(6, pclk);
 
 		tcfg1 &= ~S3C2410_TCFG1_MUX4_MASK;
 		tcfg1 |= S3C2410_TCFG1_MUX4_DIV2;
@@ -188,7 +205,7 @@
 		tcfg0 &= ~S3C2410_TCFG_PRESCALER1_MASK;
 		tcfg0 |= ((6 - 1) / 2) << S3C2410_TCFG_PRESCALER1_SHIFT;
 
-		tcnt = (s3c24xx_pclk / 6) / HZ;
+		tcnt = (pclk / 6) / HZ;
 	}
 
 	/* timers reload after counting zero, so reduce the count by 1 */
diff -Nru a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
--- a/arch/arm/mach-sa1100/assabet.c	2004-12-10 11:08:03 -08:00
+++ b/arch/arm/mach-sa1100/assabet.c	2005-03-05 07:51:54 -08:00
@@ -259,9 +259,11 @@
 	unsigned long phys = __PREG(GPLR) & PMD_MASK;
 	unsigned long virt = io_p2v(phys);
 	int prot = PMD_TYPE_SECT | PMD_SECT_AP_WRITE | PMD_DOMAIN(DOMAIN_IO);
-	pmd_t pmd;
-	pmd_val(pmd) = phys | prot;
-	set_pmd(pmd_offset(pgd_offset_k(virt), virt), pmd);
+	pmd_t *pmd;
+
+	pmd = pmd_offset(pgd_offset_k(virt), virt);
+	*pmd = __pmd(phys | prot);
+	flush_pmd_entry(pmd);
 }
 
 /*
diff -Nru a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
--- a/arch/arm/mach-sa1100/collie.c	2005-01-17 16:00:00 -08:00
+++ b/arch/arm/mach-sa1100/collie.c	2005-03-06 12:25:11 -08:00
@@ -55,7 +55,7 @@
 	.io_out		= COLLIE_SCOOP_IO_OUT,
 };
 
-static struct platform_device colliescoop_device = {
+struct platform_device colliescoop_device = {
 	.name		= "sharp-scoop",
 	.id		= -1,
 	.dev		= {
diff -Nru a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
--- a/arch/arm/mach-sa1100/neponset.c	2005-01-09 03:18:57 -08:00
+++ b/arch/arm/mach-sa1100/neponset.c	2005-01-28 19:36:52 -08:00
@@ -266,6 +266,7 @@
 
 static struct resource smc91x_resources[] = {
 	[0] = {
+		.name	= "smc91x-regs",
 		.start	= SA1100_CS3_PHYS,
 		.end	= SA1100_CS3_PHYS + 0x01ffffff,
 		.flags	= IORESOURCE_MEM,
@@ -276,6 +277,7 @@
 		.flags	= IORESOURCE_IRQ,
 	},
 	[2] = {
+		.name	= "smc91x-attrib",
 		.start	= SA1100_CS3_PHYS + 0x02000000,
 		.end	= SA1100_CS3_PHYS + 0x03ffffff,
 		.flags	= IORESOURCE_MEM,
diff -Nru a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c
--- a/arch/arm/mm/consistent.c	2005-02-25 11:42:41 -08:00
+++ b/arch/arm/mm/consistent.c	2005-03-01 15:04:36 -08:00
@@ -323,7 +323,7 @@
 void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr_t handle)
 {
 	struct vm_region *c;
-	unsigned long flags;
+	unsigned long flags, addr;
 	pte_t *ptep;
 
 	size = PAGE_ALIGN(size);
@@ -342,11 +342,13 @@
 	}
 
 	ptep = consistent_pte + CONSISTENT_OFFSET(c->vm_start);
+	addr = c->vm_start;
 	do {
-		pte_t pte = ptep_get_and_clear(ptep);
+		pte_t pte = ptep_get_and_clear(&init_mm, addr, ptep);
 		unsigned long pfn;
 
 		ptep++;
+		addr += PAGE_SIZE;
 
 		if (!pte_none(pte) && pte_present(pte)) {
 			pfn = pte_pfn(pte);
diff -Nru a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
--- a/arch/arm/mm/fault-armv.c	2004-09-07 06:36:20 -07:00
+++ b/arch/arm/mm/fault-armv.c	2005-02-25 16:35:19 -08:00
@@ -54,7 +54,7 @@
 	 * fault (ie, is old), we can safely ignore any issues.
 	 */
 	if (pte_present(entry) && pte_val(entry) & shared_pte_mask) {
-		flush_cache_page(vma, address);
+		flush_cache_page(vma, address, pte_pfn(entry));
 		pte_val(entry) &= ~shared_pte_mask;
 		set_pte(pte, entry);
 		flush_tlb_page(vma, address);
@@ -115,7 +115,7 @@
 	if (aliases)
 		adjust_pte(vma, addr);
 	else
-		flush_cache_page(vma, addr);
+		flush_cache_page(vma, addr, page_to_pfn(page));
 }
 
 /*
diff -Nru a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
--- a/arch/arm/mm/flush.c	2004-09-07 06:36:20 -07:00
+++ b/arch/arm/mm/flush.c	2005-02-25 16:35:19 -08:00
@@ -56,7 +56,7 @@
 		if (!(mpnt->vm_flags & VM_MAYSHARE))
 			continue;
 		offset = (pgoff - mpnt->vm_pgoff) << PAGE_SHIFT;
-		flush_cache_page(mpnt, mpnt->vm_start + offset);
+		flush_cache_page(mpnt, mpnt->vm_start + offset, page_to_pfn(page));
 		if (cache_is_vipt())
 			break;
 	}
diff -Nru a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
--- a/arch/arm/mm/mm-armv.c	2005-01-10 03:28:55 -08:00
+++ b/arch/arm/mm/mm-armv.c	2005-03-05 07:51:55 -08:00
@@ -252,7 +252,25 @@
 	if (virt & (1 << 20))
 		pmdp++;
 
-	set_pmd(pmdp, __pmd(phys | prot));
+	*pmdp = __pmd(phys | prot);
+	flush_pmd_entry(pmdp);
+}
+
+/*
+ * Create a SUPER SECTION PGD between VIRT and PHYS with protection PROT
+ */
+static inline void
+alloc_init_supersection(unsigned long virt, unsigned long phys, int prot)
+{
+	int i;
+
+	for (i = 0; i < 16; i += 1) {
+		alloc_init_section(virt, phys & SUPERSECTION_MASK,
+				   prot | PMD_SECT_SUPER);
+
+		virt += (PGDIR_SIZE / 2);
+		phys += (PGDIR_SIZE / 2);
+	}
 }
 
 /*
@@ -436,7 +454,8 @@
  * Create the page directory entries and any necessary
  * page tables for the mapping specified by `md'.  We
  * are able to cope here with varying sizes and address
- * offsets, and we take full advantage of sections.
+ * offsets, and we take full advantage of sections and
+ * supersections.
  */
 static void __init create_mapping(struct map_desc *md)
 {
@@ -483,6 +502,30 @@
 		length -= PAGE_SIZE;
 	}
 
+	/* N.B.	ARMv6 supersections are only defined to work with domain 0.
+	 *	Since domain assignments can in fact be arbitrary, the
+	 *	'domain == 0' check below is required to insure that ARMv6
+	 *	supersections are only allocated for domain 0 regardless
+	 *	of the actual domain assignments in use.
+	 */
+	if (cpu_architecture() >= CPU_ARCH_ARMv6 && domain == 0) {
+		/* Align to supersection boundary */
+		while ((virt & ~SUPERSECTION_MASK || (virt + off) &
+			~SUPERSECTION_MASK) && length >= (PGDIR_SIZE / 2)) {
+			alloc_init_section(virt, virt + off, prot_sect);
+
+			virt   += (PGDIR_SIZE / 2);
+			length -= (PGDIR_SIZE / 2);
+		}
+
+		while (length >= SUPERSECTION_SIZE) {
+			alloc_init_supersection(virt, virt + off, prot_sect);
+
+			virt   += SUPERSECTION_SIZE;
+			length -= SUPERSECTION_SIZE;
+		}
+	}
+
 	/*
 	 * A section mapping covers half a "pgdir" entry.
 	 */
@@ -526,8 +569,9 @@
 		if (cpu_arch <= CPU_ARCH_ARMv5)
 			pmdval |= PMD_BIT4;
 		pmd = pmd_offset(pgd + i, i << PGDIR_SHIFT);
-		set_pmd(pmd, __pmd(pmdval));
-		set_pmd(pmd + 1, __pmd(pmdval + (1 << (PGDIR_SHIFT - 1))));
+		pmd[0] = __pmd(pmdval);
+		pmd[1] = __pmd(pmdval + (1 << (PGDIR_SHIFT - 1)));
+		flush_pmd_entry(pmd);
 	}
 }
 
diff -Nru a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
--- a/arch/arm/tools/mach-types	2005-01-05 16:12:49 -08:00
+++ b/arch/arm/tools/mach-types	2005-03-06 14:28:32 -08:00
@@ -6,7 +6,7 @@
 # To add an entry into this database, please see Documentation/arm/README,
 # or contact rmk@arm.linux.org.uk
 #
-# Last update: Thu Jan 6 00:10:23 2005
+# Last update: Wed Mar 2 11:32:53 2005
 #
 # machine_is_xxx	CONFIG_xxxx		MACH_TYPE_xxx		number
 #
@@ -226,7 +226,7 @@
 pnp1110			SA1100_PNP1110		PNP1110			215
 csb226			ARCH_CSB226		CSB226			216
 arnold			SA1100_ARNOLD		ARNOLD			217
-voiceblue		SA1100_PSIBOARD		PSIBOARD		218
+voiceblue		MACH_VOICEBLUE		VOICEBLUE		218
 jz8028			ARCH_JZ8028		JZ8028			219
 h5400			ARCH_H5400		H5400			220
 forte			SA1100_FORTE		FORTE			221
@@ -381,7 +381,7 @@
 spearhead		ARCH_SPEARHEAD		SPEARHEAD		370
 pantera			ARCH_PANTERA		PANTERA			371
 prayoglite		ARCH_PRAYOGLITE		PRAYOGLITE		372
-gumstik			ARCH_GUMSTIK		GUMSTIK			373
+gumstix			ARCH_GUMSTIK		GUMSTIK			373
 rcube			ARCH_RCUBE		RCUBE			374
 rea_olv			ARCH_REA_OLV		REA_OLV			375
 pxa_iphone		ARCH_PXA_IPHONE		PXA_IPHONE		376
@@ -667,3 +667,44 @@
 manga_ks8695		MACH_MANGA_KS8695	MANGA_KS8695		657
 ajax			MACH_AJAX		AJAX			658
 nec_mp900		MACH_NEC_MP900		NEC_MP900		659
+vvtk1000		MACH_VVTK1000		VVTK1000		661
+kafa			MACH_KAFA		KAFA			662
+vvtk3000		MACH_VVTK3000		VVTK3000		663
+pimx1			MACH_PIMX1		PIMX1			664
+ollie			MACH_OLLIE		OLLIE			665
+skymax			MACH_SKYMAX		SKYMAX			666
+jazz			MACH_JAZZ		JAZZ			667
+tel_t3			MACH_TEL_T3		TEL_T3			668
+aisino_fcr255		MACH_AISINO_FCR255	AISINO_FCR255		669
+btweb			MACH_BTWEB		BTWEB			670
+dbg_lh79520		MACH_DBG_LH79520	DBG_LH79520		671
+cm41xx			MACH_CM41XX		CM41XX			672
+ts72xx			MACH_TS72XX		TS72XX			673
+nggpxa			MACH_NGGPXA		NGGPXA			674
+csb535			MACH_CSB535		CSB535			675
+csb536			MACH_CSB536		CSB536			676
+pxa_trakpod		MACH_PXA_TRAKPOD	PXA_TRAKPOD		677
+praxis			MACH_PRAXIS		PRAXIS			678
+lh75411			MACH_LH75411		LH75411			679
+otom			MACH_OTOM		OTOM			680
+nexcoder_2440		MACH_NEXCODER_2440	NEXCODER_2440		681
+loox410			MACH_LOOX410		LOOX410			682
+westlake		MACH_WESTLAKE		WESTLAKE		683
+nsb			MACH_NSB		NSB			684
+esl_sarva_stn		MACH_ESL_SARVA_STN	ESL_SARVA_STN		685
+esl_sarva_tft		MACH_ESL_SARVA_TFT	ESL_SARVA_TFT		686
+esl_sarva_iad		MACH_ESL_SARVA_IAD	ESL_SARVA_IAD		687
+esl_sarva_acc		MACH_ESL_SARVA_ACC	ESL_SARVA_ACC		688
+typhoon			MACH_TYPHOON		TYPHOON			689
+cnav			MACH_CNAV		CNAV			690
+a730			MACH_A730		A730			691
+netstar			MACH_NETSTAR		NETSTAR			692
+supercon		MACH_PHASEFALE_SUPERCON	PHASEFALE_SUPERCON	693
+shiva1100		MACH_SHIVA1100		SHIVA1100		694
+etexsc			MACH_ETEXSC		ETEXSC			695
+ixdpg465		MACH_IXDPG465		IXDPG465		696
+a9m2410			MACH_A9M2410		A9M2410			697
+a9m2440			MACH_A9M2440		A9M2440			698
+a9m9750			MACH_A9M9750		A9M9750			699
+a9m9360			MACH_A9M9360		A9M9360			700
+unc90			MACH_UNC90		UNC90			701
diff -Nru a/arch/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c
--- a/arch/frv/mb93090-mb00/pci-frv.c	2005-01-05 06:49:38 -08:00
+++ b/arch/frv/mb93090-mb00/pci-frv.c	2005-02-07 12:52:54 -08:00
@@ -43,7 +43,7 @@
 	pci_read_config_dword(dev, reg, &check);
 	if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
 		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
+		       "%s/%d (%08x != %08x)\n", pci_name(dev), resource,
 		       new, check);
 	}
 }
@@ -128,7 +128,7 @@
 					continue;
 				pr = pci_find_parent_resource(dev, r);
 				if (!pr || request_resource(pr, r) < 0)
-					printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, dev->slot_name);
+					printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, pci_name(dev));
 			}
 		}
 		pcibios_allocate_bus_resources(&bus->children);
diff -Nru a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
--- a/arch/frv/mb93090-mb00/pci-vdk.c	2005-01-04 18:48:06 -08:00
+++ b/arch/frv/mb93090-mb00/pci-vdk.c	2005-02-07 12:52:54 -08:00
@@ -294,7 +294,7 @@
 	 */
 	int i;
 
-	printk("PCI: Fixing base address flags for device %s\n", d->slot_name);
+	printk("PCI: Fixing base address flags for device %s\n", pci_name(d));
 	for(i=0; i<4; i++)
 		d->resource[i].flags |= PCI_BASE_ADDRESS_SPACE_IO;
 }
@@ -308,7 +308,7 @@
 	 */
 	if ((d->class >> 8) != PCI_CLASS_STORAGE_IDE)
 		return;
-	printk("PCI: IDE base address fixup for %s\n", d->slot_name);
+	printk("PCI: IDE base address fixup for %s\n", pci_name(d));
 	for(i=0; i<4; i++) {
 		struct resource *r = &d->resource[i];
 		if ((r->start & ~0x80) == 0x374) {
@@ -326,7 +326,7 @@
 	 * There exist PCI IDE controllers which have utter garbage
 	 * in first four base registers. Ignore that.
 	 */
-	printk("PCI: IDE base address trash cleared for %s\n", d->slot_name);
+	printk("PCI: IDE base address trash cleared for %s\n", pci_name(d));
 	for(i=0; i<4; i++)
 		d->resource[i].start = d->resource[i].end = d->resource[i].flags = 0;
 }
diff -Nru a/arch/i386/Kconfig b/arch/i386/Kconfig
--- a/arch/i386/Kconfig	2005-01-17 12:30:41 -08:00
+++ b/arch/i386/Kconfig	2005-03-07 20:41:40 -08:00
@@ -183,6 +183,7 @@
 	  - "Winchip-C6" for original IDT Winchip.
 	  - "Winchip-2" for IDT Winchip 2.
 	  - "Winchip-2A" for IDT Winchips with 3dNow! capabilities.
+	  - "MediaGX/Geode" for Cyrix MediaGX aka Geode.
 	  - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3.
 	  - "VIA C3-2 for VIA C3-2 "Nehemiah" (model 9 and above).
 
@@ -310,6 +311,13 @@
 	  stores for this CPU, which can increase performance of some
 	  operations.
 
+config MGEODE
+	bool "MediaGX/Geode"
+	help
+	  Select this for a Cyrix MediaGX aka Geode chip. Linux and GCC
+          treat this chip as a 586TSC with some extended instructions
+          and alignment reqirements.
+
 config MCYRIXIII
 	bool "CyrixIII/VIA-C3"
 	help
@@ -360,7 +368,7 @@
 	int
 	default "7" if MPENTIUM4 || X86_GENERIC
 	default "4" if X86_ELAN || M486 || M386
-	default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2
+	default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE
 	default "6" if MK7 || MK8 || MPENTIUMM
 
 config RWSEM_GENERIC_SPINLOCK
@@ -379,7 +387,7 @@
 
 config X86_PPRO_FENCE
 	bool
-	depends on M686 || M586MMX || M586TSC || M586 || M486 || M386
+	depends on M686 || M586MMX || M586TSC || M586 || M486 || M386 || MGEODE
 	default y
 
 config X86_F00F_BUG
@@ -409,7 +417,7 @@
 
 config X86_ALIGNMENT_16
 	bool
-	depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || X86_ELAN || MK6 || M586MMX || M586TSC || M586 || M486 || MVIAC3_2
+	depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || X86_ELAN || MK6 || M586MMX || M586TSC || M586 || M486 || MVIAC3_2 || MGEODE
 	default y
 
 config X86_GOOD_APIC
@@ -434,7 +442,7 @@
 
 config X86_OOSTORE
 	bool
-	depends on (MWINCHIP3D || MWINCHIP2 || MWINCHIPC6) && MTRR
+	depends on (MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MGEODE) && MTRR
 	default y
 
 config HPET_TIMER
@@ -570,7 +578,7 @@
 
 config X86_TSC
 	bool
-	depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2) && !X86_NUMAQ
+	depends on (MWINCHIP3D || MWINCHIP2 || MCRUSOE || MEFFICEON || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || MK8 || MVIAC3_2 || MGEODE) && !X86_NUMAQ
 	default y
 
 config X86_MCE
@@ -887,6 +895,23 @@
 	This feature is only enabled for gcc-3.0 and later - earlier compilers
 	generate incorrect output with certain kernel constructs when
 	-mregparm=3 is used.
+
+config SECCOMP
+	bool "Enable seccomp to safely compute untrusted bytecode"
+	depends on PROC_FS
+	default y
+	help
+	  This kernel feature is useful for number crunching applications
+	  that may need to compute untrusted bytecode during their
+	  execution. By using pipes or other transports made available to
+	  the process as file descriptors supporting the read/write
+	  syscalls, it's possible to isolate those applications in
+	  their own address space using seccomp. Once seccomp is
+	  enabled via /proc/<pid>/seccomp, it cannot be disabled
+	  and the task is only allowed to execute a few safe syscalls
+	  defined by each seccomp mode.
+
+	  If unsure, say Y. Only embedded should say N here.
 
 endmenu
 
diff -Nru a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug
--- a/arch/i386/Kconfig.debug	2004-10-20 01:37:19 -07:00
+++ b/arch/i386/Kconfig.debug	2005-03-07 20:41:32 -08:00
@@ -38,9 +38,12 @@
 
 	  This option will slow down process creation somewhat.
 
+comment "Page alloc debug is incompatible with Software Suspend on i386"
+	depends on DEBUG_KERNEL && SOFTWARE_SUSPEND
+
 config DEBUG_PAGEALLOC
 	bool "Page alloc debugging"
-	depends on DEBUG_KERNEL
+	depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
 	help
 	  Unmap pages from the kernel linear mapping after free_pages().
 	  This results in a large slowdown, but helps to find certain types
diff -Nru a/arch/i386/Makefile b/arch/i386/Makefile
--- a/arch/i386/Makefile	2004-12-24 13:09:47 -08:00
+++ b/arch/i386/Makefile	2005-03-07 20:41:30 -08:00
@@ -14,6 +14,8 @@
 # 19990713  Artur Skawina <skawina@geocities.com>
 #           Added '-march' and '-mpreferred-stack-boundary' support
 #
+#           Kianusch Sayah Karadji <kianusch@sk-tech.net>
+#           Added support for GEODE CPU
 
 LDFLAGS		:= -m elf_i386
 OBJCOPYFLAGS	:= -O binary -R .note -R .comment -S
@@ -51,6 +53,9 @@
 
 # AMD Elan support
 cflags-$(CONFIG_X86_ELAN)	+= -march=i486
+
+# MediaGX aka Geode support
+cflags-$(CONFIG_MGEODE)		+= $(call cc-option,-march=pentium-mmx,-march=i586)
 
 # -mregparm=3 works ok on gcc-3.0 and later
 #
diff -Nru a/arch/i386/defconfig b/arch/i386/defconfig
--- a/arch/i386/defconfig	2004-11-27 03:20:13 -08:00
+++ b/arch/i386/defconfig	2005-02-22 16:55:59 -08:00
@@ -802,7 +802,6 @@
 # CONFIG_AGP_AMD is not set
 # CONFIG_AGP_AMD64 is not set
 CONFIG_AGP_INTEL=y
-CONFIG_AGP_INTEL_MCH=m
 # CONFIG_AGP_NVIDIA is not set
 # CONFIG_AGP_SIS is not set
 # CONFIG_AGP_SWORKS is not set
diff -Nru a/arch/i386/kernel/cpu/mtrr/centaur.c b/arch/i386/kernel/cpu/mtrr/centaur.c
--- a/arch/i386/kernel/cpu/mtrr/centaur.c	2002-11-27 22:45:37 -08:00
+++ b/arch/i386/kernel/cpu/mtrr/centaur.c	2005-03-07 20:41:31 -08:00
@@ -86,6 +86,8 @@
 	centaur_mcr[reg].low = low;
 	wrmsr(MSR_IDT_MCR0 + reg, low, high);
 }
+
+#if 0
 /*
  *	Initialise the later (saner) Winchip MCR variant. In this version
  *	the BIOS can pass us the registers it has used (but not their values)
@@ -183,6 +185,7 @@
 
 	set_mtrr_done(&ctxt);
 }
+#endif
 
 static int centaur_validate_add_page(unsigned long base, 
 				     unsigned long size, unsigned int type)
@@ -203,7 +206,7 @@
 
 static struct mtrr_ops centaur_mtrr_ops = {
 	.vendor            = X86_VENDOR_CENTAUR,
-	.init              = centaur_mcr_init,
+//	.init              = centaur_mcr_init,
 	.set               = centaur_set_mcr,
 	.get               = centaur_get_mcr,
 	.get_free_region   = centaur_get_free_region,
diff -Nru a/arch/i386/kernel/cpu/mtrr/cyrix.c b/arch/i386/kernel/cpu/mtrr/cyrix.c
--- a/arch/i386/kernel/cpu/mtrr/cyrix.c	2003-07-15 10:05:00 -07:00
+++ b/arch/i386/kernel/cpu/mtrr/cyrix.c	2005-03-07 20:41:31 -08:00
@@ -218,12 +218,12 @@
 	mtrr_type type;
 } arr_state_t;
 
-arr_state_t arr_state[8] __initdata = {
+static arr_state_t arr_state[8] __initdata = {
 	{0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL},
 	{0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}, {0UL, 0UL, 0UL}
 };
 
-unsigned char ccr_state[7] __initdata = { 0, 0, 0, 0, 0, 0, 0 };
+static unsigned char ccr_state[7] __initdata = { 0, 0, 0, 0, 0, 0, 0 };
 
 static void cyrix_set_all(void)
 {
@@ -243,6 +243,7 @@
 	post_set();
 }
 
+#if 0
 /*
  * On Cyrix 6x86(MX) and M II the ARR3 is special: it has connection
  * with the SMM (System Management Mode) mode. So we need the following:
@@ -341,10 +342,11 @@
 	if (ccrc[6])
 		printk(KERN_INFO "mtrr: ARR3 was write protected, unprotected\n");
 }
+#endif
 
 static struct mtrr_ops cyrix_mtrr_ops = {
 	.vendor            = X86_VENDOR_CYRIX,
-	.init              = cyrix_arr_init,
+//	.init              = cyrix_arr_init,
 	.set_all	   = cyrix_set_all,
 	.set               = cyrix_set_arr,
 	.get               = cyrix_get_arr,
diff -Nru a/arch/i386/kernel/cpu/mtrr/generic.c b/arch/i386/kernel/cpu/mtrr/generic.c
--- a/arch/i386/kernel/cpu/mtrr/generic.c	2005-01-20 21:02:11 -08:00
+++ b/arch/i386/kernel/cpu/mtrr/generic.c	2005-03-07 20:41:31 -08:00
@@ -19,8 +19,7 @@
 };
 
 static unsigned long smp_changes_mask;
-struct mtrr_state mtrr_state = {};
-
+static struct mtrr_state mtrr_state = {};
 
 /*  Get the MSR pair relating to a var range  */
 static void __init
@@ -383,7 +382,7 @@
 }
 
 
-int generic_have_wrcomb(void)
+static int generic_have_wrcomb(void)
 {
 	unsigned long config, dummy;
 	rdmsr(MTRRcap_MSR, config, dummy);
diff -Nru a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
--- a/arch/i386/kernel/cpu/mtrr/main.c	2004-11-15 19:29:12 -08:00
+++ b/arch/i386/kernel/cpu/mtrr/main.c	2005-03-07 20:41:31 -08:00
@@ -57,10 +57,6 @@
 
 struct mtrr_ops * mtrr_if = NULL;
 
-__initdata char *mtrr_if_name[] = {
-    "none", "Intel", "AMD K6", "Cyrix ARR", "Centaur MCR"
-};
-
 static void set_mtrr(unsigned int reg, unsigned long base,
 		     unsigned long size, mtrr_type type);
 
@@ -100,7 +96,7 @@
 }
 
 /*  This function returns the number of variable MTRRs  */
-void __init set_num_var_ranges(void)
+static void __init set_num_var_ranges(void)
 {
 	unsigned long config = 0, dummy;
 
diff -Nru a/arch/i386/kernel/cpu/mtrr/mtrr.h b/arch/i386/kernel/cpu/mtrr/mtrr.h
--- a/arch/i386/kernel/cpu/mtrr/mtrr.h	2004-08-23 01:14:59 -07:00
+++ b/arch/i386/kernel/cpu/mtrr/mtrr.h	2005-03-07 20:41:31 -08:00
@@ -37,7 +37,7 @@
 struct mtrr_ops {
 	u32	vendor;
 	u32	use_intel_if;
-	void	(*init)(void);
+//	void	(*init)(void);
 	void	(*set)(unsigned int reg, unsigned long base,
 		       unsigned long size, mtrr_type type);
 	void	(*set_all)(void);
@@ -57,7 +57,6 @@
 
 extern struct mtrr_ops generic_mtrr_ops;
 
-extern int generic_have_wrcomb(void);
 extern int positive_have_wrcomb(void);
 
 /* library functions for processor-specific routines */
@@ -96,4 +95,3 @@
 void mtrr_state_warn(void);
 char *mtrr_attrib_to_str(int x);
 
-extern char * mtrr_if_name[];
diff -Nru a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
--- a/arch/i386/kernel/entry.S	2005-01-30 22:33:48 -08:00
+++ b/arch/i386/kernel/entry.S	2005-03-07 20:41:40 -08:00
@@ -219,7 +219,8 @@
 	SAVE_ALL
 	GET_THREAD_INFO(%ebp)
 
-	testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
+	/* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
+	testw $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),TI_flags(%ebp)
 	jnz syscall_trace_entry
 	cmpl $(nr_syscalls), %eax
 	jae syscall_badsys
@@ -243,7 +244,8 @@
 	SAVE_ALL
 	GET_THREAD_INFO(%ebp)
 					# system call tracing in operation
-	testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%ebp)
+	/* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
+	testw $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),TI_flags(%ebp)
 	jnz syscall_trace_entry
 	cmpl $(nr_syscalls), %eax
 	jae syscall_badsys
diff -Nru a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
--- a/arch/i386/kernel/i386_ksyms.c	2005-01-15 14:01:45 -08:00
+++ b/arch/i386/kernel/i386_ksyms.c	2005-03-05 16:26:28 -08:00
@@ -97,6 +97,11 @@
 EXPORT_SYMBOL(__get_user_2);
 EXPORT_SYMBOL(__get_user_4);
 
+EXPORT_SYMBOL(__put_user_1);
+EXPORT_SYMBOL(__put_user_2);
+EXPORT_SYMBOL(__put_user_4);
+EXPORT_SYMBOL(__put_user_8);
+
 EXPORT_SYMBOL(strpbrk);
 EXPORT_SYMBOL(strstr);
 
diff -Nru a/arch/i386/kernel/i8259.c b/arch/i386/kernel/i8259.c
--- a/arch/i386/kernel/i8259.c	2005-01-20 21:02:11 -08:00
+++ b/arch/i386/kernel/i8259.c	2005-03-07 20:41:30 -08:00
@@ -58,14 +58,13 @@
 }
 
 static struct hw_interrupt_type i8259A_irq_type = {
-	"XT-PIC",
-	startup_8259A_irq,
-	shutdown_8259A_irq,
-	enable_8259A_irq,
-	disable_8259A_irq,
-	mask_and_ack_8259A,
-	end_8259A_irq,
-	NULL
+	.typename = "XT-PIC",
+	.startup = startup_8259A_irq,
+	.shutdown = shutdown_8259A_irq,
+	.enable = enable_8259A_irq,
+	.disable = disable_8259A_irq,
+	.ack = mask_and_ack_8259A,
+	.end = end_8259A_irq,
 };
 
 /*
diff -Nru a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
--- a/arch/i386/kernel/process.c	2005-01-30 22:20:14 -08:00
+++ b/arch/i386/kernel/process.c	2005-03-04 22:41:13 -08:00
@@ -36,6 +36,7 @@
 #include <linux/module.h>
 #include <linux/kallsyms.h>
 #include <linux/ptrace.h>
+#include <linux/random.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -828,3 +829,9 @@
 	return 0;
 }
 
+unsigned long arch_align_stack(unsigned long sp)
+{
+	if (randomize_va_space)
+		sp -= get_random_int() % 8192;
+	return sp & ~0xf;
+}
diff -Nru a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
--- a/arch/i386/kernel/ptrace.c	2005-01-30 22:20:14 -08:00
+++ b/arch/i386/kernel/ptrace.c	2005-03-07 20:41:40 -08:00
@@ -15,6 +15,7 @@
 #include <linux/user.h>
 #include <linux/security.h>
 #include <linux/audit.h>
+#include <linux/seccomp.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -678,6 +679,9 @@
 __attribute__((regparm(3)))
 void do_syscall_trace(struct pt_regs *regs, int entryexit)
 {
+	/* do the secure computing check first */
+	secure_computing(regs->orig_eax);
+
 	if (unlikely(current->audit_context)) {
 		if (!entryexit)
 			audit_syscall_entry(current, regs->orig_eax,
diff -Nru a/arch/i386/kernel/scx200.c b/arch/i386/kernel/scx200.c
--- a/arch/i386/kernel/scx200.c	2005-01-20 21:02:11 -08:00
+++ b/arch/i386/kernel/scx200.c	2005-03-07 20:41:30 -08:00
@@ -13,6 +13,9 @@
 
 #include <linux/scx200.h>
 
+/* Verify that the configuration block really is there */
+#define scx200_cb_probe(base) (inw((base) + SCx200_CBA) == (base))
+
 #define NAME "scx200"
 
 MODULE_AUTHOR("Christer Weinigel <wingel@nano-system.com>");
@@ -22,9 +25,13 @@
 unsigned scx200_gpio_base = 0;
 long scx200_gpio_shadow[2];
 
+unsigned scx200_cb_base = 0;
+
 static struct pci_device_id scx200_tbl[] = {
 	{ PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_XBUS)   },
+	{ PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_XBUS)   },
 	{ },
 };
 MODULE_DEVICE_TABLE(pci,scx200_tbl);
@@ -45,22 +52,39 @@
 	int bank;
 	unsigned base;
 
-	base = pci_resource_start(pdev, 0);
-	printk(KERN_INFO NAME ": GPIO base 0x%x\n", base);
-
-	if (request_region(base, SCx200_GPIO_SIZE, "NatSemi SCx200 GPIO") == 0) {
-		printk(KERN_ERR NAME ": can't allocate I/O for GPIOs\n");
-		return -EBUSY;
+	if (pdev->device == PCI_DEVICE_ID_NS_SCx200_BRIDGE ||
+	    pdev->device == PCI_DEVICE_ID_NS_SC1100_BRIDGE) {
+		base = pci_resource_start(pdev, 0);
+		printk(KERN_INFO NAME ": GPIO base 0x%x\n", base);
+
+		if (request_region(base, SCx200_GPIO_SIZE, "NatSemi SCx200 GPIO") == 0) {
+			printk(KERN_ERR NAME ": can't allocate I/O for GPIOs\n");
+			return -EBUSY;
+		}
+
+		scx200_gpio_base = base;
+
+		/* read the current values driven on the GPIO signals */
+		for (bank = 0; bank < 2; ++bank)
+			scx200_gpio_shadow[bank] = inl(scx200_gpio_base + 0x10 * bank);
+
+	} else {
+		/* find the base of the Configuration Block */
+		if (scx200_cb_probe(SCx200_CB_BASE_FIXED)) {
+			scx200_cb_base = SCx200_CB_BASE_FIXED;
+		} else {
+			pci_read_config_dword(pdev, SCx200_CBA_SCRATCH, &base);
+			if (scx200_cb_probe(base)) {
+				scx200_cb_base = base;
+			} else {
+				printk(KERN_WARNING NAME ": Configuration Block not found\n");
+				return -ENODEV;
+			}
+		}
+		printk(KERN_INFO NAME ": Configuration Block base 0x%x\n", scx200_cb_base);
 	}
 
-	scx200_gpio_base = base;
-
-	/* read the current values driven on the GPIO signals */
-	for (bank = 0; bank < 2; ++bank)
-		scx200_gpio_shadow[bank] = inl(scx200_gpio_base + 0x10 * bank);
-
 	return 0;
-
 }
 
 u32 scx200_gpio_configure(int index, u32 mask, u32 bits)
@@ -134,6 +158,7 @@
 EXPORT_SYMBOL(scx200_gpio_lock);
 EXPORT_SYMBOL(scx200_gpio_configure);
 EXPORT_SYMBOL(scx200_gpio_dump);
+EXPORT_SYMBOL(scx200_cb_base);
 
 /*
     Local variables:
diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
--- a/arch/i386/kernel/setup.c	2005-02-20 12:51:09 -08:00
+++ b/arch/i386/kernel/setup.c	2005-03-07 20:41:29 -08:00
@@ -951,8 +951,6 @@
 	return max_low_pfn;
 }
 
-#ifndef CONFIG_DISCONTIGMEM
-
 /*
  * Free all available memory for boot time allocation.  Used
  * as a callback function by efi_memory_walk()
@@ -1026,15 +1024,15 @@
 		reserve_bootmem(addr, PAGE_SIZE);	
 }
 
+#ifndef CONFIG_DISCONTIGMEM
+void __init setup_bootmem_allocator(void);
 static unsigned long __init setup_memory(void)
 {
-	unsigned long bootmap_size, start_pfn, max_low_pfn;
-
 	/*
 	 * partially used pages are not usable - thus
 	 * we are rounding upwards:
 	 */
-	start_pfn = PFN_UP(init_pg_tables_end);
+	min_low_pfn = PFN_UP(init_pg_tables_end);
 
 	find_max_pfn();
 
@@ -1050,10 +1048,22 @@
 #endif
 	printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
 			pages_to_mb(max_low_pfn));
+
+	setup_bootmem_allocator();
+
+	return max_low_pfn;
+}
+#else
+extern unsigned long setup_memory(void);
+#endif /* !CONFIG_DISCONTIGMEM */
+
+void __init setup_bootmem_allocator(void)
+{
+	unsigned long bootmap_size;
 	/*
 	 * Initialize the boot-time allocator (with low memory only):
 	 */
-	bootmap_size = init_bootmem(start_pfn, max_low_pfn);
+	bootmap_size = init_bootmem(min_low_pfn, max_low_pfn);
 
 	register_bootmem_low_pages(max_low_pfn);
 
@@ -1063,7 +1073,7 @@
 	 * the (very unlikely) case of us accidentally initializing the
 	 * bootmem allocator with an invalid RAM area.
 	 */
-	reserve_bootmem(HIGH_MEMORY, (PFN_PHYS(start_pfn) +
+	reserve_bootmem(HIGH_MEMORY, (PFN_PHYS(min_low_pfn) +
 			 bootmap_size + PAGE_SIZE-1) - (HIGH_MEMORY));
 
 	/*
@@ -1120,11 +1130,7 @@
 		}
 	}
 #endif
-	return max_low_pfn;
 }
-#else
-extern unsigned long setup_memory(void);
-#endif /* !CONFIG_DISCONTIGMEM */
 
 /*
  * Request address space for all standard RAM and ROM resources
diff -Nru a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
--- a/arch/i386/kernel/signal.c	2005-01-30 22:20:14 -08:00
+++ b/arch/i386/kernel/signal.c	2005-03-06 12:36:41 -08:00
@@ -277,6 +277,18 @@
 {
 	int tmp, err = 0;
 
+	/*
+	 * If TF is set due to a debugger (PT_DTRACE), clear the TF
+	 * flag so that register information in the sigcontext is
+	 * correct.
+	 */
+	if (unlikely(regs->eflags & TF_MASK)) {
+		if (likely(current->ptrace & PT_DTRACE)) {
+			current->ptrace &= ~PT_DTRACE;
+			regs->eflags &= ~TF_MASK;
+		}
+	}
+
 	tmp = 0;
 	__asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
 	err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
--- a/arch/i386/kernel/time.c	2005-01-20 21:02:11 -08:00
+++ b/arch/i386/kernel/time.c	2005-03-07 20:41:35 -08:00
@@ -89,6 +89,35 @@
 struct timer_opts *cur_timer = &timer_none;
 
 /*
+ * This is a special lock that is owned by the CPU and holds the index
+ * register we are working with.  It is required for NMI access to the
+ * CMOS/RTC registers.  See include/asm-i386/mc146818rtc.h for details.
+ */
+volatile unsigned long cmos_lock = 0;
+EXPORT_SYMBOL(cmos_lock);
+
+/* Routines for accessing the CMOS RAM/RTC. */
+unsigned char rtc_cmos_read(unsigned char addr)
+{
+	unsigned char val;
+	lock_cmos_prefix(addr);
+	outb_p(addr, RTC_PORT(0));
+	val = inb_p(RTC_PORT(1));
+	lock_cmos_suffix(addr);
+	return val;
+}
+EXPORT_SYMBOL(rtc_cmos_read);
+
+void rtc_cmos_write(unsigned char val, unsigned char addr)
+{
+	lock_cmos_prefix(addr);
+	outb_p(addr, RTC_PORT(0));
+	outb_p(val, RTC_PORT(1));
+	lock_cmos_suffix(addr);
+}
+EXPORT_SYMBOL(rtc_cmos_write);
+
+/*
  * This version of gettimeofday has microsecond resolution
  * and better than microsecond precision on fast x86 machines with TSC.
  */
@@ -250,16 +279,12 @@
 			>= USEC_AFTER - ((unsigned) TICK_SIZE) / 2 &&
 	    (xtime.tv_nsec / 1000)
 			<= USEC_BEFORE + ((unsigned) TICK_SIZE) / 2) {
-		/* horrible...FIXME */
+	        last_rtc_update = xtime.tv_sec;
 		if (efi_enabled) {
-	 		if (efi_set_rtc_mmss(xtime.tv_sec) == 0)
-				last_rtc_update = xtime.tv_sec;
-			else
-				last_rtc_update = xtime.tv_sec - 600;
-		} else if (set_rtc_mmss(xtime.tv_sec) == 0)
-			last_rtc_update = xtime.tv_sec;
-		else
-			last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
+		    if (efi_set_rtc_mmss(xtime.tv_sec))
+			last_rtc_update -= 600;
+		} else if (set_rtc_mmss(xtime.tv_sec))
+			last_rtc_update -= 600;
 	}
 
 	if (MCA_bus) {
diff -Nru a/arch/i386/kernel/time_hpet.c b/arch/i386/kernel/time_hpet.c
--- a/arch/i386/kernel/time_hpet.c	2005-02-04 17:23:42 -08:00
+++ b/arch/i386/kernel/time_hpet.c	2005-03-07 20:41:31 -08:00
@@ -121,11 +121,16 @@
 	id = hpet_readl(HPET_ID);
 
 	/*
-	 * We are checking for value '1' or more in number field.
-	 * So, we are OK with HPET_EMULATE_RTC part too, where we need
-	 * to have atleast 2 timers.
+	 * We are checking for value '1' or more in number field if
+	 * CONFIG_HPET_EMULATE_RTC is set because we will need an
+	 * additional timer for RTC emulation.
+	 * However, we can do with one timer otherwise using the
+	 * the single HPET timer for system time.
 	 */
-	if (!(id & HPET_ID_NUMBER) ||
+	if (
+#ifdef CONFIG_HPET_EMULATE_RTC
+		!(id & HPET_ID_NUMBER) ||
+#endif
 	    !(id & HPET_ID_LEGSUP))
 		return -1;
 
diff -Nru a/arch/i386/lib/Makefile b/arch/i386/lib/Makefile
--- a/arch/i386/lib/Makefile	2004-06-17 23:55:22 -07:00
+++ b/arch/i386/lib/Makefile	2005-03-05 16:26:28 -08:00
@@ -3,7 +3,7 @@
 #
 
 
-lib-y = checksum.o delay.o usercopy.o getuser.o memcpy.o strstr.o \
+lib-y = checksum.o delay.o usercopy.o getuser.o putuser.o memcpy.o strstr.o \
 	bitops.o
 
 lib-$(CONFIG_X86_USE_3DNOW) += mmx.o
diff -Nru a/arch/i386/lib/putuser.S b/arch/i386/lib/putuser.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/i386/lib/putuser.S	2005-03-05 16:26:28 -08:00
@@ -0,0 +1,87 @@
+/*
+ * __put_user functions.
+ *
+ * (C) Copyright 2005 Linus Torvalds
+ *
+ * These functions have a non-standard call interface
+ * to make them more efficient, especially as they
+ * return an error value in addition to the "real"
+ * return value.
+ */
+#include <asm/thread_info.h>
+
+
+/*
+ * __put_user_X
+ *
+ * Inputs:	%eax[:%edx] contains the data
+ *		%ecx contains the address
+ *
+ * Outputs:	%eax is error code (0 or -EFAULT)
+ *
+ * These functions should not modify any other registers,
+ * as they get called from within inline assembly.
+ */
+
+#define ENTER	pushl %ebx ; GET_THREAD_INFO(%ebx)
+#define EXIT	popl %ebx ; ret
+
+.text
+.align 4
+.globl __put_user_1
+__put_user_1:
+	ENTER
+	cmpl TI_addr_limit(%ebx),%ecx
+	jae bad_put_user
+1:	movb %al,(%ecx)
+	xorl %eax,%eax
+	EXIT
+
+.align 4
+.globl __put_user_2
+__put_user_2:
+	ENTER
+	movl TI_addr_limit(%ebx),%ebx
+	subl $1,%ebx
+	cmpl %ebx,%ecx
+	jae bad_put_user
+2:	movw %ax,(%ecx)
+	xorl %eax,%eax
+	EXIT
+
+.align 4
+.globl __put_user_4
+__put_user_4:
+	ENTER
+	movl TI_addr_limit(%ebx),%ebx
+	subl $3,%ebx
+	cmpl %ebx,%ecx
+	jae bad_put_user
+3:	movl %eax,(%ecx)
+	xorl %eax,%eax
+	EXIT
+
+.align 4
+.globl __put_user_8
+__put_user_8:
+	ENTER
+	movl TI_addr_limit(%ebx),%ebx
+	subl $7,%ebx
+	cmpl %ebx,%ecx
+	jae bad_put_user
+4:	movl %eax,(%ecx)
+5:	movl %edx,4(%ecx)
+	xorl %eax,%eax
+	EXIT
+
+bad_put_user:
+	movl $-14,%eax
+	EXIT
+
+.section __ex_table,"a"
+	.long 1b,bad_put_user
+	.long 2b,bad_put_user
+	.long 3b,bad_put_user
+	.long 4b,bad_put_user
+	.long 5b,bad_put_user
+.previous
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	2005-01-24 14:37:49 -08:00
+++ b/arch/i386/mach-voyager/voyager_smp.c	2005-03-07 20:41:30 -08:00
@@ -210,14 +210,14 @@
  * 8259 IRQs except that masks and things must be kept per processor
  */
 static struct hw_interrupt_type vic_irq_type = {
-	"VIC-level",
-	startup_vic_irq,	/* startup */
-	disable_vic_irq,	/* shutdown */
-	enable_vic_irq,		/* enable */
-	disable_vic_irq,	/* disable */
-	before_handle_vic_irq,	/* ack */
-	after_handle_vic_irq,	/* end */
-	set_vic_irq_affinity,	/* affinity */
+	.typename = "VIC-level",
+	.startup = startup_vic_irq,
+	.shutdown = disable_vic_irq,
+	.enable = enable_vic_irq,
+	.disable = disable_vic_irq,
+	.ack = before_handle_vic_irq,
+	.end = after_handle_vic_irq,
+	.set_affinity = set_vic_irq_affinity,
 };
 
 /* used to count up as CPUs are brought on line (starts at 0) */
diff -Nru a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c
--- a/arch/i386/mm/discontig.c	2005-01-07 21:44:03 -08:00
+++ b/arch/i386/mm/discontig.c	2005-03-07 20:41:29 -08:00
@@ -137,46 +137,6 @@
 	}
 }
 
-/*
- * Register fully available low RAM pages with the bootmem allocator.
- */
-static void __init register_bootmem_low_pages(unsigned long system_max_low_pfn)
-{
-	int i;
-
-	for (i = 0; i < e820.nr_map; i++) {
-		unsigned long curr_pfn, last_pfn, size;
-		/*
-		 * Reserve usable low memory
-		 */
-		if (e820.map[i].type != E820_RAM)
-			continue;
-		/*
-		 * We are rounding up the start address of usable memory:
-		 */
-		curr_pfn = PFN_UP(e820.map[i].addr);
-		if (curr_pfn >= system_max_low_pfn)
-			continue;
-		/*
-		 * ... and at the end of the usable range downwards:
-		 */
-		last_pfn = PFN_DOWN(e820.map[i].addr + e820.map[i].size);
-
-		if (last_pfn > system_max_low_pfn)
-			last_pfn = system_max_low_pfn;
-
-		/*
-		 * .. finally, did all the rounding and playing
-		 * around just make the area go away?
-		 */
-		if (last_pfn <= curr_pfn)
-			continue;
-
-		size = last_pfn - curr_pfn;
-		free_bootmem_node(NODE_DATA(0), PFN_PHYS(curr_pfn), PFN_PHYS(size));
-	}
-}
-
 void __init remap_numa_kva(void)
 {
 	void *vaddr;
@@ -203,6 +163,15 @@
 	for_each_online_node(nid) {
 		if (nid == 0)
 			continue;
+		/*
+		 * The acpi/srat node info can show hot-add memroy zones
+		 * where memory could be added but not currently present.
+		 */
+		if (node_start_pfn[nid] > max_pfn)
+			continue;
+		if (node_end_pfn[nid] > max_pfn)
+			node_end_pfn[nid] = max_pfn;
+
 		/* calculate the size of the mem_map needed in bytes */
 		size = (node_end_pfn[nid] - node_start_pfn[nid] + 1) 
 			* sizeof(struct page) + sizeof(pg_data_t);
@@ -225,21 +194,11 @@
 	return reserve_pages;
 }
 
-/*
- * workaround for Dell systems that neglect to reserve EBDA
- */
-static void __init reserve_ebda_region_node(void)
-{
-	unsigned int addr;
-	addr = get_bios_ebda();
-	if (addr)
-		reserve_bootmem_node(NODE_DATA(0), addr, PAGE_SIZE);
-}
-
+extern void setup_bootmem_allocator(void);
 unsigned long __init setup_memory(void)
 {
 	int nid;
-	unsigned long bootmap_size, system_start_pfn, system_max_low_pfn;
+	unsigned long system_start_pfn, system_max_low_pfn;
 	unsigned long reserve_pages, pfn;
 
 	/*
@@ -265,12 +224,12 @@
 		printk("\n");
 	}
 
+	find_max_pfn();
 	reserve_pages = calculate_numa_remap_pages();
 
 	/* partially used pages are not usable - thus round upwards */
 	system_start_pfn = min_low_pfn = PFN_UP(init_pg_tables_end);
 
-	find_max_pfn();
 	system_max_low_pfn = max_low_pfn = find_max_low_pfn() - reserve_pages;
 	printk("reserve_pages = %ld find_max_low_pfn() ~ %ld\n",
 			reserve_pages, max_low_pfn + reserve_pages);
@@ -305,69 +264,8 @@
 		find_max_pfn_node(nid);
 
 	NODE_DATA(0)->bdata = &node0_bdata;
-
-	/*
-	 * Initialize the boot-time allocator (with low memory only):
-	 */
-	bootmap_size = init_bootmem_node(NODE_DATA(0), min_low_pfn, 0, system_max_low_pfn);
-
-	register_bootmem_low_pages(system_max_low_pfn);
-
-	/*
-	 * Reserve the bootmem bitmap itself as well. We do this in two
-	 * steps (first step was init_bootmem()) because this catches
-	 * the (very unlikely) case of us accidentally initializing the
-	 * bootmem allocator with an invalid RAM area.
-	 */
-	reserve_bootmem_node(NODE_DATA(0), HIGH_MEMORY, (PFN_PHYS(min_low_pfn) +
-		 bootmap_size + PAGE_SIZE-1) - (HIGH_MEMORY));
-
-	/*
-	 * reserve physical page 0 - it's a special BIOS page on many boxes,
-	 * enabling clean reboots, SMP operation, laptop functions.
-	 */
-	reserve_bootmem_node(NODE_DATA(0), 0, PAGE_SIZE);
-
-	/*
-	 * But first pinch a few for the stack/trampoline stuff
-	 * FIXME: Don't need the extra page at 4K, but need to fix
-	 * trampoline before removing it. (see the GDT stuff)
-	 */
-	reserve_bootmem_node(NODE_DATA(0), PAGE_SIZE, PAGE_SIZE);
-
-	/* reserve EBDA region, it's a 4K region */
-	reserve_ebda_region_node();
-
-#ifdef CONFIG_ACPI_SLEEP
-	/*
-	 * Reserve low memory region for sleep support.
-	 */
-	acpi_reserve_bootmem();
-#endif
-
-	/*
-	 * Find and reserve possible boot-time SMP configuration:
-	 */
-	find_smp_config();
-
-#ifdef CONFIG_BLK_DEV_INITRD
-	if (LOADER_TYPE && INITRD_START) {
-		if (INITRD_START + INITRD_SIZE <= (system_max_low_pfn << PAGE_SHIFT)) {
-			reserve_bootmem_node(NODE_DATA(0), INITRD_START, INITRD_SIZE);
-			initrd_start =
-				INITRD_START ? INITRD_START + PAGE_OFFSET : 0;
-			initrd_end = initrd_start+INITRD_SIZE;
-		}
-		else {
-			printk(KERN_ERR "initrd extends beyond end of memory "
-			    "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
-			    INITRD_START + INITRD_SIZE,
-			    system_max_low_pfn << PAGE_SHIFT);
-			initrd_start = 0;
-		}
-	}
-#endif
-	return system_max_low_pfn;
+	setup_bootmem_allocator();
+	return max_low_pfn;
 }
 
 void __init zone_sizes_init(void)
@@ -464,14 +362,5 @@
 		}
 	}
 	totalram_pages += totalhigh_pages;
-#endif
-}
-
-void __init set_max_mapnr_init(void)
-{
-#ifdef CONFIG_HIGHMEM
-	num_physpages = highend_pfn;
-#else
-	num_physpages = max_low_pfn;
 #endif
 }
diff -Nru a/arch/i386/mm/highmem.c b/arch/i386/mm/highmem.c
--- a/arch/i386/mm/highmem.c	2005-01-03 15:49:15 -08:00
+++ b/arch/i386/mm/highmem.c	2005-02-23 15:40:52 -08:00
@@ -66,7 +66,7 @@
 	 * force other mappings to Oops if they'll try to access
 	 * this pte without first remap it
 	 */
-	pte_clear(kmap_pte-idx);
+	pte_clear(&init_mm, vaddr, kmap_pte-idx);
 	__flush_tlb_one(vaddr);
 #endif
 
diff -Nru a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c
--- a/arch/i386/mm/hugetlbpage.c	2004-12-22 01:31:49 -08:00
+++ b/arch/i386/mm/hugetlbpage.c	2005-02-23 15:40:52 -08:00
@@ -216,7 +216,7 @@
 	BUG_ON(end & (HPAGE_SIZE - 1));
 
 	for (address = start; address < end; address += HPAGE_SIZE) {
-		pte = ptep_get_and_clear(huge_pte_offset(mm, address));
+		pte = ptep_get_and_clear(mm, address, huge_pte_offset(mm, address));
 		if (pte_none(pte))
 			continue;
 		page = pte_page(pte);
diff -Nru a/arch/i386/mm/init.c b/arch/i386/mm/init.c
--- a/arch/i386/mm/init.c	2005-01-03 15:50:32 -08:00
+++ b/arch/i386/mm/init.c	2005-03-07 20:41:30 -08:00
@@ -548,20 +548,17 @@
 	}
 }
 
-#ifndef CONFIG_DISCONTIGMEM
 static void __init set_max_mapnr_init(void)
 {
 #ifdef CONFIG_HIGHMEM
-	max_mapnr = num_physpages = highend_pfn;
+	num_physpages = highend_pfn;
 #else
-	max_mapnr = num_physpages = max_low_pfn;
+	num_physpages = max_low_pfn;
+#endif
+#ifndef CONFIG_DISCONTIGMEM
+	max_mapnr = num_physpages;
 #endif
 }
-#define __free_all_bootmem() free_all_bootmem()
-#else
-#define __free_all_bootmem() free_all_bootmem_node(NODE_DATA(0))
-extern void set_max_mapnr_init(void);
-#endif /* !CONFIG_DISCONTIGMEM */
 
 static struct kcore_list kcore_mem, kcore_vmalloc; 
 
@@ -592,13 +589,13 @@
 	set_max_mapnr_init();
 
 #ifdef CONFIG_HIGHMEM
-	high_memory = (void *) __va(highstart_pfn * PAGE_SIZE);
+	high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
 #else
-	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
+	high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
 #endif
 
 	/* this will put all low memory onto the freelists */
-	totalram_pages += __free_all_bootmem();
+	totalram_pages += free_all_bootmem();
 
 	reservedpages = 0;
 	for (tmp = 0; tmp < max_low_pfn; tmp++)
diff -Nru a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c
--- a/arch/i386/mm/ioremap.c	2005-01-23 10:29:03 -08:00
+++ b/arch/i386/mm/ioremap.c	2005-03-08 09:27:41 -08:00
@@ -17,6 +17,9 @@
 #include <asm/tlbflush.h>
 #include <asm/pgtable.h>
 
+#define ISA_START_ADDRESS	0xa0000
+#define ISA_END_ADDRESS		0x100000
+
 static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
 	unsigned long phys_addr, unsigned long flags)
 {
@@ -129,7 +132,7 @@
 	/*
 	 * Don't remap the low PCI/ISA area, it's always mapped..
 	 */
-	if (phys_addr >= 0xA0000 && last_addr < 0x100000)
+	if (phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS)
 		return (void __iomem *) phys_to_virt(phys_addr);
 
 	/*
@@ -230,7 +233,17 @@
 {
 	struct vm_struct *p;
 	if ((void __force *) addr <= high_memory) 
-		return; 
+		return;
+
+	/*
+	 * __ioremap special-cases the PCI/ISA range by not instantiating a
+	 * vm_area and by simply returning an address into the kernel mapping
+	 * of ISA space.   So handle that here.
+	 */
+	if (addr >= phys_to_virt(ISA_START_ADDRESS) &&
+			addr < phys_to_virt(ISA_END_ADDRESS))
+		return;
+
 	p = remove_vm_area((void *) (PAGE_MASK & (unsigned long __force) addr));
 	if (!p) { 
 		printk("__iounmap: bad address %p\n", addr);
@@ -240,8 +253,8 @@
 	if ((p->flags >> 20) && p->phys_addr < virt_to_phys(high_memory) - 1) {
 		/* p->size includes the guard page, but cpa doesn't like that */
 		change_page_attr(virt_to_page(__va(p->phys_addr)),
-				 (p->size - PAGE_SIZE) >> PAGE_SHIFT,
-				 PAGE_KERNEL); 				 
+				 p->size >> PAGE_SHIFT,
+				 PAGE_KERNEL);
 		global_flush_tlb();
 	} 
 	kfree(p); 
@@ -261,7 +274,7 @@
 	/*
 	 * Don't remap the low PCI/ISA area, it's always mapped..
 	 */
-	if (phys_addr >= 0xA0000 && last_addr < 0x100000)
+	if (phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS)
 		return phys_to_virt(phys_addr);
 
 	/*
diff -Nru a/arch/i386/mm/mmap.c b/arch/i386/mm/mmap.c
--- a/arch/i386/mm/mmap.c	2004-10-18 22:26:36 -07:00
+++ b/arch/i386/mm/mmap.c	2005-03-04 22:41:14 -08:00
@@ -26,6 +26,7 @@
 
 #include <linux/personality.h>
 #include <linux/mm.h>
+#include <linux/random.h>
 
 /*
  * Top of mmap area (just below the process stack).
@@ -38,13 +39,17 @@
 static inline unsigned long mmap_base(struct mm_struct *mm)
 {
 	unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
+	unsigned long random_factor = 0;
+
+	if (current->flags & PF_RANDOMIZE)
+		random_factor = get_random_int() % (1024*1024);
 
 	if (gap < MIN_GAP)
 		gap = MIN_GAP;
 	else if (gap > MAX_GAP)
 		gap = MAX_GAP;
 
-	return TASK_SIZE - (gap & PAGE_MASK);
+	return PAGE_ALIGN(TASK_SIZE - gap - random_factor);
 }
 
 /*
diff -Nru a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c
--- a/arch/i386/pci/acpi.c	2004-10-18 21:44:01 -07:00
+++ b/arch/i386/pci/acpi.c	2005-02-22 18:53:24 -08:00
@@ -37,21 +37,12 @@
 		 * also do it here in case there are still broken drivers that
 		 * don't use pci_enable_device().
 		 */
-		printk(KERN_INFO "** Routing PCI interrupts for all devices because \"pci=routeirq\"\n");
-		printk(KERN_INFO "** was specified.  If this was required to make a driver work,\n");
-		printk(KERN_INFO "** please email the output of \"lspci\" to bjorn.helgaas@hp.com\n");
-		printk(KERN_INFO "** so I can fix the driver.\n");
+		printk(KERN_INFO "PCI: Routing PCI interrupts for all devices because \"pci=routeirq\" specified\n");
 		while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL)
 			acpi_pci_irq_enable(dev);
-	} else {
-		printk(KERN_INFO "** PCI interrupts are no longer routed automatically.  If this\n");
-		printk(KERN_INFO "** causes a device to stop working, it is probably because the\n");
-		printk(KERN_INFO "** driver failed to call pci_enable_device().  As a temporary\n");
-		printk(KERN_INFO "** workaround, the \"pci=routeirq\" argument restores the old\n");
-		printk(KERN_INFO "** behavior.  If this argument makes the device work again,\n");
-		printk(KERN_INFO "** please email the output of \"lspci\" to bjorn.helgaas@hp.com\n");
-		printk(KERN_INFO "** so I can fix the driver.\n");
-	}
+	} else
+		printk(KERN_INFO "PCI: If a device doesn't work, try \"pci=routeirq\".  If it helps, post a report\n");
+
 #ifdef CONFIG_X86_IO_APIC
 	if (acpi_ioapic)
 		print_IO_APIC();
diff -Nru a/arch/i386/pci/direct.c b/arch/i386/pci/direct.c
--- a/arch/i386/pci/direct.c	2004-01-04 21:54:04 -08:00
+++ b/arch/i386/pci/direct.c	2005-02-03 10:08:21 -08:00
@@ -13,7 +13,8 @@
 #define PCI_CONF1_ADDRESS(bus, devfn, reg) \
 	(0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
 
-static int pci_conf1_read (int seg, int bus, int devfn, int reg, int len, u32 *value)
+static int pci_conf1_read(unsigned int seg, unsigned int bus,
+			  unsigned int devfn, int reg, int len, u32 *value)
 {
 	unsigned long flags;
 
@@ -41,7 +42,8 @@
 	return 0;
 }
 
-static int pci_conf1_write (int seg, int bus, int devfn, int reg, int len, u32 value)
+static int pci_conf1_write(unsigned int seg, unsigned int bus,
+			   unsigned int devfn, int reg, int len, u32 value)
 {
 	unsigned long flags;
 
@@ -83,7 +85,8 @@
 
 #define PCI_CONF2_ADDRESS(dev, reg)	(u16)(0xC000 | (dev << 8) | reg)
 
-static int pci_conf2_read(int seg, int bus, int devfn, int reg, int len, u32 *value)
+static int pci_conf2_read(unsigned int seg, unsigned int bus,
+			  unsigned int devfn, int reg, int len, u32 *value)
 {
 	unsigned long flags;
 	int dev, fn;
@@ -121,7 +124,8 @@
 	return 0;
 }
 
-static int pci_conf2_write (int seg, int bus, int devfn, int reg, int len, u32 value)
+static int pci_conf2_write(unsigned int seg, unsigned int bus,
+			   unsigned int devfn, int reg, int len, u32 value)
 {
 	unsigned long flags;
 	int dev, fn;
diff -Nru a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
--- a/arch/i386/pci/irq.c	2005-01-10 17:29:40 -08:00
+++ b/arch/i386/pci/irq.c	2005-02-07 21:39:15 -08:00
@@ -1031,56 +1031,55 @@
 
 	pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
 	if (pin && !pcibios_lookup_irq(dev, 1) && !dev->irq) {
-		char *msg;
-		msg = "";
+		char *msg = "";
+
+		pin--;		/* interrupt pins are numbered starting from 1 */
+
 		if (io_apic_assign_pci_irqs) {
 			int irq;
 
-			if (pin) {
-				pin--;		/* interrupt pins are numbered starting from 1 */
-				irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin);
-				/*
-				 * Busses behind bridges are typically not listed in the MP-table.
-				 * In this case we have to look up the IRQ based on the parent bus,
-				 * parent slot, and pin number. The SMP code detects such bridged
-				 * busses itself so we should get into this branch reliably.
-				 */
-				temp_dev = dev;
-				while (irq < 0 && dev->bus->parent) { /* go back to the bridge */
-					struct pci_dev * bridge = dev->bus->self;
-
-					pin = (pin + PCI_SLOT(dev->devfn)) % 4;
-					irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
-							PCI_SLOT(bridge->devfn), pin);
-					if (irq >= 0)
-						printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n",
-							pci_name(bridge), 'A' + pin, irq);
-					dev = bridge;
-				}
-				dev = temp_dev;
-				if (irq >= 0) {
+			irq = IO_APIC_get_PCI_irq_vector(dev->bus->number, PCI_SLOT(dev->devfn), pin);
+			/*
+			 * Busses behind bridges are typically not listed in the MP-table.
+			 * In this case we have to look up the IRQ based on the parent bus,
+			 * parent slot, and pin number. The SMP code detects such bridged
+			 * busses itself so we should get into this branch reliably.
+			 */
+			temp_dev = dev;
+			while (irq < 0 && dev->bus->parent) { /* go back to the bridge */
+				struct pci_dev * bridge = dev->bus->self;
+
+				pin = (pin + PCI_SLOT(dev->devfn)) % 4;
+				irq = IO_APIC_get_PCI_irq_vector(bridge->bus->number, 
+						PCI_SLOT(bridge->devfn), pin);
+				if (irq >= 0)
+					printk(KERN_WARNING "PCI: using PPB %s[%c] to get irq %d\n",
+						pci_name(bridge), 'A' + pin, irq);
+				dev = bridge;
+			}
+			dev = temp_dev;
+			if (irq >= 0) {
 #ifdef CONFIG_PCI_MSI
-					if (!platform_legacy_irq(irq))
-						irq = IO_APIC_VECTOR(irq);
+				if (!platform_legacy_irq(irq))
+					irq = IO_APIC_VECTOR(irq);
 #endif
-					printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n",
-						pci_name(dev), 'A' + pin, irq);
-					dev->irq = irq;
-					return 0;
-				} else
-					msg = " Probably buggy MP table.";
-			}
+				printk(KERN_INFO "PCI->APIC IRQ transform: %s[%c] -> IRQ %d\n",
+					pci_name(dev), 'A' + pin, irq);
+				dev->irq = irq;
+				return 0;
+			} else
+				msg = " Probably buggy MP table.";
 		} else if (pci_probe & PCI_BIOS_IRQ_SCAN)
 			msg = "";
 		else
 			msg = " Please try using pci=biosirq.";
-			
+
 		/* With IDE legacy devices the IRQ lookup failure is not a problem.. */
 		if (dev->class >> 8 == PCI_CLASS_STORAGE_IDE && !(dev->class & 0x5))
 			return 0;
-			
+
 		printk(KERN_WARNING "PCI: No IRQ known for interrupt pin %c of device %s.%s\n",
-		       'A' + pin - 1, pci_name(dev), msg);
+		       'A' + pin, pci_name(dev), msg);
 	}
 	/* VIA bridges use interrupt line for apic/pci steering across
 	   the V-Link */
diff -Nru a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
--- a/arch/i386/pci/mmconfig.c	2004-11-29 11:13:05 -08:00
+++ b/arch/i386/pci/mmconfig.c	2005-02-03 10:08:21 -08:00
@@ -34,7 +34,8 @@
 	}
 }
 
-static int pci_mmcfg_read(int seg, int bus, int devfn, int reg, int len, u32 *value)
+static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
+			  unsigned int devfn, int reg, int len, u32 *value)
 {
 	unsigned long flags;
 
@@ -62,7 +63,8 @@
 	return 0;
 }
 
-static int pci_mmcfg_write(int seg, int bus, int devfn, int reg, int len, u32 value)
+static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
+			   unsigned int devfn, int reg, int len, u32 value)
 {
 	unsigned long flags;
 
diff -Nru a/arch/i386/pci/numa.c b/arch/i386/pci/numa.c
--- a/arch/i386/pci/numa.c	2005-01-20 20:58:10 -08:00
+++ b/arch/i386/pci/numa.c	2005-02-03 10:55:05 -08:00
@@ -14,11 +14,12 @@
 #define PCI_CONF1_MQ_ADDRESS(bus, devfn, reg) \
 	(0x80000000 | (BUS2LOCAL(bus) << 16) | (devfn << 8) | (reg & ~3))
 
-static int pci_conf1_mq_read (int seg, int bus, int devfn, int reg, int len, u32 *value)
+static int pci_conf1_mq_read(unsigned int seg, unsigned int bus,
+			     unsigned int devfn, int reg, int len, u32 *value)
 {
 	unsigned long flags;
 
-	if (!value || (bus > MAX_MP_BUSSES) || (devfn > 255) || (reg > 255))
+	if (!value || (bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255))
 		return -EINVAL;
 
 	spin_lock_irqsave(&pci_config_lock, flags);
@@ -42,11 +43,12 @@
 	return 0;
 }
 
-static int pci_conf1_mq_write (int seg, int bus, int devfn, int reg, int len, u32 value)
+static int pci_conf1_mq_write(unsigned int seg, unsigned int bus,
+			      unsigned int devfn, int reg, int len, u32 value)
 {
 	unsigned long flags;
 
-	if ((bus > MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) 
+	if ((bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255)) 
 		return -EINVAL;
 
 	spin_lock_irqsave(&pci_config_lock, flags);
diff -Nru a/arch/i386/pci/pcbios.c b/arch/i386/pci/pcbios.c
--- a/arch/i386/pci/pcbios.c	2005-01-14 15:07:29 -08:00
+++ b/arch/i386/pci/pcbios.c	2005-02-03 10:08:21 -08:00
@@ -172,7 +172,8 @@
 	return (int) (ret & 0xff00) >> 8;
 }
 
-static int pci_bios_read (int seg, int bus, int devfn, int reg, int len, u32 *value)
+static int pci_bios_read(unsigned int seg, unsigned int bus,
+			 unsigned int devfn, int reg, int len, u32 *value)
 {
 	unsigned long result = 0;
 	unsigned long flags;
@@ -227,7 +228,8 @@
 	return (int)((result & 0xff00) >> 8);
 }
 
-static int pci_bios_write (int seg, int bus, int devfn, int reg, int len, u32 value)
+static int pci_bios_write(unsigned int seg, unsigned int bus,
+			  unsigned int devfn, int reg, int len, u32 value)
 {
 	unsigned long result = 0;
 	unsigned long flags;
diff -Nru a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
--- a/arch/ia64/ia32/ia32_entry.S	2005-01-14 11:56:04 -08:00
+++ b/arch/ia64/ia32/ia32_entry.S	2005-03-06 15:58:57 -08:00
@@ -494,7 +494,7 @@
   	data8 compat_sys_mq_notify
   	data8 compat_sys_mq_getsetattr
 	data8 sys_ni_syscall		/* reserved for kexec */
-	data8 sys32_waitid
+	data8 compat_sys_waitid
 
 	// guard against failures to increase IA32_NR_syscalls
 	.org ia32_syscall_table + 8*IA32_NR_syscalls
diff -Nru a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
--- a/arch/ia64/ia32/sys_ia32.c	2005-02-10 12:32:24 -08:00
+++ b/arch/ia64/ia32/sys_ia32.c	2005-03-06 15:58:57 -08:00
@@ -2633,32 +2633,6 @@
 			       advice); 
 } 
 
-asmlinkage long sys32_waitid(int which, compat_pid_t pid,
-			     compat_siginfo_t __user *uinfo, int options,
-			     struct compat_rusage __user *uru)
-{
-	siginfo_t info;
-	struct rusage ru;
-	long ret;
-	mm_segment_t old_fs = get_fs();
-
-	info.si_signo = 0;
-	set_fs (KERNEL_DS);
-	ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options,
-			 uru ? (struct rusage __user *) &ru : NULL);
-	set_fs (old_fs);
-
-	if (ret < 0 || info.si_signo == 0)
-		return ret;
-
-	if (uru && (ret = put_compat_rusage(&ru, uru)))
-		return ret;
-
-	BUG_ON(info.si_code & __SI_MASK);
-	info.si_code |= __SI_CHLD;
-	return copy_siginfo_to_user32(uinfo, &info);
-}
-
 #ifdef	NOTYET  /* UNTESTED FOR IA64 FROM HERE DOWN */
 
 asmlinkage long sys32_setreuid(compat_uid_t ruid, compat_uid_t euid)
diff -Nru a/arch/ia64/mm/extable.c b/arch/ia64/mm/extable.c
--- a/arch/ia64/mm/extable.c	2004-10-05 11:19:51 -07:00
+++ b/arch/ia64/mm/extable.c	2005-03-07 20:41:46 -08:00
@@ -6,29 +6,24 @@
  */
 
 #include <linux/config.h>
+#include <linux/sort.h>
 
 #include <asm/uaccess.h>
 #include <asm/module.h>
 
-static inline int
-compare_entries (struct exception_table_entry *l, struct exception_table_entry *r)
+static int cmp_ex(const void *a, const void *b)
 {
+	const struct exception_table_entry *l = a, *r = b;
 	u64 lip = (u64) &l->addr + l->addr;
 	u64 rip = (u64) &r->addr + r->addr;
 
-	if (lip < rip)
-		return -1;
-	if (lip == rip)
-		return 0;
-	else
-		return 1;
+	return lip - rip;
 }
 
-static inline void
-swap_entries (struct exception_table_entry *l, struct exception_table_entry *r)
+static void swap_ex(void *a, void *b)
 {
+	struct exception_table_entry *l = a, *r = b, tmp;
 	u64 delta = (u64) r - (u64) l;
-	struct exception_table_entry tmp;
 
 	tmp = *l;
 	l->addr = r->addr + delta;
@@ -38,23 +33,20 @@
 }
 
 /*
- * Sort the exception table.  It's usually already sorted, but there may be unordered
- * entries due to multiple text sections (such as the .init text section).  Note that the
- * exception-table-entries contain location-relative addresses, which requires a bit of
- * care during sorting to avoid overflows in the offset members (e.g., it would not be
- * safe to make a temporary copy of an exception-table entry on the stack, because the
- * stack may be more than 2GB away from the exception-table).
+ * Sort the exception table. It's usually already sorted, but there
+ * may be unordered entries due to multiple text sections (such as the
+ * .init text section). Note that the exception-table-entries contain
+ * location-relative addresses, which requires a bit of care during
+ * sorting to avoid overflows in the offset members (e.g., it would
+ * not be safe to make a temporary copy of an exception-table entry on
+ * the stack, because the stack may be more than 2GB away from the
+ * exception-table).
  */
-void
-sort_extable (struct exception_table_entry *start, struct exception_table_entry *finish)
+void sort_extable (struct exception_table_entry *start,
+		   struct exception_table_entry *finish)
 {
-	struct exception_table_entry *p, *q;
-
- 	/* insertion sort */
-	for (p = start + 1; p < finish; ++p)
-		/* start .. p-1 is sorted; push p down to it's proper place */
-		for (q = p; q > start && compare_entries(&q[0], &q[-1]) < 0; --q)
-			swap_entries(&q[0], &q[-1]);
+	sort(start, finish - start, sizeof(struct exception_table_entry),
+	     cmp_ex, swap_ex);
 }
 
 const struct exception_table_entry *
diff -Nru a/arch/ia64/mm/hugetlbpage.c b/arch/ia64/mm/hugetlbpage.c
--- a/arch/ia64/mm/hugetlbpage.c	2004-12-22 01:32:06 -08:00
+++ b/arch/ia64/mm/hugetlbpage.c	2005-02-23 15:40:52 -08:00
@@ -244,7 +244,7 @@
 			continue;
 		page = pte_page(*pte);
 		put_page(page);
-		pte_clear(pte);
+		pte_clear(mm, address, pte);
 	}
 	mm->rss -= (end - start) >> PAGE_SHIFT;
 	flush_tlb_range(vma, start, end);
diff -Nru a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
--- a/arch/ia64/pci/pci.c	2005-01-25 13:23:42 -08:00
+++ b/arch/ia64/pci/pci.c	2005-02-22 18:53:24 -08:00
@@ -3,9 +3,9 @@
  *
  * Derived from bios32.c of i386 tree.
  *
- * Copyright (C) 2002 Hewlett-Packard Co
+ * (c) Copyright 2002, 2005 Hewlett-Packard Development Company, L.P.
  *	David Mosberger-Tang <davidm@hpl.hp.com>
- *	Bjorn Helgaas <bjorn_helgaas@hp.com>
+ *	Bjorn Helgaas <bjorn.helgaas@hp.com>
  * Copyright (C) 2004 Silicon Graphics, Inc.
  *
  * Note: Above list of copyright holders is incomplete...
@@ -27,26 +27,12 @@
 #include <asm/segment.h>
 #include <asm/system.h>
 #include <asm/io.h>
-
 #include <asm/sal.h>
-
-
-#ifdef CONFIG_SMP
-# include <asm/smp.h>
-#endif
+#include <asm/smp.h>
 #include <asm/irq.h>
 #include <asm/hw_irq.h>
 
 
-#undef DEBUG
-#define DEBUG
-
-#ifdef DEBUG
-#define DBG(x...) printk(x)
-#else
-#define DBG(x...)
-#endif
-
 static int pci_routeirq;
 
 /*
@@ -55,23 +41,22 @@
  * synchronization mechanism here.
  */
 
-#define PCI_SAL_ADDRESS(seg, bus, devfn, reg)	\
-	((u64)(seg << 24) | (u64)(bus << 16) |	\
-	 (u64)(devfn << 8) | (u64)(reg))
+#define PCI_SAL_ADDRESS(seg, bus, devfn, reg)		\
+	(((u64) seg << 24) | (bus << 16) | (devfn << 8) | (reg))
 
 /* SAL 3.2 adds support for extended config space. */
 
 #define PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg)	\
-	((u64)(seg << 28) | (u64)(bus << 20) |		\
-	 (u64)(devfn << 12) | (u64)(reg))
+	(((u64) seg << 28) | (bus << 20) | (devfn << 12) | (reg))
 
 static int
-pci_sal_read (int seg, int bus, int devfn, int reg, int len, u32 *value)
+pci_sal_read (unsigned int seg, unsigned int bus, unsigned int devfn,
+	      int reg, int len, u32 *value)
 {
-	u64 addr, mode, data = 0;
-	int result = 0;
+	u64 addr, data = 0;
+	int mode, result;
 
-	if ((seg > 65535) || (bus > 255) || (devfn > 255) || (reg > 4095))
+	if (!value || (seg > 65535) || (bus > 255) || (devfn > 255) || (reg > 4095))
 		return -EINVAL;
 
 	if ((seg | reg) <= 255) {
@@ -82,16 +67,19 @@
 		mode = 1;
 	}
 	result = ia64_sal_pci_config_read(addr, mode, len, &data);
+	if (result != 0)
+		return -EINVAL;
 
 	*value = (u32) data;
-
-	return result;
+	return 0;
 }
 
 static int
-pci_sal_write (int seg, int bus, int devfn, int reg, int len, u32 value)
+pci_sal_write (unsigned int seg, unsigned int bus, unsigned int devfn,
+	       int reg, int len, u32 value)
 {
-	u64 addr, mode;
+	u64 addr;
+	int mode, result;
 
 	if ((seg > 65535) || (bus > 255) || (devfn > 255) || (reg > 4095))
 		return -EINVAL;
@@ -103,7 +91,10 @@
 		addr = PCI_SAL_EXT_ADDRESS(seg, bus, devfn, reg);
 		mode = 1;
 	}
-	return ia64_sal_pci_config_write(addr, mode, len, value);
+	result = ia64_sal_pci_config_write(addr, mode, len, value);
+	if (result != 0)
+		return -EINVAL;
+	return 0;
 }
 
 static struct pci_raw_ops pci_sal_ops = {
@@ -160,21 +151,11 @@
 		 * also do it here in case there are still broken drivers that
 		 * don't use pci_enable_device().
 		 */
-		printk(KERN_INFO "** Routing PCI interrupts for all devices because \"pci=routeirq\"\n");
-		printk(KERN_INFO "** was specified.  If this was required to make a driver work,\n");
-		printk(KERN_INFO "** please email the output of \"lspci\" to bjorn.helgaas@hp.com\n");
-		printk(KERN_INFO "** so I can fix the driver.\n");
+		printk(KERN_INFO "PCI: Routing interrupts for all devices because \"pci=routeirq\" specified\n");
 		for_each_pci_dev(dev)
 			acpi_pci_irq_enable(dev);
-	} else {
-		printk(KERN_INFO "** PCI interrupts are no longer routed automatically.  If this\n");
-		printk(KERN_INFO "** causes a device to stop working, it is probably because the\n");
-		printk(KERN_INFO "** driver failed to call pci_enable_device().  As a temporary\n");
-		printk(KERN_INFO "** workaround, the \"pci=routeirq\" argument restores the old\n");
-		printk(KERN_INFO "** behavior.  If this argument makes the device work again,\n");
-		printk(KERN_INFO "** please email the output of \"lspci\" to bjorn.helgaas@hp.com\n");
-		printk(KERN_INFO "** so I can fix the driver.\n");
-	}
+	} else
+		printk(KERN_INFO "PCI: If a device doesn't work, try \"pci=routeirq\".  If it helps, post a report\n");
 
 	return 0;
 }
diff -Nru a/arch/mips/Kconfig b/arch/mips/Kconfig
--- a/arch/mips/Kconfig	2005-02-10 22:57:45 -08:00
+++ b/arch/mips/Kconfig	2005-03-04 22:41:55 -08:00
@@ -122,10 +122,6 @@
 	  The TANBAC TB0229 (VR4131DIMM) is a MIPS-based platform manufactured by TANBAC.
 	  Please refer to <http://www.tanbac.co.jp/> about VR4131DIMM.
 
-config TANBAC_TB0219
-	bool "Added TANBAC TB0219 Base board support"
-	depends on TANBAC_TB0229
-
 config VICTOR_MPC30X
 	bool "Support for Victor MP-C303/304"
 	select DMA_NONCOHERENT
diff -Nru a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
--- a/arch/mips/kernel/ptrace.c	2005-01-30 22:20:14 -08:00
+++ b/arch/mips/kernel/ptrace.c	2005-03-04 22:32:50 -08:00
@@ -21,6 +21,7 @@
 #include <linux/mm.h>
 #include <linux/errno.h>
 #include <linux/ptrace.h>
+#include <linux/audit.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
 #include <linux/user.h>
@@ -307,7 +308,7 @@
 {
 	if (unlikely(current->audit_context)) {
 		if (!entryexit)
-			audit_syscall_entry(current, regs->orig_eax,
+			audit_syscall_entry(current, regs->regs[2],
 			                    regs->regs[4], regs->regs[5],
 			                    regs->regs[6], regs->regs[7]);
 		else
diff -Nru a/arch/mips/mm/c-r3k.c b/arch/mips/mm/c-r3k.c
--- a/arch/mips/mm/c-r3k.c	2004-11-29 05:11:43 -08:00
+++ b/arch/mips/mm/c-r3k.c	2005-02-25 16:35:19 -08:00
@@ -254,8 +254,7 @@
 {
 }
 
-static void r3k_flush_cache_page(struct vm_area_struct *vma,
-	unsigned long page)
+static void r3k_flush_cache_page(struct vm_area_struct *vma, unsigned long page, unsigned long pfn)
 {
 }
 
diff -Nru a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
--- a/arch/mips/mm/c-r4k.c	2005-01-30 22:22:40 -08:00
+++ b/arch/mips/mm/c-r4k.c	2005-02-25 16:35:19 -08:00
@@ -426,8 +426,7 @@
 	}
 }
 
-static void r4k_flush_cache_page(struct vm_area_struct *vma,
-	unsigned long page)
+static void r4k_flush_cache_page(struct vm_area_struct *vma, unsigned long page, unsigned long pfn)
 {
 	struct flush_cache_page_args args;
 
diff -Nru a/arch/mips/mm/c-sb1.c b/arch/mips/mm/c-sb1.c
--- a/arch/mips/mm/c-sb1.c	2005-01-30 22:22:40 -08:00
+++ b/arch/mips/mm/c-sb1.c	2005-02-25 16:35:19 -08:00
@@ -160,8 +160,7 @@
  * dcache first, then invalidate the icache.  If the page isn't
  * executable, nothing is required.
  */
-static void local_sb1_flush_cache_page(struct vm_area_struct *vma,
-	unsigned long addr)
+static void local_sb1_flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn)
 {
 	int cpu = smp_processor_id();
 
@@ -183,17 +182,18 @@
 struct flush_cache_page_args {
 	struct vm_area_struct *vma;
 	unsigned long addr;
+	unsigned long pfn;
 };
 
 static void sb1_flush_cache_page_ipi(void *info)
 {
 	struct flush_cache_page_args *args = info;
 
-	local_sb1_flush_cache_page(args->vma, args->addr);
+	local_sb1_flush_cache_page(args->vma, args->addr, args->pfn);
 }
 
 /* Dirty dcache could be on another CPU, so do the IPIs */
-static void sb1_flush_cache_page(struct vm_area_struct *vma, unsigned long addr)
+static void sb1_flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn)
 {
 	struct flush_cache_page_args args;
 
@@ -203,10 +203,11 @@
 	addr &= PAGE_MASK;
 	args.vma = vma;
 	args.addr = addr;
+	args.pfn = pfn;
 	on_each_cpu(sb1_flush_cache_page_ipi, (void *) &args, 1, 1);
 }
 #else
-void sb1_flush_cache_page(struct vm_area_struct *vma, unsigned long addr)
+void sb1_flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn)
 	__attribute__((alias("local_sb1_flush_cache_page")));
 #endif
 
diff -Nru a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c
--- a/arch/mips/mm/c-tx39.c	2004-11-29 05:11:43 -08:00
+++ b/arch/mips/mm/c-tx39.c	2005-02-25 16:35:19 -08:00
@@ -178,8 +178,7 @@
 	}
 }
 
-static void tx39_flush_cache_page(struct vm_area_struct *vma,
-				   unsigned long page)
+static void tx39_flush_cache_page(struct vm_area_struct *vma, unsigned long page, unsigned long pfn)
 {
 	int exec = vma->vm_flags & VM_EXEC;
 	struct mm_struct *mm = vma->vm_mm;
diff -Nru a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
--- a/arch/mips/mm/cache.c	2005-01-30 22:22:40 -08:00
+++ b/arch/mips/mm/cache.c	2005-02-25 16:35:19 -08:00
@@ -23,7 +23,7 @@
 void (*flush_cache_mm)(struct mm_struct *mm);
 void (*flush_cache_range)(struct vm_area_struct *vma, unsigned long start,
 	unsigned long end);
-void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page);
+void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn);
 void (*flush_icache_range)(unsigned long start, unsigned long end);
 void (*flush_icache_page)(struct vm_area_struct *vma, struct page *page);
 
diff -Nru a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
--- a/arch/mips/mm/highmem.c	2005-01-03 15:49:15 -08:00
+++ b/arch/mips/mm/highmem.c	2005-02-23 15:40:52 -08:00
@@ -75,7 +75,7 @@
 	 * force other mappings to Oops if they'll try to access
 	 * this pte without first remap it
 	 */
-	pte_clear(kmap_pte-idx);
+	pte_clear(&init_mm, vaddr, kmap_pte-idx);
 	local_flush_tlb_one(vaddr);
 #endif
 
diff -Nru a/arch/mips/pci/pci-vr41xx.c b/arch/mips/pci/pci-vr41xx.c
--- a/arch/mips/pci/pci-vr41xx.c	2005-01-30 22:33:43 -08:00
+++ b/arch/mips/pci/pci-vr41xx.c	2005-03-04 22:41:56 -08:00
@@ -288,4 +288,4 @@
 	return 0;
 }
 
-early_initcall(vr41xx_pciu_init);
+arch_initcall(vr41xx_pciu_init);
diff -Nru a/arch/mips/pmc-sierra/yosemite/ht.c b/arch/mips/pmc-sierra/yosemite/ht.c
--- a/arch/mips/pmc-sierra/yosemite/ht.c	2004-08-04 04:59:12 -07:00
+++ b/arch/mips/pmc-sierra/yosemite/ht.c	2005-02-07 12:52:54 -08:00
@@ -303,7 +303,7 @@
                 if (!r->start && r->end) {
                         printk(KERN_ERR
                                "PCI: Device %s not available because of "
-                               "resource collisions\n", dev->slot_name);
+                               "resource collisions\n", pci_name(dev));
                         return -EINVAL;
                 }
                 if (r->flags & IORESOURCE_IO)
@@ -377,7 +377,7 @@
             ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK :
              PCI_BASE_ADDRESS_MEM_MASK)) {
                 printk(KERN_ERR "PCI: Error while updating region "
-                       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
+                       "%s/%d (%08x != %08x)\n", pci_name(dev), resource,
                        new, check);
         }
 }
@@ -396,7 +396,7 @@
                    addresses kilobyte aligned.  */
                 if (size > 0x100) {
                         printk(KERN_ERR "PCI: I/O Region %s/%d too large"
-                               " (%ld bytes)\n", dev->slot_name,
+                               " (%ld bytes)\n", pci_name(dev),
                                 dev->resource - res, size);
                 }
 
diff -Nru a/arch/mips/vr41xx/casio-e55/setup.c b/arch/mips/vr41xx/casio-e55/setup.c
--- a/arch/mips/vr41xx/casio-e55/setup.c	2004-05-10 04:25:30 -07:00
+++ b/arch/mips/vr41xx/casio-e55/setup.c	2005-03-07 20:41:37 -08:00
@@ -1,7 +1,7 @@
 /*
  *  setup.c, Setup for the CASIO CASSIOPEIA E-11/15/55/65.
  *
- *  Copyright (C) 2002-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *  Copyright (C) 2002-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
  *
  *  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
@@ -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/config.h>
+#include <linux/init.h>
 #include <linux/ioport.h>
 
 #include <asm/io.h>
@@ -28,18 +28,13 @@
 	return "CASIO CASSIOPEIA E-11/15/55/65";
 }
 
-static int casio_e55_setup(void)
+static int __init casio_e55_setup(void)
 {
 	set_io_port_base(IO_PORT_BASE);
 	ioport_resource.start = IO_PORT_RESOURCE_START;
 	ioport_resource.end = IO_PORT_RESOURCE_END;
 
-#ifdef CONFIG_SERIAL_8250
-	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
-	vr41xx_siu_init();
-#endif
-
 	return 0;
 }
 
-early_initcall(casio_e55_setup);
+arch_initcall(casio_e55_setup);
diff -Nru a/arch/mips/vr41xx/common/Makefile b/arch/mips/vr41xx/common/Makefile
--- a/arch/mips/vr41xx/common/Makefile	2004-04-19 23:53:22 -07:00
+++ b/arch/mips/vr41xx/common/Makefile	2005-03-07 20:41:37 -08:00
@@ -3,7 +3,6 @@
 #
 
 obj-y				+= bcu.o cmu.o giu.o icu.o init.o int-handler.o ksyms.o pmu.o rtc.o
-obj-$(CONFIG_SERIAL_8250)	+= serial.o
 obj-$(CONFIG_VRC4171)		+= vrc4171.o
 obj-$(CONFIG_VRC4173)		+= vrc4173.o
 
diff -Nru a/arch/mips/vr41xx/common/bcu.c b/arch/mips/vr41xx/common/bcu.c
--- a/arch/mips/vr41xx/common/bcu.c	2005-01-10 17:29:39 -08:00
+++ b/arch/mips/vr41xx/common/bcu.c	2005-03-04 22:41:55 -08:00
@@ -3,7 +3,7 @@
  *
  *  Copyright (C) 2002  MontaVista Software Inc.
  *    Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com>
- *  Copyright (C) 2003-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *  Copyright (C) 2003-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
  *
  *  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
@@ -28,20 +28,16 @@
  *  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
  *  - Added support for NEC VR4133.
  */
-#include <linux/init.h>
-#include <linux/ioport.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/smp.h>
 #include <linux/types.h>
 
 #include <asm/cpu.h>
 #include <asm/io.h>
 
-#define IO_MEM_RESOURCE_START	0UL
-#define IO_MEM_RESOURCE_END	0x1fffffffUL
-
-#define CLKSPEEDREG_TYPE1	KSEG1ADDR(0x0b000014)
-#define CLKSPEEDREG_TYPE2	KSEG1ADDR(0x0f000014)
+#define CLKSPEEDREG_TYPE1	(void __iomem *)KSEG1ADDR(0x0b000014)
+#define CLKSPEEDREG_TYPE2	(void __iomem *)KSEG1ADDR(0x0f000014)
  #define CLKSP(x)		((x) & 0x001f)
  #define CLKSP_VR4133(x)	((x) & 0x0007)
 
@@ -63,11 +59,15 @@
 	return vr41xx_vtclock;
 }
 
+EXPORT_SYMBOL_GPL(vr41xx_get_vtclock_frequency);
+
 unsigned long vr41xx_get_tclock_frequency(void)
 {
 	return vr41xx_tclock;
 }
 
+EXPORT_SYMBOL_GPL(vr41xx_get_tclock_frequency);
+
 static inline uint16_t read_clkspeed(void)
 {
 	switch (current_cpu_data.cputype) {
@@ -207,7 +207,7 @@
 	return tclock;
 }
 
-static int __init vr41xx_bcu_init(void)
+void vr41xx_calculate_clock_frequency(void)
 {
 	unsigned long pclock;
 	uint16_t clkspeed;
@@ -217,11 +217,6 @@
 	pclock = calculate_pclock(clkspeed);
 	vr41xx_vtclock = calculate_vtclock(clkspeed, pclock);
 	vr41xx_tclock = calculate_tclock(clkspeed, pclock, vr41xx_vtclock);
-
-	iomem_resource.start = IO_MEM_RESOURCE_START;
-	iomem_resource.end = IO_MEM_RESOURCE_END;
-
-	return 0;
 }
 
-early_initcall(vr41xx_bcu_init);
+EXPORT_SYMBOL_GPL(vr41xx_calculate_clock_frequency);
diff -Nru a/arch/mips/vr41xx/common/cmu.c b/arch/mips/vr41xx/common/cmu.c
--- a/arch/mips/vr41xx/common/cmu.c	2004-06-24 01:55:59 -07:00
+++ b/arch/mips/vr41xx/common/cmu.c	2005-03-07 20:41:37 -08:00
@@ -3,7 +3,7 @@
  *
  *  Copyright (C) 2001-2002  MontaVista Software Inc.
  *    Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
- *  Copuright (C) 2003-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *  Copuright (C) 2003-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
  *
  *  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
@@ -29,6 +29,8 @@
  *  - Added support for NEC VR4133.
  */
 #include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/module.h>
 #include <linux/smp.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
@@ -37,8 +39,16 @@
 #include <asm/io.h>
 #include <asm/vr41xx/vr41xx.h>
 
-#define CMUCLKMSK_TYPE1	KSEG1ADDR(0x0b000060)
-#define CMUCLKMSK_TYPE2	KSEG1ADDR(0x0f000060)
+#define CMU_TYPE1_BASE	0x0b000060UL
+#define CMU_TYPE1_SIZE	0x4
+
+#define CMU_TYPE2_BASE	0x0f000060UL
+#define CMU_TYPE2_SIZE	0x4
+
+#define CMU_TYPE3_BASE	0x0f000060UL
+#define CMU_TYPE3_SIZE	0x8
+
+#define CMUCLKMSK	0x0
  #define MSKPIU		0x0001
  #define MSKSIU		0x0002
  #define MSKAIU		0x0004
@@ -52,19 +62,17 @@
  #define MSKFFIR	0x0400
  #define MSKSCSI	0x1000
  #define MSKPPCIU	0x2000
-#define CMUCLKMSK2	KSEG1ADDR(0x0f000064)
+#define CMUCLKMSK2	0x4
  #define MSKCEU		0x0001
  #define MSKMAC0	0x0002
  #define MSKMAC1	0x0004
 
-static uint32_t cmu_base;
+static void __iomem *cmu_base;
 static uint16_t cmuclkmsk, cmuclkmsk2;
 static spinlock_t cmu_lock;
 
-#define read_cmuclkmsk()	readw(cmu_base)
-#define read_cmuclkmsk2()	readw(CMUCLKMSK2)
-#define write_cmuclkmsk()	writew(cmuclkmsk, cmu_base)
-#define write_cmuclkmsk2()	writew(cmuclkmsk2, CMUCLKMSK2)
+#define cmu_read(offset)		readw(cmu_base + (offset))
+#define cmu_write(offset, value)	writew((value), cmu_base + (offset))
 
 void vr41xx_supply_clock(vr41xx_clock_t clock)
 {
@@ -120,13 +128,15 @@
 
 	if (clock == CEU_CLOCK || clock == ETHER0_CLOCK ||
 	    clock == ETHER1_CLOCK)
-		write_cmuclkmsk2();
+		cmu_write(CMUCLKMSK2, cmuclkmsk2);
 	else
-		write_cmuclkmsk();
+		cmu_write(CMUCLKMSK, cmuclkmsk);
 
 	spin_unlock_irq(&cmu_lock);
 }
 
+EXPORT_SYMBOL_GPL(vr41xx_supply_clock);
+
 void vr41xx_mask_clock(vr41xx_clock_t clock)
 {
 	spin_lock_irq(&cmu_lock);
@@ -160,7 +170,7 @@
 		    current_cpu_data.cputype == CPU_VR4121) {
 			cmuclkmsk &= ~MSKDSIU;
 		} else {
-			if (cmuclkmsk & MSKSIU)
+			if (cmuclkmsk & MSKSSIU)
 				cmuclkmsk &= ~MSKDSIU;
 			else
 				cmuclkmsk &= ~(MSKSIU | MSKDSIU);
@@ -193,38 +203,55 @@
 
 	if (clock == CEU_CLOCK || clock == ETHER0_CLOCK ||
 	    clock == ETHER1_CLOCK)
-		write_cmuclkmsk2();
+		cmu_write(CMUCLKMSK2, cmuclkmsk2);
 	else
-		write_cmuclkmsk();
+		cmu_write(CMUCLKMSK, cmuclkmsk);
 
 	spin_unlock_irq(&cmu_lock);
 }
 
+EXPORT_SYMBOL_GPL(vr41xx_mask_clock);
+
 static int __init vr41xx_cmu_init(void)
 {
+	unsigned long start, size;
+
 	switch (current_cpu_data.cputype) {
         case CPU_VR4111:
         case CPU_VR4121:
-                cmu_base = CMUCLKMSK_TYPE1;
+		start = CMU_TYPE1_BASE;
+		size = CMU_TYPE1_SIZE;
                 break;
         case CPU_VR4122:
         case CPU_VR4131:
-                cmu_base = CMUCLKMSK_TYPE2;
-                break;
+		start = CMU_TYPE2_BASE;
+		size = CMU_TYPE2_SIZE;
+		break;
         case CPU_VR4133:
-                cmu_base = CMUCLKMSK_TYPE2;
-		cmuclkmsk2 = read_cmuclkmsk2();
+		start = CMU_TYPE3_BASE;
+		size = CMU_TYPE3_SIZE;
                 break;
 	default:
 		panic("Unexpected CPU of NEC VR4100 series");
 		break;
         }
 
-	cmuclkmsk = read_cmuclkmsk();
+	if (request_mem_region(start, size, "CMU") == NULL)
+		return -EBUSY;
+
+	cmu_base = ioremap(start, size);
+	if (cmu_base == NULL) {
+		release_mem_region(start, size);
+		return -EBUSY;
+	}
+
+	cmuclkmsk = cmu_read(CMUCLKMSK);
+	if (current_cpu_data.cputype == CPU_VR4133)
+		cmuclkmsk2 = cmu_read(CMUCLKMSK2);
 
 	spin_lock_init(&cmu_lock);
 
 	return 0;
 }
 
-early_initcall(vr41xx_cmu_init);
+core_initcall(vr41xx_cmu_init);
diff -Nru a/arch/mips/vr41xx/common/init.c b/arch/mips/vr41xx/common/init.c
--- a/arch/mips/vr41xx/common/init.c	2004-06-24 01:55:59 -07:00
+++ b/arch/mips/vr41xx/common/init.c	2005-03-07 20:41:26 -08:00
@@ -1,7 +1,7 @@
 /*
  *  init.c, Common initialization routines for NEC VR4100 series.
  *
- *  Copyright (C) 2003-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *  Copyright (C) 2003-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
  *
  *  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
@@ -18,9 +18,45 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/irq.h>
 #include <linux/string.h>
 
 #include <asm/bootinfo.h>
+#include <asm/time.h>
+#include <asm/vr41xx/vr41xx.h>
+
+#define IO_MEM_RESOURCE_START	0UL
+#define IO_MEM_RESOURCE_END	0x1fffffffUL
+
+static void __init iomem_resource_init(void)
+{
+	iomem_resource.start = IO_MEM_RESOURCE_START;
+	iomem_resource.end = IO_MEM_RESOURCE_END;
+}
+
+static void __init setup_timer_frequency(void)
+{
+	unsigned long tclock;
+
+	tclock = vr41xx_get_tclock_frequency();
+	if (current_cpu_data.processor_id == PRID_VR4131_REV2_0 ||
+	    current_cpu_data.processor_id == PRID_VR4131_REV2_1)
+		mips_hpt_frequency = tclock / 2;
+	else
+		mips_hpt_frequency = tclock / 4;
+}
+
+static void __init setup_timer_irq(struct irqaction *irq)
+{
+	setup_irq(TIMER_IRQ, irq);
+}
+
+static void __init timer_init(void)
+{
+	board_time_init = setup_timer_frequency;
+	board_timer_setup = setup_timer_irq;
+}
 
 void __init prom_init(void)
 {
@@ -35,6 +71,12 @@
 		if (i < (argc - 1))
 			strcat(arcs_cmdline, " ");
 	}
+
+	vr41xx_calculate_clock_frequency();
+
+	timer_init();
+
+	iomem_resource_init();
 }
 
 unsigned long __init prom_free_prom_memory (void)
diff -Nru a/arch/mips/vr41xx/common/ksyms.c b/arch/mips/vr41xx/common/ksyms.c
--- a/arch/mips/vr41xx/common/ksyms.c	2005-01-30 22:33:43 -08:00
+++ b/arch/mips/vr41xx/common/ksyms.c	2005-03-04 22:41:55 -08:00
@@ -22,9 +22,6 @@
 
 #include <asm/vr41xx/vr41xx.h>
 
-EXPORT_SYMBOL(vr41xx_get_vtclock_frequency);
-EXPORT_SYMBOL(vr41xx_get_tclock_frequency);
-
 EXPORT_SYMBOL(vr41xx_set_rtclong1_cycle);
 EXPORT_SYMBOL(vr41xx_read_rtclong1_counter);
 EXPORT_SYMBOL(vr41xx_set_rtclong2_cycle);
diff -Nru a/arch/mips/vr41xx/common/serial.c b/arch/mips/vr41xx/common/serial.c
--- a/arch/mips/vr41xx/common/serial.c	2004-09-22 13:32:04 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,178 +0,0 @@
-/*
- *  serial.c, Serial Interface Unit routines for NEC VR4100 series.
- *
- *  Copyright (C) 2002  MontaVista Software Inc.
- *    Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
- *  Copyright (C) 2003-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
- *
- *  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
- */
-/*
- * Changes:
- *  MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
- *  - New creation, NEC VR4122 and VR4131 are supported.
- *  - Added support for NEC VR4111 and VR4121.
- *
- *  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
- *  - Added support for NEC VR4133.
- */
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/tty.h>
-#include <linux/serial.h>
-#include <linux/serial_core.h>
-#include <linux/smp.h>
-
-#include <asm/addrspace.h>
-#include <asm/cpu.h>
-#include <asm/io.h>
-#include <asm/vr41xx/vr41xx.h>
-
-#define SIUIRSEL_TYPE1		KSEG1ADDR(0x0c000008)
-#define SIUIRSEL_TYPE2		KSEG1ADDR(0x0f000808)
- #define USE_RS232C		0x00
- #define USE_IRDA		0x01
- #define SIU_USES_IRDA		0x00
- #define FIR_USES_IRDA		0x02
- #define IRDA_MODULE_SHARP	0x00
- #define IRDA_MODULE_TEMIC	0x04
- #define IRDA_MODULE_HP		0x08
- #define TMICTX			0x10
- #define TMICMODE		0x20
-
-#define SIU_BASE_TYPE1		0x0c000000UL	/* VR4111 and VR4121 */
-#define SIU_BASE_TYPE2		0x0f000800UL	/* VR4122, VR4131 and VR4133 */
-#define SIU_SIZE		0x8UL
-
-#define SIU_BASE_BAUD		1152000
-
-/* VR4122, VR4131 and VR4133 DSIU Registers */
-#define DSIU_BASE		0x0f000820UL
-#define DSIU_SIZE		0x8UL
-
-#define DSIU_BASE_BAUD		1152000
-
-int vr41xx_serial_ports = 0;
-
-void vr41xx_select_siu_interface(siu_interface_t interface,
-                                 irda_module_t module)
-{
-	uint16_t val = USE_RS232C;	/* Select RS-232C */
-
-	/* Select IrDA */
-	if (interface == SIU_IRDA) {
-		switch (module) {
-		case IRDA_SHARP:
-			val = IRDA_MODULE_SHARP;
-			break;
-		case IRDA_TEMIC:
-			val = IRDA_MODULE_TEMIC;
-			break;
-		case IRDA_HP:
-			val = IRDA_MODULE_HP;
-			break;
-		default:
-			printk(KERN_ERR "SIU: unknown IrDA module\n");
-			return;
-		}
-		val |= USE_IRDA | SIU_USES_IRDA;
-	}
-
-	switch (current_cpu_data.cputype) {
-	case CPU_VR4111:
-	case CPU_VR4121:
-		writew(val, SIUIRSEL_TYPE1);
-		break;
-	case CPU_VR4122:
-	case CPU_VR4131:
-	case CPU_VR4133:
-		writew(val, SIUIRSEL_TYPE2);
-		break;
-	default:
-		printk(KERN_ERR "SIU: unsupported CPU of NEC VR4100 series\n");
-		break;
-	}
-}
-
-void __init vr41xx_siu_init(void)
-{
-	struct uart_port port;
-
-	memset(&port, 0, sizeof(port));
-
-	port.line = vr41xx_serial_ports;
-	port.uartclk = SIU_BASE_BAUD * 16;
-	port.irq = SIU_IRQ;
-	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
-	switch (current_cpu_data.cputype) {
-	case CPU_VR4111:
-	case CPU_VR4121:
-		port.mapbase = SIU_BASE_TYPE1;
-		break;
-	case CPU_VR4122:
-	case CPU_VR4131:
-	case CPU_VR4133:
-		port.mapbase = SIU_BASE_TYPE2;
-		break;
-	default:
-		printk(KERN_ERR "SIU: unsupported CPU of NEC VR4100 series\n");
-		return;
-	}
-	port.regshift = 0;
-	port.iotype = UPIO_MEM;
-	port.membase = ioremap(port.mapbase, SIU_SIZE);
-	if (port.membase != NULL) {
-		if (early_serial_setup(&port) == 0) {
-			vr41xx_supply_clock(SIU_CLOCK);
-			vr41xx_serial_ports++;
-			return;
-		}
-	}
-
-	printk(KERN_ERR "SIU: setup failed!\n");
-}
-
-void __init vr41xx_dsiu_init(void)
-{
-	struct uart_port port;
-
-	if (current_cpu_data.cputype != CPU_VR4122 &&
-	    current_cpu_data.cputype != CPU_VR4131 &&
-	    current_cpu_data.cputype != CPU_VR4133) {
-		printk(KERN_ERR "DSIU: unsupported CPU of NEC VR4100 series\n");
-		return;
-	}
-
-	memset(&port, 0, sizeof(port));
-
-	port.line = vr41xx_serial_ports;
-	port.uartclk = DSIU_BASE_BAUD * 16;
-	port.irq = DSIU_IRQ;
-	port.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST;
-	port.mapbase = DSIU_BASE;
-	port.regshift = 0;
-	port.iotype = UPIO_MEM;
-	port.membase = ioremap(port.mapbase, DSIU_SIZE);
-	if (port.membase != NULL) {
-		if (early_serial_setup(&port) == 0) {
-			vr41xx_supply_clock(DSIU_CLOCK);
-			vr41xx_enable_dsiuint(DSIUINT_ALL);
-			vr41xx_serial_ports++;
-			return;
-		}
-	}
-
-	printk(KERN_ERR "DSIU: setup failed!\n");
-}
diff -Nru a/arch/mips/vr41xx/ibm-workpad/setup.c b/arch/mips/vr41xx/ibm-workpad/setup.c
--- a/arch/mips/vr41xx/ibm-workpad/setup.c	2004-05-10 04:25:30 -07:00
+++ b/arch/mips/vr41xx/ibm-workpad/setup.c	2005-03-07 20:41:37 -08:00
@@ -1,7 +1,7 @@
 /*
  *  setup.c, Setup for the IBM WorkPad z50.
  *
- *  Copyright (C) 2002-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *  Copyright (C) 2002-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
  *
  *  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
@@ -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/config.h>
+#include <linux/init.h>
 #include <linux/ioport.h>
 
 #include <asm/io.h>
@@ -28,18 +28,13 @@
 	return "IBM WorkPad z50";
 }
 
-static int ibm_workpad_setup(void)
+static int __init ibm_workpad_setup(void)
 {
 	set_io_port_base(IO_PORT_BASE);
 	ioport_resource.start = IO_PORT_RESOURCE_START;
 	ioport_resource.end = IO_PORT_RESOURCE_END;
 
-#ifdef CONFIG_SERIAL_8250
-	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
-	vr41xx_siu_init();
-#endif
-
 	return 0;
 }
 
-early_initcall(ibm_workpad_setup);
+arch_initcall(ibm_workpad_setup);
diff -Nru a/arch/mips/vr41xx/nec-cmbvr4133/setup.c b/arch/mips/vr41xx/nec-cmbvr4133/setup.c
--- a/arch/mips/vr41xx/nec-cmbvr4133/setup.c	2005-01-30 22:33:43 -08:00
+++ b/arch/mips/vr41xx/nec-cmbvr4133/setup.c	2005-03-07 20:41:37 -08:00
@@ -16,7 +16,6 @@
  */
 #include <linux/config.h>
 #include <linux/init.h>
-#include <linux/console.h>
 #include <linux/ide.h>
 #include <linux/ioport.h>
 
@@ -55,15 +54,6 @@
 #define number_partitions (sizeof(cmbvr4133_mtd_parts)/sizeof(struct mtd_partition))
 #endif
 
-extern void (*late_time_init)(void);
-
-static void __init vr4133_serial_init(void)
-{
-	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
-	vr41xx_siu_init();
-	vr41xx_dsiu_init();
-}
-
 extern void i8259_init(void);
 
 static int __init nec_cmbvr4133_setup(void)
@@ -77,8 +67,6 @@
 
 	mips_machgroup = MACH_GROUP_NEC_VR41XX;
 	mips_machtype = MACH_NEC_CMBVR4133;
-
-	late_time_init = vr4133_serial_init;
 
 #ifdef CONFIG_PCI
 #ifdef CONFIG_ROCKHOPPER
diff -Nru a/arch/mips/vr41xx/tanbac-tb0226/setup.c b/arch/mips/vr41xx/tanbac-tb0226/setup.c
--- a/arch/mips/vr41xx/tanbac-tb0226/setup.c	2004-06-24 01:55:59 -07:00
+++ b/arch/mips/vr41xx/tanbac-tb0226/setup.c	2005-03-07 20:41:37 -08:00
@@ -1,7 +1,7 @@
 /*
  *  setup.c, Setup for the TANBAC TB0226.
  *
- *  Copyright (C) 2002-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *  Copyright (C) 2002-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
  *
  *  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
@@ -17,23 +17,8 @@
  *  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/config.h>
-
-#include <asm/vr41xx/vr41xx.h>
 
 const char *get_system_type(void)
 {
 	return "TANBAC TB0226";
 }
-
-static int tanbac_tb0226_setup(void)
-{
-#ifdef CONFIG_SERIAL_8250
-	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
-	vr41xx_siu_init();
-#endif
-
-	return 0;
-}
-
-early_initcall(tanbac_tb0226_setup);
diff -Nru a/arch/mips/vr41xx/tanbac-tb0229/Makefile b/arch/mips/vr41xx/tanbac-tb0229/Makefile
--- a/arch/mips/vr41xx/tanbac-tb0229/Makefile	2004-06-24 01:55:59 -07:00
+++ b/arch/mips/vr41xx/tanbac-tb0229/Makefile	2005-03-04 22:41:55 -08:00
@@ -3,5 +3,3 @@
 #
 
 obj-y				:= setup.o
-
-obj-$(CONFIG_TANBAC_TB0219)	+= tb0219.o
diff -Nru a/arch/mips/vr41xx/tanbac-tb0229/setup.c b/arch/mips/vr41xx/tanbac-tb0229/setup.c
--- a/arch/mips/vr41xx/tanbac-tb0229/setup.c	2004-06-24 01:55:59 -07:00
+++ b/arch/mips/vr41xx/tanbac-tb0229/setup.c	2005-03-07 20:41:37 -08:00
@@ -1,7 +1,7 @@
 /*
  *  setup.c, Setup for the TANBAC TB0229 (VR4131DIMM)
  *
- *  Copyright (C) 2002-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *  Copyright (C) 2002-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
  *
  *  Modified for TANBAC TB0229:
  *  Copyright (C) 2003  Megasolution Inc.  <matsu@megasolution.jp>
@@ -20,24 +20,8 @@
  *  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/config.h>
-
-#include <asm/vr41xx/vr41xx.h>
 
 const char *get_system_type(void)
 {
 	return "TANBAC TB0229";
 }
-
-static int tanbac_tb0229_setup(void)
-{
-#ifdef CONFIG_SERIAL_8250
-	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
-	vr41xx_siu_init();
-	vr41xx_dsiu_init();
-#endif
-
-	return 0;
-}
-
-early_initcall(tanbac_tb0229_setup);
diff -Nru a/arch/mips/vr41xx/tanbac-tb0229/tb0219.c b/arch/mips/vr41xx/tanbac-tb0229/tb0219.c
--- a/arch/mips/vr41xx/tanbac-tb0229/tb0219.c	2004-06-24 09:19:45 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,44 +0,0 @@
-/*
- *  tb0219.c, Setup for the TANBAC TB0219
- *
- *  Copyright (C) 2003  Megasolution Inc. <matsu@megasolution.jp>
- *  Copyright (C) 2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#include <linux/init.h>
-
-#include <asm/io.h>
-#include <asm/reboot.h>
-
-#define TB0219_RESET_REGS	KSEG1ADDR(0x0a00000e)
-
-#define tb0219_hard_reset()	writew(0, TB0219_RESET_REGS)
-
-static void tanbac_tb0219_restart(char *command)
-{
-	local_irq_disable();
-	tb0219_hard_reset();
-	while (1);
-}
-
-static int __init tanbac_tb0219_setup(void)
-{
-	_machine_restart = tanbac_tb0219_restart;
-
-	return 0;
-}
-
-early_initcall(tanbac_tb0219_setup);
diff -Nru a/arch/mips/vr41xx/victor-mpc30x/setup.c b/arch/mips/vr41xx/victor-mpc30x/setup.c
--- a/arch/mips/vr41xx/victor-mpc30x/setup.c	2004-06-24 01:55:59 -07:00
+++ b/arch/mips/vr41xx/victor-mpc30x/setup.c	2005-03-07 20:41:37 -08:00
@@ -1,7 +1,7 @@
 /*
  *  setup.c, Setup for the Victor MP-C303/304.
  *
- *  Copyright (C) 2002-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *  Copyright (C) 2002-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
  *
  *  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
@@ -17,23 +17,8 @@
  *  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/config.h>
-
-#include <asm/vr41xx/vr41xx.h>
 
 const char *get_system_type(void)
 {
 	return "Victor MP-C303/304";
 }
-
-static int victor_mpc30x_setup(void)
-{
-#ifdef CONFIG_SERIAL_8250
-	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
-	vr41xx_siu_init();
-#endif
-
-	return 0;
-}
-
-early_initcall(victor_mpc30x_setup);
diff -Nru a/arch/mips/vr41xx/zao-capcella/setup.c b/arch/mips/vr41xx/zao-capcella/setup.c
--- a/arch/mips/vr41xx/zao-capcella/setup.c	2004-06-24 01:55:59 -07:00
+++ b/arch/mips/vr41xx/zao-capcella/setup.c	2005-03-07 20:41:37 -08:00
@@ -1,7 +1,7 @@
 /*
  *  setup.c, Setup for the ZAO Networks Capcella.
  *
- *  Copyright (C) 2002-2004  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *  Copyright (C) 2002-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
  *
  *  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
@@ -17,24 +17,8 @@
  *  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/config.h>
-
-#include <asm/vr41xx/vr41xx.h>
 
 const char *get_system_type(void)
 {
 	return "ZAO Networks Capcella";
 }
-
-static int zao_capcella_setup(void)
-{
-#ifdef CONFIG_SERIAL_8250
-	vr41xx_select_siu_interface(SIU_RS232C, IRDA_NONE);
-	vr41xx_siu_init();
-	vr41xx_dsiu_init();
-#endif
-
-	return 0;
-}
-
-early_initcall(zao_capcella_setup);
diff -Nru a/arch/parisc/Kconfig b/arch/parisc/Kconfig
--- a/arch/parisc/Kconfig	2005-01-12 11:59:21 -08:00
+++ b/arch/parisc/Kconfig	2005-03-02 03:25:23 -08:00
@@ -6,8 +6,7 @@
 mainmenu "Linux/PA-RISC Kernel Configuration"
 
 config PARISC
-	bool
-	default y
+	def_bool y
 	help
 	  The PA-RISC microprocessor is designed by Hewlett-Packard and used
 	  in many of their workstations & servers (HP9000 700 and 800 series,
@@ -15,19 +14,16 @@
 	  at <http://www.parisc-linux.org/>.
 
 config MMU
-	bool
-	default y
+	def_bool y
 
 config STACK_GROWSUP
-	bool
-	default y
+	def_bool y
 
 config UID16
 	bool
 
 config RWSEM_GENERIC_SPINLOCK
-	bool
-	default y
+	def_bool y
 
 config RWSEM_XCHGADD_ALGORITHM
 	bool
@@ -111,7 +107,7 @@
 	def_bool y
 	depends on PA8X00
 
-config PARISC64
+config 64BIT
 	bool "64-bit kernel"
 	depends on PA8X00
 	help
@@ -124,9 +120,6 @@
 	  enable this option otherwise. The 64bit kernel is significantly bigger
 	  and slower than the 32bit one.
 
-config 64BIT
-	def_bool PARISC64
-
 config SMP
 	bool "Symmetric multi-processing support"
 	---help---
@@ -166,13 +159,12 @@
 	default n
 
 config COMPAT
-	bool
-	depends on PARISC64
-	default y
+	def_bool y
+	depends on 64BIT
 
 config HPUX
 	bool "Support for HP-UX binaries"
-	depends on !PARISC64
+	depends on !64BIT
 
 config NR_CPUS
 	int "Maximum number of CPUs (2-32)"
diff -Nru a/arch/parisc/Makefile b/arch/parisc/Makefile
--- a/arch/parisc/Makefile	2004-11-02 00:14:06 -08:00
+++ b/arch/parisc/Makefile	2005-03-02 03:25:23 -08:00
@@ -17,9 +17,12 @@
 # Mike Shaver, Helge Deller and Martin K. Petersen
 #
 NM		= sh $(srctree)/arch/parisc/nm
-ifdef CONFIG_PARISC64
+CHECKFLAGS	+= -D__hppa__=1
+
+ifdef CONFIG_64BIT
 CROSS_COMPILE	:= hppa64-linux-
 UTS_MACHINE	:= parisc64
+CHECKFLAGS	+= -D__LP64__=1 -m64
 else
 MACHINE := $(subst 64,,$(shell uname -m))
 ifneq ($(MACHINE),parisc)
@@ -65,8 +68,12 @@
 
 drivers-$(CONFIG_OPROFILE)		+= arch/parisc/oprofile/
 
+PALO := $(shell if which palo; then : ; \
+	elif [ -x /sbin/palo ]; then echo /sbin/palo; \
+	fi)
+
 palo: vmlinux
-	@if [ $$(palo -f /dev/null >/dev/null 2>&1 ; echo $$?) != 2 ]; then \
+	@if [ -x $PALO ]; then \
 		echo 'ERROR: Please install palo first (apt-get install palo)';\
 		echo 'or build it from source and install it somewhere in your $$PATH';\
 		false; \
@@ -78,7 +85,7 @@
 		echo 'WARNING: the "lifimage" file is now placed in this directory by default!'; \
 		false; \
 	fi
-	palo -f ./palo.conf
+	$(PALO) -f ./palo.conf
 
 oldpalo: vmlinux
 	export TOPDIR=`pwd`; \
diff -Nru a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig
--- a/arch/parisc/configs/a500_defconfig	2005-01-12 11:59:21 -08:00
+++ b/arch/parisc/configs/a500_defconfig	2005-03-02 03:25:23 -08:00
@@ -1,12 +1,15 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.10-pa5
-# Wed Jan  5 13:22:34 2005
+# Linux kernel version: 2.6.11-rc4-pa1
+# Wed Feb 16 11:32:49 2005
 #
 CONFIG_PARISC=y
 CONFIG_MMU=y
 CONFIG_STACK_GROWSUP=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
 
 #
 # Code maturity level options
@@ -68,7 +71,6 @@
 CONFIG_PA8X00=y
 CONFIG_PA20=y
 CONFIG_PREFETCH=y
-CONFIG_PARISC64=y
 CONFIG_64BIT=y
 CONFIG_SMP=y
 CONFIG_HOTPLUG_CPU=y
@@ -87,16 +89,12 @@
 CONFIG_PCI_LBA=y
 CONFIG_IOSAPIC=y
 CONFIG_IOMMU_SBA=y
-# CONFIG_SUPERIO is not set
-# CONFIG_CHASSIS_LCD_LED is not set
-CONFIG_PDC_CHASSIS=y
 
 #
 # PCCARD (PCMCIA/CardBus) support
 #
 CONFIG_PCCARD=m
 # CONFIG_PCMCIA_DEBUG is not set
-# CONFIG_PCMCIA_OBSOLETE is not set
 CONFIG_PCMCIA=m
 CONFIG_CARDBUS=y
 
@@ -107,6 +105,7 @@
 CONFIG_PD6729=m
 CONFIG_I82092=m
 CONFIG_TCIC=m
+CONFIG_PCCARD_NONSTATIC=m
 
 #
 # PCI Hotplug Support
@@ -114,6 +113,14 @@
 # CONFIG_HOTPLUG_PCI is not set
 
 #
+# PA-RISC specific drivers
+#
+# CONFIG_SUPERIO is not set
+# CONFIG_CHASSIS_LCD_LED is not set
+CONFIG_PDC_CHASSIS=y
+CONFIG_PDC_STABLE=y
+
+#
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
@@ -153,6 +160,7 @@
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 CONFIG_BLK_DEV_UMEM=m
+# CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
@@ -171,6 +179,7 @@
 CONFIG_IOSCHED_AS=y
 CONFIG_IOSCHED_DEADLINE=y
 CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -205,6 +214,7 @@
 #
 CONFIG_SCSI_SPI_ATTRS=y
 CONFIG_SCSI_FC_ATTRS=m
+CONFIG_SCSI_ISCSI_ATTRS=m
 
 #
 # SCSI low-level drivers
@@ -231,10 +241,10 @@
 # CONFIG_SCSI_INITIO is not set
 # CONFIG_SCSI_INIA100 is not set
 CONFIG_SCSI_SYM53C8XX_2=y
-CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
+CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
-CONFIG_SCSI_SYM53C8XX_IOMAPPED=y
+# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
 # CONFIG_SCSI_IPR is not set
 # CONFIG_SCSI_PCI2000 is not set
 # CONFIG_SCSI_PCI2220I is not set
@@ -249,7 +259,6 @@
 CONFIG_SCSI_QLA2300=m
 CONFIG_SCSI_QLA2322=m
 CONFIG_SCSI_QLA6312=m
-CONFIG_SCSI_QLA6322=m
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
 CONFIG_SCSI_DEBUG=m
@@ -399,8 +408,6 @@
 CONFIG_IP_NF_ARPTABLES=m
 CONFIG_IP_NF_ARPFILTER=m
 CONFIG_IP_NF_ARP_MANGLE=m
-# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
-# CONFIG_IP_NF_COMPAT_IPFWADM is not set
 CONFIG_XFRM=y
 CONFIG_XFRM_USER=m
 
@@ -465,7 +472,7 @@
 #
 CONFIG_NET_TULIP=y
 CONFIG_DE2104X=m
-CONFIG_TULIP=m
+CONFIG_TULIP=y
 # CONFIG_TULIP_MWI is not set
 CONFIG_TULIP_MMIO=y
 # CONFIG_TULIP_NAPI is not set
@@ -483,7 +490,6 @@
 # CONFIG_FORCEDETH is not set
 # CONFIG_DGRS is not set
 CONFIG_EEPRO100=m
-# CONFIG_EEPRO100_PIO is not set
 CONFIG_E100=m
 CONFIG_E100_NAPI=y
 # CONFIG_FEALNX is not set
@@ -524,6 +530,7 @@
 CONFIG_IXGB_NAPI=y
 CONFIG_S2IO=m
 CONFIG_S2IO_NAPI=y
+# CONFIG_2BUFF_MODE is not set
 
 #
 # Token Ring devices
@@ -691,7 +698,6 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 
 #
@@ -733,9 +739,9 @@
 #
 # Console display driver support
 #
+CONFIG_DUMMY_CONSOLE=y
 CONFIG_DUMMY_CONSOLE_COLUMNS=160
 CONFIG_DUMMY_CONSOLE_ROWS=64
-CONFIG_DUMMY_CONSOLE=y
 
 #
 # Sound
@@ -764,6 +770,15 @@
 # CONFIG_MMC is not set
 
 #
+# InfiniBand support
+#
+CONFIG_INFINIBAND=m
+CONFIG_INFINIBAND_MTHCA=m
+# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
+CONFIG_INFINIBAND_IPOIB=m
+# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -775,10 +790,16 @@
 # CONFIG_REISERFS_FS is not set
 CONFIG_JFS_FS=m
 # CONFIG_JFS_POSIX_ACL is not set
+# CONFIG_JFS_SECURITY is not set
 # CONFIG_JFS_DEBUG is not set
 # CONFIG_JFS_STATISTICS is not set
 CONFIG_FS_POSIX_ACL=y
+
+#
+# XFS support
+#
 CONFIG_XFS_FS=m
+CONFIG_XFS_EXPORT=y
 # CONFIG_XFS_RT is not set
 # CONFIG_XFS_QUOTA is not set
 # CONFIG_XFS_SECURITY is not set
@@ -786,7 +807,7 @@
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
-# CONFIG_DNOTIFY is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 CONFIG_AUTOFS4_FS=y
 
@@ -817,7 +838,8 @@
 CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
-# CONFIG_TMPFS is not set
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
@@ -935,6 +957,8 @@
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_KOBJECT is not set
 # CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_IOREMAP is not set
+# CONFIG_DEBUG_FS is not set
 # CONFIG_DEBUG_RWLOCK is not set
 
 #
@@ -971,6 +995,10 @@
 CONFIG_CRYPTO_MICHAEL_MIC=m
 CONFIG_CRYPTO_CRC32C=m
 CONFIG_CRYPTO_TEST=m
+
+#
+# Hardware crypto devices
+#
 
 #
 # Library routines
diff -Nru a/arch/parisc/configs/n4000_defconfig b/arch/parisc/configs/n4000_defconfig
--- a/arch/parisc/configs/n4000_defconfig	2005-01-12 11:59:22 -08:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,927 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.10-pa5
-# Wed Jan  5 13:40:36 2005
-#
-CONFIG_PARISC=y
-CONFIG_MMU=y
-CONFIG_STACK_GROWSUP=y
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-# CONFIG_CLEAN_COMPILE is not set
-CONFIG_BROKEN=y
-CONFIG_BROKEN_ON_SMP=y
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-CONFIG_POSIX_MQUEUE=y
-# CONFIG_BSD_PROCESS_ACCT is not set
-CONFIG_SYSCTL=y
-# CONFIG_AUDIT is not set
-CONFIG_LOG_BUF_SHIFT=16
-CONFIG_HOTPLUG=y
-CONFIG_KOBJECT_UEVENT=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_EMBEDDED=y
-CONFIG_KALLSYMS=y
-CONFIG_KALLSYMS_ALL=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
-CONFIG_SHMEM=y
-CONFIG_CC_ALIGN_FUNCTIONS=0
-CONFIG_CC_ALIGN_LABELS=0
-CONFIG_CC_ALIGN_LOOPS=0
-CONFIG_CC_ALIGN_JUMPS=0
-# CONFIG_TINY_SHMEM is not set
-
-#
-# Loadable module support
-#
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
-CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
-# CONFIG_MODULE_SRCVERSION_ALL is not set
-CONFIG_KMOD=y
-
-#
-# Processor type and features
-#
-# CONFIG_PA7000 is not set
-# CONFIG_PA7100LC is not set
-# CONFIG_PA7200 is not set
-# CONFIG_PA7300LC is not set
-CONFIG_PA8X00=y
-CONFIG_PA20=y
-CONFIG_PREFETCH=y
-CONFIG_PARISC64=y
-CONFIG_64BIT=y
-# CONFIG_SMP is not set
-CONFIG_DISCONTIGMEM=y
-# CONFIG_PREEMPT is not set
-CONFIG_COMPAT=y
-
-#
-# Bus options (PCI, PCMCIA, EISA, GSC, ISA)
-#
-# CONFIG_GSC is not set
-CONFIG_PCI=y
-CONFIG_PCI_LEGACY_PROC=y
-CONFIG_PCI_NAMES=y
-CONFIG_PCI_LBA=y
-CONFIG_IOSAPIC=y
-CONFIG_IOMMU_SBA=y
-# CONFIG_SUPERIO is not set
-CONFIG_CHASSIS_LCD_LED=y
-# CONFIG_PDC_CHASSIS is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-# CONFIG_PCCARD is not set
-
-#
-# PC-card bridges
-#
-
-#
-# PCI Hotplug Support
-#
-# CONFIG_HOTPLUG_PCI is not set
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_MISC is not set
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-# CONFIG_STANDALONE is not set
-# CONFIG_PREVENT_FIRMWARE_BUILD is not set
-CONFIG_FW_LOADER=y
-# CONFIG_DEBUG_DRIVER is not set
-
-#
-# Memory Technology Devices (MTD)
-#
-# CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
-# CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_CPQ_DA is not set
-# CONFIG_BLK_CPQ_CISS_DA is not set
-# CONFIG_BLK_DEV_DAC960 is not set
-CONFIG_BLK_DEV_UMEM=m
-CONFIG_BLK_DEV_LOOP=y
-# CONFIG_BLK_DEV_CRYPTOLOOP is not set
-# CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_SX8 is not set
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_COUNT=16
-CONFIG_BLK_DEV_RAM_SIZE=6144
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_INITRAMFS_SOURCE=""
-CONFIG_CDROM_PKTCDVD=m
-CONFIG_CDROM_PKTCDVD_BUFFERS=8
-# CONFIG_CDROM_PKTCDVD_WCACHE is not set
-
-#
-# IO Schedulers
-#
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-# CONFIG_IDE is not set
-
-#
-# SCSI device support
-#
-CONFIG_SCSI=y
-CONFIG_SCSI_PROC_FS=y
-
-#
-# SCSI support type (disk, tape, CD-ROM)
-#
-CONFIG_BLK_DEV_SD=y
-CONFIG_CHR_DEV_ST=y
-# CONFIG_CHR_DEV_OSST is not set
-CONFIG_BLK_DEV_SR=y
-# CONFIG_BLK_DEV_SR_VENDOR is not set
-CONFIG_CHR_DEV_SG=y
-
-#
-# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
-#
-CONFIG_SCSI_MULTI_LUN=y
-# CONFIG_SCSI_CONSTANTS is not set
-# CONFIG_SCSI_LOGGING is not set
-
-#
-# SCSI Transport Attributes
-#
-CONFIG_SCSI_SPI_ATTRS=y
-CONFIG_SCSI_FC_ATTRS=m
-
-#
-# SCSI low-level drivers
-#
-# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
-# CONFIG_SCSI_3W_9XXX is not set
-# CONFIG_SCSI_ACARD is not set
-# CONFIG_SCSI_AACRAID is not set
-# CONFIG_SCSI_AIC7XXX is not set
-# CONFIG_SCSI_AIC7XXX_OLD is not set
-# CONFIG_SCSI_AIC79XX is not set
-# CONFIG_SCSI_ADVANSYS is not set
-# CONFIG_MEGARAID_NEWGEN is not set
-# CONFIG_MEGARAID_LEGACY is not set
-# CONFIG_SCSI_SATA is not set
-# CONFIG_SCSI_BUSLOGIC is not set
-# CONFIG_SCSI_CPQFCTS is not set
-# CONFIG_SCSI_DMX3191D is not set
-# CONFIG_SCSI_EATA is not set
-# CONFIG_SCSI_EATA_PIO is not set
-# CONFIG_SCSI_FUTURE_DOMAIN is not set
-# CONFIG_SCSI_GDTH is not set
-# CONFIG_SCSI_IPS is not set
-# CONFIG_SCSI_INITIO is not set
-# CONFIG_SCSI_INIA100 is not set
-CONFIG_SCSI_SYM53C8XX_2=y
-CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
-CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
-CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
-CONFIG_SCSI_SYM53C8XX_IOMAPPED=y
-# CONFIG_SCSI_IPR is not set
-# CONFIG_SCSI_PCI2000 is not set
-# CONFIG_SCSI_PCI2220I is not set
-# CONFIG_SCSI_QLOGIC_ISP is not set
-CONFIG_SCSI_QLOGIC_FC=m
-# CONFIG_SCSI_QLOGIC_FC_FIRMWARE is not set
-CONFIG_SCSI_QLOGIC_1280=m
-# CONFIG_SCSI_QLOGIC_1280_1040 is not set
-CONFIG_SCSI_QLA2XXX=y
-# CONFIG_SCSI_QLA21XX is not set
-# CONFIG_SCSI_QLA22XX is not set
-CONFIG_SCSI_QLA2300=m
-CONFIG_SCSI_QLA2322=m
-CONFIG_SCSI_QLA6312=m
-CONFIG_SCSI_QLA6322=m
-# CONFIG_SCSI_DC395x is not set
-# CONFIG_SCSI_DC390T is not set
-CONFIG_SCSI_DEBUG=m
-
-#
-# Multi-device support (RAID and LVM)
-#
-CONFIG_MD=y
-CONFIG_BLK_DEV_MD=y
-CONFIG_MD_LINEAR=y
-CONFIG_MD_RAID0=y
-CONFIG_MD_RAID1=y
-# CONFIG_MD_RAID10 is not set
-# CONFIG_MD_RAID5 is not set
-# CONFIG_MD_RAID6 is not set
-# CONFIG_MD_MULTIPATH is not set
-# CONFIG_MD_FAULTY is not set
-# CONFIG_BLK_DEV_DM is not set
-
-#
-# Fusion MPT device support
-#
-CONFIG_FUSION=m
-CONFIG_FUSION_MAX_SGE=40
-CONFIG_FUSION_CTL=m
-
-#
-# IEEE 1394 (FireWire) support
-#
-# CONFIG_IEEE1394 is not set
-
-#
-# I2O device support
-#
-# CONFIG_I2O is not set
-
-#
-# Networking support
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-CONFIG_PACKET=y
-CONFIG_PACKET_MMAP=y
-CONFIG_NETLINK_DEV=y
-CONFIG_UNIX=y
-CONFIG_NET_KEY=m
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-# CONFIG_IP_ADVANCED_ROUTER is not set
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
-CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
-# CONFIG_NET_IPIP is not set
-# CONFIG_NET_IPGRE is not set
-# CONFIG_IP_MROUTE is not set
-# CONFIG_ARPD is not set
-# CONFIG_SYN_COOKIES is not set
-CONFIG_INET_AH=m
-CONFIG_INET_ESP=m
-# CONFIG_INET_IPCOMP is not set
-# CONFIG_INET_TUNNEL is not set
-CONFIG_IP_TCPDIAG=y
-# CONFIG_IP_TCPDIAG_IPV6 is not set
-
-#
-# IP: Virtual Server Configuration
-#
-# CONFIG_IP_VS is not set
-# CONFIG_IPV6 is not set
-CONFIG_NETFILTER=y
-# CONFIG_NETFILTER_DEBUG is not set
-
-#
-# IP: Netfilter Configuration
-#
-CONFIG_IP_NF_CONNTRACK=m
-# CONFIG_IP_NF_CT_ACCT is not set
-# CONFIG_IP_NF_CONNTRACK_MARK is not set
-# CONFIG_IP_NF_CT_PROTO_SCTP is not set
-CONFIG_IP_NF_FTP=m
-CONFIG_IP_NF_IRC=m
-CONFIG_IP_NF_TFTP=m
-CONFIG_IP_NF_AMANDA=m
-CONFIG_IP_NF_QUEUE=m
-CONFIG_IP_NF_IPTABLES=m
-CONFIG_IP_NF_MATCH_LIMIT=m
-CONFIG_IP_NF_MATCH_IPRANGE=m
-CONFIG_IP_NF_MATCH_MAC=m
-CONFIG_IP_NF_MATCH_PKTTYPE=m
-CONFIG_IP_NF_MATCH_MARK=m
-CONFIG_IP_NF_MATCH_MULTIPORT=m
-CONFIG_IP_NF_MATCH_TOS=m
-CONFIG_IP_NF_MATCH_RECENT=m
-CONFIG_IP_NF_MATCH_ECN=m
-CONFIG_IP_NF_MATCH_DSCP=m
-CONFIG_IP_NF_MATCH_AH_ESP=m
-CONFIG_IP_NF_MATCH_LENGTH=m
-CONFIG_IP_NF_MATCH_TTL=m
-CONFIG_IP_NF_MATCH_TCPMSS=m
-CONFIG_IP_NF_MATCH_HELPER=m
-CONFIG_IP_NF_MATCH_STATE=m
-CONFIG_IP_NF_MATCH_CONNTRACK=m
-CONFIG_IP_NF_MATCH_OWNER=m
-CONFIG_IP_NF_MATCH_ADDRTYPE=m
-CONFIG_IP_NF_MATCH_REALM=m
-CONFIG_IP_NF_MATCH_SCTP=m
-CONFIG_IP_NF_MATCH_COMMENT=m
-CONFIG_IP_NF_MATCH_HASHLIMIT=m
-CONFIG_IP_NF_FILTER=m
-CONFIG_IP_NF_TARGET_REJECT=m
-CONFIG_IP_NF_TARGET_LOG=m
-CONFIG_IP_NF_TARGET_ULOG=m
-CONFIG_IP_NF_TARGET_TCPMSS=m
-CONFIG_IP_NF_NAT=m
-CONFIG_IP_NF_NAT_NEEDED=y
-CONFIG_IP_NF_TARGET_MASQUERADE=m
-CONFIG_IP_NF_TARGET_REDIRECT=m
-CONFIG_IP_NF_TARGET_NETMAP=m
-CONFIG_IP_NF_TARGET_SAME=m
-CONFIG_IP_NF_NAT_SNMP_BASIC=m
-CONFIG_IP_NF_NAT_IRC=m
-CONFIG_IP_NF_NAT_FTP=m
-CONFIG_IP_NF_NAT_TFTP=m
-CONFIG_IP_NF_NAT_AMANDA=m
-CONFIG_IP_NF_MANGLE=m
-CONFIG_IP_NF_TARGET_TOS=m
-CONFIG_IP_NF_TARGET_ECN=m
-CONFIG_IP_NF_TARGET_DSCP=m
-CONFIG_IP_NF_TARGET_MARK=m
-CONFIG_IP_NF_TARGET_CLASSIFY=m
-CONFIG_IP_NF_RAW=m
-CONFIG_IP_NF_TARGET_NOTRACK=m
-CONFIG_IP_NF_ARPTABLES=m
-CONFIG_IP_NF_ARPFILTER=m
-CONFIG_IP_NF_ARP_MANGLE=m
-# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
-# CONFIG_IP_NF_COMPAT_IPFWADM is not set
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=m
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_SCTP is not set
-# CONFIG_ATM is not set
-# CONFIG_BRIDGE is not set
-# CONFIG_VLAN_8021Q is not set
-# CONFIG_DECNET is not set
-CONFIG_LLC=m
-CONFIG_LLC2=m
-# CONFIG_IPX is not set
-# CONFIG_ATALK is not set
-# CONFIG_X25 is not set
-# CONFIG_LAPB is not set
-# CONFIG_NET_DIVERT is not set
-# CONFIG_ECONET is not set
-# CONFIG_WAN_ROUTER is not set
-
-#
-# QoS and/or fair queueing
-#
-# CONFIG_NET_SCHED is not set
-CONFIG_NET_CLS_ROUTE=y
-
-#
-# Network testing
-#
-CONFIG_NET_PKTGEN=m
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-# CONFIG_HAMRADIO is not set
-# CONFIG_IRDA is not set
-# CONFIG_BT is not set
-CONFIG_NETDEVICES=y
-CONFIG_DUMMY=m
-CONFIG_BONDING=m
-# CONFIG_EQUALIZER is not set
-CONFIG_TUN=m
-# CONFIG_ETHERTAP is not set
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
-CONFIG_NET_ETHERNET=y
-CONFIG_MII=m
-# CONFIG_HAPPYMEAL is not set
-# CONFIG_SUNGEM is not set
-CONFIG_NET_VENDOR_3COM=y
-CONFIG_VORTEX=m
-CONFIG_TYPHOON=m
-
-#
-# Tulip family network device support
-#
-CONFIG_NET_TULIP=y
-CONFIG_DE2104X=y
-CONFIG_TULIP=y
-# CONFIG_TULIP_MWI is not set
-CONFIG_TULIP_MMIO=y
-# CONFIG_TULIP_NAPI is not set
-# CONFIG_DE4X5 is not set
-# CONFIG_WINBOND_840 is not set
-# CONFIG_DM9102 is not set
-CONFIG_HP100=m
-CONFIG_NET_PCI=y
-CONFIG_PCNET32=m
-# CONFIG_AMD8111_ETH is not set
-# CONFIG_ADAPTEC_STARFIRE is not set
-# CONFIG_B44 is not set
-# CONFIG_FORCEDETH is not set
-# CONFIG_DGRS is not set
-CONFIG_EEPRO100=m
-# CONFIG_EEPRO100_PIO is not set
-CONFIG_E100=m
-CONFIG_E100_NAPI=y
-# CONFIG_FEALNX is not set
-CONFIG_NATSEMI=m
-# CONFIG_NE2K_PCI is not set
-# CONFIG_8139CP is not set
-CONFIG_8139TOO=m
-# CONFIG_8139TOO_PIO is not set
-# CONFIG_8139TOO_TUNE_TWISTER is not set
-# CONFIG_8139TOO_8129 is not set
-# CONFIG_8139_OLD_RX_RESET is not set
-# CONFIG_SIS900 is not set
-CONFIG_EPIC100=m
-# CONFIG_SUNDANCE is not set
-CONFIG_VIA_RHINE=m
-CONFIG_VIA_RHINE_MMIO=y
-
-#
-# Ethernet (1000 Mbit)
-#
-CONFIG_ACENIC=m
-CONFIG_ACENIC_OMIT_TIGON_I=y
-CONFIG_DL2K=m
-CONFIG_E1000=m
-CONFIG_E1000_NAPI=y
-# CONFIG_NS83820 is not set
-# CONFIG_HAMACHI is not set
-# CONFIG_YELLOWFIN is not set
-# CONFIG_R8169 is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_VIA_VELOCITY is not set
-CONFIG_TIGON3=m
-
-#
-# Ethernet (10000 Mbit)
-#
-CONFIG_IXGB=m
-CONFIG_IXGB_NAPI=y
-CONFIG_S2IO=m
-CONFIG_S2IO_NAPI=y
-
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-CONFIG_NET_RADIO=y
-
-#
-# Obsolete Wireless cards support (pre-802.11)
-#
-# CONFIG_STRIP is not set
-
-#
-# Wireless 802.11b ISA/PCI cards support
-#
-CONFIG_HERMES=m
-CONFIG_PLX_HERMES=m
-CONFIG_TMD_HERMES=m
-CONFIG_PCI_HERMES=m
-# CONFIG_ATMEL is not set
-
-#
-# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
-#
-# CONFIG_PRISM54 is not set
-CONFIG_NET_WIRELESS=y
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_PPP=m
-# CONFIG_PPP_MULTILINK is not set
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=m
-CONFIG_PPP_BSDCOMP=m
-# CONFIG_PPPOE is not set
-# CONFIG_SLIP is not set
-# CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# ISDN subsystem
-#
-# CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-
-#
-# Userland interfaces
-#
-# CONFIG_INPUT_MOUSEDEV is not set
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
-# CONFIG_INPUT_EVDEV is not set
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input I/O drivers
-#
-# CONFIG_GAMEPORT is not set
-CONFIG_SOUND_GAMEPORT=y
-# CONFIG_SERIO is not set
-
-#
-# Input Device Drivers
-#
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_MISC is not set
-
-#
-# Character devices
-#
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
-# CONFIG_SERIAL_NONSTANDARD is not set
-
-#
-# Serial drivers
-#
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_NR_UARTS=8
-CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_MANY_PORTS=y
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-# CONFIG_SERIAL_8250_DETECT_IRQ is not set
-# CONFIG_SERIAL_8250_MULTIPORT is not set
-# CONFIG_SERIAL_8250_RSA is not set
-
-#
-# Non-8250 serial port support
-#
-# CONFIG_SERIAL_MUX is not set
-CONFIG_PDC_CONSOLE=y
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-CONFIG_UNIX98_PTYS=y
-# CONFIG_LEGACY_PTYS is not set
-
-#
-# IPMI
-#
-# CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
-CONFIG_GEN_RTC=y
-CONFIG_GEN_RTC_X=y
-# CONFIG_DTLK is not set
-# CONFIG_R3964 is not set
-# CONFIG_APPLICOM is not set
-
-#
-# Ftape, the floppy tape device driver
-#
-# CONFIG_AGP is not set
-# CONFIG_DRM is not set
-CONFIG_RAW_DRIVER=y
-CONFIG_MAX_RAW_DEVS=256
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# Dallas's 1-wire bus
-#
-# CONFIG_W1 is not set
-
-#
-# Misc devices
-#
-
-#
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-
-#
-# Digital Video Broadcasting Devices
-#
-# CONFIG_DVB is not set
-
-#
-# Graphics support
-#
-# CONFIG_FB is not set
-
-#
-# Console display driver support
-#
-CONFIG_DUMMY_CONSOLE_COLUMNS=160
-CONFIG_DUMMY_CONSOLE_ROWS=64
-CONFIG_DUMMY_CONSOLE=y
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-# CONFIG_USB is not set
-CONFIG_USB_ARCH_HAS_HCD=y
-CONFIG_USB_ARCH_HAS_OHCI=y
-
-#
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
-#
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
-# CONFIG_MMC is not set
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_FS_XATTR is not set
-CONFIG_JBD=y
-# CONFIG_JBD_DEBUG is not set
-# CONFIG_REISERFS_FS is not set
-CONFIG_JFS_FS=m
-# CONFIG_JFS_POSIX_ACL is not set
-# CONFIG_JFS_DEBUG is not set
-# CONFIG_JFS_STATISTICS is not set
-CONFIG_FS_POSIX_ACL=y
-CONFIG_XFS_FS=m
-# CONFIG_XFS_RT is not set
-# CONFIG_XFS_QUOTA is not set
-# CONFIG_XFS_SECURITY is not set
-# CONFIG_XFS_POSIX_ACL is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
-# CONFIG_QUOTA is not set
-# CONFIG_DNOTIFY is not set
-# CONFIG_AUTOFS_FS is not set
-CONFIG_AUTOFS4_FS=y
-
-#
-# CD-ROM/DVD Filesystems
-#
-CONFIG_ISO9660_FS=y
-CONFIG_JOLIET=y
-# CONFIG_ZISOFS is not set
-CONFIG_UDF_FS=m
-CONFIG_UDF_NLS=y
-
-#
-# DOS/FAT/NT Filesystems
-#
-CONFIG_FAT_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=m
-CONFIG_FAT_DEFAULT_CODEPAGE=437
-CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_SYSFS=y
-# CONFIG_DEVFS_FS is not set
-# CONFIG_DEVPTS_FS_XATTR is not set
-CONFIG_TMPFS=y
-# CONFIG_TMPFS_XATTR is not set
-# CONFIG_HUGETLBFS is not set
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
-# CONFIG_BEFS_FS is not set
-# CONFIG_BFS_FS is not set
-# CONFIG_EFS_FS is not set
-# CONFIG_CRAMFS is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_SYSV_FS is not set
-CONFIG_UFS_FS=m
-# CONFIG_UFS_FS_WRITE is not set
-
-#
-# Network File Systems
-#
-CONFIG_NFS_FS=y
-CONFIG_NFS_V3=y
-CONFIG_NFS_V4=y
-CONFIG_NFS_DIRECTIO=y
-CONFIG_NFSD=m
-CONFIG_NFSD_V3=y
-CONFIG_NFSD_V4=y
-CONFIG_NFSD_TCP=y
-CONFIG_ROOT_NFS=y
-CONFIG_LOCKD=y
-CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=m
-CONFIG_SUNRPC=y
-CONFIG_SUNRPC_GSS=y
-CONFIG_RPCSEC_GSS_KRB5=y
-# CONFIG_RPCSEC_GSS_SPKM3 is not set
-CONFIG_SMB_FS=m
-CONFIG_SMB_NLS_DEFAULT=y
-CONFIG_SMB_NLS_REMOTE="cp437"
-CONFIG_CIFS=m
-# CONFIG_CIFS_STATS is not set
-# CONFIG_CIFS_XATTR is not set
-# CONFIG_CIFS_EXPERIMENTAL is not set
-# CONFIG_NCP_FS is not set
-# CONFIG_CODA_FS is not set
-# CONFIG_AFS_FS is not set
-
-#
-# Partition Types
-#
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
-CONFIG_NLS=y
-CONFIG_NLS_DEFAULT="iso8859-1"
-CONFIG_NLS_CODEPAGE_437=m
-# CONFIG_NLS_CODEPAGE_737 is not set
-# CONFIG_NLS_CODEPAGE_775 is not set
-CONFIG_NLS_CODEPAGE_850=m
-CONFIG_NLS_CODEPAGE_852=m
-# CONFIG_NLS_CODEPAGE_855 is not set
-# CONFIG_NLS_CODEPAGE_857 is not set
-# CONFIG_NLS_CODEPAGE_860 is not set
-# CONFIG_NLS_CODEPAGE_861 is not set
-# CONFIG_NLS_CODEPAGE_862 is not set
-CONFIG_NLS_CODEPAGE_863=m
-# CONFIG_NLS_CODEPAGE_864 is not set
-CONFIG_NLS_CODEPAGE_865=m
-# CONFIG_NLS_CODEPAGE_866 is not set
-# CONFIG_NLS_CODEPAGE_869 is not set
-# CONFIG_NLS_CODEPAGE_936 is not set
-# CONFIG_NLS_CODEPAGE_950 is not set
-# CONFIG_NLS_CODEPAGE_932 is not set
-# CONFIG_NLS_CODEPAGE_949 is not set
-# CONFIG_NLS_CODEPAGE_874 is not set
-# CONFIG_NLS_ISO8859_8 is not set
-# CONFIG_NLS_CODEPAGE_1250 is not set
-# CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ASCII is not set
-CONFIG_NLS_ISO8859_1=m
-CONFIG_NLS_ISO8859_2=m
-CONFIG_NLS_ISO8859_3=m
-CONFIG_NLS_ISO8859_4=m
-# CONFIG_NLS_ISO8859_5 is not set
-# CONFIG_NLS_ISO8859_6 is not set
-# CONFIG_NLS_ISO8859_7 is not set
-# CONFIG_NLS_ISO8859_9 is not set
-# CONFIG_NLS_ISO8859_13 is not set
-# CONFIG_NLS_ISO8859_14 is not set
-CONFIG_NLS_ISO8859_15=m
-# CONFIG_NLS_KOI8_R is not set
-# CONFIG_NLS_KOI8_U is not set
-CONFIG_NLS_UTF8=m
-
-#
-# Profiling support
-#
-CONFIG_PROFILING=y
-CONFIG_OPROFILE=m
-
-#
-# Kernel hacking
-#
-CONFIG_DEBUG_KERNEL=y
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_SCHEDSTATS is not set
-# CONFIG_DEBUG_SLAB is not set
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_KOBJECT is not set
-# CONFIG_DEBUG_INFO is not set
-
-#
-# Security options
-#
-# CONFIG_KEYS is not set
-# CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_NULL=m
-CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=m
-CONFIG_CRYPTO_SHA256=m
-CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WP512=m
-CONFIG_CRYPTO_DES=y
-CONFIG_CRYPTO_BLOWFISH=m
-CONFIG_CRYPTO_TWOFISH=m
-CONFIG_CRYPTO_SERPENT=m
-CONFIG_CRYPTO_AES=m
-CONFIG_CRYPTO_CAST5=m
-CONFIG_CRYPTO_CAST6=m
-CONFIG_CRYPTO_TEA=m
-# CONFIG_CRYPTO_ARC4 is not set
-CONFIG_CRYPTO_KHAZAD=m
-CONFIG_CRYPTO_ANUBIS=m
-CONFIG_CRYPTO_DEFLATE=m
-# CONFIG_CRYPTO_MICHAEL_MIC is not set
-CONFIG_CRYPTO_CRC32C=m
-CONFIG_CRYPTO_TEST=m
-
-#
-# Library routines
-#
-CONFIG_CRC_CCITT=m
-CONFIG_CRC32=y
-CONFIG_LIBCRC32C=m
-CONFIG_ZLIB_INFLATE=m
-CONFIG_ZLIB_DEFLATE=m
diff -Nru a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
--- a/arch/parisc/kernel/Makefile	2004-11-02 00:14:06 -08:00
+++ b/arch/parisc/kernel/Makefile	2005-03-02 03:25:23 -08:00
@@ -19,6 +19,6 @@
 obj-$(CONFIG_PA11)	+= pci-dma.o
 obj-$(CONFIG_PCI)	+= pci.o
 obj-$(CONFIG_MODULES)	+= module.o
-obj-$(CONFIG_PARISC64)	+= binfmt_elf32.o sys_parisc32.o ioctl32.o signal32.o
+obj-$(CONFIG_64BIT)	+= binfmt_elf32.o sys_parisc32.o ioctl32.o signal32.o
 # only supported for PCX-W/U in 64-bit mode at the moment
-obj-$(CONFIG_PARISC64)	+= perf.o perf_asm.o
+obj-$(CONFIG_64BIT)	+= perf.o perf_asm.o
diff -Nru a/arch/parisc/kernel/binfmt_elf32.c b/arch/parisc/kernel/binfmt_elf32.c
--- a/arch/parisc/kernel/binfmt_elf32.c	2005-01-11 16:42:35 -08:00
+++ b/arch/parisc/kernel/binfmt_elf32.c	2005-03-08 11:15:54 -08:00
@@ -37,7 +37,6 @@
 #include <linux/spinlock.h>
 #include <asm/processor.h>
 #include <linux/module.h>
-#include <linux/config.h>
 #include <linux/elfcore.h>
 #include <linux/compat.h>		/* struct compat_timeval */
 
diff -Nru a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
--- a/arch/parisc/kernel/drivers.c	2005-01-12 11:59:22 -08:00
+++ b/arch/parisc/kernel/drivers.c	2005-03-02 03:25:23 -08:00
@@ -10,7 +10,7 @@
  * Copyright (c) 2001 Matthew Wilcox for Hewlett Packard
  * Copyright (c) 2001 Helge Deller <deller@gmx.de>
  * Copyright (c) 2001,2002 Ryan Bradetich 
- * Copyright (c) 2004 Thibaut VARENE <varenet@parisc-linux.org>
+ * Copyright (c) 2004-2005 Thibaut VARENE <varenet@parisc-linux.org>
  * 
  * The file handles registering devices and drivers, then matching them.
  * It's the closest we get to a dating agency.
@@ -610,6 +610,24 @@
 		return parse_tree_node(parent, 6, modpath);
 }
 EXPORT_SYMBOL(hwpath_to_device);
+
+/**
+ * device_to_hwpath - Populates the hwpath corresponding to the given device.
+ * @param dev the target device
+ * @param path pointer to a previously allocated hwpath struct to be filled in
+ */
+void device_to_hwpath(struct device *dev, struct hardware_path *path)
+{
+	struct parisc_device *padev;
+	if (dev->bus == &parisc_bus_type) {
+		padev = to_parisc_device(dev);
+		get_node_path(dev->parent, path);
+		path->mod = padev->hw_path;
+	} else if (is_pci_dev(dev)) {
+		get_node_path(dev, path);
+	}
+}
+EXPORT_SYMBOL(device_to_hwpath);
 
 #define BC_PORT_MASK 0x8
 #define BC_LOWER_PORT 0x8
diff -Nru a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
--- a/arch/parisc/kernel/entry.S	2004-10-31 22:09:34 -08:00
+++ b/arch/parisc/kernel/entry.S	2005-03-08 11:15:54 -08:00
@@ -76,13 +76,11 @@
 	mtsp	%r0, %sr5
 	mtsp	%r0, %sr6
 	mtsp	%r0, %sr7
-	ldil	L%KERNEL_PSW, %r1
-	ldo	R%KERNEL_PSW(%r1), %r1
+	load32	KERNEL_PSW, %r1
 	mtctl	%r1, %cr22
 	mtctl	%r0, %cr17	/* Clear IIASQ tail */
 	mtctl	%r0, %cr17	/* Clear IIASQ head */
-	ldil	L%4f, %r1
-	ldo	R%4f(%r1), %r1
+	load32	4f, %r1
 	mtctl	%r1, %cr18	/* Set IIAOQ tail */
 	ldo	4(%r1), %r1
 	mtctl	%r1, %cr18	/* Set IIAOQ head */
@@ -197,8 +195,7 @@
 	/* HPMC handler */
 	.macro	hpmc code
 	nop			/* must be a NOP, will be patched later */
-	ldil	L%PA(os_hpmc), %r3
-	ldo	R%PA(os_hpmc)(%r3), %r3
+	load32	PA(os_hpmc), %r3
 	bv,n	0(%r3)
 	nop
 	.word	0		/* checksum (will be patched) */
@@ -860,8 +857,7 @@
 
 	callee_save
 
-	ldil	L%_switch_to_ret, %r2
-	ldo	R%_switch_to_ret(%r2), %r2
+	load32	_switch_to_ret, %r2
 
 	STREG	%r2, TASK_PT_KPC(%r26)
 	LDREG	TASK_PT_KPC(%r25), %r2
@@ -914,16 +910,13 @@
 	depi	3,31,2,%r19
 	STREG	%r19,PT_IAOQ1(%r16)
 	LDREG   PT_PSW(%r16),%r19
-	ldil    L%USER_PSW_MASK,%r1
-	ldo     R%USER_PSW_MASK(%r1),%r1
+	load32	USER_PSW_MASK,%r1
 #ifdef __LP64__
-	ldil    L%USER_PSW_HI_MASK,%r20
-	ldo     R%USER_PSW_HI_MASK(%r20),%r20
+	load32	USER_PSW_HI_MASK,%r20
 	depd    %r20,31,32,%r1
 #endif
 	and     %r19,%r1,%r19 /* Mask out bits that user shouldn't play with */
-	ldil    L%USER_PSW,%r1
-	ldo     R%USER_PSW(%r1),%r1
+	load32	USER_PSW,%r1
 	or      %r19,%r1,%r19 /* Make sure default USER_PSW bits are set */
 	STREG   %r19,PT_PSW(%r16)
 
@@ -955,8 +948,7 @@
 
 	.import irq_stat,data
 
-	ldil	L%irq_stat,%r19
-	ldo	R%irq_stat(%r19),%r19
+	load32	irq_stat,%r19
 #ifdef CONFIG_SMP
 	mfctl   %cr30,%r1
 	ldw	TI_CPU(%r1),%r1 /* get cpu # - int */
@@ -1079,7 +1071,7 @@
 	BL	do_signal,%r2
 	copy	%r0, %r26			/* sigset_t *oldset = NULL */
 
-	b	intr_restore
+	b	intr_check_sig
 	nop
 
 	/*
@@ -1607,8 +1599,7 @@
 
 #ifdef CONFIG_SMP
 	CMPIB=,n        0,spc,dbit_nolock_20w
-	ldil            L%PA(pa_dbit_lock),t0
-	ldo             R%PA(pa_dbit_lock)(t0),t0
+	load32		PA(pa_dbit_lock),t0
 
 dbit_spin_20w:
 	ldcw            0(t0),t1
@@ -1644,8 +1635,7 @@
 
 #ifdef CONFIG_SMP
 	CMPIB=,n        0,spc,dbit_nolock_11
-	ldil            L%PA(pa_dbit_lock),t0
-	ldo             R%PA(pa_dbit_lock)(t0),t0
+	load32		PA(pa_dbit_lock),t0
 
 dbit_spin_11:
 	ldcw            0(t0),t1
@@ -1685,8 +1675,7 @@
 
 #ifdef CONFIG_SMP
 	CMPIB=,n        0,spc,dbit_nolock_20
-	ldil            L%PA(pa_dbit_lock),t0
-	ldo             R%PA(pa_dbit_lock)(t0),t0
+	load32		PA(pa_dbit_lock),t0
 
 dbit_spin_20:
 	ldcw            0(t0),t1
@@ -2082,8 +2071,7 @@
 
 	.import irq_stat,data
 
-	ldil    L%irq_stat,%r19
-	ldo     R%irq_stat(%r19),%r19
+	load32	irq_stat,%r19
 
 #ifdef CONFIG_SMP
 	/* sched.h: int processor */
@@ -2282,7 +2270,7 @@
 	ldo	TASK_REGS(%r1), %r20		/* reload pt_regs */
 	reg_restore %r20
 
-	b,n     syscall_restore
+	b,n     syscall_check_sig
 
 	/*
 	 * get_register is used by the non access tlb miss handlers to
diff -Nru a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
--- a/arch/parisc/kernel/firmware.c	2005-01-20 21:02:14 -08:00
+++ b/arch/parisc/kernel/firmware.c	2005-03-08 11:15:54 -08:00
@@ -120,10 +120,10 @@
 #ifdef __LP64__
 	if(unlikely(parisc_narrow_firmware)) {
 		if((address & 0xff000000) == 0xf0000000)
-			return 0xf0f0f0f000000000 | (u32)address;
+			return 0xf0f0f0f000000000UL | (u32)address;
 
 		if((address & 0xf0000000) == 0xf0000000)
-			return 0xffffffff00000000 | (u32)address;
+			return 0xffffffff00000000UL | (u32)address;
 	}
 #endif
 	return address;
@@ -912,7 +912,7 @@
  *
  * Reset the system.
  */
-int pdc_do_reset()
+int pdc_do_reset(void)
 {
         int retval;
 
diff -Nru a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c
--- a/arch/parisc/kernel/hardware.c	2004-08-24 02:09:07 -07:00
+++ b/arch/parisc/kernel/hardware.c	2005-03-08 11:15:54 -08:00
@@ -1296,18 +1296,18 @@
 };
 
 char *cpu_name_version[][2] = {
-	[pcx]	{ "PA7000 (PCX)",	"1.0" },
-	[pcxs]	{ "PA7000 (PCX-S)",	"1.1a" },
-	[pcxt]	{ "PA7100 (PCX-T)",	"1.1b" },
-	[pcxt_]	{ "PA7200 (PCX-T')",	"1.1c" },
-	[pcxl]	{ "PA7100LC (PCX-L)",	"1.1d" },
-	[pcxl2]	{ "PA7300LC (PCX-L2)",	"1.1e" },
-	[pcxu]	{ "PA8000 (PCX-U)",	"2.0" },
-	[pcxu_]	{ "PA8200 (PCX-U+)",	"2.0" },
-	[pcxw]	{ "PA8500 (PCX-W)",	"2.0" },
-	[pcxw_]	{ "PA8600 (PCX-W+)",	"2.0" },
-	[pcxw2]	{ "PA8700 (PCX-W2)",	"2.0" },
-	[mako]	{ "PA8800 (Mako)",	"2.0" }
+	[pcx]	= { "PA7000 (PCX)",	"1.0" },
+	[pcxs]	= { "PA7000 (PCX-S)",	"1.1a" },
+	[pcxt]	= { "PA7100 (PCX-T)",	"1.1b" },
+	[pcxt_]	= { "PA7200 (PCX-T')",	"1.1c" },
+	[pcxl]	= { "PA7100LC (PCX-L)",	"1.1d" },
+	[pcxl2]	= { "PA7300LC (PCX-L2)",	"1.1e" },
+	[pcxu]	= { "PA8000 (PCX-U)",	"2.0" },
+	[pcxu_]	= { "PA8200 (PCX-U+)",	"2.0" },
+	[pcxw]	= { "PA8500 (PCX-W)",	"2.0" },
+	[pcxw_]	= { "PA8600 (PCX-W+)",	"2.0" },
+	[pcxw2]	= { "PA8700 (PCX-W2)",	"2.0" },
+	[mako]	= { "PA8800 (Mako)",	"2.0" }
 };
 
 const char * __init
diff -Nru a/arch/parisc/kernel/head.S b/arch/parisc/kernel/head.S
--- a/arch/parisc/kernel/head.S	2004-10-31 22:09:34 -08:00
+++ b/arch/parisc/kernel/head.S	2005-03-08 11:15:55 -08:00
@@ -71,47 +71,42 @@
 	stw,ma          %arg2,4(%r1)
 	stw,ma          %arg3,4(%r1)
 
-	/* Initialize startup VM. Just map first 8 MB of memory */
-	load32		PA(pg0),%r1
-
-#ifdef __LP64__
-	load32		PA(pmd0),%r5
-	shrd            %r5,PxD_VALUE_SHIFT,%r3	
-#else
-	shr		%r1,PxD_VALUE_SHIFT,%r3
-#endif
-        ldo             (PxD_FLAG_PRESENT+PxD_FLAG_VALID)(%r3),%r3	
-	
+	/* Initialize startup VM. Just map first 8/16 MB of memory */
 	load32		PA(swapper_pg_dir),%r4
 	mtctl		%r4,%cr24	/* Initialize kernel root pointer */
 	mtctl		%r4,%cr25	/* Initialize user root pointer */
 
 #ifdef __LP64__
+	/* Set pmd in pgd */
+	load32		PA(pmd0),%r5
+	shrd            %r5,PxD_VALUE_SHIFT,%r3	
+        ldo             (PxD_FLAG_PRESENT+PxD_FLAG_VALID)(%r3),%r3	
 	stw		%r3,ASM_PGD_ENTRY*ASM_PGD_ENTRY_SIZE(%r4)
-	shrd		%r1,PxD_VALUE_SHIFT,%r3
-	ldo		(PxD_FLAG_PRESENT+PxD_FLAG_VALID)(%r3),%r3
-	ldo		ASM_PMD_ENTRY*ASM_PMD_ENTRY_SIZE(%r5),%r5
+	ldo		ASM_PMD_ENTRY*ASM_PMD_ENTRY_SIZE(%r5),%r4
 #else
+	/* 2-level page table, so pmd == pgd */
         ldo             ASM_PGD_ENTRY*ASM_PGD_ENTRY_SIZE(%r4),%r4
 #endif
+
+	/* Fill in pmd with enough pte directories */
+	load32		PA(pg0),%r1
+	SHRREG		%r1,PxD_VALUE_SHIFT,%r3
+	ldo		(PxD_FLAG_PRESENT+PxD_FLAG_VALID)(%r3),%r3
+
 	ldi		ASM_PT_INITIAL,%r1
 
 1:
-#ifdef __LP64__
-	stw             %r3,0(%r5)
-#else
-	stw             %r3,0(%r4)
-#endif
-	
+	stw		%r3,0(%r4)
 	ldo		(ASM_PAGE_SIZE >> PxD_VALUE_SHIFT)(%r3),%r3
 	addib,>		-1,%r1,1b
-
 #ifdef __LP64__
-	ldo		ASM_PMD_ENTRY_SIZE(%r5),%r5
+	ldo             ASM_PMD_ENTRY_SIZE(%r4),%r4
 #else
-	ldo		ASM_PGD_ENTRY_SIZE(%r4),%r4
+	ldo             ASM_PGD_ENTRY_SIZE(%r4),%r4
 #endif
 
+
+	/* Now initialize the PTEs themselves */
 	ldo		_PAGE_KERNEL(%r0),%r3 /* Hardwired 0 phys addr start */
 	load32		PA(pg0),%r1
 
@@ -306,7 +301,7 @@
 	mtctl		%r11,%cr18	/* IIAOQ head */
 	ldo		4(%r11),%r11
 	mtctl		%r11,%cr18	/* IIAOQ tail */
-
+	
 	/* Jump to hyperspace */
 	rfi
 	nop
diff -Nru a/arch/parisc/kernel/hpmc.S b/arch/parisc/kernel/hpmc.S
--- a/arch/parisc/kernel/hpmc.S	2004-02-03 21:41:56 -08:00
+++ b/arch/parisc/kernel/hpmc.S	2005-03-08 11:15:55 -08:00
@@ -121,8 +121,7 @@
 
 	/* Setup stack pointer. */
 
-	ldil    L%PA(hpmc_stack),sp
-	ldo     R%PA(hpmc_stack)(sp),sp
+	load32	PA(hpmc_stack),sp
 	
 	ldo     128(sp),sp /* leave room for arguments */
 
@@ -135,8 +134,7 @@
 	mtctl   %r4,ipsw
 	mtctl   %r0,pcsq
 	mtctl   %r0,pcsq
-	ldil    L%PA(os_hpmc_1),%r4
-	ldo     R%PA(os_hpmc_1)(%r4),%r4
+	load32	PA(os_hpmc_1),%r4
 	mtctl   %r4,pcoq
 	ldo     4(%r4),%r4
 	mtctl   %r4,pcoq
@@ -155,12 +153,9 @@
 
 	ldo     PDC_PIM(%r0), arg0
 	ldo     PDC_PIM_HPMC(%r0),arg1          /* Transfer HPMC data */
-	ldil    L%PA(hpmc_raddr),arg2
-	ldo     R%PA(hpmc_raddr)(arg2),arg2
-	ldil    L%PA(hpmc_pim_data),arg3
-	ldo     R%PA(hpmc_pim_data)(arg3),arg3
-	ldil    L%HPMC_PIM_DATA_SIZE,%r4
-	ldo     R%HPMC_PIM_DATA_SIZE(%r4),%r4
+	load32	PA(hpmc_raddr),arg2
+	load32	PA(hpmc_pim_data),arg3
+	load32	HPMC_PIM_DATA_SIZE,%r4
 	stw     %r4,-52(sp)
 
 	ldil    L%PA(os_hpmc_2), rp
@@ -199,16 +194,13 @@
 
 	ldo     PDC_IODC(%r0),arg0
 	ldo     PDC_IODC_READ(%r0),arg1
-	ldil    L%PA(hpmc_raddr),arg2
-	ldo     R%PA(hpmc_raddr)(arg2),arg2
+	load32	PA(hpmc_raddr),arg2
 	ldw     BOOT_CONSOLE_HPA_OFFSET(%r0),arg3 /* console hpa */
 	ldo     PDC_IODC_RI_INIT(%r0),%r4
 	stw     %r4,-52(sp)
-	ldil    L%PA(hpmc_iodc_buf),%r4
-	ldo     R%PA(hpmc_iodc_buf)(%r4),%r4
+	load32	PA(hpmc_iodc_buf),%r4
 	stw     %r4,-56(sp)
-	ldil    L%HPMC_IODC_BUF_SIZE,%r4
-	ldo     R%HPMC_IODC_BUF_SIZE(%r4),%r4
+	load32	HPMC_IODC_BUF_SIZE,%r4
 	stw     %r4,-60(sp)
 
 	ldil    L%PA(os_hpmc_4),rp
@@ -225,16 +217,14 @@
 	ldw     BOOT_CONSOLE_SPA_OFFSET(%r0),arg2  /* console spa */
 	depi    0,31,11,arg2                       /* clear bits 21-31    */
 	ldo     BOOT_CONSOLE_PATH_OFFSET(%r0),arg3 /* console path */
-	ldil    L%PA(hpmc_raddr),%r4
-	ldo     R%PA(hpmc_raddr)(%r4),%r4
+	load32	PA(hpmc_raddr),%r4
 	stw     %r4, -52(sp)
 	stw     %r0, -56(sp)                    /* HV                  */
 	stw     %r0, -60(sp)                    /* HV                  */
 	stw     %r0, -64(sp)                    /* HV                  */
 	stw     %r0, -68(sp)                    /* lang, must be zero  */
 
-	ldil    L%PA(hpmc_iodc_buf),%r5
-	ldo     R%PA(hpmc_iodc_buf)(%r5),%r5
+	load32	PA(hpmc_iodc_buf),%r5
 	ldil    L%PA(os_hpmc_5),rp
 	bv      (%r5)
 	ldo     R%PA(os_hpmc_5)(rp),rp
@@ -249,8 +239,7 @@
 	 * we don't intend to ever return to user land anyway)
 	 */
 
-	ldil		L%PA(swapper_pg_dir),%r4
-	ldo		R%PA(swapper_pg_dir)(%r4),%r4
+	load32		PA(swapper_pg_dir),%r4
 	mtctl		%r4,%cr24	/* Initialize kernel root pointer */
 	mtctl		%r4,%cr25	/* Initialize user root pointer */
 
@@ -265,8 +254,7 @@
 
 	rsm 8,%r0           /* Clear Q bit */
 	ldi     1,%r8       /* Set trap code to "1" for HPMC */
-	ldil    L%PA(intr_save), %r1
-	ldo     R%PA(intr_save)(%r1), %r1
+	load32	PA(intr_save),%r1
 	be      0(%sr7,%r1)
 	nop
 
diff -Nru a/arch/parisc/kernel/ioctl32.c b/arch/parisc/kernel/ioctl32.c
--- a/arch/parisc/kernel/ioctl32.c	2004-02-25 02:31:13 -08:00
+++ b/arch/parisc/kernel/ioctl32.c	2005-03-08 11:15:55 -08:00
@@ -563,7 +563,7 @@
 
 #endif
 
-#define HANDLE_IOCTL(cmd, handler) { cmd, (ioctl_trans_handler_t)handler, 0 },
+#define HANDLE_IOCTL(cmd, handler) { cmd, (ioctl_trans_handler_t)handler, NULL },
 #define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd, sys_ioctl) 
 
 #define IOCTL_TABLE_START  struct ioctl_trans ioctl_start[] = {
diff -Nru a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
--- a/arch/parisc/kernel/irq.c	2005-01-12 11:59:23 -08:00
+++ b/arch/parisc/kernel/irq.c	2005-03-08 11:15:55 -08:00
@@ -5,6 +5,7 @@
  * Copyright (C) 1994, 1995, 1996, 1997, 1998 Ralf Baechle
  * Copyright (C) 1999 SuSE GmbH (Philipp Rumpf, prumpf@tux.org)
  * Copyright (C) 1999-2000 Grant Grundler
+ * Copyright (c) 2005 Matthew Wilcox
  *
  *    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
@@ -22,38 +23,19 @@
  */
 #include <linux/bitops.h>
 #include <linux/config.h>
-#include <linux/eisa.h>
 #include <linux/errno.h>
 #include <linux/init.h>
-#include <linux/module.h>
-#include <linux/signal.h>
-#include <linux/types.h>
-#include <linux/ioport.h>
-#include <linux/timex.h>
-#include <linux/slab.h>
-#include <linux/random.h>
-#include <linux/sched.h>
 #include <linux/interrupt.h>
 #include <linux/kernel_stat.h>
-#include <linux/irq.h>
 #include <linux/seq_file.h>
 #include <linux/spinlock.h>
+#include <linux/types.h>
 
-#include <asm/cache.h>
-#include <asm/pdc.h>
-
-#undef DEBUG_IRQ
 #undef PARISC_IRQ_CR16_COUNTS
 
 extern irqreturn_t timer_interrupt(int, void *, struct pt_regs *);
 extern irqreturn_t ipi_interrupt(int, void *, struct pt_regs *);
 
-#ifdef DEBUG_IRQ
-#define DBG_IRQ(irq, x)	if ((irq) != TIMER_IRQ) printk x
-#else /* DEBUG_IRQ */
-#define DBG_IRQ(irq, x)	do { } while (0)
-#endif /* DEBUG_IRQ */
-
 #define EIEM_MASK(irq)       (1UL<<(CPU_IRQ_MAX - irq))
 
 /* Bits in EIEM correlate with cpu_irq_action[].
@@ -200,7 +182,25 @@
 	return cpu_claim_irq(irq, NULL, NULL) ? -1 : irq;
 }
 
-int txn_alloc_irq(void)
+/*
+ * The bits_wide parameter accommodates the limitations of the HW/SW which
+ * use these bits:
+ * Legacy PA I/O (GSC/NIO): 5 bits (architected EIM register)
+ * V-class (EPIC):          6 bits
+ * N/L/A-class (iosapic):   8 bits
+ * PCI 2.2 MSI:            16 bits
+ * Some PCI devices:       32 bits (Symbios SCSI/ATM/HyperFabric)
+ *
+ * On the service provider side:
+ * o PA 1.1 (and PA2.0 narrow mode)     5-bits (width of EIR register)
+ * o PA 2.0 wide mode                   6-bits (per processor)
+ * o IA64                               8-bits (0-256 total)
+ *
+ * So a Legacy PA I/O device on a PA 2.0 box can't use all the bits supported
+ * by the processor...and the N/L-class I/O subsystem supports more bits than
+ * PA2.0 has. The first case is the problem.
+ */
+int txn_alloc_irq(unsigned int bits_wide)
 {
 	int irq;
 
@@ -208,6 +208,8 @@
 	for (irq = CPU_IRQ_BASE + 1; irq <= CPU_IRQ_MAX; irq++) {
 		if (cpu_claim_irq(irq, NULL, NULL) < 0)
 			continue;
+		if ((irq - CPU_IRQ_BASE) >= (1 << bits_wide))
+			continue;
 		return irq;
 	}
 
@@ -215,7 +217,7 @@
 	return -1;
 }
 
-unsigned long txn_alloc_addr(int virt_irq)
+unsigned long txn_alloc_addr(unsigned int virt_irq)
 {
 	static int next_cpu = -1;
 
@@ -233,36 +235,8 @@
 }
 
 
-/*
-** The alloc process needs to accept a parameter to accommodate limitations
-** of the HW/SW which use these bits:
-** Legacy PA I/O (GSC/NIO): 5 bits (architected EIM register)
-** V-class (EPIC):          6 bits
-** N/L-class/A500:          8 bits (iosapic)
-** PCI 2.2 MSI:             16 bits (I think)
-** Existing PCI devices:    32-bits (all Symbios SCSI/ATM/HyperFabric)
-**
-** On the service provider side:
-** o PA 1.1 (and PA2.0 narrow mode)     5-bits (width of EIR register)
-** o PA 2.0 wide mode                   6-bits (per processor)
-** o IA64                               8-bits (0-256 total)
-**
-** So a Legacy PA I/O device on a PA 2.0 box can't use all
-** the bits supported by the processor...and the N/L-class
-** I/O subsystem supports more bits than PA2.0 has. The first
-** case is the problem.
-*/
-unsigned int txn_alloc_data(int virt_irq, unsigned int bits_wide)
+unsigned int txn_alloc_data(unsigned int virt_irq)
 {
-	/* XXX FIXME : bits_wide indicates how wide the transaction
-	** data is allowed to be...we may need a different virt_irq
-	** if this one won't work. Another reason to index virtual
-	** irq's into a table which can manage CPU/IRQ bit separately.
-	*/
-	if ((virt_irq - CPU_IRQ_BASE) > (1 << (bits_wide - 1))) {
-		panic("Sorry -- didn't allocate valid IRQ for this device\n");
-	}
-
 	return virt_irq - CPU_IRQ_BASE;
 }
 
@@ -270,42 +244,35 @@
 void do_cpu_irq_mask(struct pt_regs *regs)
 {
 	unsigned long eirr_val;
-	unsigned int i=3;	/* limit time in interrupt context */
+
+	irq_enter();
 
 	/*
-	 * PSW_I or EIEM bits cannot be enabled until after the
-	 * interrupts are processed.
-	 * timer_interrupt() assumes it won't get interrupted when it
-	 * holds the xtime_lock...an unmasked interrupt source could
-	 * interrupt and deadlock by trying to grab xtime_lock too.
-	 * Keeping PSW_I and EIEM disabled avoids this.
+	 * Only allow interrupt processing to be interrupted by the
+	 * timer tick
 	 */
-	set_eiem(0UL);	/* disable all extr interrupt for now */
+	set_eiem(EIEM_MASK(TIMER_IRQ));
 
 	/* 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 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.
 	 */
 	for (;;) {
 		unsigned long bit = (1UL << (BITS_PER_LONG - 1));
 		unsigned int irq;
 		eirr_val = mfctl(23) & cpu_eiem;
-		if (!eirr_val || !i--)
+		if (!eirr_val)
 			break;
 
-		mtctl(eirr_val, 23); /* reset bits we are going to process */
+		if (eirr_val & EIEM_MASK(TIMER_IRQ))
+			set_eiem(0);
 
-#ifdef DEBUG_IRQ
-		if (eirr_val != (1UL << MAX_CPU_IRQ))
-			printk(KERN_DEBUG "do_cpu_irq_mask  0x%x & 0x%x\n", eirr_val, cpu_eiem);
-#endif
+		mtctl(eirr_val, 23); /* reset bits we are going to process */
 
 		/* Work our way from MSb to LSb...same order we alloc EIRs */
 		for (irq = TIMER_IRQ; eirr_val && bit; bit>>=1, irq++) {
-			if (!(bit & eirr_val & cpu_eiem))
+			if (!(bit & eirr_val))
 				continue;
 
 			/* clear bit in mask - can exit loop sooner */
@@ -315,6 +282,7 @@
 		}
 	}
 	set_eiem(cpu_eiem);
+	irq_exit();
 }
 
 
diff -Nru a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S
--- a/arch/parisc/kernel/pacache.S	2004-10-31 22:09:35 -08:00
+++ b/arch/parisc/kernel/pacache.S	2005-03-02 03:25:24 -08:00
@@ -27,17 +27,17 @@
  */
 
 #ifdef __LP64__
-#define ADDIB   addib,*
-#define CMPB    cmpb,*
-#define ANDCM   andcm,*
+#define ADDIB	addib,*
+#define CMPB	cmpb,*
+#define ANDCM	andcm,*
 
-	.level 2.0w
+	.level	2.0w
 #else
-#define ADDIB   addib,
-#define CMPB    cmpb,
-#define ANDCM   andcm
+#define ADDIB	addib,
+#define CMPB	cmpb,
+#define ANDCM	andcm
 
-	.level 2.0
+	.level	2.0
 #endif
 
 #include <asm/assembly.h>
@@ -46,7 +46,7 @@
 #include <asm/cache.h>
 
 	.text
-	.align 128
+	.align	128
 
 	.export flush_tlb_all_local,code
 
@@ -68,7 +68,7 @@
 	 * consolidated.
 	 */
 
-	rsm     PSW_SM_I,%r19	/* relied upon translation! PA 2.0 Arch. F-5 */
+	rsm		PSW_SM_I, %r19		/* relied upon translation! PA 2.0 Arch. F-5 */
 	nop
 	nop
 	nop
@@ -77,127 +77,127 @@
 	nop
 	nop
 	
-	rsm     PSW_SM_Q,%r0       /* Turn off Q bit to load iia queue */
-	ldil    L%REAL_MODE_PSW, %r1
-	ldo     R%REAL_MODE_PSW(%r1), %r1
-	mtctl	%r1, %cr22
-	mtctl	%r0, %cr17	/* Clear IIASQ tail */
-	mtctl	%r0, %cr17	/* Clear IIASQ head */
-	ldil    L%PA(1f),%r1
-	ldo     R%PA(1f)(%r1),%r1
-	mtctl	%r1, %cr18	/* IIAOQ head */
-	ldo	4(%r1), %r1
-	mtctl	%r1, %cr18	/* IIAOQ tail */
+	rsm		PSW_SM_Q, %r0		/* Turn off Q bit to load iia queue */
+	ldil		L%REAL_MODE_PSW, %r1
+	ldo		R%REAL_MODE_PSW(%r1), %r1
+	mtctl		%r1, %cr22
+	mtctl		%r0, %cr17		/* Clear IIASQ tail */
+	mtctl		%r0, %cr17		/* Clear IIASQ head */
+	ldil		L%PA(1f), %r1
+	ldo		R%PA(1f)(%r1), %r1
+	mtctl		%r1, %cr18		/* IIAOQ head */
+	ldo		4(%r1), %r1
+	mtctl		%r1, %cr18		/* IIAOQ tail */
 	rfi
 	nop
 
-1:      ldil            L%PA(cache_info),%r1
-	ldo             R%PA(cache_info)(%r1),%r1
+1:      ldil		L%PA(cache_info), %r1
+	ldo		R%PA(cache_info)(%r1), %r1
 
 	/* Flush Instruction Tlb */
 
-	LDREG           ITLB_SID_BASE(%r1),%r20
-	LDREG           ITLB_SID_STRIDE(%r1),%r21
-	LDREG           ITLB_SID_COUNT(%r1),%r22
-	LDREG           ITLB_OFF_BASE(%r1),%arg0
-	LDREG           ITLB_OFF_STRIDE(%r1),%arg1
-	LDREG           ITLB_OFF_COUNT(%r1),%arg2
-	LDREG           ITLB_LOOP(%r1),%arg3
-
-	ADDIB=          -1,%arg3,fitoneloop     /* Preadjust and test */
-	movb,<,n        %arg3,%r31,fitdone      /* If loop < 0, skip */
-	copy            %arg0,%r28              /* Init base addr */
-
-fitmanyloop:                                    /* Loop if LOOP >= 2 */
-	mtsp            %r20,%sr1
-	add             %r21,%r20,%r20          /* increment space */
-	copy            %arg2,%r29              /* Init middle loop count */
-
-fitmanymiddle:                                  /* Loop if LOOP >= 2 */
-	ADDIB>          -1,%r31,fitmanymiddle   /* Adjusted inner loop decr */
-	pitlbe          0(%sr1,%r28)
-	pitlbe,m        %arg1(%sr1,%r28)        /* Last pitlbe and addr adjust */
-	ADDIB>          -1,%r29,fitmanymiddle   /* Middle loop decr */
-	copy            %arg3,%r31              /* Re-init inner loop count */
-
-	movb,tr         %arg0,%r28,fitmanyloop  /* Re-init base addr */
-	ADDIB<=,n       -1,%r22,fitdone         /* Outer loop count decr */
-
-fitoneloop:                                     /* Loop if LOOP = 1 */
-	mtsp            %r20,%sr1
-	copy            %arg0,%r28              /* init base addr */
-	copy            %arg2,%r29              /* init middle loop count */
-
-fitonemiddle:                                   /* Loop if LOOP = 1 */
-	ADDIB>          -1,%r29,fitonemiddle    /* Middle loop count decr */
-	pitlbe,m        %arg1(%sr1,%r28)        /* pitlbe for one loop */
+	LDREG		ITLB_SID_BASE(%r1), %r20
+	LDREG		ITLB_SID_STRIDE(%r1), %r21
+	LDREG		ITLB_SID_COUNT(%r1), %r22
+	LDREG		ITLB_OFF_BASE(%r1), %arg0
+	LDREG		ITLB_OFF_STRIDE(%r1), %arg1
+	LDREG		ITLB_OFF_COUNT(%r1), %arg2
+	LDREG		ITLB_LOOP(%r1), %arg3
+
+	ADDIB=		-1, %arg3, fitoneloop	/* Preadjust and test */
+	movb,<,n	%arg3, %r31, fitdone	/* If loop < 0, skip */
+	copy		%arg0, %r28		/* Init base addr */
+
+fitmanyloop:					/* Loop if LOOP >= 2 */
+	mtsp		%r20, %sr1
+	add		%r21, %r20, %r20	/* increment space */
+	copy		%arg2, %r29		/* Init middle loop count */
+
+fitmanymiddle:					/* Loop if LOOP >= 2 */
+	ADDIB>		-1, %r31, fitmanymiddle	/* Adjusted inner loop decr */
+	pitlbe		0(%sr1, %r28)
+	pitlbe,m	%arg1(%sr1, %r28)	/* Last pitlbe and addr adjust */
+	ADDIB>		-1, %r29, fitmanymiddle	/* Middle loop decr */
+	copy		%arg3, %r31		/* Re-init inner loop count */
+
+	movb,tr		%arg0, %r28, fitmanyloop /* Re-init base addr */
+	ADDIB<=,n	-1, %r22, fitdone	/* Outer loop count decr */
+
+fitoneloop:					/* Loop if LOOP = 1 */
+	mtsp		%r20, %sr1
+	copy		%arg0, %r28		/* init base addr */
+	copy		%arg2, %r29		/* init middle loop count */
+
+fitonemiddle:					/* Loop if LOOP = 1 */
+	ADDIB>		-1, %r29, fitonemiddle	/* Middle loop count decr */
+	pitlbe,m	%arg1(%sr1, %r28)	/* pitlbe for one loop */
 
-	ADDIB>          -1,%r22,fitoneloop      /* Outer loop count decr */
-	add             %r21,%r20,%r20          /* increment space */
+	ADDIB>		-1, %r22, fitoneloop	/* Outer loop count decr */
+	add		%r21, %r20, %r20		/* increment space */
 
 fitdone:
 
 	/* Flush Data Tlb */
 
-	LDREG           DTLB_SID_BASE(%r1),%r20
-	LDREG           DTLB_SID_STRIDE(%r1),%r21
-	LDREG           DTLB_SID_COUNT(%r1),%r22
-	LDREG           DTLB_OFF_BASE(%r1),%arg0
-	LDREG           DTLB_OFF_STRIDE(%r1),%arg1
-	LDREG           DTLB_OFF_COUNT(%r1),%arg2
-	LDREG           DTLB_LOOP(%r1),%arg3
-
-	ADDIB=          -1,%arg3,fdtoneloop     /* Preadjust and test */
-	movb,<,n        %arg3,%r31,fdtdone      /* If loop < 0, skip */
-	copy            %arg0,%r28              /* Init base addr */
-
-fdtmanyloop:                                    /* Loop if LOOP >= 2 */
-	mtsp            %r20,%sr1
-	add             %r21,%r20,%r20          /* increment space */
-	copy            %arg2,%r29              /* Init middle loop count */
-
-fdtmanymiddle:                                  /* Loop if LOOP >= 2 */
-	ADDIB>          -1,%r31,fdtmanymiddle   /* Adjusted inner loop decr */
-	pdtlbe          0(%sr1,%r28)
-	pdtlbe,m        %arg1(%sr1,%r28)        /* Last pdtlbe and addr adjust */
-	ADDIB>          -1,%r29,fdtmanymiddle   /* Middle loop decr */
-	copy            %arg3,%r31              /* Re-init inner loop count */
-
-	movb,tr         %arg0,%r28,fdtmanyloop  /* Re-init base addr */
-	ADDIB<=,n       -1,%r22,fdtdone         /* Outer loop count decr */
-
-fdtoneloop:                                     /* Loop if LOOP = 1 */
-	mtsp            %r20,%sr1
-	copy            %arg0,%r28              /* init base addr */
-	copy            %arg2,%r29              /* init middle loop count */
-
-fdtonemiddle:                                   /* Loop if LOOP = 1 */
-	ADDIB>          -1,%r29,fdtonemiddle    /* Middle loop count decr */
-	pdtlbe,m        %arg1(%sr1,%r28)        /* pdtlbe for one loop */
+	LDREG		DTLB_SID_BASE(%r1), %r20
+	LDREG		DTLB_SID_STRIDE(%r1), %r21
+	LDREG		DTLB_SID_COUNT(%r1), %r22
+	LDREG		DTLB_OFF_BASE(%r1), %arg0
+	LDREG		DTLB_OFF_STRIDE(%r1), %arg1
+	LDREG		DTLB_OFF_COUNT(%r1), %arg2
+	LDREG		DTLB_LOOP(%r1), %arg3
+
+	ADDIB=		-1, %arg3, fdtoneloop	/* Preadjust and test */
+	movb,<,n	%arg3, %r31, fdtdone	/* If loop < 0, skip */
+	copy		%arg0, %r28		/* Init base addr */
+
+fdtmanyloop:					/* Loop if LOOP >= 2 */
+	mtsp		%r20, %sr1
+	add		%r21, %r20, %r20	/* increment space */
+	copy		%arg2, %r29		/* Init middle loop count */
+
+fdtmanymiddle:					/* Loop if LOOP >= 2 */
+	ADDIB>		-1, %r31, fdtmanymiddle	/* Adjusted inner loop decr */
+	pdtlbe		0(%sr1, %r28)
+	pdtlbe,m	%arg1(%sr1, %r28)	/* Last pdtlbe and addr adjust */
+	ADDIB>		-1, %r29, fdtmanymiddle	/* Middle loop decr */
+	copy		%arg3, %r31		/* Re-init inner loop count */
+
+	movb,tr		%arg0, %r28, fdtmanyloop /* Re-init base addr */
+	ADDIB<=,n	-1, %r22,fdtdone	/* Outer loop count decr */
+
+fdtoneloop:					/* Loop if LOOP = 1 */
+	mtsp		%r20, %sr1
+	copy		%arg0, %r28		/* init base addr */
+	copy		%arg2, %r29		/* init middle loop count */
+
+fdtonemiddle:					/* Loop if LOOP = 1 */
+	ADDIB>		-1, %r29, fdtonemiddle	/* Middle loop count decr */
+	pdtlbe,m	%arg1(%sr1, %r28)	/* pdtlbe for one loop */
 
-	ADDIB>          -1,%r22,fdtoneloop      /* Outer loop count decr */
-	add             %r21,%r20,%r20          /* increment space */
+	ADDIB>		-1, %r22, fdtoneloop	/* Outer loop count decr */
+	add		%r21, %r20, %r20	/* increment space */
 
 fdtdone:
 
 	/* Switch back to virtual mode */
 
-	rsm     PSW_SM_Q,%r0       /* clear Q bit to load iia queue */
-	ldil	L%KERNEL_PSW, %r1
-	ldo	R%KERNEL_PSW(%r1), %r1
-	or      %r1,%r19,%r1    /* Set I bit if set on entry */
-	mtctl	%r1, %cr22
-	mtctl	%r0, %cr17	/* Clear IIASQ tail */
-	mtctl	%r0, %cr17	/* Clear IIASQ head */
-	ldil    L%(2f), %r1
-	ldo     R%(2f)(%r1), %r1
-	mtctl	%r1, %cr18	/* IIAOQ head */
-	ldo	4(%r1), %r1
-	mtctl	%r1, %cr18	/* IIAOQ tail */
+	rsm		PSW_SM_Q, %r0		/* clear Q bit to load iia queue */
+	ldil		L%KERNEL_PSW, %r1
+	ldo		R%KERNEL_PSW(%r1), %r1
+	or		%r1, %r19, %r1		/* Set I bit if set on entry */
+	mtctl		%r1, %cr22
+	mtctl		%r0, %cr17		/* Clear IIASQ tail */
+	mtctl		%r0, %cr17		/* Clear IIASQ head */
+	ldil		L%(2f), %r1
+	ldo		R%(2f)(%r1), %r1
+	mtctl		%r1, %cr18		/* IIAOQ head */
+	ldo		4(%r1), %r1
+	mtctl		%r1, %cr18		/* IIAOQ tail */
 	rfi
 	nop
 
-2:      bv      %r0(%r2)
+2:      bv		%r0(%r2)
 	nop
 	.exit
 
@@ -211,140 +211,198 @@
 	.callinfo NO_CALLS
 	.entry
 
-	mtsp            %r0,%sr1
-	ldil            L%cache_info,%r1
-	ldo             R%cache_info(%r1),%r1
+	mtsp		%r0, %sr1
+	ldil		L%cache_info, %r1
+	ldo		R%cache_info(%r1), %r1
 
 	/* Flush Instruction Cache */
 
-	LDREG           ICACHE_BASE(%r1),%arg0
-	LDREG           ICACHE_STRIDE(%r1),%arg1
-	LDREG           ICACHE_COUNT(%r1),%arg2
-	LDREG           ICACHE_LOOP(%r1),%arg3
-	rsm             PSW_SM_I,%r22		/* No mmgt ops during loop*/
-	ADDIB=          -1,%arg3,fioneloop      /* Preadjust and test */
-	movb,<,n        %arg3,%r31,fisync       /* If loop < 0, do sync */
-
-fimanyloop:                                     /* Loop if LOOP >= 2 */
-	ADDIB>          -1,%r31,fimanyloop      /* Adjusted inner loop decr */
-	fice            0(%sr1,%arg0)
-	fice,m          %arg1(%sr1,%arg0)       /* Last fice and addr adjust */
-	movb,tr         %arg3,%r31,fimanyloop   /* Re-init inner loop count */
-	ADDIB<=,n       -1,%arg2,fisync         /* Outer loop decr */
-
-fioneloop:                                      /* Loop if LOOP = 1 */
-	ADDIB>          -1,%arg2,fioneloop      /* Outer loop count decr */
-	fice,m          %arg1(%sr1,%arg0)       /* Fice for one loop */
+	LDREG		ICACHE_BASE(%r1), %arg0
+	LDREG		ICACHE_STRIDE(%r1), %arg1
+	LDREG		ICACHE_COUNT(%r1), %arg2
+	LDREG		ICACHE_LOOP(%r1), %arg3
+	rsm             PSW_SM_I, %r22		/* No mmgt ops during loop*/
+	ADDIB=		-1, %arg3, fioneloop	/* Preadjust and test */
+	movb,<,n	%arg3, %r31, fisync	/* If loop < 0, do sync */
+
+fimanyloop:					/* Loop if LOOP >= 2 */
+	ADDIB>		-1, %r31, fimanyloop	/* Adjusted inner loop decr */
+	fice            0(%sr1, %arg0)
+	fice,m		%arg1(%sr1, %arg0)	/* Last fice and addr adjust */
+	movb,tr		%arg3, %r31, fimanyloop	/* Re-init inner loop count */
+	ADDIB<=,n	-1, %arg2, fisync	/* Outer loop decr */
+
+fioneloop:					/* Loop if LOOP = 1 */
+	ADDIB>		-1, %arg2, fioneloop	/* Outer loop count decr */
+	fice,m		%arg1(%sr1, %arg0)	/* Fice for one loop */
 
 fisync:
 	sync
-	mtsm	%r22
-	bv      %r0(%r2)
+	mtsm		%r22
+	bv		%r0(%r2)
 	nop
 	.exit
 
 	.procend
 
-	.export flush_data_cache_local,code
-	.import cache_info,data
+	.export flush_data_cache_local, code
+	.import cache_info, data
 
 flush_data_cache_local:
 	.proc
 	.callinfo NO_CALLS
 	.entry
 
-	mtsp            %r0,%sr1
-	ldil            L%cache_info,%r1
-	ldo             R%cache_info(%r1),%r1
+	mtsp		%r0, %sr1
+	ldil		L%cache_info, %r1
+	ldo		R%cache_info(%r1), %r1
 
 	/* Flush Data Cache */
 
-	LDREG           DCACHE_BASE(%r1),%arg0
-	LDREG           DCACHE_STRIDE(%r1),%arg1
-	LDREG           DCACHE_COUNT(%r1),%arg2
-	LDREG           DCACHE_LOOP(%r1),%arg3
-	rsm             PSW_SM_I,%r22
-	ADDIB=          -1,%arg3,fdoneloop      /* Preadjust and test */
-	movb,<,n        %arg3,%r31,fdsync       /* If loop < 0, do sync */
-
-fdmanyloop:                                     /* Loop if LOOP >= 2 */
-	ADDIB>          -1,%r31,fdmanyloop      /* Adjusted inner loop decr */
-	fdce            0(%sr1,%arg0)
-	fdce,m          %arg1(%sr1,%arg0)       /* Last fdce and addr adjust */
-	movb,tr         %arg3,%r31,fdmanyloop   /* Re-init inner loop count */
-	ADDIB<=,n       -1,%arg2,fdsync         /* Outer loop decr */
-
-fdoneloop:                                      /* Loop if LOOP = 1 */
-	ADDIB>          -1,%arg2,fdoneloop      /* Outer loop count decr */
-	fdce,m          %arg1(%sr1,%arg0)       /* Fdce for one loop */
+	LDREG		DCACHE_BASE(%r1), %arg0
+	LDREG		DCACHE_STRIDE(%r1), %arg1
+	LDREG		DCACHE_COUNT(%r1), %arg2
+	LDREG		DCACHE_LOOP(%r1), %arg3
+	rsm		PSW_SM_I, %r22
+	ADDIB=		-1, %arg3, fdoneloop	/* Preadjust and test */
+	movb,<,n	%arg3, %r31, fdsync	/* If loop < 0, do sync */
+
+fdmanyloop:					/* Loop if LOOP >= 2 */
+	ADDIB>		-1, %r31, fdmanyloop	/* Adjusted inner loop decr */
+	fdce		0(%sr1, %arg0)
+	fdce,m		%arg1(%sr1, %arg0)	/* Last fdce and addr adjust */
+	movb,tr		%arg3, %r31, fdmanyloop	/* Re-init inner loop count */
+	ADDIB<=,n	-1, %arg2, fdsync	/* Outer loop decr */
+
+fdoneloop:					/* Loop if LOOP = 1 */
+	ADDIB>		-1, %arg2, fdoneloop	/* Outer loop count decr */
+	fdce,m		%arg1(%sr1, %arg0)	/* Fdce for one loop */
 
 fdsync:
 	syncdma
 	sync
-	mtsm    %r22
-	bv      %r0(%r2)
+	mtsm		%r22
+	bv		%r0(%r2)
 	nop
 	.exit
 
 	.procend
 
 	.export copy_user_page_asm,code
+	.align	16
 
 copy_user_page_asm:
 	.proc
 	.callinfo NO_CALLS
 	.entry
 
-	ldi 64,%r1
+#ifdef __LP64__
+	/* PA8x00 CPUs can consume 2 loads or 1 store per cycle.
+	 * Unroll the loop by hand and arrange insn appropriately.
+	 * GCC probably can do this just as well.
+	 */
+
+	ldd		0(%r25), %r19
+	ldi		32, %r1                 /* PAGE_SIZE/128 == 32 */
+	ldw		64(%r25), %r0		/* prefetch 1 cacheline ahead */
+	ldw		128(%r25), %r0		/* prefetch 2 */
+
+1:	ldd		8(%r25), %r20
+	ldw		192(%r25), %r0		/* prefetch 3 */
+	ldw		256(%r25), %r0		/* prefetch 4 */
+
+	ldd		16(%r25), %r21
+	ldd		24(%r25), %r22
+	std		%r19, 0(%r26)
+	std		%r20, 8(%r26)
+
+	ldd		32(%r25), %r19
+	ldd		40(%r25), %r20
+	std		%r21, 16(%r26)
+	std		%r22, 24(%r26)
+
+	ldd		48(%r25), %r21
+	ldd		56(%r25), %r22
+	std		%r19, 32(%r26)
+	std		%r20, 40(%r26)
+
+	ldd		64(%r25), %r19
+	ldd		72(%r25), %r20
+	std		%r21, 48(%r26)
+	std		%r22, 56(%r26)
+
+	ldd		80(%r25), %r21
+	ldd		88(%r25), %r22
+	std		%r19, 64(%r26)
+	std		%r20, 72(%r26)
+
+	ldd		 96(%r25), %r19
+	ldd		104(%r25), %r20
+	std		%r21, 80(%r26)
+	std		%r22, 88(%r26)
+
+	ldd		112(%r25), %r21
+	ldd		120(%r25), %r22
+	std		%r19, 96(%r26)
+	std		%r20, 104(%r26)
+
+	ldo		128(%r25), %r25
+	std		%r21, 112(%r26)
+	std		%r22, 120(%r26)
+	ldo		128(%r26), %r26
+
+	ADDIB>		-1, %r1, 1b		/* bundle 10 */
+	ldd		0(%r25), %r19		/* start next loads */
+
+#else
 
 	/*
 	 * This loop is optimized for PCXL/PCXL2 ldw/ldw and stw/stw
-	 * bundles (very restricted rules for bundling). It probably
-	 * does OK on PCXU and better, but we could do better with
-	 * ldd/std instructions. Note that until (if) we start saving
+	 * bundles (very restricted rules for bundling).
+	 * Note that until (if) we start saving
 	 * the full 64 bit register values on interrupt, we can't
 	 * use ldd/std on a 32 bit kernel.
 	 */
-
+	ldi		64, %r1		/* PAGE_SIZE/64 == 64 */
 
 1:
-	ldw 0(%r25),%r19
-	ldw 4(%r25),%r20
-	ldw 8(%r25),%r21
-	ldw 12(%r25),%r22
-	stw %r19,0(%r26)
-	stw %r20,4(%r26)
-	stw %r21,8(%r26)
-	stw %r22,12(%r26)
-	ldw 16(%r25),%r19
-	ldw 20(%r25),%r20
-	ldw 24(%r25),%r21
-	ldw 28(%r25),%r22
-	stw %r19,16(%r26)
-	stw %r20,20(%r26)
-	stw %r21,24(%r26)
-	stw %r22,28(%r26)
-	ldw 32(%r25),%r19
-	ldw 36(%r25),%r20
-	ldw 40(%r25),%r21
-	ldw 44(%r25),%r22
-	stw %r19,32(%r26)
-	stw %r20,36(%r26)
-	stw %r21,40(%r26)
-	stw %r22,44(%r26)
-	ldw 48(%r25),%r19
-	ldw 52(%r25),%r20
-	ldw 56(%r25),%r21
-	ldw 60(%r25),%r22
-	stw %r19,48(%r26)
-	stw %r20,52(%r26)
-	stw %r21,56(%r26)
-	stw %r22,60(%r26)
-	ldo 64(%r26),%r26
-	ADDIB>  -1,%r1,1b
-	ldo 64(%r25),%r25
-
-	bv      %r0(%r2)
+	ldw		0(%r25), %r19
+	ldw		4(%r25), %r20
+	ldw		8(%r25), %r21
+	ldw		12(%r25), %r22
+	stw		%r19, 0(%r26)
+	stw		%r20, 4(%r26)
+	stw		%r21, 8(%r26)
+	stw		%r22, 12(%r26)
+	ldw		16(%r25), %r19
+	ldw		20(%r25), %r20
+	ldw		24(%r25), %r21
+	ldw		28(%r25), %r22
+	stw		%r19, 16(%r26)
+	stw		%r20, 20(%r26)
+	stw		%r21, 24(%r26)
+	stw		%r22, 28(%r26)
+	ldw		32(%r25), %r19
+	ldw		36(%r25), %r20
+	ldw		40(%r25), %r21
+	ldw		44(%r25), %r22
+	stw		%r19, 32(%r26)
+	stw		%r20, 36(%r26)
+	stw		%r21, 40(%r26)
+	stw		%r22, 44(%r26)
+	ldw		48(%r25), %r19
+	ldw		52(%r25), %r20
+	ldw		56(%r25), %r21
+	ldw		60(%r25), %r22
+	stw		%r19, 48(%r26)
+	stw		%r20, 52(%r26)
+	stw		%r21, 56(%r26)
+	stw		%r22, 60(%r26)
+	ldo		64(%r26), %r26
+	ADDIB>		-1, %r1, 1b
+	ldo		64(%r25), %r25
+#endif
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -393,33 +451,33 @@
 	.callinfo NO_CALLS
 	.entry
 
-	ldil    L%(__PAGE_OFFSET),%r1
-	sub     %r26,%r1,%r26
-	sub     %r25,%r1,%r23  /* move physical addr into non shadowed reg */
-
-	ldil    L%(TMPALIAS_MAP_START),%r28
-#ifdef __LP64__
-	extrd,u %r26,56,32,%r26 /* convert phys addr to tlb insert format */
-	extrd,u %r23,56,32,%r23 /* convert phys addr to tlb insert format */
-	depd    %r24,63,22,%r28 /* Form aliased virtual address 'to' */
-	depdi   0,63,12,%r28    /* Clear any offset bits */
-	copy    %r28,%r29
-	depdi   1,41,1,%r29     /* Form aliased virtual address 'from' */
-#else
-	extrw,u %r26,24,25,%r26 /* convert phys addr to tlb insert format */
-	extrw,u %r23,24,25,%r23 /* convert phys addr to tlb insert format */
-	depw    %r24,31,22,%r28 /* Form aliased virtual address 'to' */
-	depwi   0,31,12,%r28    /* Clear any offset bits */
-	copy    %r28,%r29
-	depwi   1,9,1,%r29      /* Form aliased virtual address 'from' */
+	ldil		L%(__PAGE_OFFSET), %r1
+	sub		%r26, %r1, %r26
+	sub		%r25, %r1, %r23		/* move physical addr into non shadowed reg */
+
+	ldil		L%(TMPALIAS_MAP_START), %r28
+#ifdef __LP64__
+	extrd,u		%r26,56,32, %r26		/* convert phys addr to tlb insert format */
+	extrd,u		%r23,56,32, %r23		/* convert phys addr to tlb insert format */
+	depd		%r24,63,22, %r28		/* Form aliased virtual address 'to' */
+	depdi		0, 63,12, %r28		/* Clear any offset bits */
+	copy		%r28, %r29
+	depdi		1, 41,1, %r29		/* Form aliased virtual address 'from' */
+#else
+	extrw,u		%r26, 24,25, %r26	/* convert phys addr to tlb insert format */
+	extrw,u		%r23, 24,25, %r23	/* convert phys addr to tlb insert format */
+	depw		%r24, 31,22, %r28	/* Form aliased virtual address 'to' */
+	depwi		0, 31,12, %r28		/* Clear any offset bits */
+	copy		%r28, %r29
+	depwi		1, 9,1, %r29		/* Form aliased virtual address 'from' */
 #endif
 
 	/* Purge any old translations */
 
-	pdtlb   0(%r28)
-	pdtlb   0(%r29)
+	pdtlb		0(%r28)
+	pdtlb		0(%r29)
 
-	ldi 64,%r1
+	ldi		64, %r1
 
 	/*
 	 * This loop is optimized for PCXL/PCXL2 ldw/ldw and stw/stw
@@ -432,43 +490,43 @@
 
 
 1:
-	ldw 0(%r29),%r19
-	ldw 4(%r29),%r20
-	ldw 8(%r29),%r21
-	ldw 12(%r29),%r22
-	stw %r19,0(%r28)
-	stw %r20,4(%r28)
-	stw %r21,8(%r28)
-	stw %r22,12(%r28)
-	ldw 16(%r29),%r19
-	ldw 20(%r29),%r20
-	ldw 24(%r29),%r21
-	ldw 28(%r29),%r22
-	stw %r19,16(%r28)
-	stw %r20,20(%r28)
-	stw %r21,24(%r28)
-	stw %r22,28(%r28)
-	ldw 32(%r29),%r19
-	ldw 36(%r29),%r20
-	ldw 40(%r29),%r21
-	ldw 44(%r29),%r22
-	stw %r19,32(%r28)
-	stw %r20,36(%r28)
-	stw %r21,40(%r28)
-	stw %r22,44(%r28)
-	ldw 48(%r29),%r19
-	ldw 52(%r29),%r20
-	ldw 56(%r29),%r21
-	ldw 60(%r29),%r22
-	stw %r19,48(%r28)
-	stw %r20,52(%r28)
-	stw %r21,56(%r28)
-	stw %r22,60(%r28)
-	ldo 64(%r28),%r28
-	ADDIB>  -1,%r1,1b
-	ldo 64(%r29),%r29
+	ldw		0(%r29), %r19
+	ldw		4(%r29), %r20
+	ldw		8(%r29), %r21
+	ldw		12(%r29), %r22
+	stw		%r19, 0(%r28)
+	stw		%r20, 4(%r28)
+	stw		%r21, 8(%r28)
+	stw		%r22, 12(%r28)
+	ldw		16(%r29), %r19
+	ldw		20(%r29), %r20
+	ldw		24(%r29), %r21
+	ldw		28(%r29), %r22
+	stw		%r19, 16(%r28)
+	stw		%r20, 20(%r28)
+	stw		%r21, 24(%r28)
+	stw		%r22, 28(%r28)
+	ldw		32(%r29), %r19
+	ldw		36(%r29), %r20
+	ldw		40(%r29), %r21
+	ldw		44(%r29), %r22
+	stw		%r19, 32(%r28)
+	stw		%r20, 36(%r28)
+	stw		%r21, 40(%r28)
+	stw		%r22, 44(%r28)
+	ldw		48(%r29), %r19
+	ldw		52(%r29), %r20
+	ldw		56(%r29), %r21
+	ldw		60(%r29), %r22
+	stw		%r19, 48(%r28)
+	stw		%r20, 52(%r28)
+	stw		%r21, 56(%r28)
+	stw		%r22, 60(%r28)
+	ldo		64(%r28), %r28
+	ADDIB>		-1, %r1,1b
+	ldo		64(%r29), %r29
 
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -482,49 +540,77 @@
 	.callinfo NO_CALLS
 	.entry
 
-	tophys_r1 %r26
+	tophys_r1	%r26
 
-	ldil    L%(TMPALIAS_MAP_START),%r28
+	ldil		L%(TMPALIAS_MAP_START), %r28
 #ifdef __LP64__
 #if (TMPALIAS_MAP_START >= 0x80000000)
-	depdi	0,31,32,%r28	/* clear any sign extension */
+	depdi		0, 31,32, %r28		/* clear any sign extension */
 #endif
-	extrd,u %r26,56,32,%r26 /* convert phys addr to tlb insert format */
-	depd    %r25,63,22,%r28 /* Form aliased virtual address 'to' */
-	depdi   0,63,12,%r28    /* Clear any offset bits */
-#else
-	extrw,u %r26,24,25,%r26 /* convert phys addr to tlb insert format */
-	depw    %r25,31,22,%r28 /* Form aliased virtual address 'to' */
-	depwi   0,31,12,%r28    /* Clear any offset bits */
+	extrd,u		%r26, 56,32, %r26	/* convert phys addr to tlb insert format */
+	depd		%r25, 63,22, %r28	/* Form aliased virtual address 'to' */
+	depdi		0, 63,12, %r28		/* Clear any offset bits */
+#else
+	extrw,u		%r26, 24,25, %r26	/* convert phys addr to tlb insert format */
+	depw		%r25, 31,22, %r28	/* Form aliased virtual address 'to' */
+	depwi		0, 31,12, %r28		/* Clear any offset bits */
 #endif
 
 	/* Purge any old translation */
 
-	pdtlb   0(%r28)
+	pdtlb		0(%r28)
 
-	ldi 64,%r1
+#ifdef __LP64__
+	ldi		32, %r1			/* PAGE_SIZE/128 == 32 */
+
+	/* PREFETCH (Write) has not (yet) been proven to help here */
+/* #define	PREFETCHW_OP	ldd		256(%0), %r0 */
+
+1:	std		%r0, 0(%r28)
+	std		%r0, 8(%r28)
+	std		%r0, 16(%r28)
+	std		%r0, 24(%r28)
+	std		%r0, 32(%r28)
+	std		%r0, 40(%r28)
+	std		%r0, 48(%r28)
+	std		%r0, 56(%r28)
+	std		%r0, 64(%r28)
+	std		%r0, 72(%r28)
+	std		%r0, 80(%r28)
+	std		%r0, 88(%r28)
+	std		%r0, 96(%r28)
+	std		%r0, 104(%r28)
+	std		%r0, 112(%r28)
+	std		%r0, 120(%r28)
+	ADDIB>		-1, %r1, 1b
+	ldo		128(%r28), %r28
+
+#else	/* ! __LP64 */
+
+	ldi		64, %r1			/* PAGE_SIZE/64 == 64 */
 
 1:
-	stw %r0,0(%r28)
-	stw %r0,4(%r28)
-	stw %r0,8(%r28)
-	stw %r0,12(%r28)
-	stw %r0,16(%r28)
-	stw %r0,20(%r28)
-	stw %r0,24(%r28)
-	stw %r0,28(%r28)
-	stw %r0,32(%r28)
-	stw %r0,36(%r28)
-	stw %r0,40(%r28)
-	stw %r0,44(%r28)
-	stw %r0,48(%r28)
-	stw %r0,52(%r28)
-	stw %r0,56(%r28)
-	stw %r0,60(%r28)
-	ADDIB>  -1,%r1,1b
-	ldo 64(%r28),%r28
+	stw		%r0, 0(%r28)
+	stw		%r0, 4(%r28)
+	stw		%r0, 8(%r28)
+	stw		%r0, 12(%r28)
+	stw		%r0, 16(%r28)
+	stw		%r0, 20(%r28)
+	stw		%r0, 24(%r28)
+	stw		%r0, 28(%r28)
+	stw		%r0, 32(%r28)
+	stw		%r0, 36(%r28)
+	stw		%r0, 40(%r28)
+	stw		%r0, 44(%r28)
+	stw		%r0, 48(%r28)
+	stw		%r0, 52(%r28)
+	stw		%r0, 56(%r28)
+	stw		%r0, 60(%r28)
+	ADDIB>		-1, %r1, 1b
+	ldo		64(%r28), %r28
+#endif	/* __LP64 */
 
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -537,38 +623,38 @@
 	.callinfo NO_CALLS
 	.entry
 
-	ldil    L%dcache_stride,%r1
-	ldw     R%dcache_stride(%r1),%r23
+	ldil		L%dcache_stride, %r1
+	ldw		R%dcache_stride(%r1), %r23
 
 #ifdef __LP64__
-	depdi,z 1,63-PAGE_SHIFT,1,%r25
+	depdi,z		1, 63-PAGE_SHIFT,1, %r25
 #else
-	depwi,z 1,31-PAGE_SHIFT,1,%r25
+	depwi,z		1, 31-PAGE_SHIFT,1, %r25
 #endif
-	add     %r26,%r25,%r25
-	sub     %r25,%r23,%r25
-
-
-1:      fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	fdc,m   %r23(%r26)
-	CMPB<<  %r26,%r25,1b
-	fdc,m   %r23(%r26)
+	add		%r26, %r25, %r25
+	sub		%r25, %r23, %r25
+
+
+1:      fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	fdc,m		%r23(%r26)
+	CMPB<<		%r26, %r25,1b
+	fdc,m		%r23(%r26)
 
 	sync
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -581,38 +667,38 @@
 	.callinfo NO_CALLS
 	.entry
 
-	ldil    L%dcache_stride,%r1
-	ldw     R%dcache_stride(%r1),%r23
+	ldil		L%dcache_stride, %r1
+	ldw		R%dcache_stride(%r1), %r23
 
 #ifdef __LP64__
-	depdi,z 1,63-PAGE_SHIFT,1,%r25
+	depdi,z		1,63-PAGE_SHIFT,1, %r25
 #else
-	depwi,z 1,31-PAGE_SHIFT,1,%r25
+	depwi,z		1,31-PAGE_SHIFT,1, %r25
 #endif
-	add     %r26,%r25,%r25
-	sub     %r25,%r23,%r25
-
-
-1:      fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	fdc,m   %r23(%sr3,%r26)
-	CMPB<<  %r26,%r25,1b
-	fdc,m   %r23(%sr3,%r26)
+	add		%r26, %r25, %r25
+	sub		%r25, %r23, %r25
+
+
+1:      fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	fdc,m		%r23(%sr3, %r26)
+	CMPB<<		%r26, %r25,1b
+	fdc,m		%r23(%sr3, %r26)
 
 	sync
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -625,38 +711,38 @@
 	.callinfo NO_CALLS
 	.entry
 
-	ldil    L%dcache_stride,%r1
-	ldw     R%dcache_stride(%r1),%r23
+	ldil		L%dcache_stride, %r1
+	ldw		R%dcache_stride(%r1), %r23
 
 #ifdef __LP64__
-	depdi,z 1,63-PAGE_SHIFT,1,%r25
+	depdi,z		1, 63-PAGE_SHIFT,1, %r25
 #else
-	depwi,z 1,31-PAGE_SHIFT,1,%r25
+	depwi,z		1, 31-PAGE_SHIFT,1, %r25
 #endif
-	add     %r26,%r25,%r25
-	sub     %r25,%r23,%r25
-
-
-1:      fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	fic,m   %r23(%sr3,%r26)
-	CMPB<<  %r26,%r25,1b
-	fic,m   %r23(%sr3,%r26)
+	add		%r26, %r25, %r25
+	sub		%r25, %r23, %r25
+
+
+1:      fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	fic,m		%r23(%sr3, %r26)
+	CMPB<<		%r26, %r25,1b
+	fic,m		%r23(%sr3, %r26)
 
 	sync
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -670,37 +756,37 @@
 	.callinfo NO_CALLS
 	.entry
 
-	ldil    L%dcache_stride,%r1
-	ldw     R%dcache_stride(%r1),%r23
+	ldil		L%dcache_stride, %r1
+	ldw		R%dcache_stride(%r1), %r23
 
 #ifdef __LP64__
-	depdi,z 1,63-PAGE_SHIFT,1,%r25
+	depdi,z		1, 63-PAGE_SHIFT,1, %r25
 #else
-	depwi,z 1,31-PAGE_SHIFT,1,%r25
+	depwi,z		1, 31-PAGE_SHIFT,1, %r25
 #endif
-	add      %r26,%r25,%r25
-	sub      %r25,%r23,%r25
-
-1:      pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	pdc,m   %r23(%r26)
-	CMPB<<  %r26,%r25,1b
-	pdc,m   %r23(%r26)
+	add		%r26, %r25, %r25
+	sub		%r25, %r23, %r25
+
+1:      pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	pdc,m		%r23(%r26)
+	CMPB<<		%r26, %r25, 1b
+	pdc,m		%r23(%r26)
 
 	sync
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -718,54 +804,54 @@
 	.callinfo NO_CALLS
 	.entry
 
-	tophys_r1 %r26
+	tophys_r1		%r26
 
-	ldil    L%(TMPALIAS_MAP_START),%r28
+	ldil		L%(TMPALIAS_MAP_START), %r28
 #ifdef __LP64__
-	extrd,u %r26,56,32,%r26 /* convert phys addr to tlb insert format */
-	depd    %r25,63,22,%r28 /* Form aliased virtual address 'to' */
-	depdi   0,63,12,%r28    /* Clear any offset bits */
+	extrd,u		%r26, 56,32, %r26	/* convert phys addr to tlb insert format */
+	depd		%r25, 63,22, %r28	/* Form aliased virtual address 'to' */
+	depdi		0, 63,12, %r28		/* Clear any offset bits */
 #else
-	extrw,u %r26,24,25,%r26 /* convert phys addr to tlb insert format */
-	depw    %r25,31,22,%r28 /* Form aliased virtual address 'to' */
-	depwi   0,31,12,%r28    /* Clear any offset bits */
+	extrw,u		%r26, 24,25, %r26	/* convert phys addr to tlb insert format */
+	depw		%r25, 31,22, %r28	/* Form aliased virtual address 'to' */
+	depwi		0, 31,12, %r28		/* Clear any offset bits */
 #endif
 
 	/* Purge any old translation */
 
-	pdtlb   0(%r28)
+	pdtlb		0(%r28)
 
-	ldil    L%dcache_stride,%r1
-	ldw     R%dcache_stride(%r1),%r23
+	ldil		L%dcache_stride, %r1
+	ldw		R%dcache_stride(%r1), %r23
 
 #ifdef __LP64__
-	depdi,z 1,63-PAGE_SHIFT,1,%r29
+	depdi,z		1, 63-PAGE_SHIFT,1, %r29
 #else
-	depwi,z 1,31-PAGE_SHIFT,1,%r29
-#endif
-	add      %r28,%r29,%r29
-	sub      %r29,%r23,%r29
-
-1:      fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	fdc,m   %r23(%r28)
-	CMPB<<  %r28,%r29,1b
-	fdc,m   %r23(%r28)
+	depwi,z		1, 31-PAGE_SHIFT,1, %r29
+#endif
+	add		%r28, %r29, %r29
+	sub		%r29, %r23, %r29
+
+1:      fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	fdc,m		%r23(%r28)
+	CMPB<<		%r28, %r29, 1b
+	fdc,m		%r23(%r28)
 
 	sync
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -779,16 +865,16 @@
 	.callinfo NO_CALLS
 	.entry
 
-	ldil    L%dcache_stride,%r1
-	ldw     R%dcache_stride(%r1),%r23
-	ldo     -1(%r23),%r21
-	ANDCM   %r26,%r21,%r26
+	ldil		L%dcache_stride, %r1
+	ldw		R%dcache_stride(%r1), %r23
+	ldo		-1(%r23), %r21
+	ANDCM		%r26, %r21, %r26
 
-1:      CMPB<<,n %r26,%r25,1b
-	fdc,m   %r23(%sr3,%r26)
+1:      CMPB<<,n	%r26, %r25, 1b
+	fdc,m		%r23(%sr3, %r26)
 
 	sync
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -801,17 +887,17 @@
 	.callinfo NO_CALLS
 	.entry
 
-	ldil    L%dcache_stride,%r1
-	ldw     R%dcache_stride(%r1),%r23
-	ldo     -1(%r23),%r21
-	ANDCM   %r26,%r21,%r26
+	ldil		L%dcache_stride, %r1
+	ldw		R%dcache_stride(%r1), %r23
+	ldo		-1(%r23), %r21
+	ANDCM		%r26, %r21, %r26
 
-1:      CMPB<<,n %r26,%r25,1b
-	fdc,m   %r23(%r26)
+1:      CMPB<<,n	%r26, %r25,1b
+	fdc,m		%r23(%r26)
 
 	sync
 	syncdma
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -824,16 +910,16 @@
 	.callinfo NO_CALLS
 	.entry
 
-	ldil    L%icache_stride,%r1
-	ldw     R%icache_stride(%r1),%r23
-	ldo     -1(%r23),%r21
-	ANDCM   %r26,%r21,%r26
+	ldil		L%icache_stride, %r1
+	ldw		R%icache_stride(%r1), %r23
+	ldo		-1(%r23), %r21
+	ANDCM		%r26, %r21, %r26
 
-1:      CMPB<<,n %r26,%r25,1b
-	fic,m   %r23(%sr3,%r26)
+1:      CMPB<<,n	%r26, %r25,1b
+	fic,m		%r23(%sr3, %r26)
 
 	sync
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -846,38 +932,38 @@
 	.callinfo NO_CALLS
 	.entry
 
-	ldil    L%icache_stride,%r1
-	ldw     R%icache_stride(%r1),%r23
+	ldil		L%icache_stride, %r1
+	ldw		R%icache_stride(%r1), %r23
 
 #ifdef __LP64__
-	depdi,z 1,63-PAGE_SHIFT,1,%r25
+	depdi,z		1, 63-PAGE_SHIFT,1, %r25
 #else
-	depwi,z 1,31-PAGE_SHIFT,1,%r25
+	depwi,z		1, 31-PAGE_SHIFT,1, %r25
 #endif
-	add     %r26,%r25,%r25
-	sub     %r25,%r23,%r25
-
-
-1:      fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	fic,m   %r23(%r26)
-	CMPB<<  %r26,%r25,1b
-	fic,m   %r23(%r26)
+	add		%r26, %r25, %r25
+	sub		%r25, %r23, %r25
+
+
+1:      fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	fic,m		%r23(%r26)
+	CMPB<<		%r26, %r25, 1b
+	fic,m		%r23(%r26)
 
 	sync
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
@@ -890,22 +976,22 @@
 	.callinfo NO_CALLS
 	.entry
 
-	ldil    L%icache_stride,%r1
-	ldw     R%icache_stride(%r1),%r23
-	ldo     -1(%r23),%r21
-	ANDCM   %r26,%r21,%r26
+	ldil		L%icache_stride, %r1
+	ldw		R%icache_stride(%r1), %r23
+	ldo		-1(%r23), %r21
+	ANDCM		%r26, %r21, %r26
 
-1:      CMPB<<,n %r26,%r25,1b
-	fic,m   %r23(%r26)
+1:      CMPB<<,n	%r26, %r25, 1b
+	fic,m		%r23(%r26)
 
 	sync
-	bv      %r0(%r2)
+	bv		%r0(%r2)
 	nop
 	.exit
 
 	.procend
 
-	.align 128
+	.align	128
 
 	.export disable_sr_hashing_asm,code
 
@@ -916,7 +1002,7 @@
 
 	/* Switch to real mode */
 
-	ssm     0,%r0           /* relied upon translation! */
+	ssm		0, %r0			/* relied upon translation! */
 	nop
 	nop
 	nop
@@ -925,73 +1011,73 @@
 	nop
 	nop
 	
-	rsm     (PSW_SM_Q|PSW_SM_I),%r0 /* disable Q&I to load the iia queue */
-	ldil    L%REAL_MODE_PSW, %r1
-	ldo     R%REAL_MODE_PSW(%r1), %r1
-	mtctl	%r1, %cr22
-	mtctl	%r0, %cr17	/* Clear IIASQ tail */
-	mtctl	%r0, %cr17	/* Clear IIASQ head */
-	ldil    L%PA(1f),%r1
-	ldo     R%PA(1f)(%r1),%r1
-	mtctl	%r1, %cr18	/* IIAOQ head */
-	ldo	4(%r1), %r1
-	mtctl	%r1, %cr18	/* IIAOQ tail */
+	rsm		(PSW_SM_Q|PSW_SM_I), %r0 /* disable Q&I to load the iia queue */
+	ldil		L%REAL_MODE_PSW, %r1
+	ldo		R%REAL_MODE_PSW(%r1), %r1
+	mtctl		%r1, %cr22
+	mtctl		%r0, %cr17		/* Clear IIASQ tail */
+	mtctl		%r0, %cr17		/* Clear IIASQ head */
+	ldil		L%PA(1f), %r1
+	ldo		R%PA(1f)(%r1), %r1
+	mtctl		%r1, %cr18		/* IIAOQ head */
+	ldo		4(%r1), %r1
+	mtctl		%r1, %cr18		/* IIAOQ tail */
 	rfi
 	nop
 
-1:      cmpib,=,n SRHASH_PCXST,%r26,srdis_pcxs
-	cmpib,=,n SRHASH_PCXL,%r26,srdis_pcxl
-	cmpib,=,n SRHASH_PA20,%r26,srdis_pa20
-	b,n       srdis_done
+1:      cmpib,=,n	SRHASH_PCXST, %r26,srdis_pcxs
+	cmpib,=,n	SRHASH_PCXL, %r26,srdis_pcxl
+	cmpib,=,n	SRHASH_PA20, %r26,srdis_pa20
+	b,n		srdis_done
 
 srdis_pcxs:
 
 	/* Disable Space Register Hashing for PCXS,PCXT,PCXT' */
 
-	.word           0x141c1a00  /* mfdiag %dr0,%r28 */
-	.word           0x141c1a00  /* must issue twice */
-	depwi           0,18,1,%r28 /* Clear DHE (dcache hash enable) */
-	depwi           0,20,1,%r28 /* Clear IHE (icache hash enable) */
-	.word           0x141c1600  /* mtdiag %r28,%dr0 */
-	.word           0x141c1600  /* must issue twice */
-	b,n             srdis_done
+	.word		0x141c1a00		/* mfdiag %dr0, %r28 */
+	.word		0x141c1a00		/* must issue twice */
+	depwi		0,18,1, %r28		/* Clear DHE (dcache hash enable) */
+	depwi		0,20,1, %r28		/* Clear IHE (icache hash enable) */
+	.word		0x141c1600		/* mtdiag %r28, %dr0 */
+	.word		0x141c1600		/* must issue twice */
+	b,n		srdis_done
 
 srdis_pcxl:
 
 	/* Disable Space Register Hashing for PCXL */
 
-	.word           0x141c0600  /* mfdiag %dr0,%r28 */
-	depwi           0,28,2,%r28 /* Clear DHASH_EN & IHASH_EN */
-	.word           0x141c0240  /* mtdiag %r28,%dr0 */
-	b,n             srdis_done
+	.word		0x141c0600		/* mfdiag %dr0, %r28 */
+	depwi           0,28,2, %r28		/* Clear DHASH_EN & IHASH_EN */
+	.word		0x141c0240		/* mtdiag %r28, %dr0 */
+	b,n		srdis_done
 
 srdis_pa20:
 
 	/* Disable Space Register Hashing for PCXU,PCXU+,PCXW,PCXW+ */
 
-	.word           0x144008bc  /* mfdiag %dr2,%r28 */
-	depdi           0,54,1,%r28 /* clear DIAG_SPHASH_ENAB (bit 54) */
-	.word           0x145c1840  /* mtdiag %r28,%dr2 */
+	.word		0x144008bc		/* mfdiag %dr2, %r28 */
+	depdi		0, 54,1, %r28		/* clear DIAG_SPHASH_ENAB (bit 54) */
+	.word		0x145c1840		/* mtdiag %r28, %dr2 */
 
 srdis_done:
 
 	/* Switch back to virtual mode */
 
-	rsm     PSW_SM_Q,%r0           /* clear Q bit to load iia queue */
-	ldil	L%KERNEL_PSW, %r1
-	ldo	R%KERNEL_PSW(%r1), %r1
-	mtctl	%r1, %cr22
-	mtctl	%r0, %cr17	/* Clear IIASQ tail */
-	mtctl	%r0, %cr17	/* Clear IIASQ head */
-	ldil    L%(2f), %r1
-	ldo     R%(2f)(%r1), %r1
-	mtctl	%r1, %cr18	/* IIAOQ head */
-	ldo	4(%r1), %r1
-	mtctl	%r1, %cr18	/* IIAOQ tail */
+	rsm		PSW_SM_Q, %r0		/* clear Q bit to load iia queue */
+	ldil		L%KERNEL_PSW, %r1
+	ldo		R%KERNEL_PSW(%r1), %r1
+	mtctl		%r1, %cr22
+	mtctl		%r0, %cr17		/* Clear IIASQ tail */
+	mtctl		%r0, %cr17		/* Clear IIASQ head */
+	ldil 	   	L%(2f), %r1
+	ldo     	R%(2f)(%r1), %r1
+	mtctl		%r1, %cr18		/* IIAOQ head */
+	ldo		4(%r1), %r1
+	mtctl		%r1, %cr18		/* IIAOQ tail */
 	rfi
 	nop
 
-2:      bv      %r0(%r2)
+2:      bv		%r0(%r2)
 	nop
 	.exit
 
diff -Nru a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
--- a/arch/parisc/kernel/pci-dma.c	2004-10-31 22:09:35 -08:00
+++ b/arch/parisc/kernel/pci-dma.c	2005-02-23 15:40:52 -08:00
@@ -180,7 +180,7 @@
 		end = PMD_SIZE;
 	do {
 		pte_t page = *pte;
-		pte_clear(pte);
+		pte_clear(&init_mm, vaddr, pte);
 		purge_tlb_start();
 		pdtlb_kernel(orig_vaddr);
 		purge_tlb_end();
diff -Nru a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c
--- a/arch/parisc/kernel/pdc_chassis.c	2004-08-13 01:21:43 -07:00
+++ b/arch/parisc/kernel/pdc_chassis.c	2005-03-02 03:25:25 -08:00
@@ -182,7 +182,7 @@
 
 		DPRINTK(KERN_DEBUG "%s: pdc_chassis_send_status(%d)\n", __FILE__, message);
 
-#ifdef CONFIG_PARISC64
+#ifdef CONFIG_64BIT
 		if (is_pdc_pat()) {
 			switch(message) {
 				case PDC_CHASSIS_DIRECT_BSTART:
@@ -238,7 +238,7 @@
 					retval = -1;
 			}
 		} else retval = -1;
-#endif /* CONFIG_PARISC64 */
+#endif /* CONFIG_64BIT */
 	}	/* if (pdc_chassis_enabled) */
 #endif /* CONFIG_PDC_CHASSIS */
 	return retval;
diff -Nru a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c
--- a/arch/parisc/kernel/perf.c	2004-05-10 02:18:37 -07:00
+++ b/arch/parisc/kernel/perf.c	2005-03-08 11:15:56 -08:00
@@ -42,7 +42,6 @@
  *  on every box. 
  */
 
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/proc_fs.h>
 #include <linux/miscdevice.h>
@@ -157,16 +156,16 @@
  * this array.
  */
 static uint64_t perf_bitmasks[] = {
-	0x0000000000000000,     /* first dbl word must be zero */
-	0xfdffe00000000000,     /* RDR0 bitmask */
-	0x003f000000000000,     /* RDR1 bitmask */
-	0x00ffffffffffffff,     /* RDR20-RDR21 bitmask (152 bits) */
-	0xffffffffffffffff,
-	0xfffffffc00000000,
-	0xffffffffffffffff,     /* RDR22-RDR23 bitmask (233 bits) */
-	0xffffffffffffffff,
-	0xfffffffffffffffc,
-	0xff00000000000000
+	0x0000000000000000ul,     /* first dbl word must be zero */
+	0xfdffe00000000000ul,     /* RDR0 bitmask */
+	0x003f000000000000ul,     /* RDR1 bitmask */
+	0x00fffffffffffffful,     /* RDR20-RDR21 bitmask (152 bits) */
+	0xfffffffffffffffful,
+	0xfffffffc00000000ul,
+	0xfffffffffffffffful,     /* RDR22-RDR23 bitmask (233 bits) */
+	0xfffffffffffffffful,
+	0xfffffffffffffffcul,
+	0xff00000000000000ul
 };
 
 /*
@@ -174,16 +173,16 @@
  * somethings have changed slightly.
  */
 static uint64_t perf_bitmasks_piranha[] = {
-	0x0000000000000000,     /* first dbl word must be zero */
-	0xfdffe00000000000,     /* RDR0 bitmask */
-	0x003f000000000000,     /* RDR1 bitmask */
-	0x00ffffffffffffff,     /* RDR20-RDR21 bitmask (158 bits) */
-	0xffffffffffffffff,
-	0xfffffffc00000000,
-	0xffffffffffffffff,     /* RDR22-RDR23 bitmask (210 bits) */
-	0xffffffffffffffff,
-	0xffffffffffffffff,
-	0xfffc000000000000
+	0x0000000000000000ul,     /* first dbl word must be zero */
+	0xfdffe00000000000ul,     /* RDR0 bitmask */
+	0x003f000000000000ul,     /* RDR1 bitmask */
+	0x00fffffffffffffful,     /* RDR20-RDR21 bitmask (158 bits) */
+	0xfffffffffffffffful,
+	0xfffffffc00000000ul,
+	0xfffffffffffffffful,     /* RDR22-RDR23 bitmask (210 bits) */
+	0xfffffffffffffffful,
+	0xfffffffffffffffful,
+	0xfffc000000000000ul
 };
 
 static uint64_t *bitmask_array;   /* array of bitmasks to use */
@@ -194,8 +193,8 @@
 static int perf_config(uint32_t *image_ptr);
 static int perf_release(struct inode *inode, struct file *file);
 static int perf_open(struct inode *inode, struct file *file);
-static ssize_t perf_read(struct file *file, char *buf, size_t cnt, loff_t *ppos);
-static ssize_t perf_write(struct file *file, const char *buf, size_t count, 
+static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t *ppos);
+static ssize_t perf_write(struct file *file, const char __user *buf, size_t count, 
 	loff_t *ppos);
 static int perf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 	unsigned long arg);
@@ -287,7 +286,7 @@
 /*
  * Read does nothing for this driver
  */
-static ssize_t perf_read(struct file *file, char *buf, size_t cnt, loff_t *ppos)
+static ssize_t perf_read(struct file *file, char __user *buf, size_t cnt, loff_t *ppos)
 {
 	return 0;
 }
@@ -299,7 +298,7 @@
  * called on the processor that the download should happen
  * on.
  */
-static ssize_t perf_write(struct file *file, const char *buf, size_t count, 
+static ssize_t perf_write(struct file *file, const char __user *buf, size_t count, 
 	loff_t *ppos)
 {
 	int err;
@@ -460,7 +459,7 @@
 			}
 
 			/* copy out the Counters */
-			if (copy_to_user((void *)arg, raddr, 
+			if (copy_to_user((void __user *)arg, raddr, 
 					sizeof (raddr)) != 0) {
 				return -EFAULT;
 			}
@@ -607,7 +606,7 @@
 		 * all of dword 22 and 58 bits (plus 6 don't care bits) of
 		 * dword 23.
 		 */
-		userbuf[21] &= 0xfffffffffffffc00;	/* 0 to last 10 bits */
+		userbuf[21] &= 0xfffffffffffffc00ul;	/* 0 to last 10 bits */
 		userbuf[22] = 0;
 		userbuf[23] = 0;
 
@@ -802,8 +801,8 @@
 	proc_hpa = cpu_device->hpa;
 
 	/* Merge intrigue bits into Runway STATUS 0 */
-	tmp64 = __raw_readq(proc_hpa + RUNWAY_STATUS) & 0xffecffffffffffff;
-	__raw_writeq(tmp64 | (*memaddr++ & 0x0013000000000000), proc_hpa + RUNWAY_STATUS);
+	tmp64 = __raw_readq(proc_hpa + RUNWAY_STATUS) & 0xffecfffffffffffful;
+	__raw_writeq(tmp64 | (*memaddr++ & 0x0013000000000000ul), proc_hpa + RUNWAY_STATUS);
 	
 	/* Write RUNWAY DEBUG registers */
 	for (i = 0; i < 8; i++) {
diff -Nru a/arch/parisc/kernel/perf_asm.S b/arch/parisc/kernel/perf_asm.S
--- a/arch/parisc/kernel/perf_asm.S	2004-10-30 02:31:28 -07:00
+++ b/arch/parisc/kernel/perf_asm.S	2005-03-02 03:25:25 -08:00
@@ -22,9 +22,9 @@
 #include <linux/config.h>
 #include <asm/assembly.h>
 
-#ifdef __LP64__
+#ifdef CONFIG_64BIT
 	.level		2.0w
-#endif /* __LP64__ */
+#endif /* CONFIG_64BIT */
 
 #define MTDIAG_1(gr)    .word 0x14201840 + gr*0x10000
 #define MTDIAG_2(gr)    .word 0x14401840 + gr*0x10000
diff -Nru a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
--- a/arch/parisc/kernel/process.c	2004-10-18 22:26:37 -07:00
+++ b/arch/parisc/kernel/process.c	2005-03-08 11:15:56 -08:00
@@ -251,7 +251,7 @@
 sys_clone(unsigned long clone_flags, unsigned long usp,
 	  struct pt_regs *regs)
 {
-	int *user_tid = (int *)regs->gr[26];
+	int __user *user_tid = (int __user *)regs->gr[26];
 
 	/* usp must be word aligned.  This also prevents users from
 	 * passing in the value 1 (which is the signal for a special
@@ -357,12 +357,12 @@
 	int error;
 	char *filename;
 
-	filename = getname((char *) regs->gr[26]);
+	filename = getname((const char __user *) regs->gr[26]);
 	error = PTR_ERR(filename);
 	if (IS_ERR(filename))
 		goto out;
-	error = do_execve(filename, (char **) regs->gr[25],
-		(char **) regs->gr[24], regs);
+	error = do_execve(filename, (char __user **) regs->gr[25],
+		(char __user **) regs->gr[24], regs);
 	if (error == 0) {
 		task_lock(current);
 		current->ptrace &= ~PT_DTRACE;
diff -Nru a/arch/parisc/kernel/real2.S b/arch/parisc/kernel/real2.S
--- a/arch/parisc/kernel/real2.S	2004-10-30 02:31:28 -07:00
+++ b/arch/parisc/kernel/real2.S	2005-03-08 11:15:56 -08:00
@@ -81,8 +81,7 @@
 	rsm	PSW_SM_W, %r0		/* go narrow */
 #endif
 
-	ldil	L%PA(ric_ret), %r2
-	ldo	R%PA(ric_ret)(%r2), %r2
+	load32	PA(ric_ret), %r2
 	bv	0(%r31)
 	nop
 ric_ret:
diff -Nru a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
--- a/arch/parisc/kernel/setup.c	2005-01-09 17:06:54 -08:00
+++ b/arch/parisc/kernel/setup.c	2005-03-08 11:15:56 -08:00
@@ -199,7 +199,7 @@
 	case pcxl2:
 		if (NULL == proc_gsc_root)
 		{
-			proc_gsc_root = proc_mkdir("bus/gsc", 0);
+			proc_gsc_root = proc_mkdir("bus/gsc", NULL);
 		}
 		break;
         case pcxt_:
@@ -210,13 +210,13 @@
         case pcxw2:
                 if (NULL == proc_runway_root)
                 {
-                        proc_runway_root = proc_mkdir("bus/runway", 0);
+                        proc_runway_root = proc_mkdir("bus/runway", NULL);
                 }
                 break;
 	case mako:
                 if (NULL == proc_mckinley_root)
                 {
-                        proc_mckinley_root = proc_mkdir("bus/mckinley", 0);
+                        proc_mckinley_root = proc_mkdir("bus/mckinley", NULL);
                 }
                 break;
 	default:
diff -Nru a/arch/parisc/kernel/signal.c b/arch/parisc/kernel/signal.c
--- a/arch/parisc/kernel/signal.c	2004-10-31 22:09:35 -08:00
+++ b/arch/parisc/kernel/signal.c	2005-03-08 11:15:56 -08:00
@@ -69,7 +69,7 @@
 #endif
 
 asmlinkage int
-sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs *regs)
+sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, struct pt_regs *regs)
 {
 	sigset_t saveset, newset;
 #ifdef __LP64__
@@ -79,7 +79,7 @@
 		/* XXX: Don't preclude handling different sized sigset_t's.  */
 		if (sigsetsize != sizeof(compat_sigset_t))
 			return -EINVAL;
-		if (copy_from_user(&newset32, (compat_sigset_t *)unewset, sizeof(newset32)))
+		if (copy_from_user(&newset32, (compat_sigset_t __user *)unewset, sizeof(newset32)))
 			return -EFAULT;
 		sigset_32to64(&newset,&newset32);
 		
@@ -125,7 +125,7 @@
 #define INSN_DIE_HORRIBLY 0x68000ccc /* stw %r0,0x666(%sr0,%r0) */
 
 static long
-restore_sigcontext(struct sigcontext *sc, struct pt_regs *regs)
+restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs)
 {
 	long err = 0;
 
@@ -143,14 +143,14 @@
 void
 sys_rt_sigreturn(struct pt_regs *regs, int in_syscall)
 {
-	struct rt_sigframe *frame;
+	struct rt_sigframe __user *frame;
 	struct siginfo si;
 	sigset_t set;
 	unsigned long usp = (regs->gr[30] & ~(0x01UL));
 	unsigned long sigframe_size = PARISC_RT_SIGFRAME_SIZE;
 #ifdef __LP64__
 	compat_sigset_t compat_set;
-	struct compat_rt_sigframe * compat_frame;
+	struct compat_rt_sigframe __user * compat_frame;
 	
 	if(personality(current->personality) == PER_LINUX32)
 		sigframe_size = PARISC_RT_SIGFRAME_SIZE32;
@@ -158,12 +158,12 @@
 
 
 	/* Unwind the user stack to get the rt_sigframe structure. */
-	frame = (struct rt_sigframe *)
+	frame = (struct rt_sigframe __user *)
 		(usp - sigframe_size);
 	DBG(2,"sys_rt_sigreturn: frame is %p\n", frame);
 
 #ifdef __LP64__
-	compat_frame = (struct compat_rt_sigframe *)frame;
+	compat_frame = (struct compat_rt_sigframe __user *)frame;
 	
 	if(personality(current->personality) == PER_LINUX32){
 		DBG(2,"sys_rt_sigreturn: ELF32 process.\n");
@@ -238,7 +238,7 @@
  * Set up a signal frame.
  */
 
-static inline void *
+static inline void __user *
 get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
 {
 	/*FIXME: ELF32 vs. ELF64 has different frame_size, but since we
@@ -251,11 +251,11 @@
 		sp = current->sas_ss_sp; /* Stacks grow up! */
 
 	DBG(1,"get_sigframe: Returning sp = %#lx\n", (unsigned long)sp);
-	return (void *) sp; /* Stacks grow up.  Fun. */
+	return (void __user *) sp; /* Stacks grow up.  Fun. */
 }
 
 static long
-setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs, int in_syscall)
+setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, int in_syscall)
 		 
 {
 	unsigned long flags = 0;
@@ -292,14 +292,14 @@
 setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
 	       sigset_t *set, struct pt_regs *regs, int in_syscall)
 {
-	struct rt_sigframe *frame;
+	struct rt_sigframe __user *frame;
 	unsigned long rp, usp;
 	unsigned long haddr, sigframe_size;
 	struct siginfo si;
 	int err = 0;
 #ifdef __LP64__
 	compat_int_t compat_val;
-	struct compat_rt_sigframe * compat_frame;
+	struct compat_rt_sigframe __user * compat_frame;
 	compat_sigset_t compat_set;
 #endif
 	
@@ -313,7 +313,7 @@
 	
 #ifdef __LP64__
 
-	compat_frame = (struct compat_rt_sigframe *)frame;
+	compat_frame = (struct compat_rt_sigframe __user *)frame;
 	
 	if(personality(current->personality) == PER_LINUX32) {
 		DBG(1,"setup_rt_frame: frame->info = 0x%p\n", &compat_frame->info);
@@ -396,7 +396,7 @@
 #endif
 		if (haddr & PA_PLABEL_FDESC) {
 			Elf32_Fdesc fdesc;
-			Elf32_Fdesc *ufdesc = (Elf32_Fdesc *)A(haddr & ~3);
+			Elf32_Fdesc __user *ufdesc = (Elf32_Fdesc __user *)A(haddr & ~3);
 
 			err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc));
 
@@ -409,7 +409,7 @@
 #ifdef __LP64__
 	} else {
 		Elf64_Fdesc fdesc;
-		Elf64_Fdesc *ufdesc = (Elf64_Fdesc *)A(haddr & ~3);
+		Elf64_Fdesc __user *ufdesc = (Elf64_Fdesc __user *)A(haddr & ~3);
 		
 		err = __copy_from_user(&fdesc, ufdesc, sizeof(fdesc));
 		
diff -Nru a/arch/parisc/kernel/signal32.c b/arch/parisc/kernel/signal32.c
--- a/arch/parisc/kernel/signal32.c	2004-02-25 02:31:13 -08:00
+++ b/arch/parisc/kernel/signal32.c	2005-03-08 11:15:56 -08:00
@@ -20,7 +20,6 @@
  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include <linux/config.h>
 #include <linux/compat.h>
 #include <linux/slab.h>
 #include <linux/module.h>
@@ -65,7 +64,7 @@
 }
 
 static int
-put_sigset32(compat_sigset_t *up, sigset_t *set, size_t sz)
+put_sigset32(compat_sigset_t __user *up, sigset_t *set, size_t sz)
 {
 	compat_sigset_t s;
 
@@ -76,7 +75,7 @@
 }
 
 static int
-get_sigset32(compat_sigset_t *up, sigset_t *set, size_t sz)
+get_sigset32(compat_sigset_t __user *up, sigset_t *set, size_t sz)
 {
 	compat_sigset_t s;
 	int r;
@@ -90,7 +89,7 @@
 	return r;
 }
 
-int sys32_rt_sigprocmask(int how, compat_sigset_t *set, compat_sigset_t *oset,
+int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set, compat_sigset_t __user *oset,
 				    unsigned int sigsetsize)
 {
 	sigset_t old_set, new_set;
@@ -99,8 +98,8 @@
 	if (set && get_sigset32(set, &new_set, sigsetsize))
 		return -EFAULT;
 	
-	KERNEL_SYSCALL(ret, sys_rt_sigprocmask, how, set ? &new_set : NULL,
-				 oset ? &old_set : NULL, sigsetsize);
+	KERNEL_SYSCALL(ret, sys_rt_sigprocmask, how, set ? (sigset_t __user *)&new_set : NULL,
+				 oset ? (sigset_t __user *)&old_set : NULL, sigsetsize);
 
 	if (!ret && oset && put_sigset32(oset, &old_set, sigsetsize))
 		return -EFAULT;
@@ -109,12 +108,12 @@
 }
 
 
-int sys32_rt_sigpending(compat_sigset_t *uset, unsigned int sigsetsize)
+int sys32_rt_sigpending(compat_sigset_t __user *uset, unsigned int sigsetsize)
 {
 	int ret;
 	sigset_t set;
 
-	KERNEL_SYSCALL(ret, sys_rt_sigpending, &set, sigsetsize);
+	KERNEL_SYSCALL(ret, sys_rt_sigpending, (sigset_t __user *)&set, sigsetsize);
 
 	if (!ret && put_sigset32(uset, &set, sigsetsize))
 		return -EFAULT;
@@ -123,7 +122,7 @@
 }
 
 long
-sys32_rt_sigaction(int sig, const struct sigaction32 *act, struct sigaction32 *oact,
+sys32_rt_sigaction(int sig, const struct sigaction32 __user *act, struct sigaction32 __user *oact,
                  size_t sigsetsize)
 {
 	struct k_sigaction32 new_sa32, old_sa32;
@@ -151,7 +150,7 @@
 }
 
 int 
-do_sigaltstack32 (const compat_stack_t *uss32, compat_stack_t *uoss32, unsigned long sp)
+do_sigaltstack32 (const compat_stack_t __user *uss32, compat_stack_t __user *uoss32, unsigned long sp)
 {
 	compat_stack_t ss32, oss32;
 	stack_t ss, oss;
@@ -162,7 +161,7 @@
 		if (copy_from_user(&ss32, uss32, sizeof ss32))
 			return -EFAULT;
 
-		ss.ss_sp = (void *)(unsigned long)ss32.ss_sp;
+		ss.ss_sp = (void __user *)(unsigned long)ss32.ss_sp;
 		ss.ss_flags = ss32.ss_flags;
 		ss.ss_size = ss32.ss_size;
 
@@ -172,7 +171,7 @@
 	if (uoss32)
 		ossp = &oss;
 
-	KERNEL_SYSCALL(ret, do_sigaltstack, ssp, ossp, sp);
+	KERNEL_SYSCALL(ret, do_sigaltstack, (const stack_t __user *)ssp, (stack_t __user *)ossp, sp);
 
 	if (!ret && uoss32) {
 		oss32.ss_sp = (unsigned int)(unsigned long)oss.ss_sp;
@@ -186,7 +185,7 @@
 }
 
 long
-restore_sigcontext32(struct compat_sigcontext *sc, struct compat_regfile * rf,
+restore_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __user * rf,
 		struct pt_regs *regs)
 {
 	long err = 0;
@@ -265,7 +264,7 @@
  * truncate for a 32-bit userspace.
  */
 long
-setup_sigcontext32(struct compat_sigcontext *sc, struct compat_regfile * rf, 
+setup_sigcontext32(struct compat_sigcontext __user *sc, struct compat_regfile __user * rf, 
 		struct pt_regs *regs, int in_syscall)		 
 {
 	compat_int_t flags = 0;
diff -Nru a/arch/parisc/kernel/signal32.h b/arch/parisc/kernel/signal32.h
--- a/arch/parisc/kernel/signal32.h	2004-02-03 21:41:57 -08:00
+++ b/arch/parisc/kernel/signal32.h	2005-03-08 11:15:56 -08:00
@@ -31,13 +31,13 @@
 
 void sigset_32to64(sigset_t *s64, compat_sigset_t *s32);
 void sigset_64to32(compat_sigset_t *s32, sigset_t *s64);
-int do_sigaltstack32 (const compat_stack_t *uss32, 
-		compat_stack_t *uoss32, unsigned long sp);
-long restore_sigcontext32(struct compat_sigcontext *sc, 
-		struct compat_regfile *rf,
+int do_sigaltstack32 (const compat_stack_t __user *uss32, 
+		compat_stack_t __user *uoss32, unsigned long sp);
+long restore_sigcontext32(struct compat_sigcontext __user *sc, 
+		struct compat_regfile __user *rf,
 		struct pt_regs *regs);
-long setup_sigcontext32(struct compat_sigcontext *sc, 
-		struct compat_regfile *rf,
+long setup_sigcontext32(struct compat_sigcontext __user *sc, 
+		struct compat_regfile __user *rf,
 		struct pt_regs *regs, int in_syscall);
 
 #endif
diff -Nru a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
--- a/arch/parisc/kernel/sys_parisc.c	2004-11-02 00:14:08 -08:00
+++ b/arch/parisc/kernel/sys_parisc.c	2005-03-08 11:15:56 -08:00
@@ -32,7 +32,7 @@
 #include <linux/smp_lock.h>
 #include <linux/syscalls.h>
 
-int sys_pipe(int *fildes)
+int sys_pipe(int __user *fildes)
 {
 	int fd[2];
 	int error;
@@ -161,7 +161,7 @@
 	}
 }
 
-long sys_shmat_wrapper(int shmid, char *shmaddr, int shmflag)
+long sys_shmat_wrapper(int shmid, char __user *shmaddr, int shmflag)
 {
 	unsigned long raddr;
 	int r;
@@ -174,8 +174,8 @@
 
 /* Fucking broken ABI */
 
-#ifdef CONFIG_PARISC64
-asmlinkage long parisc_truncate64(const char * path,
+#ifdef CONFIG_64BIT
+asmlinkage long parisc_truncate64(const char __user * path,
 					unsigned int high, unsigned int low)
 {
 	return sys_truncate(path, (long)high << 32 | low);
@@ -189,7 +189,7 @@
 
 /* stubs for the benefit of the syscall_table since truncate64 and truncate 
  * are identical on LP64 */
-asmlinkage long sys_truncate64(const char * path, unsigned long length)
+asmlinkage long sys_truncate64(const char __user * path, unsigned long length)
 {
 	return sys_truncate(path, length);
 }
@@ -203,7 +203,7 @@
 }
 #else
 
-asmlinkage long parisc_truncate64(const char * path,
+asmlinkage long parisc_truncate64(const char __user * path,
 					unsigned int high, unsigned int low)
 {
 	return sys_truncate64(path, (loff_t)high << 32 | low);
@@ -216,13 +216,13 @@
 }
 #endif
 
-asmlinkage ssize_t parisc_pread64(unsigned int fd, char *buf, size_t count,
+asmlinkage ssize_t parisc_pread64(unsigned int fd, char __user *buf, size_t count,
 					unsigned int high, unsigned int low)
 {
 	return sys_pread64(fd, buf, count, (loff_t)high << 32 | low);
 }
 
-asmlinkage ssize_t parisc_pwrite64(unsigned int fd, const char *buf,
+asmlinkage ssize_t parisc_pwrite64(unsigned int fd, const char __user *buf,
 			size_t count, unsigned int high, unsigned int low)
 {
 	return sys_pwrite64(fd, buf, count, (loff_t)high << 32 | low);
diff -Nru a/arch/parisc/kernel/sys_parisc32.c b/arch/parisc/kernel/sys_parisc32.c
--- a/arch/parisc/kernel/sys_parisc32.c	2005-01-25 13:50:22 -08:00
+++ b/arch/parisc/kernel/sys_parisc32.c	2005-03-08 11:15:56 -08:00
@@ -74,7 +74,7 @@
 	char *filename;
 
 	DBG(("sys32_execve(%p) r26 = 0x%lx\n", regs, regs->gr[26]));
-	filename = getname((char *) regs->gr[26]);
+	filename = getname((const char __user *) regs->gr[26]);
 	error = PTR_ERR(filename);
 	if (IS_ERR(filename))
 		goto out;
@@ -111,13 +111,13 @@
 	u32 __unused[4];
 };
 
-asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
+asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
 {
 	struct __sysctl_args32 tmp;
 	int error;
 	unsigned int oldlen32;
 	size_t oldlen, *oldlenp = NULL;
-	unsigned long addr = (((long)&args->__unused[0]) + 7) & ~7;
+	unsigned long addr = (((long __force)&args->__unused[0]) + 7) & ~7;
 	extern int do_sysctl(int *name, int nlen, void *oldval, size_t *oldlenp,
 	       void *newval, size_t newlen);
 
@@ -159,7 +159,7 @@
 					error = -EFAULT;
 			}
 		}
-		if (copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)))
+		if (copy_to_user(&args->__unused[0], tmp.__unused, sizeof(tmp.__unused)))
 			error = -EFAULT;
 	}
 	return error;
@@ -168,19 +168,19 @@
 #endif /* CONFIG_SYSCTL */
 
 asmlinkage long sys32_sched_rr_get_interval(pid_t pid,
-	struct compat_timespec *interval)
+	struct compat_timespec __user *interval)
 {
 	struct timespec t;
 	int ret;
-	
-	KERNEL_SYSCALL(ret, sys_sched_rr_get_interval, pid, &t);
+
+	KERNEL_SYSCALL(ret, sys_sched_rr_get_interval, pid, (struct timespec __user *)&t);
 	if (put_compat_timespec(&t, interval))
 		return -EFAULT;
 	return ret;
 }
 
 static int
-put_compat_timeval(struct compat_timeval *u, struct timeval *t)
+put_compat_timeval(struct compat_timeval __user *u, struct timeval *t)
 {
 	struct compat_timeval t32;
 	t32.tv_sec = t->tv_sec;
@@ -188,7 +188,7 @@
 	return copy_to_user(u, &t32, sizeof t32);
 }
 
-static inline long get_ts32(struct timespec *o, struct compat_timeval *i)
+static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
 {
 	long usec;
 
@@ -201,7 +201,7 @@
 }
 
 asmlinkage int
-sys32_gettimeofday(struct compat_timeval *tv, struct timezone *tz)
+sys32_gettimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
 {
     extern void do_gettimeofday(struct timeval *tv);
 
@@ -220,7 +220,7 @@
 }
 
 asmlinkage 
-int sys32_settimeofday(struct compat_timeval *tv, struct timezone *tz)
+int sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
 {
 	struct timespec kts;
 	struct timezone ktz;
@@ -237,7 +237,7 @@
 	return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
 }
 
-int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
+int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
 {
 	int err;
 
@@ -294,24 +294,24 @@
 };
 
 struct getdents32_callback {
-	struct linux32_dirent * current_dir;
-	struct linux32_dirent * previous;
+	struct linux32_dirent __user * current_dir;
+	struct linux32_dirent __user * previous;
 	int count;
 	int error;
 };
 
 struct readdir32_callback {
-	struct old_linux32_dirent * dirent;
+	struct old_linux32_dirent __user * dirent;
 	int count;
 };
 
 #define ROUND_UP(x,a)	((__typeof__(x))(((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)))
-#define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
+#define NAME_OFFSET(de) ((int) ((de)->d_name - (char __user *) (de)))
 static int
 filldir32 (void *__buf, const char *name, int namlen, loff_t offset, ino_t ino,
 	   unsigned int d_type)
 {
-	struct linux32_dirent * dirent;
+	struct linux32_dirent __user * dirent;
 	struct getdents32_callback * buf = (struct getdents32_callback *) __buf;
 	int reclen = ROUND_UP(NAME_OFFSET(dirent) + namlen + 1, 4);
 
@@ -327,17 +327,17 @@
 	put_user(reclen, &dirent->d_reclen);
 	copy_to_user(dirent->d_name, name, namlen);
 	put_user(0, dirent->d_name + namlen);
-	dirent = (struct linux32_dirent *)((char *)dirent + reclen);
+	dirent = ((void __user *)dirent) + reclen;
 	buf->current_dir = dirent;
 	buf->count -= reclen;
 	return 0;
 }
 
 asmlinkage long
-sys32_getdents (unsigned int fd, void * dirent, unsigned int count)
+sys32_getdents (unsigned int fd, void __user * dirent, unsigned int count)
 {
 	struct file * file;
-	struct linux32_dirent * lastdirent;
+	struct linux32_dirent __user * lastdirent;
 	struct getdents32_callback buf;
 	int error;
 
@@ -346,7 +346,7 @@
 	if (!file)
 		goto out;
 
-	buf.current_dir = (struct linux32_dirent *) dirent;
+	buf.current_dir = (struct linux32_dirent __user *) dirent;
 	buf.previous = NULL;
 	buf.count = count;
 	buf.error = 0;
@@ -372,7 +372,7 @@
 	      unsigned int d_type)
 {
 	struct readdir32_callback * buf = (struct readdir32_callback *) __buf;
-	struct old_linux32_dirent * dirent;
+	struct old_linux32_dirent __user * dirent;
 
 	if (buf->count)
 		return -EINVAL;
@@ -387,7 +387,7 @@
 }
 
 asmlinkage long
-sys32_readdir (unsigned int fd, void * dirent, unsigned int count)
+sys32_readdir (unsigned int fd, void __user * dirent, unsigned int count)
 {
 	int error;
 	struct file * file;
@@ -477,7 +477,7 @@
 };
 
 asmlinkage long sys32_msgsnd(int msqid,
-				struct msgbuf32 *umsgp32,
+				struct msgbuf32 __user *umsgp32,
 				size_t msgsz, int msgflg)
 {
 	struct msgbuf *mb;
@@ -494,14 +494,14 @@
 	if (err)
 		err = -EFAULT;
 	else
-		KERNEL_SYSCALL(err, sys_msgsnd, msqid, mb, msgsz, msgflg);
+		KERNEL_SYSCALL(err, sys_msgsnd, msqid, (struct msgbuf __user *)mb, msgsz, msgflg);
 
 	kfree(mb);
 	return err;
 }
 
 asmlinkage long sys32_msgrcv(int msqid,
-				struct msgbuf32 *umsgp32,
+				struct msgbuf32 __user *umsgp32,
 				size_t msgsz, long msgtyp, int msgflg)
 {
 	struct msgbuf *mb;
@@ -511,7 +511,7 @@
 	if ((mb = kmalloc(msgsz + sizeof *mb + 4, GFP_KERNEL)) == NULL)
 		return -ENOMEM;
 
-	KERNEL_SYSCALL(err, sys_msgrcv, msqid, mb, msgsz, msgtyp, msgflg);
+	KERNEL_SYSCALL(err, sys_msgrcv, msqid, (struct msgbuf __user *)mb, msgsz, msgtyp, msgflg);
 
 	if (err >= 0) {
 		len = err;
@@ -528,7 +528,7 @@
 	return err;
 }
 
-asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
+asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset, s32 count)
 {
         mm_segment_t old_fs = get_fs();
         int ret;
@@ -538,7 +538,7 @@
                 return -EFAULT;
 
         set_fs(KERNEL_DS);
-        ret = sys_sendfile(out_fd, in_fd, offset ? &of : NULL, count);
+        ret = sys_sendfile(out_fd, in_fd, offset ? (off_t __user *)&of : NULL, count);
         set_fs(old_fs);
 
         if (offset && put_user(of, offset))
@@ -547,9 +547,7 @@
         return ret;
 }
 
-typedef long __kernel_loff_t32;		/* move this to asm/posix_types.h? */
-
-asmlinkage int sys32_sendfile64(int out_fd, int in_fd, __kernel_loff_t32 *offset, s32 count)
+asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t __user *offset, s32 count)
 {
 	mm_segment_t old_fs = get_fs();
 	int ret;
@@ -559,7 +557,7 @@
 		return -EFAULT;
 		
 	set_fs(KERNEL_DS);
-	ret = sys_sendfile64(out_fd, in_fd, offset ? &lof : NULL, count);
+	ret = sys_sendfile64(out_fd, in_fd, offset ? (loff_t __user *)&lof : NULL, count);
 	set_fs(old_fs);
 	
 	if (offset && put_user(lof, offset))
@@ -598,7 +596,7 @@
 	int  :32; int  :32; int  :32; int  :32;
 };
 
-asmlinkage long sys32_adjtimex(struct timex32 *txc_p32)
+asmlinkage long sys32_adjtimex(struct timex32 __user *txc_p32)
 {
 	struct timex txc;
 	struct timex32 t32;
@@ -647,7 +645,7 @@
  * damage, I decided to just duplicate the code from sys_sysinfo here.
  */
 
-asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
+asmlinkage int sys32_sysinfo(struct sysinfo32 __user *info)
 {
 	struct sysinfo val;
 	int err;
@@ -714,7 +712,7 @@
 	return sys_semctl (semid, semnum, cmd, arg);
 }
 
-long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char *buf,
+long sys32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf,
 			  size_t len)
 {
 	return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low,
diff -Nru a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c
--- a/arch/parisc/kernel/traps.c	2005-01-20 21:02:14 -08:00
+++ b/arch/parisc/kernel/traps.c	2005-03-08 11:15:56 -08:00
@@ -242,7 +242,7 @@
 	struct siginfo si;
 
 	si.si_code = wot;
-	si.si_addr = (void *) (regs->iaoq[0] & ~3);
+	si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
 	si.si_signo = SIGTRAP;
 	si.si_errno = 0;
 	force_sig_info(SIGTRAP, &si, current);
@@ -263,7 +263,7 @@
 		show_regs(regs);
 #endif
 		si.si_code = TRAP_BRKPT;
-		si.si_addr = (void *) (regs->iaoq[0] & ~3);
+		si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
 		si.si_signo = SIGTRAP;
 		force_sig_info(SIGTRAP, &si, current);
 		break;
@@ -281,7 +281,7 @@
 #endif
 		si.si_signo = SIGTRAP;
 		si.si_code = TRAP_BRKPT;
-		si.si_addr = (void *) (regs->iaoq[0] & ~3);
+		si.si_addr = (void __user *) (regs->iaoq[0] & ~3);
 		force_sig_info(SIGTRAP, &si, current);
 		return;
 	}
@@ -569,7 +569,7 @@
 	give_sigill:
 		si.si_signo = SIGILL;
 		si.si_errno = 0;
-		si.si_addr = (void *) regs->iaoq[0];
+		si.si_addr = (void __user *) regs->iaoq[0];
 		force_sig_info(SIGILL, &si, current);
 		return;
 
@@ -577,7 +577,7 @@
 		/* Overflow Trap, let the userland signal handler do the cleanup */
 		si.si_signo = SIGFPE;
 		si.si_code = FPE_INTOVF;
-		si.si_addr = (void *) regs->iaoq[0];
+		si.si_addr = (void __user *) regs->iaoq[0];
 		force_sig_info(SIGFPE, &si, current);
 		return;
 		
@@ -699,9 +699,9 @@
 		si.si_signo = SIGSEGV;
 		si.si_errno = 0;
 		if (code == 7)
-		    si.si_addr = (void *) regs->iaoq[0];
+		    si.si_addr = (void __user *) regs->iaoq[0];
 		else
-		    si.si_addr = (void *) regs->ior;
+		    si.si_addr = (void __user *) regs->ior;
 		force_sig_info(SIGSEGV, &si, current);
 		return;
 
@@ -721,7 +721,7 @@
 			si.si_signo = SIGBUS;
 			si.si_code = BUS_OBJERR;
 			si.si_errno = 0;
-			si.si_addr = (void *) regs->ior;
+			si.si_addr = (void __user *) regs->ior;
 			force_sig_info(SIGBUS, &si, current);
 			return;
 		}
@@ -745,7 +745,7 @@
 		si.si_signo = SIGSEGV;
 		si.si_errno = 0;
 		si.si_code = SEGV_MAPERR;
-		si.si_addr = (void *) regs->ior;
+		si.si_addr = (void __user *) regs->ior;
 		force_sig_info(SIGSEGV, &si, current);
 		return;
 	    }
diff -Nru a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
--- a/arch/parisc/kernel/unaligned.c	2004-10-31 22:09:36 -08:00
+++ b/arch/parisc/kernel/unaligned.c	2005-03-08 11:15:56 -08:00
@@ -744,7 +744,7 @@
 			si.si_signo = SIGSEGV;
 			si.si_errno = 0;
 			si.si_code = SEGV_MAPERR;
-			si.si_addr = (void *)regs->ior;
+			si.si_addr = (void __user *)regs->ior;
 			force_sig_info(SIGSEGV, &si, current);
 		}
 		else
@@ -754,7 +754,7 @@
 			si.si_signo = SIGBUS;
 			si.si_errno = 0;
 			si.si_code = BUS_ADRALN;
-			si.si_addr = (void *)regs->ior;
+			si.si_addr = (void __user *)regs->ior;
 			force_sig_info(SIGBUS, &si, current);
 		}
 		
diff -Nru a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
--- a/arch/parisc/kernel/vmlinux.lds.S	2004-09-03 16:55:27 -07:00
+++ b/arch/parisc/kernel/vmlinux.lds.S	2005-03-02 03:25:26 -08:00
@@ -29,7 +29,7 @@
 #include <asm/page.h>
 	
 /* ld script to make hppa Linux kernel */
-#ifndef CONFIG_PARISC64
+#ifndef CONFIG_64BIT
 OUTPUT_FORMAT("elf32-hppa-linux")
 OUTPUT_ARCH(hppa)
 #else
@@ -38,7 +38,7 @@
 #endif
 
 ENTRY(_stext)
-#ifndef CONFIG_PARISC64
+#ifndef CONFIG_64BIT
 jiffies = jiffies_64 + 4;
 #else
 jiffies = jiffies_64;
@@ -112,7 +112,7 @@
   . = ALIGN(16384);	
   init_istack : { *(init_istack) }
 
-#ifdef CONFIG_PARISC64
+#ifdef CONFIG_64BIT
   . = ALIGN(16);               /* Linkage tables */
   .opd : { *(.opd) } PROVIDE (__gp = .); 
   .plt : { *(.plt) } 
@@ -180,7 +180,7 @@
   /* Sections to be discarded */
   /DISCARD/ : {
 	*(.exitcall.exit)
-#ifdef CONFIG_PARISC64
+#ifdef CONFIG_64BIT
 	/* temporary hack until binutils is fixed to not emit these
 	 for static binaries */
 	*(.interp)
diff -Nru a/arch/parisc/lib/checksum.c b/arch/parisc/lib/checksum.c
--- a/arch/parisc/lib/checksum.c	2005-01-15 14:01:58 -08:00
+++ b/arch/parisc/lib/checksum.c	2005-03-08 11:15:56 -08:00
@@ -131,9 +131,9 @@
  * Copy from userspace and compute checksum.  If we catch an exception
  * then zero the rest of the buffer.
  */
-unsigned int csum_partial_copy_from_user (const unsigned char *src, unsigned char *dst,
-                                          int len, unsigned int sum,
-                                          int *err_ptr)
+unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
+					unsigned char *dst, int len,
+					unsigned int sum, int *err_ptr)
 {
 	int missing;
 
diff -Nru a/arch/parisc/math-emu/driver.c b/arch/parisc/math-emu/driver.c
--- a/arch/parisc/math-emu/driver.c	2004-02-03 21:41:58 -08:00
+++ b/arch/parisc/math-emu/driver.c	2005-03-08 11:15:57 -08:00
@@ -27,7 +27,6 @@
  *  Copyright (C) 2001	      Hewlett-Packard <bame@debian.org>
  */
 
-#include <linux/config.h>
 #include <linux/sched.h>
 #include "float.h"
 #include "math-emu.h"
@@ -120,7 +119,7 @@
 	    si.si_signo = signalcode >> 24;
 	    si.si_errno = 0;
 	    si.si_code = signalcode & 0xffffff;
-	    si.si_addr = (void *) regs->iaoq[0];
+	    si.si_addr = (void __user *) regs->iaoq[0];
 	    force_sig_info(si.si_signo, &si, current);
 	    return -1;
 	}
diff -Nru a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c
--- a/arch/parisc/mm/fault.c	2004-10-31 22:09:37 -08:00
+++ b/arch/parisc/mm/fault.c	2005-03-08 11:15:57 -08:00
@@ -225,7 +225,7 @@
 		si.si_signo = SIGSEGV;
 		si.si_errno = 0;
 		si.si_code = SEGV_MAPERR;
-		si.si_addr = (void *) address;
+		si.si_addr = (void __user *) address;
 		force_sig_info(SIGSEGV, &si, current);
 		return;
 	}
diff -Nru a/arch/parisc/mm/kmap.c b/arch/parisc/mm/kmap.c
--- a/arch/parisc/mm/kmap.c	2004-02-03 21:42:01 -08:00
+++ b/arch/parisc/mm/kmap.c	2005-02-23 15:40:52 -08:00
@@ -49,10 +49,10 @@
  * unmap_uncached_page() and save a little code space but I didn't
  * do that since I'm not certain whether this is the right path. -PB
  */
-static void unmap_cached_pte(pte_t * pte, unsigned long arg)
+static void unmap_cached_pte(pte_t * pte, unsigned long addr, unsigned long arg)
 {
 	pte_t page = *pte;
-	pte_clear(pte);
+	pte_clear(&init_mm, addr, pte);
 	if (!pte_none(page)) {
 		if (pte_present(page)) {
 			unsigned long map_nr = pte_pagenr(page);
diff -Nru a/arch/ppc/Kconfig b/arch/ppc/Kconfig
--- a/arch/ppc/Kconfig	2005-01-20 20:56:31 -08:00
+++ b/arch/ppc/Kconfig	2005-03-07 20:41:25 -08:00
@@ -52,17 +52,17 @@
 	default 6xx
 
 config 6xx
-	bool "6xx/7xx/74xx/52xx/8260"
+	bool "6xx/7xx/74xx/52xx/82xx/83xx"
 	help
 	  There are four types of PowerPC chips supported.  The more common
 	  types (601, 603, 604, 740, 750, 7400), the Motorola embedded
-	  versions (821, 823, 850, 855, 860, 52xx, 8260), the IBM embedded
+	  versions (821, 823, 850, 855, 860, 52xx, 82xx, 83xx), the IBM embedded
 	  versions (403 and 405) and the high end 64 bit Power processors
 	  (POWER 3, POWER4, and IBM 970 also known as G5)
 	  Unless you are building a kernel for one of the embedded processor
 	  systems, 64 bit IBM RS/6000 or an Apple G5, choose 6xx.
 	  Note that the kernel runs in 32-bit mode even on 64-bit chips.
-	  Also note that because the 52xx & 82xx family has a 603e core,
+	  Also note that because the 52xx, 82xx, & 83xx family has a 603e core,
 	  specific support for that chipset is asked later on.
 
 config 40x
@@ -109,7 +109,7 @@
 config ALTIVEC
 	bool "AltiVec Support"
 	depends on 6xx || POWER4
-	depends on !8260
+	depends on !8260 && !83xx
 	---help---
 	  This option enables kernel support for the Altivec extensions to the
 	  PowerPC processor. The kernel currently supports saving and restoring
@@ -140,7 +140,7 @@
 
 config TAU
 	bool "Thermal Management Support"
-	depends on 6xx && !8260
+	depends on 6xx && !8260 && !83xx
 	help
 	  G3 and G4 processors have an on-chip temperature sensor called the
 	  'Thermal Assist Unit (TAU)', which, in theory, can measure the on-die
@@ -228,6 +228,7 @@
 	  If in doubt, say Y here.
 
 source arch/ppc/platforms/4xx/Kconfig
+source arch/ppc/platforms/83xx/Kconfig
 source arch/ppc/platforms/85xx/Kconfig
 
 config PPC64BRIDGE
@@ -475,7 +476,7 @@
 
 choice
 	prompt "Machine Type"
-	depends on 6xx || POWER3 || POWER4
+	depends on (6xx && !83xx) || POWER3 || POWER4
 	default PPC_MULTIPLATFORM
 	---help---
 	  Linux currently supports several different kinds of PowerPC-based
@@ -568,6 +569,10 @@
 	  Select SANDPOINT if configuring for a Motorola Sandpoint X3
 	  (any flavor).
 
+config RADSTONE_PPC7D
+	bool "Radstone Technology PPC7D board"
+	select MV64360
+
 config ADIR
 	bool "SBS-Adirondack"
 
@@ -660,7 +665,7 @@
 
 config 8260
 	bool "CPM2 Support" if WILLOW
-	depends on 6xx
+	depends on 6xx && !83xx
 	default y if TQM8260 || RPX8260 || EST8260 || SBS8260 || SBC82xx || PQ2FADS
 	help
 	  The MPC8260 is a typical embedded CPU made by Motorola.  Selecting
@@ -715,7 +720,7 @@
 	bool
 	depends on SANDPOINT || MCPN765 || SPRUCE || PPLUS || PCORE || \
 		PRPMC750 || K2 || PRPMC800 || LOPEC || \
-		(EV64260 && !SERIAL_MPSC) || CHESTNUT
+		(EV64260 && !SERIAL_MPSC) || CHESTNUT || RADSTONE_PPC7D
 	default y
 
 config FORCE
@@ -730,7 +735,7 @@
 
 config MV64360
 	bool
-	depends on KATANA
+	depends on KATANA || RADSTONE_PPC7D
 	default y
 
 config MV64360
@@ -1079,8 +1084,8 @@
 	bool
 
 config PCI
-	bool "PCI support" if 40x || CPM2 || 85xx
-	default y if !40x && !CPM2 && !8xx && !APUS && !85xx
+	bool "PCI support" if 40x || CPM2 || 83xx || 85xx
+	default y if !40x && !CPM2 && !8xx && !APUS && !83xx && !85xx
 	default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS
 	default PCI_QSPAN if !4xx && !CPM2 && 8xx
 	help
diff -Nru a/arch/ppc/Makefile b/arch/ppc/Makefile
--- a/arch/ppc/Makefile	2005-01-03 15:49:20 -08:00
+++ b/arch/ppc/Makefile	2005-03-04 22:41:52 -08:00
@@ -57,6 +57,7 @@
 core-y				+= arch/ppc/kernel/ arch/ppc/platforms/ \
 				   arch/ppc/mm/ arch/ppc/lib/ arch/ppc/syslib/
 core-$(CONFIG_4xx)		+= arch/ppc/platforms/4xx/
+core-$(CONFIG_83xx)		+= arch/ppc/platforms/83xx/
 core-$(CONFIG_85xx)		+= arch/ppc/platforms/85xx/
 core-$(CONFIG_MATH_EMULATION)	+= arch/ppc/math-emu/
 core-$(CONFIG_XMON)		+= arch/ppc/xmon/
@@ -112,26 +113,24 @@
 TOUT	:= .tmp_gas_check
 # Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec
 # instructions.
-AS_ALTIVEC	:= $(shell echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; echo $$?)
 # gcc-3.4 and binutils-2.14 are a fatal combination.
 GCC_VERSION	:= $(call cc-version)
-BAD_GCC_AS	:= $(shell echo mftb 5 | $(AS) -mppc -many -o $(TOUT) >/dev/null 2>&1 && echo 0 || echo 1)
 
 checkbin:
-ifeq ($(GCC_VERSION)$(BAD_GCC_AS),03041)
-	@echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '
-	@echo 'correctly with gcc-3.4 and your version of binutils.'
-	@echo '*** Please upgrade your binutils or downgrade your gcc'
-	@false
-endif
-ifneq ($(AS_ALTIVEC),0)
-	echo $(AS_ALTIVEC)
-	@echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '
-	@echo 'correctly with old versions of binutils.'
-	@echo '*** Please upgrade your binutils to 2.12.1 or newer'
-	@false
-endif
-	@true
+	@if test "$(GCC_VERSION)" = "0304" ; then \
+		if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
+			echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
+			echo 'correctly with gcc-3.4 and your version of binutils.'; \
+			echo '*** Please upgrade your binutils or downgrade your gcc'; \
+			false; \
+		fi ; \
+	fi
+	@if ! /bin/echo dssall | $(AS) -many -o $(TOUT) >/dev/null 2>&1 ; then \
+		echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build ' ; \
+		echo 'correctly with old versions of binutils.' ; \
+		echo '*** Please upgrade your binutils to 2.12.1 or newer' ; \
+		false ; \
+	fi
 
 CLEAN_FILES +=	include/asm-$(ARCH)/offsets.h \
 		arch/$(ARCH)/kernel/asm-offsets.s \
diff -Nru a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
--- a/arch/ppc/boot/simple/Makefile	2005-02-03 06:42:41 -08:00
+++ b/arch/ppc/boot/simple/Makefile	2005-03-07 20:41:25 -08:00
@@ -65,6 +65,7 @@
 zimageinitrd-$(CONFIG_EBONY)		:= zImage.initrd-TREE
          end-$(CONFIG_EBONY)		:= ebony
   entrypoint-$(CONFIG_EBONY)		:= 0x01000000
+     extra.o-$(CONFIG_EBONY)		:= openbios.o
 
       zimage-$(CONFIG_LUAN)		:= zImage-TREE
 zimageinitrd-$(CONFIG_LUAN)		:= zImage.initrd-TREE
@@ -96,6 +97,10 @@
      extra.o-$(CONFIG_KATANA)		:= misc-katana.o mv64x60_stub.o
          end-$(CONFIG_KATANA)		:= katana
    cacheflag-$(CONFIG_KATANA)		:= -include $(clear_L2_L3)
+
+     extra.o-$(CONFIG_RADSTONE_PPC7D)	:= misc-radstone_ppc7d.o mv64x60_stub.o
+         end-$(CONFIG_RADSTONE_PPC7D)	:= radstone_ppc7d
+   cacheflag-$(CONFIG_RADSTONE_PPC7D)	:= -include $(clear_L2_L3)
 
 # kconfig 'feature', only one of these will ever be 'y' at a time.
 # The rest will be unset.
diff -Nru a/arch/ppc/boot/simple/misc-mv64x60.S b/arch/ppc/boot/simple/misc-mv64x60.S
--- a/arch/ppc/boot/simple/misc-mv64x60.S	2005-01-03 20:31:54 -08:00
+++ b/arch/ppc/boot/simple/misc-mv64x60.S	2005-03-04 22:41:16 -08:00
@@ -32,7 +32,11 @@
 #if (CONFIG_MV64X60_NEW_BASE != CONFIG_MV64X60_BASE)
 move_base:
 	li	r20,0
+#ifdef CONFIG_GT64260
 	li	r23,20
+#else /* Must be mv64[34]60 which uses top 16 bits */
+	li	r23,16
+#endif
 
 	/* Relocate bridge's regs */
 	addis	r25,0,CONFIG_MV64X60_BASE@h
diff -Nru a/arch/ppc/boot/simple/misc-radstone_ppc7d.c b/arch/ppc/boot/simple/misc-radstone_ppc7d.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/boot/simple/misc-radstone_ppc7d.c	2005-03-07 20:41:25 -08:00
@@ -0,0 +1,19 @@
+/*
+ * arch/ppc/boot/simple/misc-radstone_ppc7d.c
+ *
+ * Misc data for Radstone PPC7D board.
+ *
+ * Author: James Chapman <jchapman@katalix.com>
+ */
+
+#include <linux/types.h>
+#include <asm/reg.h>
+
+#include "../../platforms/radstone_ppc7d.h"
+
+#if defined(CONFIG_SERIAL_MPSC_CONSOLE)
+long	mv64x60_mpsc_clk_freq = PPC7D_MPSC_CLK_FREQ;;
+long	mv64x60_mpsc_clk_src = PPC7D_MPSC_CLK_SRC;
+long	mv64x60_mpsc_console_baud = PPC7D_DEFAULT_BAUD;
+#endif
+
diff -Nru a/arch/ppc/boot/simple/openbios.c b/arch/ppc/boot/simple/openbios.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/boot/simple/openbios.c	2005-03-04 22:41:48 -08:00
@@ -0,0 +1,37 @@
+/*
+ * arch/ppc/boot/simple/openbios.c
+ *
+ * 2005 (c) SYSGO AG - g.jaeger@sysgo.com
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without
+ * any warranty of any kind, whether express or implied.
+ *
+ * Derived from arch/ppc/boot/simple/pibs.c (from MontaVista)
+ */
+
+#include <linux/types.h>
+#include <linux/config.h>
+#include <linux/string.h>
+#include <asm/ppcboot.h>
+#include <platforms/4xx/ebony.h>
+
+extern unsigned long decompress_kernel(unsigned long load_addr, int num_words,
+				       unsigned long cksum);
+
+/* We need to make sure that this is before the images to ensure
+ * that it's in a mapped location. */
+bd_t hold_resid_buf __attribute__ ((__section__ (".data.boot")));
+bd_t *hold_residual = &hold_resid_buf;
+
+void *
+load_kernel(unsigned long load_addr, int num_words, unsigned long cksum,
+		void *ign1, void *ign2)
+{
+	decompress_kernel(load_addr, num_words, cksum);
+
+	/* simply copy the MAC addresses */
+	memcpy(hold_residual->bi_enetaddr,  (char *)EBONY_OPENBIOS_MAC_BASE, 6);
+	memcpy(hold_residual->bi_enet1addr, (char *)(EBONY_OPENBIOS_MAC_BASE+EBONY_OPENBIOS_MAC_OFFSET), 6);
+
+	return (void *)hold_residual;
+}
diff -Nru a/arch/ppc/configs/katana_defconfig b/arch/ppc/configs/katana_defconfig
--- a/arch/ppc/configs/katana_defconfig	2005-01-30 22:22:37 -08:00
+++ b/arch/ppc/configs/katana_defconfig	2005-03-04 22:41:16 -08:00
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.11-rc2
-# Tue Jan 25 16:31:13 2005
+# Linux kernel version: 2.6.11-rc4
+# Tue Feb 15 14:27:12 2005
 #
 CONFIG_MMU=y
 CONFIG_GENERIC_HARDIRQS=y
@@ -152,8 +152,8 @@
 CONFIG_TASK_SIZE=0x80000000
 CONFIG_CONSISTENT_START_BOOL=y
 CONFIG_CONSISTENT_START=0xf0000000
-# CONFIG_CONSISTENT_SIZE_BOOL is not set
-CONFIG_CONSISTENT_SIZE=0x00200000
+CONFIG_CONSISTENT_SIZE_BOOL=y
+CONFIG_CONSISTENT_SIZE=0x00400000
 # CONFIG_BOOT_LOAD_BOOL is not set
 CONFIG_BOOT_LOAD=0x00800000
 
@@ -171,7 +171,82 @@
 #
 # Memory Technology Devices (MTD)
 #
-# CONFIG_MTD is not set
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+CONFIG_MTD_PARTITIONS=y
+CONFIG_MTD_CONCAT=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+CONFIG_MTD_CFI_GEOMETRY=y
+# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_2 is not set
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+# CONFIG_MTD_CFI_I1 is not set
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+# CONFIG_MTD_XIP is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_PHYSMAP_START=0xe0000000
+CONFIG_MTD_PHYSMAP_LEN=0x0
+CONFIG_MTD_PHYSMAP_BANKWIDTH=4
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_PMC551 is not set
+# CONFIG_MTD_SLRAM is not set
+CONFIG_MTD_PHRAM=y
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLKMTD is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+# CONFIG_MTD_NAND is not set
 
 #
 # Parallel port support
@@ -531,7 +606,6 @@
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
 # Sound
@@ -573,6 +647,10 @@
 # CONFIG_JBD is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
@@ -619,6 +697,8 @@
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
+# CONFIG_JFFS_FS is not set
+# CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
@@ -637,7 +717,6 @@
 CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
-# CONFIG_EXPORTFS is not set
 CONFIG_SUNRPC=y
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
diff -Nru a/arch/ppc/configs/mpc834x_sys_defconfig b/arch/ppc/configs/mpc834x_sys_defconfig
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/configs/mpc834x_sys_defconfig	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,644 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-rc4
+# Thu Feb 17 16:12:23 2005
+#
+CONFIG_MMU=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_HAVE_DEC_LOCK=y
+CONFIG_PPC=y
+CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
+
+#
+# Code maturity level options
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_CLEAN_COMPILE=y
+CONFIG_BROKEN_ON_SMP=y
+
+#
+# General setup
+#
+CONFIG_LOCALVERSION=""
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+CONFIG_KOBJECT_UEVENT=y
+# CONFIG_IKCONFIG is not set
+CONFIG_EMBEDDED=y
+# CONFIG_KALLSYMS is not set
+CONFIG_FUTEX=y
+# CONFIG_EPOLL is not set
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
+
+#
+# Loadable module support
+#
+# CONFIG_MODULES is not set
+
+#
+# Processor
+#
+CONFIG_6xx=y
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_POWER3 is not set
+# CONFIG_POWER4 is not set
+# CONFIG_8xx is not set
+# CONFIG_E500 is not set
+# CONFIG_CPU_FREQ is not set
+CONFIG_PPC_GEN550=y
+CONFIG_83xx=y
+
+#
+# Freescale 83xx options
+#
+CONFIG_MPC834x_SYS=y
+CONFIG_MPC834x=y
+CONFIG_PPC_STD_MMU=y
+
+#
+# Platform options
+#
+# CONFIG_SMP is not set
+# CONFIG_PREEMPT is not set
+# CONFIG_HIGHMEM is not set
+CONFIG_BINFMT_ELF=y
+# CONFIG_BINFMT_MISC is not set
+# CONFIG_CMDLINE_BOOL is not set
+
+#
+# Bus options
+#
+CONFIG_GENERIC_ISA_DMA=y
+# CONFIG_PCI is not set
+# CONFIG_PCI_DOMAINS is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# Advanced setup
+#
+# CONFIG_ADVANCED_OPTIONS is not set
+
+#
+# Default settings for advanced configuration options are used
+#
+CONFIG_HIGHMEM_START=0xfe000000
+CONFIG_LOWMEM_SIZE=0x30000000
+CONFIG_KERNEL_START=0xc0000000
+CONFIG_TASK_SIZE=0x80000000
+CONFIG_BOOT_LOAD=0x00800000
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
+
+#
+# Memory Technology Devices (MTD)
+#
+# CONFIG_MTD is not set
+
+#
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Plug and Play support
+#
+
+#
+# Block devices
+#
+# CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=32768
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
+
+#
+# ATA/ATAPI/MFM/RLL support
+#
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_SCSI is not set
+
+#
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# Fusion MPT device support
+#
+
+#
+# IEEE 1394 (FireWire) support
+#
+
+#
+# I2O device support
+#
+
+#
+# Macintosh device drivers
+#
+
+#
+# Networking support
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+# CONFIG_NETLINK_DEV is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETFILTER is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_NET_DIVERT is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+
+#
+# Ethernet (10 or 100Mbit)
+#
+CONFIG_NET_ETHERNET=y
+CONFIG_MII=y
+
+#
+# Ethernet (1000 Mbit)
+#
+CONFIG_GIANFAR=y
+# CONFIG_GFAR_NAPI is not set
+
+#
+# Ethernet (10000 Mbit)
+#
+
+#
+# Token Ring devices
+#
+
+#
+# Wireless LAN (non-hamradio)
+#
+# CONFIG_NET_RADIO is not set
+
+#
+# Wan interfaces
+#
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+
+#
+# ISDN subsystem
+#
+# CONFIG_ISDN is not set
+
+#
+# Telephony Support
+#
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+
+#
+# Userland interfaces
+#
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+# CONFIG_SERIO is not set
+# CONFIG_SERIO_I8042 is not set
+
+#
+# Input Device Drivers
+#
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Character devices
+#
+# CONFIG_VT is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=4
+# CONFIG_SERIAL_8250_EXTENDED is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+# CONFIG_WATCHDOG is not set
+# CONFIG_NVRAM is not set
+CONFIG_GEN_RTC=y
+# CONFIG_GEN_RTC_X is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+
+#
+# Ftape, the floppy tape device driver
+#
+# CONFIG_AGP is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
+
+#
+# I2C support
+#
+CONFIG_I2C=y
+CONFIG_I2C_CHARDEV=y
+
+#
+# I2C Algorithms
+#
+# CONFIG_I2C_ALGOBIT is not set
+# CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
+
+#
+# I2C Hardware Bus support
+#
+# CONFIG_I2C_ISA is not set
+CONFIG_I2C_MPC=y
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_PCA_ISA is not set
+
+#
+# Hardware Sensors Chip support
+#
+# CONFIG_I2C_SENSOR is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_FSCHER is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
+
+#
+# Other I2C Chip support
+#
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_RTC8564 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+
+#
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
+# Misc devices
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=y
+# CONFIG_NFS_V3 is not set
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFS_DIRECTIO is not set
+# CONFIG_NFSD is not set
+CONFIG_ROOT_NFS=y
+CONFIG_LOCKD=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+# CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+# CONFIG_MSDOS_PARTITION is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+
+#
+# Native Language Support
+#
+# CONFIG_NLS is not set
+
+#
+# Library routines
+#
+# CONFIG_CRC_CCITT is not set
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_SERIAL_TEXT_DEBUG is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Hardware crypto devices
+#
diff -Nru a/arch/ppc/configs/pmac_defconfig b/arch/ppc/configs/pmac_defconfig
--- a/arch/ppc/configs/pmac_defconfig	2004-11-27 03:20:13 -08:00
+++ b/arch/ppc/configs/pmac_defconfig	2005-03-04 22:41:16 -08:00
@@ -1,8 +1,12 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-rc4
+# Sun Feb 13 14:56:58 2005
 #
 CONFIG_MMU=y
+CONFIG_GENERIC_HARDIRQS=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_PPC=y
 CONFIG_PPC32=y
@@ -13,40 +17,45 @@
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
-# CONFIG_STANDALONE is not set
 CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
-# CONFIG_AUDIT is not set
-CONFIG_LOG_BUF_SHIFT=14
+CONFIG_LOG_BUF_SHIFT=16
 CONFIG_HOTPLUG=y
+CONFIG_KOBJECT_UEVENT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
 #
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
+CONFIG_MODVERSIONS=y
+CONFIG_MODULE_SRCVERSION_ALL=y
 CONFIG_KMOD=y
 
 #
@@ -58,17 +67,21 @@
 # CONFIG_POWER3 is not set
 # CONFIG_POWER4 is not set
 # CONFIG_8xx is not set
+# CONFIG_E500 is not set
 CONFIG_ALTIVEC=y
 CONFIG_TAU=y
 # CONFIG_TAU_INT is not set
 # CONFIG_TAU_AVERAGE is not set
 CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_PROC_INTF=y
+# CONFIG_CPU_FREQ_DEBUG is not set
+CONFIG_CPU_FREQ_STAT=m
+CONFIG_CPU_FREQ_STAT_DETAILS=y
 CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
 # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
 CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
-# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
-# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
+CONFIG_CPU_FREQ_GOV_POWERSAVE=m
+CONFIG_CPU_FREQ_GOV_USERSPACE=m
+CONFIG_CPU_FREQ_GOV_ONDEMAND=m
 CONFIG_CPU_FREQ_PMAC=y
 CONFIG_CPU_FREQ_TABLE=y
 CONFIG_PPC601_SYNC_FIX=y
@@ -80,11 +93,14 @@
 #
 CONFIG_PPC_MULTIPLATFORM=y
 # CONFIG_APUS is not set
+# CONFIG_KATANA is not set
 # CONFIG_WILLOW is not set
+# CONFIG_CPCI690 is not set
 # CONFIG_PCORE is not set
 # CONFIG_POWERPMC250 is not set
-# CONFIG_EV64260 is not set
+# CONFIG_CHESTNUT is not set
 # CONFIG_SPRUCE is not set
+# CONFIG_EV64260 is not set
 # CONFIG_LOPEC is not set
 # CONFIG_MCPN765 is not set
 # CONFIG_MVME5100 is not set
@@ -97,9 +113,13 @@
 # CONFIG_PAL4 is not set
 # CONFIG_GEMINI is not set
 # CONFIG_EST8260 is not set
+# CONFIG_SBC82xx is not set
 # CONFIG_SBS8260 is not set
-# CONFIG_RPX6 is not set
+# CONFIG_RPX8260 is not set
 # CONFIG_TQM8260 is not set
+# CONFIG_ADS8272 is not set
+# CONFIG_PQ2FADS is not set
+# CONFIG_LITE5200 is not set
 CONFIG_PPC_CHRP=y
 CONFIG_PPC_PMAC=y
 CONFIG_PPC_PREP=y
@@ -108,11 +128,9 @@
 # CONFIG_SMP is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_HIGHMEM is not set
-CONFIG_KERNEL_ELF=y
 CONFIG_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=m
 CONFIG_PROC_DEVICETREE=y
-CONFIG_PPC_RTAS=y
 # CONFIG_PREP_RESIDUAL is not set
 # CONFIG_CMDLINE_BOOL is not set
 
@@ -127,14 +145,21 @@
 CONFIG_PCI_NAMES=y
 
 #
-# PCMCIA/CardBus support
+# PCCARD (PCMCIA/CardBus) support
 #
-CONFIG_PCMCIA=m
+CONFIG_PCCARD=m
 # CONFIG_PCMCIA_DEBUG is not set
-CONFIG_YENTA=m
+CONFIG_PCMCIA=m
 CONFIG_CARDBUS=y
-CONFIG_I82092=m
-CONFIG_TCIC=m
+
+#
+# PC-card bridges
+#
+CONFIG_YENTA=m
+# CONFIG_PD6729 is not set
+# CONFIG_I82092 is not set
+# CONFIG_TCIC is not set
+CONFIG_PCCARD_NONSTATIC=m
 
 #
 # Advanced setup
@@ -156,7 +181,10 @@
 #
 # Generic Driver Options
 #
+# CONFIG_STANDALONE is not set
+CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -176,18 +204,35 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
+CONFIG_MAC_FLOPPY=m
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_CARMEL is not set
+# CONFIG_BLK_DEV_SX8 is not set
+# CONFIG_BLK_DEV_UB is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
 CONFIG_LBD=y
+CONFIG_CDROM_PKTCDVD=m
+CONFIG_CDROM_PKTCDVD_BUFFERS=8
+# CONFIG_CDROM_PKTCDVD_WCACHE is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -198,16 +243,15 @@
 #
 # Please see Documentation/ide.txt for help/info on IDE drives
 #
+# CONFIG_BLK_DEV_IDE_SATA is not set
 CONFIG_BLK_DEV_IDEDISK=y
 # CONFIG_IDEDISK_MULTI_MODE is not set
-# CONFIG_IDEDISK_STROKE is not set
-CONFIG_BLK_DEV_IDECS=m
+# CONFIG_BLK_DEV_IDECS is not set
 CONFIG_BLK_DEV_IDECD=y
 # CONFIG_BLK_DEV_IDETAPE is not set
 CONFIG_BLK_DEV_IDEFLOPPY=y
 CONFIG_BLK_DEV_IDESCSI=y
 # CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
 
 #
 # IDE chipset support/bugfixes
@@ -218,12 +262,11 @@
 # CONFIG_BLK_DEV_OFFBOARD is not set
 CONFIG_BLK_DEV_GENERIC=y
 # CONFIG_BLK_DEV_OPTI621 is not set
-CONFIG_BLK_DEV_SL82C105=y
+# CONFIG_BLK_DEV_SL82C105 is not set
 CONFIG_BLK_DEV_IDEDMA_PCI=y
 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
 CONFIG_IDEDMA_PCI_AUTO=y
 # CONFIG_IDEDMA_ONLYDISK is not set
-CONFIG_BLK_DEV_ADMA=y
 # CONFIG_BLK_DEV_AEC62XX is not set
 # CONFIG_BLK_DEV_ALI15X3 is not set
 # CONFIG_BLK_DEV_AMD74XX is not set
@@ -249,7 +292,7 @@
 CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
 CONFIG_BLK_DEV_IDEDMA_PMAC=y
 CONFIG_BLK_DEV_IDE_PMAC_BLINK=y
-CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y
+# CONFIG_IDE_ARM is not set
 CONFIG_BLK_DEV_IDEDMA=y
 # CONFIG_IDEDMA_IVB is not set
 CONFIG_IDEDMA_AUTO=y
@@ -275,7 +318,6 @@
 # Some SCSI devices (e.g. CD jukebox) support multiple LUNs
 #
 # CONFIG_SCSI_MULTI_LUN is not set
-# CONFIG_SCSI_REPORT_LUNS is not set
 CONFIG_SCSI_CONSTANTS=y
 # CONFIG_SCSI_LOGGING is not set
 
@@ -284,33 +326,35 @@
 #
 CONFIG_SCSI_SPI_ATTRS=y
 # CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
 
 #
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_3W_9XXX is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 CONFIG_SCSI_AIC7XXX=m
 CONFIG_AIC7XXX_CMDS_PER_DEVICE=253
 CONFIG_AIC7XXX_RESET_DELAY_MS=15000
-# CONFIG_AIC7XXX_BUILD_FIRMWARE is not set
 CONFIG_AIC7XXX_DEBUG_ENABLE=y
 CONFIG_AIC7XXX_DEBUG_MASK=0
 CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
 CONFIG_SCSI_AIC7XXX_OLD=m
 # CONFIG_SCSI_AIC79XX is not set
-CONFIG_SCSI_ADVANSYS=m
-# CONFIG_SCSI_MEGARAID is not set
+# CONFIG_SCSI_DPT_I2O is not set
+# CONFIG_MEGARAID_NEWGEN is not set
+# CONFIG_MEGARAID_LEGACY is not set
 # CONFIG_SCSI_SATA is not set
 # CONFIG_SCSI_BUSLOGIC is not set
-# CONFIG_SCSI_CPQFCTS is not set
 # CONFIG_SCSI_DMX3191D is not set
 # CONFIG_SCSI_EATA is not set
 # CONFIG_SCSI_EATA_PIO is not set
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
 # CONFIG_SCSI_GDTH is not set
 # CONFIG_SCSI_IPS is not set
+# CONFIG_SCSI_INITIO is not set
 # CONFIG_SCSI_INIA100 is not set
 CONFIG_SCSI_SYM53C8XX_2=y
 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
@@ -327,7 +371,6 @@
 # CONFIG_SCSI_QLA2300 is not set
 # CONFIG_SCSI_QLA2322 is not set
 # CONFIG_SCSI_QLA6312 is not set
-# CONFIG_SCSI_QLA6322 is not set
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
 # CONFIG_SCSI_NSP32 is not set
@@ -384,7 +427,8 @@
 CONFIG_IEEE1394_ETH1394=m
 CONFIG_IEEE1394_DV1394=m
 CONFIG_IEEE1394_RAWIO=m
-# CONFIG_IEEE1394_CMP is not set
+CONFIG_IEEE1394_CMP=m
+CONFIG_IEEE1394_AMDTP=m
 
 #
 # I2O device support
@@ -400,8 +444,6 @@
 CONFIG_PMAC_PBOOK=y
 CONFIG_PMAC_APM_EMU=y
 CONFIG_PMAC_BACKLIGHT=y
-# CONFIG_MAC_FLOPPY is not set
-CONFIG_MAC_SERIAL=y
 CONFIG_ADB_MACIO=y
 CONFIG_INPUT_ADBHID=y
 CONFIG_MAC_EMUMOUSEBTN=y
@@ -434,6 +476,9 @@
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 
 #
 # IP: Virtual Server Configuration
@@ -447,11 +492,14 @@
 # IP: Netfilter Configuration
 #
 CONFIG_IP_NF_CONNTRACK=m
+CONFIG_IP_NF_CT_ACCT=y
+CONFIG_IP_NF_CONNTRACK_MARK=y
+CONFIG_IP_NF_CT_PROTO_SCTP=m
 CONFIG_IP_NF_FTP=m
 CONFIG_IP_NF_IRC=m
 CONFIG_IP_NF_TFTP=m
 CONFIG_IP_NF_AMANDA=m
-# CONFIG_IP_NF_QUEUE is not set
+CONFIG_IP_NF_QUEUE=m
 CONFIG_IP_NF_IPTABLES=m
 CONFIG_IP_NF_MATCH_LIMIT=m
 CONFIG_IP_NF_MATCH_IPRANGE=m
@@ -471,8 +519,17 @@
 CONFIG_IP_NF_MATCH_STATE=m
 CONFIG_IP_NF_MATCH_CONNTRACK=m
 CONFIG_IP_NF_MATCH_OWNER=m
+CONFIG_IP_NF_MATCH_ADDRTYPE=m
+CONFIG_IP_NF_MATCH_REALM=m
+CONFIG_IP_NF_MATCH_SCTP=m
+CONFIG_IP_NF_MATCH_COMMENT=m
+CONFIG_IP_NF_MATCH_CONNMARK=m
+CONFIG_IP_NF_MATCH_HASHLIMIT=m
 CONFIG_IP_NF_FILTER=m
 CONFIG_IP_NF_TARGET_REJECT=m
+CONFIG_IP_NF_TARGET_LOG=m
+CONFIG_IP_NF_TARGET_ULOG=m
+CONFIG_IP_NF_TARGET_TCPMSS=m
 CONFIG_IP_NF_NAT=m
 CONFIG_IP_NF_NAT_NEEDED=y
 CONFIG_IP_NF_TARGET_MASQUERADE=m
@@ -484,17 +541,19 @@
 CONFIG_IP_NF_NAT_FTP=m
 CONFIG_IP_NF_NAT_TFTP=m
 CONFIG_IP_NF_NAT_AMANDA=m
-# CONFIG_IP_NF_MANGLE is not set
-# CONFIG_IP_NF_TARGET_LOG is not set
-CONFIG_IP_NF_TARGET_ULOG=m
-CONFIG_IP_NF_TARGET_TCPMSS=m
+CONFIG_IP_NF_MANGLE=m
+CONFIG_IP_NF_TARGET_TOS=m
+CONFIG_IP_NF_TARGET_ECN=m
+CONFIG_IP_NF_TARGET_DSCP=m
+CONFIG_IP_NF_TARGET_MARK=m
+CONFIG_IP_NF_TARGET_CLASSIFY=m
+CONFIG_IP_NF_TARGET_CONNMARK=m
+CONFIG_IP_NF_TARGET_CLUSTERIP=m
+CONFIG_IP_NF_RAW=m
+CONFIG_IP_NF_TARGET_NOTRACK=m
 CONFIG_IP_NF_ARPTABLES=m
 CONFIG_IP_NF_ARPFILTER=m
 CONFIG_IP_NF_ARP_MANGLE=m
-CONFIG_IP_NF_COMPAT_IPCHAINS=m
-# CONFIG_IP_NF_COMPAT_IPFWADM is not set
-CONFIG_IP_NF_TARGET_NOTRACK=m
-CONFIG_IP_NF_RAW=m
 
 #
 # SCTP Configuration (EXPERIMENTAL)
@@ -512,12 +571,12 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
 #
 # CONFIG_NET_SCHED is not set
+CONFIG_NET_CLS_ROUTE=y
 
 #
 # Network testing
@@ -593,7 +652,6 @@
 CONFIG_MACE=y
 # CONFIG_MACE_AAUI_PORT is not set
 CONFIG_BMAC=y
-# CONFIG_OAKNET is not set
 # CONFIG_HAPPYMEAL is not set
 CONFIG_SUNGEM=y
 # CONFIG_NET_VENDOR_3COM is not set
@@ -634,6 +692,7 @@
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
 # CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 
 #
@@ -667,7 +726,6 @@
 #
 # Wireless 802.11b ISA/PCI cards support
 #
-# CONFIG_AIRO is not set
 CONFIG_HERMES=m
 CONFIG_APPLE_AIRPORT=m
 # CONFIG_PLX_HERMES is not set
@@ -691,15 +749,7 @@
 #
 # PCMCIA network device support
 #
-CONFIG_NET_PCMCIA=y
-# CONFIG_PCMCIA_3C589 is not set
-# CONFIG_PCMCIA_3C574 is not set
-# CONFIG_PCMCIA_FMVJ18X is not set
-# CONFIG_PCMCIA_PCNET is not set
-# CONFIG_PCMCIA_NMCLAN is not set
-# CONFIG_PCMCIA_SMC91C92 is not set
-# CONFIG_PCMCIA_XIRC2PS is not set
-# CONFIG_PCMCIA_AXNET is not set
+# CONFIG_NET_PCMCIA is not set
 
 #
 # Wan interfaces
@@ -714,10 +764,9 @@
 CONFIG_PPP_SYNC_TTY=m
 CONFIG_PPP_DEFLATE=y
 CONFIG_PPP_BSDCOMP=m
-# CONFIG_PPPOE is not set
+CONFIG_PPPOE=m
 # CONFIG_SLIP is not set
 # CONFIG_NET_FC is not set
-# CONFIG_RCPCI is not set
 # CONFIG_SHAPER is not set
 # CONFIG_NETCONSOLE is not set
 
@@ -740,7 +789,7 @@
 # Userland interfaces
 #
 CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
@@ -753,11 +802,8 @@
 #
 # CONFIG_GAMEPORT is not set
 CONFIG_SOUND_GAMEPORT=y
-CONFIG_SERIO=y
+# CONFIG_SERIO is not set
 # CONFIG_SERIO_I8042 is not set
-# CONFIG_SERIO_SERPORT is not set
-# CONFIG_SERIO_CT82C710 is not set
-# CONFIG_SERIO_PCIPS2 is not set
 
 #
 # Input Device Drivers
@@ -796,12 +842,12 @@
 # Non-8250 serial port support
 #
 CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_SERIAL_PMACZILOG=y
-# CONFIG_SERIAL_PMACZILOG_CONSOLE is not set
+CONFIG_SERIAL_PMACZILOG_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-# CONFIG_QIC02_TAPE is not set
 
 #
 # IPMI
@@ -822,9 +868,14 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_FTAPE is not set
-# CONFIG_AGP is not set
-# CONFIG_DRM is not set
+CONFIG_AGP=m
+CONFIG_AGP_UNINORTH=m
+CONFIG_DRM=m
+# CONFIG_DRM_TDFX is not set
+CONFIG_DRM_R128=m
+CONFIG_DRM_RADEON=m
+# CONFIG_DRM_MGA is not set
+# CONFIG_DRM_SIS is not set
 
 #
 # PCMCIA character devices
@@ -843,6 +894,7 @@
 #
 CONFIG_I2C_ALGOBIT=y
 # CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
 
 #
 # I2C Hardware Bus support
@@ -857,6 +909,7 @@
 # CONFIG_I2C_I810 is not set
 # CONFIG_I2C_ISA is not set
 CONFIG_I2C_KEYWEST=m
+# CONFIG_I2C_MPC is not set
 # CONFIG_I2C_NFORCE2 is not set
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PIIX4 is not set
@@ -866,26 +919,38 @@
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_STUB is not set
 # CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
 # CONFIG_I2C_VOODOO3 is not set
+# CONFIG_I2C_PCA_ISA is not set
 
 #
 # Hardware Sensors Chip support
 #
 # CONFIG_I2C_SENSOR is not set
 # CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ASB100 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_FSCHER is not set
 # CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
 # CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
 # CONFIG_SENSORS_LM80 is not set
 # CONFIG_SENSORS_LM83 is not set
 # CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
 # CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_W83781D is not set
 # CONFIG_SENSORS_W83L785TS is not set
@@ -897,12 +962,18 @@
 # CONFIG_SENSORS_EEPROM is not set
 # CONFIG_SENSORS_PCF8574 is not set
 # CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_RTC8564 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
 # CONFIG_I2C_DEBUG_BUS is not set
 # CONFIG_I2C_DEBUG_CHIP is not set
 
 #
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
 # Misc devices
 #
 
@@ -920,6 +991,9 @@
 # Graphics support
 #
 CONFIG_FB=y
+CONFIG_FB_MODE_HELPERS=y
+CONFIG_FB_TILEBLITTING=y
+# CONFIG_FB_CIRRUS is not set
 # CONFIG_FB_PM2 is not set
 # CONFIG_FB_CYBER2000 is not set
 CONFIG_FB_OF=y
@@ -927,16 +1001,14 @@
 CONFIG_FB_PLATINUM=y
 CONFIG_FB_VALKYRIE=y
 CONFIG_FB_CT65550=y
+# CONFIG_FB_ASILIANT is not set
 CONFIG_FB_IMSTT=y
-# CONFIG_FB_S3TRIO is not set
 # CONFIG_FB_VGA16 is not set
 # CONFIG_FB_RIVA is not set
 CONFIG_FB_MATROX=y
 CONFIG_FB_MATROX_MILLENIUM=y
 CONFIG_FB_MATROX_MYSTIQUE=y
-# CONFIG_FB_MATROX_G450 is not set
-CONFIG_FB_MATROX_G100A=y
-CONFIG_FB_MATROX_G100=y
+CONFIG_FB_MATROX_G=y
 # CONFIG_FB_MATROX_I2C is not set
 # CONFIG_FB_MATROX_MULTIHEAD is not set
 # CONFIG_FB_RADEON_OLD is not set
@@ -946,12 +1018,15 @@
 CONFIG_FB_ATY128=y
 CONFIG_FB_ATY=y
 CONFIG_FB_ATY_CT=y
-CONFIG_FB_ATY_GX=y
+CONFIG_FB_ATY_GENERIC_LCD=y
 # CONFIG_FB_ATY_XL_INIT is not set
+CONFIG_FB_ATY_GX=y
+# CONFIG_FB_SAVAGE is not set
 # CONFIG_FB_SIS is not set
 # CONFIG_FB_NEOMAGIC is not set
 # CONFIG_FB_KYRO is not set
 CONFIG_FB_3DFX=y
+CONFIG_FB_3DFX_ACCEL=y
 # CONFIG_FB_VOODOO1 is not set
 # CONFIG_FB_TRIDENT is not set
 # CONFIG_FB_VIRTUAL is not set
@@ -960,10 +1035,8 @@
 # Console display driver support
 #
 # CONFIG_VGA_CONSOLE is not set
-# CONFIG_MDA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
 # CONFIG_FONTS is not set
 CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
@@ -975,6 +1048,11 @@
 CONFIG_LOGO_LINUX_MONO=y
 CONFIG_LOGO_LINUX_VGA16=y
 CONFIG_LOGO_LINUX_CLUT224=y
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_DEVICE=y
+CONFIG_LCD_CLASS_DEVICE=y
+CONFIG_LCD_DEVICE=y
 
 #
 # Sound
@@ -989,6 +1067,7 @@
 CONFIG_SND=m
 CONFIG_SND_TIMER=m
 CONFIG_SND_PCM=m
+CONFIG_SND_HWDEP=m
 CONFIG_SND_RAWMIDI=m
 CONFIG_SND_SEQUENCER=m
 CONFIG_SND_SEQ_DUMMY=m
@@ -1013,6 +1092,7 @@
 #
 # CONFIG_SND_ALI5451 is not set
 # CONFIG_SND_ATIIXP is not set
+# CONFIG_SND_ATIIXP_MODEM is not set
 # CONFIG_SND_AU8810 is not set
 # CONFIG_SND_AU8820 is not set
 # CONFIG_SND_AU8830 is not set
@@ -1021,6 +1101,8 @@
 # CONFIG_SND_CS46XX is not set
 # CONFIG_SND_CS4281 is not set
 # CONFIG_SND_EMU10K1 is not set
+# CONFIG_SND_EMU10K1X is not set
+# CONFIG_SND_CA0106 is not set
 # CONFIG_SND_KORG1212 is not set
 # CONFIG_SND_MIXART is not set
 # CONFIG_SND_NM256 is not set
@@ -1044,6 +1126,7 @@
 # CONFIG_SND_INTEL8X0M is not set
 # CONFIG_SND_SONICVIBES is not set
 # CONFIG_SND_VIA82XX is not set
+# CONFIG_SND_VIA82XX_MODEM is not set
 # CONFIG_SND_VX222 is not set
 
 #
@@ -1052,9 +1135,10 @@
 CONFIG_SND_POWERMAC=m
 
 #
-# ALSA USB devices
+# USB devices
 #
 CONFIG_SND_USB_AUDIO=m
+CONFIG_SND_USB_USX2Y=m
 
 #
 # PCMCIA devices
@@ -1077,6 +1161,10 @@
 CONFIG_USB_DEVICEFS=y
 # CONFIG_USB_BANDWIDTH is not set
 CONFIG_USB_DYNAMIC_MINORS=y
+CONFIG_USB_SUSPEND=y
+# CONFIG_USB_OTG is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
 
 #
 # USB Host Controller Drivers
@@ -1084,6 +1172,7 @@
 # CONFIG_USB_EHCI_HCD is not set
 CONFIG_USB_OHCI_HCD=y
 # CONFIG_USB_UHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
 
 #
 # USB Device Class drivers
@@ -1093,20 +1182,25 @@
 # CONFIG_USB_MIDI is not set
 CONFIG_USB_ACM=m
 CONFIG_USB_PRINTER=m
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 # CONFIG_USB_STORAGE is not set
 
 #
-# USB Human Interface Devices (HID)
+# USB Input Devices
 #
 CONFIG_USB_HID=y
 CONFIG_USB_HIDINPUT=y
 # CONFIG_HID_FF is not set
-# CONFIG_USB_HIDDEV is not set
+CONFIG_USB_HIDDEV=y
 # CONFIG_USB_AIPTEK is not set
 # CONFIG_USB_WACOM is not set
 # CONFIG_USB_KBTAB is not set
 # CONFIG_USB_POWERMATE is not set
 # CONFIG_USB_MTOUCH is not set
+# CONFIG_USB_EGALAX is not set
 # CONFIG_USB_XPAD is not set
 # CONFIG_USB_ATI_REMOTE is not set
 
@@ -1115,7 +1209,6 @@
 #
 # CONFIG_USB_MDC800 is not set
 # CONFIG_USB_MICROTEK is not set
-# CONFIG_USB_HPUSBSCSI is not set
 
 #
 # USB Multimedia devices
@@ -1127,11 +1220,11 @@
 #
 
 #
-# USB Network adaptors
+# USB Network Adapters
 #
 # CONFIG_USB_CATC is not set
 # CONFIG_USB_KAWETH is not set
-# CONFIG_USB_PEGASUS is not set
+CONFIG_USB_PEGASUS=m
 # CONFIG_USB_RTL8150 is not set
 # CONFIG_USB_USBNET is not set
 
@@ -1147,6 +1240,7 @@
 # CONFIG_USB_SERIAL_BELKIN is not set
 # CONFIG_USB_SERIAL_WHITEHEAT is not set
 # CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
+# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
 # CONFIG_USB_SERIAL_EMPEG is not set
 # CONFIG_USB_SERIAL_FTDI_SIO is not set
 CONFIG_USB_SERIAL_VISOR=m
@@ -1154,41 +1248,75 @@
 # CONFIG_USB_SERIAL_IR is not set
 # CONFIG_USB_SERIAL_EDGEPORT is not set
 # CONFIG_USB_SERIAL_EDGEPORT_TI is not set
+# CONFIG_USB_SERIAL_GARMIN is not set
+# CONFIG_USB_SERIAL_IPW is not set
 # CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
-# CONFIG_USB_SERIAL_KEYSPAN is not set
+CONFIG_USB_SERIAL_KEYSPAN=m
+CONFIG_USB_SERIAL_KEYSPAN_MPR=y
+CONFIG_USB_SERIAL_KEYSPAN_USA28=y
+CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
+CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
+CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
+CONFIG_USB_SERIAL_KEYSPAN_USA19=y
+CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
+CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
+CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
+CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
+CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
+CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
 # CONFIG_USB_SERIAL_KLSI is not set
 # CONFIG_USB_SERIAL_KOBIL_SCT is not set
 # CONFIG_USB_SERIAL_MCT_U232 is not set
 # CONFIG_USB_SERIAL_PL2303 is not set
 # CONFIG_USB_SERIAL_SAFE is not set
+# CONFIG_USB_SERIAL_TI is not set
 # CONFIG_USB_SERIAL_CYBERJACK is not set
 # CONFIG_USB_SERIAL_XIRCOM is not set
 # CONFIG_USB_SERIAL_OMNINET is not set
+CONFIG_USB_EZUSB=y
 
 #
 # USB Miscellaneous drivers
 #
 # CONFIG_USB_EMI62 is not set
 # CONFIG_USB_EMI26 is not set
-# CONFIG_USB_TIGL is not set
 # CONFIG_USB_AUERSWALD is not set
 # CONFIG_USB_RIO500 is not set
 # CONFIG_USB_LEGOTOWER is not set
 # CONFIG_USB_LCD is not set
 # CONFIG_USB_LED is not set
 # CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGETKIT is not set
+# CONFIG_USB_PHIDGETSERVO is not set
+# CONFIG_USB_IDMOUSE is not set
 # CONFIG_USB_TEST is not set
 
 #
+# USB ATM/DSL drivers
+#
+
+#
 # USB Gadget Support
 #
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
+CONFIG_EXT2_FS_XATTR=y
+# CONFIG_EXT2_FS_POSIX_ACL is not set
+# CONFIG_EXT2_FS_SECURITY is not set
 CONFIG_EXT3_FS=y
 CONFIG_EXT3_FS_XATTR=y
 # CONFIG_EXT3_FS_POSIX_ACL is not set
@@ -1198,10 +1326,15 @@
 CONFIG_FS_MBCACHE=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -1211,7 +1344,8 @@
 CONFIG_ISO9660_FS=y
 # CONFIG_JOLIET is not set
 # CONFIG_ZISOFS is not set
-# CONFIG_UDF_FS is not set
+CONFIG_UDF_FS=m
+CONFIG_UDF_NLS=y
 
 #
 # DOS/FAT/NT Filesystems
@@ -1219,6 +1353,8 @@
 CONFIG_FAT_FS=m
 CONFIG_MSDOS_FS=m
 CONFIG_VFAT_FS=m
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 # CONFIG_NTFS_FS is not set
 
 #
@@ -1227,11 +1363,12 @@
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
 CONFIG_SYSFS=y
-CONFIG_DEVFS_FS=y
-# CONFIG_DEVFS_MOUNT is not set
-# CONFIG_DEVFS_DEBUG is not set
-# CONFIG_DEVPTS_FS_XATTR is not set
+# CONFIG_DEVFS_FS is not set
+CONFIG_DEVPTS_FS_XATTR=y
+CONFIG_DEVPTS_FS_SECURITY=y
 CONFIG_TMPFS=y
+CONFIG_TMPFS_XATTR=y
+CONFIG_TMPFS_SECURITY=y
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
 
@@ -1245,7 +1382,7 @@
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_CRAMFS is not set
+CONFIG_CRAMFS=m
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
@@ -1256,16 +1393,19 @@
 # Network File Systems
 #
 CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
+CONFIG_NFS_V3=y
 # CONFIG_NFS_V4 is not set
 # CONFIG_NFS_DIRECTIO is not set
 CONFIG_NFSD=y
-# CONFIG_NFSD_V3 is not set
-# CONFIG_NFSD_TCP is not set
+CONFIG_NFSD_V3=y
+# CONFIG_NFSD_V4 is not set
+CONFIG_NFSD_TCP=y
 CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_SUNRPC=y
 # CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
 CONFIG_SMB_FS=m
 # CONFIG_SMB_NLS_DEFAULT is not set
 # CONFIG_CIFS is not set
@@ -1288,7 +1428,6 @@
 # CONFIG_SOLARIS_X86_PARTITION is not set
 # CONFIG_UNIXWARE_DISKLABEL is not set
 # CONFIG_LDM_PARTITION is not set
-# CONFIG_NEC98_PARTITION is not set
 # CONFIG_SGI_PARTITION is not set
 # CONFIG_ULTRIX_PARTITION is not set
 # CONFIG_SUN_PARTITION is not set
@@ -1320,8 +1459,9 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-# CONFIG_NLS_CODEPAGE_1250 is not set
-# CONFIG_NLS_CODEPAGE_1251 is not set
+CONFIG_NLS_CODEPAGE_1250=m
+CONFIG_NLS_CODEPAGE_1251=m
+CONFIG_NLS_ASCII=m
 CONFIG_NLS_ISO8859_1=m
 # CONFIG_NLS_ISO8859_2 is not set
 # CONFIG_NLS_ISO8859_3 is not set
@@ -1332,31 +1472,52 @@
 # CONFIG_NLS_ISO8859_9 is not set
 # CONFIG_NLS_ISO8859_13 is not set
 # CONFIG_NLS_ISO8859_14 is not set
-# CONFIG_NLS_ISO8859_15 is not set
+CONFIG_NLS_ISO8859_15=m
 # CONFIG_NLS_KOI8_R is not set
 # CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
+CONFIG_NLS_UTF8=m
 
 #
 # Library routines
 #
+CONFIG_CRC_CCITT=y
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
 
 #
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
 # Kernel hacking
 #
-# CONFIG_DEBUG_KERNEL is not set
+CONFIG_DEBUG_KERNEL=y
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_XMON is not set
+# CONFIG_BDI_SWITCH is not set
 CONFIG_BOOTX_TEXT=y
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
 # Cryptographic options
 #
 # CONFIG_CRYPTO is not set
+
+#
+# Hardware crypto devices
+#
diff -Nru a/arch/ppc/configs/radstone_ppc7d_defconfig b/arch/ppc/configs/radstone_ppc7d_defconfig
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/configs/radstone_ppc7d_defconfig	2005-03-07 20:41:25 -08:00
@@ -0,0 +1,870 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-rc4
+# Thu Feb 24 21:26:04 2005
+#
+CONFIG_MMU=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_HAVE_DEC_LOCK=y
+CONFIG_PPC=y
+CONFIG_PPC32=y
+CONFIG_GENERIC_NVRAM=y
+
+#
+# Code maturity level options
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_CLEAN_COMPILE=y
+CONFIG_BROKEN_ON_SMP=y
+
+#
+# General setup
+#
+CONFIG_LOCALVERSION=""
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+CONFIG_KOBJECT_UEVENT=y
+# CONFIG_IKCONFIG is not set
+CONFIG_EMBEDDED=y
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_EXTRA_PASS=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
+
+#
+# Loadable module support
+#
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+CONFIG_OBSOLETE_MODPARM=y
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+
+#
+# Processor
+#
+CONFIG_6xx=y
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_POWER3 is not set
+# CONFIG_POWER4 is not set
+# CONFIG_8xx is not set
+# CONFIG_E500 is not set
+CONFIG_ALTIVEC=y
+# CONFIG_TAU is not set
+# CONFIG_CPU_FREQ is not set
+CONFIG_PPC_GEN550=y
+CONFIG_PPC_STD_MMU=y
+# CONFIG_NOT_COHERENT_CACHE is not set
+
+#
+# Platform options
+#
+# CONFIG_PPC_MULTIPLATFORM is not set
+# CONFIG_APUS is not set
+# CONFIG_KATANA is not set
+# CONFIG_WILLOW is not set
+# CONFIG_CPCI690 is not set
+# CONFIG_PCORE is not set
+# CONFIG_POWERPMC250 is not set
+# CONFIG_CHESTNUT is not set
+# CONFIG_SPRUCE is not set
+# CONFIG_EV64260 is not set
+# CONFIG_LOPEC is not set
+# CONFIG_MCPN765 is not set
+# CONFIG_MVME5100 is not set
+# CONFIG_PPLUS is not set
+# CONFIG_PRPMC750 is not set
+# CONFIG_PRPMC800 is not set
+# CONFIG_SANDPOINT is not set
+CONFIG_RADSTONE_PPC7D=y
+# CONFIG_ADIR is not set
+# CONFIG_K2 is not set
+# CONFIG_PAL4 is not set
+# CONFIG_GEMINI is not set
+# CONFIG_EST8260 is not set
+# CONFIG_SBC82xx is not set
+# CONFIG_SBS8260 is not set
+# CONFIG_RPX8260 is not set
+# CONFIG_TQM8260 is not set
+# CONFIG_ADS8272 is not set
+# CONFIG_PQ2FADS is not set
+# CONFIG_LITE5200 is not set
+CONFIG_MV64360=y
+CONFIG_MV64X60=y
+
+#
+# Set bridge options
+#
+CONFIG_MV64X60_BASE=0xfef00000
+CONFIG_MV64X60_NEW_BASE=0xfef00000
+# CONFIG_SMP is not set
+# CONFIG_PREEMPT is not set
+# CONFIG_HIGHMEM is not set
+CONFIG_BINFMT_ELF=y
+CONFIG_BINFMT_MISC=y
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="console=ttyS0,9600"
+
+#
+# Bus options
+#
+CONFIG_GENERIC_ISA_DMA=y
+CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_LEGACY_PROC=y
+CONFIG_PCI_NAMES=y
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# Advanced setup
+#
+CONFIG_ADVANCED_OPTIONS=y
+CONFIG_HIGHMEM_START=0xfe000000
+# CONFIG_LOWMEM_SIZE_BOOL is not set
+CONFIG_LOWMEM_SIZE=0x30000000
+# CONFIG_KERNEL_START_BOOL is not set
+CONFIG_KERNEL_START=0xc0000000
+# CONFIG_TASK_SIZE_BOOL is not set
+CONFIG_TASK_SIZE=0x80000000
+# CONFIG_BOOT_LOAD_BOOL is not set
+CONFIG_BOOT_LOAD=0x00800000
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
+
+#
+# Memory Technology Devices (MTD)
+#
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_PARTITIONS is not set
+# CONFIG_MTD_CONCAT is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLOCK=y
+CONFIG_FTL=y
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_GEOMETRY is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+# CONFIG_MTD_XIP is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PHYSMAP is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_PMC551 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLKMTD is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+# CONFIG_MTD_NAND is not set
+
+#
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Plug and Play support
+#
+
+#
+# Block devices
+#
+# CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_CPQ_DA is not set
+# CONFIG_BLK_CPQ_CISS_DA is not set
+# CONFIG_BLK_DEV_DAC960 is not set
+# CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=8192
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
+
+#
+# ATA/ATAPI/MFM/RLL support
+#
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+CONFIG_SCSI=y
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+CONFIG_BLK_DEV_SR=y
+CONFIG_BLK_DEV_SR_VENDOR=y
+CONFIG_CHR_DEV_SG=y
+
+#
+# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
+#
+CONFIG_SCSI_MULTI_LUN=y
+CONFIG_SCSI_CONSTANTS=y
+CONFIG_SCSI_LOGGING=y
+
+#
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+
+#
+# SCSI low-level drivers
+#
+# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_ACARD is not set
+# CONFIG_SCSI_AACRAID is not set
+# CONFIG_SCSI_AIC7XXX is not set
+# CONFIG_SCSI_AIC7XXX_OLD is not set
+# CONFIG_SCSI_AIC79XX is not set
+# CONFIG_SCSI_DPT_I2O is not set
+# CONFIG_MEGARAID_NEWGEN is not set
+# CONFIG_MEGARAID_LEGACY is not set
+# CONFIG_SCSI_SATA is not set
+# CONFIG_SCSI_BUSLOGIC is not set
+# CONFIG_SCSI_DMX3191D is not set
+# CONFIG_SCSI_EATA is not set
+# CONFIG_SCSI_EATA_PIO is not set
+# CONFIG_SCSI_FUTURE_DOMAIN is not set
+# CONFIG_SCSI_GDTH is not set
+# CONFIG_SCSI_IPS is not set
+# CONFIG_SCSI_INITIO is not set
+# CONFIG_SCSI_INIA100 is not set
+CONFIG_SCSI_SYM53C8XX_2=y
+CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
+CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
+CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
+# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
+# CONFIG_SCSI_IPR is not set
+# CONFIG_SCSI_QLOGIC_ISP is not set
+# CONFIG_SCSI_QLOGIC_FC is not set
+# CONFIG_SCSI_QLOGIC_1280 is not set
+CONFIG_SCSI_QLA2XXX=y
+# CONFIG_SCSI_QLA21XX is not set
+# CONFIG_SCSI_QLA22XX is not set
+# CONFIG_SCSI_QLA2300 is not set
+# CONFIG_SCSI_QLA2322 is not set
+# CONFIG_SCSI_QLA6312 is not set
+# CONFIG_SCSI_DC395x is not set
+# CONFIG_SCSI_DC390T is not set
+# CONFIG_SCSI_NSP32 is not set
+# CONFIG_SCSI_DEBUG is not set
+
+#
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# Fusion MPT device support
+#
+# CONFIG_FUSION is not set
+
+#
+# IEEE 1394 (FireWire) support
+#
+# CONFIG_IEEE1394 is not set
+
+#
+# I2O device support
+#
+# CONFIG_I2O is not set
+
+#
+# Macintosh device drivers
+#
+
+#
+# Networking support
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+# CONFIG_NETLINK_DEV is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETFILTER is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATM is not set
+CONFIG_BRIDGE=y
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_NET_DIVERT is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+
+#
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
+# Ethernet (10 or 100Mbit)
+#
+CONFIG_NET_ETHERNET=y
+CONFIG_MII=y
+# CONFIG_HAPPYMEAL is not set
+# CONFIG_SUNGEM is not set
+# CONFIG_NET_VENDOR_3COM is not set
+
+#
+# Tulip family network device support
+#
+CONFIG_NET_TULIP=y
+# CONFIG_DE2104X is not set
+CONFIG_TULIP=y
+# CONFIG_TULIP_MWI is not set
+# CONFIG_TULIP_MMIO is not set
+# CONFIG_TULIP_NAPI is not set
+# CONFIG_DE4X5 is not set
+# CONFIG_WINBOND_840 is not set
+# CONFIG_DM9102 is not set
+# CONFIG_HP100 is not set
+CONFIG_NET_PCI=y
+# CONFIG_PCNET32 is not set
+# CONFIG_AMD8111_ETH is not set
+# CONFIG_ADAPTEC_STARFIRE is not set
+# CONFIG_B44 is not set
+# CONFIG_FORCEDETH is not set
+# CONFIG_DGRS is not set
+# CONFIG_EEPRO100 is not set
+CONFIG_E100=y
+# CONFIG_E100_NAPI is not set
+# CONFIG_FEALNX is not set
+# CONFIG_NATSEMI is not set
+# CONFIG_NE2K_PCI is not set
+# CONFIG_8139CP is not set
+# CONFIG_8139TOO is not set
+# CONFIG_SIS900 is not set
+# CONFIG_EPIC100 is not set
+# CONFIG_SUNDANCE is not set
+# CONFIG_TLAN is not set
+# CONFIG_VIA_RHINE is not set
+
+#
+# Ethernet (1000 Mbit)
+#
+# CONFIG_ACENIC is not set
+# CONFIG_DL2K is not set
+# CONFIG_E1000 is not set
+# CONFIG_NS83820 is not set
+# CONFIG_HAMACHI is not set
+# CONFIG_YELLOWFIN is not set
+CONFIG_R8169=y
+CONFIG_R8169_NAPI=y
+CONFIG_SK98LIN=y
+# CONFIG_VIA_VELOCITY is not set
+CONFIG_TIGON3=y
+
+#
+# Ethernet (10000 Mbit)
+#
+# CONFIG_IXGB is not set
+# CONFIG_S2IO is not set
+
+#
+# Token Ring devices
+#
+# CONFIG_TR is not set
+
+#
+# Wireless LAN (non-hamradio)
+#
+# CONFIG_NET_RADIO is not set
+
+#
+# Wan interfaces
+#
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+
+#
+# ISDN subsystem
+#
+# CONFIG_ISDN is not set
+
+#
+# Telephony Support
+#
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+CONFIG_SERIO=y
+CONFIG_SERIO_I8042=y
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_PCIPS2 is not set
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+CONFIG_KEYBOARD_XTKBD=y
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+# CONFIG_VT_CONSOLE is not set
+CONFIG_HW_CONSOLE=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=4
+# CONFIG_SERIAL_8250_EXTENDED is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_MPSC=y
+# CONFIG_SERIAL_MPSC_CONSOLE is not set
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+CONFIG_WATCHDOG=y
+CONFIG_WATCHDOG_NOWAYOUT=y
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+CONFIG_MV64X60_WDT=y
+
+#
+# PCI-based Watchdog Cards
+#
+# CONFIG_PCIPCWATCHDOG is not set
+# CONFIG_WDTPCI is not set
+# CONFIG_NVRAM is not set
+CONFIG_GEN_RTC=y
+# CONFIG_GEN_RTC_X is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
+
+#
+# Ftape, the floppy tape device driver
+#
+# CONFIG_AGP is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
+
+#
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
+# Misc devices
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+# CONFIG_USB is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_JBD is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=y
+# CONFIG_JOLIET is not set
+# CONFIG_ZISOFS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS_FS is not set
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+# CONFIG_JFFS2_FS_NAND is not set
+# CONFIG_JFFS2_FS_NOR_ECC is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFS_DIRECTIO is not set
+# CONFIG_NFSD is not set
+CONFIG_ROOT_NFS=y
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+# CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+
+#
+# Native Language Support
+#
+# CONFIG_NLS is not set
+
+#
+# Library routines
+#
+CONFIG_CRC_CCITT=y
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_SERIAL_TEXT_DEBUG is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Hardware crypto devices
+#
diff -Nru a/arch/ppc/kernel/cputable.c b/arch/ppc/kernel/cputable.c
--- a/arch/ppc/kernel/cputable.c	2004-11-11 00:25:53 -08:00
+++ b/arch/ppc/kernel/cputable.c	2005-03-04 22:41:52 -08:00
@@ -560,6 +560,18 @@
 		.dcache_bsize		= 32,
 		.cpu_setup		= __setup_cpu_603
 	},
+	{	/* e300 (a 603e core, plus some) on 83xx */
+		.pvr_mask		= 0x7fff0000,
+		.pvr_value		= 0x00830000,
+		.cpu_name		= "e300",
+		.cpu_features		= CPU_FTR_SPLIT_ID_CACHE |
+			CPU_FTR_MAYBE_CAN_DOZE | CPU_FTR_USE_TB |
+			CPU_FTR_MAYBE_CAN_NAP | CPU_FTR_HAS_HIGH_BATS,
+		.cpu_user_features	= COMMON_PPC,
+		.icache_bsize		= 32,
+		.dcache_bsize		= 32,
+		.cpu_setup		= __setup_cpu_603
+	},
 	{	/* default match, we assume split I/D cache & TB (non-601)... */
 		.pvr_mask		= 0x00000000,
 		.pvr_value		= 0x00000000,
diff -Nru a/arch/ppc/kernel/dma-mapping.c b/arch/ppc/kernel/dma-mapping.c
--- a/arch/ppc/kernel/dma-mapping.c	2005-01-20 21:02:08 -08:00
+++ b/arch/ppc/kernel/dma-mapping.c	2005-02-23 19:26:53 -08:00
@@ -219,7 +219,8 @@
 	c = vm_region_alloc(&consistent_head, size,
 			    gfp & ~(__GFP_DMA | __GFP_HIGHMEM));
 	if (c) {
-		pte_t *pte = consistent_pte + CONSISTENT_OFFSET(c->vm_start);
+		unsigned long vaddr = c->vm_start;
+		pte_t *pte = consistent_pte + CONSISTENT_OFFSET(vaddr);
 		struct page *end = page + (1 << order);
 
 		/*
@@ -232,9 +233,11 @@
 
 			set_page_count(page, 1);
 			SetPageReserved(page);
-			set_pte(pte, mk_pte(page, pgprot_noncached(PAGE_KERNEL)));
+			set_pte_at(&init_mm, vaddr,
+				   pte, mk_pte(page, pgprot_noncached(PAGE_KERNEL)));
 			page++;
 			pte++;
+			vaddr += PAGE_SIZE;
 		} while (size -= PAGE_SIZE);
 
 		/*
@@ -262,7 +265,7 @@
 void __dma_free_coherent(size_t size, void *vaddr)
 {
 	struct vm_region *c;
-	unsigned long flags;
+	unsigned long flags, addr;
 	pte_t *ptep;
 
 	size = PAGE_ALIGN(size);
@@ -281,11 +284,13 @@
 	}
 
 	ptep = consistent_pte + CONSISTENT_OFFSET(c->vm_start);
+	addr = c->vm_start;
 	do {
-		pte_t pte = ptep_get_and_clear(ptep);
+		pte_t pte = ptep_get_and_clear(&init_mm, addr, ptep);
 		unsigned long pfn;
 
 		ptep++;
+		addr += PAGE_SIZE;
 
 		if (!pte_none(pte) && pte_present(pte)) {
 			pfn = pte_pfn(pte);
diff -Nru a/arch/ppc/kernel/head_booke.h b/arch/ppc/kernel/head_booke.h
--- a/arch/ppc/kernel/head_booke.h	2005-01-03 15:49:17 -08:00
+++ b/arch/ppc/kernel/head_booke.h	2005-03-04 22:41:52 -08:00
@@ -194,8 +194,8 @@
 	CRITICAL_EXCEPTION_PROLOG;				\
 	addi	r3,r1,STACK_FRAME_OVERHEAD;			\
 	EXC_XFER_TEMPLATE(hdlr, n+2, (MSR_KERNEL & ~(MSR_ME|MSR_DE|MSR_CE)), \
-			  NOCOPY, transfer_to_handler_full, \
-			  ret_from_except_full)
+			  NOCOPY, crit_transfer_to_handler, \
+			  ret_from_crit_exc)
 
 #define MCHECK_EXCEPTION(n, label, hdlr)			\
 	START_EXCEPTION(label);					\
diff -Nru a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
--- a/arch/ppc/kernel/misc.S	2005-01-03 15:49:20 -08:00
+++ b/arch/ppc/kernel/misc.S	2005-03-06 15:58:58 -08:00
@@ -1450,3 +1450,4 @@
 	.long sys_add_key
 	.long sys_request_key		/* 270 */
 	.long sys_keyctl
+	.long sys_waitid
diff -Nru a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
--- a/arch/ppc/kernel/pci.c	2005-01-25 13:50:14 -08:00
+++ b/arch/ppc/kernel/pci.c	2005-02-07 12:52:54 -08:00
@@ -1058,7 +1058,7 @@
 		return;
  	res = *(bus->resource[0]);
 
-	DBG("Remapping Bus %d, bridge: %s\n", bus->number, bridge->slot_name);
+	DBG("Remapping Bus %d, bridge: %s\n", bus->number, pci_name(bridge));
 	res.start -= ((unsigned long) hose->io_base_virt - isa_io_base);
 	res.end -= ((unsigned long) hose->io_base_virt - isa_io_base);
 	DBG("  IO window: %08lx-%08lx\n", res.start, res.end);
diff -Nru a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c
--- a/arch/ppc/kernel/ppc_htab.c	2004-10-20 01:37:14 -07:00
+++ b/arch/ppc/kernel/ppc_htab.c	2005-03-04 22:41:15 -08:00
@@ -108,7 +108,7 @@
 	PTE *ptr;
 #endif /* CONFIG_PPC_STD_MMU */
 
-	if (cur_cpu_spec[0]->cpu_features & CPU_FTR_604_PERF_MON) {
+	if (cpu_has_feature(CPU_FTR_604_PERF_MON)) {
 		mmcr0 = mfspr(SPRN_MMCR0);
 		pmc1 = mfspr(SPRN_PMC1);
 		pmc2 = mfspr(SPRN_PMC2);
@@ -209,7 +209,7 @@
 
 	if ( !strncmp( buffer, "reset", 5) )
 	{
-		if (cur_cpu_spec[0]->cpu_features & CPU_FTR_604_PERF_MON) {
+		if (cpu_has_feature(CPU_FTR_604_PERF_MON)) {
 			/* reset PMC1 and PMC2 */
 			mtspr(SPRN_PMC1, 0);
 			mtspr(SPRN_PMC2, 0);
@@ -221,7 +221,7 @@
 	}
 
 	/* Everything below here requires the performance monitor feature. */
-	if ( !cur_cpu_spec[0]->cpu_features & CPU_FTR_604_PERF_MON )
+	if (!cpu_has_feature(CPU_FTR_604_PERF_MON))
 		return count;
 
 	/* turn off performance monitoring */
@@ -339,7 +339,7 @@
 		"0.5", "1.0", "(reserved2)", "(reserved3)"
 	};
 
-	if (!(cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR))
+	if (!cpu_has_feature(CPU_FTR_L2CR))
 		return -EFAULT;
 
 	if ( /*!table->maxlen ||*/ (*ppos && !write)) {
diff -Nru a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
--- a/arch/ppc/kernel/ppc_ksyms.c	2005-02-02 02:13:47 -08:00
+++ b/arch/ppc/kernel/ppc_ksyms.c	2005-03-04 22:41:52 -08:00
@@ -319,7 +319,8 @@
 EXPORT_SYMBOL(cpm_install_handler);
 EXPORT_SYMBOL(cpm_free_handler);
 #endif /* CONFIG_8xx */
-#if defined(CONFIG_8xx) || defined(CONFIG_40x) || defined(CONFIG_85xx)
+#if defined(CONFIG_8xx) || defined(CONFIG_40x) || defined(CONFIG_85xx) ||\
+	defined(CONFIG_83xx)
 EXPORT_SYMBOL(__res);
 #endif
 
diff -Nru a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
--- a/arch/ppc/kernel/setup.c	2005-01-04 18:48:16 -08:00
+++ b/arch/ppc/kernel/setup.c	2005-03-04 22:41:52 -08:00
@@ -227,6 +227,10 @@
 		maj = ((pvr >> 8) & 0xFF) - 1;
 		min = pvr & 0xFF;
 		break;
+	case 0x8083:	/* e300 */
+		maj = PVR_MAJ(pvr);
+		min = PVR_MIN(pvr);
+		break;
 	case 0x8020:	/* e500 */
 		maj = PVR_MAJ(pvr);
 		min = PVR_MIN(pvr);
@@ -619,7 +623,7 @@
 /* Checks "l2cr=xxxx" command-line option */
 int __init ppc_setup_l2cr(char *str)
 {
-	if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR) {
+	if (cpu_has_feature(CPU_FTR_L2CR)) {
 		unsigned long val = simple_strtoul(str, NULL, 0);
 		printk(KERN_INFO "l2cr set to %lx\n", val);
 		_set_L2CR(0);		/* force invalidate by disable cache */
@@ -720,7 +724,7 @@
 	 * Systems with OF can look in the properties on the cpu node(s)
 	 * for a possibly more accurate value.
 	 */
-	if (cur_cpu_spec[0]->cpu_features & CPU_FTR_SPLIT_ID_CACHE) {
+	if (cpu_has_feature(CPU_FTR_SPLIT_ID_CACHE)) {
 		dcache_bsize = cur_cpu_spec[0]->dcache_bsize;
 		icache_bsize = cur_cpu_spec[0]->icache_bsize;
 		ucache_bsize = 0;
diff -Nru a/arch/ppc/kernel/temp.c b/arch/ppc/kernel/temp.c
--- a/arch/ppc/kernel/temp.c	2003-09-15 13:59:05 -07:00
+++ b/arch/ppc/kernel/temp.c	2005-03-04 22:41:15 -08:00
@@ -223,7 +223,7 @@
 	/* We assume in SMP that if one CPU has TAU support, they
 	 * all have it --BenH
 	 */
-	if (!(cur_cpu_spec[0]->cpu_features & CPU_FTR_TAU)) {
+	if (!cpu_has_feature(CPU_FTR_TAU)) {
 		printk("Thermal assist unit not available\n");
 		tau_initialized = 0;
 		return 1;
diff -Nru a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
--- a/arch/ppc/mm/init.c	2005-01-11 16:42:37 -08:00
+++ b/arch/ppc/mm/init.c	2005-02-23 19:26:53 -08:00
@@ -490,18 +490,6 @@
 		printk(KERN_INFO "AGP special page: 0x%08lx\n", agp_special_page);
 #endif
 
-	/* Make sure all our pagetable pages have page->mapping
-	   and page->index set correctly. */
-	for (addr = KERNELBASE; addr != 0; addr += PGDIR_SIZE) {
-		struct page *pg;
-		pmd_t *pmd = pmd_offset(pgd_offset_k(addr), addr);
-		if (pmd_present(*pmd)) {
-			pg = pmd_page(*pmd);
-			pg->mapping = (void *) &init_mm;
-			pg->index = addr;
-		}
-	}
-
 	mem_init_done = 1;
 }
 
diff -Nru a/arch/ppc/mm/mmu_decl.h b/arch/ppc/mm/mmu_decl.h
--- a/arch/ppc/mm/mmu_decl.h	2004-06-17 23:41:08 -07:00
+++ b/arch/ppc/mm/mmu_decl.h	2005-03-04 22:41:15 -08:00
@@ -75,7 +75,7 @@
 			      unsigned long pdval)
 {
 	if ((Hash != 0) &&
-	    (cur_cpu_spec[0]->cpu_features & CPU_FTR_HPTE_TABLE))
+	    cpu_has_feature(CPU_FTR_HPTE_TABLE))
 		flush_hash_pages(0, va, pdval, 1);
 	else
 		_tlbie(va);
diff -Nru a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c
--- a/arch/ppc/mm/pgtable.c	2005-02-22 19:31:41 -08:00
+++ b/arch/ppc/mm/pgtable.c	2005-02-23 19:26:53 -08:00
@@ -102,11 +102,6 @@
 
 	if (mem_init_done) {
 		pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO);
-		if (pte) {
-			struct page *ptepage = virt_to_page(pte);
-			ptepage->mapping = (void *) mm;
-			ptepage->index = address & PMD_MASK;
-		}
 	} else {
 		pte = (pte_t *)early_get_page();
 		if (pte)
@@ -126,11 +121,8 @@
 #endif
 
 	ptepage = alloc_pages(flags, 0);
-	if (ptepage) {
-		ptepage->mapping = (void *) mm;
-		ptepage->index = address & PMD_MASK;
+	if (ptepage)
 		clear_highpage(ptepage);
-	}
 	return ptepage;
 }
 
@@ -139,7 +131,6 @@
 #ifdef CONFIG_SMP
 	hash_page_sync();
 #endif
-	virt_to_page(pte)->mapping = NULL;
 	free_page((unsigned long)pte);
 }
 
@@ -148,7 +139,6 @@
 #ifdef CONFIG_SMP
 	hash_page_sync();
 #endif
-	ptepage->mapping = NULL;
 	__free_page(ptepage);
 }
 
@@ -298,7 +288,7 @@
 	pg = pte_alloc_kernel(&init_mm, pd, va);
 	if (pg != 0) {
 		err = 0;
-		set_pte(pg, pfn_pte(pa >> PAGE_SHIFT, __pgprot(flags)));
+		set_pte_at(&init_mm, va, pg, pfn_pte(pa >> PAGE_SHIFT, __pgprot(flags)));
 		if (mem_init_done)
 			flush_HPTE(0, va, pmd_val(*pd));
 	}
diff -Nru a/arch/ppc/mm/ppc_mmu.c b/arch/ppc/mm/ppc_mmu.c
--- a/arch/ppc/mm/ppc_mmu.c	2004-03-16 10:27:30 -08:00
+++ b/arch/ppc/mm/ppc_mmu.c	2005-03-04 22:41:15 -08:00
@@ -138,7 +138,7 @@
 	union ubat *bat = BATS[index];
 
 	if (((flags & _PAGE_NO_CACHE) == 0) &&
-	    (cur_cpu_spec[0]->cpu_features & CPU_FTR_NEED_COHERENT))
+	    cpu_has_feature(CPU_FTR_NEED_COHERENT))
 		flags |= _PAGE_COHERENT;
 
 	bl = (size >> 17) - 1;
@@ -191,7 +191,7 @@
 	extern unsigned int hash_page[];
 	extern unsigned int flush_hash_patch_A[], flush_hash_patch_B[];
 
-	if ((cur_cpu_spec[0]->cpu_features & CPU_FTR_HPTE_TABLE) == 0) {
+	if (!cpu_has_feature(CPU_FTR_HPTE_TABLE)) {
 		/*
 		 * Put a blr (procedure return) instruction at the
 		 * start of hash_page, since we can still get DSI
diff -Nru a/arch/ppc/mm/tlb.c b/arch/ppc/mm/tlb.c
--- a/arch/ppc/mm/tlb.c	2005-02-22 23:53:49 -08:00
+++ b/arch/ppc/mm/tlb.c	2005-02-23 19:26:53 -08:00
@@ -47,26 +47,6 @@
 }
 
 /*
- * Called by ptep_test_and_clear_young()
- */
-void flush_hash_one_pte(pte_t *ptep)
-{
-	struct page *ptepage;
-	struct mm_struct *mm;
-	unsigned long ptephys;
-	unsigned long addr;
-
-	if (Hash == 0)
-		return;
-	
-	ptepage = virt_to_page(ptep);
-	mm = (struct mm_struct *) ptepage->mapping;
-	ptephys = __pa(ptep) & PAGE_MASK;
-	addr = ptepage->index + (((unsigned long)ptep & ~PAGE_MASK) << 10);
-	flush_hash_pages(mm->context, addr, ptephys, 1);
-}
-
-/*
  * Called by ptep_set_access_flags, must flush on CPUs for which the
  * DSI handler can't just "fixup" the TLB on a write fault
  */
diff -Nru a/arch/ppc/oprofile/op_model_fsl_booke.c b/arch/ppc/oprofile/op_model_fsl_booke.c
--- a/arch/ppc/oprofile/op_model_fsl_booke.c	2005-01-03 20:37:48 -08:00
+++ b/arch/ppc/oprofile/op_model_fsl_booke.c	2005-03-07 20:41:19 -08:00
@@ -150,7 +150,6 @@
 	int is_kernel;
 	int val;
 	int i;
-	unsigned int cpu = smp_processor_id();
 
 	/* set the PMM bit (see comment below) */
 	mtmsr(mfmsr() | MSR_PMM);
@@ -162,7 +161,7 @@
 		val = ctr_read(i);
 		if (val < 0) {
 			if (oprofile_running && ctr[i].enabled) {
-				oprofile_add_sample(pc, is_kernel, i, cpu);
+				oprofile_add_pc(pc, is_kernel, i);
 				ctr_write(i, reset_value[i]);
 			} else {
 				ctr_write(i, 0);
diff -Nru a/arch/ppc/platforms/4xx/ebony.c b/arch/ppc/platforms/4xx/ebony.c
--- a/arch/ppc/platforms/4xx/ebony.c	2005-02-03 06:42:41 -08:00
+++ b/arch/ppc/platforms/4xx/ebony.c	2005-03-04 22:41:48 -08:00
@@ -49,8 +49,19 @@
 #include <asm/todc.h>
 #include <asm/bootinfo.h>
 #include <asm/ppc4xx_pic.h>
+#include <asm/ppcboot.h>
 
 #include <syslib/gen550.h>
+#include <syslib/ibm440gp_common.h>
+
+/*
+ * This is a horrible kludge, we eventually need to abstract this
+ * generic PHY stuff, so the  standard phy mode defines can be
+ * easily used from arch code.
+ */
+#include "../../../../drivers/net/ibm_emac/ibm_emac_phy.h"
+
+bd_t __res;
 
 static struct ibm44x_clocks clocks __initdata;
 
@@ -258,19 +269,21 @@
 static void __init
 ebony_setup_arch(void)
 {
-	unsigned char * vpd_base;
 	struct ocp_def *def;
 	struct ocp_func_emac_data *emacdata;
 
 	/* Set mac_addr for each EMAC */
-	vpd_base = ioremap64(EBONY_VPD_BASE, EBONY_VPD_SIZE);
 	def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 0);
 	emacdata = def->additions;
-	memcpy(emacdata->mac_addr, EBONY_NA0_ADDR(vpd_base), 6);
+	emacdata->phy_map = 0x00000001;	/* Skip 0x00 */
+	emacdata->phy_mode = PHY_MODE_RMII;
+	memcpy(emacdata->mac_addr, __res.bi_enetaddr, 6);
+
 	def = ocp_get_one_device(OCP_VENDOR_IBM, OCP_FUNC_EMAC, 1);
 	emacdata = def->additions;
-	memcpy(emacdata->mac_addr, EBONY_NA1_ADDR(vpd_base), 6);
-	iounmap(vpd_base);
+	emacdata->phy_map = 0x00000001;	/* Skip 0x00 */
+	emacdata->phy_mode = PHY_MODE_RMII;
+	memcpy(emacdata->mac_addr, __res.bi_enet1addr, 6);
 
 	/*
 	 * Determine various clocks.
@@ -314,7 +327,14 @@
 void __init platform_init(unsigned long r3, unsigned long r4,
 		unsigned long r5, unsigned long r6, unsigned long r7)
 {
-	parse_bootinfo((struct bi_record *) (r3 + KERNELBASE));
+	parse_bootinfo(find_bootinfo());
+
+	/*
+	 * If we were passed in a board information, copy it into the
+	 * residual data area.
+	 */
+	if (r3)
+		__res = *(bd_t *)(r3 + KERNELBASE);
 
 	ibm44x_platform_init();
 
diff -Nru a/arch/ppc/platforms/4xx/ebony.h b/arch/ppc/platforms/4xx/ebony.h
--- a/arch/ppc/platforms/4xx/ebony.h	2004-10-02 23:26:32 -07:00
+++ b/arch/ppc/platforms/4xx/ebony.h	2005-03-07 20:41:21 -08:00
@@ -23,13 +23,9 @@
 /* F/W TLB mapping used in bootloader glue to reset EMAC */
 #define PPC44x_EMAC0_MR0	0xE0000800
 
-/* Macros to get at Ebony VPD info */
-#define EBONY_VPD_BASE		0x00000001fffffe00ULL
-#define EBONY_VPD_SIZE		0x24
-#define EBONY_NA0_OFFSET	0x0c
-#define EBONY_NA1_OFFSET	0x18
-#define EBONY_NA0_ADDR(base)	(base + EBONY_NA0_OFFSET)
-#define EBONY_NA1_ADDR(base)	(base + EBONY_NA1_OFFSET)
+/* Where to find the MAC info */
+#define EBONY_OPENBIOS_MAC_BASE   0xfffffe0c
+#define EBONY_OPENBIOS_MAC_OFFSET 0x0c
 
 /* Default clock rates for Rev. B and Rev. C silicon */
 #define EBONY_440GP_RB_SYSCLK	33000000
@@ -61,8 +57,8 @@
  */
 
 /* OpenBIOS defined UART mappings, used before early_serial_setup */
-#define UART0_IO_BASE	(u8 *) 0xE0000200
-#define UART1_IO_BASE	(u8 *) 0xE0000300
+#define UART0_IO_BASE	0xE0000200
+#define UART1_IO_BASE	0xE0000300
 
 /* external Epson SG-615P */
 #define BASE_BAUD	691200
diff -Nru a/arch/ppc/platforms/4xx/luan.h b/arch/ppc/platforms/4xx/luan.h
--- a/arch/ppc/platforms/4xx/luan.h	2005-02-03 06:42:41 -08:00
+++ b/arch/ppc/platforms/4xx/luan.h	2005-03-07 20:41:21 -08:00
@@ -47,9 +47,9 @@
 #define RS_TABLE_SIZE	3
 
 /* PIBS defined UART mappings, used before early_serial_setup */
-#define UART0_IO_BASE	(u8 *) 0xa0000200
-#define UART1_IO_BASE	(u8 *) 0xa0000300
-#define UART2_IO_BASE	(u8 *) 0xa0000600
+#define UART0_IO_BASE	0xa0000200
+#define UART1_IO_BASE	0xa0000300
+#define UART2_IO_BASE	0xa0000600
 
 #define BASE_BAUD	11059200
 #define STD_UART_OP(num)					\
diff -Nru a/arch/ppc/platforms/4xx/ocotea.h b/arch/ppc/platforms/4xx/ocotea.h
--- a/arch/ppc/platforms/4xx/ocotea.h	2005-02-03 06:42:41 -08:00
+++ b/arch/ppc/platforms/4xx/ocotea.h	2005-03-07 20:41:21 -08:00
@@ -56,8 +56,8 @@
 #define RS_TABLE_SIZE	2
 
 /* OpenBIOS defined UART mappings, used before early_serial_setup */
-#define UART0_IO_BASE	(u8 *) 0xE0000200
-#define UART1_IO_BASE	(u8 *) 0xE0000300
+#define UART0_IO_BASE	0xE0000200
+#define UART1_IO_BASE	0xE0000300
 
 #define BASE_BAUD	11059200/16
 #define STD_UART_OP(num)					\
diff -Nru a/arch/ppc/platforms/4xx/xilinx_ml300.c b/arch/ppc/platforms/4xx/xilinx_ml300.c
--- a/arch/ppc/platforms/4xx/xilinx_ml300.c	2004-10-18 22:26:40 -07:00
+++ b/arch/ppc/platforms/4xx/xilinx_ml300.c	2005-03-04 22:41:16 -08:00
@@ -122,25 +122,7 @@
 void __init
 ml300_init_irq(void)
 {
-	unsigned int i;
-
 	ppc4xx_init_IRQ();
-
-	/*
-	 * For PowerPC 405 cores the default value for NR_IRQS is 32.
-	 * See include/asm-ppc/irq.h for details.
-	 * This is just fine for ML300.
-	 */
-#if (NR_IRQS != 32)
-#error NR_IRQS must be 32 for ML300
-#endif
-
-	for (i = 0; i < NR_IRQS; i++) {
-		if (XPAR_INTC_0_KIND_OF_INTR & (0x80000000 >> i))
-			irq_desc[i].status &= ~IRQ_LEVEL;
-		else
-			irq_desc[i].status |= IRQ_LEVEL;
-	}
 }
 
 void __init
diff -Nru a/arch/ppc/platforms/83xx/Kconfig b/arch/ppc/platforms/83xx/Kconfig
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/platforms/83xx/Kconfig	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,30 @@
+config 83xx
+	bool "PowerQUICC II Pro (83xx) Support"
+	depends on 6xx
+
+menu "Freescale 83xx options"
+	depends on 83xx
+
+choice
+	prompt "Machine Type"
+	depends on 83xx
+	default MPC834x_SYS
+
+config MPC834x_SYS
+	bool "Freescale MPC834x SYS"
+	help
+	  This option enables support for the MPC 834x SYS evaluation board.
+
+endchoice
+
+config MPC834x
+	bool
+	depends on MPC834x_SYS
+	default y
+
+config PPC_GEN550
+	bool
+	depends on 83xx
+	default y
+
+endmenu
diff -Nru a/arch/ppc/platforms/83xx/Makefile b/arch/ppc/platforms/83xx/Makefile
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/platforms/83xx/Makefile	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,6 @@
+#
+# Makefile for the PowerPC 83xx linux kernel.
+#
+obj-$(CONFIG_83xx)		+= mpc83xx_sys.o mpc83xx_devices.o
+
+obj-$(CONFIG_MPC834x_SYS)	+= mpc834x_sys.o
diff -Nru a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.c	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,290 @@
+/*
+ * arch/ppc/platforms/83xx/mpc834x_sys.c
+ *
+ * MPC834x SYS board specific routines
+ *
+ * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ *
+ * Copyright 2005 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/config.h>
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/reboot.h>
+#include <linux/pci.h>
+#include <linux/kdev_t.h>
+#include <linux/major.h>
+#include <linux/console.h>
+#include <linux/delay.h>
+#include <linux/irq.h>
+#include <linux/seq_file.h>
+#include <linux/root_dev.h>
+#include <linux/serial.h>
+#include <linux/tty.h>	/* for linux/serial_core.h */
+#include <linux/serial_core.h>
+#include <linux/initrd.h>
+#include <linux/module.h>
+#include <linux/fsl_devices.h>
+
+#include <asm/system.h>
+#include <asm/pgtable.h>
+#include <asm/page.h>
+#include <asm/atomic.h>
+#include <asm/time.h>
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/prom.h>
+#include <asm/ipic.h>
+#include <asm/bootinfo.h>
+#include <asm/pci-bridge.h>
+#include <asm/mpc83xx.h>
+#include <asm/irq.h>
+#include <asm/kgdb.h>
+#include <asm/ppc_sys.h>
+#include <mm/mmu_decl.h>
+
+#include <syslib/ppc83xx_setup.h>
+
+#ifndef CONFIG_PCI
+unsigned long isa_io_base = 0;
+unsigned long isa_mem_base = 0;
+#endif
+
+extern unsigned long total_memory;	/* in mm/init */
+
+unsigned char __res[sizeof (bd_t)];
+
+#ifdef CONFIG_PCI
+#error "PCI is not supported"
+/* NEED mpc83xx_map_irq & mpc83xx_exclude_device
+   see platforms/85xx/mpc85xx_ads_common.c */
+#endif /* CONFIG_PCI */
+
+/* ************************************************************************
+ *
+ * Setup the architecture
+ *
+ */
+static void __init
+mpc834x_sys_setup_arch(void)
+{
+	bd_t *binfo = (bd_t *) __res;
+	unsigned int freq;
+	struct gianfar_platform_data *pdata;
+
+	/* get the core frequency */
+	freq = binfo->bi_intfreq;
+
+	/* Set loops_per_jiffy to a half-way reasonable value,
+	   for use until calibrate_delay gets called. */
+	loops_per_jiffy = freq / HZ;
+
+#ifdef CONFIG_PCI
+	/* setup PCI host bridges */
+	mpc83xx_sys_setup_hose();
+#endif
+	mpc83xx_early_serial_map();
+
+	/* setup the board related information for the enet controllers */
+	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC1);
+	pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
+	pdata->interruptPHY = MPC83xx_IRQ_EXT1;
+	pdata->phyid = 0;
+	/* fixup phy address */
+	pdata->phy_reg_addr += binfo->bi_immr_base;
+	memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
+
+	pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC2);
+	pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
+	pdata->interruptPHY = MPC83xx_IRQ_EXT2;
+	pdata->phyid = 1;
+	/* fixup phy address */
+	pdata->phy_reg_addr += binfo->bi_immr_base;
+	memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
+
+#ifdef CONFIG_BLK_DEV_INITRD
+	if (initrd_start)
+		ROOT_DEV = Root_RAM0;
+	else
+#endif
+#ifdef  CONFIG_ROOT_NFS
+		ROOT_DEV = Root_NFS;
+#else
+		ROOT_DEV = Root_HDA1;
+#endif
+}
+
+static void __init
+mpc834x_sys_map_io(void)
+{
+	/* we steal the lowest ioremap addr for virt space */
+	io_block_mapping(VIRT_IMMRBAR, immrbar, 1024*1024, _PAGE_IO);
+	io_block_mapping(BCSR_VIRT_ADDR, BCSR_PHYS_ADDR, BCSR_SIZE, _PAGE_IO);
+}
+
+int
+mpc834x_sys_show_cpuinfo(struct seq_file *m)
+{
+	uint pvid, svid, phid1;
+	bd_t *binfo = (bd_t *) __res;
+	unsigned int freq;
+
+	/* get the core frequency */
+	freq = binfo->bi_intfreq;
+
+	pvid = mfspr(PVR);
+	svid = mfspr(SVR);
+
+	seq_printf(m, "chip\t\t: MPC%s\n", cur_ppc_sys_spec->ppc_sys_name);
+	seq_printf(m, "Vendor\t\t: Freescale Inc.\n");
+	seq_printf(m, "Machine\t\t: mpc%s sys\n", cur_ppc_sys_spec->ppc_sys_name);
+	seq_printf(m, "core clock\t: %d MHz\n"
+			"bus  clock\t: %d MHz\n",
+			(int)(binfo->bi_intfreq / 1000000),
+			(int)(binfo->bi_busfreq / 1000000));
+	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
+	seq_printf(m, "SVR\t\t: 0x%x\n", svid);
+
+	/* Display cpu Pll setting */
+	phid1 = mfspr(HID1);
+	seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
+
+	/* Display the amount of memory */
+	seq_printf(m, "Memory\t\t: %d MB\n", (int)(binfo->bi_memsize / (1024 * 1024)));
+
+	return 0;
+}
+
+
+void __init
+mpc834x_sys_init_IRQ(void)
+{
+	bd_t *binfo = (bd_t *) __res;
+
+	u8 senses[8] = {
+		0,			/* EXT 0 */
+		IRQ_SENSE_LEVEL,	/* EXT 1 */
+		IRQ_SENSE_LEVEL,	/* EXT 2 */
+		0,			/* EXT 3 */
+		0,			/* EXT 4 */
+		0,			/* EXT 5 */
+		0,			/* EXT 6 */
+		0,			/* EXT 7 */
+	};
+
+	ipic_init(binfo->bi_immr_base + 0x00700, 0, MPC83xx_IPIC_IRQ_OFFSET, senses, 8);
+
+	/* Initialize the default interrupt mapping priorities,
+	 * in case the boot rom changed something on us.
+	 */
+	ipic_set_default_priority();
+}
+
+static __inline__ void
+mpc834x_sys_set_bat(void)
+{
+	/* we steal the lowest ioremap addr for virt space */
+	mb();
+	mtspr(DBAT1U, VIRT_IMMRBAR | 0x1e);
+	mtspr(DBAT1L, immrbar | 0x2a);
+	mb();
+}
+
+void __init
+platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+	      unsigned long r6, unsigned long r7)
+{
+	bd_t *binfo = (bd_t *) __res;
+
+	/* parse_bootinfo must always be called first */
+	parse_bootinfo(find_bootinfo());
+
+	/*
+	 * If we were passed in a board information, copy it into the
+	 * residual data area.
+	 */
+	if (r3) {
+		memcpy((void *) __res, (void *) (r3 + KERNELBASE),
+		       sizeof (bd_t));
+	}
+
+#if defined(CONFIG_BLK_DEV_INITRD)
+	/*
+	 * If the init RAM disk has been configured in, and there's a valid
+	 * starting address for it, set it up.
+	 */
+	if (r4) {
+		initrd_start = r4 + KERNELBASE;
+		initrd_end = r5 + KERNELBASE;
+	}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
+	/* Copy the kernel command line arguments to a safe place. */
+	if (r6) {
+		*(char *) (r7 + KERNELBASE) = 0;
+		strcpy(cmd_line, (char *) (r6 + KERNELBASE));
+	}
+
+	immrbar = binfo->bi_immr_base;
+
+	mpc834x_sys_set_bat();
+
+#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG)
+	{
+		struct uart_port p;
+
+		memset(&p, 0, sizeof (p));
+		p.iotype = SERIAL_IO_MEM;
+		p.membase = (unsigned char __iomem *)immrbar + 0x4500;
+		p.uartclk = binfo->bi_busfreq;
+
+		gen550_init(0, &p);
+
+		memset(&p, 0, sizeof (p));
+		p.iotype = SERIAL_IO_MEM;
+		p.membase = (unsigned char __iomem *)immrbar + 0x4500;
+		p.uartclk = binfo->bi_busfreq;
+
+		gen550_init(1, &p);
+	}
+#endif
+
+	identify_ppc_sys_by_id(mfspr(SVR));
+
+	/* setup the PowerPC module struct */
+	ppc_md.setup_arch = mpc834x_sys_setup_arch;
+	ppc_md.show_cpuinfo = mpc834x_sys_show_cpuinfo;
+
+	ppc_md.init_IRQ = mpc834x_sys_init_IRQ;
+	ppc_md.get_irq = ipic_get_irq;
+
+	ppc_md.restart = mpc83xx_restart;
+	ppc_md.power_off = mpc83xx_power_off;
+	ppc_md.halt = mpc83xx_halt;
+
+	ppc_md.find_end_of_memory = mpc83xx_find_end_of_memory;
+	ppc_md.setup_io_mappings  = mpc834x_sys_map_io;
+
+	ppc_md.time_init = mpc83xx_time_init;
+	ppc_md.set_rtc_time = NULL;
+	ppc_md.get_rtc_time = NULL;
+	ppc_md.calibrate_decr = mpc83xx_calibrate_decr;
+
+	ppc_md.early_serial_map = mpc83xx_early_serial_map;
+#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG)
+	ppc_md.progress = gen550_progress;
+#endif	/* CONFIG_SERIAL_8250 && CONFIG_SERIAL_TEXT_DEBUG */
+
+	if (ppc_md.progress)
+		ppc_md.progress("mpc834x_sys_init(): exit", 0);
+
+	return;
+}
diff -Nru a/arch/ppc/platforms/83xx/mpc834x_sys.h b/arch/ppc/platforms/83xx/mpc834x_sys.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.h	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,51 @@
+/*
+ * arch/ppc/platforms/83xx/mpc834x_sys.h
+ *
+ * MPC834X SYS common board definitions
+ *
+ * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ *
+ * Copyright 2005 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef __MACH_MPC83XX_SYS_H__
+#define __MACH_MPC83XX_SYS_H__
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/seq_file.h>
+#include <syslib/ppc83xx_setup.h>
+#include <asm/ppcboot.h>
+
+#define VIRT_IMMRBAR		((uint)0xfe000000)
+
+#define BCSR_PHYS_ADDR		((uint)0xf8000000)
+#define BCSR_VIRT_ADDR		((uint)0xfe100000)
+#define BCSR_SIZE		((uint)(32 * 1024))
+
+#ifdef CONFIG_PCI
+/* PCI interrupt controller */
+#define PIRQA        MPC83xx_IRQ_IRQ4
+#define PIRQB        MPC83xx_IRQ_IRQ5
+#define PIRQC        MPC83xx_IRQ_IRQ6
+#define PIRQD        MPC83xx_IRQ_IRQ7
+
+#define MPC834x_SYS_PCI1_LOWER_IO        0x00000000
+#define MPC834x_SYS_PCI1_UPPER_IO        0x00ffffff
+
+#define MPC834x_SYS_PCI1_LOWER_MEM       0x80000000
+#define MPC834x_SYS_PCI1_UPPER_MEM       0x9fffffff
+
+#define MPC834x_SYS_PCI1_IO_BASE         0xe2000000
+#define MPC834x_SYS_PCI1_MEM_OFFSET      0x00000000
+
+#define MPC834x_SYS_PCI1_IO_SIZE         0x01000000
+#endif /* CONFIG_PCI */
+
+#endif                /* __MACH_MPC83XX_SYS_H__ */
diff -Nru a/arch/ppc/platforms/83xx/mpc83xx_devices.c b/arch/ppc/platforms/83xx/mpc83xx_devices.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/platforms/83xx/mpc83xx_devices.c	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,237 @@
+/*
+ * arch/ppc/platforms/83xx/mpc83xx_devices.c
+ *
+ * MPC83xx Device descriptions
+ *
+ * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ *
+ * Copyright 2005 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/serial_8250.h>
+#include <linux/fsl_devices.h>
+#include <asm/mpc83xx.h>
+#include <asm/irq.h>
+#include <asm/ppc_sys.h>
+
+/* We use offsets for IORESOURCE_MEM since we do not know at compile time
+ * what IMMRBAR is, will get fixed up by mach_mpc83xx_fixup
+ */
+
+static struct gianfar_platform_data mpc83xx_tsec1_pdata = {
+	.device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
+	    FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
+	    FSL_GIANFAR_DEV_HAS_MULTI_INTR,
+	.phy_reg_addr = 0x24000,
+};
+
+static struct gianfar_platform_data mpc83xx_tsec2_pdata = {
+	.device_flags = FSL_GIANFAR_DEV_HAS_GIGABIT |
+	    FSL_GIANFAR_DEV_HAS_COALESCE | FSL_GIANFAR_DEV_HAS_RMON |
+	    FSL_GIANFAR_DEV_HAS_MULTI_INTR,
+	.phy_reg_addr = 0x24000,
+};
+
+static struct fsl_i2c_platform_data mpc83xx_fsl_i2c1_pdata = {
+	.device_flags = FSL_I2C_DEV_SEPARATE_DFSRR,
+};
+
+static struct fsl_i2c_platform_data mpc83xx_fsl_i2c2_pdata = {
+	.device_flags = FSL_I2C_DEV_SEPARATE_DFSRR,
+};
+
+static struct plat_serial8250_port serial_platform_data[] = {
+	[0] = {
+		.mapbase	= 0x4500,
+		.irq		= MPC83xx_IRQ_UART1,
+		.iotype		= UPIO_MEM,
+		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+	},
+	[1] = {
+		.mapbase	= 0x4600,
+		.irq		= MPC83xx_IRQ_UART2,
+		.iotype		= UPIO_MEM,
+		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
+	},
+};
+
+struct platform_device ppc_sys_platform_devices[] = {
+	[MPC83xx_TSEC1] = {
+		.name = "fsl-gianfar",
+		.id	= 1,
+		.dev.platform_data = &mpc83xx_tsec1_pdata,
+		.num_resources	 = 4,
+		.resource = (struct resource[]) {
+			{
+				.start	= 0x24000,
+				.end	= 0x24fff,
+				.flags	= IORESOURCE_MEM,
+			},
+			{
+				.name	= "tx",
+				.start	= MPC83xx_IRQ_TSEC1_TX,
+				.end	= MPC83xx_IRQ_TSEC1_TX,
+				.flags	= IORESOURCE_IRQ,
+			},
+			{
+				.name	= "rx",
+				.start	= MPC83xx_IRQ_TSEC1_RX,
+				.end	= MPC83xx_IRQ_TSEC1_RX,
+				.flags	= IORESOURCE_IRQ,
+			},
+			{
+				.name	= "error",
+				.start	= MPC83xx_IRQ_TSEC1_ERROR,
+				.end	= MPC83xx_IRQ_TSEC1_ERROR,
+				.flags	= IORESOURCE_IRQ,
+			},
+		},
+	},
+	[MPC83xx_TSEC2] = {
+		.name = "fsl-gianfar",
+		.id	= 2,
+		.dev.platform_data = &mpc83xx_tsec2_pdata,
+		.num_resources	 = 4,
+		.resource = (struct resource[]) {
+			{
+				.start	= 0x25000,
+				.end	= 0x25fff,
+				.flags	= IORESOURCE_MEM,
+			},
+			{
+				.name	= "tx",
+				.start	= MPC83xx_IRQ_TSEC2_TX,
+				.end	= MPC83xx_IRQ_TSEC2_TX,
+				.flags	= IORESOURCE_IRQ,
+			},
+			{
+				.name	= "rx",
+				.start	= MPC83xx_IRQ_TSEC2_RX,
+				.end	= MPC83xx_IRQ_TSEC2_RX,
+				.flags	= IORESOURCE_IRQ,
+			},
+			{
+				.name	= "error",
+				.start	= MPC83xx_IRQ_TSEC2_ERROR,
+				.end	= MPC83xx_IRQ_TSEC2_ERROR,
+				.flags	= IORESOURCE_IRQ,
+			},
+		},
+	},
+	[MPC83xx_IIC1] = {
+		.name = "fsl-i2c",
+		.id	= 1,
+		.dev.platform_data = &mpc83xx_fsl_i2c1_pdata,
+		.num_resources	 = 2,
+		.resource = (struct resource[]) {
+			{
+				.start	= 0x3000,
+				.end	= 0x30ff,
+				.flags	= IORESOURCE_MEM,
+			},
+			{
+				.start	= MPC83xx_IRQ_IIC1,
+				.end	= MPC83xx_IRQ_IIC1,
+				.flags	= IORESOURCE_IRQ,
+			},
+		},
+	},
+	[MPC83xx_IIC2] = {
+		.name = "fsl-i2c",
+		.id	= 2,
+		.dev.platform_data = &mpc83xx_fsl_i2c2_pdata,
+		.num_resources	 = 2,
+		.resource = (struct resource[]) {
+			{
+				.start	= 0x3100,
+				.end	= 0x31ff,
+				.flags	= IORESOURCE_MEM,
+			},
+			{
+				.start	= MPC83xx_IRQ_IIC2,
+				.end	= MPC83xx_IRQ_IIC2,
+				.flags	= IORESOURCE_IRQ,
+			},
+		},
+	},
+	[MPC83xx_DUART] = {
+		.name = "serial8250",
+		.id	= 0,
+		.dev.platform_data = serial_platform_data,
+	},
+	[MPC83xx_SEC2] = {
+		.name = "fsl-sec2",
+		.id	= 1,
+		.num_resources	 = 2,
+		.resource = (struct resource[]) {
+			{
+				.start	= 0x30000,
+				.end	= 0x3ffff,
+				.flags	= IORESOURCE_MEM,
+			},
+			{
+				.start	= MPC83xx_IRQ_SEC2,
+				.end	= MPC83xx_IRQ_SEC2,
+				.flags	= IORESOURCE_IRQ,
+			},
+		},
+	},
+	[MPC83xx_USB2_DR] = {
+		.name = "fsl-usb2-dr",
+		.id	= 1,
+		.num_resources	 = 2,
+		.resource = (struct resource[]) {
+			{
+				.start	= 0x22000,
+				.end	= 0x22fff,
+				.flags	= IORESOURCE_MEM,
+			},
+			{
+				.start	= MPC83xx_IRQ_USB2_DR,
+				.end	= MPC83xx_IRQ_USB2_DR,
+				.flags	= IORESOURCE_IRQ,
+			},
+		},
+	},
+	[MPC83xx_USB2_MPH] = {
+		.name = "fsl-usb2-mph",
+		.id	= 1,
+		.num_resources	 = 2,
+		.resource = (struct resource[]) {
+			{
+				.start	= 0x23000,
+				.end	= 0x23fff,
+				.flags	= IORESOURCE_MEM,
+			},
+			{
+				.start	= MPC83xx_IRQ_USB2_MPH,
+				.end	= MPC83xx_IRQ_USB2_MPH,
+				.flags	= IORESOURCE_IRQ,
+			},
+		},
+	},
+};
+
+static int __init mach_mpc83xx_fixup(struct platform_device *pdev)
+{
+	ppc_sys_fixup_mem_resource(pdev, immrbar);
+	return 0;
+}
+
+static int __init mach_mpc83xx_init(void)
+{
+	if (ppc_md.progress)
+		ppc_md.progress("mach_mpc83xx_init:enter", 0);
+	ppc_sys_device_fixup = mach_mpc83xx_fixup;
+	return 0;
+}
+
+postcore_initcall(mach_mpc83xx_init);
diff -Nru a/arch/ppc/platforms/83xx/mpc83xx_sys.c b/arch/ppc/platforms/83xx/mpc83xx_sys.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/platforms/83xx/mpc83xx_sys.c	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,100 @@
+/*
+ * arch/ppc/platforms/83xx/mpc83xx_sys.c
+ *
+ * MPC83xx System descriptions
+ *
+ * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ *
+ * Copyright 2005 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <asm/ppc_sys.h>
+
+struct ppc_sys_spec *cur_ppc_sys_spec;
+struct ppc_sys_spec ppc_sys_specs[] = {
+	{
+		.ppc_sys_name	= "8349E",
+		.mask 		= 0xFFFF0000,
+		.value 		= 0x80500000,
+		.num_devices	= 8,
+		.device_list	= (enum ppc_sys_devices[])
+		{
+			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
+			MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
+			MPC83xx_USB2_DR, MPC83xx_USB2_MPH
+		},
+	},
+	{
+		.ppc_sys_name	= "8349",
+		.mask 		= 0xFFFF0000,
+		.value 		= 0x80510000,
+		.num_devices	= 7,
+		.device_list	= (enum ppc_sys_devices[])
+		{
+			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
+			MPC83xx_IIC2, MPC83xx_DUART,
+			MPC83xx_USB2_DR, MPC83xx_USB2_MPH
+		},
+	},
+	{
+		.ppc_sys_name	= "8347E",
+		.mask 		= 0xFFFF0000,
+		.value 		= 0x80520000,
+		.num_devices	= 8,
+		.device_list	= (enum ppc_sys_devices[])
+		{
+			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
+			MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
+			MPC83xx_USB2_DR, MPC83xx_USB2_MPH
+		},
+	},
+	{
+		.ppc_sys_name	= "8347",
+		.mask 		= 0xFFFF0000,
+		.value 		= 0x80530000,
+		.num_devices	= 7,
+		.device_list	= (enum ppc_sys_devices[])
+		{
+			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
+			MPC83xx_IIC2, MPC83xx_DUART,
+			MPC83xx_USB2_DR, MPC83xx_USB2_MPH
+		},
+	},
+	{
+		.ppc_sys_name	= "8343E",
+		.mask 		= 0xFFFF0000,
+		.value 		= 0x80540000,
+		.num_devices	= 7,
+		.device_list	= (enum ppc_sys_devices[])
+		{
+			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
+			MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
+			MPC83xx_USB2_DR,
+		},
+	},
+	{
+		.ppc_sys_name	= "8343",
+		.mask 		= 0xFFFF0000,
+		.value 		= 0x80550000,
+		.num_devices	= 6,
+		.device_list	= (enum ppc_sys_devices[])
+		{
+			MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
+			MPC83xx_IIC2, MPC83xx_DUART,
+			MPC83xx_USB2_DR,
+		},
+	},
+	{	/* default match */
+		.ppc_sys_name	= "",
+		.mask 		= 0x00000000,
+		.value 		= 0x00000000,
+	},
+};
diff -Nru a/arch/ppc/platforms/85xx/mpc85xx_ads_common.c b/arch/ppc/platforms/85xx/mpc85xx_ads_common.c
--- a/arch/ppc/platforms/85xx/mpc85xx_ads_common.c	2005-01-20 20:56:31 -08:00
+++ b/arch/ppc/platforms/85xx/mpc85xx_ads_common.c	2005-03-04 22:41:17 -08:00
@@ -43,6 +43,7 @@
 #include <asm/mpc85xx.h>
 #include <asm/irq.h>
 #include <asm/immap_85xx.h>
+#include <asm/ppc_sys.h>
 
 #include <mm/mmu_decl.h>
 
@@ -128,19 +129,9 @@
 	pvid = mfspr(PVR);
 	svid = mfspr(SVR);
 
+	seq_printf(m, "chip\t\t: MPC%s\n", cur_ppc_sys_spec->ppc_sys_name);
 	seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
-
-	switch (svid & 0xffff0000) {
-	case SVR_8540:
-		seq_printf(m, "Machine\t\t: mpc8540ads\n");
-		break;
-	case SVR_8560:
-		seq_printf(m, "Machine\t\t: mpc8560ads\n");
-		break;
-	default:
-		seq_printf(m, "Machine\t\t: unknown\n");
-		break;
-	}
+	seq_printf(m, "Machine\t\t: mpc%sads\n", cur_ppc_sys_spec->ppc_sys_name);
 	seq_printf(m, "clock\t\t: %dMHz\n", freq / 1000000);
 	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
 	seq_printf(m, "SVR\t\t: 0x%x\n", svid);
diff -Nru a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c	2005-02-10 16:33:44 -08:00
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c	2005-03-04 22:41:52 -08:00
@@ -39,6 +39,7 @@
 #include <asm/page.h>
 #include <asm/atomic.h>
 #include <asm/time.h>
+#include <asm/todc.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
 #include <asm/prom.h>
@@ -73,60 +74,60 @@
 /* Internal interrupts are all Level Sensitive, and Positive Polarity */
 
 static u_char mpc85xx_cds_openpic_initsenses[] __initdata = {
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal  0: L2 Cache */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal  1: ECM */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal  2: DDR DRAM */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal  3: LBIU */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal  4: DMA 0 */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal  5: DMA 1 */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal  6: DMA 2 */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal  7: DMA 3 */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal  8: PCI/PCI-X */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal  9: RIO Inbound Port Write Error */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 10: RIO Doorbell Inbound */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 11: RIO Outbound Message */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 12: RIO Inbound Message */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 13: TSEC 0 Transmit */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 14: TSEC 0 Receive */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 15: Unused */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 16: Unused */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 17: Unused */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 18: TSEC 0 Receive/Transmit Error */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 19: TSEC 1 Transmit */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 20: TSEC 1 Receive */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 21: Unused */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 22: Unused */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 23: Unused */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 24: TSEC 1 Receive/Transmit Error */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 25: Fast Ethernet */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 26: DUART */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 27: I2C */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 28: Performance Monitor */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 29: Unused */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 30: CPM */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),        /* Internal 31: Unused */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal  0: L2 Cache */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal  1: ECM */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal  2: DDR DRAM */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal  3: LBIU */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal  4: DMA 0 */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal  5: DMA 1 */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal  6: DMA 2 */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal  7: DMA 3 */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal  8: PCI/PCI-X */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal  9: RIO Inbound Port Write Error */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 10: RIO Doorbell Inbound */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 11: RIO Outbound Message */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 12: RIO Inbound Message */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 13: TSEC 0 Transmit */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 14: TSEC 0 Receive */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 15: Unused */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 16: Unused */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 17: Unused */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 18: TSEC 0 Receive/Transmit Error */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 19: TSEC 1 Transmit */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 20: TSEC 1 Receive */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 21: Unused */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 22: Unused */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 23: Unused */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 24: TSEC 1 Receive/Transmit Error */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 25: Fast Ethernet */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 26: DUART */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 27: I2C */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 28: Performance Monitor */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 29: Unused */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 30: CPM */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE),	/* Internal 31: Unused */
 #if defined(CONFIG_PCI)
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),      /* External 0: PCI1 slot */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),      /* External 1: PCI1 slot */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),      /* External 2: PCI1 slot */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),      /* External 3: PCI1 slot */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* External 0: PCI1 slot */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* External 1: PCI1 slot */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* External 2: PCI1 slot */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* External 3: PCI1 slot */
 #else
-        0x0,                            /* External  0: */
-        0x0,                            /* External  1: */
-        0x0,                            /* External  2: */
-        0x0,                            /* External  3: */
-#endif
-        0x0,                            /* External  4: */
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),      /* External 5: PHY */
-        0x0,                            /* External  6: */
-        0x0,                            /* External  7: */
-        0x0,                            /* External  8: */
-        0x0,                            /* External  9: */
-        0x0,                            /* External 10: */
+	0x0,						/* External  0: */
+	0x0,						/* External  1: */
+	0x0,						/* External  2: */
+	0x0,						/* External  3: */
+#endif
+	0x0,						/* External  4: */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* External  5: PHY */
+	0x0,						/* External  6: */
+	0x0,						/* External  7: */
+	0x0,						/* External  8: */
+	0x0,						/* External  9: */
+	0x0,						/* External 10: */
 #if defined(CONFIG_85xx_PCI2) && defined(CONFIG_PCI)
-        (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),      /* External 11: PCI2 slot 0 */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* External 11: PCI2 slot 0 */
 #else
-        0x0,                            /* External 11: */
+	0x0,						/* External 11: */
 #endif
 };
 
@@ -134,31 +135,32 @@
 int
 mpc85xx_cds_show_cpuinfo(struct seq_file *m)
 {
-        uint pvid, svid, phid1;
-        uint memsize = total_memory;
-        bd_t *binfo = (bd_t *) __res;
-        unsigned int freq;
+	uint pvid, svid, phid1;
+	uint memsize = total_memory;
+	bd_t *binfo = (bd_t *) __res;
+	unsigned int freq;
 
-        /* get the core frequency */
-        freq = binfo->bi_intfreq;
+	/* get the core frequency */
+	freq = binfo->bi_intfreq;
 
-        pvid = mfspr(PVR);
-        svid = mfspr(SVR);
+	pvid = mfspr(PVR);
+	svid = mfspr(SVR);
 
-        seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
-	seq_printf(m, "Machine\t\t: CDS (%x)\n", cadmus[CM_VER]);
+	seq_printf(m, "chip\t\t: MPC%s\n", cur_ppc_sys_spec->ppc_sys_name);
+	seq_printf(m, "Vendor\t\t: Freescale Semiconductor\n");
+	seq_printf(m, "Machine\t\t: CDS - MPC%s (%x)\n", cur_ppc_sys_spec->ppc_sys_name, cadmus[CM_VER]);
 	seq_printf(m, "clock\t\t: %dMHz\n", freq / 1000000);
-        seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
-        seq_printf(m, "SVR\t\t: 0x%x\n", svid);
+	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
+	seq_printf(m, "SVR\t\t: 0x%x\n", svid);
 
-        /* Display cpu Pll setting */
-        phid1 = mfspr(HID1);
-        seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
+	/* Display cpu Pll setting */
+	phid1 = mfspr(HID1);
+	seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
 
-        /* Display the amount of memory */
-        seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
+	/* Display the amount of memory */
+	seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
 
-        return 0;
+	return 0;
 }
 
 #ifdef CONFIG_CPM2
@@ -185,21 +187,21 @@
 	int i;
 #endif
 
-        /* Determine the Physical Address of the OpenPIC regs */
-        phys_addr_t OpenPIC_PAddr = binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET;
-        OpenPIC_Addr = ioremap(OpenPIC_PAddr, MPC85xx_OPENPIC_SIZE);
-        OpenPIC_InitSenses = mpc85xx_cds_openpic_initsenses;
-        OpenPIC_NumInitSenses = sizeof (mpc85xx_cds_openpic_initsenses);
-
-        /* Skip reserved space and internal sources */
-        openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
-        /* Map PIC IRQs 0-11 */
-        openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000);
-
-        /* we let openpic interrupts starting from an offset, to
-         * leave space for cascading interrupts underneath.
-         */
-        openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET);
+	/* Determine the Physical Address of the OpenPIC regs */
+	phys_addr_t OpenPIC_PAddr = binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET;
+	OpenPIC_Addr = ioremap(OpenPIC_PAddr, MPC85xx_OPENPIC_SIZE);
+	OpenPIC_InitSenses = mpc85xx_cds_openpic_initsenses;
+	OpenPIC_NumInitSenses = sizeof (mpc85xx_cds_openpic_initsenses);
+
+	/* Skip reserved space and internal sources */
+	openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
+	/* Map PIC IRQs 0-11 */
+	openpic_set_sources(32, 12, OpenPIC_Addr + 0x10000);
+
+	/* we let openpic interrupts starting from an offset, to
+	 * leave space for cascading interrupts underneath.
+	 */
+	openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET);
 
 #ifdef CONFIG_CPM2
 	/* disable all CPM interupts */
@@ -219,7 +221,7 @@
 	setup_irq(MPC85xx_IRQ_CPM, &cpm2_irqaction);
 #endif
 
-        return;
+	return;
 }
 
 #ifdef CONFIG_PCI
@@ -278,8 +280,8 @@
 	}
 }
 
-#define ARCADIA_HOST_BRIDGE_IDSEL     17
-#define ARCADIA_2ND_BRIDGE_IDSEL     3
+#define ARCADIA_HOST_BRIDGE_IDSEL	17
+#define ARCADIA_2ND_BRIDGE_IDSEL	3
 
 extern int mpc85xx_pci1_last_busno;
 
@@ -289,7 +291,7 @@
 	if (bus == 0 && PCI_SLOT(devfn) == 0)
 		return PCIBIOS_DEVICE_NOT_FOUND;
 #ifdef CONFIG_85xx_PCI2
-	if (mpc85xx_pci1_last_busno) 
+	if (mpc85xx_pci1_last_busno)
 		if (bus == (mpc85xx_pci1_last_busno + 1) && PCI_SLOT(devfn) == 0)
 			return PCIBIOS_DEVICE_NOT_FOUND;
 #endif
@@ -303,6 +305,8 @@
 }
 #endif /* CONFIG_PCI */
 
+TODC_ALLOC();
+
 /* ************************************************************************
  *
  * Setup the architecture
@@ -311,14 +315,14 @@
 static void __init
 mpc85xx_cds_setup_arch(void)
 {
-        bd_t *binfo = (bd_t *) __res;
-        unsigned int freq;
+	bd_t *binfo = (bd_t *) __res;
+	unsigned int freq;
 	struct gianfar_platform_data *pdata;
 
-        /* get the core frequency */
-        freq = binfo->bi_intfreq;
+	/* get the core frequency */
+	freq = binfo->bi_intfreq;
 
-        printk("mpc85xx_cds_setup_arch\n");
+	printk("mpc85xx_cds_setup_arch\n");
 
 #ifdef CONFIG_CPM2
 	cpm2_reset();
@@ -328,17 +332,24 @@
 	cds_pci_slot = ((cadmus[CM_CSR] >> 6) & 0x3) + 1;
 	printk("CDS Version = %x in PCI slot %d\n", cadmus[CM_VER], cds_pci_slot);
 
-        /* Set loops_per_jiffy to a half-way reasonable value,
-           for use until calibrate_delay gets called. */
-        loops_per_jiffy = freq / HZ;
+	/* Setup TODC access */
+	TODC_INIT(TODC_TYPE_DS1743,
+			0,
+			0,
+			ioremap(CDS_RTC_ADDR, CDS_RTC_SIZE),
+			8);
+
+	/* Set loops_per_jiffy to a half-way reasonable value,
+	   for use until calibrate_delay gets called. */
+	loops_per_jiffy = freq / HZ;
 
 #ifdef CONFIG_PCI
-        /* setup PCI host bridges */
-        mpc85xx_setup_hose();
+	/* setup PCI host bridges */
+	mpc85xx_setup_hose();
 #endif
 
 #ifdef CONFIG_SERIAL_8250
-        mpc85xx_early_serial_map();
+	mpc85xx_early_serial_map();
 #endif
 
 #ifdef CONFIG_SERIAL_TEXT_DEBUG
@@ -366,14 +377,14 @@
 
 
 #ifdef CONFIG_BLK_DEV_INITRD
-        if (initrd_start)
-                ROOT_DEV = Root_RAM0;
-        else
+	if (initrd_start)
+		ROOT_DEV = Root_RAM0;
+	else
 #endif
 #ifdef  CONFIG_ROOT_NFS
-                ROOT_DEV = Root_NFS;
+		ROOT_DEV = Root_NFS;
 #else
-                ROOT_DEV = Root_HDA1;
+	ROOT_DEV = Root_HDA1;
 #endif
 }
 
@@ -382,18 +393,18 @@
 platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
               unsigned long r6, unsigned long r7)
 {
-        /* parse_bootinfo must always be called first */
-        parse_bootinfo(find_bootinfo());
+	/* parse_bootinfo must always be called first */
+	parse_bootinfo(find_bootinfo());
 
-        /*
-         * If we were passed in a board information, copy it into the
-         * residual data area.
-         */
-        if (r3) {
-                memcpy((void *) __res, (void *) (r3 + KERNELBASE),
-                       sizeof (bd_t));
+	/*
+	 * If we were passed in a board information, copy it into the
+	 * residual data area.
+	 */
+	if (r3) {
+		memcpy((void *) __res, (void *) (r3 + KERNELBASE),
+				sizeof (bd_t));
 
-        }
+	}
 #ifdef CONFIG_SERIAL_TEXT_DEBUG
 	{
 		bd_t *binfo = (bd_t *) __res;
@@ -401,7 +412,7 @@
 
 		/* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */
 		settlbcam(NUM_TLBCAMS - 1, binfo->bi_immr_base,
-			  binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
+				binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
 
 		memset(&p, 0, sizeof (p));
 		p.iotype = SERIAL_IO_MEM;
@@ -420,49 +431,53 @@
 #endif
 
 #if defined(CONFIG_BLK_DEV_INITRD)
-        /*
-         * If the init RAM disk has been configured in, and there's a valid
-         * starting address for it, set it up.
-         */
-        if (r4) {
-                initrd_start = r4 + KERNELBASE;
-                initrd_end = r5 + KERNELBASE;
-        }
-#endif                          /* CONFIG_BLK_DEV_INITRD */
-
-        /* Copy the kernel command line arguments to a safe place. */
-
-        if (r6) {
-                *(char *) (r7 + KERNELBASE) = 0;
-                strcpy(cmd_line, (char *) (r6 + KERNELBASE));
-        }
+	/*
+	 * If the init RAM disk has been configured in, and there's a valid
+	 * starting address for it, set it up.
+	 */
+	if (r4) {
+		initrd_start = r4 + KERNELBASE;
+		initrd_end = r5 + KERNELBASE;
+	}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
+	/* Copy the kernel command line arguments to a safe place. */
+
+	if (r6) {
+		*(char *) (r7 + KERNELBASE) = 0;
+		strcpy(cmd_line, (char *) (r6 + KERNELBASE));
+	}
 
 	identify_ppc_sys_by_id(mfspr(SVR));
 
-        /* setup the PowerPC module struct */
-        ppc_md.setup_arch = mpc85xx_cds_setup_arch;
-        ppc_md.show_cpuinfo = mpc85xx_cds_show_cpuinfo;
-
-        ppc_md.init_IRQ = mpc85xx_cds_init_IRQ;
-        ppc_md.get_irq = openpic_get_irq;
-
-        ppc_md.restart = mpc85xx_restart;
-        ppc_md.power_off = mpc85xx_power_off;
-        ppc_md.halt = mpc85xx_halt;
-
-        ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory;
-
-        ppc_md.time_init = NULL;
-        ppc_md.set_rtc_time = NULL;
-        ppc_md.get_rtc_time = NULL;
-        ppc_md.calibrate_decr = mpc85xx_calibrate_decr;
+	/* setup the PowerPC module struct */
+	ppc_md.setup_arch = mpc85xx_cds_setup_arch;
+	ppc_md.show_cpuinfo = mpc85xx_cds_show_cpuinfo;
+
+	ppc_md.init_IRQ = mpc85xx_cds_init_IRQ;
+	ppc_md.get_irq = openpic_get_irq;
+
+	ppc_md.restart = mpc85xx_restart;
+	ppc_md.power_off = mpc85xx_power_off;
+	ppc_md.halt = mpc85xx_halt;
+
+	ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory;
+
+	ppc_md.calibrate_decr = mpc85xx_calibrate_decr;
+
+	ppc_md.time_init = todc_time_init;
+	ppc_md.set_rtc_time = todc_set_rtc_time;
+	ppc_md.get_rtc_time = todc_get_rtc_time;
+
+	ppc_md.nvram_read_val = todc_direct_read_val;
+	ppc_md.nvram_write_val = todc_direct_write_val;
 
 #if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG)
-        ppc_md.progress = gen550_progress;
+	ppc_md.progress = gen550_progress;
 #endif /* CONFIG_SERIAL_8250 && CONFIG_SERIAL_TEXT_DEBUG */
 
-        if (ppc_md.progress)
-                ppc_md.progress("mpc85xx_cds_init(): exit", 0);
+	if (ppc_md.progress)
+		ppc_md.progress("mpc85xx_cds_init(): exit", 0);
 
-        return;
+	return;
 }
diff -Nru a/arch/ppc/platforms/85xx/mpc85xx_cds_common.h b/arch/ppc/platforms/85xx/mpc85xx_cds_common.h
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.h	2005-01-30 22:22:38 -08:00
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.h	2005-03-04 22:41:52 -08:00
@@ -33,6 +33,10 @@
 #define CM_CSR	(1)
 #define CM_RST	(2)
 
+/* CDS NVRAM/RTC */
+#define CDS_RTC_ADDR	(0xf8000000)
+#define CDS_RTC_SIZE	(8 * 1024)
+
 /* PCI config */
 #define PCI1_CFG_ADDR_OFFSET	(0x8000)
 #define PCI1_CFG_DATA_OFFSET	(0x8004)
diff -Nru a/arch/ppc/platforms/85xx/mpc85xx_sys.c b/arch/ppc/platforms/85xx/mpc85xx_sys.c
--- a/arch/ppc/platforms/85xx/mpc85xx_sys.c	2005-01-30 22:22:38 -08:00
+++ b/arch/ppc/platforms/85xx/mpc85xx_sys.c	2005-03-04 22:41:17 -08:00
@@ -21,7 +21,7 @@
 struct ppc_sys_spec *cur_ppc_sys_spec;
 struct ppc_sys_spec ppc_sys_specs[] = {
 	{
-		.ppc_sys_name	= "MPC8540",
+		.ppc_sys_name	= "8540",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80300000,
 		.num_devices	= 10,
@@ -33,7 +33,7 @@
 		},
 	},
 	{
-		.ppc_sys_name	= "MPC8560",
+		.ppc_sys_name	= "8560",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80700000,
 		.num_devices	= 19,
@@ -49,7 +49,7 @@
 		},
 	},
 	{
-		.ppc_sys_name	= "MPC8541",
+		.ppc_sys_name	= "8541",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80720000,
 		.num_devices	= 13,
@@ -63,7 +63,7 @@
 		},
 	},
 	{
-		.ppc_sys_name	= "MPC8541E",
+		.ppc_sys_name	= "8541E",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x807A0000,
 		.num_devices	= 14,
@@ -77,7 +77,7 @@
 		},
 	},
 	{
-		.ppc_sys_name	= "MPC8555",
+		.ppc_sys_name	= "8555",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80710000,
 		.num_devices	= 20,
@@ -94,7 +94,7 @@
 		},
 	},
 	{
-		.ppc_sys_name	= "MPC8555E",
+		.ppc_sys_name	= "8555E",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80790000,
 		.num_devices	= 21,
diff -Nru a/arch/ppc/platforms/85xx/sbc85xx.c b/arch/ppc/platforms/85xx/sbc85xx.c
--- a/arch/ppc/platforms/85xx/sbc85xx.c	2005-01-20 20:56:31 -08:00
+++ b/arch/ppc/platforms/85xx/sbc85xx.c	2005-03-04 22:41:17 -08:00
@@ -42,6 +42,7 @@
 #include <asm/mpc85xx.h>
 #include <asm/irq.h>
 #include <asm/immap_85xx.h>
+#include <asm/ppc_sys.h>
 
 #include <mm/mmu_decl.h>
 
@@ -128,19 +129,9 @@
 	pvid = mfspr(PVR);
 	svid = mfspr(SVR);
 
+	seq_printf(m, "chip\t\t: MPC%s\n", cur_ppc_sys_spec->ppc_sys_name);
 	seq_printf(m, "Vendor\t\t: Wind River\n");
-
-	switch (svid & 0xffff0000) {
-	case SVR_8540:
-		seq_printf(m, "Machine\t\t: hhmmm, this board isn't made yet!\n");
-		break;
-	case SVR_8560:
-		seq_printf(m, "Machine\t\t: SBC8560\n");
-		break;
-	default:
-		seq_printf(m, "Machine\t\t: unknown\n");
-		break;
-	}
+	seq_printf(m, "Machine\t\t: SBC%s\n", cur_ppc_sys_spec->ppc_sys_name);
 	seq_printf(m, "clock\t\t: %dMHz\n", freq / 1000000);
 	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
 	seq_printf(m, "SVR\t\t: 0x%x\n", svid);
diff -Nru a/arch/ppc/platforms/85xx/stx_gp3.c b/arch/ppc/platforms/85xx/stx_gp3.c
--- a/arch/ppc/platforms/85xx/stx_gp3.c	2005-01-30 22:22:38 -08:00
+++ b/arch/ppc/platforms/85xx/stx_gp3.c	2005-03-04 22:41:17 -08:00
@@ -34,8 +34,10 @@
 #include <linux/root_dev.h>
 #include <linux/seq_file.h>
 #include <linux/serial.h>
+#include <linux/initrd.h>
 #include <linux/module.h>
 #include <linux/fsl_devices.h>
+#include <linux/interrupt.h>
 
 #include <asm/system.h>
 #include <asm/pgtable.h>
@@ -266,19 +268,9 @@
 
 	memsize = total_memory;
 
+	seq_printf(m, "chip\t\t: MPC%s\n", cur_ppc_sys_spec->ppc_sys_name);
 	seq_printf(m, "Vendor\t\t: RPC Electronics STx \n");
-
-	switch (svid & 0xffff0000) {
-	case SVR_8540:
-		seq_printf(m, "Machine\t\t: GP3 - MPC8540\n");
-		break;
-	case SVR_8560:
-		seq_printf(m, "Machine\t\t: GP3 - MPC8560\n");
-		break;
-	default:
-		seq_printf(m, "Machine\t\t: unknown\n");
-		break;
-	}
+	seq_printf(m, "Machine\t\t: GP3 - MPC%s\n", cur_ppc_sys_spec->ppc_sys_name);
 	seq_printf(m, "bus freq\t: %u.%.6u MHz\n", freq / 1000000,
 		   freq % 1000000);
 	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
diff -Nru a/arch/ppc/platforms/Makefile b/arch/ppc/platforms/Makefile
--- a/arch/ppc/platforms/Makefile	2005-01-30 22:22:37 -08:00
+++ b/arch/ppc/platforms/Makefile	2005-03-07 20:41:25 -08:00
@@ -39,6 +39,7 @@
 obj-$(CONFIG_PPLUS)		+= pplus.o
 obj-$(CONFIG_PRPMC750)		+= prpmc750.o
 obj-$(CONFIG_PRPMC800)		+= prpmc800.o
+obj-$(CONFIG_RADSTONE_PPC7D)	+= radstone_ppc7d.o
 obj-$(CONFIG_SANDPOINT)		+= sandpoint.o
 obj-$(CONFIG_SBC82xx)		+= sbc82xx.o
 obj-$(CONFIG_SPRUCE)		+= spruce.o
diff -Nru a/arch/ppc/platforms/katana.c b/arch/ppc/platforms/katana.c
--- a/arch/ppc/platforms/katana.c	2005-01-30 22:22:37 -08:00
+++ b/arch/ppc/platforms/katana.c	2005-03-04 22:41:16 -08:00
@@ -1,9 +1,10 @@
 /*
  * arch/ppc/platforms/katana.c
  *
- * Board setup routines for the Artesyn Katana 750 based boards.
+ * Board setup routines for the Artesyn Katana cPCI boards.
  *
- * Tim Montgomery <timm@artesyncp.com>
+ * Athor: Tim Montgomery <timm@artesyncp.com>
+ * Maintained by: Mark A. Greer <mgreer@mvista.com>
  *
  * Based on code done by Rabeeh Khoury - rabeeh@galileo.co.il
  * Based on code done by - Mark A. Greer <mgreer@mvista.com>
@@ -26,7 +27,8 @@
 #include <linux/root_dev.h>
 #include <linux/delay.h>
 #include <linux/seq_file.h>
-#include <linux/smp.h>
+#include <linux/bootmem.h>
+#include <linux/mtd/physmap.h>
 #include <linux/mv643xx.h>
 #ifdef CONFIG_BOOTIMG
 #include <linux/bootimg.h>
@@ -36,13 +38,19 @@
 #include <asm/smp.h>
 #include <asm/todc.h>
 #include <asm/bootinfo.h>
+#include <asm/ppcboot.h>
 #include <asm/mv64x60.h>
 #include <platforms/katana.h>
 
 static struct		mv64x60_handle bh;
 static katana_id_t	katana_id;
-static u32		cpld_base;
-static u32		sram_base;
+static void __iomem	*cpld_base;
+static void __iomem	*sram_base;
+
+static u32		katana_flash_size_0;
+static u32		katana_flash_size_1;
+
+unsigned char	__res[sizeof(bd_t)];
 
 /* PCI Interrupt routing */
 static int __init
@@ -105,7 +113,7 @@
 void __init
 katana_get_board_id(void)
 {
-	switch (in_8((volatile char *)(cpld_base + KATANA_CPLD_PRODUCT_ID))) {
+	switch (in_8(cpld_base + KATANA_CPLD_PRODUCT_ID)) {
 	case KATANA_PRODUCT_ID_3750:
 		katana_id = KATANA_ID_3750;
 		break;
@@ -170,7 +178,7 @@
 static inline int
 katana_is_monarch(void)
 {
-	return in_8((volatile char *)(cpld_base + KATANA_CPLD_BD_CFG_3)) &
+	return in_8(cpld_base + KATANA_CPLD_BD_CFG_3) &
 		KATANA_CPLD_BD_CFG_3_MONARCH;
 }
 
@@ -180,18 +188,17 @@
 	u8 reset_out;
 
 	/* Enable access to IPMI ctlr by clearing IPMI PORTSEL bit in CPLD */
-	reset_out = in_8((volatile char *)(cpld_base + KATANA_CPLD_RESET_OUT));
+	reset_out = in_8(cpld_base + KATANA_CPLD_RESET_OUT);
 	reset_out &= ~KATANA_CPLD_RESET_OUT_PORTSEL;
-	out_8((volatile void *)(cpld_base + KATANA_CPLD_RESET_OUT), reset_out);
-	return;
+	out_8(cpld_base + KATANA_CPLD_RESET_OUT, reset_out);
 }
 
-static unsigned long
+static u32
 katana_bus_freq(void)
 {
 	u8 bd_cfg_0;
 
-	bd_cfg_0 = in_8((volatile char *)(cpld_base + KATANA_CPLD_BD_CFG_0));
+	bd_cfg_0 = in_8(cpld_base + KATANA_CPLD_BD_CFG_0);
 
 	switch (bd_cfg_0 & KATANA_CPLD_BD_CFG_0_SYSCLK_MASK) {
 	case KATANA_CPLD_BD_CFG_0_SYSCLK_200:
@@ -263,13 +270,12 @@
 	 * BIT25 summarizes GPP interrupts 8-15
 	 */
 	mv64x60_set_bits(&bh, MV64360_IC_CPU0_INTR_MASK_HI, (1<<25));
-	return;
 }
 
 void __init
 katana_setup_peripherals(void)
 {
-	u32 base, size_0, size_1;
+	u32 base;
 
 	/* Set up windows for boot CS, soldered & socketed flash, and CPLD */
 	mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
@@ -277,19 +283,22 @@
 	bh.ci->enable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
 
 	/* Assume firmware set up window sizes correctly for dev 0 & 1 */
-	mv64x60_get_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN, &base, &size_0);
+	mv64x60_get_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN, &base,
+		&katana_flash_size_0);
 
-	if (size_0 > 0) {
+	if (katana_flash_size_0 > 0) {
 		mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_0_WIN,
-			 KATANA_SOLDERED_FLASH_BASE, size_0, 0);
+			 KATANA_SOLDERED_FLASH_BASE, katana_flash_size_0, 0);
 		bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_0_WIN);
 	}
 
-	mv64x60_get_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN, &base, &size_1);
+	mv64x60_get_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN, &base,
+		&katana_flash_size_1);
 
-	if (size_1 > 0) {
+	if (katana_flash_size_1 > 0) {
 		mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_1_WIN,
-			 (KATANA_SOLDERED_FLASH_BASE + size_0), size_1, 0);
+			 (KATANA_SOLDERED_FLASH_BASE + katana_flash_size_0),
+			 katana_flash_size_1, 0);
 		bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_1_WIN);
 	}
 
@@ -300,12 +309,12 @@
 	mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN,
 		 KATANA_CPLD_BASE, KATANA_CPLD_SIZE, 0);
 	bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_3_WIN);
-	cpld_base = (u32)ioremap(KATANA_CPLD_BASE, KATANA_CPLD_SIZE);
+	cpld_base = ioremap(KATANA_CPLD_BASE, KATANA_CPLD_SIZE);
 
 	mv64x60_set_32bit_window(&bh, MV64x60_CPU2SRAM_WIN,
 		 KATANA_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE, 0);
 	bh.ci->enable_window_32bit(&bh, MV64x60_CPU2SRAM_WIN);
-	sram_base = (u32)ioremap(KATANA_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE);
+	sram_base = ioremap(KATANA_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE);
 
 	/* Set up Enet->SRAM window */
 	mv64x60_set_32bit_window(&bh, MV64x60_ENET2MEM_4_WIN,
@@ -339,13 +348,11 @@
 	 * internal data path in SRAM since it's first time accessing it
 	 * while after reset it's not configured.
 	 */
-	memset((void *)sram_base, 0, MV64360_SRAM_SIZE);
+	memset(sram_base, 0, MV64360_SRAM_SIZE);
 
 	/* Only processor zero [on 3750] is an PCI interrupt controller */
 	if (katana_get_proc_num() == 0)
 		katana_intr_setup();
-
-	return;
 }
 
 static void __init
@@ -356,7 +363,7 @@
 
 	memset(&si, 0, sizeof(si));
 
-	si.phys_reg_base = KATANA_BRIDGE_REG_BASE;
+	si.phys_reg_base = CONFIG_MV64X60_NEW_BASE;
 
 	si.pci_1.enable_bus = 1;
 	si.pci_1.pci_io.cpu_base = KATANA_PCI1_IO_START_PROC_ADDR;
@@ -410,10 +417,77 @@
 	mv64x60_set_bus(&bh, 1, 0);
 	bh.hose_b->first_busno = 0;
 	bh.hose_b->last_busno = 0xff;
+}
+
+#ifdef CONFIG_MTD_PHYSMAP
 
-	return;
+#ifndef MB
+#define MB	(1 << 20)
+#endif
+
+/*
+ * MTD Layout depends on amount of soldered FLASH in system. Sizes in MB.
+ *
+ * FLASH Amount:	128	64	32	16
+ * -------------	---	--	--	--
+ * Monitor:		1	1	1	1
+ * Primary Kernel:	1.5	1.5	1.5	1.5
+ * Primary fs:		30	30	<end>	<end>
+ * Secondary Kernel:	1.5	1.5	N/A	N/A
+ * Secondary fs:	<end>	<end>	N/A	N/A
+ * User: 		<overlays entire FLASH except for "Monitor" section>
+ */
+static int __init
+katana_setup_mtd(void)
+{
+	u32	size;
+	int	ptbl_entries;
+	static struct mtd_partition	*ptbl;
+
+	size = katana_flash_size_0 + katana_flash_size_1;
+	if (!size)
+		return -ENOMEM;
+
+	ptbl_entries = (size >= (64*MB)) ? 6 : 4;
+
+	if ((ptbl = kmalloc(ptbl_entries * sizeof(struct mtd_partition),
+		GFP_KERNEL)) == NULL) {
+
+		printk(KERN_WARNING "Can't alloc MTD partition table\n");
+		return -ENOMEM;
+	}
+	memset(ptbl, 0, ptbl_entries * sizeof(struct mtd_partition));
+
+	ptbl[0].name = "Monitor";
+	ptbl[0].size = KATANA_MTD_MONITOR_SIZE;
+	ptbl[1].name = "Primary Kernel";
+	ptbl[1].offset = MTDPART_OFS_NXTBLK;
+	ptbl[1].size = 0x00180000; /* 1.5 MB */
+	ptbl[2].name = "Primary Filesystem";
+	ptbl[2].offset = MTDPART_OFS_APPEND;
+	ptbl[2].size = MTDPART_SIZ_FULL; /* Correct for 16 & 32 MB */
+	ptbl[ptbl_entries-1].name = "User FLASH";
+	ptbl[ptbl_entries-1].offset = KATANA_MTD_MONITOR_SIZE;
+	ptbl[ptbl_entries-1].size = MTDPART_SIZ_FULL;
+
+	if (size >= (64*MB)) {
+		ptbl[2].size = 30*MB;
+		ptbl[3].name = "Secondary Kernel";
+		ptbl[3].offset = MTDPART_OFS_NXTBLK;
+		ptbl[3].size = 0x00180000; /* 1.5 MB */
+		ptbl[4].name = "Secondary Filesystem";
+		ptbl[4].offset = MTDPART_OFS_APPEND;
+		ptbl[4].size = MTDPART_SIZ_FULL;
+	}
+
+	physmap_map.size = size;
+	physmap_set_partitions(ptbl, ptbl_entries);
+	return 0;
 }
 
+arch_initcall(katana_setup_mtd);
+#endif
+
 static void __init
 katana_setup_arch(void)
 {
@@ -444,8 +518,7 @@
 		printk(KERN_INFO "DD2.0 detected. Setting L2 cache"
 			"to Writethrough mode\n");
 		_set_L2CR(L2CR_L2E | L2CR_L2PE | L2CR_L2WT);
-	}
-	else
+	} else
 		_set_L2CR(L2CR_L2E | L2CR_L2PE);
 
 	if (ppc_md.progress)
@@ -458,7 +531,6 @@
 	printk(KERN_INFO "Artesyn Communication Products, LLC - Katana(TM)\n");
 	if (ppc_md.progress)
 		ppc_md.progress("katana_setup_arch: exit", 0);
-	return;
 }
 
 /* Platform device data fixup routines. */
@@ -473,9 +545,12 @@
 	pdata->max_idle = 40;
 	pdata->default_baud = KATANA_DEFAULT_BAUD;
 	pdata->brg_clk_src = KATANA_MPSC_CLK_SRC;
-	pdata->brg_clk_freq = KATANA_MPSC_CLK_FREQ;
-
-	return;
+	/*
+	 * TCLK (not SysCLk) is routed to BRG, then to the MPSC.  On most parts,
+	 * TCLK == SysCLK but on 64460, they are separate pins.
+	 * SysCLK can go up to 200 MHz but TCLK can only go up to 133 MHz.
+	 */
+	pdata->brg_clk_freq = min(katana_bus_freq(), MV64x60_TCLK_FREQ_MAX);
 }
 #endif
 
@@ -483,32 +558,18 @@
 static void __init
 katana_fixup_eth_pdata(struct platform_device *pdev)
 {
-	struct mv64xxx_eth_platform_data *eth_pd;
+	struct mv643xx_eth_platform_data *eth_pd;
 	static u16 phy_addr[] = {
 		KATANA_ETH0_PHY_ADDR,
 		KATANA_ETH1_PHY_ADDR,
 		KATANA_ETH2_PHY_ADDR,
 	};
-	int	rx_size = KATANA_ETH_RX_QUEUE_SIZE * MV64340_ETH_DESC_SIZE;
-	int	tx_size = KATANA_ETH_TX_QUEUE_SIZE * MV64340_ETH_DESC_SIZE;
 
 	eth_pd = pdev->dev.platform_data;
 	eth_pd->force_phy_addr = 1;
 	eth_pd->phy_addr = phy_addr[pdev->id];
 	eth_pd->tx_queue_size = KATANA_ETH_TX_QUEUE_SIZE;
 	eth_pd->rx_queue_size = KATANA_ETH_RX_QUEUE_SIZE;
-	eth_pd->tx_sram_addr = mv643xx_sram_alloc(tx_size);
-
-	if (eth_pd->tx_sram_addr)
-		eth_pd->tx_sram_size = tx_size;
-	else
-		printk(KERN_ERR "mv643xx_sram_alloc failed\n");
-
-	eth_pd->rx_sram_addr = mv643xx_sram_alloc(rx_size);
-	if (eth_pd->rx_sram_addr)
-		eth_pd->rx_sram_size = rx_size;
-	else
-		printk(KERN_ERR "mv643xx_sram_alloc failed\n");
 }
 #endif
 
@@ -524,9 +585,9 @@
 		{ MPSC_CTLR_NAME "1", katana_fixup_mpsc_pdata },
 #endif
 #if defined(CONFIG_MV643XX_ETH)
-		{ MV64XXX_ETH_NAME "0", katana_fixup_eth_pdata },
-		{ MV64XXX_ETH_NAME "1", katana_fixup_eth_pdata },
-		{ MV64XXX_ETH_NAME "2", katana_fixup_eth_pdata },
+		{ MV643XX_ETH_NAME "0", katana_fixup_eth_pdata },
+		{ MV643XX_ETH_NAME "1", katana_fixup_eth_pdata },
+		{ MV643XX_ETH_NAME "2", katana_fixup_eth_pdata },
 #endif
 	};
 	struct platform_device	*pdev;
@@ -548,11 +609,10 @@
 static void
 katana_restart(char *cmd)
 {
-	volatile ulong i = 10000000;
+	ulong	i = 10000000;
 
 	/* issue hard reset to the reset command register */
-	out_8((volatile char *)(cpld_base + KATANA_CPLD_RST_CMD),
-		KATANA_CPLD_RST_CMD_HR);
+	out_8(cpld_base + KATANA_CPLD_RST_CMD, KATANA_CPLD_RST_CMD_HR);
 
 	while (i-- > 0) ;
 	panic("restart failed\n");
@@ -561,6 +621,14 @@
 static void
 katana_halt(void)
 {
+	u8	v;
+
+	if (katana_id == KATANA_ID_752I) {
+		   v = in_8(cpld_base + HSL_PLD_BASE + HSL_PLD_HOT_SWAP_OFF);
+		   v |= HSL_PLD_HOT_SWAP_LED_BIT;
+		   out_8(cpld_base + HSL_PLD_BASE + HSL_PLD_HOT_SWAP_OFF, v);
+	}
+
 	while (1) ;
 	/* NOTREACHED */
 }
@@ -598,12 +666,13 @@
 	}
 
 	seq_printf(m, "product ID\t: 0x%x\n",
-		   in_8((volatile char *)(cpld_base + KATANA_CPLD_PRODUCT_ID)));
+		   in_8(cpld_base + KATANA_CPLD_PRODUCT_ID));
 	seq_printf(m, "hardware rev\t: 0x%x\n",
-		   in_8((volatile char *)(cpld_base+KATANA_CPLD_HARDWARE_VER)));
+		   in_8(cpld_base+KATANA_CPLD_HARDWARE_VER));
 	seq_printf(m, "PLD rev\t\t: 0x%x\n",
-		   in_8((volatile char *)(cpld_base + KATANA_CPLD_PLD_VER)));
-	seq_printf(m, "PLB freq\t: %ldMhz\n", katana_bus_freq() / 1000000);
+		   in_8(cpld_base + KATANA_CPLD_PLD_VER));
+	seq_printf(m, "PLB freq\t: %ldMhz\n",
+		(long)katana_bus_freq() / 1000000);
 	seq_printf(m, "PCI\t\t: %sMonarch\n", katana_is_monarch()? "" : "Non-");
 
 	return 0;
@@ -612,23 +681,21 @@
 static void __init
 katana_calibrate_decr(void)
 {
-	ulong freq;
+	u32 freq;
 
 	freq = katana_bus_freq() / 4;
 
 	printk(KERN_INFO "time_init: decrementer frequency = %lu.%.6lu MHz\n",
-	       freq / 1000000, freq % 1000000);
+	       (long)freq / 1000000, (long)freq % 1000000);
 
 	tb_ticks_per_jiffy = freq / HZ;
 	tb_to_us = mulhwu_scale_factor(freq, 1000000);
-
-	return;
 }
 
 unsigned long __init
 katana_find_end_of_memory(void)
 {
-	return mv64x60_get_mem_size(KATANA_BRIDGE_REG_BASE,
+	return mv64x60_get_mem_size(CONFIG_MV64X60_NEW_BASE,
 		MV64x60_TYPE_MV64360);
 }
 
@@ -639,8 +706,6 @@
 	mtspr(DBAT2U, 0xf0001ffe);
 	mtspr(DBAT2L, 0xf000002a);
 	mb();
-
-	return;
 }
 
 #if defined(CONFIG_SERIAL_TEXT_DEBUG) && defined(CONFIG_SERIAL_MPSC_CONSOLE)
@@ -657,6 +722,23 @@
 {
 	parse_bootinfo(find_bootinfo());
 
+	/* ASSUMPTION:  If both r3 (bd_t pointer) and r6 (cmdline pointer)
+	 * are non-zero, then we should use the board info from the bd_t
+	 * structure and the cmdline pointed to by r6 instead of the
+	 * information from birecs, if any.  Otherwise, use the information
+	 * from birecs as discovered by the preceeding call to
+	 * parse_bootinfo().  This rule should work with both PPCBoot, which
+	 * uses a bd_t board info structure, and the kernel boot wrapper,
+	 * which uses birecs.
+	 */
+	if (r3 && r6) {
+		/* copy board info structure */
+		memcpy( (void *)__res,(void *)(r3+KERNELBASE), sizeof(bd_t) );
+		/* copy command line */
+		*(char *)(r7+KERNELBASE) = 0;
+		strcpy(cmd_line, (char *)(r6+KERNELBASE));
+	}
+
 	isa_mem_base = 0;
 
 	ppc_md.setup_arch = katana_setup_arch;
@@ -672,7 +754,7 @@
 #if defined(CONFIG_SERIAL_TEXT_DEBUG) && defined(CONFIG_SERIAL_MPSC_CONSOLE)
 	ppc_md.setup_io_mappings = katana_map_io;
 	ppc_md.progress = mv64x60_mpsc_progress;
-	mv64x60_progress_init(KATANA_BRIDGE_REG_BASE);
+	mv64x60_progress_init(CONFIG_MV64X60_NEW_BASE);
 #endif
 
 #if defined(CONFIG_SERIAL_MPSC) || defined(CONFIG_MV643XX_ETH)
@@ -680,5 +762,4 @@
 #endif
 
 	katana_set_bat(); /* Need for katana_find_end_of_memory and progress */
-	return;
 }
diff -Nru a/arch/ppc/platforms/katana.h b/arch/ppc/platforms/katana.h
--- a/arch/ppc/platforms/katana.h	2005-01-30 22:22:37 -08:00
+++ b/arch/ppc/platforms/katana.h	2005-03-04 22:41:16 -08:00
@@ -19,18 +19,17 @@
  * PCI I/O space and 4 windows from the CPU bus to PCI MEM space.
  * We'll only use one PCI MEM window on each PCI bus.
  *
- * This is the CPU physical memory map (windows must be at least 1MB and start
+ * This is the CPU physical memory map (windows must be at least 64 KB and start
  * on a boundary that is a multiple of the window size):
  *
  *    0xff800000-0xffffffff      - Boot window
  *    0xf8400000-0xf85fffff      - Internal SRAM
- *    0xf8200000-0xf823ffff      - CPLD
- *    0xf8100000-0xf810ffff      - MV64360 Registers
- *    0xf8000000-0xf80fffff      - PLCC socket
- *    0xf0000000-0xf01fffff	 - Consistent memory pool
- *    0xe8000000-0xefffffff      - soldered flash
- *    0xc0000000-0xc0ffffff      - PCI I/O
- *    0x80000000-0xbfffffff      - PCI MEM
+ *    0xf8200000-0xf83fffff      - CPLD
+ *    0xf8100000-0xf810ffff      - MV64360 Registers (CONFIG_MV64X60_NEW_BASE)
+ *    0xf8000000-0xf80fffff      - Socketed FLASH
+ *    0xe0000000-0xefffffff      - Soldered FLASH
+ *    0xc0000000-0xc3ffffff      - PCI I/O (second hose)
+ *    0x80000000-0xbfffffff      - PCI MEM (second hose)
  */
 
 #ifndef __PPC_PLATFORMS_KATANA_H
@@ -38,33 +37,22 @@
 
 /* CPU Physical Memory Map setup. */
 #define KATANA_BOOT_WINDOW_BASE			0xff800000
+#define KATANA_BOOT_WINDOW_SIZE			0x00800000 /* 8 MB */
 #define KATANA_INTERNAL_SRAM_BASE		0xf8400000
 #define KATANA_CPLD_BASE			0xf8200000
-#define KATANA_BRIDGE_REG_BASE			0xf8100000
+#define KATANA_CPLD_SIZE			0x00200000 /* 2 MB */
 #define KATANA_SOCKET_BASE			0xf8000000
-#define KATANA_SOLDERED_FLASH_BASE		0xe8000000
-
-#define KATANA_BOOT_WINDOW_SIZE_ACTUAL		0x00800000 /* 8MB */
-#define KATANA_CPLD_SIZE_ACTUAL			0x00020000 /* 128KB */
-#define KATANA_SOCKETED_FLASH_SIZE_ACTUAL	0x00080000 /* 512KB */
-#define KATANA_SOLDERED_FLASH_SIZE_ACTUAL	0x02000000 /* 32MB */
-
-#define KATANA_BOOT_WINDOW_SIZE		max(MV64360_WINDOW_SIZE_MIN,	\
-		KATANA_BOOT_WINDOW_SIZE_ACTUAL)
-#define KATANA_CPLD_SIZE		max(MV64360_WINDOW_SIZE_MIN,	\
-		KATANA_CPLD_SIZE_ACTUAL)
-#define KATANA_SOCKETED_FLASH_SIZE	max(MV64360_WINDOW_SIZE_MIN,	\
-		KATANA_SOCKETED_FLASH_SIZE_ACTUAL)
-#define KATANA_SOLDERED_FLASH_SIZE	max(MV64360_WINDOW_SIZE_MIN,	\
-		KATANA_SOLDERED_FLASH_SIZE_ACTUAL)
+#define KATANA_SOCKETED_FLASH_SIZE		0x00100000 /* 1 MB */
+#define KATANA_SOLDERED_FLASH_BASE		0xe0000000
+#define KATANA_SOLDERED_FLASH_SIZE		0x10000000 /* 256 MB */
 
 #define KATANA_PCI1_MEM_START_PROC_ADDR         0x80000000
 #define KATANA_PCI1_MEM_START_PCI_HI_ADDR       0x00000000
 #define KATANA_PCI1_MEM_START_PCI_LO_ADDR       0x80000000
-#define KATANA_PCI1_MEM_SIZE                    0x40000000
+#define KATANA_PCI1_MEM_SIZE                    0x40000000 /* 1 GB */
 #define KATANA_PCI1_IO_START_PROC_ADDR          0xc0000000
 #define KATANA_PCI1_IO_START_PCI_ADDR           0x00000000
-#define KATANA_PCI1_IO_SIZE                     0x01000000
+#define KATANA_PCI1_IO_SIZE                     0x04000000 /* 64 MB */
 
 /* Board-specific IRQ info */
 #define  KATANA_PCI_INTA_IRQ_3750		64+8
@@ -138,6 +126,8 @@
 #define HSL_PLD_J4SGA_REG_OFF			0
 #define HSL_PLD_J4GA_REG_OFF			1
 #define HSL_PLD_J2GA_REG_OFF			2
+#define HSL_PLD_HOT_SWAP_OFF			6
+#define HSL_PLD_HOT_SWAP_LED_BIT		0x1
 #define GA_MASK					0x1f
 #define HSL_PLD_SIZE				0x1000
 #define K3750_GPP_GEO_ADDR_PINS			0xf8000000
@@ -162,7 +152,8 @@
 
 #define	KATANA_DEFAULT_BAUD			9600
 #define	KATANA_MPSC_CLK_SRC			8	  /* TCLK */
-#define	KATANA_MPSC_CLK_FREQ			133333333 /* 133.3333... MHz */
+
+#define	KATANA_MTD_MONITOR_SIZE			(1 << 20) /* 1 MB */
 
 #define	KATANA_ETH0_PHY_ADDR			12
 #define	KATANA_ETH1_PHY_ADDR			11
diff -Nru a/arch/ppc/platforms/pmac_cpufreq.c b/arch/ppc/platforms/pmac_cpufreq.c
--- a/arch/ppc/platforms/pmac_cpufreq.c	2005-01-30 22:22:37 -08:00
+++ b/arch/ppc/platforms/pmac_cpufreq.c	2005-03-04 22:41:15 -08:00
@@ -230,7 +230,7 @@
 	enable_kernel_fp();
 
 #ifdef CONFIG_ALTIVEC
-	if (cur_cpu_spec[0]->cpu_features & CPU_FTR_ALTIVEC)
+	if (cpu_has_feature(CPU_FTR_ALTIVEC))
 		enable_kernel_altivec();
 #endif /* CONFIG_ALTIVEC */
 
diff -Nru a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c
--- a/arch/ppc/platforms/pmac_setup.c	2004-10-20 01:37:14 -07:00
+++ b/arch/ppc/platforms/pmac_setup.c	2005-03-04 22:41:15 -08:00
@@ -274,7 +274,7 @@
 	pmac_find_bridges();
 
 	/* Checks "l2cr-value" property in the registry */
-	if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR) {
+	if (cpu_has_feature(CPU_FTR_L2CR)) {
 		struct device_node *np = find_devices("cpus");
 		if (np == 0)
 			np = find_type_devices("cpu");
diff -Nru a/arch/ppc/platforms/pmac_smp.c b/arch/ppc/platforms/pmac_smp.c
--- a/arch/ppc/platforms/pmac_smp.c	2004-11-02 06:40:33 -08:00
+++ b/arch/ppc/platforms/pmac_smp.c	2005-03-04 22:41:15 -08:00
@@ -119,7 +119,7 @@
 
 static void __init core99_init_caches(int cpu)
 {
-	if (!(cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR))
+	if (!cpu_has_feature(CPU_FTR_L2CR))
 		return;
 
 	if (cpu == 0) {
@@ -132,7 +132,7 @@
 		printk("CPU%d: L2CR set to %lx\n", cpu, core99_l2_cache);
 	}
 
-	if (!(cur_cpu_spec[0]->cpu_features & CPU_FTR_L3CR))
+	if (!cpu_has_feature(CPU_FTR_L3CR))
 		return;
 
 	if (cpu == 0){
diff -Nru a/arch/ppc/platforms/radstone_ppc7d.c b/arch/ppc/platforms/radstone_ppc7d.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/platforms/radstone_ppc7d.c	2005-03-07 20:41:25 -08:00
@@ -0,0 +1,1408 @@
+/*
+ * arch/ppc/platforms/radstone_ppc7d.c
+ *
+ * Board setup routines for the Radstone PPC7D boards.
+ *
+ * Author: James Chapman <jchapman@katalix.com>
+ *
+ * Based on code done by Rabeeh Khoury - rabeeh@galileo.co.il
+ * Based on code done by - Mark A. Greer <mgreer@mvista.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+/* Radstone PPC7D boards are rugged VME boards with PPC 7447A CPUs,
+ * Discovery-II, dual gigabit ethernet, dual PMC, USB, keyboard/mouse,
+ * 4 serial ports, 2 high speed serial ports (MPSCs) and optional
+ * SCSI / VGA.
+ */
+
+#include <linux/config.h>
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/reboot.h>
+#include <linux/pci.h>
+#include <linux/kdev_t.h>
+#include <linux/major.h>
+#include <linux/initrd.h>
+#include <linux/console.h>
+#include <linux/delay.h>
+#include <linux/irq.h>
+#include <linux/ide.h>
+#include <linux/seq_file.h>
+#include <linux/root_dev.h>
+#include <linux/serial.h>
+#include <linux/tty.h>		/* for linux/serial_core.h */
+#include <linux/serial_core.h>
+#include <linux/mv643xx.h>
+#include <linux/netdevice.h>
+
+#include <asm/system.h>
+#include <asm/pgtable.h>
+#include <asm/page.h>
+#include <asm/time.h>
+#include <asm/dma.h>
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/prom.h>
+#include <asm/smp.h>
+#include <asm/vga.h>
+#include <asm/open_pic.h>
+#include <asm/i8259.h>
+#include <asm/todc.h>
+#include <asm/bootinfo.h>
+#include <asm/mpc10x.h>
+#include <asm/pci-bridge.h>
+#include <asm/mv64x60.h>
+#include <asm/i8259.h>
+
+#include "radstone_ppc7d.h"
+
+#undef DEBUG
+
+#define PPC7D_RST_PIN			17 	/* GPP17 */
+
+extern u32 mv64360_irq_base;
+
+static struct mv64x60_handle bh;
+static int ppc7d_has_alma;
+
+extern void gen550_progress(char *, unsigned short);
+extern void gen550_init(int, struct uart_port *);
+
+/* residual data */
+unsigned char __res[sizeof(bd_t)];
+
+/*****************************************************************************
+ * Serial port code
+ *****************************************************************************/
+
+#if defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG)
+static void __init ppc7d_early_serial_map(void)
+{
+#if defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	mv64x60_progress_init(CONFIG_MV64X60_NEW_BASE);
+#elif defined(CONFIG_SERIAL_8250)
+	struct uart_port serial_req;
+
+	/* Setup serial port access */
+	memset(&serial_req, 0, sizeof(serial_req));
+	serial_req.uartclk = UART_CLK;
+	serial_req.irq = 4;
+	serial_req.flags = STD_COM_FLAGS;
+	serial_req.iotype = SERIAL_IO_MEM;
+	serial_req.membase = (u_char *) PPC7D_SERIAL_0;
+
+	gen550_init(0, &serial_req);
+	if (early_serial_setup(&serial_req) != 0)
+		printk(KERN_ERR "Early serial init of port 0 failed\n");
+
+	/* Assume early_serial_setup() doesn't modify serial_req */
+	serial_req.line = 1;
+	serial_req.irq = 3;
+	serial_req.membase = (u_char *) PPC7D_SERIAL_1;
+
+	gen550_init(1, &serial_req);
+	if (early_serial_setup(&serial_req) != 0)
+		printk(KERN_ERR "Early serial init of port 1 failed\n");
+#else
+#error CONFIG_KGDB || CONFIG_SERIAL_TEXT_DEBUG has no supported CONFIG_SERIAL_XXX
+#endif
+}
+#endif /* CONFIG_KGDB || CONFIG_SERIAL_TEXT_DEBUG */
+
+/*****************************************************************************
+ * Low-level board support code
+ *****************************************************************************/
+
+static unsigned long __init ppc7d_find_end_of_memory(void)
+{
+	bd_t *bp = (bd_t *) __res;
+
+	if (bp->bi_memsize)
+		return bp->bi_memsize;
+
+	return (256 * 1024 * 1024);
+}
+
+static void __init ppc7d_map_io(void)
+{
+	/* remove temporary mapping */
+	mtspr(SPRN_DBAT3U, 0x00000000);
+	mtspr(SPRN_DBAT3L, 0x00000000);
+
+	io_block_mapping(0xe8000000, 0xe8000000, 0x08000000, _PAGE_IO);
+	io_block_mapping(0xfe000000, 0xfe000000, 0x02000000, _PAGE_IO);
+}
+
+static void ppc7d_restart(char *cmd)
+{
+	u32 data;
+
+	/* Disable GPP17 interrupt */
+	data = mv64x60_read(&bh, MV64x60_GPP_INTR_MASK);
+	data &= ~(1 << PPC7D_RST_PIN);
+	mv64x60_write(&bh, MV64x60_GPP_INTR_MASK, data);
+
+	/* Configure MPP17 as GPP */
+	data = mv64x60_read(&bh, MV64x60_MPP_CNTL_2);
+	data &= ~(0x0000000f << 4);
+	mv64x60_write(&bh, MV64x60_MPP_CNTL_2, data);
+
+	/* Enable pin GPP17 for output */
+	data = mv64x60_read(&bh, MV64x60_GPP_IO_CNTL);
+	data |= (1 << PPC7D_RST_PIN);
+	mv64x60_write(&bh, MV64x60_GPP_IO_CNTL, data);
+
+	/* Toggle GPP9 pin to reset the board */
+	mv64x60_write(&bh, MV64x60_GPP_VALUE_CLR, 1 << PPC7D_RST_PIN);
+	mv64x60_write(&bh, MV64x60_GPP_VALUE_SET, 1 << PPC7D_RST_PIN);
+
+	for (;;) ;		/* Spin until reset happens */
+	/* NOTREACHED */
+}
+
+static void ppc7d_power_off(void)
+{
+	u32 data;
+
+	local_irq_disable();
+
+	/* Ensure that internal MV643XX watchdog is disabled.
+	 * The Disco watchdog uses MPP17 on this hardware.
+	 */
+	data = mv64x60_read(&bh, MV64x60_MPP_CNTL_2);
+	data &= ~(0x0000000f << 4);
+	mv64x60_write(&bh, MV64x60_MPP_CNTL_2, data);
+
+	data = mv64x60_read(&bh, MV64x60_WDT_WDC);
+	if (data & 0x80000000) {
+		mv64x60_write(&bh, MV64x60_WDT_WDC, 1 << 24);
+		mv64x60_write(&bh, MV64x60_WDT_WDC, 2 << 24);
+	}
+
+	for (;;) ;		/* No way to shut power off with software */
+	/* NOTREACHED */
+}
+
+static void ppc7d_halt(void)
+{
+	ppc7d_power_off();
+	/* NOTREACHED */
+}
+
+static unsigned long ppc7d_led_no_pulse;
+
+static int __init ppc7d_led_pulse_disable(char *str)
+{
+	ppc7d_led_no_pulse = 1;
+	return 1;
+}
+
+/* This kernel option disables the heartbeat pulsing of a board LED */
+__setup("ledoff", ppc7d_led_pulse_disable);
+
+static void ppc7d_heartbeat(void)
+{
+	u32 data32;
+	u8 data8;
+	static int max706_wdog = 0;
+
+	/* Unfortunately we can't access the LED control registers
+	 * during early init because they're on the CPLD which is the
+	 * other side of a PCI bridge which goes unreachable during
+	 * PCI scan. So write the LEDs only if the MV64360 watchdog is
+	 * enabled (i.e. userspace apps are running so kernel is up)..
+	 */
+	data32 = mv64x60_read(&bh, MV64x60_WDT_WDC);
+	if (data32 & 0x80000000) {
+		/* Enable MAX706 watchdog if not done already */
+		if (!max706_wdog) {
+			outb(3, PPC7D_CPLD_RESET);
+			max706_wdog = 1;
+		}
+
+		/* Hit the MAX706 watchdog */
+		outb(0, PPC7D_CPLD_WATCHDOG_TRIG);
+
+		/* Pulse LED DS219 if not disabled */
+		if (!ppc7d_led_no_pulse) {
+			static int led_on = 0;
+
+			data8 = inb(PPC7D_CPLD_LEDS);
+			if (led_on)
+				data8 &= ~PPC7D_CPLD_LEDS_DS219_MASK;
+			else
+				data8 |= PPC7D_CPLD_LEDS_DS219_MASK;
+
+			outb(data8, PPC7D_CPLD_LEDS);
+			led_on = !led_on;
+		}
+	}
+	ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
+}
+
+static int ppc7d_show_cpuinfo(struct seq_file *m)
+{
+	u8 val;
+	u8 val1, val2;
+	static int flash_sizes[4] = { 64, 32, 0, 16 };
+	static int flash_banks[4] = { 4, 3, 2, 1 };
+	static char *pci_modes[] = { "PCI33", "PCI66",
+		"Unknown", "Unknown",
+		"PCIX33", "PCIX66",
+		"PCIX100", "PCIX133"
+	};
+
+	seq_printf(m, "vendor\t\t: Radstone Technology\n");
+	seq_printf(m, "machine\t\t: PPC7D\n");
+
+	val = inb(PPC7D_CPLD_BOARD_REVISION);
+	val1 = (val & PPC7D_CPLD_BOARD_REVISION_NUMBER_MASK) >> 5;
+	val2 = (val & PPC7D_CPLD_BOARD_REVISION_LETTER_MASK);
+	seq_printf(m, "revision\t: %hd%c%c\n",
+		   val1,
+		   (val2 <= 0x18) ? 'A' + val2 : 'Y',
+		   (val2 > 0x18) ? 'A' + (val2 - 0x19) : ' ');
+
+	val = inb(PPC7D_CPLD_MOTHERBOARD_TYPE);
+	val1 = val & PPC7D_CPLD_MB_TYPE_PLL_MASK;
+	val2 = val & (PPC7D_CPLD_MB_TYPE_ECC_FITTED_MASK |
+		      PPC7D_CPLD_MB_TYPE_ECC_ENABLE_MASK);
+	seq_printf(m, "bus speed\t: %dMHz\n",
+		   (val1 == PPC7D_CPLD_MB_TYPE_PLL_133) ? 133 :
+		   (val1 == PPC7D_CPLD_MB_TYPE_PLL_100) ? 100 :
+		   (val1 == PPC7D_CPLD_MB_TYPE_PLL_64) ? 64 : 0);
+
+	val = inb(PPC7D_CPLD_MEM_CONFIG_EXTEND);
+	val1 = val & PPC7D_CPLD_SDRAM_BANK_SIZE_MASK;
+	seq_printf(m, "SDRAM\t\t: %d%c",
+		   (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_128M) ? 128 :
+		   (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_256M) ? 256 :
+		   (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_512M) ? 512 : 1,
+		   (val1 == PPC7D_CPLD_SDRAM_BANK_SIZE_1G) ? 'G' : 'M');
+	if (val2 & PPC7D_CPLD_MB_TYPE_ECC_FITTED_MASK) {
+		seq_printf(m, " [ECC %sabled]",
+			   (val2 & PPC7D_CPLD_MB_TYPE_ECC_ENABLE_MASK) ? "en" :
+			   "dis");
+	}
+	seq_printf(m, "\n");
+
+	val1 = (val & PPC7D_CPLD_FLASH_DEV_SIZE_MASK);
+	val2 = (val & PPC7D_CPLD_FLASH_BANK_NUM_MASK) >> 2;
+	seq_printf(m, "FLASH\t\t: %d banks of %dM, total %dM\n",
+		   flash_banks[val2], flash_sizes[val1],
+		   flash_banks[val2] * flash_sizes[val1]);
+
+	val = inb(PPC7D_CPLD_FLASH_WRITE_CNTL);
+	val1 = inb(PPC7D_CPLD_SW_FLASH_WRITE_PROTECT);
+	seq_printf(m, "  write links\t: %s%s%s%s\n",
+		   (val & PPD7D_CPLD_FLASH_CNTL_WR_LINK_MASK) ? "WRITE " : "",
+		   (val & PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_MASK) ? "BOOT " : "",
+		   (val & PPD7D_CPLD_FLASH_CNTL_USER_LINK_MASK) ? "USER " : "",
+		   (val & (PPD7D_CPLD_FLASH_CNTL_WR_LINK_MASK |
+			   PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_MASK |
+			   PPD7D_CPLD_FLASH_CNTL_USER_LINK_MASK)) ==
+		   0 ? "NONE" : "");
+	seq_printf(m, "  write sector h/w enables: %s%s%s%s%s\n",
+		   (val & PPD7D_CPLD_FLASH_CNTL_RECO_WR_MASK) ? "RECOVERY " :
+		   "",
+		   (val & PPD7D_CPLD_FLASH_CNTL_BOOT_WR_MASK) ? "BOOT " : "",
+		   (val & PPD7D_CPLD_FLASH_CNTL_USER_WR_MASK) ? "USER " : "",
+		   (val1 & PPC7D_CPLD_FLASH_CNTL_NVRAM_PROT_MASK) ? "NVRAM " :
+		   "",
+		   (((val &
+		      (PPD7D_CPLD_FLASH_CNTL_RECO_WR_MASK |
+		       PPD7D_CPLD_FLASH_CNTL_BOOT_WR_MASK |
+		       PPD7D_CPLD_FLASH_CNTL_BOOT_WR_MASK)) == 0)
+		    && ((val1 & PPC7D_CPLD_FLASH_CNTL_NVRAM_PROT_MASK) ==
+			0)) ? "NONE" : "");
+	val1 =
+	    inb(PPC7D_CPLD_SW_FLASH_WRITE_PROTECT) &
+	    (PPC7D_CPLD_SW_FLASH_WRPROT_SYSBOOT_MASK |
+	     PPC7D_CPLD_SW_FLASH_WRPROT_USER_MASK);
+	seq_printf(m, "  software sector enables: %s%s%s\n",
+		   (val1 & PPC7D_CPLD_SW_FLASH_WRPROT_SYSBOOT_MASK) ? "SYSBOOT "
+		   : "",
+		   (val1 & PPC7D_CPLD_SW_FLASH_WRPROT_USER_MASK) ? "USER " : "",
+		   (val1 == 0) ? "NONE " : "");
+
+	seq_printf(m, "Boot options\t: %s%s%s%s\n",
+		   (val & PPC7D_CPLD_FLASH_CNTL_ALTBOOT_LINK_MASK) ?
+		   "ALTERNATE " : "",
+		   (val & PPC7D_CPLD_FLASH_CNTL_VMEBOOT_LINK_MASK) ? "VME " :
+		   "",
+		   (val & PPC7D_CPLD_FLASH_CNTL_RECBOOT_LINK_MASK) ? "RECOVERY "
+		   : "",
+		   ((val &
+		     (PPC7D_CPLD_FLASH_CNTL_ALTBOOT_LINK_MASK |
+		      PPC7D_CPLD_FLASH_CNTL_VMEBOOT_LINK_MASK |
+		      PPC7D_CPLD_FLASH_CNTL_RECBOOT_LINK_MASK)) ==
+		    0) ? "NONE" : "");
+
+	val = inb(PPC7D_CPLD_EQUIPMENT_PRESENT_1);
+	seq_printf(m, "Fitted modules\t: %s%s%s%s\n",
+		   (val & PPC7D_CPLD_EQPT_PRES_1_PMC1_MASK) ? "" : "PMC1 ",
+		   (val & PPC7D_CPLD_EQPT_PRES_1_PMC2_MASK) ? "" : "PMC2 ",
+		   (val & PPC7D_CPLD_EQPT_PRES_1_AFIX_MASK) ? "AFIX " : "",
+		   ((val & (PPC7D_CPLD_EQPT_PRES_1_PMC1_MASK |
+			    PPC7D_CPLD_EQPT_PRES_1_PMC2_MASK |
+			    PPC7D_CPLD_EQPT_PRES_1_AFIX_MASK)) ==
+		    (PPC7D_CPLD_EQPT_PRES_1_PMC1_MASK |
+		     PPC7D_CPLD_EQPT_PRES_1_PMC2_MASK)) ? "NONE" : "");
+
+	if (val & PPC7D_CPLD_EQPT_PRES_1_AFIX_MASK) {
+		static const char *ids[] = {
+			"unknown",
+			"1553 (Dual Channel)",
+			"1553 (Single Channel)",
+			"8-bit SCSI + VGA",
+			"16-bit SCSI + VGA",
+			"1553 (Single Channel with sideband)",
+			"1553 (Dual Channel with sideband)",
+			NULL
+		};
+		u8 id = __raw_readb((void *)PPC7D_AFIX_REG_BASE + 0x03);
+		seq_printf(m, "AFIX module\t: 0x%hx [%s]\n", id,
+			   id < 7 ? ids[id] : "unknown");
+	}
+
+	val = inb(PPC7D_CPLD_PCI_CONFIG);
+	val1 = (val & PPC7D_CPLD_PCI_CONFIG_PCI0_MASK) >> 4;
+	val2 = (val & PPC7D_CPLD_PCI_CONFIG_PCI1_MASK);
+	seq_printf(m, "PCI#0\t\t: %s\nPCI#1\t\t: %s\n",
+		   pci_modes[val1], pci_modes[val2]);
+
+	val = inb(PPC7D_CPLD_EQUIPMENT_PRESENT_2);
+	seq_printf(m, "PMC1\t\t: %s\nPMC2\t\t: %s\n",
+		   (val & PPC7D_CPLD_EQPT_PRES_3_PMC1_V_MASK) ? "3.3v" : "5v",
+		   (val & PPC7D_CPLD_EQPT_PRES_3_PMC2_V_MASK) ? "3.3v" : "5v");
+	seq_printf(m, "PMC power source: %s\n",
+		   (val & PPC7D_CPLD_EQPT_PRES_3_PMC_POWER_MASK) ? "VME" :
+		   "internal");
+
+	val = inb(PPC7D_CPLD_EQUIPMENT_PRESENT_4);
+	val2 = inb(PPC7D_CPLD_EQUIPMENT_PRESENT_2);
+	seq_printf(m, "Fit options\t: %s%s%s%s%s%s%s\n",
+		   (val & PPC7D_CPLD_EQPT_PRES_4_LPT_MASK) ? "LPT " : "",
+		   (val & PPC7D_CPLD_EQPT_PRES_4_PS2_FITTED) ? "PS2 " : "",
+		   (val & PPC7D_CPLD_EQPT_PRES_4_USB2_FITTED) ? "USB2 " : "",
+		   (val2 & PPC7D_CPLD_EQPT_PRES_2_UNIVERSE_MASK) ? "VME " : "",
+		   (val2 & PPC7D_CPLD_EQPT_PRES_2_COM36_MASK) ? "COM3-6 " : "",
+		   (val2 & PPC7D_CPLD_EQPT_PRES_2_GIGE_MASK) ? "eth0 " : "",
+		   (val2 & PPC7D_CPLD_EQPT_PRES_2_DUALGIGE_MASK) ? "eth1 " :
+		   "");
+
+	val = inb(PPC7D_CPLD_ID_LINK);
+	val1 = val & (PPC7D_CPLD_ID_LINK_E6_MASK |
+		      PPC7D_CPLD_ID_LINK_E7_MASK |
+		      PPC7D_CPLD_ID_LINK_E12_MASK |
+		      PPC7D_CPLD_ID_LINK_E13_MASK);
+
+	val = inb(PPC7D_CPLD_FLASH_WRITE_CNTL) &
+	    (PPD7D_CPLD_FLASH_CNTL_WR_LINK_MASK |
+	     PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_MASK |
+	     PPD7D_CPLD_FLASH_CNTL_USER_LINK_MASK);
+
+	seq_printf(m, "Board links present: %s%s%s%s%s%s%s%s\n",
+		   (val1 & PPC7D_CPLD_ID_LINK_E6_MASK) ? "E6 " : "",
+		   (val1 & PPC7D_CPLD_ID_LINK_E7_MASK) ? "E7 " : "",
+		   (val & PPD7D_CPLD_FLASH_CNTL_WR_LINK_MASK) ? "E9 " : "",
+		   (val & PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_MASK) ? "E10 " : "",
+		   (val & PPD7D_CPLD_FLASH_CNTL_USER_LINK_MASK) ? "E11 " : "",
+		   (val1 & PPC7D_CPLD_ID_LINK_E12_MASK) ? "E12 " : "",
+		   (val1 & PPC7D_CPLD_ID_LINK_E13_MASK) ? "E13 " : "",
+		   ((val == 0) && (val1 == 0)) ? "NONE" : "");
+
+	val = inb(PPC7D_CPLD_WDOG_RESETSW_MASK);
+	seq_printf(m, "Front panel reset switch: %sabled\n",
+		   (val & PPC7D_CPLD_WDOG_RESETSW_MASK) ? "dis" : "en");
+
+	return 0;
+}
+
+static void __init ppc7d_calibrate_decr(void)
+{
+	ulong freq;
+
+	freq = 100000000 / 4;
+
+	pr_debug("time_init: decrementer frequency = %lu.%.6lu MHz\n",
+		 freq / 1000000, freq % 1000000);
+
+	tb_ticks_per_jiffy = freq / HZ;
+	tb_to_us = mulhwu_scale_factor(freq, 1000000);
+}
+
+/*****************************************************************************
+ * Interrupt stuff
+ *****************************************************************************/
+
+static irqreturn_t ppc7d_i8259_intr(int irq, void *dev_id, struct pt_regs *regs)
+{
+	u32 temp = mv64x60_read(&bh, MV64x60_GPP_INTR_CAUSE);
+	if (temp & (1 << 28)) {
+		i8259_irq(regs);
+		mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, temp & (~(1 << 28)));
+		return IRQ_HANDLED;
+	}
+
+	return IRQ_NONE;
+}
+
+/*
+ * Each interrupt cause is assigned an IRQ number.
+ * Southbridge has 16*2 (two 8259's) interrupts.
+ * Discovery-II has 96 interrupts (cause-hi, cause-lo, gpp x 32).
+ * If multiple interrupts are pending, get_irq() returns the
+ * lowest pending irq number first.
+ *
+ *
+ * IRQ #   Source                              Trig   Active
+ * =============================================================
+ *
+ * Southbridge
+ * -----------
+ * IRQ #   Source                              Trig
+ * =============================================================
+ * 0       ISA High Resolution Counter         Edge
+ * 1       Keyboard                            Edge
+ * 2       Cascade From (IRQ 8-15)             Edge
+ * 3       Com 2 (Uart 2)                      Edge
+ * 4       Com 1 (Uart 1)                      Edge
+ * 5       PCI Int D/AFIX IRQZ ID4 (2,7)       Level
+ * 6       GPIO                                Level
+ * 7       LPT                                 Edge
+ * 8       RTC Alarm                           Edge
+ * 9       PCI Int A/PMC 2/AFIX IRQW ID1 (2,0) Level
+ * 10      PCI Int B/PMC 1/AFIX IRQX ID2 (2,1) Level
+ * 11      USB2                                Level
+ * 12      Mouse                               Edge
+ * 13      Reserved internally by Ali M1535+
+ * 14      PCI Int C/VME/AFIX IRQY ID3 (2,6)   Level
+ * 15      COM 5/6                             Level
+ *
+ * 16..112 Discovery-II...
+ *
+ * MPP28   Southbridge                         Edge   High
+ *
+ *
+ * Interrupts are cascaded through to the Discovery-II.
+ *
+ *  PCI ---
+ *         \
+ * CPLD --> ALI1535 -------> DISCOVERY-II
+ *        INTF           MPP28
+ */
+static void __init ppc7d_init_irq(void)
+{
+	int irq;
+
+	pr_debug("%s\n", __FUNCTION__);
+	i8259_init(0);
+	mv64360_init_irq();
+
+	/* IRQ 0..15 are handled by the cascaded 8259's of the Ali1535 */
+	for (irq = 0; irq < 16; irq++) {
+		irq_desc[irq].handler = &i8259_pic;
+	}
+	/* IRQs 5,6,9,10,11,14,15 are level sensitive */
+	irq_desc[5].status |= IRQ_LEVEL;
+	irq_desc[6].status |= IRQ_LEVEL;
+	irq_desc[9].status |= IRQ_LEVEL;
+	irq_desc[10].status |= IRQ_LEVEL;
+	irq_desc[11].status |= IRQ_LEVEL;
+	irq_desc[14].status |= IRQ_LEVEL;
+	irq_desc[15].status |= IRQ_LEVEL;
+
+	/* GPP28 is edge triggered */
+	irq_desc[mv64360_irq_base + MV64x60_IRQ_GPP28].status &= ~IRQ_LEVEL;
+}
+
+static u32 ppc7d_irq_canonicalize(u32 irq)
+{
+	if ((irq >= 16) && (irq < (16 + 96)))
+		irq -= 16;
+
+	return irq;
+}
+
+static int ppc7d_get_irq(struct pt_regs *regs)
+{
+	int irq;
+
+	irq = mv64360_get_irq(regs);
+	if (irq == (mv64360_irq_base + MV64x60_IRQ_GPP28))
+		irq = i8259_irq(regs);
+	return irq;
+}
+
+/*
+ * 9       PCI Int A/PMC 2/AFIX IRQW ID1 (2,0) Level
+ * 10      PCI Int B/PMC 1/AFIX IRQX ID2 (2,1) Level
+ * 14      PCI Int C/VME/AFIX IRQY ID3 (2,6)   Level
+ * 5       PCI Int D/AFIX IRQZ ID4 (2,7)       Level
+ */
+static int __init ppc7d_map_irq(struct pci_dev *dev, unsigned char idsel,
+				unsigned char pin)
+{
+	static const char pci_irq_table[][4] =
+	    /*
+	     *      PCI IDSEL/INTPIN->INTLINE
+	     *         A   B   C   D
+	     */
+	{
+		{10, 14, 5, 9},	/* IDSEL 10 - PMC2 / AFIX IRQW */
+		{9, 10, 14, 5},	/* IDSEL 11 - PMC1 / AFIX IRQX */
+		{5, 9, 10, 14},	/* IDSEL 12 - AFIX IRQY */
+		{14, 5, 9, 10},	/* IDSEL 13 - AFIX IRQZ */
+	};
+	const long min_idsel = 10, max_idsel = 14, irqs_per_slot = 4;
+
+	pr_debug("%s: %04x/%04x/%x: idsel=%hx pin=%hu\n", __FUNCTION__,
+		 dev->vendor, dev->device, PCI_FUNC(dev->devfn), idsel, pin);
+
+	return PCI_IRQ_TABLE_LOOKUP;
+}
+
+void __init ppc7d_intr_setup(void)
+{
+	u32 data;
+
+	/*
+	 * Define GPP 28 interrupt polarity as active high
+	 * input signal and level triggered
+	 */
+	data = mv64x60_read(&bh, MV64x60_GPP_LEVEL_CNTL);
+	data &= ~(1 << 28);
+	mv64x60_write(&bh, MV64x60_GPP_LEVEL_CNTL, data);
+	data = mv64x60_read(&bh, MV64x60_GPP_IO_CNTL);
+	data &= ~(1 << 28);
+	mv64x60_write(&bh, MV64x60_GPP_IO_CNTL, data);
+
+	/* Config GPP intr ctlr to respond to level trigger */
+	data = mv64x60_read(&bh, MV64x60_COMM_ARBITER_CNTL);
+	data |= (1 << 10);
+	mv64x60_write(&bh, MV64x60_COMM_ARBITER_CNTL, data);
+
+	/* XXXX Erranum FEr PCI-#8 */
+	data = mv64x60_read(&bh, MV64x60_PCI0_CMD);
+	data &= ~((1 << 5) | (1 << 9));
+	mv64x60_write(&bh, MV64x60_PCI0_CMD, data);
+	data = mv64x60_read(&bh, MV64x60_PCI1_CMD);
+	data &= ~((1 << 5) | (1 << 9));
+	mv64x60_write(&bh, MV64x60_PCI1_CMD, data);
+
+	/*
+	 * Dismiss and then enable interrupt on GPP interrupt cause
+	 * for CPU #0
+	 */
+	mv64x60_write(&bh, MV64x60_GPP_INTR_CAUSE, ~(1 << 28));
+	data = mv64x60_read(&bh, MV64x60_GPP_INTR_MASK);
+	data |= (1 << 28);
+	mv64x60_write(&bh, MV64x60_GPP_INTR_MASK, data);
+
+	/*
+	 * Dismiss and then enable interrupt on CPU #0 high cause reg
+	 * BIT27 summarizes GPP interrupts 23-31
+	 */
+	mv64x60_write(&bh, MV64360_IC_MAIN_CAUSE_HI, ~(1 << 27));
+	data = mv64x60_read(&bh, MV64360_IC_CPU0_INTR_MASK_HI);
+	data |= (1 << 27);
+	mv64x60_write(&bh, MV64360_IC_CPU0_INTR_MASK_HI, data);
+}
+
+/*****************************************************************************
+ * Platform device data fixup routines.
+ *****************************************************************************/
+
+#if defined(CONFIG_SERIAL_MPSC)
+static void __init ppc7d_fixup_mpsc_pdata(struct platform_device *pdev)
+{
+	struct mpsc_pdata *pdata;
+
+	pdata = (struct mpsc_pdata *)pdev->dev.platform_data;
+
+	pdata->max_idle = 40;
+	pdata->default_baud = PPC7D_DEFAULT_BAUD;
+	pdata->brg_clk_src = PPC7D_MPSC_CLK_SRC;
+	pdata->brg_clk_freq = PPC7D_MPSC_CLK_FREQ;
+
+	return;
+}
+#endif
+
+#if defined(CONFIG_MV643XX_ETH)
+static void __init ppc7d_fixup_eth_pdata(struct platform_device *pdev)
+{
+	struct mv643xx_eth_platform_data *eth_pd;
+	static u16 phy_addr[] = {
+		PPC7D_ETH0_PHY_ADDR,
+		PPC7D_ETH1_PHY_ADDR,
+		PPC7D_ETH2_PHY_ADDR,
+	};
+	int i;
+
+	eth_pd = pdev->dev.platform_data;
+	eth_pd->force_phy_addr = 1;
+	eth_pd->phy_addr = phy_addr[pdev->id];
+	eth_pd->tx_queue_size = PPC7D_ETH_TX_QUEUE_SIZE;
+	eth_pd->rx_queue_size = PPC7D_ETH_RX_QUEUE_SIZE;
+
+	/* Adjust IRQ by mv64360_irq_base */
+	for (i = 0; i < pdev->num_resources; i++) {
+		struct resource *r = &pdev->resource[i];
+
+		if (r->flags & IORESOURCE_IRQ) {
+			r->start += mv64360_irq_base;
+			r->end += mv64360_irq_base;
+			pr_debug("%s, uses IRQ %d\n", pdev->name,
+				 (int)r->start);
+		}
+	}
+
+}
+#endif
+
+static int __init ppc7d_platform_notify(struct device *dev)
+{
+	static struct {
+		char *bus_id;
+		void ((*rtn) (struct platform_device * pdev));
+	} dev_map[] = {
+#if defined(CONFIG_SERIAL_MPSC)
+		{ MPSC_CTLR_NAME "0", ppc7d_fixup_mpsc_pdata },
+		{ MPSC_CTLR_NAME "1", ppc7d_fixup_mpsc_pdata },
+#endif
+#if defined(CONFIG_MV643XX_ETH)
+		{ MV643XX_ETH_NAME "0", ppc7d_fixup_eth_pdata },
+		{ MV643XX_ETH_NAME "1", ppc7d_fixup_eth_pdata },
+		{ MV643XX_ETH_NAME "2", ppc7d_fixup_eth_pdata },
+#endif
+	};
+	struct platform_device *pdev;
+	int i;
+
+	if (dev && dev->bus_id)
+		for (i = 0; i < ARRAY_SIZE(dev_map); i++)
+			if (!strncmp(dev->bus_id, dev_map[i].bus_id,
+				     BUS_ID_SIZE)) {
+
+				pdev = container_of(dev,
+						    struct platform_device,
+						    dev);
+				dev_map[i].rtn(pdev);
+			}
+
+	return 0;
+}
+
+/*****************************************************************************
+ * PCI device fixups.
+ * These aren't really fixups per se. They are used to init devices as they
+ * are found during PCI scan.
+ *
+ * The PPC7D has an HB8 PCI-X bridge which must be set up during a PCI
+ * scan in order to find other devices on its secondary side.
+ *****************************************************************************/
+
+static void __init ppc7d_fixup_hb8(struct pci_dev *dev)
+{
+	u16 val16;
+
+	if (dev->bus->number == 0) {
+		pr_debug("PCI: HB8 init\n");
+
+		pci_write_config_byte(dev, 0x1c,
+				      ((PPC7D_PCI0_IO_START_PCI_ADDR & 0xf000)
+				       >> 8) | 0x01);
+		pci_write_config_byte(dev, 0x1d,
+				      (((PPC7D_PCI0_IO_START_PCI_ADDR +
+					 PPC7D_PCI0_IO_SIZE -
+					 1) & 0xf000) >> 8) | 0x01);
+		pci_write_config_word(dev, 0x30,
+				      PPC7D_PCI0_IO_START_PCI_ADDR >> 16);
+		pci_write_config_word(dev, 0x32,
+				      ((PPC7D_PCI0_IO_START_PCI_ADDR +
+					PPC7D_PCI0_IO_SIZE -
+					1) >> 16) & 0xffff);
+
+		pci_write_config_word(dev, 0x20,
+				      PPC7D_PCI0_MEM0_START_PCI_LO_ADDR >> 16);
+		pci_write_config_word(dev, 0x22,
+				      ((PPC7D_PCI0_MEM0_START_PCI_LO_ADDR +
+					PPC7D_PCI0_MEM0_SIZE -
+					1) >> 16) & 0xffff);
+		pci_write_config_word(dev, 0x24, 0);
+		pci_write_config_word(dev, 0x26, 0);
+		pci_write_config_dword(dev, 0x28, 0);
+		pci_write_config_dword(dev, 0x2c, 0);
+
+		pci_read_config_word(dev, 0x3e, &val16);
+		val16 |= ((1 << 5) | (1 << 1));	/* signal master aborts and
+						 * SERR to primary
+						 */
+		val16 &= ~(1 << 2);		/* ISA disable, so all ISA
+						 * ports forwarded to secondary
+						 */
+		pci_write_config_word(dev, 0x3e, val16);
+	}
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0028, ppc7d_fixup_hb8);
+
+/* This should perhaps be a separate driver as we're actually initializing
+ * the chip for this board here. It's hardly a fixup...
+ */
+static void __init ppc7d_fixup_ali1535(struct pci_dev *dev)
+{
+	pr_debug("PCI: ALI1535 init\n");
+
+	if (dev->bus->number == 1) {
+		/* Configure the ISA Port Settings */
+		pci_write_config_byte(dev, 0x43, 0x00);
+
+		/* Disable PCI Interrupt polling mode */
+		pci_write_config_byte(dev, 0x45, 0x00);
+
+		/* Multifunction pin select INTFJ -> INTF */
+		pci_write_config_byte(dev, 0x78, 0x00);
+
+		/* Set PCI INT -> IRQ Routing control in for external
+		 * pins south bridge.
+		 */
+		pci_write_config_byte(dev, 0x48, 0x31);	/* [7-4] INT B -> IRQ10
+							 * [3-0] INT A -> IRQ9
+							 */
+		pci_write_config_byte(dev, 0x49, 0x5D);	/* [7-4] INT D -> IRQ5
+							 * [3-0] INT C -> IRQ14
+							 */
+
+		/* PPC7D setup */
+		/* NEC USB device on IRQ 11 (INTE) - INTF disabled */
+		pci_write_config_byte(dev, 0x4A, 0x09);
+
+		/* GPIO on IRQ 6 */
+		pci_write_config_byte(dev, 0x76, 0x07);
+
+		/* SIRQ I (COMS 5/6) use IRQ line 15.
+		 * Positive (not subtractive) address decode.
+		 */
+		pci_write_config_byte(dev, 0x44, 0x0f);
+
+		/* SIRQ II disabled */
+		pci_write_config_byte(dev, 0x75, 0x0);
+
+		/* On board USB and RTC disabled */
+		pci_write_config_word(dev, 0x52, (1 << 14));
+		pci_write_config_byte(dev, 0x74, 0x00);
+
+		/* On board IDE disabled */
+		pci_write_config_byte(dev, 0x58, 0x00);
+
+		/* Decode 32-bit addresses */
+		pci_write_config_byte(dev, 0x5b, 0);
+
+		/* Disable docking IO */
+		pci_write_config_word(dev, 0x5c, 0x0000);
+
+		/* Disable modem, enable sound */
+		pci_write_config_byte(dev, 0x77, (1 << 6));
+
+		/* Disable hot-docking mode */
+		pci_write_config_byte(dev, 0x7d, 0x00);
+	}
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1533, ppc7d_fixup_ali1535);
+
+static int ppc7d_pci_exclude_device(u8 bus, u8 devfn)
+{
+	/* Early versions of this board were fitted with IBM ALMA
+	 * PCI-VME bridge chips. The PCI config space of these devices
+	 * was not set up correctly and causes PCI scan problems.
+	 */
+	if ((bus == 1) && (PCI_SLOT(devfn) == 4) && ppc7d_has_alma)
+		return PCIBIOS_DEVICE_NOT_FOUND;
+
+	return mv64x60_pci_exclude_device(bus, devfn);
+}
+
+/* This hook is called when each PCI bus is probed.
+ */
+static void ppc7d_pci_fixup_bus(struct pci_bus *bus)
+{
+	pr_debug("PCI BUS %hu: %lx/%lx %lx/%lx %lx/%lx %lx/%lx\n",
+		 bus->number,
+		 bus->resource[0] ? bus->resource[0]->start : 0,
+		 bus->resource[0] ? bus->resource[0]->end : 0,
+		 bus->resource[1] ? bus->resource[1]->start : 0,
+		 bus->resource[1] ? bus->resource[1]->end : 0,
+		 bus->resource[2] ? bus->resource[2]->start : 0,
+		 bus->resource[2] ? bus->resource[2]->end : 0,
+		 bus->resource[3] ? bus->resource[3]->start : 0,
+		 bus->resource[3] ? bus->resource[3]->end : 0);
+
+	if ((bus->number == 1) && (bus->resource[2] != NULL)) {
+		/* Hide PCI window 2 of Bus 1 which is used only to
+		 * map legacy ISA memory space.
+		 */
+		bus->resource[2]->start = 0;
+		bus->resource[2]->end = 0;
+		bus->resource[2]->flags = 0;
+	}
+}
+
+/*****************************************************************************
+ * Board device setup code
+ *****************************************************************************/
+
+void __init ppc7d_setup_peripherals(void)
+{
+	u32 val32;
+
+	/* Set up windows for boot CS */
+	mv64x60_set_32bit_window(&bh, MV64x60_CPU2BOOT_WIN,
+				 PPC7D_BOOT_WINDOW_BASE, PPC7D_BOOT_WINDOW_SIZE,
+				 0);
+	bh.ci->enable_window_32bit(&bh, MV64x60_CPU2BOOT_WIN);
+
+	/* Boot firmware configures the following DevCS addresses.
+	 * DevCS0 - board control/status
+	 * DevCS1 - test registers
+	 * DevCS2 - AFIX port/address registers (for identifying)
+	 * DevCS3 - FLASH
+	 *
+	 * We don't use DevCS0, DevCS1.
+	 */
+	val32 = mv64x60_read(&bh, MV64360_CPU_BAR_ENABLE);
+	val32 |= ((1 << 4) | (1 << 5));
+	mv64x60_write(&bh, MV64360_CPU_BAR_ENABLE, val32);
+	mv64x60_write(&bh, MV64x60_CPU2DEV_0_BASE, 0);
+	mv64x60_write(&bh, MV64x60_CPU2DEV_0_SIZE, 0);
+	mv64x60_write(&bh, MV64x60_CPU2DEV_1_BASE, 0);
+	mv64x60_write(&bh, MV64x60_CPU2DEV_1_SIZE, 0);
+
+	mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_2_WIN,
+				 PPC7D_AFIX_REG_BASE, PPC7D_AFIX_REG_SIZE, 0);
+	bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_2_WIN);
+
+	mv64x60_set_32bit_window(&bh, MV64x60_CPU2DEV_3_WIN,
+				 PPC7D_FLASH_BASE, PPC7D_FLASH_SIZE_ACTUAL, 0);
+	bh.ci->enable_window_32bit(&bh, MV64x60_CPU2DEV_3_WIN);
+
+	mv64x60_set_32bit_window(&bh, MV64x60_CPU2SRAM_WIN,
+				 PPC7D_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE,
+				 0);
+	bh.ci->enable_window_32bit(&bh, MV64x60_CPU2SRAM_WIN);
+
+	/* Set up Enet->SRAM window */
+	mv64x60_set_32bit_window(&bh, MV64x60_ENET2MEM_4_WIN,
+				 PPC7D_INTERNAL_SRAM_BASE, MV64360_SRAM_SIZE,
+				 0x2);
+	bh.ci->enable_window_32bit(&bh, MV64x60_ENET2MEM_4_WIN);
+
+	/* Give enet r/w access to memory region */
+	val32 = mv64x60_read(&bh, MV64360_ENET2MEM_ACC_PROT_0);
+	val32 |= (0x3 << (4 << 1));
+	mv64x60_write(&bh, MV64360_ENET2MEM_ACC_PROT_0, val32);
+	val32 = mv64x60_read(&bh, MV64360_ENET2MEM_ACC_PROT_1);
+	val32 |= (0x3 << (4 << 1));
+	mv64x60_write(&bh, MV64360_ENET2MEM_ACC_PROT_1, val32);
+	val32 = mv64x60_read(&bh, MV64360_ENET2MEM_ACC_PROT_2);
+	val32 |= (0x3 << (4 << 1));
+	mv64x60_write(&bh, MV64360_ENET2MEM_ACC_PROT_2, val32);
+
+	val32 = mv64x60_read(&bh, MV64x60_TIMR_CNTR_0_3_CNTL);
+	val32 &= ~((1 << 0) | (1 << 8) | (1 << 16) | (1 << 24));
+	mv64x60_write(&bh, MV64x60_TIMR_CNTR_0_3_CNTL, val32);
+
+	/* Enumerate pci bus.
+	 *
+	 * We scan PCI#0 first (the bus with the HB8 and other
+	 * on-board peripherals). We must configure the 64360 before
+	 * each scan, according to the bus number assignments.  Busses
+	 * are assigned incrementally, starting at 0.  PCI#0 is
+	 * usually assigned bus#0, the secondary side of the HB8 gets
+	 * bus#1 and PCI#1 (second PMC site) gets bus#2.  However, if
+	 * any PMC card has a PCI bridge, these bus assignments will
+	 * change.
+	 */
+
+	/* Turn off PCI retries */
+	val32 = mv64x60_read(&bh, MV64x60_CPU_CONFIG);
+	val32 |= (1 << 17);
+	mv64x60_write(&bh, MV64x60_CPU_CONFIG, val32);
+
+	/* Scan PCI#0 */
+	mv64x60_set_bus(&bh, 0, 0);
+	bh.hose_a->first_busno = 0;
+	bh.hose_a->last_busno = 0xff;
+	bh.hose_a->last_busno = pciauto_bus_scan(bh.hose_a, 0);
+	printk(KERN_INFO "PCI#0: first=%d last=%d\n",
+	       bh.hose_a->first_busno, bh.hose_a->last_busno);
+
+	/* Scan PCI#1 */
+	bh.hose_b->first_busno = bh.hose_a->last_busno + 1;
+	mv64x60_set_bus(&bh, 1, bh.hose_b->first_busno);
+	bh.hose_b->last_busno = 0xff;
+	bh.hose_b->last_busno = pciauto_bus_scan(bh.hose_b,
+		bh.hose_b->first_busno);
+	printk(KERN_INFO "PCI#1: first=%d last=%d\n",
+	       bh.hose_b->first_busno, bh.hose_b->last_busno);
+
+	/* Turn on PCI retries */
+	val32 = mv64x60_read(&bh, MV64x60_CPU_CONFIG);
+	val32 &= ~(1 << 17);
+	mv64x60_write(&bh, MV64x60_CPU_CONFIG, val32);
+
+	/* Setup interrupts */
+	ppc7d_intr_setup();
+}
+
+static void __init ppc7d_setup_bridge(void)
+{
+	struct mv64x60_setup_info si;
+	int i;
+	u32 temp;
+
+	mv64360_irq_base = 16;	/* first 16 intrs are 2 x 8259's */
+
+	memset(&si, 0, sizeof(si));
+
+	si.phys_reg_base = CONFIG_MV64X60_NEW_BASE;
+
+	si.pci_0.enable_bus = 1;
+	si.pci_0.pci_io.cpu_base = PPC7D_PCI0_IO_START_PROC_ADDR;
+	si.pci_0.pci_io.pci_base_hi = 0;
+	si.pci_0.pci_io.pci_base_lo = PPC7D_PCI0_IO_START_PCI_ADDR;
+	si.pci_0.pci_io.size = PPC7D_PCI0_IO_SIZE;
+	si.pci_0.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE;
+	si.pci_0.pci_mem[0].cpu_base = PPC7D_PCI0_MEM0_START_PROC_ADDR;
+	si.pci_0.pci_mem[0].pci_base_hi = PPC7D_PCI0_MEM0_START_PCI_HI_ADDR;
+	si.pci_0.pci_mem[0].pci_base_lo = PPC7D_PCI0_MEM0_START_PCI_LO_ADDR;
+	si.pci_0.pci_mem[0].size = PPC7D_PCI0_MEM0_SIZE;
+	si.pci_0.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE;
+	si.pci_0.pci_mem[1].cpu_base = PPC7D_PCI0_MEM1_START_PROC_ADDR;
+	si.pci_0.pci_mem[1].pci_base_hi = PPC7D_PCI0_MEM1_START_PCI_HI_ADDR;
+	si.pci_0.pci_mem[1].pci_base_lo = PPC7D_PCI0_MEM1_START_PCI_LO_ADDR;
+	si.pci_0.pci_mem[1].size = PPC7D_PCI0_MEM1_SIZE;
+	si.pci_0.pci_mem[1].swap = MV64x60_CPU2PCI_SWAP_NONE;
+	si.pci_0.pci_cmd_bits = 0;
+	si.pci_0.latency_timer = 0x80;
+
+	si.pci_1.enable_bus = 1;
+	si.pci_1.pci_io.cpu_base = PPC7D_PCI1_IO_START_PROC_ADDR;
+	si.pci_1.pci_io.pci_base_hi = 0;
+	si.pci_1.pci_io.pci_base_lo = PPC7D_PCI1_IO_START_PCI_ADDR;
+	si.pci_1.pci_io.size = PPC7D_PCI1_IO_SIZE;
+	si.pci_1.pci_io.swap = MV64x60_CPU2PCI_SWAP_NONE;
+	si.pci_1.pci_mem[0].cpu_base = PPC7D_PCI1_MEM0_START_PROC_ADDR;
+	si.pci_1.pci_mem[0].pci_base_hi = PPC7D_PCI1_MEM0_START_PCI_HI_ADDR;
+	si.pci_1.pci_mem[0].pci_base_lo = PPC7D_PCI1_MEM0_START_PCI_LO_ADDR;
+	si.pci_1.pci_mem[0].size = PPC7D_PCI1_MEM0_SIZE;
+	si.pci_1.pci_mem[0].swap = MV64x60_CPU2PCI_SWAP_NONE;
+	si.pci_1.pci_mem[1].cpu_base = PPC7D_PCI1_MEM1_START_PROC_ADDR;
+	si.pci_1.pci_mem[1].pci_base_hi = PPC7D_PCI1_MEM1_START_PCI_HI_ADDR;
+	si.pci_1.pci_mem[1].pci_base_lo = PPC7D_PCI1_MEM1_START_PCI_LO_ADDR;
+	si.pci_1.pci_mem[1].size = PPC7D_PCI1_MEM1_SIZE;
+	si.pci_1.pci_mem[1].swap = MV64x60_CPU2PCI_SWAP_NONE;
+	si.pci_1.pci_cmd_bits = 0;
+	si.pci_1.latency_timer = 0x80;
+
+	/* Don't clear the SRAM window since we use it for debug */
+	si.window_preserve_mask_32_lo = (1 << MV64x60_CPU2SRAM_WIN);
+
+	printk(KERN_INFO "PCI: MV64360 PCI#0 IO at %x, size %x\n",
+	       si.pci_0.pci_io.cpu_base, si.pci_0.pci_io.size);
+	printk(KERN_INFO "PCI: MV64360 PCI#1 IO at %x, size %x\n",
+	       si.pci_1.pci_io.cpu_base, si.pci_1.pci_io.size);
+
+	for (i = 0; i < MV64x60_CPU2MEM_WINDOWS; i++) {
+#if defined(CONFIG_NOT_COHERENT_CACHE)
+		si.cpu_prot_options[i] = 0;
+		si.enet_options[i] = MV64360_ENET2MEM_SNOOP_NONE;
+		si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_NONE;
+		si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_NONE;
+
+		si.pci_0.acc_cntl_options[i] =
+		    MV64360_PCI_ACC_CNTL_SNOOP_NONE |
+		    MV64360_PCI_ACC_CNTL_SWAP_NONE |
+		    MV64360_PCI_ACC_CNTL_MBURST_128_BYTES |
+		    MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES;
+
+		si.pci_1.acc_cntl_options[i] =
+		    MV64360_PCI_ACC_CNTL_SNOOP_NONE |
+		    MV64360_PCI_ACC_CNTL_SWAP_NONE |
+		    MV64360_PCI_ACC_CNTL_MBURST_128_BYTES |
+		    MV64360_PCI_ACC_CNTL_RDSIZE_256_BYTES;
+#else
+		si.cpu_prot_options[i] = 0;
+		/* All PPC7D hardware uses B0 or newer MV64360 silicon which
+		 * does not have snoop bugs.
+		 */
+		si.enet_options[i] = MV64360_ENET2MEM_SNOOP_WB;
+		si.mpsc_options[i] = MV64360_MPSC2MEM_SNOOP_WB;
+		si.idma_options[i] = MV64360_IDMA2MEM_SNOOP_WB;
+
+		si.pci_0.acc_cntl_options[i] =
+		    MV64360_PCI_ACC_CNTL_SNOOP_WB |
+		    MV64360_PCI_ACC_CNTL_SWAP_NONE |
+		    MV64360_PCI_ACC_CNTL_MBURST_32_BYTES |
+		    MV64360_PCI_ACC_CNTL_RDSIZE_32_BYTES;
+
+		si.pci_1.acc_cntl_options[i] =
+		    MV64360_PCI_ACC_CNTL_SNOOP_WB |
+		    MV64360_PCI_ACC_CNTL_SWAP_NONE |
+		    MV64360_PCI_ACC_CNTL_MBURST_32_BYTES |
+		    MV64360_PCI_ACC_CNTL_RDSIZE_32_BYTES;
+#endif
+	}
+
+	/* Lookup PCI host bridges */
+	if (mv64x60_init(&bh, &si))
+		printk(KERN_ERR "MV64360 initialization failed.\n");
+
+	pr_debug("MV64360 regs @ %lx/%p\n", bh.p_base, bh.v_base);
+
+	/* Enable WB Cache coherency on SRAM */
+	temp = mv64x60_read(&bh, MV64360_SRAM_CONFIG);
+	pr_debug("SRAM_CONFIG: %x\n", temp);
+#if defined(CONFIG_NOT_COHERENT_CACHE)
+	mv64x60_write(&bh, MV64360_SRAM_CONFIG, temp & ~0x2);
+#else
+	mv64x60_write(&bh, MV64360_SRAM_CONFIG, temp | 0x2);
+#endif
+	/* If system operates with internal bus arbiter (CPU master
+	 * control bit8) clear AACK Delay bit [25] in CPU
+	 * configuration register.
+	 */
+	temp = mv64x60_read(&bh, MV64x60_CPU_MASTER_CNTL);
+	if (temp & (1 << 8)) {
+		temp = mv64x60_read(&bh, MV64x60_CPU_CONFIG);
+		mv64x60_write(&bh, MV64x60_CPU_CONFIG, (temp & ~(1 << 25)));
+	}
+
+	/* Data and address parity is enabled */
+	temp = mv64x60_read(&bh, MV64x60_CPU_CONFIG);
+	mv64x60_write(&bh, MV64x60_CPU_CONFIG,
+		      (temp | (1 << 26) | (1 << 19)));
+
+	pci_dram_offset = 0;	/* sys mem at same addr on PCI & cpu bus */
+	ppc_md.pci_swizzle = common_swizzle;
+	ppc_md.pci_map_irq = ppc7d_map_irq;
+	ppc_md.pci_exclude_device = ppc7d_pci_exclude_device;
+
+	mv64x60_set_bus(&bh, 0, 0);
+	bh.hose_a->first_busno = 0;
+	bh.hose_a->last_busno = 0xff;
+	bh.hose_a->mem_space.start = PPC7D_PCI0_MEM0_START_PCI_LO_ADDR;
+	bh.hose_a->mem_space.end =
+	    PPC7D_PCI0_MEM0_START_PCI_LO_ADDR + PPC7D_PCI0_MEM0_SIZE;
+
+	/* These will be set later, as a result of PCI0 scan */
+	bh.hose_b->first_busno = 0;
+	bh.hose_b->last_busno = 0xff;
+	bh.hose_b->mem_space.start = PPC7D_PCI1_MEM0_START_PCI_LO_ADDR;
+	bh.hose_b->mem_space.end =
+	    PPC7D_PCI1_MEM0_START_PCI_LO_ADDR + PPC7D_PCI1_MEM0_SIZE;
+
+	pr_debug("MV64360: PCI#0 IO decode %08x/%08x IO remap %08x\n",
+		 mv64x60_read(&bh, 0x48), mv64x60_read(&bh, 0x50),
+		 mv64x60_read(&bh, 0xf0));
+}
+
+static void __init ppc7d_setup_arch(void)
+{
+	int port;
+
+	loops_per_jiffy = 100000000 / HZ;
+
+#ifdef CONFIG_BLK_DEV_INITRD
+	if (initrd_start)
+		ROOT_DEV = Root_RAM0;
+	else
+#endif
+#ifdef	CONFIG_ROOT_NFS
+		ROOT_DEV = Root_NFS;
+#else
+		ROOT_DEV = Root_HDA1;
+#endif
+
+	if ((cur_cpu_spec[0]->cpu_features & CPU_FTR_SPEC7450) ||
+	    (cur_cpu_spec[0]->cpu_features & CPU_FTR_L3CR))
+		/* 745x is different.  We only want to pass along enable. */
+		_set_L2CR(L2CR_L2E);
+	else if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR)
+		/* All modules have 1MB of L2.  We also assume that an
+		 * L2 divisor of 3 will work.
+		 */
+		_set_L2CR(L2CR_L2E | L2CR_L2SIZ_1MB | L2CR_L2CLK_DIV3
+			  | L2CR_L2RAM_PIPE | L2CR_L2OH_1_0 | L2CR_L2DF);
+
+	if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L3CR)
+		/* No L3 cache */
+		_set_L3CR(0);
+
+#ifdef CONFIG_DUMMY_CONSOLE
+	conswitchp = &dummy_con;
+#endif
+
+	/* Lookup PCI host bridges */
+	if (ppc_md.progress)
+		ppc_md.progress("ppc7d_setup_arch: calling setup_bridge", 0);
+
+	ppc7d_setup_bridge();
+	ppc7d_setup_peripherals();
+
+	/* Disable ethernet. It might have been setup by the bootrom */
+	for (port = 0; port < 3; port++)
+		mv64x60_write(&bh, MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(port),
+			      0x0000ff00);
+
+	/* Clear queue pointers to ensure they are all initialized,
+	 * otherwise since queues 1-7 are unused, they have random
+	 * pointers which look strange in register dumps. Don't bother
+	 * with queue 0 since it will be initialized later.
+	 */
+	for (port = 0; port < 3; port++) {
+		mv64x60_write(&bh,
+			      MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_1(port),
+			      0x00000000);
+		mv64x60_write(&bh,
+			      MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_2(port),
+			      0x00000000);
+		mv64x60_write(&bh,
+			      MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_3(port),
+			      0x00000000);
+		mv64x60_write(&bh,
+			      MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_4(port),
+			      0x00000000);
+		mv64x60_write(&bh,
+			      MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_5(port),
+			      0x00000000);
+		mv64x60_write(&bh,
+			      MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_6(port),
+			      0x00000000);
+		mv64x60_write(&bh,
+			      MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_7(port),
+			      0x00000000);
+	}
+
+	printk(KERN_INFO "Radstone Technology PPC7D\n");
+	if (ppc_md.progress)
+		ppc_md.progress("ppc7d_setup_arch: exit", 0);
+}
+
+/* This kernel command line parameter can be used to have the target
+ * wait for a JTAG debugger to attach. Of course, a JTAG debugger
+ * with hardware breakpoint support can have the target stop at any
+ * location during init, but this is a convenience feature that makes
+ * it easier in the common case of loading the code using the ppcboot
+ * bootloader..
+ */
+static unsigned long ppc7d_wait_debugger;
+
+static int __init ppc7d_waitdbg(char *str)
+{
+	ppc7d_wait_debugger = 1;
+	return 1;
+}
+
+__setup("waitdbg", ppc7d_waitdbg);
+
+/* Second phase board init, called after other (architecture common)
+ * low-level services have been initialized.
+ */
+static void ppc7d_init2(void)
+{
+	unsigned long flags;
+	u32 data;
+	u8 data8;
+
+	pr_debug("%s: enter\n", __FUNCTION__);
+
+	/* Wait for debugger? */
+	if (ppc7d_wait_debugger) {
+		printk("Waiting for debugger...\n");
+
+		while (readl(&ppc7d_wait_debugger)) ;
+	}
+
+	/* Hook up i8259 interrupt which is connected to GPP28 */
+	request_irq(mv64360_irq_base + MV64x60_IRQ_GPP28, ppc7d_i8259_intr,
+		    SA_INTERRUPT, "I8259 (GPP28) interrupt", (void *)0);
+
+	/* Configure MPP16 as watchdog NMI, MPP17 as watchdog WDE */
+	spin_lock_irqsave(&mv64x60_lock, flags);
+	data = mv64x60_read(&bh, MV64x60_MPP_CNTL_2);
+	data &= ~(0x0000000f << 0);
+	data |= (0x00000004 << 0);
+	data &= ~(0x0000000f << 4);
+	data |= (0x00000004 << 4);
+	mv64x60_write(&bh, MV64x60_MPP_CNTL_2, data);
+	spin_unlock_irqrestore(&mv64x60_lock, flags);
+
+	/* All LEDs off */
+	data8 = inb(PPC7D_CPLD_LEDS);
+	data8 &= ~0x08;
+	data8 |= 0x07;
+	outb(data8, PPC7D_CPLD_LEDS);
+
+	pr_debug("%s: exit\n", __FUNCTION__);
+}
+
+/* Called from machine_init(), early, before any of the __init functions
+ * have run. We must init software-configurable pins before other functions
+ * such as interrupt controllers are initialised.
+ */
+void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+			  unsigned long r6, unsigned long r7)
+{
+	u8 val8;
+	u8 rev_num;
+
+	/* Map 0xe0000000-0xffffffff early because we need access to SRAM
+	 * and the ISA memory space (for serial port) here. This mapping
+	 * is redone properly in ppc7d_map_io() later.
+	 */
+	mtspr(SPRN_DBAT3U, 0xe0003fff);
+	mtspr(SPRN_DBAT3L, 0xe000002a);
+
+	/*
+	 * Zero SRAM. Note that this generates parity errors on
+	 * internal data path in SRAM if it's first time accessing it
+	 * after reset.
+	 *
+	 * We do this ASAP to avoid parity errors when reading
+	 * uninitialized SRAM.
+	 */
+	memset((void *)PPC7D_INTERNAL_SRAM_BASE, 0, MV64360_SRAM_SIZE);
+
+	pr_debug("platform_init: r3-r7: %lx %lx %lx %lx %lx\n",
+		 r3, r4, r5, r6, r7);
+
+	parse_bootinfo(find_bootinfo());
+
+	/* ASSUMPTION:  If both r3 (bd_t pointer) and r6 (cmdline pointer)
+	 * are non-zero, then we should use the board info from the bd_t
+	 * structure and the cmdline pointed to by r6 instead of the
+	 * information from birecs, if any.  Otherwise, use the information
+	 * from birecs as discovered by the preceeding call to
+	 * parse_bootinfo().  This rule should work with both PPCBoot, which
+	 * uses a bd_t board info structure, and the kernel boot wrapper,
+	 * which uses birecs.
+	 */
+	if (r3 && r6) {
+		bd_t *bp = (bd_t *) __res;
+
+		/* copy board info structure */
+		memcpy((void *)__res, (void *)(r3 + KERNELBASE), sizeof(bd_t));
+		/* copy command line */
+		*(char *)(r7 + KERNELBASE) = 0;
+		strcpy(cmd_line, (char *)(r6 + KERNELBASE));
+
+		printk(KERN_INFO "Board info data:-\n");
+		printk(KERN_INFO "  Internal freq: %lu MHz, bus freq: %lu MHz\n",
+		       bp->bi_intfreq, bp->bi_busfreq);
+		printk(KERN_INFO "  Memory: %lx, size %lx\n", bp->bi_memstart,
+		       bp->bi_memsize);
+		printk(KERN_INFO "  Console baudrate: %lu\n", bp->bi_baudrate);
+		printk(KERN_INFO "  Ethernet address: "
+		       "%02x:%02x:%02x:%02x:%02x:%02x\n",
+		       bp->bi_enetaddr[0], bp->bi_enetaddr[1],
+		       bp->bi_enetaddr[2], bp->bi_enetaddr[3],
+		       bp->bi_enetaddr[4], bp->bi_enetaddr[5]);
+	}
+#ifdef CONFIG_BLK_DEV_INITRD
+	/* take care of initrd if we have one */
+	if (r4) {
+		initrd_start = r4 + KERNELBASE;
+		initrd_end = r5 + KERNELBASE;
+		printk(KERN_INFO "INITRD @ %lx/%lx\n", initrd_start, initrd_end);
+	}
+#endif /* CONFIG_BLK_DEV_INITRD */
+
+	/* Map in board regs, etc. */
+	isa_io_base = 0xe8000000;
+	isa_mem_base = 0xe8000000;
+	pci_dram_offset = 0x00000000;
+	ISA_DMA_THRESHOLD = 0x00ffffff;
+	DMA_MODE_READ = 0x44;
+	DMA_MODE_WRITE = 0x48;
+
+	ppc_md.setup_arch = ppc7d_setup_arch;
+	ppc_md.init = ppc7d_init2;
+	ppc_md.show_cpuinfo = ppc7d_show_cpuinfo;
+	ppc_md.irq_canonicalize = ppc7d_irq_canonicalize;
+	ppc_md.init_IRQ = ppc7d_init_irq;
+	ppc_md.get_irq = ppc7d_get_irq;
+
+	ppc_md.restart = ppc7d_restart;
+	ppc_md.power_off = ppc7d_power_off;
+	ppc_md.halt = ppc7d_halt;
+
+	ppc_md.find_end_of_memory = ppc7d_find_end_of_memory;
+	ppc_md.setup_io_mappings = ppc7d_map_io;
+
+	ppc_md.time_init = NULL;
+	ppc_md.set_rtc_time = NULL;
+	ppc_md.get_rtc_time = NULL;
+	ppc_md.calibrate_decr = ppc7d_calibrate_decr;
+	ppc_md.nvram_read_val = NULL;
+	ppc_md.nvram_write_val = NULL;
+
+	ppc_md.heartbeat = ppc7d_heartbeat;
+	ppc_md.heartbeat_reset = HZ;
+	ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
+
+	ppc_md.pcibios_fixup_bus = ppc7d_pci_fixup_bus;
+
+#if defined(CONFIG_SERIAL_MPSC) || defined(CONFIG_MV643XX_ETH)
+	platform_notify = ppc7d_platform_notify;
+#endif
+
+#ifdef CONFIG_SERIAL_MPSC
+	/* On PPC7D, we must configure MPSC support via CPLD control
+	 * registers.
+	 */
+	outb(PPC7D_CPLD_RTS_COM4_SCLK |
+	     PPC7D_CPLD_RTS_COM56_ENABLED, PPC7D_CPLD_RTS);
+	outb(PPC7D_CPLD_COMS_COM3_TCLKEN |
+	     PPC7D_CPLD_COMS_COM3_TXEN |
+	     PPC7D_CPLD_COMS_COM4_TCLKEN |
+	     PPC7D_CPLD_COMS_COM4_TXEN, PPC7D_CPLD_COMS);
+#endif /* CONFIG_SERIAL_MPSC */
+
+#if defined(CONFIG_KGDB) || defined(CONFIG_SERIAL_TEXT_DEBUG)
+	ppc7d_early_serial_map();
+#ifdef  CONFIG_SERIAL_TEXT_DEBUG
+#if defined(CONFIG_SERIAL_MPSC_CONSOLE)
+	ppc_md.progress = mv64x60_mpsc_progress;
+#elif defined(CONFIG_SERIAL_8250)
+	ppc_md.progress = gen550_progress;
+#else
+#error CONFIG_KGDB || CONFIG_SERIAL_TEXT_DEBUG has no supported CONFIG_SERIAL_XXX
+#endif /* CONFIG_SERIAL_8250 */
+#endif /* CONFIG_SERIAL_TEXT_DEBUG */
+#endif /* CONFIG_KGDB || CONFIG_SERIAL_TEXT_DEBUG */
+
+	/* Enable write access to user flash.  This is necessary for
+	 * flash probe.
+	 */
+	val8 = readb((void *)isa_io_base + PPC7D_CPLD_SW_FLASH_WRITE_PROTECT);
+	writeb(val8 | (PPC7D_CPLD_SW_FLASH_WRPROT_ENABLED &
+		       PPC7D_CPLD_SW_FLASH_WRPROT_USER_MASK),
+	       (void *)isa_io_base + PPC7D_CPLD_SW_FLASH_WRITE_PROTECT);
+
+	/* Determine if this board has IBM ALMA VME devices */
+	val8 = readb((void *)isa_io_base + PPC7D_CPLD_BOARD_REVISION);
+	rev_num = (val8 & PPC7D_CPLD_BOARD_REVISION_NUMBER_MASK) >> 5;
+	if (rev_num <= 1)
+		ppc7d_has_alma = 1;
+}
diff -Nru a/arch/ppc/platforms/radstone_ppc7d.h b/arch/ppc/platforms/radstone_ppc7d.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/platforms/radstone_ppc7d.h	2005-03-07 20:41:25 -08:00
@@ -0,0 +1,434 @@
+/*
+ * arch/ppc/platforms/radstone_ppc7d.h
+ *
+ * Board definitions for the Radstone PPC7D boards.
+ *
+ * Author: James Chapman <jchapman@katalix.com>
+ *
+ * Based on code done by Rabeeh Khoury - rabeeh@galileo.co.il
+ * Based on code done by - Mark A. Greer <mgreer@mvista.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+/*
+ * The MV64360 has 2 PCI buses each with 1 window from the CPU bus to
+ * PCI I/O space and 4 windows from the CPU bus to PCI MEM space.
+ * We'll only use one PCI MEM window on each PCI bus.
+ *
+ * This is the CPU physical memory map (windows must be at least 1MB
+ * and start on a boundary that is a multiple of the window size):
+ *
+ *    0xff800000-0xffffffff      - Boot window
+ *    0xff000000-0xff000fff	 - AFIX registers (DevCS2)
+ *    0xfef00000-0xfef0ffff      - Internal MV64x60 registers
+ *    0xfef40000-0xfef7ffff      - Internal SRAM
+ *    0xfef00000-0xfef0ffff      - MV64360 Registers
+ *    0x70000000-0x7fffffff      - soldered flash (DevCS3)
+ *    0xe8000000-0xe9ffffff      - PCI I/O
+ *    0x80000000-0xbfffffff      - PCI MEM
+ */
+
+#ifndef __PPC_PLATFORMS_PPC7D_H
+#define __PPC_PLATFORMS_PPC7D_H
+
+#include <asm/ppcboot.h>
+
+/*****************************************************************************
+ * CPU Physical Memory Map setup.
+ *****************************************************************************/
+
+#define PPC7D_BOOT_WINDOW_BASE			0xff800000
+#define PPC7D_AFIX_REG_BASE			0xff000000
+#define PPC7D_INTERNAL_SRAM_BASE		0xfef40000
+#define PPC7D_FLASH_BASE			0x70000000
+
+#define PPC7D_BOOT_WINDOW_SIZE_ACTUAL		0x00800000 /* 8MB */
+#define PPC7D_FLASH_SIZE_ACTUAL			0x10000000 /* 256MB */
+
+#define PPC7D_BOOT_WINDOW_SIZE		max(MV64360_WINDOW_SIZE_MIN,	\
+		PPC7D_BOOT_WINDOW_SIZE_ACTUAL)
+#define PPC7D_FLASH_SIZE		max(MV64360_WINDOW_SIZE_MIN,	\
+		PPC7D_FLASH_SIZE_ACTUAL)
+#define PPC7D_AFIX_REG_SIZE		max(MV64360_WINDOW_SIZE_MIN, 0xff)
+
+
+#define PPC7D_PCI0_MEM0_START_PROC_ADDR        0x80000000UL
+#define PPC7D_PCI0_MEM0_START_PCI_HI_ADDR      0x00000000UL
+#define PPC7D_PCI0_MEM0_START_PCI_LO_ADDR      0x80000000UL
+#define PPC7D_PCI0_MEM0_SIZE                   0x20000000UL
+#define PPC7D_PCI0_MEM1_START_PROC_ADDR        0xe8010000UL
+#define PPC7D_PCI0_MEM1_START_PCI_HI_ADDR      0x00000000UL
+#define PPC7D_PCI0_MEM1_START_PCI_LO_ADDR      0x00000000UL
+#define PPC7D_PCI0_MEM1_SIZE                   0x000f0000UL
+#define PPC7D_PCI0_IO_START_PROC_ADDR          0xe8000000UL
+#define PPC7D_PCI0_IO_START_PCI_ADDR           0x00000000UL
+#define PPC7D_PCI0_IO_SIZE                     0x00010000UL
+
+#define PPC7D_PCI1_MEM0_START_PROC_ADDR        0xa0000000UL
+#define PPC7D_PCI1_MEM0_START_PCI_HI_ADDR      0x00000000UL
+#define PPC7D_PCI1_MEM0_START_PCI_LO_ADDR      0xa0000000UL
+#define PPC7D_PCI1_MEM0_SIZE                   0x20000000UL
+#define PPC7D_PCI1_MEM1_START_PROC_ADDR        0xe9800000UL
+#define PPC7D_PCI1_MEM1_START_PCI_HI_ADDR      0x00000000UL
+#define PPC7D_PCI1_MEM1_START_PCI_LO_ADDR      0x00000000UL
+#define PPC7D_PCI1_MEM1_SIZE                   0x00800000UL
+#define PPC7D_PCI1_IO_START_PROC_ADDR          0xe9000000UL
+#define PPC7D_PCI1_IO_START_PCI_ADDR           0x00000000UL
+#define PPC7D_PCI1_IO_SIZE                     0x00010000UL
+
+#define	PPC7D_DEFAULT_BAUD			9600
+#define	PPC7D_MPSC_CLK_SRC			8	  /* TCLK */
+#define	PPC7D_MPSC_CLK_FREQ			133333333 /* 133.3333... MHz */
+
+#define	PPC7D_ETH0_PHY_ADDR			8
+#define	PPC7D_ETH1_PHY_ADDR			9
+#define	PPC7D_ETH2_PHY_ADDR			0
+
+#define PPC7D_ETH_TX_QUEUE_SIZE			400
+#define PPC7D_ETH_RX_QUEUE_SIZE			400
+
+#define	PPC7D_ETH_PORT_CONFIG_VALUE			\
+	MV64340_ETH_UNICAST_NORMAL_MODE			|	\
+	MV64340_ETH_DEFAULT_RX_QUEUE_0			|	\
+	MV64340_ETH_DEFAULT_RX_ARP_QUEUE_0		|	\
+	MV64340_ETH_RECEIVE_BC_IF_NOT_IP_OR_ARP		|	\
+	MV64340_ETH_RECEIVE_BC_IF_IP			|	\
+	MV64340_ETH_RECEIVE_BC_IF_ARP			|	\
+	MV64340_ETH_CAPTURE_TCP_FRAMES_DIS		|	\
+	MV64340_ETH_CAPTURE_UDP_FRAMES_DIS		|	\
+	MV64340_ETH_DEFAULT_RX_TCP_QUEUE_0		|	\
+	MV64340_ETH_DEFAULT_RX_UDP_QUEUE_0		|	\
+	MV64340_ETH_DEFAULT_RX_BPDU_QUEUE_0
+
+#define	PPC7D_ETH_PORT_CONFIG_EXTEND_VALUE		\
+	MV64340_ETH_SPAN_BPDU_PACKETS_AS_NORMAL		|	\
+	MV64340_ETH_PARTITION_DISABLE
+
+#define	GT_ETH_IPG_INT_RX(value)			\
+	((value & 0x3fff) << 8)
+
+#define	PPC7D_ETH_PORT_SDMA_CONFIG_VALUE		\
+	MV64340_ETH_RX_BURST_SIZE_4_64BIT		|	\
+	GT_ETH_IPG_INT_RX(0)			|	\
+	MV64340_ETH_TX_BURST_SIZE_4_64BIT
+
+#define	PPC7D_ETH_PORT_SERIAL_CONTROL_VALUE		\
+	MV64340_ETH_ENABLE_AUTO_NEG_FOR_DUPLX		|	\
+	MV64340_ETH_DISABLE_AUTO_NEG_FOR_FLOW_CTRL	|	\
+	MV64340_ETH_ADV_SYMMETRIC_FLOW_CTRL		|	\
+	MV64340_ETH_FORCE_FC_MODE_NO_PAUSE_DIS_TX	|	\
+	MV64340_ETH_FORCE_BP_MODE_NO_JAM		|	\
+	(1 << 9)					|	\
+	MV64340_ETH_DO_NOT_FORCE_LINK_FAIL		|	\
+	MV64340_ETH_RETRANSMIT_16_ATTEMPTS		|	\
+	MV64340_ETH_ENABLE_AUTO_NEG_SPEED_GMII		|	\
+	MV64340_ETH_DTE_ADV_0				|	\
+	MV64340_ETH_DISABLE_AUTO_NEG_BYPASS		|	\
+	MV64340_ETH_AUTO_NEG_NO_CHANGE			|	\
+	MV64340_ETH_MAX_RX_PACKET_9700BYTE		|	\
+	MV64340_ETH_CLR_EXT_LOOPBACK			|	\
+	MV64340_ETH_SET_FULL_DUPLEX_MODE		|	\
+	MV64340_ETH_ENABLE_FLOW_CTRL_TX_RX_IN_FULL_DUPLEX
+
+/*****************************************************************************
+ * Serial defines.
+ *****************************************************************************/
+
+#define PPC7D_SERIAL_0		0xe80003f8
+#define PPC7D_SERIAL_1		0xe80002f8
+
+#define RS_TABLE_SIZE  2
+
+/* Rate for the 1.8432 Mhz clock for the onboard serial chip */
+#define UART_CLK			1843200
+#define BASE_BAUD			( UART_CLK / 16 )
+
+#ifdef CONFIG_SERIAL_DETECT_IRQ
+#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF|ASYNC_AUTO_IRQ)
+#else
+#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF)
+#endif
+
+#define STD_SERIAL_PORT_DFNS \
+        { 0, BASE_BAUD, PPC7D_SERIAL_0, 4, STD_COM_FLAGS, /* ttyS0 */ \
+		iomem_base: (u8 *)PPC7D_SERIAL_0,			  \
+		io_type: SERIAL_IO_MEM, },				  \
+        { 0, BASE_BAUD, PPC7D_SERIAL_1, 3, STD_COM_FLAGS, /* ttyS1 */ \
+		iomem_base: (u8 *)PPC7D_SERIAL_1,			  \
+		io_type: SERIAL_IO_MEM },
+
+#define SERIAL_PORT_DFNS \
+        STD_SERIAL_PORT_DFNS
+
+/*****************************************************************************
+ * CPLD defines.
+ *
+ * Register map:-
+ *
+ * 0000 to 000F 	South Bridge DMA 1 Control
+ * 0020 and 0021 	South Bridge Interrupt 1 Control
+ * 0040 to 0043 	South Bridge Counter Control
+ * 0060 		Keyboard
+ * 0061 		South Bridge NMI Status and Control
+ * 0064 		Keyboard
+ * 0071 and 0072 	RTC R/W
+ * 0078 to 007B 	South Bridge BIOS Timer
+ * 0080 to 0090 	South Bridge DMA Pages
+ * 00A0 and 00A1 	South Bridge Interrupt 2 Control
+ * 00C0 to 00DE 	South Bridge DMA 2 Control
+ * 02E8 to 02EF 	COM6 R/W
+ * 02F8 to 02FF 	South Bridge COM2 R/W
+ * 03E8 to 03EF 	COM5 R/W
+ * 03F8 to 03FF 	South Bridge COM1 R/W
+ * 040A 		South Bridge DMA Scatter/Gather RO
+ * 040B 		DMA 1 Extended Mode WO
+ * 0410 to 043F 	South Bridge DMA Scatter/Gather
+ * 0481 to 048B 	South Bridge DMA High Pages
+ * 04D0 and 04D1 	South Bridge Edge/Level Control
+ * 04D6 		DMA 2 Extended Mode WO
+ * 0804 		Memory Configuration RO
+ * 0806 		Memory Configuration Extend RO
+ * 0808 		SCSI Activity LED R/W
+ * 080C 		Equipment Present 1 RO
+ * 080E 		Equipment Present 2 RO
+ * 0810 		Equipment Present 3 RO
+ * 0812 		Equipment Present 4 RO
+ * 0818 		Key Lock RO
+ * 0820 		LEDS R/W
+ * 0824 		COMs R/W
+ * 0826 		RTS R/W
+ * 0828 		Reset R/W
+ * 082C 		Watchdog Trig R/W
+ * 082E 		Interrupt R/W
+ * 0830 		Interrupt Status RO
+ * 0832 		PCI configuration RO
+ * 0854 		Board Revision RO
+ * 0858 		Extended ID RO
+ * 0864 		ID Link RO
+ * 0866 		Motherboard Type RO
+ * 0868 		FLASH Write control RO
+ * 086A 		Software FLASH write protect R/W
+ * 086E 		FLASH Control R/W
+ *****************************************************************************/
+
+#define PPC7D_CPLD_MEM_CONFIG			0x0804
+#define PPC7D_CPLD_MEM_CONFIG_EXTEND		0x0806
+#define PPC7D_CPLD_SCSI_ACTIVITY_LED		0x0808
+#define PPC7D_CPLD_EQUIPMENT_PRESENT_1		0x080C
+#define PPC7D_CPLD_EQUIPMENT_PRESENT_2		0x080E
+#define PPC7D_CPLD_EQUIPMENT_PRESENT_3		0x0810
+#define PPC7D_CPLD_EQUIPMENT_PRESENT_4		0x0812
+#define PPC7D_CPLD_KEY_LOCK			0x0818
+#define PPC7D_CPLD_LEDS				0x0820
+#define PPC7D_CPLD_COMS				0x0824
+#define PPC7D_CPLD_RTS				0x0826
+#define PPC7D_CPLD_RESET			0x0828
+#define PPC7D_CPLD_WATCHDOG_TRIG		0x082C
+#define PPC7D_CPLD_INTR				0x082E
+#define PPC7D_CPLD_INTR_STATUS			0x0830
+#define PPC7D_CPLD_PCI_CONFIG			0x0832
+#define PPC7D_CPLD_BOARD_REVISION		0x0854
+#define PPC7D_CPLD_EXTENDED_ID			0x0858
+#define PPC7D_CPLD_ID_LINK			0x0864
+#define PPC7D_CPLD_MOTHERBOARD_TYPE		0x0866
+#define PPC7D_CPLD_FLASH_WRITE_CNTL		0x0868
+#define PPC7D_CPLD_SW_FLASH_WRITE_PROTECT	0x086A
+#define PPC7D_CPLD_FLASH_CNTL			0x086E
+
+/* MEMORY_CONFIG_EXTEND */
+#define PPC7D_CPLD_SDRAM_BANK_SIZE_MASK		0xc0
+#define PPC7D_CPLD_SDRAM_BANK_SIZE_128M		0
+#define PPC7D_CPLD_SDRAM_BANK_SIZE_256M		0x40
+#define PPC7D_CPLD_SDRAM_BANK_SIZE_512M		0x80
+#define PPC7D_CPLD_SDRAM_BANK_SIZE_1G		0xc0
+#define PPC7D_CPLD_FLASH_DEV_SIZE_MASK		0x03
+#define PPC7D_CPLD_FLASH_BANK_NUM_MASK		0x0c
+#define PPC7D_CPLD_FLASH_DEV_SIZE_64M		0
+#define PPC7D_CPLD_FLASH_DEV_SIZE_32M		1
+#define PPC7D_CPLD_FLASH_DEV_SIZE_16M		3
+#define PPC7D_CPLD_FLASH_BANK_NUM_4		0x00
+#define PPC7D_CPLD_FLASH_BANK_NUM_3		0x04
+#define PPC7D_CPLD_FLASH_BANK_NUM_2		0x08
+#define PPC7D_CPLD_FLASH_BANK_NUM_1		0x0c
+
+/* SCSI_LED */
+#define PPC7D_CPLD_SCSI_ACTIVITY_LED_OFF	0
+#define PPC7D_CPLD_SCSI_ACTIVITY_LED_ON		1
+
+/* EQUIPMENT_PRESENT_1 */
+#define PPC7D_CPLD_EQPT_PRES_1_FITTED		0
+#define PPC7D_CPLD_EQPT_PRES_1_PMC2_MASK	(0x80 >> 2)
+#define PPC7D_CPLD_EQPT_PRES_1_PMC1_MASK	(0x80 >> 3)
+#define PPC7D_CPLD_EQPT_PRES_1_AFIX_MASK	(0x80 >> 4)
+
+/* EQUIPMENT_PRESENT_2 */
+#define PPC7D_CPLD_EQPT_PRES_2_FITTED		!0
+#define PPC7D_CPLD_EQPT_PRES_2_UNIVERSE_MASK	(0x80 >> 0)
+#define PPC7D_CPLD_EQPT_PRES_2_COM36_MASK	(0x80 >> 2)
+#define PPC7D_CPLD_EQPT_PRES_2_GIGE_MASK	(0x80 >> 3)
+#define PPC7D_CPLD_EQPT_PRES_2_DUALGIGE_MASK	(0x80 >> 4)
+
+/* EQUIPMENT_PRESENT_3 */
+#define PPC7D_CPLD_EQPT_PRES_3_PMC2_V_MASK	(0x80 >> 3)
+#define PPC7D_CPLD_EQPT_PRES_3_PMC2_5V		(0 >> 3)
+#define PPC7D_CPLD_EQPT_PRES_3_PMC2_3V		(0x80 >> 3)
+#define PPC7D_CPLD_EQPT_PRES_3_PMC1_V_MASK	(0x80 >> 4)
+#define PPC7D_CPLD_EQPT_PRES_3_PMC1_5V		(0 >> 4)
+#define PPC7D_CPLD_EQPT_PRES_3_PMC1_3V		(0x80 >> 4)
+#define PPC7D_CPLD_EQPT_PRES_3_PMC_POWER_MASK	(0x80 >> 5)
+#define PPC7D_CPLD_EQPT_PRES_3_PMC_POWER_INTER	(0 >> 5)
+#define PPC7D_CPLD_EQPT_PRES_3_PMC_POWER_VME	(0x80 >> 5)
+
+/* EQUIPMENT_PRESENT_4 */
+#define PPC7D_CPLD_EQPT_PRES_4_LPT_MASK		(0x80 >> 2)
+#define PPC7D_CPLD_EQPT_PRES_4_LPT_FITTED	(0x80 >> 2)
+#define PPC7D_CPLD_EQPT_PRES_4_PS2_USB2_MASK	(0xc0 >> 6)
+#define PPC7D_CPLD_EQPT_PRES_4_PS2_FITTED	(0x40 >> 6)
+#define PPC7D_CPLD_EQPT_PRES_4_USB2_FITTED	(0x80 >> 6)
+
+/* CPLD_LEDS */
+#define PPC7D_CPLD_LEDS_ON			(!0)
+#define PPC7D_CPLD_LEDS_OFF			(0)
+#define PPC7D_CPLD_LEDS_NVRAM_PAGE_MASK		(0xc0 >> 2)
+#define PPC7D_CPLD_LEDS_DS201_MASK		(0x80 >> 4)
+#define PPC7D_CPLD_LEDS_DS219_MASK		(0x80 >> 5)
+#define PPC7D_CPLD_LEDS_DS220_MASK		(0x80 >> 6)
+#define PPC7D_CPLD_LEDS_DS221_MASK		(0x80 >> 7)
+
+/* CPLD_COMS */
+#define PPC7D_CPLD_COMS_COM3_TCLKEN		(0x80 >> 0)
+#define PPC7D_CPLD_COMS_COM3_RTCLKEN		(0x80 >> 1)
+#define PPC7D_CPLD_COMS_COM3_MODE_MASK		(0x80 >> 2)
+#define PPC7D_CPLD_COMS_COM3_MODE_RS232		(0)
+#define PPC7D_CPLD_COMS_COM3_MODE_RS422		(0x80 >> 2)
+#define PPC7D_CPLD_COMS_COM3_TXEN		(0x80 >> 3)
+#define PPC7D_CPLD_COMS_COM4_TCLKEN		(0x80 >> 4)
+#define PPC7D_CPLD_COMS_COM4_RTCLKEN		(0x80 >> 5)
+#define PPC7D_CPLD_COMS_COM4_MODE_MASK		(0x80 >> 6)
+#define PPC7D_CPLD_COMS_COM4_MODE_RS232		(0)
+#define PPC7D_CPLD_COMS_COM4_MODE_RS422		(0x80 >> 6)
+#define PPC7D_CPLD_COMS_COM4_TXEN		(0x80 >> 7)
+
+/* CPLD_RTS */
+#define PPC7D_CPLD_RTS_COM36_LOOPBACK		(0x80 >> 0)
+#define PPC7D_CPLD_RTS_COM4_SCLK		(0x80 >> 1)
+#define PPC7D_CPLD_RTS_COM3_TXFUNC_MASK		(0xc0 >> 2)
+#define PPC7D_CPLD_RTS_COM3_TXFUNC_DISABLED	(0 >> 2)
+#define PPC7D_CPLD_RTS_COM3_TXFUNC_ENABLED	(0x80 >> 2)
+#define PPC7D_CPLD_RTS_COM3_TXFUNC_ENABLED_RTG3	(0xc0 >> 2)
+#define PPC7D_CPLD_RTS_COM3_TXFUNC_ENABLED_RTG3S (0xc0 >> 2)
+#define PPC7D_CPLD_RTS_COM56_MODE_MASK		(0x80 >> 4)
+#define PPC7D_CPLD_RTS_COM56_MODE_RS232		(0)
+#define PPC7D_CPLD_RTS_COM56_MODE_RS422		(0x80 >> 4)
+#define PPC7D_CPLD_RTS_COM56_ENABLE_MASK	(0x80 >> 5)
+#define PPC7D_CPLD_RTS_COM56_DISABLED		(0)
+#define PPC7D_CPLD_RTS_COM56_ENABLED		(0x80 >> 5)
+#define PPC7D_CPLD_RTS_COM4_TXFUNC_MASK		(0xc0 >> 6)
+#define PPC7D_CPLD_RTS_COM4_TXFUNC_DISABLED	(0 >> 6)
+#define PPC7D_CPLD_RTS_COM4_TXFUNC_ENABLED	(0x80 >> 6)
+#define PPC7D_CPLD_RTS_COM4_TXFUNC_ENABLED_RTG3	(0x40 >> 6)
+#define PPC7D_CPLD_RTS_COM4_TXFUNC_ENABLED_RTG3S (0x40 >> 6)
+
+/* WATCHDOG_TRIG */
+#define PPC7D_CPLD_WDOG_CAUSE_MASK		(0x80 >> 0)
+#define PPC7D_CPLD_WDOG_CAUSE_NORMAL_RESET	(0 >> 0)
+#define PPC7D_CPLD_WDOG_CAUSE_WATCHDOG		(0x80 >> 0)
+#define PPC7D_CPLD_WDOG_ENABLE_MASK		(0x80 >> 6)
+#define PPC7D_CPLD_WDOG_ENABLE_OFF		(0 >> 6)
+#define PPC7D_CPLD_WDOG_ENABLE_ON		(0x80 >> 6)
+#define PPC7D_CPLD_WDOG_RESETSW_MASK		(0x80 >> 7)
+#define PPC7D_CPLD_WDOG_RESETSW_OFF		(0 >> 7)
+#define PPC7D_CPLD_WDOG_RESETSW_ON		(0x80 >> 7)
+
+/* Interrupt mask and status bits */
+#define PPC7D_CPLD_INTR_TEMP_MASK		(0x80 >> 0)
+#define PPC7D_CPLD_INTR_HB8_MASK		(0x80 >> 1)
+#define PPC7D_CPLD_INTR_PHY1_MASK		(0x80 >> 2)
+#define PPC7D_CPLD_INTR_PHY0_MASK		(0x80 >> 3)
+#define PPC7D_CPLD_INTR_ISANMI_MASK		(0x80 >> 5)
+#define PPC7D_CPLD_INTR_CRITTEMP_MASK		(0x80 >> 6)
+
+/* CPLD_INTR */
+#define PPC7D_CPLD_INTR_ENABLE_OFF		(0)
+#define PPC7D_CPLD_INTR_ENABLE_ON		(!0)
+
+/* CPLD_INTR_STATUS */
+#define PPC7D_CPLD_INTR_STATUS_OFF		(0)
+#define PPC7D_CPLD_INTR_STATUS_ON		(!0)
+
+/* CPLD_PCI_CONFIG */
+#define PPC7D_CPLD_PCI_CONFIG_PCI0_MASK		0x70
+#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCI33	0x00
+#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCI66	0x10
+#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCIX33	0x40
+#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCIX66	0x50
+#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCIX100      0x60
+#define PPC7D_CPLD_PCI_CONFIG_PCI0_PCIX133	0x70
+#define PPC7D_CPLD_PCI_CONFIG_PCI1_MASK		0x07
+#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCI33	0x00
+#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCI66	0x01
+#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCIX33	0x04
+#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCIX66	0x05
+#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCIX100	0x06
+#define PPC7D_CPLD_PCI_CONFIG_PCI1_PCIX133	0x07
+
+/* CPLD_BOARD_REVISION */
+#define PPC7D_CPLD_BOARD_REVISION_NUMBER_MASK	0xe0
+#define PPC7D_CPLD_BOARD_REVISION_LETTER_MASK	0x1f
+
+/* CPLD_EXTENDED_ID */
+#define PPC7D_CPLD_EXTENDED_ID_PPC7D		0x18
+
+/* CPLD_ID_LINK */
+#define PPC7D_CPLD_ID_LINK_VME64_GAP_MASK	(0x80 >> 2)
+#define PPC7D_CPLD_ID_LINK_VME64_GA4_MASK	(0x80 >> 3)
+#define PPC7D_CPLD_ID_LINK_E13_MASK		(0x80 >> 4)
+#define PPC7D_CPLD_ID_LINK_E12_MASK		(0x80 >> 5)
+#define PPC7D_CPLD_ID_LINK_E7_MASK		(0x80 >> 6)
+#define PPC7D_CPLD_ID_LINK_E6_MASK		(0x80 >> 7)
+
+/* CPLD_MOTHERBOARD_TYPE */
+#define PPC7D_CPLD_MB_TYPE_ECC_ENABLE_MASK	(0x80 >> 0)
+#define PPC7D_CPLD_MB_TYPE_ECC_ENABLED		(0x80 >> 0)
+#define PPC7D_CPLD_MB_TYPE_ECC_DISABLED		(0 >> 0)
+#define PPC7D_CPLD_MB_TYPE_ECC_FITTED_MASK	(0x80 >> 3)
+#define PPC7D_CPLD_MB_TYPE_PLL_MASK		0x0c
+#define PPC7D_CPLD_MB_TYPE_PLL_133		0x00
+#define PPC7D_CPLD_MB_TYPE_PLL_100		0x08
+#define PPC7D_CPLD_MB_TYPE_PLL_64		0x04
+#define PPC7D_CPLD_MB_TYPE_HW_ID_MASK		0x03
+
+/* CPLD_FLASH_WRITE_CNTL */
+#define PPD7D_CPLD_FLASH_CNTL_WR_LINK_MASK	(0x80 >> 0)
+#define PPD7D_CPLD_FLASH_CNTL_WR_LINK_FITTED	(0x80 >> 0)
+#define PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_MASK	(0x80 >> 2)
+#define PPD7D_CPLD_FLASH_CNTL_BOOT_LINK_FITTED	(0x80 >> 2)
+#define PPD7D_CPLD_FLASH_CNTL_USER_LINK_MASK	(0x80 >> 3)
+#define PPD7D_CPLD_FLASH_CNTL_USER_LINK_FITTED	(0x80 >> 3)
+#define PPD7D_CPLD_FLASH_CNTL_RECO_WR_MASK	(0x80 >> 5)
+#define PPD7D_CPLD_FLASH_CNTL_RECO_WR_ENABLED	(0x80 >> 5)
+#define PPD7D_CPLD_FLASH_CNTL_BOOT_WR_MASK	(0x80 >> 6)
+#define PPD7D_CPLD_FLASH_CNTL_BOOT_WR_ENABLED	(0x80 >> 6)
+#define PPD7D_CPLD_FLASH_CNTL_USER_WR_MASK	(0x80 >> 7)
+#define PPD7D_CPLD_FLASH_CNTL_USER_WR_ENABLED	(0x80 >> 7)
+
+/* CPLD_SW_FLASH_WRITE_PROTECT */
+#define PPC7D_CPLD_SW_FLASH_WRPROT_ENABLED	(!0)
+#define PPC7D_CPLD_SW_FLASH_WRPROT_DISABLED	(0)
+#define PPC7D_CPLD_SW_FLASH_WRPROT_SYSBOOT_MASK	(0x80 >> 6)
+#define PPC7D_CPLD_SW_FLASH_WRPROT_USER_MASK	(0x80 >> 7)
+
+/* CPLD_FLASH_WRITE_CNTL */
+#define PPC7D_CPLD_FLASH_CNTL_NVRAM_PROT_MASK	(0x80 >> 0)
+#define PPC7D_CPLD_FLASH_CNTL_NVRAM_DISABLED	(0 >> 0)
+#define PPC7D_CPLD_FLASH_CNTL_NVRAM_ENABLED	(0x80 >> 0)
+#define PPC7D_CPLD_FLASH_CNTL_ALTBOOT_LINK_MASK	(0x80 >> 1)
+#define PPC7D_CPLD_FLASH_CNTL_VMEBOOT_LINK_MASK	(0x80 >> 2)
+#define PPC7D_CPLD_FLASH_CNTL_RECBOOT_LINK_MASK	(0x80 >> 3)
+
+
+#endif /* __PPC_PLATFORMS_PPC7D_H */
diff -Nru a/arch/ppc/platforms/sandpoint.c b/arch/ppc/platforms/sandpoint.c
--- a/arch/ppc/platforms/sandpoint.c	2004-11-15 19:29:07 -08:00
+++ b/arch/ppc/platforms/sandpoint.c	2005-03-04 22:41:15 -08:00
@@ -319,10 +319,10 @@
 	 * We will do this now with good known values.  Future versions
 	 * of DINK32 are supposed to get this correct.
 	 */
-	if (cur_cpu_spec[0]->cpu_features & CPU_FTR_SPEC7450)
+	if (cpu_has_feature(CPU_FTR_SPEC7450))
 		/* 745x is different.  We only want to pass along enable. */
 		_set_L2CR(L2CR_L2E);
-	else if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L2CR)
+	else if (cpu_has_feature(CPU_FTR_L2CR))
 		/* All modules have 1MB of L2.  We also assume that an
 		 * L2 divisor of 3 will work.
 		 */
@@ -330,7 +330,7 @@
 				| L2CR_L2RAM_PIPE | L2CR_L2OH_1_0 | L2CR_L2DF);
 #if 0
 	/* Untested right now. */
-	if (cur_cpu_spec[0]->cpu_features & CPU_FTR_L3CR) {
+	if (cpu_has_feature(CPU_FTR_L3CR)) {
 		/* Magic value. */
 		_set_L3CR(0x8f032000);
 	}
diff -Nru a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
--- a/arch/ppc/syslib/Makefile	2005-02-03 06:42:41 -08:00
+++ b/arch/ppc/syslib/Makefile	2005-03-07 20:41:25 -08:00
@@ -74,6 +74,7 @@
 					hawk_common.o
 obj-$(CONFIG_HARRIER)		+= harrier.o
 obj-$(CONFIG_PRPMC800)		+= open_pic.o indirect_pci.o pci_auto.o
+obj-$(CONFIG_RADSTONE_PPC7D)	+= i8259.o pci_auto.o
 obj-$(CONFIG_SANDPOINT)		+= i8259.o pci_auto.o todc_time.o
 obj-$(CONFIG_SBC82xx)		+= todc_time.o
 obj-$(CONFIG_SPRUCE)		+= cpc700_pic.o indirect_pci.o pci_auto.o \
@@ -99,4 +100,9 @@
 ifeq ($(CONFIG_85xx),y)
 obj-$(CONFIG_PCI)		+= indirect_pci.o pci_auto.o
 endif
+obj-$(CONFIG_83xx)		+= ipic.o ppc83xx_setup.o ppc_sys.o
+ifeq ($(CONFIG_83xx),y)
+obj-$(CONFIG_PCI)		+= indirect_pci.o pci_auto.o
+endif
+obj-$(CONFIG_MPC8555_CDS)	+= todc_time.o
 obj-$(CONFIG_PPC_MPC52xx)	+= mpc52xx_setup.o mpc52xx_pic.o
diff -Nru a/arch/ppc/syslib/ipic.c b/arch/ppc/syslib/ipic.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/syslib/ipic.c	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,646 @@
+/*
+ * include/asm-ppc/ipic.c
+ *
+ * IPIC routines implementations.
+ *
+ * Copyright 2005 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/reboot.h>
+#include <linux/slab.h>
+#include <linux/stddef.h>
+#include <linux/sched.h>
+#include <linux/signal.h>
+#include <linux/sysdev.h>
+#include <asm/irq.h>
+#include <asm/io.h>
+#include <asm/ipic.h>
+#include <asm/mpc83xx.h>
+
+#include "ipic.h"
+
+static struct ipic p_ipic;
+static struct ipic * primary_ipic;
+
+static struct ipic_info ipic_info[] = {
+	[9] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_D,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 24,
+		.prio_mask = 0,
+	},
+	[10] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_D,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 25,
+		.prio_mask = 1,
+	},
+	[11] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_D,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 26,
+		.prio_mask = 2,
+	},
+	[14] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_D,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 29,
+		.prio_mask = 5,
+	},
+	[15] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_D,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 30,
+		.prio_mask = 6,
+	},
+	[16] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_D,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 31,
+		.prio_mask = 7,
+	},
+	[17] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SEMSR,
+		.prio	= IPIC_SMPRR_A,
+		.force	= IPIC_SEFCR,
+		.bit	= 1,
+		.prio_mask = 5,
+	},
+	[18] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SEMSR,
+		.prio	= IPIC_SMPRR_A,
+		.force	= IPIC_SEFCR,
+		.bit	= 2,
+		.prio_mask = 6,
+	},
+	[19] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SEMSR,
+		.prio	= IPIC_SMPRR_A,
+		.force	= IPIC_SEFCR,
+		.bit	= 3,
+		.prio_mask = 7,
+	},
+	[20] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SEMSR,
+		.prio	= IPIC_SMPRR_B,
+		.force	= IPIC_SEFCR,
+		.bit	= 4,
+		.prio_mask = 4,
+	},
+	[21] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SEMSR,
+		.prio	= IPIC_SMPRR_B,
+		.force	= IPIC_SEFCR,
+		.bit	= 5,
+		.prio_mask = 5,
+	},
+	[22] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SEMSR,
+		.prio	= IPIC_SMPRR_B,
+		.force	= IPIC_SEFCR,
+		.bit	= 6,
+		.prio_mask = 6,
+	},
+	[23] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SEMSR,
+		.prio	= IPIC_SMPRR_B,
+		.force	= IPIC_SEFCR,
+		.bit	= 7,
+		.prio_mask = 7,
+	},
+	[32] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_A,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 0,
+		.prio_mask = 0,
+	},
+	[33] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_A,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 1,
+		.prio_mask = 1,
+	},
+	[34] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_A,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 2,
+		.prio_mask = 2,
+	},
+	[35] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_A,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 3,
+		.prio_mask = 3,
+	},
+	[36] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_A,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 4,
+		.prio_mask = 4,
+	},
+	[37] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_A,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 5,
+		.prio_mask = 5,
+	},
+	[38] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_A,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 6,
+		.prio_mask = 6,
+	},
+	[39] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_H,
+		.prio	= IPIC_SIPRR_A,
+		.force	= IPIC_SIFCR_H,
+		.bit	= 7,
+		.prio_mask = 7,
+	},
+	[48] = {
+		.pend	= IPIC_SEPNR,
+		.mask	= IPIC_SEMSR,
+		.prio	= IPIC_SMPRR_A,
+		.force	= IPIC_SEFCR,
+		.bit	= 0,
+		.prio_mask = 4,
+	},
+	[64] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= IPIC_SMPRR_A,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 0,
+		.prio_mask = 0,
+	},
+	[65] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= IPIC_SMPRR_A,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 1,
+		.prio_mask = 1,
+	},
+	[66] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= IPIC_SMPRR_A,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 2,
+		.prio_mask = 2,
+	},
+	[67] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= IPIC_SMPRR_A,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 3,
+		.prio_mask = 3,
+	},
+	[68] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= IPIC_SMPRR_B,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 4,
+		.prio_mask = 0,
+	},
+	[69] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= IPIC_SMPRR_B,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 5,
+		.prio_mask = 1,
+	},
+	[70] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= IPIC_SMPRR_B,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 6,
+		.prio_mask = 2,
+	},
+	[71] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= IPIC_SMPRR_B,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 7,
+		.prio_mask = 3,
+	},
+	[72] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 8,
+	},
+	[73] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 9,
+	},
+	[74] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 10,
+	},
+	[75] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 11,
+	},
+	[76] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 12,
+	},
+	[77] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 13,
+	},
+	[78] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 14,
+	},
+	[79] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 15,
+	},
+	[80] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 16,
+	},
+	[84] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 20,
+	},
+	[85] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 21,
+	},
+	[90] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 26,
+	},
+	[91] = {
+		.pend	= IPIC_SIPNR_H,
+		.mask	= IPIC_SIMSR_L,
+		.prio	= 0,
+		.force	= IPIC_SIFCR_L,
+		.bit	= 27,
+	},
+};
+
+static inline u32 ipic_read(volatile u32 __iomem *base, unsigned int reg)
+{
+	return in_be32(base + (reg >> 2));
+}
+
+static inline void ipic_write(volatile u32 __iomem *base, unsigned int reg, u32 value)
+{
+	out_be32(base + (reg >> 2), value);
+}
+
+static inline struct ipic * ipic_from_irq(unsigned int irq)
+{
+	return primary_ipic;
+}
+
+static void ipic_enable_irq(unsigned int irq)
+{
+	struct ipic *ipic = ipic_from_irq(irq);
+	unsigned int src = irq - ipic->irq_offset;
+	u32 temp;
+
+	temp = ipic_read(ipic->regs, ipic_info[src].mask);
+	temp |= (1 << (31 - ipic_info[src].bit));
+	ipic_write(ipic->regs, ipic_info[src].mask, temp);
+}
+
+static void ipic_disable_irq(unsigned int irq)
+{
+	struct ipic *ipic = ipic_from_irq(irq);
+	unsigned int src = irq - ipic->irq_offset;
+	u32 temp;
+
+	temp = ipic_read(ipic->regs, ipic_info[src].mask);
+	temp &= ~(1 << (31 - ipic_info[src].bit));
+	ipic_write(ipic->regs, ipic_info[src].mask, temp);
+}
+
+static void ipic_disable_irq_and_ack(unsigned int irq)
+{
+	struct ipic *ipic = ipic_from_irq(irq);
+	unsigned int src = irq - ipic->irq_offset;
+	u32 temp;
+
+	ipic_disable_irq(irq);
+
+	temp = ipic_read(ipic->regs, ipic_info[src].pend);
+	temp |= (1 << (31 - ipic_info[src].bit));
+	ipic_write(ipic->regs, ipic_info[src].pend, temp);
+}
+
+static void ipic_end_irq(unsigned int irq)
+{
+	if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
+		ipic_enable_irq(irq);
+}
+
+struct hw_interrupt_type ipic = {
+	.typename = " IPIC  ",
+	.enable = ipic_enable_irq,
+	.disable = ipic_disable_irq,
+	.ack = ipic_disable_irq_and_ack,
+	.end = ipic_end_irq,
+};
+
+void __init ipic_init(phys_addr_t phys_addr,
+		unsigned int flags,
+		unsigned int irq_offset,
+		unsigned char *senses,
+		unsigned int senses_count)
+{
+	u32 i, temp = 0;
+
+	primary_ipic = &p_ipic;
+	primary_ipic->regs = ioremap(phys_addr, MPC83xx_IPIC_SIZE);
+
+	primary_ipic->irq_offset = irq_offset;
+
+	ipic_write(primary_ipic->regs, IPIC_SICNR, 0x0);
+
+	/* default priority scheme is grouped. If spread mode is required
+	 * configure SICFR accordingly */
+	if (flags & IPIC_SPREADMODE_GRP_A)
+		temp |= SICFR_IPSA;
+	if (flags & IPIC_SPREADMODE_GRP_D)
+		temp |= SICFR_IPSD;
+	if (flags & IPIC_SPREADMODE_MIX_A)
+		temp |= SICFR_MPSA;
+	if (flags & IPIC_SPREADMODE_MIX_B)
+		temp |= SICFR_MPSB;
+
+	ipic_write(primary_ipic->regs, IPIC_SICNR, temp);
+
+	/* handle MCP route */
+	temp = 0;
+	if (flags & IPIC_DISABLE_MCP_OUT)
+		temp = SERCR_MCPR;
+	ipic_write(primary_ipic->regs, IPIC_SERCR, temp);
+
+	/* handle routing of IRQ0 to MCP */
+	temp = ipic_read(primary_ipic->regs, IPIC_SEMSR);
+
+	if (flags & IPIC_IRQ0_MCP)
+		temp |= SEMSR_SIRQ0;
+	else
+		temp &= ~SEMSR_SIRQ0;
+
+	ipic_write(primary_ipic->regs, IPIC_SEMSR, temp);
+
+	for (i = 0 ; i < NR_IPIC_INTS ; i++) {
+		irq_desc[i+irq_offset].handler = &ipic;
+		irq_desc[i+irq_offset].status = IRQ_LEVEL;
+	}
+
+	temp = 0;
+	for (i = 0 ; i < senses_count ; i++) {
+		if ((senses[i] & IRQ_SENSE_MASK) == IRQ_SENSE_EDGE) {
+			temp |= 1 << (16 - i);
+			if (i != 0)
+				irq_desc[i + irq_offset + MPC83xx_IRQ_EXT1 - 1].status = 0;
+			else
+				irq_desc[irq_offset + MPC83xx_IRQ_EXT0].status = 0;
+		}
+	}
+	ipic_write(primary_ipic->regs, IPIC_SECNR, temp);
+
+	printk ("IPIC (%d IRQ sources, %d External IRQs) at %p\n", NR_IPIC_INTS,
+			senses_count, primary_ipic->regs);
+}
+
+int ipic_set_priority(unsigned int irq, unsigned int priority)
+{
+	struct ipic *ipic = ipic_from_irq(irq);
+	unsigned int src = irq - ipic->irq_offset;
+	u32 temp;
+
+	if (priority > 7)
+		return -EINVAL;
+	if (src > 127)
+		return -EINVAL;
+	if (ipic_info[src].prio == 0)
+		return -EINVAL;
+
+	temp = ipic_read(ipic->regs, ipic_info[src].prio);
+
+	if (priority < 4) {
+		temp &= ~(0x7 << (20 + (3 - priority) * 3));
+		temp |= ipic_info[src].prio_mask << (20 + (3 - priority) * 3);
+	} else {
+		temp &= ~(0x7 << (4 + (7 - priority) * 3));
+		temp |= ipic_info[src].prio_mask << (4 + (7 - priority) * 3);
+	}
+
+	ipic_write(ipic->regs, ipic_info[src].prio, temp);
+
+	return 0;
+}
+
+void ipic_set_highest_priority(unsigned int irq)
+{
+	struct ipic *ipic = ipic_from_irq(irq);
+	unsigned int src = irq - ipic->irq_offset;
+	u32 temp;
+
+	temp = ipic_read(ipic->regs, IPIC_SICFR);
+
+	/* clear and set HPI */
+	temp &= 0x7f000000;
+	temp |= (src & 0x7f) << 24;
+
+	ipic_write(ipic->regs, IPIC_SICFR, temp);
+}
+
+void ipic_set_default_priority(void)
+{
+	ipic_set_priority(MPC83xx_IRQ_TSEC1_TX, 0);
+	ipic_set_priority(MPC83xx_IRQ_TSEC1_RX, 1);
+	ipic_set_priority(MPC83xx_IRQ_TSEC1_ERROR, 2);
+	ipic_set_priority(MPC83xx_IRQ_TSEC2_TX, 3);
+	ipic_set_priority(MPC83xx_IRQ_TSEC2_RX, 4);
+	ipic_set_priority(MPC83xx_IRQ_TSEC2_ERROR, 5);
+	ipic_set_priority(MPC83xx_IRQ_USB2_DR, 6);
+	ipic_set_priority(MPC83xx_IRQ_USB2_MPH, 7);
+
+	ipic_set_priority(MPC83xx_IRQ_UART1, 0);
+	ipic_set_priority(MPC83xx_IRQ_UART2, 1);
+	ipic_set_priority(MPC83xx_IRQ_SEC2, 2);
+	ipic_set_priority(MPC83xx_IRQ_IIC1, 5);
+	ipic_set_priority(MPC83xx_IRQ_IIC2, 6);
+	ipic_set_priority(MPC83xx_IRQ_SPI, 7);
+	ipic_set_priority(MPC83xx_IRQ_RTC_SEC, 0);
+	ipic_set_priority(MPC83xx_IRQ_PIT, 1);
+	ipic_set_priority(MPC83xx_IRQ_PCI1, 2);
+	ipic_set_priority(MPC83xx_IRQ_PCI2, 3);
+	ipic_set_priority(MPC83xx_IRQ_EXT0, 4);
+	ipic_set_priority(MPC83xx_IRQ_EXT1, 5);
+	ipic_set_priority(MPC83xx_IRQ_EXT2, 6);
+	ipic_set_priority(MPC83xx_IRQ_EXT3, 7);
+	ipic_set_priority(MPC83xx_IRQ_RTC_ALR, 0);
+	ipic_set_priority(MPC83xx_IRQ_MU, 1);
+	ipic_set_priority(MPC83xx_IRQ_SBA, 2);
+	ipic_set_priority(MPC83xx_IRQ_DMA, 3);
+	ipic_set_priority(MPC83xx_IRQ_EXT4, 4);
+	ipic_set_priority(MPC83xx_IRQ_EXT5, 5);
+	ipic_set_priority(MPC83xx_IRQ_EXT6, 6);
+	ipic_set_priority(MPC83xx_IRQ_EXT7, 7);
+}
+
+void ipic_enable_mcp(enum ipic_mcp_irq mcp_irq)
+{
+	struct ipic *ipic = primary_ipic;
+	u32 temp;
+
+	temp = ipic_read(ipic->regs, IPIC_SERMR);
+	temp |= (1 << (31 - mcp_irq));
+	ipic_write(ipic->regs, IPIC_SERMR, temp);
+}
+
+void ipic_disable_mcp(enum ipic_mcp_irq mcp_irq)
+{
+	struct ipic *ipic = primary_ipic;
+	u32 temp;
+
+	temp = ipic_read(ipic->regs, IPIC_SERMR);
+	temp &= (1 << (31 - mcp_irq));
+	ipic_write(ipic->regs, IPIC_SERMR, temp);
+}
+
+u32 ipic_get_mcp_status(void)
+{
+	return ipic_read(primary_ipic->regs, IPIC_SERMR);
+}
+
+void ipic_clear_mcp_status(u32 mask)
+{
+	ipic_write(primary_ipic->regs, IPIC_SERMR, mask);
+}
+
+/* Return an interrupt vector or -1 if no interrupt is pending. */
+int ipic_get_irq(struct pt_regs *regs)
+{
+	int irq;
+
+	irq = ipic_read(primary_ipic->regs, IPIC_SIVCR) & 0x7f;
+
+	if (irq == 0)    /* 0 --> no irq is pending */
+		irq = -1;
+
+	return irq;
+}
+
+static struct sysdev_class ipic_sysclass = {
+	set_kset_name("ipic"),
+};
+
+static struct sys_device device_ipic = {
+	.id		= 0,
+	.cls		= &ipic_sysclass,
+};
+
+static int __init init_ipic_sysfs(void)
+{
+	int rc;
+
+	if (!primary_ipic->regs)
+		return -ENODEV;
+	printk(KERN_DEBUG "Registering ipic with sysfs...\n");
+
+	rc = sysdev_class_register(&ipic_sysclass);
+	if (rc) {
+		printk(KERN_ERR "Failed registering ipic sys class\n");
+		return -ENODEV;
+	}
+	rc = sysdev_register(&device_ipic);
+	if (rc) {
+		printk(KERN_ERR "Failed registering ipic sys device\n");
+		return -ENODEV;
+	}
+	return 0;
+}
+
+subsys_initcall(init_ipic_sysfs);
diff -Nru a/arch/ppc/syslib/ipic.h b/arch/ppc/syslib/ipic.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/syslib/ipic.h	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,49 @@
+/*
+ * arch/ppc/kernel/ipic.h
+ *
+ * IPIC private definitions and structure.
+ *
+ * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ *
+ * Copyright 2005 Freescale Semiconductor, Inc
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+#ifndef __IPIC_H__
+#define __IPIC_H__
+
+#include <asm/ipic.h>
+
+#define MPC83xx_IPIC_SIZE	(0x00100)
+
+/* System Global Interrupt Configuration Register */
+#define	SICFR_IPSA	0x00010000
+#define	SICFR_IPSD	0x00080000
+#define	SICFR_MPSA	0x00200000
+#define	SICFR_MPSB	0x00400000
+
+/* System External Interrupt Mask Register */
+#define	SEMSR_SIRQ0	0x00008000
+
+/* System Error Control Register */
+#define SERCR_MCPR	0x00000001
+
+struct ipic {
+	volatile u32 __iomem	*regs;
+	unsigned int		irq_offset;
+};
+
+struct ipic_info {
+	u8	pend;		/* pending register offset from base */
+	u8	mask;		/* mask register offset from base */
+	u8	prio;		/* priority register offset from base */
+	u8	force;		/* force register offset from base */
+	u8	bit;		/* register bit position (as per doc)
+				   bit mask = 1 << (31 - bit) */
+	u8	prio_mask;	/* priority mask value */
+};
+
+#endif /* __IPIC_H__ */
diff -Nru a/arch/ppc/syslib/mv64360_pic.c b/arch/ppc/syslib/mv64360_pic.c
--- a/arch/ppc/syslib/mv64360_pic.c	2005-01-30 22:22:37 -08:00
+++ b/arch/ppc/syslib/mv64360_pic.c	2005-03-04 22:41:17 -08:00
@@ -64,7 +64,7 @@
 /* ========================== local declarations =========================== */
 
 struct hw_interrupt_type mv64360_pic = {
-	.typename = " mv64360_pic ",
+	.typename = " mv64360  ",
 	.enable   = mv64360_unmask_irq,
 	.disable  = mv64360_mask_irq,
 	.ack      = mv64360_mask_irq,
@@ -155,9 +155,10 @@
 	 */
 	int cpu_nr = smp_processor_id();
 	if (cpu_nr == 1) {
-		if (!(mv64x60_read(&bh, MV64360_IC_MAIN_CAUSE_LO) & (1 << 28)))
+		if (!(mv64x60_read(&bh, MV64360_IC_MAIN_CAUSE_LO) &
+		      (1 << MV64x60_IRQ_DOORBELL)))
 			return -1;
-		return 28;
+		return mv64360_irq_base + MV64x60_IRQ_DOORBELL;
 	}
 #endif
 
@@ -171,7 +172,7 @@
 		if (irq == -1)
 			irq = -2; /* bogus interrupt, should never happen */
 		else {
-			if ((irq >= 24) && (irq < 28)) {
+			if ((irq >= 24) && (irq < MV64x60_IRQ_DOORBELL)) {
 				irq_gpp = mv64x60_read(&bh,
 					MV64x60_GPP_INTR_CAUSE);
 				irq_gpp = __ilog2(irq_gpp &
@@ -217,8 +218,9 @@
 {
 #ifdef CONFIG_SMP
 	/* second CPU gets only doorbell interrupts */
-	if ((irq - mv64360_irq_base) == 28) {
-		mv64x60_set_bits(&bh, MV64360_IC_CPU1_INTR_MASK_LO, (1 << 28));
+	if ((irq - mv64360_irq_base) == MV64x60_IRQ_DOORBELL) {
+		mv64x60_set_bits(&bh, MV64360_IC_CPU1_INTR_MASK_LO,
+				 (1 << MV64x60_IRQ_DOORBELL));
 		return;
 	}
 #endif
@@ -257,8 +259,9 @@
 mv64360_mask_irq(unsigned int irq)
 {
 #ifdef CONFIG_SMP
-	if ((irq - mv64360_irq_base) == 28) {
-		mv64x60_clr_bits(&bh, MV64360_IC_CPU1_INTR_MASK_LO, (1 << 28));
+	if ((irq - mv64360_irq_base) == MV64x60_IRQ_DOORBELL) {
+		mv64x60_clr_bits(&bh, MV64360_IC_CPU1_INTR_MASK_LO,
+				 (1 << MV64x60_IRQ_DOORBELL));
 		return;
 	}
 #endif
@@ -371,7 +374,7 @@
 
 	/* Clear old errors and register CPU interface error intr handler */
 	mv64x60_write(&bh, MV64x60_CPU_ERR_CAUSE, 0);
-	if ((rc = request_irq(MV64x60_IRQ_CPU_ERR,
+	if ((rc = request_irq(MV64x60_IRQ_CPU_ERR + mv64360_irq_base,
 		mv64360_cpu_error_int_handler, SA_INTERRUPT, CPU_INTR_STR, 0)))
 		printk(KERN_WARNING "Can't register cpu error handler: %d", rc);
 
@@ -380,7 +383,7 @@
 
 	/* Clear old errors and register internal SRAM error intr handler */
 	mv64x60_write(&bh, MV64360_SRAM_ERR_CAUSE, 0);
-	if ((rc = request_irq(MV64360_IRQ_SRAM_PAR_ERR,
+	if ((rc = request_irq(MV64360_IRQ_SRAM_PAR_ERR + mv64360_irq_base,
 		mv64360_sram_error_int_handler,SA_INTERRUPT,SRAM_INTR_STR, 0)))
 		printk(KERN_WARNING "Can't register SRAM error handler: %d",rc);
 
@@ -397,7 +400,8 @@
 
 	/* Clear old errors and register PCI 0 error intr handler */
 	mv64x60_write(&bh, MV64x60_PCI0_ERR_CAUSE, 0);
-	if ((rc = request_irq(MV64360_IRQ_PCI0, mv64360_pci_error_int_handler,
+	if ((rc = request_irq(MV64360_IRQ_PCI0 + mv64360_irq_base,
+			mv64360_pci_error_int_handler,
 			SA_INTERRUPT, PCI0_INTR_STR, (void *)0)))
 		printk(KERN_WARNING "Can't register pci 0 error handler: %d",
 			rc);
@@ -407,7 +411,8 @@
 
 	/* Clear old errors and register PCI 1 error intr handler */
 	mv64x60_write(&bh, MV64x60_PCI1_ERR_CAUSE, 0);
-	if ((rc = request_irq(MV64360_IRQ_PCI1, mv64360_pci_error_int_handler,
+	if ((rc = request_irq(MV64360_IRQ_PCI1 + mv64360_irq_base,
+			mv64360_pci_error_int_handler,
 			SA_INTERRUPT, PCI1_INTR_STR, (void *)1)))
 		printk(KERN_WARNING "Can't register pci 1 error handler: %d",
 			rc);
diff -Nru a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c
--- a/arch/ppc/syslib/mv64x60.c	2005-02-03 06:42:42 -08:00
+++ b/arch/ppc/syslib/mv64x60.c	2005-03-04 22:41:16 -08:00
@@ -314,15 +314,15 @@
 static struct resource mv64x60_eth_shared_resources[] = {
 	[0] = {
 		.name	= "ethernet shared base",
-		.start	= MV64340_ETH_SHARED_REGS,
-		.end	= MV64340_ETH_SHARED_REGS +
-					MV64340_ETH_SHARED_REGS_SIZE - 1,
+		.start	= MV643XX_ETH_SHARED_REGS,
+		.end	= MV643XX_ETH_SHARED_REGS +
+					MV643XX_ETH_SHARED_REGS_SIZE - 1,
 		.flags	= IORESOURCE_MEM,
 	},
 };
 
 static struct platform_device mv64x60_eth_shared_device = {
-	.name		= MV64XXX_ETH_SHARED_NAME,
+	.name		= MV643XX_ETH_SHARED_NAME,
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(mv64x60_eth_shared_resources),
 	.resource	= mv64x60_eth_shared_resources,
@@ -338,10 +338,10 @@
 	},
 };
 
-static struct mv64xxx_eth_platform_data eth0_pd;
+static struct mv643xx_eth_platform_data eth0_pd;
 
 static struct platform_device eth0_device = {
-	.name		= MV64XXX_ETH_NAME,
+	.name		= MV643XX_ETH_NAME,
 	.id		= 0,
 	.num_resources	= ARRAY_SIZE(mv64x60_eth0_resources),
 	.resource	= mv64x60_eth0_resources,
@@ -361,10 +361,10 @@
 	},
 };
 
-static struct mv64xxx_eth_platform_data eth1_pd;
+static struct mv643xx_eth_platform_data eth1_pd;
 
 static struct platform_device eth1_device = {
-	.name		= MV64XXX_ETH_NAME,
+	.name		= MV643XX_ETH_NAME,
 	.id		= 1,
 	.num_resources	= ARRAY_SIZE(mv64x60_eth1_resources),
 	.resource	= mv64x60_eth1_resources,
@@ -384,10 +384,10 @@
 	},
 };
 
-static struct mv64xxx_eth_platform_data eth2_pd;
+static struct mv643xx_eth_platform_data eth2_pd;
 
 static struct platform_device eth2_device = {
-	.name		= MV64XXX_ETH_NAME,
+	.name		= MV643XX_ETH_NAME,
 	.id		= 2,
 	.num_resources	= ARRAY_SIZE(mv64x60_eth2_resources),
 	.resource	= mv64x60_eth2_resources,
diff -Nru a/arch/ppc/syslib/ppc4xx_pic.c b/arch/ppc/syslib/ppc4xx_pic.c
--- a/arch/ppc/syslib/ppc4xx_pic.c	2005-01-03 15:49:19 -08:00
+++ b/arch/ppc/syslib/ppc4xx_pic.c	2005-03-04 22:41:17 -08:00
@@ -4,7 +4,7 @@
  * Interrupt controller driver for PowerPC 4xx-based processors.
  *
  * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
- * Copyright (c) 2004 Zultys Technologies
+ * Copyright (c) 2004, 2005 Zultys Technologies
  *
  * Based on original code by
  *    Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
@@ -29,8 +29,9 @@
 /* See comment in include/arch-ppc/ppc4xx_pic.h
  * for more info about these two variables
  */
-extern struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[NR_UICS] __attribute__((weak));
-extern unsigned char ppc4xx_uic_ext_irq_cfg[] __attribute__((weak));
+extern struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[NR_UICS]
+    __attribute__ ((weak));
+extern unsigned char ppc4xx_uic_ext_irq_cfg[] __attribute__ ((weak));
 
 #define IRQ_MASK_UIC0(irq)		(1 << (31 - (irq)))
 #define IRQ_MASK_UICx(irq)		(1 << (31 - ((irq) & 0x1f)))
@@ -48,6 +49,7 @@
 {									\
 	ppc_cached_irq_mask[n] &= ~IRQ_MASK_UIC##n(irq);		\
 	mtdcr(DCRN_UIC_ER(UIC##n), ppc_cached_irq_mask[n]);		\
+	ACK_UIC##n##_PARENT						\
 }									\
 									\
 static void ppc4xx_uic##n##_ack(unsigned int irq)			\
@@ -63,11 +65,11 @@
 {									\
 	unsigned int status = irq_desc[irq].status;			\
 	u32 mask = IRQ_MASK_UIC##n(irq);				\
-	if (status & IRQ_LEVEL){					\
+	if (status & IRQ_LEVEL) {					\
 		mtdcr(DCRN_UIC_SR(UIC##n), mask);			\
 		ACK_UIC##n##_PARENT					\
 	}								\
-	if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))){		\
+	if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {		\
 		ppc_cached_irq_mask[n] |= mask;				\
 		mtdcr(DCRN_UIC_ER(UIC##n), ppc_cached_irq_mask[n]);	\
 	}								\
@@ -86,7 +88,9 @@
 #define ACK_UIC0_PARENT	mtdcr(DCRN_UIC_SR(UICB), UICB_UIC0NC);
 #define ACK_UIC1_PARENT	mtdcr(DCRN_UIC_SR(UICB), UICB_UIC1NC);
 #define ACK_UIC2_PARENT	mtdcr(DCRN_UIC_SR(UICB), UICB_UIC2NC);
-UIC_HANDLERS(0); UIC_HANDLERS(1); UIC_HANDLERS(2);
+UIC_HANDLERS(0);
+UIC_HANDLERS(1);
+UIC_HANDLERS(2);
 
 static int ppc4xx_pic_get_irq(struct pt_regs *regs)
 {
@@ -114,7 +118,8 @@
 #elif NR_UICS == 2
 #define ACK_UIC0_PARENT
 #define ACK_UIC1_PARENT	mtdcr(DCRN_UIC_SR(UIC0), UIC0_UIC1NC);
-UIC_HANDLERS(0); UIC_HANDLERS(1);
+UIC_HANDLERS(0);
+UIC_HANDLERS(1);
 
 static int ppc4xx_pic_get_irq(struct pt_regs *regs)
 {
@@ -143,18 +148,20 @@
 	return uic0 ? 32 - ffs(uic0) : -1;
 }
 
-static inline void ppc4xx_pic_impl_init(void){}
+static inline void ppc4xx_pic_impl_init(void)
+{
+}
 #endif
 
 static struct ppc4xx_uic_impl {
 	struct hw_interrupt_type decl;
-	int			 base;		/* Base DCR number */
+	int base;			/* Base DCR number */
 } __uic[] = {
-    { .decl = DECLARE_UIC(0), .base = UIC0 },
+	{ .decl = DECLARE_UIC(0), .base = UIC0 },
 #if NR_UICS > 1
-    { .decl = DECLARE_UIC(1), .base = UIC1 },
+	{ .decl = DECLARE_UIC(1), .base = UIC1 },
 #if NR_UICS > 2
-    { .decl = DECLARE_UIC(2), .base = UIC2 },
+	{ .decl = DECLARE_UIC(2), .base = UIC2 },
 #endif
 #endif
 };
@@ -168,9 +175,9 @@
 void __init ppc4xx_pic_init(void)
 {
 	int i;
-	unsigned char* eirqs = ppc4xx_uic_ext_irq_cfg;
+	unsigned char *eirqs = ppc4xx_uic_ext_irq_cfg;
 
-	for (i = 0; i < NR_UICS; ++i){
+	for (i = 0; i < NR_UICS; ++i) {
 		int base = __uic[i].base;
 
 		/* Disable everything by default */
@@ -181,23 +188,23 @@
 		mtdcr(DCRN_UIC_CR(base), 0);
 
 		/* Configure polarity and triggering */
-		if (ppc4xx_core_uic_cfg){
-			struct ppc4xx_uic_settings* p = ppc4xx_core_uic_cfg + i;
+		if (ppc4xx_core_uic_cfg) {
+			struct ppc4xx_uic_settings *p = ppc4xx_core_uic_cfg + i;
 			u32 mask = p->ext_irq_mask;
 			u32 pr = mfdcr(DCRN_UIC_PR(base)) & mask;
 			u32 tr = mfdcr(DCRN_UIC_TR(base)) & mask;
 
 			/* "Fixed" interrupts (on-chip devices) */
-			pr |= p->polarity   & ~mask;
+			pr |= p->polarity & ~mask;
 			tr |= p->triggering & ~mask;
 
 			/* Merge external IRQs settings if board port
 			 * provided them
 			 */
-			if (eirqs && mask){
+			if (eirqs && mask) {
 				pr &= ~mask;
 				tr &= ~mask;
-				while (mask){
+				while (mask) {
 					/* Extract current external IRQ mask */
 					u32 eirq_mask = 1 << __ilog2(mask);
 
@@ -227,8 +234,8 @@
 	ppc4xx_pic_impl_init();
 
 	/* Attach low-level handlers */
-	for (i = 0; i < (NR_UICS << 5); ++i){
-    		irq_desc[i].handler = &__uic[i >> 5].decl;
+	for (i = 0; i < (NR_UICS << 5); ++i) {
+		irq_desc[i].handler = &__uic[i >> 5].decl;
 		if (is_level_sensitive(i))
 			irq_desc[i].status |= IRQ_LEVEL;
 	}
diff -Nru a/arch/ppc/syslib/ppc83xx_setup.c b/arch/ppc/syslib/ppc83xx_setup.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/syslib/ppc83xx_setup.c	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,138 @@
+/*
+ * arch/ppc/syslib/ppc83xx_setup.c
+ *
+ * MPC83XX common board code
+ *
+ * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ *
+ * Copyright 2005 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/config.h>
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/serial.h>
+#include <linux/tty.h>	/* for linux/serial_core.h */
+#include <linux/serial_core.h>
+#include <linux/serial_8250.h>
+
+#include <asm/prom.h>
+#include <asm/time.h>
+#include <asm/mpc83xx.h>
+#include <asm/mmu.h>
+#include <asm/ppc_sys.h>
+#include <asm/kgdb.h>
+
+#include <syslib/ppc83xx_setup.h>
+
+phys_addr_t immrbar;
+
+/* Return the amount of memory */
+unsigned long __init
+mpc83xx_find_end_of_memory(void)
+{
+        bd_t *binfo;
+
+        binfo = (bd_t *) __res;
+
+        return binfo->bi_memsize;
+}
+
+long __init
+mpc83xx_time_init(void)
+{
+#define SPCR_OFFS   0x00000110
+#define SPCR_TBEN   0x00400000
+
+	bd_t *binfo = (bd_t *)__res;
+	u32 *spcr = ioremap(binfo->bi_immr_base + SPCR_OFFS, 4);
+
+	*spcr |= SPCR_TBEN;
+
+	iounmap(spcr);
+
+	return 0;
+}
+
+/* The decrementer counts at the system (internal) clock freq divided by 4 */
+void __init
+mpc83xx_calibrate_decr(void)
+{
+        bd_t *binfo = (bd_t *) __res;
+        unsigned int freq, divisor;
+
+	freq = binfo->bi_busfreq;
+	divisor = 4;
+	tb_ticks_per_jiffy = freq / HZ / divisor;
+	tb_to_us = mulhwu_scale_factor(freq / divisor, 1000000);
+}
+
+#ifdef CONFIG_SERIAL_8250
+void __init
+mpc83xx_early_serial_map(void)
+{
+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
+	struct uart_port serial_req;
+#endif
+	struct plat_serial8250_port *pdata;
+	bd_t *binfo = (bd_t *) __res;
+	pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC83xx_DUART);
+
+	/* Setup serial port access */
+	pdata[0].uartclk = binfo->bi_busfreq;
+	pdata[0].mapbase += binfo->bi_immr_base;
+	pdata[0].membase = ioremap(pdata[0].mapbase, 0x100);
+
+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
+	memset(&serial_req, 0, sizeof (serial_req));
+	serial_req.iotype = SERIAL_IO_MEM;
+	serial_req.mapbase = pdata[0].mapbase;
+	serial_req.membase = pdata[0].membase;
+	serial_req.regshift = 0;
+
+	gen550_init(0, &serial_req);
+#endif
+
+	pdata[1].uartclk = binfo->bi_busfreq;
+	pdata[1].mapbase += binfo->bi_immr_base;
+	pdata[1].membase = ioremap(pdata[1].mapbase, 0x100);
+
+#if defined(CONFIG_SERIAL_TEXT_DEBUG) || defined(CONFIG_KGDB)
+	/* Assume gen550_init() doesn't modify serial_req */
+	serial_req.mapbase = pdata[1].mapbase;
+	serial_req.membase = pdata[1].membase;
+
+	gen550_init(1, &serial_req);
+#endif
+}
+#endif
+
+void
+mpc83xx_restart(char *cmd)
+{
+	local_irq_disable();
+	for(;;);
+}
+
+void
+mpc83xx_power_off(void)
+{
+	local_irq_disable();
+	for(;;);
+}
+
+void
+mpc83xx_halt(void)
+{
+	local_irq_disable();
+	for(;;);
+}
+
+/* PCI SUPPORT DOES NOT EXIT, MODEL after ppc85xx_setup.c */
diff -Nru a/arch/ppc/syslib/ppc83xx_setup.h b/arch/ppc/syslib/ppc83xx_setup.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc/syslib/ppc83xx_setup.h	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,53 @@
+/*
+ * arch/ppc/syslib/ppc83xx_setup.h
+ *
+ * MPC83XX common board definitions
+ *
+ * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ *
+ * Copyright 2005 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef __PPC_SYSLIB_PPC83XX_SETUP_H
+#define __PPC_SYSLIB_PPC83XX_SETUP_H
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <asm/ppcboot.h>
+
+extern unsigned long mpc83xx_find_end_of_memory(void) __init;
+extern long mpc83xx_time_init(void) __init;
+extern void mpc83xx_calibrate_decr(void) __init;
+extern void mpc83xx_early_serial_map(void) __init;
+extern void mpc83xx_restart(char *cmd);
+extern void mpc83xx_power_off(void);
+extern void mpc83xx_halt(void);
+extern void mpc83xx_setup_hose(void) __init;
+
+/* PCI config */
+#if 0
+#define PCI1_CFG_ADDR_OFFSET	(FIXME)
+#define PCI1_CFG_DATA_OFFSET	(FIXME)
+
+#define PCI2_CFG_ADDR_OFFSET	(FIXME)
+#define PCI2_CFG_DATA_OFFSET	(FIXME)
+#endif
+
+/* Serial Config */
+#ifdef CONFIG_SERIAL_MANY_PORTS
+#define RS_TABLE_SIZE  64
+#else
+#define RS_TABLE_SIZE  2
+#endif
+
+#ifndef BASE_BAUD
+#define BASE_BAUD 115200
+#endif
+
+#endif /* __PPC_SYSLIB_PPC83XX_SETUP_H */
diff -Nru a/arch/ppc/syslib/todc_time.c b/arch/ppc/syslib/todc_time.c
--- a/arch/ppc/syslib/todc_time.c	2004-11-24 22:42:43 -08:00
+++ b/arch/ppc/syslib/todc_time.c	2005-03-04 22:41:52 -08:00
@@ -287,6 +287,7 @@
 		limit = 1;
 
 		switch (todc_info->rtc_type) {
+			case TODC_TYPE_DS1553:
 			case TODC_TYPE_DS1557:
 			case TODC_TYPE_DS1743:
 			case TODC_TYPE_DS1746:	/* XXXX BAD HACK -> FIX */
@@ -322,6 +323,7 @@
 
 	if (todc_info->rtc_type != TODC_TYPE_MC146818) {
 		switch (todc_info->rtc_type) {
+			case TODC_TYPE_DS1553:
 			case TODC_TYPE_DS1557:
 			case TODC_TYPE_DS1743:
 			case TODC_TYPE_DS1746:	/* XXXX BAD HACK -> FIX */
@@ -418,6 +420,7 @@
 	unsigned char save_control = 0, val;
 
 	switch (todc_info->rtc_type) {
+		case TODC_TYPE_DS1553:
 		case TODC_TYPE_DS1557:
 		case TODC_TYPE_DS1746:	/* XXXX BAD HACK -> FIX */
 		case TODC_TYPE_DS1747:
@@ -432,6 +435,7 @@
 	val = todc_read_val(addr);
 
 	switch (todc_info->rtc_type) {
+		case TODC_TYPE_DS1553:
 		case TODC_TYPE_DS1557:
 		case TODC_TYPE_DS1746:	/* XXXX BAD HACK -> FIX */
 		case TODC_TYPE_DS1747:
diff -Nru a/arch/ppc/syslib/xilinx_pic.c b/arch/ppc/syslib/xilinx_pic.c
--- a/arch/ppc/syslib/xilinx_pic.c	2005-01-03 15:49:19 -08:00
+++ b/arch/ppc/syslib/xilinx_pic.c	2005-03-04 22:41:16 -08:00
@@ -114,6 +114,14 @@
 {
 	int i;
 
+	/*
+	 * NOTE: The assumption here is that NR_IRQS is 32 or less
+	 * (NR_IRQS is 32 for PowerPC 405 cores by default).
+	 */
+#if (NR_IRQS > 32)
+#error NR_IRQS > 32 not supported
+#endif
+
 #if XPAR_XINTC_USE_DCR == 0
 	intc = ioremap(XPAR_INTC_0_BASEADDR, 32);
 
@@ -138,6 +146,12 @@
 
 	ppc_md.get_irq = xilinx_pic_get_irq;
 
-	for (i = 0; i < NR_IRQS; ++i)
+	for (i = 0; i < NR_IRQS; ++i) {
 		irq_desc[i].handler = &xilinx_intc;
+
+		if (XPAR_INTC_0_KIND_OF_INTR & (0x00000001 << i))
+			irq_desc[i].status &= ~IRQ_LEVEL;
+		else
+			irq_desc[i].status |= IRQ_LEVEL;
+	}
 }
diff -Nru a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
--- a/arch/ppc64/Kconfig	2005-01-25 13:50:16 -08:00
+++ b/arch/ppc64/Kconfig	2005-03-04 22:41:54 -08:00
@@ -194,7 +194,10 @@
 
 config HMT
 	bool "Hardware multithreading"
-	depends on SMP && PPC_PSERIES
+	depends on SMP && PPC_PSERIES && BROKEN
+	help
+	  This option enables hardware multithreading on RS64 cpus.
+	  pSeries systems p620 and p660 have such a cpu type.
 
 config DISCONTIGMEM
 	bool "Discontiguous Memory Support"
@@ -313,7 +316,7 @@
 
 config HOTPLUG_CPU
 	bool "Support for hot-pluggable CPUs"
-	depends on SMP && EXPERIMENTAL && PPC_PSERIES
+	depends on SMP && EXPERIMENTAL && (PPC_PSERIES || PPC_PMAC)
 	select HOTPLUG
 	---help---
 	  Say Y here to be able to turn CPUs off and on.
diff -Nru a/arch/ppc64/Makefile b/arch/ppc64/Makefile
--- a/arch/ppc64/Makefile	2005-01-07 21:44:07 -08:00
+++ b/arch/ppc64/Makefile	2005-03-04 22:41:55 -08:00
@@ -15,17 +15,38 @@
 
 KERNELLOAD	:= 0xc000000000000000
 
+# Set default 32 bits cross compilers for vdso and boot wrapper
+CROSS32_COMPILE ?=
+
+CROSS32CC		:= $(CROSS32_COMPILE)gcc
+CROSS32AS		:= $(CROSS32_COMPILE)as
+CROSS32LD		:= $(CROSS32_COMPILE)ld
+CROSS32OBJCOPY		:= $(CROSS32_COMPILE)objcopy
+
+# If we have a biarch compiler, use it for 32 bits cross compile if
+# CROSS32_COMPILE wasn't explicitely defined, and add proper explicit
+# target type to target compilers
+
 HAS_BIARCH      := $(call cc-option-yn, -m64)
 ifeq ($(HAS_BIARCH),y)
+ifeq ($(CROSS32_COMPILE),)
+CROSS32CC	:= $(CC) -m32
+CROSS32AS	:= $(AS) -a32
+CROSS32LD	:= $(LD) -m elf32ppc
+CROSS32OBJCOPY	:= $(OBJCOPY)
+endif
 AS              := $(AS) -a64
 LD              := $(LD) -m elf64ppc
 CC		:= $(CC) -m64
 endif
 
+export CROSS32CC CROSS32AS CROSS32LD CROSS32OBJCOPY
+
 new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
 
 ifeq ($(new_nm),y)
 NM		:= $(NM) --synthetic
+
 endif
 
 CHECKFLAGS	+= -m64 -D__powerpc__
@@ -65,14 +86,20 @@
 $(boottarget-y): vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
-bootimage-$(CONFIG_PPC_PSERIES) := zImage
-bootimage-$(CONFIG_PPC_MAPLE) := zImage
+bootimage-$(CONFIG_PPC_PSERIES) := $(boot)/zImage
+bootimage-$(CONFIG_PPC_PMAC) := vmlinux
+bootimage-$(CONFIG_PPC_MAPLE) := $(boot)/zImage
 bootimage-$(CONFIG_PPC_ISERIES) := vmlinux
 BOOTIMAGE := $(bootimage-y)
 install: vmlinux
 	$(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
 
-all: $(BOOTIMAGE)
+defaultimage-$(CONFIG_PPC_PSERIES) := zImage
+defaultimage-$(CONFIG_PPC_PMAC) := vmlinux
+defaultimage-$(CONFIG_PPC_MAPLE) := zImage
+defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
+KBUILD_IMAGE := $(defaultimage-y)
+all: $(KBUILD_IMAGE)
 
 archclean:
 	$(Q)$(MAKE) $(clean)=$(boot)
diff -Nru a/arch/ppc64/boot/Makefile b/arch/ppc64/boot/Makefile
--- a/arch/ppc64/boot/Makefile	2004-10-11 12:15:58 -07:00
+++ b/arch/ppc64/boot/Makefile	2005-03-04 22:41:55 -08:00
@@ -20,17 +20,11 @@
 #	CROSS32_COMPILE is setup as a prefix just like CROSS_COMPILE
 #	in the toplevel makefile.
 
-CROSS32_COMPILE ?=
-#CROSS32_COMPILE = /usr/local/ppc/bin/powerpc-linux-
 
-BOOTCC		:= $(CROSS32_COMPILE)gcc
 HOSTCC		:= gcc
 BOOTCFLAGS	:= $(HOSTCFLAGS) $(LINUXINCLUDE) -fno-builtin 
-BOOTAS		:= $(CROSS32_COMPILE)as
 BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional
-BOOTLD		:= $(CROSS32_COMPILE)ld
 BOOTLFLAGS	:= -Ttext 0x00400000 -e _start -T $(srctree)/$(src)/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 div64.S
@@ -38,10 +32,10 @@
 obj-boot := $(addsuffix .o, $(basename $(src-boot)))
 
 quiet_cmd_bootcc = BOOTCC  $@
-      cmd_bootcc = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
+      cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
 
 quiet_cmd_bootas = BOOTAS  $@
-      cmd_bootas = $(BOOTCC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
+      cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
 
 $(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
 	$(call if_changed_dep,bootcc)
@@ -77,15 +71,15 @@
 $(obj)/vmlinux.initrd: vmlinux.strip $(obj)/addRamDisk $(obj)/ramdisk.image.gz FORCE
 	$(call if_changed,ramdisk)
 
-addsection = $(BOOTOBJCOPY) $(1) \
+addsection = $(CROSS32OBJCOPY) $(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 $@
+      cmd_addnote = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(obj-boot) && $(obj)/addnote $@
 
 quiet_cmd_piggy = PIGGY   $@
-      cmd_piggy = $(obj)/piggyback $(@:.o=) < $< | $(BOOTAS) -o $@
+      cmd_piggy = $(obj)/piggyback $(@:.o=) < $< | $(CROSS32AS) -o $@
 
 $(call gz-sec, $(required)): $(obj)/kernel-%.gz: % FORCE
 	$(call if_changed,gzip)
@@ -117,7 +111,7 @@
 	awk '{printf "unsigned long vmlinux_memsize = 0x%s;\n", substr($$1,8)}' \
 		>> $(obj)/imagesize.c
 
-install: $(CONFIGURE) $(obj)/$(BOOTIMAGE)
-	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" "$(obj)/$(BOOTIMAGE)" "$(INSTALL_PATH)"
+install: $(CONFIGURE) $(BOOTIMAGE)
+	sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
 
 clean-files := $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip)
diff -Nru a/arch/ppc64/boot/install.sh b/arch/ppc64/boot/install.sh
--- a/arch/ppc64/boot/install.sh	2003-09-01 17:30:54 -07:00
+++ b/arch/ppc64/boot/install.sh	2005-03-04 22:41:55 -08:00
@@ -17,6 +17,7 @@
 #   $2 - kernel image file
 #   $3 - kernel map file
 #   $4 - default install path (blank if root directory)
+#   $5 - kernel boot file, the zImage
 #
 
 # User may have a custom install script
@@ -27,7 +28,7 @@
 # Default install
 
 # this should work for both the pSeries zImage and the iSeries vmlinux.sm
-image_name=`basename $2`
+image_name=`basename $5`
 
 if [ -f $4/$image_name ]; then
 	mv $4/$image_name $4/$image_name.old
diff -Nru a/arch/ppc64/boot/main.c b/arch/ppc64/boot/main.c
--- a/arch/ppc64/boot/main.c	2005-01-25 13:50:16 -08:00
+++ b/arch/ppc64/boot/main.c	2005-03-04 22:41:55 -08:00
@@ -200,7 +200,7 @@
 	vmlinux.addr += (unsigned long)elf64ph->p_offset;
 	vmlinux.size -= (unsigned long)elf64ph->p_offset;
 
-	flush_cache((void *)vmlinux.addr, vmlinux.memsize);
+	flush_cache((void *)vmlinux.addr, vmlinux.size);
 
 	if (a1)
 		printf("initrd head: 0x%lx\n\r", *((u32 *)initrd.addr));
diff -Nru a/arch/ppc64/configs/g5_defconfig b/arch/ppc64/configs/g5_defconfig
--- a/arch/ppc64/configs/g5_defconfig	2004-11-27 03:20:13 -08:00
+++ b/arch/ppc64/configs/g5_defconfig	2005-03-04 22:41:53 -08:00
@@ -1,11 +1,12 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.9-rc3
-# Thu Oct  7 15:18:38 2004
+# Linux kernel version: 2.6.11-rc3-bk6
+# Wed Feb  9 23:34:53 2005
 #
 CONFIG_64BIT=y
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_ISA_DMA=y
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_EARLY_PRINTK=y
@@ -18,6 +19,7 @@
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
+CONFIG_LOCK_KERNEL=y
 
 #
 # General setup
@@ -25,25 +27,26 @@
 CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_POSIX_MQUEUE is not set
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
-# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=17
 CONFIG_HOTPLUG=y
-# CONFIG_IKCONFIG is not set
+CONFIG_KOBJECT_UEVENT=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
 # CONFIG_KALLSYMS_ALL is not set
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
 # CONFIG_TINY_SHMEM is not set
 
 #
@@ -51,10 +54,11 @@
 #
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
-# CONFIG_KMOD is not set
+CONFIG_MODVERSIONS=y
+CONFIG_MODULE_SRCVERSION_ALL=y
+CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 CONFIG_SYSVIPC_COMPAT=y
 
@@ -65,6 +69,7 @@
 CONFIG_PPC_MULTIPLATFORM=y
 # CONFIG_PPC_PSERIES is not set
 CONFIG_PPC_PMAC=y
+# CONFIG_PPC_MAPLE is not set
 CONFIG_PPC=y
 CONFIG_PPC64=y
 CONFIG_PPC_OF=y
@@ -75,12 +80,10 @@
 CONFIG_POWER4_ONLY=y
 CONFIG_IOMMU_VMERGE=y
 CONFIG_SMP=y
-CONFIG_IRQ_ALL_CPUS=y
 CONFIG_NR_CPUS=2
 # CONFIG_SCHED_SMT is not set
 # CONFIG_PREEMPT is not set
-# CONFIG_PPC_RTAS is not set
-# CONFIG_LPARCFG is not set
+CONFIG_GENERIC_HARDIRQS=y
 
 #
 # General setup
@@ -91,12 +94,15 @@
 # CONFIG_BINFMT_MISC is not set
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
-# CONFIG_HOTPLUG_CPU is not set
 
 #
-# PCMCIA/CardBus support
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
 #
-# CONFIG_PCMCIA is not set
 
 #
 # PCI Hotplug Support
@@ -139,14 +145,29 @@
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 CONFIG_BLK_DEV_NBD=m
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
 CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=8192
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=65536
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_CDROM_PKTCDVD=m
+CONFIG_CDROM_PKTCDVD_BUFFERS=8
+# CONFIG_CDROM_PKTCDVD_WCACHE is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -161,11 +182,10 @@
 CONFIG_BLK_DEV_IDEDISK=y
 # CONFIG_IDEDISK_MULTI_MODE is not set
 CONFIG_BLK_DEV_IDECD=y
-CONFIG_BLK_DEV_IDETAPE=y
-CONFIG_BLK_DEV_IDEFLOPPY=y
+# CONFIG_BLK_DEV_IDETAPE is not set
+# CONFIG_BLK_DEV_IDEFLOPPY is not set
 # CONFIG_BLK_DEV_IDESCSI is not set
 # CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
 
 #
 # IDE chipset support/bugfixes
@@ -205,7 +225,6 @@
 CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
 CONFIG_BLK_DEV_IDEDMA_PMAC=y
 # CONFIG_BLK_DEV_IDE_PMAC_BLINK is not set
-CONFIG_BLK_DEV_IDEDMA_PMAC_AUTO=y
 # CONFIG_IDE_ARM is not set
 CONFIG_BLK_DEV_IDEDMA=y
 # CONFIG_IDEDMA_IVB is not set
@@ -240,6 +259,7 @@
 #
 CONFIG_SCSI_SPI_ATTRS=y
 # CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
 
 #
 # SCSI low-level drivers
@@ -254,6 +274,7 @@
 # CONFIG_MEGARAID_NEWGEN is not set
 # CONFIG_MEGARAID_LEGACY is not set
 CONFIG_SCSI_SATA=y
+# CONFIG_SCSI_SATA_AHCI is not set
 CONFIG_SCSI_SATA_SVW=y
 # CONFIG_SCSI_ATA_PIIX is not set
 # CONFIG_SCSI_SATA_NV is not set
@@ -261,6 +282,7 @@
 # CONFIG_SCSI_SATA_SX4 is not set
 # CONFIG_SCSI_SATA_SIL is not set
 # CONFIG_SCSI_SATA_SIS is not set
+# CONFIG_SCSI_SATA_ULI is not set
 # CONFIG_SCSI_SATA_VIA is not set
 # CONFIG_SCSI_SATA_VITESSE is not set
 # CONFIG_SCSI_BUSLOGIC is not set
@@ -270,12 +292,9 @@
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
 # CONFIG_SCSI_GDTH is not set
 # CONFIG_SCSI_IPS is not set
+# CONFIG_SCSI_INITIO is not set
 # CONFIG_SCSI_INIA100 is not set
-CONFIG_SCSI_SYM53C8XX_2=y
-CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
-CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
-CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
-# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
+# CONFIG_SCSI_SYM53C8XX_2 is not set
 # CONFIG_SCSI_IPR is not set
 # CONFIG_SCSI_QLOGIC_ISP is not set
 # CONFIG_SCSI_QLOGIC_FC is not set
@@ -286,11 +305,9 @@
 # CONFIG_SCSI_QLA2300 is not set
 # CONFIG_SCSI_QLA2322 is not set
 # CONFIG_SCSI_QLA6312 is not set
-# CONFIG_SCSI_QLA6322 is not set
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
 # CONFIG_SCSI_DEBUG is not set
-# CONFIG_SCSI_MAC53C94 is not set
 
 #
 # Multi-device support (RAID and LVM)
@@ -300,15 +317,16 @@
 CONFIG_MD_LINEAR=y
 CONFIG_MD_RAID0=y
 CONFIG_MD_RAID1=y
-# CONFIG_MD_RAID10 is not set
+CONFIG_MD_RAID10=m
 CONFIG_MD_RAID5=y
-# CONFIG_MD_RAID6 is not set
-# CONFIG_MD_MULTIPATH is not set
+CONFIG_MD_RAID6=m
+CONFIG_MD_MULTIPATH=m
+CONFIG_MD_FAULTY=m
 CONFIG_BLK_DEV_DM=y
-# CONFIG_DM_CRYPT is not set
-# CONFIG_DM_SNAPSHOT is not set
-# CONFIG_DM_MIRROR is not set
-# CONFIG_DM_ZERO is not set
+CONFIG_DM_CRYPT=m
+CONFIG_DM_SNAPSHOT=m
+CONFIG_DM_MIRROR=m
+CONFIG_DM_ZERO=m
 
 #
 # Fusion MPT device support
@@ -386,6 +404,8 @@
 CONFIG_INET_ESP=m
 CONFIG_INET_IPCOMP=m
 CONFIG_INET_TUNNEL=y
+CONFIG_IP_TCPDIAG=m
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 
 #
 # IP: Virtual Server Configuration
@@ -398,61 +418,71 @@
 #
 # IP: Netfilter Configuration
 #
-CONFIG_IP_NF_CONNTRACK=y
-# CONFIG_IP_NF_CT_ACCT is not set
-# CONFIG_IP_NF_CT_PROTO_SCTP is not set
-# CONFIG_IP_NF_FTP is not set
-# CONFIG_IP_NF_IRC is not set
-# CONFIG_IP_NF_TFTP is not set
-# CONFIG_IP_NF_AMANDA is not set
-CONFIG_IP_NF_QUEUE=y
-CONFIG_IP_NF_IPTABLES=y
-CONFIG_IP_NF_MATCH_LIMIT=y
-CONFIG_IP_NF_MATCH_IPRANGE=y
-CONFIG_IP_NF_MATCH_MAC=y
-CONFIG_IP_NF_MATCH_PKTTYPE=y
-CONFIG_IP_NF_MATCH_MARK=y
-CONFIG_IP_NF_MATCH_MULTIPORT=y
-CONFIG_IP_NF_MATCH_TOS=y
-CONFIG_IP_NF_MATCH_RECENT=y
-CONFIG_IP_NF_MATCH_ECN=y
-CONFIG_IP_NF_MATCH_DSCP=y
-CONFIG_IP_NF_MATCH_AH_ESP=y
-CONFIG_IP_NF_MATCH_LENGTH=y
-CONFIG_IP_NF_MATCH_TTL=y
-CONFIG_IP_NF_MATCH_TCPMSS=y
-CONFIG_IP_NF_MATCH_HELPER=y
-CONFIG_IP_NF_MATCH_STATE=y
-CONFIG_IP_NF_MATCH_CONNTRACK=y
-CONFIG_IP_NF_MATCH_OWNER=y
-# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
-# CONFIG_IP_NF_MATCH_REALM is not set
-# CONFIG_IP_NF_MATCH_SCTP is not set
-# CONFIG_IP_NF_MATCH_COMMENT is not set
-CONFIG_IP_NF_FILTER=y
-CONFIG_IP_NF_TARGET_REJECT=y
-CONFIG_IP_NF_TARGET_LOG=y
-CONFIG_IP_NF_TARGET_ULOG=y
-CONFIG_IP_NF_TARGET_TCPMSS=y
-CONFIG_IP_NF_NAT=y
+CONFIG_IP_NF_CONNTRACK=m
+CONFIG_IP_NF_CT_ACCT=y
+CONFIG_IP_NF_CONNTRACK_MARK=y
+CONFIG_IP_NF_CT_PROTO_SCTP=m
+CONFIG_IP_NF_FTP=m
+CONFIG_IP_NF_IRC=m
+CONFIG_IP_NF_TFTP=m
+CONFIG_IP_NF_AMANDA=m
+CONFIG_IP_NF_QUEUE=m
+CONFIG_IP_NF_IPTABLES=m
+CONFIG_IP_NF_MATCH_LIMIT=m
+CONFIG_IP_NF_MATCH_IPRANGE=m
+CONFIG_IP_NF_MATCH_MAC=m
+CONFIG_IP_NF_MATCH_PKTTYPE=m
+CONFIG_IP_NF_MATCH_MARK=m
+CONFIG_IP_NF_MATCH_MULTIPORT=m
+CONFIG_IP_NF_MATCH_TOS=m
+CONFIG_IP_NF_MATCH_RECENT=m
+CONFIG_IP_NF_MATCH_ECN=m
+CONFIG_IP_NF_MATCH_DSCP=m
+CONFIG_IP_NF_MATCH_AH_ESP=m
+CONFIG_IP_NF_MATCH_LENGTH=m
+CONFIG_IP_NF_MATCH_TTL=m
+CONFIG_IP_NF_MATCH_TCPMSS=m
+CONFIG_IP_NF_MATCH_HELPER=m
+CONFIG_IP_NF_MATCH_STATE=m
+CONFIG_IP_NF_MATCH_CONNTRACK=m
+CONFIG_IP_NF_MATCH_OWNER=m
+CONFIG_IP_NF_MATCH_ADDRTYPE=m
+CONFIG_IP_NF_MATCH_REALM=m
+CONFIG_IP_NF_MATCH_SCTP=m
+CONFIG_IP_NF_MATCH_COMMENT=m
+CONFIG_IP_NF_MATCH_CONNMARK=m
+CONFIG_IP_NF_MATCH_HASHLIMIT=m
+CONFIG_IP_NF_FILTER=m
+CONFIG_IP_NF_TARGET_REJECT=m
+CONFIG_IP_NF_TARGET_LOG=m
+CONFIG_IP_NF_TARGET_ULOG=m
+CONFIG_IP_NF_TARGET_TCPMSS=m
+CONFIG_IP_NF_NAT=m
 CONFIG_IP_NF_NAT_NEEDED=y
-CONFIG_IP_NF_TARGET_MASQUERADE=y
-CONFIG_IP_NF_TARGET_REDIRECT=y
-CONFIG_IP_NF_TARGET_NETMAP=y
-CONFIG_IP_NF_TARGET_SAME=y
-# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
-CONFIG_IP_NF_MANGLE=y
-CONFIG_IP_NF_TARGET_TOS=y
-CONFIG_IP_NF_TARGET_ECN=y
-CONFIG_IP_NF_TARGET_DSCP=y
-CONFIG_IP_NF_TARGET_MARK=y
-CONFIG_IP_NF_TARGET_CLASSIFY=y
-# CONFIG_IP_NF_RAW is not set
-CONFIG_IP_NF_ARPTABLES=y
-CONFIG_IP_NF_ARPFILTER=y
-CONFIG_IP_NF_ARP_MANGLE=y
+CONFIG_IP_NF_TARGET_MASQUERADE=m
+CONFIG_IP_NF_TARGET_REDIRECT=m
+CONFIG_IP_NF_TARGET_NETMAP=m
+CONFIG_IP_NF_TARGET_SAME=m
+CONFIG_IP_NF_NAT_SNMP_BASIC=m
+CONFIG_IP_NF_NAT_IRC=m
+CONFIG_IP_NF_NAT_FTP=m
+CONFIG_IP_NF_NAT_TFTP=m
+CONFIG_IP_NF_NAT_AMANDA=m
+CONFIG_IP_NF_MANGLE=m
+CONFIG_IP_NF_TARGET_TOS=m
+CONFIG_IP_NF_TARGET_ECN=m
+CONFIG_IP_NF_TARGET_DSCP=m
+CONFIG_IP_NF_TARGET_MARK=m
+CONFIG_IP_NF_TARGET_CLASSIFY=m
+CONFIG_IP_NF_TARGET_CONNMARK=m
+CONFIG_IP_NF_TARGET_CLUSTERIP=m
+CONFIG_IP_NF_RAW=m
+CONFIG_IP_NF_TARGET_NOTRACK=m
+CONFIG_IP_NF_ARPTABLES=m
+CONFIG_IP_NF_ARPFILTER=m
+CONFIG_IP_NF_ARP_MANGLE=m
 CONFIG_XFRM=y
-# CONFIG_XFRM_USER is not set
+CONFIG_XFRM_USER=m
 
 #
 # SCTP Configuration (EXPERIMENTAL)
@@ -471,13 +501,12 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
 #
 # CONFIG_NET_SCHED is not set
-# CONFIG_NET_CLS_ROUTE is not set
+CONFIG_NET_CLS_ROUTE=y
 
 #
 # Network testing
@@ -587,7 +616,7 @@
 # Userland interfaces
 #
 CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 CONFIG_INPUT_JOYDEV=m
@@ -663,7 +692,6 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 CONFIG_RAW_DRIVER=y
 CONFIG_MAX_RAW_DEVS=256
@@ -693,6 +721,7 @@
 # CONFIG_I2C_I810 is not set
 # CONFIG_I2C_ISA is not set
 CONFIG_I2C_KEYWEST=y
+# CONFIG_I2C_MPC is not set
 # CONFIG_I2C_NFORCE2 is not set
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PROSAVAGE is not set
@@ -701,6 +730,7 @@
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_STUB is not set
 # CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
 # CONFIG_I2C_VOODOO3 is not set
@@ -712,20 +742,25 @@
 # CONFIG_I2C_SENSOR is not set
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
 # CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ASB100 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_FSCHER is not set
 # CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
 # CONFIG_SENSORS_LM80 is not set
 # CONFIG_SENSORS_LM83 is not set
 # CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
 # CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
 # CONFIG_SENSORS_SMSC47M1 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_W83781D is not set
@@ -768,6 +803,7 @@
 #
 CONFIG_FB=y
 CONFIG_FB_MODE_HELPERS=y
+CONFIG_FB_TILEBLITTING=y
 # CONFIG_FB_CIRRUS is not set
 # CONFIG_FB_PM2 is not set
 # CONFIG_FB_CYBER2000 is not set
@@ -789,6 +825,7 @@
 # CONFIG_FB_RADEON_DEBUG is not set
 # CONFIG_FB_ATY128 is not set
 # CONFIG_FB_ATY is not set
+# CONFIG_FB_SAVAGE is not set
 # CONFIG_FB_SIS is not set
 # CONFIG_FB_NEOMAGIC is not set
 # CONFIG_FB_KYRO is not set
@@ -814,6 +851,11 @@
 CONFIG_LOGO_LINUX_MONO=y
 CONFIG_LOGO_LINUX_VGA16=y
 CONFIG_LOGO_LINUX_CLUT224=y
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_BACKLIGHT_CLASS_DEVICE=m
+CONFIG_BACKLIGHT_DEVICE=y
+CONFIG_LCD_CLASS_DEVICE=m
+CONFIG_LCD_DEVICE=y
 
 #
 # Sound
@@ -833,6 +875,8 @@
 # CONFIG_USB_BANDWIDTH is not set
 # CONFIG_USB_DYNAMIC_MINORS is not set
 # CONFIG_USB_OTG is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
 
 #
 # USB Host Controller Drivers
@@ -842,6 +886,7 @@
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 CONFIG_USB_OHCI_HCD=y
 # CONFIG_USB_UHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
 
 #
 # USB Device Class drivers
@@ -849,9 +894,13 @@
 # CONFIG_USB_BLUETOOTH_TTY is not set
 CONFIG_USB_ACM=m
 CONFIG_USB_PRINTER=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 CONFIG_USB_STORAGE=y
 # CONFIG_USB_STORAGE_DEBUG is not set
-# CONFIG_USB_STORAGE_RW_DETECT is not set
+CONFIG_USB_STORAGE_RW_DETECT=y
 CONFIG_USB_STORAGE_DATAFAB=y
 CONFIG_USB_STORAGE_FREECOM=y
 CONFIG_USB_STORAGE_ISD200=y
@@ -862,7 +911,7 @@
 CONFIG_USB_STORAGE_JUMPSHOT=y
 
 #
-# USB Human Interface Devices (HID)
+# USB Input Devices
 #
 CONFIG_USB_HID=y
 CONFIG_USB_HIDINPUT=y
@@ -885,7 +934,6 @@
 #
 # CONFIG_USB_MDC800 is not set
 # CONFIG_USB_MICROTEK is not set
-# CONFIG_USB_HPUSBSCSI is not set
 
 #
 # USB Multimedia devices
@@ -897,12 +945,12 @@
 #
 
 #
-# USB Network adaptors
+# USB Network Adapters
 #
-# CONFIG_USB_CATC is not set
-# CONFIG_USB_KAWETH is not set
-# CONFIG_USB_PEGASUS is not set
-# CONFIG_USB_RTL8150 is not set
+CONFIG_USB_CATC=m
+CONFIG_USB_KAWETH=m
+CONFIG_USB_PEGASUS=m
+CONFIG_USB_RTL8150=m
 CONFIG_USB_USBNET=m
 
 #
@@ -914,6 +962,7 @@
 CONFIG_USB_GENESYS=y
 CONFIG_USB_NET1080=y
 CONFIG_USB_PL2301=y
+CONFIG_USB_KC2190=y
 
 #
 # Intelligent USB Devices/Gadgets
@@ -939,6 +988,7 @@
 CONFIG_USB_SERIAL_GENERIC=y
 CONFIG_USB_SERIAL_BELKIN=m
 CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
+CONFIG_USB_SERIAL_CYPRESS_M8=m
 CONFIG_USB_SERIAL_EMPEG=m
 CONFIG_USB_SERIAL_FTDI_SIO=m
 CONFIG_USB_SERIAL_VISOR=m
@@ -946,6 +996,8 @@
 CONFIG_USB_SERIAL_IR=m
 CONFIG_USB_SERIAL_EDGEPORT=m
 CONFIG_USB_SERIAL_EDGEPORT_TI=m
+CONFIG_USB_SERIAL_GARMIN=m
+CONFIG_USB_SERIAL_IPW=m
 CONFIG_USB_SERIAL_KEYSPAN_PDA=m
 CONFIG_USB_SERIAL_KEYSPAN=m
 CONFIG_USB_SERIAL_KEYSPAN_MPR=y
@@ -966,6 +1018,7 @@
 CONFIG_USB_SERIAL_PL2303=m
 CONFIG_USB_SERIAL_SAFE=m
 CONFIG_USB_SERIAL_SAFE_PADDED=y
+CONFIG_USB_SERIAL_TI=m
 CONFIG_USB_SERIAL_CYBERJACK=m
 CONFIG_USB_SERIAL_XIRCOM=m
 CONFIG_USB_SERIAL_OMNINET=m
@@ -976,42 +1029,72 @@
 #
 # CONFIG_USB_EMI62 is not set
 # CONFIG_USB_EMI26 is not set
-# CONFIG_USB_TIGL is not set
 # CONFIG_USB_AUERSWALD is not set
 # CONFIG_USB_RIO500 is not set
 # CONFIG_USB_LEGOTOWER is not set
 # CONFIG_USB_LCD is not set
 # CONFIG_USB_LED is not set
 # CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGETKIT is not set
 # CONFIG_USB_PHIDGETSERVO is not set
+# CONFIG_USB_IDMOUSE is not set
 # CONFIG_USB_TEST is not set
 
 #
+# USB ATM/DSL drivers
+#
+
+#
 # USB Gadget Support
 #
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
 CONFIG_EXT2_FS_XATTR=y
 CONFIG_EXT2_FS_POSIX_ACL=y
-# CONFIG_EXT2_FS_SECURITY is not set
+CONFIG_EXT2_FS_SECURITY=y
 CONFIG_EXT3_FS=y
 CONFIG_EXT3_FS_XATTR=y
 CONFIG_EXT3_FS_POSIX_ACL=y
-# CONFIG_EXT3_FS_SECURITY is not set
+CONFIG_EXT3_FS_SECURITY=y
 CONFIG_JBD=y
 # CONFIG_JBD_DEBUG is not set
 CONFIG_FS_MBCACHE=y
-# CONFIG_REISERFS_FS is not set
+CONFIG_REISERFS_FS=y
+# CONFIG_REISERFS_CHECK is not set
+# CONFIG_REISERFS_PROC_INFO is not set
+CONFIG_REISERFS_FS_XATTR=y
+CONFIG_REISERFS_FS_POSIX_ACL=y
+CONFIG_REISERFS_FS_SECURITY=y
 # CONFIG_JFS_FS is not set
 CONFIG_FS_POSIX_ACL=y
-# CONFIG_XFS_FS is not set
+
+#
+# XFS support
+#
+CONFIG_XFS_FS=m
+CONFIG_XFS_EXPORT=y
+# CONFIG_XFS_RT is not set
+# CONFIG_XFS_QUOTA is not set
+CONFIG_XFS_SECURITY=y
+CONFIG_XFS_POSIX_ACL=y
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 CONFIG_AUTOFS_FS=m
 # CONFIG_AUTOFS4_FS is not set
 
@@ -1019,8 +1102,9 @@
 # CD-ROM/DVD Filesystems
 #
 CONFIG_ISO9660_FS=y
-# CONFIG_JOLIET is not set
-# CONFIG_ZISOFS is not set
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+CONFIG_ZISOFS_FS=y
 CONFIG_UDF_FS=m
 CONFIG_UDF_NLS=y
 
@@ -1044,6 +1128,8 @@
 CONFIG_DEVPTS_FS_XATTR=y
 # CONFIG_DEVPTS_FS_SECURITY is not set
 CONFIG_TMPFS=y
+CONFIG_TMPFS_XATTR=y
+CONFIG_TMPFS_SECURITY=y
 CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
 CONFIG_RAMFS=y
@@ -1053,8 +1139,8 @@
 #
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
+CONFIG_HFS_FS=m
+CONFIG_HFSPLUS_FS=m
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
@@ -1087,7 +1173,7 @@
 CONFIG_CIFS=m
 # CONFIG_CIFS_STATS is not set
 # CONFIG_CIFS_XATTR is not set
-# CONFIG_CIFS_POSIX is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
@@ -1117,7 +1203,7 @@
 #
 CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_CODEPAGE_437 is not set
+CONFIG_NLS_CODEPAGE_437=y
 # CONFIG_NLS_CODEPAGE_737 is not set
 # CONFIG_NLS_CODEPAGE_775 is not set
 # CONFIG_NLS_CODEPAGE_850 is not set
@@ -1138,10 +1224,10 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-# CONFIG_NLS_CODEPAGE_1250 is not set
-# CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ASCII is not set
-# CONFIG_NLS_ISO8859_1 is not set
+CONFIG_NLS_CODEPAGE_1250=y
+CONFIG_NLS_CODEPAGE_1251=y
+CONFIG_NLS_ASCII=y
+CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
 # CONFIG_NLS_ISO8859_3 is not set
 # CONFIG_NLS_ISO8859_4 is not set
@@ -1151,10 +1237,10 @@
 # CONFIG_NLS_ISO8859_9 is not set
 # CONFIG_NLS_ISO8859_13 is not set
 # CONFIG_NLS_ISO8859_14 is not set
-# CONFIG_NLS_ISO8859_15 is not set
+CONFIG_NLS_ISO8859_15=y
 # CONFIG_NLS_KOI8_R is not set
 # CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
+CONFIG_NLS_UTF8=y
 
 #
 # Profiling support
@@ -1167,19 +1253,23 @@
 #
 CONFIG_DEBUG_KERNEL=y
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHEDSTATS is not set
 # CONFIG_DEBUG_SLAB is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_KOBJECT is not set
 # CONFIG_DEBUG_INFO is not set
+CONFIG_DEBUG_FS=y
 # CONFIG_DEBUG_STACKOVERFLOW is not set
+# CONFIG_KPROBES is not set
 # CONFIG_DEBUG_STACK_USAGE is not set
 # CONFIG_DEBUGGER is not set
 # CONFIG_PPCDBG is not set
 CONFIG_IRQSTACKS=y
-# CONFIG_SCHEDSTATS is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -1193,7 +1283,7 @@
 CONFIG_CRYPTO_SHA1=m
 CONFIG_CRYPTO_SHA256=m
 CONFIG_CRYPTO_SHA512=m
-# CONFIG_CRYPTO_WP512 is not set
+CONFIG_CRYPTO_WP512=m
 CONFIG_CRYPTO_DES=y
 CONFIG_CRYPTO_BLOWFISH=m
 CONFIG_CRYPTO_TWOFISH=m
@@ -1201,19 +1291,24 @@
 CONFIG_CRYPTO_AES=m
 CONFIG_CRYPTO_CAST5=m
 CONFIG_CRYPTO_CAST6=m
-# CONFIG_CRYPTO_TEA is not set
+CONFIG_CRYPTO_TEA=m
 CONFIG_CRYPTO_ARC4=m
-# CONFIG_CRYPTO_KHAZAD is not set
+CONFIG_CRYPTO_KHAZAD=m
+CONFIG_CRYPTO_ANUBIS=m
 CONFIG_CRYPTO_DEFLATE=m
 CONFIG_CRYPTO_MICHAEL_MIC=m
-# CONFIG_CRYPTO_CRC32C is not set
+CONFIG_CRYPTO_CRC32C=m
 CONFIG_CRYPTO_TEST=m
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
 CONFIG_CRC_CCITT=m
 CONFIG_CRC32=y
-# CONFIG_LIBCRC32C is not set
+CONFIG_LIBCRC32C=m
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=m
diff -Nru a/arch/ppc64/configs/iSeries_defconfig b/arch/ppc64/configs/iSeries_defconfig
--- a/arch/ppc64/configs/iSeries_defconfig	2004-11-27 03:20:13 -08:00
+++ b/arch/ppc64/configs/iSeries_defconfig	2005-03-04 22:41:53 -08:00
@@ -1,9 +1,12 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-rc3-bk6
+# Wed Feb  9 23:34:52 2005
 #
 CONFIG_64BIT=y
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_ISA_DMA=y
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_EARLY_PRINTK=y
@@ -16,19 +19,20 @@
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
+CONFIG_LOCK_KERNEL=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
-CONFIG_AUDIT=y
-CONFIG_AUDITSYSCALL=y
 CONFIG_LOG_BUF_SHIFT=17
 CONFIG_HOTPLUG=y
+CONFIG_KOBJECT_UEVENT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
@@ -37,12 +41,12 @@
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
 # CONFIG_TINY_SHMEM is not set
 
 #
@@ -52,8 +56,9 @@
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
-# CONFIG_KMOD is not set
+CONFIG_MODVERSIONS=y
+CONFIG_MODULE_SRCVERSION_ALL=y
+CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 CONFIG_SYSVIPC_COMPAT=y
 
@@ -61,15 +66,17 @@
 # Platform support
 #
 CONFIG_PPC_ISERIES=y
-# CONFIG_PPC_PSERIES is not set
+# CONFIG_PPC_MULTIPLATFORM is not set
 CONFIG_PPC=y
 CONFIG_PPC64=y
+CONFIG_IBMVIO=y
 # CONFIG_POWER4_ONLY is not set
 CONFIG_IOMMU_VMERGE=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=32
 # CONFIG_SCHED_SMT is not set
 # CONFIG_PREEMPT is not set
+CONFIG_GENERIC_HARDIRQS=y
 CONFIG_MSCHUNKS=y
 CONFIG_LPARCFG=y
 
@@ -82,12 +89,15 @@
 # CONFIG_BINFMT_MISC is not set
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
-# CONFIG_HOTPLUG_CPU is not set
 
 #
-# PCMCIA/CardBus support
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
 #
-# CONFIG_PCMCIA is not set
 
 #
 # PCI Hotplug Support
@@ -128,13 +138,26 @@
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 CONFIG_BLK_DEV_NBD=m
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=4096
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=65536
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -169,6 +192,7 @@
 #
 CONFIG_SCSI_SPI_ATTRS=y
 CONFIG_SCSI_FC_ATTRS=y
+# CONFIG_SCSI_ISCSI_ATTRS is not set
 
 #
 # SCSI low-level drivers
@@ -191,6 +215,7 @@
 # CONFIG_SCSI_GDTH is not set
 # CONFIG_SCSI_IPS is not set
 CONFIG_SCSI_IBMVSCSI=m
+# CONFIG_SCSI_INITIO is not set
 # CONFIG_SCSI_INIA100 is not set
 # CONFIG_SCSI_SYM53C8XX_2 is not set
 # CONFIG_SCSI_IPR is not set
@@ -203,7 +228,6 @@
 # CONFIG_SCSI_QLA2300 is not set
 # CONFIG_SCSI_QLA2322 is not set
 # CONFIG_SCSI_QLA6312 is not set
-# CONFIG_SCSI_QLA6322 is not set
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
 # CONFIG_SCSI_DEBUG is not set
@@ -220,6 +244,7 @@
 CONFIG_MD_RAID5=y
 CONFIG_MD_RAID6=m
 CONFIG_MD_MULTIPATH=m
+CONFIG_MD_FAULTY=m
 CONFIG_BLK_DEV_DM=y
 CONFIG_DM_CRYPT=m
 CONFIG_DM_SNAPSHOT=m
@@ -271,6 +296,8 @@
 CONFIG_INET_ESP=m
 CONFIG_INET_IPCOMP=m
 CONFIG_INET_TUNNEL=y
+CONFIG_IP_TCPDIAG=m
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 
 #
 # IP: Virtual Server Configuration
@@ -284,6 +311,9 @@
 # IP: Netfilter Configuration
 #
 CONFIG_IP_NF_CONNTRACK=m
+CONFIG_IP_NF_CT_ACCT=y
+CONFIG_IP_NF_CONNTRACK_MARK=y
+CONFIG_IP_NF_CT_PROTO_SCTP=m
 CONFIG_IP_NF_FTP=m
 CONFIG_IP_NF_IRC=m
 CONFIG_IP_NF_TFTP=m
@@ -308,8 +338,17 @@
 CONFIG_IP_NF_MATCH_STATE=m
 CONFIG_IP_NF_MATCH_CONNTRACK=m
 CONFIG_IP_NF_MATCH_OWNER=m
+CONFIG_IP_NF_MATCH_ADDRTYPE=m
+CONFIG_IP_NF_MATCH_REALM=m
+CONFIG_IP_NF_MATCH_SCTP=m
+CONFIG_IP_NF_MATCH_COMMENT=m
+CONFIG_IP_NF_MATCH_CONNMARK=m
+CONFIG_IP_NF_MATCH_HASHLIMIT=m
 CONFIG_IP_NF_FILTER=m
 CONFIG_IP_NF_TARGET_REJECT=m
+CONFIG_IP_NF_TARGET_LOG=m
+CONFIG_IP_NF_TARGET_ULOG=m
+CONFIG_IP_NF_TARGET_TCPMSS=m
 CONFIG_IP_NF_NAT=m
 CONFIG_IP_NF_NAT_NEEDED=y
 CONFIG_IP_NF_TARGET_MASQUERADE=m
@@ -327,21 +366,13 @@
 CONFIG_IP_NF_TARGET_DSCP=m
 CONFIG_IP_NF_TARGET_MARK=m
 CONFIG_IP_NF_TARGET_CLASSIFY=m
-CONFIG_IP_NF_TARGET_LOG=m
-CONFIG_IP_NF_TARGET_ULOG=m
-CONFIG_IP_NF_TARGET_TCPMSS=m
+CONFIG_IP_NF_TARGET_CONNMARK=m
+CONFIG_IP_NF_TARGET_CLUSTERIP=m
+CONFIG_IP_NF_RAW=m
+CONFIG_IP_NF_TARGET_NOTRACK=m
 CONFIG_IP_NF_ARPTABLES=m
 CONFIG_IP_NF_ARPFILTER=m
 CONFIG_IP_NF_ARP_MANGLE=m
-CONFIG_IP_NF_COMPAT_IPCHAINS=m
-CONFIG_IP_NF_COMPAT_IPFWADM=m
-CONFIG_IP_NF_TARGET_NOTRACK=m
-CONFIG_IP_NF_RAW=m
-CONFIG_IP_NF_MATCH_ADDRTYPE=m
-CONFIG_IP_NF_MATCH_REALM=m
-# CONFIG_IP_NF_CT_ACCT is not set
-CONFIG_IP_NF_MATCH_SCTP=m
-CONFIG_IP_NF_CT_PROTO_SCTP=m
 CONFIG_XFRM=y
 CONFIG_XFRM_USER=m
 
@@ -362,7 +393,6 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
@@ -425,19 +455,21 @@
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
 # CONFIG_VIA_RHINE is not set
-# CONFIG_VIA_VELOCITY is not set
 
 #
 # Ethernet (1000 Mbit)
 #
-# CONFIG_ACENIC is not set
+CONFIG_ACENIC=m
+# CONFIG_ACENIC_OMIT_TIGON_I is not set
 # CONFIG_DL2K is not set
-# CONFIG_E1000 is not set
+CONFIG_E1000=m
+# CONFIG_E1000_NAPI is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
 # CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 
 #
@@ -498,7 +530,7 @@
 # Userland interfaces
 #
 CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
@@ -511,11 +543,8 @@
 #
 # CONFIG_GAMEPORT is not set
 CONFIG_SOUND_GAMEPORT=y
-CONFIG_SERIO=y
+# CONFIG_SERIO is not set
 # CONFIG_SERIO_I8042 is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_CT82C710 is not set
-# CONFIG_SERIO_PCIPS2 is not set
 
 #
 # Input Device Drivers
@@ -563,7 +592,6 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 CONFIG_RAW_DRIVER=y
 CONFIG_MAX_RAW_DEVS=256
@@ -606,6 +634,12 @@
 # USB support
 #
 # CONFIG_USB is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 
 #
 # USB Gadget Support
@@ -613,16 +647,26 @@
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
 CONFIG_EXT2_FS_XATTR=y
 CONFIG_EXT2_FS_POSIX_ACL=y
-# CONFIG_EXT2_FS_SECURITY is not set
+CONFIG_EXT2_FS_SECURITY=y
 CONFIG_EXT3_FS=y
 CONFIG_EXT3_FS_XATTR=y
 CONFIG_EXT3_FS_POSIX_ACL=y
-# CONFIG_EXT3_FS_SECURITY is not set
+CONFIG_EXT3_FS_SECURITY=y
 CONFIG_JBD=y
 # CONFIG_JBD_DEBUG is not set
 CONFIG_FS_MBCACHE=y
@@ -631,20 +675,27 @@
 # CONFIG_REISERFS_PROC_INFO is not set
 CONFIG_REISERFS_FS_XATTR=y
 CONFIG_REISERFS_FS_POSIX_ACL=y
-# CONFIG_REISERFS_FS_SECURITY is not set
+CONFIG_REISERFS_FS_SECURITY=y
 CONFIG_JFS_FS=m
 CONFIG_JFS_POSIX_ACL=y
+CONFIG_JFS_SECURITY=y
 # CONFIG_JFS_DEBUG is not set
 # CONFIG_JFS_STATISTICS is not set
 CONFIG_FS_POSIX_ACL=y
+
+#
+# XFS support
+#
 CONFIG_XFS_FS=m
+CONFIG_XFS_EXPORT=y
 # CONFIG_XFS_RT is not set
 # CONFIG_XFS_QUOTA is not set
-# CONFIG_XFS_SECURITY is not set
+CONFIG_XFS_SECURITY=y
 CONFIG_XFS_POSIX_ACL=y
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 CONFIG_AUTOFS_FS=m
 # CONFIG_AUTOFS4_FS is not set
 
@@ -652,8 +703,9 @@
 # CD-ROM/DVD Filesystems
 #
 CONFIG_ISO9660_FS=y
-# CONFIG_JOLIET is not set
-# CONFIG_ZISOFS is not set
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+CONFIG_ZISOFS_FS=y
 CONFIG_UDF_FS=m
 CONFIG_UDF_NLS=y
 
@@ -675,8 +727,10 @@
 CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
-# CONFIG_DEVPTS_FS_SECURITY is not set
+CONFIG_DEVPTS_FS_SECURITY=y
 CONFIG_TMPFS=y
+CONFIG_TMPFS_XATTR=y
+CONFIG_TMPFS_SECURITY=y
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
@@ -721,6 +775,7 @@
 # CONFIG_CIFS_STATS is not set
 CONFIG_CIFS_XATTR=y
 CONFIG_CIFS_POSIX=y
+# CONFIG_CIFS_EXPERIMENTAL is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
@@ -795,19 +850,23 @@
 #
 CONFIG_DEBUG_KERNEL=y
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHEDSTATS is not set
 # CONFIG_DEBUG_SLAB is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_KOBJECT is not set
 # CONFIG_DEBUG_INFO is not set
+CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_STACKOVERFLOW=y
+# CONFIG_KPROBES is not set
 CONFIG_DEBUG_STACK_USAGE=y
 # CONFIG_DEBUGGER is not set
 # CONFIG_PPCDBG is not set
-# CONFIG_IRQSTACKS is not set
-# CONFIG_SCHEDSTATS is not set
+CONFIG_IRQSTACKS=y
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -821,7 +880,7 @@
 CONFIG_CRYPTO_SHA1=m
 CONFIG_CRYPTO_SHA256=m
 CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WHIRLPOOL=m
+CONFIG_CRYPTO_WP512=m
 CONFIG_CRYPTO_DES=y
 CONFIG_CRYPTO_BLOWFISH=m
 CONFIG_CRYPTO_TWOFISH=m
@@ -832,10 +891,15 @@
 CONFIG_CRYPTO_TEA=m
 CONFIG_CRYPTO_ARC4=m
 CONFIG_CRYPTO_KHAZAD=m
+CONFIG_CRYPTO_ANUBIS=m
 CONFIG_CRYPTO_DEFLATE=m
 CONFIG_CRYPTO_MICHAEL_MIC=m
 CONFIG_CRYPTO_CRC32C=m
 CONFIG_CRYPTO_TEST=m
+
+#
+# Hardware crypto devices
+#
 
 #
 # Library routines
diff -Nru a/arch/ppc64/configs/maple_defconfig b/arch/ppc64/configs/maple_defconfig
--- a/arch/ppc64/configs/maple_defconfig	2004-10-25 19:24:06 -07:00
+++ b/arch/ppc64/configs/maple_defconfig	2005-03-04 22:41:53 -08:00
@@ -1,11 +1,12 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.9
-# Wed Oct 20 15:39:14 2004
+# Linux kernel version: 2.6.11-rc3-bk6
+# Wed Feb  9 23:34:53 2005
 #
 CONFIG_64BIT=y
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_ISA_DMA=y
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_EARLY_PRINTK=y
@@ -18,6 +19,7 @@
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
+CONFIG_LOCK_KERNEL=y
 
 #
 # General setup
@@ -25,12 +27,12 @@
 CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_POSIX_MQUEUE is not set
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
-# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=17
 # CONFIG_HOTPLUG is not set
+CONFIG_KOBJECT_UEVENT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
@@ -39,12 +41,12 @@
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
 # CONFIG_TINY_SHMEM is not set
 
 #
@@ -52,9 +54,10 @@
 #
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
+CONFIG_MODVERSIONS=y
+CONFIG_MODULE_SRCVERSION_ALL=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 CONFIG_SYSVIPC_COMPAT=y
@@ -77,10 +80,10 @@
 CONFIG_POWER4_ONLY=y
 CONFIG_IOMMU_VMERGE=y
 CONFIG_SMP=y
-# CONFIG_IRQ_ALL_CPUS is not set
 CONFIG_NR_CPUS=2
 # CONFIG_SCHED_SMT is not set
 # CONFIG_PREEMPT is not set
+CONFIG_GENERIC_HARDIRQS=y
 
 #
 # General setup
@@ -91,6 +94,20 @@
 # CONFIG_BINFMT_MISC is not set
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+# CONFIG_HOTPLUG_PCI is not set
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
 
@@ -103,6 +120,7 @@
 #
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 # CONFIG_DEBUG_DRIVER is not set
 
 #
@@ -127,13 +145,26 @@
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=8192
 # CONFIG_BLK_DEV_INITRD is not set
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -151,7 +182,6 @@
 # CONFIG_BLK_DEV_IDETAPE is not set
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
 CONFIG_IDE_TASK_IOCTL=y
-CONFIG_IDE_TASKFILE_IO=y
 
 #
 # IDE chipset support/bugfixes
@@ -250,6 +280,8 @@
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 # CONFIG_IPV6 is not set
 # CONFIG_NETFILTER is not set
 
@@ -269,7 +301,6 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
@@ -330,7 +361,6 @@
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
 # CONFIG_VIA_RHINE is not set
-# CONFIG_VIA_VELOCITY is not set
 
 #
 # Ethernet (1000 Mbit)
@@ -344,6 +374,7 @@
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
 # CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 
 #
@@ -461,7 +492,6 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
 
@@ -489,6 +519,7 @@
 # CONFIG_I2C_I801 is not set
 # CONFIG_I2C_I810 is not set
 # CONFIG_I2C_ISA is not set
+# CONFIG_I2C_MPC is not set
 # CONFIG_I2C_NFORCE2 is not set
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PROSAVAGE is not set
@@ -497,6 +528,7 @@
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_STUB is not set
 # CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
 # CONFIG_I2C_VOODOO3 is not set
@@ -508,20 +540,25 @@
 # CONFIG_I2C_SENSOR is not set
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
 # CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ASB100 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_FSCHER is not set
 # CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
 # CONFIG_SENSORS_LM80 is not set
 # CONFIG_SENSORS_LM83 is not set
 # CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
 # CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
 # CONFIG_SENSORS_SMSC47M1 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_W83781D is not set
@@ -588,6 +625,8 @@
 # CONFIG_USB_BANDWIDTH is not set
 # CONFIG_USB_DYNAMIC_MINORS is not set
 # CONFIG_USB_OTG is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
 
 #
 # USB Host Controller Drivers
@@ -597,6 +636,7 @@
 CONFIG_USB_EHCI_ROOT_HUB_TT=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_UHCI_HCD=y
+# CONFIG_USB_SL811_HCD is not set
 
 #
 # USB Device Class drivers
@@ -604,10 +644,14 @@
 # CONFIG_USB_BLUETOOTH_TTY is not set
 # CONFIG_USB_ACM is not set
 # CONFIG_USB_PRINTER is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 # CONFIG_USB_STORAGE is not set
 
 #
-# USB Human Interface Devices (HID)
+# USB Input Devices
 #
 CONFIG_USB_HID=y
 CONFIG_USB_HIDINPUT=y
@@ -637,7 +681,7 @@
 #
 
 #
-# USB Network adaptors
+# USB Network Adapters
 #
 # CONFIG_USB_CATC is not set
 # CONFIG_USB_KAWETH is not set
@@ -657,6 +701,7 @@
 CONFIG_USB_SERIAL_GENERIC=y
 # CONFIG_USB_SERIAL_BELKIN is not set
 # CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
+CONFIG_USB_SERIAL_CYPRESS_M8=m
 # CONFIG_USB_SERIAL_EMPEG is not set
 # CONFIG_USB_SERIAL_FTDI_SIO is not set
 # CONFIG_USB_SERIAL_VISOR is not set
@@ -664,6 +709,8 @@
 # CONFIG_USB_SERIAL_IR is not set
 # CONFIG_USB_SERIAL_EDGEPORT is not set
 # CONFIG_USB_SERIAL_EDGEPORT_TI is not set
+CONFIG_USB_SERIAL_GARMIN=m
+CONFIG_USB_SERIAL_IPW=m
 # CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
 CONFIG_USB_SERIAL_KEYSPAN=y
 CONFIG_USB_SERIAL_KEYSPAN_MPR=y
@@ -683,6 +730,7 @@
 # CONFIG_USB_SERIAL_MCT_U232 is not set
 # CONFIG_USB_SERIAL_PL2303 is not set
 # CONFIG_USB_SERIAL_SAFE is not set
+CONFIG_USB_SERIAL_TI=m
 # CONFIG_USB_SERIAL_CYBERJACK is not set
 # CONFIG_USB_SERIAL_XIRCOM is not set
 # CONFIG_USB_SERIAL_OMNINET is not set
@@ -693,22 +741,37 @@
 #
 # CONFIG_USB_EMI62 is not set
 # CONFIG_USB_EMI26 is not set
-# CONFIG_USB_TIGL is not set
 # CONFIG_USB_AUERSWALD is not set
 # CONFIG_USB_RIO500 is not set
 # CONFIG_USB_LEGOTOWER is not set
 # CONFIG_USB_LCD is not set
 # CONFIG_USB_LED is not set
 # CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGETKIT is not set
 # CONFIG_USB_PHIDGETSERVO is not set
+# CONFIG_USB_IDMOUSE is not set
 # CONFIG_USB_TEST is not set
 
 #
+# USB ATM/DSL drivers
+#
+
+#
 # USB Gadget Support
 #
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -719,10 +782,15 @@
 # CONFIG_JBD_DEBUG is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -752,8 +820,10 @@
 CONFIG_DEVPTS_FS_XATTR=y
 # CONFIG_DEVPTS_FS_SECURITY is not set
 CONFIG_TMPFS=y
-# CONFIG_HUGETLBFS is not set
-# CONFIG_HUGETLB_PAGE is not set
+CONFIG_TMPFS_XATTR=y
+CONFIG_TMPFS_SECURITY=y
+CONFIG_HUGETLBFS=y
+CONFIG_HUGETLB_PAGE=y
 CONFIG_RAMFS=y
 
 #
@@ -766,7 +836,7 @@
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_CRAMFS is not set
+CONFIG_CRAMFS=y
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
@@ -784,7 +854,6 @@
 CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
-# CONFIG_EXPORTFS is not set
 CONFIG_SUNRPC=y
 CONFIG_SUNRPC_GSS=y
 CONFIG_RPCSEC_GSS_KRB5=y
@@ -869,21 +938,25 @@
 #
 CONFIG_DEBUG_KERNEL=y
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHEDSTATS is not set
 CONFIG_DEBUG_SLAB=y
 CONFIG_DEBUG_SPINLOCK_SLEEP=y
+# CONFIG_DEBUG_KOBJECT is not set
 # CONFIG_DEBUG_INFO is not set
+CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_STACKOVERFLOW=y
+# CONFIG_KPROBES is not set
 CONFIG_DEBUG_STACK_USAGE=y
 CONFIG_DEBUGGER=y
 CONFIG_XMON=y
 CONFIG_XMON_DEFAULT=y
 # CONFIG_PPCDBG is not set
 # CONFIG_IRQSTACKS is not set
-# CONFIG_SCHEDSTATS is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -908,14 +981,20 @@
 # CONFIG_CRYPTO_TEA is not set
 # CONFIG_CRYPTO_ARC4 is not set
 # CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_ANUBIS is not set
 # CONFIG_CRYPTO_DEFLATE is not set
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
 # CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_TEST is not set
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
 CONFIG_CRC_CCITT=y
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
diff -Nru a/arch/ppc64/configs/pSeries_defconfig b/arch/ppc64/configs/pSeries_defconfig
--- a/arch/ppc64/configs/pSeries_defconfig	2005-01-25 13:50:16 -08:00
+++ b/arch/ppc64/configs/pSeries_defconfig	2005-03-04 22:41:53 -08:00
@@ -1,11 +1,12 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.9-rc2
-# Thu Sep 23 16:45:05 2004
+# Linux kernel version: 2.6.11-rc3-bk6
+# Wed Feb  9 23:34:54 2005
 #
 CONFIG_64BIT=y
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_ISA_DMA=y
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_EARLY_PRINTK=y
@@ -18,6 +19,7 @@
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
+CONFIG_LOCK_KERNEL=y
 
 #
 # General setup
@@ -28,10 +30,9 @@
 CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
-CONFIG_AUDIT=y
-CONFIG_AUDITSYSCALL=y
 CONFIG_LOG_BUF_SHIFT=17
 CONFIG_HOTPLUG=y
+CONFIG_KOBJECT_UEVENT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
@@ -40,12 +41,12 @@
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
 # CONFIG_TINY_SHMEM is not set
 
 #
@@ -55,8 +56,9 @@
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
-# CONFIG_KMOD is not set
+CONFIG_MODVERSIONS=y
+CONFIG_MODULE_SRCVERSION_ALL=y
+CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 CONFIG_SYSVIPC_COMPAT=y
 
@@ -67,22 +69,25 @@
 CONFIG_PPC_MULTIPLATFORM=y
 CONFIG_PPC_PSERIES=y
 # CONFIG_PPC_PMAC is not set
+# CONFIG_PPC_MAPLE is not set
 CONFIG_PPC=y
 CONFIG_PPC64=y
 CONFIG_PPC_OF=y
 CONFIG_ALTIVEC=y
 CONFIG_PPC_SPLPAR=y
+CONFIG_IBMVIO=y
+# CONFIG_U3_DART is not set
 # CONFIG_BOOTX_TEXT is not set
 # CONFIG_POWER4_ONLY is not set
 CONFIG_IOMMU_VMERGE=y
 CONFIG_SMP=y
-CONFIG_IRQ_ALL_CPUS=y
 CONFIG_NR_CPUS=128
-# CONFIG_HMT is not set
 CONFIG_DISCONTIGMEM=y
 CONFIG_NUMA=y
 CONFIG_SCHED_SMT=y
 # CONFIG_PREEMPT is not set
+CONFIG_EEH=y
+CONFIG_GENERIC_HARDIRQS=y
 CONFIG_PPC_RTAS=y
 CONFIG_RTAS_FLASH=m
 CONFIG_SCANLOG=m
@@ -100,9 +105,13 @@
 CONFIG_HOTPLUG_CPU=y
 
 #
-# PCMCIA/CardBus support
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
 #
-# CONFIG_PCMCIA is not set
 
 #
 # PCI Hotplug Support
@@ -110,7 +119,6 @@
 CONFIG_HOTPLUG_PCI=m
 # CONFIG_HOTPLUG_PCI_FAKE is not set
 # CONFIG_HOTPLUG_PCI_CPCI is not set
-# CONFIG_HOTPLUG_PCI_PCIE is not set
 # CONFIG_HOTPLUG_PCI_SHPC is not set
 CONFIG_HOTPLUG_PCI_RPA=m
 CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
@@ -137,7 +145,14 @@
 #
 # Parallel port support
 #
-# CONFIG_PARPORT is not set
+CONFIG_PARPORT=m
+CONFIG_PARPORT_PC=m
+CONFIG_PARPORT_PC_CML1=m
+# CONFIG_PARPORT_SERIAL is not set
+# CONFIG_PARPORT_PC_FIFO is not set
+# CONFIG_PARPORT_PC_SUPERIO is not set
+# CONFIG_PARPORT_OTHER is not set
+# CONFIG_PARPORT_1284 is not set
 
 #
 # Plug and Play support
@@ -147,18 +162,32 @@
 # Block devices
 #
 CONFIG_BLK_DEV_FD=m
+# CONFIG_PARIDE is not set
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 CONFIG_BLK_DEV_NBD=m
 # CONFIG_BLK_DEV_SX8 is not set
 # CONFIG_BLK_DEV_UB is not set
 CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=4096
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=65536
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -177,7 +206,6 @@
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
 # CONFIG_BLK_DEV_IDESCSI is not set
 # CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
 
 #
 # IDE chipset support/bugfixes
@@ -247,6 +275,7 @@
 #
 CONFIG_SCSI_SPI_ATTRS=y
 CONFIG_SCSI_FC_ATTRS=y
+CONFIG_SCSI_ISCSI_ATTRS=m
 
 #
 # SCSI low-level drivers
@@ -269,15 +298,18 @@
 # CONFIG_SCSI_GDTH is not set
 # CONFIG_SCSI_IPS is not set
 CONFIG_SCSI_IBMVSCSI=y
+# CONFIG_SCSI_INITIO is not set
 # CONFIG_SCSI_INIA100 is not set
+# CONFIG_SCSI_PPA is not set
+# CONFIG_SCSI_IMM is not set
 CONFIG_SCSI_SYM53C8XX_2=y
 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
 # CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
 CONFIG_SCSI_IPR=y
-# CONFIG_SCSI_IPR_TRACE is not set
-# CONFIG_SCSI_IPR_DUMP is not set
+CONFIG_SCSI_IPR_TRACE=y
+CONFIG_SCSI_IPR_DUMP=y
 # CONFIG_SCSI_QLOGIC_ISP is not set
 # CONFIG_SCSI_QLOGIC_FC is not set
 # CONFIG_SCSI_QLOGIC_1280 is not set
@@ -287,7 +319,6 @@
 CONFIG_SCSI_QLA2300=m
 CONFIG_SCSI_QLA2322=m
 CONFIG_SCSI_QLA6312=m
-CONFIG_SCSI_QLA6322=m
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
 # CONFIG_SCSI_DEBUG is not set
@@ -304,6 +335,7 @@
 CONFIG_MD_RAID5=y
 CONFIG_MD_RAID6=m
 CONFIG_MD_MULTIPATH=m
+CONFIG_MD_FAULTY=m
 CONFIG_BLK_DEV_DM=y
 CONFIG_DM_CRYPT=m
 CONFIG_DM_SNAPSHOT=m
@@ -355,6 +387,8 @@
 CONFIG_INET_ESP=m
 CONFIG_INET_IPCOMP=m
 CONFIG_INET_TUNNEL=y
+CONFIG_IP_TCPDIAG=m
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 
 #
 # IP: Virtual Server Configuration
@@ -368,7 +402,8 @@
 # IP: Netfilter Configuration
 #
 CONFIG_IP_NF_CONNTRACK=m
-# CONFIG_IP_NF_CT_ACCT is not set
+CONFIG_IP_NF_CT_ACCT=y
+CONFIG_IP_NF_CONNTRACK_MARK=y
 CONFIG_IP_NF_CT_PROTO_SCTP=m
 CONFIG_IP_NF_FTP=m
 CONFIG_IP_NF_IRC=m
@@ -397,6 +432,9 @@
 CONFIG_IP_NF_MATCH_ADDRTYPE=m
 CONFIG_IP_NF_MATCH_REALM=m
 CONFIG_IP_NF_MATCH_SCTP=m
+CONFIG_IP_NF_MATCH_COMMENT=m
+CONFIG_IP_NF_MATCH_CONNMARK=m
+CONFIG_IP_NF_MATCH_HASHLIMIT=m
 CONFIG_IP_NF_FILTER=m
 CONFIG_IP_NF_TARGET_REJECT=m
 CONFIG_IP_NF_TARGET_LOG=m
@@ -419,13 +457,13 @@
 CONFIG_IP_NF_TARGET_DSCP=m
 CONFIG_IP_NF_TARGET_MARK=m
 CONFIG_IP_NF_TARGET_CLASSIFY=m
+CONFIG_IP_NF_TARGET_CONNMARK=m
+CONFIG_IP_NF_TARGET_CLUSTERIP=m
 CONFIG_IP_NF_RAW=m
 CONFIG_IP_NF_TARGET_NOTRACK=m
 CONFIG_IP_NF_ARPTABLES=m
 CONFIG_IP_NF_ARPFILTER=m
 CONFIG_IP_NF_ARP_MANGLE=m
-CONFIG_IP_NF_COMPAT_IPCHAINS=m
-CONFIG_IP_NF_COMPAT_IPFWADM=m
 CONFIG_XFRM=y
 CONFIG_XFRM_USER=m
 
@@ -446,7 +484,6 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
@@ -512,7 +549,6 @@
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
 # CONFIG_VIA_RHINE is not set
-# CONFIG_VIA_VELOCITY is not set
 
 #
 # Ethernet (1000 Mbit)
@@ -527,6 +563,7 @@
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
 # CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
 CONFIG_TIGON3=y
 
 #
@@ -536,6 +573,7 @@
 # CONFIG_IXGB_NAPI is not set
 CONFIG_S2IO=m
 # CONFIG_S2IO_NAPI is not set
+# CONFIG_2BUFF_MODE is not set
 
 #
 # Token Ring devices
@@ -556,6 +594,7 @@
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
+# CONFIG_PLIP is not set
 CONFIG_PPP=m
 # CONFIG_PPP_MULTILINK is not set
 # CONFIG_PPP_FILTER is not set
@@ -588,7 +627,7 @@
 # Userland interfaces
 #
 CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
@@ -605,7 +644,9 @@
 CONFIG_SERIO_I8042=y
 # CONFIG_SERIO_SERPORT is not set
 # CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_PARKBD is not set
 # CONFIG_SERIO_PCIPS2 is not set
+CONFIG_SERIO_LIBPS2=y
 # CONFIG_SERIO_RAW is not set
 
 #
@@ -624,7 +665,7 @@
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 CONFIG_INPUT_MISC=y
-# CONFIG_INPUT_PCSPKR is not set
+CONFIG_INPUT_PCSPKR=m
 # CONFIG_INPUT_UINPUT is not set
 
 #
@@ -653,6 +694,9 @@
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_PRINTER is not set
+# CONFIG_PPDEV is not set
+# CONFIG_TIPAR is not set
 CONFIG_HVC_CONSOLE=y
 CONFIG_HVCS=m
 
@@ -674,7 +718,6 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 CONFIG_RAW_DRIVER=y
 CONFIG_MAX_RAW_DEVS=1024
@@ -703,7 +746,9 @@
 # CONFIG_I2C_I801 is not set
 # CONFIG_I2C_I810 is not set
 # CONFIG_I2C_ISA is not set
+# CONFIG_I2C_MPC is not set
 # CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT is not set
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PROSAVAGE is not set
 # CONFIG_I2C_SAVAGE4 is not set
@@ -711,6 +756,7 @@
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_STUB is not set
 # CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
 # CONFIG_I2C_VOODOO3 is not set
@@ -722,20 +768,25 @@
 # CONFIG_I2C_SENSOR is not set
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
 # CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ASB100 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_FSCHER is not set
 # CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
 # CONFIG_SENSORS_LM75 is not set
 # CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
 # CONFIG_SENSORS_LM80 is not set
 # CONFIG_SENSORS_LM83 is not set
 # CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
 # CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
 # CONFIG_SENSORS_SMSC47M1 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_W83781D is not set
@@ -778,6 +829,7 @@
 #
 CONFIG_FB=y
 CONFIG_FB_MODE_HELPERS=y
+# CONFIG_FB_TILEBLITTING is not set
 # CONFIG_FB_CIRRUS is not set
 # CONFIG_FB_PM2 is not set
 # CONFIG_FB_CYBER2000 is not set
@@ -790,8 +842,7 @@
 CONFIG_FB_MATROX=y
 CONFIG_FB_MATROX_MILLENIUM=y
 CONFIG_FB_MATROX_MYSTIQUE=y
-CONFIG_FB_MATROX_G450=y
-CONFIG_FB_MATROX_G100=y
+CONFIG_FB_MATROX_G=y
 # CONFIG_FB_MATROX_I2C is not set
 CONFIG_FB_MATROX_MULTIHEAD=y
 # CONFIG_FB_RADEON_OLD is not set
@@ -800,6 +851,7 @@
 # CONFIG_FB_RADEON_DEBUG is not set
 # CONFIG_FB_ATY128 is not set
 # CONFIG_FB_ATY is not set
+# CONFIG_FB_SAVAGE is not set
 # CONFIG_FB_SIS is not set
 # CONFIG_FB_NEOMAGIC is not set
 # CONFIG_FB_KYRO is not set
@@ -825,6 +877,11 @@
 CONFIG_LOGO_LINUX_MONO=y
 CONFIG_LOGO_LINUX_VGA16=y
 CONFIG_LOGO_LINUX_CLUT224=y
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_BACKLIGHT_CLASS_DEVICE=m
+CONFIG_BACKLIGHT_DEVICE=y
+CONFIG_LCD_CLASS_DEVICE=m
+CONFIG_LCD_DEVICE=y
 
 #
 # Sound
@@ -844,6 +901,8 @@
 # CONFIG_USB_BANDWIDTH is not set
 # CONFIG_USB_DYNAMIC_MINORS is not set
 # CONFIG_USB_OTG is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
 
 #
 # USB Host Controller Drivers
@@ -853,6 +912,7 @@
 # CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 CONFIG_USB_OHCI_HCD=y
 # CONFIG_USB_UHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
 
 #
 # USB Device Class drivers
@@ -860,6 +920,10 @@
 # CONFIG_USB_BLUETOOTH_TTY is not set
 # CONFIG_USB_ACM is not set
 # CONFIG_USB_PRINTER is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 CONFIG_USB_STORAGE=y
 # CONFIG_USB_STORAGE_DEBUG is not set
 # CONFIG_USB_STORAGE_RW_DETECT is not set
@@ -873,7 +937,7 @@
 # CONFIG_USB_STORAGE_JUMPSHOT is not set
 
 #
-# USB Human Interface Devices (HID)
+# USB Input Devices
 #
 CONFIG_USB_HID=y
 CONFIG_USB_HIDINPUT=y
@@ -893,7 +957,6 @@
 #
 # CONFIG_USB_MDC800 is not set
 # CONFIG_USB_MICROTEK is not set
-# CONFIG_USB_HPUSBSCSI is not set
 
 #
 # USB Multimedia devices
@@ -905,7 +968,7 @@
 #
 
 #
-# USB Network adaptors
+# USB Network Adapters
 #
 # CONFIG_USB_CATC is not set
 # CONFIG_USB_KAWETH is not set
@@ -916,6 +979,7 @@
 #
 # USB port drivers
 #
+# CONFIG_USB_USS720 is not set
 
 #
 # USB Serial Converter support
@@ -927,32 +991,51 @@
 #
 # CONFIG_USB_EMI62 is not set
 # CONFIG_USB_EMI26 is not set
-# CONFIG_USB_TIGL is not set
 # CONFIG_USB_AUERSWALD is not set
 # CONFIG_USB_RIO500 is not set
 # CONFIG_USB_LEGOTOWER is not set
 # CONFIG_USB_LCD is not set
 # CONFIG_USB_LED is not set
 # CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGETKIT is not set
 # CONFIG_USB_PHIDGETSERVO is not set
+# CONFIG_USB_IDMOUSE is not set
 # CONFIG_USB_TEST is not set
 
 #
+# USB ATM/DSL drivers
+#
+
+#
 # USB Gadget Support
 #
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+CONFIG_INFINIBAND=m
+CONFIG_INFINIBAND_MTHCA=m
+# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
+CONFIG_INFINIBAND_IPOIB=m
+# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
 CONFIG_EXT2_FS_XATTR=y
 CONFIG_EXT2_FS_POSIX_ACL=y
-# CONFIG_EXT2_FS_SECURITY is not set
+CONFIG_EXT2_FS_SECURITY=y
 CONFIG_EXT3_FS=y
 CONFIG_EXT3_FS_XATTR=y
 CONFIG_EXT3_FS_POSIX_ACL=y
-# CONFIG_EXT3_FS_SECURITY is not set
+CONFIG_EXT3_FS_SECURITY=y
 CONFIG_JBD=y
 # CONFIG_JBD_DEBUG is not set
 CONFIG_FS_MBCACHE=y
@@ -961,20 +1044,27 @@
 # CONFIG_REISERFS_PROC_INFO is not set
 CONFIG_REISERFS_FS_XATTR=y
 CONFIG_REISERFS_FS_POSIX_ACL=y
-# CONFIG_REISERFS_FS_SECURITY is not set
+CONFIG_REISERFS_FS_SECURITY=y
 CONFIG_JFS_FS=m
 CONFIG_JFS_POSIX_ACL=y
+CONFIG_JFS_SECURITY=y
 # CONFIG_JFS_DEBUG is not set
 # CONFIG_JFS_STATISTICS is not set
 CONFIG_FS_POSIX_ACL=y
+
+#
+# XFS support
+#
 CONFIG_XFS_FS=m
+CONFIG_XFS_EXPORT=y
 # CONFIG_XFS_RT is not set
 # CONFIG_XFS_QUOTA is not set
-# CONFIG_XFS_SECURITY is not set
+CONFIG_XFS_SECURITY=y
 CONFIG_XFS_POSIX_ACL=y
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 CONFIG_AUTOFS_FS=m
 # CONFIG_AUTOFS4_FS is not set
 
@@ -982,8 +1072,9 @@
 # CD-ROM/DVD Filesystems
 #
 CONFIG_ISO9660_FS=y
-# CONFIG_JOLIET is not set
-# CONFIG_ZISOFS is not set
+CONFIG_JOLIET=y
+CONFIG_ZISOFS=y
+CONFIG_ZISOFS_FS=y
 CONFIG_UDF_FS=m
 CONFIG_UDF_NLS=y
 
@@ -1005,8 +1096,10 @@
 CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
-# CONFIG_DEVPTS_FS_SECURITY is not set
+CONFIG_DEVPTS_FS_SECURITY=y
 CONFIG_TMPFS=y
+CONFIG_TMPFS_XATTR=y
+CONFIG_TMPFS_SECURITY=y
 CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
 CONFIG_RAMFS=y
@@ -1035,13 +1128,13 @@
 CONFIG_NFS_V3=y
 CONFIG_NFS_V4=y
 # CONFIG_NFS_DIRECTIO is not set
-CONFIG_NFSD=m
+CONFIG_NFSD=y
 CONFIG_NFSD_V3=y
 CONFIG_NFSD_V4=y
 CONFIG_NFSD_TCP=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=m
+CONFIG_EXPORTFS=y
 CONFIG_SUNRPC=y
 CONFIG_SUNRPC_GSS=y
 CONFIG_RPCSEC_GSS_KRB5=y
@@ -1051,6 +1144,7 @@
 # CONFIG_CIFS_STATS is not set
 CONFIG_CIFS_XATTR=y
 CONFIG_CIFS_POSIX=y
+# CONFIG_CIFS_EXPERIMENTAL is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
@@ -1116,21 +1210,25 @@
 #
 CONFIG_DEBUG_KERNEL=y
 CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHEDSTATS is not set
 # CONFIG_DEBUG_SLAB is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_KOBJECT is not set
 # CONFIG_DEBUG_INFO is not set
+CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_STACKOVERFLOW=y
+# CONFIG_KPROBES is not set
 CONFIG_DEBUG_STACK_USAGE=y
 CONFIG_DEBUGGER=y
 CONFIG_XMON=y
 CONFIG_XMON_DEFAULT=y
 # CONFIG_PPCDBG is not set
 CONFIG_IRQSTACKS=y
-# CONFIG_SCHEDSTATS is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -1144,7 +1242,7 @@
 CONFIG_CRYPTO_SHA1=m
 CONFIG_CRYPTO_SHA256=m
 CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_WHIRLPOOL=m
+CONFIG_CRYPTO_WP512=m
 CONFIG_CRYPTO_DES=y
 CONFIG_CRYPTO_BLOWFISH=m
 CONFIG_CRYPTO_TWOFISH=m
@@ -1155,10 +1253,15 @@
 CONFIG_CRYPTO_TEA=m
 CONFIG_CRYPTO_ARC4=m
 CONFIG_CRYPTO_KHAZAD=m
+CONFIG_CRYPTO_ANUBIS=m
 CONFIG_CRYPTO_DEFLATE=m
 CONFIG_CRYPTO_MICHAEL_MIC=m
 CONFIG_CRYPTO_CRC32C=m
 CONFIG_CRYPTO_TEST=m
+
+#
+# Hardware crypto devices
+#
 
 #
 # Library routines
diff -Nru a/arch/ppc64/defconfig b/arch/ppc64/defconfig
--- a/arch/ppc64/defconfig	2004-11-27 03:20:13 -08:00
+++ b/arch/ppc64/defconfig	2005-03-04 22:41:53 -08:00
@@ -1,9 +1,12 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-rc3-bk6
+# Wed Feb  9 23:34:51 2005
 #
 CONFIG_64BIT=y
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_ISA_DMA=y
 CONFIG_HAVE_DEC_LOCK=y
 CONFIG_EARLY_PRINTK=y
@@ -16,27 +19,35 @@
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
+CONFIG_LOCK_KERNEL=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 CONFIG_LOG_BUF_SHIFT=17
 CONFIG_HOTPLUG=y
+CONFIG_KOBJECT_UEVENT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -45,28 +56,40 @@
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
-# CONFIG_MODVERSIONS is not set
-# CONFIG_KMOD is not set
+CONFIG_MODVERSIONS=y
+CONFIG_MODULE_SRCVERSION_ALL=y
+CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
+CONFIG_SYSVIPC_COMPAT=y
 
 #
 # Platform support
 #
 # CONFIG_PPC_ISERIES is not set
+CONFIG_PPC_MULTIPLATFORM=y
 CONFIG_PPC_PSERIES=y
+CONFIG_PPC_PMAC=y
+CONFIG_PPC_MAPLE=y
 CONFIG_PPC=y
 CONFIG_PPC64=y
 CONFIG_PPC_OF=y
 CONFIG_ALTIVEC=y
-# CONFIG_PPC_PMAC is not set
-# CONFIG_BOOTX_TEXT is not set
+CONFIG_PPC_SPLPAR=y
+CONFIG_IBMVIO=y
+CONFIG_U3_DART=y
+CONFIG_MPIC_BROKEN_U3=y
+CONFIG_PPC_PMAC64=y
+CONFIG_BOOTX_TEXT=y
 # CONFIG_POWER4_ONLY is not set
-# CONFIG_IOMMU_VMERGE is not set
+CONFIG_IOMMU_VMERGE=y
 CONFIG_SMP=y
-CONFIG_IRQ_ALL_CPUS=y
 CONFIG_NR_CPUS=32
-# CONFIG_HMT is not set
-# CONFIG_DISCONTIGMEM is not set
+CONFIG_DISCONTIGMEM=y
+# CONFIG_NUMA is not set
+# CONFIG_SCHED_SMT is not set
+# CONFIG_PREEMPT is not set
+CONFIG_EEH=y
+CONFIG_GENERIC_HARDIRQS=y
 CONFIG_PPC_RTAS=y
 CONFIG_RTAS_FLASH=m
 CONFIG_SCANLOG=m
@@ -78,14 +101,19 @@
 CONFIG_PCI=y
 CONFIG_PCI_DOMAINS=y
 CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_MISC is not set
-CONFIG_PCI_LEGACY_PROC=y
-CONFIG_PCI_NAMES=y
+CONFIG_BINFMT_MISC=m
+# CONFIG_PCI_LEGACY_PROC is not set
+# CONFIG_PCI_NAMES is not set
+CONFIG_HOTPLUG_CPU=y
 
 #
-# PCMCIA/CardBus support
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
 #
-# CONFIG_PCMCIA is not set
 
 #
 # PCI Hotplug Support
@@ -93,7 +121,6 @@
 CONFIG_HOTPLUG_PCI=m
 # CONFIG_HOTPLUG_PCI_FAKE is not set
 # CONFIG_HOTPLUG_PCI_CPCI is not set
-# CONFIG_HOTPLUG_PCI_PCIE is not set
 # CONFIG_HOTPLUG_PCI_SHPC is not set
 CONFIG_HOTPLUG_PCI_RPA=m
 CONFIG_HOTPLUG_PCI_RPA_DLPAR=m
@@ -107,7 +134,9 @@
 #
 # Generic Driver Options
 #
-CONFIG_FW_LOADER=m
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
 # CONFIG_DEBUG_DRIVER is not set
 
 #
@@ -118,7 +147,14 @@
 #
 # Parallel port support
 #
-# CONFIG_PARPORT is not set
+CONFIG_PARPORT=m
+CONFIG_PARPORT_PC=m
+CONFIG_PARPORT_PC_CML1=m
+# CONFIG_PARPORT_SERIAL is not set
+# CONFIG_PARPORT_PC_FIFO is not set
+# CONFIG_PARPORT_PC_SUPERIO is not set
+# CONFIG_PARPORT_OTHER is not set
+# CONFIG_PARPORT_1284 is not set
 
 #
 # Plug and Play support
@@ -128,17 +164,32 @@
 # Block devices
 #
 CONFIG_BLK_DEV_FD=y
+# CONFIG_PARIDE is not set
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 CONFIG_BLK_DEV_NBD=m
-# CONFIG_BLK_DEV_CARMEL is not set
+# CONFIG_BLK_DEV_SX8 is not set
+# CONFIG_BLK_DEV_UB is not set
 CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=4096
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=65536
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -149,15 +200,14 @@
 #
 # Please see Documentation/ide.txt for help/info on IDE drives
 #
+# CONFIG_BLK_DEV_IDE_SATA is not set
 CONFIG_BLK_DEV_IDEDISK=y
 # CONFIG_IDEDISK_MULTI_MODE is not set
-# CONFIG_IDEDISK_STROKE is not set
 CONFIG_BLK_DEV_IDECD=y
 # CONFIG_BLK_DEV_IDETAPE is not set
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
 # CONFIG_BLK_DEV_IDESCSI is not set
 # CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
 
 #
 # IDE chipset support/bugfixes
@@ -173,7 +223,6 @@
 # CONFIG_BLK_DEV_IDEDMA_FORCED is not set
 CONFIG_IDEDMA_PCI_AUTO=y
 # CONFIG_IDEDMA_ONLYDISK is not set
-CONFIG_BLK_DEV_ADMA=y
 # CONFIG_BLK_DEV_AEC62XX is not set
 # CONFIG_BLK_DEV_ALI15X3 is not set
 CONFIG_BLK_DEV_AMD74XX=y
@@ -194,6 +243,11 @@
 # CONFIG_BLK_DEV_SLC90E66 is not set
 # CONFIG_BLK_DEV_TRM290 is not set
 # CONFIG_BLK_DEV_VIA82CXXX is not set
+CONFIG_BLK_DEV_IDE_PMAC=y
+CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
+CONFIG_BLK_DEV_IDEDMA_PMAC=y
+# CONFIG_BLK_DEV_IDE_PMAC_BLINK is not set
+# CONFIG_IDE_ARM is not set
 CONFIG_BLK_DEV_IDEDMA=y
 # CONFIG_IDEDMA_IVB is not set
 CONFIG_IDEDMA_AUTO=y
@@ -219,7 +273,6 @@
 # Some SCSI devices (e.g. CD jukebox) support multiple LUNs
 #
 CONFIG_SCSI_MULTI_LUN=y
-CONFIG_SCSI_REPORT_LUNS=y
 CONFIG_SCSI_CONSTANTS=y
 # CONFIG_SCSI_LOGGING is not set
 
@@ -228,33 +281,52 @@
 #
 CONFIG_SCSI_SPI_ATTRS=y
 CONFIG_SCSI_FC_ATTRS=y
+CONFIG_SCSI_ISCSI_ATTRS=m
 
 #
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_3W_9XXX is not set
 # CONFIG_SCSI_ACARD is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
 # CONFIG_SCSI_AIC7XXX_OLD is not set
 # CONFIG_SCSI_AIC79XX is not set
-# CONFIG_SCSI_ADVANSYS is not set
-# CONFIG_SCSI_MEGARAID is not set
-# CONFIG_SCSI_SATA is not set
+# CONFIG_MEGARAID_NEWGEN is not set
+# CONFIG_MEGARAID_LEGACY is not set
+CONFIG_SCSI_SATA=y
+# CONFIG_SCSI_SATA_AHCI is not set
+CONFIG_SCSI_SATA_SVW=y
+# CONFIG_SCSI_ATA_PIIX is not set
+# CONFIG_SCSI_SATA_NV is not set
+# CONFIG_SCSI_SATA_PROMISE is not set
+# CONFIG_SCSI_SATA_SX4 is not set
+# CONFIG_SCSI_SATA_SIL is not set
+# CONFIG_SCSI_SATA_SIS is not set
+# CONFIG_SCSI_SATA_ULI is not set
+# CONFIG_SCSI_SATA_VIA is not set
+# CONFIG_SCSI_SATA_VITESSE is not set
 # CONFIG_SCSI_BUSLOGIC is not set
-# CONFIG_SCSI_CPQFCTS is not set
 # CONFIG_SCSI_DMX3191D is not set
 # CONFIG_SCSI_EATA is not set
 # CONFIG_SCSI_EATA_PIO is not set
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
 # CONFIG_SCSI_GDTH is not set
 # CONFIG_SCSI_IPS is not set
+CONFIG_SCSI_IBMVSCSI=y
+# CONFIG_SCSI_INITIO is not set
 # CONFIG_SCSI_INIA100 is not set
+# CONFIG_SCSI_PPA is not set
+# CONFIG_SCSI_IMM is not set
 CONFIG_SCSI_SYM53C8XX_2=y
 CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
 CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
 CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
 # CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
+CONFIG_SCSI_IPR=y
+CONFIG_SCSI_IPR_TRACE=y
+CONFIG_SCSI_IPR_DUMP=y
 # CONFIG_SCSI_QLOGIC_ISP is not set
 # CONFIG_SCSI_QLOGIC_FC is not set
 # CONFIG_SCSI_QLOGIC_1280 is not set
@@ -264,10 +336,9 @@
 CONFIG_SCSI_QLA2300=m
 CONFIG_SCSI_QLA2322=m
 CONFIG_SCSI_QLA6312=m
-CONFIG_SCSI_QLA6322=m
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
-# CONFIG_SCSI_DEBUG is not set
+CONFIG_SCSI_DEBUG=m
 
 #
 # Multi-device support (RAID and LVM)
@@ -277,11 +348,16 @@
 CONFIG_MD_LINEAR=y
 CONFIG_MD_RAID0=y
 CONFIG_MD_RAID1=y
+CONFIG_MD_RAID10=y
 CONFIG_MD_RAID5=y
-CONFIG_MD_RAID6=y
-# CONFIG_MD_MULTIPATH is not set
+CONFIG_MD_RAID6=m
+CONFIG_MD_MULTIPATH=m
+CONFIG_MD_FAULTY=m
 CONFIG_BLK_DEV_DM=y
 CONFIG_DM_CRYPT=m
+CONFIG_DM_SNAPSHOT=m
+CONFIG_DM_MIRROR=m
+CONFIG_DM_ZERO=m
 
 #
 # Fusion MPT device support
@@ -291,15 +367,48 @@
 #
 # IEEE 1394 (FireWire) support
 #
-# CONFIG_IEEE1394 is not set
+CONFIG_IEEE1394=y
+
+#
+# Subsystem Options
+#
+# CONFIG_IEEE1394_VERBOSEDEBUG is not set
+# CONFIG_IEEE1394_OUI_DB is not set
+CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
+CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
+
+#
+# Device Drivers
+#
+# CONFIG_IEEE1394_PCILYNX is not set
+CONFIG_IEEE1394_OHCI1394=y
+
+#
+# Protocol Drivers
+#
+CONFIG_IEEE1394_VIDEO1394=m
+CONFIG_IEEE1394_SBP2=m
+# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
+CONFIG_IEEE1394_ETH1394=m
+CONFIG_IEEE1394_DV1394=m
+CONFIG_IEEE1394_RAWIO=y
+CONFIG_IEEE1394_CMP=m
+CONFIG_IEEE1394_AMDTP=m
 
 #
 # I2O device support
 #
+# CONFIG_I2O is not set
 
 #
 # Macintosh device drivers
 #
+CONFIG_ADB=y
+CONFIG_ADB_PMU=y
+# CONFIG_PMAC_PBOOK is not set
+# CONFIG_PMAC_BACKLIGHT is not set
+# CONFIG_INPUT_ADBHID is not set
+CONFIG_THERM_PM72=y
 
 #
 # Networking support
@@ -322,19 +431,19 @@
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
 # CONFIG_ARPD is not set
-CONFIG_INET_ECN=y
 CONFIG_SYN_COOKIES=y
 CONFIG_INET_AH=m
 CONFIG_INET_ESP=m
 CONFIG_INET_IPCOMP=m
+CONFIG_INET_TUNNEL=y
+# CONFIG_IP_TCPDIAG is not set
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 
 #
 # IP: Virtual Server Configuration
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 
@@ -342,6 +451,9 @@
 # IP: Netfilter Configuration
 #
 CONFIG_IP_NF_CONNTRACK=m
+CONFIG_IP_NF_CT_ACCT=y
+CONFIG_IP_NF_CONNTRACK_MARK=y
+CONFIG_IP_NF_CT_PROTO_SCTP=m
 CONFIG_IP_NF_FTP=m
 CONFIG_IP_NF_IRC=m
 CONFIG_IP_NF_TFTP=m
@@ -366,8 +478,17 @@
 CONFIG_IP_NF_MATCH_STATE=m
 CONFIG_IP_NF_MATCH_CONNTRACK=m
 CONFIG_IP_NF_MATCH_OWNER=m
+CONFIG_IP_NF_MATCH_ADDRTYPE=m
+CONFIG_IP_NF_MATCH_REALM=m
+CONFIG_IP_NF_MATCH_SCTP=m
+CONFIG_IP_NF_MATCH_COMMENT=m
+CONFIG_IP_NF_MATCH_CONNMARK=m
+CONFIG_IP_NF_MATCH_HASHLIMIT=m
 CONFIG_IP_NF_FILTER=m
 CONFIG_IP_NF_TARGET_REJECT=m
+CONFIG_IP_NF_TARGET_LOG=m
+CONFIG_IP_NF_TARGET_ULOG=m
+CONFIG_IP_NF_TARGET_TCPMSS=m
 CONFIG_IP_NF_NAT=m
 CONFIG_IP_NF_NAT_NEEDED=y
 CONFIG_IP_NF_TARGET_MASQUERADE=m
@@ -385,24 +506,24 @@
 CONFIG_IP_NF_TARGET_DSCP=m
 CONFIG_IP_NF_TARGET_MARK=m
 CONFIG_IP_NF_TARGET_CLASSIFY=m
-CONFIG_IP_NF_TARGET_LOG=m
-CONFIG_IP_NF_TARGET_ULOG=m
-CONFIG_IP_NF_TARGET_TCPMSS=m
+CONFIG_IP_NF_TARGET_CONNMARK=m
+CONFIG_IP_NF_TARGET_CLUSTERIP=m
+CONFIG_IP_NF_RAW=m
+CONFIG_IP_NF_TARGET_NOTRACK=m
 CONFIG_IP_NF_ARPTABLES=m
 CONFIG_IP_NF_ARPFILTER=m
 CONFIG_IP_NF_ARP_MANGLE=m
-CONFIG_IP_NF_COMPAT_IPCHAINS=m
-CONFIG_IP_NF_COMPAT_IPFWADM=m
 CONFIG_XFRM=y
 CONFIG_XFRM_USER=m
 
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 CONFIG_LLC=y
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
@@ -412,36 +533,42 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
 #
 # CONFIG_NET_SCHED is not set
+CONFIG_NET_CLS_ROUTE=y
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+CONFIG_NETPOLL=y
+CONFIG_NETPOLL_RX=y
+CONFIG_NETPOLL_TRAP=y
+CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
+CONFIG_DUMMY=m
+CONFIG_BONDING=m
+# CONFIG_EQUALIZER is not set
+CONFIG_TUN=m
 
 #
 # ARCnet devices
 #
 # CONFIG_ARCNET is not set
-CONFIG_DUMMY=m
-CONFIG_BONDING=m
-# CONFIG_EQUALIZER is not set
-CONFIG_TUN=m
 
 #
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
-# CONFIG_OAKNET is not set
 # CONFIG_HAPPYMEAL is not set
-# CONFIG_SUNGEM is not set
+CONFIG_SUNGEM=y
 CONFIG_NET_VENDOR_3COM=y
 CONFIG_VORTEX=y
 # CONFIG_TYPHOON is not set
@@ -451,6 +578,7 @@
 #
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
+CONFIG_IBMVETH=m
 CONFIG_NET_PCI=y
 CONFIG_PCNET32=y
 # CONFIG_AMD8111_ETH is not set
@@ -483,8 +611,8 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
 CONFIG_TIGON3=y
 
 #
@@ -492,59 +620,40 @@
 #
 CONFIG_IXGB=m
 # CONFIG_IXGB_NAPI is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-CONFIG_IBMVETH=m
-CONFIG_PPP=m
-# CONFIG_PPP_MULTILINK is not set
-# CONFIG_PPP_FILTER is not set
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_SYNC_TTY=m
-CONFIG_PPP_DEFLATE=m
-CONFIG_PPP_BSDCOMP=m
-CONFIG_PPPOE=m
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 CONFIG_TR=y
 CONFIG_IBMOL=y
-# CONFIG_IBMLS is not set
 # CONFIG_3C359 is not set
 # CONFIG_TMS380TR is not set
-# CONFIG_NET_FC is not set
-# CONFIG_SHAPER is not set
-CONFIG_NETCONSOLE=y
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
 
 #
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
-CONFIG_NETPOLL=y
-CONFIG_NETPOLL_RX=y
-CONFIG_NETPOLL_TRAP=y
-CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PLIP is not set
+CONFIG_PPP=m
+# CONFIG_PPP_MULTILINK is not set
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+CONFIG_PPP_SYNC_TTY=m
+CONFIG_PPP_DEFLATE=m
+CONFIG_PPP_BSDCOMP=m
+CONFIG_PPPOE=m
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
+CONFIG_NETCONSOLE=y
 
 #
 # ISDN subsystem
@@ -565,12 +674,12 @@
 # Userland interfaces
 #
 CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
 CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
 CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
 # CONFIG_INPUT_TSDEV is not set
-# CONFIG_INPUT_EVDEV is not set
+CONFIG_INPUT_EVDEV=m
 # CONFIG_INPUT_EVBUG is not set
 
 #
@@ -582,7 +691,10 @@
 CONFIG_SERIO_I8042=y
 # CONFIG_SERIO_SERPORT is not set
 # CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_PARKBD is not set
 # CONFIG_SERIO_PCIPS2 is not set
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
 
 #
 # Input Device Drivers
@@ -590,15 +702,17 @@
 CONFIG_INPUT_KEYBOARD=y
 CONFIG_KEYBOARD_ATKBD=y
 # CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
 # CONFIG_KEYBOARD_XTKBD is not set
 # CONFIG_KEYBOARD_NEWTON is not set
 CONFIG_INPUT_MOUSE=y
 CONFIG_MOUSE_PS2=y
 # CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_VSXXXAA is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 CONFIG_INPUT_MISC=y
-CONFIG_INPUT_PCSPKR=y
+CONFIG_INPUT_PCSPKR=m
 # CONFIG_INPUT_UINPUT is not set
 
 #
@@ -623,16 +737,16 @@
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_PMACZILOG is not set
+CONFIG_SERIAL_ICOM=m
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
+CONFIG_PRINTER=m
+# CONFIG_LP_CONSOLE is not set
+# CONFIG_PPDEV is not set
+# CONFIG_TIPAR is not set
 CONFIG_HVC_CONSOLE=y
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
-# CONFIG_QIC02_TAPE is not set
+CONFIG_HVCS=m
 
 #
 # IPMI
@@ -652,7 +766,6 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 CONFIG_RAW_DRIVER=y
 CONFIG_MAX_RAW_DEVS=256
@@ -661,25 +774,30 @@
 # I2C support
 #
 CONFIG_I2C=y
-# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_CHARDEV=y
 
 #
 # I2C Algorithms
 #
 CONFIG_I2C_ALGOBIT=y
 # CONFIG_I2C_ALGOPCF is not set
+# CONFIG_I2C_ALGOPCA is not set
 
 #
 # I2C Hardware Bus support
 #
 # CONFIG_I2C_ALI1535 is not set
+# CONFIG_I2C_ALI1563 is not set
 # CONFIG_I2C_ALI15X3 is not set
 # CONFIG_I2C_AMD756 is not set
-# CONFIG_I2C_AMD8111 is not set
+CONFIG_I2C_AMD8111=y
 # CONFIG_I2C_I801 is not set
 # CONFIG_I2C_I810 is not set
 # CONFIG_I2C_ISA is not set
+CONFIG_I2C_KEYWEST=y
+# CONFIG_I2C_MPC is not set
 # CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_PARPORT is not set
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PROSAVAGE is not set
 # CONFIG_I2C_SAVAGE4 is not set
@@ -687,33 +805,61 @@
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_STUB is not set
 # CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
 # CONFIG_I2C_VOODOO3 is not set
+# CONFIG_I2C_PCA_ISA is not set
 
 #
-# I2C Hardware Sensors Chip support
+# Hardware Sensors Chip support
 #
 # CONFIG_I2C_SENSOR is not set
 # CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ASB100 is not set
-# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_FSCHER is not set
 # CONFIG_SENSORS_GL518SM is not set
 # CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
 # CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
 # CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
 # CONFIG_SENSORS_LM83 is not set
 # CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
 # CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
 # CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_W83781D is not set
 # CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83627HF is not set
+
+#
+# Other I2C Chip support
+#
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_RTC8564 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
 # CONFIG_I2C_DEBUG_BUS is not set
 # CONFIG_I2C_DEBUG_CHIP is not set
 
 #
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
 # Misc devices
 #
 
@@ -731,20 +877,28 @@
 # Graphics support
 #
 CONFIG_FB=y
+CONFIG_FB_MODE_HELPERS=y
+CONFIG_FB_TILEBLITTING=y
+# CONFIG_FB_CIRRUS is not set
 # CONFIG_FB_PM2 is not set
 # CONFIG_FB_CYBER2000 is not set
 CONFIG_FB_OF=y
+# CONFIG_FB_CONTROL is not set
+# CONFIG_FB_PLATINUM is not set
+# CONFIG_FB_VALKYRIE is not set
 # CONFIG_FB_CT65550 is not set
+# CONFIG_FB_ASILIANT is not set
 # CONFIG_FB_IMSTT is not set
-# CONFIG_FB_S3TRIO is not set
 # CONFIG_FB_VGA16 is not set
-# CONFIG_FB_RIVA is not set
+CONFIG_FB_RIVA=y
+CONFIG_FB_RIVA_I2C=y
+# CONFIG_FB_RIVA_DEBUG is not set
 CONFIG_FB_MATROX=y
 CONFIG_FB_MATROX_MILLENIUM=y
 CONFIG_FB_MATROX_MYSTIQUE=y
-CONFIG_FB_MATROX_G450=y
-CONFIG_FB_MATROX_G100=y
-# CONFIG_FB_MATROX_I2C is not set
+CONFIG_FB_MATROX_G=y
+CONFIG_FB_MATROX_I2C=m
+CONFIG_FB_MATROX_MAVEN=m
 CONFIG_FB_MATROX_MULTIHEAD=y
 # CONFIG_FB_RADEON_OLD is not set
 CONFIG_FB_RADEON=y
@@ -752,6 +906,7 @@
 # CONFIG_FB_RADEON_DEBUG is not set
 # CONFIG_FB_ATY128 is not set
 # CONFIG_FB_ATY is not set
+# CONFIG_FB_SAVAGE is not set
 # CONFIG_FB_SIS is not set
 # CONFIG_FB_NEOMAGIC is not set
 # CONFIG_FB_KYRO is not set
@@ -764,10 +919,8 @@
 # Console display driver support
 #
 # CONFIG_VGA_CONSOLE is not set
-# CONFIG_MDA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
 # CONFIG_FONTS is not set
 CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
@@ -779,6 +932,11 @@
 CONFIG_LOGO_LINUX_MONO=y
 CONFIG_LOGO_LINUX_VGA16=y
 CONFIG_LOGO_LINUX_CLUT224=y
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_DEVICE=y
+CONFIG_LCD_CLASS_DEVICE=y
+CONFIG_LCD_DEVICE=y
 
 #
 # Sound
@@ -797,13 +955,19 @@
 CONFIG_USB_DEVICEFS=y
 # CONFIG_USB_BANDWIDTH is not set
 # CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_OTG is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
 
 #
 # USB Host Controller Drivers
 #
 CONFIG_USB_EHCI_HCD=y
+# CONFIG_USB_EHCI_SPLIT_ISO is not set
+# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
 CONFIG_USB_OHCI_HCD=y
 # CONFIG_USB_UHCI_HCD is not set
+# CONFIG_USB_SL811_HCD is not set
 
 #
 # USB Device Class drivers
@@ -811,8 +975,13 @@
 # CONFIG_USB_BLUETOOTH_TTY is not set
 # CONFIG_USB_ACM is not set
 # CONFIG_USB_PRINTER is not set
-CONFIG_USB_STORAGE=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
+CONFIG_USB_STORAGE=m
 # CONFIG_USB_STORAGE_DEBUG is not set
+CONFIG_USB_STORAGE_RW_DETECT=y
 # CONFIG_USB_STORAGE_DATAFAB is not set
 # CONFIG_USB_STORAGE_FREECOM is not set
 # CONFIG_USB_STORAGE_ISD200 is not set
@@ -823,7 +992,7 @@
 # CONFIG_USB_STORAGE_JUMPSHOT is not set
 
 #
-# USB Human Interface Devices (HID)
+# USB Input Devices
 #
 CONFIG_USB_HID=y
 CONFIG_USB_HIDINPUT=y
@@ -833,14 +1002,16 @@
 # CONFIG_USB_WACOM is not set
 # CONFIG_USB_KBTAB is not set
 # CONFIG_USB_POWERMATE is not set
+# CONFIG_USB_MTOUCH is not set
+# CONFIG_USB_EGALAX is not set
 # CONFIG_USB_XPAD is not set
+# CONFIG_USB_ATI_REMOTE is not set
 
 #
 # USB Imaging devices
 #
 # CONFIG_USB_MDC800 is not set
 # CONFIG_USB_MICROTEK is not set
-# CONFIG_USB_HPUSBSCSI is not set
 
 #
 # USB Multimedia devices
@@ -852,17 +1023,18 @@
 #
 
 #
-# USB Network adaptors
+# USB Network Adapters
 #
 # CONFIG_USB_CATC is not set
 # CONFIG_USB_KAWETH is not set
-# CONFIG_USB_PEGASUS is not set
+CONFIG_USB_PEGASUS=y
 # CONFIG_USB_RTL8150 is not set
 # CONFIG_USB_USBNET is not set
 
 #
 # USB port drivers
 #
+# CONFIG_USB_USS720 is not set
 
 #
 # USB Serial Converter support
@@ -874,50 +1046,81 @@
 #
 # CONFIG_USB_EMI62 is not set
 # CONFIG_USB_EMI26 is not set
-# CONFIG_USB_TIGL is not set
 # CONFIG_USB_AUERSWALD is not set
 # CONFIG_USB_RIO500 is not set
 # CONFIG_USB_LEGOTOWER is not set
 # CONFIG_USB_LCD is not set
 # CONFIG_USB_LED is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGETKIT is not set
+# CONFIG_USB_PHIDGETSERVO is not set
+# CONFIG_USB_IDMOUSE is not set
 # CONFIG_USB_TEST is not set
 
 #
+# USB ATM/DSL drivers
+#
+
+#
 # USB Gadget Support
 #
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+CONFIG_INFINIBAND=m
+CONFIG_INFINIBAND_MTHCA=m
+# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
+CONFIG_INFINIBAND_IPOIB=m
+# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
 CONFIG_EXT2_FS_XATTR=y
 CONFIG_EXT2_FS_POSIX_ACL=y
-# CONFIG_EXT2_FS_SECURITY is not set
+CONFIG_EXT2_FS_SECURITY=y
 CONFIG_EXT3_FS=y
 CONFIG_EXT3_FS_XATTR=y
 CONFIG_EXT3_FS_POSIX_ACL=y
-# CONFIG_EXT3_FS_SECURITY is not set
+CONFIG_EXT3_FS_SECURITY=y
 CONFIG_JBD=y
 # CONFIG_JBD_DEBUG is not set
 CONFIG_FS_MBCACHE=y
 CONFIG_REISERFS_FS=y
 # CONFIG_REISERFS_CHECK is not set
 # CONFIG_REISERFS_PROC_INFO is not set
+CONFIG_REISERFS_FS_XATTR=y
+CONFIG_REISERFS_FS_POSIX_ACL=y
+CONFIG_REISERFS_FS_SECURITY=y
 CONFIG_JFS_FS=y
 CONFIG_JFS_POSIX_ACL=y
+CONFIG_JFS_SECURITY=y
 # CONFIG_JFS_DEBUG is not set
 # CONFIG_JFS_STATISTICS is not set
 CONFIG_FS_POSIX_ACL=y
+
+#
+# XFS support
+#
 CONFIG_XFS_FS=m
+CONFIG_XFS_EXPORT=y
 # CONFIG_XFS_RT is not set
 # CONFIG_XFS_QUOTA is not set
-# CONFIG_XFS_SECURITY is not set
+CONFIG_XFS_SECURITY=y
 CONFIG_XFS_POSIX_ACL=y
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
-CONFIG_AUTOFS_FS=m
+CONFIG_DNOTIFY=y
+CONFIG_AUTOFS_FS=y
 # CONFIG_AUTOFS4_FS is not set
 
 #
@@ -927,6 +1130,7 @@
 # CONFIG_JOLIET is not set
 # CONFIG_ZISOFS is not set
 CONFIG_UDF_FS=m
+CONFIG_UDF_NLS=y
 
 #
 # DOS/FAT/NT Filesystems
@@ -934,6 +1138,8 @@
 CONFIG_FAT_FS=y
 CONFIG_MSDOS_FS=y
 CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 # CONFIG_NTFS_FS is not set
 
 #
@@ -941,10 +1147,13 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
 CONFIG_DEVPTS_FS_XATTR=y
-# CONFIG_DEVPTS_FS_SECURITY is not set
+CONFIG_DEVPTS_FS_SECURITY=y
 CONFIG_TMPFS=y
+CONFIG_TMPFS_XATTR=y
+CONFIG_TMPFS_SECURITY=y
 CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
 CONFIG_RAMFS=y
@@ -954,8 +1163,8 @@
 #
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
+CONFIG_HFS_FS=m
+CONFIG_HFSPLUS_FS=m
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
@@ -973,18 +1182,23 @@
 CONFIG_NFS_V3=y
 CONFIG_NFS_V4=y
 # CONFIG_NFS_DIRECTIO is not set
-CONFIG_NFSD=y
+CONFIG_NFSD=m
 CONFIG_NFSD_V3=y
 CONFIG_NFSD_V4=y
 CONFIG_NFSD_TCP=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
-CONFIG_EXPORTFS=y
+CONFIG_EXPORTFS=m
 CONFIG_SUNRPC=y
-CONFIG_SUNRPC_GSS=m
-CONFIG_RPCSEC_GSS_KRB5=m
+CONFIG_SUNRPC_GSS=y
+CONFIG_RPCSEC_GSS_KRB5=y
+CONFIG_RPCSEC_GSS_SPKM3=m
 # CONFIG_SMB_FS is not set
 CONFIG_CIFS=m
+# CONFIG_CIFS_STATS is not set
+CONFIG_CIFS_XATTR=y
+CONFIG_CIFS_POSIX=y
+# CONFIG_CIFS_EXPERIMENTAL is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
@@ -992,51 +1206,66 @@
 #
 # Partition Types
 #
-# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+CONFIG_MAC_PARTITION=y
 CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
 
 #
 # Native Language Support
 #
 CONFIG_NLS=y
 CONFIG_NLS_DEFAULT="iso8859-1"
-# CONFIG_NLS_CODEPAGE_437 is not set
-# CONFIG_NLS_CODEPAGE_737 is not set
-# CONFIG_NLS_CODEPAGE_775 is not set
-# CONFIG_NLS_CODEPAGE_850 is not set
-# CONFIG_NLS_CODEPAGE_852 is not set
-# CONFIG_NLS_CODEPAGE_855 is not set
-# CONFIG_NLS_CODEPAGE_857 is not set
-# CONFIG_NLS_CODEPAGE_860 is not set
-# CONFIG_NLS_CODEPAGE_861 is not set
-# CONFIG_NLS_CODEPAGE_862 is not set
-# CONFIG_NLS_CODEPAGE_863 is not set
-# CONFIG_NLS_CODEPAGE_864 is not set
-# CONFIG_NLS_CODEPAGE_865 is not set
-# CONFIG_NLS_CODEPAGE_866 is not set
-# CONFIG_NLS_CODEPAGE_869 is not set
-# CONFIG_NLS_CODEPAGE_936 is not set
-# CONFIG_NLS_CODEPAGE_950 is not set
-# CONFIG_NLS_CODEPAGE_932 is not set
-# CONFIG_NLS_CODEPAGE_949 is not set
-# CONFIG_NLS_CODEPAGE_874 is not set
-# CONFIG_NLS_ISO8859_8 is not set
-# CONFIG_NLS_CODEPAGE_1250 is not set
-# CONFIG_NLS_CODEPAGE_1251 is not set
-# CONFIG_NLS_ISO8859_1 is not set
-# CONFIG_NLS_ISO8859_2 is not set
-# CONFIG_NLS_ISO8859_3 is not set
-# CONFIG_NLS_ISO8859_4 is not set
-# CONFIG_NLS_ISO8859_5 is not set
-# CONFIG_NLS_ISO8859_6 is not set
-# CONFIG_NLS_ISO8859_7 is not set
-# CONFIG_NLS_ISO8859_9 is not set
-# CONFIG_NLS_ISO8859_13 is not set
-# CONFIG_NLS_ISO8859_14 is not set
-# CONFIG_NLS_ISO8859_15 is not set
-# CONFIG_NLS_KOI8_R is not set
-# CONFIG_NLS_KOI8_U is not set
-# CONFIG_NLS_UTF8 is not set
+CONFIG_NLS_CODEPAGE_437=m
+CONFIG_NLS_CODEPAGE_737=m
+CONFIG_NLS_CODEPAGE_775=m
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_CODEPAGE_852=m
+CONFIG_NLS_CODEPAGE_855=m
+CONFIG_NLS_CODEPAGE_857=m
+CONFIG_NLS_CODEPAGE_860=m
+CONFIG_NLS_CODEPAGE_861=m
+CONFIG_NLS_CODEPAGE_862=m
+CONFIG_NLS_CODEPAGE_863=m
+CONFIG_NLS_CODEPAGE_864=m
+CONFIG_NLS_CODEPAGE_865=m
+CONFIG_NLS_CODEPAGE_866=m
+CONFIG_NLS_CODEPAGE_869=m
+CONFIG_NLS_CODEPAGE_936=m
+CONFIG_NLS_CODEPAGE_950=m
+CONFIG_NLS_CODEPAGE_932=m
+CONFIG_NLS_CODEPAGE_949=m
+CONFIG_NLS_CODEPAGE_874=m
+CONFIG_NLS_ISO8859_8=m
+CONFIG_NLS_CODEPAGE_1250=m
+CONFIG_NLS_CODEPAGE_1251=m
+CONFIG_NLS_ASCII=m
+CONFIG_NLS_ISO8859_1=m
+CONFIG_NLS_ISO8859_2=m
+CONFIG_NLS_ISO8859_3=m
+CONFIG_NLS_ISO8859_4=m
+CONFIG_NLS_ISO8859_5=m
+CONFIG_NLS_ISO8859_6=m
+CONFIG_NLS_ISO8859_7=m
+CONFIG_NLS_ISO8859_9=m
+CONFIG_NLS_ISO8859_13=m
+CONFIG_NLS_ISO8859_14=m
+CONFIG_NLS_ISO8859_15=m
+CONFIG_NLS_KOI8_R=m
+CONFIG_NLS_KOI8_U=m
+CONFIG_NLS_UTF8=m
 
 #
 # Profiling support
@@ -1048,19 +1277,26 @@
 # Kernel hacking
 #
 CONFIG_DEBUG_KERNEL=y
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_STACKOVERFLOW=y
+# CONFIG_KPROBES is not set
 CONFIG_DEBUG_STACK_USAGE=y
-# CONFIG_DEBUG_SLAB is not set
-CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUGGER=y
 CONFIG_XMON=y
-CONFIG_XMON_DEFAULT=y
+# CONFIG_XMON_DEFAULT is not set
 # CONFIG_PPCDBG is not set
-# CONFIG_DEBUG_INFO is not set
+CONFIG_IRQSTACKS=y
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -1070,24 +1306,36 @@
 CONFIG_CRYPTO_HMAC=y
 CONFIG_CRYPTO_NULL=m
 CONFIG_CRYPTO_MD4=m
-CONFIG_CRYPTO_MD5=m
+CONFIG_CRYPTO_MD5=y
 CONFIG_CRYPTO_SHA1=m
 CONFIG_CRYPTO_SHA256=m
 CONFIG_CRYPTO_SHA512=m
-CONFIG_CRYPTO_DES=m
+CONFIG_CRYPTO_WP512=m
+CONFIG_CRYPTO_DES=y
 CONFIG_CRYPTO_BLOWFISH=m
 CONFIG_CRYPTO_TWOFISH=m
 CONFIG_CRYPTO_SERPENT=m
 CONFIG_CRYPTO_AES=m
 CONFIG_CRYPTO_CAST5=m
 CONFIG_CRYPTO_CAST6=m
+CONFIG_CRYPTO_TEA=m
 CONFIG_CRYPTO_ARC4=m
+CONFIG_CRYPTO_KHAZAD=m
+CONFIG_CRYPTO_ANUBIS=m
 CONFIG_CRYPTO_DEFLATE=m
+CONFIG_CRYPTO_MICHAEL_MIC=m
+CONFIG_CRYPTO_CRC32C=m
 CONFIG_CRYPTO_TEST=m
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
+CONFIG_CRC_CCITT=m
 CONFIG_CRC32=y
+CONFIG_LIBCRC32C=m
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=m
diff -Nru a/arch/ppc64/kernel/LparData.c b/arch/ppc64/kernel/LparData.c
--- a/arch/ppc64/kernel/LparData.c	2005-01-07 21:43:52 -08:00
+++ b/arch/ppc64/kernel/LparData.c	2005-03-04 22:41:53 -08:00
@@ -45,7 +45,7 @@
 	.xSize = sizeof(struct HvReleaseData),
 	.xVpdAreasPtrOffset = offsetof(struct naca_struct, xItVpdAreas),
 	.xSlicNacaAddr = &naca,		/* 64-bit Naca address */
-	.xMsNucDataOffset = 0x6000,	/* offset of LparMap within loadarea (see head.S) */
+	.xMsNucDataOffset = 0x4800,	/* offset of LparMap within loadarea (see head.S) */
 	.xTagsMode = 1,			/* tags inactive       */
 	.xAddressSize = 0,		/* 64 bit              */
 	.xNoSharedProcs = 0,		/* shared processors   */
@@ -224,6 +224,7 @@
 };
 
 struct msChunks msChunks;
+EXPORT_SYMBOL(msChunks);
 
 /* Depending on whether this is called from iSeries or pSeries setup
  * code, the location of the msChunks struct may or may not have
diff -Nru a/arch/ppc64/kernel/Makefile b/arch/ppc64/kernel/Makefile
--- a/arch/ppc64/kernel/Makefile	2005-01-25 13:50:16 -08:00
+++ b/arch/ppc64/kernel/Makefile	2005-03-04 22:41:55 -08:00
@@ -11,7 +11,8 @@
 			udbg.o binfmt_elf32.o sys_ppc32.o ioctl32.o \
 			ptrace32.o signal32.o rtc.o init_task.o \
 			lmb.o cputable.o cpu_setup_power4.o idle_power4.o \
-			iommu.o sysfs.o
+			iommu.o sysfs.o vdso.o pmc.o
+obj-y += vdso32/ vdso64/
 
 obj-$(CONFIG_PPC_OF) +=	of_device.o
 
diff -Nru a/arch/ppc64/kernel/align.c b/arch/ppc64/kernel/align.c
--- a/arch/ppc64/kernel/align.c	2004-06-09 23:21:41 -07:00
+++ b/arch/ppc64/kernel/align.c	2005-03-04 22:41:15 -08:00
@@ -238,7 +238,7 @@
 
 	dsisr = regs->dsisr;
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_NODSISRALIGN) {
+	if (cpu_has_feature(CPU_FTR_NODSISRALIGN)) {
 	    unsigned int real_instr;
 	    if (__get_user(real_instr, (unsigned int __user *)regs->nip))
 		return 0;
diff -Nru a/arch/ppc64/kernel/asm-offsets.c b/arch/ppc64/kernel/asm-offsets.c
--- a/arch/ppc64/kernel/asm-offsets.c	2005-01-04 18:48:02 -08:00
+++ b/arch/ppc64/kernel/asm-offsets.c	2005-03-04 22:41:54 -08:00
@@ -22,6 +22,7 @@
 #include <linux/types.h>
 #include <linux/mman.h>
 #include <linux/mm.h>
+#include <linux/time.h>
 #include <linux/hardirq.h>
 #include <asm/io.h>
 #include <asm/page.h>
@@ -35,6 +36,8 @@
 #include <asm/rtas.h>
 #include <asm/cputable.h>
 #include <asm/cache.h>
+#include <asm/systemcfg.h>
+#include <asm/compat.h>
 
 #define DEFINE(sym, val) \
 	asm volatile("\n->" #sym " %0 " #val : : "i" (val))
@@ -166,6 +169,25 @@
 	DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value));
 	DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
 	DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
+
+	/* systemcfg offsets for use by vdso */
+	DEFINE(CFG_TB_ORIG_STAMP, offsetof(struct systemcfg, tb_orig_stamp));
+	DEFINE(CFG_TB_TICKS_PER_SEC, offsetof(struct systemcfg, tb_ticks_per_sec));
+	DEFINE(CFG_TB_TO_XS, offsetof(struct systemcfg, tb_to_xs));
+	DEFINE(CFG_STAMP_XSEC, offsetof(struct systemcfg, stamp_xsec));
+	DEFINE(CFG_TB_UPDATE_COUNT, offsetof(struct systemcfg, tb_update_count));
+	DEFINE(CFG_TZ_MINUTEWEST, offsetof(struct systemcfg, tz_minuteswest));
+	DEFINE(CFG_TZ_DSTTIME, offsetof(struct systemcfg, tz_dsttime));
+	DEFINE(CFG_SYSCALL_MAP32, offsetof(struct systemcfg, syscall_map_32));
+	DEFINE(CFG_SYSCALL_MAP64, offsetof(struct systemcfg, syscall_map_64));
+
+	/* timeval/timezone offsets for use by vdso */
+	DEFINE(TVAL64_TV_SEC, offsetof(struct timeval, tv_sec));
+	DEFINE(TVAL64_TV_USEC, offsetof(struct timeval, tv_usec));
+	DEFINE(TVAL32_TV_SEC, offsetof(struct compat_timeval, tv_sec));
+	DEFINE(TVAL32_TV_USEC, offsetof(struct compat_timeval, tv_usec));
+	DEFINE(TZONE_TZ_MINWEST, offsetof(struct timezone, tz_minuteswest));
+	DEFINE(TZONE_TZ_DSTTIME, offsetof(struct timezone, tz_dsttime));
 
 	return 0;
 }
diff -Nru a/arch/ppc64/kernel/cputable.c b/arch/ppc64/kernel/cputable.c
--- a/arch/ppc64/kernel/cputable.c	2004-06-27 00:19:24 -07:00
+++ b/arch/ppc64/kernel/cputable.c	2005-03-04 22:41:53 -08:00
@@ -17,9 +17,12 @@
 #include <linux/sched.h>
 #include <linux/threads.h>
 #include <linux/init.h>
+#include <linux/module.h>
+
 #include <asm/cputable.h>
 
 struct cpu_spec* cur_cpu_spec = NULL;
+EXPORT_SYMBOL(cur_cpu_spec);
 
 /* NOTE:
  * Unlike ppc32, ppc64 will only call this once for the boot CPU, it's
diff -Nru a/arch/ppc64/kernel/dma.c b/arch/ppc64/kernel/dma.c
--- a/arch/ppc64/kernel/dma.c	2004-10-25 12:47:50 -07:00
+++ b/arch/ppc64/kernel/dma.c	2005-02-06 22:47:41 -08:00
@@ -13,14 +13,23 @@
 #include <asm/scatterlist.h>
 #include <asm/bug.h>
 
-int dma_supported(struct device *dev, u64 mask)
+static struct dma_mapping_ops *get_dma_ops(struct device *dev)
 {
 	if (dev->bus == &pci_bus_type)
-		return pci_dma_supported(to_pci_dev(dev), mask);
+		return &pci_dma_ops;
 #ifdef CONFIG_IBMVIO
 	if (dev->bus == &vio_bus_type)
-		return vio_dma_supported(to_vio_dev(dev), mask);
-#endif /* CONFIG_IBMVIO */
+		return &vio_dma_ops;
+#endif
+	return NULL;
+}
+
+int dma_supported(struct device *dev, u64 mask)
+{
+	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+
+	if (dma_ops)
+		return dma_ops->dma_supported(dev, mask);
 	BUG();
 	return 0;
 }
@@ -32,7 +41,7 @@
 		return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
 #ifdef CONFIG_IBMVIO
 	if (dev->bus == &vio_bus_type)
-		return vio_set_dma_mask(to_vio_dev(dev), dma_mask);
+		return -EIO;
 #endif /* CONFIG_IBMVIO */
 	BUG();
 	return 0;
@@ -42,12 +51,10 @@
 void *dma_alloc_coherent(struct device *dev, size_t size,
 		dma_addr_t *dma_handle, int flag)
 {
-	if (dev->bus == &pci_bus_type)
-		return pci_alloc_consistent(to_pci_dev(dev), size, dma_handle);
-#ifdef CONFIG_IBMVIO
-	if (dev->bus == &vio_bus_type)
-		return vio_alloc_consistent(to_vio_dev(dev), size, dma_handle);
-#endif /* CONFIG_IBMVIO */
+	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+
+	if (dma_ops)
+		return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
 	BUG();
 	return NULL;
 }
@@ -56,12 +63,10 @@
 void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
 		dma_addr_t dma_handle)
 {
-	if (dev->bus == &pci_bus_type)
-		pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
-#ifdef CONFIG_IBMVIO
-	else if (dev->bus == &vio_bus_type)
-		vio_free_consistent(to_vio_dev(dev), size, cpu_addr, dma_handle);
-#endif /* CONFIG_IBMVIO */
+	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+
+	if (dma_ops)
+		dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
 	else
 		BUG();
 }
@@ -70,12 +75,10 @@
 dma_addr_t dma_map_single(struct device *dev, void *cpu_addr, size_t size,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
-		return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
-#ifdef CONFIG_IBMVIO
-	if (dev->bus == &vio_bus_type)
-		return vio_map_single(to_vio_dev(dev), cpu_addr, size, direction);
-#endif /* CONFIG_IBMVIO */
+	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+
+	if (dma_ops)
+		return dma_ops->map_single(dev, cpu_addr, size, direction);
 	BUG();
 	return (dma_addr_t)0;
 }
@@ -84,12 +87,10 @@
 void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
-		pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
-#ifdef CONFIG_IBMVIO
-	else if (dev->bus == &vio_bus_type)
-		vio_unmap_single(to_vio_dev(dev), dma_addr, size, direction);
-#endif /* CONFIG_IBMVIO */
+	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+
+	if (dma_ops)
+		dma_ops->unmap_single(dev, dma_addr, size, direction);
 	else
 		BUG();
 }
@@ -99,12 +100,11 @@
 		unsigned long offset, size_t size,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
-		return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
-#ifdef CONFIG_IBMVIO
-	if (dev->bus == &vio_bus_type)
-		return vio_map_page(to_vio_dev(dev), page, offset, size, direction);
-#endif /* CONFIG_IBMVIO */
+	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+
+	if (dma_ops)
+		return dma_ops->map_single(dev,
+				(page_address(page) + offset), size, direction);
 	BUG();
 	return (dma_addr_t)0;
 }
@@ -113,12 +113,10 @@
 void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
-		pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
-#ifdef CONFIG_IBMVIO
-	else if (dev->bus == &vio_bus_type)
-		vio_unmap_page(to_vio_dev(dev), dma_address, size, direction);
-#endif /* CONFIG_IBMVIO */
+	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+
+	if (dma_ops)
+		dma_ops->unmap_single(dev, dma_address, size, direction);
 	else
 		BUG();
 }
@@ -127,12 +125,10 @@
 int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
-		return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
-#ifdef CONFIG_IBMVIO
-	if (dev->bus == &vio_bus_type)
-		return vio_map_sg(to_vio_dev(dev), sg, nents, direction);
-#endif /* CONFIG_IBMVIO */
+	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+
+	if (dma_ops)
+		return dma_ops->map_sg(dev, sg, nents, direction);
 	BUG();
 	return 0;
 }
@@ -141,12 +137,10 @@
 void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
 		enum dma_data_direction direction)
 {
-	if (dev->bus == &pci_bus_type)
-		pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
-#ifdef CONFIG_IBMVIO
-	else if (dev->bus == &vio_bus_type)
-		vio_unmap_sg(to_vio_dev(dev), sg, nhwentries, direction);
-#endif /* CONFIG_IBMVIO */
+	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+
+	if (dma_ops)
+		dma_ops->unmap_sg(dev, sg, nhwentries, direction);
 	else
 		BUG();
 }
diff -Nru a/arch/ppc64/kernel/eeh.c b/arch/ppc64/kernel/eeh.c
--- a/arch/ppc64/kernel/eeh.c	2005-01-25 13:50:16 -08:00
+++ b/arch/ppc64/kernel/eeh.c	2005-03-07 20:41:26 -08:00
@@ -824,7 +824,7 @@
 	struct pci_controller *phb;
 	struct eeh_early_enable_info info;
 
-	if (!dn || !eeh_subsystem_enabled)
+	if (!dn)
 		return;
 	phb = dn->phb;
 	if (NULL == phb || 0 == phb->buid) {
diff -Nru a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
--- a/arch/ppc64/kernel/head.S	2005-01-25 13:50:14 -08:00
+++ b/arch/ppc64/kernel/head.S	2005-03-04 22:41:54 -08:00
@@ -54,7 +54,6 @@
  * 0x0100 - 0x2fff : pSeries Interrupt prologs
  * 0x3000 - 0x3fff : Interrupt support
  * 0x4000 - 0x4fff : NACA
- * 0x5000 - 0x5fff : SystemCfg
  * 0x6000	   : iSeries and common interrupt prologs
  * 0x9000 - 0x9fff : Initial segment table
  */
@@ -517,16 +516,7 @@
 	.globl naca
 naca:
 	.llong itVpdAreas
-#endif
-
-	. = SYSTEMCFG_PHYS_ADDR
-	.globl __start_systemcfg
-__start_systemcfg:
-	. = (SYSTEMCFG_PHYS_ADDR + PAGE_SIZE)
-	.globl __end_systemcfg
-__end_systemcfg:
 
-#ifdef CONFIG_PPC_ISERIES
 	/*
 	 * The iSeries LPAR map is at this fixed address
 	 * so that the HvReleaseData structure can address
@@ -536,6 +526,8 @@
 	 * VSID generation algorithm.  See include/asm/mmu_context.h.
 	 */
 
+	. = 0x4800
+
 	.llong	2		/* # ESIDs to be mapped by hypervisor	 */
 	.llong	1		/* # memory ranges to be mapped by hypervisor */
 	.llong	STAB0_PAGE	/* Page # of segment table within load area	*/
@@ -1264,10 +1256,6 @@
 	addi	r2,r2,0x4000
 	addi	r2,r2,0x4000
 
-	LOADADDR(r9,systemcfg)
-	SET_REG_TO_CONST(r4, SYSTEMCFG_VIRT_ADDR)
-	std	r4,0(r9)		/* set the systemcfg pointer */
-
 	bl	.iSeries_early_setup
 
 	/* relocation is on at this point */
@@ -1772,7 +1760,7 @@
 	sc				/* HvCall_setASR */
 #else
 	/* set the ASR */
-	li	r3,SYSTEMCFG_PHYS_ADDR	/* r3 = ptr to systemcfg	 */
+	ld	r3,systemcfg@got(r2)	/* r3 = ptr to systemcfg	 */
 	lwz	r3,PLATFORM(r3)		/* r3 = platform flags		 */
 	cmpldi 	r3,PLATFORM_PSERIES_LPAR
 	bne	98f
@@ -1861,12 +1849,6 @@
 	ori	r6,r6,MSR_RI
 	mtmsrd	r6			/* RI on */
 
-	/* setup the systemcfg pointer which is needed by *tab_initialize	*/
-	LOADADDR(r6,systemcfg)
-	sub	r6,r6,r26		/* addr of the variable systemcfg */
-	li	r27,SYSTEMCFG_PHYS_ADDR
-	std	r27,0(r6)	 	/* set the value of systemcfg	*/
-
 #ifdef CONFIG_HMT
 	/* Start up the second thread on cpu 0 */
 	mfspr	r3,PVR
@@ -1941,7 +1923,7 @@
 	/* set the ASR */
 	ld	r3,PACASTABREAL(r13)
 	ori	r4,r3,1			/* turn on valid bit		 */
-	li	r3,SYSTEMCFG_PHYS_ADDR	/* r3 = ptr to systemcfg */
+	ld	r3,systemcfg@got(r2)	/* r3 = ptr to systemcfg */
 	lwz	r3,PLATFORM(r3)		/* r3 = platform flags */
 	cmpldi 	r3,PLATFORM_PSERIES_LPAR
 	bne	98f
@@ -1960,7 +1942,7 @@
 	mtasr	r4			/* set the stab location	*/
 99:
 	/* Set SDR1 (hash table pointer) */
-	li	r3,SYSTEMCFG_PHYS_ADDR	/* r3 = ptr to systemcfg */
+	ld	r3,systemcfg@got(r2)	/* r3 = ptr to systemcfg */
 	lwz	r3,PLATFORM(r3)		/* r3 = platform flags */
 	/* Test if bit 0 is set (LPAR bit) */
 	andi.	r3,r3,0x1
@@ -1997,11 +1979,6 @@
 	 */
 	li	r3,0
 	bl	.do_cpu_ftr_fixups
-
-	/* setup the systemcfg pointer */
-	LOADADDR(r9,systemcfg)
-	SET_REG_TO_CONST(r8, SYSTEMCFG_VIRT_ADDR)
-	std	r8,0(r9)
 
 	LOADADDR(r26, boot_cpuid)
 	lwz	r26,0(r26)
diff -Nru a/arch/ppc64/kernel/i8259.c b/arch/ppc64/kernel/i8259.c
--- a/arch/ppc64/kernel/i8259.c	2005-01-20 21:02:09 -08:00
+++ b/arch/ppc64/kernel/i8259.c	2005-03-07 20:41:25 -08:00
@@ -131,14 +131,11 @@
 }
 
 struct hw_interrupt_type i8259_pic = {
-        " i8259    ",
-        NULL,
-        NULL,
-        i8259_unmask_irq,
-        i8259_mask_irq,
-        i8259_mask_and_ack_irq,
-        i8259_end_irq,
-        NULL
+	.typename = " i8259    ",
+	.enable = i8259_unmask_irq,
+	.disable = i8259_mask_irq,
+	.ack = i8259_mask_and_ack_irq,
+	.end = i8259_end_irq,
 };
 
 void __init i8259_init(int offset)
diff -Nru a/arch/ppc64/kernel/iSeries_pci.c b/arch/ppc64/kernel/iSeries_pci.c
--- a/arch/ppc64/kernel/iSeries_pci.c	2005-01-20 21:02:09 -08:00
+++ b/arch/ppc64/kernel/iSeries_pci.c	2005-03-07 20:41:25 -08:00
@@ -610,6 +610,10 @@
 
 	if (node == NULL)
 		return PCIBIOS_DEVICE_NOT_FOUND;
+	if (offset > 255) {
+		*val = ~0;
+		return PCIBIOS_BAD_REGISTER_NUMBER;
+	}
 
 	fn = hv_cfg_read_func[(size - 1) & 3];
 	HvCall3Ret16(fn, &ret, node->DsaAddr.DsaAddr, offset, 0);
@@ -636,6 +640,8 @@
 
 	if (node == NULL)
 		return PCIBIOS_DEVICE_NOT_FOUND;
+	if (offset > 255)
+		return PCIBIOS_BAD_REGISTER_NUMBER;
 
 	fn = hv_cfg_write_func[(size - 1) & 3];
 	ret = HvCall4(fn, node->DsaAddr.DsaAddr, offset, val, 0);
diff -Nru a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c
--- a/arch/ppc64/kernel/iSeries_setup.c	2005-01-07 21:43:52 -08:00
+++ b/arch/ppc64/kernel/iSeries_setup.c	2005-03-04 22:41:15 -08:00
@@ -267,7 +267,7 @@
 	unsigned long i;
 	unsigned long mem_blocks = 0;
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_SLB)
+	if (cpu_has_feature(CPU_FTR_SLB))
 		mem_blocks = iSeries_process_Regatta_mainstore_vpd(mb_array,
 				max_entries);
 	else
diff -Nru a/arch/ppc64/kernel/idle.c b/arch/ppc64/kernel/idle.c
--- a/arch/ppc64/kernel/idle.c	2005-01-04 18:48:20 -08:00
+++ b/arch/ppc64/kernel/idle.c	2005-03-04 22:41:54 -08:00
@@ -293,6 +293,10 @@
 			power4_idle();
 		if (need_resched())
 			schedule();
+
+		if (cpu_is_offline(_smp_processor_id()) &&
+		    system_state == SYSTEM_RUNNING)
+			cpu_die();
 	}
 	return 0;
 }
diff -Nru a/arch/ppc64/kernel/ioctl32.c b/arch/ppc64/kernel/ioctl32.c
--- a/arch/ppc64/kernel/ioctl32.c	2004-09-16 23:58:38 -07:00
+++ b/arch/ppc64/kernel/ioctl32.c	2005-03-07 20:41:38 -08:00
@@ -39,7 +39,6 @@
 #include <linux/compat_ioctl.h>
 #define DECLARES
 #include "compat_ioctl.c"
-COMPATIBLE_IOCTL(TCSBRKP)
 COMPATIBLE_IOCTL(TIOCSTART)
 COMPATIBLE_IOCTL(TIOCSTOP)
 COMPATIBLE_IOCTL(TIOCSLTC)
diff -Nru a/arch/ppc64/kernel/iommu.c b/arch/ppc64/kernel/iommu.c
--- a/arch/ppc64/kernel/iommu.c	2005-01-07 21:43:52 -08:00
+++ b/arch/ppc64/kernel/iommu.c	2005-02-06 20:00:06 -08:00
@@ -513,8 +513,8 @@
  * Returns the virtual address of the buffer and sets dma_handle
  * to the dma address (mapping) of the first page.
  */
-void *iommu_alloc_consistent(struct iommu_table *tbl, size_t size,
-		dma_addr_t *dma_handle)
+void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
+		dma_addr_t *dma_handle, int flag)
 {
 	void *ret = NULL;
 	dma_addr_t mapping;
@@ -538,7 +538,7 @@
 		return NULL;
 
 	/* Alloc enough pages (and possibly more) */
-	ret = (void *)__get_free_pages(GFP_ATOMIC, order);
+	ret = (void *)__get_free_pages(flag, order);
 	if (!ret)
 		return NULL;
 	memset(ret, 0, size);
@@ -553,7 +553,7 @@
 	return ret;
 }
 
-void iommu_free_consistent(struct iommu_table *tbl, size_t size,
+void iommu_free_coherent(struct iommu_table *tbl, size_t size,
 			 void *vaddr, dma_addr_t dma_handle)
 {
 	unsigned int npages;
diff -Nru a/arch/ppc64/kernel/irq.c b/arch/ppc64/kernel/irq.c
--- a/arch/ppc64/kernel/irq.c	2005-01-20 20:56:33 -08:00
+++ b/arch/ppc64/kernel/irq.c	2005-03-04 22:41:54 -08:00
@@ -61,6 +61,7 @@
 #endif
 
 extern irq_desc_t irq_desc[NR_IRQS];
+EXPORT_SYMBOL(irq_desc);
 
 int distribute_irqs = 1;
 int __irq_offset_value;
@@ -114,6 +115,35 @@
 		seq_printf(p, "BAD: %10u\n", ppc_spurious_interrupts);
 	return 0;
 }
+
+#ifdef CONFIG_HOTPLUG_CPU
+void fixup_irqs(cpumask_t map)
+{
+	unsigned int irq;
+	static int warned;
+
+	for_each_irq(irq) {
+		cpumask_t mask;
+
+		if (irq_desc[irq].status & IRQ_PER_CPU)
+			continue;
+
+		cpus_and(mask, irq_affinity[irq], map);
+		if (any_online_cpu(mask) == NR_CPUS) {
+			printk("Breaking affinity for irq %i\n", irq);
+			mask = map;
+		}
+		if (irq_desc[irq].handler->set_affinity)
+			irq_desc[irq].handler->set_affinity(irq, mask);
+		else if (irq_desc[irq].action && !(warned++))
+			printk("Cannot set affinity for irq %i\n", irq);
+	}
+
+	local_irq_enable();
+	mdelay(1);
+	local_irq_disable();
+}
+#endif
 
 extern int noirqdebug;
 
diff -Nru a/arch/ppc64/kernel/kprobes.c b/arch/ppc64/kernel/kprobes.c
--- a/arch/ppc64/kernel/kprobes.c	2005-01-20 20:59:15 -08:00
+++ b/arch/ppc64/kernel/kprobes.c	2005-03-07 20:41:25 -08:00
@@ -105,9 +105,17 @@
 	p = get_kprobe(addr);
 	if (!p) {
 		unlock_kprobes();
-#if 0
 		if (*addr != BREAKPOINT_INSTRUCTION) {
 			/*
+			 * PowerPC has multiple variants of the "trap"
+			 * instruction. If the current instruction is a
+			 * trap variant, it could belong to someone else
+			 */
+			kprobe_opcode_t cur_insn = *addr;
+			if (IS_TW(cur_insn) || IS_TD(cur_insn) ||
+					IS_TWI(cur_insn) || IS_TDI(cur_insn))
+		       		goto no_kprobe;
+			/*
 			 * The breakpoint instruction was removed right
 			 * after we hit it.  Another cpu has removed
 			 * either a probepoint or a debugger breakpoint
@@ -116,7 +124,6 @@
 			 */
 			ret = 1;
 		}
-#endif
 		/* Not one of ours: let kernel handle it */
 		goto no_kprobe;
 	}
diff -Nru a/arch/ppc64/kernel/lparcfg.c b/arch/ppc64/kernel/lparcfg.c
--- a/arch/ppc64/kernel/lparcfg.c	2005-01-04 18:48:02 -08:00
+++ b/arch/ppc64/kernel/lparcfg.c	2005-03-04 22:41:53 -08:00
@@ -33,8 +33,9 @@
 #include <asm/cputable.h>
 #include <asm/rtas.h>
 #include <asm/system.h>
+#include <asm/time.h>
 
-#define MODULE_VERS "1.5"
+#define MODULE_VERS "1.6"
 #define MODULE_NAME "lparcfg"
 
 /* #define LPARCFG_DEBUG */
@@ -214,13 +215,20 @@
 }
 
 static unsigned long get_purr(void);
-/* ToDo:  get sum of purr across all processors.  The purr collection code
- * is coming, but at this time is still problematic, so for now this
- * function will return 0.
- */
+
+/* Track sum of all purrs across all processors. This is used to further */
+/* calculate usage values by different applications                       */
+
 static unsigned long get_purr(void)
 {
 	unsigned long sum_purr = 0;
+	int cpu;
+	struct cpu_usage *cu;
+
+	for_each_cpu(cpu) {
+		cu = &per_cpu(cpu_usage_array, cpu);
+		sum_purr += cu->current_tb;
+	}
 	return sum_purr;
 }
 
diff -Nru a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
--- a/arch/ppc64/kernel/misc.S	2005-01-14 11:56:04 -08:00
+++ b/arch/ppc64/kernel/misc.S	2005-03-06 15:58:58 -08:00
@@ -939,6 +939,7 @@
 	.llong .sys32_add_key
 	.llong .sys32_request_key
 	.llong .compat_sys_keyctl
+	.llong .compat_sys_waitid
 
 	.balign 8
 _GLOBAL(sys_call_table)
@@ -1214,3 +1215,4 @@
 	.llong .sys_add_key
 	.llong .sys_request_key		/* 270 */
 	.llong .sys_keyctl
+	.llong .sys_waitid
diff -Nru a/arch/ppc64/kernel/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c
--- a/arch/ppc64/kernel/pSeries_lpar.c	2005-01-20 21:02:10 -08:00
+++ b/arch/ppc64/kernel/pSeries_lpar.c	2005-03-04 22:41:15 -08:00
@@ -505,7 +505,7 @@
 	int i;
 	unsigned long flags = 0;
 	struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
-	int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE);
+	int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE);
 
 	if (lock_tlbie)
 		spin_lock_irqsave(&pSeries_lpar_tlbie_lock, flags);
diff -Nru a/arch/ppc64/kernel/pSeries_nvram.c b/arch/ppc64/kernel/pSeries_nvram.c
--- a/arch/ppc64/kernel/pSeries_nvram.c	2005-01-20 21:02:10 -08:00
+++ b/arch/ppc64/kernel/pSeries_nvram.c	2005-03-04 22:41:53 -08:00
@@ -11,14 +11,9 @@
  * This perhaps should live in drivers/char
  */
 
-#include <linux/module.h>
 
 #include <linux/types.h>
 #include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/miscdevice.h>
-#include <linux/fcntl.h>
-#include <linux/nvram.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
diff -Nru a/arch/ppc64/kernel/pSeries_pci.c b/arch/ppc64/kernel/pSeries_pci.c
--- a/arch/ppc64/kernel/pSeries_pci.c	2005-01-11 16:42:39 -08:00
+++ b/arch/ppc64/kernel/pSeries_pci.c	2005-03-07 20:41:26 -08:00
@@ -52,6 +52,16 @@
 
 extern struct mpic *pSeries_mpic;
 
+static int config_access_valid(struct device_node *dn, int where)
+{
+	if (where < 256)
+		return 1;
+	if (where < 4096 && dn->pci_ext_config_space)
+		return 1;
+
+	return 0;
+}
+
 static int rtas_read_config(struct device_node *dn, int where, int size, u32 *val)
 {
 	int returnval = -1;
@@ -60,10 +70,11 @@
 
 	if (!dn)
 		return PCIBIOS_DEVICE_NOT_FOUND;
-	if (where & (size - 1))
+	if (!config_access_valid(dn, where))
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 
-	addr = (dn->busno << 16) | (dn->devfn << 8) | where;
+	addr = ((where & 0xf00) << 20) | (dn->busno << 16) |
+		(dn->devfn << 8) | (where & 0xff);
 	buid = dn->phb->buid;
 	if (buid) {
 		ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval,
@@ -108,10 +119,11 @@
 
 	if (!dn)
 		return PCIBIOS_DEVICE_NOT_FOUND;
-	if (where & (size - 1))
+	if (!config_access_valid(dn, where))
 		return PCIBIOS_BAD_REGISTER_NUMBER;
 
-	addr = (dn->busno << 16) | (dn->devfn << 8) | where;
+	addr = ((where & 0xf00) << 20) | (dn->busno << 16) |
+		(dn->devfn << 8) | (where & 0xff);
 	buid = dn->phb->buid;
 	if (buid) {
 		ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, buid >> 32, buid & 0xffffffff, size, (ulong) val);
@@ -412,16 +424,18 @@
 	unsigned int root_size_cells = 0;
 	struct pci_controller *phb;
 	struct pci_bus *bus;
+	int primary;
 
 	root_size_cells = prom_n_size_cells(root);
 
+	primary = list_empty(&hose_list);
 	phb = alloc_phb_dynamic(dn, root_size_cells);
 	if (!phb)
 		return NULL;
 
 	pci_process_bridge_OF_ranges(phb, dn);
 
-	pci_setup_phb_io_dynamic(phb);
+	pci_setup_phb_io_dynamic(phb, primary);
 	of_node_put(root);
 
 	pci_devs_phb_init_dynamic(phb);
diff -Nru a/arch/ppc64/kernel/pSeries_setup.c b/arch/ppc64/kernel/pSeries_setup.c
--- a/arch/ppc64/kernel/pSeries_setup.c	2005-01-25 13:50:16 -08:00
+++ b/arch/ppc64/kernel/pSeries_setup.c	2005-03-06 20:15:22 -08:00
@@ -320,9 +320,10 @@
 	}
 }
 
-static void pSeries_cpu_die(void)
+static void pSeries_mach_cpu_die(void)
 {
 	local_irq_disable();
+	idle_task_exit();
 	/* Some hardware requires clearing the CPPR, while other hardware does not
 	 * it is safe either way
 	 */
@@ -599,7 +600,7 @@
 	.power_off		= rtas_power_off,
 	.halt			= rtas_halt,
 	.panic			= rtas_os_term,
-	.cpu_die		= pSeries_cpu_die,
+	.cpu_die		= pSeries_mach_cpu_die,
 	.get_boot_time		= pSeries_get_boot_time,
 	.get_rtc_time		= pSeries_get_rtc_time,
 	.set_rtc_time		= pSeries_set_rtc_time,
diff -Nru a/arch/ppc64/kernel/pSeries_smp.c b/arch/ppc64/kernel/pSeries_smp.c
--- a/arch/ppc64/kernel/pSeries_smp.c	2005-01-25 13:50:15 -08:00
+++ b/arch/ppc64/kernel/pSeries_smp.c	2005-03-02 12:50:33 -08:00
@@ -151,7 +151,7 @@
 		if (index) {
 			int state;
 			int rc = rtas_get_sensor(9003, *index, &state);
-			if (rc != 0 || state != 1)
+			if (rc < 0 || state != 1)
 				continue;
 		}
 
diff -Nru a/arch/ppc64/kernel/pacaData.c b/arch/ppc64/kernel/pacaData.c
--- a/arch/ppc64/kernel/pacaData.c	2005-01-11 16:42:40 -08:00
+++ b/arch/ppc64/kernel/pacaData.c	2005-03-04 22:41:53 -08:00
@@ -20,9 +20,14 @@
 #include <asm/iSeries/ItLpQueue.h>
 #include <asm/paca.h>
 
-struct systemcfg *systemcfg;
+static union {
+	struct systemcfg	data;
+	u8			page[PAGE_SIZE];
+} systemcfg_store __page_aligned;
+struct systemcfg *systemcfg = &systemcfg_store.data;
 EXPORT_SYMBOL(systemcfg);
 
+
 /* This symbol is provided by the linker - let it fill in the paca
  * field correctly */
 extern unsigned long __toc_start;
@@ -216,3 +221,4 @@
 #endif
 #endif
 };
+EXPORT_SYMBOL(paca);
diff -Nru a/arch/ppc64/kernel/pci.c b/arch/ppc64/kernel/pci.c
--- a/arch/ppc64/kernel/pci.c	2005-01-20 21:02:10 -08:00
+++ b/arch/ppc64/kernel/pci.c	2005-03-06 15:23:14 -08:00
@@ -63,13 +63,15 @@
  * page is mapped and isa_io_limit prevents access to it.
  */
 unsigned long isa_io_base;	/* NULL if no ISA bus */
+EXPORT_SYMBOL(isa_io_base);
 unsigned long pci_io_base;
+EXPORT_SYMBOL(pci_io_base);
 
 void iSeries_pcibios_init(void);
 
 LIST_HEAD(hose_list);
 
-struct pci_dma_ops pci_dma_ops;
+struct dma_mapping_ops pci_dma_ops;
 EXPORT_SYMBOL(pci_dma_ops);
 
 int global_phb_number;		/* Global phb counter */
@@ -300,19 +302,15 @@
 
 EXPORT_SYMBOL(pci_domain_nr);
 
-/* Set the name of the bus as it appears in /proc/bus/pci */
-int pci_name_bus(char *name, struct pci_bus *bus)
+/* Decide whether to display the domain number in /proc */
+int pci_proc_domain(struct pci_bus *bus)
 {
-#ifndef CONFIG_PPC_ISERIES
+#ifdef CONFIG_PPC_ISERIES
+	return 0;
+#else
 	struct pci_controller *hose = pci_bus_to_host(bus);
-
-	if (hose->buid)
-		sprintf(name, "%04x:%02x", pci_domain_nr(bus), bus->number);
-	else
+	return hose->buid;
 #endif
-		sprintf(name, "%02x", bus->number);
-
-	return 0;
 }
 
 /*
@@ -621,7 +619,8 @@
 	res->end += io_virt_offset;
 }
 
-void __devinit pci_setup_phb_io_dynamic(struct pci_controller *hose)
+void __devinit pci_setup_phb_io_dynamic(struct pci_controller *hose,
+					int primary)
 {
 	unsigned long size = hose->pci_io_size;
 	unsigned long io_virt_offset;
@@ -632,6 +631,9 @@
 	DBG("phb%d io_base_phys 0x%lx io_base_virt 0x%lx\n",
 		hose->global_number, hose->io_base_phys,
 		(unsigned long) hose->io_base_virt);
+
+	if (primary)
+		pci_io_base = (unsigned long)hose->io_base_virt;
 
 	io_virt_offset = (unsigned long)hose->io_base_virt - pci_io_base;
 	res = &hose->io_resource;
diff -Nru a/arch/ppc64/kernel/pci.h b/arch/ppc64/kernel/pci.h
--- a/arch/ppc64/kernel/pci.h	2005-01-11 16:42:39 -08:00
+++ b/arch/ppc64/kernel/pci.h	2005-03-07 20:41:26 -08:00
@@ -16,8 +16,7 @@
 
 extern void pci_setup_pci_controller(struct pci_controller *hose);
 extern void pci_setup_phb_io(struct pci_controller *hose, int primary);
-
-extern void pci_setup_phb_io_dynamic(struct pci_controller *hose);
+extern void pci_setup_phb_io_dynamic(struct pci_controller *hose, int primary);
 
 
 extern struct list_head hose_list;
diff -Nru a/arch/ppc64/kernel/pci_direct_iommu.c b/arch/ppc64/kernel/pci_direct_iommu.c
--- a/arch/ppc64/kernel/pci_direct_iommu.c	2005-01-07 21:43:52 -08:00
+++ b/arch/ppc64/kernel/pci_direct_iommu.c	2005-02-06 21:00:47 -08:00
@@ -30,12 +30,12 @@
 
 #include "pci.h"
 
-static void *pci_direct_alloc_consistent(struct pci_dev *hwdev, size_t size,
-				   dma_addr_t *dma_handle)
+static void *pci_direct_alloc_coherent(struct device *hwdev, size_t size,
+				   dma_addr_t *dma_handle, int flag)
 {
 	void *ret;
 
-	ret = (void *)__get_free_pages(GFP_ATOMIC, get_order(size));
+	ret = (void *)__get_free_pages(flag, get_order(size));
 	if (ret != NULL) {
 		memset(ret, 0, size);
 		*dma_handle = virt_to_abs(ret);
@@ -43,24 +43,24 @@
 	return ret;
 }
 
-static void pci_direct_free_consistent(struct pci_dev *hwdev, size_t size,
+static void pci_direct_free_coherent(struct device *hwdev, size_t size,
 				 void *vaddr, dma_addr_t dma_handle)
 {
 	free_pages((unsigned long)vaddr, get_order(size));
 }
 
-static dma_addr_t pci_direct_map_single(struct pci_dev *hwdev, void *ptr,
+static dma_addr_t pci_direct_map_single(struct device *hwdev, void *ptr,
 		size_t size, enum dma_data_direction direction)
 {
 	return virt_to_abs(ptr);
 }
 
-static void pci_direct_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
+static void pci_direct_unmap_single(struct device *hwdev, dma_addr_t dma_addr,
 		size_t size, enum dma_data_direction direction)
 {
 }
 
-static int pci_direct_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
+static int pci_direct_map_sg(struct device *hwdev, struct scatterlist *sg,
 		int nents, enum dma_data_direction direction)
 {
 	int i;
@@ -73,17 +73,23 @@
 	return nents;
 }
 
-static void pci_direct_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
+static void pci_direct_unmap_sg(struct device *hwdev, struct scatterlist *sg,
 		int nents, enum dma_data_direction direction)
 {
 }
 
+static int pci_direct_dma_supported(struct device *dev, u64 mask)
+{
+	return mask < 0x100000000ull;
+}
+
 void __init pci_direct_iommu_init(void)
 {
-	pci_dma_ops.pci_alloc_consistent = pci_direct_alloc_consistent;
-	pci_dma_ops.pci_free_consistent = pci_direct_free_consistent;
-	pci_dma_ops.pci_map_single = pci_direct_map_single;
-	pci_dma_ops.pci_unmap_single = pci_direct_unmap_single;
-	pci_dma_ops.pci_map_sg = pci_direct_map_sg;
-	pci_dma_ops.pci_unmap_sg = pci_direct_unmap_sg;
+	pci_dma_ops.alloc_coherent = pci_direct_alloc_coherent;
+	pci_dma_ops.free_coherent = pci_direct_free_coherent;
+	pci_dma_ops.map_single = pci_direct_map_single;
+	pci_dma_ops.unmap_single = pci_direct_unmap_single;
+	pci_dma_ops.map_sg = pci_direct_map_sg;
+	pci_dma_ops.unmap_sg = pci_direct_unmap_sg;
+	pci_dma_ops.dma_supported = pci_direct_dma_supported;
 }
diff -Nru a/arch/ppc64/kernel/pci_dn.c b/arch/ppc64/kernel/pci_dn.c
--- a/arch/ppc64/kernel/pci_dn.c	2005-01-11 16:42:39 -08:00
+++ b/arch/ppc64/kernel/pci_dn.c	2005-03-07 20:41:25 -08:00
@@ -37,6 +37,7 @@
 static void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
 {
 	struct pci_controller *phb = data;
+	int *type = (int *)get_property(dn, "ibm,pci-config-space-type", NULL);
 	u32 *regs;
 
 	dn->phb = phb;
@@ -46,6 +47,8 @@
 		dn->busno = (regs[0] >> 16) & 0xff;
 		dn->devfn = (regs[0] >> 8) & 0xff;
 	}
+
+	dn->pci_ext_config_space = (type && *type == 1);
 	return NULL;
 }
 
diff -Nru a/arch/ppc64/kernel/pci_iommu.c b/arch/ppc64/kernel/pci_iommu.c
--- a/arch/ppc64/kernel/pci_iommu.c	2004-11-15 19:29:08 -08:00
+++ b/arch/ppc64/kernel/pci_iommu.c	2005-02-06 20:10:05 -08:00
@@ -50,19 +50,23 @@
  */
 #define PCI_GET_DN(dev) ((struct device_node *)((dev)->sysdata))
 
-static inline struct iommu_table *devnode_table(struct pci_dev *dev)
+static inline struct iommu_table *devnode_table(struct device *dev)
 {
-	if (!dev)
-		dev = ppc64_isabridge_dev;
-	if (!dev)
-		return NULL;
+	struct pci_dev *pdev;
+
+	if (!dev) {
+		pdev = ppc64_isabridge_dev;
+		if (!pdev)
+			return NULL;
+	} else
+		pdev = to_pci_dev(dev);
 
 #ifdef CONFIG_PPC_ISERIES
-	return ISERIES_DEVNODE(dev)->iommu_table;
+	return ISERIES_DEVNODE(pdev)->iommu_table;
 #endif /* CONFIG_PPC_ISERIES */
 
 #ifdef CONFIG_PPC_MULTIPLATFORM
-	return PCI_GET_DN(dev)->iommu_table;
+	return PCI_GET_DN(pdev)->iommu_table;
 #endif /* CONFIG_PPC_MULTIPLATFORM */
 }
 
@@ -71,16 +75,17 @@
  * Returns the virtual address of the buffer and sets dma_handle
  * to the dma address (mapping) of the first page.
  */
-static void *pci_iommu_alloc_consistent(struct pci_dev *hwdev, size_t size,
-			   dma_addr_t *dma_handle)
+static void *pci_iommu_alloc_coherent(struct device *hwdev, size_t size,
+			   dma_addr_t *dma_handle, int flag)
 {
-	return iommu_alloc_consistent(devnode_table(hwdev), size, dma_handle);
+	return iommu_alloc_coherent(devnode_table(hwdev), size, dma_handle,
+			flag);
 }
 
-static void pci_iommu_free_consistent(struct pci_dev *hwdev, size_t size,
+static void pci_iommu_free_coherent(struct device *hwdev, size_t size,
 			 void *vaddr, dma_addr_t dma_handle)
 {
-	iommu_free_consistent(devnode_table(hwdev), size, vaddr, dma_handle);
+	iommu_free_coherent(devnode_table(hwdev), size, vaddr, dma_handle);
 }
 
 /* Creates TCEs for a user provided buffer.  The user buffer must be 
@@ -89,46 +94,46 @@
  * need not be page aligned, the dma_addr_t returned will point to the same
  * byte within the page as vaddr.
  */
-static dma_addr_t pci_iommu_map_single(struct pci_dev *hwdev, void *vaddr,
+static dma_addr_t pci_iommu_map_single(struct device *hwdev, void *vaddr,
 		size_t size, enum dma_data_direction direction)
 {
 	return iommu_map_single(devnode_table(hwdev), vaddr, size, direction);
 }
 
 
-static void pci_iommu_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_handle,
+static void pci_iommu_unmap_single(struct device *hwdev, dma_addr_t dma_handle,
 		size_t size, enum dma_data_direction direction)
 {
 	iommu_unmap_single(devnode_table(hwdev), dma_handle, size, direction);
 }
 
 
-static int pci_iommu_map_sg(struct pci_dev *pdev, struct scatterlist *sglist,
+static int pci_iommu_map_sg(struct device *pdev, struct scatterlist *sglist,
 		int nelems, enum dma_data_direction direction)
 {
-	return iommu_map_sg(&pdev->dev, devnode_table(pdev), sglist,
+	return iommu_map_sg(pdev, devnode_table(pdev), sglist,
 			nelems, direction);
 }
 
-static void pci_iommu_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist,
+static void pci_iommu_unmap_sg(struct device *pdev, struct scatterlist *sglist,
 		int nelems, enum dma_data_direction direction)
 {
 	iommu_unmap_sg(devnode_table(pdev), sglist, nelems, direction);
 }
 
 /* We support DMA to/from any memory page via the iommu */
-static int pci_iommu_dma_supported(struct pci_dev *pdev, u64 mask)
+static int pci_iommu_dma_supported(struct device *dev, u64 mask)
 {
 	return 1;
 }
 
 void pci_iommu_init(void)
 {
-	pci_dma_ops.pci_alloc_consistent = pci_iommu_alloc_consistent;
-	pci_dma_ops.pci_free_consistent = pci_iommu_free_consistent;
-	pci_dma_ops.pci_map_single = pci_iommu_map_single;
-	pci_dma_ops.pci_unmap_single = pci_iommu_unmap_single;
-	pci_dma_ops.pci_map_sg = pci_iommu_map_sg;
-	pci_dma_ops.pci_unmap_sg = pci_iommu_unmap_sg;
-	pci_dma_ops.pci_dma_supported = pci_iommu_dma_supported;
+	pci_dma_ops.alloc_coherent = pci_iommu_alloc_coherent;
+	pci_dma_ops.free_coherent = pci_iommu_free_coherent;
+	pci_dma_ops.map_single = pci_iommu_map_single;
+	pci_dma_ops.unmap_single = pci_iommu_unmap_single;
+	pci_dma_ops.map_sg = pci_iommu_map_sg;
+	pci_dma_ops.unmap_sg = pci_iommu_unmap_sg;
+	pci_dma_ops.dma_supported = pci_iommu_dma_supported;
 }
diff -Nru a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
--- a/arch/ppc64/kernel/pmac_setup.c	2005-01-07 21:43:52 -08:00
+++ b/arch/ppc64/kernel/pmac_setup.c	2005-03-07 20:41:25 -08:00
@@ -244,7 +244,6 @@
 {
 	btext_drawchar(c);
 }
-#endif /* CONFIG_BOOTX_TEXT */
 
 static void __init init_boot_display(void)
 {
@@ -280,6 +279,7 @@
 			return;
 	}
 }
+#endif /* CONFIG_BOOTX_TEXT */
 
 /* 
  * Early initialization.
@@ -439,6 +439,9 @@
 }
 
 struct machdep_calls __initdata pmac_md = {
+#ifdef CONFIG_HOTPLUG_CPU
+	.cpu_die		= generic_mach_cpu_die,
+#endif
 	.probe			= pmac_probe,
 	.setup_arch		= pmac_setup_arch,
 	.init_early		= pmac_init_early,
diff -Nru a/arch/ppc64/kernel/pmac_smp.c b/arch/ppc64/kernel/pmac_smp.c
--- a/arch/ppc64/kernel/pmac_smp.c	2005-01-20 21:02:10 -08:00
+++ b/arch/ppc64/kernel/pmac_smp.c	2005-03-04 22:41:54 -08:00
@@ -308,4 +308,9 @@
 void __init pmac_setup_smp(void)
 {
 	smp_ops = &core99_smp_ops;
+#ifdef CONFIG_HOTPLUG_CPU
+	smp_ops->cpu_enable = generic_cpu_enable;
+	smp_ops->cpu_disable = generic_cpu_disable;
+	smp_ops->cpu_die = generic_cpu_die;
+#endif
 }
diff -Nru a/arch/ppc64/kernel/pmc.c b/arch/ppc64/kernel/pmc.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/pmc.c	2005-03-04 22:41:55 -08:00
@@ -0,0 +1,64 @@
+/*
+ *  linux/arch/ppc64/kernel/pmc.c
+ *
+ *  Copyright (C) 2004 David Gibson, IBM Corporation.
+ *
+ *  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 <linux/config.h>
+#include <linux/errno.h>
+#include <linux/spinlock.h>
+
+#include <asm/processor.h>
+#include <asm/pmc.h>
+
+/* Ensure exceptions are disabled */
+static void dummy_perf(struct pt_regs *regs)
+{
+	unsigned int mmcr0 = mfspr(SPRN_MMCR0);
+
+	mmcr0 &= ~(MMCR0_PMXE|MMCR0_PMAO);
+	mtspr(SPRN_MMCR0, mmcr0);
+}
+
+static spinlock_t pmc_owner_lock = SPIN_LOCK_UNLOCKED;
+static void *pmc_owner_caller; /* mostly for debugging */
+perf_irq_t perf_irq = dummy_perf;
+
+int reserve_pmc_hardware(perf_irq_t new_perf_irq)
+{
+	int err = 0;
+
+	spin_lock(&pmc_owner_lock);
+
+	if (pmc_owner_caller) {
+		printk(KERN_WARNING "reserve_pmc_hardware: "
+		       "PMC hardware busy (reserved by caller %p)\n",
+		       pmc_owner_caller);
+		err = -EBUSY;
+		goto out;
+	}
+
+	pmc_owner_caller = __builtin_return_address(0);
+	perf_irq = new_perf_irq ? : dummy_perf;
+
+ out:
+	spin_unlock(&pmc_owner_lock);
+	return err;
+}
+
+void release_pmc_hardware(void)
+{
+	spin_lock(&pmc_owner_lock);
+
+	WARN_ON(! pmc_owner_caller);
+
+	pmc_owner_caller = NULL;
+	perf_irq = dummy_perf;
+
+	spin_unlock(&pmc_owner_lock);
+}
diff -Nru a/arch/ppc64/kernel/ppc_ksyms.c b/arch/ppc64/kernel/ppc_ksyms.c
--- a/arch/ppc64/kernel/ppc_ksyms.c	2005-01-11 16:42:39 -08:00
+++ b/arch/ppc64/kernel/ppc_ksyms.c	2005-03-04 22:41:53 -08:00
@@ -8,49 +8,18 @@
  */
 #include <linux/config.h>
 #include <linux/module.h>
-#include <linux/threads.h>
-#include <linux/smp.h>
-#include <linux/elfcore.h>
-#include <linux/sched.h>
 #include <linux/string.h>
-#include <linux/interrupt.h>
-#include <linux/spinlock.h>
 #include <linux/console.h>
-#include <linux/irq.h>
-#include <linux/pci.h>
-#include <linux/delay.h>
-#include <linux/smp_lock.h>
-#include <linux/syscalls.h>
-#include <linux/bitops.h>
+#include <net/checksum.h>
 
-#include <asm/page.h>
-#include <asm/semaphore.h>
 #include <asm/processor.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
-#include <asm/atomic.h>
-#include <asm/checksum.h>
-#include <asm/pgtable.h>
-#include <asm/prom.h>
 #include <asm/system.h>
-#include <asm/pci-bridge.h>
-#include <asm/irq.h>
-#include <asm/dma.h>
-#include <asm/machdep.h>
 #include <asm/hw_irq.h>
 #include <asm/abs_addr.h>
 #include <asm/cacheflush.h>
-#ifdef CONFIG_PPC_ISERIES
 #include <asm/iSeries/HvCallSc.h>
-#include <asm/iSeries/LparData.h>
-#endif
-
-extern int do_signal(sigset_t *, struct pt_regs *);
-
-EXPORT_SYMBOL(do_signal);
-
-EXPORT_SYMBOL(isa_io_base);
-EXPORT_SYMBOL(pci_io_base);
 
 EXPORT_SYMBOL(strcpy);
 EXPORT_SYMBOL(strncpy);
@@ -65,10 +34,6 @@
 EXPORT_SYMBOL(strcmp);
 EXPORT_SYMBOL(strncmp);
 
-EXPORT_SYMBOL(__down_interruptible);
-EXPORT_SYMBOL(__up);
-EXPORT_SYMBOL(__down);
-
 EXPORT_SYMBOL(csum_partial);
 EXPORT_SYMBOL(csum_partial_copy_generic);
 EXPORT_SYMBOL(ip_fast_csum);
@@ -79,11 +44,6 @@
 EXPORT_SYMBOL(__strncpy_from_user);
 EXPORT_SYMBOL(__strnlen_user);
 
-EXPORT_SYMBOL(clear_user_page);
-
-#ifdef CONFIG_MSCHUNKS
-EXPORT_SYMBOL(msChunks);
-#endif
 EXPORT_SYMBOL(reloc_offset);
 
 #ifdef CONFIG_PPC_ISERIES
@@ -107,11 +67,7 @@
 EXPORT_SYMBOL(_outsw_ns);
 EXPORT_SYMBOL(_insl_ns);
 EXPORT_SYMBOL(_outsl_ns);
-EXPORT_SYMBOL(ioremap);
-EXPORT_SYMBOL(__ioremap);
-EXPORT_SYMBOL(iounmap);
 
-EXPORT_SYMBOL(start_thread);
 EXPORT_SYMBOL(kernel_thread);
 
 EXPORT_SYMBOL(giveup_fpu);
@@ -119,8 +75,7 @@
 EXPORT_SYMBOL(giveup_altivec);
 #endif
 EXPORT_SYMBOL(flush_icache_range);
-EXPORT_SYMBOL(flush_icache_user_range);
-EXPORT_SYMBOL(flush_dcache_page);
+
 #ifdef CONFIG_SMP
 #ifdef CONFIG_PPC_ISERIES
 EXPORT_SYMBOL(local_get_flags);
@@ -129,19 +84,6 @@
 #endif
 #endif
 
-EXPORT_SYMBOL(ppc_md);
-
-#ifdef CONFIG_PPC_MULTIPLATFORM
-EXPORT_SYMBOL(find_devices);
-EXPORT_SYMBOL(find_type_devices);
-EXPORT_SYMBOL(find_compatible_devices);
-EXPORT_SYMBOL(find_path_device);
-EXPORT_SYMBOL(device_is_compatible);
-EXPORT_SYMBOL(machine_is_compatible);
-EXPORT_SYMBOL(find_all_nodes);
-EXPORT_SYMBOL(get_property);
-#endif
-
 EXPORT_SYMBOL(memcpy);
 EXPORT_SYMBOL(memset);
 EXPORT_SYMBOL(memmove);
@@ -150,10 +92,4 @@
 EXPORT_SYMBOL(memchr);
 
 EXPORT_SYMBOL(timer_interrupt);
-EXPORT_SYMBOL(irq_desc);
-EXPORT_SYMBOL(get_wchan);
 EXPORT_SYMBOL(console_drivers);
-
-EXPORT_SYMBOL(tb_ticks_per_usec);
-EXPORT_SYMBOL(paca);
-EXPORT_SYMBOL(cur_cpu_spec);
diff -Nru a/arch/ppc64/kernel/proc_ppc64.c b/arch/ppc64/kernel/proc_ppc64.c
--- a/arch/ppc64/kernel/proc_ppc64.c	2005-01-04 18:48:01 -08:00
+++ b/arch/ppc64/kernel/proc_ppc64.c	2005-03-04 22:41:53 -08:00
@@ -89,7 +89,7 @@
 		return 1;
 	pde->nlink = 1;
 	pde->data = systemcfg;
-	pde->size = 4096;
+	pde->size = PAGE_SIZE;
 	pde->proc_fops = &page_map_fops;
 
 #ifdef CONFIG_PPC_PSERIES
diff -Nru a/arch/ppc64/kernel/process.c b/arch/ppc64/kernel/process.c
--- a/arch/ppc64/kernel/process.c	2005-01-25 13:50:18 -08:00
+++ b/arch/ppc64/kernel/process.c	2005-03-04 22:41:53 -08:00
@@ -51,6 +51,7 @@
 #include <asm/cputable.h>
 #include <asm/sections.h>
 #include <asm/tlbflush.h>
+#include <asm/time.h>
 
 #ifndef CONFIG_SMP
 struct task_struct *last_task_used_math = NULL;
@@ -168,6 +169,8 @@
 
 #endif /* CONFIG_ALTIVEC */
 
+DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);
+
 struct task_struct *__switch_to(struct task_struct *prev,
 				struct task_struct *new)
 {
@@ -206,6 +209,21 @@
 	new_thread = &new->thread;
 	old_thread = &current->thread;
 
+/* Collect purr utilization data per process and per processor wise */
+/* purr is nothing but processor time base                          */
+
+#if defined(CONFIG_PPC_PSERIES)
+	if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
+		struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array);
+		long unsigned start_tb, current_tb;
+		start_tb = old_thread->start_tb;
+		cu->current_tb = current_tb = mfspr(SPRN_PURR);
+		old_thread->accum_tb += (current_tb - start_tb);
+		new_thread->start_tb = current_tb;
+	}
+#endif
+
+
 	local_irq_save(flags);
 	last = _switch(old_thread, new_thread);
 
@@ -388,12 +406,12 @@
 	kregs = (struct pt_regs *) sp;
 	sp -= STACK_FRAME_OVERHEAD;
 	p->thread.ksp = sp;
-	if (cur_cpu_spec->cpu_features & CPU_FTR_SLB) {
+	if (cpu_has_feature(CPU_FTR_SLB)) {
 		unsigned long sp_vsid = get_kernel_vsid(sp);
 
 		sp_vsid <<= SLB_VSID_SHIFT;
 		sp_vsid |= SLB_VSID_KERNEL;
-		if (cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE)
+		if (cpu_has_feature(CPU_FTR_16M_PAGE))
 			sp_vsid |= SLB_VSID_L;
 
 		p->thread.ksp_vsid = sp_vsid;
@@ -469,6 +487,7 @@
 	current->thread.used_vr = 0;
 #endif /* CONFIG_ALTIVEC */
 }
+EXPORT_SYMBOL(start_thread);
 
 int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
 {
@@ -607,6 +626,7 @@
 	} while (count++ < 16);
 	return 0;
 }
+EXPORT_SYMBOL(get_wchan);
 
 void show_stack(struct task_struct *p, unsigned long *_sp)
 {
diff -Nru a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c
--- a/arch/ppc64/kernel/prom.c	2005-01-25 20:58:33 -08:00
+++ b/arch/ppc64/kernel/prom.c	2005-03-07 20:41:25 -08:00
@@ -32,6 +32,8 @@
 #include <linux/delay.h>
 #include <linux/initrd.h>
 #include <linux/bitops.h>
+#include <linux/module.h>
+
 #include <asm/prom.h>
 #include <asm/rtas.h>
 #include <asm/lmb.h>
@@ -333,7 +335,8 @@
 		while ((l -= sizeof(struct pci_reg_property)) >= 0) {
 			if (!measure_only) {
 				adr[i].space = pci_addrs[i].addr.a_hi;
-				adr[i].address = pci_addrs[i].addr.a_lo;
+				adr[i].address = pci_addrs[i].addr.a_lo |
+					((u64)pci_addrs[i].addr.a_mid << 32);
 				adr[i].size = pci_addrs[i].size_lo;
 			}
 			++i;
@@ -1138,6 +1141,7 @@
 	*prevp = NULL;
 	return head;
 }
+EXPORT_SYMBOL(find_devices);
 
 /**
  * Construct and return a list of the device_nodes with a given type.
@@ -1157,6 +1161,7 @@
 	*prevp = NULL;
 	return head;
 }
+EXPORT_SYMBOL(find_type_devices);
 
 /**
  * Returns all nodes linked together
@@ -1174,6 +1179,7 @@
 	*prevp = NULL;
 	return head;
 }
+EXPORT_SYMBOL(find_all_nodes);
 
 /** Checks if the given "compat" string matches one of the strings in
  * the device's "compatible" property
@@ -1197,6 +1203,7 @@
 
 	return 0;
 }
+EXPORT_SYMBOL(device_is_compatible);
 
 
 /**
@@ -1216,6 +1223,7 @@
 	}
 	return rc;
 }
+EXPORT_SYMBOL(machine_is_compatible);
 
 /**
  * Construct and return a list of the device_nodes with a given type
@@ -1239,6 +1247,7 @@
 	*prevp = NULL;
 	return head;
 }
+EXPORT_SYMBOL(find_compatible_devices);
 
 /**
  * Find the device_node with a given full_name.
@@ -1253,6 +1262,7 @@
 			return np;
 	return NULL;
 }
+EXPORT_SYMBOL(find_path_device);
 
 /*******
  *
@@ -1712,7 +1722,8 @@
 			}
 			while ((l -= sizeof(struct pci_reg_property)) >= 0) {
 				adr[i].space = pci_addrs[i].addr.a_hi;
-				adr[i].address = pci_addrs[i].addr.a_lo;
+				adr[i].address = pci_addrs[i].addr.a_lo |
+					((u64)pci_addrs[i].addr.a_mid << 32);
 				adr[i].size = pci_addrs[i].size_lo;
 				++i;
 			}
@@ -1872,6 +1883,7 @@
 		}
 	return NULL;
 }
+EXPORT_SYMBOL(get_property);
 
 /*
  * Add a property to a node
diff -Nru a/arch/ppc64/kernel/prom_init.c b/arch/ppc64/kernel/prom_init.c
--- a/arch/ppc64/kernel/prom_init.c	2005-02-10 12:33:18 -08:00
+++ b/arch/ppc64/kernel/prom_init.c	2005-03-04 22:41:55 -08:00
@@ -151,7 +151,6 @@
 
 extern void __start(unsigned long r3, unsigned long r4, unsigned long r5);
 
-extern unsigned long reloc_offset(void);
 extern void enter_prom(struct prom_args *args, unsigned long entry);
 extern void copy_and_flush(unsigned long dest, unsigned long src,
 			   unsigned long size, unsigned long offset);
@@ -679,8 +678,7 @@
 	 * point to after it
 	 */
 	if (RELOC(prom_initrd_start)) {
-		if ((RELOC(prom_initrd_start) + RELOC(prom_initrd_end))
-		    > RELOC(alloc_bottom))
+		if (RELOC(prom_initrd_end) > RELOC(alloc_bottom))
 			RELOC(alloc_bottom) = PAGE_ALIGN(RELOC(prom_initrd_end));
 	}
 
diff -Nru a/arch/ppc64/kernel/rtas.c b/arch/ppc64/kernel/rtas.c
--- a/arch/ppc64/kernel/rtas.c	2005-01-20 21:02:10 -08:00
+++ b/arch/ppc64/kernel/rtas.c	2005-03-02 12:50:33 -08:00
@@ -255,29 +255,59 @@
 	return ms; 
 }
 
-int
-rtas_get_power_level(int powerdomain, int *level)
+int rtas_error_rc(int rtas_rc)
+{
+	int rc;
+
+	switch (rtas_rc) {
+		case -1: 		/* Hardware Error */
+			rc = -EIO;
+			break;
+		case -3:		/* Bad indicator/domain/etc */
+			rc = -EINVAL;
+			break;
+		case -9000:		/* Isolation error */
+			rc = -EFAULT;
+			break;
+		case -9001:		/* Outstanding TCE/PTE */
+			rc = -EEXIST;
+			break;
+		case -9002:		/* No usable slot */
+			rc = -ENODEV;
+			break;
+		default:
+			printk(KERN_ERR "%s: unexpected RTAS error %d\n",
+					__FUNCTION__, rtas_rc);
+			rc = -ERANGE;
+			break;
+	}
+	return rc;
+}
+
+int rtas_get_power_level(int powerdomain, int *level)
 {
 	int token = rtas_token("get-power-level");
 	int rc;
 
 	if (token == RTAS_UNKNOWN_SERVICE)
-		return RTAS_UNKNOWN_OP;
+		return -ENOENT;
 
 	while ((rc = rtas_call(token, 1, 2, level, powerdomain)) == RTAS_BUSY)
 		udelay(1);
+
+	if (rc < 0)
+		return rtas_error_rc(rc);
 	return rc;
 }
 
-int
-rtas_set_power_level(int powerdomain, int level, int *setlevel)
+int rtas_set_power_level(int powerdomain, int level, int *setlevel)
 {
 	int token = rtas_token("set-power-level");
 	unsigned int wait_time;
 	int rc;
 
 	if (token == RTAS_UNKNOWN_SERVICE)
-		return RTAS_UNKNOWN_OP;
+		return -ENOENT;
 
 	while (1) {
 		rc = rtas_call(token, 2, 2, setlevel, powerdomain, level);
@@ -289,18 +319,20 @@
 		} else
 			break;
 	}
+
+	if (rc < 0)
+		return rtas_error_rc(rc);
 	return rc;
 }
 
-int
-rtas_get_sensor(int sensor, int index, int *state)
+int rtas_get_sensor(int sensor, int index, int *state)
 {
 	int token = rtas_token("get-sensor-state");
 	unsigned int wait_time;
 	int rc;
 
 	if (token == RTAS_UNKNOWN_SERVICE)
-		return RTAS_UNKNOWN_OP;
+		return -ENOENT;
 
 	while (1) {
 		rc = rtas_call(token, 2, 2, state, sensor, index);
@@ -312,18 +344,20 @@
 		} else
 			break;
 	}
+
+	if (rc < 0)
+		return rtas_error_rc(rc);
 	return rc;
 }
 
-int
-rtas_set_indicator(int indicator, int index, int new_value)
+int rtas_set_indicator(int indicator, int index, int new_value)
 {
 	int token = rtas_token("set-indicator");
 	unsigned int wait_time;
 	int rc;
 
 	if (token == RTAS_UNKNOWN_SERVICE)
-		return RTAS_UNKNOWN_OP;
+		return -ENOENT;
 
 	while (1) {
 		rc = rtas_call(token, 3, 1, NULL, indicator, index, new_value);
@@ -337,6 +371,8 @@
 			break;
 	}
 
+	if (rc < 0)
+		return rtas_error_rc(rc);
 	return rc;
 }
 
diff -Nru a/arch/ppc64/kernel/rtasd.c b/arch/ppc64/kernel/rtasd.c
--- a/arch/ppc64/kernel/rtasd.c	2005-01-20 21:02:10 -08:00
+++ b/arch/ppc64/kernel/rtasd.c	2005-03-02 12:50:33 -08:00
@@ -347,7 +347,7 @@
 	if (error == 0)
 		return 0;
 
-	if (error == RTAS_NO_SUCH_INDICATOR) {
+	if (error == -EINVAL) {
 		printk(KERN_INFO "rtasd: surveillance not supported\n");
 		return 0;
 	}
diff -Nru a/arch/ppc64/kernel/semaphore.c b/arch/ppc64/kernel/semaphore.c
--- a/arch/ppc64/kernel/semaphore.c	2004-04-12 10:53:59 -07:00
+++ b/arch/ppc64/kernel/semaphore.c	2005-03-04 22:41:53 -08:00
@@ -18,6 +18,8 @@
 
 #include <linux/sched.h>
 #include <linux/init.h>
+#include <linux/module.h>
+
 #include <asm/atomic.h>
 #include <asm/semaphore.h>
 #include <asm/errno.h>
@@ -62,6 +64,7 @@
 	__sem_update_count(sem, 1);
 	wake_up(&sem->wait);
 }
+EXPORT_SYMBOL(__up);
 
 /*
  * Note that when we come in to __down or __down_interruptible,
@@ -99,6 +102,7 @@
 	 */
 	wake_up(&sem->wait);
 }
+EXPORT_SYMBOL(__down);
 
 int __sched __down_interruptible(struct semaphore * sem)
 {
@@ -129,3 +133,4 @@
 	wake_up(&sem->wait);
 	return retval;
 }
+EXPORT_SYMBOL(__down_interruptible);
diff -Nru a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
--- a/arch/ppc64/kernel/setup.c	2005-01-07 21:43:57 -08:00
+++ b/arch/ppc64/kernel/setup.c	2005-03-04 22:41:54 -08:00
@@ -129,6 +129,7 @@
 /* The main machine-dep calls structure
  */
 struct machdep_calls ppc_md;
+EXPORT_SYMBOL(ppc_md);
 
 #ifdef CONFIG_MAGIC_SYSRQ
 unsigned long SYSRQ_KEY;
@@ -315,7 +316,7 @@
 		maxcpus = ireg[num_addr_cell + num_size_cell];
 
 		/* Double maxcpus for processors which have SMT capability */
-		if (cur_cpu_spec->cpu_features & CPU_FTR_SMT)
+		if (cpu_has_feature(CPU_FTR_SMT))
 			maxcpus *= 2;
 
 		if (maxcpus > NR_CPUS) {
@@ -339,7 +340,7 @@
 	 */
 	for_each_cpu(cpu) {
 		cpu_set(cpu, cpu_sibling_map[cpu]);
-		if (cur_cpu_spec->cpu_features & CPU_FTR_SMT)
+		if (cpu_has_feature(CPU_FTR_SMT))
 			cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
 	}
 
@@ -767,7 +768,7 @@
 		seq_printf(m, "unknown (%08x)", pvr);
 
 #ifdef CONFIG_ALTIVEC
-	if (cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC)
+	if (cpu_has_feature(CPU_FTR_ALTIVEC))
 		seq_printf(m, ", altivec supported");
 #endif /* CONFIG_ALTIVEC */
 
@@ -990,6 +991,34 @@
 }
 
 /*
+ * Called from setup_arch to initialize the bitmap of available
+ * syscalls in the systemcfg page
+ */
+void __init setup_syscall_map(void)
+{
+	unsigned int i, count64 = 0, count32 = 0;
+	extern unsigned long *sys_call_table;
+	extern unsigned long *sys_call_table32;
+	extern unsigned long sys_ni_syscall;
+
+
+	for (i = 0; i < __NR_syscalls; i++) {
+		if (sys_call_table[i] == sys_ni_syscall)
+			continue;
+		count64++;
+		systemcfg->syscall_map_64[i >> 5] |= 0x80000000UL >> (i & 0x1f);
+	}
+	for (i = 0; i < __NR_syscalls; i++) {
+		if (sys_call_table32[i] == sys_ni_syscall)
+			continue;
+		count32++;
+		systemcfg->syscall_map_32[i >> 5] |= 0x80000000UL >> (i & 0x1f);
+	}
+	printk(KERN_INFO "Syscall map setup, %d 32 bits and %d 64 bits syscalls\n",
+	       count32, count64);
+}
+
+/*
  * Called into from start_kernel, after lock_kernel has been called.
  * Initializes bootmem, which is unsed to manage page allocation until
  * mem_init is called.
@@ -1027,6 +1056,9 @@
 	/* set up the bootmem stuff with available memory */
 	do_init_bootmem();
 
+	/* initialize the syscall map in systemcfg */
+	setup_syscall_map();
+
 	ppc_md.setup_arch();
 
 	/* Select the correct idle loop for the platform. */
@@ -1345,9 +1377,6 @@
 
 void cpu_die(void)
 {
-	idle_task_exit();
 	if (ppc_md.cpu_die)
 		ppc_md.cpu_die();
-	local_irq_disable();
-	for (;;);
 }
diff -Nru a/arch/ppc64/kernel/signal.c b/arch/ppc64/kernel/signal.c
--- a/arch/ppc64/kernel/signal.c	2005-01-21 16:00:00 -08:00
+++ b/arch/ppc64/kernel/signal.c	2005-03-04 22:41:54 -08:00
@@ -27,6 +27,8 @@
 #include <linux/stddef.h>
 #include <linux/elf.h>
 #include <linux/ptrace.h>
+#include <linux/module.h>
+
 #include <asm/sigcontext.h>
 #include <asm/ucontext.h>
 #include <asm/uaccess.h>
@@ -34,6 +36,7 @@
 #include <asm/ppcdebug.h>
 #include <asm/unistd.h>
 #include <asm/cacheflush.h>
+#include <asm/vdso.h>
 
 #define DEBUG_SIG 0
 
@@ -426,10 +429,14 @@
 		goto badframe;
 
 	/* Set up to return from userspace. */
-	err |= setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0]);
-	if (err)
-		goto badframe;
-
+	if (vdso64_rt_sigtramp && current->thread.vdso_base) {
+		regs->link = current->thread.vdso_base + vdso64_rt_sigtramp;
+	} else {
+		err |= setup_trampoline(__NR_rt_sigreturn, &frame->tramp[0]);
+		if (err)
+			goto badframe;
+		regs->link = (unsigned long) &frame->tramp[0];
+	}
 	funct_desc_ptr = (func_descr_t __user *) ka->sa.sa_handler;
 
 	/* Allocate a dummy caller frame for the signal handler. */
@@ -438,7 +445,6 @@
 
 	/* Set up "regs" so we "return" to the signal handler. */
 	err |= get_user(regs->nip, &funct_desc_ptr->entry);
-	regs->link = (unsigned long) &frame->tramp[0];
 	regs->gpr[1] = newsp;
 	err |= get_user(regs->gpr[2], &funct_desc_ptr->toc);
 	regs->gpr[3] = signr;
@@ -566,6 +572,4 @@
 
 	return 0;
 }
-
-
-
+EXPORT_SYMBOL(do_signal);
diff -Nru a/arch/ppc64/kernel/signal32.c b/arch/ppc64/kernel/signal32.c
--- a/arch/ppc64/kernel/signal32.c	2005-01-04 18:48:19 -08:00
+++ b/arch/ppc64/kernel/signal32.c	2005-03-04 22:41:54 -08:00
@@ -31,6 +31,7 @@
 #include <asm/ppcdebug.h>
 #include <asm/unistd.h>
 #include <asm/cacheflush.h>
+#include <asm/vdso.h>
 
 #define DEBUG_SIG 0
 
@@ -656,18 +657,24 @@
 
 	/* Save user registers on the stack */
 	frame = &rt_sf->uc.uc_mcontext;
-	if (save_user_regs(regs, frame, __NR_rt_sigreturn))
-		goto badframe;
-
 	if (put_user(regs->gpr[1], (unsigned long __user *)newsp))
 		goto badframe;
+
+	if (vdso32_rt_sigtramp && current->thread.vdso_base) {
+		if (save_user_regs(regs, frame, 0))
+			goto badframe;
+		regs->link = current->thread.vdso_base + vdso32_rt_sigtramp;
+	} else {
+		if (save_user_regs(regs, frame, __NR_rt_sigreturn))
+			goto badframe;
+		regs->link = (unsigned long) frame->tramp;
+	}
 	regs->gpr[1] = (unsigned long) newsp;
 	regs->gpr[3] = sig;
 	regs->gpr[4] = (unsigned long) &rt_sf->info;
 	regs->gpr[5] = (unsigned long) &rt_sf->uc;
 	regs->gpr[6] = (unsigned long) rt_sf;
 	regs->nip = (unsigned long) ka->sa.sa_handler;
-	regs->link = (unsigned long) frame->tramp;
 	regs->trap = 0;
 	regs->result = 0;
 
@@ -825,8 +832,15 @@
 	    || __put_user(sig, &sc->signal))
 		goto badframe;
 
-	if (save_user_regs(regs, &frame->mctx, __NR_sigreturn))
-		goto badframe;
+	if (vdso32_sigtramp && current->thread.vdso_base) {
+		if (save_user_regs(regs, &frame->mctx, 0))
+			goto badframe;
+		regs->link = current->thread.vdso_base + vdso32_sigtramp;
+	} else {
+		if (save_user_regs(regs, &frame->mctx, __NR_sigreturn))
+			goto badframe;
+		regs->link = (unsigned long) frame->mctx.tramp;
+	}
 
 	if (put_user(regs->gpr[1], (unsigned long __user *)newsp))
 		goto badframe;
@@ -834,7 +848,6 @@
 	regs->gpr[3] = sig;
 	regs->gpr[4] = (unsigned long) sc;
 	regs->nip = (unsigned long) ka->sa.sa_handler;
-	regs->link = (unsigned long) frame->mctx.tramp;
 	regs->trap = 0;
 	regs->result = 0;
 
diff -Nru a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c
--- a/arch/ppc64/kernel/smp.c	2005-01-25 13:50:15 -08:00
+++ b/arch/ppc64/kernel/smp.c	2005-03-04 22:41:54 -08:00
@@ -30,6 +30,7 @@
 #include <linux/err.h>
 #include <linux/sysdev.h>
 #include <linux/cpu.h>
+#include <linux/notifier.h>
 
 #include <asm/ptrace.h>
 #include <asm/atomic.h>
@@ -383,7 +384,7 @@
 	 * For now we leave it which means the time can be some
 	 * number of msecs off until someone does a settimeofday()
 	 */
-	do_gtod.tb_orig_stamp = tb_last_stamp;
+	do_gtod.varp->tb_orig_stamp = tb_last_stamp;
 	systemcfg->tb_orig_stamp = tb_last_stamp;
 #endif
 
@@ -406,17 +407,96 @@
 	current_set[boot_cpuid] = current->thread_info;
 }
 
+#ifdef CONFIG_HOTPLUG_CPU
+/* State of each CPU during hotplug phases */
+DEFINE_PER_CPU(int, cpu_state) = { 0 };
+
+int generic_cpu_disable(void)
+{
+	unsigned int cpu = smp_processor_id();
+
+	if (cpu == boot_cpuid)
+		return -EBUSY;
+
+	systemcfg->processorCount--;
+	cpu_clear(cpu, cpu_online_map);
+	fixup_irqs(cpu_online_map);
+	return 0;
+}
+
+int generic_cpu_enable(unsigned int cpu)
+{
+	/* Do the normal bootup if we haven't
+	 * already bootstrapped. */
+	if (system_state != SYSTEM_RUNNING)
+		return -ENOSYS;
+
+	/* get the target out of it's holding state */
+	per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
+	wmb();
+
+	while (!cpu_online(cpu))
+		cpu_relax();
+
+	fixup_irqs(cpu_online_map);
+	/* counter the irq disable in fixup_irqs */
+	local_irq_enable();
+	return 0;
+}
+
+void generic_cpu_die(unsigned int cpu)
+{
+	int i;
+
+	for (i = 0; i < 100; i++) {
+		rmb();
+		if (per_cpu(cpu_state, cpu) == CPU_DEAD)
+			return;
+		msleep(100);
+	}
+	printk(KERN_ERR "CPU%d didn't die...\n", cpu);
+}
+
+void generic_mach_cpu_die(void)
+{
+	unsigned int cpu;
+
+	local_irq_disable();
+	cpu = smp_processor_id();
+	printk(KERN_DEBUG "CPU%d offline\n", cpu);
+	__get_cpu_var(cpu_state) = CPU_DEAD;
+	wmb();
+	while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE)
+		cpu_relax();
+
+	flush_tlb_pending();
+	cpu_set(cpu, cpu_online_map);
+	local_irq_enable();
+}
+#endif
+
+static int __devinit cpu_enable(unsigned int cpu)
+{
+	if (smp_ops->cpu_enable)
+		return smp_ops->cpu_enable(cpu);
+
+	return -ENOSYS;
+}
+
 int __devinit __cpu_up(unsigned int cpu)
 {
 	int c;
 
+	if (!cpu_enable(cpu))
+		return 0;
+
 	/* At boot, don't bother with non-present cpus -JSCHOPP */
 	if (system_state < SYSTEM_RUNNING && !cpu_present(cpu))
 		return -ENOENT;
 
 	paca[cpu].default_decr = tb_ticks_per_jiffy / decr_overclock;
 
-	if (!(cur_cpu_spec->cpu_features & CPU_FTR_SLB)) {
+	if (!cpu_has_feature(CPU_FTR_SLB)) {
 		void *tmp;
 
 		/* maximum of 48 CPUs on machines with a segment table */
diff -Nru a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c
--- a/arch/ppc64/kernel/sysfs.c	2005-02-04 17:23:05 -08:00
+++ b/arch/ppc64/kernel/sysfs.c	2005-03-04 22:41:54 -08:00
@@ -18,7 +18,7 @@
 #include <asm/systemcfg.h>
 #include <asm/paca.h>
 #include <asm/lppaca.h>
-
+#include <asm/machdep.h>
 
 static DEFINE_PER_CPU(struct cpu, cpu_devices);
 
@@ -63,7 +63,7 @@
 	unsigned int *val;
 	unsigned int cpu;
 
-	if (!cur_cpu_spec->cpu_features & CPU_FTR_SMT)
+	if (!cpu_has_feature(CPU_FTR_SMT))
 		return 1;
 
 	options = find_path_device("/options");
@@ -86,7 +86,7 @@
 	unsigned int cpu;
 	int snooze;
 
-	if (!cur_cpu_spec->cpu_features & CPU_FTR_SMT)
+	if (!cpu_has_feature(CPU_FTR_SMT))
 		return 1;
 
 	smt_snooze_cmdline = 1;
@@ -167,7 +167,7 @@
 	 * On SMT machines we have to set the run latch in the ctrl register
 	 * in order to make PMC6 spin.
 	 */
-	if (cur_cpu_spec->cpu_features & CPU_FTR_SMT) {
+	if (cpu_has_feature(CPU_FTR_SMT)) {
 		ctrl = mfspr(CTRLF);
 		ctrl |= RUNLATCH;
 		mtspr(CTRLT, ctrl);
@@ -266,7 +266,7 @@
 	struct sys_device *s = &c->sysdev;
 
 #ifndef CONFIG_PPC_ISERIES
-	if (cur_cpu_spec->cpu_features & CPU_FTR_SMT)
+	if (cpu_has_feature(CPU_FTR_SMT))
 		sysdev_create_file(s, &attr_smt_snooze_delay);
 #endif
 
@@ -275,7 +275,7 @@
 	sysdev_create_file(s, &attr_mmcr0);
 	sysdev_create_file(s, &attr_mmcr1);
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_MMCRA)
+	if (cpu_has_feature(CPU_FTR_MMCRA))
 		sysdev_create_file(s, &attr_mmcra);
 
 	sysdev_create_file(s, &attr_pmc1);
@@ -285,12 +285,12 @@
 	sysdev_create_file(s, &attr_pmc5);
 	sysdev_create_file(s, &attr_pmc6);
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_PMC8) {
+	if (cpu_has_feature(CPU_FTR_PMC8)) {
 		sysdev_create_file(s, &attr_pmc7);
 		sysdev_create_file(s, &attr_pmc8);
 	}
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_SMT)
+	if (cpu_has_feature(CPU_FTR_SMT))
 		sysdev_create_file(s, &attr_purr);
 }
 
@@ -303,7 +303,7 @@
 	BUG_ON(c->no_control);
 
 #ifndef CONFIG_PPC_ISERIES
-	if (cur_cpu_spec->cpu_features & CPU_FTR_SMT)
+	if (cpu_has_feature(CPU_FTR_SMT))
 		sysdev_remove_file(s, &attr_smt_snooze_delay);
 #endif
 
@@ -312,7 +312,7 @@
 	sysdev_remove_file(s, &attr_mmcr0);
 	sysdev_remove_file(s, &attr_mmcr1);
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_MMCRA)
+	if (cpu_has_feature(CPU_FTR_MMCRA))
 		sysdev_remove_file(s, &attr_mmcra);
 
 	sysdev_remove_file(s, &attr_pmc1);
@@ -322,12 +322,12 @@
 	sysdev_remove_file(s, &attr_pmc5);
 	sysdev_remove_file(s, &attr_pmc6);
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_PMC8) {
+	if (cpu_has_feature(CPU_FTR_PMC8)) {
 		sysdev_remove_file(s, &attr_pmc7);
 		sysdev_remove_file(s, &attr_pmc8);
 	}
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_SMT)
+	if (cpu_has_feature(CPU_FTR_SMT))
 		sysdev_remove_file(s, &attr_purr);
 }
 #endif /* CONFIG_HOTPLUG_CPU */
@@ -413,9 +413,7 @@
 		 * CPU.  For instance, the boot cpu might never be valid
 		 * for hotplugging.
 		 */
-#ifdef CONFIG_HOTPLUG_CPU
-		if (systemcfg->platform != PLATFORM_PSERIES_LPAR)
-#endif
+		if (!ppc_md.cpu_die)
 			c->no_control = 1;
 
 		if (cpu_online(cpu) || (c->no_control == 0)) {
diff -Nru a/arch/ppc64/kernel/time.c b/arch/ppc64/kernel/time.c
--- a/arch/ppc64/kernel/time.c	2005-01-20 21:02:10 -08:00
+++ b/arch/ppc64/kernel/time.c	2005-03-04 22:41:54 -08:00
@@ -85,9 +85,8 @@
 
 unsigned long tb_ticks_per_jiffy;
 unsigned long tb_ticks_per_usec = 100; /* sane default */
+EXPORT_SYMBOL(tb_ticks_per_usec);
 unsigned long tb_ticks_per_sec;
-unsigned long next_xtime_sync_tb;
-unsigned long xtime_sync_interval;
 unsigned long tb_to_xs;
 unsigned      tb_to_us;
 unsigned long processor_freq;
@@ -158,8 +157,8 @@
 	 * The conversion to microseconds at the end is done
 	 * without a divide (and in fact, without a multiply)
 	 */
-	tb_ticks = tb_val - do_gtod.tb_orig_stamp;
 	temp_varp = do_gtod.varp;
+	tb_ticks = tb_val - temp_varp->tb_orig_stamp;
 	temp_tb_to_xs = temp_varp->tb_to_xs;
 	temp_stamp_xsec = temp_varp->stamp_xsec;
 	tb_xsec = mulhdu( tb_ticks, temp_tb_to_xs );
@@ -185,17 +184,55 @@
 {
 	struct timeval my_tv;
 
-	if (cur_tb > next_xtime_sync_tb) {
-		next_xtime_sync_tb = cur_tb + xtime_sync_interval;
-		__do_gettimeofday(&my_tv, cur_tb);
-
-		if (xtime.tv_sec <= my_tv.tv_sec) {
-			xtime.tv_sec = my_tv.tv_sec;
-			xtime.tv_nsec = my_tv.tv_usec * 1000;
-		}
+	__do_gettimeofday(&my_tv, cur_tb);
+
+	if (xtime.tv_sec <= my_tv.tv_sec) {
+		xtime.tv_sec = my_tv.tv_sec;
+		xtime.tv_nsec = my_tv.tv_usec * 1000;
 	}
 }
 
+/*
+ * When the timebase - tb_orig_stamp gets too big, we do a manipulation
+ * between tb_orig_stamp and stamp_xsec. The goal here is to keep the
+ * difference tb - tb_orig_stamp small enough to always fit inside a
+ * 32 bits number. This is a requirement of our fast 32 bits userland
+ * implementation in the vdso. If we "miss" a call to this function
+ * (interrupt latency, CPU locked in a spinlock, ...) and we end up
+ * with a too big difference, then the vdso will fallback to calling
+ * the syscall
+ */
+static __inline__ void timer_recalc_offset(unsigned long cur_tb)
+{
+	struct gettimeofday_vars * temp_varp;
+	unsigned temp_idx;
+	unsigned long offset, new_stamp_xsec, new_tb_orig_stamp;
+
+	if (((cur_tb - do_gtod.varp->tb_orig_stamp) & 0x80000000u) == 0)
+		return;
+
+	temp_idx = (do_gtod.var_idx == 0);
+	temp_varp = &do_gtod.vars[temp_idx];
+
+	new_tb_orig_stamp = cur_tb;
+	offset = new_tb_orig_stamp - do_gtod.varp->tb_orig_stamp;
+	new_stamp_xsec = do_gtod.varp->stamp_xsec + mulhdu(offset, do_gtod.varp->tb_to_xs);
+
+	temp_varp->tb_to_xs = do_gtod.varp->tb_to_xs;
+	temp_varp->tb_orig_stamp = new_tb_orig_stamp;
+	temp_varp->stamp_xsec = new_stamp_xsec;
+	mb();
+	do_gtod.varp = temp_varp;
+	do_gtod.var_idx = temp_idx;
+
+	++(systemcfg->tb_update_count);
+	wmb();
+	systemcfg->tb_orig_stamp = new_tb_orig_stamp;
+	systemcfg->stamp_xsec = new_stamp_xsec;
+	wmb();
+	++(systemcfg->tb_update_count);
+}
+
 #ifdef CONFIG_SMP
 unsigned long profile_pc(struct pt_regs *regs)
 {
@@ -311,6 +348,7 @@
 		if (cpu == boot_cpuid) {
 			write_seqlock(&xtime_lock);
 			tb_last_stamp = lpaca->next_jiffy_update_tb;
+			timer_recalc_offset(lpaca->next_jiffy_update_tb);
 			do_timer(regs);
 			timer_sync_xtime(lpaca->next_jiffy_update_tb);
 			timer_check_rtc();
@@ -334,6 +372,14 @@
 	}
 #endif
 
+/* collect purr register values often, for accurate calculations */
+#if defined(CONFIG_PPC_PSERIES)
+	if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
+		struct cpu_usage *cu = &__get_cpu_var(cpu_usage_array);
+		cu->current_tb = mfspr(SPRN_PURR);
+	}
+#endif
+
 	irq_exit();
 
 	return 1;
@@ -398,7 +444,9 @@
 	time_maxerror = NTP_PHASE_LIMIT;
 	time_esterror = NTP_PHASE_LIMIT;
 
-	delta_xsec = mulhdu( (tb_last_stamp-do_gtod.tb_orig_stamp), do_gtod.varp->tb_to_xs );
+	delta_xsec = mulhdu( (tb_last_stamp-do_gtod.varp->tb_orig_stamp),
+			     do_gtod.varp->tb_to_xs );
+
 	new_xsec = (new_nsec * XSEC_PER_SEC) / NSEC_PER_SEC;
 	new_xsec += new_sec * XSEC_PER_SEC;
 	if ( new_xsec > delta_xsec ) {
@@ -411,7 +459,7 @@
 		 * before 1970 ... eg. we booted ten days ago, and we are setting
 		 * the time to Jan 5, 1970 */
 		do_gtod.varp->stamp_xsec = new_xsec;
-		do_gtod.tb_orig_stamp = tb_last_stamp;
+		do_gtod.varp->tb_orig_stamp = tb_last_stamp;
 		systemcfg->stamp_xsec = new_xsec;
 		systemcfg->tb_orig_stamp = tb_last_stamp;
 	}
@@ -464,9 +512,9 @@
 	xtime.tv_sec = mktime(tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
 			      tm.tm_hour, tm.tm_min, tm.tm_sec);
 	tb_last_stamp = get_tb();
-	do_gtod.tb_orig_stamp = tb_last_stamp;
 	do_gtod.varp = &do_gtod.vars[0];
 	do_gtod.var_idx = 0;
+	do_gtod.varp->tb_orig_stamp = tb_last_stamp;
 	do_gtod.varp->stamp_xsec = xtime.tv_sec * XSEC_PER_SEC;
 	do_gtod.tb_ticks_per_sec = tb_ticks_per_sec;
 	do_gtod.varp->tb_to_xs = tb_to_xs;
@@ -477,9 +525,6 @@
 	systemcfg->stamp_xsec = xtime.tv_sec * XSEC_PER_SEC;
 	systemcfg->tb_to_xs = tb_to_xs;
 
-	xtime_sync_interval = tb_ticks_per_sec - (tb_ticks_per_sec/8);
-	next_xtime_sync_tb = tb_last_stamp + xtime_sync_interval;
-
 	time_freq = 0;
 
 	xtime.tv_nsec = 0;
@@ -584,12 +629,12 @@
 	   stamp_xsec which is the time (in 1/2^20 second units) corresponding to tb_orig_stamp.  This 
 	   new value of stamp_xsec compensates for the change in frequency (implied by the new tb_to_xs)
 	   which guarantees that the current time remains the same */ 
-	tb_ticks = get_tb() - do_gtod.tb_orig_stamp;
+	write_seqlock_irqsave( &xtime_lock, flags );
+	tb_ticks = get_tb() - do_gtod.varp->tb_orig_stamp;
 	div128_by_32( 1024*1024, 0, new_tb_ticks_per_sec, &divres );
 	new_tb_to_xs = divres.result_low;
 	new_xsec = mulhdu( tb_ticks, new_tb_to_xs );
 
-	write_seqlock_irqsave( &xtime_lock, flags );
 	old_xsec = mulhdu( tb_ticks, do_gtod.varp->tb_to_xs );
 	new_stamp_xsec = do_gtod.varp->stamp_xsec + old_xsec - new_xsec;
 
@@ -597,16 +642,12 @@
 	   values in do_gettimeofday.  We alternate the copies and as long as a reasonable time elapses between
 	   changes, there will never be inconsistent values.  ntpd has a minimum of one minute between updates */
 
-	if (do_gtod.var_idx == 0) {
-		temp_varp = &do_gtod.vars[1];
-		temp_idx  = 1;
-	}
-	else {
-		temp_varp = &do_gtod.vars[0];
-		temp_idx  = 0;
-	}
+	temp_idx = (do_gtod.var_idx == 0);
+	temp_varp = &do_gtod.vars[temp_idx];
+
 	temp_varp->tb_to_xs = new_tb_to_xs;
 	temp_varp->stamp_xsec = new_stamp_xsec;
+	temp_varp->tb_orig_stamp = do_gtod.varp->tb_orig_stamp;
 	mb();
 	do_gtod.varp = temp_varp;
 	do_gtod.var_idx = temp_idx;
diff -Nru a/arch/ppc64/kernel/traps.c b/arch/ppc64/kernel/traps.c
--- a/arch/ppc64/kernel/traps.c	2005-01-25 13:50:15 -08:00
+++ b/arch/ppc64/kernel/traps.c	2005-03-04 22:41:55 -08:00
@@ -41,6 +41,7 @@
 #include <asm/rtas.h>
 #include <asm/systemcfg.h>
 #include <asm/machdep.h>
+#include <asm/pmc.h>
 
 #ifdef CONFIG_DEBUGGER
 int (*__debugger)(struct pt_regs *regs);
@@ -450,18 +451,7 @@
 	die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT);
 }
 
-/* Ensure exceptions are disabled */
-static void dummy_perf(struct pt_regs *regs)
-{
-	unsigned int mmcr0 = mfspr(SPRN_MMCR0);
-
-	mmcr0 &= ~(MMCR0_PMXE|MMCR0_PMAO);
-	mtspr(SPRN_MMCR0, mmcr0);
-}
-
-void (*perf_irq)(struct pt_regs *) = dummy_perf;
-
-EXPORT_SYMBOL(perf_irq);
+extern perf_irq_t perf_irq;
 
 void performance_monitor_exception(struct pt_regs *regs)
 {
diff -Nru a/arch/ppc64/kernel/vdso.c b/arch/ppc64/kernel/vdso.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso.c	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,614 @@
+/*
+ *  linux/arch/ppc64/kernel/vdso.c
+ *
+ *    Copyright (C) 2004 Benjamin Herrenschmidt, IBM Corp.
+ *			 <benh@kernel.crashing.org>
+ *
+ *  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 <linux/config.h>
+#include <linux/module.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/smp_lock.h>
+#include <linux/stddef.h>
+#include <linux/unistd.h>
+#include <linux/slab.h>
+#include <linux/user.h>
+#include <linux/elf.h>
+#include <linux/security.h>
+#include <linux/bootmem.h>
+
+#include <asm/pgtable.h>
+#include <asm/system.h>
+#include <asm/processor.h>
+#include <asm/mmu.h>
+#include <asm/mmu_context.h>
+#include <asm/machdep.h>
+#include <asm/cputable.h>
+#include <asm/sections.h>
+#include <asm/vdso.h>
+
+#undef DEBUG
+
+#ifdef DEBUG
+#define DBG(fmt...) printk(fmt)
+#else
+#define DBG(fmt...)
+#endif
+
+
+/*
+ * The vDSOs themselves are here
+ */
+extern char vdso64_start, vdso64_end;
+extern char vdso32_start, vdso32_end;
+
+static void *vdso64_kbase = &vdso64_start;
+static void *vdso32_kbase = &vdso32_start;
+
+unsigned int vdso64_pages;
+unsigned int vdso32_pages;
+
+/* Signal trampolines user addresses */
+
+unsigned long vdso64_rt_sigtramp;
+unsigned long vdso32_sigtramp;
+unsigned long vdso32_rt_sigtramp;
+
+/* Format of the patch table */
+struct vdso_patch_def
+{
+	u32		pvr_mask, pvr_value;
+	const char	*gen_name;
+	const char	*fix_name;
+};
+
+/* Table of functions to patch based on the CPU type/revision
+ *
+ * TODO: Improve by adding whole lists for each entry
+ */
+static struct vdso_patch_def vdso_patches[] = {
+	{
+		0xffff0000, 0x003a0000,		/* POWER5 */
+		"__kernel_sync_dicache", "__kernel_sync_dicache_p5"
+	},
+	{
+		0xffff0000, 0x003b0000,		/* POWER5 */
+		"__kernel_sync_dicache", "__kernel_sync_dicache_p5"
+	},
+};
+
+/*
+ * Some infos carried around for each of them during parsing at
+ * boot time.
+ */
+struct lib32_elfinfo
+{
+	Elf32_Ehdr	*hdr;		/* ptr to ELF */
+	Elf32_Sym	*dynsym;	/* ptr to .dynsym section */
+	unsigned long	dynsymsize;	/* size of .dynsym section */
+	char		*dynstr;	/* ptr to .dynstr section */
+	unsigned long	text;		/* offset of .text section in .so */
+};
+
+struct lib64_elfinfo
+{
+	Elf64_Ehdr	*hdr;
+	Elf64_Sym	*dynsym;
+	unsigned long	dynsymsize;
+	char		*dynstr;
+	unsigned long	text;
+};
+
+
+#ifdef __DEBUG
+static void dump_one_vdso_page(struct page *pg, struct page *upg)
+{
+	printk("kpg: %p (c:%d,f:%08lx)", __va(page_to_pfn(pg) << PAGE_SHIFT),
+	       page_count(pg),
+	       pg->flags);
+	if (upg/* && pg != upg*/) {
+		printk(" upg: %p (c:%d,f:%08lx)", __va(page_to_pfn(upg) << PAGE_SHIFT),
+		       page_count(upg),
+		       upg->flags);
+	}
+	printk("\n");
+}
+
+static void dump_vdso_pages(struct vm_area_struct * vma)
+{
+	int i;
+
+	if (!vma || test_thread_flag(TIF_32BIT)) {
+		printk("vDSO32 @ %016lx:\n", (unsigned long)vdso32_kbase);
+		for (i=0; i<vdso32_pages; i++) {
+			struct page *pg = virt_to_page(vdso32_kbase + i*PAGE_SIZE);
+			struct page *upg = (vma && vma->vm_mm) ?
+				follow_page(vma->vm_mm, vma->vm_start + i*PAGE_SIZE, 0)
+				: NULL;
+			dump_one_vdso_page(pg, upg);
+		}
+	}
+	if (!vma || !test_thread_flag(TIF_32BIT)) {
+		printk("vDSO64 @ %016lx:\n", (unsigned long)vdso64_kbase);
+		for (i=0; i<vdso64_pages; i++) {
+			struct page *pg = virt_to_page(vdso64_kbase + i*PAGE_SIZE);
+			struct page *upg = (vma && vma->vm_mm) ?
+				follow_page(vma->vm_mm, vma->vm_start + i*PAGE_SIZE, 0)
+				: NULL;
+			dump_one_vdso_page(pg, upg);
+		}
+	}
+}
+#endif /* DEBUG */
+
+/*
+ * Keep a dummy vma_close for now, it will prevent VMA merging.
+ */
+static void vdso_vma_close(struct vm_area_struct * vma)
+{
+}
+
+/*
+ * Our nopage() function, maps in the actual vDSO kernel pages, they will
+ * be mapped read-only by do_no_page(), and eventually COW'ed, either
+ * right away for an initial write access, or by do_wp_page().
+ */
+static struct page * vdso_vma_nopage(struct vm_area_struct * vma,
+				     unsigned long address, int *type)
+{
+	unsigned long offset = address - vma->vm_start;
+	struct page *pg;
+	void *vbase = test_thread_flag(TIF_32BIT) ? vdso32_kbase : vdso64_kbase;
+
+	DBG("vdso_vma_nopage(current: %s, address: %016lx, off: %lx)\n",
+	    current->comm, address, offset);
+
+	if (address < vma->vm_start || address > vma->vm_end)
+		return NOPAGE_SIGBUS;
+
+	/*
+	 * Last page is systemcfg, special handling here, no get_page() a
+	 * this is a reserved page
+	 */
+	if ((vma->vm_end - address) <= PAGE_SIZE)
+		return virt_to_page(systemcfg);
+
+	pg = virt_to_page(vbase + offset);
+	get_page(pg);
+	DBG(" ->page count: %d\n", page_count(pg));
+
+	return pg;
+}
+
+static struct vm_operations_struct vdso_vmops = {
+	.close	= vdso_vma_close,
+	.nopage	= vdso_vma_nopage,
+};
+
+/*
+ * This is called from binfmt_elf, we create the special vma for the
+ * vDSO and insert it into the mm struct tree
+ */
+int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack)
+{
+	struct mm_struct *mm = current->mm;
+	struct vm_area_struct *vma;
+	unsigned long vdso_pages;
+	unsigned long vdso_base;
+
+	if (test_thread_flag(TIF_32BIT)) {
+		vdso_pages = vdso32_pages;
+		vdso_base = VDSO32_MBASE;
+	} else {
+		vdso_pages = vdso64_pages;
+		vdso_base = VDSO64_MBASE;
+	}
+
+	/* vDSO has a problem and was disabled, just don't "enable" it for the
+	 * process
+	 */
+	if (vdso_pages == 0) {
+		current->thread.vdso_base = 0;
+		return 0;
+	}
+	vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
+	if (vma == NULL)
+		return -ENOMEM;
+	if (security_vm_enough_memory(vdso_pages)) {
+		kmem_cache_free(vm_area_cachep, vma);
+		return -ENOMEM;
+	}
+	memset(vma, 0, sizeof(*vma));
+
+	/*
+	 * pick a base address for the vDSO in process space. We have a default
+	 * base of 1Mb on which we had a random offset up to 1Mb.
+	 * XXX: Add possibility for a program header to specify that location
+	 */
+	current->thread.vdso_base = vdso_base;
+	/*  + ((unsigned long)vma & 0x000ff000); */
+
+	vma->vm_mm = mm;
+	vma->vm_start = current->thread.vdso_base;
+
+	/*
+	 * the VMA size is one page more than the vDSO since systemcfg
+	 * is mapped in the last one
+	 */
+	vma->vm_end = vma->vm_start + ((vdso_pages + 1) << PAGE_SHIFT);
+
+	/*
+	 * our vma flags don't have VM_WRITE so by default, the process isn't allowed
+	 * to write those pages.
+	 * gdb can break that with ptrace interface, and thus trigger COW on those
+	 * pages but it's then your responsibility to never do that on the "data" page
+	 * of the vDSO or you'll stop getting kernel updates and your nice userland
+	 * gettimeofday will be totally dead. It's fine to use that for setting
+	 * breakpoints in the vDSO code pages though
+	 */
+	vma->vm_flags = VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC;
+	vma->vm_flags |= mm->def_flags;
+	vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];
+	vma->vm_ops = &vdso_vmops;
+
+	down_write(&mm->mmap_sem);
+	insert_vm_struct(mm, vma);
+	mm->total_vm += (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
+	up_write(&mm->mmap_sem);
+
+	return 0;
+}
+
+static void * __init find_section32(Elf32_Ehdr *ehdr, const char *secname,
+				  unsigned long *size)
+{
+	Elf32_Shdr *sechdrs;
+	unsigned int i;
+	char *secnames;
+
+	/* Grab section headers and strings so we can tell who is who */
+	sechdrs = (void *)ehdr + ehdr->e_shoff;
+	secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset;
+
+	/* Find the section they want */
+	for (i = 1; i < ehdr->e_shnum; i++) {
+		if (strcmp(secnames+sechdrs[i].sh_name, secname) == 0) {
+			if (size)
+				*size = sechdrs[i].sh_size;
+			return (void *)ehdr + sechdrs[i].sh_offset;
+		}
+	}
+	*size = 0;
+	return NULL;
+}
+
+static void * __init find_section64(Elf64_Ehdr *ehdr, const char *secname,
+				  unsigned long *size)
+{
+	Elf64_Shdr *sechdrs;
+	unsigned int i;
+	char *secnames;
+
+	/* Grab section headers and strings so we can tell who is who */
+	sechdrs = (void *)ehdr + ehdr->e_shoff;
+	secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset;
+
+	/* Find the section they want */
+	for (i = 1; i < ehdr->e_shnum; i++) {
+		if (strcmp(secnames+sechdrs[i].sh_name, secname) == 0) {
+			if (size)
+				*size = sechdrs[i].sh_size;
+			return (void *)ehdr + sechdrs[i].sh_offset;
+		}
+	}
+	if (size)
+		*size = 0;
+	return NULL;
+}
+
+static Elf32_Sym * __init find_symbol32(struct lib32_elfinfo *lib, const char *symname)
+{
+	unsigned int i;
+	char name[32], *c;
+
+	for (i = 0; i < (lib->dynsymsize / sizeof(Elf32_Sym)); i++) {
+		if (lib->dynsym[i].st_name == 0)
+			continue;
+		strlcpy(name, lib->dynstr + lib->dynsym[i].st_name, 32);
+		c = strchr(name, '@');
+		if (c)
+			*c = 0;
+		if (strcmp(symname, name) == 0)
+			return &lib->dynsym[i];
+	}
+	return NULL;
+}
+
+static Elf64_Sym * __init find_symbol64(struct lib64_elfinfo *lib, const char *symname)
+{
+	unsigned int i;
+	char name[32], *c;
+
+	for (i = 0; i < (lib->dynsymsize / sizeof(Elf64_Sym)); i++) {
+		if (lib->dynsym[i].st_name == 0)
+			continue;
+		strlcpy(name, lib->dynstr + lib->dynsym[i].st_name, 32);
+		c = strchr(name, '@');
+		if (c)
+			*c = 0;
+		if (strcmp(symname, name) == 0)
+			return &lib->dynsym[i];
+	}
+	return NULL;
+}
+
+/* Note that we assume the section is .text and the symbol is relative to
+ * the library base
+ */
+static unsigned long __init find_function32(struct lib32_elfinfo *lib, const char *symname)
+{
+	Elf32_Sym *sym = find_symbol32(lib, symname);
+
+	if (sym == NULL) {
+		printk(KERN_WARNING "vDSO32: function %s not found !\n", symname);
+		return 0;
+	}
+	return sym->st_value - VDSO32_LBASE;
+}
+
+/* Note that we assume the section is .text and the symbol is relative to
+ * the library base
+ */
+static unsigned long __init find_function64(struct lib64_elfinfo *lib, const char *symname)
+{
+	Elf64_Sym *sym = find_symbol64(lib, symname);
+
+	if (sym == NULL) {
+		printk(KERN_WARNING "vDSO64: function %s not found !\n", symname);
+		return 0;
+	}
+#ifdef VDS64_HAS_DESCRIPTORS
+	return *((u64 *)(vdso64_kbase + sym->st_value - VDSO64_LBASE)) - VDSO64_LBASE;
+#else
+	return sym->st_value - VDSO64_LBASE;
+#endif
+}
+
+
+static __init int vdso_do_find_sections(struct lib32_elfinfo *v32,
+					struct lib64_elfinfo *v64)
+{
+	void *sect;
+
+	/*
+	 * Locate symbol tables & text section
+	 */
+
+	v32->dynsym = find_section32(v32->hdr, ".dynsym", &v32->dynsymsize);
+	v32->dynstr = find_section32(v32->hdr, ".dynstr", NULL);
+	if (v32->dynsym == NULL || v32->dynstr == NULL) {
+		printk(KERN_ERR "vDSO32: a required symbol section was not found\n");
+		return -1;
+	}
+	sect = find_section32(v32->hdr, ".text", NULL);
+	if (sect == NULL) {
+		printk(KERN_ERR "vDSO32: the .text section was not found\n");
+		return -1;
+	}
+	v32->text = sect - vdso32_kbase;
+
+	v64->dynsym = find_section64(v64->hdr, ".dynsym", &v64->dynsymsize);
+	v64->dynstr = find_section64(v64->hdr, ".dynstr", NULL);
+	if (v64->dynsym == NULL || v64->dynstr == NULL) {
+		printk(KERN_ERR "vDSO64: a required symbol section was not found\n");
+		return -1;
+	}
+	sect = find_section64(v64->hdr, ".text", NULL);
+	if (sect == NULL) {
+		printk(KERN_ERR "vDSO64: the .text section was not found\n");
+		return -1;
+	}
+	v64->text = sect - vdso64_kbase;
+
+	return 0;
+}
+
+static __init void vdso_setup_trampolines(struct lib32_elfinfo *v32,
+					  struct lib64_elfinfo *v64)
+{
+	/*
+	 * Find signal trampolines
+	 */
+
+	vdso64_rt_sigtramp	= find_function64(v64, "__kernel_sigtramp_rt64");
+	vdso32_sigtramp		= find_function32(v32, "__kernel_sigtramp32");
+	vdso32_rt_sigtramp	= find_function32(v32, "__kernel_sigtramp_rt32");
+}
+
+static __init int vdso_fixup_datapage(struct lib32_elfinfo *v32,
+				       struct lib64_elfinfo *v64)
+{
+	Elf32_Sym *sym32;
+	Elf64_Sym *sym64;
+
+	sym32 = find_symbol32(v32, "__kernel_datapage_offset");
+	if (sym32 == NULL) {
+		printk(KERN_ERR "vDSO32: Can't find symbol __kernel_datapage_offset !\n");
+		return -1;
+	}
+	*((int *)(vdso32_kbase + (sym32->st_value - VDSO32_LBASE))) =
+		(vdso32_pages << PAGE_SHIFT) - (sym32->st_value - VDSO32_LBASE);
+
+       	sym64 = find_symbol64(v64, "__kernel_datapage_offset");
+	if (sym64 == NULL) {
+		printk(KERN_ERR "vDSO64: Can't find symbol __kernel_datapage_offset !\n");
+		return -1;
+	}
+	*((int *)(vdso64_kbase + sym64->st_value - VDSO64_LBASE)) =
+		(vdso64_pages << PAGE_SHIFT) - (sym64->st_value - VDSO64_LBASE);
+
+	return 0;
+}
+
+static int vdso_do_func_patch32(struct lib32_elfinfo *v32,
+				struct lib64_elfinfo *v64,
+				const char *orig, const char *fix)
+{
+	Elf32_Sym *sym32_gen, *sym32_fix;
+
+	sym32_gen = find_symbol32(v32, orig);
+	if (sym32_gen == NULL) {
+		printk(KERN_ERR "vDSO32: Can't find symbol %s !\n", orig);
+		return -1;
+	}
+	sym32_fix = find_symbol32(v32, fix);
+	if (sym32_fix == NULL) {
+		printk(KERN_ERR "vDSO32: Can't find symbol %s !\n", fix);
+		return -1;
+	}
+	sym32_gen->st_value = sym32_fix->st_value;
+	sym32_gen->st_size = sym32_fix->st_size;
+	sym32_gen->st_info = sym32_fix->st_info;
+	sym32_gen->st_other = sym32_fix->st_other;
+	sym32_gen->st_shndx = sym32_fix->st_shndx;
+
+	return 0;
+}
+
+static int vdso_do_func_patch64(struct lib32_elfinfo *v32,
+				struct lib64_elfinfo *v64,
+				const char *orig, const char *fix)
+{
+	Elf64_Sym *sym64_gen, *sym64_fix;
+
+	sym64_gen = find_symbol64(v64, orig);
+	if (sym64_gen == NULL) {
+		printk(KERN_ERR "vDSO64: Can't find symbol %s !\n", orig);
+		return -1;
+	}
+	sym64_fix = find_symbol64(v64, fix);
+	if (sym64_fix == NULL) {
+		printk(KERN_ERR "vDSO64: Can't find symbol %s !\n", fix);
+		return -1;
+	}
+	sym64_gen->st_value = sym64_fix->st_value;
+	sym64_gen->st_size = sym64_fix->st_size;
+	sym64_gen->st_info = sym64_fix->st_info;
+	sym64_gen->st_other = sym64_fix->st_other;
+	sym64_gen->st_shndx = sym64_fix->st_shndx;
+
+	return 0;
+}
+
+static __init int vdso_fixup_alt_funcs(struct lib32_elfinfo *v32,
+				       struct lib64_elfinfo *v64)
+{
+	u32 pvr;
+	int i;
+
+	pvr = mfspr(SPRN_PVR);
+	for (i = 0; i < ARRAY_SIZE(vdso_patches); i++) {
+		struct vdso_patch_def *patch = &vdso_patches[i];
+		int match = (pvr & patch->pvr_mask) == patch->pvr_value;
+
+		DBG("patch %d (mask: %x, pvr: %x) : %s\n",
+		    i, patch->pvr_mask, patch->pvr_value, match ? "match" : "skip");
+
+		if (!match)
+			continue;
+
+		DBG("replacing %s with %s...\n", patch->gen_name, patch->fix_name);
+
+		/*
+		 * Patch the 32 bits and 64 bits symbols. Note that we do not patch
+		 * the "." symbol on 64 bits. It would be easy to do, but doesn't
+		 * seem to be necessary, patching the OPD symbol is enough.
+		 */
+		vdso_do_func_patch32(v32, v64, patch->gen_name, patch->fix_name);
+		vdso_do_func_patch64(v32, v64, patch->gen_name, patch->fix_name);
+	}
+
+	return 0;
+}
+
+
+static __init int vdso_setup(void)
+{
+	struct lib32_elfinfo	v32;
+	struct lib64_elfinfo	v64;
+
+	v32.hdr = vdso32_kbase;
+	v64.hdr = vdso64_kbase;
+
+	if (vdso_do_find_sections(&v32, &v64))
+		return -1;
+
+	if (vdso_fixup_datapage(&v32, &v64))
+		return -1;
+
+	if (vdso_fixup_alt_funcs(&v32, &v64))
+		return -1;
+
+	vdso_setup_trampolines(&v32, &v64);
+
+	return 0;
+}
+
+void __init vdso_init(void)
+{
+	int i;
+
+	vdso64_pages = (&vdso64_end - &vdso64_start) >> PAGE_SHIFT;
+	vdso32_pages = (&vdso32_end - &vdso32_start) >> PAGE_SHIFT;
+
+	DBG("vdso64_kbase: %p, 0x%x pages, vdso32_kbase: %p, 0x%x pages\n",
+	       vdso64_kbase, vdso64_pages, vdso32_kbase, vdso32_pages);
+
+	/*
+	 * Initialize the vDSO images in memory, that is do necessary
+	 * fixups of vDSO symbols, locate trampolines, etc...
+	 */
+	if (vdso_setup()) {
+		printk(KERN_ERR "vDSO setup failure, not enabled !\n");
+		/* XXX should free pages here ? */
+		vdso64_pages = vdso32_pages = 0;
+		return;
+	}
+
+	/* Make sure pages are in the correct state */
+	for (i = 0; i < vdso64_pages; i++) {
+		struct page *pg = virt_to_page(vdso64_kbase + i*PAGE_SIZE);
+		ClearPageReserved(pg);
+		get_page(pg);
+	}
+	for (i = 0; i < vdso32_pages; i++) {
+		struct page *pg = virt_to_page(vdso32_kbase + i*PAGE_SIZE);
+		ClearPageReserved(pg);
+		get_page(pg);
+	}
+}
+
+int in_gate_area_no_task(unsigned long addr)
+{
+	return 0;
+}
+
+int in_gate_area(struct task_struct *task, unsigned long addr)
+{
+	return 0;
+}
+
+struct vm_area_struct *get_gate_vma(struct task_struct *tsk)
+{
+	return NULL;
+}
+
diff -Nru a/arch/ppc64/kernel/vdso32/Makefile b/arch/ppc64/kernel/vdso32/Makefile
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso32/Makefile	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,36 @@
+
+# List of files in the vdso, has to be asm only for now
+
+obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o
+
+# Build rules
+
+targets := $(obj-vdso32) vdso32.so
+obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
+
+
+EXTRA_CFLAGS := -shared -s -fno-common -fno-builtin
+EXTRA_CFLAGS += -nostdlib -Wl,-soname=linux-vdso32.so.1
+EXTRA_AFLAGS := -D__VDSO32__ -s
+
+obj-y += vdso32_wrapper.o
+extra-y += vdso32.lds
+CPPFLAGS_vdso32.lds += -P -C -U$(ARCH)
+
+# Force dependency (incbin is bad)
+$(obj)/vdso32_wrapper.o : $(obj)/vdso32.so
+
+# link rule for the .so file, .lds has to be first
+$(obj)/vdso32.so: $(src)/vdso32.lds $(obj-vdso32)
+	$(call if_changed,vdso32ld)
+
+# assembly rules for the .S files
+$(obj-vdso32): %.o: %.S
+	$(call if_changed_dep,vdso32as)
+
+# actual build commands
+quiet_cmd_vdso32ld = VDSO32L $@
+      cmd_vdso32ld = $(CROSS32CC) $(c_flags) -Wl,-T $^ -o $@
+quiet_cmd_vdso32as = VDSO32A $@
+      cmd_vdso32as = $(CROSS32CC) $(a_flags) -c -o $@ $<
+
diff -Nru a/arch/ppc64/kernel/vdso32/cacheflush.S b/arch/ppc64/kernel/vdso32/cacheflush.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso32/cacheflush.S	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,65 @@
+/*
+ * vDSO provided cache flush routines
+ *
+ * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org),
+ *                    IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/ppc_asm.h>
+#include <asm/vdso.h>
+#include <asm/offsets.h>
+
+	.text
+
+/*
+ * Default "generic" version of __kernel_sync_dicache.
+ *
+ * void __kernel_sync_dicache(unsigned long start, unsigned long end)
+ *
+ * Flushes the data cache & invalidate the instruction cache for the
+ * provided range [start, end[
+ *
+ * Note: all CPUs supported by this kernel have a 128 bytes cache
+ * line size so we don't have to peek that info from the datapage
+ */
+V_FUNCTION_BEGIN(__kernel_sync_dicache)
+  .cfi_startproc
+	li	r5,127
+	andc	r6,r3,r5		/* round low to line bdy */
+	subf	r8,r6,r4		/* compute length */
+	add	r8,r8,r5		/* ensure we get enough */
+	srwi.	r8,r8,7			/* compute line count */
+	beqlr				/* nothing to do? */
+	mtctr	r8
+	mr	r3,r6
+1:	dcbst	0,r3
+	addi	r3,r3,128
+	bdnz	1b
+	sync
+	mtctr	r8
+1:	icbi	0,r6
+	addi	r6,r6,128
+	bdnz	1b
+	isync
+	blr
+  .cfi_endproc
+V_FUNCTION_END(__kernel_sync_dicache)
+
+
+/*
+ * POWER5 version of __kernel_sync_dicache
+ */
+V_FUNCTION_BEGIN(__kernel_sync_dicache_p5)
+  .cfi_startproc
+	sync
+	isync
+	blr
+  .cfi_endproc
+V_FUNCTION_END(__kernel_sync_dicache_p5)
+
diff -Nru a/arch/ppc64/kernel/vdso32/datapage.S b/arch/ppc64/kernel/vdso32/datapage.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso32/datapage.S	2005-03-07 20:41:20 -08:00
@@ -0,0 +1,68 @@
+/*
+ * Access to the shared data page by the vDSO & syscall map
+ *
+ * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/ppc_asm.h>
+#include <asm/offsets.h>
+#include <asm/unistd.h>
+#include <asm/vdso.h>
+
+	.text
+V_FUNCTION_BEGIN(__get_datapage)
+  .cfi_startproc
+	/* We don't want that exposed or overridable as we want other objects
+	 * to be able to bl directly to here
+	 */
+	.protected __get_datapage
+	.hidden __get_datapage
+
+	mflr	r0
+  .cfi_register lr,r0
+
+	bcl	20,31,1f
+	.global	__kernel_datapage_offset;
+__kernel_datapage_offset:
+	.long	0
+1:
+	mflr	r3
+	mtlr	r0
+	lwz	r0,0(r3)
+	add	r3,r0,r3
+	blr
+  .cfi_endproc
+V_FUNCTION_END(__get_datapage)
+
+/*
+ * void *__kernel_get_syscall_map(unsigned int *syscall_count) ;
+ *
+ * returns a pointer to the syscall map. the map is agnostic to the
+ * size of "long", unlike kernel bitops, it stores bits from top to
+ * bottom so that memory actually contains a linear bitmap
+ * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of
+ * 32 bits int at N >> 5.
+ */
+V_FUNCTION_BEGIN(__kernel_get_syscall_map)
+  .cfi_startproc
+	mflr	r12
+  .cfi_register lr,r12
+
+	mr	r4,r3
+	bl	__get_datapage@local
+	mtlr	r12
+	addi	r3,r3,CFG_SYSCALL_MAP32
+	cmpli	cr0,r4,0
+	beqlr
+	li	r0,__NR_syscalls
+	stw	r0,0(r4)
+	blr
+  .cfi_endproc
+V_FUNCTION_END(__kernel_get_syscall_map)
diff -Nru a/arch/ppc64/kernel/vdso32/gettimeofday.S b/arch/ppc64/kernel/vdso32/gettimeofday.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso32/gettimeofday.S	2005-03-07 20:41:20 -08:00
@@ -0,0 +1,139 @@
+/*
+ * Userland implementation of gettimeofday() for 32 bits processes in a
+ * ppc64 kernel for use in the vDSO
+ *
+ * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/ppc_asm.h>
+#include <asm/vdso.h>
+#include <asm/offsets.h>
+#include <asm/unistd.h>
+
+	.text
+/*
+ * Exact prototype of gettimeofday
+ *
+ * int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz);
+ *
+ */
+V_FUNCTION_BEGIN(__kernel_gettimeofday)
+  .cfi_startproc
+	mflr	r12
+  .cfi_register lr,r12
+
+	mr	r10,r3			/* r10 saves tv */
+	mr	r11,r4			/* r11 saves tz */
+	bl	__get_datapage@local	/* get data page */
+	mr	r9, r3			/* datapage ptr in r9 */
+	bl	__do_get_xsec@local	/* get xsec from tb & kernel */
+	bne-	2f			/* out of line -> do syscall */
+
+	/* seconds are xsec >> 20 */
+	rlwinm	r5,r4,12,20,31
+	rlwimi	r5,r3,12,0,19
+	stw	r5,TVAL32_TV_SEC(r10)
+
+	/* get remaining xsec and convert to usec. we scale
+	 * up remaining xsec by 12 bits and get the top 32 bits
+	 * of the multiplication
+	 */
+	rlwinm	r5,r4,12,0,19
+	lis	r6,1000000@h
+	ori	r6,r6,1000000@l
+	mulhwu	r5,r5,r6
+	stw	r5,TVAL32_TV_USEC(r10)
+
+	cmpli	cr0,r11,0		/* check if tz is NULL */
+	beq	1f
+	lwz	r4,CFG_TZ_MINUTEWEST(r9)/* fill tz */
+	lwz	r5,CFG_TZ_DSTTIME(r9)
+	stw	r4,TZONE_TZ_MINWEST(r11)
+	stw	r5,TZONE_TZ_DSTTIME(r11)
+
+1:	mtlr	r12
+	blr
+
+2:	mr	r3,r10
+	mr	r4,r11
+	li	r0,__NR_gettimeofday
+	sc
+	b	1b
+  .cfi_endproc
+V_FUNCTION_END(__kernel_gettimeofday)
+
+/*
+ * This is the core of gettimeofday(), it returns the xsec
+ * value in r3 & r4 and expects the datapage ptr (non clobbered)
+ * in r9. clobbers r0,r4,r5,r6,r7,r8
+*/
+__do_get_xsec:
+  .cfi_startproc
+	/* Check for update count & load values. We use the low
+	 * order 32 bits of the update count
+	 */
+1:	lwz	r8,(CFG_TB_UPDATE_COUNT+4)(r9)
+	andi.	r0,r8,1			/* pending update ? loop */
+	bne-	1b
+	xor	r0,r8,r8		/* create dependency */
+	add	r9,r9,r0
+
+	/* Load orig stamp (offset to TB) */
+	lwz	r5,CFG_TB_ORIG_STAMP(r9)
+	lwz	r6,(CFG_TB_ORIG_STAMP+4)(r9)
+
+	/* Get a stable TB value */
+2:	mftbu	r3
+	mftbl	r4
+	mftbu	r0
+	cmpl	cr0,r3,r0
+	bne-	2b
+
+	/* Substract tb orig stamp. If the high part is non-zero, we jump to the
+	 * slow path which call the syscall. If it's ok, then we have our 32 bits
+	 * tb_ticks value in r7
+	 */
+	subfc	r7,r6,r4
+	subfe.	r0,r5,r3
+	bne-	3f
+
+	/* Load scale factor & do multiplication */
+	lwz	r5,CFG_TB_TO_XS(r9)	/* load values */
+	lwz	r6,(CFG_TB_TO_XS+4)(r9)
+	mulhwu	r4,r7,r5
+	mulhwu	r6,r7,r6
+	mullw	r6,r7,r5
+	addc	r6,r6,r0
+
+	/* At this point, we have the scaled xsec value in r4 + XER:CA
+	 * we load & add the stamp since epoch
+	 */
+	lwz	r5,CFG_STAMP_XSEC(r9)
+	lwz	r6,(CFG_STAMP_XSEC+4)(r9)
+	adde	r4,r4,r6
+	addze	r3,r5
+
+	/* We now have our result in r3,r4. We create a fake dependency
+	 * on that result and re-check the counter
+	 */
+	xor	r0,r4,r4
+	add	r9,r9,r0
+	lwz	r0,(CFG_TB_UPDATE_COUNT+4)(r9)
+        cmpl    cr0,r8,r0		/* check if updated */
+	bne-	1b
+
+	/* Warning ! The caller expects CR:EQ to be set to indicate a
+	 * successful calculation (so it won't fallback to the syscall
+	 * method). We have overriden that CR bit in the counter check,
+	 * but fortunately, the loop exit condition _is_ CR:EQ set, so
+	 * we can exit safely here. If you change this code, be careful
+	 * of that side effect.
+	 */
+3:	blr
+  .cfi_endproc
diff -Nru a/arch/ppc64/kernel/vdso32/sigtramp.S b/arch/ppc64/kernel/vdso32/sigtramp.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso32/sigtramp.S	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,300 @@
+/*
+ * Signal trampolines for 32 bits processes in a ppc64 kernel for
+ * use in the vDSO
+ *
+ * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp.
+ * Copyright (C) 2004 Alan Modra (amodra@au.ibm.com)), IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/ppc_asm.h>
+#include <asm/unistd.h>
+#include <asm/vdso.h>
+
+	.text
+
+/* The nop here is a hack.  The dwarf2 unwind routines subtract 1 from
+   the return address to get an address in the middle of the presumed
+   call instruction.  Since we don't have a call here, we artifically
+   extend the range covered by the unwind info by adding a nop before
+   the real start.  */
+	nop
+V_FUNCTION_BEGIN(__kernel_sigtramp32)
+.Lsig_start = . - 4
+	li	r0,__NR_sigreturn
+	sc
+.Lsig_end:
+V_FUNCTION_END(__kernel_sigtramp32)
+
+.Lsigrt_start:
+	nop
+V_FUNCTION_BEGIN(__kernel_sigtramp_rt32)
+	li	r0,__NR_rt_sigreturn
+	sc
+.Lsigrt_end:
+V_FUNCTION_END(__kernel_sigtramp_rt32)
+
+	.section .eh_frame,"a",@progbits
+
+/* Register r1 can be found at offset 4 of a pt_regs structure.
+   A pointer to the pt_regs is stored in memory at the old sp plus PTREGS.  */
+#define cfa_save \
+  .byte 0x0f;			/* DW_CFA_def_cfa_expression */		\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x71; .sleb128 PTREGS;	/*     DW_OP_breg1 */			\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .byte 0x23; .uleb128 RSIZE;	/*     DW_OP_plus_uconst */		\
+  .byte 0x06;			/*     DW_OP_deref */			\
+9:
+
+/* Register REGNO can be found at offset OFS of a pt_regs structure.
+   A pointer to the pt_regs is stored in memory at the old sp plus PTREGS.  */
+#define rsave(regno, ofs) \
+  .byte 0x10;			/* DW_CFA_expression */			\
+  .uleb128 regno;		/*   regno */				\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x71; .sleb128 PTREGS;	/*     DW_OP_breg1 */			\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .ifne ofs;								\
+    .byte 0x23; .uleb128 ofs;	/*     DW_OP_plus_uconst */		\
+  .endif;								\
+9:
+
+/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16
+   of the VMX reg struct.  The VMX reg struct is at offset VREGS of
+   the pt_regs struct.  This macro is for REGNO == 0, and contains
+   'subroutines' that the other macros jump to.  */
+#define vsave_msr0(regno) \
+  .byte 0x10;			/* DW_CFA_expression */			\
+  .uleb128 regno + 77;		/*   regno */				\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x30 + regno;		/*     DW_OP_lit0 */			\
+2:									\
+  .byte 0x40;			/*     DW_OP_lit16 */			\
+  .byte 0x1e;			/*     DW_OP_mul */			\
+3:									\
+  .byte 0x71; .sleb128 PTREGS;	/*     DW_OP_breg1 */			\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .byte 0x12;			/*     DW_OP_dup */			\
+  .byte 0x23;			/*     DW_OP_plus_uconst */		\
+    .uleb128 33*RSIZE;		/*       msr offset */			\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .byte 0x0c; .long 1 << 25;	/*     DW_OP_const4u */			\
+  .byte 0x1a;			/*     DW_OP_and */			\
+  .byte 0x12;			/*     DW_OP_dup, ret 0 if bra taken */	\
+  .byte 0x30;			/*     DW_OP_lit0 */			\
+  .byte 0x29;			/*     DW_OP_eq */			\
+  .byte 0x28; .short 0x7fff;	/*     DW_OP_bra to end */		\
+  .byte 0x13;			/*     DW_OP_drop, pop the 0 */		\
+  .byte 0x23; .uleb128 VREGS;	/*     DW_OP_plus_uconst */		\
+  .byte 0x22;			/*     DW_OP_plus */			\
+  .byte 0x2f; .short 0x7fff;	/*     DW_OP_skip to end */		\
+9:
+
+/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16
+   of the VMX reg struct.  REGNO is 1 thru 31.  */
+#define vsave_msr1(regno) \
+  .byte 0x10;			/* DW_CFA_expression */			\
+  .uleb128 regno + 77;		/*   regno */				\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x30 + regno;		/*     DW_OP_lit n */			\
+  .byte 0x2f; .short 2b - 9f;	/*     DW_OP_skip */			\
+9:
+
+/* If msr bit 1<<25 is set, then VMX register REGNO is at offset OFS of
+   the VMX save block.  */
+#define vsave_msr2(regno, ofs) \
+  .byte 0x10;			/* DW_CFA_expression */			\
+  .uleb128 regno + 77;		/*   regno */				\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x0a; .short ofs;	/*     DW_OP_const2u */			\
+  .byte 0x2f; .short 3b - 9f;	/*     DW_OP_skip */			\
+9:
+
+/* VMX register REGNO is at offset OFS of the VMX save area.  */
+#define vsave(regno, ofs) \
+  .byte 0x10;			/* DW_CFA_expression */			\
+  .uleb128 regno + 77;		/*   regno */				\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x71; .sleb128 PTREGS;	/*     DW_OP_breg1 */			\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .byte 0x23; .uleb128 VREGS;	/*     DW_OP_plus_uconst */		\
+  .byte 0x23; .uleb128 ofs;	/*     DW_OP_plus_uconst */		\
+9:
+
+/* This is where the pt_regs pointer can be found on the stack.  */
+#define PTREGS 64+28
+
+/* Size of regs.  */
+#define RSIZE 4
+
+/* This is the offset of the VMX regs.  */
+#define VREGS 48*RSIZE+34*8
+
+/* Describe where general purpose regs are saved.  */
+#define EH_FRAME_GEN \
+  cfa_save;								\
+  rsave ( 0,  0*RSIZE);							\
+  rsave ( 2,  2*RSIZE);							\
+  rsave ( 3,  3*RSIZE);							\
+  rsave ( 4,  4*RSIZE);							\
+  rsave ( 5,  5*RSIZE);							\
+  rsave ( 6,  6*RSIZE);							\
+  rsave ( 7,  7*RSIZE);							\
+  rsave ( 8,  8*RSIZE);							\
+  rsave ( 9,  9*RSIZE);							\
+  rsave (10, 10*RSIZE);							\
+  rsave (11, 11*RSIZE);							\
+  rsave (12, 12*RSIZE);							\
+  rsave (13, 13*RSIZE);							\
+  rsave (14, 14*RSIZE);							\
+  rsave (15, 15*RSIZE);							\
+  rsave (16, 16*RSIZE);							\
+  rsave (17, 17*RSIZE);							\
+  rsave (18, 18*RSIZE);							\
+  rsave (19, 19*RSIZE);							\
+  rsave (20, 20*RSIZE);							\
+  rsave (21, 21*RSIZE);							\
+  rsave (22, 22*RSIZE);							\
+  rsave (23, 23*RSIZE);							\
+  rsave (24, 24*RSIZE);							\
+  rsave (25, 25*RSIZE);							\
+  rsave (26, 26*RSIZE);							\
+  rsave (27, 27*RSIZE);							\
+  rsave (28, 28*RSIZE);							\
+  rsave (29, 29*RSIZE);							\
+  rsave (30, 30*RSIZE);							\
+  rsave (31, 31*RSIZE);							\
+  rsave (67, 32*RSIZE);		/* ap, used as temp for nip */		\
+  rsave (65, 36*RSIZE);		/* lr */				\
+  rsave (70, 38*RSIZE)		/* cr */
+
+/* Describe where the FP regs are saved.  */
+#define EH_FRAME_FP \
+  rsave (32, 48*RSIZE +  0*8);						\
+  rsave (33, 48*RSIZE +  1*8);						\
+  rsave (34, 48*RSIZE +  2*8);						\
+  rsave (35, 48*RSIZE +  3*8);						\
+  rsave (36, 48*RSIZE +  4*8);						\
+  rsave (37, 48*RSIZE +  5*8);						\
+  rsave (38, 48*RSIZE +  6*8);						\
+  rsave (39, 48*RSIZE +  7*8);						\
+  rsave (40, 48*RSIZE +  8*8);						\
+  rsave (41, 48*RSIZE +  9*8);						\
+  rsave (42, 48*RSIZE + 10*8);						\
+  rsave (43, 48*RSIZE + 11*8);						\
+  rsave (44, 48*RSIZE + 12*8);						\
+  rsave (45, 48*RSIZE + 13*8);						\
+  rsave (46, 48*RSIZE + 14*8);						\
+  rsave (47, 48*RSIZE + 15*8);						\
+  rsave (48, 48*RSIZE + 16*8);						\
+  rsave (49, 48*RSIZE + 17*8);						\
+  rsave (50, 48*RSIZE + 18*8);						\
+  rsave (51, 48*RSIZE + 19*8);						\
+  rsave (52, 48*RSIZE + 20*8);						\
+  rsave (53, 48*RSIZE + 21*8);						\
+  rsave (54, 48*RSIZE + 22*8);						\
+  rsave (55, 48*RSIZE + 23*8);						\
+  rsave (56, 48*RSIZE + 24*8);						\
+  rsave (57, 48*RSIZE + 25*8);						\
+  rsave (58, 48*RSIZE + 26*8);						\
+  rsave (59, 48*RSIZE + 27*8);						\
+  rsave (60, 48*RSIZE + 28*8);						\
+  rsave (61, 48*RSIZE + 29*8);						\
+  rsave (62, 48*RSIZE + 30*8);						\
+  rsave (63, 48*RSIZE + 31*8)
+
+/* Describe where the VMX regs are saved.  */
+#ifdef CONFIG_ALTIVEC
+#define EH_FRAME_VMX \
+  vsave_msr0 ( 0);							\
+  vsave_msr1 ( 1);							\
+  vsave_msr1 ( 2);							\
+  vsave_msr1 ( 3);							\
+  vsave_msr1 ( 4);							\
+  vsave_msr1 ( 5);							\
+  vsave_msr1 ( 6);							\
+  vsave_msr1 ( 7);							\
+  vsave_msr1 ( 8);							\
+  vsave_msr1 ( 9);							\
+  vsave_msr1 (10);							\
+  vsave_msr1 (11);							\
+  vsave_msr1 (12);							\
+  vsave_msr1 (13);							\
+  vsave_msr1 (14);							\
+  vsave_msr1 (15);							\
+  vsave_msr1 (16);							\
+  vsave_msr1 (17);							\
+  vsave_msr1 (18);							\
+  vsave_msr1 (19);							\
+  vsave_msr1 (20);							\
+  vsave_msr1 (21);							\
+  vsave_msr1 (22);							\
+  vsave_msr1 (23);							\
+  vsave_msr1 (24);							\
+  vsave_msr1 (25);							\
+  vsave_msr1 (26);							\
+  vsave_msr1 (27);							\
+  vsave_msr1 (28);							\
+  vsave_msr1 (29);							\
+  vsave_msr1 (30);							\
+  vsave_msr1 (31);							\
+  vsave_msr2 (33, 32*16+12);						\
+  vsave      (32, 32*16)
+#else
+#define EH_FRAME_VMX
+#endif
+
+.Lcie:
+	.long .Lcie_end - .Lcie_start
+.Lcie_start:
+	.long 0			/* CIE ID */
+	.byte 1			/* Version number */
+	.string "zR"		/* NUL-terminated augmentation string */
+	.uleb128 4		/* Code alignment factor */
+	.sleb128 -4		/* Data alignment factor */
+	.byte 67		/* Return address register column, ap */
+	.uleb128 1		/* Augmentation value length */
+	.byte 0x1b		/* DW_EH_PE_pcrel | DW_EH_PE_sdata4. */
+	.byte 0x0c,1,0		/* DW_CFA_def_cfa: r1 ofs 0 */
+	.balign 4
+.Lcie_end:
+
+	.long .Lfde0_end - .Lfde0_start
+.Lfde0_start:
+	.long .Lfde0_start - .Lcie	/* CIE pointer. */
+	.long .Lsig_start - .		/* PC start, length */
+	.long .Lsig_end - .Lsig_start
+	.uleb128 0			/* Augmentation */
+	EH_FRAME_GEN
+	EH_FRAME_FP
+	EH_FRAME_VMX
+	.balign 4
+.Lfde0_end:
+
+/* We have a different stack layout for rt_sigreturn.  */
+#undef PTREGS
+#define PTREGS 64+16+128+20+28
+
+	.long .Lfde1_end - .Lfde1_start
+.Lfde1_start:
+	.long .Lfde1_start - .Lcie	/* CIE pointer. */
+	.long .Lsigrt_start - .		/* PC start, length */
+	.long .Lsigrt_end - .Lsigrt_start
+	.uleb128 0			/* Augmentation */
+	EH_FRAME_GEN
+	EH_FRAME_FP
+	EH_FRAME_VMX
+	.balign 4
+.Lfde1_end:
diff -Nru a/arch/ppc64/kernel/vdso32/vdso32.lds.S b/arch/ppc64/kernel/vdso32/vdso32.lds.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso32/vdso32.lds.S	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,111 @@
+
+/*
+ * This is the infamous ld script for the 32 bits vdso
+ * library
+ */
+#include <asm/vdso.h>
+
+/* Default link addresses for the vDSOs */
+OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
+OUTPUT_ARCH(powerpc:common)
+ENTRY(_start)
+
+SECTIONS
+{
+  . = VDSO32_LBASE + SIZEOF_HEADERS;
+  .hash           : { *(.hash) }			:text
+  .dynsym         : { *(.dynsym) }
+  .dynstr         : { *(.dynstr) }
+  .gnu.version    : { *(.gnu.version) }
+  .gnu.version_d  : { *(.gnu.version_d) }
+  .gnu.version_r  : { *(.gnu.version_r) }
+
+  . = ALIGN (16);
+  .text :
+  {
+    *(.text .stub .text.* .gnu.linkonce.t.*)
+  }
+  PROVIDE (__etext = .);
+  PROVIDE (_etext = .);
+  PROVIDE (etext = .);
+
+  /* Other stuff is appended to the text segment: */
+  .rodata		: { *(.rodata .rodata.* .gnu.linkonce.r.*) }
+  .rodata1		: { *(.rodata1) }
+
+  .eh_frame_hdr		: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
+  .eh_frame		: { KEEP (*(.eh_frame)) }	:text
+  .gcc_except_table	: { *(.gcc_except_table) }
+  .fixup		: { *(.fixup) }
+
+  .got ALIGN(4)		: { *(.got.plt) *(.got) }
+
+  .dynamic		: { *(.dynamic) }		:text	:dynamic
+
+  _end = .;
+  __end = .;
+  PROVIDE (end = .);
+
+
+  /* Stabs debugging sections are here too
+   */
+  .stab 0 : { *(.stab) }
+  .stabstr 0 : { *(.stabstr) }
+  .stab.excl 0 : { *(.stab.excl) }
+  .stab.exclstr 0 : { *(.stab.exclstr) }
+  .stab.index 0 : { *(.stab.index) }
+  .stab.indexstr 0 : { *(.stab.indexstr) }
+  .comment 0 : { *(.comment) }
+  .debug 0 : { *(.debug) }
+  .line 0 : { *(.line) }
+
+  .debug_srcinfo 0 : { *(.debug_srcinfo) }
+  .debug_sfnames 0 : { *(.debug_sfnames) }
+
+  .debug_aranges 0 : { *(.debug_aranges) }
+  .debug_pubnames 0 : { *(.debug_pubnames) }
+
+  .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
+  .debug_abbrev 0 : { *(.debug_abbrev) }
+  .debug_line 0 : { *(.debug_line) }
+  .debug_frame 0 : { *(.debug_frame) }
+  .debug_str 0 : { *(.debug_str) }
+  .debug_loc 0 : { *(.debug_loc) }
+  .debug_macinfo 0 : { *(.debug_macinfo) }
+
+  .debug_weaknames 0 : { *(.debug_weaknames) }
+  .debug_funcnames 0 : { *(.debug_funcnames) }
+  .debug_typenames 0 : { *(.debug_typenames) }
+  .debug_varnames 0 : { *(.debug_varnames) }
+
+  /DISCARD/ : { *(.note.GNU-stack) }
+  /DISCARD/ : { *(.data .data.* .gnu.linkonce.d.* .sdata*) }
+  /DISCARD/ : { *(.bss .sbss .dynbss .dynsbss) }
+}
+
+
+PHDRS
+{
+  text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
+  dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
+  eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
+}
+
+
+/*
+ * This controls what symbols we export from the DSO.
+ */
+VERSION
+{
+  VDSO_VERSION_STRING {
+    global:
+	__kernel_datapage_offset; /* Has to be there for the kernel to find it */
+	__kernel_get_syscall_map;
+	__kernel_gettimeofday;
+	__kernel_sync_dicache;
+	__kernel_sync_dicache_p5;
+	__kernel_sigtramp32;
+	__kernel_sigtramp_rt32;
+    local: *;
+  };
+}
diff -Nru a/arch/ppc64/kernel/vdso32/vdso32_wrapper.S b/arch/ppc64/kernel/vdso32/vdso32_wrapper.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso32/vdso32_wrapper.S	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,13 @@
+#include <linux/init.h>
+#include <asm/page.h>
+
+	.section ".data.page_aligned"
+
+	.globl vdso32_start, vdso32_end
+	.balign PAGE_SIZE
+vdso32_start:
+	.incbin "arch/ppc64/kernel/vdso32/vdso32.so"
+	.balign PAGE_SIZE
+vdso32_end:
+
+	.previous
diff -Nru a/arch/ppc64/kernel/vdso64/Makefile b/arch/ppc64/kernel/vdso64/Makefile
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso64/Makefile	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,35 @@
+# List of files in the vdso, has to be asm only for now
+
+obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o
+
+# Build rules
+
+targets := $(obj-vdso64) vdso64.so
+obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
+
+EXTRA_CFLAGS := -shared -s -fno-common -fno-builtin
+EXTRA_CFLAGS +=  -nostdlib -Wl,-soname=linux-vdso64.so.1
+EXTRA_AFLAGS := -D__VDSO64__ -s
+
+obj-y += vdso64_wrapper.o
+extra-y += vdso64.lds
+CPPFLAGS_vdso64.lds += -P -C -U$(ARCH)
+
+# Force dependency (incbin is bad)
+$(obj)/vdso64_wrapper.o : $(obj)/vdso64.so
+
+# link rule for the .so file, .lds has to be first
+$(obj)/vdso64.so: $(src)/vdso64.lds $(obj-vdso64)
+	$(call if_changed,vdso64ld)
+
+# assembly rules for the .S files
+$(obj-vdso64): %.o: %.S
+	$(call if_changed_dep,vdso64as)
+
+# actual build commands
+quiet_cmd_vdso64ld = VDSO64L $@
+      cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $^ -o $@
+quiet_cmd_vdso64as = VDSO64A $@
+      cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
+
+
diff -Nru a/arch/ppc64/kernel/vdso64/cacheflush.S b/arch/ppc64/kernel/vdso64/cacheflush.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso64/cacheflush.S	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,64 @@
+/*
+ * vDSO provided cache flush routines
+ *
+ * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org),
+ *                    IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/ppc_asm.h>
+#include <asm/vdso.h>
+#include <asm/offsets.h>
+
+	.text
+
+/*
+ * Default "generic" version of __kernel_sync_dicache.
+ *
+ * void __kernel_sync_dicache(unsigned long start, unsigned long end)
+ *
+ * Flushes the data cache & invalidate the instruction cache for the
+ * provided range [start, end[
+ *
+ * Note: all CPUs supported by this kernel have a 128 bytes cache
+ * line size so we don't have to peek that info from the datapage
+ */
+V_FUNCTION_BEGIN(__kernel_sync_dicache)
+  .cfi_startproc
+	li	r5,127
+	andc	r6,r3,r5		/* round low to line bdy */
+	subf	r8,r6,r4		/* compute length */
+	add	r8,r8,r5		/* ensure we get enough */
+	srwi.	r8,r8,7			/* compute line count */
+	beqlr				/* nothing to do? */
+	mtctr	r8
+	mr	r3,r6
+1:	dcbst	0,r3
+	addi	r3,r3,128
+	bdnz	1b
+	sync
+	mtctr	r8
+1:	icbi	0,r6
+	addi	r6,r6,128
+	bdnz	1b
+	isync
+	blr
+  .cfi_endproc
+V_FUNCTION_END(__kernel_sync_dicache)
+
+
+/*
+ * POWER5 version of __kernel_sync_dicache
+ */
+V_FUNCTION_BEGIN(__kernel_sync_dicache_p5)
+  .cfi_startproc
+	sync
+	isync
+	blr
+  .cfi_endproc
+V_FUNCTION_END(__kernel_sync_dicache_p5)
diff -Nru a/arch/ppc64/kernel/vdso64/datapage.S b/arch/ppc64/kernel/vdso64/datapage.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso64/datapage.S	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,68 @@
+/*
+ * Access to the shared data page by the vDSO & syscall map
+ *
+ * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/ppc_asm.h>
+#include <asm/offsets.h>
+#include <asm/unistd.h>
+#include <asm/vdso.h>
+
+	.text
+V_FUNCTION_BEGIN(__get_datapage)
+  .cfi_startproc
+	/* We don't want that exposed or overridable as we want other objects
+	 * to be able to bl directly to here
+	 */
+	.protected __get_datapage
+	.hidden __get_datapage
+
+	mflr	r0
+  .cfi_register lr,r0
+
+	bcl	20,31,1f
+	.global	__kernel_datapage_offset;
+__kernel_datapage_offset:
+	.long	0
+1:
+	mflr	r3
+	mtlr	r0
+	lwz	r0,0(r3)
+	add	r3,r0,r3
+	blr
+  .cfi_endproc
+V_FUNCTION_END(__get_datapage)
+
+/*
+ * void *__kernel_get_syscall_map(unsigned int *syscall_count) ;
+ *
+ * returns a pointer to the syscall map. the map is agnostic to the
+ * size of "long", unlike kernel bitops, it stores bits from top to
+ * bottom so that memory actually contains a linear bitmap
+ * check for syscall N by testing bit (0x80000000 >> (N & 0x1f)) of
+ * 32 bits int at N >> 5.
+ */
+V_FUNCTION_BEGIN(__kernel_get_syscall_map)
+  .cfi_startproc
+	mflr	r12
+  .cfi_register lr,r12
+
+	mr	r4,r3
+	bl	V_LOCAL_FUNC(__get_datapage)
+	mtlr	r12
+	addi	r3,r3,CFG_SYSCALL_MAP64
+	cmpli	cr0,r4,0
+	beqlr
+	li	r0,__NR_syscalls
+	stw	r0,0(r4)
+	blr
+  .cfi_endproc
+V_FUNCTION_END(__kernel_get_syscall_map)
diff -Nru a/arch/ppc64/kernel/vdso64/gettimeofday.S b/arch/ppc64/kernel/vdso64/gettimeofday.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso64/gettimeofday.S	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,91 @@
+/*
+ * Userland implementation of gettimeofday() for 64 bits processes in a
+ * ppc64 kernel for use in the vDSO
+ *
+ * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org),
+ *                    IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/ppc_asm.h>
+#include <asm/vdso.h>
+#include <asm/offsets.h>
+
+	.text
+/*
+ * Exact prototype of gettimeofday
+ *
+ * int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz);
+ *
+ */
+V_FUNCTION_BEGIN(__kernel_gettimeofday)
+  .cfi_startproc
+	mflr	r12
+  .cfi_register lr,r12
+
+	mr	r11,r3			/* r11 holds tv */
+	mr	r10,r4			/* r10 holds tz */
+	bl	V_LOCAL_FUNC(__get_datapage)		/* get data page */
+	bl	V_LOCAL_FUNC(__do_get_xsec)		/* get xsec from tb & kernel */
+	lis     r7,15			/* r7 = 1000000 = USEC_PER_SEC */
+	ori     r7,r7,16960
+	rldicl  r5,r4,44,20		/* r5 = sec = xsec / XSEC_PER_SEC */
+	rldicr  r6,r5,20,43		/* r6 = sec * XSEC_PER_SEC */
+	std	r5,TVAL64_TV_SEC(r11)	/* store sec in tv */
+	subf	r0,r6,r4		/* r0 = xsec = (xsec - r6) */
+	mulld   r0,r0,r7		/* usec = (xsec * USEC_PER_SEC) / XSEC_PER_SEC */
+	rldicl  r0,r0,44,20
+	cmpldi	cr0,r10,0		/* check if tz is NULL */
+	std	r0,TVAL64_TV_USEC(r11)	/* store usec in tv */
+	beq	1f
+	lwz	r4,CFG_TZ_MINUTEWEST(r3)/* fill tz */
+	lwz	r5,CFG_TZ_DSTTIME(r3)
+	stw	r4,TZONE_TZ_MINWEST(r10)
+	stw	r5,TZONE_TZ_DSTTIME(r10)
+1:	mtlr	r12
+	li	r3,0			/* always success */
+	blr
+  .cfi_endproc
+V_FUNCTION_END(__kernel_gettimeofday)
+
+
+/*
+ * This is the core of gettimeofday(), it returns the xsec
+ * value in r4 and expects the datapage ptr (non clobbered)
+ * in r3. clobbers r0,r4,r5,r6,r7,r8
+*/
+V_FUNCTION_BEGIN(__do_get_xsec)
+  .cfi_startproc
+	/* check for update count & load values */
+1:	ld	r7,CFG_TB_UPDATE_COUNT(r3)
+	andi.	r0,r4,1			/* pending update ? loop */
+	bne-	1b
+	xor	r0,r4,r4		/* create dependency */
+	add	r3,r3,r0
+
+	/* Get TB & offset it */
+	mftb	r8
+	ld	r9,CFG_TB_ORIG_STAMP(r3)
+	subf	r8,r9,r8
+
+	/* Scale result */
+	ld	r5,CFG_TB_TO_XS(r3)
+	mulhdu	r8,r8,r5
+
+	/* Add stamp since epoch */
+	ld	r6,CFG_STAMP_XSEC(r3)
+	add	r4,r6,r8
+
+	xor	r0,r4,r4
+	add	r3,r3,r0
+	ld	r0,CFG_TB_UPDATE_COUNT(r3)
+        cmpld   cr0,r0,r7		/* check if updated */
+	bne-	1b
+	blr
+  .cfi_endproc
+V_FUNCTION_END(__do_get_xsec)
diff -Nru a/arch/ppc64/kernel/vdso64/sigtramp.S b/arch/ppc64/kernel/vdso64/sigtramp.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso64/sigtramp.S	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,294 @@
+/*
+ * Signal trampoline for 64 bits processes in a ppc64 kernel for
+ * use in the vDSO
+ *
+ * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org), IBM Corp.
+ * Copyright (C) 2004 Alan Modra (amodra@au.ibm.com)), IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/ppc_asm.h>
+#include <asm/unistd.h>
+#include <asm/vdso.h>
+
+	.text
+
+/* The nop here is a hack.  The dwarf2 unwind routines subtract 1 from
+   the return address to get an address in the middle of the presumed
+   call instruction.  Since we don't have a call here, we artifically
+   extend the range covered by the unwind info by padding before the
+   real start.  */
+	nop
+	.balign 8
+V_FUNCTION_BEGIN(__kernel_sigtramp_rt64)
+.Lsigrt_start = . - 4
+	addi	r1, r1, __SIGNAL_FRAMESIZE
+	li	r0,__NR_rt_sigreturn
+	sc
+.Lsigrt_end:
+V_FUNCTION_END(__kernel_sigtramp_rt64)
+/* The ".balign 8" above and the following zeros mimic the old stack
+   trampoline layout.  The last magic value is the ucontext pointer,
+   chosen in such a way that older libgcc unwind code returns a zero
+   for a sigcontext pointer.  */
+	.long 0,0,0
+	.quad 0,-21*8
+
+/* Register r1 can be found at offset 8 of a pt_regs structure.
+   A pointer to the pt_regs is stored in memory at the old sp plus PTREGS.  */
+#define cfa_save \
+  .byte 0x0f;			/* DW_CFA_def_cfa_expression */		\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x71; .sleb128 PTREGS;	/*     DW_OP_breg1 */			\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .byte 0x23; .uleb128 RSIZE;	/*     DW_OP_plus_uconst */		\
+  .byte 0x06;			/*     DW_OP_deref */			\
+9:
+
+/* Register REGNO can be found at offset OFS of a pt_regs structure.
+   A pointer to the pt_regs is stored in memory at the old sp plus PTREGS.  */
+#define rsave(regno, ofs) \
+  .byte 0x10;			/* DW_CFA_expression */			\
+  .uleb128 regno;		/*   regno */				\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x71; .sleb128 PTREGS;	/*     DW_OP_breg1 */			\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .ifne ofs;								\
+    .byte 0x23; .uleb128 ofs;	/*     DW_OP_plus_uconst */		\
+  .endif;								\
+9:
+
+/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16
+   of the VMX reg struct.  A pointer to the VMX reg struct is at VREGS in
+   the pt_regs struct.  This macro is for REGNO == 0, and contains
+   'subroutines' that the other macros jump to.  */
+#define vsave_msr0(regno) \
+  .byte 0x10;			/* DW_CFA_expression */			\
+  .uleb128 regno + 77;		/*   regno */				\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x30 + regno;		/*     DW_OP_lit0 */			\
+2:									\
+  .byte 0x40;			/*     DW_OP_lit16 */			\
+  .byte 0x1e;			/*     DW_OP_mul */			\
+3:									\
+  .byte 0x71; .sleb128 PTREGS;	/*     DW_OP_breg1 */			\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .byte 0x12;			/*     DW_OP_dup */			\
+  .byte 0x23;			/*     DW_OP_plus_uconst */		\
+    .uleb128 33*RSIZE;		/*       msr offset */			\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .byte 0x0c; .long 1 << 25;	/*     DW_OP_const4u */			\
+  .byte 0x1a;			/*     DW_OP_and */			\
+  .byte 0x12;			/*     DW_OP_dup, ret 0 if bra taken */	\
+  .byte 0x30;			/*     DW_OP_lit0 */			\
+  .byte 0x29;			/*     DW_OP_eq */			\
+  .byte 0x28; .short 0x7fff;	/*     DW_OP_bra to end */		\
+  .byte 0x13;			/*     DW_OP_drop, pop the 0 */		\
+  .byte 0x23; .uleb128 VREGS;	/*     DW_OP_plus_uconst */		\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .byte 0x22;			/*     DW_OP_plus */			\
+  .byte 0x2f; .short 0x7fff;	/*     DW_OP_skip to end */		\
+9:
+
+/* If msr bit 1<<25 is set, then VMX register REGNO is at offset REGNO*16
+   of the VMX reg struct.  REGNO is 1 thru 31.  */
+#define vsave_msr1(regno) \
+  .byte 0x10;			/* DW_CFA_expression */			\
+  .uleb128 regno + 77;		/*   regno */				\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x30 + regno;		/*     DW_OP_lit n */			\
+  .byte 0x2f; .short 2b - 9f;	/*     DW_OP_skip */			\
+9:
+
+/* If msr bit 1<<25 is set, then VMX register REGNO is at offset OFS of
+   the VMX save block.  */
+#define vsave_msr2(regno, ofs) \
+  .byte 0x10;			/* DW_CFA_expression */			\
+  .uleb128 regno + 77;		/*   regno */				\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x0a; .short ofs;	/*     DW_OP_const2u */			\
+  .byte 0x2f; .short 3b - 9f;	/*     DW_OP_skip */			\
+9:
+
+/* VMX register REGNO is at offset OFS of the VMX save area.  */
+#define vsave(regno, ofs) \
+  .byte 0x10;			/* DW_CFA_expression */			\
+  .uleb128 regno + 77;		/*   regno */				\
+  .uleb128 9f - 1f;		/*   length */				\
+1:									\
+  .byte 0x71; .sleb128 PTREGS;	/*     DW_OP_breg1 */			\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .byte 0x23; .uleb128 VREGS;	/*     DW_OP_plus_uconst */		\
+  .byte 0x06;			/*     DW_OP_deref */			\
+  .byte 0x23; .uleb128 ofs;	/*     DW_OP_plus_uconst */		\
+9:
+
+/* This is where the pt_regs pointer can be found on the stack.  */
+#define PTREGS 128+168+56
+
+/* Size of regs.  */
+#define RSIZE 8
+
+/* This is the offset of the VMX reg pointer.  */
+#define VREGS 48*RSIZE+33*8
+
+/* Describe where general purpose regs are saved.  */
+#define EH_FRAME_GEN \
+  cfa_save;								\
+  rsave ( 0,  0*RSIZE);							\
+  rsave ( 2,  2*RSIZE);							\
+  rsave ( 3,  3*RSIZE);							\
+  rsave ( 4,  4*RSIZE);							\
+  rsave ( 5,  5*RSIZE);							\
+  rsave ( 6,  6*RSIZE);							\
+  rsave ( 7,  7*RSIZE);							\
+  rsave ( 8,  8*RSIZE);							\
+  rsave ( 9,  9*RSIZE);							\
+  rsave (10, 10*RSIZE);							\
+  rsave (11, 11*RSIZE);							\
+  rsave (12, 12*RSIZE);							\
+  rsave (13, 13*RSIZE);							\
+  rsave (14, 14*RSIZE);							\
+  rsave (15, 15*RSIZE);							\
+  rsave (16, 16*RSIZE);							\
+  rsave (17, 17*RSIZE);							\
+  rsave (18, 18*RSIZE);							\
+  rsave (19, 19*RSIZE);							\
+  rsave (20, 20*RSIZE);							\
+  rsave (21, 21*RSIZE);							\
+  rsave (22, 22*RSIZE);							\
+  rsave (23, 23*RSIZE);							\
+  rsave (24, 24*RSIZE);							\
+  rsave (25, 25*RSIZE);							\
+  rsave (26, 26*RSIZE);							\
+  rsave (27, 27*RSIZE);							\
+  rsave (28, 28*RSIZE);							\
+  rsave (29, 29*RSIZE);							\
+  rsave (30, 30*RSIZE);							\
+  rsave (31, 31*RSIZE);							\
+  rsave (67, 32*RSIZE);		/* ap, used as temp for nip */		\
+  rsave (65, 36*RSIZE);		/* lr */				\
+  rsave (70, 38*RSIZE)		/* cr */
+
+/* Describe where the FP regs are saved.  */
+#define EH_FRAME_FP \
+  rsave (32, 48*RSIZE +  0*8);						\
+  rsave (33, 48*RSIZE +  1*8);						\
+  rsave (34, 48*RSIZE +  2*8);						\
+  rsave (35, 48*RSIZE +  3*8);						\
+  rsave (36, 48*RSIZE +  4*8);						\
+  rsave (37, 48*RSIZE +  5*8);						\
+  rsave (38, 48*RSIZE +  6*8);						\
+  rsave (39, 48*RSIZE +  7*8);						\
+  rsave (40, 48*RSIZE +  8*8);						\
+  rsave (41, 48*RSIZE +  9*8);						\
+  rsave (42, 48*RSIZE + 10*8);						\
+  rsave (43, 48*RSIZE + 11*8);						\
+  rsave (44, 48*RSIZE + 12*8);						\
+  rsave (45, 48*RSIZE + 13*8);						\
+  rsave (46, 48*RSIZE + 14*8);						\
+  rsave (47, 48*RSIZE + 15*8);						\
+  rsave (48, 48*RSIZE + 16*8);						\
+  rsave (49, 48*RSIZE + 17*8);						\
+  rsave (50, 48*RSIZE + 18*8);						\
+  rsave (51, 48*RSIZE + 19*8);						\
+  rsave (52, 48*RSIZE + 20*8);						\
+  rsave (53, 48*RSIZE + 21*8);						\
+  rsave (54, 48*RSIZE + 22*8);						\
+  rsave (55, 48*RSIZE + 23*8);						\
+  rsave (56, 48*RSIZE + 24*8);						\
+  rsave (57, 48*RSIZE + 25*8);						\
+  rsave (58, 48*RSIZE + 26*8);						\
+  rsave (59, 48*RSIZE + 27*8);						\
+  rsave (60, 48*RSIZE + 28*8);						\
+  rsave (61, 48*RSIZE + 29*8);						\
+  rsave (62, 48*RSIZE + 30*8);						\
+  rsave (63, 48*RSIZE + 31*8)
+
+/* Describe where the VMX regs are saved.  */
+#ifdef CONFIG_ALTIVEC
+#define EH_FRAME_VMX \
+  vsave_msr0 ( 0);							\
+  vsave_msr1 ( 1);							\
+  vsave_msr1 ( 2);							\
+  vsave_msr1 ( 3);							\
+  vsave_msr1 ( 4);							\
+  vsave_msr1 ( 5);							\
+  vsave_msr1 ( 6);							\
+  vsave_msr1 ( 7);							\
+  vsave_msr1 ( 8);							\
+  vsave_msr1 ( 9);							\
+  vsave_msr1 (10);							\
+  vsave_msr1 (11);							\
+  vsave_msr1 (12);							\
+  vsave_msr1 (13);							\
+  vsave_msr1 (14);							\
+  vsave_msr1 (15);							\
+  vsave_msr1 (16);							\
+  vsave_msr1 (17);							\
+  vsave_msr1 (18);							\
+  vsave_msr1 (19);							\
+  vsave_msr1 (20);							\
+  vsave_msr1 (21);							\
+  vsave_msr1 (22);							\
+  vsave_msr1 (23);							\
+  vsave_msr1 (24);							\
+  vsave_msr1 (25);							\
+  vsave_msr1 (26);							\
+  vsave_msr1 (27);							\
+  vsave_msr1 (28);							\
+  vsave_msr1 (29);							\
+  vsave_msr1 (30);							\
+  vsave_msr1 (31);							\
+  vsave_msr2 (33, 32*16+12);						\
+  vsave      (32, 33*16)
+#else
+#define EH_FRAME_VMX
+#endif
+
+	.section .eh_frame,"a",@progbits
+.Lcie:
+	.long .Lcie_end - .Lcie_start
+.Lcie_start:
+	.long 0			/* CIE ID */
+	.byte 1			/* Version number */
+	.string "zR"		/* NUL-terminated augmentation string */
+	.uleb128 4		/* Code alignment factor */
+	.sleb128 -8		/* Data alignment factor */
+	.byte 67		/* Return address register column, ap */
+	.uleb128 1		/* Augmentation value length */
+	.byte 0x14		/* DW_EH_PE_pcrel | DW_EH_PE_udata8. */
+	.byte 0x0c,1,0		/* DW_CFA_def_cfa: r1 ofs 0 */
+	.balign 8
+.Lcie_end:
+
+	.long .Lfde0_end - .Lfde0_start
+.Lfde0_start:
+	.long .Lfde0_start - .Lcie	/* CIE pointer. */
+	.quad .Lsigrt_start - .		/* PC start, length */
+	.quad .Lsigrt_end - .Lsigrt_start
+	.uleb128 0			/* Augmentation */
+	EH_FRAME_GEN
+	EH_FRAME_FP
+	EH_FRAME_VMX
+# Do we really need to describe the frame at this point?  ie. will
+# we ever have some call chain that returns somewhere past the addi?
+# I don't think so, since gcc doesn't support async signals.
+#	.byte 0x41		/* DW_CFA_advance_loc 1*4 */
+#undef PTREGS
+#define PTREGS 168+56
+#	EH_FRAME_GEN
+#	EH_FRAME_FP
+#	EH_FRAME_VMX
+	.balign 8
+.Lfde0_end:
diff -Nru a/arch/ppc64/kernel/vdso64/vdso64.lds.S b/arch/ppc64/kernel/vdso64/vdso64.lds.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso64/vdso64.lds.S	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,110 @@
+/*
+ * This is the infamous ld script for the 64 bits vdso
+ * library
+ */
+#include <asm/vdso.h>
+
+OUTPUT_FORMAT("elf64-powerpc", "elf64-powerpc", "elf64-powerpc")
+OUTPUT_ARCH(powerpc:common64)
+ENTRY(_start)
+
+SECTIONS
+{
+  . = VDSO64_LBASE + SIZEOF_HEADERS;
+  .hash           : { *(.hash) }		:text
+  .dynsym         : { *(.dynsym) }
+  .dynstr         : { *(.dynstr) }
+  .gnu.version    : { *(.gnu.version) }
+  .gnu.version_d  : { *(.gnu.version_d) }
+  .gnu.version_r  : { *(.gnu.version_r) }
+
+  . = ALIGN (16);
+  .text           :
+  {
+    *(.text .stub .text.* .gnu.linkonce.t.*)
+    *(.sfpr .glink)
+  }
+  PROVIDE (__etext = .);
+  PROVIDE (_etext = .);
+  PROVIDE (etext = .);
+
+  /* Other stuff is appended to the text segment: */
+  .rodata         : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
+  .rodata1        : { *(.rodata1) }
+  .eh_frame_hdr   : { *(.eh_frame_hdr) }	:text	:eh_frame_hdr
+  .eh_frame       : { KEEP (*(.eh_frame)) }	:text
+  .gcc_except_table   : { *(.gcc_except_table) }
+
+  .opd           ALIGN(8) : { KEEP (*(.opd)) }
+  .got		 ALIGN(8) : { *(.got .toc) }
+  .rela.dyn	 ALIGN(8) : { *(.rela.dyn) }
+
+  .dynamic        : { *(.dynamic) }		:text	:dynamic
+
+  _end = .;
+  PROVIDE (end = .);
+
+  /* Stabs debugging sections are here too
+   */
+  .stab          0 : { *(.stab) }
+  .stabstr       0 : { *(.stabstr) }
+  .stab.excl     0 : { *(.stab.excl) }
+  .stab.exclstr  0 : { *(.stab.exclstr) }
+  .stab.index    0 : { *(.stab.index) }
+  .stab.indexstr 0 : { *(.stab.indexstr) }
+  .comment       0 : { *(.comment) }
+  /* DWARF debug sectio/ns.
+     Symbols in the DWARF debugging sections are relative to the beginning
+     of the section so we begin them at 0.  */
+  /* DWARF 1 */
+  .debug          0 : { *(.debug) }
+  .line           0 : { *(.line) }
+  /* GNU DWARF 1 extensions */
+  .debug_srcinfo  0 : { *(.debug_srcinfo) }
+  .debug_sfnames  0 : { *(.debug_sfnames) }
+  /* DWARF 1.1 and DWARF 2 */
+  .debug_aranges  0 : { *(.debug_aranges) }
+  .debug_pubnames 0 : { *(.debug_pubnames) }
+  /* DWARF 2 */
+  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
+  .debug_abbrev   0 : { *(.debug_abbrev) }
+  .debug_line     0 : { *(.debug_line) }
+  .debug_frame    0 : { *(.debug_frame) }
+  .debug_str      0 : { *(.debug_str) }
+  .debug_loc      0 : { *(.debug_loc) }
+  .debug_macinfo  0 : { *(.debug_macinfo) }
+  /* SGI/MIPS DWARF 2 extensions */
+  .debug_weaknames 0 : { *(.debug_weaknames) }
+  .debug_funcnames 0 : { *(.debug_funcnames) }
+  .debug_typenames 0 : { *(.debug_typenames) }
+  .debug_varnames  0 : { *(.debug_varnames) }
+
+  /DISCARD/ : { *(.note.GNU-stack) }
+  /DISCARD/ : { *(.branch_lt) }
+  /DISCARD/ : { *(.data .data.* .gnu.linkonce.d.*) }
+  /DISCARD/ : { *(.bss .sbss .dynbss .dynsbss) }
+}
+
+PHDRS
+{
+  text PT_LOAD FILEHDR PHDRS FLAGS(5); /* PF_R|PF_X */
+  dynamic PT_DYNAMIC FLAGS(4); /* PF_R */
+  eh_frame_hdr 0x6474e550; /* PT_GNU_EH_FRAME, but ld doesn't match the name */
+}
+
+/*
+ * This controls what symbols we export from the DSO.
+ */
+VERSION
+{
+  VDSO_VERSION_STRING {
+    global:
+	__kernel_datapage_offset; /* Has to be there for the kernel to find it */
+	__kernel_get_syscall_map;
+    	__kernel_gettimeofday;
+	__kernel_sync_dicache;
+	__kernel_sync_dicache_p5;
+	__kernel_sigtramp_rt64;
+    local: *;
+  };
+}
diff -Nru a/arch/ppc64/kernel/vdso64/vdso64_wrapper.S b/arch/ppc64/kernel/vdso64/vdso64_wrapper.S
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/ppc64/kernel/vdso64/vdso64_wrapper.S	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,13 @@
+#include <linux/init.h>
+#include <asm/page.h>
+
+	.section ".data.page_aligned"
+
+	.globl vdso64_start, vdso64_end
+	.balign PAGE_SIZE
+vdso64_start:
+	.incbin "arch/ppc64/kernel/vdso64/vdso64.so"
+	.balign PAGE_SIZE
+vdso64_end:
+
+	.previous
diff -Nru a/arch/ppc64/kernel/vio.c b/arch/ppc64/kernel/vio.c
--- a/arch/ppc64/kernel/vio.c	2005-01-07 21:43:52 -08:00
+++ b/arch/ppc64/kernel/vio.c	2005-02-06 20:45:00 -08:00
@@ -557,48 +557,61 @@
 EXPORT_SYMBOL(vio_disable_interrupts);
 #endif
 
-dma_addr_t vio_map_single(struct vio_dev *dev, void *vaddr,
+static dma_addr_t vio_map_single(struct device *dev, void *vaddr,
 			  size_t size, enum dma_data_direction direction)
 {
-	return iommu_map_single(dev->iommu_table, vaddr, size, direction);
+	return iommu_map_single(to_vio_dev(dev)->iommu_table, vaddr, size,
+			direction);
 }
-EXPORT_SYMBOL(vio_map_single);
 
-void vio_unmap_single(struct vio_dev *dev, dma_addr_t dma_handle,
+static void vio_unmap_single(struct device *dev, dma_addr_t dma_handle,
 		      size_t size, enum dma_data_direction direction)
 {
-	iommu_unmap_single(dev->iommu_table, dma_handle, size, direction);
+	iommu_unmap_single(to_vio_dev(dev)->iommu_table, dma_handle, size,
+			direction);
 }
-EXPORT_SYMBOL(vio_unmap_single);
 
-int vio_map_sg(struct vio_dev *vdev, struct scatterlist *sglist, int nelems,
-	       enum dma_data_direction direction)
+static int vio_map_sg(struct device *dev, struct scatterlist *sglist,
+		int nelems, enum dma_data_direction direction)
 {
-	return iommu_map_sg(&vdev->dev, vdev->iommu_table, sglist,
+	return iommu_map_sg(dev, to_vio_dev(dev)->iommu_table, sglist,
 			nelems, direction);
 }
-EXPORT_SYMBOL(vio_map_sg);
 
-void vio_unmap_sg(struct vio_dev *vdev, struct scatterlist *sglist, int nelems,
-		  enum dma_data_direction direction)
+static void vio_unmap_sg(struct device *dev, struct scatterlist *sglist,
+		int nelems, enum dma_data_direction direction)
 {
-	iommu_unmap_sg(vdev->iommu_table, sglist, nelems, direction);
+	iommu_unmap_sg(to_vio_dev(dev)->iommu_table, sglist, nelems, direction);
 }
-EXPORT_SYMBOL(vio_unmap_sg);
 
-void *vio_alloc_consistent(struct vio_dev *dev, size_t size,
-			   dma_addr_t *dma_handle)
+static void *vio_alloc_coherent(struct device *dev, size_t size,
+			   dma_addr_t *dma_handle, int flag)
 {
-	return iommu_alloc_consistent(dev->iommu_table, size, dma_handle);
+	return iommu_alloc_coherent(to_vio_dev(dev)->iommu_table, size,
+			dma_handle, flag);
 }
-EXPORT_SYMBOL(vio_alloc_consistent);
 
-void vio_free_consistent(struct vio_dev *dev, size_t size,
+static void vio_free_coherent(struct device *dev, size_t size,
 			 void *vaddr, dma_addr_t dma_handle)
 {
-	iommu_free_consistent(dev->iommu_table, size, vaddr, dma_handle);
+	iommu_free_coherent(to_vio_dev(dev)->iommu_table, size, vaddr,
+			dma_handle);
 }
-EXPORT_SYMBOL(vio_free_consistent);
+
+static int vio_dma_supported(struct device *dev, u64 mask)
+{
+	return 1;
+}
+
+struct dma_mapping_ops vio_dma_ops = {
+	.alloc_coherent = vio_alloc_coherent,
+	.free_coherent = vio_free_coherent,
+	.map_single = vio_map_single,
+	.unmap_single = vio_unmap_single,
+	.map_sg = vio_map_sg,
+	.unmap_sg = vio_unmap_sg,
+	.dma_supported = vio_dma_supported,
+};
 
 static int vio_bus_match(struct device *dev, struct device_driver *drv)
 {
diff -Nru a/arch/ppc64/kernel/xics.c b/arch/ppc64/kernel/xics.c
--- a/arch/ppc64/kernel/xics.c	2005-01-20 20:56:33 -08:00
+++ b/arch/ppc64/kernel/xics.c	2005-03-06 19:52:08 -08:00
@@ -654,7 +654,7 @@
 	/* remove ourselves from the global interrupt queue */
 	status = rtas_set_indicator(GLOBAL_INTERRUPT_QUEUE,
 		(1UL << interrupt_server_size) - 1 - default_distrib_server, 0);
-	WARN_ON(status != 0);
+	WARN_ON(status < 0);
 
 	/* Allow IPIs again... */
 	ops->cppr_info(cpu, DEFAULT_PRIORITY);
@@ -704,15 +704,8 @@
 		       virq, cpu);
 
 		/* Reset affinity to all cpus */
-		xics_status[0] = default_distrib_server;
-
-		status = rtas_call(ibm_set_xive, 3, 1, NULL, irq,
-				xics_status[0], xics_status[1]);
-		if (status)
-			printk(KERN_ERR "migrate_irqs_away: irq=%d "
-					"ibm,set-xive returns %d\n",
-					virq, status);
-
+		desc->handler->set_affinity(virq, CPU_MASK_ALL);
+		irq_affinity[virq] = CPU_MASK_ALL;
 unlock:
 		spin_unlock_irqrestore(&desc->lock, flags);
 	}
diff -Nru a/arch/ppc64/mm/hash_native.c b/arch/ppc64/mm/hash_native.c
--- a/arch/ppc64/mm/hash_native.c	2005-01-20 21:02:10 -08:00
+++ b/arch/ppc64/mm/hash_native.c	2005-03-04 22:41:15 -08:00
@@ -217,10 +217,10 @@
 	}
 
 	/* Ensure it is out of the tlb too */
-	if ((cur_cpu_spec->cpu_features & CPU_FTR_TLBIEL) && !large && local) {
+	if (cpu_has_feature(CPU_FTR_TLBIEL) && !large && local) {
 		tlbiel(va);
 	} else {
-		int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE);
+		int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE);
 
 		if (lock_tlbie)
 			spin_lock(&native_tlbie_lock);
@@ -245,7 +245,7 @@
 	unsigned long vsid, va, vpn, flags = 0;
 	long slot;
 	HPTE *hptep;
-	int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE);
+	int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE);
 
 	vsid = get_kernel_vsid(ea);
 	va = (vsid << 28) | (ea & 0x0fffffff);
@@ -273,7 +273,7 @@
 	Hpte_dword0 dw0;
 	unsigned long avpn = va >> 23;
 	unsigned long flags;
-	int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE);
+	int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE);
 
 	if (large)
 		avpn &= ~0x1UL;
@@ -292,7 +292,7 @@
 	}
 
 	/* Invalidate the tlb */
-	if ((cur_cpu_spec->cpu_features & CPU_FTR_TLBIEL) && !large && local) {
+	if (cpu_has_feature(CPU_FTR_TLBIEL) && !large && local) {
 		tlbiel(va);
 	} else {
 		if (lock_tlbie)
@@ -360,7 +360,7 @@
 		j++;
 	}
 
-	if ((cur_cpu_spec->cpu_features & CPU_FTR_TLBIEL) && !large && local) {
+	if (cpu_has_feature(CPU_FTR_TLBIEL) && !large && local) {
 		asm volatile("ptesync":::"memory");
 
 		for (i = 0; i < j; i++)
@@ -368,7 +368,7 @@
 
 		asm volatile("ptesync":::"memory");
 	} else {
-		int lock_tlbie = !(cur_cpu_spec->cpu_features & CPU_FTR_LOCKLESS_TLBIE);
+		int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE);
 
 		if (lock_tlbie)
 			spin_lock(&native_tlbie_lock);
diff -Nru a/arch/ppc64/mm/hash_utils.c b/arch/ppc64/mm/hash_utils.c
--- a/arch/ppc64/mm/hash_utils.c	2005-01-25 13:50:15 -08:00
+++ b/arch/ppc64/mm/hash_utils.c	2005-03-04 22:41:15 -08:00
@@ -190,7 +190,7 @@
 	 * _NOT_ map it to avoid cache paradoxes as it's remapped non
 	 * cacheable later on
 	 */
-	if (cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE)
+	if (cpu_has_feature(CPU_FTR_16M_PAGE))
 		use_largepages = 1;
 
 	/* create bolted the linear mapping in the hash table */
diff -Nru a/arch/ppc64/mm/hugetlbpage.c b/arch/ppc64/mm/hugetlbpage.c
--- a/arch/ppc64/mm/hugetlbpage.c	2005-02-22 01:32:19 -08:00
+++ b/arch/ppc64/mm/hugetlbpage.c	2005-03-05 20:47:56 -08:00
@@ -149,7 +149,8 @@
 }
 
 static void set_huge_pte(struct mm_struct *mm, struct vm_area_struct *vma,
-			 struct page *page, pte_t *ptep, int write_access)
+			 unsigned long addr, struct page *page,
+			 pte_t *ptep, int write_access)
 {
 	pte_t entry;
 
@@ -163,7 +164,7 @@
 	entry = pte_mkyoung(entry);
 	entry = pte_mkhuge(entry);
 
-	set_pte(ptep, entry);
+	set_pte_at(mm, addr, ptep, entry);
 }
 
 /*
@@ -316,7 +317,7 @@
 		ptepage = pte_page(entry);
 		get_page(ptepage);
 		dst->rss += (HPAGE_SIZE / PAGE_SIZE);
-		set_pte(dst_pte, entry);
+		set_pte_at(dst, addr, dst_pte, entry);
 
 		addr += HPAGE_SIZE;
 	}
@@ -421,7 +422,7 @@
 
 		pte = *ptep;
 		page = pte_page(pte);
-		pte_clear(ptep);
+		pte_clear(mm, addr, ptep);
 
 		put_page(page);
 	}
@@ -486,7 +487,7 @@
 				goto out;
 			}
 		}
-		set_huge_pte(mm, vma, page, pte, vma->vm_flags & VM_WRITE);
+		set_huge_pte(mm, vma, addr, page, pte, vma->vm_flags & VM_WRITE);
 	}
 out:
 	spin_unlock(&mm->page_table_lock);
@@ -709,7 +710,7 @@
 	if (len & ~HPAGE_MASK)
 		return -EINVAL;
 
-	if (!(cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE))
+	if (!cpu_has_feature(CPU_FTR_16M_PAGE))
 		return -EINVAL;
 
 	if (test_thread_flag(TIF_32BIT)) {
diff -Nru a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c
--- a/arch/ppc64/mm/init.c	2005-01-20 21:02:10 -08:00
+++ b/arch/ppc64/mm/init.c	2005-03-05 20:47:56 -08:00
@@ -38,6 +38,7 @@
 #include <linux/highmem.h>
 #include <linux/idr.h>
 #include <linux/nodemask.h>
+#include <linux/module.h>
 
 #include <asm/pgalloc.h>
 #include <asm/page.h>
@@ -62,6 +63,7 @@
 #include <asm/system.h>
 #include <asm/iommu.h>
 #include <asm/abs_addr.h>
+#include <asm/vdso.h>
 
 int mem_init_done;
 unsigned long ioremap_bot = IMALLOC_BASE;
@@ -153,7 +155,7 @@
 		ptep = pte_alloc_kernel(&ioremap_mm, pmdp, ea);
 
 		pa = abs_to_phys(pa);
-		set_pte(ptep, pfn_pte(pa >> PAGE_SHIFT, __pgprot(flags)));
+		set_pte_at(&ioremap_mm, ea, ptep, pfn_pte(pa >> PAGE_SHIFT, __pgprot(flags)));
 		spin_unlock(&ioremap_mm.page_table_lock);
 	} else {
 		unsigned long va, vpn, hash, hpteg;
@@ -305,7 +307,7 @@
 
 	do {
 		pte_t page;
-		page = ptep_get_and_clear(pte);
+		page = ptep_get_and_clear(&ioremap_mm, address, pte);
 		address += PAGE_SIZE;
 		pte++;
 		if (pte_none(page))
@@ -441,6 +443,10 @@
 
 #endif
 
+EXPORT_SYMBOL(ioremap);
+EXPORT_SYMBOL(__ioremap);
+EXPORT_SYMBOL(iounmap);
+
 void free_initmem(void)
 {
 	unsigned long addr;
@@ -743,6 +749,8 @@
 #ifdef CONFIG_PPC_ISERIES
 	iommu_vio_init();
 #endif
+	/* Initialize the vDSO */
+	vdso_init();
 }
 
 /*
@@ -752,18 +760,19 @@
  */
 void flush_dcache_page(struct page *page)
 {
-	if (cur_cpu_spec->cpu_features & CPU_FTR_COHERENT_ICACHE)
+	if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
 		return;
 	/* avoid an atomic op if possible */
 	if (test_bit(PG_arch_1, &page->flags))
 		clear_bit(PG_arch_1, &page->flags);
 }
+EXPORT_SYMBOL(flush_dcache_page);
 
 void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
 {
 	clear_page(page);
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_COHERENT_ICACHE)
+	if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
 		return;
 	/*
 	 * We shouldnt have to do this, but some versions of glibc
@@ -775,6 +784,7 @@
 	if (test_bit(PG_arch_1, &pg->flags))
 		clear_bit(PG_arch_1, &pg->flags);
 }
+EXPORT_SYMBOL(clear_user_page);
 
 void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
 		    struct page *pg)
@@ -796,7 +806,7 @@
 		return;
 #endif
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_COHERENT_ICACHE)
+	if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
 		return;
 
 	/* avoid an atomic op if possible */
@@ -812,6 +822,7 @@
 	maddr = (unsigned long)page_address(page) + (addr & ~PAGE_MASK);
 	flush_icache_range(maddr, maddr + len);
 }
+EXPORT_SYMBOL(flush_icache_user_range);
 
 /*
  * This is called at the end of handling a user page fault, when the
@@ -832,8 +843,8 @@
 	unsigned long flags;
 
 	/* handle i-cache coherency */
-	if (!(cur_cpu_spec->cpu_features & CPU_FTR_COHERENT_ICACHE) &&
-	    !(cur_cpu_spec->cpu_features & CPU_FTR_NOEXECUTE)) {
+	if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE) &&
+	    !cpu_has_feature(CPU_FTR_NOEXECUTE)) {
 		unsigned long pfn = pte_pfn(pte);
 		if (pfn_valid(pfn)) {
 			struct page *page = pfn_to_page(pfn);
diff -Nru a/arch/ppc64/mm/slb.c b/arch/ppc64/mm/slb.c
--- a/arch/ppc64/mm/slb.c	2005-01-25 13:50:15 -08:00
+++ b/arch/ppc64/mm/slb.c	2005-03-04 22:41:15 -08:00
@@ -51,7 +51,7 @@
 
 	WARN_ON(!irqs_disabled());
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE)
+	if (cpu_has_feature(CPU_FTR_16M_PAGE))
 		ksp_flags |= SLB_VSID_L;
 
 	ksp_esid_data = mk_esid_data(get_paca()->kstack, 2);
@@ -139,7 +139,7 @@
 	unsigned long flags = SLB_VSID_KERNEL;
 
  	/* Invalidate the entire SLB (even slot 0) & all the ERATS */
- 	if (cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE)
+ 	if (cpu_has_feature(CPU_FTR_16M_PAGE))
  		flags |= SLB_VSID_L;
 
  	asm volatile("isync":::"memory");
diff -Nru a/arch/ppc64/mm/stab.c b/arch/ppc64/mm/stab.c
--- a/arch/ppc64/mm/stab.c	2005-01-04 18:48:01 -08:00
+++ b/arch/ppc64/mm/stab.c	2005-03-04 22:41:15 -08:00
@@ -227,7 +227,7 @@
 {
 	unsigned long vsid = get_kernel_vsid(KERNELBASE);
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_SLB) {
+	if (cpu_has_feature(CPU_FTR_SLB)) {
 		slb_initialize();
 	} else {
 		asm volatile("isync; slbia; isync":::"memory");
diff -Nru a/arch/ppc64/mm/tlb.c b/arch/ppc64/mm/tlb.c
--- a/arch/ppc64/mm/tlb.c	2005-02-24 19:56:47 -08:00
+++ b/arch/ppc64/mm/tlb.c	2005-03-01 15:37:54 -08:00
@@ -74,23 +74,12 @@
  * change the existing HPTE to read-only rather than removing it
  * (if we remove it we should clear the _PTE_HPTEFLAGS bits).
  */
-void hpte_update(pte_t *ptep, unsigned long pte, int wrprot)
+void hpte_update(struct mm_struct *mm, unsigned long addr,
+		 unsigned long pte, int wrprot)
 {
-	struct page *ptepage;
-	struct mm_struct *mm;
-	unsigned long addr;
 	int i;
 	unsigned long context = 0;
 	struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
-
-	ptepage = virt_to_page(ptep);
-	mm = (struct mm_struct *) ptepage->mapping;
-	addr = ptepage->index;
-	if (pte_huge(pte))
-		addr +=  ((unsigned long)ptep & ~PAGE_MASK)
-			/ sizeof(*ptep) * HPAGE_SIZE;
-	else
-		addr += ((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE;
 
 	if (REGION_ID(addr) == USER_REGION_ID)
 		context = mm->context.id;
diff -Nru a/arch/ppc64/oprofile/common.c b/arch/ppc64/oprofile/common.c
--- a/arch/ppc64/oprofile/common.c	2005-01-25 13:43:48 -08:00
+++ b/arch/ppc64/oprofile/common.c	2005-03-04 22:41:55 -08:00
@@ -15,6 +15,7 @@
 #include <linux/errno.h>
 #include <asm/ptrace.h>
 #include <asm/system.h>
+#include <asm/pmc.h>
 
 #include "op_impl.h"
 
@@ -22,9 +23,6 @@
 extern struct op_ppc64_model op_model_power4;
 static struct op_ppc64_model *model;
 
-extern void (*perf_irq)(struct pt_regs *);
-static void (*save_perf_irq)(struct pt_regs *);
-
 static struct op_counter_config ctr[OP_MAX_COUNTER];
 static struct op_system_config sys;
 
@@ -35,11 +33,12 @@
 
 static int op_ppc64_setup(void)
 {
-	/* Install our interrupt handler into the existing hook.  */
-	save_perf_irq = perf_irq;
-	perf_irq = op_handle_interrupt;
+	int err;
 
-	mb();
+	/* Grab the hardware */
+	err = reserve_pmc_hardware(op_handle_interrupt);
+	if (err)
+		return err;
 
 	/* Pre-compute the values to stuff in the hardware registers.  */
 	model->reg_setup(ctr, &sys, model->num_counters);
@@ -52,10 +51,7 @@
 
 static void op_ppc64_shutdown(void)
 {
-	mb();
-
-	/* Remove our interrupt handler. We may be removing this module. */
-	perf_irq = save_perf_irq;
+	release_pmc_hardware();
 }
 
 static void op_ppc64_cpu_start(void *dummy)
diff -Nru a/arch/ppc64/oprofile/op_model_power4.c b/arch/ppc64/oprofile/op_model_power4.c
--- a/arch/ppc64/oprofile/op_model_power4.c	2005-01-10 17:29:24 -08:00
+++ b/arch/ppc64/oprofile/op_model_power4.c	2005-03-04 22:41:15 -08:00
@@ -54,7 +54,7 @@
 	 *
 	 * It has been verified to work on POWER5 so we enable it there.
 	 */
-	if (cur_cpu_spec->cpu_features & CPU_FTR_MMCRA_SIHV)
+	if (cpu_has_feature(CPU_FTR_MMCRA_SIHV))
 		mmcra_has_sihv = 1;
 
 	/*
diff -Nru a/arch/ppc64/oprofile/op_model_rs64.c b/arch/ppc64/oprofile/op_model_rs64.c
--- a/arch/ppc64/oprofile/op_model_rs64.c	2005-01-10 17:29:24 -08:00
+++ b/arch/ppc64/oprofile/op_model_rs64.c	2005-03-04 22:41:15 -08:00
@@ -114,7 +114,7 @@
 	/* reset MMCR1, MMCRA */
 	mtspr(SPRN_MMCR1, 0);
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_MMCRA)
+	if (cpu_has_feature(CPU_FTR_MMCRA))
 		mtspr(SPRN_MMCRA, 0);
 
 	mmcr0 |= MMCR0_FCM1|MMCR0_PMXE|MMCR0_FCECE;
diff -Nru a/arch/ppc64/xmon/xmon.c b/arch/ppc64/xmon/xmon.c
--- a/arch/ppc64/xmon/xmon.c	2005-02-23 01:47:06 -08:00
+++ b/arch/ppc64/xmon/xmon.c	2005-03-04 22:41:15 -08:00
@@ -725,7 +725,7 @@
 {
 	if (dabr.enabled)
 		set_controlled_dabr(dabr.address | (dabr.enabled & 7));
-	if (iabr && (cur_cpu_spec->cpu_features & CPU_FTR_IABR))
+	if (iabr && cpu_has_feature(CPU_FTR_IABR))
 		set_iabr(iabr->address
 			 | (iabr->enabled & (BP_IABR|BP_IABR_TE)));
 }
@@ -753,7 +753,7 @@
 static void remove_cpu_bpts(void)
 {
 	set_controlled_dabr(0);
-	if ((cur_cpu_spec->cpu_features & CPU_FTR_IABR))
+	if (cpu_has_feature(CPU_FTR_IABR))
 		set_iabr(0);
 }
 
@@ -1100,7 +1100,7 @@
 		break;
 
 	case 'i':	/* bi - hardware instr breakpoint */
-		if (!(cur_cpu_spec->cpu_features & CPU_FTR_IABR)) {
+		if (!cpu_has_feature(CPU_FTR_IABR)) {
 			printf("Hardware instruction breakpoint "
 			       "not supported on this cpu\n");
 			break;
@@ -2498,7 +2498,7 @@
 
 void dump_segments(void)
 {
-	if (cur_cpu_spec->cpu_features & CPU_FTR_SLB)
+	if (cpu_has_feature(CPU_FTR_SLB))
 		dump_slb();
 	else
 		dump_stab();
diff -Nru a/arch/s390/Kconfig b/arch/s390/Kconfig
--- a/arch/s390/Kconfig	2005-01-11 16:42:35 -08:00
+++ b/arch/s390/Kconfig	2005-03-07 20:41:32 -08:00
@@ -84,12 +84,12 @@
 	  approximately sixteen kilobytes to the kernel image.
 
 config HOTPLUG_CPU
-	bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
-	depends on SMP && EXPERIMENTAL
+	bool "Support for hot-pluggable CPUs"
+	depends on SMP
 	select HOTPLUG
 	default n
 	help
-	  Say Y here to experiment with turning CPUs off and on.  CPUs
+	  Say Y here to be able to turn CPUs off and on. CPUs
 	  can be controlled through /sys/devices/system/cpu/cpu#.
 	  Say N if you want to disable CPU hotplug.
 
diff -Nru a/arch/s390/Makefile b/arch/s390/Makefile
--- a/arch/s390/Makefile	2004-12-02 23:25:43 -08:00
+++ b/arch/s390/Makefile	2005-03-07 20:41:32 -08:00
@@ -66,7 +66,7 @@
 cflags-$(CONFIG_WARN_STACK) += -mwarn-framesize=$(CONFIG_WARN_STACK_SIZE)
 endif
 
-CFLAGS		+= -mbackchain $(cflags-y)
+CFLAGS		+= -mbackchain -msoft-float $(cflags-y)
 CFLAGS		+= $(call cc-option,-finline-limit=10000)
 CFLAGS 		+= -pipe -fno-strength-reduce -Wno-sign-compare 
 AFLAGS		+= $(aflags-y)
diff -Nru a/arch/s390/defconfig b/arch/s390/defconfig
--- a/arch/s390/defconfig	2005-02-03 06:42:42 -08:00
+++ b/arch/s390/defconfig	2005-03-07 20:41:32 -08:00
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.11-rc2
-# Mon Jan 31 16:27:12 2005
+# Linux kernel version: 2.6.11
+# Wed Mar  2 16:57:55 2005
 #
 CONFIG_MMU=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
@@ -54,6 +54,7 @@
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
+CONFIG_STOP_MACHINE=y
 
 #
 # Base setup
@@ -67,7 +68,7 @@
 CONFIG_ARCH_S390_31=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=32
-# CONFIG_HOTPLUG_CPU is not set
+CONFIG_HOTPLUG_CPU=y
 CONFIG_MATHEMU=y
 
 #
@@ -419,6 +420,10 @@
 CONFIG_FS_MBCACHE=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
diff -Nru a/arch/s390/kernel/compat_ioctl.c b/arch/s390/kernel/compat_ioctl.c
--- a/arch/s390/kernel/compat_ioctl.c	2004-03-01 19:01:23 -08:00
+++ b/arch/s390/kernel/compat_ioctl.c	2005-03-07 20:41:38 -08:00
@@ -65,9 +65,6 @@
 COMPATIBLE_IOCTL(TAPE390_DISPLAY)
 #endif
 
-/* This one should be architecture independent */
-COMPATIBLE_IOCTL(TCSBRKP)
-
 /* s390 doesn't need handlers here */
 COMPATIBLE_IOCTL(TIOCGSERIAL)
 COMPATIBLE_IOCTL(TIOCSSERIAL)
diff -Nru a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
--- a/arch/s390/kernel/compat_wrapper.S	2005-02-03 06:42:43 -08:00
+++ b/arch/s390/kernel/compat_wrapper.S	2005-03-07 20:41:33 -08:00
@@ -1406,3 +1406,20 @@
 	llgtr	%r3,%r3			# struct compat_mq_attr *
 	llgtr	%r4,%r4			# struct compat_mq_attr *
 	jg	compat_sys_mq_getsetattr
+
+	.globl	compat_sys_add_key
+compat_sys_add_key:
+	llgtr	%r2,%r2			# const char *
+	llgtr	%r3,%r3			# const char *
+	llgtr	%r4,%r4			# const void *
+	llgfr	%r5,%r5			# size_t
+	llgfr	%r6,%r6			# (key_serial_t) u32
+	jg	sys_add_key
+
+	.globl	compat_sys_request_key
+compat_sys_request_key:
+	llgtr	%r2,%r2			# const char *
+	llgtr	%r3,%r3			# const char *
+	llgtr	%r4,%r4			# const void *
+	llgfr	%r5,%r5			# (key_serial_t) u32
+	jg	sys_request_key
diff -Nru a/arch/s390/kernel/irq.c b/arch/s390/kernel/irq.c
--- a/arch/s390/kernel/irq.c	2005-01-11 16:42:35 -08:00
+++ b/arch/s390/kernel/irq.c	2005-03-07 20:41:32 -08:00
@@ -25,9 +25,8 @@
 
 	if (i == 0) {
 		seq_puts(p, "           ");
-		for (j=0; j<NR_CPUS; j++)
-			if (cpu_online(j))
-				seq_printf(p, "CPU%d       ",j);
+		for_each_online_cpu(j)
+			seq_printf(p, "CPU%d       ",j);
 		seq_putc(p, '\n');
 	}
 
@@ -36,9 +35,8 @@
 #ifndef CONFIG_SMP
 		seq_printf(p, "%10u ", kstat_irqs(i));
 #else
-		for (j = 0; j < NR_CPUS; j++)
-			if (cpu_online(j))
-				seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
+		for_each_online_cpu(j)
+			seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
 #endif
                 seq_putc(p, '\n');
 
diff -Nru a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
--- a/arch/s390/kernel/smp.c	2005-01-20 21:02:10 -08:00
+++ b/arch/s390/kernel/smp.c	2005-03-07 20:41:32 -08:00
@@ -212,29 +212,29 @@
 
 static inline void do_send_stop(void)
 {
-        int i, rc;
+        int cpu, rc;
 
         /* stop all processors */
-        for (i =  0; i < NR_CPUS; i++) {
-                if (!cpu_online(i) || smp_processor_id() == i)
+	for_each_online_cpu(cpu) {
+		if (cpu == smp_processor_id())
 			continue;
 		do {
-			rc = signal_processor(i, sigp_stop);
+			rc = signal_processor(cpu, sigp_stop);
 		} while (rc == sigp_busy);
 	}
 }
 
 static inline void do_store_status(void)
 {
-        int i, rc;
+        int cpu, rc;
 
         /* store status of all processors in their lowcores (real 0) */
-        for (i =  0; i < NR_CPUS; i++) {
-                if (!cpu_online(i) || smp_processor_id() == i) 
+	for_each_online_cpu(cpu) {
+		if (cpu == smp_processor_id())
 			continue;
 		do {
 			rc = signal_processor_p(
-				(__u32)(unsigned long) lowcore_ptr[i], i,
+				(__u32)(unsigned long) lowcore_ptr[cpu], cpu,
 				sigp_store_status_at_address);
 		} while(rc == sigp_busy);
         }
@@ -259,37 +259,41 @@
 /*
  * Reboot, halt and power_off routines for SMP.
  */
-static cpumask_t cpu_restart_map;
 
 static void do_machine_restart(void * __unused)
 {
+	int cpu;
 	static atomic_t cpuid = ATOMIC_INIT(-1);
 
-	cpu_clear(smp_processor_id(), cpu_restart_map);
-	if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) {
-		/* Wait for all other cpus to enter do_machine_restart. */
-		while (!cpus_empty(cpu_restart_map))
+	if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid))
+		signal_processor(smp_processor_id(), sigp_stop);
+
+	/* Wait for all other cpus to enter stopped state */
+	for_each_online_cpu(cpu) {
+		if (cpu == smp_processor_id())
+			continue;
+		while(!smp_cpu_not_running(cpu))
 			cpu_relax();
-		/* Store status of other cpus. */
-		do_store_status();
-		/*
-		 * Finally call reipl. Because we waited for all other
-		 * cpus to enter this function we know that they do
-		 * not hold any s390irq-locks (the cpus have been
-		 * interrupted by an external interrupt and s390irq
-		 * locks are always held disabled).
-		 */
-		if (MACHINE_IS_VM)
-			cpcmd ("IPL", NULL, 0);
-		else
-			reipl (0x10000 | S390_lowcore.ipl_device);
 	}
-	signal_processor(smp_processor_id(), sigp_stop);
+
+	/* Store status of other cpus. */
+	do_store_status();
+
+	/*
+	 * Finally call reipl. Because we waited for all other
+	 * cpus to enter this function we know that they do
+	 * not hold any s390irq-locks (the cpus have been
+	 * interrupted by an external interrupt and s390irq
+	 * locks are always held disabled).
+	 */
+	if (MACHINE_IS_VM)
+		cpcmd ("IPL", NULL, 0);
+	else
+		reipl (0x10000 | S390_lowcore.ipl_device);
 }
 
 void machine_restart_smp(char * __unused) 
 {
-	cpu_restart_map = cpu_online_map;
         on_each_cpu(do_machine_restart, NULL, 0, 0);
 }
 
@@ -384,16 +388,16 @@
  */
 static void smp_ext_bitcall_others(ec_bit_sig sig)
 {
-        int i;
+        int cpu;
 
-        for (i = 0; i < NR_CPUS; i++) {
-                if (!cpu_online(i) || smp_processor_id() == i)
+	for_each_online_cpu(cpu) {
+		if (cpu == smp_processor_id())
                         continue;
                 /*
                  * Set signaling bit in lowcore of target cpu and kick it
                  */
-		set_bit(sig, (unsigned long *) &lowcore_ptr[i]->ext_call_fast);
-                while (signal_processor(i, sigp_external_call) == sigp_busy)
+		set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast);
+		while (signal_processor(cpu, sigp_external_call) == sigp_busy)
 			udelay(10);
         }
 }
@@ -497,7 +501,6 @@
 	 */
 
 	boot_cpu_addr = S390_lowcore.cpu_data.cpu_addr;
-	__cpu_logical_map[0] = boot_cpu_addr;
 	current_thread_info()->cpu = 0;
 	num_cpus = 1;
 	for (cpu = 0; cpu <= 65535 && num_cpus < max_cpus; cpu++) {
@@ -725,7 +728,7 @@
 __cpu_die(unsigned int cpu)
 {
 	/* Wait until target cpu is down */
-	while (!cpu_stopped(cpu))
+	while (!smp_cpu_not_running(cpu))
 		cpu_relax();
 	printk("Processor %d spun down\n", cpu);
 }
@@ -790,6 +793,7 @@
 	BUG_ON(smp_processor_id() != 0);
 
 	cpu_set(0, cpu_online_map);
+	cpu_set(0, cpu_present_map);
 	cpu_set(0, cpu_possible_map);
 	S390_lowcore.percpu_offset = __per_cpu_offset[0];
 	current_set[0] = current;
diff -Nru a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
--- a/arch/s390/kernel/syscalls.S	2005-01-14 11:56:05 -08:00
+++ b/arch/s390/kernel/syscalls.S	2005-03-07 20:41:33 -08:00
@@ -286,3 +286,6 @@
 SYSCALL(sys_mq_notify,sys_mq_notify,compat_sys_mq_notify_wrapper) /* 275 */
 SYSCALL(sys_mq_getsetattr,sys_mq_getsetattr,compat_sys_mq_getsetattr_wrapper)
 NI_SYSCALL							/* reserved for kexec */
+SYSCALL(sys_add_key,sys_add_key,compat_sys_add_key)
+SYSCALL(sys_request_key,sys_request_key,compat_sys_request_key)
+SYSCALL(sys_keyctl,sys_keyctl,compat_sys_keyctl)		/* 280 */
diff -Nru a/arch/s390/mm/init.c b/arch/s390/mm/init.c
--- a/arch/s390/mm/init.c	2005-01-03 15:49:38 -08:00
+++ b/arch/s390/mm/init.c	2005-02-23 15:40:52 -08:00
@@ -145,7 +145,7 @@
                 for (tmp = 0 ; tmp < PTRS_PER_PTE ; tmp++,pg_table++) {
                         pte = pfn_pte(pfn, PAGE_KERNEL);
                         if (pfn >= max_low_pfn)
-                                pte_clear(&pte);
+                                pte_clear(&init_mm, 0, &pte);
                         set_pte(pg_table, pte);
                         pfn++;
                 }
@@ -229,7 +229,7 @@
                         for (k = 0 ; k < PTRS_PER_PTE ; k++,pt_dir++) {
                                 pte = pfn_pte(pfn, PAGE_KERNEL);
                                 if (pfn >= max_low_pfn) {
-                                        pte_clear(&pte); 
+                                        pte_clear(&init_mm, 0, &pte); 
                                         continue;
                                 }
                                 set_pte(pt_dir, pte);
diff -Nru a/arch/sh/Kconfig b/arch/sh/Kconfig
--- a/arch/sh/Kconfig	2005-01-15 14:31:06 -08:00
+++ b/arch/sh/Kconfig	2005-03-07 20:41:28 -08:00
@@ -25,6 +25,14 @@
 config RWSEM_XCHGADD_ALGORITHM
 	bool
 
+config GENERIC_HARDIRQS
+	bool
+	default y
+
+config GENERIC_IRQ_PROBE
+	bool
+	default y
+
 config GENERIC_CALIBRATE_DELAY
 	bool
 	default y
@@ -754,7 +762,6 @@
 source "drivers/pci/hotplug/Kconfig"
 
 endmenu
-
 
 menu "Executable file formats"
 
diff -Nru a/arch/sh/Makefile b/arch/sh/Makefile
--- a/arch/sh/Makefile	2004-10-18 22:26:43 -07:00
+++ b/arch/sh/Makefile	2005-03-07 20:41:28 -08:00
@@ -31,6 +31,13 @@
 OBJCOPYFLAGS	:= -O binary -R .note -R .comment -R .stab -R .stabstr -S
 
 #
+# arch/sh/defconfig doesn't reflect any real hardware, and as such should
+# never be used by anyone. Use a board-specific defconfig that has a
+# reasonable chance of being current instead.
+#
+KBUILD_DEFCONFIG := rts7751r2d_defconfig
+
+#
 # Choosing incompatible machines durings configuration will result in
 # error messages during linking.
 #
diff -Nru a/arch/sh/boards/hp6xx/hp620/Makefile b/arch/sh/boards/hp6xx/hp620/Makefile
--- a/arch/sh/boards/hp6xx/hp620/Makefile	2004-03-01 19:01:46 -08:00
+++ b/arch/sh/boards/hp6xx/hp620/Makefile	2005-03-07 20:41:28 -08:00
@@ -2,5 +2,5 @@
 # Makefile for the HP620 specific parts of the kernel
 #
 
-obj-y	 := mach.o
+obj-y	 := mach.o setup.o
 
diff -Nru a/arch/sh/boards/hp6xx/hp620/setup.c b/arch/sh/boards/hp6xx/hp620/setup.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/sh/boards/hp6xx/hp620/setup.c	2005-03-07 20:41:28 -08:00
@@ -0,0 +1,45 @@
+/*
+ * linux/arch/sh/boards/hp6xx/hp620/setup.c
+ *
+ * Copyright (C) 2002 Andriy Skulysh, 2005 Kristoffer Ericson
+ *
+ * May be copied or modified under the terms of the GNU General Public
+ * License. See Linux/COPYING for more information.
+ *
+ * Setup code for an HP620.
+ * Due to similiarity with hp680/hp690 same inits are done (for now)
+ */
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <asm/hd64461/hd64461.h>
+#include <asm/io.h>
+#include <asm/hp6xx/hp6xx.h>
+#include <asm/cpu/dac.h>
+
+const char *get_system_type(void)
+{
+	return "HP620";
+}
+
+int __init platform_setup(void)
+{
+	u16 v;
+
+	v  = inw(HD64461_STBCR);
+	v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST  |
+	     HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
+	     HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
+	     HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST |
+	     HD64461_STBCR_SAFECKE_IST;
+	outw(v, HD64461_STBCR);
+
+	v  = inw(HD64461_GPADR);
+	v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
+	outw(v, HD64461_GPADR);
+
+	sh_dac_disable(DAC_SPEAKER_VOLUME);
+
+	return 0;
+}
+
diff -Nru a/arch/sh/boards/se/7300/io.c b/arch/sh/boards/se/7300/io.c
--- a/arch/sh/boards/se/7300/io.c	2004-06-24 01:56:11 -07:00
+++ b/arch/sh/boards/se/7300/io.c	2005-03-07 20:41:29 -08:00
@@ -1,12 +1,16 @@
 /*
- * linux/arch/sh/boards/se/7300/io.c
+ * arch/sh/boards/se/7300/io.c
  *
  * Copyright (C) 2003 YOSHII Takashi <yoshii-takashi@hitachi-ul.co.jp>
+ * Based on arch/sh/kernel/io_shmse.c
+ *
+ * I/O routine for SH-Mobile3 73180 SolutionEngine.
+ *
  */
 
 #include <linux/config.h>
 #include <linux/kernel.h>
-#include <asm/se7300/se7300.h>
+#include <asm/mach/se7300.h>
 #include <asm/io.h>
 
 #define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a)
diff -Nru a/arch/sh/boards/sh03/rtc.c b/arch/sh/boards/sh03/rtc.c
--- a/arch/sh/boards/sh03/rtc.c	2004-10-18 22:26:44 -07:00
+++ b/arch/sh/boards/sh03/rtc.c	2005-03-07 20:41:29 -08:00
@@ -115,8 +115,6 @@
 	real_minutes %= 60;
 
 	if (abs(real_minutes - cmos_minutes) < 30) {
-		BIN_TO_BCD(real_seconds);
-		BIN_TO_BCD(real_minutes);
 		ctrl_outb(real_seconds % 10, RTC_SEC1);
 		ctrl_outb(real_seconds / 10, RTC_SEC10);
 		ctrl_outb(real_minutes % 10, RTC_MIN1);
diff -Nru a/arch/sh/boards/snapgear/setup.c b/arch/sh/boards/snapgear/setup.c
--- a/arch/sh/boards/snapgear/setup.c	2004-01-19 10:04:57 -08:00
+++ b/arch/sh/boards/snapgear/setup.c	2005-03-07 20:41:29 -08:00
@@ -27,6 +27,7 @@
 #include <asm/mach/io.h>
 #include <asm/irq.h>
 #include <asm/io.h>
+#include <asm/cpu/timer.h>
 
 extern void (*board_time_init)(void);
 extern void secureedge5410_rtc_init(void);
@@ -111,11 +112,6 @@
 #endif
 #define TMU_TSTR_INIT	1
 #define TMU1_TCR_CALIB	0x0000
-#define TMU_TOCR	0xffd80000	/* Byte access */
-#define TMU_TSTR	0xffd80004	/* Byte access */
-#define TMU1_TCOR	0xffd80014	/* Long access */
-#define TMU1_TCNT	0xffd80018	/* Long access */
-#define TMU1_TCR	0xffd8001c	/* Word access */
 
 
 #ifdef FAST_POLL_INTR
diff -Nru a/arch/sh/configs/adx_defconfig b/arch/sh/configs/adx_defconfig
--- a/arch/sh/configs/adx_defconfig	2004-03-23 02:05:26 -08:00
+++ b/arch/sh/configs/adx_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,15 +1,46 @@
 #
-# Automatically generated by make menuconfig: don't edit
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:26 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
+CONFIG_CLEAN_COMPILE=y
+CONFIG_BROKEN_ON_SMP=y
+
+#
+# General setup
+#
+CONFIG_LOCALVERSION=""
+CONFIG_SWAP=y
+# CONFIG_SYSVIPC is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_SYSCTL is not set
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+# CONFIG_IKCONFIG is not set
+# CONFIG_EMBEDDED is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -17,10 +48,13 @@
 # CONFIG_MODULES is not set
 
 #
-# Processor type and features
+# System type
 #
 # CONFIG_SH_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SOLUTION_ENGINE is not set
+# CONFIG_SH_7300_SOLUTION_ENGINE is not set
+# CONFIG_SH_73180_SOLUTION_ENGINE is not set
+# CONFIG_SH_7751_SYSTEMH is not set
 # CONFIG_SH_STB1_HARP is not set
 # CONFIG_SH_STB1_OVERDRIVE is not set
 # CONFIG_SH_HP620 is not set
@@ -29,57 +63,115 @@
 # CONFIG_SH_CQREEK is not set
 # CONFIG_SH_DMIDA is not set
 # CONFIG_SH_EC3104 is not set
+# CONFIG_SH_SATURN is not set
 # CONFIG_SH_DREAMCAST is not set
 # CONFIG_SH_CAT68701 is not set
 # CONFIG_SH_BIGSUR is not set
 # CONFIG_SH_SH2000 is not set
 CONFIG_SH_ADX=y
+# CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
+# CONFIG_SH_SECUREEDGE5410 is not set
+# CONFIG_SH_HS7751RVOIP is not set
+# CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_EDOSK7705 is not set
+# CONFIG_SH_SH4202_MICRODEV is not set
 # CONFIG_SH_UNKNOWN is not set
-CONFIG_SH_RTC=y
+# CONFIG_CPU_SH2 is not set
+# CONFIG_CPU_SH3 is not set
+CONFIG_CPU_SH4=y
+# CONFIG_CPU_SUBTYPE_SH7604 is not set
+# CONFIG_CPU_SUBTYPE_SH7300 is not set
+# CONFIG_CPU_SUBTYPE_SH7705 is not set
 # CONFIG_CPU_SUBTYPE_SH7707 is not set
 # CONFIG_CPU_SUBTYPE_SH7708 is not set
 # CONFIG_CPU_SUBTYPE_SH7709 is not set
 CONFIG_CPU_SUBTYPE_SH7750=y
 # CONFIG_CPU_SUBTYPE_SH7751 is not set
+# CONFIG_CPU_SUBTYPE_SH7760 is not set
+# CONFIG_CPU_SUBTYPE_SH73180 is not set
 # CONFIG_CPU_SUBTYPE_ST40STB1 is not set
-# CONFIG_CPU_SH3 is not set
-CONFIG_CPU_SH4=y
-CONFIG_CPU_LITTLE_ENDIAN=y
+# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
+CONFIG_MMU=y
+# CONFIG_CMDLINE_BOOL is not set
 CONFIG_MEMORY_START=0x08000000
 CONFIG_MEMORY_SIZE=0x00400000
 CONFIG_MEMORY_SET=y
-# CONFIG_DISCONTIGMEM is not set
-
-#
-# General setup
-#
-CONFIG_ISA=y
-# CONFIG_EISA is not set
-# CONFIG_MCA is not set
-# CONFIG_SBUS is not set
-# CONFIG_NET is not set
+# CONFIG_MEMORY_OVERRIDE is not set
 CONFIG_CF_ENABLER=y
 # CONFIG_CF_AREA5 is not set
 CONFIG_CF_AREA6=y
 CONFIG_CF_BASE_ADDR=0xb8000000
-# CONFIG_HD64461 is not set
-# CONFIG_HD64465 is not set
+CONFIG_SH_RTC=y
+CONFIG_SH_FPU=y
+CONFIG_ZERO_PAGE_OFFSET=0x00001000
+CONFIG_BOOT_LINK_OFFSET=0x00800000
+CONFIG_CPU_LITTLE_ENDIAN=y
+# CONFIG_PREEMPT is not set
+# CONFIG_UBC_WAKEUP is not set
+# CONFIG_SH_WRITETHROUGH is not set
+# CONFIG_SH_OCRAM is not set
+# CONFIG_SH_STORE_QUEUES is not set
+# CONFIG_SMP is not set
+CONFIG_SH_PCLK_CALC=y
+CONFIG_SH_PCLK_FREQ=50000000
+
+#
+# CPU Frequency scaling
+#
+# CONFIG_CPU_FREQ is not set
+
+#
+# DMA support
+#
 # CONFIG_SH_DMA is not set
+
+#
+# Companion Chips
+#
+# CONFIG_HD6446X_SERIES is not set
+
+#
+# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
+#
 # CONFIG_PCI is not set
-# CONFIG_HOTPLUG is not set
-# CONFIG_PCMCIA is not set
-# CONFIG_SYSVIPC is not set
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_SYSCTL is not set
-CONFIG_KCORE_ELF=y
-# CONFIG_KCORE_AOUT is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+
+#
+# Executable file formats
+#
 CONFIG_BINFMT_ELF=y
+# CONFIG_BINFMT_FLAT is not set
 # CONFIG_BINFMT_MISC is not set
 
 #
-# Parallel port support
+# SH initrd options
+#
+# CONFIG_EMBEDDED_RAMDISK is not set
+
+#
+# Device Drivers
 #
-# CONFIG_PARPORT is not set
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -87,190 +179,361 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Plug and Play support
+#
+
+#
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_DEV_XD is not set
-# CONFIG_PARIDE is not set
-# CONFIG_BLK_CPQ_DA is not set
-# CONFIG_BLK_CPQ_CISS_DA is not set
-# CONFIG_CISS_SCSI_TAPE is not set
-# CONFIG_BLK_DEV_DAC960 is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
-# CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
 
 #
-# Multi-device support (RAID and LVM)
+# IO Schedulers
 #
-# CONFIG_MD is not set
-# CONFIG_BLK_DEV_MD is not set
-# CONFIG_MD_LINEAR is not set
-# CONFIG_MD_RAID0 is not set
-# CONFIG_MD_RAID1 is not set
-# CONFIG_MD_RAID5 is not set
-# CONFIG_MD_MULTIPATH is not set
-# CONFIG_BLK_DEV_LVM is not set
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 
 #
-# ATA/IDE/MFM/RLL support
+# ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
+CONFIG_IDE_MAX_HWIFS=4
+CONFIG_BLK_DEV_IDE=y
 
 #
-# IDE, ATA and ATAPI Block devices
+# Please see Documentation/ide.txt for help/info on IDE drives
 #
-CONFIG_BLK_DEV_IDE=y
-# CONFIG_BLK_DEV_HD_IDE is not set
-# CONFIG_BLK_DEV_HD is not set
+# CONFIG_BLK_DEV_IDE_SATA is not set
 CONFIG_BLK_DEV_IDEDISK=y
 # CONFIG_IDEDISK_MULTI_MODE is not set
-# CONFIG_BLK_DEV_IDEDISK_VENDOR is not set
-# CONFIG_BLK_DEV_IDEDISK_FUJITSU is not set
-# CONFIG_BLK_DEV_IDEDISK_IBM is not set
-# CONFIG_BLK_DEV_IDEDISK_MAXTOR is not set
-# CONFIG_BLK_DEV_IDEDISK_QUANTUM is not set
-# CONFIG_BLK_DEV_IDEDISK_SEAGATE is not set
-# CONFIG_BLK_DEV_IDEDISK_WD is not set
-# CONFIG_BLK_DEV_COMMERIAL is not set
-# CONFIG_BLK_DEV_TIVO is not set
-# CONFIG_BLK_DEV_IDECS is not set
 # CONFIG_BLK_DEV_IDECD is not set
 # CONFIG_BLK_DEV_IDETAPE is not set
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_BLK_DEV_CMD640 is not set
-# CONFIG_BLK_DEV_CMD640_ENHANCED is not set
-# CONFIG_BLK_DEV_ISAPNP is not set
-# CONFIG_IDE_CHIPSETS is not set
+# CONFIG_IDE_TASK_IOCTL is not set
+
+#
+# IDE chipset support/bugfixes
+#
+CONFIG_IDE_GENERIC=y
+CONFIG_IDE_SH=y
+# CONFIG_IDE_ARM is not set
+# CONFIG_BLK_DEV_IDEDMA is not set
 # CONFIG_IDEDMA_AUTO is not set
-# CONFIG_DMA_NONPCI is not set
-# CONFIG_BLK_DEV_ATARAID is not set
-# CONFIG_BLK_DEV_ATARAID_PDC is not set
-# CONFIG_BLK_DEV_ATARAID_HPT is not set
+# CONFIG_BLK_DEV_HD is not set
 
 #
-# SCSI support
+# SCSI device support
 #
 # CONFIG_SCSI is not set
 
 #
-# Old CD-ROM drivers (not SCSI, not IDE)
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# Fusion MPT device support
 #
-# CONFIG_CD_NO_IDESCSI is not set
 
 #
-# Input core support
+# IEEE 1394 (FireWire) support
+#
+
 #
-# CONFIG_INPUT is not set
-# CONFIG_INPUT_KEYBDEV is not set
-# CONFIG_INPUT_MOUSEDEV is not set
+# I2O device support
+#
+
+#
+# Networking support
+#
+# CONFIG_NET is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+
+#
+# ISDN subsystem
+#
+
+#
+# Telephony Support
+#
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
 # CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+CONFIG_SERIO=y
+CONFIG_SERIO_I8042=y
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_CT82C710 is not set
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
 
 #
 # Character devices
 #
-# CONFIG_VT is not set
-# CONFIG_SERIAL is not set
-CONFIG_SH_SCI=y
-CONFIG_SERIAL_CONSOLE=y
-# CONFIG_UNIX98_PTYS is not set
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_SH_SCI is not set
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
 
 #
-# Joysticks
+# IPMI
 #
-# CONFIG_INPUT_GAMEPORT is not set
-# CONFIG_PSMOUSE is not set
+# CONFIG_IPMI_HANDLER is not set
 
 #
 # Watchdog Cards
 #
 # CONFIG_WATCHDOG is not set
 # CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+
+#
+# Ftape, the floppy tape device driver
+#
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
+
+#
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
+# Misc devices
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Console display driver support
+#
+CONFIG_VGA_CONSOLE=y
+CONFIG_DUMMY_CONSOLE=y
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
 
 #
 # File systems
 #
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_JBD is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_PROC_INFO is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+# CONFIG_PROC_KCORE is not set
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+# CONFIG_TMPFS is not set
+# CONFIG_HUGETLBFS is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
 # CONFIG_ADFS_FS is not set
-# CONFIG_ADFS_FS_RW is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_JBD is not set
-# CONFIG_JBD_DEBUG is not set
-# CONFIG_FAT_FS is not set
-# CONFIG_MSDOS_FS is not set
-# CONFIG_UMSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_JFFS_FS is not set
-# CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
-# CONFIG_TMPFS is not set
-CONFIG_RAMFS=y
-# CONFIG_ISO9660_FS is not set
-# CONFIG_JOLIET is not set
-# CONFIG_ZISOFS is not set
-# CONFIG_MINIX_FS is not set
 # CONFIG_VXFS_FS is not set
-# CONFIG_NTFS_FS is not set
-# CONFIG_NTFS_RW is not set
 # CONFIG_HPFS_FS is not set
-CONFIG_PROC_FS=y
-# CONFIG_DEVFS_FS is not set
-# CONFIG_DEVFS_MOUNT is not set
-# CONFIG_DEVFS_DEBUG is not set
-# CONFIG_DEVPTS_FS is not set
 # CONFIG_QNX4FS_FS is not set
-# CONFIG_QNX4FS_RW is not set
-# CONFIG_ROMFS_FS is not set
-CONFIG_EXT2_FS=y
 # CONFIG_SYSV_FS is not set
-# CONFIG_UDF_FS is not set
-# CONFIG_UDF_RW is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_UFS_FS_WRITE is not set
-# CONFIG_NCPFS_NLS is not set
-# CONFIG_SMB_FS is not set
-# CONFIG_ZISOFS_FS is not set
-# CONFIG_ZLIB_FS_INFLATE is not set
 
 #
 # Partition Types
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-# CONFIG_SMB_NLS is not set
-# CONFIG_NLS is not set
 
 #
-# Multimedia devices
+# Native Language Support
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_NLS is not set
 
 #
-# Sound
+# Profiling support
 #
-# CONFIG_SOUND is not set
+# CONFIG_PROFILING is not set
 
 #
 # Kernel hacking
 #
-# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_FRAME_POINTER is not set
 CONFIG_SH_STANDARD_BIOS=y
-CONFIG_SH_EARLY_PRINTK=y
+# CONFIG_EARLY_SCIF_CONSOLE is not set
+# CONFIG_EARLY_PRINTK is not set
+# CONFIG_KGDB is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Hardware crypto devices
+#
 
 #
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 # CONFIG_CRC32 is not set
+# CONFIG_LIBCRC32C is not set
diff -Nru a/arch/sh/configs/cqreek_defconfig b/arch/sh/configs/cqreek_defconfig
--- a/arch/sh/configs/cqreek_defconfig	2004-03-23 02:05:26 -08:00
+++ b/arch/sh/configs/cqreek_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,15 +1,46 @@
 #
-# Automatically generated by make menuconfig: don't edit
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:38 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
+CONFIG_CLEAN_COMPILE=y
+CONFIG_BROKEN_ON_SMP=y
+
+#
+# General setup
+#
+CONFIG_LOCALVERSION=""
+CONFIG_SWAP=y
+# CONFIG_SYSVIPC is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_SYSCTL is not set
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+# CONFIG_IKCONFIG is not set
+# CONFIG_EMBEDDED is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -17,10 +48,13 @@
 # CONFIG_MODULES is not set
 
 #
-# Processor type and features
+# System type
 #
 # CONFIG_SH_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SOLUTION_ENGINE is not set
+# CONFIG_SH_7300_SOLUTION_ENGINE is not set
+# CONFIG_SH_73180_SOLUTION_ENGINE is not set
+# CONFIG_SH_7751_SYSTEMH is not set
 # CONFIG_SH_STB1_HARP is not set
 # CONFIG_SH_STB1_OVERDRIVE is not set
 # CONFIG_SH_HP620 is not set
@@ -29,55 +63,110 @@
 CONFIG_SH_CQREEK=y
 # CONFIG_SH_DMIDA is not set
 # CONFIG_SH_EC3104 is not set
+# CONFIG_SH_SATURN is not set
 # CONFIG_SH_DREAMCAST is not set
 # CONFIG_SH_CAT68701 is not set
 # CONFIG_SH_BIGSUR is not set
 # CONFIG_SH_SH2000 is not set
 # CONFIG_SH_ADX is not set
+# CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
+# CONFIG_SH_SECUREEDGE5410 is not set
+# CONFIG_SH_HS7751RVOIP is not set
+# CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_EDOSK7705 is not set
+# CONFIG_SH_SH4202_MICRODEV is not set
 # CONFIG_SH_UNKNOWN is not set
-CONFIG_SH_RTC=y
+# CONFIG_CPU_SH2 is not set
+CONFIG_CPU_SH3=y
+# CONFIG_CPU_SH4 is not set
+# CONFIG_CPU_SUBTYPE_SH7604 is not set
+# CONFIG_CPU_SUBTYPE_SH7300 is not set
+# CONFIG_CPU_SUBTYPE_SH7705 is not set
 # CONFIG_CPU_SUBTYPE_SH7707 is not set
 CONFIG_CPU_SUBTYPE_SH7708=y
 # CONFIG_CPU_SUBTYPE_SH7709 is not set
 # CONFIG_CPU_SUBTYPE_SH7750 is not set
 # CONFIG_CPU_SUBTYPE_SH7751 is not set
+# CONFIG_CPU_SUBTYPE_SH7760 is not set
+# CONFIG_CPU_SUBTYPE_SH73180 is not set
 # CONFIG_CPU_SUBTYPE_ST40STB1 is not set
-CONFIG_CPU_SH3=y
-# CONFIG_CPU_SH4 is not set
-CONFIG_CPU_LITTLE_ENDIAN=y
+# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
+CONFIG_MMU=y
+# CONFIG_CMDLINE_BOOL is not set
 CONFIG_MEMORY_START=0x0c000000
 CONFIG_MEMORY_SIZE=0x00400000
-# CONFIG_DISCONTIGMEM is not set
+# CONFIG_MEMORY_OVERRIDE is not set
+CONFIG_SH_RTC=y
+CONFIG_SH_DSP=y
+CONFIG_SH_ADC=y
+CONFIG_ZERO_PAGE_OFFSET=0x00001000
+CONFIG_BOOT_LINK_OFFSET=0x00800000
+CONFIG_CPU_LITTLE_ENDIAN=y
+# CONFIG_PREEMPT is not set
+# CONFIG_UBC_WAKEUP is not set
+# CONFIG_SH_WRITETHROUGH is not set
+# CONFIG_SH_OCRAM is not set
+# CONFIG_SMP is not set
+CONFIG_SH_PCLK_CALC=y
+CONFIG_SH_PCLK_FREQ=1193182
 
 #
-# General setup
+# CPU Frequency scaling
+#
+# CONFIG_CPU_FREQ is not set
+
+#
+# DMA support
 #
-CONFIG_ISA=y
-# CONFIG_EISA is not set
-# CONFIG_MCA is not set
-# CONFIG_SBUS is not set
-# CONFIG_NET is not set
-# CONFIG_CF_AREA5 is not set
-CONFIG_CF_AREA6=y
-CONFIG_CF_BASE_ADDR=0xb8000000
-# CONFIG_HD64461 is not set
-# CONFIG_HD64465 is not set
 # CONFIG_SH_DMA is not set
+
+#
+# Companion Chips
+#
+# CONFIG_HD6446X_SERIES is not set
+
+#
+# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
+#
 # CONFIG_PCI is not set
-# CONFIG_HOTPLUG is not set
-# CONFIG_PCMCIA is not set
-# CONFIG_SYSVIPC is not set
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_SYSCTL is not set
-CONFIG_KCORE_ELF=y
-# CONFIG_KCORE_AOUT is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+
+#
+# Executable file formats
+#
 CONFIG_BINFMT_ELF=y
+# CONFIG_BINFMT_FLAT is not set
 # CONFIG_BINFMT_MISC is not set
 
 #
-# Parallel port support
+# SH initrd options
 #
-# CONFIG_PARPORT is not set
+# CONFIG_EMBEDDED_RAMDISK is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -85,190 +174,360 @@
 # CONFIG_MTD is not set
 
 #
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Plug and Play support
+#
+
+#
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_DEV_XD is not set
-# CONFIG_PARIDE is not set
-# CONFIG_BLK_CPQ_DA is not set
-# CONFIG_BLK_CPQ_CISS_DA is not set
-# CONFIG_CISS_SCSI_TAPE is not set
-# CONFIG_BLK_DEV_DAC960 is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
-# CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
 
 #
-# Multi-device support (RAID and LVM)
+# IO Schedulers
 #
-# CONFIG_MD is not set
-# CONFIG_BLK_DEV_MD is not set
-# CONFIG_MD_LINEAR is not set
-# CONFIG_MD_RAID0 is not set
-# CONFIG_MD_RAID1 is not set
-# CONFIG_MD_RAID5 is not set
-# CONFIG_MD_MULTIPATH is not set
-# CONFIG_BLK_DEV_LVM is not set
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 
 #
-# ATA/IDE/MFM/RLL support
+# ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
+CONFIG_IDE_MAX_HWIFS=4
+CONFIG_BLK_DEV_IDE=y
 
 #
-# IDE, ATA and ATAPI Block devices
+# Please see Documentation/ide.txt for help/info on IDE drives
 #
-CONFIG_BLK_DEV_IDE=y
-# CONFIG_BLK_DEV_HD_IDE is not set
-# CONFIG_BLK_DEV_HD is not set
+# CONFIG_BLK_DEV_IDE_SATA is not set
 CONFIG_BLK_DEV_IDEDISK=y
 # CONFIG_IDEDISK_MULTI_MODE is not set
-# CONFIG_BLK_DEV_IDEDISK_VENDOR is not set
-# CONFIG_BLK_DEV_IDEDISK_FUJITSU is not set
-# CONFIG_BLK_DEV_IDEDISK_IBM is not set
-# CONFIG_BLK_DEV_IDEDISK_MAXTOR is not set
-# CONFIG_BLK_DEV_IDEDISK_QUANTUM is not set
-# CONFIG_BLK_DEV_IDEDISK_SEAGATE is not set
-# CONFIG_BLK_DEV_IDEDISK_WD is not set
-# CONFIG_BLK_DEV_COMMERIAL is not set
-# CONFIG_BLK_DEV_TIVO is not set
-# CONFIG_BLK_DEV_IDECS is not set
 # CONFIG_BLK_DEV_IDECD is not set
 # CONFIG_BLK_DEV_IDETAPE is not set
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_BLK_DEV_CMD640 is not set
-# CONFIG_BLK_DEV_CMD640_ENHANCED is not set
-# CONFIG_BLK_DEV_ISAPNP is not set
-# CONFIG_IDE_CHIPSETS is not set
+# CONFIG_IDE_TASK_IOCTL is not set
+
+#
+# IDE chipset support/bugfixes
+#
+CONFIG_IDE_GENERIC=y
+CONFIG_IDE_SH=y
+# CONFIG_IDE_ARM is not set
+# CONFIG_BLK_DEV_IDEDMA is not set
 # CONFIG_IDEDMA_AUTO is not set
-# CONFIG_DMA_NONPCI is not set
-# CONFIG_BLK_DEV_ATARAID is not set
-# CONFIG_BLK_DEV_ATARAID_PDC is not set
-# CONFIG_BLK_DEV_ATARAID_HPT is not set
+# CONFIG_BLK_DEV_HD is not set
 
 #
-# SCSI support
+# SCSI device support
 #
 # CONFIG_SCSI is not set
 
 #
-# Old CD-ROM drivers (not SCSI, not IDE)
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# Fusion MPT device support
+#
+
+#
+# IEEE 1394 (FireWire) support
+#
+
+#
+# I2O device support
+#
+
+#
+# Networking support
+#
+# CONFIG_NET is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+
+#
+# ISDN subsystem
+#
+
+#
+# Telephony Support
+#
+# CONFIG_PHONE is not set
+
+#
+# Input device support
 #
-# CONFIG_CD_NO_IDESCSI is not set
+CONFIG_INPUT=y
 
 #
-# Input core support
+# Userland interfaces
 #
-# CONFIG_INPUT is not set
-# CONFIG_INPUT_KEYBDEV is not set
-# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
 # CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+CONFIG_SERIO=y
+CONFIG_SERIO_I8042=y
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_CT82C710 is not set
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
 
 #
 # Character devices
 #
-# CONFIG_VT is not set
-# CONFIG_SERIAL is not set
-CONFIG_SH_SCI=y
-CONFIG_SERIAL_CONSOLE=y
-# CONFIG_UNIX98_PTYS is not set
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
 
 #
-# Joysticks
+# Non-8250 serial port support
 #
-# CONFIG_INPUT_GAMEPORT is not set
-# CONFIG_PSMOUSE is not set
+# CONFIG_SERIAL_SH_SCI is not set
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
 
 #
 # Watchdog Cards
 #
 # CONFIG_WATCHDOG is not set
 # CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+
+#
+# Ftape, the floppy tape device driver
+#
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
+
+#
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
+# Misc devices
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Console display driver support
+#
+CONFIG_VGA_CONSOLE=y
+CONFIG_DUMMY_CONSOLE=y
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
 
 #
 # File systems
 #
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_JBD is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_PROC_INFO is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+# CONFIG_PROC_KCORE is not set
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+# CONFIG_TMPFS is not set
+# CONFIG_HUGETLBFS is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
 # CONFIG_ADFS_FS is not set
-# CONFIG_ADFS_FS_RW is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_JBD is not set
-# CONFIG_JBD_DEBUG is not set
-# CONFIG_FAT_FS is not set
-# CONFIG_MSDOS_FS is not set
-# CONFIG_UMSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_JFFS_FS is not set
-# CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
-# CONFIG_TMPFS is not set
-CONFIG_RAMFS=y
-# CONFIG_ISO9660_FS is not set
-# CONFIG_JOLIET is not set
-# CONFIG_ZISOFS is not set
-# CONFIG_MINIX_FS is not set
 # CONFIG_VXFS_FS is not set
-# CONFIG_NTFS_FS is not set
-# CONFIG_NTFS_RW is not set
 # CONFIG_HPFS_FS is not set
-CONFIG_PROC_FS=y
-# CONFIG_DEVFS_FS is not set
-# CONFIG_DEVFS_MOUNT is not set
-# CONFIG_DEVFS_DEBUG is not set
-# CONFIG_DEVPTS_FS is not set
 # CONFIG_QNX4FS_FS is not set
-# CONFIG_QNX4FS_RW is not set
-# CONFIG_ROMFS_FS is not set
-CONFIG_EXT2_FS=y
 # CONFIG_SYSV_FS is not set
-# CONFIG_UDF_FS is not set
-# CONFIG_UDF_RW is not set
 # CONFIG_UFS_FS is not set
-# CONFIG_UFS_FS_WRITE is not set
-# CONFIG_NCPFS_NLS is not set
-# CONFIG_SMB_FS is not set
-# CONFIG_ZISOFS_FS is not set
-# CONFIG_ZLIB_FS_INFLATE is not set
 
 #
 # Partition Types
 #
 # CONFIG_PARTITION_ADVANCED is not set
 CONFIG_MSDOS_PARTITION=y
-# CONFIG_SMB_NLS is not set
-# CONFIG_NLS is not set
 
 #
-# Multimedia devices
+# Native Language Support
 #
-# CONFIG_VIDEO_DEV is not set
+# CONFIG_NLS is not set
 
 #
-# Sound
+# Profiling support
 #
-# CONFIG_SOUND is not set
+# CONFIG_PROFILING is not set
 
 #
 # Kernel hacking
 #
-# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_FRAME_POINTER is not set
 CONFIG_SH_STANDARD_BIOS=y
-CONFIG_SH_EARLY_PRINTK=y
+# CONFIG_EARLY_PRINTK is not set
+# CONFIG_KGDB is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Hardware crypto devices
+#
 
 #
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 # CONFIG_CRC32 is not set
+# CONFIG_LIBCRC32C is not set
diff -Nru a/arch/sh/configs/dreamcast_defconfig b/arch/sh/configs/dreamcast_defconfig
--- a/arch/sh/configs/dreamcast_defconfig	2004-08-09 16:41:37 -07:00
+++ b/arch/sh/configs/dreamcast_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,36 +1,50 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:40 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
-# CONFIG_STANDALONE is not set
 CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
+CONFIG_KOBJECT_UEVENT=y
 # CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -40,6 +54,7 @@
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
 
 #
@@ -47,6 +62,8 @@
 #
 # CONFIG_SH_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SOLUTION_ENGINE is not set
+# CONFIG_SH_7300_SOLUTION_ENGINE is not set
+# CONFIG_SH_73180_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SYSTEMH is not set
 # CONFIG_SH_STB1_HARP is not set
 # CONFIG_SH_STB1_OVERDRIVE is not set
@@ -63,20 +80,29 @@
 # CONFIG_SH_SH2000 is not set
 # CONFIG_SH_ADX is not set
 # CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
 # CONFIG_SH_SECUREEDGE5410 is not set
+# CONFIG_SH_HS7751RVOIP is not set
+# CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_EDOSK7705 is not set
+# CONFIG_SH_SH4202_MICRODEV is not set
 # CONFIG_SH_UNKNOWN is not set
 # CONFIG_CPU_SH2 is not set
 # CONFIG_CPU_SH3 is not set
 CONFIG_CPU_SH4=y
 # CONFIG_CPU_SUBTYPE_SH7604 is not set
 # CONFIG_CPU_SUBTYPE_SH7300 is not set
+# CONFIG_CPU_SUBTYPE_SH7705 is not set
 # CONFIG_CPU_SUBTYPE_SH7707 is not set
 # CONFIG_CPU_SUBTYPE_SH7708 is not set
 # CONFIG_CPU_SUBTYPE_SH7709 is not set
 CONFIG_CPU_SUBTYPE_SH7750=y
 # CONFIG_CPU_SUBTYPE_SH7751 is not set
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
+# CONFIG_CPU_SUBTYPE_SH73180 is not set
 # CONFIG_CPU_SUBTYPE_ST40STB1 is not set
+# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
 CONFIG_MMU=y
 CONFIG_HUGETLB_PAGE_SIZE_64K=y
 # CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
@@ -85,6 +111,7 @@
 CONFIG_MEMORY_SIZE=0x01000000
 CONFIG_MEMORY_SET=y
 # CONFIG_MEMORY_OVERRIDE is not set
+CONFIG_SH_FPU=y
 CONFIG_ZERO_PAGE_OFFSET=0x00001000
 CONFIG_BOOT_LINK_OFFSET=0x00800000
 CONFIG_CPU_LITTLE_ENDIAN=y
@@ -94,25 +121,36 @@
 CONFIG_SH_OCRAM=y
 CONFIG_SH_STORE_QUEUES=y
 # CONFIG_SMP is not set
+CONFIG_SH_PCLK_CALC=y
 CONFIG_SH_PCLK_FREQ=49876504
 
 #
 # CPU Frequency scaling
 #
 CONFIG_CPU_FREQ=y
-# CONFIG_CPU_FREQ_PROC_INTF is not set
+# CONFIG_CPU_FREQ_DEBUG is not set
+CONFIG_CPU_FREQ_STAT=y
+# CONFIG_CPU_FREQ_STAT_DETAILS is not set
 CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
 # CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
 CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
 CONFIG_CPU_FREQ_GOV_POWERSAVE=y
 CONFIG_CPU_FREQ_GOV_USERSPACE=y
-# CONFIG_CPU_FREQ_24_API is not set
+# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
 CONFIG_CPU_FREQ_TABLE=y
 CONFIG_SH_CPU_FREQ=y
+
+#
+# DMA support
+#
 CONFIG_SH_DMA=y
 CONFIG_NR_ONCHIP_DMA_CHANNELS=4
 CONFIG_NR_DMA_CHANNELS_BOOL=y
 CONFIG_NR_DMA_CHANNELS=9
+
+#
+# Companion Chips
+#
 # CONFIG_HD6446X_SERIES is not set
 
 #
@@ -126,9 +164,13 @@
 CONFIG_PCI_NAMES=y
 
 #
-# PCMCIA/CardBus support
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
 #
-# CONFIG_PCMCIA is not set
 
 #
 # PCI Hotplug Support
@@ -143,12 +185,19 @@
 # CONFIG_BINFMT_MISC is not set
 
 #
+# SH initrd options
+#
+# CONFIG_EMBEDDED_RAMDISK is not set
+
+#
 # Device Drivers
 #
 
 #
 # Generic Driver Options
 #
+# CONFIG_STANDALONE is not set
+CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
 
 #
@@ -173,12 +222,26 @@
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=1024
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -210,10 +273,6 @@
 # CONFIG_I2O is not set
 
 #
-# Macintosh device drivers
-#
-
-#
 # Networking support
 #
 CONFIG_NET=y
@@ -236,23 +295,24 @@
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_ARPD is not set
-# CONFIG_INET_ECN is not set
 # CONFIG_SYN_COOKIES is not set
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -261,27 +321,32 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
 #
 # CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
 
 #
 # ARCnet devices
 #
 # CONFIG_ARCNET is not set
-# CONFIG_DUMMY is not set
-# CONFIG_BONDING is not set
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
 
 #
 # Ethernet (10 or 100Mbit)
@@ -292,6 +357,7 @@
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_SMC91X is not set
 
 #
 # Tulip family network device support
@@ -316,7 +382,6 @@
 # CONFIG_8139TOO_TUNE_TWISTER is not set
 # CONFIG_8139TOO_8129 is not set
 # CONFIG_8139_OLD_RX_RESET is not set
-CONFIG_8139_RXBUF_IDX=1
 # CONFIG_SIS900 is not set
 # CONFIG_EPIC100 is not set
 # CONFIG_SUNDANCE is not set
@@ -333,50 +398,36 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 
 #
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
@@ -415,6 +466,8 @@
 # CONFIG_SERIO_SERPORT is not set
 # CONFIG_SERIO_CT82C710 is not set
 # CONFIG_SERIO_PCIPS2 is not set
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
 
 #
 # Input Device Drivers
@@ -422,6 +475,7 @@
 CONFIG_INPUT_KEYBOARD=y
 CONFIG_KEYBOARD_ATKBD=y
 # CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
 # CONFIG_KEYBOARD_XTKBD is not set
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_MAPLE is not set
@@ -429,6 +483,7 @@
 CONFIG_MOUSE_PS2=y
 # CONFIG_MOUSE_SERIAL is not set
 # CONFIG_MOUSE_MAPLE is not set
+# CONFIG_MOUSE_VSXXXAA is not set
 # CONFIG_INPUT_JOYSTICK is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
@@ -458,12 +513,6 @@
 CONFIG_LEGACY_PTY_COUNT=256
 
 #
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
-# CONFIG_QIC02_TAPE is not set
-
-#
 # IPMI
 #
 # CONFIG_IPMI_HANDLER is not set
@@ -485,7 +534,6 @@
 #
 # CONFIG_PCIPCWATCHDOG is not set
 # CONFIG_WDTPCI is not set
-# CONFIG_NVRAM is not set
 # CONFIG_RTC is not set
 # CONFIG_GEN_RTC is not set
 # CONFIG_DTLK is not set
@@ -495,8 +543,6 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_FTAPE is not set
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
 
@@ -506,6 +552,11 @@
 # CONFIG_I2C is not set
 
 #
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
 # Misc devices
 #
 
@@ -523,18 +574,22 @@
 # Graphics support
 #
 CONFIG_FB=y
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+# CONFIG_FB_CIRRUS is not set
 # CONFIG_FB_PM2 is not set
 # CONFIG_FB_CYBER2000 is not set
 # CONFIG_FB_ASILIANT is not set
 # CONFIG_FB_IMSTT is not set
 CONFIG_FB_PVR2=y
-# CONFIG_FB_E1355 is not set
+# CONFIG_FB_EPSON1355 is not set
 # CONFIG_FB_RIVA is not set
 # CONFIG_FB_MATROX is not set
 # CONFIG_FB_RADEON_OLD is not set
 # CONFIG_FB_RADEON is not set
 # CONFIG_FB_ATY128 is not set
 # CONFIG_FB_ATY is not set
+# CONFIG_FB_SAVAGE is not set
 # CONFIG_FB_SIS is not set
 # CONFIG_FB_NEOMAGIC is not set
 # CONFIG_FB_KYRO is not set
@@ -547,10 +602,8 @@
 # Console display driver support
 #
 # CONFIG_VGA_CONSOLE is not set
-# CONFIG_MDA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
 CONFIG_FONTS=y
 CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
@@ -571,6 +624,7 @@
 # CONFIG_LOGO_SUPERH_MONO is not set
 # CONFIG_LOGO_SUPERH_VGA16 is not set
 CONFIG_LOGO_SUPERH_CLUT224=y
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
 # Sound
@@ -581,6 +635,12 @@
 # USB support
 #
 # CONFIG_USB is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 
 #
 # USB Gadget Support
@@ -588,10 +648,14 @@
 # CONFIG_USB_GADGET is not set
 
 #
-# Maple Bus input peripherals
+# MMC/SD Card support
 #
-# CONFIG_MAPLE_KEYBOARD is not set
-# CONFIG_MAPLE_MOUSE is not set
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
 
 #
 # File systems
@@ -601,10 +665,15 @@
 # CONFIG_JBD is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 CONFIG_ROMFS_FS=y
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -617,7 +686,8 @@
 #
 # DOS/FAT/NT Filesystems
 #
-# CONFIG_FAT_FS is not set
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
 # CONFIG_NTFS_FS is not set
 
 #
@@ -625,11 +695,13 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 CONFIG_DEVFS_FS=y
 CONFIG_DEVFS_MOUNT=y
 # CONFIG_DEVFS_DEBUG is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
 CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
 CONFIG_RAMFS=y
@@ -662,9 +734,9 @@
 CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
-# CONFIG_EXPORTFS is not set
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -691,15 +763,17 @@
 #
 # Kernel hacking
 #
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_KERNEL is not set
+CONFIG_DEBUG_PREEMPT=y
+# CONFIG_FRAME_POINTER is not set
 # CONFIG_SH_STANDARD_BIOS is not set
+# CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_KGDB is not set
-# CONFIG_FRAME_POINTER is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -708,7 +782,13 @@
 # CONFIG_CRYPTO is not set
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
diff -Nru a/arch/sh/configs/hp680_defconfig b/arch/sh/configs/hp680_defconfig
--- a/arch/sh/configs/hp680_defconfig	2004-03-23 02:05:26 -08:00
+++ b/arch/sh/configs/hp680_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,36 +1,47 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:41 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
 # CONFIG_CLEAN_COMPILE is not set
-# CONFIG_STANDALONE is not set
 CONFIG_BROKEN=y
 CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 # CONFIG_SYSVIPC is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_SYSCTL is not set
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -42,6 +53,8 @@
 #
 # CONFIG_SH_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SOLUTION_ENGINE is not set
+# CONFIG_SH_7300_SOLUTION_ENGINE is not set
+# CONFIG_SH_73180_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SYSTEMH is not set
 # CONFIG_SH_STB1_HARP is not set
 # CONFIG_SH_STB1_OVERDRIVE is not set
@@ -58,20 +71,29 @@
 # CONFIG_SH_SH2000 is not set
 # CONFIG_SH_ADX is not set
 # CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
 # CONFIG_SH_SECUREEDGE5410 is not set
+# CONFIG_SH_HS7751RVOIP is not set
+# CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_EDOSK7705 is not set
+# CONFIG_SH_SH4202_MICRODEV is not set
 # CONFIG_SH_UNKNOWN is not set
 # CONFIG_CPU_SH2 is not set
 CONFIG_CPU_SH3=y
 # CONFIG_CPU_SH4 is not set
 # CONFIG_CPU_SUBTYPE_SH7604 is not set
 # CONFIG_CPU_SUBTYPE_SH7300 is not set
+# CONFIG_CPU_SUBTYPE_SH7705 is not set
 # CONFIG_CPU_SUBTYPE_SH7707 is not set
 # CONFIG_CPU_SUBTYPE_SH7708 is not set
 CONFIG_CPU_SUBTYPE_SH7709=y
 # CONFIG_CPU_SUBTYPE_SH7750 is not set
 # CONFIG_CPU_SUBTYPE_SH7751 is not set
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
+# CONFIG_CPU_SUBTYPE_SH73180 is not set
 # CONFIG_CPU_SUBTYPE_ST40STB1 is not set
+# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
 CONFIG_MMU=y
 # CONFIG_CMDLINE_BOOL is not set
 CONFIG_MEMORY_START=0x0c000000
@@ -80,6 +102,7 @@
 # CONFIG_MEMORY_OVERRIDE is not set
 CONFIG_SH_RTC=y
 # CONFIG_SH_DSP is not set
+CONFIG_SH_ADC=y
 CONFIG_SH_HP600=y
 CONFIG_ZERO_PAGE_OFFSET=0x00001000
 CONFIG_BOOT_LINK_OFFSET=0x00800000
@@ -89,9 +112,22 @@
 # CONFIG_SH_WRITETHROUGH is not set
 # CONFIG_SH_OCRAM is not set
 # CONFIG_SMP is not set
+CONFIG_SH_PCLK_CALC=y
 CONFIG_SH_PCLK_FREQ=1193182
+
+#
+# CPU Frequency scaling
+#
 # CONFIG_CPU_FREQ is not set
+
+#
+# DMA support
+#
 # CONFIG_SH_DMA is not set
+
+#
+# Companion Chips
+#
 CONFIG_HD6446X_SERIES=y
 CONFIG_HD64461=y
 # CONFIG_HD64465 is not set
@@ -102,7 +138,19 @@
 # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
 #
 # CONFIG_PCI is not set
-# CONFIG_HOTPLUG is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
 
 #
 # Executable file formats
@@ -112,8 +160,20 @@
 # CONFIG_BINFMT_MISC is not set
 
 #
+# SH initrd options
+#
+# CONFIG_EMBEDDED_RAMDISK is not set
+
+#
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
+# CONFIG_STANDALONE is not set
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -126,40 +186,57 @@
 # CONFIG_PARPORT is not set
 
 #
+# Plug and Play support
+#
+
+#
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 
 #
 # ATA/ATAPI/MFM/RLL support
 #
 CONFIG_IDE=y
+CONFIG_IDE_MAX_HWIFS=4
 CONFIG_BLK_DEV_IDE=y
 
 #
 # Please see Documentation/ide.txt for help/info on IDE drives
 #
+# CONFIG_BLK_DEV_IDE_SATA is not set
 CONFIG_BLK_DEV_IDEDISK=y
 # CONFIG_IDEDISK_MULTI_MODE is not set
-# CONFIG_IDEDISK_STROKE is not set
 # CONFIG_BLK_DEV_IDECD is not set
 # CONFIG_BLK_DEV_IDETAPE is not set
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
 # CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
 
 #
 # IDE chipset support/bugfixes
 #
 CONFIG_IDE_GENERIC=y
+CONFIG_IDE_SH=y
+# CONFIG_IDE_ARM is not set
 # CONFIG_BLK_DEV_IDEDMA is not set
 # CONFIG_IDEDMA_AUTO is not set
-# CONFIG_DMA_NONPCI is not set
 # CONFIG_BLK_DEV_HD is not set
 
 #
@@ -173,19 +250,24 @@
 # CONFIG_MD is not set
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# Fusion MPT device support
+#
+
+#
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
 #
-# Networking support
+# I2O device support
 #
-# CONFIG_NET is not set
 
 #
-# Amateur Radio support
+# Networking support
 #
-# CONFIG_HAMRADIO is not set
+# CONFIG_NET is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # ISDN subsystem
@@ -222,6 +304,7 @@
 # CONFIG_SERIO_I8042 is not set
 # CONFIG_SERIO_SERPORT is not set
 # CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_RAW is not set
 
 #
 # Input Device Drivers
@@ -238,33 +321,125 @@
 CONFIG_VT=y
 CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
+# CONFIG_SERIAL_NONSTANDARD is not set
 
 #
-# Unix98 PTY support
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
 #
-# CONFIG_UNIX98_PTYS is not set
-# CONFIG_PSMOUSE is not set
+# CONFIG_SERIAL_SH_SCI is not set
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
 
 #
 # Watchdog Cards
 #
 # CONFIG_WATCHDOG is not set
 # CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
 
 #
-# Serial drivers
+# Ftape, the floppy tape device driver
 #
-# CONFIG_SERIAL_8250 is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
 
 #
-# Non-8250 serial port support
+# I2C support
 #
-# CONFIG_SERIAL_SH_SCI is not set
+# CONFIG_I2C is not set
 
 #
-# I2C support
+# Dallas's 1-wire bus
 #
-# CONFIG_I2C is not set
+# CONFIG_W1 is not set
+
+#
+# Misc devices
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+
+#
+# Graphics support
+#
+CONFIG_FB=y
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+# CONFIG_FB_EPSON1355 is not set
+CONFIG_FB_HIT=y
+# CONFIG_FB_VIRTUAL is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FONTS=y
+# CONFIG_FONT_8x8 is not set
+# CONFIG_FONT_8x16 is not set
+# CONFIG_FONT_6x11 is not set
+CONFIG_FONT_PEARL_8x8=y
+# CONFIG_FONT_ACORN_8x8 is not set
+# CONFIG_FONT_MINI_4x6 is not set
+# CONFIG_FONT_SUN8x16 is not set
+# CONFIG_FONT_SUN12x22 is not set
+
+#
+# Logo configuration
+#
+# CONFIG_LOGO is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
 
 #
 # File systems
@@ -275,10 +450,15 @@
 # CONFIG_JBD is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -291,7 +471,8 @@
 #
 # DOS/FAT/NT Filesystems
 #
-# CONFIG_FAT_FS is not set
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
 # CONFIG_NTFS_FS is not set
 
 #
@@ -299,9 +480,11 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 CONFIG_DEVFS_FS=y
 CONFIG_DEVFS_MOUNT=y
 # CONFIG_DEVFS_DEBUG is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
 # CONFIG_TMPFS is not set
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
@@ -313,6 +496,7 @@
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
@@ -335,60 +519,6 @@
 # CONFIG_NLS is not set
 
 #
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-
-#
-# Digital Video Broadcasting Devices
-#
-
-#
-# Graphics support
-#
-CONFIG_FB=y
-# CONFIG_FB_E1355 is not set
-CONFIG_FB_HIT=y
-# CONFIG_FB_VIRTUAL is not set
-
-#
-# Console display driver support
-#
-# CONFIG_VGA_CONSOLE is not set
-# CONFIG_MDA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
-CONFIG_FONTS=y
-# CONFIG_FONT_8x8 is not set
-# CONFIG_FONT_8x16 is not set
-# CONFIG_FONT_6x11 is not set
-CONFIG_FONT_PEARL_8x8=y
-# CONFIG_FONT_ACORN_8x8 is not set
-# CONFIG_FONT_MINI_4x6 is not set
-# CONFIG_FONT_SUN8x16 is not set
-# CONFIG_FONT_SUN12x22 is not set
-
-#
-# Logo configuration
-#
-# CONFIG_LOGO is not set
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
 # Profiling support
 #
 # CONFIG_PROFILING is not set
@@ -396,15 +526,15 @@
 #
 # Kernel hacking
 #
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_FRAME_POINTER is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 # CONFIG_KGDB is not set
-# CONFIG_FRAME_POINTER is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -413,6 +543,12 @@
 # CONFIG_CRYPTO is not set
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
-# CONFIG_CRC32 is not set
+# CONFIG_CRC_CCITT is not set
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
diff -Nru a/arch/sh/configs/microdev_defconfig b/arch/sh/configs/microdev_defconfig
--- a/arch/sh/configs/microdev_defconfig	2004-10-18 22:26:42 -07:00
+++ b/arch/sh/configs/microdev_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,9 +1,14 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:41 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
@@ -11,10 +16,12 @@
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
 CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 # CONFIG_SYSVIPC is not set
 # CONFIG_POSIX_MQUEUE is not set
@@ -24,17 +31,20 @@
 # CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
+CONFIG_KOBJECT_UEVENT=y
 # CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -133,9 +143,13 @@
 # CONFIG_PCI is not set
 
 #
-# PCMCIA/CardBus support
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
 #
-# CONFIG_PCMCIA is not set
 CONFIG_PCMCIA_PROBE=y
 
 #
@@ -185,12 +199,25 @@
 #
 # CONFIG_BLK_DEV_FD is not set
 # CONFIG_BLK_DEV_XD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -209,7 +236,6 @@
 # CONFIG_BLK_DEV_IDETAPE is not set
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
 # CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
 
 #
 # IDE chipset support/bugfixes
@@ -275,6 +301,9 @@
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 # CONFIG_IPV6 is not set
 # CONFIG_NETFILTER is not set
 
@@ -294,7 +323,6 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
@@ -419,7 +447,6 @@
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-# CONFIG_QIC02_TAPE is not set
 
 #
 # IPMI
@@ -437,7 +464,6 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
 
@@ -478,6 +504,12 @@
 #
 # USB support
 #
+# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 
 #
 # USB Gadget Support
@@ -485,6 +517,16 @@
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -498,10 +540,15 @@
 CONFIG_FS_MBCACHE=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -533,6 +580,7 @@
 CONFIG_DEVPTS_FS_XATTR=y
 # CONFIG_DEVPTS_FS_SECURITY is not set
 CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
@@ -565,10 +613,10 @@
 CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
-# CONFIG_EXPORTFS is not set
 CONFIG_SUNRPC=y
 CONFIG_SUNRPC_GSS=y
 CONFIG_RPCSEC_GSS_KRB5=y
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -633,17 +681,17 @@
 #
 # Kernel hacking
 #
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_KERNEL is not set
+CONFIG_DEBUG_PREEMPT=y
+# CONFIG_FRAME_POINTER is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 # CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_KGDB is not set
-# CONFIG_FRAME_POINTER is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -657,6 +705,7 @@
 # CONFIG_CRYPTO_SHA1 is not set
 # CONFIG_CRYPTO_SHA256 is not set
 # CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_WP512 is not set
 CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_BLOWFISH is not set
 # CONFIG_CRYPTO_TWOFISH is not set
@@ -667,10 +716,15 @@
 # CONFIG_CRYPTO_TEA is not set
 # CONFIG_CRYPTO_ARC4 is not set
 # CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_ANUBIS is not set
 # CONFIG_CRYPTO_DEFLATE is not set
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
 # CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_TEST is not set
+
+#
+# Hardware crypto devices
+#
 
 #
 # Library routines
diff -Nru a/arch/sh/configs/rts7751r2d_defconfig b/arch/sh/configs/rts7751r2d_defconfig
--- a/arch/sh/configs/rts7751r2d_defconfig	2004-10-18 22:26:42 -07:00
+++ b/arch/sh/configs/rts7751r2d_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,21 +1,26 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:42 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
 CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 # CONFIG_POSIX_MQUEUE is not set
@@ -24,16 +29,20 @@
 # CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
+CONFIG_KOBJECT_UEVENT=y
 # CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -42,6 +51,7 @@
 # CONFIG_MODULE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 # CONFIG_KMOD is not set
 
 #
@@ -50,6 +60,7 @@
 # CONFIG_SH_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SOLUTION_ENGINE is not set
 # CONFIG_SH_7300_SOLUTION_ENGINE is not set
+# CONFIG_SH_73180_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SYSTEMH is not set
 # CONFIG_SH_STB1_HARP is not set
 # CONFIG_SH_STB1_OVERDRIVE is not set
@@ -66,9 +77,12 @@
 # CONFIG_SH_SH2000 is not set
 # CONFIG_SH_ADX is not set
 # CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
 # CONFIG_SH_SECUREEDGE5410 is not set
 # CONFIG_SH_HS7751RVOIP is not set
 CONFIG_SH_RTS7751R2D=y
+# CONFIG_SH_EDOSK7705 is not set
+# CONFIG_SH_SH4202_MICRODEV is not set
 # CONFIG_SH_UNKNOWN is not set
 # CONFIG_CPU_SH2 is not set
 # CONFIG_CPU_SH3 is not set
@@ -82,8 +96,10 @@
 # CONFIG_CPU_SUBTYPE_SH7750 is not set
 CONFIG_CPU_SUBTYPE_SH7751=y
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
+# CONFIG_CPU_SUBTYPE_SH73180 is not set
 # CONFIG_CPU_SUBTYPE_ST40STB1 is not set
 # CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
 CONFIG_MMU=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="mem=64M console=ttySC0,115200 root=/dev/hda1"
@@ -92,6 +108,7 @@
 CONFIG_MEMORY_SET=y
 # CONFIG_MEMORY_OVERRIDE is not set
 CONFIG_SH_RTC=y
+CONFIG_SH_FPU=y
 CONFIG_ZERO_PAGE_OFFSET=0x00010000
 CONFIG_BOOT_LINK_OFFSET=0x00800000
 CONFIG_CPU_LITTLE_ENDIAN=y
@@ -128,7 +145,6 @@
 #
 # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
 #
-CONFIG_ISA=y
 CONFIG_PCI=y
 CONFIG_SH_PCIDMA_NONCOHERENT=y
 CONFIG_PCI_AUTO=y
@@ -137,16 +153,13 @@
 CONFIG_PCI_NAMES=y
 
 #
-# PCMCIA/CardBus support
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
 #
-CONFIG_PCMCIA=m
-# CONFIG_PCMCIA_DEBUG is not set
-CONFIG_YENTA=m
-CONFIG_CARDBUS=y
-# CONFIG_I82092 is not set
-# CONFIG_I82365 is not set
-# CONFIG_TCIC is not set
-CONFIG_PCMCIA_PROBE=y
 
 #
 # PCI Hotplug Support
@@ -154,7 +167,6 @@
 CONFIG_HOTPLUG_PCI=y
 # CONFIG_HOTPLUG_PCI_FAKE is not set
 # CONFIG_HOTPLUG_PCI_CPCI is not set
-# CONFIG_HOTPLUG_PCI_PCIE is not set
 # CONFIG_HOTPLUG_PCI_SHPC is not set
 
 #
@@ -171,6 +183,8 @@
 #
 # Generic Driver Options
 #
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
 
 #
@@ -186,24 +200,35 @@
 #
 # Plug and Play support
 #
-# CONFIG_PNP is not set
 
 #
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_DEV_XD is not set
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_CARMEL is not set
+# CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 # CONFIG_BLK_DEV_INITRD is not set
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -215,14 +240,13 @@
 #
 # Please see Documentation/ide.txt for help/info on IDE drives
 #
+# CONFIG_BLK_DEV_IDE_SATA is not set
 CONFIG_BLK_DEV_IDEDISK=y
 # CONFIG_IDEDISK_MULTI_MODE is not set
-CONFIG_BLK_DEV_IDECS=m
 # CONFIG_BLK_DEV_IDECD is not set
 # CONFIG_BLK_DEV_IDETAPE is not set
 # CONFIG_BLK_DEV_IDEFLOPPY is not set
 # CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
 
 #
 # IDE chipset support/bugfixes
@@ -231,7 +255,6 @@
 # CONFIG_BLK_DEV_IDEPCI is not set
 CONFIG_IDE_SH=y
 # CONFIG_IDE_ARM is not set
-# CONFIG_IDE_CHIPSETS is not set
 # CONFIG_BLK_DEV_IDEDMA is not set
 # CONFIG_IDEDMA_AUTO is not set
 # CONFIG_BLK_DEV_HD is not set
@@ -242,11 +265,6 @@
 # CONFIG_SCSI is not set
 
 #
-# Old CD-ROM drivers (not SCSI, not IDE)
-#
-# CONFIG_CD_NO_IDESCSI is not set
-
-#
 # Multi-device support (RAID and LVM)
 #
 # CONFIG_MD is not set
@@ -289,6 +307,9 @@
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 # CONFIG_IPV6 is not set
 # CONFIG_NETFILTER is not set
 
@@ -308,13 +329,12 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
 #
 # CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
 
 #
 # Network testing
@@ -345,38 +365,19 @@
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
 # CONFIG_NET_VENDOR_3COM is not set
-# CONFIG_LANCE is not set
-# CONFIG_NET_VENDOR_SMC is not set
-# CONFIG_NET_VENDOR_RACAL is not set
+# CONFIG_SMC91X is not set
 
 #
 # Tulip family network device support
 #
 # CONFIG_NET_TULIP is not set
-# CONFIG_AT1700 is not set
-# CONFIG_DEPCA is not set
 # CONFIG_HP100 is not set
-CONFIG_NET_ISA=y
-# CONFIG_E2100 is not set
-# CONFIG_EWRK3 is not set
-# CONFIG_EEXPRESS is not set
-# CONFIG_EEXPRESS_PRO is not set
-# CONFIG_HPLAN_PLUS is not set
-# CONFIG_HPLAN is not set
-# CONFIG_LP486E is not set
-# CONFIG_ETH16I is not set
-CONFIG_NE2000=m
-# CONFIG_ZNET is not set
-# CONFIG_SEEQ8005 is not set
 CONFIG_NET_PCI=y
 # CONFIG_PCNET32 is not set
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
-# CONFIG_AC3200 is not set
-# CONFIG_APRICOT is not set
 # CONFIG_B44 is not set
 # CONFIG_FORCEDETH is not set
-# CONFIG_CS89x0 is not set
 # CONFIG_DGRS is not set
 # CONFIG_EEPRO100 is not set
 # CONFIG_E100 is not set
@@ -394,7 +395,6 @@
 # CONFIG_SUNDANCE is not set
 # CONFIG_TLAN is not set
 # CONFIG_VIA_RHINE is not set
-# CONFIG_NET_POCKET is not set
 
 #
 # Ethernet (1000 Mbit)
@@ -407,6 +407,7 @@
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
 # CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 
 #
@@ -429,20 +430,10 @@
 # Obsolete Wireless cards support (pre-802.11)
 #
 # CONFIG_STRIP is not set
-# CONFIG_ARLAN is not set
-# CONFIG_WAVELAN is not set
-# CONFIG_PCMCIA_WAVELAN is not set
-# CONFIG_PCMCIA_NETWAVE is not set
-
-#
-# Wireless 802.11 Frequency Hopping cards support
-#
-# CONFIG_PCMCIA_RAYCS is not set
 
 #
 # Wireless 802.11b ISA/PCI cards support
 #
-# CONFIG_AIRO is not set
 CONFIG_HERMES=m
 # CONFIG_PLX_HERMES is not set
 # CONFIG_TMD_HERMES is not set
@@ -450,24 +441,12 @@
 # CONFIG_ATMEL is not set
 
 #
-# Wireless 802.11b Pcmcia/Cardbus cards support
-#
-CONFIG_PCMCIA_HERMES=m
-# CONFIG_AIRO_CS is not set
-# CONFIG_PCMCIA_WL3501 is not set
-
-#
 # Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
 #
 # CONFIG_PRISM54 is not set
 CONFIG_NET_WIRELESS=y
 
 #
-# PCMCIA network device support
-#
-# CONFIG_NET_PCMCIA is not set
-
-#
 # Wan interfaces
 #
 # CONFIG_WAN is not set
@@ -527,7 +506,6 @@
 # CONFIG_UNIX98_PTYS is not set
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-# CONFIG_QIC02_TAPE is not set
 
 #
 # IPMI
@@ -547,14 +525,7 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_FTAPE is not set
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
-
-#
-# PCMCIA character devices
-#
-# CONFIG_SYNCLINK_CS is not set
 # CONFIG_RAW_DRIVER is not set
 
 #
@@ -563,6 +534,11 @@
 # CONFIG_I2C is not set
 
 #
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
 # Misc devices
 #
 
@@ -611,37 +587,12 @@
 # CONFIG_SND_MPU401 is not set
 
 #
-# ISA devices
-#
-# CONFIG_SND_AD1848 is not set
-# CONFIG_SND_CS4231 is not set
-# CONFIG_SND_CS4232 is not set
-# CONFIG_SND_CS4236 is not set
-# CONFIG_SND_ES1688 is not set
-# CONFIG_SND_ES18XX is not set
-# CONFIG_SND_GUSCLASSIC is not set
-# CONFIG_SND_GUSEXTREME is not set
-# CONFIG_SND_GUSMAX is not set
-# CONFIG_SND_INTERWAVE is not set
-# CONFIG_SND_INTERWAVE_STB is not set
-# CONFIG_SND_OPTI92X_AD1848 is not set
-# CONFIG_SND_OPTI92X_CS4231 is not set
-# CONFIG_SND_OPTI93X is not set
-# CONFIG_SND_SB8 is not set
-# CONFIG_SND_SB16 is not set
-# CONFIG_SND_SBAWE is not set
-# CONFIG_SND_WAVEFRONT is not set
-# CONFIG_SND_CMI8330 is not set
-# CONFIG_SND_OPL3SA2 is not set
-# CONFIG_SND_SGALAXY is not set
-# CONFIG_SND_SSCAPE is not set
-
-#
 # PCI devices
 #
 CONFIG_SND_AC97_CODEC=m
 # CONFIG_SND_ALI5451 is not set
 # CONFIG_SND_ATIIXP is not set
+# CONFIG_SND_ATIIXP_MODEM is not set
 # CONFIG_SND_AU8810 is not set
 # CONFIG_SND_AU8820 is not set
 # CONFIG_SND_AU8830 is not set
@@ -650,6 +601,8 @@
 # CONFIG_SND_CS46XX is not set
 # CONFIG_SND_CS4281 is not set
 # CONFIG_SND_EMU10K1 is not set
+# CONFIG_SND_EMU10K1X is not set
+# CONFIG_SND_CA0106 is not set
 # CONFIG_SND_KORG1212 is not set
 # CONFIG_SND_MIXART is not set
 # CONFIG_SND_NM256 is not set
@@ -673,16 +626,10 @@
 # CONFIG_SND_INTEL8X0M is not set
 # CONFIG_SND_SONICVIBES is not set
 # CONFIG_SND_VIA82XX is not set
+# CONFIG_SND_VIA82XX_MODEM is not set
 # CONFIG_SND_VX222 is not set
 
 #
-# PCMCIA devices
-#
-# CONFIG_SND_VXPOCKET is not set
-# CONFIG_SND_VXP440 is not set
-# CONFIG_SND_PDAUDIOCF is not set
-
-#
 # Open Sound System
 #
 CONFIG_SOUND_PRIME=m
@@ -713,6 +660,12 @@
 # USB support
 #
 # CONFIG_USB is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 
 #
 # USB Gadget Support
@@ -720,6 +673,16 @@
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -728,10 +691,15 @@
 # CONFIG_JBD is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 CONFIG_MINIX_FS=y
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -747,6 +715,8 @@
 CONFIG_FAT_FS=y
 CONFIG_MSDOS_FS=y
 CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 # CONFIG_NTFS_FS is not set
 
 #
@@ -783,7 +753,6 @@
 #
 # CONFIG_NFS_FS is not set
 # CONFIG_NFSD is not set
-# CONFIG_EXPORTFS is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -824,6 +793,7 @@
 # CONFIG_NLS_ISO8859_8 is not set
 # CONFIG_NLS_CODEPAGE_1250 is not set
 # CONFIG_NLS_CODEPAGE_1251 is not set
+# CONFIG_NLS_ASCII is not set
 # CONFIG_NLS_ISO8859_1 is not set
 # CONFIG_NLS_ISO8859_2 is not set
 # CONFIG_NLS_ISO8859_3 is not set
@@ -848,17 +818,16 @@
 #
 # Kernel hacking
 #
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_FRAME_POINTER is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 # CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_KGDB is not set
-# CONFIG_FRAME_POINTER is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -867,7 +836,12 @@
 # CONFIG_CRYPTO is not set
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
diff -Nru a/arch/sh/configs/se7300_defconfig b/arch/sh/configs/se7300_defconfig
--- a/arch/sh/configs/se7300_defconfig	2004-06-24 01:56:11 -07:00
+++ b/arch/sh/configs/se7300_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,24 +1,28 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:43 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
 CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 # CONFIG_SWAP is not set
 # CONFIG_SYSVIPC is not set
-# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 CONFIG_SYSCTL=y
 # CONFIG_AUDIT is not set
@@ -29,11 +33,13 @@
 # CONFIG_KALLSYMS is not set
 # CONFIG_FUTEX is not set
 # CONFIG_EPOLL is not set
-CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -46,6 +52,7 @@
 # CONFIG_SH_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SOLUTION_ENGINE is not set
 CONFIG_SH_7300_SOLUTION_ENGINE=y
+# CONFIG_SH_73180_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SYSTEMH is not set
 # CONFIG_SH_STB1_HARP is not set
 # CONFIG_SH_STB1_OVERDRIVE is not set
@@ -62,23 +69,29 @@
 # CONFIG_SH_SH2000 is not set
 # CONFIG_SH_ADX is not set
 # CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
 # CONFIG_SH_SECUREEDGE5410 is not set
 # CONFIG_SH_HS7751RVOIP is not set
 # CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_EDOSK7705 is not set
+# CONFIG_SH_SH4202_MICRODEV is not set
 # CONFIG_SH_UNKNOWN is not set
 # CONFIG_CPU_SH2 is not set
 CONFIG_CPU_SH3=y
 # CONFIG_CPU_SH4 is not set
 # CONFIG_CPU_SUBTYPE_SH7604 is not set
 CONFIG_CPU_SUBTYPE_SH7300=y
+# CONFIG_CPU_SUBTYPE_SH7705 is not set
 # CONFIG_CPU_SUBTYPE_SH7707 is not set
 # CONFIG_CPU_SUBTYPE_SH7708 is not set
 # CONFIG_CPU_SUBTYPE_SH7709 is not set
 # CONFIG_CPU_SUBTYPE_SH7750 is not set
 # CONFIG_CPU_SUBTYPE_SH7751 is not set
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
+# CONFIG_CPU_SUBTYPE_SH73180 is not set
 # CONFIG_CPU_SUBTYPE_ST40STB1 is not set
 # CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
 CONFIG_MMU=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttySC0,38400 root=/dev/ram0"
@@ -120,6 +133,19 @@
 # CONFIG_PCI is not set
 
 #
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+
+#
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
@@ -139,6 +165,9 @@
 #
 # Generic Driver Options
 #
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -158,11 +187,23 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_AS is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -186,7 +227,6 @@
 #
 # IEEE 1394 (FireWire) support
 #
-# CONFIG_IEEE1394 is not set
 
 #
 # I2O device support
@@ -234,6 +274,8 @@
 # CONFIG_SERIO_I8042 is not set
 # CONFIG_SERIO_SERPORT is not set
 # CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_LIBPS2 is not set
+# CONFIG_SERIO_RAW is not set
 
 #
 # Input Device Drivers
@@ -264,7 +306,6 @@
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_UNIX98_PTYS is not set
 # CONFIG_LEGACY_PTYS is not set
-# CONFIG_QIC02_TAPE is not set
 
 #
 # IPMI
@@ -274,6 +315,7 @@
 CONFIG_IPMI_DEVICE_INTERFACE=y
 # CONFIG_IPMI_SI is not set
 CONFIG_IPMI_WATCHDOG=y
+# CONFIG_IPMI_POWEROFF is not set
 
 #
 # Watchdog Cards
@@ -290,13 +332,10 @@
 # CONFIG_GEN_RTC is not set
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
-# CONFIG_APPLICOM is not set
 
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_FTAPE is not set
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
 
@@ -306,6 +345,11 @@
 # CONFIG_I2C is not set
 
 #
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
 # Misc devices
 #
 
@@ -331,6 +375,12 @@
 #
 # USB support
 #
+# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 
 #
 # USB Gadget Support
@@ -338,6 +388,16 @@
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -346,10 +406,15 @@
 # CONFIG_JBD is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -362,7 +427,8 @@
 #
 # DOS/FAT/NT Filesystems
 #
-# CONFIG_FAT_FS is not set
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
 # CONFIG_NTFS_FS is not set
 
 #
@@ -415,9 +481,8 @@
 #
 # Kernel hacking
 #
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_FRAME_POINTER is not set
 CONFIG_SH_STANDARD_BIOS=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_KGDB=y
@@ -442,11 +507,11 @@
 # CONFIG_KGDB_DEFPARITY_O is not set
 CONFIG_KGDB_DEFBITS_8=y
 # CONFIG_KGDB_DEFBITS_7 is not set
-# CONFIG_FRAME_POINTER is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -455,7 +520,12 @@
 # CONFIG_CRYPTO is not set
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
diff -Nru a/arch/sh/configs/se73180_defconfig b/arch/sh/configs/se73180_defconfig
--- a/arch/sh/configs/se73180_defconfig	2004-10-18 22:26:42 -07:00
+++ b/arch/sh/configs/se73180_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,24 +1,28 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:44 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
 CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 # CONFIG_SYSVIPC is not set
-# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_SYSCTL is not set
 # CONFIG_AUDIT is not set
@@ -29,11 +33,13 @@
 # CONFIG_KALLSYMS is not set
 # CONFIG_FUTEX is not set
 # CONFIG_EPOLL is not set
-CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -42,6 +48,7 @@
 # CONFIG_MODULE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 # CONFIG_KMOD is not set
 
 #
@@ -67,9 +74,12 @@
 # CONFIG_SH_SH2000 is not set
 # CONFIG_SH_ADX is not set
 # CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
 # CONFIG_SH_SECUREEDGE5410 is not set
 # CONFIG_SH_HS7751RVOIP is not set
 # CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_EDOSK7705 is not set
+# CONFIG_SH_SH4202_MICRODEV is not set
 # CONFIG_SH_UNKNOWN is not set
 # CONFIG_CPU_SH2 is not set
 # CONFIG_CPU_SH3 is not set
@@ -86,6 +96,7 @@
 CONFIG_CPU_SUBTYPE_SH73180=y
 # CONFIG_CPU_SUBTYPE_ST40STB1 is not set
 # CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
 CONFIG_MMU=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttySC0,38400 root=/dev/ram"
@@ -127,6 +138,19 @@
 # CONFIG_PCI is not set
 
 #
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+
+#
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
@@ -146,6 +170,9 @@
 #
 # Generic Driver Options
 #
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -165,12 +192,24 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+# CONFIG_IOSCHED_AS is not set
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -194,7 +233,6 @@
 #
 # IEEE 1394 (FireWire) support
 #
-# CONFIG_IEEE1394 is not set
 
 #
 # I2O device support
@@ -257,7 +295,6 @@
 CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_UNIX98_PTYS is not set
 # CONFIG_LEGACY_PTYS is not set
-# CONFIG_QIC02_TAPE is not set
 
 #
 # IPMI
@@ -279,13 +316,10 @@
 # CONFIG_GEN_RTC is not set
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
-# CONFIG_APPLICOM is not set
 
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_FTAPE is not set
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
 
@@ -295,6 +329,11 @@
 # CONFIG_I2C is not set
 
 #
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
 # Misc devices
 #
 
@@ -320,6 +359,12 @@
 #
 # USB support
 #
+# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 
 #
 # USB Gadget Support
@@ -327,6 +372,16 @@
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -335,10 +390,15 @@
 # CONFIG_JBD is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -351,7 +411,8 @@
 #
 # DOS/FAT/NT Filesystems
 #
-# CONFIG_FAT_FS is not set
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
 # CONFIG_NTFS_FS is not set
 
 #
@@ -364,6 +425,7 @@
 CONFIG_DEVFS_MOUNT=y
 # CONFIG_DEVFS_DEBUG is not set
 CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
@@ -404,18 +466,17 @@
 #
 # Kernel hacking
 #
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_FRAME_POINTER is not set
 CONFIG_SH_STANDARD_BIOS=y
 # CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_EARLY_PRINTK is not set
 # CONFIG_KGDB is not set
-# CONFIG_FRAME_POINTER is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -424,7 +485,12 @@
 # CONFIG_CRYPTO is not set
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
diff -Nru a/arch/sh/configs/se7705_defconfig b/arch/sh/configs/se7705_defconfig
--- a/arch/sh/configs/se7705_defconfig	2004-10-18 22:26:42 -07:00
+++ b/arch/sh/configs/se7705_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,9 +1,14 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:45 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
@@ -11,10 +16,12 @@
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
 CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 # CONFIG_SWAP is not set
 # CONFIG_SYSVIPC is not set
 # CONFIG_POSIX_MQUEUE is not set
@@ -23,16 +30,19 @@
 # CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_HOTPLUG is not set
+CONFIG_KOBJECT_UEVENT=y
 # CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
 # CONFIG_KALLSYMS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-# CONFIG_IOSCHED_NOOP is not set
-CONFIG_IOSCHED_AS=y
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -41,6 +51,7 @@
 # CONFIG_MODULE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
 
 #
@@ -66,6 +77,7 @@
 # CONFIG_SH_SH2000 is not set
 # CONFIG_SH_ADX is not set
 # CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
 # CONFIG_SH_SECUREEDGE5410 is not set
 # CONFIG_SH_HS7751RVOIP is not set
 # CONFIG_SH_RTS7751R2D is not set
@@ -132,6 +144,19 @@
 # CONFIG_PCI is not set
 
 #
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+
+#
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
@@ -152,6 +177,7 @@
 #
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -215,6 +241,7 @@
 # CONFIG_MTD_PHRAM is not set
 # CONFIG_MTD_MTDRAM is not set
 # CONFIG_MTD_BLKMTD is not set
+# CONFIG_MTD_BLOCK2MTD is not set
 
 #
 # Disk-On-Chip Device Drivers
@@ -241,12 +268,25 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=8192
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+# CONFIG_IOSCHED_DEADLINE is not set
+# CONFIG_IOSCHED_CFQ is not set
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -302,6 +342,9 @@
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 # CONFIG_IPV6 is not set
 # CONFIG_NETFILTER is not set
 
@@ -321,7 +364,6 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
@@ -350,6 +392,7 @@
 CONFIG_NET_ETHERNET=y
 # CONFIG_MII is not set
 CONFIG_STNIC=y
+# CONFIG_SMC91X is not set
 
 #
 # Ethernet (1000 Mbit)
@@ -417,6 +460,8 @@
 # CONFIG_SERIO_I8042 is not set
 # CONFIG_SERIO_SERPORT is not set
 # CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_LIBPS2 is not set
+# CONFIG_SERIO_RAW is not set
 
 #
 # Input Device Drivers
@@ -447,7 +492,6 @@
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 # CONFIG_LEGACY_PTYS is not set
-# CONFIG_QIC02_TAPE is not set
 
 #
 # IPMI
@@ -466,7 +510,6 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
 
@@ -507,6 +550,12 @@
 #
 # USB support
 #
+# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 
 #
 # USB Gadget Support
@@ -514,6 +563,16 @@
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -522,10 +581,15 @@
 # CONFIG_JBD is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -569,6 +633,7 @@
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_FS_DEBUG=0
 # CONFIG_JFFS2_FS_NAND is not set
+# CONFIG_JFFS2_FS_NOR_ECC is not set
 # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
 CONFIG_JFFS2_ZLIB=y
 CONFIG_JFFS2_RTIME=y
@@ -590,9 +655,9 @@
 # CONFIG_NFSD is not set
 CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
-# CONFIG_EXPORTFS is not set
 CONFIG_SUNRPC=y
 # CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -618,22 +683,26 @@
 #
 # Kernel hacking
 #
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_DEBUG_SPINLOCK is not set
-# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_KERNEL is not set
+CONFIG_DEBUG_PREEMPT=y
+# CONFIG_FRAME_POINTER is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 # CONFIG_KGDB is not set
-# CONFIG_FRAME_POINTER is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
 # Cryptographic options
 #
 # CONFIG_CRYPTO is not set
+
+#
+# Hardware crypto devices
+#
 
 #
 # Library routines
diff -Nru a/arch/sh/configs/se7750_defconfig b/arch/sh/configs/se7750_defconfig
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/sh/configs/se7750_defconfig	2005-03-08 09:36:02 -08:00
@@ -0,0 +1,713 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:46 2005
+#
+CONFIG_SUPERH=y
+CONFIG_UID16=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+
+#
+# Code maturity level options
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_CLEAN_COMPILE=y
+CONFIG_BROKEN_ON_SMP=y
+
+#
+# General setup
+#
+CONFIG_LOCALVERSION=""
+# CONFIG_SWAP is not set
+CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
+CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
+CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+CONFIG_KOBJECT_UEVENT=y
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_EMBEDDED=y
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
+
+#
+# Loadable module support
+#
+CONFIG_MODULES=y
+# CONFIG_MODULE_UNLOAD is not set
+CONFIG_OBSOLETE_MODPARM=y
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_KMOD=y
+
+#
+# System type
+#
+CONFIG_SH_SOLUTION_ENGINE=y
+# CONFIG_SH_7751_SOLUTION_ENGINE is not set
+# CONFIG_SH_7300_SOLUTION_ENGINE is not set
+# CONFIG_SH_73180_SOLUTION_ENGINE is not set
+# CONFIG_SH_7751_SYSTEMH is not set
+# CONFIG_SH_STB1_HARP is not set
+# CONFIG_SH_STB1_OVERDRIVE is not set
+# CONFIG_SH_HP620 is not set
+# CONFIG_SH_HP680 is not set
+# CONFIG_SH_HP690 is not set
+# CONFIG_SH_CQREEK is not set
+# CONFIG_SH_DMIDA is not set
+# CONFIG_SH_EC3104 is not set
+# CONFIG_SH_SATURN is not set
+# CONFIG_SH_DREAMCAST is not set
+# CONFIG_SH_CAT68701 is not set
+# CONFIG_SH_BIGSUR is not set
+# CONFIG_SH_SH2000 is not set
+# CONFIG_SH_ADX is not set
+# CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
+# CONFIG_SH_SECUREEDGE5410 is not set
+# CONFIG_SH_HS7751RVOIP is not set
+# CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_EDOSK7705 is not set
+# CONFIG_SH_SH4202_MICRODEV is not set
+# CONFIG_SH_UNKNOWN is not set
+# CONFIG_CPU_SH2 is not set
+# CONFIG_CPU_SH3 is not set
+CONFIG_CPU_SH4=y
+# CONFIG_CPU_SUBTYPE_SH7604 is not set
+# CONFIG_CPU_SUBTYPE_SH7300 is not set
+# CONFIG_CPU_SUBTYPE_SH7705 is not set
+# CONFIG_CPU_SUBTYPE_SH7707 is not set
+# CONFIG_CPU_SUBTYPE_SH7708 is not set
+# CONFIG_CPU_SUBTYPE_SH7709 is not set
+CONFIG_CPU_SUBTYPE_SH7750=y
+# CONFIG_CPU_SUBTYPE_SH7751 is not set
+# CONFIG_CPU_SUBTYPE_SH7760 is not set
+# CONFIG_CPU_SUBTYPE_SH73180 is not set
+# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
+# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
+CONFIG_MMU=y
+CONFIG_CMDLINE_BOOL=y
+CONFIG_CMDLINE="console=ttySC1,38400 root=/dev/nfs ip=bootp"
+CONFIG_MEMORY_START=0x0c000000
+CONFIG_MEMORY_SIZE=0x02000000
+CONFIG_MEMORY_SET=y
+# CONFIG_MEMORY_OVERRIDE is not set
+CONFIG_CF_ENABLER=y
+# CONFIG_CF_AREA5 is not set
+CONFIG_CF_AREA6=y
+CONFIG_CF_BASE_ADDR=0xb8000000
+CONFIG_SH_RTC=y
+CONFIG_SH_FPU=y
+CONFIG_ZERO_PAGE_OFFSET=0x00001000
+CONFIG_BOOT_LINK_OFFSET=0x00800000
+CONFIG_CPU_LITTLE_ENDIAN=y
+# CONFIG_PREEMPT is not set
+# CONFIG_UBC_WAKEUP is not set
+# CONFIG_SH_WRITETHROUGH is not set
+# CONFIG_SH_OCRAM is not set
+# CONFIG_SH_STORE_QUEUES is not set
+# CONFIG_SMP is not set
+CONFIG_SH_PCLK_CALC=y
+CONFIG_SH_PCLK_FREQ=49876504
+
+#
+# CPU Frequency scaling
+#
+# CONFIG_CPU_FREQ is not set
+
+#
+# DMA support
+#
+# CONFIG_SH_DMA is not set
+
+#
+# Companion Chips
+#
+# CONFIG_HD6446X_SERIES is not set
+CONFIG_HEARTBEAT=y
+
+#
+# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
+#
+# CONFIG_PCI is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+
+#
+# Executable file formats
+#
+CONFIG_BINFMT_ELF=y
+# CONFIG_BINFMT_FLAT is not set
+# CONFIG_BINFMT_MISC is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
+
+#
+# Memory Technology Devices (MTD)
+#
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+# CONFIG_MTD_CFI_ADV_OPTIONS is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_CFI_INTELEXT is not set
+CONFIG_MTD_CFI_AMDSTD=y
+CONFIG_MTD_CFI_AMDSTD_RETRY=0
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+# CONFIG_MTD_RAM is not set
+CONFIG_MTD_ROM=y
+# CONFIG_MTD_ABSENT is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PHYSMAP is not set
+CONFIG_MTD_SOLUTIONENGINE=y
+CONFIG_MTD_SUPERH_RESERVE=0x00010000
+# CONFIG_MTD_MPC1211 is not set
+# CONFIG_MTD_RTS7751R2D is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLKMTD is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+
+#
+# NAND Flash Device Drivers
+#
+# CONFIG_MTD_NAND is not set
+
+#
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Plug and Play support
+#
+
+#
+# Block devices
+#
+# CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+# CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_RAM is not set
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
+
+#
+# ATA/ATAPI/MFM/RLL support
+#
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_SCSI is not set
+
+#
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# Fusion MPT device support
+#
+
+#
+# IEEE 1394 (FireWire) support
+#
+
+#
+# I2O device support
+#
+
+#
+# Networking support
+#
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+# CONFIG_NETLINK_DEV is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_PNP=y
+# CONFIG_IP_PNP_DHCP is not set
+CONFIG_IP_PNP_BOOTP=y
+# CONFIG_IP_PNP_RARP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETFILTER is not set
+
+#
+# SCTP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_SCTP is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_NET_DIVERT is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
+# CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+
+#
+# Ethernet (10 or 100Mbit)
+#
+CONFIG_NET_ETHERNET=y
+# CONFIG_MII is not set
+CONFIG_STNIC=y
+# CONFIG_SMC91X is not set
+
+#
+# Ethernet (1000 Mbit)
+#
+
+#
+# Ethernet (10000 Mbit)
+#
+
+#
+# Token Ring devices
+#
+
+#
+# Wireless LAN (non-hamradio)
+#
+# CONFIG_NET_RADIO is not set
+
+#
+# Wan interfaces
+#
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
+
+#
+# ISDN subsystem
+#
+# CONFIG_ISDN is not set
+
+#
+# Telephony Support
+#
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+# CONFIG_INPUT is not set
+
+#
+# Userland interfaces
+#
+
+#
+# Input I/O drivers
+#
+# CONFIG_GAMEPORT is not set
+CONFIG_SOUND_GAMEPORT=y
+# CONFIG_SERIO is not set
+# CONFIG_SERIO_I8042 is not set
+
+#
+# Input Device Drivers
+#
+
+#
+# Character devices
+#
+# CONFIG_VT is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+# CONFIG_SERIAL_8250_CONSOLE is not set
+CONFIG_SERIAL_8250_NR_UARTS=2
+# CONFIG_SERIAL_8250_EXTENDED is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_SH_SCI=y
+CONFIG_SERIAL_SH_SCI_CONSOLE=y
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+CONFIG_WATCHDOG=y
+# CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+CONFIG_SH_WDT=y
+# CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+
+#
+# Ftape, the floppy tape device driver
+#
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
+
+#
+# I2C support
+#
+# CONFIG_I2C is not set
+
+#
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
+# Misc devices
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
+# File systems
+#
+# CONFIG_EXT2_FS is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_JBD is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
+# CONFIG_DEVFS_FS is not set
+# CONFIG_DEVPTS_FS_XATTR is not set
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLBFS is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS_FS is not set
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+# CONFIG_JFFS2_FS_NAND is not set
+# CONFIG_JFFS2_FS_NOR_ECC is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Network File Systems
+#
+CONFIG_NFS_FS=y
+# CONFIG_NFS_V3 is not set
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFS_DIRECTIO is not set
+# CONFIG_NFSD is not set
+CONFIG_ROOT_NFS=y
+CONFIG_LOCKD=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+# CONFIG_SMB_FS is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+# CONFIG_MSDOS_PARTITION is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
+
+#
+# Native Language Support
+#
+# CONFIG_NLS is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_FRAME_POINTER is not set
+# CONFIG_SH_STANDARD_BIOS is not set
+# CONFIG_EARLY_SCIF_CONSOLE is not set
+# CONFIG_KGDB is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Hardware crypto devices
+#
+
+#
+# Library routines
+#
+# CONFIG_CRC_CCITT is not set
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
diff -Nru a/arch/sh/configs/se7751_defconfig b/arch/sh/configs/se7751_defconfig
--- a/arch/sh/configs/se7751_defconfig	2004-10-18 22:26:42 -07:00
+++ b/arch/sh/configs/se7751_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,34 +1,49 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:48 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
 CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+# CONFIG_POSIX_MQUEUE is not set
 CONFIG_BSD_PROCESS_ACCT=y
+# CONFIG_BSD_PROCESS_ACCT_V3 is not set
 CONFIG_SYSCTL=y
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+CONFIG_KOBJECT_UEVENT=y
 # CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -37,6 +52,7 @@
 # CONFIG_MODULE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 # CONFIG_KMOD is not set
 
 #
@@ -44,6 +60,8 @@
 #
 # CONFIG_SH_SOLUTION_ENGINE is not set
 CONFIG_SH_7751_SOLUTION_ENGINE=y
+# CONFIG_SH_7300_SOLUTION_ENGINE is not set
+# CONFIG_SH_73180_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SYSTEMH is not set
 # CONFIG_SH_STB1_HARP is not set
 # CONFIG_SH_STB1_OVERDRIVE is not set
@@ -60,20 +78,29 @@
 # CONFIG_SH_SH2000 is not set
 # CONFIG_SH_ADX is not set
 # CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
 # CONFIG_SH_SECUREEDGE5410 is not set
+# CONFIG_SH_HS7751RVOIP is not set
+# CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_EDOSK7705 is not set
+# CONFIG_SH_SH4202_MICRODEV is not set
 # CONFIG_SH_UNKNOWN is not set
 # CONFIG_CPU_SH2 is not set
 # CONFIG_CPU_SH3 is not set
 CONFIG_CPU_SH4=y
 # CONFIG_CPU_SUBTYPE_SH7604 is not set
 # CONFIG_CPU_SUBTYPE_SH7300 is not set
+# CONFIG_CPU_SUBTYPE_SH7705 is not set
 # CONFIG_CPU_SUBTYPE_SH7707 is not set
 # CONFIG_CPU_SUBTYPE_SH7708 is not set
 # CONFIG_CPU_SUBTYPE_SH7709 is not set
 # CONFIG_CPU_SUBTYPE_SH7750 is not set
 CONFIG_CPU_SUBTYPE_SH7751=y
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
+# CONFIG_CPU_SUBTYPE_SH73180 is not set
 # CONFIG_CPU_SUBTYPE_ST40STB1 is not set
+# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
 CONFIG_MMU=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttySC1,38400"
@@ -82,6 +109,7 @@
 CONFIG_MEMORY_SET=y
 # CONFIG_MEMORY_OVERRIDE is not set
 CONFIG_SH_RTC=y
+CONFIG_SH_FPU=y
 CONFIG_ZERO_PAGE_OFFSET=0x00010000
 CONFIG_BOOT_LINK_OFFSET=0x00800000
 CONFIG_CPU_LITTLE_ENDIAN=y
@@ -91,21 +119,48 @@
 # CONFIG_SH_OCRAM is not set
 # CONFIG_SH_STORE_QUEUES is not set
 # CONFIG_SMP is not set
+CONFIG_SH_PCLK_CALC=y
 CONFIG_SH_PCLK_FREQ=60013568
+
+#
+# CPU Frequency scaling
+#
 # CONFIG_CPU_FREQ is not set
+
+#
+# DMA support
+#
 # CONFIG_SH_DMA is not set
 
 #
+# Companion Chips
+#
+# CONFIG_HD6446X_SERIES is not set
+CONFIG_HEARTBEAT=y
+
+#
 # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
 #
 CONFIG_PCI=y
 # CONFIG_SH_PCIDMA_NONCOHERENT is not set
 CONFIG_PCI_AUTO=y
 CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
-CONFIG_PCI_DMA=y
 # CONFIG_PCI_LEGACY_PROC is not set
 # CONFIG_PCI_NAMES is not set
-# CONFIG_HOTPLUG is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+# CONFIG_HOTPLUG_PCI is not set
 
 #
 # Executable file formats
@@ -115,8 +170,20 @@
 # CONFIG_BINFMT_MISC is not set
 
 #
+# SH initrd options
+#
+# CONFIG_EMBEDDED_RAMDISK is not set
+
+#
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -144,28 +211,43 @@
 # CONFIG_MTD_JEDECPROBE is not set
 CONFIG_MTD_GEN_PROBE=y
 # CONFIG_MTD_CFI_ADV_OPTIONS is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
 # CONFIG_MTD_CFI_INTELEXT is not set
 CONFIG_MTD_CFI_AMDSTD=y
+CONFIG_MTD_CFI_AMDSTD_RETRY=0
 # CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
 CONFIG_MTD_RAM=y
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
 # CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_SOLUTIONENGINE is not set
 # CONFIG_MTD_MPC1211 is not set
+# CONFIG_MTD_RTS7751R2D is not set
 
 #
 # Self-contained MTD device drivers
 #
 # CONFIG_MTD_PMC551 is not set
 # CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
 # CONFIG_MTD_MTDRAM is not set
 # CONFIG_MTD_BLKMTD is not set
+# CONFIG_MTD_BLOCK2MTD is not set
 
 #
 # Disk-On-Chip Device Drivers
@@ -185,6 +267,10 @@
 # CONFIG_PARPORT is not set
 
 #
+# Plug and Play support
+#
+
+#
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
@@ -192,12 +278,26 @@
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -215,11 +315,20 @@
 # CONFIG_MD is not set
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# Fusion MPT device support
+#
+
+#
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
 #
+# I2O device support
+#
+# CONFIG_I2O is not set
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -243,19 +352,19 @@
 # CONFIG_NET_IPGRE is not set
 # CONFIG_IP_MROUTE is not set
 # CONFIG_ARPD is not set
-# CONFIG_INET_ECN is not set
 # CONFIG_SYN_COOKIES is not set
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 
 #
 # IP: Virtual Server Configuration
 #
 # CONFIG_IP_VS is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 CONFIG_NETFILTER=y
 CONFIG_NETFILTER_DEBUG=y
 
@@ -263,19 +372,19 @@
 # IP: Netfilter Configuration
 #
 # CONFIG_IP_NF_CONNTRACK is not set
+# CONFIG_IP_NF_CONNTRACK_MARK is not set
 CONFIG_IP_NF_QUEUE=y
 # CONFIG_IP_NF_IPTABLES is not set
 # CONFIG_IP_NF_ARPTABLES is not set
-# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
-# CONFIG_IP_NF_COMPAT_IPFWADM is not set
 
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
 # CONFIG_IPX is not set
 # CONFIG_ATALK is not set
@@ -284,24 +393,23 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_FASTROUTE is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
 #
 # CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
@@ -309,6 +417,11 @@
 # CONFIG_ETHERTAP is not set
 
 #
+# ARCnet devices
+#
+# CONFIG_ARCNET is not set
+
+#
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
@@ -317,6 +430,7 @@
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_SMC91X is not set
 
 #
 # Tulip family network device support
@@ -328,6 +442,7 @@
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
 # CONFIG_B44 is not set
+# CONFIG_FORCEDETH is not set
 # CONFIG_DGRS is not set
 # CONFIG_EEPRO100 is not set
 # CONFIG_E100 is not set
@@ -352,55 +467,41 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 
 #
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
+# CONFIG_S2IO is not set
 
 #
 # Token Ring devices
 #
 # CONFIG_TR is not set
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
 
 #
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_IRDA is not set
+# CONFIG_NET_RADIO is not set
 
 #
-# Bluetooth support
+# Wan interfaces
 #
-# CONFIG_BT is not set
+# CONFIG_WAN is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
+# CONFIG_ISDN is not set
 
 #
 # Telephony Support
@@ -432,35 +533,54 @@
 # Character devices
 #
 # CONFIG_VT is not set
-# CONFIG_SERIAL is not set
-CONFIG_SH_SCI=y
-CONFIG_SERIAL_CONSOLE=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
 
 #
-# Unix 98 PTY support
+# Non-8250 serial port support
 #
+# CONFIG_SERIAL_SH_SCI is not set
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
-CONFIG_HEARTBEAT=y
-# CONFIG_PSMOUSE is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
 
 #
 # Watchdog Cards
 #
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
 # CONFIG_SH_WDT is not set
-# CONFIG_RTC is not set
 
 #
-# Serial drivers
+# PCI-based Watchdog Cards
 #
-# CONFIG_SERIAL_8250 is not set
+# CONFIG_PCIPCWATCHDOG is not set
+# CONFIG_WDTPCI is not set
+# CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
 
 #
-# Non-8250 serial port support
+# Ftape, the floppy tape device driver
 #
-# CONFIG_SERIAL_SH_SCI is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
 
 #
 # I2C support
@@ -468,17 +588,59 @@
 # CONFIG_I2C is not set
 
 #
-# I2C Algorithms
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
+# Misc devices
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+# CONFIG_USB is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
 #
 
 #
-# I2C Hardware Bus support
+# USB Gadget Support
 #
+# CONFIG_USB_GADGET is not set
 
 #
-# I2C Hardware Sensors Chip support
+# MMC/SD Card support
 #
-# CONFIG_I2C_SENSOR is not set
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
 
 #
 # File systems
@@ -489,10 +651,15 @@
 # CONFIG_JBD is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -505,7 +672,8 @@
 #
 # DOS/FAT/NT Filesystems
 #
-# CONFIG_FAT_FS is not set
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
 # CONFIG_NTFS_FS is not set
 
 #
@@ -513,10 +681,12 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 # CONFIG_DEVFS_FS is not set
-CONFIG_DEVPTS_FS=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
 
@@ -526,6 +696,7 @@
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
@@ -533,6 +704,11 @@
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_FS_DEBUG=0
 # CONFIG_JFFS2_FS_NAND is not set
+# CONFIG_JFFS2_FS_NOR_ECC is not set
+# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
@@ -545,12 +721,10 @@
 #
 # CONFIG_NFS_FS is not set
 # CONFIG_NFSD is not set
-# CONFIG_EXPORTFS is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
-# CONFIG_INTERMEZZO_FS is not set
 # CONFIG_AFS_FS is not set
 
 #
@@ -560,30 +734,9 @@
 CONFIG_MSDOS_PARTITION=y
 
 #
-# Multimedia devices
+# Native Language Support
 #
-# CONFIG_VIDEO_DEV is not set
-
-#
-# Digital Video Broadcasting Devices
-#
-# CONFIG_DVB is not set
-
-#
-# Graphics support
-#
-# CONFIG_FB is not set
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-# CONFIG_USB is not set
-# CONFIG_USB_GADGET is not set
+# CONFIG_NLS is not set
 
 #
 # Profiling support
@@ -593,15 +746,16 @@
 #
 # Kernel hacking
 #
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_FRAME_POINTER is not set
 # CONFIG_SH_STANDARD_BIOS is not set
+# CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_KGDB is not set
-# CONFIG_FRAME_POINTER is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -610,8 +764,14 @@
 # CONFIG_CRYPTO is not set
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
diff -Nru a/arch/sh/configs/sh03_defconfig b/arch/sh/configs/sh03_defconfig
--- a/arch/sh/configs/sh03_defconfig	2004-10-18 22:26:42 -07:00
+++ b/arch/sh/configs/sh03_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,9 +1,14 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:49 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
@@ -12,10 +17,12 @@
 # CONFIG_CLEAN_COMPILE is not set
 CONFIG_BROKEN=y
 CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
 CONFIG_POSIX_MQUEUE=y
@@ -25,17 +32,20 @@
 # CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
 CONFIG_HOTPLUG=y
+CONFIG_KOBJECT_UEVENT=y
 # CONFIG_IKCONFIG is not set
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -45,6 +55,7 @@
 CONFIG_MODULE_FORCE_UNLOAD=y
 CONFIG_OBSOLETE_MODPARM=y
 CONFIG_MODVERSIONS=y
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
 
 #
@@ -137,7 +148,6 @@
 #
 # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
 #
-CONFIG_ISA=y
 CONFIG_PCI=y
 CONFIG_SH_PCIDMA_NONCOHERENT=y
 CONFIG_PCI_AUTO=y
@@ -146,16 +156,13 @@
 CONFIG_PCI_NAMES=y
 
 #
-# PCMCIA/CardBus support
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
 #
-CONFIG_PCMCIA=m
-# CONFIG_PCMCIA_DEBUG is not set
-# CONFIG_YENTA is not set
-# CONFIG_PD6729 is not set
-# CONFIG_I82092 is not set
-# CONFIG_I82365 is not set
-# CONFIG_TCIC is not set
-CONFIG_PCMCIA_PROBE=y
 
 #
 # PCI Hotplug Support
@@ -163,7 +170,6 @@
 CONFIG_HOTPLUG_PCI=m
 # CONFIG_HOTPLUG_PCI_FAKE is not set
 # CONFIG_HOTPLUG_PCI_CPCI is not set
-# CONFIG_HOTPLUG_PCI_PCIE is not set
 # CONFIG_HOTPLUG_PCI_SHPC is not set
 
 #
@@ -202,25 +208,36 @@
 #
 # Plug and Play support
 #
-# CONFIG_PNP is not set
 
 #
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_DEV_XD is not set
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 CONFIG_BLK_DEV_NBD=y
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -235,13 +252,11 @@
 # CONFIG_BLK_DEV_IDE_SATA is not set
 CONFIG_BLK_DEV_IDEDISK=y
 CONFIG_IDEDISK_MULTI_MODE=y
-CONFIG_BLK_DEV_IDECS=m
 CONFIG_BLK_DEV_IDECD=m
 CONFIG_BLK_DEV_IDETAPE=m
 CONFIG_BLK_DEV_IDEFLOPPY=m
 # CONFIG_BLK_DEV_IDESCSI is not set
 # CONFIG_IDE_TASK_IOCTL is not set
-# CONFIG_IDE_TASKFILE_IO is not set
 
 #
 # IDE chipset support/bugfixes
@@ -250,7 +265,6 @@
 # CONFIG_BLK_DEV_IDEPCI is not set
 CONFIG_IDE_SH=y
 # CONFIG_IDE_ARM is not set
-# CONFIG_IDE_CHIPSETS is not set
 # CONFIG_BLK_DEV_IDEDMA is not set
 # CONFIG_IDEDMA_AUTO is not set
 # CONFIG_BLK_DEV_HD is not set
@@ -283,46 +297,37 @@
 #
 # CONFIG_SCSI_SPI_ATTRS is not set
 # CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
 
 #
 # SCSI low-level drivers
 #
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
 # CONFIG_SCSI_3W_9XXX is not set
-# CONFIG_SCSI_7000FASST is not set
 # CONFIG_SCSI_ACARD is not set
-# CONFIG_SCSI_AHA152X is not set
-# CONFIG_SCSI_AHA1542 is not set
 # CONFIG_SCSI_AACRAID is not set
 # CONFIG_SCSI_AIC7XXX is not set
 # CONFIG_SCSI_AIC7XXX_OLD is not set
 # CONFIG_SCSI_AIC79XX is not set
 # CONFIG_SCSI_DPT_I2O is not set
 # CONFIG_SCSI_ADVANSYS is not set
-# CONFIG_SCSI_IN2000 is not set
-# CONFIG_SCSI_MEGARAID is not set
+# CONFIG_MEGARAID_NEWGEN is not set
+# CONFIG_MEGARAID_LEGACY is not set
 # CONFIG_SCSI_SATA is not set
 # CONFIG_SCSI_BUSLOGIC is not set
 # CONFIG_SCSI_CPQFCTS is not set
 # CONFIG_SCSI_DMX3191D is not set
-# CONFIG_SCSI_DTC3280 is not set
 # CONFIG_SCSI_EATA is not set
 # CONFIG_SCSI_EATA_PIO is not set
 # CONFIG_SCSI_FUTURE_DOMAIN is not set
 # CONFIG_SCSI_GDTH is not set
-# CONFIG_SCSI_GENERIC_NCR5380 is not set
-# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
 # CONFIG_SCSI_IPS is not set
 # CONFIG_SCSI_INITIO is not set
 # CONFIG_SCSI_INIA100 is not set
-# CONFIG_SCSI_NCR53C406A is not set
 # CONFIG_SCSI_SYM53C8XX_2 is not set
 # CONFIG_SCSI_IPR is not set
-# CONFIG_SCSI_PAS16 is not set
 # CONFIG_SCSI_PCI2000 is not set
 # CONFIG_SCSI_PCI2220I is not set
-# CONFIG_SCSI_PSI240I is not set
-# CONFIG_SCSI_QLOGIC_FAS is not set
 # CONFIG_SCSI_QLOGIC_ISP is not set
 # CONFIG_SCSI_QLOGIC_FC is not set
 # CONFIG_SCSI_QLOGIC_1280 is not set
@@ -332,30 +337,12 @@
 # CONFIG_SCSI_QLA2300 is not set
 # CONFIG_SCSI_QLA2322 is not set
 # CONFIG_SCSI_QLA6312 is not set
-# CONFIG_SCSI_QLA6322 is not set
-# CONFIG_SCSI_SYM53C416 is not set
 # CONFIG_SCSI_DC395x is not set
 # CONFIG_SCSI_DC390T is not set
-# CONFIG_SCSI_T128 is not set
-# CONFIG_SCSI_U14_34F is not set
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 
 #
-# PCMCIA SCSI adapter support
-#
-# CONFIG_PCMCIA_AHA152X is not set
-# CONFIG_PCMCIA_FDOMAIN is not set
-# CONFIG_PCMCIA_NINJA_SCSI is not set
-# CONFIG_PCMCIA_QLOGIC is not set
-# CONFIG_PCMCIA_SYM53C500 is not set
-
-#
-# Old CD-ROM drivers (not SCSI, not IDE)
-#
-# CONFIG_CD_NO_IDESCSI is not set
-
-#
 # Multi-device support (RAID and LVM)
 #
 # CONFIG_MD is not set
@@ -403,6 +390,9 @@
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 # CONFIG_IPV6 is not set
 # CONFIG_NETFILTER is not set
 CONFIG_XFRM=y
@@ -424,7 +414,6 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
@@ -461,27 +450,19 @@
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
 # CONFIG_NET_VENDOR_3COM is not set
-# CONFIG_LANCE is not set
-# CONFIG_NET_VENDOR_SMC is not set
-# CONFIG_NET_VENDOR_RACAL is not set
+# CONFIG_SMC91X is not set
 
 #
 # Tulip family network device support
 #
 # CONFIG_NET_TULIP is not set
-# CONFIG_AT1700 is not set
-# CONFIG_DEPCA is not set
 # CONFIG_HP100 is not set
-# CONFIG_NET_ISA is not set
 CONFIG_NET_PCI=y
 # CONFIG_PCNET32 is not set
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
-# CONFIG_AC3200 is not set
-# CONFIG_APRICOT is not set
 # CONFIG_B44 is not set
 # CONFIG_FORCEDETH is not set
-# CONFIG_CS89x0 is not set
 # CONFIG_DGRS is not set
 # CONFIG_EEPRO100 is not set
 # CONFIG_E100 is not set
@@ -495,8 +476,6 @@
 # CONFIG_SUNDANCE is not set
 # CONFIG_TLAN is not set
 # CONFIG_VIA_RHINE is not set
-# CONFIG_VIA_VELOCITY is not set
-# CONFIG_NET_POCKET is not set
 
 #
 # Ethernet (1000 Mbit)
@@ -509,6 +488,7 @@
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
 # CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 
 #
@@ -528,11 +508,6 @@
 # CONFIG_NET_RADIO is not set
 
 #
-# PCMCIA network device support
-#
-# CONFIG_NET_PCMCIA is not set
-
-#
 # Wan interfaces
 #
 # CONFIG_WAN is not set
@@ -600,7 +575,6 @@
 # Serial drivers
 #
 CONFIG_SERIAL_8250=m
-# CONFIG_SERIAL_8250_CS is not set
 CONFIG_SERIAL_8250_NR_UARTS=4
 # CONFIG_SERIAL_8250_EXTENDED is not set
 
@@ -614,7 +588,6 @@
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-# CONFIG_QIC02_TAPE is not set
 
 #
 # IPMI
@@ -634,13 +607,6 @@
 CONFIG_SH_WDT=m
 
 #
-# ISA-based Watchdog Cards
-#
-# CONFIG_PCWATCHDOG is not set
-# CONFIG_MIXCOMWD is not set
-# CONFIG_WDT is not set
-
-#
 # PCI-based Watchdog Cards
 #
 # CONFIG_PCIPCWATCHDOG is not set
@@ -655,13 +621,7 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
-
-#
-# PCMCIA character devices
-#
-# CONFIG_SYNCLINK_CS is not set
 # CONFIG_RAW_DRIVER is not set
 
 #
@@ -697,7 +657,6 @@
 # Console display driver support
 #
 # CONFIG_VGA_CONSOLE is not set
-# CONFIG_MDA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
 
 #
@@ -709,6 +668,12 @@
 # USB support
 #
 # CONFIG_USB is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 
 #
 # USB Gadget Support
@@ -716,6 +681,16 @@
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
@@ -732,10 +707,15 @@
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 CONFIG_FS_POSIX_ACL=y
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 CONFIG_AUTOFS_FS=y
 CONFIG_AUTOFS4_FS=y
 
@@ -768,6 +748,7 @@
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
@@ -807,6 +788,7 @@
 CONFIG_SUNRPC=y
 CONFIG_SUNRPC_GSS=y
 CONFIG_RPCSEC_GSS_KRB5=y
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -886,18 +868,18 @@
 #
 # Kernel hacking
 #
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_DEBUG_SPINLOCK is not set
-CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_KERNEL is not set
+CONFIG_DEBUG_PREEMPT=y
+# CONFIG_FRAME_POINTER is not set
 CONFIG_SH_STANDARD_BIOS=y
 # CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_EARLY_PRINTK is not set
 # CONFIG_KGDB is not set
-# CONFIG_FRAME_POINTER is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -911,6 +893,7 @@
 CONFIG_CRYPTO_SHA1=y
 # CONFIG_CRYPTO_SHA256 is not set
 # CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_WP512 is not set
 CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_BLOWFISH is not set
 # CONFIG_CRYPTO_TWOFISH is not set
@@ -921,10 +904,15 @@
 # CONFIG_CRYPTO_TEA is not set
 # CONFIG_CRYPTO_ARC4 is not set
 # CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_ANUBIS is not set
 CONFIG_CRYPTO_DEFLATE=y
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
 # CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_TEST is not set
+
+#
+# Hardware crypto devices
+#
 
 #
 # Library routines
diff -Nru a/arch/sh/configs/snapgear_defconfig b/arch/sh/configs/snapgear_defconfig
--- a/arch/sh/configs/snapgear_defconfig	2004-08-09 16:41:37 -07:00
+++ b/arch/sh/configs/snapgear_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,34 +1,48 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:51 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
 CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 # CONFIG_SYSVIPC is not set
+# CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_SYSCTL is not set
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
+CONFIG_KOBJECT_UEVENT=y
 # CONFIG_IKCONFIG is not set
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -40,6 +54,9 @@
 #
 # CONFIG_SH_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SOLUTION_ENGINE is not set
+# CONFIG_SH_7300_SOLUTION_ENGINE is not set
+# CONFIG_SH_73180_SOLUTION_ENGINE is not set
+# CONFIG_SH_7751_SYSTEMH is not set
 # CONFIG_SH_STB1_HARP is not set
 # CONFIG_SH_STB1_OVERDRIVE is not set
 # CONFIG_SH_HP620 is not set
@@ -55,19 +72,29 @@
 # CONFIG_SH_SH2000 is not set
 # CONFIG_SH_ADX is not set
 # CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
 CONFIG_SH_SECUREEDGE5410=y
+# CONFIG_SH_HS7751RVOIP is not set
+# CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_EDOSK7705 is not set
+# CONFIG_SH_SH4202_MICRODEV is not set
 # CONFIG_SH_UNKNOWN is not set
 # CONFIG_CPU_SH2 is not set
 # CONFIG_CPU_SH3 is not set
 CONFIG_CPU_SH4=y
 # CONFIG_CPU_SUBTYPE_SH7604 is not set
 # CONFIG_CPU_SUBTYPE_SH7300 is not set
+# CONFIG_CPU_SUBTYPE_SH7705 is not set
 # CONFIG_CPU_SUBTYPE_SH7707 is not set
 # CONFIG_CPU_SUBTYPE_SH7708 is not set
 # CONFIG_CPU_SUBTYPE_SH7709 is not set
 # CONFIG_CPU_SUBTYPE_SH7750 is not set
 CONFIG_CPU_SUBTYPE_SH7751=y
+# CONFIG_CPU_SUBTYPE_SH7760 is not set
+# CONFIG_CPU_SUBTYPE_SH73180 is not set
 # CONFIG_CPU_SUBTYPE_ST40STB1 is not set
+# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
 CONFIG_MMU=y
 # CONFIG_CMDLINE_BOOL is not set
 CONFIG_MEMORY_START=0x08000000
@@ -75,6 +102,7 @@
 CONFIG_MEMORY_SET=y
 # CONFIG_MEMORY_OVERRIDE is not set
 CONFIG_SH_RTC=y
+CONFIG_SH_FPU=y
 CONFIG_ZERO_PAGE_OFFSET=0x00001000
 CONFIG_BOOT_LINK_OFFSET=0x00800000
 CONFIG_CPU_LITTLE_ENDIAN=y
@@ -84,11 +112,25 @@
 # CONFIG_SH_OCRAM is not set
 # CONFIG_SH_STORE_QUEUES is not set
 # CONFIG_SMP is not set
+CONFIG_SH_PCLK_CALC=y
 CONFIG_SH_PCLK_FREQ=60013568
+
+#
+# CPU Frequency scaling
+#
 # CONFIG_CPU_FREQ is not set
+
+#
+# DMA support
+#
 CONFIG_SH_DMA=y
-CONFIG_NR_DMA_CHANNELS=8
-# CONFIG_DMA_PAGE_OPS is not set
+CONFIG_NR_ONCHIP_DMA_CHANNELS=4
+# CONFIG_NR_DMA_CHANNELS_BOOL is not set
+
+#
+# Companion Chips
+#
+# CONFIG_HD6446X_SERIES is not set
 
 #
 # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
@@ -97,10 +139,22 @@
 # CONFIG_SH_PCIDMA_NONCOHERENT is not set
 CONFIG_PCI_AUTO=y
 CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
-CONFIG_PCI_DMA=y
 # CONFIG_PCI_LEGACY_PROC is not set
 CONFIG_PCI_NAMES=y
-# CONFIG_HOTPLUG is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+# CONFIG_HOTPLUG_PCI is not set
 
 #
 # Executable file formats
@@ -110,8 +164,20 @@
 # CONFIG_BINFMT_MISC is not set
 
 #
+# SH initrd options
+#
+# CONFIG_EMBEDDED_RAMDISK is not set
+
+#
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -124,6 +190,10 @@
 # CONFIG_PARPORT is not set
 
 #
+# Plug and Play support
+#
+
+#
 # Block devices
 #
 # CONFIG_BLK_DEV_FD is not set
@@ -131,12 +201,26 @@
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -154,11 +238,20 @@
 # CONFIG_MD is not set
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# Fusion MPT device support
+#
+
+#
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
 #
+# I2O device support
+#
+# CONFIG_I2O is not set
+
+#
 # Networking support
 #
 CONFIG_NET=y
@@ -180,60 +273,69 @@
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_ARPD is not set
-# CONFIG_INET_ECN is not set
 # CONFIG_SYN_COOKIES is not set
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 # CONFIG_IPV6 is not set
-# CONFIG_DECNET is not set
-# CONFIG_BRIDGE is not set
 # CONFIG_NETFILTER is not set
 
 #
 # SCTP Configuration (EXPERIMENTAL)
 #
-CONFIG_IPV6_SCTP__=y
 # CONFIG_IP_SCTP is not set
 # CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
 # CONFIG_VLAN_8021Q is not set
-# CONFIG_LLC is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
 # CONFIG_X25 is not set
 # CONFIG_LAPB is not set
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
 #
 # CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
 
 #
 # Network testing
 #
 # CONFIG_NET_PKTGEN is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
 
 #
 # ARCnet devices
 #
 # CONFIG_ARCNET is not set
-# CONFIG_DUMMY is not set
-# CONFIG_BONDING is not set
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
 
 #
 # Ethernet (10 or 100Mbit)
 #
 CONFIG_NET_ETHERNET=y
-# CONFIG_MII is not set
+CONFIG_MII=y
 # CONFIG_STNIC is not set
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
 # CONFIG_NET_VENDOR_3COM is not set
+# CONFIG_SMC91X is not set
 
 #
 # Tulip family network device support
@@ -245,6 +347,7 @@
 # CONFIG_AMD8111_ETH is not set
 # CONFIG_ADAPTEC_STARFIRE is not set
 # CONFIG_B44 is not set
+# CONFIG_FORCEDETH is not set
 # CONFIG_DGRS is not set
 # CONFIG_EEPRO100 is not set
 # CONFIG_E100 is not set
@@ -273,49 +376,41 @@
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
-# CONFIG_SIS190 is not set
 # CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 
 #
 # Ethernet (10000 Mbit)
 #
 # CONFIG_IXGB is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
+# CONFIG_S2IO is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Token Ring devices
 #
-# CONFIG_NET_RADIO is not set
+# CONFIG_TR is not set
 
 #
-# Token Ring devices (depends on LLC=y)
+# Wireless LAN (non-hamradio)
 #
-# CONFIG_RCPCI is not set
-# CONFIG_SHAPER is not set
+# CONFIG_NET_RADIO is not set
 
 #
 # Wan interfaces
 #
 # CONFIG_WAN is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# IrDA (infrared) support
-#
-# CONFIG_IRDA is not set
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_SHAPER is not set
+# CONFIG_NETCONSOLE is not set
 
 #
 # ISDN subsystem
 #
-# CONFIG_ISDN_BOOL is not set
+# CONFIG_ISDN is not set
 
 #
 # Telephony Support
@@ -344,7 +439,12 @@
 #
 # CONFIG_GAMEPORT is not set
 CONFIG_SOUND_GAMEPORT=y
-# CONFIG_SERIO is not set
+CONFIG_SERIO=y
+CONFIG_SERIO_I8042=y
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_CT82C710 is not set
+# CONFIG_SERIO_PCIPS2 is not set
+# CONFIG_SERIO_RAW is not set
 
 #
 # Input Device Drivers
@@ -358,47 +458,110 @@
 #
 # Character devices
 #
-# CONFIG_VT is not set
-# CONFIG_SERIAL is not set
-CONFIG_SH_SCI=y
-CONFIG_SERIAL_CONSOLE=y
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_SERIAL_NONSTANDARD is not set
 
 #
-# Unix 98 PTY support
+# Serial drivers
 #
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_SH_SCI is not set
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
-# CONFIG_PSMOUSE is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
 
 #
 # Watchdog Cards
 #
 # CONFIG_WATCHDOG is not set
 # CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
 
 #
-# Serial drivers
+# Ftape, the floppy tape device driver
 #
-# CONFIG_SERIAL_8250 is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
 
 #
-# Non-8250 serial port support
+# I2C support
 #
-# CONFIG_SERIAL_SH_SCI is not set
+# CONFIG_I2C is not set
 
 #
-# I2C support
+# Dallas's 1-wire bus
 #
-# CONFIG_I2C is not set
+# CONFIG_W1 is not set
 
 #
-# I2C Hardware Sensors Mainboard support
+# Misc devices
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
 #
+# Digital Video Broadcasting Devices
+#
+# CONFIG_DVB is not set
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Console display driver support
+#
+CONFIG_VGA_CONSOLE=y
+CONFIG_DUMMY_CONSOLE=y
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+# CONFIG_USB is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
 
 #
-# I2C Hardware Sensors Chip support
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
 #
-# CONFIG_I2C_SENSOR is not set
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
 
 #
 # File systems
@@ -409,10 +572,15 @@
 # CONFIG_JBD is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 CONFIG_ROMFS_FS=y
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -425,19 +593,24 @@
 #
 # DOS/FAT/NT Filesystems
 #
-# CONFIG_FAT_FS is not set
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
 # CONFIG_NTFS_FS is not set
 
 #
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
+# CONFIG_PROC_KCORE is not set
+CONFIG_SYSFS=y
 CONFIG_DEVFS_FS=y
 CONFIG_DEVFS_MOUNT=y
 # CONFIG_DEVFS_DEBUG is not set
-CONFIG_DEVPTS_FS=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
+# CONFIG_HUGETLBFS is not set
+# CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
 
 #
@@ -446,6 +619,7 @@
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
@@ -462,18 +636,18 @@
 CONFIG_NFS_FS=y
 CONFIG_NFS_V3=y
 # CONFIG_NFS_V4 is not set
+# CONFIG_NFS_DIRECTIO is not set
 # CONFIG_NFSD is not set
 CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
-# CONFIG_EXPORTFS is not set
 CONFIG_SUNRPC=y
-# CONFIG_SUNRPC_GSS is not set
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
-# CONFIG_INTERMEZZO_FS is not set
 # CONFIG_AFS_FS is not set
 
 #
@@ -483,48 +657,28 @@
 CONFIG_MSDOS_PARTITION=y
 
 #
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-
-#
-# Digital Video Broadcasting Devices
-#
-# CONFIG_DVB is not set
-
-#
-# Graphics support
+# Native Language Support
 #
-# CONFIG_FB is not set
+# CONFIG_NLS is not set
 
 #
-# Sound
+# Profiling support
 #
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-# CONFIG_USB is not set
-# CONFIG_USB_GADGET is not set
-
-#
-# Bluetooth support
-#
-# CONFIG_BT is not set
+# CONFIG_PROFILING is not set
 
 #
 # Kernel hacking
 #
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_KERNEL is not set
+# CONFIG_FRAME_POINTER is not set
 # CONFIG_SH_STANDARD_BIOS is not set
+# CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_KGDB is not set
-# CONFIG_FRAME_POINTER is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -533,7 +687,13 @@
 # CONFIG_CRYPTO is not set
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
-# CONFIG_CRC32 is not set
+# CONFIG_CRC_CCITT is not set
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
diff -Nru a/arch/sh/configs/systemh_defconfig b/arch/sh/configs/systemh_defconfig
--- a/arch/sh/configs/systemh_defconfig	2004-03-23 02:05:26 -08:00
+++ b/arch/sh/configs/systemh_defconfig	2005-03-07 20:41:28 -08:00
@@ -1,35 +1,48 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11-sh
+# Wed Mar  2 15:09:53 2005
 #
 CONFIG_SUPERH=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 
 #
 # Code maturity level options
 #
 CONFIG_EXPERIMENTAL=y
 # CONFIG_CLEAN_COMPILE is not set
-# CONFIG_STANDALONE is not set
 CONFIG_BROKEN=y
 CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 # CONFIG_SYSVIPC is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_SYSCTL is not set
+# CONFIG_AUDIT is not set
 CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_HOTPLUG is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -39,6 +52,7 @@
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
 # CONFIG_KMOD is not set
 
 #
@@ -46,6 +60,8 @@
 #
 # CONFIG_SH_SOLUTION_ENGINE is not set
 # CONFIG_SH_7751_SOLUTION_ENGINE is not set
+# CONFIG_SH_7300_SOLUTION_ENGINE is not set
+# CONFIG_SH_73180_SOLUTION_ENGINE is not set
 CONFIG_SH_7751_SYSTEMH=y
 # CONFIG_SH_STB1_HARP is not set
 # CONFIG_SH_STB1_OVERDRIVE is not set
@@ -62,25 +78,36 @@
 # CONFIG_SH_SH2000 is not set
 # CONFIG_SH_ADX is not set
 # CONFIG_SH_MPC1211 is not set
+# CONFIG_SH_SH03 is not set
 # CONFIG_SH_SECUREEDGE5410 is not set
+# CONFIG_SH_HS7751RVOIP is not set
+# CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_EDOSK7705 is not set
+# CONFIG_SH_SH4202_MICRODEV is not set
 # CONFIG_SH_UNKNOWN is not set
 # CONFIG_CPU_SH2 is not set
 # CONFIG_CPU_SH3 is not set
 CONFIG_CPU_SH4=y
 # CONFIG_CPU_SUBTYPE_SH7604 is not set
 # CONFIG_CPU_SUBTYPE_SH7300 is not set
+# CONFIG_CPU_SUBTYPE_SH7705 is not set
 # CONFIG_CPU_SUBTYPE_SH7707 is not set
 # CONFIG_CPU_SUBTYPE_SH7708 is not set
 # CONFIG_CPU_SUBTYPE_SH7709 is not set
 # CONFIG_CPU_SUBTYPE_SH7750 is not set
 CONFIG_CPU_SUBTYPE_SH7751=y
+# CONFIG_CPU_SUBTYPE_SH7760 is not set
+# CONFIG_CPU_SUBTYPE_SH73180 is not set
 # CONFIG_CPU_SUBTYPE_ST40STB1 is not set
+# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
+# CONFIG_CPU_SUBTYPE_SH4_202 is not set
 CONFIG_MMU=y
 # CONFIG_CMDLINE_BOOL is not set
 CONFIG_MEMORY_START=0x0c000000
 CONFIG_MEMORY_SIZE=0x00400000
 # CONFIG_MEMORY_OVERRIDE is not set
 CONFIG_SH_RTC=y
+CONFIG_SH_FPU=y
 CONFIG_ZERO_PAGE_OFFSET=0x00001000
 CONFIG_BOOT_LINK_OFFSET=0x00800000
 CONFIG_CPU_LITTLE_ENDIAN=y
@@ -90,21 +117,47 @@
 # CONFIG_SH_OCRAM is not set
 # CONFIG_SH_STORE_QUEUES is not set
 # CONFIG_SMP is not set
+CONFIG_SH_PCLK_CALC=y
 CONFIG_SH_PCLK_FREQ=49876504
+
+#
+# CPU Frequency scaling
+#
 # CONFIG_CPU_FREQ is not set
+
+#
+# DMA support
+#
 # CONFIG_SH_DMA is not set
 
 #
+# Companion Chips
+#
+# CONFIG_HD6446X_SERIES is not set
+
+#
 # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
 #
 CONFIG_PCI=y
 # CONFIG_SH_PCIDMA_NONCOHERENT is not set
 CONFIG_PCI_AUTO=y
 CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
-CONFIG_PCI_DMA=y
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
-# CONFIG_HOTPLUG is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+# CONFIG_HOTPLUG_PCI is not set
 
 #
 # Executable file formats
@@ -114,8 +167,20 @@
 # CONFIG_BINFMT_MISC is not set
 
 #
+# SH initrd options
+#
+# CONFIG_EMBEDDED_RAMDISK is not set
+
+#
+# Device Drivers
+#
+
+#
 # Generic Driver Options
 #
+# CONFIG_STANDALONE is not set
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -128,17 +193,35 @@
 # CONFIG_PARPORT is not set
 
 #
+# Plug and Play support
+#
+
+#
 # Block devices
 #
+# CONFIG_BLK_DEV_FD is not set
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
+# CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=1024
 CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -156,19 +239,25 @@
 # CONFIG_MD is not set
 
 #
-# IEEE 1394 (FireWire) support (EXPERIMENTAL)
+# Fusion MPT device support
+#
+
+#
+# IEEE 1394 (FireWire) support
 #
 # CONFIG_IEEE1394 is not set
 
 #
-# Networking support
+# I2O device support
 #
-# CONFIG_NET is not set
+# CONFIG_I2O is not set
 
 #
-# Amateur Radio support
+# Networking support
 #
-# CONFIG_HAMRADIO is not set
+# CONFIG_NET is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 
 #
 # ISDN subsystem
@@ -198,6 +287,8 @@
 # CONFIG_SERIO_SERPORT is not set
 # CONFIG_SERIO_CT82C710 is not set
 # CONFIG_SERIO_PCIPS2 is not set
+# CONFIG_SERIO_LIBPS2 is not set
+# CONFIG_SERIO_RAW is not set
 
 #
 # Input Device Drivers
@@ -207,50 +298,100 @@
 # Character devices
 #
 # CONFIG_VT is not set
-# CONFIG_SERIAL is not set
-CONFIG_SH_SCI=y
-CONFIG_SERIAL_CONSOLE=y
+# CONFIG_SERIAL_NONSTANDARD is not set
 
 #
-# Unix 98 PTY support
+# Serial drivers
 #
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_SH_SCI is not set
 CONFIG_UNIX98_PTYS=y
-CONFIG_UNIX98_PTY_COUNT=256
-# CONFIG_PSMOUSE is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
 
 #
 # Watchdog Cards
 #
 # CONFIG_WATCHDOG is not set
 # CONFIG_RTC is not set
+# CONFIG_GEN_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
 
 #
-# Serial drivers
+# Ftape, the floppy tape device driver
 #
-# CONFIG_SERIAL_8250 is not set
+# CONFIG_DRM is not set
+# CONFIG_RAW_DRIVER is not set
 
 #
-# Non-8250 serial port support
+# I2C support
 #
-# CONFIG_SERIAL_SH_SCI is not set
+# CONFIG_I2C is not set
 
 #
-# I2C support
+# Dallas's 1-wire bus
 #
-# CONFIG_I2C is not set
+# CONFIG_W1 is not set
+
+#
+# Misc devices
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
 
 #
-# I2C Algorithms
+# USB support
+#
+# CONFIG_USB is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
 #
 
 #
-# I2C Hardware Bus support
+# USB Gadget Support
 #
+# CONFIG_USB_GADGET is not set
 
 #
-# I2C Hardware Sensors Chip support
+# MMC/SD Card support
 #
-# CONFIG_I2C_SENSOR is not set
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
 
 #
 # File systems
@@ -260,10 +401,15 @@
 # CONFIG_JBD is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 CONFIG_ROMFS_FS=y
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -276,7 +422,8 @@
 #
 # DOS/FAT/NT Filesystems
 #
-# CONFIG_FAT_FS is not set
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
 # CONFIG_NTFS_FS is not set
 
 #
@@ -284,12 +431,13 @@
 #
 CONFIG_PROC_FS=y
 CONFIG_PROC_KCORE=y
+CONFIG_SYSFS=y
 CONFIG_DEVFS_FS=y
 CONFIG_DEVFS_MOUNT=y
 # CONFIG_DEVFS_DEBUG is not set
-CONFIG_DEVPTS_FS=y
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
@@ -300,6 +448,7 @@
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
@@ -317,29 +466,9 @@
 CONFIG_MSDOS_PARTITION=y
 
 #
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-
-#
-# Digital Video Broadcasting Devices
-#
-
-#
-# Graphics support
+# Native Language Support
 #
-# CONFIG_FB is not set
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-# CONFIG_USB is not set
-# CONFIG_USB_GADGET is not set
+# CONFIG_NLS is not set
 
 #
 # Profiling support
@@ -349,15 +478,17 @@
 #
 # Kernel hacking
 #
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_KERNEL is not set
+CONFIG_DEBUG_PREEMPT=y
+# CONFIG_FRAME_POINTER is not set
 # CONFIG_SH_STANDARD_BIOS is not set
+# CONFIG_EARLY_SCIF_CONSOLE is not set
 # CONFIG_KGDB is not set
-# CONFIG_FRAME_POINTER is not set
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -366,7 +497,13 @@
 # CONFIG_CRYPTO is not set
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
diff -Nru a/arch/sh/defconfig b/arch/sh/defconfig
--- a/arch/sh/defconfig	2004-06-24 01:56:09 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,372 +0,0 @@
-#
-# Automatically generated make config: don't edit
-#
-CONFIG_SUPERH=y
-CONFIG_UID16=y
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-
-#
-# Code maturity level options
-#
-# CONFIG_EXPERIMENTAL is not set
-CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
-CONFIG_BROKEN_ON_SMP=y
-
-#
-# General setup
-#
-CONFIG_SWAP=y
-# CONFIG_SYSVIPC is not set
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_SYSCTL is not set
-CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_IKCONFIG is not set
-CONFIG_EMBEDDED=y
-CONFIG_KALLSYMS=y
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
-
-#
-# Loadable module support
-#
-# CONFIG_MODULES is not set
-
-#
-# System type
-#
-# CONFIG_SH_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SYSTEMH is not set
-# CONFIG_SH_STB1_HARP is not set
-# CONFIG_SH_STB1_OVERDRIVE is not set
-# CONFIG_SH_HP620 is not set
-# CONFIG_SH_HP680 is not set
-# CONFIG_SH_HP690 is not set
-# CONFIG_SH_CQREEK is not set
-# CONFIG_SH_DMIDA is not set
-# CONFIG_SH_EC3104 is not set
-# CONFIG_SH_SATURN is not set
-# CONFIG_SH_DREAMCAST is not set
-# CONFIG_SH_CAT68701 is not set
-# CONFIG_SH_BIGSUR is not set
-# CONFIG_SH_SH2000 is not set
-# CONFIG_SH_ADX is not set
-# CONFIG_SH_MPC1211 is not set
-# CONFIG_SH_SECUREEDGE5410 is not set
-CONFIG_SH_UNKNOWN=y
-# CONFIG_CPU_SH2 is not set
-CONFIG_CPU_SH3=y
-# CONFIG_CPU_SH4 is not set
-# CONFIG_CPU_SUBTYPE_SH7604 is not set
-# CONFIG_CPU_SUBTYPE_SH7300 is not set
-# CONFIG_CPU_SUBTYPE_SH7707 is not set
-CONFIG_CPU_SUBTYPE_SH7708=y
-# CONFIG_CPU_SUBTYPE_SH7709 is not set
-# CONFIG_CPU_SUBTYPE_SH7750 is not set
-# CONFIG_CPU_SUBTYPE_SH7751 is not set
-# CONFIG_CPU_SUBTYPE_SH7760 is not set
-# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
-CONFIG_MMU=y
-# CONFIG_CMDLINE_BOOL is not set
-CONFIG_MEMORY_START=0x0c000000
-CONFIG_MEMORY_SIZE=0x00400000
-# CONFIG_MEMORY_OVERRIDE is not set
-CONFIG_CF_ENABLER=y
-# CONFIG_CF_AREA5 is not set
-CONFIG_CF_AREA6=y
-CONFIG_CF_BASE_ADDR=0xb8000000
-CONFIG_SH_RTC=y
-CONFIG_SH_DSP=y
-CONFIG_ZERO_PAGE_OFFSET=0x00001000
-CONFIG_BOOT_LINK_OFFSET=0x00800000
-CONFIG_CPU_LITTLE_ENDIAN=y
-# CONFIG_UBC_WAKEUP is not set
-# CONFIG_SH_WRITETHROUGH is not set
-# CONFIG_SH_OCRAM is not set
-# CONFIG_SMP is not set
-CONFIG_SH_PCLK_FREQ=1193182
-# CONFIG_CPU_FREQ is not set
-# CONFIG_SH_DMA is not set
-
-#
-# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
-#
-# CONFIG_PCI is not set
-# CONFIG_HOTPLUG is not set
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_FLAT is not set
-# CONFIG_BINFMT_MISC is not set
-
-#
-# Generic Driver Options
-#
-
-#
-# Memory Technology Devices (MTD)
-#
-# CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Block devices
-#
-# CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_DEV_LOOP is not set
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=4096
-CONFIG_BLK_DEV_INITRD=y
-# CONFIG_LBD is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-CONFIG_IDE=y
-CONFIG_BLK_DEV_IDE=y
-
-#
-# Please see Documentation/ide.txt for help/info on IDE drives
-#
-CONFIG_BLK_DEV_IDEDISK=y
-# CONFIG_IDEDISK_MULTI_MODE is not set
-# CONFIG_IDEDISK_STROKE is not set
-# CONFIG_BLK_DEV_IDECD is not set
-# CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_IDE_TASK_IOCTL is not set
-
-#
-# IDE chipset support/bugfixes
-#
-CONFIG_IDE_GENERIC=y
-# CONFIG_BLK_DEV_IDEDMA is not set
-# CONFIG_IDEDMA_AUTO is not set
-# CONFIG_BLK_DEV_HD is not set
-
-#
-# SCSI device support
-#
-# CONFIG_SCSI is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
-# Networking support
-#
-# CONFIG_NET is not set
-
-#
-# Amateur Radio support
-#
-# CONFIG_HAMRADIO is not set
-
-#
-# ISDN subsystem
-#
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-
-#
-# Userland interfaces
-#
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
-# CONFIG_INPUT_EVDEV is not set
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input I/O drivers
-#
-# CONFIG_GAMEPORT is not set
-CONFIG_SOUND_GAMEPORT=y
-CONFIG_SERIO=y
-CONFIG_SERIO_I8042=y
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_CT82C710 is not set
-
-#
-# Input Device Drivers
-#
-CONFIG_INPUT_KEYBOARD=y
-CONFIG_KEYBOARD_ATKBD=y
-# CONFIG_KEYBOARD_SUNKBD is not set
-# CONFIG_KEYBOARD_XTKBD is not set
-# CONFIG_KEYBOARD_NEWTON is not set
-CONFIG_INPUT_MOUSE=y
-CONFIG_MOUSE_PS2=y
-# CONFIG_MOUSE_SERIAL is not set
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_MISC is not set
-
-#
-# Character devices
-#
-# CONFIG_VT is not set
-# CONFIG_SERIAL is not set
-CONFIG_SH_SCI=y
-CONFIG_SERIAL_CONSOLE=y
-
-#
-# Unix98 PTY support
-#
-# CONFIG_UNIX98_PTYS is not set
-# CONFIG_PSMOUSE is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
-# CONFIG_RTC is not set
-
-#
-# Serial drivers
-#
-# CONFIG_SERIAL_8250 is not set
-
-#
-# Non-8250 serial port support
-#
-# CONFIG_SERIAL_SH_SCI is not set
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_JBD is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_JFS_FS is not set
-# CONFIG_XFS_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
-# CONFIG_QUOTA is not set
-# CONFIG_AUTOFS_FS is not set
-# CONFIG_AUTOFS4_FS is not set
-
-#
-# CD-ROM/DVD Filesystems
-#
-# CONFIG_ISO9660_FS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-# CONFIG_FAT_FS is not set
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-# CONFIG_TMPFS is not set
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_CRAMFS is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_SYSV_FS is not set
-# CONFIG_UFS_FS is not set
-
-#
-# Partition Types
-#
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
-# CONFIG_NLS is not set
-
-#
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-
-#
-# Digital Video Broadcasting Devices
-#
-
-#
-# Graphics support
-#
-# CONFIG_FB is not set
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# Kernel hacking
-#
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_DEBUG_SPINLOCK is not set
-CONFIG_SH_STANDARD_BIOS=y
-CONFIG_EARLY_PRINTK=y
-# CONFIG_KGDB is not set
-# CONFIG_FRAME_POINTER is not set
-
-#
-# Security options
-#
-# CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-# CONFIG_CRYPTO is not set
-
-#
-# Library routines
-#
-# CONFIG_CRC32 is not set
diff -Nru a/arch/sh/drivers/pci/fixups-sh03.c b/arch/sh/drivers/pci/fixups-sh03.c
--- a/arch/sh/drivers/pci/fixups-sh03.c	2004-10-18 22:26:43 -07:00
+++ b/arch/sh/drivers/pci/fixups-sh03.c	2005-02-07 12:52:54 -08:00
@@ -46,11 +46,11 @@
 	/* now lookup the actual IRQ on a platform specific basis (pci-'platform'.c) */
 	irq = pcibios_map_platform_irq(slot, pin, dev);
 	if( irq < 0 ) {
-		pr_debug("PCI: Error mapping IRQ on device %s\n", dev->slot_name);
+		pr_debug("PCI: Error mapping IRQ on device %s\n", pci_name(dev));
 		return irq;
 	}
 
-	pr_debug("Setting IRQ for slot %s to %d\n", dev->slot_name, irq);
+	pr_debug("Setting IRQ for slot %s to %d\n", pci_name(dev), irq);
 
 	return irq;
 }
diff -Nru a/arch/sh/drivers/pci/pci-sh7751.c b/arch/sh/drivers/pci/pci-sh7751.c
--- a/arch/sh/drivers/pci/pci-sh7751.c	2004-10-18 22:26:43 -07:00
+++ b/arch/sh/drivers/pci/pci-sh7751.c	2005-03-07 20:41:29 -08:00
@@ -169,7 +169,7 @@
 	 */
 	if ((d->class >> 8) != PCI_CLASS_STORAGE_IDE)
 		return;
-	pr_debug("PCI: IDE base address fixup for %s\n", d->slot_name);
+	pr_debug("PCI: IDE base address fixup for %s\n", pci_name(d));
 	for(i=0; i<4; i++) {
 		struct resource *r = &d->resource[i];
 		if ((r->start & ~0x80) == 0x374) {
@@ -178,8 +178,8 @@
 		}
 	}
 }
+
 DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_ide_bases);
-#endif
 
 /*
  *  Called after each bus is probed, but before its children
@@ -401,11 +401,11 @@
 	/* now lookup the actual IRQ on a platform specific basis (pci-'platform'.c) */
 	irq = pcibios_map_platform_irq(slot,pin);
 	if( irq < 0 ) {
-		pr_debug("PCI: Error mapping IRQ on device %s\n", dev->slot_name);
+		pr_debug("PCI: Error mapping IRQ on device %s\n", pci_name(dev));
 		return irq;
 	}
-	
-	pr_debug("Setting IRQ for slot %s to %d\n", dev->slot_name, irq);
+
+	pr_debug("Setting IRQ for slot %s to %d\n", pci_name(dev), irq);
 
 	return irq;
 }
diff -Nru a/arch/sh/drivers/pci/pci-st40.c b/arch/sh/drivers/pci/pci-st40.c
--- a/arch/sh/drivers/pci/pci-st40.c	2004-10-18 22:26:43 -07:00
+++ b/arch/sh/drivers/pci/pci-st40.c	2005-02-07 12:52:54 -08:00
@@ -246,7 +246,7 @@
 	 */
 	if ((d->class >> 8) != PCI_CLASS_STORAGE_IDE)
 		return;
-	printk("PCI: IDE base address fixup for %s\n", d->slot_name);
+	printk("PCI: IDE base address fixup for %s\n", pci_name(d));
 	for(i=0; i<4; i++) {
 		struct resource *r = &d->resource[i];
 		if ((r->start & ~0x80) == 0x374) {
diff -Nru a/arch/sh/kernel/cpufreq.c b/arch/sh/kernel/cpufreq.c
--- a/arch/sh/kernel/cpufreq.c	2003-09-02 17:19:42 -07:00
+++ b/arch/sh/kernel/cpufreq.c	2005-03-07 20:41:29 -08:00
@@ -3,7 +3,7 @@
  *
  * cpufreq driver for the SuperH processors.
  *
- * Copyright (C) 2002, 2003 Paul Mundt
+ * Copyright (C) 2002, 2003, 2004, 2005 Paul Mundt
  * Copyright (C) 2002 M. R. Brown
  *
  * This program is free software; you can redistribute it and/or modify it
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/cpumask.h>
 #include <linux/smp.h>
 
 #include <asm/processor.h>
@@ -46,9 +47,8 @@
 #endif
 };
 
-#define NR_CLOCK_SETS	(sizeof(clock_sets) / sizeof(struct clock_set))
 #define MIN_CLOCK_SET	0
-#define MAX_CLOCK_SET	(NR_CLOCK_SETS - 1)
+#define MAX_CLOCK_SET	(ARRAY_SIZE(clock_sets) - 1)
 
 /*
  * For the time being, we only support two frequencies, which in turn are
@@ -83,18 +83,16 @@
 static int sh_cpufreq_setstate(unsigned int cpu, unsigned int set)
 {
 	unsigned short frqcr = ctrl_inw(FRQCR);
-	unsigned long cpus_allowed;
+	cpumask_t cpus_allowed;
 	struct cpufreq_freqs freqs;
-	int allowable_cpu_map;
 
 	if (!cpu_online(cpu))
 		return -ENODEV;
 
 	cpus_allowed = current->cpus_allowed;
-	allowable_cpu_map = 1 << cpu;
-	set_cpus_allowed(current, allowable_cpu_map);
-	
-	BUG_ON(!(allowable_cpu_map & (1 << smp_processor_id())));
+	set_cpus_allowed(current, cpumask_of_cpu(cpu));
+
+	BUG_ON(smp_processor_id() != cpu);
 
 	freqs.cpu = cpu;
 	freqs.old = current_cpu_data.cpu_clock / 1000;
@@ -134,7 +132,7 @@
 
 	set_cpus_allowed(current, cpus_allowed);
 	cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
-	
+
 	return 0;
 }
 
diff -Nru a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
--- a/arch/sh/kernel/irq.c	2004-10-20 01:37:14 -07:00
+++ b/arch/sh/kernel/irq.c	2005-03-07 20:41:28 -08:00
@@ -40,58 +40,17 @@
 #include <asm/irq.h>
 #include <linux/irq.h>
 
-/*
- * Controller mappings for all interrupt sources:
- */
-irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
-	[0 ... NR_IRQS-1] = {
-		.handler = &no_irq_type,
-		.lock = SPIN_LOCK_UNLOCKED
-	}
-};
-
-/*
- * Special irq handlers.
- */
 
-irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs)
-{ return IRQ_NONE; }
-
-/*
- * Generic no controller code
- */
-
-static void enable_none(unsigned int irq) { }
-static unsigned int startup_none(unsigned int irq) { return 0; }
-static void disable_none(unsigned int irq) { }
-static void ack_none(unsigned int irq)
-{
 /*
  * 'what should we do if we get a hw irq event on an illegal vector'.
  * each architecture has to answer this themselves, it doesn't deserve
  * a generic callback i think.
  */
+void ack_bad_irq(unsigned int irq)
+{
 	printk("unexpected IRQ trap at vector %02x\n", irq);
 }
 
-/* startup is the same as "enable", shutdown is same as "disable" */
-#define shutdown_none	disable_none
-#define end_none	enable_none
-
-struct hw_interrupt_type no_irq_type = {
-	"none",
-	startup_none,
-	shutdown_none,
-	enable_none,
-	disable_none,
-	ack_none,
-	end_none
-};
-
-/*
- * Generic, controller-independent functions:
- */
-
 #if defined(CONFIG_PROC_FS)
 int show_interrupts(struct seq_file *p, void *v)
 {
@@ -127,210 +86,13 @@
 }
 #endif
 
-/*
- * This should really return information about whether
- * we should do bottom half handling etc. Right now we
- * end up _always_ checking the bottom half, which is a
- * waste of time and is not what some drivers would
- * prefer.
- */
-int handle_IRQ_event(unsigned int irq, struct pt_regs * regs, struct irqaction * action)
-{
-	int status = 1;	/* Force the "do bottom halves" bit */
-	int ret, retval = 0;
-
-	if (!(action->flags & SA_INTERRUPT))
-		local_irq_enable();
-
-	do {
-		ret = action->handler(irq, action->dev_id, regs);
-		if (ret == IRQ_HANDLED)
-			status |= action->flags;
-		retval |= ret;
-		action = action->next;
-	} while (action);
-
-	if (status & SA_SAMPLE_RANDOM)
-		add_interrupt_randomness(irq);
-
-	local_irq_disable();
-	return retval;
-}
-
-static void __report_bad_irq(int irq, irq_desc_t *desc, irqreturn_t action_ret)
-{
-	struct irqaction *action;
-
-	if (action_ret != IRQ_HANDLED && action_ret != IRQ_NONE) {
-		printk(KERN_ERR "irq event %d: bogus return value %x\n",
-				irq, action_ret);
-	} else {
-		printk(KERN_ERR "irq %d: nobody cared!\n", irq);
-	}
-	dump_stack();
-	printk(KERN_ERR "handlers:\n");
-	action = desc->action;
-	do {
-		printk(KERN_ERR "[<%p>]", action->handler);
-		print_symbol(" (%s)",
-			(unsigned long)action->handler);
-		printk("\n");
-		action = action->next;
-	} while (action);
-}
-
-static void report_bad_irq(int irq, irq_desc_t *desc, irqreturn_t action_ret)
-{
-	static int count = 100;
-
-	if (count) {
-		count--;
-		__report_bad_irq(irq, desc, action_ret);
-	}
-}
-
-static int noirqdebug;
-
-static int __init noirqdebug_setup(char *str)
-{
-	noirqdebug = 1;
-	printk("IRQ lockup detection disabled\n");
-	return 1;
-}
-
-__setup("noirqdebug", noirqdebug_setup);
-
-/*
- * If 99,900 of the previous 100,000 interrupts have not been handled then
- * assume that the IRQ is stuck in some manner.  Drop a diagnostic and try to
- * turn the IRQ off.
- *
- * (The other 100-of-100,000 interrupts may have been a correctly-functioning
- *  device sharing an IRQ with the failing one)
- *
- * Called under desc->lock
- */
-static void note_interrupt(int irq, irq_desc_t *desc, irqreturn_t action_ret)
-{
-	if (action_ret != IRQ_HANDLED) {
-		desc->irqs_unhandled++;
-		if (action_ret != IRQ_NONE)
-			report_bad_irq(irq, desc, action_ret);
-	}
-
-	desc->irq_count++;
-	if (desc->irq_count < 100000)
-		return;
-
-	desc->irq_count = 0;
-	if (desc->irqs_unhandled > 99900) {
-		/*
-		 * The interrupt is stuck
-		 */
-		__report_bad_irq(irq, desc, action_ret);
-		/*
-		 * Now kill the IRQ
-		 */
-		printk(KERN_EMERG "Disabling IRQ #%d\n", irq);
-		desc->status |= IRQ_DISABLED;
-		desc->handler->disable(irq);
-	}
-	desc->irqs_unhandled = 0;
-}
-
-/*
- * Generic enable/disable code: this just calls
- * down into the PIC-specific version for the actual
- * hardware disable after having gotten the irq
- * controller lock. 
- */
-inline void disable_irq_nosync(unsigned int irq)
-{
-	irq_desc_t *desc = irq_desc + irq;
-	unsigned long flags;
-
-	spin_lock_irqsave(&desc->lock, flags);
-	if (!desc->depth++) {
-		desc->status |= IRQ_DISABLED;
-		desc->handler->disable(irq);
-	}
-	spin_unlock_irqrestore(&desc->lock, flags);
-}
-
-/*
- * Synchronous version of the above, making sure the IRQ is
- * no longer running on any other IRQ..
- */
-void disable_irq(unsigned int irq)
-{
-	irq_desc_t *desc = irq_desc + irq;
-	disable_irq_nosync(irq);
-	if (desc->action)
-		synchronize_irq(irq);
-}
-
-void enable_irq(unsigned int irq)
-{
-	irq_desc_t *desc = irq_desc + irq;
-	unsigned long flags;
-
-	spin_lock_irqsave(&desc->lock, flags);
-	switch (desc->depth) {
-	case 1: {
-		unsigned int status = desc->status & ~(IRQ_DISABLED | IRQ_INPROGRESS);
-		desc->status = status;
-		if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
-			desc->status = status | IRQ_REPLAY;
-			hw_resend_irq(desc->handler,irq);
-		}
-		desc->handler->enable(irq);
-		/* fall-through */
-	}
-	default:
-		desc->depth--;
-		break;
-	case 0:
-		printk("enable_irq() unbalanced from %p\n",
-		       __builtin_return_address(0));
-	}
-	spin_unlock_irqrestore(&desc->lock, flags);
-}
-
-/*
- * do_IRQ handles all normal device IRQ's.
- */
 asmlinkage int do_IRQ(unsigned long r4, unsigned long r5,
 		      unsigned long r6, unsigned long r7,
 		      struct pt_regs regs)
 {	
-	/* 
-	 * We ack quickly, we don't want the irq controller
-	 * thinking we're snobs just because some other CPU has
-	 * disabled global interrupts (we have already done the
-	 * INT_ACK cycles, it's too late to try to pretend to the
-	 * controller that we aren't taking the interrupt).
-	 *
-	 * 0 return value means that this irq is already being
-	 * handled by some other CPU. (or is disabled)
-	 */
 	int irq;
-	irq_desc_t *desc;
-	struct irqaction * action;
-	unsigned int status;
 
 	irq_enter();
-
-#ifdef CONFIG_PREEMPT
-	/*
-	 * At this point we're now about to actually call handlers,
-	 * and interrupts might get reenabled during them... bump
-	 * preempt_count to prevent any preemption while the handler
-	 * called here is pending...
-	 */
-	preempt_disable();
-#endif
-
-	/* Get IRQ number */
 	asm volatile("stc	r2_bank, %0\n\t"
 		     "shlr2	%0\n\t"
 		     "shlr2	%0\n\t"
@@ -338,394 +100,7 @@
 		     "add	#-16, %0\n\t"
 		     :"=z" (irq));
 	irq = irq_demux(irq);
-
-	kstat_this_cpu.irqs[irq]++;
-	desc = irq_desc + irq;
-	spin_lock(&desc->lock);
-	desc->handler->ack(irq);
-	/*
-	   REPLAY is when Linux resends an IRQ that was dropped earlier
-	   WAITING is used by probe to mark irqs that are being tested
-	   */
-	status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
-	status |= IRQ_PENDING; /* we _want_ to handle it */
-
-	/*
-	 * If the IRQ is disabled for whatever reason, we cannot
-	 * use the action we have.
-	 */
-	action = NULL;
-	if (likely(!(status & (IRQ_DISABLED | IRQ_INPROGRESS)))) {
-		action = desc->action;
-		status &= ~IRQ_PENDING; /* we commit to handling */
-		status |= IRQ_INPROGRESS; /* we are handling it */
-	}
-	desc->status = status;
-
-	/*
-	 * If there is no IRQ handler or it was disabled, exit early.
-	   Since we set PENDING, if another processor is handling
-	   a different instance of this same irq, the other processor
-	   will take care of it.
-	 */
-	if (unlikely(!action))
-		goto out;
-
-	/*
-	 * Edge triggered interrupts need to remember
-	 * pending events.
-	 * This applies to any hw interrupts that allow a second
-	 * instance of the same irq to arrive while we are in do_IRQ
-	 * or in the handler. But the code here only handles the _second_
-	 * instance of the irq, not the third or fourth. So it is mostly
-	 * useful for irq hardware that does not mask cleanly in an
-	 * SMP environment.
-	 */
-	for (;;) {
-		irqreturn_t action_ret;
-
-		spin_unlock(&desc->lock);
-		action_ret = handle_IRQ_event(irq, &regs, action);
-		spin_lock(&desc->lock);
-		if (!noirqdebug)
-			note_interrupt(irq, desc, action_ret);
-		if (likely(!(desc->status & IRQ_PENDING)))
-			break;
-		desc->status &= ~IRQ_PENDING;
-	}
-	desc->status &= ~IRQ_INPROGRESS;
-
-out:
-	/*
-	 * The ->end() handler has to deal with interrupts which got
-	 * disabled while the handler was running.
-	 */
-	desc->handler->end(irq);
-	spin_unlock(&desc->lock);
-
+	__do_IRQ(irq, &regs);
 	irq_exit();
-
-#ifdef CONFIG_PREEMPT
-	/*
-	 * We're done with the handlers, interrupts should be
-	 * currently disabled; decrement preempt_count now so
-	 * as we return preemption may be allowed...
-	 */
-	preempt_enable_no_resched();
-#endif
-
 	return 1;
 }
-
-int request_irq(unsigned int irq, 
-		irqreturn_t (*handler)(int, void *, struct pt_regs *),
-		unsigned long irqflags, 
-		const char * devname,
-		void *dev_id)
-{
-	int retval;
-	struct irqaction * action;
-
-	if (irq >= ACTUAL_NR_IRQS)
-		return -EINVAL;
-	if (!handler)
-		return -EINVAL;
-
-	action = (struct irqaction *)
-			kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
-	if (!action)
-		return -ENOMEM;
-
-	action->handler = handler;
-	action->flags = irqflags;
-	cpus_clear(action->mask);
-	action->name = devname;
-	action->next = NULL;
-	action->dev_id = dev_id;
-
-	retval = setup_irq(irq, action);
-	if (retval)
-		kfree(action);
-	return retval;
-}
-
-EXPORT_SYMBOL(request_irq);
-
-void free_irq(unsigned int irq, void *dev_id)
-{
-	irq_desc_t *desc;
-	struct irqaction **p;
-	unsigned long flags;
-
-	if (irq >= ACTUAL_NR_IRQS)
-		return;
-
-	desc = irq_desc + irq;
-	spin_lock_irqsave(&desc->lock,flags);
-	p = &desc->action;
-	for (;;) {
-		struct irqaction * action = *p;
-		if (action) {
-			struct irqaction **pp = p;
-			p = &action->next;
-			if (action->dev_id != dev_id)
-				continue;
-
-			/* Found it - now remove it from the list of entries */
-			*pp = action->next;
-			if (!desc->action) {
-				desc->status |= IRQ_DISABLED;
-				desc->handler->shutdown(irq);
-			}
-			spin_unlock_irqrestore(&desc->lock,flags);
-			synchronize_irq(irq);
-			kfree(action);
-			return;
-		}
-		printk("Trying to free free IRQ%d\n",irq);
-		spin_unlock_irqrestore(&desc->lock,flags);
-		return;
-	}
-}
-
-EXPORT_SYMBOL(free_irq);
-
-static DECLARE_MUTEX(probe_sem);
-
-/*
- * IRQ autodetection code..
- *
- * This depends on the fact that any interrupt that
- * comes in on to an unassigned handler will get stuck
- * with "IRQ_WAITING" cleared and the interrupt
- * disabled.
- */
-unsigned long probe_irq_on(void)
-{
-	unsigned int i;
-	irq_desc_t *desc;
-	unsigned long val;
-	unsigned long delay;
-
-	down(&probe_sem);
-	/* 
-	 * something may have generated an irq long ago and we want to
-	 * flush such a longstanding irq before considering it as spurious. 
-	 */
-	for (i = NR_IRQS-1; i > 0; i--) {
-		desc = irq_desc + i;
-
-		spin_lock_irq(&desc->lock);
-		if (!desc->action)
-			desc->handler->startup(i);
-		spin_unlock_irq(&desc->lock);
-	}
-
-	/* Wait for longstanding interrupts to trigger. */
-	for (delay = jiffies + HZ/50; time_after(delay, jiffies); )
-		/* about 20ms delay */ barrier();
-
-	/*
-	 * enable any unassigned irqs
-	 * (we must startup again here because if a longstanding irq
-	 * happened in the previous stage, it may have masked itself)
-	 */
-	for (i = NR_IRQS-1; i > 0; i--) {
-		desc = irq_desc + i;
-
-		spin_lock_irq(&desc->lock);
-		if (!desc->action) {
-			desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
-			if (desc->handler->startup(i))
-				desc->status |= IRQ_PENDING;
-		}
-		spin_unlock_irq(&desc->lock);
-	}
-
-	/*
-	 * Wait for spurious interrupts to trigger
-	 */
-	for (delay = jiffies + HZ/10; time_after(delay, jiffies); )
-		/* about 100ms delay */ barrier();
-
-	/*
-	 * Now filter out any obviously spurious interrupts
-	 */
-	val = 0;
-	for (i=0; i<NR_IRQS; i++) {
-		unsigned int status;
-
-		desc = irq_desc + i;
-
-		spin_lock_irq(&desc->lock);
-		status = desc->status;
-
-		if (status & IRQ_AUTODETECT) {
-			/* It triggered already - consider it spurious. */
-			if (!(status & IRQ_WAITING)) {
-				desc->status = status & ~IRQ_AUTODETECT;
-				desc->handler->shutdown(i);
-			} else
-				if (i < 32)
-					val |= 1 << i;
-		}
-		spin_unlock_irq(&desc->lock);
-	}
-
-	return val;
-}
-
-EXPORT_SYMBOL(probe_irq_on);
-
-/* Return a mask of triggered interrupts (this
- * can handle only legacy ISA interrupts).
- */
-
-/*
- *	probe_irq_mask - scan a bitmap of interrupt lines
- *	@val:	mask of interrupts to consider
- *
- *	Scan the ISA bus interrupt lines and return a bitmap of
- *	active interrupts. The interrupt probe logic state is then
- *	returned to its previous value.
- *
- *	Note: we need to scan all the irq's even though we will
- *	only return ISA irq numbers - just so that we reset them
- *	all to a known state.
- */
-unsigned int probe_irq_mask(unsigned long val)
-{
-	int i;
-	unsigned int mask;
-
-	mask = 0;
-	for (i = 0; i < NR_IRQS; i++) {
-		irq_desc_t *desc = irq_desc + i;
-		unsigned int status;
-
-		spin_lock_irq(&desc->lock);
-		status = desc->status;
-
-		if (status & IRQ_AUTODETECT) {
-			if (i < 16 && !(status & IRQ_WAITING))
-				mask |= 1 << i;
-
-			desc->status = status & ~IRQ_AUTODETECT;
-			desc->handler->shutdown(i);
-		}
-		spin_unlock_irq(&desc->lock);
-	}
-	up(&probe_sem);
-
-	return mask & val;
-}
-
-int probe_irq_off(unsigned long val)
-{
-	int i, irq_found, nr_irqs;
-
-	nr_irqs = 0;
-	irq_found = 0;
-	for (i=0; i<NR_IRQS; i++) {
-		irq_desc_t *desc = irq_desc + i;
-		unsigned int status;
-
-		spin_lock_irq(&desc->lock);
-		status = desc->status;
-
-		if (status & IRQ_AUTODETECT) {
-			if (!(status & IRQ_WAITING)) {
-				if (!nr_irqs)
-					irq_found = i;
-				nr_irqs++;
-			}
-			desc->status = status & ~IRQ_AUTODETECT;
-			desc->handler->shutdown(i);
-		}
-		spin_unlock_irq(&desc->lock);
-	}
-	up(&probe_sem);
-
-	if (nr_irqs > 1)
-		irq_found = -irq_found;
-	return irq_found;
-}
-
-EXPORT_SYMBOL(probe_irq_off);
-
-int setup_irq(unsigned int irq, struct irqaction * new)
-{
-	int shared = 0;
-	struct irqaction *old, **p;
-	unsigned long flags;
-	irq_desc_t *desc = irq_desc + irq;
-
-	if (desc->handler == &no_irq_type)
-		return -ENOSYS;
- 	/*
-	 * Some drivers like serial.c use request_irq() heavily,
-	 * so we have to be careful not to interfere with a
-	 * running system.
-	 */
-	if (new->flags & SA_SAMPLE_RANDOM) {
-		/*
-		 * This function might sleep, we want to call it first,
-		 * outside of the atomic block.
-		 * Yes, this might clear the entropy pool if the wrong
-		 * driver is attempted to be loaded, without actually
-		 * installing a new handler, but is this really a problem,
-		 * only the sysadmin is able to do this.
-		 */
-		rand_initialize_irq(irq);
-	}
-
-	/*
-	 * The following block of code has to be executed atomically
-	 */
-	spin_lock_irqsave(&desc->lock,flags);
-	p = &desc->action;
-	if ((old = *p) != NULL) {
-		/* Can't share interrupts unless both agree to */
-		if (!(old->flags & new->flags & SA_SHIRQ)) {
-			spin_unlock_irqrestore(&desc->lock,flags);
-			return -EBUSY;
-		}
-
-		/* add new interrupt at end of irq queue */
-		do {
-			p = &old->next;
-			old = *p;
-		} while (old);
-		shared = 1;
-	}
-
-	*p = new;
-
-	if (!shared) {
-		desc->depth = 0;
-		desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | IRQ_WAITING | IRQ_INPROGRESS);
-		desc->handler->startup(irq);
-	}
-	spin_unlock_irqrestore(&desc->lock,flags);
-	return 0;
-}
-
-#if defined(CONFIG_PROC_FS) && defined(CONFIG_SYSCTL)
-
-void init_irq_proc(void)
-{
-}
-#endif
-
-/* Taken from the 2.5 alpha port */
-#ifdef CONFIG_SMP
-void synchronize_irq(unsigned int irq)
-{
-	/* is there anything to synchronize with? */
-	if (!irq_desc[irq].action)
-		return;
-
-	while (irq_desc[irq].status & IRQ_INPROGRESS)
-		barrier();
-}
-#endif
diff -Nru a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c
--- a/arch/sh/kernel/ptrace.c	2005-01-30 22:20:14 -08:00
+++ b/arch/sh/kernel/ptrace.c	2005-03-07 20:41:29 -08:00
@@ -1,5 +1,4 @@
-/* $Id: ptrace.c,v 1.15 2004/05/07 05:32:05 sugioka Exp $
- *
+/*
  * linux/arch/sh/kernel/ptrace.c
  *
  * Original x86 implementation:
diff -Nru a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c
--- a/arch/sh/kernel/sh_ksyms.c	2005-01-07 21:44:07 -08:00
+++ b/arch/sh/kernel/sh_ksyms.c	2005-03-07 20:41:29 -08:00
@@ -65,13 +65,6 @@
 EXPORT_SYMBOL(memcmp);
 EXPORT_SYMBOL(memscan);
 EXPORT_SYMBOL(__copy_user);
-
-#ifdef CONFIG_VT
-/* XXX: MRB-remove - what was screen_info changed to?
-EXPORT_SYMBOL(screen_info);
-*/
-#endif
-
 EXPORT_SYMBOL(boot_cpu_data);
 
 #ifdef CONFIG_MMU
diff -Nru a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c
--- a/arch/sh/kernel/signal.c	2005-01-30 22:20:14 -08:00
+++ b/arch/sh/kernel/signal.c	2005-03-07 20:41:29 -08:00
@@ -1,5 +1,4 @@
-/* $Id: signal.c,v 1.21 2004/06/28 13:18:44 doyu Exp $
- *
+/*
  *  linux/arch/sh/kernel/signal.c
  *
  *  Copyright (C) 1991, 1992  Linus Torvalds
@@ -341,8 +340,10 @@
 static inline void __user *
 get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
 {
-	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && ! on_sig_stack(sp))
-		sp = current->sas_ss_sp + current->sas_ss_size;
+	if (ka->sa.sa_flags & SA_ONSTACK) {
+		if (sas_ss_flags(sp) == 0)
+			sp = current->sas_ss_sp + current->sas_ss_size;
+	}
 
 	return (void __user *)((sp - frame_size) & -8ul);
 }
diff -Nru a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
--- a/arch/sh/kernel/time.c	2005-01-20 21:02:09 -08:00
+++ b/arch/sh/kernel/time.c	2005-03-07 20:41:29 -08:00
@@ -33,6 +33,7 @@
 #include <asm/machvec.h>
 #include <asm/rtc.h>
 #include <asm/freq.h>
+#include <asm/cpu/timer.h>
 #ifdef CONFIG_SH_KGDB
 #include <asm/kgdb.h>
 #endif
@@ -46,40 +47,10 @@
 
 #define TMU0_TCR_CALIB	0x0000
 
-#if defined(CONFIG_CPU_SH3)
-#if defined(CONFIG_CPU_SUBTYPE_SH7300)
-#define TMU_TSTR        0xA412FE92      /* Byte access */
-
-#define TMU0_TCOR       0xA412FE94      /* Long access */
-#define TMU0_TCNT       0xA412FE98      /* Long access */
-#define TMU0_TCR        0xA412FE9C      /* Word access */
-
-#define TMU1_TCOR	0xA412FEA0	/* Long access */
-#define TMU1_TCNT	0xA412FEA4	/* Long access */
-#define TMU1_TCR	0xA412FEA8	/* Word access */
-
-#define FRQCR           0xA415FF80
-#else
-#define TMU_TOCR	0xfffffe90	/* Byte access */
-#define TMU_TSTR	0xfffffe92	/* Byte access */
-
-#define TMU0_TCOR	0xfffffe94	/* Long access */
-#define TMU0_TCNT	0xfffffe98	/* Long access */
-#define TMU0_TCR	0xfffffe9c	/* Word access */
-#endif
-#elif defined(CONFIG_CPU_SH4)
-#define TMU_TOCR	0xffd80000	/* Byte access */
-#define TMU_TSTR	0xffd80004	/* Byte access */
-
-#define TMU0_TCOR	0xffd80008	/* Long access */
-#define TMU0_TCNT	0xffd8000c	/* Long access */
-#define TMU0_TCR	0xffd80010	/* Word access */
-
 #ifdef CONFIG_CPU_SUBTYPE_ST40STB1
 #define CLOCKGEN_MEMCLKCR 0xbb040038
 #define MEMCLKCR_RATIO_MASK 0x7
 #endif /* CONFIG_CPU_SUBTYPE_ST40STB1 */
-#endif /* CONFIG_CPU_SH3 or CONFIG_CPU_SH4 */
 
 extern unsigned long wall_jiffies;
 #define TICK_SIZE (tick_nsec / 1000)
@@ -272,7 +243,7 @@
 	profile_tick(CPU_PROFILING, regs);
 
 #ifdef CONFIG_HEARTBEAT
-	if (sh_mv.mv_heartbeat != NULL) 
+	if (sh_mv.mv_heartbeat != NULL)
 		sh_mv.mv_heartbeat();
 #endif
 
diff -Nru a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
--- a/arch/sh/mm/cache-sh4.c	2004-10-18 22:26:44 -07:00
+++ b/arch/sh/mm/cache-sh4.c	2005-03-05 21:23:02 -08:00
@@ -258,10 +258,16 @@
 	flush_cache_all();
 }
 
-static void __flush_cache_page(struct vm_area_struct *vma,
-			       unsigned long address,
-			       unsigned long phys)
+/*
+ * Write back and invalidate I/D-caches for the page.
+ *
+ * ADDR: Virtual Address (U0 address)
+ * PFN: Physical page number
+ */
+void flush_cache_page(struct vm_area_struct *vma, unsigned long address, unsigned long pfn)
 {
+	unsigned long phys = pfn << PAGE_SHIFT;
+
 	/* We only need to flush D-cache when we have alias */
 	if ((address^phys) & CACHE_ALIAS) {
 		/* Loop 4K of the D-cache */
@@ -342,32 +348,6 @@
 }
 
 /*
- * Write back and invalidate I/D-caches for the page.
- *
- * ADDR: Virtual Address (U0 address)
- */
-void flush_cache_page(struct vm_area_struct *vma, unsigned long address)
-{
-	pgd_t *dir;
-	pmd_t *pmd;
-	pte_t *pte;
-	pte_t entry;
-	unsigned long phys;
-
-	dir = pgd_offset(vma->vm_mm, address);
-	pmd = pmd_offset(dir, address);
-	if (pmd_none(*pmd) || pmd_bad(*pmd))
-		return;
-	pte = pte_offset_kernel(pmd, address);
-	entry = *pte;
-	if (!(pte_val(entry) & _PAGE_PRESENT))
-		return;
-
-	phys = pte_val(entry)&PTE_PHYS_MASK;
-	__flush_cache_page(vma, address, phys);
-}
-
-/*
  * flush_icache_user_range
  * @vma: VMA of the process
  * @page: page
@@ -377,6 +357,6 @@
 void flush_icache_user_range(struct vm_area_struct *vma,
 			     struct page *page, unsigned long addr, int len)
 {
-	__flush_cache_page(vma, addr, PHYSADDR(page_address(page)));
+	flush_cache_page(vma, addr, page_to_pfn(page));
 }
 
diff -Nru a/arch/sh/mm/cache-sh7705.c b/arch/sh/mm/cache-sh7705.c
--- a/arch/sh/mm/cache-sh7705.c	2004-10-18 22:26:41 -07:00
+++ b/arch/sh/mm/cache-sh7705.c	2005-02-25 16:35:19 -08:00
@@ -186,25 +186,9 @@
  *
  * ADDRESS: Virtual Address (U0 address)
  */
-void flush_cache_page(struct vm_area_struct *vma, unsigned long address)
+void flush_cache_page(struct vm_area_struct *vma, unsigned long address, unsigned long pfn)
 {
-	pgd_t *dir;
-	pmd_t *pmd;
-	pte_t *pte;
-	pte_t entry;
-	unsigned long phys;
-
-	dir = pgd_offset(vma->vm_mm, address);
-	pmd = pmd_offset(dir, address);
-	if (pmd_none(*pmd) || pmd_bad(*pmd))
-		return;
-	pte = pte_offset(pmd, address);
-	entry = *pte;
-	if (pte_none(entry) || !pte_present(entry))
-		return;
-
-	phys = pte_val(entry)&PTE_PHYS_MASK;
-	__flush_dcache_page(phys);
+	__flush_dcache_page(pfn << PAGE_SHIFT);
 }
 
 /*
diff -Nru a/arch/sh/mm/hugetlbpage.c b/arch/sh/mm/hugetlbpage.c
--- a/arch/sh/mm/hugetlbpage.c	2004-05-10 04:25:53 -07:00
+++ b/arch/sh/mm/hugetlbpage.c	2005-02-23 15:40:52 -08:00
@@ -202,7 +202,7 @@
 		page = pte_page(*pte);
 		put_page(page);
 		for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
-			pte_clear(pte);
+			pte_clear(mm, address+(i*PAGE_SIZE), pte);
 			pte++;
 		}
 	}
diff -Nru a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c
--- a/arch/sh/mm/pg-sh4.c	2004-06-24 01:56:10 -07:00
+++ b/arch/sh/mm/pg-sh4.c	2005-02-23 15:40:52 -08:00
@@ -56,7 +56,7 @@
 		local_irq_restore(flags);
 		update_mmu_cache(NULL, p3_addr, entry);
 		__clear_user_page((void *)p3_addr, to);
-		pte_clear(pte);
+		pte_clear(&init_mm, p3_addr, pte);
 		up(&p3map_sem[(address & CACHE_ALIAS)>>12]);
 	}
 }
@@ -95,7 +95,7 @@
 		local_irq_restore(flags);
 		update_mmu_cache(NULL, p3_addr, entry);
 		__copy_user_page((void *)p3_addr, from, to);
-		pte_clear(pte);
+		pte_clear(&init_mm, p3_addr, pte);
 		up(&p3map_sem[(address & CACHE_ALIAS)>>12]);
 	}
 }
@@ -103,11 +103,11 @@
 /*
  * For SH-4, we have our own implementation for ptep_get_and_clear
  */
-inline pte_t ptep_get_and_clear(pte_t *ptep)
+inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	pte_t pte = *ptep;
 
-	pte_clear(ptep);
+	pte_clear(mm, addr, ptep);
 	if (!pte_not_present(pte)) {
 		unsigned long pfn = pte_pfn(pte);
 		if (pfn_valid(pfn)) {
diff -Nru a/arch/sh/mm/pg-sh7705.c b/arch/sh/mm/pg-sh7705.c
--- a/arch/sh/mm/pg-sh7705.c	2004-10-18 22:26:41 -07:00
+++ b/arch/sh/mm/pg-sh7705.c	2005-02-23 15:40:52 -08:00
@@ -117,11 +117,11 @@
  * For SH7705, we have our own implementation for ptep_get_and_clear
  * Copied from pg-sh4.c
  */
-inline pte_t ptep_get_and_clear(pte_t *ptep)
+inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	pte_t pte = *ptep;
 
-	pte_clear(ptep);
+	pte_clear(mm, addr, ptep);
 	if (!pte_not_present(pte)) {
 		unsigned long pfn = pte_pfn(pte);
 		if (pfn_valid(pfn)) {
diff -Nru a/arch/sh64/Kconfig b/arch/sh64/Kconfig
--- a/arch/sh64/Kconfig	2005-01-04 18:48:07 -08:00
+++ b/arch/sh64/Kconfig	2005-03-07 20:41:28 -08:00
@@ -98,7 +98,12 @@
 
 endchoice
 
+config SH_FPU
+	bool "FPU support"
+	default y
+
 config SH64_FPU_DENORM_FLUSH
+	depends on SH_FPU
 	bool "Flush floating point denorms to zero"
 
 choice
@@ -274,3 +279,15 @@
 source "crypto/Kconfig"
 
 source "lib/Kconfig"
+
+#
+# Use the generic interrupt handling code in kernel/irq/:
+#
+config GENERIC_HARDIRQS
+	bool
+	default y
+
+config GENERIC_IRQ_PROBE
+	bool
+	default y
+
diff -Nru a/arch/sh64/Kconfig.debug b/arch/sh64/Kconfig.debug
--- a/arch/sh64/Kconfig.debug	2004-08-15 12:45:35 -07:00
+++ b/arch/sh64/Kconfig.debug	2005-03-07 20:41:28 -08:00
@@ -19,6 +19,13 @@
 config SH64_SR_WATCH
 	bool "Debug: set SR.WATCH to enable hardware watchpoints and trace"
 
+config POOR_MANS_STRACE
+	bool "Debug: enable rudimentary strace facility"
+	help
+	  This option allows system calls to be traced to the console.  It also
+	  aids in detecting kernel stack underflow.  It is useful for debugging
+	  early-userland problems (e.g. init incurring fatal exceptions.)
+
 config SH_ALPHANUMERIC
 	bool "Enable debug outputs to on-board alphanumeric display"
 
diff -Nru a/arch/sh64/Makefile b/arch/sh64/Makefile
--- a/arch/sh64/Makefile	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/Makefile	2005-03-07 20:41:28 -08:00
@@ -11,13 +11,6 @@
 # for "archclean" and "archdep" for cleaning up and making dependencies for
 # this architecture
 #
-# Note that top level Makefile automagically builds dependencies for SUBDIRS
-# but does not automagically clean SUBDIRS. Therefore "archclean" should clean
-# up all, "archdep" does nothing on added SUBDIRS.
-#
-ifndef include_config
--include .config
-endif
 
 cpu-y				:= -mb
 cpu-$(CONFIG_LITTLE_ENDIAN)	:= -ml
@@ -37,10 +30,17 @@
 CFLAGS		+= $(cpu-y)
 
 LDFLAGS_vmlinux	+= --defsym phys_stext=_stext-$(CONFIG_CACHED_MEMORY_OFFSET) \
-		   -e phys_stext
+		  --defsym phys_stext_shmedia=phys_stext+1 \
+		  -e phys_stext_shmedia
 
 OBJCOPYFLAGS	:= -O binary -R .note -R .comment -R .stab -R .stabstr -S
 
+#
+# arch/sh64/defconfig never had any hope of being
+# frequently updated, so use one that does
+#
+KBUILD_DEFCONFIG	:= cayman_defconfig
+
 ifdef LOADADDR
 LINKFLAGS     += -Ttext $(word 1,$(LOADADDR))
 endif
@@ -52,7 +52,11 @@
 
 head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
 
-core-y += $(addprefix arch/$(ARCH)/, kernel/ mm/ mach-$(machine-y)/)
+core-y	+= arch/sh64/kernel/ arch/sh64/mm/
+
+ifneq ($(machine-y),)
+core-y	+= arch/sh64/mach-$(machine-y)/
+endif
 
 LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
 libs-y	+= arch/$(ARCH)/lib/ $(LIBGCC)
@@ -92,7 +96,7 @@
 	echo "struct syscall_info {"; \
 	echo "	const char *name;"; \
 	echo "} syscall_info_table[] = {"; \
-	sed -e '/^.*\.long /!d;s//\t{ "/;s/\(\([^/]*\)\/\)\{1\}.*/\2/; \
+	sed -e '/^.*\.long /!d;s//    { "/;s/\(\([^/]*\)\/\)\{1\}.*/\2/; \
 		s/[ \t]*$$//g;s/$$/" },/;s/\("\)sys_/\1/g'; \
 	echo "};"; \
 	echo ""; \
diff -Nru a/arch/sh64/configs/cayman_defconfig b/arch/sh64/configs/cayman_defconfig
--- a/arch/sh64/configs/cayman_defconfig	2004-08-09 16:41:37 -07:00
+++ b/arch/sh64/configs/cayman_defconfig	2005-03-07 20:41:26 -08:00
@@ -1,11 +1,14 @@
 #
 # Automatically generated make config: don't edit
+# Linux kernel version: 2.6.11
+# Fri Feb 25 18:14:31 2005
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH64=y
 CONFIG_MMU=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_LOG_BUF_SHIFT=14
 
 #
@@ -13,12 +16,12 @@
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
 CONFIG_BROKEN_ON_SMP=y
 
 #
 # General setup
 #
+CONFIG_LOCALVERSION=""
 CONFIG_SWAP=y
 # CONFIG_SYSVIPC is not set
 CONFIG_POSIX_MQUEUE=y
@@ -26,16 +29,21 @@
 CONFIG_SYSCTL=y
 # CONFIG_AUDIT is not set
 # CONFIG_HOTPLUG is not set
+CONFIG_KOBJECT_UEVENT=y
 # CONFIG_IKCONFIG is not set
 # CONFIG_EMBEDDED is not set
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
 
 #
 # Loadable module support
@@ -50,15 +58,12 @@
 CONFIG_SH_CAYMAN=y
 # CONFIG_SH_ROMRAM is not set
 # CONFIG_SH_HARP is not set
-
-#
-# Processor type and features
-#
 CONFIG_CPU_SH5=y
 CONFIG_CPU_SUBTYPE_SH5_101=y
 # CONFIG_CPU_SUBTYPE_SH5_103 is not set
 CONFIG_LITTLE_ENDIAN=y
 # CONFIG_BIG_ENDIAN is not set
+CONFIG_SH_FPU=y
 # CONFIG_SH64_FPU_DENORM_FLUSH is not set
 CONFIG_SH64_PGTABLE_2_LEVEL=y
 # CONFIG_SH64_PGTABLE_3_LEVEL is not set
@@ -102,12 +107,27 @@
 #
 # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
 #
+CONFIG_SUPERHYWAY=y
 CONFIG_PCI=y
 CONFIG_SH_PCIDMA_NONCOHERENT=y
 CONFIG_PCI_LEGACY_PROC=y
 CONFIG_PCI_NAMES=y
 
 #
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# PC-card bridges
+#
+
+#
+# PCI Hotplug Support
+#
+# CONFIG_HOTPLUG_PCI is not set
+
+#
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
@@ -121,6 +141,10 @@
 #
 # Generic Driver Options
 #
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER is not set
 
 #
 # Memory Technology Devices (MTD)
@@ -144,14 +168,27 @@
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
 # CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_CARMEL is not set
+# CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 # CONFIG_BLK_DEV_INITRD is not set
+CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_LBD is not set
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+# CONFIG_ATA_OVER_ETH is not set
 
 #
 # ATA/ATAPI/MFM/RLL support
@@ -161,7 +198,74 @@
 #
 # SCSI device support
 #
-# CONFIG_SCSI is not set
+CONFIG_SCSI=y
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+# CONFIG_CHR_DEV_SG is not set
+
+#
+# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
+#
+CONFIG_SCSI_MULTI_LUN=y
+# CONFIG_SCSI_CONSTANTS is not set
+# CONFIG_SCSI_LOGGING is not set
+
+#
+# SCSI Transport Attributes
+#
+CONFIG_SCSI_SPI_ATTRS=y
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+
+#
+# SCSI low-level drivers
+#
+# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_ACARD is not set
+# CONFIG_SCSI_AACRAID is not set
+# CONFIG_SCSI_AIC7XXX is not set
+# CONFIG_SCSI_AIC7XXX_OLD is not set
+# CONFIG_SCSI_AIC79XX is not set
+# CONFIG_SCSI_DPT_I2O is not set
+# CONFIG_MEGARAID_NEWGEN is not set
+# CONFIG_MEGARAID_LEGACY is not set
+# CONFIG_SCSI_SATA is not set
+# CONFIG_SCSI_BUSLOGIC is not set
+# CONFIG_SCSI_DMX3191D is not set
+# CONFIG_SCSI_EATA is not set
+# CONFIG_SCSI_EATA_PIO is not set
+# CONFIG_SCSI_FUTURE_DOMAIN is not set
+# CONFIG_SCSI_GDTH is not set
+# CONFIG_SCSI_IPS is not set
+# CONFIG_SCSI_INITIO is not set
+# CONFIG_SCSI_INIA100 is not set
+CONFIG_SCSI_SYM53C8XX_2=y
+CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
+CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
+CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
+# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
+# CONFIG_SCSI_IPR is not set
+# CONFIG_SCSI_QLOGIC_ISP is not set
+# CONFIG_SCSI_QLOGIC_FC is not set
+# CONFIG_SCSI_QLOGIC_1280 is not set
+CONFIG_SCSI_QLA2XXX=y
+# CONFIG_SCSI_QLA21XX is not set
+# CONFIG_SCSI_QLA22XX is not set
+# CONFIG_SCSI_QLA2300 is not set
+# CONFIG_SCSI_QLA2322 is not set
+# CONFIG_SCSI_QLA6312 is not set
+# CONFIG_SCSI_DC395x is not set
+# CONFIG_SCSI_DC390T is not set
+# CONFIG_SCSI_NSP32 is not set
+# CONFIG_SCSI_DEBUG is not set
 
 #
 # Multi-device support (RAID and LVM)
@@ -171,6 +275,7 @@
 #
 # Fusion MPT device support
 #
+# CONFIG_FUSION is not set
 
 #
 # IEEE 1394 (FireWire) support
@@ -209,6 +314,9 @@
 # CONFIG_INET_AH is not set
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_IP_TCPDIAG=y
+# CONFIG_IP_TCPDIAG_IPV6 is not set
 # CONFIG_IPV6 is not set
 # CONFIG_NETFILTER is not set
 
@@ -228,12 +336,12 @@
 # CONFIG_NET_DIVERT is not set
 # CONFIG_ECONET is not set
 # CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
 
 #
 # QoS and/or fair queueing
 #
 # CONFIG_NET_SCHED is not set
+# CONFIG_NET_CLS_ROUTE is not set
 
 #
 # Network testing
@@ -309,6 +417,7 @@
 # CONFIG_YELLOWFIN is not set
 # CONFIG_R8169 is not set
 # CONFIG_SK98LIN is not set
+# CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
 
 #
@@ -335,6 +444,7 @@
 # CONFIG_HIPPI is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
 # CONFIG_SHAPER is not set
 # CONFIG_NETCONSOLE is not set
 
@@ -375,6 +485,8 @@
 CONFIG_SERIO_SERPORT=y
 # CONFIG_SERIO_CT82C710 is not set
 # CONFIG_SERIO_PCIPS2 is not set
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
 
 #
 # Input Device Drivers
@@ -416,7 +528,6 @@
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-# CONFIG_QIC02_TAPE is not set
 
 #
 # IPMI
@@ -449,8 +560,6 @@
 #
 # Ftape, the floppy tape device driver
 #
-# CONFIG_FTAPE is not set
-# CONFIG_AGP is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
 
@@ -460,6 +569,11 @@
 # CONFIG_I2C is not set
 
 #
+# Dallas's 1-wire bus
+#
+# CONFIG_W1 is not set
+
+#
 # Misc devices
 #
 
@@ -477,17 +591,21 @@
 # Graphics support
 #
 CONFIG_FB=y
+CONFIG_FB_MODE_HELPERS=y
+# CONFIG_FB_TILEBLITTING is not set
+# CONFIG_FB_CIRRUS is not set
 # CONFIG_FB_PM2 is not set
 # CONFIG_FB_CYBER2000 is not set
 # CONFIG_FB_ASILIANT is not set
 # CONFIG_FB_IMSTT is not set
-# CONFIG_FB_E1355 is not set
+# CONFIG_FB_EPSON1355 is not set
 # CONFIG_FB_RIVA is not set
 # CONFIG_FB_MATROX is not set
 # CONFIG_FB_RADEON_OLD is not set
 # CONFIG_FB_RADEON is not set
 # CONFIG_FB_ATY128 is not set
 # CONFIG_FB_ATY is not set
+# CONFIG_FB_SAVAGE is not set
 # CONFIG_FB_SIS is not set
 # CONFIG_FB_NEOMAGIC is not set
 CONFIG_FB_KYRO=y
@@ -500,10 +618,8 @@
 # Console display driver support
 #
 # CONFIG_VGA_CONSOLE is not set
-# CONFIG_MDA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
 CONFIG_FONTS=y
 # CONFIG_FONT_8x8 is not set
 CONFIG_FONT_8x16=y
@@ -524,6 +640,7 @@
 # CONFIG_LOGO_SUPERH_MONO is not set
 # CONFIG_LOGO_SUPERH_VGA16 is not set
 CONFIG_LOGO_SUPERH_CLUT224=y
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
 # Sound
@@ -534,6 +651,12 @@
 # USB support
 #
 # CONFIG_USB is not set
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+#
 
 #
 # USB Gadget Support
@@ -541,18 +664,38 @@
 # CONFIG_USB_GADGET is not set
 
 #
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# InfiniBand support
+#
+# CONFIG_INFINIBAND is not set
+
+#
 # File systems
 #
 CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_JBD is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+CONFIG_FS_MBCACHE=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
+
+#
+# XFS support
+#
 # CONFIG_XFS_FS is not set
 CONFIG_MINIX_FS=y
 CONFIG_ROMFS_FS=y
 # CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 
@@ -565,7 +708,8 @@
 #
 # DOS/FAT/NT Filesystems
 #
-# CONFIG_FAT_FS is not set
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
 # CONFIG_NTFS_FS is not set
 
 #
@@ -577,6 +721,7 @@
 # CONFIG_DEVFS_FS is not set
 # CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
+# CONFIG_TMPFS_XATTR is not set
 CONFIG_HUGETLBFS=y
 CONFIG_HUGETLB_PAGE=y
 CONFIG_RAMFS=y
@@ -609,9 +754,9 @@
 CONFIG_ROOT_NFS=y
 CONFIG_LOCKD=y
 CONFIG_LOCKD_V4=y
-# CONFIG_EXPORTFS is not set
 CONFIG_SUNRPC=y
 # CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
@@ -621,8 +766,22 @@
 #
 # Partition Types
 #
-# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
 CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+# CONFIG_SGI_PARTITION is not set
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_EFI_PARTITION is not set
 
 #
 # Native Language Support
@@ -630,21 +789,33 @@
 # CONFIG_NLS is not set
 
 #
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
 # Kernel hacking
 #
+CONFIG_DEBUG_KERNEL=y
 CONFIG_MAGIC_SYSRQ=y
+CONFIG_SCHEDSTATS=y
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_FS=y
+CONFIG_FRAME_POINTER=y
 # CONFIG_EARLY_PRINTK is not set
 # CONFIG_DEBUG_KERNEL_WITH_GDB_STUB is not set
-# CONFIG_SH64_PROC_TLB is not set
-# CONFIG_SH64_PROC_ASIDS is not set
+CONFIG_SH64_PROC_TLB=y
+CONFIG_SH64_PROC_ASIDS=y
 CONFIG_SH64_SR_WATCH=y
+# CONFIG_POOR_MANS_STRACE is not set
 # CONFIG_SH_ALPHANUMERIC is not set
 # CONFIG_SH_NO_BSS_INIT is not set
-CONFIG_FRAME_POINTER=y
 
 #
 # Security options
 #
+# CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
 
 #
@@ -653,7 +824,14 @@
 # CONFIG_CRYPTO is not set
 
 #
+# Hardware crypto devices
+#
+
+#
 # Library routines
 #
+# CONFIG_CRC_CCITT is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
diff -Nru a/arch/sh64/defconfig b/arch/sh64/defconfig
--- a/arch/sh64/defconfig	2004-08-09 16:41:37 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,667 +0,0 @@
-#
-# Automatically generated make config: don't edit
-#
-CONFIG_SUPERH=y
-CONFIG_SUPERH64=y
-CONFIG_MMU=y
-CONFIG_UID16=y
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-CONFIG_LOG_BUF_SHIFT=14
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_CLEAN_COMPILE=y
-CONFIG_STANDALONE=y
-CONFIG_BROKEN_ON_SMP=y
-
-#
-# General setup
-#
-CONFIG_SWAP=y
-# CONFIG_SYSVIPC is not set
-CONFIG_POSIX_MQUEUE=y
-# CONFIG_BSD_PROCESS_ACCT is not set
-CONFIG_SYSCTL=y
-# CONFIG_AUDIT is not set
-# CONFIG_HOTPLUG is not set
-# CONFIG_IKCONFIG is not set
-# CONFIG_EMBEDDED is not set
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
-
-#
-# Loadable module support
-#
-# CONFIG_MODULES is not set
-
-#
-# System type
-#
-# CONFIG_SH_GENERIC is not set
-# CONFIG_SH_SIMULATOR is not set
-CONFIG_SH_CAYMAN=y
-# CONFIG_SH_ROMRAM is not set
-# CONFIG_SH_HARP is not set
-CONFIG_CPU_SH5=y
-CONFIG_CPU_SUBTYPE_SH5_101=y
-# CONFIG_CPU_SUBTYPE_SH5_103 is not set
-CONFIG_LITTLE_ENDIAN=y
-# CONFIG_BIG_ENDIAN is not set
-# CONFIG_SH64_FPU_DENORM_FLUSH is not set
-CONFIG_SH64_PGTABLE_2_LEVEL=y
-# CONFIG_SH64_PGTABLE_3_LEVEL is not set
-CONFIG_HUGETLB_PAGE_SIZE_64K=y
-# CONFIG_HUGETLB_PAGE_SIZE_1MB is not set
-# CONFIG_HUGETLB_PAGE_SIZE_512MB is not set
-CONFIG_SH64_USER_MISALIGNED_FIXUP=y
-
-#
-# Memory options
-#
-CONFIG_CACHED_MEMORY_OFFSET=0x20000000
-CONFIG_MEMORY_START=0x80000000
-CONFIG_MEMORY_SIZE_IN_MB=128
-
-#
-# Cache options
-#
-# CONFIG_DCACHE_DISABLED is not set
-CONFIG_DCACHE_WRITE_BACK=y
-# CONFIG_DCACHE_WRITE_THROUGH is not set
-# CONFIG_ICACHE_DISABLED is not set
-CONFIG_PCIDEVICE_MEMORY_START=C0000000
-CONFIG_DEVICE_MEMORY_START=E0000000
-CONFIG_FLASH_MEMORY_START=0x00000000
-CONFIG_PCI_BLOCK_START=0x40000000
-
-#
-# CPU Subtype specific options
-#
-CONFIG_SH64_ID2815_WORKAROUND=y
-
-#
-# Misc options
-#
-CONFIG_HEARTBEAT=y
-CONFIG_HDSP253_LED=y
-CONFIG_SH_DMA=y
-CONFIG_PREEMPT=y
-
-#
-# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
-#
-CONFIG_PCI=y
-CONFIG_SH_PCIDMA_NONCOHERENT=y
-CONFIG_PCI_LEGACY_PROC=y
-CONFIG_PCI_NAMES=y
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_FLAT is not set
-# CONFIG_BINFMT_MISC is not set
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-
-#
-# Memory Technology Devices (MTD)
-#
-# CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
-# CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_CPQ_DA is not set
-# CONFIG_BLK_CPQ_CISS_DA is not set
-# CONFIG_BLK_DEV_DAC960 is not set
-# CONFIG_BLK_DEV_UMEM is not set
-CONFIG_BLK_DEV_LOOP=y
-# CONFIG_BLK_DEV_CRYPTOLOOP is not set
-# CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_SX8 is not set
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=4096
-# CONFIG_BLK_DEV_INITRD is not set
-# CONFIG_LBD is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-# CONFIG_IDE is not set
-
-#
-# SCSI device support
-#
-# CONFIG_SCSI is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
-# Fusion MPT device support
-#
-
-#
-# IEEE 1394 (FireWire) support
-#
-# CONFIG_IEEE1394 is not set
-
-#
-# I2O device support
-#
-# CONFIG_I2O is not set
-
-#
-# Networking support
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-CONFIG_PACKET=y
-# CONFIG_PACKET_MMAP is not set
-# CONFIG_NETLINK_DEV is not set
-CONFIG_UNIX=y
-# CONFIG_NET_KEY is not set
-CONFIG_INET=y
-# CONFIG_IP_MULTICAST is not set
-# CONFIG_IP_ADVANCED_ROUTER is not set
-CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
-# CONFIG_IP_PNP_BOOTP is not set
-# CONFIG_IP_PNP_RARP is not set
-# CONFIG_NET_IPIP is not set
-# CONFIG_NET_IPGRE is not set
-# CONFIG_ARPD is not set
-# CONFIG_SYN_COOKIES is not set
-# CONFIG_INET_AH is not set
-# CONFIG_INET_ESP is not set
-# CONFIG_INET_IPCOMP is not set
-# CONFIG_IPV6 is not set
-# CONFIG_NETFILTER is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_SCTP is not set
-# CONFIG_ATM is not set
-# CONFIG_BRIDGE is not set
-# CONFIG_VLAN_8021Q is not set
-# CONFIG_DECNET is not set
-# CONFIG_LLC2 is not set
-# CONFIG_IPX is not set
-# CONFIG_ATALK is not set
-# CONFIG_X25 is not set
-# CONFIG_LAPB is not set
-# CONFIG_NET_DIVERT is not set
-# CONFIG_ECONET is not set
-# CONFIG_WAN_ROUTER is not set
-# CONFIG_NET_HW_FLOWCONTROL is not set
-
-#
-# QoS and/or fair queueing
-#
-# CONFIG_NET_SCHED is not set
-# CONFIG_NET_CLS_ROUTE is not set
-
-#
-# Network testing
-#
-# CONFIG_NET_PKTGEN is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-# CONFIG_HAMRADIO is not set
-# CONFIG_IRDA is not set
-# CONFIG_BT is not set
-CONFIG_NETDEVICES=y
-# CONFIG_DUMMY is not set
-# CONFIG_BONDING is not set
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
-CONFIG_NET_ETHERNET=y
-# CONFIG_MII is not set
-# CONFIG_STNIC is not set
-# CONFIG_HAPPYMEAL is not set
-# CONFIG_SUNGEM is not set
-# CONFIG_NET_VENDOR_3COM is not set
-
-#
-# Tulip family network device support
-#
-CONFIG_NET_TULIP=y
-# CONFIG_DE2104X is not set
-CONFIG_TULIP=y
-# CONFIG_TULIP_MWI is not set
-# CONFIG_TULIP_MMIO is not set
-# CONFIG_TULIP_NAPI is not set
-# CONFIG_DE4X5 is not set
-# CONFIG_WINBOND_840 is not set
-# CONFIG_DM9102 is not set
-# CONFIG_HP100 is not set
-CONFIG_NET_PCI=y
-# CONFIG_PCNET32 is not set
-# CONFIG_AMD8111_ETH is not set
-# CONFIG_ADAPTEC_STARFIRE is not set
-# CONFIG_B44 is not set
-# CONFIG_FORCEDETH is not set
-# CONFIG_DGRS is not set
-# CONFIG_EEPRO100 is not set
-# CONFIG_E100 is not set
-# CONFIG_FEALNX is not set
-# CONFIG_NATSEMI is not set
-# CONFIG_NE2K_PCI is not set
-# CONFIG_8139CP is not set
-# CONFIG_8139TOO is not set
-# CONFIG_SIS900 is not set
-# CONFIG_EPIC100 is not set
-# CONFIG_SUNDANCE is not set
-# CONFIG_TLAN is not set
-# CONFIG_VIA_RHINE is not set
-# CONFIG_VIA_VELOCITY is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-# CONFIG_ACENIC is not set
-# CONFIG_DL2K is not set
-# CONFIG_E1000 is not set
-# CONFIG_NS83820 is not set
-# CONFIG_HAMACHI is not set
-# CONFIG_YELLOWFIN is not set
-# CONFIG_R8169 is not set
-# CONFIG_SK98LIN is not set
-# CONFIG_TIGON3 is not set
-
-#
-# Ethernet (10000 Mbit)
-#
-# CONFIG_IXGB is not set
-# CONFIG_S2IO is not set
-
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-
-#
-# ISDN subsystem
-#
-# CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-
-#
-# Userland interfaces
-#
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
-# CONFIG_INPUT_EVDEV is not set
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input I/O drivers
-#
-# CONFIG_GAMEPORT is not set
-CONFIG_SOUND_GAMEPORT=y
-CONFIG_SERIO=y
-CONFIG_SERIO_I8042=y
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_CT82C710 is not set
-# CONFIG_SERIO_PCIPS2 is not set
-
-#
-# Input Device Drivers
-#
-CONFIG_INPUT_KEYBOARD=y
-CONFIG_KEYBOARD_ATKBD=y
-# CONFIG_KEYBOARD_SUNKBD is not set
-# CONFIG_KEYBOARD_LKKBD is not set
-# CONFIG_KEYBOARD_XTKBD is not set
-# CONFIG_KEYBOARD_NEWTON is not set
-CONFIG_INPUT_MOUSE=y
-CONFIG_MOUSE_PS2=y
-# CONFIG_MOUSE_SERIAL is not set
-# CONFIG_MOUSE_VSXXXAA is not set
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_MISC is not set
-
-#
-# Character devices
-#
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
-# CONFIG_SERIAL_NONSTANDARD is not set
-
-#
-# Serial drivers
-#
-# CONFIG_SERIAL_8250 is not set
-
-#
-# Non-8250 serial port support
-#
-CONFIG_SERIAL_SH_SCI=y
-CONFIG_SERIAL_SH_SCI_CONSOLE=y
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-CONFIG_UNIX98_PTYS=y
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=256
-# CONFIG_QIC02_TAPE is not set
-
-#
-# IPMI
-#
-# CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-CONFIG_WATCHDOG=y
-# CONFIG_WATCHDOG_NOWAYOUT is not set
-
-#
-# Watchdog Device Drivers
-#
-# CONFIG_SOFT_WATCHDOG is not set
-# CONFIG_SH_WDT is not set
-
-#
-# PCI-based Watchdog Cards
-#
-# CONFIG_PCIPCWATCHDOG is not set
-# CONFIG_WDTPCI is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
-# CONFIG_R3964 is not set
-# CONFIG_APPLICOM is not set
-
-#
-# Ftape, the floppy tape device driver
-#
-# CONFIG_FTAPE is not set
-# CONFIG_AGP is not set
-# CONFIG_DRM is not set
-# CONFIG_RAW_DRIVER is not set
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# Misc devices
-#
-
-#
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-
-#
-# Digital Video Broadcasting Devices
-#
-# CONFIG_DVB is not set
-
-#
-# Graphics support
-#
-CONFIG_FB=y
-# CONFIG_FB_CIRRUS is not set
-# CONFIG_FB_PM2 is not set
-# CONFIG_FB_CYBER2000 is not set
-# CONFIG_FB_ASILIANT is not set
-# CONFIG_FB_IMSTT is not set
-# CONFIG_FB_E1355 is not set
-# CONFIG_FB_RIVA is not set
-# CONFIG_FB_MATROX is not set
-# CONFIG_FB_RADEON_OLD is not set
-# CONFIG_FB_RADEON is not set
-# CONFIG_FB_ATY128 is not set
-# CONFIG_FB_ATY is not set
-# CONFIG_FB_SIS is not set
-# CONFIG_FB_NEOMAGIC is not set
-CONFIG_FB_KYRO=y
-# CONFIG_FB_3DFX is not set
-# CONFIG_FB_VOODOO1 is not set
-# CONFIG_FB_TRIDENT is not set
-# CONFIG_FB_VIRTUAL is not set
-
-#
-# Console display driver support
-#
-# CONFIG_VGA_CONSOLE is not set
-# CONFIG_MDA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_PCI_CONSOLE=y
-CONFIG_FONTS=y
-# CONFIG_FONT_8x8 is not set
-CONFIG_FONT_8x16=y
-# CONFIG_FONT_6x11 is not set
-# CONFIG_FONT_PEARL_8x8 is not set
-# CONFIG_FONT_ACORN_8x8 is not set
-# CONFIG_FONT_MINI_4x6 is not set
-# CONFIG_FONT_SUN8x16 is not set
-# CONFIG_FONT_SUN12x22 is not set
-
-#
-# Logo configuration
-#
-CONFIG_LOGO=y
-# CONFIG_LOGO_LINUX_MONO is not set
-# CONFIG_LOGO_LINUX_VGA16 is not set
-# CONFIG_LOGO_LINUX_CLUT224 is not set
-# CONFIG_LOGO_SUPERH_MONO is not set
-# CONFIG_LOGO_SUPERH_VGA16 is not set
-CONFIG_LOGO_SUPERH_CLUT224=y
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-# CONFIG_USB is not set
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_JBD is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_JFS_FS is not set
-# CONFIG_XFS_FS is not set
-CONFIG_MINIX_FS=y
-CONFIG_ROMFS_FS=y
-# CONFIG_QUOTA is not set
-# CONFIG_AUTOFS_FS is not set
-# CONFIG_AUTOFS4_FS is not set
-
-#
-# CD-ROM/DVD Filesystems
-#
-# CONFIG_ISO9660_FS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-# CONFIG_FAT_FS is not set
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_SYSFS=y
-# CONFIG_DEVFS_FS is not set
-# CONFIG_DEVPTS_FS_XATTR is not set
-CONFIG_TMPFS=y
-CONFIG_HUGETLBFS=y
-CONFIG_HUGETLB_PAGE=y
-CONFIG_RAMFS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
-# CONFIG_BEFS_FS is not set
-# CONFIG_BFS_FS is not set
-# CONFIG_EFS_FS is not set
-# CONFIG_CRAMFS is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_SYSV_FS is not set
-# CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
-CONFIG_NFS_FS=y
-CONFIG_NFS_V3=y
-# CONFIG_NFS_V4 is not set
-# CONFIG_NFS_DIRECTIO is not set
-# CONFIG_NFSD is not set
-CONFIG_ROOT_NFS=y
-CONFIG_LOCKD=y
-CONFIG_LOCKD_V4=y
-# CONFIG_EXPORTFS is not set
-CONFIG_SUNRPC=y
-# CONFIG_RPCSEC_GSS_KRB5 is not set
-# CONFIG_SMB_FS is not set
-# CONFIG_CIFS is not set
-# CONFIG_NCP_FS is not set
-# CONFIG_CODA_FS is not set
-# CONFIG_AFS_FS is not set
-
-#
-# Partition Types
-#
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
-# CONFIG_NLS is not set
-
-#
-# Profiling support
-#
-CONFIG_PROFILING=y
-# CONFIG_OPROFILE is not set
-
-#
-# Kernel hacking
-#
-CONFIG_MAGIC_SYSRQ=y
-# CONFIG_EARLY_PRINTK is not set
-# CONFIG_DEBUG_KERNEL_WITH_GDB_STUB is not set
-# CONFIG_SH64_PROC_TLB is not set
-# CONFIG_SH64_PROC_ASIDS is not set
-CONFIG_SH64_SR_WATCH=y
-# CONFIG_SH_ALPHANUMERIC is not set
-# CONFIG_SH_NO_BSS_INIT is not set
-CONFIG_FRAME_POINTER=y
-
-#
-# Security options
-#
-# CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-# CONFIG_CRYPTO is not set
-
-#
-# Library routines
-#
-# CONFIG_CRC16 is not set
-CONFIG_CRC32=y
-# CONFIG_LIBCRC32C is not set
diff -Nru a/arch/sh64/kernel/Makefile b/arch/sh64/kernel/Makefile
--- a/arch/sh64/kernel/Makefile	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/kernel/Makefile	2005-03-07 20:41:28 -08:00
@@ -13,7 +13,7 @@
 # unless it's something special (ie not a .c file).
 #
 
-extra-y	:= head.o init_task.o vmlinux.lds.s
+extra-y	:= head.o init_task.o vmlinux.lds
 
 obj-y	:= process.o signal.o entry.o traps.o irq.o irq_intc.o \
 	   ptrace.o setup.o time.o sys_sh64.o semaphore.o sh_ksyms.o \
@@ -22,16 +22,14 @@
 obj-$(CONFIG_HEARTBEAT)		+= led.o
 obj-$(CONFIG_SH_ALPHANUMERIC)	+= alphanum.o
 obj-$(CONFIG_SH_DMA)		+= dma.o
+obj-$(CONFIG_SH_FPU)		+= fpu.o
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_KALLSYMS)		+= unwind.o
 obj-$(CONFIG_PCI)		+= pci-dma.o pcibios.o
+obj-$(CONFIG_MODULES)		+= module.o
 
 ifeq ($(CONFIG_PCI),y)
 obj-$(CONFIG_CPU_SH5)		+= pci_sh5.o
-endif
-
-ifndef CONFIG_NOFPU_SUPPORT
-obj-y				+= fpu.o
 endif
 
 USE_STANDARD_AS_RULE := true
diff -Nru a/arch/sh64/kernel/dma.c b/arch/sh64/kernel/dma.c
--- a/arch/sh64/kernel/dma.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/kernel/dma.c	2005-03-07 20:41:28 -08:00
@@ -31,7 +31,7 @@
 } dma_info_t;
 
 static dma_info_t dma_info[MAX_DMA_CHANNELS];
-extern spinlock_t dma_spin_lock;
+static DEFINE_SPINLOCK(dma_spin_lock);
 
 /* arch/sh64/kernel/irq_intc.c */
 extern void make_intc_irq(unsigned int irq);
diff -Nru a/arch/sh64/kernel/early_printk.c b/arch/sh64/kernel/early_printk.c
--- a/arch/sh64/kernel/early_printk.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/kernel/early_printk.c	2005-03-07 20:41:28 -08:00
@@ -16,8 +16,6 @@
 #include <asm/io.h>
 #include <asm/hardware.h>
 
-extern void cpu_relax(void);
-
 #define SCIF_BASE_ADDR	0x01030000
 #define SCIF_ADDR_SH5	PHYS_PERIPHERAL_BLOCK+SCIF_BASE_ADDR
 
diff -Nru a/arch/sh64/kernel/entry.S b/arch/sh64/kernel/entry.S
--- a/arch/sh64/kernel/entry.S	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/kernel/entry.S	2005-03-07 20:41:28 -08:00
@@ -6,7 +6,7 @@
  * arch/sh64/kernel/entry.S
  *
  * Copyright (C) 2000, 2001  Paolo Alberelli
- * Copyright (C) 2004  Paul Mundt
+ * Copyright (C) 2004, 2005  Paul Mundt
  * Copyright (C) 2003, 2004 Richard Curnow
  *
  */
@@ -155,7 +155,7 @@
 	.long	tlb_miss_store				/* 0x0C0 */
 	.long	do_address_error_load	/* 0x0E0 */
 	.long	do_address_error_store	/* 0x100 */
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
 	.long	do_fpu_error		/* 0x120 */
 #else
 	.long	do_exception_error		/* 0x120 */
@@ -237,6 +237,7 @@
 	.space	256, 0			/* Power-on class handler, */
 					/* not required here       */
 not_a_tlb_miss:
+	synco	/* TAKum03020 (but probably a good idea anyway.) */
 	/* Save original stack pointer into KCR1 */
 	putcon	SP, KCR1
 
@@ -278,6 +279,7 @@
 	 * block making sure the final alignment is correct.
 	 */
 tlb_miss:
+	synco	/* TAKum03020 (but probably a good idea anyway.) */
 	putcon	SP, KCR1
 	movi	reg_save_area, SP
 	/* SP is guaranteed 32-byte aligned. */
@@ -393,6 +395,7 @@
 	/* VBR + 0x600 */
 
 interrupt:
+	synco	/* TAKum03020 (but probably a good idea anyway.) */
 	/* Save original stack pointer into KCR1 */
 	putcon	SP, KCR1
 
@@ -429,6 +432,7 @@
 	 *			(this may need to be extended...)
 	 */
 reset_or_panic:
+	synco	/* TAKum03020 (but probably a good idea anyway.) */
 	putcon	SP, DCR
 	/* First save r0-1 and tr0, as we need to use these */
 	movi	resvec_save_area-CONFIG_CACHED_MEMORY_OFFSET, SP
@@ -481,6 +485,7 @@
 
 	.balign	256
 debug_exception:
+	synco	/* TAKum03020 (but probably a good idea anyway.) */
 	/*
 	 * Single step/software_break_point first level handler.
 	 * Called with MMU off, so the first thing we do is enable it
@@ -788,9 +793,7 @@
 	! exceptions
 	add	SP, ZERO, r14
 
-#define POOR_MANS_STRACE 0
-
-#if POOR_MANS_STRACE
+#ifdef CONFIG_POOR_MANS_STRACE
 	/* We've pushed all the registers now, so only r2-r4 hold anything
 	 * useful. Move them into callee save registers */
 	or	r2, ZERO, r28
@@ -811,7 +814,6 @@
 	or	r30, ZERO, r4
 #endif
 
-
 	/* For syscall and debug race condition, get TRA now */
 	getcon	TRA, r5
 
@@ -866,7 +868,7 @@
  */
 	.global ret_from_irq
 ret_from_irq:
-#if POOR_MANS_STRACE
+#ifdef CONFIG_POOR_MANS_STRACE
 	pta	evt_debug_ret_from_irq, tr0
 	ori	SP, 0, r2
 	blink	tr0, LINK
@@ -884,7 +886,7 @@
 ret_from_exception:
 	preempt_stop()
 
-#if POOR_MANS_STRACE
+#ifdef CONFIG_POOR_MANS_STRACE
 	pta	evt_debug_ret_from_exc, tr0
 	ori	SP, 0, r2
 	blink	tr0, LINK
@@ -1141,7 +1143,7 @@
 fpu_error_or_IRQA:
 	pta	its_IRQ, tr0
 	beqi/l	r4, EVENT_INTERRUPT, tr0
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
 	movi	do_fpu_state_restore, r6
 #else
 	movi	do_exception_error, r6
@@ -1152,7 +1154,7 @@
 fpu_error_or_IRQB:
 	pta	its_IRQ, tr0
 	beqi/l	r4, EVENT_INTERRUPT, tr0
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
 	movi	do_fpu_state_restore, r6
 #else
 	movi	do_exception_error, r6
@@ -1223,7 +1225,7 @@
 syscall_ret:
 	st.q	SP, FRAME_R(9), r2	/* Expecting SP back to BASIC frame */
 
-#if POOR_MANS_STRACE
+#ifdef CONFIG_POOR_MANS_STRACE
 	/* nothing useful in registers at this point */
 
 	movi	evt_debug2, r5
@@ -1254,7 +1256,7 @@
 	ptabs	r5, tr0
 	blink	tr0, LINK
 
-#if POOR_MANS_STRACE
+#ifdef CONFIG_POOR_MANS_STRACE
 	/* nothing useful in registers at this point */
 
 	movi	evt_debug2, r5
diff -Nru a/arch/sh64/kernel/head.S b/arch/sh64/kernel/head.S
--- a/arch/sh64/kernel/head.S	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/kernel/head.S	2005-03-07 20:41:28 -08:00
@@ -96,8 +96,8 @@
 	.long	0		/* RAMDISK_FLAGS */
 	.long	0x0200		/* ORIG_ROOT_DEV */
 	.long	1		/* LOADER_TYPE */
-	.long	0x00360000	/* INITRD_START */
-	.long	0x000a0000	/* INITRD_SIZE */
+	.long	0x00800000	/* INITRD_START */
+	.long	0x00800000	/* INITRD_SIZE */
 	.long	0
 
 	.text
@@ -310,7 +310,7 @@
 	 */
 	movi fpu_in_use, r31	/* Temporary */
 
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
 	getcon	SR, r21
 	movi	SR_ENABLE_FPU, r22
 	and	r21, r22, r22
diff -Nru a/arch/sh64/kernel/irq.c b/arch/sh64/kernel/irq.c
--- a/arch/sh64/kernel/irq.c	2004-10-20 01:37:14 -07:00
+++ b/arch/sh64/kernel/irq.c	2005-03-07 20:41:27 -08:00
@@ -39,57 +39,11 @@
 #include <asm/irq.h>
 #include <linux/irq.h>
 
-/*
- * Controller mappings for all interrupt sources:
- */
-irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
-	[0 ... NR_IRQS-1] = {
-		.handler = &no_irq_type,
-		.lock = SPIN_LOCK_UNLOCKED
-	}
-};
-
-
-/*
- * Special irq handlers.
- */
-
-irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs)
+void ack_bad_irq(unsigned int irq)
 {
-	return IRQ_NONE;
-}
-
-/*
- * Generic no controller code
- */
-
-static void enable_none(unsigned int irq) { }
-static unsigned int startup_none(unsigned int irq) { return 0; }
-static void disable_none(unsigned int irq) { }
-static void ack_none(unsigned int irq)
-{
-/*
- * 'what should we do if we get a hw irq event on an illegal vector'.
- * each architecture has to answer this themselves, it doesnt deserve
- * a generic callback i think.
- */
 	printk("unexpected IRQ trap at irq %02x\n", irq);
 }
 
-/* startup is the same as "enable", shutdown is same as "disable" */
-#define shutdown_none	disable_none
-#define end_none	enable_none
-
-struct hw_interrupt_type no_irq_type = {
-	"none",
-	startup_none,
-	shutdown_none,
-	enable_none,
-	disable_none,
-	ack_none,
-	end_none
-};
-
 #if defined(CONFIG_PROC_FS)
 int show_interrupts(struct seq_file *p, void *v)
 {
@@ -139,584 +93,24 @@
 }
 
 /*
- * This should really return information about whether
- * we should do bottom half handling etc. Right now we
- * end up _always_ checking the bottom half, which is a
- * waste of time and is not what some drivers would
- * prefer.
- */
-int handle_IRQ_event(unsigned int irq, struct pt_regs * regs, struct irqaction * action)
-{
-	int status;
-	int ret;
-
-	status = 1;	/* Force the "do bottom halves" bit */
-
-        if (!(action->flags & SA_INTERRUPT))
-                local_irq_enable();
-
-	do {
-		ret = action->handler(irq, action->dev_id, regs);
-		if (ret == IRQ_HANDLED)
-			status |= action->flags;
-		action = action->next;
-	} while (action);
-	if (status & SA_SAMPLE_RANDOM)
-		add_interrupt_randomness(irq);
-
-	local_irq_disable();
-
-	return status;
-}
-
-/*
- * Generic enable/disable code: this just calls
- * down into the PIC-specific version for the actual
- * hardware disable after having gotten the irq
- * controller lock.
- */
-
-/**
- *	disable_irq_nosync - disable an irq without waiting
- *	@irq: Interrupt to disable
- *
- *	Disable the selected interrupt line. Disables of an interrupt
- *	stack. Unlike disable_irq(), this function does not ensure existing
- *	instances of the IRQ handler have completed before returning.
- *
- *	This function may be called from IRQ context.
- */
-void disable_irq_nosync(unsigned int irq)
-{
-	irq_desc_t *desc = irq_desc + irq;
-	unsigned long flags;
-
-	spin_lock_irqsave(&desc->lock, flags);
-	if (!desc->depth++) {
-		desc->status |= IRQ_DISABLED;
-		desc->handler->disable(irq);
-	}
-	spin_unlock_irqrestore(&desc->lock, flags);
-}
-
-/**
- *	disable_irq - disable an irq and wait for completion
- *	@irq: Interrupt to disable
- *
- *	Disable the selected interrupt line. Disables of an interrupt
- *	stack. That is for two disables you need two enables. This
- *	function waits for any pending IRQ handlers for this interrupt
- *	to complete before returning. If you use this function while
- *	holding a resource the IRQ handler may need you will deadlock.
- *
- *	This function may be called - with care - from IRQ context.
- */
-void disable_irq(unsigned int irq)
-{
-	disable_irq_nosync(irq);
-	synchronize_irq(irq);
-}
-
-/**
- *	enable_irq - enable interrupt handling on an irq
- *	@irq: Interrupt to enable
- *
- *	Re-enables the processing of interrupts on this IRQ line
- *	providing no disable_irq calls are now in effect.
- *
- *	This function may be called from IRQ context.
- */
-void enable_irq(unsigned int irq)
-{
-	irq_desc_t *desc = irq_desc + irq;
-	unsigned long flags;
-
-	spin_lock_irqsave(&desc->lock, flags);
-	switch (desc->depth) {
-	case 1: {
-		unsigned int status = desc->status & ~IRQ_DISABLED;
-		desc->status = status;
-		if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
-			desc->status = status | IRQ_REPLAY;
-			hw_resend_irq(desc->handler,irq);
-		}
-		desc->handler->enable(irq);
-		/* fall-through */
-	}
-	default:
-		desc->depth--;
-		break;
-	case 0:
-		printk("enable_irq() unbalanced from %p\n",
-		       __builtin_return_address(0));
-	}
-	spin_unlock_irqrestore(&desc->lock, flags);
-}
-
-/*
  * do_IRQ handles all normal device IRQ's.
  */
 asmlinkage int do_IRQ(unsigned long vector_num, struct pt_regs * regs)
 {
-	/*
-	 * We ack quickly, we don't want the irq controller
-	 * thinking we're snobs just because some other CPU has
-	 * disabled global interrupts (we have already done the
-	 * INT_ACK cycles, it's too late to try to pretend to the
-	 * controller that we aren't taking the interrupt).
-	 *
-	 * 0 return value means that this irq is already being
-	 * handled by some other CPU. (or is disabled)
-	 */
 	int irq;
-	int cpu = smp_processor_id();
-	irq_desc_t *desc = NULL;
-	struct irqaction * action;
-	unsigned int status;
 
 	irq_enter();
 
-#ifdef CONFIG_PREEMPT
-	/*
-	 * At this point we're now about to actually call handlers,
-	 * and interrupts might get reenabled during them... bump
-	 * preempt_count to prevent any preemption while the handler
-	 * called here is pending...
-	 */
-	preempt_disable();
-#endif
-
 	irq = irq_demux(vector_num);
 
-	/*
-	 * Should never happen, if it does check
-	 * vectorN_to_IRQ[] against trap_jtable[].
-	 */
-	if (irq == -1) {
+	if (irq >= 0) {
+		__do_IRQ(irq, regs);
+	} else {
 		printk("unexpected IRQ trap at vector %03lx\n", vector_num);
-		goto out;
-	}
-
-	desc = irq_desc + irq;
-
-	kstat_cpu(cpu).irqs[irq]++;
-	spin_lock(&desc->lock);
-	desc->handler->ack(irq);
-	/*
-	   REPLAY is when Linux resends an IRQ that was dropped earlier
-	   WAITING is used by probe to mark irqs that are being tested
-	   */
-	status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING | IRQ_INPROGRESS);
-	status |= IRQ_PENDING; /* we _want_ to handle it */
-
-	/*
-	 * If the IRQ is disabled for whatever reason, we cannot
-	 * use the action we have.
-	 */
-	action = NULL;
-	if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
-		action = desc->action;
-		status &= ~IRQ_PENDING; /* we commit to handling */
-		status |= IRQ_INPROGRESS; /* we are handling it */
-	}
-	desc->status = status;
-
-	/*
-	 * If there is no IRQ handler or it was disabled, exit early.
-	   Since we set PENDING, if another processor is handling
-	   a different instance of this same irq, the other processor
-	   will take care of it.
-	 */
-	if (!action)
-		goto out;
-
-	/*
-	 * Edge triggered interrupts need to remember
-	 * pending events.
-	 * This applies to any hw interrupts that allow a second
-	 * instance of the same irq to arrive while we are in do_IRQ
-	 * or in the handler. But the code here only handles the _second_
-	 * instance of the irq, not the third or fourth. So it is mostly
-	 * useful for irq hardware that does not mask cleanly in an
-	 * SMP environment.
-	 */
-	for (;;) {
-		spin_unlock(&desc->lock);
-		handle_IRQ_event(irq, regs, action);
-		spin_lock(&desc->lock);
-
-		if (!(desc->status & IRQ_PENDING))
-			break;
-		desc->status &= ~IRQ_PENDING;
-	}
-	desc->status &= ~IRQ_INPROGRESS;
-out:
-	/*
-	 * The ->end() handler has to deal with interrupts which got
-	 * disabled while the handler was running.
-	 */
-	if (desc) {
-		desc->handler->end(irq);
-		spin_unlock(&desc->lock);
 	}
 
 	irq_exit();
 
-#ifdef CONFIG_PREEMPT
-	/*
-	 * We're done with the handlers, interrupts should be
-	 * currently disabled; decrement preempt_count now so
-	 * as we return preemption may be allowed...
-	 */
-	preempt_enable_no_resched();
-#endif
-
 	return 1;
 }
 
-/**
- *	request_irq - allocate an interrupt line
- *	@irq: Interrupt line to allocate
- *	@handler: Function to be called when the IRQ occurs
- *	@irqflags: Interrupt type flags
- *	@devname: An ascii name for the claiming device
- *	@dev_id: A cookie passed back to the handler function
- *
- *	This call allocates interrupt resources and enables the
- *	interrupt line and IRQ handling. From the point this
- *	call is made your handler function may be invoked. Since
- *	your handler function must clear any interrupt the board
- *	raises, you must take care both to initialise your hardware
- *	and to set up the interrupt handler in the right order.
- *
- *	Dev_id must be globally unique. Normally the address of the
- *	device data structure is used as the cookie. Since the handler
- *	receives this value it makes sense to use it.
- *
- *	If your interrupt is shared you must pass a non NULL dev_id
- *	as this is required when freeing the interrupt.
- *
- *	Flags:
- *
- *	SA_SHIRQ		Interrupt is shared
- *
- *	SA_INTERRUPT		Disable local interrupts while processing
- *
- *	SA_SAMPLE_RANDOM	The interrupt can be used for entropy
- *
- */
-int request_irq(unsigned int irq,
-		irqreturn_t (*handler)(int, void *, struct pt_regs *),
-		unsigned long irqflags,
-		const char * devname,
-		void *dev_id)
-{
-	int retval;
-	struct irqaction * action;
-
-#if 1
-	/*
-	 * Sanity-check: shared interrupts should REALLY pass in
-	 * a real dev-ID, otherwise we'll have trouble later trying
-	 * to figure out which interrupt is which (messes up the
-	 * interrupt freeing logic etc).
-	 */
-	if (irqflags & SA_SHIRQ) {
-		if (!dev_id)
-			printk("Bad boy: %s (at 0x%x) called us without a dev_id!\n", devname, (&irq)[-1]);
-	}
-#endif
-
-	if (irq >= NR_IRQS)
-		return -EINVAL;
-	if (!handler)
-		return -EINVAL;
-
-	action = (struct irqaction *)
-			kmalloc(sizeof(struct irqaction), GFP_KERNEL);
-	if (!action)
-		return -ENOMEM;
-
-	action->handler = handler;
-	action->flags = irqflags;
-	cpus_clear(action->mask);
-	action->name = devname;
-	action->next = NULL;
-	action->dev_id = dev_id;
-
-	retval = setup_irq(irq, action);
-	if (retval)
-		kfree(action);
-	return retval;
-}
-
-/**
- *	free_irq - free an interrupt
- *	@irq: Interrupt line to free
- *	@dev_id: Device identity to free
- *
- *	Remove an interrupt handler. The handler is removed and if the
- *	interrupt line is no longer in use by any driver it is disabled.
- *	On a shared IRQ the caller must ensure the interrupt is disabled
- *	on the card it drives before calling this function. The function
- *	does not return until any executing interrupts for this IRQ
- *	have completed.
- *
- *	This function may be called from interrupt context.
- *
- *	Bugs: Attempting to free an irq in a handler for the same irq hangs
- *	      the machine.
- */
-void free_irq(unsigned int irq, void *dev_id)
-{
-	irq_desc_t *desc;
-	struct irqaction **p;
-	unsigned long flags;
-
-	if (irq >= NR_IRQS)
-		return;
-
-	desc = irq_desc + irq;
-	spin_lock_irqsave(&desc->lock,flags);
-	p = &desc->action;
-	for (;;) {
-		struct irqaction * action = *p;
-		if (action) {
-			struct irqaction **pp = p;
-			p = &action->next;
-			if (action->dev_id != dev_id)
-				continue;
-
-			/* Found it - now remove it from the list of entries */
-			*pp = action->next;
-			if (!desc->action) {
-				desc->status |= IRQ_DISABLED;
-				desc->handler->shutdown(irq);
-			}
-			spin_unlock_irqrestore(&desc->lock,flags);
-			kfree(action);
-			return;
-		}
-		printk("Trying to free free IRQ%d\n",irq);
-		spin_unlock_irqrestore(&desc->lock,flags);
-		return;
-	}
-}
-
-/*
- * IRQ autodetection code..
- *
- * This depends on the fact that any interrupt that
- * comes in on to an unassigned handler will get stuck
- * with "IRQ_WAITING" cleared and the interrupt
- * disabled.
- */
-
-/**
- *	probe_irq_on	- begin an interrupt autodetect
- *
- *	Commence probing for an interrupt. The interrupts are scanned
- *	and a mask of potential interrupt lines is returned.
- *
- */
-unsigned long probe_irq_on(void)
-{
-	unsigned int i;
-	irq_desc_t *desc;
-	unsigned long val;
-	unsigned long delay;
-
-	/*
-	 * something may have generated an irq long ago and we want to
-	 * flush such a longstanding irq before considering it as spurious.
-	 */
-	for (i = NR_IRQS-1; i >= 0; i--) {
-		desc = irq_desc + i;
-
-		spin_lock_irq(&desc->lock);
-		if (!irq_desc[i].action) {
-			irq_desc[i].handler->startup(i);
-		}
-		spin_unlock_irq(&desc->lock);
-	}
-
-	/* Wait for longstanding interrupts to trigger. */
-	for (delay = jiffies + HZ/50; time_after(delay, jiffies); )
-		/* about 20ms delay */ synchronize_irq();
-
-	/*
-	 * enable any unassigned irqs
-	 * (we must startup again here because if a longstanding irq
-	 * happened in the previous stage, it may have masked itself)
-	 */
-	for (i = NR_IRQS-1; i >= 0; i--) {
-		desc = irq_desc + 1;
-
-		spin_lock_irq(&desc->lock);
-		if (!desc->action) {
-			desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
-			if (desc->handler->startup(i))
-				desc->status |= IRQ_PENDING;
-		}
-		spin_unlock_irq(&desc->lock);
-	}
-
-	/*
-	 * Wait for spurious interrupts to trigger
-	 */
-	for (delay = jiffies + HZ/10; time_after(delay, jiffies); )
-		/* about 100ms delay */ synchronize_irq();
-
-	/*
-	 * Now filter out any obviously spurious interrupts
-	 */
-	val = 0;
-	for (i = 0; i < NR_IRQS; i++) {
-		irq_desc_t *desc = irq_desc + i;
-		unsigned int status;
-
-		spin_lock_irq(&desc->lock);
-		status = desc->status;
-
-		if (status & IRQ_AUTODETECT) {
-			/* It triggered already - consider it spurious. */
-			if (!(status & IRQ_WAITING)) {
-				desc->status = status & ~IRQ_AUTODETECT;
-				desc->handler->shutdown(i);
-			} else
-				if (i < 32)
-					val |= 1 << i;
-		}
-		spin_unlock_irq(&desc->lock);
-	}
-
-	return val;
-}
-
-/*
- * Return the one interrupt that triggered (this can
- * handle any interrupt source).
- */
-
-/**
- *	probe_irq_off   - end an interrupt autodetect
- *	@val: mask of potential interrupts (unused)
- *
- *	Scans the unused interrupt lines and returns the line which
- *	appears to have triggered the interrupt. If no interrupt was
- *	found then zero is returned. If more than one interrupt is
- *	found then minus the first candidate is returned to indicate
- *	their is doubt.
- *
- *	The interrupt probe logic state is returned to its previous
- *	value.
- *
- *	BUGS: When used in a module (which arguably shouldnt happen)
- *	nothing prevents two IRQ probe callers from overlapping. The
- *	results of this are non-optimal.
- */
-int probe_irq_off(unsigned long val)
-{
-	int i, irq_found, nr_irqs;
-
-	nr_irqs = 0;
-	irq_found = 0;
-	for (i=0; i<NR_IRQS; i++) {
-		irq_desc_t *desc = irq_desc + i;
-		unsigned int status;
-
-		spin_lock_irq(&desc->lock);
-		status = desc->status;
-		if (!(status & IRQ_AUTODETECT))
-			continue;
-
-		if (status & IRQ_AUTODETECT) {
-			if (!(status & IRQ_WAITING)) {
-				if (!nr_irqs)
-					irq_found = i;
-				nr_irqs++;
-			}
-
-			desc->status = status & ~IRQ_AUTODETECT;
-			desc->handler->shutdown(i);
-		}
-		spin_unlock_irq(&desc->lock);
-	}
-
-	if (nr_irqs > 1)
-		irq_found = -irq_found;
-	return irq_found;
-}
-
-int setup_irq(unsigned int irq, struct irqaction * new)
-{
-	int shared = 0;
-	unsigned long flags;
-	struct irqaction *old, **p;
-	irq_desc_t *desc = irq_desc + irq;
-
-	/*
-	 * Some drivers like serial.c use request_irq() heavily,
-	 * so we have to be careful not to interfere with a
-	 * running system.
-	 */
-	if (new->flags & SA_SAMPLE_RANDOM) {
-		/*
-		 * This function might sleep, we want to call it first,
-		 * outside of the atomic block.
-		 * Yes, this might clear the entropy pool if the wrong
-		 * driver is attempted to be loaded, without actually
-		 * installing a new handler, but is this really a problem,
-		 * only the sysadmin is able to do this.
-		 */
-		rand_initialize_irq(irq);
-	}
-
-	/*
-	 * The following block of code has to be executed atomically
-	 */
-	spin_lock_irqsave(&desc->lock,flags);
-	p = &desc->action;
-	if ((old = *p) != NULL) {
-		/* Can't share interrupts unless both agree to */
-		if (!(old->flags & new->flags & SA_SHIRQ)) {
-			spin_unlock_irqrestore(&desc->lock,flags);
-			return -EBUSY;
-		}
-
-		/* add new interrupt at end of irq queue */
-		do {
-			p = &old->next;
-			old = *p;
-		} while (old);
-		shared = 1;
-	}
-
-	*p = new;
-
-	if (!shared) {
-		desc->depth = 0;
-		desc->status &= ~IRQ_DISABLED;
-		desc->handler->startup(irq);
-	}
-	spin_unlock_irqrestore(&desc->lock,flags);
-
-	/*
-	 * No PROC FS support for interrupts.
-	 * For improvements in this area please check
-	 * the i386 branch.
-	 */
-	return 0;
-}
-
-#if defined(CONFIG_PROC_FS) && defined(CONFIG_SYSCTL)
-
-void init_irq_proc(void)
-{
-	/*
-	 * No PROC FS support for interrupts.
-	 * For improvements in this area please check
-	 * the i386 branch.
-	 */
-}
-#endif
diff -Nru a/arch/sh64/kernel/module.c b/arch/sh64/kernel/module.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/sh64/kernel/module.c	2005-03-07 20:41:27 -08:00
@@ -0,0 +1,161 @@
+/*  Kernel module help for sh64.
+
+    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
+
+    Copyright 2004 SuperH (UK) Ltd
+    Author: Richard Curnow
+
+    Based on the sh version, and on code from the sh64-specific parts of
+    modutils, originally written by Richard Curnow and Ben Gaster.
+
+*/
+#include <linux/moduleloader.h>
+#include <linux/elf.h>
+#include <linux/vmalloc.h>
+#include <linux/fs.h>
+#include <linux/string.h>
+#include <linux/kernel.h>
+
+#if 0
+#define DEBUGP printk
+#else
+#define DEBUGP(fmt...)
+#endif
+
+void *module_alloc(unsigned long size)
+{
+	if (size == 0)
+		return NULL;
+	return vmalloc(size);
+}
+
+
+/* Free memory returned from module_alloc */
+void module_free(struct module *mod, void *module_region)
+{
+	vfree(module_region);
+	/* FIXME: If module_region == mod->init_region, trim exception
+           table entries. */
+}
+
+/* We don't need anything special. */
+int module_frob_arch_sections(Elf_Ehdr *hdr,
+			      Elf_Shdr *sechdrs,
+			      char *secstrings,
+			      struct module *mod)
+{
+	return 0;
+}
+
+int apply_relocate_add(Elf32_Shdr *sechdrs,
+		   const char *strtab,
+		   unsigned int symindex,
+		   unsigned int relsec,
+		   struct module *me)
+{
+	unsigned int i;
+	Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr;
+	Elf32_Sym *sym;
+	Elf32_Addr relocation;
+	uint32_t *location;
+	int align;
+	int is_shmedia;
+
+	DEBUGP("Applying relocate section %u to %u\n", relsec,
+	       sechdrs[relsec].sh_info);
+	for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
+		/* This is where to make the change */
+		location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+			+ rel[i].r_offset;
+		/* This is the symbol it is referring to.  Note that all
+		   undefined symbols have been resolved.  */
+		sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
+			+ ELF32_R_SYM(rel[i].r_info);
+		relocation = sym->st_value + rel[i].r_addend;
+		align = (int)location & 3;
+
+		/* For text addresses, bit2 of the st_other field indicates
+		 * whether the symbol is SHmedia (1) or SHcompact (0).  If
+		 * SHmedia, the LSB of the symbol needs to be asserted
+		 * for the CPU to be in SHmedia mode when it starts executing
+		 * the branch target. */
+		is_shmedia = (sym->st_other & 4) ? 1 : 0;
+		if (is_shmedia) {
+			relocation |= 1;
+		}
+
+		switch (ELF32_R_TYPE(rel[i].r_info)) {
+		case R_SH_DIR32:
+			DEBUGP("R_SH_DIR32 @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation);
+			*location += relocation;
+			break;
+		case R_SH_REL32:
+			DEBUGP("R_SH_REL32 @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation);
+			relocation -= (Elf32_Addr) location;
+			*location += relocation;
+			break;
+		case R_SH_IMM_LOW16:
+			DEBUGP("R_SH_IMM_LOW16 @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation);
+			*location = (*location & ~0x3fffc00) |
+				((relocation & 0xffff) << 10);
+			break;
+		case R_SH_IMM_MEDLOW16:
+			DEBUGP("R_SH_IMM_MEDLOW16 @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation);
+			*location = (*location & ~0x3fffc00) |
+				(((relocation >> 16) & 0xffff) << 10);
+			break;
+		case R_SH_IMM_LOW16_PCREL:
+			DEBUGP("R_SH_IMM_LOW16_PCREL @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation);
+			relocation -= (Elf32_Addr) location;
+			*location = (*location & ~0x3fffc00) |
+				((relocation & 0xffff) << 10);
+			break;
+		case R_SH_IMM_MEDLOW16_PCREL:
+			DEBUGP("R_SH_IMM_MEDLOW16_PCREL @%08lx = %08lx\n", (unsigned long) location, (unsigned long) relocation);
+			relocation -= (Elf32_Addr) location;
+			*location = (*location & ~0x3fffc00) |
+				(((relocation >> 16) & 0xffff) << 10);
+			break;
+		default:
+			printk(KERN_ERR "module %s: Unknown relocation: %u\n",
+			       me->name, ELF32_R_TYPE(rel[i].r_info));
+			return -ENOEXEC;
+		}
+	}
+	return 0;
+}
+
+int apply_relocate(Elf32_Shdr *sechdrs,
+		       const char *strtab,
+		       unsigned int symindex,
+		       unsigned int relsec,
+		       struct module *me)
+{
+	printk(KERN_ERR "module %s: REL RELOCATION unsupported\n",
+	       me->name);
+	return -ENOEXEC;
+}
+
+int module_finalize(const Elf_Ehdr *hdr,
+		    const Elf_Shdr *sechdrs,
+		    struct module *me)
+{
+	return 0;
+}
+
+void module_arch_cleanup(struct module *mod)
+{
+}
+
diff -Nru a/arch/sh64/kernel/pci_sh5.c b/arch/sh64/kernel/pci_sh5.c
--- a/arch/sh64/kernel/pci_sh5.c	2004-11-08 06:14:36 -08:00
+++ b/arch/sh64/kernel/pci_sh5.c	2005-02-07 12:52:54 -08:00
@@ -39,7 +39,7 @@
 	 */
 	if ((d->class >> 8) != PCI_CLASS_STORAGE_IDE)
 		return;
-	printk("PCI: IDE base address fixup for %s\n", d->slot_name);
+	printk("PCI: IDE base address fixup for %s\n", pci_name(d));
 	for(i=0; i<4; i++) {
 		struct resource *r = &d->resource[i];
 		if ((r->start & ~0x80) == 0x374) {
diff -Nru a/arch/sh64/kernel/pcibios.c b/arch/sh64/kernel/pcibios.c
--- a/arch/sh64/kernel/pcibios.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/kernel/pcibios.c	2005-02-07 12:52:54 -08:00
@@ -57,7 +57,7 @@
 	pci_read_config_dword(dev, reg, &check);
 	if ((new ^ check) & ((new & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)) {
 		printk(KERN_ERR "PCI: Error while updating region "
-		       "%s/%d (%08x != %08x)\n", dev->slot_name, resource,
+		       "%s/%d (%08x != %08x)\n", pci_name(dev), resource,
 		       new, check);
 	}
 }
@@ -125,7 +125,7 @@
 			continue;
 		r = &dev->resource[idx];
 		if (!r->start && r->end) {
-			printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", dev->slot_name);
+			printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
 			return -EINVAL;
 		}
 		if (r->flags & IORESOURCE_IO)
diff -Nru a/arch/sh64/kernel/process.c b/arch/sh64/kernel/process.c
--- a/arch/sh64/kernel/process.c	2005-01-30 22:20:14 -08:00
+++ b/arch/sh64/kernel/process.c	2005-03-07 20:41:28 -08:00
@@ -638,7 +638,6 @@
 int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
 {
 	/* A bit less processor dependent than older sh ... */
-
 	unsigned int reply;
 
 static __inline__ _syscall2(int,clone,unsigned long,flags,unsigned long,newsp)
@@ -671,7 +670,7 @@
 	   null it here, there is no other path through which it would get safely
 	   nulled. */
 
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
 	if (last_task_used_math == current) {
 		last_task_used_math = NULL;
 	}
@@ -683,7 +682,7 @@
 
 	/* Called by fs/exec.c (flush_old_exec) to remove traces of a
 	 * previously running executable. */
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
 	if (last_task_used_math == current) {
 		last_task_used_math = NULL;
 	}
@@ -709,7 +708,7 @@
 /* Fill in the fpu structure for a core dump.. */
 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
 {
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
 	int fpvalid;
 	struct task_struct *tsk = current;
 
@@ -741,7 +740,7 @@
 	struct pt_regs *childregs;
 	unsigned long long se;			/* Sign extension */
 
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
 	if(last_task_used_math == current) {
 		grab_fpu();
 		fpsave(&current->thread.fpu.hard);
@@ -933,7 +932,7 @@
 	int len=0;
 	struct task_struct *p;
 	read_lock(&tasklist_lock);
-	for_each_task(p) {
+	for_each_process(p) {
 		int pid = p->pid;
 		struct mm_struct *mm;
 		if (!pid) continue;
@@ -942,7 +941,7 @@
 			unsigned long asid, context;
 			context = mm->context;
 			asid = (context & 0xff);
-			len += sprintf(buf+len, "%5d : %02x\n", pid, asid);
+			len += sprintf(buf+len, "%5d : %02lx\n", pid, asid);
 		} else {
 			len += sprintf(buf+len, "%5d : (none)\n", pid);
 		}
diff -Nru a/arch/sh64/kernel/ptrace.c b/arch/sh64/kernel/ptrace.c
--- a/arch/sh64/kernel/ptrace.c	2005-01-30 22:20:14 -08:00
+++ b/arch/sh64/kernel/ptrace.c	2005-03-07 20:41:28 -08:00
@@ -123,9 +123,26 @@
 asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
 {
 	struct task_struct *child;
+	extern void poke_real_address_q(unsigned long long addr, unsigned long long data);
+#define WPC_DBRMODE 0x0d104008
+	static int first_call = 1;
 	int ret;
 
 	lock_kernel();
+
+	if (first_call) {
+		/* Set WPC.DBRMODE to 0.  This makes all debug events get
+		 * delivered through RESVEC, i.e. into the handlers in entry.S.
+		 * (If the kernel was downloaded using a remote gdb, WPC.DBRMODE
+		 * would normally be left set to 1, which makes debug events get
+		 * delivered through DBRVEC, i.e. into the remote gdb's
+		 * handlers.  This prevents ptrace getting them, and confuses
+		 * the remote gdb.) */
+		printk("DBRMODE set to 0 to permit native debugging\n");
+		poke_real_address_q(WPC_DBRMODE, 0);
+		first_call = 0;
+	}
+
 	ret = -EPERM;
 	if (request == PTRACE_TRACEME) {
 		/* are we already being traced? */
diff -Nru a/arch/sh64/kernel/sh_ksyms.c b/arch/sh64/kernel/sh_ksyms.c
--- a/arch/sh64/kernel/sh_ksyms.c	2004-09-07 23:32:57 -07:00
+++ b/arch/sh64/kernel/sh_ksyms.c	2005-03-07 20:41:28 -08:00
@@ -19,6 +19,7 @@
 #include <linux/in6.h>
 #include <linux/interrupt.h>
 #include <linux/smp_lock.h>
+#include <linux/tty.h>
 
 #include <asm/semaphore.h>
 #include <asm/processor.h>
@@ -50,7 +51,6 @@
 /* Networking helper routines. */
 EXPORT_SYMBOL(csum_partial_copy);
 
-EXPORT_SYMBOL(strtok);
 EXPORT_SYMBOL(strpbrk);
 EXPORT_SYMBOL(strstr);
 
@@ -72,12 +72,18 @@
 
 EXPORT_SYMBOL(flush_dcache_page);
 
+/* For ext3 */
+EXPORT_SYMBOL(sh64_page_clear);
+
 /* Ugh.  These come in from libgcc.a at link time. */
 
 extern void __sdivsi3(void);
 extern void __muldi3(void);
 extern void __udivsi3(void);
+extern char __div_table;
 EXPORT_SYMBOL(__sdivsi3);
 EXPORT_SYMBOL(__muldi3);
 EXPORT_SYMBOL(__udivsi3);
+EXPORT_SYMBOL(__div_table);
+
 
diff -Nru a/arch/sh64/kernel/signal.c b/arch/sh64/kernel/signal.c
--- a/arch/sh64/kernel/signal.c	2005-01-30 22:20:14 -08:00
+++ b/arch/sh64/kernel/signal.c	2005-03-07 20:41:28 -08:00
@@ -178,7 +178,7 @@
 	long long retcode[2];
 };
 
-#ifndef CONFIG_NOFPU_SUPPORT
+#ifdef CONFIG_SH_FPU
 static inline int
 restore_sigcontext_fpu(struct pt_regs *regs, struct sigcontext __user *sc)
 {
@@ -634,11 +634,9 @@
  */
 
 static void
-handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
-	      struct pt_regs * regs)
+handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
+		sigset_t *oldset, struct pt_regs * regs)
 {
-	struct k_sigaction *ka = &current->sighand->action[sig-1];
-
 	/* Are we from a system call? */
 	if (regs->syscall_nr >= 0) {
 		/* If so, check system call restarting.. */
@@ -666,9 +664,6 @@
 	else
 		setup_frame(sig, ka, oldset, regs);
 
-	if (ka->sa.sa_flags & SA_ONESHOT)
-		ka->sa.sa_handler = SIG_DFL;
-
 	if (!(ka->sa.sa_flags & SA_NODEFER)) {
 		spin_lock_irq(&current->sighand->siglock);
 		sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
@@ -691,6 +686,7 @@
 {
 	siginfo_t info;
 	int signr;
+	struct k_sigaction ka;
 
 	/*
 	 * We want the common case to go fast, which
@@ -707,11 +703,11 @@
 	if (!oldset)
 		oldset = &current->blocked;
 
-	signr = get_signal_to_deliver(&info, regs, 0);
+	signr = get_signal_to_deliver(&info, &ka, regs, 0);
 
 	if (signr > 0) {
 		/* Whee!  Actually deliver the signal.  */
-		handle_signal(signr, &info, oldset, regs);
+		handle_signal(signr, &info, &ka, oldset, regs);
 		return 1;
 	}
 
diff -Nru a/arch/sh64/kernel/switchto.S b/arch/sh64/kernel/switchto.S
--- a/arch/sh64/kernel/switchto.S	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/kernel/switchto.S	2005-03-07 20:41:28 -08:00
@@ -27,7 +27,7 @@
    r5 - &next->thread
 
    Outgoing results
-   r2 - last (=prev)
+   r2 - last (=prev) : this just stays in r2 throughout
 
    Want to create a full (struct pt_regs) on the stack to allow backtracing
    functions to work.  However, we only need to populate the callee-save
@@ -188,7 +188,6 @@
 	! epilogue
 	ld.l	r15, 0, r18
 	ld.l	r15, 4, r14
-	ori	r4, 0, r2	! last = prev
 	ptabs	r18, tr0
 	movi	FRAME_SIZE, r0
 	add	r15, r0, r15
diff -Nru a/arch/sh64/kernel/sys_sh64.c b/arch/sh64/kernel/sys_sh64.c
--- a/arch/sh64/kernel/sys_sh64.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/kernel/sys_sh64.c	2005-03-07 20:41:28 -08:00
@@ -284,3 +284,17 @@
 	return err?-EFAULT:0;
 }
 
+/* Copy from mips version */
+asmlinkage long sys_shmatcall(int shmid, char __user *shmaddr,
+		int shmflg)
+{
+	unsigned long raddr;
+	int err;
+
+	err = do_shmat(shmid, shmaddr, shmflg, &raddr);
+	if (err)
+		return err;
+
+	err = raddr;
+	return err;
+}
diff -Nru a/arch/sh64/kernel/syscalls.S b/arch/sh64/kernel/syscalls.S
--- a/arch/sh64/kernel/syscalls.S	2004-06-29 07:44:48 -07:00
+++ b/arch/sh64/kernel/syscalls.S	2005-03-07 20:41:28 -08:00
@@ -268,7 +268,7 @@
 	.long sys_msgrcv
 	.long sys_msgget
 	.long sys_msgctl
-	.long sys_ni_syscall /* sys_shmatcall */
+	.long sys_shmatcall
 	.long sys_shmdt			/* 245 */
 	.long sys_shmget
 	.long sys_shmctl
@@ -337,4 +337,9 @@
 	.long sys_mq_timedreceive
 	.long sys_mq_notify
 	.long sys_mq_getsetattr		/* 310 */
+	.long sys_ni_syscall	/* Reserved for kexec */
+	.long sys_waitid
+	.long sys_add_key
+	.long sys_request_key
+	.long sys_keyctl		/* 315 */
 
diff -Nru a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c
--- a/arch/sh64/kernel/time.c	2004-10-19 02:40:28 -07:00
+++ b/arch/sh64/kernel/time.c	2005-03-07 20:41:27 -08:00
@@ -45,6 +45,7 @@
 #define TMU_TOCR_INIT	0x00
 #define TMU0_TCR_INIT	0x0020
 #define TMU_TSTR_INIT	1
+#define TMU_TSTR_OFF	0
 
 /* RCR1 Bits */
 #define RCR1_CF		0x80	/* Carry Flag             */
@@ -424,7 +425,7 @@
 	*/
 	register unsigned long long  __rtc_irq_flag __asm__ ("r3");
 
-	sti();
+	local_irq_enable();
 	do {} while (ctrl_inb(R64CNT) != 0);
 	ctrl_outb(RCR1_CIE, RCR1); /* Enable carry interrupt */
 
@@ -443,7 +444,7 @@
 		     "getcon	" __CTC ", %0\n\t"
 		: "=r"(ctc_val), "=r" (__dummy), "=r" (__rtc_irq_flag)
 		: "0" (0));
-	cli();
+	local_irq_disable();
 	/*
 	 * SH-3:
 	 * CPU clock = 4 stages * loop
@@ -561,6 +562,7 @@
 	current_cpu_data.module_clock = module_clock;
 
 	/* Start TMU0 */
+	ctrl_outb(TMU_TSTR_OFF, TMU_TSTR);
 	ctrl_outb(TMU_TOCR_INIT, TMU_TOCR);
 	ctrl_outw(TMU0_TCR_INIT, TMU0_TCR);
 	ctrl_outl(interval, TMU0_TCOR);
diff -Nru a/arch/sh64/kernel/traps.c b/arch/sh64/kernel/traps.c
--- a/arch/sh64/kernel/traps.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/kernel/traps.c	2005-03-07 20:41:28 -08:00
@@ -30,6 +30,7 @@
 #include <linux/kallsyms.h>
 #include <linux/interrupt.h>
 #include <linux/sysctl.h>
+#include <linux/module.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -286,6 +287,8 @@
 {
 	show_task(NULL);
 }
+/* Needed by any user of WARN_ON in view of the defn in include/asm-sh/bug.h */
+EXPORT_SYMBOL(dump_stack);
 
 static void do_unhandled_exception(int trapnr, int signr, char *str, char *fn_name,
 		unsigned long error_code, struct pt_regs *regs, struct task_struct *tsk)
diff -Nru a/arch/sh64/lib/Makefile b/arch/sh64/lib/Makefile
--- a/arch/sh64/lib/Makefile	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/lib/Makefile	2005-03-07 20:41:27 -08:00
@@ -15,5 +15,5 @@
 
 # Panic should really be compiled as PIC
 lib-y  := udelay.o c-checksum.o dbg.o io.o panic.o memcpy.o copy_user_memcpy.o \
-		page_copy.o page_clear.o
+		page_copy.o page_clear.o iomap.o
 
diff -Nru a/arch/sh64/lib/copy_user_memcpy.S b/arch/sh64/lib/copy_user_memcpy.S
--- a/arch/sh64/lib/copy_user_memcpy.S	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/lib/copy_user_memcpy.S	2005-03-07 20:41:28 -08:00
@@ -46,6 +46,11 @@
 
 */
 
+/* NOTE : Prefetches removed and allocos guarded by synco to avoid TAKum03020
+ * erratum.  The first two prefetches are nop-ed out to avoid upsetting the
+ * instruction counts used in the jump address calculation.
+ * */
+
 	.section .text..SHmedia32,"ax"
 	.little
 	.balign 32
@@ -58,7 +63,7 @@
 #define LDUAL(P,O,D0,D1) ldlo.l P,O,D0; ldhi.l P,O+3,D1
 #define STUAL(P,O,D0,D1) stlo.l P,O,D0; sthi.l P,O+3,D1
 
-	ld.b r3,0,r63
+	nop ! ld.b r3,0,r63 ! TAKum03020
 	pta/l Large,tr0
 	movi 25,r0
 	bgeu/u r4,r0,tr0
@@ -108,7 +113,7 @@
 
 	/* 2 or 3 byte memcpy */
 	ld.b r3,0,r0
-	ld.b r2,0,r63
+	nop ! ld.b r2,0,r63 ! TAKum03020
 	ld.b r3,1,r1
 	st.b r2,0,r0
 	pta/l L2_3,tr0
@@ -151,7 +156,7 @@
 	blink tr1,r63
 
 Large:
-	ld.b r2, 0, r63
+	! ld.b r2, 0, r63 ! TAKum03020
 	pta/l  Loop_ua, tr1
 	ori r3, -8, r7
 	sub r2, r7, r22
@@ -173,8 +178,7 @@
 	addi r6, -8, r21
 
 Loop_line:
-	ldx.q r22, r36, r63
-	synco
+	! ldx.q r22, r36, r63 ! TAKum03020
 	alloco r22, 32
 	synco
 	addi r22, 32, r22
diff -Nru a/arch/sh64/lib/dbg.c b/arch/sh64/lib/dbg.c
--- a/arch/sh64/lib/dbg.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/lib/dbg.c	2005-03-07 20:41:28 -08:00
@@ -8,6 +8,7 @@
 -- Copyright 2004 Richard Curnow (evt_debug etc)
 --
 --------------------------------------------------------------------------*/
+#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -136,6 +137,8 @@
 
 /* ======================================================================= */
 
+#ifdef CONFIG_POOR_MANS_STRACE
+
 #include "syscalltab.h"
 
 struct ring_node {
@@ -151,6 +154,17 @@
 static struct ring_node event_ring[16];
 static int event_ptr = 0;
 
+struct stored_syscall_data {
+	int pid;
+	int syscall_number;
+};
+
+#define N_STORED_SYSCALLS 16
+
+static struct stored_syscall_data stored_syscalls[N_STORED_SYSCALLS];
+static int syscall_next=0;
+static int syscall_next_print=0;
+
 void evt_debug(int evt, int ret_addr, int event, int tra, struct pt_regs *regs)
 {
 	int syscallno = tra & 0xff;
@@ -187,15 +201,35 @@
 	event_ptr = (event_ptr + 1) & 15;
 
 	if ((event == 2) && (evt == 0x160)) {
-		if (syscallno < NUM_SYSCALL_INFO_ENTRIES)
-			printk("Task %d: %s()\n",
-			       current->pid,
-			       syscall_info_table[syscallno].name);
+		if (syscallno < NUM_SYSCALL_INFO_ENTRIES) {
+			/* Store the syscall information to print later.  We
+			 * can't print this now - currently we're running with
+			 * SR.BL=1, so we can't take a tlbmiss (which could occur
+			 * in the console drivers under printk).
+			 *
+			 * Just overwrite old entries on ring overflow - this
+			 * is only for last-hope debugging. */
+			stored_syscalls[syscall_next].pid = current->pid;
+			stored_syscalls[syscall_next].syscall_number = syscallno;
+			syscall_next++;
+			syscall_next &= (N_STORED_SYSCALLS - 1);
+		}
+	}
+}
+
+static void drain_syscalls(void) {
+	while (syscall_next_print != syscall_next) {
+		printk("Task %d: %s()\n",
+			stored_syscalls[syscall_next_print].pid,
+			syscall_info_table[stored_syscalls[syscall_next_print].syscall_number].name);
+			syscall_next_print++;
+			syscall_next_print &= (N_STORED_SYSCALLS - 1);
 	}
 }
 
 void evt_debug2(unsigned int ret)
 {
+	drain_syscalls();
 	printk("Task %d: syscall returns %08x\n", current->pid, ret);
 }
 
@@ -230,6 +264,8 @@
 	rr->pc = regs->pc;
 	event_ptr = (event_ptr + 1) & 15;
 }
+
+#endif /* CONFIG_POOR_MANS_STRACE */
 
 /* ======================================================================= */
 
diff -Nru a/arch/sh64/lib/io.c b/arch/sh64/lib/io.c
--- a/arch/sh64/lib/io.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/lib/io.c	2005-03-07 20:41:27 -08:00
@@ -9,14 +9,12 @@
  */
 
 #include <linux/config.h>
+#include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/delay.h>
 #include <asm/system.h>
 #include <asm/processor.h>
 #include <asm/io.h>
-#ifdef CONFIG_SH_CAYMAN
-#include <asm/cayman.h>
-#endif
 
 /*
  * readX/writeX() are used to access memory mapped devices. On some
@@ -25,71 +23,6 @@
  * memory location directly.
  */
 
-#define dprintk(x...)
-
-static int io_addr(int x) {
-	if (x < 0x400) {
-#ifdef CONFIG_SH_CAYMAN
-		return (x << 2) | smsc_superio_virt;
-#else
-		panic ("Illegal access to I/O port 0x%04x\n", x);
-		return 0;
-#endif
-	} else {
-#ifdef CONFIG_PCI
-		return (x + pciio_virt);
-#else
-		panic ("Illegal access to I/O port 0x%04x\n", x);
-		return 0;
-#endif
-	}
-}
-
-unsigned long inb(unsigned long port)
-{
-	unsigned long r;
-
-	r = ctrl_inb(io_addr(port));
-	dprintk("inb(0x%x)=0x%x (0x%x)\n", port, r, io_addr(port));
-	return r;
-}
-
-unsigned long inw(unsigned long port)
-{
-	unsigned long r;
-
-	r = ctrl_inw(io_addr(port));
-	dprintk("inw(0x%x)=0x%x (0x%x)\n", port, r, io_addr(port));
-	return r;
-}
-
-unsigned long inl(unsigned long port)
-{
-	unsigned long r;
-
-	r = ctrl_inl(io_addr(port));
-	dprintk("inl(0x%x)=0x%x (0x%x)\n", port, r, io_addr(port));
-	return r;
-}
-
-void outb(unsigned long value, unsigned long port)
-{
-	dprintk("outb(0x%x,0x%x) (0x%x)\n", value, port, io_addr(port));
-	ctrl_outb(value, io_addr(port));
-}
-
-void outw(unsigned long value, unsigned long port)
-{
-	dprintk("outw(0x%x,0x%x) (0x%x)\n", value, port, io_addr(port));
-	ctrl_outw(value, io_addr(port));
-}
-
-void outl(unsigned long value, unsigned long port)
-{
-	dprintk("outw(0x%x,0x%x) (0x%x)\n", value, port, io_addr(port));
-	ctrl_outl(value, io_addr(port));
-}
-
 /* This is horrible at the moment - needs more work to do something sensible */
 #define IO_DELAY()
 
@@ -185,7 +118,7 @@
 	}
 }
 
-void memcpy_toio(unsigned long to, const void *from, long count)
+void memcpy_toio(void __iomem *to, const void *from, long count)
 {
 	unsigned char *p = (unsigned char *) from;
 
@@ -195,7 +128,7 @@
 	}
 }
 
-void memcpy_fromio(void *to, unsigned long from, long count)
+void memcpy_fromio(void *to, void __iomem *from, long count)
 {
 	int i;
 	unsigned char *p = (unsigned char *) to;
diff -Nru a/arch/sh64/lib/iomap.c b/arch/sh64/lib/iomap.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/sh64/lib/iomap.c	2005-03-07 20:41:27 -08:00
@@ -0,0 +1,55 @@
+/*
+ * arch/sh64/lib/iomap.c
+ *
+ * Generic sh64 iomap interface
+ *
+ * Copyright (C) 2004  Paul Mundt
+ *
+ * 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 <linux/config.h>
+#include <linux/pci.h>
+#include <asm/io.h>
+
+void __iomem *__attribute__ ((weak))
+ioport_map(unsigned long port, unsigned int len)
+{
+	return (void __iomem *)port;
+}
+
+void ioport_unmap(void __iomem *addr)
+{
+	/* Nothing .. */
+}
+
+void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
+{
+	unsigned long start = pci_resource_start(dev, bar);
+	unsigned long len = pci_resource_len(dev, bar);
+	unsigned long flags = pci_resource_flags(dev, bar);
+
+	if (!len)
+		return NULL;
+	if (max && len > max)
+		len = max;
+	if (flags & IORESOURCE_IO)
+		return ioport_map(start + pciio_virt, len);
+	if (flags & IORESOURCE_MEM)
+		return (void __iomem *)start;
+
+	/* What? */
+	return NULL;
+}
+
+void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
+{
+	/* Nothing .. */
+}
+
+EXPORT_SYMBOL(ioport_map);
+EXPORT_SYMBOL(ioport_unmap);
+EXPORT_SYMBOL(pci_iomap);
+EXPORT_SYMBOL(pci_iounmap);
+
diff -Nru a/arch/sh64/lib/old-checksum.c b/arch/sh64/lib/old-checksum.c
--- a/arch/sh64/lib/old-checksum.c	2004-06-29 07:44:46 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,17 +0,0 @@
-/*
- * FIXME: old compatibility stuff, will be removed soon.
- */
-
-#include <net/checksum.h>
-
-unsigned int csum_partial_copy( const char *src, char *dst, int len, int sum)
-{
-	int src_err=0, dst_err=0;
-
-	sum = csum_partial_copy_generic ( src, dst, len, sum, &src_err, &dst_err);
-
-	if (src_err || dst_err)
-		printk("old csum_partial_copy_fromuser(), tell mingo to convert me.\n");
-
-	return sum;
-}
diff -Nru a/arch/sh64/lib/page_clear.S b/arch/sh64/lib/page_clear.S
--- a/arch/sh64/lib/page_clear.S	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/lib/page_clear.S	2005-03-07 20:41:28 -08:00
@@ -17,6 +17,8 @@
 
    Always clears 4096 bytes.
 
+   Note : alloco guarded by synco to avoid TAKum03020 erratum
+
 */
 
 	.section .text..SHmedia32,"ax"
@@ -34,6 +36,7 @@
 	add  r2, r63, r6
 1:
 	alloco r6, 0
+	synco	! TAKum03020
 	addi	r6, 32, r6
 	bgt/l	r7, r6, tr1
 
diff -Nru a/arch/sh64/lib/page_copy.S b/arch/sh64/lib/page_copy.S
--- a/arch/sh64/lib/page_copy.S	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/lib/page_copy.S	2005-03-07 20:41:28 -08:00
@@ -39,12 +39,17 @@
 	pta 3f, tr3
 	ptabs r18, tr0
 
+#if 0
+	/* TAKum03020 */
 	ld.q r2, 0x00, r63
 	ld.q r2, 0x20, r63
 	ld.q r2, 0x40, r63
 	ld.q r2, 0x60, r63
+#endif
 	alloco r3, 0x00
+	synco		! TAKum03020
 	alloco r3, 0x20
+	synco		! TAKum03020
 
 	movi 3968, r6
 	add  r3, r6, r6
@@ -60,11 +65,15 @@
    because they overlap with the time spent waiting for prefetches to
    complete. */
 1:
+#if 0
+	/* TAKum03020 */
 	bge/u r3, r6, tr2  ! skip prefetch for last 4 lines
 	ldx.q r3, r22, r63 ! prefetch 4 lines hence
+#endif
 2:
 	bge/u r3, r7, tr3  ! skip alloco for last 2 lines
 	alloco r3, 0x40    ! alloc destination line 2 lines ahead
+	synco		! TAKum03020
 3:
 	ldx.q r3, r60, r36
 	ldx.q r3, r61, r37
diff -Nru a/arch/sh64/mach-cayman/Makefile b/arch/sh64/mach-cayman/Makefile
--- a/arch/sh64/mach-cayman/Makefile	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/mach-cayman/Makefile	2005-03-07 20:41:27 -08:00
@@ -6,6 +6,6 @@
 # unless it's something special (ie not a .c file).
 #
 
-obj-y := setup.o irq.o
+obj-y := setup.o irq.o iomap.o
 obj-$(CONFIG_HEARTBEAT)	+= led.o
 
diff -Nru a/arch/sh64/mach-cayman/iomap.c b/arch/sh64/mach-cayman/iomap.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/arch/sh64/mach-cayman/iomap.c	2005-03-07 20:41:27 -08:00
@@ -0,0 +1,24 @@
+/*
+ * arch/sh64/mach-cayman/iomap.c
+ *
+ * Cayman iomap interface
+ *
+ * Copyright (C) 2004  Paul Mundt
+ *
+ * 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 <linux/config.h>
+#include <linux/pci.h>
+#include <asm/io.h>
+#include <asm/cayman.h>
+
+void __iomem *ioport_map(unsigned long port, unsigned int len)
+{
+	if (port < 0x400)
+		return (void __iomem *)((port << 2) | smsc_superio_virt);
+
+	return (void __iomem *)port;
+}
+
diff -Nru a/arch/sh64/mach-cayman/irq.c b/arch/sh64/mach-cayman/irq.c
--- a/arch/sh64/mach-cayman/irq.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/mach-cayman/irq.c	2005-03-07 20:41:27 -08:00
@@ -64,11 +64,11 @@
 	irq -= START_EXT_IRQS;
 	reg = EPLD_MASK_BASE + ((irq / 8) << 2);
 	bit = 1<<(irq % 8);
-	save_and_cli(flags);
+	local_irq_save(flags);
 	mask = ctrl_inl(reg);
 	mask |= bit;
 	ctrl_outl(mask, reg);
-	restore_flags(flags);
+	local_irq_restore(flags);
 }
 
 void disable_cayman_irq(unsigned int irq)
@@ -81,11 +81,11 @@
 	irq -= START_EXT_IRQS;
 	reg = EPLD_MASK_BASE + ((irq / 8) << 2);
 	bit = 1<<(irq % 8);
-	save_and_cli(flags);
+	local_irq_save(flags);
 	mask = ctrl_inl(reg);
 	mask &= ~bit;
 	ctrl_outl(mask, reg);
-	restore_flags(flags);
+	local_irq_restore(flags);
 }
 
 static void ack_cayman_irq(unsigned int irq)
diff -Nru a/arch/sh64/mach-cayman/setup.c b/arch/sh64/mach-cayman/setup.c
--- a/arch/sh64/mach-cayman/setup.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/mach-cayman/setup.c	2005-03-07 20:41:27 -08:00
@@ -33,8 +33,6 @@
 #include <asm/irq.h>
 #include <asm/page.h>
 
-#define RES_COUNT(res) ((sizeof((res))/sizeof(struct resource)))
-
 /*
  * Platform Dependent Interrupt Priorities.
  */
@@ -86,10 +84,14 @@
 #define SMSC_DEVICE_ID_INDEX	0x20
 #define SMSC_DEVICE_REV_INDEX	0x21
 #define SMSC_ACTIVATE_INDEX	0x30
+#define SMSC_PRIMARY_BASE_INDEX  0x60
+#define SMSC_SECONDARY_BASE_INDEX 0x62
 #define SMSC_PRIMARY_INT_INDEX	0x70
 #define SMSC_SECONDARY_INT_INDEX 0x72
 
-#define SMSC_KEYBOARD_DEVICE 7
+#define SMSC_IDE1_DEVICE	1
+#define SMSC_KEYBOARD_DEVICE	7
+#define SMSC_CONFIG_REGISTERS	8
 
 #define SMSC_SUPERIO_READ_INDEXED(index) ({ \
 	outb((index), SMSC_INDEX_PORT_ADDR); \
@@ -98,6 +100,9 @@
 	outb((index), SMSC_INDEX_PORT_ADDR); \
 	outb((val),   SMSC_DATA_PORT_ADDR); })
 
+#define IDE1_PRIMARY_BASE	0x01f0
+#define IDE1_SECONDARY_BASE	0x03f6
+
 unsigned long smsc_superio_virt;
 
 /*
@@ -125,13 +130,13 @@
 	.initial_root_dev =	0x0100,
 	.loader_type =		1,
 	.io_res_p =		io_resources,
-	.io_res_count =		RES_COUNT(io_resources),
+	.io_res_count =		ARRAY_SIZE(io_resources),
 	.kram_res_p =		kram_resources,
-	.kram_res_count =	RES_COUNT(kram_resources),
+	.kram_res_count =	ARRAY_SIZE(kram_resources),
 	.xram_res_p =		xram_resources,
-	.xram_res_count =	RES_COUNT(xram_resources),
+	.xram_res_count =	ARRAY_SIZE(xram_resources),
 	.rom_res_p =		rom_resources,
-	.rom_res_count =	RES_COUNT(rom_resources),
+	.rom_res_count =	ARRAY_SIZE(rom_resources),
 };
 
 int platform_int_priority[NR_INTC_IRQS] = {
@@ -174,6 +179,38 @@
 	/* On a PC keyboard is IRQ1, mouse is IRQ12 */
 	SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_PRIMARY_INT_INDEX);
 	SMSC_SUPERIO_WRITE_INDEXED(12, SMSC_SECONDARY_INT_INDEX);
+
+#ifdef CONFIG_IDE
+	/*
+	 * Only IDE1 exists on the Cayman
+	 */
+
+	/* Power it on */
+	SMSC_SUPERIO_WRITE_INDEXED(1 << SMSC_IDE1_DEVICE, 0x22);
+
+	SMSC_SUPERIO_WRITE_INDEXED(SMSC_IDE1_DEVICE, SMCS_LOGICAL_DEV_INDEX);
+	SMSC_SUPERIO_WRITE_INDEXED(1, SMSC_ACTIVATE_INDEX);
+
+	SMSC_SUPERIO_WRITE_INDEXED(IDE1_PRIMARY_BASE >> 8,
+				   SMSC_PRIMARY_BASE_INDEX + 0);
+	SMSC_SUPERIO_WRITE_INDEXED(IDE1_PRIMARY_BASE & 0xff,
+				   SMSC_PRIMARY_BASE_INDEX + 1);
+
+	SMSC_SUPERIO_WRITE_INDEXED(IDE1_SECONDARY_BASE >> 8,
+				   SMSC_SECONDARY_BASE_INDEX + 0);
+	SMSC_SUPERIO_WRITE_INDEXED(IDE1_SECONDARY_BASE & 0xff,
+				   SMSC_SECONDARY_BASE_INDEX + 1);
+
+	SMSC_SUPERIO_WRITE_INDEXED(14, SMSC_PRIMARY_INT_INDEX);
+
+	SMSC_SUPERIO_WRITE_INDEXED(SMSC_CONFIG_REGISTERS,
+				   SMCS_LOGICAL_DEV_INDEX);
+
+	SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc2); /* GP42 = nIDE1_OE */
+	SMSC_SUPERIO_WRITE_INDEXED(0x01, 0xc5); /* GP45 = IDE1_IRQ */
+	SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc6); /* GP46 = nIOROP */
+	SMSC_SUPERIO_WRITE_INDEXED(0x00, 0xc7); /* GP47 = nIOWOP */
+#endif
 
 	/* Exit the configuraton state */
 	outb(SMSC_EXIT_CONFIG_KEY, SMSC_CONFIG_PORT_ADDR);
diff -Nru a/arch/sh64/mm/cache.c b/arch/sh64/mm/cache.c
--- a/arch/sh64/mm/cache.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/mm/cache.c	2005-03-07 20:41:27 -08:00
@@ -114,6 +114,16 @@
 	return 0;
 }
 
+#ifdef CONFIG_DCACHE_DISABLED
+#define sh64_dcache_purge_all()					do { } while (0)
+#define sh64_dcache_purge_coloured_phy_page(paddr, eaddr)	do { } while (0)
+#define sh64_dcache_purge_user_range(mm, start, end)		do { } while (0)
+#define sh64_dcache_purge_phy_page(paddr)			do { } while (0)
+#define sh64_dcache_purge_virt_page(mm, eaddr)			do { } while (0)
+#define sh64_dcache_purge_kernel_range(start, end)		do { } while (0)
+#define sh64_dcache_wback_current_user_range(start, end)	do { } while (0)
+#endif
+
 /*##########################################################################*/
 
 /* From here onwards, a rewrite of the implementation,
@@ -436,6 +446,7 @@
 		eaddr1 = eaddr0 + cpu_data->dcache.way_ofs * cpu_data->dcache.ways;
 		for (eaddr=eaddr0; eaddr<eaddr1; eaddr+=cpu_data->dcache.way_ofs) {
 			asm __volatile__ ("alloco %0, 0" : : "r" (eaddr));
+			asm __volatile__ ("synco"); /* TAKum03020 */
 		}
 
 		eaddr1 = eaddr0 + cpu_data->dcache.way_ofs * cpu_data->dcache.ways;
@@ -573,31 +584,6 @@
 	}
 }
 
-static void sh64_dcache_purge_virt_page(struct mm_struct *mm, unsigned long eaddr)
-{
-	unsigned long phys;
-	pgd_t *pgd;
-	pmd_t *pmd;
-	pte_t *pte;
-	pte_t entry;
-
-	pgd = pgd_offset(mm, eaddr);
-	pmd = pmd_offset(pgd, eaddr);
-
-	if (pmd_none(*pmd) || pmd_bad(*pmd))
-		return;
-
-	pte = pte_offset_kernel(pmd, eaddr);
-	entry = *pte;
-
-	if (pte_none(entry) || !pte_present(entry))
-		return;
-
-	phys = pte_val(entry) & PAGE_MASK;
-
-	sh64_dcache_purge_phy_page(phys);
-}
-
 static void sh64_dcache_purge_user_page(struct mm_struct *mm, unsigned long eaddr)
 {
 	pgd_t *pgd;
@@ -766,8 +752,6 @@
 	}
 }
 
-#endif /* !CONFIG_DCACHE_DISABLED */
-
 /****************************************************************************/
 
 /* These *MUST* lie in an area of virtual address space that's otherwise unused. */
@@ -830,6 +814,8 @@
 	sh64_teardown_dtlb_cache_slot();
 }
 
+#endif /* !CONFIG_DCACHE_DISABLED */
+
 /****************************************************************************/
 
 /*##########################################################################
@@ -904,7 +890,7 @@
 
 /****************************************************************************/
 
-void flush_cache_page(struct vm_area_struct *vma, unsigned long eaddr)
+void flush_cache_page(struct vm_area_struct *vma, unsigned long eaddr, unsigned long pfn)
 {
 	/* Invalidate any entries in either cache for the vma within the user
 	   address space vma->vm_mm for the page starting at virtual address
@@ -915,7 +901,7 @@
 	   Note(1), this is called with mm->page_table_lock held.
 	   */
 
-	sh64_dcache_purge_virt_page(vma->vm_mm, eaddr);
+	sh64_dcache_purge_phy_page(pfn << PAGE_SHIFT);
 
 	if (vma->vm_flags & VM_EXEC) {
 		sh64_icache_inv_user_page(vma, eaddr);
diff -Nru a/arch/sh64/mm/extable.c b/arch/sh64/mm/extable.c
--- a/arch/sh64/mm/extable.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/mm/extable.c	2005-03-07 20:41:28 -08:00
@@ -15,7 +15,8 @@
 #include <linux/module.h>
 #include <asm/uaccess.h>
 
-extern unsigned long copy_user_memcpy, copy_user_memcpy_end, __copy_user_fixup;
+extern unsigned long copy_user_memcpy, copy_user_memcpy_end;
+extern void __copy_user_fixup(void);
 
 static const struct exception_table_entry __copy_user_fixup_ex = {
 	.fixup = (unsigned long)&__copy_user_fixup,
diff -Nru a/arch/sh64/mm/fault.c b/arch/sh64/mm/fault.c
--- a/arch/sh64/mm/fault.c	2004-09-07 23:32:57 -07:00
+++ b/arch/sh64/mm/fault.c	2005-03-07 20:41:28 -08:00
@@ -148,7 +148,7 @@
 	mm = tsk->mm;
 
 	/* Not an IO address, so reenable interrupts */
-	sti();
+	local_irq_enable();
 
 	/*
 	 * If we're in an interrupt or have no user
@@ -203,17 +203,17 @@
  * we can handle it..
  */
 good_area:
-	if (writeaccess) {
-		if (!(vma->vm_flags & VM_WRITE))
-			goto bad_area;
-	} else {
-		if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
-			goto bad_area;
-	}
-
 	if (textaccess) {
 		if (!(vma->vm_flags & VM_EXEC))
 			goto bad_area;
+	} else {
+		if (writeaccess) {
+			if (!(vma->vm_flags & VM_WRITE))
+				goto bad_area;
+		} else {
+			if (!(vma->vm_flags & VM_READ))
+				goto bad_area;
+		}
 	}
 
 	/*
@@ -264,17 +264,28 @@
 	up_read(&mm->mmap_sem);
 
 	if (user_mode(regs)) {
-		printk("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx opcode=%08lx\n",
-			address, current->pid, current->comm,
-			(unsigned long) regs->pc,
-			*(unsigned long *)(u32)(regs->pc & ~3));
-		show_regs(regs);
+		static int count=0;
+		siginfo_t info;
+		if (count < 4) {
+			/* This is really to help debug faults when starting
+			 * usermode, so only need a few */
+			count++;
+			printk("user mode bad_area address=%08lx pid=%d (%s) pc=%08lx\n",
+				address, current->pid, current->comm,
+				(unsigned long) regs->pc);
+#if 0
+			show_regs(regs);
+#endif
+		}
 		if (tsk->pid == 1) {
 			panic("INIT had user mode bad_area\n");
 		}
 		tsk->thread.address = address;
 		tsk->thread.error_code = writeaccess;
-		force_sig(SIGSEGV, tsk);
+		info.si_signo = SIGSEGV;
+		info.si_errno = 0;
+		info.si_addr = (void *) address;
+		force_sig_info(SIGSEGV, &info, tsk);
 		return;
 	}
 
diff -Nru a/arch/sh64/mm/hugetlbpage.c b/arch/sh64/mm/hugetlbpage.c
--- a/arch/sh64/mm/hugetlbpage.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/mm/hugetlbpage.c	2005-02-23 15:40:52 -08:00
@@ -202,7 +202,7 @@
 		page = pte_page(*pte);
 		put_page(page);
 		for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
-			pte_clear(pte);
+			pte_clear(mm, address+(i*PAGE_SIZE), pte);
 			pte++;
 		}
 	}
diff -Nru a/arch/sh64/mm/ioremap.c b/arch/sh64/mm/ioremap.c
--- a/arch/sh64/mm/ioremap.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/mm/ioremap.c	2005-03-07 20:41:28 -08:00
@@ -182,8 +182,8 @@
 }
 
 static struct resource shmedia_iomap = {
-        .name	= "shmedia_iomap",
-	.start	= IOBASE_VADDR,
+	.name	= "shmedia_iomap",
+	.start	= IOBASE_VADDR + PAGE_SIZE,
 	.end	= IOBASE_END - 1,
 };
 
@@ -400,7 +400,7 @@
 		return;
 
 	clear_page((void *)ptep);
-	pte_clear(ptep);
+	pte_clear(&init_mm, vaddr, ptep);
 }
 
 unsigned long onchip_remap(unsigned long phys, unsigned long size, const char *name)
diff -Nru a/arch/sh64/mm/tlbmiss.c b/arch/sh64/mm/tlbmiss.c
--- a/arch/sh64/mm/tlbmiss.c	2004-09-07 23:32:57 -07:00
+++ b/arch/sh64/mm/tlbmiss.c	2005-03-07 20:41:28 -08:00
@@ -75,7 +75,6 @@
 
 	/* Set PTEL register, set_pte has performed the sign extension */
 	ptel &= _PAGE_FLAGS_HARDWARE_MASK; /* drop software flags */
-	ptel |= _PAGE_FLAGS_HARDWARE_DEFAULT; /* add default flags */
 
 	tlbp = is_text_not_data ? &(cpu_data->itlb) : &(cpu_data->dtlb);
 	next = tlbp->next;
diff -Nru a/arch/sh64/oprofile/op_model_null.c b/arch/sh64/oprofile/op_model_null.c
--- a/arch/sh64/oprofile/op_model_null.c	2004-06-29 07:44:46 -07:00
+++ b/arch/sh64/oprofile/op_model_null.c	2005-03-07 20:41:28 -08:00
@@ -12,7 +12,7 @@
 #include <linux/init.h>
 #include <linux/errno.h>
 
-int __init oprofile_arch_init(struct oprofile_operations **ops)
+int __init oprofile_arch_init(struct oprofile_operations *ops)
 {
 	return -ENODEV;
 }
diff -Nru a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
--- a/arch/sparc/kernel/ioport.c	2004-11-20 04:59:49 -08:00
+++ b/arch/sparc/kernel/ioport.c	2005-03-07 20:41:42 -08:00
@@ -54,11 +54,11 @@
 
 /* This points to the next to use virtual memory for DVMA mappings */
 static struct resource _sparc_dvma = {
-	"sparc_dvma", DVMA_VADDR, DVMA_END - 1
+	.name = "sparc_dvma", .start = DVMA_VADDR, .end = DVMA_END - 1
 };
 /* This points to the start of I/O mappings, cluable from outside. */
 /*ext*/ struct resource sparc_iomap = {
-	"sparc_iomap", IOBASE_VADDR, IOBASE_END - 1
+	.name = "sparc_iomap", .start = IOBASE_VADDR, .end = IOBASE_END - 1
 };
 
 /*
diff -Nru a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic.c
--- a/arch/sparc/mm/generic.c	2004-10-20 01:37:05 -07:00
+++ b/arch/sparc/mm/generic.c	2005-02-23 15:40:52 -08:00
@@ -47,7 +47,7 @@
  * They use a pgprot that sets PAGE_IO and does not check the
  * mem_map table as this is independent of normal memory.
  */
-static inline void io_remap_pte_range(pte_t * pte, unsigned long address, unsigned long size,
+static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte, unsigned long address, unsigned long size,
 	unsigned long offset, pgprot_t prot, int space)
 {
 	unsigned long end;
@@ -58,7 +58,7 @@
 		end = PMD_SIZE;
 	do {
 		pte_t oldpage = *pte;
-		pte_clear(pte);
+		pte_clear(mm, address, pte);
 		set_pte(pte, mk_pte_io(offset, prot, space));
 		forget_pte(oldpage);
 		address += PAGE_SIZE;
@@ -67,7 +67,7 @@
 	} while (address < end);
 }
 
-static inline int io_remap_pmd_range(pmd_t * pmd, unsigned long address, unsigned long size,
+static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size,
 	unsigned long offset, pgprot_t prot, int space)
 {
 	unsigned long end;
@@ -78,10 +78,10 @@
 		end = PGDIR_SIZE;
 	offset -= address;
 	do {
-		pte_t * pte = pte_alloc_map(current->mm, pmd, address);
+		pte_t * pte = pte_alloc_map(mm, pmd, address);
 		if (!pte)
 			return -ENOMEM;
-		io_remap_pte_range(pte, address, end - address, address + offset, prot, space);
+		io_remap_pte_range(mm, pte, address, end - address, address + offset, prot, space);
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;
 	} while (address < end);
@@ -107,7 +107,7 @@
 		error = -ENOMEM;
 		if (!pmd)
 			break;
-		error = io_remap_pmd_range(pmd, from, end - from, offset + from, prot, space);
+		error = io_remap_pmd_range(mm, pmd, from, end - from, offset + from, prot, space);
 		if (error)
 			break;
 		from = (from + PGDIR_SIZE) & PGDIR_MASK;
diff -Nru a/arch/sparc/mm/highmem.c b/arch/sparc/mm/highmem.c
--- a/arch/sparc/mm/highmem.c	2005-01-03 15:49:15 -08:00
+++ b/arch/sparc/mm/highmem.c	2005-02-23 15:40:52 -08:00
@@ -88,7 +88,7 @@
 	 * force other mappings to Oops if they'll try to access
 	 * this pte without first remap it
 	 */
-	pte_clear(kmap_pte-idx);
+	pte_clear(&init_mm, vaddr, kmap_pte-idx);
 /* XXX Fix - Anton */
 #if 0
 	__flush_tlb_one(vaddr);
diff -Nru a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
--- a/arch/sparc/mm/srmmu.c	2005-02-12 11:13:59 -08:00
+++ b/arch/sparc/mm/srmmu.c	2005-02-25 16:35:19 -08:00
@@ -1003,8 +1003,7 @@
 extern void viking_flush_cache_mm(struct mm_struct *mm);
 extern void viking_flush_cache_range(struct vm_area_struct *vma, unsigned long start,
 				     unsigned long end);
-extern void viking_flush_cache_page(struct vm_area_struct *vma,
-				    unsigned long page);
+extern void viking_flush_cache_page(struct vm_area_struct *vma, unsigned long page);
 extern void viking_flush_page_to_ram(unsigned long page);
 extern void viking_flush_page_for_dma(unsigned long page);
 extern void viking_flush_sig_insns(struct mm_struct *mm, unsigned long addr);
diff -Nru a/arch/sparc64/defconfig b/arch/sparc64/defconfig
--- a/arch/sparc64/defconfig	2005-02-17 21:53:03 -08:00
+++ b/arch/sparc64/defconfig	2005-03-06 20:47:44 -08:00
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.11-rc4
-# Thu Feb 17 15:32:19 2005
+# Linux kernel version: 2.6.11
+# Sun Mar  6 20:47:29 2005
 #
 CONFIG_64BIT=y
 CONFIG_MMU=y
@@ -368,6 +368,7 @@
 CONFIG_SCSI_ATA_PIIX=m
 CONFIG_SCSI_SATA_NV=m
 CONFIG_SCSI_SATA_PROMISE=m
+CONFIG_SCSI_SATA_QSTOR=m
 CONFIG_SCSI_SATA_SX4=m
 CONFIG_SCSI_SATA_SIL=m
 CONFIG_SCSI_SATA_SIS=m
@@ -737,6 +738,7 @@
 CONFIG_NET_QOS=y
 CONFIG_NET_ESTIMATOR=y
 CONFIG_NET_CLS=y
+CONFIG_NET_CLS_BASIC=m
 CONFIG_NET_CLS_TCINDEX=m
 CONFIG_NET_CLS_ROUTE4=m
 CONFIG_NET_CLS_ROUTE=y
@@ -747,6 +749,12 @@
 CONFIG_CLS_U32_MARK=y
 CONFIG_NET_CLS_RSVP=m
 CONFIG_NET_CLS_RSVP6=m
+CONFIG_NET_EMATCH=y
+CONFIG_NET_EMATCH_STACK=32
+CONFIG_NET_EMATCH_CMP=m
+CONFIG_NET_EMATCH_NBYTE=m
+CONFIG_NET_EMATCH_U32=m
+CONFIG_NET_EMATCH_META=m
 CONFIG_NET_CLS_ACT=y
 CONFIG_NET_ACT_POLICE=m
 CONFIG_NET_ACT_GACT=m
@@ -899,7 +907,6 @@
 CONFIG_DGRS=m
 CONFIG_EEPRO100=m
 CONFIG_E100=m
-CONFIG_E100_NAPI=y
 CONFIG_FEALNX=m
 CONFIG_NATSEMI=m
 CONFIG_NE2K_PCI=m
@@ -1171,6 +1178,7 @@
 CONFIG_I2C_NFORCE2=m
 CONFIG_I2C_PARPORT=m
 CONFIG_I2C_PARPORT_LIGHT=m
+CONFIG_I2C_PIIX4=m
 CONFIG_I2C_PROSAVAGE=m
 CONFIG_I2C_SAVAGE4=m
 CONFIG_SCx200_ACB=m
@@ -1194,7 +1202,9 @@
 CONFIG_SENSORS_ASB100=m
 CONFIG_SENSORS_DS1621=m
 CONFIG_SENSORS_FSCHER=m
+CONFIG_SENSORS_FSCPOS=m
 CONFIG_SENSORS_GL518SM=m
+CONFIG_SENSORS_GL520SM=m
 CONFIG_SENSORS_IT87=m
 CONFIG_SENSORS_LM63=m
 CONFIG_SENSORS_LM75=m
@@ -1208,6 +1218,7 @@
 CONFIG_SENSORS_MAX1619=m
 CONFIG_SENSORS_PC87360=m
 CONFIG_SENSORS_SMSC47B397=m
+CONFIG_SENSORS_SIS5595=m
 CONFIG_SENSORS_SMSC47M1=m
 CONFIG_SENSORS_VIA686A=m
 CONFIG_SENSORS_W83781D=m
@@ -1909,6 +1920,7 @@
 CONFIG_CRYPTO_SHA256=m
 CONFIG_CRYPTO_SHA512=m
 CONFIG_CRYPTO_WP512=m
+CONFIG_CRYPTO_TGR192=m
 CONFIG_CRYPTO_DES=y
 CONFIG_CRYPTO_BLOWFISH=m
 CONFIG_CRYPTO_TWOFISH=m
diff -Nru a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
--- a/arch/sparc64/kernel/ioctl32.c	2004-07-26 11:37:30 -07:00
+++ b/arch/sparc64/kernel/ioctl32.c	2005-03-07 20:41:38 -08:00
@@ -475,7 +475,6 @@
 #include <linux/compat_ioctl.h>
 #define DECLARES
 #include "compat_ioctl.c"
-COMPATIBLE_IOCTL(TCSBRKP)
 COMPATIBLE_IOCTL(TIOCSTART)
 COMPATIBLE_IOCTL(TIOCSTOP)
 COMPATIBLE_IOCTL(TIOCSLTC)
diff -Nru a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
--- a/arch/sparc64/kernel/irq.c	2005-01-20 21:02:14 -08:00
+++ b/arch/sparc64/kernel/irq.c	2005-03-08 19:16:31 -08:00
@@ -1112,7 +1112,7 @@
 void init_irqwork_curcpu(void)
 {
 	register struct irq_work_struct *workp asm("o2");
-	unsigned long tmp;
+	register unsigned long tmp asm("o3");
 	int cpu = hard_smp_processor_id();
 
 	memset(__irq_work + cpu, 0, sizeof(*workp));
diff -Nru a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
--- a/arch/sparc64/kernel/pci.c	2005-01-20 21:02:14 -08:00
+++ b/arch/sparc64/kernel/pci.c	2005-02-07 12:52:02 -08:00
@@ -794,12 +794,6 @@
 }
 EXPORT_SYMBOL(pci_domain_nr);
 
-int pci_name_bus(char *name, struct pci_bus *bus)
-{
-	sprintf(name, "%04x:%02x", pci_domain_nr(bus), bus->number);
-	return 0;
-}
-
 int pcibios_prep_mwi(struct pci_dev *dev)
 {
 	/* We set correct PCI_CACHE_LINE_SIZE register values for every
diff -Nru a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
--- a/arch/sparc64/kernel/pci_schizo.c	2005-01-20 21:02:14 -08:00
+++ b/arch/sparc64/kernel/pci_schizo.c	2005-03-04 16:46:31 -08:00
@@ -326,9 +326,9 @@
 	return ret;
 }
 
-static unsigned int __init schizo_irq_build(struct pci_pbm_info *pbm,
-					    struct pci_dev *pdev,
-					    unsigned int ino)
+static unsigned int schizo_irq_build(struct pci_pbm_info *pbm,
+				     struct pci_dev *pdev,
+				     unsigned int ino)
 {
 	struct ino_bucket *bucket;
 	unsigned long imap, iclr;
@@ -382,19 +382,57 @@
 static unsigned long stc_tag_buf[16];
 static unsigned long stc_line_buf[16];
 
-/* These offsets look weird because I keep in pbm->controller_regs
- * the second PROM register property minus 0x10000 which is the
- * base of the Safari and UPA64S registers of SCHIZO.
- */
-#define SCHIZO_PBM_A_REGS_OFF	(0x600000UL - 0x400000UL)
-#define SCHIZO_PBM_B_REGS_OFF	(0x700000UL - 0x400000UL)
+#define SCHIZO_UE_INO		0x30 /* Uncorrectable ECC error */
+#define SCHIZO_CE_INO		0x31 /* Correctable ECC error */
+#define SCHIZO_PCIERR_A_INO	0x32 /* PBM A PCI bus error */
+#define SCHIZO_PCIERR_B_INO	0x33 /* PBM B PCI bus error */
+#define SCHIZO_SERR_INO		0x34 /* Safari interface error */
 
-static void schizo_clear_other_err_intr(int irq)
+struct pci_pbm_info *pbm_for_ino(struct pci_controller_info *p, u32 ino)
 {
-	struct ino_bucket *bucket = __bucket(irq);
-	unsigned long iclr = bucket->iclr;
+	ino &= IMAP_INO;
+	if (p->pbm_A.ino_bitmap & (1UL << ino))
+		return &p->pbm_A;
+	if (p->pbm_B.ino_bitmap & (1UL << ino))
+		return &p->pbm_B;
+
+	printk("PCI%d: No ino_bitmap entry for ino[%x], bitmaps "
+	       "PBM_A[%016lx] PBM_B[%016lx]",
+	       p->index, ino,
+	       p->pbm_A.ino_bitmap,
+	       p->pbm_B.ino_bitmap);
+	printk("PCI%d: Using PBM_A, report this problem immediately.\n",
+	       p->index);
+
+	return &p->pbm_A;
+}
+
+static void schizo_clear_other_err_intr(struct pci_controller_info *p, int irq)
+{
+	struct pci_pbm_info *pbm;
+	struct ino_bucket *bucket;
+	unsigned long iclr;
+
+	/* Do not clear the interrupt for the other PCI bus.
+	 *
+	 * This "ACK both PBM IRQs" only needs to be performed
+	 * for chip-wide error interrupts.
+	 */
+	if ((irq & IMAP_INO) == SCHIZO_PCIERR_A_INO ||
+	    (irq & IMAP_INO) == SCHIZO_PCIERR_B_INO)
+		return;
+
+	pbm = pbm_for_ino(p, irq);
+	if (pbm == &p->pbm_A)
+		pbm = &p->pbm_B;
+	else
+		pbm = &p->pbm_A;
+
+	irq = schizo_irq_build(pbm, NULL,
+			       (pbm->portid << 6) | (irq & IMAP_INO));
+	bucket = __bucket(irq);
+	iclr = bucket->iclr;
 
-	iclr += (SCHIZO_PBM_B_REGS_OFF - SCHIZO_PBM_A_REGS_OFF);
 	upa_writel(ICLR_IDLE, iclr);
 }
 
@@ -728,7 +766,7 @@
 	/* Interrogate IOMMU for error status. */
 	schizo_check_iommu_error(p, UE_ERR);
 
-	schizo_clear_other_err_intr(irq);
+	schizo_clear_other_err_intr(p, irq);
 
 	return IRQ_HANDLED;
 }
@@ -819,7 +857,7 @@
 		printk("(none)");
 	printk("]\n");
 
-	schizo_clear_other_err_intr(irq);
+	schizo_clear_other_err_intr(p, irq);
 
 	return IRQ_HANDLED;
 }
@@ -856,9 +894,9 @@
 #define SCHIZO_PCICTRL_SBH_ERR	(1UL << 35UL) /* Safari */
 #define SCHIZO_PCICTRL_SERR	(1UL << 34UL) /* Safari/Tomatillo */
 #define SCHIZO_PCICTRL_PCISPD	(1UL << 33UL) /* Safari */
-#define SCHIZO_PCICTRL_MRM_PREF	(1UL << 28UL) /* Tomatillo */
-#define SCHIZO_PCICTRL_RDO_PREF	(1UL << 27UL) /* Tomatillo */
-#define SCHIZO_PCICTRL_RDL_PREF	(1UL << 26UL) /* Tomatillo */
+#define SCHIZO_PCICTRL_MRM_PREF	(1UL << 30UL) /* Tomatillo */
+#define SCHIZO_PCICTRL_RDO_PREF	(1UL << 29UL) /* Tomatillo */
+#define SCHIZO_PCICTRL_RDL_PREF	(1UL << 28UL) /* Tomatillo */
 #define SCHIZO_PCICTRL_PTO	(3UL << 24UL) /* Safari/Tomatillo */
 #define SCHIZO_PCICTRL_PTO_SHIFT 24UL
 #define SCHIZO_PCICTRL_TRWSW	(7UL << 21UL) /* Tomatillo */
@@ -1040,7 +1078,7 @@
 	if (error_bits & (SCHIZO_PCIAFSR_PPERR | SCHIZO_PCIAFSR_SPERR))
 		pci_scan_for_parity_error(p, pbm, pbm->pci_bus);
 
-	schizo_clear_other_err_intr(irq);
+	schizo_clear_other_err_intr(p, irq);
 
 	return IRQ_HANDLED;
 }
@@ -1097,7 +1135,7 @@
 		printk("PCI%d: Unexpected Safari/JBUS error interrupt, errlog[%016lx]\n",
 		       p->index, errlog);
 
-		schizo_clear_other_err_intr(irq);
+		schizo_clear_other_err_intr(p, irq);
 		return IRQ_HANDLED;
 	}
 
@@ -1105,7 +1143,7 @@
 	       p->index);
 	schizo_check_iommu_error(p, SAFARI_ERR);
 
-	schizo_clear_other_err_intr(irq);
+	schizo_clear_other_err_intr(p, irq);
 	return IRQ_HANDLED;
 }
 
@@ -1120,26 +1158,6 @@
 #define SCHIZO_SAFARI_IRQCTRL	0x10010UL
 #define  SCHIZO_SAFIRQCTRL_EN	 0x8000000000000000UL
 
-#define SCHIZO_UE_INO		0x30 /* Uncorrectable ECC error */
-#define SCHIZO_CE_INO		0x31 /* Correctable ECC error */
-#define SCHIZO_PCIERR_A_INO	0x32 /* PBM A PCI bus error */
-#define SCHIZO_PCIERR_B_INO	0x33 /* PBM B PCI bus error */
-#define SCHIZO_SERR_INO		0x34 /* Safari interface error */
-
-struct pci_pbm_info *pbm_for_ino(struct pci_controller_info *p, u32 ino)
-{
-	ino &= IMAP_INO;
-	if (p->pbm_A.ino_bitmap & (1UL << ino))
-		return &p->pbm_A;
-	if (p->pbm_B.ino_bitmap & (1UL << ino))
-		return &p->pbm_B;
-	prom_printf("TOMATILLO%d: No entry in ino bitmap for %d\n",
-		    p->index, ino);
-	prom_halt();
-	/* NOTREACHED */
-	return NULL;
-}
-
 /* How the Tomatillo IRQs are routed around is pure guesswork here.
  *
  * All the Tomatillo devices I see in prtconf dumps seem to have only
@@ -1887,7 +1905,7 @@
 
 	tmp &= ~SCHIZO_PCICTRL_PTO;
 	if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO &&
-	    pbm->chip_version == 0x2)
+	    pbm->chip_version >= 0x2)
 		tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT;
 	else
 		tmp |= 0x1UL << SCHIZO_PCICTRL_PTO_SHIFT;
@@ -1895,8 +1913,16 @@
 	if (!prom_getbool(pbm->prom_node, "no-bus-parking"))
 		tmp |= SCHIZO_PCICTRL_PARK;
 
+	if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO &&
+	    pbm->chip_version <= 0x1)
+		tmp |= (1UL << 61);
+	else
+		tmp &= ~(1UL << 61);
+
 	if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO)
-		tmp |= SCHIZO_PCICTRL_MRM_PREF;
+		tmp |= (SCHIZO_PCICTRL_MRM_PREF |
+			SCHIZO_PCICTRL_RDO_PREF |
+			SCHIZO_PCICTRL_RDL_PREF);
 
 	schizo_write(pbm->pbm_regs + SCHIZO_PCI_CTRL, tmp);
 
diff -Nru a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
--- a/arch/sparc64/kernel/signal.c	2004-10-20 01:37:14 -07:00
+++ b/arch/sparc64/kernel/signal.c	2005-03-07 21:20:28 -08:00
@@ -53,7 +53,7 @@
 	flush_user_windows();
 	if (get_thread_wsaved()					||
 	    (((unsigned long)ucp) & (sizeof(unsigned long)-1))	||
-	    (!__access_ok((unsigned long)ucp, sizeof(*ucp))))
+	    (!__access_ok(ucp, sizeof(*ucp))))
 		goto do_sigsegv;
 	grp  = &ucp->uc_mcontext.mc_gregs;
 	err  = __get_user(pc, &((*grp)[MC_PC]));
diff -Nru a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
--- a/arch/sparc64/kernel/signal32.c	2005-02-02 04:05:45 -08:00
+++ b/arch/sparc64/kernel/signal32.c	2005-03-07 21:20:28 -08:00
@@ -1102,7 +1102,7 @@
 		goto sigsegv;
 	}
 
-	if (!__access_ok((unsigned long)c, sizeof(*c))) {
+	if (!__access_ok(c, sizeof(*c))) {
 		/* Miguel, add nice debugging msg _here_. ;-) */
 		goto sigsegv;
 	}
diff -Nru a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
--- a/arch/sparc64/kernel/sys_sparc32.c	2005-02-17 21:53:03 -08:00
+++ b/arch/sparc64/kernel/sys_sparc32.c	2005-03-06 20:49:59 -08:00
@@ -268,7 +268,7 @@
 			/* sign extend semid */
 			return compat_sys_semtimedop((int)first,
 						     compat_ptr(ptr), second,
-						     compat_ptr(third));
+						     compat_ptr(fifth));
 		/* else fall through for normal semop() */
 	case SEMOP:
 		/* struct sembuf is the same on 32 and 64bit :)) */
@@ -1120,35 +1120,4 @@
 		err = __put_user (t, timer_id);
 
 	return err;
-}
-
-asmlinkage long compat_sys_waitid(u32 which, u32 pid,
-				  struct compat_siginfo __user *uinfo,
-				  u32 options, struct compat_rusage __user *uru)
-{
-	siginfo_t info;
-	struct rusage ru;
-	long ret;
-	mm_segment_t old_fs = get_fs();
-
-	memset(&info, 0, sizeof(info));
-
-	set_fs (KERNEL_DS);
-	ret = sys_waitid(which, pid, (siginfo_t __user *) &info,
-			 options,
-			 uru ? (struct rusage __user *) &ru : NULL);
-	set_fs (old_fs);
-
-	if (ret < 0 || info.si_signo == 0)
-		return ret;
-
-	if (uru) {
-		ret = put_compat_rusage(&ru, uru);
-		if (ret)
-			return ret;
-	}
-
-	BUG_ON(info.si_code & __SI_MASK);
-	info.si_code |= __SI_CHLD;
-	return copy_siginfo_to_user32(uinfo, &info);
 }
diff -Nru a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
--- a/arch/sparc64/kernel/time.c	2005-01-20 21:02:14 -08:00
+++ b/arch/sparc64/kernel/time.c	2005-03-02 14:02:54 -08:00
@@ -779,6 +779,7 @@
 		    strcmp(model, "mk48t59") &&
 		    strcmp(model, "m5819") &&
 		    strcmp(model, "m5819p") &&
+		    strcmp(model, "m5823") &&
 		    strcmp(model, "ds1287")) {
 			if (cbus != NULL) {
 				prom_printf("clock_probe: Central bus lacks timer chip.\n");
@@ -838,7 +839,8 @@
 
 			if (!strcmp(model, "ds1287") ||
 			    !strcmp(model, "m5819") ||
-			    !strcmp(model, "m5819p")) {
+			    !strcmp(model, "m5819p") ||
+			    !strcmp(model, "m5823")) {
 				ds1287_regs = edev->resource[0].start;
 			} else {
 				mstk48t59_regs = edev->resource[0].start;
@@ -859,7 +861,8 @@
 			}
 			if (!strcmp(model, "ds1287") ||
 			    !strcmp(model, "m5819") ||
-			    !strcmp(model, "m5819p")) {
+			    !strcmp(model, "m5819p") ||
+			    !strcmp(model, "m5823")) {
 				ds1287_regs = isadev->resource.start;
 			} else {
 				mstk48t59_regs = isadev->resource.start;
diff -Nru a/arch/sparc64/mm/generic.c b/arch/sparc64/mm/generic.c
--- a/arch/sparc64/mm/generic.c	2005-01-25 20:34:29 -08:00
+++ b/arch/sparc64/mm/generic.c	2005-02-23 17:45:36 -08:00
@@ -25,8 +25,11 @@
  * side-effect bit will be turned off.  This is used as a
  * performance improvement on FFB/AFB. -DaveM
  */
-static inline void io_remap_pte_range(pte_t * pte, unsigned long address, unsigned long size,
-	unsigned long offset, pgprot_t prot, int space)
+static inline void io_remap_pte_range(struct mm_struct *mm, pte_t * pte,
+				      unsigned long address,
+				      unsigned long size,
+				      unsigned long offset, pgprot_t prot,
+				      int space)
 {
 	unsigned long end;
 
@@ -67,14 +70,14 @@
 			pte_val(entry) &= ~(_PAGE_E);
 		do {
 			BUG_ON(!pte_none(*pte));
-			set_pte(pte, entry);
+			set_pte_at(mm, address, pte, entry);
 			address += PAGE_SIZE;
 			pte++;
 		} while (address < curend);
 	} while (address < end);
 }
 
-static inline int io_remap_pmd_range(pmd_t * pmd, unsigned long address, unsigned long size,
+static inline int io_remap_pmd_range(struct mm_struct *mm, pmd_t * pmd, unsigned long address, unsigned long size,
 	unsigned long offset, pgprot_t prot, int space)
 {
 	unsigned long end;
@@ -85,10 +88,10 @@
 		end = PGDIR_SIZE;
 	offset -= address;
 	do {
-		pte_t * pte = pte_alloc_map(current->mm, pmd, address);
+		pte_t * pte = pte_alloc_map(mm, pmd, address);
 		if (!pte)
 			return -ENOMEM;
-		io_remap_pte_range(pte, address, end - address, address + offset, prot, space);
+		io_remap_pte_range(mm, pte, address, end - address, address + offset, prot, space);
 		pte_unmap(pte);
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;
@@ -96,7 +99,7 @@
 	return 0;
 }
 
-static inline int io_remap_pud_range(pud_t * pud, unsigned long address, unsigned long size,
+static inline int io_remap_pud_range(struct mm_struct *mm, pud_t * pud, unsigned long address, unsigned long size,
 	unsigned long offset, pgprot_t prot, int space)
 {
 	unsigned long end;
@@ -107,10 +110,10 @@
 		end = PUD_SIZE;
 	offset -= address;
 	do {
-		pmd_t *pmd = pmd_alloc(current->mm, pud, address);
+		pmd_t *pmd = pmd_alloc(mm, pud, address);
 		if (!pud)
 			return -ENOMEM;
-		io_remap_pmd_range(pmd, address, end - address, address + offset, prot, space);
+		io_remap_pmd_range(mm, pmd, address, end - address, address + offset, prot, space);
 		address = (address + PUD_SIZE) & PUD_MASK;
 		pud++;
 	} while (address < end);
@@ -132,11 +135,11 @@
 
 	spin_lock(&mm->page_table_lock);
 	while (from < end) {
-		pud_t *pud = pud_alloc(current->mm, dir, from);
+		pud_t *pud = pud_alloc(mm, dir, from);
 		error = -ENOMEM;
 		if (!pud)
 			break;
-		error = io_remap_pud_range(pud, from, end - from, offset + from, prot, space);
+		error = io_remap_pud_range(mm, pud, from, end - from, offset + from, prot, space);
 		if (error)
 			break;
 		from = (from + PGDIR_SIZE) & PGDIR_MASK;
diff -Nru a/arch/sparc64/mm/hugetlbpage.c b/arch/sparc64/mm/hugetlbpage.c
--- a/arch/sparc64/mm/hugetlbpage.c	2005-01-25 20:34:29 -08:00
+++ b/arch/sparc64/mm/hugetlbpage.c	2005-02-23 17:45:36 -08:00
@@ -62,6 +62,7 @@
 #define mk_pte_huge(entry) do { pte_val(entry) |= _PAGE_SZHUGE; } while (0)
 
 static void set_huge_pte(struct mm_struct *mm, struct vm_area_struct *vma,
+			 unsigned long addr,
 			 struct page *page, pte_t * page_table, int write_access)
 {
 	unsigned long i;
@@ -78,8 +79,9 @@
 	mk_pte_huge(entry);
 
 	for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
-		set_pte(page_table, entry);
+		set_pte_at(mm, addr, page_table, entry);
 		page_table++;
+		addr += PAGE_SIZE;
 
 		pte_val(entry) += PAGE_SIZE;
 	}
@@ -116,12 +118,12 @@
 		ptepage = pte_page(entry);
 		get_page(ptepage);
 		for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
-			set_pte(dst_pte, entry);
+			set_pte_at(dst, addr, dst_pte, entry);
 			pte_val(entry) += PAGE_SIZE;
 			dst_pte++;
+			addr += PAGE_SIZE;
 		}
 		dst->rss += (HPAGE_SIZE / PAGE_SIZE);
-		addr += HPAGE_SIZE;
 	}
 	return 0;
 
@@ -207,7 +209,7 @@
 		page = pte_page(*pte);
 		put_page(page);
 		for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) {
-			pte_clear(pte);
+			pte_clear(mm, address+(i*PAGE_SIZE), pte);
 			pte++;
 		}
 	}
@@ -261,7 +263,7 @@
 				goto out;
 			}
 		}
-		set_huge_pte(mm, vma, page, pte, vma->vm_flags & VM_WRITE);
+		set_huge_pte(mm, vma, addr, page, pte, vma->vm_flags & VM_WRITE);
 	}
 out:
 	spin_unlock(&mm->page_table_lock);
diff -Nru a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
--- a/arch/sparc64/mm/init.c	2005-01-25 20:34:29 -08:00
+++ b/arch/sparc64/mm/init.c	2005-02-23 17:45:36 -08:00
@@ -431,7 +431,8 @@
 				if (tlb_type == spitfire)
 					val &= ~0x0003fe0000000000UL;
 
-				set_pte (ptep, __pte(val | _PAGE_MODIFIED));
+				set_pte_at(&init_mm, vaddr,
+					   ptep, __pte(val | _PAGE_MODIFIED));
 				trans[i].data += BASE_PAGE_SIZE;
 			}
 		}
diff -Nru a/arch/sparc64/mm/tlb.c b/arch/sparc64/mm/tlb.c
--- a/arch/sparc64/mm/tlb.c	2005-01-05 13:11:53 -08:00
+++ b/arch/sparc64/mm/tlb.c	2005-02-27 11:33:59 -08:00
@@ -41,24 +41,12 @@
 	}
 }
 
-void tlb_batch_add(pte_t *ptep, pte_t orig)
+void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, pte_t *ptep, pte_t orig)
 {
 	struct mmu_gather *mp = &__get_cpu_var(mmu_gathers);
-	struct page *ptepage;
-	struct mm_struct *mm;
-	unsigned long vaddr, nr;
+	unsigned long nr;
 
-	ptepage = virt_to_page(ptep);
-	mm = (struct mm_struct *) ptepage->mapping;
-
-	/* It is more efficient to let flush_tlb_kernel_range()
-	 * handle these cases.
-	 */
-	if (mm == &init_mm)
-		return;
-
-	vaddr = ptepage->index +
-		(((unsigned long)ptep & ~PAGE_MASK) * PTRS_PER_PTE);
+	vaddr &= PAGE_MASK;
 	if (pte_exec(orig))
 		vaddr |= 0x1UL;
 
diff -Nru a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
--- a/arch/um/drivers/Makefile	2005-01-11 16:42:51 -08:00
+++ b/arch/um/drivers/Makefile	2005-03-07 20:41:32 -08:00
@@ -3,8 +3,6 @@
 # Licensed under the GPL
 #
 
-CHAN_OBJS := chan_kern.o chan_user.o line.o 
-
 # pcap is broken in 2.5 because kbuild doesn't allow pcap.a to be linked
 # in to pcap.o
 
@@ -20,7 +18,7 @@
 port-objs := port_kern.o port_user.o
 harddog-objs := harddog_kern.o harddog_user.o
 
-obj-y := stdio_console.o fd.o $(CHAN_OBJS)
+obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o
 obj-$(CONFIG_SSL) += ssl.o
 obj-$(CONFIG_STDERR_CONSOLE) += stderr_console.o
 
diff -Nru a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c
--- a/arch/um/kernel/process_kern.c	2005-01-11 16:42:55 -08:00
+++ b/arch/um/kernel/process_kern.c	2005-03-04 22:38:38 -08:00
@@ -21,6 +21,7 @@
 #include "linux/spinlock.h"
 #include "linux/proc_fs.h"
 #include "linux/ptrace.h"
+#include "linux/random.h"
 #include "asm/unistd.h"
 #include "asm/mman.h"
 #include "asm/segment.h"
@@ -478,6 +479,14 @@
 
 	return 2;
 }
+
+unsigned long arch_align_stack(unsigned long sp)
+{
+	if (randomize_va_space)
+		sp -= get_random_int() % 8192;
+	return sp & ~0xf;
+}
+
 
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
diff -Nru a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
--- a/arch/x86_64/Kconfig	2005-01-25 13:50:17 -08:00
+++ b/arch/x86_64/Kconfig	2005-03-07 20:41:40 -08:00
@@ -350,6 +350,24 @@
 	help
 	   Additional support for intel specific MCE features such as
 	   the thermal monitor.
+
+config SECCOMP
+	bool "Enable seccomp to safely compute untrusted bytecode"
+	depends on PROC_FS
+	default y
+	help
+	  This kernel feature is useful for number crunching applications
+	  that may need to compute untrusted bytecode during their
+	  execution. By using pipes or other transports made available to
+	  the process as file descriptors supporting the read/write
+	  syscalls, it's possible to isolate those applications in
+	  their own address space using seccomp. Once seccomp is
+	  enabled via /proc/<pid>/seccomp, it cannot be disabled
+	  and the task is only allowed to execute a few safe syscalls
+	  defined by each seccomp mode.
+
+	  If unsure, say Y. Only embedded should say N here.
+
 endmenu
 
 #
diff -Nru a/arch/x86_64/defconfig b/arch/x86_64/defconfig
--- a/arch/x86_64/defconfig	2005-01-11 16:42:42 -08:00
+++ b/arch/x86_64/defconfig	2005-02-22 16:55:59 -08:00
@@ -672,7 +672,6 @@
 #
 CONFIG_AGP=y
 CONFIG_AGP_AMD64=y
-# CONFIG_AGP_INTEL_MCH is not set
 # CONFIG_DRM is not set
 # CONFIG_MWAVE is not set
 CONFIG_RAW_DRIVER=y
diff -Nru a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
--- a/arch/x86_64/ia32/ia32entry.S	2005-01-15 14:01:52 -08:00
+++ b/arch/x86_64/ia32/ia32entry.S	2005-03-07 20:41:40 -08:00
@@ -78,7 +78,7 @@
  	.quad 1b,ia32_badarg
  	.previous	
 	GET_THREAD_INFO(%r10)
-	testl  $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),threadinfo_flags(%r10)
+	testl  $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
 	jnz  sysenter_tracesys
 sysenter_do_call:	
 	cmpl	$(IA32_NR_syscalls),%eax
@@ -163,7 +163,7 @@
 	.quad 1b,ia32_badarg
 	.previous	
 	GET_THREAD_INFO(%r10)
-	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),threadinfo_flags(%r10)
+	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
 	jnz   cstar_tracesys
 cstar_do_call:	
 	cmpl $IA32_NR_syscalls,%eax
@@ -236,7 +236,7 @@
 	   this could be a problem. */
 	SAVE_ARGS 0,0,1
 	GET_THREAD_INFO(%r10)
-	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),threadinfo_flags(%r10)
+	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
 	jnz ia32_tracesys
 ia32_do_syscall:	
 	cmpl $(IA32_NR_syscalls),%eax
@@ -590,7 +590,7 @@
 	.quad compat_sys_mq_notify
 	.quad compat_sys_mq_getsetattr
 	.quad quiet_ni_syscall		/* reserved for kexec */
-	.quad sys32_waitid
+	.quad compat_sys_waitid
 	.quad quiet_ni_syscall		/* sys_altroot */
 	.quad sys_add_key
 	.quad sys_request_key
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	2005-02-02 03:40:38 -08:00
+++ b/arch/x86_64/ia32/sys_ia32.c	2005-03-06 15:58:58 -08:00
@@ -955,32 +955,6 @@
         return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
 }
 
-asmlinkage long sys32_waitid(int which, compat_pid_t pid,
-			     compat_siginfo_t __user *uinfo, int options,
-			     struct compat_rusage __user *uru)
-{
-	siginfo_t info;
-	struct rusage ru;
-	long ret;
-	mm_segment_t old_fs = get_fs();
-
-	info.si_signo = 0;
-	set_fs (KERNEL_DS);
-	ret = sys_waitid(which, pid, (siginfo_t __user *) &info, options,
-			 uru ? &ru : NULL);
-	set_fs (old_fs);
-
-	if (ret < 0 || info.si_signo == 0)
-		return ret;
-
-	if (uru && (ret = put_compat_rusage(&ru, uru)))
-		return ret;
-
-	BUG_ON(info.si_code & __SI_MASK);
-	info.si_code |= __SI_CHLD;
-	return copy_siginfo_to_user32(uinfo, &info);
-}
-
 /*
  * Some system calls that need sign extended arguments. This could be done by a generic wrapper.
  */ 
diff -Nru a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
--- a/arch/x86_64/kernel/entry.S	2005-01-25 13:50:17 -08:00
+++ b/arch/x86_64/kernel/entry.S	2005-03-07 20:41:40 -08:00
@@ -184,7 +184,7 @@
 	movq  %rax,ORIG_RAX-ARGOFFSET(%rsp) 
 	movq  %rcx,RIP-ARGOFFSET(%rsp)  
 	GET_THREAD_INFO(%rcx)
-	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),threadinfo_flags(%rcx)
+	testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx)
 	jnz tracesys
 	cmpq $__NR_syscall_max,%rax
 	ja badsys
diff -Nru a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
--- a/arch/x86_64/kernel/pci-gart.c	2005-01-20 21:02:13 -08:00
+++ b/arch/x86_64/kernel/pci-gart.c	2005-02-23 15:12:04 -08:00
@@ -789,7 +789,7 @@
 	/* Add other K8 AGP bridge drivers here */
 	no_agp = no_agp || 
 		(agp_amd64_init() < 0) || 
-		(agp_copy_info(&info) < 0); 
+		(agp_copy_info(agp_bridge, &info) < 0);
 #endif	
 
 	if (swiotlb) { 
diff -Nru a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
--- a/arch/x86_64/kernel/process.c	2005-02-10 12:33:18 -08:00
+++ b/arch/x86_64/kernel/process.c	2005-03-04 22:41:13 -08:00
@@ -33,6 +33,7 @@
 #include <linux/irq.h>
 #include <linux/ptrace.h>
 #include <linux/utsname.h>
+#include <linux/random.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -748,4 +749,11 @@
 	elf_core_copy_regs(regs, &ptregs);
  
 	return 1;
+}
+
+unsigned long arch_align_stack(unsigned long sp)
+{
+	if (randomize_va_space)
+		sp -= get_random_int() % 8192;
+	return sp & ~0xf;
 }
diff -Nru a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
--- a/arch/x86_64/kernel/ptrace.c	2005-01-30 22:20:14 -08:00
+++ b/arch/x86_64/kernel/ptrace.c	2005-03-07 20:41:40 -08:00
@@ -17,6 +17,7 @@
 #include <linux/user.h>
 #include <linux/security.h>
 #include <linux/audit.h>
+#include <linux/seccomp.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -521,6 +522,9 @@
 
 asmlinkage void syscall_trace_enter(struct pt_regs *regs)
 {
+	/* do the secure computing check first */
+	secure_computing(regs->orig_rax);
+
 	if (unlikely(current->audit_context))
 		audit_syscall_entry(current, regs->orig_rax,
 				    regs->rdi, regs->rsi,
diff -Nru a/arch/x86_64/mm/extable.c b/arch/x86_64/mm/extable.c
--- a/arch/x86_64/mm/extable.c	2004-01-25 21:14:35 -08:00
+++ b/arch/x86_64/mm/extable.c	2005-03-07 20:41:46 -08:00
@@ -33,26 +33,3 @@
         }
         return NULL;
 }
-
-/* When an exception handler is in an non standard section (like __init)
-   the fixup table can end up unordered. Fix that here. */
-void sort_extable(struct exception_table_entry *start,
-		  struct exception_table_entry *finish)
-{
-	struct exception_table_entry *e;
-	int change;
-
-	/* The input is near completely presorted, which makes bubble sort the
-	   best (and simplest) sort algorithm. */
-	do {
-		change = 0;
-		for (e = start+1; e < finish; e++) {
-			if (e->insn < e[-1].insn) {
-				struct exception_table_entry tmp = e[-1];
-				e[-1] = e[0];
-				e[0] = tmp;
-				change = 1;
-			}
-		}
-	} while (change != 0);
-}
diff -Nru a/arch/x86_64/mm/ioremap.c b/arch/x86_64/mm/ioremap.c
--- a/arch/x86_64/mm/ioremap.c	2005-01-23 10:29:03 -08:00
+++ b/arch/x86_64/mm/ioremap.c	2005-03-08 09:28:18 -08:00
@@ -267,8 +267,8 @@
 		p->phys_addr + p->size - 1 < virt_to_phys(high_memory)) {
 		/* p->size includes the guard page, but cpa doesn't like that */
 		change_page_attr(virt_to_page(__va(p->phys_addr)),
-				 (p->size - PAGE_SIZE) >> PAGE_SHIFT,
-				 PAGE_KERNEL); 				 
+				 p->size >> PAGE_SHIFT,
+				 PAGE_KERNEL);
 		global_flush_tlb();
 	} 
 out_unlock:
diff -Nru a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
--- a/arch/x86_64/pci/mmconfig.c	2004-11-29 11:13:05 -08:00
+++ b/arch/x86_64/pci/mmconfig.c	2005-02-03 10:08:22 -08:00
@@ -17,12 +17,13 @@
 /* Static virtual mapping of the MMCONFIG aperture */
 char *pci_mmcfg_virt;
 
-static inline char *pci_dev_base(int bus, int devfn)
+static inline char *pci_dev_base(unsigned int bus, unsigned int devfn)
 {
 	return pci_mmcfg_virt + ((bus << 20) | (devfn << 12));
 }
 
-static int pci_mmcfg_read(int seg, int bus, int devfn, int reg, int len, u32 *value)
+static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
+			  unsigned int devfn, int reg, int len, u32 *value)
 {
 	char *addr = pci_dev_base(bus, devfn); 
 
@@ -44,7 +45,8 @@
 	return 0;
 }
 
-static int pci_mmcfg_write(int seg, int bus, int devfn, int reg, int len, u32 value)
+static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
+			   unsigned int devfn, int reg, int len, u32 value)
 {
 	char *addr = pci_dev_base(bus,devfn);
 
diff -Nru a/crypto/Kconfig b/crypto/Kconfig
--- a/crypto/Kconfig	2005-01-15 14:31:06 -08:00
+++ b/crypto/Kconfig	2005-02-24 11:24:22 -08:00
@@ -79,6 +79,19 @@
 	  See also:
 	  <http://planeta.terra.com.br/informatica/paulobarreto/WhirlpoolPage.html>
 
+config CRYPTO_TGR192
+	tristate "Tiger digest algorithms"
+	depends on CRYPTO
+	help
+	  Tiger hash algorithm 192, 160 and 128-bit hashes
+
+	  Tiger is a hash function optimized for 64-bit processors while
+	  still having decent performance on 32-bit processors.
+	  Tiger was developed by Ross Anderson and Eli Biham.
+
+	  See also:
+	  <http://www.cs.technion.ac.il/~biham/Reports/Tiger/>.
+
 config CRYPTO_DES
 	tristate "DES and Triple DES EDE cipher algorithms"
 	depends on CRYPTO
diff -Nru a/crypto/Makefile b/crypto/Makefile
--- a/crypto/Makefile	2004-11-09 15:21:35 -08:00
+++ b/crypto/Makefile	2005-02-24 11:24:22 -08:00
@@ -15,6 +15,7 @@
 obj-$(CONFIG_CRYPTO_SHA256) += sha256.o
 obj-$(CONFIG_CRYPTO_SHA512) += sha512.o
 obj-$(CONFIG_CRYPTO_WP512) += wp512.o
+obj-$(CONFIG_CRYPTO_TGR192) += tgr192.o
 obj-$(CONFIG_CRYPTO_DES) += des.o
 obj-$(CONFIG_CRYPTO_BLOWFISH) += blowfish.o
 obj-$(CONFIG_CRYPTO_TWOFISH) += twofish.o
diff -Nru a/crypto/aes.c b/crypto/aes.c
--- a/crypto/aes.c	2004-10-05 12:25:04 -07:00
+++ b/crypto/aes.c	2005-03-07 20:41:50 -08:00
@@ -64,23 +64,6 @@
 
 #define AES_BLOCK_SIZE		16
 
-static inline 
-u32 generic_rotr32 (const u32 x, const unsigned bits)
-{
-	const unsigned n = bits % 32;
-	return (x >> n) | (x << (32 - n));
-}
-
-static inline 
-u32 generic_rotl32 (const u32 x, const unsigned bits)
-{
-	const unsigned n = bits % 32;
-	return (x << n) | (x >> (32 - n));
-}
-
-#define rotl generic_rotl32
-#define rotr generic_rotr32
-
 /*
  * #define byte(x, nr) ((unsigned char)((x) >> (nr*8))) 
  */
@@ -191,26 +174,26 @@
 
 		t = p;
 		fl_tab[0][i] = t;
-		fl_tab[1][i] = rotl (t, 8);
-		fl_tab[2][i] = rotl (t, 16);
-		fl_tab[3][i] = rotl (t, 24);
+		fl_tab[1][i] = rol32(t, 8);
+		fl_tab[2][i] = rol32(t, 16);
+		fl_tab[3][i] = rol32(t, 24);
 
 		t = ((u32) ff_mult (2, p)) |
 		    ((u32) p << 8) |
 		    ((u32) p << 16) | ((u32) ff_mult (3, p) << 24);
 
 		ft_tab[0][i] = t;
-		ft_tab[1][i] = rotl (t, 8);
-		ft_tab[2][i] = rotl (t, 16);
-		ft_tab[3][i] = rotl (t, 24);
+		ft_tab[1][i] = rol32(t, 8);
+		ft_tab[2][i] = rol32(t, 16);
+		ft_tab[3][i] = rol32(t, 24);
 
 		p = isb_tab[i];
 
 		t = p;
 		il_tab[0][i] = t;
-		il_tab[1][i] = rotl (t, 8);
-		il_tab[2][i] = rotl (t, 16);
-		il_tab[3][i] = rotl (t, 24);
+		il_tab[1][i] = rol32(t, 8);
+		il_tab[2][i] = rol32(t, 16);
+		il_tab[3][i] = rol32(t, 24);
 
 		t = ((u32) ff_mult (14, p)) |
 		    ((u32) ff_mult (9, p) << 8) |
@@ -218,9 +201,9 @@
 		    ((u32) ff_mult (11, p) << 24);
 
 		it_tab[0][i] = t;
-		it_tab[1][i] = rotl (t, 8);
-		it_tab[2][i] = rotl (t, 16);
-		it_tab[3][i] = rotl (t, 24);
+		it_tab[1][i] = rol32(t, 8);
+		it_tab[2][i] = rol32(t, 16);
+		it_tab[3][i] = rol32(t, 24);
 	}
 }
 
@@ -232,14 +215,14 @@
     w   = star_x(v);        \
     t   = w ^ (x);          \
    (y)  = u ^ v ^ w;        \
-   (y) ^= rotr(u ^ t,  8) ^ \
-          rotr(v ^ t, 16) ^ \
-          rotr(t,24)
+   (y) ^= ror32(u ^ t,  8) ^ \
+          ror32(v ^ t, 16) ^ \
+          ror32(t,24)
 
 /* initialise the key schedule from the user supplied key */
 
 #define loop4(i)                                    \
-{   t = rotr(t,  8); t = ls_box(t) ^ rco_tab[i];    \
+{   t = ror32(t,  8); t = ls_box(t) ^ rco_tab[i];    \
     t ^= E_KEY[4 * i];     E_KEY[4 * i + 4] = t;    \
     t ^= E_KEY[4 * i + 1]; E_KEY[4 * i + 5] = t;    \
     t ^= E_KEY[4 * i + 2]; E_KEY[4 * i + 6] = t;    \
@@ -247,7 +230,7 @@
 }
 
 #define loop6(i)                                    \
-{   t = rotr(t,  8); t = ls_box(t) ^ rco_tab[i];    \
+{   t = ror32(t,  8); t = ls_box(t) ^ rco_tab[i];    \
     t ^= E_KEY[6 * i];     E_KEY[6 * i + 6] = t;    \
     t ^= E_KEY[6 * i + 1]; E_KEY[6 * i + 7] = t;    \
     t ^= E_KEY[6 * i + 2]; E_KEY[6 * i + 8] = t;    \
@@ -257,7 +240,7 @@
 }
 
 #define loop8(i)                                    \
-{   t = rotr(t,  8); ; t = ls_box(t) ^ rco_tab[i];  \
+{   t = ror32(t,  8); ; t = ls_box(t) ^ rco_tab[i];  \
     t ^= E_KEY[8 * i];     E_KEY[8 * i + 8] = t;    \
     t ^= E_KEY[8 * i + 1]; E_KEY[8 * i + 9] = t;    \
     t ^= E_KEY[8 * i + 2]; E_KEY[8 * i + 10] = t;   \
diff -Nru a/crypto/cast5.c b/crypto/cast5.c
--- a/crypto/cast5.c	2003-08-18 05:06:56 -07:00
+++ b/crypto/cast5.c	2005-03-07 20:41:50 -08:00
@@ -567,14 +567,11 @@
 	0xeaee6801, 0x8db2a283, 0xea8bf59e
 };
 
-
-#define rol(n,x) ( ((x) << (n)) | ((x) >> (32-(n))) )
-
-#define F1(D,m,r)  (  (I = ((m) + (D))), (I=rol((r),I)),   \
+#define F1(D,m,r)  (  (I = ((m) + (D))), (I=rol32(I,(r))),   \
     (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff]) )
-#define F2(D,m,r)  (  (I = ((m) ^ (D))), (I=rol((r),I)),   \
+#define F2(D,m,r)  (  (I = ((m) ^ (D))), (I=rol32(I,(r))),   \
     (((s1[I >> 24] - s2[(I>>16)&0xff]) + s3[(I>>8)&0xff]) ^ s4[I&0xff]) )
-#define F3(D,m,r)  (  (I = ((m) - (D))), (I=rol((r),I)),   \
+#define F3(D,m,r)  (  (I = ((m) - (D))), (I=rol32(I,(r))),   \
     (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff]) )
 
 
diff -Nru a/crypto/cast6.c b/crypto/cast6.c
--- a/crypto/cast6.c	2003-08-18 05:06:56 -07:00
+++ b/crypto/cast6.c	2005-03-07 20:41:50 -08:00
@@ -33,13 +33,11 @@
 	u8 Kr[12][4];
 };
 
-#define rol(n,x) ( ((x) << (n)) | ((x) >> (32-(n))) )
-
-#define F1(D,r,m)  (  (I = ((m) + (D))), (I=rol((r),I)),   \
+#define F1(D,r,m)  (  (I = ((m) + (D))), (I=rol32(I,(r))),   \
     (((s1[I >> 24] ^ s2[(I>>16)&0xff]) - s3[(I>>8)&0xff]) + s4[I&0xff]) )
-#define F2(D,r,m)  (  (I = ((m) ^ (D))), (I=rol((r),I)),   \
+#define F2(D,r,m)  (  (I = ((m) ^ (D))), (I=rol32(I,(r))),   \
     (((s1[I >> 24] - s2[(I>>16)&0xff]) + s3[(I>>8)&0xff]) ^ s4[I&0xff]) )
-#define F3(D,r,m)  (  (I = ((m) - (D))), (I=rol((r),I)),   \
+#define F3(D,r,m)  (  (I = ((m) - (D))), (I=rol32(I,(r))),   \
     (((s1[I >> 24] + s2[(I>>16)&0xff]) ^ s3[(I>>8)&0xff]) - s4[I&0xff]) )
 
 static const u32 s1[256] = {
diff -Nru a/crypto/michael_mic.c b/crypto/michael_mic.c
--- a/crypto/michael_mic.c	2004-03-21 22:38:08 -08:00
+++ b/crypto/michael_mic.c	2005-03-07 20:41:50 -08:00
@@ -24,18 +24,6 @@
 };
 
 
-static inline u32 rotl(u32 val, int bits)
-{
-	return (val << bits) | (val >> (32 - bits));
-}
-
-
-static inline u32 rotr(u32 val, int bits)
-{
-	return (val >> bits) | (val << (32 - bits));
-}
-
-
 static inline u32 xswap(u32 val)
 {
 	return ((val & 0x00ff00ff) << 8) | ((val & 0xff00ff00) >> 8);
@@ -44,13 +32,13 @@
 
 #define michael_block(l, r)	\
 do {				\
-	r ^= rotl(l, 17);	\
+	r ^= rol32(l, 17);	\
 	l += r;			\
 	r ^= xswap(l);		\
 	l += r;			\
-	r ^= rotl(l, 3);	\
+	r ^= rol32(l, 3);	\
 	l += r;			\
-	r ^= rotr(l, 2);	\
+	r ^= ror32(l, 2);	\
 	l += r;			\
 } while (0)
 
diff -Nru a/crypto/serpent.c b/crypto/serpent.c
--- a/crypto/serpent.c	2004-10-19 22:19:41 -07:00
+++ b/crypto/serpent.c	2005-03-07 20:41:50 -08:00
@@ -31,11 +31,9 @@
 #define SERPENT_BLOCK_SIZE		 16
 
 #define PHI 0x9e3779b9UL
-#define ROL(x,r) ((x) = ((x) << (r)) | ((x) >> (32-(r))))
-#define ROR(x,r) ((x) = ((x) >> (r)) | ((x) << (32-(r))))
 
 #define keyiter(a,b,c,d,i,j) \
-        b ^= d; b ^= c; b ^= a; b ^= PHI ^ i; ROL(b,11); k[j] = b;
+        b ^= d; b ^= c; b ^= a; b ^= PHI ^ i; b = rol32(b,11); k[j] = b;
 
 #define loadkeys(x0,x1,x2,x3,i) \
 	x0=k[i]; x1=k[i+1]; x2=k[i+2]; x3=k[i+3];
@@ -48,24 +46,24 @@
 	x1 ^= k[4*(i)+1];        x0 ^= k[4*(i)+0];
 
 #define LK(x0,x1,x2,x3,x4,i)				\
-					ROL(x0,13);	\
-	ROL(x2,3);	x1 ^= x0;	x4  = x0 << 3;	\
+					x0=rol32(x0,13);\
+	x2=rol32(x2,3);	x1 ^= x0;	x4  = x0 << 3;	\
 	x3 ^= x2;	x1 ^= x2;			\
-	ROL(x1,1);	x3 ^= x4;			\
-	ROL(x3,7);	x4  = x1;			\
+	x1=rol32(x1,1);	x3 ^= x4;			\
+	x3=rol32(x3,7);	x4  = x1;			\
 	x0 ^= x1;	x4 <<= 7;	x2 ^= x3;	\
 	x0 ^= x3;	x2 ^= x4;	x3 ^= k[4*i+3];	\
-	x1 ^= k[4*i+1];	ROL(x0,5);	ROL(x2,22);	\
+	x1 ^= k[4*i+1];	x0=rol32(x0,5);	x2=rol32(x2,22);\
 	x0 ^= k[4*i+0];	x2 ^= k[4*i+2];
 
 #define KL(x0,x1,x2,x3,x4,i)				\
 	x0 ^= k[4*i+0];	x1 ^= k[4*i+1];	x2 ^= k[4*i+2];	\
-	x3 ^= k[4*i+3];	ROR(x0,5);	ROR(x2,22);	\
+	x3 ^= k[4*i+3];	x0=ror32(x0,5);	x2=ror32(x2,22);\
 	x4 =  x1;	x2 ^= x3;	x0 ^= x3;	\
-	x4 <<= 7;	x0 ^= x1;	ROR(x1,1);	\
-	x2 ^= x4;	ROR(x3,7);	x4 = x0 << 3;	\
-	x1 ^= x0;	x3 ^= x4;	ROR(x0,13);	\
-	x1 ^= x2;	x3 ^= x2;	ROR(x2,3);
+	x4 <<= 7;	x0 ^= x1;	x1=ror32(x1,1);	\
+	x2 ^= x4;	x3=ror32(x3,7);	x4 = x0 << 3;	\
+	x1 ^= x0;	x3 ^= x4;	x0=ror32(x0,13);\
+	x1 ^= x2;	x3 ^= x2;	x2=ror32(x2,3);
 
 #define S0(x0,x1,x2,x3,x4)				\
 					x4  = x3;	\
diff -Nru a/crypto/sha1.c b/crypto/sha1.c
--- a/crypto/sha1.c	2002-12-30 20:26:12 -08:00
+++ b/crypto/sha1.c	2005-03-07 20:41:51 -08:00
@@ -4,8 +4,7 @@
  * SHA1 Secure Hash Algorithm.
  *
  * Derived from cryptoapi implementation, adapted for in-place
- * scatterlist interface.  Originally based on the public domain
- * implementation written by Steve Reid.
+ * scatterlist interface.
  *
  * Copyright (c) Alan Smithee.
  * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk>
@@ -13,7 +12,7 @@
  *
  * 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) 
+ * Software Foundation; either version 2 of the License, or (at your option)
  * any later version.
  *
  */
@@ -21,89 +20,19 @@
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/crypto.h>
+#include <linux/cryptohash.h>
 #include <asm/scatterlist.h>
 #include <asm/byteorder.h>
 
 #define SHA1_DIGEST_SIZE	20
 #define SHA1_HMAC_BLOCK_SIZE	64
 
-static inline u32 rol(u32 value, u32 bits)
-{
-	return (((value) << (bits)) | ((value) >> (32 - (bits))));
-}
-
-/* blk0() and blk() perform the initial expand. */
-/* I got the idea of expanding during the round function from SSLeay */
-# define blk0(i) block32[i]
-
-#define blk(i) (block32[i&15] = rol(block32[(i+13)&15]^block32[(i+8)&15] \
-    ^block32[(i+2)&15]^block32[i&15],1))
-
-/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
-#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5); \
-                        w=rol(w,30);
-#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5); \
-                        w=rol(w,30);
-#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
-#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5); \
-                        w=rol(w,30);
-#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
-
 struct sha1_ctx {
         u64 count;
         u32 state[5];
         u8 buffer[64];
 };
 
-/* Hash a single 512-bit block. This is the core of the algorithm. */
-static void sha1_transform(u32 *state, const u8 *in)
-{
-	u32 a, b, c, d, e;
-	u32 block32[16];
-
-	/* convert/copy data to workspace */
-	for (a = 0; a < sizeof(block32)/sizeof(u32); a++)
-	  block32[a] = be32_to_cpu (((const u32 *)in)[a]);
-
-	/* Copy context->state[] to working vars */
-	a = state[0];
-	b = state[1];
-	c = state[2];
-	d = state[3];
-	e = state[4];
-
-	/* 4 rounds of 20 operations each. Loop unrolled. */
-	R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
-	R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
-	R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
-	R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
-	R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
-	R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
-	R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
-	R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
-	R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
-	R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
-	R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
-	R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
-	R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
-	R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
-	R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
-	R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
-	R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
-	R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
-	R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
-	R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
-	/* Add the working vars back into context.state[] */
-	state[0] += a;
-	state[1] += b;
-	state[2] += c;
-	state[3] += d;
-	state[4] += e;
-	/* Wipe variables */
-	a = b = c = d = e = 0;
-	memset (block32, 0x00, sizeof block32);
-}
-
 static void sha1_init(void *ctx)
 {
 	struct sha1_ctx *sctx = ctx;
@@ -120,19 +49,21 @@
 {
 	struct sha1_ctx *sctx = ctx;
 	unsigned int i, j;
+	u32 temp[SHA_WORKSPACE_WORDS];
 
 	j = (sctx->count >> 3) & 0x3f;
 	sctx->count += len << 3;
 
 	if ((j + len) > 63) {
 		memcpy(&sctx->buffer[j], data, (i = 64-j));
-		sha1_transform(sctx->state, sctx->buffer);
+		sha_transform(sctx->state, sctx->buffer, temp);
 		for ( ; i + 63 < len; i += 64) {
-			sha1_transform(sctx->state, &data[i]);
+			sha_transform(sctx->state, &data[i], temp);
 		}
 		j = 0;
 	}
 	else i = 0;
+	memset(temp, 0, sizeof(temp));
 	memcpy(&sctx->buffer[j], &data[i], len - i);
 }
 
diff -Nru a/crypto/sha256.c b/crypto/sha256.c
--- a/crypto/sha256.c	2004-10-25 20:45:16 -07:00
+++ b/crypto/sha256.c	2005-03-07 20:41:50 -08:00
@@ -42,15 +42,10 @@
 	return (x & y) | (z & (x | y));
 }
 
-static inline u32 RORu32(u32 x, u32 y)
-{
-	return (x >> y) | (x << (32 - y));
-}
-
-#define e0(x)       (RORu32(x, 2) ^ RORu32(x,13) ^ RORu32(x,22))
-#define e1(x)       (RORu32(x, 6) ^ RORu32(x,11) ^ RORu32(x,25))
-#define s0(x)       (RORu32(x, 7) ^ RORu32(x,18) ^ (x >> 3))
-#define s1(x)       (RORu32(x,17) ^ RORu32(x,19) ^ (x >> 10))
+#define e0(x)       (ror32(x, 2) ^ ror32(x,13) ^ ror32(x,22))
+#define e1(x)       (ror32(x, 6) ^ ror32(x,11) ^ ror32(x,25))
+#define s0(x)       (ror32(x, 7) ^ ror32(x,18) ^ (x >> 3))
+#define s1(x)       (ror32(x,17) ^ ror32(x,19) ^ (x >> 10))
 
 #define H0         0x6a09e667
 #define H1         0xbb67ae85
diff -Nru a/crypto/tcrypt.c b/crypto/tcrypt.c
--- a/crypto/tcrypt.c	2004-11-30 21:55:18 -08:00
+++ b/crypto/tcrypt.c	2005-02-24 11:24:22 -08:00
@@ -695,6 +695,9 @@
 		test_hash("wp512", wp512_tv_template, WP512_TEST_VECTORS);
 		test_hash("wp384", wp384_tv_template, WP384_TEST_VECTORS);
 		test_hash("wp256", wp256_tv_template, WP256_TEST_VECTORS);
+		test_hash("tgr192", tgr192_tv_template, TGR192_TEST_VECTORS);
+		test_hash("tgr160", tgr160_tv_template, TGR160_TEST_VECTORS);
+		test_hash("tgr128", tgr128_tv_template, TGR128_TEST_VECTORS);
 		test_deflate();
 		test_crc32c();
 #ifdef CONFIG_CRYPTO_HMAC
@@ -830,6 +833,19 @@
 		test_cipher ("anubis", MODE_ECB, DECRYPT, anubis_dec_tv_template, ANUBIS_DEC_TEST_VECTORS);
 		test_cipher ("anubis", MODE_CBC, ENCRYPT, anubis_cbc_enc_tv_template, ANUBIS_CBC_ENC_TEST_VECTORS);
 		test_cipher ("anubis", MODE_CBC, DECRYPT, anubis_cbc_dec_tv_template, ANUBIS_CBC_ENC_TEST_VECTORS);
+		break;
+
+	case 27:
+		test_hash("tgr192", tgr192_tv_template, TGR192_TEST_VECTORS);
+		break;
+
+	case 28:
+
+		test_hash("tgr160", tgr160_tv_template, TGR160_TEST_VECTORS);
+		break;
+
+	case 29:
+		test_hash("tgr128", tgr128_tv_template, TGR128_TEST_VECTORS);
 		break;
 
 #ifdef CONFIG_CRYPTO_HMAC
diff -Nru a/crypto/tcrypt.h b/crypto/tcrypt.h
--- a/crypto/tcrypt.h	2005-01-30 22:19:51 -08:00
+++ b/crypto/tcrypt.h	2005-02-24 11:24:22 -08:00
@@ -553,6 +553,137 @@
 	},
 };
 
+/*
+ * TIGER test vectors from Tiger website 
+ */
+#define TGR192_TEST_VECTORS	6
+
+static struct hash_testvec tgr192_tv_template[] = {
+	{
+		.plaintext = "",
+		.psize	= 0,
+		.digest = { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
+			    0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f,
+			    0xf3, 0x73, 0xde, 0x2d, 0x49, 0x58, 0x4e, 0x7a },
+	}, {
+		.plaintext = "abc",
+		.psize	= 3,
+		.digest = { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a,
+			    0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf,
+			    0x93, 0x5f, 0x7b, 0x95, 0x1c, 0x13, 0x29, 0x51 },
+	}, {
+		.plaintext = "Tiger",
+		.psize	= 5,
+		.digest = { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
+			    0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec,
+			    0x37, 0x79, 0x0c, 0x11, 0x6f, 0x9d, 0x2b, 0xdf },
+	}, {
+		.plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
+		.psize	= 64,
+		.digest = { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
+			    0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e,
+			    0xb5, 0x86, 0x44, 0x50, 0x34, 0xa5, 0xa3, 0x86 },
+	}, {
+		.plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
+		.psize	= 64,
+		.digest = { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
+			    0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9,
+			    0x57, 0x89, 0x65, 0x65, 0x97, 0x5f, 0x91, 0x97 },
+	}, {
+		.plaintext = "Tiger - A Fast New Hash Function, "
+			     "by Ross Anderson and Eli Biham, "
+			     "proceedings of Fast Software Encryption 3, "
+			     "Cambridge, 1996.",
+		.psize  = 125,
+		.digest = { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
+			    0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24,
+			    0xdd, 0x68, 0x15, 0x1d, 0x50, 0x39, 0x74, 0xfc },
+	},
+};
+
+#define TGR160_TEST_VECTORS	6
+
+static struct hash_testvec tgr160_tv_template[] = {
+	{
+		.plaintext = "",
+		.psize	= 0,
+		.digest = { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
+			    0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f,
+			    0xf3, 0x73, 0xde, 0x2d },
+	}, {
+		.plaintext = "abc",
+		.psize	= 3,
+		.digest = { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a,
+			    0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf,
+			    0x93, 0x5f, 0x7b, 0x95 },
+	}, {
+		.plaintext = "Tiger",
+		.psize	= 5,
+		.digest = { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
+			    0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec,
+			    0x37, 0x79, 0x0c, 0x11 },
+	}, {
+		.plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
+		.psize	= 64,
+		.digest = { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
+			    0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e,
+			    0xb5, 0x86, 0x44, 0x50 },
+	}, {
+		.plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
+		.psize	= 64,
+		.digest = { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
+			    0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9,
+			    0x57, 0x89, 0x65, 0x65 },
+	}, {
+		.plaintext = "Tiger - A Fast New Hash Function, "
+			     "by Ross Anderson and Eli Biham, "
+			     "proceedings of Fast Software Encryption 3, "
+			     "Cambridge, 1996.",
+		.psize  = 125,
+		.digest = { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
+			    0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24,
+			    0xdd, 0x68, 0x15, 0x1d },
+	},
+};
+
+#define TGR128_TEST_VECTORS	6
+
+static struct hash_testvec tgr128_tv_template[] = {
+	{
+		.plaintext = "",
+		.psize	= 0,
+		.digest = { 0x24, 0xf0, 0x13, 0x0c, 0x63, 0xac, 0x93, 0x32,
+			    0x16, 0x16, 0x6e, 0x76, 0xb1, 0xbb, 0x92, 0x5f },
+	}, {
+		.plaintext = "abc",
+		.psize	= 3,
+		.digest = { 0xf2, 0x58, 0xc1, 0xe8, 0x84, 0x14, 0xab, 0x2a,
+			    0x52, 0x7a, 0xb5, 0x41, 0xff, 0xc5, 0xb8, 0xbf },
+	}, {
+		.plaintext = "Tiger",
+		.psize	= 5,
+		.digest = { 0x9f, 0x00, 0xf5, 0x99, 0x07, 0x23, 0x00, 0xdd,
+			    0x27, 0x6a, 0xbb, 0x38, 0xc8, 0xeb, 0x6d, 0xec },
+	}, {
+		.plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-",
+		.psize	= 64,
+		.digest = { 0x87, 0xfb, 0x2a, 0x90, 0x83, 0x85, 0x1c, 0xf7,
+			    0x47, 0x0d, 0x2c, 0xf8, 0x10, 0xe6, 0xdf, 0x9e },
+	}, {
+		.plaintext = "ABCDEFGHIJKLMNOPQRSTUVWXYZ=abcdefghijklmnopqrstuvwxyz+0123456789",
+		.psize	= 64,
+		.digest = { 0x46, 0x7d, 0xb8, 0x08, 0x63, 0xeb, 0xce, 0x48,
+			    0x8d, 0xf1, 0xcd, 0x12, 0x61, 0x65, 0x5d, 0xe9 },
+	}, {
+		.plaintext = "Tiger - A Fast New Hash Function, "
+			     "by Ross Anderson and Eli Biham, "
+			     "proceedings of Fast Software Encryption 3, "
+			     "Cambridge, 1996.",
+		.psize  = 125,
+		.digest = { 0x3d, 0x9a, 0xeb, 0x03, 0xd1, 0xbd, 0x1a, 0x63,
+			    0x57, 0xb2, 0x77, 0x4d, 0xfd, 0x6d, 0x5b, 0x24 },
+	},
+};
 
 #ifdef CONFIG_CRYPTO_HMAC
 /*
diff -Nru a/crypto/tgr192.c b/crypto/tgr192.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/crypto/tgr192.c	2005-02-24 11:24:18 -08:00
@@ -0,0 +1,735 @@
+/*
+ * Cryptographic API.
+ *
+ * Tiger hashing Algorithm
+ *
+ *      Copyright (C) 1998 Free Software Foundation, Inc.
+ *
+ * The Tiger algorithm was developed by Ross Anderson and Eli Biham.
+ * It was optimized for 64-bit processors while still delievering
+ * decent performance on 32 and 16-bit processors.
+ *
+ * This version is derived from the GnuPG implementation and the
+ * Tiger-Perl interface written by Rafael Sevilla
+ *
+ * Adapted for Linux Kernel Crypto  by Aaron Grothe 
+ * ajgrothe@yahoo.com, February 22, 2005
+ *
+ * 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 <linux/init.h>
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <asm/scatterlist.h>
+#include <linux/crypto.h>
+
+#define TGR192_DIGEST_SIZE 24
+#define TGR160_DIGEST_SIZE 20
+#define TGR128_DIGEST_SIZE 16
+
+#define TGR192_BLOCK_SIZE  64
+
+struct tgr192_ctx {
+	u64 a, b, c;
+	u8 hash[64];
+	int count;
+	u32 nblocks;
+};
+
+static const u64 sbox1[256] = {
+	0x02aab17cf7e90c5eULL, 0xac424b03e243a8ecULL, 0x72cd5be30dd5fcd3ULL,
+	0x6d019b93f6f97f3aULL, 0xcd9978ffd21f9193ULL, 0x7573a1c9708029e2ULL,
+	0xb164326b922a83c3ULL, 0x46883eee04915870ULL, 0xeaace3057103ece6ULL,
+	0xc54169b808a3535cULL, 0x4ce754918ddec47cULL, 0x0aa2f4dfdc0df40cULL,
+	0x10b76f18a74dbefaULL, 0xc6ccb6235ad1ab6aULL, 0x13726121572fe2ffULL,
+	0x1a488c6f199d921eULL, 0x4bc9f9f4da0007caULL, 0x26f5e6f6e85241c7ULL,
+	0x859079dbea5947b6ULL, 0x4f1885c5c99e8c92ULL, 0xd78e761ea96f864bULL,
+	0x8e36428c52b5c17dULL, 0x69cf6827373063c1ULL, 0xb607c93d9bb4c56eULL,
+	0x7d820e760e76b5eaULL, 0x645c9cc6f07fdc42ULL, 0xbf38a078243342e0ULL,
+	0x5f6b343c9d2e7d04ULL, 0xf2c28aeb600b0ec6ULL, 0x6c0ed85f7254bcacULL,
+	0x71592281a4db4fe5ULL, 0x1967fa69ce0fed9fULL, 0xfd5293f8b96545dbULL,
+	0xc879e9d7f2a7600bULL, 0x860248920193194eULL, 0xa4f9533b2d9cc0b3ULL,
+	0x9053836c15957613ULL, 0xdb6dcf8afc357bf1ULL, 0x18beea7a7a370f57ULL,
+	0x037117ca50b99066ULL, 0x6ab30a9774424a35ULL, 0xf4e92f02e325249bULL,
+	0x7739db07061ccae1ULL, 0xd8f3b49ceca42a05ULL, 0xbd56be3f51382f73ULL,
+	0x45faed5843b0bb28ULL, 0x1c813d5c11bf1f83ULL, 0x8af0e4b6d75fa169ULL,
+	0x33ee18a487ad9999ULL, 0x3c26e8eab1c94410ULL, 0xb510102bc0a822f9ULL,
+	0x141eef310ce6123bULL, 0xfc65b90059ddb154ULL, 0xe0158640c5e0e607ULL,
+	0x884e079826c3a3cfULL, 0x930d0d9523c535fdULL, 0x35638d754e9a2b00ULL,
+	0x4085fccf40469dd5ULL, 0xc4b17ad28be23a4cULL, 0xcab2f0fc6a3e6a2eULL,
+	0x2860971a6b943fcdULL, 0x3dde6ee212e30446ULL, 0x6222f32ae01765aeULL,
+	0x5d550bb5478308feULL, 0xa9efa98da0eda22aULL, 0xc351a71686c40da7ULL,
+	0x1105586d9c867c84ULL, 0xdcffee85fda22853ULL, 0xccfbd0262c5eef76ULL,
+	0xbaf294cb8990d201ULL, 0xe69464f52afad975ULL, 0x94b013afdf133e14ULL,
+	0x06a7d1a32823c958ULL, 0x6f95fe5130f61119ULL, 0xd92ab34e462c06c0ULL,
+	0xed7bde33887c71d2ULL, 0x79746d6e6518393eULL, 0x5ba419385d713329ULL,
+	0x7c1ba6b948a97564ULL, 0x31987c197bfdac67ULL, 0xde6c23c44b053d02ULL,
+	0x581c49fed002d64dULL, 0xdd474d6338261571ULL, 0xaa4546c3e473d062ULL,
+	0x928fce349455f860ULL, 0x48161bbacaab94d9ULL, 0x63912430770e6f68ULL,
+	0x6ec8a5e602c6641cULL, 0x87282515337ddd2bULL, 0x2cda6b42034b701bULL,
+	0xb03d37c181cb096dULL, 0xe108438266c71c6fULL, 0x2b3180c7eb51b255ULL,
+	0xdf92b82f96c08bbcULL, 0x5c68c8c0a632f3baULL, 0x5504cc861c3d0556ULL,
+	0xabbfa4e55fb26b8fULL, 0x41848b0ab3baceb4ULL, 0xb334a273aa445d32ULL,
+	0xbca696f0a85ad881ULL, 0x24f6ec65b528d56cULL, 0x0ce1512e90f4524aULL,
+	0x4e9dd79d5506d35aULL, 0x258905fac6ce9779ULL, 0x2019295b3e109b33ULL,
+	0xf8a9478b73a054ccULL, 0x2924f2f934417eb0ULL, 0x3993357d536d1bc4ULL,
+	0x38a81ac21db6ff8bULL, 0x47c4fbf17d6016bfULL, 0x1e0faadd7667e3f5ULL,
+	0x7abcff62938beb96ULL, 0xa78dad948fc179c9ULL, 0x8f1f98b72911e50dULL,
+	0x61e48eae27121a91ULL, 0x4d62f7ad31859808ULL, 0xeceba345ef5ceaebULL,
+	0xf5ceb25ebc9684ceULL, 0xf633e20cb7f76221ULL, 0xa32cdf06ab8293e4ULL,
+	0x985a202ca5ee2ca4ULL, 0xcf0b8447cc8a8fb1ULL, 0x9f765244979859a3ULL,
+	0xa8d516b1a1240017ULL, 0x0bd7ba3ebb5dc726ULL, 0xe54bca55b86adb39ULL,
+	0x1d7a3afd6c478063ULL, 0x519ec608e7669eddULL, 0x0e5715a2d149aa23ULL,
+	0x177d4571848ff194ULL, 0xeeb55f3241014c22ULL, 0x0f5e5ca13a6e2ec2ULL,
+	0x8029927b75f5c361ULL, 0xad139fabc3d6e436ULL, 0x0d5df1a94ccf402fULL,
+	0x3e8bd948bea5dfc8ULL, 0xa5a0d357bd3ff77eULL, 0xa2d12e251f74f645ULL,
+	0x66fd9e525e81a082ULL, 0x2e0c90ce7f687a49ULL, 0xc2e8bcbeba973bc5ULL,
+	0x000001bce509745fULL, 0x423777bbe6dab3d6ULL, 0xd1661c7eaef06eb5ULL,
+	0xa1781f354daacfd8ULL, 0x2d11284a2b16affcULL, 0xf1fc4f67fa891d1fULL,
+	0x73ecc25dcb920adaULL, 0xae610c22c2a12651ULL, 0x96e0a810d356b78aULL,
+	0x5a9a381f2fe7870fULL, 0xd5ad62ede94e5530ULL, 0xd225e5e8368d1427ULL,
+	0x65977b70c7af4631ULL, 0x99f889b2de39d74fULL, 0x233f30bf54e1d143ULL,
+	0x9a9675d3d9a63c97ULL, 0x5470554ff334f9a8ULL, 0x166acb744a4f5688ULL,
+	0x70c74caab2e4aeadULL, 0xf0d091646f294d12ULL, 0x57b82a89684031d1ULL,
+	0xefd95a5a61be0b6bULL, 0x2fbd12e969f2f29aULL, 0x9bd37013feff9fe8ULL,
+	0x3f9b0404d6085a06ULL, 0x4940c1f3166cfe15ULL, 0x09542c4dcdf3defbULL,
+	0xb4c5218385cd5ce3ULL, 0xc935b7dc4462a641ULL, 0x3417f8a68ed3b63fULL,
+	0xb80959295b215b40ULL, 0xf99cdaef3b8c8572ULL, 0x018c0614f8fcb95dULL,
+	0x1b14accd1a3acdf3ULL, 0x84d471f200bb732dULL, 0xc1a3110e95e8da16ULL,
+	0x430a7220bf1a82b8ULL, 0xb77e090d39df210eULL, 0x5ef4bd9f3cd05e9dULL,
+	0x9d4ff6da7e57a444ULL, 0xda1d60e183d4a5f8ULL, 0xb287c38417998e47ULL,
+	0xfe3edc121bb31886ULL, 0xc7fe3ccc980ccbefULL, 0xe46fb590189bfd03ULL,
+	0x3732fd469a4c57dcULL, 0x7ef700a07cf1ad65ULL, 0x59c64468a31d8859ULL,
+	0x762fb0b4d45b61f6ULL, 0x155baed099047718ULL, 0x68755e4c3d50baa6ULL,
+	0xe9214e7f22d8b4dfULL, 0x2addbf532eac95f4ULL, 0x32ae3909b4bd0109ULL,
+	0x834df537b08e3450ULL, 0xfa209da84220728dULL, 0x9e691d9b9efe23f7ULL,
+	0x0446d288c4ae8d7fULL, 0x7b4cc524e169785bULL, 0x21d87f0135ca1385ULL,
+	0xcebb400f137b8aa5ULL, 0x272e2b66580796beULL, 0x3612264125c2b0deULL,
+	0x057702bdad1efbb2ULL, 0xd4babb8eacf84be9ULL, 0x91583139641bc67bULL,
+	0x8bdc2de08036e024ULL, 0x603c8156f49f68edULL, 0xf7d236f7dbef5111ULL,
+	0x9727c4598ad21e80ULL, 0xa08a0896670a5fd7ULL, 0xcb4a8f4309eba9cbULL,
+	0x81af564b0f7036a1ULL, 0xc0b99aa778199abdULL, 0x959f1ec83fc8e952ULL,
+	0x8c505077794a81b9ULL, 0x3acaaf8f056338f0ULL, 0x07b43f50627a6778ULL,
+	0x4a44ab49f5eccc77ULL, 0x3bc3d6e4b679ee98ULL, 0x9cc0d4d1cf14108cULL,
+	0x4406c00b206bc8a0ULL, 0x82a18854c8d72d89ULL, 0x67e366b35c3c432cULL,
+	0xb923dd61102b37f2ULL, 0x56ab2779d884271dULL, 0xbe83e1b0ff1525afULL,
+	0xfb7c65d4217e49a9ULL, 0x6bdbe0e76d48e7d4ULL, 0x08df828745d9179eULL,
+	0x22ea6a9add53bd34ULL, 0xe36e141c5622200aULL, 0x7f805d1b8cb750eeULL,
+	0xafe5c7a59f58e837ULL, 0xe27f996a4fb1c23cULL, 0xd3867dfb0775f0d0ULL,
+	0xd0e673de6e88891aULL, 0x123aeb9eafb86c25ULL, 0x30f1d5d5c145b895ULL,
+	0xbb434a2dee7269e7ULL, 0x78cb67ecf931fa38ULL, 0xf33b0372323bbf9cULL,
+	0x52d66336fb279c74ULL, 0x505f33ac0afb4eaaULL, 0xe8a5cd99a2cce187ULL,
+	0x534974801e2d30bbULL, 0x8d2d5711d5876d90ULL, 0x1f1a412891bc038eULL,
+	0xd6e2e71d82e56648ULL, 0x74036c3a497732b7ULL, 0x89b67ed96361f5abULL,
+	0xffed95d8f1ea02a2ULL, 0xe72b3bd61464d43dULL, 0xa6300f170bdc4820ULL,
+	0xebc18760ed78a77aULL
+};
+
+static const u64 sbox2[256] = {
+	0xe6a6be5a05a12138ULL, 0xb5a122a5b4f87c98ULL, 0x563c6089140b6990ULL,
+	0x4c46cb2e391f5dd5ULL, 0xd932addbc9b79434ULL, 0x08ea70e42015aff5ULL,
+	0xd765a6673e478cf1ULL, 0xc4fb757eab278d99ULL, 0xdf11c6862d6e0692ULL,
+	0xddeb84f10d7f3b16ULL, 0x6f2ef604a665ea04ULL, 0x4a8e0f0ff0e0dfb3ULL,
+	0xa5edeef83dbcba51ULL, 0xfc4f0a2a0ea4371eULL, 0xe83e1da85cb38429ULL,
+	0xdc8ff882ba1b1ce2ULL, 0xcd45505e8353e80dULL, 0x18d19a00d4db0717ULL,
+	0x34a0cfeda5f38101ULL, 0x0be77e518887caf2ULL, 0x1e341438b3c45136ULL,
+	0xe05797f49089ccf9ULL, 0xffd23f9df2591d14ULL, 0x543dda228595c5cdULL,
+	0x661f81fd99052a33ULL, 0x8736e641db0f7b76ULL, 0x15227725418e5307ULL,
+	0xe25f7f46162eb2faULL, 0x48a8b2126c13d9feULL, 0xafdc541792e76eeaULL,
+	0x03d912bfc6d1898fULL, 0x31b1aafa1b83f51bULL, 0xf1ac2796e42ab7d9ULL,
+	0x40a3a7d7fcd2ebacULL, 0x1056136d0afbbcc5ULL, 0x7889e1dd9a6d0c85ULL,
+	0xd33525782a7974aaULL, 0xa7e25d09078ac09bULL, 0xbd4138b3eac6edd0ULL,
+	0x920abfbe71eb9e70ULL, 0xa2a5d0f54fc2625cULL, 0xc054e36b0b1290a3ULL,
+	0xf6dd59ff62fe932bULL, 0x3537354511a8ac7dULL, 0xca845e9172fadcd4ULL,
+	0x84f82b60329d20dcULL, 0x79c62ce1cd672f18ULL, 0x8b09a2add124642cULL,
+	0xd0c1e96a19d9e726ULL, 0x5a786a9b4ba9500cULL, 0x0e020336634c43f3ULL,
+	0xc17b474aeb66d822ULL, 0x6a731ae3ec9baac2ULL, 0x8226667ae0840258ULL,
+	0x67d4567691caeca5ULL, 0x1d94155c4875adb5ULL, 0x6d00fd985b813fdfULL,
+	0x51286efcb774cd06ULL, 0x5e8834471fa744afULL, 0xf72ca0aee761ae2eULL,
+	0xbe40e4cdaee8e09aULL, 0xe9970bbb5118f665ULL, 0x726e4beb33df1964ULL,
+	0x703b000729199762ULL, 0x4631d816f5ef30a7ULL, 0xb880b5b51504a6beULL,
+	0x641793c37ed84b6cULL, 0x7b21ed77f6e97d96ULL, 0x776306312ef96b73ULL,
+	0xae528948e86ff3f4ULL, 0x53dbd7f286a3f8f8ULL, 0x16cadce74cfc1063ULL,
+	0x005c19bdfa52c6ddULL, 0x68868f5d64d46ad3ULL, 0x3a9d512ccf1e186aULL,
+	0x367e62c2385660aeULL, 0xe359e7ea77dcb1d7ULL, 0x526c0773749abe6eULL,
+	0x735ae5f9d09f734bULL, 0x493fc7cc8a558ba8ULL, 0xb0b9c1533041ab45ULL,
+	0x321958ba470a59bdULL, 0x852db00b5f46c393ULL, 0x91209b2bd336b0e5ULL,
+	0x6e604f7d659ef19fULL, 0xb99a8ae2782ccb24ULL, 0xccf52ab6c814c4c7ULL,
+	0x4727d9afbe11727bULL, 0x7e950d0c0121b34dULL, 0x756f435670ad471fULL,
+	0xf5add442615a6849ULL, 0x4e87e09980b9957aULL, 0x2acfa1df50aee355ULL,
+	0xd898263afd2fd556ULL, 0xc8f4924dd80c8fd6ULL, 0xcf99ca3d754a173aULL,
+	0xfe477bacaf91bf3cULL, 0xed5371f6d690c12dULL, 0x831a5c285e687094ULL,
+	0xc5d3c90a3708a0a4ULL, 0x0f7f903717d06580ULL, 0x19f9bb13b8fdf27fULL,
+	0xb1bd6f1b4d502843ULL, 0x1c761ba38fff4012ULL, 0x0d1530c4e2e21f3bULL,
+	0x8943ce69a7372c8aULL, 0xe5184e11feb5ce66ULL, 0x618bdb80bd736621ULL,
+	0x7d29bad68b574d0bULL, 0x81bb613e25e6fe5bULL, 0x071c9c10bc07913fULL,
+	0xc7beeb7909ac2d97ULL, 0xc3e58d353bc5d757ULL, 0xeb017892f38f61e8ULL,
+	0xd4effb9c9b1cc21aULL, 0x99727d26f494f7abULL, 0xa3e063a2956b3e03ULL,
+	0x9d4a8b9a4aa09c30ULL, 0x3f6ab7d500090fb4ULL, 0x9cc0f2a057268ac0ULL,
+	0x3dee9d2dedbf42d1ULL, 0x330f49c87960a972ULL, 0xc6b2720287421b41ULL,
+	0x0ac59ec07c00369cULL, 0xef4eac49cb353425ULL, 0xf450244eef0129d8ULL,
+	0x8acc46e5caf4deb6ULL, 0x2ffeab63989263f7ULL, 0x8f7cb9fe5d7a4578ULL,
+	0x5bd8f7644e634635ULL, 0x427a7315bf2dc900ULL, 0x17d0c4aa2125261cULL,
+	0x3992486c93518e50ULL, 0xb4cbfee0a2d7d4c3ULL, 0x7c75d6202c5ddd8dULL,
+	0xdbc295d8e35b6c61ULL, 0x60b369d302032b19ULL, 0xce42685fdce44132ULL,
+	0x06f3ddb9ddf65610ULL, 0x8ea4d21db5e148f0ULL, 0x20b0fce62fcd496fULL,
+	0x2c1b912358b0ee31ULL, 0xb28317b818f5a308ULL, 0xa89c1e189ca6d2cfULL,
+	0x0c6b18576aaadbc8ULL, 0xb65deaa91299fae3ULL, 0xfb2b794b7f1027e7ULL,
+	0x04e4317f443b5bebULL, 0x4b852d325939d0a6ULL, 0xd5ae6beefb207ffcULL,
+	0x309682b281c7d374ULL, 0xbae309a194c3b475ULL, 0x8cc3f97b13b49f05ULL,
+	0x98a9422ff8293967ULL, 0x244b16b01076ff7cULL, 0xf8bf571c663d67eeULL,
+	0x1f0d6758eee30da1ULL, 0xc9b611d97adeb9b7ULL, 0xb7afd5887b6c57a2ULL,
+	0x6290ae846b984fe1ULL, 0x94df4cdeacc1a5fdULL, 0x058a5bd1c5483affULL,
+	0x63166cc142ba3c37ULL, 0x8db8526eb2f76f40ULL, 0xe10880036f0d6d4eULL,
+	0x9e0523c9971d311dULL, 0x45ec2824cc7cd691ULL, 0x575b8359e62382c9ULL,
+	0xfa9e400dc4889995ULL, 0xd1823ecb45721568ULL, 0xdafd983b8206082fULL,
+	0xaa7d29082386a8cbULL, 0x269fcd4403b87588ULL, 0x1b91f5f728bdd1e0ULL,
+	0xe4669f39040201f6ULL, 0x7a1d7c218cf04adeULL, 0x65623c29d79ce5ceULL,
+	0x2368449096c00bb1ULL, 0xab9bf1879da503baULL, 0xbc23ecb1a458058eULL,
+	0x9a58df01bb401eccULL, 0xa070e868a85f143dULL, 0x4ff188307df2239eULL,
+	0x14d565b41a641183ULL, 0xee13337452701602ULL, 0x950e3dcf3f285e09ULL,
+	0x59930254b9c80953ULL, 0x3bf299408930da6dULL, 0xa955943f53691387ULL,
+	0xa15edecaa9cb8784ULL, 0x29142127352be9a0ULL, 0x76f0371fff4e7afbULL,
+	0x0239f450274f2228ULL, 0xbb073af01d5e868bULL, 0xbfc80571c10e96c1ULL,
+	0xd267088568222e23ULL, 0x9671a3d48e80b5b0ULL, 0x55b5d38ae193bb81ULL,
+	0x693ae2d0a18b04b8ULL, 0x5c48b4ecadd5335fULL, 0xfd743b194916a1caULL,
+	0x2577018134be98c4ULL, 0xe77987e83c54a4adULL, 0x28e11014da33e1b9ULL,
+	0x270cc59e226aa213ULL, 0x71495f756d1a5f60ULL, 0x9be853fb60afef77ULL,
+	0xadc786a7f7443dbfULL, 0x0904456173b29a82ULL, 0x58bc7a66c232bd5eULL,
+	0xf306558c673ac8b2ULL, 0x41f639c6b6c9772aULL, 0x216defe99fda35daULL,
+	0x11640cc71c7be615ULL, 0x93c43694565c5527ULL, 0xea038e6246777839ULL,
+	0xf9abf3ce5a3e2469ULL, 0x741e768d0fd312d2ULL, 0x0144b883ced652c6ULL,
+	0xc20b5a5ba33f8552ULL, 0x1ae69633c3435a9dULL, 0x97a28ca4088cfdecULL,
+	0x8824a43c1e96f420ULL, 0x37612fa66eeea746ULL, 0x6b4cb165f9cf0e5aULL,
+	0x43aa1c06a0abfb4aULL, 0x7f4dc26ff162796bULL, 0x6cbacc8e54ed9b0fULL,
+	0xa6b7ffefd2bb253eULL, 0x2e25bc95b0a29d4fULL, 0x86d6a58bdef1388cULL,
+	0xded74ac576b6f054ULL, 0x8030bdbc2b45805dULL, 0x3c81af70e94d9289ULL,
+	0x3eff6dda9e3100dbULL, 0xb38dc39fdfcc8847ULL, 0x123885528d17b87eULL,
+	0xf2da0ed240b1b642ULL, 0x44cefadcd54bf9a9ULL, 0x1312200e433c7ee6ULL,
+	0x9ffcc84f3a78c748ULL, 0xf0cd1f72248576bbULL, 0xec6974053638cfe4ULL,
+	0x2ba7b67c0cec4e4cULL, 0xac2f4df3e5ce32edULL, 0xcb33d14326ea4c11ULL,
+	0xa4e9044cc77e58bcULL, 0x5f513293d934fcefULL, 0x5dc9645506e55444ULL,
+	0x50de418f317de40aULL, 0x388cb31a69dde259ULL, 0x2db4a83455820a86ULL,
+	0x9010a91e84711ae9ULL, 0x4df7f0b7b1498371ULL, 0xd62a2eabc0977179ULL,
+	0x22fac097aa8d5c0eULL
+};
+
+static const u64 sbox3[256] = {
+	0xf49fcc2ff1daf39bULL, 0x487fd5c66ff29281ULL, 0xe8a30667fcdca83fULL,
+	0x2c9b4be3d2fcce63ULL, 0xda3ff74b93fbbbc2ULL, 0x2fa165d2fe70ba66ULL,
+	0xa103e279970e93d4ULL, 0xbecdec77b0e45e71ULL, 0xcfb41e723985e497ULL,
+	0xb70aaa025ef75017ULL, 0xd42309f03840b8e0ULL, 0x8efc1ad035898579ULL,
+	0x96c6920be2b2abc5ULL, 0x66af4163375a9172ULL, 0x2174abdcca7127fbULL,
+	0xb33ccea64a72ff41ULL, 0xf04a4933083066a5ULL, 0x8d970acdd7289af5ULL,
+	0x8f96e8e031c8c25eULL, 0xf3fec02276875d47ULL, 0xec7bf310056190ddULL,
+	0xf5adb0aebb0f1491ULL, 0x9b50f8850fd58892ULL, 0x4975488358b74de8ULL,
+	0xa3354ff691531c61ULL, 0x0702bbe481d2c6eeULL, 0x89fb24057deded98ULL,
+	0xac3075138596e902ULL, 0x1d2d3580172772edULL, 0xeb738fc28e6bc30dULL,
+	0x5854ef8f63044326ULL, 0x9e5c52325add3bbeULL, 0x90aa53cf325c4623ULL,
+	0xc1d24d51349dd067ULL, 0x2051cfeea69ea624ULL, 0x13220f0a862e7e4fULL,
+	0xce39399404e04864ULL, 0xd9c42ca47086fcb7ULL, 0x685ad2238a03e7ccULL,
+	0x066484b2ab2ff1dbULL, 0xfe9d5d70efbf79ecULL, 0x5b13b9dd9c481854ULL,
+	0x15f0d475ed1509adULL, 0x0bebcd060ec79851ULL, 0xd58c6791183ab7f8ULL,
+	0xd1187c5052f3eee4ULL, 0xc95d1192e54e82ffULL, 0x86eea14cb9ac6ca2ULL,
+	0x3485beb153677d5dULL, 0xdd191d781f8c492aULL, 0xf60866baa784ebf9ULL,
+	0x518f643ba2d08c74ULL, 0x8852e956e1087c22ULL, 0xa768cb8dc410ae8dULL,
+	0x38047726bfec8e1aULL, 0xa67738b4cd3b45aaULL, 0xad16691cec0dde19ULL,
+	0xc6d4319380462e07ULL, 0xc5a5876d0ba61938ULL, 0x16b9fa1fa58fd840ULL,
+	0x188ab1173ca74f18ULL, 0xabda2f98c99c021fULL, 0x3e0580ab134ae816ULL,
+	0x5f3b05b773645abbULL, 0x2501a2be5575f2f6ULL, 0x1b2f74004e7e8ba9ULL,
+	0x1cd7580371e8d953ULL, 0x7f6ed89562764e30ULL, 0xb15926ff596f003dULL,
+	0x9f65293da8c5d6b9ULL, 0x6ecef04dd690f84cULL, 0x4782275fff33af88ULL,
+	0xe41433083f820801ULL, 0xfd0dfe409a1af9b5ULL, 0x4325a3342cdb396bULL,
+	0x8ae77e62b301b252ULL, 0xc36f9e9f6655615aULL, 0x85455a2d92d32c09ULL,
+	0xf2c7dea949477485ULL, 0x63cfb4c133a39ebaULL, 0x83b040cc6ebc5462ULL,
+	0x3b9454c8fdb326b0ULL, 0x56f56a9e87ffd78cULL, 0x2dc2940d99f42bc6ULL,
+	0x98f7df096b096e2dULL, 0x19a6e01e3ad852bfULL, 0x42a99ccbdbd4b40bULL,
+	0xa59998af45e9c559ULL, 0x366295e807d93186ULL, 0x6b48181bfaa1f773ULL,
+	0x1fec57e2157a0a1dULL, 0x4667446af6201ad5ULL, 0xe615ebcacfb0f075ULL,
+	0xb8f31f4f68290778ULL, 0x22713ed6ce22d11eULL, 0x3057c1a72ec3c93bULL,
+	0xcb46acc37c3f1f2fULL, 0xdbb893fd02aaf50eULL, 0x331fd92e600b9fcfULL,
+	0xa498f96148ea3ad6ULL, 0xa8d8426e8b6a83eaULL, 0xa089b274b7735cdcULL,
+	0x87f6b3731e524a11ULL, 0x118808e5cbc96749ULL, 0x9906e4c7b19bd394ULL,
+	0xafed7f7e9b24a20cULL, 0x6509eadeeb3644a7ULL, 0x6c1ef1d3e8ef0edeULL,
+	0xb9c97d43e9798fb4ULL, 0xa2f2d784740c28a3ULL, 0x7b8496476197566fULL,
+	0x7a5be3e6b65f069dULL, 0xf96330ed78be6f10ULL, 0xeee60de77a076a15ULL,
+	0x2b4bee4aa08b9bd0ULL, 0x6a56a63ec7b8894eULL, 0x02121359ba34fef4ULL,
+	0x4cbf99f8283703fcULL, 0x398071350caf30c8ULL, 0xd0a77a89f017687aULL,
+	0xf1c1a9eb9e423569ULL, 0x8c7976282dee8199ULL, 0x5d1737a5dd1f7abdULL,
+	0x4f53433c09a9fa80ULL, 0xfa8b0c53df7ca1d9ULL, 0x3fd9dcbc886ccb77ULL,
+	0xc040917ca91b4720ULL, 0x7dd00142f9d1dcdfULL, 0x8476fc1d4f387b58ULL,
+	0x23f8e7c5f3316503ULL, 0x032a2244e7e37339ULL, 0x5c87a5d750f5a74bULL,
+	0x082b4cc43698992eULL, 0xdf917becb858f63cULL, 0x3270b8fc5bf86ddaULL,
+	0x10ae72bb29b5dd76ULL, 0x576ac94e7700362bULL, 0x1ad112dac61efb8fULL,
+	0x691bc30ec5faa427ULL, 0xff246311cc327143ULL, 0x3142368e30e53206ULL,
+	0x71380e31e02ca396ULL, 0x958d5c960aad76f1ULL, 0xf8d6f430c16da536ULL,
+	0xc8ffd13f1be7e1d2ULL, 0x7578ae66004ddbe1ULL, 0x05833f01067be646ULL,
+	0xbb34b5ad3bfe586dULL, 0x095f34c9a12b97f0ULL, 0x247ab64525d60ca8ULL,
+	0xdcdbc6f3017477d1ULL, 0x4a2e14d4decad24dULL, 0xbdb5e6d9be0a1eebULL,
+	0x2a7e70f7794301abULL, 0xdef42d8a270540fdULL, 0x01078ec0a34c22c1ULL,
+	0xe5de511af4c16387ULL, 0x7ebb3a52bd9a330aULL, 0x77697857aa7d6435ULL,
+	0x004e831603ae4c32ULL, 0xe7a21020ad78e312ULL, 0x9d41a70c6ab420f2ULL,
+	0x28e06c18ea1141e6ULL, 0xd2b28cbd984f6b28ULL, 0x26b75f6c446e9d83ULL,
+	0xba47568c4d418d7fULL, 0xd80badbfe6183d8eULL, 0x0e206d7f5f166044ULL,
+	0xe258a43911cbca3eULL, 0x723a1746b21dc0bcULL, 0xc7caa854f5d7cdd3ULL,
+	0x7cac32883d261d9cULL, 0x7690c26423ba942cULL, 0x17e55524478042b8ULL,
+	0xe0be477656a2389fULL, 0x4d289b5e67ab2da0ULL, 0x44862b9c8fbbfd31ULL,
+	0xb47cc8049d141365ULL, 0x822c1b362b91c793ULL, 0x4eb14655fb13dfd8ULL,
+	0x1ecbba0714e2a97bULL, 0x6143459d5cde5f14ULL, 0x53a8fbf1d5f0ac89ULL,
+	0x97ea04d81c5e5b00ULL, 0x622181a8d4fdb3f3ULL, 0xe9bcd341572a1208ULL,
+	0x1411258643cce58aULL, 0x9144c5fea4c6e0a4ULL, 0x0d33d06565cf620fULL,
+	0x54a48d489f219ca1ULL, 0xc43e5eac6d63c821ULL, 0xa9728b3a72770dafULL,
+	0xd7934e7b20df87efULL, 0xe35503b61a3e86e5ULL, 0xcae321fbc819d504ULL,
+	0x129a50b3ac60bfa6ULL, 0xcd5e68ea7e9fb6c3ULL, 0xb01c90199483b1c7ULL,
+	0x3de93cd5c295376cULL, 0xaed52edf2ab9ad13ULL, 0x2e60f512c0a07884ULL,
+	0xbc3d86a3e36210c9ULL, 0x35269d9b163951ceULL, 0x0c7d6e2ad0cdb5faULL,
+	0x59e86297d87f5733ULL, 0x298ef221898db0e7ULL, 0x55000029d1a5aa7eULL,
+	0x8bc08ae1b5061b45ULL, 0xc2c31c2b6c92703aULL, 0x94cc596baf25ef42ULL,
+	0x0a1d73db22540456ULL, 0x04b6a0f9d9c4179aULL, 0xeffdafa2ae3d3c60ULL,
+	0xf7c8075bb49496c4ULL, 0x9cc5c7141d1cd4e3ULL, 0x78bd1638218e5534ULL,
+	0xb2f11568f850246aULL, 0xedfabcfa9502bc29ULL, 0x796ce5f2da23051bULL,
+	0xaae128b0dc93537cULL, 0x3a493da0ee4b29aeULL, 0xb5df6b2c416895d7ULL,
+	0xfcabbd25122d7f37ULL, 0x70810b58105dc4b1ULL, 0xe10fdd37f7882a90ULL,
+	0x524dcab5518a3f5cULL, 0x3c9e85878451255bULL, 0x4029828119bd34e2ULL,
+	0x74a05b6f5d3ceccbULL, 0xb610021542e13ecaULL, 0x0ff979d12f59e2acULL,
+	0x6037da27e4f9cc50ULL, 0x5e92975a0df1847dULL, 0xd66de190d3e623feULL,
+	0x5032d6b87b568048ULL, 0x9a36b7ce8235216eULL, 0x80272a7a24f64b4aULL,
+	0x93efed8b8c6916f7ULL, 0x37ddbff44cce1555ULL, 0x4b95db5d4b99bd25ULL,
+	0x92d3fda169812fc0ULL, 0xfb1a4a9a90660bb6ULL, 0x730c196946a4b9b2ULL,
+	0x81e289aa7f49da68ULL, 0x64669a0f83b1a05fULL, 0x27b3ff7d9644f48bULL,
+	0xcc6b615c8db675b3ULL, 0x674f20b9bcebbe95ULL, 0x6f31238275655982ULL,
+	0x5ae488713e45cf05ULL, 0xbf619f9954c21157ULL, 0xeabac46040a8eae9ULL,
+	0x454c6fe9f2c0c1cdULL, 0x419cf6496412691cULL, 0xd3dc3bef265b0f70ULL,
+	0x6d0e60f5c3578a9eULL
+};
+
+static const u64 sbox4[256] = {
+	0x5b0e608526323c55ULL, 0x1a46c1a9fa1b59f5ULL, 0xa9e245a17c4c8ffaULL,
+	0x65ca5159db2955d7ULL, 0x05db0a76ce35afc2ULL, 0x81eac77ea9113d45ULL,
+	0x528ef88ab6ac0a0dULL, 0xa09ea253597be3ffULL, 0x430ddfb3ac48cd56ULL,
+	0xc4b3a67af45ce46fULL, 0x4ececfd8fbe2d05eULL, 0x3ef56f10b39935f0ULL,
+	0x0b22d6829cd619c6ULL, 0x17fd460a74df2069ULL, 0x6cf8cc8e8510ed40ULL,
+	0xd6c824bf3a6ecaa7ULL, 0x61243d581a817049ULL, 0x048bacb6bbc163a2ULL,
+	0xd9a38ac27d44cc32ULL, 0x7fddff5baaf410abULL, 0xad6d495aa804824bULL,
+	0xe1a6a74f2d8c9f94ULL, 0xd4f7851235dee8e3ULL, 0xfd4b7f886540d893ULL,
+	0x247c20042aa4bfdaULL, 0x096ea1c517d1327cULL, 0xd56966b4361a6685ULL,
+	0x277da5c31221057dULL, 0x94d59893a43acff7ULL, 0x64f0c51ccdc02281ULL,
+	0x3d33bcc4ff6189dbULL, 0xe005cb184ce66af1ULL, 0xff5ccd1d1db99beaULL,
+	0xb0b854a7fe42980fULL, 0x7bd46a6a718d4b9fULL, 0xd10fa8cc22a5fd8cULL,
+	0xd31484952be4bd31ULL, 0xc7fa975fcb243847ULL, 0x4886ed1e5846c407ULL,
+	0x28cddb791eb70b04ULL, 0xc2b00be2f573417fULL, 0x5c9590452180f877ULL,
+	0x7a6bddfff370eb00ULL, 0xce509e38d6d9d6a4ULL, 0xebeb0f00647fa702ULL,
+	0x1dcc06cf76606f06ULL, 0xe4d9f28ba286ff0aULL, 0xd85a305dc918c262ULL,
+	0x475b1d8732225f54ULL, 0x2d4fb51668ccb5feULL, 0xa679b9d9d72bba20ULL,
+	0x53841c0d912d43a5ULL, 0x3b7eaa48bf12a4e8ULL, 0x781e0e47f22f1ddfULL,
+	0xeff20ce60ab50973ULL, 0x20d261d19dffb742ULL, 0x16a12b03062a2e39ULL,
+	0x1960eb2239650495ULL, 0x251c16fed50eb8b8ULL, 0x9ac0c330f826016eULL,
+	0xed152665953e7671ULL, 0x02d63194a6369570ULL, 0x5074f08394b1c987ULL,
+	0x70ba598c90b25ce1ULL, 0x794a15810b9742f6ULL, 0x0d5925e9fcaf8c6cULL,
+	0x3067716cd868744eULL, 0x910ab077e8d7731bULL, 0x6a61bbdb5ac42f61ULL,
+	0x93513efbf0851567ULL, 0xf494724b9e83e9d5ULL, 0xe887e1985c09648dULL,
+	0x34b1d3c675370cfdULL, 0xdc35e433bc0d255dULL, 0xd0aab84234131be0ULL,
+	0x08042a50b48b7eafULL, 0x9997c4ee44a3ab35ULL, 0x829a7b49201799d0ULL,
+	0x263b8307b7c54441ULL, 0x752f95f4fd6a6ca6ULL, 0x927217402c08c6e5ULL,
+	0x2a8ab754a795d9eeULL, 0xa442f7552f72943dULL, 0x2c31334e19781208ULL,
+	0x4fa98d7ceaee6291ULL, 0x55c3862f665db309ULL, 0xbd0610175d53b1f3ULL,
+	0x46fe6cb840413f27ULL, 0x3fe03792df0cfa59ULL, 0xcfe700372eb85e8fULL,
+	0xa7be29e7adbce118ULL, 0xe544ee5cde8431ddULL, 0x8a781b1b41f1873eULL,
+	0xa5c94c78a0d2f0e7ULL, 0x39412e2877b60728ULL, 0xa1265ef3afc9a62cULL,
+	0xbcc2770c6a2506c5ULL, 0x3ab66dd5dce1ce12ULL, 0xe65499d04a675b37ULL,
+	0x7d8f523481bfd216ULL, 0x0f6f64fcec15f389ULL, 0x74efbe618b5b13c8ULL,
+	0xacdc82b714273e1dULL, 0xdd40bfe003199d17ULL, 0x37e99257e7e061f8ULL,
+	0xfa52626904775aaaULL, 0x8bbbf63a463d56f9ULL, 0xf0013f1543a26e64ULL,
+	0xa8307e9f879ec898ULL, 0xcc4c27a4150177ccULL, 0x1b432f2cca1d3348ULL,
+	0xde1d1f8f9f6fa013ULL, 0x606602a047a7ddd6ULL, 0xd237ab64cc1cb2c7ULL,
+	0x9b938e7225fcd1d3ULL, 0xec4e03708e0ff476ULL, 0xfeb2fbda3d03c12dULL,
+	0xae0bced2ee43889aULL, 0x22cb8923ebfb4f43ULL, 0x69360d013cf7396dULL,
+	0x855e3602d2d4e022ULL, 0x073805bad01f784cULL, 0x33e17a133852f546ULL,
+	0xdf4874058ac7b638ULL, 0xba92b29c678aa14aULL, 0x0ce89fc76cfaadcdULL,
+	0x5f9d4e0908339e34ULL, 0xf1afe9291f5923b9ULL, 0x6e3480f60f4a265fULL,
+	0xeebf3a2ab29b841cULL, 0xe21938a88f91b4adULL, 0x57dfeff845c6d3c3ULL,
+	0x2f006b0bf62caaf2ULL, 0x62f479ef6f75ee78ULL, 0x11a55ad41c8916a9ULL,
+	0xf229d29084fed453ULL, 0x42f1c27b16b000e6ULL, 0x2b1f76749823c074ULL,
+	0x4b76eca3c2745360ULL, 0x8c98f463b91691bdULL, 0x14bcc93cf1ade66aULL,
+	0x8885213e6d458397ULL, 0x8e177df0274d4711ULL, 0xb49b73b5503f2951ULL,
+	0x10168168c3f96b6bULL, 0x0e3d963b63cab0aeULL, 0x8dfc4b5655a1db14ULL,
+	0xf789f1356e14de5cULL, 0x683e68af4e51dac1ULL, 0xc9a84f9d8d4b0fd9ULL,
+	0x3691e03f52a0f9d1ULL, 0x5ed86e46e1878e80ULL, 0x3c711a0e99d07150ULL,
+	0x5a0865b20c4e9310ULL, 0x56fbfc1fe4f0682eULL, 0xea8d5de3105edf9bULL,
+	0x71abfdb12379187aULL, 0x2eb99de1bee77b9cULL, 0x21ecc0ea33cf4523ULL,
+	0x59a4d7521805c7a1ULL, 0x3896f5eb56ae7c72ULL, 0xaa638f3db18f75dcULL,
+	0x9f39358dabe9808eULL, 0xb7defa91c00b72acULL, 0x6b5541fd62492d92ULL,
+	0x6dc6dee8f92e4d5bULL, 0x353f57abc4beea7eULL, 0x735769d6da5690ceULL,
+	0x0a234aa642391484ULL, 0xf6f9508028f80d9dULL, 0xb8e319a27ab3f215ULL,
+	0x31ad9c1151341a4dULL, 0x773c22a57bef5805ULL, 0x45c7561a07968633ULL,
+	0xf913da9e249dbe36ULL, 0xda652d9b78a64c68ULL, 0x4c27a97f3bc334efULL,
+	0x76621220e66b17f4ULL, 0x967743899acd7d0bULL, 0xf3ee5bcae0ed6782ULL,
+	0x409f753600c879fcULL, 0x06d09a39b5926db6ULL, 0x6f83aeb0317ac588ULL,
+	0x01e6ca4a86381f21ULL, 0x66ff3462d19f3025ULL, 0x72207c24ddfd3bfbULL,
+	0x4af6b6d3e2ece2ebULL, 0x9c994dbec7ea08deULL, 0x49ace597b09a8bc4ULL,
+	0xb38c4766cf0797baULL, 0x131b9373c57c2a75ULL, 0xb1822cce61931e58ULL,
+	0x9d7555b909ba1c0cULL, 0x127fafdd937d11d2ULL, 0x29da3badc66d92e4ULL,
+	0xa2c1d57154c2ecbcULL, 0x58c5134d82f6fe24ULL, 0x1c3ae3515b62274fULL,
+	0xe907c82e01cb8126ULL, 0xf8ed091913e37fcbULL, 0x3249d8f9c80046c9ULL,
+	0x80cf9bede388fb63ULL, 0x1881539a116cf19eULL, 0x5103f3f76bd52457ULL,
+	0x15b7e6f5ae47f7a8ULL, 0xdbd7c6ded47e9ccfULL, 0x44e55c410228bb1aULL,
+	0xb647d4255edb4e99ULL, 0x5d11882bb8aafc30ULL, 0xf5098bbb29d3212aULL,
+	0x8fb5ea14e90296b3ULL, 0x677b942157dd025aULL, 0xfb58e7c0a390acb5ULL,
+	0x89d3674c83bd4a01ULL, 0x9e2da4df4bf3b93bULL, 0xfcc41e328cab4829ULL,
+	0x03f38c96ba582c52ULL, 0xcad1bdbd7fd85db2ULL, 0xbbb442c16082ae83ULL,
+	0xb95fe86ba5da9ab0ULL, 0xb22e04673771a93fULL, 0x845358c9493152d8ULL,
+	0xbe2a488697b4541eULL, 0x95a2dc2dd38e6966ULL, 0xc02c11ac923c852bULL,
+	0x2388b1990df2a87bULL, 0x7c8008fa1b4f37beULL, 0x1f70d0c84d54e503ULL,
+	0x5490adec7ece57d4ULL, 0x002b3c27d9063a3aULL, 0x7eaea3848030a2bfULL,
+	0xc602326ded2003c0ULL, 0x83a7287d69a94086ULL, 0xc57a5fcb30f57a8aULL,
+	0xb56844e479ebe779ULL, 0xa373b40f05dcbce9ULL, 0xd71a786e88570ee2ULL,
+	0x879cbacdbde8f6a0ULL, 0x976ad1bcc164a32fULL, 0xab21e25e9666d78bULL,
+	0x901063aae5e5c33cULL, 0x9818b34448698d90ULL, 0xe36487ae3e1e8abbULL,
+	0xafbdf931893bdcb4ULL, 0x6345a0dc5fbbd519ULL, 0x8628fe269b9465caULL,
+	0x1e5d01603f9c51ecULL, 0x4de44006a15049b7ULL, 0xbf6c70e5f776cbb1ULL,
+	0x411218f2ef552bedULL, 0xcb0c0708705a36a3ULL, 0xe74d14754f986044ULL,
+	0xcd56d9430ea8280eULL, 0xc12591d7535f5065ULL, 0xc83223f1720aef96ULL,
+	0xc3a0396f7363a51fULL
+};
+
+
+static void tgr192_round(u64 * ra, u64 * rb, u64 * rc, u64 x, int mul)
+{
+	u64 a = *ra;
+	u64 b = *rb;
+	u64 c = *rc;
+
+	c ^= x;
+	a -= sbox1[c         & 0xff] ^ sbox2[(c >> 16) & 0xff]
+	   ^ sbox3[(c >> 32) & 0xff] ^ sbox4[(c >> 48) & 0xff];
+	b += sbox4[(c >>  8) & 0xff] ^ sbox3[(c >> 24) & 0xff]
+	   ^ sbox2[(c >> 40) & 0xff] ^ sbox1[(c >> 56) & 0xff];
+	b *= mul;
+
+	*ra = a;
+	*rb = b;
+	*rc = c;
+}
+
+
+static void tgr192_pass(u64 * ra, u64 * rb, u64 * rc, u64 * x, int mul)
+{
+	u64 a = *ra;
+	u64 b = *rb;
+	u64 c = *rc;
+
+	tgr192_round(&a, &b, &c, x[0], mul);
+	tgr192_round(&b, &c, &a, x[1], mul);
+	tgr192_round(&c, &a, &b, x[2], mul);
+	tgr192_round(&a, &b, &c, x[3], mul);
+	tgr192_round(&b, &c, &a, x[4], mul);
+	tgr192_round(&c, &a, &b, x[5], mul);
+	tgr192_round(&a, &b, &c, x[6], mul);
+	tgr192_round(&b, &c, &a, x[7], mul);
+
+	*ra = a;
+	*rb = b;
+	*rc = c;
+}
+
+
+static void tgr192_key_schedule(u64 * x)
+{
+	x[0] -= x[7] ^ 0xa5a5a5a5a5a5a5a5ULL;
+	x[1] ^= x[0];
+	x[2] += x[1];
+	x[3] -= x[2] ^ ((~x[1]) << 19);
+	x[4] ^= x[3];
+	x[5] += x[4];
+	x[6] -= x[5] ^ ((~x[4]) >> 23);
+	x[7] ^= x[6];
+	x[0] += x[7];
+	x[1] -= x[0] ^ ((~x[7]) << 19);
+	x[2] ^= x[1];
+	x[3] += x[2];
+	x[4] -= x[3] ^ ((~x[2]) >> 23);
+	x[5] ^= x[4];
+	x[6] += x[5];
+	x[7] -= x[6] ^ 0x0123456789abcdefULL;
+}
+
+
+/****************
+ * Transform the message DATA which consists of 512 bytes (8 words)
+ */
+
+static void tgr192_transform(struct tgr192_ctx *tctx, const u8 * data)
+{
+	u64 a, b, c, aa, bb, cc;
+	u64 x[8];
+	int i;
+	const u8 *ptr = data;
+
+	for (i = 0; i < 8; i++, ptr += 8) {
+		x[i] = (((u64)ptr[7] ) << 56) ^
+		(((u64)ptr[6] & 0xffL) << 48) ^
+		(((u64)ptr[5] & 0xffL) << 40) ^
+		(((u64)ptr[4] & 0xffL) << 32) ^
+		(((u64)ptr[3] & 0xffL) << 24) ^
+		(((u64)ptr[2] & 0xffL) << 16) ^
+		(((u64)ptr[1] & 0xffL) <<  8) ^
+		(((u64)ptr[0] & 0xffL)      );
+	}
+
+	/* save */
+	a = aa = tctx->a;
+	b = bb = tctx->b;
+	c = cc = tctx->c;
+
+	tgr192_pass(&a, &b, &c, x, 5);
+	tgr192_key_schedule(x);
+	tgr192_pass(&c, &a, &b, x, 7);
+	tgr192_key_schedule(x);
+	tgr192_pass(&b, &c, &a, x, 9);
+
+
+	/* feedforward */
+	a ^= aa;
+	b -= bb;
+	c += cc;
+	/* store */
+	tctx->a = a;
+	tctx->b = b;
+	tctx->c = c;
+}
+
+static void tgr192_init(void *ctx)
+{
+	struct tgr192_ctx *tctx = ctx;
+
+	memset (tctx->hash, 0, 64);
+	tctx->a = 0x0123456789abcdefULL;
+	tctx->b = 0xfedcba9876543210ULL;
+	tctx->c = 0xf096a5b4c3b2e187ULL;
+	tctx->nblocks = 0;
+	tctx->count = 0;
+}
+
+
+/* Update the message digest with the contents
+ * of INBUF with length INLEN. */
+static void tgr192_update(void *ctx, const u8 * inbuf, unsigned int len)
+{
+	struct tgr192_ctx *tctx = ctx;
+
+	if (tctx->count == 64) {	/* flush the buffer */
+		tgr192_transform(tctx, tctx->hash);
+		tctx->count = 0;
+		tctx->nblocks++;
+	}
+	if (!inbuf) {
+		return;
+	}
+	if (tctx->count) {
+		for (; len && tctx->count < 64; len--) {
+			tctx->hash[tctx->count++] = *inbuf++;
+		}
+		tgr192_update(tctx, NULL, 0);
+		if (!len) {
+			return;
+		}
+
+	}
+
+	while (len >= 64) {
+		tgr192_transform(tctx, inbuf);
+		tctx->count = 0;
+		tctx->nblocks++;
+		len -= 64;
+		inbuf += 64;
+	}
+	for (; len && tctx->count < 64; len--) {
+		tctx->hash[tctx->count++] = *inbuf++;
+	}
+}
+
+
+
+/* The routine terminates the computation */
+static void tgr192_final(void *ctx, u8 * out)
+{
+	struct tgr192_ctx *tctx = ctx;
+	u32 t, msb, lsb;
+	u8 *p;
+	int i, j;
+
+	tgr192_update(tctx, NULL, 0); /* flush */ ;
+
+	msb = 0;
+	t = tctx->nblocks;
+	if ((lsb = t << 6) < t) { /* multiply by 64 to make a byte count */
+		msb++;
+	}
+	msb += t >> 26;
+	t = lsb;
+	if ((lsb = t + tctx->count) < t) {	/* add the count */
+		msb++;
+	}
+	t = lsb;
+	if ((lsb = t << 3) < t)	{ /* multiply by 8 to make a bit count */
+		msb++;
+	}
+	msb += t >> 29;
+
+	if (tctx->count < 56) {	/* enough room */
+		tctx->hash[tctx->count++] = 0x01;	/* pad */
+		while (tctx->count < 56) {
+			tctx->hash[tctx->count++] = 0;	/* pad */
+		}
+	} else {		/* need one extra block */
+		tctx->hash[tctx->count++] = 0x01;	/* pad character */
+		while (tctx->count < 64) {
+			tctx->hash[tctx->count++] = 0;
+		}
+		tgr192_update(tctx, NULL, 0); /* flush */ ;
+		memset(tctx->hash, 0, 56);    /* fill next block with zeroes */
+	}
+	/* append the 64 bit count */
+	tctx->hash[56] = lsb;
+	tctx->hash[57] = lsb >> 8;
+	tctx->hash[58] = lsb >> 16;
+	tctx->hash[59] = lsb >> 24;
+	tctx->hash[60] = msb;
+	tctx->hash[61] = msb >> 8;
+	tctx->hash[62] = msb >> 16;
+	tctx->hash[63] = msb >> 24;
+	tgr192_transform(tctx, tctx->hash);
+
+	p = tctx->hash;
+	*p++ = tctx->a >> 56; *p++ = tctx->a >> 48; *p++ = tctx->a >> 40;
+	*p++ = tctx->a >> 32; *p++ = tctx->a >> 24; *p++ = tctx->a >> 16;
+	*p++ = tctx->a >>  8; *p++ = tctx->a;\
+	*p++ = tctx->b >> 56; *p++ = tctx->b >> 48; *p++ = tctx->b >> 40;
+	*p++ = tctx->b >> 32; *p++ = tctx->b >> 24; *p++ = tctx->b >> 16;
+	*p++ = tctx->b >>  8; *p++ = tctx->b;
+	*p++ = tctx->c >> 56; *p++ = tctx->c >> 48; *p++ = tctx->c >> 40;
+	*p++ = tctx->c >> 32; *p++ = tctx->c >> 24; *p++ = tctx->c >> 16;
+	*p++ = tctx->c >>  8; *p++ = tctx->c;
+
+
+	/* unpack the hash */
+	j = 7;
+	for (i = 0; i < 8; i++) {
+		out[j--] = (tctx->a >> 8 * i) & 0xff;
+	}
+	j = 15;
+	for (i = 0; i < 8; i++) {
+		out[j--] = (tctx->b >> 8 * i) & 0xff;
+	}
+	j = 23;
+	for (i = 0; i < 8; i++) {
+		out[j--] = (tctx->c >> 8 * i) & 0xff;
+	}
+}
+
+static void tgr160_final(void *ctx, u8 * out)
+{
+	struct tgr192_ctx *wctx = ctx;
+	u8 D[64];
+
+	tgr192_final(wctx, D);
+	memcpy(out, D, TGR160_DIGEST_SIZE);
+	memset(D, 0, TGR192_DIGEST_SIZE);
+}
+
+static void tgr128_final(void *ctx, u8 * out)
+{
+	struct tgr192_ctx *wctx = ctx;
+	u8 D[64];
+
+	tgr192_final(wctx, D);
+	memcpy(out, D, TGR128_DIGEST_SIZE);
+	memset(D, 0, TGR192_DIGEST_SIZE);
+}
+
+static struct crypto_alg tgr192 = {
+	.cra_name = "tgr192",
+	.cra_flags = CRYPTO_ALG_TYPE_DIGEST,
+	.cra_blocksize = TGR192_BLOCK_SIZE,
+	.cra_ctxsize = sizeof(struct tgr192_ctx),
+	.cra_module = THIS_MODULE,
+	.cra_list = LIST_HEAD_INIT(tgr192.cra_list),
+	.cra_u = {.digest = {
+			     .dia_digestsize = TGR192_DIGEST_SIZE,
+			     .dia_init = tgr192_init,
+			     .dia_update = tgr192_update,
+			     .dia_final = tgr192_final}}
+};
+
+static struct crypto_alg tgr160 = {
+	.cra_name = "tgr160",
+	.cra_flags = CRYPTO_ALG_TYPE_DIGEST,
+	.cra_blocksize = TGR192_BLOCK_SIZE,
+	.cra_ctxsize = sizeof(struct tgr192_ctx),
+	.cra_module = THIS_MODULE,
+	.cra_list = LIST_HEAD_INIT(tgr160.cra_list),
+	.cra_u = {.digest = {
+			     .dia_digestsize = TGR160_DIGEST_SIZE,
+			     .dia_init = tgr192_init,
+			     .dia_update = tgr192_update,
+			     .dia_final = tgr160_final}}
+};
+
+static struct crypto_alg tgr128 = {
+	.cra_name = "tgr128",
+	.cra_flags = CRYPTO_ALG_TYPE_DIGEST,
+	.cra_blocksize = TGR192_BLOCK_SIZE,
+	.cra_ctxsize = sizeof(struct tgr192_ctx),
+	.cra_module = THIS_MODULE,
+	.cra_list = LIST_HEAD_INIT(tgr128.cra_list),
+	.cra_u = {.digest = {
+			     .dia_digestsize = TGR128_DIGEST_SIZE,
+			     .dia_init = tgr192_init,
+			     .dia_update = tgr192_update,
+			     .dia_final = tgr128_final}}
+};
+
+static int __init init(void)
+{
+	int ret = 0;
+
+	ret = crypto_register_alg(&tgr192);
+
+	if (ret < 0) {
+		goto out;
+	}
+
+	ret = crypto_register_alg(&tgr160);
+	if (ret < 0) {
+		crypto_unregister_alg(&tgr192);
+		goto out;
+	}
+
+	ret = crypto_register_alg(&tgr128);
+	if (ret < 0) {
+		crypto_unregister_alg(&tgr192);
+		crypto_unregister_alg(&tgr160);
+	}
+      out:
+	return ret;
+}
+
+static void __exit fini(void)
+{
+	crypto_unregister_alg(&tgr192);
+	crypto_unregister_alg(&tgr160);
+	crypto_unregister_alg(&tgr128);
+}
+
+MODULE_ALIAS("tgr160");
+MODULE_ALIAS("tgr128");
+
+module_init(init);
+module_exit(fini);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Tiger Message Digest Algorithm");
diff -Nru a/drivers/Makefile b/drivers/Makefile
--- a/drivers/Makefile	2005-01-17 10:06:18 -08:00
+++ b/drivers/Makefile	2005-03-07 20:41:31 -08:00
@@ -61,5 +61,6 @@
 obj-$(CONFIG_CPU_FREQ)		+= cpufreq/
 obj-$(CONFIG_MMC)		+= mmc/
 obj-$(CONFIG_INFINIBAND)	+= infiniband/
+obj-$(CONFIG_BLK_DEV_SGIIOC4)	+= sn/
 obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
diff -Nru a/drivers/acorn/char/i2c.c b/drivers/acorn/char/i2c.c
--- a/drivers/acorn/char/i2c.c	2004-03-29 14:16:31 -08:00
+++ b/drivers/acorn/char/i2c.c	2005-03-02 10:00:56 -08:00
@@ -313,7 +313,7 @@
 
 static int ioc_client_reg(struct i2c_client *client)
 {
-	if (client->id == I2C_DRIVERID_PCF8583 &&
+	if (client->driver->id == I2C_DRIVERID_PCF8583 &&
 	    client->addr == 0x50) {
 		struct rtc_tm rtctm;
 		unsigned int year;
diff -Nru a/drivers/acorn/char/pcf8583.c b/drivers/acorn/char/pcf8583.c
--- a/drivers/acorn/char/pcf8583.c	2004-02-20 11:40:36 -08:00
+++ b/drivers/acorn/char/pcf8583.c	2005-03-02 10:00:56 -08:00
@@ -51,7 +51,6 @@
 		return -ENOMEM;
 
 	memset(c, 0, sizeof(*c));
-	c->id		= pcf8583_driver.id;
 	c->addr		= addr;
 	c->adapter	= adap;
 	c->driver	= &pcf8583_driver;
diff -Nru a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
--- a/drivers/atm/ambassador.c	2005-01-18 13:02:53 -08:00
+++ b/drivers/atm/ambassador.c	2005-03-07 20:41:43 -08:00
@@ -296,16 +296,16 @@
 #endif
 #define UCODE2(x) #x
 
-static u32 __initdata ucode_start = 
+static u32 __devinitdata ucode_start =
 #include UCODE(start)
 ;
 
-static region __initdata ucode_regions[] = {
+static region __devinitdata ucode_regions[] = {
 #include UCODE(regions)
   { 0, 0 }
 };
 
-static u32 __initdata ucode_data[] = {
+static u32 __devinitdata ucode_data[] = {
 #include UCODE(data)
   0xdeadbeef
 };
@@ -1539,7 +1539,7 @@
 
 /********** creation of communication queues **********/
 
-static int __init create_queues (amb_dev * dev, unsigned int cmds,
+static int __devinit create_queues (amb_dev * dev, unsigned int cmds,
 				 unsigned int txs, unsigned int * rxs,
 				 unsigned int * rx_buffer_sizes) {
   unsigned char pool;
@@ -1769,7 +1769,7 @@
 	return res;
 }
 
-static int __init do_loader_command (volatile loader_block * lb,
+static int __devinit do_loader_command (volatile loader_block * lb,
 				     const amb_dev * dev, loader_command cmd) {
   
   unsigned long timeout;
@@ -1825,7 +1825,7 @@
 
 /* loader: determine loader version */
 
-static int __init get_loader_version (loader_block * lb,
+static int __devinit get_loader_version (loader_block * lb,
 				      const amb_dev * dev, u32 * version) {
   int res;
   
@@ -1841,7 +1841,7 @@
 
 /* loader: write memory data blocks */
 
-static int __init loader_write (loader_block * lb,
+static int __devinit loader_write (loader_block * lb,
 				const amb_dev * dev, const u32 * data,
 				u32 address, unsigned int count) {
   unsigned int i;
@@ -1860,7 +1860,7 @@
 
 /* loader: verify memory data blocks */
 
-static int __init loader_verify (loader_block * lb,
+static int __devinit loader_verify (loader_block * lb,
 				 const amb_dev * dev, const u32 * data,
 				 u32 address, unsigned int count) {
   unsigned int i;
@@ -1885,7 +1885,7 @@
 
 /* loader: start microcode */
 
-static int __init loader_start (loader_block * lb,
+static int __devinit loader_start (loader_block * lb,
 				const amb_dev * dev, u32 address) {
   PRINTD (DBG_FLOW|DBG_LOAD, "loader_start");
   
@@ -1961,7 +1961,7 @@
 
 /********** transfer and start the microcode **********/
 
-static int __init ucode_init (loader_block * lb, amb_dev * dev) {
+static int __devinit ucode_init (loader_block * lb, amb_dev * dev) {
   unsigned int i = 0;
   unsigned int total = 0;
   const u32 * pointer = ucode_data;
@@ -2011,7 +2011,7 @@
     return cpu_to_be32 (virt_to_bus (addr));
 }
 
-static int __init amb_talk (amb_dev * dev) {
+static int __devinit amb_talk (amb_dev * dev) {
   adap_talk_block a;
   unsigned char pool;
   unsigned long timeout;
@@ -2058,7 +2058,7 @@
 }
 
 // get microcode version
-static void __init amb_ucode_version (amb_dev * dev) {
+static void __devinit amb_ucode_version (amb_dev * dev) {
   u32 major;
   u32 minor;
   command cmd;
@@ -2085,7 +2085,7 @@
 }
 
 // get end station address
-static void __init amb_esi (amb_dev * dev, u8 * esi) {
+static void __devinit amb_esi (amb_dev * dev, u8 * esi) {
   u32 lower4;
   u16 upper2;
   command cmd;
@@ -2131,7 +2131,7 @@
 	return;
 }
 
-static int __init amb_init (amb_dev * dev)
+static int __devinit amb_init (amb_dev * dev)
 {
   loader_block lb;
   
diff -Nru a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
--- a/drivers/atm/atmtcp.c	2004-12-27 18:07:47 -08:00
+++ b/drivers/atm/atmtcp.c	2005-01-20 18:17:39 -08:00
@@ -67,7 +67,7 @@
 	*(struct atm_vcc **) &new_msg->vcc = vcc;
 	old_test = test_bit(flag,&vcc->flags);
 	out_vcc->push(out_vcc,skb);
-	add_wait_queue(vcc->sk->sk_sleep, &wait);
+	add_wait_queue(sk_atm(vcc)->sk_sleep, &wait);
 	while (test_bit(flag,&vcc->flags) == old_test) {
 		mb();
 		out_vcc = PRIV(vcc->dev) ? PRIV(vcc->dev)->vcc : NULL;
@@ -79,7 +79,7 @@
 		schedule();
 	}
 	set_current_state(TASK_RUNNING);
-	remove_wait_queue(vcc->sk->sk_sleep, &wait);
+	remove_wait_queue(sk_atm(vcc)->sk_sleep, &wait);
 	return error;
 }
 
@@ -91,7 +91,7 @@
 	vcc->vpi = msg->addr.sap_addr.vpi;
 	vcc->vci = msg->addr.sap_addr.vci;
 	vcc->qos = msg->qos;
-	vcc->sk->sk_err = -msg->result;
+	sk_atm(vcc)->sk_err = -msg->result;
 	switch (msg->type) {
 	    case ATMTCP_CTRL_OPEN:
 		change_bit(ATM_VF_READY,&vcc->flags);
@@ -104,7 +104,7 @@
 		    msg->type);
 		return -EINVAL;
 	}
-	wake_up(vcc->sk->sk_sleep);
+	wake_up(sk_atm(vcc)->sk_sleep);
 	return 0;
 }
 
@@ -135,7 +135,7 @@
 	clear_bit(ATM_VF_READY,&vcc->flags); /* just in case ... */
 	error = atmtcp_send_control(vcc,ATMTCP_CTRL_OPEN,&msg,ATM_VF_READY);
 	if (error) return error;
-	return -vcc->sk->sk_err;
+	return -sk_atm(vcc)->sk_err;
 }
 
 
@@ -267,7 +267,7 @@
 			walk = atm_sk(s);
 			if (walk->dev != atmtcp_dev)
 				continue;
-			wake_up(walk->sk->sk_sleep);
+			wake_up(s->sk_sleep);
 		}
 	}
 	read_unlock(&vcc_sklist_lock);
@@ -417,7 +417,7 @@
 	}
 	PRIV(dev)->vcc = vcc;
 	vcc->dev = &atmtcp_control_dev;
-	vcc_insert_socket(vcc->sk);
+	vcc_insert_socket(sk_atm(vcc));
 	set_bit(ATM_VF_META,&vcc->flags);
 	set_bit(ATM_VF_READY,&vcc->flags);
 	vcc->dev_data = dev;
diff -Nru a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
--- a/drivers/atm/fore200e.c	2005-02-01 23:45:37 -08:00
+++ b/drivers/atm/fore200e.c	2005-02-15 13:04:20 -08:00
@@ -1027,7 +1027,7 @@
 		/* when a vcc is closed, some PDUs may be still pending in the tx queue.
 		   if the same vcc is immediately re-opened, those pending PDUs must
 		   not be popped after the completion of their emission, as they refer
-		   to the prior incarnation of that vcc. otherwise, vcc->sk->sk_wmem_alloc
+		   to the prior incarnation of that vcc. otherwise, sk_atm(vcc)->sk_wmem_alloc
 		   would be decremented by the size of the (unrelated) skb, possibly
 		   leading to a negative sk->sk_wmem_alloc count, ultimately freezing the vcc.
 		   we thus bind the tx entry to the current incarnation of the vcc
@@ -1054,8 +1054,8 @@
 		}
 #if 1
 		/* race fixed by the above incarnation mechanism, but... */
-		if (atomic_read(&vcc->sk->sk_wmem_alloc) < 0) {
-		    atomic_set(&vcc->sk->sk_wmem_alloc, 0);
+		if (atomic_read(&sk_atm(vcc)->sk_wmem_alloc) < 0) {
+		    atomic_set(&sk_atm(vcc)->sk_wmem_alloc, 0);
 		}
 #endif
 		/* check error condition */
@@ -1258,12 +1258,12 @@
 	return -ENOMEM;
     }
 
-    ASSERT(atomic_read(&vcc->sk->sk_wmem_alloc) >= 0);
+    ASSERT(atomic_read(&sk_atm(vcc)->sk_wmem_alloc) >= 0);
 
     vcc->push(vcc, skb);
     atomic_inc(&vcc->stats->rx);
 
-    ASSERT(atomic_read(&vcc->sk->sk_wmem_alloc) >= 0);
+    ASSERT(atomic_read(&sk_atm(vcc)->sk_wmem_alloc) >= 0);
 
     return 0;
 }
@@ -1700,7 +1700,7 @@
     unsigned long           flags;
 
     ASSERT(vcc);
-    ASSERT(atomic_read(&vcc->sk->sk_wmem_alloc) >= 0);
+    ASSERT(atomic_read(&sk_atm(vcc)->sk_wmem_alloc) >= 0);
     ASSERT(fore200e);
     ASSERT(fore200e_vcc);
 
diff -Nru a/drivers/atm/he.c b/drivers/atm/he.c
--- a/drivers/atm/he.c	2005-01-26 23:01:02 -08:00
+++ b/drivers/atm/he.c	2005-02-08 20:09:14 -08:00
@@ -2610,7 +2610,7 @@
 		 * TBRQ, the host issues the close command to the adapter.
 		 */
 
-		while (((tx_inuse = atomic_read(&vcc->sk->sk_wmem_alloc)) > 0) &&
+		while (((tx_inuse = atomic_read(&sk_atm(vcc)->sk_wmem_alloc)) > 0) &&
 		       (retry < MAX_RETRY)) {
 			msleep(sleep);
 			if (sleep < 250)
diff -Nru a/drivers/atm/idt77252.c b/drivers/atm/idt77252.c
--- a/drivers/atm/idt77252.c	2005-01-18 13:03:51 -08:00
+++ b/drivers/atm/idt77252.c	2005-01-20 18:17:39 -08:00
@@ -727,10 +727,11 @@
 	spin_lock_irqsave(&vc->lock, flags);
 	if (vc->estimator) {
 		struct atm_vcc *vcc = vc->tx_vcc;
+		struct sock *sk = sk_atm(vcc);
 
 		vc->estimator->cells += (skb->len + 47) / 48;
-		if (atomic_read(&vcc->sk->sk_wmem_alloc) >
-		    (vcc->sk->sk_sndbuf >> 1)) {
+		if (atomic_read(&sk->sk_wmem_alloc) >
+		    (sk->sk_sndbuf >> 1)) {
 			u32 cps = vc->estimator->maxcps;
 
 			vc->estimator->cps = cps;
@@ -1325,7 +1326,7 @@
 			goto drop;
 		}
 
-		if ((vcc->sk != NULL) && !atm_charge(vcc, sb->truesize)) {
+		if (!atm_charge(vcc, sb->truesize)) {
 			RXPRINTK("%s: atm_charge() dropped AAL0 packets.\n",
 				 card->name);
 			dev_kfree_skb(sb);
@@ -2029,7 +2030,7 @@
 		atomic_inc(&vcc->stats->tx_err);
 		return -ENOMEM;
 	}
-	atomic_add(skb->truesize, &vcc->sk->sk_wmem_alloc);
+	atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
 
 	memcpy(skb_put(skb, 52), cell, 52);
 
diff -Nru a/drivers/atm/iphase.c b/drivers/atm/iphase.c
--- a/drivers/atm/iphase.c	2005-02-06 22:18:18 -08:00
+++ b/drivers/atm/iphase.c	2005-02-15 11:54:29 -08:00
@@ -1778,16 +1778,18 @@
         if (ia_vcc->pcr < iadev->rate_limit)
            skb_queue_head_init (&ia_vcc->txing_skb);
         if (ia_vcc->pcr < iadev->rate_limit) {
-           if (vcc->qos.txtp.max_sdu != 0) {
+	   struct sock *sk = sk_atm(vcc);
+
+	   if (vcc->qos.txtp.max_sdu != 0) {
                if (ia_vcc->pcr > 60000)
-                  vcc->sk->sk_sndbuf = vcc->qos.txtp.max_sdu * 5;
+                  sk->sk_sndbuf = vcc->qos.txtp.max_sdu * 5;
                else if (ia_vcc->pcr > 2000)
-                  vcc->sk->sk_sndbuf = vcc->qos.txtp.max_sdu * 4;
+                  sk->sk_sndbuf = vcc->qos.txtp.max_sdu * 4;
                else
-                 vcc->sk->sk_sndbuf = vcc->qos.txtp.max_sdu * 3;
+                 sk->sk_sndbuf = vcc->qos.txtp.max_sdu * 3;
            }
            else
-             vcc->sk->sk_sndbuf = 24576;
+             sk->sk_sndbuf = 24576;
         }
            
 	vc = (struct main_vc *)iadev->MAIN_VC_TABLE_ADDR;  
diff -Nru a/drivers/atm/lanai.c b/drivers/atm/lanai.c
--- a/drivers/atm/lanai.c	2004-11-27 19:07:14 -08:00
+++ b/drivers/atm/lanai.c	2005-03-07 20:41:43 -08:00
@@ -566,7 +566,7 @@
 	return -EIO;
 }
 
-static int __init sram_test_pass(const struct lanai_dev *lanai, u32 pattern)
+static int __devinit sram_test_pass(const struct lanai_dev *lanai, u32 pattern)
 {
 	int offset, result = 0;
 	for (offset = 0; offset < SRAM_BYTES && result == 0; offset += 4)
@@ -574,7 +574,7 @@
 	return result;
 }
 
-static int __init sram_test_and_clear(const struct lanai_dev *lanai)
+static int __devinit sram_test_and_clear(const struct lanai_dev *lanai)
 {
 #ifdef FULL_MEMORY_TEST
 	int result;
@@ -860,7 +860,7 @@
 #ifndef READ_EEPROM
 
 /* Stub functions to use if EEPROM reading is disabled */
-static int __init eeprom_read(struct lanai_dev *lanai)
+static int __devinit eeprom_read(struct lanai_dev *lanai)
 {
 	printk(KERN_INFO DEV_LABEL "(itf %d): *NOT* reading EEPROM\n",
 	    lanai->number);
@@ -868,7 +868,7 @@
 	return 0;
 }
 
-static int __init eeprom_validate(struct lanai_dev *lanai)
+static int __devinit eeprom_validate(struct lanai_dev *lanai)
 {
 	lanai->serialno = 0;
 	lanai->magicno = EEPROM_MAGIC_VALUE;
@@ -877,7 +877,7 @@
 
 #else /* READ_EEPROM */
 
-static int __init eeprom_read(struct lanai_dev *lanai)
+static int __devinit eeprom_read(struct lanai_dev *lanai)
 {
 	int i, address;
 	u8 data;
@@ -953,7 +953,7 @@
 }
 
 /* Checksum/validate EEPROM contents */
-static int __init eeprom_validate(struct lanai_dev *lanai)
+static int __devinit eeprom_validate(struct lanai_dev *lanai)
 {
 	int i, s;
 	u32 v;
@@ -1449,7 +1449,7 @@
 #include <linux/vmalloc.h>
 #endif
 
-static int __init vcc_table_allocate(struct lanai_dev *lanai)
+static int __devinit vcc_table_allocate(struct lanai_dev *lanai)
 {
 #ifdef VCCTABLE_GETFREEPAGE
 	APRINTK((lanai->num_vci) * sizeof(struct lanai_vcc *) <= PAGE_SIZE,
@@ -1596,7 +1596,7 @@
 /*
  * Allocate service buffer and tell card about it
  */
-static int __init service_buffer_allocate(struct lanai_dev *lanai)
+static int __devinit service_buffer_allocate(struct lanai_dev *lanai)
 {
 	lanai_buf_allocate(&lanai->service, SERVICE_ENTRIES * 4, 8,
 	    lanai->pci);
@@ -1952,7 +1952,7 @@
 
 /* -------------------- PCI INITIALIZATION/SHUTDOWN: */
 
-static int __init lanai_pci_start(struct lanai_dev *lanai)
+static int __devinit lanai_pci_start(struct lanai_dev *lanai)
 {
 	struct pci_dev *pci = lanai->pci;
 	int result;
@@ -2148,7 +2148,7 @@
 /* -------------------- OPERATIONS: */
 
 /* setup a newly detected device */
-static int __init lanai_dev_open(struct atm_dev *atmdev)
+static int __devinit lanai_dev_open(struct atm_dev *atmdev)
 {
 	struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data;
 	unsigned long raw_base;
diff -Nru a/drivers/atm/zatm.c b/drivers/atm/zatm.c
--- a/drivers/atm/zatm.c	2005-02-06 22:19:00 -08:00
+++ b/drivers/atm/zatm.c	2005-03-07 20:41:43 -08:00
@@ -1090,7 +1090,7 @@
 /*----------------------------- (E)EPROM access -----------------------------*/
 
 
-static void __init eprom_set(struct zatm_dev *zatm_dev,unsigned long value,
+static void __devinit eprom_set(struct zatm_dev *zatm_dev,unsigned long value,
     unsigned short cmd)
 {
 	int error;
@@ -1101,7 +1101,7 @@
 }
 
 
-static unsigned long __init eprom_get(struct zatm_dev *zatm_dev,
+static unsigned long __devinit eprom_get(struct zatm_dev *zatm_dev,
     unsigned short cmd)
 {
 	unsigned int value;
@@ -1114,7 +1114,7 @@
 }
 
 
-static void __init eprom_put_bits(struct zatm_dev *zatm_dev,
+static void __devinit eprom_put_bits(struct zatm_dev *zatm_dev,
     unsigned long data,int bits,unsigned short cmd)
 {
 	unsigned long value;
@@ -1129,7 +1129,7 @@
 }
 
 
-static void __init eprom_get_byte(struct zatm_dev *zatm_dev,
+static void __devinit eprom_get_byte(struct zatm_dev *zatm_dev,
     unsigned char *byte,unsigned short cmd)
 {
 	int i;
@@ -1145,7 +1145,7 @@
 }
 
 
-static unsigned char __init eprom_try_esi(struct atm_dev *dev,
+static unsigned char __devinit eprom_try_esi(struct atm_dev *dev,
     unsigned short cmd,int offset,int swap)
 {
 	unsigned char buf[ZEPROM_SIZE];
@@ -1166,7 +1166,7 @@
 }
 
 
-static void __init eprom_get_esi(struct atm_dev *dev)
+static void __devinit eprom_get_esi(struct atm_dev *dev)
 {
 	if (eprom_try_esi(dev,ZEPROM_V1_REG,ZEPROM_V1_ESI_OFF,1)) return;
 	(void) eprom_try_esi(dev,ZEPROM_V2_REG,ZEPROM_V2_ESI_OFF,0);
diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
--- a/drivers/base/bus.c	2004-08-25 15:25:13 -07:00
+++ b/drivers/base/bus.c	2005-03-09 09:04:17 -08:00
@@ -65,7 +65,7 @@
 static void driver_release(struct kobject * kobj)
 {
 	struct device_driver * drv = to_driver(kobj);
-	up(&drv->unload_sem);
+	complete(&drv->unloaded);
 }
 
 static struct kobj_type ktype_driver = {
@@ -465,6 +465,7 @@
 		up_write(&dev->bus->subsys.rwsem);
 		device_add_attrs(bus, dev);
 		sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
+		sysfs_create_link(&dev->kobj, &dev->bus->subsys.kset.kobj, "bus");
 	}
 	return error;
 }
@@ -481,6 +482,7 @@
 void bus_remove_device(struct device * dev)
 {
 	if (dev->bus) {
+		sysfs_remove_link(&dev->kobj, "bus");
 		sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
 		device_remove_attrs(dev->bus, dev);
 		down_write(&dev->bus->subsys.rwsem);
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c	2004-12-21 16:29:34 -08:00
+++ b/drivers/base/class.c	2005-03-09 09:03:56 -08:00
@@ -15,6 +15,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/string.h>
+#include <linux/kdev_t.h>
 #include "base.h"
 
 #define to_class_attr(_attr) container_of(_attr, struct class_attribute, attr)
@@ -139,6 +140,7 @@
 
 	INIT_LIST_HEAD(&cls->children);
 	INIT_LIST_HEAD(&cls->interfaces);
+	init_MUTEX(&cls->sem);
 	error = kobject_set_name(&cls->subsys.kset.kobj, "%s", cls->name);
 	if (error)
 		return error;
@@ -195,33 +197,6 @@
 		sysfs_remove_bin_file(&class_dev->kobj, attr);
 }
 
-static int class_device_dev_link(struct class_device * class_dev)
-{
-	if (class_dev->dev)
-		return sysfs_create_link(&class_dev->kobj,
-					 &class_dev->dev->kobj, "device");
-	return 0;
-}
-
-static void class_device_dev_unlink(struct class_device * class_dev)
-{
-	sysfs_remove_link(&class_dev->kobj, "device");
-}
-
-static int class_device_driver_link(struct class_device * class_dev)
-{
-	if ((class_dev->dev) && (class_dev->dev->driver))
-		return sysfs_create_link(&class_dev->kobj,
-					 &class_dev->dev->driver->kobj, "driver");
-	return 0;
-}
-
-static void class_device_driver_unlink(struct class_device * class_dev)
-{
-	sysfs_remove_link(&class_dev->kobj, "driver");
-}
-
-
 static ssize_t
 class_device_attr_show(struct kobject * kobj, struct attribute * attr,
 		       char * buf)
@@ -298,9 +273,9 @@
 			 int num_envp, char *buffer, int buffer_size)
 {
 	struct class_device *class_dev = to_class_dev(kobj);
-	int retval = 0;
 	int i = 0;
 	int length = 0;
+	int retval = 0;
 
 	pr_debug("%s - name = %s\n", __FUNCTION__, class_dev->class_id);
 
@@ -313,26 +288,34 @@
 				    &length, "PHYSDEVPATH=%s", path);
 		kfree(path);
 
-		/* add bus name of physical device */
 		if (dev->bus)
 			add_hotplug_env_var(envp, num_envp, &i,
 					    buffer, buffer_size, &length,
 					    "PHYSDEVBUS=%s", dev->bus->name);
 
-		/* add driver name of physical device */
 		if (dev->driver)
 			add_hotplug_env_var(envp, num_envp, &i,
 					    buffer, buffer_size, &length,
 					    "PHYSDEVDRIVER=%s", dev->driver->name);
-
-		/* terminate, set to next free slot, shrink available space */
-		envp[i] = NULL;
-		envp = &envp[i];
-		num_envp -= i;
-		buffer = &buffer[length];
-		buffer_size -= length;
 	}
 
+	if (MAJOR(class_dev->devt)) {
+		add_hotplug_env_var(envp, num_envp, &i,
+				    buffer, buffer_size, &length,
+				    "MAJOR=%u", MAJOR(class_dev->devt));
+
+		add_hotplug_env_var(envp, num_envp, &i,
+				    buffer, buffer_size, &length,
+				    "MINOR=%u", MINOR(class_dev->devt));
+	}
+
+	/* terminate, set to next free slot, shrink available space */
+	envp[i] = NULL;
+	envp = &envp[i];
+	num_envp -= i;
+	buffer = &buffer[length];
+	buffer_size -= length;
+
 	if (class_dev->class->hotplug) {
 		/* have the bus specific function add its stuff */
 		retval = class_dev->class->hotplug (class_dev, envp, num_envp,
@@ -388,6 +371,12 @@
 	}
 }
 
+static ssize_t show_dev(struct class_device *class_dev, char *buf)
+{
+	return print_dev_t(buf, class_dev->devt);
+}
+static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
+
 void class_device_initialize(struct class_device *class_dev)
 {
 	kobj_set_kset_s(class_dev, class_obj_subsys);
@@ -425,16 +414,21 @@
 
 	/* now take care of our own registration */
 	if (parent) {
-		down_write(&parent->subsys.rwsem);
+		down(&parent->sem);
 		list_add_tail(&class_dev->node, &parent->children);
 		list_for_each_entry(class_intf, &parent->interfaces, node)
 			if (class_intf->add)
 				class_intf->add(class_dev);
-		up_write(&parent->subsys.rwsem);
+		up(&parent->sem);
 	}
+
+	if (MAJOR(class_dev->devt))
+		class_device_create_file(class_dev, &class_device_attr_dev);
+
 	class_device_add_attrs(class_dev);
-	class_device_dev_link(class_dev);
-	class_device_driver_link(class_dev);
+	if (class_dev->dev)
+		sysfs_create_link(&class_dev->kobj,
+				  &class_dev->dev->kobj, "device");
 
  register_done:
 	if (error && parent)
@@ -455,16 +449,16 @@
 	struct class_interface * class_intf;
 
 	if (parent) {
-		down_write(&parent->subsys.rwsem);
+		down(&parent->sem);
 		list_del_init(&class_dev->node);
 		list_for_each_entry(class_intf, &parent->interfaces, node)
 			if (class_intf->remove)
 				class_intf->remove(class_dev);
-		up_write(&parent->subsys.rwsem);
+		up(&parent->sem);
 	}
 
-	class_device_dev_unlink(class_dev);
-	class_device_driver_unlink(class_dev);
+	if (class_dev->dev)
+		sysfs_remove_link(&class_dev->kobj, "device");
 	class_device_remove_attrs(class_dev);
 
 	kobject_del(&class_dev->kobj);
@@ -516,8 +510,8 @@
 
 int class_interface_register(struct class_interface *class_intf)
 {
-	struct class * parent;
-	struct class_device * class_dev;
+	struct class *parent;
+	struct class_device *class_dev;
 
 	if (!class_intf || !class_intf->class)
 		return -ENODEV;
@@ -526,14 +520,13 @@
 	if (!parent)
 		return -EINVAL;
 
-	down_write(&parent->subsys.rwsem);
+	down(&parent->sem);
 	list_add_tail(&class_intf->node, &parent->interfaces);
-
 	if (class_intf->add) {
 		list_for_each_entry(class_dev, &parent->children, node)
 			class_intf->add(class_dev);
 	}
-	up_write(&parent->subsys.rwsem);
+	up(&parent->sem);
 
 	return 0;
 }
@@ -546,14 +539,13 @@
 	if (!parent)
 		return;
 
-	down_write(&parent->subsys.rwsem);
+	down(&parent->sem);
 	list_del_init(&class_intf->node);
-
 	if (class_intf->remove) {
 		list_for_each_entry(class_dev, &parent->children, node)
 			class_intf->remove(class_dev);
 	}
-	up_write(&parent->subsys.rwsem);
+	up(&parent->sem);
 
 	class_put(parent);
 }
diff -Nru a/drivers/base/class_simple.c b/drivers/base/class_simple.c
--- a/drivers/base/class_simple.c	2005-01-20 21:02:15 -08:00
+++ b/drivers/base/class_simple.c	2005-03-09 09:04:38 -08:00
@@ -10,18 +10,15 @@
 
 #include <linux/config.h>
 #include <linux/device.h>
-#include <linux/kdev_t.h>
 #include <linux/err.h>
 
 struct class_simple {
-	struct class_device_attribute attr;
 	struct class class;
 };
 #define to_class_simple(d) container_of(d, struct class_simple, class)
 
 struct simple_dev {
 	struct list_head node;
-	dev_t dev;
 	struct class_device class_dev;
 };
 #define to_simple_dev(d) container_of(d, struct simple_dev, class_dev)
@@ -35,12 +32,6 @@
 	kfree(s_dev);
 }
 
-static ssize_t show_dev(struct class_device *class_dev, char *buf)
-{
-	struct simple_dev *s_dev = to_simple_dev(class_dev);
-	return print_dev_t(buf, s_dev->dev);
-}
-
 static void class_simple_release(struct class *class)
 {
 	struct class_simple *cs = to_class_simple(class);
@@ -75,12 +66,6 @@
 	cs->class.class_release = class_simple_release;
 	cs->class.release = release_simple_dev;
 
-	cs->attr.attr.name = "dev";
-	cs->attr.attr.mode = S_IRUGO;
-	cs->attr.attr.owner = owner;
-	cs->attr.show = show_dev;
-	cs->attr.store = NULL;
-
 	retval = class_register(&cs->class);
 	if (retval)
 		goto error;
@@ -143,7 +128,7 @@
 	}
 	memset(s_dev, 0x00, sizeof(*s_dev));
 
-	s_dev->dev = dev;
+	s_dev->class_dev.devt = dev;
 	s_dev->class_dev.dev = device;
 	s_dev->class_dev.class = &cs->class;
 
@@ -154,8 +139,6 @@
 	if (retval)
 		goto error;
 
-	class_device_create_file(&s_dev->class_dev, &cs->attr);
-
 	spin_lock(&simple_dev_list_lock);
 	list_add(&s_dev->node, &simple_dev_list);
 	spin_unlock(&simple_dev_list_lock);
@@ -200,7 +183,7 @@
 
 	spin_lock(&simple_dev_list_lock);
 	list_for_each_entry(s_dev, &simple_dev_list, node) {
-		if (s_dev->dev == dev) {
+		if (s_dev->class_dev.devt == dev) {
 			found = 1;
 			break;
 		}
diff -Nru a/drivers/base/driver.c b/drivers/base/driver.c
--- a/drivers/base/driver.c	2004-09-24 11:44:53 -07:00
+++ b/drivers/base/driver.c	2005-03-09 09:04:21 -08:00
@@ -79,14 +79,14 @@
  *	since most of the things we have to do deal with the bus
  *	structures.
  *
- *	The one interesting aspect is that we initialize @drv->unload_sem
- *	to a locked state here. It will be unlocked when the driver
- *	reference count reaches 0.
+ *	The one interesting aspect is that we setup @drv->unloaded
+ *	as a completion that gets complete when the driver reference
+ *	count reaches 0.
  */
 int driver_register(struct device_driver * drv)
 {
 	INIT_LIST_HEAD(&drv->devices);
-	init_MUTEX_LOCKED(&drv->unload_sem);
+	init_completion(&drv->unloaded);
 	return bus_add_driver(drv);
 }
 
@@ -97,7 +97,7 @@
  *
  *	Again, we pass off most of the work to the bus-level call.
  *
- *	Though, once that is done, we attempt to take @drv->unload_sem.
+ *	Though, once that is done, we wait until @drv->unloaded is completed.
  *	This will block until the driver refcount reaches 0, and it is
  *	released. Only modular drivers will call this function, and we
  *	have to guarantee that it won't complete, letting the driver
@@ -107,8 +107,7 @@
 void driver_unregister(struct device_driver * drv)
 {
 	bus_remove_driver(drv);
-	down(&drv->unload_sem);
-	up(&drv->unload_sem);
+	wait_for_completion(&drv->unloaded);
 }
 
 /**
diff -Nru a/drivers/base/map.c b/drivers/base/map.c
--- a/drivers/base/map.c	2004-05-05 07:39:44 -07:00
+++ b/drivers/base/map.c	2005-03-09 09:03:28 -08:00
@@ -25,7 +25,7 @@
 		int (*lock)(dev_t, void *);
 		void *data;
 	} *probes[255];
-	struct rw_semaphore *sem;
+	struct semaphore *sem;
 };
 
 int kobj_map(struct kobj_map *domain, dev_t dev, unsigned long range,
@@ -53,7 +53,7 @@
 		p->range = range;
 		p->data = data;
 	}
-	down_write(domain->sem);
+	down(domain->sem);
 	for (i = 0, p -= n; i < n; i++, p++, index++) {
 		struct probe **s = &domain->probes[index % 255];
 		while (*s && (*s)->range < range)
@@ -61,7 +61,7 @@
 		p->next = *s;
 		*s = p;
 	}
-	up_write(domain->sem);
+	up(domain->sem);
 	return 0;
 }
 
@@ -75,7 +75,7 @@
 	if (n > 255)
 		n = 255;
 
-	down_write(domain->sem);
+	down(domain->sem);
 	for (i = 0; i < n; i++, index++) {
 		struct probe **s;
 		for (s = &domain->probes[index % 255]; *s; s = &(*s)->next) {
@@ -88,7 +88,7 @@
 			}
 		}
 	}
-	up_write(domain->sem);
+	up(domain->sem);
 	kfree(found);
 }
 
@@ -99,7 +99,7 @@
 	unsigned long best = ~0UL;
 
 retry:
-	down_read(domain->sem);
+	down(domain->sem);
 	for (p = domain->probes[MAJOR(dev) % 255]; p; p = p->next) {
 		struct kobject *(*probe)(dev_t, int *, void *);
 		struct module *owner;
@@ -120,7 +120,7 @@
 			module_put(owner);
 			continue;
 		}
-		up_read(domain->sem);
+		up(domain->sem);
 		kobj = probe(dev, index, data);
 		/* Currently ->owner protects _only_ ->probe() itself. */
 		module_put(owner);
@@ -128,12 +128,11 @@
 			return kobj;
 		goto retry;
 	}
-	up_read(domain->sem);
+	up(domain->sem);
 	return NULL;
 }
 
-struct kobj_map *kobj_map_init(kobj_probe_t *base_probe,
-		struct subsystem *s)
+struct kobj_map *kobj_map_init(kobj_probe_t *base_probe, struct semaphore *sem)
 {
 	struct kobj_map *p = kmalloc(sizeof(struct kobj_map), GFP_KERNEL);
 	struct probe *base = kmalloc(sizeof(struct probe), GFP_KERNEL);
@@ -151,6 +150,6 @@
 	base->get = base_probe;
 	for (i = 0; i < 255; i++)
 		p->probes[i] = base;
-	p->sem = &s->rwsem;
+	p->sem = sem;
 	return p;
 }
diff -Nru a/drivers/base/platform.c b/drivers/base/platform.c
--- a/drivers/base/platform.c	2005-01-10 17:29:25 -08:00
+++ b/drivers/base/platform.c	2005-03-09 09:04:54 -08:00
@@ -131,7 +131,7 @@
 	pdev->dev.bus = &platform_bus_type;
 
 	if (pdev->id != -1)
-		snprintf(pdev->dev.bus_id, BUS_ID_SIZE, "%s%u", pdev->name, pdev->id);
+		snprintf(pdev->dev.bus_id, BUS_ID_SIZE, "%s.%u", pdev->name, pdev->id);
 	else
 		strlcpy(pdev->dev.bus_id, pdev->name, BUS_ID_SIZE);
 
diff -Nru a/drivers/base/sys.c b/drivers/base/sys.c
--- a/drivers/base/sys.c	2004-09-24 11:47:02 -07:00
+++ b/drivers/base/sys.c	2005-03-09 09:03:37 -08:00
@@ -79,7 +79,7 @@
 /*
  * declare system_subsys
  */
-decl_subsys(system, &ktype_sysdev, NULL);
+static decl_subsys(system, &ktype_sysdev, NULL);
 
 int sysdev_class_register(struct sysdev_class * cls)
 {
@@ -102,7 +102,8 @@
 EXPORT_SYMBOL_GPL(sysdev_class_unregister);
 
 
-static LIST_HEAD(global_drivers);
+static LIST_HEAD(sysdev_drivers);
+static DECLARE_MUTEX(sysdev_drivers_lock);
 
 /**
  *	sysdev_driver_register - Register auxillary driver
@@ -112,14 +113,14 @@
  *	If @cls is valid, then @drv is inserted into @cls->drivers to be
  *	called on each operation on devices of that class. The refcount
  *	of @cls is incremented.
- *	Otherwise, @drv is inserted into global_drivers, and called for
+ *	Otherwise, @drv is inserted into sysdev_drivers, and called for
  *	each device.
  */
 
 int sysdev_driver_register(struct sysdev_class * cls,
 			   struct sysdev_driver * drv)
 {
-	down_write(&system_subsys.rwsem);
+	down(&sysdev_drivers_lock);
 	if (cls && kset_get(&cls->kset)) {
 		list_add_tail(&drv->entry, &cls->drivers);
 
@@ -130,8 +131,8 @@
 				drv->add(dev);
 		}
 	} else
-		list_add_tail(&drv->entry, &global_drivers);
-	up_write(&system_subsys.rwsem);
+		list_add_tail(&drv->entry, &sysdev_drivers);
+	up(&sysdev_drivers_lock);
 	return 0;
 }
 
@@ -144,7 +145,7 @@
 void sysdev_driver_unregister(struct sysdev_class * cls,
 			      struct sysdev_driver * drv)
 {
-	down_write(&system_subsys.rwsem);
+	down(&sysdev_drivers_lock);
 	list_del_init(&drv->entry);
 	if (cls) {
 		if (drv->remove) {
@@ -154,7 +155,7 @@
 		}
 		kset_put(&cls->kset);
 	}
-	up_write(&system_subsys.rwsem);
+	up(&sysdev_drivers_lock);
 }
 
 EXPORT_SYMBOL_GPL(sysdev_driver_register);
@@ -193,13 +194,13 @@
 	if (!error) {
 		struct sysdev_driver * drv;
 
-		down_write(&system_subsys.rwsem);
+		down(&sysdev_drivers_lock);
 		/* Generic notification is implicit, because it's that
 		 * code that should have called us.
 		 */
 
 		/* Notify global drivers */
-		list_for_each_entry(drv, &global_drivers, entry) {
+		list_for_each_entry(drv, &sysdev_drivers, entry) {
 			if (drv->add)
 				drv->add(sysdev);
 		}
@@ -209,7 +210,7 @@
 			if (drv->add)
 				drv->add(sysdev);
 		}
-		up_write(&system_subsys.rwsem);
+		up(&sysdev_drivers_lock);
 	}
 	return error;
 }
@@ -218,8 +219,8 @@
 {
 	struct sysdev_driver * drv;
 
-	down_write(&system_subsys.rwsem);
-	list_for_each_entry(drv, &global_drivers, entry) {
+	down(&sysdev_drivers_lock);
+	list_for_each_entry(drv, &sysdev_drivers, entry) {
 		if (drv->remove)
 			drv->remove(sysdev);
 	}
@@ -228,7 +229,7 @@
 		if (drv->remove)
 			drv->remove(sysdev);
 	}
-	up_write(&system_subsys.rwsem);
+	up(&sysdev_drivers_lock);
 
 	kobject_unregister(&sysdev->kobj);
 }
@@ -255,7 +256,7 @@
 
 	pr_debug("Shutting Down System Devices\n");
 
-	down_write(&system_subsys.rwsem);
+	down(&sysdev_drivers_lock);
 	list_for_each_entry_reverse(cls, &system_subsys.kset.list,
 				    kset.kobj.entry) {
 		struct sys_device * sysdev;
@@ -268,7 +269,7 @@
 			pr_debug(" %s\n", kobject_name(&sysdev->kobj));
 
 			/* Call global drivers first. */
-			list_for_each_entry(drv, &global_drivers, entry) {
+			list_for_each_entry(drv, &sysdev_drivers, entry) {
 				if (drv->shutdown)
 					drv->shutdown(sysdev);
 			}
@@ -284,7 +285,7 @@
 				cls->shutdown(sysdev);
 		}
 	}
-	up_write(&system_subsys.rwsem);
+	up(&sysdev_drivers_lock);
 }
 
 
@@ -319,7 +320,7 @@
 			pr_debug(" %s\n", kobject_name(&sysdev->kobj));
 
 			/* Call global drivers first. */
-			list_for_each_entry(drv, &global_drivers, entry) {
+			list_for_each_entry(drv, &sysdev_drivers, entry) {
 				if (drv->suspend)
 					drv->suspend(sysdev, state);
 			}
@@ -375,7 +376,7 @@
 			}
 
 			/* Call global drivers. */
-			list_for_each_entry(drv, &global_drivers, entry) {
+			list_for_each_entry(drv, &sysdev_drivers, entry) {
 				if (drv->resume)
 					drv->resume(sysdev);
 			}
diff -Nru a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
--- a/drivers/block/aoe/aoe.h	2005-01-14 11:21:17 -08:00
+++ b/drivers/block/aoe/aoe.h	2005-03-09 09:05:11 -08:00
@@ -143,7 +143,6 @@
 int aoechr_init(void);
 void aoechr_exit(void);
 void aoechr_error(char *);
-void aoechr_hdump(char *, int len);
 
 void aoecmd_work(struct aoedev *d);
 void aoecmd_cfg(ushort, unsigned char);
diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
--- a/drivers/block/aoe/aoeblk.c	2005-01-19 12:21:53 -08:00
+++ b/drivers/block/aoe/aoeblk.c	2005-03-04 22:32:50 -08:00
@@ -28,7 +28,8 @@
 {
 	struct aoedev *d = disk->private_data;
 
-	return snprintf(page, PAGE_SIZE, "%012llx\n", mac_addr(d->addr));
+	return snprintf(page, PAGE_SIZE, "%012llx\n",
+			(unsigned long long)mac_addr(d->addr));
 }
 static ssize_t aoedisk_show_netif(struct gendisk * disk, char *page)
 {
@@ -241,7 +242,8 @@
 	aoedisk_add_sysfs(d);
 	
 	printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu "
-		"sectors\n", mac_addr(d->addr), d->aoemajor, d->aoeminor,
+		"sectors\n", (unsigned long long)mac_addr(d->addr),
+		d->aoemajor, d->aoeminor,
 		d->fw_ver, (long long)d->ssize);
 }
 
diff -Nru a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c
--- a/drivers/block/aoe/aoechr.c	2005-01-14 11:21:11 -08:00
+++ b/drivers/block/aoe/aoechr.c	2005-03-09 09:05:11 -08:00
@@ -99,41 +99,6 @@
 		up(&emsgs_sema);
 }
 
-#define PERLINE 16
-void
-aoechr_hdump(char *buf, int n)
-{
-	int bufsiz;
-	char *fbuf;
-	int linelen;
-	char *p, *e, *fp;
-
-	bufsiz = n * 3;			/* 2 hex digits and a space */
-	bufsiz += n / PERLINE + 1;	/* the newline characters */
-	bufsiz += 1;			/* the final '\0' */
-
-	fbuf = kmalloc(bufsiz, GFP_ATOMIC);
-	if (!fbuf) {
-		printk(KERN_INFO
-		       "%s: cannot allocate memory\n",
-		       __FUNCTION__);
-		return;
-	}
-	
-	for (p = buf; n <= 0;) {
-		linelen = n > PERLINE ? PERLINE : n;
-		n -= linelen;
-
-		fp = fbuf;
-		for (e=p+linelen; p<e; p++)
-			fp += sprintf(fp, "%2.2X ", *p & 255);
-		sprintf(fp, "\n");
-		aoechr_error(fbuf);
-	}
-
-	kfree(fbuf);
-}
-
 static ssize_t
 aoechr_write(struct file *filp, const char __user *buf, size_t cnt, loff_t *offp)
 {
@@ -178,13 +143,13 @@
 static ssize_t
 aoechr_read(struct file *filp, char __user *buf, size_t cnt, loff_t *off)
 {
-	int n;
+	unsigned long n;
 	char *mp;
 	struct ErrMsg *em;
 	ssize_t len;
 	ulong flags;
 
-	n = (int) filp->private_data;
+	n = (unsigned long) filp->private_data;
 	switch (n) {
 	case MINOR_ERR:
 		spin_lock_irqsave(&emsgs_lock, flags);
@@ -233,7 +198,7 @@
 	}
 }
 
-struct file_operations aoe_fops = {
+static struct file_operations aoe_fops = {
 	.write = aoechr_write,
 	.read = aoechr_read,
 	.open = aoechr_open,
diff -Nru a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
--- a/drivers/block/aoe/aoecmd.c	2004-12-17 07:11:25 -08:00
+++ b/drivers/block/aoe/aoecmd.c	2005-03-09 09:05:19 -08:00
@@ -416,7 +416,9 @@
 
 	if (ahin->cmdstat & 0xa9) {	/* these bits cleared on success */
 		printk(KERN_CRIT "aoe: aoecmd_ata_rsp: ata error cmd=%2.2Xh "
-			"stat=%2.2Xh\n", ahout->cmdstat, ahin->cmdstat);
+			"stat=%2.2Xh from e%ld.%ld\n", 
+			ahout->cmdstat, ahin->cmdstat,
+			d->aoemajor, d->aoeminor);
 		if (buf)
 			buf->flags |= BUFFL_FAIL;
 	} else {
@@ -458,8 +460,8 @@
 	if (buf) {
 		buf->nframesout -= 1;
 		if (buf->nframesout == 0 && buf->resid == 0) {
-			n = !(buf->flags & BUFFL_FAIL);
-			bio_endio(buf->bio, buf->bio->bi_size, 0);
+			n = (buf->flags & BUFFL_FAIL) ? -EIO : 0;
+			bio_endio(buf->bio, buf->bio->bi_size, n);
 			mempool_free(buf, d->bufpool);
 		}
 	}
diff -Nru a/drivers/block/as-iosched.c b/drivers/block/as-iosched.c
--- a/drivers/block/as-iosched.c	2004-10-29 16:28:05 -07:00
+++ b/drivers/block/as-iosched.c	2005-03-09 00:07:15 -08:00
@@ -1463,35 +1463,36 @@
 	arq->state = AS_RQ_QUEUED;
 }
 
-/*
- * requeue the request. The request has not been completed, nor is it a
- * new request, so don't touch accounting.
- */
-static void as_requeue_request(request_queue_t *q, struct request *rq)
+static void as_deactivate_request(request_queue_t *q, struct request *rq)
 {
 	struct as_data *ad = q->elevator->elevator_data;
 	struct as_rq *arq = RQ_DATA(rq);
 
 	if (arq) {
-		if (arq->state != AS_RQ_REMOVED) {
-			printk("arq->state %d\n", arq->state);
-			WARN_ON(1);
+		if (arq->state == AS_RQ_REMOVED) {
+			arq->state = AS_RQ_DISPATCHED;
+			if (arq->io_context && arq->io_context->aic)
+				atomic_inc(&arq->io_context->aic->nr_dispatched);
 		}
-
-		arq->state = AS_RQ_DISPATCHED;
-		if (arq->io_context && arq->io_context->aic)
-			atomic_inc(&arq->io_context->aic->nr_dispatched);
 	} else
 		WARN_ON(blk_fs_request(rq)
 			&& (!(rq->flags & (REQ_HARDBARRIER|REQ_SOFTBARRIER))) );
 
-	list_add(&rq->queuelist, ad->dispatch);
-
 	/* Stop anticipating - let this request get through */
 	as_antic_stop(ad);
 }
 
 /*
+ * requeue the request. The request has not been completed, nor is it a
+ * new request, so don't touch accounting.
+ */
+static void as_requeue_request(request_queue_t *q, struct request *rq)
+{
+	as_deactivate_request(q, rq);
+	list_add(&rq->queuelist, &q->queue_head);
+}
+
+/*
  * Account a request that is inserted directly onto the dispatch queue.
  * arq->io_context->aic->nr_dispatched should not need to be incremented
  * because only new requests should come through here: requeues go through
@@ -2080,6 +2081,7 @@
 		.elevator_add_req_fn =		as_insert_request,
 		.elevator_remove_req_fn =	as_remove_request,
 		.elevator_requeue_req_fn = 	as_requeue_request,
+		.elevator_deactivate_req_fn = 	as_deactivate_request,
 		.elevator_queue_empty_fn =	as_queue_empty,
 		.elevator_completed_req_fn =	as_completed_request,
 		.elevator_former_req_fn =	as_former_request,
diff -Nru a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c
--- a/drivers/block/cfq-iosched.c	2005-02-26 05:18:00 -08:00
+++ b/drivers/block/cfq-iosched.c	2005-03-09 00:05:54 -08:00
@@ -607,10 +607,7 @@
 	return NULL;
 }
 
-/*
- * make sure the service time gets corrected on reissue of this request
- */
-static void cfq_requeue_request(request_queue_t *q, struct request *rq)
+static void cfq_deactivate_request(request_queue_t *q, struct request *rq)
 {
 	struct cfq_rq *crq = RQ_DATA(rq);
 
@@ -627,6 +624,14 @@
 			cfqq->cfqd->rq_in_driver--;
 		}
 	}
+}
+
+/*
+ * make sure the service time gets corrected on reissue of this request
+ */
+static void cfq_requeue_request(request_queue_t *q, struct request *rq)
+{
+	cfq_deactivate_request(q, rq);
 	list_add(&rq->queuelist, &q->queue_head);
 }
 
@@ -1804,6 +1809,7 @@
 		.elevator_add_req_fn =		cfq_insert_request,
 		.elevator_remove_req_fn =	cfq_remove_request,
 		.elevator_requeue_req_fn =	cfq_requeue_request,
+		.elevator_deactivate_req_fn =	cfq_deactivate_request,
 		.elevator_queue_empty_fn =	cfq_queue_empty,
 		.elevator_completed_req_fn =	cfq_completed_request,
 		.elevator_former_req_fn =	cfq_former_request,
diff -Nru a/drivers/block/elevator.c b/drivers/block/elevator.c
--- a/drivers/block/elevator.c	2005-01-20 21:02:10 -08:00
+++ b/drivers/block/elevator.c	2005-03-09 00:08:14 -08:00
@@ -255,8 +255,16 @@
 		e->ops->elevator_merge_req_fn(q, rq, next);
 }
 
-void elv_requeue_request(request_queue_t *q, struct request *rq)
+/*
+ * For careful internal use by the block layer. Essentially the same as
+ * a requeue in that it tells the io scheduler that this request is not
+ * active in the driver or hardware anymore, but we don't want the request
+ * added back to the scheduler. Function is not exported.
+ */
+void elv_deactivate_request(request_queue_t *q, struct request *rq)
 {
+	elevator_t *e = q->elevator;
+
 	/*
 	 * it already went through dequeue, we need to decrement the
 	 * in_flight count again
@@ -264,6 +272,24 @@
 	if (blk_account_rq(rq))
 		q->in_flight--;
 
+	rq->flags &= ~REQ_STARTED;
+
+	if (e->ops->elevator_deactivate_req_fn)
+		e->ops->elevator_deactivate_req_fn(q, rq);
+}
+
+void elv_requeue_request(request_queue_t *q, struct request *rq)
+{
+	elv_deactivate_request(q, rq);
+
+	/*
+	 * if this is the flush, requeue the original instead and drop the flush
+	 */
+	if (rq->flags & REQ_BAR_FLUSH) {
+		clear_bit(QUEUE_FLAG_FLUSH, &q->queue_flags);
+		rq = rq->end_io_data;
+	}
+
 	/*
 	 * if iosched has an explicit requeue hook, then use that. otherwise
 	 * just put the request at the front of the queue
@@ -320,7 +346,21 @@
 
 static inline struct request *__elv_next_request(request_queue_t *q)
 {
-	return q->elevator->ops->elevator_next_req_fn(q);
+	struct request *rq = q->elevator->ops->elevator_next_req_fn(q);
+
+	/*
+	 * if this is a barrier write and the device has to issue a
+	 * flush sequence to support it, check how far we are
+	 */
+	if (rq && blk_fs_request(rq) && blk_barrier_rq(rq)) {
+		BUG_ON(q->ordered == QUEUE_ORDERED_NONE);
+
+		if (q->ordered == QUEUE_ORDERED_FLUSH &&
+		    !blk_barrier_preflush(rq))
+			rq = blk_start_pre_flush(q, rq);
+	}
+
+	return rq;
 }
 
 struct request *elv_next_request(request_queue_t *q)
diff -Nru a/drivers/block/floppy.c b/drivers/block/floppy.c
--- a/drivers/block/floppy.c	2005-01-20 21:02:10 -08:00
+++ b/drivers/block/floppy.c	2005-03-09 09:04:13 -08:00
@@ -4370,6 +4370,10 @@
 		goto out_flush_work;
 	}
 
+	err = platform_device_register(&floppy_device);
+	if (err)
+		goto out_flush_work;
+
 	for (drive = 0; drive < N_DRIVE; drive++) {
 		if (!(allowed_drive_mask & (1 << drive)))
 			continue;
@@ -4379,23 +4383,12 @@
 		disks[drive]->private_data = (void *)(long)drive;
 		disks[drive]->queue = floppy_queue;
 		disks[drive]->flags |= GENHD_FL_REMOVABLE;
+		disks[drive]->driverfs_dev = &floppy_device.dev;
 		add_disk(disks[drive]);
 	}
 
-	err = platform_device_register(&floppy_device);
-	if (err)
-		goto out_del_disk;
-
 	return 0;
 
-out_del_disk:
-	for (drive = 0; drive < N_DRIVE; drive++) {
-		if (!(allowed_drive_mask & (1 << drive)))
-			continue;
-		if (fdc_state[FDC(drive)].version == FDC_NONE)
-			continue;
-		del_gendisk(disks[drive]);
-	}
 out_flush_work:
 	flush_scheduled_work();
 	if (usage_count)
@@ -4600,7 +4593,6 @@
 	int drive;
 
 	init_completion(&device_release);
-	platform_device_unregister(&floppy_device);
 	blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
 	unregister_blkdev(FLOPPY_MAJOR, "fd");
 
@@ -4614,6 +4606,7 @@
 		}
 		put_disk(disks[drive]);
 	}
+	platform_device_unregister(&floppy_device);
 	devfs_remove("floppy");
 
 	del_timer_sync(&fd_timeout);
diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c
--- a/drivers/block/genhd.c	2005-03-01 00:14:58 -08:00
+++ b/drivers/block/genhd.c	2005-03-09 09:03:28 -08:00
@@ -302,7 +302,7 @@
 
 static int __init genhd_device_init(void)
 {
-	bdev_map = kobj_map_init(base_probe, &block_subsys);
+	bdev_map = kobj_map_init(base_probe, &block_subsys_sem);
 	blk_dev_init();
 	subsystem_register(&block_subsys);
 	return 0;
@@ -430,42 +430,57 @@
 static int block_hotplug(struct kset *kset, struct kobject *kobj, char **envp,
 			 int num_envp, char *buffer, int buffer_size)
 {
-	struct device *dev = NULL;
 	struct kobj_type *ktype = get_ktype(kobj);
+	struct device *physdev;
+	struct gendisk *disk;
+	struct hd_struct *part;
 	int length = 0;
 	int i = 0;
 
-	/* get physical device backing disk or partition */
 	if (ktype == &ktype_block) {
-		struct gendisk *disk = container_of(kobj, struct gendisk, kobj);
-		dev = disk->driverfs_dev;
+		disk = container_of(kobj, struct gendisk, kobj);
+		add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size,
+				    &length, "MINOR=%u", disk->first_minor);
 	} else if (ktype == &ktype_part) {
-		struct gendisk *disk = container_of(kobj->parent, struct gendisk, kobj);
-		dev = disk->driverfs_dev;
-	}
-
-	if (dev) {
-		/* add physical device, backing this device  */
-		char *path = kobject_get_path(&dev->kobj, GFP_KERNEL);
+		disk = container_of(kobj->parent, struct gendisk, kobj);
+		part = container_of(kobj, struct hd_struct, kobj);
+		add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size,
+				    &length, "MINOR=%u",
+				    disk->first_minor + part->partno);
+	} else
+		return 0;
+
+	add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &length,
+			    "MAJOR=%u", disk->major);
+
+	/* add physical device, backing this device  */
+	physdev = disk->driverfs_dev;
+	if (physdev) {
+		char *path = kobject_get_path(&physdev->kobj, GFP_KERNEL);
 
 		add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size,
 				    &length, "PHYSDEVPATH=%s", path);
 		kfree(path);
 
-		/* add bus name of physical device */
-		if (dev->bus)
+		if (physdev->bus)
 			add_hotplug_env_var(envp, num_envp, &i,
 					    buffer, buffer_size, &length,
-					    "PHYSDEVBUS=%s", dev->bus->name);
+					    "PHYSDEVBUS=%s",
+					    physdev->bus->name);
 
-		/* add driver name of physical device */
-		if (dev->driver)
+		if (physdev->driver)
 			add_hotplug_env_var(envp, num_envp, &i,
 					    buffer, buffer_size, &length,
-					    "PHYSDEVDRIVER=%s", dev->driver->name);
-
-		envp[i] = NULL;
+					    "PHYSDEVDRIVER=%s",
+					    physdev->driver->name);
 	}
+
+	/* terminate, set to next free slot, shrink available space */
+	envp[i] = NULL;
+	envp = &envp[i];
+	num_envp -= i;
+	buffer = &buffer[length];
+	buffer_size -= length;
 
 	return 0;
 }
diff -Nru a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c
--- a/drivers/block/ll_rw_blk.c	2005-01-13 01:17:36 -08:00
+++ b/drivers/block/ll_rw_blk.c	2005-03-09 00:01:38 -08:00
@@ -267,6 +267,25 @@
 
 EXPORT_SYMBOL(blk_queue_make_request);
 
+static inline void rq_init(request_queue_t *q, struct request *rq)
+{
+	INIT_LIST_HEAD(&rq->queuelist);
+
+	rq->errors = 0;
+	rq->rq_status = RQ_ACTIVE;
+	rq->bio = rq->biotail = NULL;
+	rq->buffer = NULL;
+	rq->ref_count = 1;
+	rq->q = q;
+	rq->waiting = NULL;
+	rq->special = NULL;
+	rq->data_len = 0;
+	rq->data = NULL;
+	rq->sense = NULL;
+	rq->end_io = NULL;
+	rq->end_io_data = NULL;
+}
+
 /**
  * blk_queue_ordered - does this queue support ordered writes
  * @q:     the request queue
@@ -281,10 +300,26 @@
  **/
 void blk_queue_ordered(request_queue_t *q, int flag)
 {
-	if (flag)
-		set_bit(QUEUE_FLAG_ORDERED, &q->queue_flags);
-	else
-		clear_bit(QUEUE_FLAG_ORDERED, &q->queue_flags);
+	switch (flag) {
+		case QUEUE_ORDERED_NONE:
+			if (q->flush_rq)
+				kmem_cache_free(request_cachep, q->flush_rq);
+			q->flush_rq = NULL;
+			q->ordered = flag;
+			break;
+		case QUEUE_ORDERED_TAG:
+			q->ordered = flag;
+			break;
+		case QUEUE_ORDERED_FLUSH:
+			q->ordered = flag;
+			if (!q->flush_rq)
+				q->flush_rq = kmem_cache_alloc(request_cachep,
+								GFP_KERNEL);
+			break;
+		default:
+			printk("blk_queue_ordered: bad value %d\n", flag);
+			break;
+	}
 }
 
 EXPORT_SYMBOL(blk_queue_ordered);
@@ -306,6 +341,169 @@
 
 EXPORT_SYMBOL(blk_queue_issue_flush_fn);
 
+/*
+ * Cache flushing for ordered writes handling
+ */
+static void blk_pre_flush_end_io(struct request *flush_rq)
+{
+	struct request *rq = flush_rq->end_io_data;
+	request_queue_t *q = rq->q;
+
+	rq->flags |= REQ_BAR_PREFLUSH;
+
+	if (!flush_rq->errors)
+		elv_requeue_request(q, rq);
+	else {
+		q->end_flush_fn(q, flush_rq);
+		clear_bit(QUEUE_FLAG_FLUSH, &q->queue_flags);
+		q->request_fn(q);
+	}
+}
+
+static void blk_post_flush_end_io(struct request *flush_rq)
+{
+	struct request *rq = flush_rq->end_io_data;
+	request_queue_t *q = rq->q;
+
+	rq->flags |= REQ_BAR_POSTFLUSH;
+
+	q->end_flush_fn(q, flush_rq);
+	clear_bit(QUEUE_FLAG_FLUSH, &q->queue_flags);
+	q->request_fn(q);
+}
+
+struct request *blk_start_pre_flush(request_queue_t *q, struct request *rq)
+{
+	struct request *flush_rq = q->flush_rq;
+
+	BUG_ON(!blk_barrier_rq(rq));
+
+	if (test_and_set_bit(QUEUE_FLAG_FLUSH, &q->queue_flags))
+		return NULL;
+
+	rq_init(q, flush_rq);
+	flush_rq->elevator_private = NULL;
+	flush_rq->flags = REQ_BAR_FLUSH;
+	flush_rq->rq_disk = rq->rq_disk;
+	flush_rq->rl = NULL;
+
+	/*
+	 * prepare_flush returns 0 if no flush is needed, just mark both
+	 * pre and post flush as done in that case
+	 */
+	if (!q->prepare_flush_fn(q, flush_rq)) {
+		rq->flags |= REQ_BAR_PREFLUSH | REQ_BAR_POSTFLUSH;
+		clear_bit(QUEUE_FLAG_FLUSH, &q->queue_flags);
+		return rq;
+	}
+
+	/*
+	 * some drivers dequeue requests right away, some only after io
+	 * completion. make sure the request is dequeued.
+	 */
+	if (!list_empty(&rq->queuelist))
+		blkdev_dequeue_request(rq);
+
+	elv_deactivate_request(q, rq);
+
+	flush_rq->end_io_data = rq;
+	flush_rq->end_io = blk_pre_flush_end_io;
+
+	__elv_add_request(q, flush_rq, ELEVATOR_INSERT_FRONT, 0);
+	return flush_rq;
+}
+
+static void blk_start_post_flush(request_queue_t *q, struct request *rq)
+{
+	struct request *flush_rq = q->flush_rq;
+
+	BUG_ON(!blk_barrier_rq(rq));
+
+	rq_init(q, flush_rq);
+	flush_rq->elevator_private = NULL;
+	flush_rq->flags = REQ_BAR_FLUSH;
+	flush_rq->rq_disk = rq->rq_disk;
+	flush_rq->rl = NULL;
+
+	if (q->prepare_flush_fn(q, flush_rq)) {
+		flush_rq->end_io_data = rq;
+		flush_rq->end_io = blk_post_flush_end_io;
+
+		__elv_add_request(q, flush_rq, ELEVATOR_INSERT_FRONT, 0);
+		q->request_fn(q);
+	}
+}
+
+static inline int blk_check_end_barrier(request_queue_t *q, struct request *rq,
+					int sectors)
+{
+	if (sectors > rq->nr_sectors)
+		sectors = rq->nr_sectors;
+
+	rq->nr_sectors -= sectors;
+	return rq->nr_sectors;
+}
+
+static int __blk_complete_barrier_rq(request_queue_t *q, struct request *rq,
+				     int sectors, int queue_locked)
+{
+	if (q->ordered != QUEUE_ORDERED_FLUSH)
+		return 0;
+	if (!blk_fs_request(rq) || !blk_barrier_rq(rq))
+		return 0;
+	if (blk_barrier_postflush(rq))
+		return 0;
+
+	if (!blk_check_end_barrier(q, rq, sectors)) {
+		unsigned long flags = 0;
+
+		if (!queue_locked)
+			spin_lock_irqsave(q->queue_lock, flags);
+
+		blk_start_post_flush(q, rq);
+
+		if (!queue_locked)
+			spin_unlock_irqrestore(q->queue_lock, flags);
+	}
+
+	return 1;
+}
+
+/**
+ * blk_complete_barrier_rq - complete possible barrier request
+ * @q:  the request queue for the device
+ * @rq:  the request
+ * @sectors:  number of sectors to complete
+ *
+ * Description:
+ *   Used in driver end_io handling to determine whether to postpone
+ *   completion of a barrier request until a post flush has been done. This
+ *   is the unlocked variant, used if the caller doesn't already hold the
+ *   queue lock.
+ **/
+int blk_complete_barrier_rq(request_queue_t *q, struct request *rq, int sectors)
+{
+	return __blk_complete_barrier_rq(q, rq, sectors, 0);
+}
+EXPORT_SYMBOL(blk_complete_barrier_rq);
+
+/**
+ * blk_complete_barrier_rq_locked - complete possible barrier request
+ * @q:  the request queue for the device
+ * @rq:  the request
+ * @sectors:  number of sectors to complete
+ *
+ * Description:
+ *   See blk_complete_barrier_rq(). This variant must be used if the caller
+ *   holds the queue lock.
+ **/
+int blk_complete_barrier_rq_locked(request_queue_t *q, struct request *rq,
+				   int sectors)
+{
+	return __blk_complete_barrier_rq(q, rq, sectors, 1);
+}
+EXPORT_SYMBOL(blk_complete_barrier_rq_locked);
+
 /**
  * blk_queue_bounce_limit - set bounce buffer limit for queue
  * @q:  the request queue for the device
@@ -1428,6 +1626,8 @@
 	if (q->queue_tags)
 		__blk_queue_free_tags(q);
 
+	blk_queue_ordered(q, QUEUE_ORDERED_NONE);
+
 	kmem_cache_free(requestq_cachep, q);
 }
 
@@ -1739,21 +1939,8 @@
 	if (ioc_batching(q, ioc))
 		ioc->nr_batch_requests--;
 	
-	INIT_LIST_HEAD(&rq->queuelist);
-
-	rq->errors = 0;
-	rq->rq_status = RQ_ACTIVE;
-	rq->bio = rq->biotail = NULL;
-	rq->buffer = NULL;
-	rq->ref_count = 1;
-	rq->q = q;
+	rq_init(q, rq);
 	rq->rl = rl;
-	rq->waiting = NULL;
-	rq->special = NULL;
-	rq->data_len = 0;
-	rq->data = NULL;
-	rq->sense = NULL;
-
 out:
 	put_io_context(ioc);
 	return rq;
@@ -2018,11 +2205,11 @@
 	}
 
 	rq->flags |= REQ_NOMERGE;
-	if (!rq->waiting)
-		rq->waiting = &wait;
+	rq->waiting = &wait;
+	rq->end_io = blk_end_sync_rq;
 	elv_add_request(q, rq, ELEVATOR_INSERT_BACK, 1);
 	generic_unplug_device(q);
-	wait_for_completion(rq->waiting);
+	wait_for_completion(&wait);
 	rq->waiting = NULL;
 
 	if (rq->errors)
@@ -2171,7 +2358,7 @@
 /*
  * queue lock must be held
  */
-void __blk_put_request(request_queue_t *q, struct request *req)
+static void __blk_put_request(request_queue_t *q, struct request *req)
 {
 	struct request_list *rl = req->rl;
 
@@ -2219,6 +2406,25 @@
 EXPORT_SYMBOL(blk_put_request);
 
 /**
+ * blk_end_sync_rq - executes a completion event on a request
+ * @rq: request to complete
+ */
+void blk_end_sync_rq(struct request *rq)
+{
+	struct completion *waiting = rq->waiting;
+
+	rq->waiting = NULL;
+	__blk_put_request(rq->q, rq);
+
+	/*
+	 * complete last, if this is a stack request the process (and thus
+	 * the rq pointer) could be invalid right after this complete()
+	 */
+	complete(waiting);
+}
+EXPORT_SYMBOL(blk_end_sync_rq);
+
+/**
  * blk_congestion_wait - wait for a queue to become uncongested
  * @rw: READ or WRITE
  * @timeout: timeout in jiffies
@@ -2371,7 +2577,7 @@
 	spin_lock_prefetch(q->queue_lock);
 
 	barrier = bio_barrier(bio);
-	if (barrier && !(q->queue_flags & (1 << QUEUE_FLAG_ORDERED))) {
+	if (barrier && (q->ordered == QUEUE_ORDERED_NONE)) {
 		err = -EOPNOTSUPP;
 		goto end_io;
 	}
@@ -2978,7 +3184,6 @@
 void end_that_request_last(struct request *req)
 {
 	struct gendisk *disk = req->rq_disk;
-	struct completion *waiting = req->waiting;
 
 	if (unlikely(laptop_mode) && blk_fs_request(req))
 		laptop_io_completion();
@@ -2998,10 +3203,10 @@
 		disk_round_stats(disk);
 		disk->in_flight--;
 	}
-	__blk_put_request(req->q, req);
-	/* Do this LAST! The structure may be freed immediately afterwards */
-	if (waiting)
-		complete(waiting);
+	if (req->end_io)
+		req->end_io(req);
+	else
+		__blk_put_request(req->q, req);
 }
 
 EXPORT_SYMBOL(end_that_request_last);
diff -Nru a/drivers/block/loop.c b/drivers/block/loop.c
--- a/drivers/block/loop.c	2005-01-04 18:48:17 -08:00
+++ b/drivers/block/loop.c	2005-03-07 20:41:40 -08:00
@@ -39,6 +39,11 @@
  * Support up to 256 loop devices
  * Heinz Mauelshagen <mge@sistina.com>, Feb 2002
  *
+ * Support for falling back on the write file operation when the address space
+ * operations prepare_write and/or commit_write are not available on the
+ * backing filesystem.
+ * Anton Altaparmakov, 16 Feb 2005
+ *
  * Still To Fix:
  * - Advisory locking is ignored here.
  * - Should use an own CAP_* category instead of CAP_SYS_ADMIN
@@ -67,6 +72,8 @@
 #include <linux/writeback.h>
 #include <linux/buffer_head.h>		/* for invalidate_bdev() */
 #include <linux/completion.h>
+#include <linux/highmem.h>
+#include <linux/gfp.h>
 
 #include <asm/uaccess.h>
 
@@ -127,7 +134,7 @@
 
 static int xor_init(struct loop_device *lo, const struct loop_info64 *info)
 {
-	if (info->lo_encrypt_key_size <= 0)
+	if (unlikely(info->lo_encrypt_key_size <= 0))
 		return -EINVAL;
 	return 0;
 }
@@ -173,7 +180,7 @@
 	loff_t size = get_loop_size(lo, lo->lo_backing_file);
 	sector_t x = (sector_t)size;
 
-	if ((loff_t)x != size)
+	if (unlikely((loff_t)x != size))
 		return -EFBIG;
 
 	set_capacity(disks[lo->lo_number], x);
@@ -186,23 +193,27 @@
 	       struct page *lpage, unsigned loffs,
 	       int size, sector_t rblock)
 {
-	if (!lo->transfer)
+	if (unlikely(!lo->transfer))
 		return 0;
 
 	return lo->transfer(lo, cmd, rpage, roffs, lpage, loffs, size, rblock);
 }
 
-static int
-do_lo_send(struct loop_device *lo, struct bio_vec *bvec, int bsize, loff_t pos)
+/**
+ * do_lo_send_aops - helper for writing data to a loop device
+ *
+ * This is the fast version for backing filesystems which implement the address
+ * space operations prepare_write and commit_write.
+ */
+static int do_lo_send_aops(struct loop_device *lo, struct bio_vec *bvec,
+		int bsize, loff_t pos, struct page *page)
 {
 	struct file *file = lo->lo_backing_file; /* kudos to NFsckingS */
 	struct address_space *mapping = file->f_mapping;
 	struct address_space_operations *aops = mapping->a_ops;
-	struct page *page;
 	pgoff_t index;
-	unsigned size, offset, bv_offs;
-	int len;
-	int ret = 0;
+	unsigned offset, bv_offs;
+	int len, ret = 0;
 
 	down(&mapping->host->i_sem);
 	index = pos >> PAGE_CACHE_SHIFT;
@@ -211,23 +222,22 @@
 	len = bvec->bv_len;
 	while (len > 0) {
 		sector_t IV;
+		unsigned size;
 		int transfer_result;
 
 		IV = ((sector_t)index << (PAGE_CACHE_SHIFT - 9))+(offset >> 9);
-
 		size = PAGE_CACHE_SIZE - offset;
 		if (size > len)
 			size = len;
-
 		page = grab_cache_page(mapping, index);
-		if (!page)
+		if (unlikely(!page))
 			goto fail;
-		if (aops->prepare_write(file, page, offset, offset+size))
+		if (unlikely(aops->prepare_write(file, page, offset,
+				offset + size)))
 			goto unlock;
 		transfer_result = lo_do_transfer(lo, WRITE, page, offset,
-						 bvec->bv_page, bv_offs,
-						 size, IV);
-		if (transfer_result) {
+				bvec->bv_page, bv_offs, size, IV);
+		if (unlikely(transfer_result)) {
 			char *kaddr;
 
 			/*
@@ -241,9 +251,10 @@
 			kunmap_atomic(kaddr, KM_USER0);
 		}
 		flush_dcache_page(page);
-		if (aops->commit_write(file, page, offset, offset+size))
+		if (unlikely(aops->commit_write(file, page, offset,
+				offset + size)))
 			goto unlock;
-		if (transfer_result)
+		if (unlikely(transfer_result))
 			goto unlock;
 		bv_offs += size;
 		len -= size;
@@ -253,32 +264,125 @@
 		unlock_page(page);
 		page_cache_release(page);
 	}
-	up(&mapping->host->i_sem);
 out:
+	up(&mapping->host->i_sem);
 	return ret;
-
 unlock:
 	unlock_page(page);
 	page_cache_release(page);
 fail:
-	up(&mapping->host->i_sem);
 	ret = -1;
 	goto out;
 }
 
-static int
-lo_send(struct loop_device *lo, struct bio *bio, int bsize, loff_t pos)
+/**
+ * __do_lo_send_write - helper for writing data to a loop device
+ *
+ * This helper just factors out common code between do_lo_send_direct_write()
+ * and do_lo_send_write().
+ */
+static inline int __do_lo_send_write(struct file *file,
+		u8 __user *buf, const int len, loff_t pos)
 {
+	ssize_t bw;
+	mm_segment_t old_fs = get_fs();
+
+	set_fs(get_ds());
+	bw = file->f_op->write(file, buf, len, &pos);
+	set_fs(old_fs);
+	if (likely(bw == len))
+		return 0;
+	printk(KERN_ERR "loop: Write error at byte offset %llu, length %i.\n",
+			(unsigned long long)pos, len);
+	if (bw >= 0)
+		bw = -EIO;
+	return bw;
+}
+
+/**
+ * do_lo_send_direct_write - helper for writing data to a loop device
+ *
+ * This is the fast, non-transforming version for backing filesystems which do
+ * not implement the address space operations prepare_write and commit_write.
+ * It uses the write file operation which should be present on all writeable
+ * filesystems.
+ */
+static int do_lo_send_direct_write(struct loop_device *lo,
+		struct bio_vec *bvec, int bsize, loff_t pos, struct page *page)
+{
+	ssize_t bw = __do_lo_send_write(lo->lo_backing_file,
+			(u8 __user *)kmap(bvec->bv_page) + bvec->bv_offset,
+			bvec->bv_len, pos);
+	kunmap(bvec->bv_page);
+	cond_resched();
+	return bw;
+}
+
+/**
+ * do_lo_send_write - helper for writing data to a loop device
+ *
+ * This is the slow, transforming version for filesystems which do not
+ * implement the address space operations prepare_write and commit_write.  It
+ * uses the write file operation which should be present on all writeable
+ * filesystems.
+ *
+ * Using fops->write is slower than using aops->{prepare,commit}_write in the
+ * transforming case because we need to double buffer the data as we cannot do
+ * the transformations in place as we do not have direct access to the
+ * destination pages of the backing file.
+ */
+static int do_lo_send_write(struct loop_device *lo, struct bio_vec *bvec,
+		int bsize, loff_t pos, struct page *page)
+{
+	int ret = lo_do_transfer(lo, WRITE, page, 0, bvec->bv_page,
+			bvec->bv_offset, bvec->bv_len, pos >> 9);
+	if (likely(!ret))
+		return __do_lo_send_write(lo->lo_backing_file,
+				(u8 __user *)page_address(page), bvec->bv_len,
+				pos);
+	printk(KERN_ERR "loop: Transfer error at byte offset %llu, "
+			"length %i.\n", (unsigned long long)pos, bvec->bv_len);
+	if (ret > 0)
+		ret = -EIO;
+	return ret;
+}
+
+static int lo_send(struct loop_device *lo, struct bio *bio, int bsize,
+		loff_t pos)
+{
+	int (*do_lo_send)(struct loop_device *, struct bio_vec *, int, loff_t,
+			struct page *page);
 	struct bio_vec *bvec;
+	struct page *page = NULL;
 	int i, ret = 0;
 
+	do_lo_send = do_lo_send_aops;
+	if (!(lo->lo_flags & LO_FLAGS_USE_AOPS)) {
+		do_lo_send = do_lo_send_direct_write;
+		if (lo->transfer != transfer_none) {
+			page = alloc_page(GFP_NOIO | __GFP_HIGHMEM);
+			if (unlikely(!page))
+				goto fail;
+			kmap(page);
+			do_lo_send = do_lo_send_write;
+		}
+	}
 	bio_for_each_segment(bvec, bio, i) {
-		ret = do_lo_send(lo, bvec, bsize, pos);
+		ret = do_lo_send(lo, bvec, bsize, pos, page);
 		if (ret < 0)
 			break;
 		pos += bvec->bv_len;
 	}
+	if (page) {
+		kunmap(page);
+		__free_page(page);
+	}
+out:
 	return ret;
+fail:
+	printk(KERN_ERR "loop: Failed to allocate temporary page for write.\n");
+	ret = -ENOMEM;
+	goto out;
 }
 
 struct lo_read_data {
@@ -584,7 +688,7 @@
 
 	/* the loop device has to be read-only */
 	error = -EINVAL;
-	if (lo->lo_flags != LO_FLAGS_READ_ONLY)
+	if (!(lo->lo_flags & LO_FLAGS_READ_ONLY))
 		goto out;
 
 	error = -EBADF;
@@ -683,8 +787,9 @@
 		 */
 		if (!file->f_op->sendfile)
 			goto out_putf;
-
-		if (!aops->prepare_write || !aops->commit_write)
+		if (aops->prepare_write && aops->commit_write)
+			lo_flags |= LO_FLAGS_USE_AOPS;
+		if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write)
 			lo_flags |= LO_FLAGS_READ_ONLY;
 
 		lo_blocksize = inode->i_blksize;
diff -Nru a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c
--- a/drivers/block/paride/pd.c	2005-01-20 21:02:10 -08:00
+++ b/drivers/block/paride/pd.c	2005-03-07 20:41:36 -08:00
@@ -743,6 +743,7 @@
 	rq.rq_disk = disk->gd;
 	rq.ref_count = 1;
 	rq.waiting = &wait;
+	rq.end_io = blk_end_sync_rq;
 	blk_insert_request(disk->gd->queue, &rq, 0, func, 0);
 	wait_for_completion(&wait);
 	rq.waiting = NULL;
diff -Nru a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
--- a/drivers/block/pktcdvd.c	2005-01-10 17:29:37 -08:00
+++ b/drivers/block/pktcdvd.c	2005-03-07 20:41:36 -08:00
@@ -375,6 +375,7 @@
 	rq->ref_count++;
 	rq->flags |= REQ_NOMERGE;
 	rq->waiting = &wait;
+	rq->end_io = blk_end_sync_rq;
 	elv_add_request(q, rq, ELEVATOR_INSERT_BACK, 1);
 	generic_unplug_device(q);
 	wait_for_completion(&wait);
diff -Nru a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c
--- a/drivers/bluetooth/bfusb.c	2005-01-10 21:04:03 -08:00
+++ b/drivers/bluetooth/bfusb.c	2005-03-07 20:45:20 -08:00
@@ -63,7 +63,7 @@
 
 #define BFUSB_MAX_BLOCK_SIZE	256
 
-#define BFUSB_BLOCK_TIMEOUT	(HZ * 3)
+#define BFUSB_BLOCK_TIMEOUT	3000
 
 #define BFUSB_TX_PROCESS	1
 #define BFUSB_TX_WAKEUP		2
@@ -582,7 +582,7 @@
 	pipe = usb_sndctrlpipe(bfusb->udev, 0);
 
 	if (usb_control_msg(bfusb->udev, pipe, USB_REQ_SET_CONFIGURATION,
-				0, 1, 0, NULL, 0, HZ * USB_CTRL_SET_TIMEOUT) < 0) {
+				0, 1, 0, NULL, 0, USB_CTRL_SET_TIMEOUT) < 0) {
 		BT_ERR("Can't change to loading configuration");
 		return -EBUSY;
 	}
@@ -623,7 +623,7 @@
 	pipe = usb_sndctrlpipe(bfusb->udev, 0);
 
         if ((err = usb_control_msg(bfusb->udev, pipe, USB_REQ_SET_CONFIGURATION,
-				0, 2, 0, NULL, 0, HZ * USB_CTRL_SET_TIMEOUT)) < 0) {
+				0, 2, 0, NULL, 0, USB_CTRL_SET_TIMEOUT)) < 0) {
 		BT_ERR("Can't change to running configuration");
 		goto error;
 	}
@@ -641,7 +641,7 @@
 	pipe = usb_sndctrlpipe(bfusb->udev, 0);
 
 	usb_control_msg(bfusb->udev, pipe, USB_REQ_SET_CONFIGURATION,
-				0, 0, 0, NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
+				0, 0, 0, NULL, 0, USB_CTRL_SET_TIMEOUT);
 
 	return err;
 }
diff -Nru a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c
--- a/drivers/bluetooth/bluecard_cs.c	2005-01-15 14:31:03 -08:00
+++ b/drivers/bluetooth/bluecard_cs.c	2005-03-05 04:30:19 -08:00
@@ -35,6 +35,7 @@
 #include <linux/ioport.h>
 #include <linux/spinlock.h>
 #include <linux/moduleparam.h>
+#include <linux/wait.h>
 
 #include <linux/skbuff.h>
 #include <asm/io.h>
@@ -289,8 +290,9 @@
 		clear_bit(ready_bit, &(info->tx_state));
 
 		if (skb->pkt_type & 0x80) {
+			DECLARE_WAIT_QUEUE_HEAD(wq);
+			DEFINE_WAIT(wait);
 
-			wait_queue_head_t wait;
 			unsigned char baud_reg;
 
 			switch (skb->pkt_type) {
@@ -311,8 +313,9 @@
 			}
 
 			/* Wait until the command reaches the baseband */
-			init_waitqueue_head(&wait);
-			interruptible_sleep_on_timeout(&wait, HZ / 10);
+			prepare_to_wait(&wq, &wait, TASK_INTERRUPTIBLE);
+			schedule_timeout(HZ/10);
+			finish_wait(&wq, &wait);
 
 			/* Set baud on baseband */
 			info->ctrl_reg &= ~0x03;
@@ -324,8 +327,9 @@
 			outb(info->ctrl_reg, iobase + REG_CONTROL);
 
 			/* Wait before the next HCI packet can be send */
-			interruptible_sleep_on_timeout(&wait, HZ);
-
+			prepare_to_wait(&wq, &wait, TASK_INTERRUPTIBLE);
+			schedule_timeout(HZ);
+			finish_wait(&wq, &wait);
 		}
 
 		if (len == skb->len) {
diff -Nru a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
--- a/drivers/bluetooth/hci_usb.c	2005-02-18 14:22:20 -08:00
+++ b/drivers/bluetooth/hci_usb.c	2005-03-05 04:27:09 -08:00
@@ -888,7 +888,7 @@
 	isoc_ifnum = 1;
 
 #ifdef CONFIG_BT_HCIUSB_SCO
-	if (isoc && !(id->driver_info & HCI_BROKEN_ISOC))
+	if (isoc && !(id->driver_info & (HCI_BROKEN_ISOC | HCI_SNIFFER)))
 		isoc_iface = usb_ifnum_to_if(udev, isoc_ifnum);
 
 	if (isoc_iface) {
diff -Nru a/drivers/char/Kconfig b/drivers/char/Kconfig
--- a/drivers/char/Kconfig	2005-01-30 22:33:40 -08:00
+++ b/drivers/char/Kconfig	2005-03-09 09:05:39 -08:00
@@ -839,6 +839,10 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called sonypi.
 
+config TANBAC_TB0219
+	tristate "TANBAC TB0219 base board support"
+	depends TANBAC_TB0229
+
 
 menu "Ftape, the floppy tape device driver"
 
@@ -990,6 +994,8 @@
 	help
 	  The mmtimer device allows direct userspace access to the
 	  Altix system timer.
+
+source "drivers/char/tpm/Kconfig"
 
 endmenu
 
diff -Nru a/drivers/char/Makefile b/drivers/char/Makefile
--- a/drivers/char/Makefile	2005-01-30 22:33:40 -08:00
+++ b/drivers/char/Makefile	2005-03-09 09:05:39 -08:00
@@ -73,13 +73,13 @@
 obj-$(CONFIG_I8K) += i8k.o
 obj-$(CONFIG_DS1620) += ds1620.o
 obj-$(CONFIG_HW_RANDOM) += hw_random.o
-obj-$(CONFIG_QIC02_TAPE) += tpqic02.o
 obj-$(CONFIG_FTAPE) += ftape/
 obj-$(CONFIG_COBALT_LCD) += lcd.o
 obj-$(CONFIG_PPDEV) += ppdev.o
 obj-$(CONFIG_NWBUTTON) += nwbutton.o
 obj-$(CONFIG_NWFLASH) += nwflash.o
 obj-$(CONFIG_SCx200_GPIO) += scx200_gpio.o
+obj-$(CONFIG_TANBAC_TB0219) += tb0219.o
 
 obj-$(CONFIG_WATCHDOG)	+= watchdog/
 obj-$(CONFIG_MWAVE) += mwave/
@@ -89,7 +89,7 @@
 obj-$(CONFIG_IPMI_HANDLER) += ipmi/
 
 obj-$(CONFIG_HANGCHECK_TIMER) += hangcheck-timer.o
-
+obj-$(CONFIG_TCG_TPM) += tpm/
 # Files generated that shall be removed upon make clean
 clean-files := consolemap_deftbl.c defkeymap.c qtronixmap.c
 
diff -Nru a/drivers/char/agp/Kconfig b/drivers/char/agp/Kconfig
--- a/drivers/char/agp/Kconfig	2005-01-19 21:50:53 -08:00
+++ b/drivers/char/agp/Kconfig	2005-02-22 16:55:59 -08:00
@@ -89,16 +89,6 @@
 	  use GLX or DRI, or if you have any Intel integrated graphics
 	  chipsets.  If unsure, say Y.
 
-config AGP_INTEL_MCH
-	tristate "Intel i865 chipset support"
-	depends on AGP && X86
-	help
-	  This option gives you AGP support for the GLX component of XFree86 4.x
-	  on Intel chipsets that support Intel EM64T processors.
-
-	  You should say Y here if you use XFree86 3.3.6 or 4.x and want to
-	  use GLX or DRI.  If unsure, say Y.
-
 config AGP_NVIDIA
 	tristate "NVIDIA nForce/nForce2 chipset support"
 	depends on AGP && X86 && !X86_64
diff -Nru a/drivers/char/agp/Makefile b/drivers/char/agp/Makefile
--- a/drivers/char/agp/Makefile	2004-03-24 09:01:28 -08:00
+++ b/drivers/char/agp/Makefile	2005-02-22 16:55:59 -08:00
@@ -9,7 +9,6 @@
 obj-$(CONFIG_AGP_EFFICEON)	+= efficeon-agp.o
 obj-$(CONFIG_AGP_HP_ZX1)	+= hp-agp.o
 obj-$(CONFIG_AGP_I460)		+= i460-agp.o
-obj-$(CONFIG_AGP_INTEL_MCH)		+= intel-mch-agp.o
 obj-$(CONFIG_AGP_INTEL)		+= intel-agp.o
 obj-$(CONFIG_AGP_NVIDIA)	+= nvidia-agp.o
 obj-$(CONFIG_AGP_SIS)		+= sis-agp.o
diff -Nru a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
--- a/drivers/char/agp/agp.h	2004-12-15 16:54:34 -08:00
+++ b/drivers/char/agp/agp.h	2005-02-23 16:36:05 -08:00
@@ -1,5 +1,6 @@
 /*
  * AGPGART
+ * Copyright (C) 2004 Silicon Graphics, Inc.
  * Copyright (C) 2002-2004 Dave Jones
  * Copyright (C) 1999 Jeff Hartmann
  * Copyright (C) 1999 Precision Insight, Inc.
@@ -100,18 +101,19 @@
 	struct gatt_mask *masks;
 	int (*fetch_size)(void);
 	int (*configure)(void);
-	void (*agp_enable)(u32);
+	void (*agp_enable)(struct agp_bridge_data *, u32);
 	void (*cleanup)(void);
 	void (*tlb_flush)(struct agp_memory *);
-	unsigned long (*mask_memory)(unsigned long, int);
+	unsigned long (*mask_memory)(struct agp_bridge_data *,
+		unsigned long, int);
 	void (*cache_flush)(void);
-	int (*create_gatt_table)(void);
-	int (*free_gatt_table)(void);
+	int (*create_gatt_table)(struct agp_bridge_data *);
+	int (*free_gatt_table)(struct agp_bridge_data *);
 	int (*insert_memory)(struct agp_memory *, off_t, int);
 	int (*remove_memory)(struct agp_memory *, off_t, int);
 	struct agp_memory *(*alloc_by_type) (size_t, int);
 	void (*free_by_type)(struct agp_memory *);
-	void *(*agp_alloc_page)(void);
+	void *(*agp_alloc_page)(struct agp_bridge_data *);
 	void (*agp_destroy_page)(void *);
 };
 
@@ -137,8 +139,10 @@
 	int max_memory_agp;	/* in number of pages */
 	int aperture_size_idx;
 	int capndx;
+	int flags;
 	char major_version;
 	char minor_version;
+	struct list_head list;
 };
 
 #define KB(x)	((x) * 1024)
@@ -243,24 +247,26 @@
 void agp_frontend_cleanup(void);
 
 /* Generic routines. */
-void agp_generic_enable(u32 mode);
-int agp_generic_create_gatt_table(void);
-int agp_generic_free_gatt_table(void);
+void agp_generic_enable(struct agp_bridge_data *bridge, u32 mode);
+int agp_generic_create_gatt_table(struct agp_bridge_data *bridge);
+int agp_generic_free_gatt_table(struct agp_bridge_data *bridge);
 struct agp_memory *agp_create_memory(int scratch_pages);
 int agp_generic_insert_memory(struct agp_memory *mem, off_t pg_start, int type);
 int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type);
 struct agp_memory *agp_generic_alloc_by_type(size_t page_count, int type);
 void agp_generic_free_by_type(struct agp_memory *curr);
-void *agp_generic_alloc_page(void);
+void *agp_generic_alloc_page(struct agp_bridge_data *bridge);
 void agp_generic_destroy_page(void *addr);
 void agp_free_key(int key);
 int agp_num_entries(void);
-u32 agp_collect_device_status(u32 mode, u32 command);
+u32 agp_collect_device_status(struct agp_bridge_data *bridge, u32 mode, u32 command);
 void agp_device_command(u32 command, int agp_v3);
 int agp_3_5_enable(struct agp_bridge_data *bridge);
 void global_cache_flush(void);
 void get_agp_version(struct agp_bridge_data *bridge);
-unsigned long agp_generic_mask_memory(unsigned long addr, int type);
+unsigned long agp_generic_mask_memory(struct agp_bridge_data *bridge,
+	unsigned long addr, int type);
+struct agp_bridge_data *agp_generic_find_bridge(struct pci_dev *pdev);
 
 /* generic routines for agp>=3 */
 int agp3_generic_fetch_size(void);
@@ -314,5 +320,12 @@
 
 #define AGPCTRL_APERENB		(1<<8)
 #define AGPCTRL_GTLBEN		(1<<7)
+
+#define AGP2_RESERVED_MASK 0x00fffcc8
+#define AGP3_RESERVED_MASK 0x00ff00cc
+
+#define AGP_ERRATA_FASTWRITES 1<<0
+#define AGP_ERRATA_SBA	 1<<1
+#define AGP_ERRATA_1X 1<<2
 
 #endif	/* _AGP_BACKEND_PRIV_H */
diff -Nru a/drivers/char/agp/ali-agp.c b/drivers/char/agp/ali-agp.c
--- a/drivers/char/agp/ali-agp.c	2004-12-22 15:25:04 -08:00
+++ b/drivers/char/agp/ali-agp.c	2005-02-23 15:16:53 -08:00
@@ -139,9 +139,9 @@
 	}
 }
 
-static void *m1541_alloc_page(void)
+static void *m1541_alloc_page(struct agp_bridge_data *bridge)
 {
-	void *addr = agp_generic_alloc_page();
+	void *addr = agp_generic_alloc_page(agp_bridge);
 	u32 temp;
 
 	if (!addr)
@@ -398,7 +398,7 @@
 {
 	if (agp_off)
 		return -EINVAL;
-	return pci_module_init(&agp_ali_pci_driver);
+	return pci_register_driver(&agp_ali_pci_driver);
 }
 
 static void __exit agp_ali_cleanup(void)
diff -Nru a/drivers/char/agp/alpha-agp.c b/drivers/char/agp/alpha-agp.c
--- a/drivers/char/agp/alpha-agp.c	2004-12-22 15:25:04 -08:00
+++ b/drivers/char/agp/alpha-agp.c	2005-02-23 16:36:05 -08:00
@@ -76,11 +76,12 @@
 	alpha_mv.mv_pci_tbi(agp->hose, 0, -1);
 }
 
-static void alpha_core_agp_enable(u32 mode)
+static void alpha_core_agp_enable(struct agp_bridge_data *bridge, u32 mode)
 {
-	alpha_agp_info *agp = agp_bridge->dev_private_data;
+	alpha_agp_info *agp = bridge->dev_private_data;
 
-	agp->mode.lw = agp_collect_device_status(mode, agp->capability.lw);
+	agp->mode.lw = agp_collect_device_status(bridge, mode,
+					agp->capability.lw);
 
 	agp->mode.bits.enable = 1;
 	agp->ops->configure(agp);
diff -Nru a/drivers/char/agp/amd-k7-agp.c b/drivers/char/agp/amd-k7-agp.c
--- a/drivers/char/agp/amd-k7-agp.c	2004-12-22 15:25:04 -08:00
+++ b/drivers/char/agp/amd-k7-agp.c	2005-02-23 16:36:05 -08:00
@@ -132,7 +132,7 @@
 #define GET_GATT(addr) (amd_irongate_private.gatt_pages[\
 	GET_PAGE_DIR_IDX(addr)]->remapped)
 
-static int amd_create_gatt_table(void)
+static int amd_create_gatt_table(struct agp_bridge_data *bridge)
 {
 	struct aper_size_info_lvl2 *value;
 	struct amd_page_map page_dir;
@@ -175,7 +175,7 @@
 	return 0;
 }
 
-static int amd_free_gatt_table(void)
+static int amd_free_gatt_table(struct agp_bridge_data *bridge)
 {
 	struct amd_page_map page_dir;
 
@@ -314,7 +314,8 @@
 	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
 		addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
 		cur_gatt = GET_GATT(addr);
-		writel(agp_generic_mask_memory(mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
+		writel(agp_generic_mask_memory(agp_bridge,
+			mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
 		readl(cur_gatt+GET_GATT_OFF(addr));	/* PCI Posting. */
 	}
 	amd_irongate_tlbflush(mem);
@@ -421,6 +422,53 @@
 	bridge->dev = pdev;
 	bridge->capndx = cap_ptr;
 
+	/* 751 Errata (22564_B-1.PDF)
+	   erratum 20: strobe glitch with Nvidia NV10 GeForce cards.
+	   system controller may experience noise due to strong drive strengths
+	 */
+	if (agp_bridge->dev->device == PCI_DEVICE_ID_AMD_FE_GATE_7006) {
+		u8 cap_ptr=0;
+		struct pci_dev *gfxcard=NULL;
+		while (!cap_ptr) {
+			gfxcard = pci_get_class(PCI_CLASS_DISPLAY_VGA<<8, gfxcard);
+			if (!gfxcard) {
+				printk (KERN_INFO PFX "Couldn't find an AGP VGA controller.\n");
+				return -ENODEV;
+			}
+			cap_ptr = pci_find_capability(gfxcard, PCI_CAP_ID_AGP);
+			if (!cap_ptr) {
+				pci_dev_put(gfxcard);
+				continue;
+			}
+		}
+
+		/* With so many variants of NVidia cards, it's simpler just
+		   to blacklist them all, and then whitelist them as needed
+		   (if necessary at all). */
+		if (gfxcard->vendor == PCI_VENDOR_ID_NVIDIA) {
+			agp_bridge->flags |= AGP_ERRATA_1X;
+			printk (KERN_INFO PFX "AMD 751 chipset with NVidia GeForce detected. Forcing to 1X due to errata.\n");
+		}
+		pci_dev_put(gfxcard);
+	}
+
+	/* 761 Errata (23613_F.pdf)
+	 * Revisions B0/B1 were a disaster.
+	 * erratum 44: SYSCLK/AGPCLK skew causes 2X failures -- Force mode to 1X
+	 * erratum 45: Timing problem prevents fast writes -- Disable fast write.
+	 * erratum 46: Setup violation on AGP SBA pins - Disable side band addressing.
+	 * With this lot disabled, we should prevent lockups. */
+	if (agp_bridge->dev->device == PCI_DEVICE_ID_AMD_FE_GATE_700E) {
+		u8 revision=0;
+		pci_read_config_byte(pdev, PCI_REVISION_ID, &revision);
+		if (revision == 0x10 || revision == 0x11) {
+			agp_bridge->flags = AGP_ERRATA_FASTWRITES;
+			agp_bridge->flags |= AGP_ERRATA_SBA;
+			agp_bridge->flags |= AGP_ERRATA_1X;
+			printk (KERN_INFO PFX "AMD 761 chipset with errata detected - disabling AGP fast writes & SBA and forcing to 1X.\n");
+		}
+	}
+
 	/* Fill in the mode register */
 	pci_read_config_dword(pdev,
 			bridge->capndx+PCI_AGP_STATUS,
@@ -480,7 +528,7 @@
 {
 	if (agp_off)
 		return -EINVAL;
-	return pci_module_init(&agp_amdk7_pci_driver);
+	return pci_register_driver(&agp_amdk7_pci_driver);
 }
 
 static void __exit agp_amdk7_cleanup(void)
diff -Nru a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c
--- a/drivers/char/agp/amd64-agp.c	2005-01-07 21:44:25 -08:00
+++ b/drivers/char/agp/amd64-agp.c	2005-02-23 16:36:05 -08:00
@@ -106,7 +106,8 @@
 	}
 
 	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
-		tmp = agp_bridge->driver->mask_memory(mem->memory[i], mem->type);
+		tmp = agp_bridge->driver->mask_memory(agp_bridge,
+			mem->memory[i], mem->type);
 
 		BUG_ON(tmp & 0xffffff0000000ffcULL);
 		pte = (tmp & 0x000000ff00000000ULL) >> 28;
@@ -709,7 +710,7 @@
 
 	if (agp_off)
 		return -EINVAL;
-	if (pci_module_init(&agp_amd64_pci_driver) > 0) {
+	if (pci_register_driver(&agp_amd64_pci_driver) > 0) {
 		struct pci_dev *dev;
 		if (!agp_try_unsupported && !agp_try_unsupported_boot) {
 			printk(KERN_INFO PFX "No supported AGP bridge found.\n");
diff -Nru a/drivers/char/agp/ati-agp.c b/drivers/char/agp/ati-agp.c
--- a/drivers/char/agp/ati-agp.c	2004-12-22 15:25:04 -08:00
+++ b/drivers/char/agp/ati-agp.c	2005-02-23 16:36:05 -08:00
@@ -291,7 +291,8 @@
 	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
 		addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
 		cur_gatt = GET_GATT(addr);
-		writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
+		writel(agp_bridge->driver->mask_memory(agp_bridge,
+			mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
 		readl(cur_gatt+GET_GATT_OFF(addr));	/* PCI Posting. */
 	}
 	agp_bridge->driver->tlb_flush(mem);
@@ -319,7 +320,7 @@
 	return 0;
 }
 
-static int ati_create_gatt_table(void)
+static int ati_create_gatt_table(struct agp_bridge_data *bridge)
 {
 	struct aper_size_info_lvl2 *value;
 	ati_page_map page_dir;
@@ -380,7 +381,7 @@
 	return 0;
 }
 
-static int ati_free_gatt_table(void)
+static int ati_free_gatt_table(struct agp_bridge_data *bridge)
 {
 	ati_page_map page_dir;
 
@@ -531,7 +532,7 @@
 {
 	if (agp_off)
 		return -EINVAL;
-	return pci_module_init(&agp_ati_pci_driver);
+	return pci_register_driver(&agp_ati_pci_driver);
 }
 
 static void __exit agp_ati_cleanup(void)
diff -Nru a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c
--- a/drivers/char/agp/backend.c	2005-01-19 20:31:20 -08:00
+++ b/drivers/char/agp/backend.c	2005-02-23 16:36:05 -08:00
@@ -1,5 +1,6 @@
 /*
  * AGPGART driver backend routines.
+ * Copyright (C) 2004 Silicon Graphics, Inc.
  * Copyright (C) 2002-2003 Dave Jones.
  * Copyright (C) 1999 Jeff Hartmann.
  * Copyright (C) 1999 Precision Insight, Inc.
@@ -18,12 +19,12 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * JEFF HARTMANN, DAVE JONES, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, 
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
+ * JEFF HARTMANN, DAVE JONES, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
- * TODO: 
+ * TODO:
  * - Allocate more than order 0 pages to avoid too much linear map splitting.
  */
 #include <linux/module.h>
@@ -42,34 +43,38 @@
  * fix some real stupidity. It's only by chance we can bump
  * past 0.99 at all due to some boolean logic error. */
 #define AGPGART_VERSION_MAJOR 0
-#define AGPGART_VERSION_MINOR 100
+#define AGPGART_VERSION_MINOR 101
 static struct agp_version agp_current_version =
 {
 	.major = AGPGART_VERSION_MAJOR,
 	.minor = AGPGART_VERSION_MINOR,
 };
 
-static int agp_count=0;
+struct agp_bridge_data *(*agp_find_bridge)(struct pci_dev *) =
+	&agp_generic_find_bridge;
 
-struct agp_bridge_data agp_bridge_dummy = { .type = NOT_SUPPORTED };
-struct agp_bridge_data *agp_bridge = &agp_bridge_dummy;
+struct agp_bridge_data *agp_bridge;
+LIST_HEAD(agp_bridges);
 EXPORT_SYMBOL(agp_bridge);
-
+EXPORT_SYMBOL(agp_bridges);
 
 /**
- *	agp_backend_acquire  -  attempt to acquire the agp backend.
+ *	agp_backend_acquire  -  attempt to acquire an agp backend.
  *
- *	returns -EBUSY if agp is in use,
- *	returns 0 if the caller owns the agp backend
  */
-int agp_backend_acquire(void)
+struct agp_bridge_data *agp_backend_acquire(struct pci_dev *pdev)
 {
-	if (agp_bridge->type == NOT_SUPPORTED)
-		return -EINVAL;
-	if (atomic_read(&agp_bridge->agp_in_use))
-		return -EBUSY;
-	atomic_inc(&agp_bridge->agp_in_use);
-	return 0;
+	struct agp_bridge_data *bridge;
+
+	bridge = agp_find_bridge(pdev);
+
+	if (!bridge)
+		return NULL;
+
+	if (atomic_read(&bridge->agp_in_use))
+		return NULL;
+	atomic_inc(&bridge->agp_in_use);
+	return bridge;
 }
 EXPORT_SYMBOL(agp_backend_acquire);
 
@@ -82,10 +87,11 @@
  *
  *	(Ensure that all memory it bound is unbound.)
  */
-void agp_backend_release(void)
+void agp_backend_release(struct agp_bridge_data *bridge)
 {
-	if (agp_bridge->type != NOT_SUPPORTED)
-		atomic_dec(&agp_bridge->agp_in_use);
+
+	if (bridge)
+		atomic_dec(&bridge->agp_in_use);
 }
 EXPORT_SYMBOL(agp_backend_release);
 
@@ -121,7 +127,6 @@
 	     (maxes_table[index].agp - maxes_table[index - 1].agp)) /
 	   (maxes_table[index].mem - maxes_table[index - 1].mem);
 
-	printk(KERN_INFO PFX "Maximum main memory to use for agp memory: %ldM\n", result);
 	result = result << (20 - PAGE_SHIFT);
 	return result;
 }
@@ -135,7 +140,7 @@
 	bridge->version = &agp_current_version;
 
 	if (bridge->driver->needs_scratch_page) {
-		void *addr = bridge->driver->agp_alloc_page();
+		void *addr = bridge->driver->agp_alloc_page(bridge);
 
 		if (!addr) {
 			printk(KERN_ERR PFX "unable to get memory for scratch page.\n");
@@ -144,7 +149,7 @@
 
 		bridge->scratch_page_real = virt_to_phys(addr);
 		bridge->scratch_page =
-		    bridge->driver->mask_memory(bridge->scratch_page_real, 0);
+		    bridge->driver->mask_memory(bridge, bridge->scratch_page_real, 0);
 	}
 
 	size_value = bridge->driver->fetch_size();
@@ -153,14 +158,14 @@
 		rc = -EINVAL;
 		goto err_out;
 	}
-	if (bridge->driver->create_gatt_table()) {
+	if (bridge->driver->create_gatt_table(bridge)) {
 		printk(KERN_ERR PFX
 		    "unable to get memory for graphics translation table.\n");
 		rc = -ENOMEM;
 		goto err_out;
 	}
 	got_gatt = 1;
-	
+
 	bridge->key_list = vmalloc(PAGE_SIZE * 4);
 	if (bridge->key_list == NULL) {
 		printk(KERN_ERR PFX "error allocating memory for key lists.\n");
@@ -168,7 +173,7 @@
 		goto err_out;
 	}
 	got_keylist = 1;
-	
+
 	/* FIXME vmalloc'd memory not guaranteed contiguous */
 	memset(bridge->key_list, 0, PAGE_SIZE * 4);
 
@@ -178,9 +183,6 @@
 		goto err_out;
 	}
 
-	printk(KERN_INFO PFX "AGP aperture is %dM @ 0x%lx\n",
-	       size_value, bridge->gart_bus_addr);
-
 	return 0;
 
 err_out:
@@ -188,7 +190,7 @@
 		bridge->driver->agp_destroy_page(
 				phys_to_virt(bridge->scratch_page_real));
 	if (got_gatt)
-		bridge->driver->free_gatt_table();
+		bridge->driver->free_gatt_table(bridge);
 	if (got_keylist) {
 		vfree(bridge->key_list);
 		bridge->key_list = NULL;
@@ -202,7 +204,7 @@
 	if (bridge->driver->cleanup)
 		bridge->driver->cleanup();
 	if (bridge->driver->free_gatt_table)
-		bridge->driver->free_gatt_table();
+		bridge->driver->free_gatt_table(bridge);
 	if (bridge->key_list) {
 		vfree(bridge->key_list);
 		bridge->key_list = NULL;
@@ -214,16 +216,35 @@
 				phys_to_virt(bridge->scratch_page_real));
 }
 
-/* XXX Kludge alert: agpgart isn't ready for multiple bridges yet */
+/* When we remove the global variable agp_bridge from all drivers
+ * then agp_alloc_bridge and agp_generic_find_bridge need to be updated
+ */
+
 struct agp_bridge_data *agp_alloc_bridge(void)
 {
-	return agp_bridge;
+	struct agp_bridge_data *bridge = kmalloc(sizeof(*bridge), GFP_KERNEL);
+
+	if (!bridge)
+		return NULL;
+
+	memset(bridge, 0, sizeof(*bridge));
+	atomic_set(&bridge->agp_in_use, 0);
+	atomic_set(&bridge->current_memory_agp, 0);
+
+	if (list_empty(&agp_bridges))
+		agp_bridge = bridge;
+
+	return bridge;
 }
 EXPORT_SYMBOL(agp_alloc_bridge);
 
 
 void agp_put_bridge(struct agp_bridge_data *bridge)
 {
+        kfree(bridge);
+
+        if (list_empty(&agp_bridges))
+                agp_bridge = NULL;
 }
 EXPORT_SYMBOL(agp_put_bridge);
 
@@ -240,40 +261,38 @@
 		return -EINVAL;
 	}
 
-	if (agp_count) {
-		printk (KERN_INFO PFX
-		       "Only one agpgart device currently supported.\n");
-		return -ENODEV;
-	}
-
 	/* Grab reference on the chipset driver. */
 	if (!try_module_get(bridge->driver->owner)) {
 		printk (KERN_INFO PFX "Couldn't lock chipset driver.\n");
 		return -EINVAL;
 	}
 
-	bridge->type = SUPPORTED;
-
-	error = agp_backend_initialize(agp_bridge);
+	error = agp_backend_initialize(bridge);
 	if (error) {
 		printk (KERN_INFO PFX "agp_backend_initialize() failed.\n");
 		goto err_out;
 	}
 
-	error = agp_frontend_initialize();
-	if (error) {
-		printk (KERN_INFO PFX "agp_frontend_initialize() failed.\n");
-		goto frontend_err;
+	if (list_empty(&agp_bridges)) {
+		error = agp_frontend_initialize();
+		if (error) {
+			printk (KERN_INFO PFX "agp_frontend_initialize() failed.\n");
+			goto frontend_err;
+		}
+
+		printk(KERN_INFO PFX "AGP aperture is %dM @ 0x%lx\n",
+			bridge->driver->fetch_size(), bridge->gart_bus_addr);
+
 	}
 
-	agp_count++;
+	list_add(&bridge->list, &agp_bridges);
 	return 0;
 
 frontend_err:
-	agp_backend_cleanup(agp_bridge);
+	agp_backend_cleanup(bridge);
 err_out:
-	bridge->type = NOT_SUPPORTED;
 	module_put(bridge->driver->owner);
+	agp_put_bridge(bridge);
 	return error;
 }
 EXPORT_SYMBOL_GPL(agp_add_bridge);
@@ -281,10 +300,10 @@
 
 void agp_remove_bridge(struct agp_bridge_data *bridge)
 {
-	bridge->type = NOT_SUPPORTED;
-	agp_frontend_cleanup();
 	agp_backend_cleanup(bridge);
-	agp_count--;
+	list_del(&bridge->list);
+	if (list_empty(&agp_bridges))
+		agp_frontend_cleanup();
 	module_put(bridge->driver->owner);
 }
 EXPORT_SYMBOL_GPL(agp_remove_bridge);
diff -Nru a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c
--- a/drivers/char/agp/efficeon-agp.c	2004-12-22 15:25:04 -08:00
+++ b/drivers/char/agp/efficeon-agp.c	2005-02-23 16:36:05 -08:00
@@ -148,7 +148,7 @@
 	return 0;
 }
 
-static int efficeon_free_gatt_table(void)
+static int efficeon_free_gatt_table(struct agp_bridge_data *bridge)
 {
 	int index, freed = 0;
 
@@ -183,7 +183,7 @@
 #define GET_GATT(addr) (efficeon_private.gatt_pages[\
 	GET_PAGE_DIR_IDX(addr)]->remapped)
 
-static int efficeon_create_gatt_table(void)
+static int efficeon_create_gatt_table(struct agp_bridge_data *bridge)
 {
 	int index;
 	const int pati    = EFFICEON_PATI;
@@ -209,7 +209,7 @@
 
 		page = get_zeroed_page(GFP_KERNEL);
 		if (!page) {
-			efficeon_free_gatt_table();
+			efficeon_free_gatt_table(agp_bridge);
 			return -ENOMEM;
 		}
 		SetPageReserved(virt_to_page((char *)page));
@@ -448,7 +448,7 @@
 		return 0;
 	agp_initialised=1;
 
-	return pci_module_init(&agp_efficeon_pci_driver);
+	return pci_register_driver(&agp_efficeon_pci_driver);
 }
 
 static void __exit agp_efficeon_cleanup(void)
diff -Nru a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c
--- a/drivers/char/agp/frontend.c	2004-10-20 01:37:06 -07:00
+++ b/drivers/char/agp/frontend.c	2005-02-23 15:12:04 -08:00
@@ -1,5 +1,6 @@
 /*
  * AGPGART driver frontend
+ * Copyright (C) 2004 Silicon Graphics, Inc.
  * Copyright (C) 2002-2003 Dave Jones
  * Copyright (C) 1999 Jeff Hartmann
  * Copyright (C) 1999 Precision Insight, Inc.
@@ -18,9 +19,9 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, 
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE 
+ * JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  *
  */
@@ -152,8 +153,8 @@
 
 /* Originally taken from linux/mm/mmap.c from the array
  * protection_map.
- * The original really should be exported to modules, or 
- * some routine which does the conversion for you 
+ * The original really should be exported to modules, or
+ * some routine which does the conversion for you
  */
 
 static const pgprot_t my_protect_map[16] =
@@ -285,8 +286,8 @@
 
 /* End - File flag list routines */
 
-/* 
- * Wrappers for agp_free_memory & agp_allocate_memory 
+/*
+ * Wrappers for agp_free_memory & agp_allocate_memory
  * These make sure that internal lists are kept updated.
  */
 static void agp_free_memory_wrap(struct agp_memory *memory)
@@ -299,7 +300,7 @@
 {
 	struct agp_memory *memory;
 
-	memory = agp_allocate_memory(pg_count, type);
+	memory = agp_allocate_memory(agp_bridge, pg_count, type);
 	if (memory == NULL)
 		return NULL;
 
@@ -420,7 +421,7 @@
 	if (agp_fe.current_controller == controller) {
 		agp_fe.current_controller = NULL;
 		agp_fe.backend_acquired = FALSE;
-		agp_backend_release();
+		agp_backend_release(agp_bridge);
 	}
 	kfree(controller);
 	return 0;
@@ -468,10 +469,10 @@
 
 	agp_fe.current_controller = NULL;
 	agp_fe.used_by_controller = FALSE;
-	agp_backend_release();
+	agp_backend_release(agp_bridge);
 }
 
-/* 
+/*
  * Routines for managing client lists -
  * These routines are for managing the list of auth'ed clients.
  */
@@ -605,7 +606,7 @@
 	if (!(test_bit(AGP_FF_IS_VALID, &priv->access_flags)))
 		goto out_eperm;
 
-	agp_copy_info(&kerninfo);
+	agp_copy_info(agp_bridge, &kerninfo);
 	size = vma->vm_end - vma->vm_start;
 	current_size = kerninfo.aper_size;
 	current_size = current_size * 0x100000;
@@ -757,7 +758,7 @@
 	struct agp_info userinfo;
 	struct agp_kern_info kerninfo;
 
-	agp_copy_info(&kerninfo);
+	agp_copy_info(agp_bridge, &kerninfo);
 
 	userinfo.version.major = kerninfo.version.major;
 	userinfo.version.minor = kerninfo.version.minor;
@@ -777,7 +778,6 @@
 
 static int agpioc_acquire_wrap(struct agp_file_private *priv)
 {
-	int ret;
 	struct agp_controller *controller;
 
 	DBG("");
@@ -788,11 +788,15 @@
 	if (agp_fe.current_controller != NULL)
 		return -EBUSY;
 
-	ret = agp_backend_acquire();
-	if (ret == 0)
-		agp_fe.backend_acquired = TRUE;
-	else
-		return ret;
+	if(!agp_bridge)
+		return -ENODEV;
+
+        if (atomic_read(&agp_bridge->agp_in_use))
+                return -EBUSY;
+
+	atomic_inc(&agp_bridge->agp_in_use);
+
+	agp_fe.backend_acquired = TRUE;
 
 	controller = agp_find_controller_by_pid(priv->my_pid);
 
@@ -803,7 +807,7 @@
 
 		if (controller == NULL) {
 			agp_fe.backend_acquired = FALSE;
-			agp_backend_release();
+			agp_backend_release(agp_bridge);
 			return -ENOMEM;
 		}
 		agp_insert_controller(controller);
@@ -830,7 +834,7 @@
 	if (copy_from_user(&mode, arg, sizeof(struct agp_setup)))
 		return -EFAULT;
 
-	agp_enable(mode.agp_mode);
+	agp_enable(agp_bridge, mode.agp_mode);
 	return 0;
 }
 
@@ -993,24 +997,24 @@
 	if ((agp_fe.current_controller == NULL) &&
 	    (cmd != AGPIOC_ACQUIRE)) {
 		ret_val = -EINVAL;
-	   	goto ioctl_out;
+		goto ioctl_out;
 	}
 	if ((agp_fe.backend_acquired != TRUE) &&
 	    (cmd != AGPIOC_ACQUIRE)) {
 		ret_val = -EBUSY;
-	   	goto ioctl_out;
+		goto ioctl_out;
 	}
 	if (cmd != AGPIOC_ACQUIRE) {
 		if (!(test_bit(AGP_FF_IS_CONTROLLER, &curr_priv->access_flags))) {
 			ret_val = -EPERM;
-		   	goto ioctl_out;
+			goto ioctl_out;
 		}
 		/* Use the original pid of the controller,
 		 * in case it's threaded */
 
 		if (agp_fe.current_controller->pid != curr_priv->my_pid) {
 			ret_val = -EBUSY;
-		   	goto ioctl_out;
+			goto ioctl_out;
 		}
 	}
 
@@ -1022,35 +1026,35 @@
 	case AGPIOC_ACQUIRE:
 		ret_val = agpioc_acquire_wrap(curr_priv);
 		break;
-	   	
+
 	case AGPIOC_RELEASE:
 		ret_val = agpioc_release_wrap(curr_priv);
 		break;
-	   	
+
 	case AGPIOC_SETUP:
 		ret_val = agpioc_setup_wrap(curr_priv, (void __user *) arg);
 		break;
-	   	
+
 	case AGPIOC_RESERVE:
 		ret_val = agpioc_reserve_wrap(curr_priv, (void __user *) arg);
 		break;
-	   	
+
 	case AGPIOC_PROTECT:
 		ret_val = agpioc_protect_wrap(curr_priv);
 		break;
-	  	
+
 	case AGPIOC_ALLOCATE:
 		ret_val = agpioc_allocate_wrap(curr_priv, (void __user *) arg);
 		break;
-	   	
+
 	case AGPIOC_DEALLOCATE:
 		ret_val = agpioc_deallocate_wrap(curr_priv, (int) arg);
 		break;
-	   	
+
 	case AGPIOC_BIND:
 		ret_val = agpioc_bind_wrap(curr_priv, (void __user *) arg);
 		break;
-	   	
+
 	case AGPIOC_UNBIND:
 		ret_val = agpioc_unbind_wrap(curr_priv, (void __user *) arg);
 		break;
diff -Nru a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c
--- a/drivers/char/agp/generic.c	2004-12-15 22:31:44 -08:00
+++ b/drivers/char/agp/generic.c	2005-03-06 16:59:19 -08:00
@@ -1,6 +1,7 @@
 /*
  * AGPGART driver.
- * Copyright (C) 2002-2004 Dave Jones.
+ * Copyright (C) 2004 Silicon Graphics, Inc.
+ * Copyright (C) 2002-2005 Dave Jones.
  * Copyright (C) 1999 Jeff Hartmann.
  * Copyright (C) 1999 Precision Insight, Inc.
  * Copyright (C) 1999 Xi Graphics, Inc.
@@ -139,19 +140,19 @@
 {
 	size_t i;
 
-	if ((agp_bridge->type == NOT_SUPPORTED) || (curr == NULL))
+	if (curr == NULL)
 		return;
 
 	if (curr->is_bound == TRUE)
 		agp_unbind_memory(curr);
 
 	if (curr->type != 0) {
-		agp_bridge->driver->free_by_type(curr);
+		curr->bridge->driver->free_by_type(curr);
 		return;
 	}
 	if (curr->page_count != 0) {
 		for (i = 0; i < curr->page_count; i++) {
-			agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[i]));
+			curr->bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[i]));
 		}
 	}
 	agp_free_key(curr->key);
@@ -173,20 +174,23 @@
  *
  *	It returns NULL whenever memory is unavailable.
  */
-struct agp_memory *agp_allocate_memory(size_t page_count, u32 type)
+struct agp_memory *agp_allocate_memory(struct agp_bridge_data *bridge,
+					size_t page_count, u32 type)
 {
 	int scratch_pages;
 	struct agp_memory *new;
 	size_t i;
 
-	if (agp_bridge->type == NOT_SUPPORTED)
+	if (!bridge)
 		return NULL;
 
-	if ((atomic_read(&agp_bridge->current_memory_agp) + page_count) > agp_bridge->max_memory_agp)
+	if ((atomic_read(&bridge->current_memory_agp) + page_count) > bridge->max_memory_agp)
 		return NULL;
 
 	if (type != 0) {
-		new = agp_bridge->driver->alloc_by_type(page_count, type);
+		new = bridge->driver->alloc_by_type(page_count, type);
+		if (new)
+			new->bridge = bridge;
 		return new;
 	}
 
@@ -198,7 +202,7 @@
 		return NULL;
 
 	for (i = 0; i < page_count; i++) {
-		void *addr = agp_bridge->driver->agp_alloc_page();
+		void *addr = bridge->driver->agp_alloc_page(bridge);
 
 		if (addr == NULL) {
 			agp_free_memory(new);
@@ -207,6 +211,7 @@
 		new->memory[i] = virt_to_phys(addr);
 		new->page_count++;
 	}
+       new->bridge = bridge;
 
 	flush_agp_mappings();
 
@@ -289,6 +294,19 @@
 EXPORT_SYMBOL_GPL(agp_num_entries);
 
 
+static int check_bridge_mode(struct pci_dev *dev)
+{
+	u32 agp3;
+	u8 cap_ptr;
+
+	cap_ptr = pci_find_capability(dev, PCI_CAP_ID_AGP);
+	pci_read_config_dword(dev, cap_ptr+AGPSTAT, &agp3);
+	if (agp3 & AGPSTAT_MODE_3_0)
+		return 1;
+	return 0;
+}
+
+
 /**
  *	agp_copy_info  -  copy bridge state information
  *
@@ -297,35 +315,36 @@
  *	This function copies information about the agp bridge device and the state of
  *	the agp backend into an agp_kern_info pointer.
  */
-int agp_copy_info(struct agp_kern_info *info)
+int agp_copy_info(struct agp_bridge_data *bridge, struct agp_kern_info *info)
 {
 	memset(info, 0, sizeof(struct agp_kern_info));
-	if (!agp_bridge || agp_bridge->type == NOT_SUPPORTED ||
-	    !agp_bridge->version) {
+	if (!bridge) {
 		info->chipset = NOT_SUPPORTED;
 		return -EIO;
 	}
 
-	info->version.major = agp_bridge->version->major;
-	info->version.minor = agp_bridge->version->minor;
-	info->chipset = agp_bridge->type;
-	info->device = agp_bridge->dev;
-	info->mode = agp_bridge->mode;
-	info->aper_base = agp_bridge->gart_bus_addr;
+	info->version.major = bridge->version->major;
+	info->version.minor = bridge->version->minor;
+	info->chipset = SUPPORTED;
+	info->device = bridge->dev;
+	if (check_bridge_mode(bridge->dev))
+		info->mode = bridge->mode & ~AGP3_RESERVED_MASK;
+	else
+		info->mode = bridge->mode & ~AGP2_RESERVED_MASK;
+	info->mode = bridge->mode;
+	info->aper_base = bridge->gart_bus_addr;
 	info->aper_size = agp_return_size();
-	info->max_memory = agp_bridge->max_memory_agp;
-	info->current_memory = atomic_read(&agp_bridge->current_memory_agp);
-	info->cant_use_aperture = agp_bridge->driver->cant_use_aperture;
-	info->vm_ops = agp_bridge->vm_ops;
+	info->max_memory = bridge->max_memory_agp;
+	info->current_memory = atomic_read(&bridge->current_memory_agp);
+	info->cant_use_aperture = bridge->driver->cant_use_aperture;
+	info->vm_ops = bridge->vm_ops;
 	info->page_mask = ~0UL;
 	return 0;
 }
 EXPORT_SYMBOL(agp_copy_info);
 
-
 /* End - Routine to copy over information structure */
 
-
 /*
  * Routines for handling swapping of agp_memory into the GATT -
  * These routines take agp_memory and insert them into the GATT.
@@ -345,7 +364,7 @@
 {
 	int ret_val;
 
-	if ((agp_bridge->type == NOT_SUPPORTED) || (curr == NULL))
+	if (curr == NULL)
 		return -EINVAL;
 
 	if (curr->is_bound == TRUE) {
@@ -353,10 +372,10 @@
 		return -EINVAL;
 	}
 	if (curr->is_flushed == FALSE) {
-		agp_bridge->driver->cache_flush();
+		curr->bridge->driver->cache_flush();
 		curr->is_flushed = TRUE;
 	}
-	ret_val = agp_bridge->driver->insert_memory(curr, pg_start, curr->type);
+	ret_val = curr->bridge->driver->insert_memory(curr, pg_start, curr->type);
 
 	if (ret_val != 0)
 		return ret_val;
@@ -380,7 +399,7 @@
 {
 	int ret_val;
 
-	if ((agp_bridge->type == NOT_SUPPORTED) || (curr == NULL))
+	if (curr == NULL)
 		return -EINVAL;
 
 	if (curr->is_bound != TRUE) {
@@ -388,7 +407,7 @@
 		return -EINVAL;
 	}
 
-	ret_val = agp_bridge->driver->remove_memory(curr, curr->pg_start, curr->type);
+	ret_val = curr->bridge->driver->remove_memory(curr, curr->pg_start, curr->type);
 
 	if (ret_val != 0)
 		return ret_val;
@@ -403,71 +422,137 @@
 
 
 /* Generic Agp routines - Start */
-static void agp_v2_parse_one(u32 *mode, u32 *cmd, u32 *tmp)
+static void agp_v2_parse_one(u32 *requested_mode, u32 *bridge_agpstat, u32 *vga_agpstat)
 {
+	u32 tmp;
+
+	if (*requested_mode & AGP2_RESERVED_MASK) {
+		printk (KERN_INFO PFX "reserved bits set in mode 0x%x. Fixed.\n", *requested_mode);
+		*requested_mode &= ~AGP2_RESERVED_MASK;
+	}
+
+	/* Check the speed bits make sense. Only one should be set. */
+	tmp = *requested_mode & 7;
+	switch (tmp) {
+		case 0:
+			printk (KERN_INFO PFX "%s tried to set rate=x0. Setting to x1 mode.\n", current->comm);
+			*requested_mode |= AGPSTAT2_1X;
+			break;
+		case 1:
+		case 2:
+			break;
+		case 3:
+			*requested_mode &= ~(AGPSTAT2_1X);	/* rate=2 */
+			break;
+		case 4:
+			break;
+		case 5:
+		case 6:
+		case 7:
+			*requested_mode &= ~(AGPSTAT2_1X|AGPSTAT2_2X); /* rate=4*/
+			break;
+	}
+
 	/* disable SBA if it's not supported */
-	if (!((*cmd & AGPSTAT_SBA) && (*tmp & AGPSTAT_SBA) && (*mode & AGPSTAT_SBA)))
-		*cmd &= ~AGPSTAT_SBA;
+	if (!((*bridge_agpstat & AGPSTAT_SBA) && (*vga_agpstat & AGPSTAT_SBA) && (*requested_mode & AGPSTAT_SBA)))
+		*bridge_agpstat &= ~AGPSTAT_SBA;
 
-	/* Set speed */
-	if (!((*cmd & AGPSTAT2_4X) && (*tmp & AGPSTAT2_4X) && (*mode & AGPSTAT2_4X)))
-		*cmd &= ~AGPSTAT2_4X;
+	/* Set rate */
+	if (!((*bridge_agpstat & AGPSTAT2_4X) && (*vga_agpstat & AGPSTAT2_4X) && (*requested_mode & AGPSTAT2_4X)))
+		*bridge_agpstat &= ~AGPSTAT2_4X;
 
-	if (!((*cmd & AGPSTAT2_2X) && (*tmp & AGPSTAT2_2X) && (*mode & AGPSTAT2_2X)))
-		*cmd &= ~AGPSTAT2_2X;
+	if (!((*bridge_agpstat & AGPSTAT2_2X) && (*vga_agpstat & AGPSTAT2_2X) && (*requested_mode & AGPSTAT2_2X)))
+		*bridge_agpstat &= ~AGPSTAT2_2X;
 
-	if (!((*cmd & AGPSTAT2_1X) && (*tmp & AGPSTAT2_1X) && (*mode & AGPSTAT2_1X)))
-		*cmd &= ~AGPSTAT2_1X;
+	if (!((*bridge_agpstat & AGPSTAT2_1X) && (*vga_agpstat & AGPSTAT2_1X) && (*requested_mode & AGPSTAT2_1X)))
+		*bridge_agpstat &= ~AGPSTAT2_1X;
 
 	/* Now we know what mode it should be, clear out the unwanted bits. */
-	if (*cmd & AGPSTAT2_4X)
-		*cmd &= ~(AGPSTAT2_1X | AGPSTAT2_2X);	/* 4X */
+	if (*bridge_agpstat & AGPSTAT2_4X)
+		*bridge_agpstat &= ~(AGPSTAT2_1X | AGPSTAT2_2X);	/* 4X */
+
+	if (*bridge_agpstat & AGPSTAT2_2X)
+		*bridge_agpstat &= ~(AGPSTAT2_1X | AGPSTAT2_4X);	/* 2X */
+
+	if (*bridge_agpstat & AGPSTAT2_1X)
+		*bridge_agpstat &= ~(AGPSTAT2_2X | AGPSTAT2_4X);	/* 1X */
+
+	/* Apply any errata. */
+	if (agp_bridge->flags & AGP_ERRATA_FASTWRITES)
+		*bridge_agpstat &= ~AGPSTAT_FW;
 
-	if (*cmd & AGPSTAT2_2X)
-		*cmd &= ~(AGPSTAT2_1X | AGPSTAT2_4X);	/* 2X */
+	if (agp_bridge->flags & AGP_ERRATA_SBA)
+		*bridge_agpstat &= ~AGPSTAT_SBA;
 
-	if (*cmd & AGPSTAT2_1X)
-		*cmd &= ~(AGPSTAT2_2X | AGPSTAT2_4X);	/* 1X */
+	if (agp_bridge->flags & AGP_ERRATA_1X) {
+		*bridge_agpstat &= ~(AGPSTAT2_2X | AGPSTAT2_4X);
+		*bridge_agpstat |= AGPSTAT2_1X;
+	}
+
+	/* If we've dropped down to 1X, disable fast writes. */
+	if (*bridge_agpstat & AGPSTAT2_1X)
+		*bridge_agpstat &= ~AGPSTAT_FW;
 }
 
 /*
- * mode = requested mode.
- * cmd = PCI_AGP_STATUS from agp bridge.
- * tmp = PCI_AGP_STATUS from graphic card.
+ * requested_mode = Mode requested by (typically) X.
+ * bridge_agpstat = PCI_AGP_STATUS from agp bridge.
+ * vga_agpstat = PCI_AGP_STATUS from graphic card.
  */
-static void agp_v3_parse_one(u32 *mode, u32 *cmd, u32 *tmp)
+static void agp_v3_parse_one(u32 *requested_mode, u32 *bridge_agpstat, u32 *vga_agpstat)
 {
-	u32 origcmd=*cmd, origtmp=*tmp;
+	u32 origbridge=*bridge_agpstat, origvga=*vga_agpstat;
+	u32 tmp;
+
+	if (*requested_mode & AGP3_RESERVED_MASK) {
+		printk (KERN_INFO PFX "reserved bits set in mode 0x%x. Fixed.\n", *requested_mode);
+		*requested_mode &= ~AGP3_RESERVED_MASK;
+	}
+
+	/* Check the speed bits make sense. */
+	tmp = *requested_mode & 7;
+	if (tmp == 0) {
+		printk (KERN_INFO PFX "%s tried to set rate=x0. Setting to AGP3 x4 mode.\n", current->comm);
+		*requested_mode |= AGPSTAT3_4X;
+	}
+	if (tmp == 3) {
+		printk (KERN_INFO PFX "%s tried to set rate=x3. Setting to AGP3 x4 mode.\n", current->comm);
+		*requested_mode |= AGPSTAT3_4X;
+	}
+	if (tmp >3) {
+		printk (KERN_INFO PFX "%s tried to set rate=x%d. Setting to AGP3 x8 mode.\n", current->comm, tmp);
+		*requested_mode |= AGPSTAT3_8X;
+	}
 
 	/* ARQSZ - Set the value to the maximum one.
 	 * Don't allow the mode register to override values. */
-	*cmd = ((*cmd & ~AGPSTAT_ARQSZ) |
-		max_t(u32,(*cmd & AGPSTAT_ARQSZ),(*tmp & AGPSTAT_ARQSZ)));
+	*bridge_agpstat = ((*bridge_agpstat & ~AGPSTAT_ARQSZ) |
+		max_t(u32,(*bridge_agpstat & AGPSTAT_ARQSZ),(*vga_agpstat & AGPSTAT_ARQSZ)));
 
 	/* Calibration cycle.
 	 * Don't allow the mode register to override values. */
-	*cmd = ((*cmd & ~AGPSTAT_CAL_MASK) |
-		min_t(u32,(*cmd & AGPSTAT_CAL_MASK),(*tmp & AGPSTAT_CAL_MASK)));
+	*bridge_agpstat = ((*bridge_agpstat & ~AGPSTAT_CAL_MASK) |
+		min_t(u32,(*bridge_agpstat & AGPSTAT_CAL_MASK),(*vga_agpstat & AGPSTAT_CAL_MASK)));
 
 	/* SBA *must* be supported for AGP v3 */
-	*cmd |= AGPSTAT_SBA;
+	*bridge_agpstat |= AGPSTAT_SBA;
 
 	/*
 	 * Set speed.
 	 * Check for invalid speeds. This can happen when applications
 	 * written before the AGP 3.0 standard pass AGP2.x modes to AGP3 hardware
 	 */
-	if (*mode & AGPSTAT_MODE_3_0) {
+	if (*requested_mode & AGPSTAT_MODE_3_0) {
 		/*
-		 * Caller hasn't a clue what its doing. We are in 3.0 mode,
+		 * Caller hasn't a clue what it is doing. Bridge is in 3.0 mode,
 		 * have been passed a 3.0 mode, but with 2.x speed bits set.
 		 * AGP2.x 4x -> AGP3.0 4x.
 		 */
-		if (*mode & AGPSTAT2_4X) {
+		if (*requested_mode & AGPSTAT2_4X) {
 			printk (KERN_INFO PFX "%s passes broken AGP3 flags (%x). Fixed.\n",
-						current->comm, *mode);
-			*mode &= ~AGPSTAT2_4X;
-			*mode |= AGPSTAT3_4X;
+						current->comm, *requested_mode);
+			*requested_mode &= ~AGPSTAT2_4X;
+			*requested_mode |= AGPSTAT3_4X;
 		}
 	} else {
 		/*
@@ -476,27 +561,27 @@
 		 * Convert AGP 1x,2x,4x -> AGP 3.0 4x.
 		 */
 		printk (KERN_INFO PFX "%s passes broken AGP2 flags (%x) in AGP3 mode. Fixed.\n",
-					current->comm, *mode);
-		*mode &= ~(AGPSTAT2_4X | AGPSTAT2_2X | AGPSTAT2_1X);
-		*mode |= AGPSTAT3_4X;
+					current->comm, *requested_mode);
+		*requested_mode &= ~(AGPSTAT2_4X | AGPSTAT2_2X | AGPSTAT2_1X);
+		*requested_mode |= AGPSTAT3_4X;
 	}
 
-	if (*mode & AGPSTAT3_8X) {
-		if (!(*cmd & AGPSTAT3_8X)) {
-			*cmd &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD);
-			*cmd |= AGPSTAT3_4X;
+	if (*requested_mode & AGPSTAT3_8X) {
+		if (!(*bridge_agpstat & AGPSTAT3_8X)) {
+			*bridge_agpstat &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD);
+			*bridge_agpstat |= AGPSTAT3_4X;
 			printk ("%s requested AGPx8 but bridge not capable.\n", current->comm);
 			return;
 		}
-		if (!(*tmp & AGPSTAT3_8X)) {
-			*cmd &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD);
-			*cmd |= AGPSTAT3_4X;
+		if (!(*vga_agpstat & AGPSTAT3_8X)) {
+			*bridge_agpstat &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD);
+			*bridge_agpstat |= AGPSTAT3_4X;
 			printk ("%s requested AGPx8 but graphic card not capable.\n", current->comm);
 			return;
 		}
 		/* All set, bridge & device can do AGP x8*/
-		*cmd &= ~(AGPSTAT3_4X | AGPSTAT3_RSVD);
-		return;
+		*bridge_agpstat &= ~(AGPSTAT3_4X | AGPSTAT3_RSVD);
+		goto done;
 
 	} else {
 
@@ -505,71 +590,105 @@
 		 * If the hardware can't do x4, we're up shit creek, and never
 		 *  should have got this far.
 		 */
-		*cmd &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD);
-		if ((*cmd & AGPSTAT3_4X) && (*tmp & AGPSTAT3_4X))
-			*cmd |= AGPSTAT3_4X;
+		*bridge_agpstat &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD);
+		if ((*bridge_agpstat & AGPSTAT3_4X) && (*vga_agpstat & AGPSTAT3_4X))
+			*bridge_agpstat |= AGPSTAT3_4X;
 		else {
 			printk (KERN_INFO PFX "Badness. Don't know which AGP mode to set. "
-							"[cmd:%x tmp:%x fell back to:- cmd:%x tmp:%x]\n",
-							origcmd, origtmp, *cmd, *tmp);
-			if (!(*cmd & AGPSTAT3_4X))
+							"[bridge_agpstat:%x vga_agpstat:%x fell back to:- bridge_agpstat:%x vga_agpstat:%x]\n",
+							origbridge, origvga, *bridge_agpstat, *vga_agpstat);
+			if (!(*bridge_agpstat & AGPSTAT3_4X))
 				printk (KERN_INFO PFX "Bridge couldn't do AGP x4.\n");
-			if (!(*tmp & AGPSTAT3_4X))
+			if (!(*vga_agpstat & AGPSTAT3_4X))
 				printk (KERN_INFO PFX "Graphic card couldn't do AGP x4.\n");
+			return;
 		}
 	}
+
+done:
+	/* Apply any errata. */
+	if (agp_bridge->flags & AGP_ERRATA_FASTWRITES)
+		*bridge_agpstat &= ~AGPSTAT_FW;
+
+	if (agp_bridge->flags & AGP_ERRATA_SBA)
+		*bridge_agpstat &= ~AGPSTAT_SBA;
+
+	if (agp_bridge->flags & AGP_ERRATA_1X) {
+		*bridge_agpstat &= ~(AGPSTAT2_2X | AGPSTAT2_4X);
+		*bridge_agpstat |= AGPSTAT2_1X;
+	}
 }
 
-//FIXME: This doesn't smell right.
-//We need a function we pass an agp_device to.
-u32 agp_collect_device_status(u32 mode, u32 cmd)
+
+/**
+ * agp_collect_device_status - determine correct agp_cmd from various agp_stat's
+ * @bridge: an agp_bridge_data struct allocated for the AGP host bridge.
+ * @requested_mode: requested agp_stat from userspace (Typically from X)
+ * @bridge_agpstat: current agp_stat from AGP bridge.
+ *
+ * This function will hunt for an AGP graphics card, and try to match
+ * the requested mode to the capabilities of both the bridge and the card.
+ */
+u32 agp_collect_device_status(struct agp_bridge_data *bridge, u32 requested_mode, u32 bridge_agpstat)
 {
 	struct pci_dev *device = NULL;
-	u8 cap_ptr;
-	u32 tmp;
-	u32 agp3;
+	u8 cap_ptr = 0;
+	u32 vga_agpstat;
 
-	for_each_pci_dev(device) {
+	while (!cap_ptr) {
+		device = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, device);
+		if (!device) {
+			printk (KERN_INFO PFX "Couldn't find an AGP VGA controller.\n");
+			return 0;
+		}
 		cap_ptr = pci_find_capability(device, PCI_CAP_ID_AGP);
-		if (!cap_ptr)
+		if (!cap_ptr) {
+			pci_dev_put(device);
+			continue;
+		}
+		if ((device->bus->self->vendor != bridge->dev->vendor) &&
+			(device->bus->self->device != bridge->dev->device)) {
+			pci_dev_put(device);
+			cap_ptr = 0;
 			continue;
-
-		//FIXME: We should probably skip anything here that
-		// isn't an AGP graphic card.
-		/*
-		 * Ok, here we have a AGP device. Disable impossible
-		 * settings, and adjust the readqueue to the minimum.
-		 */
-		pci_read_config_dword(device, cap_ptr+PCI_AGP_STATUS, &tmp);
-
-		/* adjust RQ depth */
-		cmd = ((cmd & ~AGPSTAT_RQ_DEPTH) |
-		     min_t(u32, (mode & AGPSTAT_RQ_DEPTH),
-			 min_t(u32, (cmd & AGPSTAT_RQ_DEPTH), (tmp & AGPSTAT_RQ_DEPTH))));
-
-		/* disable FW if it's not supported */
-		if (!((cmd & AGPSTAT_FW) && (tmp & AGPSTAT_FW) && (mode & AGPSTAT_FW)))
-			cmd &= ~AGPSTAT_FW;
-
-		/* Check to see if we are operating in 3.0 mode */
-		pci_read_config_dword(device, cap_ptr+AGPSTAT, &agp3);
-		if (agp3 & AGPSTAT_MODE_3_0) {
-			agp_v3_parse_one(&mode, &cmd, &tmp);
-		} else {
-			agp_v2_parse_one(&mode, &cmd, &tmp);
 		}
 	}
-	return cmd;
+
+	/*
+	 * Ok, here we have a AGP device. Disable impossible
+	 * settings, and adjust the readqueue to the minimum.
+	 */
+	pci_read_config_dword(device, cap_ptr+PCI_AGP_STATUS, &vga_agpstat);
+
+	/* adjust RQ depth */
+	bridge_agpstat = ((bridge_agpstat & ~AGPSTAT_RQ_DEPTH) |
+	     min_t(u32, (requested_mode & AGPSTAT_RQ_DEPTH),
+		 min_t(u32, (bridge_agpstat & AGPSTAT_RQ_DEPTH), (vga_agpstat & AGPSTAT_RQ_DEPTH))));
+
+	/* disable FW if it's not supported */
+	if (!((bridge_agpstat & AGPSTAT_FW) &&
+		 (vga_agpstat & AGPSTAT_FW) &&
+		 (requested_mode & AGPSTAT_FW)))
+		bridge_agpstat &= ~AGPSTAT_FW;
+
+	/* Check to see if we are operating in 3.0 mode */
+	if (check_bridge_mode(agp_bridge->dev))
+		agp_v3_parse_one(&requested_mode, &bridge_agpstat, &vga_agpstat);
+	else
+		agp_v2_parse_one(&requested_mode, &bridge_agpstat, &vga_agpstat);
+
+	pci_dev_put(device);
+	return bridge_agpstat;
 }
 EXPORT_SYMBOL(agp_collect_device_status);
 
 
-void agp_device_command(u32 command, int agp_v3)
+void agp_device_command(u32 bridge_agpstat, int agp_v3)
 {
 	struct pci_dev *device = NULL;
 	int mode;
 
-	mode = command & 0x7;
+	mode = bridge_agpstat & 0x7;
 	if (agp_v3)
 		mode *= 4;
 
@@ -580,7 +699,7 @@
 
 		printk(KERN_INFO PFX "Putting AGP V%d device at %s into %dx mode\n",
 				agp_v3 ? 3 : 2, pci_name(device), mode);
-		pci_write_config_dword(device, agp + PCI_AGP_COMMAND, command);
+		pci_write_config_dword(device, agp + PCI_AGP_COMMAND, bridge_agpstat);
 	}
 }
 EXPORT_SYMBOL(agp_device_command);
@@ -591,52 +710,53 @@
 	u32 ncapid;
 
 	/* Exit early if already set by errata workarounds. */
-	if (agp_bridge->major_version != 0)
+	if (bridge->major_version != 0)
 		return;
 
-	pci_read_config_dword(agp_bridge->dev, agp_bridge->capndx, &ncapid);
-	agp_bridge->major_version = (ncapid >> AGP_MAJOR_VERSION_SHIFT) & 0xf;
-	agp_bridge->minor_version = (ncapid >> AGP_MINOR_VERSION_SHIFT) & 0xf;
+	pci_read_config_dword(bridge->dev, bridge->capndx, &ncapid);
+	bridge->major_version = (ncapid >> AGP_MAJOR_VERSION_SHIFT) & 0xf;
+	bridge->minor_version = (ncapid >> AGP_MINOR_VERSION_SHIFT) & 0xf;
 }
 EXPORT_SYMBOL(get_agp_version);
 
 
-void agp_generic_enable(u32 mode)
+void agp_generic_enable(struct agp_bridge_data *bridge, u32 requested_mode)
 {
-	u32 command, temp;
-	u32 agp3;
+	u32 bridge_agpstat, temp;
 
 	get_agp_version(agp_bridge);
 
 	printk(KERN_INFO PFX "Found an AGP %d.%d compliant device at %s.\n",
 				agp_bridge->major_version,
 				agp_bridge->minor_version,
-				agp_bridge->dev->slot_name);
+				pci_name(agp_bridge->dev));
 
 	pci_read_config_dword(agp_bridge->dev,
-		      agp_bridge->capndx + PCI_AGP_STATUS, &command);
+		      agp_bridge->capndx + PCI_AGP_STATUS, &bridge_agpstat);
+
+	bridge_agpstat = agp_collect_device_status(agp_bridge, requested_mode, bridge_agpstat);
+	if (bridge_agpstat == 0)
+		/* Something bad happened. FIXME: Return error code? */
+		return;
 
-	command = agp_collect_device_status(mode, command);
-	command |= AGPSTAT_AGP_ENABLE;
+	bridge_agpstat |= AGPSTAT_AGP_ENABLE;
 
 	/* Do AGP version specific frobbing. */
-	if(agp_bridge->major_version >= 3) {
-		pci_read_config_dword(agp_bridge->dev,
-			agp_bridge->capndx+AGPSTAT, &agp3);
-
-		/* Check to see if we are operating in 3.0 mode */
-		if (agp3 & AGPSTAT_MODE_3_0) {
+	if (bridge->major_version >= 3) {
+		if (check_bridge_mode(bridge->dev)) {
 			/* If we have 3.5, we can do the isoch stuff. */
-			if (agp_bridge->minor_version >= 5)
-				agp_3_5_enable(agp_bridge);
-			agp_device_command(command, TRUE);
+			if (bridge->minor_version >= 5)
+				agp_3_5_enable(bridge);
+			agp_device_command(bridge_agpstat, TRUE);
 			return;
 		} else {
 		    /* Disable calibration cycle in RX91<1> when not in AGP3.0 mode of operation.*/
-		    command &= ~(7<<10) ;
-		    pci_read_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, &temp);
+		    bridge_agpstat &= ~(7<<10) ;
+		    pci_read_config_dword(bridge->dev,
+					bridge->capndx+AGPCTRL, &temp);
 		    temp |= (1<<9);
-		    pci_write_config_dword(agp_bridge->dev, agp_bridge->capndx+AGPCTRL, temp);
+		    pci_write_config_dword(bridge->dev,
+					bridge->capndx+AGPCTRL, temp);
 
 		    printk (KERN_INFO PFX "Device is in legacy mode,"
 				" falling back to 2.x\n");
@@ -644,12 +764,12 @@
 	}
 
 	/* AGP v<3 */
-	agp_device_command(command, FALSE);
+	agp_device_command(bridge_agpstat, FALSE);
 }
 EXPORT_SYMBOL(agp_generic_enable);
 
 
-int agp_generic_create_gatt_table(void)
+int agp_generic_create_gatt_table(struct agp_bridge_data *bridge)
 {
 	char *table;
 	char *table_end;
@@ -661,17 +781,17 @@
 	struct page *page;
 
 	/* The generic routines can't handle 2 level gatt's */
-	if (agp_bridge->driver->size_type == LVL2_APER_SIZE)
+	if (bridge->driver->size_type == LVL2_APER_SIZE)
 		return -EINVAL;
 
 	table = NULL;
-	i = agp_bridge->aperture_size_idx;
-	temp = agp_bridge->current_size;
+	i = bridge->aperture_size_idx;
+	temp = bridge->current_size;
 	size = page_order = num_entries = 0;
 
-	if (agp_bridge->driver->size_type != FIXED_APER_SIZE) {
+	if (bridge->driver->size_type != FIXED_APER_SIZE) {
 		do {
-			switch (agp_bridge->driver->size_type) {
+			switch (bridge->driver->size_type) {
 			case U8_APER_SIZE:
 				size = A_SIZE_8(temp)->size;
 				page_order =
@@ -702,29 +822,29 @@
 
 			if (table == NULL) {
 				i++;
-				switch (agp_bridge->driver->size_type) {
+				switch (bridge->driver->size_type) {
 				case U8_APER_SIZE:
-					agp_bridge->current_size = A_IDX8(agp_bridge);
+					bridge->current_size = A_IDX8(bridge);
 					break;
 				case U16_APER_SIZE:
-					agp_bridge->current_size = A_IDX16(agp_bridge);
+					bridge->current_size = A_IDX16(bridge);
 					break;
 				case U32_APER_SIZE:
-					agp_bridge->current_size = A_IDX32(agp_bridge);
+					bridge->current_size = A_IDX32(bridge);
 					break;
 					/* This case will never really happen. */
 				case FIXED_APER_SIZE:
 				case LVL2_APER_SIZE:
 				default:
-					agp_bridge->current_size =
-					    agp_bridge->current_size;
+					bridge->current_size =
+					    bridge->current_size;
 					break;
 				}
-				temp = agp_bridge->current_size;
+				temp = bridge->current_size;
 			} else {
-				agp_bridge->aperture_size_idx = i;
+				bridge->aperture_size_idx = i;
 			}
-		} while (!table && (i < agp_bridge->driver->num_aperture_sizes));
+		} while (!table && (i < bridge->driver->num_aperture_sizes));
 	} else {
 		size = ((struct aper_size_info_fixed *) temp)->size;
 		page_order = ((struct aper_size_info_fixed *) temp)->page_order;
@@ -740,15 +860,15 @@
 	for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
 		SetPageReserved(page);
 
-	agp_bridge->gatt_table_real = (u32 *) table;
+	bridge->gatt_table_real = (u32 *) table;
 	agp_gatt_table = (void *)table;
 
-	agp_bridge->driver->cache_flush();
-	agp_bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
+	bridge->driver->cache_flush();
+	bridge->gatt_table = ioremap_nocache(virt_to_phys(table),
 					(PAGE_SIZE * (1 << page_order)));
-	agp_bridge->driver->cache_flush();
+	bridge->driver->cache_flush();
 
-	if (agp_bridge->gatt_table == NULL) {
+	if (bridge->gatt_table == NULL) {
 		for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
 			ClearPageReserved(page);
 
@@ -756,28 +876,28 @@
 
 		return -ENOMEM;
 	}
-	agp_bridge->gatt_bus_addr = virt_to_phys(agp_bridge->gatt_table_real);
+	bridge->gatt_bus_addr = virt_to_phys(bridge->gatt_table_real);
 
 	/* AK: bogus, should encode addresses > 4GB */
 	for (i = 0; i < num_entries; i++) {
-		writel(agp_bridge->scratch_page, agp_bridge->gatt_table+i);
-		readl(agp_bridge->gatt_table+i);	/* PCI Posting. */
+		writel(bridge->scratch_page, bridge->gatt_table+i);
+		readl(bridge->gatt_table+i);	/* PCI Posting. */
 	}
 
 	return 0;
 }
 EXPORT_SYMBOL(agp_generic_create_gatt_table);
 
-int agp_generic_free_gatt_table(void)
+int agp_generic_free_gatt_table(struct agp_bridge_data *bridge)
 {
 	int page_order;
 	char *table, *table_end;
 	void *temp;
 	struct page *page;
 
-	temp = agp_bridge->current_size;
+	temp = bridge->current_size;
 
-	switch (agp_bridge->driver->size_type) {
+	switch (bridge->driver->size_type) {
 	case U8_APER_SIZE:
 		page_order = A_SIZE_8(temp)->page_order;
 		break;
@@ -803,19 +923,19 @@
 	 * called, then all agp memory is deallocated and removed
 	 * from the table. */
 
-	iounmap(agp_bridge->gatt_table);
-	table = (char *) agp_bridge->gatt_table_real;
+	iounmap(bridge->gatt_table);
+	table = (char *) bridge->gatt_table_real;
 	table_end = table + ((PAGE_SIZE * (1 << page_order)) - 1);
 
 	for (page = virt_to_page(table); page <= virt_to_page(table_end); page++)
 		ClearPageReserved(page);
 
-	free_pages((unsigned long) agp_bridge->gatt_table_real, page_order);
+	free_pages((unsigned long) bridge->gatt_table_real, page_order);
 
 	agp_gatt_table = NULL;
-	agp_bridge->gatt_table = NULL;
-	agp_bridge->gatt_table_real = NULL;
-	agp_bridge->gatt_bus_addr = 0;
+	bridge->gatt_table = NULL;
+	bridge->gatt_table_real = NULL;
+	bridge->gatt_bus_addr = 0;
 
 	return 0;
 }
@@ -828,10 +948,15 @@
 	size_t i;
 	off_t j;
 	void *temp;
+	struct agp_bridge_data *bridge;
 
-	temp = agp_bridge->current_size;
+	bridge = mem->bridge;
+	if (!bridge)
+		return -EINVAL;
 
-	switch (agp_bridge->driver->size_type) {
+	temp = bridge->current_size;
+
+	switch (bridge->driver->size_type) {
 	case U8_APER_SIZE:
 		num_entries = A_SIZE_8(temp)->num_entries;
 		break;
@@ -868,22 +993,22 @@
 	j = pg_start;
 
 	while (j < (pg_start + mem->page_count)) {
-		if (!PGE_EMPTY(agp_bridge, readl(agp_bridge->gatt_table+j)))
+		if (!PGE_EMPTY(bridge, readl(bridge->gatt_table+j)))
 			return -EBUSY;
 		j++;
 	}
 
 	if (mem->is_flushed == FALSE) {
-		agp_bridge->driver->cache_flush();
+		bridge->driver->cache_flush();
 		mem->is_flushed = TRUE;
 	}
 
 	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
-		writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), agp_bridge->gatt_table+j);
-		readl(agp_bridge->gatt_table+j);	/* PCI Posting. */
+		writel(bridge->driver->mask_memory(bridge, mem->memory[i], mem->type), bridge->gatt_table+j);
+		readl(bridge->gatt_table+j);	/* PCI Posting. */
 	}
 
-	agp_bridge->driver->tlb_flush(mem);
+	bridge->driver->tlb_flush(mem);
 	return 0;
 }
 EXPORT_SYMBOL(agp_generic_insert_memory);
@@ -892,6 +1017,11 @@
 int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
 {
 	size_t i;
+	struct agp_bridge_data *bridge;
+
+	bridge = mem->bridge;
+	if (!bridge)
+		return -EINVAL;
 
 	if (type != 0 || mem->type != 0) {
 		/* The generic routines know nothing of memory types */
@@ -900,12 +1030,12 @@
 
 	/* AK: bogus, should encode addresses > 4GB */
 	for (i = pg_start; i < (mem->page_count + pg_start); i++) {
-		writel(agp_bridge->scratch_page, agp_bridge->gatt_table+i);
-		readl(agp_bridge->gatt_table+i);	/* PCI Posting. */
+		writel(bridge->scratch_page, bridge->gatt_table+i);
+		readl(bridge->gatt_table+i);	/* PCI Posting. */
 	}
 
 	global_cache_flush();
-	agp_bridge->driver->tlb_flush(mem);
+	bridge->driver->tlb_flush(mem);
 	return 0;
 }
 EXPORT_SYMBOL(agp_generic_remove_memory);
@@ -920,9 +1050,7 @@
 
 void agp_generic_free_by_type(struct agp_memory *curr)
 {
-	if (curr->memory != NULL)
-		vfree(curr->memory);
-
+	vfree(curr->memory);
 	agp_free_key(curr->key);
 	kfree(curr);
 }
@@ -936,7 +1064,7 @@
  * against a maximum value.
  */
 
-void *agp_generic_alloc_page(void)
+void *agp_generic_alloc_page(struct agp_bridge_data *bridge)
 {
 	struct page * page;
 
@@ -978,14 +1106,25 @@
  *
  * @mode:	agp mode register value to configure with.
  */
-void agp_enable(u32 mode)
+void agp_enable(struct agp_bridge_data *bridge, u32 mode)
 {
-	if (agp_bridge->type == NOT_SUPPORTED)
+	if (!bridge)
 		return;
-	agp_bridge->driver->agp_enable(mode);
+	bridge->driver->agp_enable(bridge, mode);
 }
 EXPORT_SYMBOL(agp_enable);
 
+/* When we remove the global variable agp_bridge from all drivers
+ * then agp_alloc_bridge and agp_generic_find_bridge need to be updated
+ */
+
+struct agp_bridge_data *agp_generic_find_bridge(struct pci_dev *pdev)
+{
+	if (list_empty(&agp_bridges))
+		return NULL;
+
+	return agp_bridge;
+}
 
 static void ipi_handler(void *null)
 {
@@ -999,11 +1138,12 @@
 }
 EXPORT_SYMBOL(global_cache_flush);
 
-unsigned long agp_generic_mask_memory(unsigned long addr, int type)
+unsigned long agp_generic_mask_memory(struct agp_bridge_data *bridge,
+	unsigned long addr, int type)
 {
 	/* memory type is ignored in the generic routine */
-	if (agp_bridge->driver->masks)
-		return addr | agp_bridge->driver->masks[0].mask;
+	if (bridge->driver->masks)
+		return addr | bridge->driver->masks[0].mask;
 	else
 		return addr;
 }
diff -Nru a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c
--- a/drivers/char/agp/hp-agp.c	2004-12-22 15:25:04 -08:00
+++ b/drivers/char/agp/hp-agp.c	2005-02-23 16:36:05 -08:00
@@ -289,7 +289,7 @@
 }
 
 static int
-hp_zx1_create_gatt_table (void)
+hp_zx1_create_gatt_table (struct agp_bridge_data *bridge)
 {
 	struct _hp_private *hp = &hp_private;
 	int i;
@@ -317,7 +317,7 @@
 }
 
 static int
-hp_zx1_free_gatt_table (void)
+hp_zx1_free_gatt_table (struct agp_bridge_data *bridge)
 {
 	struct _hp_private *hp = &hp_private;
 
@@ -367,7 +367,9 @@
 		for (k = 0;
 		     k < hp->io_pages_per_kpage;
 		     k++, j++, paddr += hp->io_page_size) {
-			hp->gatt[j] = agp_bridge->driver->mask_memory(paddr, type);
+			hp->gatt[j] =
+				agp_bridge->driver->mask_memory(agp_bridge,
+					paddr, type);
 		}
 	}
 
@@ -396,19 +398,20 @@
 }
 
 static unsigned long
-hp_zx1_mask_memory (unsigned long addr, int type)
+hp_zx1_mask_memory (struct agp_bridge_data *bridge,
+	unsigned long addr, int type)
 {
 	return HP_ZX1_PDIR_VALID_BIT | addr;
 }
 
 static void
-hp_zx1_enable (u32 mode)
+hp_zx1_enable (struct agp_bridge_data *bridge, u32 mode)
 {
 	struct _hp_private *hp = &hp_private;
 	u32 command;
 
 	command = readl(hp->lba_regs+hp->lba_cap_offset+PCI_AGP_STATUS);
-	command = agp_collect_device_status(mode, command);
+	command = agp_collect_device_status(bridge, mode, command);
 	command |= 0x00000100;
 
 	writel(command, hp->lba_regs+hp->lba_cap_offset+PCI_AGP_COMMAND);
diff -Nru a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c
--- a/drivers/char/agp/i460-agp.c	2004-12-22 15:25:04 -08:00
+++ b/drivers/char/agp/i460-agp.c	2005-02-23 16:36:05 -08:00
@@ -233,7 +233,7 @@
 	return 0;
 }
 
-static int i460_create_gatt_table (void)
+static int i460_create_gatt_table (struct agp_bridge_data *bridge)
 {
 	int page_order, num_entries, i;
 	void *temp;
@@ -258,7 +258,7 @@
 	return 0;
 }
 
-static int i460_free_gatt_table (void)
+static int i460_free_gatt_table (struct agp_bridge_data *bridge)
 {
 	int num_entries, i;
 	void *temp;
@@ -314,7 +314,8 @@
 	for (i = 0, j = io_pg_start; i < mem->page_count; i++) {
 		paddr = mem->memory[i];
 		for (k = 0; k < I460_IOPAGES_PER_KPAGE; k++, j++, paddr += io_page_size)
-			WR_GATT(j, agp_bridge->driver->mask_memory(paddr, mem->type));
+			WR_GATT(j, agp_bridge->driver->mask_memory(agp_bridge,
+				paddr, mem->type));
 	}
 	WR_FLUSH_GATT(j - 1);
 	return 0;
@@ -427,7 +428,8 @@
 			if (i460_alloc_large_page(lp) < 0)
 				return -ENOMEM;
 			pg = lp - i460.lp_desc;
-			WR_GATT(pg, agp_bridge->driver->mask_memory(lp->paddr, 0));
+			WR_GATT(pg, agp_bridge->driver->mask_memory(agp_bridge,
+				lp->paddr, 0));
 			WR_FLUSH_GATT(pg);
 		}
 
@@ -508,12 +510,12 @@
  * Let's just hope nobody counts on the allocated AGP memory being there before bind time
  * (I don't think current drivers do)...
  */
-static void *i460_alloc_page (void)
+static void *i460_alloc_page (struct agp_bridge_data *bridge)
 {
 	void *page;
 
 	if (I460_IO_PAGE_SHIFT <= PAGE_SHIFT)
-		page = agp_generic_alloc_page();
+		page = agp_generic_alloc_page(agp_bridge);
 	else
 		/* Returning NULL would cause problems */
 		/* AK: really dubious code. */
@@ -529,10 +531,11 @@
 
 #endif /* I460_LARGE_IO_PAGES */
 
-static unsigned long i460_mask_memory (unsigned long addr, int type)
+static unsigned long i460_mask_memory (struct agp_bridge_data *bridge,
+	unsigned long addr, int type)
 {
 	/* Make sure the returned address is a valid GATT entry */
-	return agp_bridge->driver->masks[0].mask
+	return bridge->driver->masks[0].mask
 		| (((addr & ~((1 << I460_IO_PAGE_SHIFT) - 1)) & 0xffffff000) >> 12);
 }
 
@@ -624,7 +627,7 @@
 {
 	if (agp_off)
 		return -EINVAL;
-	return pci_module_init(&agp_intel_i460_pci_driver);
+	return pci_register_driver(&agp_intel_i460_pci_driver);
 }
 
 static void __exit agp_intel_i460_cleanup(void)
diff -Nru a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
--- a/drivers/char/agp/intel-agp.c	2005-02-07 18:25:10 -08:00
+++ b/drivers/char/agp/intel-agp.c	2005-02-23 16:36:05 -08:00
@@ -150,7 +150,7 @@
 	return;
 }
 
-static void intel_i810_agp_enable(u32 mode)
+static void intel_i810_agp_enable(struct agp_bridge_data *bridge, u32 mode)
 {
 	return;
 }
@@ -229,8 +229,9 @@
 insert:
 	global_cache_flush();
 	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
-		writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type),
-				intel_i810_private.registers+I810_PTE_BASE+(j*4));
+		writel(agp_bridge->driver->mask_memory(agp_bridge,
+			mem->memory[i], mem->type),
+			intel_i810_private.registers+I810_PTE_BASE+(j*4));
 		readl(intel_i810_private.registers+I810_PTE_BASE+(j*4));	/* PCI Posting. */
 	}
 	global_cache_flush();
@@ -268,7 +269,7 @@
 		return NULL;
 
 	switch (pg_count) {
-	case 1: addr = agp_bridge->driver->agp_alloc_page();
+	case 1: addr = agp_bridge->driver->agp_alloc_page(agp_bridge);
 		break;
 	case 4:
 		/* kludge to get 4 physical pages for ARGB cursor */
@@ -337,10 +338,11 @@
 	kfree(curr);
 }
 
-static unsigned long intel_i810_mask_memory(unsigned long addr, int type)
+static unsigned long intel_i810_mask_memory(struct agp_bridge_data *bridge,
+	unsigned long addr, int type)
 {
 	/* Type checking must be done elsewhere */
-	return addr | agp_bridge->driver->masks[type].mask;
+	return addr | bridge->driver->masks[type].mask;
 }
 
 static struct aper_size_info_fixed intel_i830_sizes[] =
@@ -447,7 +449,7 @@
 /* The intel i830 automatically initializes the agp aperture during POST.
  * Use the memory already set aside for in the GTT.
  */
-static int intel_i830_create_gatt_table(void)
+static int intel_i830_create_gatt_table(struct agp_bridge_data *bridge)
 {
 	int page_order;
 	struct aper_size_info_fixed *size;
@@ -482,7 +484,7 @@
 /* Return the gatt table to a sane state. Use the top of stolen
  * memory for the GTT.
  */
-static int intel_i830_free_gatt_table(void)
+static int intel_i830_free_gatt_table(struct agp_bridge_data *bridge)
 {
 	return 0;
 }
@@ -582,8 +584,9 @@
 	global_cache_flush();	/* FIXME: Necessary ?*/
 
 	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
-		writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type),
-				intel_i830_private.registers+I810_PTE_BASE+(j*4));
+		writel(agp_bridge->driver->mask_memory(agp_bridge,
+			mem->memory[i], mem->type),
+			intel_i830_private.registers+I810_PTE_BASE+(j*4));
 		readl(intel_i830_private.registers+I810_PTE_BASE+(j*4));	/* PCI Posting. */
 	}
 
@@ -691,7 +694,8 @@
 	global_cache_flush();
 
 	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
-		writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), intel_i830_private.gtt+j);
+		writel(agp_bridge->driver->mask_memory(agp_bridge,
+			mem->memory[i], mem->type), intel_i830_private.gtt+j);
 		readl(intel_i830_private.gtt+j);	/* PCI Posting. */
 	}
 
@@ -743,7 +747,7 @@
 /* The intel i915 automatically initializes the agp aperture during POST.
  * Use the memory already set aside for in the GTT.
  */
-static int intel_i915_create_gatt_table(void)
+static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge)
 {
 	int page_order;
 	struct aper_size_info_fixed *size;
@@ -1758,6 +1762,8 @@
 		intel_i915_configure();
 	else if (bridge->driver == &intel_830_driver)
 		intel_i830_configure();
+	else if (bridge->driver == &intel_810_driver)
+		intel_i810_configure();
 
 	return 0;
 }
@@ -1810,7 +1816,9 @@
 
 static int __init agp_intel_init(void)
 {
-	return pci_module_init(&agp_intel_pci_driver);
+	if (agp_off)
+		return -EINVAL;
+	return pci_register_driver(&agp_intel_pci_driver);
 }
 
 static void __exit agp_intel_cleanup(void)
diff -Nru a/drivers/char/agp/intel-mch-agp.c b/drivers/char/agp/intel-mch-agp.c
--- a/drivers/char/agp/intel-mch-agp.c	2005-01-19 20:42:31 -08:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,643 +0,0 @@
-/*
- * Intel MCH AGPGART routines.
- */
-
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/init.h>
-#include <linux/agp_backend.h>
-#include "agp.h"
-
-
-#define AGP_DCACHE_MEMORY	1
-#define AGP_PHYS_MEMORY		2
-
-static struct gatt_mask intel_i810_masks[] =
-{
-	{.mask = I810_PTE_VALID, .type = 0},
-	{.mask = (I810_PTE_VALID | I810_PTE_LOCAL), .type = AGP_DCACHE_MEMORY},
-	{.mask = I810_PTE_VALID, .type = 0}
-};
-
-static void intel_i810_tlbflush(struct agp_memory *mem)
-{
-	return;
-}
-
-static void intel_i810_agp_enable(u32 mode)
-{
-	return;
-}
-
-
-/*
- * The i810/i830 requires a physical address to program its mouse
- * pointer into hardware.
- * However the Xserver still writes to it through the agp aperture.
- */
-static struct agp_memory *alloc_agpphysmem_i8xx(size_t pg_count, int type)
-{
-	struct agp_memory *new;
-	void *addr;
-
-	if (pg_count != 1)
-		return NULL;
-
-	addr = agp_bridge->driver->agp_alloc_page();
-	if (addr == NULL)
-		return NULL;
-
-	new = agp_create_memory(1);
-	if (new == NULL)
-		return NULL;
-
-	new->memory[0] = virt_to_phys(addr);
-	new->page_count = 1;
-	new->num_scratch_pages = 1;
-	new->type = AGP_PHYS_MEMORY;
-	new->physical = new->memory[0];
-	return new;
-}
-
-static void intel_i810_free_by_type(struct agp_memory *curr)
-{
-	agp_free_key(curr->key);
-	if(curr->type == AGP_PHYS_MEMORY) {
-		agp_bridge->driver->agp_destroy_page(phys_to_virt(curr->memory[0]));
-		vfree(curr->memory);
-	}
-	kfree(curr);
-}
-
-static unsigned long intel_i810_mask_memory(unsigned long addr, int type)
-{
-	/* Type checking must be done elsewhere */
-	return addr | agp_bridge->driver->masks[type].mask;
-}
-
-static struct aper_size_info_fixed intel_i830_sizes[] =
-{
-	{128, 32768, 5},
-	/* The 64M mode still requires a 128k gatt */
-	{64, 16384, 5}
-};
-
-static struct _intel_i830_private {
-	struct pci_dev *i830_dev;		/* device one */
-	volatile u8 __iomem *registers;
-	int gtt_entries;
-} intel_i830_private;
-
-static void intel_i830_init_gtt_entries(void)
-{
-	u16 gmch_ctrl;
-	int gtt_entries;
-	u8 rdct;
-	int local = 0;
-	static const int ddt[4] = { 0, 16, 32, 64 };
-
-	pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl);
-
-	if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB ||
-	    agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) {
-		switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
-		case I830_GMCH_GMS_STOLEN_512:
-			gtt_entries = KB(512) - KB(132);
-			break;
-		case I830_GMCH_GMS_STOLEN_1024:
-			gtt_entries = MB(1) - KB(132);
-			break;
-		case I830_GMCH_GMS_STOLEN_8192:
-			gtt_entries = MB(8) - KB(132);
-			break;
-		case I830_GMCH_GMS_LOCAL:
-			rdct = readb(intel_i830_private.registers+I830_RDRAM_CHANNEL_TYPE);
-			gtt_entries = (I830_RDRAM_ND(rdct) + 1) *
-					MB(ddt[I830_RDRAM_DDT(rdct)]);
-			local = 1;
-			break;
-		default:
-			gtt_entries = 0;
-			break;
-		}
-	} else {
-		switch (gmch_ctrl & I830_GMCH_GMS_MASK) {
-		case I855_GMCH_GMS_STOLEN_1M:
-			gtt_entries = MB(1) - KB(132);
-			break;
-		case I855_GMCH_GMS_STOLEN_4M:
-			gtt_entries = MB(4) - KB(132);
-			break;
-		case I855_GMCH_GMS_STOLEN_8M:
-			gtt_entries = MB(8) - KB(132);
-			break;
-		case I855_GMCH_GMS_STOLEN_16M:
-			gtt_entries = MB(16) - KB(132);
-			break;
-		case I855_GMCH_GMS_STOLEN_32M:
-			gtt_entries = MB(32) - KB(132);
-			break;
-		default:
-			gtt_entries = 0;
-			break;
-		}
-	}
-	if (gtt_entries > 0)
-		printk(KERN_INFO PFX "Detected %dK %s memory.\n",
-		       gtt_entries / KB(1), local ? "local" : "stolen");
-	else
-		printk(KERN_INFO PFX
-		       "No pre-allocated video memory detected.\n");
-	gtt_entries /= KB(4);
-
-	intel_i830_private.gtt_entries = gtt_entries;
-}
-
-/* The intel i830 automatically initializes the agp aperture during POST.
- * Use the memory already set aside for in the GTT.
- */
-static int intel_i830_create_gatt_table(void)
-{
-	int page_order;
-	struct aper_size_info_fixed *size;
-	int num_entries;
-	u32 temp;
-
-	size = agp_bridge->current_size;
-	page_order = size->page_order;
-	num_entries = size->num_entries;
-	agp_bridge->gatt_table_real = NULL;
-
-	pci_read_config_dword(intel_i830_private.i830_dev,I810_MMADDR,&temp);
-	temp &= 0xfff80000;
-
-	intel_i830_private.registers = (volatile u8 __iomem*) ioremap(temp,128 * 4096);
-	if (!intel_i830_private.registers)
-		return -ENOMEM;
-
-	temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000;
-	global_cache_flush();	/* FIXME: ?? */
-
-	/* we have to call this as early as possible after the MMIO base address is known */
-	intel_i830_init_gtt_entries();
-
-	agp_bridge->gatt_table = NULL;
-
-	agp_bridge->gatt_bus_addr = temp;
-
-	return 0;
-}
-
-/* Return the gatt table to a sane state. Use the top of stolen
- * memory for the GTT.
- */
-static int intel_i830_free_gatt_table(void)
-{
-	return 0;
-}
-
-static int intel_i830_fetch_size(void)
-{
-	u16 gmch_ctrl;
-	struct aper_size_info_fixed *values;
-
-	values = A_SIZE_FIX(agp_bridge->driver->aperture_sizes);
-
-	if (agp_bridge->dev->device != PCI_DEVICE_ID_INTEL_82830_HB &&
-	    agp_bridge->dev->device != PCI_DEVICE_ID_INTEL_82845G_HB) {
-		/* 855GM/852GM/865G has 128MB aperture size */
-		agp_bridge->previous_size = agp_bridge->current_size = (void *) values;
-		agp_bridge->aperture_size_idx = 0;
-		return values[0].size;
-	}
-
-	pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl);
-
-	if ((gmch_ctrl & I830_GMCH_MEM_MASK) == I830_GMCH_MEM_128M) {
-		agp_bridge->previous_size = agp_bridge->current_size = (void *) values;
-		agp_bridge->aperture_size_idx = 0;
-		return values[0].size;
-	} else {
-		agp_bridge->previous_size = agp_bridge->current_size = (void *) values;
-		agp_bridge->aperture_size_idx = 1;
-		return values[1].size;
-	}
-
-	return 0;
-}
-
-static int intel_i830_configure(void)
-{
-	struct aper_size_info_fixed *current_size;
-	u32 temp;
-	u16 gmch_ctrl;
-	int i;
-
-	current_size = A_SIZE_FIX(agp_bridge->current_size);
-
-	pci_read_config_dword(intel_i830_private.i830_dev,I810_GMADDR,&temp);
-	agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
-
-	pci_read_config_word(agp_bridge->dev,I830_GMCH_CTRL,&gmch_ctrl);
-	gmch_ctrl |= I830_GMCH_ENABLED;
-	pci_write_config_word(agp_bridge->dev,I830_GMCH_CTRL,gmch_ctrl);
-
-	writel(agp_bridge->gatt_bus_addr|I810_PGETBL_ENABLED, intel_i830_private.registers+I810_PGETBL_CTL);
-	readl(intel_i830_private.registers+I810_PGETBL_CTL);	/* PCI Posting. */
-
-	if (agp_bridge->driver->needs_scratch_page) {
-		for (i = intel_i830_private.gtt_entries; i < current_size->num_entries; i++) {
-			writel(agp_bridge->scratch_page, intel_i830_private.registers+I810_PTE_BASE+(i*4));
-			readl(intel_i830_private.registers+I810_PTE_BASE+(i*4));	/* PCI Posting. */
-		}
-	}
-	global_cache_flush();
-	return 0;
-}
-
-static void intel_i830_cleanup(void)
-{
-	iounmap((void __iomem *) intel_i830_private.registers);
-}
-
-static int intel_i830_insert_entries(struct agp_memory *mem,off_t pg_start,
-				int type)
-{
-	int i,j,num_entries;
-	void *temp;
-
-	temp = agp_bridge->current_size;
-	num_entries = A_SIZE_FIX(temp)->num_entries;
-
-	if (pg_start < intel_i830_private.gtt_entries) {
-		printk (KERN_DEBUG PFX "pg_start == 0x%.8lx,intel_i830_private.gtt_entries == 0x%.8x\n",
-				pg_start,intel_i830_private.gtt_entries);
-
-		printk (KERN_INFO PFX "Trying to insert into local/stolen memory\n");
-		return -EINVAL;
-	}
-
-	if ((pg_start + mem->page_count) > num_entries)
-		return -EINVAL;
-
-	/* The i830 can't check the GTT for entries since its read only,
-	 * depend on the caller to make the correct offset decisions.
-	 */
-
-	if ((type != 0 && type != AGP_PHYS_MEMORY) ||
-		(mem->type != 0 && mem->type != AGP_PHYS_MEMORY))
-		return -EINVAL;
-
-	global_cache_flush();	/* FIXME: ?? */
-
-	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
-		writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type),
-				intel_i830_private.registers+I810_PTE_BASE+(j*4));
-		readl(intel_i830_private.registers+I810_PTE_BASE+(j*4));	/* PCI Posting. */
-	}
-
-	global_cache_flush();
-
-	agp_bridge->driver->tlb_flush(mem);
-
-	return 0;
-}
-
-static int intel_i830_remove_entries(struct agp_memory *mem,off_t pg_start,
-				int type)
-{
-	int i;
-
-	global_cache_flush();
-
-	if (pg_start < intel_i830_private.gtt_entries) {
-		printk (KERN_INFO PFX "Trying to disable local/stolen memory\n");
-		return -EINVAL;
-	}
-
-	for (i = pg_start; i < (mem->page_count + pg_start); i++) {
-		writel(agp_bridge->scratch_page, intel_i830_private.registers+I810_PTE_BASE+(i*4));
-		readl(intel_i830_private.registers+I810_PTE_BASE+(i*4));	/* PCI Posting. */
-	}
-
-	global_cache_flush();
-	agp_bridge->driver->tlb_flush(mem);
-	return 0;
-}
-
-static struct agp_memory *intel_i830_alloc_by_type(size_t pg_count,int type)
-{
-	if (type == AGP_PHYS_MEMORY)
-		return alloc_agpphysmem_i8xx(pg_count, type);
-
-	/* always return NULL for other allocation types for now */
-	return NULL;
-}
-
-static int intel_8xx_fetch_size(void)
-{
-	u8 temp;
-	int i;
-	struct aper_size_info_8 *values;
-
-	pci_read_config_byte(agp_bridge->dev, INTEL_APSIZE, &temp);
-
-	values = A_SIZE_8(agp_bridge->driver->aperture_sizes);
-
-	for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) {
-		if (temp == values[i].size_value) {
-			agp_bridge->previous_size =
-				agp_bridge->current_size = (void *) (values + i);
-			agp_bridge->aperture_size_idx = i;
-			return values[i].size;
-		}
-	}
-	return 0;
-}
-
-static void intel_8xx_tlbflush(struct agp_memory *mem)
-{
-	u32 temp;
-	pci_read_config_dword(agp_bridge->dev, INTEL_AGPCTRL, &temp);
-	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, temp & ~(1 << 7));
-	pci_read_config_dword(agp_bridge->dev, INTEL_AGPCTRL, &temp);
-	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, temp | (1 << 7));
-}
-
-static void intel_8xx_cleanup(void)
-{
-	u16 temp;
-	struct aper_size_info_8 *previous_size;
-
-	previous_size = A_SIZE_8(agp_bridge->previous_size);
-	pci_read_config_word(agp_bridge->dev, INTEL_NBXCFG, &temp);
-	pci_write_config_word(agp_bridge->dev, INTEL_NBXCFG, temp & ~(1 << 9));
-	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, previous_size->size_value);
-}
-
-static int intel_845_configure(void)
-{
-	u32 temp;
-	u8 temp2;
-	struct aper_size_info_8 *current_size;
-
-	current_size = A_SIZE_8(agp_bridge->current_size);
-
-	/* aperture size */
-	pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); 
-
-	/* address to map to */
-	pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp);
-	agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK);
-
-	/* attbase - aperture base */
-	pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); 
-
-	/* agpctrl */
-	pci_write_config_dword(agp_bridge->dev, INTEL_AGPCTRL, 0x0000); 
-
-	/* agpm */
-	pci_read_config_byte(agp_bridge->dev, INTEL_I845_AGPM, &temp2);
-	pci_write_config_byte(agp_bridge->dev, INTEL_I845_AGPM, temp2 | (1 << 1));
-	/* clear any possible error conditions */
-	pci_write_config_word(agp_bridge->dev, INTEL_I845_ERRSTS, 0x001c); 
-	return 0;
-}
-
-
-/* Setup function */
-static struct gatt_mask intel_generic_masks[] =
-{
-	{.mask = 0x00000017, .type = 0}
-};
-
-static struct aper_size_info_8 intel_8xx_sizes[7] =
-{
-	{256, 65536, 6, 0},
-	{128, 32768, 5, 32},
-	{64, 16384, 4, 48},
-	{32, 8192, 3, 56},
-	{16, 4096, 2, 60},
-	{8, 2048, 1, 62},
-	{4, 1024, 0, 63}
-};
-
-static struct agp_bridge_driver intel_830_driver = {
-	.owner			= THIS_MODULE,
-	.aperture_sizes		= intel_i830_sizes,
-	.size_type		= FIXED_APER_SIZE,
-	.num_aperture_sizes 	= 2,
-	.needs_scratch_page	= TRUE,
-	.configure		= intel_i830_configure,
-	.fetch_size		= intel_i830_fetch_size,
-	.cleanup		= intel_i830_cleanup,
-	.tlb_flush		= intel_i810_tlbflush,
-	.mask_memory		= intel_i810_mask_memory,
-	.masks			= intel_i810_masks,
-	.agp_enable		= intel_i810_agp_enable,
-	.cache_flush		= global_cache_flush,
-	.create_gatt_table	= intel_i830_create_gatt_table,
-	.free_gatt_table	= intel_i830_free_gatt_table,
-	.insert_memory		= intel_i830_insert_entries,
-	.remove_memory		= intel_i830_remove_entries,
-	.alloc_by_type		= intel_i830_alloc_by_type,
-	.free_by_type		= intel_i810_free_by_type,
-	.agp_alloc_page		= agp_generic_alloc_page,
-	.agp_destroy_page	= agp_generic_destroy_page,
-};
-
-static struct agp_bridge_driver intel_845_driver = {
-	.owner			= THIS_MODULE,
-	.aperture_sizes		= intel_8xx_sizes,
-	.size_type		= U8_APER_SIZE,
-	.num_aperture_sizes	= 7,
-	.configure		= intel_845_configure,
-	.fetch_size		= intel_8xx_fetch_size,
-	.cleanup		= intel_8xx_cleanup,
-	.tlb_flush		= intel_8xx_tlbflush,
-	.mask_memory		= agp_generic_mask_memory,
-	.masks			= intel_generic_masks,
-	.agp_enable		= agp_generic_enable,
-	.cache_flush		= global_cache_flush,
-	.create_gatt_table	= agp_generic_create_gatt_table,
-	.free_gatt_table	= agp_generic_free_gatt_table,
-	.insert_memory		= agp_generic_insert_memory,
-	.remove_memory		= agp_generic_remove_memory,
-	.alloc_by_type		= agp_generic_alloc_by_type,
-	.free_by_type		= agp_generic_free_by_type,
-	.agp_alloc_page		= agp_generic_alloc_page,
-	.agp_destroy_page	= agp_generic_destroy_page,
-};
-
-
-static int find_i830(u16 device)
-{
-	struct pci_dev *i830_dev;
-
-	i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL);
-	if (i830_dev && PCI_FUNC(i830_dev->devfn) != 0) {
-		i830_dev = pci_get_device(PCI_VENDOR_ID_INTEL,
-				device, i830_dev);
-	}
-
-	if (!i830_dev)
-		return 0;
-
-	intel_i830_private.i830_dev = i830_dev;
-	return 1;
-}
-
-static int __devinit agp_intelmch_probe(struct pci_dev *pdev,
-				     const struct pci_device_id *ent)
-{
-	struct agp_bridge_data *bridge;
-	struct resource *r;
-	char *name = "(unknown)";
-	u8 cap_ptr = 0;
-
-	cap_ptr = pci_find_capability(pdev, PCI_CAP_ID_AGP);
-	if (!cap_ptr) 
-		return -ENODEV;
-
-	bridge = agp_alloc_bridge();
-	if (!bridge)
-		return -ENOMEM;
-
-	switch (pdev->device) {
-	case PCI_DEVICE_ID_INTEL_82865_HB:
-		if (find_i830(PCI_DEVICE_ID_INTEL_82865_IG)) {
-			bridge->driver = &intel_830_driver;
-		} else {
-			bridge->driver = &intel_845_driver;
-		}
-		name = "865";
-		break;
-	case PCI_DEVICE_ID_INTEL_82875_HB:
-		bridge->driver = &intel_845_driver;
-		name = "i875";
-		break;
-
-	default:
-		printk(KERN_ERR PFX "Unsupported Intel chipset (device id: %04x)\n",
-			    pdev->device);
-		return -ENODEV;
-	};
-
-	bridge->dev = pdev;
-	bridge->capndx = cap_ptr;
-
-	if (bridge->driver == &intel_830_driver)
-		bridge->dev_private_data = &intel_i830_private;
-
-	printk(KERN_INFO PFX "Detected an Intel %s Chipset.\n", name);
-
-	/*
-	* The following fixes the case where the BIOS has "forgotten" to
-	* provide an address range for the GART.
-	* 20030610 - hamish@zot.org
-	*/
-	r = &pdev->resource[0];
-	if (!r->start && r->end) {
-		if(pci_assign_resource(pdev, 0)) {
-			printk(KERN_ERR PFX "could not assign resource 0\n");
-			return -ENODEV;
-		}
-	}
-
-	/*
-	* If the device has not been properly setup, the following will catch
-	* the problem and should stop the system from crashing.
-	* 20030610 - hamish@zot.org
-	*/
-	if (pci_enable_device(pdev)) {
-		printk(KERN_ERR PFX "Unable to Enable PCI device\n");
-		return -ENODEV;
-	}
-
-	/* Fill in the mode register */
-	if (cap_ptr) {
-		pci_read_config_dword(pdev,
-				bridge->capndx+PCI_AGP_STATUS,
-				&bridge->mode);
-	}
-
-	pci_set_drvdata(pdev, bridge);
-	return agp_add_bridge(bridge);
-}
-
-static void __devexit agp_intelmch_remove(struct pci_dev *pdev)
-{
-	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
-
-	agp_remove_bridge(bridge);
-	if (intel_i830_private.i830_dev)
-		pci_dev_put(intel_i830_private.i830_dev);
-	agp_put_bridge(bridge);
-}
-
-static int agp_intelmch_resume(struct pci_dev *pdev)
-{
-	struct agp_bridge_data *bridge = pci_get_drvdata(pdev);
-
-	pci_restore_state(pdev);
-
-	if (bridge->driver == &intel_845_driver)
-		intel_845_configure();
-
-	return 0;
-}
-
-static struct pci_device_id agp_intelmch_pci_table[] = {
-	{
-	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
-	.class_mask	= ~0,
-	.vendor		= PCI_VENDOR_ID_INTEL,
-	.device		= PCI_DEVICE_ID_INTEL_82865_HB,
-	.subvendor	= PCI_ANY_ID,
-	.subdevice	= PCI_ANY_ID,
-	},
-	{
-	.class		= (PCI_CLASS_BRIDGE_HOST << 8),
-	.class_mask	= ~0,
-	.vendor		= PCI_VENDOR_ID_INTEL,
-	.device		= PCI_DEVICE_ID_INTEL_82875_HB,
-	.subvendor	= PCI_ANY_ID,
-	.subdevice	= PCI_ANY_ID,
-	},
-	{ }
-};
-
-MODULE_DEVICE_TABLE(pci, agp_intelmch_pci_table);
-
-static struct pci_driver agp_intelmch_pci_driver = {
-	.name		= "agpgart-intel-mch",
-	.id_table	= agp_intelmch_pci_table,
-	.probe		= agp_intelmch_probe,
-	.remove		= agp_intelmch_remove,
-	.resume		= agp_intelmch_resume,
-};
-
-/* intel_agp_init() must not be declared static for explicit
-   early initialization to work (ie i810fb) */
-int __init agp_intelmch_init(void)
-{
-	static int agp_initialised=0;
-
-	if (agp_initialised == 1)
-		return 0;
-	agp_initialised=1;
-
-	return pci_module_init(&agp_intelmch_pci_driver);
-}
-
-static void __exit agp_intelmch_cleanup(void)
-{
-	pci_unregister_driver(&agp_intelmch_pci_driver);
-}
-
-module_init(agp_intelmch_init);
-module_exit(agp_intelmch_cleanup);
-
-MODULE_AUTHOR("Dave Jones <davej@codemonkey.org.uk>");
-MODULE_LICENSE("GPL");
-
diff -Nru a/drivers/char/agp/nvidia-agp.c b/drivers/char/agp/nvidia-agp.c
--- a/drivers/char/agp/nvidia-agp.c	2004-12-22 15:25:04 -08:00
+++ b/drivers/char/agp/nvidia-agp.c	2005-02-23 16:36:05 -08:00
@@ -215,7 +215,8 @@
 		mem->is_flushed = TRUE;
 	}
 	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
-		writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type),
+		writel(agp_bridge->driver->mask_memory(agp_bridge,
+			mem->memory[i], mem->type),
 			agp_bridge->gatt_table+nvidia_private.pg_offset+j);
 		readl(agp_bridge->gatt_table+nvidia_private.pg_offset+j);	/* PCI Posting. */
 	}
@@ -407,7 +408,7 @@
 {
 	if (agp_off)
 		return -EINVAL;
-	return pci_module_init(&agp_nvidia_pci_driver);
+	return pci_register_driver(&agp_nvidia_pci_driver);
 }
 
 static void __exit agp_nvidia_cleanup(void)
diff -Nru a/drivers/char/agp/sis-agp.c b/drivers/char/agp/sis-agp.c
--- a/drivers/char/agp/sis-agp.c	2005-01-07 21:44:25 -08:00
+++ b/drivers/char/agp/sis-agp.c	2005-03-06 16:59:19 -08:00
@@ -1,5 +1,5 @@
 /*
- * SiS AGPGART routines. 
+ * SiS AGPGART routines.
  */
 
 #include <linux/module.h>
@@ -70,7 +70,7 @@
 			      (previous_size->size_value & ~(0x03)));
 }
 
-static void sis_delayed_enable(u32 mode)
+static void sis_delayed_enable(struct agp_bridge_data *bridge, u32 mode)
 {
 	struct pci_dev *device = NULL;
 	u32 command;
@@ -79,10 +79,10 @@
 	printk(KERN_INFO PFX "Found an AGP %d.%d compliant device at %s.\n",
 		agp_bridge->major_version,
 		agp_bridge->minor_version,
-		agp_bridge->dev->slot_name);
+		pci_name(agp_bridge->dev));
 
 	pci_read_config_dword(agp_bridge->dev, agp_bridge->capndx + PCI_AGP_STATUS, &command);
-	command = agp_collect_device_status(mode, command);
+	command = agp_collect_device_status(bridge, mode, command);
 	command |= AGPSTAT_AGP_ENABLE;
 	rate = (command & 0x7) << 2;
 
@@ -99,9 +99,9 @@
 		/*
 		 * Weird: on some sis chipsets any rate change in the target
 		 * command register triggers a 5ms screwup during which the master
-		 * cannot be configured		 
+		 * cannot be configured
 		 */
-		if (device->device == agp_bridge->dev->device) {
+		if (device->device == bridge->dev->device) {
 			printk(KERN_INFO PFX "SiS delay workaround: giving bridge time to recover.\n");
 			msleep(10);
 		}
@@ -342,7 +342,7 @@
 {
 	if (agp_off)
 		return -EINVAL;
-	return pci_module_init(&agp_sis_pci_driver);
+	return pci_register_driver(&agp_sis_pci_driver);
 }
 
 static void __exit agp_sis_cleanup(void)
diff -Nru a/drivers/char/agp/sworks-agp.c b/drivers/char/agp/sworks-agp.c
--- a/drivers/char/agp/sworks-agp.c	2004-12-22 15:25:04 -08:00
+++ b/drivers/char/agp/sworks-agp.c	2005-02-23 16:36:05 -08:00
@@ -141,7 +141,7 @@
 #define GET_GATT_OFF(addr) ((addr & 0x003ff000) >> 12)
 #endif
 
-static int serverworks_create_gatt_table(void)
+static int serverworks_create_gatt_table(struct agp_bridge_data *bridge)
 {
 	struct aper_size_info_lvl2 *value;
 	struct serverworks_page_map page_dir;
@@ -192,7 +192,7 @@
 	return 0;
 }
 
-static int serverworks_free_gatt_table(void)
+static int serverworks_free_gatt_table(struct agp_bridge_data *bridge)
 {
 	struct serverworks_page_map page_dir;
    
@@ -341,7 +341,7 @@
 	for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
 		addr = (j * PAGE_SIZE) + agp_bridge->gart_bus_addr;
 		cur_gatt = SVRWRKS_GET_GATT(addr);
-		writel(agp_bridge->driver->mask_memory(mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
+		writel(agp_bridge->driver->mask_memory(agp_bridge, mem->memory[i], mem->type), cur_gatt+GET_GATT_OFF(addr));
 	}
 	serverworks_tlbflush(mem);
 	return 0;
@@ -387,15 +387,15 @@
 	{32, 8192, 0xfe000000}
 };
 
-static void serverworks_agp_enable(u32 mode)
+static void serverworks_agp_enable(struct agp_bridge_data *bridge, u32 mode)
 {
 	u32 command;
 
 	pci_read_config_dword(serverworks_private.svrwrks_dev,
-			      agp_bridge->capndx + PCI_AGP_STATUS,
+			      bridge->capndx + PCI_AGP_STATUS,
 			      &command);
 
-	command = agp_collect_device_status(mode, command);
+	command = agp_collect_device_status(bridge, mode, command);
 
 	command &= ~0x10;	/* disable FW */
 	command &= ~0x08;
@@ -403,7 +403,7 @@
 	command |= 0x100;
 
 	pci_write_config_dword(serverworks_private.svrwrks_dev,
-			       agp_bridge->capndx + PCI_AGP_COMMAND,
+			       bridge->capndx + PCI_AGP_COMMAND,
 			       command);
 
 	agp_device_command(command, 0);
@@ -541,7 +541,7 @@
 {
 	if (agp_off)
 		return -EINVAL;
-	return pci_module_init(&agp_serverworks_pci_driver);
+	return pci_register_driver(&agp_serverworks_pci_driver);
 }
 
 static void __exit agp_serverworks_cleanup(void)
diff -Nru a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c
--- a/drivers/char/agp/uninorth-agp.c	2004-12-22 15:25:04 -08:00
+++ b/drivers/char/agp/uninorth-agp.c	2005-02-23 16:36:05 -08:00
@@ -124,27 +124,27 @@
 	return 0;
 }
 
-static void uninorth_agp_enable(u32 mode)
+static void uninorth_agp_enable(struct agp_bridge_data *bridge, u32 mode)
 {
 	u32 command, scratch;
 	int timeout;
 
-	pci_read_config_dword(agp_bridge->dev,
-			      agp_bridge->capndx + PCI_AGP_STATUS,
+	pci_read_config_dword(bridge->dev,
+			      bridge->capndx + PCI_AGP_STATUS,
 			      &command);
 
-	command = agp_collect_device_status(mode, command);
+	command = agp_collect_device_status(bridge, mode, command);
 	command |= 0x100;
 
 	uninorth_tlbflush(NULL);
 
 	timeout = 0;
 	do {
-		pci_write_config_dword(agp_bridge->dev,
-				       agp_bridge->capndx + PCI_AGP_COMMAND,
+		pci_write_config_dword(bridge->dev,
+				       bridge->capndx + PCI_AGP_COMMAND,
 				       command);
-		pci_read_config_dword(agp_bridge->dev,
-				       agp_bridge->capndx + PCI_AGP_COMMAND,
+		pci_read_config_dword(bridge->dev,
+				      bridge->capndx + PCI_AGP_COMMAND,
 				       &scratch);
 	} while ((scratch & 0x100) == 0 && ++timeout < 1000);
 	if ((scratch & 0x100) == 0)
@@ -155,7 +155,7 @@
 	uninorth_tlbflush(NULL);
 }
 
-static int uninorth_create_gatt_table(void)
+static int uninorth_create_gatt_table(struct agp_bridge_data *bridge)
 {
 	char *table;
 	char *table_end;
@@ -212,7 +212,7 @@
 	return 0;
 }
 
-static int uninorth_free_gatt_table(void)
+static int uninorth_free_gatt_table(struct agp_bridge_data *bridge)
 {
 	int page_order;
 	char *table, *table_end;
@@ -375,7 +375,7 @@
 {
 	if (agp_off)
 		return -EINVAL;
-	return pci_module_init(&agp_uninorth_pci_driver);
+	return pci_register_driver(&agp_uninorth_pci_driver);
 }
 
 static void __exit agp_uninorth_cleanup(void)
diff -Nru a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c
--- a/drivers/char/agp/via-agp.c	2004-12-22 15:25:04 -08:00
+++ b/drivers/char/agp/via-agp.c	2005-02-22 16:56:06 -08:00
@@ -1,5 +1,5 @@
 /*
- * VIA AGPGART routines. 
+ * VIA AGPGART routines.
  */
 
 #include <linux/types.h>
@@ -36,6 +36,7 @@
 			return values[i].size;
 		}
 	}
+	printk(KERN_ERR PFX "Unknown aperture size from AGP bridge (0x%x)\n", temp);
 	return 0;
 }
 
@@ -78,12 +79,19 @@
 
 static void via_tlbflush(struct agp_memory *mem)
 {
-	pci_write_config_dword(agp_bridge->dev, VIA_GARTCTRL, 0x0000008f);
-	pci_write_config_dword(agp_bridge->dev, VIA_GARTCTRL, 0x0000000f);
+	u32 temp;
+
+	pci_read_config_dword(agp_bridge->dev, VIA_GARTCTRL, &temp);
+	temp |= (1<<7);
+	temp &= ~0x7f;
+	pci_write_config_dword(agp_bridge->dev, VIA_GARTCTRL, temp);
+	temp &= ~(1<<7);
+	temp &= ~0x7f;
+	pci_write_config_dword(agp_bridge->dev, VIA_GARTCTRL, temp);
 }
 
 
-static struct aper_size_info_8 via_generic_sizes[7] =
+static struct aper_size_info_8 via_generic_sizes[9] =
 {
 	{256, 65536, 6, 0},
 	{128, 32768, 5, 128},
@@ -91,7 +99,9 @@
 	{32, 8192, 3, 224},
 	{16, 4096, 2, 240},
 	{8, 2048, 1, 248},
-	{4, 1024, 0, 252}
+	{4, 1024, 0, 252},
+	{2, 512, 0, 254},
+	{1, 256, 0, 255}
 };
 
 
@@ -121,7 +131,7 @@
 {
 	u32 temp;
 	struct aper_size_info_16 *current_size;
-    
+
 	current_size = A_SIZE_16(agp_bridge->current_size);
 
 	/* address to map too */
@@ -132,13 +142,13 @@
 	pci_write_config_dword(agp_bridge->dev, VIA_AGP3_ATTBASE,
 		agp_bridge->gatt_bus_addr & 0xfffff000);
 
-	/* 1. Enable GTLB in RX90<7>, all AGP aperture access needs to fetch 
+	/* 1. Enable GTLB in RX90<7>, all AGP aperture access needs to fetch
 	 *    translation table first.
 	 * 2. Enable AGP aperture in RX91<0>. This bit controls the enabling of the
 	 *    graphics AGP aperture for the AGP3.0 port.
 	 */
 	pci_read_config_dword(agp_bridge->dev, VIA_AGP3_GARTCTRL, &temp);
-	pci_write_config_dword(agp_bridge->dev, VIA_AGP3_GARTCTRL, temp | (3<<7));		
+	pci_write_config_dword(agp_bridge->dev, VIA_AGP3_GARTCTRL, temp | (3<<7));
 	return 0;
 }
 
@@ -189,7 +199,7 @@
 	.owner			= THIS_MODULE,
 	.aperture_sizes		= via_generic_sizes,
 	.size_type		= U8_APER_SIZE,
-	.num_aperture_sizes	= 7,
+	.num_aperture_sizes	= 9,
 	.configure		= via_configure,
 	.fetch_size		= via_fetch_size,
 	.cleanup		= via_cleanup,
@@ -525,7 +535,7 @@
 {
 	if (agp_off)
 		return -EINVAL;
-	return pci_module_init(&agp_via_pci_driver);
+	return pci_register_driver(&agp_via_pci_driver);
 }
 
 static void __exit agp_via_cleanup(void)
diff -Nru a/drivers/char/console_macros.h b/drivers/char/console_macros.h
--- a/drivers/char/console_macros.h	2003-03-20 06:36:40 -08:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,71 +0,0 @@
-#define cons_num	(vc_cons[currcons].d->vc_num)
-#define video_scan_lines (vc_cons[currcons].d->vc_scan_lines)
-#define sw		(vc_cons[currcons].d->vc_sw)
-#define screenbuf	(vc_cons[currcons].d->vc_screenbuf)
-#define screenbuf_size	(vc_cons[currcons].d->vc_screenbuf_size)
-#define origin		(vc_cons[currcons].d->vc_origin)
-#define scr_top		(vc_cons[currcons].d->vc_scr_top)
-#define visible_origin  (vc_cons[currcons].d->vc_visible_origin)
-#define scr_end		(vc_cons[currcons].d->vc_scr_end)
-#define pos		(vc_cons[currcons].d->vc_pos)
-#define top		(vc_cons[currcons].d->vc_top)
-#define bottom		(vc_cons[currcons].d->vc_bottom)
-#define x		(vc_cons[currcons].d->vc_x)
-#define y		(vc_cons[currcons].d->vc_y)
-#define vc_state	(vc_cons[currcons].d->vc_state)
-#define npar		(vc_cons[currcons].d->vc_npar)
-#define par		(vc_cons[currcons].d->vc_par)
-#define ques		(vc_cons[currcons].d->vc_ques)
-#define attr		(vc_cons[currcons].d->vc_attr)
-#define saved_x		(vc_cons[currcons].d->vc_saved_x)
-#define saved_y		(vc_cons[currcons].d->vc_saved_y)
-#define translate	(vc_cons[currcons].d->vc_translate)
-#define G0_charset	(vc_cons[currcons].d->vc_G0_charset)
-#define G1_charset	(vc_cons[currcons].d->vc_G1_charset)
-#define saved_G0	(vc_cons[currcons].d->vc_saved_G0)
-#define saved_G1	(vc_cons[currcons].d->vc_saved_G1)
-#define utf		(vc_cons[currcons].d->vc_utf)
-#define utf_count	(vc_cons[currcons].d->vc_utf_count)
-#define utf_char	(vc_cons[currcons].d->vc_utf_char)
-#define video_erase_char (vc_cons[currcons].d->vc_video_erase_char)
-#define disp_ctrl	(vc_cons[currcons].d->vc_disp_ctrl)
-#define toggle_meta	(vc_cons[currcons].d->vc_toggle_meta)
-#define decscnm		(vc_cons[currcons].d->vc_decscnm)
-#define decom		(vc_cons[currcons].d->vc_decom)
-#define decawm		(vc_cons[currcons].d->vc_decawm)
-#define deccm		(vc_cons[currcons].d->vc_deccm)
-#define decim		(vc_cons[currcons].d->vc_decim)
-#define deccolm		(vc_cons[currcons].d->vc_deccolm)
-#define need_wrap	(vc_cons[currcons].d->vc_need_wrap)
-#define kmalloced	(vc_cons[currcons].d->vc_kmalloced)
-#define report_mouse	(vc_cons[currcons].d->vc_report_mouse)
-#define color		(vc_cons[currcons].d->vc_color)
-#define s_color		(vc_cons[currcons].d->vc_s_color)
-#define def_color	(vc_cons[currcons].d->vc_def_color)
-#define foreground	(color & 0x0f)
-#define background	(color & 0xf0)
-#define charset		(vc_cons[currcons].d->vc_charset)
-#define s_charset	(vc_cons[currcons].d->vc_s_charset)
-#define	intensity	(vc_cons[currcons].d->vc_intensity)
-#define	underline	(vc_cons[currcons].d->vc_underline)
-#define	blink		(vc_cons[currcons].d->vc_blink)
-#define	reverse		(vc_cons[currcons].d->vc_reverse)
-#define	s_intensity	(vc_cons[currcons].d->vc_s_intensity)
-#define	s_underline	(vc_cons[currcons].d->vc_s_underline)
-#define	s_blink		(vc_cons[currcons].d->vc_s_blink)
-#define	s_reverse	(vc_cons[currcons].d->vc_s_reverse)
-#define	ulcolor		(vc_cons[currcons].d->vc_ulcolor)
-#define	halfcolor	(vc_cons[currcons].d->vc_halfcolor)
-#define tab_stop	(vc_cons[currcons].d->vc_tab_stop)
-#define palette		(vc_cons[currcons].d->vc_palette)
-#define bell_pitch	(vc_cons[currcons].d->vc_bell_pitch)
-#define bell_duration	(vc_cons[currcons].d->vc_bell_duration)
-#define cursor_type	(vc_cons[currcons].d->vc_cursor_type)
-#define display_fg	(vc_cons[currcons].d->vc_display_fg)
-#define complement_mask (vc_cons[currcons].d->vc_complement_mask)
-#define s_complement_mask (vc_cons[currcons].d->vc_s_complement_mask)
-#define hi_font_mask	(vc_cons[currcons].d->vc_hi_font_mask)
-
-#define vcmode		(vt_cons[currcons]->vc_mode)
-
-#define structsize	(sizeof(struct vc_data) + sizeof(struct vt_struct))
diff -Nru a/drivers/char/consolemap.c b/drivers/char/consolemap.c
--- a/drivers/char/consolemap.c	2005-01-20 21:00:50 -08:00
+++ b/drivers/char/consolemap.c	2005-03-07 20:41:34 -08:00
@@ -208,9 +208,9 @@
 	}
 }
 
-unsigned short *set_translate(int m,int currcons)
+unsigned short *set_translate(int m, struct vc_data *vc)
 {
-	inv_translate[currcons] = m;
+	inv_translate[vc->vc_num] = m;
 	return translations[m];
 }
 
@@ -362,15 +362,16 @@
 		}
 }
 
-void con_free_unimap(int con)
+void con_free_unimap(struct vc_data *vc)
 {
 	struct uni_pagedir *p;
-	struct vc_data *conp = vc_cons[con].d;
-	
-	p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc;
-	if (!p) return;
-	*conp->vc_uni_pagedir_loc = 0;
-	if (--p->refcount) return;
+
+	p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
+	if (!p)
+		return;
+	*vc->vc_uni_pagedir_loc = 0;
+	if (--p->refcount)
+		return;
 	con_release_unimap(p);
 	kfree(p);
 }
@@ -442,12 +443,11 @@
 }
 
 /* ui is a leftover from using a hashtable, but might be used again */
-int con_clear_unimap(int con, struct unimapinit *ui)
+int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui)
 {
 	struct uni_pagedir *p, *q;
-	struct vc_data *conp = vc_cons[con].d;
   
-	p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc;
+	p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
 	if (p && p->readonly) return -EIO;
 	if (!p || --p->refcount) {
 		q = (struct uni_pagedir *)kmalloc(sizeof(*p), GFP_KERNEL);
@@ -457,7 +457,7 @@
 		}
 		memset(q, 0, sizeof(*q));
 		q->refcount=1;
-		*conp->vc_uni_pagedir_loc = (unsigned long)q;
+		*vc->vc_uni_pagedir_loc = (unsigned long)q;
 	} else {
 		if (p == dflt) dflt = NULL;
 		p->refcount++;
@@ -467,14 +467,12 @@
 	return 0;
 }
 
-int
-con_set_unimap(int con, ushort ct, struct unipair __user *list)
+int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
 {
 	int err = 0, err1, i;
 	struct uni_pagedir *p, *q;
-	struct vc_data *conp = vc_cons[con].d;
 
-	p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc;
+	p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
 	if (p->readonly) return -EIO;
 	
 	if (!ct) return 0;
@@ -483,10 +481,10 @@
 		int j, k;
 		u16 **p1, *p2, l;
 		
-		err1 = con_clear_unimap(con, NULL);
+		err1 = con_clear_unimap(vc, NULL);
 		if (err1) return err1;
 		
-		q = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc;
+		q = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
 		for (i = 0, l = 0; i < 32; i++)
 		if ((p1 = p->uni_pgdir[i]))
 			for (j = 0; j < 32; j++)
@@ -496,7 +494,7 @@
 					err1 = con_insert_unipair(q, l, p2[k]);
 					if (err1) {
 						p->refcount++;
-						*conp->vc_uni_pagedir_loc = (unsigned long)p;
+						*vc->vc_uni_pagedir_loc = (unsigned long)p;
 						con_release_unimap(q);
 						kfree(q);
 						return err1; 
@@ -515,11 +513,11 @@
 			list++;
 	}
 	
-	if (con_unify_unimap(conp, p))
+	if (con_unify_unimap(vc, p))
 		return err;
 
 	for (i = 0; i <= 3; i++)
-		set_inverse_transl(conp, p, i); /* Update all inverse translations */
+		set_inverse_transl(vc, p, i); /* Update all inverse translations */
   
 	return err;
 }
@@ -529,20 +527,18 @@
    with.  This routine is executed at sys_setup time, and when the
    PIO_FONTRESET ioctl is called. */
 
-int
-con_set_default_unimap(int con)
+int con_set_default_unimap(struct vc_data *vc)
 {
 	int i, j, err = 0, err1;
 	u16 *q;
 	struct uni_pagedir *p;
-	struct vc_data *conp = vc_cons[con].d;
-	
+
 	if (dflt) {
-		p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc;
+		p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
 		if (p == dflt)
 			return 0;
 		dflt->refcount++;
-		*conp->vc_uni_pagedir_loc = (unsigned long)dflt;
+		*vc->vc_uni_pagedir_loc = (unsigned long)dflt;
 		if (p && --p->refcount) {
 			con_release_unimap(p);
 			kfree(p);
@@ -552,10 +548,10 @@
 	
 	/* The default font is always 256 characters */
 
-	err = con_clear_unimap(con,NULL);
+	err = con_clear_unimap(vc, NULL);
 	if (err) return err;
     
-	p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc;
+	p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
 	q = dfont_unitable;
 	
 	for (i = 0; i < 256; i++)
@@ -565,47 +561,42 @@
 				err = err1;
 		}
 			
-	if (con_unify_unimap(conp, p)) {
-		dflt = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc;
+	if (con_unify_unimap(vc, p)) {
+		dflt = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
 		return err;
 	}
 
 	for (i = 0; i <= 3; i++)
-		set_inverse_transl(conp, p, i);	/* Update all inverse translations */
+		set_inverse_transl(vc, p, i);	/* Update all inverse translations */
 	dflt = p;
 	return err;
 }
 EXPORT_SYMBOL(con_set_default_unimap);
 
-int
-con_copy_unimap(int dstcon, int srccon)
+int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc)
 {
-	struct vc_data *sconp = vc_cons[srccon].d;
-	struct vc_data *dconp = vc_cons[dstcon].d;
 	struct uni_pagedir *q;
-	
-	if (!vc_cons_allocated(srccon) || !*sconp->vc_uni_pagedir_loc)
+
+	if (!*src_vc->vc_uni_pagedir_loc)
 		return -EINVAL;
-	if (*dconp->vc_uni_pagedir_loc == *sconp->vc_uni_pagedir_loc)
+	if (*dst_vc->vc_uni_pagedir_loc == *src_vc->vc_uni_pagedir_loc)
 		return 0;
-	con_free_unimap(dstcon);
-	q = (struct uni_pagedir *)*sconp->vc_uni_pagedir_loc;
+	con_free_unimap(dst_vc);
+	q = (struct uni_pagedir *)*src_vc->vc_uni_pagedir_loc;
 	q->refcount++;
-	*dconp->vc_uni_pagedir_loc = (long)q;
+	*dst_vc->vc_uni_pagedir_loc = (long)q;
 	return 0;
 }
 
-int
-con_get_unimap(int con, ushort ct, ushort __user *uct, struct unipair __user *list)
+int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list)
 {
 	int i, j, k, ect;
 	u16 **p1, *p2;
 	struct uni_pagedir *p;
-	struct vc_data *conp = vc_cons[con].d;
 
 	ect = 0;
-	if (*conp->vc_uni_pagedir_loc) {
-		p = (struct uni_pagedir *)*conp->vc_uni_pagedir_loc;
+	if (*vc->vc_uni_pagedir_loc) {
+		p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
 		for (i = 0; i < 32; i++)
 		if ((p1 = p->uni_pgdir[i]))
 			for (j = 0; j < 32; j++)
@@ -625,12 +616,12 @@
 	return ((ect <= ct) ? 0 : -ENOMEM);
 }
 
-void con_protect_unimap(int con, int rdonly)
+void con_protect_unimap(struct vc_data *vc, int rdonly)
 {
-	struct uni_pagedir *p = (struct uni_pagedir *)
-		*vc_cons[con].d->vc_uni_pagedir_loc;
+	struct uni_pagedir *p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
 	
-	if (p) p->readonly = rdonly;
+	if (p)
+		p->readonly = rdonly;
 }
 
 int
@@ -679,7 +670,7 @@
 	
 	for (i = 0; i < MAX_NR_CONSOLES; i++)
 		if (vc_cons_allocated(i) && !*vc_cons[i].d->vc_uni_pagedir_loc)
-			con_set_default_unimap(i);
+			con_set_default_unimap(vc_cons[i].d);
 }
 
 EXPORT_SYMBOL(con_copy_unimap);
diff -Nru a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
--- a/drivers/char/drm/drmP.h	2005-01-26 23:04:56 -08:00
+++ b/drivers/char/drm/drmP.h	2005-02-23 15:18:04 -08:00
@@ -497,6 +497,7 @@
 	DRM_AGP_KERN       agp_info;	/**< AGP device information */
 	drm_agp_mem_t      *memory;	/**< memory entries */
 	unsigned long      mode;	/**< AGP mode */
+	struct agp_bridge_data  *bridge;
 	int                enabled;	/**< whether the AGP bus as been enabled */
 	int                acquired;	/**< whether the AGP device has been acquired */
 	unsigned long      base;
@@ -807,7 +808,7 @@
 					   drm_device_t *dev);
 extern void	     drm_ioremapfree(void *pt, unsigned long size, drm_device_t *dev);
 
-extern DRM_AGP_MEM   *drm_alloc_agp(int pages, u32 type);
+extern DRM_AGP_MEM   *drm_alloc_agp(struct agp_bridge_data *bridge, int pages, u32 type);
 extern int           drm_free_agp(DRM_AGP_MEM *handle, int pages);
 extern int           drm_bind_agp(DRM_AGP_MEM *handle, unsigned int start);
 extern int           drm_unbind_agp(DRM_AGP_MEM *handle);
@@ -930,10 +931,10 @@
 extern void          drm_vbl_send_signals( drm_device_t *dev );
 
 				/* AGP/GART support (drm_agpsupport.h) */
-extern drm_agp_head_t *drm_agp_init(void);
+extern drm_agp_head_t *drm_agp_init(drm_device_t *dev);
 extern int            drm_agp_acquire(struct inode *inode, struct file *filp,
 				       unsigned int cmd, unsigned long arg);
-extern void           drm_agp_do_release(void);
+extern void           drm_agp_do_release(drm_device_t *dev);
 extern int            drm_agp_release(struct inode *inode, struct file *filp,
 				       unsigned int cmd, unsigned long arg);
 extern int            drm_agp_enable(struct inode *inode, struct file *filp,
@@ -948,7 +949,7 @@
 				      unsigned int cmd, unsigned long arg);
 extern int            drm_agp_bind(struct inode *inode, struct file *filp,
 				    unsigned int cmd, unsigned long arg);
-extern DRM_AGP_MEM    *drm_agp_allocate_memory(size_t pages, u32 type);
+extern DRM_AGP_MEM    *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type);
 extern int            drm_agp_free_memory(DRM_AGP_MEM *handle);
 extern int            drm_agp_bind_memory(DRM_AGP_MEM *handle, off_t start);
 extern int            drm_agp_unbind_memory(DRM_AGP_MEM *handle);
diff -Nru a/drivers/char/drm/drm_agpsupport.c b/drivers/char/drm/drm_agpsupport.c
--- a/drivers/char/drm/drm_agpsupport.c	2004-11-11 02:52:02 -08:00
+++ b/drivers/char/drm/drm_agpsupport.c	2005-02-23 15:18:04 -08:00
@@ -92,14 +92,13 @@
 {
 	drm_file_t	 *priv	 = filp->private_data;
 	drm_device_t	 *dev	 = priv->dev;
-	int              retcode;
 
 	if (!dev->agp)
 		return -ENODEV;
 	if (dev->agp->acquired)
 		return -EBUSY;
-	if ((retcode = agp_backend_acquire()))
-		return retcode;
+	if (!(dev->agp->bridge = agp_backend_acquire(dev->pdev)))
+		return -ENODEV;
 	dev->agp->acquired = 1;
 	return 0;
 }
@@ -123,7 +122,7 @@
 
 	if (!dev->agp || !dev->agp->acquired)
 		return -EINVAL;
-	agp_backend_release();
+	agp_backend_release(dev->agp->bridge);
 	dev->agp->acquired = 0;
 	return 0;
 
@@ -134,9 +133,9 @@
  *
  * Calls agp_backend_release().
  */
-void drm_agp_do_release(void)
+void drm_agp_do_release(drm_device_t *dev)
 {
-  agp_backend_release();
+  agp_backend_release(dev->agp->bridge);
 }
 
 /**
@@ -165,7 +164,7 @@
 		return -EFAULT;
 
 	dev->agp->mode    = mode.mode;
-	agp_enable(mode.mode);
+	agp_enable(dev->agp->bridge, mode.mode);
 	dev->agp->base    = dev->agp->agp_info.aper_base;
 	dev->agp->enabled = 1;
 	return 0;
@@ -207,7 +206,7 @@
 	pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE;
 	type = (u32) request.type;
 
-	if (!(memory = drm_alloc_agp(pages, type))) {
+	if (!(memory = drm_alloc_agp(dev->agp->bridge, pages, type))) {
 		drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
 		return -ENOMEM;
 	}
@@ -381,14 +380,19 @@
  * \return pointer to a drm_agp_head structure.
  *
  */
-drm_agp_head_t *drm_agp_init(void)
+drm_agp_head_t *drm_agp_init(drm_device_t *dev)
 {
 	drm_agp_head_t *head         = NULL;
 
 	if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
 		return NULL;
 	memset((void *)head, 0, sizeof(*head));
-	agp_copy_info(&head->agp_info);
+	if (!(head->bridge = agp_backend_acquire(dev->pdev))) {
+		drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
+		return NULL;
+	}
+	agp_copy_info(head->bridge, &head->agp_info);
+	agp_backend_release(head->bridge);
 	if (head->agp_info.chipset == NOT_SUPPORTED) {
 		drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
 		return NULL;
@@ -406,9 +410,9 @@
 }
 
 /** Calls agp_allocate_memory() */
-DRM_AGP_MEM *drm_agp_allocate_memory(size_t pages, u32 type)
+DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type)
 {
-	return agp_allocate_memory(pages, type);
+	return agp_allocate_memory(bridge, pages, type);
 }
 
 /** Calls agp_free_memory() */
diff -Nru a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
--- a/drivers/char/drm/drm_drv.c	2005-02-08 00:26:15 -08:00
+++ b/drivers/char/drm/drm_drv.c	2005-02-23 15:18:04 -08:00
@@ -185,7 +185,7 @@
 		}
 		dev->agp->memory = NULL;
 
-		if ( dev->agp->acquired ) drm_agp_do_release();
+		if ( dev->agp->acquired ) drm_agp_do_release(dev);
 
 		dev->agp->acquired = 0;
 		dev->agp->enabled  = 0;
diff -Nru a/drivers/char/drm/drm_memory.c b/drivers/char/drm/drm_memory.c
--- a/drivers/char/drm/drm_memory.c	2004-11-02 02:57:07 -08:00
+++ b/drivers/char/drm/drm_memory.c	2005-02-23 15:18:04 -08:00
@@ -155,9 +155,9 @@
 
 #if __OS_HAS_AGP
 /** Wrapper around agp_allocate_memory() */
-DRM_AGP_MEM *drm_alloc_agp(int pages, u32 type)
+DRM_AGP_MEM *drm_alloc_agp(struct agp_bridge_data *bridge, int pages, u32 type)
 {
-	return drm_agp_allocate_memory(pages, type);
+	return drm_agp_allocate_memory(bridge, pages, type);
 }
 
 /** Wrapper around agp_free_memory() */
diff -Nru a/drivers/char/drm/drm_stub.c b/drivers/char/drm/drm_stub.c
--- a/drivers/char/drm/drm_stub.c	2005-01-26 23:04:56 -08:00
+++ b/drivers/char/drm/drm_stub.c	2005-02-23 15:18:04 -08:00
@@ -91,7 +91,7 @@
 			goto error_out_unreg;
 
 	if (drm_core_has_AGP(dev)) {
-		dev->agp = drm_agp_init();
+		dev->agp = drm_agp_init(dev);
 		if (drm_core_check_feature(dev, DRIVER_REQUIRE_AGP) && (dev->agp == NULL)) {
 			DRM_ERROR( "Cannot initialize the agpgart module.\n" );
 			retcode = -EINVAL;
diff -Nru a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
--- a/drivers/char/ipmi/ipmi_msghandler.c	2005-02-14 10:31:41 -08:00
+++ b/drivers/char/ipmi/ipmi_msghandler.c	2005-03-07 20:41:43 -08:00
@@ -612,6 +612,7 @@
 	unsigned long flags;
 	ipmi_user_t   new_user;
 	int           rv = 0;
+	ipmi_smi_t    intf;
 
 	/* There is no module usecount here, because it's not
            required.  Since this can only be used by and called from
@@ -646,19 +647,29 @@
 		goto out_unlock;
 	}
 
+	intf = ipmi_interfaces[if_num];
+
 	new_user->handler = handler;
 	new_user->handler_data = handler_data;
-	new_user->intf = ipmi_interfaces[if_num];
+	new_user->intf = intf;
 	new_user->gets_events = 0;
 
-	if (!try_module_get(new_user->intf->handlers->owner)) {
+	if (!try_module_get(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);
+	if (intf->handlers->inc_usecount) {
+		rv = intf->handlers->inc_usecount(intf->send_info);
+		if (rv) {
+			module_put(intf->handlers->owner);
+			goto out_unlock;
+		}
+	}
+
+	write_lock_irqsave(&intf->users_lock, flags);
+	list_add_tail(&new_user->link, &intf->users);
+	write_unlock_irqrestore(&intf->users_lock, flags);
 
  out_unlock:	
 	if (rv) {
@@ -729,8 +740,11 @@
 	down_read(&interfaces_sem);
 	write_lock_irqsave(&intf->users_lock, flags);
 	rv = ipmi_destroy_user_nolock(user);
-	if (!rv)
+	if (!rv) {
 		module_put(intf->handlers->owner);
+		if (intf->handlers->dec_usecount)
+			intf->handlers->dec_usecount(intf->send_info);
+	}
 		
 	write_unlock_irqrestore(&intf->users_lock, flags);
 	up_read(&interfaces_sem);
@@ -1629,6 +1643,7 @@
 		      void		       *send_info,
 		      unsigned char            version_major,
 		      unsigned char            version_minor,
+		      unsigned char            slave_addr,
 		      ipmi_smi_t               *intf)
 {
 	int              i, j;
@@ -1664,7 +1679,10 @@
 			new_intf->intf_num = i;
 			new_intf->version_major = version_major;
 			new_intf->version_minor = version_minor;
-			new_intf->my_address = IPMI_BMC_SLAVE_ADDR;
+			if (slave_addr == 0)
+				new_intf->my_address = IPMI_BMC_SLAVE_ADDR;
+			else
+				new_intf->my_address = slave_addr;
 			new_intf->my_lun = 2;  /* the SMS LUN. */
 			rwlock_init(&(new_intf->users_lock));
 			INIT_LIST_HEAD(&(new_intf->users));
diff -Nru a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
--- a/drivers/char/ipmi/ipmi_si_intf.c	2005-02-10 22:57:43 -08:00
+++ b/drivers/char/ipmi/ipmi_si_intf.c	2005-03-07 20:41:43 -08:00
@@ -176,6 +176,9 @@
 	unsigned char ipmi_version_major;
 	unsigned char ipmi_version_minor;
 
+	/* Slave address, could be reported from DMI. */
+	unsigned char slave_addr;
+
 	/* Counters and things for the proc filesystem. */
 	spinlock_t count_lock;
 	unsigned long short_timeouts;
@@ -407,7 +410,7 @@
 			/* Error fetching flags, just give up for
 			   now. */
 			smi_info->si_state = SI_NORMAL;
-		} else if (len < 3) {
+		} else if (len < 4) {
 			/* Hmm, no flags.  That's technically illegal, but
 			   don't use uninitialized data. */
 			smi_info->si_state = SI_NORMAL;
@@ -897,21 +900,23 @@
 #define DEFAULT_REGSPACING	1
 
 static int           si_trydefaults = 1;
-static char          *si_type[SI_MAX_PARMS] = { NULL, NULL, NULL, NULL };
+static char          *si_type[SI_MAX_PARMS];
 #define MAX_SI_TYPE_STR 30
 static char          si_type_str[MAX_SI_TYPE_STR];
-static unsigned long addrs[SI_MAX_PARMS] = { 0, 0, 0, 0 };
-static int num_addrs = 0;
-static unsigned int  ports[SI_MAX_PARMS] = { 0, 0, 0, 0 };
-static int num_ports = 0;
-static int           irqs[SI_MAX_PARMS] = { 0, 0, 0, 0 };
-static int num_irqs = 0;
-static int           regspacings[SI_MAX_PARMS] = { 0, 0, 0, 0 };
+static unsigned long addrs[SI_MAX_PARMS];
+static int num_addrs;
+static unsigned int  ports[SI_MAX_PARMS];
+static int num_ports;
+static int           irqs[SI_MAX_PARMS];
+static int num_irqs;
+static int           regspacings[SI_MAX_PARMS];
 static int num_regspacings = 0;
-static int           regsizes[SI_MAX_PARMS] = { 0, 0, 0, 0 };
+static int           regsizes[SI_MAX_PARMS];
 static int num_regsizes = 0;
-static int           regshifts[SI_MAX_PARMS] = { 0, 0, 0, 0 };
+static int           regshifts[SI_MAX_PARMS];
 static int num_regshifts = 0;
+static int slave_addrs[SI_MAX_PARMS];
+static int num_slave_addrs = 0;
 
 
 module_param_named(trydefaults, si_trydefaults, bool, 0);
@@ -955,6 +960,12 @@
 		 " IPMI register, in bits.  For instance, if the data"
 		 " is read from a 32-bit word and the IPMI data is in"
 		 " bit 8-15, then the shift would be 8");
+module_param_array(slave_addrs, int, &num_slave_addrs, 0);
+MODULE_PARM_DESC(slave_addrs, "Set the default IPMB slave address for"
+		 " the controller.  Normally this is 0x20, but can be"
+		 " overridden by this parm.  This is an array indexed"
+		 " by interface number.");
+
 
 #define IPMI_MEM_ADDR_SPACE 1
 #define IPMI_IO_ADDR_SPACE  2
@@ -1542,7 +1553,6 @@
 #endif
 
 #ifdef CONFIG_X86
-
 typedef struct dmi_ipmi_data
 {
 	u8   		type;
@@ -1550,21 +1560,26 @@
 	unsigned long	base_addr;
 	u8   		irq;
 	u8              offset;
-}dmi_ipmi_data_t;
+	u8              slave_addr;
+} dmi_ipmi_data_t;
+
+static dmi_ipmi_data_t dmi_data[SI_MAX_DRIVERS];
+static int dmi_data_entries;
 
 typedef struct dmi_header
 {
 	u8	type;
 	u8	length;
 	u16	handle;
-}dmi_header_t;
+} dmi_header_t;
 
-static int decode_dmi(dmi_header_t *dm, dmi_ipmi_data_t *ipmi_data)
+static int decode_dmi(dmi_header_t *dm, int intf_num)
 {
 	u8		*data = (u8 *)dm;
 	unsigned long  	base_addr;
 	u8		reg_spacing;
 	u8              len = dm->length;
+	dmi_ipmi_data_t *ipmi_data = dmi_data+intf_num;
 
 	ipmi_data->type = data[4];
 
@@ -1608,22 +1623,26 @@
 		ipmi_data->offset = 1;
 	}
 
-	if (is_new_interface(-1, ipmi_data->addr_space,ipmi_data->base_addr))
+	ipmi_data->slave_addr = data[6];
+
+	if (is_new_interface(-1, ipmi_data->addr_space,ipmi_data->base_addr)) {
+		dmi_data_entries++;
 		return 0;
+	}
 
 	memset(ipmi_data, 0, sizeof(dmi_ipmi_data_t));
 
 	return -1;
 }
 
-static int dmi_table(u32 base, int len, int num,
-	dmi_ipmi_data_t *ipmi_data)
+static int dmi_table(u32 base, int len, int num)
 {
 	u8 		  *buf;
 	struct dmi_header *dm;
 	u8 		  *data;
 	int 		  i=1;
 	int		  status=-1;
+	int               intf_num = 0;
 
 	buf = ioremap(base, len);
 	if(buf==NULL)
@@ -1639,9 +1658,10 @@
         		break;
 
 		if (dm->type == 38) {
-			if (decode_dmi(dm, ipmi_data) == 0) {
-				status = 0;
-				break;
+			if (decode_dmi(dm, intf_num) == 0) {
+				intf_num++;
+				if (intf_num >= SI_MAX_DRIVERS)
+					break;
 			}
 		}
 
@@ -1666,7 +1686,7 @@
 	return (sum==0);
 }
 
-static int dmi_iterator(dmi_ipmi_data_t *ipmi_data)
+static int dmi_decode(void)
 {
 	u8   buf[15];
 	u32  fp=0xF0000;
@@ -1684,7 +1704,7 @@
 			u16 len=buf[7]<<8|buf[6];
 			u32 base=buf[11]<<24|buf[10]<<16|buf[9]<<8|buf[8];
 
-			if(dmi_table(base, len, num, ipmi_data) == 0)
+			if(dmi_table(base, len, num) == 0)
 				return 0;
 		}
 		fp+=16;
@@ -1696,16 +1716,13 @@
 static int try_init_smbios(int intf_num, struct smi_info **new_info)
 {
 	struct smi_info   *info;
-	dmi_ipmi_data_t   ipmi_data;
+	dmi_ipmi_data_t   *ipmi_data = dmi_data+intf_num;
 	char              *io_type;
-	int               status;
-
-	status = dmi_iterator(&ipmi_data);
 
-	if (status < 0)
+	if (intf_num >= dmi_data_entries)
 		return -ENODEV;
 
-	switch(ipmi_data.type) {
+	switch(ipmi_data->type) {
 		case 0x01: /* KCS */
 			si_type[intf_num] = "kcs";
 			break;
@@ -1716,7 +1733,6 @@
 			si_type[intf_num] = "bt";
 			break;
 		default:
-			printk("ipmi_si: Unknown SMBIOS SI type.\n");
 			return -EIO;
 	}
 
@@ -1727,15 +1743,15 @@
 	}
 	memset(info, 0, sizeof(*info));
 
-	if (ipmi_data.addr_space == 1) {
+	if (ipmi_data->addr_space == 1) {
 		io_type = "memory";
 		info->io_setup = mem_setup;
-		addrs[intf_num] = ipmi_data.base_addr;
+		addrs[intf_num] = ipmi_data->base_addr;
 		info->io.info = &(addrs[intf_num]);
-	} else if (ipmi_data.addr_space == 2) {
+	} else if (ipmi_data->addr_space == 2) {
 		io_type = "I/O";
 		info->io_setup = port_setup;
-		ports[intf_num] = ipmi_data.base_addr;
+		ports[intf_num] = ipmi_data->base_addr;
 		info->io.info = &(ports[intf_num]);
 	} else {
 		kfree(info);
@@ -1743,20 +1759,23 @@
 		return -EIO;
 	}
 
-	regspacings[intf_num] = ipmi_data.offset;
+	regspacings[intf_num] = ipmi_data->offset;
 	info->io.regspacing = regspacings[intf_num];
 	if (!info->io.regspacing)
 		info->io.regspacing = DEFAULT_REGSPACING;
 	info->io.regsize = DEFAULT_REGSPACING;
 	info->io.regshift = regshifts[intf_num];
 
-	irqs[intf_num] = ipmi_data.irq;
+	info->slave_addr = ipmi_data->slave_addr;
+
+	irqs[intf_num] = ipmi_data->irq;
 
 	*new_info = info;
 
 	printk("ipmi_si: Found SMBIOS-specified state machine at %s"
-	       " address 0x%lx\n",
-	       io_type, (unsigned long)ipmi_data.base_addr);
+	       " address 0x%lx, slave address 0x%x\n",
+	       io_type, (unsigned long)ipmi_data->base_addr,
+	       ipmi_data->slave_addr);
 	return 0;
 }
 #endif /* CONFIG_X86 */
@@ -2121,6 +2140,7 @@
 			       new_smi,
 			       new_smi->ipmi_version_major,
 			       new_smi->ipmi_version_minor,
+			       new_smi->slave_addr,
 			       &(new_smi->intf));
 	if (rv) {
 		printk(KERN_ERR
@@ -2221,6 +2241,10 @@
 	if (bt_smi_handlers.version)
    	        printk(", BT version %s", bt_smi_handlers.version);
 	printk("\n");
+
+#ifdef CONFIG_X86
+	dmi_decode();
+#endif
 
 	rv = init_one_smi(0, &(smi_infos[pos]));
 	if (rv && !ports[0] && si_trydefaults) {
diff -Nru a/drivers/char/keyboard.c b/drivers/char/keyboard.c
--- a/drivers/char/keyboard.c	2005-02-26 10:12:08 -08:00
+++ b/drivers/char/keyboard.c	2005-03-07 20:41:34 -08:00
@@ -536,12 +536,12 @@
 
 static void fn_scroll_forw(struct vc_data *vc, struct pt_regs *regs)
 {
-	scrollfront(0);
+	scrollfront(vc, 0);
 }
 
 static void fn_scroll_back(struct vc_data *vc, struct pt_regs *regs)
 {
-	scrollback(0);
+	scrollback(vc, 0);
 }
 
 static void fn_show_mem(struct vc_data *vc, struct pt_regs *regs)
@@ -581,7 +581,7 @@
 	 */
 	if (tty)
 		do_SAK(tty);
-	reset_vc(fg_console);
+	reset_vc(vc);
 }
 
 static void fn_null(struct vc_data *vc, struct pt_regs *regs)
diff -Nru a/drivers/char/lp.c b/drivers/char/lp.c
--- a/drivers/char/lp.c	2005-01-10 17:29:36 -08:00
+++ b/drivers/char/lp.c	2005-03-07 20:41:39 -08:00
@@ -314,12 +314,14 @@
 	if (copy_size > LP_BUFFER_SIZE)
 		copy_size = LP_BUFFER_SIZE;
 
-	if (copy_from_user (kbuf, buf, copy_size))
-		return -EFAULT;
-
 	if (down_interruptible (&lp_table[minor].port_mutex))
 		return -EINTR;
 
+	if (copy_from_user (kbuf, buf, copy_size)) {
+		retv = -EFAULT;
+		goto out_unlock;
+	}
+
  	/* Claim Parport or sleep until it becomes available
  	 */
 	lp_claim_parport_or_block (&lp_table[minor]);
@@ -398,7 +400,7 @@
 		lp_table[minor].current_mode = IEEE1284_MODE_COMPAT;
 		lp_release_parport (&lp_table[minor]);
 	}
-
+out_unlock:
 	up (&lp_table[minor].port_mutex);
 
  	return retv;
diff -Nru a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
--- a/drivers/char/mmtimer.c	2005-01-28 15:38:57 -08:00
+++ b/drivers/char/mmtimer.c	2005-03-07 20:41:52 -08:00
@@ -376,7 +376,7 @@
 static struct timespec sgi_clock_offset;
 static int sgi_clock_period;
 
-static int sgi_clock_get(struct timespec *tp)
+static int sgi_clock_get(clockid_t clockid, struct timespec *tp)
 {
 	u64 nsec;
 
@@ -387,7 +387,7 @@
 	return 0;
 };
 
-static int sgi_clock_set(struct timespec *tp)
+static int sgi_clock_set(clockid_t clockid, struct timespec *tp)
 {
 
 	u64 nsec;
@@ -418,19 +418,19 @@
 	int n;
 	struct k_itimer *t = x->timer;
 
-	t->it_timer.magic = x->i;
+	t->it.mmtimer.clock = x->i;
 	t->it_overrun--;
 
 	n = 0;
 	do {
 
-		t->it_timer.expires += t->it_incr << n;
+		t->it.mmtimer.expires += t->it.mmtimer.incr << n;
 		t->it_overrun += 1 << n;
 		n++;
 		if (n > 20)
 			return 1;
 
-	} while (mmtimer_setup(x->i, t->it_timer.expires));
+	} while (mmtimer_setup(x->i, t->it.mmtimer.expires));
 
 	return 0;
 }
@@ -466,7 +466,7 @@
 		spin_lock(&base[i].lock);
 		if (base[i].cpu == smp_processor_id()) {
 			if (base[i].timer)
-				expires = base[i].timer->it_timer.expires;
+				expires = base[i].timer->it.mmtimer.expires;
 			/* expires test won't work with shared irqs */
 			if ((mmtimer_int_pending(i) > 0) ||
 				(expires && (expires < rtc_time()))) {
@@ -503,7 +503,7 @@
 
 		t->it_overrun++;
 	}
-	if(t->it_incr) {
+	if(t->it.mmtimer.incr) {
 		/* Periodic timer */
 		if (reschedule_periodic_timer(x)) {
 			printk(KERN_WARNING "mmtimer: unable to reschedule\n");
@@ -511,7 +511,7 @@
 		}
 	} else {
 		/* Ensure we don't false trigger in mmtimer_interrupt */
-		t->it_timer.expires = 0;
+		t->it.mmtimer.expires = 0;
 	}
 	t->it_overrun_last = t->it_overrun;
 out:
@@ -522,7 +522,7 @@
 static int sgi_timer_create(struct k_itimer *timer)
 {
 	/* Insure that a newly created timer is off */
-	timer->it_timer.magic = TIMER_OFF;
+	timer->it.mmtimer.clock = TIMER_OFF;
 	return 0;
 }
 
@@ -533,8 +533,8 @@
  */
 static int sgi_timer_del(struct k_itimer *timr)
 {
-	int i = timr->it_timer.magic;
-	cnodeid_t nodeid = timr->it_timer.data;
+	int i = timr->it.mmtimer.clock;
+	cnodeid_t nodeid = timr->it.mmtimer.node;
 	mmtimer_t *t = timers + nodeid * NUM_COMPARATORS +i;
 	unsigned long irqflags;
 
@@ -542,8 +542,8 @@
 		spin_lock_irqsave(&t->lock, irqflags);
 		mmtimer_disable_int(cnodeid_to_nasid(nodeid),i);
 		t->timer = NULL;
-		timr->it_timer.magic = TIMER_OFF;
-		timr->it_timer.expires = 0;
+		timr->it.mmtimer.clock = TIMER_OFF;
+		timr->it.mmtimer.expires = 0;
 		spin_unlock_irqrestore(&t->lock, irqflags);
 	}
 	return 0;
@@ -556,7 +556,7 @@
 static void sgi_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
 {
 
-	if (timr->it_timer.magic == TIMER_OFF) {
+	if (timr->it.mmtimer.clock == TIMER_OFF) {
 		cur_setting->it_interval.tv_nsec = 0;
 		cur_setting->it_interval.tv_sec = 0;
 		cur_setting->it_value.tv_nsec = 0;
@@ -564,8 +564,8 @@
 		return;
 	}
 
-	ns_to_timespec(cur_setting->it_interval, timr->it_incr * sgi_clock_period);
-	ns_to_timespec(cur_setting->it_value, (timr->it_timer.expires - rtc_time())* sgi_clock_period);
+	ns_to_timespec(cur_setting->it_interval, timr->it.mmtimer.incr * sgi_clock_period);
+	ns_to_timespec(cur_setting->it_value, (timr->it.mmtimer.expires - rtc_time())* sgi_clock_period);
 	return;
 }
 
@@ -638,19 +638,19 @@
 	base[i].timer = timr;
 	base[i].cpu = smp_processor_id();
 
-	timr->it_timer.magic = i;
-	timr->it_timer.data = nodeid;
-	timr->it_incr = period;
-	timr->it_timer.expires = when;
+	timr->it.mmtimer.clock = i;
+	timr->it.mmtimer.node = nodeid;
+	timr->it.mmtimer.incr = period;
+	timr->it.mmtimer.expires = when;
 
 	if (period == 0) {
 		if (mmtimer_setup(i, when)) {
 			mmtimer_disable_int(-1, i);
 			posix_timer_event(timr, 0);
-			timr->it_timer.expires = 0;
+			timr->it.mmtimer.expires = 0;
 		}
 	} else {
-		timr->it_timer.expires -= period;
+		timr->it.mmtimer.expires -= period;
 		if (reschedule_periodic_timer(base+i))
 			err = -EINVAL;
 	}
diff -Nru a/drivers/char/random.c b/drivers/char/random.c
--- a/drivers/char/random.c	2005-01-30 22:19:51 -08:00
+++ b/drivers/char/random.c	2005-03-07 20:41:51 -08:00
@@ -218,13 +218,6 @@
  * Any flaws in the design are solely my responsibility, and should
  * not be attributed to the Phil, Colin, or any of authors of PGP.
  *
- * The code for SHA transform was taken from Peter Gutmann's
- * implementation, which has been placed in the public domain.
- * The code for MD5 transform was taken from Colin Plumb's
- * implementation, which has been placed in the public domain.
- * The MD5 cryptographic checksum was devised by Ronald Rivest, and is
- * documented in RFC 1321, "The MD5 Message Digest Algorithm".
- *
  * Further background information on this topic may be obtained from
  * RFC 1750, "Randomness Recommendations for Security", by Donald
  * Eastlake, Steve Crocker, and Jeff Schiller.
@@ -242,11 +235,11 @@
 #include <linux/poll.h>
 #include <linux/init.h>
 #include <linux/fs.h>
-#include <linux/workqueue.h>
 #include <linux/genhd.h>
 #include <linux/interrupt.h>
 #include <linux/spinlock.h>
 #include <linux/percpu.h>
+#include <linux/cryptohash.h>
 
 #include <asm/processor.h>
 #include <asm/uaccess.h>
@@ -256,10 +249,9 @@
 /*
  * Configuration information
  */
-#define DEFAULT_POOL_SIZE 512
-#define SECONDARY_POOL_SIZE 128
-#define BATCH_ENTROPY_SIZE 256
-#define USE_SHA
+#define INPUT_POOL_WORDS 128
+#define OUTPUT_POOL_WORDS 32
+#define SEC_XFER_SIZE 512
 
 /*
  * The minimum number of bits of entropy before we wake up a read on
@@ -279,7 +271,7 @@
  * samples to avoid wasting CPU time and reduce lock contention.
  */
 
-static int trickle_thresh = DEFAULT_POOL_SIZE * 7;
+static int trickle_thresh = INPUT_POOL_WORDS * 28;
 
 static DEFINE_PER_CPU(int, trickle_count) = 0;
 
@@ -295,42 +287,37 @@
 	int poolwords;
 	int tap1, tap2, tap3, tap4, tap5;
 } poolinfo_table[] = {
+	/* x^128 + x^103 + x^76 + x^51 +x^25 + x + 1 -- 105 */
+	{ 128,	103,	76,	51,	25,	1 },
+	/* x^32 + x^26 + x^20 + x^14 + x^7 + x + 1 -- 15 */
+	{ 32,	26,	20,	14,	7,	1 },
+#if 0
 	/* x^2048 + x^1638 + x^1231 + x^819 + x^411 + x + 1  -- 115 */
 	{ 2048,	1638,	1231,	819,	411,	1 },
 
 	/* x^1024 + x^817 + x^615 + x^412 + x^204 + x + 1 -- 290 */
 	{ 1024,	817,	615,	412,	204,	1 },
-#if 0				/* Alternate polynomial */
+
 	/* x^1024 + x^819 + x^616 + x^410 + x^207 + x^2 + 1 -- 115 */
 	{ 1024,	819,	616,	410,	207,	2 },
-#endif
 
 	/* x^512 + x^411 + x^308 + x^208 + x^104 + x + 1 -- 225 */
 	{ 512,	411,	308,	208,	104,	1 },
-#if 0				/* Alternates */
+
 	/* x^512 + x^409 + x^307 + x^206 + x^102 + x^2 + 1 -- 95 */
 	{ 512,	409,	307,	206,	102,	2 },
 	/* x^512 + x^409 + x^309 + x^205 + x^103 + x^2 + 1 -- 95 */
 	{ 512,	409,	309,	205,	103,	2 },
-#endif
 
 	/* x^256 + x^205 + x^155 + x^101 + x^52 + x + 1 -- 125 */
 	{ 256,	205,	155,	101,	52,	1 },
 
-	/* x^128 + x^103 + x^76 + x^51 +x^25 + x + 1 -- 105 */
-	{ 128,	103,	76,	51,	25,	1 },
-#if 0	/* Alternate polynomial */
 	/* x^128 + x^103 + x^78 + x^51 + x^27 + x^2 + 1 -- 70 */
 	{ 128,	103,	78,	51,	27,	2 },
-#endif
 
 	/* x^64 + x^52 + x^39 + x^26 + x^14 + x + 1 -- 15 */
 	{ 64,	52,	39,	26,	14,	1 },
-
-	/* x^32 + x^26 + x^20 + x^14 + x^7 + x + 1 -- 15 */
-	{ 32,	26,	20,	14,	7,	1 },
-
-	{ 0,	0,	0,	0,	0,	0 },
+#endif
 };
 
 #define POOLBITS	poolwords*32
@@ -380,104 +367,20 @@
  */
 
 /*
- * Linux 2.2 compatibility
- */
-#ifndef DECLARE_WAITQUEUE
-#define DECLARE_WAITQUEUE(WAIT, PTR) struct wait_queue WAIT = { PTR, NULL }
-#endif
-#ifndef DECLARE_WAIT_QUEUE_HEAD
-#define DECLARE_WAIT_QUEUE_HEAD(WAIT) struct wait_queue *WAIT
-#endif
-
-/*
  * Static global variables
  */
-static struct entropy_store *random_state; /* The default global store */
-static struct entropy_store *sec_random_state; /* secondary store */
-static struct entropy_store *urandom_state; /* For urandom */
 static DECLARE_WAIT_QUEUE_HEAD(random_read_wait);
 static DECLARE_WAIT_QUEUE_HEAD(random_write_wait);
 
-/*
- * Forward procedure declarations
- */
-#ifdef CONFIG_SYSCTL
-static void sysctl_init_random(struct entropy_store *random_state);
-#endif
-
-/*****************************************************************
- *
- * Utility functions, with some ASM defined functions for speed
- * purposes
- *
- *****************************************************************/
-
-/*
- * Unfortunately, while the GCC optimizer for the i386 understands how
- * to optimize a static rotate left of x bits, it doesn't know how to
- * deal with a variable rotate of x bits.  So we use a bit of asm magic.
- */
-#if (!defined (__i386__))
-static inline __u32 rotate_left(int i, __u32 word)
-{
-	return (word << i) | (word >> (32 - i));
-}
-#else
-static inline __u32 rotate_left(int i, __u32 word)
-{
-	__asm__("roll %%cl,%0"
-		:"=r" (word)
-		:"0" (word),"c" (i));
-	return word;
-}
-#endif
-
-/*
- * More asm magic....
- *
- * For entropy estimation, we need to do an integral base 2
- * logarithm.
- *
- * Note the "12bits" suffix - this is used for numbers between
- * 0 and 4095 only.  This allows a few shortcuts.
- */
-#if 0	/* Slow but clear version */
-static inline __u32 int_ln_12bits(__u32 word)
-{
-	__u32 nbits = 0;
-
-	while (word >>= 1)
-		nbits++;
-	return nbits;
-}
-#else	/* Faster (more clever) version, courtesy Colin Plumb */
-static inline __u32 int_ln_12bits(__u32 word)
-{
-	/* Smear msbit right to make an n-bit mask */
-	word |= word >> 8;
-	word |= word >> 4;
-	word |= word >> 2;
-	word |= word >> 1;
-	/* Remove one bit to make this a logarithm */
-	word >>= 1;
-	/* Count the bits set in the word */
-	word -= (word >> 1) & 0x555;
-	word = (word & 0x333) + ((word >> 2) & 0x333);
-	word += (word >> 4);
-	word += (word >> 8);
-	return word & 15;
-}
-#endif
-
 #if 0
 static int debug = 0;
 module_param(debug, bool, 0644);
 #define DEBUG_ENT(fmt, arg...) do { if (debug) \
 	printk(KERN_DEBUG "random %04d %04d %04d: " \
 	fmt,\
-	random_state->entropy_count,\
-	sec_random_state->entropy_count,\
-	urandom_state->entropy_count,\
+	input_pool.entropy_count,\
+	blocking_pool.entropy_count,\
+	nonblocking_pool.entropy_count,\
 	## arg); } while (0)
 #else
 #define DEBUG_ENT(fmt, arg...) do {} while (0)
@@ -490,11 +393,14 @@
  *
  **********************************************************************/
 
+struct entropy_store;
 struct entropy_store {
 	/* mostly-read data: */
-	struct poolinfo poolinfo;
+	struct poolinfo *poolinfo;
 	__u32 *pool;
 	const char *name;
+	int limit;
+	struct entropy_store *pull;
 
 	/* read-write data: */
 	spinlock_t lock ____cacheline_aligned_in_smp;
@@ -503,57 +409,34 @@
 	int input_rotate;
 };
 
-/*
- * Initialize the entropy store.  The input argument is the size of
- * the random pool.
- *
- * Returns an negative error if there is a problem.
- */
-static int create_entropy_store(int size, const char *name,
-				struct entropy_store **ret_bucket)
-{
-	struct entropy_store *r;
-	struct poolinfo *p;
-	int poolwords;
-
-	poolwords = (size + 3) / 4; /* Convert bytes->words */
-	/* The pool size must be a multiple of 16 32-bit words */
-	poolwords = ((poolwords + 15) / 16) * 16;
-
-	for (p = poolinfo_table; p->poolwords; p++) {
-		if (poolwords == p->poolwords)
-			break;
-	}
-	if (p->poolwords == 0)
-		return -EINVAL;
+static __u32 input_pool_data[INPUT_POOL_WORDS];
+static __u32 blocking_pool_data[OUTPUT_POOL_WORDS];
+static __u32 nonblocking_pool_data[OUTPUT_POOL_WORDS];
+
+static struct entropy_store input_pool = {
+	.poolinfo = &poolinfo_table[0],
+	.name = "input",
+	.limit = 1,
+	.lock = SPIN_LOCK_UNLOCKED,
+	.pool = input_pool_data
+};
 
-	r = kmalloc(sizeof(struct entropy_store), GFP_KERNEL);
-	if (!r)
-		return -ENOMEM;
-
-	memset (r, 0, sizeof(struct entropy_store));
-	r->poolinfo = *p;
-
-	r->pool = kmalloc(POOLBYTES, GFP_KERNEL);
-	if (!r->pool) {
-		kfree(r);
-		return -ENOMEM;
-	}
-	memset(r->pool, 0, POOLBYTES);
-	spin_lock_init(&r->lock);
-	r->name = name;
-	*ret_bucket = r;
-	return 0;
-}
+static struct entropy_store blocking_pool = {
+	.poolinfo = &poolinfo_table[1],
+	.name = "blocking",
+	.limit = 1,
+	.pull = &input_pool,
+	.lock = SPIN_LOCK_UNLOCKED,
+	.pool = blocking_pool_data
+};
 
-/* Clear the entropy pool and associated counters. */
-static void clear_entropy_store(struct entropy_store *r)
-{
-	r->add_ptr = 0;
-	r->entropy_count = 0;
-	r->input_rotate = 0;
-	memset(r->pool, 0, r->poolinfo.POOLBYTES);
-}
+static struct entropy_store nonblocking_pool = {
+	.poolinfo = &poolinfo_table[1],
+	.name = "nonblocking",
+	.pull = &input_pool,
+	.lock = SPIN_LOCK_UNLOCKED,
+	.pool = nonblocking_pool_data
+};
 
 /*
  * This function adds a byte into the entropy "pool".  It does not
@@ -573,16 +456,16 @@
 		0xedb88320, 0xd6d6a3e8, 0x9b64c2b0, 0xa00ae278 };
 	unsigned long i, add_ptr, tap1, tap2, tap3, tap4, tap5;
 	int new_rotate, input_rotate;
-	int wordmask = r->poolinfo.poolwords - 1;
+	int wordmask = r->poolinfo->poolwords - 1;
 	__u32 w, next_w;
 	unsigned long flags;
 
 	/* Taps are constant, so we can load them without holding r->lock.  */
-	tap1 = r->poolinfo.tap1;
-	tap2 = r->poolinfo.tap2;
-	tap3 = r->poolinfo.tap3;
-	tap4 = r->poolinfo.tap4;
-	tap5 = r->poolinfo.tap5;
+	tap1 = r->poolinfo->tap1;
+	tap2 = r->poolinfo->tap2;
+	tap3 = r->poolinfo->tap3;
+	tap4 = r->poolinfo->tap4;
+	tap5 = r->poolinfo->tap5;
 	next_w = *in++;
 
 	spin_lock_irqsave(&r->lock, flags);
@@ -591,7 +474,7 @@
 	add_ptr = r->add_ptr;
 
 	while (nwords--) {
-		w = rotate_left(input_rotate, next_w);
+		w = rol32(next_w, input_rotate);
 		if (nwords > 0)
 			next_w = *in++;
 		i = add_ptr = (add_ptr - 1) & wordmask;
@@ -648,8 +531,8 @@
 		DEBUG_ENT("negative entropy/overflow (%d+%d)\n",
 			  r->entropy_count, nbits);
 		r->entropy_count = 0;
-	} else if (r->entropy_count + nbits > r->poolinfo.POOLBITS) {
-		r->entropy_count = r->poolinfo.POOLBITS;
+	} else if (r->entropy_count + nbits > r->poolinfo->POOLBITS) {
+		r->entropy_count = r->poolinfo->POOLBITS;
 	} else {
 		r->entropy_count += nbits;
 		if (nbits)
@@ -660,118 +543,6 @@
 	spin_unlock_irqrestore(&r->lock, flags);
 }
 
-/**********************************************************************
- *
- * Entropy batch input management
- *
- * We batch entropy to be added to avoid increasing interrupt latency
- *
- **********************************************************************/
-
-struct sample {
-	__u32 data[2];
-	int credit;
-};
-
-static struct sample *batch_entropy_pool, *batch_entropy_copy;
-static int batch_head, batch_tail;
-static DEFINE_SPINLOCK(batch_lock);
-
-static int batch_max;
-static void batch_entropy_process(void *private_);
-static DECLARE_WORK(batch_work, batch_entropy_process, NULL);
-
-/* note: the size must be a power of 2 */
-static int __init batch_entropy_init(int size, struct entropy_store *r)
-{
-	batch_entropy_pool = kmalloc(size*sizeof(struct sample), GFP_KERNEL);
-	if (!batch_entropy_pool)
-		return -1;
-	batch_entropy_copy = kmalloc(size*sizeof(struct sample), GFP_KERNEL);
-	if (!batch_entropy_copy) {
-		kfree(batch_entropy_pool);
-		return -1;
-	}
-	batch_head = batch_tail = 0;
-	batch_work.data = r;
-	batch_max = size;
-	return 0;
-}
-
-/*
- * Changes to the entropy data is put into a queue rather than being added to
- * the entropy counts directly.  This is presumably to avoid doing heavy
- * hashing calculations during an interrupt in add_timer_randomness().
- * Instead, the entropy is only added to the pool by keventd.
- */
-static void batch_entropy_store(u32 a, u32 b, int num)
-{
-	int new;
-	unsigned long flags;
-
-	if (!batch_max)
-		return;
-
-	spin_lock_irqsave(&batch_lock, flags);
-
-	batch_entropy_pool[batch_head].data[0] = a;
-	batch_entropy_pool[batch_head].data[1] = b;
-	batch_entropy_pool[batch_head].credit = num;
-
-	if (((batch_head - batch_tail) & (batch_max - 1)) >= (batch_max / 2))
-		schedule_delayed_work(&batch_work, 1);
-
-	new = (batch_head + 1) & (batch_max - 1);
-	if (new == batch_tail)
-		DEBUG_ENT("batch entropy buffer full\n");
-	else
-		batch_head = new;
-
-	spin_unlock_irqrestore(&batch_lock, flags);
-}
-
-/*
- * Flush out the accumulated entropy operations, adding entropy to the passed
- * store (normally random_state).  If that store has enough entropy, alternate
- * between randomizing the data of the primary and secondary stores.
- */
-static void batch_entropy_process(void *private_)
-{
-	struct entropy_store *r	= (struct entropy_store *) private_, *p;
-	int max_entropy = r->poolinfo.POOLBITS;
-	unsigned head, tail;
-
-	/* Mixing into the pool is expensive, so copy over the batch
-	 * data and release the batch lock. The pool is at least half
-	 * full, so don't worry too much about copying only the used
-	 * part.
-	 */
-	spin_lock_irq(&batch_lock);
-
-	memcpy(batch_entropy_copy, batch_entropy_pool,
-	       batch_max * sizeof(struct sample));
-
-	head = batch_head;
-	tail = batch_tail;
-	batch_tail = batch_head;
-
-	spin_unlock_irq(&batch_lock);
-
-	p = r;
-	while (head != tail) {
-		if (r->entropy_count >= max_entropy) {
-			r = (r == sec_random_state) ? random_state :
-				sec_random_state;
-			max_entropy = r->poolinfo.POOLBITS;
-		}
-		add_entropy_words(r, batch_entropy_copy[tail].data, 2);
-		credit_entropy_store(r, batch_entropy_copy[tail].credit);
-		tail = (tail + 1) & (batch_max - 1);
-	}
-	if (p->entropy_count >= random_read_wakeup_thresh)
-		wake_up_interruptible(&random_read_wait);
-}
-
 /*********************************************************************
  *
  * Entropy input management
@@ -786,7 +557,6 @@
 };
 
 static struct timer_rand_state input_timer_state;
-static struct timer_rand_state extract_timer_state;
 static struct timer_rand_state *irq_timer_state[NR_IRQS];
 
 /*
@@ -801,26 +571,33 @@
  */
 static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
 {
-	cycles_t data;
-	long delta, delta2, delta3, time;
-	int entropy = 0;
+	struct {
+		cycles_t cycles;
+		long jiffies;
+		unsigned num;
+	} sample;
+	long delta, delta2, delta3;
 
 	preempt_disable();
 	/* if over the trickle threshold, use only 1 in 4096 samples */
-	if (random_state->entropy_count > trickle_thresh &&
+	if (input_pool.entropy_count > trickle_thresh &&
 	    (__get_cpu_var(trickle_count)++ & 0xfff))
 		goto out;
 
+	sample.jiffies = jiffies;
+	sample.cycles = get_cycles();
+	sample.num = num;
+	add_entropy_words(&input_pool, (u32 *)&sample, sizeof(sample)/4);
+
 	/*
 	 * Calculate number of bits of randomness we probably added.
 	 * We take into account the first, second and third-order deltas
 	 * in order to make our estimate.
 	 */
-	time = jiffies;
 
 	if (!state->dont_count_entropy) {
-		delta = time - state->last_time;
-		state->last_time = time;
+		delta = sample.jiffies - state->last_time;
+		state->last_time = sample.jiffies;
 
 		delta2 = delta - state->last_delta;
 		state->last_delta = delta;
@@ -844,23 +621,13 @@
 		 * Round down by 1 bit on general principles,
 		 * and limit entropy entimate to 12 bits.
 		 */
-		delta >>= 1;
-		delta &= (1 << 12) - 1;
-
-		entropy = int_ln_12bits(delta);
+		credit_entropy_store(&input_pool,
+				     min_t(int, fls(delta>>1), 11));
 	}
 
-	/*
-	 * Use get_cycles() if implemented, otherwise fall back to
-	 * jiffies.
-	 */
-	data = get_cycles();
-	if (data)
-		num ^= (u32)((data >> 31) >> 1);
-	else
-		data = time;
+	if(input_pool.entropy_count >= random_read_wakeup_thresh)
+		wake_up_interruptible(&random_read_wait);
 
-	batch_entropy_store(num, data, entropy);
 out:
 	preempt_enable();
 }
@@ -902,391 +669,7 @@
 
 EXPORT_SYMBOL(add_disk_randomness);
 
-/******************************************************************
- *
- * Hash function definition
- *
- *******************************************************************/
-
-/*
- * This chunk of code defines a function
- * void HASH_TRANSFORM(__u32 digest[HASH_BUFFER_SIZE + HASH_EXTRA_SIZE],
- * 		__u32 const data[16])
- *
- * The function hashes the input data to produce a digest in the first
- * HASH_BUFFER_SIZE words of the digest[] array, and uses HASH_EXTRA_SIZE
- * more words for internal purposes.  (This buffer is exported so the
- * caller can wipe it once rather than this code doing it each call,
- * and tacking it onto the end of the digest[] array is the quick and
- * dirty way of doing it.)
- *
- * It so happens that MD5 and SHA share most of the initial vector
- * used to initialize the digest[] array before the first call:
- * 1) 0x67452301
- * 2) 0xefcdab89
- * 3) 0x98badcfe
- * 4) 0x10325476
- * 5) 0xc3d2e1f0 (SHA only)
- *
- * For /dev/random purposes, the length of the data being hashed is
- * fixed in length, so appending a bit count in the usual way is not
- * cryptographically necessary.
- */
-
-#ifdef USE_SHA
-
-#define HASH_BUFFER_SIZE 5
-#define HASH_EXTRA_SIZE 80
-#define HASH_TRANSFORM SHATransform
-
-/* Various size/speed tradeoffs are available.  Choose 0..3. */
-#define SHA_CODE_SIZE 0
-
-/*
- * SHA transform algorithm, taken from code written by Peter Gutmann,
- * and placed in the public domain.
- */
-
-/* The SHA f()-functions.  */
-
-#define f1(x,y,z)   (z ^ (x & (y ^ z)))		/* Rounds  0-19: x ? y : z */
-#define f2(x,y,z)   (x ^ y ^ z)			/* Rounds 20-39: XOR */
-#define f3(x,y,z)   ((x & y) + (z & (x ^ y)))	/* Rounds 40-59: majority */
-#define f4(x,y,z)   (x ^ y ^ z)			/* Rounds 60-79: XOR */
-
-/* The SHA Mysterious Constants */
-
-#define K1  0x5A827999L			/* Rounds  0-19: sqrt(2) * 2^30 */
-#define K2  0x6ED9EBA1L			/* Rounds 20-39: sqrt(3) * 2^30 */
-#define K3  0x8F1BBCDCL			/* Rounds 40-59: sqrt(5) * 2^30 */
-#define K4  0xCA62C1D6L			/* Rounds 60-79: sqrt(10) * 2^30 */
-
-#define ROTL(n,X)  (((X) << n ) | ((X) >> (32 - n)))
-
-#define subRound(a, b, c, d, e, f, k, data) \
-    (e += ROTL(5, a) + f(b, c, d) + k + data, b = ROTL(30, b))
-
-static void SHATransform(__u32 digest[85], __u32 const data[16])
-{
-	__u32 A, B, C, D, E;     /* Local vars */
-	__u32 TEMP;
-	int i;
-#define W (digest + HASH_BUFFER_SIZE)	/* Expanded data array */
-
-	/*
-	 * Do the preliminary expansion of 16 to 80 words.  Doing it
-	 * out-of-line line this is faster than doing it in-line on
-	 * register-starved machines like the x86, and not really any
-	 * slower on real processors.
-	 */
-	memcpy(W, data, 16*sizeof(__u32));
-	for (i = 0; i < 64; i++) {
-		TEMP = W[i] ^ W[i+2] ^ W[i+8] ^ W[i+13];
-		W[i+16] = ROTL(1, TEMP);
-	}
-
-	/* Set up first buffer and local data buffer */
-	A = digest[ 0 ];
-	B = digest[ 1 ];
-	C = digest[ 2 ];
-	D = digest[ 3 ];
-	E = digest[ 4 ];
-
-	/* Heavy mangling, in 4 sub-rounds of 20 iterations each. */
-#if SHA_CODE_SIZE == 0
-	/*
-	 * Approximately 50% of the speed of the largest version, but
-	 * takes up 1/16 the space.  Saves about 6k on an i386 kernel.
-	 */
-	for (i = 0; i < 80; i++) {
-		if (i < 40) {
-			if (i < 20)
-				TEMP = f1(B, C, D) + K1;
-			else
-				TEMP = f2(B, C, D) + K2;
-		} else {
-			if (i < 60)
-				TEMP = f3(B, C, D) + K3;
-			else
-				TEMP = f4(B, C, D) + K4;
-		}
-		TEMP += ROTL(5, A) + E + W[i];
-		E = D; D = C; C = ROTL(30, B); B = A; A = TEMP;
-	}
-#elif SHA_CODE_SIZE == 1
-	for (i = 0; i < 20; i++) {
-		TEMP = f1(B, C, D) + K1 + ROTL(5, A) + E + W[i];
-		E = D; D = C; C = ROTL(30, B); B = A; A = TEMP;
-	}
-	for (; i < 40; i++) {
-		TEMP = f2(B, C, D) + K2 + ROTL(5, A) + E + W[i];
-		E = D; D = C; C = ROTL(30, B); B = A; A = TEMP;
-	}
-	for (; i < 60; i++) {
-		TEMP = f3(B, C, D) + K3 + ROTL(5, A) + E + W[i];
-		E = D; D = C; C = ROTL(30, B); B = A; A = TEMP;
-	}
-	for (; i < 80; i++) {
-		TEMP = f4(B, C, D) + K4 + ROTL(5, A) + E + W[i];
-		E = D; D = C; C = ROTL(30, B); B = A; A = TEMP;
-	}
-#elif SHA_CODE_SIZE == 2
-	for (i = 0; i < 20; i += 5) {
-		subRound(A, B, C, D, E, f1, K1, W[i  ]);
-		subRound(E, A, B, C, D, f1, K1, W[i+1]);
-		subRound(D, E, A, B, C, f1, K1, W[i+2]);
-		subRound(C, D, E, A, B, f1, K1, W[i+3]);
-		subRound(B, C, D, E, A, f1, K1, W[i+4]);
-	}
-	for (; i < 40; i += 5) {
-		subRound(A, B, C, D, E, f2, K2, W[i  ]);
-		subRound(E, A, B, C, D, f2, K2, W[i+1]);
-		subRound(D, E, A, B, C, f2, K2, W[i+2]);
-		subRound(C, D, E, A, B, f2, K2, W[i+3]);
-		subRound(B, C, D, E, A, f2, K2, W[i+4]);
-	}
-	for (; i < 60; i += 5) {
-		subRound(A, B, C, D, E, f3, K3, W[i  ]);
-		subRound(E, A, B, C, D, f3, K3, W[i+1]);
-		subRound(D, E, A, B, C, f3, K3, W[i+2]);
-		subRound(C, D, E, A, B, f3, K3, W[i+3]);
-		subRound(B, C, D, E, A, f3, K3, W[i+4]);
-	}
-	for (; i < 80; i += 5) {
-		subRound(A, B, C, D, E, f4, K4, W[i  ]);
-		subRound(E, A, B, C, D, f4, K4, W[i+1]);
-		subRound(D, E, A, B, C, f4, K4, W[i+2]);
-		subRound(C, D, E, A, B, f4, K4, W[i+3]);
-		subRound(B, C, D, E, A, f4, K4, W[i+4]);
-	}
-#elif SHA_CODE_SIZE == 3 /* Really large version */
-	subRound(A, B, C, D, E, f1, K1, W[ 0]);
-	subRound(E, A, B, C, D, f1, K1, W[ 1]);
-	subRound(D, E, A, B, C, f1, K1, W[ 2]);
-	subRound(C, D, E, A, B, f1, K1, W[ 3]);
-	subRound(B, C, D, E, A, f1, K1, W[ 4]);
-	subRound(A, B, C, D, E, f1, K1, W[ 5]);
-	subRound(E, A, B, C, D, f1, K1, W[ 6]);
-	subRound(D, E, A, B, C, f1, K1, W[ 7]);
-	subRound(C, D, E, A, B, f1, K1, W[ 8]);
-	subRound(B, C, D, E, A, f1, K1, W[ 9]);
-	subRound(A, B, C, D, E, f1, K1, W[10]);
-	subRound(E, A, B, C, D, f1, K1, W[11]);
-	subRound(D, E, A, B, C, f1, K1, W[12]);
-	subRound(C, D, E, A, B, f1, K1, W[13]);
-	subRound(B, C, D, E, A, f1, K1, W[14]);
-	subRound(A, B, C, D, E, f1, K1, W[15]);
-	subRound(E, A, B, C, D, f1, K1, W[16]);
-	subRound(D, E, A, B, C, f1, K1, W[17]);
-	subRound(C, D, E, A, B, f1, K1, W[18]);
-	subRound(B, C, D, E, A, f1, K1, W[19]);
-
-	subRound(A, B, C, D, E, f2, K2, W[20]);
-	subRound(E, A, B, C, D, f2, K2, W[21]);
-	subRound(D, E, A, B, C, f2, K2, W[22]);
-	subRound(C, D, E, A, B, f2, K2, W[23]);
-	subRound(B, C, D, E, A, f2, K2, W[24]);
-	subRound(A, B, C, D, E, f2, K2, W[25]);
-	subRound(E, A, B, C, D, f2, K2, W[26]);
-	subRound(D, E, A, B, C, f2, K2, W[27]);
-	subRound(C, D, E, A, B, f2, K2, W[28]);
-	subRound(B, C, D, E, A, f2, K2, W[29]);
-	subRound(A, B, C, D, E, f2, K2, W[30]);
-	subRound(E, A, B, C, D, f2, K2, W[31]);
-	subRound(D, E, A, B, C, f2, K2, W[32]);
-	subRound(C, D, E, A, B, f2, K2, W[33]);
-	subRound(B, C, D, E, A, f2, K2, W[34]);
-	subRound(A, B, C, D, E, f2, K2, W[35]);
-	subRound(E, A, B, C, D, f2, K2, W[36]);
-	subRound(D, E, A, B, C, f2, K2, W[37]);
-	subRound(C, D, E, A, B, f2, K2, W[38]);
-	subRound(B, C, D, E, A, f2, K2, W[39]);
-
-	subRound(A, B, C, D, E, f3, K3, W[40]);
-	subRound(E, A, B, C, D, f3, K3, W[41]);
-	subRound(D, E, A, B, C, f3, K3, W[42]);
-	subRound(C, D, E, A, B, f3, K3, W[43]);
-	subRound(B, C, D, E, A, f3, K3, W[44]);
-	subRound(A, B, C, D, E, f3, K3, W[45]);
-	subRound(E, A, B, C, D, f3, K3, W[46]);
-	subRound(D, E, A, B, C, f3, K3, W[47]);
-	subRound(C, D, E, A, B, f3, K3, W[48]);
-	subRound(B, C, D, E, A, f3, K3, W[49]);
-	subRound(A, B, C, D, E, f3, K3, W[50]);
-	subRound(E, A, B, C, D, f3, K3, W[51]);
-	subRound(D, E, A, B, C, f3, K3, W[52]);
-	subRound(C, D, E, A, B, f3, K3, W[53]);
-	subRound(B, C, D, E, A, f3, K3, W[54]);
-	subRound(A, B, C, D, E, f3, K3, W[55]);
-	subRound(E, A, B, C, D, f3, K3, W[56]);
-	subRound(D, E, A, B, C, f3, K3, W[57]);
-	subRound(C, D, E, A, B, f3, K3, W[58]);
-	subRound(B, C, D, E, A, f3, K3, W[59]);
-
-	subRound(A, B, C, D, E, f4, K4, W[60]);
-	subRound(E, A, B, C, D, f4, K4, W[61]);
-	subRound(D, E, A, B, C, f4, K4, W[62]);
-	subRound(C, D, E, A, B, f4, K4, W[63]);
-	subRound(B, C, D, E, A, f4, K4, W[64]);
-	subRound(A, B, C, D, E, f4, K4, W[65]);
-	subRound(E, A, B, C, D, f4, K4, W[66]);
-	subRound(D, E, A, B, C, f4, K4, W[67]);
-	subRound(C, D, E, A, B, f4, K4, W[68]);
-	subRound(B, C, D, E, A, f4, K4, W[69]);
-	subRound(A, B, C, D, E, f4, K4, W[70]);
-	subRound(E, A, B, C, D, f4, K4, W[71]);
-	subRound(D, E, A, B, C, f4, K4, W[72]);
-	subRound(C, D, E, A, B, f4, K4, W[73]);
-	subRound(B, C, D, E, A, f4, K4, W[74]);
-	subRound(A, B, C, D, E, f4, K4, W[75]);
-	subRound(E, A, B, C, D, f4, K4, W[76]);
-	subRound(D, E, A, B, C, f4, K4, W[77]);
-	subRound(C, D, E, A, B, f4, K4, W[78]);
-	subRound(B, C, D, E, A, f4, K4, W[79]);
-#else
-#error Illegal SHA_CODE_SIZE
-#endif
-
-	/* Build message digest */
-	digest[0] += A;
-	digest[1] += B;
-	digest[2] += C;
-	digest[3] += D;
-	digest[4] += E;
-
-	/* W is wiped by the caller */
-#undef W
-}
-
-#undef ROTL
-#undef f1
-#undef f2
-#undef f3
-#undef f4
-#undef K1
-#undef K2
-#undef K3
-#undef K4
-#undef subRound
-
-#else /* !USE_SHA - Use MD5 */
-
-#define HASH_BUFFER_SIZE 4
-#define HASH_EXTRA_SIZE 0
-#define HASH_TRANSFORM MD5Transform
-
-/*
- * MD5 transform algorithm, taken from code written by Colin Plumb,
- * and put into the public domain
- */
-
-/* The four core functions - F1 is optimized somewhat */
-
-/* #define F1(x, y, z) (x & y | ~x & z) */
-#define F1(x, y, z) (z ^ (x & (y ^ z)))
-#define F2(x, y, z) F1(z, x, y)
-#define F3(x, y, z) (x ^ y ^ z)
-#define F4(x, y, z) (y ^ (x | ~z))
-
-/* This is the central step in the MD5 algorithm. */
-#define MD5STEP(f, w, x, y, z, data, s) \
-	(w += f(x, y, z) + data,  w = w << s | w >> (32 - s),  w += x )
-
-/*
- * The core of the MD5 algorithm, this alters an existing MD5 hash to
- * reflect the addition of 16 longwords of new data.  MD5Update blocks
- * the data and converts bytes into longwords for this routine.
- */
-static void MD5Transform(__u32 buf[HASH_BUFFER_SIZE], __u32 const in[16])
-{
-	__u32 a, b, c, d;
-
-	a = buf[0];
-	b = buf[1];
-	c = buf[2];
-	d = buf[3];
-
-	MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478,  7);
-	MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
-	MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
-	MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
-	MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf,  7);
-	MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
-	MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
-	MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
-	MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8,  7);
-	MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
-	MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
-	MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
-	MD5STEP(F1, a, b, c, d, in[12]+0x6b901122,  7);
-	MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
-	MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
-	MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
-
-	MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562,  5);
-	MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340,  9);
-	MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
-	MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
-	MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d,  5);
-	MD5STEP(F2, d, a, b, c, in[10]+0x02441453,  9);
-	MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
-	MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
-	MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6,  5);
-	MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6,  9);
-	MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
-	MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
-	MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905,  5);
-	MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8,  9);
-	MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
-	MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
-
-	MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942,  4);
-	MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
-	MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
-	MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
-	MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44,  4);
-	MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
-	MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
-	MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
-	MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6,  4);
-	MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
-	MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
-	MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
-	MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039,  4);
-	MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
-	MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
-	MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
-
-	MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244,  6);
-	MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
-	MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
-	MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
-	MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3,  6);
-	MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
-	MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
-	MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
-	MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f,  6);
-	MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
-	MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
-	MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
-	MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82,  6);
-	MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
-	MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
-	MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
-
-	buf[0] += a;
-	buf[1] += b;
-	buf[2] += c;
-	buf[3] += d;
-}
-
-#undef F1
-#undef F2
-#undef F3
-#undef F4
-#undef MD5STEP
-
-#endif /* !USE_SHA */
+#define EXTRACT_SIZE 10
 
 /*********************************************************************
  *
@@ -1294,157 +677,174 @@
  *
  *********************************************************************/
 
-#define EXTRACT_ENTROPY_USER		1
-#define EXTRACT_ENTROPY_SECONDARY	2
-#define EXTRACT_ENTROPY_LIMIT		4
-#define TMP_BUF_SIZE			(HASH_BUFFER_SIZE + HASH_EXTRA_SIZE)
-#define SEC_XFER_SIZE			(TMP_BUF_SIZE*4)
-
 static ssize_t extract_entropy(struct entropy_store *r, void * buf,
-			       size_t nbytes, int flags);
+			       size_t nbytes, int min, int rsvd);
 
 /*
  * This utility inline function is responsible for transfering entropy
  * from the primary pool to the secondary extraction pool. We make
  * sure we pull enough for a 'catastrophic reseed'.
  */
-static inline void xfer_secondary_pool(struct entropy_store *r,
-				       size_t nbytes, __u32 *tmp)
+static void xfer_secondary_pool(struct entropy_store *r, size_t nbytes)
 {
-	if (r->entropy_count < nbytes * 8 &&
-	    r->entropy_count < r->poolinfo.POOLBITS) {
+	__u32 tmp[OUTPUT_POOL_WORDS];
+
+	if (r->pull && r->entropy_count < nbytes * 8 &&
+	    r->entropy_count < r->poolinfo->POOLBITS) {
 		int bytes = max_t(int, random_read_wakeup_thresh / 8,
-				min_t(int, nbytes, TMP_BUF_SIZE));
+				min_t(int, nbytes, sizeof(tmp)));
+		int rsvd = r->limit ? 0 : random_read_wakeup_thresh/4;
 
 		DEBUG_ENT("going to reseed %s with %d bits "
 			  "(%d of %d requested)\n",
 			  r->name, bytes * 8, nbytes * 8, r->entropy_count);
 
-		bytes=extract_entropy(random_state, tmp, bytes,
-				      EXTRACT_ENTROPY_LIMIT);
+		bytes=extract_entropy(r->pull, tmp, bytes,
+				      random_read_wakeup_thresh / 8, rsvd);
 		add_entropy_words(r, tmp, (bytes + 3) / 4);
 		credit_entropy_store(r, bytes*8);
 	}
 }
 
 /*
- * This function extracts randomness from the "entropy pool", and
- * returns it in a buffer.  This function computes how many remaining
- * bits of entropy are left in the pool, but it does not restrict the
- * number of bytes that are actually obtained.  If the EXTRACT_ENTROPY_USER
- * flag is given, then the buf pointer is assumed to be in user space.
- *
- * If the EXTRACT_ENTROPY_SECONDARY flag is given, then we are actually
- * extracting entropy from the secondary pool, and can refill from the
- * primary pool if needed.
+ * These functions extracts randomness from the "entropy pool", and
+ * returns it in a buffer.
+ *
+ * The min parameter specifies the minimum amount we can pull before
+ * failing to avoid races that defeat catastrophic reseeding while the
+ * reserved parameter indicates how much entropy we must leave in the
+ * pool after each pull to avoid starving other readers.
  *
  * Note: extract_entropy() assumes that .poolwords is a multiple of 16 words.
  */
-static ssize_t extract_entropy(struct entropy_store *r, void * buf,
-			       size_t nbytes, int flags)
+
+static size_t account(struct entropy_store *r, size_t nbytes, int min,
+		      int reserved)
 {
-	ssize_t ret, i;
-	__u32 tmp[TMP_BUF_SIZE], data[16];
-	__u32 x;
-	unsigned long cpuflags;
-
-	/* Redundant, but just in case... */
-	if (r->entropy_count > r->poolinfo.POOLBITS)
-		r->entropy_count = r->poolinfo.POOLBITS;
+	unsigned long flags;
 
-	if (flags & EXTRACT_ENTROPY_SECONDARY)
-		xfer_secondary_pool(r, nbytes, tmp);
+	BUG_ON(r->entropy_count > r->poolinfo->POOLBITS);
 
 	/* Hold lock while accounting */
-	spin_lock_irqsave(&r->lock, cpuflags);
+	spin_lock_irqsave(&r->lock, flags);
 
 	DEBUG_ENT("trying to extract %d bits from %s\n",
 		  nbytes * 8, r->name);
 
-	if (flags & EXTRACT_ENTROPY_LIMIT && nbytes >= r->entropy_count / 8)
-		nbytes = r->entropy_count / 8;
-
-	if (r->entropy_count / 8 >= nbytes)
-		r->entropy_count -= nbytes*8;
-	else
-		r->entropy_count = 0;
+	/* Can we pull enough? */
+	if (r->entropy_count / 8 < min + reserved) {
+		nbytes = 0;
+	} else {
+		/* If limited, never pull more than available */
+		if (r->limit && nbytes + reserved >= r->entropy_count / 8)
+			nbytes = r->entropy_count/8 - reserved;
+
+		if(r->entropy_count / 8 >= nbytes + reserved)
+			r->entropy_count -= nbytes*8;
+		else
+			r->entropy_count = reserved;
 
-	if (r->entropy_count < random_write_wakeup_thresh)
-		wake_up_interruptible(&random_write_wait);
+		if (r->entropy_count < random_write_wakeup_thresh)
+			wake_up_interruptible(&random_write_wait);
+	}
 
 	DEBUG_ENT("debiting %d entropy credits from %s%s\n",
-		  nbytes * 8, r->name,
-		  flags & EXTRACT_ENTROPY_LIMIT ? "" : " (unlimited)");
+		  nbytes * 8, r->name, r->limit ? "" : " (unlimited)");
 
-	spin_unlock_irqrestore(&r->lock, cpuflags);
+	spin_unlock_irqrestore(&r->lock, flags);
+
+	return nbytes;
+}
+
+static void extract_buf(struct entropy_store *r, __u8 *out)
+{
+	int i, x;
+	__u32 data[16], buf[5 + SHA_WORKSPACE_WORDS];
+
+	sha_init(buf);
+	/*
+	 * As we hash the pool, we mix intermediate values of
+	 * the hash back into the pool.  This eliminates
+	 * backtracking attacks (where the attacker knows
+	 * the state of the pool plus the current outputs, and
+	 * attempts to find previous ouputs), unless the hash
+	 * function can be inverted.
+	 */
+	for (i = 0, x = 0; i < r->poolinfo->poolwords; i += 16, x+=2) {
+		sha_transform(buf, (__u8 *)r->pool+i, buf + 5);
+		add_entropy_words(r, &buf[x % 5], 1);
+	}
+
+	/*
+	 * To avoid duplicates, we atomically extract a
+	 * portion of the pool while mixing, and hash one
+	 * final time.
+	 */
+	__add_entropy_words(r, &buf[x % 5], 1, data);
+	sha_transform(buf, (__u8 *)data, buf + 5);
+
+	/*
+	 * In case the hash function has some recognizable
+	 * output pattern, we fold it in half.
+	 */
+
+	buf[0] ^= buf[3];
+	buf[1] ^= buf[4];
+	buf[0] ^= rol32(buf[3], 16);
+	memcpy(out, buf, EXTRACT_SIZE);
+	memset(buf, 0, sizeof(buf));
+}
+
+static ssize_t extract_entropy(struct entropy_store *r, void * buf,
+			       size_t nbytes, int min, int reserved)
+{
+	ssize_t ret = 0, i;
+	__u8 tmp[EXTRACT_SIZE];
+
+	xfer_secondary_pool(r, nbytes);
+	nbytes = account(r, nbytes, min, reserved);
 
-	ret = 0;
 	while (nbytes) {
-		/*
-		 * Check if we need to break out or reschedule....
-		 */
-		if ((flags & EXTRACT_ENTROPY_USER) && need_resched()) {
+		extract_buf(r, tmp);
+		i = min_t(int, nbytes, EXTRACT_SIZE);
+		memcpy(buf, tmp, i);
+		nbytes -= i;
+		buf += i;
+		ret += i;
+	}
+
+	/* Wipe data just returned from memory */
+	memset(tmp, 0, sizeof(tmp));
+
+	return ret;
+}
+
+static ssize_t extract_entropy_user(struct entropy_store *r, void __user *buf,
+				    size_t nbytes)
+{
+	ssize_t ret = 0, i;
+	__u8 tmp[EXTRACT_SIZE];
+
+	xfer_secondary_pool(r, nbytes);
+	nbytes = account(r, nbytes, 0, 0);
+
+	while (nbytes) {
+		if (need_resched()) {
 			if (signal_pending(current)) {
 				if (ret == 0)
 					ret = -ERESTARTSYS;
 				break;
 			}
-
 			schedule();
 		}
 
-		/* Hash the pool to get the output */
-		tmp[0] = 0x67452301;
-		tmp[1] = 0xefcdab89;
-		tmp[2] = 0x98badcfe;
-		tmp[3] = 0x10325476;
-#ifdef USE_SHA
-		tmp[4] = 0xc3d2e1f0;
-#endif
-		/*
-		 * As we hash the pool, we mix intermediate values of
-		 * the hash back into the pool.  This eliminates
-		 * backtracking attacks (where the attacker knows
-		 * the state of the pool plus the current outputs, and
-		 * attempts to find previous ouputs), unless the hash
-		 * function can be inverted.
-		 */
-		for (i = 0, x = 0; i < r->poolinfo.poolwords; i += 16, x+=2) {
-			HASH_TRANSFORM(tmp, r->pool+i);
-			add_entropy_words(r, &tmp[x%HASH_BUFFER_SIZE], 1);
+		extract_buf(r, tmp);
+		i = min_t(int, nbytes, EXTRACT_SIZE);
+		if (copy_to_user(buf, tmp, i)) {
+			ret = -EFAULT;
+			break;
 		}
 
-		/*
-		 * To avoid duplicates, we atomically extract a
-		 * portion of the pool while mixing, and hash one
-		 * final time.
-		 */
-		__add_entropy_words(r, &tmp[x%HASH_BUFFER_SIZE], 1, data);
-		HASH_TRANSFORM(tmp, data);
-
-		/*
-		 * In case the hash function has some recognizable
-		 * output pattern, we fold it in half.
-		 */
-		for (i = 0; i <  HASH_BUFFER_SIZE/2; i++)
-			tmp[i] ^= tmp[i + (HASH_BUFFER_SIZE+1)/2];
-#if HASH_BUFFER_SIZE & 1	/* There's a middle word to deal with */
-		x = tmp[HASH_BUFFER_SIZE/2];
-		x ^= (x >> 16);		/* Fold it in half */
-		((__u16 *)tmp)[HASH_BUFFER_SIZE-1] = (__u16)x;
-#endif
-
-		/* Copy data to destination buffer */
-		i = min(nbytes, HASH_BUFFER_SIZE*sizeof(__u32)/2);
-		if (flags & EXTRACT_ENTROPY_USER) {
-			i -= copy_to_user(buf, (__u8 const *)tmp, i);
-			if (!i) {
-				ret = -EFAULT;
-				break;
-			}
-		} else
-			memcpy(buf, (__u8 const *)tmp, i);
-
 		nbytes -= i;
 		buf += i;
 		ret += i;
@@ -1463,91 +863,41 @@
  */
 void get_random_bytes(void *buf, int nbytes)
 {
-	struct entropy_store *r = urandom_state;
-	int flags = EXTRACT_ENTROPY_SECONDARY;
-
-	if (!r)
-		r = sec_random_state;
-	if (!r) {
-		r = random_state;
-		flags = 0;
-	}
-	if (!r) {
-		printk(KERN_NOTICE "get_random_bytes called before "
-				   "random driver initialization\n");
-		return;
-	}
-	extract_entropy(r, (char *) buf, nbytes, flags);
+	extract_entropy(&nonblocking_pool, buf, nbytes, 0, 0);
 }
 
 EXPORT_SYMBOL(get_random_bytes);
 
-/*********************************************************************
- *
- * Functions to interface with Linux
- *
- *********************************************************************/
-
 /*
- * Initialize the random pool with standard stuff.
+ * init_std_data - initialize pool with system data
+ *
+ * @r: pool to initialize
  *
- * NOTE: This is an OS-dependent function.
+ * This function clears the pool's entropy count and mixes some system
+ * data into the pool to prepare it for use. The pool is not cleared
+ * as that can only decrease the entropy in the pool.
  */
 static void init_std_data(struct entropy_store *r)
 {
 	struct timeval tv;
-	__u32 words[2];
-	char *p;
-	int i;
+	unsigned long flags;
 
-	do_gettimeofday(&tv);
-	words[0] = tv.tv_sec;
-	words[1] = tv.tv_usec;
-	add_entropy_words(r, words, 2);
+	spin_lock_irqsave(&r->lock, flags);
+	r->entropy_count = 0;
+	spin_unlock_irqrestore(&r->lock, flags);
 
-	/*
-	 *	This doesn't lock system.utsname. However, we are generating
-	 *	entropy so a race with a name set here is fine.
-	 */
-	p = (char *) &system_utsname;
-	for (i = sizeof(system_utsname) / sizeof(words); i; i--) {
-		memcpy(words, p, sizeof(words));
-		add_entropy_words(r, words, sizeof(words)/4);
-		p += sizeof(words);
-	}
+	do_gettimeofday(&tv);
+	add_entropy_words(r, (__u32 *)&tv, sizeof(tv)/4);
+	add_entropy_words(r, (__u32 *)&system_utsname,
+			  sizeof(system_utsname)/4);
 }
 
 static int __init rand_initialize(void)
 {
-	int i;
-
-	if (create_entropy_store(DEFAULT_POOL_SIZE, "primary", &random_state))
-		goto err;
-	if (batch_entropy_init(BATCH_ENTROPY_SIZE, random_state))
-		goto err;
-	if (create_entropy_store(SECONDARY_POOL_SIZE, "secondary",
-				 &sec_random_state))
-		goto err;
-	if (create_entropy_store(SECONDARY_POOL_SIZE, "urandom",
-				 &urandom_state))
-		goto err;
-	clear_entropy_store(random_state);
-	clear_entropy_store(sec_random_state);
-	clear_entropy_store(urandom_state);
-	init_std_data(random_state);
-	init_std_data(sec_random_state);
-	init_std_data(urandom_state);
-#ifdef CONFIG_SYSCTL
-	sysctl_init_random(random_state);
-#endif
-	for (i = 0; i < NR_IRQS; i++)
-		irq_timer_state[i] = NULL;
-	memset(&input_timer_state, 0, sizeof(struct timer_rand_state));
-	memset(&extract_timer_state, 0, sizeof(struct timer_rand_state));
-	extract_timer_state.dont_count_entropy = 1;
+	init_std_data(&input_pool);
+	init_std_data(&blocking_pool);
+	init_std_data(&nonblocking_pool);
 	return 0;
-err:
-	return -1;
 }
 module_init(rand_initialize);
 
@@ -1587,7 +937,6 @@
 static ssize_t
 random_read(struct file * file, char __user * buf, size_t nbytes, loff_t *ppos)
 {
-	DECLARE_WAITQUEUE(wait, current);
 	ssize_t n, retval = 0, count = 0;
 
 	if (nbytes == 0)
@@ -1600,10 +949,7 @@
 
 		DEBUG_ENT("reading %d bits\n", n*8);
 
-		n = extract_entropy(sec_random_state, buf, n,
-				    EXTRACT_ENTROPY_USER |
-				    EXTRACT_ENTROPY_LIMIT |
-				    EXTRACT_ENTROPY_SECONDARY);
+		n = extract_entropy_user(&blocking_pool, buf, n);
 
 		DEBUG_ENT("read got %d bits (%d still needed)\n",
 			  n*8, (nbytes-n)*8);
@@ -1613,20 +959,20 @@
 				retval = -EAGAIN;
 				break;
 			}
+
+			DEBUG_ENT("sleeping?\n");
+
+			wait_event_interruptible(random_read_wait,
+				input_pool.entropy_count >=
+						 random_read_wakeup_thresh);
+
+			DEBUG_ENT("awake\n");
+
 			if (signal_pending(current)) {
 				retval = -ERESTARTSYS;
 				break;
 			}
 
-			set_current_state(TASK_INTERRUPTIBLE);
-			add_wait_queue(&random_read_wait, &wait);
-
-			if (sec_random_state->entropy_count / 8 == 0)
-				schedule();
-
-			set_current_state(TASK_RUNNING);
-			remove_wait_queue(&random_read_wait, &wait);
-
 			continue;
 		}
 
@@ -1654,15 +1000,7 @@
 urandom_read(struct file * file, char __user * buf,
 		      size_t nbytes, loff_t *ppos)
 {
-	int flags = EXTRACT_ENTROPY_USER;
-	unsigned long cpuflags;
-
-	spin_lock_irqsave(&random_state->lock, cpuflags);
-	if (random_state->entropy_count > random_state->poolinfo.POOLBITS)
-		flags |= EXTRACT_ENTROPY_SECONDARY;
-	spin_unlock_irqrestore(&random_state->lock, cpuflags);
-
-	return extract_entropy(urandom_state, buf, nbytes, flags);
+	return extract_entropy_user(&nonblocking_pool, buf, nbytes);
 }
 
 static unsigned int
@@ -1673,9 +1011,9 @@
 	poll_wait(file, &random_read_wait, wait);
 	poll_wait(file, &random_write_wait, wait);
 	mask = 0;
-	if (random_state->entropy_count >= random_read_wakeup_thresh)
+	if (input_pool.entropy_count >= random_read_wakeup_thresh)
 		mask |= POLLIN | POLLRDNORM;
-	if (random_state->entropy_count < random_write_wakeup_thresh)
+	if (input_pool.entropy_count < random_write_wakeup_thresh)
 		mask |= POLLOUT | POLLWRNORM;
 	return mask;
 }
@@ -1701,7 +1039,7 @@
 		c -= bytes;
 		p += bytes;
 
-		add_entropy_words(random_state, buf, (bytes + 3) / 4);
+		add_entropy_words(&input_pool, buf, (bytes + 3) / 4);
 	}
 	if (p == buffer) {
 		return (ssize_t)ret;
@@ -1723,7 +1061,7 @@
 
 	switch (cmd) {
 	case RNDGETENTCNT:
-		ent_count = random_state->entropy_count;
+		ent_count = input_pool.entropy_count;
 		if (put_user(ent_count, p))
 			return -EFAULT;
 		return 0;
@@ -1732,12 +1070,12 @@
 			return -EPERM;
 		if (get_user(ent_count, p))
 			return -EFAULT;
-		credit_entropy_store(random_state, ent_count);
+		credit_entropy_store(&input_pool, ent_count);
 		/*
 		 * Wake up waiting processes if we have enough
 		 * entropy.
 		 */
-		if (random_state->entropy_count >= random_read_wakeup_thresh)
+		if (input_pool.entropy_count >= random_read_wakeup_thresh)
 			wake_up_interruptible(&random_read_wait);
 		return 0;
 	case RNDADDENTROPY:
@@ -1753,25 +1091,22 @@
 				      size, &file->f_pos);
 		if (retval < 0)
 			return retval;
-		credit_entropy_store(random_state, ent_count);
+		credit_entropy_store(&input_pool, ent_count);
 		/*
 		 * Wake up waiting processes if we have enough
 		 * entropy.
 		 */
-		if (random_state->entropy_count >= random_read_wakeup_thresh)
+		if (input_pool.entropy_count >= random_read_wakeup_thresh)
 			wake_up_interruptible(&random_read_wait);
 		return 0;
 	case RNDZAPENTCNT:
-		if (!capable(CAP_SYS_ADMIN))
-			return -EPERM;
-		random_state->entropy_count = 0;
-		return 0;
 	case RNDCLEARPOOL:
-		/* Clear the entropy pool and associated counters. */
+		/* Clear the entropy pool counters. */
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
-		clear_entropy_store(random_state);
-		init_std_data(random_state);
+		init_std_data(&input_pool);
+		init_std_data(&blocking_pool);
+		init_std_data(&nonblocking_pool);
 		return 0;
 	default:
 		return -EINVAL;
@@ -1822,8 +1157,9 @@
 
 #include <linux/sysctl.h>
 
-static int min_read_thresh, max_read_thresh;
-static int min_write_thresh, max_write_thresh;
+static int min_read_thresh = 8, min_write_thresh;
+static int max_read_thresh = INPUT_POOL_WORDS * 32;
+static int max_write_thresh = INPUT_POOL_WORDS * 32;
 static char sysctl_bootid[16];
 
 /*
@@ -1891,7 +1227,7 @@
 	return 1;
 }
 
-static int sysctl_poolsize = DEFAULT_POOL_SIZE;
+static int sysctl_poolsize = INPUT_POOL_WORDS * 32;
 ctl_table random_table[] = {
 	{
 		.ctl_name 	= RANDOM_POOLSIZE,
@@ -1907,6 +1243,7 @@
 		.maxlen		= sizeof(int),
 		.mode		= 0444,
 		.proc_handler	= &proc_dointvec,
+		.data		= &input_pool.entropy_count,
 	},
 	{
 		.ctl_name	= RANDOM_READ_THRESH,
@@ -1949,14 +1286,6 @@
 	},
 	{ .ctl_name = 0 }
 };
-
-static void sysctl_init_random(struct entropy_store *random_state)
-{
-	min_read_thresh = 8;
-	min_write_thresh = 0;
-	max_read_thresh = max_write_thresh = random_state->poolinfo.POOLBITS;
-	random_table[1].data = &random_state->entropy_count;
-}
 #endif 	/* CONFIG_SYSCTL */
 
 /********************************************************************
@@ -1965,7 +1294,6 @@
  *
  ********************************************************************/
 
-#ifdef CONFIG_INET
 /*
  * TCP initial sequence number picking.  This uses the random number
  * generator to pick an initial secret value.  This value is hashed
@@ -1996,47 +1324,6 @@
 #define K2 013240474631UL
 #define K3 015666365641UL
 
-/*
- * Basic cut-down MD4 transform.  Returns only 32 bits of result.
- */
-static __u32 halfMD4Transform (__u32 const buf[4], __u32 const in[8])
-{
-	__u32 a = buf[0], b = buf[1], c = buf[2], d = buf[3];
-
-	/* Round 1 */
-	ROUND(F, a, b, c, d, in[0] + K1,  3);
-	ROUND(F, d, a, b, c, in[1] + K1,  7);
-	ROUND(F, c, d, a, b, in[2] + K1, 11);
-	ROUND(F, b, c, d, a, in[3] + K1, 19);
-	ROUND(F, a, b, c, d, in[4] + K1,  3);
-	ROUND(F, d, a, b, c, in[5] + K1,  7);
-	ROUND(F, c, d, a, b, in[6] + K1, 11);
-	ROUND(F, b, c, d, a, in[7] + K1, 19);
-
-	/* Round 2 */
-	ROUND(G, a, b, c, d, in[1] + K2,  3);
-	ROUND(G, d, a, b, c, in[3] + K2,  5);
-	ROUND(G, c, d, a, b, in[5] + K2,  9);
-	ROUND(G, b, c, d, a, in[7] + K2, 13);
-	ROUND(G, a, b, c, d, in[0] + K2,  3);
-	ROUND(G, d, a, b, c, in[2] + K2,  5);
-	ROUND(G, c, d, a, b, in[4] + K2,  9);
-	ROUND(G, b, c, d, a, in[6] + K2, 13);
-
-	/* Round 3 */
-	ROUND(H, a, b, c, d, in[3] + K3,  3);
-	ROUND(H, d, a, b, c, in[7] + K3,  9);
-	ROUND(H, c, d, a, b, in[2] + K3, 11);
-	ROUND(H, b, c, d, a, in[6] + K3, 15);
-	ROUND(H, a, b, c, d, in[1] + K3,  3);
-	ROUND(H, d, a, b, c, in[5] + K3,  9);
-	ROUND(H, c, d, a, b, in[0] + K3, 11);
-	ROUND(H, b, c, d, a, in[4] + K3, 15);
-
-	return buf[1] + b;	/* "most hashed" word */
-	/* Alternative: return sum of all words? */
-}
-
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
 
 static __u32 twothirdsMD4Transform (__u32 const buf[4], __u32 const in[12])
@@ -2202,6 +1489,31 @@
 EXPORT_SYMBOL(secure_tcpv6_sequence_number);
 #endif
 
+/*  The code below is shamelessly stolen from secure_tcp_sequence_number().
+ *  All blames to Andrey V. Savochkin <saw@msu.ru>.
+ */
+__u32 secure_ip_id(__u32 daddr)
+{
+	struct keydata *keyptr;
+	__u32 hash[4];
+
+	keyptr = get_keyptr();
+
+	/*
+	 *  Pick a unique starting offset for each IP destination.
+	 *  The dest ip address is placed in the starting vector,
+	 *  which is then hashed with random data.
+	 */
+	hash[0] = daddr;
+	hash[1] = keyptr->secret[9];
+	hash[2] = keyptr->secret[10];
+	hash[3] = keyptr->secret[11];
+
+	return half_md4_transform(hash, keyptr->secret);
+}
+
+#ifdef CONFIG_INET
+
 __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr,
 				 __u16 sport, __u16 dport)
 {
@@ -2221,7 +1533,7 @@
 	hash[2]=(sport << 16) + dport;
 	hash[3]=keyptr->secret[11];
 
-	seq = halfMD4Transform(hash, keyptr->secret) & HASH_MASK;
+	seq = half_md4_transform(hash, keyptr->secret) & HASH_MASK;
 	seq += keyptr->count;
 	/*
 	 *	As close as possible to RFC 793, which
@@ -2242,28 +1554,7 @@
 
 EXPORT_SYMBOL(secure_tcp_sequence_number);
 
-/*  The code below is shamelessly stolen from secure_tcp_sequence_number().
- *  All blames to Andrey V. Savochkin <saw@msu.ru>.
- */
-__u32 secure_ip_id(__u32 daddr)
-{
-	struct keydata *keyptr;
-	__u32 hash[4];
-
-	keyptr = get_keyptr();
-
-	/*
-	 *  Pick a unique starting offset for each IP destination.
-	 *  The dest ip address is placed in the starting vector,
-	 *  which is then hashed with random data.
-	 */
-	hash[0] = daddr;
-	hash[1] = keyptr->secret[9];
-	hash[2] = keyptr->secret[10];
-	hash[3] = keyptr->secret[11];
 
-	return halfMD4Transform(hash, keyptr->secret);
-}
 
 /* Generate secure starting point for ephemeral TCP port search */
 u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport)
@@ -2280,106 +1571,59 @@
 	hash[2] = dport ^ keyptr->secret[10];
 	hash[3] = keyptr->secret[11];
 
-	return halfMD4Transform(hash, keyptr->secret);
+	return half_md4_transform(hash, keyptr->secret);
 }
 
-#ifdef CONFIG_SYN_COOKIES
-/*
- * Secure SYN cookie computation. This is the algorithm worked out by
- * Dan Bernstein and Eric Schenk.
- *
- * For linux I implement the 1 minute counter by looking at the jiffies clock.
- * The count is passed in as a parameter, so this code doesn't much care.
- */
+#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
+u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, __u16 dport)
+{
+	struct keydata *keyptr = get_keyptr();
+	u32 hash[12];
 
-#define COOKIEBITS 24	/* Upper bits store count */
-#define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1)
+	memcpy(hash, saddr, 16);
+	hash[4] = dport;
+	memcpy(&hash[5],keyptr->secret,sizeof(__u32) * 7);
 
-static int syncookie_init;
-static __u32 syncookie_secret[2][16-3+HASH_BUFFER_SIZE];
+	return twothirdsMD4Transform(daddr, hash);
+}
+EXPORT_SYMBOL(secure_tcpv6_port_ephemeral);
+#endif
 
-__u32 secure_tcp_syn_cookie(__u32 saddr, __u32 daddr, __u16 sport,
-		__u16 dport, __u32 sseq, __u32 count, __u32 data)
-{
-	__u32 tmp[16 + HASH_BUFFER_SIZE + HASH_EXTRA_SIZE];
-	__u32 seq;
+#endif /* CONFIG_INET */
 
-	/*
-	 * Pick two random secrets the first time we need a cookie.
-	 */
-	if (syncookie_init == 0) {
-		get_random_bytes(syncookie_secret, sizeof(syncookie_secret));
-		syncookie_init = 1;
-	}
 
+/*
+ * Get a random word for internal kernel use only. Similar to urandom but
+ * with the goal of minimal entropy pool depletion. As a result, the random
+ * value is not cryptographically secure but for several uses the cost of
+ * depleting entropy is too high
+ */
+unsigned int get_random_int(void)
+{
 	/*
-	 * Compute the secure sequence number.
-	 * The output should be:
-   	 *   HASH(sec1,saddr,sport,daddr,dport,sec1) + sseq + (count * 2^24)
-	 *      + (HASH(sec2,saddr,sport,daddr,dport,count,sec2) % 2^24).
-	 * Where sseq is their sequence number and count increases every
-	 * minute by 1.
-	 * As an extra hack, we add a small "data" value that encodes the
-	 * MSS into the second hash value.
+	 * Use IP's RNG. It suits our purpose perfectly: it re-keys itself
+	 * every second, from the entropy pool (and thus creates a limited
+	 * drain on it), and uses halfMD4Transform within the second. We
+	 * also mix it with jiffies and the PID:
 	 */
-
-	memcpy(tmp + 3, syncookie_secret[0], sizeof(syncookie_secret[0]));
-	tmp[0]=saddr;
-	tmp[1]=daddr;
-	tmp[2]=(sport << 16) + dport;
-	HASH_TRANSFORM(tmp+16, tmp);
-	seq = tmp[17] + sseq + (count << COOKIEBITS);
-
-	memcpy(tmp + 3, syncookie_secret[1], sizeof(syncookie_secret[1]));
-	tmp[0]=saddr;
-	tmp[1]=daddr;
-	tmp[2]=(sport << 16) + dport;
-	tmp[3] = count;	/* minute counter */
-	HASH_TRANSFORM(tmp + 16, tmp);
-
-	/* Add in the second hash and the data */
-	return seq + ((tmp[17] + data) & COOKIEMASK);
+	return secure_ip_id(current->pid + jiffies);
 }
 
 /*
- * This retrieves the small "data" value from the syncookie.
- * If the syncookie is bad, the data returned will be out of
- * range.  This must be checked by the caller.
- *
- * The count value used to generate the cookie must be within
- * "maxdiff" if the current (passed-in) "count".  The return value
- * is (__u32)-1 if this test fails.
- */
-__u32 check_tcp_syn_cookie(__u32 cookie, __u32 saddr, __u32 daddr, __u16 sport,
-		__u16 dport, __u32 sseq, __u32 count, __u32 maxdiff)
-{
-	__u32 tmp[16 + HASH_BUFFER_SIZE + HASH_EXTRA_SIZE];
-	__u32 diff;
-
-	if (syncookie_init == 0)
-		return (__u32)-1; /* Well, duh! */
-
-	/* Strip away the layers from the cookie */
-	memcpy(tmp + 3, syncookie_secret[0], sizeof(syncookie_secret[0]));
-	tmp[0]=saddr;
-	tmp[1]=daddr;
-	tmp[2]=(sport << 16) + dport;
-	HASH_TRANSFORM(tmp + 16, tmp);
-	cookie -= tmp[17] + sseq;
-	/* Cookie is now reduced to (count * 2^24) ^ (hash % 2^24) */
-
-	diff = (count - (cookie >> COOKIEBITS)) & ((__u32)-1 >> COOKIEBITS);
-	if (diff >= maxdiff)
-		return (__u32)-1;
-
-	memcpy(tmp+3, syncookie_secret[1], sizeof(syncookie_secret[1]));
-	tmp[0] = saddr;
-	tmp[1] = daddr;
-	tmp[2] = (sport << 16) + dport;
-	tmp[3] = count - diff;	/* minute counter */
-	HASH_TRANSFORM(tmp + 16, tmp);
+ * randomize_range() returns a start address such that
+ *
+ *    [...... <range> .....]
+ *  start                  end
+ *
+ * a <range> with size "len" starting at the return value is inside in the
+ * area defined by [start, end], but is otherwise randomized.
+ */
+unsigned long
+randomize_range(unsigned long start, unsigned long end, unsigned long len)
+{
+	unsigned long range = end - len - start;
 
-	return (cookie - tmp[17]) & COOKIEMASK;	/* Leaving the data behind */
+	if (end <= start + len)
+		return 0;
+	return PAGE_ALIGN(get_random_int() % range + start);
 }
-#endif
-#endif /* CONFIG_INET */
diff -Nru a/drivers/char/rtc.c b/drivers/char/rtc.c
--- a/drivers/char/rtc.c	2005-01-07 21:44:12 -08:00
+++ b/drivers/char/rtc.c	2005-03-07 20:41:39 -08:00
@@ -73,6 +73,7 @@
 #include <linux/init.h>
 #include <linux/poll.h>
 #include <linux/proc_fs.h>
+#include <linux/seq_file.h>
 #include <linux/spinlock.h>
 #include <linux/sysctl.h>
 #include <linux/wait.h>
@@ -151,8 +152,7 @@
 static void mask_rtc_irq_bit(unsigned char bit);
 #endif
 
-static int rtc_read_proc(char *page, char **start, off_t off,
-                         int count, int *eof, void *data);
+static int rtc_proc_open(struct inode *inode, struct file *file);
 
 /*
  *	Bits in rtc_status. (6 bits of room for future expansion)
@@ -871,11 +871,18 @@
 	.fasync		= rtc_fasync,
 };
 
-static struct miscdevice rtc_dev=
-{
-	RTC_MINOR,
-	"rtc",
-	&rtc_fops
+static struct miscdevice rtc_dev = {
+	.minor		= RTC_MINOR,
+	.name		= "rtc",
+	.fops		= &rtc_fops,
+};
+
+static struct file_operations rtc_proc_fops = {
+	.owner = THIS_MODULE,
+	.open = rtc_proc_open,
+	.read  = seq_read,
+	.llseek = seq_lseek,
+	.release = single_release,
 };
 
 #if defined(RTC_IRQ) && !defined(__sparc__)
@@ -884,6 +891,7 @@
 
 static int __init rtc_init(void)
 {
+	struct proc_dir_entry *ent;
 #if defined(__alpha__) || defined(__mips__)
 	unsigned int year, ctrl;
 	unsigned long uip_watchdog;
@@ -974,7 +982,9 @@
 		release_region(RTC_PORT(0), RTC_IO_EXTENT);
 		return -ENODEV;
 	}
-	if (!create_proc_read_entry ("driver/rtc", 0, NULL, rtc_read_proc, NULL)) {
+
+	ent = create_proc_entry("driver/rtc", 0, NULL);
+	if (!ent) {
 #ifdef RTC_IRQ
 		free_irq(RTC_IRQ, NULL);
 #endif
@@ -982,6 +992,7 @@
 		misc_deregister(&rtc_dev);
 		return -ENOMEM;
 	}
+	ent->proc_fops = &rtc_proc_fops;
 
 #if defined(__alpha__) || defined(__mips__)
 	rtc_freq = HZ;
@@ -1119,11 +1130,10 @@
  *	Info exported via "/proc/driver/rtc".
  */
 
-static int rtc_proc_output (char *buf)
+static int rtc_proc_show(struct seq_file *seq, void *v)
 {
 #define YN(bit) ((ctrl & bit) ? "yes" : "no")
 #define NY(bit) ((ctrl & bit) ? "no" : "yes")
-	char *p;
 	struct rtc_time tm;
 	unsigned char batt, ctrl;
 	unsigned long freq;
@@ -1134,7 +1144,6 @@
 	freq = rtc_freq;
 	spin_unlock_irq(&rtc_lock);
 
-	p = buf;
 
 	rtc_get_rtc_time(&tm);
 
@@ -1142,12 +1151,12 @@
 	 * There is no way to tell if the luser has the RTC set for local
 	 * time or for Universal Standard Time (GMT). Probably local though.
 	 */
-	p += sprintf(p,
-		     "rtc_time\t: %02d:%02d:%02d\n"
-		     "rtc_date\t: %04d-%02d-%02d\n"
-	 	     "rtc_epoch\t: %04lu\n",
-		     tm.tm_hour, tm.tm_min, tm.tm_sec,
-		     tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, epoch);
+	seq_printf(seq,
+		   "rtc_time\t: %02d:%02d:%02d\n"
+		   "rtc_date\t: %04d-%02d-%02d\n"
+		   "rtc_epoch\t: %04lu\n",
+		   tm.tm_hour, tm.tm_min, tm.tm_sec,
+		   tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, epoch);
 
 	get_rtc_alm_time(&tm);
 
@@ -1156,57 +1165,50 @@
 	 * match any value for that particular field. Values that are
 	 * greater than a valid time, but less than 0xc0 shouldn't appear.
 	 */
-	p += sprintf(p, "alarm\t\t: ");
+	seq_puts(seq, "alarm\t\t: ");
 	if (tm.tm_hour <= 24)
-		p += sprintf(p, "%02d:", tm.tm_hour);
+		seq_printf(seq, "%02d:", tm.tm_hour);
 	else
-		p += sprintf(p, "**:");
+		seq_puts(seq, "**:");
 
 	if (tm.tm_min <= 59)
-		p += sprintf(p, "%02d:", tm.tm_min);
+		seq_printf(seq, "%02d:", tm.tm_min);
 	else
-		p += sprintf(p, "**:");
+		seq_puts(seq, "**:");
 
 	if (tm.tm_sec <= 59)
-		p += sprintf(p, "%02d\n", tm.tm_sec);
+		seq_printf(seq, "%02d\n", tm.tm_sec);
 	else
-		p += sprintf(p, "**\n");
+		seq_puts(seq, "**\n");
 
-	p += sprintf(p,
-		     "DST_enable\t: %s\n"
-		     "BCD\t\t: %s\n"
-		     "24hr\t\t: %s\n"
-		     "square_wave\t: %s\n"
-		     "alarm_IRQ\t: %s\n"
-		     "update_IRQ\t: %s\n"
-		     "periodic_IRQ\t: %s\n"
-		     "periodic_freq\t: %ld\n"
-		     "batt_status\t: %s\n",
-		     YN(RTC_DST_EN),
-		     NY(RTC_DM_BINARY),
-		     YN(RTC_24H),
-		     YN(RTC_SQWE),
-		     YN(RTC_AIE),
-		     YN(RTC_UIE),
-		     YN(RTC_PIE),
-		     freq,
-		     batt ? "okay" : "dead");
+	seq_printf(seq,
+		   "DST_enable\t: %s\n"
+		   "BCD\t\t: %s\n"
+		   "24hr\t\t: %s\n"
+		   "square_wave\t: %s\n"
+		   "alarm_IRQ\t: %s\n"
+		   "update_IRQ\t: %s\n"
+		   "periodic_IRQ\t: %s\n"
+		   "periodic_freq\t: %ld\n"
+		   "batt_status\t: %s\n",
+		   YN(RTC_DST_EN),
+		   NY(RTC_DM_BINARY),
+		   YN(RTC_24H),
+		   YN(RTC_SQWE),
+		   YN(RTC_AIE),
+		   YN(RTC_UIE),
+		   YN(RTC_PIE),
+		   freq,
+		   batt ? "okay" : "dead");
 
-	return  p - buf;
+	return  0;
 #undef YN
 #undef NY
 }
 
-static int rtc_read_proc(char *page, char **start, off_t off,
-                         int count, int *eof, void *data)
+static int rtc_proc_open(struct inode *inode, struct file *file)
 {
-        int len = rtc_proc_output (page);
-        if (len <= off+count) *eof = 1;
-        *start = page + off;
-        len -= off;
-        if (len>count) len = count;
-        if (len<0) len = 0;
-        return len;
+	return single_open(file, rtc_proc_show, NULL);
 }
 
 void rtc_get_rtc_time(struct rtc_time *rtc_tm)
diff -Nru a/drivers/char/selection.c b/drivers/char/selection.c
--- a/drivers/char/selection.c	2005-01-10 17:29:34 -08:00
+++ b/drivers/char/selection.c	2005-03-07 20:41:34 -08:00
@@ -43,15 +43,13 @@
    from interrupt (via scrollback/front) */
 
 /* set reverse video on characters s-e of console with selection. */
-inline static void
-highlight(const int s, const int e)
+static inline void highlight(const int s, const int e)
 {
 	invert_screen(sel_cons, s, e-s+2, 1);
 }
 
 /* use complementary color to show the pointer */
-inline static void
-highlight_pointer(const int where)
+static inline void highlight_pointer(const int where)
 {
 	complement_pos(sel_cons, where);
 }
@@ -277,7 +275,7 @@
  */
 int paste_selection(struct tty_struct *tty)
 {
-	struct vt_struct *vt = (struct vt_struct *) tty->driver_data;
+	struct vc_data *vc = (struct vc_data *)tty->driver_data;
 	int	pasted = 0, count;
 	struct  tty_ldisc *ld;
 	DECLARE_WAITQUEUE(wait, current);
@@ -288,7 +286,7 @@
 
 	ld = tty_ldisc_ref_wait(tty);
 	
-	add_wait_queue(&vt->paste_wait, &wait);
+	add_wait_queue(&vc->paste_wait, &wait);
 	while (sel_buffer && sel_buffer_lth > pasted) {
 		set_current_state(TASK_INTERRUPTIBLE);
 		if (test_bit(TTY_THROTTLED, &tty->flags)) {
@@ -300,7 +298,7 @@
 		tty->ldisc.receive_buf(tty, sel_buffer + pasted, NULL, count);
 		pasted += count;
 	}
-	remove_wait_queue(&vt->paste_wait, &wait);
+	remove_wait_queue(&vc->paste_wait, &wait);
 	current->state = TASK_RUNNING;
 
 	tty_ldisc_deref(ld);
diff -Nru a/drivers/char/stallion.c b/drivers/char/stallion.c
--- a/drivers/char/stallion.c	2004-10-21 10:03:21 -07:00
+++ b/drivers/char/stallion.c	2005-03-05 07:32:33 -08:00
@@ -174,14 +174,6 @@
  */
 static char		stl_unwanted[SC26198_RXFIFOSIZE];
 
-/*
- *	Keep track of what interrupts we have requested for us.
- *	We don't need to request an interrupt twice if it is being
- *	shared with another Stallion board.
- */
-static int	stl_gotintrs[STL_MAXBRDS];
-static int	stl_numintrs;
-
 /*****************************************************************************/
 
 static stlbrd_t		*stl_brds[STL_MAXBRDS];
@@ -504,7 +496,6 @@
 
 static int	stl_brdinit(stlbrd_t *brdp);
 static int	stl_initports(stlbrd_t *brdp, stlpanel_t *panelp);
-static int	stl_mapirq(int irq, char *name);
 static int	stl_getserial(stlport_t *portp, struct serial_struct __user *sp);
 static int	stl_setserial(stlport_t *portp, struct serial_struct __user *sp);
 static int	stl_getbrdstats(combrd_t __user *bp);
@@ -513,11 +504,11 @@
 static int	stl_getportstruct(stlport_t __user *arg);
 static int	stl_getbrdstruct(stlbrd_t __user *arg);
 static int	stl_waitcarrier(stlport_t *portp, struct file *filp);
-static void	stl_eiointr(stlbrd_t *brdp);
-static void	stl_echatintr(stlbrd_t *brdp);
-static void	stl_echmcaintr(stlbrd_t *brdp);
-static void	stl_echpciintr(stlbrd_t *brdp);
-static void	stl_echpci64intr(stlbrd_t *brdp);
+static int	stl_eiointr(stlbrd_t *brdp);
+static int	stl_echatintr(stlbrd_t *brdp);
+static int	stl_echmcaintr(stlbrd_t *brdp);
+static int	stl_echpciintr(stlbrd_t *brdp);
+static int	stl_echpci64intr(stlbrd_t *brdp);
 static void	stl_offintr(void *private);
 static void	*stl_memalloc(int len);
 static stlbrd_t *stl_allocbrd(void);
@@ -807,6 +798,9 @@
 	for (i = 0; (i < stl_nrbrds); i++) {
 		if ((brdp = stl_brds[i]) == (stlbrd_t *) NULL)
 			continue;
+
+		free_irq(brdp->irq, brdp);
+
 		for (j = 0; (j < STL_MAXPANELS); j++) {
 			panelp = brdp->panels[j];
 			if (panelp == (stlpanel_t *) NULL)
@@ -832,9 +826,6 @@
 		stl_brds[i] = (stlbrd_t *) NULL;
 	}
 
-	for (i = 0; (i < stl_numintrs); i++)
-		free_irq(stl_gotintrs[i], NULL);
-
 	restore_flags(flags);
 }
 
@@ -1992,23 +1983,14 @@
 
 static irqreturn_t stl_intr(int irq, void *dev_id, struct pt_regs *regs)
 {
-	stlbrd_t	*brdp;
-	int		i;
-	int handled = 0;
+	stlbrd_t	*brdp = (stlbrd_t *) dev_id;
 
 #ifdef DEBUG
-	printk("stl_intr(irq=%d,regs=%x)\n", irq, (int) regs);
+	printk("stl_intr(brdp=%x,irq=%d,regs=%x)\n", (int) brdp, irq,
+	    (int) regs);
 #endif
 
-	for (i = 0; (i < stl_nrbrds); i++) {
-		if ((brdp = stl_brds[i]) == (stlbrd_t *) NULL)
-			continue;
-		if (brdp->state == 0)
-			continue;
-		handled = 1;
-		(* brdp->isr)(brdp);
-	}
-	return IRQ_RETVAL(handled);
+	return IRQ_RETVAL((* brdp->isr)(brdp));
 }
 
 /*****************************************************************************/
@@ -2017,15 +1999,19 @@
  *	Interrupt service routine for EasyIO board types.
  */
 
-static void stl_eiointr(stlbrd_t *brdp)
+static int stl_eiointr(stlbrd_t *brdp)
 {
 	stlpanel_t	*panelp;
 	unsigned int	iobase;
+	int		handled = 0;
 
 	panelp = brdp->panels[0];
 	iobase = panelp->iobase;
-	while (inb(brdp->iostatus) & EIO_INTRPEND)
+	while (inb(brdp->iostatus) & EIO_INTRPEND) {
+		handled = 1;
 		(* panelp->isr)(panelp, iobase);
+	}
+	return handled;
 }
 
 /*****************************************************************************/
@@ -2034,15 +2020,17 @@
  *	Interrupt service routine for ECH-AT board types.
  */
 
-static void stl_echatintr(stlbrd_t *brdp)
+static int stl_echatintr(stlbrd_t *brdp)
 {
 	stlpanel_t	*panelp;
 	unsigned int	ioaddr;
 	int		bnknr;
+	int		handled = 0;
 
 	outb((brdp->ioctrlval | ECH_BRDENABLE), brdp->ioctrl);
 
 	while (inb(brdp->iostatus) & ECH_INTRPEND) {
+		handled = 1;
 		for (bnknr = 0; (bnknr < brdp->nrbnks); bnknr++) {
 			ioaddr = brdp->bnkstataddr[bnknr];
 			if (inb(ioaddr) & ECH_PNLINTRPEND) {
@@ -2053,6 +2041,8 @@
 	}
 
 	outb((brdp->ioctrlval | ECH_BRDDISABLE), brdp->ioctrl);
+
+	return handled;
 }
 
 /*****************************************************************************/
@@ -2061,13 +2051,15 @@
  *	Interrupt service routine for ECH-MCA board types.
  */
 
-static void stl_echmcaintr(stlbrd_t *brdp)
+static int stl_echmcaintr(stlbrd_t *brdp)
 {
 	stlpanel_t	*panelp;
 	unsigned int	ioaddr;
 	int		bnknr;
+	int		handled = 0;
 
 	while (inb(brdp->iostatus) & ECH_INTRPEND) {
+		handled = 1;
 		for (bnknr = 0; (bnknr < brdp->nrbnks); bnknr++) {
 			ioaddr = brdp->bnkstataddr[bnknr];
 			if (inb(ioaddr) & ECH_PNLINTRPEND) {
@@ -2076,6 +2068,7 @@
 			}
 		}
 	}
+	return handled;
 }
 
 /*****************************************************************************/
@@ -2084,11 +2077,12 @@
  *	Interrupt service routine for ECH-PCI board types.
  */
 
-static void stl_echpciintr(stlbrd_t *brdp)
+static int stl_echpciintr(stlbrd_t *brdp)
 {
 	stlpanel_t	*panelp;
 	unsigned int	ioaddr;
 	int		bnknr, recheck;
+	int		handled = 0;
 
 	while (1) {
 		recheck = 0;
@@ -2099,11 +2093,13 @@
 				panelp = brdp->bnk2panel[bnknr];
 				(* panelp->isr)(panelp, (ioaddr & 0xfffc));
 				recheck++;
+				handled = 1;
 			}
 		}
 		if (! recheck)
 			break;
 	}
+	return handled;
 }
 
 /*****************************************************************************/
@@ -2112,13 +2108,15 @@
  *	Interrupt service routine for ECH-8/64-PCI board types.
  */
 
-static void stl_echpci64intr(stlbrd_t *brdp)
+static int stl_echpci64intr(stlbrd_t *brdp)
 {
 	stlpanel_t	*panelp;
 	unsigned int	ioaddr;
 	int		bnknr;
+	int		handled = 0;
 
 	while (inb(brdp->ioctrl) & 0x1) {
+		handled = 1;
 		for (bnknr = 0; (bnknr < brdp->nrbnks); bnknr++) {
 			ioaddr = brdp->bnkstataddr[bnknr];
 			if (inb(ioaddr) & ECH_PNLINTRPEND) {
@@ -2127,6 +2125,8 @@
 			}
 		}
 	}
+
+	return handled;
 }
 
 /*****************************************************************************/
@@ -2174,39 +2174,6 @@
 /*****************************************************************************/
 
 /*
- *	Map in interrupt vector to this driver. Check that we don't
- *	already have this vector mapped, we might be sharing this
- *	interrupt across multiple boards.
- */
-
-static int __init stl_mapirq(int irq, char *name)
-{
-	int	rc, i;
-
-#ifdef DEBUG
-	printk("stl_mapirq(irq=%d,name=%s)\n", irq, name);
-#endif
-
-	rc = 0;
-	for (i = 0; (i < stl_numintrs); i++) {
-		if (stl_gotintrs[i] == irq)
-			break;
-	}
-	if (i >= stl_numintrs) {
-		if (request_irq(irq, stl_intr, SA_SHIRQ, name, NULL) != 0) {
-			printk("STALLION: failed to register interrupt "
-				"routine for %s irq=%d\n", name, irq);
-			rc = -ENODEV;
-		} else {
-			stl_gotintrs[stl_numintrs++] = irq;
-		}
-	}
-	return(rc);
-}
-
-/*****************************************************************************/
-
-/*
  *	Initialize all the ports on a panel.
  */
 
@@ -2389,7 +2356,13 @@
 	brdp->nrpanels = 1;
 	brdp->state |= BRD_FOUND;
 	brdp->hwid = status;
-	rc = stl_mapirq(brdp->irq, name);
+	if (request_irq(brdp->irq, stl_intr, SA_SHIRQ, name, brdp) != 0) {
+		printk("STALLION: failed to register interrupt "
+		    "routine for %s irq=%d\n", name, brdp->irq);
+		rc = -ENODEV;
+	} else {
+		rc = 0;
+	}
 	return(rc);
 }
 
@@ -2594,7 +2567,14 @@
 		outb((brdp->ioctrlval | ECH_BRDDISABLE), brdp->ioctrl);
 
 	brdp->state |= BRD_FOUND;
-	i = stl_mapirq(brdp->irq, name);
+	if (request_irq(brdp->irq, stl_intr, SA_SHIRQ, name, brdp) != 0) {
+		printk("STALLION: failed to register interrupt "
+		    "routine for %s irq=%d\n", name, brdp->irq);
+		i = -ENODEV;
+	} else {
+		i = 0;
+	}
+
 	return(i);
 }
 
diff -Nru a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
--- a/drivers/char/synclinkmp.c	2005-01-07 21:44:25 -08:00
+++ b/drivers/char/synclinkmp.c	2005-03-07 20:41:43 -08:00
@@ -1,5 +1,5 @@
 /*
- * $Id: synclinkmp.c,v 4.29 2004/08/27 20:06:41 paulkf Exp $
+ * $Id: synclinkmp.c,v 4.34 2005/03/04 15:07:10 paulkf Exp $
  *
  * Device driver for Microgate SyncLink Multiport
  * high speed multiprotocol serial adapter.
@@ -487,7 +487,7 @@
 module_param_array(dosyncppp, int, NULL, 0);
 
 static char *driver_name = "SyncLink MultiPort driver";
-static char *driver_version = "$Revision: 4.29 $";
+static char *driver_version = "$Revision: 4.34 $";
 
 static int synclinkmp_init_one(struct pci_dev *dev,const struct pci_device_id *ent);
 static void synclinkmp_remove_one(struct pci_dev *dev);
@@ -4528,7 +4528,7 @@
 	 * 07..05  Reserved, must be 0
 	 * 04..00  RRC<4..0> Rx FIFO trigger active 0x00 = 1 byte
 	 */
-	write_reg(info, TRC0, 0x00);
+	write_reg(info, RRC, 0x00);
 
 	/* TRC0 Transmit Ready Control 0
 	 *
diff -Nru a/drivers/char/sysrq.c b/drivers/char/sysrq.c
--- a/drivers/char/sysrq.c	2005-01-07 21:44:12 -08:00
+++ b/drivers/char/sysrq.c	2005-03-07 20:41:34 -08:00
@@ -33,11 +33,10 @@
 #include <linux/buffer_head.h>		/* for fsync_bdev() */
 
 #include <linux/spinlock.h>
+#include <linux/vt_kern.h>
 
 #include <asm/ptrace.h>
 
-extern void reset_vc(unsigned int);
-
 /* Whether we react on sysrq keys or just ignore them */
 int sysrq_enabled = 1;
 
@@ -68,7 +67,7 @@
 {
 	if (tty)
 		do_SAK(tty);
-	reset_vc(fg_console);
+	reset_vc(vc_cons[fg_console].d);
 }
 static struct sysrq_key_op sysrq_SAK_op = {
 	.handler	= sysrq_handle_SAK,
diff -Nru a/drivers/char/tb0219.c b/drivers/char/tb0219.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/char/tb0219.c	2005-03-05 09:36:24 -08:00
@@ -0,0 +1,347 @@
+/*
+ *  Driver for TANBAC TB0219 base board.
+ *
+ *  Copyright (C) 2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include <linux/device.h>
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/module.h>
+
+#include <asm/io.h>
+#include <asm/reboot.h>
+
+MODULE_AUTHOR("Yoichi Yuasa <yuasa@hh.iij4u.or.jp>");
+MODULE_DESCRIPTION("TANBAC TB0219 base board driver");
+MODULE_LICENSE("GPL");
+
+static int major;	/* default is dynamic major device number */
+module_param(major, int, 0);
+MODULE_PARM_DESC(major, "Major device number");
+
+static void (*old_machine_restart)(char *command);
+static void __iomem *tb0219_base;
+static spinlock_t tb0219_lock;
+
+#define tb0219_read(offset)		readw(tb0219_base + (offset))
+#define tb0219_write(offset, value)	writew((value), tb0219_base + (offset))
+
+#define TB0219_START	0x0a000000UL
+#define TB0219_SIZE	0x20UL
+
+#define TB0219_LED			0x00
+#define TB0219_GPIO_INPUT		0x02
+#define TB0219_GPIO_OUTPUT		0x04
+#define TB0219_DIP_SWITCH		0x06
+#define TB0219_MISC			0x08
+#define TB0219_RESET			0x0e
+#define TB0219_PCI_SLOT1_IRQ_STATUS	0x10
+#define TB0219_PCI_SLOT2_IRQ_STATUS	0x12
+#define TB0219_PCI_SLOT3_IRQ_STATUS	0x14
+
+typedef enum {
+	TYPE_LED,
+	TYPE_GPIO_OUTPUT,
+} tb0219_type_t;
+
+/*
+ * Minor device number
+ *	 0 = 7 segment LED
+ *
+ *	16 = GPIO IN 0
+ *	17 = GPIO IN 1
+ *	18 = GPIO IN 2
+ *	19 = GPIO IN 3
+ *	20 = GPIO IN 4
+ *	21 = GPIO IN 5
+ *	22 = GPIO IN 6
+ *	23 = GPIO IN 7
+ *
+ *	32 = GPIO OUT 0
+ *	33 = GPIO OUT 1
+ *	34 = GPIO OUT 2
+ *	35 = GPIO OUT 3
+ *	36 = GPIO OUT 4
+ *	37 = GPIO OUT 5
+ *	38 = GPIO OUT 6
+ *	39 = GPIO OUT 7
+ *
+ *	48 = DIP switch 1
+ *	49 = DIP switch 2
+ *	50 = DIP switch 3
+ *	51 = DIP switch 4
+ *	52 = DIP switch 5
+ *	53 = DIP switch 6
+ *	54 = DIP switch 7
+ *	55 = DIP switch 8
+ */
+
+static inline char get_led(void)
+{
+	return (char)tb0219_read(TB0219_LED);
+}
+
+static inline char get_gpio_input_pin(unsigned int pin)
+{
+	uint16_t values;
+
+	values = tb0219_read(TB0219_GPIO_INPUT);
+	if (values & (1 << pin))
+		return '1';
+
+	return '0';
+}
+
+static inline char get_gpio_output_pin(unsigned int pin)
+{
+	uint16_t values;
+
+	values = tb0219_read(TB0219_GPIO_OUTPUT);
+	if (values & (1 << pin))
+		return '1';
+
+	return '0';
+}
+
+static inline char get_dip_switch(unsigned int pin)
+{
+	uint16_t values;
+
+	values = tb0219_read(TB0219_DIP_SWITCH);
+	if (values & (1 << pin))
+		return '1';
+
+	return '0';
+}
+
+static inline int set_led(char command)
+{
+	tb0219_write(TB0219_LED, command);
+
+	return 0;
+}
+
+static inline int set_gpio_output_pin(unsigned int pin, char command)
+{
+	unsigned long flags;
+	uint16_t value;
+
+	if (command != '0' && command != '1')
+		return -EINVAL;
+
+	spin_lock_irqsave(&tb0219_lock, flags);
+	value = tb0219_read(TB0219_GPIO_OUTPUT);
+	if (command == '0')
+		value &= ~(1 << pin);
+	else
+		value |= 1 << pin;
+	tb0219_write(TB0219_GPIO_OUTPUT, value);
+	spin_unlock_irqrestore(&tb0219_lock, flags);
+
+	return 0;
+
+}
+
+static ssize_t tanbac_tb0219_read(struct file *file, char __user *buf, size_t len,
+                                  loff_t *ppos)
+{
+	unsigned int minor;
+	char value;
+
+	minor = iminor(file->f_dentry->d_inode);
+	switch (minor) {
+	case 0:
+		value = get_led();
+		break;
+	case 16 ... 23:
+		value = get_gpio_input_pin(minor - 16);
+		break;
+	case 32 ... 39:
+		value = get_gpio_output_pin(minor - 32);
+		break;
+	case 48 ... 55:
+		value = get_dip_switch(minor - 48);
+		break;
+	default:
+		return -EBADF;
+	}
+
+	if (len <= 0)
+		return -EFAULT;
+
+	if (put_user(value, buf))
+		return -EFAULT;
+
+	return 1;
+}
+
+static ssize_t tanbac_tb0219_write(struct file *file, const char __user *data,
+                                   size_t len, loff_t *ppos)
+{
+	unsigned int minor;
+	tb0219_type_t type;
+	size_t i;
+	int retval = 0;
+	char c;
+
+	minor = iminor(file->f_dentry->d_inode);
+	switch (minor) {
+	case 0:
+		type = TYPE_LED;
+		break;
+	case 32 ... 39:
+		type = TYPE_GPIO_OUTPUT;
+		break;
+	default:
+		return -EBADF;
+	}
+
+	for (i = 0; i < len; i++) {
+		if (get_user(c, data + i))
+			return -EFAULT;
+
+		switch (type) {
+		case TYPE_LED:
+			retval = set_led(c);
+			break;
+		case TYPE_GPIO_OUTPUT:
+			retval = set_gpio_output_pin(minor - 32, c);
+			break;
+		}
+
+		if (retval < 0)
+			break;
+	}
+
+	return i;
+}
+
+static int tanbac_tb0219_open(struct inode *inode, struct file *file)
+{
+	unsigned int minor;
+
+	minor = iminor(inode);
+	switch (minor) {
+	case 0:
+	case 16 ... 23:
+	case 32 ... 39:
+	case 48 ... 55:
+		return nonseekable_open(inode, file);
+	default:
+		break;
+	}
+
+	return -EBADF;
+}
+
+static int tanbac_tb0219_release(struct inode *inode, struct file *file)
+{
+	return 0;
+}
+
+static struct file_operations tb0219_fops = {
+	.owner		= THIS_MODULE,
+	.read		= tanbac_tb0219_read,
+	.write		= tanbac_tb0219_write,
+	.open		= tanbac_tb0219_open,
+	.release	= tanbac_tb0219_release,
+};
+
+static void tb0219_restart(char *command)
+{
+	tb0219_write(TB0219_RESET, 0);
+}
+
+static int tb0219_probe(struct device *dev)
+{
+	int retval;
+
+	if (request_mem_region(TB0219_START, TB0219_SIZE, "TB0219") == NULL)
+		return -EBUSY;
+
+	tb0219_base = ioremap(TB0219_START, TB0219_SIZE);
+	if (tb0219_base == NULL) {
+		release_mem_region(TB0219_START, TB0219_SIZE);
+		return -ENOMEM;
+	}
+
+	retval = register_chrdev(major, "TB0219", &tb0219_fops);
+	if (retval < 0) {
+		iounmap(tb0219_base);
+		tb0219_base = NULL;
+		release_mem_region(TB0219_START, TB0219_SIZE);
+		return retval;
+	}
+
+	spin_lock_init(&tb0219_lock);
+
+	old_machine_restart = _machine_restart;
+	_machine_restart = tb0219_restart;
+
+	if (major == 0) {
+		major = retval;
+		printk(KERN_INFO "TB0219: major number %d\n", major);
+	}
+
+	return 0;
+}
+
+static int tb0219_remove(struct device *dev)
+{
+	_machine_restart = old_machine_restart;
+
+	iounmap(tb0219_base);
+	tb0219_base = NULL;
+
+	release_mem_region(TB0219_START, TB0219_SIZE);
+
+	return 0;
+}
+
+static struct platform_device *tb0219_platform_device;
+
+static struct device_driver tb0219_device_driver = {
+	.name		= "TB0219",
+	.bus		= &platform_bus_type,
+	.probe		= tb0219_probe,
+	.remove		= tb0219_remove,
+};
+
+static int __devinit tanbac_tb0219_init(void)
+{
+	int retval;
+
+	tb0219_platform_device = platform_device_register_simple("TB0219", -1, NULL, 0);
+	if (IS_ERR(tb0219_platform_device))
+		return PTR_ERR(tb0219_platform_device);
+
+	retval = driver_register(&tb0219_device_driver);
+	if (retval < 0)
+		platform_device_unregister(tb0219_platform_device);
+
+	return retval;
+}
+
+static void __devexit tanbac_tb0219_exit(void)
+{
+	driver_unregister(&tb0219_device_driver);
+
+	platform_device_unregister(tb0219_platform_device);
+}
+
+module_init(tanbac_tb0219_init);
+module_exit(tanbac_tb0219_exit);
diff -Nru a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/char/tpm/Kconfig	2005-03-09 09:05:40 -08:00
@@ -0,0 +1,39 @@
+#
+# TPM device configuration
+#
+
+menu "TPM devices"
+
+config TCG_TPM
+	tristate "TPM Hardware Support"
+	depends on EXPERIMENTAL
+	---help---
+	  If you have a TPM security chip in your system, which
+	  implements the Trusted Computing Group's specification,
+	  say Yes and it will be accessible from within Linux.  For
+	  more information see <http://www.trustedcomputinggroup.org>. 
+	  An implementation of the Trusted Software Stack (TSS), the 
+	  userspace enablement piece of the specification, can be 
+	  obtained at: <http://sourceforge.net/projects/trousers>.  To 
+	  compile this driver as a module, choose M here; the module 
+	  will be called tpm. If unsure, say N.
+
+config TCG_NSC
+	tristate "National Semiconductor TPM Interface"
+	depends on TCG_TPM
+	---help---
+	  If you have a TPM security chip from National Semicondutor 
+	  say Yes and it will be accessible from within Linux.  To 
+	  compile this driver as a module, choose M here; the module 
+	  will be called tpm_nsc.
+
+config TCG_ATMEL
+	tristate "Atmel TPM Interface"
+	depends on TCG_TPM
+	---help---
+	  If you have a TPM security chip from Atmel say Yes and it 
+	  will be accessible from within Linux.  To compile this driver 
+	  as a module, choose M here; the module will be called tpm_atmel.
+
+endmenu
+
diff -Nru a/drivers/char/tpm/Makefile b/drivers/char/tpm/Makefile
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/char/tpm/Makefile	2005-03-09 09:05:40 -08:00
@@ -0,0 +1,7 @@
+#
+# Makefile for the kernel tpm device drivers.
+#
+obj-$(CONFIG_TCG_TPM) += tpm.o
+obj-$(CONFIG_TCG_NSC) += tpm_nsc.o
+obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o
+
diff -Nru a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/char/tpm/tpm.c	2005-03-09 09:03:12 -08:00
@@ -0,0 +1,697 @@
+/*
+ * Copyright (C) 2004 IBM Corporation
+ *
+ * Authors:
+ * Leendert van Doorn <leendert@watson.ibm.com>
+ * Dave Safford <safford@watson.ibm.com>
+ * Reiner Sailer <sailer@watson.ibm.com>
+ * Kylene Hall <kjhall@us.ibm.com>
+ *
+ * Maintained by: <tpmdd_devel@lists.sourceforge.net>
+ *
+ * Device driver for TCG/TCPA TPM (trusted platform module).
+ * Specifications at www.trustedcomputinggroup.org	 
+ *
+ * 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, version 2 of the
+ * License.
+ * 
+ * Note, the TPM chip is not interrupt driven (only polling)
+ * and can have very long timeouts (minutes!). Hence the unusual
+ * calls to schedule_timeout.
+ *
+ */
+
+#include <linux/sched.h>
+#include <linux/poll.h>
+#include <linux/spinlock.h>
+#include "tpm.h"
+
+#define	TPM_MINOR			224	/* officially assigned */
+
+#define	TPM_BUFSIZE			2048
+
+/* PCI configuration addresses */
+#define	PCI_GEN_PMCON_1			0xA0
+#define	PCI_GEN1_DEC			0xE4
+#define	PCI_LPC_EN			0xE6
+#define	PCI_GEN2_DEC			0xEC
+
+static LIST_HEAD(tpm_chip_list);
+static spinlock_t driver_lock = SPIN_LOCK_UNLOCKED;
+static int dev_mask[32];
+
+static void user_reader_timeout(unsigned long ptr)
+{
+	struct tpm_chip *chip = (struct tpm_chip *) ptr;
+
+	down(&chip->buffer_mutex);
+	atomic_set(&chip->data_pending, 0);
+	memset(chip->data_buffer, 0, TPM_BUFSIZE);
+	up(&chip->buffer_mutex);
+}
+
+void tpm_time_expired(unsigned long ptr)
+{
+	int *exp = (int *) ptr;
+	*exp = 1;
+}
+
+EXPORT_SYMBOL_GPL(tpm_time_expired);
+
+/*
+ * Initialize the LPC bus and enable the TPM ports
+ */
+int tpm_lpc_bus_init(struct pci_dev *pci_dev, u16 base)
+{
+	u32 lpcenable, tmp;
+	int is_lpcm = 0;
+
+	switch (pci_dev->vendor) {
+	case PCI_VENDOR_ID_INTEL:
+		switch (pci_dev->device) {
+		case PCI_DEVICE_ID_INTEL_82801CA_12:
+		case PCI_DEVICE_ID_INTEL_82801DB_12:
+			is_lpcm = 1;
+			break;
+		}
+		/* init ICH (enable LPC) */
+		pci_read_config_dword(pci_dev, PCI_GEN1_DEC, &lpcenable);
+		lpcenable |= 0x20000000;
+		pci_write_config_dword(pci_dev, PCI_GEN1_DEC, lpcenable);
+
+		if (is_lpcm) {
+			pci_read_config_dword(pci_dev, PCI_GEN1_DEC,
+					      &lpcenable);
+			if ((lpcenable & 0x20000000) == 0) {
+				dev_err(&pci_dev->dev,
+					"cannot enable LPC\n");
+				return -ENODEV;
+			}
+		}
+
+		/* initialize TPM registers */
+		pci_read_config_dword(pci_dev, PCI_GEN2_DEC, &tmp);
+
+		if (!is_lpcm)
+			tmp = (tmp & 0xFFFF0000) | (base & 0xFFF0);
+		else
+			tmp =
+			    (tmp & 0xFFFF0000) | (base & 0xFFF0) |
+			    0x00000001;
+
+		pci_write_config_dword(pci_dev, PCI_GEN2_DEC, tmp);
+
+		if (is_lpcm) {
+			pci_read_config_dword(pci_dev, PCI_GEN_PMCON_1,
+					      &tmp);
+			tmp |= 0x00000004;	/* enable CLKRUN */
+			pci_write_config_dword(pci_dev, PCI_GEN_PMCON_1,
+					       tmp);
+		}
+		tpm_write_index(0x0D, 0x55);	/* unlock 4F */
+		tpm_write_index(0x0A, 0x00);	/* int disable */
+		tpm_write_index(0x08, base);	/* base addr lo */
+		tpm_write_index(0x09, (base & 0xFF00) >> 8);	/* base addr hi */
+		tpm_write_index(0x0D, 0xAA);	/* lock 4F */
+		break;
+	case PCI_VENDOR_ID_AMD:
+		/* nothing yet */
+		break;
+	}
+
+	return 0;
+}
+
+EXPORT_SYMBOL_GPL(tpm_lpc_bus_init);
+
+/*
+ * Internal kernel interface to transmit TPM commands
+ */
+static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
+			    size_t bufsiz)
+{
+	ssize_t len;
+	u32 count;
+	__be32 *native_size;
+
+	native_size = (__force __be32 *) (buf + 2);
+	count = be32_to_cpu(*native_size);
+
+	if (count == 0)
+		return -ENODATA;
+	if (count > bufsiz) {
+		dev_err(&chip->pci_dev->dev,
+			"invalid count value %x %x \n", count, bufsiz);
+		return -E2BIG;
+	}
+
+	down(&chip->tpm_mutex);
+
+	if ((len = chip->vendor->send(chip, (u8 *) buf, count)) < 0) {
+		dev_err(&chip->pci_dev->dev,
+			"tpm_transmit: tpm_send: error %d\n", len);
+		return len;
+	}
+
+	down(&chip->timer_manipulation_mutex);
+	chip->time_expired = 0;
+	init_timer(&chip->device_timer);
+	chip->device_timer.function = tpm_time_expired;
+	chip->device_timer.expires = jiffies + 2 * 60 * HZ;
+	chip->device_timer.data = (unsigned long) &chip->time_expired;
+	add_timer(&chip->device_timer);
+	up(&chip->timer_manipulation_mutex);
+
+	do {
+		u8 status = inb(chip->vendor->base + 1);
+		if ((status & chip->vendor->req_complete_mask) ==
+		    chip->vendor->req_complete_val) {
+			down(&chip->timer_manipulation_mutex);
+			del_singleshot_timer_sync(&chip->device_timer);
+			up(&chip->timer_manipulation_mutex);
+			goto out_recv;
+		}
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(TPM_TIMEOUT);
+		rmb();
+	} while (!chip->time_expired);
+
+
+	chip->vendor->cancel(chip);
+	dev_err(&chip->pci_dev->dev, "Time expired\n");
+	up(&chip->tpm_mutex);
+	return -EIO;
+
+out_recv:
+	len = chip->vendor->recv(chip, (u8 *) buf, bufsiz);
+	if (len < 0)
+		dev_err(&chip->pci_dev->dev,
+			"tpm_transmit: tpm_recv: error %d\n", len);
+	up(&chip->tpm_mutex);
+	return len;
+}
+
+#define TPM_DIGEST_SIZE 20
+#define CAP_PCR_RESULT_SIZE 18
+static u8 cap_pcr[] = {
+	0, 193,			/* TPM_TAG_RQU_COMMAND */
+	0, 0, 0, 22,		/* length */
+	0, 0, 0, 101,		/* TPM_ORD_GetCapability */
+	0, 0, 0, 5,
+	0, 0, 0, 4,
+	0, 0, 1, 1
+};
+
+#define READ_PCR_RESULT_SIZE 30
+static u8 pcrread[] = {
+	0, 193,			/* TPM_TAG_RQU_COMMAND */
+	0, 0, 0, 14,		/* length */
+	0, 0, 0, 21,		/* TPM_ORD_PcrRead */
+	0, 0, 0, 0		/* PCR index */
+};
+
+static ssize_t show_pcrs(struct device *dev, char *buf)
+{
+	u8 data[READ_PCR_RESULT_SIZE];
+	ssize_t len;
+	int i, j, index, num_pcrs;
+	char *str = buf;
+
+	struct tpm_chip *chip =
+	    pci_get_drvdata(container_of(dev, struct pci_dev, dev));
+	if (chip == NULL)
+		return -ENODEV;
+
+	memcpy(data, cap_pcr, sizeof(cap_pcr));
+	if ((len = tpm_transmit(chip, data, sizeof(data)))
+	    < CAP_PCR_RESULT_SIZE)
+		return len;
+
+	num_pcrs = be32_to_cpu(*((__force __be32 *) (data + 14)));
+
+	for (i = 0; i < num_pcrs; i++) {
+		memcpy(data, pcrread, sizeof(pcrread));
+		index = cpu_to_be32(i);
+		memcpy(data + 10, &index, 4);
+		if ((len = tpm_transmit(chip, data, sizeof(data)))
+		    < READ_PCR_RESULT_SIZE)
+			return len;
+		str += sprintf(str, "PCR-%02d: ", i);
+		for (j = 0; j < TPM_DIGEST_SIZE; j++)
+			str += sprintf(str, "%02X ", *(data + 10 + j));
+		str += sprintf(str, "\n");
+	}
+	return str - buf;
+}
+
+static DEVICE_ATTR(pcrs, S_IRUGO, show_pcrs, NULL);
+
+#define  READ_PUBEK_RESULT_SIZE 314
+static u8 readpubek[] = {
+	0, 193,			/* TPM_TAG_RQU_COMMAND */
+	0, 0, 0, 30,		/* length */
+	0, 0, 0, 124,		/* TPM_ORD_ReadPubek */
+};
+
+static ssize_t show_pubek(struct device *dev, char *buf)
+{
+	u8 data[READ_PUBEK_RESULT_SIZE];
+	ssize_t len;
+	__be32 *native_val;
+	int i;
+	char *str = buf;
+
+	struct tpm_chip *chip =
+	    pci_get_drvdata(container_of(dev, struct pci_dev, dev));
+	if (chip == NULL)
+		return -ENODEV;
+
+	memcpy(data, readpubek, sizeof(readpubek));
+	memset(data + sizeof(readpubek), 0, 20);	/* zero nonce */
+
+	if ((len = tpm_transmit(chip, data, sizeof(data))) <
+	    READ_PUBEK_RESULT_SIZE)
+		return len;
+
+	/* 
+	   ignore header 10 bytes
+	   algorithm 32 bits (1 == RSA )
+	   encscheme 16 bits
+	   sigscheme 16 bits
+	   parameters (RSA 12->bytes: keybit, #primes, expbit)  
+	   keylenbytes 32 bits
+	   256 byte modulus
+	   ignore checksum 20 bytes
+	 */
+
+	native_val = (__force __be32 *) (data + 34);
+
+	str +=
+	    sprintf(str,
+		    "Algorithm: %02X %02X %02X %02X\nEncscheme: %02X %02X\n"
+		    "Sigscheme: %02X %02X\nParameters: %02X %02X %02X %02X"
+		    " %02X %02X %02X %02X %02X %02X %02X %02X\n"
+		    "Modulus length: %d\nModulus: \n",
+		    data[10], data[11], data[12], data[13], data[14],
+		    data[15], data[16], data[17], data[22], data[23],
+		    data[24], data[25], data[26], data[27], data[28],
+		    data[29], data[30], data[31], data[32], data[33],
+		    be32_to_cpu(*native_val)
+	    );
+
+	for (i = 0; i < 256; i++) {
+		str += sprintf(str, "%02X ", data[i + 39]);
+		if ((i + 1) % 16 == 0)
+			str += sprintf(str, "\n");
+	}
+	return str - buf;
+}
+
+static DEVICE_ATTR(pubek, S_IRUGO, show_pubek, NULL);
+
+#define CAP_VER_RESULT_SIZE 18
+static u8 cap_version[] = {
+	0, 193,			/* TPM_TAG_RQU_COMMAND */
+	0, 0, 0, 18,		/* length */
+	0, 0, 0, 101,		/* TPM_ORD_GetCapability */
+	0, 0, 0, 6,
+	0, 0, 0, 0
+};
+
+#define CAP_MANUFACTURER_RESULT_SIZE 18
+static u8 cap_manufacturer[] = {
+	0, 193,			/* TPM_TAG_RQU_COMMAND */
+	0, 0, 0, 22,		/* length */
+	0, 0, 0, 101,		/* TPM_ORD_GetCapability */
+	0, 0, 0, 5,
+	0, 0, 0, 4,
+	0, 0, 1, 3
+};
+
+static ssize_t show_caps(struct device *dev, char *buf)
+{
+	u8 data[READ_PUBEK_RESULT_SIZE];
+	ssize_t len;
+	char *str = buf;
+
+	struct tpm_chip *chip =
+	    pci_get_drvdata(container_of(dev, struct pci_dev, dev));
+	if (chip == NULL)
+		return -ENODEV;
+
+	memcpy(data, cap_manufacturer, sizeof(cap_manufacturer));
+
+	if ((len = tpm_transmit(chip, data, sizeof(data))) <
+	    CAP_MANUFACTURER_RESULT_SIZE)
+		return len;
+
+	str += sprintf(str, "Manufacturer: 0x%x\n",
+		       be32_to_cpu(*(data + 14)));
+
+	memcpy(data, cap_version, sizeof(cap_version));
+
+	if ((len = tpm_transmit(chip, data, sizeof(data))) <
+	    CAP_VER_RESULT_SIZE)
+		return len;
+
+	str +=
+	    sprintf(str, "TCG version: %d.%d\nFirmware version: %d.%d\n",
+		    (int) data[14], (int) data[15], (int) data[16],
+		    (int) data[17]);
+
+	return str - buf;
+}
+
+static DEVICE_ATTR(caps, S_IRUGO, show_caps, NULL);
+
+/*
+ * Device file system interface to the TPM
+ */
+int tpm_open(struct inode *inode, struct file *file)
+{
+	int rc = 0, minor = iminor(inode);
+	struct tpm_chip *chip = NULL, *pos;
+
+	spin_lock(&driver_lock);
+
+	list_for_each_entry(pos, &tpm_chip_list, list) {
+		if (pos->vendor->miscdev.minor == minor) {
+			chip = pos;
+			break;
+		}
+	}
+
+	if (chip == NULL) {
+		rc = -ENODEV;
+		goto err_out;
+	}
+
+	if (chip->num_opens) {
+		dev_dbg(&chip->pci_dev->dev,
+			"Another process owns this TPM\n");
+		rc = -EBUSY;
+		goto err_out;
+	}
+
+	chip->num_opens++;
+	pci_dev_get(chip->pci_dev);
+
+	spin_unlock(&driver_lock);
+
+	chip->data_buffer = kmalloc(TPM_BUFSIZE * sizeof(u8), GFP_KERNEL);
+	if (chip->data_buffer == NULL) {
+		chip->num_opens--;
+		pci_dev_put(chip->pci_dev);
+		return -ENOMEM;
+	}
+
+	atomic_set(&chip->data_pending, 0);
+
+	file->private_data = chip;
+	return 0;
+
+err_out:
+	spin_unlock(&driver_lock);
+	return rc;
+}
+
+EXPORT_SYMBOL_GPL(tpm_open);
+
+int tpm_release(struct inode *inode, struct file *file)
+{
+	struct tpm_chip *chip = file->private_data;
+	
+	file->private_data = NULL;
+
+	spin_lock(&driver_lock);
+	chip->num_opens--;
+	spin_unlock(&driver_lock);
+
+	down(&chip->timer_manipulation_mutex);
+	if (timer_pending(&chip->user_read_timer))
+		del_singleshot_timer_sync(&chip->user_read_timer);
+	else if (timer_pending(&chip->device_timer))
+		del_singleshot_timer_sync(&chip->device_timer);
+	up(&chip->timer_manipulation_mutex);
+
+	kfree(chip->data_buffer);
+	atomic_set(&chip->data_pending, 0);
+
+	pci_dev_put(chip->pci_dev);
+	return 0;
+}
+
+EXPORT_SYMBOL_GPL(tpm_release);
+
+ssize_t tpm_write(struct file * file, const char __user * buf,
+		  size_t size, loff_t * off)
+{
+	struct tpm_chip *chip = file->private_data;
+	int in_size = size, out_size;
+
+	/* cannot perform a write until the read has cleared
+	   either via tpm_read or a user_read_timer timeout */
+	while (atomic_read(&chip->data_pending) != 0) {
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(TPM_TIMEOUT);
+	}
+
+	down(&chip->buffer_mutex);
+
+	if (in_size > TPM_BUFSIZE)
+		in_size = TPM_BUFSIZE;
+
+	if (copy_from_user
+	    (chip->data_buffer, (void __user *) buf, in_size)) {
+		up(&chip->buffer_mutex);
+		return -EFAULT;
+	}
+
+	/* atomic tpm command send and result receive */
+	out_size = tpm_transmit(chip, chip->data_buffer, TPM_BUFSIZE);
+
+	atomic_set(&chip->data_pending, out_size);
+	up(&chip->buffer_mutex);
+
+	/* Set a timeout by which the reader must come claim the result */
+	down(&chip->timer_manipulation_mutex);
+	init_timer(&chip->user_read_timer);
+	chip->user_read_timer.function = user_reader_timeout;
+	chip->user_read_timer.data = (unsigned long) chip;
+	chip->user_read_timer.expires = jiffies + (60 * HZ);
+	add_timer(&chip->user_read_timer);
+	up(&chip->timer_manipulation_mutex);
+
+	return in_size;
+}
+
+EXPORT_SYMBOL_GPL(tpm_write);
+
+ssize_t tpm_read(struct file * file, char __user * buf,
+		 size_t size, loff_t * off)
+{
+	struct tpm_chip *chip = file->private_data;
+	int ret_size = -ENODATA;
+
+	if (atomic_read(&chip->data_pending) != 0) {	/* Result available */
+		down(&chip->timer_manipulation_mutex);
+		del_singleshot_timer_sync(&chip->user_read_timer);
+		up(&chip->timer_manipulation_mutex);
+
+		down(&chip->buffer_mutex);
+
+		ret_size = atomic_read(&chip->data_pending);
+		atomic_set(&chip->data_pending, 0);
+
+		if (ret_size == 0)	/* timeout just occurred */
+			ret_size = -ETIME;
+		else if (ret_size > 0) {	/* relay data */
+			if (size < ret_size)
+				ret_size = size;
+
+			if (copy_to_user((void __user *) buf,
+					 chip->data_buffer, ret_size)) {
+				ret_size = -EFAULT;
+			}
+		}
+		up(&chip->buffer_mutex);
+	}
+
+	return ret_size;
+}
+
+EXPORT_SYMBOL_GPL(tpm_read);
+
+void __devexit tpm_remove(struct pci_dev *pci_dev)
+{
+	struct tpm_chip *chip = pci_get_drvdata(pci_dev);
+
+	if (chip == NULL) {
+		dev_err(&pci_dev->dev, "No device data found\n");
+		return;
+	}
+
+	spin_lock(&driver_lock);
+
+	list_del(&chip->list);
+
+	spin_unlock(&driver_lock);
+
+	pci_set_drvdata(pci_dev, NULL);
+	misc_deregister(&chip->vendor->miscdev);
+
+	device_remove_file(&pci_dev->dev, &dev_attr_pubek);
+	device_remove_file(&pci_dev->dev, &dev_attr_pcrs);
+	device_remove_file(&pci_dev->dev, &dev_attr_caps);
+
+	pci_disable_device(pci_dev);
+
+	dev_mask[chip->dev_num / 32] &= !(1 << (chip->dev_num % 32));
+
+	kfree(chip);
+
+	pci_dev_put(pci_dev);
+}
+
+EXPORT_SYMBOL_GPL(tpm_remove);
+
+static u8 savestate[] = {
+	0, 193,			/* TPM_TAG_RQU_COMMAND */
+	0, 0, 0, 10,		/* blob length (in bytes) */
+	0, 0, 0, 152		/* TPM_ORD_SaveState */
+};
+
+/*
+ * We are about to suspend. Save the TPM state
+ * so that it can be restored.
+ */
+int tpm_pm_suspend(struct pci_dev *pci_dev, u32 pm_state)
+{
+	struct tpm_chip *chip = pci_get_drvdata(pci_dev);
+	if (chip == NULL)
+		return -ENODEV;
+
+	tpm_transmit(chip, savestate, sizeof(savestate));
+	return 0;
+}
+
+EXPORT_SYMBOL_GPL(tpm_pm_suspend);
+
+/*
+ * Resume from a power safe. The BIOS already restored
+ * the TPM state.
+ */
+int tpm_pm_resume(struct pci_dev *pci_dev)
+{
+	struct tpm_chip *chip = pci_get_drvdata(pci_dev);
+
+	if (chip == NULL)
+		return -ENODEV;
+
+	spin_lock(&driver_lock);
+	tpm_lpc_bus_init(pci_dev, chip->vendor->base);
+	spin_unlock(&driver_lock);
+
+	return 0;
+}
+
+EXPORT_SYMBOL_GPL(tpm_pm_resume);
+
+/*
+ * Called from tpm_<specific>.c probe function only for devices 
+ * the driver has determined it should claim.  Prior to calling
+ * this function the specific probe function has called pci_enable_device
+ * upon errant exit from this function specific probe function should call
+ * pci_disable_device
+ */
+int tpm_register_hardware(struct pci_dev *pci_dev,
+			  struct tpm_vendor_specific *entry)
+{
+	char devname[7];
+	struct tpm_chip *chip;
+	int i, j;
+
+	/* Driver specific per-device data */
+	chip = kmalloc(sizeof(*chip), GFP_KERNEL);
+	if (chip == NULL)
+		return -ENOMEM;
+
+	memset(chip, 0, sizeof(struct tpm_chip));
+
+	init_MUTEX(&chip->buffer_mutex);
+	init_MUTEX(&chip->tpm_mutex);
+	init_MUTEX(&chip->timer_manipulation_mutex);
+	INIT_LIST_HEAD(&chip->list);
+
+	chip->vendor = entry;
+
+	chip->dev_num = -1;
+
+	for (i = 0; i < 32; i++)
+		for (j = 0; j < 8; j++)
+			if ((dev_mask[i] & (1 << j)) == 0) {
+				chip->dev_num = i * 32 + j;
+				dev_mask[i] |= 1 << j;
+				goto dev_num_search_complete;
+			}
+
+dev_num_search_complete:
+	if (chip->dev_num < 0) {
+		dev_err(&pci_dev->dev,
+			"No available tpm device numbers\n");
+		kfree(chip);
+		return -ENODEV;
+	} else if (chip->dev_num == 0)
+		chip->vendor->miscdev.minor = TPM_MINOR;
+	else
+		chip->vendor->miscdev.minor = MISC_DYNAMIC_MINOR;
+
+	snprintf(devname, sizeof(devname), "%s%d", "tpm", chip->dev_num);
+	chip->vendor->miscdev.name = devname;
+
+	chip->vendor->miscdev.dev = &(pci_dev->dev);
+	chip->pci_dev = pci_dev_get(pci_dev);
+
+	if (misc_register(&chip->vendor->miscdev)) {
+		dev_err(&chip->pci_dev->dev,
+			"unable to misc_register %s, minor %d\n",
+			chip->vendor->miscdev.name,
+			chip->vendor->miscdev.minor);
+		pci_dev_put(pci_dev);
+		kfree(chip);
+		dev_mask[i] &= !(1 << j);
+		return -ENODEV;
+	}
+
+	pci_set_drvdata(pci_dev, chip);
+
+	list_add(&chip->list, &tpm_chip_list);
+
+	device_create_file(&pci_dev->dev, &dev_attr_pubek);
+	device_create_file(&pci_dev->dev, &dev_attr_pcrs);
+	device_create_file(&pci_dev->dev, &dev_attr_caps);
+
+	return 0;
+}
+
+EXPORT_SYMBOL_GPL(tpm_register_hardware);
+
+static int __init init_tpm(void)
+{
+	return 0;
+}
+
+static void __exit cleanup_tpm(void)
+{
+
+}
+
+module_init(init_tpm);
+module_exit(cleanup_tpm);
+
+MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)");
+MODULE_DESCRIPTION("TPM Driver");
+MODULE_VERSION("2.0");
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/char/tpm/tpm.h	2005-03-09 09:05:40 -08:00
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2004 IBM Corporation
+ *
+ * Authors:
+ * Leendert van Doorn <leendert@watson.ibm.com>
+ * Dave Safford <safford@watson.ibm.com>
+ * Reiner Sailer <sailer@watson.ibm.com>
+ * Kylene Hall <kjhall@us.ibm.com>
+ *
+ * Maintained by: <tpmdd_devel@lists.sourceforge.net>
+ *
+ * Device driver for TCG/TCPA TPM (trusted platform module).
+ * Specifications at www.trustedcomputinggroup.org	 
+ *
+ * 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, version 2 of the
+ * License.
+ * 
+ */
+#include <linux/module.h>
+#include <linux/version.h>
+#include <linux/pci.h>
+#include <linux/delay.h>
+#include <linux/miscdevice.h>
+
+#define TPM_TIMEOUT msecs_to_jiffies(5)
+
+/* TPM addresses */
+#define	TPM_ADDR			0x4E
+#define	TPM_DATA			0x4F
+
+struct tpm_chip;
+
+struct tpm_vendor_specific {
+	u8 req_complete_mask;
+	u8 req_complete_val;
+	u16 base;		/* TPM base address */
+
+	int (*recv) (struct tpm_chip *, u8 *, size_t);
+	int (*send) (struct tpm_chip *, u8 *, size_t);
+	void (*cancel) (struct tpm_chip *);
+	struct miscdevice miscdev;
+};
+
+struct tpm_chip {
+	struct pci_dev *pci_dev;	/* PCI device stuff */
+
+	int dev_num;		/* /dev/tpm# */
+	int num_opens;		/* only one allowed */
+	int time_expired;
+
+	/* Data passed to and from the tpm via the read/write calls */
+	u8 *data_buffer;
+	atomic_t data_pending;
+	struct semaphore buffer_mutex;
+
+	struct timer_list user_read_timer;	/* user needs to claim result */
+	struct semaphore tpm_mutex;	/* tpm is processing */
+	struct timer_list device_timer;	/* tpm is processing */
+	struct semaphore timer_manipulation_mutex;
+
+	struct tpm_vendor_specific *vendor;
+
+	struct list_head list;
+};
+
+static inline int tpm_read_index(int index)
+{
+	outb(index, TPM_ADDR);
+	return inb(TPM_DATA) & 0xFF;
+}
+
+static inline void tpm_write_index(int index, int value)
+{
+	outb(index, TPM_ADDR);
+	outb(value & 0xFF, TPM_DATA);
+}
+
+extern void tpm_time_expired(unsigned long);
+extern int tpm_lpc_bus_init(struct pci_dev *, u16);
+
+extern int tpm_register_hardware(struct pci_dev *,
+				 struct tpm_vendor_specific *);
+extern int tpm_open(struct inode *, struct file *);
+extern int tpm_release(struct inode *, struct file *);
+extern ssize_t tpm_write(struct file *, const char __user *, size_t,
+			 loff_t *);
+extern ssize_t tpm_read(struct file *, char __user *, size_t, loff_t *);
+extern void __devexit tpm_remove(struct pci_dev *);
+extern int tpm_pm_suspend(struct pci_dev *, u32);
+extern int tpm_pm_resume(struct pci_dev *);
diff -Nru a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/char/tpm/tpm_atmel.c	2005-03-09 09:04:58 -08:00
@@ -0,0 +1,216 @@
+/*
+ * Copyright (C) 2004 IBM Corporation
+ *
+ * Authors:
+ * Leendert van Doorn <leendert@watson.ibm.com>
+ * Dave Safford <safford@watson.ibm.com>
+ * Reiner Sailer <sailer@watson.ibm.com>
+ * Kylene Hall <kjhall@us.ibm.com>
+ *
+ * Maintained by: <tpmdd_devel@lists.sourceforge.net>
+ *
+ * Device driver for TCG/TCPA TPM (trusted platform module).
+ * Specifications at www.trustedcomputinggroup.org	 
+ *
+ * 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, version 2 of the
+ * License.
+ * 
+ */
+
+#include "tpm.h"
+
+/* Atmel definitions */
+#define	TPM_ATML_BASE			0x400
+
+/* write status bits */
+#define	ATML_STATUS_ABORT		0x01
+#define	ATML_STATUS_LASTBYTE		0x04
+
+/* read status bits */
+#define	ATML_STATUS_BUSY		0x01
+#define	ATML_STATUS_DATA_AVAIL		0x02
+#define	ATML_STATUS_REWRITE		0x04
+
+
+static int tpm_atml_recv(struct tpm_chip *chip, u8 * buf, size_t count)
+{
+	u8 status, *hdr = buf;
+	u32 size;
+	int i;
+	__be32 *native_size;
+
+	/* start reading header */
+	if (count < 6)
+		return -EIO;
+
+	for (i = 0; i < 6; i++) {
+		status = inb(chip->vendor->base + 1);
+		if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
+			dev_err(&chip->pci_dev->dev,
+				"error reading header\n");
+			return -EIO;
+		}
+		*buf++ = inb(chip->vendor->base);
+	}
+
+	/* size of the data received */
+	native_size = (__force __be32 *) (hdr + 2);
+	size = be32_to_cpu(*native_size);
+
+	if (count < size) {
+		dev_err(&chip->pci_dev->dev,
+			"Recv size(%d) less than available space\n", size);
+		for (; i < size; i++) {	/* clear the waiting data anyway */
+			status = inb(chip->vendor->base + 1);
+			if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
+				dev_err(&chip->pci_dev->dev,
+					"error reading data\n");
+				return -EIO;
+			}
+		}
+		return -EIO;
+	}
+
+	/* read all the data available */
+	for (; i < size; i++) {
+		status = inb(chip->vendor->base + 1);
+		if ((status & ATML_STATUS_DATA_AVAIL) == 0) {
+			dev_err(&chip->pci_dev->dev,
+				"error reading data\n");
+			return -EIO;
+		}
+		*buf++ = inb(chip->vendor->base);
+	}
+
+	/* make sure data available is gone */
+	status = inb(chip->vendor->base + 1);
+	if (status & ATML_STATUS_DATA_AVAIL) {
+		dev_err(&chip->pci_dev->dev, "data available is stuck\n");
+		return -EIO;
+	}
+
+	return size;
+}
+
+static int tpm_atml_send(struct tpm_chip *chip, u8 * buf, size_t count)
+{
+	int i;
+
+	dev_dbg(&chip->pci_dev->dev, "tpm_atml_send: ");
+	for (i = 0; i < count; i++) {
+		dev_dbg(&chip->pci_dev->dev, "0x%x(%d) ", buf[i], buf[i]);
+		outb(buf[i], chip->vendor->base);
+	}
+
+	return count;
+}
+
+static void tpm_atml_cancel(struct tpm_chip *chip)
+{
+	outb(ATML_STATUS_ABORT, chip->vendor->base + 1);
+}
+
+static struct file_operations atmel_ops = {
+	.owner = THIS_MODULE,
+	.llseek = no_llseek,
+	.open = tpm_open,
+	.read = tpm_read,
+	.write = tpm_write,
+	.release = tpm_release,
+};
+
+static struct tpm_vendor_specific tpm_atmel = {
+	.recv = tpm_atml_recv,
+	.send = tpm_atml_send,
+	.cancel = tpm_atml_cancel,
+	.req_complete_mask = ATML_STATUS_BUSY | ATML_STATUS_DATA_AVAIL,
+	.req_complete_val = ATML_STATUS_DATA_AVAIL,
+	.base = TPM_ATML_BASE,
+	.miscdev = { .fops = &atmel_ops, },
+};
+
+static int __devinit tpm_atml_init(struct pci_dev *pci_dev,
+				   const struct pci_device_id *pci_id)
+{
+	u8 version[4];
+	int rc = 0;
+
+	if (pci_enable_device(pci_dev))
+		return -EIO;
+
+	if (tpm_lpc_bus_init(pci_dev, TPM_ATML_BASE)) {
+		rc = -ENODEV;
+		goto out_err;
+	}
+
+	/* verify that it is an Atmel part */
+	if (tpm_read_index(4) != 'A' || tpm_read_index(5) != 'T'
+	    || tpm_read_index(6) != 'M' || tpm_read_index(7) != 'L') {
+		rc = -ENODEV;
+		goto out_err;
+	}
+
+	/* query chip for its version number */
+	if ((version[0] = tpm_read_index(0x00)) != 0xFF) {
+		version[1] = tpm_read_index(0x01);
+		version[2] = tpm_read_index(0x02);
+		version[3] = tpm_read_index(0x03);
+	} else {
+		dev_info(&pci_dev->dev, "version query failed\n");
+		rc = -ENODEV;
+		goto out_err;
+	}
+
+	if ((rc = tpm_register_hardware(pci_dev, &tpm_atmel)) < 0)
+		goto out_err;
+
+	dev_info(&pci_dev->dev,
+		 "Atmel TPM version %d.%d.%d.%d\n", version[0], version[1],
+		 version[2], version[3]);
+
+	return 0;
+out_err:
+	pci_disable_device(pci_dev);
+	return rc;
+}
+
+static struct pci_device_id tpm_pci_tbl[] __devinitdata = {
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)},
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)},
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0)},
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12)},
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0)},
+	{PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_LPC)},
+	{0,}
+};
+
+MODULE_DEVICE_TABLE(pci, tpm_pci_tbl);
+
+static struct pci_driver atmel_pci_driver = {
+	.name = "tpm_atmel",
+	.id_table = tpm_pci_tbl,
+	.probe = tpm_atml_init,
+	.remove = __devexit_p(tpm_remove),
+	.suspend = tpm_pm_suspend,
+	.resume = tpm_pm_resume,
+};
+
+static int __init init_atmel(void)
+{
+	return pci_register_driver(&atmel_pci_driver);
+}
+
+static void __exit cleanup_atmel(void)
+{
+	pci_unregister_driver(&atmel_pci_driver);
+}
+
+module_init(init_atmel);
+module_exit(cleanup_atmel);
+
+MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)");
+MODULE_DESCRIPTION("TPM Driver");
+MODULE_VERSION("2.0");
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/char/tpm/tpm_nsc.c	2005-03-09 09:05:02 -08:00
@@ -0,0 +1,373 @@
+/*
+ * Copyright (C) 2004 IBM Corporation
+ *
+ * Authors:
+ * Leendert van Doorn <leendert@watson.ibm.com>
+ * Dave Safford <safford@watson.ibm.com>
+ * Reiner Sailer <sailer@watson.ibm.com>
+ * Kylene Hall <kjhall@us.ibm.com>
+ *
+ * Maintained by: <tpmdd_devel@lists.sourceforge.net>
+ *
+ * Device driver for TCG/TCPA TPM (trusted platform module).
+ * Specifications at www.trustedcomputinggroup.org	 
+ *
+ * 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, version 2 of the
+ * License.
+ * 
+ */
+
+#include "tpm.h"
+
+/* National definitions */
+#define	TPM_NSC_BASE			0x360
+#define	TPM_NSC_IRQ			0x07
+
+#define	NSC_LDN_INDEX			0x07
+#define	NSC_SID_INDEX			0x20
+#define	NSC_LDC_INDEX			0x30
+#define	NSC_DIO_INDEX			0x60
+#define	NSC_CIO_INDEX			0x62
+#define	NSC_IRQ_INDEX			0x70
+#define	NSC_ITS_INDEX			0x71
+
+#define	NSC_STATUS			0x01
+#define	NSC_COMMAND			0x01
+#define	NSC_DATA			0x00
+
+/* status bits */
+#define	NSC_STATUS_OBF			0x01	/* output buffer full */
+#define	NSC_STATUS_IBF			0x02	/* input buffer full */
+#define	NSC_STATUS_F0			0x04	/* F0 */
+#define	NSC_STATUS_A2			0x08	/* A2 */
+#define	NSC_STATUS_RDY			0x10	/* ready to receive command */
+#define	NSC_STATUS_IBR			0x20	/* ready to receive data */
+
+/* command bits */
+#define	NSC_COMMAND_NORMAL		0x01	/* normal mode */
+#define	NSC_COMMAND_EOC			0x03
+#define	NSC_COMMAND_CANCEL		0x22
+
+/*
+ * Wait for a certain status to appear
+ */
+static int wait_for_stat(struct tpm_chip *chip, u8 mask, u8 val, u8 * data)
+{
+	int expired = 0;
+	struct timer_list status_timer =
+	    TIMER_INITIALIZER(tpm_time_expired, jiffies + 10 * HZ,
+			      (unsigned long) &expired);
+
+	/* status immediately available check */
+	*data = inb(chip->vendor->base + NSC_STATUS);
+	if ((*data & mask) == val)
+		return 0;
+
+	/* wait for status */
+	add_timer(&status_timer);
+	do {
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(TPM_TIMEOUT);
+		*data = inb(chip->vendor->base + 1);
+		if ((*data & mask) == val) {
+			del_singleshot_timer_sync(&status_timer);
+			return 0;
+		}
+	}
+	while (!expired);
+
+	return -EBUSY;
+}
+
+static int nsc_wait_for_ready(struct tpm_chip *chip)
+{
+	int status;
+	int expired = 0;
+	struct timer_list status_timer =
+	    TIMER_INITIALIZER(tpm_time_expired, jiffies + 100,
+			      (unsigned long) &expired);
+
+	/* status immediately available check */
+	status = inb(chip->vendor->base + NSC_STATUS);
+	if (status & NSC_STATUS_OBF)
+		status = inb(chip->vendor->base + NSC_DATA);
+	if (status & NSC_STATUS_RDY)
+		return 0;
+
+	/* wait for status */
+	add_timer(&status_timer);
+	do {
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		schedule_timeout(TPM_TIMEOUT);
+		status = inb(chip->vendor->base + NSC_STATUS);
+		if (status & NSC_STATUS_OBF)
+			status = inb(chip->vendor->base + NSC_DATA);
+		if (status & NSC_STATUS_RDY) {
+			del_singleshot_timer_sync(&status_timer);
+			return 0;
+		}
+	}
+	while (!expired);
+
+	dev_info(&chip->pci_dev->dev, "wait for ready failed\n");
+	return -EBUSY;
+}
+
+
+static int tpm_nsc_recv(struct tpm_chip *chip, u8 * buf, size_t count)
+{
+	u8 *buffer = buf;
+	u8 data, *p;
+	u32 size;
+	__be32 *native_size;
+
+	if (count < 6)
+		return -EIO;
+
+	if (wait_for_stat(chip, NSC_STATUS_F0, NSC_STATUS_F0, &data) < 0) {
+		dev_err(&chip->pci_dev->dev, "F0 timeout\n");
+		return -EIO;
+	}
+	if ((data =
+	     inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_NORMAL) {
+		dev_err(&chip->pci_dev->dev, "not in normal mode (0x%x)\n",
+			data);
+		return -EIO;
+	}
+
+	/* read the whole packet */
+	for (p = buffer; p < &buffer[count]; p++) {
+		if (wait_for_stat
+		    (chip, NSC_STATUS_OBF, NSC_STATUS_OBF, &data) < 0) {
+			dev_err(&chip->pci_dev->dev,
+				"OBF timeout (while reading data)\n");
+			return -EIO;
+		}
+		if (data & NSC_STATUS_F0)
+			break;
+		*p = inb(chip->vendor->base + NSC_DATA);
+	}
+
+	if ((data & NSC_STATUS_F0) == 0) {
+		dev_err(&chip->pci_dev->dev, "F0 not set\n");
+		return -EIO;
+	}
+	if ((data = inb(chip->vendor->base + NSC_DATA)) != NSC_COMMAND_EOC) {
+		dev_err(&chip->pci_dev->dev,
+			"expected end of command(0x%x)\n", data);
+		return -EIO;
+	}
+
+	native_size = (__force __be32 *) (buf + 2);
+	size = be32_to_cpu(*native_size);
+
+	if (count < size)
+		return -EIO;
+
+	return size;
+}
+
+static int tpm_nsc_send(struct tpm_chip *chip, u8 * buf, size_t count)
+{
+	u8 data;
+	int i;
+
+	/*
+	 * If we hit the chip with back to back commands it locks up
+	 * and never set IBF. Hitting it with this "hammer" seems to
+	 * fix it. Not sure why this is needed, we followed the flow
+	 * chart in the manual to the letter.
+	 */
+	outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND);
+
+	if (nsc_wait_for_ready(chip) != 0)
+		return -EIO;
+
+	if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
+		dev_err(&chip->pci_dev->dev, "IBF timeout\n");
+		return -EIO;
+	}
+
+	outb(NSC_COMMAND_NORMAL, chip->vendor->base + NSC_COMMAND);
+	if (wait_for_stat(chip, NSC_STATUS_IBR, NSC_STATUS_IBR, &data) < 0) {
+		dev_err(&chip->pci_dev->dev, "IBR timeout\n");
+		return -EIO;
+	}
+
+	for (i = 0; i < count; i++) {
+		if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
+			dev_err(&chip->pci_dev->dev,
+				"IBF timeout (while writing data)\n");
+			return -EIO;
+		}
+		outb(buf[i], chip->vendor->base + NSC_DATA);
+	}
+
+	if (wait_for_stat(chip, NSC_STATUS_IBF, 0, &data) < 0) {
+		dev_err(&chip->pci_dev->dev, "IBF timeout\n");
+		return -EIO;
+	}
+	outb(NSC_COMMAND_EOC, chip->vendor->base + NSC_COMMAND);
+
+	return count;
+}
+
+static void tpm_nsc_cancel(struct tpm_chip *chip)
+{
+	outb(NSC_COMMAND_CANCEL, chip->vendor->base + NSC_COMMAND);
+}
+
+static struct file_operations nsc_ops = {
+	.owner = THIS_MODULE,
+	.llseek = no_llseek,
+	.open = tpm_open,
+	.read = tpm_read,
+	.write = tpm_write,
+	.release = tpm_release,
+};
+
+static struct tpm_vendor_specific tpm_nsc = {
+	.recv = tpm_nsc_recv,
+	.send = tpm_nsc_send,
+	.cancel = tpm_nsc_cancel,
+	.req_complete_mask = NSC_STATUS_OBF,
+	.req_complete_val = NSC_STATUS_OBF,
+	.base = TPM_NSC_BASE,
+	.miscdev = { .fops = &nsc_ops, },
+	
+};
+
+static int __devinit tpm_nsc_init(struct pci_dev *pci_dev,
+				  const struct pci_device_id *pci_id)
+{
+	int rc = 0;
+
+	if (pci_enable_device(pci_dev))
+		return -EIO;
+
+	if (tpm_lpc_bus_init(pci_dev, TPM_NSC_BASE)) {
+		rc = -ENODEV;
+		goto out_err;
+	}
+
+	/* verify that it is a National part (SID) */
+	if (tpm_read_index(NSC_SID_INDEX) != 0xEF) {
+		rc = -ENODEV;
+		goto out_err;
+	}
+
+	dev_dbg(&pci_dev->dev, "NSC TPM detected\n");
+	dev_dbg(&pci_dev->dev,
+		"NSC LDN 0x%x, SID 0x%x, SRID 0x%x\n",
+		tpm_read_index(0x07), tpm_read_index(0x20),
+		tpm_read_index(0x27));
+	dev_dbg(&pci_dev->dev,
+		"NSC SIOCF1 0x%x SIOCF5 0x%x SIOCF6 0x%x SIOCF8 0x%x\n",
+		tpm_read_index(0x21), tpm_read_index(0x25),
+		tpm_read_index(0x26), tpm_read_index(0x28));
+	dev_dbg(&pci_dev->dev, "NSC IO Base0 0x%x\n",
+		(tpm_read_index(0x60) << 8) | tpm_read_index(0x61));
+	dev_dbg(&pci_dev->dev, "NSC IO Base1 0x%x\n",
+		(tpm_read_index(0x62) << 8) | tpm_read_index(0x63));
+	dev_dbg(&pci_dev->dev, "NSC Interrupt number and wakeup 0x%x\n",
+		tpm_read_index(0x70));
+	dev_dbg(&pci_dev->dev, "NSC IRQ type select 0x%x\n",
+		tpm_read_index(0x71));
+	dev_dbg(&pci_dev->dev,
+		"NSC DMA channel select0 0x%x, select1 0x%x\n",
+		tpm_read_index(0x74), tpm_read_index(0x75));
+	dev_dbg(&pci_dev->dev,
+		"NSC Config "
+		"0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
+		tpm_read_index(0xF0), tpm_read_index(0xF1),
+		tpm_read_index(0xF2), tpm_read_index(0xF3),
+		tpm_read_index(0xF4), tpm_read_index(0xF5),
+		tpm_read_index(0xF6), tpm_read_index(0xF7),
+		tpm_read_index(0xF8), tpm_read_index(0xF9));
+
+	dev_info(&pci_dev->dev,
+		 "NSC PC21100 TPM revision %d\n",
+		 tpm_read_index(0x27) & 0x1F);
+
+	if (tpm_read_index(NSC_LDC_INDEX) == 0)
+		dev_info(&pci_dev->dev, ": NSC TPM not active\n");
+
+	/* select PM channel 1 */
+	tpm_write_index(NSC_LDN_INDEX, 0x12);
+	tpm_read_index(NSC_LDN_INDEX);
+
+	/* disable the DPM module */
+	tpm_write_index(NSC_LDC_INDEX, 0);
+	tpm_read_index(NSC_LDC_INDEX);
+
+	/* set the data register base addresses */
+	tpm_write_index(NSC_DIO_INDEX, TPM_NSC_BASE >> 8);
+	tpm_write_index(NSC_DIO_INDEX + 1, TPM_NSC_BASE);
+	tpm_read_index(NSC_DIO_INDEX);
+	tpm_read_index(NSC_DIO_INDEX + 1);
+
+	/* set the command register base addresses */
+	tpm_write_index(NSC_CIO_INDEX, (TPM_NSC_BASE + 1) >> 8);
+	tpm_write_index(NSC_CIO_INDEX + 1, (TPM_NSC_BASE + 1));
+	tpm_read_index(NSC_DIO_INDEX);
+	tpm_read_index(NSC_DIO_INDEX + 1);
+
+	/* set the interrupt number to be used for the host interface */
+	tpm_write_index(NSC_IRQ_INDEX, TPM_NSC_IRQ);
+	tpm_write_index(NSC_ITS_INDEX, 0x00);
+	tpm_read_index(NSC_IRQ_INDEX);
+
+	/* enable the DPM module */
+	tpm_write_index(NSC_LDC_INDEX, 0x01);
+	tpm_read_index(NSC_LDC_INDEX);
+
+	if ((rc = tpm_register_hardware(pci_dev, &tpm_nsc)) < 0)
+		goto out_err;
+
+	return 0;
+
+out_err:
+	pci_disable_device(pci_dev);
+	return rc;
+}
+
+static struct pci_device_id tpm_pci_tbl[] __devinitdata = {
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0)},
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12)},
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0)},
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12)},
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0)},
+	{PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_8111_LPC)},
+	{0,}
+};
+
+MODULE_DEVICE_TABLE(pci, tpm_pci_tbl);
+
+static struct pci_driver nsc_pci_driver = {
+	.name = "tpm_nsc",
+	.id_table = tpm_pci_tbl,
+	.probe = tpm_nsc_init,
+	.remove = __devexit_p(tpm_remove),
+	.suspend = tpm_pm_suspend,
+	.resume = tpm_pm_resume,
+};
+
+static int __init init_nsc(void)
+{
+	return pci_register_driver(&nsc_pci_driver);
+}
+
+static void __exit cleanup_nsc(void)
+{
+	pci_unregister_driver(&nsc_pci_driver);
+}
+
+module_init(init_nsc);
+module_exit(cleanup_nsc);
+
+MODULE_AUTHOR("Leendert van Doorn (leendert@watson.ibm.com)");
+MODULE_DESCRIPTION("TPM Driver");
+MODULE_VERSION("2.0");
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/char/tpqic02.c b/drivers/char/tpqic02.c
--- a/drivers/char/tpqic02.c	2004-10-19 02:40:33 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,2812 +0,0 @@
-/* $Id: tpqic02.c,v 1.10 1997/01/26 07:13:20 davem Exp $
- *
- * Driver for tape drive support for Linux-i386
- *
- * Copyright (c) 1992--1996 by H. H. Bergman. All rights reserved.
- * Current e-mail address: hennus@cybercomm.nl
- *
- * Distribution of this program in executable form is only allowed if
- * all of the corresponding source files are made available through the same
- * medium at no extra cost.
- *
- * I will not accept any responsibility for damage caused directly or
- * indirectly by this program, or code derived from this program.
- *
- * Use this code at your own risk. Don't blame me if it destroys your data!
- * Make sure you have a backup before you try this code.
- *
- * If you make changes to my code and redistribute it in source or binary
- * form you must make it clear to even casual users of your code that you
- * have modified my code, clearly point out what the changes exactly are
- * (preferably in the form of a context diff file), how to undo your changes,
- * where the original can be obtained, and that complaints/requests about the
- * modified code should be directed to you instead of me.
- *
- * This driver was partially inspired by the 'wt' driver in the 386BSD
- * source distribution, which carries the following copyright notice:
- *
- *  Copyright (c) 1991 The Regents of the University of California.
- *  All rights reserved.
- *
- * You are not allowed to change this line nor the text above.
- *
- * 2001/02/26	Minor s/suser/capable/
- *
- * 1996/10/10   Emerald changes
- *
- * 1996/05/21	Misc changes+merges+cleanups + I/O reservations
- *
- * 1996/05/20	Module support patches submitted by Brian McCauley.
- *
- * 1994/05/03	Initial attempt at Mountain support for the Mountain 7150.
- * Based on patches provided by Erik Jacobson. Still incomplete, I suppose.
- *
- * 1994/02/07	Archive changes & some cleanups by Eddy Olk.
- *
- * 1994/01/19	Speed measuring stuff moved from aperf.h to delay.h.
- *		BogoMips (tm) introduced by Linus.
- *
- * 1993/01/25	Kernel udelay. Eof fixups.
- * 
- * 1992/09/19	Some changes based on patches by Eddy Olk to support
- * 		Archive SC402/SC499R controller cards.
- *
- * 1992/05/27	First release.
- *
- * 1992/05/26	Initial version. Copyright H. H. Bergman 1992
- */
-
-/* After the legalese, now the important bits:
- * 
- * This is a driver for the Wangtek 5150 tape drive with 
- * a QIC-02 controller for ISA-PC type computers.
- * Hopefully it will work with other QIC-02 tape drives as well.
- *
- * Make sure your setup matches the configuration parameters.
- * Also, be careful to avoid IO conflicts with other devices!
- */
-
-
-/*
-#define TDEBUG
-*/
-
-#define REALLY_SLOW_IO		/* it sure is ... */
-
-#include <linux/module.h>
-
-#include <linux/config.h>
-
-#include <linux/interrupt.h>
-#include <linux/sched.h>
-#include <linux/timer.h>
-#include <linux/fs.h>
-#include <linux/kernel.h>
-#include <linux/major.h>
-#include <linux/errno.h>
-#include <linux/mtio.h>
-#include <linux/fcntl.h>
-#include <linux/delay.h>
-#include <linux/ioport.h>
-#include <linux/tpqic02.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/smp_lock.h>
-#include <linux/devfs_fs_kernel.h>
-#include <linux/device.h>
-
-#include <asm/dma.h>
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
-
-/* check existence of required configuration parameters */
-#if !defined(QIC02_CMD_PORT) || !defined(QIC02_TAPE_IRQ) || !defined(QIC02_TAPE_DMA)
-# error qic02_tape configuration error
-#endif
-
-
-#define TPQIC02_NAME	"tpqic02"
-
-/* Linux outb() commands have (value,port) as parameters.
- * One might expect (port,value) instead, so beware!
- */
-
-#ifdef CONFIG_QIC02_DYNCONF
-/* This holds the dynamic configuration info for the interface
- * card+drive info if runtime configuration has been selected.
- */
-
-static struct mtconfiginfo qic02_tape_dynconf =	 {
-	/* user settable */
-	0, 0, BOGUS_IRQ, 0, 0, TPQD_DEFAULT_FLAGS, 
-};
-static struct qic02_ccb qic02_tape_ccb;	/* private stuff */
-
-#else
-
-static unsigned long qic02_tape_debug = TPQD_DEFAULT_FLAGS;
-
-# if ((QIC02_TAPE_IFC!=WANGTEK) && (QIC02_TAPE_IFC!=ARCHIVE) && (QIC02_TAPE_IFC!=MOUNTAIN))
-#  error No valid interface card specified
-# endif
-#endif				/* CONFIG_QIC02_DYNCONF */
-
-static int ctlbits;	/* control reg bits for tape interface */
-
-static wait_queue_head_t qic02_tape_transfer;	/* sync rw with interrupts */
-
-static struct mtget ioctl_status;	/* current generic status */
-
-static struct tpstatus tperror;	/* last drive status */
-
-static char rcs_revision[] = "$Revision: 1.10 $";
-static char rcs_date[] = "$Date: 1997/01/26 07:13:20 $";
-
-/* Flag bits for status and outstanding requests.
- * (Could all be put in one bit-field-struct.)
- * Some variables need `volatile' because they may be modified
- * by an interrupt.
- */
-static flag status_dead = YES;	/* device is legally dead until proven alive */
-static flag status_zombie = YES;	/* it's `zombie' until irq/dma allocated */
-
-static flag status_bytes_wr = NO;	/* write FM at close or not */
-static flag status_bytes_rd = NO;	/* (rd|wr) used for rewinding */
-
-static volatile unsigned long status_cmd_pending;	/* cmd in progress */
-static flag status_expect_int = NO;	/* ready for interrupts */
-static flag status_timer_on = NO;	/* using time-out */
-static int status_error;	/* int handler may detect error */
-static flag status_eof_detected = NO;	/* end of file */
-static flag status_eom_detected = NO;	/* end of recorded media */
-static flag status_eot_detected = NO;	/* end of tape */
-static flag doing_read = NO;
-static flag doing_write = NO;
-
-static unsigned long dma_bytes_todo;
-static unsigned long dma_bytes_done;
-static volatile unsigned dma_mode;	/* !=0 also means DMA in use */
-static flag need_rewind = YES;
-
-static int current_type;
-static int extra_blocks_left = BLOCKS_BEYOND_EW;
-static struct timer_list tp_timer;
-
-static unsigned long tape_open;		/* Guard open one only */
-static DECLARE_MUTEX(tape_op);		/* Serialize tape operations */
-
-/* return_*_eof:
- *	NO:	not at EOF,
- *	YES:	tell app EOF was reached (return 0).
- *
- * return_*_eof==YES && reported_*_eof==NO  ==>
- *	return current buffer, next time(s) return EOF.
- *
- * return_*_eof==YES && reported_*_eof==YES  ==>
- *	at EOF and application knows it, so we can
- *	move on to the next file.
- *
- */
- 
-static flag return_read_eof = NO;	/* set to signal app EOF was reached */
-static flag return_write_eof = NO;
-static flag reported_read_eof = NO;	/* set when we've done that */
-static flag reported_write_eof = NO;
-
-
-/* This is for doing `mt seek <blocknr>' */
-static char seek_addr_buf[AR_SEEK_BUF_SIZE];
-
-
-/* In write mode, we have to write a File Mark after the last block written, 
- * when the tape device is closed. Tape repositioning and reading in write
- * mode is allowed as long as no actual writing has been done. After writing
- * the File Mark, repositioning and reading are allowed again.
- */
-static int mode_access;		/* access mode: READ or WRITE */
-
-static int qic02_get_resources(void);
-static void qic02_release_resources(void);
-
-/* This is a pointer to the actual kernel buffer where the interrupt routines
- * read from/write to. It is needed because the DMA channels 1 and 3 cannot
- * always access the user buffers. [The kernel buffer must reside in the
- * lower 16MBytes of system memory because of the DMA controller.] The user
- * must ensure that a large enough buffer is passed to the kernel, in order
- * to reduce tape repositioning wear and tear.
- */
-static void *buffaddr;		/* virtual address of buffer */
-
-/* This translates minor numbers to the corresponding recording format: */
-static const char *format_names[] = {
-	"not set",		/* for dumb drives unable to handle format selection */
-	"11",			/* extinct */
-	"24",
-	"120",
-	"150",
-	"300",			/* untested. */
-	"600"			/* untested. */
-};
-
-static struct class_simple *tpqic02_class;
-
-
-/* `exception_list' is needed for exception status reporting.
- * Exceptions 1..14 are defined by QIC-02 rev F.
- * The drive status is matched sequentially to each entry,
- * ignoring irrelevant bits, until a match is found. If no
- * match is found, exception number 0 is used. (That should of
- * course never happen...) The original table was based on the
- * "Exception Status Summary" in QIC-02 rev F, but some changes
- * were required to make it work with real-world drives.
- *
- * Exception 2 (CNI) is changed to also cover status 0x00e0 (mask USL),
- * Exception 4 (EOM) is changed to also cover status 0x8288 (mask EOR),
- * Exception 11 (FIL) is changed to also cover status 0x0089 (mask EOM).
- * Exception 15 (EOR) is added for seek-to-end-of-data (catch EOR),
- * Exception 16 (BOM) is added for beginning-of-media (catch BOM).
- *
- * Had to swap EXC_NDRV and EXC_NCART to ensure that extended EXC_NCART
- * (because of the incorrect Wangtek status code) doesn't catch the
- * EXC_NDRV first.
- */
-static struct exception_list_type {
-	unsigned short mask, code;
-	const char *msg;
-	/* EXC_nr attribute should match with tpqic02.h */
-} exception_list[] = {
-	{ 0, 0, "Unknown exception status code", /* extra: 0 */ },
-	{ ~(0), TP_ST0 | TP_CNI | TP_USL | TP_WRP, "Drive not online" /* 1 */ }, /* Drive presence goes before cartridge presence. */
-	{ ~(TP_WRP | TP_USL), TP_ST0 | TP_CNI,
-		    /* My Wangtek 5150EQ sometimes reports a status code
-		     * of 0x00e0, which is not a valid exception code, but
-		     * I think it should be recognized as "NO CARTRIDGE".
-		     */
-			"Cartridge not in place" /* 2 */ },
-	{ (unsigned short) ~(TP_ST1 | TP_BOM), (TP_ST0 | TP_WRP), "Write protected cartridge" /* 3 */ },
-	{ (unsigned short) ~(TP_ST1 | TP_EOR), (TP_ST0 | TP_EOM), "End of media" /* 4 */ },
-	{ ~TP_WRP, TP_ST0 | TP_UDA | TP_ST1 | TP_BOM, "Read or Write abort. Rewind tape." /* 5 */ },
-	{ ~TP_WRP, TP_ST0 | TP_UDA, "Read error. Bad block transferred." /* 6 */ },
-	{ ~TP_WRP, TP_ST0 | TP_UDA | TP_BNL, "Read error. Filler block transferred." /* 7 */ },
-	{ ~TP_WRP, TP_ST0 | TP_UDA | TP_BNL | TP_ST1 | TP_NDT, "Read error. No data detected." /* 8 */ },
-	{ ~TP_WRP, TP_ST0 | TP_EOM | TP_UDA | TP_BNL | TP_ST1 | TP_NDT, "Read error. No data detected. EOM." /* 9 */ },
-	{ ~(TP_WRP | TP_MBD | TP_PAR | TP_EOR), TP_ST0 | TP_UDA | TP_BNL | TP_ST1 | TP_NDT | TP_BOM, "Read error. No data detected. BOM." /* 10 */ },
-	{ ~(TP_WRP | TP_EOM), TP_ST0 | TP_FIL,
-		    /* Status 0x0089 (EOM & FM) is viewed as an FM,
-		     * because it can only happen during a read.
-		     * EOM is checked separately for an FM condition.
-		     */
-			"File mark detected" /* 11 */ },
-	{ ~(TP_ST0 | TP_CNI | TP_USL | TP_WRP | TP_BOM), TP_ST1 | TP_ILL, "Illegal command" /* 12 */ },
-	{ ~(TP_ST0 | TP_CNI | TP_USL | TP_WRP | TP_BOM), TP_ST1 | TP_POR, "Reset occurred" /* 13 */ },
-	{ ~TP_WRP, TP_ST0 | TP_FIL | TP_MBD,	/* NOTE: ST1 not set! */ "Marginal block detected" /* 14 */ },
-	{ ~(TP_ST0 | TP_WRP | TP_EOM | TP_UDA | TP_BNL | TP_FIL |  TP_NDT), TP_ST1 | TP_EOR,	/********** Is the extra TP_NDT really needed Eddy? **********/ "End of recorded media" /* extra: 15 */ },
-	    /* 15 is returned when SEEKEOD completes successfully */
-	{ ~(TP_WRP | TP_ST0), TP_ST1 | TP_BOM, "Beginning of media" /* extra: 16 */ }
-};
-
-#define NR_OF_EXC	(sizeof(exception_list)/sizeof(struct exception_list_type))
-
-/* Compare expected struct size and actual struct size. This
- * is useful to catch programs compiled with old #includes.
- */
-#define CHECK_IOC_SIZE(structure) \
-	if (_IOC_SIZE(iocmd) != sizeof(struct structure)) { \
-		tpqputs(TPQD_ALWAYS, "sizeof(struct " #structure \
-			") does not match!"); \
-		return -EFAULT; \
-	} \
-
-static void tpqputs(unsigned long flags, const char *s)
-{
-	if ((flags & TPQD_ALWAYS) || (flags & QIC02_TAPE_DEBUG))
-		printk(TPQIC02_NAME ": %s\n", s);
-}				/* tpqputs */
-
-
-/* Init control register bits on interface card.
- * For Archive, interrupts must be enabled explicitly.
- * Wangtek interface card requires ONLINE to be set, Archive SC402/SC499R
- * cards keep it active all the time.
- */
-
-static void ifc_init(void)
-{
-	if (QIC02_TAPE_IFC == WANGTEK) {	/* || (QIC02_TAPE_IFC == EVEREX) */
-		ctlbits = WT_CTL_ONLINE;	/* online */
-		outb_p(ctlbits, QIC02_CTL_PORT);
-	} else if (QIC02_TAPE_IFC == ARCHIVE) {
-		ctlbits = 0;	/* no interrupts yet */
-		outb_p(ctlbits, QIC02_CTL_PORT);
-		outb_p(0, AR_RESET_DMA_PORT);	/* dummy write to reset DMA */
-	} else {		/* MOUNTAIN */
-
-		ctlbits = MTN_CTL_ONLINE;	/* online, and logic enabled */
-		outb_p(ctlbits, QIC02_CTL_PORT);
-	}
-}				/* ifc_init */
-
-
-static void report_qic_exception(unsigned n)
-{
-	if (n >= NR_OF_EXC) {
-		tpqputs(TPQD_ALWAYS, "Oops -- report_qic_exception");
-		n = 0;
-	}
-	if (TPQDBG(SENSE_TEXT) || n == 0)
-		printk(TPQIC02_NAME ": sense: %s\n", exception_list[n].msg);
-}				/* report_qic_exception */
-
-
-/* Try to map the drive-exception bits `s' to a predefined "exception number",
- * by comparing the significant exception bits for each entry in the
- * exception table (`exception_list[]').
- * It is assumed that s!=0.
- */
-static int decode_qic_exception_nr(unsigned s)
-{
-	int i;
-
-	for (i = 1; i < NR_OF_EXC; i++) {
-		if ((s & exception_list[i].mask) == exception_list[i].code) {
-			return i;
-		}
-	}
-	printk(TPQIC02_NAME ": decode_qic_exception_nr: exception(%x) not recognized\n", s);
-	return 0;
-}				/* decode_qic_exception_nr */
-
-
-
-/* Perform appropriate action for certain exceptions.
- * should return a value to indicate stop/continue (in case of bad blocks)
- */
-static void handle_qic_exception(int exnr, int exbits)
-{
-	if (exnr == EXC_NCART) {
-		/* Cartridge was changed. Redo sense().
-		 * EXC_NCART should be handled in open().
-		 * It is not permitted to remove the tape while
-		 * the tape driver has open files. 
-		 */
-		need_rewind = YES;
-		status_eof_detected = NO;
-		status_eom_detected = NO;
-	} else if (exnr == EXC_XFILLER) {
-		tpqputs(TPQD_ALWAYS,
-			"[Bad block -- filler data transferred.]");
-	} else if (exnr == EXC_XBAD) {
-		tpqputs(TPQD_ALWAYS, "[CRC failed!]");
-	} else if (exnr == EXC_MARGINAL) {
-		/* A marginal block behaves much like a FM.
-		 * User may continue reading, if desired.
-		 */
-		tpqputs(TPQD_ALWAYS, "[Marginal block]");
-		doing_read = NO;
-	} else if (exnr == EXC_FM) {
-		doing_read = NO;
-	}
-}				/* handle_qic_exception */
-
-
-static inline int is_exception(void)
-{
-	return (inb(QIC02_STAT_PORT) & QIC02_STAT_EXCEPTION) == 0;
-}				/* is_exception */
-
-
-/* Reset the tape drive and controller.
- * When reset fails, it marks  the drive as dead and all
- * requests (except reset) are to be ignored (ENXIO).
- */
-static int tape_reset(int verbose)
-{
-	ifc_init();		/* reset interface card */
-
-	/* assert reset */
-	if (QIC02_TAPE_IFC == MOUNTAIN) {
-		outb_p(ctlbits & ~MTN_QIC02_CTL_RESET_NOT, QIC02_CTL_PORT);
-	} else {		/* WANGTEK, ARCHIVE */
-
-		outb_p(ctlbits | QIC02_CTL_RESET, QIC02_CTL_PORT);
-	}
-
-	/* Next, we need to wait >=25 usec. */
-	udelay(30);
-
-	/* after reset, we will be at BOT (modulo an automatic rewind) */
-	status_eof_detected = NO;
-	status_eom_detected = NO;
-	status_cmd_pending = 0;
-	need_rewind = YES;
-	doing_read = doing_write = NO;
-	ioctl_status.mt_fileno = ioctl_status.mt_blkno = 0;
-
-	/* de-assert reset */
-	if (QIC02_TAPE_IFC == MOUNTAIN) {
-		outb_p(ctlbits | MTN_QIC02_CTL_RESET_NOT, QIC02_CTL_PORT);
-	} else {
-		outb_p(ctlbits & ~QIC02_CTL_RESET, QIC02_CTL_PORT);
-	}
-
-	/* KLUDGE FOR G++ BUG */
-	{
-		int stat = inb_p(QIC02_STAT_PORT);
-		status_dead = ((stat & QIC02_STAT_RESETMASK) != QIC02_STAT_RESETVAL);
-	}
-	/* if successful, inb(STAT) returned RESETVAL */
-	if (status_dead == YES)
-		printk(TPQIC02_NAME ": reset failed!\n");
-	else if (verbose)
-		printk(TPQIC02_NAME ": reset successful\n");
-
-	return (status_dead == YES) ? TE_DEAD : TE_OK;
-}				/* tape_reset */
-
-
-
-/* Notify tape drive of a new command. It only waits for the
- * command to be accepted, not for the actual command to complete.
- *
- * Before calling this routine, QIC02_CMD_PORT must have been loaded
- * with the command to be executed.
- * After this routine, the exception bit must be checked.
- * This routine is also used by rdstatus(), so in that case, any exception
- * must be ignored (`ignore_ex' flag).
- */
-static int notify_cmd(char cmd, short ignore_ex)
-{
-	int i;
-
-	outb_p(cmd, QIC02_CMD_PORT);	/* output the command */
-
-	/* wait 1 usec before asserting /REQUEST */
-	udelay(1);
-
-	if ((!ignore_ex) && is_exception()) {
-		tpqputs(TPQD_ALWAYS, "*** exception detected in notify_cmd");
-		/** force a reset here **/
-		if (tape_reset(1) == TE_DEAD)
-			return TE_DEAD;
-		if (is_exception()) {
-			tpqputs(TPQD_ALWAYS, "exception persists after reset.");
-			tpqputs(TPQD_ALWAYS, " ^ exception ignored.");
-		}
-	}
-
-	outb_p(ctlbits | QIC02_CTL_REQUEST, QIC02_CTL_PORT);	/* set request bit */
-	i = TAPE_NOTIFY_TIMEOUT;
-	/* The specs say this takes about 500 usec, but there is no upper limit!
-	 * If the drive were busy retensioning or something like that,
-	 * it could be *much* longer!
-	 */
-	while ((inb_p(QIC02_STAT_PORT) & QIC02_STAT_READY) && (--i > 0))
-		udelay(1);
-	/* wait for ready */
-	if (i == 0) {
-		tpqputs(TPQD_ALWAYS, "timed out waiting for ready in notify_cmd");
-		status_dead = YES;
-		return TE_TIM;
-	}
-
-	outb_p(ctlbits & ~QIC02_CTL_REQUEST, QIC02_CTL_PORT);	/* reset request bit */
-	i = TAPE_NOTIFY_TIMEOUT;
-	/* according to the specs this one should never time-out */
-	while (((inb_p(QIC02_STAT_PORT) & QIC02_STAT_READY) == 0) && (--i > 0))
-		udelay(1);
-	/* wait for not ready */
-	if (i == 0) {
-		tpqputs(TPQD_ALWAYS, "timed out waiting for !ready in notify_cmd");
-		status_dead = YES;
-		return TE_TIM;
-	}
-	/* command accepted */
-	return TE_OK;
-}				/* notify_cmd */
-
-
-
-/* Wait for a command to complete, with timeout */
-static int wait_for_ready(time_t timeout)
-{
-	int stat;
-	unsigned long spin_t;
-
-	/* Wait for ready or exception, without driving the loadavg up too much.
-	 * In most cases, the tape drive already has READY asserted,
-	 * so optimize for that case.
-	 *
-	 * First, busy wait a few usec:
-	 */
-	spin_t = 50;
-	while (((stat = inb_p(QIC02_STAT_PORT) & QIC02_STAT_MASK) == QIC02_STAT_MASK) && (--spin_t > 0))
-		udelay(1);
-	if ((stat & QIC02_STAT_READY) == 0)
-		return TE_OK;	/* covers 99.99% of all calls */
-
-	/* Then use schedule() a few times */
-	spin_t = 3;		/* max 0.03 sec busy waiting */
-	if (spin_t > timeout)
-		spin_t = timeout;
-	timeout -= spin_t;
-	spin_t += jiffies;
-
-	/* FIXME...*/
-	while (((stat = inb_p(QIC02_STAT_PORT) & QIC02_STAT_MASK) == QIC02_STAT_MASK)  && time_before(jiffies, spin_t))
-	{
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(1);	/* don't waste all the CPU time */
-	}
-	if ((stat & QIC02_STAT_READY) == 0)
-		return TE_OK;
-
-	/* If we reach this point, we probably need to wait much longer, or
-	 * an exception occurred. Either case is not very time-critical.
-	 * Check the status port only a few times every second.
-	 * A interval of less than 0.10 sec will not be noticed by the user,
-	 * more than 0.40 sec may give noticeable delays.
-	 */
-	spin_t += timeout;
-	TPQDEB({printk("wait_for_ready: additional timeout: %d\n", spin_t);})
-
-	    /* not ready and no exception && timeout not expired yet */
-	while (((stat = inb_p(QIC02_STAT_PORT) & QIC02_STAT_MASK) == QIC02_STAT_MASK) && time_before(jiffies, spin_t)) {
-		/* be `nice` to other processes on long operations... */
-		/* nap 0.30 sec between checks, */
-		/* but could be woken up earlier by signals... */
-		msleep_interruptible(300);
-	}
-
-	/* don't use jiffies for this test because it may have changed by now */
-	if ((stat & QIC02_STAT_MASK) == QIC02_STAT_MASK) {
-		tpqputs(TPQD_ALWAYS, "wait_for_ready() timed out");
-		return TE_TIM;
-	}
-
-	if ((stat & QIC02_STAT_EXCEPTION) == 0) {
-		tpqputs(TPQD_ALWAYS, "exception detected after waiting_for_ready");
-		return TE_EX;
-	} else {
-		return TE_OK;
-	}
-}				/* wait_for_ready */
-
-
-
-/* Send some data to the drive */
-static int send_qic02_data(char sb[], unsigned size, int ignore_ex)
-{
-	int i, stat;
-
-	for (i = 0; i < size; i++) {
-		stat = wait_for_ready(TIM_S);
-		if (stat != TE_OK)
-			return stat;
-
-		stat = notify_cmd(sb[i], ignore_ex);
-		if (stat != TE_OK)
-			return stat;
-	}
-	return TE_OK;
-
-}				/* send_qic02_data */
-
-
-/* Send a QIC-02 command (`cmd') to the tape drive, with
- * a time-out (`timeout').
- * This one is also used by tp_sense(), so we must have
- * a flag to disable exception checking (`ignore_ex'). 
- *
- * On entry, the controller is supposed to be READY.
- */
-static int send_qic02_cmd(int cmd, time_t timeout, int ignore_ex)
-{
-	int stat;
-
-	stat = inb_p(QIC02_STAT_PORT);
-	if ((stat & QIC02_STAT_EXCEPTION) == 0) {	/* if exception */
-		tpqputs(TPQD_ALWAYS, "send_qic02_cmd: Exception!");
-		return TE_EX;
-	}
-	if (stat & QIC02_STAT_READY) {	/* if not ready */
-		tpqputs(TPQD_ALWAYS, "send_qic02_cmd: not Ready!");
-		return TE_ERR;
-	}
-
-	/* assert(ready & !exception) */
-
-	/* Remember current command for later re-use with dma transfers.
-	 * (For reading/writing multiple blocks.)
-	 */
-	status_cmd_pending = cmd;
-
-	stat = notify_cmd(cmd, ignore_ex);	/* tell drive new command was loaded, */
-	/* inherit exception check. */
-	if (TP_HAVE_SEEK && (cmd == AR_QCMDV_SEEK_BLK)) {
-		/* This one needs to send 3 more bytes, MSB first */
-		stat = send_qic02_data(seek_addr_buf, sizeof(seek_addr_buf), ignore_ex);
-	}
-
-	if (stat != TE_OK) {
-		tpqputs(TPQD_ALWAYS, "send_qic02_cmd failed");
-	}
-	return stat;
-}				/* send_qic02_cmd */
-
-
-
-/* Get drive status. Assume drive is ready or has exception set.
- * (or will be in <1000 usec.)
- * Extra parameters added because of 'Read Extended Status 3' command.
- */
-static int rdstatus(char *stp, unsigned size, char qcmd)
-{
-	int s, n;
-	char *q = stp;
-
-	/* Try to busy-wait a few (700) usec, after that de-schedule.
-	 *
-	 * The problem is, if we don't de-schedule, performance will
-	 * drop to zero when the drive is not responding and if we
-	 * de-schedule immediately, we waste a lot of time because a
-	 * task switch is much longer than we usually have to wait here.
-	 */
-	n = 700;
-	while ((n > 0) && ((inb_p(QIC02_STAT_PORT) & QIC02_STAT_MASK) == QIC02_STAT_MASK))
-	{
-		udelay(1);
-		n--;		/* wait for ready or exception or timeout */
-	}
-	if (n == 0) {
-		/* n (above) should be chosen such that on your machine
-		 * you rarely ever see the message below, and it should
-		 * be small enough to give reasonable response time.]
-		 */
-	 	/* FIXME */
-		tpqputs(TPQD_ALWAYS, "waiting looong in rdstatus() -- drive dead?");
-		while ((inb_p(QIC02_STAT_PORT) & QIC02_STAT_MASK) == QIC02_STAT_MASK)
-		{
-			set_current_state(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(1);
-		}
-		tpqputs(TPQD_ALWAYS, "finished waiting in rdstatus()");
-	}
-
-	(void) notify_cmd(qcmd, 1);	/* send read status command */
-	/* ignore return code -- should always be ok, STAT may contain 
-	 * exception flag from previous exception which we are trying to clear.
-	 */
-
-	if (TP_DIAGS(current_type))
-		printk(TPQIC02_NAME ": reading status bytes: ");
-
-	for (q = stp; q < stp + size; q++) {
-		do
-			s = inb_p(QIC02_STAT_PORT);
-		while ((s & QIC02_STAT_MASK) == QIC02_STAT_MASK);	/* wait for ready or exception */
-
-		if ((s & QIC02_STAT_EXCEPTION) == 0) {	/* if exception */
-			tpqputs(TPQD_ALWAYS, "rdstatus: exception error");
-			ioctl_status.mt_erreg = 0;	/* dunno... */
-			return TE_NS;	/* error, shouldn't happen... */
-		}
-
-		*q = inb_p(QIC02_DATA_PORT);	/* read status byte */
-
-		if (TP_DIAGS(current_type))
-			printk("[%1zd]=0x%x  ", q - stp, (unsigned) (*q) & 0xff);
-
-		outb_p(ctlbits | QIC02_CTL_REQUEST, QIC02_CTL_PORT);	/* set request */
-
-		while ((inb_p(QIC02_STAT_PORT) & QIC02_STAT_READY) == 0)
-			cpu_relax();	/* wait for not ready */
-
-		udelay(22);	/* delay >20 usec */
-
-		outb_p(ctlbits & ~QIC02_CTL_REQUEST, QIC02_CTL_PORT);	/* un-set request */
-
-	}
-
-	/* Specs say we should wait for READY here.
-	 * My drive doesn't seem to need it here yet, but others do?
-	 */
-	while (inb_p(QIC02_STAT_PORT) & QIC02_STAT_READY)
-		cpu_relax();
-	/* wait for ready */
-
-	if (TP_DIAGS(current_type))
-		printk("\n");
-
-	return TE_OK;
-}				/* rdstatus */
-
-
-
-/* Get standard status (6 bytes).
- * The `.dec' and `.urc' fields are in MSB-first byte-order,
- * so they have to be swapped first.
- */
-static int get_status(volatile struct tpstatus *stp)
-{
-	int stat = rdstatus((char *) stp, TPSTATSIZE, QCMD_RD_STAT);
-	stp->dec = be16_to_cpu(stp->dec);
-	stp->urc = be16_to_cpu(stp->urc);
-	return stat;
-}				/* get_status */
-
-
-#if 0
-/* This fails for my Wangtek drive */
-/* get "Extended Status Register 3" (64 bytes)
- *
- * If the meaning of the returned bytes were known, the MT_TYPE
- * identifier could be used to decode them, since they are
- * "vendor unique". :-(
- */
-static int get_ext_status3(void)
-{
-	char vus[64];		/* vendor unique status */
-	int stat, i;
-
-	tpqputs(TPQD_ALWAYS, "Attempting to read Extended Status 3...");
-	stat = rdstatus(vus, sizeof(vus), QCMD_RD_STAT_X3);
-	if (stat != TE_OK)
-		return stat;
-
-	tpqputs(TPQD_ALWAYS, "Returned status bytes:");
-	for (i = 0; i < sizeof(vus); i++) {
-		if (i % 8 == 0)
-			printk("\n" TPQIC02_NAME ": %2d:");
-		printk(" %2x", vus[i] & 0xff);
-	}
-	printk("\n");
-
-	return TE_OK;
-}				/* get_ext_status3 */
-#endif
-
-
-/* Read drive status and set generic status too.
- * NOTE: Once we do a tp_sense(), read/write transfers are killed.
- */
-static int tp_sense(int ignore)
-{
-	unsigned err = 0, exnr = 0, gs = 0;
-	static void finish_rw(int cmd);
-
-	if (TPQDBG(SENSE_TEXT))
-		printk(TPQIC02_NAME ": tp_sense(ignore=0x%x) enter\n", ignore);
-
-	/* sense() is not allowed during a read or write cycle */
-	if (doing_write == YES)
-		tpqputs(TPQD_ALWAYS, "Warning: File Mark inserted because of sense() request");
-	/* The extra test is to avoid calling finish_rw during booting */
-	if ((doing_read != NO) || (doing_write != NO))
-		finish_rw(QCMD_RD_STAT);
-
-	if (get_status(&tperror) != TE_OK) {
-		tpqputs(TPQD_ALWAYS, "tp_sense: could not read tape drive status");
-		return TE_ERR;
-	}
-
-	err = tperror.exs;	/* get exception status bits */
-	if (err & (TP_ST0 | TP_ST1))
-		printk(TPQIC02_NAME ": tp_sense: status: %x, error count: %d, underruns: %d\n",
-		       tperror.exs, tperror.dec, tperror.urc);
-	else if ((tperror.dec != 0) || (tperror.urc != 0) || TPQDBG(SENSE_CNTS))
-		printk(TPQIC02_NAME ": tp_sense: no hard errors, soft error count: %d, underruns: %d\n", tperror.dec, tperror.urc);
-
-	/* Set generic status. HP-UX defines these, but some extra would 
-	 * be useful. Problem is to remain compatible. [Do we want to be
-	 * compatible??]
-	 */
-	if (err & TP_ST0) {
-		if (err & TP_CNI)	/* no cartridge */
-			gs |= GMT_DR_OPEN(-1);
-		if (status_dead == NO)
-			gs |= GMT_ONLINE(-1);	/* always online */
-		if (err & TP_USL)	/* not online */
-			gs &= ~GMT_ONLINE(-1);
-		if (err & TP_WRP)
-			gs |= GMT_WR_PROT(-1);
-		if (err & TP_EOM) {	/* end of media */
-			gs |= GMT_EOT(-1);	/* not sure this is correct for writes */
-			status_eom_detected = YES;
-			/* I don't know whether drive always reports EOF at or before EOM. */
-			status_eof_detected = YES;
-		}
-		/** if (err & TP_UDA) "Unrecoverable data error" **/
-		/** if (err & TP_BNL) "Bad block not located" **/
-		if (err & TP_FIL) {
-			gs |= GMT_EOF(-1);
-			status_eof_detected = YES;
-		}
-	}
-	if (err & TP_ST1) {
-		/** if (err & TP_ILL) "Illegal command" **/
-		/** if (err & TP_NDT) "No data detected" **/
-		/** if (err & TP_MBD) "Marginal block detected" **/
-		if (err & TP_BOM)
-			gs |= GMT_BOT(-1);	/* beginning of tape */
-	}
-	ioctl_status.mt_gstat = gs;
-	ioctl_status.mt_dsreg = tperror.exs;	/* "drive status" */
-	ioctl_status.mt_erreg = tperror.dec;	/* "sense key error" */
-
-	if (err & (TP_ST0 | TP_ST1)) {
-		/* My Wangtek occasionally reports `status' 1212 which should be ignored. */
-		exnr = decode_qic_exception_nr(err);
-		handle_qic_exception(exnr, err);	/* update driver state wrt drive status */
-		report_qic_exception(exnr);
-	}
-	err &= ~ignore;		/* mask unwanted errors -- not the correct way, use exception nrs?? */
-	if (((err & TP_ST0) && (err & REPORT_ERR0)) ||
-	    ((err & TP_ST1) && (err & REPORT_ERR1)))
-		return TE_ERR;
-	return TE_OK;
-}				/* tp_sense */
-
-
-
-/* Wait for a wind or rewind operation to finish or
- * to time-out. (May take very long).
- */
-static int wait_for_rewind(time_t timeout)
-{
-	int stat;
-
-	stat = inb(QIC02_STAT_PORT) & QIC02_STAT_MASK;
-	if (TPQDBG(REWIND))
-		printk(TPQIC02_NAME ": Waiting for (re-)wind to finish: stat=0x%x\n", stat);
-
-	stat = wait_for_ready(timeout);
-
-	if (stat != TE_OK) {
-		tpqputs(TPQD_ALWAYS, "(re-) winding failed\n");
-	}
-	return stat;
-}				/* wait_for_rewind */
-
-
-
-/* Perform a full QIC02 command, and wait for completion,
- * check status when done. Complain about exceptions.
- *
- * This function should return an OS error code when
- * something goes wrong, 0 otherwise.
- */
-static int ll_do_qic_cmd(int cmd, time_t timeout)
-{
-	int stat;
-
-	if (status_dead == YES) {
-		tpqputs(TPQD_ALWAYS, "Drive is dead. Do a `mt reset`.");
-		return -ENXIO;	/* User should do an MTRESET. */
-	}
-
-	stat = wait_for_ready(timeout);	/* wait for ready or exception */
-	if (stat == TE_EX) {
-		if (tp_sense(TP_WRP | TP_BOM | TP_EOM | TP_FIL) != TE_OK)
-			return -EIO;
-		/* else nothing to worry about, I hope */
-		stat = TE_OK;
-	}
-	if (stat != TE_OK) {
-		printk(TPQIC02_NAME ": ll_do_qic_cmd(%x, %ld) failed\n", cmd, (long) timeout);
-		return -EIO;
-	}
-#ifdef OBSOLETE
-	/* wait for ready since it may not be active immediately after reading status */
-	while ((inb_p(QIC02_STAT_PORT) & QIC02_STAT_READY) != 0)
-		cpu_relax();
-#endif
-
-	stat = send_qic02_cmd(cmd, timeout, 0);	/* (checks for exceptions) */
-
-	if (cmd == QCMD_RD_FM) {
-		status_eof_detected = NO;
-		ioctl_status.mt_fileno++;
-		/* Should update block count as well, but can't.
-		 * Can do a `read address' for some drives, when MTNOP is done.
-		 */
-	} else if (cmd == QCMD_WRT_FM) {
-		status_eof_detected = NO;
-		ioctl_status.mt_fileno++;
-	} else if ((cmd == QCMD_REWIND) || (cmd == QCMD_ERASE)
-		   || (cmd == QCMD_RETEN)) {
-		status_eof_detected = NO;
-		status_eom_detected = NO;
-		status_eot_detected = NO;
-		need_rewind = NO;
-		ioctl_status.mt_fileno = ioctl_status.mt_blkno = 0;
-		extra_blocks_left = BLOCKS_BEYOND_EW;
-		return_write_eof = NO;
-		return_read_eof = NO;
-		reported_read_eof = NO;
-		reported_write_eof = NO;
-	}
-	/* sense() will set eof/eom as required */
-	if (stat == TE_EX) {
-		if (tp_sense(TP_WRP | TP_BOM | TP_EOM | TP_FIL) != TE_OK) {
-			printk(TPQIC02_NAME ": Exception persist in ll_do_qic_cmd[1](%x, %ld)", cmd, (long) timeout);
-			status_dead = YES;
-			return -ENXIO;
-			/* if rdstatus fails too, we're in trouble */
-		}
-	} else if (stat != TE_OK) {
-		printk(TPQIC02_NAME ": ll_do_qic_cmd: send_qic02_cmd failed, stat = 0x%x\n", stat);
-		return -EIO;	/*** -EIO is probably not always appropriate */
-	}
-
-	if (timeout == TIM_R)
-		stat = wait_for_rewind(timeout);
-	else
-		stat = wait_for_ready(timeout);
-
-	if (stat == TE_EX) {
-		if (tp_sense((cmd == QCMD_SEEK_EOD ?		/*****************************/
-			      TP_EOR | TP_NDT | TP_UDA | TP_BNL | TP_WRP |
-			      TP_BOM | TP_EOM | TP_FIL : TP_WRP | TP_BOM |
-			      TP_EOM | TP_FIL)) != TE_OK) {
-			printk(TPQIC02_NAME ": Exception persist in ll_do_qic_cmd[2](%x, %ld)\n", cmd, (long) timeout);
-			if (cmd != QCMD_RD_FM)
-				status_dead = YES;
-			return -ENXIO;
-			/* if rdstatus fails too, we're in trouble */
-		}
-	} else if (stat != TE_OK) {
-		printk(TPQIC02_NAME ": ll_do_qic_cmd %x: wait failed, stat == 0x%x\n", cmd, stat);
-		return -EIO;
-	}
-	return 0;
-}				/* ll_do_qic_cmd */
-
-
-/* 
- * Problem: What to do when the user cancels a read/write operation
- * in-progress?
- *
- * "Deactivating ONLINE during a READ also causes the"
- * "tape to be rewound to BOT." Ditto for WRITEs, except
- * a FM is written first. "The host may alternatively terminate
- * the READ/WRITE command by issuing a RFM/WFM command."
- *
- * For READs:
- * Neither option will leave the tape positioned where it was.
- * Another (better?) solution is to terminate the READ by two
- * subsequent sense() operations, the first to stop the current
- * READ cycle, the second to clear the `Illegal command' exception,
- * because the QIC-02 specs didn't anticipate this. This is
- * delayed until actually needed, so a tar listing can be aborted
- * by the user and continued later.
- * If anybody has a better solution, let me know! [Also, let me
- * know if your drive (mine is a Wangtek5150EQ) does not accept
- * this sequence for canceling the read-cycle.]
- *
- * For WRITEs it's simple: Just do a WRITE_FM, leaving the tape
- * positioned after the FM.
- */
-
-static void terminate_read(int cmd)
-{
-	if (doing_read != YES)
-		return;
-		
-	doing_read = NO;
-	
-	if (cmd == QCMD_RD_FM)
-		return;
-		
-	/* if the command is a RFM, there is no need to do this
-	 * because a RFM will legally terminate the read-cycle.
-	 */
-	tpqputs(TPQD_ALWAYS, "terminating pending read-cycle");
-
-	/* I'm not too sure about this part  -- hhb */
-	if (QIC02_TAPE_IFC == MOUNTAIN) {
-		/* Mountain reference says can terminate by de-asserting online */
-		ctlbits &= ~MTN_QIC02_CTL_ONLINE;
-	}
-
-	if (tp_sense(TP_FIL | TP_EOM | TP_WRP) != TE_OK) {
-		tpqputs(TPQD_ALWAYS, "finish_rw[read1]: ignore the 2 lines above");
-		if (is_exception()) {
-			if (tp_sense(TP_ILL | TP_FIL | TP_EOM | TP_WRP) != TE_OK)
-				tpqputs(TPQD_ALWAYS,"finish_rw[read2]: read cycle error");
-		}
-	}
-}				/* terminate_read */
-
-
-static void terminate_write(int cmd)
-{
-	int stat;
-
-	if (doing_write != YES)
-		return;
-
-	doing_write = NO;
-	/* Finish writing by appending a FileMark at the end. */
-	if (cmd != QCMD_WRT_FM) {
-		/* finish off write cycle */
-		stat = ll_do_qic_cmd(QCMD_WRT_FM, TIM_M);
-		if (stat != TE_OK)
-			tpqputs(TPQD_ALWAYS, "Couldn't finish write cycle properly");
-		(void) tp_sense(0);
-	}
-	/* If there is an EOF token waiting to be returned to
-	 * the (writing) application, discard it now.
-	 * We could be at EOT, so don't reset return_write_eof.
-	 */
-	reported_write_eof = YES;
-}				/* terminate_write */
-
-
-/* terminate read or write cycle because of command `cmd' */
-static void finish_rw(int cmd)
-{
-	if (wait_for_ready(TIM_S) != TE_OK) {
-		tpqputs(TPQD_ALWAYS, "error: drive not ready in finish_rw() !");
-		return;
-	}
-	terminate_read(cmd);
-	terminate_write(cmd);
-}				/* finish_rw */
-
-
-/* Perform a QIC command through ll_do_qic_cmd().
- * If necessary, rewind the tape first.
- * Return an OS error code if something goes wrong, 0 if all is well.
- */
-static int do_qic_cmd(int cmd, time_t timeout)
-{
-	int stat;
-
-
-	finish_rw(cmd);
-
-	if (need_rewind) {
-		tpqputs(TPQD_REWIND, "Rewinding tape...");
-		stat = ll_do_qic_cmd(QCMD_REWIND, TIM_R);
-		if (stat != 0) {
-			printk(TPQIC02_NAME ": rewind failed in do_qic_cmd(). stat=0x%2x", stat);
-			return stat;
-		}
-		need_rewind = NO;
-		if (cmd == QCMD_REWIND)	/* don't wind beyond BOT ;-) */
-			return 0;
-	}
-
-	return ll_do_qic_cmd(cmd, timeout);
-}				/* do_qic_cmd */
-
-
-/* Not all ioctls are supported for all drives. Some rely on
- * optional QIC-02 commands. Check tpqic02.h for configuration.
- * Some of these commands may require ONLINE to be active.
- */
-static int do_ioctl_cmd(int cmd)
-{
-	int stat;
-
-	/* It is not permitted to read or wind the tape after bytes have
-	 * been written. It is not permitted to write the tape while in
-	 * read mode.
-	 * We try to be kind and allow reading again after writing a FM...
-	 */
-
-	switch (cmd) {
-	case MTRESET:
-		/* reset verbose */
-		return (tape_reset(1) == TE_OK) ? 0 : -EIO;
-
-	case MTFSF:
-		tpqputs(TPQD_IOCTLS, "MTFSF forward searching filemark");
-		if ((mode_access == WRITE) && status_bytes_wr)
-			return -EACCES;
-		return do_qic_cmd(QCMD_RD_FM, TIM_F);
-
-	case MTBSF:
-		if (TP_HAVE_BSF) {
-			tpqputs(TPQD_IOCTLS, "MTBSF backward searching filemark -- optional command");
-			if ((mode_access == WRITE) && status_bytes_wr)
-				return -EACCES;
-			stat = do_qic_cmd(QCMD_RD_FM_BCK, TIM_F);
-		} else {
-			stat = -ENXIO;
-		}
-		status_eom_detected = status_eof_detected = NO;
-		return stat;
-
-	case MTFSR:
-		if (TP_HAVE_FSR) {	/* This is an optional QIC-02 command */
-			tpqputs(TPQD_IOCTLS, "MTFSR forward space record");
-			if ((mode_access == WRITE) && status_bytes_wr)
-				return -EACCES;
-			stat = do_qic_cmd(QCMD_SPACE_FWD, TIM_F);
-		} else {
-				/**** fake it by doing a read data block command? ******/
-			tpqputs(TPQD_IOCTLS, "MTFSR not supported");
-			stat = -ENXIO;
-		}
-		return stat;
-
-	case MTBSR:
-		if (TP_HAVE_BSR) {	/* This is an optional QIC-02 command */
-			/* we need this for appending files with GNU tar!! */
-			tpqputs(TPQD_IOCTLS, "MTFSR backward space record");
-			if ((mode_access == WRITE) && status_bytes_wr)
-				return -EACCES;
-			stat = do_qic_cmd(QCMD_SPACE_BCK, TIM_F);
-		} else {
-			tpqputs(TPQD_IOCTLS, "MTBSR not supported");
-			stat = -ENXIO;
-		}
-		status_eom_detected = status_eof_detected = NO;
-		return stat;
-
-	case MTWEOF:
-		tpqputs(TPQD_IOCTLS, "MTWEOF write eof mark");
-		/* Plain GNU mt(1) 2.2 uses read-only mode for writing FM. :-( */
-		if (mode_access == READ)
-			return -EACCES;
-
-		/* allow tape movement after writing FM */
-		status_bytes_rd = status_bytes_wr;	/* Kludge-O-Matic */
-		status_bytes_wr = NO;
-		return do_qic_cmd(QCMD_WRT_FM, TIM_M);
-		/* not sure what to do with status_bytes when WFM should fail */
-
-	case MTREW:
-		tpqputs(TPQD_IOCTLS, "MTREW rewinding tape");
-		if ((mode_access == WRITE) && status_bytes_wr)
-			return -EACCES;
-		status_eom_detected = status_eof_detected = NO;
-		return do_qic_cmd(QCMD_REWIND, TIM_R);
-
-	case MTOFFL:
-		tpqputs(TPQD_IOCTLS, "MTOFFL rewinding & going offline");
-		/* Doing a drive select will clear (unlock) the current drive.
-		 * But that requires support for multiple drives and locking.
-		 */
-		if ((mode_access == WRITE) && status_bytes_wr)
-			return -EACCES;
-		status_eom_detected = status_eof_detected = NO;
-			/**** do rewind depending on minor bits??? ***/
-		stat = do_qic_cmd(QCMD_REWIND, TIM_R);
-		return stat;
-
-	case MTNOP:
-		tpqputs(TPQD_IOCTLS, "MTNOP setting status only");
-		/********** should do `read position' for drives that support it **********/
-		return (tp_sense(-1) == TE_OK) ? 0 : -EIO;	/**** check return codes ****/
-
-	case MTRETEN:
-		tpqputs(TPQD_IOCTLS, "MTRETEN retension tape");
-		if ((mode_access == WRITE) && status_bytes_wr)
-			return -EACCES;
-		status_eom_detected = status_eof_detected = NO;
-		return do_qic_cmd(QCMD_RETEN, TIM_R);
-
-	case MTBSFM:
-		/* Think think is like MTBSF, except that
-		 * we shouldn't skip the FM. Tricky.
-		 * Maybe use RD_FM_BCK, then do a SPACE_FWD?
-		 */
-		tpqputs(TPQD_IOCTLS, "MTBSFM not supported");
-		if ((mode_access == WRITE) && status_bytes_wr)
-			return -EACCES;
-		return -ENXIO;
-
-	case MTFSFM:
-		/* I think this is like MTFSF, except that
-		 * we shouldn't skip the FM. Tricky.
-		 * Maybe use QCMD_RD_DATA until we get a TP_FIL exception?
-		 * But then the FM will have been skipped...
-		 * Maybe use RD_FM, then RD_FM_BCK, but not all
-		 * drives will support that!
-		 */
-		tpqputs(TPQD_IOCTLS, "MTFSFM not supported");
-		if ((mode_access == WRITE) && status_bytes_wr)
-			return -EACCES;
-		return -ENXIO;
-
-	case MTEOM:
-		/* This should leave the tape ready for appending
-		 * another file to the end, such that it would append
-		 * after the last FM on tape.
-		 */
-		tpqputs(TPQD_IOCTLS, "MTEOM search for End Of recorded Media");
-		if ((mode_access == WRITE) && status_bytes_wr)
-			return -EACCES;
-		if (TP_HAVE_EOD) {
-			/* Use faster seeking when possible.
-			 * This requires the absence of data beyond the EOM.
-			 * It seems that my drive does not always perform the
-			 * SEEK_EOD correctly, unless it is preceded by a
-			 * rewind command.
-			 */
-# if 0
-			status_eom_detected = status_eof_detected = NO;
-# endif
-			stat = do_qic_cmd(QCMD_REWIND, TIM_R);
-			if (stat)
-				return stat;
-			stat = do_qic_cmd(QCMD_SEEK_EOD, TIM_F);
-			/* After a successful seek, TP_EOR should be returned */
-		} else {
-			/* else just seek until the drive returns exception "No Data" */
-			stat = 0;
-			while ((stat == 0) && (!status_eom_detected)) {
-				stat = do_qic_cmd(QCMD_RD_FM, TIM_F);	      /***** should use MTFSFM here???? ******/
-			}
-			if (tperror.exs & TP_NDT)
-				return 0;
-		}
-		return stat;
-
-	case MTERASE:
-		tpqputs(TPQD_IOCTLS, "MTERASE -- ERASE TAPE !");
-		if ((tperror.exs & TP_ST0) && (tperror.exs & TP_WRP)) {
-			tpqputs(TPQD_ALWAYS, "Cartridge is write-protected.");
-			return -EACCES;
-		} else {
-			time_t t = jiffies;
-
-			/* Plain GNU mt(1) 2.2 erases a tape in O_RDONLY. :-( */
-			if (mode_access == READ)
-				return -EACCES;
-
-			/* FIXME */
-			/* give user a few seconds to pull out tape */
-			while (jiffies - t < 4 * HZ)
-				schedule();
-		}
-
-		/* don't bother writing filemark first */
-		status_eom_detected = status_eof_detected = NO;
-		return do_qic_cmd(QCMD_ERASE, TIM_R);
-
-	case MTRAS1:
-		if (TP_HAVE_RAS1) {
-			tpqputs(TPQD_IOCTLS, "MTRAS1: non-destructive self test");
-			stat = do_qic_cmd(QCMD_SELF_TST1, TIM_R);
-			if (stat != 0) {
-				tpqputs(TPQD_ALWAYS, "RAS1 failed");
-				return stat;
-			}
-			return (tp_sense(0) == TE_OK) ? 0 : -EIO;	/* get_ext_status3(); */
-		}
-		tpqputs(TPQD_IOCTLS, "RAS1 not supported");
-		return -ENXIO;
-
-	case MTRAS2:
-		if (TP_HAVE_RAS2) {
-			tpqputs(TPQD_IOCTLS, "MTRAS2: destructive self test");
-			stat = do_qic_cmd(QCMD_SELF_TST2, TIM_R);
-			if (stat != 0) {
-				tpqputs(TPQD_ALWAYS, "RAS2 failed");
-				return stat;
-			}
-			return (tp_sense(0) == TE_OK) ? 0 : -EIO;	/* get_ext_status3(); */
-		}
-		tpqputs(TPQD_IOCTLS, "RAS2 not supported");
-		return -ENXIO;
-
-	case MTSEEK:
-		if (TP_HAVE_SEEK && (QIC02_TAPE_IFC == ARCHIVE)) {
-			tpqputs(TPQD_IOCTLS, "MTSEEK seeking block");
-			if ((mode_access == WRITE) && status_bytes_wr)
-				return -EACCES;
-			/* NOTE: address (24 bits) is in seek_addr_buf[] */
-			return do_qic_cmd(AR_QCMDV_SEEK_BLK, TIM_F);
-		} else
-			return -ENOTTY;
-
-	default:
-		return -ENOTTY;
-	}
-}				/* do_ioctl_cmd */
-
-
-/* dma_transfer(): This routine is called for every 512 bytes to be read
- * from/written to the tape controller. Speed is important here!
- * (There must be enough time left for the hd controller!)
- * The dma lock protects the DMA controller
- *
- * This routine merely does the least possible to keep
- * the transfers going:
- *	- set the DMA count register for the next 512 bytes
- *	- adjust the DMA address and page registers
- *	- adjust the timeout
- *	- tell the tape controller to start transferring
- * We assume the dma address and mode are, and remain, valid.
- */
-static inline void dma_transfer(void)
-{
-	unsigned long flags;
-
-	if (QIC02_TAPE_IFC == WANGTEK)	/* or EVEREX */
-		outb_p(WT_CTL_ONLINE, QIC02_CTL_PORT);	/* back to normal */
-	else if (QIC02_TAPE_IFC == ARCHIVE)
-		outb_p(0, AR_RESET_DMA_PORT);
-	else			/* QIC02_TAPE_IFC == MOUNTAIN */
-		outb_p(ctlbits, QIC02_CTL_PORT);
-
-
-	flags = claim_dma_lock();
-	clear_dma_ff(QIC02_TAPE_DMA);
-	set_dma_mode(QIC02_TAPE_DMA, dma_mode);
-	set_dma_addr(QIC02_TAPE_DMA, isa_virt_to_bus(buffaddr) + dma_bytes_done);
-	set_dma_count(QIC02_TAPE_DMA, TAPE_BLKSIZE);
-
-	/* start tape DMA controller */
-	if (QIC02_TAPE_IFC == WANGTEK)	/* or EVEREX */
-		outb_p(WT_CTL_DMA | WT_CTL_ONLINE, QIC02_CTL_PORT);	/* trigger DMA transfer */
-
-	else if (QIC02_TAPE_IFC == ARCHIVE) {
-		outb_p(AR_CTL_IEN | AR_CTL_DNIEN, QIC02_CTL_PORT);	/* enable interrupts again */
-		outb_p(0, AR_START_DMA_PORT);	/* start DMA transfer */
-		/* In dma_end() AR_RESET_DMA_PORT is written too. */
-
-	} else {		/* QIC02_TAPE_IFC == MOUNTAIN */
-
-		inb(MTN_R_DESELECT_DMA_PORT);
-		outb_p(ctlbits | (MTN_CTL_EXC_IEN | MTN_CTL_DNIEN),
-		       QIC02_CTL_PORT);
-		outb_p(0, MTN_W_SELECT_DMA_PORT);	/* start DMA transfer */
-		if (dma_mode == DMA_MODE_WRITE)
-			outb_p(0, MTN_W_DMA_WRITE_PORT);	/* start DMA transfer */
-	}
-
-	/* start computer DMA controller */
-	enable_dma(QIC02_TAPE_DMA);
-
-	release_dma_lock(flags);
-
-	/* block transfer should start now, jumping to the 
-	 * interrupt routine when done or an exception was detected.
-	 */
-}				/* dma_transfer */
-
-
-/* start_dma() sets a DMA transfer up between the tape controller and
- * the kernel qic02_tape_buf buffer.
- * Normally bytes_todo==dma_bytes_done at the end of a DMA transfer. If not,
- * a filemark was read, or an attempt to write beyond the End Of Tape 
- * was made. [Or some other bad thing happened.]
- * Must do a sense() before returning error.
- */
-static int start_dma(short mode, unsigned long bytes_todo)
-/* assume 'bytes_todo'>0 */
-{
-	int stat;
-
-	tpqputs(TPQD_DEBUG, "start_dma() enter");
-	TPQDEB( {printk(TPQIC02_NAME ": doing_read==%d, doing_write==%d\n",
-		      doing_read, doing_write);})
-
-	dma_bytes_done = 0;
-	dma_bytes_todo = bytes_todo;
-	status_error = NO;
-	/* dma_mode!=0 indicates that the dma controller is in use */
-	dma_mode = (mode == WRITE) ? DMA_MODE_WRITE : DMA_MODE_READ;
-
-	/* Only give READ/WRITE DATA command to tape drive if we haven't
-	 * done that already. Otherwise the drive will rewind to the beginning
-	 * of the current file on tape. Any QIC command given other than
-	 * R/W FM will break the read/write transfer cycle.
-	 * do_qic_cmd() will terminate doing_{read,write}
-	 */
-	if ((doing_read == NO) && (doing_write == NO)) {
-		/* First, we have to clear the status -- maybe remove TP_FIL???
-		 */
-
-#if 0
-		/* Next dummy get status is to make sure CNI is valid,
-		   since we're only just starting a read/write it doesn't
-		   matter some exceptions are cleared by reading the status;
-		   we're only interested in CNI and WRP. -Eddy */
-		get_status(&tperror);
-#else
-		/* TP_CNI should now be handled in open(). -Hennus */
-#endif
-
-		stat = tp_sense(((mode == WRITE) ? 0 : TP_WRP) | TP_BOM | TP_FIL);
-		if (stat != TE_OK)
-			return stat;
-
-#ifdef OBSOLETE
-		/************* not needed iff rd_status() would wait for ready!!!!!! **********/
-		if (wait_for_ready(TIM_S) != TE_OK) {	/*** not sure this is needed ***/
-			tpqputs(TPQD_ALWAYS, "wait_for_ready failed in start_dma");
-			return -EIO;
-		}
-#endif
-
-		if (QIC02_TAPE_IFC == MOUNTAIN) {
-			/* Set control bits to select ONLINE during command */
-			ctlbits |= MTN_QIC02_CTL_ONLINE;
-		}
-
-		/* Tell the controller the data direction */
-
-		/* r/w, timeout medium, check exceptions, sets status_cmd_pending. */
-		stat = send_qic02_cmd((mode == WRITE) ? QCMD_WRT_DATA : QCMD_RD_DATA, TIM_M, 0);
-		if (stat != TE_OK) {
-			printk(TPQIC02_NAME ": start_dma: init %s failed\n", (mode == WRITE) ? "write" : "read");
-			(void) tp_sense(0);
-			return stat;
-		}
-
-		/* Do this last, because sense() will clear the doing_{read,write}
-		 * flags, causing trouble next time around.
-		 */
-		if (wait_for_ready(TIM_M) != TE_OK)
-			return -EIO;
-		switch (mode) {
-		case READ:
-			doing_read = YES;
-			break;
-		case WRITE:
-			doing_write = YES;
-			break;
-		default:
-			printk(TPQIC02_NAME ": requested unknown mode %d\n", mode);
-			panic(TPQIC02_NAME ": invalid mode in start_dma()");
-		}
-
-	} else if (is_exception()) {
-		/* This is for Archive drives, to handle reads with 0 bytes
-		 * left for the last read request.
-		 *
-		 * ******** this also affects EOF/EOT handling! ************
-		 */
-		tpqputs(TPQD_ALWAYS, "detected exception in start_dma() while transfer in progress");
-		status_error = YES;
-		return TE_END;
-	}
-
-
-	status_expect_int = YES;
-
-	/* This assumes tape is already positioned, but these
-	 * semi-'intelligent' drives are unpredictable...
-	 */
-	TIMERON(TIM_M * 2);
-
-	/* initiate first data block read from/write to the tape controller */
-
-	dma_transfer();
-
-	TPQPUTS("start_dma() end");
-	return TE_OK;
-}				/* start_dma */
-
-
-/* This cleans up after the dma transfer has completed
- * (or failed). If an exception occurred, a sense()
- * must be done. If the exception was caused by a FM,
- * sense() will set `status_eof_detected' and
- * `status_eom_detected', as required.
- */
-static void end_dma(unsigned long *bytes_done)
-{
-	int stat = TE_OK;
-	unsigned long flags;
-
-	TIMEROFF;
-
-	TPQPUTS("end_dma() enter");
-
-	flags = claim_dma_lock();
-
-	disable_dma(QIC02_TAPE_DMA);
-	clear_dma_ff(QIC02_TAPE_DMA);
-
-	release_dma_lock(flags);
-
-	if (QIC02_TAPE_IFC == WANGTEK)	/* or EVEREX */
-		outb_p(WT_CTL_ONLINE, QIC02_CTL_PORT);	/* back to normal */
-	else if (QIC02_TAPE_IFC == ARCHIVE)
-		outb_p(0, AR_RESET_DMA_PORT);
-	else {			/* QIC02_TAPE_IFC == MOUNTAIN */
-		/* Clear control bits, de-select ONLINE during tp_sense */
-		ctlbits &= ~MTN_QIC02_CTL_ONLINE;
-	}
-
-	stat = wait_for_ready(TIM_M);
-	if (status_error || (stat != TE_OK)) {
-		tpqputs(TPQD_DMAX, "DMA transfer exception");
-		stat = tp_sense((dma_mode == READ) ? TP_WRP : 0);
-		/* no return here -- got to clean up first! */
-	} else {		/* if (QIC02_TAPE_IFC == MOUNTAIN) */
-		outb_p(ctlbits, QIC02_CTL_PORT);
-	}
-
-	if (QIC02_TAPE_IFC == MOUNTAIN)
-		inb(MTN_R_DESELECT_DMA_PORT);
-
-	/* take the tape controller offline */
-
-	/* finish off DMA stuff */
-
-
-	dma_mode = 0;
-	/* Note: The drive is left on-line, ready for the next
-	 * data transfer.
-	 * If the next command to the drive does not continue
-	 * the pending cycle, it must do 2 sense()s first.
-	 */
-
-	*bytes_done = dma_bytes_done;
-	status_expect_int = NO;
-	ioctl_status.mt_blkno += (dma_bytes_done / TAPE_BLKSIZE);
-
-	TPQPUTS("end_dma() exit");
-	/*** could return stat here ***/
-}				/* end_dma */
-
-/*********** Below are the (public) OS-interface procedures ***********/
-
-
-/* qic02_tape_times_out() is called when a DMA transfer doesn't complete
- * quickly enough. Usually this means there is something seriously wrong
- * with the hardware/software, but it could just be that the controller
- * has decided to do a long rewind, just when I didn't expect it.
- * Just try again.
- */
-static void qic02_tape_times_out(unsigned long dummy)
-{
-	printk("time-out in %s driver\n", TPQIC02_NAME);
-	if ((status_cmd_pending > 0) || dma_mode) {
-		/* takes tooo long, shut it down */
-		status_dead = YES;
-		status_cmd_pending = 0;
-		status_timer_on = NO;
-		status_expect_int = NO;
-		status_error = YES;
-		if (dma_mode) {
-			dma_mode = 0;	/* signal end to read/write routine */
-			wake_up(&qic02_tape_transfer);
-		}
-	}
-}				/* qic02_tape_times_out */
-
-/*
- * Interrupt handling:
- *
- * 1) Interrupt is generated iff at the end of 
- *    a 512-DMA-block transfer.
- * 2) EXCEPTION is not raised unless something 
- *    is wrong or EOT/FM is detected.
- * 3) FM EXCEPTION is set *after* the last byte has
- *    been transferred by DMA. By the time the interrupt
- *    is handled, the EXCEPTION may already be set.
- *
- * So,
- * 1) On EXCEPTION, assume data has been transferred, so
- *    continue as usual, but set a flag to indicate the
- *    exception was detected.
- *    Do a sense status when the flag is found set.
- * 2) Do not attempt to continue a transfer after an exception.
- *    [??? What about marginal blocks???????]
- */
-
-
-/* qic02_tape_interrupt() is called when the tape controller completes 
- * a DMA transfer.
- * We are not allowed to sleep here! 
- *
- * Check if the transfer was successful, check if we need to transfer
- * more. If the buffer contains enough data/is empty enough, signal the
- * read/write() thread to copy to/from user space.
- * When we are finished, set flags to indicate end, disable timer.
- * NOTE: This *must* be fast! 
- */
-static irqreturn_t qic02_tape_interrupt(int irq, void *dev_id,
-				 struct pt_regs *regs)
-{
-	int stat, r, i;
-	unsigned long flags;
-
-	TIMEROFF;
-
-	if (status_expect_int) {
-#ifdef WANT_EXTRA_FULL_DEBUGGING
-		if (TP_DIAGS(current_type))
-			printk("@");
-#endif
-		stat = inb(QIC02_STAT_PORT);	/* Knock, knock */
-		if (QIC02_TAPE_IFC == ARCHIVE) {	/* "Who's there?" */
-			if (((stat & (AR_STAT_DMADONE)) == 0) &&
-			    ((stat & (QIC02_STAT_EXCEPTION)) != 0)) {
-				TIMERCONT;
-				return IRQ_NONE;/* "Linux with IRQ sharing" */
-			}
-		}
-
-		if ((stat & QIC02_STAT_EXCEPTION) == 0) {	/* exception occurred */
-			/* Possible causes for an exception during a transfer:
-			 *      - during a write-cycle: end of tape (EW) hole detected.
-			 *      - during a read-cycle: filemark or EOD detected.
-			 *      - something went wrong
-			 * So don't continue with the next block.
-			 */
-			tpqputs(TPQD_ALWAYS, "isr: exception on tape controller");
-			printk("      status %02x\n", stat);
-			status_error = TE_EX;
-
-			dma_bytes_done += TAPE_BLKSIZE;
-
-			dma_mode = 0;	/* wake up rw() */
-			status_expect_int = NO;
-			wake_up(&qic02_tape_transfer);
-			return IRQ_HANDLED;
-		}
-		/* return if tape controller not ready, or
-		 * if dma channel hasn't finished last byte yet.
-		 */
-		r = 0;
-
-		/* Skip next ready check for Archive controller because
-		 * it may be busy reading ahead. Weird. --hhb
-		 */
-		if (QIC02_TAPE_IFC == WANGTEK)	/* I think this is a drive-dependency, not IFC -- hhb */
-			if (stat & QIC02_STAT_READY) {	/* not ready */
-				tpqputs(TPQD_ALWAYS, "isr: ? Tape controller not ready");
-				r = 1;
-			}
-
-		flags = claim_dma_lock();
-
-		if ((i = get_dma_residue(QIC02_TAPE_DMA)) != 0) {
-			printk(TPQIC02_NAME ": dma_residue == %x !!!\n", i);
-			r = 1;	/* big trouble, but can't do much about it... */
-		}
-
-		release_dma_lock(flags);
-
-		if (r)
-			return IRQ_HANDLED;
-
-		/* finish DMA cycle */
-
-		/* no errors detected, continue */
-		dma_bytes_done += TAPE_BLKSIZE;
-		if (dma_bytes_done >= dma_bytes_todo) {
-			/* finished! Wakeup rw() */
-			dma_mode = 0;
-			status_expect_int = NO;
-			TPQPUTS("isr: dma_bytes_done");
-			wake_up(&qic02_tape_transfer);
-		} else {
-			/* start next transfer, account for track-switching time */
-			mod_timer(&tp_timer, jiffies + 6 * HZ);
-			dma_transfer();
-		}
-	} else {
-		printk(TPQIC02_NAME ": Unexpected interrupt, stat == %x\n", inb(QIC02_STAT_PORT));
-	}
-	return IRQ_HANDLED;
-}				/* qic02_tape_interrupt */
-
-
-/* read/write routines:
- * This code copies between a kernel buffer and a user buffer. The 
- * actual data transfer is done using DMA and interrupts. Time-outs
- * are also used.
- *
- * When a filemark is read, we return '0 bytes read' and continue with the
- * next file after that.
- * When EOM is read, we return '0 bytes read' twice.
- * When the EOT marker is detected on writes, '0 bytes read' should be
- * returned twice. If user program does a MTNOP after that, 2 additional
- * blocks may be written.	------- FIXME: Implement this correctly  *************************************************
- *
- * Only read/writes in multiples of 512 bytes are accepted.
- * When no bytes are available, we sleep() until they are. The controller will
- * generate an interrupt, and we (should) get a wake_up() call.
- *
- * Simple buffering is used. User program should ensure that a large enough
- * buffer is used. Usually the drive does some buffering as well (something
- * like 4k or so).
- *
- * Scott S. Bertilson suggested to continue filling the user buffer, rather
- * than waste time on a context switch, when the kernel buffer fills up.
- */
-
-/*
- * Problem: tar(1) doesn't always read the entire file. Sometimes the entire file
- * has been read, but the EOF token is never returned to tar(1), simply because
- * tar(1) knows it has already read all of the data it needs. So we must use
- * open/release to reset the `reported_read_eof' flag. If we don't, the next read
- * request would return the EOF flag for the previous file.
- */
-
-static ssize_t qic02_tape_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
-{
-	int type = iminor(filp->f_dentry->d_inode);
-	unsigned short flags = filp->f_flags;
-	unsigned long bytes_todo, bytes_done, total_bytes_done = 0;
-	int stat;
-
-	if (status_zombie == YES) {
-		tpqputs(TPQD_ALWAYS, "configs not set");
-		return -ENXIO;
-	}
-
-	if (TP_DIAGS(current_type))
-		printk(TPQIC02_NAME ": request READ, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x\n", type, buf,
-		       (long) count, filp->f_pos, flags);
-
-	if (count % TAPE_BLKSIZE) {	/* Only allow mod 512 bytes at a time. */
-		tpqputs(TPQD_BLKSZ, "Wrong block size");
-		return -EINVAL;
-	}
-
-	/* Just assume everything is ok. Controller will scream if not. */
-
-	if (status_bytes_wr) {	/* Once written, no more reads, 'till after WFM. */
-		return -EACCES;
-	}
-
-	/* This is rather ugly because it has to implement a finite state
-	 * machine in order to handle the EOF situations properly.
-	 */
-	while ((signed) count >= 0) {
-		bytes_done = 0;
-		/* see how much fits in the kernel buffer */
-		bytes_todo = TPQBUF_SIZE;
-		if (bytes_todo > count) {
-			bytes_todo = count;
-		}
-
-		/* Must ensure that user program sees exactly one EOF token (==0) */
-		if (return_read_eof == YES) {
-			if (TPQDBG(DEBUG)) {
-				printk("read: return_read_eof==%d, reported_read_eof==%d, total_bytes_done==%lu\n", return_read_eof, reported_read_eof, total_bytes_done);
-			}
-
-			if (reported_read_eof == NO) {
-				/* have not yet returned EOF to user program */
-				if (total_bytes_done > 0) {
-					return total_bytes_done;	/* next time return EOF */
-				} else {
-					reported_read_eof = YES;	/* move on next time */
-					return 0;	/* return EOF */
-				}
-			} else {
-				/* Application program has already received EOF
-				 * (above), now continue with next file on tape,
-				 * if possible.
-				 * When the FM is reached, EXCEPTION is set,
-				 * causing a sense(). Subsequent read/writes will
-				 * continue after the FM.
-				 */
-		/*********** ?????????? this should check for (EOD|NDT), not EOM, 'cause we can read past EW: ************/
-				if (status_eom_detected) {
-					/* If EOM, nothing left to read, so keep returning EOFs.
-					 *** should probably set some flag to avoid clearing
-					 *** status_eom_detected through ioctls or something
-					 */
-					return 0;
-				} else {
-					/* just eof, there may be more files ahead... */
-					return_read_eof = NO;
-					reported_read_eof = NO;
-					status_eof_detected = NO;	/* reset this too */
-					/*fall through */
-				}
-			}
-		}
-
-		if (bytes_todo == 0) {
-			return total_bytes_done;
-		}
-
-		if (bytes_todo > 0) {
-			/* start reading data */
-			if (is_exception()) {
-				tpqputs(TPQD_DMAX, "is_exception() before start_dma()!");
-			}
-
-/******************************************************************
- ***** if start_dma() fails because the head is positioned 0 bytes
- ***** before the FM, (causing EXCEPTION to be set) return_read_eof should
- ***** be set to YES, and we should return total_bytes_done, rather than -ENXIO.
- ***** The app should recognize this as an EOF condition.
- ***************************************************************************/
-			stat = start_dma(READ, bytes_todo);
-			if (stat == TE_OK) {
-				/* Wait for transfer to complete, interrupt should wake us */
-				
-				wait_event(qic02_tape_transfer, dma_mode != 0);
-
-				if (status_error)
-					return_read_eof = YES;
-
-			} else if (stat != TE_END) {
-				/* should do sense() on error here */
-#if 0
-				return -ENXIO;
-#else
-				printk("Trouble: stat==%02x\n", stat);
-				return_read_eof = YES;
-		/*************** check EOF/EOT handling!!!!!! **/
-#endif
-			}
-			end_dma(&bytes_done);
-			if (bytes_done > bytes_todo) {
-				tpqputs(TPQD_ALWAYS, "read: Oops, read more bytes than requested");
-				return -EIO;
-			}
-			/* copy buffer to user-space in one go */
-			if (bytes_done > 0) {
-				if (copy_to_user(buf, buffaddr, bytes_done))
-					return -EFAULT;
-			}
-#if 1
-			/* Checks Ton's patch below */
-			if ((return_read_eof == NO)  && (status_eof_detected == YES)) {
-				printk(TPQIC02_NAME ": read(): return_read_eof=%d, status_eof_detected=YES. return_read_eof:=YES\n",
-				       return_read_eof);
-			}
-#endif
-			if ((bytes_todo != bytes_done) || (status_eof_detected == YES)) {
-				/* EOF or EOM detected. return EOF next time. */
-				return_read_eof = YES;
-			}
-
-		}
-		/* else: ignore read request for 0 bytes */
-		if (bytes_done > 0) {
-			status_bytes_rd = YES;
-			buf += bytes_done;
-			*ppos += bytes_done;
-			total_bytes_done += bytes_done;
-			count -= bytes_done;
-		}
-	}
-	tpqputs(TPQD_ALWAYS, "read request for <0 bytes");
-	return -EINVAL;
-}				/* qic02_tape_read */
-
-
-
-/* The drive detects near-EOT by means of the holes in the tape.
- * When the holes are detected, there is some space left. The drive
- * reports this as a TP_EOM exception. After clearing the exception,
- * the drive should accept two extra blocks.
- *
- * It seems there are some archiver programs that would like to use the
- * extra space for writing a continuation marker. The driver should return
- * end-of-file to the user program on writes, when the holes are detected.
- * If the user-program wants to use the extra space, it should use the
- * MTNOP ioctl() to get the generic status register and may then continue
- * writing (max 1kB).	----------- doesn't work yet...............
- *
- * EOF behaviour on writes:
- * If there is enough room, write all of the data.
- * If there is insufficient room, write as much as will fit and
- * return the amount written. If the requested amount differs from the
- * written amount, the application program should recognize that as the
- * end of file. Subsequent writes will return -ENOSPC.
- * Unless the minor bits specify a rewind-on-close, the tape will not
- * be rewound when it is full. The user-program should do that, if desired.
- * If the driver were to do that automatically, a user-program could be 
- * confused about the EOT/BOT condition after re-opening the tape device.
- *
- * Multiple volume support: Tar closes the tape device before prompting for
- * the next tape. The user may then insert a new tape and tar will open the
- * tape device again. The driver will detect an exception status in (No Cartridge)
- * and force a rewind. After that tar may continue writing.
- */
-static ssize_t qic02_tape_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
-{
-	int type = iminor(filp->f_dentry->d_inode);
-	unsigned short flags = filp->f_flags;
-	unsigned long bytes_todo, bytes_done, total_bytes_done = 0;
-
-	if (status_zombie == YES) {
-		tpqputs(TPQD_ALWAYS, "configs not set");
-		return -ENXIO;
-	}
-
-	if (TP_DIAGS(current_type)) {
-		printk(TPQIC02_NAME ": request WRITE, minor=%x, buf=%p, count=%lx, pos=%Lx, flags=%x\n",
-		       type, buf, (long) count, filp->f_pos, flags);
-	}
-
-	if (count % TAPE_BLKSIZE) {	/* only allow mod 512 bytes at a time */
-		tpqputs(TPQD_BLKSZ, "Wrong block size");
-		return -EINVAL;
-	}
-
-	if (mode_access == READ) {
-		tpqputs(TPQD_ALWAYS, "Not in write mode");
-		return -EACCES;
-	}
-
-	/* open() does a sense() and we can assume the tape isn't changed
-	 * between open() and release(), so the tperror.exs bits will still
-	 * be valid.
-	 */
-	if ((tperror.exs & TP_ST0) && (tperror.exs & TP_WRP)) {
-		tpqputs(TPQD_ALWAYS, "Cartridge is write-protected.");
-		return -EACCES;	/* don't even try when write protected */
-	}
-
-	if (doing_read == YES) {
-		terminate_read(0);
-	}
-
-	while ((signed) count >= 0) {
-		/* see how much fits in the kernel buffer */
-		bytes_done = 0;
-		bytes_todo = TPQBUF_SIZE;
-		if (bytes_todo > count) {
-			bytes_todo = count;
-		}
-
-		if (return_write_eof == YES) {
-			/* return_write_eof should be reset on reverse tape movements. */
-
-			if (reported_write_eof == NO) {
-				if (bytes_todo > 0) {
-					tpqputs(TPQD_ALWAYS, "partial write");
-					/* partial write signals EOF to user program */
-				}
-				reported_write_eof = YES;
-				return total_bytes_done;
-			} else {
-				return -ENOSPC;	/* return error */
-			}
-		}
-
-		/* Quit when done. */
-		if (bytes_todo == 0) {
-			return total_bytes_done;
-		}
-
-		/* copy from user to DMA buffer and initiate transfer. */
-		if (bytes_todo > 0) {
-			if (copy_from_user(buffaddr, buf, bytes_todo))
-				return -EFAULT;
-
-/****************** similar problem with read() at FM could happen here at EOT.
- ******************/
-
-/***** if at EOT, 0 bytes can be written. start_dma() will
- ***** fail and write() will return ENXIO error
- *****/
-			if (start_dma(WRITE, bytes_todo) != TE_OK) {
-				tpqputs(TPQD_ALWAYS, "write: start_dma() failed");
-				/* should do sense() on error here */
-				return -ENXIO;
-				/*********** FIXTHIS **************/
-			}
-
-			/* Wait for write to complete, interrupt should wake us. */
-			wait_event(qic02_tape_transfer, (status_error == 0 && dma_mode != 0));
-
-			end_dma(&bytes_done);
-			if (bytes_done > bytes_todo) {
-				tpqputs(TPQD_ALWAYS, "write: Oops, wrote more bytes than requested");
-				return -EIO;
-			}
-			/* If the dma-transfer was aborted because of an exception,
-			 * status_error will have been set in the interrupt handler.
-			 * Then end_dma() will do a sense().
-			 * If the exception was EXC_EOM, the EW-hole was encountered
-			 * and two more blocks could be written. For the time being we'll
-			 * just consider this to be the EOT.
-			 * Otherwise, something Bad happened, such as the maximum number
-			 * of block-rewrites was exceeded. [e.g. A very bad spot on tape was
-			 * encountered. Normally short dropouts are compensated for by
-			 * rewriting the block in error, up to 16 times. I'm not sure
-			 * QIC-24 drives can do this.]
-			 */
-			if (status_error) {
-				if (status_eom_detected == YES) {
-					tpqputs(TPQD_ALWAYS, "write: EW detected");
-					return_write_eof = YES;
-				} else {
-					/* probably EXC_RWA */
-					tpqputs(TPQD_ALWAYS, "write: dma: error in writing");
-					return -EIO;
-				}
-			}
-			if (bytes_todo != bytes_done) {
-				/* EOF or EOM detected. return EOT next time. */
-				return_write_eof = YES;
-			}
-		}
-		/* else: ignore write request for 0 bytes. */
-
-		if (bytes_done > 0) {
-			status_bytes_wr = YES;
-			buf += bytes_done;
-			*ppos += bytes_done;
-			total_bytes_done += bytes_done;
-			count -= bytes_done;
-		}
-	}
-
-	tpqputs(TPQD_ALWAYS, "write request for <0 bytes");
-	if (TPQDBG(DEBUG)) {
-		printk(TPQIC02_NAME ": status_bytes_wr %x, buf %p"
-		       ", total_bytes_done %lx, count %lx\n",
-		       status_bytes_wr, buf, total_bytes_done,
-		       (long) count);
-	}
-	return -EINVAL;
-}				/* qic02_tape_write */
-
-
-
-/* qic02_tape_open()
- * We allow the device to be opened, even if it is marked 'dead' because
- * we want to be able to reset the tape device without rebooting.
- * Only one open tape file at a time, except when minor=255.
- * Minor 255 is only allowed for resetting and always returns <0.
- * 
- * The density command is only allowed when TP_BOM is set. Thus, remember
- * the most recently used minor bits. When they are different from the
- * remembered values, rewind the tape and set the required density.
- * Don't rewind if the minor bits specify density 0.
- */
-
-static int qic02_tape_open(struct inode *inode, struct file *filp)
-{
-	static int qic02_tape_open_no_use_count(struct inode *,
-						struct file *);
-	int open_error;
-
-	open_error = qic02_tape_open_no_use_count(inode, filp);
-	return open_error;
-}
-
-static int qic02_tape_open_no_use_count(struct inode *inode,
-					struct file *filp)
-{
-	int type = iminor(inode);
-	unsigned short flags = filp->f_flags;
-	unsigned short dens = 0;
-	int s;
-
-
-	if (TP_DIAGS(type)) {
-		printk("qic02_tape_open: dev=tpqic2(%d), flags=%x     ",
-			type, flags);
-	}
-
-	if (type == 255) {	/* special case for resetting */
-		if (capable(CAP_SYS_ADMIN)) {
-			return (tape_reset(1) == TE_OK) ? -EAGAIN : -ENXIO;
-		} else {
-			return -EPERM;
-		}
-	}
-
-	if (status_dead == YES) {
-		/* Allow `mt reset' ioctl() even when already open()ed. */
-		return 0;
-	}
-
-	if(test_and_set_bit(0, &tape_open))
-		return -EBUSY;
-		
-	if (status_zombie == YES) {
-		/* no irq/dma/port stuff allocated yet, no reset done
-		 * yet, so return until MTSETCONFIG has been done.
-		 */
-		return 0;
-	}
-
-	status_bytes_rd = NO;
-	status_bytes_wr = NO;
-
-	return_read_eof = NO;	/********????????????????*****/
-	return_write_eof = (status_eot_detected) ? YES : NO;
-
-	/* Clear this in case user app close()d before reading EOF token */
-	status_eof_detected = NO;
-
-	reported_read_eof = NO;
-	reported_write_eof = NO;
-
-
-	switch (flags & O_ACCMODE) {
-	case O_RDONLY:
-		mode_access = READ;
-		break;
-	case O_WRONLY:		/* Fallthru... Strictly speaking this is not correct... */
-	case O_RDWR:		/* Reads are allowed as long as nothing is written */
-		mode_access = WRITE;
-		break;
-	}
-
-	/* This is to avoid tape-changed problems (TP_CNI exception).
-	 *
-	 * Since removing the cartridge will not raise an exception,
-	 * we always do a tp_sense() to make sure we have the proper
-	 * CNI status, the 2150L may need an additional sense.... - Eddy
-	 */
-	s = tp_sense(TP_WRP | TP_EOM | TP_BOM | TP_CNI | TP_EOR);
-
-	if (s == TE_OK) {
-		/* Try to clear cartridge-changed status for Archive-2150L */
-		if ((tperror.exs & TP_ST0) && (tperror.exs & TP_CNI)) {
-			s = tp_sense(TP_WRP | TP_EOM | TP_BOM | TP_CNI | TP_EOR);
-		}
-	}
-
-	if (s != TE_OK) {
-		tpqputs(TPQD_ALWAYS, "open: sense() failed");
-		clear_bit(0, &tape_open);
-		return -EIO;
-	}
-
-	/* exception bits should be up-to-date now, so check for
-	 * tape presence and exit if absent.
-	 * Even `mt stat' will fail without a tape.
-	 */
-	if ((tperror.exs & TP_ST0) && (tperror.exs & TP_CNI)) {
-		tpqputs(TPQD_ALWAYS, "No tape present.");
-		clear_bit(0, &tape_open);
-		return -EIO;
-	}
-
-	/* At this point we can assume that a tape is present and
-	 * that it will remain present until release() is called.
-	 */
-
-	/* not allowed to do QCMD_DENS_* unless tape is rewound */
-	if ((TP_DENS(type) != 0) && (TP_DENS(current_type) != TP_DENS(type))) {
-		/* force rewind if minor bits have changed,
-		 * i.e. user wants to use tape in different format.
-		 * [assuming single drive operation]
-		 */
-		if (TP_HAVE_DENS) {
-			tpqputs(TPQD_REWIND, "Density minor bits have changed. Forcing rewind.");
-			need_rewind = YES;
-		}
-	} else {
-		/* density bits still the same, but TP_DIAGS bit 
-		 * may have changed.
-		 */
-		current_type = type;
-	}
-
-	if (need_rewind == YES) {
-/***************** CHECK THIS!!!!!!!! **********/
-		s = do_qic_cmd(QCMD_REWIND, TIM_R);
-		if (s != 0) {
-			tpqputs(TPQD_ALWAYS, "open: rewind failed");
-			return -EIO;
-		}
-	}
-
-
-/* Note: After a reset command, the controller will rewind the tape
- *	 just before performing any tape movement operation! ************ SO SET need_rewind flag!!!!!
- */
-	if (status_dead == YES) {
-		tpqputs(TPQD_ALWAYS, "open: tape dead, attempting reset");
-		if (tape_reset(1) != TE_OK) {
-			return -ENXIO;
-		} else {
-			status_dead = NO;
-			if (tp_sense(~(TP_ST1 | TP_ILL)) != TE_OK) {
-				tpqputs(TPQD_ALWAYS, "open: tp_sense() failed\n");
-				status_dead = YES;	/* try reset next time */
-				return -EIO;
-			}
-		}
-	}
-
-	/* things should be ok, once we get here */
-
-
-	/* set density: only allowed when TP_BOM status bit is set,
-	 * so we must have done a rewind by now. If not, just skip over.
-	 * Only give set density command when minor bits have changed.
-	 */
-	if (TP_DENS(current_type) == TP_DENS(type)) {
-		return 0;
-	}
-
-	current_type = type;
-	need_rewind = NO;
-	if (TP_HAVE_DENS) {
-		dens = TP_DENS(type);
-	}
-
-	if (dens < sizeof(format_names) / sizeof(char *))
-		printk(TPQIC02_NAME ": format: %s%s\n", (dens != 0) ? "QIC-" : "", format_names[dens]);
-	else
-		tpqputs(TPQD_REWIND, "Wait for retensioning...");
-
-	switch (TP_DENS(type)) {
-	case 0:		/* Minor 0 is for drives without set-density support */
-		s = 0;
-		break;
-	case 1:
-		s = do_qic_cmd(QCMD_DENS_11, TIM_S);
-		break;
-	case 2:
-		s = do_qic_cmd(QCMD_DENS_24, TIM_S);
-		break;
-	case 3:
-		s = do_qic_cmd(QCMD_DENS_120, TIM_S);
-		break;
-	case 4:
-		s = do_qic_cmd(QCMD_DENS_150, TIM_S);
-		break;
-	case 5:
-		s = do_qic_cmd(QCMD_DENS_300, TIM_S);
-		break;
-	case 6:
-		s = do_qic_cmd(QCMD_DENS_600, TIM_S);
-		break;
-	default:		/* otherwise do a retension before anything else */
-		s = do_qic_cmd(QCMD_RETEN, TIM_R);
-	}
-	if (s != 0) {
-		status_dead = YES;	/* force reset */
-		current_type = 0;/* earlier 0xff80 */
-		return -EIO;
-	}
-
-	return 0;
-}				/* qic02_tape_open */
-
-
-static int qic02_tape_release(struct inode *inode, struct file *filp)
-{
-	int type = iminor(inode);
-
-	if (TP_DIAGS(type)) {
-		printk("qic02_tape_release: dev=tpqic2(%d)\n", type);
-	}
-
-	if (status_zombie == NO) {	/* don't rewind in zombie mode */
-		/* Terminate any pending write cycle. Terminating the read-cycle
-		 * is delayed until it is required to do so for a new command.
-		 */
-		terminate_write(-1);
-
-		if (status_dead == YES) {
-			tpqputs(TPQD_ALWAYS, "release: device dead!?");
-		}
-
-		/* Rewind only if minor number requires it AND 
-		 * read/writes have been done. ************* IS THIS CORRECT??????????
-		 */
-		if (TP_REWCLOSE(type) && (status_bytes_rd | status_bytes_wr)) {
-			tpqputs(TPQD_REWIND, "release: Doing rewind...");
-			(void) do_qic_cmd(QCMD_REWIND, TIM_R);
-		}
-	}
-	clear_bit(0, &tape_open);
-	return 0;
-}				/* qic02_tape_release */
-
-
-#ifdef CONFIG_QIC02_DYNCONF
-/* Set masks etc. based on the interface card type. */
-static int update_ifc_masks(int ifc)
-{
-	QIC02_TAPE_IFC = ifc;
-
-	if ((QIC02_TAPE_IFC == WANGTEK) || (QIC02_TAPE_IFC == EVEREX)) {
-		QIC02_STAT_PORT = QIC02_TAPE_PORT;
-		QIC02_CTL_PORT = QIC02_TAPE_PORT;
-		QIC02_CMD_PORT = QIC02_TAPE_PORT + 1;
-		QIC02_DATA_PORT = QIC02_TAPE_PORT + 1;
-		QIC02_STAT_READY = WT_QIC02_STAT_READY;
-		QIC02_STAT_EXCEPTION = WT_QIC02_STAT_EXCEPTION;
-		QIC02_STAT_MASK = WT_QIC02_STAT_MASK;
-
-		QIC02_STAT_RESETMASK = WT_QIC02_STAT_RESETMASK;
-		QIC02_STAT_RESETVAL = WT_QIC02_STAT_RESETVAL;
-
-		QIC02_CTL_RESET = WT_QIC02_CTL_RESET;
-		QIC02_CTL_REQUEST = WT_QIC02_CTL_REQUEST;
-
-		if (QIC02_TAPE_DMA == 3) {
-			WT_CTL_DMA = WT_CTL_DMA3;
-		} else if (QIC02_TAPE_DMA == 1) {
-			WT_CTL_DMA = WT_CTL_DMA1;
-		} else {
-			tpqputs(TPQD_ALWAYS,
-				"Unsupported or incorrect DMA channel");
-			return -EIO;
-		}
-
-		if (QIC02_TAPE_IFC == EVEREX) {
-			/* Everex is a special case for Wangtek (actually
-			 * it's the other way 'round, but I saw Wangtek first)
-			 */
-			if (QIC02_TAPE_DMA == 3) {
-				WT_CTL_DMA = WT_CTL_DMA1;
-			}
-
-			/* Fixup the kernel copy of the IFC type to that
-			 * we don't have to distinguish between Wangtek and
-			 * and Everex at runtime.
-			 */
-			QIC02_TAPE_IFC = WANGTEK;
-		}
-	} else if (QIC02_TAPE_IFC == ARCHIVE) {
-		QIC02_STAT_PORT = QIC02_TAPE_PORT + 1;
-		QIC02_CTL_PORT = QIC02_TAPE_PORT + 1;
-		QIC02_CMD_PORT = QIC02_TAPE_PORT;
-		QIC02_DATA_PORT = QIC02_TAPE_PORT;
-		QIC02_STAT_READY = AR_QIC02_STAT_READY;
-		QIC02_STAT_EXCEPTION = AR_QIC02_STAT_EXCEPTION;
-		QIC02_STAT_MASK = AR_QIC02_STAT_MASK;
-
-		QIC02_STAT_RESETMASK = AR_QIC02_STAT_RESETMASK;
-		QIC02_STAT_RESETVAL = AR_QIC02_STAT_RESETVAL;
-
-		QIC02_CTL_RESET = AR_QIC02_CTL_RESET;
-		QIC02_CTL_REQUEST = AR_QIC02_CTL_REQUEST;
-
-		if (QIC02_TAPE_DMA > 3) {
-			tpqputs(TPQD_ALWAYS,
-				"Unsupported or incorrect DMA channel");
-			return -EIO;
-		}
-	} else if (QIC02_TAPE_IFC == MOUNTAIN) {
-		QIC02_STAT_PORT = QIC02_TAPE_PORT + 1;
-		QIC02_CTL_PORT = QIC02_TAPE_PORT + 1;
-		QIC02_CMD_PORT = QIC02_TAPE_PORT;
-		QIC02_DATA_PORT = QIC02_TAPE_PORT;
-
-		QIC02_STAT_READY = MTN_QIC02_STAT_READY;
-		QIC02_STAT_EXCEPTION = MTN_QIC02_STAT_EXCEPTION;
-		QIC02_STAT_MASK = MTN_QIC02_STAT_MASK;
-
-		QIC02_STAT_RESETMASK = MTN_QIC02_STAT_RESETMASK;
-		QIC02_STAT_RESETVAL = MTN_QIC02_STAT_RESETVAL;
-
-		QIC02_CTL_RESET = MTN_QIC02_CTL_RESET;
-		QIC02_CTL_REQUEST = MTN_QIC02_CTL_REQUEST;
-
-		if (QIC02_TAPE_DMA > 3) {
-			tpqputs(TPQD_ALWAYS,
-				"Unsupported or incorrect DMA channel");
-			return -EIO;
-		}
-	} else {
-		tpqputs(TPQD_ALWAYS, "Invalid interface type");
-		return -ENXIO;
-	}
-	return qic02_get_resources();
-}				/* update_ifc_masks */
-#endif
-
-
-/* ioctl allows user programs to rewind the tape and stuff like that */
-static int qic02_tape_ioctl(struct inode *inode, struct file *filp, unsigned int iocmd, unsigned long ioarg)
-{
-	int error;
-	int c;
-	struct mtop operation;
-	unsigned char blk_addr[6];
-	struct mtpos ioctl_tell;
-	void __user *argp = (void __user *)ioarg;
-
-
-	if (TP_DIAGS(current_type))
-		printk(TPQIC02_NAME ": ioctl(%4x, %4lx)\n", iocmd, ioarg);
-
-	if (!inode)
-		return -EINVAL;
-
-	/* check iocmd first */
-
-	c = _IOC_NR(iocmd);
-
-#ifdef CONFIG_QIC02_DYNCONF
-	if (c == _IOC_NR(MTIOCGETCONFIG)) {
-		CHECK_IOC_SIZE(mtconfiginfo);
-
-		if (copy_to_user(argp, &qic02_tape_dynconf, sizeof(qic02_tape_dynconf)))
-			return -EFAULT;
-		return 0;
-	} else if (c == _IOC_NR(MTIOCSETCONFIG)) {
-		/* One should always do a MTIOCGETCONFIG first, then update
-		 * user-settings, then write back with MTIOCSETCONFIG.
-		 * The qic02conf program should re-open() the device before actual
-		 * use, to make sure everything is initialized.
-		 */
-
-		CHECK_IOC_SIZE(mtconfiginfo);
-
-		if (!capable(CAP_SYS_RAWIO))
-			return -EPERM;
-
-		if (doing_read != NO || doing_write != NO)
-			return -EBUSY;
-
-		if (status_zombie == NO)
-			qic02_release_resources();	/* and go zombie */
-
-		/* copy struct from user space to kernel space */
-		if (copy_from_user(&qic02_tape_dynconf, argp, sizeof(qic02_tape_dynconf)))
-			return -EFAULT;
-		
-		return update_ifc_masks(qic02_tape_dynconf.ifc_type);
-	}
-	if (status_zombie == YES) {
-		tpqputs(TPQD_ALWAYS, "Configs not set");
-		return -ENXIO;
-	}
-#endif
-	if (c == _IOC_NR(MTIOCTOP)) {
-		CHECK_IOC_SIZE(mtop);
-
-		/* copy mtop struct from user space to kernel space */
-		if (copy_from_user(&operation, argp, sizeof(operation)))
-			return -EFAULT;
-
-		/* ---note: mt_count is signed, negative seeks must be
-		 * ---      translated to seeks in opposite direction!
-		 * (only needed for Sun-programs, I think.)
-		 */
-		/* ---note: MTFSF with count 0 should position the
-		 * ---      tape at the beginning of the current file.
-		 */
-
-		if (TP_DIAGS(current_type))
-			printk("OP op=%4x, count=%4x\n", operation.mt_op, operation.mt_count);
-
-		if (operation.mt_count < 0)
-			tpqputs(TPQD_ALWAYS, "Warning: negative mt_count ignored");
-
-		ioctl_status.mt_resid = operation.mt_count;
-		if (operation.mt_op == MTSEEK) {
-			if (!TP_HAVE_SEEK)
-				return -ENOTTY;
-
-			seek_addr_buf[0] = (operation.mt_count >> 16) & 0xff;
-			seek_addr_buf[1] = (operation.mt_count >> 8) & 0xff;
-			seek_addr_buf[2] = (operation.mt_count) & 0xff;
-			if (operation.mt_count >> 24)
-				return -EINVAL;
-			
-			if ((error = do_ioctl_cmd(operation.mt_op)) != 0)
-				return error;
-
-			ioctl_status.mt_resid = 0;
-		} else {
-			while (operation.mt_count > 0) {
-				operation.mt_count--;
-				if ((error = do_ioctl_cmd(operation.mt_op)) != 0)
-					return error;
-
-				ioctl_status.mt_resid = operation.mt_count;
-			}
-		}
-		return 0;
-
-	} else if (c == _IOC_NR(MTIOCGET)) {
-		if (TP_DIAGS(current_type))
-			printk("GET ");
-
-		CHECK_IOC_SIZE(mtget);
-
-		/* It appears (gmt(1)) that it is normal behaviour to
-		 * first set the status with MTNOP, and then to read
-		 * it out with MTIOCGET
-		 */
-
-		/* copy results to user space */
-		if (copy_to_user(argp, &ioctl_status, sizeof(ioctl_status)))
-			return -EFAULT;
-		return 0;
-	} else if (TP_HAVE_TELL && (c == _IOC_NR(MTIOCPOS))) {
-		if (TP_DIAGS(current_type))
-			printk("POS ");
-
-		CHECK_IOC_SIZE(mtpos);
-
-		tpqputs(TPQD_IOCTLS, "MTTELL reading block address");
-		if (doing_read == YES || doing_write == YES)
-			finish_rw(AR_QCMDV_TELL_BLK);
-
-		c = rdstatus((char *) blk_addr, sizeof(blk_addr), AR_QCMDV_TELL_BLK);
-		if (c != TE_OK)
-			return -EIO;
-
-		ioctl_tell.mt_blkno = (blk_addr[3] << 16) | (blk_addr[4] << 8) | blk_addr[5];
-
-		/* copy results to user space */
-		if (copy_to_user(argp, &ioctl_tell, sizeof(ioctl_tell)))
-			return -EFAULT;
-		return 0;
-
-	} else
-		return -ENOTTY;	/* Other cmds not supported. */
-}				/* qic02_tape_ioctl */
-
-
-static ssize_t qic02_do_tape_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
-{
-	int err;
-	
-	down(&tape_op);	
-	err = qic02_tape_read(filp, buf, count, ppos);
-	up(&tape_op);
-	
-	return err;
-}
-
-static ssize_t qic02_do_tape_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
-{
-	int err;
-
-	down(&tape_op);	
-	err = qic02_tape_write(filp, buf, count, ppos);
-	up(&tape_op);
-	
-	return err;
-}
-
-static int qic02_do_tape_ioctl(struct inode *inode, struct file *filp, unsigned int iocmd, unsigned long ioarg)
-{
-	int err;
-	
-	down(&tape_op);	
-	err = qic02_tape_ioctl(inode, filp,  iocmd, ioarg);
-	up(&tape_op);
-	
-	return err;
-}
-
-/* These are (most) of the interface functions: */
-static struct file_operations qic02_tape_fops = {
-	.owner = THIS_MODULE,
-	.llseek = no_llseek,
-	.read = qic02_do_tape_read,
-	.write = qic02_do_tape_write,
-	.ioctl = qic02_do_tape_ioctl,
-	.open = qic02_tape_open,
-	.release = qic02_tape_release,
-};
-
-
-static void qic02_release_resources(void)
-{
-	free_irq(QIC02_TAPE_IRQ, NULL);
-	free_dma(QIC02_TAPE_DMA);
-	release_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE);
-	if (buffaddr)
-		free_pages((unsigned long) buffaddr, get_order(TPQBUF_SIZE));
-	buffaddr = NULL;	/* Better to cause a panic than overwite someone else */
-	status_zombie = YES;
-}				/* qic02_release_resources */
-
-
-static int qic02_get_resources(void)
-{
-	/* First perform some checks. If one of them fails,
-	 * the tape driver will not be registered to the system.
-	 */
-
-	/* for DYNCONF, allocating IO, DMA and IRQ should not be done until 
-	 * the config parameters have been set using MTSETCONFIG.
-	 */
-
-	/* Grab the IO region. */
-	if (!request_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE, TPQIC02_NAME)) {
-		printk(TPQIC02_NAME ": IO space at 0x%x [%d ports] already reserved\n",
-		       QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE);
-		return -ENXIO;
-	}
-
-	/* get IRQ */
-	if (request_irq(QIC02_TAPE_IRQ, qic02_tape_interrupt, SA_INTERRUPT, "QIC-02", NULL)) {
-		printk(TPQIC02_NAME ": can't allocate IRQ%d for QIC-02 tape\n", QIC02_TAPE_IRQ);
-		release_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE);
-		return -EBUSY;
-	}
-
-	/* After IRQ, allocate DMA channel */
-	if (request_dma(QIC02_TAPE_DMA, "QIC-02")) {
-		printk(TPQIC02_NAME ": can't allocate DMA%d for QIC-02 tape\n", QIC02_TAPE_DMA);
-		free_irq(QIC02_TAPE_IRQ, NULL);
-		release_region(QIC02_TAPE_PORT, QIC02_TAPE_PORT_RANGE);
-		return -EBUSY;
-	}
-
-	/* Setup the page-address for the dma transfer. */
-	buffaddr = (void *) __get_dma_pages(GFP_KERNEL, get_order(TPQBUF_SIZE));
-	if (!buffaddr) {
-		qic02_release_resources();
-		return -EBUSY;	/* Not ideal, EAGAIN perhaps? */
-	}
-
-	memset(buffaddr, 0, TPQBUF_SIZE);
-
-	printk(TPQIC02_NAME ": Settings: IRQ %d, DMA %d, IO 0x%x, IFC %s\n",
-	       QIC02_TAPE_IRQ, QIC02_TAPE_DMA, ((QIC02_TAPE_IFC == ARCHIVE)
-						|| (QIC02_TAPE_IFC ==
-						    MOUNTAIN)) ?
-	       QIC02_CMD_PORT : QIC02_STAT_PORT,
-	       (QIC02_TAPE_IFC ==
-		MOUNTAIN) ? "Mountain" : ((QIC02_TAPE_IFC ==
-					   ARCHIVE) ? "Archive" :
-					  "Wangtek"));
-
-	if (tape_reset(0) != TE_OK || tp_sense(TP_WRP | TP_POR | TP_CNI) != TE_OK) {
-		/* No drive detected, so vanish */
-		tpqputs(TPQD_ALWAYS, "No drive detected -- releasing IO/IRQ/DMA.");
-		status_dead = YES;
-		qic02_release_resources();
-		return -EIO;
-	}
-
-	/* All should be ok now */
-	status_zombie = NO;
-	return 0;
-}				/* qic02_get_resources */
-
-int __init qic02_tape_init(void)
-{
-	if (TPSTATSIZE != 6) {
-		printk(TPQIC02_NAME ": internal error: tpstatus struct incorrect!\n");
-		return -ENODEV;
-	}
-	if ((TPQBUF_SIZE < 512) || (TPQBUF_SIZE >= 0x10000)) {
-		printk(TPQIC02_NAME ": internal error: DMA buffer size out of range\n");
-		return -ENODEV;
-	}
-
-	current_type = 0;
-
-#ifndef CONFIG_QIC02_DYNCONF
-	printk(TPQIC02_NAME ": IRQ %d, DMA %d, IO 0x%x, IFC %s, %s, %s\n",
-	       QIC02_TAPE_IRQ, QIC02_TAPE_DMA,
-# if QIC02_TAPE_IFC == WANGTEK
-	       QIC02_STAT_PORT, "Wangtek",
-# elif QIC02_TAPE_IFC == ARCHIVE
-	       QIC02_CMD_PORT, "Archive",
-# elif QIC02_TAPE_IFC == MOUNTAIN
-	       QIC02_CMD_PORT, "Mountain",
-# else
-#  error
-# endif
-	       rcs_revision, rcs_date);
-	if (qic02_get_resources())
-		return -ENODEV;
-#else
-	printk(TPQIC02_NAME ": Runtime config, %s, %s\n", rcs_revision, rcs_date);
-#endif
-	printk(TPQIC02_NAME ": DMA buffers: %u blocks\n", NR_BLK_BUF);
-	/* If we got this far, install driver functions */
-	if (register_chrdev(QIC02_TAPE_MAJOR, TPQIC02_NAME, &qic02_tape_fops)) 
-	{
-		printk(TPQIC02_NAME ": Unable to get chrdev major %d\n", QIC02_TAPE_MAJOR);
-#ifndef CONFIG_QIC02_DYNCONF
-		qic02_release_resources();
-#endif
-		return -ENODEV;
-	}
-
-	tpqic02_class = class_simple_create(THIS_MODULE, TPQIC02_NAME);
-	class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 2), NULL, "ntpqic11");
-	devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 2),
-		       S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic11");
-	class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 3), NULL, "tpqic11");
-	devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 3),
-		       S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic11");
-
-	class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 4), NULL, "ntpqic24");
-	devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 4),
-		       S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic24");
-	class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 5), NULL, "tpqic24");
-	devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 5),
-		       S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic24");
-
-	class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 6), NULL, "ntpqic20");
-	devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 6),
-		       S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic120");
-	class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 7), NULL, "tpqic20");
-	devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 7),
-		       S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic120");
-
-	class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 8), NULL, "ntpqic50");
-	devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 8),
-		       S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "ntpqic150");
-	class_simple_device_add(tpqic02_class, MKDEV(QIC02_TAPE_MAJOR, 9), NULL, "tpqic50");
-	devfs_mk_cdev(MKDEV(QIC02_TAPE_MAJOR, 9),
-		       S_IFCHR|S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP, "tpqic150");
-
-	init_waitqueue_head(&qic02_tape_transfer);
-	/* prepare timer */
-	TIMEROFF;
-	init_timer(&tp_timer);
-	tp_timer.function = qic02_tape_times_out;
-
-#ifndef CONFIG_QIC02_DYNCONF
-	if (tape_reset(0) != TE_OK || tp_sense(TP_WRP | TP_POR | TP_CNI) != TE_OK) {
-		/* No drive detected, so vanish */
-		tpqputs(TPQD_ALWAYS, "No drive detected -- driver going on vacation...");
-		qic02_release_resources();
-		status_dead = YES;
-		return -ENODEV;
-	} else {
-		if (is_exception()) {
-			tpqputs(TPQD_ALWAYS, "exception detected\n");
-			(void) tp_sense(TP_WRP | TP_POR | TP_CNI);
-		}
-	}
-#endif
-
-	/* initialize generic status for ioctl requests */
-
-	ioctl_status.mt_type = QIC02_TAPE_DRIVE;	/* MT_IS* id nr */
-
-	ioctl_status.mt_resid = 0;	/* ---residual count */
-	ioctl_status.mt_gstat = 0;	/* ---generic status */
-	ioctl_status.mt_erreg = 0;	/* not used */
-	ioctl_status.mt_fileno = 0;	/* number of current file on tape */
-	ioctl_status.mt_blkno = 0;	/* number of current (logical) block */
-
-	return 0;
-}				/* qic02_tape_init */
-
-static void qic02_module_exit(void)
-{
-	unregister_chrdev(QIC02_TAPE_MAJOR, TPQIC02_NAME);
-	if (status_zombie == NO)
-		qic02_release_resources();
-		
-	devfs_remove("ntpqic11");
-	class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 2));
-	devfs_remove("tpqic11");
-	class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 3));
-	devfs_remove("ntpqic24");
-	class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 4));
-	devfs_remove("tpqic24");
-	class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 5));
-	devfs_remove("ntpqic120");
-	class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 6));
-	devfs_remove("tpqic120");
-	class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 7));
-	devfs_remove("ntpqic150");
-	class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 8));
-	devfs_remove("tpqic150");
-	class_simple_device_remove(MKDEV(QIC02_TAPE_MAJOR, 9));
-
-	class_simple_destroy(tpqic02_class);
-}
-
-static int qic02_module_init(void)
-{
-	int retval;
-	retval = qic02_tape_init();
-# ifdef CONFIG_QIC02_DYNCONF
-	/* This allows the dynamic config program to setup the card
-	 * by presetting qic02_tape_dynconf via insmod
-	 */
-	if (!retval && qic02_tape_dynconf.ifc_type) {
-		retval = update_ifc_masks(qic02_tape_dynconf.ifc_type);
-		if (retval) {
-			qic02_module_exit();
-		}
-	}
-# endif
-	return retval;
-}
-
-MODULE_LICENSE("GPL");
-
-module_init(qic02_module_init);
-module_exit(qic02_module_exit);
diff -Nru a/drivers/char/tty_io.c b/drivers/char/tty_io.c
--- a/drivers/char/tty_io.c	2005-02-15 11:52:21 -08:00
+++ b/drivers/char/tty_io.c	2005-03-07 20:41:34 -08:00
@@ -1789,7 +1789,6 @@
 	}
 #ifdef CONFIG_VT
 	if (device == MKDEV(TTY_MAJOR,0)) {
-		extern int fg_console;
 		extern struct tty_driver *console_driver;
 		driver = console_driver;
 		index = fg_console;
@@ -2016,11 +2015,10 @@
 		return 0;
 #ifdef CONFIG_VT
 	if (tty->driver->type == TTY_DRIVER_TYPE_CONSOLE) {
-		unsigned int currcons = tty->index;
 		int rc;
 
 		acquire_console_sem();
-		rc = vc_resize(currcons, tmp_ws.ws_col, tmp_ws.ws_row);
+		rc = vc_resize(tty->driver_data, tmp_ws.ws_col, tmp_ws.ws_row);
 		release_console_sem();
 		if (rc)
 			return -ENXIO;
diff -Nru a/drivers/char/vc_screen.c b/drivers/char/vc_screen.c
--- a/drivers/char/vc_screen.c	2005-01-10 17:29:34 -08:00
+++ b/drivers/char/vc_screen.c	2005-03-07 20:41:34 -08:00
@@ -52,14 +52,17 @@
 	int size;
 	int minor = iminor(inode);
 	int currcons = minor & 127;
+	struct vc_data *vc;
+
 	if (currcons == 0)
 		currcons = fg_console;
 	else
 		currcons--;
 	if (!vc_cons_allocated(currcons))
 		return -ENXIO;
+	vc = vc_cons[currcons].d;
 
-	size = vc_cons[currcons].d->vc_rows * vc_cons[currcons].d->vc_cols;
+	size = vc->vc_rows * vc->vc_cols;
 
 	if (minor & 128)
 		size = 2*size + HEADER_SIZE;
@@ -442,7 +445,7 @@
 		buf += orig_count;
 		pos += orig_count;
 		if (org0)
-			update_region(currcons, (unsigned long)(org0), org-org0);
+			update_region(vc, (unsigned long)(org0), org - org0);
 	}
 	*ppos += written;
 	ret = written;
diff -Nru a/drivers/char/vt.c b/drivers/char/vt.c
--- a/drivers/char/vt.c	2005-01-10 17:29:34 -08:00
+++ b/drivers/char/vt.c	2005-03-07 20:41:34 -08:00
@@ -98,8 +98,6 @@
 #include <asm/system.h>
 #include <asm/uaccess.h>
 
-#include "console_macros.h"
-
 
 const struct consw *conswitchp;
 
@@ -135,11 +133,11 @@
 #endif
 
 static int con_open(struct tty_struct *, struct file *);
-static void vc_init(unsigned int console, unsigned int rows,
+static void vc_init(struct vc_data *vc, unsigned int rows,
 		    unsigned int cols, int do_clear);
 static void gotoxy(struct vc_data *vc, int new_x, int new_y);
-static void save_cur(int currcons);
-static void reset_terminal(int currcons, int do_clear);
+static void save_cur(struct vc_data *vc);
+static void reset_terminal(struct vc_data *vc, int do_clear);
 static void con_flush_chars(struct tty_struct *tty);
 static void set_vesa_blanking(char __user *p);
 static void set_cursor(struct vc_data *vc);
@@ -214,17 +212,12 @@
  *	Low-Level Functions
  */
 
-#define IS_FG			(currcons == fg_console)
-#define IS_FG_VC(vc)		(vc == vc_cons[fg_console].d)
-
-#define IS_VISIBLE CON_IS_VISIBLE(vc_cons[currcons].d)
+#define IS_FG(vc)	((vc)->vc_num == fg_console)
 
 #ifdef VT_BUF_VRAM_ONLY
-#define DO_UPDATE		0
-#define DO_UPDATE_VC(vc)	0
+#define DO_UPDATE(vc)	0
 #else
-#define DO_UPDATE 		IS_VISIBLE
-#define DO_UPDATE_VC(vc)	CON_IS_VISIBLE(vc)
+#define DO_UPDATE(vc)	CON_IS_VISIBLE(vc)
 #endif
 
 static int pm_con_request(struct pm_dev *dev, pm_request_t rqst, void *data);
@@ -254,39 +247,38 @@
 	schedule_work(&console_work);
 }
 
-static void scrup(int currcons, unsigned int t, unsigned int b, int nr)
+static void scrup(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
 {
 	unsigned short *d, *s;
 
 	if (t+nr >= b)
 		nr = b - t - 1;
-	if (b > vc_cons[currcons].d->vc_rows || t >= b || nr < 1)
+	if (b > vc->vc_rows || t >= b || nr < 1)
 		return;
-	if (IS_VISIBLE && sw->con_scroll(vc_cons[currcons].d, t, b, SM_UP, nr))
+	if (CON_IS_VISIBLE(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_UP, nr))
 		return;
-	d = (unsigned short *) (origin+vc_cons[currcons].d->vc_size_row*t);
-	s = (unsigned short *) (origin+vc_cons[currcons].d->vc_size_row*(t+nr));
-	scr_memmovew(d, s, (b-t-nr) * vc_cons[currcons].d->vc_size_row);
-	scr_memsetw(d + (b-t-nr) * vc_cons[currcons].d->vc_cols, video_erase_char,
-			vc_cons[currcons].d->vc_size_row * nr);
+	d = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t);
+	s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * (t + nr));
+	scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row);
+	scr_memsetw(d + (b - t - nr) * vc->vc_cols, vc->vc_video_erase_char,
+		    vc->vc_size_row * nr);
 }
 
-static void
-scrdown(int currcons, unsigned int t, unsigned int b, int nr)
+static void scrdown(struct vc_data *vc, unsigned int t, unsigned int b, int nr)
 {
 	unsigned short *s;
 	unsigned int step;
 
 	if (t+nr >= b)
 		nr = b - t - 1;
-	if (b > vc_cons[currcons].d->vc_rows || t >= b || nr < 1)
+	if (b > vc->vc_rows || t >= b || nr < 1)
 		return;
-	if (IS_VISIBLE && sw->con_scroll(vc_cons[currcons].d, t, b, SM_DOWN, nr))
+	if (CON_IS_VISIBLE(vc) && vc->vc_sw->con_scroll(vc, t, b, SM_DOWN, nr))
 		return;
-	s = (unsigned short *) (origin+vc_cons[currcons].d->vc_size_row*t);
-	step = vc_cons[currcons].d->vc_cols * nr;
-	scr_memmovew(s + step, s, (b-t-nr)*vc_cons[currcons].d->vc_size_row);
-	scr_memsetw(s, video_erase_char, 2*step);
+	s = (unsigned short *)(vc->vc_origin + vc->vc_size_row * t);
+	step = vc->vc_cols * nr;
+	scr_memmovew(s + step, s, (b - t - nr) * vc->vc_size_row);
+	scr_memsetw(s, vc->vc_video_erase_char, 2 * step);
 }
 
 static void do_update_region(struct vc_data *vc, unsigned long start, int count)
@@ -335,23 +327,23 @@
 #endif
 }
 
-void update_region(int currcons, unsigned long start, int count)
+void update_region(struct vc_data *vc, unsigned long start, int count)
 {
 	WARN_CONSOLE_UNLOCKED();
 
-	if (DO_UPDATE) {
-		hide_cursor(vc_cons[currcons].d);
-		do_update_region(vc_cons[currcons].d, start, count);
-		set_cursor(vc_cons[currcons].d);
+	if (DO_UPDATE(vc)) {
+		hide_cursor(vc);
+		do_update_region(vc, start, count);
+		set_cursor(vc);
 	}
 }
 
 /* Structure of attributes is hardware-dependent */
 
-static u8 build_attr(int currcons, u8 _color, u8 _intensity, u8 _blink, u8 _underline, u8 _reverse)
+static u8 build_attr(struct vc_data *vc, u8 _color, u8 _intensity, u8 _blink, u8 _underline, u8 _reverse)
 {
-	if (sw->con_build_attr)
-		return sw->con_build_attr(vc_cons[currcons].d, _color, _intensity, _blink, _underline, _reverse);
+	if (vc->vc_sw->con_build_attr)
+		return vc->vc_sw->con_build_attr(vc, _color, _intensity, _blink, _underline, _reverse);
 
 #ifndef VT_BUF_VRAM_ONLY
 /*
@@ -365,23 +357,23 @@
  *  Bit 7   : blink
  */
 	{
-	u8 a = color;
-	if (!vc_cons[currcons].d->vc_can_do_color)
+	u8 a = vc->vc_color;
+	if (!vc->vc_can_do_color)
 		return _intensity |
 		       (_underline ? 4 : 0) |
 		       (_reverse ? 8 : 0) |
 		       (_blink ? 0x80 : 0);
 	if (_underline)
-		a = (a & 0xf0) | ulcolor;
+		a = (a & 0xf0) | vc->vc_ulcolor;
 	else if (_intensity == 0)
-		a = (a & 0xf0) | halfcolor;
+		a = (a & 0xf0) | vc->vc_ulcolor;
 	if (_reverse)
 		a = ((a) & 0x88) | ((((a) >> 4) | ((a) << 4)) & 0x77);
 	if (_blink)
 		a ^= 0x80;
 	if (_intensity == 2)
 		a ^= 0x08;
-	if (hi_font_mask == 0x100)
+	if (vc->vc_hi_font_mask == 0x100)
 		a <<= 1;
 	return a;
 	}
@@ -390,10 +382,10 @@
 #endif
 }
 
-static void update_attr(int currcons)
+static void update_attr(struct vc_data *vc)
 {
-	attr = build_attr(currcons, color, intensity, blink, underline, reverse ^ decscnm);
-	video_erase_char = (build_attr(currcons, color, 1, blink, 0, decscnm) << 8) | ' ';
+	vc->vc_attr = build_attr(vc, vc->vc_color, vc->vc_intensity, vc->vc_blink, vc->vc_underline, vc->vc_reverse ^ vc->vc_decscnm);
+	vc->vc_video_erase_char = (build_attr(vc, vc->vc_color, 1, vc->vc_blink, 0, vc->vc_decscnm) << 8) | ' ';
 }
 
 /* Note: inverting the screen twice should revert to the original state */
@@ -437,7 +429,7 @@
 		}
 	}
 #endif
-	if (DO_UPDATE_VC(vc))
+	if (DO_UPDATE(vc))
 		do_update_region(vc, (unsigned long) p, count);
 }
 
@@ -452,7 +444,7 @@
 
 	if (p) {
 		scr_writew(old, p);
-		if (DO_UPDATE_VC(vc))
+		if (DO_UPDATE(vc))
 			vc->vc_sw->con_putc(vc, old, oldy, oldx);
 	}
 	if (offset == -1)
@@ -463,7 +455,7 @@
 		old = scr_readw(p);
 		new = old ^ vc->vc_complement_mask;
 		scr_writew(new, p);
-		if (DO_UPDATE_VC(vc)) {
+		if (DO_UPDATE(vc)) {
 			oldx = (offset >> 1) % vc->vc_cols;
 			oldy = (offset >> 1) / vc->vc_cols;
 			vc->vc_sw->con_putc(vc, new, oldy, oldx);
@@ -471,48 +463,46 @@
 	}
 }
 
-static void insert_char(int currcons, unsigned int nr)
+static void insert_char(struct vc_data *vc, unsigned int nr)
 {
-	unsigned short *p, *q = (unsigned short *) pos;
+	unsigned short *p, *q = (unsigned short *)vc->vc_pos;
 
-	p = q + vc_cons[currcons].d->vc_cols - nr - x;
+	p = q + vc->vc_cols - nr - vc->vc_x;
 	while (--p >= q)
 		scr_writew(scr_readw(p), p + nr);
-	scr_memsetw(q, video_erase_char, nr*2);
-	need_wrap = 0;
-	if (DO_UPDATE) {
-		unsigned short oldattr = attr;
-		sw->con_bmove(vc_cons[currcons].d,y,x,y,x+nr,1,
-			      vc_cons[currcons].d->vc_cols-x-nr);
-		attr = video_erase_char >> 8;
+	scr_memsetw(q, vc->vc_video_erase_char, nr * 2);
+	vc->vc_need_wrap = 0;
+	if (DO_UPDATE(vc)) {
+		unsigned short oldattr = vc->vc_attr;
+		vc->vc_sw->con_bmove(vc, vc->vc_y, vc->vc_x, vc->vc_y, vc->vc_x + nr, 1,
+				     vc->vc_cols - vc->vc_x - nr);
+		vc->vc_attr = vc->vc_video_erase_char >> 8;
 		while (nr--)
-			sw->con_putc(vc_cons[currcons].d,
-				     video_erase_char,y,x+nr);
-		attr = oldattr;
+			vc->vc_sw->con_putc(vc, vc->vc_video_erase_char, vc->vc_y, vc->vc_x + nr);
+		vc->vc_attr = oldattr;
 	}
 }
 
-static void delete_char(int currcons, unsigned int nr)
+static void delete_char(struct vc_data *vc, unsigned int nr)
 {
-	unsigned int i = x;
-	unsigned short *p = (unsigned short *) pos;
+	unsigned int i = vc->vc_x;
+	unsigned short *p = (unsigned short *)vc->vc_pos;
 
-	while (++i <= vc_cons[currcons].d->vc_cols - nr) {
+	while (++i <= vc->vc_cols - nr) {
 		scr_writew(scr_readw(p+nr), p);
 		p++;
 	}
-	scr_memsetw(p, video_erase_char, nr*2);
-	need_wrap = 0;
-	if (DO_UPDATE) {
-		unsigned short oldattr = attr;
-		sw->con_bmove(vc_cons[currcons].d, y, x+nr, y, x, 1,
-			      vc_cons[currcons].d->vc_cols-x-nr);
-		attr = video_erase_char >> 8;
+	scr_memsetw(p, vc->vc_video_erase_char, nr * 2);
+	vc->vc_need_wrap = 0;
+	if (DO_UPDATE(vc)) {
+		unsigned short oldattr = vc->vc_attr;
+		vc->vc_sw->con_bmove(vc, vc->vc_y, vc->vc_x + nr, vc->vc_y, vc->vc_x, 1,
+				     vc->vc_cols - vc->vc_x - nr);
+		vc->vc_attr = vc->vc_video_erase_char >> 8;
 		while (nr--)
-			sw->con_putc(vc_cons[currcons].d,
-				     video_erase_char, y,
-				     vc_cons[currcons].d->vc_cols-1-nr);
-		attr = oldattr;
+			vc->vc_sw->con_putc(vc, vc->vc_video_erase_char, vc->vc_y,
+				     vc->vc_cols - 1 - nr);
+		vc->vc_attr = oldattr;
 	}
 }
 
@@ -531,7 +521,7 @@
 	if ((type & 0x20) && ((softcursor_original & 0x7000) == (i & 0x7000))) i ^= 0x7000;
 	if ((type & 0x40) && ((i & 0x700) == ((i & 0x7000) >> 4))) i ^= 0x0700;
 	scr_writew(i, (u16 *) vc->vc_pos);
-	if (DO_UPDATE_VC(vc))
+	if (DO_UPDATE(vc))
 		vc->vc_sw->con_putc(vc, i, vc->vc_y, vc->vc_x);
 }
 
@@ -539,7 +529,7 @@
 {
 	if (softcursor_original != -1) {
 		scr_writew(softcursor_original, (u16 *)vc->vc_pos);
-		if (DO_UPDATE_VC(vc))
+		if (DO_UPDATE(vc))
 			vc->vc_sw->con_putc(vc, softcursor_original,
 					vc->vc_y, vc->vc_x);
 		softcursor_original = -1;
@@ -556,8 +546,8 @@
 
 static void set_cursor(struct vc_data *vc)
 {
-	if (!IS_FG_VC(vc) || console_blanked ||
-	    vc->vc_vt->vc_mode == KD_GRAPHICS)
+	if (!IS_FG(vc) || console_blanked ||
+	    vc->vc_mode == KD_GRAPHICS)
 		return;
 	if (vc->vc_deccm) {
 		if (vc == sel_cons)
@@ -569,98 +559,93 @@
 		hide_cursor(vc);
 }
 
-static void set_origin(int currcons)
+static void set_origin(struct vc_data *vc)
 {
 	WARN_CONSOLE_UNLOCKED();
 
-	if (!IS_VISIBLE ||
-	    !sw->con_set_origin ||
-	    !sw->con_set_origin(vc_cons[currcons].d))
-		origin = (unsigned long) screenbuf;
-	visible_origin = origin;
-	scr_end = origin + screenbuf_size;
-	pos = origin + vc_cons[currcons].d->vc_size_row*y + 2*x;
+	if (!CON_IS_VISIBLE(vc) ||
+	    !vc->vc_sw->con_set_origin ||
+	    !vc->vc_sw->con_set_origin(vc))
+		vc->vc_origin = (unsigned long)vc->vc_screenbuf;
+	vc->vc_visible_origin = vc->vc_origin;
+	vc->vc_scr_end = vc->vc_origin + vc->vc_screenbuf_size;
+	vc->vc_pos = vc->vc_origin + vc->vc_size_row * vc->vc_y + 2 * vc->vc_x;
 }
 
-static inline void save_screen(int currcons)
+static inline void save_screen(struct vc_data *vc)
 {
 	WARN_CONSOLE_UNLOCKED();
 
-	if (sw->con_save_screen)
-		sw->con_save_screen(vc_cons[currcons].d);
+	if (vc->vc_sw->con_save_screen)
+		vc->vc_sw->con_save_screen(vc);
 }
 
 /*
  *	Redrawing of screen
  */
 
-static void clear_buffer_attributes(int currcons)
+static void clear_buffer_attributes(struct vc_data *vc)
 {
-	unsigned short *p = (unsigned short *) origin;
-	int count = screenbuf_size/2;
-	int mask = hi_font_mask | 0xff;
+	unsigned short *p = (unsigned short *)vc->vc_origin;
+	int count = vc->vc_screenbuf_size / 2;
+	int mask = vc->vc_hi_font_mask | 0xff;
 
 	for (; count > 0; count--, p++) {
-		scr_writew((scr_readw(p)&mask) | (video_erase_char&~mask), p);
+		scr_writew((scr_readw(p)&mask) | (vc->vc_video_erase_char & ~mask), p);
 	}
 }
 
-void redraw_screen(int new_console, int is_switch)
+void redraw_screen(struct vc_data *vc, int is_switch)
 {
-	int redraw = 1;
-	int currcons, old_console;
+	int redraw = 0;
 
 	WARN_CONSOLE_UNLOCKED();
 
-	if (!vc_cons_allocated(new_console)) {
+	if (!vc) {
 		/* strange ... */
 		/* printk("redraw_screen: tty %d not allocated ??\n", new_console+1); */
 		return;
 	}
 
 	if (is_switch) {
-		currcons = fg_console;
-		hide_cursor(vc_cons[currcons].d);
-		if (fg_console != new_console) {
-			struct vc_data **display = vc_cons[new_console].d->vc_display_fg;
-			old_console = (*display) ? (*display)->vc_num : fg_console;
-			*display = vc_cons[new_console].d;
-			fg_console = new_console;
-			currcons = old_console;
-			if (!IS_VISIBLE) {
-				save_screen(currcons);
-				set_origin(currcons);
-			}
-			currcons = new_console;
-			if (old_console == new_console)
-				redraw = 0;
+		struct vc_data *old_vc = vc_cons[fg_console].d;
+		if (old_vc == vc)
+			return;
+		if (!CON_IS_VISIBLE(vc))
+			redraw = 1;
+		*vc->vc_display_fg = vc;
+		fg_console = vc->vc_num;
+		hide_cursor(old_vc);
+		if (!CON_IS_VISIBLE(old_vc)) {
+			save_screen(old_vc);
+			set_origin(old_vc);
 		}
 	} else {
-		currcons = new_console;
-		hide_cursor(vc_cons[currcons].d);
+		hide_cursor(vc);
+		redraw = 1;
 	}
 
 	if (redraw) {
 		int update;
-		int old_was_color = vc_cons[currcons].d->vc_can_do_color;
+		int old_was_color = vc->vc_can_do_color;
 
-		set_origin(currcons);
-		update = sw->con_switch(vc_cons[currcons].d);
-		set_palette(currcons);
+		set_origin(vc);
+		update = vc->vc_sw->con_switch(vc);
+		set_palette(vc);
 		/*
 		 * If console changed from mono<->color, the best we can do
 		 * is to clear the buffer attributes. As it currently stands,
 		 * rebuilding new attributes from the old buffer is not doable
 		 * without overly complex code.
 		 */
-		if (old_was_color != vc_cons[currcons].d->vc_can_do_color) {
-			update_attr(currcons);
-			clear_buffer_attributes(currcons);
+		if (old_was_color != vc->vc_can_do_color) {
+			update_attr(vc);
+			clear_buffer_attributes(vc);
 		}
-		if (update && vcmode != KD_GRAPHICS)
-			do_update_region(vc_cons[currcons].d, origin, screenbuf_size/2);
+		if (update && vc->vc_mode != KD_GRAPHICS)
+			do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2);
 	}
-	set_cursor(vc_cons[currcons].d);
+	set_cursor(vc);
 	if (is_switch) {
 		set_leds();
 		compute_shiftstate();
@@ -676,31 +661,30 @@
 	return (i < MAX_NR_CONSOLES && vc_cons[i].d);
 }
 
-static void visual_init(int currcons, int init)
+static void visual_init(struct vc_data *vc, int num, int init)
 {
-    /* ++Geert: sw->con_init determines console size */
-    if (sw)
-	module_put(sw->owner);
-    sw = conswitchp;
+	/* ++Geert: vc->vc_sw->con_init determines console size */
+	if (vc->vc_sw)
+		module_put(vc->vc_sw->owner);
+	vc->vc_sw = conswitchp;
 #ifndef VT_SINGLE_DRIVER
-    if (con_driver_map[currcons])
-	sw = con_driver_map[currcons];
+	if (con_driver_map[num])
+		vc->vc_sw = con_driver_map[num];
 #endif
-    __module_get(sw->owner);
-    cons_num = currcons;
-    display_fg = &master_display_fg;
-    vc_cons[currcons].d->vc_uni_pagedir_loc = &vc_cons[currcons].d->vc_uni_pagedir;
-    vc_cons[currcons].d->vc_uni_pagedir = 0;
-    hi_font_mask = 0;
-    complement_mask = 0;
-    vc_cons[currcons].d->vc_can_do_color = 0;
-    sw->con_init(vc_cons[currcons].d, init);
-    if (!complement_mask)
-        complement_mask =
-		vc_cons[currcons].d->vc_can_do_color ? 0x7700 : 0x0800;
-    s_complement_mask = complement_mask;
-    vc_cons[currcons].d->vc_size_row = vc_cons[currcons].d->vc_cols<<1;
-    screenbuf_size = vc_cons[currcons].d->vc_rows * vc_cons[currcons].d->vc_size_row;
+	__module_get(vc->vc_sw->owner);
+	vc->vc_num = num;
+	vc->vc_display_fg = &master_display_fg;
+	vc->vc_uni_pagedir_loc = &vc->vc_uni_pagedir;
+	vc->vc_uni_pagedir = 0;
+	vc->vc_hi_font_mask = 0;
+	vc->vc_complement_mask = 0;
+	vc->vc_can_do_color = 0;
+	vc->vc_sw->con_init(vc, init);
+	if (!vc->vc_complement_mask)
+		vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
+	vc->vc_s_complement_mask = vc->vc_complement_mask;
+	vc->vc_size_row = vc->vc_cols << 1;
+	vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row;
 }
 
 int vc_allocate(unsigned int currcons)	/* return 0 on success */
@@ -710,7 +694,7 @@
 	if (currcons >= MAX_NR_CONSOLES)
 		return -ENXIO;
 	if (!vc_cons[currcons].d) {
-	    long p, q;
+	    struct vc_data *vc;
 
 	    /* prevent users from taking too much memory */
 	    if (currcons >= MAX_NR_USER_CONSOLES && !capable(CAP_SYS_RESOURCE))
@@ -722,26 +706,22 @@
 	    /* although the numbers above are not valid since long ago, the
 	       point is still up-to-date and the comment still has its value
 	       even if only as a historical artifact.  --mj, July 1998 */
-	    p = (long) kmalloc(structsize, GFP_KERNEL);
-	    if (!p)
+	    vc = kmalloc(sizeof(struct vc_data), GFP_KERNEL);
+	    if (!vc)
 		return -ENOMEM;
-	    memset((void *)p, 0, structsize);
-	    vc_cons[currcons].d = (struct vc_data *)p;
-	    vt_cons[currcons] = (struct vt_struct *)(p+sizeof(struct vc_data));
-	    vc_cons[currcons].d->vc_vt = vt_cons[currcons];
-	    visual_init(currcons, 1);
-	    if (!*vc_cons[currcons].d->vc_uni_pagedir_loc)
-		con_set_default_unimap(currcons);
-	    q = (long)kmalloc(screenbuf_size, GFP_KERNEL);
-	    if (!q) {
-		kfree((char *) p);
+	    memset(vc, 0, sizeof(*vc));
+	    vc_cons[currcons].d = vc;
+	    visual_init(vc, currcons, 1);
+	    if (!*vc->vc_uni_pagedir_loc)
+		con_set_default_unimap(vc);
+	    vc->vc_screenbuf = kmalloc(vc->vc_screenbuf_size, GFP_KERNEL);
+	    if (!vc->vc_screenbuf) {
+		kfree(vc);
 		vc_cons[currcons].d = NULL;
-		vt_cons[currcons] = NULL;
 		return -ENOMEM;
 	    }
-	    screenbuf = (unsigned short *) q;
-	    kmalloced = 1;
-	    vc_init(currcons, vc_cons[currcons].d->vc_rows, vc_cons[currcons].d->vc_cols, 1);
+	    vc->vc_kmalloced = 1;
+	    vc_init(vc, vc->vc_rows, vc->vc_cols, 1);
 
 	    if (!pm_con) {
 		    pm_con = pm_register(PM_SYS_DEV,
@@ -752,13 +732,13 @@
 	return 0;
 }
 
-inline int resize_screen(int currcons, int width, int height)
+inline int resize_screen(struct vc_data *vc, int width, int height)
 {
 	/* Resizes the resolution of the display adapater */
 	int err = 0;
 
-	if (vcmode != KD_GRAPHICS && sw->con_resize)
-		err = sw->con_resize(vc_cons[currcons].d, width, height);
+	if (vc->vc_mode != KD_GRAPHICS && vc->vc_sw->con_resize)
+		err = vc->vc_sw->con_resize(vc, width, height);
 	return err;
 }
 
@@ -769,7 +749,7 @@
  */
 #define VC_RESIZE_MAXCOL (32767)
 #define VC_RESIZE_MAXROW (32767)
-int vc_resize(int currcons, unsigned int cols, unsigned int lines)
+int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines)
 {
 	unsigned long old_origin, new_origin, new_scr_end, rlth, rrem, err = 0;
 	unsigned int old_cols, old_rows, old_row_size, old_screen_size;
@@ -778,87 +758,87 @@
 
 	WARN_CONSOLE_UNLOCKED();
 
-	if (!vc_cons_allocated(currcons))
+	if (!vc)
 		return -ENXIO;
 
 	if (cols > VC_RESIZE_MAXCOL || lines > VC_RESIZE_MAXROW)
 		return -EINVAL;
 
-	new_cols = (cols ? cols : vc_cons[currcons].d->vc_cols);
-	new_rows = (lines ? lines : vc_cons[currcons].d->vc_rows);
+	new_cols = (cols ? cols : vc->vc_cols);
+	new_rows = (lines ? lines : vc->vc_rows);
 	new_row_size = new_cols << 1;
 	new_screen_size = new_row_size * new_rows;
 
-	if (new_cols == vc_cons[currcons].d->vc_cols && new_rows == vc_cons[currcons].d->vc_rows)
+	if (new_cols == vc->vc_cols && new_rows == vc->vc_rows)
 		return 0;
 
 	newscreen = (unsigned short *) kmalloc(new_screen_size, GFP_USER);
 	if (!newscreen)
 		return -ENOMEM;
 
-	old_rows = vc_cons[currcons].d->vc_rows;
-	old_cols = vc_cons[currcons].d->vc_cols;
-	old_row_size = vc_cons[currcons].d->vc_size_row;
-	old_screen_size = screenbuf_size;
+	old_rows = vc->vc_rows;
+	old_cols = vc->vc_cols;
+	old_row_size = vc->vc_size_row;
+	old_screen_size = vc->vc_screenbuf_size;
 
-	err = resize_screen(currcons, new_cols, new_rows);
+	err = resize_screen(vc, new_cols, new_rows);
 	if (err) {
 		kfree(newscreen);
 		return err;
 	}
 
-	vc_cons[currcons].d->vc_rows = new_rows;
-	vc_cons[currcons].d->vc_cols = new_cols;
-	vc_cons[currcons].d->vc_size_row = new_row_size;
-	screenbuf_size = new_screen_size;
+	vc->vc_rows = new_rows;
+	vc->vc_cols = new_cols;
+	vc->vc_size_row = new_row_size;
+	vc->vc_screenbuf_size = new_screen_size;
 
 	rlth = min(old_row_size, new_row_size);
 	rrem = new_row_size - rlth;
-	old_origin = origin;
+	old_origin = vc->vc_origin;
 	new_origin = (long) newscreen;
 	new_scr_end = new_origin + new_screen_size;
 	if (new_rows < old_rows)
 		old_origin += (old_rows - new_rows) * old_row_size;
 
-	update_attr(currcons);
+	update_attr(vc);
 
-	while (old_origin < scr_end) {
+	while (old_origin < vc->vc_scr_end) {
 		scr_memcpyw((unsigned short *) new_origin, (unsigned short *) old_origin, rlth);
 		if (rrem)
-			scr_memsetw((void *)(new_origin + rlth), video_erase_char, rrem);
+			scr_memsetw((void *)(new_origin + rlth), vc->vc_video_erase_char, rrem);
 		old_origin += old_row_size;
 		new_origin += new_row_size;
 	}
 	if (new_scr_end > new_origin)
-		scr_memsetw((void *) new_origin, video_erase_char, new_scr_end - new_origin);
-	if (kmalloced)
-		kfree(screenbuf);
-	screenbuf = newscreen;
-	kmalloced = 1;
-	screenbuf_size = new_screen_size;
-	set_origin(currcons);
+		scr_memsetw((void *)new_origin, vc->vc_video_erase_char, new_scr_end - new_origin);
+	if (vc->vc_kmalloced)
+		kfree(vc->vc_screenbuf);
+	vc->vc_screenbuf = newscreen;
+	vc->vc_kmalloced = 1;
+	vc->vc_screenbuf_size = new_screen_size;
+	set_origin(vc);
 
 	/* do part of a reset_terminal() */
-	top = 0;
-	bottom = vc_cons[currcons].d->vc_rows;
-	gotoxy(vc_cons[currcons].d, x, y);
-	save_cur(currcons);
+	vc->vc_top = 0;
+	vc->vc_bottom = vc->vc_rows;
+	gotoxy(vc, vc->vc_x, vc->vc_y);
+	save_cur(vc);
 
-	if (vc_cons[currcons].d->vc_tty) {
-		struct winsize ws, *cws = &vc_cons[currcons].d->vc_tty->winsize;
+	if (vc->vc_tty) {
+		struct winsize ws, *cws = &vc->vc_tty->winsize;
 
 		memset(&ws, 0, sizeof(ws));
-		ws.ws_row = vc_cons[currcons].d->vc_rows;
-		ws.ws_col = vc_cons[currcons].d->vc_cols;
-		ws.ws_ypixel = video_scan_lines;
+		ws.ws_row = vc->vc_rows;
+		ws.ws_col = vc->vc_cols;
+		ws.ws_ypixel = vc->vc_scan_lines;
 		if ((ws.ws_row != cws->ws_row || ws.ws_col != cws->ws_col) &&
-		    vc_cons[currcons].d->vc_tty->pgrp > 0)
-			kill_pg(vc_cons[currcons].d->vc_tty->pgrp, SIGWINCH, 1);
+		    vc->vc_tty->pgrp > 0)
+			kill_pg(vc->vc_tty->pgrp, SIGWINCH, 1);
 		*cws = ws;
 	}
 
-	if (IS_VISIBLE)
-		update_screen(currcons);
+	if (CON_IS_VISIBLE(vc))
+		update_screen(vc);
 	return err;
 }
 
@@ -868,12 +848,13 @@
 	WARN_CONSOLE_UNLOCKED();
 
 	if (vc_cons_allocated(currcons)) {
-	    sw->con_deinit(vc_cons[currcons].d);
-	    if (kmalloced)
-		kfree(screenbuf);
-	    if (currcons >= MIN_NR_CONSOLES)
-		kfree(vc_cons[currcons].d);
-	    vc_cons[currcons].d = NULL;
+		struct vc_data *vc = vc_cons[currcons].d;
+		vc->vc_sw->con_deinit(vc);
+		if (vc->vc_kmalloced)
+			kfree(vc->vc_screenbuf);
+		if (currcons >= MIN_NR_CONSOLES)
+			kfree(vc);
+		vc_cons[currcons].d = NULL;
 	}
 }
 
@@ -881,9 +862,9 @@
  *	VT102 emulator
  */
 
-#define set_kbd(x) set_vc_kbd_mode(kbd_table+currcons,x)
-#define clr_kbd(x) clr_vc_kbd_mode(kbd_table+currcons,x)
-#define is_kbd(x) vc_kbd_mode(kbd_table+currcons,x)
+#define set_kbd(vc, x)	set_vc_kbd_mode(kbd_table + (vc)->vc_num, (x))
+#define clr_kbd(vc, x)	clr_vc_kbd_mode(kbd_table + (vc)->vc_num, (x))
+#define is_kbd(vc, x)	vc_kbd_mode(kbd_table + (vc)->vc_num, (x))
 
 #define decarm		VC_REPEAT
 #define decckm		VC_CKMODE
@@ -943,272 +924,268 @@
 }
 
 /* for absolute user moves, when decom is set */
-static void gotoxay(int currcons, int new_x, int new_y)
+static void gotoxay(struct vc_data *vc, int new_x, int new_y)
 {
-	gotoxy(vc_cons[currcons].d, new_x, decom ? (top+new_y) : new_y);
+	gotoxy(vc, new_x, vc->vc_decom ? (vc->vc_top + new_y) : new_y);
 }
 
-void scrollback(int lines)
+void scrollback(struct vc_data *vc, int lines)
 {
-	int currcons = fg_console;
-
 	if (!lines)
-		lines = vc_cons[currcons].d->vc_rows/2;
+		lines = vc->vc_rows / 2;
 	scrolldelta(-lines);
 }
 
-void scrollfront(int lines)
+void scrollfront(struct vc_data *vc, int lines)
 {
-	int currcons = fg_console;
-
 	if (!lines)
-		lines = vc_cons[currcons].d->vc_rows/2;
+		lines = vc->vc_rows / 2;
 	scrolldelta(lines);
 }
 
-static void lf(int currcons)
+static void lf(struct vc_data *vc)
 {
     	/* don't scroll if above bottom of scrolling region, or
 	 * if below scrolling region
 	 */
-    	if (y+1 == bottom)
-		scrup(currcons,top,bottom,1);
-	else if (y < vc_cons[currcons].d->vc_rows-1) {
-	    	y++;
-		pos += vc_cons[currcons].d->vc_size_row;
+    	if (vc->vc_y + 1 == vc->vc_bottom)
+		scrup(vc, vc->vc_top, vc->vc_bottom, 1);
+	else if (vc->vc_y < vc->vc_rows - 1) {
+	    	vc->vc_y++;
+		vc->vc_pos += vc->vc_size_row;
 	}
-	need_wrap = 0;
+	vc->vc_need_wrap = 0;
 }
 
-static void ri(int currcons)
+static void ri(struct vc_data *vc)
 {
     	/* don't scroll if below top of scrolling region, or
 	 * if above scrolling region
 	 */
-	if (y == top)
-		scrdown(currcons,top,bottom,1);
-	else if (y > 0) {
-		y--;
-		pos -= vc_cons[currcons].d->vc_size_row;
+	if (vc->vc_y == vc->vc_top)
+		scrdown(vc, vc->vc_top, vc->vc_bottom, 1);
+	else if (vc->vc_y > 0) {
+		vc->vc_y--;
+		vc->vc_pos -= vc->vc_size_row;
 	}
-	need_wrap = 0;
+	vc->vc_need_wrap = 0;
 }
 
-static inline void cr(int currcons)
+static inline void cr(struct vc_data *vc)
 {
-	pos -= x<<1;
-	need_wrap = x = 0;
+	vc->vc_pos -= vc->vc_x << 1;
+	vc->vc_need_wrap = vc->vc_x = 0;
 }
 
-static inline void bs(int currcons)
+static inline void bs(struct vc_data *vc)
 {
-	if (x) {
-		pos -= 2;
-		x--;
-		need_wrap = 0;
+	if (vc->vc_x) {
+		vc->vc_pos -= 2;
+		vc->vc_x--;
+		vc->vc_need_wrap = 0;
 	}
 }
 
-static inline void del(int currcons)
+static inline void del(struct vc_data *vc)
 {
 	/* ignored */
 }
 
-static void csi_J(int currcons, int vpar)
+static void csi_J(struct vc_data *vc, int vpar)
 {
 	unsigned int count;
 	unsigned short * start;
 
 	switch (vpar) {
 		case 0:	/* erase from cursor to end of display */
-			count = (scr_end-pos)>>1;
-			start = (unsigned short *) pos;
-			if (DO_UPDATE) {
+			count = (vc->vc_scr_end - vc->vc_pos) >> 1;
+			start = (unsigned short *)vc->vc_pos;
+			if (DO_UPDATE(vc)) {
 				/* do in two stages */
-				sw->con_clear(vc_cons[currcons].d, y, x, 1,
-					      vc_cons[currcons].d->vc_cols-x);
-				sw->con_clear(vc_cons[currcons].d, y+1, 0,
-					      vc_cons[currcons].d->vc_rows-y-1,
-					      vc_cons[currcons].d->vc_cols);
+				vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1,
+					      vc->vc_cols - vc->vc_x);
+				vc->vc_sw->con_clear(vc, vc->vc_y + 1, 0,
+					      vc->vc_rows - vc->vc_y - 1,
+					      vc->vc_cols);
 			}
 			break;
 		case 1:	/* erase from start to cursor */
-			count = ((pos-origin)>>1)+1;
-			start = (unsigned short *) origin;
-			if (DO_UPDATE) {
+			count = ((vc->vc_pos - vc->vc_origin) >> 1) + 1;
+			start = (unsigned short *)vc->vc_origin;
+			if (DO_UPDATE(vc)) {
 				/* do in two stages */
-				sw->con_clear(vc_cons[currcons].d, 0, 0, y,
-					      vc_cons[currcons].d->vc_cols);
-				sw->con_clear(vc_cons[currcons].d, y, 0, 1,
-					      x + 1);
+				vc->vc_sw->con_clear(vc, 0, 0, vc->vc_y,
+					      vc->vc_cols);
+				vc->vc_sw->con_clear(vc, vc->vc_y, 0, 1,
+					      vc->vc_x + 1);
 			}
 			break;
 		case 2: /* erase whole display */
-			count = vc_cons[currcons].d->vc_cols * vc_cons[currcons].d->vc_rows;
-			start = (unsigned short *) origin;
-			if (DO_UPDATE)
-				sw->con_clear(vc_cons[currcons].d, 0, 0,
-					      vc_cons[currcons].d->vc_rows,
-					      vc_cons[currcons].d->vc_cols);
+			count = vc->vc_cols * vc->vc_rows;
+			start = (unsigned short *)vc->vc_origin;
+			if (DO_UPDATE(vc))
+				vc->vc_sw->con_clear(vc, 0, 0,
+					      vc->vc_rows,
+					      vc->vc_cols);
 			break;
 		default:
 			return;
 	}
-	scr_memsetw(start, video_erase_char, 2*count);
-	need_wrap = 0;
+	scr_memsetw(start, vc->vc_video_erase_char, 2 * count);
+	vc->vc_need_wrap = 0;
 }
 
-static void csi_K(int currcons, int vpar)
+static void csi_K(struct vc_data *vc, int vpar)
 {
 	unsigned int count;
 	unsigned short * start;
 
 	switch (vpar) {
 		case 0:	/* erase from cursor to end of line */
-			count = vc_cons[currcons].d->vc_cols-x;
-			start = (unsigned short *) pos;
-			if (DO_UPDATE)
-				sw->con_clear(vc_cons[currcons].d, y, x, 1,
-					      vc_cons[currcons].d->vc_cols-x);
+			count = vc->vc_cols - vc->vc_x;
+			start = (unsigned short *)vc->vc_pos;
+			if (DO_UPDATE(vc))
+				vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1,
+						     vc->vc_cols - vc->vc_x);
 			break;
 		case 1:	/* erase from start of line to cursor */
-			start = (unsigned short *) (pos - (x<<1));
-			count = x+1;
-			if (DO_UPDATE)
-				sw->con_clear(vc_cons[currcons].d, y, 0, 1,
-					      x + 1);
+			start = (unsigned short *)(vc->vc_pos - (vc->vc_x << 1));
+			count = vc->vc_x + 1;
+			if (DO_UPDATE(vc))
+				vc->vc_sw->con_clear(vc, vc->vc_y, 0, 1,
+						     vc->vc_x + 1);
 			break;
 		case 2: /* erase whole line */
-			start = (unsigned short *) (pos - (x<<1));
-			count = vc_cons[currcons].d->vc_cols;
-			if (DO_UPDATE)
-				sw->con_clear(vc_cons[currcons].d, y, 0, 1,
-					      vc_cons[currcons].d->vc_cols);
+			start = (unsigned short *)(vc->vc_pos - (vc->vc_x << 1));
+			count = vc->vc_cols;
+			if (DO_UPDATE(vc))
+				vc->vc_sw->con_clear(vc, vc->vc_y, 0, 1,
+					      vc->vc_cols);
 			break;
 		default:
 			return;
 	}
-	scr_memsetw(start, video_erase_char, 2 * count);
-	need_wrap = 0;
+	scr_memsetw(start, vc->vc_video_erase_char, 2 * count);
+	vc->vc_need_wrap = 0;
 }
 
-static void csi_X(int currcons, int vpar) /* erase the following vpar positions */
+static void csi_X(struct vc_data *vc, int vpar) /* erase the following vpar positions */
 {					  /* not vt100? */
 	int count;
 
 	if (!vpar)
 		vpar++;
-	count = (vpar > vc_cons[currcons].d->vc_cols-x) ? (vc_cons[currcons].d->vc_cols-x) : vpar;
+	count = (vpar > vc->vc_cols - vc->vc_x) ? (vc->vc_cols - vc->vc_x) : vpar;
 
-	scr_memsetw((unsigned short *) pos, video_erase_char, 2 * count);
-	if (DO_UPDATE)
-		sw->con_clear(vc_cons[currcons].d, y, x, 1, count);
-	need_wrap = 0;
+	scr_memsetw((unsigned short *)vc->vc_pos, vc->vc_video_erase_char, 2 * count);
+	if (DO_UPDATE(vc))
+		vc->vc_sw->con_clear(vc, vc->vc_y, vc->vc_x, 1, count);
+	vc->vc_need_wrap = 0;
 }
 
-static void default_attr(int currcons)
+static void default_attr(struct vc_data *vc)
 {
-	intensity = 1;
-	underline = 0;
-	reverse = 0;
-	blink = 0;
-	color = def_color;
+	vc->vc_intensity = 1;
+	vc->vc_underline = 0;
+	vc->vc_reverse = 0;
+	vc->vc_blink = 0;
+	vc->vc_color = vc->vc_def_color;
 }
 
 /* console_sem is held */
-static void csi_m(int currcons)
+static void csi_m(struct vc_data *vc)
 {
 	int i;
 
-	for (i=0;i<=npar;i++)
-		switch (par[i]) {
+	for (i = 0; i <= vc->vc_npar; i++)
+		switch (vc->vc_par[i]) {
 			case 0:	/* all attributes off */
-				default_attr(currcons);
+				default_attr(vc);
 				break;
 			case 1:
-				intensity = 2;
+				vc->vc_intensity = 2;
 				break;
 			case 2:
-				intensity = 0;
+				vc->vc_intensity = 0;
 				break;
 			case 4:
-				underline = 1;
+				vc->vc_underline = 1;
 				break;
 			case 5:
-				blink = 1;
+				vc->vc_blink = 1;
 				break;
 			case 7:
-				reverse = 1;
+				vc->vc_reverse = 1;
 				break;
 			case 10: /* ANSI X3.64-1979 (SCO-ish?)
 				  * Select primary font, don't display
 				  * control chars if defined, don't set
 				  * bit 8 on output.
 				  */
-				translate = set_translate(charset == 0
-						? G0_charset
-						: G1_charset,currcons);
-				disp_ctrl = 0;
-				toggle_meta = 0;
+				vc->vc_translate = set_translate(vc->vc_charset == 0
+						? vc->vc_G0_charset
+						: vc->vc_G1_charset, vc);
+				vc->vc_disp_ctrl = 0;
+				vc->vc_toggle_meta = 0;
 				break;
 			case 11: /* ANSI X3.64-1979 (SCO-ish?)
 				  * Select first alternate font, lets
 				  * chars < 32 be displayed as ROM chars.
 				  */
-				translate = set_translate(IBMPC_MAP,currcons);
-				disp_ctrl = 1;
-				toggle_meta = 0;
+				vc->vc_translate = set_translate(IBMPC_MAP, vc);
+				vc->vc_disp_ctrl = 1;
+				vc->vc_toggle_meta = 0;
 				break;
 			case 12: /* ANSI X3.64-1979 (SCO-ish?)
 				  * Select second alternate font, toggle
 				  * high bit before displaying as ROM char.
 				  */
-				translate = set_translate(IBMPC_MAP,currcons);
-				disp_ctrl = 1;
-				toggle_meta = 1;
+				vc->vc_translate = set_translate(IBMPC_MAP, vc);
+				vc->vc_disp_ctrl = 1;
+				vc->vc_toggle_meta = 1;
 				break;
 			case 21:
 			case 22:
-				intensity = 1;
+				vc->vc_intensity = 1;
 				break;
 			case 24:
-				underline = 0;
+				vc->vc_underline = 0;
 				break;
 			case 25:
-				blink = 0;
+				vc->vc_blink = 0;
 				break;
 			case 27:
-				reverse = 0;
+				vc->vc_reverse = 0;
 				break;
 			case 38: /* ANSI X3.64-1979 (SCO-ish?)
 				  * Enables underscore, white foreground
 				  * with white underscore (Linux - use
 				  * default foreground).
 				  */
-				color = (def_color & 0x0f) | background;
-				underline = 1;
+				vc->vc_color = (vc->vc_def_color & 0x0f) | (vc->vc_color & 0xf0);
+				vc->vc_underline = 1;
 				break;
 			case 39: /* ANSI X3.64-1979 (SCO-ish?)
 				  * Disable underline option.
 				  * Reset colour to default? It did this
 				  * before...
 				  */
-				color = (def_color & 0x0f) | background;
-				underline = 0;
+				vc->vc_color = (vc->vc_def_color & 0x0f) | (vc->vc_color & 0xf0);
+				vc->vc_underline = 0;
 				break;
 			case 49:
-				color = (def_color & 0xf0) | foreground;
+				vc->vc_color = (vc->vc_def_color & 0xf0) | (vc->vc_color & 0x0f);
 				break;
 			default:
-				if (par[i] >= 30 && par[i] <= 37)
-					color = color_table[par[i]-30]
-						| background;
-				else if (par[i] >= 40 && par[i] <= 47)
-					color = (color_table[par[i]-40]<<4)
-						| foreground;
+				if (vc->vc_par[i] >= 30 && vc->vc_par[i] <= 37)
+					vc->vc_color = color_table[vc->vc_par[i] - 30]
+						| (vc->vc_color & 0xf0);
+				else if (vc->vc_par[i] >= 40 && vc->vc_par[i] <= 47)
+					vc->vc_color = (color_table[vc->vc_par[i] - 40] << 4)
+						| (vc->vc_color & 0x0f);
 				break;
 		}
-	update_attr(currcons);
+	update_attr(vc);
 }
 
 static void respond_string(const char *p, struct tty_struct *tty)
@@ -1220,11 +1197,11 @@
 	con_schedule_flip(tty);
 }
 
-static void cursor_report(int currcons, struct tty_struct *tty)
+static void cursor_report(struct vc_data *vc, struct tty_struct *tty)
 {
 	char buf[40];
 
-	sprintf(buf, "\033[%d;%dR", y + (decom ? top+1 : 1), x+1);
+	sprintf(buf, "\033[%d;%dR", vc->vc_y + (vc->vc_decom ? vc->vc_top + 1 : 1), vc->vc_x + 1);
 	respond_string(buf, tty);
 }
 
@@ -1250,130 +1227,132 @@
 /* invoked via ioctl(TIOCLINUX) and through set_selection */
 int mouse_reporting(void)
 {
-	int currcons = fg_console;
-
-	return report_mouse;
+	return vc_cons[fg_console].d->vc_report_mouse;
 }
 
 /* console_sem is held */
-static void set_mode(int currcons, int on_off)
+static void set_mode(struct vc_data *vc, int on_off)
 {
 	int i;
 
-	for (i=0; i<=npar; i++)
-		if (ques) switch(par[i]) {	/* DEC private modes set/reset */
+	for (i = 0; i <= vc->vc_npar; i++)
+		if (vc->vc_ques) {
+			switch(vc->vc_par[i]) {	/* DEC private modes set/reset */
 			case 1:			/* Cursor keys send ^[Ox/^[[x */
 				if (on_off)
-					set_kbd(decckm);
+					set_kbd(vc, decckm);
 				else
-					clr_kbd(decckm);
+					clr_kbd(vc, decckm);
 				break;
 			case 3:	/* 80/132 mode switch unimplemented */
-				deccolm = on_off;
+				vc->vc_deccolm = on_off;
 #if 0
-				(void) vc_resize(deccolm ? 132 : 80, vc_cons[currcons].d->vc_rows);
+				vc_resize(deccolm ? 132 : 80, vc->vc_rows);
 				/* this alone does not suffice; some user mode
 				   utility has to change the hardware regs */
 #endif
 				break;
 			case 5:			/* Inverted screen on/off */
-				if (decscnm != on_off) {
-					decscnm = on_off;
-					invert_screen(vc_cons[currcons].d, 0, screenbuf_size, 0);
-					update_attr(currcons);
+				if (vc->vc_decscnm != on_off) {
+					vc->vc_decscnm = on_off;
+					invert_screen(vc, 0, vc->vc_screenbuf_size, 0);
+					update_attr(vc);
 				}
 				break;
 			case 6:			/* Origin relative/absolute */
-				decom = on_off;
-				gotoxay(currcons,0,0);
+				vc->vc_decom = on_off;
+				gotoxay(vc, 0, 0);
 				break;
 			case 7:			/* Autowrap on/off */
-				decawm = on_off;
+				vc->vc_decawm = on_off;
 				break;
 			case 8:			/* Autorepeat on/off */
 				if (on_off)
-					set_kbd(decarm);
+					set_kbd(vc, decarm);
 				else
-					clr_kbd(decarm);
+					clr_kbd(vc, decarm);
 				break;
 			case 9:
-				report_mouse = on_off ? 1 : 0;
+				vc->vc_report_mouse = on_off ? 1 : 0;
 				break;
 			case 25:		/* Cursor on/off */
-				deccm = on_off;
+				vc->vc_deccm = on_off;
 				break;
 			case 1000:
-				report_mouse = on_off ? 2 : 0;
+				vc->vc_report_mouse = on_off ? 2 : 0;
 				break;
-		} else switch(par[i]) {		/* ANSI modes set/reset */
+			}
+		} else {
+			switch(vc->vc_par[i]) {	/* ANSI modes set/reset */
 			case 3:			/* Monitor (display ctrls) */
-				disp_ctrl = on_off;
+				vc->vc_disp_ctrl = on_off;
 				break;
 			case 4:			/* Insert Mode on/off */
-				decim = on_off;
+				vc->vc_decim = on_off;
 				break;
 			case 20:		/* Lf, Enter == CrLf/Lf */
 				if (on_off)
-					set_kbd(lnm);
+					set_kbd(vc, lnm);
 				else
-					clr_kbd(lnm);
+					clr_kbd(vc, lnm);
 				break;
+			}
 		}
 }
 
 /* console_sem is held */
-static void setterm_command(int currcons)
+static void setterm_command(struct vc_data *vc)
 {
-	switch(par[0]) {
+	switch(vc->vc_par[0]) {
 		case 1:	/* set color for underline mode */
-			if (vc_cons[currcons].d->vc_can_do_color &&
-					par[1] < 16) {
-				ulcolor = color_table[par[1]];
-				if (underline)
-					update_attr(currcons);
+			if (vc->vc_can_do_color &&
+					vc->vc_par[1] < 16) {
+				vc->vc_ulcolor = color_table[vc->vc_par[1]];
+				if (vc->vc_underline)
+					update_attr(vc);
 			}
 			break;
 		case 2:	/* set color for half intensity mode */
-			if (vc_cons[currcons].d->vc_can_do_color &&
-					par[1] < 16) {
-				halfcolor = color_table[par[1]];
-				if (intensity == 0)
-					update_attr(currcons);
+			if (vc->vc_can_do_color &&
+					vc->vc_par[1] < 16) {
+				vc->vc_halfcolor = color_table[vc->vc_par[1]];
+				if (vc->vc_intensity == 0)
+					update_attr(vc);
 			}
 			break;
 		case 8:	/* store colors as defaults */
-			def_color = attr;
-			if (hi_font_mask == 0x100)
-				def_color >>= 1;
-			default_attr(currcons);
-			update_attr(currcons);
+			vc->vc_def_color = vc->vc_attr;
+			if (vc->vc_hi_font_mask == 0x100)
+				vc->vc_def_color >>= 1;
+			default_attr(vc);
+			update_attr(vc);
 			break;
 		case 9:	/* set blanking interval */
-			blankinterval = ((par[1] < 60) ? par[1] : 60) * 60 * HZ;
+			blankinterval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60 * HZ;
 			poke_blanked_console();
 			break;
 		case 10: /* set bell frequency in Hz */
-			if (npar >= 1)
-				bell_pitch = par[1];
+			if (vc->vc_npar >= 1)
+				vc->vc_bell_pitch = vc->vc_par[1];
 			else
-				bell_pitch = DEFAULT_BELL_PITCH;
+				vc->vc_bell_pitch = DEFAULT_BELL_PITCH;
 			break;
 		case 11: /* set bell duration in msec */
-			if (npar >= 1)
-				bell_duration = (par[1] < 2000) ?
-					par[1]*HZ/1000 : 0;
+			if (vc->vc_npar >= 1)
+				vc->vc_bell_duration = (vc->vc_par[1] < 2000) ?
+					vc->vc_par[1] * HZ / 1000 : 0;
 			else
-				bell_duration = DEFAULT_BELL_DURATION;
+				vc->vc_bell_duration = DEFAULT_BELL_DURATION;
 			break;
 		case 12: /* bring specified console to the front */
-			if (par[1] >= 1 && vc_cons_allocated(par[1]-1))
-				set_console(par[1] - 1);
+			if (vc->vc_par[1] >= 1 && vc_cons_allocated(vc->vc_par[1] - 1))
+				set_console(vc->vc_par[1] - 1);
 			break;
 		case 13: /* unblank the screen */
 			poke_blanked_console();
 			break;
 		case 14: /* set vesa powerdown interval */
-			vesa_off_interval = ((par[1] < 60) ? par[1] : 60) * 60 * HZ;
+			vesa_off_interval = ((vc->vc_par[1] < 60) ? vc->vc_par[1] : 60) * 60 * HZ;
 			break;
 		case 15: /* activate the previous console */
 			set_console(last_console);
@@ -1382,77 +1361,77 @@
 }
 
 /* console_sem is held */
-static void csi_at(int currcons, unsigned int nr)
+static void csi_at(struct vc_data *vc, unsigned int nr)
 {
-	if (nr > vc_cons[currcons].d->vc_cols - x)
-		nr = vc_cons[currcons].d->vc_cols - x;
+	if (nr > vc->vc_cols - vc->vc_x)
+		nr = vc->vc_cols - vc->vc_x;
 	else if (!nr)
 		nr = 1;
-	insert_char(currcons, nr);
+	insert_char(vc, nr);
 }
 
 /* console_sem is held */
-static void csi_L(int currcons, unsigned int nr)
+static void csi_L(struct vc_data *vc, unsigned int nr)
 {
-	if (nr > vc_cons[currcons].d->vc_rows - y)
-		nr = vc_cons[currcons].d->vc_rows - y;
+	if (nr > vc->vc_rows - vc->vc_y)
+		nr = vc->vc_rows - vc->vc_y;
 	else if (!nr)
 		nr = 1;
-	scrdown(currcons,y,bottom,nr);
-	need_wrap = 0;
+	scrdown(vc, vc->vc_y, vc->vc_bottom, nr);
+	vc->vc_need_wrap = 0;
 }
 
 /* console_sem is held */
-static void csi_P(int currcons, unsigned int nr)
+static void csi_P(struct vc_data *vc, unsigned int nr)
 {
-	if (nr > vc_cons[currcons].d->vc_cols - x)
-		nr = vc_cons[currcons].d->vc_cols - x;
+	if (nr > vc->vc_cols - vc->vc_x)
+		nr = vc->vc_cols - vc->vc_x;
 	else if (!nr)
 		nr = 1;
-	delete_char(currcons, nr);
+	delete_char(vc, nr);
 }
 
 /* console_sem is held */
-static void csi_M(int currcons, unsigned int nr)
+static void csi_M(struct vc_data *vc, unsigned int nr)
 {
-	if (nr > vc_cons[currcons].d->vc_rows - y)
-		nr = vc_cons[currcons].d->vc_rows - y;
+	if (nr > vc->vc_rows - vc->vc_y)
+		nr = vc->vc_rows - vc->vc_y;
 	else if (!nr)
 		nr=1;
-	scrup(currcons,y,bottom,nr);
-	need_wrap = 0;
+	scrup(vc, vc->vc_y, vc->vc_bottom, nr);
+	vc->vc_need_wrap = 0;
 }
 
 /* console_sem is held (except via vc_init->reset_terminal */
-static void save_cur(int currcons)
+static void save_cur(struct vc_data *vc)
 {
-	saved_x		= x;
-	saved_y		= y;
-	s_intensity	= intensity;
-	s_underline	= underline;
-	s_blink		= blink;
-	s_reverse	= reverse;
-	s_charset	= charset;
-	s_color		= color;
-	saved_G0	= G0_charset;
-	saved_G1	= G1_charset;
+	vc->vc_saved_x		= vc->vc_x;
+	vc->vc_saved_y		= vc->vc_y;
+	vc->vc_s_intensity	= vc->vc_intensity;
+	vc->vc_s_underline	= vc->vc_underline;
+	vc->vc_s_blink		= vc->vc_blink;
+	vc->vc_s_reverse	= vc->vc_reverse;
+	vc->vc_s_charset	= vc->vc_charset;
+	vc->vc_s_color		= vc->vc_color;
+	vc->vc_saved_G0		= vc->vc_G0_charset;
+	vc->vc_saved_G1		= vc->vc_G1_charset;
 }
 
 /* console_sem is held */
-static void restore_cur(int currcons)
+static void restore_cur(struct vc_data *vc)
 {
-	gotoxy(vc_cons[currcons].d,saved_x,saved_y);
-	intensity	= s_intensity;
-	underline	= s_underline;
-	blink		= s_blink;
-	reverse		= s_reverse;
-	charset		= s_charset;
-	color		= s_color;
-	G0_charset	= saved_G0;
-	G1_charset	= saved_G1;
-	translate	= set_translate(charset ? G1_charset : G0_charset,currcons);
-	update_attr(currcons);
-	need_wrap = 0;
+	gotoxy(vc, vc->vc_saved_x, vc->vc_saved_y);
+	vc->vc_intensity	= vc->vc_s_intensity;
+	vc->vc_underline	= vc->vc_s_underline;
+	vc->vc_blink		= vc->vc_s_blink;
+	vc->vc_reverse		= vc->vc_s_reverse;
+	vc->vc_charset		= vc->vc_s_charset;
+	vc->vc_color		= vc->vc_s_color;
+	vc->vc_G0_charset	= vc->vc_saved_G0;
+	vc->vc_G1_charset	= vc->vc_saved_G1;
+	vc->vc_translate	= set_translate(vc->vc_charset ? vc->vc_G1_charset : vc->vc_G0_charset, vc);
+	update_attr(vc);
+	vc->vc_need_wrap = 0;
 }
 
 enum { ESnormal, ESesc, ESsquare, ESgetpars, ESgotpars, ESfunckey,
@@ -1460,64 +1439,64 @@
 	ESpalette };
 
 /* console_sem is held (except via vc_init()) */
-static void reset_terminal(int currcons, int do_clear)
+static void reset_terminal(struct vc_data *vc, int do_clear)
 {
-	top		= 0;
-	bottom		= vc_cons[currcons].d->vc_rows;
-	vc_state	= ESnormal;
-	ques		= 0;
-	translate	= set_translate(LAT1_MAP,currcons);
-	G0_charset	= LAT1_MAP;
-	G1_charset	= GRAF_MAP;
-	charset		= 0;
-	need_wrap	= 0;
-	report_mouse	= 0;
-	utf             = 0;
-	utf_count       = 0;
-
-	disp_ctrl	= 0;
-	toggle_meta	= 0;
-
-	decscnm		= 0;
-	decom		= 0;
-	decawm		= 1;
-	deccm		= 1;
-	decim		= 0;
-
-	set_kbd(decarm);
-	clr_kbd(decckm);
-	clr_kbd(kbdapplic);
-	clr_kbd(lnm);
-	kbd_table[currcons].lockstate = 0;
-	kbd_table[currcons].slockstate = 0;
-	kbd_table[currcons].ledmode = LED_SHOW_FLAGS;
-	kbd_table[currcons].ledflagstate = kbd_table[currcons].default_ledflagstate;
+	vc->vc_top		= 0;
+	vc->vc_bottom		= vc->vc_rows;
+	vc->vc_state		= ESnormal;
+	vc->vc_ques		= 0;
+	vc->vc_translate	= set_translate(LAT1_MAP, vc);
+	vc->vc_G0_charset	= LAT1_MAP;
+	vc->vc_G1_charset	= GRAF_MAP;
+	vc->vc_charset		= 0;
+	vc->vc_need_wrap	= 0;
+	vc->vc_report_mouse	= 0;
+	vc->vc_utf		= 0;
+	vc->vc_utf_count	= 0;
+
+	vc->vc_disp_ctrl	= 0;
+	vc->vc_toggle_meta	= 0;
+
+	vc->vc_decscnm		= 0;
+	vc->vc_decom		= 0;
+	vc->vc_decawm		= 1;
+	vc->vc_deccm		= 1;
+	vc->vc_decim		= 0;
+
+	set_kbd(vc, decarm);
+	clr_kbd(vc, decckm);
+	clr_kbd(vc, kbdapplic);
+	clr_kbd(vc, lnm);
+	kbd_table[vc->vc_num].lockstate = 0;
+	kbd_table[vc->vc_num].slockstate = 0;
+	kbd_table[vc->vc_num].ledmode = LED_SHOW_FLAGS;
+	kbd_table[vc->vc_num].ledflagstate = kbd_table[vc->vc_num].default_ledflagstate;
 	/* do not do set_leds here because this causes an endless tasklet loop
 	   when the keyboard hasn't been initialized yet */
 
-	cursor_type = CUR_DEFAULT;
-	complement_mask = s_complement_mask;
+	vc->vc_cursor_type = CUR_DEFAULT;
+	vc->vc_complement_mask = vc->vc_s_complement_mask;
 
-	default_attr(currcons);
-	update_attr(currcons);
+	default_attr(vc);
+	update_attr(vc);
 
-	tab_stop[0]	= 0x01010100;
-	tab_stop[1]	=
-	tab_stop[2]	=
-	tab_stop[3]	=
-	tab_stop[4]	= 0x01010101;
+	vc->vc_tab_stop[0]	= 0x01010100;
+	vc->vc_tab_stop[1]	=
+	vc->vc_tab_stop[2]	=
+	vc->vc_tab_stop[3]	=
+	vc->vc_tab_stop[4]	= 0x01010101;
 
-	bell_pitch = DEFAULT_BELL_PITCH;
-	bell_duration = DEFAULT_BELL_DURATION;
+	vc->vc_bell_pitch = DEFAULT_BELL_PITCH;
+	vc->vc_bell_duration = DEFAULT_BELL_DURATION;
 
-	gotoxy(vc_cons[currcons].d, 0, 0);
-	save_cur(currcons);
+	gotoxy(vc, 0, 0);
+	save_cur(vc);
 	if (do_clear)
-	    csi_J(currcons,2);
+	    csi_J(vc, 2);
 }
 
 /* console_sem is held */
-static void do_con_trol(struct tty_struct *tty, unsigned int currcons, int c)
+static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, int c)
 {
 	/*
 	 *  Control characters can be used in the _middle_
@@ -1527,360 +1506,371 @@
 	case 0:
 		return;
 	case 7:
-		if (bell_duration)
-			kd_mksound(bell_pitch, bell_duration);
+		if (vc->vc_bell_duration)
+			kd_mksound(vc->vc_bell_pitch, vc->vc_bell_duration);
 		return;
 	case 8:
-		bs(currcons);
+		bs(vc);
 		return;
 	case 9:
-		pos -= (x << 1);
-		while (x < vc_cons[currcons].d->vc_cols - 1) {
-			x++;
-			if (tab_stop[x >> 5] & (1 << (x & 31)))
+		vc->vc_pos -= (vc->vc_x << 1);
+		while (vc->vc_x < vc->vc_cols - 1) {
+			vc->vc_x++;
+			if (vc->vc_tab_stop[vc->vc_x >> 5] & (1 << (vc->vc_x & 31)))
 				break;
 		}
-		pos += (x << 1);
+		vc->vc_pos += (vc->vc_x << 1);
 		return;
 	case 10: case 11: case 12:
-		lf(currcons);
-		if (!is_kbd(lnm))
+		lf(vc);
+		if (!is_kbd(vc, lnm))
 			return;
 	case 13:
-		cr(currcons);
+		cr(vc);
 		return;
 	case 14:
-		charset = 1;
-		translate = set_translate(G1_charset,currcons);
-		disp_ctrl = 1;
+		vc->vc_charset = 1;
+		vc->vc_translate = set_translate(vc->vc_G1_charset, vc);
+		vc->vc_disp_ctrl = 1;
 		return;
 	case 15:
-		charset = 0;
-		translate = set_translate(G0_charset,currcons);
-		disp_ctrl = 0;
+		vc->vc_charset = 0;
+		vc->vc_translate = set_translate(vc->vc_G0_charset, vc);
+		vc->vc_disp_ctrl = 0;
 		return;
 	case 24: case 26:
-		vc_state = ESnormal;
+		vc->vc_state = ESnormal;
 		return;
 	case 27:
-		vc_state = ESesc;
+		vc->vc_state = ESesc;
 		return;
 	case 127:
-		del(currcons);
+		del(vc);
 		return;
 	case 128+27:
-		vc_state = ESsquare;
+		vc->vc_state = ESsquare;
 		return;
 	}
-	switch(vc_state) {
+	switch(vc->vc_state) {
 	case ESesc:
-		vc_state = ESnormal;
+		vc->vc_state = ESnormal;
 		switch (c) {
 		case '[':
-			vc_state = ESsquare;
+			vc->vc_state = ESsquare;
 			return;
 		case ']':
-			vc_state = ESnonstd;
+			vc->vc_state = ESnonstd;
 			return;
 		case '%':
-			vc_state = ESpercent;
+			vc->vc_state = ESpercent;
 			return;
 		case 'E':
-			cr(currcons);
-			lf(currcons);
+			cr(vc);
+			lf(vc);
 			return;
 		case 'M':
-			ri(currcons);
+			ri(vc);
 			return;
 		case 'D':
-			lf(currcons);
+			lf(vc);
 			return;
 		case 'H':
-			tab_stop[x >> 5] |= (1 << (x & 31));
+			vc->vc_tab_stop[vc->vc_x >> 5] |= (1 << (vc->vc_x & 31));
 			return;
 		case 'Z':
 			respond_ID(tty);
 			return;
 		case '7':
-			save_cur(currcons);
+			save_cur(vc);
 			return;
 		case '8':
-			restore_cur(currcons);
+			restore_cur(vc);
 			return;
 		case '(':
-			vc_state = ESsetG0;
+			vc->vc_state = ESsetG0;
 			return;
 		case ')':
-			vc_state = ESsetG1;
+			vc->vc_state = ESsetG1;
 			return;
 		case '#':
-			vc_state = EShash;
+			vc->vc_state = EShash;
 			return;
 		case 'c':
-			reset_terminal(currcons,1);
+			reset_terminal(vc, 1);
 			return;
 		case '>':  /* Numeric keypad */
-			clr_kbd(kbdapplic);
+			clr_kbd(vc, kbdapplic);
 			return;
 		case '=':  /* Appl. keypad */
-			set_kbd(kbdapplic);
+			set_kbd(vc, kbdapplic);
 			return;
 		}
 		return;
 	case ESnonstd:
 		if (c=='P') {   /* palette escape sequence */
-			for (npar=0; npar<NPAR; npar++)
-				par[npar] = 0 ;
-			npar = 0 ;
-			vc_state = ESpalette;
+			for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++)
+				vc->vc_par[vc->vc_npar] = 0;
+			vc->vc_npar = 0;
+			vc->vc_state = ESpalette;
 			return;
 		} else if (c=='R') {   /* reset palette */
-			reset_palette(currcons);
-			vc_state = ESnormal;
+			reset_palette(vc);
+			vc->vc_state = ESnormal;
 		} else
-			vc_state = ESnormal;
+			vc->vc_state = ESnormal;
 		return;
 	case ESpalette:
 		if ( (c>='0'&&c<='9') || (c>='A'&&c<='F') || (c>='a'&&c<='f') ) {
-			par[npar++] = (c>'9' ? (c&0xDF)-'A'+10 : c-'0') ;
-			if (npar==7) {
-				int i = par[0]*3, j = 1;
-				palette[i] = 16*par[j++];
-				palette[i++] += par[j++];
-				palette[i] = 16*par[j++];
-				palette[i++] += par[j++];
-				palette[i] = 16*par[j++];
-				palette[i] += par[j];
-				set_palette(currcons);
-				vc_state = ESnormal;
+			vc->vc_par[vc->vc_npar++] = (c > '9' ? (c & 0xDF) - 'A' + 10 : c - '0');
+			if (vc->vc_npar == 7) {
+				int i = vc->vc_par[0] * 3, j = 1;
+				vc->vc_palette[i] = 16 * vc->vc_par[j++];
+				vc->vc_palette[i++] += vc->vc_par[j++];
+				vc->vc_palette[i] = 16 * vc->vc_par[j++];
+				vc->vc_palette[i++] += vc->vc_par[j++];
+				vc->vc_palette[i] = 16 * vc->vc_par[j++];
+				vc->vc_palette[i] += vc->vc_par[j];
+				set_palette(vc);
+				vc->vc_state = ESnormal;
 			}
 		} else
-			vc_state = ESnormal;
+			vc->vc_state = ESnormal;
 		return;
 	case ESsquare:
-		for(npar = 0 ; npar < NPAR ; npar++)
-			par[npar] = 0;
-		npar = 0;
-		vc_state = ESgetpars;
+		for (vc->vc_npar = 0; vc->vc_npar < NPAR; vc->vc_npar++)
+			vc->vc_par[vc->vc_npar] = 0;
+		vc->vc_npar = 0;
+		vc->vc_state = ESgetpars;
 		if (c == '[') { /* Function key */
-			vc_state=ESfunckey;
+			vc->vc_state=ESfunckey;
 			return;
 		}
-		ques = (c=='?');
-		if (ques)
+		vc->vc_ques = (c == '?');
+		if (vc->vc_ques)
 			return;
 	case ESgetpars:
-		if (c==';' && npar<NPAR-1) {
-			npar++;
+		if (c == ';' && vc->vc_npar < NPAR - 1) {
+			vc->vc_npar++;
 			return;
 		} else if (c>='0' && c<='9') {
-			par[npar] *= 10;
-			par[npar] += c-'0';
+			vc->vc_par[vc->vc_npar] *= 10;
+			vc->vc_par[vc->vc_npar] += c - '0';
 			return;
-		} else vc_state=ESgotpars;
+		} else
+			vc->vc_state = ESgotpars;
 	case ESgotpars:
-		vc_state = ESnormal;
+		vc->vc_state = ESnormal;
 		switch(c) {
 		case 'h':
-			set_mode(currcons,1);
+			set_mode(vc, 1);
 			return;
 		case 'l':
-			set_mode(currcons,0);
+			set_mode(vc, 0);
 			return;
 		case 'c':
-			if (ques) {
-				if (par[0])
-					cursor_type = par[0] | (par[1]<<8) | (par[2]<<16);
+			if (vc->vc_ques) {
+				if (vc->vc_par[0])
+					vc->vc_cursor_type = vc->vc_par[0] | (vc->vc_par[1] << 8) | (vc->vc_par[2] << 16);
 				else
-					cursor_type = CUR_DEFAULT;
+					vc->vc_cursor_type = CUR_DEFAULT;
 				return;
 			}
 			break;
 		case 'm':
-			if (ques) {
+			if (vc->vc_ques) {
 				clear_selection();
-				if (par[0])
-					complement_mask = par[0]<<8 | par[1];
+				if (vc->vc_par[0])
+					vc->vc_complement_mask = vc->vc_par[0] << 8 | vc->vc_par[1];
 				else
-					complement_mask = s_complement_mask;
+					vc->vc_complement_mask = vc->vc_s_complement_mask;
 				return;
 			}
 			break;
 		case 'n':
-			if (!ques) {
-				if (par[0] == 5)
+			if (!vc->vc_ques) {
+				if (vc->vc_par[0] == 5)
 					status_report(tty);
-				else if (par[0] == 6)
-					cursor_report(currcons,tty);
+				else if (vc->vc_par[0] == 6)
+					cursor_report(vc, tty);
 			}
 			return;
 		}
-		if (ques) {
-			ques = 0;
+		if (vc->vc_ques) {
+			vc->vc_ques = 0;
 			return;
 		}
 		switch(c) {
 		case 'G': case '`':
-			if (par[0]) par[0]--;
-			gotoxy(vc_cons[currcons].d, par[0], y);
+			if (vc->vc_par[0])
+				vc->vc_par[0]--;
+			gotoxy(vc, vc->vc_par[0], vc->vc_y);
 			return;
 		case 'A':
-			if (!par[0]) par[0]++;
-			gotoxy(vc_cons[currcons].d, x, y-par[0]);
+			if (!vc->vc_par[0])
+				vc->vc_par[0]++;
+			gotoxy(vc, vc->vc_x, vc->vc_y - vc->vc_par[0]);
 			return;
 		case 'B': case 'e':
-			if (!par[0]) par[0]++;
-			gotoxy(vc_cons[currcons].d, x, y+par[0]);
+			if (!vc->vc_par[0])
+				vc->vc_par[0]++;
+			gotoxy(vc, vc->vc_x, vc->vc_y + vc->vc_par[0]);
 			return;
 		case 'C': case 'a':
-			if (!par[0]) par[0]++;
-			gotoxy(vc_cons[currcons].d, x+par[0], y);
+			if (!vc->vc_par[0])
+				vc->vc_par[0]++;
+			gotoxy(vc, vc->vc_x + vc->vc_par[0], vc->vc_y);
 			return;
 		case 'D':
-			if (!par[0]) par[0]++;
-			gotoxy(vc_cons[currcons].d, x-par[0], y);
+			if (!vc->vc_par[0])
+				vc->vc_par[0]++;
+			gotoxy(vc, vc->vc_x - vc->vc_par[0], vc->vc_y);
 			return;
 		case 'E':
-			if (!par[0]) par[0]++;
-			gotoxy(vc_cons[currcons].d, 0, y+par[0]);
+			if (!vc->vc_par[0])
+				vc->vc_par[0]++;
+			gotoxy(vc, 0, vc->vc_y + vc->vc_par[0]);
 			return;
 		case 'F':
-			if (!par[0]) par[0]++;
-			gotoxy(vc_cons[currcons].d, 0, y-par[0]);
+			if (!vc->vc_par[0])
+				vc->vc_par[0]++;
+			gotoxy(vc, 0, vc->vc_y - vc->vc_par[0]);
 			return;
 		case 'd':
-			if (par[0]) par[0]--;
-			gotoxay(currcons,x,par[0]);
+			if (vc->vc_par[0])
+				vc->vc_par[0]--;
+			gotoxay(vc, vc->vc_x ,vc->vc_par[0]);
 			return;
 		case 'H': case 'f':
-			if (par[0]) par[0]--;
-			if (par[1]) par[1]--;
-			gotoxay(currcons,par[1],par[0]);
+			if (vc->vc_par[0])
+				vc->vc_par[0]--;
+			if (vc->vc_par[1])
+				vc->vc_par[1]--;
+			gotoxay(vc, vc->vc_par[1], vc->vc_par[0]);
 			return;
 		case 'J':
-			csi_J(currcons,par[0]);
+			csi_J(vc, vc->vc_par[0]);
 			return;
 		case 'K':
-			csi_K(currcons,par[0]);
+			csi_K(vc, vc->vc_par[0]);
 			return;
 		case 'L':
-			csi_L(currcons,par[0]);
+			csi_L(vc, vc->vc_par[0]);
 			return;
 		case 'M':
-			csi_M(currcons,par[0]);
+			csi_M(vc, vc->vc_par[0]);
 			return;
 		case 'P':
-			csi_P(currcons,par[0]);
+			csi_P(vc, vc->vc_par[0]);
 			return;
 		case 'c':
-			if (!par[0])
+			if (!vc->vc_par[0])
 				respond_ID(tty);
 			return;
 		case 'g':
-			if (!par[0])
-				tab_stop[x >> 5] &= ~(1 << (x & 31));
-			else if (par[0] == 3) {
-				tab_stop[0] =
-					tab_stop[1] =
-					tab_stop[2] =
-					tab_stop[3] =
-					tab_stop[4] = 0;
+			if (!vc->vc_par[0])
+				vc->vc_tab_stop[vc->vc_x >> 5] &= ~(1 << (vc->vc_x & 31));
+			else if (vc->vc_par[0] == 3) {
+				vc->vc_tab_stop[0] =
+					vc->vc_tab_stop[1] =
+					vc->vc_tab_stop[2] =
+					vc->vc_tab_stop[3] =
+					vc->vc_tab_stop[4] = 0;
 			}
 			return;
 		case 'm':
-			csi_m(currcons);
+			csi_m(vc);
 			return;
 		case 'q': /* DECLL - but only 3 leds */
 			/* map 0,1,2,3 to 0,1,2,4 */
-			if (par[0] < 4)
-				setledstate(kbd_table + currcons,
-					    (par[0] < 3) ? par[0] : 4);
+			if (vc->vc_par[0] < 4)
+				setledstate(kbd_table + vc->vc_num,
+					    (vc->vc_par[0] < 3) ? vc->vc_par[0] : 4);
 			return;
 		case 'r':
-			if (!par[0])
-				par[0]++;
-			if (!par[1])
-				par[1] = vc_cons[currcons].d->vc_rows;
+			if (!vc->vc_par[0])
+				vc->vc_par[0]++;
+			if (!vc->vc_par[1])
+				vc->vc_par[1] = vc->vc_rows;
 			/* Minimum allowed region is 2 lines */
-			if (par[0] < par[1] &&
-			    par[1] <= vc_cons[currcons].d->vc_rows) {
-				top=par[0]-1;
-				bottom=par[1];
-				gotoxay(currcons,0,0);
+			if (vc->vc_par[0] < vc->vc_par[1] &&
+			    vc->vc_par[1] <= vc->vc_rows) {
+				vc->vc_top = vc->vc_par[0] - 1;
+				vc->vc_bottom = vc->vc_par[1];
+				gotoxay(vc, 0, 0);
 			}
 			return;
 		case 's':
-			save_cur(currcons);
+			save_cur(vc);
 			return;
 		case 'u':
-			restore_cur(currcons);
+			restore_cur(vc);
 			return;
 		case 'X':
-			csi_X(currcons, par[0]);
+			csi_X(vc, vc->vc_par[0]);
 			return;
 		case '@':
-			csi_at(currcons,par[0]);
+			csi_at(vc, vc->vc_par[0]);
 			return;
 		case ']': /* setterm functions */
-			setterm_command(currcons);
+			setterm_command(vc);
 			return;
 		}
 		return;
 	case ESpercent:
-		vc_state = ESnormal;
+		vc->vc_state = ESnormal;
 		switch (c) {
 		case '@':  /* defined in ISO 2022 */
-			utf = 0;
+			vc->vc_utf = 0;
 			return;
 		case 'G':  /* prelim official escape code */
 		case '8':  /* retained for compatibility */
-			utf = 1;
+			vc->vc_utf = 1;
 			return;
 		}
 		return;
 	case ESfunckey:
-		vc_state = ESnormal;
+		vc->vc_state = ESnormal;
 		return;
 	case EShash:
-		vc_state = ESnormal;
+		vc->vc_state = ESnormal;
 		if (c == '8') {
 			/* DEC screen alignment test. kludge :-) */
-			video_erase_char =
-				(video_erase_char & 0xff00) | 'E';
-			csi_J(currcons, 2);
-			video_erase_char =
-				(video_erase_char & 0xff00) | ' ';
-			do_update_region(vc_cons[currcons].d, origin, screenbuf_size/2);
+			vc->vc_video_erase_char =
+				(vc->vc_video_erase_char & 0xff00) | 'E';
+			csi_J(vc, 2);
+			vc->vc_video_erase_char =
+				(vc->vc_video_erase_char & 0xff00) | ' ';
+			do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2);
 		}
 		return;
 	case ESsetG0:
 		if (c == '0')
-			G0_charset = GRAF_MAP;
+			vc->vc_G0_charset = GRAF_MAP;
 		else if (c == 'B')
-			G0_charset = LAT1_MAP;
+			vc->vc_G0_charset = LAT1_MAP;
 		else if (c == 'U')
-			G0_charset = IBMPC_MAP;
+			vc->vc_G0_charset = IBMPC_MAP;
 		else if (c == 'K')
-			G0_charset = USER_MAP;
-		if (charset == 0)
-			translate = set_translate(G0_charset,currcons);
-		vc_state = ESnormal;
+			vc->vc_G0_charset = USER_MAP;
+		if (vc->vc_charset == 0)
+			vc->vc_translate = set_translate(vc->vc_G0_charset, vc);
+		vc->vc_state = ESnormal;
 		return;
 	case ESsetG1:
 		if (c == '0')
-			G1_charset = GRAF_MAP;
+			vc->vc_G1_charset = GRAF_MAP;
 		else if (c == 'B')
-			G1_charset = LAT1_MAP;
+			vc->vc_G1_charset = LAT1_MAP;
 		else if (c == 'U')
-			G1_charset = IBMPC_MAP;
+			vc->vc_G1_charset = IBMPC_MAP;
 		else if (c == 'K')
-			G1_charset = USER_MAP;
-		if (charset == 1)
-			translate = set_translate(G1_charset,currcons);
-		vc_state = ESnormal;
+			vc->vc_G1_charset = USER_MAP;
+		if (vc->vc_charset == 1)
+			vc->vc_translate = set_translate(vc->vc_G1_charset, vc);
+		vc->vc_state = ESnormal;
 		return;
 	default:
-		vc_state = ESnormal;
+		vc->vc_state = ESnormal;
 	}
 }
 
@@ -1903,7 +1893,7 @@
 #define FLUSH do { } while(0);
 #else
 #define FLUSH if (draw_x >= 0) { \
-	sw->con_putcs(vc_cons[currcons].d, (u16 *)draw_from, (u16 *)draw_to-(u16 *)draw_from, y, draw_x); \
+	vc->vc_sw->con_putcs(vc, (u16 *)draw_from, (u16 *)draw_to - (u16 *)draw_from, vc->vc_y, draw_x); \
 	draw_x = -1; \
 	}
 #endif
@@ -1911,7 +1901,7 @@
 	int c, tc, ok, n = 0, draw_x = -1;
 	unsigned int currcons;
 	unsigned long draw_from = 0, draw_to = 0;
-	struct vt_struct *vt;
+	struct vc_data *vc;
 	u16 himask, charmask;
 	const unsigned char *orig_buf = NULL;
 	int orig_count;
@@ -1922,14 +1912,14 @@
 	might_sleep();
 
 	acquire_console_sem();
-	vt = tty->driver_data;
-	if (vt == NULL) {
+	vc = tty->driver_data;
+	if (vc == NULL) {
 		printk(KERN_ERR "vt: argh, driver_data is NULL !\n");
 		release_console_sem();
 		return 0;
 	}
 
-	currcons = vt->vc_num;
+	currcons = vc->vc_num;
 	if (!vc_cons_allocated(currcons)) {
 	    /* could this happen? */
 	    static int error = 0;
@@ -1954,19 +1944,19 @@
 
 	acquire_console_sem();
 
-	vt = tty->driver_data;
-	if (vt == NULL) {
+	vc = tty->driver_data;
+	if (vc == NULL) {
 		printk(KERN_ERR "vt: argh, driver_data _became_ NULL !\n");
 		release_console_sem();
 		goto out;
 	}
 
-	himask = hi_font_mask;
+	himask = vc->vc_hi_font_mask;
 	charmask = himask ? 0x1ff : 0xff;
 
 	/* undraw cursor first */
-	if (IS_FG)
-		hide_cursor(vc_cons[currcons].d);
+	if (IS_FG(vc))
+		hide_cursor(vc);
 
 	while (!tty->stopped && count) {
 		int orig = *buf;
@@ -1976,44 +1966,44 @@
 		count--;
 
 		/* Do no translation at all in control states */
-		if (vc_state != ESnormal) {
+		if (vc->vc_state != ESnormal) {
 			tc = c;
-		} else if (utf) {
+		} else if (vc->vc_utf) {
 		    /* Combine UTF-8 into Unicode */
 		    /* Incomplete characters silently ignored */
 		    if(c > 0x7f) {
-			if (utf_count > 0 && (c & 0xc0) == 0x80) {
-				utf_char = (utf_char << 6) | (c & 0x3f);
-				utf_count--;
-				if (utf_count == 0)
-				    tc = c = utf_char;
+			if (vc->vc_utf_count > 0 && (c & 0xc0) == 0x80) {
+				vc->vc_utf_char = (vc->vc_utf_char << 6) | (c & 0x3f);
+				vc->vc_utf_count--;
+				if (vc->vc_utf_count == 0)
+				    tc = c = vc->vc_utf_char;
 				else continue;
 			} else {
 				if ((c & 0xe0) == 0xc0) {
-				    utf_count = 1;
-				    utf_char = (c & 0x1f);
+				    vc->vc_utf_count = 1;
+				    vc->vc_utf_char = (c & 0x1f);
 				} else if ((c & 0xf0) == 0xe0) {
-				    utf_count = 2;
-				    utf_char = (c & 0x0f);
+				    vc->vc_utf_count = 2;
+				    vc->vc_utf_char = (c & 0x0f);
 				} else if ((c & 0xf8) == 0xf0) {
-				    utf_count = 3;
-				    utf_char = (c & 0x07);
+				    vc->vc_utf_count = 3;
+				    vc->vc_utf_char = (c & 0x07);
 				} else if ((c & 0xfc) == 0xf8) {
-				    utf_count = 4;
-				    utf_char = (c & 0x03);
+				    vc->vc_utf_count = 4;
+				    vc->vc_utf_char = (c & 0x03);
 				} else if ((c & 0xfe) == 0xfc) {
-				    utf_count = 5;
-				    utf_char = (c & 0x01);
+				    vc->vc_utf_count = 5;
+				    vc->vc_utf_char = (c & 0x01);
 				} else
-				    utf_count = 0;
+				    vc->vc_utf_count = 0;
 				continue;
 			      }
 		    } else {
 		      tc = c;
-		      utf_count = 0;
+		      vc->vc_utf_count = 0;
 		    }
 		} else {	/* no utf */
-		  tc = translate[toggle_meta ? (c|0x80) : c];
+		  tc = vc->vc_translate[vc->vc_toggle_meta ? (c | 0x80) : c];
 		}
 
                 /* If the original code was a control character we
@@ -2027,18 +2017,18 @@
                  * direct-to-font zone in UTF-8 mode.
                  */
                 ok = tc && (c >= 32 ||
-                            (!utf && !(((disp_ctrl ? CTRL_ALWAYS
-                                         : CTRL_ACTION) >> c) & 1)))
-                        && (c != 127 || disp_ctrl)
+			    (!vc->vc_utf && !(((vc->vc_disp_ctrl ? CTRL_ALWAYS
+						: CTRL_ACTION) >> c) & 1)))
+			&& (c != 127 || vc->vc_disp_ctrl)
 			&& (c != 128+27);
 
-		if (vc_state == ESnormal && ok) {
+		if (vc->vc_state == ESnormal && ok) {
 			/* Now try to find out how to display it */
-			tc = conv_uni_to_pc(vc_cons[currcons].d, tc);
+			tc = conv_uni_to_pc(vc, tc);
 			if ( tc == -4 ) {
                                 /* If we got -4 (not found) then see if we have
                                    defined a replacement character (U+FFFD) */
-                                tc = conv_uni_to_pc(vc_cons[currcons].d, 0xfffd);
+                                tc = conv_uni_to_pc(vc, 0xfffd);
 
 				/* One reason for the -4 can be that we just
 				   did a clear_unimap();
@@ -2052,33 +2042,33 @@
 			if (tc & ~charmask)
                                 continue; /* Conversion failed */
 
-			if (need_wrap || decim)
+			if (vc->vc_need_wrap || vc->vc_decim)
 				FLUSH
-			if (need_wrap) {
-				cr(currcons);
-				lf(currcons);
+			if (vc->vc_need_wrap) {
+				cr(vc);
+				lf(vc);
 			}
-			if (decim)
-				insert_char(currcons, 1);
+			if (vc->vc_decim)
+				insert_char(vc, 1);
 			scr_writew(himask ?
-				     ((attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) :
-				     (attr << 8) + tc,
-				   (u16 *) pos);
-			if (DO_UPDATE && draw_x < 0) {
-				draw_x = x;
-				draw_from = pos;
-			}
-			if (x == vc_cons[currcons].d->vc_cols - 1) {
-				need_wrap = decawm;
-				draw_to = pos+2;
+				     ((vc->vc_attr << 8) & ~himask) + ((tc & 0x100) ? himask : 0) + (tc & 0xff) :
+				     (vc->vc_attr << 8) + tc,
+				   (u16 *) vc->vc_pos);
+			if (DO_UPDATE(vc) && draw_x < 0) {
+				draw_x = vc->vc_x;
+				draw_from = vc->vc_pos;
+			}
+			if (vc->vc_x == vc->vc_cols - 1) {
+				vc->vc_need_wrap = vc->vc_decawm;
+				draw_to = vc->vc_pos + 2;
 			} else {
-				x++;
-				draw_to = (pos+=2);
+				vc->vc_x++;
+				draw_to = (vc->vc_pos += 2);
 			}
 			continue;
 		}
 		FLUSH
-		do_con_trol(tty, currcons, orig);
+		do_con_trol(tty, vc, orig);
 	}
 	FLUSH
 	console_conditional_schedule();
@@ -2106,7 +2096,7 @@
 		if (want_console != fg_console &&
 		    vc_cons_allocated(want_console)) {
 			hide_cursor(vc_cons[fg_console].d);
-			change_console(want_console);
+			change_console(vc_cons[want_console].d);
 			/* we only changed when the console had already
 			   been allocated - a new console is not created
 			   in an interrupt routine */
@@ -2118,10 +2108,10 @@
 		poke_blanked_console();
 	}
 	if (scrollback_delta) {
-		int currcons = fg_console;
+		struct vc_data *vc = vc_cons[fg_console].d;
 		clear_selection();
-		if (vcmode == KD_TEXT)
-			sw->con_scrolldelta(vc_cons[currcons].d, scrollback_delta);
+		if (vc->vc_mode == KD_TEXT)
+			vc->vc_sw->con_scrolldelta(vc, scrollback_delta);
 		scrollback_delta = 0;
 	}
 	if (blank_timer_expired) {
@@ -2150,7 +2140,7 @@
 
 void vt_console_print(struct console *co, const char *b, unsigned count)
 {
-	int currcons = fg_console;
+	struct vc_data *vc = vc_cons[fg_console].d;
 	unsigned char c;
 	static unsigned long printing;
 	const ushort *start;
@@ -2162,73 +2152,73 @@
 		return;
 
 	if (kmsg_redirect && vc_cons_allocated(kmsg_redirect - 1))
-		currcons = kmsg_redirect - 1;
+		vc = vc_cons[kmsg_redirect - 1].d;
 
 	/* read `x' only after setting currcons properly (otherwise
 	   the `x' macro will read the x of the foreground console). */
-	myx = x;
+	myx = vc->vc_x;
 
-	if (!vc_cons_allocated(currcons)) {
+	if (!vc_cons_allocated(fg_console)) {
 		/* impossible */
 		/* printk("vt_console_print: tty %d not allocated ??\n", currcons+1); */
 		goto quit;
 	}
 
-	if (vcmode != KD_TEXT)
+	if (vc->vc_mode != KD_TEXT)
 		goto quit;
 
 	/* undraw cursor first */
-	if (IS_FG)
-		hide_cursor(vc_cons[currcons].d);
+	if (IS_FG(vc))
+		hide_cursor(vc);
 
-	start = (ushort *)pos;
+	start = (ushort *)vc->vc_pos;
 
 	/* Contrived structure to try to emulate original need_wrap behaviour
 	 * Problems caused when we have need_wrap set on '\n' character */
 	while (count--) {
 		c = *b++;
-		if (c == 10 || c == 13 || c == 8 || need_wrap) {
+		if (c == 10 || c == 13 || c == 8 || vc->vc_need_wrap) {
 			if (cnt > 0) {
-				if (IS_VISIBLE)
-					sw->con_putcs(vc_cons[currcons].d, start, cnt, y, x);
-				x += cnt;
-				if (need_wrap)
-					x--;
+				if (CON_IS_VISIBLE(vc))
+					vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x);
+				vc->vc_x += cnt;
+				if (vc->vc_need_wrap)
+					vc->vc_x--;
 				cnt = 0;
 			}
 			if (c == 8) {		/* backspace */
-				bs(currcons);
-				start = (ushort *)pos;
-				myx = x;
+				bs(vc);
+				start = (ushort *)vc->vc_pos;
+				myx = vc->vc_x;
 				continue;
 			}
 			if (c != 13)
-				lf(currcons);
-			cr(currcons);
-			start = (ushort *)pos;
-			myx = x;
+				lf(vc);
+			cr(vc);
+			start = (ushort *)vc->vc_pos;
+			myx = vc->vc_x;
 			if (c == 10 || c == 13)
 				continue;
 		}
-		scr_writew((attr << 8) + c, (unsigned short *) pos);
+		scr_writew((vc->vc_attr << 8) + c, (unsigned short *)vc->vc_pos);
 		cnt++;
-		if (myx == vc_cons[currcons].d->vc_cols - 1) {
-			need_wrap = 1;
+		if (myx == vc->vc_cols - 1) {
+			vc->vc_need_wrap = 1;
 			continue;
 		}
-		pos+=2;
+		vc->vc_pos += 2;
 		myx++;
 	}
 	if (cnt > 0) {
-		if (IS_VISIBLE)
-			sw->con_putcs(vc_cons[currcons].d, start, cnt, y, x);
-		x += cnt;
-		if (x == vc_cons[currcons].d->vc_cols) {
-			x--;
-			need_wrap = 1;
+		if (CON_IS_VISIBLE(vc))
+			vc->vc_sw->con_putcs(vc, start, cnt, vc->vc_y, vc->vc_x);
+		vc->vc_x += cnt;
+		if (vc->vc_x == vc->vc_cols) {
+			vc->vc_x--;
+			vc->vc_need_wrap = 1;
 		}
 	}
-	set_cursor(vc_cons[currcons].d);
+	set_cursor(vc);
 
 	if (!oops_in_progress)
 		poke_blanked_console();
@@ -2333,7 +2323,7 @@
 			if (get_user(lines, (s32 __user *)(p+4))) {
 				ret = -EFAULT;
 			} else {
-				scrollfront(lines);
+				scrollfront(vc_cons[fg_console].d, lines);
 				ret = 0;
 			}
 			break;
@@ -2395,9 +2385,9 @@
 
 static void con_unthrottle(struct tty_struct *tty)
 {
-	struct vt_struct *vt = tty->driver_data;
+	struct vc_data *vc = tty->driver_data;
 
-	wake_up_interruptible(&vt->paste_wait);
+	wake_up_interruptible(&vc->paste_wait);
 }
 
 /*
@@ -2432,16 +2422,16 @@
 
 static void con_flush_chars(struct tty_struct *tty)
 {
-	struct vt_struct *vt;
+	struct vc_data *vc;
 
 	if (in_interrupt())	/* from flush_to_ldisc */
 		return;
 
 	/* if we race with con_close(), vt may be null */
 	acquire_console_sem();
-	vt = tty->driver_data;
-	if (vt)
-		set_cursor(vc_cons[vt->vc_num].d);
+	vc = tty->driver_data;
+	if (vc)
+		set_cursor(vc);
 	release_console_sem();
 }
 
@@ -2457,9 +2447,9 @@
 	if (tty->count == 1) {
 		ret = vc_allocate(currcons);
 		if (ret == 0) {
-			vt_cons[currcons]->vc_num = currcons;
-			tty->driver_data = vt_cons[currcons];
-			vc_cons[currcons].d->vc_tty = tty;
+			struct vc_data *vc = vc_cons[currcons].d;
+			tty->driver_data = vc;
+			vc->vc_tty = tty;
 
 			if (!tty->winsize.ws_row && !tty->winsize.ws_col) {
 				tty->winsize.ws_row = vc_cons[currcons].d->vc_rows;
@@ -2486,11 +2476,10 @@
 	down(&tty_sem);
 	acquire_console_sem();
 	if (tty && tty->count == 1) {
-		struct vt_struct *vt;
+		struct vc_data *vc = tty->driver_data;
 
-		vt = tty->driver_data;
-		if (vt)
-			vc_cons[vt->vc_num].d->vc_tty = NULL;
+		if (vc)
+			vc->vc_tty = NULL;
 		tty->driver_data = NULL;
 		release_console_sem();
 		vcs_remove_devfs(tty);
@@ -2505,29 +2494,29 @@
 	up(&tty_sem);
 }
 
-static void vc_init(unsigned int currcons, unsigned int rows,
-			unsigned int cols, int do_clear)
+static void vc_init(struct vc_data *vc, unsigned int rows,
+		    unsigned int cols, int do_clear)
 {
 	int j, k ;
 
-	vc_cons[currcons].d->vc_cols = cols;
-	vc_cons[currcons].d->vc_rows = rows;
-	vc_cons[currcons].d->vc_size_row = cols<<1;
-	screenbuf_size = vc_cons[currcons].d->vc_rows * vc_cons[currcons].d->vc_size_row;
-
-	set_origin(currcons);
-	pos = origin;
-	reset_vc(currcons);
+	vc->vc_cols = cols;
+	vc->vc_rows = rows;
+	vc->vc_size_row = cols << 1;
+	vc->vc_screenbuf_size = vc->vc_rows * vc->vc_size_row;
+
+	set_origin(vc);
+	vc->vc_pos = vc->vc_origin;
+	reset_vc(vc);
 	for (j=k=0; j<16; j++) {
-		vc_cons[currcons].d->vc_palette[k++] = default_red[j] ;
-		vc_cons[currcons].d->vc_palette[k++] = default_grn[j] ;
-		vc_cons[currcons].d->vc_palette[k++] = default_blu[j] ;
-	}
-	def_color       = 0x07;   /* white */
-	ulcolor		= 0x0f;   /* bold white */
-	halfcolor       = 0x08;   /* grey */
-	init_waitqueue_head(&vt_cons[currcons]->paste_wait);
-	reset_terminal(currcons, do_clear);
+		vc->vc_palette[k++] = default_red[j] ;
+		vc->vc_palette[k++] = default_grn[j] ;
+		vc->vc_palette[k++] = default_blu[j] ;
+	}
+	vc->vc_def_color       = 0x07;   /* white */
+	vc->vc_ulcolor		= 0x0f;   /* bold white */
+	vc->vc_halfcolor       = 0x08;   /* grey */
+	init_waitqueue_head(&vc->paste_wait);
+	reset_terminal(vc, do_clear);
 }
 
 /*
@@ -2539,6 +2528,7 @@
 static int __init con_init(void)
 {
 	const char *display_desc = NULL;
+	struct vc_data *vc;
 	unsigned int currcons = 0;
 
 	acquire_console_sem();
@@ -2562,27 +2552,23 @@
 	 * kmalloc is not running yet - we use the bootmem allocator.
 	 */
 	for (currcons = 0; currcons < MIN_NR_CONSOLES; currcons++) {
-		vc_cons[currcons].d = (struct vc_data *)
-				alloc_bootmem(sizeof(struct vc_data));
-		vt_cons[currcons] = (struct vt_struct *)
-				alloc_bootmem(sizeof(struct vt_struct));
-		vc_cons[currcons].d->vc_vt = vt_cons[currcons];
-		visual_init(currcons, 1);
-		screenbuf = (unsigned short *) alloc_bootmem(screenbuf_size);
-		kmalloced = 0;
-		vc_init(currcons, vc_cons[currcons].d->vc_rows, vc_cons[currcons].d->vc_cols,
-			currcons || !sw->con_save_screen);
+		vc_cons[currcons].d = vc = alloc_bootmem(sizeof(struct vc_data));
+		visual_init(vc, currcons, 1);
+		vc->vc_screenbuf = (unsigned short *)alloc_bootmem(vc->vc_screenbuf_size);
+		vc->vc_kmalloced = 0;
+		vc_init(vc, vc->vc_rows, vc->vc_cols,
+			currcons || !vc->vc_sw->con_save_screen);
 	}
 	currcons = fg_console = 0;
-	master_display_fg = vc_cons[currcons].d;
-	set_origin(currcons);
-	save_screen(currcons);
-	gotoxy(vc_cons[currcons].d, x, y);
-	csi_J(currcons, 0);
-	update_screen(fg_console);
+	master_display_fg = vc = vc_cons[currcons].d;
+	set_origin(vc);
+	save_screen(vc);
+	gotoxy(vc, vc->vc_x, vc->vc_y);
+	csi_J(vc, 0);
+	update_screen(vc);
 	printk("Console: %s %s %dx%d",
-		vc_cons[currcons].d->vc_can_do_color ? "colour" : "mono",
-		display_desc, vc_cons[currcons].d->vc_cols, vc_cons[currcons].d->vc_rows);
+		vc->vc_can_do_color ? "colour" : "mono",
+		display_desc, vc->vc_cols, vc->vc_rows);
 	printable = 1;
 	printk("\n");
 
@@ -2676,37 +2662,37 @@
 
 	for (i = first; i <= last; i++) {
 		int old_was_color;
-		int currcons = i;
+		struct vc_data *vc = vc_cons[i].d;
 
 		if (con_driver_map[i])
 			module_put(con_driver_map[i]->owner);
 		__module_get(owner);
 		con_driver_map[i] = csw;
 
-		if (!vc_cons[i].d || !vc_cons[i].d->vc_sw)
+		if (!vc || !vc->vc_sw)
 			continue;
 
 		j = i;
-		if (IS_VISIBLE)
-			save_screen(i);
-		old_was_color = vc_cons[i].d->vc_can_do_color;
-		vc_cons[i].d->vc_sw->con_deinit(vc_cons[i].d);
-		origin = (unsigned long) screenbuf;
-		visible_origin = origin;
-		scr_end = origin + screenbuf_size;
-		pos = origin + vc_cons[currcons].d->vc_size_row*y + 2*x;
-		visual_init(i, 0);
-		update_attr(i);
+		if (CON_IS_VISIBLE(vc))
+			save_screen(vc);
+		old_was_color = vc->vc_can_do_color;
+		vc->vc_sw->con_deinit(vc);
+		vc->vc_origin = (unsigned long)vc->vc_screenbuf;
+		vc->vc_visible_origin = vc->vc_origin;
+		vc->vc_scr_end = vc->vc_origin + vc->vc_screenbuf_size;
+		vc->vc_pos = vc->vc_origin + vc->vc_size_row * vc->vc_y + 2 * vc->vc_x;
+		visual_init(vc, i, 0);
+		update_attr(vc);
 
 		/* If the console changed between mono <-> color, then
 		 * the attributes in the screenbuf will be wrong.  The
 		 * following resets all attributes to something sane.
 		 */
-		if (old_was_color != vc_cons[i].d->vc_can_do_color)
-			clear_buffer_attributes(i);
+		if (old_was_color != vc->vc_can_do_color)
+			clear_buffer_attributes(vc);
 
-		if (IS_VISIBLE)
-			update_screen(i);
+		if (CON_IS_VISIBLE(vc))
+			update_screen(vc);
 	}
 	printk("Console: switching ");
 	if (!deflt)
@@ -2773,7 +2759,7 @@
 
 void do_blank_screen(int entering_gfx)
 {
-	int currcons = fg_console;
+	struct vc_data *vc = vc_cons[fg_console].d;
 	int i;
 
 	WARN_CONSOLE_UNLOCKED();
@@ -2792,30 +2778,30 @@
 
 	/* entering graphics mode? */
 	if (entering_gfx) {
-		hide_cursor(vc_cons[currcons].d);
-		save_screen(currcons);
-		sw->con_blank(vc_cons[currcons].d, -1, 1);
+		hide_cursor(vc);
+		save_screen(vc);
+		vc->vc_sw->con_blank(vc, -1, 1);
 		console_blanked = fg_console + 1;
-		set_origin(currcons);
+		set_origin(vc);
 		return;
 	}
 
 	/* don't blank graphics */
-	if (vcmode != KD_TEXT) {
+	if (vc->vc_mode != KD_TEXT) {
 		console_blanked = fg_console + 1;
 		return;
 	}
 
-	hide_cursor(vc_cons[currcons].d);
+	hide_cursor(vc);
 	del_timer_sync(&console_timer);
 	blank_timer_expired = 0;
 
-	save_screen(currcons);
+	save_screen(vc);
 	/* In case we need to reset origin, blanking hook returns 1 */
-	i = sw->con_blank(vc_cons[currcons].d, 1, 0);
+	i = vc->vc_sw->con_blank(vc, 1, 0);
 	console_blanked = fg_console + 1;
 	if (i)
-		set_origin(currcons);
+		set_origin(vc);
 
 	if (console_blank_hook && console_blank_hook(1))
 		return;
@@ -2826,7 +2812,7 @@
 	}
 
     	if (vesa_blank_mode)
-		sw->con_blank(vc_cons[currcons].d, vesa_blank_mode + 1, 0);
+		vc->vc_sw->con_blank(vc, vesa_blank_mode + 1, 0);
 }
 EXPORT_SYMBOL(do_blank_screen);
 
@@ -2835,7 +2821,7 @@
  */
 void do_unblank_screen(int leaving_gfx)
 {
-	int currcons;
+	struct vc_data *vc;
 
 	WARN_CONSOLE_UNLOCKED();
 
@@ -2847,8 +2833,8 @@
 		printk("unblank_screen: tty %d not allocated ??\n", fg_console+1);
 		return;
 	}
-	currcons = fg_console;
-	if (vcmode != KD_TEXT)
+	vc = vc_cons[fg_console].d;
+	if (vc->vc_mode != KD_TEXT)
 		return; /* but leave console_blanked != 0 */
 
 	if (blankinterval) {
@@ -2857,13 +2843,13 @@
 	}
 
 	console_blanked = 0;
-	if (sw->con_blank(vc_cons[currcons].d, 0, leaving_gfx))
+	if (vc->vc_sw->con_blank(vc, 0, leaving_gfx))
 		/* Low-level driver cannot restore -> do it ourselves */
-		update_screen(fg_console);
+		update_screen(vc);
 	if (console_blank_hook)
 		console_blank_hook(0);
-	set_palette(currcons);
-	set_cursor(vc_cons[fg_console].d);
+	set_palette(vc);
+	set_cursor(vc);
 }
 EXPORT_SYMBOL(do_unblank_screen);
 
@@ -2899,7 +2885,7 @@
 	del_timer(&console_timer);
 	blank_timer_expired = 0;
 
-	if (ignore_poke || !vt_cons[fg_console] || vt_cons[fg_console]->vc_mode == KD_GRAPHICS)
+	if (ignore_poke || !vc_cons[fg_console].d || vc_cons[fg_console].d->vc_mode == KD_GRAPHICS)
 		return;
 	if (console_blanked)
 		unblank_screen();
@@ -2913,12 +2899,12 @@
  *	Palettes
  */
 
-void set_palette(int currcons)
+void set_palette(struct vc_data *vc)
 {
 	WARN_CONSOLE_UNLOCKED();
 
-	if (vcmode != KD_GRAPHICS)
-		sw->con_set_palette(vc_cons[currcons].d, color_table);
+	if (vc->vc_mode != KD_GRAPHICS)
+		vc->vc_sw->con_set_palette(vc, color_table);
 }
 
 static int set_get_cmap(unsigned char __user *arg, int set)
@@ -2945,7 +2931,7 @@
 		    vc_cons[i].d->vc_palette[k++] = default_grn[j];
 		    vc_cons[i].d->vc_palette[k++] = default_blu[j];
 		}
-		set_palette(i);
+		set_palette(vc_cons[i].d);
 	    }
     }
     return 0;
@@ -2978,15 +2964,15 @@
 	return rc;
 }
 
-void reset_palette(int currcons)
+void reset_palette(struct vc_data *vc)
 {
 	int j, k;
 	for (j=k=0; j<16; j++) {
-		palette[k++] = default_red[j];
-		palette[k++] = default_grn[j];
-		palette[k++] = default_blu[j];
+		vc->vc_palette[k++] = default_red[j];
+		vc->vc_palette[k++] = default_grn[j];
+		vc->vc_palette[k++] = default_blu[j];
 	}
-	set_palette(currcons);
+	set_palette(vc);
 }
 
 /*
@@ -3004,13 +2990,13 @@
 
 #define max_font_size 65536
 
-int con_font_get(int currcons, struct console_font_op *op)
+int con_font_get(struct vc_data *vc, struct console_font_op *op)
 {
 	struct console_font font;
 	int rc = -EINVAL;
 	int c;
 
-	if (vt_cons[currcons]->vc_mode != KD_TEXT)
+	if (vc->vc_mode != KD_TEXT)
 		return -EINVAL;
 
 	if (op->data) {
@@ -3021,8 +3007,8 @@
 		font.data = NULL;
 
 	acquire_console_sem();
-	if (sw->con_font_get)
-		rc = sw->con_font_get(vc_cons[currcons].d, &font);
+	if (vc->vc_sw->con_font_get)
+		rc = vc->vc_sw->con_font_get(vc, &font);
 	else
 		rc = -ENOSYS;
 	release_console_sem();
@@ -3059,13 +3045,13 @@
 	return rc;
 }
 
-int con_font_set(int currcons, struct console_font_op *op)
+int con_font_set(struct vc_data *vc, struct console_font_op *op)
 {
 	struct console_font font;
 	int rc = -EINVAL;
 	int size;
 
-	if (vt_cons[currcons]->vc_mode != KD_TEXT)
+	if (vc->vc_mode != KD_TEXT)
 		return -EINVAL;
 	if (!op->data)
 		return -EINVAL;
@@ -3107,8 +3093,8 @@
 		return -EFAULT;
 	}
 	acquire_console_sem();
-	if (sw->con_font_set)
-		rc = sw->con_font_set(vc_cons[currcons].d, &font, op->flags);
+	if (vc->vc_sw->con_font_set)
+		rc = vc->vc_sw->con_font_set(vc, &font, op->flags);
 	else
 		rc = -ENOSYS;
 	release_console_sem();
@@ -3116,14 +3102,14 @@
 	return rc;
 }
 
-int con_font_default(int currcons, struct console_font_op *op)
+int con_font_default(struct vc_data *vc, struct console_font_op *op)
 {
 	struct console_font font = {.width = op->width, .height = op->height};
 	char name[MAX_FONT_NAME];
 	char *s = name;
 	int rc;
 
-	if (vt_cons[currcons]->vc_mode != KD_TEXT)
+	if (vc->vc_mode != KD_TEXT)
 		return -EINVAL;
 
 	if (!op->data)
@@ -3134,8 +3120,8 @@
 		name[MAX_FONT_NAME - 1] = 0;
 
 	acquire_console_sem();
-	if (sw->con_font_default)
-		rc = sw->con_font_default(vc_cons[currcons].d, &font, s);
+	if (vc->vc_sw->con_font_default)
+		rc = vc->vc_sw->con_font_default(vc, &font, s);
 	else
 		rc = -ENOSYS;
 	release_console_sem();
@@ -3146,40 +3132,38 @@
 	return rc;
 }
 
-int con_font_copy(int currcons, struct console_font_op *op)
+int con_font_copy(struct vc_data *vc, struct console_font_op *op)
 {
 	int con = op->height;
-	struct vc_data *vc;
 	int rc;
 
-	if (vt_cons[currcons]->vc_mode != KD_TEXT)
+	if (vc->vc_mode != KD_TEXT)
 		return -EINVAL;
 
 	acquire_console_sem();
-	vc = vc_cons[currcons].d;
-	if (!sw->con_font_copy)
+	if (!vc->vc_sw->con_font_copy)
 		rc = -ENOSYS;
 	else if (con < 0 || !vc_cons_allocated(con))
 		rc = -ENOTTY;
 	else if (con == vc->vc_num)	/* nothing to do */
 		rc = 0;
 	else
-		rc = sw->con_font_copy(vc, con);
+		rc = vc->vc_sw->con_font_copy(vc, con);
 	release_console_sem();
 	return rc;
 }
 
-int con_font_op(int currcons, struct console_font_op *op)
+int con_font_op(struct vc_data *vc, struct console_font_op *op)
 {
 	switch (op->op) {
 	case KD_FONT_OP_SET:
-		return con_font_set(currcons, op);
+		return con_font_set(vc, op);
 	case KD_FONT_OP_GET:
-		return con_font_get(currcons, op);
+		return con_font_get(vc, op);
 	case KD_FONT_OP_SET_DEFAULT:
-		return con_font_default(currcons, op);
+		return con_font_default(vc, op);
 	case KD_FONT_OP_COPY:
-		return con_font_copy(currcons, op);
+		return con_font_copy(vc, op);
 	}
 	return -ENOSYS;
 }
@@ -3265,7 +3249,6 @@
 EXPORT_SYMBOL(fg_console);
 EXPORT_SYMBOL(console_blank_hook);
 EXPORT_SYMBOL(console_blanked);
-EXPORT_SYMBOL(vt_cons);
 EXPORT_SYMBOL(vc_cons);
 #ifndef VT_SINGLE_DRIVER
 EXPORT_SYMBOL(take_over_console);
diff -Nru a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c
--- a/drivers/char/vt_ioctl.c	2005-01-10 17:29:34 -08:00
+++ b/drivers/char/vt_ioctl.c	2005-03-07 20:41:34 -08:00
@@ -52,8 +52,6 @@
  * to the current console is done by the main ioctl code.
  */
 
-struct vt_struct *vt_cons[MAX_NR_CONSOLES];
-
 /* Keyboard type: Default is KB_101, but can be set by machine
  * specific code.
  */
@@ -311,7 +309,7 @@
 		op->height = cfdarg.charheight;
 		op->charcount = cfdarg.charcount;
 		op->data = cfdarg.chardata;
-		return con_font_op(fg_console, op);
+		return con_font_op(vc_cons[fg_console].d, op);
 	case GIO_FONTX: {
 		op->op = KD_FONT_OP_GET;
 		op->flags = KD_FONT_FLAG_OLD;
@@ -319,7 +317,7 @@
 		op->height = cfdarg.charheight;
 		op->charcount = cfdarg.charcount;
 		op->data = cfdarg.chardata;
-		i = con_font_op(fg_console, op);
+		i = con_font_op(vc_cons[fg_console].d, op);
 		if (i)
 			return i;
 		cfdarg.charheight = op->height;
@@ -333,7 +331,7 @@
 }
 
 static inline int 
-do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, unsigned int console)
+do_unimap_ioctl(int cmd, struct unimapdesc __user *user_ud, int perm, struct vc_data *vc)
 {
 	struct unimapdesc tmp;
 	int i = 0; 
@@ -349,11 +347,11 @@
 	case PIO_UNIMAP:
 		if (!perm)
 			return -EPERM;
-		return con_set_unimap(console, tmp.entry_ct, tmp.entries);
+		return con_set_unimap(vc, tmp.entry_ct, tmp.entries);
 	case GIO_UNIMAP:
-		if (!perm && fg_console != console)
+		if (!perm && fg_console != vc->vc_num)
 			return -EPERM;
-		return con_get_unimap(console, tmp.entry_ct, &(user_ud->entry_ct), tmp.entries);
+		return con_get_unimap(vc, tmp.entry_ct, &(user_ud->entry_ct), tmp.entries);
 	}
 	return 0;
 }
@@ -365,8 +363,7 @@
 int vt_ioctl(struct tty_struct *tty, struct file * file,
 	     unsigned int cmd, unsigned long arg)
 {
-	struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
-	struct vc_data *vc = vc_cons[vt->vc_num].d;
+	struct vc_data *vc = (struct vc_data *)tty->driver_data;
 	struct console_font_op op;	/* used in multiple places here */
 	struct kbd_struct * kbd;
 	unsigned int console;
@@ -374,7 +371,7 @@
 	void __user *up = (void __user *)arg;
 	int i, perm;
 	
-	console = vt->vc_num;
+	console = vc->vc_num;
 
 	if (!vc_cons_allocated(console)) 	/* impossible? */
 		return -ENOIOCTLCMD;
@@ -487,9 +484,9 @@
 		default:
 			return -EINVAL;
 		}
-		if (vt_cons[console]->vc_mode == (unsigned char) arg)
+		if (vc->vc_mode == (unsigned char) arg)
 			return 0;
-		vt_cons[console]->vc_mode = (unsigned char) arg;
+		vc->vc_mode = (unsigned char) arg;
 		if (console != fg_console)
 			return 0;
 		/*
@@ -504,7 +501,7 @@
 		return 0;
 
 	case KDGETMODE:
-		ucval = vt_cons[console]->vc_mode;
+		ucval = vc->vc_mode;
 		goto setint;
 
 	case KDMAPDISP:
@@ -667,12 +664,12 @@
 		if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS)
 			return -EINVAL;
 		acquire_console_sem();
-		vt_cons[console]->vt_mode = tmp;
+		vc->vt_mode = tmp;
 		/* the frsig is ignored, so we set it to 0 */
-		vt_cons[console]->vt_mode.frsig = 0;
-		vt_cons[console]->vt_pid = current->pid;
+		vc->vt_mode.frsig = 0;
+		vc->vt_pid = current->pid;
 		/* no switch is required -- saw@shade.msu.ru */
-		vt_cons[console]->vt_newvt = -1; 
+		vc->vt_newvt = -1;
 		release_console_sem();
 		return 0;
 	}
@@ -683,7 +680,7 @@
 		int rc;
 
 		acquire_console_sem();
-		memcpy(&tmp, &vt_cons[console]->vt_mode, sizeof(struct vt_mode));
+		memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode));
 		release_console_sem();
 
 		rc = copy_to_user(up, &tmp, sizeof(struct vt_mode));
@@ -761,31 +758,29 @@
 	case VT_RELDISP:
 		if (!perm)
 			return -EPERM;
-		if (vt_cons[console]->vt_mode.mode != VT_PROCESS)
+		if (vc->vt_mode.mode != VT_PROCESS)
 			return -EINVAL;
 
 		/*
 		 * Switching-from response
 		 */
-		if (vt_cons[console]->vt_newvt >= 0)
-		{
+		if (vc->vt_newvt >= 0) {
 			if (arg == 0)
 				/*
 				 * Switch disallowed, so forget we were trying
 				 * to do it.
 				 */
-				vt_cons[console]->vt_newvt = -1;
+				vc->vt_newvt = -1;
 
-			else
-			{
+			else {
 				/*
 				 * The current vt has been released, so
 				 * complete the switch.
 				 */
 				int newvt;
 				acquire_console_sem();
-				newvt = vt_cons[console]->vt_newvt;
-				vt_cons[console]->vt_newvt = -1;
+				newvt = vc->vt_newvt;
+				vc->vt_newvt = -1;
 				i = vc_allocate(newvt);
 				if (i) {
 					release_console_sem();
@@ -796,7 +791,7 @@
 				 * make sure we are atomic with respect to
 				 * other console switches..
 				 */
-				complete_change_console(newvt);
+				complete_change_console(vc_cons[newvt].d);
 				release_console_sem();
 			}
 		}
@@ -852,7 +847,7 @@
 			return -EFAULT;
 		for (i = 0; i < MAX_NR_CONSOLES; i++) {
 			acquire_console_sem();
-                        vc_resize(i, cc, ll);
+			vc_resize(vc_cons[i].d, cc, ll);
 			release_console_sem();
 		}
 		return 0;
@@ -900,7 +895,7 @@
 				vc_cons[i].d->vc_scan_lines = vlin;
 			if (clin)
 				vc_cons[i].d->vc_font.height = clin;
-			vc_resize(i, cc, ll);
+			vc_resize(vc_cons[i].d, cc, ll);
 			release_console_sem();
 		}
   		return 0;
@@ -915,7 +910,7 @@
 		op.height = 0;
 		op.charcount = 256;
 		op.data = up;
-		return con_font_op(fg_console, &op);
+		return con_font_op(vc_cons[fg_console].d, &op);
 	}
 
 	case GIO_FONT: {
@@ -925,7 +920,7 @@
 		op.height = 32;
 		op.charcount = 256;
 		op.data = up;
-		return con_font_op(fg_console, &op);
+		return con_font_op(vc_cons[fg_console].d, &op);
 	}
 
 	case PIO_CMAP:
@@ -953,9 +948,10 @@
 		{
 		op.op = KD_FONT_OP_SET_DEFAULT;
 		op.data = NULL;
-		i = con_font_op(fg_console, &op);
-		if (i) return i;
-		con_set_default_unimap(fg_console);
+		i = con_font_op(vc_cons[fg_console].d, &op);
+		if (i)
+			return i;
+		con_set_default_unimap(vc_cons[fg_console].d);
 		return 0;
 		}
 #endif
@@ -966,7 +962,7 @@
 			return -EFAULT;
 		if (!perm && op.op != KD_FONT_OP_GET)
 			return -EPERM;
-		i = con_font_op(console, &op);
+		i = con_font_op(vc, &op);
 		if (i) return i;
 		if (copy_to_user(up, &op, sizeof(op)))
 			return -EFAULT;
@@ -995,13 +991,13 @@
 			return -EPERM;
 		i = copy_from_user(&ui, up, sizeof(struct unimapinit));
 		if (i) return -EFAULT;
-		con_clear_unimap(console, &ui);
+		con_clear_unimap(vc, &ui);
 		return 0;
 	      }
 
 	case PIO_UNIMAP:
 	case GIO_UNIMAP:
-		return do_unimap_ioctl(cmd, up, perm, console);
+		return do_unimap_ioctl(cmd, up, perm, vc);
 
 	case VT_LOCKSWITCH:
 		if (!capable(CAP_SYS_TTY_CONFIG))
@@ -1054,25 +1050,25 @@
 
 #define vt_wake_waitactive() wake_up(&vt_activate_queue)
 
-void reset_vc(unsigned int new_console)
+void reset_vc(struct vc_data *vc)
 {
-	vt_cons[new_console]->vc_mode = KD_TEXT;
-	kbd_table[new_console].kbdmode = VC_XLATE;
-	vt_cons[new_console]->vt_mode.mode = VT_AUTO;
-	vt_cons[new_console]->vt_mode.waitv = 0;
-	vt_cons[new_console]->vt_mode.relsig = 0;
-	vt_cons[new_console]->vt_mode.acqsig = 0;
-	vt_cons[new_console]->vt_mode.frsig = 0;
-	vt_cons[new_console]->vt_pid = -1;
-	vt_cons[new_console]->vt_newvt = -1;
+	vc->vc_mode = KD_TEXT;
+	kbd_table[vc->vc_num].kbdmode = VC_XLATE;
+	vc->vt_mode.mode = VT_AUTO;
+	vc->vt_mode.waitv = 0;
+	vc->vt_mode.relsig = 0;
+	vc->vt_mode.acqsig = 0;
+	vc->vt_mode.frsig = 0;
+	vc->vt_pid = -1;
+	vc->vt_newvt = -1;
 	if (!in_interrupt())    /* Via keyboard.c:SAK() - akpm */
-		reset_palette(new_console) ;
+		reset_palette(vc);
 }
 
 /*
  * Performs the back end of a vt switch
  */
-void complete_change_console(unsigned int new_console)
+void complete_change_console(struct vc_data *vc)
 {
 	unsigned char old_vc_mode;
 
@@ -1083,8 +1079,8 @@
 	 * KD_TEXT mode or vice versa, which means we need to blank or
 	 * unblank the screen later.
 	 */
-	old_vc_mode = vt_cons[fg_console]->vc_mode;
-	switch_screen(new_console);
+	old_vc_mode = vc_cons[fg_console].d->vc_mode;
+	switch_screen(vc);
 
 	/*
 	 * This can't appear below a successful kill_proc().  If it did,
@@ -1096,9 +1092,8 @@
 	 * To account for this we duplicate this code below only if the
 	 * controlling process is gone and we've called reset_vc.
 	 */
-	if (old_vc_mode != vt_cons[new_console]->vc_mode)
-	{
-		if (vt_cons[new_console]->vc_mode == KD_TEXT)
+	if (old_vc_mode != vc->vc_mode) {
+		if (vc->vc_mode == KD_TEXT)
 			do_unblank_screen(1);
 		else
 			do_blank_screen(1);
@@ -1109,17 +1104,13 @@
 	 * telling it that it has acquired. Also check if it has died and
 	 * clean up (similar to logic employed in change_console())
 	 */
-	if (vt_cons[new_console]->vt_mode.mode == VT_PROCESS)
-	{
+	if (vc->vt_mode.mode == VT_PROCESS) {
 		/*
 		 * Send the signal as privileged - kill_proc() will
 		 * tell us if the process has gone or something else
 		 * is awry
 		 */
-		if (kill_proc(vt_cons[new_console]->vt_pid,
-			      vt_cons[new_console]->vt_mode.acqsig,
-			      1) != 0)
-		{
+		if (kill_proc(vc->vt_pid, vc->vt_mode.acqsig, 1) != 0) {
 		/*
 		 * The controlling process has died, so we revert back to
 		 * normal operation. In this case, we'll also change back
@@ -1129,11 +1120,10 @@
 		 * this outside of VT_PROCESS but there is no single process
 		 * to account for and tracking tty count may be undesirable.
 		 */
-		        reset_vc(new_console);
+			reset_vc(vc);
 
-			if (old_vc_mode != vt_cons[new_console]->vc_mode)
-			{
-				if (vt_cons[new_console]->vc_mode == KD_TEXT)
+			if (old_vc_mode != vc->vc_mode) {
+				if (vc->vc_mode == KD_TEXT)
 					do_unblank_screen(1);
 				else
 					do_blank_screen(1);
@@ -1151,11 +1141,11 @@
 /*
  * Performs the front-end of a vt switch
  */
-void change_console(unsigned int new_console)
+void change_console(struct vc_data *new_vc)
 {
-        if ((new_console == fg_console) || (vt_dont_switch))
-                return;
-        if (!vc_cons_allocated(new_console))
+	struct vc_data *vc;
+
+	if (!new_vc || new_vc->vc_num == fg_console || vt_dont_switch)
 		return;
 
 	/*
@@ -1173,23 +1163,20 @@
 	 * the user waits just the right amount of time :-) and revert the
 	 * vt to auto control.
 	 */
-	if (vt_cons[fg_console]->vt_mode.mode == VT_PROCESS)
-	{
+	vc = vc_cons[fg_console].d;
+	if (vc->vt_mode.mode == VT_PROCESS) {
 		/*
 		 * Send the signal as privileged - kill_proc() will
 		 * tell us if the process has gone or something else
 		 * is awry
 		 */
-		if (kill_proc(vt_cons[fg_console]->vt_pid,
-			      vt_cons[fg_console]->vt_mode.relsig,
-			      1) == 0)
-		{
+		if (kill_proc(vc->vt_pid, vc->vt_mode.relsig, 1) == 0) {
 			/*
 			 * It worked. Mark the vt to switch to and
 			 * return. The process needs to send us a
 			 * VT_RELDISP ioctl to complete the switch.
 			 */
-			vt_cons[fg_console]->vt_newvt = new_console;
+			vc->vt_newvt = new_vc->vc_num;
 			return;
 		}
 
@@ -1202,7 +1189,7 @@
 		 * this outside of VT_PROCESS but there is no single process
 		 * to account for and tracking tty count may be undesirable.
 		 */
-		reset_vc(fg_console);
+		reset_vc(vc);
 
 		/*
 		 * Fall through to normal (VT_AUTO) handling of the switch...
@@ -1212,8 +1199,8 @@
 	/*
 	 * Ignore all switches in KD_GRAPHICS+VT_AUTO mode
 	 */
-	if (vt_cons[fg_console]->vc_mode == KD_GRAPHICS)
+	if (vc->vc_mode == KD_GRAPHICS)
 		return;
 
-	complete_change_console(new_console);
+	complete_change_console(new_vc);
 }
diff -Nru a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig
--- a/drivers/char/watchdog/Kconfig	2004-12-22 02:54:00 -08:00
+++ b/drivers/char/watchdog/Kconfig	2005-03-07 20:41:30 -08:00
@@ -268,12 +268,12 @@
 
 config SCx200_WDT
 	tristate "National Semiconductor SCx200 Watchdog"
-	depends on WATCHDOG && X86 && PCI
+	depends on WATCHDOG && SCx200 && PCI
 	help
 	  Enable the built-in watchdog timer support on the National
 	  Semiconductor SCx200 processors.
 
-	  If compiled as a module, it will be called scx200_watchdog.
+	  If compiled as a module, it will be called scx200_wdt.
 
 config 60XX_WDT
 	tristate "SBC-60XX Watchdog Timer"
diff -Nru a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c
--- a/drivers/char/watchdog/pcwd_usb.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/char/watchdog/pcwd_usb.c	2005-03-07 20:45:15 -08:00
@@ -227,7 +227,7 @@
 	if (usb_control_msg(usb_pcwd->udev, usb_sndctrlpipe(usb_pcwd->udev, 0),
 			HID_REQ_SET_REPORT, HID_DT_REPORT,
 			0x0200, usb_pcwd->interface_number, buf, sizeof(buf),
-			HZ) != sizeof(buf)) {
+			1000) != sizeof(buf)) {
 		dbg("usb_pcwd_send_command: error in usb_control_msg for cmd 0x%x 0x%x 0x%x\n", cmd, *msb, *lsb);
 	}
 	/* wait till the usb card processed the command,
diff -Nru a/drivers/char/watchdog/sa1100_wdt.c b/drivers/char/watchdog/sa1100_wdt.c
--- a/drivers/char/watchdog/sa1100_wdt.c	2004-09-30 06:37:23 -07:00
+++ b/drivers/char/watchdog/sa1100_wdt.c	2005-02-25 10:53:29 -08:00
@@ -35,7 +35,7 @@
 #include <asm/bitops.h>
 #include <asm/uaccess.h>
 
-#define OSCR_FREQ		3686400
+#define OSCR_FREQ		CLOCK_TICK_RATE
 #define SA1100_CLOSE_MAGIC	(0x5afc4453)
 
 static unsigned long sa1100wdt_users;
diff -Nru a/drivers/char/watchdog/scx200_wdt.c b/drivers/char/watchdog/scx200_wdt.c
--- a/drivers/char/watchdog/scx200_wdt.c	2004-09-29 11:07:04 -07:00
+++ b/drivers/char/watchdog/scx200_wdt.c	2005-03-07 20:41:30 -08:00
@@ -4,7 +4,7 @@
 
    Copyright (c) 2001,2002 Christer Weinigel <wingel@nano-system.com>
 
-   Som code taken from:
+   Some code taken from:
    National Semiconductor PC87307/PC97307 (ala SC1200) WDT driver
    (c) Copyright 2002 Zwane Mwaikambo <zwane@commfireservices.com>
 
@@ -64,7 +64,7 @@
 
 static void scx200_wdt_ping(void)
 {
-	outw(wdto_restart, SCx200_CB_BASE + SCx200_WDT_WDTO);
+	outw(wdto_restart, scx200_cb_base + SCx200_WDT_WDTO);
 }
 
 static void scx200_wdt_update_margin(void)
@@ -78,9 +78,9 @@
 	printk(KERN_DEBUG NAME ": enabling watchdog timer, wdto_restart = %d\n",
 	       wdto_restart);
 
-	outw(0, SCx200_CB_BASE + SCx200_WDT_WDTO);
-	outb(SCx200_WDT_WDSTS_WDOVF, SCx200_CB_BASE + SCx200_WDT_WDSTS);
-	outw(W_ENABLE, SCx200_CB_BASE + SCx200_WDT_WDCNFG);
+	outw(0, scx200_cb_base + SCx200_WDT_WDTO);
+	outb(SCx200_WDT_WDSTS_WDOVF, scx200_cb_base + SCx200_WDT_WDSTS);
+	outw(W_ENABLE, scx200_cb_base + SCx200_WDT_WDCNFG);
 
 	scx200_wdt_ping();
 }
@@ -89,9 +89,9 @@
 {
 	printk(KERN_DEBUG NAME ": disabling watchdog timer\n");
 
-	outw(0, SCx200_CB_BASE + SCx200_WDT_WDTO);
-	outb(SCx200_WDT_WDSTS_WDOVF, SCx200_CB_BASE + SCx200_WDT_WDSTS);
-	outw(W_DISABLE, SCx200_CB_BASE + SCx200_WDT_WDCNFG);
+	outw(0, scx200_cb_base + SCx200_WDT_WDTO);
+	outb(SCx200_WDT_WDSTS_WDOVF, scx200_cb_base + SCx200_WDT_WDSTS);
+	outw(W_DISABLE, scx200_cb_base + SCx200_WDT_WDCNFG);
 }
 
 static int scx200_wdt_open(struct inode *inode, struct file *file)
@@ -217,28 +217,14 @@
 static int __init scx200_wdt_init(void)
 {
 	int r;
-	static struct pci_device_id ns_sc[] = {
-		{ PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SCx200_BRIDGE) },
-		{ PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_SC1100_BRIDGE) },
-		{ },
-	};
 
 	printk(KERN_DEBUG NAME ": NatSemi SCx200 Watchdog Driver\n");
 
-	/*
-	 * First check that this really is a NatSemi SCx200 CPU or a Geode
-	 * SC1100 processor
-	 */
-	if (!pci_dev_present(ns_sc))
-		return -ENODEV;
-
-	/* More sanity checks, verify that the configuration block is there */
-	if (!scx200_cb_probe(SCx200_CB_BASE)) {
-		printk(KERN_WARNING NAME ": no configuration block found\n");
+	/* check that we have found the configuration block */
+	if (!scx200_cb_present())
 		return -ENODEV;
-	}
 
-	if (!request_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+	if (!request_region(scx200_cb_base + SCx200_WDT_OFFSET,
 			    SCx200_WDT_SIZE,
 			    "NatSemi SCx200 Watchdog")) {
 		printk(KERN_WARNING NAME ": watchdog I/O region busy\n");
@@ -252,7 +238,7 @@
 
 	r = misc_register(&scx200_wdt_miscdev);
 	if (r) {
-		release_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+		release_region(scx200_cb_base + SCx200_WDT_OFFSET,
 				SCx200_WDT_SIZE);
 		return r;
 	}
@@ -261,7 +247,7 @@
 	if (r) {
 		printk(KERN_ERR NAME ": unable to register reboot notifier");
 		misc_deregister(&scx200_wdt_miscdev);
-		release_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+		release_region(scx200_cb_base + SCx200_WDT_OFFSET,
 				SCx200_WDT_SIZE);
 		return r;
 	}
@@ -273,7 +259,7 @@
 {
 	unregister_reboot_notifier(&scx200_wdt_notifier);
 	misc_deregister(&scx200_wdt_miscdev);
-	release_region(SCx200_CB_BASE + SCx200_WDT_OFFSET,
+	release_region(scx200_cb_base + SCx200_WDT_OFFSET,
 		       SCx200_WDT_SIZE);
 }
 
diff -Nru a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
--- a/drivers/firmware/efivars.c	2005-01-20 21:02:15 -08:00
+++ b/drivers/firmware/efivars.c	2005-03-07 20:41:43 -08:00
@@ -665,14 +665,22 @@
 {
 	efi_status_t status = EFI_NOT_FOUND;
 	efi_guid_t vendor_guid;
-	efi_char16_t *variable_name = kmalloc(1024, GFP_KERNEL);
+	efi_char16_t *variable_name;
 	struct subsys_attribute *attr;
 	unsigned long variable_name_size = 1024;
-	int i, rc = 0, error = 0;
+	int i, error = 0;
 
 	if (!efi_enabled)
 		return -ENODEV;
 
+	variable_name = kmalloc(variable_name_size, GFP_KERNEL);
+	if (!variable_name) {
+		printk(KERN_ERR "efivars: Memory allocation failed.\n");
+		return -ENOMEM;
+	}
+
+	memset(variable_name, 0, variable_name_size);
+
 	printk(KERN_INFO "EFI Variables Facility v%s %s\n", EFIVARS_VERSION,
 	       EFIVARS_DATE);
 
@@ -680,21 +688,27 @@
 	 * For now we'll register the efi subsys within this driver
 	 */
 
-	rc = firmware_register(&efi_subsys);
+	error = firmware_register(&efi_subsys);
 
-	if (rc)
-		return rc;
+	if (error) {
+		printk(KERN_ERR "efivars: Firmware registration failed with error %d.\n", error);
+		goto out_free;
+	}
 
 	kset_set_kset_s(&vars_subsys, efi_subsys);
-	subsystem_register(&vars_subsys);
+
+	error = subsystem_register(&vars_subsys);
+
+	if (error) {
+		printk(KERN_ERR "efivars: Subsystem registration failed with error %d.\n", error);
+		goto out_firmware_unregister;
+	}
 
 	/*
 	 * Per EFI spec, the maximum storage allocated for both
 	 * the variable name and variable data is 1024 bytes.
 	 */
 
-	memset(variable_name, 0, 1024);
-
 	do {
 		variable_name_size = 1024;
 
@@ -734,8 +748,20 @@
 			error = subsys_create_file(&efi_subsys, attr);
 	}
 
+	if (error)
+		printk(KERN_ERR "efivars: Sysfs attribute export failed with error %d.\n", error);
+	else
+		goto out_free;
+
+	subsystem_unregister(&vars_subsys);
+
+out_firmware_unregister:
+	firmware_unregister(&efi_subsys);
+
+out_free:
 	kfree(variable_name);
-	return 0;
+
+	return error;
 }
 
 static void __exit
diff -Nru a/drivers/i2c/algos/i2c-algo-ite.c b/drivers/i2c/algos/i2c-algo-ite.c
--- a/drivers/i2c/algos/i2c-algo-ite.c	2004-09-01 15:10:04 -07:00
+++ b/drivers/i2c/algos/i2c-algo-ite.c	2005-03-02 09:55:03 -08:00
@@ -490,7 +490,7 @@
  * condition.
  */
 #if 0
-static int iic_combined_transaction(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) 
+static int iic_combined_transaction(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num) 
 {
    int i;
    struct i2c_msg *pmsg;
@@ -600,7 +600,7 @@
  * verify that the bus is not busy or in some unknown state.
  */
 static int iic_xfer(struct i2c_adapter *i2c_adap,
-		    struct i2c_msg msgs[], 
+		    struct i2c_msg *msgs, 
 		    int num)
 {
 	struct i2c_algo_iic_data *adap = i2c_adap->algo_data;
diff -Nru a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
--- a/drivers/i2c/algos/i2c-algo-pca.c	2004-12-07 03:14:09 -08:00
+++ b/drivers/i2c/algos/i2c-algo-pca.c	2005-03-02 09:55:02 -08:00
@@ -178,7 +178,7 @@
 }
 
 static int pca_xfer(struct i2c_adapter *i2c_adap,
-                    struct i2c_msg msgs[],
+                    struct i2c_msg *msgs,
                     int num)
 {
         struct i2c_algo_pca_data *adap = i2c_adap->algo_data;
@@ -186,6 +186,7 @@
         int curmsg;
 	int numbytes = 0;
 	int state;
+	int ret;
 
 	state = pca_status(adap);
 	if ( state != 0xF8 ) {
@@ -218,6 +219,7 @@
 	}
 
 	curmsg = 0;
+	ret = -EREMOTEIO;
 	while (curmsg < num) {
 		state = pca_status(adap);
 
@@ -251,7 +253,7 @@
 		case 0x20: /* SLA+W has been transmitted; NOT ACK has been received */
 			DEB2("NOT ACK received after SLA+W\n");
 			pca_stop(adap);
-			return -EREMOTEIO;
+			goto out;
 
 		case 0x40: /* SLA+R has been transmitted; ACK has been received */
 			pca_rx_ack(adap, msg->len > 1);
@@ -263,7 +265,7 @@
 				numbytes++;
 				pca_rx_ack(adap, numbytes < msg->len - 1);
 				break;
-			} 
+			}
 			curmsg++; numbytes = 0;
 			if (curmsg == num)
 				pca_stop(adap);
@@ -274,15 +276,15 @@
 		case 0x48: /* SLA+R has been transmitted; NOT ACK has been received */
 			DEB2("NOT ACK received after SLA+R\n");
 			pca_stop(adap);
-			return -EREMOTEIO;
+			goto out;
 
 		case 0x30: /* Data byte in I2CDAT has been transmitted; NOT ACK has been received */
 			DEB2("NOT ACK received after data byte\n");
-			return -EREMOTEIO;
+			goto out;
 
 		case 0x38: /* Arbitration lost during SLA+W, SLA+R or data bytes */
 			DEB2("Arbitration lost\n");
-			return -EREMOTEIO;
+			goto out;
 			
 		case 0x58: /* Data byte has been received; NOT ACK has been returned */
 			if ( numbytes == msg->len - 1 ) {
@@ -297,21 +299,21 @@
 				     "Not final byte. numbytes %d. len %d\n",
 				     numbytes, msg->len);
 				pca_stop(adap);
-				return -EREMOTEIO;
+				goto out;
 			}
 			break;
 		case 0x70: /* Bus error - SDA stuck low */
 			DEB2("BUS ERROR - SDA Stuck low\n");
 			pca_reset(adap);
-			return -EREMOTEIO;
+			goto out;
 		case 0x90: /* Bus error - SCL stuck low */
 			DEB2("BUS ERROR - SCL Stuck low\n");
 			pca_reset(adap);
-			return -EREMOTEIO;
+			goto out;
 		case 0x00: /* Bus error during master or slave mode due to illegal START or STOP condition */
 			DEB2("BUS ERROR - Illegal START or STOP\n");
 			pca_reset(adap);
-			return -EREMOTEIO;
+			goto out;
 		default:
 			printk(KERN_ERR DRIVER ": unhandled SIO state 0x%02x\n", state);
 			break;
@@ -319,11 +321,13 @@
 		
 	}
 
-	DEB1(KERN_CRIT "}}} transfered %d messages. "
+	ret = curmsg;
+ out:
+	DEB1(KERN_CRIT "}}} transfered %d/%d messages. "
 	     "status is %#04x. control is %#04x\n", 
-	     num, pca_status(adap),
+	     curmsg, num, pca_status(adap),
 	     pca_get_con(adap));
-	return curmsg;
+	return ret;
 }
 
 static u32 pca_func(struct i2c_adapter *adap)
diff -Nru a/drivers/i2c/algos/i2c-algo-pcf.c b/drivers/i2c/algos/i2c-algo-pcf.c
--- a/drivers/i2c/algos/i2c-algo-pcf.c	2004-12-07 02:14:58 -08:00
+++ b/drivers/i2c/algos/i2c-algo-pcf.c	2005-03-02 09:55:03 -08:00
@@ -332,7 +332,7 @@
 }
 
 static int pcf_xfer(struct i2c_adapter *i2c_adap,
-		    struct i2c_msg msgs[], 
+		    struct i2c_msg *msgs, 
 		    int num)
 {
 	struct i2c_algo_pcf_data *adap = i2c_adap->algo_data;
diff -Nru a/drivers/i2c/algos/i2c-algo-sgi.c b/drivers/i2c/algos/i2c-algo-sgi.c
--- a/drivers/i2c/algos/i2c-algo-sgi.c	2003-09-30 07:27:22 -07:00
+++ b/drivers/i2c/algos/i2c-algo-sgi.c	2005-03-02 09:55:02 -08:00
@@ -131,7 +131,7 @@
 	return 0;
 }
 
-static int sgi_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[],
+static int sgi_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
 		    int num)
 {
 	struct i2c_algo_sgi_data *adap = i2c_adap->algo_data;
diff -Nru a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
--- a/drivers/i2c/busses/Kconfig	2005-01-30 22:33:41 -08:00
+++ b/drivers/i2c/busses/Kconfig	2005-03-02 09:55:46 -08:00
@@ -287,7 +287,7 @@
 
 config I2C_PIIX4
 	tristate "Intel PIIX4"
-	depends on I2C && PCI && EXPERIMENTAL && !64BIT
+	depends on I2C && PCI && EXPERIMENTAL
 	help
 	  If you say yes to this option, support will be included for the Intel
 	  PIIX4 family of mainboard I2C interfaces.  Specifically, the following
@@ -485,5 +485,15 @@
 	  
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-pca-isa.
+
+config I2C_MV64XXX
+	tristate "Marvell mv64xxx I2C Controller"
+	depends on I2C && MV64X60 && EXPERIMENTAL
+	help
+	  If you say yes to this option, support will be included for the
+	  built-in I2C interface on the Marvell 64xxx line of host bridges.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called i2c-mv64xxx.
 
 endmenu
diff -Nru a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
--- a/drivers/i2c/busses/Makefile	2005-01-30 22:33:41 -08:00
+++ b/drivers/i2c/busses/Makefile	2005-03-02 09:56:05 -08:00
@@ -21,6 +21,7 @@
 obj-$(CONFIG_I2C_IXP4XX)	+= i2c-ixp4xx.o
 obj-$(CONFIG_I2C_KEYWEST)	+= i2c-keywest.o
 obj-$(CONFIG_I2C_MPC)		+= i2c-mpc.o
+obj-$(CONFIG_I2C_MV64XXX)	+= i2c-mv64xxx.o
 obj-$(CONFIG_I2C_NFORCE2)	+= i2c-nforce2.o
 obj-$(CONFIG_I2C_PARPORT)	+= i2c-parport.o
 obj-$(CONFIG_I2C_PARPORT_LIGHT)	+= i2c-parport-light.o
diff -Nru a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c
--- a/drivers/i2c/busses/i2c-au1550.c	2005-01-30 22:33:41 -08:00
+++ b/drivers/i2c/busses/i2c-au1550.c	2005-03-02 09:55:03 -08:00
@@ -253,7 +253,7 @@
 }
 
 static int
-au1550_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num)
+au1550_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, int num)
 {
 	struct i2c_au1550_data *adap = i2c_adap->algo_data;
 	struct i2c_msg *p;
diff -Nru a/drivers/i2c/busses/i2c-elektor.c b/drivers/i2c/busses/i2c-elektor.c
--- a/drivers/i2c/busses/i2c-elektor.c	2004-11-24 07:28:07 -08:00
+++ b/drivers/i2c/busses/i2c-elektor.c	2005-03-02 09:54:29 -08:00
@@ -183,6 +183,7 @@
 
 static struct i2c_adapter pcf_isa_ops = {
 	.owner		= THIS_MODULE,
+	.class		= I2C_CLASS_HWMON,
 	.id		= I2C_HW_P_ELEK,
 	.algo_data	= &pcf_isa_data,
 	.name		= "PCF8584 ISA adapter",
diff -Nru a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
--- a/drivers/i2c/busses/i2c-ibm_iic.c	2004-11-27 10:18:32 -08:00
+++ b/drivers/i2c/busses/i2c-ibm_iic.c	2005-03-02 09:55:03 -08:00
@@ -549,7 +549,7 @@
  * Generic master transfer entrypoint. 
  * Returns the number of processed messages or error (<0)
  */
-static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
+static int iic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
 {
     	struct ibm_iic_private* dev = (struct ibm_iic_private*)(i2c_get_adapdata(adap));
 	volatile struct iic_regs __iomem *iic = dev->vaddr;
diff -Nru a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
--- a/drivers/i2c/busses/i2c-iop3xx.c	2005-01-04 16:22:34 -08:00
+++ b/drivers/i2c/busses/i2c-iop3xx.c	2005-03-02 09:55:02 -08:00
@@ -361,7 +361,7 @@
  * master_xfer() - main read/write entry
  */
 static int 
-iop3xx_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], 
+iop3xx_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, 
 				int num)
 {
 	struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data;
diff -Nru a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c
--- a/drivers/i2c/busses/i2c-ixp4xx.c	2004-04-14 16:44:56 -07:00
+++ b/drivers/i2c/busses/i2c-ixp4xx.c	2005-03-02 09:55:39 -08:00
@@ -133,8 +133,8 @@
 	drv_data->algo_data.mdelay = 10;
 	drv_data->algo_data.timeout = 100;
 
-	drv_data->adapter.id = I2C_HW_B_IXP4XX,
-	drv_data->adapter.algo_data = &drv_data->algo_data,
+	drv_data->adapter.id = I2C_HW_B_IXP4XX;
+	drv_data->adapter.algo_data = &drv_data->algo_data;
 
 	drv_data->adapter.dev.parent = &plat_dev->dev;
 
diff -Nru a/drivers/i2c/busses/i2c-keywest.c b/drivers/i2c/busses/i2c-keywest.c
--- a/drivers/i2c/busses/i2c-keywest.c	2004-11-27 10:18:32 -08:00
+++ b/drivers/i2c/busses/i2c-keywest.c	2005-03-02 09:55:02 -08:00
@@ -399,7 +399,7 @@
  */
 static int
 keywest_xfer(	struct i2c_adapter *adap,
-		struct i2c_msg msgs[], 
+		struct i2c_msg *msgs, 
 		int num)
 {
 	struct keywest_chan* chan = i2c_get_adapdata(adap);
diff -Nru a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
--- a/drivers/i2c/busses/i2c-mpc.c	2005-01-14 14:17:16 -08:00
+++ b/drivers/i2c/busses/i2c-mpc.c	2005-03-02 09:55:02 -08:00
@@ -233,7 +233,7 @@
 	return length;
 }
 
-static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
+static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
 {
 	struct i2c_msg *pmsg;
 	int i;
diff -Nru a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/i2c/busses/i2c-mv64xxx.c	2005-03-02 09:56:05 -08:00
@@ -0,0 +1,596 @@
+/*
+ * drivers/i2c/busses/i2c-mv64xxx.c
+ * 
+ * Driver for the i2c controller on the Marvell line of host bridges for MIPS
+ * and PPC (e.g, gt642[46]0, mv643[46]0, mv644[46]0).
+ *
+ * Author: Mark A. Greer <mgreer@mvista.com>
+ *
+ * 2005 (c) MontaVista, Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/spinlock.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/mv643xx.h>
+#include <asm/io.h>
+
+/* Register defines */
+#define	MV64XXX_I2C_REG_SLAVE_ADDR			0x00
+#define	MV64XXX_I2C_REG_DATA				0x04
+#define	MV64XXX_I2C_REG_CONTROL				0x08
+#define	MV64XXX_I2C_REG_STATUS				0x0c
+#define	MV64XXX_I2C_REG_BAUD				0x0c
+#define	MV64XXX_I2C_REG_EXT_SLAVE_ADDR			0x10
+#define	MV64XXX_I2C_REG_SOFT_RESET			0x1c
+
+#define	MV64XXX_I2C_REG_CONTROL_ACK			0x00000004
+#define	MV64XXX_I2C_REG_CONTROL_IFLG			0x00000008
+#define	MV64XXX_I2C_REG_CONTROL_STOP			0x00000010
+#define	MV64XXX_I2C_REG_CONTROL_START			0x00000020
+#define	MV64XXX_I2C_REG_CONTROL_TWSIEN			0x00000040
+#define	MV64XXX_I2C_REG_CONTROL_INTEN			0x00000080
+
+/* Ctlr status values */
+#define	MV64XXX_I2C_STATUS_BUS_ERR			0x00
+#define	MV64XXX_I2C_STATUS_MAST_START			0x08
+#define	MV64XXX_I2C_STATUS_MAST_REPEAT_START		0x10
+#define	MV64XXX_I2C_STATUS_MAST_WR_ADDR_ACK		0x18
+#define	MV64XXX_I2C_STATUS_MAST_WR_ADDR_NO_ACK		0x20
+#define	MV64XXX_I2C_STATUS_MAST_WR_ACK			0x28
+#define	MV64XXX_I2C_STATUS_MAST_WR_NO_ACK		0x30
+#define	MV64XXX_I2C_STATUS_MAST_LOST_ARB		0x38
+#define	MV64XXX_I2C_STATUS_MAST_RD_ADDR_ACK		0x40
+#define	MV64XXX_I2C_STATUS_MAST_RD_ADDR_NO_ACK		0x48
+#define	MV64XXX_I2C_STATUS_MAST_RD_DATA_ACK		0x50
+#define	MV64XXX_I2C_STATUS_MAST_RD_DATA_NO_ACK		0x58
+#define	MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_ACK		0xd0
+#define	MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_NO_ACK	0xd8
+#define	MV64XXX_I2C_STATUS_MAST_RD_ADDR_2_ACK		0xe0
+#define	MV64XXX_I2C_STATUS_MAST_RD_ADDR_2_NO_ACK	0xe8
+#define	MV64XXX_I2C_STATUS_NO_STATUS			0xf8
+
+/* Driver states */
+enum {
+	MV64XXX_I2C_STATE_INVALID,
+	MV64XXX_I2C_STATE_IDLE,
+	MV64XXX_I2C_STATE_WAITING_FOR_START_COND,
+	MV64XXX_I2C_STATE_WAITING_FOR_ADDR_1_ACK,
+	MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK,
+	MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK,
+	MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA,
+	MV64XXX_I2C_STATE_ABORTING,
+};
+
+/* Driver actions */
+enum {
+	MV64XXX_I2C_ACTION_INVALID,
+	MV64XXX_I2C_ACTION_CONTINUE,
+	MV64XXX_I2C_ACTION_SEND_START,
+	MV64XXX_I2C_ACTION_SEND_ADDR_1,
+	MV64XXX_I2C_ACTION_SEND_ADDR_2,
+	MV64XXX_I2C_ACTION_SEND_DATA,
+	MV64XXX_I2C_ACTION_RCV_DATA,
+	MV64XXX_I2C_ACTION_RCV_DATA_STOP,
+	MV64XXX_I2C_ACTION_SEND_STOP,
+};
+
+struct mv64xxx_i2c_data {
+	int			irq;
+	u32			state;
+	u32			action;
+	u32			cntl_bits;
+	void __iomem		*reg_base;
+	u32			reg_base_p;
+	u32			addr1;
+	u32			addr2;
+	u32			bytes_left;
+	u32			byte_posn;
+	u32			block;
+	int			rc;
+	u32			freq_m;
+	u32			freq_n;
+	wait_queue_head_t	waitq;
+	spinlock_t		lock;
+	struct i2c_msg		*msg;
+	struct i2c_adapter	adapter;
+};
+
+/*
+ *****************************************************************************
+ *
+ *	Finite State Machine & Interrupt Routines
+ *
+ *****************************************************************************
+ */
+static void
+mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
+{
+	/*
+	 * If state is idle, then this is likely the remnants of an old
+	 * operation that driver has given up on or the user has killed.
+	 * If so, issue the stop condition and go to idle.
+	 */
+	if (drv_data->state == MV64XXX_I2C_STATE_IDLE) {
+		drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
+		return;
+	}
+
+	if (drv_data->state == MV64XXX_I2C_STATE_ABORTING) {
+		drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
+		drv_data->state = MV64XXX_I2C_STATE_IDLE;
+		return;
+	}
+
+	/* The status from the ctlr [mostly] tells us what to do next */
+	switch (status) {
+	/* Start condition interrupt */
+	case MV64XXX_I2C_STATUS_MAST_START: /* 0x08 */
+	case MV64XXX_I2C_STATUS_MAST_REPEAT_START: /* 0x10 */
+		drv_data->action = MV64XXX_I2C_ACTION_SEND_ADDR_1;
+		drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_ADDR_1_ACK;
+		break;
+
+	/* Performing a write */
+	case MV64XXX_I2C_STATUS_MAST_WR_ADDR_ACK: /* 0x18 */
+		if (drv_data->msg->flags & I2C_M_TEN) {
+			drv_data->action = MV64XXX_I2C_ACTION_SEND_ADDR_2;
+			drv_data->state =
+				MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK;
+			break;
+		}
+		/* FALLTHRU */
+	case MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_ACK: /* 0xd0 */
+	case MV64XXX_I2C_STATUS_MAST_WR_ACK: /* 0x28 */
+		if (drv_data->bytes_left > 0) {
+			drv_data->action = MV64XXX_I2C_ACTION_SEND_DATA;
+			drv_data->state =
+				MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK;
+			drv_data->bytes_left--;
+		} else {
+			drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
+			drv_data->state = MV64XXX_I2C_STATE_IDLE;
+		}
+		break;
+
+	/* Performing a read */
+	case MV64XXX_I2C_STATUS_MAST_RD_ADDR_ACK: /* 40 */
+		if (drv_data->msg->flags & I2C_M_TEN) {
+			drv_data->action = MV64XXX_I2C_ACTION_SEND_ADDR_2;
+			drv_data->state =
+				MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK;
+			break;
+		}
+		/* FALLTHRU */
+	case MV64XXX_I2C_STATUS_MAST_RD_ADDR_2_ACK: /* 0xe0 */
+		if (drv_data->bytes_left == 0) {
+			drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
+			drv_data->state = MV64XXX_I2C_STATE_IDLE;
+			break;
+		}
+		/* FALLTHRU */
+	case MV64XXX_I2C_STATUS_MAST_RD_DATA_ACK: /* 0x50 */
+		if (status != MV64XXX_I2C_STATUS_MAST_RD_DATA_ACK)
+			drv_data->action = MV64XXX_I2C_ACTION_CONTINUE;
+		else {
+			drv_data->action = MV64XXX_I2C_ACTION_RCV_DATA;
+			drv_data->bytes_left--;
+		}
+		drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA;
+
+		if (drv_data->bytes_left == 1)
+			drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_ACK;
+		break;
+
+	case MV64XXX_I2C_STATUS_MAST_RD_DATA_NO_ACK: /* 0x58 */
+		drv_data->action = MV64XXX_I2C_ACTION_RCV_DATA_STOP;
+		drv_data->state = MV64XXX_I2C_STATE_IDLE;
+		break;
+
+	case MV64XXX_I2C_STATUS_MAST_WR_ADDR_NO_ACK: /* 0x20 */
+	case MV64XXX_I2C_STATUS_MAST_WR_NO_ACK: /* 30 */
+	case MV64XXX_I2C_STATUS_MAST_RD_ADDR_NO_ACK: /* 48 */
+		/* Doesn't seem to be a device at other end */
+		drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
+		drv_data->state = MV64XXX_I2C_STATE_IDLE;
+		drv_data->rc = -ENODEV;
+		break;
+
+	default:
+		dev_err(&drv_data->adapter.dev,
+			"mv64xxx_i2c_fsm: Ctlr Error -- state: 0x%x, "
+			"status: 0x%x, addr: 0x%x, flags: 0x%x\n",
+			 drv_data->state, status, drv_data->msg->addr,
+			 drv_data->msg->flags);
+		drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
+		drv_data->state = MV64XXX_I2C_STATE_IDLE;
+		drv_data->rc = -EIO;
+	}
+}
+
+static void
+mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
+{
+	switch(drv_data->action) {
+	case MV64XXX_I2C_ACTION_CONTINUE:
+		writel(drv_data->cntl_bits,
+			drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
+		break;
+
+	case MV64XXX_I2C_ACTION_SEND_START:
+		writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_START,
+			drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
+		break;
+
+	case MV64XXX_I2C_ACTION_SEND_ADDR_1:
+		writel(drv_data->addr1,
+			drv_data->reg_base + MV64XXX_I2C_REG_DATA);
+		writel(drv_data->cntl_bits,
+			drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
+		break;
+
+	case MV64XXX_I2C_ACTION_SEND_ADDR_2:
+		writel(drv_data->addr2,
+			drv_data->reg_base + MV64XXX_I2C_REG_DATA);
+		writel(drv_data->cntl_bits,
+			drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
+		break;
+
+	case MV64XXX_I2C_ACTION_SEND_DATA:
+		writel(drv_data->msg->buf[drv_data->byte_posn++],
+			drv_data->reg_base + MV64XXX_I2C_REG_DATA);
+		writel(drv_data->cntl_bits,
+			drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
+		break;
+
+	case MV64XXX_I2C_ACTION_RCV_DATA:
+		drv_data->msg->buf[drv_data->byte_posn++] =
+			readl(drv_data->reg_base + MV64XXX_I2C_REG_DATA);
+		writel(drv_data->cntl_bits,
+			drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
+		break;
+
+	case MV64XXX_I2C_ACTION_RCV_DATA_STOP:
+		drv_data->msg->buf[drv_data->byte_posn++] =
+			readl(drv_data->reg_base + MV64XXX_I2C_REG_DATA);
+		drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_INTEN;
+		writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP,
+			drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
+		drv_data->block = 0;
+		wake_up_interruptible(&drv_data->waitq);
+		break;
+
+	case MV64XXX_I2C_ACTION_INVALID:
+	default:
+		dev_err(&drv_data->adapter.dev,
+			"mv64xxx_i2c_do_action: Invalid action: %d\n",
+			drv_data->action);
+		drv_data->rc = -EIO;
+		/* FALLTHRU */
+	case MV64XXX_I2C_ACTION_SEND_STOP:
+		drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_INTEN;
+		writel(drv_data->cntl_bits | MV64XXX_I2C_REG_CONTROL_STOP,
+			drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
+		drv_data->block = 0;
+		wake_up_interruptible(&drv_data->waitq);
+		break;
+	}
+}
+
+static int
+mv64xxx_i2c_intr(int irq, void *dev_id, struct pt_regs *regs)
+{
+	struct mv64xxx_i2c_data	*drv_data = dev_id;
+	unsigned long	flags;
+	u32		status;
+	int		rc = IRQ_NONE;
+
+	spin_lock_irqsave(&drv_data->lock, flags);
+	while (readl(drv_data->reg_base + MV64XXX_I2C_REG_CONTROL) &
+						MV64XXX_I2C_REG_CONTROL_IFLG) {
+		status = readl(drv_data->reg_base + MV64XXX_I2C_REG_STATUS);
+		mv64xxx_i2c_fsm(drv_data, status);
+		mv64xxx_i2c_do_action(drv_data);
+		rc = IRQ_HANDLED;
+	}
+	spin_unlock_irqrestore(&drv_data->lock, flags);
+
+	return rc;
+}
+
+/*
+ *****************************************************************************
+ *
+ *	I2C Msg Execution Routines
+ *
+ *****************************************************************************
+ */
+static void
+mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data,
+	struct i2c_msg *msg)
+{
+	u32	dir = 0;
+
+	drv_data->msg = msg;
+	drv_data->byte_posn = 0;
+	drv_data->bytes_left = msg->len;
+	drv_data->rc = 0;
+	drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK |
+		MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN;
+
+	if (msg->flags & I2C_M_RD)
+		dir = 1;
+
+	if (msg->flags & I2C_M_REV_DIR_ADDR)
+		dir ^= 1;
+
+	if (msg->flags & I2C_M_TEN) {
+		drv_data->addr1 = 0xf0 | (((u32)msg->addr & 0x300) >> 7) | dir;
+		drv_data->addr2 = (u32)msg->addr & 0xff;
+	} else {
+		drv_data->addr1 = ((u32)msg->addr & 0x7f) << 1 | dir;
+		drv_data->addr2 = 0;
+	}
+}
+
+static void
+mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data)
+{
+	long		time_left;
+	unsigned long	flags;
+	char		abort = 0;
+
+	time_left = wait_event_interruptible_timeout(drv_data->waitq,
+		!drv_data->block, msecs_to_jiffies(drv_data->adapter.timeout));
+
+	spin_lock_irqsave(&drv_data->lock, flags);
+	if (!time_left) { /* Timed out */
+		drv_data->rc = -ETIMEDOUT;
+		abort = 1;
+	} else if (time_left < 0) { /* Interrupted/Error */
+		drv_data->rc = time_left; /* errno value */
+		abort = 1;
+	}
+
+	if (abort && drv_data->block) {
+		drv_data->state = MV64XXX_I2C_STATE_ABORTING;
+		spin_unlock_irqrestore(&drv_data->lock, flags);
+
+		time_left = wait_event_timeout(drv_data->waitq,
+			!drv_data->block,
+			msecs_to_jiffies(drv_data->adapter.timeout));
+
+		if (time_left <= 0) {
+			drv_data->state = MV64XXX_I2C_STATE_IDLE;
+			dev_err(&drv_data->adapter.dev,
+				"mv64xxx: I2C bus locked\n");
+		}
+	} else
+		spin_unlock_irqrestore(&drv_data->lock, flags);
+}
+
+static int
+mv64xxx_i2c_execute_msg(struct mv64xxx_i2c_data *drv_data, struct i2c_msg *msg)
+{
+	unsigned long	flags;
+
+	spin_lock_irqsave(&drv_data->lock, flags);
+	mv64xxx_i2c_prepare_for_io(drv_data, msg);
+
+	if (unlikely(msg->flags & I2C_M_NOSTART)) { /* Skip start/addr phases */
+		if (drv_data->msg->flags & I2C_M_RD) {
+			/* No action to do, wait for slave to send a byte */
+			drv_data->action = MV64XXX_I2C_ACTION_CONTINUE;
+			drv_data->state =
+				MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA;
+		} else {
+			drv_data->action = MV64XXX_I2C_ACTION_SEND_DATA;
+			drv_data->state =
+				MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK;
+			drv_data->bytes_left--;
+		}
+	} else {
+		drv_data->action = MV64XXX_I2C_ACTION_SEND_START;
+		drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_START_COND;
+	}
+
+	drv_data->block = 1;
+	mv64xxx_i2c_do_action(drv_data);
+	spin_unlock_irqrestore(&drv_data->lock, flags);
+
+	mv64xxx_i2c_wait_for_completion(drv_data);
+	return drv_data->rc;
+}
+
+/*
+ *****************************************************************************
+ *
+ *	I2C Core Support Routines (Interface to higher level I2C code)
+ *
+ *****************************************************************************
+ */
+static u32
+mv64xxx_i2c_functionality(struct i2c_adapter *adap)
+{
+	return I2C_FUNC_I2C | I2C_FUNC_10BIT_ADDR | I2C_FUNC_SMBUS_EMUL;
+}
+
+static int
+mv64xxx_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
+{
+	struct mv64xxx_i2c_data *drv_data = i2c_get_adapdata(adap);
+	int	i, rc = 0;
+
+	for (i=0; i<num; i++)
+		if ((rc = mv64xxx_i2c_execute_msg(drv_data, &msgs[i])) != 0)
+			break;
+
+	return rc;
+}
+
+static struct i2c_algorithm mv64xxx_i2c_algo = {
+	.name = MV64XXX_I2C_CTLR_NAME " algorithm",
+	.id = I2C_ALGO_MV64XXX,
+	.master_xfer = mv64xxx_i2c_xfer,
+	.functionality = mv64xxx_i2c_functionality,
+};
+
+/*
+ *****************************************************************************
+ *
+ *	Driver Interface & Early Init Routines
+ *
+ *****************************************************************************
+ */
+static void __devinit
+mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data)
+{
+	writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SOFT_RESET);
+	writel((((drv_data->freq_m & 0xf) << 3) | (drv_data->freq_n & 0x7)),
+		drv_data->reg_base + MV64XXX_I2C_REG_BAUD);
+	writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SLAVE_ADDR);
+	writel(0, drv_data->reg_base + MV64XXX_I2C_REG_EXT_SLAVE_ADDR);
+	writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP,
+		drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
+	drv_data->state = MV64XXX_I2C_STATE_IDLE;
+}
+
+static int __devinit
+mv64xxx_i2c_map_regs(struct platform_device *pd,
+	struct mv64xxx_i2c_data *drv_data)
+{
+	struct resource	*r;
+
+	if ((r = platform_get_resource(pd, IORESOURCE_MEM, 0)) &&
+		request_mem_region(r->start, MV64XXX_I2C_REG_BLOCK_SIZE,
+			drv_data->adapter.name)) {
+
+		drv_data->reg_base = ioremap(r->start,
+			MV64XXX_I2C_REG_BLOCK_SIZE);
+		drv_data->reg_base_p = r->start;
+	} else
+		return -ENOMEM;
+
+	return 0;
+}
+
+static void __devexit
+mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data)
+{
+	if (drv_data->reg_base) {
+		iounmap(drv_data->reg_base);
+		release_mem_region(drv_data->reg_base_p,
+			MV64XXX_I2C_REG_BLOCK_SIZE);
+	}
+
+	drv_data->reg_base = NULL;
+	drv_data->reg_base_p = 0;
+}
+
+static int __devinit
+mv64xxx_i2c_probe(struct device *dev)
+{
+	struct platform_device		*pd = to_platform_device(dev);
+	struct mv64xxx_i2c_data		*drv_data;
+	struct mv64xxx_i2c_pdata	*pdata = dev->platform_data;
+	int	rc;
+
+	if ((pd->id != 0) || !pdata)
+		return -ENODEV;
+
+	drv_data = kmalloc(sizeof(struct mv64xxx_i2c_data), GFP_KERNEL);
+
+	if (!drv_data)
+		return -ENOMEM;
+
+	memset(drv_data, 0, sizeof(struct mv64xxx_i2c_data));
+
+	if (mv64xxx_i2c_map_regs(pd, drv_data)) {
+		rc = -ENODEV;
+		goto exit_kfree;
+	}
+
+	strncpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter",
+		I2C_NAME_SIZE);
+
+	init_waitqueue_head(&drv_data->waitq);
+	spin_lock_init(&drv_data->lock);
+
+	drv_data->freq_m = pdata->freq_m;
+	drv_data->freq_n = pdata->freq_n;
+	drv_data->irq = platform_get_irq(pd, 0);
+	drv_data->adapter.id = I2C_ALGO_MV64XXX | I2C_HW_MV64XXX;
+	drv_data->adapter.algo = &mv64xxx_i2c_algo;
+	drv_data->adapter.timeout = pdata->timeout;
+	drv_data->adapter.retries = pdata->retries;
+	dev_set_drvdata(dev, drv_data);
+	i2c_set_adapdata(&drv_data->adapter, drv_data);
+
+	if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0,
+		MV64XXX_I2C_CTLR_NAME, drv_data)) {
+
+		dev_err(dev, "mv64xxx: Can't register intr handler "
+			"irq: %d\n", drv_data->irq);
+		rc = -EINVAL;
+		goto exit_unmap_regs;
+	} else if ((rc = i2c_add_adapter(&drv_data->adapter)) != 0) {
+		dev_err(dev, "mv64xxx: Can't add i2c adapter, rc: %d\n", -rc);
+		goto exit_free_irq;
+	}
+
+	mv64xxx_i2c_hw_init(drv_data);
+
+	return 0;
+
+	exit_free_irq:
+		free_irq(drv_data->irq, drv_data);
+	exit_unmap_regs:
+		mv64xxx_i2c_unmap_regs(drv_data);
+	exit_kfree:
+		kfree(drv_data);
+	return rc;
+}
+
+static int __devexit
+mv64xxx_i2c_remove(struct device *dev)
+{
+	struct mv64xxx_i2c_data		*drv_data = dev_get_drvdata(dev);
+	int	rc;
+
+	rc = i2c_del_adapter(&drv_data->adapter);
+	free_irq(drv_data->irq, drv_data);
+	mv64xxx_i2c_unmap_regs(drv_data);
+	kfree(drv_data);
+
+	return rc;
+}
+
+static struct device_driver mv64xxx_i2c_driver = {
+	.name	= MV64XXX_I2C_CTLR_NAME,
+	.bus	= &platform_bus_type,
+	.probe	= mv64xxx_i2c_probe,
+	.remove	= mv64xxx_i2c_remove,
+};
+
+static int __init
+mv64xxx_i2c_init(void)
+{
+	return driver_register(&mv64xxx_i2c_driver);
+}
+
+static void __exit
+mv64xxx_i2c_exit(void)
+{
+	driver_unregister(&mv64xxx_i2c_driver);
+}
+
+module_init(mv64xxx_i2c_init);
+module_exit(mv64xxx_i2c_exit);
+
+MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>");
+MODULE_DESCRIPTION("Marvell mv64xxx host bridge i2c ctlr driver");
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
--- a/drivers/i2c/busses/i2c-nforce2.c	2004-12-18 08:55:31 -08:00
+++ b/drivers/i2c/busses/i2c-nforce2.c	2005-03-02 09:55:27 -08:00
@@ -29,9 +29,10 @@
     nForce2 Ultra 400 MCP	0084
     nForce3 Pro150 MCP		00D4
     nForce3 250Gb MCP		00E4
+    nForce4 MCP			0052
 
-    This driver supports the 2 SMBuses that are included in the MCP2 of the
-    nForce2 chipset.
+    This driver supports the 2 SMBuses that are included in the MCP of the
+    nForce2/3/4 chipsets.
 */
 
 /* Note: we assume there can only be one nForce2, with two SMBus interfaces */
@@ -295,6 +296,7 @@
 	{ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS) },
 	{ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS) },
+	{ PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS) },
 	{ 0 }
 };
 
diff -Nru a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
--- a/drivers/i2c/busses/i2c-s3c2410.c	2004-11-08 02:33:46 -08:00
+++ b/drivers/i2c/busses/i2c-s3c2410.c	2005-03-02 09:54:46 -08:00
@@ -483,7 +483,7 @@
  * this starts an i2c transfer
 */
 
-static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg msgs[], int num)
+static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg *msgs, int num)
 {
 	unsigned long timeout;
 	int ret;
@@ -534,7 +534,7 @@
 */
 
 static int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
-			struct i2c_msg msgs[], int num)
+			struct i2c_msg *msgs, int num)
 {
 	struct s3c24xx_i2c *i2c = (struct s3c24xx_i2c *)adap->algo_data;
 	int retry;
@@ -569,6 +569,7 @@
 		.name			= "s3c2410-i2c",
 		.algo			= &s3c24xx_i2c_algorithm,
 		.retries		= 2,
+		.class			= I2C_CLASS_HWMON,
 	},
 };
 
diff -Nru a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
--- a/drivers/i2c/chips/Kconfig	2005-01-03 18:59:59 -08:00
+++ b/drivers/i2c/chips/Kconfig	2005-03-02 07:15:12 -08:00
@@ -63,7 +63,7 @@
 	  will be called asb100.
 
 config SENSORS_DS1621
-      	tristate "Dallas Semiconductor DS1621 and DS1625"
+	tristate "Dallas Semiconductor DS1621 and DS1625"
 	depends on I2C && EXPERIMENTAL
 	select I2C_SENSOR
 	help
@@ -84,6 +84,17 @@
 	  This driver can also be built as a module.  If so, the module
 	  will be called fscher.
 
+config SENSORS_FSCPOS
+	tristate "FSC Poseidon"
+	depends on I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Fujitsu Siemens
+	  Computers Poseidon sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called fscpos.
+
 config SENSORS_GL518SM
 	tristate "Genesys Logic GL518SM"
 	depends on I2C && EXPERIMENTAL
@@ -95,6 +106,17 @@
 	  This driver can also be built as a module.  If so, the module
 	  will be called gl518sm.
 
+config SENSORS_GL520SM
+	tristate "Genesys Logic GL520SM"
+	depends on I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Genesys Logic GL520SM
+	  sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called gl520sm.
+
 config SENSORS_IT87
 	tristate "ITE IT87xx and compatibles"
 	depends on I2C && EXPERIMENTAL
@@ -251,6 +273,18 @@
 	  This driver can also be built as a module.  If so, the module
 	  will be called smsc47b397.
 
+config SENSORS_SIS5595
+	tristate "Silicon Integrated Systems Corp. SiS5595"
+	depends on I2C && PCI && EXPERIMENTAL
+	select I2C_SENSOR
+	select I2C_ISA
+	help
+	  If you say yes here you get support for the integrated sensors in
+	  SiS5595 South Bridges.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called sis5595.
+
 config SENSORS_SMSC47M1
 	tristate "SMSC LPC47M10x and compatibles"
 	depends on I2C && EXPERIMENTAL
@@ -304,6 +338,7 @@
 	tristate "Winbond W83627HF, W83627THF, W83637HF, W83697HF"
 	depends on I2C && EXPERIMENTAL
 	select I2C_SENSOR
+	select I2C_ISA
 	help
 	  If you say yes here you get support for the Winbond W836X7 series
 	  of sensor chips: the W83627HF, W83627THF, W83637HF, and the W83697HF
@@ -370,5 +405,14 @@
 	  
 	  This driver can also be built as a module.  If so, the module
 	  will be called isp1301_omap.
+
+config SENSORS_M41T00
+	tristate "ST M41T00 RTC chip"
+	depends on I2C && PPC32
+	help
+	  If you say yes here you get support for the ST M41T00 RTC chip.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called m41t00.
 
 endmenu
diff -Nru a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
--- a/drivers/i2c/chips/Makefile	2005-01-03 19:00:53 -08:00
+++ b/drivers/i2c/chips/Makefile	2005-03-02 09:55:58 -08:00
@@ -14,7 +14,9 @@
 obj-$(CONFIG_SENSORS_DS1621)	+= ds1621.o
 obj-$(CONFIG_SENSORS_EEPROM)	+= eeprom.o
 obj-$(CONFIG_SENSORS_FSCHER)	+= fscher.o
+obj-$(CONFIG_SENSORS_FSCPOS)	+= fscpos.o
 obj-$(CONFIG_SENSORS_GL518SM)	+= gl518sm.o
+obj-$(CONFIG_SENSORS_GL520SM)	+= gl520sm.o
 obj-$(CONFIG_SENSORS_IT87)	+= it87.o
 obj-$(CONFIG_SENSORS_LM63)	+= lm63.o
 obj-$(CONFIG_SENSORS_LM75)	+= lm75.o
@@ -26,10 +28,12 @@
 obj-$(CONFIG_SENSORS_LM87)	+= lm87.o
 obj-$(CONFIG_SENSORS_LM90)	+= lm90.o
 obj-$(CONFIG_SENSORS_MAX1619)	+= max1619.o
+obj-$(CONFIG_SENSORS_M41T00)	+= m41t00.o
 obj-$(CONFIG_SENSORS_PC87360)	+= pc87360.o
 obj-$(CONFIG_SENSORS_PCF8574)	+= pcf8574.o
 obj-$(CONFIG_SENSORS_PCF8591)	+= pcf8591.o
 obj-$(CONFIG_SENSORS_RTC8564)	+= rtc8564.o
+obj-$(CONFIG_SENSORS_SIS5595)	+= sis5595.o
 obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
 obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47m1.o
 obj-$(CONFIG_SENSORS_VIA686A)	+= via686a.o
diff -Nru a/drivers/i2c/chips/adm1021.c b/drivers/i2c/chips/adm1021.c
--- a/drivers/i2c/chips/adm1021.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/adm1021.c	2005-03-02 09:56:26 -08:00
@@ -23,6 +23,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -147,8 +148,6 @@
 	.detach_client	= adm1021_detach_client,
 };
 
-static int adm1021_id;
-
 #define show(value)	\
 static ssize_t show_##value(struct device *dev, char *buf)		\
 {									\
@@ -299,8 +298,6 @@
 	/* Fill in the remaining client fields and put it into the global list */
 	strlcpy(new_client->name, type_name, I2C_NAME_SIZE);
 	data->type = kind;
-
-	new_client->id = adm1021_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -373,8 +370,8 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ + HZ / 2) ||
-	    (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
 		dev_dbg(&client->dev, "Starting adm1021 update\n");
 
 		data->temp_input = adm1021_read_value(client, ADM1021_REG_TEMP);
diff -Nru a/drivers/i2c/chips/adm1025.c b/drivers/i2c/chips/adm1025.c
--- a/drivers/i2c/chips/adm1025.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/adm1025.c	2005-03-02 09:56:26 -08:00
@@ -49,6 +49,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
@@ -148,12 +149,6 @@
 };
 
 /*
- * Internal variables
- */
-
-static int adm1025_id;
-
-/*
  * Sysfs stuff
  */
 
@@ -397,7 +392,6 @@
 
 	/* We can fill in the remaining client fields */
 	strlcpy(new_client->name, name, I2C_NAME_SIZE);
-	new_client->id = adm1025_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -512,9 +506,7 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ * 2) ||
-	    (jiffies < data->last_updated) ||
-	    !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
 		int i;
 
 		dev_dbg(&client->dev, "Updating data.\n");
diff -Nru a/drivers/i2c/chips/adm1026.c b/drivers/i2c/chips/adm1026.c
--- a/drivers/i2c/chips/adm1026.c	2005-01-14 14:18:02 -08:00
+++ b/drivers/i2c/chips/adm1026.c	2005-03-02 09:56:26 -08:00
@@ -27,6 +27,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
@@ -313,8 +314,6 @@
 	.detach_client  = adm1026_detach_client,
 };
 
-static int adm1026_id;
-
 int adm1026_attach_adapter(struct i2c_adapter *adapter)
 {
 	if (!(adapter->class & I2C_CLASS_HWMON)) {
@@ -363,49 +362,47 @@
 	int value, i;
 	struct adm1026_data *data = i2c_get_clientdata(client);
 
-        dev_dbg(&client->dev,"(%d): Initializing device\n", client->id);
+        dev_dbg(&client->dev, "Initializing device\n");
 	/* Read chip config */
 	data->config1 = adm1026_read_value(client, ADM1026_REG_CONFIG1);
 	data->config2 = adm1026_read_value(client, ADM1026_REG_CONFIG2);
 	data->config3 = adm1026_read_value(client, ADM1026_REG_CONFIG3);
 
 	/* Inform user of chip config */
-	dev_dbg(&client->dev, "(%d): ADM1026_REG_CONFIG1 is: 0x%02x\n",
-		client->id, data->config1);
+	dev_dbg(&client->dev, "ADM1026_REG_CONFIG1 is: 0x%02x\n",
+		data->config1);
 	if ((data->config1 & CFG1_MONITOR) == 0) {
-		dev_dbg(&client->dev, "(%d): Monitoring not currently "
-			"enabled.\n", client->id);
+		dev_dbg(&client->dev, "Monitoring not currently "
+			"enabled.\n");
 	}
 	if (data->config1 & CFG1_INT_ENABLE) {
-		dev_dbg(&client->dev, "(%d): SMBALERT interrupts are "
-			"enabled.\n", client->id);
+		dev_dbg(&client->dev, "SMBALERT interrupts are "
+			"enabled.\n");
 	}
 	if (data->config1 & CFG1_AIN8_9) {
-		dev_dbg(&client->dev, "(%d): in8 and in9 enabled. "
-			"temp3 disabled.\n", client->id);
+		dev_dbg(&client->dev, "in8 and in9 enabled. "
+			"temp3 disabled.\n");
 	} else {
-		dev_dbg(&client->dev, "(%d): temp3 enabled.  in8 and "
-			"in9 disabled.\n", client->id);
+		dev_dbg(&client->dev, "temp3 enabled.  in8 and "
+			"in9 disabled.\n");
 	}
 	if (data->config1 & CFG1_THERM_HOT) {
-		dev_dbg(&client->dev, "(%d): Automatic THERM, PWM, "
-			"and temp limits enabled.\n", client->id);
+		dev_dbg(&client->dev, "Automatic THERM, PWM, "
+			"and temp limits enabled.\n");
 	}
 
 	value = data->config3;
 	if (data->config3 & CFG3_GPIO16_ENABLE) {
-		dev_dbg(&client->dev, "(%d): GPIO16 enabled.  THERM"
-			"pin disabled.\n", client->id);
+		dev_dbg(&client->dev, "GPIO16 enabled.  THERM"
+			"pin disabled.\n");
 	} else {
-		dev_dbg(&client->dev, "(%d): THERM pin enabled.  "
-			"GPIO16 disabled.\n", client->id);
+		dev_dbg(&client->dev, "THERM pin enabled.  "
+			"GPIO16 disabled.\n");
 	}
 	if (data->config3 & CFG3_VREF_250) {
-		dev_dbg(&client->dev, "(%d): Vref is 2.50 Volts.\n",
-			client->id);
+		dev_dbg(&client->dev, "Vref is 2.50 Volts.\n");
 	} else {
-		dev_dbg(&client->dev, "(%d): Vref is 1.82 Volts.\n",
-			client->id);
+		dev_dbg(&client->dev, "Vref is 1.82 Volts.\n");
 	}
 	/* Read and pick apart the existing GPIO configuration */
 	value = 0;
@@ -423,12 +420,11 @@
 	adm1026_print_gpio(client);
 
 	/* If the user asks us to reprogram the GPIO config, then
-	 *   do it now.  But only if this is the first ADM1026.
+	 * do it now.
 	 */
-	if (client->id == 0
-	    && (gpio_input[0] != -1 || gpio_output[0] != -1
+	if (gpio_input[0] != -1 || gpio_output[0] != -1
 		|| gpio_inverted[0] != -1 || gpio_normal[0] != -1
-		|| gpio_fan[0] != -1)) {
+		|| gpio_fan[0] != -1) {
 		adm1026_fixup_gpio(client);
 	}
 
@@ -448,8 +444,7 @@
 	value = adm1026_read_value(client, ADM1026_REG_CONFIG1);
 	/* Set MONITOR, clear interrupt acknowledge and s/w reset */
 	value = (value | CFG1_MONITOR) & (~CFG1_INT_CLEAR & ~CFG1_RESET);
-	dev_dbg(&client->dev, "(%d): Setting CONFIG to: 0x%02x\n",
-		client->id, value);
+	dev_dbg(&client->dev, "Setting CONFIG to: 0x%02x\n", value);
 	data->config1 = value;
 	adm1026_write_value(client, ADM1026_REG_CONFIG1, value);
 
@@ -467,31 +462,30 @@
 	struct adm1026_data *data = i2c_get_clientdata(client);
 	int  i;
 
-	dev_dbg(&client->dev, "(%d): GPIO config is:", client->id);
+	dev_dbg(&client->dev, "GPIO config is:");
 	for (i = 0;i <= 7;++i) {
 		if (data->config2 & (1 << i)) {
-			dev_dbg(&client->dev, "\t(%d): %sGP%s%d\n", client->id,
+			dev_dbg(&client->dev, "\t%sGP%s%d\n",
 				data->gpio_config[i] & 0x02 ? "" : "!",
 				data->gpio_config[i] & 0x01 ? "OUT" : "IN",
 				i);
 		} else {
-			dev_dbg(&client->dev, "\t(%d): FAN%d\n",
-				client->id, i);
+			dev_dbg(&client->dev, "\tFAN%d\n", i);
 		}
 	}
 	for (i = 8;i <= 15;++i) {
-		dev_dbg(&client->dev, "\t(%d): %sGP%s%d\n", client->id,
+		dev_dbg(&client->dev, "\t%sGP%s%d\n",
 			data->gpio_config[i] & 0x02 ? "" : "!",
 			data->gpio_config[i] & 0x01 ? "OUT" : "IN",
 			i);
 	}
 	if (data->config3 & CFG3_GPIO16_ENABLE) {
-		dev_dbg(&client->dev, "\t(%d): %sGP%s16\n", client->id,
+		dev_dbg(&client->dev, "\t%sGP%s16\n",
 			data->gpio_config[16] & 0x02 ? "" : "!",
 			data->gpio_config[16] & 0x01 ? "OUT" : "IN");
 	} else {
 		/* GPIO16 is THERM  */
-		dev_dbg(&client->dev, "\t(%d): THERM\n", client->id);
+		dev_dbg(&client->dev, "\tTHERM\n");
 	}
 }
 
@@ -580,10 +574,9 @@
 
 	down(&data->update_lock);
 	if (!data->valid
-	    || (jiffies - data->last_reading > ADM1026_DATA_INTERVAL)) {
+	    || time_after(jiffies, data->last_reading + ADM1026_DATA_INTERVAL)) {
 		/* Things that change quickly */
-		dev_dbg(&client->dev,"(%d): Reading sensor values\n", 
-			client->id);
+		dev_dbg(&client->dev,"Reading sensor values\n");
 		for (i = 0;i <= 16;++i) {
 			data->in[i] =
 			    adm1026_read_value(client, ADM1026_REG_IN[i]);
@@ -628,11 +621,10 @@
 		data->last_reading = jiffies;
 	};  /* last_reading */
 
-	if (!data->valid || (jiffies - data->last_config > 
-		ADM1026_CONFIG_INTERVAL)) {
+	if (!data->valid ||
+	    time_after(jiffies, data->last_config + ADM1026_CONFIG_INTERVAL)) {
 		/* Things that don't change often */
-		dev_dbg(&client->dev, "(%d): Reading config values\n", 
-			client->id);
+		dev_dbg(&client->dev, "Reading config values\n");
 		for (i = 0;i <= 16;++i) {
 			data->in_min[i] = adm1026_read_value(client, 
 				ADM1026_REG_IN_MIN[i]);
@@ -712,8 +704,7 @@
 		data->last_config = jiffies;
 	};  /* last_config */
 
-	dev_dbg(&client->dev, "(%d): Setting VID from GPIO11-15.\n", 
-		client->id);
+	dev_dbg(&client->dev, "Setting VID from GPIO11-15.\n");
 	data->vid = (data->gpio >> 11) & 0x1f;
 	data->valid = 1;
 	up(&data->update_lock);
@@ -1608,15 +1599,9 @@
 	strlcpy(new_client->name, type_name, I2C_NAME_SIZE);
 
 	/* Fill in the remaining client fields */
-	new_client->id = adm1026_id++;
 	data->type = kind;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
-
-	dev_dbg(&new_client->dev, "(%d): Assigning ID %d to %s at %d,0x%02x\n",
-		new_client->id, new_client->id, new_client->name,
-		i2c_adapter_id(new_client->adapter),
-		new_client->addr);
 
 	/* Tell the I2C layer a new client has arrived */
 	if ((err = i2c_attach_client(new_client)))
diff -Nru a/drivers/i2c/chips/adm1031.c b/drivers/i2c/chips/adm1031.c
--- a/drivers/i2c/chips/adm1031.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/adm1031.c	2005-03-02 09:56:26 -08:00
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -110,8 +111,6 @@
 	.detach_client = adm1031_detach_client,
 };
 
-static int adm1031_id;
-
 static inline u8 adm1031_read_value(struct i2c_client *client, u8 reg)
 {
 	return i2c_smbus_read_byte_data(client, reg);
@@ -781,8 +780,6 @@
 	data->chip_type = kind;
 
 	strlcpy(new_client->name, name, I2C_NAME_SIZE);
-
-	new_client->id = adm1031_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -888,8 +885,8 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ + HZ / 2) ||
-	    (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
 
 		dev_dbg(&client->dev, "Starting adm1031 update\n");
 		for (chan = 0;
diff -Nru a/drivers/i2c/chips/asb100.c b/drivers/i2c/chips/asb100.c
--- a/drivers/i2c/chips/asb100.c	2005-01-02 13:17:16 -08:00
+++ b/drivers/i2c/chips/asb100.c	2005-03-02 09:56:26 -08:00
@@ -36,17 +36,12 @@
     asb100	7	3	1	4	0x31	0x0694	yes	no
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/slab.h>
-#include <linux/ioport.h>
-#include <linux/types.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
 #include <linux/init.h>
-#include <asm/errno.h>
-#include <asm/io.h>
 #include "lm75.h"
 
 /*
@@ -970,8 +965,8 @@
 
 	down(&data->update_lock);
 
-	if (time_after(jiffies - data->last_updated, (unsigned long)(HZ+HZ/2))
-		|| time_before(jiffies, data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+		|| !data->valid) {
 
 		dev_dbg(&client->dev, "starting device update...\n");
 
diff -Nru a/drivers/i2c/chips/ds1621.c b/drivers/i2c/chips/ds1621.c
--- a/drivers/i2c/chips/ds1621.c	2005-02-02 22:35:48 -08:00
+++ b/drivers/i2c/chips/ds1621.c	2005-03-02 09:56:26 -08:00
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include "lm75.h"
@@ -95,8 +96,6 @@
 	.detach_client	= ds1621_detach_client,
 };
 
-static int ds1621_id;
-
 /* All registers are word-sized, except for the configuration register.
    DS1621 uses a high-byte first convention, which is exactly opposite to
    the usual practice. */
@@ -236,8 +235,6 @@
 
 	/* Fill in remaining client fields and put it into the global list */
 	strlcpy(new_client->name, "ds1621", I2C_NAME_SIZE);
-
-	new_client->id = ds1621_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -288,8 +285,8 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ + HZ / 2) ||
-	    (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
 
 		dev_dbg(&client->dev, "Starting ds1621 update\n");
 
diff -Nru a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
--- a/drivers/i2c/chips/eeprom.c	2005-01-14 14:17:45 -08:00
+++ b/drivers/i2c/chips/eeprom.c	2005-03-02 09:56:26 -08:00
@@ -32,6 +32,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/sched.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -86,8 +87,7 @@
 	down(&data->update_lock);
 
 	if (!(data->valid & (1 << slice)) ||
-	    (jiffies - data->last_updated[slice] > 300 * HZ) ||
-	    (jiffies < data->last_updated[slice])) {
+	    time_after(jiffies, data->last_updated[slice] + 300 * HZ)) {
 		dev_dbg(&client->dev, "Starting eeprom update, slice %u\n", slice);
 
 		if (i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
diff -Nru a/drivers/i2c/chips/fscher.c b/drivers/i2c/chips/fscher.c
--- a/drivers/i2c/chips/fscher.c	2005-01-05 11:40:34 -08:00
+++ b/drivers/i2c/chips/fscher.c	2005-03-02 09:56:26 -08:00
@@ -30,6 +30,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -151,12 +152,6 @@
 };
 
 /*
- * Internal variables
- */
-
-static int fscher_id;
-
-/*
  * Sysfs stuff
  */
 
@@ -337,7 +332,6 @@
 	/* Fill in the remaining client fields and put it into the
 	 * global list */
 	strlcpy(new_client->name, "fscher", I2C_NAME_SIZE);
-	new_client->id = fscher_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -418,8 +412,7 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > 2 * HZ) ||
-	    (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
 
 		dev_dbg(&client->dev, "Starting fscher update\n");
 
diff -Nru a/drivers/i2c/chips/fscpos.c b/drivers/i2c/chips/fscpos.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/i2c/chips/fscpos.c	2005-03-02 10:00:05 -08:00
@@ -0,0 +1,631 @@
+/*
+	fscpos.c - Kernel module for hardware monitoring with FSC Poseidon chips
+	Copyright (C) 2004, 2005 Stefan Ott <stefan@desire.ch>
+
+	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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/*
+	fujitsu siemens poseidon chip,
+	module based on the old fscpos module by Hermann Jung <hej@odn.de> and
+	the fscher module by Reinhard Nissl <rnissl@gmx.de>
+
+	original module based on lm80.c
+	Copyright (C) 1998, 1999 Frodo Looijaard <frodol@dds.nl>
+	and Philip Edelbrock <phil@netroedge.com>
+
+	Thanks to Jean Delvare for reviewing my code and suggesting a lot of
+	improvements.
+*/
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/i2c.h>
+#include <linux/i2c-sensor.h>
+#include <linux/init.h>
+
+/*
+ * Addresses to scan
+ */
+static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+
+/*
+ * Insmod parameters
+ */
+SENSORS_INSMOD_1(fscpos);
+
+/*
+ * The FSCPOS registers
+ */
+
+/* chip identification */
+#define FSCPOS_REG_IDENT_0		0x00
+#define FSCPOS_REG_IDENT_1		0x01
+#define FSCPOS_REG_IDENT_2		0x02
+#define FSCPOS_REG_REVISION		0x03
+
+/* global control and status */
+#define FSCPOS_REG_EVENT_STATE		0x04
+#define FSCPOS_REG_CONTROL		0x05
+
+/* watchdog */
+#define FSCPOS_REG_WDOG_PRESET		0x28
+#define FSCPOS_REG_WDOG_STATE		0x23
+#define FSCPOS_REG_WDOG_CONTROL		0x21
+
+/* voltages */
+#define FSCPOS_REG_VOLT_12		0x45
+#define FSCPOS_REG_VOLT_5		0x42
+#define FSCPOS_REG_VOLT_BATT		0x48
+
+/* fans - the chip does not support minimum speed for fan2 */
+static u8 FSCPOS_REG_PWM[] = { 0x55, 0x65 };
+static u8 FSCPOS_REG_FAN_ACT[] = { 0x0e, 0x6b, 0xab };
+static u8 FSCPOS_REG_FAN_STATE[] = { 0x0d, 0x62, 0xa2 };
+static u8 FSCPOS_REG_FAN_RIPPLE[] = { 0x0f, 0x6f, 0xaf };
+
+/* temperatures */
+static u8 FSCPOS_REG_TEMP_ACT[] = { 0x64, 0x32, 0x35 };
+static u8 FSCPOS_REG_TEMP_STATE[] = { 0x71, 0x81, 0x91 };
+
+/*
+ * Functions declaration
+ */
+static int fscpos_attach_adapter(struct i2c_adapter *adapter);
+static int fscpos_detect(struct i2c_adapter *adapter, int address, int kind);
+static int fscpos_detach_client(struct i2c_client *client);
+
+static int fscpos_read_value(struct i2c_client *client, u8 register);
+static int fscpos_write_value(struct i2c_client *client, u8 register, u8 value);
+static struct fscpos_data *fscpos_update_device(struct device *dev);
+static void fscpos_init_client(struct i2c_client *client);
+
+static void reset_fan_alarm(struct i2c_client *client, int nr);
+
+/*
+ * Driver data (common to all clients)
+ */
+static struct i2c_driver fscpos_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "fscpos",
+	.id		= I2C_DRIVERID_FSCPOS,
+	.flags		= I2C_DF_NOTIFY,
+	.attach_adapter	= fscpos_attach_adapter,
+	.detach_client	= fscpos_detach_client,
+};
+
+/*
+ * Client data (each client gets its own)
+ */
+struct fscpos_data {
+	struct i2c_client client;
+	struct semaphore update_lock;
+	char valid; 		/* 0 until following fields are valid */
+	unsigned long last_updated;	/* In jiffies */
+
+	/* register values */
+	u8 revision;		/* revision of chip */
+	u8 global_event;	/* global event status */
+	u8 global_control;	/* global control register */
+	u8 wdog_control;	/* watchdog control */
+	u8 wdog_state;		/* watchdog status */
+	u8 wdog_preset;		/* watchdog preset */
+	u8 volt[3];		/* 12, 5, battery current */
+	u8 temp_act[3];		/* temperature */
+	u8 temp_status[3];	/* status of sensor */
+	u8 fan_act[3];		/* fans revolutions per second */
+	u8 fan_status[3];	/* fan status */
+	u8 pwm[2];		/* fan min value for rps */
+	u8 fan_ripple[3];	/* divider for rps */
+};
+
+/* Temperature */
+#define TEMP_FROM_REG(val)	(((val) - 128) * 1000)
+
+static ssize_t show_temp_input(struct fscpos_data *data, char *buf, int nr)
+{
+	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_act[nr - 1]));
+}
+
+static ssize_t show_temp_status(struct fscpos_data *data, char *buf, int nr)
+{
+	/* bits 2..7 reserved => mask with 0x03 */
+	return sprintf(buf, "%u\n", data->temp_status[nr - 1] & 0x03);
+}
+
+static ssize_t show_temp_reset(struct fscpos_data *data, char *buf, int nr)
+{
+	return sprintf(buf, "1\n");
+}
+
+static ssize_t set_temp_reset(struct i2c_client *client, struct fscpos_data
+			*data, const char *buf,	size_t count, int nr, int reg)
+{
+	unsigned long v = simple_strtoul(buf, NULL, 10);
+	if (v != 1) {
+		dev_err(&client->dev, "temp_reset value %ld not supported. "
+					"Use 1 to reset the alarm!\n", v);
+		return -EINVAL;
+	}
+
+	dev_info(&client->dev, "You used the temp_reset feature which has not "
+				"been proplerly tested. Please report your "
+				"experience to the module author.\n");
+
+	/* Supported value: 2 (clears the status) */
+	fscpos_write_value(client, FSCPOS_REG_TEMP_STATE[nr], 2);
+	return count;
+}
+
+/* Fans */
+#define RPM_FROM_REG(val)	((val) * 60)
+
+static ssize_t show_fan_status(struct fscpos_data *data, char *buf, int nr)
+{
+	/* bits 0..1, 3..7 reserved => mask with 0x04 */
+	return sprintf(buf, "%u\n", data->fan_status[nr - 1] & 0x04);
+}
+
+static ssize_t show_fan_input(struct fscpos_data *data, char *buf, int nr)
+{
+	return sprintf(buf, "%u\n", RPM_FROM_REG(data->fan_act[nr - 1]));
+}
+
+static ssize_t show_fan_ripple(struct fscpos_data *data, char *buf, int nr)
+{
+	/* bits 2..7 reserved => mask with 0x03 */
+	return sprintf(buf, "%u\n", data->fan_ripple[nr - 1] & 0x03);
+}
+
+static ssize_t set_fan_ripple(struct i2c_client *client, struct fscpos_data
+			*data, const char *buf,	size_t count, int nr, int reg)
+{
+	/* supported values: 2, 4, 8 */
+	unsigned long v = simple_strtoul(buf, NULL, 10);
+
+	switch (v) {
+		case 2: v = 1; break;
+		case 4: v = 2; break;
+		case 8: v = 3; break;
+	default:
+		dev_err(&client->dev, "fan_ripple value %ld not supported. "
+					"Must be one of 2, 4 or 8!\n", v);
+		return -EINVAL;
+	}
+	
+	/* bits 2..7 reserved => mask with 0x03 */
+	data->fan_ripple[nr - 1] &= ~0x03;
+	data->fan_ripple[nr - 1] |= v;
+	
+	fscpos_write_value(client, reg, data->fan_ripple[nr - 1]);
+	return count;
+}
+
+static ssize_t show_pwm(struct fscpos_data *data, char *buf, int nr)
+{
+	return sprintf(buf, "%u\n", data->pwm[nr - 1]);
+}
+
+static ssize_t set_pwm(struct i2c_client *client, struct fscpos_data *data,
+				const char *buf, size_t count, int nr, int reg)
+{
+	unsigned long v = simple_strtoul(buf, NULL, 10);
+
+	/* Range: 0..255 */
+	if (v < 0) v = 0;
+	if (v > 255) v = 255;
+
+	data->pwm[nr - 1] = v;
+	fscpos_write_value(client, reg, data->pwm[nr - 1]);
+	return count;
+}
+
+static void reset_fan_alarm(struct i2c_client *client, int nr)
+{
+	fscpos_write_value(client, FSCPOS_REG_FAN_STATE[nr], 4);
+}
+
+/* Volts */
+#define VOLT_FROM_REG(val, mult)	((val) * (mult) / 255)
+
+static ssize_t show_volt_12(struct device *dev, char *buf)
+{
+	struct fscpos_data *data = fscpos_update_device(dev);
+	return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[0], 14200));
+}
+
+static ssize_t show_volt_5(struct device *dev, char *buf)
+{
+	struct fscpos_data *data = fscpos_update_device(dev);
+	return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[1], 6600));
+}
+
+static ssize_t show_volt_batt(struct device *dev, char *buf)
+{
+	struct fscpos_data *data = fscpos_update_device(dev);
+	return sprintf(buf, "%u\n", VOLT_FROM_REG(data->volt[2], 3300));
+}
+
+/* Watchdog */
+static ssize_t show_wdog_control(struct fscpos_data *data, char *buf)
+{
+	/* bits 0..3 reserved, bit 6 write only => mask with 0xb0 */
+	return sprintf(buf, "%u\n", data->wdog_control & 0xb0);
+}
+
+static ssize_t set_wdog_control(struct i2c_client *client, struct fscpos_data
+				*data, const char *buf,	size_t count, int reg)
+{
+	/* bits 0..3 reserved => mask with 0xf0 */
+	unsigned long v = simple_strtoul(buf, NULL, 10) & 0xf0;
+	data->wdog_control &= ~0xf0;
+	data->wdog_control |= v;
+	
+	fscpos_write_value(client, reg, data->wdog_control);
+	return count;
+}
+
+static ssize_t show_wdog_state(struct fscpos_data *data, char *buf)
+{
+	/* bits 0, 2..7 reserved => mask with 0x02 */
+	return sprintf(buf, "%u\n", data->wdog_state & 0x02);
+}
+
+static ssize_t set_wdog_state(struct i2c_client *client, struct fscpos_data
+				*data, const char *buf, size_t count, int reg)
+{
+	unsigned long v = simple_strtoul(buf, NULL, 10) & 0x02;
+
+	/* Valid values: 2 (clear) */
+	if (v != 2) {
+		dev_err(&client->dev, "wdog_state value %ld not supported. "
+					"Must be 2 to clear the state!\n", v);
+		return -EINVAL;
+	}
+
+	data->wdog_state &= ~v;
+	
+	fscpos_write_value(client, reg, v);
+	return count;
+}
+
+static ssize_t show_wdog_preset(struct fscpos_data *data, char *buf)
+{
+	return sprintf(buf, "%u\n", data->wdog_preset);
+}
+
+static ssize_t set_wdog_preset(struct i2c_client *client, struct fscpos_data
+				*data, const char *buf,	size_t count, int reg)
+{
+	data->wdog_preset = simple_strtoul(buf, NULL, 10) & 0xff;
+	
+	fscpos_write_value(client, reg, data->wdog_preset);
+	return count;
+}
+
+/* Event */
+static ssize_t show_event(struct device *dev, char *buf)
+{
+	/* bits 5..7 reserved => mask with 0x1f */
+	struct fscpos_data *data = fscpos_update_device(dev);
+	return sprintf(buf, "%u\n", data->global_event & 0x9b);
+}
+
+/*
+ * Sysfs stuff
+ */
+#define create_getter(kind, sub) \
+	static ssize_t sysfs_show_##kind##sub(struct device *dev, char *buf) \
+	{ \
+		struct fscpos_data *data = fscpos_update_device(dev); \
+		return show_##kind##sub(data, buf); \
+	}
+
+#define create_getter_n(kind, offset, sub) \
+	static ssize_t sysfs_show_##kind##offset##sub(struct device *dev, char\
+								 	*buf) \
+	{ \
+		struct fscpos_data *data = fscpos_update_device(dev); \
+		return show_##kind##sub(data, buf, offset); \
+	}
+
+#define create_setter(kind, sub, reg) \
+	static ssize_t sysfs_set_##kind##sub (struct device *dev, const char \
+							*buf, size_t count) \
+	{ \
+		struct i2c_client *client = to_i2c_client(dev); \
+		struct fscpos_data *data = i2c_get_clientdata(client); \
+		return set_##kind##sub(client, data, buf, count, reg); \
+	}
+
+#define create_setter_n(kind, offset, sub, reg) \
+	static ssize_t sysfs_set_##kind##offset##sub (struct device *dev, \
+					const char *buf, size_t count) \
+	{ \
+		struct i2c_client *client = to_i2c_client(dev); \
+		struct fscpos_data *data = i2c_get_clientdata(client); \
+		return set_##kind##sub(client, data, buf, count, offset, reg);\
+	}
+
+#define create_sysfs_device_ro(kind, sub, offset) \
+	static DEVICE_ATTR(kind##offset##sub, S_IRUGO, \
+					sysfs_show_##kind##offset##sub, NULL);
+
+#define create_sysfs_device_rw(kind, sub, offset) \
+	static DEVICE_ATTR(kind##offset##sub, S_IRUGO | S_IWUSR, \
+		sysfs_show_##kind##offset##sub, sysfs_set_##kind##offset##sub);
+
+#define sysfs_ro_n(kind, sub, offset) \
+	create_getter_n(kind, offset, sub); \
+	create_sysfs_device_ro(kind, sub, offset);
+
+#define sysfs_rw_n(kind, sub, offset, reg) \
+	create_getter_n(kind, offset, sub); \
+	create_setter_n(kind, offset, sub, reg); \
+	create_sysfs_device_rw(kind, sub, offset);
+
+#define sysfs_rw(kind, sub, reg) \
+	create_getter(kind, sub); \
+	create_setter(kind, sub, reg); \
+	create_sysfs_device_rw(kind, sub,);
+
+#define sysfs_fan_with_min(offset, reg_status, reg_ripple, reg_min) \
+	sysfs_fan(offset, reg_status, reg_ripple); \
+	sysfs_rw_n(pwm,, offset, reg_min);
+
+#define sysfs_fan(offset, reg_status, reg_ripple) \
+	sysfs_ro_n(fan, _input, offset); \
+	sysfs_ro_n(fan, _status, offset); \
+	sysfs_rw_n(fan, _ripple, offset, reg_ripple);
+
+#define sysfs_temp(offset, reg_status) \
+	sysfs_ro_n(temp, _input, offset); \
+	sysfs_ro_n(temp, _status, offset); \
+	sysfs_rw_n(temp, _reset, offset, reg_status);
+
+#define sysfs_watchdog(reg_wdog_preset, reg_wdog_state, reg_wdog_control) \
+	sysfs_rw(wdog, _control, reg_wdog_control); \
+	sysfs_rw(wdog, _preset, reg_wdog_preset); \
+	sysfs_rw(wdog, _state, reg_wdog_state);
+
+sysfs_fan_with_min(1, FSCPOS_REG_FAN_STATE[0], FSCPOS_REG_FAN_RIPPLE[0],
+							FSCPOS_REG_PWM[0]);
+sysfs_fan_with_min(2, FSCPOS_REG_FAN_STATE[1], FSCPOS_REG_FAN_RIPPLE[1],
+							FSCPOS_REG_PWM[1]);
+sysfs_fan(3, FSCPOS_REG_FAN_STATE[2], FSCPOS_REG_FAN_RIPPLE[2]);
+
+sysfs_temp(1, FSCPOS_REG_TEMP_STATE[0]);
+sysfs_temp(2, FSCPOS_REG_TEMP_STATE[1]);
+sysfs_temp(3, FSCPOS_REG_TEMP_STATE[2]);
+
+sysfs_watchdog(FSCPOS_REG_WDOG_PRESET, FSCPOS_REG_WDOG_STATE,
+						FSCPOS_REG_WDOG_CONTROL);
+
+static DEVICE_ATTR(event, S_IRUGO, show_event, NULL);
+static DEVICE_ATTR(in0_input, S_IRUGO, show_volt_12, NULL);
+static DEVICE_ATTR(in1_input, S_IRUGO, show_volt_5, NULL);
+static DEVICE_ATTR(in2_input, S_IRUGO, show_volt_batt, NULL);
+
+static int fscpos_attach_adapter(struct i2c_adapter *adapter)
+{
+	if (!(adapter->class & I2C_CLASS_HWMON))
+		return 0;
+	return i2c_detect(adapter, &addr_data, fscpos_detect);
+}
+
+int fscpos_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+	struct i2c_client *new_client;
+	struct fscpos_data *data;
+	int err = 0;
+
+	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
+		goto exit;
+
+	/*
+	 * OK. For now, we presume we have a valid client. We now create the
+	 * client structure, even though we cannot fill it completely yet.
+	 * But it allows us to access fscpos_{read,write}_value.
+	 */
+
+	if (!(data = kmalloc(sizeof(struct fscpos_data), GFP_KERNEL))) {
+		err = -ENOMEM;
+		goto exit;
+	}
+	memset(data, 0, sizeof(struct fscpos_data));
+
+	new_client = &data->client;
+	i2c_set_clientdata(new_client, data);
+	new_client->addr = address;
+	new_client->adapter = adapter;
+	new_client->driver = &fscpos_driver;
+	new_client->flags = 0;
+
+	/* Do the remaining detection unless force or force_fscpos parameter */
+	if (kind < 0) {
+		if ((fscpos_read_value(new_client, FSCPOS_REG_IDENT_0)
+			!= 0x50) /* 'P' */
+		|| (fscpos_read_value(new_client, FSCPOS_REG_IDENT_1)
+			!= 0x45) /* 'E' */
+		|| (fscpos_read_value(new_client, FSCPOS_REG_IDENT_2)
+			!= 0x47))/* 'G' */
+		{
+			dev_dbg(&new_client->dev, "fscpos detection failed\n");
+			goto exit_free;
+		}
+	}
+
+	/* Fill in the remaining client fields and put it in the global list */
+	strlcpy(new_client->name, "fscpos", I2C_NAME_SIZE);
+
+	data->valid = 0;
+	init_MUTEX(&data->update_lock);
+
+	/* Tell the I2C layer a new client has arrived */
+	if ((err = i2c_attach_client(new_client)))
+		goto exit_free;
+
+	/* Inizialize the fscpos chip */
+	fscpos_init_client(new_client);
+
+	/* Announce that the chip was found */
+	dev_info(&new_client->dev, "Found fscpos chip, rev %u\n", data->revision);
+
+	/* Register sysfs hooks */
+	device_create_file(&new_client->dev, &dev_attr_event);
+	device_create_file(&new_client->dev, &dev_attr_in0_input);
+	device_create_file(&new_client->dev, &dev_attr_in1_input);
+	device_create_file(&new_client->dev, &dev_attr_in2_input);
+	device_create_file(&new_client->dev, &dev_attr_wdog_control);
+	device_create_file(&new_client->dev, &dev_attr_wdog_preset);
+	device_create_file(&new_client->dev, &dev_attr_wdog_state);
+	device_create_file(&new_client->dev, &dev_attr_temp1_input);
+	device_create_file(&new_client->dev, &dev_attr_temp1_status);
+	device_create_file(&new_client->dev, &dev_attr_temp1_reset);
+	device_create_file(&new_client->dev, &dev_attr_temp2_input);
+	device_create_file(&new_client->dev, &dev_attr_temp2_status);
+	device_create_file(&new_client->dev, &dev_attr_temp2_reset);
+	device_create_file(&new_client->dev, &dev_attr_temp3_input);
+	device_create_file(&new_client->dev, &dev_attr_temp3_status);
+	device_create_file(&new_client->dev, &dev_attr_temp3_reset);
+	device_create_file(&new_client->dev, &dev_attr_fan1_input);
+	device_create_file(&new_client->dev, &dev_attr_fan1_status);
+	device_create_file(&new_client->dev, &dev_attr_fan1_ripple);
+	device_create_file(&new_client->dev, &dev_attr_pwm1);
+	device_create_file(&new_client->dev, &dev_attr_fan2_input);
+	device_create_file(&new_client->dev, &dev_attr_fan2_status);
+	device_create_file(&new_client->dev, &dev_attr_fan2_ripple);
+	device_create_file(&new_client->dev, &dev_attr_pwm2);
+	device_create_file(&new_client->dev, &dev_attr_fan3_input);
+	device_create_file(&new_client->dev, &dev_attr_fan3_status);
+	device_create_file(&new_client->dev, &dev_attr_fan3_ripple);
+
+	return 0;
+
+exit_free:
+	kfree(data);
+exit:
+	return err;
+}
+
+static int fscpos_detach_client(struct i2c_client *client)
+{
+	int err;
+
+	if ((err = i2c_detach_client(client))) {
+		dev_err(&client->dev, "Client deregistration failed, client"
+							" not detached.\n");
+		return err;
+	}
+	kfree(i2c_get_clientdata(client));
+	return 0;
+}
+
+static int fscpos_read_value(struct i2c_client *client, u8 reg)
+{
+	dev_dbg(&client->dev, "Read reg 0x%02x\n", reg);
+	return i2c_smbus_read_byte_data(client, reg);
+}
+
+static int fscpos_write_value(struct i2c_client *client, u8 reg, u8 value)
+{
+	dev_dbg(&client->dev, "Write reg 0x%02x, val 0x%02x\n", reg, value);
+	return i2c_smbus_write_byte_data(client, reg, value);
+}
+
+/* Called when we have found a new FSCPOS chip */
+static void fscpos_init_client(struct i2c_client *client)
+{
+	struct fscpos_data *data = i2c_get_clientdata(client);
+
+	/* read revision from chip */
+	data->revision = fscpos_read_value(client, FSCPOS_REG_REVISION);
+}
+
+static struct fscpos_data *fscpos_update_device(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct fscpos_data *data = i2c_get_clientdata(client);
+
+	down(&data->update_lock);
+
+	if ((jiffies - data->last_updated > 2 * HZ) ||
+			(jiffies < data->last_updated) || !data->valid) {
+		int i;
+
+		dev_dbg(&client->dev, "Starting fscpos update\n");
+
+		for (i = 0; i < 3; i++) {
+			data->temp_act[i] = fscpos_read_value(client,
+						FSCPOS_REG_TEMP_ACT[i]);
+			data->temp_status[i] = fscpos_read_value(client,
+						FSCPOS_REG_TEMP_STATE[i]);
+			data->fan_act[i] = fscpos_read_value(client,
+						FSCPOS_REG_FAN_ACT[i]);
+			data->fan_status[i] = fscpos_read_value(client,
+						FSCPOS_REG_FAN_STATE[i]);
+			data->fan_ripple[i] = fscpos_read_value(client,
+						FSCPOS_REG_FAN_RIPPLE[i]);
+			if (i < 2) {
+				/* fan2_min is not supported by the chip */
+				data->pwm[i] = fscpos_read_value(client,
+							FSCPOS_REG_PWM[i]);
+			}
+			/* reset fan status if speed is back to > 0 */
+			if (data->fan_status[i] != 0 && data->fan_act[i] > 0) {
+				reset_fan_alarm(client, i);
+			}
+		}
+
+		data->volt[0] = fscpos_read_value(client, FSCPOS_REG_VOLT_12);
+		data->volt[1] = fscpos_read_value(client, FSCPOS_REG_VOLT_5);
+		data->volt[2] = fscpos_read_value(client, FSCPOS_REG_VOLT_BATT);
+
+		data->wdog_preset = fscpos_read_value(client,
+							FSCPOS_REG_WDOG_PRESET);
+		data->wdog_state = fscpos_read_value(client,
+							FSCPOS_REG_WDOG_STATE);
+		data->wdog_control = fscpos_read_value(client,
+						FSCPOS_REG_WDOG_CONTROL);
+
+		data->global_event = fscpos_read_value(client,
+						FSCPOS_REG_EVENT_STATE);
+
+		data->last_updated = jiffies;
+		data->valid = 1;
+	}
+	up(&data->update_lock);
+	return data;
+}
+
+static int __init sm_fscpos_init(void)
+{
+	return i2c_add_driver(&fscpos_driver);
+}
+
+static void __exit sm_fscpos_exit(void)
+{
+	i2c_del_driver(&fscpos_driver);
+}
+
+MODULE_AUTHOR("Stefan Ott <stefan@desire.ch> based on work from Hermann Jung "
+				"<hej@odn.de>, Frodo Looijaard <frodol@dds.nl>"
+				" and Philip Edelbrock <phil@netroedge.com>");
+MODULE_DESCRIPTION("fujitsu siemens poseidon chip driver");
+MODULE_LICENSE("GPL");
+
+module_init(sm_fscpos_init);
+module_exit(sm_fscpos_exit);
diff -Nru a/drivers/i2c/chips/gl518sm.c b/drivers/i2c/chips/gl518sm.c
--- a/drivers/i2c/chips/gl518sm.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/gl518sm.c	2005-03-02 09:56:26 -08:00
@@ -40,6 +40,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -159,12 +160,6 @@
 };
 
 /*
- * Internal variables
- */
-
-static int gl518_id;
-
-/*
  * Sysfs stuff
  */
 
@@ -396,7 +391,6 @@
 
 	/* Fill in the remaining client fields */
 	strlcpy(new_client->name, "gl518sm", I2C_NAME_SIZE);
-	new_client->id = gl518_id++;
 	data->type = kind;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
@@ -512,8 +506,8 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ + HZ / 2) ||
-	    (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
 		dev_dbg(&client->dev, "Starting gl518 update\n");
 
 		data->alarms = gl518_read_value(client, GL518_REG_INT);
diff -Nru a/drivers/i2c/chips/gl520sm.c b/drivers/i2c/chips/gl520sm.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/i2c/chips/gl520sm.c	2005-03-02 09:55:58 -08:00
@@ -0,0 +1,754 @@
+/*
+    gl520sm.c - Part of lm_sensors, Linux kernel modules for hardware
+                monitoring
+    Copyright (c) 1998, 1999  Frodo Looijaard <frodol@dds.nl>,
+                              Kyösti Mälkki <kmalkki@cc.hut.fi>
+    Copyright (c) 2005        Maarten Deprez <maartendeprez@users.sourceforge.net>
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/i2c.h>
+#include <linux/i2c-sensor.h>
+#include <linux/i2c-vid.h>
+
+/* Type of the extra sensor */
+static unsigned short extra_sensor_type;
+module_param(extra_sensor_type, ushort, 0);
+MODULE_PARM_DESC(extra_sensor_type, "Type of extra sensor (0=autodetect, 1=temperature, 2=voltage)");
+
+/* Addresses to scan */
+static unsigned short normal_i2c[] = { 0x2c, 0x2d, I2C_CLIENT_END };
+static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
+
+/* Insmod parameters */
+SENSORS_INSMOD_1(gl520sm);
+
+/* Many GL520 constants specified below 
+One of the inputs can be configured as either temp or voltage.
+That's why _TEMP2 and _IN4 access the same register 
+*/
+
+/* The GL520 registers */
+#define GL520_REG_CHIP_ID		0x00
+#define GL520_REG_REVISION		0x01
+#define GL520_REG_CONF			0x03
+#define GL520_REG_MASK			0x11
+
+#define GL520_REG_VID_INPUT		0x02
+
+#define GL520_REG_IN0_INPUT		0x15
+#define GL520_REG_IN0_LIMIT		0x0c
+#define GL520_REG_IN0_MIN		GL520_REG_IN0_LIMIT
+#define GL520_REG_IN0_MAX		GL520_REG_IN0_LIMIT
+
+#define GL520_REG_IN1_INPUT		0x14
+#define GL520_REG_IN1_LIMIT		0x09
+#define GL520_REG_IN1_MIN		GL520_REG_IN1_LIMIT
+#define GL520_REG_IN1_MAX		GL520_REG_IN1_LIMIT
+
+#define GL520_REG_IN2_INPUT		0x13
+#define GL520_REG_IN2_LIMIT		0x0a
+#define GL520_REG_IN2_MIN		GL520_REG_IN2_LIMIT
+#define GL520_REG_IN2_MAX		GL520_REG_IN2_LIMIT
+
+#define GL520_REG_IN3_INPUT		0x0d
+#define GL520_REG_IN3_LIMIT		0x0b
+#define GL520_REG_IN3_MIN		GL520_REG_IN3_LIMIT
+#define GL520_REG_IN3_MAX		GL520_REG_IN3_LIMIT
+
+#define GL520_REG_IN4_INPUT		0x0e
+#define GL520_REG_IN4_MAX		0x17
+#define GL520_REG_IN4_MIN		0x18
+
+#define GL520_REG_TEMP1_INPUT		0x04
+#define GL520_REG_TEMP1_MAX		0x05
+#define GL520_REG_TEMP1_MAX_HYST	0x06
+
+#define GL520_REG_TEMP2_INPUT		0x0e
+#define GL520_REG_TEMP2_MAX		0x17
+#define GL520_REG_TEMP2_MAX_HYST	0x18
+
+#define GL520_REG_FAN_INPUT		0x07
+#define GL520_REG_FAN_MIN		0x08
+#define GL520_REG_FAN_DIV		0x0f
+#define GL520_REG_FAN_OFF		GL520_REG_FAN_DIV
+
+#define GL520_REG_ALARMS		0x12
+#define GL520_REG_BEEP_MASK		0x10
+#define GL520_REG_BEEP_ENABLE		GL520_REG_CONF
+
+/*
+ * Function declarations
+ */
+
+static int gl520_attach_adapter(struct i2c_adapter *adapter);
+static int gl520_detect(struct i2c_adapter *adapter, int address, int kind);
+static void gl520_init_client(struct i2c_client *client);
+static int gl520_detach_client(struct i2c_client *client);
+static int gl520_read_value(struct i2c_client *client, u8 reg);
+static int gl520_write_value(struct i2c_client *client, u8 reg, u16 value);
+static struct gl520_data *gl520_update_device(struct device *dev);
+
+/* Driver data */
+static struct i2c_driver gl520_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "gl520sm",
+	.id		= I2C_DRIVERID_GL520,
+	.flags		= I2C_DF_NOTIFY,
+	.attach_adapter	= gl520_attach_adapter,
+	.detach_client	= gl520_detach_client,
+};
+
+/* Client data */
+struct gl520_data {
+	struct i2c_client client;
+	struct semaphore update_lock;
+	char valid;		/* zero until the following fields are valid */
+	unsigned long last_updated;	/* in jiffies */
+
+	u8 vid;
+	u8 vrm;
+	u8 in_input[5];		/* [0] = VVD */
+	u8 in_min[5];		/* [0] = VDD */
+	u8 in_max[5];		/* [0] = VDD */
+	u8 fan_input[2];
+	u8 fan_min[2];
+	u8 fan_div[2];
+	u8 fan_off;
+	u8 temp_input[2];
+	u8 temp_max[2];
+	u8 temp_max_hyst[2];
+	u8 alarms;
+	u8 beep_enable;
+	u8 beep_mask;
+	u8 alarm_mask;
+	u8 two_temps;
+};
+
+/*
+ * Sysfs stuff
+ */
+
+#define sysfs_r(type, n, item, reg) \
+static ssize_t get_##type##item (struct gl520_data *, char *, int); \
+static ssize_t get_##type##n##item (struct device *, char *); \
+static ssize_t get_##type##n##item (struct device *dev, char *buf) \
+{ \
+	struct gl520_data *data = gl520_update_device(dev); \
+	return get_##type##item(data, buf, (n)); \
+}
+
+#define sysfs_w(type, n, item, reg) \
+static ssize_t set_##type##item (struct i2c_client *, struct gl520_data *, const char *, size_t, int, int); \
+static ssize_t set_##type##n##item (struct device *, const char *, size_t); \
+static ssize_t set_##type##n##item (struct device *dev, const char *buf, size_t count) \
+{ \
+	struct i2c_client *client = to_i2c_client(dev); \
+	struct gl520_data *data = i2c_get_clientdata(client); \
+	return set_##type##item(client, data, buf, count, (n), reg); \
+}
+
+#define sysfs_rw_n(type, n, item, reg) \
+sysfs_r(type, n, item, reg) \
+sysfs_w(type, n, item, reg) \
+static DEVICE_ATTR(type##n##item, S_IRUGO | S_IWUSR, get_##type##n##item, set_##type##n##item);
+
+#define sysfs_ro_n(type, n, item, reg) \
+sysfs_r(type, n, item, reg) \
+static DEVICE_ATTR(type##n##item, S_IRUGO, get_##type##n##item, NULL);
+
+#define sysfs_rw(type, item, reg) \
+sysfs_r(type, 0, item, reg) \
+sysfs_w(type, 0, item, reg) \
+static DEVICE_ATTR(type##item, S_IRUGO | S_IWUSR, get_##type##0##item, set_##type##0##item);
+
+#define sysfs_ro(type, item, reg) \
+sysfs_r(type, 0, item, reg) \
+static DEVICE_ATTR(type##item, S_IRUGO, get_##type##0##item, NULL);
+
+
+#define sysfs_vid(n) \
+sysfs_ro_n(cpu, n, _vid, GL520_REG_VID_INPUT)
+
+#define device_create_file_vid(client, n) \
+device_create_file(&client->dev, &dev_attr_cpu##n##_vid)
+
+#define sysfs_in(n) \
+sysfs_ro_n(in, n, _input, GL520_REG_IN##n##INPUT) \
+sysfs_rw_n(in, n, _min, GL520_REG_IN##n##_MIN) \
+sysfs_rw_n(in, n, _max, GL520_REG_IN##n##_MAX) \
+
+#define device_create_file_in(client, n) \
+({device_create_file(&client->dev, &dev_attr_in##n##_input); \
+device_create_file(&client->dev, &dev_attr_in##n##_min); \
+device_create_file(&client->dev, &dev_attr_in##n##_max);})
+
+#define sysfs_fan(n) \
+sysfs_ro_n(fan, n, _input, GL520_REG_FAN_INPUT) \
+sysfs_rw_n(fan, n, _min, GL520_REG_FAN_MIN) \
+sysfs_rw_n(fan, n, _div, GL520_REG_FAN_DIV)
+
+#define device_create_file_fan(client, n) \
+({device_create_file(&client->dev, &dev_attr_fan##n##_input); \
+device_create_file(&client->dev, &dev_attr_fan##n##_min); \
+device_create_file(&client->dev, &dev_attr_fan##n##_div);})
+
+#define sysfs_fan_off(n) \
+sysfs_rw_n(fan, n, _off, GL520_REG_FAN_OFF) \
+
+#define device_create_file_fan_off(client, n) \
+device_create_file(&client->dev, &dev_attr_fan##n##_off)
+
+#define sysfs_temp(n) \
+sysfs_ro_n(temp, n, _input, GL520_REG_TEMP##n##_INPUT) \
+sysfs_rw_n(temp, n, _max, GL520_REG_TEMP##n##_MAX) \
+sysfs_rw_n(temp, n, _max_hyst, GL520_REG_TEMP##n##_MAX_HYST)
+
+#define device_create_file_temp(client, n) \
+({device_create_file(&client->dev, &dev_attr_temp##n##_input); \
+device_create_file(&client->dev, &dev_attr_temp##n##_max); \
+device_create_file(&client->dev, &dev_attr_temp##n##_max_hyst);})
+
+#define sysfs_alarms() \
+sysfs_ro(alarms, , GL520_REG_ALARMS) \
+sysfs_rw(beep_enable, , GL520_REG_BEEP_ENABLE) \
+sysfs_rw(beep_mask, , GL520_REG_BEEP_MASK)
+
+#define device_create_file_alarms(client) \
+({device_create_file(&client->dev, &dev_attr_alarms); \
+device_create_file(&client->dev, &dev_attr_beep_enable); \
+device_create_file(&client->dev, &dev_attr_beep_mask);})
+
+
+sysfs_vid(0)
+
+sysfs_in(0)
+sysfs_in(1)
+sysfs_in(2)
+sysfs_in(3)
+sysfs_in(4)
+
+sysfs_fan(1)
+sysfs_fan(2)
+sysfs_fan_off(1)
+
+sysfs_temp(1)
+sysfs_temp(2)
+
+sysfs_alarms()
+
+
+static ssize_t get_cpu_vid(struct gl520_data *data, char *buf, int n)
+{
+	return sprintf(buf, "%u\n", vid_from_reg(data->vid, data->vrm));
+}
+
+#define VDD_FROM_REG(val) (((val)*95+2)/4)
+#define VDD_TO_REG(val) (SENSORS_LIMIT((((val)*4+47)/95),0,255))
+
+#define IN_FROM_REG(val) ((val)*19)
+#define IN_TO_REG(val) (SENSORS_LIMIT((((val)+9)/19),0,255))
+
+static ssize_t get_in_input(struct gl520_data *data, char *buf, int n)
+{
+	u8 r = data->in_input[n];
+
+	if (n == 0)
+		return sprintf(buf, "%d\n", VDD_FROM_REG(r));
+	else
+		return sprintf(buf, "%d\n", IN_FROM_REG(r));
+}
+
+static ssize_t get_in_min(struct gl520_data *data, char *buf, int n)
+{
+	u8 r = data->in_min[n];
+
+	if (n == 0)
+		return sprintf(buf, "%d\n", VDD_FROM_REG(r));
+	else
+		return sprintf(buf, "%d\n", IN_FROM_REG(r));
+}
+
+static ssize_t get_in_max(struct gl520_data *data, char *buf, int n)
+{
+	u8 r = data->in_max[n];
+
+	if (n == 0)
+		return sprintf(buf, "%d\n", VDD_FROM_REG(r));
+	else
+		return sprintf(buf, "%d\n", IN_FROM_REG(r));
+}
+
+static ssize_t set_in_min(struct i2c_client *client, struct gl520_data *data, const char *buf, size_t count, int n, int reg)
+{
+	long v = simple_strtol(buf, NULL, 10);
+	u8 r;
+
+	if (n == 0)
+		r = VDD_TO_REG(v);
+	else
+		r = IN_TO_REG(v);
+
+	data->in_min[n] = r;
+
+	if (n < 4)
+		gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0xff) | r);
+	else
+		gl520_write_value(client, reg, r);
+
+	return count;
+}
+
+static ssize_t set_in_max(struct i2c_client *client, struct gl520_data *data, const char *buf, size_t count, int n, int reg)
+{
+	long v = simple_strtol(buf, NULL, 10);
+	u8 r;
+
+	if (n == 0)
+		r = VDD_TO_REG(v);
+	else
+		r = IN_TO_REG(v);
+
+	data->in_max[n] = r;
+
+	if (n < 4)
+		gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0xff00) | (r << 8));
+	else
+		gl520_write_value(client, reg, r);
+
+	return count;
+}
+
+#define DIV_FROM_REG(val) (1 << (val))
+#define FAN_FROM_REG(val,div) ((val)==0 ? 0 : (480000/((val) << (div))))
+#define FAN_TO_REG(val,div) ((val)<=0?0:SENSORS_LIMIT((480000 + ((val) << ((div)-1))) / ((val) << (div)), 1, 255));
+
+static ssize_t get_fan_input(struct gl520_data *data, char *buf, int n)
+{
+	return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_input[n - 1], data->fan_div[n - 1]));
+}
+
+static ssize_t get_fan_min(struct gl520_data *data, char *buf, int n)
+{
+	return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan_min[n - 1], data->fan_div[n - 1]));
+}
+
+static ssize_t get_fan_div(struct gl520_data *data, char *buf, int n)
+{
+	return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[n - 1]));
+}
+
+static ssize_t get_fan_off(struct gl520_data *data, char *buf, int n)
+{
+	return sprintf(buf, "%d\n", data->fan_off);
+}
+
+static ssize_t set_fan_min(struct i2c_client *client, struct gl520_data *data, const char *buf, size_t count, int n, int reg)
+{
+	unsigned long v = simple_strtoul(buf, NULL, 10);
+	u8 r = FAN_TO_REG(v, data->fan_div[n - 1]);
+
+	data->fan_min[n - 1] = r;
+
+	if (n == 1)
+		gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0xff00) | (r << 8));
+	else
+		gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0xff) | r);
+
+	data->beep_mask = gl520_read_value(client, GL520_REG_BEEP_MASK);
+	if (data->fan_min[n - 1] == 0)
+		data->alarm_mask &= (n == 1) ? ~0x20 : ~0x40;
+	else
+		data->alarm_mask |= (n == 1) ? 0x20 : 0x40;
+	data->beep_mask &= data->alarm_mask;
+	gl520_write_value(client, GL520_REG_BEEP_MASK, data->beep_mask);
+
+	return count;
+}
+
+static ssize_t set_fan_div(struct i2c_client *client, struct gl520_data *data, const char *buf, size_t count, int n, int reg)
+{
+	unsigned long v = simple_strtoul(buf, NULL, 10);
+	u8 r;
+
+	switch (v) {
+	case 1: r = 0; break;
+	case 2: r = 1; break;
+	case 4: r = 2; break;
+	case 8: r = 3; break;
+	default:
+		dev_err(&client->dev, "fan_div value %ld not supported. Choose one of 1, 2, 4 or 8!\n", v);
+		return -EINVAL;
+	}
+
+	data->fan_div[n - 1] = r;
+
+	if (n == 1)
+		gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0xc0) | (r << 6));
+	else
+		gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x30) | (r << 4));
+
+	return count;
+}
+
+static ssize_t set_fan_off(struct i2c_client *client, struct gl520_data *data, const char *buf, size_t count, int n, int reg)
+{
+	u8 r = simple_strtoul(buf, NULL, 10)?1:0;
+
+	data->fan_off = r;
+	gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x0c) | (r << 2));
+
+	return count;
+}
+
+#define TEMP_FROM_REG(val) (((val) - 130) * 1000)
+#define TEMP_TO_REG(val) (SENSORS_LIMIT(((((val)<0?(val)-500:(val)+500) / 1000)+130),0,255))
+
+static ssize_t get_temp_input(struct gl520_data *data, char *buf, int n)
+{
+	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_input[n - 1]));
+}
+
+static ssize_t get_temp_max(struct gl520_data *data, char *buf, int n)
+{
+	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[n - 1]));
+}
+
+static ssize_t get_temp_max_hyst(struct gl520_data *data, char *buf, int n)
+{
+	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max_hyst[n - 1]));
+}
+
+static ssize_t set_temp_max(struct i2c_client *client, struct gl520_data *data, const char *buf, size_t count, int n, int reg)
+{
+	long v = simple_strtol(buf, NULL, 10);
+	u8 r = TEMP_TO_REG(v);
+
+	data->temp_max[n - 1] = r;
+	gl520_write_value(client, reg, r);
+
+	return count;
+}
+
+static ssize_t set_temp_max_hyst(struct i2c_client *client, struct gl520_data *data, const char *buf, size_t count, int n, int reg)
+{
+	long v = simple_strtol(buf, NULL, 10);
+	u8 r = TEMP_TO_REG(v);
+
+	data->temp_max_hyst[n - 1] = r;
+	gl520_write_value(client, reg, r);
+
+	return count;
+}
+
+static ssize_t get_alarms(struct gl520_data *data, char *buf, int n)
+{
+	return sprintf(buf, "%d\n", data->alarms);
+}
+
+static ssize_t get_beep_enable(struct gl520_data *data, char *buf, int n)
+{
+	return sprintf(buf, "%d\n", data->beep_enable);
+}
+
+static ssize_t get_beep_mask(struct gl520_data *data, char *buf, int n)
+{
+	return sprintf(buf, "%d\n", data->beep_mask);
+}
+
+static ssize_t set_beep_enable(struct i2c_client *client, struct gl520_data *data, const char *buf, size_t count, int n, int reg)
+{
+	u8 r = simple_strtoul(buf, NULL, 10)?0:1;
+
+	data->beep_enable = !r;
+	gl520_write_value(client, reg, (gl520_read_value(client, reg) & ~0x04) | (r << 2));
+
+	return count;
+}
+
+static ssize_t set_beep_mask(struct i2c_client *client, struct gl520_data *data, const char *buf, size_t count, int n, int reg)
+{
+	u8 r = simple_strtoul(buf, NULL, 10) & data->alarm_mask;
+
+	data->beep_mask = r;
+	gl520_write_value(client, reg, r);
+
+	return count;
+}
+
+
+/*
+ * Real code
+ */
+
+static int gl520_attach_adapter(struct i2c_adapter *adapter)
+{
+	if (!(adapter->class & I2C_CLASS_HWMON))
+		return 0;
+	return i2c_detect(adapter, &addr_data, gl520_detect);
+}
+
+static int gl520_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+	struct i2c_client *new_client;
+	struct gl520_data *data;
+	int err = 0;
+
+	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
+				     I2C_FUNC_SMBUS_WORD_DATA))
+		goto exit;
+
+	/* OK. For now, we presume we have a valid client. We now create the
+	   client structure, even though we cannot fill it completely yet.
+	   But it allows us to access gl520_{read,write}_value. */
+
+	if (!(data = kmalloc(sizeof(struct gl520_data), GFP_KERNEL))) {
+		err = -ENOMEM;
+		goto exit;
+	}
+	memset(data, 0, sizeof(struct gl520_data));
+
+	new_client = &data->client;
+	i2c_set_clientdata(new_client, data);
+	new_client->addr = address;
+	new_client->adapter = adapter;
+	new_client->driver = &gl520_driver;
+	new_client->flags = 0;
+
+	/* Determine the chip type. */
+	if (kind < 0) {
+		if ((gl520_read_value(new_client, GL520_REG_CHIP_ID) != 0x20) ||
+		    ((gl520_read_value(new_client, GL520_REG_REVISION) & 0x7f) != 0x00) ||
+		    ((gl520_read_value(new_client, GL520_REG_CONF) & 0x80) != 0x00)) {
+			dev_dbg(&new_client->dev, "Unknown chip type, skipping\n");
+			goto exit_free;
+		}
+	}
+
+	/* Fill in the remaining client fields */
+	strlcpy(new_client->name, "gl520sm", I2C_NAME_SIZE);
+	data->valid = 0;
+	init_MUTEX(&data->update_lock);
+
+	/* Tell the I2C layer a new client has arrived */
+	if ((err = i2c_attach_client(new_client)))
+		goto exit_free;
+
+	/* Initialize the GL520SM chip */
+	gl520_init_client(new_client);
+
+	/* Register sysfs hooks */
+	device_create_file_vid(new_client, 0);
+
+	device_create_file_in(new_client, 0);
+	device_create_file_in(new_client, 1);
+	device_create_file_in(new_client, 2);
+	device_create_file_in(new_client, 3);
+	if (!data->two_temps)
+		device_create_file_in(new_client, 4);
+
+	device_create_file_fan(new_client, 1);
+	device_create_file_fan(new_client, 2);
+	device_create_file_fan_off(new_client, 1);
+
+	device_create_file_temp(new_client, 1);
+	if (data->two_temps)
+		device_create_file_temp(new_client, 2);
+
+	device_create_file_alarms(new_client);
+
+	return 0;
+
+exit_free:
+	kfree(data);
+exit:
+	return err;
+}
+
+
+/* Called when we have found a new GL520SM. */
+static void gl520_init_client(struct i2c_client *client)
+{
+	struct gl520_data *data = i2c_get_clientdata(client);
+	u8 oldconf, conf;
+
+	conf = oldconf = gl520_read_value(client, GL520_REG_CONF);
+
+	data->alarm_mask = 0xff;
+	data->vrm = i2c_which_vrm();
+
+	if (extra_sensor_type == 1)
+		conf &= ~0x10;
+	else if (extra_sensor_type == 2)
+		conf |= 0x10;
+	data->two_temps = !(conf & 0x10);
+
+	/* If IRQ# is disabled, we can safely force comparator mode */
+	if (!(conf & 0x20))
+		conf &= 0xf7;
+
+	/* Enable monitoring if needed */
+	conf |= 0x40;
+
+	if (conf != oldconf)
+		gl520_write_value(client, GL520_REG_CONF, conf);
+
+	gl520_update_device(&(client->dev));
+
+	if (data->fan_min[0] == 0)
+		data->alarm_mask &= ~0x20;
+	if (data->fan_min[1] == 0)
+		data->alarm_mask &= ~0x40;
+
+	data->beep_mask &= data->alarm_mask;
+	gl520_write_value(client, GL520_REG_BEEP_MASK, data->beep_mask);
+}
+
+static int gl520_detach_client(struct i2c_client *client)
+{
+	int err;
+
+	if ((err = i2c_detach_client(client))) {
+		dev_err(&client->dev, "Client deregistration failed, "
+			"client not detached.\n");
+		return err;
+	}
+
+	kfree(i2c_get_clientdata(client));
+	return 0;
+}
+
+
+/* Registers 0x07 to 0x0c are word-sized, others are byte-sized 
+   GL520 uses a high-byte first convention */
+static int gl520_read_value(struct i2c_client *client, u8 reg)
+{
+	if ((reg >= 0x07) && (reg <= 0x0c))
+		return swab16(i2c_smbus_read_word_data(client, reg));
+	else
+		return i2c_smbus_read_byte_data(client, reg);
+}
+
+static int gl520_write_value(struct i2c_client *client, u8 reg, u16 value)
+{
+	if ((reg >= 0x07) && (reg <= 0x0c))
+		return i2c_smbus_write_word_data(client, reg, swab16(value));
+	else
+		return i2c_smbus_write_byte_data(client, reg, value);
+}
+
+
+static struct gl520_data *gl520_update_device(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct gl520_data *data = i2c_get_clientdata(client);
+	int val;
+
+	down(&data->update_lock);
+
+	if ((jiffies - data->last_updated > 2 * HZ) ||
+	    (jiffies < data->last_updated) || !data->valid) {
+
+		dev_dbg(&client->dev, "Starting gl520sm update\n");
+
+		data->alarms = gl520_read_value(client, GL520_REG_ALARMS);
+		data->beep_mask = gl520_read_value(client, GL520_REG_BEEP_MASK);
+		data->vid = gl520_read_value(client, GL520_REG_VID_INPUT) & 0x1f;
+
+		val = gl520_read_value(client, GL520_REG_IN0_LIMIT);
+		data->in_min[0] = val & 0xff;
+		data->in_max[0] = (val >> 8) & 0xff;
+		val = gl520_read_value(client, GL520_REG_IN1_LIMIT);
+		data->in_min[1] = val & 0xff;
+		data->in_max[1] = (val >> 8) & 0xff;
+		val = gl520_read_value(client, GL520_REG_IN2_LIMIT);
+		data->in_min[2] = val & 0xff;
+		data->in_max[2] = (val >> 8) & 0xff;
+		val = gl520_read_value(client, GL520_REG_IN3_LIMIT);
+		data->in_min[3] = val & 0xff;
+		data->in_max[3] = (val >> 8) & 0xff;
+
+		val = gl520_read_value(client, GL520_REG_FAN_INPUT);
+		data->fan_input[0] = (val >> 8) & 0xff;
+		data->fan_input[1] = val & 0xff;
+
+		val = gl520_read_value(client, GL520_REG_FAN_MIN);
+		data->fan_min[0] = (val >> 8) & 0xff;
+		data->fan_min[1] = val & 0xff;
+
+		data->temp_input[0] = gl520_read_value(client, GL520_REG_TEMP1_INPUT);
+		data->temp_max[0] = gl520_read_value(client, GL520_REG_TEMP1_MAX);
+		data->temp_max_hyst[0] = gl520_read_value(client, GL520_REG_TEMP1_MAX_HYST);
+
+		val = gl520_read_value(client, GL520_REG_FAN_DIV);
+		data->fan_div[0] = (val >> 6) & 0x03;
+		data->fan_div[1] = (val >> 4) & 0x03;
+		data->fan_off = (val >> 2) & 0x01;
+
+		data->alarms &= data->alarm_mask;
+
+		val = gl520_read_value(client, GL520_REG_CONF);
+		data->beep_enable = !((val >> 2) & 1);
+
+		data->in_input[0] = gl520_read_value(client, GL520_REG_IN0_INPUT);
+		data->in_input[1] = gl520_read_value(client, GL520_REG_IN1_INPUT);
+		data->in_input[2] = gl520_read_value(client, GL520_REG_IN2_INPUT);
+		data->in_input[3] = gl520_read_value(client, GL520_REG_IN3_INPUT);
+
+		/* Temp1 and Vin4 are the same input */
+		if (data->two_temps) {
+			data->temp_input[1] = gl520_read_value(client, GL520_REG_TEMP2_INPUT);
+			data->temp_max[1] = gl520_read_value(client, GL520_REG_TEMP2_MAX);
+			data->temp_max_hyst[1] = gl520_read_value(client, GL520_REG_TEMP2_MAX_HYST);
+		} else {
+			data->in_input[4] = gl520_read_value(client, GL520_REG_IN4_INPUT);
+			data->in_min[4] = gl520_read_value(client, GL520_REG_IN4_MIN);
+			data->in_max[4] = gl520_read_value(client, GL520_REG_IN4_MAX);
+		}
+
+		data->last_updated = jiffies;
+		data->valid = 1;
+	}
+
+	up(&data->update_lock);
+
+	return data;
+}
+
+
+static int __init sensors_gl520sm_init(void)
+{
+	return i2c_add_driver(&gl520_driver);
+}
+
+static void __exit sensors_gl520sm_exit(void)
+{
+	i2c_del_driver(&gl520_driver);
+}
+
+
+MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl>, "
+	"Kyösti Mälkki <kmalkki@cc.hut.fi>, "
+	"Maarten Deprez <maartendeprez@users.sourceforge.net>");
+MODULE_DESCRIPTION("GL520SM driver");
+MODULE_LICENSE("GPL");
+
+module_init(sensors_gl520sm_init);
+module_exit(sensors_gl520sm_exit);
diff -Nru a/drivers/i2c/chips/isp1301_omap.c b/drivers/i2c/chips/isp1301_omap.c
--- a/drivers/i2c/chips/isp1301_omap.c	2005-01-05 12:21:54 -08:00
+++ b/drivers/i2c/chips/isp1301_omap.c	2005-03-02 10:01:11 -08:00
@@ -1503,7 +1503,6 @@
 	isp->client.addr = address;
 	i2c_set_clientdata(&isp->client, isp);
 	isp->client.adapter = bus;
-	isp->client.id = 1301;
 	isp->client.driver = &isp1301_driver;
 	strlcpy(isp->client.name, DRIVER_NAME, I2C_NAME_SIZE);
 	i2c = &isp->client;
diff -Nru a/drivers/i2c/chips/it87.c b/drivers/i2c/chips/it87.c
--- a/drivers/i2c/chips/it87.c	2005-02-02 22:34:21 -08:00
+++ b/drivers/i2c/chips/it87.c	2005-03-02 09:56:26 -08:00
@@ -35,6 +35,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
@@ -104,6 +105,9 @@
 /* Update battery voltage after every reading if true */
 static int update_vbat;
 
+/* Not all BIOSes properly configure the PWM registers */
+static int fix_pwm_polarity;
+
 /* Chip Type */
 
 static u16 chip_type;
@@ -224,6 +228,7 @@
 static int it87_write_value(struct i2c_client *client, u8 register,
 			u8 value);
 static struct it87_data *it87_update_device(struct device *dev);
+static int it87_check_pwm(struct i2c_client *client);
 static void it87_init_client(struct i2c_client *client, struct it87_data *data);
 
 
@@ -718,7 +723,6 @@
 	const char *name = "";
 	int is_isa = i2c_is_isa_adapter(adapter);
 	int enable_pwm_interface;
-	int tmp;
 
 	if (!is_isa && 
 	    !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
@@ -822,20 +826,12 @@
 	if ((err = i2c_attach_client(new_client)))
 		goto ERROR2;
 
+	/* Check PWM configuration */
+	enable_pwm_interface = it87_check_pwm(new_client);
+
 	/* Initialize the IT87 chip */
 	it87_init_client(new_client, data);
 
-	/* Some BIOSes fail to correctly configure the IT87 fans. All fans off
-	 * and polarity set to active low is sign that this is the case so we
-	 * disable pwm control to protect the user. */
-	enable_pwm_interface = 1;
-	tmp = it87_read_value(new_client, IT87_REG_FAN_CTL);
-	if ((tmp & 0x87) == 0) {
-		enable_pwm_interface = 0;
-		dev_info(&new_client->dev,
-			"detected broken BIOS defaults, disabling pwm interface");
-	}
-
 	/* Register sysfs hooks */
 	device_create_file(&new_client->dev, &dev_attr_in0_input);
 	device_create_file(&new_client->dev, &dev_attr_in1_input);
@@ -966,6 +962,56 @@
 		return i2c_smbus_write_byte_data(client, reg, value);
 }
 
+/* Return 1 if and only if the PWM interface is safe to use */
+static int it87_check_pwm(struct i2c_client *client)
+{
+	/* Some BIOSes fail to correctly configure the IT87 fans. All fans off
+	 * and polarity set to active low is sign that this is the case so we
+	 * disable pwm control to protect the user. */
+	int tmp = it87_read_value(client, IT87_REG_FAN_CTL);
+	if ((tmp & 0x87) == 0) {
+		if (fix_pwm_polarity) {
+			/* The user asks us to attempt a chip reconfiguration.
+			 * This means switching to active high polarity and
+			 * inverting all fan speed values. */
+			int i;
+			u8 pwm[3];
+
+			for (i = 0; i < 3; i++)
+				pwm[i] = it87_read_value(client,
+							 IT87_REG_PWM(i));
+
+			/* If any fan is in automatic pwm mode, the polarity
+			 * might be correct, as suspicious as it seems, so we
+			 * better don't change anything (but still disable the
+			 * PWM interface). */
+			if (!((pwm[0] | pwm[1] | pwm[2]) & 0x80)) {
+				dev_info(&client->dev, "Reconfiguring PWM to "
+					 "active high polarity\n");
+				it87_write_value(client, IT87_REG_FAN_CTL,
+						 tmp | 0x87);
+				for (i = 0; i < 3; i++)
+					it87_write_value(client,
+							 IT87_REG_PWM(i),
+							 0x7f & ~pwm[i]);
+				return 1;
+			}
+
+			dev_info(&client->dev, "PWM configuration is "
+				 "too broken to be fixed\n");
+		}
+
+		dev_info(&client->dev, "Detected broken BIOS "
+			 "defaults, disabling PWM interface\n");
+		return 0;
+	} else if (fix_pwm_polarity) {
+		dev_info(&client->dev, "PWM configuration looks "
+			 "sane, won't touch\n");
+	}
+
+	return 1;
+}
+
 /* Called when we have found a new IT87. */
 static void it87_init_client(struct i2c_client *client, struct it87_data *data)
 {
@@ -1038,8 +1084,8 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ + HZ / 2) ||
-	    (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
 
 		if (update_vbat) {
 			/* Cleared after each update, so reenable.  Value
@@ -1126,6 +1172,8 @@
 MODULE_DESCRIPTION("IT8705F, IT8712F, Sis950 driver");
 module_param(update_vbat, bool, 0);
 MODULE_PARM_DESC(update_vbat, "Update vbat if set else return powerup value");
+module_param(fix_pwm_polarity, bool, 0);
+MODULE_PARM_DESC(fix_pwm_polarity, "Force PWM polarity to active high (DANGEROUS)");
 MODULE_LICENSE("GPL");
 
 module_init(sm_it87_init);
diff -Nru a/drivers/i2c/chips/lm63.c b/drivers/i2c/chips/lm63.c
--- a/drivers/i2c/chips/lm63.c	2005-01-14 14:17:50 -08:00
+++ b/drivers/i2c/chips/lm63.c	2005-03-02 09:56:26 -08:00
@@ -41,6 +41,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -492,9 +493,7 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ) ||
-	    (jiffies < data->last_updated) ||
-	    !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
 		if (data->config & 0x04) { /* tachometer enabled  */
 			/* order matters for fan1_input */
 			data->fan1_input = i2c_smbus_read_byte_data(client,
diff -Nru a/drivers/i2c/chips/lm75.c b/drivers/i2c/chips/lm75.c
--- a/drivers/i2c/chips/lm75.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/lm75.c	2005-03-02 09:56:26 -08:00
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include "lm75.h"
@@ -73,8 +74,6 @@
 	.detach_client	= lm75_detach_client,
 };
 
-static int lm75_id;
-
 #define show(value)	\
 static ssize_t show_##value(struct device *dev, char *buf)		\
 {									\
@@ -196,8 +195,6 @@
 
 	/* Fill in the remaining client fields and put it into the global list */
 	strlcpy(new_client->name, name, I2C_NAME_SIZE);
-
-	new_client->id = lm75_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -263,8 +260,8 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ + HZ / 2) ||
-	    (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
 		dev_dbg(&client->dev, "Starting lm75 update\n");
 
 		data->temp_input = lm75_read_value(client, LM75_REG_TEMP);
diff -Nru a/drivers/i2c/chips/lm77.c b/drivers/i2c/chips/lm77.c
--- a/drivers/i2c/chips/lm77.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/lm77.c	2005-03-02 09:56:26 -08:00
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -81,8 +82,6 @@
 	.detach_client	= lm77_detach_client,
 };
 
-static int lm77_id;
-
 /* straight from the datasheet */
 #define LM77_TEMP_MIN (-55000)
 #define LM77_TEMP_MAX 125000
@@ -295,8 +294,6 @@
 
 	/* Fill in the remaining client fields and put it into the global list */
 	strlcpy(new_client->name, name, I2C_NAME_SIZE);
-
-	new_client->id = lm77_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -364,8 +361,8 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ + HZ / 2) ||
-	    (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
 		dev_dbg(&client->dev, "Starting lm77 update\n");
 		data->temp_input =
 			LM77_TEMP_FROM_REG(lm77_read_value(client,
diff -Nru a/drivers/i2c/chips/lm78.c b/drivers/i2c/chips/lm78.c
--- a/drivers/i2c/chips/lm78.c	2004-12-10 10:39:43 -08:00
+++ b/drivers/i2c/chips/lm78.c	2005-03-02 09:56:26 -08:00
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <asm/io.h>
@@ -81,9 +82,8 @@
 
 static inline u8 FAN_TO_REG(long rpm, int div)
 {
-	if (rpm == 0)
+	if (rpm <= 0)
 		return 255;
-	rpm = SENSORS_LIMIT(rpm, 1, 1000000);
 	return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, 254);
 }
 
@@ -94,15 +94,15 @@
 
 /* TEMP: mC (-128C to +127C)
    REG: 1C/bit, two's complement */
-static inline u8 TEMP_TO_REG(int val)
+static inline s8 TEMP_TO_REG(int val)
 {
 	int nval = SENSORS_LIMIT(val, -128000, 127000) ;
-	return nval<0 ? (nval-500)/1000+0x100 : (nval+500)/1000;
+	return nval<0 ? (nval-500)/1000 : (nval+500)/1000;
 }
 
-static inline int TEMP_FROM_REG(u8 val)
+static inline int TEMP_FROM_REG(s8 val)
 {
-	return (val>=0x80 ? val-0x100 : val) * 1000;
+	return val * 1000;
 }
 
 /* VID: mV
@@ -112,16 +112,6 @@
 	return val==0x1f ? 0 : val>=0x10 ? 5100-val*100 : 2050-val*50;
 }
 
-/* ALARMS: chip-specific bitmask
-   REG: (same) */
-#define ALARMS_FROM_REG(val) (val)
-
-/* FAN DIV: 1, 2, 4, or 8 (defaults to 2)
-   REG: 0, 1, 2, or 3 (respectively) (defaults to 1) */
-static inline u8 DIV_TO_REG(int val)
-{
-	return val==8 ? 3 : val==4 ? 2 : val==1 ? 0 : 1;
-}
 #define DIV_FROM_REG(val) (1 << (val))
 
 /* There are some complications in a module like this. First off, LM78 chips
@@ -157,9 +147,9 @@
 	u8 in_min[7];		/* Register value */
 	u8 fan[3];		/* Register value */
 	u8 fan_min[3];		/* Register value */
-	u8 temp;		/* Register value */
-	u8 temp_over;		/* Register value */
-	u8 temp_hyst;		/* Register value */
+	s8 temp;		/* Register value */
+	s8 temp_over;		/* Register value */
+	s8 temp_hyst;		/* Register value */
 	u8 fan_div[3];		/* Register encoding, shifted right */
 	u8 vid;			/* Register encoding, combined */
 	u16 alarms;		/* Register encoding, combined */
@@ -357,7 +347,17 @@
 			DIV_FROM_REG(data->fan_div[nr]));
 	unsigned long val = simple_strtoul(buf, NULL, 10);
 	int reg = lm78_read_value(client, LM78_REG_VID_FANDIV);
-	data->fan_div[nr] = DIV_TO_REG(val);
+	switch (val) {
+	case 1: data->fan_div[nr] = 0; break;
+	case 2: data->fan_div[nr] = 1; break;
+	case 4: data->fan_div[nr] = 2; break;
+	case 8: data->fan_div[nr] = 3; break;
+	default:
+		dev_err(&client->dev, "fan_div value %ld not "
+			"supported. Choose one of 1, 2, 4 or 8!\n", val);
+		return -EINVAL;
+	}
+
 	switch (nr) {
 	case 0:
 		reg = (reg & 0xcf) | (data->fan_div[nr] << 4);
@@ -430,7 +430,7 @@
 static ssize_t show_alarms(struct device *dev, char *buf)
 {
 	struct lm78_data *data = lm78_update_device(dev);
-	return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->alarms));
+	return sprintf(buf, "%u\n", data->alarms);
 }
 static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
 
@@ -633,17 +633,15 @@
 {
 	int err;
 
-	/* release ISA region first */
-	if(i2c_is_isa_client(client))
-		release_region(client->addr, LM78_EXTENT);
-
-	/* now it's safe to scrap the rest */
 	if ((err = i2c_detach_client(client))) {
 		dev_err(&client->dev,
 		    "Client deregistration failed, client not detached.\n");
 		return err;
 	}
 
+	if(i2c_is_isa_client(client))
+		release_region(client->addr, LM78_EXTENT);
+
 	kfree(i2c_get_clientdata(client));
 
 	return 0;
@@ -653,9 +651,7 @@
    We don't want to lock the whole ISA bus, so we lock each client
    separately.
    We ignore the LM78 BUSY flag at this moment - it could lead to deadlocks,
-   would slow down the LM78 access and should not be necessary. 
-   There are some ugly typecasts here, but the good new is - they should
-   nowhere else be necessary! */
+   would slow down the LM78 access and should not be necessary.  */
 static int lm78_read_value(struct i2c_client *client, u8 reg)
 {
 	int res;
@@ -709,8 +705,8 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ + HZ / 2) ||
-	    (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
 
 		dev_dbg(&client->dev, "Starting lm78 update\n");
 
diff -Nru a/drivers/i2c/chips/lm80.c b/drivers/i2c/chips/lm80.c
--- a/drivers/i2c/chips/lm80.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/lm80.c	2005-03-02 09:56:26 -08:00
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -99,10 +100,7 @@
 #define TEMP_LIMIT_TO_REG(val)		SENSORS_LIMIT((val)<0?\
 					((val)-500)/1000:((val)+500)/1000,0,255)
 
-#define ALARMS_FROM_REG(val)		(val)
-
 #define DIV_FROM_REG(val)		(1 << (val))
-#define DIV_TO_REG(val)			((val)==8?3:(val)==4?2:(val)==1?0:1)
 
 /*
  * Client data (each client gets its own)
@@ -141,12 +139,6 @@
 static int lm80_write_value(struct i2c_client *client, u8 reg, u8 value);
 
 /*
- * Internal variables
- */
-
-static int lm80_id;
-
-/*
  * Driver data (common to all clients)
  */
 
@@ -269,7 +261,17 @@
 			   DIV_FROM_REG(data->fan_div[nr]));
 
 	val = simple_strtoul(buf, NULL, 10);
-	data->fan_div[nr] = DIV_TO_REG(val);
+
+	switch (val) {
+	case 1: data->fan_div[nr] = 0; break;
+	case 2: data->fan_div[nr] = 1; break;
+	case 4: data->fan_div[nr] = 2; break;
+	case 8: data->fan_div[nr] = 3; break;
+	default:
+		dev_err(&client->dev, "fan_div value %ld not "
+			"supported. Choose one of 1, 2, 4 or 8!\n", val);
+		return -EINVAL;
+	}
 
 	reg = (lm80_read_value(client, LM80_REG_FANDIV) & ~(3 << (2 * (nr + 1))))
 	    | (data->fan_div[nr] << (2 * (nr + 1)));
@@ -327,7 +329,7 @@
 static ssize_t show_alarms(struct device *dev, char *buf)
 {
 	struct lm80_data *data = lm80_update_device(dev);
-	return sprintf(buf, "%d\n", ALARMS_FROM_REG(data->alarms));
+	return sprintf(buf, "%u\n", data->alarms);
 }
 
 static DEVICE_ATTR(in0_min, S_IWUSR | S_IRUGO, show_in_min0, set_in_min0);
@@ -425,8 +427,6 @@
 
 	/* Fill in the remaining client fields and put it into the global list */
 	strlcpy(new_client->name, name, I2C_NAME_SIZE);
-
-	new_client->id = lm80_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -530,9 +530,7 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > 2 * HZ) ||
-	    (jiffies < data->last_updated) || !data->valid) {
-
+	if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) {
 		dev_dbg(&client->dev, "Starting lm80 update\n");
 		for (i = 0; i <= 6; i++) {
 			data->in[i] =
diff -Nru a/drivers/i2c/chips/lm83.c b/drivers/i2c/chips/lm83.c
--- a/drivers/i2c/chips/lm83.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/lm83.c	2005-03-02 09:56:26 -08:00
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -150,12 +151,6 @@
 };
 
 /*
- * Internal variables
- */
-
-static int lm83_id;
-
-/*
  * Sysfs stuff
  */
 
@@ -312,7 +307,6 @@
 
 	/* We can fill in the remaining client fields */
 	strlcpy(new_client->name, name, I2C_NAME_SIZE);
-	new_client->id = lm83_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -369,9 +363,7 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ * 2) ||
-	    (jiffies < data->last_updated) ||
-	    !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
 		int nr;
 
 		dev_dbg(&client->dev, "Updating lm83 data.\n");
diff -Nru a/drivers/i2c/chips/lm85.c b/drivers/i2c/chips/lm85.c
--- a/drivers/i2c/chips/lm85.c	2005-01-14 14:17:33 -08:00
+++ b/drivers/i2c/chips/lm85.c	2005-03-02 09:56:26 -08:00
@@ -27,6 +27,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
@@ -389,9 +390,6 @@
 	.detach_client  = lm85_detach_client,
 };
 
-/* Unique ID assigned to each LM85 detected */
-static int lm85_id;
-
 
 /* 4 Fans */
 static ssize_t show_fan(struct device *dev, char *buf, int nr)
@@ -1148,16 +1146,10 @@
 	strlcpy(new_client->name, type_name, I2C_NAME_SIZE);
 
 	/* Fill in the remaining client fields */
-	new_client->id = lm85_id++;
 	data->type = kind;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
-	dev_dbg(&adapter->dev, "Assigning ID %d to %s at %d,0x%02x\n",
-		new_client->id, new_client->name,
-		i2c_adapter_id(new_client->adapter),
-		new_client->addr);
-
 	/* Tell the I2C layer a new client has arrived */
 	if ((err = i2c_attach_client(new_client)))
 		goto ERROR1;
@@ -1363,7 +1355,7 @@
 	down(&data->update_lock);
 
 	if ( !data->valid ||
-	     (jiffies - data->last_reading > LM85_DATA_INTERVAL ) ) {
+	     time_after(jiffies, data->last_reading + LM85_DATA_INTERVAL) ) {
 		/* Things that change quickly */
 		dev_dbg(&client->dev, "Reading sensor values\n");
 		
@@ -1417,7 +1409,7 @@
 	};  /* last_reading */
 
 	if ( !data->valid ||
-	     (jiffies - data->last_config > LM85_CONFIG_INTERVAL) ) {
+	     time_after(jiffies, data->last_config + LM85_CONFIG_INTERVAL) ) {
 		/* Things that don't change often */
 		dev_dbg(&client->dev, "Reading config values\n");
 
diff -Nru a/drivers/i2c/chips/lm87.c b/drivers/i2c/chips/lm87.c
--- a/drivers/i2c/chips/lm87.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/lm87.c	2005-03-02 09:56:26 -08:00
@@ -56,6 +56,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
@@ -203,12 +204,6 @@
 };
 
 /*
- * Internal variables
- */
-
-static int lm87_id;
-
-/*
  * Sysfs stuff
  */
 
@@ -569,7 +564,6 @@
 
 	/* We can fill in the remaining client fields */
 	strlcpy(new_client->name, "lm87", I2C_NAME_SIZE);
-	new_client->id = lm87_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -720,9 +714,7 @@
 
 	down(&data->update_lock);
 
-	if (jiffies - data->last_updated > HZ
-	  || jiffies < data->last_updated
-	  || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
 		int i, j;
 
 		dev_dbg(&client->dev, "Updating data.\n");
diff -Nru a/drivers/i2c/chips/lm90.c b/drivers/i2c/chips/lm90.c
--- a/drivers/i2c/chips/lm90.c	2004-12-12 07:28:42 -08:00
+++ b/drivers/i2c/chips/lm90.c	2005-03-02 09:56:26 -08:00
@@ -66,6 +66,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -190,12 +191,6 @@
 };
 
 /*
- * Internal variables
- */
-
-static int lm90_id;
-
-/*
  * Sysfs stuff
  */
 
@@ -427,7 +422,6 @@
 
 	/* We can fill in the remaining client fields */
 	strlcpy(new_client->name, name, I2C_NAME_SIZE);
-	new_client->id = lm90_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -495,9 +489,7 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ * 2) ||
-	    (jiffies < data->last_updated) ||
-	    !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
 		u8 oldh, newh;
 
 		dev_dbg(&client->dev, "Updating lm90 data.\n");
diff -Nru a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/i2c/chips/m41t00.c	2005-03-02 09:56:19 -08:00
@@ -0,0 +1,247 @@
+/*
+ * drivers/i2c/chips/m41t00.c
+ *
+ * I2C client/driver for the ST M41T00 Real-Time Clock chip.
+ *
+ * Author: Mark A. Greer <mgreer@mvista.com>
+ *
+ * 2005 (c) MontaVista Software, Inc. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+/*
+ * This i2c client/driver wedges between the drivers/char/genrtc.c RTC
+ * interface and the SMBus interface of the i2c subsystem.
+ * It would be more efficient to use i2c msgs/i2c_transfer directly but, as
+ * recommened in .../Documentation/i2c/writing-clients section
+ * "Sending and receiving", using SMBus level communication is preferred.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <linux/rtc.h>
+#include <linux/bcd.h>
+
+#include <asm/time.h>
+#include <asm/rtc.h>
+
+#define	M41T00_DRV_NAME		"m41t00"
+
+static DECLARE_MUTEX(m41t00_mutex);
+
+static struct i2c_driver m41t00_driver;
+static struct i2c_client *save_client;
+
+static unsigned short ignore[] = { I2C_CLIENT_END };
+static unsigned short normal_addr[] = { 0x68, I2C_CLIENT_END };
+
+static struct i2c_client_address_data addr_data = {
+	.normal_i2c		= normal_addr,
+	.normal_i2c_range	= ignore,
+	.probe			= ignore,
+	.probe_range		= ignore,
+	.ignore			= ignore,
+	.ignore_range		= ignore,
+	.force			= ignore,
+};
+
+ulong
+m41t00_get_rtc_time(void)
+{
+	s32	sec, min, hour, day, mon, year;
+	s32	sec1, min1, hour1, day1, mon1, year1;
+	ulong	limit = 10;
+
+	sec = min = hour = day = mon = year = 0;
+	sec1 = min1 = hour1 = day1 = mon1 = year1 = 0;
+
+	down(&m41t00_mutex);
+	do {
+		if (((sec = i2c_smbus_read_byte_data(save_client, 0)) >= 0)
+			&& ((min = i2c_smbus_read_byte_data(save_client, 1))
+				>= 0)
+			&& ((hour = i2c_smbus_read_byte_data(save_client, 2))
+				>= 0)
+			&& ((day = i2c_smbus_read_byte_data(save_client, 4))
+				>= 0)
+			&& ((mon = i2c_smbus_read_byte_data(save_client, 5))
+				>= 0)
+			&& ((year = i2c_smbus_read_byte_data(save_client, 6))
+				>= 0)
+			&& ((sec == sec1) && (min == min1) && (hour == hour1)
+				&& (day == day1) && (mon == mon1)
+				&& (year == year1)))
+
+				break;
+
+		sec1 = sec;
+		min1 = min;
+		hour1 = hour;
+		day1 = day;
+		mon1 = mon;
+		year1 = year;
+	} while (--limit > 0);
+	up(&m41t00_mutex);
+
+	if (limit == 0) {
+		dev_warn(&save_client->dev,
+			"m41t00: can't read rtc chip\n");
+		sec = min = hour = day = mon = year = 0;
+	}
+
+	sec &= 0x7f;
+	min &= 0x7f;
+	hour &= 0x3f;
+	day &= 0x3f;
+	mon &= 0x1f;
+	year &= 0xff;
+
+	BCD_TO_BIN(sec);
+	BCD_TO_BIN(min);
+	BCD_TO_BIN(hour);
+	BCD_TO_BIN(day);
+	BCD_TO_BIN(mon);
+	BCD_TO_BIN(year);
+
+	year += 1900;
+	if (year < 1970)
+		year += 100;
+
+	return mktime(year, mon, day, hour, min, sec);
+}
+
+static void
+m41t00_set_tlet(ulong arg)
+{
+	struct rtc_time	tm;
+	ulong	nowtime = *(ulong *)arg;
+
+	to_tm(nowtime, &tm);
+	tm.tm_year = (tm.tm_year - 1900) % 100;
+
+	BIN_TO_BCD(tm.tm_sec);
+	BIN_TO_BCD(tm.tm_min);
+	BIN_TO_BCD(tm.tm_hour);
+	BIN_TO_BCD(tm.tm_mon);
+	BIN_TO_BCD(tm.tm_mday);
+	BIN_TO_BCD(tm.tm_year);
+
+	down(&m41t00_mutex);
+	if ((i2c_smbus_write_byte_data(save_client, 0, tm.tm_sec & 0x7f) < 0)
+		|| (i2c_smbus_write_byte_data(save_client, 1, tm.tm_min & 0x7f)
+			< 0)
+		|| (i2c_smbus_write_byte_data(save_client, 2, tm.tm_hour & 0x7f)
+			< 0)
+		|| (i2c_smbus_write_byte_data(save_client, 4, tm.tm_mday & 0x7f)
+			< 0)
+		|| (i2c_smbus_write_byte_data(save_client, 5, tm.tm_mon & 0x7f)
+			< 0)
+		|| (i2c_smbus_write_byte_data(save_client, 6, tm.tm_year & 0x7f)
+			< 0))
+
+		dev_warn(&save_client->dev,"m41t00: can't write to rtc chip\n");
+
+	up(&m41t00_mutex);
+	return;
+}
+
+ulong	new_time;
+
+DECLARE_TASKLET_DISABLED(m41t00_tasklet, m41t00_set_tlet, (ulong)&new_time);
+
+int
+m41t00_set_rtc_time(ulong nowtime)
+{
+	new_time = nowtime;
+
+	if (in_interrupt())
+		tasklet_schedule(&m41t00_tasklet);
+	else
+		m41t00_set_tlet((ulong)&new_time);
+
+	return 0;
+}
+
+/*
+ *****************************************************************************
+ *
+ *	Driver Interface
+ *
+ *****************************************************************************
+ */
+static int
+m41t00_probe(struct i2c_adapter *adap, int addr, int kind)
+{
+	struct i2c_client *client;
+	int rc;
+
+	client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
+	if (!client)
+		return -ENOMEM;
+
+	memset(client, 0, sizeof(struct i2c_client));
+	strncpy(client->name, M41T00_DRV_NAME, I2C_NAME_SIZE);
+	client->id = m41t00_driver.id;
+	client->flags = I2C_DF_NOTIFY;
+	client->addr = addr;
+	client->adapter = adap;
+	client->driver = &m41t00_driver;
+
+	if ((rc = i2c_attach_client(client)) != 0) {
+		kfree(client);
+		return rc;
+	}
+
+	save_client = client;
+	return 0;
+}
+
+static int
+m41t00_attach(struct i2c_adapter *adap)
+{
+	return i2c_probe(adap, &addr_data, m41t00_probe);
+}
+
+static int
+m41t00_detach(struct i2c_client *client)
+{
+	int	rc;
+
+	if ((rc = i2c_detach_client(client)) == 0) {
+		kfree(i2c_get_clientdata(client));
+		tasklet_kill(&m41t00_tasklet);
+	}
+	return rc;
+}
+
+static struct i2c_driver m41t00_driver = {
+	.owner		= THIS_MODULE,
+	.name		= M41T00_DRV_NAME,
+	.id		= I2C_DRIVERID_STM41T00,
+	.flags		= I2C_DF_NOTIFY,
+	.attach_adapter	= m41t00_attach,
+	.detach_client	= m41t00_detach,
+};
+
+static int __init
+m41t00_init(void)
+{
+	return i2c_add_driver(&m41t00_driver);
+}
+
+static void __exit
+m41t00_exit(void)
+{
+	i2c_del_driver(&m41t00_driver);
+	return;
+}
+
+module_init(m41t00_init);
+module_exit(m41t00_exit);
+
+MODULE_AUTHOR("Mark A. Greer <mgreer@mvista.com>");
+MODULE_DESCRIPTION("ST Microelectronics M41T00 RTC I2C Client Driver");
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/i2c/chips/max1619.c b/drivers/i2c/chips/max1619.c
--- a/drivers/i2c/chips/max1619.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/max1619.c	2005-03-02 09:56:26 -08:00
@@ -30,6 +30,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -117,12 +118,6 @@
 };
 
 /*
- * Internal variables
- */
-
-static int max1619_id;
-
-/*
  * Sysfs stuff
  */
 
@@ -267,7 +262,6 @@
 
 	/* We can fill in the remaining client fields */
 	strlcpy(new_client->name, name, I2C_NAME_SIZE);
-	new_client->id = max1619_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -331,10 +325,7 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ * 2) ||
-	    (jiffies < data->last_updated) ||
-	    !data->valid) {
-		
+	if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
 		dev_dbg(&client->dev, "Updating max1619 data.\n");
 		data->temp_input1 = i2c_smbus_read_byte_data(client,
 					MAX1619_REG_R_LOCAL_TEMP);
diff -Nru a/drivers/i2c/chips/pc87360.c b/drivers/i2c/chips/pc87360.c
--- a/drivers/i2c/chips/pc87360.c	2005-02-02 22:34:00 -08:00
+++ b/drivers/i2c/chips/pc87360.c	2005-03-02 09:56:26 -08:00
@@ -37,6 +37,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
@@ -1174,8 +1175,7 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ * 2)
-	 || (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ * 2) || !data->valid) {
 		dev_dbg(&client->dev, "Data update\n");
 
 		/* Fans */
diff -Nru a/drivers/i2c/chips/pcf8574.c b/drivers/i2c/chips/pcf8574.c
--- a/drivers/i2c/chips/pcf8574.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/pcf8574.c	2005-03-02 10:01:11 -08:00
@@ -77,8 +77,6 @@
 	.detach_client	= pcf8574_detach_client,
 };
 
-static int pcf8574_id;
-
 /* following are the sysfs callback functions */
 static ssize_t show_read(struct device *dev, char *buf)
 {
@@ -159,8 +157,6 @@
 
 	/* Fill in the remaining client fields and put it into the global list */
 	strlcpy(new_client->name, client_name, I2C_NAME_SIZE);
-
-	new_client->id = pcf8574_id++;
 	init_MUTEX(&data->update_lock);
 
 	/* Tell the I2C layer a new client has arrived */
diff -Nru a/drivers/i2c/chips/pcf8591.c b/drivers/i2c/chips/pcf8591.c
--- a/drivers/i2c/chips/pcf8591.c	2004-11-08 16:37:27 -08:00
+++ b/drivers/i2c/chips/pcf8591.c	2005-03-02 10:01:11 -08:00
@@ -98,8 +98,6 @@
 	.detach_client	= pcf8591_detach_client,
 };
 
-static int pcf8591_id;
-
 /* following are the sysfs callback functions */
 #define show_in_channel(channel)					\
 static ssize_t show_in##channel##_input(struct device *dev, char *buf)	\
@@ -201,8 +199,6 @@
 	/* Fill in the remaining client fields and put it into the global 
 	   list */
 	strlcpy(new_client->name, "pcf8591", I2C_NAME_SIZE);
-
-	new_client->id = pcf8591_id++;
 	init_MUTEX(&data->update_lock);
 
 	/* Tell the I2C layer a new client has arrived */
diff -Nru a/drivers/i2c/chips/rtc8564.c b/drivers/i2c/chips/rtc8564.c
--- a/drivers/i2c/chips/rtc8564.c	2004-11-12 11:40:07 -08:00
+++ b/drivers/i2c/chips/rtc8564.c	2005-03-02 09:55:20 -08:00
@@ -89,7 +89,7 @@
 
 	_DBG(1, "client=%p, adr=%d, buf=%p, len=%d", client, adr, buf, len);
 
-	if (!buf || !client) {
+	if (!buf) {
 		ret = -EINVAL;
 		goto done;
 	}
@@ -111,7 +111,7 @@
 	struct i2c_msg wr;
 	int i;
 
-	if (!client || !data || len > 15) {
+	if (!data || len > 15) {
 		ret = -EINVAL;
 		goto done;
 	}
@@ -163,14 +163,12 @@
 
 	strlcpy(new_client->name, "RTC8564", I2C_NAME_SIZE);
 	i2c_set_clientdata(new_client, d);
-	new_client->id = rtc8564_driver.id;
 	new_client->flags = I2C_CLIENT_ALLOW_USE | I2C_DF_NOTIFY;
 	new_client->addr = addr;
 	new_client->adapter = adap;
 	new_client->driver = &rtc8564_driver;
 
 	_DBG(1, "client=%p", new_client);
-	_DBG(1, "client.id=%d", new_client->id);
 
 	/* init ctrl1 reg */
 	data[0] = 0;
@@ -222,7 +220,7 @@
 
 	_DBG(1, "client=%p, dt=%p", client, dt);
 
-	if (!dt || !client)
+	if (!dt)
 		return -EINVAL;
 
 	memset(buf, 0, sizeof(buf));
@@ -256,7 +254,7 @@
 
 	_DBG(1, "client=%p, dt=%p", client, dt);
 
-	if (!dt || !client)
+	if (!dt)
 		return -EINVAL;
 
 	_DBGRTCTM(2, *dt);
@@ -295,7 +293,7 @@
 {
 	struct rtc8564_data *data = i2c_get_clientdata(client);
 
-	if (!ctrl || !client)
+	if (!ctrl)
 		return -1;
 
 	*ctrl = data->ctrl;
@@ -307,7 +305,7 @@
 	struct rtc8564_data *data = i2c_get_clientdata(client);
 	unsigned char buf[2];
 
-	if (!ctrl || !client)
+	if (!ctrl)
 		return -1;
 
 	buf[0] = *ctrl & 0xff;
@@ -320,7 +318,7 @@
 static int rtc8564_read_mem(struct i2c_client *client, struct mem *mem)
 {
 
-	if (!mem || !client)
+	if (!mem)
 		return -EINVAL;
 
 	return rtc8564_read(client, mem->loc, mem->data, mem->nr);
@@ -329,7 +327,7 @@
 static int rtc8564_write_mem(struct i2c_client *client, struct mem *mem)
 {
 
-	if (!mem || !client)
+	if (!mem)
 		return -EINVAL;
 
 	return rtc8564_write(client, mem->loc, mem->data, mem->nr);
diff -Nru a/drivers/i2c/chips/sis5595.c b/drivers/i2c/chips/sis5595.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/i2c/chips/sis5595.c	2005-03-02 09:56:12 -08:00
@@ -0,0 +1,794 @@
+/*
+    sis5595.c - Part of lm_sensors, Linux kernel modules
+		for hardware monitoring
+
+    Copyright (C) 1998 - 2001 Frodo Looijaard <frodol@dds.nl>,
+			Kyösti Mälkki <kmalkki@cc.hut.fi>, and
+			Mark D. Studebaker <mdsxyz123@yahoo.com>
+    Ported to Linux 2.6 by Aurelien Jarno <aurelien@aurel32.net> with
+    the help of Jean Delvare <khali@linux-fr.org>
+
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+/*
+   SiS southbridge has a LM78-like chip integrated on the same IC.
+   This driver is a customized copy of lm78.c
+   
+   Supports following revisions:
+	Version		PCI ID		PCI Revision
+	1		1039/0008	AF or less
+	2		1039/0008	B0 or greater
+
+   Note: these chips contain a 0008 device which is incompatible with the
+	 5595. We recognize these by the presence of the listed
+	 "blacklist" PCI ID and refuse to load.
+
+   NOT SUPPORTED	PCI ID		BLACKLIST PCI ID	
+	 540		0008		0540
+	 550		0008		0550
+	5513		0008		5511
+	5581		0008		5597
+	5582		0008		5597
+	5597		0008		5597
+	5598		0008		5597/5598
+	 630		0008		0630
+	 645		0008		0645
+	 730		0008		0730
+	 735		0008		0735
+*/
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/ioport.h>
+#include <linux/pci.h>
+#include <linux/i2c.h>
+#include <linux/i2c-sensor.h>
+#include <linux/init.h>
+#include <asm/io.h>
+
+
+/* If force_addr is set to anything different from 0, we forcibly enable
+   the device at the given address. */
+static u16 force_addr;
+module_param(force_addr, ushort, 0);
+MODULE_PARM_DESC(force_addr,
+		 "Initialize the base address of the sensors");
+
+/* Addresses to scan.
+   Note that we can't determine the ISA address until we have initialized
+   our module */
+static unsigned short normal_i2c[] = { I2C_CLIENT_END };
+static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
+
+/* Insmod parameters */
+SENSORS_INSMOD_1(sis5595);
+
+/* Many SIS5595 constants specified below */
+
+/* Length of ISA address segment */
+#define SIS5595_EXTENT 8
+/* PCI Config Registers */
+#define SIS5595_REVISION_REG 0x08
+#define SIS5595_BASE_REG 0x68
+#define SIS5595_PIN_REG 0x7A
+#define SIS5595_ENABLE_REG 0x7B
+
+/* Where are the ISA address/data registers relative to the base address */
+#define SIS5595_ADDR_REG_OFFSET 5
+#define SIS5595_DATA_REG_OFFSET 6
+
+/* The SIS5595 registers */
+#define SIS5595_REG_IN_MAX(nr) (0x2b + (nr) * 2)
+#define SIS5595_REG_IN_MIN(nr) (0x2c + (nr) * 2)
+#define SIS5595_REG_IN(nr) (0x20 + (nr))
+
+#define SIS5595_REG_FAN_MIN(nr) (0x3b + (nr))
+#define SIS5595_REG_FAN(nr) (0x28 + (nr))
+
+/* On the first version of the chip, the temp registers are separate.
+   On the second version,
+   TEMP pin is shared with IN4, configured in PCI register 0x7A.
+   The registers are the same as well.
+   OVER and HYST are really MAX and MIN. */
+
+#define REV2MIN	0xb0
+#define SIS5595_REG_TEMP 	(( data->revision) >= REV2MIN) ? \
+					SIS5595_REG_IN(4) : 0x27
+#define SIS5595_REG_TEMP_OVER	(( data->revision) >= REV2MIN) ? \
+					SIS5595_REG_IN_MAX(4) : 0x39
+#define SIS5595_REG_TEMP_HYST	(( data->revision) >= REV2MIN) ? \
+					SIS5595_REG_IN_MIN(4) : 0x3a
+
+#define SIS5595_REG_CONFIG 0x40
+#define SIS5595_REG_ALARM1 0x41
+#define SIS5595_REG_ALARM2 0x42
+#define SIS5595_REG_FANDIV 0x47
+
+/* Conversions. Limit checking is only done on the TO_REG
+   variants. */
+
+/* IN: mV, (0V to 4.08V)
+   REG: 16mV/bit */
+static inline u8 IN_TO_REG(unsigned long val)
+{
+	unsigned long nval = SENSORS_LIMIT(val, 0, 4080);
+	return (nval + 8) / 16;
+}
+#define IN_FROM_REG(val) ((val) *  16)
+
+static inline u8 FAN_TO_REG(long rpm, int div)
+{
+	if (rpm <= 0)
+		return 255;
+	return SENSORS_LIMIT((1350000 + rpm * div / 2) / (rpm * div), 1, 254);
+}
+
+static inline int FAN_FROM_REG(u8 val, int div)
+{
+	return val==0 ? -1 : val==255 ? 0 : 1350000/(val*div);
+}
+
+/* TEMP: mC (-54.12C to +157.53C)
+   REG: 0.83C/bit + 52.12, two's complement  */
+static inline int TEMP_FROM_REG(s8 val)
+{
+	return val * 830 + 52120;
+}
+static inline s8 TEMP_TO_REG(int val)
+{
+	int nval = SENSORS_LIMIT(val, -54120, 157530) ;
+	return nval<0 ? (nval-5212-415)/830 : (nval-5212+415)/830;
+}
+
+/* FAN DIV: 1, 2, 4, or 8 (defaults to 2)
+   REG: 0, 1, 2, or 3 (respectively) (defaults to 1) */
+static inline u8 DIV_TO_REG(int val)
+{
+	return val==8 ? 3 : val==4 ? 2 : val==1 ? 0 : 1;
+}
+#define DIV_FROM_REG(val) (1 << (val))
+
+/* For the SIS5595, we need to keep some data in memory. That
+   data is pointed to by sis5595_list[NR]->data. The structure itself is
+   dynamically allocated, at the time when the new sis5595 client is
+   allocated. */
+struct sis5595_data {
+	struct i2c_client client;
+	struct semaphore lock;
+
+	struct semaphore update_lock;
+	char valid;		/* !=0 if following fields are valid */
+	unsigned long last_updated;	/* In jiffies */
+	char maxins;		/* == 3 if temp enabled, otherwise == 4 */
+	u8 revision;		/* Reg. value */
+
+	u8 in[5];		/* Register value */
+	u8 in_max[5];		/* Register value */
+	u8 in_min[5];		/* Register value */
+	u8 fan[2];		/* Register value */
+	u8 fan_min[2];		/* Register value */
+	s8 temp;		/* Register value */
+	s8 temp_over;		/* Register value */
+	s8 temp_hyst;		/* Register value */
+	u8 fan_div[2];		/* Register encoding, shifted right */
+	u16 alarms;		/* Register encoding, combined */
+};
+
+static struct pci_dev *s_bridge;	/* pointer to the (only) sis5595 */
+
+static int sis5595_attach_adapter(struct i2c_adapter *adapter);
+static int sis5595_detect(struct i2c_adapter *adapter, int address, int kind);
+static int sis5595_detach_client(struct i2c_client *client);
+
+static int sis5595_read_value(struct i2c_client *client, u8 register);
+static int sis5595_write_value(struct i2c_client *client, u8 register, u8 value);
+static struct sis5595_data *sis5595_update_device(struct device *dev);
+static void sis5595_init_client(struct i2c_client *client);
+
+static struct i2c_driver sis5595_driver = {
+	.owner		= THIS_MODULE,
+	.name		= "sis5595",
+	.id		= I2C_DRIVERID_SIS5595,
+	.flags		= I2C_DF_NOTIFY,
+	.attach_adapter	= sis5595_attach_adapter,
+	.detach_client	= sis5595_detach_client,
+};
+
+/* 4 Voltages */
+static ssize_t show_in(struct device *dev, char *buf, int nr)
+{
+	struct sis5595_data *data = sis5595_update_device(dev);
+	return sprintf(buf, "%d\n", IN_FROM_REG(data->in[nr]));
+}
+
+static ssize_t show_in_min(struct device *dev, char *buf, int nr)
+{
+	struct sis5595_data *data = sis5595_update_device(dev);
+	return sprintf(buf, "%d\n", IN_FROM_REG(data->in_min[nr]));
+}
+
+static ssize_t show_in_max(struct device *dev, char *buf, int nr)
+{
+	struct sis5595_data *data = sis5595_update_device(dev);
+	return sprintf(buf, "%d\n", IN_FROM_REG(data->in_max[nr]));
+}
+
+static ssize_t set_in_min(struct device *dev, const char *buf,
+	       size_t count, int nr)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct sis5595_data *data = i2c_get_clientdata(client);
+	unsigned long val = simple_strtoul(buf, NULL, 10);
+	data->in_min[nr] = IN_TO_REG(val);
+	sis5595_write_value(client, SIS5595_REG_IN_MIN(nr), data->in_min[nr]);
+	return count;
+}
+
+static ssize_t set_in_max(struct device *dev, const char *buf,
+	       size_t count, int nr)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct sis5595_data *data = i2c_get_clientdata(client);
+	unsigned long val = simple_strtoul(buf, NULL, 10);
+	data->in_max[nr] = IN_TO_REG(val);
+	sis5595_write_value(client, SIS5595_REG_IN_MAX(nr), data->in_max[nr]);
+	return count;
+}
+
+#define show_in_offset(offset)					\
+static ssize_t							\
+	show_in##offset (struct device *dev, char *buf)		\
+{								\
+	return show_in(dev, buf, offset);			\
+}								\
+static DEVICE_ATTR(in##offset##_input, S_IRUGO, 		\
+		show_in##offset, NULL);				\
+static ssize_t							\
+	show_in##offset##_min (struct device *dev, char *buf)	\
+{								\
+	return show_in_min(dev, buf, offset);			\
+}								\
+static ssize_t							\
+	show_in##offset##_max (struct device *dev, char *buf)	\
+{								\
+	return show_in_max(dev, buf, offset);			\
+}								\
+static ssize_t set_in##offset##_min (struct device *dev,	\
+		const char *buf, size_t count)			\
+{								\
+	return set_in_min(dev, buf, count, offset);		\
+}								\
+static ssize_t set_in##offset##_max (struct device *dev,	\
+		const char *buf, size_t count)			\
+{								\
+	return set_in_max(dev, buf, count, offset);		\
+}								\
+static DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR,		\
+		show_in##offset##_min, set_in##offset##_min);	\
+static DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR,		\
+		show_in##offset##_max, set_in##offset##_max);
+
+show_in_offset(0);
+show_in_offset(1);
+show_in_offset(2);
+show_in_offset(3);
+show_in_offset(4);
+
+/* Temperature */
+static ssize_t show_temp(struct device *dev, char *buf)
+{
+	struct sis5595_data *data = sis5595_update_device(dev);
+	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp));
+}
+
+static ssize_t show_temp_over(struct device *dev, char *buf)
+{
+	struct sis5595_data *data = sis5595_update_device(dev);
+	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_over));
+}
+
+static ssize_t set_temp_over(struct device *dev, const char *buf, size_t count)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct sis5595_data *data = i2c_get_clientdata(client);
+	long val = simple_strtol(buf, NULL, 10);
+	data->temp_over = TEMP_TO_REG(val);
+	sis5595_write_value(client, SIS5595_REG_TEMP_OVER, data->temp_over);
+	return count;
+}
+
+static ssize_t show_temp_hyst(struct device *dev, char *buf)
+{
+	struct sis5595_data *data = sis5595_update_device(dev);
+	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst));
+}
+
+static ssize_t set_temp_hyst(struct device *dev, const char *buf, size_t count)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct sis5595_data *data = i2c_get_clientdata(client);
+	long val = simple_strtol(buf, NULL, 10);
+	data->temp_hyst = TEMP_TO_REG(val);
+	sis5595_write_value(client, SIS5595_REG_TEMP_HYST, data->temp_hyst);
+	return count;
+}
+
+static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp, NULL);
+static DEVICE_ATTR(temp1_max, S_IRUGO | S_IWUSR,
+		show_temp_over, set_temp_over);
+static DEVICE_ATTR(temp1_max_hyst, S_IRUGO | S_IWUSR,
+		show_temp_hyst, set_temp_hyst);
+
+/* 2 Fans */
+static ssize_t show_fan(struct device *dev, char *buf, int nr)
+{
+	struct sis5595_data *data = sis5595_update_device(dev);
+	return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[nr],
+		DIV_FROM_REG(data->fan_div[nr])) );
+}
+
+static ssize_t show_fan_min(struct device *dev, char *buf, int nr)
+{
+	struct sis5595_data *data = sis5595_update_device(dev);
+	return sprintf(buf,"%d\n", FAN_FROM_REG(data->fan_min[nr],
+		DIV_FROM_REG(data->fan_div[nr])) );
+}
+
+static ssize_t set_fan_min(struct device *dev, const char *buf,
+		size_t count, int nr)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct sis5595_data *data = i2c_get_clientdata(client);
+	unsigned long val = simple_strtoul(buf, NULL, 10);
+	data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
+	sis5595_write_value(client, SIS5595_REG_FAN_MIN(nr), data->fan_min[nr]);
+	return count;
+}
+
+static ssize_t show_fan_div(struct device *dev, char *buf, int nr)
+{
+	struct sis5595_data *data = sis5595_update_device(dev);
+	return sprintf(buf, "%d\n", DIV_FROM_REG(data->fan_div[nr]) );
+}
+
+/* Note: we save and restore the fan minimum here, because its value is
+   determined in part by the fan divisor.  This follows the principle of
+   least suprise; the user doesn't expect the fan minimum to change just
+   because the divisor changed. */
+static ssize_t set_fan_div(struct device *dev, const char *buf,
+	size_t count, int nr)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct sis5595_data *data = i2c_get_clientdata(client);
+	unsigned long min = FAN_FROM_REG(data->fan_min[nr],
+			DIV_FROM_REG(data->fan_div[nr]));
+	unsigned long val = simple_strtoul(buf, NULL, 10);
+	int reg = sis5595_read_value(client, SIS5595_REG_FANDIV);
+	switch (val) {
+	case 1: data->fan_div[nr] = 0; break;
+	case 2: data->fan_div[nr] = 1; break;
+	case 4: data->fan_div[nr] = 2; break;
+	case 8: data->fan_div[nr] = 3; break;
+	default:
+		dev_err(&client->dev, "fan_div value %ld not "
+			"supported. Choose one of 1, 2, 4 or 8!\n", val);
+		return -EINVAL;
+	}
+	
+	switch (nr) {
+	case 0:
+		reg = (reg & 0xcf) | (data->fan_div[nr] << 4);
+		break;
+	case 1:
+		reg = (reg & 0x3f) | (data->fan_div[nr] << 6);
+		break;
+	}
+	sis5595_write_value(client, SIS5595_REG_FANDIV, reg);
+	data->fan_min[nr] =
+		FAN_TO_REG(min, DIV_FROM_REG(data->fan_div[nr]));
+	sis5595_write_value(client, SIS5595_REG_FAN_MIN(nr), data->fan_min[nr]);
+	return count;
+}
+
+#define show_fan_offset(offset)						\
+static ssize_t show_fan_##offset (struct device *dev, char *buf)	\
+{									\
+	return show_fan(dev, buf, offset - 1);			\
+}									\
+static ssize_t show_fan_##offset##_min (struct device *dev, char *buf)	\
+{									\
+	return show_fan_min(dev, buf, offset - 1);			\
+}									\
+static ssize_t show_fan_##offset##_div (struct device *dev, char *buf)	\
+{									\
+	return show_fan_div(dev, buf, offset - 1);			\
+}									\
+static ssize_t set_fan_##offset##_min (struct device *dev,		\
+		const char *buf, size_t count)				\
+{									\
+	return set_fan_min(dev, buf, count, offset - 1);		\
+}									\
+static DEVICE_ATTR(fan##offset##_input, S_IRUGO, show_fan_##offset, NULL);\
+static DEVICE_ATTR(fan##offset##_min, S_IRUGO | S_IWUSR,		\
+		show_fan_##offset##_min, set_fan_##offset##_min);
+
+show_fan_offset(1);
+show_fan_offset(2);
+
+static ssize_t set_fan_1_div(struct device *dev, const char *buf,
+		size_t count)
+{
+	return set_fan_div(dev, buf, count, 0) ;
+}
+
+static ssize_t set_fan_2_div(struct device *dev, const char *buf,
+		size_t count)
+{
+	return set_fan_div(dev, buf, count, 1) ;
+}
+static DEVICE_ATTR(fan1_div, S_IRUGO | S_IWUSR,
+		show_fan_1_div, set_fan_1_div);
+static DEVICE_ATTR(fan2_div, S_IRUGO | S_IWUSR,
+		show_fan_2_div, set_fan_2_div);
+
+/* Alarms */
+static ssize_t show_alarms(struct device *dev, char *buf)
+{
+	struct sis5595_data *data = sis5595_update_device(dev);
+	return sprintf(buf, "%d\n", data->alarms);
+}
+static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
+ 
+/* This is called when the module is loaded */
+static int sis5595_attach_adapter(struct i2c_adapter *adapter)
+{
+	if (!(adapter->class & I2C_CLASS_HWMON))
+		return 0;
+	return i2c_detect(adapter, &addr_data, sis5595_detect);
+}
+
+int sis5595_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+	int err = 0;
+	int i;
+	struct i2c_client *new_client;
+	struct sis5595_data *data;
+	char val;
+	u16 a;
+
+	/* Make sure we are probing the ISA bus!!  */
+	if (!i2c_is_isa_adapter(adapter))
+		goto exit;
+
+	if (force_addr)
+		address = force_addr & ~(SIS5595_EXTENT - 1);
+	/* Reserve the ISA region */
+	if (!request_region(address, SIS5595_EXTENT, sis5595_driver.name)) {
+		err = -EBUSY;
+		goto exit;
+	}
+	if (force_addr) {
+		dev_warn(&adapter->dev, "forcing ISA address 0x%04X\n", address);
+		if (PCIBIOS_SUCCESSFUL !=
+		    pci_write_config_word(s_bridge, SIS5595_BASE_REG, address))
+			goto exit_release;
+		if (PCIBIOS_SUCCESSFUL !=
+		    pci_read_config_word(s_bridge, SIS5595_BASE_REG, &a))
+			goto exit_release;
+		if ((a & ~(SIS5595_EXTENT - 1)) != address)
+			/* doesn't work for some chips? */
+			goto exit_release;
+	}
+
+	if (PCIBIOS_SUCCESSFUL !=
+	    pci_read_config_byte(s_bridge, SIS5595_ENABLE_REG, &val)) {
+		goto exit_release;
+	}
+	if ((val & 0x80) == 0) {
+		if (PCIBIOS_SUCCESSFUL !=
+		    pci_write_config_byte(s_bridge, SIS5595_ENABLE_REG,
+					  val | 0x80))
+			goto exit_release;
+		if (PCIBIOS_SUCCESSFUL !=
+		    pci_read_config_byte(s_bridge, SIS5595_ENABLE_REG, &val))
+			goto exit_release;
+		if ((val & 0x80) == 0) 
+			/* doesn't work for some chips! */
+			goto exit_release;
+	}
+
+	if (!(data = kmalloc(sizeof(struct sis5595_data), GFP_KERNEL))) {
+		err = -ENOMEM;
+		goto exit_release;
+	}
+	memset(data, 0, sizeof(struct sis5595_data));
+
+	new_client = &data->client;
+	new_client->addr = address;
+	init_MUTEX(&data->lock);
+	i2c_set_clientdata(new_client, data);
+	new_client->adapter = adapter;
+	new_client->driver = &sis5595_driver;
+	new_client->flags = 0;
+
+	/* Check revision and pin registers to determine whether 4 or 5 voltages */
+	pci_read_config_byte(s_bridge, SIS5595_REVISION_REG, &(data->revision));
+	/* 4 voltages, 1 temp */
+	data->maxins = 3;
+	if (data->revision >= REV2MIN) {
+		pci_read_config_byte(s_bridge, SIS5595_PIN_REG, &val);
+		if (!(val & 0x80))
+			/* 5 voltages, no temps */
+			data->maxins = 4;
+	}
+	
+	/* Fill in the remaining client fields and put it into the global list */
+	strlcpy(new_client->name, "sis5595", I2C_NAME_SIZE);
+
+	data->valid = 0;
+	init_MUTEX(&data->update_lock);
+
+	/* Tell the I2C layer a new client has arrived */
+	if ((err = i2c_attach_client(new_client)))
+		goto exit_free;
+	
+	/* Initialize the SIS5595 chip */
+	sis5595_init_client(new_client);
+
+	/* A few vars need to be filled upon startup */
+	for (i = 0; i < 2; i++) {
+		data->fan_min[i] = sis5595_read_value(new_client,
+					SIS5595_REG_FAN_MIN(i));
+	}
+
+	/* Register sysfs hooks */
+	device_create_file(&new_client->dev, &dev_attr_in0_input);
+	device_create_file(&new_client->dev, &dev_attr_in0_min);
+	device_create_file(&new_client->dev, &dev_attr_in0_max);
+	device_create_file(&new_client->dev, &dev_attr_in1_input);
+	device_create_file(&new_client->dev, &dev_attr_in1_min);
+	device_create_file(&new_client->dev, &dev_attr_in1_max);
+	device_create_file(&new_client->dev, &dev_attr_in2_input);
+	device_create_file(&new_client->dev, &dev_attr_in2_min);
+	device_create_file(&new_client->dev, &dev_attr_in2_max);
+	device_create_file(&new_client->dev, &dev_attr_in3_input);
+	device_create_file(&new_client->dev, &dev_attr_in3_min);
+	device_create_file(&new_client->dev, &dev_attr_in3_max);
+	if (data->maxins == 4) {
+		device_create_file(&new_client->dev, &dev_attr_in4_input);
+		device_create_file(&new_client->dev, &dev_attr_in4_min);
+		device_create_file(&new_client->dev, &dev_attr_in4_max);
+	}
+	device_create_file(&new_client->dev, &dev_attr_fan1_input);
+	device_create_file(&new_client->dev, &dev_attr_fan1_min);
+	device_create_file(&new_client->dev, &dev_attr_fan1_div);
+	device_create_file(&new_client->dev, &dev_attr_fan2_input);
+	device_create_file(&new_client->dev, &dev_attr_fan2_min);
+	device_create_file(&new_client->dev, &dev_attr_fan2_div);
+	device_create_file(&new_client->dev, &dev_attr_alarms);
+	if (data->maxins == 3) {
+		device_create_file(&new_client->dev, &dev_attr_temp1_input);
+		device_create_file(&new_client->dev, &dev_attr_temp1_max);
+		device_create_file(&new_client->dev, &dev_attr_temp1_max_hyst);
+	}
+	return 0;
+	
+exit_free:
+	kfree(data);
+exit_release:
+	release_region(address, SIS5595_EXTENT);
+exit:
+	return err;
+}
+
+static int sis5595_detach_client(struct i2c_client *client)
+{
+	int err;
+
+	if ((err = i2c_detach_client(client))) {
+		dev_err(&client->dev,
+		    "Client deregistration failed, client not detached.\n");
+		return err;
+	}
+
+	if (i2c_is_isa_client(client))
+		release_region(client->addr, SIS5595_EXTENT);
+
+	kfree(i2c_get_clientdata(client));
+
+	return 0;
+}
+
+
+/* ISA access must be locked explicitly. */
+static int sis5595_read_value(struct i2c_client *client, u8 reg)
+{
+	int res;
+
+	struct sis5595_data *data = i2c_get_clientdata(client);
+	down(&data->lock);
+	outb_p(reg, client->addr + SIS5595_ADDR_REG_OFFSET);
+	res = inb_p(client->addr + SIS5595_DATA_REG_OFFSET);
+	up(&data->lock);
+	return res;
+}
+
+static int sis5595_write_value(struct i2c_client *client, u8 reg, u8 value)
+{
+	struct sis5595_data *data = i2c_get_clientdata(client);
+	down(&data->lock);
+	outb_p(reg, client->addr + SIS5595_ADDR_REG_OFFSET);
+	outb_p(value, client->addr + SIS5595_DATA_REG_OFFSET);
+	up(&data->lock);
+	return 0;
+}
+
+/* Called when we have found a new SIS5595. */
+static void sis5595_init_client(struct i2c_client *client)
+{
+	u8 config = sis5595_read_value(client, SIS5595_REG_CONFIG);
+	if (!(config & 0x01))
+		sis5595_write_value(client, SIS5595_REG_CONFIG,
+				(config & 0xf7) | 0x01);
+}
+
+static struct sis5595_data *sis5595_update_device(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct sis5595_data *data = i2c_get_clientdata(client);
+	int i;
+
+	down(&data->update_lock);
+
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
+
+		for (i = 0; i <= data->maxins; i++) {
+			data->in[i] =
+			    sis5595_read_value(client, SIS5595_REG_IN(i));
+			data->in_min[i] =
+			    sis5595_read_value(client,
+					       SIS5595_REG_IN_MIN(i));
+			data->in_max[i] =
+			    sis5595_read_value(client,
+					       SIS5595_REG_IN_MAX(i));
+		}
+		for (i = 0; i < 2; i++) {
+			data->fan[i] =
+			    sis5595_read_value(client, SIS5595_REG_FAN(i));
+			data->fan_min[i] =
+			    sis5595_read_value(client,
+					       SIS5595_REG_FAN_MIN(i));
+		}
+		if (data->maxins == 3) {
+			data->temp =
+			    sis5595_read_value(client, SIS5595_REG_TEMP);
+			data->temp_over =
+			    sis5595_read_value(client, SIS5595_REG_TEMP_OVER);
+			data->temp_hyst =
+			    sis5595_read_value(client, SIS5595_REG_TEMP_HYST);
+		}
+		i = sis5595_read_value(client, SIS5595_REG_FANDIV);
+		data->fan_div[0] = (i >> 4) & 0x03;
+		data->fan_div[1] = i >> 6;
+		data->alarms =
+		    sis5595_read_value(client, SIS5595_REG_ALARM1) |
+		    (sis5595_read_value(client, SIS5595_REG_ALARM2) << 8);
+		data->last_updated = jiffies;
+		data->valid = 1;
+	}
+
+	up(&data->update_lock);
+
+	return data;
+}
+
+static struct pci_device_id sis5595_pci_ids[] = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_503) },
+	{ 0, }
+};
+
+MODULE_DEVICE_TABLE(pci, sis5595_pci_ids);
+
+static int blacklist[] __devinitdata = {
+	PCI_DEVICE_ID_SI_540,
+	PCI_DEVICE_ID_SI_550,
+	PCI_DEVICE_ID_SI_630,
+	PCI_DEVICE_ID_SI_645,
+	PCI_DEVICE_ID_SI_730,
+	PCI_DEVICE_ID_SI_735,
+	PCI_DEVICE_ID_SI_5511, /* 5513 chip has the 0008 device but
+				  that ID shows up in other chips so we
+				  use the 5511 ID for recognition */
+	PCI_DEVICE_ID_SI_5597,
+	PCI_DEVICE_ID_SI_5598,
+	0 };
+
+static int __devinit sis5595_pci_probe(struct pci_dev *dev,
+				       const struct pci_device_id *id)
+{
+	u16 val;
+	int *i;
+	int addr = 0;
+
+	for (i = blacklist; *i != 0; i++) {
+		struct pci_dev *dev;
+		dev = pci_get_device(PCI_VENDOR_ID_SI, *i, NULL);
+		if (dev) {
+			dev_err(&dev->dev, "Looked for SIS5595 but found unsupported device %.4x\n", *i);
+			pci_dev_put(dev);
+			return -ENODEV;
+		}
+	}
+	
+	if (PCIBIOS_SUCCESSFUL !=
+	    pci_read_config_word(dev, SIS5595_BASE_REG, &val))
+		return -ENODEV;
+	
+	addr = val & ~(SIS5595_EXTENT - 1);
+	if (addr == 0 && force_addr == 0) {
+		dev_err(&dev->dev, "Base address not set - upgrade BIOS or use force_addr=0xaddr\n");
+		return -ENODEV;
+	}
+	if (force_addr)
+		addr = force_addr;	/* so detect will get called */
+
+	if (!addr) {
+		dev_err(&dev->dev,"No SiS 5595 sensors found.\n");
+		return -ENODEV;
+	}
+	normal_isa[0] = addr;
+
+	s_bridge = pci_dev_get(dev);
+	if (i2c_add_driver(&sis5595_driver)) {
+		pci_dev_put(s_bridge);
+		s_bridge = NULL;
+	}
+
+	/* Always return failure here.  This is to allow other drivers to bind
+	 * to this pci device.  We don't really want to have control over the
+	 * pci device, we only wanted to read as few register values from it.
+	 */
+	return -ENODEV;
+}
+
+static struct pci_driver sis5595_pci_driver = {
+	.name            = "sis5595",
+	.id_table        = sis5595_pci_ids,
+	.probe           = sis5595_pci_probe,
+};
+
+static int __init sm_sis5595_init(void)
+{
+	return pci_register_driver(&sis5595_pci_driver);
+}
+
+static void __exit sm_sis5595_exit(void)
+{
+	pci_unregister_driver(&sis5595_pci_driver);
+	if (s_bridge != NULL) {
+		i2c_del_driver(&sis5595_driver);
+		pci_dev_put(s_bridge);
+		s_bridge = NULL;
+	}
+}
+
+MODULE_AUTHOR("Aurelien Jarno <aurelien@aurel32.net>");
+MODULE_DESCRIPTION("SiS 5595 Sensor device");
+MODULE_LICENSE("GPL");
+
+module_init(sm_sis5595_init);
+module_exit(sm_sis5595_exit);
diff -Nru a/drivers/i2c/chips/smsc47b397.c b/drivers/i2c/chips/smsc47b397.c
--- a/drivers/i2c/chips/smsc47b397.c	2005-01-03 19:52:41 -08:00
+++ b/drivers/i2c/chips/smsc47b397.c	2005-03-02 09:56:26 -08:00
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/ioport.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/init.h>
@@ -130,9 +131,7 @@
 
 	down(&data->update_lock);
 
-	if (time_after(jiffies - data->last_updated, (unsigned long)HZ)
-		|| time_before(jiffies, data->last_updated) || !data->valid) {
-
+	if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
 		dev_dbg(&client->dev, "starting device update...\n");
 
 		/* 4 temperature inputs, 4 fan inputs */
diff -Nru a/drivers/i2c/chips/smsc47m1.c b/drivers/i2c/chips/smsc47m1.c
--- a/drivers/i2c/chips/smsc47m1.c	2004-12-10 10:39:17 -08:00
+++ b/drivers/i2c/chips/smsc47m1.c	2005-03-02 09:56:26 -08:00
@@ -28,6 +28,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/ioport.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/init.h>
@@ -108,7 +109,6 @@
 struct smsc47m1_data {
 	struct i2c_client client;
 	struct semaphore lock;
-	int sysctl_id;
 
 	struct semaphore update_lock;
 	unsigned long last_updated;	/* In jiffies */
@@ -133,8 +133,6 @@
 		int init);
 
 
-static int smsc47m1_id;
-
 static struct i2c_driver smsc47m1_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "smsc47m1",
@@ -420,8 +418,6 @@
 	new_client->flags = 0;
 
 	strlcpy(new_client->name, "smsc47m1", I2C_NAME_SIZE);
-
-	new_client->id = smsc47m1_id++;
 	init_MUTEX(&data->update_lock);
 
 	/* If no function is properly configured, there's no point in
@@ -532,8 +528,7 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ + HZ / 2) ||
-	    (jiffies < data->last_updated) || init) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2) || init) {
 		int i;
 
 		for (i = 0; i < 2; i++) {
diff -Nru a/drivers/i2c/chips/via686a.c b/drivers/i2c/chips/via686a.c
--- a/drivers/i2c/chips/via686a.c	2005-02-02 22:34:47 -08:00
+++ b/drivers/i2c/chips/via686a.c	2005-03-02 09:56:26 -08:00
@@ -35,6 +35,7 @@
 #include <linux/slab.h>
 #include <linux/pci.h>
 #include <linux/delay.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/init.h>
@@ -726,9 +727,8 @@
 
 	down(&data->update_lock);
 
-       if ((jiffies - data->last_updated > HZ + HZ / 2) ||
-           (jiffies < data->last_updated) || !data->valid) {
-
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
 		for (i = 0; i <= 4; i++) {
 			data->in[i] =
 			    via686a_read_value(client, VIA686A_REG_IN(i));
diff -Nru a/drivers/i2c/chips/w83627hf.c b/drivers/i2c/chips/w83627hf.c
--- a/drivers/i2c/chips/w83627hf.c	2004-12-19 04:57:59 -08:00
+++ b/drivers/i2c/chips/w83627hf.c	2005-03-02 09:56:26 -08:00
@@ -40,6 +40,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
@@ -1321,6 +1322,27 @@
 	data->pwmenable[2] = 1;
 
 	if(init) {
+		/* Enable temp2 */
+		tmp = w83627hf_read_value(client, W83781D_REG_TEMP2_CONFIG);
+		if (tmp & 0x01) {
+			dev_warn(&client->dev, "Enabling temp2, readings "
+				 "might not make sense\n");
+			w83627hf_write_value(client, W83781D_REG_TEMP2_CONFIG,
+				tmp & 0xfe);
+		}
+
+		/* Enable temp3 */
+		if (type != w83697hf) {
+			tmp = w83627hf_read_value(client,
+				W83781D_REG_TEMP3_CONFIG);
+			if (tmp & 0x01) {
+				dev_warn(&client->dev, "Enabling temp3, "
+					 "readings might not make sense\n");
+				w83627hf_write_value(client,
+					W83781D_REG_TEMP3_CONFIG, tmp & 0xfe);
+			}
+		}
+
 		if (type == w83627hf) {
 			/* enable PWM2 control (can't hurt since PWM reg
 		           should have been reset to 0xff) */
@@ -1350,8 +1372,8 @@
 
 	down(&data->update_lock);
 
-	if ((jiffies - data->last_updated > HZ + HZ / 2) ||
-	    (jiffies < data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
 		for (i = 0; i <= 8; i++) {
 			/* skip missing sensors */
 			if (((data->type == w83697hf) && (i == 1)) ||
diff -Nru a/drivers/i2c/chips/w83781d.c b/drivers/i2c/chips/w83781d.c
--- a/drivers/i2c/chips/w83781d.c	2005-02-02 22:34:25 -08:00
+++ b/drivers/i2c/chips/w83781d.c	2005-03-02 09:56:26 -08:00
@@ -39,6 +39,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 #include <linux/i2c-vid.h>
@@ -1562,11 +1563,28 @@
 	}
 #endif				/* W83781D_RT */
 
-	if (init) {
+	if (init && type != as99127f) {
+		/* Enable temp2 */
+		tmp = w83781d_read_value(client, W83781D_REG_TEMP2_CONFIG);
+		if (tmp & 0x01) {
+			dev_warn(&client->dev, "Enabling temp2, readings "
+				 "might not make sense\n");
+			w83781d_write_value(client, W83781D_REG_TEMP2_CONFIG,
+				tmp & 0xfe);
+		}
+
+		/* Enable temp3 */
 		if (type != w83783s && type != w83697hf) {
-			w83781d_write_value(client, W83781D_REG_TEMP3_CONFIG,
-					    0x00);
+			tmp = w83781d_read_value(client,
+				W83781D_REG_TEMP3_CONFIG);
+			if (tmp & 0x01) {
+				dev_warn(&client->dev, "Enabling temp3, "
+					 "readings might not make sense\n");
+				w83781d_write_value(client,
+					W83781D_REG_TEMP3_CONFIG, tmp & 0xfe);
+			}
 		}
+
 		if (type != w83781d) {
 			/* enable comparator mode for temp2 and temp3 so
 			   alarm indication will work correctly */
@@ -1592,9 +1610,8 @@
 
 	down(&data->update_lock);
 
-	if (time_after
-	    (jiffies - data->last_updated, (unsigned long) (HZ + HZ / 2))
-	    || time_before(jiffies, data->last_updated) || !data->valid) {
+	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
+	    || !data->valid) {
 		dev_dbg(dev, "Starting device update\n");
 
 		for (i = 0; i <= 8; i++) {
diff -Nru a/drivers/i2c/chips/w83l785ts.c b/drivers/i2c/chips/w83l785ts.c
--- a/drivers/i2c/chips/w83l785ts.c	2004-11-23 16:00:00 -08:00
+++ b/drivers/i2c/chips/w83l785ts.c	2005-03-02 09:56:26 -08:00
@@ -35,6 +35,7 @@
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/jiffies.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
 
@@ -114,12 +115,6 @@
 };
 
 /*
- * Internal variables
- */
-
-static int w83l785ts_id = 0;
-
-/*
  * Sysfs stuff
  */
 
@@ -229,7 +224,6 @@
 
 	/* We can fill in the remaining client fields. */
 	strlcpy(new_client->name, "w83l785ts", I2C_NAME_SIZE);
-	new_client->id = w83l785ts_id++;
 	data->valid = 0;
 	init_MUTEX(&data->update_lock);
 
@@ -301,9 +295,7 @@
 
 	down(&data->update_lock);
 
-	if (!data->valid
-	 || (jiffies - data->last_updated > HZ * 2)
-	 || (jiffies < data->last_updated)) {
+	if (!data->valid || time_after(jiffies, data->last_updated + HZ * 2)) {
 		dev_dbg(&client->dev, "Updating w83l785ts data.\n");
 		data->temp = w83l785ts_read_value(client,
 			     W83L785TS_REG_TEMP, data->temp);
diff -Nru a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
--- a/drivers/i2c/i2c-core.c	2004-11-17 03:18:35 -08:00
+++ b/drivers/i2c/i2c-core.c	2005-03-02 09:55:02 -08:00
@@ -38,12 +38,43 @@
 static DECLARE_MUTEX(core_lists);
 static DEFINE_IDR(i2c_adapter_idr);
 
-int i2c_device_probe(struct device *dev)
+/* match always succeeds, as we want the probe() to tell if we really accept this match */
+static int i2c_device_match(struct device *dev, struct device_driver *drv)
+{
+	return 1;
+}
+
+static int i2c_bus_suspend(struct device * dev, pm_message_t state)
+{
+	int rc = 0;
+
+	if (dev->driver && dev->driver->suspend)
+		rc = dev->driver->suspend(dev,state,0);
+	return rc;
+}
+
+static int i2c_bus_resume(struct device * dev)
+{
+	int rc = 0;
+	
+	if (dev->driver && dev->driver->resume)
+		rc = dev->driver->resume(dev,0);
+	return rc;
+}
+
+static struct bus_type i2c_bus_type = {
+	.name =		"i2c",
+	.match =	i2c_device_match,
+	.suspend =      i2c_bus_suspend,
+	.resume =       i2c_bus_resume,
+};
+
+static int i2c_device_probe(struct device *dev)
 {
 	return -ENODEV;
 }
 
-int i2c_device_remove(struct device *dev)
+static int i2c_device_remove(struct device *dev)
 {
 	return 0;
 }
@@ -523,38 +554,6 @@
        up(&adap->clist_lock);
 }
 
-
-/* match always succeeds, as we want the probe() to tell if we really accept this match */
-static int i2c_device_match(struct device *dev, struct device_driver *drv)
-{
-	return 1;
-}
-
-static int i2c_bus_suspend(struct device * dev, u32 state)
-{
-	int rc = 0;
-
-	if (dev->driver && dev->driver->suspend)
-		rc = dev->driver->suspend(dev,state,0);
-	return rc;
-}
-
-static int i2c_bus_resume(struct device * dev)
-{
-	int rc = 0;
-	
-	if (dev->driver && dev->driver->resume)
-		rc = dev->driver->resume(dev,0);
-	return rc;
-}
-
-struct bus_type i2c_bus_type = {
-	.name =		"i2c",
-	.match =	i2c_device_match,
-	.suspend =      i2c_bus_suspend,
-	.resume =       i2c_bus_resume,
-};
-
 static int __init i2c_init(void)
 {
 	int retval;
@@ -583,7 +582,7 @@
  * ----------------------------------------------------
  */
 
-int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg msgs[],int num)
+int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num)
 {
 	int ret;
 
@@ -860,7 +859,7 @@
 /* CRC over count bytes in the first array plus the bytes in the rest
    array if it is non-null. rest[0] is the (length of rest) - 1
    and is included. */
-u8 i2c_smbus_partial_pec(u8 crc, int count, u8 *first, u8 *rest)
+static u8 i2c_smbus_partial_pec(u8 crc, int count, u8 *first, u8 *rest)
 {
 	int i;
 
@@ -872,7 +871,7 @@
 	return crc;
 }
 
-u8 i2c_smbus_pec(int count, u8 *first, u8 *rest)
+static u8 i2c_smbus_pec(int count, u8 *first, u8 *rest)
 {
 	return i2c_smbus_partial_pec(0, count, first, rest);
 }
@@ -880,8 +879,8 @@
 /* Returns new "size" (transaction type)
    Note that we convert byte to byte_data and byte_data to word_data
    rather than invent new xxx_PEC transactions. */
-int i2c_smbus_add_pec(u16 addr, u8 command, int size,
-                      union i2c_smbus_data *data)
+static int i2c_smbus_add_pec(u16 addr, u8 command, int size,
+			     union i2c_smbus_data *data)
 {
 	u8 buf[3];
 
@@ -910,8 +909,8 @@
 	return size;	
 }
 
-int i2c_smbus_check_pec(u16 addr, u8 command, int size, u8 partial,
-                        union i2c_smbus_data *data)
+static int i2c_smbus_check_pec(u16 addr, u8 command, int size, u8 partial,
+			       union i2c_smbus_data *data)
 {
 	u8 buf[3], rpec, cpec;
 
diff -Nru a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
--- a/drivers/i2c/i2c-dev.c	2005-01-20 21:02:15 -08:00
+++ b/drivers/i2c/i2c-dev.c	2005-03-09 09:04:29 -08:00
@@ -55,7 +55,7 @@
 static struct i2c_dev *i2c_dev_array[I2C_MINORS];
 static DEFINE_SPINLOCK(i2c_dev_array_lock);
 
-struct i2c_dev *i2c_dev_get_by_minor(unsigned index)
+static struct i2c_dev *i2c_dev_get_by_minor(unsigned index)
 {
 	struct i2c_dev *i2c_dev;
 
@@ -65,7 +65,7 @@
 	return i2c_dev;
 }
 
-struct i2c_dev *i2c_dev_get_by_adapter(struct i2c_adapter *adap)
+static struct i2c_dev *i2c_dev_get_by_adapter(struct i2c_adapter *adap)
 {
 	struct i2c_dev *i2c_dev = NULL;
 
@@ -108,13 +108,6 @@
 	spin_unlock(&i2c_dev_array_lock);
 }
 
-static ssize_t show_dev(struct class_device *class_dev, char *buf)
-{
-	struct i2c_dev *i2c_dev = to_i2c_dev(class_dev);
-	return print_dev_t(buf, MKDEV(I2C_MAJOR, i2c_dev->minor));
-}
-static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
-
 static ssize_t show_adapter_name(struct class_device *class_dev, char *buf)
 {
 	struct i2c_dev *i2c_dev = to_i2c_dev(class_dev);
@@ -173,8 +166,8 @@
 	return ret;
 }
 
-int i2cdev_ioctl (struct inode *inode, struct file *file, unsigned int cmd, 
-                  unsigned long arg)
+static int i2cdev_ioctl(struct inode *inode, struct file *file,
+		unsigned int cmd, unsigned long arg)
 {
 	struct i2c_client *client = (struct i2c_client *)file->private_data;
 	struct i2c_rdwr_ioctl_data rdwr_arg;
@@ -451,11 +444,11 @@
 	else
 		i2c_dev->class_dev.dev = adap->dev.parent;
 	i2c_dev->class_dev.class = &i2c_dev_class;
+	i2c_dev->class_dev.devt = MKDEV(I2C_MAJOR, i2c_dev->minor);
 	snprintf(i2c_dev->class_dev.class_id, BUS_ID_SIZE, "i2c-%d", i2c_dev->minor);
 	retval = class_device_register(&i2c_dev->class_dev);
 	if (retval)
 		goto error;
-	class_device_create_file(&i2c_dev->class_dev, &class_device_attr_dev);
 	class_device_create_file(&i2c_dev->class_dev, &class_device_attr_name);
 	return 0;
 error:
@@ -507,7 +500,6 @@
 
 static struct i2c_client i2cdev_client_template = {
 	.name		= "I2C /dev entry",
-	.id		= 1,
 	.addr		= -1,
 	.driver		= &i2cdev_driver,
 };
diff -Nru a/drivers/i2c/i2c-sensor-detect.c b/drivers/i2c/i2c-sensor-detect.c
--- a/drivers/i2c/i2c-sensor-detect.c	2004-11-09 11:40:42 -08:00
+++ b/drivers/i2c/i2c-sensor-detect.c	2005-03-02 09:58:33 -08:00
@@ -19,17 +19,10 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/ctype.h>
-#include <linux/sysctl.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
 #include <linux/i2c.h>
 #include <linux/i2c-sensor.h>
-#include <asm/uaccess.h>
 
 static unsigned short empty[] = {I2C_CLIENT_END};
 static unsigned int empty_isa[] = {I2C_CLIENT_ISA_END};
diff -Nru a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
--- a/drivers/ide/arm/icside.c	2005-01-09 12:06:39 -08:00
+++ b/drivers/ide/arm/icside.c	2005-03-02 08:02:28 -08:00
@@ -713,7 +713,7 @@
 icside_probe(struct expansion_card *ec, const struct ecard_id *id)
 {
 	struct icside_state *state;
-	void *idmem;
+	void __iomem *idmem;
 	int ret;
 
 	ret = ecard_request_resources(ec);
diff -Nru a/drivers/ide/arm/rapide.c b/drivers/ide/arm/rapide.c
--- a/drivers/ide/arm/rapide.c	2004-11-14 09:32:14 -08:00
+++ b/drivers/ide/arm/rapide.c	2005-03-02 08:02:29 -08:00
@@ -17,7 +17,7 @@
  * Something like this really should be in generic code, but isn't.
  */
 static ide_hwif_t *
-rapide_locate_hwif(void __iomem *base, void *ctrl, unsigned int sz, int irq)
+rapide_locate_hwif(void __iomem *base, void __iomem *ctrl, unsigned int sz, int irq)
 {
 	unsigned long port = (unsigned long)base;
 	ide_hwif_t *hwif;
diff -Nru a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
--- a/drivers/ide/ide-disk.c	2005-02-23 10:58:29 -08:00
+++ b/drivers/ide/ide-disk.c	2005-03-09 03:27:42 -08:00
@@ -698,18 +698,51 @@
 
 #endif	/* CONFIG_PROC_FS */
 
-static int idedisk_issue_flush(request_queue_t *q, struct gendisk *disk,
-			       sector_t *error_sector)
+static void idedisk_end_flush(request_queue_t *q, struct request *flush_rq)
+{
+	ide_drive_t *drive = q->queuedata;
+	struct request *rq = flush_rq->end_io_data;
+	int good_sectors = rq->hard_nr_sectors;
+	int bad_sectors;
+	sector_t sector;
+
+	if (flush_rq->errors & ABRT_ERR) {
+		printk(KERN_ERR "%s: barrier support doesn't work\n", drive->name);
+		blk_queue_ordered(drive->queue, QUEUE_ORDERED_NONE);
+		blk_queue_issue_flush_fn(drive->queue, NULL);
+		good_sectors = 0;
+	} else if (flush_rq->errors) {
+		good_sectors = 0;
+		if (blk_barrier_preflush(rq)) {
+			sector = ide_get_error_location(drive,flush_rq->buffer);
+			if ((sector >= rq->hard_sector) &&
+			    (sector < rq->hard_sector + rq->hard_nr_sectors))
+				good_sectors = sector - rq->hard_sector;
+		}
+	}
+
+	if (flush_rq->errors)
+		printk(KERN_ERR "%s: failed barrier write: "
+				"sector=%Lx(good=%d/bad=%d)\n",
+				drive->name, (unsigned long long)rq->sector,
+				good_sectors,
+				(int) (rq->hard_nr_sectors-good_sectors));
+
+	bad_sectors = rq->hard_nr_sectors - good_sectors;
+
+	if (good_sectors)
+		__ide_end_request(drive, rq, 1, good_sectors);
+	if (bad_sectors)
+		__ide_end_request(drive, rq, 0, bad_sectors);
+}
+
+static int idedisk_prepare_flush(request_queue_t *q, struct request *rq)
 {
 	ide_drive_t *drive = q->queuedata;
-	struct request *rq;
-	int ret;
 
 	if (!drive->wcache)
 		return 0;
 
-	rq = blk_get_request(q, WRITE, __GFP_WAIT);
-
 	memset(rq->cmd, 0, sizeof(rq->cmd));
 
 	if (ide_id_has_flush_cache_ext(drive->id) &&
@@ -721,6 +754,22 @@
 
 	rq->flags |= REQ_DRIVE_TASK | REQ_SOFTBARRIER;
 	rq->buffer = rq->cmd;
+	return 1;
+}
+
+static int idedisk_issue_flush(request_queue_t *q, struct gendisk *disk,
+			       sector_t *error_sector)
+{
+	ide_drive_t *drive = q->queuedata;
+	struct request *rq;
+	int ret;
+
+	if (!drive->wcache)
+		return 0;
+
+	rq = blk_get_request(q, WRITE, __GFP_WAIT);
+
+	idedisk_prepare_flush(q, rq);
 
 	ret = blk_execute_rq(q, disk, rq);
 
@@ -1098,10 +1147,12 @@
 			barrier = 0;
 	}
 
-	printk(KERN_DEBUG "%s: cache flushes %ssupported\n",
+	printk(KERN_INFO "%s: cache flushes %ssupported\n",
 		drive->name, barrier ? "" : "not ");
 	if (barrier) {
-		blk_queue_ordered(drive->queue, 1);
+		blk_queue_ordered(drive->queue, QUEUE_ORDERED_FLUSH);
+		drive->queue->prepare_flush_fn = idedisk_prepare_flush;
+		drive->queue->end_flush_fn = idedisk_end_flush;
 		blk_queue_issue_flush_fn(drive->queue, idedisk_issue_flush);
 	}
 }
diff -Nru a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
--- a/drivers/ide/ide-io.c	2005-02-24 03:01:54 -08:00
+++ b/drivers/ide/ide-io.c	2005-03-07 20:41:36 -08:00
@@ -55,62 +55,8 @@
 #include <asm/io.h>
 #include <asm/bitops.h>
 
-static void ide_fill_flush_cmd(ide_drive_t *drive, struct request *rq)
-{
-	char *buf = rq->cmd;
-
-	/*
-	 * reuse cdb space for ata command
-	 */
-	memset(buf, 0, sizeof(rq->cmd));
-
-	rq->flags |= REQ_DRIVE_TASK | REQ_STARTED;
-	rq->buffer = buf;
-	rq->buffer[0] = WIN_FLUSH_CACHE;
-
-	if (ide_id_has_flush_cache_ext(drive->id) &&
-	    (drive->capacity64 >= (1UL << 28)))
-		rq->buffer[0] = WIN_FLUSH_CACHE_EXT;
-}
-
-/*
- * preempt pending requests, and store this cache flush for immediate
- * execution
- */
-static struct request *ide_queue_flush_cmd(ide_drive_t *drive,
-					   struct request *rq, int post)
-{
-	struct request *flush_rq = &HWGROUP(drive)->wrq;
-
-	/*
-	 * write cache disabled, clear the barrier bit and treat it like
-	 * an ordinary write
-	 */
-	if (!drive->wcache) {
-		rq->flags |= REQ_BAR_PREFLUSH;
-		return rq;
-	}
-
-	ide_init_drive_cmd(flush_rq);
-	ide_fill_flush_cmd(drive, flush_rq);
-
-	flush_rq->special = rq;
-	flush_rq->nr_sectors = rq->nr_sectors;
-
-	if (!post) {
-		drive->doing_barrier = 1;
-		flush_rq->flags |= REQ_BAR_PREFLUSH;
-		blkdev_dequeue_request(rq);
-	} else
-		flush_rq->flags |= REQ_BAR_POSTFLUSH;
-
-	__elv_add_request(drive->queue, flush_rq, ELEVATOR_INSERT_FRONT, 0);
-	HWGROUP(drive)->rq = NULL;
-	return flush_rq;
-}
-
-static int __ide_end_request(ide_drive_t *drive, struct request *rq,
-			     int uptodate, int nr_sectors)
+int __ide_end_request(ide_drive_t *drive, struct request *rq, int uptodate,
+		      int nr_sectors)
 {
 	int ret = 1;
 
@@ -148,6 +94,7 @@
 	}
 	return ret;
 }
+EXPORT_SYMBOL(__ide_end_request);
 
 /**
  *	ide_end_request		-	complete an IDE I/O
@@ -172,17 +119,10 @@
 	if (!nr_sectors)
 		nr_sectors = rq->hard_cur_sectors;
 
-	if (!blk_barrier_rq(rq) || !drive->wcache)
+	if (blk_complete_barrier_rq_locked(drive->queue, rq, nr_sectors))
+		ret = rq->nr_sectors != 0;
+	else
 		ret = __ide_end_request(drive, rq, uptodate, nr_sectors);
-	else {
-		struct request *flush_rq = &HWGROUP(drive)->wrq;
-
-		flush_rq->nr_sectors -= nr_sectors;
-		if (!flush_rq->nr_sectors) {
-			ide_queue_flush_cmd(drive, rq, 1);
-			ret = 0;
-		}
-	}
 
 	spin_unlock_irqrestore(&ide_lock, flags);
 	return ret;
@@ -253,79 +193,6 @@
 }
 EXPORT_SYMBOL(ide_get_error_location);
 
-static void ide_complete_barrier(ide_drive_t *drive, struct request *rq,
-				 int error)
-{
-	struct request *real_rq = rq->special;
-	int good_sectors, bad_sectors;
-	sector_t sector;
-
-	if (!error) {
-		if (blk_barrier_postflush(rq)) {
-			/*
-			 * this completes the barrier write
-			 */
-			__ide_end_request(drive, real_rq, 1, real_rq->hard_nr_sectors);
-			drive->doing_barrier = 0;
-		} else {
-			/*
-			 * just indicate that we did the pre flush
-			 */
-			real_rq->flags |= REQ_BAR_PREFLUSH;
-			elv_requeue_request(drive->queue, real_rq);
-		}
-		/*
-		 * all is fine, return
-		 */
-		return;
-	}
-
-	/*
-	 * we need to end real_rq, but it's not on the queue currently.
-	 * put it back on the queue, so we don't have to special case
-	 * anything else for completing it
-	 */
-	if (!blk_barrier_postflush(rq))
-		elv_requeue_request(drive->queue, real_rq);
-
-	/*
-	 * drive aborted flush command, assume FLUSH_CACHE_* doesn't
-	 * work and disable barrier support
-	 */
-	if (error & ABRT_ERR) {
-		printk(KERN_ERR "%s: barrier support doesn't work\n", drive->name);
-		__ide_end_request(drive, real_rq, -EOPNOTSUPP, real_rq->hard_nr_sectors);
-		blk_queue_ordered(drive->queue, 0);
-		blk_queue_issue_flush_fn(drive->queue, NULL);
-	} else {
-		/*
-		 * find out what part of the request failed
-		 */
-		good_sectors = 0;
-		if (blk_barrier_postflush(rq)) {
-			sector = ide_get_error_location(drive, rq->buffer);
-
-			if ((sector >= real_rq->hard_sector) &&
-			    (sector < real_rq->hard_sector + real_rq->hard_nr_sectors))
-				good_sectors = sector - real_rq->hard_sector;
-		} else
-			sector = real_rq->hard_sector;
-
-		bad_sectors = real_rq->hard_nr_sectors - good_sectors;
-		if (good_sectors)
-			__ide_end_request(drive, real_rq, 1, good_sectors);
-		if (bad_sectors)
-			__ide_end_request(drive, real_rq, 0, bad_sectors);
-
-		printk(KERN_ERR "%s: failed barrier write: "
-				"sector=%Lx(good=%d/bad=%d)\n",
-				drive->name, (unsigned long long)sector,
-				good_sectors, bad_sectors);
-	}
-
-	drive->doing_barrier = 0;
-}
-
 /**
  *	ide_end_drive_cmd	-	end an explicit drive command
  *	@drive: command 
@@ -417,11 +284,8 @@
 
 	spin_lock_irqsave(&ide_lock, flags);
 	blkdev_dequeue_request(rq);
-
-	if (blk_barrier_preflush(rq) || blk_barrier_postflush(rq))
-		ide_complete_barrier(drive, rq, err);
-
 	HWGROUP(drive)->rq = NULL;
+	rq->errors = err;
 	end_that_request_last(rq);
 	spin_unlock_irqrestore(&ide_lock, flags);
 }
@@ -963,7 +827,7 @@
 	 * though that is 3 requests, it must be seen as a single transaction.
 	 * we must not preempt this drive until that is complete
 	 */
-	if (drive->doing_barrier) {
+	if (blk_queue_flushing(drive->queue)) {
 		/*
 		 * small race where queue could get replugged during
 		 * the 3-request flush cycle, just yank the plug since
@@ -1128,13 +992,6 @@
 		}
 
 		/*
-		 * if rq is a barrier write, issue pre cache flush if not
-		 * already done
-		 */
-		if (blk_barrier_rq(rq) && !blk_barrier_preflush(rq))
-			rq = ide_queue_flush_cmd(drive, rq, 0);
-
-		/*
 		 * Sanity: don't accept a request that isn't a PM request
 		 * if we are currently power managed. This is very important as
 		 * blk_stop_queue() doesn't prevent the elv_next_request()
@@ -1607,6 +1464,7 @@
 	if (must_wait) {
 		rq->ref_count++;
 		rq->waiting = &wait;
+		rq->end_io = blk_end_sync_rq;
 	}
 
 	spin_lock_irqsave(&ide_lock, flags);
diff -Nru a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
--- a/drivers/ide/ide-tape.c	2005-02-02 17:09:29 -08:00
+++ b/drivers/ide/ide-tape.c	2005-03-07 20:41:36 -08:00
@@ -2720,6 +2720,7 @@
 	}
 #endif /* IDETAPE_DEBUG_BUGS */
 	rq->waiting = &wait;
+	rq->end_io = blk_end_sync_rq;
 	spin_unlock_irq(&tape->spinlock);
 	wait_for_completion(&wait);
 	/* The stage and its struct request have been deallocated */
@@ -4100,7 +4101,13 @@
 	idetape_pc_t pc;
 	int retval;
 
-	nonseekable_open(inode, filp);
+	/*
+	 * We really want to do nonseekable_open(inode, filp); here, but some
+	 * versions of tar incorrectly call lseek on tapes and bail out if that
+	 * fails.  So we disallow pread() and pwrite(), but permit lseeks.
+	 */
+	filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
+
 #if IDETAPE_DEBUG_LOG
 	printk(KERN_INFO "ide-tape: Reached idetape_chrdev_open\n");
 #endif /* IDETAPE_DEBUG_LOG */
diff -Nru a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c
--- a/drivers/ide/pci/sgiioc4.c	2005-02-03 06:58:21 -08:00
+++ b/drivers/ide/pci/sgiioc4.c	2005-03-07 20:41:31 -08:00
@@ -34,6 +34,7 @@
 #include <linux/mm.h>
 #include <linux/ioport.h>
 #include <linux/blkdev.h>
+#include <linux/ioc4_common.h>
 #include <asm/io.h>
 
 #include <linux/ide.h>
@@ -684,23 +685,14 @@
 	unsigned int class_rev;
 	int ret;
 
-	ret = pci_enable_device(dev);
-	if (ret < 0) {
-		printk(KERN_ERR
-		       "Failed to enable device %s at slot %s\n",
-		       d->name, dev->slot_name);
-		goto out;
-	}
-	pci_set_master(dev);
-
 	pci_read_config_dword(dev, PCI_CLASS_REVISION, &class_rev);
 	class_rev &= 0xff;
 	printk(KERN_INFO "%s: IDE controller at PCI slot %s, revision %d\n",
-			d->name, dev->slot_name, class_rev);
+			d->name, pci_name(dev), class_rev);
 	if (class_rev < IOC4_SUPPORTED_FIRMWARE_REV) {
 		printk(KERN_ERR "Skipping %s IDE controller in slot %s: "
 			"firmware is obsolete - please upgrade to revision"
-			"46 or higher\n", d->name, dev->slot_name);
+			"46 or higher\n", d->name, pci_name(dev));
 		ret = -EAGAIN;
 		goto out;
 	}
@@ -722,34 +714,15 @@
 	}
 };
 
-static int __devinit
-sgiioc4_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+int
+ioc4_ide_attach_one(struct pci_dev *dev, const struct pci_device_id *id)
 {
-	pci_init_sgiioc4(dev, &sgiioc4_chipsets[id->driver_data]);
-	return 0;
+	return pci_init_sgiioc4(dev, &sgiioc4_chipsets[id->driver_data]);
 }
 
-static struct pci_device_id sgiioc4_pci_tbl[] = {
-	{PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC4, PCI_ANY_ID,
-	 PCI_ANY_ID, 0x0b4000, 0xFFFFFF, 0},
-	{0}
-};
-MODULE_DEVICE_TABLE(pci, sgiioc4_pci_tbl);
-
-static struct pci_driver __devinitdata driver = {
-	.name = "SGI-IOC4_IDE",
-	.id_table = sgiioc4_pci_tbl,
-	.probe = sgiioc4_init_one,
-};
-
-static int __devinit
-sgiioc4_ide_init(void)
-{
-	return ide_pci_register_driver(&driver);
-}
-
-module_init(sgiioc4_ide_init);
 
 MODULE_AUTHOR("Aniket Malatpure - Silicon Graphics Inc. (SGI)");
-MODULE_DESCRIPTION("PCI driver module for SGI IOC4 Base-IO Card");
+MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card");
 MODULE_LICENSE("GPL");
+
+EXPORT_SYMBOL(ioc4_ide_attach_one);
diff -Nru a/drivers/ieee1394/Kconfig b/drivers/ieee1394/Kconfig
--- a/drivers/ieee1394/Kconfig	2004-07-28 21:58:45 -07:00
+++ b/drivers/ieee1394/Kconfig	2005-02-02 10:32:57 -08:00
@@ -5,6 +5,7 @@
 config IEEE1394
 	tristate "IEEE 1394 (FireWire) support"
 	depends on PCI || BROKEN
+	select NET
 	help
 	  IEEE 1394 describes a high performance serial bus, which is also
 	  known as FireWire(tm) or i.Link(tm) and is used for connecting all
diff -Nru a/drivers/ieee1394/amdtp.c b/drivers/ieee1394/amdtp.c
--- a/drivers/ieee1394/amdtp.c	2005-01-20 21:01:18 -08:00
+++ b/drivers/ieee1394/amdtp.c	2005-01-30 21:33:22 -08:00
@@ -286,7 +286,7 @@
 #define OHCI1394_CONTEXT_DEAD        0x00000800
 #define OHCI1394_CONTEXT_ACTIVE      0x00000400
 
-void ohci1394_start_it_ctx(struct ti_ohci *ohci, int ctx,
+static void ohci1394_start_it_ctx(struct ti_ohci *ohci, int ctx,
 			   dma_addr_t first_cmd, int z, int cycle_match)
 {
 	reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, 1 << ctx);
@@ -298,13 +298,13 @@
 		  OHCI1394_CONTEXT_RUN);
 }
 
-void ohci1394_wake_it_ctx(struct ti_ohci *ohci, int ctx)
+static void ohci1394_wake_it_ctx(struct ti_ohci *ohci, int ctx)
 {
 	reg_write(ohci, OHCI1394_IsoXmitContextControlSet + ctx * 16,
 		  OHCI1394_CONTEXT_WAKE);
 }
 
-void ohci1394_stop_it_ctx(struct ti_ohci *ohci, int ctx, int synchronous)
+static void ohci1394_stop_it_ctx(struct ti_ohci *ohci, int ctx, int synchronous)
 {
 	u32 control;
 	int wait;
@@ -530,7 +530,7 @@
 	return frac->integer + (frac->numerator > 0 ? 1 : 0);
 }
 
-void packet_initialize(struct packet *p, struct packet *next)
+static void packet_initialize(struct packet *p, struct packet *next)
 {
 	/* Here we initialize the dma descriptor block for
 	 * transferring one iso packet.  We use two descriptors per
@@ -559,7 +559,7 @@
 	p->db->payload_desc.status = 0;
 }
 
-struct packet_list *packet_list_alloc(struct stream *s)
+static struct packet_list *packet_list_alloc(struct stream *s)
 {
 	int i;
 	struct packet_list *pl;
@@ -588,7 +588,7 @@
 	return pl;
 }
 
-void packet_list_free(struct packet_list *pl, struct stream *s)
+static void packet_list_free(struct packet_list *pl, struct stream *s)
 {
 	int i;
 
@@ -1010,7 +1010,7 @@
 	return 0;
 }
 
-struct stream *stream_alloc(struct amdtp_host *host)
+static struct stream *stream_alloc(struct amdtp_host *host)
 {
 	struct stream *s;
 	unsigned long flags;
@@ -1062,7 +1062,7 @@
 	return s;
 }
 
-void stream_free(struct stream *s)
+static void stream_free(struct stream *s)
 {
 	unsigned long flags;
 
diff -Nru a/drivers/ieee1394/config_roms.c b/drivers/ieee1394/config_roms.c
--- a/drivers/ieee1394/config_roms.c	2004-02-28 11:15:44 -08:00
+++ b/drivers/ieee1394/config_roms.c	2005-01-30 22:02:41 -08:00
@@ -67,8 +67,8 @@
 	ret = csr1212_associate_keyval(vend_id, text);
 	csr1212_release_keyval(text);
 	ret |= csr1212_attach_keyval_to_directory(root, vend_id);
+	csr1212_release_keyval(vend_id);
 	if (ret != CSR1212_SUCCESS) {
-		csr1212_release_keyval(vend_id);
 		csr1212_destroy_csr(host->csr.rom);
 		return -ENOMEM;
 	}
diff -Nru a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c
--- a/drivers/ieee1394/csr1212.c	2004-06-13 07:08:59 -07:00
+++ b/drivers/ieee1394/csr1212.c	2005-01-29 12:24:05 -08:00
@@ -87,7 +87,8 @@
 
 static inline void free_keyval(struct csr1212_keyval *kv)
 {
-	if (kv->key.type == CSR1212_KV_TYPE_LEAF)
+	if ((kv->key.type == CSR1212_KV_TYPE_LEAF) &&
+	    (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM))
 		CSR1212_FREE(kv->value.leaf.data);
 
 	CSR1212_FREE(kv);
@@ -155,7 +156,7 @@
 {
 	struct csr1212_keyval *kv;
 
-	for (kv = kv_list; kv != NULL; kv = kv->next) {
+	for (kv = kv_list->next; kv && (kv != kv_list); kv = kv->next) {
 		if (kv->offset == offset)
 			return kv;
 	}
@@ -181,9 +182,9 @@
 		return NULL;
 	}
 
-        /* The keyval key id is not used for the root node, but a valid key id
-         * that can be used for a directory needs to be passed to
-         * csr1212_new_directory(). */
+	/* The keyval key id is not used for the root node, but a valid key id
+	 * that can be used for a directory needs to be passed to
+	 * csr1212_new_directory(). */
 	csr->root_kv = csr1212_new_directory(CSR1212_KV_ID_VENDOR);
 	if (!csr->root_kv) {
 		CSR1212_FREE(csr->cache_head);
@@ -709,7 +710,7 @@
 					tail->next = k->value.directory.dentries_head;
 					k->value.directory.dentries_head->prev = tail;
 					tail = k->value.directory.dentries_tail;
-                                }
+				}
 			}
 			free_keyval(k);
 			k = a;
@@ -796,7 +797,8 @@
 		return CSR1212_ENOMEM;
 	}
 	cache->ext_rom->offset = csr_addr - CSR1212_REGISTER_SPACE_BASE;
-	cache->ext_rom->value.leaf.len = 0;
+	cache->ext_rom->value.leaf.len = -1;
+	cache->ext_rom->value.leaf.data = cache->data;
 
 	/* Add cache to tail of cache list */
 	cache->prev = csr->cache_tail;
@@ -864,20 +866,20 @@
 			default:
 			case CSR1212_KV_TYPE_IMMEDIATE:
 			case CSR1212_KV_TYPE_CSR_OFFSET:
-				continue;
+				break;
 			case CSR1212_KV_TYPE_LEAF:
 			case CSR1212_KV_TYPE_DIRECTORY:
 				/* Remove from list */
-				if (dkv->prev)
+				if (dkv->prev && (dkv->prev->next == dkv))
 					dkv->prev->next = dkv->next;
-				if (dkv->next)
+				if (dkv->next && (dkv->next->prev == dkv))
 					dkv->next->prev = dkv->prev;
-				if (dkv == *layout_tail)
-					*layout_tail = dkv->prev;
+				//if (dkv == *layout_tail)
+				//	*layout_tail = dkv->prev;
 
 				/* Special case: Extended ROM leafs */
 				if (dkv->key.id == CSR1212_KV_ID_EXTENDED_ROM) {
-					dkv->value.leaf.len = 0; /* initialize to zero */
+					dkv->value.leaf.len = -1;
 					/* Don't add Extended ROM leafs in the layout list,
 					 * they are handled differently. */
 					break;
@@ -919,8 +921,8 @@
 }
 
 struct csr1212_keyval *csr1212_generate_positions(struct csr1212_csr_rom_cache *cache,
-                                                  struct csr1212_keyval *start_kv,
-                                                  int start_pos)
+						  struct csr1212_keyval *start_kv,
+						  int start_pos)
 {
 	struct csr1212_keyval *kv = start_kv;
 	struct csr1212_keyval *okv = start_kv;
@@ -930,7 +932,10 @@
 	cache->layout_head = kv;
 
 	while(kv && pos < cache->size) {
-		kv->offset = cache->offset + pos;
+		/* Special case: Extended ROM leafs */
+		if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM) {
+			kv->offset = cache->offset + pos;
+		}
 
 		switch(kv->key.type) {
 		case CSR1212_KV_TYPE_LEAF:
@@ -1090,6 +1095,9 @@
 	bi->crc_length = bi->length;
 	bi->crc = csr1212_crc16(bi->data, bi->crc_length);
 
+	csr->root_kv->next = NULL;
+	csr->root_kv->prev = NULL;
+
 	agg_size = csr1212_generate_layout_order(csr->root_kv);
 
 	init_offset = csr->bus_info_len;
@@ -1158,6 +1166,17 @@
 
 		/* Copy the data into the cache buffer */
 		csr1212_fill_cache(cache);
+
+		if (cache != csr->cache_head) {
+			/* Set the length and CRC of the extended ROM. */
+			struct csr1212_keyval_img *kvi =
+				(struct csr1212_keyval_img*)cache->data;
+
+			kvi->length = CSR1212_CPU_TO_BE16(bytes_to_quads(cache->len) - 1);
+			kvi->crc = csr1212_crc16(kvi->data,
+						 bytes_to_quads(cache->len) - 1);
+
+		}
 	}
 
 	return CSR1212_SUCCESS;
@@ -1174,11 +1193,6 @@
 			       &cache->data[bytes_to_quads(offset - cache->offset)],
 			       len);
 			return CSR1212_SUCCESS;
-		} else if (((offset < cache->offset) &&
-			    ((offset + len) >= cache->offset)) ||
-			   ((offset >= cache->offset) &&
-			    ((offset + len) > (cache->offset + cache->size)))) {
-			return CSR1212_EINVAL;
 		}
 	}
 	return CSR1212_ENOENT;
@@ -1227,8 +1241,8 @@
 		return CSR1212_EINVAL;
 
 #if 0
-        /* Apparently there are too many differnt wrong implementations of the
-         * CRC algorithm that verifying them is moot. */
+	/* Apparently there are too many differnt wrong implementations of the
+	 * CRC algorithm that verifying them is moot. */
 	if ((csr1212_crc16(bi->data, bi->crc_length) != bi->crc) &&
 	    (csr1212_msft_crc16(bi->data, bi->crc_length) != bi->crc))
 		return CSR1212_EINVAL;
@@ -1249,10 +1263,9 @@
 	return CSR1212_SUCCESS;
 }
 
-static inline int csr1212_parse_dir_entry(struct csr1212_keyval *dir,
-					  csr1212_quad_t ki,
-					  u_int32_t kv_pos,
-					  struct csr1212_csr_rom_cache *cache)
+static int csr1212_parse_dir_entry(struct csr1212_keyval *dir,
+				   csr1212_quad_t ki,
+				   u_int32_t kv_pos)
 {
 	int ret = CSR1212_SUCCESS;
 	struct csr1212_keyval *k = NULL;
@@ -1291,7 +1304,7 @@
 			goto fail;
 		}
 
-		k = csr1212_find_keyval_offset(cache->layout_head, offset);
+		k = csr1212_find_keyval_offset(dir, offset);
 
 		if (k)
 			break;		/* Found it. */
@@ -1309,11 +1322,10 @@
 		k->valid = 0;	/* Contents not read yet so it's not valid. */
 		k->offset = offset;
 
-		k->prev = cache->layout_tail;
-		k->next = NULL;
-		if (cache->layout_tail)
-			cache->layout_tail->next = k;
-		cache->layout_tail = k;
+		k->prev = dir;
+		k->next = dir->next;
+		dir->next->prev = k;
+		dir->next = k;
 	}
 	ret = csr1212_attach_keyval_to_directory(dir, k);
 
@@ -1325,6 +1337,7 @@
 	return ret;
 }
 
+
 int csr1212_parse_keyval(struct csr1212_keyval *kv,
 			 struct csr1212_csr_rom_cache *cache)
 {
@@ -1338,8 +1351,8 @@
 	kvi_len = CSR1212_BE16_TO_CPU(kvi->length);
 
 #if 0
-        /* Apparently there are too many differnt wrong implementations of the
-         * CRC algorithm that verifying them is moot. */
+	/* Apparently there are too many differnt wrong implementations of the
+	 * CRC algorithm that verifying them is moot. */
 	if ((csr1212_crc16(kvi->data, kvi_len) != kvi->crc) &&
 	    (csr1212_msft_crc16(kvi->data, kvi_len) != kvi->crc)) {
 		ret = CSR1212_EINVAL;
@@ -1353,22 +1366,19 @@
 			csr1212_quad_t ki = kvi->data[i];
 
 			/* Some devices put null entries in their unit
-			 * directories.  If we come across such and entry,
+			 * directories.  If we come across such an entry,
 			 * then skip it. */
 			if (ki == 0x0)
 				continue;
 			ret = csr1212_parse_dir_entry(kv, ki,
 						      (kv->offset +
-						       quads_to_bytes(i + 1)),
-						      cache);
+						       quads_to_bytes(i + 1)));
 		}
 		kv->value.directory.len = kvi_len;
 		break;
 
 	case CSR1212_KV_TYPE_LEAF:
-		if (kv->key.id == CSR1212_KV_ID_EXTENDED_ROM) {
-			kv->value.leaf.data = cache->data;
-		} else {
+		if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM) {
 			kv->value.leaf.data = CSR1212_MALLOC(quads_to_bytes(kvi_len));
 			if (!kv->value.leaf.data)
 			{
@@ -1399,7 +1409,6 @@
 	u_int32_t *cache_ptr;
 	u_int16_t kv_len = 0;
 
-
 	if (!csr || !kv)
 		return CSR1212_EINVAL;
 
@@ -1413,7 +1422,7 @@
 
 	if (!cache) {
 		csr1212_quad_t q;
-		struct csr1212_csr_rom_cache *nc;
+		u_int32_t cache_size;
 
 		/* Only create a new cache for Extended ROM leaves. */
 		if (kv->key.id != CSR1212_KV_ID_EXTENDED_ROM)
@@ -1425,12 +1434,20 @@
 			return CSR1212_EIO;
 		}
 
-		kv->value.leaf.len = quads_to_bytes(CSR1212_BE32_TO_CPU(q)>>16);
+		kv->value.leaf.len = CSR1212_BE32_TO_CPU(q) >> 16;
+
+		cache_size = (quads_to_bytes(kv->value.leaf.len + 1) +
+			      (csr->max_rom - 1)) & ~(csr->max_rom - 1);
 
-		nc = csr1212_rom_cache_malloc(kv->offset, kv->value.leaf.len);
-		cache->next = nc;
-		nc->prev = cache;
-		csr->cache_tail = nc;
+		cache = csr1212_rom_cache_malloc(kv->offset, cache_size);
+		if (!cache)
+			return CSR1212_ENOMEM;
+
+		kv->value.leaf.data = &cache->data[1];
+		csr->cache_tail->next = cache;
+		cache->prev = csr->cache_tail;
+		cache->next = NULL;
+		csr->cache_tail = cache;
 		cache->filled_head =
 			CSR1212_MALLOC(sizeof(struct csr1212_cache_region));
 		if (!cache->filled_head) {
@@ -1443,6 +1460,10 @@
 		cache->filled_head->next = NULL;
 		cache->filled_head->prev = NULL;
 		cache->data[0] = q;
+
+		/* Don't read the entire extended ROM now.  Pieces of it will
+		 * be read when entries inside it are read. */
+		return csr1212_parse_keyval(kv, cache);
 	}
 
 	cache_index = kv->offset - cache->offset;
@@ -1548,6 +1569,7 @@
 int csr1212_parse_csr(struct csr1212_csr *csr)
 {
 	static const int mr_map[] = { 4, 64, 1024, 0 };
+	struct csr1212_dentry *dentry;
 	int ret;
 
 	if (!csr || !csr->ops->bus_read)
@@ -1570,7 +1592,21 @@
 		csr->bus_info_len;
 
 	csr->root_kv->valid = 0;
+	csr->root_kv->next = csr->root_kv;
+	csr->root_kv->prev = csr->root_kv;
 	csr1212_get_keyval(csr, csr->root_kv);
+
+	/* Scan through the Root directory finding all extended ROM regions
+	 * and make cache regions for them */
+	for (dentry = csr->root_kv->value.directory.dentries_head;
+	     dentry; dentry = dentry->next) {
+		if (dentry->kv->key.id == CSR1212_KV_ID_EXTENDED_ROM) {
+			csr1212_get_keyval(csr, dentry->kv);
+
+			if (ret != CSR1212_SUCCESS)
+				return ret;
+		}
+	}
 
 	return CSR1212_SUCCESS;
 }
diff -Nru a/drivers/ieee1394/dma.c b/drivers/ieee1394/dma.c
--- a/drivers/ieee1394/dma.c	2004-04-06 04:34:14 -07:00
+++ b/drivers/ieee1394/dma.c	2005-01-30 22:06:22 -08:00
@@ -127,16 +127,12 @@
 		dma->dev = NULL;
 	}
 
-	if (dma->sglist) {
-		vfree(dma->sglist);
-		dma->sglist = NULL;
-	}
+	vfree(dma->sglist);
+	dma->sglist = NULL;
 
-	if (dma->kvirt) {
-		vfree(dma->kvirt);
-		dma->kvirt = NULL;
-		dma->n_pages = 0;
-	}
+	vfree(dma->kvirt);
+	dma->kvirt = NULL;
+	dma->n_pages = 0;
 }
 
 /* find the scatterlist index and remaining offset corresponding to a
diff -Nru a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
--- a/drivers/ieee1394/dv1394.c	2005-01-20 21:02:12 -08:00
+++ b/drivers/ieee1394/dv1394.c	2005-01-30 21:57:18 -08:00
@@ -1277,7 +1277,7 @@
 	error-prone code in dv1394.
 */
 
-int dv1394_mmap(struct file *file, struct vm_area_struct *vma)
+static int dv1394_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	struct video_card *video = file_to_video_card(file);
 	int retval = -EINVAL;
@@ -2343,6 +2343,8 @@
 			dv1394_un_init(video);
 	} while (video != NULL);
 
+	class_simple_device_remove(MKDEV(
+		IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)));
 	devfs_remove("ieee1394/dv/host%d/NTSC", id);
 	devfs_remove("ieee1394/dv/host%d/PAL", id);
 	devfs_remove("ieee1394/dv/host%d", id);
@@ -2359,6 +2361,9 @@
 
 	ohci = (struct ti_ohci *)host->hostdata;
 
+	class_simple_device_add(hpsb_protocol_class, MKDEV(
+		IEEE1394_MAJOR,	IEEE1394_MINOR_BLOCK_DV1394 * 16 + (id<<2)), 
+		NULL, "dv1394-%d", id);
 	devfs_mk_dir("ieee1394/dv/host%d", id);
 	devfs_mk_dir("ieee1394/dv/host%d/NTSC", id);
 	devfs_mk_dir("ieee1394/dv/host%d/PAL", id);
diff -Nru a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c
--- a/drivers/ieee1394/eth1394.c	2005-01-07 21:44:16 -08:00
+++ b/drivers/ieee1394/eth1394.c	2005-01-31 12:49:38 -08:00
@@ -89,7 +89,7 @@
 #define TRACE() printk(KERN_ERR "%s:%s[%d] ---- TRACE\n", driver_name, __FUNCTION__, __LINE__)
 
 static char version[] __devinitdata =
-	"$Rev: 1224 $ Ben Collins <bcollins@debian.org>";
+	"$Rev: 1247 $ Ben Collins <bcollins@debian.org>";
 
 struct fragment_info {
 	struct list_head list;
@@ -165,8 +165,7 @@
 /* The max_partial_datagrams parameter is the maximum number of fragmented
  * datagrams per node that eth1394 will keep in memory.  Providing an upper
  * bound allows us to limit the amount of memory that partial datagrams
- * consume in the event that some partial datagrams are never completed.  This
- * should probably change to a sysctl item or the like if possible.
+ * consume in the event that some partial datagrams are never completed.
  */
 static int max_partial_datagrams = 25;
 module_param(max_partial_datagrams, int, S_IRUGO | S_IWUSR);
@@ -186,7 +185,7 @@
 					  unsigned char * haddr);
 static int ether1394_mac_addr(struct net_device *dev, void *p);
 
-static inline void purge_partial_datagram(struct list_head *old);
+static void purge_partial_datagram(struct list_head *old);
 static int ether1394_tx(struct sk_buff *skb, struct net_device *dev);
 static void ether1394_iso(struct hpsb_iso *iso);
 
@@ -289,7 +288,7 @@
 	return 0;
 }
 
-static inline void purge_partial_datagram(struct list_head *old)
+static void purge_partial_datagram(struct list_head *old)
 {
 	struct partial_datagram *pd = list_entry(old, struct partial_datagram, list);
 	struct list_head *lh, *n;
@@ -449,7 +448,7 @@
 		if (!node_info) {
 			kfree(node);
 			return -ENOMEM;
-                }
+		}
 
 		spin_lock_init(&node_info->pdg.lock);
 		INIT_LIST_HEAD(&node_info->pdg.list);
@@ -1187,7 +1186,7 @@
 		lh = find_partial_datagram(pdgl, dgl);
 
 		if (lh == NULL) {
-			if (pdg->sz == max_partial_datagrams) {
+			while (pdg->sz >= max_partial_datagrams) {
 				/* remove the oldest */
 				purge_partial_datagram(pdgl->prev);
 				pdg->sz--;
@@ -1583,7 +1582,7 @@
 	struct sk_buff *skb = ptask->skb;
 	struct net_device *dev = skb->dev;
 	struct eth1394_priv *priv = netdev_priv(dev);
-        unsigned long flags;
+	unsigned long flags;
 
 	/* Statistics */
 	spin_lock_irqsave(&priv->lock, flags);
@@ -1771,7 +1770,7 @@
 static void ether1394_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
 	strcpy (info->driver, driver_name);
-	strcpy (info->version, "$Rev: 1224 $");
+	strcpy (info->version, "$Rev: 1247 $");
 	/* FIXME XXX provide sane businfo */
 	strcpy (info->bus_info, "ieee1394");
 }
diff -Nru a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c
--- a/drivers/ieee1394/highlevel.c	2005-01-20 21:02:12 -08:00
+++ b/drivers/ieee1394/highlevel.c	2005-01-31 12:50:32 -08:00
@@ -173,18 +173,6 @@
 }
 
 
-unsigned long hpsb_get_hostinfo_key(struct hpsb_highlevel *hl, struct hpsb_host *host)
-{
-	struct hl_host_info *hi;
-
-	hi = hl_get_hostinfo(hl, host);
-	if (hi)
-		return hi->key;
-
-	return 0;
-}
-
-
 void *hpsb_get_hostinfo_bykey(struct hpsb_highlevel *hl, unsigned long key)
 {
 	struct hl_host_info *hi;
@@ -206,26 +194,6 @@
 }
 
 
-struct hpsb_host *hpsb_get_host_bykey(struct hpsb_highlevel *hl, unsigned long key)
-{
-	struct hl_host_info *hi;
-	struct hpsb_host *host = NULL;
-
-	if (!hl)
-		return NULL;
-
-	read_lock(&hl->host_info_lock);
-	list_for_each_entry(hi, &hl->host_info_list, list) {
-		if (hi->key == key) {
-			host = hi->host;
-			break;
-		}
-	}
-	read_unlock(&hl->host_info_lock);
-
-	return host;
-}
-
 static int highlevel_for_each_host_reg(struct hpsb_host *host, void *__data)
 {
 	struct hpsb_highlevel *hl = __data;
@@ -416,7 +384,7 @@
         }
 
         as = (struct hpsb_address_serve *)
-                kmalloc(sizeof(struct hpsb_address_serve), GFP_KERNEL);
+                kmalloc(sizeof(struct hpsb_address_serve), GFP_ATOMIC);
         if (as == NULL) {
                 return 0;
         }
diff -Nru a/drivers/ieee1394/ieee1394.h b/drivers/ieee1394/ieee1394.h
--- a/drivers/ieee1394/ieee1394.h	2004-04-06 04:34:14 -07:00
+++ b/drivers/ieee1394/ieee1394.h	2005-01-30 22:14:29 -08:00
@@ -77,6 +77,30 @@
 #define SELFID_PORT_NONE         0x0
 
 
+/* 1394a PHY bitmasks */
+#define PHY_00_PHYSICAL_ID       0xFC
+#define PHY_00_R                 0x02 /* Root */
+#define PHY_00_PS                0x01 /* Power Status*/
+#define PHY_01_RHB               0x80 /* Root Hold-Off */
+#define PHY_01_IBR               0x80 /* Initiate Bus Reset */
+#define PHY_01_GAP_COUNT         0x3F
+#define PHY_02_EXTENDED          0xE0 /* 0x7 for 1394a-compliant PHY */
+#define PHY_02_TOTAL_PORTS       0x1F
+#define PHY_03_MAX_SPEED         0xE0
+#define PHY_03_DELAY             0x0F
+#define PHY_04_LCTRL             0x80 /* Link Active Report Control */
+#define PHY_04_CONTENDER         0x40
+#define PHY_04_JITTER            0x38
+#define PHY_04_PWR_CLASS         0x07 /* Power Class */
+#define PHY_05_WATCHDOG          0x80
+#define PHY_05_ISBR              0x40 /* Initiate Short Bus Reset */
+#define PHY_05_LOOP              0x20 /* Loop Detect */
+#define PHY_05_PWR_FAIL          0x10 /* Cable Power Failure Detect */
+#define PHY_05_TIMEOUT           0x08 /* Arbitration State Machine Timeout */
+#define PHY_05_PORT_EVENT        0x04 /* Port Event Detect */
+#define PHY_05_ENAB_ACCEL        0x02 /* Enable Arbitration Acceleration */
+#define PHY_05_ENAB_MULTI        0x01 /* Ena. Multispeed Packet Concatenation */
+
 #include <asm/byteorder.h>
 
 #ifdef __BIG_ENDIAN_BITFIELD
diff -Nru a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
--- a/drivers/ieee1394/ieee1394_core.c	2004-06-13 07:15:05 -07:00
+++ b/drivers/ieee1394/ieee1394_core.c	2005-01-30 22:14:29 -08:00
@@ -56,11 +56,18 @@
 module_param(disable_nodemgr, int, 0444);
 MODULE_PARM_DESC(disable_nodemgr, "Disable nodemgr functionality.");
 
+/* Disable Isochronous Resource Manager functionality */
+int hpsb_disable_irm = 0;
+module_param_named(disable_irm, hpsb_disable_irm, bool, 0);
+MODULE_PARM_DESC(disable_irm,
+		 "Disable Isochronous Resource Manager functionality.");
+
 /* We are GPL, so treat us special */
 MODULE_LICENSE("GPL");
 
 /* Some globals used */
 const char *hpsb_speedto_str[] = { "S100", "S200", "S400", "S800", "S1600", "S3200" };
+struct class_simple *hpsb_protocol_class;
 
 #ifdef CONFIG_IEEE1394_VERBOSEDEBUG
 static void dump_packet(const char *text, quadlet_t *data, int size)
@@ -79,6 +86,7 @@
 #define dump_packet(x,y,z)
 #endif
 
+static void abort_requests(struct hpsb_host *host);
 static void queue_packet_complete(struct hpsb_packet *packet);
 
 
@@ -512,6 +520,7 @@
 
 	if (!packet->no_waiter || packet->expect_response) {
 		atomic_inc(&packet->refcnt);
+		packet->sendtime = jiffies;
 		skb_queue_tail(&host->pending_packet_queue, packet->skb);
 	}
 
@@ -939,7 +948,7 @@
 }
 
 
-void abort_requests(struct hpsb_host *host)
+static void abort_requests(struct hpsb_host *host)
 {
 	struct hpsb_packet *packet;
 	struct sk_buff *skb;
@@ -1002,7 +1011,7 @@
  * the stack. */
 static int khpsbpkt_pid = -1, khpsbpkt_kill;
 static DECLARE_COMPLETION(khpsbpkt_complete);
-struct sk_buff_head hpsbpkt_queue;
+static struct sk_buff_head hpsbpkt_queue;
 static DECLARE_MUTEX_LOCKED(khpsbpkt_sig);
 
 
@@ -1030,15 +1039,19 @@
 
 	daemonize("khpsbpkt");
 
-	while (!down_interruptible(&khpsbpkt_sig)) {
-		if (khpsbpkt_kill)
+	while (1) {
+		if (down_interruptible(&khpsbpkt_sig)) {
+			if (current->flags & PF_FREEZE) {
+				refrigerator(0);
+				continue;
+			}
+			printk("khpsbpkt: received unexpected signal?!\n" );
 			break;
-
-		if (current->flags & PF_FREEZE) {
-			refrigerator(0);
-			continue;
 		}
 
+		if (khpsbpkt_kill)
+			break;
+
 		while ((skb = skb_dequeue(&hpsbpkt_queue)) != NULL) {
 			packet = (struct hpsb_packet *)skb->data;
 
@@ -1054,7 +1067,6 @@
 	complete_and_exit(&khpsbpkt_complete, 0);
 }
 
-
 static int __init ieee1394_init(void)
 {
 	int i, ret;
@@ -1109,18 +1121,33 @@
 	if (ret < 0)
 		goto release_all_bus;
 
+	hpsb_protocol_class = class_simple_create(THIS_MODULE, "ieee1394_protocol");
+	if (IS_ERR(hpsb_protocol_class)) {
+		ret = PTR_ERR(hpsb_protocol_class);
+		goto release_class_host;
+	}
+
 	ret = init_csr();
 	if (ret) {
 		HPSB_INFO("init csr failed");
 		ret = -ENOMEM;
-		goto release_class;
+		goto release_class_protocol;
 	}
 
 	if (disable_nodemgr) {
-		HPSB_INFO("nodemgr functionality disabled");
+		HPSB_INFO("nodemgr and IRM functionality disabled");
+		/* We shouldn't contend for IRM with nodemgr disabled, since
+		   nodemgr implements functionality required of ieee1394a-2000
+		   IRMs */
+		hpsb_disable_irm = 1;
+                      
 		return 0;
 	}
 
+	if (hpsb_disable_irm) {
+		HPSB_INFO("IRM functionality disabled");
+	}
+
 	ret = init_ieee1394_nodemgr();
 	if (ret < 0) {
 		HPSB_INFO("init nodemgr failed");
@@ -1131,7 +1158,9 @@
 
 cleanup_csr:
 	cleanup_csr();
-release_class:
+release_class_protocol:
+	class_simple_destroy(hpsb_protocol_class);
+release_class_host:
 	class_unregister(&hpsb_host_class);
 release_all_bus:
 	for (i = 0; fw_bus_attrs[i]; i++)
@@ -1160,6 +1189,7 @@
 
 	cleanup_csr();
 
+	class_simple_destroy(hpsb_protocol_class);
 	class_unregister(&hpsb_host_class);
 	for (i = 0; fw_bus_attrs[i]; i++)
 		bus_remove_file(&ieee1394_bus_type, fw_bus_attrs[i]);
@@ -1191,6 +1221,7 @@
 
 /** ieee1394_core.c **/
 EXPORT_SYMBOL(hpsb_speedto_str);
+EXPORT_SYMBOL(hpsb_protocol_class);
 EXPORT_SYMBOL(hpsb_set_packet_complete_task);
 EXPORT_SYMBOL(hpsb_alloc_packet);
 EXPORT_SYMBOL(hpsb_free_packet);
@@ -1203,6 +1234,7 @@
 EXPORT_SYMBOL(hpsb_selfid_complete);
 EXPORT_SYMBOL(hpsb_packet_sent);
 EXPORT_SYMBOL(hpsb_packet_received);
+EXPORT_SYMBOL_GPL(hpsb_disable_irm);
 
 /** ieee1394_transactions.c **/
 EXPORT_SYMBOL(hpsb_get_tlabel);
@@ -1217,8 +1249,6 @@
 EXPORT_SYMBOL(hpsb_read);
 EXPORT_SYMBOL(hpsb_write);
 EXPORT_SYMBOL(hpsb_lock);
-EXPORT_SYMBOL(hpsb_lock64);
-EXPORT_SYMBOL(hpsb_send_gasp);
 EXPORT_SYMBOL(hpsb_packet_success);
 
 /** highlevel.c **/
@@ -1230,28 +1260,18 @@
 EXPORT_SYMBOL(hpsb_listen_channel);
 EXPORT_SYMBOL(hpsb_unlisten_channel);
 EXPORT_SYMBOL(hpsb_get_hostinfo);
-EXPORT_SYMBOL(hpsb_get_host_bykey);
 EXPORT_SYMBOL(hpsb_create_hostinfo);
 EXPORT_SYMBOL(hpsb_destroy_hostinfo);
 EXPORT_SYMBOL(hpsb_set_hostinfo_key);
-EXPORT_SYMBOL(hpsb_get_hostinfo_key);
 EXPORT_SYMBOL(hpsb_get_hostinfo_bykey);
 EXPORT_SYMBOL(hpsb_set_hostinfo);
-EXPORT_SYMBOL(highlevel_read);
-EXPORT_SYMBOL(highlevel_write);
-EXPORT_SYMBOL(highlevel_lock);
-EXPORT_SYMBOL(highlevel_lock64);
 EXPORT_SYMBOL(highlevel_add_host);
 EXPORT_SYMBOL(highlevel_remove_host);
 EXPORT_SYMBOL(highlevel_host_reset);
 
 /** nodemgr.c **/
-EXPORT_SYMBOL(hpsb_guid_get_entry);
-EXPORT_SYMBOL(hpsb_nodeid_get_entry);
 EXPORT_SYMBOL(hpsb_node_fill_packet);
-EXPORT_SYMBOL(hpsb_node_read);
 EXPORT_SYMBOL(hpsb_node_write);
-EXPORT_SYMBOL(hpsb_node_lock);
 EXPORT_SYMBOL(hpsb_register_protocol);
 EXPORT_SYMBOL(hpsb_unregister_protocol);
 EXPORT_SYMBOL(ieee1394_bus_type);
@@ -1295,27 +1315,14 @@
 EXPORT_SYMBOL(csr1212_create_csr);
 EXPORT_SYMBOL(csr1212_init_local_csr);
 EXPORT_SYMBOL(csr1212_new_immediate);
-EXPORT_SYMBOL(csr1212_new_leaf);
-EXPORT_SYMBOL(csr1212_new_csr_offset);
 EXPORT_SYMBOL(csr1212_new_directory);
 EXPORT_SYMBOL(csr1212_associate_keyval);
 EXPORT_SYMBOL(csr1212_attach_keyval_to_directory);
-EXPORT_SYMBOL(csr1212_new_extended_immediate);
-EXPORT_SYMBOL(csr1212_new_extended_leaf);
-EXPORT_SYMBOL(csr1212_new_descriptor_leaf);
-EXPORT_SYMBOL(csr1212_new_textual_descriptor_leaf);
 EXPORT_SYMBOL(csr1212_new_string_descriptor_leaf);
-EXPORT_SYMBOL(csr1212_new_icon_descriptor_leaf);
-EXPORT_SYMBOL(csr1212_new_modifiable_descriptor_leaf);
-EXPORT_SYMBOL(csr1212_new_keyword_leaf);
 EXPORT_SYMBOL(csr1212_detach_keyval_from_directory);
-EXPORT_SYMBOL(csr1212_disassociate_keyval);
 EXPORT_SYMBOL(csr1212_release_keyval);
 EXPORT_SYMBOL(csr1212_destroy_csr);
 EXPORT_SYMBOL(csr1212_read);
-EXPORT_SYMBOL(csr1212_generate_positions);
-EXPORT_SYMBOL(csr1212_generate_layout_order);
-EXPORT_SYMBOL(csr1212_fill_cache);
 EXPORT_SYMBOL(csr1212_generate_csr_image);
 EXPORT_SYMBOL(csr1212_parse_keyval);
 EXPORT_SYMBOL(csr1212_parse_csr);
diff -Nru a/drivers/ieee1394/ieee1394_core.h b/drivers/ieee1394/ieee1394_core.h
--- a/drivers/ieee1394/ieee1394_core.h	2004-05-28 07:17:32 -07:00
+++ b/drivers/ieee1394/ieee1394_core.h	2005-01-30 22:14:29 -08:00
@@ -89,7 +89,6 @@
 }
 
 void abort_timedouts(unsigned long __opaque);
-void abort_requests(struct hpsb_host *host);
 
 struct hpsb_packet *hpsb_alloc_packet(size_t data_size);
 void hpsb_free_packet(struct hpsb_packet *packet);
@@ -219,9 +218,11 @@
 	return file->f_dentry->d_inode->i_cindex;
 }
 
+extern int hpsb_disable_irm;
 
 /* Our sysfs bus entry */
 extern struct bus_type ieee1394_bus_type;
 extern struct class hpsb_host_class;
+extern struct class_simple *hpsb_protocol_class;
 
 #endif /* _IEEE1394_CORE_H */
diff -Nru a/drivers/ieee1394/ieee1394_transactions.c b/drivers/ieee1394/ieee1394_transactions.c
--- a/drivers/ieee1394/ieee1394_transactions.c	2004-04-06 04:34:14 -07:00
+++ b/drivers/ieee1394/ieee1394_transactions.c	2005-01-30 21:33:22 -08:00
@@ -566,34 +566,6 @@
         return retval;
 }
 
-int hpsb_lock64(struct hpsb_host *host, nodeid_t node, unsigned int generation,
-		u64 addr, int extcode, octlet_t *data, octlet_t arg)
-{
-	struct hpsb_packet *packet;
-	int retval = 0;
-
-	BUG_ON(in_interrupt()); // We can't be called in an interrupt, yet
-
-	packet = hpsb_make_lock64packet(host, node, addr, extcode, data, arg);
-	if (!packet)
-		return -ENOMEM;
-
-	packet->generation = generation;
-	retval = hpsb_send_packet_and_wait(packet);
-	if (retval < 0)
-		goto hpsb_lock64_fail;
-
-	retval = hpsb_packet_success(packet);
-
-	if (retval == 0)
-		*data = (u64)packet->data[1] << 32 | packet->data[0];
-
-hpsb_lock64_fail:
-	hpsb_free_tlabel(packet);
-	hpsb_free_packet(packet);
-
-        return retval;
-}
 
 int hpsb_send_gasp(struct hpsb_host *host, int channel, unsigned int generation,
 		   quadlet_t *buffer, size_t length, u32 specifier_id,
diff -Nru a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
--- a/drivers/ieee1394/nodemgr.c	2005-01-15 14:01:54 -08:00
+++ b/drivers/ieee1394/nodemgr.c	2005-01-30 22:15:47 -08:00
@@ -23,6 +23,7 @@
 
 #include "ieee1394_types.h"
 #include "ieee1394.h"
+#include "ieee1394_core.h"
 #include "hosts.h"
 #include "ieee1394_transactions.h"
 #include "highlevel.h"
@@ -146,7 +147,7 @@
 	put_device(&container_of((class_dev), struct node_entry, class_dev)->device);
 }
 
-struct class nodemgr_ne_class = {
+static struct class nodemgr_ne_class = {
 	.name		= "ieee1394_node",
 	.release	= ne_cls_release,
 };
@@ -158,7 +159,7 @@
 
 /* The name here is only so that unit directory hotplug works with old
  * style hotplug, which only ever did unit directories anyway. */
-struct class nodemgr_ud_class = {
+static struct class nodemgr_ud_class = {
 	.name		= "ieee1394",
 	.release	= ud_cls_release,
 	.hotplug	= nodemgr_hotplug,
@@ -831,6 +832,31 @@
 }
 
 
+static void nodemgr_register_device(struct node_entry *ne, 
+	struct unit_directory *ud, struct device *parent)
+{
+	memcpy(&ud->device, &nodemgr_dev_template_ud,
+	       sizeof(ud->device));
+
+	ud->device.parent = parent;
+
+	snprintf(ud->device.bus_id, BUS_ID_SIZE, "%s-%u",
+		 ne->device.bus_id, ud->id);
+
+	ud->class_dev.dev = &ud->device;
+	ud->class_dev.class = &nodemgr_ud_class;
+	snprintf(ud->class_dev.class_id, BUS_ID_SIZE, "%s-%u",
+		 ne->device.bus_id, ud->id);
+
+	device_register(&ud->device);
+	class_device_register(&ud->class_dev);
+	get_device(&ud->device);
+
+	if (ud->vendor_oui)
+		device_create_file(&ud->device, &dev_attr_ud_vendor_oui);
+	nodemgr_create_ud_dev_files(ud);
+}	
+
 
 /* This implementation currently only scans the config rom and its
  * immediate unit directories looking for software_id and
@@ -840,7 +866,7 @@
 	 unsigned int *id, struct unit_directory *parent)
 {
 	struct unit_directory *ud;
-	struct unit_directory *ud_temp = NULL;
+	struct unit_directory *ud_child = NULL;
 	struct csr1212_dentry *dentry;
 	struct csr1212_keyval *kv;
 	u8 last_key_id = 0;
@@ -907,42 +933,61 @@
 			break;
 
 		case CSR1212_KV_ID_DEPENDENT_INFO:
-			if (kv->key.type == CSR1212_KV_TYPE_DIRECTORY) {
+			/* Logical Unit Number */
+			if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) {
+				if (ud->flags & UNIT_DIRECTORY_HAS_LUN) {
+					ud_child = kmalloc(sizeof(struct unit_directory), GFP_KERNEL);
+					if (!ud_child)
+						goto unit_directory_error;
+					memcpy(ud_child, ud, sizeof(struct unit_directory));
+					nodemgr_register_device(ne, ud_child, &ne->device);
+					ud_child = NULL;
+					
+					ud->id = (*id)++;
+				}
+				ud->lun = kv->value.immediate;
+				ud->flags |= UNIT_DIRECTORY_HAS_LUN;
+
+			/* Logical Unit Directory */
+			} else if (kv->key.type == CSR1212_KV_TYPE_DIRECTORY) {
 				/* This should really be done in SBP2 as this is
-				 * doing SBP2 specific parsing. */
+				 * doing SBP2 specific parsing.
+				 */
+				
+				/* first register the parent unit */
 				ud->flags |= UNIT_DIRECTORY_HAS_LUN_DIRECTORY;
-				ud_temp = nodemgr_process_unit_directory(hi, ne, kv, id,
-									 parent);
+				if (ud->device.bus != &ieee1394_bus_type)
+					nodemgr_register_device(ne, ud, &ne->device);
+				
+				/* process the child unit */
+				ud_child = nodemgr_process_unit_directory(hi, ne, kv, id, ud);
 
-				if (ud_temp == NULL)
+				if (ud_child == NULL)
 					break;
-
-				/* inherit unspecified values */
-				if ((ud->flags & UNIT_DIRECTORY_VENDOR_ID) &&
-				    !(ud_temp->flags & UNIT_DIRECTORY_VENDOR_ID))
-				{
-					ud_temp->flags |=  UNIT_DIRECTORY_VENDOR_ID;
-					ud_temp->vendor_id = ud->vendor_id;
-					ud_temp->vendor_oui = ud->vendor_oui;
-				}
+				
+				/* inherit unspecified values so hotplug picks it up */
 				if ((ud->flags & UNIT_DIRECTORY_MODEL_ID) &&
-				    !(ud_temp->flags & UNIT_DIRECTORY_MODEL_ID))
+				    !(ud_child->flags & UNIT_DIRECTORY_MODEL_ID))
 				{
-					ud_temp->flags |=  UNIT_DIRECTORY_MODEL_ID;
-					ud_temp->model_id = ud->model_id;
+					ud_child->flags |=  UNIT_DIRECTORY_MODEL_ID;
+					ud_child->model_id = ud->model_id;
 				}
 				if ((ud->flags & UNIT_DIRECTORY_SPECIFIER_ID) &&
-				    !(ud_temp->flags & UNIT_DIRECTORY_SPECIFIER_ID))
+				    !(ud_child->flags & UNIT_DIRECTORY_SPECIFIER_ID))
 				{
-					ud_temp->flags |=  UNIT_DIRECTORY_SPECIFIER_ID;
-					ud_temp->specifier_id = ud->specifier_id;
+					ud_child->flags |=  UNIT_DIRECTORY_SPECIFIER_ID;
+					ud_child->specifier_id = ud->specifier_id;
 				}
 				if ((ud->flags & UNIT_DIRECTORY_VERSION) &&
-				    !(ud_temp->flags & UNIT_DIRECTORY_VERSION))
+				    !(ud_child->flags & UNIT_DIRECTORY_VERSION))
 				{
-					ud_temp->flags |=  UNIT_DIRECTORY_VERSION;
-					ud_temp->version = ud->version;
+					ud_child->flags |=  UNIT_DIRECTORY_VERSION;
+					ud_child->version = ud->version;
 				}
+				
+				/* register the child unit */
+				ud_child->flags |= UNIT_DIRECTORY_LUN_DIRECTORY;
+				nodemgr_register_device(ne, ud_child, &ud->device);
 			}
 
 			break;
@@ -952,31 +997,10 @@
 		}
 		last_key_id = kv->key.id;
 	}
-
-	memcpy(&ud->device, &nodemgr_dev_template_ud,
-	       sizeof(ud->device));
-
-	if (parent) {
-		ud->flags |= UNIT_DIRECTORY_LUN_DIRECTORY;
-		ud->device.parent = &parent->device;
-	} else
-		ud->device.parent = &ne->device;
-
-	snprintf(ud->device.bus_id, BUS_ID_SIZE, "%s-%u",
-		 ne->device.bus_id, ud->id);
-
-	ud->class_dev.dev = &ud->device;
-	ud->class_dev.class = &nodemgr_ud_class;
-	snprintf(ud->class_dev.class_id, BUS_ID_SIZE, "%s-%u",
-		 ne->device.bus_id, ud->id);
-
-	device_register(&ud->device);
-	class_device_register(&ud->class_dev);
-	get_device(&ud->device);
-
-	if (ud->vendor_oui)
-		device_create_file(&ud->device, &dev_attr_ud_vendor_oui);
-	nodemgr_create_ud_dev_files(ud);
+	
+	/* do not process child units here and only if not already registered */
+	if (!parent && ud->device.bus != &ieee1394_bus_type)
+		nodemgr_register_device(ne, ud, &ne->device);
 
 	return ud;
 
@@ -1141,6 +1165,13 @@
 
 		/* Mark the node as new, so it gets re-probed */
 		ne->needs_probe = 1;
+	} else {
+		/* old cache is valid, so update its generation */
+		struct nodemgr_csr_info *ci = ne->csr->private;
+		ci->generation = generation;
+		/* free the partially filled now unneeded new cache */
+		kfree(csr->private);
+		csr1212_destroy_csr(csr);
 	}
 
 	if (ne->in_limbo)
@@ -1431,7 +1462,7 @@
 	quadlet_t bc;
 	int status;
 
-	if (host->is_irm)
+	if (hpsb_disable_irm || host->is_irm)
 		return 1;
 
 	status = hpsb_read(host, LOCAL_BUS | (host->irm_id),
@@ -1553,29 +1584,6 @@
 	complete_and_exit(&hi->exited, 0);
 }
 
-struct node_entry *hpsb_guid_get_entry(u64 guid)
-{
-        struct node_entry *ne;
-
-	down(&nodemgr_serialize);
-        ne = find_entry_by_guid(guid);
-	up(&nodemgr_serialize);
-
-        return ne;
-}
-
-struct node_entry *hpsb_nodeid_get_entry(struct hpsb_host *host, nodeid_t nodeid)
-{
-	struct node_entry *ne;
-
-	down(&nodemgr_serialize);
-	ne = find_entry_by_nodeid(host, nodeid);
-	up(&nodemgr_serialize);
-
-	return ne;
-}
-
-
 int nodemgr_for_each_host(void *__data, int (*cb)(struct hpsb_host *, void *))
 {
 	struct class *class = &hpsb_host_class;
@@ -1618,16 +1626,6 @@
         pkt->node_id = ne->nodeid;
 }
 
-int hpsb_node_read(struct node_entry *ne, u64 addr,
-		   quadlet_t *buffer, size_t length)
-{
-	unsigned int generation = ne->generation;
-
-	barrier();
-	return hpsb_read(ne->host, ne->nodeid, generation,
-			 addr, buffer, length);
-}
-
 int hpsb_node_write(struct node_entry *ne, u64 addr,
 		    quadlet_t *buffer, size_t length)
 {
@@ -1636,16 +1634,6 @@
 	barrier();
 	return hpsb_write(ne->host, ne->nodeid, generation,
 			  addr, buffer, length);
-}
-
-int hpsb_node_lock(struct node_entry *ne, u64 addr,
-		   int extcode, quadlet_t *data, quadlet_t arg)
-{
-	unsigned int generation = ne->generation;
-
-	barrier();
-	return hpsb_lock(ne->host, ne->nodeid, generation,
-			 addr, extcode, data, arg);
 }
 
 static void nodemgr_add_host(struct hpsb_host *host)
diff -Nru a/drivers/ieee1394/nodemgr.h b/drivers/ieee1394/nodemgr.h
--- a/drivers/ieee1394/nodemgr.h	2004-05-28 07:25:47 -07:00
+++ b/drivers/ieee1394/nodemgr.h	2005-01-30 22:09:18 -08:00
@@ -51,6 +51,7 @@
 #define UNIT_DIRECTORY_VERSION			0x08
 #define UNIT_DIRECTORY_HAS_LUN_DIRECTORY	0x10
 #define UNIT_DIRECTORY_LUN_DIRECTORY		0x20
+#define UNIT_DIRECTORY_HAS_LUN			0x40
 
 /*
  * A unit directory corresponds to a protocol supported by the
@@ -82,6 +83,7 @@
 	struct class_device class_dev;
 
 	struct csr1212_keyval *ud_kv;
+	u32 lun;                /* logical unit number immediate value */
 };
 
 struct node_entry {
diff -Nru a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
--- a/drivers/ieee1394/ohci1394.c	2004-12-07 01:01:17 -08:00
+++ b/drivers/ieee1394/ohci1394.c	2005-01-31 12:46:02 -08:00
@@ -162,7 +162,7 @@
 printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args)
 
 static char version[] __devinitdata =
-	"$Rev: 1223 $ Ben Collins <bcollins@debian.org>";
+	"$Rev: 1250 $ Ben Collins <bcollins@debian.org>";
 
 /* Module Parameters */
 static int phys_dma = 1;
@@ -482,7 +482,9 @@
 
 	/* Put some defaults to these undefined bus options */
 	buf = reg_read(ohci, OHCI1394_BusOptions);
-	buf |=  0xE0000000; /* Enable IRMC, CMC and ISC */
+	buf |=  0x60000000; /* Enable CMC and ISC */
+	if (!hpsb_disable_irm)
+		buf |=  0x80000000; /* Enable IRMC */
 	buf &= ~0x00ff0000; /* XXX: Set cyc_clk_acc to zero for now */
 	buf &= ~0x18000000; /* Disable PMC and BMC */
 	reg_write(ohci, OHCI1394_BusOptions, buf);
@@ -497,10 +499,12 @@
 	reg_write(ohci, OHCI1394_LinkControlClear, 0xffffffff);
 
 	/* Enable cycle timer and cycle master and set the IRM
-	 * contender bit in our self ID packets. */
-	reg_write(ohci, OHCI1394_LinkControlSet, OHCI1394_LinkControl_CycleTimerEnable |
+	 * contender bit in our self ID packets if appropriate. */
+	reg_write(ohci, OHCI1394_LinkControlSet,
+		  OHCI1394_LinkControl_CycleTimerEnable |
 		  OHCI1394_LinkControl_CycleMaster);
-	set_phy_reg_mask(ohci, 4, 0xc0);
+	set_phy_reg_mask(ohci, 4, PHY_04_LCTRL |
+			 (hpsb_disable_irm ? 0 : PHY_04_CONTENDER));
 
 	/* Set up self-id dma buffer */
 	reg_write(ohci, OHCI1394_SelfIDBuffer, ohci->selfid_buf_bus);
@@ -515,12 +519,6 @@
 	/* Now get our max packet size */
 	ohci->max_packet_size =
 		1<<(((reg_read(ohci, OHCI1394_BusOptions)>>12)&0xf)+1);
-
-	if (ohci->max_packet_size < 512) {
-		HPSB_ERR("warning: Invalid max packet size of %d, setting to 512",
-			     ohci->max_packet_size);
-		ohci->max_packet_size = 512;
-	}
 		
 	/* Don't accept phy packets into AR request context */
 	reg_write(ohci, OHCI1394_LinkControlClear, 0x00000400);
@@ -2545,6 +2543,10 @@
 	idx = (idx + d->num_desc - 1 ) % d->num_desc;
 	d->prg_cpu[idx]->branchAddress |= le32_to_cpu(0x00000001);
 
+	/* To avoid a race, ensure 1394 interface hardware sees the inserted
+	 * context program descriptors before it sees the wakeup bit set. */
+	wmb();
+	
 	/* wake up the dma context if necessary */
 	if (!(reg_read(ohci, d->ctrlSet) & 0x400)) {
 		PRINT(KERN_INFO,
diff -Nru a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c
--- a/drivers/ieee1394/pcilynx.c	2005-01-07 21:44:10 -08:00
+++ b/drivers/ieee1394/pcilynx.c	2005-02-01 14:03:20 -08:00
@@ -384,7 +384,8 @@
         lsid = 0x80400000 | ((phyreg[0] & 0xfc) << 22);
         lsid |= (phyreg[1] & 0x3f) << 16; /* gap count */
         lsid |= (phyreg[2] & 0xc0) << 8; /* max speed */
-        lsid |= (phyreg[6] & 0x01) << 11; /* contender (phy dependent) */
+	if (!hpsb_disable_irm)
+		lsid |= (phyreg[6] & 0x01) << 11; /* contender (phy dependent) */
         /* lsid |= 1 << 11; *//* set contender (hack) */
         lsid |= (phyreg[6] & 0x10) >> 3; /* initiated reset */
 
@@ -500,7 +501,7 @@
         pcl.async_error_next = PCL_NEXT_INVALID;
         pcl.pcl_status = 0;
         pcl.buffer[0].control = packet->speed_code << 14 | packet->header_size;
-#ifdef __BIG_ENDIAN
+#ifndef __BIG_ENDIAN
         pcl.buffer[0].control |= PCL_BIGENDIAN;
 #endif
         pcl.buffer[0].pointer = d->header_dma;
@@ -1521,10 +1522,6 @@
         int i;
         int error;
 
-        /* needed for i2c communication with serial eeprom */
-        struct i2c_adapter i2c_adapter;
-        struct i2c_algo_bit_data i2c_adapter_data;
-
         error = -ENXIO;
 
         if (pci_set_dma_mask(dev, 0xffffffff))
@@ -1697,7 +1694,7 @@
         pcl.async_error_next = PCL_NEXT_INVALID;
 
         pcl.buffer[0].control = PCL_CMD_RCV | 16;
-#ifdef __BIG_ENDIAN
+#ifndef __BIG_ENDIAN
 	pcl.buffer[0].control |= PCL_BIGENDIAN;
 #endif
 	pcl.buffer[1].control = PCL_LAST_BUFF | 4080;
@@ -1779,26 +1776,40 @@
                   | LINK_CONTROL_TX_ASYNC_EN | LINK_CONTROL_RX_ASYNC_EN
                   | LINK_CONTROL_RESET_TX    | LINK_CONTROL_RESET_RX);
 
-        if (!lynx->phyic.reg_1394a) {
-                /* attempt to enable contender bit -FIXME- would this work
-                 * elsewhere? */
-                reg_set_bits(lynx, GPIO_CTRL_A, 0x1);
-                reg_write(lynx, GPIO_DATA_BASE + 0x3c, 0x1);
-        } else {
-                /* set the contender and LCtrl bit in the extended PHY register
-                 * set. (Should check that bis 0,1,2 (=0xE0) is set
-                 * in register 2?)
-                 */
-                i = get_phy_reg(lynx, 4);
-                if (i != -1) set_phy_reg(lynx, 4, i | 0xc0);
-        }
-
-
+	if (!lynx->phyic.reg_1394a) {
+		if (!hpsb_disable_irm) {
+			/* attempt to enable contender bit -FIXME- would this
+			 * work elsewhere? */
+			reg_set_bits(lynx, GPIO_CTRL_A, 0x1);
+			reg_write(lynx, GPIO_DATA_BASE + 0x3c, 0x1);
+		}
+	} else {
+		/* set the contender (if appropriate) and LCtrl bit in the
+		 * extended PHY register set. (Should check that PHY_02_EXTENDED
+		 * is set in register 2?)
+		 */
+		i = get_phy_reg(lynx, 4);
+		i |= PHY_04_LCTRL;
+		if (hpsb_disable_irm)
+			i &= !PHY_04_CONTENDER;
+		else
+			i |= PHY_04_CONTENDER;
+		if (i != -1) set_phy_reg(lynx, 4, i);
+	}
+	
         if (!skip_eeprom)
         {
-                i2c_adapter = bit_ops;
+        	/* needed for i2c communication with serial eeprom */
+        	struct i2c_adapter *i2c_ad;
+        	struct i2c_algo_bit_data i2c_adapter_data;
+
+        	error = -ENOMEM;
+		i2c_ad = kmalloc(sizeof(struct i2c_adapter), SLAB_KERNEL);
+        	if (!i2c_ad) FAIL("failed to allocate I2C adapter memory");
+
+		memcpy(i2c_ad, &bit_ops, sizeof(struct i2c_adapter));
                 i2c_adapter_data = bit_data;
-                i2c_adapter.algo_data = &i2c_adapter_data;
+                i2c_ad->algo_data = &i2c_adapter_data;
                 i2c_adapter_data.data = lynx;
 
 		PRINTD(KERN_DEBUG, lynx->id,"original eeprom control: %d",
@@ -1808,8 +1819,9 @@
         	lynx->i2c_driven_state = 0x00000070;
         	reg_write(lynx, SERIAL_EEPROM_CONTROL, lynx->i2c_driven_state);
 
-        	if (i2c_bit_add_bus(&i2c_adapter) < 0)
+        	if (i2c_bit_add_bus(i2c_ad) < 0)
         	{
+			kfree(i2c_ad);
 			error = -ENXIO;
 			FAIL("unable to register i2c");
         	}
@@ -1825,13 +1837,13 @@
 #ifdef CONFIG_IEEE1394_VERBOSEDEBUG
                         union i2c_smbus_data data;
 
-                        if (i2c_smbus_xfer(&i2c_adapter, 80, 0, I2C_SMBUS_WRITE, 0, I2C_SMBUS_BYTE,NULL))
+                        if (i2c_smbus_xfer(i2c_ad, 80, 0, I2C_SMBUS_WRITE, 0, I2C_SMBUS_BYTE,NULL))
                                 PRINT(KERN_ERR, lynx->id,"eeprom read start has failed");
                         else
                         {
                                 u16 addr;
                                 for (addr=0x00; addr < 0x100; addr++) {
-                                        if (i2c_smbus_xfer(&i2c_adapter, 80, 0, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE,& data)) {
+                                        if (i2c_smbus_xfer(i2c_ad, 80, 0, I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE,& data)) {
                                                 PRINT(KERN_ERR, lynx->id, "unable to read i2c %x", addr);
                                                 break;
                                         }
@@ -1843,7 +1855,7 @@
 
                         /* we use i2c_transfer, because i2c_smbus_read_block_data does not work properly and we
                            do it more efficiently in one transaction rather then using several reads */
-                        if (i2c_transfer(&i2c_adapter, msg, 2) < 0) {
+                        if (i2c_transfer(i2c_ad, msg, 2) < 0) {
                                 PRINT(KERN_ERR, lynx->id, "unable to read bus info block from i2c");
                         } else {
                                 int i;
@@ -1863,13 +1875,15 @@
                                 {
                                         PRINT(KERN_DEBUG, lynx->id, "read a valid bus info block from");
                                 } else {
+					kfree(i2c_ad);
 					error = -ENXIO;
 					FAIL("read something from serial eeprom, but it does not seem to be a valid bus info block");
                                 }
 
                         }
 
-                        i2c_bit_del_bus(&i2c_adapter);
+                        i2c_bit_del_bus(i2c_ad);
+			kfree(i2c_ad);
                 }
         }
 
diff -Nru a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
--- a/drivers/ieee1394/raw1394.c	2005-01-20 21:02:12 -08:00
+++ b/drivers/ieee1394/raw1394.c	2005-01-30 21:59:32 -08:00
@@ -75,58 +75,60 @@
 static atomic_t internal_generation = ATOMIC_INIT(0);
 
 static atomic_t iso_buffer_size;
-static const int iso_buffer_max = 4 * 1024 * 1024; /* 4 MB */
+static const int iso_buffer_max = 4 * 1024 * 1024;	/* 4 MB */
 
 static struct hpsb_highlevel raw1394_highlevel;
 
-static int arm_read (struct hpsb_host *host, int nodeid, quadlet_t *buffer,
-		     u64 addr, size_t length, u16 flags);
-static int arm_write (struct hpsb_host *host, int nodeid, int destid,
-		      quadlet_t *data, u64 addr, size_t length, u16 flags);
-static int arm_lock (struct hpsb_host *host, int nodeid, quadlet_t *store,
-             u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags);
-static int arm_lock64 (struct hpsb_host *host, int nodeid, octlet_t *store,
-               u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags);
+static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer,
+		    u64 addr, size_t length, u16 flags);
+static int arm_write(struct hpsb_host *host, int nodeid, int destid,
+		     quadlet_t * data, u64 addr, size_t length, u16 flags);
+static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store,
+		    u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode,
+		    u16 flags);
+static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store,
+		      u64 addr, octlet_t data, octlet_t arg, int ext_tcode,
+		      u16 flags);
 static struct hpsb_address_ops arm_ops = {
-	.read	= arm_read,
-	.write	= arm_write,
-	.lock	= arm_lock,
-	.lock64	= arm_lock64,
+	.read = arm_read,
+	.write = arm_write,
+	.lock = arm_lock,
+	.lock64 = arm_lock64,
 };
 
 static void queue_complete_cb(struct pending_request *req);
 
 static struct pending_request *__alloc_pending_request(int flags)
 {
-        struct pending_request *req;
+	struct pending_request *req;
 
-        req = (struct pending_request *)kmalloc(sizeof(struct pending_request),
-                                                flags);
-        if (req != NULL) {
-                memset(req, 0, sizeof(struct pending_request));
-                INIT_LIST_HEAD(&req->list);
-        }
+	req = (struct pending_request *)kmalloc(sizeof(struct pending_request),
+						flags);
+	if (req != NULL) {
+		memset(req, 0, sizeof(struct pending_request));
+		INIT_LIST_HEAD(&req->list);
+	}
 
-        return req;
+	return req;
 }
 
 static inline struct pending_request *alloc_pending_request(void)
 {
-        return __alloc_pending_request(SLAB_KERNEL);
+	return __alloc_pending_request(SLAB_KERNEL);
 }
 
 static void free_pending_request(struct pending_request *req)
 {
-        if (req->ibs) {
-                if (atomic_dec_and_test(&req->ibs->refcount)) {
-                        atomic_sub(req->ibs->data_size, &iso_buffer_size);
-                        kfree(req->ibs);
-                }
-        } else if (req->free_data) {
-                kfree(req->data);
-        }
-        hpsb_free_packet(req->packet);
-        kfree(req);
+	if (req->ibs) {
+		if (atomic_dec_and_test(&req->ibs->refcount)) {
+			atomic_sub(req->ibs->data_size, &iso_buffer_size);
+			kfree(req->ibs);
+		}
+	} else if (req->free_data) {
+		kfree(req->data);
+	}
+	hpsb_free_packet(req->packet);
+	kfree(req);
 }
 
 /* fi->reqlists_lock must be taken */
@@ -134,494 +136,505 @@
 {
 	struct file_info *fi = req->file_info;
 	list_del(&req->list);
-        list_add_tail(&req->list, &fi->req_complete);
+	list_add_tail(&req->list, &fi->req_complete);
 
 	up(&fi->complete_sem);
-        wake_up_interruptible(&fi->poll_wait_complete);
+	wake_up_interruptible(&fi->poll_wait_complete);
 }
 
 static void queue_complete_req(struct pending_request *req)
 {
-        unsigned long flags;
-        struct file_info *fi = req->file_info;
+	unsigned long flags;
+	struct file_info *fi = req->file_info;
 
-        spin_lock_irqsave(&fi->reqlists_lock, flags);
+	spin_lock_irqsave(&fi->reqlists_lock, flags);
 	__queue_complete_req(req);
-        spin_unlock_irqrestore(&fi->reqlists_lock, flags);
+	spin_unlock_irqrestore(&fi->reqlists_lock, flags);
 }
 
 static void queue_complete_cb(struct pending_request *req)
 {
-        struct hpsb_packet *packet = req->packet;
-        int rcode = (packet->header[1] >> 12) & 0xf;
+	struct hpsb_packet *packet = req->packet;
+	int rcode = (packet->header[1] >> 12) & 0xf;
 
-        switch (packet->ack_code) {
-        case ACKX_NONE:
-        case ACKX_SEND_ERROR:
-                req->req.error = RAW1394_ERROR_SEND_ERROR;
-                break;
-        case ACKX_ABORTED:
-                req->req.error = RAW1394_ERROR_ABORTED;
-                break;
-        case ACKX_TIMEOUT:
-                req->req.error = RAW1394_ERROR_TIMEOUT;
-                break;
-        default:
-                req->req.error = (packet->ack_code << 16) | rcode;
-                break;
-        }
-
-        if (!((packet->ack_code == ACK_PENDING) && (rcode == RCODE_COMPLETE))) {
-                req->req.length = 0;
-        }
+	switch (packet->ack_code) {
+	case ACKX_NONE:
+	case ACKX_SEND_ERROR:
+		req->req.error = RAW1394_ERROR_SEND_ERROR;
+		break;
+	case ACKX_ABORTED:
+		req->req.error = RAW1394_ERROR_ABORTED;
+		break;
+	case ACKX_TIMEOUT:
+		req->req.error = RAW1394_ERROR_TIMEOUT;
+		break;
+	default:
+		req->req.error = (packet->ack_code << 16) | rcode;
+		break;
+	}
+
+	if (!((packet->ack_code == ACK_PENDING) && (rcode == RCODE_COMPLETE))) {
+		req->req.length = 0;
+	}
 
-        if ((req->req.type == RAW1394_REQ_ASYNC_READ) ||
+	if ((req->req.type == RAW1394_REQ_ASYNC_READ) ||
 	    (req->req.type == RAW1394_REQ_ASYNC_WRITE) ||
 	    (req->req.type == RAW1394_REQ_ASYNC_STREAM) ||
 	    (req->req.type == RAW1394_REQ_LOCK) ||
 	    (req->req.type == RAW1394_REQ_LOCK64))
-                hpsb_free_tlabel(packet);
+		hpsb_free_tlabel(packet);
 
-        queue_complete_req(req);
+	queue_complete_req(req);
 }
 
-
 static void add_host(struct hpsb_host *host)
 {
-        struct host_info *hi;
-        unsigned long flags;
+	struct host_info *hi;
+	unsigned long flags;
 
-        hi = (struct host_info *)kmalloc(sizeof(struct host_info), GFP_KERNEL);
+	hi = (struct host_info *)kmalloc(sizeof(struct host_info), GFP_KERNEL);
 
-        if (hi != NULL) {
-                INIT_LIST_HEAD(&hi->list);
-                hi->host = host;
-                INIT_LIST_HEAD(&hi->file_info_list);
-
-                spin_lock_irqsave(&host_info_lock, flags);
-                list_add_tail(&hi->list, &host_info_list);
-                host_count++;
-                spin_unlock_irqrestore(&host_info_lock, flags);
-        }
+	if (hi != NULL) {
+		INIT_LIST_HEAD(&hi->list);
+		hi->host = host;
+		INIT_LIST_HEAD(&hi->file_info_list);
+
+		spin_lock_irqsave(&host_info_lock, flags);
+		list_add_tail(&hi->list, &host_info_list);
+		host_count++;
+		spin_unlock_irqrestore(&host_info_lock, flags);
+	}
 
-        atomic_inc(&internal_generation);
+	atomic_inc(&internal_generation);
 }
 
-
 static struct host_info *find_host_info(struct hpsb_host *host)
 {
-        struct host_info *hi;
+	struct host_info *hi;
 
-        list_for_each_entry(hi, &host_info_list, list)
-                if (hi->host == host)
-                        return hi;
+	list_for_each_entry(hi, &host_info_list, list)
+	    if (hi->host == host)
+		return hi;
 
-        return NULL;
+	return NULL;
 }
 
 static void remove_host(struct hpsb_host *host)
 {
-        struct host_info *hi;
-        unsigned long flags;
+	struct host_info *hi;
+	unsigned long flags;
+
+	spin_lock_irqsave(&host_info_lock, flags);
+	hi = find_host_info(host);
 
-        spin_lock_irqsave(&host_info_lock, flags);
-        hi = find_host_info(host);
+	if (hi != NULL) {
+		list_del(&hi->list);
+		host_count--;
+		/*
+		   FIXME: address ranges should be removed
+		   and fileinfo states should be initialized
+		   (including setting generation to
+		   internal-generation ...)
+		 */
+	}
+	spin_unlock_irqrestore(&host_info_lock, flags);
 
-        if (hi != NULL) {
-                list_del(&hi->list);
-                host_count--;
-                /*
-                   FIXME: address ranges should be removed
-                   and fileinfo states should be initialized
-                   (including setting generation to
-                   internal-generation ...)
-                */
-        }
-        spin_unlock_irqrestore(&host_info_lock, flags);
-
-        if (hi == NULL) {
-                printk(KERN_ERR "raw1394: attempt to remove unknown host "
-                       "0x%p\n", host);
-                return;
-        }
+	if (hi == NULL) {
+		printk(KERN_ERR "raw1394: attempt to remove unknown host "
+		       "0x%p\n", host);
+		return;
+	}
 
-        kfree(hi);
+	kfree(hi);
 
-        atomic_inc(&internal_generation);
+	atomic_inc(&internal_generation);
 }
 
 static void host_reset(struct hpsb_host *host)
 {
-        unsigned long flags;
-        struct host_info *hi;
-        struct file_info *fi;
-        struct pending_request *req;
-
-        spin_lock_irqsave(&host_info_lock, flags);
-        hi = find_host_info(host);
-
-        if (hi != NULL) {
-                list_for_each_entry(fi, &hi->file_info_list, list) {
-                        if (fi->notification == RAW1394_NOTIFY_ON) {
-                                req = __alloc_pending_request(SLAB_ATOMIC);
-
-                                if (req != NULL) {
-                                        req->file_info = fi;
-                                        req->req.type = RAW1394_REQ_BUS_RESET;
-                                        req->req.generation = get_hpsb_generation(host);
-                                        req->req.misc = (host->node_id << 16)
-                                                | host->node_count;
-                                        if (fi->protocol_version > 3) {
-                                                req->req.misc |= (NODEID_TO_NODE(host->irm_id)
-                                                                  << 8);
-                                        }
-
-                                        queue_complete_req(req);
-                                }
-                        }
-                }
-        }
-        spin_unlock_irqrestore(&host_info_lock, flags);
-}
-
-static void iso_receive(struct hpsb_host *host, int channel, quadlet_t *data,
-                        size_t length)
-{
-        unsigned long flags;
-        struct host_info *hi;
-        struct file_info *fi;
-        struct pending_request *req, *req_next;
-        struct iso_block_store *ibs = NULL;
-        LIST_HEAD(reqs);
-
-        if ((atomic_read(&iso_buffer_size) + length) > iso_buffer_max) {
-                HPSB_INFO("dropped iso packet");
-                return;
-        }
+	unsigned long flags;
+	struct host_info *hi;
+	struct file_info *fi;
+	struct pending_request *req;
+
+	spin_lock_irqsave(&host_info_lock, flags);
+	hi = find_host_info(host);
+
+	if (hi != NULL) {
+		list_for_each_entry(fi, &hi->file_info_list, list) {
+			if (fi->notification == RAW1394_NOTIFY_ON) {
+				req = __alloc_pending_request(SLAB_ATOMIC);
+
+				if (req != NULL) {
+					req->file_info = fi;
+					req->req.type = RAW1394_REQ_BUS_RESET;
+					req->req.generation =
+					    get_hpsb_generation(host);
+					req->req.misc = (host->node_id << 16)
+					    | host->node_count;
+					if (fi->protocol_version > 3) {
+						req->req.misc |=
+						    (NODEID_TO_NODE
+						     (host->irm_id)
+						     << 8);
+					}
+
+					queue_complete_req(req);
+				}
+			}
+		}
+	}
+	spin_unlock_irqrestore(&host_info_lock, flags);
+}
+
+static void iso_receive(struct hpsb_host *host, int channel, quadlet_t * data,
+			size_t length)
+{
+	unsigned long flags;
+	struct host_info *hi;
+	struct file_info *fi;
+	struct pending_request *req, *req_next;
+	struct iso_block_store *ibs = NULL;
+	LIST_HEAD(reqs);
+
+	if ((atomic_read(&iso_buffer_size) + length) > iso_buffer_max) {
+		HPSB_INFO("dropped iso packet");
+		return;
+	}
 
-        spin_lock_irqsave(&host_info_lock, flags);
-        hi = find_host_info(host);
+	spin_lock_irqsave(&host_info_lock, flags);
+	hi = find_host_info(host);
 
-        if (hi != NULL) {
+	if (hi != NULL) {
 		list_for_each_entry(fi, &hi->file_info_list, list) {
-                        if (!(fi->listen_channels & (1ULL << channel)))
-                                continue;
+			if (!(fi->listen_channels & (1ULL << channel)))
+				continue;
+
+			req = __alloc_pending_request(SLAB_ATOMIC);
+			if (!req)
+				break;
+
+			if (!ibs) {
+				ibs = kmalloc(sizeof(struct iso_block_store)
+					      + length, SLAB_ATOMIC);
+				if (!ibs) {
+					kfree(req);
+					break;
+				}
+
+				atomic_add(length, &iso_buffer_size);
+				atomic_set(&ibs->refcount, 0);
+				ibs->data_size = length;
+				memcpy(ibs->data, data, length);
+			}
+
+			atomic_inc(&ibs->refcount);
 
-                        req = __alloc_pending_request(SLAB_ATOMIC);
-                        if (!req) break;
+			req->file_info = fi;
+			req->ibs = ibs;
+			req->data = ibs->data;
+			req->req.type = RAW1394_REQ_ISO_RECEIVE;
+			req->req.generation = get_hpsb_generation(host);
+			req->req.misc = 0;
+			req->req.recvb = ptr2int(fi->iso_buffer);
+			req->req.length = min(length, fi->iso_buffer_length);
 
-                        if (!ibs) {
-                                ibs = kmalloc(sizeof(struct iso_block_store)
-                                              + length, SLAB_ATOMIC);
-                                if (!ibs) {
-                                        kfree(req);
-                                        break;
-                                }
-
-                                atomic_add(length, &iso_buffer_size);
-                                atomic_set(&ibs->refcount, 0);
-                                ibs->data_size = length;
-                                memcpy(ibs->data, data, length);
-                        }
-
-                        atomic_inc(&ibs->refcount);
-
-                        req->file_info = fi;
-                        req->ibs = ibs;
-                        req->data = ibs->data;
-                        req->req.type = RAW1394_REQ_ISO_RECEIVE;
-                        req->req.generation = get_hpsb_generation(host);
-                        req->req.misc = 0;
-                        req->req.recvb = ptr2int(fi->iso_buffer);
-                        req->req.length = min(length, fi->iso_buffer_length);
-
-                        list_add_tail(&req->list, &reqs);
-                }
-        }
-        spin_unlock_irqrestore(&host_info_lock, flags);
+			list_add_tail(&req->list, &reqs);
+		}
+	}
+	spin_unlock_irqrestore(&host_info_lock, flags);
 
 	list_for_each_entry_safe(req, req_next, &reqs, list)
-                queue_complete_req(req);
+	    queue_complete_req(req);
 }
 
 static void fcp_request(struct hpsb_host *host, int nodeid, int direction,
-			int cts, u8 *data, size_t length)
+			int cts, u8 * data, size_t length)
 {
-        unsigned long flags;
-        struct host_info *hi;
-        struct file_info *fi;
-        struct pending_request *req, *req_next;
-        struct iso_block_store *ibs = NULL;
-        LIST_HEAD(reqs);
-
-        if ((atomic_read(&iso_buffer_size) + length) > iso_buffer_max) {
-                HPSB_INFO("dropped fcp request");
-                return;
-        }
+	unsigned long flags;
+	struct host_info *hi;
+	struct file_info *fi;
+	struct pending_request *req, *req_next;
+	struct iso_block_store *ibs = NULL;
+	LIST_HEAD(reqs);
+
+	if ((atomic_read(&iso_buffer_size) + length) > iso_buffer_max) {
+		HPSB_INFO("dropped fcp request");
+		return;
+	}
 
-        spin_lock_irqsave(&host_info_lock, flags);
-        hi = find_host_info(host);
+	spin_lock_irqsave(&host_info_lock, flags);
+	hi = find_host_info(host);
 
-        if (hi != NULL) {
+	if (hi != NULL) {
 		list_for_each_entry(fi, &hi->file_info_list, list) {
-                        if (!fi->fcp_buffer)
-                                continue;
+			if (!fi->fcp_buffer)
+				continue;
 
-                        req = __alloc_pending_request(SLAB_ATOMIC);
-                        if (!req) break;
+			req = __alloc_pending_request(SLAB_ATOMIC);
+			if (!req)
+				break;
+
+			if (!ibs) {
+				ibs = kmalloc(sizeof(struct iso_block_store)
+					      + length, SLAB_ATOMIC);
+				if (!ibs) {
+					kfree(req);
+					break;
+				}
+
+				atomic_add(length, &iso_buffer_size);
+				atomic_set(&ibs->refcount, 0);
+				ibs->data_size = length;
+				memcpy(ibs->data, data, length);
+			}
 
-                        if (!ibs) {
-                                ibs = kmalloc(sizeof(struct iso_block_store)
-                                              + length, SLAB_ATOMIC);
-                                if (!ibs) {
-                                        kfree(req);
-                                        break;
-                                }
-
-                                atomic_add(length, &iso_buffer_size);
-                                atomic_set(&ibs->refcount, 0);
-                                ibs->data_size = length;
-                                memcpy(ibs->data, data, length);
-                        }
-
-                        atomic_inc(&ibs->refcount);
-
-                        req->file_info = fi;
-                        req->ibs = ibs;
-                        req->data = ibs->data;
-                        req->req.type = RAW1394_REQ_FCP_REQUEST;
-                        req->req.generation = get_hpsb_generation(host);
-                        req->req.misc = nodeid | (direction << 16);
-                        req->req.recvb = ptr2int(fi->fcp_buffer);
-                        req->req.length = length;
-
-                        list_add_tail(&req->list, &reqs);
-                }
-        }
-        spin_unlock_irqrestore(&host_info_lock, flags);
+			atomic_inc(&ibs->refcount);
+
+			req->file_info = fi;
+			req->ibs = ibs;
+			req->data = ibs->data;
+			req->req.type = RAW1394_REQ_FCP_REQUEST;
+			req->req.generation = get_hpsb_generation(host);
+			req->req.misc = nodeid | (direction << 16);
+			req->req.recvb = ptr2int(fi->fcp_buffer);
+			req->req.length = length;
+
+			list_add_tail(&req->list, &reqs);
+		}
+	}
+	spin_unlock_irqrestore(&host_info_lock, flags);
 
 	list_for_each_entry_safe(req, req_next, &reqs, list)
-                queue_complete_req(req);
+	    queue_complete_req(req);
 }
 
-
-static ssize_t raw1394_read(struct file *file, char __user *buffer, size_t count,
-                    loff_t *offset_is_ignored)
+static ssize_t raw1394_read(struct file *file, char __user * buffer,
+			    size_t count, loff_t * offset_is_ignored)
 {
-        struct file_info *fi = (struct file_info *)file->private_data;
-        struct list_head *lh;
-        struct pending_request *req;
-
-        if (count != sizeof(struct raw1394_request)) {
-                return -EINVAL;
-        }
-
-        if (!access_ok(VERIFY_WRITE, buffer, count)) {
-                return -EFAULT;
-        }
-
-        if (file->f_flags & O_NONBLOCK) {
-                if (down_trylock(&fi->complete_sem)) {
-                        return -EAGAIN;
-                }
-        } else {
-                if (down_interruptible(&fi->complete_sem)) {
-                        return -ERESTARTSYS;
-                }
-        }
-
-        spin_lock_irq(&fi->reqlists_lock);
-        lh = fi->req_complete.next;
-        list_del(lh);
-        spin_unlock_irq(&fi->reqlists_lock);
-
-        req = list_entry(lh, struct pending_request, list);
-
-        if (req->req.length) {
-                if (copy_to_user(int2ptr(req->req.recvb), req->data,
-                                 req->req.length)) {
-                        req->req.error = RAW1394_ERROR_MEMFAULT;
-                }
-        }
-        __copy_to_user(buffer, &req->req, sizeof(req->req));
+	struct file_info *fi = (struct file_info *)file->private_data;
+	struct list_head *lh;
+	struct pending_request *req;
+	ssize_t ret;
 
-        free_pending_request(req);
-        return sizeof(struct raw1394_request);
-}
+	if (count != sizeof(struct raw1394_request)) {
+		return -EINVAL;
+	}
 
+	if (!access_ok(VERIFY_WRITE, buffer, count)) {
+		return -EFAULT;
+	}
+
+	if (file->f_flags & O_NONBLOCK) {
+		if (down_trylock(&fi->complete_sem)) {
+			return -EAGAIN;
+		}
+	} else {
+		if (down_interruptible(&fi->complete_sem)) {
+			return -ERESTARTSYS;
+		}
+	}
+
+	spin_lock_irq(&fi->reqlists_lock);
+	lh = fi->req_complete.next;
+	list_del(lh);
+	spin_unlock_irq(&fi->reqlists_lock);
+
+	req = list_entry(lh, struct pending_request, list);
+
+	if (req->req.length) {
+		if (copy_to_user(int2ptr(req->req.recvb), req->data,
+				 req->req.length)) {
+			req->req.error = RAW1394_ERROR_MEMFAULT;
+		}
+	}
+	if (copy_to_user(buffer, &req->req, sizeof(req->req))) {
+		ret = -EFAULT;
+		goto out;
+	}
+
+	ret = (ssize_t) sizeof(struct raw1394_request);
+      out:
+	free_pending_request(req);
+	return ret;
+}
 
 static int state_opened(struct file_info *fi, struct pending_request *req)
 {
-        if (req->req.type == RAW1394_REQ_INITIALIZE) {
-                switch (req->req.misc) {
-                case RAW1394_KERNELAPI_VERSION:
-                case 3:
-                        fi->state = initialized;
-                        fi->protocol_version = req->req.misc;
-                        req->req.error = RAW1394_ERROR_NONE;
-                        req->req.generation = atomic_read(&internal_generation);
-                        break;
-
-                default:
-                        req->req.error = RAW1394_ERROR_COMPAT;
-                        req->req.misc = RAW1394_KERNELAPI_VERSION;
-                }
-        } else {
-                req->req.error = RAW1394_ERROR_STATE_ORDER;
-        }
-
-        req->req.length = 0;
-        queue_complete_req(req);
-        return sizeof(struct raw1394_request);
+	if (req->req.type == RAW1394_REQ_INITIALIZE) {
+		switch (req->req.misc) {
+		case RAW1394_KERNELAPI_VERSION:
+		case 3:
+			fi->state = initialized;
+			fi->protocol_version = req->req.misc;
+			req->req.error = RAW1394_ERROR_NONE;
+			req->req.generation = atomic_read(&internal_generation);
+			break;
+
+		default:
+			req->req.error = RAW1394_ERROR_COMPAT;
+			req->req.misc = RAW1394_KERNELAPI_VERSION;
+		}
+	} else {
+		req->req.error = RAW1394_ERROR_STATE_ORDER;
+	}
+
+	req->req.length = 0;
+	queue_complete_req(req);
+	return sizeof(struct raw1394_request);
 }
 
 static int state_initialized(struct file_info *fi, struct pending_request *req)
 {
-        struct host_info *hi;
-        struct raw1394_khost_list *khl;
+	struct host_info *hi;
+	struct raw1394_khost_list *khl;
+
+	if (req->req.generation != atomic_read(&internal_generation)) {
+		req->req.error = RAW1394_ERROR_GENERATION;
+		req->req.generation = atomic_read(&internal_generation);
+		req->req.length = 0;
+		queue_complete_req(req);
+		return sizeof(struct raw1394_request);
+	}
+
+	switch (req->req.type) {
+	case RAW1394_REQ_LIST_CARDS:
+		spin_lock_irq(&host_info_lock);
+		khl = kmalloc(sizeof(struct raw1394_khost_list) * host_count,
+			      SLAB_ATOMIC);
+
+		if (khl != NULL) {
+			req->req.misc = host_count;
+			req->data = (quadlet_t *) khl;
 
-        if (req->req.generation != atomic_read(&internal_generation)) {
-                req->req.error = RAW1394_ERROR_GENERATION;
-                req->req.generation = atomic_read(&internal_generation);
-                req->req.length = 0;
-                queue_complete_req(req);
-                return sizeof(struct raw1394_request);
-        }
-
-        switch (req->req.type) {
-        case RAW1394_REQ_LIST_CARDS:
-                spin_lock_irq(&host_info_lock);
-                khl = kmalloc(sizeof(struct raw1394_khost_list) * host_count,
-                              SLAB_ATOMIC);
-
-                if (khl != NULL) {
-                        req->req.misc = host_count;
-                        req->data = (quadlet_t *)khl;
-
-                        list_for_each_entry(hi, &host_info_list, list) {
-                                khl->nodes = hi->host->node_count;
-                                strcpy(khl->name, hi->host->driver->name);
-                                khl++;
-                        }
-                }
-                spin_unlock_irq(&host_info_lock);
-
-                if (khl != NULL) {
-                        req->req.error = RAW1394_ERROR_NONE;
-                        req->req.length = min(req->req.length,
-                                              (u32)(sizeof(struct raw1394_khost_list)
-                                              * req->req.misc));
-                        req->free_data = 1;
-                } else {
-                        return -ENOMEM;
-                }
-                break;
-
-        case RAW1394_REQ_SET_CARD:
-                spin_lock_irq(&host_info_lock);
-                if (req->req.misc < host_count) {
+			list_for_each_entry(hi, &host_info_list, list) {
+				khl->nodes = hi->host->node_count;
+				strcpy(khl->name, hi->host->driver->name);
+				khl++;
+			}
+		}
+		spin_unlock_irq(&host_info_lock);
+
+		if (khl != NULL) {
+			req->req.error = RAW1394_ERROR_NONE;
+			req->req.length = min(req->req.length,
+					      (u32) (sizeof
+						     (struct raw1394_khost_list)
+						     * req->req.misc));
+			req->free_data = 1;
+		} else {
+			return -ENOMEM;
+		}
+		break;
+
+	case RAW1394_REQ_SET_CARD:
+		spin_lock_irq(&host_info_lock);
+		if (req->req.misc < host_count) {
 			list_for_each_entry(hi, &host_info_list, list) {
 				if (!req->req.misc--)
 					break;
 			}
-			get_device(&hi->host->device); // XXX Need to handle failure case
-                        list_add_tail(&fi->list, &hi->file_info_list);
-                        fi->host = hi->host;
-                        fi->state = connected;
-
-                        req->req.error = RAW1394_ERROR_NONE;
-                        req->req.generation = get_hpsb_generation(fi->host);
-                        req->req.misc = (fi->host->node_id << 16)
-                                | fi->host->node_count;
-                        if (fi->protocol_version > 3) {
-                                req->req.misc |= NODEID_TO_NODE(fi->host->irm_id) << 8;
-                        }
-                } else {
-                        req->req.error = RAW1394_ERROR_INVALID_ARG;
-                }
+			get_device(&hi->host->device);	// XXX Need to handle failure case
+			list_add_tail(&fi->list, &hi->file_info_list);
+			fi->host = hi->host;
+			fi->state = connected;
+
+			req->req.error = RAW1394_ERROR_NONE;
+			req->req.generation = get_hpsb_generation(fi->host);
+			req->req.misc = (fi->host->node_id << 16)
+			    | fi->host->node_count;
+			if (fi->protocol_version > 3) {
+				req->req.misc |=
+				    NODEID_TO_NODE(fi->host->irm_id) << 8;
+			}
+		} else {
+			req->req.error = RAW1394_ERROR_INVALID_ARG;
+		}
 		spin_unlock_irq(&host_info_lock);
 
-                req->req.length = 0;
-                break;
+		req->req.length = 0;
+		break;
 
-        default:
-                req->req.error = RAW1394_ERROR_STATE_ORDER;
-                req->req.length = 0;
-                break;
-        }
+	default:
+		req->req.error = RAW1394_ERROR_STATE_ORDER;
+		req->req.length = 0;
+		break;
+	}
 
-        queue_complete_req(req);
-        return sizeof(struct raw1394_request);
+	queue_complete_req(req);
+	return sizeof(struct raw1394_request);
 }
 
 static void handle_iso_listen(struct file_info *fi, struct pending_request *req)
 {
-        int channel = req->req.misc;
+	int channel = req->req.misc;
 
-        spin_lock_irq(&host_info_lock);
-        if ((channel > 63) || (channel < -64)) {
-                req->req.error = RAW1394_ERROR_INVALID_ARG;
-        } else if (channel >= 0) {
-                /* allocate channel req.misc */
-                if (fi->listen_channels & (1ULL << channel)) {
-                        req->req.error = RAW1394_ERROR_ALREADY;
-                } else {
-                        if (hpsb_listen_channel(&raw1394_highlevel, fi->host, channel)) {
+	spin_lock_irq(&host_info_lock);
+	if ((channel > 63) || (channel < -64)) {
+		req->req.error = RAW1394_ERROR_INVALID_ARG;
+	} else if (channel >= 0) {
+		/* allocate channel req.misc */
+		if (fi->listen_channels & (1ULL << channel)) {
+			req->req.error = RAW1394_ERROR_ALREADY;
+		} else {
+			if (hpsb_listen_channel
+			    (&raw1394_highlevel, fi->host, channel)) {
 				req->req.error = RAW1394_ERROR_ALREADY;
 			} else {
 				fi->listen_channels |= 1ULL << channel;
 				fi->iso_buffer = int2ptr(req->req.recvb);
 				fi->iso_buffer_length = req->req.length;
 			}
-                }
-        } else {
-                /* deallocate channel (one's complement neg) req.misc */
-                channel = ~channel;
-
-                if (fi->listen_channels & (1ULL << channel)) {
-                        hpsb_unlisten_channel(&raw1394_highlevel, fi->host, channel);
-                        fi->listen_channels &= ~(1ULL << channel);
-                } else {
-                        req->req.error = RAW1394_ERROR_INVALID_ARG;
-                }
-        }
-
-        req->req.length = 0;
-        queue_complete_req(req);
-        spin_unlock_irq(&host_info_lock);
+		}
+	} else {
+		/* deallocate channel (one's complement neg) req.misc */
+		channel = ~channel;
+
+		if (fi->listen_channels & (1ULL << channel)) {
+			hpsb_unlisten_channel(&raw1394_highlevel, fi->host,
+					      channel);
+			fi->listen_channels &= ~(1ULL << channel);
+		} else {
+			req->req.error = RAW1394_ERROR_INVALID_ARG;
+		}
+	}
+
+	req->req.length = 0;
+	queue_complete_req(req);
+	spin_unlock_irq(&host_info_lock);
 }
 
 static void handle_fcp_listen(struct file_info *fi, struct pending_request *req)
 {
-        if (req->req.misc) {
-                if (fi->fcp_buffer) {
-                        req->req.error = RAW1394_ERROR_ALREADY;
-                } else {
-                        fi->fcp_buffer = int2ptr(req->req.recvb);
-                }
-        } else {
-                if (!fi->fcp_buffer) {
-                        req->req.error = RAW1394_ERROR_ALREADY;
-                } else {
-                        fi->fcp_buffer = NULL;
-                }
-        }
+	if (req->req.misc) {
+		if (fi->fcp_buffer) {
+			req->req.error = RAW1394_ERROR_ALREADY;
+		} else {
+			fi->fcp_buffer = int2ptr(req->req.recvb);
+		}
+	} else {
+		if (!fi->fcp_buffer) {
+			req->req.error = RAW1394_ERROR_ALREADY;
+		} else {
+			fi->fcp_buffer = NULL;
+		}
+	}
 
-        req->req.length = 0;
-        queue_complete_req(req);
+	req->req.length = 0;
+	queue_complete_req(req);
 }
 
-
 static int handle_async_request(struct file_info *fi,
-                                struct pending_request *req, int node)
+				struct pending_request *req, int node)
 {
-        struct hpsb_packet *packet = NULL;
-        u64 addr = req->req.address & 0xffffffffffffULL;
+	struct hpsb_packet *packet = NULL;
+	u64 addr = req->req.address & 0xffffffffffffULL;
 
-        switch (req->req.type) {
-        case RAW1394_REQ_ASYNC_READ:
+	switch (req->req.type) {
+	case RAW1394_REQ_ASYNC_READ:
 		DBGMSG("read_request called");
-		packet = hpsb_make_readpacket(fi->host, node, addr, req->req.length);
+		packet =
+		    hpsb_make_readpacket(fi->host, node, addr, req->req.length);
 
 		if (!packet)
 			return -ENOMEM;
@@ -631,7 +644,7 @@
 		else
 			req->data = packet->data;
 
-                break;
+		break;
 
 	case RAW1394_REQ_ASYNC_WRITE:
 		DBGMSG("write_request called");
@@ -642,1105 +655,1207 @@
 			return -ENOMEM;
 
 		if (req->req.length == 4) {
-			if (copy_from_user(&packet->header[3], int2ptr(req->req.sendb),
-					req->req.length))
+			if (copy_from_user
+			    (&packet->header[3], int2ptr(req->req.sendb),
+			     req->req.length))
 				req->req.error = RAW1394_ERROR_MEMFAULT;
 		} else {
-			if (copy_from_user(packet->data, int2ptr(req->req.sendb),
-					req->req.length))
+			if (copy_from_user
+			    (packet->data, int2ptr(req->req.sendb),
+			     req->req.length))
 				req->req.error = RAW1394_ERROR_MEMFAULT;
 		}
 
 		req->req.length = 0;
-	    break;
+		break;
 
 	case RAW1394_REQ_ASYNC_STREAM:
 		DBGMSG("stream_request called");
 
-		packet = hpsb_make_streampacket(fi->host, NULL, req->req.length, node & 0x3f/*channel*/,
-                                        (req->req.misc >> 16) & 0x3, req->req.misc & 0xf);
+		packet =
+		    hpsb_make_streampacket(fi->host, NULL, req->req.length,
+					   node & 0x3f /*channel */ ,
+					   (req->req.misc >> 16) & 0x3,
+					   req->req.misc & 0xf);
 		if (!packet)
 			return -ENOMEM;
 
 		if (copy_from_user(packet->data, int2ptr(req->req.sendb),
-		                   req->req.length))
+				   req->req.length))
 			req->req.error = RAW1394_ERROR_MEMFAULT;
 
 		req->req.length = 0;
 		break;
 
-        case RAW1394_REQ_LOCK:
-                DBGMSG("lock_request called");
-                if ((req->req.misc == EXTCODE_FETCH_ADD)
-                    || (req->req.misc == EXTCODE_LITTLE_ADD)) {
-                        if (req->req.length != 4) {
-                                req->req.error = RAW1394_ERROR_INVALID_ARG;
-                                break;
-                        }
-                } else {
-                        if (req->req.length != 8) {
-                                req->req.error = RAW1394_ERROR_INVALID_ARG;
-                                break;
-                        }
-                }
-
-                packet = hpsb_make_lockpacket(fi->host, node, addr,
-                                              req->req.misc, NULL, 0);
-                if (!packet) return -ENOMEM;
-
-                if (copy_from_user(packet->data, int2ptr(req->req.sendb),
-                                   req->req.length)) {
-                        req->req.error = RAW1394_ERROR_MEMFAULT;
-                        break;
-                }
-
-                req->data = packet->data;
-                req->req.length = 4;
-                break;
-
-        case RAW1394_REQ_LOCK64:
-                DBGMSG("lock64_request called");
-                if ((req->req.misc == EXTCODE_FETCH_ADD)
-                    || (req->req.misc == EXTCODE_LITTLE_ADD)) {
-                        if (req->req.length != 8) {
-                                req->req.error = RAW1394_ERROR_INVALID_ARG;
-                                break;
-                        }
-                } else {
-                        if (req->req.length != 16) {
-                                req->req.error = RAW1394_ERROR_INVALID_ARG;
-                                break;
-                        }
-                }
-                packet = hpsb_make_lock64packet(fi->host, node, addr,
-                                                req->req.misc, NULL, 0);
-                if (!packet) return -ENOMEM;
-
-                if (copy_from_user(packet->data, int2ptr(req->req.sendb),
-                                   req->req.length)) {
-                        req->req.error = RAW1394_ERROR_MEMFAULT;
-                        break;
-                }
-
-                req->data = packet->data;
-                req->req.length = 8;
-                break;
-
-        default:
-                req->req.error = RAW1394_ERROR_STATE_ORDER;
-        }
-
-        req->packet = packet;
-
-        if (req->req.error) {
-                req->req.length = 0;
-                queue_complete_req(req);
-                return sizeof(struct raw1394_request);
-        }
-
-	hpsb_set_packet_complete_task(packet, (void(*)(void*))queue_complete_cb, req);
-
-        spin_lock_irq(&fi->reqlists_lock);
-        list_add_tail(&req->list, &fi->req_pending);
-        spin_unlock_irq(&fi->reqlists_lock);
+	case RAW1394_REQ_LOCK:
+		DBGMSG("lock_request called");
+		if ((req->req.misc == EXTCODE_FETCH_ADD)
+		    || (req->req.misc == EXTCODE_LITTLE_ADD)) {
+			if (req->req.length != 4) {
+				req->req.error = RAW1394_ERROR_INVALID_ARG;
+				break;
+			}
+		} else {
+			if (req->req.length != 8) {
+				req->req.error = RAW1394_ERROR_INVALID_ARG;
+				break;
+			}
+		}
+
+		packet = hpsb_make_lockpacket(fi->host, node, addr,
+					      req->req.misc, NULL, 0);
+		if (!packet)
+			return -ENOMEM;
+
+		if (copy_from_user(packet->data, int2ptr(req->req.sendb),
+				   req->req.length)) {
+			req->req.error = RAW1394_ERROR_MEMFAULT;
+			break;
+		}
+
+		req->data = packet->data;
+		req->req.length = 4;
+		break;
+
+	case RAW1394_REQ_LOCK64:
+		DBGMSG("lock64_request called");
+		if ((req->req.misc == EXTCODE_FETCH_ADD)
+		    || (req->req.misc == EXTCODE_LITTLE_ADD)) {
+			if (req->req.length != 8) {
+				req->req.error = RAW1394_ERROR_INVALID_ARG;
+				break;
+			}
+		} else {
+			if (req->req.length != 16) {
+				req->req.error = RAW1394_ERROR_INVALID_ARG;
+				break;
+			}
+		}
+		packet = hpsb_make_lock64packet(fi->host, node, addr,
+						req->req.misc, NULL, 0);
+		if (!packet)
+			return -ENOMEM;
+
+		if (copy_from_user(packet->data, int2ptr(req->req.sendb),
+				   req->req.length)) {
+			req->req.error = RAW1394_ERROR_MEMFAULT;
+			break;
+		}
+
+		req->data = packet->data;
+		req->req.length = 8;
+		break;
+
+	default:
+		req->req.error = RAW1394_ERROR_STATE_ORDER;
+	}
+
+	req->packet = packet;
+
+	if (req->req.error) {
+		req->req.length = 0;
+		queue_complete_req(req);
+		return sizeof(struct raw1394_request);
+	}
+
+	hpsb_set_packet_complete_task(packet,
+				      (void (*)(void *))queue_complete_cb, req);
+
+	spin_lock_irq(&fi->reqlists_lock);
+	list_add_tail(&req->list, &fi->req_pending);
+	spin_unlock_irq(&fi->reqlists_lock);
 
 	packet->generation = req->req.generation;
 
-        if (hpsb_send_packet(packet) < 0) {
-                req->req.error = RAW1394_ERROR_SEND_ERROR;
-                req->req.length = 0;
-                hpsb_free_tlabel(packet);
-                queue_complete_req(req);
-        }
-        return sizeof(struct raw1394_request);
+	if (hpsb_send_packet(packet) < 0) {
+		req->req.error = RAW1394_ERROR_SEND_ERROR;
+		req->req.length = 0;
+		hpsb_free_tlabel(packet);
+		queue_complete_req(req);
+	}
+	return sizeof(struct raw1394_request);
 }
 
 static int handle_iso_send(struct file_info *fi, struct pending_request *req,
-                           int channel)
+			   int channel)
 {
-        struct hpsb_packet *packet;
+	struct hpsb_packet *packet;
 
 	packet = hpsb_make_isopacket(fi->host, req->req.length, channel & 0x3f,
-				     (req->req.misc >> 16) & 0x3, req->req.misc & 0xf);
+				     (req->req.misc >> 16) & 0x3,
+				     req->req.misc & 0xf);
 	if (!packet)
 		return -ENOMEM;
 
-        packet->speed_code = req->req.address & 0x3;
+	packet->speed_code = req->req.address & 0x3;
 
 	req->packet = packet;
 
-        if (copy_from_user(packet->data, int2ptr(req->req.sendb),
-                           req->req.length)) {
-                req->req.error = RAW1394_ERROR_MEMFAULT;
-                req->req.length = 0;
-                queue_complete_req(req);
-                return sizeof(struct raw1394_request);
-        }
-
-        req->req.length = 0;
-	hpsb_set_packet_complete_task(packet, (void (*)(void*))queue_complete_req, req);
-
-        spin_lock_irq(&fi->reqlists_lock);
-        list_add_tail(&req->list, &fi->req_pending);
-        spin_unlock_irq(&fi->reqlists_lock);
+	if (copy_from_user(packet->data, int2ptr(req->req.sendb),
+			   req->req.length)) {
+		req->req.error = RAW1394_ERROR_MEMFAULT;
+		req->req.length = 0;
+		queue_complete_req(req);
+		return sizeof(struct raw1394_request);
+	}
+
+	req->req.length = 0;
+	hpsb_set_packet_complete_task(packet,
+				      (void (*)(void *))queue_complete_req,
+				      req);
+
+	spin_lock_irq(&fi->reqlists_lock);
+	list_add_tail(&req->list, &fi->req_pending);
+	spin_unlock_irq(&fi->reqlists_lock);
 
 	/* Update the generation of the packet just before sending. */
 	packet->generation = req->req.generation;
 
-        if (hpsb_send_packet(packet) < 0) {
-                req->req.error = RAW1394_ERROR_SEND_ERROR;
-                queue_complete_req(req);
-        }
+	if (hpsb_send_packet(packet) < 0) {
+		req->req.error = RAW1394_ERROR_SEND_ERROR;
+		queue_complete_req(req);
+	}
 
-        return sizeof(struct raw1394_request);
+	return sizeof(struct raw1394_request);
 }
 
 static int handle_async_send(struct file_info *fi, struct pending_request *req)
 {
-        struct hpsb_packet *packet;
-        int header_length = req->req.misc & 0xffff;
-        int expect_response = req->req.misc >> 16;
-
-        if ((header_length > req->req.length) ||
-            (header_length  < 12)) {
-                req->req.error = RAW1394_ERROR_INVALID_ARG;
-                req->req.length = 0;
-                queue_complete_req(req);
-                return sizeof(struct raw1394_request);
-        }
-
-        packet = hpsb_alloc_packet(req->req.length-header_length);
-        req->packet = packet;
-        if (!packet) return -ENOMEM;
-
-        if (copy_from_user(packet->header, int2ptr(req->req.sendb),
-                           header_length)) {
-                req->req.error = RAW1394_ERROR_MEMFAULT;
-                req->req.length = 0;
-                queue_complete_req(req);
-                return sizeof(struct raw1394_request);
-        }
-
-        if (copy_from_user(packet->data, int2ptr(req->req.sendb) + header_length,
-                           packet->data_size)) {
-                req->req.error = RAW1394_ERROR_MEMFAULT;
-                req->req.length = 0;
-                queue_complete_req(req);
-                return sizeof(struct raw1394_request);
-        }
-
-        packet->type = hpsb_async;
-        packet->node_id = packet->header[0] >> 16;
-        packet->tcode = (packet->header[0] >> 4) & 0xf;
-        packet->tlabel = (packet->header[0] >> 10) &0x3f;
-        packet->host = fi->host;
-        packet->expect_response = expect_response;
-        packet->header_size=header_length;
-        packet->data_size=req->req.length-header_length;
-
-        req->req.length = 0;
-        hpsb_set_packet_complete_task(packet, (void(*)(void*))queue_complete_cb, req);
-
-        spin_lock_irq(&fi->reqlists_lock);
-        list_add_tail(&req->list, &fi->req_pending);
-        spin_unlock_irq(&fi->reqlists_lock);
-
-        /* Update the generation of the packet just before sending. */
-        packet->generation = req->req.generation;
-
-        if (hpsb_send_packet(packet) < 0) {
-                req->req.error = RAW1394_ERROR_SEND_ERROR;
-                queue_complete_req(req);
-        }
-
-        return sizeof(struct raw1394_request);
-}
-
-static int arm_read (struct hpsb_host *host, int nodeid, quadlet_t *buffer,
-		     u64 addr, size_t length, u16 flags)
-{
-        struct pending_request *req;
-        struct host_info *hi;
-        struct file_info *fi = NULL;
-        struct list_head *entry;
-        struct arm_addr  *arm_addr = NULL;
-        struct arm_request  *arm_req = NULL;
-        struct arm_response *arm_resp = NULL;
-        int found=0, size=0, rcode=-1;
-        struct arm_request_response *arm_req_resp = NULL;
-
-        DBGMSG("arm_read  called by node: %X"
-              "addr: %4.4x %8.8x length: %Zu", nodeid,
-              (u16) ((addr >>32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF),
-              length);
-        spin_lock(&host_info_lock);
-        hi = find_host_info(host); /* search address-entry */
-        if (hi != NULL) {
-                list_for_each_entry(fi, &hi->file_info_list, list) {
-                        entry = fi->addr_list.next;
-                        while (entry != &(fi->addr_list)) {
-                                arm_addr = list_entry(entry, struct arm_addr, addr_list);
-                                if (((arm_addr->start) <= (addr)) &&
-                                        ((arm_addr->end) >= (addr+length))) {
-                                        found = 1;
-                                        break;
-                                }
-                                entry = entry->next;
-                        }
-                        if (found) {
-                                break;
-                        }
-                }
-        }
-        rcode = -1;
-        if (!found) {
-                printk(KERN_ERR "raw1394: arm_read FAILED addr_entry not found"
-                " -> rcode_address_error\n");
-                spin_unlock(&host_info_lock);
-                return (RCODE_ADDRESS_ERROR);
-        } else {
-                DBGMSG("arm_read addr_entry FOUND");
-        }
-        if (arm_addr->rec_length < length) {
-                DBGMSG("arm_read blocklength too big -> rcode_data_error");
-                rcode = RCODE_DATA_ERROR; /* hardware error, data is unavailable */
-        }
-        if (rcode == -1) {
-                if (arm_addr->access_rights & ARM_READ) {
-                        if (!(arm_addr->client_transactions & ARM_READ)) {
-                                memcpy(buffer,(arm_addr->addr_space_buffer)+(addr-(arm_addr->start)),
-                                       length);
-                                DBGMSG("arm_read -> (rcode_complete)");
-                                rcode = RCODE_COMPLETE;
-                        }
-                } else {
-                        rcode = RCODE_TYPE_ERROR; /* function not allowed */
-                        DBGMSG("arm_read -> rcode_type_error (access denied)");
-                }
-        }
-        if (arm_addr->notification_options & ARM_READ) {
-                DBGMSG("arm_read -> entering notification-section");
-                req = __alloc_pending_request(SLAB_ATOMIC);
-                if (!req) {
-                        DBGMSG("arm_read -> rcode_conflict_error");
-                        spin_unlock(&host_info_lock);
-                        return(RCODE_CONFLICT_ERROR); /* A resource conflict was detected.
-                                                        The request may be retried */
-                }
-                if (rcode == RCODE_COMPLETE) {
-                        size =  sizeof(struct arm_request)+sizeof(struct arm_response) +
-                                length * sizeof(byte_t) +
-                                sizeof (struct arm_request_response);
-                } else {
-                        size =  sizeof(struct arm_request)+sizeof(struct arm_response) +
-                                sizeof (struct arm_request_response);
-                }
-                req->data = kmalloc(size, SLAB_ATOMIC);
-                if (!(req->data)) {
-                        free_pending_request(req);
-                        DBGMSG("arm_read -> rcode_conflict_error");
-                        spin_unlock(&host_info_lock);
-                        return(RCODE_CONFLICT_ERROR); /* A resource conflict was detected.
-                                                        The request may be retried */
-                }
-                req->free_data=1;
-                req->file_info = fi;
-                req->req.type = RAW1394_REQ_ARM;
-                req->req.generation = get_hpsb_generation(host);
-                req->req.misc = ( ((length << 16) & (0xFFFF0000)) | (ARM_READ & 0xFF));
-                req->req.tag  = arm_addr->arm_tag;
-                req->req.recvb = arm_addr->recvb;
-                req->req.length = size;
-                arm_req_resp = (struct arm_request_response *) (req->data);
-                arm_req  = (struct arm_request *) ((byte_t *)(req->data) +
-                        (sizeof (struct arm_request_response)));
-                arm_resp = (struct arm_response *) ((byte_t *)(arm_req) +
-                        (sizeof(struct arm_request)));
-                arm_req->buffer  = NULL;
-                arm_resp->buffer = NULL;
-                if (rcode == RCODE_COMPLETE) {
-                        byte_t *buf = (byte_t *)arm_resp + sizeof(struct arm_response);
-                        memcpy (buf,
-                                (arm_addr->addr_space_buffer)+(addr-(arm_addr->start)),
-                                length);
-                        arm_resp->buffer = int2ptr((arm_addr->recvb) +
-                                sizeof (struct arm_request_response) +
-                                sizeof (struct arm_request) +
-                                sizeof (struct arm_response));
-                }
-                arm_resp->buffer_length = (rcode == RCODE_COMPLETE) ? length : 0;
-                arm_resp->response_code = rcode;
-                arm_req->buffer_length = 0;
-                arm_req->generation = req->req.generation;
-                arm_req->extended_transaction_code = 0;
-                arm_req->destination_offset = addr;
-                arm_req->source_nodeid = nodeid;
-                arm_req->destination_nodeid = host->node_id;
-                arm_req->tlabel = (flags >> 10) & 0x3f;
-                arm_req->tcode = (flags >> 4) & 0x0f;
-                arm_req_resp->request  = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response));
-                arm_req_resp->response = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response) +
-                        sizeof (struct arm_request));
-                queue_complete_req(req);
-        }
-        spin_unlock(&host_info_lock);
-        return(rcode);
-}
-
-static int arm_write (struct hpsb_host *host, int nodeid, int destid,
-		      quadlet_t *data, u64 addr, size_t length, u16 flags)
-{
-        struct pending_request *req;
-        struct host_info *hi;
-        struct file_info *fi = NULL;
-        struct list_head *entry;
-        struct arm_addr  *arm_addr = NULL;
-        struct arm_request  *arm_req = NULL;
-        struct arm_response *arm_resp = NULL;
-        int found=0, size=0, rcode=-1, length_conflict=0;
-        struct arm_request_response *arm_req_resp = NULL;
-
-        DBGMSG("arm_write called by node: %X"
-              "addr: %4.4x %8.8x length: %Zu", nodeid,
-              (u16) ((addr >>32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF),
-              length);
-        spin_lock(&host_info_lock);
-        hi = find_host_info(host); /* search address-entry */
-        if (hi != NULL) {
-                list_for_each_entry(fi, &hi->file_info_list, list) {
-                        entry = fi->addr_list.next;
-                        while (entry != &(fi->addr_list)) {
-                                arm_addr = list_entry(entry, struct arm_addr, addr_list);
-                                if (((arm_addr->start) <= (addr)) &&
-                                        ((arm_addr->end) >= (addr+length))) {
-                                        found = 1;
-                                        break;
-                                }
-                                entry = entry->next;
-                        }
-                        if (found) {
-                                break;
-                        }
-                }
-        }
-        rcode = -1;
-        if (!found) {
-                printk(KERN_ERR "raw1394: arm_write FAILED addr_entry not found"
-                " -> rcode_address_error\n");
-                spin_unlock(&host_info_lock);
-                return (RCODE_ADDRESS_ERROR);
-        } else {
-                DBGMSG("arm_write addr_entry FOUND");
-        }
-        if (arm_addr->rec_length < length) {
-                DBGMSG("arm_write blocklength too big -> rcode_data_error");
-                length_conflict = 1;
-                rcode = RCODE_DATA_ERROR; /* hardware error, data is unavailable */
-        }
-        if (rcode == -1) {
-                if (arm_addr->access_rights & ARM_WRITE) {
-                        if (!(arm_addr->client_transactions & ARM_WRITE)) {
-                                memcpy((arm_addr->addr_space_buffer)+(addr-(arm_addr->start)),
-                                        data, length);
-                                DBGMSG("arm_write -> (rcode_complete)");
-                                rcode = RCODE_COMPLETE;
-                        }
-                } else {
-                        rcode = RCODE_TYPE_ERROR; /* function not allowed */
-                        DBGMSG("arm_write -> rcode_type_error (access denied)");
-                }
-        }
-        if (arm_addr->notification_options & ARM_WRITE) {
-                DBGMSG("arm_write -> entering notification-section");
-                req = __alloc_pending_request(SLAB_ATOMIC);
-                if (!req) {
-                        DBGMSG("arm_write -> rcode_conflict_error");
-                        spin_unlock(&host_info_lock);
-                        return(RCODE_CONFLICT_ERROR); /* A resource conflict was detected.
-                                                        The request my be retried */
-                }
-                size =  sizeof(struct arm_request)+sizeof(struct arm_response) +
-                        (length) * sizeof(byte_t) +
-                        sizeof (struct arm_request_response);
-                req->data = kmalloc(size, SLAB_ATOMIC);
-                if (!(req->data)) {
-                        free_pending_request(req);
-                        DBGMSG("arm_write -> rcode_conflict_error");
-                        spin_unlock(&host_info_lock);
-                        return(RCODE_CONFLICT_ERROR); /* A resource conflict was detected.
-                                                        The request may be retried */
-                }
-                req->free_data=1;
-                req->file_info = fi;
-                req->req.type = RAW1394_REQ_ARM;
-                req->req.generation = get_hpsb_generation(host);
-                req->req.misc = ( ((length << 16) & (0xFFFF0000)) | (ARM_WRITE & 0xFF));
-                req->req.tag  = arm_addr->arm_tag;
-                req->req.recvb = arm_addr->recvb;
-                req->req.length = size;
-                arm_req_resp = (struct arm_request_response *) (req->data);
-                arm_req  = (struct arm_request *) ((byte_t *)(req->data) +
-                        (sizeof (struct arm_request_response)));
-                arm_resp = (struct arm_response *) ((byte_t *)(arm_req) +
-                        (sizeof(struct arm_request)));
-                arm_resp->buffer = NULL;
-                memcpy ((byte_t *)arm_resp + sizeof(struct arm_response),
-			data, length);
-                arm_req->buffer = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response) +
-                        sizeof (struct arm_request) +
-                        sizeof (struct arm_response));
-                arm_req->buffer_length = length;
-                arm_req->generation = req->req.generation;
-                arm_req->extended_transaction_code = 0;
-                arm_req->destination_offset = addr;
-                arm_req->source_nodeid = nodeid;
-                arm_req->destination_nodeid = destid;
-                arm_req->tlabel = (flags >> 10) & 0x3f;
-                arm_req->tcode = (flags >> 4) & 0x0f;
-                arm_resp->buffer_length = 0;
-                arm_resp->response_code = rcode;
-                arm_req_resp->request  = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response));
-                arm_req_resp->response = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response) +
-                        sizeof (struct arm_request));
-                queue_complete_req(req);
-        }
-        spin_unlock(&host_info_lock);
-        return(rcode);
-}
-
-static int arm_lock (struct hpsb_host *host, int nodeid, quadlet_t *store,
-             u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode, u16 flags)
-{
-        struct pending_request *req;
-        struct host_info *hi;
-        struct file_info *fi = NULL;
-        struct list_head *entry;
-        struct arm_addr  *arm_addr = NULL;
-        struct arm_request  *arm_req = NULL;
-        struct arm_response *arm_resp = NULL;
-        int found=0, size=0, rcode=-1;
-        quadlet_t old, new;
-        struct arm_request_response *arm_req_resp = NULL;
-
-        if (((ext_tcode & 0xFF) == EXTCODE_FETCH_ADD) ||
-                ((ext_tcode & 0xFF) == EXTCODE_LITTLE_ADD)) {
-                DBGMSG("arm_lock  called by node: %X "
-                      "addr: %4.4x %8.8x extcode: %2.2X data: %8.8X",
-                      nodeid, (u16) ((addr >>32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF),
-                      ext_tcode & 0xFF , be32_to_cpu(data));
-        } else {
-                DBGMSG("arm_lock  called by node: %X "
-                      "addr: %4.4x %8.8x extcode: %2.2X data: %8.8X arg: %8.8X",
-                      nodeid, (u16) ((addr >>32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF),
-                      ext_tcode & 0xFF , be32_to_cpu(data), be32_to_cpu(arg));
-        }
-        spin_lock(&host_info_lock);
-        hi = find_host_info(host); /* search address-entry */
-        if (hi != NULL) {
-                list_for_each_entry(fi, &hi->file_info_list, list) {
-                        entry = fi->addr_list.next;
-                        while (entry != &(fi->addr_list)) {
-                                arm_addr = list_entry(entry, struct arm_addr, addr_list);
-                                if (((arm_addr->start) <= (addr)) &&
-                                        ((arm_addr->end) >= (addr+sizeof(*store)))) {
-                                        found = 1;
-                                        break;
-                                }
-                                entry = entry->next;
-                        }
-                        if (found) {
-                                break;
-                        }
-                }
-        }
-        rcode = -1;
-        if (!found) {
-                printk(KERN_ERR "raw1394: arm_lock FAILED addr_entry not found"
-                " -> rcode_address_error\n");
-                spin_unlock(&host_info_lock);
-                return (RCODE_ADDRESS_ERROR);
-        } else {
-                DBGMSG("arm_lock addr_entry FOUND");
-        }
-        if (rcode == -1) {
-                if (arm_addr->access_rights & ARM_LOCK) {
-                        if (!(arm_addr->client_transactions & ARM_LOCK)) {
-                                memcpy(&old,(arm_addr->addr_space_buffer)+(addr-(arm_addr->start)),
-                                        sizeof(old));
-                                switch (ext_tcode) {
-                                        case (EXTCODE_MASK_SWAP):
-                                                new = data | (old & ~arg);
-                                                break;
-                                        case (EXTCODE_COMPARE_SWAP):
-                                                if (old == arg) {
-                                                        new = data;
-                                                } else {
-                                                        new = old;
-                                                }
-                                                break;
-                                        case (EXTCODE_FETCH_ADD):
-                                                new = cpu_to_be32(be32_to_cpu(data) + be32_to_cpu(old));
-                                                break;
-                                        case (EXTCODE_LITTLE_ADD):
-                                                new = cpu_to_le32(le32_to_cpu(data) + le32_to_cpu(old));
-                                                break;
-                                        case (EXTCODE_BOUNDED_ADD):
-                                                if (old != arg) {
-                                                        new = cpu_to_be32(be32_to_cpu(data) +
-                                                                be32_to_cpu(old));
-                                                } else {
-                                                        new = old;
-                                                }
-                                                break;
-                                        case (EXTCODE_WRAP_ADD):
-                                                if (old != arg) {
-                                                        new = cpu_to_be32(be32_to_cpu(data) +
-                                                                be32_to_cpu(old));
-                                                } else {
-                                                        new = data;
-                                                }
-                                                break;
-                                        default:
-                                                rcode = RCODE_TYPE_ERROR; /* function not allowed */
-                                                printk(KERN_ERR "raw1394: arm_lock FAILED "
-                                                "ext_tcode not allowed -> rcode_type_error\n");
-                                                break;
-                                } /*switch*/
-                                if (rcode == -1) {
-                                        DBGMSG("arm_lock -> (rcode_complete)");
-                                        rcode = RCODE_COMPLETE;
-                                        memcpy (store, &old, sizeof(*store));
-                                        memcpy ((arm_addr->addr_space_buffer)+
-                                                (addr-(arm_addr->start)),
-                                                &new, sizeof(*store));
-                                }
-                        }
-                } else {
-                        rcode = RCODE_TYPE_ERROR; /* function not allowed */
-                        DBGMSG("arm_lock -> rcode_type_error (access denied)");
-                }
-        }
-        if (arm_addr->notification_options & ARM_LOCK) {
+	struct hpsb_packet *packet;
+	int header_length = req->req.misc & 0xffff;
+	int expect_response = req->req.misc >> 16;
+
+	if ((header_length > req->req.length) || (header_length < 12)) {
+		req->req.error = RAW1394_ERROR_INVALID_ARG;
+		req->req.length = 0;
+		queue_complete_req(req);
+		return sizeof(struct raw1394_request);
+	}
+
+	packet = hpsb_alloc_packet(req->req.length - header_length);
+	req->packet = packet;
+	if (!packet)
+		return -ENOMEM;
+
+	if (copy_from_user(packet->header, int2ptr(req->req.sendb),
+			   header_length)) {
+		req->req.error = RAW1394_ERROR_MEMFAULT;
+		req->req.length = 0;
+		queue_complete_req(req);
+		return sizeof(struct raw1394_request);
+	}
+
+	if (copy_from_user
+	    (packet->data, int2ptr(req->req.sendb) + header_length,
+	     packet->data_size)) {
+		req->req.error = RAW1394_ERROR_MEMFAULT;
+		req->req.length = 0;
+		queue_complete_req(req);
+		return sizeof(struct raw1394_request);
+	}
+
+	packet->type = hpsb_async;
+	packet->node_id = packet->header[0] >> 16;
+	packet->tcode = (packet->header[0] >> 4) & 0xf;
+	packet->tlabel = (packet->header[0] >> 10) & 0x3f;
+	packet->host = fi->host;
+	packet->expect_response = expect_response;
+	packet->header_size = header_length;
+	packet->data_size = req->req.length - header_length;
+
+	req->req.length = 0;
+	hpsb_set_packet_complete_task(packet,
+				      (void (*)(void *))queue_complete_cb, req);
+
+	spin_lock_irq(&fi->reqlists_lock);
+	list_add_tail(&req->list, &fi->req_pending);
+	spin_unlock_irq(&fi->reqlists_lock);
+
+	/* Update the generation of the packet just before sending. */
+	packet->generation = req->req.generation;
+
+	if (hpsb_send_packet(packet) < 0) {
+		req->req.error = RAW1394_ERROR_SEND_ERROR;
+		queue_complete_req(req);
+	}
+
+	return sizeof(struct raw1394_request);
+}
+
+static int arm_read(struct hpsb_host *host, int nodeid, quadlet_t * buffer,
+		    u64 addr, size_t length, u16 flags)
+{
+	struct pending_request *req;
+	struct host_info *hi;
+	struct file_info *fi = NULL;
+	struct list_head *entry;
+	struct arm_addr *arm_addr = NULL;
+	struct arm_request *arm_req = NULL;
+	struct arm_response *arm_resp = NULL;
+	int found = 0, size = 0, rcode = -1;
+	struct arm_request_response *arm_req_resp = NULL;
+
+	DBGMSG("arm_read  called by node: %X"
+	       "addr: %4.4x %8.8x length: %Zu", nodeid,
+	       (u16) ((addr >> 32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF),
+	       length);
+	spin_lock(&host_info_lock);
+	hi = find_host_info(host);	/* search address-entry */
+	if (hi != NULL) {
+		list_for_each_entry(fi, &hi->file_info_list, list) {
+			entry = fi->addr_list.next;
+			while (entry != &(fi->addr_list)) {
+				arm_addr =
+				    list_entry(entry, struct arm_addr,
+					       addr_list);
+				if (((arm_addr->start) <= (addr))
+				    && ((arm_addr->end) >= (addr + length))) {
+					found = 1;
+					break;
+				}
+				entry = entry->next;
+			}
+			if (found) {
+				break;
+			}
+		}
+	}
+	rcode = -1;
+	if (!found) {
+		printk(KERN_ERR "raw1394: arm_read FAILED addr_entry not found"
+		       " -> rcode_address_error\n");
+		spin_unlock(&host_info_lock);
+		return (RCODE_ADDRESS_ERROR);
+	} else {
+		DBGMSG("arm_read addr_entry FOUND");
+	}
+	if (arm_addr->rec_length < length) {
+		DBGMSG("arm_read blocklength too big -> rcode_data_error");
+		rcode = RCODE_DATA_ERROR;	/* hardware error, data is unavailable */
+	}
+	if (rcode == -1) {
+		if (arm_addr->access_rights & ARM_READ) {
+			if (!(arm_addr->client_transactions & ARM_READ)) {
+				memcpy(buffer,
+				       (arm_addr->addr_space_buffer) + (addr -
+									(arm_addr->
+									 start)),
+				       length);
+				DBGMSG("arm_read -> (rcode_complete)");
+				rcode = RCODE_COMPLETE;
+			}
+		} else {
+			rcode = RCODE_TYPE_ERROR;	/* function not allowed */
+			DBGMSG("arm_read -> rcode_type_error (access denied)");
+		}
+	}
+	if (arm_addr->notification_options & ARM_READ) {
+		DBGMSG("arm_read -> entering notification-section");
+		req = __alloc_pending_request(SLAB_ATOMIC);
+		if (!req) {
+			DBGMSG("arm_read -> rcode_conflict_error");
+			spin_unlock(&host_info_lock);
+			return (RCODE_CONFLICT_ERROR);	/* A resource conflict was detected.
+							   The request may be retried */
+		}
+		if (rcode == RCODE_COMPLETE) {
+			size =
+			    sizeof(struct arm_request) +
+			    sizeof(struct arm_response) +
+			    length * sizeof(byte_t) +
+			    sizeof(struct arm_request_response);
+		} else {
+			size =
+			    sizeof(struct arm_request) +
+			    sizeof(struct arm_response) +
+			    sizeof(struct arm_request_response);
+		}
+		req->data = kmalloc(size, SLAB_ATOMIC);
+		if (!(req->data)) {
+			free_pending_request(req);
+			DBGMSG("arm_read -> rcode_conflict_error");
+			spin_unlock(&host_info_lock);
+			return (RCODE_CONFLICT_ERROR);	/* A resource conflict was detected.
+							   The request may be retried */
+		}
+		req->free_data = 1;
+		req->file_info = fi;
+		req->req.type = RAW1394_REQ_ARM;
+		req->req.generation = get_hpsb_generation(host);
+		req->req.misc =
+		    (((length << 16) & (0xFFFF0000)) | (ARM_READ & 0xFF));
+		req->req.tag = arm_addr->arm_tag;
+		req->req.recvb = arm_addr->recvb;
+		req->req.length = size;
+		arm_req_resp = (struct arm_request_response *)(req->data);
+		arm_req = (struct arm_request *)((byte_t *) (req->data) +
+						 (sizeof
+						  (struct
+						   arm_request_response)));
+		arm_resp =
+		    (struct arm_response *)((byte_t *) (arm_req) +
+					    (sizeof(struct arm_request)));
+		arm_req->buffer = NULL;
+		arm_resp->buffer = NULL;
+		if (rcode == RCODE_COMPLETE) {
+			byte_t *buf =
+			    (byte_t *) arm_resp + sizeof(struct arm_response);
+			memcpy(buf,
+			       (arm_addr->addr_space_buffer) + (addr -
+								(arm_addr->
+								 start)),
+			       length);
+			arm_resp->buffer =
+			    int2ptr((arm_addr->recvb) +
+				    sizeof(struct arm_request_response) +
+				    sizeof(struct arm_request) +
+				    sizeof(struct arm_response));
+		}
+		arm_resp->buffer_length =
+		    (rcode == RCODE_COMPLETE) ? length : 0;
+		arm_resp->response_code = rcode;
+		arm_req->buffer_length = 0;
+		arm_req->generation = req->req.generation;
+		arm_req->extended_transaction_code = 0;
+		arm_req->destination_offset = addr;
+		arm_req->source_nodeid = nodeid;
+		arm_req->destination_nodeid = host->node_id;
+		arm_req->tlabel = (flags >> 10) & 0x3f;
+		arm_req->tcode = (flags >> 4) & 0x0f;
+		arm_req_resp->request = int2ptr((arm_addr->recvb) +
+						sizeof(struct
+						       arm_request_response));
+		arm_req_resp->response =
+		    int2ptr((arm_addr->recvb) +
+			    sizeof(struct arm_request_response) +
+			    sizeof(struct arm_request));
+		queue_complete_req(req);
+	}
+	spin_unlock(&host_info_lock);
+	return (rcode);
+}
+
+static int arm_write(struct hpsb_host *host, int nodeid, int destid,
+		     quadlet_t * data, u64 addr, size_t length, u16 flags)
+{
+	struct pending_request *req;
+	struct host_info *hi;
+	struct file_info *fi = NULL;
+	struct list_head *entry;
+	struct arm_addr *arm_addr = NULL;
+	struct arm_request *arm_req = NULL;
+	struct arm_response *arm_resp = NULL;
+	int found = 0, size = 0, rcode = -1, length_conflict = 0;
+	struct arm_request_response *arm_req_resp = NULL;
+
+	DBGMSG("arm_write called by node: %X"
+	       "addr: %4.4x %8.8x length: %Zu", nodeid,
+	       (u16) ((addr >> 32) & 0xFFFF), (u32) (addr & 0xFFFFFFFF),
+	       length);
+	spin_lock(&host_info_lock);
+	hi = find_host_info(host);	/* search address-entry */
+	if (hi != NULL) {
+		list_for_each_entry(fi, &hi->file_info_list, list) {
+			entry = fi->addr_list.next;
+			while (entry != &(fi->addr_list)) {
+				arm_addr =
+				    list_entry(entry, struct arm_addr,
+					       addr_list);
+				if (((arm_addr->start) <= (addr))
+				    && ((arm_addr->end) >= (addr + length))) {
+					found = 1;
+					break;
+				}
+				entry = entry->next;
+			}
+			if (found) {
+				break;
+			}
+		}
+	}
+	rcode = -1;
+	if (!found) {
+		printk(KERN_ERR "raw1394: arm_write FAILED addr_entry not found"
+		       " -> rcode_address_error\n");
+		spin_unlock(&host_info_lock);
+		return (RCODE_ADDRESS_ERROR);
+	} else {
+		DBGMSG("arm_write addr_entry FOUND");
+	}
+	if (arm_addr->rec_length < length) {
+		DBGMSG("arm_write blocklength too big -> rcode_data_error");
+		length_conflict = 1;
+		rcode = RCODE_DATA_ERROR;	/* hardware error, data is unavailable */
+	}
+	if (rcode == -1) {
+		if (arm_addr->access_rights & ARM_WRITE) {
+			if (!(arm_addr->client_transactions & ARM_WRITE)) {
+				memcpy((arm_addr->addr_space_buffer) +
+				       (addr - (arm_addr->start)), data,
+				       length);
+				DBGMSG("arm_write -> (rcode_complete)");
+				rcode = RCODE_COMPLETE;
+			}
+		} else {
+			rcode = RCODE_TYPE_ERROR;	/* function not allowed */
+			DBGMSG("arm_write -> rcode_type_error (access denied)");
+		}
+	}
+	if (arm_addr->notification_options & ARM_WRITE) {
+		DBGMSG("arm_write -> entering notification-section");
+		req = __alloc_pending_request(SLAB_ATOMIC);
+		if (!req) {
+			DBGMSG("arm_write -> rcode_conflict_error");
+			spin_unlock(&host_info_lock);
+			return (RCODE_CONFLICT_ERROR);	/* A resource conflict was detected.
+							   The request my be retried */
+		}
+		size =
+		    sizeof(struct arm_request) + sizeof(struct arm_response) +
+		    (length) * sizeof(byte_t) +
+		    sizeof(struct arm_request_response);
+		req->data = kmalloc(size, SLAB_ATOMIC);
+		if (!(req->data)) {
+			free_pending_request(req);
+			DBGMSG("arm_write -> rcode_conflict_error");
+			spin_unlock(&host_info_lock);
+			return (RCODE_CONFLICT_ERROR);	/* A resource conflict was detected.
+							   The request may be retried */
+		}
+		req->free_data = 1;
+		req->file_info = fi;
+		req->req.type = RAW1394_REQ_ARM;
+		req->req.generation = get_hpsb_generation(host);
+		req->req.misc =
+		    (((length << 16) & (0xFFFF0000)) | (ARM_WRITE & 0xFF));
+		req->req.tag = arm_addr->arm_tag;
+		req->req.recvb = arm_addr->recvb;
+		req->req.length = size;
+		arm_req_resp = (struct arm_request_response *)(req->data);
+		arm_req = (struct arm_request *)((byte_t *) (req->data) +
+						 (sizeof
+						  (struct
+						   arm_request_response)));
+		arm_resp =
+		    (struct arm_response *)((byte_t *) (arm_req) +
+					    (sizeof(struct arm_request)));
+		arm_resp->buffer = NULL;
+		memcpy((byte_t *) arm_resp + sizeof(struct arm_response),
+		       data, length);
+		arm_req->buffer = int2ptr((arm_addr->recvb) +
+					  sizeof(struct arm_request_response) +
+					  sizeof(struct arm_request) +
+					  sizeof(struct arm_response));
+		arm_req->buffer_length = length;
+		arm_req->generation = req->req.generation;
+		arm_req->extended_transaction_code = 0;
+		arm_req->destination_offset = addr;
+		arm_req->source_nodeid = nodeid;
+		arm_req->destination_nodeid = destid;
+		arm_req->tlabel = (flags >> 10) & 0x3f;
+		arm_req->tcode = (flags >> 4) & 0x0f;
+		arm_resp->buffer_length = 0;
+		arm_resp->response_code = rcode;
+		arm_req_resp->request = int2ptr((arm_addr->recvb) +
+						sizeof(struct
+						       arm_request_response));
+		arm_req_resp->response =
+		    int2ptr((arm_addr->recvb) +
+			    sizeof(struct arm_request_response) +
+			    sizeof(struct arm_request));
+		queue_complete_req(req);
+	}
+	spin_unlock(&host_info_lock);
+	return (rcode);
+}
+
+static int arm_lock(struct hpsb_host *host, int nodeid, quadlet_t * store,
+		    u64 addr, quadlet_t data, quadlet_t arg, int ext_tcode,
+		    u16 flags)
+{
+	struct pending_request *req;
+	struct host_info *hi;
+	struct file_info *fi = NULL;
+	struct list_head *entry;
+	struct arm_addr *arm_addr = NULL;
+	struct arm_request *arm_req = NULL;
+	struct arm_response *arm_resp = NULL;
+	int found = 0, size = 0, rcode = -1;
+	quadlet_t old, new;
+	struct arm_request_response *arm_req_resp = NULL;
+
+	if (((ext_tcode & 0xFF) == EXTCODE_FETCH_ADD) ||
+	    ((ext_tcode & 0xFF) == EXTCODE_LITTLE_ADD)) {
+		DBGMSG("arm_lock  called by node: %X "
+		       "addr: %4.4x %8.8x extcode: %2.2X data: %8.8X",
+		       nodeid, (u16) ((addr >> 32) & 0xFFFF),
+		       (u32) (addr & 0xFFFFFFFF), ext_tcode & 0xFF,
+		       be32_to_cpu(data));
+	} else {
+		DBGMSG("arm_lock  called by node: %X "
+		       "addr: %4.4x %8.8x extcode: %2.2X data: %8.8X arg: %8.8X",
+		       nodeid, (u16) ((addr >> 32) & 0xFFFF),
+		       (u32) (addr & 0xFFFFFFFF), ext_tcode & 0xFF,
+		       be32_to_cpu(data), be32_to_cpu(arg));
+	}
+	spin_lock(&host_info_lock);
+	hi = find_host_info(host);	/* search address-entry */
+	if (hi != NULL) {
+		list_for_each_entry(fi, &hi->file_info_list, list) {
+			entry = fi->addr_list.next;
+			while (entry != &(fi->addr_list)) {
+				arm_addr =
+				    list_entry(entry, struct arm_addr,
+					       addr_list);
+				if (((arm_addr->start) <= (addr))
+				    && ((arm_addr->end) >=
+					(addr + sizeof(*store)))) {
+					found = 1;
+					break;
+				}
+				entry = entry->next;
+			}
+			if (found) {
+				break;
+			}
+		}
+	}
+	rcode = -1;
+	if (!found) {
+		printk(KERN_ERR "raw1394: arm_lock FAILED addr_entry not found"
+		       " -> rcode_address_error\n");
+		spin_unlock(&host_info_lock);
+		return (RCODE_ADDRESS_ERROR);
+	} else {
+		DBGMSG("arm_lock addr_entry FOUND");
+	}
+	if (rcode == -1) {
+		if (arm_addr->access_rights & ARM_LOCK) {
+			if (!(arm_addr->client_transactions & ARM_LOCK)) {
+				memcpy(&old,
+				       (arm_addr->addr_space_buffer) + (addr -
+									(arm_addr->
+									 start)),
+				       sizeof(old));
+				switch (ext_tcode) {
+				case (EXTCODE_MASK_SWAP):
+					new = data | (old & ~arg);
+					break;
+				case (EXTCODE_COMPARE_SWAP):
+					if (old == arg) {
+						new = data;
+					} else {
+						new = old;
+					}
+					break;
+				case (EXTCODE_FETCH_ADD):
+					new =
+					    cpu_to_be32(be32_to_cpu(data) +
+							be32_to_cpu(old));
+					break;
+				case (EXTCODE_LITTLE_ADD):
+					new =
+					    cpu_to_le32(le32_to_cpu(data) +
+							le32_to_cpu(old));
+					break;
+				case (EXTCODE_BOUNDED_ADD):
+					if (old != arg) {
+						new =
+						    cpu_to_be32(be32_to_cpu
+								(data) +
+								be32_to_cpu
+								(old));
+					} else {
+						new = old;
+					}
+					break;
+				case (EXTCODE_WRAP_ADD):
+					if (old != arg) {
+						new =
+						    cpu_to_be32(be32_to_cpu
+								(data) +
+								be32_to_cpu
+								(old));
+					} else {
+						new = data;
+					}
+					break;
+				default:
+					rcode = RCODE_TYPE_ERROR;	/* function not allowed */
+					printk(KERN_ERR
+					       "raw1394: arm_lock FAILED "
+					       "ext_tcode not allowed -> rcode_type_error\n");
+					break;
+				}	/*switch */
+				if (rcode == -1) {
+					DBGMSG("arm_lock -> (rcode_complete)");
+					rcode = RCODE_COMPLETE;
+					memcpy(store, &old, sizeof(*store));
+					memcpy((arm_addr->addr_space_buffer) +
+					       (addr - (arm_addr->start)),
+					       &new, sizeof(*store));
+				}
+			}
+		} else {
+			rcode = RCODE_TYPE_ERROR;	/* function not allowed */
+			DBGMSG("arm_lock -> rcode_type_error (access denied)");
+		}
+	}
+	if (arm_addr->notification_options & ARM_LOCK) {
 		byte_t *buf1, *buf2;
-                DBGMSG("arm_lock -> entering notification-section");
-                req = __alloc_pending_request(SLAB_ATOMIC);
-                if (!req) {
-                        DBGMSG("arm_lock -> rcode_conflict_error");
-                        spin_unlock(&host_info_lock);
-                        return(RCODE_CONFLICT_ERROR); /* A resource conflict was detected.
-                                                        The request may be retried */
-                }
-                size =  sizeof(struct arm_request)+sizeof(struct arm_response) +
-                        3 * sizeof(*store) +
-                        sizeof (struct arm_request_response);  /* maximum */
-                req->data = kmalloc(size, SLAB_ATOMIC);
-                if (!(req->data)) {
-                        free_pending_request(req);
-                        DBGMSG("arm_lock -> rcode_conflict_error");
-                        spin_unlock(&host_info_lock);
-                        return(RCODE_CONFLICT_ERROR); /* A resource conflict was detected.
-                                                        The request may be retried */
-                }
-                req->free_data=1;
-                arm_req_resp = (struct arm_request_response *) (req->data);
-                arm_req  = (struct arm_request *) ((byte_t *)(req->data) +
-                        (sizeof (struct arm_request_response)));
-                arm_resp = (struct arm_response *) ((byte_t *)(arm_req) +
-                        (sizeof(struct arm_request)));
-                buf1 = (byte_t *)arm_resp + sizeof(struct arm_response);
+		DBGMSG("arm_lock -> entering notification-section");
+		req = __alloc_pending_request(SLAB_ATOMIC);
+		if (!req) {
+			DBGMSG("arm_lock -> rcode_conflict_error");
+			spin_unlock(&host_info_lock);
+			return (RCODE_CONFLICT_ERROR);	/* A resource conflict was detected.
+							   The request may be retried */
+		}
+		size = sizeof(struct arm_request) + sizeof(struct arm_response) + 3 * sizeof(*store) + sizeof(struct arm_request_response);	/* maximum */
+		req->data = kmalloc(size, SLAB_ATOMIC);
+		if (!(req->data)) {
+			free_pending_request(req);
+			DBGMSG("arm_lock -> rcode_conflict_error");
+			spin_unlock(&host_info_lock);
+			return (RCODE_CONFLICT_ERROR);	/* A resource conflict was detected.
+							   The request may be retried */
+		}
+		req->free_data = 1;
+		arm_req_resp = (struct arm_request_response *)(req->data);
+		arm_req = (struct arm_request *)((byte_t *) (req->data) +
+						 (sizeof
+						  (struct
+						   arm_request_response)));
+		arm_resp =
+		    (struct arm_response *)((byte_t *) (arm_req) +
+					    (sizeof(struct arm_request)));
+		buf1 = (byte_t *) arm_resp + sizeof(struct arm_response);
 		buf2 = buf1 + 2 * sizeof(*store);
-                if ((ext_tcode == EXTCODE_FETCH_ADD) ||
-                        (ext_tcode == EXTCODE_LITTLE_ADD)) {
-                        arm_req->buffer_length = sizeof(*store);
-                        memcpy (buf1, &data, sizeof(*store));
-
-                } else {
-                        arm_req->buffer_length = 2 * sizeof(*store);
-                        memcpy (buf1, &arg,  sizeof(*store));
-                        memcpy (buf1 + sizeof(*store), &data, sizeof(*store));
-                }
-                if (rcode == RCODE_COMPLETE) {
-                        arm_resp->buffer_length = sizeof(*store);
-                        memcpy (buf2, &old, sizeof(*store));
-                } else {
-                        arm_resp->buffer_length = 0;
-                }
-                req->file_info = fi;
-                req->req.type = RAW1394_REQ_ARM;
-                req->req.generation = get_hpsb_generation(host);
-                req->req.misc = ( (((sizeof(*store)) << 16) & (0xFFFF0000)) |
-                        (ARM_LOCK & 0xFF));
-                req->req.tag  = arm_addr->arm_tag;
-                req->req.recvb = arm_addr->recvb;
-                req->req.length = size;
-                arm_req->generation = req->req.generation;
-                arm_req->extended_transaction_code = ext_tcode;
-                arm_req->destination_offset = addr;
-                arm_req->source_nodeid = nodeid;
-                arm_req->destination_nodeid = host->node_id;
-                arm_req->tlabel = (flags >> 10) & 0x3f;
-                arm_req->tcode = (flags >> 4) & 0x0f;
-                arm_resp->response_code = rcode;
-                arm_req_resp->request  = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response));
-                arm_req_resp->response = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response) +
-                        sizeof (struct arm_request));
-                arm_req->buffer = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response) +
-                        sizeof (struct arm_request) +
-                        sizeof (struct arm_response));
-                arm_resp->buffer = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response) +
-                        sizeof (struct arm_request) +
-                        sizeof (struct arm_response) +
-                        2* sizeof (*store));
-                queue_complete_req(req);
-        }
-        spin_unlock(&host_info_lock);
-        return(rcode);
-}
-
-static int arm_lock64 (struct hpsb_host *host, int nodeid, octlet_t *store,
-               u64 addr, octlet_t data, octlet_t arg, int ext_tcode, u16 flags)
-{
-        struct pending_request *req;
-        struct host_info *hi;
-        struct file_info *fi = NULL;
-        struct list_head *entry;
-        struct arm_addr  *arm_addr = NULL;
-        struct arm_request  *arm_req = NULL;
-        struct arm_response *arm_resp = NULL;
-        int found=0, size=0, rcode=-1;
-        octlet_t old, new;
-        struct arm_request_response *arm_req_resp = NULL;
-
-        if (((ext_tcode & 0xFF) == EXTCODE_FETCH_ADD) ||
-                ((ext_tcode & 0xFF) == EXTCODE_LITTLE_ADD)) {
-                DBGMSG("arm_lock64 called by node: %X "
-                      "addr: %4.4x %8.8x extcode: %2.2X data: %8.8X %8.8X ",
-                      nodeid, (u16) ((addr >>32) & 0xFFFF),
-                      (u32) (addr & 0xFFFFFFFF),
-                      ext_tcode & 0xFF ,
-                      (u32) ((be64_to_cpu(data) >> 32) & 0xFFFFFFFF),
-                      (u32) (be64_to_cpu(data) & 0xFFFFFFFF));
-        } else {
-                DBGMSG("arm_lock64 called by node: %X "
-                      "addr: %4.4x %8.8x extcode: %2.2X data: %8.8X %8.8X arg: "
-                      "%8.8X %8.8X ",
-                      nodeid, (u16) ((addr >>32) & 0xFFFF),
-                      (u32) (addr & 0xFFFFFFFF),
-                      ext_tcode & 0xFF ,
-                      (u32) ((be64_to_cpu(data) >> 32) & 0xFFFFFFFF),
-                      (u32) (be64_to_cpu(data) & 0xFFFFFFFF),
-                      (u32) ((be64_to_cpu(arg)  >> 32) & 0xFFFFFFFF),
-                      (u32) (be64_to_cpu(arg)  & 0xFFFFFFFF));
-        }
-        spin_lock(&host_info_lock);
-        hi = find_host_info(host); /* search addressentry in file_info's for host */
-        if (hi != NULL) {
-                list_for_each_entry(fi, &hi->file_info_list, list) {
-                        entry = fi->addr_list.next;
-                        while (entry != &(fi->addr_list)) {
-                                arm_addr = list_entry(entry, struct arm_addr, addr_list);
-                                if (((arm_addr->start) <= (addr)) &&
-                                        ((arm_addr->end) >= (addr+sizeof(*store)))) {
-                                        found = 1;
-                                        break;
-                                }
-                                entry = entry->next;
-                        }
-                        if (found) {
-                                break;
-                        }
-                }
-        }
-        rcode = -1;
-        if (!found) {
-                printk(KERN_ERR "raw1394: arm_lock64 FAILED addr_entry not found"
-                " -> rcode_address_error\n");
-                spin_unlock(&host_info_lock);
-                return (RCODE_ADDRESS_ERROR);
-        } else {
-                DBGMSG("arm_lock64 addr_entry FOUND");
-        }
-        if (rcode == -1) {
-                if (arm_addr->access_rights & ARM_LOCK) {
-                        if (!(arm_addr->client_transactions & ARM_LOCK)) {
-                                memcpy(&old,(arm_addr->addr_space_buffer)+(addr-(arm_addr->start)),
-                                        sizeof(old));
-                                switch (ext_tcode) {
-                                        case (EXTCODE_MASK_SWAP):
-                                                new = data | (old & ~arg);
-                                                break;
-                                        case (EXTCODE_COMPARE_SWAP):
-                                                if (old == arg) {
-                                                        new = data;
-                                                } else {
-                                                        new = old;
-                                                }
-                                                break;
-                                        case (EXTCODE_FETCH_ADD):
-                                                new = cpu_to_be64(be64_to_cpu(data) + be64_to_cpu(old));
-                                                break;
-                                        case (EXTCODE_LITTLE_ADD):
-                                                new = cpu_to_le64(le64_to_cpu(data) + le64_to_cpu(old));
-                                                break;
-                                        case (EXTCODE_BOUNDED_ADD):
-                                                if (old != arg) {
-                                                        new = cpu_to_be64(be64_to_cpu(data) +
-                                                                be64_to_cpu(old));
-                                                } else {
-                                                        new = old;
-                                                }
-                                                break;
-                                        case (EXTCODE_WRAP_ADD):
-                                                if (old != arg) {
-                                                        new = cpu_to_be64(be64_to_cpu(data) +
-                                                                be64_to_cpu(old));
-                                                } else {
-                                                        new = data;
-                                                }
-                                                break;
-                                        default:
-                                                printk(KERN_ERR "raw1394: arm_lock64 FAILED "
-                                                "ext_tcode not allowed -> rcode_type_error\n");
-                                                rcode = RCODE_TYPE_ERROR; /* function not allowed */
-                                                break;
-                                } /*switch*/
-                                if (rcode == -1) {
-                                        DBGMSG("arm_lock64 -> (rcode_complete)");
-                                        rcode = RCODE_COMPLETE;
-                                        memcpy (store, &old, sizeof(*store));
-                                        memcpy ((arm_addr->addr_space_buffer)+
-                                                (addr-(arm_addr->start)),
-                                                &new, sizeof(*store));
-                                }
-                        }
-                } else {
-                        rcode = RCODE_TYPE_ERROR; /* function not allowed */
-                        DBGMSG("arm_lock64 -> rcode_type_error (access denied)");
-                }
-        }
-        if (arm_addr->notification_options & ARM_LOCK) {
+		if ((ext_tcode == EXTCODE_FETCH_ADD) ||
+		    (ext_tcode == EXTCODE_LITTLE_ADD)) {
+			arm_req->buffer_length = sizeof(*store);
+			memcpy(buf1, &data, sizeof(*store));
+
+		} else {
+			arm_req->buffer_length = 2 * sizeof(*store);
+			memcpy(buf1, &arg, sizeof(*store));
+			memcpy(buf1 + sizeof(*store), &data, sizeof(*store));
+		}
+		if (rcode == RCODE_COMPLETE) {
+			arm_resp->buffer_length = sizeof(*store);
+			memcpy(buf2, &old, sizeof(*store));
+		} else {
+			arm_resp->buffer_length = 0;
+		}
+		req->file_info = fi;
+		req->req.type = RAW1394_REQ_ARM;
+		req->req.generation = get_hpsb_generation(host);
+		req->req.misc = ((((sizeof(*store)) << 16) & (0xFFFF0000)) |
+				 (ARM_LOCK & 0xFF));
+		req->req.tag = arm_addr->arm_tag;
+		req->req.recvb = arm_addr->recvb;
+		req->req.length = size;
+		arm_req->generation = req->req.generation;
+		arm_req->extended_transaction_code = ext_tcode;
+		arm_req->destination_offset = addr;
+		arm_req->source_nodeid = nodeid;
+		arm_req->destination_nodeid = host->node_id;
+		arm_req->tlabel = (flags >> 10) & 0x3f;
+		arm_req->tcode = (flags >> 4) & 0x0f;
+		arm_resp->response_code = rcode;
+		arm_req_resp->request = int2ptr((arm_addr->recvb) +
+						sizeof(struct
+						       arm_request_response));
+		arm_req_resp->response =
+		    int2ptr((arm_addr->recvb) +
+			    sizeof(struct arm_request_response) +
+			    sizeof(struct arm_request));
+		arm_req->buffer =
+		    int2ptr((arm_addr->recvb) +
+			    sizeof(struct arm_request_response) +
+			    sizeof(struct arm_request) +
+			    sizeof(struct arm_response));
+		arm_resp->buffer =
+		    int2ptr((arm_addr->recvb) +
+			    sizeof(struct arm_request_response) +
+			    sizeof(struct arm_request) +
+			    sizeof(struct arm_response) + 2 * sizeof(*store));
+		queue_complete_req(req);
+	}
+	spin_unlock(&host_info_lock);
+	return (rcode);
+}
+
+static int arm_lock64(struct hpsb_host *host, int nodeid, octlet_t * store,
+		      u64 addr, octlet_t data, octlet_t arg, int ext_tcode,
+		      u16 flags)
+{
+	struct pending_request *req;
+	struct host_info *hi;
+	struct file_info *fi = NULL;
+	struct list_head *entry;
+	struct arm_addr *arm_addr = NULL;
+	struct arm_request *arm_req = NULL;
+	struct arm_response *arm_resp = NULL;
+	int found = 0, size = 0, rcode = -1;
+	octlet_t old, new;
+	struct arm_request_response *arm_req_resp = NULL;
+
+	if (((ext_tcode & 0xFF) == EXTCODE_FETCH_ADD) ||
+	    ((ext_tcode & 0xFF) == EXTCODE_LITTLE_ADD)) {
+		DBGMSG("arm_lock64 called by node: %X "
+		       "addr: %4.4x %8.8x extcode: %2.2X data: %8.8X %8.8X ",
+		       nodeid, (u16) ((addr >> 32) & 0xFFFF),
+		       (u32) (addr & 0xFFFFFFFF),
+		       ext_tcode & 0xFF,
+		       (u32) ((be64_to_cpu(data) >> 32) & 0xFFFFFFFF),
+		       (u32) (be64_to_cpu(data) & 0xFFFFFFFF));
+	} else {
+		DBGMSG("arm_lock64 called by node: %X "
+		       "addr: %4.4x %8.8x extcode: %2.2X data: %8.8X %8.8X arg: "
+		       "%8.8X %8.8X ",
+		       nodeid, (u16) ((addr >> 32) & 0xFFFF),
+		       (u32) (addr & 0xFFFFFFFF),
+		       ext_tcode & 0xFF,
+		       (u32) ((be64_to_cpu(data) >> 32) & 0xFFFFFFFF),
+		       (u32) (be64_to_cpu(data) & 0xFFFFFFFF),
+		       (u32) ((be64_to_cpu(arg) >> 32) & 0xFFFFFFFF),
+		       (u32) (be64_to_cpu(arg) & 0xFFFFFFFF));
+	}
+	spin_lock(&host_info_lock);
+	hi = find_host_info(host);	/* search addressentry in file_info's for host */
+	if (hi != NULL) {
+		list_for_each_entry(fi, &hi->file_info_list, list) {
+			entry = fi->addr_list.next;
+			while (entry != &(fi->addr_list)) {
+				arm_addr =
+				    list_entry(entry, struct arm_addr,
+					       addr_list);
+				if (((arm_addr->start) <= (addr))
+				    && ((arm_addr->end) >=
+					(addr + sizeof(*store)))) {
+					found = 1;
+					break;
+				}
+				entry = entry->next;
+			}
+			if (found) {
+				break;
+			}
+		}
+	}
+	rcode = -1;
+	if (!found) {
+		printk(KERN_ERR
+		       "raw1394: arm_lock64 FAILED addr_entry not found"
+		       " -> rcode_address_error\n");
+		spin_unlock(&host_info_lock);
+		return (RCODE_ADDRESS_ERROR);
+	} else {
+		DBGMSG("arm_lock64 addr_entry FOUND");
+	}
+	if (rcode == -1) {
+		if (arm_addr->access_rights & ARM_LOCK) {
+			if (!(arm_addr->client_transactions & ARM_LOCK)) {
+				memcpy(&old,
+				       (arm_addr->addr_space_buffer) + (addr -
+									(arm_addr->
+									 start)),
+				       sizeof(old));
+				switch (ext_tcode) {
+				case (EXTCODE_MASK_SWAP):
+					new = data | (old & ~arg);
+					break;
+				case (EXTCODE_COMPARE_SWAP):
+					if (old == arg) {
+						new = data;
+					} else {
+						new = old;
+					}
+					break;
+				case (EXTCODE_FETCH_ADD):
+					new =
+					    cpu_to_be64(be64_to_cpu(data) +
+							be64_to_cpu(old));
+					break;
+				case (EXTCODE_LITTLE_ADD):
+					new =
+					    cpu_to_le64(le64_to_cpu(data) +
+							le64_to_cpu(old));
+					break;
+				case (EXTCODE_BOUNDED_ADD):
+					if (old != arg) {
+						new =
+						    cpu_to_be64(be64_to_cpu
+								(data) +
+								be64_to_cpu
+								(old));
+					} else {
+						new = old;
+					}
+					break;
+				case (EXTCODE_WRAP_ADD):
+					if (old != arg) {
+						new =
+						    cpu_to_be64(be64_to_cpu
+								(data) +
+								be64_to_cpu
+								(old));
+					} else {
+						new = data;
+					}
+					break;
+				default:
+					printk(KERN_ERR
+					       "raw1394: arm_lock64 FAILED "
+					       "ext_tcode not allowed -> rcode_type_error\n");
+					rcode = RCODE_TYPE_ERROR;	/* function not allowed */
+					break;
+				}	/*switch */
+				if (rcode == -1) {
+					DBGMSG
+					    ("arm_lock64 -> (rcode_complete)");
+					rcode = RCODE_COMPLETE;
+					memcpy(store, &old, sizeof(*store));
+					memcpy((arm_addr->addr_space_buffer) +
+					       (addr - (arm_addr->start)),
+					       &new, sizeof(*store));
+				}
+			}
+		} else {
+			rcode = RCODE_TYPE_ERROR;	/* function not allowed */
+			DBGMSG
+			    ("arm_lock64 -> rcode_type_error (access denied)");
+		}
+	}
+	if (arm_addr->notification_options & ARM_LOCK) {
 		byte_t *buf1, *buf2;
-                DBGMSG("arm_lock64 -> entering notification-section");
-                req = __alloc_pending_request(SLAB_ATOMIC);
-                if (!req) {
-                        spin_unlock(&host_info_lock);
-                        DBGMSG("arm_lock64 -> rcode_conflict_error");
-                        return(RCODE_CONFLICT_ERROR); /* A resource conflict was detected.
-                                                        The request may be retried */
-                }
-                size =  sizeof(struct arm_request)+sizeof(struct arm_response) +
-                        3 * sizeof(*store) +
-                        sizeof (struct arm_request_response); /* maximum */
-                req->data = kmalloc(size, SLAB_ATOMIC);
-                if (!(req->data)) {
-                        free_pending_request(req);
-                        spin_unlock(&host_info_lock);
-                        DBGMSG("arm_lock64 -> rcode_conflict_error");
-                        return(RCODE_CONFLICT_ERROR); /* A resource conflict was detected.
-                                                        The request may be retried */
-                }
-                req->free_data=1;
-                arm_req_resp = (struct arm_request_response *) (req->data);
-                arm_req  = (struct arm_request *) ((byte_t *)(req->data) +
-                        (sizeof (struct arm_request_response)));
-                arm_resp = (struct arm_response *) ((byte_t *)(arm_req) +
-                        (sizeof(struct arm_request)));
-                buf1 = (byte_t *)arm_resp + sizeof(struct arm_response);
-                buf2 = buf1 + 2 * sizeof(*store);
-                if ((ext_tcode == EXTCODE_FETCH_ADD) ||
-                        (ext_tcode == EXTCODE_LITTLE_ADD)) {
-                        arm_req->buffer_length = sizeof(*store);
-                        memcpy (buf1, &data, sizeof(*store));
-
-                } else {
-                        arm_req->buffer_length = 2 * sizeof(*store);
-                        memcpy (buf1, &arg,  sizeof(*store));
-                        memcpy (buf1 + sizeof(*store), &data, sizeof(*store));
-                }
-                if (rcode == RCODE_COMPLETE) {
-                        arm_resp->buffer_length = sizeof(*store);
-                        memcpy (buf2, &old, sizeof(*store));
-                } else {
-                        arm_resp->buffer_length = 0;
-                }
-                req->file_info = fi;
-                req->req.type = RAW1394_REQ_ARM;
-                req->req.generation = get_hpsb_generation(host);
-                req->req.misc = ( (((sizeof(*store)) << 16) & (0xFFFF0000)) |
-                        (ARM_LOCK & 0xFF));
-                req->req.tag  = arm_addr->arm_tag;
-                req->req.recvb = arm_addr->recvb;
-                req->req.length = size;
-                arm_req->generation = req->req.generation;
-                arm_req->extended_transaction_code = ext_tcode;
-                arm_req->destination_offset = addr;
-                arm_req->source_nodeid = nodeid;
-                arm_req->destination_nodeid = host->node_id;
-                arm_req->tlabel = (flags >> 10) & 0x3f;
-                arm_req->tcode = (flags >> 4) & 0x0f;
-                arm_resp->response_code = rcode;
-                arm_req_resp->request  = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response));
-                arm_req_resp->response = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response) +
-                        sizeof (struct arm_request));
-                arm_req->buffer = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response) +
-                        sizeof (struct arm_request) +
-                        sizeof (struct arm_response));
-                arm_resp->buffer = int2ptr((arm_addr->recvb) +
-                        sizeof (struct arm_request_response) +
-                        sizeof (struct arm_request) +
-                        sizeof (struct arm_response) +
-                        2* sizeof (*store));
-                queue_complete_req(req);
-        }
-        spin_unlock(&host_info_lock);
-        return(rcode);
+		DBGMSG("arm_lock64 -> entering notification-section");
+		req = __alloc_pending_request(SLAB_ATOMIC);
+		if (!req) {
+			spin_unlock(&host_info_lock);
+			DBGMSG("arm_lock64 -> rcode_conflict_error");
+			return (RCODE_CONFLICT_ERROR);	/* A resource conflict was detected.
+							   The request may be retried */
+		}
+		size = sizeof(struct arm_request) + sizeof(struct arm_response) + 3 * sizeof(*store) + sizeof(struct arm_request_response);	/* maximum */
+		req->data = kmalloc(size, SLAB_ATOMIC);
+		if (!(req->data)) {
+			free_pending_request(req);
+			spin_unlock(&host_info_lock);
+			DBGMSG("arm_lock64 -> rcode_conflict_error");
+			return (RCODE_CONFLICT_ERROR);	/* A resource conflict was detected.
+							   The request may be retried */
+		}
+		req->free_data = 1;
+		arm_req_resp = (struct arm_request_response *)(req->data);
+		arm_req = (struct arm_request *)((byte_t *) (req->data) +
+						 (sizeof
+						  (struct
+						   arm_request_response)));
+		arm_resp =
+		    (struct arm_response *)((byte_t *) (arm_req) +
+					    (sizeof(struct arm_request)));
+		buf1 = (byte_t *) arm_resp + sizeof(struct arm_response);
+		buf2 = buf1 + 2 * sizeof(*store);
+		if ((ext_tcode == EXTCODE_FETCH_ADD) ||
+		    (ext_tcode == EXTCODE_LITTLE_ADD)) {
+			arm_req->buffer_length = sizeof(*store);
+			memcpy(buf1, &data, sizeof(*store));
+
+		} else {
+			arm_req->buffer_length = 2 * sizeof(*store);
+			memcpy(buf1, &arg, sizeof(*store));
+			memcpy(buf1 + sizeof(*store), &data, sizeof(*store));
+		}
+		if (rcode == RCODE_COMPLETE) {
+			arm_resp->buffer_length = sizeof(*store);
+			memcpy(buf2, &old, sizeof(*store));
+		} else {
+			arm_resp->buffer_length = 0;
+		}
+		req->file_info = fi;
+		req->req.type = RAW1394_REQ_ARM;
+		req->req.generation = get_hpsb_generation(host);
+		req->req.misc = ((((sizeof(*store)) << 16) & (0xFFFF0000)) |
+				 (ARM_LOCK & 0xFF));
+		req->req.tag = arm_addr->arm_tag;
+		req->req.recvb = arm_addr->recvb;
+		req->req.length = size;
+		arm_req->generation = req->req.generation;
+		arm_req->extended_transaction_code = ext_tcode;
+		arm_req->destination_offset = addr;
+		arm_req->source_nodeid = nodeid;
+		arm_req->destination_nodeid = host->node_id;
+		arm_req->tlabel = (flags >> 10) & 0x3f;
+		arm_req->tcode = (flags >> 4) & 0x0f;
+		arm_resp->response_code = rcode;
+		arm_req_resp->request = int2ptr((arm_addr->recvb) +
+						sizeof(struct
+						       arm_request_response));
+		arm_req_resp->response =
+		    int2ptr((arm_addr->recvb) +
+			    sizeof(struct arm_request_response) +
+			    sizeof(struct arm_request));
+		arm_req->buffer =
+		    int2ptr((arm_addr->recvb) +
+			    sizeof(struct arm_request_response) +
+			    sizeof(struct arm_request) +
+			    sizeof(struct arm_response));
+		arm_resp->buffer =
+		    int2ptr((arm_addr->recvb) +
+			    sizeof(struct arm_request_response) +
+			    sizeof(struct arm_request) +
+			    sizeof(struct arm_response) + 2 * sizeof(*store));
+		queue_complete_req(req);
+	}
+	spin_unlock(&host_info_lock);
+	return (rcode);
 }
 
 static int arm_register(struct file_info *fi, struct pending_request *req)
 {
-        int retval;
-        struct arm_addr *addr;
-        struct host_info *hi;
-        struct file_info *fi_hlp = NULL;
-        struct list_head *entry;
-        struct arm_addr  *arm_addr = NULL;
-        int same_host, another_host;
-        unsigned long flags;
-
-        DBGMSG("arm_register called "
-              "addr(Offset): %8.8x %8.8x length: %u "
-              "rights: %2.2X notify: %2.2X "
-              "max_blk_len: %4.4X",
-              (u32) ((req->req.address >>32) & 0xFFFF),
-              (u32) (req->req.address & 0xFFFFFFFF),
-              req->req.length, ((req->req.misc >> 8) & 0xFF),
-              (req->req.misc & 0xFF),((req->req.misc >> 16) & 0xFFFF));
-        /* check addressrange */
-        if ((((req->req.address) & ~(0xFFFFFFFFFFFFULL)) != 0) ||
-                (((req->req.address + req->req.length) & ~(0xFFFFFFFFFFFFULL)) != 0)) {
-                req->req.length = 0;
-                return (-EINVAL);
-        }
-        /* addr-list-entry for fileinfo */
-        addr = (struct arm_addr *)kmalloc(sizeof(struct arm_addr), SLAB_KERNEL);
-        if (!addr) {
-                req->req.length = 0;
-                return (-ENOMEM);
-        }
-        /* allocation of addr_space_buffer */
-        addr->addr_space_buffer = (u8 *)vmalloc(req->req.length);
-        if (!(addr->addr_space_buffer)) {
-                kfree(addr);
-                req->req.length = 0;
-                return (-ENOMEM);
-        }
-        /* initialization of addr_space_buffer */
-        if ((req->req.sendb)== (unsigned long)NULL) {
-                /* init: set 0 */
-                memset(addr->addr_space_buffer, 0,req->req.length);
-        } else {
-                /* init: user -> kernel */
-                if (copy_from_user(addr->addr_space_buffer,int2ptr(req->req.sendb),
-                        req->req.length)) {
-                        vfree(addr->addr_space_buffer);
-                        kfree(addr);
-                        return (-EFAULT);
-                }
-        }
-        INIT_LIST_HEAD(&addr->addr_list);
-        addr->arm_tag   = req->req.tag;
-        addr->start     = req->req.address;
-        addr->end       = req->req.address + req->req.length;
-        addr->access_rights = (u8) (req->req.misc & 0x0F);
-        addr->notification_options = (u8) ((req->req.misc >> 4) & 0x0F);
-        addr->client_transactions = (u8) ((req->req.misc >> 8) & 0x0F);
-        addr->access_rights |= addr->client_transactions;
-        addr->notification_options |= addr->client_transactions;
-        addr->recvb     = req->req.recvb;
-        addr->rec_length = (u16) ((req->req.misc >> 16) & 0xFFFF);
-        spin_lock_irqsave(&host_info_lock, flags);
-        hi = find_host_info(fi->host);
-        same_host = 0;
-        another_host = 0;
-        /* same host with address-entry containing same addressrange ? */
-        list_for_each_entry(fi_hlp, &hi->file_info_list, list) {
-                entry = fi_hlp->addr_list.next;
-                while (entry != &(fi_hlp->addr_list)) {
-                        arm_addr = list_entry(entry, struct arm_addr, addr_list);
-                        if ( (arm_addr->start == addr->start) &&
-                                (arm_addr->end == addr->end)) {
-                                DBGMSG("same host ownes same "
-                                        "addressrange -> EALREADY");
-                                same_host = 1;
-                                break;
-                        }
-                        entry = entry->next;
-                }
-                if (same_host) {
-                        break;
-                }
-        }
-        if (same_host) {
-                /* addressrange occupied by same host */
-                vfree(addr->addr_space_buffer);
-                kfree(addr);
-                spin_unlock_irqrestore(&host_info_lock, flags);
-                return (-EALREADY);
-        }
-        /* another host with valid address-entry containing same addressrange */
-        list_for_each_entry(hi, &host_info_list, list) {
-                if (hi->host != fi->host) {
-                        list_for_each_entry(fi_hlp, &hi->file_info_list, list) {
-                                entry = fi_hlp->addr_list.next;
-                                while (entry != &(fi_hlp->addr_list)) {
-                                        arm_addr = list_entry(entry, struct arm_addr, addr_list);
-                                        if ( (arm_addr->start == addr->start) &&
-                                                (arm_addr->end == addr->end)) {
-                                                DBGMSG("another host ownes same "
-                                                "addressrange");
-                                                another_host = 1;
-                                                break;
-                                        }
-                                        entry = entry->next;
-                                }
-                                if (another_host) {
-                                        break;
-                                }
-                        }
-                }
-        }
-        if (another_host) {
-                DBGMSG("another hosts entry is valid -> SUCCESS");
-                if (copy_to_user(int2ptr(req->req.recvb),
-                        &addr->start,sizeof(u64))) {
-                        printk(KERN_ERR "raw1394: arm_register failed "
-                              " address-range-entry is invalid -> EFAULT !!!\n");
-                        vfree(addr->addr_space_buffer);
-                        kfree(addr);
-                        spin_unlock_irqrestore(&host_info_lock, flags);
-                        return (-EFAULT);
-                }
-                free_pending_request(req); /* immediate success or fail */
-                /* INSERT ENTRY */
-                list_add_tail(&addr->addr_list, &fi->addr_list);
-                spin_unlock_irqrestore(&host_info_lock, flags);
-                return sizeof(struct raw1394_request);
-        }
-        retval = hpsb_register_addrspace(&raw1394_highlevel, fi->host, &arm_ops, req->req.address,
-                req->req.address + req->req.length);
-        if (retval) {
-               /* INSERT ENTRY */
-               list_add_tail(&addr->addr_list, &fi->addr_list);
-        } else {
-                DBGMSG("arm_register failed errno: %d \n",retval);
-                vfree(addr->addr_space_buffer);
-                kfree(addr);
-                spin_unlock_irqrestore(&host_info_lock, flags);
-                return (-EALREADY);
-        }
-        spin_unlock_irqrestore(&host_info_lock, flags);
-        free_pending_request(req); /* immediate success or fail */
-        return sizeof(struct raw1394_request);
+	int retval;
+	struct arm_addr *addr;
+	struct host_info *hi;
+	struct file_info *fi_hlp = NULL;
+	struct list_head *entry;
+	struct arm_addr *arm_addr = NULL;
+	int same_host, another_host;
+	unsigned long flags;
+
+	DBGMSG("arm_register called "
+	       "addr(Offset): %8.8x %8.8x length: %u "
+	       "rights: %2.2X notify: %2.2X "
+	       "max_blk_len: %4.4X",
+	       (u32) ((req->req.address >> 32) & 0xFFFF),
+	       (u32) (req->req.address & 0xFFFFFFFF),
+	       req->req.length, ((req->req.misc >> 8) & 0xFF),
+	       (req->req.misc & 0xFF), ((req->req.misc >> 16) & 0xFFFF));
+	/* check addressrange */
+	if ((((req->req.address) & ~(0xFFFFFFFFFFFFULL)) != 0) ||
+	    (((req->req.address + req->req.length) & ~(0xFFFFFFFFFFFFULL)) !=
+	     0)) {
+		req->req.length = 0;
+		return (-EINVAL);
+	}
+	/* addr-list-entry for fileinfo */
+	addr = (struct arm_addr *)kmalloc(sizeof(struct arm_addr), SLAB_KERNEL);
+	if (!addr) {
+		req->req.length = 0;
+		return (-ENOMEM);
+	}
+	/* allocation of addr_space_buffer */
+	addr->addr_space_buffer = (u8 *) vmalloc(req->req.length);
+	if (!(addr->addr_space_buffer)) {
+		kfree(addr);
+		req->req.length = 0;
+		return (-ENOMEM);
+	}
+	/* initialization of addr_space_buffer */
+	if ((req->req.sendb) == (unsigned long)NULL) {
+		/* init: set 0 */
+		memset(addr->addr_space_buffer, 0, req->req.length);
+	} else {
+		/* init: user -> kernel */
+		if (copy_from_user
+		    (addr->addr_space_buffer, int2ptr(req->req.sendb),
+		     req->req.length)) {
+			vfree(addr->addr_space_buffer);
+			kfree(addr);
+			return (-EFAULT);
+		}
+	}
+	INIT_LIST_HEAD(&addr->addr_list);
+	addr->arm_tag = req->req.tag;
+	addr->start = req->req.address;
+	addr->end = req->req.address + req->req.length;
+	addr->access_rights = (u8) (req->req.misc & 0x0F);
+	addr->notification_options = (u8) ((req->req.misc >> 4) & 0x0F);
+	addr->client_transactions = (u8) ((req->req.misc >> 8) & 0x0F);
+	addr->access_rights |= addr->client_transactions;
+	addr->notification_options |= addr->client_transactions;
+	addr->recvb = req->req.recvb;
+	addr->rec_length = (u16) ((req->req.misc >> 16) & 0xFFFF);
+	spin_lock_irqsave(&host_info_lock, flags);
+	hi = find_host_info(fi->host);
+	same_host = 0;
+	another_host = 0;
+	/* same host with address-entry containing same addressrange ? */
+	list_for_each_entry(fi_hlp, &hi->file_info_list, list) {
+		entry = fi_hlp->addr_list.next;
+		while (entry != &(fi_hlp->addr_list)) {
+			arm_addr =
+			    list_entry(entry, struct arm_addr, addr_list);
+			if ((arm_addr->start == addr->start)
+			    && (arm_addr->end == addr->end)) {
+				DBGMSG("same host ownes same "
+				       "addressrange -> EALREADY");
+				same_host = 1;
+				break;
+			}
+			entry = entry->next;
+		}
+		if (same_host) {
+			break;
+		}
+	}
+	if (same_host) {
+		/* addressrange occupied by same host */
+		vfree(addr->addr_space_buffer);
+		kfree(addr);
+		spin_unlock_irqrestore(&host_info_lock, flags);
+		return (-EALREADY);
+	}
+	/* another host with valid address-entry containing same addressrange */
+	list_for_each_entry(hi, &host_info_list, list) {
+		if (hi->host != fi->host) {
+			list_for_each_entry(fi_hlp, &hi->file_info_list, list) {
+				entry = fi_hlp->addr_list.next;
+				while (entry != &(fi_hlp->addr_list)) {
+					arm_addr =
+					    list_entry(entry, struct arm_addr,
+						       addr_list);
+					if ((arm_addr->start == addr->start)
+					    && (arm_addr->end == addr->end)) {
+						DBGMSG
+						    ("another host ownes same "
+						     "addressrange");
+						another_host = 1;
+						break;
+					}
+					entry = entry->next;
+				}
+				if (another_host) {
+					break;
+				}
+			}
+		}
+	}
+	if (another_host) {
+		DBGMSG("another hosts entry is valid -> SUCCESS");
+		if (copy_to_user(int2ptr(req->req.recvb),
+				 &addr->start, sizeof(u64))) {
+			printk(KERN_ERR "raw1394: arm_register failed "
+			       " address-range-entry is invalid -> EFAULT !!!\n");
+			vfree(addr->addr_space_buffer);
+			kfree(addr);
+			spin_unlock_irqrestore(&host_info_lock, flags);
+			return (-EFAULT);
+		}
+		free_pending_request(req);	/* immediate success or fail */
+		/* INSERT ENTRY */
+		list_add_tail(&addr->addr_list, &fi->addr_list);
+		spin_unlock_irqrestore(&host_info_lock, flags);
+		return sizeof(struct raw1394_request);
+	}
+	retval =
+	    hpsb_register_addrspace(&raw1394_highlevel, fi->host, &arm_ops,
+				    req->req.address,
+				    req->req.address + req->req.length);
+	if (retval) {
+		/* INSERT ENTRY */
+		list_add_tail(&addr->addr_list, &fi->addr_list);
+	} else {
+		DBGMSG("arm_register failed errno: %d \n", retval);
+		vfree(addr->addr_space_buffer);
+		kfree(addr);
+		spin_unlock_irqrestore(&host_info_lock, flags);
+		return (-EALREADY);
+	}
+	spin_unlock_irqrestore(&host_info_lock, flags);
+	free_pending_request(req);	/* immediate success or fail */
+	return sizeof(struct raw1394_request);
 }
 
 static int arm_unregister(struct file_info *fi, struct pending_request *req)
 {
-        int found  = 0;
-        int retval = 0;
-        struct list_head *entry;
-        struct arm_addr  *addr = NULL;
-        struct host_info *hi;
-        struct file_info *fi_hlp = NULL;
-        struct arm_addr  *arm_addr = NULL;
-        int another_host;
-        unsigned long flags;
-
-        DBGMSG("arm_Unregister called addr(Offset): "
-              "%8.8x %8.8x",
-              (u32) ((req->req.address >>32) & 0xFFFF),
-              (u32) (req->req.address & 0xFFFFFFFF));
-        spin_lock_irqsave(&host_info_lock, flags);
-        /* get addr */
-        entry = fi->addr_list.next;
-        while (entry != &(fi->addr_list)) {
-                addr = list_entry(entry, struct arm_addr, addr_list);
-                if (addr->start == req->req.address) {
-                        found = 1;
-                        break;
-                }
-                entry = entry->next;
-        }
-        if (!found) {
-                DBGMSG("arm_Unregister addr not found");
-                spin_unlock_irqrestore(&host_info_lock, flags);
-                return (-EINVAL);
-        }
-        DBGMSG("arm_Unregister addr found");
-        another_host = 0;
-        /* another host with valid address-entry containing
-           same addressrange */
-        list_for_each_entry(hi, &host_info_list, list) {
-                if (hi->host != fi->host) {
-                        list_for_each_entry(fi_hlp, &hi->file_info_list, list) {
-                                entry = fi_hlp->addr_list.next;
-                                while (entry != &(fi_hlp->addr_list)) {
-                                        arm_addr = list_entry(entry,
-                                                struct arm_addr, addr_list);
-                                        if (arm_addr->start ==
-                                                addr->start) {
-                                                DBGMSG("another host ownes "
-                                                "same addressrange");
-                                                another_host = 1;
-                                                break;
-                                        }
-                                        entry = entry->next;
-                                }
-                                if (another_host) {
-                                        break;
-                                }
-                        }
-                }
-        }
-        if (another_host) {
-                DBGMSG("delete entry from list -> success");
-                list_del(&addr->addr_list);
-                vfree(addr->addr_space_buffer);
-                kfree(addr);
-                free_pending_request(req); /* immediate success or fail */
-                spin_unlock_irqrestore(&host_info_lock, flags);
-                return sizeof(struct raw1394_request);
-        }
-        retval = hpsb_unregister_addrspace(&raw1394_highlevel, fi->host, addr->start);
-        if (!retval) {
-                printk(KERN_ERR "raw1394: arm_Unregister failed -> EINVAL\n");
-                spin_unlock_irqrestore(&host_info_lock, flags);
-                return (-EINVAL);
-        }
-        DBGMSG("delete entry from list -> success");
-        list_del(&addr->addr_list);
-        spin_unlock_irqrestore(&host_info_lock, flags);
-        vfree(addr->addr_space_buffer);
-        kfree(addr);
-        free_pending_request(req); /* immediate success or fail */
-        return sizeof(struct raw1394_request);
+	int found = 0;
+	int retval = 0;
+	struct list_head *entry;
+	struct arm_addr *addr = NULL;
+	struct host_info *hi;
+	struct file_info *fi_hlp = NULL;
+	struct arm_addr *arm_addr = NULL;
+	int another_host;
+	unsigned long flags;
+
+	DBGMSG("arm_Unregister called addr(Offset): "
+	       "%8.8x %8.8x",
+	       (u32) ((req->req.address >> 32) & 0xFFFF),
+	       (u32) (req->req.address & 0xFFFFFFFF));
+	spin_lock_irqsave(&host_info_lock, flags);
+	/* get addr */
+	entry = fi->addr_list.next;
+	while (entry != &(fi->addr_list)) {
+		addr = list_entry(entry, struct arm_addr, addr_list);
+		if (addr->start == req->req.address) {
+			found = 1;
+			break;
+		}
+		entry = entry->next;
+	}
+	if (!found) {
+		DBGMSG("arm_Unregister addr not found");
+		spin_unlock_irqrestore(&host_info_lock, flags);
+		return (-EINVAL);
+	}
+	DBGMSG("arm_Unregister addr found");
+	another_host = 0;
+	/* another host with valid address-entry containing
+	   same addressrange */
+	list_for_each_entry(hi, &host_info_list, list) {
+		if (hi->host != fi->host) {
+			list_for_each_entry(fi_hlp, &hi->file_info_list, list) {
+				entry = fi_hlp->addr_list.next;
+				while (entry != &(fi_hlp->addr_list)) {
+					arm_addr = list_entry(entry,
+							      struct arm_addr,
+							      addr_list);
+					if (arm_addr->start == addr->start) {
+						DBGMSG("another host ownes "
+						       "same addressrange");
+						another_host = 1;
+						break;
+					}
+					entry = entry->next;
+				}
+				if (another_host) {
+					break;
+				}
+			}
+		}
+	}
+	if (another_host) {
+		DBGMSG("delete entry from list -> success");
+		list_del(&addr->addr_list);
+		vfree(addr->addr_space_buffer);
+		kfree(addr);
+		free_pending_request(req);	/* immediate success or fail */
+		spin_unlock_irqrestore(&host_info_lock, flags);
+		return sizeof(struct raw1394_request);
+	}
+	retval =
+	    hpsb_unregister_addrspace(&raw1394_highlevel, fi->host,
+				      addr->start);
+	if (!retval) {
+		printk(KERN_ERR "raw1394: arm_Unregister failed -> EINVAL\n");
+		spin_unlock_irqrestore(&host_info_lock, flags);
+		return (-EINVAL);
+	}
+	DBGMSG("delete entry from list -> success");
+	list_del(&addr->addr_list);
+	spin_unlock_irqrestore(&host_info_lock, flags);
+	vfree(addr->addr_space_buffer);
+	kfree(addr);
+	free_pending_request(req);	/* immediate success or fail */
+	return sizeof(struct raw1394_request);
 }
 
 /* Copy data from ARM buffer(s) to user buffer. */
 static int arm_get_buf(struct file_info *fi, struct pending_request *req)
 {
-	struct arm_addr  *arm_addr = NULL;
+	struct arm_addr *arm_addr = NULL;
 	unsigned long flags;
 	unsigned long offset;
 
@@ -1749,8 +1864,7 @@
 	DBGMSG("arm_get_buf "
 	       "addr(Offset): %04X %08X length: %u",
 	       (u32) ((req->req.address >> 32) & 0xFFFF),
-	       (u32) (req->req.address & 0xFFFFFFFF),
-	       (u32) req->req.length);
+	       (u32) (req->req.address & 0xFFFFFFFF), (u32) req->req.length);
 
 	spin_lock_irqsave(&host_info_lock, flags);
 	entry = fi->addr_list.next;
@@ -1761,13 +1875,18 @@
 			if (req->req.address + req->req.length <= arm_addr->end) {
 				offset = req->req.address - arm_addr->start;
 
-				DBGMSG("arm_get_buf copy_to_user( %08X, %p, %u )",
-				       (u32) req->req.recvb,
-				       arm_addr->addr_space_buffer+offset,
-				       (u32) req->req.length);
-
-				if (copy_to_user(int2ptr(req->req.recvb), arm_addr->addr_space_buffer+offset, req->req.length)) {
-					spin_unlock_irqrestore(&host_info_lock, flags);
+				DBGMSG
+				    ("arm_get_buf copy_to_user( %08X, %p, %u )",
+				     (u32) req->req.recvb,
+				     arm_addr->addr_space_buffer + offset,
+				     (u32) req->req.length);
+
+				if (copy_to_user
+				    (int2ptr(req->req.recvb),
+				     arm_addr->addr_space_buffer + offset,
+				     req->req.length)) {
+					spin_unlock_irqrestore(&host_info_lock,
+							       flags);
 					return (-EFAULT);
 				}
 
@@ -1789,11 +1908,10 @@
 	return (-EINVAL);
 }
 
-
 /* Copy data from user buffer to ARM buffer(s). */
 static int arm_set_buf(struct file_info *fi, struct pending_request *req)
 {
-	struct arm_addr  *arm_addr = NULL;
+	struct arm_addr *arm_addr = NULL;
 	unsigned long flags;
 	unsigned long offset;
 
@@ -1802,9 +1920,7 @@
 	DBGMSG("arm_set_buf "
 	       "addr(Offset): %04X %08X length: %u",
 	       (u32) ((req->req.address >> 32) & 0xFFFF),
-	       (u32) (req->req.address & 0xFFFFFFFF),
-	       (u32) req->req.length);
-
+	       (u32) (req->req.address & 0xFFFFFFFF), (u32) req->req.length);
 
 	spin_lock_irqsave(&host_info_lock, flags);
 	entry = fi->addr_list.next;
@@ -1815,18 +1931,23 @@
 			if (req->req.address + req->req.length <= arm_addr->end) {
 				offset = req->req.address - arm_addr->start;
 
-				DBGMSG("arm_set_buf copy_from_user( %p, %08X, %u )",
-				       arm_addr->addr_space_buffer+offset,
-				       (u32) req->req.sendb,
-				       (u32) req->req.length);
-
-				if (copy_from_user(arm_addr->addr_space_buffer+offset, int2ptr(req->req.sendb), req->req.length)) {
-					spin_unlock_irqrestore(&host_info_lock, flags);
+				DBGMSG
+				    ("arm_set_buf copy_from_user( %p, %08X, %u )",
+				     arm_addr->addr_space_buffer + offset,
+				     (u32) req->req.sendb,
+				     (u32) req->req.length);
+
+				if (copy_from_user
+				    (arm_addr->addr_space_buffer + offset,
+				     int2ptr(req->req.sendb),
+				     req->req.length)) {
+					spin_unlock_irqrestore(&host_info_lock,
+							       flags);
 					return (-EFAULT);
 				}
 
 				spin_unlock_irqrestore(&host_info_lock, flags);
-				free_pending_request(req); /* we have to free the request, because we queue no response, and therefore nobody will free it */
+				free_pending_request(req);	/* we have to free the request, because we queue no response, and therefore nobody will free it */
 				return sizeof(struct raw1394_request);
 			} else {
 				DBGMSG("arm_set_buf request exceeded mapping");
@@ -1842,96 +1963,100 @@
 
 static int reset_notification(struct file_info *fi, struct pending_request *req)
 {
-        DBGMSG("reset_notification called - switch %s ",
-                (req->req.misc == RAW1394_NOTIFY_OFF)?"OFF":"ON");
-        if ((req->req.misc == RAW1394_NOTIFY_OFF) ||
-                (req->req.misc == RAW1394_NOTIFY_ON)) {
-                fi->notification=(u8)req->req.misc;
-                free_pending_request(req); /* we have to free the request, because we queue no response, and therefore nobody will free it */
-                return sizeof(struct raw1394_request);
-        }
-        /* error EINVAL (22) invalid argument */
-        return (-EINVAL);
+	DBGMSG("reset_notification called - switch %s ",
+	       (req->req.misc == RAW1394_NOTIFY_OFF) ? "OFF" : "ON");
+	if ((req->req.misc == RAW1394_NOTIFY_OFF) ||
+	    (req->req.misc == RAW1394_NOTIFY_ON)) {
+		fi->notification = (u8) req->req.misc;
+		free_pending_request(req);	/* we have to free the request, because we queue no response, and therefore nobody will free it */
+		return sizeof(struct raw1394_request);
+	}
+	/* error EINVAL (22) invalid argument */
+	return (-EINVAL);
 }
 
 static int write_phypacket(struct file_info *fi, struct pending_request *req)
 {
-        struct hpsb_packet *packet = NULL;
-        int retval=0;
-        quadlet_t data;
-
-        data = be32_to_cpu((u32)req->req.sendb);
-        DBGMSG("write_phypacket called - quadlet 0x%8.8x ",data);
-        packet = hpsb_make_phypacket (fi->host, data);
-        if (!packet) return -ENOMEM;
-        req->req.length=0;
-        req->packet=packet;
-        hpsb_set_packet_complete_task(packet, (void(*)(void*))queue_complete_cb, req);
-        spin_lock_irq(&fi->reqlists_lock);
-        list_add_tail(&req->list, &fi->req_pending);
-        spin_unlock_irq(&fi->reqlists_lock);
-        packet->generation = req->req.generation;
-        retval = hpsb_send_packet(packet);
-        DBGMSG("write_phypacket send_packet called => retval: %d ", retval);
-        if (retval < 0) {
-                req->req.error = RAW1394_ERROR_SEND_ERROR;
-                req->req.length = 0;
-                queue_complete_req(req);
-        }
-        return sizeof(struct raw1394_request);
+	struct hpsb_packet *packet = NULL;
+	int retval = 0;
+	quadlet_t data;
+
+	data = be32_to_cpu((u32) req->req.sendb);
+	DBGMSG("write_phypacket called - quadlet 0x%8.8x ", data);
+	packet = hpsb_make_phypacket(fi->host, data);
+	if (!packet)
+		return -ENOMEM;
+	req->req.length = 0;
+	req->packet = packet;
+	hpsb_set_packet_complete_task(packet,
+				      (void (*)(void *))queue_complete_cb, req);
+	spin_lock_irq(&fi->reqlists_lock);
+	list_add_tail(&req->list, &fi->req_pending);
+	spin_unlock_irq(&fi->reqlists_lock);
+	packet->generation = req->req.generation;
+	retval = hpsb_send_packet(packet);
+	DBGMSG("write_phypacket send_packet called => retval: %d ", retval);
+	if (retval < 0) {
+		req->req.error = RAW1394_ERROR_SEND_ERROR;
+		req->req.length = 0;
+		queue_complete_req(req);
+	}
+	return sizeof(struct raw1394_request);
 }
 
 static int get_config_rom(struct file_info *fi, struct pending_request *req)
 {
-        int ret=sizeof(struct raw1394_request);
-        quadlet_t *data = kmalloc(req->req.length, SLAB_KERNEL);
-        int status;
-
-        if (!data) return -ENOMEM;
-
-	status = csr1212_read(fi->host->csr.rom, CSR1212_CONFIG_ROM_SPACE_OFFSET,
-			      data, req->req.length);
-        if (copy_to_user(int2ptr(req->req.recvb), data,
-                req->req.length))
-                ret = -EFAULT;
-	if (copy_to_user(int2ptr(req->req.tag), &fi->host->csr.rom->cache_head->len,
-			 sizeof(fi->host->csr.rom->cache_head->len)))
-                ret = -EFAULT;
+	int ret = sizeof(struct raw1394_request);
+	quadlet_t *data = kmalloc(req->req.length, SLAB_KERNEL);
+	int status;
+
+	if (!data)
+		return -ENOMEM;
+
+	status =
+	    csr1212_read(fi->host->csr.rom, CSR1212_CONFIG_ROM_SPACE_OFFSET,
+			 data, req->req.length);
+	if (copy_to_user(int2ptr(req->req.recvb), data, req->req.length))
+		ret = -EFAULT;
+	if (copy_to_user
+	    (int2ptr(req->req.tag), &fi->host->csr.rom->cache_head->len,
+	     sizeof(fi->host->csr.rom->cache_head->len)))
+		ret = -EFAULT;
 	if (copy_to_user(int2ptr(req->req.address), &fi->host->csr.generation,
 			 sizeof(fi->host->csr.generation)))
-                ret = -EFAULT;
-        if (copy_to_user(int2ptr(req->req.sendb), &status,
-                sizeof(status)))
-                ret = -EFAULT;
-        kfree(data);
-        if (ret >= 0) {
-                free_pending_request(req); /* we have to free the request, because we queue no response, and therefore nobody will free it */
-        }
-        return ret;
+		ret = -EFAULT;
+	if (copy_to_user(int2ptr(req->req.sendb), &status, sizeof(status)))
+		ret = -EFAULT;
+	kfree(data);
+	if (ret >= 0) {
+		free_pending_request(req);	/* we have to free the request, because we queue no response, and therefore nobody will free it */
+	}
+	return ret;
 }
 
 static int update_config_rom(struct file_info *fi, struct pending_request *req)
 {
-        int ret=sizeof(struct raw1394_request);
-        quadlet_t *data = kmalloc(req->req.length, SLAB_KERNEL);
-        if (!data) return -ENOMEM;
-        if (copy_from_user(data,int2ptr(req->req.sendb),
-                req->req.length)) {
-                ret= -EFAULT;
-        } else {
-                int status = hpsb_update_config_rom(fi->host,
-                        data, req->req.length,
-                        (unsigned char) req->req.misc);
-                if (copy_to_user(int2ptr(req->req.recvb),
-                        &status, sizeof(status)))
-                        ret = -ENOMEM;
-        }
-        kfree(data);
-        if (ret >= 0) {
-                free_pending_request(req); /* we have to free the request, because we queue no response, and therefore nobody will free it */
+	int ret = sizeof(struct raw1394_request);
+	quadlet_t *data = kmalloc(req->req.length, SLAB_KERNEL);
+	if (!data)
+		return -ENOMEM;
+	if (copy_from_user(data, int2ptr(req->req.sendb), req->req.length)) {
+		ret = -EFAULT;
+	} else {
+		int status = hpsb_update_config_rom(fi->host,
+						    data, req->req.length,
+						    (unsigned char)req->req.
+						    misc);
+		if (copy_to_user
+		    (int2ptr(req->req.recvb), &status, sizeof(status)))
+			ret = -ENOMEM;
+	}
+	kfree(data);
+	if (ret >= 0) {
+		free_pending_request(req);	/* we have to free the request, because we queue no response, and therefore nobody will free it */
 		fi->cfgrom_upd = 1;
-        }
-        return ret;
+	}
+	return ret;
 }
 
 static int modify_config_rom(struct file_info *fi, struct pending_request *req)
@@ -1943,23 +2068,32 @@
 	int ret = 0;
 
 	if (req->req.misc == ~0) {
-		if (req->req.length == 0) return -EINVAL;
+		if (req->req.length == 0)
+			return -EINVAL;
 
 		/* Find an unused slot */
-		for (dr = 0; dr < RAW1394_MAX_USER_CSR_DIRS && fi->csr1212_dirs[dr]; dr++);
+		for (dr = 0;
+		     dr < RAW1394_MAX_USER_CSR_DIRS && fi->csr1212_dirs[dr];
+		     dr++) ;
 
-		if (dr == RAW1394_MAX_USER_CSR_DIRS) return -ENOMEM;
+		if (dr == RAW1394_MAX_USER_CSR_DIRS)
+			return -ENOMEM;
 
-		fi->csr1212_dirs[dr] = csr1212_new_directory(CSR1212_KV_ID_VENDOR);
-		if (!fi->csr1212_dirs[dr]) return -ENOMEM;
+		fi->csr1212_dirs[dr] =
+		    csr1212_new_directory(CSR1212_KV_ID_VENDOR);
+		if (!fi->csr1212_dirs[dr])
+			return -ENOMEM;
 	} else {
 		dr = req->req.misc;
-		if (!fi->csr1212_dirs[dr]) return -EINVAL;
+		if (!fi->csr1212_dirs[dr])
+			return -EINVAL;
 
 		/* Delete old stuff */
-		for (dentry = fi->csr1212_dirs[dr]->value.directory.dentries_head;
+		for (dentry =
+		     fi->csr1212_dirs[dr]->value.directory.dentries_head;
 		     dentry; dentry = dentry->next) {
-			csr1212_detach_keyval_from_directory(fi->host->csr.rom->root_kv,
+			csr1212_detach_keyval_from_directory(fi->host->csr.rom->
+							     root_kv,
 							     dentry->kv);
 		}
 
@@ -1980,7 +2114,8 @@
 		return -ENOMEM;
 	}
 
-	cache->filled_head = kmalloc(sizeof(struct csr1212_cache_region), GFP_KERNEL);
+	cache->filled_head =
+	    kmalloc(sizeof(struct csr1212_cache_region), GFP_KERNEL);
 	if (!cache->filled_head) {
 		csr1212_release_keyval(fi->csr1212_dirs[dr]);
 		fi->csr1212_dirs[dr] = NULL;
@@ -1994,11 +2129,11 @@
 		csr1212_release_keyval(fi->csr1212_dirs[dr]);
 		fi->csr1212_dirs[dr] = NULL;
 		CSR1212_FREE(cache);
-		ret= -EFAULT;
+		ret = -EFAULT;
 	} else {
 		cache->len = req->req.length;
 		cache->filled_head->offset_start = 0;
-		cache->filled_head->offset_end = cache->size -1;
+		cache->filled_head->offset_end = cache->size - 1;
 
 		cache->layout_head = cache->layout_tail = fi->csr1212_dirs[dr];
 
@@ -2010,17 +2145,20 @@
 		}
 
 		/* attach top level items to the root directory */
-		for (dentry = fi->csr1212_dirs[dr]->value.directory.dentries_head;
+		for (dentry =
+		     fi->csr1212_dirs[dr]->value.directory.dentries_head;
 		     ret == CSR1212_SUCCESS && dentry; dentry = dentry->next) {
-			ret = csr1212_attach_keyval_to_directory(fi->host->csr.rom->root_kv,
-								 dentry->kv);
+			ret =
+			    csr1212_attach_keyval_to_directory(fi->host->csr.
+							       rom->root_kv,
+							       dentry->kv);
 		}
 
 		if (ret == CSR1212_SUCCESS) {
 			ret = hpsb_update_config_rom_image(fi->host);
 
 			if (ret >= 0 && copy_to_user(int2ptr(req->req.recvb),
-						    &dr, sizeof(dr))) {
+						     &dr, sizeof(dr))) {
 				ret = -ENOMEM;
 			}
 		}
@@ -2034,9 +2172,11 @@
 		free_pending_request(req);
 		return sizeof(struct raw1394_request);
 	} else {
-		for (dentry = fi->csr1212_dirs[dr]->value.directory.dentries_head;
+		for (dentry =
+		     fi->csr1212_dirs[dr]->value.directory.dentries_head;
 		     dentry; dentry = dentry->next) {
-			csr1212_detach_keyval_from_directory(fi->host->csr.rom->root_kv,
+			csr1212_detach_keyval_from_directory(fi->host->csr.rom->
+							     root_kv,
 							     dentry->kv);
 		}
 		csr1212_release_keyval(fi->csr1212_dirs[dr]);
@@ -2047,133 +2187,132 @@
 
 static int state_connected(struct file_info *fi, struct pending_request *req)
 {
-        int node = req->req.address >> 48;
+	int node = req->req.address >> 48;
+
+	req->req.error = RAW1394_ERROR_NONE;
 
-        req->req.error = RAW1394_ERROR_NONE;
+	switch (req->req.type) {
 
-        switch (req->req.type) {
+	case RAW1394_REQ_ECHO:
+		queue_complete_req(req);
+		return sizeof(struct raw1394_request);
+
+	case RAW1394_REQ_ISO_SEND:
+		return handle_iso_send(fi, req, node);
+
+	case RAW1394_REQ_ARM_REGISTER:
+		return arm_register(fi, req);
+
+	case RAW1394_REQ_ARM_UNREGISTER:
+		return arm_unregister(fi, req);
+
+	case RAW1394_REQ_ARM_SET_BUF:
+		return arm_set_buf(fi, req);
 
-        case RAW1394_REQ_ECHO:
-                queue_complete_req(req);
-                return sizeof(struct raw1394_request);
-
-        case RAW1394_REQ_ISO_SEND:
-                return handle_iso_send(fi, req, node);
-
-        case RAW1394_REQ_ARM_REGISTER:
-                return arm_register(fi, req);
-
-        case RAW1394_REQ_ARM_UNREGISTER:
-                return arm_unregister(fi, req);
-
-        case RAW1394_REQ_ARM_SET_BUF:
-                return arm_set_buf(fi, req);
-
-        case RAW1394_REQ_ARM_GET_BUF:
-                return arm_get_buf(fi, req);
-
-        case RAW1394_REQ_RESET_NOTIFY:
-                return reset_notification(fi, req);
-
-        case RAW1394_REQ_ISO_LISTEN:
-                handle_iso_listen(fi, req);
-                return sizeof(struct raw1394_request);
-
-        case RAW1394_REQ_FCP_LISTEN:
-                handle_fcp_listen(fi, req);
-                return sizeof(struct raw1394_request);
-
-        case RAW1394_REQ_RESET_BUS:
-                if (req->req.misc == RAW1394_LONG_RESET) {
-                        DBGMSG("busreset called (type: LONG)");
-                        hpsb_reset_bus(fi->host, LONG_RESET);
-                        free_pending_request(req); /* we have to free the request, because we queue no response, and therefore nobody will free it */
-                        return sizeof(struct raw1394_request);
-                }
-                if (req->req.misc == RAW1394_SHORT_RESET) {
-                        DBGMSG("busreset called (type: SHORT)");
-                        hpsb_reset_bus(fi->host, SHORT_RESET);
-                        free_pending_request(req); /* we have to free the request, because we queue no response, and therefore nobody will free it */
-                        return sizeof(struct raw1394_request);
-                }
-                /* error EINVAL (22) invalid argument */
-                return (-EINVAL);
-        case RAW1394_REQ_GET_ROM:
-                return get_config_rom(fi, req);
+	case RAW1394_REQ_ARM_GET_BUF:
+		return arm_get_buf(fi, req);
 
-        case RAW1394_REQ_UPDATE_ROM:
-                return update_config_rom(fi, req);
+	case RAW1394_REQ_RESET_NOTIFY:
+		return reset_notification(fi, req);
+
+	case RAW1394_REQ_ISO_LISTEN:
+		handle_iso_listen(fi, req);
+		return sizeof(struct raw1394_request);
+
+	case RAW1394_REQ_FCP_LISTEN:
+		handle_fcp_listen(fi, req);
+		return sizeof(struct raw1394_request);
+
+	case RAW1394_REQ_RESET_BUS:
+		if (req->req.misc == RAW1394_LONG_RESET) {
+			DBGMSG("busreset called (type: LONG)");
+			hpsb_reset_bus(fi->host, LONG_RESET);
+			free_pending_request(req);	/* we have to free the request, because we queue no response, and therefore nobody will free it */
+			return sizeof(struct raw1394_request);
+		}
+		if (req->req.misc == RAW1394_SHORT_RESET) {
+			DBGMSG("busreset called (type: SHORT)");
+			hpsb_reset_bus(fi->host, SHORT_RESET);
+			free_pending_request(req);	/* we have to free the request, because we queue no response, and therefore nobody will free it */
+			return sizeof(struct raw1394_request);
+		}
+		/* error EINVAL (22) invalid argument */
+		return (-EINVAL);
+	case RAW1394_REQ_GET_ROM:
+		return get_config_rom(fi, req);
+
+	case RAW1394_REQ_UPDATE_ROM:
+		return update_config_rom(fi, req);
 
 	case RAW1394_REQ_MODIFY_ROM:
 		return modify_config_rom(fi, req);
-        }
+	}
 
-        if (req->req.generation != get_hpsb_generation(fi->host)) {
-                req->req.error = RAW1394_ERROR_GENERATION;
-                req->req.generation = get_hpsb_generation(fi->host);
-                req->req.length = 0;
-                queue_complete_req(req);
-                return sizeof(struct raw1394_request);
-        }
-
-        switch (req->req.type) {
-        case RAW1394_REQ_PHYPACKET:
-                return write_phypacket(fi, req);
-        case RAW1394_REQ_ASYNC_SEND:
-                return handle_async_send(fi, req);
-        }
-
-        if (req->req.length == 0) {
-                req->req.error = RAW1394_ERROR_INVALID_ARG;
-                queue_complete_req(req);
-                return sizeof(struct raw1394_request);
-        }
-
-        return handle_async_request(fi, req, node);
-}
-
-
-static ssize_t raw1394_write(struct file *file, const char __user *buffer, size_t count,
-                     loff_t *offset_is_ignored)
-{
-        struct file_info *fi = (struct file_info *)file->private_data;
-        struct pending_request *req;
-        ssize_t retval = 0;
-
-        if (count != sizeof(struct raw1394_request)) {
-                return -EINVAL;
-        }
-
-        req = alloc_pending_request();
-        if (req == NULL) {
-                return -ENOMEM;
-        }
-        req->file_info = fi;
-
-        if (copy_from_user(&req->req, buffer, sizeof(struct raw1394_request))) {
-                free_pending_request(req);
-                return -EFAULT;
-        }
-
-        switch (fi->state) {
-        case opened:
-                retval = state_opened(fi, req);
-                break;
-
-        case initialized:
-                retval = state_initialized(fi, req);
-                break;
-
-        case connected:
-                retval = state_connected(fi, req);
-                break;
-        }
-
-        if (retval < 0) {
-                free_pending_request(req);
-        }
+	if (req->req.generation != get_hpsb_generation(fi->host)) {
+		req->req.error = RAW1394_ERROR_GENERATION;
+		req->req.generation = get_hpsb_generation(fi->host);
+		req->req.length = 0;
+		queue_complete_req(req);
+		return sizeof(struct raw1394_request);
+	}
+
+	switch (req->req.type) {
+	case RAW1394_REQ_PHYPACKET:
+		return write_phypacket(fi, req);
+	case RAW1394_REQ_ASYNC_SEND:
+		return handle_async_send(fi, req);
+	}
 
-        return retval;
+	if (req->req.length == 0) {
+		req->req.error = RAW1394_ERROR_INVALID_ARG;
+		queue_complete_req(req);
+		return sizeof(struct raw1394_request);
+	}
+
+	return handle_async_request(fi, req, node);
+}
+
+static ssize_t raw1394_write(struct file *file, const char __user * buffer,
+			     size_t count, loff_t * offset_is_ignored)
+{
+	struct file_info *fi = (struct file_info *)file->private_data;
+	struct pending_request *req;
+	ssize_t retval = 0;
+
+	if (count != sizeof(struct raw1394_request)) {
+		return -EINVAL;
+	}
+
+	req = alloc_pending_request();
+	if (req == NULL) {
+		return -ENOMEM;
+	}
+	req->file_info = fi;
+
+	if (copy_from_user(&req->req, buffer, sizeof(struct raw1394_request))) {
+		free_pending_request(req);
+		return -EFAULT;
+	}
+
+	switch (fi->state) {
+	case opened:
+		retval = state_opened(fi, req);
+		break;
+
+	case initialized:
+		retval = state_initialized(fi, req);
+		break;
+
+	case connected:
+		retval = state_connected(fi, req);
+		break;
+	}
+
+	if (retval < 0) {
+		free_pending_request(req);
+	}
+
+	return retval;
 }
 
 /* rawiso operations */
@@ -2185,8 +2324,8 @@
 	struct pending_request *req;
 
 	list_for_each_entry(req, &fi->req_complete, list)
-		if (req->req.type == RAW1394_REQ_RAWISO_ACTIVITY)
-			return 1;
+	    if (req->req.type == RAW1394_REQ_RAWISO_ACTIVITY)
+		return 1;
 
 	return 0;
 }
@@ -2200,7 +2339,8 @@
 
 	/* only one ISO activity event may be in the queue */
 	if (!__rawiso_event_in_queue(fi)) {
-		struct pending_request *req = __alloc_pending_request(SLAB_ATOMIC);
+		struct pending_request *req =
+		    __alloc_pending_request(SLAB_ATOMIC);
 
 		if (req) {
 			req->file_info = fi;
@@ -2220,11 +2360,11 @@
 static void rawiso_activity_cb(struct hpsb_iso *iso)
 {
 	unsigned long flags;
-        struct host_info *hi;
+	struct host_info *hi;
 	struct file_info *fi;
 
-        spin_lock_irqsave(&host_info_lock, flags);
-        hi = find_host_info(iso->host);
+	spin_lock_irqsave(&host_info_lock, flags);
+	hi = find_host_info(iso->host);
 
 	if (hi != NULL) {
 		list_for_each_entry(fi, &hi->file_info_list, list) {
@@ -2237,7 +2377,8 @@
 }
 
 /* helper function - gather all the kernel iso status bits for returning to user-space */
-static void raw1394_iso_fill_status(struct hpsb_iso *iso, struct raw1394_iso_status *stat)
+static void raw1394_iso_fill_status(struct hpsb_iso *iso,
+				    struct raw1394_iso_status *stat)
 {
 	stat->config.data_buf_size = iso->buf_size;
 	stat->config.buf_packets = iso->buf_packets;
@@ -2249,7 +2390,7 @@
 	stat->xmit_cycle = iso->xmit_cycle;
 }
 
-static int raw1394_iso_xmit_init(struct file_info *fi, void __user *uaddr)
+static int raw1394_iso_xmit_init(struct file_info *fi, void __user * uaddr)
 {
 	struct raw1394_iso_status stat;
 
@@ -2281,7 +2422,7 @@
 	return 0;
 }
 
-static int raw1394_iso_recv_init(struct file_info *fi, void __user *uaddr)
+static int raw1394_iso_recv_init(struct file_info *fi, void __user * uaddr)
 {
 	struct raw1394_iso_status stat;
 
@@ -2295,7 +2436,7 @@
 					    stat.config.data_buf_size,
 					    stat.config.buf_packets,
 					    stat.config.channel,
- 					    stat.config.dma_mode,
+					    stat.config.dma_mode,
 					    stat.config.irq_interval,
 					    rawiso_activity_cb);
 	if (!fi->iso_handle)
@@ -2309,7 +2450,7 @@
 	return 0;
 }
 
-static int raw1394_iso_get_status(struct file_info *fi, void __user *uaddr)
+static int raw1394_iso_get_status(struct file_info *fi, void __user * uaddr)
 {
 	struct raw1394_iso_status stat;
 	struct hpsb_iso *iso = fi->iso_handle;
@@ -2325,7 +2466,7 @@
 }
 
 /* copy N packet_infos out of the ringbuffer into user-supplied array */
-static int raw1394_iso_recv_packets(struct file_info *fi, void __user *uaddr)
+static int raw1394_iso_recv_packets(struct file_info *fi, void __user * uaddr)
 {
 	struct raw1394_iso_packets upackets;
 	unsigned int packet = fi->iso_handle->first_packet;
@@ -2339,14 +2480,15 @@
 
 	/* ensure user-supplied buffer is accessible and big enough */
 	if (verify_area(VERIFY_WRITE, upackets.infos,
-		       upackets.n_packets * sizeof(struct raw1394_iso_packet_info)))
+			upackets.n_packets *
+			sizeof(struct raw1394_iso_packet_info)))
 		return -EFAULT;
 
 	/* copy the packet_infos out */
 	for (i = 0; i < upackets.n_packets; i++) {
 		if (__copy_to_user(&upackets.infos[i],
-				  &fi->iso_handle->infos[packet],
-				  sizeof(struct raw1394_iso_packet_info)))
+				   &fi->iso_handle->infos[packet],
+				   sizeof(struct raw1394_iso_packet_info)))
 			return -EFAULT;
 
 		packet = (packet + 1) % fi->iso_handle->buf_packets;
@@ -2356,7 +2498,7 @@
 }
 
 /* copy N packet_infos from user to ringbuffer, and queue them for transmission */
-static int raw1394_iso_send_packets(struct file_info *fi, void __user *uaddr)
+static int raw1394_iso_send_packets(struct file_info *fi, void __user * uaddr)
 {
 	struct raw1394_iso_packets upackets;
 	int i, rv;
@@ -2369,7 +2511,8 @@
 
 	/* ensure user-supplied buffer is accessible and big enough */
 	if (verify_area(VERIFY_READ, upackets.infos,
-		       upackets.n_packets * sizeof(struct raw1394_iso_packet_info)))
+			upackets.n_packets *
+			sizeof(struct raw1394_iso_packet_info)))
 		return -EFAULT;
 
 	/* copy the infos structs in and queue the packets */
@@ -2377,7 +2520,7 @@
 		struct raw1394_iso_packet_info info;
 
 		if (__copy_from_user(&info, &upackets.infos[i],
-				    sizeof(struct raw1394_iso_packet_info)))
+				     sizeof(struct raw1394_iso_packet_info)))
 			return -EFAULT;
 
 		rv = hpsb_iso_xmit_queue_packet(fi->iso_handle, info.offset,
@@ -2410,14 +2553,15 @@
 }
 
 /* ioctl is only used for rawiso operations */
-static int raw1394_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+static int raw1394_ioctl(struct inode *inode, struct file *file,
+			 unsigned int cmd, unsigned long arg)
 {
 	struct file_info *fi = file->private_data;
 	void __user *argp = (void __user *)arg;
 
-	switch(fi->iso_state) {
+	switch (fi->iso_state) {
 	case RAW1394_ISO_INACTIVE:
-		switch(cmd) {
+		switch (cmd) {
 		case RAW1394_IOC_ISO_XMIT_INIT:
 			return raw1394_iso_xmit_init(fi, argp);
 		case RAW1394_IOC_ISO_RECV_INIT:
@@ -2427,34 +2571,42 @@
 		}
 		break;
 	case RAW1394_ISO_RECV:
-		switch(cmd) {
-		case RAW1394_IOC_ISO_RECV_START: {
-			/* copy args from user-space */
-			int args[3];
-			if (copy_from_user(&args[0], argp, sizeof(args)))
-				return -EFAULT;
-			return hpsb_iso_recv_start(fi->iso_handle, args[0], args[1], args[2]);
-		}
+		switch (cmd) {
+		case RAW1394_IOC_ISO_RECV_START:{
+				/* copy args from user-space */
+				int args[3];
+				if (copy_from_user
+				    (&args[0], argp, sizeof(args)))
+					return -EFAULT;
+				return hpsb_iso_recv_start(fi->iso_handle,
+							   args[0], args[1],
+							   args[2]);
+			}
 		case RAW1394_IOC_ISO_XMIT_RECV_STOP:
 			hpsb_iso_stop(fi->iso_handle);
 			return 0;
 		case RAW1394_IOC_ISO_RECV_LISTEN_CHANNEL:
-			return hpsb_iso_recv_listen_channel(fi->iso_handle, arg);
+			return hpsb_iso_recv_listen_channel(fi->iso_handle,
+							    arg);
 		case RAW1394_IOC_ISO_RECV_UNLISTEN_CHANNEL:
-			return hpsb_iso_recv_unlisten_channel(fi->iso_handle, arg);
-		case RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK: {
-			/* copy the u64 from user-space */
-			u64 mask;
-			if (copy_from_user(&mask, argp, sizeof(mask)))
-				return -EFAULT;
-			return hpsb_iso_recv_set_channel_mask(fi->iso_handle, mask);
-		}
+			return hpsb_iso_recv_unlisten_channel(fi->iso_handle,
+							      arg);
+		case RAW1394_IOC_ISO_RECV_SET_CHANNEL_MASK:{
+				/* copy the u64 from user-space */
+				u64 mask;
+				if (copy_from_user(&mask, argp, sizeof(mask)))
+					return -EFAULT;
+				return hpsb_iso_recv_set_channel_mask(fi->
+								      iso_handle,
+								      mask);
+			}
 		case RAW1394_IOC_ISO_GET_STATUS:
 			return raw1394_iso_get_status(fi, argp);
 		case RAW1394_IOC_ISO_RECV_PACKETS:
 			return raw1394_iso_recv_packets(fi, argp);
 		case RAW1394_IOC_ISO_RECV_RELEASE_PACKETS:
-			return hpsb_iso_recv_release_packets(fi->iso_handle, arg);
+			return hpsb_iso_recv_release_packets(fi->iso_handle,
+							     arg);
 		case RAW1394_IOC_ISO_RECV_FLUSH:
 			return hpsb_iso_recv_flush(fi->iso_handle);
 		case RAW1394_IOC_ISO_SHUTDOWN:
@@ -2466,14 +2618,16 @@
 		}
 		break;
 	case RAW1394_ISO_XMIT:
-		switch(cmd) {
-		case RAW1394_IOC_ISO_XMIT_START: {
-			/* copy two ints from user-space */
-			int args[2];
-			if (copy_from_user(&args[0], argp, sizeof(args)))
-				return -EFAULT;
-			return hpsb_iso_xmit_start(fi->iso_handle, args[0], args[1]);
-		}
+		switch (cmd) {
+		case RAW1394_IOC_ISO_XMIT_START:{
+				/* copy two ints from user-space */
+				int args[2];
+				if (copy_from_user
+				    (&args[0], argp, sizeof(args)))
+					return -EFAULT;
+				return hpsb_iso_xmit_start(fi->iso_handle,
+							   args[0], args[1]);
+			}
 		case RAW1394_IOC_ISO_XMIT_SYNC:
 			return hpsb_iso_xmit_sync(fi->iso_handle);
 		case RAW1394_IOC_ISO_XMIT_RECV_STOP:
@@ -2498,270 +2652,303 @@
 	return -EINVAL;
 }
 
-static unsigned int raw1394_poll(struct file *file, poll_table *pt)
+static unsigned int raw1394_poll(struct file *file, poll_table * pt)
 {
-        struct file_info *fi = file->private_data;
-        unsigned int mask = POLLOUT | POLLWRNORM;
+	struct file_info *fi = file->private_data;
+	unsigned int mask = POLLOUT | POLLWRNORM;
 
-        poll_wait(file, &fi->poll_wait_complete, pt);
+	poll_wait(file, &fi->poll_wait_complete, pt);
 
-        spin_lock_irq(&fi->reqlists_lock);
-        if (!list_empty(&fi->req_complete)) {
-                mask |= POLLIN | POLLRDNORM;
-        }
-        spin_unlock_irq(&fi->reqlists_lock);
+	spin_lock_irq(&fi->reqlists_lock);
+	if (!list_empty(&fi->req_complete)) {
+		mask |= POLLIN | POLLRDNORM;
+	}
+	spin_unlock_irq(&fi->reqlists_lock);
 
-        return mask;
+	return mask;
 }
 
 static int raw1394_open(struct inode *inode, struct file *file)
 {
-        struct file_info *fi;
+	struct file_info *fi;
+
+	fi = kmalloc(sizeof(struct file_info), SLAB_KERNEL);
+	if (fi == NULL)
+		return -ENOMEM;
+
+	memset(fi, 0, sizeof(struct file_info));
+	fi->notification = (u8) RAW1394_NOTIFY_ON;	/* busreset notification */
 
-        fi = kmalloc(sizeof(struct file_info), SLAB_KERNEL);
-        if (fi == NULL)
-                return -ENOMEM;
-
-        memset(fi, 0, sizeof(struct file_info));
-        fi->notification = (u8) RAW1394_NOTIFY_ON; /* busreset notification */
-
-        INIT_LIST_HEAD(&fi->list);
-        fi->state = opened;
-        INIT_LIST_HEAD(&fi->req_pending);
-        INIT_LIST_HEAD(&fi->req_complete);
-        sema_init(&fi->complete_sem, 0);
-        spin_lock_init(&fi->reqlists_lock);
-        init_waitqueue_head(&fi->poll_wait_complete);
-        INIT_LIST_HEAD(&fi->addr_list);
+	INIT_LIST_HEAD(&fi->list);
+	fi->state = opened;
+	INIT_LIST_HEAD(&fi->req_pending);
+	INIT_LIST_HEAD(&fi->req_complete);
+	sema_init(&fi->complete_sem, 0);
+	spin_lock_init(&fi->reqlists_lock);
+	init_waitqueue_head(&fi->poll_wait_complete);
+	INIT_LIST_HEAD(&fi->addr_list);
 
-        file->private_data = fi;
+	file->private_data = fi;
 
-        return 0;
+	return 0;
 }
 
 static int raw1394_release(struct inode *inode, struct file *file)
 {
-        struct file_info *fi = file->private_data;
-        struct list_head *lh;
-        struct pending_request *req;
-        int done = 0, i, fail = 0;
-        int retval = 0;
-        struct list_head *entry;
-        struct arm_addr  *addr = NULL;
-        struct host_info *hi;
-        struct file_info *fi_hlp = NULL;
-        struct arm_addr  *arm_addr = NULL;
-        int another_host;
+	struct file_info *fi = file->private_data;
+	struct list_head *lh;
+	struct pending_request *req;
+	int done = 0, i, fail = 0;
+	int retval = 0;
+	struct list_head *entry;
+	struct arm_addr *addr = NULL;
+	struct host_info *hi;
+	struct file_info *fi_hlp = NULL;
+	struct arm_addr *arm_addr = NULL;
+	int another_host;
 	int csr_mod = 0;
 
 	if (fi->iso_state != RAW1394_ISO_INACTIVE)
 		raw1394_iso_shutdown(fi);
 
-        for (i = 0; i < 64; i++) {
-                if (fi->listen_channels & (1ULL << i)) {
-                        hpsb_unlisten_channel(&raw1394_highlevel, fi->host, i);
-                }
-        }
-
-        spin_lock_irq(&host_info_lock);
-        fi->listen_channels = 0;
-        spin_unlock_irq(&host_info_lock);
-
-        fail = 0;
-        /* set address-entries invalid */
-        spin_lock_irq(&host_info_lock);
-
-        while (!list_empty(&fi->addr_list)) {
-                another_host = 0;
-                lh = fi->addr_list.next;
-                addr = list_entry(lh, struct arm_addr, addr_list);
-                /* another host with valid address-entry containing
-                   same addressrange? */
-                list_for_each_entry(hi, &host_info_list, list) {
-                        if (hi->host != fi->host) {
-                                list_for_each_entry(fi_hlp, &hi->file_info_list, list) {
-                                        entry = fi_hlp->addr_list.next;
-                                        while (entry != &(fi_hlp->addr_list)) {
-                                                arm_addr = list_entry(entry,
-                                                        struct arm_addr, addr_list);
-                                                if (arm_addr->start ==
-                                                        addr->start) {
-                                                        DBGMSG("raw1394_release: "
-                                                        "another host ownes "
-                                                        "same addressrange");
-                                                        another_host = 1;
-                                                        break;
-                                                }
-                                                entry = entry->next;
-                                        }
-                                        if (another_host) {
-                                                break;
-                                        }
-                                }
-                        }
-                }
-                if (!another_host) {
-                        DBGMSG("raw1394_release: call hpsb_arm_unregister");
-                        retval = hpsb_unregister_addrspace(&raw1394_highlevel, fi->host, addr->start);
-                        if (!retval) {
-                                ++fail;
-                                printk(KERN_ERR "raw1394_release arm_Unregister failed\n");
-                        }
-                }
-                DBGMSG("raw1394_release: delete addr_entry from list");
-                list_del(&addr->addr_list);
-                vfree(addr->addr_space_buffer);
-                kfree(addr);
-        } /* while */
-        spin_unlock_irq(&host_info_lock);
-        if (fail > 0) {
-                printk(KERN_ERR "raw1394: during addr_list-release "
-                        "error(s) occurred \n");
-        }
-
-        while (!done) {
-                spin_lock_irq(&fi->reqlists_lock);
-
-                while (!list_empty(&fi->req_complete)) {
-                        lh = fi->req_complete.next;
-                        list_del(lh);
-
-                        req = list_entry(lh, struct pending_request, list);
-
-                        free_pending_request(req);
-                }
+	for (i = 0; i < 64; i++) {
+		if (fi->listen_channels & (1ULL << i)) {
+			hpsb_unlisten_channel(&raw1394_highlevel, fi->host, i);
+		}
+	}
+
+	spin_lock_irq(&host_info_lock);
+	fi->listen_channels = 0;
+	spin_unlock_irq(&host_info_lock);
+
+	fail = 0;
+	/* set address-entries invalid */
+	spin_lock_irq(&host_info_lock);
+
+	while (!list_empty(&fi->addr_list)) {
+		another_host = 0;
+		lh = fi->addr_list.next;
+		addr = list_entry(lh, struct arm_addr, addr_list);
+		/* another host with valid address-entry containing
+		   same addressrange? */
+		list_for_each_entry(hi, &host_info_list, list) {
+			if (hi->host != fi->host) {
+				list_for_each_entry(fi_hlp, &hi->file_info_list,
+						    list) {
+					entry = fi_hlp->addr_list.next;
+					while (entry != &(fi_hlp->addr_list)) {
+						arm_addr = list_entry(entry, struct
+								      arm_addr,
+								      addr_list);
+						if (arm_addr->start ==
+						    addr->start) {
+							DBGMSG
+							    ("raw1394_release: "
+							     "another host ownes "
+							     "same addressrange");
+							another_host = 1;
+							break;
+						}
+						entry = entry->next;
+					}
+					if (another_host) {
+						break;
+					}
+				}
+			}
+		}
+		if (!another_host) {
+			DBGMSG("raw1394_release: call hpsb_arm_unregister");
+			retval =
+			    hpsb_unregister_addrspace(&raw1394_highlevel,
+						      fi->host, addr->start);
+			if (!retval) {
+				++fail;
+				printk(KERN_ERR
+				       "raw1394_release arm_Unregister failed\n");
+			}
+		}
+		DBGMSG("raw1394_release: delete addr_entry from list");
+		list_del(&addr->addr_list);
+		vfree(addr->addr_space_buffer);
+		kfree(addr);
+	}			/* while */
+	spin_unlock_irq(&host_info_lock);
+	if (fail > 0) {
+		printk(KERN_ERR "raw1394: during addr_list-release "
+		       "error(s) occurred \n");
+	}
+
+	while (!done) {
+		spin_lock_irq(&fi->reqlists_lock);
+
+		while (!list_empty(&fi->req_complete)) {
+			lh = fi->req_complete.next;
+			list_del(lh);
+
+			req = list_entry(lh, struct pending_request, list);
 
-                if (list_empty(&fi->req_pending)) done = 1;
+			free_pending_request(req);
+		}
 
-                spin_unlock_irq(&fi->reqlists_lock);
+		if (list_empty(&fi->req_pending))
+			done = 1;
 
-                if (!done) down_interruptible(&fi->complete_sem);
-        }
+		spin_unlock_irq(&fi->reqlists_lock);
+
+		if (!done)
+			down_interruptible(&fi->complete_sem);
+	}
 
 	/* Remove any sub-trees left by user space programs */
 	for (i = 0; i < RAW1394_MAX_USER_CSR_DIRS; i++) {
 		struct csr1212_dentry *dentry;
-		if (!fi->csr1212_dirs[i]) continue;
-		for (dentry = fi->csr1212_dirs[i]->value.directory.dentries_head;
-		     dentry; dentry = dentry->next) {
-			csr1212_detach_keyval_from_directory(fi->host->csr.rom->root_kv, dentry->kv);
+		if (!fi->csr1212_dirs[i])
+			continue;
+		for (dentry =
+		     fi->csr1212_dirs[i]->value.directory.dentries_head; dentry;
+		     dentry = dentry->next) {
+			csr1212_detach_keyval_from_directory(fi->host->csr.rom->
+							     root_kv,
+							     dentry->kv);
 		}
 		csr1212_release_keyval(fi->csr1212_dirs[i]);
 		fi->csr1212_dirs[i] = NULL;
 		csr_mod = 1;
 	}
 
-	if ((csr_mod || fi->cfgrom_upd) && hpsb_update_config_rom_image(fi->host) < 0)
-		HPSB_ERR("Failed to generate Configuration ROM image for host %d", fi->host->id);
-
-        if (fi->state == connected) {
-                spin_lock_irq(&host_info_lock);
-                list_del(&fi->list);
-                spin_unlock_irq(&host_info_lock);
+	if ((csr_mod || fi->cfgrom_upd)
+	    && hpsb_update_config_rom_image(fi->host) < 0)
+		HPSB_ERR
+		    ("Failed to generate Configuration ROM image for host %d",
+		     fi->host->id);
+
+	if (fi->state == connected) {
+		spin_lock_irq(&host_info_lock);
+		list_del(&fi->list);
+		spin_unlock_irq(&host_info_lock);
 
 		put_device(&fi->host->device);
-        }
+	}
 
-        kfree(fi);
+	kfree(fi);
 
-        return 0;
+	return 0;
 }
 
-
 /*** HOTPLUG STUFF **********************************************************/
 /*
  * Export information about protocols/devices supported by this driver.
  */
 static struct ieee1394_device_id raw1394_id_table[] = {
 	{
-		.match_flags	= IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION,
-		.specifier_id	= AVC_UNIT_SPEC_ID_ENTRY & 0xffffff,
-		.version	= AVC_SW_VERSION_ENTRY & 0xffffff
-	},
+	 .match_flags = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION,
+	 .specifier_id = AVC_UNIT_SPEC_ID_ENTRY & 0xffffff,
+	 .version = AVC_SW_VERSION_ENTRY & 0xffffff},
+	{
+	 .match_flags = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION,
+	 .specifier_id = CAMERA_UNIT_SPEC_ID_ENTRY & 0xffffff,
+	 .version = CAMERA_SW_VERSION_ENTRY & 0xffffff},
 	{
-		.match_flags	= IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION,
-		.specifier_id	= CAMERA_UNIT_SPEC_ID_ENTRY & 0xffffff,
-		.version	= CAMERA_SW_VERSION_ENTRY & 0xffffff
-	},
-	{ }
+	 .match_flags = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION,
+	 .specifier_id = CAMERA_UNIT_SPEC_ID_ENTRY & 0xffffff,
+	 .version = (CAMERA_SW_VERSION_ENTRY + 1) & 0xffffff},
+	{
+	 .match_flags = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION,
+	 .specifier_id = CAMERA_UNIT_SPEC_ID_ENTRY & 0xffffff,
+	 .version = (CAMERA_SW_VERSION_ENTRY + 2) & 0xffffff},
+	{}
 };
 
 MODULE_DEVICE_TABLE(ieee1394, raw1394_id_table);
 
 static struct hpsb_protocol_driver raw1394_driver = {
-	.name		= "raw1394 Driver",
-	.id_table	= raw1394_id_table,
-	.driver		= {
-		.name	= "raw1394",
-		.bus	= &ieee1394_bus_type,
-	},
+	.name = "raw1394 Driver",
+	.id_table = raw1394_id_table,
+	.driver = {
+		   .name = "raw1394",
+		   .bus = &ieee1394_bus_type,
+		   },
 };
 
-
 /******************************************************************************/
 
-
 static struct hpsb_highlevel raw1394_highlevel = {
-	.name =		RAW1394_DEVICE_NAME,
-        .add_host =    add_host,
-        .remove_host = remove_host,
-        .host_reset =  host_reset,
-        .iso_receive = iso_receive,
-        .fcp_request = fcp_request,
+	.name = RAW1394_DEVICE_NAME,
+	.add_host = add_host,
+	.remove_host = remove_host,
+	.host_reset = host_reset,
+	.iso_receive = iso_receive,
+	.fcp_request = fcp_request,
 };
 
 static struct cdev raw1394_cdev;
 static struct file_operations raw1394_fops = {
-	.owner =	THIS_MODULE,
-        .read =		raw1394_read,
-        .write =	raw1394_write,
-	.mmap =         raw1394_mmap,
-	.ioctl =        raw1394_ioctl,
-        .poll =		raw1394_poll,
-        .open =		raw1394_open,
-        .release =	raw1394_release,
+	.owner = THIS_MODULE,
+	.read = raw1394_read,
+	.write = raw1394_write,
+	.mmap = raw1394_mmap,
+	.ioctl = raw1394_ioctl,
+	.poll = raw1394_poll,
+	.open = raw1394_open,
+	.release = raw1394_release,
 };
 
 static int __init init_raw1394(void)
 {
-	int ret;
+	int ret = 0;
 
 	hpsb_register_highlevel(&raw1394_highlevel);
 
-        devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16),
-			S_IFCHR | S_IRUSR | S_IWUSR, RAW1394_DEVICE_NAME);
+	if (IS_ERR(class_simple_device_add(hpsb_protocol_class, MKDEV(
+		IEEE1394_MAJOR,	IEEE1394_MINOR_BLOCK_RAW1394 * 16), 
+		NULL, RAW1394_DEVICE_NAME))) {
+		ret = -EFAULT;
+		goto out_unreg;
+	}
+	
+	devfs_mk_cdev(MKDEV(
+		IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16),
+		S_IFCHR | S_IRUSR | S_IWUSR, RAW1394_DEVICE_NAME);
 
 	cdev_init(&raw1394_cdev, &raw1394_fops);
 	raw1394_cdev.owner = THIS_MODULE;
 	kobject_set_name(&raw1394_cdev.kobj, RAW1394_DEVICE_NAME);
 	ret = cdev_add(&raw1394_cdev, IEEE1394_RAW1394_DEV, 1);
 	if (ret) {
-                HPSB_ERR("raw1394 failed to register minor device block");
-                devfs_remove(RAW1394_DEVICE_NAME);
-                hpsb_unregister_highlevel(&raw1394_highlevel);
-                return ret;
-        }
+		HPSB_ERR("raw1394 failed to register minor device block");
+		goto out_dev;
+	}
 
-        HPSB_INFO("raw1394: /dev/%s device initialized", RAW1394_DEVICE_NAME);
+	HPSB_INFO("raw1394: /dev/%s device initialized", RAW1394_DEVICE_NAME);
 
 	ret = hpsb_register_protocol(&raw1394_driver);
 	if (ret) {
 		HPSB_ERR("raw1394: failed to register protocol");
 		cdev_del(&raw1394_cdev);
-		devfs_remove(RAW1394_DEVICE_NAME);
-		hpsb_unregister_highlevel(&raw1394_highlevel);
-		return ret;
+		goto out_dev;
 	}
 
-        return 0;
+	goto out;
+
+out_dev:
+	devfs_remove(RAW1394_DEVICE_NAME);
+	class_simple_device_remove(MKDEV(
+		IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16));
+out_unreg:
+	hpsb_unregister_highlevel(&raw1394_highlevel);
+out:
+	return ret;
 }
 
 static void __exit cleanup_raw1394(void)
 {
+	class_simple_device_remove(MKDEV(
+		IEEE1394_MAJOR, IEEE1394_MINOR_BLOCK_RAW1394 * 16));
 	hpsb_unregister_protocol(&raw1394_driver);
 	cdev_del(&raw1394_cdev);
-        devfs_remove(RAW1394_DEVICE_NAME);
-        hpsb_unregister_highlevel(&raw1394_highlevel);
+	devfs_remove(RAW1394_DEVICE_NAME);
+	hpsb_unregister_highlevel(&raw1394_highlevel);
 }
 
 module_init(init_raw1394);
diff -Nru a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
--- a/drivers/ieee1394/sbp2.c	2005-01-07 21:44:10 -08:00
+++ b/drivers/ieee1394/sbp2.c	2005-01-30 22:12:53 -08:00
@@ -64,7 +64,10 @@
 #include <asm/system.h>
 #include <asm/scatterlist.h>
 
-#include "../scsi/scsi.h"
+#include <scsi/scsi.h>
+#include <scsi/scsi_cmnd.h>
+#include <scsi/scsi_dbg.h>
+#include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
 
 #include "csr1212.h"
@@ -224,12 +227,12 @@
 					   u32 status);
 
 static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
-				      u32 scsi_status, Scsi_Cmnd *SCpnt,
-				      void (*done)(Scsi_Cmnd *));
+				      u32 scsi_status, struct scsi_cmnd *SCpnt,
+				      void (*done)(struct scsi_cmnd *));
 
-static Scsi_Host_Template scsi_driver_template;
+static struct scsi_host_template scsi_driver_template;
 
-const u8 sbp2_speedto_max_payload[] = { 0x7, 0x8, 0x9, 0xA, 0xB, 0xC };
+static const u8 sbp2_speedto_max_payload[] = { 0x7, 0x8, 0x9, 0xA, 0xB, 0xC };
 
 static void sbp2_host_reset(struct hpsb_host *host);
 
@@ -373,7 +376,7 @@
 /* This is much like hpsb_node_write(), except it ignores the response
  * subaction and returns immediately. Can be used from interrupts.
  */
-int sbp2util_node_write_no_wait(struct node_entry *ne, u64 addr,
+static int sbp2util_node_write_no_wait(struct node_entry *ne, u64 addr,
 				quadlet_t *buffer, size_t length)
 {
 	struct hpsb_packet *packet;
@@ -520,8 +523,8 @@
  */
 static struct sbp2_command_info *sbp2util_allocate_command_orb(
 		struct scsi_id_instance_data *scsi_id,
-		Scsi_Cmnd *Current_SCpnt,
-		void (*Current_done)(Scsi_Cmnd *))
+		struct scsi_cmnd *Current_SCpnt,
+		void (*Current_done)(struct scsi_cmnd *))
 {
 	struct list_head *lh;
 	struct sbp2_command_info *command = NULL;
@@ -1521,8 +1524,9 @@
 
 				SBP2_DEBUG("sbp2_management_agent_addr = %x",
 					   (unsigned int) management_agent_addr);
-			} else
+			} else if (kv->key.type == CSR1212_KV_TYPE_IMMEDIATE) {
 				scsi_id->sbp2_device_type_and_lun = kv->value.immediate;
+			}
 			break;
 
 		case SBP2_COMMAND_SET_SPEC_ID_KEY:
@@ -1613,6 +1617,8 @@
 		scsi_id->sbp2_unit_characteristics = unit_characteristics;
 		scsi_id->sbp2_firmware_revision = firmware_revision;
 		scsi_id->workarounds = workarounds;
+		if (ud->flags & UNIT_DIRECTORY_HAS_LUN)
+			scsi_id->sbp2_device_type_and_lun = ud->lun;
 	}
 }
 
@@ -1700,14 +1706,14 @@
 				   unsigned int scsi_use_sg,
 				   unsigned int scsi_request_bufflen,
 				   void *scsi_request_buffer,
-				   unsigned char scsi_dir)
+				   enum dma_data_direction dma_dir)
+
 {
 	struct sbp2scsi_host_info *hi = scsi_id->hi;
 	struct scatterlist *sgpnt = (struct scatterlist *) scsi_request_buffer;
 	struct sbp2_command_orb *command_orb = &command->command_orb;
 	struct sbp2_unrestricted_page_table *scatter_gather_element =
 		&command->scatter_gather_element[0];
-	int dma_dir = scsi_to_pci_dma_dir (scsi_dir);
 	u32 sg_count, sg_len, orb_direction;
 	dma_addr_t sg_addr;
 	int i;
@@ -1730,22 +1736,22 @@
 	 * Get the direction of the transfer. If the direction is unknown, then use our
 	 * goofy table as a back-up.
 	 */
-	switch (scsi_dir) {
-		case SCSI_DATA_NONE:
+	switch (dma_dir) {
+		case DMA_NONE:
 			orb_direction = ORB_DIRECTION_NO_DATA_TRANSFER;
 			break;
-		case SCSI_DATA_WRITE:
+		case DMA_TO_DEVICE:
 			orb_direction = ORB_DIRECTION_WRITE_TO_MEDIA;
 			break;
-		case SCSI_DATA_READ:
+		case DMA_FROM_DEVICE:
 			orb_direction = ORB_DIRECTION_READ_FROM_MEDIA;
 			break;
-		case SCSI_DATA_UNKNOWN:
+		case DMA_BIDIRECTIONAL:
 		default:
 			SBP2_ERR("SCSI data transfer direction not specified. "
 				 "Update the SBP2 direction table in sbp2.h if "
 				 "necessary for your application");
-			print_command (scsi_cmd);
+			__scsi_print_command(scsi_cmd);
 			orb_direction = sbp2scsi_direction_table[*scsi_cmd];
 			break;
 	}
@@ -2031,7 +2037,8 @@
  * This function is called in order to begin a regular SBP-2 command.
  */
 static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
-			     Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
+			     struct scsi_cmnd *SCpnt,
+			     void (*done)(struct scsi_cmnd *))
 {
 	unchar *cmd = (unchar *) SCpnt->cmnd;
 	unsigned int request_bufflen = SCpnt->request_bufflen;
@@ -2040,7 +2047,7 @@
 	SBP2_DEBUG("sbp2_send_command");
 #if (CONFIG_IEEE1394_SBP2_DEBUG >= 2) || defined(CONFIG_IEEE1394_SBP2_PACKET_DUMP)
 	printk("[scsi command]\n   ");
-	print_command (cmd);
+	scsi_print_command(SCpnt);
 #endif
 	SBP2_DEBUG("SCSI transfer size = %x", request_bufflen);
 	SBP2_DEBUG("SCSI s/g elements = %x", (unsigned int)SCpnt->use_sg);
@@ -2233,7 +2240,7 @@
  * response data translations for the SCSI stack
  */
 static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, 
-				     Scsi_Cmnd *SCpnt)
+				     struct scsi_cmnd *SCpnt)
 {
 	u8 *scsi_buf = SCpnt->request_buffer;
 	u8 device_type = SBP2_DEVICE_TYPE (scsi_id->sbp2_device_type_and_lun);
@@ -2312,7 +2319,7 @@
 	struct sbp2scsi_host_info *hi;
 	struct scsi_id_instance_data *scsi_id = NULL, *scsi_id_tmp;
 	u32 id;
-	Scsi_Cmnd *SCpnt = NULL;
+	struct scsi_cmnd *SCpnt = NULL;
 	u32 scsi_status = SBP2_SCSI_STATUS_GOOD;
 	struct sbp2_command_info *command;
 
@@ -2454,7 +2461,8 @@
  * This routine is the main request entry routine for doing I/O. It is
  * called from the scsi stack directly.
  */
-static int sbp2scsi_queuecommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
+static int sbp2scsi_queuecommand(struct scsi_cmnd *SCpnt,
+				 void (*done)(struct scsi_cmnd *))
 {
 	struct scsi_id_instance_data *scsi_id =
 		(struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
@@ -2550,9 +2558,8 @@
 					    PCI_DMA_BIDIRECTIONAL);
 		sbp2util_mark_command_completed(scsi_id, command);
 		if (command->Current_SCpnt) {
-			void (*done)(Scsi_Cmnd *) = command->Current_done;
 			command->Current_SCpnt->result = status << 16;
-			done (command->Current_SCpnt);
+			command->Current_done(command->Current_SCpnt);
 		}
 	}
 
@@ -2565,8 +2572,8 @@
  * This can be called in interrupt context.
  */
 static void sbp2scsi_complete_command(struct scsi_id_instance_data *scsi_id,
-				      u32 scsi_status, Scsi_Cmnd *SCpnt,
-				      void (*done)(Scsi_Cmnd *))
+				      u32 scsi_status, struct scsi_cmnd *SCpnt,
+				      void (*done)(struct scsi_cmnd *))
 {
 	unsigned long flags;
 
@@ -2611,8 +2618,8 @@
 			 * Debug stuff
 			 */
 #if CONFIG_IEEE1394_SBP2_DEBUG >= 1
-			print_command (SCpnt->cmnd);
-			print_sense("bh", SCpnt);
+			scsi_print_command(SCpnt);
+			scsi_print_sense("bh", SCpnt);
 #endif
 
 			break;
@@ -2620,7 +2627,7 @@
 		case SBP2_SCSI_STATUS_SELECTION_TIMEOUT:
 			SBP2_ERR("SBP2_SCSI_STATUS_SELECTION_TIMEOUT");
 			SCpnt->result = DID_NO_CONNECT << 16;
-			print_command (SCpnt->cmnd);
+			scsi_print_command(SCpnt);
 			break;
 
 		case SBP2_SCSI_STATUS_CONDITION_MET:
@@ -2628,7 +2635,7 @@
 		case SBP2_SCSI_STATUS_COMMAND_TERMINATED:
 			SBP2_ERR("Bad SCSI status = %x", scsi_status);
 			SCpnt->result = DID_ERROR << 16;
-			print_command (SCpnt->cmnd);
+			scsi_print_command(SCpnt);
 			break;
 
 		default:
@@ -2688,7 +2695,7 @@
  * Called by scsi stack when something has really gone wrong.  Usually
  * called when a command has timed-out for some reason.
  */
-static int sbp2scsi_abort (Scsi_Cmnd *SCpnt)
+static int sbp2scsi_abort(struct scsi_cmnd *SCpnt)
 {
 	struct scsi_id_instance_data *scsi_id =
 		(struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
@@ -2696,7 +2703,7 @@
 	struct sbp2_command_info *command;
 
 	SBP2_ERR("aborting sbp2 command");
-	print_command (SCpnt->cmnd);
+	scsi_print_command(SCpnt);
 
 	if (scsi_id) {
 
@@ -2717,9 +2724,8 @@
 						    PCI_DMA_BIDIRECTIONAL);
 			sbp2util_mark_command_completed(scsi_id, command);
 			if (command->Current_SCpnt) {
-				void (*done)(Scsi_Cmnd *) = command->Current_done;
 				command->Current_SCpnt->result = DID_ABORT << 16;
-				done (command->Current_SCpnt);
+				command->Current_done(command->Current_SCpnt);
 			}
 		}
 
@@ -2736,7 +2742,7 @@
 /*
  * Called by scsi stack when something has really gone wrong.
  */
-static int sbp2scsi_reset (Scsi_Cmnd *SCpnt)
+static int sbp2scsi_reset(struct scsi_cmnd *SCpnt)
 {
 	struct scsi_id_instance_data *scsi_id =
 		(struct scsi_id_instance_data *)SCpnt->device->host->hostdata[0];
@@ -2789,7 +2795,7 @@
 MODULE_LICENSE("GPL");
 
 /* SCSI host template */
-static Scsi_Host_Template scsi_driver_template = {
+static struct scsi_host_template scsi_driver_template = {
 	.module =			THIS_MODULE,
 	.name =				"SBP-2 IEEE-1394",
 	.proc_name =			SBP2_DEVICE_NAME,
diff -Nru a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h
--- a/drivers/ieee1394/sbp2.h	2004-10-18 22:10:58 -07:00
+++ b/drivers/ieee1394/sbp2.h	2005-01-30 19:10:07 -08:00
@@ -324,8 +324,8 @@
 	struct list_head list;
 	struct sbp2_command_orb command_orb ____cacheline_aligned;
 	dma_addr_t command_orb_dma ____cacheline_aligned;
-	Scsi_Cmnd *Current_SCpnt;
-	void (*Current_done)(Scsi_Cmnd *);
+	struct scsi_cmnd *Current_SCpnt;
+	void (*Current_done)(struct scsi_cmnd *);
 
 	/* Also need s/g structure for each sbp2 command */
 	struct sbp2_unrestricted_page_table scatter_gather_element[SG_ALL] ____cacheline_aligned;
@@ -434,8 +434,8 @@
 static struct sbp2_command_info *sbp2util_find_command_for_orb(struct scsi_id_instance_data *scsi_id, dma_addr_t orb);
 static struct sbp2_command_info *sbp2util_find_command_for_SCpnt(struct scsi_id_instance_data *scsi_id, void *SCpnt);
 static struct sbp2_command_info *sbp2util_allocate_command_orb(struct scsi_id_instance_data *scsi_id,
-							  Scsi_Cmnd *Current_SCpnt,
-							  void (*Current_done)(Scsi_Cmnd *));
+							  struct scsi_cmnd *Current_SCpnt,
+							  void (*Current_done)(struct scsi_cmnd *));
 static void sbp2util_mark_command_completed(struct scsi_id_instance_data *scsi_id,
 		struct sbp2_command_info *command);
 
@@ -466,14 +466,16 @@
 				   unsigned int scsi_use_sg,
 				   unsigned int scsi_request_bufflen,
 				   void *scsi_request_buffer,
-				   unsigned char scsi_dir);
+				   enum dma_data_direction dma_dir);
 static int sbp2_link_orb_command(struct scsi_id_instance_data *scsi_id,
 				 struct sbp2_command_info *command);
 static int sbp2_send_command(struct scsi_id_instance_data *scsi_id,
-			     Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *));
+			     struct scsi_cmnd *SCpnt,
+			     void (*done)(struct scsi_cmnd *));
 static unsigned int sbp2_status_to_sense_data(unchar *sbp2_status, unchar *sense_data);
 static void sbp2_check_sbp2_command(struct scsi_id_instance_data *scsi_id, unchar *cmd);
-static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id, Scsi_Cmnd *SCpnt);
+static void sbp2_check_sbp2_response(struct scsi_id_instance_data *scsi_id,
+				     struct scsi_cmnd *SCpnt);
 static void sbp2_parse_unit_directory(struct scsi_id_instance_data *scsi_id,
 				      struct unit_directory *ud);
 static int sbp2_set_busy_timeout(struct scsi_id_instance_data *scsi_id);
diff -Nru a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
--- a/drivers/ieee1394/video1394.c	2005-01-20 21:01:18 -08:00
+++ b/drivers/ieee1394/video1394.c	2005-01-30 21:57:19 -08:00
@@ -16,14 +16,25 @@
  * 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.
+ *
+ * NOTES:
+ *
+ * jds -- add private data to file to keep track of iso contexts associated
+ * with each open -- so release won't kill all iso transfers.
+ * 
+ * Damien Douxchamps: Fix failure when the number of DMA pages per frame is
+ * one.
+ * 
+ * ioctl return codes:
+ * EFAULT is only for invalid address for the argp
+ * EINVAL for out of range values
+ * EBUSY when trying to use an already used resource
+ * ESRCH when trying to free/stop a not used resource
+ * EAGAIN for resource allocation failure that could perhaps succeed later
+ * ENOTTY for unsupported ioctl request
+ *
  */
 
-/* jds -- add private data to file to keep track of iso contexts associated
-   with each open -- so release won't kill all iso transfers */
-
-/* Damien Douxchamps: Fix failure when the number of DMA pages per frame is
-   one */
-
 #include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
@@ -146,8 +157,8 @@
 #define PRINT(level, card, fmt, args...) \
 printk(level "video1394_%d: " fmt "\n" , card , ## args)
 
-void wakeup_dma_ir_ctx(unsigned long l);
-void wakeup_dma_it_ctx(unsigned long l);
+static void wakeup_dma_ir_ctx(unsigned long l);
+static void wakeup_dma_it_ctx(unsigned long l);
 
 static struct hpsb_highlevel video1394_highlevel;
 
@@ -487,7 +498,7 @@
 	return NULL;
 }
 
-void wakeup_dma_ir_ctx(unsigned long l)
+static void wakeup_dma_ir_ctx(unsigned long l)
 {
 	struct dma_iso_ctx *d = (struct dma_iso_ctx *) l;
 	int i;
@@ -560,7 +571,7 @@
 #endif
 }
 
-void wakeup_dma_it_ctx(unsigned long l)
+static void wakeup_dma_it_ctx(unsigned long l)
 {
 	struct dma_iso_ctx *d = (struct dma_iso_ctx *) l;
 	struct ti_ohci *ohci = d->ohci;
@@ -723,7 +734,12 @@
 		/* if channel < 0, find lowest available one */
 		if (v.channel < 0) {
 		    mask = (u64)0x1;
-		    for (i=0; i<ISO_CHANNELS; i++) {
+		    for (i=0; ; i++) {
+			if (i == ISO_CHANNELS) {
+			    PRINT(KERN_ERR, ohci->host->id, 
+				  "No free channel found");
+			    return EAGAIN;
+			}
 			if (!(ohci->ISO_channel_usage & mask)) {
 			    v.channel = i;
 			    PRINT(KERN_INFO, ohci->host->id, "Found free channel %d", i);
@@ -731,42 +747,40 @@
 			}
 			mask = mask << 1;
 		    }
-		}
-
-		if (v.channel<0 || v.channel>(ISO_CHANNELS-1)) {
+		} else if (v.channel >= ISO_CHANNELS) {
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Iso channel %d out of bounds", v.channel);
-			return -EFAULT;
+			return -EINVAL;
+		} else {
+			mask = (u64)0x1<<v.channel;
 		}
-		mask = (u64)0x1<<v.channel;
-		printk("mask: %08X%08X usage: %08X%08X\n",
-		       (u32)(mask>>32),(u32)(mask&0xffffffff),
-		       (u32)(ohci->ISO_channel_usage>>32),
-		       (u32)(ohci->ISO_channel_usage&0xffffffff));
+		PRINT(KERN_INFO, ohci->host->id, "mask: %08X%08X usage: %08X%08X\n",
+			(u32)(mask>>32),(u32)(mask&0xffffffff),
+			(u32)(ohci->ISO_channel_usage>>32),
+			(u32)(ohci->ISO_channel_usage&0xffffffff));
 		if (ohci->ISO_channel_usage & mask) {
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Channel %d is already taken", v.channel);
-			return -EFAULT;
+			return -EBUSY;
 		}
-		ohci->ISO_channel_usage |= mask;
 
 		if (v.buf_size == 0 || v.buf_size > VIDEO1394_MAX_SIZE) {
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Invalid %d length buffer requested",v.buf_size);
-			return -EFAULT;
+			return -EINVAL;
 		}
 
 		if (v.nb_buffers == 0 || v.nb_buffers > VIDEO1394_MAX_SIZE) {
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Invalid %d buffers requested",v.nb_buffers);
-			return -EFAULT;
+			return -EINVAL;
 		}
 
 		if (v.nb_buffers * v.buf_size > VIDEO1394_MAX_SIZE) {
 			PRINT(KERN_ERR, ohci->host->id,
 			      "%d buffers of size %d bytes is too big",
 			      v.nb_buffers, v.buf_size);
-			return -EFAULT;
+			return -EINVAL;
 		}
 
 		if (cmd == VIDEO1394_IOC_LISTEN_CHANNEL) {
@@ -777,7 +791,7 @@
 			if (d == NULL) {
 				PRINT(KERN_ERR, ohci->host->id,
 				      "Couldn't allocate ir context");
-				return -EFAULT;
+				return -EAGAIN;
 			}
 			initialize_dma_ir_ctx(d, v.sync_tag, v.flags);
 
@@ -798,7 +812,7 @@
 			if (d == NULL) {
 				PRINT(KERN_ERR, ohci->host->id,
 				      "Couldn't allocate it context");
-				return -EFAULT;
+				return -EAGAIN;
 			}
 			initialize_dma_it_ctx(d, v.sync_tag,
 					      v.syt_offset, v.flags);
@@ -814,8 +828,12 @@
 			      v.channel);
 		}
 
-		if (copy_to_user(argp, &v, sizeof(v)))
+		if (copy_to_user((void *)arg, &v, sizeof(v))) {
+			/* FIXME : free allocated dma resources */
 			return -EFAULT;
+		}
+		
+		ohci->ISO_channel_usage |= mask;
 
 		return 0;
 	}
@@ -829,16 +847,16 @@
 		if (copy_from_user(&channel, argp, sizeof(int)))
 			return -EFAULT;
 
-		if (channel<0 || channel>(ISO_CHANNELS-1)) {
+		if (channel < 0 || channel >= ISO_CHANNELS) {
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Iso channel %d out of bound", channel);
-			return -EFAULT;
+			return -EINVAL;
 		}
 		mask = (u64)0x1<<channel;
 		if (!(ohci->ISO_channel_usage & mask)) {
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Channel %d is not being used", channel);
-			return -EFAULT;
+			return -ESRCH;
 		}
 
 		/* Mark this channel as unused */
@@ -849,7 +867,7 @@
 		else
 			d = find_ctx(&ctx->context_list, OHCI_ISO_TRANSMIT, channel);
 
-		if (d == NULL) return -EFAULT;
+		if (d == NULL) return -ESRCH;
 		PRINT(KERN_INFO, ohci->host->id, "Iso context %d "
 		      "stop talking on channel %d", d->ctx, channel);
 		free_dma_iso_ctx(d);
@@ -870,7 +888,7 @@
 		if ((v.buffer<0) || (v.buffer>d->num_desc)) {
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Buffer %d out of range",v.buffer);
-			return -EFAULT;
+			return -EINVAL;
 		}
 
 		spin_lock_irqsave(&d->lock,flags);
@@ -879,7 +897,7 @@
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Buffer %d is already used",v.buffer);
 			spin_unlock_irqrestore(&d->lock,flags);
-			return -EFAULT;
+			return -EBUSY;
 		}
 
 		d->buffer_status[v.buffer]=VIDEO1394_BUFFER_QUEUED;
@@ -933,7 +951,7 @@
 		if ((v.buffer<0) || (v.buffer>d->num_desc)) {
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Buffer %d out of range",v.buffer);
-			return -EFAULT;
+			return -EINVAL;
 		}
 
 		/*
@@ -976,7 +994,7 @@
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Buffer %d is not queued",v.buffer);
 			spin_unlock_irqrestore(&d->lock, flags);
-			return -EFAULT;
+			return -ESRCH;
 		}
 
 		/* set time of buffer */
@@ -1015,7 +1033,7 @@
 		if ((v.buffer<0) || (v.buffer>d->num_desc)) {
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Buffer %d out of range",v.buffer);
-			return -EFAULT;
+			return -EINVAL;
 		}
 
 		if (d->flags & VIDEO1394_VARIABLE_PACKET_SIZE) {
@@ -1044,7 +1062,7 @@
 			spin_unlock_irqrestore(&d->lock,flags);
 			if (psizes)
 				kfree(psizes);
-			return -EFAULT;
+			return -EBUSY;
 		}
 
 		if (d->flags & VIDEO1394_VARIABLE_PACKET_SIZE) {
@@ -1118,7 +1136,7 @@
 		if ((v.buffer<0) || (v.buffer>d->num_desc)) {
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Buffer %d out of range",v.buffer);
-			return -EFAULT;
+			return -EINVAL;
 		}
 
 		switch(d->buffer_status[v.buffer]) {
@@ -1144,11 +1162,11 @@
 		default:
 			PRINT(KERN_ERR, ohci->host->id,
 			      "Buffer %d is not queued",v.buffer);
-			return -EFAULT;
+			return -ESRCH;
 		}
 	}
 	default:
-		return -EINVAL;
+		return -ENOTTY;
 	}
 }
 
@@ -1170,7 +1188,7 @@
  *    But e.g. pte_alloc() does not work in modules ... :-(
  */
 
-int video1394_mmap(struct file *file, struct vm_area_struct *vma)
+static int video1394_mmap(struct file *file, struct vm_area_struct *vma)
 {
 	struct file_ctx *ctx = (struct file_ctx *)file->private_data;
 	int res = -EINVAL;
@@ -1269,6 +1287,16 @@
 		.specifier_id	= CAMERA_UNIT_SPEC_ID_ENTRY & 0xffffff,
 		.version	= CAMERA_SW_VERSION_ENTRY & 0xffffff
 	},
+        {
+                .match_flags    = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION,
+                .specifier_id   = CAMERA_UNIT_SPEC_ID_ENTRY & 0xffffff,
+                .version        = (CAMERA_SW_VERSION_ENTRY + 1) & 0xffffff
+        },
+        {
+                .match_flags    = IEEE1394_MATCH_SPECIFIER_ID | IEEE1394_MATCH_VERSION,
+                .specifier_id   = CAMERA_UNIT_SPEC_ID_ENTRY & 0xffffff,
+                .version        = (CAMERA_SW_VERSION_ENTRY + 2) & 0xffffff
+        },
 	{ }
 };
 
@@ -1304,6 +1332,9 @@
 	hpsb_set_hostinfo_key(&video1394_highlevel, host, ohci->host->id);
 
 	minor = IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id;
+	class_simple_device_add(hpsb_protocol_class, MKDEV(
+		IEEE1394_MAJOR,	minor), 
+		NULL, "%s-%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
 	devfs_mk_cdev(MKDEV(IEEE1394_MAJOR, minor),
 		       S_IFCHR | S_IRUSR | S_IWUSR,
 		       "%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
@@ -1314,9 +1345,12 @@
 {
 	struct ti_ohci *ohci = hpsb_get_hostinfo(&video1394_highlevel, host);
 
-	if (ohci)
+	if (ohci) {
+		class_simple_device_remove(MKDEV(IEEE1394_MAJOR, 
+			IEEE1394_MINOR_BLOCK_VIDEO1394 * 16 + ohci->host->id));
 		devfs_remove("%s/%d", VIDEO1394_DRIVER_NAME, ohci->host->id);
-
+	}
+	
 	return;
 }
 
diff -Nru a/drivers/infiniband/core/agent.c b/drivers/infiniband/core/agent.c
--- a/drivers/infiniband/core/agent.c	2004-12-27 22:04:25 -08:00
+++ b/drivers/infiniband/core/agent.c	2005-03-04 22:32:51 -08:00
@@ -45,14 +45,11 @@
 #include "smi.h"
 #include "agent_priv.h"
 #include "mad_priv.h"
-
+#include "agent.h"
 
 spinlock_t ib_agent_port_list_lock;
 static LIST_HEAD(ib_agent_port_list);
 
-extern kmem_cache_t *ib_mad_cache;
-
-
 /*
  * Caller must hold ib_agent_port_list_lock
  */
@@ -66,14 +63,13 @@
 
 	if (device) {
 		list_for_each_entry(entry, &ib_agent_port_list, port_list) {
-			if (entry->dr_smp_agent->device == device &&
+			if (entry->smp_agent->device == device &&
 			    entry->port_num == port_num)
 				return entry;
 		}
 	} else {
 		list_for_each_entry(entry, &ib_agent_port_list, port_list) {
-			if ((entry->dr_smp_agent == mad_agent) ||
-			    (entry->lr_smp_agent == mad_agent) ||
+			if ((entry->smp_agent == mad_agent) ||
 			    (entry->perf_mgmt_agent == mad_agent))
 				return entry;
 		}
@@ -111,7 +107,7 @@
 		return 1;
 	}
 
-	return smi_check_local_smp(port_priv->dr_smp_agent, smp);
+	return smi_check_local_smp(port_priv->smp_agent, smp);
 }
 
 static int agent_mad_send(struct ib_mad_agent *mad_agent,
@@ -231,10 +227,8 @@
 	/* Get mad agent based on mgmt_class in MAD */
 	switch (mad->mad.mad.mad_hdr.mgmt_class) {
 		case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE:
-			mad_agent = port_priv->dr_smp_agent;
-			break;
 		case IB_MGMT_CLASS_SUBN_LID_ROUTED:
-			mad_agent = port_priv->lr_smp_agent;
+			mad_agent = port_priv->smp_agent;
 			break;
 		case IB_MGMT_CLASS_PERF_MGMT:
 			mad_agent = port_priv->perf_mgmt_agent;
@@ -284,7 +278,6 @@
 {
 	int ret;
 	struct ib_agent_port_private *port_priv;
-	struct ib_mad_reg_req reg_req;
 	unsigned long flags;
 
 	/* First, check if port already open for SMI */
@@ -308,35 +301,19 @@
 	spin_lock_init(&port_priv->send_list_lock);
 	INIT_LIST_HEAD(&port_priv->send_posted_list);
 
-	/* Obtain MAD agent for directed route SM class */
-	reg_req.mgmt_class = IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE;
-	reg_req.mgmt_class_version = 1;
-
-	port_priv->dr_smp_agent = ib_register_mad_agent(device, port_num,
-							IB_QPT_SMI,
-							NULL, 0,
-						       &agent_send_handler,
-							NULL, NULL);
+	/* Obtain send only MAD agent for SM class (SMI QP) */
+	port_priv->smp_agent = ib_register_mad_agent(device, port_num,
+						     IB_QPT_SMI,
+						     NULL, 0,
+						    &agent_send_handler,
+						     NULL, NULL);
 
-	if (IS_ERR(port_priv->dr_smp_agent)) {
-		ret = PTR_ERR(port_priv->dr_smp_agent);
+	if (IS_ERR(port_priv->smp_agent)) {
+		ret = PTR_ERR(port_priv->smp_agent);
 		goto error2;
 	}
 
-	/* Obtain MAD agent for LID routed SM class */
-	reg_req.mgmt_class = IB_MGMT_CLASS_SUBN_LID_ROUTED;
-	port_priv->lr_smp_agent = ib_register_mad_agent(device, port_num,
-							IB_QPT_SMI,
-							NULL, 0,
-						       &agent_send_handler,
-							NULL, NULL);
-	if (IS_ERR(port_priv->lr_smp_agent)) {
-		ret = PTR_ERR(port_priv->lr_smp_agent);
-		goto error3;
-	}
-
-	/* Obtain MAD agent for PerfMgmt class */
-	reg_req.mgmt_class = IB_MGMT_CLASS_PERF_MGMT;
+	/* Obtain send only MAD agent for PerfMgmt class (GSI QP) */
 	port_priv->perf_mgmt_agent = ib_register_mad_agent(device, port_num,
 							   IB_QPT_GSI,
 							   NULL, 0,
@@ -344,15 +321,15 @@
 							   NULL, NULL);
 	if (IS_ERR(port_priv->perf_mgmt_agent)) {
 		ret = PTR_ERR(port_priv->perf_mgmt_agent);
-		goto error4;
+		goto error3;
 	}
 
-	port_priv->mr = ib_get_dma_mr(port_priv->dr_smp_agent->qp->pd,
+	port_priv->mr = ib_get_dma_mr(port_priv->smp_agent->qp->pd,
 				      IB_ACCESS_LOCAL_WRITE);
 	if (IS_ERR(port_priv->mr)) {
 		printk(KERN_ERR SPFX "Couldn't get DMA MR\n");
 		ret = PTR_ERR(port_priv->mr);
-		goto error5;
+		goto error4;
 	}
 
 	spin_lock_irqsave(&ib_agent_port_list_lock, flags);
@@ -361,12 +338,10 @@
 
 	return 0;
 
-error5:
-	ib_unregister_mad_agent(port_priv->perf_mgmt_agent);
 error4:
-	ib_unregister_mad_agent(port_priv->lr_smp_agent);
+	ib_unregister_mad_agent(port_priv->perf_mgmt_agent);
 error3:
-	ib_unregister_mad_agent(port_priv->dr_smp_agent);
+	ib_unregister_mad_agent(port_priv->smp_agent);
 error2:
 	kfree(port_priv);
 error1:
@@ -391,8 +366,7 @@
 	ib_dereg_mr(port_priv->mr);
 
 	ib_unregister_mad_agent(port_priv->perf_mgmt_agent);
-	ib_unregister_mad_agent(port_priv->lr_smp_agent);
-	ib_unregister_mad_agent(port_priv->dr_smp_agent);
+	ib_unregister_mad_agent(port_priv->smp_agent);
 	kfree(port_priv);
 
 	return 0;
diff -Nru a/drivers/infiniband/core/agent_priv.h b/drivers/infiniband/core/agent_priv.h
--- a/drivers/infiniband/core/agent_priv.h	2004-12-27 22:06:02 -08:00
+++ b/drivers/infiniband/core/agent_priv.h	2005-03-04 22:32:50 -08:00
@@ -55,8 +55,7 @@
 	struct list_head send_posted_list;
 	spinlock_t send_list_lock;
 	int port_num;
-	struct ib_mad_agent *dr_smp_agent;    /* DR SM class */
-	struct ib_mad_agent *lr_smp_agent;    /* LR SM class */
+	struct ib_mad_agent *smp_agent;	      /* SM class */
 	struct ib_mad_agent *perf_mgmt_agent; /* PerfMgmt class */
 	struct ib_mr *mr;
 };
diff -Nru a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c
--- a/drivers/infiniband/core/cache.c	2005-01-15 14:01:50 -08:00
+++ b/drivers/infiniband/core/cache.c	2005-03-04 22:32:52 -08:00
@@ -37,6 +37,8 @@
 #include <linux/errno.h>
 #include <linux/slab.h>
 
+#include <ib_cache.h>
+
 #include "core_priv.h"
 
 struct ib_pkey_cache {
@@ -112,7 +114,7 @@
 		cache = device->cache.gid_cache[p];
 		for (i = 0; i < cache->table_len; ++i) {
 			if (!memcmp(gid, &cache->table[i], sizeof *gid)) {
-				*port_num = p;
+				*port_num = p + start_port(device);
 				if (index)
 					*index = i;
 				ret = 0;
diff -Nru a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
--- a/drivers/infiniband/core/mad.c	2005-01-15 14:01:50 -08:00
+++ b/drivers/infiniband/core/mad.c	2005-03-04 22:32:56 -08:00
@@ -41,7 +41,6 @@
 #include "smi.h"
 #include "agent.h"
 
-
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_DESCRIPTION("kernel IB MAD API");
 MODULE_AUTHOR("Hal Rosenstock");
@@ -69,6 +68,7 @@
 static void ib_mad_complete_send_wr(struct ib_mad_send_wr_private *mad_send_wr,
 				    struct ib_mad_send_wc *mad_send_wc);
 static void timeout_sends(void *data);
+static void cancel_sends(void *data);
 static void local_completions(void *data);
 static int solicited_mad(struct ib_mad *mad);
 static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req,
@@ -342,6 +342,8 @@
 	INIT_LIST_HEAD(&mad_agent_priv->local_list);
 	INIT_WORK(&mad_agent_priv->local_work, local_completions,
 		   mad_agent_priv);
+	INIT_LIST_HEAD(&mad_agent_priv->canceled_list);
+	INIT_WORK(&mad_agent_priv->canceled_work, cancel_sends, mad_agent_priv);
 	atomic_set(&mad_agent_priv->refcount, 1);
 	init_waitqueue_head(&mad_agent_priv->wait);
 
@@ -490,6 +492,7 @@
 	cancel_mads(mad_agent_priv);
 
 	port_priv = mad_agent_priv->qp_info->port_priv;
+
 	cancel_delayed_work(&mad_agent_priv->timed_work);
 	flush_workqueue(port_priv->wq);
 
@@ -1266,12 +1269,12 @@
 	}
 
 	port_priv = agent_priv->qp_info->port_priv;
+	mgmt_class = convert_mgmt_class(agent_priv->reg_req->mgmt_class);
 	class = port_priv->version[
 			agent_priv->reg_req->mgmt_class_version].class;
 	if (!class)
 		goto vendor_check;
 
-	mgmt_class = convert_mgmt_class(agent_priv->reg_req->mgmt_class);
 	method = class->method_table[mgmt_class];
 	if (method) {
 		/* Remove any methods for this mad agent */
@@ -1293,16 +1296,21 @@
 	}
 
 vendor_check:
+	if (!is_vendor_class(mgmt_class))
+		goto out;
+
+	/* normalize mgmt_class to vendor range 2 */
+	mgmt_class = vendor_class_index(agent_priv->reg_req->mgmt_class);
 	vendor = port_priv->version[
 			agent_priv->reg_req->mgmt_class_version].vendor;
+
 	if (!vendor)
 		goto out;
 
-	mgmt_class = vendor_class_index(agent_priv->reg_req->mgmt_class);
 	vendor_class = vendor->vendor_class[mgmt_class];
 	if (vendor_class) {
 		index = find_vendor_oui(vendor_class, agent_priv->reg_req->oui);
-		if (index == -1)
+		if (index < 0)
 			goto out;
 		method = vendor_class->method_table[index];
 		if (method) {
@@ -1999,12 +2007,44 @@
 	return NULL;
 }
 
+void cancel_sends(void *data)
+{
+	struct ib_mad_agent_private *mad_agent_priv;
+	struct ib_mad_send_wr_private *mad_send_wr;
+	struct ib_mad_send_wc mad_send_wc;
+	unsigned long flags;
+
+	mad_agent_priv = data;
+
+	mad_send_wc.status = IB_WC_WR_FLUSH_ERR;
+	mad_send_wc.vendor_err = 0;
+
+	spin_lock_irqsave(&mad_agent_priv->lock, flags);
+	while (!list_empty(&mad_agent_priv->canceled_list)) {
+		mad_send_wr = list_entry(mad_agent_priv->canceled_list.next,
+					 struct ib_mad_send_wr_private,
+					 agent_list);
+
+		list_del(&mad_send_wr->agent_list);
+		spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
+
+		mad_send_wc.wr_id = mad_send_wr->wr_id;
+		mad_agent_priv->agent.send_handler(&mad_agent_priv->agent,
+						   &mad_send_wc);
+
+		kfree(mad_send_wr);
+		if (atomic_dec_and_test(&mad_agent_priv->refcount))
+			wake_up(&mad_agent_priv->wait);
+		spin_lock_irqsave(&mad_agent_priv->lock, flags);
+	}
+	spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
+}
+
 void ib_cancel_mad(struct ib_mad_agent *mad_agent,
 		  u64 wr_id)
 {
 	struct ib_mad_agent_private *mad_agent_priv;
 	struct ib_mad_send_wr_private *mad_send_wr;
-	struct ib_mad_send_wc mad_send_wc;
 	unsigned long flags;
 
 	mad_agent_priv = container_of(mad_agent, struct ib_mad_agent_private,
@@ -2026,19 +2066,12 @@
 	}
 
 	list_del(&mad_send_wr->agent_list);
+	list_add_tail(&mad_send_wr->agent_list, &mad_agent_priv->canceled_list);
 	adjust_timeout(mad_agent_priv);
 	spin_unlock_irqrestore(&mad_agent_priv->lock, flags);
 
-	mad_send_wc.status = IB_WC_WR_FLUSH_ERR;
-	mad_send_wc.vendor_err = 0;
-	mad_send_wc.wr_id = mad_send_wr->wr_id;
-	mad_agent_priv->agent.send_handler(&mad_agent_priv->agent,
-					   &mad_send_wc);
-
-	kfree(mad_send_wr);
-	if (atomic_dec_and_test(&mad_agent_priv->refcount))
-		wake_up(&mad_agent_priv->wait);
-
+	queue_work(mad_agent_priv->qp_info->port_priv->wq,
+		   &mad_agent_priv->canceled_work);
 out:
 	return;
 }
@@ -2186,7 +2219,6 @@
 	recv_wr.next = NULL;
 	recv_wr.sg_list = &sg_list;
 	recv_wr.num_sge = 1;
-	recv_wr.recv_flags = IB_RECV_SIGNALED;
 
 	do {
 		/* Allocate and map receive buffer */
@@ -2381,7 +2413,6 @@
 	qp_init_attr.send_cq = qp_info->port_priv->cq;
 	qp_init_attr.recv_cq = qp_info->port_priv->cq;
 	qp_init_attr.sq_sig_type = IB_SIGNAL_ALL_WR;
-	qp_init_attr.rq_sig_type = IB_SIGNAL_ALL_WR;
 	qp_init_attr.cap.max_send_wr = IB_MAD_QP_SEND_SIZE;
 	qp_init_attr.cap.max_recv_wr = IB_MAD_QP_RECV_SIZE;
 	qp_init_attr.cap.max_send_sge = IB_MAD_SEND_REQ_MAX_SG;
diff -Nru a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h
--- a/drivers/infiniband/core/mad_priv.h	2005-01-15 14:01:50 -08:00
+++ b/drivers/infiniband/core/mad_priv.h	2005-03-04 22:32:56 -08:00
@@ -58,8 +58,8 @@
 #define MAX_MGMT_CLASS		80
 #define MAX_MGMT_VERSION	8
 #define MAX_MGMT_OUI		8
-#define MAX_MGMT_VENDOR_RANGE2	IB_MGMT_CLASS_VENDOR_RANGE2_END - \
-				IB_MGMT_CLASS_VENDOR_RANGE2_START + 1
+#define MAX_MGMT_VENDOR_RANGE2	(IB_MGMT_CLASS_VENDOR_RANGE2_END - \
+				IB_MGMT_CLASS_VENDOR_RANGE2_START + 1)
 
 struct ib_mad_list_head {
 	struct list_head list;
@@ -95,6 +95,8 @@
 	unsigned long timeout;
 	struct list_head local_list;
 	struct work_struct local_work;
+	struct list_head canceled_list;
+	struct work_struct canceled_work;
 
 	atomic_t refcount;
 	wait_queue_head_t wait;
@@ -191,5 +193,7 @@
 	struct work_struct work;
 	struct ib_mad_qp_info qp_info[IB_MAD_QPS_CORE];
 };
+
+extern kmem_cache_t *ib_mad_cache;
 
 #endif	/* __IB_MAD_PRIV_H__ */
diff -Nru a/drivers/infiniband/core/smi.c b/drivers/infiniband/core/smi.c
--- a/drivers/infiniband/core/smi.c	2004-12-27 22:07:09 -08:00
+++ b/drivers/infiniband/core/smi.c	2005-03-04 22:32:51 -08:00
@@ -37,7 +37,7 @@
  */
 
 #include <ib_smi.h>
-
+#include "smi.h"
 
 /*
  * Fixup a directed route SMP for sending
diff -Nru a/drivers/infiniband/hw/mthca/Makefile b/drivers/infiniband/hw/mthca/Makefile
--- a/drivers/infiniband/hw/mthca/Makefile	2005-01-15 14:01:47 -08:00
+++ b/drivers/infiniband/hw/mthca/Makefile	2005-03-04 22:32:53 -08:00
@@ -9,4 +9,4 @@
 ib_mthca-y :=	mthca_main.o mthca_cmd.o mthca_profile.o mthca_reset.o \
 		mthca_allocator.o mthca_eq.o mthca_pd.o mthca_cq.o \
 		mthca_mr.o mthca_qp.o mthca_av.o mthca_mcg.o mthca_mad.o \
-		mthca_provider.o mthca_memfree.o
+		mthca_provider.o mthca_memfree.o mthca_uar.o
diff -Nru a/drivers/infiniband/hw/mthca/mthca_av.c b/drivers/infiniband/hw/mthca/mthca_av.c
--- a/drivers/infiniband/hw/mthca/mthca_av.c	2005-01-15 14:01:50 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_av.c	2005-03-04 22:32:55 -08:00
@@ -60,27 +60,34 @@
 	u32 index = -1;
 	struct mthca_av *av = NULL;
 
-	ah->on_hca = 0;
+	ah->type = MTHCA_AH_PCI_POOL;
 
-	if (!atomic_read(&pd->sqp_count) &&
-	    !(dev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN)) {
+	if (dev->hca_type == ARBEL_NATIVE) {
+		ah->av   = kmalloc(sizeof *ah->av, GFP_KERNEL);
+		if (!ah->av)
+			return -ENOMEM;
+
+		ah->type = MTHCA_AH_KMALLOC;
+		av       = ah->av;
+	} else if (!atomic_read(&pd->sqp_count) &&
+		 !(dev->mthca_flags & MTHCA_FLAG_DDR_HIDDEN)) {
 		index = mthca_alloc(&dev->av_table.alloc);
 
 		/* fall back to allocate in host memory */
 		if (index == -1)
-			goto host_alloc;
+			goto on_hca_fail;
 
 		av = kmalloc(sizeof *av, GFP_KERNEL);
 		if (!av)
-			goto host_alloc;
+			goto on_hca_fail;
 
-		ah->on_hca = 1;
+		ah->type = MTHCA_AH_ON_HCA;
 		ah->avdma  = dev->av_table.ddr_av_base +
 			index * MTHCA_AV_SIZE;
 	}
 
- host_alloc:
-	if (!ah->on_hca) {
+on_hca_fail:
+	if (ah->type == MTHCA_AH_PCI_POOL) {
 		ah->av = pci_pool_alloc(dev->av_table.pool,
 					SLAB_KERNEL, &ah->avdma);
 		if (!ah->av)
@@ -123,7 +130,7 @@
 			       j * 4, be32_to_cpu(((u32 *) av)[j]));
 	}
 
-	if (ah->on_hca) {
+	if (ah->type == MTHCA_AH_ON_HCA) {
 		memcpy_toio(dev->av_table.av_map + index * MTHCA_AV_SIZE,
 			    av, MTHCA_AV_SIZE);
 		kfree(av);
@@ -134,12 +141,21 @@
 
 int mthca_destroy_ah(struct mthca_dev *dev, struct mthca_ah *ah)
 {
-	if (ah->on_hca)
+	switch (ah->type) {
+	case MTHCA_AH_ON_HCA:
 		mthca_free(&dev->av_table.alloc,
  			   (ah->avdma - dev->av_table.ddr_av_base) /
 			   MTHCA_AV_SIZE);
-	else
+		break;
+
+	case MTHCA_AH_PCI_POOL:
 		pci_pool_free(dev->av_table.pool, ah->av, ah->avdma);
+		break;
+
+	case MTHCA_AH_KMALLOC:
+		kfree(ah->av);
+		break;
+	}
 
 	return 0;
 }
@@ -147,7 +163,7 @@
 int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah,
 		  struct ib_ud_header *header)
 {
-	if (ah->on_hca)
+	if (ah->type == MTHCA_AH_ON_HCA)
 		return -EINVAL;
 
 	header->lrh.service_level   = be32_to_cpu(ah->av->sl_tclass_flowlabel) >> 28;
@@ -176,6 +192,9 @@
 {
 	int err;
 
+	if (dev->hca_type == ARBEL_NATIVE)
+		return 0;
+
 	err = mthca_alloc_init(&dev->av_table.alloc,
 			       dev->av_table.num_ddr_avs,
 			       dev->av_table.num_ddr_avs - 1,
@@ -212,6 +231,9 @@
 
 void __devexit mthca_cleanup_av_table(struct mthca_dev *dev)
 {
+	if (dev->hca_type == ARBEL_NATIVE)
+		return;
+
 	if (dev->av_table.av_map)
 		iounmap(dev->av_table.av_map);
 	pci_pool_destroy(dev->av_table.pool);
diff -Nru a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c	2005-01-25 13:50:23 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c	2005-03-04 22:32:54 -08:00
@@ -1290,7 +1290,7 @@
 		return -ENOMEM;
 
 	inbox[0] = cpu_to_be64(virt);
-	inbox[1] = cpu_to_be64(dma_addr | (PAGE_SHIFT - 12));
+	inbox[1] = cpu_to_be64(dma_addr);
 
 	err = mthca_cmd(dev, indma, 1, 0, CMD_MAP_ICM, CMD_TIME_CLASS_B, status);
 
@@ -1305,6 +1305,9 @@
 
 int mthca_UNMAP_ICM(struct mthca_dev *dev, u64 virt, u32 page_count, u8 *status)
 {
+	mthca_dbg(dev, "Unmapping %d pages at %llx from ICM.\n",
+		  page_count, (unsigned long long) virt);
+
 	return mthca_cmd(dev, virt, page_count, 0, CMD_UNMAP_ICM, CMD_TIME_CLASS_B, status);
 }
 
@@ -1538,10 +1541,10 @@
 		if (0) {
 			int i;
 			mthca_dbg(dev, "Dumping QP context:\n");
-			printk(" %08x\n", be32_to_cpup(qp_context));
+			printk("  opt param mask: %08x\n", be32_to_cpup(qp_context));
 			for (i = 0; i < 0x100 / 4; ++i) {
 				if (i % 8 == 0)
-					printk("[%02x] ", i * 4);
+					printk("  [%02x] ", i * 4);
 				printk(" %08x", be32_to_cpu(((u32 *) qp_context)[i + 2]));
 				if ((i + 1) % 8 == 0)
 					printk("\n");
diff -Nru a/drivers/infiniband/hw/mthca/mthca_cmd.h b/drivers/infiniband/hw/mthca/mthca_cmd.h
--- a/drivers/infiniband/hw/mthca/mthca_cmd.h	2005-01-25 13:50:23 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.h	2005-03-04 22:32:56 -08:00
@@ -95,7 +95,21 @@
 };
 
 enum {
-	DEV_LIM_FLAG_SRQ = 1 << 6
+	DEV_LIM_FLAG_RC                 = 1 << 0,
+	DEV_LIM_FLAG_UC                 = 1 << 1,
+	DEV_LIM_FLAG_UD                 = 1 << 2,
+	DEV_LIM_FLAG_RD                 = 1 << 3,
+	DEV_LIM_FLAG_RAW_IPV6           = 1 << 4,
+	DEV_LIM_FLAG_RAW_ETHER          = 1 << 5,
+	DEV_LIM_FLAG_SRQ                = 1 << 6,
+	DEV_LIM_FLAG_BAD_PKEY_CNTR      = 1 << 8,
+	DEV_LIM_FLAG_BAD_QKEY_CNTR      = 1 << 9,
+	DEV_LIM_FLAG_MW                 = 1 << 16,
+	DEV_LIM_FLAG_AUTO_PATH_MIG      = 1 << 17,
+	DEV_LIM_FLAG_ATOMIC             = 1 << 18,
+	DEV_LIM_FLAG_RAW_MULTI          = 1 << 19,
+	DEV_LIM_FLAG_UD_AV_PORT_ENFORCE = 1 << 20,
+	DEV_LIM_FLAG_UD_MULTI           = 1 << 21,
 };
 
 struct mthca_dev_lim {
diff -Nru a/drivers/infiniband/hw/mthca/mthca_config_reg.h b/drivers/infiniband/hw/mthca/mthca_config_reg.h
--- a/drivers/infiniband/hw/mthca/mthca_config_reg.h	2005-01-25 13:50:24 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_config_reg.h	2005-03-04 22:32:53 -08:00
@@ -46,5 +46,6 @@
 #define MTHCA_MAP_ECR_SIZE     (MTHCA_ECR_SIZE + MTHCA_ECR_CLR_SIZE)
 #define MTHCA_CLR_INT_BASE     0xf00d8
 #define MTHCA_CLR_INT_SIZE     0x00008
+#define MTHCA_EQ_SET_CI_SIZE   (8 * 32)
 
 #endif /* MTHCA_CONFIG_REG_H */
diff -Nru a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
--- a/drivers/infiniband/hw/mthca/mthca_cq.c	2005-02-03 06:42:39 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c	2005-03-04 22:32:56 -08:00
@@ -33,11 +33,13 @@
  */
 
 #include <linux/init.h>
+#include <linux/hardirq.h>
 
 #include <ib_pack.h>
 
 #include "mthca_dev.h"
 #include "mthca_cmd.h"
+#include "mthca_memfree.h"
 
 enum {
 	MTHCA_MAX_DIRECT_CQ_SIZE = 4 * PAGE_SIZE
@@ -54,7 +56,7 @@
 	u32 flags;
 	u64 start;
 	u32 logsize_usrpage;
-	u32 error_eqn;
+	u32 error_eqn;		/* Tavor only */
 	u32 comp_eqn;
 	u32 pd;
 	u32 lkey;
@@ -63,7 +65,9 @@
 	u32 consumer_index;
 	u32 producer_index;
 	u32 cqn;
-	u32 reserved[3];
+	u32 ci_db;		/* Arbel only */
+	u32 state_db;		/* Arbel only */
+	u32 reserved;
 } __attribute__((packed));
 
 #define MTHCA_CQ_STATUS_OK          ( 0 << 28)
@@ -132,11 +136,15 @@
 #define MTHCA_CQ_ENTRY_OWNER_SW      (0 << 7)
 #define MTHCA_CQ_ENTRY_OWNER_HW      (1 << 7)
 
-#define MTHCA_CQ_DB_INC_CI       (1 << 24)
-#define MTHCA_CQ_DB_REQ_NOT      (2 << 24)
-#define MTHCA_CQ_DB_REQ_NOT_SOL  (3 << 24)
-#define MTHCA_CQ_DB_SET_CI       (4 << 24)
-#define MTHCA_CQ_DB_REQ_NOT_MULT (5 << 24)
+#define MTHCA_TAVOR_CQ_DB_INC_CI       (1 << 24)
+#define MTHCA_TAVOR_CQ_DB_REQ_NOT      (2 << 24)
+#define MTHCA_TAVOR_CQ_DB_REQ_NOT_SOL  (3 << 24)
+#define MTHCA_TAVOR_CQ_DB_SET_CI       (4 << 24)
+#define MTHCA_TAVOR_CQ_DB_REQ_NOT_MULT (5 << 24)
+
+#define MTHCA_ARBEL_CQ_DB_REQ_NOT_SOL  (1 << 24)
+#define MTHCA_ARBEL_CQ_DB_REQ_NOT      (2 << 24)
+#define MTHCA_ARBEL_CQ_DB_REQ_NOT_MULT (3 << 24)
 
 static inline struct mthca_cqe *get_cqe(struct mthca_cq *cq, int entry)
 {
@@ -147,54 +155,58 @@
 			+ (entry * MTHCA_CQ_ENTRY_SIZE) % PAGE_SIZE;
 }
 
-static inline int cqe_sw(struct mthca_cq *cq, int i)
+static inline struct mthca_cqe *cqe_sw(struct mthca_cq *cq, int i)
 {
-	return !(MTHCA_CQ_ENTRY_OWNER_HW &
-		 get_cqe(cq, i)->owner);
+	struct mthca_cqe *cqe = get_cqe(cq, i);
+	return MTHCA_CQ_ENTRY_OWNER_HW & cqe->owner ? NULL : cqe;
 }
 
-static inline int next_cqe_sw(struct mthca_cq *cq)
+static inline struct mthca_cqe *next_cqe_sw(struct mthca_cq *cq)
 {
-	return cqe_sw(cq, cq->cons_index);
+	return cqe_sw(cq, cq->cons_index & cq->ibcq.cqe);
 }
 
-static inline void set_cqe_hw(struct mthca_cq *cq, int entry)
+static inline void set_cqe_hw(struct mthca_cqe *cqe)
 {
-	get_cqe(cq, entry)->owner = MTHCA_CQ_ENTRY_OWNER_HW;
+	cqe->owner = MTHCA_CQ_ENTRY_OWNER_HW;
 }
 
-static inline void inc_cons_index(struct mthca_dev *dev, struct mthca_cq *cq,
-				  int nent)
+/*
+ * incr is ignored in native Arbel (mem-free) mode, so cq->cons_index
+ * should be correct before calling update_cons_index().
+ */
+static inline void update_cons_index(struct mthca_dev *dev, struct mthca_cq *cq,
+				     int incr)
 {
 	u32 doorbell[2];
 
-	doorbell[0] = cpu_to_be32(MTHCA_CQ_DB_INC_CI | cq->cqn);
-	doorbell[1] = cpu_to_be32(nent - 1);
+	if (dev->hca_type == ARBEL_NATIVE) {
+		*cq->set_ci_db = cpu_to_be32(cq->cons_index);
+		wmb();
+	} else {
+		doorbell[0] = cpu_to_be32(MTHCA_TAVOR_CQ_DB_INC_CI | cq->cqn);
+		doorbell[1] = cpu_to_be32(incr - 1);
 
-	mthca_write64(doorbell,
-		      dev->kar + MTHCA_CQ_DOORBELL,
-		      MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
+		mthca_write64(doorbell,
+			      dev->kar + MTHCA_CQ_DOORBELL,
+			      MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
+	}
 }
 
 void mthca_cq_event(struct mthca_dev *dev, u32 cqn)
 {
 	struct mthca_cq *cq;
 
-	spin_lock(&dev->cq_table.lock);
 	cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1));
-	if (cq)
-		atomic_inc(&cq->refcount);
-	spin_unlock(&dev->cq_table.lock);
 
 	if (!cq) {
 		mthca_warn(dev, "Completion event for bogus CQ %08x\n", cqn);
 		return;
 	}
 
-	cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
+	++cq->arm_sn;
 
-	if (atomic_dec_and_test(&cq->refcount))
-		wake_up(&cq->wait);
+	cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
 }
 
 void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn)
@@ -250,8 +262,8 @@
 
 	if (nfreed) {
 		wmb();
-		inc_cons_index(dev, cq, nfreed);
-		cq->cons_index = (cq->cons_index + nfreed) & cq->ibcq.cqe;
+		cq->cons_index += nfreed;
+		update_cons_index(dev, cq, nfreed);
 	}
 
 	spin_unlock_irq(&cq->lock);
@@ -344,7 +356,7 @@
 		break;
 	}
 
-	err = mthca_free_err_wqe(qp, is_send, wqe_index, &dbd, &new_wqe);
+	err = mthca_free_err_wqe(dev, qp, is_send, wqe_index, &dbd, &new_wqe);
 	if (err)
 		return err;
 
@@ -383,12 +395,13 @@
 	struct mthca_wq *wq;
 	struct mthca_cqe *cqe;
 	int wqe_index;
-	int is_error = 0;
+	int is_error;
 	int is_send;
 	int free_cqe = 1;
 	int err = 0;
 
-	if (!next_cqe_sw(cq))
+	cqe = next_cqe_sw(cq);
+	if (!cqe)
 		return -EAGAIN;
 
 	/*
@@ -397,8 +410,6 @@
 	 */
 	rmb();
 
-	cqe = get_cqe(cq, cq->cons_index);
-
 	if (0) {
 		mthca_dbg(dev, "%x/%d: CQE -> QPN %06x, WQE @ %08x\n",
 			  cq->cqn, cq->cons_index, be32_to_cpu(cqe->my_qpn),
@@ -407,39 +418,25 @@
 		dump_cqe(cqe);
 	}
 
-	if ((cqe->opcode & MTHCA_ERROR_CQE_OPCODE_MASK) ==
-	    MTHCA_ERROR_CQE_OPCODE_MASK) {
-		is_error = 1;
-		is_send = cqe->opcode & 1;
-	} else
-		is_send = cqe->is_send & 0x80;
+	is_error = (cqe->opcode & MTHCA_ERROR_CQE_OPCODE_MASK) ==
+		MTHCA_ERROR_CQE_OPCODE_MASK;
+	is_send  = is_error ? cqe->opcode & 0x01 : cqe->is_send & 0x80;
 
 	if (!*cur_qp || be32_to_cpu(cqe->my_qpn) != (*cur_qp)->qpn) {
-		if (*cur_qp) {
-			if (*freed) {
-				wmb();
-				inc_cons_index(dev, cq, *freed);
-				*freed = 0;
-			}
-			spin_unlock(&(*cur_qp)->lock);
-		}
-
-		spin_lock(&dev->qp_table.lock);
+		/*
+		 * We do not have to take the QP table lock here,
+		 * because CQs will be locked while QPs are removed
+		 * from the table.
+		 */
 		*cur_qp = mthca_array_get(&dev->qp_table.qp,
 					  be32_to_cpu(cqe->my_qpn) &
 					  (dev->limits.num_qps - 1));
-		if (*cur_qp)
-			atomic_inc(&(*cur_qp)->refcount);
-		spin_unlock(&dev->qp_table.lock);
-
 		if (!*cur_qp) {
 			mthca_warn(dev, "CQ entry for unknown QP %06x\n",
 				   be32_to_cpu(cqe->my_qpn) & 0xffffff);
 			err = -EINVAL;
 			goto out;
 		}
-
-		spin_lock(&(*cur_qp)->lock);
 	}
 
 	entry->qp_num = (*cur_qp)->qpn;
@@ -457,9 +454,9 @@
 	}
 
 	if (wq->last_comp < wqe_index)
-		wq->cur -= wqe_index - wq->last_comp;
+		wq->tail += wqe_index - wq->last_comp;
 	else
-		wq->cur -= wq->max - wq->last_comp + wqe_index;
+		wq->tail += wqe_index + wq->max - wq->last_comp;
 
 	wq->last_comp = wqe_index;
 
@@ -509,10 +506,10 @@
 	entry->status = IB_WC_SUCCESS;
 
  out:
-	if (free_cqe) {
-		set_cqe_hw(cq, cq->cons_index);
+	if (likely(free_cqe)) {
+		set_cqe_hw(cqe);
 		++(*freed);
-		cq->cons_index = (cq->cons_index + 1) & cq->ibcq.cqe;
+		++cq->cons_index;
 	}
 
 	return err;
@@ -540,63 +537,101 @@
 
 	if (freed) {
 		wmb();
-		inc_cons_index(dev, cq, freed);
+		update_cons_index(dev, cq, freed);
 	}
 
-	if (qp) {
-		spin_unlock(&qp->lock);
-		if (atomic_dec_and_test(&qp->refcount))
-			wake_up(&qp->wait);
-	}
-
-
 	spin_unlock_irqrestore(&cq->lock, flags);
 
 	return err == 0 || err == -EAGAIN ? npolled : err;
 }
 
-void mthca_arm_cq(struct mthca_dev *dev, struct mthca_cq *cq,
-		  int solicited)
+int mthca_tavor_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify)
 {
 	u32 doorbell[2];
 
-	doorbell[0] =  cpu_to_be32((solicited ?
-				    MTHCA_CQ_DB_REQ_NOT_SOL :
-				    MTHCA_CQ_DB_REQ_NOT)      |
-				   cq->cqn);
+	doorbell[0] = cpu_to_be32((notify == IB_CQ_SOLICITED ?
+				   MTHCA_TAVOR_CQ_DB_REQ_NOT_SOL :
+				   MTHCA_TAVOR_CQ_DB_REQ_NOT)      |
+				  to_mcq(cq)->cqn);
 	doorbell[1] = 0xffffffff;
 
 	mthca_write64(doorbell,
-		      dev->kar + MTHCA_CQ_DOORBELL,
-		      MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
+		      to_mdev(cq->device)->kar + MTHCA_CQ_DOORBELL,
+		      MTHCA_GET_DOORBELL_LOCK(&to_mdev(cq->device)->doorbell_lock));
+
+	return 0;
 }
 
-int mthca_init_cq(struct mthca_dev *dev, int nent,
-		  struct mthca_cq *cq)
+int mthca_arbel_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify notify)
+{
+	struct mthca_cq *cq = to_mcq(ibcq);
+	u32 doorbell[2];
+	u32 sn;
+	u32 ci;
+
+	sn = cq->arm_sn & 3;
+	ci = cpu_to_be32(cq->cons_index);
+
+	doorbell[0] = ci;
+	doorbell[1] = cpu_to_be32((cq->cqn << 8) | (2 << 5) | (sn << 3) |
+				  (notify == IB_CQ_SOLICITED ? 1 : 2));
+
+	mthca_write_db_rec(doorbell, cq->arm_db);
+
+	/*
+	 * Make sure that the doorbell record in host memory is
+	 * written before ringing the doorbell via PCI MMIO.
+	 */
+	wmb();
+
+	doorbell[0] = cpu_to_be32((sn << 28)                       |
+				  (notify == IB_CQ_SOLICITED ?
+				   MTHCA_ARBEL_CQ_DB_REQ_NOT_SOL :
+				   MTHCA_ARBEL_CQ_DB_REQ_NOT)      |
+				  cq->cqn);
+	doorbell[1] = ci;
+
+	mthca_write64(doorbell,
+		      to_mdev(ibcq->device)->kar + MTHCA_CQ_DOORBELL,
+		      MTHCA_GET_DOORBELL_LOCK(&to_mdev(ibcq->device)->doorbell_lock));
+
+	return 0;
+}
+
+static void mthca_free_cq_buf(struct mthca_dev *dev, struct mthca_cq *cq)
 {
-	int size = nent * MTHCA_CQ_ENTRY_SIZE;
-	dma_addr_t t;
-	void *mailbox = NULL;
-	int npages, shift;
-	u64 *dma_list = NULL;
-	struct mthca_cq_context *cq_context;
-	int err = -ENOMEM;
-	u8 status;
 	int i;
+	int size;
 
-	might_sleep();
+	if (cq->is_direct)
+		pci_free_consistent(dev->pdev,
+				    (cq->ibcq.cqe + 1) * MTHCA_CQ_ENTRY_SIZE,
+				    cq->queue.direct.buf,
+				    pci_unmap_addr(&cq->queue.direct,
+						   mapping));
+	else {
+		size = (cq->ibcq.cqe + 1) * MTHCA_CQ_ENTRY_SIZE;
+		for (i = 0; i < (size + PAGE_SIZE - 1) / PAGE_SIZE; ++i)
+			if (cq->queue.page_list[i].buf)
+				pci_free_consistent(dev->pdev, PAGE_SIZE,
+						    cq->queue.page_list[i].buf,
+						    pci_unmap_addr(&cq->queue.page_list[i],
+								   mapping));
 
-	mailbox = kmalloc(sizeof (struct mthca_cq_context) + MTHCA_CMD_MAILBOX_EXTRA,
-			  GFP_KERNEL);
-	if (!mailbox)
-		goto err_out;
+		kfree(cq->queue.page_list);
+	}
+}
 
-	cq_context = MAILBOX_ALIGN(mailbox);
+static int mthca_alloc_cq_buf(struct mthca_dev *dev, int size,
+			      struct mthca_cq *cq)
+{
+	int err = -ENOMEM;
+	int npages, shift;
+	u64 *dma_list = NULL;
+	dma_addr_t t;
+	int i;
 
 	if (size <= MTHCA_MAX_DIRECT_CQ_SIZE) {
-		if (0)
-			mthca_dbg(dev, "Creating direct CQ of size %d\n", size);
-
 		cq->is_direct = 1;
 		npages        = 1;
 		shift         = get_order(size) + PAGE_SHIFT;
@@ -604,7 +639,7 @@
 		cq->queue.direct.buf = pci_alloc_consistent(dev->pdev,
 							    size, &t);
 		if (!cq->queue.direct.buf)
-			goto err_out;
+			return -ENOMEM;
 
 		pci_unmap_addr_set(&cq->queue.direct, mapping, t);
 
@@ -617,7 +652,7 @@
 
 		dma_list = kmalloc(npages * sizeof *dma_list, GFP_KERNEL);
 		if (!dma_list)
-			goto err_out_free;
+			goto err_free;
 
 		for (i = 0; i < npages; ++i)
 			dma_list[i] = t + i * (1 << shift);
@@ -626,12 +661,9 @@
 		npages        = (size + PAGE_SIZE - 1) / PAGE_SIZE;
 		shift         = PAGE_SHIFT;
 
-		if (0)
-			mthca_dbg(dev, "Creating indirect CQ with %d pages\n", npages);
-
 		dma_list = kmalloc(npages * sizeof *dma_list, GFP_KERNEL);
 		if (!dma_list)
-			goto err_out;
+			return -ENOMEM;
 
 		cq->queue.page_list = kmalloc(npages * sizeof *cq->queue.page_list,
 					      GFP_KERNEL);
@@ -645,7 +677,7 @@
 			cq->queue.page_list[i].buf =
 				pci_alloc_consistent(dev->pdev, PAGE_SIZE, &t);
 			if (!cq->queue.page_list[i].buf)
-				goto err_out_free;
+				goto err_free;
 
 			dma_list[i] = t;
 			pci_unmap_addr_set(&cq->queue.page_list[i], mapping, t);
@@ -654,13 +686,6 @@
 		}
 	}
 
-	for (i = 0; i < nent; ++i)
-		set_cqe_hw(cq, i);
-
-	cq->cqn = mthca_alloc(&dev->cq_table.alloc);
-	if (cq->cqn == -1)
-		goto err_out_free;
-
 	err = mthca_mr_alloc_phys(dev, dev->driver_pd.pd_num,
 				  dma_list, shift, npages,
 				  0, size,
@@ -668,7 +693,72 @@
 				  MTHCA_MPT_FLAG_LOCAL_READ,
 				  &cq->mr);
 	if (err)
-		goto err_out_free_cq;
+		goto err_free;
+
+	kfree(dma_list);
+
+	return 0;
+
+err_free:
+	mthca_free_cq_buf(dev, cq);
+
+err_out:
+	kfree(dma_list);
+
+	return err;
+}
+
+int mthca_init_cq(struct mthca_dev *dev, int nent,
+		  struct mthca_cq *cq)
+{
+	int size = nent * MTHCA_CQ_ENTRY_SIZE;
+	void *mailbox = NULL;
+	struct mthca_cq_context *cq_context;
+	int err = -ENOMEM;
+	u8 status;
+	int i;
+
+	might_sleep();
+
+	cq->ibcq.cqe = nent - 1;
+
+	cq->cqn = mthca_alloc(&dev->cq_table.alloc);
+	if (cq->cqn == -1)
+		return -ENOMEM;
+
+	if (dev->hca_type == ARBEL_NATIVE) {
+		cq->arm_sn = 1;
+
+		err = mthca_table_get(dev, dev->cq_table.table, cq->cqn);
+		if (err)
+			goto err_out;
+
+		err = -ENOMEM;
+
+		cq->set_ci_db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_CQ_SET_CI,
+						     cq->cqn, &cq->set_ci_db);
+		if (cq->set_ci_db_index < 0)
+			goto err_out_icm;
+
+		cq->arm_db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_CQ_ARM,
+						  cq->cqn, &cq->arm_db);
+		if (cq->arm_db_index < 0)
+			goto err_out_ci;
+	}
+
+	mailbox = kmalloc(sizeof (struct mthca_cq_context) + MTHCA_CMD_MAILBOX_EXTRA,
+			  GFP_KERNEL);
+	if (!mailbox)
+		goto err_out_mailbox;
+
+	cq_context = MAILBOX_ALIGN(mailbox);
+
+	err = mthca_alloc_cq_buf(dev, size, cq);
+	if (err)
+		goto err_out_mailbox;
+
+	for (i = 0; i < nent; ++i)
+		set_cqe_hw(get_cqe(cq, i));
 
 	spin_lock_init(&cq->lock);
 	atomic_set(&cq->refcount, 1);
@@ -680,13 +770,18 @@
 						  MTHCA_CQ_FLAG_TR);
 	cq_context->start           = cpu_to_be64(0);
 	cq_context->logsize_usrpage = cpu_to_be32((ffs(nent) - 1) << 24 |
-						  MTHCA_KAR_PAGE);
+						  dev->driver_uar.index);
 	cq_context->error_eqn       = cpu_to_be32(dev->eq_table.eq[MTHCA_EQ_ASYNC].eqn);
 	cq_context->comp_eqn        = cpu_to_be32(dev->eq_table.eq[MTHCA_EQ_COMP].eqn);
 	cq_context->pd              = cpu_to_be32(dev->driver_pd.pd_num);
 	cq_context->lkey            = cpu_to_be32(cq->mr.ibmr.lkey);
 	cq_context->cqn             = cpu_to_be32(cq->cqn);
 
+	if (dev->hca_type == ARBEL_NATIVE) {
+		cq_context->ci_db    = cpu_to_be32(cq->set_ci_db_index);
+		cq_context->state_db = cpu_to_be32(cq->arm_db_index);
+	}
+
 	err = mthca_SW2HW_CQ(dev, cq_context, cq->cqn, &status);
 	if (err) {
 		mthca_warn(dev, "SW2HW_CQ failed (%d)\n", err);
@@ -711,36 +806,27 @@
 
 	cq->cons_index = 0;
 
-	kfree(dma_list);
 	kfree(mailbox);
 
 	return 0;
 
- err_out_free_mr:
+err_out_free_mr:
 	mthca_free_mr(dev, &cq->mr);
+	mthca_free_cq_buf(dev, cq);
 
- err_out_free_cq:
-	mthca_free(&dev->cq_table.alloc, cq->cqn);
+err_out_mailbox:
+	kfree(mailbox);
 
- err_out_free:
-	if (cq->is_direct)
-		pci_free_consistent(dev->pdev, size,
-				    cq->queue.direct.buf,
-				    pci_unmap_addr(&cq->queue.direct, mapping));
-	else {
-		for (i = 0; i < npages; ++i)
-			if (cq->queue.page_list[i].buf)
-				pci_free_consistent(dev->pdev, PAGE_SIZE,
-						    cq->queue.page_list[i].buf,
-						    pci_unmap_addr(&cq->queue.page_list[i],
-								   mapping));
+	mthca_free_db(dev, MTHCA_DB_TYPE_CQ_ARM, cq->arm_db_index);
 
-		kfree(cq->queue.page_list);
-	}
+err_out_ci:
+	mthca_free_db(dev, MTHCA_DB_TYPE_CQ_SET_CI, cq->set_ci_db_index);
 
- err_out:
-	kfree(dma_list);
-	kfree(mailbox);
+err_out_icm:
+	mthca_table_put(dev, dev->cq_table.table, cq->cqn);
+
+err_out:
+	mthca_free(&dev->cq_table.alloc, cq->cqn);
 
 	return err;
 }
@@ -773,7 +859,7 @@
 		int j;
 
 		printk(KERN_ERR "context for CQN %x (cons index %x, next sw %d)\n",
-		       cq->cqn, cq->cons_index, next_cqe_sw(cq));
+		       cq->cqn, cq->cons_index, !!next_cqe_sw(cq));
 		for (j = 0; j < 16; ++j)
 			printk(KERN_ERR "[%2x] %08x\n", j * 4, be32_to_cpu(ctx[j]));
 	}
@@ -783,30 +869,21 @@
 			  cq->cqn & (dev->limits.num_cqs - 1));
 	spin_unlock_irq(&dev->cq_table.lock);
 
+	if (dev->mthca_flags & MTHCA_FLAG_MSI_X)
+		synchronize_irq(dev->eq_table.eq[MTHCA_EQ_COMP].msi_x_vector);
+	else
+		synchronize_irq(dev->pdev->irq);
+
 	atomic_dec(&cq->refcount);
 	wait_event(cq->wait, !atomic_read(&cq->refcount));
 
 	mthca_free_mr(dev, &cq->mr);
+	mthca_free_cq_buf(dev, cq);
 
-	if (cq->is_direct)
-		pci_free_consistent(dev->pdev,
-				    (cq->ibcq.cqe + 1) * MTHCA_CQ_ENTRY_SIZE,
-				    cq->queue.direct.buf,
-				    pci_unmap_addr(&cq->queue.direct,
-						   mapping));
-	else {
-		int i;
-
-		for (i = 0;
-		     i < ((cq->ibcq.cqe + 1) * MTHCA_CQ_ENTRY_SIZE + PAGE_SIZE - 1) /
-			     PAGE_SIZE;
-		     ++i)
-			pci_free_consistent(dev->pdev, PAGE_SIZE,
-					    cq->queue.page_list[i].buf,
-					    pci_unmap_addr(&cq->queue.page_list[i],
-							   mapping));
-
-		kfree(cq->queue.page_list);
+	if (dev->hca_type == ARBEL_NATIVE) {
+		mthca_free_db(dev, MTHCA_DB_TYPE_CQ_ARM,    cq->arm_db_index);
+		mthca_free_db(dev, MTHCA_DB_TYPE_CQ_SET_CI, cq->set_ci_db_index);
+		mthca_table_put(dev, dev->cq_table.table, cq->cqn);
 	}
 
 	mthca_free(&dev->cq_table.alloc, cq->cqn);
diff -Nru a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
--- a/drivers/infiniband/hw/mthca/mthca_dev.h	2005-01-25 13:50:24 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h	2005-03-04 22:32:56 -08:00
@@ -65,7 +65,6 @@
 };
 
 enum {
-	MTHCA_KAR_PAGE  = 1,
 	MTHCA_MAX_PORTS = 2
 };
 
@@ -108,6 +107,7 @@
 	int      gid_table_len;
 	int      pkey_table_len;
 	int      local_ca_ack_delay;
+	int      num_uars;
 	int      max_sg;
 	int      num_qps;
 	int      reserved_qps;
@@ -148,6 +148,12 @@
 	} *page_list;
 };
 
+struct mthca_uar_table {
+	struct mthca_alloc alloc;
+	u64                uarc_base;
+	int                uarc_size;
+};
+
 struct mthca_pd_table {
 	struct mthca_alloc alloc;
 };
@@ -165,6 +171,7 @@
 	struct mthca_alloc alloc;
 	void __iomem      *clr_int;
 	u32                clr_mask;
+	u32                arm_mask;
 	struct mthca_eq    eq[MTHCA_NUM_EQ];
 	u64                icm_virt;
 	struct page       *icm_page;
@@ -200,8 +207,9 @@
 };
 
 struct mthca_mcg_table {
-	struct semaphore   sem;
-	struct mthca_alloc alloc;
+	struct semaphore   	sem;
+	struct mthca_alloc 	alloc;
+	struct mthca_icm_table *table;
 };
 
 struct mthca_dev {
@@ -210,6 +218,7 @@
 
 	int          	 hca_type;
 	unsigned long	 mthca_flags;
+	unsigned long    device_cap_flags;
 
 	u32              rev_id;
 
@@ -237,13 +246,22 @@
 	struct semaphore cap_mask_mutex;
 
 	void __iomem    *hcr;
-	void __iomem    *ecr_base;
-	void __iomem    *clr_base;
 	void __iomem    *kar;
+	void __iomem    *clr_base;
+	union {
+		struct {
+			void __iomem *ecr_base;
+		} tavor;
+		struct {
+			void __iomem *eq_arm;
+			void __iomem *eq_set_ci_base;
+		} arbel;
+	} eq_regs;
 
 	struct mthca_cmd    cmd;
 	struct mthca_limits limits;
 
+	struct mthca_uar_table uar_table;
 	struct mthca_pd_table  pd_table;
 	struct mthca_mr_table  mr_table;
 	struct mthca_eq_table  eq_table;
@@ -252,8 +270,10 @@
 	struct mthca_av_table  av_table;
 	struct mthca_mcg_table mcg_table;
 
-	struct mthca_pd       driver_pd;
-	struct mthca_mr       driver_mr;
+	struct mthca_uar       driver_uar;
+	struct mthca_db_table *db_tab;
+	struct mthca_pd        driver_pd;
+	struct mthca_mr        driver_mr;
 
 	struct ib_mad_agent  *send_agent[MTHCA_MAX_PORTS][2];
 	struct ib_ah         *sm_ah[MTHCA_MAX_PORTS];
@@ -310,6 +330,7 @@
 int mthca_array_init(struct mthca_array *array, int nent);
 void mthca_array_cleanup(struct mthca_array *array, int nent);
 
+int mthca_init_uar_table(struct mthca_dev *dev);
 int mthca_init_pd_table(struct mthca_dev *dev);
 int mthca_init_mr_table(struct mthca_dev *dev);
 int mthca_init_eq_table(struct mthca_dev *dev);
@@ -318,6 +339,7 @@
 int mthca_init_av_table(struct mthca_dev *dev);
 int mthca_init_mcg_table(struct mthca_dev *dev);
 
+void mthca_cleanup_uar_table(struct mthca_dev *dev);
 void mthca_cleanup_pd_table(struct mthca_dev *dev);
 void mthca_cleanup_mr_table(struct mthca_dev *dev);
 void mthca_cleanup_eq_table(struct mthca_dev *dev);
@@ -329,6 +351,9 @@
 int mthca_register_device(struct mthca_dev *dev);
 void mthca_unregister_device(struct mthca_dev *dev);
 
+int mthca_uar_alloc(struct mthca_dev *dev, struct mthca_uar *uar);
+void mthca_uar_free(struct mthca_dev *dev, struct mthca_uar *uar);
+
 int mthca_pd_alloc(struct mthca_dev *dev, struct mthca_pd *pd);
 void mthca_pd_free(struct mthca_dev *dev, struct mthca_pd *pd);
 
@@ -345,8 +370,8 @@
 
 int mthca_poll_cq(struct ib_cq *ibcq, int num_entries,
 		  struct ib_wc *entry);
-void mthca_arm_cq(struct mthca_dev *dev, struct mthca_cq *cq,
-		  int solicited);
+int mthca_tavor_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify);
+int mthca_arbel_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify);
 int mthca_init_cq(struct mthca_dev *dev, int nent,
 		  struct mthca_cq *cq);
 void mthca_free_cq(struct mthca_dev *dev,
@@ -357,11 +382,15 @@
 void mthca_qp_event(struct mthca_dev *dev, u32 qpn,
 		    enum ib_event_type event_type);
 int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask);
-int mthca_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
-		    struct ib_send_wr **bad_wr);
-int mthca_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
-		       struct ib_recv_wr **bad_wr);
-int mthca_free_err_wqe(struct mthca_qp *qp, int is_send,
+int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
+			  struct ib_send_wr **bad_wr);
+int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
+			     struct ib_recv_wr **bad_wr);
+int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
+			  struct ib_send_wr **bad_wr);
+int mthca_arbel_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
+			     struct ib_recv_wr **bad_wr);
+int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
 		       int index, int *dbd, u32 *new_wqe);
 int mthca_alloc_qp(struct mthca_dev *dev,
 		   struct mthca_pd *pd,
@@ -369,14 +398,12 @@
 		   struct mthca_cq *recv_cq,
 		   enum ib_qp_type type,
 		   enum ib_sig_type send_policy,
-		   enum ib_sig_type recv_policy,
 		   struct mthca_qp *qp);
 int mthca_alloc_sqp(struct mthca_dev *dev,
 		    struct mthca_pd *pd,
 		    struct mthca_cq *send_cq,
 		    struct mthca_cq *recv_cq,
 		    enum ib_sig_type send_policy,
-		    enum ib_sig_type recv_policy,
 		    int qpn,
 		    int port,
 		    struct mthca_sqp *sqp);
diff -Nru a/drivers/infiniband/hw/mthca/mthca_doorbell.h b/drivers/infiniband/hw/mthca/mthca_doorbell.h
--- a/drivers/infiniband/hw/mthca/mthca_doorbell.h	2005-01-25 13:50:24 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_doorbell.h	2005-03-04 22:32:55 -08:00
@@ -57,6 +57,11 @@
 	__raw_writeq(*(u64 *) val, dest);
 }
 
+static inline void mthca_write_db_rec(u32 val[2], u32 *db)
+{
+	*(u64 *) db = *(u64 *) val;
+}
+
 #else
 
 /*
@@ -78,6 +83,13 @@
 	__raw_writel(val[0], dest);
 	__raw_writel(val[1], dest + 4);
 	spin_unlock_irqrestore(doorbell_lock, flags);
+}
+
+static inline void mthca_write_db_rec(u32 val[2], u32 *db)
+{
+	db[0] = val[0];
+	wmb();
+	db[1] = val[1];
 }
 
 #endif
diff -Nru a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c
--- a/drivers/infiniband/hw/mthca/mthca_eq.c	2005-01-25 13:50:24 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_eq.c	2005-03-04 22:32:54 -08:00
@@ -54,10 +54,10 @@
 	u32 flags;
 	u64 start;
 	u32 logsize_usrpage;
-	u32 pd;
+	u32 tavor_pd;		/* reserved for Arbel */
 	u8  reserved1[3];
 	u8  intr;
-	u32 lost_count;
+	u32 arbel_pd;		/* lost_count for Tavor */
 	u32 lkey;
 	u32 reserved2[2];
 	u32 consumer_index;
@@ -75,6 +75,7 @@
 #define MTHCA_EQ_STATE_ARMED        ( 1 <<  8)
 #define MTHCA_EQ_STATE_FIRED        ( 2 <<  8)
 #define MTHCA_EQ_STATE_ALWAYS_ARMED ( 3 <<  8)
+#define MTHCA_EQ_STATE_ARBEL        ( 8 <<  8)
 
 enum {
 	MTHCA_EVENT_TYPE_COMP       	    = 0x00,
@@ -164,19 +165,46 @@
 		MTHCA_ASYNC_EVENT_MASK;
 }
 
-static inline void set_eq_ci(struct mthca_dev *dev, struct mthca_eq *eq, u32 ci)
+static inline void tavor_set_eq_ci(struct mthca_dev *dev, struct mthca_eq *eq, u32 ci)
 {
 	u32 doorbell[2];
 
 	doorbell[0] = cpu_to_be32(MTHCA_EQ_DB_SET_CI | eq->eqn);
 	doorbell[1] = cpu_to_be32(ci & (eq->nent - 1));
 
+	/*
+	 * This barrier makes sure that all updates to ownership bits
+	 * done by set_eqe_hw() hit memory before the consumer index
+	 * is updated.  set_eq_ci() allows the HCA to possibly write
+	 * more EQ entries, and we want to avoid the exceedingly
+	 * unlikely possibility of the HCA writing an entry and then
+	 * having set_eqe_hw() overwrite the owner field.
+	 */
+	wmb();
 	mthca_write64(doorbell,
 		      dev->kar + MTHCA_EQ_DOORBELL,
 		      MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
 }
 
-static inline void eq_req_not(struct mthca_dev *dev, int eqn)
+static inline void arbel_set_eq_ci(struct mthca_dev *dev, struct mthca_eq *eq, u32 ci)
+{
+	/* See comment in tavor_set_eq_ci() above. */
+	wmb();
+	__raw_writel(cpu_to_be32(ci), dev->eq_regs.arbel.eq_set_ci_base +
+		     eq->eqn * 8);
+	/* We still want ordering, just not swabbing, so add a barrier */
+	mb();
+}
+
+static inline void set_eq_ci(struct mthca_dev *dev, struct mthca_eq *eq, u32 ci)
+{
+	if (dev->hca_type == ARBEL_NATIVE)
+		arbel_set_eq_ci(dev, eq, ci);
+	else
+		tavor_set_eq_ci(dev, eq, ci);
+}
+
+static inline void tavor_eq_req_not(struct mthca_dev *dev, int eqn)
 {
 	u32 doorbell[2];
 
@@ -188,16 +216,23 @@
 		      MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
 }
 
+static inline void arbel_eq_req_not(struct mthca_dev *dev, u32 eqn_mask)
+{
+	writel(eqn_mask, dev->eq_regs.arbel.eq_arm);
+}
+
 static inline void disarm_cq(struct mthca_dev *dev, int eqn, int cqn)
 {
-	u32 doorbell[2];
+	if (dev->hca_type != ARBEL_NATIVE) {
+		u32 doorbell[2];
 
-	doorbell[0] = cpu_to_be32(MTHCA_EQ_DB_DISARM_CQ | eqn);
-	doorbell[1] = cpu_to_be32(cqn);
+		doorbell[0] = cpu_to_be32(MTHCA_EQ_DB_DISARM_CQ | eqn);
+		doorbell[1] = cpu_to_be32(cqn);
 
-	mthca_write64(doorbell,
-		      dev->kar + MTHCA_EQ_DOORBELL,
-		      MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
+		mthca_write64(doorbell,
+			      dev->kar + MTHCA_EQ_DOORBELL,
+			      MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
+	}
 }
 
 static inline struct mthca_eqe *get_eqe(struct mthca_eq *eq, u32 entry)
@@ -232,7 +267,7 @@
 	ib_dispatch_event(&record);
 }
 
-static void mthca_eq_int(struct mthca_dev *dev, struct mthca_eq *eq)
+static int mthca_eq_int(struct mthca_dev *dev, struct mthca_eq *eq)
 {
 	struct mthca_eqe *eqe;
 	int disarm_cqn;
@@ -333,60 +368,93 @@
 		++eq->cons_index;
 		eqes_found = 1;
 
-		if (set_ci) {
-			wmb(); /* see comment below */
+		if (unlikely(set_ci)) {
+			/*
+			 * Conditional on hca_type is OK here because
+			 * this is a rare case, not the fast path.
+			 */
 			set_eq_ci(dev, eq, eq->cons_index);
 			set_ci = 0;
 		}
 	}
 
 	/*
-	 * This barrier makes sure that all updates to
-	 * ownership bits done by set_eqe_hw() hit memory
-	 * before the consumer index is updated.  set_eq_ci()
-	 * allows the HCA to possibly write more EQ entries,
-	 * and we want to avoid the exceedingly unlikely
-	 * possibility of the HCA writing an entry and then
-	 * having set_eqe_hw() overwrite the owner field.
+	 * Rely on caller to set consumer index so that we don't have
+	 * to test hca_type in our interrupt handling fast path.
 	 */
-	if (likely(eqes_found)) {
-		wmb();
-		set_eq_ci(dev, eq, eq->cons_index);
-	}
-	eq_req_not(dev, eq->eqn);
+	return eqes_found;
 }
 
-static irqreturn_t mthca_interrupt(int irq, void *dev_ptr, struct pt_regs *regs)
+static irqreturn_t mthca_tavor_interrupt(int irq, void *dev_ptr, struct pt_regs *regs)
 {
 	struct mthca_dev *dev = dev_ptr;
 	u32 ecr;
-	int work = 0;
 	int i;
 
 	if (dev->eq_table.clr_mask)
 		writel(dev->eq_table.clr_mask, dev->eq_table.clr_int);
 
-	if ((ecr = readl(dev->ecr_base + 4)) != 0) {
-		work = 1;
-
-		writel(ecr, dev->ecr_base +
+	ecr = readl(dev->eq_regs.tavor.ecr_base + 4);
+	if (ecr) {
+		writel(ecr, dev->eq_regs.tavor.ecr_base +
 		       MTHCA_ECR_CLR_BASE - MTHCA_ECR_BASE + 4);
 
 		for (i = 0; i < MTHCA_NUM_EQ; ++i)
-			if (ecr & dev->eq_table.eq[i].ecr_mask)
-				mthca_eq_int(dev, &dev->eq_table.eq[i]);
+			if (ecr & dev->eq_table.eq[i].eqn_mask &&
+			    mthca_eq_int(dev, &dev->eq_table.eq[i])) {
+				tavor_set_eq_ci(dev, &dev->eq_table.eq[i],
+						dev->eq_table.eq[i].cons_index);
+				tavor_eq_req_not(dev, dev->eq_table.eq[i].eqn);
+			}
 	}
 
-	return IRQ_RETVAL(work);
+	return IRQ_RETVAL(ecr);
 }
 
-static irqreturn_t mthca_msi_x_interrupt(int irq, void *eq_ptr,
+static irqreturn_t mthca_tavor_msi_x_interrupt(int irq, void *eq_ptr,
 					 struct pt_regs *regs)
 {
 	struct mthca_eq  *eq  = eq_ptr;
 	struct mthca_dev *dev = eq->dev;
 
 	mthca_eq_int(dev, eq);
+	tavor_set_eq_ci(dev, eq, eq->cons_index);
+	tavor_eq_req_not(dev, eq->eqn);
+
+	/* MSI-X vectors always belong to us */
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t mthca_arbel_interrupt(int irq, void *dev_ptr, struct pt_regs *regs)
+{
+	struct mthca_dev *dev = dev_ptr;
+	int work = 0;
+	int i;
+
+	if (dev->eq_table.clr_mask)
+		writel(dev->eq_table.clr_mask, dev->eq_table.clr_int);
+
+	for (i = 0; i < MTHCA_NUM_EQ; ++i)
+		if (mthca_eq_int(dev, &dev->eq_table.eq[i])) {
+			work = 1;
+			arbel_set_eq_ci(dev, &dev->eq_table.eq[i],
+					dev->eq_table.eq[i].cons_index);
+		}
+
+	arbel_eq_req_not(dev, dev->eq_table.arm_mask);
+
+	return IRQ_RETVAL(work);
+}
+
+static irqreturn_t mthca_arbel_msi_x_interrupt(int irq, void *eq_ptr,
+					       struct pt_regs *regs)
+{
+	struct mthca_eq  *eq  = eq_ptr;
+	struct mthca_dev *dev = eq->dev;
+
+	mthca_eq_int(dev, eq);
+	arbel_set_eq_ci(dev, eq, eq->cons_index);
+	arbel_eq_req_not(dev, eq->eqn_mask);
 
 	/* MSI-X vectors always belong to us */
 	return IRQ_HANDLED;
@@ -467,10 +535,16 @@
 						  MTHCA_EQ_OWNER_HW    |
 						  MTHCA_EQ_STATE_ARMED |
 						  MTHCA_EQ_FLAG_TR);
-	eq_context->start           = cpu_to_be64(0);
-	eq_context->logsize_usrpage = cpu_to_be32((ffs(nent) - 1) << 24 |
-						  MTHCA_KAR_PAGE);
-	eq_context->pd              = cpu_to_be32(dev->driver_pd.pd_num);
+	if (dev->hca_type == ARBEL_NATIVE)
+		eq_context->flags  |= cpu_to_be32(MTHCA_EQ_STATE_ARBEL);
+
+	eq_context->logsize_usrpage = cpu_to_be32((ffs(nent) - 1) << 24);
+	if (dev->hca_type == ARBEL_NATIVE) {
+		eq_context->arbel_pd = cpu_to_be32(dev->driver_pd.pd_num);
+	} else {
+		eq_context->logsize_usrpage |= cpu_to_be32(dev->driver_uar.index);
+		eq_context->tavor_pd         = cpu_to_be32(dev->driver_pd.pd_num);
+	}
 	eq_context->intr            = intr;
 	eq_context->lkey            = cpu_to_be32(eq->mr.ibmr.lkey);
 
@@ -489,10 +563,10 @@
 	kfree(dma_list);
 	kfree(mailbox);
 
-	eq->ecr_mask   = swab32(1 << eq->eqn);
+	eq->eqn_mask   = swab32(1 << eq->eqn);
 	eq->cons_index = 0;
 
-	eq_req_not(dev, eq->eqn);
+	dev->eq_table.arm_mask |= eq->eqn_mask;
 
 	mthca_dbg(dev, "Allocated EQ %d with %d entries\n",
 		  eq->eqn, nent);
@@ -544,6 +618,8 @@
 		mthca_warn(dev, "HW2SW_EQ returned status 0x%02x\n",
 			   status);
 
+	dev->eq_table.arm_mask &= ~eq->eqn_mask;
+
 	if (0) {
 		mthca_dbg(dev, "Dumping EQ context %02x:\n", eq->eqn);
 		for (i = 0; i < sizeof (struct mthca_eq_context) / 4; ++i) {
@@ -555,7 +631,6 @@
 		}
 	}
 
-
 	mthca_free_mr(dev, &eq->mr);
 	for (i = 0; i < npages; ++i)
 		pci_free_consistent(dev->pdev, PAGE_SIZE,
@@ -578,6 +653,129 @@
 				 dev->eq_table.eq + i);
 }
 
+static int __devinit mthca_map_reg(struct mthca_dev *dev,
+				   unsigned long offset, unsigned long size,
+				   void __iomem **map)
+{
+	unsigned long base = pci_resource_start(dev->pdev, 0);
+
+	if (!request_mem_region(base + offset, size, DRV_NAME))
+		return -EBUSY;
+
+	*map = ioremap(base + offset, size);
+	if (!*map) {
+		release_mem_region(base + offset, size);
+		return -ENOMEM;
+	}
+
+	return 0;
+}
+
+static void mthca_unmap_reg(struct mthca_dev *dev, unsigned long offset,
+			    unsigned long size, void __iomem *map)
+{
+	unsigned long base = pci_resource_start(dev->pdev, 0);
+
+	release_mem_region(base + offset, size);
+	iounmap(map);
+}
+
+static int __devinit mthca_map_eq_regs(struct mthca_dev *dev)
+{
+	unsigned long mthca_base;
+
+	mthca_base = pci_resource_start(dev->pdev, 0);
+
+	if (dev->hca_type == ARBEL_NATIVE) {
+		/*
+		 * We assume that the EQ arm and EQ set CI registers
+		 * fall within the first BAR.  We can't trust the
+		 * values firmware gives us, since those addresses are
+		 * valid on the HCA's side of the PCI bus but not
+		 * necessarily the host side.
+		 */
+		if (mthca_map_reg(dev, (pci_resource_len(dev->pdev, 0) - 1) &
+				  dev->fw.arbel.clr_int_base, MTHCA_CLR_INT_SIZE,
+				  &dev->clr_base)) {
+			mthca_err(dev, "Couldn't map interrupt clear register, "
+				  "aborting.\n");
+			return -ENOMEM;
+		}
+
+		/*
+		 * Add 4 because we limit ourselves to EQs 0 ... 31,
+		 * so we only need the low word of the register.
+		 */
+		if (mthca_map_reg(dev, ((pci_resource_len(dev->pdev, 0) - 1) &
+					dev->fw.arbel.eq_arm_base) + 4, 4,
+				  &dev->eq_regs.arbel.eq_arm)) {
+			mthca_err(dev, "Couldn't map interrupt clear register, "
+				  "aborting.\n");
+			mthca_unmap_reg(dev, (pci_resource_len(dev->pdev, 0) - 1) &
+					dev->fw.arbel.clr_int_base, MTHCA_CLR_INT_SIZE,
+					dev->clr_base);
+			return -ENOMEM;
+		}
+
+		if (mthca_map_reg(dev, (pci_resource_len(dev->pdev, 0) - 1) &
+				  dev->fw.arbel.eq_set_ci_base,
+				  MTHCA_EQ_SET_CI_SIZE,
+				  &dev->eq_regs.arbel.eq_set_ci_base)) {
+			mthca_err(dev, "Couldn't map interrupt clear register, "
+				  "aborting.\n");
+			mthca_unmap_reg(dev, ((pci_resource_len(dev->pdev, 0) - 1) &
+					      dev->fw.arbel.eq_arm_base) + 4, 4,
+					dev->eq_regs.arbel.eq_arm);
+			mthca_unmap_reg(dev, (pci_resource_len(dev->pdev, 0) - 1) &
+					dev->fw.arbel.clr_int_base, MTHCA_CLR_INT_SIZE,
+					dev->clr_base);
+			return -ENOMEM;
+		}
+	} else {
+		if (mthca_map_reg(dev, MTHCA_CLR_INT_BASE, MTHCA_CLR_INT_SIZE,
+				  &dev->clr_base)) {
+			mthca_err(dev, "Couldn't map interrupt clear register, "
+				  "aborting.\n");
+			return -ENOMEM;
+		}
+
+		if (mthca_map_reg(dev, MTHCA_ECR_BASE,
+				  MTHCA_ECR_SIZE + MTHCA_ECR_CLR_SIZE,
+				  &dev->eq_regs.tavor.ecr_base)) {
+			mthca_err(dev, "Couldn't map ecr register, "
+				  "aborting.\n");
+			mthca_unmap_reg(dev, MTHCA_CLR_INT_BASE, MTHCA_CLR_INT_SIZE,
+					dev->clr_base);
+			return -ENOMEM;
+		}
+	}
+
+	return 0;
+
+}
+
+static void __devexit mthca_unmap_eq_regs(struct mthca_dev *dev)
+{
+	if (dev->hca_type == ARBEL_NATIVE) {
+		mthca_unmap_reg(dev, (pci_resource_len(dev->pdev, 0) - 1) &
+				dev->fw.arbel.eq_set_ci_base,
+				MTHCA_EQ_SET_CI_SIZE,
+				dev->eq_regs.arbel.eq_set_ci_base);
+		mthca_unmap_reg(dev, ((pci_resource_len(dev->pdev, 0) - 1) &
+				      dev->fw.arbel.eq_arm_base) + 4, 4,
+				dev->eq_regs.arbel.eq_arm);
+		mthca_unmap_reg(dev, (pci_resource_len(dev->pdev, 0) - 1) &
+				dev->fw.arbel.clr_int_base, MTHCA_CLR_INT_SIZE,
+				dev->clr_base);
+	} else {
+		mthca_unmap_reg(dev, MTHCA_ECR_BASE,
+				MTHCA_ECR_SIZE + MTHCA_ECR_CLR_SIZE,
+				dev->eq_regs.tavor.ecr_base);
+		mthca_unmap_reg(dev, MTHCA_CLR_INT_BASE, MTHCA_CLR_INT_SIZE,
+				dev->clr_base);
+	}
+}
+
 int __devinit mthca_map_eq_icm(struct mthca_dev *dev, u64 icm_virt)
 {
 	int ret;
@@ -636,6 +834,10 @@
 	if (err)
 		return err;
 
+	err = mthca_map_eq_regs(dev);
+	if (err)
+		goto err_out_free;
+
 	if (dev->mthca_flags & MTHCA_FLAG_MSI ||
 	    dev->mthca_flags & MTHCA_FLAG_MSI_X) {
 		dev->eq_table.clr_mask = 0;
@@ -646,6 +848,8 @@
 			(dev->eq_table.inta_pin < 31 ? 4 : 0);
 	}
 
+	dev->eq_table.arm_mask = 0;
+
 	intr = (dev->mthca_flags & MTHCA_FLAG_MSI) ?
 		128 : dev->eq_table.inta_pin;
 
@@ -653,7 +857,7 @@
 			      (dev->mthca_flags & MTHCA_FLAG_MSI_X) ? 128 : intr,
 			      &dev->eq_table.eq[MTHCA_EQ_COMP]);
 	if (err)
-		goto err_out_free;
+		goto err_out_unmap;
 
 	err = mthca_create_eq(dev, MTHCA_NUM_ASYNC_EQE,
 			      (dev->mthca_flags & MTHCA_FLAG_MSI_X) ? 129 : intr,
@@ -676,15 +880,20 @@
 
 		for (i = 0; i < MTHCA_NUM_EQ; ++i) {
 			err = request_irq(dev->eq_table.eq[i].msi_x_vector,
-					  mthca_msi_x_interrupt, 0,
-					  eq_name[i], dev->eq_table.eq + i);
+					  dev->hca_type == ARBEL_NATIVE ?
+					  mthca_arbel_msi_x_interrupt :
+					  mthca_tavor_msi_x_interrupt,
+					  0, eq_name[i], dev->eq_table.eq + i);
 			if (err)
 				goto err_out_cmd;
 			dev->eq_table.eq[i].have_irq = 1;
 		}
 	} else {
-		err = request_irq(dev->pdev->irq, mthca_interrupt, SA_SHIRQ,
-				  DRV_NAME, dev);
+		err = request_irq(dev->pdev->irq,
+				  dev->hca_type == ARBEL_NATIVE ?
+				  mthca_arbel_interrupt :
+				  mthca_tavor_interrupt,
+				  SA_SHIRQ, DRV_NAME, dev);
 		if (err)
 			goto err_out_cmd;
 		dev->eq_table.have_irq = 1;
@@ -708,6 +917,12 @@
 		mthca_warn(dev, "MAP_EQ for cmd EQ %d returned status 0x%02x\n",
 			   dev->eq_table.eq[MTHCA_EQ_CMD].eqn, status);
 
+	for (i = 0; i < MTHCA_EQ_CMD; ++i)
+		if (dev->hca_type == ARBEL_NATIVE)
+			arbel_eq_req_not(dev, dev->eq_table.eq[i].eqn_mask);
+		else
+			tavor_eq_req_not(dev, dev->eq_table.eq[i].eqn);
+
 	return 0;
 
 err_out_cmd:
@@ -720,6 +935,9 @@
 err_out_comp:
 	mthca_free_eq(dev, &dev->eq_table.eq[MTHCA_EQ_COMP]);
 
+err_out_unmap:
+	mthca_unmap_eq_regs(dev);
+
 err_out_free:
 	mthca_alloc_cleanup(&dev->eq_table.alloc);
 	return err;
@@ -739,6 +957,8 @@
 
 	for (i = 0; i < MTHCA_NUM_EQ; ++i)
 		mthca_free_eq(dev, &dev->eq_table.eq[i]);
+
+	mthca_unmap_eq_regs(dev);
 
 	mthca_alloc_cleanup(&dev->eq_table.alloc);
 }
diff -Nru a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c
--- a/drivers/infiniband/hw/mthca/mthca_main.c	2005-01-25 13:50:24 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_main.c	2005-03-04 22:32:56 -08:00
@@ -171,6 +171,33 @@
 	mdev->limits.reserved_uars      = dev_lim->reserved_uars;
 	mdev->limits.reserved_pds       = dev_lim->reserved_pds;
 
+	/* IB_DEVICE_RESIZE_MAX_WR not supported by driver.
+	   May be doable since hardware supports it for SRQ.
+
+	   IB_DEVICE_N_NOTIFY_CQ is supported by hardware but not by driver.
+
+	   IB_DEVICE_SRQ_RESIZE is supported by hardware but SRQ is not
+	   supported by driver. */
+	mdev->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT |
+		IB_DEVICE_PORT_ACTIVE_EVENT |
+		IB_DEVICE_SYS_IMAGE_GUID |
+		IB_DEVICE_RC_RNR_NAK_GEN;
+
+	if (dev_lim->flags & DEV_LIM_FLAG_BAD_PKEY_CNTR)
+		mdev->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR;
+
+	if (dev_lim->flags & DEV_LIM_FLAG_BAD_QKEY_CNTR)
+		mdev->device_cap_flags |= IB_DEVICE_BAD_QKEY_CNTR;
+
+	if (dev_lim->flags & DEV_LIM_FLAG_RAW_MULTI)
+		mdev->device_cap_flags |= IB_DEVICE_RAW_MULTI;
+
+	if (dev_lim->flags & DEV_LIM_FLAG_AUTO_PATH_MIG)
+		mdev->device_cap_flags |= IB_DEVICE_AUTO_PATH_MIG;
+
+	if (dev_lim->flags & DEV_LIM_FLAG_UD_AV_PORT_ENFORCE)
+		mdev->device_cap_flags |= IB_DEVICE_UD_AV_PORT_ENFORCE;
+
 	if (dev_lim->flags & DEV_LIM_FLAG_SRQ)
 		mdev->mthca_flags |= MTHCA_FLAG_SRQ;
 
@@ -363,10 +390,9 @@
 	}
 
 	mdev->mr_table.mtt_table = mthca_alloc_icm_table(mdev, init_hca->mtt_base,
-							 mdev->limits.num_mtt_segs *
 							 init_hca->mtt_seg_sz,
-							 mdev->limits.reserved_mtts *
-							 init_hca->mtt_seg_sz, 1);
+							 mdev->limits.num_mtt_segs,
+							 mdev->limits.reserved_mtts, 1);
 	if (!mdev->mr_table.mtt_table) {
 		mthca_err(mdev, "Failed to map MTT context memory, aborting.\n");
 		err = -ENOMEM;
@@ -374,10 +400,9 @@
 	}
 
 	mdev->mr_table.mpt_table = mthca_alloc_icm_table(mdev, init_hca->mpt_base,
-							 mdev->limits.num_mpts *
 							 dev_lim->mpt_entry_sz,
-							 mdev->limits.reserved_mrws *
-							 dev_lim->mpt_entry_sz, 1);
+							 mdev->limits.num_mpts,
+							 mdev->limits.reserved_mrws, 1);
 	if (!mdev->mr_table.mpt_table) {
 		mthca_err(mdev, "Failed to map MPT context memory, aborting.\n");
 		err = -ENOMEM;
@@ -385,10 +410,9 @@
 	}
 
 	mdev->qp_table.qp_table = mthca_alloc_icm_table(mdev, init_hca->qpc_base,
-							mdev->limits.num_qps *
 							dev_lim->qpc_entry_sz,
-							mdev->limits.reserved_qps *
-							dev_lim->qpc_entry_sz, 1);
+							mdev->limits.num_qps,
+							mdev->limits.reserved_qps, 0);
 	if (!mdev->qp_table.qp_table) {
 		mthca_err(mdev, "Failed to map QP context memory, aborting.\n");
 		err = -ENOMEM;
@@ -396,10 +420,9 @@
 	}
 
 	mdev->qp_table.eqp_table = mthca_alloc_icm_table(mdev, init_hca->eqpc_base,
-							 mdev->limits.num_qps *
 							 dev_lim->eqpc_entry_sz,
-							 mdev->limits.reserved_qps *
-							 dev_lim->eqpc_entry_sz, 1);
+							 mdev->limits.num_qps,
+							 mdev->limits.reserved_qps, 0);
 	if (!mdev->qp_table.eqp_table) {
 		mthca_err(mdev, "Failed to map EQP context memory, aborting.\n");
 		err = -ENOMEM;
@@ -407,18 +430,38 @@
 	}
 
 	mdev->cq_table.table = mthca_alloc_icm_table(mdev, init_hca->cqc_base,
-						     mdev->limits.num_cqs *
 						     dev_lim->cqc_entry_sz,
-						     mdev->limits.reserved_cqs *
-						     dev_lim->cqc_entry_sz, 1);
+						     mdev->limits.num_cqs,
+						     mdev->limits.reserved_cqs, 0);
 	if (!mdev->cq_table.table) {
 		mthca_err(mdev, "Failed to map CQ context memory, aborting.\n");
 		err = -ENOMEM;
 		goto err_unmap_eqp;
 	}
 
+	/*
+	 * It's not strictly required, but for simplicity just map the
+	 * whole multicast group table now.  The table isn't very big
+	 * and it's a lot easier than trying to track ref counts.
+	 */
+	mdev->mcg_table.table = mthca_alloc_icm_table(mdev, init_hca->mc_base,
+						      MTHCA_MGM_ENTRY_SIZE,
+						      mdev->limits.num_mgms +
+						      mdev->limits.num_amgms,
+						      mdev->limits.num_mgms +
+						      mdev->limits.num_amgms,
+						      0);
+	if (!mdev->mcg_table.table) {
+		mthca_err(mdev, "Failed to map MCG context memory, aborting.\n");
+		err = -ENOMEM;
+		goto err_unmap_cq;
+	}
+
 	return 0;
 
+err_unmap_cq:
+	mthca_free_icm_table(mdev, mdev->cq_table.table);
+
 err_unmap_eqp:
 	mthca_free_icm_table(mdev, mdev->qp_table.eqp_table);
 
@@ -570,11 +613,33 @@
 
 	MTHCA_INIT_DOORBELL_LOCK(&dev->doorbell_lock);
 
+	err = mthca_init_uar_table(dev);
+	if (err) {
+		mthca_err(dev, "Failed to initialize "
+			  "user access region table, aborting.\n");
+		return err;
+	}
+
+	err = mthca_uar_alloc(dev, &dev->driver_uar);
+	if (err) {
+		mthca_err(dev, "Failed to allocate driver access region, "
+			  "aborting.\n");
+		goto err_uar_table_free;
+	}
+
+	dev->kar = ioremap(dev->driver_uar.pfn << PAGE_SHIFT, PAGE_SIZE);
+	if (!dev->kar) {
+		mthca_err(dev, "Couldn't map kernel access region, "
+			  "aborting.\n");
+		err = -ENOMEM;
+		goto err_uar_free;
+	}
+
 	err = mthca_init_pd_table(dev);
 	if (err) {
 		mthca_err(dev, "Failed to initialize "
 			  "protection domain table, aborting.\n");
-		return err;
+		goto err_kar_unmap;
 	}
 
 	err = mthca_init_mr_table(dev);
@@ -591,13 +656,6 @@
 		goto err_mr_table_free;
 	}
 
-	if (dev->hca_type == ARBEL_NATIVE) {
-		mthca_warn(dev, "Sorry, native MT25208 mode support is not done, "
-			   "aborting.\n");
-		err = -ENODEV;
-		goto err_pd_free;
-	}
-
 	err = mthca_init_eq_table(dev);
 	if (err) {
 		mthca_err(dev, "Failed to initialize "
@@ -621,8 +679,9 @@
 			mthca_err(dev, "BIOS or ACPI interrupt routing problem?\n");
 
 		goto err_cmd_poll;
-	} else
-		mthca_dbg(dev, "NOP command IRQ test passed\n");
+	}
+
+	mthca_dbg(dev, "NOP command IRQ test passed\n");
 
 	err = mthca_init_cq_table(dev);
 	if (err) {
@@ -677,6 +736,15 @@
 
 err_pd_table_free:
 	mthca_cleanup_pd_table(dev);
+
+err_kar_unmap:
+	iounmap(dev->kar);
+
+err_uar_free:
+	mthca_uar_free(dev, &dev->driver_uar);
+
+err_uar_table_free:
+	mthca_cleanup_uar_table(dev);
 	return err;
 }
 
@@ -686,37 +754,18 @@
 	int err;
 
 	/*
-	 * We request our first BAR in two chunks, since the MSI-X
-	 * vector table is right in the middle.
+	 * We can't just use pci_request_regions() because the MSI-X
+	 * table is right in the middle of the first BAR.  If we did
+	 * pci_request_region and grab all of the first BAR, then
+	 * setting up MSI-X would fail, since the PCI core wants to do
+	 * request_mem_region on the MSI-X vector table.
 	 *
-	 * This is why we can't just use pci_request_regions() -- if
-	 * we did then setting up MSI-X would fail, since the PCI core
-	 * wants to do request_mem_region on the MSI-X vector table.
+	 * So just request what we need right now, and request any
+	 * other regions we need when setting up EQs.
 	 */
-	if (!request_mem_region(pci_resource_start(pdev, 0) +
-				MTHCA_HCR_BASE,
-				MTHCA_HCR_SIZE,
-				DRV_NAME)) {
-		err = -EBUSY;
-		goto err_hcr_failed;
-	}
-
-	if (!request_mem_region(pci_resource_start(pdev, 0) +
-				MTHCA_ECR_BASE,
-				MTHCA_MAP_ECR_SIZE,
-				DRV_NAME)) {
-		err = -EBUSY;
-		goto err_ecr_failed;
-	}
-
-	if (!request_mem_region(pci_resource_start(pdev, 0) +
-				MTHCA_CLR_INT_BASE,
-				MTHCA_CLR_INT_SIZE,
-				DRV_NAME)) {
-		err = -EBUSY;
-		goto err_int_failed;
-	}
-
+	if (!request_mem_region(pci_resource_start(pdev, 0) + MTHCA_HCR_BASE,
+				MTHCA_HCR_SIZE, DRV_NAME))
+		return -EBUSY;
 
 	err = pci_request_region(pdev, 2, DRV_NAME);
 	if (err)
@@ -731,24 +780,11 @@
 	return 0;
 
 err_bar4_failed:
-
 	pci_release_region(pdev, 2);
-err_bar2_failed:
-
-	release_mem_region(pci_resource_start(pdev, 0) +
-			   MTHCA_CLR_INT_BASE,
-			   MTHCA_CLR_INT_SIZE);
-err_int_failed:
-
-	release_mem_region(pci_resource_start(pdev, 0) +
-			   MTHCA_ECR_BASE,
-			   MTHCA_MAP_ECR_SIZE);
-err_ecr_failed:
 
-	release_mem_region(pci_resource_start(pdev, 0) +
-			   MTHCA_HCR_BASE,
+err_bar2_failed:
+	release_mem_region(pci_resource_start(pdev, 0) + MTHCA_HCR_BASE,
 			   MTHCA_HCR_SIZE);
-err_hcr_failed:
 
 	return err;
 }
@@ -761,16 +797,7 @@
 
 	pci_release_region(pdev, 2);
 
-	release_mem_region(pci_resource_start(pdev, 0) +
-			   MTHCA_CLR_INT_BASE,
-			   MTHCA_CLR_INT_SIZE);
-
-	release_mem_region(pci_resource_start(pdev, 0) +
-			   MTHCA_ECR_BASE,
-			   MTHCA_MAP_ECR_SIZE);
-
-	release_mem_region(pci_resource_start(pdev, 0) +
-			   MTHCA_HCR_BASE,
+	release_mem_region(pci_resource_start(pdev, 0) + MTHCA_HCR_BASE,
 			   MTHCA_HCR_SIZE);
 }
 
@@ -828,9 +855,9 @@
 				    const struct pci_device_id *id)
 {
 	static int mthca_version_printed = 0;
+	static int mthca_memfree_warned = 0;
 	int ddr_hidden = 0;
 	int err;
-	unsigned long mthca_base;
 	struct mthca_dev *mdev;
 
 	if (!mthca_version_printed) {
@@ -908,6 +935,10 @@
 	mdev->pdev     = pdev;
 	mdev->hca_type = id->driver_data;
 
+	if (mdev->hca_type == ARBEL_NATIVE && !mthca_memfree_warned++)
+		mthca_warn(mdev, "Warning: native MT25208 mode support is incomplete.  "
+			   "Your HCA may not work properly.\n");
+
 	if (ddr_hidden)
 		mdev->mthca_flags |= MTHCA_FLAG_DDR_HIDDEN;
 
@@ -932,8 +963,7 @@
 	sema_init(&mdev->cmd.poll_sem, 1);
 	mdev->cmd.use_events = 0;
 
-	mthca_base = pci_resource_start(pdev, 0);
-	mdev->hcr = ioremap(mthca_base + MTHCA_HCR_BASE, MTHCA_HCR_SIZE);
+	mdev->hcr = ioremap(pci_resource_start(pdev, 0) + MTHCA_HCR_BASE, MTHCA_HCR_SIZE);
 	if (!mdev->hcr) {
 		mthca_err(mdev, "Couldn't map command register, "
 			  "aborting.\n");
@@ -941,40 +971,13 @@
 		goto err_free_dev;
 	}
 
-	mdev->clr_base = ioremap(mthca_base + MTHCA_CLR_INT_BASE,
-				 MTHCA_CLR_INT_SIZE);
-	if (!mdev->clr_base) {
-		mthca_err(mdev, "Couldn't map interrupt clear register, "
-			  "aborting.\n");
-		err = -ENOMEM;
-		goto err_iounmap;
-	}
-
-	mdev->ecr_base = ioremap(mthca_base + MTHCA_ECR_BASE,
-				 MTHCA_ECR_SIZE + MTHCA_ECR_CLR_SIZE);
-	if (!mdev->ecr_base) {
-		mthca_err(mdev, "Couldn't map ecr register, "
-			  "aborting.\n");
-		err = -ENOMEM;
-		goto err_iounmap_clr;
-	}
-
-	mthca_base = pci_resource_start(pdev, 2);
-	mdev->kar = ioremap(mthca_base + PAGE_SIZE * MTHCA_KAR_PAGE, PAGE_SIZE);
-	if (!mdev->kar) {
-		mthca_err(mdev, "Couldn't map kernel access region, "
-			  "aborting.\n");
-		err = -ENOMEM;
-		goto err_iounmap_ecr;
-	}
-
 	err = mthca_tune_pci(mdev);
 	if (err)
-		goto err_iounmap_kar;
+		goto err_iounmap;
 
 	err = mthca_init_hca(mdev);
 	if (err)
-		goto err_iounmap_kar;
+		goto err_iounmap;
 
 	err = mthca_setup_hca(mdev);
 	if (err)
@@ -1007,19 +1010,11 @@
 
 	mthca_cleanup_mr_table(mdev);
 	mthca_cleanup_pd_table(mdev);
+	mthca_cleanup_uar_table(mdev);
 
 err_close:
 	mthca_close_hca(mdev);
 
-err_iounmap_kar:
-	iounmap(mdev->kar);
-
-err_iounmap_ecr:
-	iounmap(mdev->ecr_base);
-
-err_iounmap_clr:
-	iounmap(mdev->clr_base);
-
 err_iounmap:
 	iounmap(mdev->hcr);
 
@@ -1065,11 +1060,13 @@
 		mthca_cleanup_mr_table(mdev);
 		mthca_cleanup_pd_table(mdev);
 
+		iounmap(mdev->kar);
+		mthca_uar_free(mdev, &mdev->driver_uar);
+		mthca_cleanup_uar_table(mdev);
+
 		mthca_close_hca(mdev);
 
 		iounmap(mdev->hcr);
-		iounmap(mdev->ecr_base);
-		iounmap(mdev->clr_base);
 
 		if (mdev->mthca_flags & MTHCA_FLAG_MSI_X)
 			pci_disable_msix(pdev);
diff -Nru a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c
--- a/drivers/infiniband/hw/mthca/mthca_memfree.c	2005-01-25 13:50:22 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.c	2005-03-04 22:32:54 -08:00
@@ -79,6 +79,7 @@
 	if (!icm)
 		return icm;
 
+	icm->refcount = 0;
 	INIT_LIST_HEAD(&icm->chunk_list);
 
 	cur_order = get_order(MTHCA_ICM_ALLOC_SIZE);
@@ -138,9 +139,62 @@
 	return NULL;
 }
 
+int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int obj)
+{
+	int i = (obj & (table->num_obj - 1)) * table->obj_size / MTHCA_TABLE_CHUNK_SIZE;
+	int ret = 0;
+	u8 status;
+
+	down(&table->mutex);
+
+	if (table->icm[i]) {
+		++table->icm[i]->refcount;
+		goto out;
+	}
+
+	table->icm[i] = mthca_alloc_icm(dev, MTHCA_TABLE_CHUNK_SIZE >> PAGE_SHIFT,
+					(table->lowmem ? GFP_KERNEL : GFP_HIGHUSER) |
+					__GFP_NOWARN);
+	if (!table->icm[i]) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	if (mthca_MAP_ICM(dev, table->icm[i], table->virt + i * MTHCA_TABLE_CHUNK_SIZE,
+			  &status) || status) {
+		mthca_free_icm(dev, table->icm[i]);
+		table->icm[i] = NULL;
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	++table->icm[i]->refcount;
+
+out:
+	up(&table->mutex);
+	return ret;
+}
+
+void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int obj)
+{
+	int i = (obj & (table->num_obj - 1)) * table->obj_size / MTHCA_TABLE_CHUNK_SIZE;
+	u8 status;
+
+	down(&table->mutex);
+
+	if (--table->icm[i]->refcount == 0) {
+		mthca_UNMAP_ICM(dev, table->virt + i * MTHCA_TABLE_CHUNK_SIZE,
+				MTHCA_TABLE_CHUNK_SIZE >> 12, &status);
+		mthca_free_icm(dev, table->icm[i]);
+		table->icm[i] = NULL;
+	}
+
+	up(&table->mutex);
+}
+
 struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev,
-					      u64 virt, unsigned size,
-					      unsigned reserved,
+					      u64 virt, int obj_size,
+					      int nobj, int reserved,
 					      int use_lowmem)
 {
 	struct mthca_icm_table *table;
@@ -148,20 +202,23 @@
 	int i;
 	u8 status;
 
-	num_icm = size / MTHCA_TABLE_CHUNK_SIZE;
+	num_icm = obj_size * nobj / MTHCA_TABLE_CHUNK_SIZE;
 
 	table = kmalloc(sizeof *table + num_icm * sizeof *table->icm, GFP_KERNEL);
 	if (!table)
 		return NULL;
 
-	table->virt    = virt;
-	table->num_icm = num_icm;
-	init_MUTEX(&table->sem);
+	table->virt     = virt;
+	table->num_icm  = num_icm;
+	table->num_obj  = nobj;
+	table->obj_size = obj_size;
+	table->lowmem   = use_lowmem;
+	init_MUTEX(&table->mutex);
 
 	for (i = 0; i < num_icm; ++i)
 		table->icm[i] = NULL;
 
-	for (i = 0; i < (reserved + MTHCA_TABLE_CHUNK_SIZE - 1) / MTHCA_TABLE_CHUNK_SIZE; ++i) {
+	for (i = 0; i * MTHCA_TABLE_CHUNK_SIZE < reserved * obj_size; ++i) {
 		table->icm[i] = mthca_alloc_icm(dev, MTHCA_TABLE_CHUNK_SIZE >> PAGE_SHIFT,
 						(use_lowmem ? GFP_KERNEL : GFP_HIGHUSER) |
 						__GFP_NOWARN);
@@ -173,6 +230,12 @@
 			table->icm[i] = NULL;
 			goto err;
 		}
+
+		/*
+		 * Add a reference to this ICM chunk so that it never
+		 * gets freed (since it contains reserved firmware objects).
+		 */
+		++table->icm[i]->refcount;
 	}
 
 	return table;
@@ -203,4 +266,200 @@
 		}
 
 	kfree(table);
+}
+
+static u64 mthca_uarc_virt(struct mthca_dev *dev, int page)
+{
+	return dev->uar_table.uarc_base +
+		dev->driver_uar.index * dev->uar_table.uarc_size +
+		page * 4096;
+}
+
+int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, u32 **db)
+{
+	int group;
+	int start, end, dir;
+	int i, j;
+	struct mthca_db_page *page;
+	int ret = 0;
+	u8 status;
+
+	down(&dev->db_tab->mutex);
+
+	switch (type) {
+	case MTHCA_DB_TYPE_CQ_ARM:
+	case MTHCA_DB_TYPE_SQ:
+		group = 0;
+		start = 0;
+		end   = dev->db_tab->max_group1;
+		dir   = 1;
+		break;
+
+	case MTHCA_DB_TYPE_CQ_SET_CI:
+	case MTHCA_DB_TYPE_RQ:
+	case MTHCA_DB_TYPE_SRQ:
+		group = 1;
+		start = dev->db_tab->npages - 1;
+		end   = dev->db_tab->min_group2;
+		dir   = -1;
+		break;
+
+	default:
+		return -1;
+	}
+
+	for (i = start; i != end; i += dir)
+		if (dev->db_tab->page[i].db_rec &&
+		    !bitmap_full(dev->db_tab->page[i].used,
+				 MTHCA_DB_REC_PER_PAGE)) {
+			page = dev->db_tab->page + i;
+			goto found;
+		}
+
+	if (dev->db_tab->max_group1 >= dev->db_tab->min_group2 - 1) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	page = dev->db_tab->page + end;
+	page->db_rec = dma_alloc_coherent(&dev->pdev->dev, 4096,
+					  &page->mapping, GFP_KERNEL);
+	if (!page->db_rec) {
+		ret = -ENOMEM;
+		goto out;
+	}
+	memset(page->db_rec, 0, 4096);
+
+	ret = mthca_MAP_ICM_page(dev, page->mapping, mthca_uarc_virt(dev, i), &status);
+	if (!ret && status)
+		ret = -EINVAL;
+	if (ret) {
+		dma_free_coherent(&dev->pdev->dev, 4096,
+				  page->db_rec, page->mapping);
+		goto out;
+	}
+
+	bitmap_zero(page->used, MTHCA_DB_REC_PER_PAGE);
+	if (group == 0)
+		++dev->db_tab->max_group1;
+	else
+		--dev->db_tab->min_group2;
+
+found:
+	j = find_first_zero_bit(page->used, MTHCA_DB_REC_PER_PAGE);
+	set_bit(j, page->used);
+
+	if (group == 1)
+		j = MTHCA_DB_REC_PER_PAGE - 1 - j;
+
+	ret = i * MTHCA_DB_REC_PER_PAGE + j;
+
+	page->db_rec[j] = cpu_to_be64((qn << 8) | (type << 5));
+
+	*db = (u32 *) &page->db_rec[j];
+
+out:
+	up(&dev->db_tab->mutex);
+
+	return ret;
+}
+
+void mthca_free_db(struct mthca_dev *dev, int type, int db_index)
+{
+	int i, j;
+	struct mthca_db_page *page;
+	u8 status;
+
+	i = db_index / MTHCA_DB_REC_PER_PAGE;
+	j = db_index % MTHCA_DB_REC_PER_PAGE;
+
+	page = dev->db_tab->page + i;
+
+	down(&dev->db_tab->mutex);
+
+	page->db_rec[j] = 0;
+	if (i >= dev->db_tab->min_group2)
+		j = MTHCA_DB_REC_PER_PAGE - 1 - j;
+	clear_bit(j, page->used);
+
+	if (bitmap_empty(page->used, MTHCA_DB_REC_PER_PAGE) &&
+	    i >= dev->db_tab->max_group1 - 1) {
+		mthca_UNMAP_ICM(dev, mthca_uarc_virt(dev, i), 1, &status);
+
+		dma_free_coherent(&dev->pdev->dev, 4096,
+				  page->db_rec, page->mapping);
+		page->db_rec = NULL;
+
+		if (i == dev->db_tab->max_group1) {
+			--dev->db_tab->max_group1;
+			/* XXX may be able to unmap more pages now */
+		}
+		if (i == dev->db_tab->min_group2)
+			++dev->db_tab->min_group2;
+	}
+
+	up(&dev->db_tab->mutex);
+}
+
+int mthca_init_db_tab(struct mthca_dev *dev)
+{
+	int i;
+
+	if (dev->hca_type != ARBEL_NATIVE)
+		return 0;
+
+	dev->db_tab = kmalloc(sizeof *dev->db_tab, GFP_KERNEL);
+	if (!dev->db_tab)
+		return -ENOMEM;
+
+	init_MUTEX(&dev->db_tab->mutex);
+
+	dev->db_tab->npages     = dev->uar_table.uarc_size / PAGE_SIZE;
+	dev->db_tab->max_group1 = 0;
+	dev->db_tab->min_group2 = dev->db_tab->npages - 1;
+
+	dev->db_tab->page = kmalloc(dev->db_tab->npages *
+				    sizeof *dev->db_tab->page,
+				    GFP_KERNEL);
+	if (!dev->db_tab->page) {
+		kfree(dev->db_tab);
+		return -ENOMEM;
+	}
+
+	for (i = 0; i < dev->db_tab->npages; ++i)
+		dev->db_tab->page[i].db_rec = NULL;
+
+	return 0;
+}
+
+void mthca_cleanup_db_tab(struct mthca_dev *dev)
+{
+	int i;
+	u8 status;
+
+	if (dev->hca_type != ARBEL_NATIVE)
+		return;
+
+	/*
+	 * Because we don't always free our UARC pages when they
+	 * become empty to make mthca_free_db() simpler we need to
+	 * make a sweep through the doorbell pages and free any
+	 * leftover pages now.
+	 */
+	for (i = 0; i < dev->db_tab->npages; ++i) {
+		if (!dev->db_tab->page[i].db_rec)
+			continue;
+
+		if (!bitmap_empty(dev->db_tab->page[i].used, MTHCA_DB_REC_PER_PAGE))
+			mthca_warn(dev, "Kernel UARC page %d not empty\n", i);
+
+		mthca_UNMAP_ICM(dev, mthca_uarc_virt(dev, i), 1, &status);
+
+		dma_free_coherent(&dev->pdev->dev, 4096,
+				  dev->db_tab->page[i].db_rec,
+				  dev->db_tab->page[i].mapping);
+	}
+
+	kfree(dev->db_tab->page);
+	kfree(dev->db_tab);
 }
diff -Nru a/drivers/infiniband/hw/mthca/mthca_memfree.h b/drivers/infiniband/hw/mthca/mthca_memfree.h
--- a/drivers/infiniband/hw/mthca/mthca_memfree.h	2005-01-25 13:50:22 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_memfree.h	2005-03-04 22:32:54 -08:00
@@ -53,12 +53,16 @@
 
 struct mthca_icm {
 	struct list_head chunk_list;
+	int              refcount;
 };
 
 struct mthca_icm_table {
 	u64               virt;
 	int               num_icm;
-	struct semaphore  sem;
+	int               num_obj;
+	int               obj_size;
+	int               lowmem;
+	struct semaphore  mutex;
 	struct mthca_icm *icm[0];
 };
 
@@ -75,10 +79,12 @@
 void mthca_free_icm(struct mthca_dev *dev, struct mthca_icm *icm);
 
 struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev,
-					      u64 virt, unsigned size,
-					      unsigned reserved,
+					      u64 virt, int obj_size,
+					      int nobj, int reserved,
 					      int use_lowmem);
 void mthca_free_icm_table(struct mthca_dev *dev, struct mthca_icm_table *table);
+int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int obj);
+void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int obj);
 
 static inline void mthca_icm_first(struct mthca_icm *icm,
 				   struct mthca_icm_iter *iter)
@@ -118,5 +124,38 @@
 {
 	return sg_dma_len(&iter->chunk->mem[iter->page_idx]);
 }
+
+enum {
+	MTHCA_DB_REC_PER_PAGE = 4096 / 8
+};
+
+struct mthca_db_page {
+	DECLARE_BITMAP(used, MTHCA_DB_REC_PER_PAGE);
+	u64       *db_rec;
+	dma_addr_t mapping;
+};
+
+struct mthca_db_table {
+	int 	       	      npages;
+	int 	       	      max_group1;
+	int 	       	      min_group2;
+	struct mthca_db_page *page;
+	struct semaphore      mutex;
+};
+
+enum {
+	MTHCA_DB_TYPE_INVALID   = 0x0,
+	MTHCA_DB_TYPE_CQ_SET_CI = 0x1,
+	MTHCA_DB_TYPE_CQ_ARM    = 0x2,
+	MTHCA_DB_TYPE_SQ        = 0x3,
+	MTHCA_DB_TYPE_RQ        = 0x4,
+	MTHCA_DB_TYPE_SRQ       = 0x5,
+	MTHCA_DB_TYPE_GROUP_SEP = 0x7
+};
+
+int mthca_init_db_tab(struct mthca_dev *dev);
+void mthca_cleanup_db_tab(struct mthca_dev *dev);
+int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, u32 **db);
+void mthca_free_db(struct mthca_dev *dev, int type, int db_index);
 
 #endif /* MTHCA_MEMFREE_H */
diff -Nru a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
--- a/drivers/infiniband/hw/mthca/mthca_mr.c	2005-01-15 14:01:45 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c	2005-03-04 22:32:54 -08:00
@@ -53,7 +53,8 @@
 	u32 window_count;
 	u32 window_count_limit;
 	u64 mtt_seg;
-	u32 reserved[3];
+	u32 mtt_sz;		/* Arbel only */
+	u32 reserved[2];
 } __attribute__((packed));
 
 #define MTHCA_MPT_FLAG_SW_OWNS       (0xfUL << 28)
@@ -121,21 +122,38 @@
 	spin_unlock(&dev->mr_table.mpt_alloc.lock);
 }
 
+static inline u32 hw_index_to_key(struct mthca_dev *dev, u32 ind)
+{
+	if (dev->hca_type == ARBEL_NATIVE)
+		return (ind >> 24) | (ind << 8);
+	else
+		return ind;
+}
+
+static inline u32 key_to_hw_index(struct mthca_dev *dev, u32 key)
+{
+	if (dev->hca_type == ARBEL_NATIVE)
+		return (key << 24) | (key >> 8);
+	else
+		return key;
+}
+
 int mthca_mr_alloc_notrans(struct mthca_dev *dev, u32 pd,
 			   u32 access, struct mthca_mr *mr)
 {
 	void *mailbox;
 	struct mthca_mpt_entry *mpt_entry;
+	u32 key;
 	int err;
 	u8 status;
 
 	might_sleep();
 
 	mr->order = -1;
-	mr->ibmr.lkey = mthca_alloc(&dev->mr_table.mpt_alloc);
-	if (mr->ibmr.lkey == -1)
+	key = mthca_alloc(&dev->mr_table.mpt_alloc);
+	if (key == -1)
 		return -ENOMEM;
-	mr->ibmr.rkey = mr->ibmr.lkey;
+	mr->ibmr.rkey = mr->ibmr.lkey = hw_index_to_key(dev, key);
 
 	mailbox = kmalloc(sizeof *mpt_entry + MTHCA_CMD_MAILBOX_EXTRA,
 			  GFP_KERNEL);
@@ -151,7 +169,7 @@
 				       MTHCA_MPT_FLAG_REGION      |
 				       access);
 	mpt_entry->page_size = 0;
-	mpt_entry->key       = cpu_to_be32(mr->ibmr.lkey);
+	mpt_entry->key       = cpu_to_be32(key);
 	mpt_entry->pd        = cpu_to_be32(pd);
 	mpt_entry->start     = 0;
 	mpt_entry->length    = ~0ULL;
@@ -160,7 +178,7 @@
 	       sizeof *mpt_entry - offsetof(struct mthca_mpt_entry, lkey));
 
 	err = mthca_SW2HW_MPT(dev, mpt_entry,
-			      mr->ibmr.lkey & (dev->limits.num_mpts - 1),
+			      key & (dev->limits.num_mpts - 1),
 			      &status);
 	if (err)
 		mthca_warn(dev, "SW2HW_MPT failed (%d)\n", err);
@@ -182,6 +200,7 @@
 	void *mailbox;
 	u64 *mtt_entry;
 	struct mthca_mpt_entry *mpt_entry;
+	u32 key;
 	int err = -ENOMEM;
 	u8 status;
 	int i;
@@ -189,10 +208,10 @@
 	might_sleep();
 	WARN_ON(buffer_size_shift >= 32);
 
-	mr->ibmr.lkey = mthca_alloc(&dev->mr_table.mpt_alloc);
-	if (mr->ibmr.lkey == -1)
+	key = mthca_alloc(&dev->mr_table.mpt_alloc);
+	if (key == -1)
 		return -ENOMEM;
-	mr->ibmr.rkey = mr->ibmr.lkey;
+	mr->ibmr.rkey = mr->ibmr.lkey = hw_index_to_key(dev, key);
 
 	for (i = dev->limits.mtt_seg_size / 8, mr->order = 0;
 	     i < list_len;
@@ -254,7 +273,7 @@
 				       access);
 
 	mpt_entry->page_size = cpu_to_be32(buffer_size_shift - 12);
-	mpt_entry->key       = cpu_to_be32(mr->ibmr.lkey);
+	mpt_entry->key       = cpu_to_be32(key);
 	mpt_entry->pd        = cpu_to_be32(pd);
 	mpt_entry->start     = cpu_to_be64(iova);
 	mpt_entry->length    = cpu_to_be64(total_size);
@@ -275,7 +294,7 @@
 	}
 
 	err = mthca_SW2HW_MPT(dev, mpt_entry,
-			      mr->ibmr.lkey & (dev->limits.num_mpts - 1),
+			      key & (dev->limits.num_mpts - 1),
 			      &status);
 	if (err)
 		mthca_warn(dev, "SW2HW_MPT failed (%d)\n", err);
@@ -307,7 +326,8 @@
 	might_sleep();
 
 	err = mthca_HW2SW_MPT(dev, NULL,
-			      mr->ibmr.lkey & (dev->limits.num_mpts - 1),
+			      key_to_hw_index(dev, mr->ibmr.lkey) &
+			      (dev->limits.num_mpts - 1),
 			      &status);
 	if (err)
 		mthca_warn(dev, "HW2SW_MPT failed (%d)\n", err);
@@ -318,7 +338,7 @@
 	if (mr->order >= 0)
 		mthca_free_mtt(dev, mr->first_seg, mr->order);
 
-	mthca_free(&dev->mr_table.mpt_alloc, mr->ibmr.lkey);
+	mthca_free(&dev->mr_table.mpt_alloc, key_to_hw_index(dev, mr->ibmr.lkey));
 }
 
 int __devinit mthca_init_mr_table(struct mthca_dev *dev)
diff -Nru a/drivers/infiniband/hw/mthca/mthca_profile.c b/drivers/infiniband/hw/mthca/mthca_profile.c
--- a/drivers/infiniband/hw/mthca/mthca_profile.c	2005-01-25 13:50:22 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_profile.c	2005-03-04 22:32:54 -08:00
@@ -236,15 +236,20 @@
 			init_hca->mtt_seg_sz     = ffs(dev_lim->mtt_seg_sz) - 7;
 			break;
 		case MTHCA_RES_UAR:
+			dev->limits.num_uars       = profile[i].num;
 			init_hca->uar_scratch_base = profile[i].start;
 			break;
 		case MTHCA_RES_UDAV:
 			dev->av_table.ddr_av_base = profile[i].start;
 			dev->av_table.num_ddr_avs = profile[i].num;
+			break;
 		case MTHCA_RES_UARC:
-			init_hca->uarc_base   = profile[i].start;
-			init_hca->log_uarc_sz = ffs(request->uarc_size) - 13;
-			init_hca->log_uar_sz  = ffs(request->num_uar) - 1;
+			dev->uar_table.uarc_size = request->uarc_size;
+			dev->uar_table.uarc_base = profile[i].start;
+			init_hca->uarc_base   	 = profile[i].start;
+			init_hca->log_uarc_sz 	 = ffs(request->uarc_size) - 13;
+			init_hca->log_uar_sz  	 = ffs(request->num_uar) - 1;
+			break;
 		default:
 			break;
 		}
diff -Nru a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
--- a/drivers/infiniband/hw/mthca/mthca_provider.c	2005-01-25 13:50:24 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c	2005-03-04 22:32:56 -08:00
@@ -43,6 +43,8 @@
 	struct ib_smp *in_mad  = NULL;
 	struct ib_smp *out_mad = NULL;
 	int err = -ENOMEM;
+	struct mthca_dev* mdev = to_mdev(ibdev);
+
 	u8 status;
 
 	in_mad  = kmalloc(sizeof *in_mad, GFP_KERNEL);
@@ -50,7 +52,7 @@
 	if (!in_mad || !out_mad)
 		goto out;
 
-	props->fw_ver        = to_mdev(ibdev)->fw_ver;
+	props->fw_ver              = mdev->fw_ver;
 
 	memset(in_mad, 0, sizeof *in_mad);
 	in_mad->base_version       = 1;
@@ -59,7 +61,7 @@
 	in_mad->method         	   = IB_MGMT_METHOD_GET;
 	in_mad->attr_id   	   = IB_SMP_ATTR_NODE_INFO;
 
-	err = mthca_MAD_IFC(to_mdev(ibdev), 1, 1,
+	err = mthca_MAD_IFC(mdev, 1, 1,
 			    1, NULL, NULL, in_mad, out_mad,
 			    &status);
 	if (err)
@@ -69,10 +71,11 @@
 		goto out;
 	}
 
-	props->vendor_id      = be32_to_cpup((u32 *) (out_mad->data + 36)) &
+	props->device_cap_flags = mdev->device_cap_flags;
+	props->vendor_id        = be32_to_cpup((u32 *) (out_mad->data + 36)) &
 		0xffffff;
-	props->vendor_part_id = be16_to_cpup((u16 *) (out_mad->data + 30));
-	props->hw_ver         = be16_to_cpup((u16 *) (out_mad->data + 32));
+	props->vendor_part_id   = be16_to_cpup((u16 *) (out_mad->data + 30));
+	props->hw_ver           = be16_to_cpup((u16 *) (out_mad->data + 32));
 	memcpy(&props->sys_image_guid, out_mad->data +  4, 8);
 	memcpy(&props->node_guid,      out_mad->data + 12, 8);
 
@@ -343,7 +346,7 @@
 				     to_mcq(init_attr->send_cq),
 				     to_mcq(init_attr->recv_cq),
 				     init_attr->qp_type, init_attr->sq_sig_type,
-				     init_attr->rq_sig_type, qp);
+				     qp);
 		qp->ibqp.qp_num = qp->qpn;
 		break;
 	}
@@ -364,7 +367,7 @@
 		err = mthca_alloc_sqp(to_mdev(pd->device), to_mpd(pd),
 				      to_mcq(init_attr->send_cq),
 				      to_mcq(init_attr->recv_cq),
-				      init_attr->sq_sig_type, init_attr->rq_sig_type,
+				      init_attr->sq_sig_type,
 				      qp->ibqp.qp_num, init_attr->port_num,
 				      to_msqp(qp));
 		break;
@@ -408,8 +411,7 @@
 	if (err) {
 		kfree(cq);
 		cq = ERR_PTR(err);
-	} else
-		cq->ibcq.cqe = nent - 1;
+	}
 
 	return &cq->ibcq;
 }
@@ -422,13 +424,6 @@
 	return 0;
 }
 
-static int mthca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify notify)
-{
-	mthca_arm_cq(to_mdev(cq->device), to_mcq(cq),
-		     notify == IB_CQ_SOLICITED);
-	return 0;
-}
-
 static inline u32 convert_access(int acc)
 {
 	return (acc & IB_ACCESS_REMOTE_ATOMIC ? MTHCA_MPT_FLAG_ATOMIC       : 0) |
@@ -621,18 +616,25 @@
 	dev->ib_dev.create_qp            = mthca_create_qp;
 	dev->ib_dev.modify_qp            = mthca_modify_qp;
 	dev->ib_dev.destroy_qp           = mthca_destroy_qp;
-	dev->ib_dev.post_send            = mthca_post_send;
-	dev->ib_dev.post_recv            = mthca_post_receive;
 	dev->ib_dev.create_cq            = mthca_create_cq;
 	dev->ib_dev.destroy_cq           = mthca_destroy_cq;
 	dev->ib_dev.poll_cq              = mthca_poll_cq;
-	dev->ib_dev.req_notify_cq        = mthca_req_notify_cq;
 	dev->ib_dev.get_dma_mr           = mthca_get_dma_mr;
 	dev->ib_dev.reg_phys_mr          = mthca_reg_phys_mr;
 	dev->ib_dev.dereg_mr             = mthca_dereg_mr;
 	dev->ib_dev.attach_mcast         = mthca_multicast_attach;
 	dev->ib_dev.detach_mcast         = mthca_multicast_detach;
 	dev->ib_dev.process_mad          = mthca_process_mad;
+
+	if (dev->hca_type == ARBEL_NATIVE) {
+		dev->ib_dev.req_notify_cq = mthca_arbel_arm_cq;
+		dev->ib_dev.post_send     = mthca_arbel_post_send;
+		dev->ib_dev.post_recv     = mthca_arbel_post_receive;
+	} else {
+		dev->ib_dev.req_notify_cq = mthca_tavor_arm_cq;
+		dev->ib_dev.post_send     = mthca_tavor_post_send;
+		dev->ib_dev.post_recv     = mthca_tavor_post_receive;
+	}
 
 	init_MUTEX(&dev->cap_mask_mutex);
 
diff -Nru a/drivers/infiniband/hw/mthca/mthca_provider.h b/drivers/infiniband/hw/mthca/mthca_provider.h
--- a/drivers/infiniband/hw/mthca/mthca_provider.h	2005-01-25 13:50:23 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_provider.h	2005-03-04 22:32:56 -08:00
@@ -49,6 +49,11 @@
 	DECLARE_PCI_UNMAP_ADDR(mapping)
 };
 
+struct mthca_uar {
+	unsigned long pfn;
+	int           index;
+};
+
 struct mthca_mr {
 	struct ib_mr ibmr;
 	int order;
@@ -65,7 +70,7 @@
 struct mthca_eq {
 	struct mthca_dev      *dev;
 	int                    eqn;
-	u32                    ecr_mask;
+	u32                    eqn_mask;
 	u32                    cons_index;
 	u16                    msi_x_vector;
 	u16                    msi_x_entry;
@@ -77,12 +82,18 @@
 
 struct mthca_av;
 
+enum mthca_ah_type {
+	MTHCA_AH_ON_HCA,
+	MTHCA_AH_PCI_POOL,
+	MTHCA_AH_KMALLOC
+};
+
 struct mthca_ah {
-	struct ib_ah     ibah;
-	int              on_hca;
-	u32              key;
-	struct mthca_av *av;
-	dma_addr_t       avdma;
+	struct ib_ah       ibah;
+	enum mthca_ah_type type;
+	u32                key;
+	struct mthca_av   *av;
+	dma_addr_t         avdma;
 };
 
 /*
@@ -136,8 +147,16 @@
 	spinlock_t             lock;
 	atomic_t               refcount;
 	int                    cqn;
-	int                    cons_index;
+	u32                    cons_index;
 	int                    is_direct;
+
+	/* Next fields are Arbel only */
+	int                    set_ci_db_index;
+	u32                   *set_ci_db;
+	int                    arm_db_index;
+	u32                   *arm_db;
+	int                    arm_sn;
+
 	union {
 		struct mthca_buf_list direct;
 		struct mthca_buf_list *page_list;
@@ -147,19 +166,22 @@
 };
 
 struct mthca_wq {
-	int   max;
-	int   cur;
-	int   next;
-	int   last_comp;
-	void *last;
-	int   max_gs;
-	int   wqe_shift;
-	enum ib_sig_type policy;
+	spinlock_t lock;
+	int        max;
+	unsigned   next_ind;
+	unsigned   last_comp;
+	unsigned   head;
+	unsigned   tail;
+	void      *last;
+	int        max_gs;
+	int        wqe_shift;
+
+	int        db_index;	/* Arbel only */
+	u32       *db;
 };
 
 struct mthca_qp {
 	struct ib_qp           ibqp;
-	spinlock_t             lock;
 	atomic_t               refcount;
 	u32                    qpn;
 	int                    is_direct;
@@ -172,6 +194,7 @@
 
 	struct mthca_wq        rq;
 	struct mthca_wq        sq;
+	enum ib_sig_type       sq_policy;
 	int                    send_wqe_offset;
 
 	u64                   *wrid;
diff -Nru a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
--- a/drivers/infiniband/hw/mthca/mthca_qp.c	2005-02-03 06:42:39 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c	2005-03-04 22:32:56 -08:00
@@ -40,6 +40,7 @@
 
 #include "mthca_dev.h"
 #include "mthca_cmd.h"
+#include "mthca_memfree.h"
 
 enum {
 	MTHCA_MAX_DIRECT_QP_SIZE = 4 * PAGE_SIZE,
@@ -105,8 +106,11 @@
 
 struct mthca_qp_context {
 	u32 flags;
-	u32 sched_queue;
-	u32 mtu_msgmax;
+	u32 tavor_sched_queue;	/* Reserved on Arbel */
+	u8  mtu_msgmax;
+	u8  rq_size_stride;	/* Reserved on Tavor */
+	u8  sq_size_stride;	/* Reserved on Tavor */
+	u8  rlkey_arbel_sched_queue;	/* Reserved on Tavor */
 	u32 usr_page;
 	u32 local_qpn;
 	u32 remote_qpn;
@@ -121,18 +125,22 @@
 	u32 reserved2;
 	u32 next_send_psn;
 	u32 cqn_snd;
-	u32 next_snd_wqe[2];
+	u32 snd_wqe_base_l;	/* Next send WQE on Tavor */
+	u32 snd_db_index;	/* (debugging only entries) */
 	u32 last_acked_psn;
 	u32 ssn;
 	u32 params2;
 	u32 rnr_nextrecvpsn;
 	u32 ra_buff_indx;
 	u32 cqn_rcv;
-	u32 next_rcv_wqe[2];
+	u32 rcv_wqe_base_l;	/* Next recv WQE on Tavor */
+	u32 rcv_db_index;	/* (debugging only entries) */
 	u32 qkey;
 	u32 srqn;
 	u32 rmsn;
-	u32 reserved3[19];
+	u16 rq_wqe_counter;	/* reserved on Tavor */
+	u16 sq_wqe_counter;	/* reserved on Tavor */
+	u32 reserved3[18];
 } __attribute__((packed));
 
 struct mthca_qp_param {
@@ -193,7 +201,7 @@
 	u32 imm;		/* immediate data */
 };
 
-struct mthca_ud_seg {
+struct mthca_tavor_ud_seg {
 	u32 reserved1;
 	u32 lkey;
 	u64 av_addr;
@@ -203,6 +211,13 @@
 	u32 reserved3[2];
 };
 
+struct mthca_arbel_ud_seg {
+	u32 av[8];
+	u32 dqpn;
+	u32 qkey;
+	u32 reserved[2];
+};
+
 struct mthca_bind_seg {
 	u32 flags;		/* [31] Atomic [30] rem write [29] rem read */
 	u32 reserved;
@@ -238,6 +253,16 @@
 	u16 vcrc;
 };
 
+static const u8 mthca_opcode[] = {
+	[IB_WR_SEND]                 = MTHCA_OPCODE_SEND,
+	[IB_WR_SEND_WITH_IMM]        = MTHCA_OPCODE_SEND_IMM,
+	[IB_WR_RDMA_WRITE]           = MTHCA_OPCODE_RDMA_WRITE,
+	[IB_WR_RDMA_WRITE_WITH_IMM]  = MTHCA_OPCODE_RDMA_WRITE_IMM,
+	[IB_WR_RDMA_READ]            = MTHCA_OPCODE_RDMA_READ,
+	[IB_WR_ATOMIC_CMP_AND_SWP]   = MTHCA_OPCODE_ATOMIC_CS,
+	[IB_WR_ATOMIC_FETCH_AND_ADD] = MTHCA_OPCODE_ATOMIC_FA,
+};
+
 static int is_sqp(struct mthca_dev *dev, struct mthca_qp *qp)
 {
 	return qp->qpn >= dev->qp_table.sqp_start &&
@@ -552,9 +577,11 @@
 		else
 			cur_state = attr->cur_qp_state;
 	} else {
-		spin_lock_irq(&qp->lock);
+		spin_lock_irq(&qp->sq.lock);
+		spin_lock(&qp->rq.lock);
 		cur_state = qp->state;
-		spin_unlock_irq(&qp->lock);
+		spin_unlock(&qp->rq.lock);
+		spin_unlock_irq(&qp->sq.lock);
 	}
 
 	if (attr_mask & IB_QP_STATE) {
@@ -617,15 +644,24 @@
 			break;
 		}
 	}
-	/* leave sched_queue as 0 */
+
+	/* leave tavor_sched_queue as 0 */
+
 	if (qp->transport == MLX || qp->transport == UD)
-		qp_context->mtu_msgmax = cpu_to_be32((IB_MTU_2048 << 29) |
-						     (11 << 24));
-	else if (attr_mask & IB_QP_PATH_MTU) {
-		qp_context->mtu_msgmax = cpu_to_be32((attr->path_mtu << 29) |
-						     (31 << 24));
+		qp_context->mtu_msgmax = (IB_MTU_2048 << 5) | 11;
+	else if (attr_mask & IB_QP_PATH_MTU)
+		qp_context->mtu_msgmax = (attr->path_mtu << 5) | 31;
+
+	if (dev->hca_type == ARBEL_NATIVE) {
+		qp_context->rq_size_stride =
+			((ffs(qp->rq.max) - 1) << 3) | (qp->rq.wqe_shift - 4);
+		qp_context->sq_size_stride =
+			((ffs(qp->sq.max) - 1) << 3) | (qp->sq.wqe_shift - 4);
 	}
-	qp_context->usr_page   = cpu_to_be32(MTHCA_KAR_PAGE);
+
+	/* leave arbel_sched_queue as 0 */
+
+	qp_context->usr_page   = cpu_to_be32(dev->driver_uar.index);
 	qp_context->local_qpn  = cpu_to_be32(qp->qpn);
 	if (attr_mask & IB_QP_DEST_QPN) {
 		qp_context->remote_qpn = cpu_to_be32(attr->dest_qp_num);
@@ -690,7 +726,7 @@
 					     MTHCA_QP_BIT_SRE           |
 					     MTHCA_QP_BIT_SWE           |
 					     MTHCA_QP_BIT_SAE);
-	if (qp->sq.policy == IB_SIGNAL_ALL_WR)
+	if (qp->sq_policy == IB_SIGNAL_ALL_WR)
 		qp_context->params1 |= cpu_to_be32(MTHCA_QP_BIT_SSC);
 	if (attr_mask & IB_QP_RETRY_CNT) {
 		qp_context->params1 |= cpu_to_be32(attr->retry_cnt << 16);
@@ -708,6 +744,11 @@
 		qp_context->next_send_psn = cpu_to_be32(attr->sq_psn);
 	qp_context->cqn_snd = cpu_to_be32(to_mcq(ibqp->send_cq)->cqn);
 
+	if (dev->hca_type == ARBEL_NATIVE) {
+		qp_context->snd_wqe_base_l = cpu_to_be32(qp->send_wqe_offset);
+		qp_context->snd_db_index   = cpu_to_be32(qp->sq.db_index);
+	}
+
 	if (attr_mask & IB_QP_ACCESS_FLAGS) {
 		/*
 		 * Only enable RDMA/atomics if we have responder
@@ -778,8 +819,8 @@
 		qp->resp_depth = attr->max_rd_atomic;
 	}
 
-	if (qp->rq.policy == IB_SIGNAL_ALL_WR)
-		qp_context->params2 |= cpu_to_be32(MTHCA_QP_BIT_RSC);
+	qp_context->params2 |= cpu_to_be32(MTHCA_QP_BIT_RSC);
+
 	if (attr_mask & IB_QP_MIN_RNR_TIMER) {
 		qp_context->rnr_nextrecvpsn |= cpu_to_be32(attr->min_rnr_timer << 24);
 		qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RNR_TIMEOUT);
@@ -787,12 +828,16 @@
 	if (attr_mask & IB_QP_RQ_PSN)
 		qp_context->rnr_nextrecvpsn |= cpu_to_be32(attr->rq_psn);
 
-	qp_context->ra_buff_indx = dev->qp_table.rdb_base +
-		((qp->qpn & (dev->limits.num_qps - 1)) * MTHCA_RDB_ENTRY_SIZE <<
-		 dev->qp_table.rdb_shift);
+	qp_context->ra_buff_indx =
+		cpu_to_be32(dev->qp_table.rdb_base +
+			    ((qp->qpn & (dev->limits.num_qps - 1)) * MTHCA_RDB_ENTRY_SIZE <<
+			     dev->qp_table.rdb_shift));
 
 	qp_context->cqn_rcv = cpu_to_be32(to_mcq(ibqp->recv_cq)->cqn);
 
+	if (dev->hca_type == ARBEL_NATIVE)
+		qp_context->rcv_db_index   = cpu_to_be32(qp->rq.db_index);
+
 	if (attr_mask & IB_QP_QKEY) {
 		qp_context->qkey = cpu_to_be32(attr->qkey);
 		qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_Q_KEY);
@@ -860,12 +905,20 @@
 
 	size = sizeof (struct mthca_next_seg) +
 		qp->sq.max_gs * sizeof (struct mthca_data_seg);
-	if (qp->transport == MLX)
+	switch (qp->transport) {
+	case MLX:
 		size += 2 * sizeof (struct mthca_data_seg);
-	else if (qp->transport == UD)
-		size += sizeof (struct mthca_ud_seg);
-	else /* bind seg is as big as atomic + raddr segs */
+		break;
+	case UD:
+		if (dev->hca_type == ARBEL_NATIVE)
+			size += sizeof (struct mthca_arbel_ud_seg);
+		else
+			size += sizeof (struct mthca_tavor_ud_seg);
+		break;
+	default:
+		/* bind seg is as big as atomic + raddr segs */
 		size += sizeof (struct mthca_bind_seg);
+	}
 
 	for (qp->sq.wqe_shift = 6; 1 << qp->sq.wqe_shift < size;
 	     qp->sq.wqe_shift++)
@@ -942,7 +995,6 @@
 
 	err = mthca_mr_alloc_phys(dev, pd->pd_num, dma_list, shift,
 				  npages, 0, size,
-				  MTHCA_MPT_FLAG_LOCAL_WRITE |
 				  MTHCA_MPT_FLAG_LOCAL_READ,
 				  &qp->mr);
 	if (err)
@@ -972,34 +1024,134 @@
 	return err;
 }
 
+static int mthca_alloc_memfree(struct mthca_dev *dev,
+			       struct mthca_qp *qp)
+{
+	int ret = 0;
+
+	if (dev->hca_type == ARBEL_NATIVE) {
+		ret = mthca_table_get(dev, dev->qp_table.qp_table, qp->qpn);
+		if (ret)
+			return ret;
+
+		ret = mthca_table_get(dev, dev->qp_table.eqp_table, qp->qpn);
+		if (ret)
+			goto err_qpc;
+
+		qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ,
+						 qp->qpn, &qp->rq.db);
+		if (qp->rq.db_index < 0) {
+			ret = -ENOMEM;
+			goto err_eqpc;
+		}
+
+		qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ,
+						 qp->qpn, &qp->sq.db);
+		if (qp->sq.db_index < 0) {
+			ret = -ENOMEM;
+			goto err_rq_db;
+		}
+	}
+
+	return 0;
+
+err_rq_db:
+	mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index);
+
+err_eqpc:
+	mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn);
+
+err_qpc:
+	mthca_table_put(dev, dev->qp_table.qp_table, qp->qpn);
+
+	return ret;
+}
+
+static void mthca_free_memfree(struct mthca_dev *dev,
+			       struct mthca_qp *qp)
+{
+	if (dev->hca_type == ARBEL_NATIVE) {
+		mthca_free_db(dev, MTHCA_DB_TYPE_SQ, qp->sq.db_index);
+		mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index);
+		mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn);
+		mthca_table_put(dev, dev->qp_table.qp_table, qp->qpn);
+	}
+}
+
+static void mthca_wq_init(struct mthca_wq* wq)
+{
+	spin_lock_init(&wq->lock);
+	wq->next_ind  = 0;
+	wq->last_comp = wq->max - 1;
+	wq->head      = 0;
+	wq->tail      = 0;
+	wq->last      = NULL;
+}
+
 static int mthca_alloc_qp_common(struct mthca_dev *dev,
 				 struct mthca_pd *pd,
 				 struct mthca_cq *send_cq,
 				 struct mthca_cq *recv_cq,
 				 enum ib_sig_type send_policy,
-				 enum ib_sig_type recv_policy,
 				 struct mthca_qp *qp)
 {
-	int err;
+	struct mthca_next_seg *wqe;
+	int ret;
+	int i;
 
-	spin_lock_init(&qp->lock);
 	atomic_set(&qp->refcount, 1);
 	qp->state    	 = IB_QPS_RESET;
 	qp->atomic_rd_en = 0;
 	qp->resp_depth   = 0;
-	qp->sq.policy    = send_policy;
-	qp->rq.policy    = recv_policy;
-	qp->rq.cur       = 0;
-	qp->sq.cur       = 0;
-	qp->rq.next      = 0;
-	qp->sq.next      = 0;
-	qp->rq.last_comp = qp->rq.max - 1;
-	qp->sq.last_comp = qp->sq.max - 1;
-	qp->rq.last      = NULL;
-	qp->sq.last      = NULL;
+	qp->sq_policy    = send_policy;
+	mthca_wq_init(&qp->sq);
+	mthca_wq_init(&qp->rq);
+
+	ret = mthca_alloc_memfree(dev, qp);
+	if (ret)
+		return ret;
+
+	ret = mthca_alloc_wqe_buf(dev, pd, qp);
+	if (ret) {
+		mthca_free_memfree(dev, qp);
+		return ret;
+	}
+
+	if (dev->hca_type == ARBEL_NATIVE) {
+		for (i = 0; i < qp->rq.max; ++i) {
+			wqe = get_recv_wqe(qp, i);
+			wqe->nda_op = cpu_to_be32(((i + 1) & (qp->rq.max - 1)) <<
+						  qp->rq.wqe_shift);
+			wqe->ee_nds = cpu_to_be32(1 << (qp->rq.wqe_shift - 4));
+		}
+
+		for (i = 0; i < qp->sq.max; ++i) {
+			wqe = get_send_wqe(qp, i);
+			wqe->nda_op = cpu_to_be32((((i + 1) & (qp->sq.max - 1)) <<
+						   qp->sq.wqe_shift) +
+						  qp->send_wqe_offset);
+		}
+	}
 
-	err = mthca_alloc_wqe_buf(dev, pd, qp);
-	return err;
+	return 0;
+}
+
+static void mthca_align_qp_size(struct mthca_dev *dev, struct mthca_qp *qp)
+{
+	int i;
+
+	if (dev->hca_type != ARBEL_NATIVE)
+		return;
+
+	for (i = 0; 1 << i < qp->rq.max; ++i)
+		; /* nothing */
+
+	qp->rq.max = 1 << i;
+
+	for (i = 0; 1 << i < qp->sq.max; ++i)
+		; /* nothing */
+
+	qp->sq.max = 1 << i;
 }
 
 int mthca_alloc_qp(struct mthca_dev *dev,
@@ -1008,11 +1160,12 @@
 		   struct mthca_cq *recv_cq,
 		   enum ib_qp_type type,
 		   enum ib_sig_type send_policy,
-		   enum ib_sig_type recv_policy,
 		   struct mthca_qp *qp)
 {
 	int err;
 
+	mthca_align_qp_size(dev, qp);
+
 	switch (type) {
 	case IB_QPT_RC: qp->transport = RC; break;
 	case IB_QPT_UC: qp->transport = UC; break;
@@ -1025,7 +1178,7 @@
 		return -ENOMEM;
 
 	err = mthca_alloc_qp_common(dev, pd, send_cq, recv_cq,
-				    send_policy, recv_policy, qp);
+				    send_policy, qp);
 	if (err) {
 		mthca_free(&dev->qp_table.alloc, qp->qpn);
 		return err;
@@ -1044,7 +1197,6 @@
 		    struct mthca_cq *send_cq,
 		    struct mthca_cq *recv_cq,
 		    enum ib_sig_type send_policy,
-		    enum ib_sig_type recv_policy,
 		    int qpn,
 		    int port,
 		    struct mthca_sqp *sqp)
@@ -1052,6 +1204,8 @@
 	int err = 0;
 	u32 mqpn = qpn * 2 + dev->qp_table.sqp_start + port - 1;
 
+	mthca_align_qp_size(dev, &sqp->qp);
+
 	sqp->header_buf_size = sqp->qp.sq.max * MTHCA_UD_HEADER_SIZE;
 	sqp->header_buf = dma_alloc_coherent(&dev->pdev->dev, sqp->header_buf_size,
 					     &sqp->header_dma, GFP_KERNEL);
@@ -1073,8 +1227,7 @@
 	sqp->qp.transport = MLX;
 
 	err = mthca_alloc_qp_common(dev, pd, send_cq, recv_cq,
-				    send_policy, recv_policy,
-				    &sqp->qp);
+				    send_policy, &sqp->qp);
 	if (err)
 		goto err_out_free;
 
@@ -1083,9 +1236,21 @@
 	return 0;
 
  err_out_free:
-	spin_lock_irq(&dev->qp_table.lock);
+	/*
+	 * Lock CQs here, so that CQ polling code can do QP lookup
+	 * without taking a lock.
+	 */
+	spin_lock_irq(&send_cq->lock);
+	if (send_cq != recv_cq)
+		spin_lock(&recv_cq->lock);
+
+	spin_lock(&dev->qp_table.lock);
 	mthca_array_clear(&dev->qp_table.qp, mqpn);
-	spin_unlock_irq(&dev->qp_table.lock);
+	spin_unlock(&dev->qp_table.lock);
+
+	if (send_cq != recv_cq)
+		spin_unlock(&recv_cq->lock);
+	spin_unlock_irq(&send_cq->lock);
 
  err_out:
 	dma_free_coherent(&dev->pdev->dev, sqp->header_buf_size,
@@ -1100,11 +1265,28 @@
 	u8 status;
 	int size;
 	int i;
+	struct mthca_cq *send_cq;
+	struct mthca_cq *recv_cq;
 
-	spin_lock_irq(&dev->qp_table.lock);
+	send_cq = to_mcq(qp->ibqp.send_cq);
+	recv_cq = to_mcq(qp->ibqp.recv_cq);
+
+	/*
+	 * Lock CQs here, so that CQ polling code can do QP lookup
+	 * without taking a lock.
+	 */
+	spin_lock_irq(&send_cq->lock);
+	if (send_cq != recv_cq)
+		spin_lock(&recv_cq->lock);
+
+	spin_lock(&dev->qp_table.lock);
 	mthca_array_clear(&dev->qp_table.qp,
 			  qp->qpn & (dev->limits.num_qps - 1));
-	spin_unlock_irq(&dev->qp_table.lock);
+	spin_unlock(&dev->qp_table.lock);
+
+	if (send_cq != recv_cq)
+		spin_unlock(&recv_cq->lock);
+	spin_unlock_irq(&send_cq->lock);
 
 	atomic_dec(&qp->refcount);
 	wait_event(qp->wait, !atomic_read(&qp->refcount));
@@ -1136,14 +1318,15 @@
 
 	kfree(qp->wrid);
 
+	mthca_free_memfree(dev, qp);
+
 	if (is_sqp(dev, qp)) {
 		atomic_dec(&(to_mpd(qp->ibqp.pd)->sqp_count));
 		dma_free_coherent(&dev->pdev->dev,
 				  to_msqp(qp)->header_buf_size,
 				  to_msqp(qp)->header_buf,
 				  to_msqp(qp)->header_dma);
-	}
-	else
+	} else
 		mthca_free(&dev->qp_table.alloc, qp->qpn);
 }
 
@@ -1216,8 +1399,26 @@
 	return 0;
 }
 
-int mthca_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
-		    struct ib_send_wr **bad_wr)
+static inline int mthca_wq_overflow(struct mthca_wq *wq, int nreq,
+				    struct ib_cq *ib_cq)
+{
+	unsigned cur;
+	struct mthca_cq *cq;
+
+	cur = wq->head - wq->tail;
+	if (likely(cur + nreq < wq->max))
+		return 0;
+
+	cq = to_mcq(ib_cq);
+	spin_lock(&cq->lock);
+	cur = wq->head - wq->tail;
+	spin_unlock(&cq->lock);
+
+	return cur + nreq >= wq->max;
+}
+
+int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
+			  struct ib_send_wr **bad_wr)
 {
 	struct mthca_dev *dev = to_mdev(ibqp->device);
 	struct mthca_qp *qp = to_mqp(ibqp);
@@ -1233,26 +1434,18 @@
 	int ind;
 	u8 op0 = 0;
 
-	static const u8 opcode[] = {
-		[IB_WR_SEND]                 = MTHCA_OPCODE_SEND,
-		[IB_WR_SEND_WITH_IMM]        = MTHCA_OPCODE_SEND_IMM,
-		[IB_WR_RDMA_WRITE]           = MTHCA_OPCODE_RDMA_WRITE,
-		[IB_WR_RDMA_WRITE_WITH_IMM]  = MTHCA_OPCODE_RDMA_WRITE_IMM,
-		[IB_WR_RDMA_READ]            = MTHCA_OPCODE_RDMA_READ,
-		[IB_WR_ATOMIC_CMP_AND_SWP]   = MTHCA_OPCODE_ATOMIC_CS,
-		[IB_WR_ATOMIC_FETCH_AND_ADD] = MTHCA_OPCODE_ATOMIC_FA,
-	};
-
-	spin_lock_irqsave(&qp->lock, flags);
+	spin_lock_irqsave(&qp->sq.lock, flags);
 
 	/* XXX check that state is OK to post send */
 
-	ind = qp->sq.next;
+	ind = qp->sq.next_ind;
 
 	for (nreq = 0; wr; ++nreq, wr = wr->next) {
-		if (qp->sq.cur + nreq >= qp->sq.max) {
-			mthca_err(dev, "SQ full (%d posted, %d max, %d nreq)\n",
-				  qp->sq.cur, qp->sq.max, nreq);
+		if (mthca_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) {
+			mthca_err(dev, "SQ %06x full (%u head, %u tail,"
+					" %d max, %d nreq)\n", qp->qpn,
+					qp->sq.head, qp->sq.tail,
+					qp->sq.max, nreq);
 			err = -ENOMEM;
 			*bad_wr = wr;
 			goto out;
@@ -1326,17 +1519,17 @@
 			break;
 
 		case UD:
-			((struct mthca_ud_seg *) wqe)->lkey =
+			((struct mthca_tavor_ud_seg *) wqe)->lkey =
 				cpu_to_be32(to_mah(wr->wr.ud.ah)->key);
-			((struct mthca_ud_seg *) wqe)->av_addr =
+			((struct mthca_tavor_ud_seg *) wqe)->av_addr =
 				cpu_to_be64(to_mah(wr->wr.ud.ah)->avdma);
-			((struct mthca_ud_seg *) wqe)->dqpn =
+			((struct mthca_tavor_ud_seg *) wqe)->dqpn =
 				cpu_to_be32(wr->wr.ud.remote_qpn);
-			((struct mthca_ud_seg *) wqe)->qkey =
+			((struct mthca_tavor_ud_seg *) wqe)->qkey =
 				cpu_to_be32(wr->wr.ud.remote_qkey);
 
-			wqe += sizeof (struct mthca_ud_seg);
-			size += sizeof (struct mthca_ud_seg) / 16;
+			wqe += sizeof (struct mthca_tavor_ud_seg);
+			size += sizeof (struct mthca_tavor_ud_seg) / 16;
 			break;
 
 		case MLX:
@@ -1381,7 +1574,7 @@
 
 		qp->wrid[ind + qp->rq.max] = wr->wr_id;
 
-		if (wr->opcode >= ARRAY_SIZE(opcode)) {
+		if (wr->opcode >= ARRAY_SIZE(mthca_opcode)) {
 			mthca_err(dev, "opcode invalid\n");
 			err = -EINVAL;
 			*bad_wr = wr;
@@ -1392,15 +1585,15 @@
 			((struct mthca_next_seg *) prev_wqe)->nda_op =
 				cpu_to_be32(((ind << qp->sq.wqe_shift) +
 					     qp->send_wqe_offset) |
-					    opcode[wr->opcode]);
-			smp_wmb();
+					    mthca_opcode[wr->opcode]);
+			wmb();
 			((struct mthca_next_seg *) prev_wqe)->ee_nds =
 				cpu_to_be32((size0 ? 0 : MTHCA_NEXT_DBD) | size);
 		}
 
 		if (!size0) {
 			size0 = size;
-			op0   = opcode[wr->opcode];
+			op0   = mthca_opcode[wr->opcode];
 		}
 
 		++ind;
@@ -1409,10 +1602,10 @@
 	}
 
 out:
-	if (nreq) {
+	if (likely(nreq)) {
 		u32 doorbell[2];
 
-		doorbell[0] = cpu_to_be32(((qp->sq.next << qp->sq.wqe_shift) +
+		doorbell[0] = cpu_to_be32(((qp->sq.next_ind << qp->sq.wqe_shift) +
 					   qp->send_wqe_offset) | f0 | op0);
 		doorbell[1] = cpu_to_be32((qp->qpn << 8) | size0);
 
@@ -1423,15 +1616,15 @@
 			      MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
 	}
 
-	qp->sq.cur += nreq;
-	qp->sq.next = ind;
+	qp->sq.next_ind = ind;
+	qp->sq.head    += nreq;
 
-	spin_unlock_irqrestore(&qp->lock, flags);
+	spin_unlock_irqrestore(&qp->sq.lock, flags);
 	return err;
 }
 
-int mthca_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
-		       struct ib_recv_wr **bad_wr)
+int mthca_tavor_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
+			     struct ib_recv_wr **bad_wr)
 {
 	struct mthca_dev *dev = to_mdev(ibqp->device);
 	struct mthca_qp *qp = to_mqp(ibqp);
@@ -1445,15 +1638,18 @@
 	void *wqe;
 	void *prev_wqe;
 
-	spin_lock_irqsave(&qp->lock, flags);
+	spin_lock_irqsave(&qp->rq.lock, flags);
 
 	/* XXX check that state is OK to post receive */
 
-	ind = qp->rq.next;
+	ind = qp->rq.next_ind;
 
 	for (nreq = 0; wr; ++nreq, wr = wr->next) {
-		if (qp->rq.cur + nreq >= qp->rq.max) {
-			mthca_err(dev, "RQ %06x full\n", qp->qpn);
+		if (mthca_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) {
+			mthca_err(dev, "RQ %06x full (%u head, %u tail,"
+					" %d max, %d nreq)\n", qp->qpn,
+					qp->rq.head, qp->rq.tail,
+					qp->rq.max, nreq);
 			err = -ENOMEM;
 			*bad_wr = wr;
 			goto out;
@@ -1466,14 +1662,12 @@
 		((struct mthca_next_seg *) wqe)->nda_op = 0;
 		((struct mthca_next_seg *) wqe)->ee_nds =
 			cpu_to_be32(MTHCA_NEXT_DBD);
-		((struct mthca_next_seg *) wqe)->flags =
-			(wr->recv_flags & IB_RECV_SIGNALED) ?
-			cpu_to_be32(MTHCA_NEXT_CQ_UPDATE) : 0;
+		((struct mthca_next_seg *) wqe)->flags = 0;
 
 		wqe += sizeof (struct mthca_next_seg);
 		size = sizeof (struct mthca_next_seg) / 16;
 
-		if (wr->num_sge > qp->rq.max_gs) {
+		if (unlikely(wr->num_sge > qp->rq.max_gs)) {
 			err = -EINVAL;
 			*bad_wr = wr;
 			goto out;
@@ -1492,10 +1686,10 @@
 
 		qp->wrid[ind] = wr->wr_id;
 
-		if (prev_wqe) {
+		if (likely(prev_wqe)) {
 			((struct mthca_next_seg *) prev_wqe)->nda_op =
 				cpu_to_be32((ind << qp->rq.wqe_shift) | 1);
-			smp_wmb();
+			wmb();
 			((struct mthca_next_seg *) prev_wqe)->ee_nds =
 				cpu_to_be32(MTHCA_NEXT_DBD | size);
 		}
@@ -1509,10 +1703,10 @@
 	}
 
 out:
-	if (nreq) {
+	if (likely(nreq)) {
 		u32 doorbell[2];
 
-		doorbell[0] = cpu_to_be32((qp->rq.next << qp->rq.wqe_shift) | size0);
+		doorbell[0] = cpu_to_be32((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
 		doorbell[1] = cpu_to_be32((qp->qpn << 8) | nreq);
 
 		wmb();
@@ -1522,14 +1716,258 @@
 			      MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
 	}
 
-	qp->rq.cur += nreq;
-	qp->rq.next = ind;
+	qp->rq.next_ind = ind;
+	qp->rq.head    += nreq;
+
+	spin_unlock_irqrestore(&qp->rq.lock, flags);
+	return err;
+}
+
+int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
+			  struct ib_send_wr **bad_wr)
+{
+	struct mthca_dev *dev = to_mdev(ibqp->device);
+	struct mthca_qp *qp = to_mqp(ibqp);
+	void *wqe;
+	void *prev_wqe;
+	unsigned long flags;
+	int err = 0;
+	int nreq;
+	int i;
+	int size;
+	int size0 = 0;
+	u32 f0 = 0;
+	int ind;
+	u8 op0 = 0;
+
+	spin_lock_irqsave(&qp->sq.lock, flags);
+
+	/* XXX check that state is OK to post send */
+
+	ind = qp->sq.head & (qp->sq.max - 1);
+
+	for (nreq = 0; wr; ++nreq, wr = wr->next) {
+		if (mthca_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)) {
+			mthca_err(dev, "SQ %06x full (%u head, %u tail,"
+					" %d max, %d nreq)\n", qp->qpn,
+					qp->sq.head, qp->sq.tail,
+					qp->sq.max, nreq);
+			err = -ENOMEM;
+			*bad_wr = wr;
+			goto out;
+		}
+
+		wqe = get_send_wqe(qp, ind);
+		prev_wqe = qp->sq.last;
+		qp->sq.last = wqe;
+
+		((struct mthca_next_seg *) wqe)->flags =
+			((wr->send_flags & IB_SEND_SIGNALED) ?
+			 cpu_to_be32(MTHCA_NEXT_CQ_UPDATE) : 0) |
+			((wr->send_flags & IB_SEND_SOLICITED) ?
+			 cpu_to_be32(MTHCA_NEXT_SOLICIT) : 0)   |
+			cpu_to_be32(1);
+		if (wr->opcode == IB_WR_SEND_WITH_IMM ||
+		    wr->opcode == IB_WR_RDMA_WRITE_WITH_IMM)
+			((struct mthca_next_seg *) wqe)->flags = wr->imm_data;
+
+		wqe += sizeof (struct mthca_next_seg);
+		size = sizeof (struct mthca_next_seg) / 16;
+
+		switch (qp->transport) {
+		case UD:
+			memcpy(((struct mthca_arbel_ud_seg *) wqe)->av,
+			       to_mah(wr->wr.ud.ah)->av, MTHCA_AV_SIZE);
+			((struct mthca_arbel_ud_seg *) wqe)->dqpn =
+				cpu_to_be32(wr->wr.ud.remote_qpn);
+			((struct mthca_arbel_ud_seg *) wqe)->qkey =
+				cpu_to_be32(wr->wr.ud.remote_qkey);
+
+			wqe += sizeof (struct mthca_arbel_ud_seg);
+			size += sizeof (struct mthca_arbel_ud_seg) / 16;
+			break;
+
+		case MLX:
+			err = build_mlx_header(dev, to_msqp(qp), ind, wr,
+					       wqe - sizeof (struct mthca_next_seg),
+					       wqe);
+			if (err) {
+				*bad_wr = wr;
+				goto out;
+			}
+			wqe += sizeof (struct mthca_data_seg);
+			size += sizeof (struct mthca_data_seg) / 16;
+			break;
+		}
+
+		if (wr->num_sge > qp->sq.max_gs) {
+			mthca_err(dev, "too many gathers\n");
+			err = -EINVAL;
+			*bad_wr = wr;
+			goto out;
+		}
+
+		for (i = 0; i < wr->num_sge; ++i) {
+			((struct mthca_data_seg *) wqe)->byte_count =
+				cpu_to_be32(wr->sg_list[i].length);
+			((struct mthca_data_seg *) wqe)->lkey =
+				cpu_to_be32(wr->sg_list[i].lkey);
+			((struct mthca_data_seg *) wqe)->addr =
+				cpu_to_be64(wr->sg_list[i].addr);
+			wqe += sizeof (struct mthca_data_seg);
+			size += sizeof (struct mthca_data_seg) / 16;
+		}
+
+		/* Add one more inline data segment for ICRC */
+		if (qp->transport == MLX) {
+			((struct mthca_data_seg *) wqe)->byte_count =
+				cpu_to_be32((1 << 31) | 4);
+			((u32 *) wqe)[1] = 0;
+			wqe += sizeof (struct mthca_data_seg);
+			size += sizeof (struct mthca_data_seg) / 16;
+		}
+
+		qp->wrid[ind + qp->rq.max] = wr->wr_id;
+
+		if (wr->opcode >= ARRAY_SIZE(mthca_opcode)) {
+			mthca_err(dev, "opcode invalid\n");
+			err = -EINVAL;
+			*bad_wr = wr;
+			goto out;
+		}
+
+		if (likely(prev_wqe)) {
+			((struct mthca_next_seg *) prev_wqe)->nda_op =
+				cpu_to_be32(((ind << qp->sq.wqe_shift) +
+					     qp->send_wqe_offset) |
+					    mthca_opcode[wr->opcode]);
+			wmb();
+			((struct mthca_next_seg *) prev_wqe)->ee_nds =
+				cpu_to_be32(MTHCA_NEXT_DBD | size);
+		}
+
+		if (!size0) {
+			size0 = size;
+			op0   = mthca_opcode[wr->opcode];
+		}
+
+		++ind;
+		if (unlikely(ind >= qp->sq.max))
+			ind -= qp->sq.max;
+	}
+
+out:
+	if (likely(nreq)) {
+		u32 doorbell[2];
+
+		doorbell[0] = cpu_to_be32((nreq << 24)                  |
+					  ((qp->sq.head & 0xffff) << 8) |
+					  f0 | op0);
+		doorbell[1] = cpu_to_be32((qp->qpn << 8) | size0);
+
+		qp->sq.head += nreq;
+
+		/*
+		 * Make sure that descriptors are written before
+		 * doorbell record.
+		 */
+		wmb();
+		*qp->sq.db = cpu_to_be32(qp->sq.head & 0xffff);
+
+		/*
+		 * Make sure doorbell record is written before we
+		 * write MMIO send doorbell.
+		 */
+		wmb();
+		mthca_write64(doorbell,
+			      dev->kar + MTHCA_SEND_DOORBELL,
+			      MTHCA_GET_DOORBELL_LOCK(&dev->doorbell_lock));
+	}
+
+	spin_unlock_irqrestore(&qp->sq.lock, flags);
+	return err;
+}
+
+int mthca_arbel_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
+			     struct ib_recv_wr **bad_wr)
+{
+	struct mthca_dev *dev = to_mdev(ibqp->device);
+	struct mthca_qp *qp = to_mqp(ibqp);
+	unsigned long flags;
+	int err = 0;
+	int nreq;
+	int ind;
+	int i;
+	void *wqe;
+
+ 	spin_lock_irqsave(&qp->rq.lock, flags);
+
+	/* XXX check that state is OK to post receive */
+
+	ind = qp->rq.head & (qp->rq.max - 1);
 
-	spin_unlock_irqrestore(&qp->lock, flags);
+	for (nreq = 0; wr; ++nreq, wr = wr->next) {
+		if (mthca_wq_overflow(&qp->rq, nreq, qp->ibqp.recv_cq)) {
+			mthca_err(dev, "RQ %06x full (%u head, %u tail,"
+					" %d max, %d nreq)\n", qp->qpn,
+					qp->rq.head, qp->rq.tail,
+					qp->rq.max, nreq);
+			err = -ENOMEM;
+			*bad_wr = wr;
+			goto out;
+		}
+
+		wqe = get_recv_wqe(qp, ind);
+
+		((struct mthca_next_seg *) wqe)->flags = 0;
+
+		wqe += sizeof (struct mthca_next_seg);
+
+		if (unlikely(wr->num_sge > qp->rq.max_gs)) {
+			err = -EINVAL;
+			*bad_wr = wr;
+			goto out;
+		}
+
+		for (i = 0; i < wr->num_sge; ++i) {
+			((struct mthca_data_seg *) wqe)->byte_count =
+				cpu_to_be32(wr->sg_list[i].length);
+			((struct mthca_data_seg *) wqe)->lkey =
+				cpu_to_be32(wr->sg_list[i].lkey);
+			((struct mthca_data_seg *) wqe)->addr =
+				cpu_to_be64(wr->sg_list[i].addr);
+			wqe += sizeof (struct mthca_data_seg);
+		}
+
+		if (i < qp->rq.max_gs) {
+			((struct mthca_data_seg *) wqe)->byte_count = 0;
+			((struct mthca_data_seg *) wqe)->lkey = cpu_to_be32(0x100);
+			((struct mthca_data_seg *) wqe)->addr = 0;
+		}
+
+		qp->wrid[ind] = wr->wr_id;
+
+		++ind;
+		if (unlikely(ind >= qp->rq.max))
+			ind -= qp->rq.max;
+	}
+out:
+	if (likely(nreq)) {
+		qp->rq.head += nreq;
+
+		/*
+		 * Make sure that descriptors are written before
+		 * doorbell record.
+		 */
+		wmb();
+		*qp->rq.db = cpu_to_be32(qp->rq.head & 0xffff);
+	}
+
+	spin_unlock_irqrestore(&qp->rq.lock, flags);
 	return err;
 }
 
-int mthca_free_err_wqe(struct mthca_qp *qp, int is_send,
+int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
 		       int index, int *dbd, u32 *new_wqe)
 {
 	struct mthca_next_seg *next;
@@ -1539,7 +1977,10 @@
 	else
 		next = get_recv_wqe(qp, index);
 
-	*dbd = !!(next->ee_nds & cpu_to_be32(MTHCA_NEXT_DBD));
+	if (dev->hca_type == ARBEL_NATIVE)
+		*dbd = 1;
+	else
+		*dbd = !!(next->ee_nds & cpu_to_be32(MTHCA_NEXT_DBD));
 	if (next->ee_nds & cpu_to_be32(0x3f))
 		*new_wqe = (next->nda_op & cpu_to_be32(~0x3f)) |
 			(next->ee_nds & cpu_to_be32(0x3f));
diff -Nru a/drivers/infiniband/hw/mthca/mthca_reset.c b/drivers/infiniband/hw/mthca/mthca_reset.c
--- a/drivers/infiniband/hw/mthca/mthca_reset.c	2004-12-27 22:14:13 -08:00
+++ b/drivers/infiniband/hw/mthca/mthca_reset.c	2005-03-04 22:32:51 -08:00
@@ -50,7 +50,7 @@
 	struct pci_dev *bridge = NULL;
 
 #define MTHCA_RESET_OFFSET 0xf0010
-#define MTHCA_RESET_VALUE  cpu_to_be32(1)
+#define MTHCA_RESET_VALUE  swab32(1)
 
 	/*
 	 * Reset the chip.  This is somewhat ugly because we have to
diff -Nru a/drivers/infiniband/hw/mthca/mthca_uar.c b/drivers/infiniband/hw/mthca/mthca_uar.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/infiniband/hw/mthca/mthca_uar.c	2005-03-04 22:32:54 -08:00
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2005 Topspin Communications.  All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses.  You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * $Id$
+ */
+
+#include "mthca_dev.h"
+#include "mthca_memfree.h"
+
+int mthca_uar_alloc(struct mthca_dev *dev, struct mthca_uar *uar)
+{
+	uar->index = mthca_alloc(&dev->uar_table.alloc);
+	if (uar->index == -1)
+		return -ENOMEM;
+
+	uar->pfn = (pci_resource_start(dev->pdev, 2) >> PAGE_SHIFT) + uar->index;
+
+	return 0;
+}
+
+void mthca_uar_free(struct mthca_dev *dev, struct mthca_uar *uar)
+{
+	mthca_free(&dev->uar_table.alloc, uar->index);
+}
+
+int mthca_init_uar_table(struct mthca_dev *dev)
+{
+	int ret;
+
+	ret = mthca_alloc_init(&dev->uar_table.alloc,
+			       y;
+	struct mthca_av   *av;
LIMITEeN mthca_av   27zeof  mthca_av 94 {
-		if (qp->sq.cur + nreq >=yeof  Y, WHETHER IN AN
+ * ACTIOopcode invalid\n");
 			err = -EINVAL;
 			*bad_wr =Iu)->qkey =
 				cpu_to_be3ca_y =
 		stru                cons_index;
 	u16                    msi_xr = wr;
+			goto out;
+		}_valid\n");
 2u16                    msi_xr = wr;
+			go	prev_wqe = qp->sq.las wr;
 		 v;
LI +	ren");
 ruct mt+		qp_contUn= wq->max;
+}
+
+int mthca_tavor_postHE A_data_g) / 16;
+			>qp_table. * BEn);
 	if (attr_mask & IB_QP_DEST_QPN) {
 		qp_context->remote_qpn = cpu_to_be3255d mthca_uar_free(struct mthca_dev *dev, struct mthca_uar *uar)
+{
+	mthca_free(&dev->uar_table.alloc, uar->index);
+}
_tabl{
+	int.ud.remott mthca_UPsip. 9++nreq, wr = wr->neRq >=neRq u tail,"
+					" %d max, %d nreq)\n", qp->qpn,
+					qp->r+		>qpn,
+		int              on_hca;
-	u32              key;
-	struct mthca_av *av;
-	dma_addr_t       avdma;
+	struct ib_ah       ibah;
+	enum mthca_ah_type type;
+	u32                key;
+	struct mthca_av   *av;
+	dma_addr_t         avdma;
 };
 
 /*
@@ -136,8 +147,16ta_av *av;
-	dma_addr_t B%36;
u>nda_op );
@@ -708+stru%d nreq)eq)eq)eq)eq)eq)eq)eq)eq)eq)eu code mus6,8 r)(eq)  avdma;
 };
	goto WHETHER IN AN
+ * ACTIOopcode inva  key;
+Vsport = UC; break;dy2 wr->neRq >=neRq u tail,"
+					" %d max, %d nreq).addr);
+	ax, %d nreq).amthca_ -708+s+	stsq.max_gs * sizeof (s= zeof (s=_gs * qp->->send_flhca_f, op0 =tE IS Pep ).addr);
+	ax, 18 PURPOSE A (s=ax, 1y2 wspin_unlock_irqrestore(&qp->rq.lock, flags);
+	ree_nds =
 			cpu_to_be32(MTHCA_NEXT_DBD);
-		((struct mthca_next_	ree_nds =
 			cpu_to_be32(MTHCwqe)->flags = wr- >=yeof  Y, Wr);
+	 = wK  i2+atom void mthca_wqv->qp_table.rdb_base +
-		((qp->qp(q, qp-ARRAY_SIZE(mth_, op0 =tE IS IN AN
+ * ACTIOopcode inva  key;
+Vsport = UC; break;dy2 wr->neRq >=n>flags = wr- >=yeof  Y, Wr);
+	 = wK  i2+atom void mthca_wqv->qp_table.rdb_base +
-		((qp->qp(q, tom ->qp(q, tom ->qp(q, tom ->qp(q, tom ->qp(q,		((qp ;
+	ree_nds =
Gt/ "thca_opcode[wr->x] = 25	*bad =
 				cpu,
-	(NTneRq _to_be32(MTHCd mthc+atom(
+	/*j_e +
*lstore(&qp->rq.y2 wr->neRq >=n>flags = wr- >=yeof  Y, Wr);
+	 = wK  i2+atom void mthca_wqv->qp_tabt ib_ah  -t mthca_data void mthca_wqv->q_RDMlags)ree(&(struct mthca_nextS IN AN
+ )to_be32(MTHCA_NQ
+					" %d max, %d nreq)\n", qp->qpn,
+		Mc_=T+atom void mthca_w mthca_5hca_5hca_5hca_5hca_5hca_5hca_5hca_5hc=7 mthrCd mthc+q.lo       cons_index;
 	u16                    msi_xr = wr;
+			go+	 = cbreak;fine M*1y,
-	(NT0b_ah       ibah;
+	enum mthca_ah_type type;
+	u32                key;
+	struct m= as 0 */
+
+d7 +50,7 @@
 	struct pci_dev *bristruPhbristruPhbri&nreq)\n"0q)\n"0qe0,7 @      key;
+	struct >=yuPh= cbreak +50,7 @@
 	struct pci_dev *bristruPhbristr 				c_.aaLIMIT = 1;
+	else
+		*_ey;
+	struct >=yuPh= cbreak +50,7 @@
 	struct /* bind seg is istruPhbristr 				7HCA_GET_DOO_wqeg is			c_.aaLIMI +50,7 @@
 	struct pcee to ypcee t4_GET_(&qp->re"4_GET_(&qo       cons_ cee to ypc]1) << 3) | (qp->sq.wqe_shif)Q7 
+sta->doorbell_lock))ev *bristruPhbristruPNULL;
 
 #defi0
+	else
+@    o -1509,10 +4aaLIMEyjisl,"
+					" %d max, %d nreq)\n", qp->qpn,
+					qp->sq.head, qp->sq.tail,
+					qp->sq.max, nreq);
+			err =ext = get_recv_wqa_5h2 pci_dev *bristruPhbristruPhbri&nreq)\n"0q)\n"0qe0,7 @      keyp->sq.tail,
+					qp->sq.max, nreq);
+			er>0Ahbri&nreq)\n"0q)\n"O
+			e+1R+		if (i < qp->2 =ext  nreq >=yeof  Y >=yeof  Y ee_nds =
 				cpu_to_be32((size0 ? 0 : uct ib_send_wr **truPhbri9y (unlikes 0 */
+
 	if (qp->tCflags);
+	ree_nds =
->edsq.max, nreck, flags);
+	ree_nds =
+	uN) T maxto y0r **truPhbri9y (unlikes 0 */
+
 	if (qp->tCflags);
+	ree   ic >=yeof  Y, Wr);
+	 = RTtruPhbri9
 	 mthca_data */Mlags)ree(&(strA _alloc(struct mthca_dev *de)
+{
+	mthca_free(&dev->u->sq.tail,
+					qp->s_ -708+;s%AN
+ * ACTI ib_send_wr_typp&qc- 1;lloa_free(&(IES OF
+ * MERCHANTAB(*de)
+{
+	0+	u32             (retemcpy(((struct xa9lags = wr-2(qpacpu_to_,%AN
+ * ACTI ib_send_wr_typp&qc- 1;lloa_free(Q2AS ny2-d_wr_tp				" %d max, %d nreq)\n", qp->qpn,
+					qp->sq.head, qp->sq.tail,
+					qp->sq.max, nreq);
+			err =ext = get_recv_wqa_5h2 pci_dev *bristruPhbristruPhbri&nreq)\n"0q)\n"0qe0,7 @      keyp->sq.tail,
+					qp->sq.max, nreq);
+			er>0Ahbri&nreq)\n"0q)\n"O
+			d_wr_typp&qc- 1;lloa_free(&(IES OF
+ * MEa_w m ruPhb4
+		(ntation an7HCA_GET_DOO_wqeg is			cn" ax, nreq);
+			err =ex*de)
+{>sq.head, qp-tq.head += nreq3to_mdev(ibqp->device);
+	structo_mdev(ibqp->device);
+	structv(ibq,
+					RIn7HCA_GET_DOO_wqeg is			cn" au+	spin_unlock_irqrestore(&qp->rq.lock,d = inqp->sq.t(ev->pdev->dev, sqp->header_b lags);
+	re is			l,
+			oepdev->dev, sqp->header_b lags);
+	rruPhb4
+		Srq.max, nreq);
+			errp->header_b lags);
+	rruPhb4
+de)
+rq.Ep0dev, 		qp->sq.max, nreq);
+			er>0Ahbri&nre		qp->sq.max, nreq);
+	6_,%AN
+ * ACTI i4eader_dhbri&nreq)\n"0q)\n"0qe0,7 @      keyp->sq.0y>qpn,
+					qpgs)/ au+	sd u3RCTI i43Beeeeemthcarivers/u0ex*de)
+{T 
 #define MTTI i4DOO_wqeg e8E>u->sq5hca_5hca_5hcaatij_e +
a n +
a n +r hbri&nreq)\n"0q)\n"0qe0,7 @      keyp->sq.0y>qpn,
+					qpgs)/ au+	sd u3RCTI i43Beeeeemthcarivers/u0ex*de)
+{T 
 #define MTTI i4DOO_wqeg e8E>u->sq5hca_5hca_5hev, st0ex*			ah(wr->wr.ud.);
+	s);
+	rru_p->sqs)ree(&(strA _alloc(struct mthca_dev *de)
+{
+	mthca_free(&dest[iqp->sq>dev, sq>=yuPh	t  Y e(&dev->u->sq.tail,
+					qp->m write [29] rem read */
 	u3MIC_CMP_u->sq5hca_5flags & IB_SEND_SO 
 #def29] re06x full (%u headOIefine MTHCA_RESET_VALUE  cpu_to_b(+	/*qpn,
+ev_wqe = qp->sq. ind, wr,
+					       wqstruct 	" %d max, %get_rermIq. ind, wr,
+					    >sqs)rswitch -_*2AS ny2-d_);
+	 = wK  i2+atom void mthca_wqv->qp_tab	qp_context->sq_size_u3MIC_C=yuPh	t  Y e(&dev->u->sq.tail,
+					qp->m write [29] rem read */
 	u3MIC_CMP_u->sq5hca_5flags & IB_SEND_SM_Hread */
 Otail,
+					qp->s_ 	qp->s_7 @      keyp	rruPhb4
+		Srq.max, and/or other materials
/ 16;
+
+		switch vided wp->su+		swi ar *uauK  i2+a_uar.c	ral Public &
@@ -860,12 +905,20 @@
 
 	size = sizeof (struct mthca_next_seg) +
 		qp->sq.max_gs * sizeof (struct mthca_data_seg);
-	if (qp->transport == MLX)
+	switch (qp->transport) {
+	case MLX:
 		size += 2 * sizeof (struct mthca_data_seg);
-	else if (qp->transport =(stc- 1;lloa_free(&(IE_o+	}
	*bP=
+				cpu_to_be32(((ind << qp-@      keyp->sq.0y>qpn,
_dat e data segment for ICRC */
+		@@
 
 aYTHCA 			" %d max, %d nreq3,RDMA_WRITE_qp->qkeyp->sq.0y>qpn,
+					qpgs)/ au+	sd u3RCTI i43Beeeeemthcarivers/u0ex*de)
+{T 
 #define MTTI te [29] rem read */
 	;
-	elsE30/
 Otcgs T
+		Mc_=T+atom	uarmsi_xr =s=_gs * q>qpts * q>qpts *0y>qp3y2-d"read */
 	;
-	elsE30/
 Otcgs T
+	 invalid\n");
 			err = -EINVALhc=7 mtqpts CB16;
 
-		if (rq.loOtcgs T
+		Mc_=T+atom	uar4);icy, ize += 2 *ds =
   ic >=ye;
-	elsE30/
 OtCrp->headn,
+		/* bi=0
+	6l
 	sqs) max, %3 
-	mthca/mthca_reset.cxsq.lock,sl,"
+					" %d max, %d nreq)\n", qp->qpnl
 	sdev *dev,
 			data_seg);
+			size truPhbristruPNULL;
 
 I8ST_QPN) {
 		qp_context->reinvalid IB_SEc_SEc_SEc_SEc_msi_xr = wr;
RE.
+ *
+ * $Id$
a>qp_tab	qp_context->sq_size_u3MIC_C=yuPh	t  Y e( max, %3 
-	mthcANTI4_gs * q>qp|136,) {
+ dev->u->sq.mthc1_size_u3MIC_C=yuPh	t  Y e( max, %3 
-	mthcANTI4_g_nextnd/id\n");
 			err = -EINVALhc=7 mbq,
+						wqe += +NVALhc=7 mbq,
+						tail,"
+					" %d max, 2_SEc_T+atom	u8_sient fermsiariveryuPh	t  Y  s & IB_SEND_SOLICITEI6maEbze;
+	int size0 = 0;dx, nreq);
+			err = -ENOMEM;
+			*bad_wr = wr;
+			goto out;
+		} mtqpts CB16;
RCITED) ?
+			 cpuy!;
 			e_SEt  Y  n +
a n +r hbri&nreq)\n"0q)\n"0qe0,7 @      keyp->sq  Y  suqp|136,) {
+ dev->u->sq.mthc1fTE_Wh4sq  Y  suqp|136,) {
+ dev->u->sq.mthc1fTE_Wh4c1fTE_Wh4c1fTE_Whehca_vikely(prev_wqe)) {
+			((struct mthca_next_seg *) preP
+	ree_nds =
+	uN) T maxto y0r **truPhbri9y (unlikes 0 */kes 0 f**truPhbri9y (unlikes +	if ->wr.ud.)i].lkey);
+			((struct mthca_data_seg *) wqe)->addr =
+				cpuR
a n +r aeI i4DOO_Or = wr;
 			gotu32 1ue0,7(NT0b_ah     n +r aeI 	qp_contextT 
 #dkQ nnda_op );
@@ -708+stru%d nreq)eq)eq)eq)eq)eq)eq)eq)eq)eq)eu codust ree d4Ro+atom	.max_gs * sizeof (struct mca_bodust ree d4Ro+atom	.max_gs * sizeof (struct mca_bodust ree d4Ro+atom	.max_gs * sizeof (struct mca_bodI a/mthg) /_bodI e	.max_gs * sizeof (struct mca_bodust ree d4Ro+atom	.max_gs *Id$
a>qp_tab	qp_context->sq_size_O0sgearansport) {
+	casOr = _uar_free(struct mthchca_r)eI 	)uT
+	 invalct
+	struct >=yuPh= cbreak +50,7 @@
 			*bad_wr = wr;_gs * sizeof (s= ze7:
+	if +atom(Id$
a>qp_tab	qp_context->sqizeof (s= ze7:
+	if +atom(Id$
a> 2 *ds =
  e following
+ *        disclaimer.
+2h2 pWeb +158+158+158+158+17 @   case MLX1Mon, are permitted provided that the following
+ *     conditions are Rxt) {
re Rxt) {
re Rxt) {
re Rxt) {
re Rh17 @   case MLX1+		Mc_=T+atab	qLIABLE FOR ANY Cyd_x, %d nreq).am+	stsq				" Fid7uglabove
+eri9
 	 mthAY_SIZE(mt7(ovided that the following
+ *     conditions are Rxt) {
rqvikelqp->header_b lags);
+	rruPhb4
+	atab	qLIA>header_b}0 */k suqp|F,12 +905,20 @@
 
 	size d	qLIA>header_b}0 */k suqp|F,12 +905,20 @@
 h/k suqc
---ize_uct mthca_uar *uar)
+{
+	uar->ind%1/k s2uct mthchca_r)eI 	)uT
+	 invalct
 05,20 	;r ak +50,7 @@
 t @@
2);
+		 3c
---ize_uct mthca_uar *uar)
+{
+	+r au	 3c
ca_bodust CA_NEQad, %u tafwnlikes "O
+			d_id mthca-	;r ak +SS OR+SS_uct;r ak +SS 
+		((struc+SS_u t;r ak ;r amth.dlidmt+		qp_/mthg) /_ 
+		((strucid mthca_	kQ n aeI >rq.h=ext =   n +r aeI 	c >=ye;
A_NEt CA7>qp3y2-d";r ak ;r amth.pxr =((struc =tE IS I16 	sdev pmthca_qp;r ak ;r amth.=7 bri9y (=a_tavo- t @@
2)eg) *uar)
+{
+	+-p|136,) {

+{
the followi42e(&(+r =  */
+		wm->su+		s(un.wqea_ug IN ) _op k +stak +50,7 @@->ha +cq);
+r->send_nlikes "O 				cpu_55d mtht @@
2)eg) *uar)
+{
+	+ev->hca_ @@
 eg)_
+	u(& cbreakY Cyd_xeof (struct mca_ * door45NEt C465  */
+	pu_p =
+	struct >=yuPh=op k +stak +50,7 @@)r = wr;
RE.LX1Mon, ar cbreakY Cy7 @@
ze7:
+	if +atom( cbreak +50,7 @@o yos_tablee)->oruf_size,
 	ze7:
+	if +atomom(++	sdev ca_ns.tx_droppelags 		qp_context->reinvalid door49ust C511			((struc	kQ npush=op ,ey =
 		*phdr->opcode0,7(N aeI >
+	u(&  n +r aeI ,eyp );
@@-	/k suqc
--	mth&qc- 1;llor)
+{
+)nd_wqet @@
2);
+		 3c
---ize_uct k suqc
--	mth&qc- 1;llor)
+{
+)
+		*qp-q.max) {
-			}0 */k suq+		qp->s@@
2);
+		 3c
---ize_uct k          ad & e) {
 	caht @@
2)eg) *uar)
+{
+	+ev & e) {_wqe)->++	sdev ca_ns.tx_droppelags 	 		qp_context->reinvalid door6  c			67|
+					   ca_next_seg ruct >=yuPh_ablee)->or	ree_nds =50,7 @@hcas.num_q);
+			((struct mthca_datuf_+	struct >=yuPh= BUT NOT LIMI((struct mthca_dat; */kes 0 f**truPhbri9y (unlikes +	if ->wr.ud.nk +SS+	+evRCHANTABILITY, FITNESS kes 0 f**truP /_*ahrucid mthca_	/or other materib_ah "=yuPh_ablee)->orset.clude "ze truPGID_FMT ","
+	door66
+ *  68
+ 9 1 << i <Rxt) {
re Rxt) {
re Rh17 @   case MLX1$
a>a_datuf_+	struct >=yuPh= BUT = _uar_fre@@
 h/k suqr_free(stru-t mthchca_r)eI 	)uT
+	 inval 	caahruc)uT
+	 inags 	LX1Mon, ar cbreakY Cy7 @ct
+	struct >=yuPh= )r = wr;
RE. ze7:
+	if +atom(Id$
 >qp_tab	qp_context->sqizeof (s= ze7:
+	if +atoma_w m stru+ mthchca_r)eI 	at the folde can do QPruct >=yuPh_s   p	ree_nds =50,7 @@hcaif +a*
+ * $Id$
a>qp_tab	qp_context->sq_size_u3MIC_C=yulan ast	t  Y e( max, %3 
-	mthcANTI4_gs * q>qp|1ulan ast	t{
+ dev->u->sq.mthc1_size_u3MIC_C=yuPh	t  Yulan ast	tax, %3 
- * 14:01:50g_nextnd/id\n");
 			err = -EINVALhc=7 mbq,
+					ulan ast	tax, %3 Lhc=7 mbq,
+						tail,"
9IC_C+93  */
+		kes 0 f**truPhbri9y (unlikes +	if ->wr.ud.)i].lkey);
+			((struct mthca_data_semp	+evRCHANTABILITY, FITNESS 		" Fid7ugai9
 	 mthA kes 0 f**truP /_*aha_seinagsa_	/or other;
-	if 	if ->wr.ud.)i].+					"n, 05,TY,	ulan ast group "ze truPGID_FMT ","
+	door10post s03  */
+		kRxt) {
re Rxt) {
re Rh17 @   case MLX1$
q)eu codust ree d4Ro+atom	.max_gs *m/k s
-	if(struct mca_bodust ree- mthchca_r)eI 	)uT
+	 inval 	c suqr_free(stru 	ca @@
 eg)_
+	u(& cbreakaeakY Cyd_xai9
 	 mthct
+	struct >=yuPh= cbreak +50,7 @@
 			*bad_     break +50,7 @@o yos_tablee)->oruf_size,
E. ze7:
+	if +atodoor109lsE3012,9 1 << i <Rxt)	atab	qLIA>header_b}0 */k suqp|F,12 +905,+)eu codust ree d4Ro+atom	.aha_taha_xai9
 	     conditithchca_r)eI 	at thom(Id$
a
-	if(ss =
  e following
+ 
-	if(ss =c >=ye;
79			" 79us7 1 << i <Rxt)	atab	qLIA>header_b}0 */k suqp|F,12 +905,-SIZE(mt7(ovided that 
-	ifk suqp|F,12 +905,20 @@
 +)eu codust ree d4Ro+atom	.
-	ifk t
-	ifk suqp|F,12 +905,20 @@
   e follo
-	if_le) {
*uar)
-	if;
+r->sfollo
-	if_e7:
+
-	if;
+r-
+	if 90 (err)0= 0; wr; hb4
+	atab	qLIA>header_b}0 */k suqp|F,12 +905,20/* W  i2+atom *uar)
;
+}ree dreq)\n"hb4
 suqcasO-SIZE(mt7(ovided that 
-	ifk suqp|F,12 +905,20 @@
 +)eu codust ree d4Ro+atom	.
-	ifk t
-	ifk suqp|F,12 +905,20 @@
   e follo
-	if_le) {

-	if(s*uar)
-	if;
+r->sfollo
-	if_e7:
+
-	if;
+r-
+
+ * $Id$
a>qp_tab	qp_context->sq_size_u3MIC_C=		er>0t  Y e( max, %3 
-	mthcANTI4_gs * q>qp|		er>0t{
+ dev->u->sq.mthc1_size_u3MIC_C=yuPh	t  		er>0tax, %3 
- * 14:01:50g_nextnd/id\n");
 			err = -EINVALhc=7 mbq,
+						er>0tax, %3 r ICRC */
+		@@
 
 aYTHCA16pts *06>qp3y2-d"r	dex;
+= 2 som vo1+ev &valid\n)
+{T 
 #dOtcgs Mc_=T+_AL    ;
 
-		)
+{T 
 #dOtcgs Mc_=T+_AL    ;
lid\  = MTHC(struc qp->sq.tom	uar4+
+ * $Id$
a>qp_tab	qpsdn/hisax/hisax_fcpcipnp0t  Y e( max, sdn/hisax/hisax_fcpcipnp0t{
+ dev->u->sq.msdn/hisax/hisax_fcpcipnp0tax, %3 
-07 21:44:25g_nextnd/id\n");
 			ersdn/hisax/hisax_fcpcipnp0tax, %3 2-07 1,
+	om(
+	/*j_e +
*90 (err)02 0; wr; adapte			"rON Wt mthci @   _qp; (struct mtINFO "hisax_fcpcipnp:setund adapte	 %025, %0			smp_>su+		s(ch ib_) d4R(s*;
 			 v;
,Wt mthcslot16;
Rval 	>su+		s(ch ib_) d4R(s*;
 			 v;
,Wtci16;
R(t mt)+905,20   valN Wfcpcipnp_s   p	adapte	BUT = _ua   vala*
+ * $Id$
a>qp_tab	qmuqp|toshqmuqsdoorb0t  Y e( max,muqp|toshqmuqsdoorb0t{
+ dev->u->sq.muqp|toshqmuqsdoorb0te_nds =0-21 10:03:2				7xtnd/id\n");
 			emuqp|toshqmuqsdoorb0te_nd%3 r I7 20:41:20@@
 
 aYTHCA15pts *05pts  wr;e can doIA>h    _t rs_tx,
 	nda_o QPrARE.T. IN  ->w2uct Wr);
+	;
 }gs);
+2 +905e can doIA>h    _t rs_rx,
 	nda_o QPrARE.T. IN  ->w2uct Wr);
+	;
 }gs);
+2 +905e can dT. IN,
 	nca_cq *recv_ad_cqoorb *do fo7 @@e can dT. INrx,
 	qc- 1;q *recv_ad_cqoorb *do foenum mcurr;
 );thca_next_seg rx,
 	qc- 1;q *recv_ad_cqoorb *do foenum mcurr+905e can dT. INrx,
 		stttycq *recv_ad_cqoorb *do fo7 @5,2/*=ye;
76_offse76_offsuqp|136,) {
+ dev->u->sq.mthstruct _dT. INrx,
 	qc- 1;q *recv_ad_cqoorb *do foenum mcurr;
 )thca_nextstruct _dT. INrx,
 	qc- 1;q *recv_ad_cqoorb *do foenum mcurres 0 */vol_nelet Wr);
+db,
 	 }gs);
dmt+&o foSEc_ev,
  @@
vol_nelet Wr);
+db,
 	cmIN c		 * wfoSEc_	cmIs[curr;
 ]EMENT.l_nelet Wr);
+db,
 	cmIN c		 * wfoSEc_	cmIs[curr] @5,2//f (struct mthca_n "SCC:Nrx,
 	qc- 106x ful*
+ * $Id$
a>qp_tab	qmuqp|toshq 
+sm egt746x0t  Y e( max,muqp|toshq 
+sm egt746x0t{
+ dev->u->sq.muqp|toshq 
+sm egt746x0te_nds =1-28 06:19om(
+	/*j_e/id\n");
 			emuqp|toshq 
+sm egt746x0te_nd%3 r I7 20:41:25					tail,"
+4
a n 54+	qp->sq.p; =
+		.c	2004ma;
; =
ertycn/k " }g",_sizeBUT = _ua!; =
)r; ++nreq, wr =DEV @@
 
+sm buoOtc((*; =
)ES O8)t mth0f);
+	struode]set.cxss ei 
+stby)
+{
    u>qpn " }g"n" au+i				cp	cpcn/->"mth16;
Rk "/i2c-xss@")rbelsizeB *) wqe -146ch ib_*m/ buoOtc(	cp	cpcn/->"mth16;
Rk "/i2c-xss@")r+ 9val 	c 
+sm buoOtc*m/ buo[0]-'0';_receive( *) wq 
+sm buoOtc((*; =
)ES O8)t mth0f);
. 9++ 	 
+sm egd>heoOtc((*; =
)E mthca)ES O1   _qp; (struct mtINFO "egt746x: T
+smoca_ncxss: %d_seg);heo:mth%02xk "*
+ * $Id$
a>qp_tab	qmuqp|toshq 
+sm windtunnel0t  Y e( max,muqp|toshq 
+sm windtunnel0t{
+ dev->u->sq.muqp|toshq 
+sm windtunnel0te_nds =1-28 06:19o42
+	/*j_e/id\n");
 			emuqp|toshq 
+sm windtunnel0te_nd%3 r I2 10:00:56@@
 
 aYTHCA 7Et C4a n +r ht mthca_LOG_TEMP		0	nds &e -5,Touslyuodg tem
eratuct ; i <ht mthca_I2C_DRIVERID_G4FAN	0x9001	nds &fixmt ; ip(q, qp-A_ndsMOSTAT_CLIENT_ID	1ip(q, qp-AFAN_CLIENT_ID		2folde can do QP 	 	o
; =be( y0r **tr2c_adapte	 *adapte	enum meg);
num mkresour>=ye;
A7 (err370qp3y2-d"rdex);
+}
+qp; (stru"ADM1030 fan&e -5rolle	 [@%02x]thca_cl ruct m+905,-Scl ridmt+FAN_CLIENT_IDlkey);
lcpu__cl r6;
Rk "ADM1030 fan&e -5rolle	",ey =
 	(cl r6;
R) +905,20if( !r2c_attree cli;
 }cl) +YTHCA 12		" %d9qp3y2-d"x. THEheat_tem
u_tos_tem
;-d"x. THEheat_hy = -Ehy =_tem
;-d",-Scl ridmt+_ndsMOSTAT_CLIENT_IDlkey);
lcpu__cl r6;
Rk "DS1775 t
+smoca_n",ey =
 	(cl r6;
R) +905,20if( !r2c_attree cli;
 }cl) +Y
+ * $Id$
a>qp_tab	qmuqp|toshqvia-pmu0t  Y e( max,muqp|toshqvia-pmu0t{
+ dev->u->sq.muqp|toshqvia-pmu0tax, %3 
-30 C *C */7
+	/*j_e/id\n");
 			emuqp|toshqvia-pmu0tax, %3 r ICRC *41:15					tail,"
238/
 	u238/
 	a_addrkeyp-_kernel_fp(ariveryuPh	t  Y  s &ALq)eqCl[2];
+cur_ =tEex*	[0]-> =tEfeatuct08+sCPU_FTR&ALq)eqC)au+i			 =tEhasEfeatuct(CPU_FTR&ALq)eqC))r; +rkeyp-_kernel_alt
 	c( dev->u->s st0 Y  s &ALq)eqC ; i <
+ * $Id$
a>qp_tab	qmd/dm-io0t  Y e( max,md/dm-io0t{
+ dev->u->sq.md/dm-io0t*bP=
+				cpu_to_be	qp_context->sq_size_u3md/dm-io0t*bP=
+	r I7 20:41:39@@
 
 aYTHCA1_of9qe_of max, %d nreq3,R<linux/sched.h> %d nreq3,R<linux/slab.h> %ip(q, qp-ABIO_POOListru 256_sge
-/*-----------------------------------------------------------------
->0Ahio s  , p|F,pcee t2(MTio0t{
 *---------------------------------------------------------------; ip(q, qp-ABV_NAMEistru 16u->sr **tTio 	c_poolree- R PURP_ 	cs @@
ch ib6;
R[BV_NAMEistru] @@
zmem_creee_t *slab @@
mempool_t *pool @@
a_5hca_twqeg is			;ds &FIXME:>sq  Y ; ipum_sge(q, qp-ABIOeqC_NR_POOLS 6u->sr **tTio_s  ree- ch ib6;
R[BV_NAMEistru] @@
zmem_creee_t *Tio_slab @@
mempool_t *Tio_pool @@
>sr **tTio 	c_poolrpools[BIOeqC_NR_POOLS] @@um_sgee can dT. INTio_s  _exa_cq *recvTio_s  r*bs)
-ee- RCHANTABIi @@
>sr **tTio 	c_poolr*bpm_sge i			bs->Tio_poolru-t mempool_ableeoy	bs->Tio_poolrm_sge i			bs->Tio_slabru-t zmem_creee_ableeoy	bs->Tio_slabrm_sge a_init_uar_tableBIOeqC_NR_POOLS_ta++ ree- mb
u_tbs->poolsr+ i @@
 i			bp->poolru-t mmempool_ableeoy	bp->poolrm_sge  i			bp->slabru-t  zmem_creee_ableeoy	bp->slabra_tavor}_sgee can dT. INmk16;
R(ch ib_lee,ey =
_t len, e -146ch ib_pr, qxk lock, flagock, 
-ee- sn; (stf(lee,elen, "%s-%u"ext_, qxk LOCK(&der}_sgee can dR PUTio_s  _nca_cq *recvTio_s  r*bs, e -146ch ib_slab_t_, qxku-t   lock, flapool_d4Roiesk lock, flascale 
-ee- s &FIXME:>cee t		7HCmaructb 	c_" %d (), why	str go     -tionsholethdg ->rei2+ata poolrpe	 powe	 of 2 ?casO-Se can dlock, fla_ 	c_29] res[BIOeqC_NR_POOLS]12 @@
 	1, 4, 16, 64, 128,ABIO_MAX_F
+ S->num_sgee- RCHANTABIi,CITED) ?
>sr **tTio 	c_poolr*bpm_sge s &zero    tbs reewcode[wteaab	qwn ; =
erlyuo nreq_inasO-Smems  (bs, 0,ey =
 	(*bs))m_sge s  -tionS  rup    tbio pool. -tio/e- sn; (stf(bs->6;
Rk y =
 	(bs->6;
R), "%s-bio",eylab_t_, qx)m_sge bs->Tio_slab12 zmem_creee_create(bs->6;
Rk y =
 	(>sr **tTio), 0,nd_wqe(qSLAB_HWCACHE&ALIGN,_size,_sizeBUTe i			!bs->Tio_slabr @@
 	DMWARN("de['bah;i*tTioeylab"7 @@
 dex);bada_tavorge bs->Tio_poolr= mempool_create(pool_d4Roiesk mempool_unlockylabseg *) wqe)  mempool_contexlabs bs->Tio_slabrm_s i			!bs->Tio_poolr @@
 	DMWARN("de['bah;i*tTioepool"7 @@
 dex);bada_tavorge s  -tionS  rup    tbio 	crpools. -tio/e- a_init_uar_tableBIOeqC_NR_POOLS_ta++ ree- mb
u_tbs->poolsr+ i @@
 bp->RP_ 	cs 1ue 	c_29] res[i] @@

a_5hca_s  (&bp->qeg is			,T, T s &FIXME:>sq  Y ; ip_sge  ey =
+	bp->RP_ 	cs * y =
 	(>sr **tTio_ 	crm_sge  mk16;
R(bp->R;
Rk y =
 	(bp->6;
R), slab_t_, qxk i) @@
 bp->slab12 zmem_creee_create(bp->R;
Rk y =
, 0,nd_wqe(qqqqqSLAB_HWCACHE&ALIGN,_size,_sizeBUTe  i			!bp->slabrta_seg DMWARN("de['bah;i*tTio 	crslab1creee"7 @@
  dex);bada_taavorge        >=ascale 
-a_5hcol_d4Roies >>=a_ta-@@
 bp->poolr= mempool_create(pool_d4Roiesk mempool_unlockylabseg *) 	  mempool_contexlabs bp->slabra_ta i			!bp->poolr @@
 	 DMWARN("de['bah;i*tTio 	crmempool"7 @@
  dex);bada_taavoravorge 36,) {
+ d-
->badll[2Tio_s  _exa_cbs7 @@
		qp->s_ -708+;sr}_sges &FIXME:>yp-uct; ip@
 	void *wqe;RCHANTABIb 	c_" %d (RCHANTABInr 
-ee- sstruct nrr @@
 
+	if1:next_ind;
 

 
+	if2 ... 4:|136,) {
1 

 
+	if5 ... 16:136,) {
2 

 
+	if17 ... 64:136,) {
3 

 
+	if65 ... 128:36,) {
4 

 
+	if129 ... BIO_MAX_F
+ S: 36,) {
5a_tavorge BUG(7 @@
		qp->s0der}_sgee can dlock, fla_Tio_ut;
+		}_va->sr **tTio *Tio_s  _>=yeof  Y, WrTio_s  r*bs, R PUgfp_mask&qp->loc_io 	cs)
-ee- >sr **tTio 	c_poolr*bpm_s	>sr **tTio_ 	cr*bvuf_size,
-vRCHANTABILITY,idxm_s	>sr **tTio *Tiom_sge bio = mempool_unloc	bs->Tio_pool,Ugfp_maskrm_s i			) / 16;
+!Tio) 
-a_
+			d_id mthsge bio_nca_cTio)m_sge i					qp_cont_io 	cs) ree- mtd_allb 	c_" %d (nt_io 	cs);e- mb
u_tbs->poolsr+ idxm_s		bvuf_mempool_unloc	bp->pool,Ugfp_maskrm_s  i			!bvata_seg *empool_contcTios bs->Tio_poolrm_s	a_
+			d_id mthsaavorge  mems  (bv, 0,ebp->RP_ 	cs * y =
 	(*bv));e- mbio->Ti(rq.loO|= idxd usBIO_POOLise +
-;e- mbio->Ti(ex;
 	cs 1ubp->RP_ 	cs @@

a_5hca_ nr(&bp->qeg is			)a_tavorge bio->Ti(io_ 	crllb  @@
		qp->sTiom_s}_sgee can dT. INTio_s  _eP
+	ree_ndsTio_s  r*bs, >sr **tTio *Tio)
-ee- >sr **tTio 	c_poolr*bpu_tbs->poolsr+ BIO_POOLiIDXcTio)m_sge i			a_5hca_d	c_->r_tble(&bp->qeg is			) 
-a_BUG(7 @@@@
mempool_contcTio->Ti(io_ 	c,ebp->poolrm_s	*empool_contcTios bs->Tio_poolrm_s}ge
-/*-----------------------------------------------------------------
->0Adm-io ; =
er{
 *---------------------------------------------------------------; ipe can dree_ndsTio_s  r_Tios;thca_nextree_ndsTio_s  r*_Tios;t5,2/*&FIXME:>de[wwcosh (sk>cee t?casO y0r **troaatij_e2 			" 5us7 1 <<	nds &font ofeq)\n"poolr*/end_cqempool_ableeoy	_io_poolrm_pcodeio_poolr= id mthsaa2Tio_s  _exa_c&_Tiosval 	caTios  _eP
+	_Tiosval +ev & e) {_wqe)->s &reey =
)\n"poolr*/eij_e25->sqs)69izeof (s= i			!_io_poolrqe)->		qp->s_ -708+;s@@-	/eq)) io_s  _nca_c&_Tios, "dm-io",e512,
+			op0 _ua B *) wq_Tiosq)) ios  _create(16, 16, 4val 	c suq!_Tiosv.send_cqempool_ableeoy	_io_poolrm_pcodeio_poolr= id mth+)->		qp->s_ -708+;s@if (w	 followin80C_C+97s7 1 << * W  ne+50,o keep  suqk of whiuctreg.wqe_tTio e tdop|136oset..<< * In or" %d oey2+ata qem    qeg is	.wqewcostcontexe t2\n"rr =<< * b 	c whiuctct mca_be tunu+			(yp-uc)
+	reuctv(s = wr- , Wr)->rede[wOOPSPhbris>=ye e -figs... fif (an7 
+stway.<< *---------------------------------------------------------------; i @
 	void *wqe;T. INTio_s  _reg.wq(>sr **tTio *Tiok lock, flareg.wqes 0 ye;
A  Y qe_o3IC_CMP_u-au	 3c
es &FIXME M|F,pcee t2(MTio0h?t; ip@
 	voiT. INzero_fill_Tio(>sr **tTio *Tio)
-ee- RCHANTABILITY, FITNESs	>sr **tTio_ 	cr*bvine MTH i @@ge bio_dust ree  -Nru a(bv, Tiok iata_segch ib_
diffllb 	c_k qp-nda_bv, &F,12 +90e  mems  ( v;
,W0,ebv->Tv_29]+90e  flush_dcreee_pagtcTv->Tv_pagt);e- mb 	c_k", qp-nda_ v;
,W&F,12 +90e vor}_sgde can do QP>u->o(>sr **tTio *Tiok lock, flae;
+	one&qp->lreq_ies 0 */kes 0 f*o *io = (kes 0 f*o *) Tio->Ti(}0 *ate;
ca_bod7			(+150qp3y2-d"36,) {
+ dev->u->sq.mthc1fTEbio_dtr(>sr **tTio *Tio)
-ee- _Tio_ut;
+--;l[2Tio_s  _ 1;llo_Tios, Tio)m_s}_sgd/*-----------------------------------------------------------------
 >qp_tesHCA_ttlt objects *bristr(an abs suq	.wqea_inget5,TY,a new
 >qpableins	.wqepagtea_inio0YTHCA 61,13    8izeof (s=  * b 	c et.cxio_get/s  _reg.wq()
+ +	casOr ==7 mb 	cs 1u(re		wq,TY,/ (F
+ * tru >> 9))r+ 2 @@
 tTio_ut;
+++;e- mbioq)) io_s  _uct mth_Tios, GFP_NOIO, =7 mb 	csval 	cbioq)) io_unlock ios  (GFP_NOIO, =7 mb 	cs, _Tiosval  mbio->Ti(se->oruf_w* siull	->oru+ (w* siulut;
+	- re		wq,TYval  mbio->Ti(b+SS ORw* siulb+SS_u tmbio->Ti(	Wedioq))>u->o_u tmbio->Ti(}0 *ate	 * o;e- mbio->Ti(ablee)->oruf_bio_dtr_u tmbio_s  _reg.wq(Tiok reg.wqeal +ev /*<
+ * $Id$
a>qp_tab	qmd/dm-zero0t  Y e( max,md/dm-zero0t{
+ dev->u->sq.md/dm-zero0te_nds 06-17 23:53:43			7xtnd/id\n");
 			emd/dm-zero0te_nd
+	r I7 20:41:39@@
 
 aYTHCA24,23   4qp3y2-d}@5,2/*=->0AFills    tbio pagtsPhbriszeros=->0 ip@
 	voiT. INzero_fill_Tio(>sr **tTio *Tio)
-ee- RCHANTABILITY, FITNESs	>sr **tTio_ 	cr*bvine MTH i @@ge bio_dust ree  -Nru a(bv, Tiok iata_segch ib_
diffllb 	c_k qp-nda_bv, &F,12 +90e  mems  ( v;
,W0,ebv->Tv_29]+90e  flush_dcreee_pagtcTv->Tv_pagt);e- mb 	c_k", qp-nda_ v;
,W&F,12 +90e vor}_sg-eak;y2 wr,) {
zerosud.);
o		eradsk;y2/gde can do QPzero_ qp(>sr **tdm_targ  r*ti, >sr **tTio *Tio,<
+ * $Id$
a>qp_tab	qmd/dm0t  Y e( max,md/dm0t{
+ dev->u->sq.md/dm0tax, %3 2-03 	7xGt/ 4qp_context->sq_size_u3md/dm0te_nd
+	r I7 20:41:39@@
 
 aYTHCA9|
+		+9|
+6  wr;e can dzmem_creee_t *eio_creee;r;e can dzmem_creee_t *etio_creee;r;thca_nextree_ndsTio_s  r*dm_sr_typpde can do QP__nca_ g isl_nca_cT. Ies 0 */			qp905,+)dm_sr_q)) ios  _create(16, 16, 4val 	 suq!dm_sr_
+					qp->s_ -708+;s%A20/* qeg is		,a slab1f      tdm_iosqasOr eio_creee12 zmem_creee_create("dm_io
+					 wqe)  y =
 	(>sr **tdm_io), 0, 0, size,_sizeBUTye;
-	3lsE30/9  */
+		zmem_creee_ableeoy	etio_creeed provmem_creee_ableeoy	eio_creeed pr+		Tios  _eP
+	dm_sr_
thom(Id$
aunreg.ster_blkLIED_ qjor, _6;
R) < 0rqe)-DMERR("devfs_unreg.ster_blkLIEthca_re"our>=ye;
A93		" %d1yeof  Y, Wr);
+Tio *cLITe; Y, Wr);
+Tio_ 	cr*bvuf_bio->Ti(io_ 	cr+ idxm_5,-Scl (st)) io_unloc(GFP_NOIO, ad_wr cl (st)) io_unlock ios  (GFP_NOIO, 1, dm_sr_
th 	*cLITe->Ti(io_ 	crll*bvin +evcLITe->Ti(se->oruf_se->or;<
+ * $Id$
a>qp_tab	qmd/raid6alt
 	c.ut  Y e( max,md/raid6alt
 	c.ut{
+ dev->u->sq.md/raid6alt
 	c.utax, %3 
-07 21:44:07qp_context->sq_size_u3md/raid6alt
 	c.utax, %3 r I7 20:41:20@@
 
 aYTHCA1+
a n 10= 0; wr;			qpaid6_i2+a_alt
 	c(T. Ies 0 *//qp_tabtassumes ei 
+stf (sCPUsei2+atAlt
 	c    n (stdoesio/e- 		qp->scur_ =tEex*	-> =tEfeatuct08+sCPU_FTR&ALq)eqCntation and =tEhasEfeatuct(CPU_FTR&ALq)eqC) dev->->u->sq.m
+ * $Id$
a>qp_tab	qmedia/common/saa7146_i2c0t  Y e( max,media/common/saa7146_i2c0t{
+ dev->u->sq.media/common/saa7146_i2c0te_nds =
 13 02:47:29qp_context->sq_size_u3media/common/saa7146_i2c0te_nd%3 r I2 09:55:0	@@
 
 aYTHCA2pts *2pts  wr;)  ye_O0sgrougistruPsaa7146.ei2+ata ode]s @@
 	sex*		ey;
+	sts *. 122  * 
(struc			" %e c>re"4is. it 36,) {s    t=7 be	 of u32 t2(Mruct     -1
     i 
+	ifo				lreq_i.t; ip@
 	void t saa7146_i2c_msg_t_,pact(e -146y0r **tr2c_msg m[]&qp->loum_ah_typ=
)r+@
 	void t saa7146_i2c_msg_t_,pact(e -146y0r **tr2c_msg *m&qp->loum_ah_typ=
)r 0 */			qh1, h2full (%Ii,Cj_seg);UTye;
8/
 	u8/
 	a_ad    hiuctoto sPhect mcad0sgrougistruPadapte	 c>res and trum buqk to    tcorct0p4_GEng
     2c-messagt. bubah;stear *wcosimp);
s and buqk f (soto s.
    fixmt:>cee tut;ldMTHCimpbried.t; ip@
 	void t saa7146_i2c_msg__irqreste -146y0r **tr2c_msg m[]&qp->loum_ah_typ=
)r+@
 	void t saa7146_i2c_msg__irqreste -146y0r **tr2c_msg *m&qp->loum_ah_typ=
)r 0 */			qi,Cjfull (%Iop_ut;
+		}_vaTHCA27 (err27 (ery2-d"36,) {
+ dev->u-d t saa7146_i2c_thca/fer(>sr **tsaa7146_(qpacpu_toe -146y0r **tr2c_msg msgs[]&qp->loum_a			qp->oies) 0;dx,saa7146_i2c_thca/fer(>sr **tsaa7146_(qpacpu_toe -146y0r **tr2c_msg *msgs&qp->loum_a			qp->oies)  0 */			qi		}_k LOCK(		}_varite *cxsqferruc+SS->d_i2c0t=tEeg);UTye;
A7 (err37 (ery2-d}@5,2/* utiA_ty func+	sts ; ip@
 	void t saa7146_i2c_xfer(>sr **tr2c_adapte	* adapte	eny0r **tr2c_msg msg[]&qp->loum)r+@
 	void t saa7146_i2c_xfer(>sr **tr2c_adapte	* adapte	eny0r **tr2c_msg *msg&qp->loum)r 0 */kes 0 fsaa7146_(qpqpabvuf_r2c_ma;
adap v;
	adapte	BUT =m
+ * $Id$
a>qp_tab	qmedia/common/saa7146_istro0t  Y e( max,media/common/saa7146_istro0t{
+ dev->u->sq.media/common/saa7146_istro0te_nds =
 13 02:47:29qp_context->sq_size_u3media/common/saa7146_istro0te_nd%3 2-07 1,
+	om(
+	/*j_e +
*88/
 	u88/
 	a_add	
G in the main dirkescpu_cap(s*;
 		, "saa7146 v4l2"val  m);
lcpu_cap(scarr *+SS->	" %d ;
Rk y =
 	(cap(scarr));e- ms; (stf(cap(sbus_o foe"PCI:%s",lloa_fcihcslot16;
Rval 	ms; (stf(cap(sbus_o foe"PCI:%s",Wtci16;
R(lloa_fci);
+r->cap(svmthca_5= SAA7146_VERSION_CODE
+r->cap(scapabiA_ties =					V4L2_CAP_4aaLO_CAPTURE |m
+ * $Id$
a>qp_tab	qmedia/dvb/b2c2/b2c2-usb-core0t  Y e( max,media/dvb/b2c2/b2c2-usb-core0t{
+ dev->u->sq.media/dvb/b2c2/b2c2-usb-core0tax, %3 
-	mth0:56*/7
+	/*j_e/id\n");
 			emedia/dvb/b2c2/b2c2-usb-core0tax, %3 r I7 20:44:50g_nextndTHCA194   *av4s7 1 <<	nd0+					&val+					y =
 	(te )seg *)B2C2_WAIT_FOR_OPERAlike_RDWy2 HZval 	caB2C2_WAIT_FOR_OPERAlike_RDWy2 10wqe = m(Id$
a29]rbely =
 	(te )v.send__dev"req_in
 			gmcad,TY,dw not_5hcalock,sl.",wAg);heo,wRegOffsPCIBUTye;
22			" 22			"1 <<	nd0+					&val+					y =
 	(te )seg *)B2C2_WAIT_FOR_OPERAlike_RDWy2 HZval 	caB2C2_WAIT_FOR_OPERAlike_RDWy2 10wqe = m(Id$
a29]rbely =
 	(te )v.send__dev"req_in
 			gmcad,TY,dw not_5hcalock,sl.",wAg);heo,wRegOffsPCIBUTye;
27			" 27			"1 <<	ndwI;
+	e<<	ndpbBsqfere<<	ndxsqlen,eg *)nWaitTimt ; HZval 	canWaitTimt ; 10wqe = "36,) {
29]r=)) {qlen ? 0 :e(&dOthe followi312		" 3of max, %	ndwI;
+	e<<	nd {qe<<	ndxsqlen,eg *)nWaitTimt ; HZval 	canWaitTimt ; 10wqe = "36,) {
29]r=)) {qlen ? 0 :e(&dOthe followi334   *334   1 <<	ndwI;
+	e<<	ndpvBsqfere<<	ndxsqlen,eg *)nWaitTimt ; HZval 	canWaitTimt ; 10wqe = "36,) {
29]r=)) {qlen ? 0 :e(&dOthe fol
+ * $Id$
a>qp_tab	qmedia/dvb/b2c2/skyqc- 20t  Y e( max,media/dvb/b2c2/skyqc- 20t{
+ dev->u->sq.media/dvb/b2c2/skyqc- 20tax, %3 
-	mth0:56*/7
+	/*j_e/id\n");
 			emedia/dvb/b2c2/skyqc- 20tax, %3 r I2 09:55:0	@@
 
 aYTHCA293		" 293		"y2-d"36,) {
xsq.- qc- 1 dev->u->sq.mthreq)\aster_xfer(>sr **tr2c_adapte	* adapte	eny0r **tr2c_msg msgs[]&qp->loum)r+@
 	void t \aster_xfer(>sr **tr2c_adapte	* adapte	eny0r **tr2c_msg *msgs&qp->loum)r 0 */kes 0 fadapte	 *tm
u_tr2c_ma;
adap v;
	adapte	BUT =			qi,Cc- 1;l0;l
+ * $Id$
a>qp_tab	qmedia/dvb/bt8xx/bt878x, %get_rermImedia/dvb/bt8xx/bt878x,{
+ dev->u->sq.media/dvb/bt8xx/bt878x,e_nds =1-19 05
+	o47
+	/*j_e/id\n");
 			emedia/dvb/bt8xx/bt878x,e_nd%3 r I7 21*C *19@@
 
 aYTHCA8/
 	u8/
n +r ht mthca_BT878_RISC_SYNC_MASK	/hw/mtO_wqe
 ->s_7 @    bt8785hev,*/
 Otail Wr);
+Tt878+Tt878[BT878_MAX] @5,2 Wr);
+Tt878+0 */kes 0 fsemaphcont gpio) {
rUTye;
-23lsE3022  */
+		kes 0 ftaskla;
kes 0 ftaskla;UT =			qshut	qwn;	  cpu+qp->s_7 @ Wr);
+Tt878+Tt878[BT878_MAX] @5,2c1fTEbt8785qc- 1;q *recvTt878+*bt_ah_tye -5rolreg_ah_tyop_sync_o (se<<	nh_tyirq  keyigncon);l
+ * $Id$
a>qp_tab	qmedia/dvb/chcargyT2/chcargyT20t  Y e( max,media/dvb/chcargyT2/chcargyT20t{
+ dev->u->sq.media/dvb/chcargyT2/chcargyT20te_nds =
 	6RC *04:2				/*j_e/id\n");
 			emedia/dvb/chcargyT2/chcargyT20te_nd%3 r I7 20:44:38@@
 
 aYTHCA212		" 2of max, %				qp->sq5,20   1;lusb_bulk_msg(chcargyt2->upu_tousb_sndbulkpipe(chcargyt2->upu_to1)seg *))  ye_dr =
, ye_dr =
_len, &actual_len, HZval 	ca)  ye_dr =
, ye_dr =
_len, &actual_len, 10wqe = m(Id$
aruPhbcont; (stru1, "usb_bulk_msg (ye_d)thca_re, A PA%ithca_x, %d ye;
221		" 221yeof  Y,_RESETxsq.= &dummysq5,20   1;lusb_bulk_msg(chcargyt2->upu_tousb_rcvbulkpipe(chcargyt2->upu_to1)seg *))  RESETxsq, RESETxsq_len, &actual_len, HZval 	ca)  RESETxsq, RESETxsq_len, &actual_len, 10wqe = m(Id$
aruPhbcont; (stru1, "usb_bulk_msg (mcad)thca_re, A PA%ithca_x, %d 
+ * $Id$
a>qp_tab	qmedia/dvb/dibusb/dvb-dibusb-fe-i2c0t  Y e( max,media/dvb/dibusb/dvb-dibusb-fe-i2c0t{
+ dev->u->sq.media/dvb/dibusb/dvb-dibusb-fe-i2c0tax, %3 
- 3 05
24:1				/*j_e/id\n");
 			emedia/dvb/dibusb/dvb-dibusb-fe-i2c0tax, %3 r I2 09:55:0	@@
 
 aYTHCA3
a n 3= 0; wr;eak;y2 I2C \aster xfer func+	stk;y2/g->sq.mthreq)dibusb_i2c_xfer(>sr **tr2c_adapte	 *adap,y0r **tr2c_msg msg[]&p->loum)r+@
 	void t dibusb_i2c_xfer(>sr **tr2c_adapte	 *adap,y0r **tr2c_msg *msg&p->loum)r 0 */kes 0 fusb_dibusb *dibu_tr2c_ma;
adap v;
	adapBUT =			qid 
+ * $Id$
a>qp_tab	qmedia/dvb/dibusb/dvb-dibusb-firmah  0t  Y e( max,media/dvb/dibusb/dvb-dibusb-firmah  0t{
+ dev->u->sq.media/dvb/dibusb/dvb-dibusb-firmah  0tax, %3 
-07 03:49:57			/*j_e/id\n");
 			emedia/dvb/dibusb/dvb-dibusb-firmah  0tax, %3 r I7 20:44:46g_nextndTHCA19   *avts  wr;e can do t dibusb_s andmem(kes 0 fusb_duN) T mupu_tu16meg);
u8b_
diftou8
29])r 0 */36,) {
usb_e -5rol_msg(upu_tousb_sndctrlpipe(upu_t0)seg *)0xa0, USBine M_VENDOR_seg);
mth00, 
diftolen, 5*HZval 	ca0xa0, USBine M_VENDOR_seg);
mth00, 
diftolen, 50wqe = }@5,2o t dibusb_loadfirmah  (kes 0 fusb_duN) T mupu_tt Wr);
+dibusb_usb_duN) T mdibevice
+ * $Id$
a>qp_tab	qmedia/dvb/dibusb/dvb-dibusbx, %get_rermImedia/dvb/dibusb/dvb-dibusbx,{
+ dev->u->sq.media/dvb/dibusb/dvb-dibusbheader_b lags);
+33:10			/*j_e/id\n");
 			emedia/dvb/dibusb/dvb-dibusbx,e_nd%3 r I7 20:44:3	@@
 
 aYTHCA236
 	u236 0; wr;			qdibusb_ctrl_pid(kes 0 fusb_dibusb *dibtt Wr);
+dvb_dumux_fe+50*dvbdmxfe+50&qp->lono_UPsi5,2/* r2cp->re"hca/fert W=
+		 ip(q, qp-ADIBUSBiI2C_TIMEOUT			 HZ*5+ * ACTIOoDIBUSBiI2C_TIMEOUT			 50wqi5,2/* k;y2 protocolfo			llqdibusb_x,ls			 duN) Tse
+ * $Id$
a>qp_tab	qmedia/dvb/ttusb-budget/dvb-ttusb-budget0t  Y e( max,media/dvb/ttusb-budget/dvb-ttusb-budget0t{
+ dev->u->sq.media/dvb/ttusb-budget/dvb-ttusb-budget0te_nds =
 	mth5:43:29qp_context->sq_size_u3media/dvb/ttusb-budget/dvb-ttusb-budget0te_nd%3 r I7 20:44:29@@
 
 aYTHCA162ts *062yeof  Y,_REqp->s_ AGAIN = m(IA PA;lusb_bulk_msg(ttusb-s*uar)ttusb-sbulk_out_pipeseg *))  (u8b_) 
diftolen, &actual_len, HZval 	ca)  (u8b_) 
diftolen, &actual_len, 10wqe = "d$
aA PA!;l0v.send_t; (stru"%s:lusb_bulk_msg(ye_d)thca_re, A PA==A%i!,"
+					__FUNnlike__, A PBUTye;
-77ts *077s7 1 <<(Id$
 >A PA;lusb_bulk_msg(ttusb-s*uar)ttusb-sbulk_in_pipeseg *))  ttusb-srr =d_wrult_a32, &actual_len, HZval 	ca)  ttusb-srr =d_wrult_a32, &actual_len, 10wqe = m(Id$
aA PA!;l0v.send_; (stru"%s:lhca_re, mthca/mtreq_in%dthca___FUNnlike__,YTHCA2p2		" 25 (ery2-d"36,) {
rcv_len dev->u->sq.mthreq)\aster_xfer(>sr **tr2c_adapte	* adapte	eny0r **tr2c_msg msg[]&qp->loum)r+@
 	void t \aster_xfer(>sr **tr2c_adapte	* adapte	eny0r **tr2c_msg *msg&qp->loum)r 0 */kes 0 fttusb *ttusb _tr2c_ma;
adap v;
	adapte	BUT =			qi1;l0;l
+ * $Id$
a>qp_tab	qmedia/dvb/ttusb-dec/ttusb_d	c0t  Y e( max,media/dvb/ttusb-dec/ttusb_d	c0t{
+ dev->u->sq.media/dvb/ttusb-dec/ttusb_d	c0tax, %3 
-	mth0:56*40qp_context->sq_size_u3media/dvb/ttusb-dec/ttusb_d	c0tax, %3 r I7 20:44:25					tail,"
2+
a n 20= 0; wr; }q5,20  rultA;lusb_bulk_msg(d*	->upu_ttd*	->comm->r_pipes bseg *))     COMMD_SOPACKET* tru + 4, &actual_len, HZval 	ca)     COMMD_SOPACKET* tru + 4, &actual_len, 10wqe = m(Id$
arurultv.send_; (stru"%s:lcomm->r bulk messagtlhca_re:treq_in%dthcaYTHCA21/
 	u2avts  wr; }q5,20  rultA;lusb_bulk_msg(d*	->upu_ttd*	->  rult_pipes bseg *))     COMMD_SOPACKET* tru + 4, &actual_len, HZval 	ca)     COMMD_SOPACKET* tru + 4, &actual_len, 10wqe = m(Id$
arurultv.send_; (stru"%s:l  rultAbulk messagtlhca_re:treq_in%dthcaYTHCA1205			(+1205			(f (s= i			j >=a)\n"PACKET* truv.send_c  rultA;lusb_bulk_msg(d*	->upu_ttd*	->comm->r_pipes bse d wp->su+		)\n"PACKET* tru, &actual_len,nd_wqe(qqqqq HZ / 10e_uct k (qqqqq 1wqe = "		j		}_vari & e) {_i				y =
< COMMD_SOPACKET* truv.send_c  rultA;lusb_bulk_msg(d*	->upu_ttd*	->comm->r_pipes bse d wp->su+		j - COMMD_SOPACKET* tru + y =
,nd_wqe(qqqqq &actual_len, HZ / 10e_uct k (qqqqq &actual_len, 10w);s@if (w	 fol
+ * $Id$
a>qp_tab	qmedia/istro/Makea_5h>sq_size_u3media/istro/Makea_5h{
+ dev->u->sq.media/istro/Makea_5h*bP=
+				cpu_to_be6qp_context->sq_size_u3media/istro/Makea_5h*bP=
+	r I7 20:41:40g_nextndTHCAelsE37s7 1 <<zohca-objsqqqqq :=	zr36120.o zr36120_i2c0o zr36120_mem.o
 zr36067-objs	:=	zohca
; =cfs0o zohca
duN) T0o size =zohca
dsize_0o zohca
carr.o
+tuner-objs	:=	tuner-core0o tuner-simp)e0o mt20xx0o tda8290.o
 
 obj-$( Y  s &4aaLO_DEV) += istrori9yo v4l2-commonyo v4l1-compat.o
 

+ * $Id$
a>qp_tab	qmedia/istro/adv71700t  Y e( max,media/istro/adv71700t{
+ dev->u->sq.media/istro/adv71700tax, %3 
-07 21:44:25g_nextnd/id\n");
 			emedia/istro/adv71700tax, %3 r I2 10:01:0	@@
 
 aYTHCA402		" %d2qp3y2-d".force	mthcforce*de)
+{
@
 	void t adv7170_i2c_idmt+		q ca_nextree_ndsi2c_);
 		si2c_);
 		_adv7170;folde can do QYTHCA432		" %ee(&(strA cli;
  rucapte	 = adapte	;rA cli;
  r);
 		st+&o2c_);
 		_adv7170;fo cli;
  rrq.loOtcg2C_CLIENT_ALLOW_USE 

 
li;
  ridmt+adv7170_i2c_id++;e(Id$
a(cli;
  rucdPA==Ag2C_ADV7170ES O1) ||

 	;
-(cli;
  rucdPA==A(g2C_ADV7170ES O1) +O1)v.send_t6;
Rmt+adv7170_6;
Rd door444Et C442yeof  Y,_ze7:
+cli;
 );s@if36,) {
+ deavorasn; (stf(g2C_NAME+cli;
 )k y =
 	(g2C_NAME+cli;
 ))ail,
+d_w"%s[%d]ca_d ;
Rk 
li;
  ridmthA keslcpu_g2C_NAME+cli;
 )k d ;
Rk y =
 	(g2C_NAME+cli;
 ))e = m(Iencod		st+km>=yeof  =
 	(>sr **tadv7170), GFP_ct mEeBUT = _uaencod		stelsizeB *)
+ * $Id$
a>qp_tab	qmedia/istro/adv71750t  Y e( max,media/istro/adv71750t{
+ dev->u->sq.media/istro/adv71750tax, %3 
-07 21:44:25g_nextnd/id\n");
 			emedia/istro/adv71750tax, %3 r I2 10:01:0	@@
 
 aYTHCA4p2		" 4p2	p3y2-d".force	mthcforce*de)
+{
@
 	void t adv7175_i2c_idmt+		q ca_nextree_ndsi2c_);
 		si2c_);
 		_adv7175;folde can do QYTHCA482		" 48e(&(strA cli;
  rucapte	 = adapte	;rA cli;
  r);
 		st+&o2c_);
 		_adv7175;fo cli;
  rrq.loOtcg2C_CLIENT_ALLOW_USE 

 
li;
  ridmt+adv7175_i2c_id++;e(Id$
a(cli;
  rucdPA==Ag2C_ADV7175ES O1) ||

 	;
-(cli;
  rucdPA==A(g2C_ADV7175ES O1) +O1)v.send_t6;
Rmt+adv7175_6;
Rd door494Et C492yeof  Y,_ze7:
+cli;
 );s@if36,) {
+ deavorasn; (stf(g2C_NAME+cli;
 )k y =
 	(g2C_NAME+cli;
 ))ail,
+d_w"%s[%d]ca_d ;
Rk 
li;
  ridmthA keslcpu_g2C_NAME+cli;
 )k d ;
Rk y =
 	(g2C_NAME+cli;
 ))e = m(Iencod		st+km>=yeof  =
 	(>sr **tadv7175), GFP_ct mEeBUT = _uaencod		stelsizeB *)
+ * $Id$
a>qp_tab	qmedia/istro/bt8190t  Y e( max,media/istro/bt8190t{
+ dev->u->sq.media/istro/bt8190tax, %3 
-07 21:44:25g_nextnd/id\n");
 			emedia/istro/bt8190tax, %3 r I2 10:01:0	@@
 
 aYTHCA517ts *517tp3y2-d".force	mthcforce*de)
+{
@
 	void t bt819_i2c_idmt+		q ca_nextree_ndsi2c_);
 		si2c_);
 		_bt819;folde can do QYTHCA546a n 545(&(strA cli;
  rucapte	 = adapte	;rA cli;
  r);
 		st+&o2c_);
 		_bt819;fo cli;
  rrq.loOtcg2C_CLIENT_ALLOW_USE 

 
li;
  ridmt+bt819_i2c_id++;e(gs 		cod		st+km>=yeof  =
 	(>sr **tbt819), GFP_ct mEeBUT = _ua		cod		stelsizeB *)THCA56
+ 6" 5u6,13 x, %		dmt+bt819_mcad+cli;
 
mth17.lkey)struct 	dm mthc0v.send
+	if0x70:mp_>su+		s sn; (stf(g2C_NAME+cli;
 )k y =
 	(g2C_NAME+cli;
 ))ail,
+d_w	 "bt819a[%d]ca_
li;
  ridmthA  keslcpu_g2C_NAME+cli;
 )k "bt819a"k y =
 	(g2C_NAME+cli;
 ))e = 		bmcak;end
+	if0x60:mp_	sn; (stf(g2C_NAME+cli;
 )k y =
 	(g2C_NAME+cli;
 ))ail,
+d_w	 "bt817a[%d]ca_
li;
  ridmthA  keslcpu_g2C_NAME+cli;
 )k "bt817a"k y =
 	(g2C_NAME+cli;
 ))e = 		bmcak;end
+	if0x20:mp_	sn; (stf(g2C_NAME+cli;
 )k y =
 	(g2C_NAME+cli;
 ))ail,
+d_w	 "bt815a[%d]ca_
li;
  ridmthA  keslcpu_g2C_NAME+cli;
 )k "bt815a"k y =
 	(g2C_NAME+cli;
 ))e = 		bmcak;enddefault:bcont; (stru1,)
+ * $Id$
a>qp_tab	qmedia/istro/bt8560t  Y e( max,media/istro/bt8560t{
+ dev->u->sq.media/istro/bt8560tax, %3 
-07 21:44:25g_nextnd/id\n");
 			emedia/istro/bt8560tax, %3 r I2 10:01:0	@@
 
 aYTHCA306a n 306ap3y2-d".force	mthcforce*de)
+{
@
 	void t bt856_i2c_idmt+		q ca_nextree_ndsi2c_);
 		si2c_);
 		_bt856;folde can do QYTHCA335c			334   1 <<	cli;
  rucapte	 = adapte	;rA cli;
  r);
 		st+&o2c_);
 		_bt856;fo cli;
  rrq.loOtcg2C_CLIENT_ALLOW_USE 

 
li;
  ridmt+bt856_i2c_id++;e- sn; (stf(g2C_NAME+cli;
 )k y =
 	(g2C_NAME+cli;
 ))ail,
+d_w"bt856[%d]ca_
li;
  ridmthA keslcpu_g2C_NAME+cli;
 )k "bt856"k y =
 	(g2C_NAME+cli;
 ))e = m(Iencod		st+km>=yeof  =
 	(>sr **tbt856), GFP_ct mEeBUT = _uaencod		stelsizeB *)
+ * $Id$
a>qp_tab	qmedia/istro/bttv-carrs0t  Y e( max,media/istro/bttv-carrs0t{
+ dev->u->sq.media/istro/bttv-carrs0t*bP=
+				cpu_to_be7g_nextnd/id\n");
 			emedia/istro/bttv-carrs0t*bP=
+	r I7 20:41:40g_nextndTHCA1,5 +1,5  wr;eak-		s $Id: bttv-carrs0t,v 1.42 bP=
/01/13 17*C */3 kraxel Exp $
+		s $Id: bttv-carrs0t,v 1.44 bP=
/01/31 11:35:05 kraxel Exp $
 
(str bttv-carrs0t >=ye;
-70qp3+-70q */
+		//s>=ye earrs shipPhbrisoto swappel IDs ...+		{mth1bP=bd11, BTTV_PINNACLE,u+		s "Pinnacle PCTV [bswap]" &vali{mthcaP=bd11, BTTV_PINNACLE,u+		s "Pinnacle PCTV [bswap]" &va+	//scee tseem t2(Mhappen asPhell ...++i{mthca1211bd, BTTV_PINNACLE,u+		s "Pinnacle PCTV" &valali{mth3000121a, BTTV_VOODOOTV_FM,u+	"3Dfx VoodooTV FM/ VoodooTV bP=" &vali{mth263710b4, BTTV_VOODOOTV_FM,u+	"3Dfx VoodooTV FM/ VoodooTV bP=" &va
+ * $Id$
a>qp_tab	qmedia/istro/bttv-dsize_0t  Y e( max,media/istro/bttv-dsize_0t{
+ dev->u->sq.media/istro/bttv-dsize_0t*bP=
+				cpu_to_be7g_nextnd/id\n");
 			emedia/istro/bttv-dsize_0t*bP=
+	r I7 20:41:40g_nextndTHCA1,5 +1,5  wr;eak-		s $Id: bttv-dsize_0t,v 1.34 bP=
/01/07 13:11:19 kraxel Exp $
+		s $Id: bttv-dsize_0t,v 1.36 bP=
/02/ * 10:51+		@kraxel Exp $
 
(str bttvailBt848 fr;
Rmgrabbe	 dsize_r>=ye;
A921		" A921		"a_ad                ev->u->sq.mthreq)bttv_suspend(kes 0 ftci1(qpactci1(qp_ah_ty>sq.e)r+@
 	void t bttv_suspend(kes 0 ftci1(qpactci1(qp_apm_messagt_ty>sq.e)r.senmain dirkes **tbttva*btvuf_tci1ma;
drv v;
	tci1(qp.lkey);
+			bttv_xsqfer_sr_qidle;a
+ * $Id$
a>qp_tab	qmedia/istro/bttv-i2c0t  Y e( max,media/istro/bttv-i2c0t{
+ dev->u->sq.media/istro/bttv-i2c0tax, %3 
-	cpu_to_be7g_nextnd/id\n");
 			emedia/istro/bttv-i2c0tax, %3 r I2 09:55:02@@
 
 aYTHCA24pts *245		"a_ad       "36,) {
r  val  ev->u->sq.mthreq)bttv_i2c_xfer(>sr **tr2c_adapte	 *r2c_adapeny0r **tr2c_msg msgs[]&qp->loum)r+@
 	void t bttv_i2c_xfer(>sr **tr2c_adapte	 *r2c_adapeny0r **tr2c_msg *msgs&qp->loum)r 0 */kes 0 fbttva*btvuf_r2c_ma;
adap v;
	r2c_adapBUT =			q   valN W_vaTHCA330   *330qp3y2-dq ca_nextree_ndsi2c_cli;
  bttv_i2c_cli;
 _tem
late	 *0 */I2C_DEVNAME+"bttva			ernal")segd       .idm=((strucA1,*de)
+{ a
+ * $Id$
a>qp_tab	qmedia/istro/bttvx, %get_rermImedia/istro/bttvx,{
+ dev->u->sq.media/istro/bttvheader_b lags);
+o_be7g_nextnd/id\n");
 			emedia/istro/bttvx,e_nd%3 r I7 20:41:40g_nextndTHCA1,5 +1,5  wr;eak-	* $Id: bttv.h,v 1.14 bP=
/01/07 13:11:19 kraxel Exp $
+	* $Id: bttv.h,v 1.15 bP=
/01/24 17*37*C	@kraxel Exp $
  ak;y2  bttvailBt848 fr;
Rmgrabbe	 dsize_r> *a
+ * $Id$
a>qp_tab	qmedia/istro/bttvpx, %get_rermImedia/istro/bttvpx,{
+ dev->u->sq.media/istro/bttvpheader_b lags);
+o_be7g_nextnd/id\n");
 			emedia/istro/bttvpx,e_nd%3 r I8 19o40:45g_nextndTHCA1,5 +1,5  wr;eak-		s $Id: bttvp.h,v 1.15 bP=4/12/ 4th5:33:30 kraxel Exp $
+		s $Id: bttvp.h,v 1.16 bP=
/01/24 17*37*C	@kraxel Exp $
 
(str bttvailBt848 fr;
Rmgrabbe	 dsize_r>=ye;
230   *230qp3y2-d/*  @@hduN) TsqasOrt mthca_BTTV_MAX 16u ->s_7 @lock, flae;
+bttv_hev,*/
 Otail Wr);
+TttvaTttvs[BTTV_MAX] @5,2t mthca_BTTV_MAX_FBUFtr 0x2080wqi5t mthca_VBIBUF* tru 	;
-(2048*VBI_MAXuct S*2)Tye;
A7elsE337us7 1 <<	lock, flae;
+us			lkey);
+			bttv_fhah;i*;  cpu+
 Otail Wr);
+TttvaTttvs[BTTV_MAX] @5,2/2 pr *ate	ioctlsqasOrt mthca_BTTV_VERSIONthe main dir_IOR('v' , BASE&4aaIOCPRIVATE+6&qp->)a
+ * $Id$
a>qp_tab	qmedia/istro/cpia_usb0t  Y e( max,media/istro/cpia_usb0t{
+ dev->u->sq.media/istro/cpia_usb0te_nds 04-e7g06:54:3	@@
7xtnd/id\n");
 			emedia/istro/cpia_usb0te_nd%3 r I7 20:44:42@@
 
 aYTHCA30
a n 30= 0; wr; 		 packet[1]u+ (packet[0]w/mt8.+					 USBine M_VENDOR | USBiRECIP_DEVICE,r; 		 packet[2]u+ (packet[3]w/mt8.+@@-	/k packet[4]u+ (packet[5]w/mt8.+@ =
, y =
, HZval 	ca)packet[4]u+ (packet[5]w/mt8.+@ =
, y =
, 10wqe = }@5,2/****************************************************************************YTHCA32pts *32pts  wr; 		 packet[1]u+ (packet[0]w/mt8.+					 USBiDIR_IN | USBine M_VENDOR | USBiRECIP_DEVICE,r; 		 packet[2]u+ (packet[3]w/mt8.+@@-	/k packet[4]u+ (packet[5]w/mt8.+@ =
, y =
, HZval 	ca)packet[4]u+ (packet[5]w/mt8.+@ =
, y =
, 10wqe = }@5,2@
 	void t cpia_usb_thca/ferCmd(T. IN pr *
diftou8
*comm->rtou8
*
dif)a
+ * $Id$
a>qp_tab	qmedia/istro/cx88/cx88-i2c0t  Y e( max,media/istro/cx88/cx88-i2c0t{
+ dev->u->sq.media/istro/cx88/cx88-i2c0tader_b lags);
+o_be7g_nextnd/id\n");
 			emedia/istro/cx88/cx88-i2c0tader_b r I2 10:01:0	@@
 
 aYTHCA14post s41qp3y2-dq ca_nextree_ndsi2c_cli;
  cx8800_i2c_cli;
 _tem
late	 *0 *********I2C_DEVNAME+"cx88xxa			ernal")segd       .idm=(ucA1,*de)
+{ ca_nextch ib_o2c_)evs[128]12 @@
+ * $Id$
a>qp_tab	qmedia/istro/meye0t  Y e( max,media/istro/meye0t{
+ dev->u->sq.media/istro/meye0tax, %3 
-07 21:44:10			/*j_e/id\n");
 			emedia/istro/meye0tax, %3 2-07 1,
+	om(
+	/*j_e +
*1154   *a154    wr; 	mems  (capen0,ey =
 	(*cap)val  m);
cpu_cap(s*;
 		, "meye"val  m);
cpu_cap(scarr *"meye"val- ms; (stf(cap(sbus_o foe "PCI:%s",Wmeye0mchip_ mthcslot16;
Rval 	ms; (stf(cap(sbus_o foe "PCI:%s",Wtci16;
R(meye0mchip_ mt);
+r->cap(svmthca_5= (MEYE_DRIVER_MAJORVERSIONt/mt8. +r; 		       MEYE_DRIVER_MINORVERSION
+r->cap(scapabiA_ties = V4L2_CAP_4aaLO_CAPTURE |m
+ * $Id$
a>qp_tab	qmedia/istro/mt20xx0t  Y e( max,media/istro/mt20xx0t{
+ d/ mt/null	WflaDec 31 16:00:00 1969j_e/id\n");
 			emedia/istro/mt20xx0te_nd%3 r I8 09:55:28@@
 
 aYTHCA0,0 +1,55   wr+eak+	* $Id: mt20xx0t,v 1.3 bP=
/02/ * 15:59:35 kraxel Exp $
+	*k+	* r2cptvatuner chiphduN) T dsize_r+	* e -5rols microtuneatunersk mt2032u+ mt2050s @@
 	smoru a
+	re/
+d nreq3,R<linux/delay.h> +d nreq3,R<linux/i2c0h> +d nreq3,R<linux/istrori9yh> +d nreq3,R<media/tuneryh> +r+ea ----------------------------------------------------------------------re/
+r+@
 	voilock, flae;
+optim =
_vco=(uc1al module_par;
(optim =
_vco,u+		s i
 
mt644val r+@
 	voilock, flae;
+tv_a		enna(struc1al module_par;
(tv_a		enna,d       i
 
mt644val r+@
 	voilock, flae;
+radio_u		enna( W_va module_par;
(radio_u		enna,     i
 
mt644val r+ea ----------------------------------------------------------------------re/
+r+t mthca_MT2032u0x04r+t mthca_MT2030u0x06r+t mthca_MT2040u0x07r+t mthca_MT2050u0x42l r+@
 	voich ib_microtune_part[]12 @@+	[_MT2030u]12 "MT2030",@+	[_MT2032u]12 "MT2032",@+	[_MT2040u]12 "MT2040",@+	[_MT2050u]12 "MT2050",@+cpu+qp// IsSpurInB->r()?r+@
 	void t \t2032_spurcheck(ree_ndsi2c_cli;
  *c,l 	ca)   d t f1&qp->lf2&qp->lex*	ee_m__5hc,p->lex*	ee_m_to)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	 ->lo1=1,n2,f);
+	sf1=f1/10wq; //scale0,o kHz0,o aT. IN32bi
+oze_flows+	sf2=f2/10wq;hA kx*	ee_m__5hc/=10wq;hA kx*	ee_m_to/=10wq;hAhA tuner_dbg("spurcheck f1=%dlf2=%dlt_5hc=%dlto=%dthcaY+ca) f1&f2&ex*	ee_m__5hc,ex*	ee_m_to);hAhA do @@+	)   n2=-n1al 	>su+f=n1*(f1-f2val 	>su+do @@+		n2--;l+		f=f-f2al 	c uner_dbg("spurtblelo1=%dln2=%dlftble=%dthcan1,n2,f);hAhA 0if( (f>ex*	ee_m__5hc) && (f<ex*	ee_m_to)
+			c uner_dbg("mt2032uspurcheck triggerre:t%dthcan1val 	>su+}n
 			g( (f>(f2-ex*	ee_m_to)
 || (n2>-5)val 	>su+n1++;erece
 			g(n1<5);hAhA 36,) {
1 
+}l r+@
 	void t \t2032_compute_eP
q(ree_ndsi2c_cli;
  *c,l 	ca)      lock, flae;
+rf(se< 	ca)      lock, flae;
+if1&qlock, flae;
+if2e< 	ca)      lock, flae;
+ex*	ee_m__5hc,< 	ca)      lock, flae;
+ex*	ee_m_to,< 	ca)      lock, flach ib_ {qe< 	ca)      e;
+*ra;
kel,< 	ca)      lock, flae;
+xogc) //	llqin Hz
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval  )      lock, flae;
+eP
f,lo1,lo1n,lo1a,s,kel,lo1eP
qttd*sirre_lo1,< 	cd*sirre_lo2,lo2,lo2n,lo2a,lo2num,lo2eP
q;hAhA )      eP
f= 5250u*10wq; //5.25MHz
+cd*sirre_lo1=rf(s+if1;hAhA lo1=(2*(d*sirre_lo1/10wq)+(eP
f/10wq)),/ (2*eP
f/10wq)al  )      lo1n=lo1/8al  )      lo1a=lo1-(lo1n*8);hAhA )      s=rf(s/10wq/10wq+109q;hAhA if(optim =
_vcoB *) wqif(s>1890) kel=q;hA 	e) {_i	(s>1720) kel=1;hA 	e) {_i	(s>1530) kel=2;hA 	e) {_i	(s>1370) kel=3;hA 	e) {_kel=4; // >109q;
. 9+	ive( *) d       "i	(s>1790) kel=q; // <1958) d       "e) {_i	(s>1617) kel=1;hAd       "e) {_i	(s>1449) kel=2;hAd       "e) {_i	(s>1291) kel=3;hAd       "e) {_kel=4; // >109q;
. 9+	*ra;
kel=kel;hAhA )      lo1eP
q=(lo1a+8*lo1n)*eP
f;hAhA tuner_dbg("\t2032:+rf(s=%dllo1=%dllo1s=%dllo1a=%dlkel=%d_slo1eP
q=%dthcaY+ca) rf(selo1,lo1n,lo1a,sel,lo1eP
q);hAhA )      d*sirre_lo2=lo1eP
q-rf(s-if2al  )      lo2=(d*sirre_lo2)/eP
f;hA )      lo2n=lo2/8al  )      lo2a=lo2-(lo2n*8);hA )      lo2num=((d*sirre_lo2/10wq)%(eP
f/10wq))* 3780/(eP
f/10wq); //scale0,o fibah;N32bi
+arithhA )      lo2eP
q=(lo2a+8*lo2n)*eP
fu+ lo2num*(eP
f/10wq)/3780*10wq;hAhA tuner_dbg("\t2032:+rf(s=%dllo2=%dllo2s=%dllo2a=%dlnum=%dllo2eP
q=%dthcaY+ca) rf(selo2,lo2n,lo2a,lo2num,lo2eP
q);hAhA )      i	(lo1a<0 || lo1a>7 || lo1n<17 ||lo1n>48 || lo2a<0 ||lo2a >7 ||lo2n<17 ||llo2s>30B *) wqtuner_o fo("\t2032:+eP
quency)
+r;
Rters;
+}fo		range:t%dt%dt%dt%dthcaY+ca	   lo1a_slo1n, lo2a,lo2n);hA )                    (-1);hA )      }l r+	\t2032_spurcheck(c_slo1eP
qttd*sirre_lo2&q+ex*	ee_m__5hc, ex*	ee_m_to);hA	//s>ht;ldMrecalculate	lo1 ( (ststep up/	qwn)l r+	//s>  rup MT2032ureg.ster map1f    hca/ferto 		si2c+		Tuf[0]=lo1n-1;hA Tuf[1]=lo1a | (yel<<4val 	Tuf[2]=0x86; // LOGCl 	Tuf[3]=0x0f; //reservedl 	Tuf[4]=0x1fal 	Tuf[5]=(lo2n-1) | (lo2a<<5);hA "i	(rf(s >400*10wq*10wq)hA )              Tuf[6]=0xe4;hA )      e) {hA )              Tuf[6]=0xf4; // >  rPKENrpe	 rev 1.2l 	Tuf[7]=8+xogcal 	Tuf[8]=0xc3; //reservedl 	Tuf[9]=0x4e; //reservedl 	Tuf[10]=0xec; //reservedl 	Tuf[11]=(lo2num&thcaval 	Tuf[12]=(lo2num>>8) |0x8q; // Lo2RSThAhA 36,) {
0 
+}l r+@
 	void t \t2032_check_lo) {
r(ree_ndsi2c_cli;
  *c)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	 ->ltry, {
r=q;hA lock, flach ibTuf[2]);
+	sfor(try=q;try<1q;try++ ree+		Tuf[0]=0x0eal 	c 2c_master_ye_d(c_ {qe1)al 	c 2c_master_RESE(c_ {qe1)al 	c uner_dbg("mt2032uReg.E=0x%02xthcaTuf[0])al 	c {
r=Tuf[0] &0x06;hAhA 0if (lo
r==6
+			cbmcak;e+l 	c uner_dbg("mt2032: pllqwai
+1ms1f   lo
r (0x%2x)thcaTuf[0])al 	cudelay(10wq)al . 9+                {
rUT+}l r+@
 	void t \t2032_optim =
_vco(ree_ndsi2c_cli;
  *c,e;
+eel,e;
+ {
r)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	lock, flach ibTuf[2]);
	 ->ltad1;hAhA Tuf[0]=0x0fal 	 2c_master_ye_d(c_ {qe1)al 	 2c_master_RESE(c_ {qe1)al 	 uner_dbg("mt2032uReg.F=0x%02xthcaTuf[0])al 	tad1=Tuf[0]&0x07;hAhA if(tad1 ==0B         {
rUT+ if(tad1 ==1B         {
rUT+T+ if(tad1==2B *) wqif(sel==0)h+)->		qp->s {
rUT+ "e) {_kel--;l+	 9+	ive( *) wqif(sel<4vh+)->sel++;ere	e) {hA)->		qp->s {
rUT+ }hAhA tuner_dbg("\t2032+optim =
_vco:lkel=%dthcakel);hAhA Tuf[0]=0x0fal 	Tuf[1]=kel;hA )      i2c_master_ye_d(c_ {qe2val 	lo
r=\t2032_check_lo) {
r(cval 	        {
rUT+}l r+r+@
 	voiT. INmt2032_s  _nf_eP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+rf(se< 	ca)      lock, flae;
+if1&qlock, flae;
+if2e< 	ca)      lock, flae;
+_5hc, lock, flae;
+to)
+{hA lock, flach ibTuf[21]);
	 ->lli
 _try,   ,sel,lo
r=q;hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval hA tuner_dbg("\t2032_s  _nf_eP
q+rf(s=%dlif1=%dlif2=%dl_5hc=%dlto=%dthcaY+ca) rf(seif1&if2e_5hc,to);hAhA        Tuf[0]=0;9+           = 2c_master_ye_d(c_ {qe1)al  )      i2c_master_RESE(c_ {qe21);hAhA Tuf[0]=0al 	   =\t2032_compute_eP
q(c,rf(seif1&if2e_5hc,to,&Tuf[1],&sel,t->xogc)al 	 suq   <0
+					qp->;hAhA        // > ndud.);

 	sreleva		q  g.stersrpe	 Rev. 1.2l         Tuf[0]=0;9+           = 2c_master_ye_d(c_ {qe4)al  )      Tuf[5]=5;9+           = 2c_master_ye_d(c_ {q+5e4)al  )      Tuf[11]=11;9+           = 2c_master_ye_d(c_ {q+11,3)al  )      ifq   !=3)l 	c uner_wa  ("r2cpi/otreq_i:+rcA==A%d (yht;ldMTHC3)thcarr_
thom+	//swai
+f   PLL t2(Mlo
r (per manual)a_x, ry LINT_i		noa
+	sfor(li
 _try=q; li
 _try<2; li
 _try++ ree+		lo
r=\t2032_check_lo) {
r(cval ) wqif(optim =
_vcoB< 	calo
r=\t2032_optim =
_vco(c,sel,lo
rval 	c s(lo
r==6
 bmcak;e+l 	c uner_dbg("mt2032: re-nca_ PLL tby LINTthcval 	cbuf[0]=7al 	cbuf[1]=0x80 +8+t->xogc; // >  rLINT_2(Mre-nca_ PLL l 	c 2c_master_ye_d(c_ {qe2val 		mdelay(10)al 	cbuf[1]=8+t->xogc;l 	c 2c_master_ye_d(c_ {qe2val  )      }l r+	if (lo
r!=6
+			 uner_wa  ("MT2032uFv;
l Eeq_i:+PLL tdid['balo
r.thcval hA Tuf[0]=2al 	Tuf[1]=0x20; // LOGC+f   optim
l ph+	ifnoi {hA)   = 2c_master_ye_d(c_ {qe2)al 	 suq   !=2Bl 	c uner_wa  ("r2cpi/otreq_i:+rcA==A%d (yht;ldMTHC2)thcarr_
tho}l r+r+@
 	voiT. INmt2032_s  _tv_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	 ->lif2e_5hc,tothom+	//sck, 
l bandwidthp->repictuct earrie_r+	 suqt->stdm mV4L2_STD_525_60B *) wq//sNTSCl+		f5hca= 40750*10wq;hA	c ostruc46750*10wq;hA	cif2truc45750*10wq;hA	& e) {_wq wq//sPALl+		f5hca= 32900*10wq;hA	c ostruc39900*10wq;hA	cif2truc38900*10wq;hA	}hAhA        mt2032_s  _nf_eP
q(c, eP
q*62500 s &fonq*10wq*10wq/16 */e< 	ca)  109q*10wq*10wq,lif2e+_5hc, to);hA}r+r+@
 	voiT. INmt2032_s  _radio_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	 ->lif2uf_t->radio_if2al m+	//sper Manual+f   FMftuning: firs>lif ce		er+eP
q. 1085 MHz
+        mt2032_s  _nf_eP
q(c, eP
q*62500 s &fonq*10wq*10wq/16 */e< 	ca)  1085*10wq*10wq,if2eif2eif2);hA}r+r+// Ica_alizs	.wqeastd*scribflae; "MT203x Programm,TY,Proceduct0", Rev 1.2, Feb.2001r+@
 	void t \t2032_nca_cree_ndsi2c_cli;
  *c)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval  )      lock, flach ibTuf[21]);
d       i
 _x, ,xogc,xor=q;hAm+	//sIca_ializeuReg.stersrpe	 ex*	.l  )      Tuf[1]=2a //sIcdex_2(Mreg.ster 2l         Tuf[2]=0xffal  )      Tuf[3]=0x0fal  )      Tuf[4]=0x1fal            = 2c_master_ye_d(c_ {q+1,4);hAhA        Tuf[5]=6a //sIcdex_reg.ster 6hA        Tuf[6]=0xe4;hA )      Tuf[7]=0x8fal  )      Tuf[8]=0xc3;l  )      Tuf[9]=0x4e;l  )      Tuf[10]=0xec;9+           = 2c_master_ye_d(c_ {q+5e6);hAhA        Tuf[12]=13;  //sIcdex_reg.ster 13hA        Tuf[13]=0x32al            = 2c_master_ye_d(c_ {q+12e2)al hA        // Adjus>lXOGC+(reg.ster 7)a_wai
+f   XOKhA        xogc=7al  )      do *) wqtuner_dbg("mt2032: xogc( W_x%02xthcaxogc&0x07);hA )              mdelay(10)al  )              Tuf[0]=0x0eal  )               2c_master_ye_d(c_ {qe1)al  )       )      i2c_master_RESE(c_ {qe1)al  )       )      xor=Tuf[0]&0x01al  )       )      tuner_dbg("mt2032: xok( W_x%02xthcaxok)al  )       )      isuqxok( =O1) bmcak;e+l  )       )      xogc--;l+ )       )      tuner_dbg("mt2032: xogc( W_x%02xthcaxogc&0x07);hA )              isuqxogcA==A3) *) d        )       )      xogc=4; // m,T. 4rpe	 ex*	) d        )       )      bmcak;e+ )       )      }l  )              Tuf[0]=0x07al  )              Tuf[1]=0x88 + xogc;l  )                 = 2c_master_ye_d(c_ {qe2val  )              isuq   !=2Bl 	cc uner_wa  ("r2cpi/otreq_i:+rcA==A%d (yht;ldMTHC2)thcarr_
tho )      }e
 			g(xok(!=O1 )al 	t->xogc=xogc;l l 	t->tv_fP
q(strucmt2032_s  _tv_fP
qal 	t->radio_fP
qrucmt2032_s  _radio_fP
q;9+              (1);hA}r+r+@
 	voiT. INmt2050_s  _u		enna(ree_ndsi2c_cli;
  *c, lock, flach ibu		enna)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval  )     lock, flach ibTuf[2]);
       i
 _x, ;e+l  )     Tuf[0] = 6;l  )     Tuf[1] = u		enna(?mth11 :mth10;9+          = 2c_master_ye_d(c_ {qe2val  )     tuner_dbg("mt2050: enabled u		enna(conne->oru%dthca_u		enna);hA}r+r+@
 	voiT. INmt2050_s  _nf_eP
q(ree_ndsi2c_cli;
  *c,lock, flae;
+eP
q&qlock, flae;
+if2)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	lock, flae;
+if1=1218*10wq*10wqal 	lock, flae;
+f_lo1,f_lo2,lo1elo2,f_lo1_modulo,f_lo2_modulo,num1,num2,div1a,div1b,div2a,div2bal 	 ->lx, ;e+ lock, flach ibTuf[6]al hA tuner_dbg("\t2050_s  _nf_eP
q eP
q=%dlif1=%dlif2=%dthcaY+ca) fP
q&if1&if2val hA f_lo1=fP
q+if1;hA f_lo1=(f_lo1/10wq0wq)*10wq0wqal hA f_lo2=f_lo1-eP
q-if2al  f_lo2=(f_lo2/5q0wq)*5q0wqal hA lo1=f_lo1/40wq0wqal 	lo2=f_lo2/40wq0wqal hA f_lo1_modulo=+f_lo1-(lo1*40wq0wq)al  f_lo2_modulo=+f_lo2-(lo2*40wq0wq)al l  num1=4*f_lo1_modulo/40wq0wqal 	num2=4096*(f_lo2_modulo/10wq)/40wqal hA //scodo spurcheckshAhA div1a=(lo1/12)-1;hA div1b=lo1-(div1a+1)*12al m+	div2a=(lo2/8)-1;hA div2b=lo2-(div2a+1)*8;l r+	if (tuner_debug  O1) *) wqtuner_dbg("lo1 lo2 =t%dt%dthca	lo1, lo2)al 	c uner_dbg("num1lnum2 div1a div1b div2a div2b= %x %x %x %x %x %xthcaY+ca	  num1,num2,div1a,div1b,div2a,div2b)UT+ }hAhA Tuf[0]=1;hA Tuf[1]= 4*div1b + num1UT+ if(eP
q<275*10wq*10wq) Tuf[1] = Tuf[1]|0x8q;hAhA Tuf[2]=div1a;l 	Tuf[3]=32*div2b + num2/256;f 	Tuf[4]=num2-(num2/256)*256;f 	Tuf[5]=div2aUT+ if(num2!=q) Tuf[5]=Tuf[5]|0x40;l r+	if (tuner_debug  O1) *) wq			qid  	c uner_dbg("Tufs is: cval 	cfor(i=q;i<6;i++Bl 	cc; (stru"%x caTuf[i])al 	c; (stru"thcval 	}hAhA 36,= 2c_master_ye_d(c_ {qe6)al  )      ifuq   !=6Bl 	c uner_wa  ("r2cpi/otreq_i:+rcA==A%d (yht;ldMTHC6)thcarr_
tho}l r+@
 	voiT. INmt2050_s  _tv_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	lock, flae;
+if2;l r+	if (t->stdm mV4L2_STD_525_60B *) wq//sNTSCl+ )              is2ruc45750*10wq;hA )      }eive( *) d               // PALl+ )              is2ruc38900*10wq;hA )      }l 	if (V4L2_TUNER_DIGITAL_TVA==At->modeB *) wq//sDVB (pinnacle 300i)hA	cif2tuc36150*10wq;hA	}hA	mt2050_s  _nf_eP
q(c, eP
q*62500,lif2val 	mt2050_s  _u		enna(c, tv_a		enna
tho}l r+@
 	voiT. INmt2050_s  _radio_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	 ->lif2uf_t->radio_if2al m+	mt2050_s  _nf_eP
q(c, eP
q*62500,lif2val 	mt2050_s  _u		enna(c, radio_u		enna)UT+}l r+@
 	void t \t2050_nca_cree_ndsi2c_cli;
  *c)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	lock, flach ibTuf[2]);
	 ->lx, ;e+l  Tuf[0]=6al 	Tuf[1]=0x10al 	   = 2c_master_ye_d(c_ {qe2va //  powe_r+hA Tuf[0]=0x0fal 	Tuf[1]=0x0fal 	   = 2c_master_ye_d(c_ {qe2va // m1lor+hA Tuf[0]=0x0dal 	   = 2c_master_ye_d(c_ {qe1)al 	 2c_master_RESE(c_ {qe1)al hA tuner_dbg("\t2050: sro is %xthcaTuf[0])al 	t->tv_fP
q(strucmt2050_s  _tv_fP
qal 	t->radio_fP
qrucmt2050_s  _radio_fP
q;hA 36,) {
0 
+}l r+d t \icrotune_nca_cree_ndsi2c_cli;
  *c)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	ch ib_6;
Rd   )      lock, flach ibTuf[21]);
	 ->lcompany_cod	al m+	mems  ( {qe0,y =
 	( {q))al 	t->tv_fP
q(strucsizeal 	t->radio_fP
qrucsizeal 	6;
Rmt+"unknown";hAhA )      i2c_master_ye_d(c_ {qe1)al  )      i2c_master_RESE(c_ {qe21);hA )      ifuqtuner_debug) *) d        )      			qid  	c uner_dbg("MT20xx hexdump:"val  )              for(i=q;i<21;i++B *) d        )       )      ; (stru" %02xcaTuf[i])al d        )       )      if(((i+1)%8)==0B ; (stru" "val  )              }l  )              ; (stru"thcval  )      }l 	company_cod	 = Tuf[th11]w/mt8 | Tuf[th12]);
	tuner_o fo("\icrotune:lcompanycod	=%04x)
+rt=%02x rev=%02xthcaY+ca) lcompany_cod	,Tuf[th13],Tuf[th14])al hA#ifuq;
./*tseem t2(Mcaus	smore problem t2han it solves ...re/
+y)struct company_cod	B *) w
+	if0x30bf:) w
+	if0x3cbf:) w
+	if0x3dbf:) w
+	if0x4d54:) w
+	if0x8e81:) w
+	if0x8e91:) w./*tok((?)re/
+ycbmcak;e+ddefault:b 	c uner_wa  (" uner: \icrotune:lunknownlcompanycod	thcval 	c36,) {
0 
+	}hA->u->sq r+	if (Tuf[th13] < ARRAY* tru(microtune_part) &&l 	>su+size(!=Omicrotune_part[Tuf[th13]])hA	c6;
Rmt+microtune_part[Tuf[th13]];
+y)struct Tuf[th13]B *) w
+	ifMT2032:b 	c\t2032_nca_cc)al 	cbmcak;e+d
+	ifMT2050:b 	c\t2050_nca_cc)al 	cbmcak;e+ddefault:b 	c uner_o fo("\icrotune %s1f u>rtonot (yet?)rsupportre, sorry :-/thcaY+ca	   6;
Rval  )                     0al  )      }l r+	);
lcpu_c%d ;
Rk  ;
Rk y =
 	(c%d ;
R)));
	tuner_o fo("\icrotune %s1f u>rtoOKthcan;
Rval 	36,) {
0 
+}l r+eak+	* Ovreqides1f   Emacs sot2hat*wcofollow Linus' t2abb,TY,style
+	re ---------------------------------------------------------------------------+	re Local variables:r+	* e-basic-offs  : 8r+	* End:+	re/

+ * $Id$
a>qp_tab	qmedia/istro/ovcamchip/ovcamchip_core0t  Y e( max,media/istro/ovcamchip/ovcamchip_core0t{
+ dev->u->sq.media/istro/ovcamchip/ovcamchip_core0te_nds =0-19 02o40:35@@
7xtnd/id\n");
 			emedia/istro/ovcamchip/ovcamchip_core0te_nd%3 r I2 10:01:0	@@
 
 aYTHCA422		" 422qp3y2-dq ca_nextree_ndsi2c_cli;
  cli;
 _tem
late	 *0 */I2C_DEVNAME+"(locr_
")seg	.idm=		A1,*d	.);
 		st	&*;
 		,*de)
+{
+ * $Id$
a>qp_tab	qmedia/istro/saa5246a0t  Y e( max,media/istro/saa5246a0t{
+ dev->u->sq.media/istro/saa5246a0tader_b lags);
+o_be5g_nextnd/id\n");
 			emedia/istro/saa5246a0tader_b r I2 10:01:0	@@
 
 aYTHCA18pts *18ptp3y2-de)
+{ ca_nextree_ndsi2c_cli;
  cli;
 _tem
late	 *0 g	.idmmthcA1,*d	.);
 		mthc&o2c_);
 		_istrotext,*d	.n;
Rmthc"(locr_
",*de)

+ * $Id$
a>qp_tab	qmedia/istro/saa52490t  Y e( max,media/istro/saa52490t{
+ dev->u->sq.media/istro/saa52490tader_b lags);
+o_be5g_nextnd/id\n");
 			emedia/istro/saa52490tax, %3 r I2 10:01:0	@@
 
 aYTHCA25
a n 25
ap3y2-de)
+{ ca_nextree_ndsi2c_cli;
  cli;
 _tem
late	 *0 g	.idmmthcA1,*d	.);
 		mthc&o2c_);
 		_istrotext,*d	.n;
Rmthc"(locr_
",*de)

+ * $Id$
a>qp_tab	qmedia/istro/saa71100t  Y e( max,media/istro/saa71100t{
+ dev->u->sq.media/istro/saa71100tax, %3 
-07 21:44:25g_nextnd/id\n");
 			emedia/istro/saa71100tax, %3 r I2 10:01:0	@@
 
 aYTHCA47us7 +47usp3y2-d".force	mthcforce*de)
+{
@
 	void t saa7110_i2c_idmt+		q ca_nextree_ndsi2c_);
 		si2c_);
 		_saa7110;folde can do QYTHCA507c			506   1 <<	cli;
  rucapte	 = adapte	;rA cli;
  r);
 		st+&o2c_);
 		_saa7110;fo cli;
  rrq.loOtcg2C_CLIENT_ALLOW_USE 

 
li;
  ridmt+saa7110_i2c_id++;e- sn; (stf(g2C_NAME+cli;
 )k y =
 	(g2C_NAME+cli;
 ))ail,
+d_w"saa7110[%d]ca_
li;
  ridmthA keslcpu_g2C_NAME+cli;
 )k "saa7110"k y =
 	(g2C_NAME+cli;
 ))e = m(I		cod		st+km>=yeof  =
 	(>sr **tsaa7110), GFP_ct mEeBUT = _ua		cod		stel0B *)
+ * $Id$
a>qp_tab	qmedia/istro/saa71110t  Y e( max,media/istro/saa71110t{
+ dev->u->sq.media/istro/saa71110te_nds =
-07 18:11:28@@
 
 aY/id\n");
 			emedia/istro/saa71110tax, %3 r I2 10:01:0	@@
 
 aYTHCA500   *500 p3y2-d".force	mthcforce*de)
+{
@
 	void t saa7111_i2c_idmt+		q ca_nextree_ndsi2c_);
 		si2c_);
 		_saa7111;folde can do QYTHCA530c			529   1 <<	cli;
  rucapte	 = adapte	;rA cli;
  r);
 		st+&o2c_);
 		_saa7111;fo cli;
  rrq.loOtcg2C_CLIENT_ALLOW_USE 

 
li;
  ridmt+saa7111_i2c_id++;e- sn; (stf(g2C_NAME+cli;
 )k y =
 	(g2C_NAME+cli;
 ))ail,
+d_w"saa7111[%d]ca_
li;
  ridmthA keslcpu_g2C_NAME+cli;
 )k "saa7111"k y =
 	(g2C_NAME+cli;
 ))e = m(I		cod		st+km>=yeof  =
 	(>sr **tsaa7111), GFP_ct mEeBUT = _ua		cod		stelsizeB *)
+ * $Id$
a>qp_tab	qmedia/istro/saa71140t  Y e( max,media/istro/saa71140t{
+ dev->u->sq.media/istro/saa71140tax, %3 
-07 21:44:25g_nextnd/id\n");
 			emedia/istro/saa71140tax, %3 r I2 10:01:0	@@
 
 aYTHCA83
a n 83
ap3y2-d".force	mthcforce*de)
+{
@
 	void t saa7114_i2c_idmt+		q ca_nextree_ndsi2c_);
 		si2c_);
 		_saa7114;folde can do QYTHCA871c			870   1 <<	cli;
  rucapte	 = adapte	;rA cli;
  r);
 		st+&o2c_);
 		_saa7114;fo cli;
  rrq.loOtcg2C_CLIENT_ALLOW_USE 

 
li;
  ridmt+saa7114_i2c_id++;e- sn; (stf(g2C_NAME+cli;
 )k y =
 	(g2C_NAME+cli;
 ))ail,
+d_w"saa7114[%d]ca_
li;
  ridmthA keslcpu_g2C_NAME+cli;
 )k "saa7114"k y =
 	(g2C_NAME+cli;
 ))e = m(I		cod		st+km>=yeof  =
 	(>sr **tsaa7114), GFP_ct mEeBUT = _ua		cod		stelsizeB *)
+ * $Id$
a>qp_tab	qmedia/istro/saa7134/saa7134-i2c0t  Y e( max,media/istro/saa7134/saa7134-i2c0t{
+ dev->u->sq.media/istro/saa7134/saa7134-i2c0te_nds =1-11 00:36:51g_nextnd/id\n");
 			emedia/istro/saa7134/saa7134-i2c0te_nd%3 r I2 09:55:02@@
 
 aYTHCA236
 	u236 0; wr;}@5,2@
 	void t saa7134_i2c_xfer(>sr **tr2c_adapte	 *r2c_adapeeg *))   y0r **tr2c_msg msgs[]&qp->loum)r+ *))   y0r **tr2c_msg *msgs&qp->loum)r 0 */kes 0 fsaa7134_(qpac(qpa=tr2c_adap rulgo_ v;
;m(Ienumtr2c_@
 	us @
 	usvaTHCA362ts *362tp3y2-dq ca_nextree_ndsi2c_cli;
  saa7134_cli;
 _tem
late	 *0 */I2C_DEVNAME+"saa7134a			ernal")segd       .idm=((str(ucA1,*de)
+{ ea -----------------------------------------------------------re/

+ * $Id$
a>qp_tab	qmedia/istro/saa71850t  Y e( max,media/istro/saa71850t{
+ dev->u->sq.media/istro/saa71850tax, %3 
-07 21:44:25g_nextnd/id\n");
 			emedia/istro/saa71850tax, %3 r I2 10:01:0	@@
 
 aYTHCA39
a n 39
ap3y2-d".force	mthcforce*de)
+{
@
 	void t saa7185_i2c_idmt+		q ca_nextree_ndsi2c_);
 		si2c_);
 		_saa7185;folde can do QYTHCA427c			426   1 <<	cli;
  rucapte	 = adapte	;rA cli;
  r);
 		st+&o2c_);
 		_saa7185;fo cli;
  rrq.loOtcg2C_CLIENT_ALLOW_USE 

 
li;
  ridmt+saa7185_i2c_id++;e- sn; (stf(g2C_NAME+cli;
 )k y =
 	(g2C_NAME+cli;
 ))ail,
+d_w"saa7185[%d]ca_
li;
  ridmthA keslcpu_g2C_NAME+cli;
 )k "saa7185"k y =
 	(g2C_NAME+cli;
 ))e = m(Iencod		st+km>=yeof  =
 	(>sr **tsaa7185), GFP_ct mEeBUT = _uaencod		stelsizeB *)
+ * $Id$
a>qp_tab	qmedia/istro/tda74320t  Y e( max,media/istro/tda74320t{
+ dev->u->sq.media/istro/tda74320tax, %3 
-07 21:44:16qp_context->sq_size_u3media/istro/tda74320tax, %3 r I2 10:01:0	@@
 
 aYTHCA52
a n 52
a6  wr;e can dree_ndsi2c_cli;
  cli;
 _tem
late	 
*0 */I2C_DEVNAME+"tda7432")segd       .idm=((str( hcA1,*d	.);
 		str( hc&*;
 		,*de)
+{
+ * $Id$
a>qp_tab	qmedia/istro/tda8290.t  Y e( max,media/istro/tda8290.t{
+ d/ mt/null	WflaDec 31 16:00:00 1969j_e/id\n");
 			emedia/istro/tda8290.te_nd%3 r I8 09:55:29@@
 
 aYTHCA0,0 +1,224  wr+eak+	* $Id: tda8290.t,v 1.5 bP=
/02/ * 15:59:35 kraxel Exp $
+	*k+	* r2cptvatuner chiphduN) T dsize_r+	* e -5rols 
 	sphilips tda8290+75atuner chiphcombo
+	re/
+d nreq3,R<linux/i2c0h> +d nreq3,R<linux/istrori9yh> +d nreq3,R<linux/delay.h> +d nreq3,R<media/tuneryh> +r+ea ----------------------------------------------------------------------re/
+r+@
e_ndsfP
q_;
 ry *) wu16	fP
q;hA u8	valu	al }al r+@
 	voi@
e_ndsfP
q_;
 ry band_table[]12 @@+	{mth2DF4
mth1C &va+	{mth2574
mth14 &va+	{mth22B4
mth0C &va+	{mth20D4
mth0B &va+	{mth1E74
mth3B &va+	{mth1C34
mth33 &va+	{mth16F4
mth5B &va+	{mth1454
mth53 &va+	{mth12D4
mth52 &va+	{mth1034
mth4A &va+	{mth0EE4
mth7A &va+	{mth0D34
mth72 &va+	{mth0B54
mth9A &va+	{mth0914
mth91 &va+	{mth07F4
mth89 &va+	{mth0774
mthB9 &va+	{mth067B
mthB1 &va+	{mth0634
mthD9 &va+	{mth05A4
mthD8 &vq//sFM radioa+	{mth0494EmthD0 &va+	{mth03BCEmthC8 &va+	{mth0394EmthF8 &vq//s5725q0wq Hz
+	{mth00wq,lthF0 &vq//s0l }al r+@
 	voi@
e_ndsfP
q_;
 ry div_table[]12 @@+	{mth1C34
m3 &va+	{mth0D34
m2 &va+	{mth067B
m1 &va+=((str( {mth00wq,lt &va+}al r+@
 	voi@
e_ndsfP
q_;
 ry agc_table[]12 @@+	{mth22B4
mth8F &va+	{mth0B54
mth9F &va+	{mth09A4
mth8F &va+	{mth0554
mth9F &va+	{mth00wq,lthBF &va+}al r+@
 	voi__u8 ma;
fP
q_;
 ry(i@
e_ndsfP
q_;
 ry* tablea___u16+eP
q)
+{hA 
 			(table rrP
qr&& table rrP
qr>+eP
q)
+		table++;ere36,) {
table rvalu	al } +r+ea ----------------------------------------------------------------------re/
+r+@
 	voilock, flach ibi2c_enable_bridge[2]u=li{mth21EmthC0 cpu+@
 	voilock, flach ibi2c_disable_bridge[2]u=li{mth21Emth80 cpu+@
 	voilock, flach ibi2c_nca__tda8275[14]u=li{mthwq,lthwq,lthwq,lthwq,uct k (	r 0x7CEmth04
mthA3
mth3F,uct k (	r 0x2AEmth04
mthFF,lthwq,uct k (	r 0xwq,lth40 cpu+@
 	voilock, flach ibi2c_s  _VS[2]u=lii{mth30,lth6F cpu+@
 	voilock, flach ibi2c_s  _GP01_CF[2]u=li{mth20
mth0B &pu+@
 	voilock, flach ibi2c_tda8290d_wret[2]u=i{mthwq,lthwq &pu+@
 	voilock, flach ibi2c_gaiocr__off[2]u=i{mth2
amth14 &pu+@
 	voilock, flach ibi2c_gaiocr__on[2]u=i{mth2
amth54 &pu+@
 	voilock, flach ibi2c_agc3_00[2]u=ii{mth8q,lthwq &pu+@
 	voilock, flach ibi2c_agc2_BF[2]u=ii{mth6q,lthBF &pu+@
 	voilock, flach ibi2c_cb1_D2[2]u=ii{mth30,lthD2 &pu+@
 	voilock, flach ibi2c_cb1_56[2]u=ii{mth30,lth56 &pu+@
 	voilock, flach ibi2c_cb1_52[2]u=ii{mth30,lth52 &pu+@
 	voilock, flach ibi2c_cb1_50[2]u=ii{mth30,lth5q &pu+@
 	voilock, flach ibi2c_agc2_7F[2]u=ii{mth6q,lth7F &pu+@
 	voilock, flach ibi2c_agc3_08[2]u=ii{mth8q,lthw8 }al r+@
 	voi@
e_ndsr2c_msg r2c_msg_nca_[]12 @@+	{mg2C_ADDR_TDA8275en0,eARRAY* tru(i2c_nca__tda8275), i2c_nca__tda8275 &va+	{mg2C_ADDR_TDA8290en0,eARRAY* tru(i2c_disable_bridge), i2c_disable_bridge &va+	{mg2C_ADDR_TDA8290en0,eARRAY* tru(i2c_s  _VS), i2c_s  _VS &va+	{mg2C_ADDR_TDA8290en0,eARRAY* tru(i2c_s  _GP01_CF), i2c_s  _GP01_CF &va+}al r+@
 	voi@
e_ndsr2c_msg r2c_msg_prolog[]12 @@+//	{mg2C_ADDR_TDA8290en0,eARRAY* tru(i2c_easy_modeB, i2c_easy_mode &va+	{mg2C_ADDR_TDA8290en0,eARRAY* tru(i2c_gaiocr__offB, i2c_gaiocr__off &va+	{mg2C_ADDR_TDA8290en0,eARRAY* tru(i2c_tda8290d_wretB, i2c_tda8290d_wret &va+	{mg2C_ADDR_TDA8290en0,eARRAY* tru(i2c_enable_bridgeB, i2c_enable_bridge &va+}al r+@
 	voi@
e_ndsr2c_msg r2c_msg_e -fig[]12 @@+//	{mg2C_ADDR_TDA8275en0,eARRAY* tru(i2c_sa;
fP
q), i2c_s  _rP
qr&va+	{mg2C_ADDR_TDA8275en0,eARRAY* tru(i2c_agc3_00), i2c_agc3_00r&va+	{mg2C_ADDR_TDA8275en0,eARRAY* tru(i2c_agc2_BF), i2c_agc2_BFr&va+	{mg2C_ADDR_TDA8275en0,eARRAY* tru(i2c_cb1_D2), i2c_cb1_D2r&va+	{mg2C_ADDR_TDA8275en0,eARRAY* tru(i2c_cb1_56), i2c_cb1_56r&va+	{mg2C_ADDR_TDA8275en0,eARRAY* tru(i2c_cb1_52), i2c_cb1_52 &va+}al r+@
 	voi@
e_ndsr2c_msg r2c_msg_epilog[]12 @@+	{mg2C_ADDR_TDA8275en0,eARRAY* tru(i2c_cb1_50), i2c_cb1_50r&va+	{mg2C_ADDR_TDA8275en0,eARRAY* tru(i2c_agc2_7F), i2c_agc2_7Fr&va+	{mg2C_ADDR_TDA8275en0,eARRAY* tru(i2c_agc3_08), i2c_agc3_08 &va+	{mg2C_ADDR_TDA8290en0,eARRAY* tru(i2c_disable_bridge), i2c_disable_bridge &va+	{mg2C_ADDR_TDA8290en0,eARRAY* tru(i2c_gaiocr__onB, i2c_gaiocr__on &va+}al r+@
 	voie;
+tda8290dtunecree_ndsi2c_cli;
  *c)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	@
e_ndsr2c_msg easy_mode =uct {mg2C_ADDR_TDA8290en0,e2,_t->i2c_easy_mode &al 	@
e_ndsr2c_msg s  _rP
qr=uct {mg2C_ADDR_TDA8290en0,e8,_t->i2c_s  _rP
qr }al r+	 2c_ hca/fer(c%dadapte	, &easy_mode,d     1)al 	 2c_ hca/fer(c%dadapte	, r2c_msg_prolog,eARRAY* tru(i2c_msg_prolog))al r+	 2c_ hca/fer(c%dadapte	, &s  _rP
q,d      1)al 	 2c_ hca/fer(c%dadapte	, r2c_msg_e -fig,eARRAY* tru(i2c_msg_e -fig))al r+	msleep(550)al 	 2c_ hca/fer(c%dadapte	, r2c_msg_epilog,eARRAY* tru(i2c_msg_epilog)val 	36,) {
0 
+}l r+@
 	voiT. INs  _rP
quency(kes 0 ftuner *t, u16+ifc)
+{hA h_tyN5= (((t->eP
q<<3)+ifc)&th3fffcval ) wN5= NES Oma;
fP
q_;
 ry(div_table,_t->eP
q);hA	t->i2c_s  _rP
q[0] = 0;hA	t->i2c_s  _rP
q[1] = (lock, flach i)(N>>8);hA	t->i2c_s  _rP
q[2] = (lock, flach i) N;hA	t->i2c_s  _rP
q[3] = 0x40;l 	t->i2c_s  _rP
q[4] = 0x52;l 	t->i2c_s  _rP
q[5] = ma;
fP
q_;
 ry(band_table,_t->eP
q);hA	t->i2c_s  _rP
q[6] = ma;
fP
q_;
 ry(agc_table,d t->eP
q);hA	t->i2c_s  _rP
q[7] = 0x8fal }
+r+t mthca_V4L2_STD_MN	(V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)r+t mthca_V4L2_STD_B	(V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)r+t mthca_V4L2_STD_GH	(V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)r+t mthca_V4L2_STD_DK	(V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)l r+@
 	voiT. INs  _audio(kes 0 ftuner *t)
+{hA t->i2c_easy_mode[0] = 0x01al r+	if (t->stdm mV4L2_STD_MN)
+		t->i2c_easy_mode[1] = 0x01al "e) {_i	 (t->stdm mV4L2_STD_B)
+		t->i2c_easy_mode[1] = 0x02al "e) {_i	 (t->stdm mV4L2_STD_GH)
+		t->i2c_easy_mode[1] = 0x04al "e) {_i	 (t->stdm mV4L2_STD_PAL_I)
+		t->i2c_easy_mode[1] = 0x08al "e) {_i	 (t->stdm mV4L2_STD_DK)l 		t->i2c_easy_mode[1] = 0x10al 	e) {_i	 (t->stdm mV4L2_STD_SECAM_L)l 		t->i2c_easy_mode[1] = 0x20 
+}l r+@
 	voiT. INs  _tv_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval hA k  _audio(tval 	@  _rP
quency(t, 864val 	tda8290dtunecc) 
+}l r+@
 	voiT. INs  _radio_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	@  _rP
quency(t, 704val 	tda8290dtunecc) 
+}l r+@
 	voie;
+has_ck, 
lcree_ndsi2c_cli;
  *c)
+{hA lock, flach ibi2c_g  _afc[1] = {mth1B &pu+ lock, flach ibafc = 0;hAl 	 2c_master_ye_d(c_bi2c_g  _afc,eARRAY* tru(i2c_g  _afc))al 	 2c_master_RESE(c_ &afc,e1val 	36,) {
(afc &mth8q)? 65535:0 
+}l r+d t tda8290dnca_cree_ndsi2c_cli;
  *c)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval r+	);
lcpu_c%d ;
Rk "tda8290+75"k y =
 	(c%d ;
R)));
	tuner_o fo(" uner: type >  rto %sthca	c%d ;
R)al 	t->tv_fP
q(strucs  _tv_fP
qal 	t->radio_fP
qrucs  _radio_fP
q;hA t->has_ck, 
lruchas_ck, 
l;hAl 	 2c_master_ye_d(c_bi2c_enable_bridge,eARRAY* tru(i2c_enable_bridgeB)al 	 2c_ hca/fer(c%dadapte	, r2c_msg_nca_,eARRAY* tru(i2c_msg_nca_)val 	36,) {
0 
+}l r+eak+	* Ovreqides1f   Emacs sot2hat*wcofollow Linus' t2abb,TY,style
+	re ---------------------------------------------------------------------------+	re Local variables:r+	* e-basic-offs  : 8r+	* End:+	re/

+ * $Id$
a>qp_tab	qmedia/istro/tda9840.t  Y e( max,media/istro/tda9840.t{
+ dev->u->sq.media/istro/tda9840.te_nds =
-07 18:11:27qp_context->sq_size_u3media/istro/tda9840.te_nd%3 r I2 10:01:0	@@
 
 aYTHCA51c			51a6  wr;e can dree_ndsi2c_);
 		s);
 		;r;e can dree_ndsi2c_cli;
  cli;
 _tem
late)
+{
/* loique ID >=yeos	.wqee/
-@
 	voie;
+tda9840_idmt+		q-,2@
 	void t comm->rcree_ndsi2c_cli;
  *cli;
 , lock, flae;
+cmd,iT. IN*arg)r 0 */ ->lx,sult;=ye;
-79ts *17usp3y2-d+		/* fill cli;
  see_nduct asOr	memcpu_cli;
 , &cli;
 _tem
latek y =
 	(ree_ndsi2c_cli;
 )) 

 
li;
  ridmt+tda9840_id++;e<	cli;
  rucd	 = addx,ss;<<	cli;
  rucapte	 = adapte	;rA

+ * $Id$
a>qp_tab	qmedia/istro/tda9875.t  Y e( max,media/istro/tda9875.t{
+ dev->u->sq.media/istro/tda98750tax, %3 
-07 21:44:16qp_context->sq_size_u3media/istro/tda98750tax, %3 r I2 10:01:0	@@
 
 aYTHCA399a n 399a6  wr;e can dree_ndsi2c_cli;
  cli;
 _tem
late	 
*0 *********I2C_DEVNAME+"tda9875")segd       .idm=((str(ucA1,*dd       .);
 		str(hc&*;
 		,*de)
+{
+ * $Id$
a>qp_tab	qmedia/istro/tda9887.t  Y e( max,media/istro/tda9887.t{
+ dev->u->sq.media/istro/tda9887.tax, %3 2-04 07:54:57qp_context->sq_size_u3media/istro/tda9887.tax, %3 r I7 20:41:40g_nextndTHCA557a n 557a n wr;#ifuq;		/* Tee tas-e tbmcaks somt eardsk mus>lbcofixflae; a;			* eard-ex*	ifn dway, probably us,TY,TDA9887_SET_CONFIGrto

 ;y2 ,) {
on/off port2re/
+yy2 ,) {
on/off port2re/
 	i	 (t->stdm mV4L2_STD_SECAM_L) 0 */./*tsecamofixup (FIXME: movet2hi t2(Mtvnorm tarray?)re/
 	cbuf[1] &= ~cOutputPort2Inactize)

+ * $Id$
a>qp_tab	qmedia/istro/tea6415c0t  Y e( max,media/istro/tea6415c0t{
+ dev->u->sq.media/istro/tea6415c0te_nds =
-07 18:11:27qp_context->sq_size_u3media/istro/tea6415c0te_nd%3 r I2 10:01:0	@@
 
 aYTHCA51c			51a6  wr;e can dree_ndsi2c_);
 		s);
 		;r;e can dree_ndsi2c_cli;
  cli;
 _tem
late)
+{
/* loique ID >=yeos	.wqee/
-@
 	voie;
+tea6415c_idmt+		q-,2/* 2hi tfunc	.wqei tcalled bysi2c_probt asOr@
 	voie;
+detect(>sr **tr2c_adapte	 *adapte	, r;
+addx,ss, r;
+kind)r 0 THCA73a n 70sp3y2-d+		/* fill cli;
  see_nduct asOr	memcpu_cli;
 , &cli;
 _tem
latek y =
 	(ree_ndsi2c_cli;
 )) 

 
li;
  ridmt+tea6415c_id++;e<	cli;
  rucd	 = addx,ss;<<	cli;
  rucapte	 = adapte	;rA

+ * $Id$
a>qp_tab	qmedia/istro/tea64200t  Y e( max,media/istro/tea64200t{
+ dev->u->sq.media/istro/tea64200te_nds =
-07 18:11:27qp_context->sq_size_u3media/istro/tea64200tax, %3 r I2 10:01:0	@@
 
 aYTHCA48c			48a6  wr;e can dree_ndsi2c_);
 		s);
 		;r;e can dree_ndsi2c_cli;
  cli;
 _tem
late)
+{
/* loique ID >=yeos	.wqee/
-@
 	voie;
+tea6420_idmt+		q-,2/* make a(conne->.wqebetween 
 	sinput 'i'p->re
 	soutput 'o'*dd  with gaio 'g'1f     	stea6420-cli;
  'cli;
 ' (note: i = 6 meca/ 'mute') asOr@
 	voie;
+tea6420_)struccree_ndsi2c_cli;
  *cli;
 , 			qi, 			qo, 			qg)e +
*11post s08sp3y2-d+		/* fill cli;
  see_nduct asOr	memcpu_cli;
 , &cli;
 _tem
latek y =
 	(ree_ndsi2c_cli;
 )) 

 
li;
  ridmt+tea6420_id++;e<	cli;
  rucd	 = addx,ss;<<	cli;
  rucapte	 = adapte	;rA

+ * $Id$
a>qp_tab	qmedia/istro/tuner-30360t  Y e( max,media/istro/tuner-30360t{
+ dev->u->sq.media/istro/tuner-30360tax, %3 
-07 21:44:25g_nextnd/id\n");
 			emedia/istro/tuner-30360tax, %3 r I2 10:01:0	@@
 
 aYTHCA192ts *192tp3y2-dq ca_nextree_ndsi2c_cli;
  cli;
 _tem
late	 r 0 gd       .idmmthcA1,*dd       .);
 		mthc&o2c_);
 		_tuner,*d	.n;
Rmthc"SAB3036",*de)

+ * $Id$
a>qp_tab	qmedia/istro/tuner-core0t  Y e( max,media/istro/tuner-core0t{
+ d/ mt/null	WflaDec 31 16:00:00 1969j_e/id\n");
 			emedia/istro/tuner-core0te_nd%3 r I8 09:55:29@@
 
 aYTHCA0,0 +1,443  wr+eak+	* $Id: tuner-core0t,v 1.5 bP=
/02/ * 15:59:35 kraxel Exp $
+	*k+	* r2cptvatuner chiphduN) T dsize_r+	* e ct e ct, 	.e. kernela			erfaces,_reg.ster,TY,->resoton+	re/
+ +d nreq3,R<linux/moduleyh> +d nreq3,R<linux/module
+r;
yh> +d nreq3,R<linux/kernelyh> +d nreq3,R<linux/schedyh> +d nreq3,R<linux/str,TYyh> +d nreq3,R<linux/timeryh> +d nreq3,R<linux/delay.h> +d nreq3,R<linux/errnoyh> +d nreq3,R<linux/slabyh> +d nreq3,R<linux/poll.h> +d nreq3,R<linux/i2c0h> +d nreq3,R<linux/types0h> +d nreq3,R<linux/istrori9yh> +d nreq3,R<linux/nca_yh> +r+d nreq3,R<media/tuneryh> +d nreq3,R<media/audiochipyh> +r+d mthca_UNSET (-1U) +r+ea ca_ndard r2cpinsmod optioa/ e/
+@
 	voilock, flashort normal_i2c[]12 @@+	0x4b,2/* 2da8290re/
+yg2C_CLIENT_ENDa+}al @
 	voilock, flashort normal_i2c_range[]12 @@+	0x6q,lth6qe< 	g2C_CLIENT_ENDa+}al g2C_CLIENT_INSMODal r+ea insmod optioa/ used ubah;i
+ti
Rmt>_read/d.);
e/
+@
 	voilock, flar;
+addxr(hcW_va module_par;
(addx, i
 
mt444val r+ea insmod optioa/ used ubarunti
Rmt>_read/writt asO+lock, flae;
+tuner_debug  ( W_va module_par;
(tuner_debug,       i
 
mt644val r+@
 	voilock, flae;
+tv_range[2]str(hc{ 44, 958 &pu+@
 	voilock, flae;
+radio_range[2]shc{ 65, 108 }al r+module_par;
_array(tv_range,    i
 
msize
mt644val module_par;
_array(radio_range, i
 
msize
mt644val 
+MODULE_DESCRIPTION("duN) T dsize_1f   various TV,->reTV+FM radioatunerscval MODULE_AUTHOR("Ralph Metzle	, Gerd Knor	, Gunther Mayercval MODULE_LICENSE("GPL")al r+@
 	voie;
+thi _adapal r+@
 	voi@
e_ndsr2c_);
 		s);
 		;r+e can dree_ndsi2c_cli;
  cli;
 _tem
late)
+r+ea ----------------------------------------------------------------------re/
+r+// Se ftuner rP
quency,) fP
qae; U;i
sfo		62.5kHz0= 1/16MHz
+@
 	voiT. INs  _tv_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval hA i	 (t->type ==_UNSETB *) wqtuner_o fo("tuner type not s  thcval 	c36,) {;hA	}hA	i	 (size(==At->tv_fP
qB *) wqtuner_o fo("Huh?+tv_>  ri tsize?thcval 	c36,) {;hA	}hA	i	 (fP
qa<+tv_range[0]*16 ||lrP
qr>+tv_range[1]*16B *) wq/* FIXME: bette	 dot2hat*chip-ex*	ifn , butY+ca) lright now*wcodo['bahavet2hubah;   	se -figY+ca) lkes 0 f->re
 i twayri tstill bette	 2han noY+ca) lcheck uba	llqe/
+yctuner_o fo("TV,rP
qr(%d.%02d);
+}fo		ranger(%d-%d)thcaY+ca	   rP
q/16,rP
q%16*10w/16,tv_range[0],tv_range[1]val 	c36,) {;hA	}hA	t->tv_fP
q(c,eP
q);hA}l r+@
 	voiT. INs  _radio_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval hA i	 (t->type ==_UNSETB *) wqtuner_o fo("tuner type not s  thcval 	c36,) {;hA	}hA	i	 (size(==At->radio_fP
qB *) wqtuner_o fo("no radioatun,TY,f     i tone, sorry.thcval 	c36,) {;hA	}hA	i	 (fP
qa<+radio_range[0]*16 ||lrP
qr>+radio_range[1]*16B *) wqtuner_o fo("radioarP
qr(%d.%02d);
+}fo		ranger(%d-%d)thcaY+ca	   rP
q/16,rP
q%16*10w/16,Y+ca	   radio_range[0],radio_range[1]val 	c36,) {;hA	}hA	t->radio_fP
q(c,eP
q);hA}l r+@
 	voiT. INs  _fP
q(ree_ndsi2c_cli;
  *c, lock, flaloTY,fP
q)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval hA kstruct t->modeB *) w
+	ifV4L2_TUNER_RADIO:  	c uner_dbg("radioarP
qr>  rto %lu.%02luthcaY+ca	  rP
q/16,rP
q%16*10w/16val 	cs  _radio_fP
q(c,eP
q);hA	cbmcak;e+d
+	ifV4L2_TUNER_ANALOG_TV:e+d
+	ifV4L2_TUNER_DIGITAL_TV:  	c uner_dbg("tvarP
qr>  rto %lu.%02luthcaY+ca	  rP
q/16,rP
q%16*10w/16val 	cs  _tv_fP
q(c, eP
q);hA	cbmcak;e+d}hA	t->fP
qrucfP
q;hA}l r+@
 	voiT. INs  _type(ree_ndsi2c_cli;
  *c, lock, flae;
+type)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval hA ea ca;i
ylcheck e/
+yi	 (type ==_UNSET  ||l type ==_TUNER_ABSENT
+					qp->;hAyi	 (type >=+tuner_count
+					qp->;hAhA	i	 (size(==At->i2c0ri9y);
 		B *) wq/* not reg.sterflay  re/
+yct->type = typeal 	c36,) {;hA	}hA	i	 (t->ica_ialized)) wq/* runud.);
oncere/
+yc		qp->;hAhA	t->ica_ialized0= 1al 	t->type = typeal 	kstruct t->type) *) w
+	ifTUNER_MT2032:b 	c\icrotune_nca_cc)al 	cbmcak;e+d
+	ifTUNER_PHILIPS_TDA8290:  	c da8290dnca_cc)al 	cbmcak;e+ddefault:b 	cdefault_tuner_o a_cc)al 	cbmcak;e+d}hA}l r+@
 	voich ibpal[]12 "-"al module_par;
_str,TY(pal, pal, t644k y =
 	(pal))al r+@
 	voie;
+tuner_fixup_std(kes 0 ftuner *t)
+{hA i	 ((t->stdm mV4L2_STD_PAL)(==AV4L2_STD_PAL)(*) wq/* ma;smore pr*	i	ifnorm o fo+_5hc insmod optioare/
+yckstruct pal[0]B *) wd
+	if'b':) wd
+	if'B':) wd
+	if'g':) wd
+	if'G':) wdc uner_dbg("insmod fixup: PALmt>_PAL-BGthcval 	c	t->stdm=AV4L2_STD_PAL_BG;+			cbmcak;e+wd
+	if'i':) wd
+	if'I':) wdc uner_dbg("insmod fixup: PALmt>_PAL-Ithcval 	c	t->stdm=AV4L2_STD_PAL_I;+			cbmcak;e+wd
+	if'd':) wd
+	if'D':) wd
+	if'k':) wd
+	if'K':) wdc uner_dbg("insmod fixup: PALmt>_PAL-DKthcval 	c	t->stdm=AV4L2_STD_PAL_DK;+			cbmcak;e+wd}hA	}hA	36,) {
0 
+}l r+ea ----------------------------------------------------------------------re/
+r+@
 	voie;
+tuner_attauccree_ndsi2c_adapte	 *adap, r;
+addx, r;
+kind)r+{hA kes 0 ftuner *tal hA i	 (thi _adapr>+0
+					qp-> -1;hA thi _adap++;era+=((str( cli;
 _tem
late.ucapte	 = adap;a+=((str( cli;
 _tem
late.ucd	 = addx;era+=((str( tst+km>=yeof  =
 	(>sr **ttuner),GFP_ct mEeBUTA )      ifuqsize(==At)l  )                     -ENOMEMUTA )      mems  (te0,y =
 	(>sr **ttuner))UTA )      memcpu_&t->i2c,&cli;
 _tem
lateky =
 	(ree_ndsi2c_cli;
 )) 
 	 2c_sa;
cli;
  v;
	&t->i2c, t)al 	t->type ((str(ucUNSETal 	t->radio_if2truc10700*10wq; // 10.7MHz -sFM radioa+l  )      i2c_attauc
cli;
 	&t->i2c));
	tuner_o fo("chiphf u>r @W_x%xr(%s)thcaY+ca) lucd	 << 1, adap r ;
R)al 	s  _type(&t->i2c, t->type);hA 36,) {
0 
+}l r+@
 	void t tuner_probtcree_ndsi2c_adapte	 *adap)
+{hA i	 (0(!=Oucd	B *) wdnormal_i2c[0] ((str(ucaddx;erwdnormal_i2c_range[0](ucaddx;erwdnormal_i2c_range[1](ucaddx;erw}hA thi _adap = 0;hAl 	 	 (adap rclassm mg2C_CLASS_TV_ANALOG
+					qp-> i2c_probt(adap, &addx_ v;
,+tuner_attauc);hA 36,) {
0 
+}l r+@
 	void t tuner_detauccree_ndsi2c_cli;
  *cli;
 )
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cli;
 );hAl 	 2c_detauc
cli;
 	&t->i2c));
	kfP
e(tval 	36,) {
0 
+}l r+d mthca_SWITCH_V4L2	 	 (!t->us,TY_v4l2r&& tuner_debug) \Y+ca) l )     tuner_o fo("kstruc,TY,to v4l2thcva \Y+c   )       )      t->us,TY_v4l2r= 1al d mthca_CHECK_V4L2	 	 (t->us,TY_v4l2B * ifuqtuner_debug) \Y+ca	  tuner_o fo("k, ore v4l1tcallthcva \Y+c	                 0a }l r+@
 	void t
+tuner_comm->rcree_ndsi2c_cli;
  *cli;
 , lock, flae;
+cmd,iT. IN*arg)r+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cli;
 );hA )      lock, flae;
+*iarg = (e;
*)arg;era+=((str( )struct cmdB *) hA ea ---re -figurs	.wqe---re/
+d
+	ifTUNER_SET_TYPE:l 	cs  _type(cli;
 ,*iarg)al 	cbmcak;e+d
+	ifAUDC_SET_RADIO:  	cif (V4L2_TUNER_RADIO(!=Ot->modeB *) wqcs  _tv_fP
q(cli;
 ,400 * 16val 	c	t->modem=AV4L2_TUNER_RADIO;e+wd}hA	cbmcak;e+d
+	ifAUDC_CONFIG_PINNACLE:l 	csstruct *iarg) *) wd
+	if2:) wdc uner_dbg("pinnacle palthcval 	c	t->radio_if2t= 33300 * 10wq;hA	ccbmcak;e+wd
+	if3:) wdc uner_dbg("pinnacle ntscthcval 	c	t->radio_if2t= 41300 * 10wq;hA	ccbmcak;e+wd}l  )              Tmcak;e+l 	ea ---rv4l ioctlse---re/
+d/* 2ake care: bttvadoe/ userspac	se py,TY, we'll ma;saY+c   kernelapo			er herf...re/
+y
+	ifVIDIOCSCHAN:) w*) wd@
 	voiconst v4l2_std_idmmap[]12 @@+			[fVIDEO_MODE_PAL   ]m=AV4L2_STD_PAL,@+			[fVIDEO_MODE_NTSC  ]m=AV4L2_STD_NTSC_M,@+			[fVIDEO_MODE_SECAM ]m=AV4L2_STD_SECAM,@+			[f42/* bttva*/     ]m=AV4L2_STD_PAL_M,@+			[f52/* bttva*/     ]m=AV4L2_STD_PAL_N,@+			[f62/* bttva*/     ]m=AV4L2_STD_NTSC_M_JP,@+		}al 	cses 0 fistro_ch nnela*vc = arg;era+		CHECK_V4L2;
+yct->modem=AV4L2_TUNER_ANALOG_TV;  	cif (vc%d orm < ARRAY* tru(map))l 	c	t->stdm=Amap[vc%d orm]d  	c uner_fixup_std(t);  	cif (t->eP
q)) wqcs  _tv_fP
q(cli;
 ,t->eP
q);hA	c36,) {
0 
+	}hAy
+	ifVIDIOCSFREQ:) w*) wdlock, flaloTY,*v = arg;era+		CHECK_V4L2;
+ycs  _fP
q(cli;
 ,*v);hA	c36,) {
0 
+	}hAy
+	ifVIDIOCGTUNER:) w*) wd@
s 0 fistro_tuner *vt = arg;era+		CHECK_V4L2;
+ycif (V4L2_TUNER_RADIO(==At->mode r&&  t->has_ck, 
l)) wqcvt->sk, 
lruct->has_ck, 
l	cli;
 );hA	c36,) {
0 
+	}hAy
+	ifVIDIOCGAUDIO:  	*) wd@
s 0 fistro_audio *va = arg;era+		CHECK_V4L2;
+ycif (V4L2_TUNER_RADIO(==At->mode r&&  t->i _sterfoB< 	cava->modem=At->i _sterfo(cli;
 )
+k (	?fVIDEO_SOUND_STEREO
+k (	:fVIDEO_SOUND_MONO;hA	c36,) {
0 
+	}hAhAy
+	ifVIDIOC_S_STD:  	*) wdv4l2_std_idm*idmt+arg;era+		SWITCH_V4L2;
+yct->modem=AV4L2_TUNER_ANALOG_TV;  	ct->stdm=A*idd  	c uner_fixup_std(t);  	cif (t->eP
q)) wqcs  _fP
q(cli;
 ,t->eP
q);hA	cbmcak;e+d}hA	
+	ifVIDIOC_S_FREQUENCY:  	*) wd@
s 0 fi4l2_rP
quency *fmt+arg;era+		SWITCH_V4L2;
+ycif (V4L2_TUNER_RADIO(==Af->type &&l 		    V4L2_TUNER_RADIO(!=Ot->modeB) wqcs  _tv_fP
q(cli;
 ,400*16val 	ct->mode r=Af->typeal 	ct->fP
q(s=Af->rP
quency;
+ycs  _fP
q(cli;
 ,t->eP
q);hA	cbmcak;e+d}hA	
+	ifVIDIOC_G_TUNER:) w*) wd@
s 0 fi4l2_tuner *tuner t+arg;era+		SWITCH_V4L2;
+ycif (V4L2_TUNER_RADIO(==At->mode r&&  t->has_ck, 
l)) wqctuner->sk, 
lruct->has_ck, 
l	cli;
 );hA	cbmcak;e+d}hA	default:b 	c/* notc,TY,e/
+ycbmcak;e+d}hAhA 36,) {
0 
+}l r+@
 	void t tuner_suspe>rcree_ndsduN) T *sduN, l32 ca_ne, l32 level)r+{hA kes 0 fi2c_cli;
  *cruce -5ainer_ 	(duN, kes 0 fi2c_cli;
 ,sduNval 	@
e_ndstuner *tuf_r2c_ma;
cli;
  v;
	cval hA  uner_dbg("suspe>rthcval 	/* FIXME: powe_adown ???,e/
+y36,) {
0 
+}l r+@
 	void t tuner_x,sumecree_ndsduN) T *sduN, l32 level)r+{hA kes 0 fi2c_cli;
  *cruce -5ainer_ 	(duN, kes 0 fi2c_cli;
 ,sduNval 	@
e_ndstuner *tuf_r2c_ma;
cli;
  v;
	cval hA  uner_dbg("x,sumethcval 	if (t->eP
q)) wqs  _fP
q(c,t->eP
q);hA	36,) {
0 
+}l r+ea -----------------------------------------------------------------------re/
+r+@
 	voi@
e_ndsr2c_);
 		s);
 		12 @@+	.own		str( (str(ucTHIS_MODULEva+=((str( .n;
R str( (str(uc"tuner"va+=((str( .idm=((str( str(ucI2C_DRIVERID_TUNERva+=((str( .rq.loOstr( str(ucI2C_DF_NOTIFYva+=((str( .attauc
ucapte	 = tuner_probtva+=((str( .detauc
cli;
   = tuner_detaucva+=((str( .comm->rtr( str(uctuner_comm->r,@+	.);
 		12 @@+		.suspe>r(uctuner_suspe>r,@+		.x,sumer(uctuner_x,sume,@+	&va+}al ca_nextree_ndsi2c_cli;
  cli;
 _tem
late	 r+{hA I2C_DEVNAME+"(tuner locr_
")se+	.rq.loOstr( tcg2C_CLIENT_ALLOW_USEva+=((str( .d;
 		str( hc&*;
 		,*+}al r+@
 	voie;
+__h;i
+tuner_o a__module(T. I)r+{hA 		qp-> i2c_add_);
 		(&*;
 		);hA}l r+@
 	voiT. IN__exi
+tuner_cleanup_module(T. I)r+{hA  2c_del_);
 		(&*;
 		);hA}l r+module_o a_ctuner_o a__moduleval module_exi
(tuner_cleanup_moduleval r+eak+	* Ovreqides1f   Emacs sot2hat*wcofollow Linus' t2abb,TY,style
+	re ---------------------------------------------------------------------------+	re Local variables:r+	* e-basic-offs  : 8r+	* End:+	re/

+ * $Id$
a>qp_tab	qmedia/istro/tuner-sim
le0t  Y e( max,media/istro/tuner-sim
le0t{
+ d/ mt/null	WflaDec 31 16:00:00 1969j_e/id\n");
 			emedia/istro/tuner-sim
le0te_nd%3 r I8 09:55:29@@
 
 aYTHCA0,0 +1,467  wr+eak+	* $Id: tuner-sim
le0t,v 1.4 bP=
/02/ * 15:59:35 kraxel Exp $
+	*k+	* r2cptvatuner chiphduN) T dsize_r+	* e -5rols 	llqtho	ifsim
le 4-e -5rol-bytes,styleatuners
+	re/
+d nreq3,R<linux/delay.h> +d nreq3,R<linux/i2c0h> +d nreq3,R<linux/istrori9yh> +d nreq3,R<media/tuneryh> +r+ea ----------------------------------------------------------------------re/
+r+/* 2v ca_ndard sele->.wqef   Temvoi4046 FM5a+=((  i tvalu	 2akes 
 	slow bi
sfo		e -5rol byte 2a+=((_5hc  v;
sheet Ri9y01, Feb.j_e/str( )a_ndard     BG******I((str( L((str( L2(str( De/str( pinduct IFr( 38.9 r( 38.9 r( 38.9 r( 33.95r( 38.9e/str( ) u>r 1(str( 33.4tr( 32.9 r( 32.4tr( 40.45r( 32.4e/str( ) u>r 2(str( 33.16e/str( NICAM  (str( 33.05r( 32.348( 33.05r(   (str( 33.05+	re/
+d mthca_TEMIC_SET_PAL_I   (str( th05
+d mthca_TEMIC_SET_PAL_DK  (str( th09
+d mthca_TEMIC_SET_PAL_L   (str( th0a // SECAM ?
+d mthca_TEMIC_SET_PAL_L2  (str( th0b // ch ngt IFr!
+d mthca_TEMIC_SET_PAL_BG******( th0c
+r+/* 2v tuner system ca_ndard sele->.wqef   Philips FQ1216MEa+=((  i tvalu	 2akes 
 	slow bi
sfo		e -5rol byte 2a+=((_5hc  v;
sheet "1999 Nov 16" (supersedes1"1999 Mar 23")e/str( )a_ndard 		BG	DK	I	L	L`e/str( pinduct caeqier	38.90	38.90	38.90	38.90	33.95e/str( colour		34.47	34.47	34.47	34.47	38.38e/str( ) u>r 1		33.40	32.40	32.90	32.40	40.45e/str( ) u>r 2		33.16	-	-	-	-e/str( NICAM		33.05	33.05	32.35	33.05	39.80+	re/
+d mthca_PHILIPS_SET_PAL_I	0x012/* Bi
+2 	lways zero !e/
+d mthca_PHILIPS_SET_PAL_BGDK	th09
+d mthca_PHILIPS_SET_PAL_L2	th0a
+d mthca_PHILIPS_SET_PAL_L	th0b +r+ea cystem cstruc,TY,f   Philips FI1216MF MK2a+=((_5hc  v;
sheet "1996 Jul 09"va+=((s)a_ndard         BG*****L   (stL'a+=((spinduct caeqier( 38.90( 38.90( 33.95e/str(colour	str( 34.47( 34.37( 38.38e/str() u>r 1(str( tr( 33.40( 32.40( 40.45e/str() u>r 2(str( tr( 33.16  gd     -e/str(NICAM  (str( tr( 33.05r(33.05r(39.80+	re/
+d mthca_PHILIPS_MF_SET_BG	0x012/* Bi
+2 mus>lbcozero, Bi
+3ri tsystem output e/
+d mthca_PHILIPS_MF_SET_PAL_L	th03 // France
+d mthca_PHILIPS_MF_SET_PAL_L2	th02 // L'a+ +r+ea ----------------------------------------------------------------------re/
+r+@
e_ndstunertyper+{hA ch ib_6;
Rd   lock, flach ibVe>rord   lock, flach ibTypeal    lock, flashort thx,sh1; 2/*  band )structVHF_LO <=>tVHF_HI  e/
+ylock, flashort thx,sh2; 2/*  band )structVHF_HI <=>tUHF tr( e/
+ylock, flach ibVHF_L;
+ylock, flach ibVHF_H;
+ylock, flach ibUHF;
+ylock, flach ibe -fig;
+ylock, flashort IFPCoff;2/* 622.4=16*38.90(MHz PAL,@+				str732tru16*45.75sNTSCi,@+				str940( u16*58.75sNTSC-Japan@+				str704tru16*44tr( ATSC e/
+}al r+eak+	*	T 	sfloa
sfh;   	stuner ses 0 f-ct e mputed ubae mpileatimek+	*	by gccf->recas>lback,to 			egers
 Thus*wcodo['baviolate	  	k+	*	"no floa
fh; kernel" rule
+	re/l ca_nextree_ndstunertypeatuners[]12 @@+=((str( {m"TemvoiPAL (4002 FH5)",_TEMIC, PAL,@+	  16*140.25,16*463.25,th02,th04
0x01,0x8e,623&va+	{m"Philips PAL_I (FI1246 ->recompatibles)",_Philips, PAL_I,@+	  16*140.25,16*463.25,tha0,0x90,0x30,0x8e,623&va+	{m"Philips NTSC (FI1236,FM1236 ->recompatibles)",_Philips, NTSC,@+	  16*157.25,16*451.25,thA0,0x90,0x30,0x8e,732&va+	{m"Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)",_Philips, SECAM,@+	  16*168.25,16*447.25,thA7,0x97,0x37,0x8e,623&va+a+	{m"NoTuner"v NoTunerv NOTUNERva+	r 0,0,0x00,0x00,0x00,0x00,0x00&va+	{m"Philips PAL_BG*(FI1216 ->recompatibles)",_Philips, PAL,@+	  16*168.25,16*447.25,thA0,0x90,0x30,0x8e,623&va+	{m"TemvoiNTSC (4032tFY5)",_TEMIC, NTSC,@+	  16*157.25,16*463.25,th02,th04
0x01,0x8e,732&va+	{m"TemvoiPAL_I (4062tFY5)",_TEMIC, PAL_I,@+	  16*170.j_,16*450.j_,th02,th04
0x01,0x8e,623&va+@+=	{m"TemvoiNTSC (4036tFY5)",_TEMIC, NTSC,@+	  16*157.25,16*463.25,tha0,0x90,0x30,0x8e,732&va+=((str( {m"Alps HSBH1",_TEMIC, NTSC,@+	  16*137.25,16*385.25,th01,th02,th08,0x8e,732&va+=((str( {m"Alps TSBE1",TEMIC,PAL,@+	  16*137.25,16*385.25,th01,th02,th08,0x8e,732&va+=((str( {m"Alps TSBB5"k Alps, PAL_I,2/* 2ested (UKbUHF) with ModularteuctMM205re/
+yy 16*133.25,16*351.25,th01,th02,th08,0x8e,632&va+a+=((str( {m"Alps TSBE5"k Alps, PAL,2/* un2ested -  v;
 sheet guess
 O.);
IFr
+ *ers
 e/
+yy 16*133.25,16*351.25,th01,th02,th08,0x8e,622&va+=((str( {m"Alps TSBC5"k Alps, PAL,2/* un2ested -  v;
 sheet guess
 O.);
IFr
+ *ers
 e/
+yy 16*133.25,16*351.25,th01,th02,th08,0x8e,608&va+	{m"TemvoiPAL_BG*(4006FH5)",_TEMIC, PAL,@+	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va+ =	{m"Alps TSCH6",Alps,NTSC,@+ =	  16*137.25,16*385.25,th14
0x12,th11,0x8e,732&va+a+ =	{m"TemvoiPAL_DK (4016tFY5)",TEMIC,PAL,@+ =	  16*168.25,16*456.25,tha0,0x90,0x30,0x8e,623&va+ =	{m"Philips NTSC_M (MK2)",Philips,NTSC,@+ =	  16*160.j_,16*454.j_,tha0,0x90,0x30,0x8e,732&va+=((str( {m"TemvoiPAL_I (4066tFY5)",_TEMIC, PAL_I,@+(str( tr( 16*169.j_, 16*454.j_, tha0,0x90,0x30,0x8e,623&va+ =(str( {m"TemvoiPAL* auto (4006 FN5)",_TEMIC, PAL,@+(str( tr( 16*169.j_, 16*454.j_, tha0,0x90,0x30,0x8e,623&va+a+=((str( {m"TemvoiPAL_BG*(4009 FR5)    PAL_I (4069 FR5)",_TEMIC, PAL,@+(str( tr( 16*141.j_, 16*464.j_, tha0,0x90,0x30,0x8e,623&va+ =(str( {m"TemvoiNTSC (4039 FR5)",_TEMIC, NTSC,@+ =tr( tr( 16*158.j_, 16*453.j_, tha0,0x90,0x30,0x8e,732&va+=((str( {m"TemvoiPAL/SECAM multi (4046 FM5)",_TEMIC, PAL,@+(str( tr( 16*169.j_, 16*454.j_, tha0,0x90,0x30,0x8e,623&va+=((str( {m"Philips PAL_DK (FI1256 ->recompatibles)",_Philips, PAL,@+	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va+a+	{m"Philips PAL/SECAM multi (FQ1216ME)",_Philips, PAL,@+	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va+	{m"LG PAL_I+FM (TAPC-I001D)",_LGINNOTEK, PAL_I,@+	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va+	{m"LG PAL_I (TAPC-I701D)",_LGINNOTEK, PAL_I,@+	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va+	{m"LG NTSC+FM (TPI8NSR01F)",_LGINNOTEK, NTSC,@+	  16*210.j_,16*497.j_,tha0,0x90,0x30,0x8e,732&va+a+	{m"LG PAL_BG+FM (TPI8PSB01D)",_LGINNOTEK, PAL,@+	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va+	{m"LG PAL_BG*(TPI8PSB11D)",_LGINNOTEK, PAL,@+	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va+	{m"TemvoiPAL* auto +sFM (4009 FN5)",_TEMIC, PAL,@+	  16*141.j_, 16*464.j_, tha0,0x90,0x30,0x8e,623&va+	{m"SHARP NTSC_JP (2U5JF5540)",_SHARP, NTSC,2/* 940u16*58.75sNTSC@Japan e/
+yy 16*137.25,16*317.25,th01,th02,th08,0x8e,940(&va+a+	{m"SamsungiPAL TCPM9091PD27",_Samsung, PAL,22/* _5hc sourceforge v3tva*/@+(str( tr( 16*169,16*464,thA0,0x90,0x30,0x8e,623&va+	{m"MT20xx loi 			al",_Microtune,PAL|NTSC,@+	  /*tsee mt20xx.c,f   detail/ e/ &va+	{m"TemvoiPAL_BG*(4106 FH5)",_TEMIC, PAL,@+(str( tr( 16*141.j_, 16*464.j_, tha0,0x90,0x30,0x8e,623&va+	{m"TemvoiPAL_DK/SECAM_L (4012tFY5)",_TEMIC, PAL,@+(str( tr( 16*140.25, 16*463.25, th02,th04
0x01,0x8e,623&va+@+	{m"TemvoiNTSC (4136tFY5)",_TEMIC, NTSC,@+ =tr( tr( 16*158.j_, 16*453.j_, tha0,0x90,0x30,0x8e,732&va+=((str( {m"LG PAL (newe_aTAPCtseries)",_LGINNOTEK, PAL,@+ =tr( tr( 16*170.j_, 16*450.j_, th01,th02,th08,0x8e,623&va+	{m"Philips PAL/SECAM multi (FM1216ME MK3)",_Philips, PAL,@+	  16*160.j_,16*442.j_,th01,th02,th04
0x8e,623 &va+	{m"LG NTSC (newe_aTAPCtseries)",_LGINNOTEK, NTSC,@+ =tr( tr( 16*170.j_, 16*450.j_, th01,th02,th08,0x8e,732&va+a+	{m"HITACHI V7-J180AT",_HITACHI, NTSC,@+	  16*170.j_, 16*450.j_, th01,th02,th08,0x8e,940(&va+	{m"Philips PAL_MK*(FI1216 MK)",_Philips, PAL,@+	  16*140.25,16*463.25,th01,thc2,thcf,0x8e,623&va+	{m"Philips 1236D ATSC/NTSC daula		",Philips,ATSC,@+	  16*157.25,16*454.j_,tha0,0x90,0x30,0x8e,732&va+=((str( {m"Philips NTSC MK3 (FM1236MK3    FM1236/F)",_Philips, NTSC,@+(str( tr( 16*160.j_,16*442.j_,th01,th02,th04
0x8e,732&va+a+=((str( {m"Philips 4a		 1 (ATI TV,Wond		sPro/Conexant)",_Philips, NTSC,@+(str( tr( 16*160.j_,16*442.j_,th01,th02,th04
0x8e,732&va+	{m"Microtunei4049 FM5",Microtune,PAL,@+	  16*141.j_,16*464.j_,tha0,0x90,0x30,0x8e,623&va+	{m"PanasonvoiVP27s/ENGE4324D",_Panasonvo, NTSC,@+	  16*160.j_,16*454.j_,th01,th02,th08,0xce,940&va+=((str( {m"LG NTSC (TAPEtseries)",_LGINNOTEK, NTSC,@+ =tr( tr( 16*160.j_,16*442.j_,th01,th02,th04
0x8e,732 &va+a+=((str( {m"Tenna TNF 8831 BGFF)",_Philips, PAL,@+ =tr( tr( 16*161.25,16*463.25,tha0,0x90,0x30,0x8e,623&va+	{m"Microtunei4042tFI5 ATSC/NTSC duala		",_Microtune, NTSC,@+	  16*162.j_,16*457.j_,tha2,th94
0x31,0x8e,732&va+=((str( {m"TCL bP=2N",_TCL, NTSC,@+ =tr( tr( 16*172.j_,16*448.j_,th01,th02,th08,0x8e,732&va+	{m"Philips PAL/SECAM_D (FM 1256 I-H3)",_Philips, PAL,@+	  16*160.j_,16*442.j_,th01,th02,th04
0x8e,623 &va+@+	{m"Thomson DDT 7610 (ATSC/NTSC)",_THOMSON, ATSC,@+	  16*157.25,16*454.j_,th39,th3a,th3c,0x8e,732&va+	{m"Philips FQ1286",_Philips, NTSC,@+	  16*160.j_,16*454.j_,th41,th42,th04
0x8e,940&v // UHF band un2esteda+	{m"tda8290+75"k Philips,PAL|NTSC,@+	  /*tsee tda8290.t f   detail/ e/ &va+
+}al lock, flaconst d t tuner_count = ARRAY* tru(tuners);l r+ea ----------------------------------------------------------------------re/
+r+@
 	voie;
+tuner_get@
 	uscree_ndsi2c_cli;
  *c)
+{hA lock, flach ibbyte;hAl 	 	 (1(!=O 2c_master_RESE(c_&byte,1))hA	c36,) {
0 
+	36,) {
byte;hA}l r+d mthca_TUNER_POR*****( th80+	d mthca_TUNER_FL******( th40+	d mthca_TUNER_MODE****( th38e/d mthca_TUNER_AFC*****( th07l r+d mthca_TUNER_STEREO**( th10 /* radioamode e/
+d mthca_TUNER_SIGNAL    th07 /* radioamode e/
+r+@
 	void t tuner_sk, 
lcree_ndsi2c_cli;
  *c)
+{hA 36,) {
(tuner_get@
 	uscc) &_TUNER_SIGNAL)<<13 
+}l r+@
 	void t tuner_sterfo(ree_ndsi2c_cli;
  *c)
+{hA 36,) {
(tuner_get@
 	us cc) &_TUNER_STEREO);hA}l r+#ifuq2/* unused e/l ca_nextd t tuner_islocked (ree_ndsi2c_cli;
  *c)
+{hA               (tuner_get@
 	us cc) &_TUNER_FL) 
+}l r+@
 	void t tuner_afc@
 	us cree_ndsi2c_cli;
  *c)
+{hA               (tuner_get@
 	us cc) &_TUNER_AFC)ail2 
+}l r+@
 	void t tuner_mode cree_ndsi2c_cli;
  *c)
+{hA               (tuner_get@
 	us cc) &_TUNER_MODE)ES O3 
+}l #endifl r+ea ----------------------------------------------------------------------re/
+r+@
 	voiT. INdefault_s  _tv_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval 	u8be -fig;
+yl16 dival 	@
e_ndstunertypea*tun;hA )      lock, flach ibbu *er[4]d  	e;
+rcal hA  un hc&tuners[t->type];hA	i	 (fP
qa<+tun->thx,sh1) *) wd
 -fig(uctun->VHF_L;
+yc uner_dbg("tv:bVHFslowrangethcval 	} e) {_i	 (fP
qa<+tun->thx,sh2) *) wd
 -fig(uctun->VHF_H;
+yc uner_dbg("tv:bVHFshigh rangethcval 	} e) {_*) wd
 -fig(uctun->UHF;
+yc uner_dbg("tv:bUHF rangethcval 	}a+ +r+	/* 2v  orm ex*	ifn dstu * f   multi- orm tuners e/
+ykstruct t->type) *) w
+	ifTUNER_PHILIPS_SECAM: // FI1216MFb 	c/* 0x012-> ???,no ch ngt ???,e/
+yc/* 0x022-> PAL BDGHI / SECAM L,e/
+yc/* 0x042-> ???,PAL others / SECAM others ???,e/
+yc
 -fig(&= ~0x02al "	i	 (t->stdm mV4L2_STD_SECAM)) wqc
 -fig(|= 0x02al "	Tmcak;e+l 	
+	ifTUNER_TEMIC_4046FM5:
+yc
 -fig(&= ~0x0f;era+		i	 (t->stdm mV4L2_STD_PAL_BG) {) wqc
 -fig(|= TEMIC_SET_PAL_BG;era+		} e) {_i	 (t->stdm mV4L2_STD_PAL_I) {) wqc
 -fig(|= TEMIC_SET_PAL_I;era+		} e) {_i	 (t->stdm mV4L2_STD_PAL_DK) {) wqc
 -fig(|= TEMIC_SET_PAL_DK;+	a+		} e) {_i	 (t->stdm mV4L2_STD_SECAM_L) 0  wqc
 -fig(|= TEMIC_SET_PAL_L;+	a+		}l "	Tmcak;e+l 	
+	ifTUNER_PHILIPS_FQ1216ME:
+yc
 -fig(&= ~0x0f;era+		i	 (t->stdm m(V4L2_STD_PAL_BG|V4L2_STD_PAL_DK)) 0  wqc
 -fig(|= PHILIPS_SET_PAL_BGDK;era+		} e) {_i	 (t->stdm mV4L2_STD_PAL_I) {) wqc
 -fig(|= PHILIPS_SET_PAL_I;+	a+		} e) {_i	 (t->stdm mV4L2_STD_SECAM_L) 0  wqc
 -fig(|= PHILIPS_SET_PAL_L;+	a+		}l "	Tmcak;e+l 	
+	ifTUNER_PHILIPS_ATSC:
+yc/* 0x002-> ATSC antenna input 1,e/
+yc/* 0x012-> ATSC antenna input 2,e/
+yc/* 0x022-> NTSC antenna input 1,e/
+yc/* 0x032-> NTSC antenna input 2,e/
+yc
 -fig(&= ~0x03al "	i	 (!(t->stdm mV4L2_STD_ATSC))) wqc
 -fig(|= 2al "	/* FIXME: input e/
+ycbmcak;e+) w
+	ifTUNER_MICROTUNE_4042FI5:
+yc/* Se ft 	seh igt pump f   fas>ltun,TY,e/
+yctun->
 -fig(|= 0x40;l 	cbmcak;e+d}hAhA eak+yy2 Philips FI1216MK2   mark _5hc sx*	ifn s	.wqe:k+yy2 f   ch nnelasele->.wqeinvolv,TY,band )struc,TY, ->re
o ensurek+yy2 smoothltun,TY,2(Mt 	sdesirflach nnelawith
+}fcaus,TYk+yy2 unne-essaryseh igt pump a->.wq, i ri tRESommendere
o conside_r+yy2 , 	sd+ *erencerbetween wantelach nnelarP
quency ->re
 	r+yy2 curr;
  ch nnelarP
quency.  Unne-essaryseh igt pump a->.wqr+yy2 will x,sulta		 veryslow tun,TY,voltagt whiuctmay dsizee
 	r+yy2 oscillat    o ext  m	se -ditioa/.r+yy2k+yy2 Progfou: sx*	ifn s	.wqesays  o ye_dbe -fig  v;
 befor	r+yy2 rP
quency 		 
+	if(wantelarP
quency < curr;
  rP
quency).r+yy2/
+r+	div=fP
qa+ctun->IFPCoff;hA i	 (t->type ==_TUNER_PHILIPS_SECAMr&& fP
qa<+t->eP
q) 0  wqbu *er[0](uctun->
 -fig;  wqbu *er[1](uc
 -fig;  wqbu *er[2] = (div>>8) &mth7f;  wqbu *er[3] = div      &mthff;hA } e) {_*) wdbu *er[0](uc(div>>8) &mth7f;  wqbu *er[1] = div      &mthff;hA qbu *er[2] = tun->
 -fig;  wqbu *er[3](uc
 -fig;  w}hA  uner_dbg("2v 0x%02x 0x%02x 0x%02x 0x%02xthcaY+ca) bu *er[0],bu *er[1],bu *er[2],bu *er[3]);era+=((str( i	 (4(!=O(rc =O 2c_master_ye_d(c_bu *er,4)))) wq uner_warn("r2cpi/o error: rc == %d (rh
+ldlbco4)thcarcval hA i	 (t->type ==_TUNER_MICROTUNE_4042FI5)(*) wq// FIXMEail  i tmay also work _   other tuners) wdlock, flaloTY,time
+}f= j+ *iesa+cmsecs_to_j+ *ies(1val 		u8b@
 	us_byte = 0;hAl 	c/* Wai runtil , 	sPLL locks e/
+y	_   (;;) 0  wqci	 (time_after(j+ *ies,time
+}))) wqcc36,) {;hA			 	 (1(!=O(rc =O 2c_master_RESE(c_&@
 	us_byte,1))) 0  wqcq uner_warn("r2cpi/o read error: rc == %d (rh
+ldlbco1)thcarcval 		ccbmcak;e+wd	}l "	c/* bi r6ri tPLL lockflae;dn s	   e/
+y		 	 (@
 	us_byte & 0x40)l 		ccbmcak;e+wd	udelay(10)al 	d}hAhA c/* Se ft 	seh igt pump f   optimized0pha	ifnoi	iffigure,e/
+yctun->
 -fig(&= ~0x40;l 	cbu *er[0](uc(div>>8) &mth7f;  wqbu *er[1] = div      &mthff;hA qbu *er[2] = tun->
 -fig;  wqbu *er[3](uc
 -fig;  w  uner_dbg("2v 0x%02x 0x%02x 0x%02x 0x%02xthcaY+ca)      Tu *er[0],bu *er[1],bu *er[2],bu *er[3]);era+		 	 (4(!=O(rc =O 2c_master_ye_d(c_bu *er,4)))) wqq uner_warn("r2cpi/o error: rc == %d (rh
+ldlbco4)thcarcval d}hA}l r+@
 	voiT. INdefault_s  _radio_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
+{hA kes 0 ftunertypea*tun;hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval  )      lock, flach ibbu *er[4]d  	lock, fladival 	e;
+rcal hA  un=&tuners[t->type];hA	div ucfP
qa+c(e;
)(16*10.7val dbu *er[2] = tun->
 -fig;  
+ykstruct t->type) *) w
+	ifTUNER_PHILIPS_FM1216ME_MK3:) w
+	ifTUNER_PHILIPS_FM1236_MK3:) wqbu *er[3](uc0x19al 	cbmcak;e+d
+	ifTUNER_PHILIPS_FM1256_IH3:) wqdiv uc(20y2 rP
q)/16a+c333y2 2al " )      Tu *er[2] = 0x80;) wqbu *er[3](uc0x19al 	cbmcak;e+d
+	ifTUNER_LG_PAL_FM:) wqbu *er[3](uc0xa5al 	cbmcak;e+ddefault:b 	cbu *er[3](uc0xa4;l 	cbmcak;e+d}hA )      Tu *er[0](uc(div>>8) &mth7f;   )      Tu *er[1] = div      &mthff;hAhA  uner_dbg("xadioa0x%02x 0x%02x 0x%02x 0x%02xthcaY+c)      Tu *er[0],bu *er[1],bu *er[2],bu *er[3]);era+=((str( i	 (4(!=O(rc =O 2c_master_ye_d(c_bu *er,4)))) wq uner_warn("r2cpi/o error: rc == %d (rh
+ldlbco4)thcarcval }l r+d t default_tuner_o a_cree_ndsi2c_cli;
  *c)
+{hA kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval r+	tuner_o fo("type >  rto %dr(%s)thcaY+ca) lt->type, tuners[t->type]. ;
R)al 	s;
lcpu_c%d ;
Rk tuners[t->type]. ;
Rk y =
 	(c%d ;
R)));
l 	t->tv_fP
q(strucdefault_s  _tv_fP
qal 	t->radio_fP
qrucdefault_s  _radio_fP
q;hA t->has_ck, 
lructuner_sk, 
l;hA	t->i _sterfor(uctuner_sterfoal 	36,) {
0 
+}l r+eak+	* Ovreqides1f   Emacs sot2hat*wcofollow Linus' t2abb,TY,style
+	re ---------------------------------------------------------------------------+	re Local variables:r+	* e-basic-offs  : 8r+	* End:+	re/

+ * $Id$
a>qp_tab	qmedia/istro/tuneryt  Y e( max,media/istro/tuner0t{
+ dev->u->sq.media/istro/tuner0tax, %3 
-25 13:50:26qp_context->/ mt/null	WflaDec 31 16:00:00 1969j_eTHCA1,1425 +0,0 @@{
/*
-	* $Id: tuner0t,v 1.36 bP=
/01/14 13:29:40gkraxel Exp $
-re/
-
-d nreq3,R<linux/moduleyh> -d nreq3,R<linux/module
+r;
yh> -d nreq3,R<linux/kernelyh> -d nreq3,R<linux/schedyh> -d nreq3,R<linux/str,TYyh> -d nreq3,R<linux/timeryh> -d nreq3,R<linux/delay.h> -d nreq3,R<linux/errnoyh> -d nreq3,R<linux/slabyh> -d nreq3,R<linux/poll.h> -d nreq3,R<linux/i2c0h> -d nreq3,R<linux/types0h> -d nreq3,R<linux/istrori9yh> -d nreq3,R<linux/nca_yh> -
-d nreq3,R<media/tuneryh> -d nreq3,R<media/audiochipyh> -
-d mthca_UNSET (-1U) -{
/* ca_ndard r2cpinsmod optioa/ e/
-@
 	voilock, flashort normal_i2c[]12 @g2C_CLIENT_END};
-@
 	voilock, flashort normal_i2c_range[]12 @0x6q,th6qeg2C_CLIENT_END};
-g2C_CLIENT_INSMODal-{
/* insmod optioa/ used ubah;i
+ti
Rmt>_read/d.);
e/
-@
 	voilock, flae;
+type (= cUNSETal-@
 	voilock, flar;
+addxr(hcW_va-module_par;
(type, i
 
mt444val-module_par;
(addx, i
 
mt444val-{
/* insmod optioa/ used ubarunti
Rmt>_read/writt asO-@
 	voilock, flar;
+debug  (Ostr( tc0al-@
 	voilock, flar;
+tv_antenna r( tc1al-@
 	voilock, flar;
+radio_antenna tc0al-@
 	voilock, flar;
+optimize_vco( tc1al-module_par;
(debug,             i
 
mt644val-module_par;
(tv_antenna,        i
 
mt644val-module_par;
(radio_antenna,     i
 
mt644val-module_par;
(optimize_vco,      i
 
mt644val-l-@
 	voilock, flar;
+tv_range[2]str(hc{ 44, 958 &pu-@
 	voilock, flae;
+radio_range[2]shc{ 65, 108 }al-l-module_par;
_array(tv_range,    i
 
msize
mt644val-module_par;
_array(radio_range, i
 
msize
mt644val-l-MODULE_DESCRIPTION("duN) T dsize_1f   various TV,->reTV+FM radioatunerscval-MODULE_AUTHOR("Ralph Metzle	, Gerd Knor	, Gunther Mayercval-MODULE_LICENSE("GPL")al-
-@
 	voie;
+thi _adapal-d mthca_dpr,Ttkstr( i	 (debug) pr,Ttkl-
-@
s 0 ftuner {
-	lock, flae;
+type;            /* chiphtypea*/
-	lock, flae;
+fP
q;            /* keephtrack,offt 	seurr;
  s  t,TY/ e/
-dv4l2_std_idm cad 

 e;
++++++++++us,TY_v4l2al-
-	enumfi4l2_tuner_typeamode;
-	lock, flae;
+inputal-
-	//ud.);
f   MT2032
-	lock, flae;
+xogc;
-	lock, flae;
+radio_if2al-
-	T. IN(*tv_fP
qB(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q);
-	T. IN(*radio_fP
qB(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q);
-}al-
-@
 	voi@
e_ndsr2c_);
 		s);
 		;r-e can dree_ndsi2c_cli;
  cli;
 _tem
late)
-{
/* ----------------------------------------------------------------------re/
-{
/* 2v ca_ndard sele->.wqef   Temvoi4046 FM5a-=((  i tvalu	 2akes 
 	slow bi
sfo		e -5rol byte 2a-=((_5hc  v;
sheet Ri9y01, Feb.j_e-str( )a_ndard     BG******I((str( L((str( L2(str( De-str( pinduct IFr( 38.9 r( 38.9 r( 38.9 r( 33.95r( 38.9e-str( ) u>r 1(str( 33.4tr( 32.9 r( 32.4tr( 40.45r( 32.4e-str( ) u>r 2(str( 33.16e-str( NICAM  (str( 33.05r( 32.348( 33.05r(   (str( 33.05+-re/
-d mthca_TEMIC_SET_PAL_I   (str( th05
-d mthca_TEMIC_SET_PAL_DK  (str( th09
-d mthca_TEMIC_SET_PAL_L   (str( th0a // SECAM ?
-d mthca_TEMIC_SET_PAL_L2  (str( th0b // ch ngt IFr!
-d mthca_TEMIC_SET_PAL_BG******( th0c
-{
/* 2v tuner system ca_ndard sele->.wqef   Philips FQ1216MEa-=((  i tvalu	 2akes 
 	slow bi
sfo		e -5rol byte 2a-=((_5hc  v;
sheet "1999 Nov 16" (supersedes1"1999 Mar 23")e-str( )a_ndard 		BG	DK	I	L	L`e-str( pinduct caeqier	38.90	38.90	38.90	38.90	33.95e-str( colour		34.47	34.47	34.47	34.47	38.38e-str( ) u>r 1		33.40	32.40	32.90	32.40	40.45e-str( ) u>r 2		33.16	-	-	-	-e-str( NICAM		33.05	33.05	32.35	33.05	39.80+-re/
-d mthca_PHILIPS_SET_PAL_I	0x012/* Bi
+2 	lways zero !e/
-d mthca_PHILIPS_SET_PAL_BGDK	th09
-d mthca_PHILIPS_SET_PAL_L2	th0a
-d mthca_PHILIPS_SET_PAL_L	th0b -{
/* cystem cstruc,TY,f   Philips FI1216MF MK2a-=((_5hc  v;
sheet "1996 Jul 09"va-=((s)a_ndard         BG*****L   (stL'a-=((spinduct caeqier( 38.90( 38.90( 33.95e-str(colour	str( 34.47( 34.37( 38.38e-str() u>r 1(str( tr( 33.40( 32.40( 40.45e-str() u>r 2(str( tr( 33.16  gd     -e-str(NICAM  (str( tr( 33.05r(33.05r(39.80+-re/
-d mthca_PHILIPS_MF_SET_BG	0x012/* Bi
+2 mus>lbcozero, Bi
+3ri tsystem output e/
-d mthca_PHILIPS_MF_SET_PAL_L	th03 // France
-d mthca_PHILIPS_MF_SET_PAL_L2	th02 // L'a-
-{
/* ----------------------------------------------------------------------re/
-{
@
e_ndstunertyper-{
-	ch ib_6;
Rd - lock, flach ibVe>rord - lock, flach ibTypeal- - lock, flashort thx,sh1; 2/*  band )structVHF_LO <=>tVHF_HI  e/
-ylock, flashort thx,sh2; 2/*  band )structVHF_HI <=>tUHF tr( e/
-ylock, flach ibVHF_L;
-ylock, flach ibVHF_H;
-ylock, flach ibUHF;
-ylock, flach ibe -fig;
-ylock, flashort IFPCoff;2/* 622.4=16*38.90(MHz PAL,@-				str732tru16*45.75sNTSCi,@-				str940( u16*58.75sNTSC-Japan@-				str704tru16*44tr( ATSC e/
-}al-
-/*
-	*	T 	sfloa
sfh;   	stuner ses 0 f-ct e mputed ubae mpileatimek-	*	by gccf->recas>lback,to 			egers
 Thus*wcodo['baviolate	  	k-	*	"no floa
fh; kernel" rule
+- asO-@
 	voiree_ndstunertypeatuners[]12 @@-=((str( {m"TemvoiPAL (4002 FH5)",_TEMIC, PAL,@-	  16*140.25,16*463.25,th02,th04
0x01,0x8e,623&va-	{m"Philips PAL_I (FI1246 ->recompatibles)",_Philips, PAL_I,@-	  16*140.25,16*463.25,tha0,0x90,0x30,0x8e,623&va-	{m"Philips NTSC (FI1236,FM1236 ->recompatibles)",_Philips, NTSC,@-	  16*157.25,16*451.25,thA0,0x90,0x30,0x8e,732&va-	{m"Philips (SECAM+PAL_BG) (FI1216MF, FM1216MF, FR1216MF)",_Philips, SECAM,@-	  16*168.25,16*447.25,thA7,0x97,0x37,0x8e,623&va-a-	{m"NoTuner"v NoTunerv NOTUNERva-	r 0,0,0x00,0x00,0x00,0x00,0x00&va-	{m"Philips PAL_BG*(FI1216 ->recompatibles)",_Philips, PAL,@-	  16*168.25,16*447.25,thA0,0x90,0x30,0x8e,623&va-	{m"TemvoiNTSC (4032tFY5)",_TEMIC, NTSC,@-	  16*157.25,16*463.25,th02,th04
0x01,0x8e,732&va-	{m"TemvoiPAL_I (4062tFY5)",_TEMIC, PAL_I,@-	  16*170.j_,16*450.j_,th02,th04
0x01,0x8e,623&va-e-s	{m"TemvoiNTSC (4036tFY5)",_TEMIC, NTSC,@-	  16*157.25,16*463.25,tha0,0x90,0x30,0x8e,732&va-=((str( {m"Alps HSBH1",_TEMIC, NTSC,@-	  16*137.25,16*385.25,th01,th02,th08,0x8e,732&va-=((str( {m"Alps TSBE1",TEMIC,PAL,@-	  16*137.25,16*385.25,th01,th02,th08,0x8e,732&va-=((str( {m"Alps TSBB5"k Alps, PAL_I,2/* 2ested (UKbUHF) with ModularteuctMM205re/
-yy 16*133.25,16*351.25,th01,th02,th08,0x8e,632&va-a-=((str( {m"Alps TSBE5"k Alps, PAL,2/* un2ested -  v;
 sheet guess
 O.);
IFr
+ *ers
 e/
-yy 16*133.25,16*351.25,th01,th02,th08,0x8e,622&va-=((str( {m"Alps TSBC5"k Alps, PAL,2/* un2ested -  v;
 sheet guess
 O.);
IFr
+ *ers
 e/
-yy 16*133.25,16*351.25,th01,th02,th08,0x8e,608&va-	{m"TemvoiPAL_BG*(4006FH5)",_TEMIC, PAL,@-	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va- =	{m"Alps TSCH6",Alps,NTSC,@- =	  16*137.25,16*385.25,th14
0x12,th11,0x8e,732&va-a- =	{m"TemvoiPAL_DK (4016tFY5)",TEMIC,PAL,@- =	  16*168.25,16*456.25,tha0,0x90,0x30,0x8e,623&va- =	{m"Philips NTSC_M (MK2)",Philips,NTSC,@- =	  16*160.j_,16*454.j_,tha0,0x90,0x30,0x8e,732&va-=((str( {m"TemvoiPAL_I (4066tFY5)",_TEMIC, PAL_I,@-(str( tr( 16*169.j_, 16*454.j_, tha0,0x90,0x30,0x8e,623&va- =(str( {m"TemvoiPAL* auto (4006 FN5)",_TEMIC, PAL,@-(str( tr( 16*169.j_, 16*454.j_, tha0,0x90,0x30,0x8e,623&va-a-=((str( {m"TemvoiPAL_BG*(4009 FR5)    PAL_I (4069 FR5)",_TEMIC, PAL,@-(str( tr( 16*141.j_, 16*464.j_, tha0,0x90,0x30,0x8e,623&va- =(str( {m"TemvoiNTSC (4039 FR5)",_TEMIC, NTSC,@- =tr( tr( 16*158.j_, 16*453.j_, tha0,0x90,0x30,0x8e,732&va-=((str( {m"TemvoiPAL/SECAM multi (4046 FM5)",_TEMIC, PAL,@-(str( tr( 16*169.j_, 16*454.j_, tha0,0x90,0x30,0x8e,623&va- =(str( {m"Philips PAL_DK (FI1256 ->recompatibles)",_Philips, PAL,@-	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va-a-	{m"Philips PAL/SECAM multi (FQ1216ME)",_Philips, PAL,@-	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va-	{m"LG PAL_I+FM (TAPC-I001D)",_LGINNOTEK, PAL_I,@-	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va-	{m"LG PAL_I (TAPC-I701D)",_LGINNOTEK, PAL_I,@-	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va-	{m"LG NTSC+FM (TPI8NSR01F)",_LGINNOTEK, NTSC,@-	  16*210.j_,16*497.j_,tha0,0x90,0x30,0x8e,732&va-a-	{m"LG PAL_BG+FM (TPI8PSB01D)",_LGINNOTEK, PAL,@-	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va-	{m"LG PAL_BG*(TPI8PSB11D)",_LGINNOTEK, PAL,@-	  16*170.j_,16*450.j_,tha0,0x90,0x30,0x8e,623&va-	{m"TemvoiPAL* auto +sFM (4009 FN5)",_TEMIC, PAL,@-	  16*141.j_, 16*464.j_, tha0,0x90,0x30,0x8e,623&va-	{m"SHARP NTSC_JP (2U5JF5540)",_SHARP, NTSC,2/* 940u16*58.75sNTSC@Japan e/
-yy 16*137.25,16*317.25,th01,th02,th08,0x8e,940(&va-a-	{m"SamsungiPAL TCPM9091PD27",_Samsung, PAL,22/* _5hc sourceforge v3tva*/@-(str( tr( 16*169,16*464,thA0,0x90,0x30,0x8e,623&va-	{m"MT20xx loi 			al",_Microtune,PAL|NTSC,@-)              0,0,0,0,0,0,0&va-	{m"TemvoiPAL_BG*(4106 FH5)",_TEMIC, PAL,@-(str( tr( 16*141.j_, 16*464.j_, tha0,0x90,0x30,0x8e,623&va-	{m"TemvoiPAL_DK/SECAM_L (4012tFY5)",_TEMIC, PAL,@-(str( tr( 16*140.25, 16*463.25, th02,th04
0x01,0x8e,623&va-a-	{m"TemvoiNTSC (4136tFY5)",_TEMIC, NTSC,@- =tr( tr( 16*158.j_, 16*453.j_, tha0,0x90,0x30,0x8e,732&va-=((str( {m"LG PAL (newe_aTAPCtseries)",_LGINNOTEK, PAL,@- =tr( tr( 16*170.j_, 16*450.j_, th01,th02,th08,0x8e,623&va-	{m"Philips PAL/SECAM multi (FM1216ME MK3)",_Philips, PAL,@-	  16*160.j_,16*442.j_,th01,th02,th04
0x8e,623 &va-	{m"LG NTSC (newe_aTAPCtseries)",_LGINNOTEK, NTSC,@- =tr( tr( 16*170.j_, 16*450.j_, th01,th02,th08,0x8e,732&va-a-	{m"HITACHI V7-J180AT",_HITACHI, NTSC,@-	  16*170.j_, 16*450.j_, th01,th02,th08,0x8e,940(&va-	{m"Philips PAL_MK*(FI1216 MK)",_Philips, PAL,@-	  16*140.25,16*463.25,th01,thc2,thcf,0x8e,623&va-	{m"Philips 1236D ATSC/NTSC daula		",Philips,ATSC,@-	  16*157.25,16*454.j_,tha0,0x90,0x30,0x8e,732&va-=((str( {m"Philips NTSC MK3 (FM1236MK3    FM1236/F)",_Philips, NTSC,@-(str( tr( 16*160.j_,16*442.j_,th01,th02,th04
0x8e,732&va-a-=((str( {m"Philips 4a		 1 (ATI TV,Wond		sPro/Conexant)",_Philips, NTSC,@-(str( tr( 16*160.j_,16*442.j_,th01,th02,th04
0x8e,732&va-	{m"Microtunei4049 FM5",Microtune,PAL,@-	  16*141.j_,16*464.j_,tha0,0x90,0x30,0x8e,623&va-	{m"PanasonvoiVP27s/ENGE4324D",_Panasonvo, NTSC,@-	  16*160.j_,16*454.j_,th01,th02,th08,0xce,940&va-=((str( {m"LG NTSC (TAPEtseries)",_LGINNOTEK, NTSC,@- =tr( tr( 16*160.j_,16*442.j_,th01,th02,th04
0x8e,732 &va-a-=((str( {m"Tenna TNF 8831 BGFF)",_Philips, PAL,@- =tr( tr( 16*161.25,16*463.25,tha0,0x90,0x30,0x8e,623&va-	{m"Microtunei4042tFI5 ATSC/NTSC duala		",_Microtune, NTSC,@-	  16*162.j_,16*457.j_,tha2,th94
0x31,0x8e,732&va-=((str( {m"TCL bP=2N",_TCL, NTSC,@- =tr( tr( 16*172.j_,16*448.j_,th01,th02,th08,0x8e,732&va-	{m"Philips PAL/SECAM_D (FM 1256 I-H3)",_Philips, PAL,@-	  16*160.j_,16*442.j_,th01,th02,th04
0x8e,623 &va-a-	{m"Thomson DDT 7610 ATSC/NTSC)",_THOMSON, ATSC,@-	  16*157.25,16*454.j_,th39,th3a,th3c,0x8e,732&va-	{m"Philips FQ1286",_Philips, NTSC,@-	  16*160.j_,16*454.j_,th41,th42,th04
0x8e,940&v // UHF band un2esteda-
-}al-d mthca_TUNERS ARRAY* tru(tuners)
-{
/* ----------------------------------------------------------------------re/
-{
@
 	voie;
+tuner_get@
 	uscree_ndsi2c_cli;
  *c)
-{
-ylock, flach ibbyte;h-a-	kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-a-=((str( i	 (t->type ==_TUNER_MT2032)@-		36,) {
0 
-a-	 	 (1(!=O 2c_master_RESE(c_&byte,1))h-		36,) {
0 
-	36,) {
byte;h-} -
-d mthca_TUNER_POR*****( th80+-d mthca_TUNER_FL******( th40+-d mthca_TUNER_MODE****( th38e-d mthca_TUNER_AFC*****( th07l-
-d mthca_TUNER_STEREO**( th10 /* radioamode e/
-d mthca_TUNER_SIGNAL    th07 /* radioamode e/
-{
@
 	voie;
+tuner_sk, 
lcree_ndsi2c_cli;
  *c)
-{
-y36,) {
(tuner_get@
 	uscc) &_TUNER_SIGNAL)<<13 
-} -
-@
 	void t tuner_sterfo(ree_ndsi2c_cli;
  *c)
-{
-y36,) {
(tuner_get@
 	us cc) &_TUNER_STEREO);h-} -
-difuq2/* unused e/l-ca_nextd t tuner_islocked (ree_ndsi2c_cli;
  *c)
-@@-=((str(        (tuner_get@
 	us cc) &_TUNER_FL) 
-} -
-@
 	void t tuner_afc@
 	us cree_ndsi2c_cli;
  *c)
-@@-=((str(        (tuner_get@
 	us cc) &_TUNER_AFC)ail2 
-} -
-@
 	void t tuner_mode cree_ndsi2c_cli;
  *c)
-@@-=((str(        (tuner_get@
 	us cc) &_TUNER_MODE)ES O3 
-} -#endifl-{
/* ----------------------------------------------------------------------re/
-{
d mthca_MT2032 0x04{
d mthca_MT2030 0x06{
d mthca_MT2040 th07l-d mthca_MT2050 th42 -
-@
 	voich ib_microtune_part[]12 @@-	[_MT2030 ]12 "MT2030"va-	[_MT2032 ]12 "MT2032"va-	[_MT2040 ]12 "MT2040"va-	[_MT2050 ]12 "MT2050"va-}al-
-// IsSpurInB->rc)?
-@
 	void t mt2032_spurcheck(e;
+e1,ae;
+e2,ae;
+sx*	ee_m__5hc,e;
+sx*	ee_m_to)
-{
-ye;
+n1=1,n2,f 
-a-	f1=f1/10wq; //scaleato kHzato aT. IN32bi ro 		flowsa-	f2=f2/10wq;a-	kx*	ee_m__5hc/=10wq;a-	kx*	ee_m_to/=10wq;a-a-	dpr,Ttk("spurcheck+e1=%d+e2=%d+ _5hc=%d+to=%dthcae1,e2,sx*	ee_m__5hc,sx*	ee_m_to);a-a-	do @@-	tr( n2=-n1al-	tr( f=n1*(f1-f2)al-	tr( do @@-		n2--al-		f=f-f2al-		dpr,Ttk(" spur2est+n1=%d+n2=%d+f2est=%dthcan1,n2,f);a-a-		 	( (f>sx*	ee_m__5hc)r&& (f<sx*	ee_m_to))h-			pr,Ttk("mt2032 spurcheck+triggerfd: %dthcan1)al-	tr( } whilea( (f>(f2-sx*	ee_m_to)) || (n2>-5))al-	tr( n1++al-	} whilea(n1<5);a-a-	       1 
-} -
-@
 	void t mt2032_e mpute_fP
q(lock, flae;
+rthc,@-			)      lock, flae;
+ie1,alock, flae;
+ie2,@-			)      lock, flae;
+sx*	ee_m__5hc,@-			)      lock, flae;
+sx*	ee_m_to,@-			)      lock, flach ib_buf,@-			)      e;
+*   _sel,@-			)      lock, flae;
+xogc) //	llq		 Hz
-@@-=((str( lock, flae;
+eP
f,lo1,lo1n,lo1a,s,sel,lo1fP
q,sdesirfl_lo1,l-		desirfl_lo2,lo2,lo2n,lo2a,lo2num,lo2fP
q;h-a-=((str( eP
f= 5250 *10wq; //5.25MHz
-	desirfl_lo1=rthc+ie1;a-a-	lo1=(2*(desirfl_lo1/10wq)+(fP
f/10wq)) / (2*fP
f/10wq);a-=((str( lo1n=lo1/8;a-=((str( lo1a=lo1-(lo1n*8val-a-=((str( s=rthc/10wq/10wq+1090 
-a-	 	(optimize_vco) @@-		 	(s>1890) sel=q;a-		e) {_i	(s>1720) sel=1;a-		e) {_i	(s>1530) sel=2;a-		e) {_i	(s>1370) sel=3;a-		e) {_sel=4; // >1090l-	}
-	e) {_*)-=((str( 	 	(s>1790) sel=q; // <1958)-=((str( 	e) {_i	(s>1617) sel=1;a-=((str( 	e) {_i	(s>1449) sel=2;a-=((str( 	e) {_i	(s>1291) sel=3;a-=((str( 	e) {_sel=4; // >1090l-	}
-	*   _sel=selal-a-=((str( lo1fP
q=(lo1a+8*lo1n)*fP
fal-a-=((str( dpr,Ttk("mt2032:+rthc=%d+lo1=%d+lo1c=%d+lo1a=%d+sel=%d, lo1fP
q=%dthcah-		3thc,lo1,lo1n,lo1a,sel,lo1fP
qval-a-=((str( desirfl_lo2=lo1fP
q-3thc-if2al-=((str( lo2=(desirfl_lo2)/fP
fal-=((str( lo2n=lo2/8;a-=((str( lo2a=lo2-(lo2n*8val-=((str( lo2num=((desirfl_lo2/10wq)%(fP
f/10wq))* 3780/(fP
f/10wq); //scaleato fi
fh; 32bi rarithl-=((str( lo2fP
q=(lo2a+8*lo2n)*fP
f + lo2num*(fP
f/10wq)/3780*10wq;a-a-=((str( dpr,Ttk("mt2032:+rthc=%d+lo2=%d+lo2c=%d+lo2a=%d+num=%d+lo2fP
q=%dthcah-		3thc,lo2,lo2n,lo2a,lo2num,lo2fP
qval-a-=((str( i	(lo1a<0 || lo1a>7 || lo1n<17 ||lo1n>48 || lo2a<0 ||lo2a >7 ||lo2n<17 ||+lo2c>30) {@-)               pr,Ttk("mt2032:+rP
quency par;
eters 
+}fof range: %d %d %d %dthcah-		((str( lo1a, lo1n, lo2a,lo2nval-=((str( =((str(       (-1val-=((str( } -
-	mt2032_spurcheck(lo1fP
q,sdesirfl_lo2,a+sx*	ee_m__5hc, sx*	ee_m_to);a-	//urh
+ldlRESalculate	lo1 (oca_step up/down)l-
-	//u>  rup_MT2032 register map f   transfer o 		si2c
-	buf[0]=lo1n-1;a-	buf[1]=lo1a | (sel<<4val-	buf[2]=th86; // LOGCl-	buf[3]=th0f;2//reserveda-	buf[4]=th1fal-	buf[5]=(lo2n-1) | (lo2a<<5);a- 	 	(3thc >400*1000*1000)l-=((str( =((str( buf[6]=the4al-=((str( e) {l-=((str( =((str( buf[6]=thf4; // >  rPKEN p		srev 1.2l-	buf[7]=8+xogc;
-	buf[8]=thc3;2//reserveda-	buf[9]=th4e;2//reserveda-	buf[10]=thec;2//reserveda-	buf[11]=(lo2num&thffval-	buf[12]=(lo2num>>8) |0x80; // Lo2RSTa-a-	       0 
-} -
-@
 	void t mt2032_eheck_lo_lock(ree_ndsi2c_cli;
  *c)
-{
-yd t try,lock=q;a-	lock, flach ibbu [2];a-	f  (try=q;try<1q;try++) @@-		buf[0]=th0Rd - 	 2c_master_ye_d(c_bu ,1)al-		 2c_master_RESE(c_bu ,1)al-		dpr,Ttk("mt2032 Reg.E=0x%02xthcabuf[0])al-		lock=buf[0] &0x06;a-a-		 	 (lock==6)h-			bmcak;e-l-		dpr,Ttk("mt2032: pllqwai r1ms1f   lock (0x%2x)thcabuf[0])al-		udelay(10wq);a-	}
-=((str(        lock 
-} -
-@
 	void t mt2032_optimize_vco(ree_ndsi2c_cli;
  *c,e;
+sel,e;
+lock)
-{
-ylock, flach ibbu [2];a-	d t tad1;a-a-	buf[0]=th0fal-	 2c_master_ye_d(c_bu ,1)al-	 2c_master_RESE(c_bu ,1)al-	dpr,Ttk("mt2032 Reg.F=0x%02xthcabuf[0])al-	tad1=buf[0]&0x07 
-a-	 	(tad1 ==0)        lock 
-	 	(tad1 ==1)        lock 
-
-	 	(tad1==2) @@-		 	(sel==0)h-			       lock 
-		e) {_sel--al-	}
-	e) {_*)-		 	(sel<4vh-			sel++al-		e) {l-			       lock 
-	}a-a-	dpr,Ttk("mt2032 optimize_vco:+sel=%dthcasel);a-a-	buf[0]=th0fal-	buf[1]=selal-=((str( i2c_master_ye_d(c_bu ,2)al-	lock=mt2032_eheck_lo_lock(cval-	       lock 
-} -
-
-@
 	voiT. INmt2032_s  _if_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+rthc,@-			)      lock, flae;
+ie1,alock, flae;
+ie2,@-			)      lock, flae;
+_5hc, lock, flae;
+to)
-{
-ylock, flach ibbu [21];a-	d t li
 _try,   ,sel,lock=q;a-	kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-a-	dpr,Ttk("mt2032_s  _if_fP
q+rthc=%d+ie1=%d+ie2=%d+_5hc=%d+to=%dthcarthc,ie1,ie2,_5hc,to);a-a-=((str( buf[0]=t;
-=((str(    = 2c_master_ye_d(c_bu ,1)al-=((str( i2c_master_RESE(c_bu ,21);a-a-	buf[0]=tal-	   =mt2032_e mpute_fP
q(rthc,ie1,ie2,_5hc,to,&buf[1],&sel,t->xogc);a-	 	 (   <0)h-		36,) {;a-a-=((str( // > ndud.);
  	sreleva;
+registers p		sRi9y 1.2l-=((str( buf[0]=t;
-=((str(    = 2c_master_ye_d(c_bu ,4)al-=((str( buf[5]=5;
-=((str(    = 2c_master_ye_d(c_bu +5,4)al-=((str( buf[11]=11;
-=((str(    = 2c_master_ye_d(c_bu +11,3)al-=((str( if(   !=3)@-)               pr,Ttk("mt2032_s  _if_fP
q+failflawith %dthcaret)al-
-	//uwai rf   PLLs  o lock (per manual),    ry LINT i	 not.a-	f  (li
 _try=q; li
 _try<2; li
 _try++) @@-		lock=mt2032_eheck_lo_lock(cval-)-		 	(optimize_vco)@-			lock=mt2032_optimize_vco(c,sel,lock)al-		 f(lock==6) bmcak;e-l-		pr,Ttk("mt2032:+re-h;i
+PLLs by LINTthcval-		buf[0]=7al-		buf[1]=th80 +8+t->xogc; // >  rLINT to+re-h;i
+PLLs - 	 2c_master_ye_d(c_bu ,2)al-		mdelay(10)al-		buf[1]=8+t->xogc; - 	 2c_master_ye_d(c_bu ,2)al-=((str( } -
-	 	 (lock!=6)h-		pr,Ttk("MT2032 Fv;
l Error: PLLs did['balock.thcval-a-	buf[0]=2al-	buf[1]=0x20; // LOGC f   optim
l pha	ifnoi	il-	   = 2c_master_ye_d(c_bu ,2)al-	 	 (   !=2)l-		pr,Ttk("mt2032_s  _if_fP
q2+failflawith %dthcaret)al-} -
-
-@
 	voiT. INmt2032_s  _tv_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-	e;
+ie2,_5hc,toal-
-	//uck, 
lrbandwidth and pinduct caeqierl-	 	 (t->stdm mV4L2_STD_525_60) @@-		//uNTSCl-		f5hc = 40750*10wq;a-		to+r(hc46750*10wq;a-		ie2r(hc45750*10wq;a-	} e) {_*)-		//uPALl-		f5hc = 32900*10wq;a-		to+r(hc39900*10wq;a-		ie2r(hc38900*10wq;a-	}a-a-=((str( mt2032_s  _if_fP
q(c, fP
q*625002/* _5
q*1000*1000/16a*/,@-			)  1090*1000*1000,+ie2,+_5hc, to);a-}
-
-@
 	voiT. INmt2032_s  _radio_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-	e;
+ie2(uct->radio_if2al-
-	//uper Manual f   FM tun,TY:+rirst df c;
 e_1fP
q. 1085 MHz
-=((str( mt2032_s  _if_fP
q(c, fP
q*625002/* _5
q*1000*1000/16a*/,@-			)  1085*1000*1000,ie2,ie2,ie2);a-}
-
-// I;i
alizs	.wqeassdescribflae; "MT203x Programm,TY,Proceducts",sRi9 1.2, Feb.2001
-@
 	void t mt2032_o a_cree_ndsi2c_cli;
  *c)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval- )      lock, flach ibbu [21];a-        i
     ,xogc,xok=q;a-
-	//uI;i
ialize Registers p		ssx*	.l-=((str( buf[1]=2a //uI;dex to+register 2l-=((str( buf[2]=thffal-=((str( buf[3]=th0fal-=((str( buf[4]=th1fal-=((str(    = 2c_master_ye_d(c_bu +1,4);a-a-=((str( buf[5]=6a //uI;dex register 6a-=((str( buf[6]=the4al-=((str( buf[7]=th8fal-=((str( buf[8]=thc3;l-=((str( buf[9]=th4e;l-=((str( buf[10]=thec;
-=((str(    = 2c_master_ye_d(c_bu +5,6);a-a-=((str( buf[12]=13;  //uI;dex register 13a-=((str( buf[13]=th32al-=((str(    = 2c_master_ye_d(c_bu +12,2)al-a-=((str( // Adjus>lXOGC (register 7), wai rf   XOKa-=((str( xogc=7al-=((str( do @@-		dpr,Ttk("mt2032: xogc(uc0x%02xthcaxogc&0x07val-=((str( =((str( mdelay(10)al-=((str( =((str( buf[0]=th0Rd -=((str( =((str(  2c_master_ye_d(c_bu ,1)al-=((str( =((str( i2c_master_RESE(c_bu ,1)al-=((str( =((str( xok=buf[0]&0x01al-=((str( =((str( dpr,Ttk("mt2032: xok(uc0x%02xthcaxok)al-=((str( =((str( i	 (xok(u= 1) bmcak;e-l-=((str( =((str( xogc--al-=((str( =((str( dpr,Ttk("mt2032: xogc(uc0x%02xthcaxogc&0x07val-=((str( =((str( i	 (xogc == 3) {@-)               =((str( xogc=4; // m,T. 4 p		ssx*	@-)               =((str( bmcak;e-        =((str( }l-=((str( =((str( buf[0]=th07al-=((str( =((str( buf[1]=th88 ++xogc;
-=((str( =((str(    = 2c_master_ye_d(c_bu ,2)al-=((str( =((str( i	 (   !=2)l-)               =((str( pr,Ttk("mt2032_h;i
+failflawith %dthcaret)al-=((str( } whilea(xok(!= 1 )al-	t->xogc=xogc;
-l-	t->tv_fP
q(strucmt2032_s  _tv_fP
qal-	t->radio_fP
qrucmt2032_s  _radio_fP
q;
-=((str(       (1val-}
-
-@
 	voiT. INmt2050_s  _antenna(ree_ndsi2c_cli;
  *c, lock, flach ibantenna)
-@@-=((str(lock, flach ibbu [2];a-       i
     ;e-l-=((str(buf[0] = 6;l-=((str(buf[1] = antenna ? th11 : th10;l-=((str(   = 2c_master_ye_d(c_bu ,2)al-=((str(dpr,Ttk("mt2050: enabled antenna conne-	   %dthcabantenna)al-}
-
-@
 	voiT. INmt2050_s  _if_fP
q(ree_ndsi2c_cli;
  *c,lock, flae;
+eP
q,alock, flae;
+ie2)
-{
-ylock, flae;
+ie1=1218*1000*1000;
-	lock, flae;
+f_lo1,f_lo2,lo1,lo2,f_lo1_modulo,f_lo2_modulo,num1,num2,div1a,div1b,div2a,div2bal-	e;
+   ;e-ylock, flach ibbu [6]al-a-	dpr,Ttk("mt2050_s  _if_fP
q fP
q=%d+ie1=%d+ie2=%dthcah-		eP
q,ie1,ie2val-a-	f_lo1=fP
q+ie1;a-	f_lo1=(f_lo1/10wq0wq)*10wq0wqal-a-	f_lo2=f_lo1-fP
q-if2al-	f_lo2=(f_lo2/5q0wq)*5q0wqal-a-	lo1=f_lo1/40wq0wqal-	lo2=f_lo2/40wq0wqal-a-	f_lo1_modulo=+f_lo1-(lo1*40wq0wq)al-	f_lo2_modulo=+f_lo2-(lo2*40wq0wq)al-l-	num1=4*f_lo1_modulo/40wq0wqal-	num2=4096*(f_lo2_modulo/10wq)/40wqal-a-	// todo spurchecksl-a-	div1a=(lo1/12)-1;a-	div1b=lo1-(div1a+1)*12al-
-	div2a=(lo2/8)-1;a-	div2b=lo2-(div2a+1)*8 
-a-	 	 (debug > 1) @@-		pr,Ttk("lo1 lo2 = %d %dthca	lo1, lo2)al-		pr,Ttk("num1+num2 div1a div1b div2a div2b= %x %x %x %x %x %xthcanum1,num2,div1a,div1b,div2a,div2b) 
-	}a-a-	buf[0]=1;a-	buf[1]= 4*div1b ++num1 
-	 	(fP
q<275*1000*1000)(buf[1] = buf[1]|0x80;a-a-	buf[2]=div1a;l-	buf[3]=32*div2b ++num2/256;a-	buf[4]=num2-(num2/256)*256;a-	buf[5]=div2a 
-	 	(num2!=0)(buf[5]=buf[5]|0x40;l-a-	 	 (debug > 1) @@-		e;
+ial-		pr,Ttk("bufs is: cval-		f  (i=q;i<6;i++)h-			pr,Ttk("%x cabuf[i])al-		pr,Ttk("thcval-	}a-a-	   = 2c_master_ye_d(c_bu ,6)al-=((str( if (   !=6)@-)               pr,Ttk("mt2050_s  _if_fP
q failflawith %dthcaret)al-} -
-@
 	voiT. INmt2050_s  _tv_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-	lock, flae;
+ie2;l-a-	 	 (t->stdm mV4L2_STD_525_60) @@-		//uNTSCl-=((str( =((str( i	2(hc45750*10wq;a-=((str( } e) {_*)-=((str( =((str( // PALl-=((str( =((str( i	2(hc38900*10wq;a-=((str( }l-	 	 (V4L2_TUNER_DIGITAL_TV == t->mode) @@-		//u2est,TY,f   DVB ...a-		ie2rhc36150*10wq;a-	}a-	mt2050_s  _if_fP
q(c, fP
q*62500,+ie2val-	mt2050_s  _antenna(c, tv_antenna)al-} -
-@
 	voiT. INmt2050_s  _radio_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-	e;
+ie2(uct->radio_if2al-
-	mt2050_s  _if_fP
q(c, fP
q*62500,+ie2val-	mt2050_s  _antenna(c, radio_antenna) 
-} -
-@
 	void t mt2050_o a_cree_ndsi2c_cli;
  *c)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-ylock, flach ibbu [2];a-	d t    ;e-l-	buf[0]=6al-	buf[1]=0x1tal-	   = 2c_master_ye_d(c_bu ,2)a //  powerl-a-	buf[0]=th0fal-	buf[1]=th0fal-	   = 2c_master_ye_d(c_bu ,2)a // m1lol-a-	buf[0]=th0dal-	   = 2c_master_ye_d(c_bu ,1)al-	 2c_master_RESE(c_bu ,1)al-a-	dpr,Ttk("mt2050: srori t%xthcabuf[0])al-	t->tv_fP
q(strucmt2050_s  _tv_fP
qal-	t->radio_fP
qrucmt2050_s  _radio_fP
q;a-	       0 
-} -
-@
 	void t microtune_o a_cree_ndsi2c_cli;
  *c)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-ych ib_6;
Rd - )      lock, flach ibbu [21];a-	d t company_code;
-l-	mems  (bu ,0,y =
 	(bu ))al-	t->tv_fP
q(strucsizeal-	t->radio_fP
qrucsizeal-	6;
R12 "unknown"al-a-=((str( i2c_master_ye_d(c_bu ,1)al-=((str( i2c_master_RESE(c_bu ,21);a-=((str( if(debug) *)-=((str( =((str( e;
+ial-)               pr,Ttk(KERN_DEBUG "tuner:_MT2032 hexdump:thcval-)               f  (i=q;i<21;i++) {@-)               =((str( pr,Ttk(" %02xcabuf[i])al-)               =((str( if(((i+1)%8)==0) pr,Ttk(" ")al-)               =((str( if(((i+1)%16)==0) pr,Ttk("\n ")al-)               }@-)               pr,Ttk("\n ")al-)       }a-	company_code = buf[th11] << 8 | buf[th12];a-        pr,Ttk("tuner:_microtune: companycode=%04x part=%02x rev=%02xthcaY-	)      company_code,buf[th13],buf[th14])al-a-difuqa-	/*tseems  o causeamore problems  han i rsolves ... e/
-ykstruct company_code) @@-	
+	if0x30bf:@-	
+	if0x3cbf:@-	
+	if0x3dbf:@-	
+	if0x4d54:@-	
+	if0x8e81:@-	
+	if0x8e91:@-		/*tok((?) e/
-y	bmcak;e-ddefault:b-		pr,Ttk("tuner:_microtune: unknown companycodethcval-		36,) {
0 
-	} -#endifl-{
	 	 (buf[th13] < ARRAY* tru(microtune_part)r&&Y-	)   size(!= microtune_part[buf[th13]])h-		6;
R12 microtune_part[buf[th13]];
-ykstruct buf[th13]) @@-	
+	ifMT2032:b-		mt2032_o a_cc)al-		bmcak;e-d
+	ifMT2050:b-		mt2050_o a_cc)al-		bmcak;e-ddefault:b-		pr,Ttk("tuner:_microtune %s1f und, not (yet?) supported, sorry :-/thcah-		((str(  ;
R)al-=((str( =((str(        q;a-=((str( }l-	pr,Ttk("tuner:_microtune %s1f und, OKthcan;
R)al-	       0 
-} -
-/* ----------------------------------------------------------------------re/
-{
@
 	voiT. INdefault_s  _tv_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-yl8be -fig;
-yl16 dival- kes 0 ftunertypea*tun;h- )      lock, flach ibbu *er[4]d -	e;
+rcal-l-	tun hc&tuners[t->type];h-	i	 (fP
qa<+tun->thx,sh1) *)-wd
 -fig(uctun->VHF_L;
-		dpr,Ttk("tv:bVHFslowrangethcval-	} e) {_i	 (fP
qa<+tun->thx,sh2) *)-wd
 -fig(uctun->VHF_H;
-		dpr,Ttk("tv:bVHFshigh rangethcval-	} e) {_*)-		
 -fig(uctun->UHF;
-		dpr,Ttk("tv:bUHF rangethcval-	}a-a-a-	/*t2v  orm ex*	ifn dstu * f   multi- orm tuners e/
-ykstruct t->type) *)-w
+	ifTUNER_PHILIPS_SECAM: // FI1216MFb-	c/* 0x012-> ???,no ch ngt ???,e/
-yc/* 0x022-> PAL BDGHI / SECAM L,e/
-yc/* 0x042-> ???,PAL others / SECAM others ???,e/
-yc
 -fig(&= ~0x02al-"	i	 (t->stdm mV4L2_STD_SECAM))-wqc
 -fig(|= 0x02al-		bmcak;e-l-	
+	ifTUNER_TEMIC_4046FM5:
-yc
 -fig(&= ~0x0f;e-l-"	i	 (t->stdm mV4L2_STD_PAL_BG) {)-wqc
 -fig(|= TEMIC_SET_PAL_BG;e-l-"	} e) {_i	 (t->stdm mV4L2_STD_PAL_I) {)-wqc
 -fig(|= TEMIC_SET_PAL_I;e-l-"	} e) {_i	 (t->stdm mV4L2_STD_PAL_DK) {)-wqc
 -fig(|= TEMIC_SET_PAL_DK;+-l-"	} e) {_i	 (t->stdm mV4L2_STD_SECAM_L) 0 -wqc
 -fig(|= TEMIC_SET_PAL_L;+-l-"	}l-		bmcak;e-l-	
+	ifTUNER_PHILIPS_FQ1216ME:
-yc
 -fig(&= ~0x0f;e-l-"	i	 (t->stdm m(V4L2_STD_PAL_BG|V4L2_STD_PAL_DK)) 0 -wqc
 -fig(|= PHILIPS_SET_PAL_BGDK;e-l-"	} e) {_i	 (t->stdm mV4L2_STD_PAL_I) {)-wqc
 -fig(|= PHILIPS_SET_PAL_I;+-l-"	} e) {_i	 (t->stdm mV4L2_STD_SECAM_L) 0 -wqc
 -fig(|= PHILIPS_SET_PAL_L;+-l-"	}l-		bmcak;e-l-	
+	ifTUNER_PHILIPS_ATSC:
-yc/* 0x002-> ATSC antenna input 1,e/
-yc/* 0x012-> ATSC antenna input 2,e/
-yc/* 0x022-> NTSC antenna input 1,e/
-yc/* 0x032-> NTSC antenna input 2,e/
-yc
 -fig(&= ~0x03al-"	i	 (!(t->stdm mV4L2_STD_ATSC)))-wqc
 -fig(|= 2al-"	/* FIXME: input e/
-		bmcak;e-l-	
+	ifTUNER_MICROTUNE_4042FI5:
-yc/* Se ft 	seh igt pump f   fas>ltun,TY,e/
-yctun->
 -fig(|= 0x40;l-		bmcak;e-d}a-a-	/*Y-	)2 Philips FI1216MK2   mark _5hc sx*	ifn s	.wqe:k-yy2 f   ch nnelasele->.wqeinvolv,TY,band )struc,TY, ->re
o ensurek-yy2 smoothltun,TY,2(Mt 	sdesirflach nnelawith
+}fcaus,TYk-yy2 unne-essaryseh igt pump a->.wq, i ri tRESommendere
o conside_r-yy2 , 	sd+ *erencerbetween wantelach nnelarP
quency ->re
 	r-yy2 curr;
  ch nnelarP
quency.  Unne-essaryseh igt pump a->.wqr-yy2 will x,sulta		 veryslow tun,TY,voltagt whiuctmay dsizee
 	r-yy2 oscillat    o ext  m	se -ditioa/.r-yy2Y-	)2 Progfou: sx*	ifn s	.wqesays  o ye_dbe -fig  v;
 befor	r-yy2 rP
quency 		 
+	if(wantelarP
quency < curr;
  rP
quency).r-	re/
-{
	div=fP
qa+ctun->IFPCoff;h- i	 (t->type ==_TUNER_PHILIPS_SECAMr&& fP
qa<+t->eP
q) 0 -wqbu *er[0](uctun->
 -fig; -wqbu *er[1](uc
 -fig; -wqbu *er[2] = (div>>8) &mth7f; -wqbu *er[3] = div      &mthff;h-	} e) {_*)-		Tu *er[0](uc(div>>8) &mth7f; -wqbu *er[1] = div      &mthff;h- qbu *er[2] = tun->
 -fig; -wqbu *er[3](uc
 -fig; -	}a-	dpr,Ttk("tuner:_2v 0x%02x 0x%02x 0x%02x 0x%02xthcaY-		Tu *er[0],bu *er[1],bu *er[2],bu *er[3]);e-a-=((str( i	 (4(!=O(rc =O 2c_master_ye_d(c_bu *er,4))))-)               pr,Ttk("tuner:_r2cpi/o error: rc == %d (rh
+ldlbco4)thcarcval-h- i	 (t->type ==_TUNER_MICROTUNE_4042FI5)(*)-wq// FIXMEail  i tmay also work _   other tuners)-wdlock, flaloTY,time
+}f= j+ *iesa+cmsecs_to_j+ *ies(1val-		u8b@
 	us_byte = 0;h-
-yc/* Wai runtil , 	sPLL locks e/
-y	_   (;;) 0 -wqci	 (time_after(j+ *ies,time
+})))-wqcc36,) {;h-			 	 (1(!=O(rc =O 2c_master_RESE(c_&@
 	us_byte,1))) 0 -wqccdpr,Ttk("tuner:_r2cpi/o read error: rc == %d (rh
+ldlbco1)thcarcval-		ccbmcak;e-	"	}l-		c/* bi r6ri tPLL lockflae;dn s	   e/
-y		 	 (@
 	us_byte & 0x40)l-		ccbmcak;e-	"	udelay(10)al-		}h-
-yc/* Se ft 	seh igt pump f   optimized0pha	ifnoi	iffigure,e/
-yctun->
 -fig(&= ~0x40;l-		Tu *er[0](uc(div>>8) &mth7f; -wqbu *er[1] = div      &mthff;h- qbu *er[2] = tun->
 -fig; -wqbu *er[3](uc
 -fig; -		dpr,Ttk("tuner:_2v 0x%02x 0x%02x 0x%02x 0x%02xthcaY-			Tu *er[0],bu *er[1],bu *er[2],bu *er[3]);e-a-		 	 (4(!=O(rc =O 2c_master_ye_d(c_bu *er,4))))-qccdpr,Ttk("tuner:_r2cpi/o error: rc == %d (rh
+ldlbco4)thcarcval-	}h-}
-{
@
 	voiT. INdefault_s  _radio_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
-{
-ykes 0 ftunertypea*tun;h-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval- )      lock, flach ibbu *er[4]d -	lock, fladival-	e;
+rcal-l-	tun=&tuners[t->type];h-	div ucfP
qa+c(e;
)(16*10.7val-qbu *er[2] = tun->
 -fig; -
-ykstruct t->type) *)-w
+	ifTUNER_PHILIPS_FM1216ME_MK3:)-w
+	ifTUNER_PHILIPS_FM1236_MK3:)-wqbu *er[3](uc0x19al-		bmcak;e-d
+	ifTUNER_PHILIPS_FM1256_IH3:)-wqdiv uc(20y2 rP
q)/16a+c333y2 2al-" )      Tu *er[2] = 0x80;)-wqbu *er[3](uc0x19al-		bmcak;e-d
+	ifTUNER_LG_PAL_FM:)-wqbu *er[3](uc0xa5al-		bmcak;e-ddefault:b-		bu *er[3](uc0xa4;l-		bmcak;e-d}a- )      Tu *er[0](uc(div>>8) &mth7f; - )      Tu *er[1] = div      &mthff;h-a-	dpr,Ttk("tuner:_xadioa0x%02x 0x%02x 0x%02x 0x%02xthcaY-		Tu *er[0],bu *er[1],bu *er[2],bu *er[3]);e-a-=((str( i	 (4(!=O(rc =O 2c_master_ye_d(c_bu *er,4))))-)               pr,Ttk("tuner:_r2cpi/o error: rc == %d (rh
+ldlbco4)thcarcval-} -
-/* ----------------------------------------------------------------------re/
-{
// Se ftuner rP
quency, cfP
qa		 Uni
sfo		62.5kHza= 1/16MHz
-@
 	voiT. INs  _tv_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-h- i	 (t->type ==_UNSET) @@-		pr,Ttk("tuner:_2uner type not s  thcval-		36,) {; -	}a-	i	 (size(== t->tv_fP
qB @@-		pr,Ttk("tuner:_Huh? tv_>  ri tsize?thcval-		36,) {; -	}a-	i	 (fP
qa<+tv_range[0]*16a||cfP
qa>+tv_range[1]*16)(*)-wq/* FIXME: better dot2hat*chip-sx*	ifn , Tuth-		((sright now*wcodo['bahazee
 a
fh; t 	se -figh-		((sses 0 f->re
 i tway i tstill better  han noh-		((scheck+a
f	llqe/
-ycpr,Ttk("tuner:_TVcfP
qa(%d.%02d) 
+}fof rangea(%d-%d)thcah-		((str( fP
q/16,fP
q%16*100/16,tv_range[0],tv_range[1]val-		36,) {; -	}a-	t->tv_fP
q(c_eP
q);
-}
-{
@
 	voiT. INs  _radio_fP
q(ree_ndsi2c_cli;
  *c, lock, flae;
+eP
q)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-h- i	 (t->type ==_UNSET) @@-		pr,Ttk("tuner:_2uner type not s  thcval-		36,) {; -	}a-	i	 (size(== t->radio_fP
qB @@-		pr,Ttk("tuner:_no radioatun,TY,f   
 i tone, sorry.thcval-		36,) {; -	}a-	i	 (fP
qa<+radio_range[0]*16a||cfP
qa>+radio_range[1]*16)(*)-wqpr,Ttk("tuner:_xadioafP
qa(%d.%02d) 
+}fof rangea(%d-%d)thcah-		((str( fP
q/16,fP
q%16*100/16,h-		((str( radio_range[0],radio_range[1]val-		36,) {; -	}a-	t->radio_fP
q(c_eP
q);
-}
-{
@
 	voiT. INs  _fP
q(ree_ndsi2c_cli;
  *c, lock, flaloTY,eP
q)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-h- kstruct t->mode) @@-	
+	ifV4L2_TUNER_RADIO: -		dpr,Ttk("tuner:_xadioafP
qa>  rto %lu.%02luthcaY-			fP
q/16,fP
q%16*100/16val-		s  _radio_fP
q(c_eP
q);
-		bmcak;e-d
+	ifV4L2_TUNER_ANALOG_TV:e-d
+	ifV4L2_TUNER_DIGITAL_TV: -		dpr,Ttk("tuner:_2v fP
qa>  rto %lu.%02luthcaY-			fP
q/16,fP
q%16*100/16val-		s  _tv_fP
q(c_ eP
q);
-		bmcak;e-d}a-	t->fP
qrucfP
q;a-}
-{
@
 	voiT. INs  _type(ree_ndsi2c_cli;
  *c, lock, flae;
+type, ch ib_source)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-h- i	 (t->type !=_UNSETr&& t->type !=_TUNER_ABSENT) @@-		 	 (t->type !=_type)h-			pr,Ttk("tuner:_2ype already >  rto %d, "@-			)      "k, or,TY P
ques rf   %dthca	t->type, type)al-		36,) {; -	}a-	i	 (2ype >=_TUNERS)h-		36,) {;a-a-	t->type =+type;l-	pr,Ttk("tuner:_type >  rto %da(%s) by %sthcaY-	)      t->type,tuners[t->type].n;
R, source);h-ykeslcpy(c->n;
R, tuners[t->type].n;
R, s =
 	(c->n;
R)); -
-ykstruct t->type) *)-w
+	ifTUNER_MT2032:b-		microtune_o a_cc)al-		bmcak;e-ddefault:b-		t->tv_fP
q(strucdefault_s  _tv_fP
q;b-		t->radio_fP
qrucdefault_s  _radio_fP
q;
-		bmcak;e-d}a-} -
-@
 	voich ibpal[]12 "-"al-module_par;
_str,TY(pal, pal, t644, s =
 	(pal))al-
-@
 	voie;
+tuner_fixup_std(kes 0 ftuner *t)
-{
-yd	 ((t->stdm mV4L2_STD_PAL)(== V4L2_STD_PAL)(*)-wq/* ma;amore pr*	i	ifnormie;fo _5hc insmod optioaqe/
-yckstruct pal[0]) *)-wd
+	if'b':)-wd
+	if'B':)-wd
+	if'g':)-wd
+	if'G':)-wd	dpr,Ttk("insmod fixup:,PAL => PAL-BGthcval-			t->stdm=mV4L2_STD_PAL_BG;h-			bmcak;e-wd
+	if'i':)-wd
+	if'I':)-wd	dpr,Ttk("insmod fixup:,PAL => PAL-Ithcval-			t->stdm=mV4L2_STD_PAL_I;h-			bmcak;e-wd
+	if'd':)-wd
+	if'D':)-wd
+	if'k':)-wd
+	if'K':)-wd	dpr,Ttk("insmod fixup:,PAL => PAL-DKthcval-			t->stdm=mV4L2_STD_PAL_DK;e-			bmcak;e-wd} -	}a-	       0 
-} -
-/* ----------------------------------------------------------------------re/
-{
@
 	void t tuner_attach(ree_ndsi2c_adapter *adap,ar;
+addx,ar;
+kind)
-{
-ykes 0 ftuner *t;h-ykes 0 fi2c_cli;
  *cli;
 al-h- i	 (thi _adapa>+0)h-		36,) { -1;a-	thi _adap++al-)-)       cli;
 _tem
late.adapter = adapal-)       cli;
 _tem
late.addr = addral-)-)       pr,Ttk("tuner:_chiphf und+a
f	ddr 0x%xfi2c-bus %sthcaY-	)      	ddr<<1, adap->n;
R);e-a-=((str( i	 (size(== (cli;
  = km	lloc(s =
 	(kes 0 fi2c_cli;
 ), GFP_KERNEL))))-)               36,) { -ENOMEMal-)       memcpy(cli;
 ,&cli;
 _tem
late,s =
 	(kes 0 fi2c_cli;
 )val- )        = km	lloc(s =
 	(kes 0 ftuner),GFP_KERNEL);a-=((str( i	 (size(== t) {@-)               kfP
e(cli;
 )al-=((str( =((str(        -ENOMEMal-)       }l-)       mems  (t,0,y =
 	(kes 0 ftuner))al-	 2c_sa;
cli;
  v;
	cli;
 , t)al-	t->type       =_UNSETal-	t->radio_ie2r(hc10700*10wq; // 10.7MHz - FM radiol-a-=((str( i2c_attach
cli;
 (cli;
 )al-	i	 (2ype <_TUNERS) *)-wds  _type(cli;
 , type, "insmod optioa")al-		pr,Ttk("tuner:_T 	stype=<n> insmod optioaqwill go away soon.thcval-		pr,Ttk("tuner:_Ple+	ifusea  	stuner=<n> optioaqproviderebythcval-		pr,Ttk("tuner:_2v aard core );
 		s(bttv, saa7134, ...) instead.thcval-	}a-	       0 
-} -
-@
 	void t tuner_probe(ree_ndsi2c_adapter *adap)
-{
-yd	 (0 !=_	ddr) *)-wdnormal_i2c_range[0] = addral-wdnormal_i2c_range[1] = addral-w}a-	thi _adap = 0;h-
-#ifdef I2C_CLASS_TV_ANALOG
-yd	 (adap->classm mI2C_CLASS_TV_ANALOG)h-		36,) { i2c_probe(adap,a&addr_ v;
, tuner_attachval-#e) {l-	kstruct adap->id) *)-w
+	ifI2C_ALGO_BIT |fI2C_HW_SMBUS_VOODOO3:)-w
+	ifI2C_ALGO_BIT |fI2C_HW_B_BT848:)-w
+	ifI2C_ALGO_BIT |fI2C_HW_B_RIVA:)-w
+	ifI2C_ALGO_SAA7134:)-w
+	ifI2C_ALGO_SAA7146:h-		36,) { i2c_probe(adap,a&addr_ v;
, tuner_attachval-		bmcak;e-d}a-#endifl-	       0 
-} -
-@
 	void t tuner_detach(ree_ndsi2c_cli;
  *cli;
 )
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cli;
 )al-l-	 2c_detach
cli;
 (cli;
 )al-	kfP
e( )al-	kfP
e(cli;
 )al-	       0 
-} -
-d mthca_SWITCH_V4L2	i	 (!t->us,TY_v4l2r&& debug) \h-		((str(    pr,Ttk("tuner:_cstruc,TY,to v4l2thcva \h-	          =((str( t->us,TY_v4l2r= 1 
-d mthca_CHECK_V4L2	i	 (t->us,TY_v4l2) *  	 (debug) \h-			  pr,Ttk("tuner:_r, ore v4l1 c	llthcva \h-		( =((str(        q; } -
-@
 	void t
-tuner_Somm->rcree_ndsi2c_cli;
  *cli;
 , lock, flae;
+cmd, T. IN*arg)
-{
-ykes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cli;
 )al-=((str( lock, flae;
+*iarg(uc(e;
*)argal-a-=((str( sstruct cmd) *)-a-	/*t---re -figurs	.wqe---re/
-w
+	ifTUNER_SET_TYPE:
-ycs  _type(cli;
 ,*iarg,cli;
 ->adapter->n;
R);e-		bmcak;e-d
+	ifAUDC_SET_RADIO: -		 	 (V4L2_TUNER_RADIO !=_t->mode) @@-			s  _tv_fP
q(cli;
 ,400y2 16val-			t->modem=mV4L2_TUNER_RADIO;l-"	}l-		bmcak;e-d
+	ifAUDC_CONFIG_PINNACLE:
-ycsstruct *iarg) *)-wd
+	if2:)-qccdpr,Ttk("tuner:_pinnacle palthcval-			t->radio_ie2r=c33300y2 10wq;a-			bmcak;e-wd
+	if3:)-qccdpr,Ttk("tuner:_pinnacle ntscthcval-			t->radio_ie2r=c41300y2 10wq;a-			bmcak;e-wd}l-=((str( =((str( bmcak;e-l-	/*t---rv4l ioctlse---re/
-w/*t2akt caee: bttv doesfuserspac	se py,TY, we'll ga;aah-	   kernel poi
 e_1here... e/
-y
+	ifVIDIOCSCHAN:)-q*)-wds
 	voiconst v4l2_std_ INmap[]12 @@-			[fVIDEO_MODE_PAL   ]m=mV4L2_STD_PAL,@-			[fVIDEO_MODE_NTSC  ]m=mV4L2_STD_NTSC_M,@-			[fVIDEO_MODE_SECAMr]m=mV4L2_STD_SECAM,@-			[f42/* bttv */str( ]m=mV4L2_STD_PAL_M,@-			[f52/* bttv */str( ]m=mV4L2_STD_PAL_N,@-			[f62/* bttv */str( ]m=mV4L2_STD_NTSC_M_JP,@-		}al-		ses 0 fvideo_ch nnela*vc =Oargal-a-		CHECK_V4L2;b-		t->modem=mV4L2_TUNER_ANALOG_TVal-"	i	 (vc->normi< ARRAY* tru(map))l-			t->stdm=mmap[vc->norm];
-yctuner_fixup_std(t)al-"	i	 (t->eP
q)
-			s  _tv_fP
q(cli;
 ,t->eP
q)al-		36,) {
0 
-	} -y
+	ifVIDIOCSFREQ:)-q*)-wdlock, flaloTY,*v =Oargal-a-		CHECK_V4L2;b-		s  _fP
q(cli;
 ,*v)al-		36,) {
0 
-	} -y
+	ifVIDIOCGTUNER:)-q*)-wds
s 0 fvideo_tuner *vt =Oargal-a-		CHECK_V4L2;b-		 	 (V4L2_TUNER_RADIO == t->mode)
-			vt->sk, 
lr=+tuner_sk, 
lccli;
 )al-		36,) {
0 
-	} -y
+	ifVIDIOCGAUDIO: -	*)-wds
s 0 fvideo_audioa*va =Oargal-a-		CHECK_V4L2;b-		 	 (V4L2_TUNER_RADIO == t->mode)
-			va->modem=m(tuner_sterfo(cli;
 ) ?fVIDEO_SOUND_STEREO*:fVIDEO_SOUND_MONO)al-		36,) {
0 
-	} - -y
+	ifVIDIOC_S_STD: -	*)-wdv4l2_std_ IN*id =Oargal-a-		SWITCH_V4L2;b-		t->modem=mV4L2_TUNER_ANALOG_TVal-"	t->stdm=m*id;
-yctuner_fixup_std(t)al-"	i	 (t->eP
q)
-			s  _fP
q(cli;
 ,t->eP
q)al-		bmcak;e-d}a-	
+	ifVIDIOC_S_FREQUENCY: -	*)-wds
s 0 fv4l2_rP
quency *f =Oargal-a-		SWITCH_V4L2;b-		 	 (V4L2_TUNER_RADIO == f->type &&Y-		( =(V4L2_TUNER_RADIO !=_t->mode)@-			s  _tv_fP
q(cli;
 ,400*16val-		t->modem = f->typeal-		t->fP
q(s= f->rP
quency;b-		s  _fP
q(cli;
 ,t->eP
q)al-		bmcak;e-d}a-	
+	ifVIDIOC_G_TUNER:)-q*)-wds
s 0 fv4l2_tuner *tuner =Oargal-a-		SWITCH_V4L2;b-		 	 (V4L2_TUNER_RADIO == t->mode)@-			tuner->sk, 
lr=+tuner_sk, 
lccli;
 )al-		bmcak;e-d}a-	default:b-		/* noth,TY,e/
-ycbmcak;e-d}a-a-	       0 
-} -
-@
 	void t tuner_suspe>rcree_ndsdevic	s*sdev, l32 state, l32 level)
-{
-ydpr,Ttk("tuner:_suspe>rthcval-	/* FIXME: power down ???,e/
-y       0 
-} -
-@
 	void t tuner_x,sumecree_ndsdevic	s*sdev, l32 level)
-{
-yree_ndsi2c_cli;
  *c(uc
 -tainer_of(dev, see_ndsi2c_cli;
 ,sdev);a-	kes 0 ftuner *tuf_r2c_ma;
cli;
  v;
	cval-a-	dpr,Ttk("tuner:_x,sumethcval-	i	 (t->eP
q)
-		s  _fP
q(c,t->eP
q)al-	       0 
-} -
-/* -----------------------------------------------------------------------re/
-{
@
 	voisee_ndsi2c_);
 		s);
 		s2 @@-	.own		ssssssssss= THIS_MODULE,@- =tr( tr.n;
R ssssssssss= "r2cpTVftuner );
 		",@- =tr( tr.id   ssssssssss= I2C_DRIVERID_TUNER,@- =tr( tr.flagsssssssssss= I2C_DF_NOTIFY,@- =tr( tr.attach
adapter = tuner_probe,@- =tr( tr.detach
cli;
   = tuner_detach,@- =tr( tr.Somm->rssssssss= tuner_Somm->r,@-	.);
 		s2 @@-		.suspe>rr=+tuner_suspe>r,@-		.x,sumess= tuner_x,sume,@-	}va-}al-@
 	voisee_ndsi2c_cli;
  cli;
 _tem
late =
-{
-yI2C_DEVNAME("(tuner locet)"),@-	.flagsssssss=mI2C_CLIENT_ALLOW_USE,@- =tr( tr.);
 		sssss=m&);
 		va-}al-
-@
 	void t __h;i
+tuner_i;i
_module(T. I)
-{
-y36,) {
i2c_add_);
 		(&);
 		);
-}
-{
@
 	voiT. IN__exi
+tuner_cleanup_module(T. I)
-{
-y 2c_del_);
 		(&);
 		);
-}
-{
module_o a_ctuner_i;i
_module)al-module_exi
(tuner_cleanup_moduleval-a-/*Y-s*sO 		rides1f   Emacs sot2hat*we1f llow Linus'st2abb,TY,style.Y-s*s---------------------------------------------------------------------------Y-s*sLoc
lrvariables:Y-s*sc-basic-offcet: 8Y-s*sEnd:Y-s*/
d+ * -Nru a/);
 		s/media/video/tveeprom.c b/);
 		s/media/video/tveeprom.c
---ra/);
 		s/media/video/tveeprom.c	2005-01-25 13:50:26 -08:00
+++ b/);
 		s/media/video/tveeprom.c	2005-03-07 20:41:40 -08:00
@@ -34,6 +34,7 @@
 #includem<linux/kernel.h>
 #includem<linux/i;i
.h>
 #includem<linux/types.h>
+#includem<linux/videodev.h>
 #includem<linux/i2c.h>
 
 #includem<media/tuner.h>
d+ * -Nru a/);
 		s/media/video/videodev.c b/);
 		s/media/video/videodev.c
---ra/);
 		s/media/video/videodev.c	2004-08-23 01:14:55 -07:00
+++ b/);
 		s/media/video/videodev.c	2005-03-09 09:04:25 -08:00
@@ -46,15 +46,7 @@
 y36,) {
spr,Tt	(bu ,"%.*sthca(e;
)y =
 	(vfd->n;
R),vfd->n;
R);
 }
 
-@
 	voisy =
_turh
w_devcree_ndsclass_devic	s*cd,ach ib_buf)
-{
-yree_ndsvideo_devic	s*vfd(uc
 -tainer_of(cd,aree_ndsvideo_devic	,sclass_dev)al-	dev_dsdev(ucMKDEV(VIDEO_MAJOR, vfd->minor)al-	       pr,Tt_dev_d(bu ,dev)al-}
-{ @
 	voiCLASS_DEVICE_ATTR(n;
R, S_IRUGO,urh
w_n;
R, size)al-@
 	voiCLASS_DEVICE_ATTR(dev,  S_IRUGO,urh
w_dev, size)al 
 ree_ndsvideo_devic	s*video_devic	_	lloc(T. I)
 @@@@ -347,12 +339,11 @@
 yi	 (vfd->dev)
 y	vfd->class_dev.dev(ucvfd->deval 	vfd->class_dev.classmssssss=m&video_class;
+	vfd->class_dev.devtmssssss=mMKDEV(VIDEO_MAJOR, vfd->minor)al ykeslcpy(vfd->class_dev.class_ I,cvfd->devfs_n;
R + 4, BUS_ID_ tru)al yclass_devic	_register(&vfd->class_dev)al yclass_devic	_cmcate_file(&vfd->class_dev,
 y			(&class_devic	_attr_n;
R);e-	class_devic	_cmcate_file(&vfd->class_dev,
-y			(&class_devic	_attr_dev)al 
 #if 12/* needereuntil 	llq);
 		sOariffixed e/l yi	 (!vfd->rele+	i)
d+ * -Nru a/);
 		s/media/video/vpx3220.c b/);
 		s/media/video/vpx3220.c
---ra/);
 		s/media/video/vpx3220.c	2005-01-07 21:44:25 -08:00
+++ b/);
 		s/media/video/vpx3220.c	2005-03-02 10:01:032-08:00
@@ -587,7 +587,6 @@
 y.f  ce			= f  ce
 };
 
-@
 	void t vpx3220_i2c_id =O0 
 @
 	voisee_ndsi2c_);
 		svpx3220_i2c_);
 		al 
 re 	void t
@@ -634,7 +633,6 @@
 ycli;
 ->adapter = adapt		al ycli;
 ->);
 		s2 &vpx3220_i2c_);
 		al ycli;
 ->flagss=mI2C_CLIENT_ALLOW_USE;e-	cli;
 ->id =Ovpx3220_i2c_id++al 
 	/* Check+eor manufanduct ID and part+number e/l yi	 (kind < 0) @@@@ -655,16 +653,16 @@
 y	( =(vpx3220_read(cli;
 , 0x01)al yckstruct pn) @@ 		
+	if0x4680:b-			snpr,Tt	(I2C_NAME(cli;
 ), y =
 	(I2C_NAME(cli;
 ))ail1,
-y			("vpx3220a[%d]", cli;
 ->id);
+		ykeslcpy(I2C_NAME(cli;
 ), "vpx3220a",@+		y	y =
 	(I2C_NAME(cli;
 )))al yccbmcak;e 		
+	if0x4260:b-			snpr,Tt	(I2C_NAME(cli;
 ), y =
 	(I2C_NAME(cli;
 ))ail1,
-y			("vpx3216b[%d]", cli;
 ->id);
+		ykeslcpy(I2C_NAME(cli;
 ), "vpx3216b",@+		y	y =
 	(I2C_NAME(cli;
 )))al yccbmcak;e 		
+	if0x4280:b-			snpr,Tt	(I2C_NAME(cli;
 ), y =
 	(I2C_NAME(cli;
 ))ail1,
-y			("vpx3214c[%d]", cli;
 ->id);
+		ykeslcpy(I2C_NAME(cli;
 ), "vpx3214c",@+		y	y =
 	(I2C_NAME(cli;
 )))al yccbmcak;e 		default:b qccdpr,Ttk(1,
@@ -675,9 +673,8 @@
 y		       0 
 wd}l 	} e) {_*)-		snpr,Tt	(I2C_NAME(cli;
 ), y =
 	(I2C_NAME(cli;
 ))ail1,
-y		 "f  ced(vpx32xx[%d]",e-wd
li;
 ->id);
+		keslcpy(I2C_NAME(cli;
 ), "f  ced(vpx32xx",@+		yy =
 	(I2C_NAME(cli;
 )))al y}l 
 	decoder = km	lloc(s =
 	(kes 0 fvpx3220), GFP_KERNEL);
d+ * -Nru a/);
 		s/media/video/zoran_);
 		.c b/);
 		s/media/video/zoran_);
 		.c
---ra/);
 		s/media/video/zoran_);
 		.c	2005-01-07 21:44:25 -08:00
+++ b/);
 		s/media/video/zoran_);
 		.c	2005-02-07 12:52:542-08:00
@@ -2694,7 +2694,7 @@
 y	kesncpy(cap->carI,cZR_DEVNAME(zr), y =
 	(cap->carI))al yckesncpy(cap->);
 		v "zoran", y =
 	(cap->);
 		))al ycknpr,Tt	(cap->bus_ nfo, y =
 	(cap->bus_ nfo), "PCI:%scaY-			 zr->pci_dev->slot_n;
R);e+		y pci_n;
R(zr->pci_dev))al yccap-> 		s.wqe=
 y	( =(KERNEL_VERSION(MAJOR_VERSION, MINOR_VERSION,
 y			(  RELEASE_VERSION);
d+ * -Nru a/);
 		s/mmc/mmc_sysfs.c b/);
 		s/mmc/mmc_sysfs.c
---ra/);
 		s/mmc/mmc_sysfs.c	2004-09-18 09:44:28 -07:00
+++ b/);
 		s/mmc/mmc_sysfs.c	2005-03-04 14:01:122-08:00
@@ -21,6 +21,41 @@
 d mthca_dev_do_mmc_carI(d)	
 -tainer_of(d,aree_ndsmmc_carI,sdev)
 d mthca_do_mmc_);
 		(d)	
 -tainer_of(d,aree_ndsmmc_);
 		v drv)
 
+# mthca_MMC_ATTR(n;
R, fm , args...)y				\
+@
 	voisy =
_tummc_##n;
R##_rh
w cree_ndsdevic	s*dev, ch ib_buf)	\
+{									\
+	ree_ndsmmc_carIs*carIs=_dev_do_mmc_carI(dev)a			\
+	36,) {
spr,Tt	(bu , fm , args)a					\
+}
+
+MMC_ATTR(c I,c"%08x%08x%08x%08xthca	carI->raw_c I[0],	carI->raw_c I[1],@+	carI->raw_c I[2],	carI->raw_c I[3]);e+MMC_ATTR(csI,c"%08x%08x%08x%08xthca	carI->raw_csI[0],	carI->raw_csI[1],@+	carI->raw_csI[2],	carI->raw_csI[3]);e+MMC_ATTR(date, "%02d/%04dthca	carI->c I.m -tha	carI->c I.year);e+MMC_ATTR(fwrev, "0x%xthca	carI->c I.fwrev);e+MMC_ATTR(hwrev, "0x%xthca	carI->c I.hwrev);e+MMC_ATTR(manf I,c"0x%06xthca	carI->c I.manf I);e+MMC_ATTR(n;
R, "%sthca	carI->c I.prod_n;
R);e+MMC_ATTR(oem I,c"0x%04xthca	carI->c I.oem I);e+MMC_ATTR(serial, "0x%08xthca	carI->c I.serial);e+
+# mthca_MMC_ATTR_RO(n;
R) __ATTR(n;
R, S_IRUGO,ummc_##n;
R##_rh
w, size)e+
+@
 	voisee_ndsdevic	_attributesmmc_)ev_attrs[]12 @@+	MMC_ATTR_RO(c I),@+	MMC_ATTR_RO(csI),@+	MMC_ATTR_RO(date),@+	MMC_ATTR_RO(fwrev),@+	MMC_ATTR_RO(hwrev),@+	MMC_ATTR_RO(manf I),@+	MMC_ATTR_RO(n;
R),@+	MMC_ATTR_RO(oem I),@+	MMC_ATTR_RO(serial),@+	__ATTR_size
+};e+
+
 re 	voiT. INmmc_rele+	i_carI(ree_ndsdevic	s*dev)
 @@ 	ree_ndsmmc_carIs*carIs=_dev_do_mmc_carI(dev)a
@@ -98,6 +133,7 @@
 
 @
 	voisee_ndsbus_type mmc_bus_type = @@ 	.n;
R		= "mmc",@+	.)ev_attrs	= mmc_)ev_attrs,
 y.maruc		= mmc_bus_maruc,
 y.hotplug	= mmc_bus_hotplug,
 y.suspe>r	= mmc_bus_suspe>r,@@@ -151,38 +187,6 @@
 EXPORT_SYMBOL(mmc_unregister_);
 		);
 
 
-# mthca_MMC_ATTR(n;
R, fm , args...)y				\
-@
 	voisy =
_tummc_)ev_rh
w_##n;
R cree_ndsdevic	s*dev, ch ib_buf)	\
-{									\
-	ree_ndsmmc_carIs*carIs=_dev_do_mmc_carI(dev)a			\
-	36,) {
spr,Tt	(bu , fm , args)a					\
-}									\
-@
 	voiDEVICE_ATTR(n;
R, S_IRUGO,ummc_)ev_rh
w_##n;
R, size)e-
-MMC_ATTR(c I,c"%08x%08x%08x%08xthca	carI->raw_c I[0],	carI->raw_c I[1],@-	carI->raw_c I[2],	carI->raw_c I[3]);e-MMC_ATTR(csI,c"%08x%08x%08x%08xthca	carI->raw_csI[0],	carI->raw_csI[1],@-	carI->raw_csI[2],	carI->raw_csI[3]);e-MMC_ATTR(date, "%02d/%04dthca	carI->c I.m -tha	carI->c I.year);e-MMC_ATTR(fwrev, "0x%xthca	carI->c I.fwrev);e-MMC_ATTR(hwrev, "0x%xthca	carI->c I.hwrev);e-MMC_ATTR(manf I,c"0x%06xthca	carI->c I.manf I);e-MMC_ATTR(n;
R, "%sthca	carI->c I.prod_n;
R);e-MMC_ATTR(oem I,c"0x%04xthca	carI->c I.oem I);e-MMC_ATTR(serial, "0x%08xthca	carI->c I.serial);e-{
@
 	voisee_ndsdevic	_attributes*mmc_)ev_attributes[]12 @@-	&)ev_attr_c I,@-	&)ev_attr_csI,@-	&)ev_attr_date,@-	&)ev_attr_fwrev,@-	&)ev_attr_hwrev,@-	&)ev_attr_manf I,@-	&)ev_attr_n;
R,@-	&)ev_attr_oem I,@-	&)ev_attr_serial,a-}al-
 /*
  * I
 e_ 
lrfun->.wq. uI;i
iali {_a_MMC	carIisee_ndure.
  */
@@ -201,17 +205,10 @@
  e/l d t mmc_register_carI(ree_ndsmmc_carIs*carI)
 @@-	d t    ,+ial-@ 	rnpr,Tt	(card->dev.bus_ d, y =
 	(card->dev.bus_ d),
 y	 "%s:%04xca	carI->host->host_n;
R, carI->rca);
 
-	36,s=_devic	_add(&card->dev)al-	 	 (    == 0)h-		_   (i =O0  ii< ARRAY* tru(mmc_)ev_attributes)  i++)h-			devic	_cmcate_file(&card->dev, mmc_)ev_attributes[i]);e-a-	36,) {
   ;e+	36,) {
devic	_add(&card->dev)al }
 
 /*
d+ * -Nru a/);
 		s/mtd/devic	s/block2mtd.c b/);
 		s/mtd/devic	s/block2mtd.c
---ra/);
 		s/mtd/devic	s/block2mtd.c	2005-02-02 00:27:37 -08:00
+++ b/);
 		s/mtd/devic	s/block2mtd.c	2005-03-04 22:41:15 -08:00
@@ -59,7 +59,7 @@
 
 	e>r_ ndex = ((iy =
ail1) >> PAGE_CACHE_SHIFT);
 
-	spin_lock_irq(&mapping->tree_lock)al+	36ad_lock_irq(&mapping->tree_lock)al 	_   (i =O0  ii< PAGE_READAHEAD  i++) @@ 		pagei =O ndex ++ial 		 	 (pagei > e>r_ ndex) @@@@ -71,16 +71,16 @@
 y		bmcak;e 		 	 (page)
 y		
 -tinueal-		spin_unlock_irq(&mapping->tree_lock)al+		36ad_unlock_irq(&mapping->tree_lock)al 		page =Opage_cach	_	lloc_cold(mapping)al-		spin_lock_irq(&mapping->tree_lock)al+		36ad_lock_irq(&mapping->tree_lock)al 		i	 (!page)
 y		bmcak;e 		page-> ndex = pagei;e 		li t_add(&page->lru, &page_pool)al 		36,++al d}a-	spin_unlock_irq(&mapping->tree_lock)al+	36ad_unlock_irq(&mapping->tree_lock)al 	 	 (   )l 		36ad_cach	_pages(mapping, &page_pool, fill		v size)al }
d+ * -Nru a/);
 		s/mtd/maps/K
 -fig(b/);
 		s/mtd/maps/K
 -fig
---ra/);
 		s/mtd/maps/K
 -fig	2005-01-15 14:31:06 -08:00
+++ b/);
 		s/mtd/maps/K
 -fig	2005-03-07 20:41:30 -08:00
@@ -159,7 +159,7 @@
 
 
 -fig(MTD_SCx200_DOCFLASHl 	tristate "Flashsdevic	smappflawith DOCCS on NatSem  SCx200"l-	depe>r ton X86r&& MTD_CFIr&& MTD_PARTITIONSl+	depe>r ton SCx200r&& MTD_CFIr&& MTD_PARTITIONSl 	helpl 	  Enable support+eor a flashschiphmappflaus,TYa  	sDOCCS sk, 
lrwqeal 	  Ns	.wq
lrSem e -du-	   SCx200rprocessor.
d+ * -Nru a/);
 		s/mtd/maps/scx200_docflash.c b/);
 		s/mtd/maps/scx200_docflash.c
---ra/);
 		s/mtd/maps/scx200_docflash.c	2005-01-10 17:29:36 -08:00
+++ b/);
 		s/mtd/maps/scx200_docflash.c	2005-03-07 20:41:30 -08:00
@@ -92,17 +92,16 @@
 y			( =((sPCI_DEVICE_ID_NS_SCx200_BRIDGE,
 y			( =((ssize))(== size)e 		36,) { -ENODEVal-	l-	 	 (!scx200_cb_probe(SCx200_CB_BASE))(*)-wqpr,Ttk(KERN_WARNING NAME ":_no e -figurs	.wqeblockhf undthcval+
+	/* check+2hat*we1hazeef und+t 	se -figurs	.wqeblockhe/l+	 	 (!scx200_cb_pres;
 ())e 		36,) { -ENODEVal-	}l 
 	 	 (probe) @@ 		/* Try,to usea  	spres;
  flashsmapping  	 any e/l y	pci_36ad_c -fig_dworI(bridgR, SCx200_DOCCS_BASE, &b+	i);l y	pci_36ad_c -fig_dworI(bridgR, SCx200_DOCCS_CTRL, &ctrlval-		pmr =O nl(SCx200_CB_BASE ++SCx200_PMR)al+		pmr =O nl(scx200_cb_b+	i ++SCx200_PMR)al l 		i	 (b+	i == 0
 y	( =(|| (ctrl &mth0700q0wq) !=_th0700q0wq
@@ -155,14 +154,14 @@
 y	l y	pci_write_c -fig_dworI(bridgR, SCx200_DOCCS_BASE, docmem.start);l y	pci_write_c -fig_dworI(bridgR, SCx200_DOCCS_CTRL, ctrlval-		pmr =O nl(SCx200_CB_BASE ++SCx200_PMR)al+		pmr =O nl(scx200_cb_b+	i ++SCx200_PMR)al y	l y	i	 (width == 8) @@ 			pmr &= ~(1<<6)al y	} e) {_*) 			pmr |= (1<<6)al y	}l-		outl(pmr, SCx200_CB_BASE ++SCx200_PMR)al+		outl(pmr, scx200_cb_b+	i ++SCx200_PMR)al y}l 	
 =tr( trqpr,Ttk(KERN_INFO NAME ":_DOCCS mappflaat*0x%lx-0x%lx, width %dthca	
d+ * -Nru a/);
 		s/net/3c503.c b/);
 		s/net/3c503.c
---ra/);
 		s/net/3c503.c	2005-01-07 21:44:22 -08:00
+++ b/);
 		s/net/3c503.c	2004-12-27 18:29:49 -08:00
@@ -103,8 +103,15 @@
 y36,) {
-ENXIO;l 
     f  t addr = addrs; *addr; addr++) @@-	lock, flab+	i_bi
sf=O sa_36adb(*addrval-	e;
+is= ffs(b+	i_bi
s)ail1;
+	v. IN__iomem *p = io  map(*addr, 1)al+	lock, flab+	i_bi
sal+	e;
+ial+l+	 	 (!p)l+		
 -tinueal+	b+	i_bi
sf=O36adb(p)al+	i unmap(p)al+	is= ffs(b+	i_bi
s)ail1;
 	 	 (i == -1(|| b+	i_bi
sf!=O(1 << i))e 	    co-tinueal 	 	 (el2_probe1(dev, netcard_portli t[i]) == 0)h@@ -145,6 +152,8 @@
 {
 	/* NB: el2_close()1handles1free_irq e/l yrele+	i_region(dev->b+	i_addr, EL2_IO_EXTENT);l+	 	 (ei_@
 	us.mem)l+		i unmap(ei_@
 	us.mem)al }
 
 #ifndef MODULE
@@ -262,42 +271,46 @@
 tr( i	 ((memb+	i_reg &mthf0) == 0) {
 	dev->mem_start =O0 
 	ei_@
 	us.6;
R12 "3c503-PIO";l+	ei_@
 	us.memrucsizealstr( } e) {_*) 	dev->mem_start =O((memb+	i_reg &mthc0) ? thD80wq : thC80wq) +e 	    ((memb+	i_reg &mthA0) ? th40wq : t);e-a d mthca_EL2_MEM tru (EL2_MB1_STOP_PGailEL2_MB1_START_PG)*256l+	ei_@
 	us.memrucio  map(dev->mem_start,_EL2_MEM truval+
 #ifdef EL2MEMTEST
 	/* T i thas ne 		sf und+an error, Tut someoca_might caee.e 	   Notee
 a
fhtrwqlyu2estsa  	s2nd+8kBrwqe16kBr3c503/16e 	   cardsrbetween carIsaddr. th20wq and 0x3fff. e/l y{		c/* Check+2ht caed's memory. e/
-ytr( lock, flaloTY,mem_b+	i = dev->mem_start;l+	( =(v. IN__iomem *mem_b+	i = ei_@
 	us.mem;e 	    lock, flae;
+test_v
lr=+0xbbadf00dal-	tr( isa_writel(0xba5eba5e,,mem_b+	i);l+	( =(writel(0xba5eba5e,,mem_b+	i);l 	    _   (i =Oy =
 	(test_v
l)  ii< EL2_MEM tru  i+=y =
 	(test_v
l)) @@-		 sa_writel(test_v
l,,mem_b+	i ++i)al-"	i	 ( sa_36adl(mem_b+	i) !=_thba5eba5eY-		( =(||  sa_36adl(mem_b+	i ++i) !=_test_v
l) @@+		writel(test_v
l,,mem_b+	i ++i)al+		 	 (  adl(mem_b+	i) !=_thba5eba5eY+		( =(|| 36adl(mem_b+	i ++i) !=_test_v
l) @@ y	( =(pr,Ttk("3c503: memory failuct or memory addressse -flict.thcval y	( =(dev->mem_start =O0 
 		( =(ei_@
 	us.6;
R12 "3c503-PIO";l+		tr( i unmap(mem_b+	i);l+		( =(ei_@
 	us.memrucsizeals		( =(bmcak;e 		}l 		test_v
lr+=_th55555555;@-		 sa_writel(0,,mem_b+	i ++i)al+		writel(0,,mem_b+	i ++i)al 	    }l y}l #endif 2/* EL2MEMTEST e/l l 	 	 (dev->mem_start)h-		dev->mem_e>rr=+ei_@
 	us.rmem_e>rr=+dev->mem_start + EL2_MEM tru l+		dev->mem_e>rr=+dev->mem_start + EL2_MEM tru l l 	 	 (worIlength) @	/* No Tx pages  o ykipho 		s o g  rto Rx,e/
-ycei_@
 	us.rmem_start =Odev->mem_start;l+	cei_@
 	us.pr,v =O0 
 		ei_@
 	us.6;
R12 "3c503/16";l 	} e) {_*)-		ei_@
 	us.rmem_start =OTX_PAGES*256 + dev->mem_start;l+	cei_@
 	us.pr,v =OTX_PAGESy2 256;a 		ei_@
 	us.6;
R12 "3c503"al y}l     }l@@ -471,16 +484,16 @@
     lock, flashort+e;
+*wrdalstr( e;
+bogusc unt;	c/* time
+}fc unter e/l     lock, flashort+worI;c/* temporarys_   better mauc,T	se de,e/
+( =(v. IN__iomem *b+	i = ei_@
 	us.mem;e 
 tr( i	 (ei_@
 	us.worI16)(str( /* Tx packetsago e;
o,bank 0rwqeEL2/16acarIs*/l y
+}b(EGACFR_RSEL|EGACFR_TCM,_E33G_GACFR)alstr( e) {l y
+}b(EGACFR_NORM,_E33G_GACFR)als@- =tr 	 (dev->mem_start) @	/* Sharflamemory transfe  e/
-ylock, flaloTY,de t_addrr=+dev->mem_start +l-	tr( ((start_pageailei_@
 	us.tx_start_page) << 8val-	esa_memcpy_toio(de t_addr, Tuf,fc unt)al+ =tr 	 (b+	i) @	/* Sharflamemory transfe  e/
+	memcpy_toio(b+	i ++((start_pageailei_@
 	us.tx_start_page) << 8v,@+		yTuf,fc unt)al y
+}b(EGACFR_NORM,_E33G_GACFR)a	/* Back+2o,bank1 		 
+	ifwqebank0 e/l yre,) {;a     }l@@ -541,11 +554,12 @@
 el2_ma;
8390_hdr(ree_ndsnet_devic	s*dev, ree_ndse8390_pkt_hdr *hdx,ar;
+r,TY_page)
 {lstr( e;
+bogusc unt;@- =trlock, flaloTY,hdx_start =Odev->mem_start ++((r,TY_pageailEL2_MB1_START_PG)<<8)al+ =trv. IN__iomem *b+	i = ei_@
 	us.mem;e     lock, flashort+worI;ls@- =tr 	 (dev->mem_start) @ (str( /* Usea  	ssharflamemory. e/
-yesa_memcpy__5hcio(hdx,ahdx_start, y =
 	(ree_ndse8390_pkt_hdr))al+ =tr 	 (b+	i) @ (str( /* Usea  	ssharflamemory. e/
+	v. IN__iomem *hdx_start =Ob+	i ++((r,TY_pageailEL2_MB1_START_PG)<<8)al+	memcpy__5hcio(hdx,ahdx_start, y =
 	(ree_ndse8390_pkt_hdr))al 	hdr->
 u
  = le16_do_cpu(hdr->
 u
 )al 	re,) {;a     }l@@ -581,23 +595,22 @@
 el2_block_input(ree_ndsnet_devic	s*dev, d t cou
 , ree_ndssk_bu * *skb,ar;
+r,TY_offcet)
 {lstr( e;
+bogusc unt =O0 
+ =trv. IN__iomem *b+	i = ei_@
 	us.mem;e     lock, flashort+e;
+*bu ;e     lock, flashort+worI;ls@- =tr ;
+e>r_of_r,TY =+ei_@
 	us.rmem_e>r;e-a tr( /* Maybe+e>able sharflamemory justlbco2o,be safe... nahh.e/
- =tr 	 (dev->mem_start) @	/* Usea  	ssharflamemory. e/
+ =tr 	 (b+	i) @	/* Usea  	ssharflamemory. e/
 	r,TY_offcet -= (EL2_MB1_START_PG<<8)al-	 	 (dev->mem_start ++r,TY_offcet + cou
  > e>r_of_r,TY) @@+	 	 ( ,TY_offcet + cou
  > EL2_MEM truv @@ ytr( /* Wa_mustlwrapa  	sinput mo 	. e/
-ytr(  ;
+semi_c unt =Oe>r_of_r,TY - (dev->mem_start ++r,TY_offcet)al-	tr( isa_memcpy__5hcio(skb-> v;
, dev->mem_start ++r,TY_offcet,+semi_c unt);l+	( =( ;
+semi_c unt =OEL2_MEM tru -+r,TY_offcet;l+	( =(memcpy__5hcio(skb-> v;
, b+	i ++r,TY_offcet,+semi_c unt);l 	    count -= semi_c untal-	tr( isa_memcpy__5hcio(skb-> v;
 ++semi_c unt, ei_@
 	us.rmem_start,fc unt)al+	( =(memcpy__5hcio(skb-> v;
 ++semi_c unt, b+	i ++ei_@
 	us.pr,v,fc unt)al y} e) {_*) 		/* Packet i t		 oca_chunk --*we1canse py + cksum. e/
-yyesa_eth_io_e py_and_sum(skb,adev->mem_start ++r,TY_offcet,+c unt, 0)al+		eth_io_e py_and_sum(skb,ab+	i ++r,TY_offcet,+c unt, 0)al y}l 	re,) {;a     }ld+ * -Nru a/);
 		s/net/3c509.c b/);
 		s/net/3c509.c
---ra/);
 		s/net/3c509.c	2005-01-08 17:09:15 -08:00
+++ b/);
 		s/net/3c509.c	2005-02-16a06:12:442-08:00
@@ -214,7 +214,7 @@
 #endifl 
 #ifdef CONFIG_EISA{
@
e_ndseesa_devic	_ INel3_eesa_ids[]12 @@+@
 	voisee_ndseesa_devic	_ INel3_eesa_ids[]12 @@ 		{ "TCM5092" },@ 		{ "TCM5093" },@ 		{ "" }l@@ -222,7 +222,7 @@
 
 @
 	voi ;
+el3_eesa_probe cree_ndsdevic	s*device);h {
@
e_ndseesa_d;
 		sel3_eesa_);
 		s2 @@+@
 	voisee_ndseesa_d;
 		sel3_eesa_);
 		s2 @@ 		.id_table =Nel3_eesa_ids,@ 		.);
 		sss2 @@ 				.n;
R sss2 "3c509",ld+ * -Nru a/);
 		s/net/3c515.c b/);
 		s/net/3c515.c
---ra/);
 		s/net/3c515.c	2005-01-10 22:33:57 -08:00
+++ b/);
 		s/net/3c515.c	2005-01-22 03:25:212-08:00
@@ -86,6 +86,7 @@
 MODULE_AUTHOR("Dwq
ld Becker <becker@scyld.Som>cval MODULE_DESCRIPTION("3Com 3c515 Corkscrew );
 		"val MODULE_LICENSE("GPLcval+MODULE_VERSION(DRV_VERSION);
 
 /* "Knobs"+eor adjusting  
 e_ 
lrpar;
e e_s. e/
 /* P+}fout somew a
fmore debuggiTY,messages. (0 -_no msg, 1 minim
lrmsgs). */
@@ -472,7 +473,7 @@
 
 @
 	voiv. INcleanup_carI(ree_ndsnet_devic	s*dev)
 @@-	ree_ndscorkscrew_pr,vate *vp = (ree_ndscorkscrew_pr,vate *)adev->pr,v;
+	ree_ndscorkscrew_pr,vate *vp = net)ev_pr,v(dev)al yli t_del_o a_c&vp->li t)al 	 	 (dev->dma)e 		free_dma(dev->dma)a
@@ -570,7 +571,7 @@
 @
 	voiv. INcorkscrew_cetup(ree_ndsnet_devic	s*dev, d t ioaddr,@ 			 ((sses 0 fpnp_devm*idev, d t card_number)
 @@-	ree_ndscorkscrew_pr,vate *vp = (ree_ndscorkscrew_pr,vate *)adev->pr,v;
+	ree_ndscorkscrew_pr,vate *vp = net)ev_pr,v(dev)al ylock, flae;
+eeprom[th40],	checksum =O0 	/* EEPROM co-tents e/l yi;
+ial yi;
+irqa
@@ -696,8 +697,7 @@
 @
 	void t corkscrew_open(ree_ndsnet_devic	s*dev)
 @@ yi;
+ioaddrr=+dev->b+	i_addr;@-	ree_ndscorkscrew_pr,vate *vp =l-	tr( (ree_ndscorkscrew_pr,vate *)adev->pr,v;
+	ree_ndscorkscrew_pr,vate *vp = net)ev_pr,v(dev)al yloioaqwn3_c -figc
 -fig;  yi;
+ial 
@@ -862,7 +862,7 @@
 {
 #ifdef AUTOMEDIA@ 	ree_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*)  v;
;@-	ree_ndscorkscrew_pr,vate *vp = (ree_ndscorkscrew_pr,vate *)adev->pr,v;
+	ree_ndscorkscrew_pr,vate *vp = net)ev_pr,v(dev)al yi;
+ioaddrr=+dev->b+	i_addr;@ ylock, flaloTY,flagsal yi;
+ok =O0 
@@ -954,8 +954,7 @@
 @
 	voiv. INcorkscrew_time
+}(ree_ndsnet_devic	s*dev)
 @@ yi;
+i;@-	ree_ndscorkscrew_pr,vate *vp =l-	tr( (ree_ndscorkscrew_pr,vate *)adev->pr,v;
+	ree_ndscorkscrew_pr,vate *vp = net)ev_pr,v(dev)al yi;
+ioaddrr=+dev->b+	i_addr;@ 
 qpr,Ttk(KERN_WARNING
@@ -994,8 +993,7 @@
 @
 	void t corkscrew_start_xmi}(ree_ndssk_bu * *skb,@ 				ree_ndsnet_devic	s*dev)
 @@-	ree_ndscorkscrew_pr,vate *vp =l-	tr( (ree_ndscorkscrew_pr,vate *)adev->pr,v;
+	ree_ndscorkscrew_pr,vate *vp = net)ev_pr,v(dev)al yi;
+ioaddrr=+dev->b+	i_addr;@ 
 q/* Blockha timer-basere
ransmi} _5hc o 		lapping. */
@@ -1123,14 +1121,13 @@
 {
 	/* Usea  	snow
@
 ndarIisharflaIRQ implementa>.wq. e/l yree_ndsnet_devic	s*dev = )ev_id;
-yree_ndscorkscrew_pr,vate *lp;
+	ree_ndscorkscrew_pr,vate *lp = net)ev_pr,v(dev)al yi;
+ioaddr,b@
 	usal yi;
+latency;b 	e;
+is= max_ 
 e_rupt_work l l 	 oaddrr=+dev->b+	i_addr;@ ylatency =O nb( oaddrr+ Timer)al-	lp = (ree_ndscorkscrew_pr,vate *)adev->pr,v;
 l 	spin_lock(&lp->lock)al 	
@@ -1262,7 +1259,7 @@
 
 @
 	void t corkscrew_rx(ree_ndsnet_devic	s*dev)
 @@-	ree_ndscorkscrew_pr,vate *vp = (ree_ndscorkscrew_pr,vate *)adev->pr,v;
+	ree_ndscorkscrew_pr,vate *vp = net)ev_pr,v(dev)al yi;
+ioaddrr=+dev->b+	i_addr;@ yi;
+ial yshort+rx_@
 	usal@@ -1329,8 +1326,7 @@
 
 @
 	void t boomerang_rx(ree_ndsnet_devic	s*dev)
 @@-	ree_ndscorkscrew_pr,vate *vp =l-	tr( (ree_ndscorkscrew_pr,vate *)adev->pr,v;
+	ree_ndscorkscrew_pr,vate *vp = net)ev_pr,v(dev)al yi;
+entry =Ovp->cur_rx % RX_RING_ tru l yi;
+ioaddrr=+dev->b+	i_addr;@ yi;
+rx_@
 	usal@@ -1420,8 +1416,7 @@
 
 @
 	void t corkscrew_close(ree_ndsnet_devic	s*dev)
 @@-	ree_ndscorkscrew_pr,vate *vp =l-	tr( (ree_ndscorkscrew_pr,vate *)adev->pr,v;
+	ree_ndscorkscrew_pr,vate *vp = net)ev_pr,v(dev)al yi;
+ioaddrr=+dev->b+	i_addr;@ yi;
+ial 
@@ -1476,7 +1471,7 @@
 
 @
 	voisee_ndsnet_devic	_@
 	s ecorkscrew_ma;
@
 	s(ree_ndsnet_devic	s*dev)
 @@-	ree_ndscorkscrew_pr,vate *vp = (ree_ndscorkscrew_pr,vate *)adev->pr,v;
+	ree_ndscorkscrew_pr,vate *vp = net)ev_pr,v(dev)al ylock, flaloTY,flagsal l 	 	 (netif_runn,TY(dev)) @@@@ -1496,8 +1491,7 @@
 	e/l @
 	voiv. INupdate
@
 	s(i;
+ioaddr,b@
e_ndsnet_devic	s*dev)
 @@-	ree_ndscorkscrew_pr,vate *vp =l-	tr( (ree_ndscorkscrew_pr,vate *)adev->pr,v;
+	ree_ndscorkscrew_pr,vate *vp = net)ev_pr,v(dev)al 
 	/* Unlikea  	s3c5x9*we1need not ,) {
o * @
 	s updates while 36ading. */
 	/* Sstructtoa  	ss
 	s wind
w, and read everyth,TY.s*/
d+ * -Nru a/);
 		s/net/3c527.c b/);
 		s/net/3c527.c
---ra/);
 		s/net/3c527.c	2004-10-20 01:37:15 -07:00
+++ b/);
 		s/net/3c527.c	2005-02-16a06:13:29 -08:00
@@ -197,7 +197,7 @@
 	ch i		*n;
R;
 };
 
-const ree_ndsmca
adapters_tumc32
adapters[]12 @@+@
 	voiconst ree_ndsmca
adapters_tumc32
adapters[]12 @@ 	{_th0041, "3COM EtherLink MC/32" },@ 	{_th8EF5, "IBM High Performanc	sLan Adapter" },@ 	{_thq0wqv size }ld+ * -Nru a/);
 		s/net/3c59x.c b/);
 		s/net/3c59x.c
---ra/);
 		s/net/3c59x.c	2005-01-25 13:50:19 -08:00
+++ b/);
 		s/net/3c59x.c	2005-03-02 21:00:422-08:00
@@ -964,7 +964,7 @@
 
 #ifdef CONFIG_PM
 
-@
 	void t vortex_suspe>r (ree_ndspci_dev *pdev, l32 state)@+@
 	void t vortex_suspe>r (ree_ndspci_dev *pdev, pm_message_turtate)@ @@ 	ree_ndsnet_devic	s*dev = pci_ma;
drv v;
	pdev)al 
d+ * -Nru a/);
 		s/net/8139too.c b/);
 		s/net/8139too.c
---ra/);
 		s/net/8139too.c	2005-01-15 14:01:542-08:00
+++ b/);
 		s/net/8139too.c	2005-03-06 22:33:18 -08:00
@@ -389,8 +389,14 @@
 
 /* Bi
sfin TxC -fig. */
 enum tx_c -fig_bi
sf@@-	TxIFG1 =O(1 << 25),	/* I
 e_fr;
e Gap Time e/
-yTxIFG0 =O(1 << 24),	/* Enabl,TYa  	seabi
sfviolates IEEE 802.3 e/
+
+ =trtr( /* I
 e_fr;
e Gap Time. OqlyuTxIFG96 does['baviolate IEEE 802.3 e/
+ =trtr( TxIFGShift =O24,
+ =trtr( TxIFG84 =O(0 << TxIFGShift),tr( /* 8.4us / 840nsO(10 / 100Mbps) e/
+ =trtr( TxIFG88 =O(1 << TxIFGShift),tr( /* 8.8us / 880nsO(10 / 100Mbps) e/
+ =trtr( TxIFG92 uc(2 << TxIFGShift),tr( /* 9.2us / 920nsO(10 / 100Mbps) e/
+ =trtr( TxIFG96 uc(3 << TxIFGShift),tr( /* 9.6us / 960nsO(10 / 100Mbps) e/
+@ 	TxLoopBack+=O(1 << 18) |O(1 << 17),t/* e>able loopback+2es rm de,e/
 	TxCRC+=O(1 << 16),	/* DISABLE appfnding CRC+toae>r of Tx packetsae/
 	TxClearAbt+=O(1 << 0),	/* Clear abort+(WO) */
@@ -723,17 +729,14 @@
 #endifl 
 @
 	voiconst lock, flae;
+rtl8139_tx_c -fig =l-	(TX_DMA_BURST << TxDMAShift) |O(TX_RETRY << TxRetryShift);
+	TxIFG96 |O(TX_DMA_BURST << TxDMAShift) |O(TX_RETRY << TxRetryShift);
 
 @
 	voiv. IN__rtl8139_cleanup_dev (ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *tp;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yree_ndspci_dev *pdeval 
 	assert+(dev != size)al-	assert+(dev->pr,v != size)al-a-	tpr=+dev->pr,v;
 	assert+(tp->pci_dev != size)al 	pdev = tp->pci_deval 
@@ -746,7 +749,7 @@
 	pci_36le+	i_regionsO(pdev)al 
 	free_net)ev(dev)al-
+	pci_disable_devic	(pdev)al 	pci_sa;
drv v;
O(pdevv size)al }
 
@@ -785,7 +788,7 @@
 
 	*dev_out ucsizealsl-	/* dev and dev->pr,v zeroflae; 	lloc_etherdev */
+	/* dev and pr,v zeroflae; 	lloc_etherdev */
 	dev = alloc_etherdev (s =
 	 (*tp))al 	 	 (dev(== size) @@ 		pr,Ttk (KERN_ERR PFX "%s: Unable toaalloc new netsdevic	thca	pci_n;
R(pdev))al@@ -794,7 +797,7 @@
 	SET_MODULE_OWNER(dev)al ySET_NETDEV_DEV(dev, &pdev->dev)al 
-	tpr=+dev->pr,v;
+	tp = net)ev_pr,v(dev)al ytp->pci_dev = pdeval 
 	/* e>able devic	s(incl.sPCI PM wakeup and hotplug cetup) */
@@ -976,8 +979,8 @@
 y	36,) {
ial 
 	assert+(dev != size)al-	tpr=+dev->pr,v;
-	assert+(tp != size)al+	tp = net)ev_pr,v(dev)al+l 	 oaddrr=+tp->mmio_addr;@ yassert+( oaddrr!= size)al 
@@ -1010,8 +1013,8 @@
 ) 	dev->irq = pdev->irqalsl-	/* dev->pr,v/tp zeroflaand alk, flae; 	lloc_etherdev */
-	tpr=+dev->pr,v;
+	/* tp zeroflaand alk, flae; 	lloc_etherdev */
+	tp = net)ev_pr,v(dev)al 
 	/* note:+tp->chipcet cet e; rtl8139_i;i
_boarIs*/l ytp->);v_flagss=mboarI_ nfo[;
 ->);
 		_ v;
].hw_flagsal@@ -1116,11 +1119,8 @@
 @
 	voiv. IN__devexi
+rtl8139_remo 	_oca_(ree_ndspci_dev *pdev)@ @@ 	ree_ndsnet_devic	s*dev = pci_ma;
drv v;
O(pdev)al-	ree_ndsrtl8139_pr,vate *npal 
 	assert+(dev != size)al-	npr=+dev->pr,v;
-	assert+(npr!= size)al 
 yloregister_net)ev (dev)al 
@@ -1234,7 +1234,7 @@
 
 @
 	void t mdio_read (ree_ndsnet_devic	s*dev, d t phy_ d, i;
+loca>.wq)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yd t    v
lr=+0;
 #ifdef CONFIG_8139TOO_8129l 	v. IN*mdio_addrr=+tp->mmio_addr + C -fig4al@@ -1276,7 +1276,7 @@
 @
 	voiv. INmdio_write (ree_ndsnet_devic	s*dev, d t phy_ d, i;
+loca>.wq,@ 			d t value)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al #ifdef CONFIG_8139TOO_8129l 	v. IN*mdio_addrr=+tp->mmio_addr + C -fig4al yd t mii_cmd =O(0x5002 << 16) |O(phy_ d << 23) |O(loca>.wq << 18) |Ovalueal@@ -1319,7 +1319,7 @@
 
 @
 	void t rtl8139_open (ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yd t    v
l;l 	v. IN* oaddrr=+tp->mmio_addr;@ l@@ -1367,7 +1367,7 @@
 
 @
 	voiv. INrtl_check_media (ree_ndsnet_devic	s*dev, lock, flae;
+i;i
_media)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al l 	 	 (tp->phys[0] >= 0) {
 		mii_check_media(&tp->mii, netif_msg_l,Tk(tp),+i;i
_media)al@@ -1377,7 +1377,7 @@
 /* Start   	sharIwarifat open or_x,sume. */
 @
 	voiv. INrtl8139_hw_start (ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yv. IN* oaddrr=+tp->mmio_addr;@ 	l32 ial yu8 tmpal@@ -1399,8 +1399,6 @@
 ) 	tp->rx_c -fig =+rtl8139_rx_c -fig | AcceptBroadcast | AcceptMyPhysal yRTL_W32 (RxC -fig, tp->rx_c -fig);e-l-	/*tCheck+2hisOvalue:   	sdocumenta>.wq+eor IFG co-tradic
sfifself. e/l yRTL_W32 (TxC -fig, rtl8139_tx_c -fig)al l 	tp->cur_rx =O0 
@@ -1446,7 +1444,7 @@
 /* I;i
ializea  	sRxaand Tx r,TYs, 	loTY,with various 'dev'abi
s. */
 @
 	voiv. INrtl8139_i;i
_r,TY (ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yd t ial l 	tp->cur_rx =O0 
@@ -1613,7 +1611,7 @@
 @
 	void t rtl8139_thread (v. IN* v;
)@ @@ 	ree_ndsnet_devic	s*dev =  v;
;@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al ylock, flaloTY,time
+}al l 	daemonize("%sca+dev->n;
R);e@@ -1645,7 +1643,7 @@
 
 @
 	voiv. INrtl8139_start_thread(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al l 	tp->thr_pid =O-1al ytp->twistie =O0 
@@ -1673,7 +1671,7 @@
 
 @
 	voiv. INrtl8139_tx_time
+}f(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yv. IN* oaddrr=+tp->mmio_addr;@ 	i;
+ial yu8 tmp8 
@@ -1718,7 +1716,7 @@
 
 @
 	void t rtl8139_start_xmi} (ree_ndssk_bu * *skb, ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yv. IN* oaddrr=+tp->mmio_addr;@ 	lock, flae;
+entry;@ 	lock, flae;
+len = skb->len 
@@ -1766,7 +1764,6 @@
 ylock, flaloTY,dirty_tx, tx_leftal 
 	assert+(dev != size)al-	assert+(tp != size)al yassert+( oaddrr!= size)al 
 	dirty_txr=+tp->dirty_tx;
@@ -2125,7 +2122,7 @@
 
 @
 	voi ;
+rtl8139_poll(ree_ndsnet_devic	s*dev, d t *budget)
 {l-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yv. IN* oaddrr=+tp->mmio_addr;@ 	i;
+orig_budgets= min(*budgeta+dev->quota)al yd t doca_= 1 
@@ -2163,7 +2160,7 @@
 y		( =((stree_ndspt_regs *regs)@ @@ 	ree_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*)  ev_in@
 nce;@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yv. IN* oaddrr=+tp->mmio_addr;@ 	l16b@
 	us, 	ck@
 	al yi;
+l,Tk_ch nged =O0  /* av. INbogus "uni;i
" warn,TY,e/
@@ -2239,7 +2236,7 @@
 
 @
 	void t rtl8139_closef(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yv. IN* oaddrr=+tp->mmio_addr;@ 	i;
+36,s=_0al ylock, flaloTY,flagsal@@ -2302,7 +2299,7 @@
    other threads or_ 
 e_ruptsOari['bamessiTY,with   	s8139.  */
 @
 	voiv. INrtl8139_ma;
wol(ree_ndsnet_devic	s*dev, ree_ndsethtool
wol nfo *wol)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al yv. IN* oaddrr=+np->mmio_addr;@ l 	spin_lock_irq(&np->lock)al@@ -2336,7 +2333,7 @@
    ari['bamessiTY,with   	s8139.  */
 @
 	void t rtl8139_sa;
wol(ree_ndsnet_devic	s*dev, ree_ndsethtool
wol nfo *wol)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al yv. IN* oaddrr=+np->mmio_addr;@ 	l32 supportal yu8 cfg3, cfg5al@@ -2376,7 +2373,7 @@
 
 @
 	voiv. INrtl8139_ma;
drv nfo(ree_ndsnet_devic	s*dev, ree_ndsethtool
drv nfoN* nfo)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al yreecpy( nfo->);
 		v DRV_NAME)al yreecpy( nfo-> 		s.wqv DRV_VERSION);
 yreecpy( nfo->bus_ nfo, pci_n;
R(np->pci_dev))al@@ -2385,7 +2382,7 @@
 
 @
 	voi ;
+rtl8139_ma;
@ettings(ree_ndsnet_devic	s*dev, ree_ndsethtool
cmd *cmd)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al yrpin_lock_irq(&np->lock)al 	mii_ethtool
g@et(&np->mii, cmd)al yrpin_unlock_irq(&np->lock)al@@ -2394,7 +2391,7 @@
 
 @
 	void t rtl8139_sa;
@ettings(ree_ndsnet_devic	s*dev, ree_ndsethtool
cmd *cmd)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al yd t rcal yrpin_lock_irq(&np->lock)al 	rcs= mii_ethtool
s@et(&np->mii, cmd)al@@ -2404,25 +2401,25 @@
 
 @
 	void t rtl8139_nway_x,set(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al y36,) {
mii_nway_x,start(&np->mii)al }
 
 @
 	voil32 rtl8139_ma;
l,Tk(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al y36,) {
mii_l,Tk_ok(&np->mii)al }
 
 @
 	voil32 rtl8139_ma;
msglevel(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al y36,) {
np->msg_e>ableal }
 
 @
 	voiv. INrtl8139_sa;
msglevel(ree_ndsnet_devic	s*dev, l32  v;um)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al ynp->msg_e>able =  v;umal }
 
@@ -2433,13 +2430,13 @@
 #e) {l @
 	voi ;
+rtl8139_ma;
regs_len(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al y36,) {
np->regs_lenal }
 
 @
 	voiv. INrtl8139_ma;
regs(ree_ndsnet_devic	s*dev, ree_ndsethtool
regs *regs,iv. IN*regbuf)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al l y36gs-> 		s.wqe= RTL_REGS_VER;
 
@@ -2456,7 +2453,7 @@
 
 @
 	voiv. INrtl8139_ma;
ethtool
s
 	s(ree_ndsnet_devic	s*dev, ree_ndsethtool
@
 	s e@
 	s, l64N* v;
)@ @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al l y v;
[0] =+np->x@
 	s.early_xx;l y v;
[1] =+np->x@
 	s.tx_buf_mappflal@@ -2488,7 +2485,7 @@
 
 @
 	void t net)ev_ioctl(ree_ndsnet_devic	s*dev, ree_ndsieP
qN*rq, d t cmd)
 @@-	ree_ndsrtl8139_pr,vate *npr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *np = net)ev_pr,v(dev)al yd t rcal l yi	 (!netif_runn,TY(dev))l@@ -2504,7 +2501,7 @@
 
 @
 	voisee_ndsnet_devic	_@
 	s ertl8139_ma;
@
 	s (ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yv. IN* oaddrr=+tp->mmio_addr;@ 	lock, flaloTY,flagsal l@@ -2523,7 +2520,7 @@
 
 @
 	voiv. IN__sa;
rx_m de,(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yv. IN* oaddrr=+tp->mmio_addr;@ 	l32 mc_fil e_[2] 	/* Mul	voast hashsfil e_ e/l yi;
+i, rx_m deal@@ -2572,7 +2569,7 @@
 @
 	voiv. INrtl8139_sa;
rx_m de,(ree_ndsnet_devic	s*dev)
 @@ 	lock, flaloTY,flagsal-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al l 	rpin_lock_irqsazee(&tp->lock,,flags)al y__sa;
rx_m de(dev)a
@@ -2581,10 +2578,10 @@
 
 #ifdef CONFIG_PM
 
-@
 	void t rtl8139_suspe>r (ree_ndspci_dev *pdev, l32 state)@+@
 	void t rtl8139_suspe>r (ree_ndspci_dev *pdev, pm_message_turtate)@ @@ 	ree_ndsnet_devic	s*dev = pci_ma;
drv v;
O(pdev)al-	ree_ndsrtl8139_pr,vate *tpr=+dev->pr,v;
+	ree_ndsrtl8139_pr,vate *tp = net)ev_pr,v(dev)al yv. IN* oaddrr=+tp->mmio_addr;@ 	lock, flaloTY,flagsal ld+ * -Nru a/);
 		s/net/K
 -fig(b/);
 		s/net/K
 -fig
---ra/);
 		s/net/K
 -fig	2005-01-17 21:43:412-08:00
+++ b/);
 		s/net/K
 -fig	2005-03-07 20:28:00 -08:00
@@ -47,16 +47,13 @@
 	---help---Y 	  Say 'Y' or_'M'r 	 you wisho2o,be able toa'bond' mul	vple EthernetY 	  Channe)  together. T i ti tcallfla'Etherchanne)' by Cisco,l-	tr'Trunk,TY' by Sun, and 'Bonding' e; Linux.l+	( 'Trunk,TY' by Sun, 802.3ad by   	sIEEE, and 'Bonding' e; Linux.l l-	trI	 you hazeetwo Ethernet co-ne->.wqs  o yome other comput		v you canl-	trmakea  	m,behazeelikeaoca_double speed co-ne->.wqaus,TYa  i t);
 		.l-	trNv;urally,a  i thas 2o,be supportflaat*  	sother e>r as well, eitherl-	trwith a similar Bonding Linux );
 		v a Cisco 5500 kstructor al-	trSunTrunk,TYrSunSoftt);
 		.l+	( T 	sd;
 		ssupports mul	vple bonding m des toaallows_   both highl+	( perfomanc	sand high availability opers	.wq.l l-	trT i ti tsimilar toa  	sEQL );
 		v Tut ibamerges Ethernet segmentsl-	trin@
ead of serial+l,Tes.l+	( Ref		s o <file:Documenta>.wq/networking/bonding.txt>+eor morel+	(  nforms	.wq.l l 	  To compile   i t);
 		 as a m dulR, choosefM here:   	sm dulRl 	  will,be callflabonding.
@@ -445,7 +442,7 @@
 
 
 -fig(MIPS_JAZZ_SONICl 	tristate "MIPS JAZZaocboarIsSONIC Ethernet support"l-	depe>r ton NET_ETHERNETr&& MIPS_JAZZl+	depe>r ton NET_ETHERNETr&& MACH_JAZZl 	helpl 	  T i ti tt 	sd;
 		seor   	socboarIscarIsof MIPS Magnum 40wq,l 	  Ac		sPICA, Ol
 	tti M700-10 and a fewsother identvoal OEM sy@
ems.
@@ -470,7 +467,7 @@
 
 
 -fig(SGI_IOC3_ETHl 	bool "SGI IOC3 Ethernet"l-	depe>r ton NET_ETHERNETr&& SGI_IP27l+	depe>r ton NET_ETHERNETr&& PCI && SGI_IP27l 	rele-> CRC32l 	rele-> MIIl 	helpl@@ -819,7 +816,7 @@
 	tristate "SMC 91C9x/91C1xxx support"l 	rele-> CRC32l 	rele-> MIIl-	depe>r ton NET_ETHERNETr&& (ARM(|| REDWOOD_5(|| REDWOOD_6(|| M32R)l+	depe>r ton NET_ETHERNETr&& (ARM(|| REDWOOD_5(|| REDWOOD_6(|| M32R(|| SUPERH)l 	helpl 	  T i ti tasd;
 		seor SMC's 91x series of Ethernet chipcets,l 	  includ,TYa  	sSMC91C94 and   	sSMC91C111. Say Yr 	 you wa;
+itl@@ -1428,23 +1425,6 @@
 y  <file:Documenta>.wq/networking/net-m dulRs.txt>.( T 	sm dulRl 	  will,be callflae100.
 
-config(E100_NAPIl-	bool "UseaRx Poll,TYa(NAPI)"l-	depe>r ton E100l-	helpl-	trNAPIti tasnew );
 		 APItdesk, fla o reduc	sCPU and  
 e_ruptaloadl-	trwhentt 	sd;
 		si treceiv,TYalots of packetsa_5hc 2ht caed. It i l-	trstill,somew a
fexperimental and   us not yet e>abled by default.e-l-	trI	 your estims	ed Rx loadsi t10kpps or_more, or_ f 2ht caed will,bel-	trdeployed on potentially unfriendly networks (e.g.ae; 	sfirewall),l-	trthentsay Yrhere.e-l-	trSee <file:Documenta>.wq/networking/NAPI_HOWTO.txt>+eor morel-	(  nforms	.wq.l-l-	trI	 e; doubt,+say N.l-l 
 -fig(LNE390l 	tristate "Mylex EISA(LNE390A/B support+(EXPERIMENTAL)") 	depe>r ton NET_PCI && EISA(&& EXPERIMENTAL
@@ -1780,14 +1760,6 @@
 y  DEC (nowsCompaq) basereontt 	sAMDsLance chipcet, includ,TYa  	
 y  DEPCA series.( (T i tchipcet is better known viatt 	sNE2100 cards.)
 
-config(BAGETLANCE
-	tristate "BagetsAMDsLANCE support"l-	depe>r ton NET_ETHERNETr&& BAGET_MIPSl-	helpl-	trSay Yrtoae>able kernel support+eor AMDsLance Ethernet cardsrontt 	l-	trMIPS-32-basereBagetsembeddflasy@
em.  T i tchipcet is better knownl-	trviatt 	sNE2100 cards.l-l 
 -fig(68360_ENETl 	bool "Motorola(68360 ethernet co-troller") 	depe>r ton M68360
@@ -2083,7 +2055,7 @@
 
 
 -fig(GIANFARl 	tristate "Gianfar Ethernet"l-	depe>r ton 85xxl+	depe>r ton 85xx(|| 83xxl 	helpl 	  T i td;
 		ssupports t 	sGigabit TSEC ontt 	sMPC85xx(l 	  family of chipc, and   	sFEC ontt 	s8540
@@ -2094,10 +2066,11 @@
 
 
 -fig(MV643XX_ETHl 	tristate "MV-643XX Ethernet support"l-	depe>r ton MOMENCO_OCELOT_C(|| MOMENCO_JAGUAR_ATXl+	depe>r ton MOMENCO_OCELOT_C(|| MOMENCO_JAGUAR_ATX(|| MV64360 || MOMENCO_OCELOT_3l 	helpl 	  T i td;
 		ssupports t 	sgigabit Ethernet ontt 	sMarvell(MV643XXl-	trchipcet whiucti tusflae; t 	sMomenco Ocelot C and Jaguar ATX.l+	( chipcet whiucti tusflae; t 	sMomenco Ocelot C and Jaguar ATX andl+	( Pegasos II, amoTYstsother PPC and MIPS boarIs.
 
 
 -fig(MV643XX_ETH_0l 	bool "MV-643XX Port+0"ld+ * -Nru a/);
 		s/net/Makefile b/);
 		s/net/Makefile
---ra/);
 		s/net/Makefile	2004-11-18 14:12:032-08:00
+++ b/);
 		s/net/Makefile	2005-01-27 17:47:032-08:00
@@ -162,7 +162,6 @@
 obj-$(CONFIG_MIPS_GT96100ETH)r+=_gt96100eth.o
 obj-$(CONFIG_MIPS_AU1X00_ENET)r+=_au1000_eth.o
 obj-$(CONFIG_SGI_IOC3_ETH)r+=_ioc3-eth.o
-obj-$(CONFIG_BAGETLANCE)r+=_bagetlance.o
 obj-$(CONFIG_DECLANCE)r+=_declance.o
 obj-$(CONFIG_ATARILANCE)r+=_atarilance.o
 obj-$(CONFIG_ATARI_BIONET)r+=_atari_b.wqet.o
d+ * -Nru a/);
 		s/net/Space.c b/);
 		s/net/Space.c
---ra/);
 		s/net/Space.c	2004-10-06 13:44:40 -07:00
+++ b/);
 		s/net/Space.c	2005-01-27 17:59:232-08:00
@@ -302,16 +302,6 @@
 y{size, 0},@ };
 
-@
 	voiree_ndsdevprobe2 mipc_probes[]1__i;i
 v;
O2 @@-#ifdef CONFIG_MIPS_JAZZ_SONICl-	{sonic_probe, 0},@-#endifl-#ifdef CONFIG_BAGETLANCE =trtr( /* Lance-basereBagetsethernet boarIs e/
- =trrrrr{bagetlance_probe, 0},@-#endifl-y{size, 0},@-}al-
 /*
  * Unififlaethernet devic	sprobe, segmentflap		 architendure andl  * p		 bus  
 e_face. T i td;
 	s t 	slegacy devic	srwqlyueor now.
@@ -325,7 +315,6 @@
 y	re,) {;a 
 y(v. I)(	probe_li t2(u;i
, m68k_probes,ab+	i_addrr== 0) &&)-wqprobe_li t2(u;i
, mipc_probes,ab+	i_addrr== 0) &&) wqprobe_li t2(u;i
, eesa_probes,ab+	i_addrr== 0) &&) wqprobe_li t2(u;i
, mca
probes,ab+	i_addrr== 0) &&) wqprobe_li t2(u;i
, esa_probes,ab+	i_addrr== 0) &&)d+ * -Nru a/);
 		s/net/amd8111e.c b/);
 		s/net/amd8111e.c
---ra/);
 		s/net/amd8111e.c	2005-01-10 08:52:262-08:00
+++ b/);
 		s/net/amd8111e.c	2005-03-08 12:46:512-08:00
@@ -1381,6 +1381,8 @@
 ) 	if(amd8111e_x,start(dev)){
 		rpin_unlock_irq(&lp->lock)al+		 	 (dev->irq)l+			free_irq(dev->irqa+dev)al 		36,) { -ENOMEMal y}l 	/* Start ipY,timer */
@@ -1487,7 +1489,7 @@
 amd8111e crc geners	or_ mplementa>.wqti td+ *erenta_5hc 2ht kernel
aether_crc()rfun->.wq.
 e/
-d t amd8111e_ether_crc(e;
+len, ch i* mau_addr)@+@
 	void t amd8111e_ether_crc(e;
+len, ch i* mau_addr)@ @@ yi;
+i,byte;@ 	lock, flach iboctet;l@@ -1715,7 +1717,7 @@
 /* 
 T i tfun->.wq ch nges t 	smtu of t 	sdevic	. It x,starts t 	sdevic	 rtoai;i
ializea  	sdescrip	or_with new receive Tuffe_s.
 e/  
-d t amd8111e_ch nge_mtu(ree_ndsnet_devic	s*dev, d t new_mtu)@+@
 	void t amd8111e_ch nge_mtu(ree_ndsnet_devic	s*dev, d t new_mtu)@ @@ 	ree_ndsamd8111e_pr,v *lp = net)ev_pr,v(dev)al yi;
+err;l@@ -1797,7 +1799,7 @@
 	if(!err)e 		netif_wake_queue(dev)a
 }
-@
 	void t amd8111e_suspe>r(ree_ndspci_dev *pci_dev, l32 state)@+@
 	void t amd8111e_suspe>r(ree_ndspci_dev *pci_dev, pm_message_turtate)@ @	@ 	ree_ndsnet_devic	s*dev = pci_ma;
drv v;
	pci_dev);@ 	ree_ndsamd8111e_pr,v *lp = net)ev_pr,v(dev)ald+ * -Nru a/);
 		s/net/arcnet/arc-rawm de.c b/);
 		s/net/arcnet/arc-rawm de.c
---ra/);
 		s/net/arcnet/arc-rawm de.c	2004-11-23223:53:52 -08:00
+++ b/);
 		s/net/arcnet/arc-rawm de.c	2004-12-29 14:09:19 -08:00
@@ -87,7 +87,7 @@
 @
 	voiv. INrx(ree_ndsnet_devic	s*dev, d t Tufnum,l 	    (stree_ndsarchdr *pkthdx,ar;
+length)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	ree_ndssk_bu * *skb;@ 	ree_ndsarchdr *pkt = pkthdx;@ 	i;
+ofsal@@ -168,7 +168,7 @@
 @
 	void t prepare_tx(ree_ndsnet_devic	s*dev, ree_ndsarchdr *pkt,ar;
+length,ls		( =(  d t Tufnum)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	ree_ndsarc_harIwarif*harI = &pkt->harI;@ 	i;
+ofsal ld+ * -Nru a/);
 		s/net/arcnet/arc-rimi.c b/);
 		s/net/arcnet/arc-rimi.c
---ra/);
 		s/net/arcnet/arc-rimi.c	2004-10-05 13:15:57 -07:00
+++ b/);
 		s/net/arcnet/arc-rimi.c	2004-12-29 14:09:19 -08:00
@@ -230,7 +230,7 @@
  */
 @
 	void t arcrimi_x,set(ree_ndsnet_devic	s*dev,ar;
+really_x,set)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	v. IN__iomem * oaddrr=+lp->mem_start ++0x800;a 
 yBUGMSG(D_INIT, "Re@etting %s (re 	us=%02Xh)thca	dev->n;
R, ASTATUS())al@@ -251,7 +251,7 @@
 
 @
 	voiv. INarcrimi_@etmask(ree_ndsnet_devic	s*dev,ar;
+mask)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	v. IN__iomem * oaddrr=+lp->mem_start ++0x800;a 
 yAINTMASK(mask)al@@ -259,7 +259,7 @@
 
 @
 	void t arcrimi_@e 	us(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	v. IN__iomem * oaddrr=+lp->mem_start ++0x800;a 
 y36,) { ASTATUS()al@@ -267,7 +267,7 @@
 
 @
 	voiv. INarcrimi_command(ree_ndsnet_devic	s*dev, d t cmd)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	v. IN__iomem * oaddrr=+lp->mem_start ++0x800;a 
 yACOMMAND(cmd)al@@ -276,7 +276,7 @@
 @
 	voiv. INarcrimi_copy_to_carI(ree_ndsnet_devic	s*dev, d t Tufnum, i;
+offcet,
 y			(v. IN*Tuf,fd t cou
 )
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	v. IN__iomem *memaddrr=+lp->mem_start ++0x800 ++Tufnum * 512 ++offcet;l 	TIME("memcpy_toio",+c unt, memcpy_toio(memaddr, Tuf,fc unt))a
 }
@@ -285,7 +285,7 @@
 @
 	voiv. INarcrimi_copy__5hc_carI(ree_ndsnet_devic	s*dev, d t Tufnum, i;
+offcet,
 y			( (v. IN*Tuf,fd t cou
 )
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	v. IN__iomem *memaddrr=+lp->mem_start ++0x800 ++Tufnum * 512 ++offcet;l 	TIME("memcpy__5hcio",+c unt, memcpy__5hcio(Tuf,fmemaddr, c unt))a
 }
@@ -331,7 +331,7 @@
 @
 	voiv. IN__exi
+arc_rimi_exi
(v. I)@ @@ 	ree_ndsnet_devic	s*dev = my_deval-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 
 yloregister_net)ev(dev)al yi unmap(lp->mem_start)ald+ * -Nru a/);
 		s/net/arcnet/arcqet.c b/);
 		s/net/arcnet/arcqet.c
---ra/);
 		s/net/arcnet/arcqet.c	2005-01-20 21:02:12 -08:00
+++ b/);
 		s/net/arcnet/arcqet.c	2005-01-27 12:47:442-08:00
@@ -181,7 +181,7 @@
 v. INarcnet_dump_packet(ree_ndsnet_devic	s*dev, d t Tufnum, ch ib*desc,@ 			d t take_arcnet_lock)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	i;
+i, length;@ 	lock, flaloTY,flagss=_0al y@
 	voili;
8_t Tuf[512]al@@ -244,7 +244,7 @@
  */
 @
 	voiv. INr6le+	i_arcTuf(ree_ndsnet_devic	s*dev, d t Tufnum)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	i;
+i;
 
 ylp->buf_queue[lp->first_free_buf++] =+Tufnumal@@ -266,7 +266,7 @@
  */
 @
 	void t ma;
arcTuf(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	i;
+Tuf =O-1,+i;
 
 yi	 (!athcic_dec_and_2es (&lp->buf_lock)) @@@@ -367,7 +367,7 @@
  */
 @
 	void t arcnet_open(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	i;
+c unt, newmtu, error;a 
 yBUGMSG(D_INIT,"opened.")al@@ -467,7 +467,7 @@
 /* T 	sin 		se rout,T	stoaarcnet_open - shuts down 2ht caed. */
 @
 	void t arcnet_close(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 
 ynetif_stop_queue(dev)a
 l@@ -488,7 +488,7 @@
 			(lock, flashort+type,iv. IN*daddr, v. IN*saddr,@ 			 lock, flalen)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	li;
8_t _daddr, proto_numal 	ree_ndsArcProto *protoa
 l@@ -546,7 +546,7 @@
 @
 	void t arcnet_rebuild_header(ree_ndssk_bu * *skb)@ @@ 	ree_ndsnet_devic	s*dev = skb-> eval-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	i;
+@e 	us =O0 		/* defaultti tfailuct e/l ylock, flashort+type;
 	li;
8_t daddr=0 
@@ -591,7 +591,7 @@
 /*tCallflaby 2ht kernelt		 ord		s o 
ransmi} a packet. */
 @
 	void t arcnet_se>r_packet(ree_ndssk_bu * *skb, ree_ndsnet_devic	s*dev)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	ree_ndsarchdr *pkt;
 	ree_ndsarc_rfc1201 *softal 	ree_ndsArcProto *protoa
@@ -674,7 +674,7 @@
  */
 @
 	void t mo_tx(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 
 yBUGMSG(D_DURING, "mo_tx: re 	us=%Xh, d tmask=%Xh, next_tx=%d, cur_tx=%dthcal 	    (stASTATUS(),+lp->d tmask,+lp->next_tx,+lp->cur_tx)al@@ -705,7 +705,7 @@
 @
 	voiv. INarcnet_time
+}(ree_ndsnet_devic	s*dev)
 @@ ylock, flaloTY,flagsal-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	i;
+@e 	us =OASTATUS()al 	ch i *msgal 
@@ -754,7 +754,7 @@
 
 yBUGMSG(D_DURING, "e; 	rcnet_ 
 e_ruptthc)al 	
-	lp = (ree_ndsarcnet_local *)adev->pr,v;
+	lp = dev->pr,v;
 	i	 (!lp)e 		BUG()al 		
@@ -989,7 +989,7 @@
  */
 v. INarcnet_rx(ree_ndsnet_devic	s*dev, d t Tufnum)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	ree_ndsarchdr pkt;
 	ree_ndsarc_rfc1201 *softal 	r;
+length,+ofsal@@ -1053,7 +1053,7 @@
  */
 @
 	voisee_ndsnet_devic	_@
 	s earcnet_ma;
@
 	s(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	36,) { &lp->@
 	sal }
 
@@ -1070,7 +1070,7 @@
 @
 	void t null_build_header(ree_ndssk_bu * *skb, ree_ndsnet_devic	s*dev,@ 			 ((s(lock, flashort+type,ili;
8_t daddr)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 
 yBUGMSG(D_PROTOal 	    (st"tx: ca['babuild headerueor encap %02Xh; loadsa protocolt);
 		.thcal@@ -1085,7 +1085,7 @@
 @
 	void t null_prepare_tx(ree_ndsnet_devic	s*dev, ree_ndsarchdr *pkt,@ 			 ((r;
+length,+d t Tufnum)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	ree_ndsarc_harIwarifnewpkt;
 
 yBUGMSG(D_PROTOat"tx: no encap eor   i thost; loadsa protocolt);
 		.thc)ald+ * -Nru a/);
 		s/net/arcnet/com20020.c b/);
 		s/net/arcnet/com20020.c
---ra/);
 		s/net/arcnet/com20020.c	2004-11-23223:53:52 -08:00
+++ b/);
 		s/net/arcnet/com20020.c	2004-12-29 14:11:532-08:00
@@ -159,7 +159,7 @@
 
 	/* I;i
ializea  	sx,st of t 	sdevic	 ree_nduct. */
 
-	lp = (ree_ndsarcnet_local *)adev->pr,v;
+	lp = dev->pr,v;
 
 ylp->hw.own		s2 THIS_MODULE;
 ylp->hw.commands2 com20020_commandal@@ -233,7 +233,7 @@
  */
 @
 	void t com20020_x,set(ree_ndsnet_devic	s*dev,ar;
+really_x,set)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	u_i;
+ioaddrr=+dev->b+	i_addr;@ yl_ch i inbyte;@ 
@@ -300,7 +300,7 @@
 
 @
 	voiv. INcom20020_close(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 yi;
+ioaddrr=+dev->b+	i_addr;@ 
 q/* disable 
ransmi} e_ e/ld+ * -Nru a/);
 		s/net/arcnet/com90io.c b/);
 		s/net/arcnet/com90io.c
---ra/);
 		s/net/arcnet/com90io.c	2004-01-10 07:46:01 -08:00
+++ b/);
 		s/net/arcnet/com90io.c	2004-12-29 14:09:19 -08:00
@@ -248,7 +248,7 @@
 		36,) { -EBUSYal y}l 
-	lp = (ree_ndsarcnet_local *)a(dev->pr,v);
+	lp = dev->pr,v;
 	lp->card_n;
e = "COM90xx I/O";
 ylp->hw.commands2 com90io_commandal ylp->hw.@e 	us =Ocom90io_@
 	usal@@ -290,7 +290,7 @@
  */
 @
 	void t com90io_x,set(ree_ndsnet_devic	s*dev,ar;
+really_x,set)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	short+ioaddrr=+dev->b+	i_addr;@ 
 qBUGMSG(D_INIT, "Re@etting %s (re 	us=%02Xh)thca	dev->n;
R, ASTATUS())ald+ * -Nru a/);
 		s/net/arcnet/com90xx.c b/);
 		s/net/arcnet/com90xx.c
---ra/);
 		s/net/arcnet/com90xx.c	2004-10-05 13:16:05 -07:00
+++ b/);
 		s/net/arcnet/com90xx.c	2004-12-29 14:09:19 -08:00
@@ -529,7 +529,7 @@
  */
 d t com90xx_x,set(ree_ndsnet_devic	s*dev,ar;
+really_x,set)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	short+ioaddrr=+dev->b+	i_addr;@ 
 qBUGMSG(D_INIT, "Re@etting (re 	us=%02Xh)thca	ASTATUS())al@@ -565,7 +565,7 @@
 @
 	voiv. INcom90xx_copy_to_carI(ree_ndsnet_devic	s*dev, d t Tufnum, i;
+offcet,
 y			(v. IN*Tuf,fd t cou
 )
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	v. IN__iomem *memaddrr=+lp->mem_start ++Tufnum * 512 ++offcet;l 	TIME("memcpy_toio",+c unt, memcpy_toio(memaddr, Tuf,fc unt))a
 }
@@ -574,7 +574,7 @@
 @
 	voiv. INcom90xx_copy__5hc_carI(ree_ndsnet_devic	s*dev, d t Tufnum, i;
+offcet,
 y			( (v. IN*Tuf,fd t cou
 )
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	v. IN__iomem *memaddrr=+lp->mem_start ++Tufnum * 512 ++offcet;l 	TIME("memcpy__5hcio",+c unt, memcpy__5hcio(Tuf,fmemaddr, c unt))a
 }
@@ -600,7 +600,7 @@
 
 	eor (c unt =O0  c unt < numcards  c unt++) {
 		dev = cards[c unt]al-		lp = (ree_ndsarcnet_local *)adev->pr,v;
+		lp = dev->pr,v;
 
 yyloregister_net)ev(dev)al y	free_irq(dev->irqa+dev)ald+ * -Nru a/);
 		s/net/arcnet/rfc1051.c b/);
 		s/net/arcnet/rfc1051.c
---ra/);
 		s/net/arcnet/rfc1051.c	2004-11-23223:53:52 -08:00
+++ b/);
 		s/net/arcnet/rfc1051.c	2004-12-29 14:09:19 -08:00
@@ -88,7 +88,7 @@
  */
 @
 	voilock, flashort+type_
rans(ree_ndssk_bu * *skb, ree_ndsnet_devic	s*dev)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	ree_ndsarchdr *pkt = (ree_ndsarchdr *) skb-> v;
;@ 	ree_ndsarc_rfc1051 *soft = &pkt->soft.rfc1051;
 yi;
+hdr_s =
 =OARC_HDR_ tru ++RFC1051_HDR_ trual@@ -125,7 +125,7 @@
 @
 	voiv. INrx(ree_ndsnet_devic	s*dev, d t Tufnum,l 	    (stree_ndsarchdr *pkthdx,ar;
+length)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	ree_ndssk_bu * *skb;@ 	ree_ndsarchdr *pkt = pkthdx;@ 	i;
+ofsal@@ -169,7 +169,7 @@
 @
 	void t Tuild_header(ree_ndssk_bu * *skb, ree_ndsnet_devic	s*dev,@ 			lock, flashort+type,ili;
8_t daddr)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 yi;
+hdr_s =
 =OARC_HDR_ tru ++RFC1051_HDR_ trual 	ree_ndsarchdr *pkt = (ree_ndsarchdr *) skb_push(skb, hdr_s =
);@ 	ree_ndsarc_rfc1051 *soft = &pkt->soft.rfc1051;
@@ -220,7 +220,7 @@
 @
 	void t prepare_tx(ree_ndsnet_devic	s*dev, ree_ndsarchdr *pkt,ar;
+length,ls		( =(  d t Tufnum)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	ree_ndsarc_harIwarif*harI = &pkt->harI;@ 	i;
+ofsal ld+ * -Nru a/);
 		s/net/arcnet/rfc1201.c b/);
 		s/net/arcnet/rfc1201.c
---ra/);
 		s/net/arcnet/rfc1201.c	2004-11-23223:53:52 -08:00
+++ b/);
 		s/net/arcnet/rfc1201.c	2004-12-29 14:09:19 -08:00
@@ -92,7 +92,7 @@
 {
 	ree_ndsarchdr *pkt = (ree_ndsarchdr *) skb-> v;
;@ 	ree_ndsarc_rfc1201 *soft = &pkt->soft.rfc1201;@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 yi;
+hdr_s =
 =OARC_HDR_ tru ++RFC1201_HDR_ trual 
 q/* Pull
o * t 	sarcnet header. */
@@ -134,7 +134,7 @@
 @
 	voiv. INrx(ree_ndsnet_devic	s*dev, d t Tufnum,l 	    (stree_ndsarchdr *pkthdx,ar;
+length)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	ree_ndssk_bu * *skb;@ 	ree_ndsarchdr *pkt = pkthdr;@ 	ree_ndsarc_rfc1201 *soft = &pkthdr->soft.rfc1201;@@@ -376,7 +376,7 @@
 @
 	void t Tuild_header(ree_ndssk_bu * *skb, ree_ndsnet_devic	s*dev,@ 			lock, flashort+type,ili;
8_t daddr)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 yi;
+hdr_s =
 =OARC_HDR_ tru ++RFC1201_HDR_ trual 	ree_ndsarchdr *pkt = (ree_ndsarchdr *) skb_push(skb, hdr_s =
);@ 	ree_ndsarc_rfc1201 *soft = &pkt->soft.rfc1201;@@@ -443,7 +443,7 @@
 @
 	voiv. INload_pkt(ree_ndsnet_devic	s*dev, ree_ndsarc_harIwarif*harI,ls		( =( ree_ndsarc_rfc1201 *soft,ar;
+softlen, d t Tufnum)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	i;
+ofsal l q/* assume+length <= XMTU:,someoca_should hazeehandlflat a
fby now. */
@@ -476,7 +476,7 @@
 @
 	void t prepare_tx(ree_ndsnet_devic	s*dev, ree_ndsarchdr *pkt,ar;
+length,ls		( =(  d t Tufnum)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	const r;
+maxsegs =
 =OXMTU -+RFC1201_HDR_ trual 	ree_ndsOutgo,TY,e
+}al l@@ -511,7 +511,7 @@
 
 @
 	void t co-tinue_tx(ree_ndsnet_devic	s*dev, d t Tufnum)
 @@-	ree_ndsarcnet_local *lp = (ree_ndsarcnet_local *)adev->pr,v;
+	ree_ndsarcnet_local *lp = dev->pr,v;
 	ree_ndsOutgo,TY,e
+} = &lp->outgo,TY;
 	ree_ndsarc_harIwarif*harI = &out->pkt->harI;@ 	ree_ndsarc_rfc1201 *soft = &out->pkt->soft.rfc1201, *newsoftald+ * -Nru a/);
 		s/net/arm/ether1.c b/);
 		s/net/arm/ether1.c
---ra/);
 		s/net/arm/ether1.c	2004-10-20 01:37:15 -07:00
+++ b/);
 		s/net/arm/ether1.c	2005-03-04 15:51:18 -08:00
@@ -86,8 +86,8 @@
 #def,T	sDISABLEIRQS 1
 #def,T	sNORMALIRQS  0l 
-#def,T	sether1_inw(dev, addr, type,ioffcet, svflgs)sether1_inw_p (dev, addr ++(e;
)(&((type *)0)->offcet), svflgs)
-#def,T	sether1_outw(dev, val, addr, type,ioffcet, svflgs)sether1_outw_p (dev, val, addr ++(e;
)(&((type *)0)->offcet), svflgs)
+#def,T	sether1_readw(dev, addr, type,ioffcet, svflgs)sether1_inw_p (dev, addr ++(e;
)(&((type *)0)->offcet), svflgs)
+#def,T	sether1_writew(dev, val, addr, type,ioffcet, svflgs)sether1_outw_p (dev, val, addr ++(e;
)(&((type *)0)->offcet), svflgs)
 
 @
 	void l,Teilock, flashort
sether1_inw_p (ree_ndsnet_devic	s*dev, d t addr, r;
+svflgs)
@@ -98,8 +98,8 @@
 yi	 (svflgs)
 		local_irq_sazee(flags)al @-	outb (addr >> 12, REG_PAGE)al-	36,s=_inw (ETHER1_RAM ++((addr & 4095) >> 1));
+	writeb(addr >> 12, REG_PAGE)al+	36,s=_readw(ETHER1_RAM ++((addr & 4095) << 1))al 	 	 (svflgs)
 		local_irq_x,storee(flags)al 	36,) { ret;l@@ -113,8 +113,8 @@
 yi	 (svflgs)
 		local_irq_sazee(flags)al @-	outb (addr >> 12, REG_PAGE)al-	outw (val, ETHER1_RAM ++((addr & 4095) >> 1));
+	writeb(addr >> 12, REG_PAGE)al+	writew(val, ETHER1_RAM ++((addr & 4095) << 1))al 	 	 (svflgs)
 		local_irq_x,storee(flags)al }l@@ -131,11 +131,12 @@
 @
 	voiv. I
sether1_writeTuffe_ (ree_ndsnet_devic	s*dev, v. IN* v;
, lock, flae;
+start, lock, flae;
+length)
 @@-	lock, flae;
+page,a  i len, offcet, addr;@+	lock, flae;
+page,a  i len, offcet;@+	v. IN__iomem *addr;@ 
 qoffcet = start & 4095al 	page = start >> 12al-	addrr=+ioaddr(ETHER1_RAM ++(offcet >> 1));
+	addrr=+ETHER1_RAM ++(offcet << 1);
 
 yi	 (offcet ++length > 4096)
 		  i lenr=+4096 -+offcet;@@@ -145,7 +146,7 @@
 	do {
 		e;
+usflal @-		outb(page,aREG_PAGE)al+		writeb(page,aREG_PAGE)al 		length -=a  i len;
 
 yy__asm__N__vol 	vle__(
@@ -181,7 +182,7 @@
 		: "=&r" (usfl), "=&r" ( v;
)@ 		: "r"  (addr), "r" (  i len), "1" ( v;
))al @-		addrr=+ioaddr(ETHER1_RAM)al+		addrr=+ETHER1_RAM;
 
 yy  i lenr=+length;@ 		 	 (t i lenr> 4096)
@@ -193,11 +194,12 @@
 @
 	voiv. I
sether1_readTuffe_ (ree_ndsnet_devic	s*dev, v. IN* v;
, lock, flae;
+start, lock, flae;
+length)
 @@-	lock, flae;
+page,a  i len, offcet, addr;@+	lock, flae;
+page,a  i len, offcet;@+	v. IN__iomem *addr;@ 
 qoffcet = start & 4095al 	page = start >> 12al-	addrr=+ioaddr(ETHER1_RAM ++(offcet >> 1));
+	addrr=+ETHER1_RAM ++(offcet << 1);
 
 yi	 (offcet ++length > 4096)
 		  i lenr=+4096 -+offcet;@@@ -207,7 +209,7 @@
 	do {
 		e;
+usflal @-		outb(page,aREG_PAGE)al+		writeb(page,aREG_PAGE)al 		length -=a  i len;
 
 yy__asm__N__vol 	vle__(
@@ -243,7 +245,7 @@
 		: "=&r" (usfl), "=&r" ( v;
)@ 		: "r"  (addr), "r" (  i len), "1" ( v;
))al @-		addrr=+ioaddr(ETHER1_RAM)al+		addrr=+ETHER1_RAM;
 
 yy  i lenr=+length;@ 		 	 (t i lenr> 4096)
@@ -302,7 +304,7 @@
 @
 	void t
sether1_recet (ree_ndsnet_devic	s*dev)
 @@-	outb (CTRL_RST|CTRL_ACK,aREG_CONTROL);
+	writeb(CTRL_RST|CTRL_ACK,aREG_CONTROL);
 	36,) { BUS_16al }
 
@@ -447,12 +449,11 @@
 @
 	void t
sether1_i;i
_for_open (ree_ndsnet_devic	s*dev)
 @@-	ree_ndsether1_pr,v *pr,v = net)ev_pr,v(dev)al yd t i,b@
 	us, 	ddr, next, next2al yd t failuctss=_0al ylock, flaloTY,time
+}al l-	outb (CTRL_RST|CTRL_ACK,aREG_CONTROL);
+	writeb(CTRL_RST|CTRL_ACK,aREG_CONTROL);
 
 	eor (i =O0  i < 6  i++)
 		e;i
_sa.sa_addr[i] = dev->)ev_addr[i]al@@ -467,7 +468,7 @@
 	ether1_writeTuffe_ (dev, &e;i
_tdr,  TDR_ADDR,  TDR_ tru)al yether1_writeTuffe_ (dev, &e;i
_nop,  NOP_ADDR,  NOP_ tru)al l-	 	 (ether1_inw (dev, CFG_ADDR, cfg_t, cfg_command,sNORMALIRQS)r!= CMD_CONFIG) {
+	 	 (ether1_readw(dev, CFG_ADDR, cfg_t, cfg_command,sNORMALIRQS)r!= CMD_CONFIG) {
 wqprd tk (KERN_ERR "%s: detendflaeither RAM faulttor compile	 bugthcal 			dev->n;
R);e 		36,) { 1;@@@ -487,7 +488,7 @@
 		 	 (next2 >= RX_AREA_END) {
 wq	next = RX_AREA_START;@ 			d i
_rfd.rfd_commands2 RFD_CMDEL | RFD_CMDSUSPENDal-		qprdv->rx_tails2 addr;@+		qprdv(dev)->rx_tails2 addr;@ 		} e) {l 			d i
_rfd.rfd_commands2 0;@ 		 	 (addrr== RX_AREA_START)
@@ -503,21 +504,21 @@
 		addrr=+nextal y} while (next2 < RX_AREA_END)al l-	prdv->tx_linkr=+NOP_ADDR;l-	prdv->tx_headr=+NOP_ADDR ++NOP_ tru;l-	prdv->tx_tails2 TDR_ADDR;l-	prdv->rx_headr=+RX_AREA_START;@+qprdv(dev)->tx_linkr=+NOP_ADDR;l+qprdv(dev)->tx_headr=+NOP_ADDR ++NOP_ tru;l+qprdv(dev)->tx_tails2 TDR_ADDR;l+qprdv(dev)->rx_headr=+RX_AREA_START;@ l q/* r6le+	i recet & give 586sa prod e/
-	prdv->re@etting = 1 
-	prdv->i;i
ialising = 1 
-	outb (CTRL_RST,aREG_CONTROL);
-	outb (0,aREG_CONTROL);
-	outb (CTRL_CA, REG_CONTROL);
+	prdv(dev)->re@etting = 1 
+	prdv(dev)->i;i
ialising = 1 
+	writeb(CTRL_RST,aREG_CONTROL);
+	writeb(0,aREG_CONTROL);
+	writeb(CTRL_CA, REG_CONTROL);
 l q/* 586sshould nowslocet iscp.busy e/l ytime
+}f= jiffies + HZ/2al-	while (ether1_inw (dev, ISCP_ADDR, iscp_t, iscp_busy,sDISABLEIRQS)r== 1) {
+	while (ether1_readw(dev, ISCP_ADDR, iscp_t, iscp_busy,sDISABLEIRQS)r== 1) {
 		 	 (time_after(jiffies,,time
+})) {
 wq	prd tk (KERN_WARNING "%s: ca['bai;i
ialise 82586: iscp is busythca	dev->n;
R);e 			36,) { 1;@@@ -526,7 +527,7 @@
 
 	/* check+@e 	us of commandsat a
fwe issued e/l ytime
+}f+= HZ/10al-	while (((@e 	us =Oether1_inw (dev, CFG_ADDR, cfg_t, cfg_@
 	us, DISABLEIRQS))
+	while (((@e 	us =Oether1_readw(dev, CFG_ADDR, cfg_t, cfg_@
 	us, DISABLEIRQS))
 			& STAT_COMPLETE)r== 0) {
 		 	 (time_after(jiffies,,time
+}))
 			break;@@@ -535,15 +536,15 @@
 yi	 ((@e 	us & (STAT_COMPLETE | STAT_OK))r!= (STAT_COMPLETE | STAT_OK))r{
 wqprd tk (KERN_WARNING "%s: ca['bai;i
ialise 82586: 
 -fig(@e 	us %04Xthca	dev->n;
R, @e 	us);e 		prd tk (KERN_DEBUG "%s: SCB=[STS=%04X CMD=%04X CBL=%04X RFA=%04X]thca	dev->n;
R,l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_command,sNORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_rfa_offcet, NORMALIRQS))al+			ether1_readw(dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_command,sNORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_rfa_offcet, NORMALIRQS))al y	failuctss+= 1 
 y}l 
 ytime
+}f+= HZ/10al-	while (((@e 	us =Oether1_inw (dev, SA_ADDR, sa_t, sa_@
 	us, DISABLEIRQS))
+	while (((@e 	us =Oether1_readw(dev, SA_ADDR, sa_t, sa_@
 	us, DISABLEIRQS))
 			& STAT_COMPLETE)r== 0) {
 		 	 (time_after(jiffies,,time
+}))
 			break;@@@ -552,15 +553,15 @@
 yi	 ((@e 	us & (STAT_COMPLETE | STAT_OK))r!= (STAT_COMPLETE | STAT_OK))r{
 wqprd tk (KERN_WARNING "%s: ca['bai;i
ialise 82586: cet address(@e 	us %04Xthca	dev->n;
R, @e 	us);e 		prd tk (KERN_DEBUG "%s: SCB=[STS=%04X CMD=%04X CBL=%04X RFA=%04X]thca	dev->n;
R,l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_command,sNORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_rfa_offcet, NORMALIRQS))al+			ether1_readw(dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_command,sNORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_rfa_offcet, NORMALIRQS))al y	failuctss+= 1 
 y}l 
 ytime
+}f+= HZ/10al-	while (((@e 	us =Oether1_inw (dev, MC_ADDR, mc_
, mc_@
 	us, DISABLEIRQS))
+	while (((@e 	us =Oether1_readw(dev, MC_ADDR, mc_
, mc_@
 	us, DISABLEIRQS))
 			& STAT_COMPLETE)r== 0) {
 		 	 (time_after(jiffies,,time
+}))
 			break;@@@ -569,15 +570,15 @@
 yi	 ((@e 	us & (STAT_COMPLETE | STAT_OK))r!= (STAT_COMPLETE | STAT_OK))r{
 wqprd tk (KERN_WARNING "%s: ca['bai;i
ialise 82586: cet mul	voast @e 	us %04Xthca	dev->n;
R, @e 	us);e 		prd tk (KERN_DEBUG "%s: SCB=[STS=%04X CMD=%04X CBL=%04X RFA=%04X]thca	dev->n;
R,l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_command,sNORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_rfa_offcet, NORMALIRQS))al+			ether1_readw(dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_command,sNORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_rfa_offcet, NORMALIRQS))al y	failuctss+= 1 
 y}l 
 ytime
+}f+= HZal-	while (((@e 	us =Oether1_inw (dev, TDR_ADDR, tdr_t, tdr_@
 	us, DISABLEIRQS))
+	while (((@e 	us =Oether1_readw(dev, TDR_ADDR, tdr_t, tdr_@
 	us, DISABLEIRQS))
 			& STAT_COMPLETE)r== 0) {
 		 	 (time_after(jiffies,,time
+}))
 			break;@@@ -586,12 +587,12 @@
 yi	 ((@e 	us & (STAT_COMPLETE | STAT_OK))r!= (STAT_COMPLETE | STAT_OK))r{
 wqprd tk (KERN_WARNING "%s: ca['batdr (ignored)thca	dev->n;
R);e 		prd tk (KERN_DEBUG "%s: SCB=[STS=%04X CMD=%04X CBL=%04X RFA=%04X]thca	dev->n;
R,l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_command,sNORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS),l-		qether1_inw (dev, SCB_ADDR, scb_t, scb_rfa_offcet, NORMALIRQS))al+			ether1_readw(dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_command,sNORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS),l+			ether1_readw(dev, SCB_ADDR, scb_t, scb_rfa_offcet, NORMALIRQS))al y} e) { @@-		@e 	us =Oether1_inw (dev, TDR_ADDR, tdr_t, tdr_ctsul	, DISABLEIRQS)al+		@e 	us =Oether1_readw(dev, TDR_ADDR, tdr_t, tdr_ctsul	, DISABLEIRQS)al 		 	 (@e 	us & TDR_XCVRPROB)
 wq	prd tk (KERN_WARNING "%s: i/f failflatdr: 
ransceiversproblemthca	dev->n;
R);e 		e) { i	 ((@e 	us & (TDR_ HORT|TDR_OPEN))r&& (@e 	us & TDR_TIME)) @@@@ -616,24 +617,23 @@
 @
 	void t
sether1_txalloc (ree_ndsnet_devic	s*dev, d t s =
)
 @@-	ree_ndsether1_pr,v *pr,v = net)ev_pr,v(dev)al yd t start, tailal l 	r =
 =O(r =
 + 1) & ~1 
-	tails2 prdv->tx_tailal+	tails2 prdv(dev)->tx_tailal l-	 	 (prdv->tx_headr+ s =
 > TX_AREA_END) {
-		 	 (tails> prdv->tx_head)
+	 	 (prdv(dev)->tx_headr+ s =
 > TX_AREA_END) {
+		 	 (tails> prdv(dev)->tx_head)e 			36,) { -1 
 y	start = TX_AREA_START;@ 		 	 (@e rt ++s =
 > tail)e 			36,) { -1 
-		prdv->tx_headr=+@e rt ++s =
al+		prdv(dev)->tx_headr=+@e rt ++s =
al y} e) { @@-		 	 (prdv->tx_headr< tailr&& (prdv->tx_headr+ s =
) > tail)e+		 	 (prdv(dev)->tx_headr< tailr&& (prdv(dev)->tx_headr+ s =
) > tail)e 			36,) { -1 
-		start = prdv->tx_head 
-		prdv->tx_headr+= s =
al+		start = prdv(dev)->tx_headal+		prdv(dev)->tx_headr+= s =
al y}l 
 y36,) { starta
@@ -642,8 +642,6 @@
 @
 	void t
sether1_open (ree_ndsnet_devic	s*dev)
 @@-	ree_ndsether1_pr,v *pr,v = net)ev_pr,v(dev)al-
 	i	 (!is_valid_ether_addr(dev->)ev_addr))r{
 wqprd tk(KERN_WARNING "%s: invalidaethernet MAC addressthcal 			dev->n;
R);e@@ -653,7 +651,7 @@
 	i	 (request_irq(dev->irqa+ether1_in e_rupt, 0, "ether1ca	dev))
 		36,) { -EAGAINal l-	memcet (&prdv->@
 	s, 0, s =
of (ree_ndsnet_devic	
@
 	s))al+	memcet (&prdv(dev)->@
 	s, 0, s =
of (ree_ndsnet_devic	
@
 	s))al 
 yi	 (ether1_i;i
_for_open (dev))r{
 wqfree_irq (dev->irqa+dev)al@@ -668,8 +666,6 @@
 @
 	voiv. I
sether1_time
+}(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsether1_pr,v *pr,v = net)ev_pr,v(dev)al-
 	prd tk(KERN_WARNING "%s: 
ransmi} time
+}, network cable problem?thcal 		dev->n;
R);e 	prd tk(KERN_WARNING "%s: re@etting devic	thca	dev->n;
R);e@@ -679,21 +675,20 @@
 	i	 (ether1_i;i
_for_open (dev))
 wqprd tk (KERN_ERR "%s: unable toax,start  
 e_facethca	dev->n;
R);e 
-	prdv->@
 	s.tx_errors++ 
+	prdv(dev)->@
 	s.tx_errors++ 
 	netif_wake_queue(dev)a
 }
 
 @
 	void t
sether1_se>rpacket (ree_ndssk_bu * *skb, ree_ndsnet_devic	s*dev)
 @@-	ree_ndsether1_pr,v *pr,v = net)ev_pr,v(dev)al yd t tmp, ts}, nopaddr, txaddr, tbdaddr,  v;
ddr;@ ylock, flaloTY,flagsal ytx_t txal ytbd_t tbI;@ 	nop_t nopal l-	 	 (prdv->x,start) {
+	 	 (prdv(dev)->re@tart) {
 wqprd tk(KERN_WARNING "%s: re@etting devic	thca	dev->n;
R);e 
 yyether1_recet(dev)al@@ -701,7 +696,7 @@
 		 	 (ether1_i;i
_for_open(dev))
 wqqprd tk(KERN_ERR "%s: unable toax,start  
 e_facethca	dev->n;
R);e 		e) {l-		qprdv->restart = 0;@+		qprdv(dev)->restart = 0;@ y}l 
 y 	 (@kb->lenr<+ETH_ZLEN) @@@@ -735,11 +730,11 @@
 yether1_writeTuffe_ (dev, &tbI, tbdaddr, TBD_ tru)al yether1_writeTuffe_ (dev, skb-> v;
,  v;
ddr, skb->len)al yether1_writeTuffe_ (dev, &nop, nopaddr, NOP_ tru)al-	tmp = prdv->tx_link;l-	prdv->tx_linkr=+nopaddral+	tmp = prdv(dev)->tx_link;@+qprdv(dev)->tx_linkr=+nopaddral 
 	/* nowsrecet t 	sprevious nop po 
 e_ e/
-	ether1_outw (dev, txaddr, tmp, nop_}, nop_link, NORMALIRQS);@+qether1_writew(dev, txaddr, tmp, nop_}, nop_link, NORMALIRQS);@ 
 ylocal_irq_x,store(flags)al @@@ -747,9 +742,9 @@
 	dev->
rans_start = jiffies;
 
 	/* check+toase{ i	 we hazeeroom eor a full
s =
daether fr;
e e/
-	tmp = prdv->tx_headal+	tmp = prdv(dev)->tx_headal ytst =Oether1_txalloc (dev, TX_ tru ++TBD_ tru ++NOP_ tru ++ETH_FRAME_LEN);l-	prdv->tx_headr=+tmp;l+qprdv(dev)->tx_headr=+tmp;l 	dev_kfree_skb (@kb)al 
 yi	 (tst ==O-1)
@@ -762,11 +757,10 @@
 @
 	voiv. I
sether1_xmi}_doca_(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsether1_pr,v *pr,v = net)ev_pr,v(dev)al ynop_t nopal 	i;
+caddr, ts}al l-	caddrr=+prdv->tx_tailal+	caddrr=+prdv(dev)->tx_tailal l again:l yether1_readTuffe_ (dev, &nop, caddr, NOP_ tru)al@@ -774,21 +768,21 @@
 	switch (nop.nop_commands& CMD_MASK) {
 wc+	i CMD_TDR:l y	/* special c+	i e/
-		 	 (ether1_inw (dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS)e+		 	 (ether1_readw(dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS)
 y			!= (lock, flashort)I82586_size) {
-			ether1_outw(dev, SCB_CMDCUCSTART | SCB_CMDRXSTART, SCB_ADDR, scb_t,l+			ether1_writew(dev, SCB_CMDCUCSTART | SCB_CMDRXSTART, SCB_ADDR, scb_t,l y			( ( scb_command,sNORMALIRQS)al-		qoutb (CTRL_CA, REG_CONTROL);
+			writeb(CTRL_CA, REG_CONTROL);
 	y}l-		prdv->tx_tails2 NOP_ADDR;l+qqprdv(dev)->tx_tails2 NOP_ADDR;l y	re,) {;a 
 yc+	i CMD_NOP:
 		 	 (nop.nop_linkr== caddr) {
-			 	 (prdv->i;i
ialising == 0)
+			 	 (prdv(dev)->i;i
ialising == 0)
 y			prd tk (KERN_WARNING "%s: s
range command complete_with no tx command!thca	dev->n;
R);e 			e) {l-		q =trrrrrprdv->i;i
ialising = 0;@+		q =trrrrrprdv(dev)->i;i
ialising = 0;e 			36,) {;
 	y}l 		 	 (caddrr== nop.nop_link)
@@ -800,33 +794,33 @@
 		 	 (nop.nop_@e 	us & STAT_COMPLETE)
 			break;@ wqprd tk (KERN_ERR "%s: s
range command complete_with
+}fcompleted commandthca	dev->n;
R);e-	qprdv->restart = 1;l+qqprdv(dev)->restart = 1;l y	re,) {;a 
 ydefault:
 wqprd tk (KERN_WARNING "%s: s
range command %d complete! (offcet %04X)ca	dev->n;
R,l wq	nop.nop_commands& CMD_MASK, caddr);e-	qprdv->restart = 1;l+qqprdv(dev)->restart = 1;l y	re,) {;a y}l 
 ywhile (nop.nop_@e 	us & STAT_COMPLETE) {
 		 	 (nop.nop_@e 	us & STAT_OK) {
-			prdv->@
 	s.tx_packets ++ 
-			prdv->@
 	s.collisionss+= (nop.nop_@e 	us & STAT_COLLISIONS)al+			prdv(dev)->@
 	s.tx_packets ++ 
+			prdv(dev)->@
 	s.collisionss+= (nop.nop_@e 	us & STAT_COLLISIONS)al 		} e) { {
-			prdv->@
 	s.tx_errors ++ 
+			prdv(dev)->@
 	s.tx_errors ++ 
 l 			df (nop.nop_@e 	us & STAT_COLLAFTERTX)
-				prdv->@
 	s.collisionss++ 
+				prdv(dev)->@
 	s.collisionss++;l 			df (nop.nop_@e 	us & STAT_NOCARRIER)
-				prdv->@
 	s.tx_carrier_errors ++ 
+				prdv(dev)->@
 	s.tx_carrier_errors ++ 
 			df (nop.nop_@e 	us & STAT_TXLOSTCTS)
 y			prd tk (KERN_WARNING "%s: cts lostthca	dev->n;
R);e 			df (nop.nop_@e 	us & STAT_TXSLOWDMA)
-				prdv->@
 	s.tx_fifo_errors ++ 
+				prdv(dev)->@
 	s.tx_fifo_errors ++ 
 			df (nop.nop_@e 	us & STAT_COLLEXCESSIVE)
-				prdv->@
 	s.collisionss+= 16 
+				prdv(dev)->@
 	s.collisionss+= 16 
 	y}l 
 		 	 (nop.nop_linkr== caddr) {
@@ -851,11 +845,11 @@
 y		break;@ wq}a y}l-	prdv->tx_tails2 caddral+	prdv(dev)->tx_tails2 caddral 
-	caddrr=+prdv->tx_headal+	caddrr=+prdv(dev)->tx_headal ytst =Oether1_txalloc (dev, TX_ tru ++TBD_ tru ++NOP_ tru ++ETH_FRAME_LEN);l-	prdv->tx_headr=+caddral+	prdv(dev)->tx_headr=+caddral yi	 (tst !=O-1)
 		netif_wake_queue(dev)a
 }
@@ -863,17 +857,16 @@
 @
 	voiv. I
sether1_recv_doca_(ree_ndsnet_devic	s*dev)
 @@-	ree_ndsether1_pr,v *pr,v = net)ev_pr,v(dev)al yi;
+@e 	usal yi;
+nexttail, rbdaddr;
 	3bd_t rbI;@ 
 	do {
-		@e 	us =Oether1_inw (dev, prdv->rx_head, rfd_t, rfd_@
 	us, NORMALIRQS)al+		@e 	us =Oether1_readw(dev, prdv(dev)->rx_head, rfd_t, rfd_@
 	us, NORMALIRQS)al 		 	 ((@e 	us & RFD_COMPLETE)r== 0)
 y		break;@ 
-		rbdaddr =Oether1_inw (dev, prdv->rx_head, rfd_t, rfd_rbdoffcet, NORMALIRQS)al+		rbdaddr =Oether1_readw(dev, prdv(dev)->rx_head, rfd_t, rfd_rbdoffcet, NORMALIRQS)al 	yether1_readTuffe_ (dev, &rbI, rbdaddr, RBD_ tru)al l 		 	 ((rbd.3bd_@e 	us & (RBD_EOF | RBD_ACNTVALID))r== (RBD_EOF | RBD_ACNTVALID))r{
@@ -891,27 +884,27 @@
 
 				skb->protocolt=Oeth_type_
rans (skb, dev)al y			netif_rx (@kb)al-				prdv->@
 	s.rx_packets ++ 
+				prdv(dev)->@
 	s.rx_packets ++ 
 y		} e) {l-				prdv->@
 	s.rx_dropped ++ 
+				prdv(dev)->@
 	s.rx_dropped ++ 
 		} e) { {
 wqqprd tk(KERN_WARNING "%s: %sthca	dev->n;
R,l y			(rbd.3bd_@e 	us & RBD_EOF) ? "o 		s =
dapacket" : "ac;
+not valid") 
-			prdv->@
 	s.rx_dropped ++ 
+			prdv(dev)->@
 	s.rx_dropped ++ 
 		}@ 
-		nexttail =Oether1_inw (dev, prdv->rx_tail, rfd_t, rfd_link, NORMALIRQS);@+q	nexttail =Oether1_readw(dev, prdv(dev)->rx_tail, rfd_t, rfd_link, NORMALIRQS);@ y	/* nexttail should be rx_headre/
-		 	 (nexttail != prdv->rx_head)e+		 	 (nexttail != prdv(dev)->rx_head)
 wqqprd tk(KERN_ERR "%s: receiver Tuffe_ ch i;ing error (%04X != %04X)thcal-				dev->n;
R, nexttail, prdv->rx_head) 
-		ether1_outw (dev, RFD_CMDEL | RFD_CMDSUSPEND, nexttail, rfd_t, rfd_command,sNORMALIRQS)al-		ether1_outw (dev, 0, prdv->rx_tail, rfd_t, rfd_command,sNORMALIRQS)al-		ether1_outw (dev, 0, prdv->rx_tail, rfd_t, rfd_@
 	us, NORMALIRQS)al-		ether1_outw (dev, 0, prdv->rx_tail, rfd_t, rfd_rbdoffcet, NORMALIRQS)al+				dev->n;
R, nexttail, prdv(dev)->rx_head)al+		ether1_writew(dev, RFD_CMDEL | RFD_CMDSUSPEND, nexttail, rfd_t, rfd_command,sNORMALIRQS)al+		ether1_writew(dev, 0, prdv(dev)->rx_tail, rfd_t, rfd_command,sNORMALIRQS)al+		ether1_writew(dev, 0, prdv(dev)->rx_tail, rfd_t, rfd_@
 	us, NORMALIRQS)al+		ether1_writew(dev, 0, prdv(dev)->rx_tail, rfd_t, rfd_rbdoffcet, NORMALIRQS)al 	e-	qprdv->rx_tails2 nexttail;e-	qprdv->rx_headr=+ether1_inw (dev, prdv->rx_head, rfd_t, rfd_link, NORMALIRQS);@+q	prdv(dev)->rx_tails2 nexttail;e+q	prdv(dev)->rx_headr=+ether1_readw(dev, prdv(dev)->rx_head, rfd_t, rfd_link, NORMALIRQS);@ y} while (1)al }
 
@@ -919,48 +912,47 @@
 ether1_in e_rupt+(e;
 irqa+v. IN* ev_id, ree_ndspt_regs *regs)@ @@ 	ree_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*) ev_id;@-	ree_ndsether1_pr,v *pr,v = net)ev_pr,v(dev)al yi;
+@e 	usal @-	re 	us =Oether1_inw (dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS);
+	re 	us =Oether1_readw(dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS);
 
 y 	 (@e 	us) {
-		ether1_outw(dev, @e 	us & (SCB_STRNR | SCB_STCNA | SCB_STFR | SCB_STCX),l+		ether1_writew(dev, @e 	us & (SCB_STRNR | SCB_STCNA | SCB_STFR | SCB_STCX),l 			 ((sSCB_ADDR, scb_t, scb_command,sNORMALIRQS);@-		outb (CTRL_CA | CTRL_ACK,aREG_CONTROL);
+		writeb(CTRL_CA | CTRL_ACK,aREG_CONTROL);
 		 	 (@e 	us & SCB_STCX) {
 wqqether1_xmi}_doca_(dev)al y	}
 		 	 (@e 	us & SCB_STCNA) {
-			 	 (prdv->re@etting == 0)
+			 	 (prdv(dev)->re@etting == 0)
 y			prd tk (KERN_WARNING "%s: CU we;
+not ready ???thca	dev->n;
R);e 			e) {l-		q	prdv->re@etting += 1 
-			 	 (ether1_inw (dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS)e+				prdv(dev)->re@etting += 1;l+qq	 	 (ether1_readw(dev, SCB_ADDR, scb_t, scb_cbl_offcet, NORMALIRQS)
 y				!= (lock, flashort)I82586_size) {
-				ether1_outw (dev, SCB_CMDCUCSTART,sSCB_ADDR, scb_t, scb_command,sNORMALIRQS);@-			qoutb (CTRL_CA, REG_CONTROL);
+				ether1_writew(dev, SCB_CMDCUCSTART,sSCB_ADDR, scb_t, scb_command,sNORMALIRQS);@+				writeb(CTRL_CA, REG_CONTROL);
 	yy}l-			 	 (prdv->re@etting == 2)l-		q	prdv->re@etting = 0;@+		q 	 (prdv(dev)->re@etting == 2)e+				prdv(dev)->re@etting = 0;e 		}
 		 	 (@e 	us & SCB_STFR) {
 wqqether1_recv_doca_(dev)al y	}
 		 	 (@e 	us & SCB_STRNR) {
-			 	 (ether1_inw (dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS) & SCB_STRXSUSP) {
+			 	 (ether1_readw(dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS) & SCB_STRXSUSP) {
 y			prd tk (KERN_WARNING "%s: RU we;
+not ready: RU suspendedthca	dev->n;
R);e-	q		ether1_outw (dev, SCB_CMDRXRESUME,sSCB_ADDR, scb_t, scb_command,sNORMALIRQS);@-			qoutb (CTRL_CA, REG_CONTROL);
-				prdv->@
 	s.rx_dropped ++ 	/* we suspended due toalack of Tuffe_ spaci e/
+				ether1_writew(dev, SCB_CMDRXRESUME,sSCB_ADDR, scb_t, scb_command,sNORMALIRQS);@+				writeb(CTRL_CA, REG_CONTROL);
+				prdv(dev)->@
 	s.rx_dropped ++ 	/* we suspended due toalack of Tuffe_ spaci e/
 y		} e) {l y			prd tk(KERN_WARNING "%s: RU we;
+not ready: %04Xthca	dev->n;
R,
-				qether1_inw (dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS)) 
-			prd tk (KERN_WARNING "RU ptr =O%04Xthca	ether1_inw (dev, SCB_ADDR, scb_t, scb_rfa_offcet,
+					ether1_readw(dev, SCB_ADDR, scb_t, scb_@
 	us, NORMALIRQS))al+			prd tk (KERN_WARNING "RU ptr =O%04Xthca	ether1_readw(dev, SCB_ADDR, scb_t, scb_rfa_offcet,
 y					NORMALIRQS))al y	}l y} e) {@-		outb (CTRL_ACK,aREG_CONTROL);
+		writeb(CTRL_ACK,aREG_CONTROL);
 
 	36,) { IRQ_HANDLEDa
 }
@@ -978,8 +970,7 @@
 @
 	voisee_ndsnet_devic	_@
 	s e
 ether1_get@
 	s (ree_ndsnet_devic	s*dev)
 @@-	ree_ndsether1_pr,v *pr,v = net)ev_pr,v(dev)al-	36,) { &prdv->@
 	sal+	36,) { &prdv(dev)->@
 	sa
 }
 
 /*l@@ -1008,40 +999,42 @@
 ether1_probe(ree_ndsexpansion_carI *ec, c nst @ee_ndsecard_ IN*id)@ @@ 	ree_ndsnet_devic	s*dev;@-	ree_ndsether1_pr,v *pr,val yd t i,b36,s=_0;
 
 	ether1_banner()al l+	36,s=_ecard_request_re@ources(ec);
+	i	 (ret)e+		goto 
+}al+l 	devs2 alloc_ether)ev(s =
of(ree_ndsether1_pr,v))al 	 	 (!dev) {
 y	36,s=_-ENOMEM 
-		goto 
+}al+		goto r6le+	i;a y}l 
 ySET_MODULE_OWNER(dev)al+ySET_NETDEV_DEV(dev, &ec->)ev);e 
-	dev->b+	i_addr	=_ecard_address(ec, ECARD_IOC, ECARD_FAST)al-	dev->irq	=_ec->irqal-
-	/*
-	 * t 	se_will+not fail - t 	snaduct of t 	sbus ensuctsst i 
-	 */l-	36quest_region(dev->b+	i_addr, 16a	dev->n;
R);e-	36quest_region(dev->b+	i_addr + 0x800, 4096a	dev->n;
R);e+	dev->irq =_ec->irqal+	prdv(dev)->b+	ir=+ioremap(ecard_re@ource_start(ec, ECARD_RES_IOCFAST),
+				  ecard_re@ource_len(ec, ECARD_RES_IOCFAST));
+	i	 (!prdv(dev)->b+	i) {
+		36,s=_-ENOMEM 
+		goto free 
+	}e 
-	prdv = net)ev_pr,v(dev)al-	 	 ((prdv->bus_type =Oether1_recet(dev))r== 0) {
+	 	 ((prdv(dev)->bus_type =Oether1_recet(dev))r== 0) {
 y	36,s=_-ENODEV 
-		goto r6le+	i;a+		goto free 
 y}l 
 yeor (i =O0  i < 6  i++)
-		dev->)ev_addr[i]s=_inb(IDPROM_ADDRESS + i);
+		dev->)ev_addr[i]s=_readT(IDPROM_ADDRESS + (i << 2))al 
 yi	 (ether1_i;i
_2(dev))r{
 wq36,s=_-ENODEV 
-		goto r6le+	i;a+		goto free 
 y}l 
 ydev->open		=sether1_openal@@ -1054,7 +1047,7 @@
 
 	36,s=_register_net)ev(dev)al yi	 (ret)e-		goto r6le+	i;a+		goto free 
 e 	prd tk(KERN_INFO "%s: ether1t		 slot %d, cal 		dev->n;
R,_ec->slot_no)al@@ -1065,11 +1058,13 @@
 	ecard_set_drv v;
(ec, dev)al y36,) { 0;
 
-r6le+	i:e-	36le+	i_region(dev->b+	i_addr, 16);e-	36le+	i_region(dev->b+	i_addr + 0x800, 4096);
+ free:
+	 	 (prdv(dev)->b+	i)e+		 ounmap(prdv(dev)->b+	i)al yfree_net)ev(dev)al-
+}:
+ r6le+	i:e+	ecard_rele+	i_re@ources(ec);
+ 
+}:
 	36,) { ret;l }
 
@@ -1080,10 +1075,9 @@
 	ecard_set_drv v;
(ec, size);	
 e 	loregister_net)ev(dev)al-e-	36le+	i_region(dev->b+	i_addr, 16);e-	36le+	i_region(dev->b+	i_addr + 0x800, 4096);
+	 ounmap(prdv(dev)->b+	i)al yfree_net)ev(dev)al+	ecard_rele+	i_re@ources(ec);
 }
 
 @
 	voic nst @ee_ndsecard_ INether1_ids[]s=_{ld+ * -Nru a/);
 		s/net/arm/ether1.h b/);
 		s/net/arm/ether1.h
---ra/);
 		s/net/arm/ether1.h	2003-05-15 17:41:33 -07:00
+++ b/);
 		s/net/arm/ether1.h	2005-03-02 13:04:452-08:00
@@ -19,22 +19,25 @@
 #def,T	sNET_DEBUG 0
 #endifl l+#def,T	sprdv(dev)	((ree_ndsether1_pr,v *)net)ev_pr,v(dev))l+l /* Page register */l-#def,T	sREG_PAGE	(dev->b+	i_addr + 0x00)
+#def,T	sREG_PAGE	(prdv(dev)->b+	ir+ 0x0000)
 
 /* Control register */l-#def,T	sREG_CONTROL	(dev->b+	i_addr + 0x01)
+#def,T	sREG_CONTROL	(prdv(dev)->b+	ir+ 0x0004)
 #def,T	sCTRL_RST	0x01
 #def,T	sCTRL_LOOPBACK	0x02
 #def,T	sCTRL_CA		0x04
 #def,T	sCTRL_ACK	0x08l 
-#def,T	sETHER1_RAM	(dev->b+	i_addr + 0x800)
+#def,T	sETHER1_RAM	(prdv(dev)->b+	ir+ 0x2000)
 
 /* HW address(*/l-#def,T	sIDPROM_ADDRESS	(dev->b+	i_addr + 0x09)
+#def,T	sIDPROM_ADDRESS	(prdv(dev)->b+	ir+ 0x0024)
 
 @
e_ndsether1_pr,v {@+	v. IN__iomem *b+	i;a ysee_ndsnet_devic	_@
 	s @
 	sa
 	lock, flae;
+tx_link;@ 	lock, flae;
+tx_headald+ * -Nru a/);
 		s/net/arm/ether3.c b/);
 		s/net/arm/ether3.c
---ra/);
 		s/net/arm/ether3.c	2004-10-20 01:37:15 -07:00
+++ b/);
 		s/net/arm/ether3.c	2005-03-02 13:23:302-08:00
@@ -78,8 +78,8 @@
 @
 	voilock, flai;
+net_debug = NET_DEBUG;
 
 @
 	voiv. I	ether3_setmul	voastlist(ree_ndsnet_devic	s*dev);e-@
 	void t	ether3_rx(ree_ndsnet_devic	s*dev, ree_nds)ev_pr,v *pr,v, lock, flae;
+maxcnt);e-@
 	voiv. I	ether3_tx(ree_ndsnet_devic	s*dev, ree_nds)ev_pr,v *pr,v)al+@
 	void t	ether3_rx(ree_ndsnet_devic	s*dev, lock, flae;
+maxcnt);e+@
 	voiv. I	ether3_tx(ree_ndsnet_devic	s*dev);
 @
 	void t	ether3_open (ree_ndsnet_devic	s*dev);
 @
 	void t	ether3_se>rpacket (ree_ndssk_bu * *skb, ree_ndsnet_devic	s*dev);
 @
 	voidrq36,) {_dsether3_in e_rupt+(e;
 irqa+v. IN* ev_id, ree_ndspt_regs *regs)al@@ -104,33 +104,32 @@
  * T 	sSEEQ8005 does['balike us writing to i	s registers
  * too quickly.
  */
-@
 	void l,Teiv. INether3_outb(e;
 v, c nst r;
+r)l+@
 	void l,Teiv. INether3_outb(e;
 v, c nst v. IN__iomem *r)
 @@-	outb(v, r);
+	writeb(v, r);
 	ldelay(1)al }
 
-@
 	void l,Teiv. INether3_outw(e;
 v, c nst r;
+r)l+@
 	void l,Teiv. INether3_outw(e;
 v, c nst v. IN__iomem *r)
 @@-	outw(v, r);
+	writew(v, r);
 	ldelay(1)al }
-#def,T	sether3_inb(r)		({ lock, flae;
+__vs=_inb((r)); ldelay(1)a+__v; })
-#def,T	sether3_inw(r)		({ lock, flae;
+__vs=_inw((r)); ldelay(1)a+__v; })
+#def,T	sether3_inb(r)		({ lock, flae;
+__vs=_readT((r)); ldelay(1)a+__v; })
+#def,T	sether3_inw(r)		({ lock, flae;
+__vs=_readw((r)); ldelay(1)a+__v; })
 
 @
 	void t
sether3_setTuffe_(ree_ndsnet_devic	s*dev, Tuffe__rw_t read,ae;
+start)
 @@-	ree_nds)ev_pr,v *pr,v = net)ev_pr,v(dev)al yd t time
+}f= 1000;e 
-	ether3_outw(prdv->regs.co-fig1 | CFG1_LOCBUFMEM,aREG_CONFIG1);e-	ether3_outw(prdv->regs.commands| CMD_FIFOWRITE,aREG_COMMAND)al+	ether3_outw(prdv(dev)->regs.co-fig1 | CFG1_LOCBUFMEM,aREG_CONFIG1);e+	ether3_outw(prdv(dev)->regs.commands| CMD_FIFOWRITE,aREG_COMMAND)al 
 ywhile ((ether3_inw(REG_STATUS) & STAT_FIFOEMPTY)r== 0) {
 		 	 (!time
+}--) {
 wq	prd tk("%s: setTuffe_ brokenthca	dev->n;
R);e-	q	prdv->broken = 1;l+qq	prdv(dev)->broken = 1;l 			36,) { 1;@ y	}
 		ldelay(1)al@@ -138,9 +137,9 @@
 l yi	 (readr== Tuffe__read) {
 wqether3_outw(start, REG_DMAADDR)al-		ether3_outw(prdv->regs.commands| CMD_FIFOREAD,aREG_COMMAND)al+		ether3_outw(prdv(dev)->regs.commands| CMD_FIFOREAD,aREG_COMMAND)al y} e) { @@-		ether3_outw(prdv->regs.commands| CMD_FIFOWRITE,aREG_COMMAND)al+		ether3_outw(prdv(dev)->regs.commands| CMD_FIFOWRITE,aREG_COMMAND)al wqether3_outw(start, REG_DMAADDR)al y}l y36,) { 0;
@@ -150,53 +149,50 @@
  * write  v;
 to t 	sbuffe_ memory
  */
 #def,T	sether3_writeTuffe_(dev, v;
,length)			\@-	outsw(REG_BUFWIN, ( v;
), (length) >> 1)
+	writesw(REG_BUFWIN, ( v;
), (length) >> 1)
 
 #def,T	sether3_writeword(dev, v;
)				\@-	outw(( v;
), REG_BUFWIN)
+	writew(( v;
), REG_BUFWIN)
 
 #def,T	sether3_writeloTY(dev, v;
)	{			\@-	lock, flaloTY,reg_bu win = REG_BUFWIN;			\@-	outw(( v;
), reg_bu win);				\@-	outw(( v;
) >> 16, reg_bu win);				\@+	v. IN__iomem *reg_bu win = REG_BUFWIN;			\@+	writew(( v;
), reg_bu win);				\@+	writew(( v;
) >> 16, reg_bu win);			\
 }
 
 /*l  * readr v;
 _5hc t 	sbuffe_ memory
  */
 #def,T	sether3_readTuffe_(dev, v;
,length)			\@-	insw(REG_BUFWIN, ( v;
), (length) >> 1)
+	readsw(REG_BUFWIN, ( v;
), (length) >> 1)
 
 #def,T	sether3_readword(dev)					\@-	inw(REG_BUFWIN)
+	readw(REG_BUFWIN)
 
 #def,T	sether3_readloTY(dev)	 				\@-	inw(REG_BUFWIN)s| (inw(REG_BUFWIN)s<< 16)
+	readw(REG_BUFWIN)s| (readw(REG_BUFWIN)s<< 16)
 
 /*l  * Switch LED+off...
  */
-@
 	voiv. I
-ether3_ledoff(lock, flaloTY, v;
)@+@
 	voiv. I ether3_ledoff(lock, flaloTY, v;
)@ @@ 	ree_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*) v;
;@-	ree_nds)ev_pr,v *pr,v = net)ev_pr,v(dev)al-	ether3_outw(prdv->regs.co-fig2 |= CFG2_CTRLO,aREG_CONFIG2)al+	ether3_outw(prdv(dev)->regs.co-fig2 |= CFG2_CTRLO,aREG_CONFIG2)al }
 
 /*l  * switch LED+on...
  */
-@
 	void l,Teiv. I
-ether3_ledon(ree_ndsnet_devic	s*dev, ree_nds)ev_pr,v *pr,v)l+@
 	void l,Teiv. INether3_ledon(ree_ndsnet_devic	s*dev)
 @@-	del_timer(&prdv->timer);l-	prdv->timer.expictss=_jiffies + HZ / 50; /* leazeeon eor 1/50th seco-d e/
-	prdv->timer. v;
 = (lock, flaloTY)dev;@-	prdv->timer.function =Oether3_ledoffal-	add_timer(&prdv->timer);l-	 	 (prdv->regs.co-fig2 & CFG2_CTRLO)@-		ether3_outw(prdv->regs.co-fig2 &= ~CFG2_CTRLO,aREG_CONFIG2)al+	del_timer(&prdv(dev)->timer);l+	prdv(dev)->timer.expictss=_jiffies + HZ / 50; /* leazeeon eor 1/50th seco-d e/
+	prdv(dev)->timer. v;
 = (lock, flaloTY)dev;@+	prdv(dev)->timer.function =Oether3_ledoffal+	add_timer(&prdv(dev)->timer);l+	 	 (prdv(dev)->regs.co-fig2 & CFG2_CTRLO)@+		ether3_outw(prdv(dev)->regs.co-fig2 &= ~CFG2_CTRLO,aREG_CONFIG2)al }
 
 /*l@@ -277,43 +273,41 @@
 l /* ------------------------------------------------------------------------------- */
 e-@
 	void tN__init
-ether3_i;i
_2(ree_ndsnet_devic	s*dev)
+@
 	void tN__init ether3_i;i
_2(ree_ndsnet_devic	s*dev)
 @@-	ree_nds)ev_pr,v *pr,v = net)ev_pr,v(dev)al yd t i;e 
-	prdv->regs.co-fig1 = CFG1_RECVCOMPSTAT0|CFG1_DMABURST8;
-	prdv->regs.co-fig2 = CFG2_CTRLO|CFG2_RECVCRC|CFG2_ERRENCRC;
-	prdv->regs.commands2 0;@+	prdv(dev)->regs.co-fig1 = CFG1_RECVCOMPSTAT0|CFG1_DMABURST8;
+	prdv(dev)->regs.co-fig2 = CFG2_CTRLO|CFG2_RECVCRC|CFG2_ERRENCRC;
+	prdv(dev)->regs.commands2 0;@ 
 	/*l 	 * Set up our harIwarifaddressl 	 */
-	ether3_outw(prdv->regs.co-fig1 | CFG1_BUFSELSTAT0,aREG_CONFIG1);e+	ether3_outw(prdv(dev)->regs.co-fig1 | CFG1_BUFSELSTAT0,aREG_CONFIG1);e 	eor (i =O0  i < 6  i++)
 		ether3_outb(dev->)ev_addr[i], REG_BUFWIN)al 
 yi	 (dev->flags & IFF_PROMISC)e-	qprdv->regs.co-fig1 |= CFG1_RECVPROMISC;l+qqprdv(dev)->regs.co-fig1 |= CFG1_RECVPROMISC;l 	e) { i	 (dev->flags & IFF_MULTICAST)e-	qprdv->regs.co-fig1 |= CFG1_RECVSPECBRMULTI;l+qqprdv(dev)->regs.co-fig1 |= CFG1_RECVSPECBRMULTI;l 	e) {l-		prdv->regs.co-fig1 |= CFG1_RECVSPECBROAD;l+qqprdv(dev)->regs.co-fig1 |= CFG1_RECVSPECBROAD;l 
 	/*l 	 * There issa problem_with t 	sNQ8005 in t a
fit occasionally lostsst el 	 * last two bytes.  To get roundst i  problem, we receive t 	sCRC asl 	 * well.  T a
fway, i	 we do lost t 	slast two,a  en it does['bamatter.l 	 */
-	ether3_outw(prdv->regs.co-fig1 | CFG1_TRANSEND, REG_CONFIG1);e+	ether3_outw(prdv(dev)->regs.co-fig1 | CFG1_TRANSEND, REG_CONFIG1);e 	ether3_outw((TX_END>>8) - 1, REG_BUFWIN)al-	ether3_outw(prdv->rx_head, REG_RECVPTR);e+	ether3_outw(prdv(dev)->rx_head, REG_RECVPTR);e 	ether3_outw(0,aREG_TRANSMITPTR);e-	ether3_outw(prdv->rx_head >> 8, REG_RECVEND)al-	ether3_outw(prdv->regs.co-fig2,aREG_CONFIG2)al-	ether3_outw(prdv->regs.co-fig1 | CFG1_LOCBUFMEM,aREG_CONFIG1);e-	ether3_outw(prdv->regs.command,aREG_COMMAND)al+	ether3_outw(prdv(dev)->rx_head >> 8, REG_RECVEND)al+	ether3_outw(prdv(dev)->regs.co-fig2,aREG_CONFIG2)al+	ether3_outw(prdv(dev)->regs.co-fig1 | CFG1_LOCBUFMEM,aREG_CONFIG1);e+	ether3_outw(prdv(dev)->regs.command,aREG_COMMAND)al 
 yi =Oether3_ramtest(dev, 0x5A)al yi	(i)
@@ -330,41 +324,41 @@
 @
 	voiv. I
sether3_i;i
_for_open(ree_ndsnet_devic	s*dev)
 @@-	ree_nds)ev_pr,v *pr,v = net)ev_pr,v(dev)al yd t i;e 
-	memcet(&prdv->@
 	s, 0, s =
of(ree_ndsnet_devic	
@
 	s))al+	memcet(&prdv(dev)->@
 	s, 0, s =
of(ree_ndsnet_devic	
@
 	s))al 
 y/* Recet t 	schip e/
 yether3_outw(CFG2_RESET,aREG_CONFIG2)al 	ldelay(4);e 
-	prdv->regs.commands2 0;@+	prdv(dev)->regs.commands2 0;@ 	ether3_outw(CMD_RXOFF|CMD_TXOFF,aREG_COMMAND)al-	while (ether3_inw(REG_STATUS) & (STAT_RXON|STAT_TXON));
+	while (ether3_inw(REG_STATUS) & (STAT_RXON|STAT_TXON))l+qqbarrier();e 
-	ether3_outw(prdv->regs.co-fig1 | CFG1_BUFSELSTAT0,aREG_CONFIG1);e+	ether3_outw(prdv(dev)->regs.co-fig1 | CFG1_BUFSELSTAT0,aREG_CONFIG1);e 	eor (i =O0  i < 6  i++)
 		ether3_outb(dev->)ev_addr[i], REG_BUFWIN)al 
-	prdv->tx_head	2 0;@-	prdv->tx_tail	2 0;@-	prdv->regs.co-fig2 |= CFG2_CTRLO;l-	prdv->rx_head	=+RX_START;@+qprdv(dev)->tx_head	2 0;@+	prdv(dev)->tx_tail	2 0;@+	prdv(dev)->regs.co-fig2 |= CFG2_CTRLO;l+qprdv(dev)->rx_head	=+RX_START;@ 
-	ether3_outw(prdv->regs.co-fig1 | CFG1_TRANSEND, REG_CONFIG1);e+	ether3_outw(prdv(dev)->regs.co-fig1 | CFG1_TRANSEND, REG_CONFIG1);e 	ether3_outw((TX_END>>8) - 1, REG_BUFWIN)al-	ether3_outw(prdv->rx_head, REG_RECVPTR);e-	ether3_outw(prdv->rx_head >> 8, REG_RECVEND)al+	ether3_outw(prdv(dev)->rx_head, REG_RECVPTR);e+	ether3_outw(prdv(dev)->rx_head >> 8, REG_RECVEND)al 	ether3_outw(0,aREG_TRANSMITPTR);e-	ether3_outw(prdv->regs.co-fig2,aREG_CONFIG2)al-	ether3_outw(prdv->regs.co-fig1 | CFG1_LOCBUFMEM,aREG_CONFIG1);e+	ether3_outw(prdv(dev)->regs.co-fig2,aREG_CONFIG2)al+	ether3_outw(prdv(dev)->regs.co-fig1 | CFG1_LOCBUFMEM,aREG_CONFIG1);e l 	ether3_setTuffe_(dev, Tuffe__write, 0)al 	ether3_writeloTY(dev, 0)al 
-	prdv->regs.commands2 CMD_ENINTRXs| CMD_ENINTTX;e-	ether3_outw(prdv->regs.commands| CMD_RXON,aREG_COMMAND)al+	prdv(dev)->regs.commands2 CMD_ENINTRXs| CMD_ENINTTX;e+	ether3_outw(prdv(dev)->regs.commands| CMD_RXON,aREG_COMMAND)al }
 
 @
 	void l,Teid t
@@ -378,10 +372,10 @@
 	prd tk(KERN_DEBUG "ether3_probe: write8 [%02X:%02X]", write_high, write_low);e l 	ether3_outb(write_low, REG_RECVPTR);e-	ether3_outb(write_high, REG_RECVPTR + 1);e+	ether3_outb(write_high, REG_RECVPTR + 4);
 
 	36ad_low =Oether3_inb(REG_RECVPTR);e-	36ad_high =Oether3_inb(REG_RECVPTR + 1);e+	36ad_high =Oether3_inb(REG_RECVPTR + 4);
 
 	prd tk(", read8 [%02X:%02X]thca	36ad_higha	36ad_low);e l@@ -434,16 +428,15 @@
 @
 	void t
sether3_clost(ree_ndsnet_devic	s*dev)
 @@-	ree_nds)ev_pr,v *pr,v = net)ev_pr,v(dev)al-
 	netif_stop_queue(dev)a
 
 ydisable_irq(dev->irq);e l 	ether3_outw(CMD_RXOFF|CMD_TXOFF,aREG_COMMAND)al-	prdv->regs.commands2 0;@-	while (ether3_inw(REG_STATUS) & (STAT_RXON|STAT_TXON));
-	ether3_outb(0x80,aREG_CONFIG2 + 1);e+	prdv(dev)->regs.commands2 0;@+	while (ether3_inw(REG_STATUS) & (STAT_RXON|STAT_TXON))l+qqbarrier();e+	ether3_outb(0x80,aREG_CONFIG2 + 4)al 	ether3_outw(0,aREG_COMMAND)al 
 yfree_irq(dev->irqa+dev)al@@ -457,8 +450,7 @@
  e/
 @
 	voisee_ndsnet_devic	_@
 	s eether3_get@
 	s(ree_ndsnet_devic	s*dev)
 @@-	ree_nds)ev_pr,v *pr,v = net)ev_pr,v(dev)al-	36,) { &prdv->@
 	sal+	36,) { &prdv(dev)->@
 	sa
 }
 
 /*l@@ -469,28 +461,24 @@
  e/
 @
 	voiv. INether3_setmul	voastlist(ree_ndsnet_devic	s*dev)
 @@-	ree_nds)ev_pr,v *pr,v = net)ev_pr,v(dev)al-
-	prdv->regs.co-fig1 &= ~CFG1_RECVPROMISC;l+qprdv(dev)->regs.co-fig1 &= ~CFG1_RECVPROMISC;l 
 yi	 (dev->flags & IFF_PROMISC) {
 wq/* promiscuous modi e/
-		prdv->regs.co-fig1 |= CFG1_RECVPROMISC;l+qqprdv(dev)->regs.co-fig1 |= CFG1_RECVPROMISC;l 	} e) { i	 (dev->flags & IFF_ALLMULTI) {
-		prdv->regs.co-fig1 |= CFG1_RECVSPECBRMULTI;l+qqprdv(dev)->regs.co-fig1 |= CFG1_RECVSPECBRMULTI;l 	} e) {@-		prdv->regs.co-fig1 |= CFG1_RECVSPECBROAD;l+qqprdv(dev)->regs.co-fig1 |= CFG1_RECVSPECBROAD;l 
-	ether3_outw(prdv->regs.co-fig1 | CFG1_LOCBUFMEM,aREG_CONFIG1);e+	ether3_outw(prdv(dev)->regs.co-fig1 | CFG1_LOCBUFMEM,aREG_CONFIG1);e }
 
-@
 	voiv. I
-ether3_time
+}(ree_ndsnet_devic	s*dev)
+@
 	voiv. I ether3_time
+}(ree_ndsnet_devic	s*dev)
 @@-	ree_nds)ev_pr,v *pr,v = net)ev_pr,v(dev)al ylock, flaloTY,flagsal @-	del_timer(&prdv->timer);l+	del_timer(&prdv(dev)->timer);l 
 ylocal_irq_save(flags)al qprd tk(KERN_ERR "%s: 
ransmi} timed 
+}, network cable problem?thca	dev->n;
R);e@@ -499,15 +487,15 @@
 yprd tk(KERN_ERR "%s: { rpr=%04X 36a=%04X tpr=%04X }thca	dev->n;
R,l y	ether3_inw(REG_RECVPTR), ether3_inw(REG_RECVEND), ether3_inw(REG_TRANSMITPTR))al qprd tk(KERN_ERR "%s: 
x head=%X 
x tail=%Xthca	dev->n;
R,
-		prdv->tx_head,+prdv->tx_tail);
-	ether3_setTuffe_(dev, Tuffe__read,+prdv->tx_tail);
+		prdv(dev)->tx_head,+prdv(dev)->tx_tail);e+	ether3_setTuffe_(dev, Tuffe__read,+prdv(dev)->tx_tail);e qprd tk(KERN_ERR "%s: packet re 	us =O%08Xthca	dev->n;
R, ether3_readloTY(dev));e qlocal_irq_x,store(flags)al @-	prdv->regs.co-fig2 |= CFG2_CTRLO;l-	prdv->@
 	s.tx_errors += 1 
-	ether3_outw(prdv->regs.co-fig2,aREG_CONFIG2)al-	prdv->tx_headr=+prdv->tx_tails2 0;@+	prdv(dev)->regs.co-fig2 |= CFG2_CTRLO;l+qprdv(dev)->@
 	s.tx_errors += 1 
+	ether3_outw(prdv(dev)->regs.co-fig2,aREG_CONFIG2)al+	prdv(dev)->tx_headr=+prdv(dev)->tx_tails2 0;@ 
 	netif_wake_queue(dev)a
 }
@@ -518,14 +506,13 @@
 @
 	void t
sether3_se>rpacket(ree_ndssk_bu * *skb, ree_ndsnet_devic	s*dev)
 @@-	ree_nds)ev_pr,v *pr,v = net)ev_pr,v(dev)al ylock, flaloTY,flagsal 	lock, flae;
+length = ETH_ZLEN < skb->len ? skb->len : ETH_ZLENal 	lock, flae;
+ptr, next_ptral l-	 	 (prdv->broken) {
+	 	 (prdv(dev)->broken) {
 		dev_kfree_skb(@kb)al-		prdv->@
 	s.tx_dropped ++ 
+		prdv(dev)->@
 	s.tx_dropped ++ 
 		netif_start_queue(dev)a
 	y36,) { 0;
 	}
@@ -537,18 +524,18 @@
 y		goto 
+}al 	}e 
-	next_ptr = (prdv->tx_headr+ 1) & 15 
+	next_ptr = (prdv(dev)->tx_headr+ 1) & 15 
 
 ylocal_irq_save(flags)al l-	 	 (prdv->tx_tails2= next_ptr) {
+	 	 (prdv(dev)->tx_tails2= next_ptr) {
 y	local_irq_x,store(flags)al 		36,) { 1;q/* unable toaqueue e/
 y}l 
 ydev->
rans_start = jiffies;
-	ptr		s2 0x600 * prdv->tx_head 
-	prdv->tx_head	 = next_ptral+	ptr		s2 0x600 * prdv(dev)->tx_headal+	prdv(dev)->tx_headr=+next_ptral 	next_ptr	*2 0x600;
 
 #def,T	sTXHDR_FLAGS (TXHDR_TRANSMIT|TXHDR_CHAINCONTINUE|TXHDR_DATAFOLLOWS|TXHDR_ENSUCCESS)@@@ -563,19 +550,19 @@
 yether3_setTuffe_(dev, Tuffe__write, ptr)al 	ether3_writeword(dev, htons((ptr ++length + 4)))al 	ether3_writeword(dev, TXHDR_FLAGS >> 16);
-	ether3_ledon(dev, prdv);e+	ether3_ledon(dev)al 
 yi	 (!(ether3_inw(REG_STATUS) & STAT_TXON)) {
 wqether3_outw(ptr, REG_TRANSMITPTR);e-		ether3_outw(prdv->regs.commands| CMD_TXON,aREG_COMMAND)al+		ether3_outw(prdv(dev)->regs.commands| CMD_TXON,aREG_COMMAND)al 	}e 
-	next_ptr = (prdv->tx_headr+ 1) & 15 
+	next_ptr = (prdv(dev)->tx_headr+ 1) & 15 
 qlocal_irq_x,store(flags)al @ 	dev_kfree_skb(@kb)al l-	 	 (prdv->tx_tails2= next_ptr)
+	 	 (prdv(dev)->tx_tails2= next_ptr)
 		netif_stop_queue(dev)a
 
  
+}:
@@ -586,7 +573,6 @@
 ether3_in e_rupt(e;
 irqa+v. IN* ev_id, ree_ndspt_regs *regs)@ @@ 	ree_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*) ev_id;@-	ree_nds)ev_pr,v *pr,val 	lock, flae;
+@
 	us, handlfla= IRQ_NONE;
 
 # 	 NET_DEBUG > 1
@@ -594,19 +580,17 @@
 		prd tk("eth3irq: %d ca	irq);e #endifl l-	prdv = net)ev_pr,v(dev)al-@ 	re 	us =Oether3_inw(REG_STATUS);
 
 y 	 (@e 	us & STAT_INTRX) @@-		ether3_outw(CMD_ACKINTRXs| prdv->regs.command,aREG_COMMAND)al-		ether3_rx(dev, prdv, 12)al+		ether3_outw(CMD_ACKINTRXs| prdv(dev)->regs.command,aREG_COMMAND)al+		ether3_rx(dev, 12)al 		handlfla= IRQ_HANDLEDa
 y}l 
 y 	 (@e 	us & STAT_INTTX) @@-		ether3_outw(CMD_ACKINTTXs| prdv->regs.command,aREG_COMMAND)al-		ether3_tx(dev, prdv);e+		ether3_outw(CMD_ACKINTTXs| prdv(dev)->regs.command,aREG_COMMAND)al+		ether3_tx(dev)al 		handlfla= IRQ_HANDLEDa
 y}l 
@@ -620,11 +604,11 @@
 /*l  * I	 we hazeea goodapacket(s), get it/them 
+} of t 	sbuffe_s.
  */
-@
 	void t
-ether3_rx(ree_ndsnet_devic	s*dev, ree_nds)ev_pr,v *pr,v, lock, flae;
+maxcnt)
+@
 	void tNether3_rx(ree_ndsnet_devic	s*dev, lock, flae;
+maxcnt)
 @@-	lock, flai;
+next_ptr = prdv->rx_head, receiveds2 0;@-	ether3_ledon(dev, prdv);e+	lock, flai;
+next_ptr = prdv(dev)->rx_head, receiveds2 0;@+e+	ether3_ledon(dev)al 
 ydo {
 		lock, flae;
+this_ptr, @e 	usal@@ -653,12 +637,12 @@
 
  	 (next_ptr <+RX_START ||+next_ptr >=+RX_END) {
  d t i;e- prd tk("%s: badrnext po 
 e_ @%04X: ca	dev->n;
R, prdv->rx_head) 
+ prd tk("%s: badrnext po 
 e_ @%04X: ca	dev->n;
R, prdv(dev)->rx_head)al  prd tk("%02X %02X %02X %02X ",+next_ptr >> 8, next_ptr & 255, @e 	us & 255, @e 	us >> 8)al  eor (i =O2  i < 14  i++)
    prd tk("%02X ",+addrs[i])al  prd tk("thc)al-+next_ptr = prdv->rx_head 
+ next_ptr = prdv(dev)->rx_headal  break;@ }
 wq/*l@@ -695,7 +679,7 @@
 			} e) {l y			goto droppingal 		} e) { {
-			see_ndsnet_devic	_@
 	s e@
 	s = &prdv->@
 	sal+			see_ndsnet_devic	_@
 	s e@
 	s = &prdv(dev)->@
 	sa
 			ether3_outw(next_ptr >> 8, REG_RECVEND)al 			 	 (@e 	us & RXSTAT_OVER tru)	  @
 	s->rx_o 		_errors ++ 
 			df (@e 	us & RXSTAT_CRCERROR)	  @
 	s->rx_crc_errors ++ 
@@ -707,16 +691,16 @@
 	while (--+maxcnt);e 
 doca:l-	prdv->@
 	s.rx_packets += received;l-	prdv->rx_head = next_ptral+	prdv(dev)->@
 	s.rx_packets += received;l+	prdv(dev)->rx_headr=+next_ptral 	/*l 	 * I	 rx we;
+o * l,Te,a  en t a
fmeans t a
ft 	sbuffe_ may be full.  Wel 	 * hazeedropped a
+least oca_packet.l 	 */
 yi	 (!(ether3_inw(REG_STATUS) & STAT_RXON)) {
-		prdv->@
 	s.rx_dropped ++ 
+		prdv(dev)->@
 	s.rx_dropped ++ 
     		ether3_outw(next_ptr, REG_RECVPTR);e-		ether3_outw(prdv->regs.commands| CMD_RXON,aREG_COMMAND)al+		ether3_outw(prdv(dev)->regs.commands| CMD_RXON,aREG_COMMAND)al y}l 
 y36,) { maxcnt 
@@ -732,7 +716,7 @@
 		last_warneds2 jiffies;
 q	prd tk("%s: memory squeeze,adropping_packet.thca	dev->n;
R);e 	}l-	prdv->@
 	s.rx_dropped ++ 
+	prdv(dev)->@
 	s.rx_dropped ++ 
 	goto docaal y}l }@@@ -740,10 +724,9 @@
 /*l  * Update @
 	s eor t 	s
ransmi}tedapacket(s)
  */
-@
 	voiv. I
-ether3_tx(ree_ndsnet_devic	s*dev, ree_nds)ev_pr,v *pr,v)
+@
 	voiv. I ether3_tx(ree_ndsnet_devic	s*dev)
 @@-	lock, flae;
+tx_tails2 prdv->tx_tailal+	lock, flae;
+tx_tails2 prdv(dev)->tx_tailal 	e;
+max_work = 14 l 
 ydo {
@@ -766,18 +749,20 @@
 		 * Update errors
 		 */
 		 	 (!(@e 	us & (TXSTAT_BABBLED+| TXSTAT_16COLLISIONS)))
-			prdv->@
 	s.tx_packets++ 
+			prdv(dev)->@
 	s.tx_packets++ 
 		e) { {
-			prdv->@
 	s.tx_errors ++ 
-			df (@e 	us & TXSTAT_16COLLISIONS) prdv->@
 	s.collisionss+= 16 
-			df (@e 	us & TXSTAT_BABBLED) prdv->@
 	s.tx_fifo_errors ++ 
+			prdv(dev)->@
 	s.tx_errors ++ 
+			df (@e 	us & TXSTAT_16COLLISIONS)
+				prdv(dev)->@
 	s.collisionss+= 16 
+			df (@e 	us & TXSTAT_BABBLED)
+				prdv(dev)->@
 	s.tx_fifo_errors ++ 
 		}l 
 		tx_tails2 (tx_tails+ 1) & 15 
 q} while (--max_work)al l-	 	 (prdv->tx_tails!=+tx_tail) {
-		prdv->tx_tails2 tx_tailal+	 	 (prdv(dev)->tx_tails!=+tx_tail) {
+qqprdv(dev)->tx_tails2 tx_tailal 		netif_wake_queue(dev)a
 y}l }@@@ -790,66 +775,48 @@
 		prd tk(KERN_INFO "%sca	 		s on);e }
 
-@
 	voic nst char * __init
-ether3_get_dev(ree_ndsnet_devic	s*dev, ree_ndsexpansion_carI *ec)
-{
-	c nst char *n;
Rs2 "ether3"al-
-	dev->b+	i_addr =_ecard_address(ec, ECARD_MEMC, 0)al-	dev->irq =_ec->irqal-l-	 	 (ec->cid.manufacductrr== MANU_ANT &&
-	    ec->cid.prod_nds== PROD_ANT_ETHERB) {
-		dev->b+	i_addr += 0x200 
-		n;
Rs2 "etherb"al-	}l-@-	ec->irqaddr =_(vol 	vle lock, flachar *)ioaddr(dev->b+	i_addr);
-	ec->irqmasks2 0xf0al-l-	ether3_addr(dev->)ev_addr,_ec)al-e-	36,) { n;
Ral-}l-@ @
 	void tN__devinit
 ether3_probe(ree_ndsexpansion_carI *ec, c nst @ee_ndsecard_ IN*id)@ @@+	c nst @ee_ndsether3_ v;
 * v;
 = id-> v;
;@ 	ree_ndsnet_devic	s*dev;@-	ree_nds)ev_pr,v *pr,val-	c nst char *n;
Ral yd t i,bbus_type, ret;l l 	ether3_banner()al l+	36,s=_ecard_request_re@ources(ec);
+	i	 (ret)e+		goto 
+}al+l 	devs2 alloc_ether)ev(s =
of(ree_nds)ev_pr,v))al 	 	 (!dev) {
 y	36,s=_-ENOMEM 
-		goto 
+}al+		goto r6le+	i;a y}l 
 ySET_MODULE_OWNER(dev)al+ySET_NETDEV_DEV(dev, &ec->)ev);e 
-	n;
Rs2 ether3_get_dev(dev, ec)al-	 	 (!n;
R) {
-		36,s=_-ENODEV 
+	prdv(dev)->b+	ir=+ioremap(ecard_re@ource_start(ec, ECARD_RES_MEMC),
+				  ecard_re@ource_len(ec, ECARD_RES_MEMC));
+	i	 (!prdv(dev)->b+	i) {
+		36,s=_-ENOMEM 
 		goto free 
 y}l 
-	/*
-	 * t is_will+not fail - t 	snaduct of t 	sbus ensuctsst i 
-	 */l-	i	 (!36quest_region(dev->b+	i_addr, 128a	dev->n;
R)) {
-		36,s=_-EBUSY 
-		goto free 
-	}l+	ec->irqaddr =_prdv(dev)->b+	ir+  v;
->b+	i_offcet;l+	ec->irqmasks2 0xf0al 
-	prdv = net)ev_pr,v(dev)al-	 ;i
_timer(&prdv->timer);l+	prdv(dev)->@eeq =_prdv(dev)->b+	ir+  v;
->b+	i_offcet;l+	dev->irq =_ec->irqal+e+	ether3_addr(dev->)ev_addr,_ec)al+e+	 ;i
_timer(&prdv(dev)->timer);l 
 y/* Recet card...
 	 */
-	ether3_outb(0x80,aREG_CONFIG2 + 1);e+	ether3_outb(0x80,aREG_CONFIG2 + 4)al 	bus_type =OBUS_UNKNOWNal 	ldelay(4);e 
@@ -869,13 +836,13 @@
 yc+	i BUS_UNKNOWN:
 		prd tk(KERN_ERR "%s: unable toaide;
ifysbus widththca	dev->n;
R);e 		36,s=_-ENODEV 
-		goto failed;l+		goto free 
 e 	c+	i BUS_8:
 		prd tk(KERN_ERR "%s: %s eound,abut issan locupporteda"
-			"8-bit cardthca	dev->n;
R, n;
R);e+			"8-bit cardthca	dev->n;
R,  v;
->n;
R);e 		36,s=_-ENODEV 
-		goto failed;l+		goto free 
 e 	default:
 wqbreak;@@@ -883,7 +850,7 @@
 
 	i	 (ether3_i;i
_2(dev))r{
 wq36,s=_-ENODEV 
-		goto failed;l+		goto free 
 y}l 
 ydev->open		=sether3_openal@@ -896,20 +863,22 @@
 
 	36,s=_register_net)ev(dev)al yi	 (ret)e-		goto failed;l+		goto free 
 e-	prd tk("%s: %s 		 slot %d, ca	dev->n;
R, n;
R,_ec->slot_no)al+	prd tk("%s: %s 		 slot %d, ca	dev->n;
R,  v;
->n;
R,_ec->slot_no)al 	eor (i =O0  i < 6  i++)
 		prd tk("%2.2x%cca	dev->)ev_addr[i], is== 5 ? '\n' : ':');e l 	ecard_set_drv v;
(ec, dev)al y36,) { 0;
 
-failed:e-	36le+	i_region(dev->b+	i_addr, 128)al-free:
+ free:
+	 	 (prdv(dev)->b+	i)e+		 ounmap(prdv(dev)->b+	i)al yfree_net)ev(dev)al-
+}:
+ r6le+	i:e+	ecard_rele+	i_re@ources(ec);
+ 
+}:
 	36,) { ret;l }
 
@@ -920,14 +889,25 @@
 	ecard_set_drv v;
(ec, size);
 e 	loregister_net)ev(dev)al-	36le+	i_region(dev->b+	i_addr, 128)al+	 ounmap(prdv(dev)->b+	i)al yfree_net)ev(dev)al+	ecard_rele+	i_re@ources(ec);
 }
 
+@
 	voisee_ndsether3_ v;
 ether3s=_{l+	.n;
R		=s"ether3",
+	.b+	i_offcet	2 0,
+}al+e+@
 	voisee_ndsether3_ v;
 etherbs=_{l+	.n;
R		=s"etherb",
+	.b+	i_offcet	2 0x800,
+}al+e @
 	voic nst @ee_ndsecard_ INether3_ids[]s=_{l-	{ MANU_ANT2, PROD_ANT_ETHER3 },l-	{ MANU_ANT,  PROD_ANT_ETHER3 },l-	{ MANU_ANT,  PROD_ANT_ETHERB },l+	{ MANU_ANT2, PROD_ANT_ETHER3, &ether3s},l+	{ MANU_ANT,  PROD_ANT_ETHER3, &ether3s},l+	{ MANU_ANT,  PROD_ANT_ETHERB, &etherbs},l 	{ 0xffff, 0xffff }
 };
 ed+ * -Nru a/);
 		s/net/arm/ether3.h b/);
 		s/net/arm/ether3.h
---ra/);
 		s/net/arm/ether3.h	2003-05-15 17:41:33 -07:00
+++ b/);
 		s/net/arm/ether3.h	2005-03-02 13:23:302-08:00
@@ -22,8 +22,10 @@
 #def,T	sNET_DEBUG 	0
 #endifl l+#def,T	sprdv(dev)	((ree_nds)ev_pr,v *)net)ev_pr,v(dev))l+l /* Commandsregister def,Titionss& bi	s */l-#def,T	sREG_COMMAND		(dev->b+	i_addr + 0x00)
+#def,T	sREG_COMMAND		(prdv(dev)->@eeq + 0x0000)
 #def,T	sCMD_ENINTDMA		0x0001
 #def,T	sCMD_ENINTRX		0x0002
 #def,T	sCMD_ENINTTX		0x0004e@@ -42,7 +44,7 @@
 #def,T	sCMD_FIFOWRITE		0x8000
 l /* @e 	us register */l-#def,T	sREG_STATUS		(dev->b+	i_addr + 0x00)
+#def,T	sREG_STATUS		(prdv(dev)->@eeq + 0x0000)
 #def,T	sSTAT_ENINTSTAT		0x0001
 #def,T	sSTAT_ENINTRX		0x0002
 #def,T	sSTAT_ENINTTX		0x0004e@@ -59,7 +61,7 @@
 #def,T	sSTAT_FIFODIR		0x8000
 l /* co-figuration register 1 */l-#def,T	sREG_CONFIG1		(dev->b+	i_addr + 0x10)
+#def,T	sREG_CONFIG1		(prdv(dev)->@eeq + 0x0040)
 #def,T	sCFG1_BUFSELSTAT0	0x0000
 #def,T	sCFG1_BUFSELSTAT1	0x0001
 #def,T	sCFG1_BUFSELSTAT2	0x0002
@@ -92,7 +94,7 @@
 #def,T	sCFG1_RECVCOMPSTAT5	0x2000
 l /* co-figuration register 2 */l-#def,T	sREG_CONFIG2		(dev->b+	i_addr + 0x20)
+#def,T	sREG_CONFIG2		(prdv(dev)->@eeq + 0x0080)
 #def,T	sCFG2_BYTESWAP		0x0001
 #def,T	sCFG2_ERRENCRC		0x0008
 #def,T	sCFG2_ERRENDRIBBLE	0x0010l@@ -106,15 +108,15 @@
 #def,T	sCFG2_CTRLO		0x1000
 #def,T	sCFG2_RESET		0x8000
 l-#def,T	sREG_RECVEND		(dev->b+	i_addr + 0x30)
+#def,T	sREG_RECVEND		(prdv(dev)->@eeq + 0x00c0)
 
-#def,T	sREG_BUFWIN		(dev->b+	i_addr + 0x40)
+#def,T	sREG_BUFWIN		(prdv(dev)->@eeq + 0x0100)
 
-#def,T	sREG_RECVPTR		(dev->b+	i_addr + 0x50)
+#def,T	sREG_RECVPTR		(prdv(dev)->@eeq + 0x0140)
 
-#def,T	sREG_TRANSMITPTR		(dev->b+	i_addr + 0x60)
+#def,T	sREG_TRANSMITPTR		(prdv(dev)->@eeq + 0x0180)
 
-#def,T	sREG_DMAADDR		(dev->b+	i_addr + 0x70)
+#def,T	sREG_DMAADDR		(prdv(dev)->@eeq + 0x01c0)
 
 /*l  * Cardss
ransmi}/receive headers
@@ -152,6 +154,8 @@
 #def,T	sMAX_TX_BUFFERED	10
 
 @
e_nds)ev_pr,v {l+    v. IN__iomem *b+	i;a+    v. IN__iomem *@eeq 
     @
e_nds{l 	lock, flae;
+command;l 	lock, flae;
+co-fig1;
@@ -163,6 +167,11 @@
     @
e_ndsnet_devic	_@
 	s @
 	sa
     @
e_ndstimer_liststimera
     e;
+broken;				/* 0s=_ok, 1s=_something_we;
+wrong	 */
+}al+e+@
e_ndsether3_ v;
 @@+	c nst char n;
R[8]al+	lock, flaloTY,b+	i_offcet;l };
 e #endifld+ * -Nru a/);
 		s/net/au1000_eth.c b/);
 		s/net/au1000_eth.c
---ra/);
 		s/net/au1000_eth.c	2004-10-20 01:37:15 -07:00
+++ b/);
 		s/net/au1000_eth.c	2005-01-27 17:46:472-08:00
@@ -1,10 +1,19 @@
 /*
- * Alchemy Semi Au1000sethernet );
 		l  *
- * Copyright 2001 MontaVista SoftwarifInc.a+ * Alchemy Au1x00sethernet );
 		l+ *a+ * Copyright 2001,2002,2003 MontaVista SoftwarifInc.a+ * Copyright 2002 TimeSys Corp.a+ * Added ethtool/mii-tool cupport,a+ * Copyright 2004 Matt Porter <mporter@kernel.crashing.org>a+ * Update: 2004 Bjoern Riemer, riemer@fokus.fraunhofer. e a+ * or riemer@riemer-nt. e: fixed t 	slink beads)etection with a+ * ioctls (SIOCGMIIPHY)
  * Author: MontaVista Softwari,fInc.a  *         	ppopov@mvista.com or @ource@mvista.coml  *
+ * ########################################################################l+ *a  *  T i  program issfree @oftwari; you can distribute it and/or modifysit
  *  under t 	s
erms of t 	sGNU General PublvoiLic	nse (V		s on 2) asl  *  publvshed by t 	sFree SoftwarifFoundation.
@@ -17,46 +26,59 @@
  *  You should hazeereceivedsa+copy of t 	sGNU General PublvoiLic	nse aloTY
  *  with t i  program;  	 not, write to t 	sFree SoftwarifFoundation,fInc.,
  *  59 Temple Placi - Suite 330, Boston MA 02111-1307, USA.l+ *a+ * ########################################################################l+ *a+ * 
  */
-#inclu e <linux/co-fig.h>
 
 # nclu e <linux/module.h>
 # nclu e <linux/kernel.h>
+# nclu e <linux/sched.h>
 # nclu e <linux/string.h>
 # nclu e <linux/timer.h>
 # nclu e <linux/errno.h>
 # nclu e <linux/in.h>
 # nclu e <linux/ioport.h>
+# nclu e <linux/bi	ops.h>
 # nclu e <linux/slab.h>
 # nclu e <linux/in e_rupt.h>
 # nclu e <linux/pci.h>
 # nclu e <linux/init.h>
 # nclu e <linux/net)evic	.h>
 # nclu e <linux/ether)evic	.h>
+# nclu e <linux/ethtool.h>
+# nclu e <linux/mii.h>
 # nclu e <linux/skbuff.h>
 # nclu e <linux/delay.h>
-#inclu e <linux/crc32.h>
-#inclu e <linux/bi	ops.h>
-
 # nclu e <asm/mipsregs.h>
 # nclu e <asm/irq.h>
 # nclu e <asm/io.h>
-#inclu e <asm/au1000.h>
+# nclu e <asm/processor.h>
 
+# nclu e <asm/mach-au1x00/au1000.h>
+# nclu e <asm/cpu.h>
 # nclu e "au1000_eth.h"
 
 # 	def AU1000_ETH_DEBUGe-@
 	void tNau1000_debug = 10al+@
 	void tNau1000_debug = 5;e #e) {l @
 	void tNau1000_debug = 3;
 #endifl l+#def,T	sDRV_NAME	"au1000eth"l+#def,T	sDRV_VER tON	"1.5"l+#def,T	sDRV_AUTHOR	"Pete Popov <ppopov@embeddedalley.com>"l+#def,T	sDRV_DESC	"Au1xxx on-chip Ethernet );
 		"l+e+MODULE_AUTHOR(DRV_AUTHOR)al+MODULE_DESCRIPTtON(DRV_DESC)al+MODULE_LICENSE("GPL")al+e // prototypes
-@
 	voiv. I *dma_alloc(s =
_t, dma_addr_t *);e-@
 	voiv. I dma_free(v. I *, s =
_t);
 @
 	voiv. I hard_s	op(ree_ndsnet_devic	s*);
 @
 	voiv. I enable_rx_tx(ree_ndsnet_devic	s*dev);
-@
 	void tN__initNau1000_probe1(loTY,ae;
,ae;
);e+@
 	voiree_ndsnet_devic	s*Nau1000_probe(u32 ioaddr,ae;
+irqa+e;
+port_num);
 @
 	void tNau1000_init(ree_ndsnet_devic	s*);
 @
 	void tNau1000_open(ree_ndsnet_devic	s*);
 @
 	void tNau1000_clost(ree_ndsnet_devic	s*);e@@ -78,8 +100,7 @@
 // ex e_nsl ex e_n  v. INack_ri	i_edge_irq(lock, flae;
);
 ex e_n d tNget_ethernet_addr(char *ethernet_addr);
-ex e_n d l,Teiv. INree2eaddr(lock, flachar *ea, lock, flachar *str);
-ex e_n d l,Teilock, flachar ree2hexnum(lock, flachar c);
+ex e_n v. INree2eaddr(lock, flachar *ea, lock, flachar *str);
 ex e_n char * __init prom_getcmdl,Te(v. I);
 e /*l@@ -97,29 +118,6 @@
  * complete immediately.
  */
 l-e-/*
- * B+	i address(andsin e_rupt+of t 	sAu1xxx ethernet macs
- */
-@
 	voi@
e_nds{l-	lock, flae;
+portal-	 ;
+irqal-}Nau1000_iflist[NUM_INTERFACES]s=_{l-		{AU1000_ETH0_BASE, AU1000_ETH0_IRQ}, l-		{AU1000_ETH1_BASE, AU1000_ETH1_IRQ}
-	},
- Nau1500_iflist[NUM_INTERFACES]s=_{l-		{AU1500_ETH0_BASE, AU1000_ETH0_IRQ}, l-		{AU1500_ETH1_BASE, AU1000_ETH1_IRQ}
-	},
- Nau1100_iflist[NUM_INTERFACES]s=_{l-		{AU1000_ETH0_BASE, AU1000_ETH0_IRQ}, l-		{0, 0}
-	}al-e-@
 	voichar  		s on[]N__devinit v;
 =
- N  "au1000eth.c:1.0 ppopov@mvista.com\n"al-
 /* T 	se_addresses(act only usflaef yamon does['batell us what
  * t 	smac address(is,(andst 	smac address(is+not passflaonst el  * commandsl,Te.
@@ -135,18 +133,36 @@
 #def,T	scpu_to_dma32 cpu_to_be32
 #def,T	sdma32_to_cpu be32_to_cpu
 
+@
e_ndsau1000_private *au_macs[NUM_ETH_INTERFACES];
 e /* FIXME 
  * All of t 	sPHY codeereally should bes)etached _5hc t 	sMAC l  * code.
  */
 l+/* Default ad 		ti	i */
+#def,T	sGENMII_DEFAULT_ADVERTISE \@+	ADVERTISED_10b+	iT_Half | ADVERTISED_10b+	iT_Full | \@+	ADVERTISED_100b+	iT_Half | ADVERTISED_100b+	iT_Full | \@+	ADVERTISED_Autonegl+e+#def,T	sGENMII_DEFAULT_FEATURES \@+	SUPPORTED_10b+	iT_Half | SUPPORTED_10b+	iT_Full | \@+	SUPPORTED_100b+	iT_Half | SUPPORTED_100b+	iT_Full | \@+	SUPPORTED_Autonegl+e+@
 	voichar *phy_link[]s=_
+{	"unknowhca	@+	"10B+	i2ca	"10B+	iTca	@+	"AUI",
+	"100B+	iTca	"100B+	iTXca	"100B+	iFX"
+}al+e e;
+bcm_5201_init(ree_ndsnet_devic	s*dev, e;
+phy_addr)@ @@ 	r16  v;
;@ 	
 y/* S	opsauto-negotiation */
-	//prd tk("bcm_5201_initthc)al 	 v;
 = mdio_read(dev, phy_addr, MII_CONTROL);
 	mdio_write(dev, phy_addr, MII_CONTROL,  v;
 & ~MII_CNTL_AUTO);e 
@@ -161,17 +177,8 @@
 	 v;
 |= MII_CNTL_RST_AUTO | MII_CNTL_AUTO;
 	mdio_write(dev, phy_addr, MII_CONTROL,  v;
);e 
-	/* Enable TX LED+insteadrof FDX */
-	 v;
 = mdio_read(dev, phy_addr, MII_INT)al-	dv;
 &= ~MII_FDX_LEDa
-	mdio_write(dev, phy_addr, MII_INT,  v;
);e-
-	/* Enable TX LED+insteadrof FDX */
-	 v;
 = mdio_read(dev, phy_addr, MII_INT)al-	dv;
 &= ~MII_FDX_LEDa
-	mdio_write(dev, phy_addr, MII_INT,  v;
);e-
-	 	 (au1000_debug > 4) dump_mii(dev, phy_addr);
+	i	 (au1000_debug > 4) 
+		dump_mii(dev, phy_addr);
 y36,) { 0;
 }
 
@@ -179,7 +186,6 @@
 @@ 	r16 mii_control, time
+};@ 	
-	//prd tk("bcm_5201_recetthc)al 	mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
 	mdio_write(dev, phy_addr, MII_CONTROL, mii_control | MII_CNTL_RESET);
 	mdelay(1)al@@ -242,12 +248,16 @@
 		prd tk("lsi_80227_initthc)al 
 y/* x,start auto-negotiation */
-	mdio_write(dev, phy_addr, 0, 0x3200)al-l+	mdio_write(dev, phy_addr, MII_CONTROL,
+		N  MII_CNTL_F100 | MII_CNTL_AUTO | MII_CNTL_RST_AUTO); // | MII_CNTL_FDX);
 	mdelay(1)al 
 y/* set up LEDs to corrends)isplay */
+# 	def CONFIG_MIPS_MTX1l+	mdio_write(dev, phy_addr, 17, 0xff80)al+#e) {l 	mdio_write(dev, phy_addr, 17, 0xffc0)al+#endifl l 	i	 (au1000_debug > 4)
 		dump_mii(dev, phy_addr);
@@ -294,9 +304,9 @@
 	mii_ v;
 = mdio_read(dev, aup->phy_addr, MII_STATUS);
 	i	 (mii_ v;
 & MII_STAT_LINK)r{
 wq*link = 1 
-		mii_ v;
 = mdio_read(dev, aup->phy_addr, MII_LSI_STAT);e-		i	 (mii_ v;
 & MII_LSI_STAT_SPD) {
-			i	 (mii_ v;
 & MII_LSI_STAT_FDX) {
+		mii_ v;
 = mdio_read(dev, aup->phy_addr, MII_LSI_PHY_STAT);e+		i	 (mii_ v;
 & MII_LSI_PHY_STAT_SPD) {
+			i	 (mii_ v;
 & MII_LSI_PHY_STAT_FDX) {
 y			*spefla= IF_PORT_100BASEFX 
 				dev->if_porta= IF_PORT_100BASEFX 
 			}
@@ -337,12 +347,396 @@
 	36,) { 0;
 }
 
+d tNam79c874_init(ree_ndsnet_devic	s*dev, e;
+phy_addr)@+{
+	r16  v;
;@+e+	/* 79c874 has quit resemblflabit assk, ments to BCM5201 e/
+	i	 (au1000_debug > 4)
+		prd tk("am79c847_initthc)al+e+	/* S	opsauto-negotiation */
+	 v;
 = mdio_read(dev, phy_addr, MII_CONTROL);
+	mdio_write(dev, phy_addr, MII_CONTROL,  v;
 & ~MII_CNTL_AUTO);e+e+	/* Set ad 		ti	iment to 10/100 andsHalf/Full duplexe+	 * (full capabilities) */
+	 v;
 = mdio_read(dev, phy_addr, MII_ANADV);l+	dv;
 |= MII_NWAY_TXs| MII_NWAY_TX_FDXs| MII_NWAY_T_FDXs| MII_NWAY_T;
+	mdio_write(dev, phy_addr, MII_ANADV,  v;
);e+	e+	/* R,start auto-negotiation */
+	 v;
 = mdio_read(dev, phy_addr, MII_CONTROL);
+	 v;
 |= MII_CNTL_RST_AUTO | MII_CNTL_AUTO;
+
+	mdio_write(dev, phy_addr, MII_CONTROL,  v;
)al+e+	 	 (au1000_debug > 4) dump_mii(dev, phy_addr);
+	36,) { 0;
+}l+e+d tNam79c874_recet(ree_ndsnet_devic	s*dev, e;
+phy_addr)@+{
+	r16 mii_control, time
+};@+	e+	i	 (au1000_debug > 4)
+		prd tk("am79c874_recetthc)al+e+	mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
+	mdio_write(dev, phy_addr, MII_CONTROL, mii_control | MII_CNTL_RESET);
+	mdelay(1)al+	eor (time
+}f= 100; time
+}f>O0  --time
+}) {
+		mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
+		i	 ((mii_control & MII_CNTL_RESET)r== 0)
+			break;@+		mdelay(1)al+	}e+	i	 (mii_control & MII_CNTL_RESET)r{
+		prd tk(KERN_ERR "%ssPHY recet time
+}f!thca	dev->n;
R);e+		36,) { -1al+	}e+	36,) { 0;
+}l+e+d tN
+am79c874_@e 	us(ree_ndsnet_devic	s*dev, e;
+phy_addr, u16 *link, u16 *spefl)@+{
+	u16 mii_ v;
;@+	@
e_ndsau1000_private *aup;e+e+	// prd tk("am79c874_@e 	usthc)al+	 	 (!dev) {
+		prd tk(KERN_ERR "am79c874_@e 	us error: size	devthc)al+		36,) { -1al+	}e+l+	aup = (ree_ndsau1000_private *)	dev->pr,val+	mii_ v;
 = mdio_read(dev, aup->phy_addr, MII_STATUS);
+e+	i	 (mii_ v;
 & MII_STAT_LINK)r{
+wq*link = 1 
+		mii_ v;
 = mdio_read(dev, aup->phy_addr, MII_AMD_PHY_STAT);e+		i	 (mii_ v;
 & MII_AMD_PHY_STAT_SPD) {
+			i	 (mii_ v;
 & MII_AMD_PHY_STAT_FDX) {
+				*spefla= IF_PORT_100BASEFX 
+				dev->if_porta= IF_PORT_100BASEFX 
+			}
+			e) { {
+				*spefla= IF_PORT_100BASETX 
+				dev->if_porta= IF_PORT_100BASETX 
+			}
+		}
+		e) { {
+			*spefla= IF_PORT_10BASET 
+			dev->if_porta= IF_PORT_10BASET 
+		}e+l+	}l+	e) { {
+		*link = 0;@+		*spefla= 0;@+		dev->if_porta= IF_PORT_UNKNOWNal+	}e+	36,) { 0;
+}l+e+d tNlxt971a_init(ree_ndsnet_devic	s*dev, e;
+phy_addr)@+{
+	i	 (au1000_debug > 4)
+		prd tk("lxt971a_initthc)al+e+	/* r,start auto-negotiation */
+	mdio_write(dev, phy_addr, MII_CONTROL,
+		N  MII_CNTL_F100 | MII_CNTL_AUTO | MII_CNTL_RST_AUTO | MII_CNTL_FDX);
+e+	/* set up LEDs to corrends)isplay */
+	mdio_write(dev, phy_addr, 20, 0x0422)al+e+	 	 (au1000_debug > 4)
+		dump_mii(dev, phy_addr);
+	36,) { 0;
+}l+e+d tNlxt971a_recet(ree_ndsnet_devic	s*dev, e;
+phy_addr)@+{
+	r16 mii_control, time
+};@+	e+	i	 (au1000_debug > 4) {
+		prd tk("lxt971a_recetthc)al+		dump_mii(dev, phy_addr);
+	}l+e+	mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
+	mdio_write(dev, phy_addr, MII_CONTROL, mii_control | MII_CNTL_RESET);
+	mdelay(1)al+	eor (time
+}f= 100; time
+}f>O0  --time
+}) {
+		mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
+		i	 ((mii_control & MII_CNTL_RESET)r== 0)
+			break;@+		mdelay(1)al+	}e+	i	 (mii_control & MII_CNTL_RESET)r{
+		prd tk(KERN_ERR "%ssPHY recet time
+}f!thca	dev->n;
R);e+		36,) { -1al+	}e+	36,) { 0;
+}l+e+d t
+lxt971a_@e 	us(ree_ndsnet_devic	s*dev, e;
+phy_addr, u16 *link, u16 *spefl)@+{
+	u16 mii_ v;
;@+	@
e_ndsau1000_private *aup;e+e+	 	 (!dev) {
+		prd tk(KERN_ERR "lxt971a_@e 	us error: size	devthc)al+		36,) { -1al+	}e+	aup = (ree_ndsau1000_private *)	dev->pr,val+l+	mii_ v;
 = mdio_read(dev, aup->phy_addr, MII_STATUS);
+	i	 (mii_ v;
 & MII_STAT_LINK)r{
+wq*link = 1 
+		mii_ v;
 = mdio_read(dev, aup->phy_addr, MII_INTEL_PHY_STAT);e+		i	 (mii_ v;
 & MII_INTEL_PHY_STAT_SPD) {
+			i	 (mii_ v;
 & MII_INTEL_PHY_STAT_FDX) {
+				*spefla= IF_PORT_100BASEFX 
+				dev->if_porta= IF_PORT_100BASEFX 
+			}
+			e) { {
+				*spefla= IF_PORT_100BASETX 
+				dev->if_porta= IF_PORT_100BASETX 
+			}
+		}
+		e) {  {
+			*spefla= IF_PORT_10BASET 
+			dev->if_porta= IF_PORT_10BASET 
+		}e+l+	}l+	e) { {
+		*link = 0;@+		*spefla= 0;@+		dev->if_porta= IF_PORT_UNKNOWNal+	}e+	36,) { 0;
+}l+e+d tNks8995m_init(ree_ndsnet_devic	s*dev, e;
+phy_addr)@+{
+	r16  v;
;@+	e+//	prd tk("ks8995m_initthc)al+	/* S	opsauto-negotiation */
+	 v;
 = mdio_read(dev, phy_addr, MII_CONTROL);
+	mdio_write(dev, phy_addr, MII_CONTROL,  v;
 & ~MII_CNTL_AUTO);e+e+	/* Set ad 		ti	iment to 10/100 andsHalf/Full duplexe+	 * (full capabilities) */
+	 v;
 = mdio_read(dev, phy_addr, MII_ANADV);l+	dv;
 |= MII_NWAY_TXs| MII_NWAY_TX_FDXs| MII_NWAY_T_FDXs| MII_NWAY_T;
+	mdio_write(dev, phy_addr, MII_ANADV,  v;
);e+	e+	/* R,start auto-negotiation */
+	 v;
 = mdio_read(dev, phy_addr, MII_CONTROL);
+	 v;
 |= MII_CNTL_RST_AUTO | MII_CNTL_AUTO;
+	mdio_write(dev, phy_addr, MII_CONTROL,  v;
)al+e+	 	 (au1000_debug > 4) dump_mii(dev, phy_addr);
+e+	36,) { 0;
+}l+e+d tNks8995m_recet(ree_ndsnet_devic	s*dev, e;
+phy_addr)@+{
+	r16 mii_control, time
+};@+	e+//	prd tk("ks8995m_recetthc)al+	mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
+	mdio_write(dev, phy_addr, MII_CONTROL, mii_control | MII_CNTL_RESET);
+	mdelay(1)al+	eor (time
+}f= 100; time
+}f>O0  --time
+}) {
+		mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
+		i	 ((mii_control & MII_CNTL_RESET)r== 0)
+			break;@+		mdelay(1)al+	}e+	i	 (mii_control & MII_CNTL_RESET)r{
+		prd tk(KERN_ERR "%ssPHY recet time
+}f!thca	dev->n;
R);e+		36,) { -1al+	}e+	36,) { 0;
+}l+e+d tNks8995m_@e 	us(ree_ndsnet_devic	s*dev, e;
+phy_addr, u16 *link, u16 *spefl)@+{
+	u16 mii_ v;
;@+	@
e_ndsau1000_private *aup;e+e+	 	 (!dev) {
+		prd tk(KERN_ERR "ks8995m_@e 	us error: size	devthc)al+		36,) { -1al+	}e+	aup = (ree_ndsau1000_private *)	dev->pr,val+l+	mii_ v;
 = mdio_read(dev, aup->phy_addr, MII_STATUS);
+	i	 (mii_ v;
 & MII_STAT_LINK)r{
+wq*link = 1 
+		mii_ v;
 = mdio_read(dev, aup->phy_addr, MII_AUX_CNTRL);e+		i	 (mii_ v;
 & MII_AUX_100) {
+			i	 (mii_ v;
 & MII_AUX_FDX) {
+				*spefla= IF_PORT_100BASEFX 
+				dev->if_porta= IF_PORT_100BASEFX 
+			}
+			e) { {
+				*spefla= IF_PORT_100BASETX 
+				dev->if_porta= IF_PORT_100BASETX 
+			}
+		}
+		e) {  {											
+			*spefla= IF_PORT_10BASET 
+			dev->if_porta= IF_PORT_10BASET 
+		}e+l+	}l+	e) { {
+		*link = 0;@+		*spefla= 0;@+		dev->if_porta= IF_PORT_UNKNOWNal+	}e+	36,) { 0;
+}l+e+d t
+smsc_83C185_init (ree_ndsnet_devic	s*dev, e;
+phy_addr)@+{
+	r16  v;
;@+e+	i	 (au1000_debug > 4)
+		prd tk("smsc_83C185_initthc)al+e+	/* S	opsauto-negotiation */
+	 v;
 = mdio_read(dev, phy_addr, MII_CONTROL);
+	mdio_write(dev, phy_addr, MII_CONTROL,  v;
 & ~MII_CNTL_AUTO);e+e+	/* Set ad 		ti	iment to 10/100 andsHalf/Full duplexe+	 * (full capabilities) */
+	 v;
 = mdio_read(dev, phy_addr, MII_ANADV);l+	dv;
 |= MII_NWAY_TXs| MII_NWAY_TX_FDXs| MII_NWAY_T_FDXs| MII_NWAY_T;
+	mdio_write(dev, phy_addr, MII_ANADV,  v;
);e+	e+	/* R,start auto-negotiation */
+	 v;
 = mdio_read(dev, phy_addr, MII_CONTROL);
+	 v;
 |= MII_CNTL_RST_AUTO | MII_CNTL_AUTO;
+
+	mdio_write(dev, phy_addr, MII_CONTROL,  v;
)al+e+	 	 (au1000_debug > 4) dump_mii(dev, phy_addr);
+	36,) { 0;
+}l+e+d t
+smsc_83C185_recet (ree_ndsnet_devic	s*dev, e;
+phy_addr)@+{
+	r16 mii_control, time
+};@+	e+	i	 (au1000_debug > 4)
+		prd tk("smsc_83C185_recetthc)al+e+	mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
+	mdio_write(dev, phy_addr, MII_CONTROL, mii_control | MII_CNTL_RESET);
+	mdelay(1)al+	eor (time
+}f= 100; time
+}f>O0  --time
+}) {
+		mii_control = mdio_read(dev, phy_addr, MII_CONTROL);
+		i	 ((mii_control & MII_CNTL_RESET)r== 0)
+			break;@+		mdelay(1)al+	}e+	i	 (mii_control & MII_CNTL_RESET)r{
+		prd tk(KERN_ERR "%ssPHY recet time
+}f!thca	dev->n;
R);e+		36,) { -1al+	}e+	36,) { 0;
+}l+e+d tN
+smsc_83C185_@e 	us (ree_ndsnet_devic	s*dev, e;
+phy_addr, u16 *link, u16 *spefl)@+{
+	u16 mii_ v;
;@+	@
e_ndsau1000_private *aup;e+e+	 	 (!dev) {
+		prd tk(KERN_ERR "smsc_83C185_@e 	us error: size	devthc)al+		36,) { -1al+	}e+l+	aup = (ree_ndsau1000_private *)	dev->pr,val+	mii_ v;
 = mdio_read(dev, aup->phy_addr, MII_STATUS);
+e+	i	 (mii_ v;
 & MII_STAT_LINK)r{
+wq*link = 1 
+		mii_ v;
 = mdio_read(dev, aup->phy_addr, 0x1f);e+		i	 (mii_ v;
 & (1<<3)) {
+			i	 (mii_ v;
 & (1<<4)) {
+				*spefla= IF_PORT_100BASEFX 
+				dev->if_porta= IF_PORT_100BASEFX 
+			}
+			e) { {
+				*spefla= IF_PORT_100BASETX 
+				dev->if_porta= IF_PORT_100BASETX 
+			}
+		}
+		e) { {
+			*spefla= IF_PORT_10BASET 
+			dev->if_porta= IF_PORT_10BASET 
+		}e+	}l+	e) { {
+		*link = 0;@+		*spefla= 0;@+		dev->if_porta= IF_PORT_UNKNOWNal+	}e+	36,) { 0;
+}l+e+
+# 	def CONFIG_MIPS_BOSPORUSe+d tNstub_init(ree_ndsnet_devic	s*dev, e;
+phy_addr)@+{
+	//prd tk("PHY stub_initthc)al+	36,) { 0;
+}l+e+d tNstub_recet(ree_ndsnet_devic	s*dev, e;
+phy_addr)@+{
+	//prd tk("PHY stub_recetthc)al+	36,) { 0;
+}l+e+d tN
+stub_@e 	us(ree_ndsnet_devic	s*dev, e;
+phy_addr, u16 *link, u16 *spefl)@+{
+	//prd tk("PHY stub_@e 	usthc)al+	*link = 1 
+	/* hmmm, revisit */
+	*spefla= IF_PORT_100BASEFX 
+	dev->if_porta= IF_PORT_100BASEFX 
+	36,) { 0;
+}l+#endifl+
 @
e_ndsphy_ops+bcm_5201_ops+= {
 ybcm_5201_init,
 ybcm_5201_recet,
 ybcm_5201_@
 	us,l };
 e+@
e_ndsphy_ops+am79c874_ops+= {
+	am79c874_init,
+	am79c874_recet,
+	am79c874_@
 	us,l+}al+e @
e_ndsphy_ops+am79c901_ops+= {
 yam79c901_init,
 yam79c901_recet,
@@ -355,26 +749,89 @@
 	lsi_80227_@
 	us,l };
 e+@
e_ndsphy_ops+lxt971a_ops+= { 
+	lxt971a_init,
+	lxt971a_recet,
+	lxt971a_@e 	us,
+}al+e+@
e_ndsphy_ops+ks8995m_ops+= {
+	ks8995m_init,
+	ks8995m_recet,
+	ks8995m_@e 	us,
+}al+e+@
e_ndsphy_ops+smsc_83C185_ops+= {
+	smsc_83C185_init,
+	smsc_83C185_recet,
+	smsc_83C185_@e 	us,
+}al+e+# 	def CONFIG_MIPS_BOSPORUSe+@
e_ndsphy_ops+stub_ops+= {
+	stub_init,
+	stub_recet,
+	stub_@e 	us,
+}al+#endifl+
 @
 	voi@
e_ndsmii_chip_info {
 	c nst char * n;
Ral yu16 phy_id0al yu16 phy_id1;@ 	ree_ndsphy_ops+*phy_ops;	e+	i;
+dual_phy;
 }smii_chip_table[]s=_{l-	{"Broadcom BCM5201 10/100 B+	iTsPHYca	 0x0040, 0x6212, &bcm_5201_ops+},l-	{"AMD 79C901 HomePNAsPHYca	 0x0000, 0x35c8, &am79c901_ops+},l-	{"LSI 80227 10/100 B+	iTsPHYca	0x0016, 0xf840, &lsi_80227_ops+},l-	{"Broadcom BCM5221 10/100 B+	iTsPHYca	 0x0040, 0x61e4, &bcm_5201_ops+},l+	{"Broadcom BCM5201 10/100 B+	iTsPHYca0x0040,0x6212, &bcm_5201_ops,0},l+	{"Broadcom BCM5221 10/100 B+	iTsPHYca0x0040,0x61e4, &bcm_5201_ops,0},l+	{"Broadcom BCM5222 10/100 B+	iTsPHYca0x0040,0x6322, &bcm_5201_ops,1},l+	{"AMD 79C901 HomePNAsPHYca0x0000,0x35c8, &am79c901_ops,0},l+	{"AMD 79C874 10/100 B+	iTsPHYca0x0022,0x561b, &am79c874_ops,0},l+	{"LSI 80227 10/100 B+	iTsPHYca0x0016,0xf840, &lsi_80227_ops,0},l+	{"Intel LXT971A Dual SpeflaPHYca0x0013a0x78e2, &lxt971a_ops,0},l+	{"Kendin KS8995M 10/100 B+	iTsPHYca0x0022,0x1450, &ks8995m_ops,0},l+	{"SMSC LAN83C185 10/100 B+	iTsPHYca0x0007a0xc0a3, &smsc_83C185_ops,0},l+# 	def CONFIG_MIPS_BOSPORUSe+	{"Stubca	0x1234a	0x5678, &stub_ops+},l+#endifl 	{0,},l };
 e @
 	void tNmdio_read(ree_ndsnet_devic	s*dev, e;
+phy_id, e;
+reg)@ @@ 	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)	dev->pr,val+	vol 	vle l32 *mii_control_regal+	vol 	vle l32 *mii_ v;
_regal yu32 timed
+}f= 20al yu32 mii_control;e 
-	while (aup->mac->mii_control & MAC_MII_BUSY) {
+	# 	def CONFIG_BCM5222_DUAL_PHY
+	/* Firststime we probe, et's eor t 	smac0+phy.e+	 * Since we haze['ba)etermi flayet t a
fwe hazeea dual+phy,e+	 * aup->mii->mii_control_reg wo['babe setup andswe'lle+	 * default to t 	se) { @
 	iment.e+	 * By t 	stime we probe eor t 	smac1+phy, t 	smii_control_rege+	 * will+be setup to be t 	saddress(of t 	smac0+phy control sincee+	 * both+phys(act controlled t roughsmac0.e+	 */
+	i	 (aup->mii && aup->mii->mii_control_reg) {
+		mii_control_reg = aup->mii->mii_control_reg 
+		mii_ v;
_reg = aup->mii->mii_ v;
_regal+	}l+	e) { i	 (au_macs[0]->mii && au_macs[0]->mii->mii_control_reg) {
+		/* assume both+phys(act controlled t roughsmac0 */
+		mii_control_reg = au_macs[0]->mii->mii_control_reg 
+		mii_ v;
_reg = au_macs[0]->mii->mii_ v;
_regal+	}l+	e) { 
+	#endifl+	{
+		/* default control ands v;
 reg addresses(*/
+		mii_control_reg = &aup->mac->mii_control 
+		mii_ v;
_reg = &aup->mac->mii_ v;
;@+	}e+l+	while (*mii_control_reg & MAC_MII_BUSY) {
 		mdelay(1)al 		 	 (--timed
+}f== 0) {
 y		prd tk(KERN_ERR "%s: read_MIIsbusy time
+}!!thca	
@@ -386,10 +843,10 @@
 	mii_control = MAC_SET_MII_SELECT_REG(reg) | 
 		MAC_SET_MII_SELECT_PHY(phy_id) | MAC_MII_READ;l 
-	aup->mac->mii_control = mii_control 
+	*mii_control_reg = mii_control;e 
 	timed
+}f= 20al-	while (aup->mac->mii_control & MAC_MII_BUSY) {
+	while (*mii_control_reg & MAC_MII_BUSY) {
 		mdelay(1)al 		 	 (--timed
+}f== 0) {
 y		prd tk(KERN_ERR "%s: mdio_readsbusy time
+}!!thca	
@@ -397,16 +854,36 @@
 			36,) { -1al 		}l 	}l-	36,) { (e;
)aup->mac->mii_ v;
;@+	36,) { (e;
)*mii_ v;
_regal }
 e @
 	voiv. INmdio_write(ree_ndsnet_devic	s*dev, e;
+phy_id, e;
+reg, u16 value)@ @@ 	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)	dev->pr,val+	vol 	vle l32 *mii_control_regal+	vol 	vle l32 *mii_ v;
_regal yu32 timed
+}f= 20al yu32 mii_control;e 
-	while (aup->mac->mii_control & MAC_MII_BUSY) {
+	# 	def CONFIG_BCM5222_DUAL_PHY
+	i	 (aup->mii && aup->mii->mii_control_reg) {
+		mii_control_reg = aup->mii->mii_control_reg 
+		mii_ v;
_reg = aup->mii->mii_ v;
_regal+	}l+	e) { i	 (au_macs[0]->mii && au_macs[0]->mii->mii_control_reg) {
+		/* assume both+phys(act controlled t roughsmac0 */
+		mii_control_reg = au_macs[0]->mii->mii_control_reg 
+		mii_ v;
_reg = au_macs[0]->mii->mii_ v;
_regal+	}l+	e) { 
+	#endifl+	{
+		/* default control ands v;
 reg addresses(*/
+		mii_control_reg = &aup->mac->mii_control 
+		mii_ v;
_reg = &aup->mac->mii_ v;
;@+	}e+l+	while (*mii_control_reg & MAC_MII_BUSY) {
 		mdelay(1)al 		 	 (--timed
+}f== 0) {
 y		prd tk(KERN_ERR "%s: mdio_writesbusy time
+}!!thca	
@@ -418,8 +895,8 @@
 	mii_control = MAC_SET_MII_SELECT_REG(reg) | 
 		MAC_SET_MII_SELECT_PHY(phy_id) | MAC_MII_WRITE;l 
-	aup->mac->mii_ v;
 = value;
-	aup->mac->mii_control = mii_control 
+	*mii_ v;
_reg = value;
+	*mii_control_reg = mii_control;e }
 e 
@@ -437,12 +914,13 @@
 y}e }
 
-@
 	void tN__initNmii_probe (ree_ndsnet_devic	s* dev)l+@
 	void tNmii_probe (ree_ndsnet_devic	s* dev)l @@ 	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)	dev->pr,val yd t phy_addr;e-
-	aup->mii = size;l+# 	def CONFIG_MIPS_BOSPORUSe+	d t phy_eound=0al+#endifl l 	/* search eor total of 32 possible mii phy addresses(*/
 	eor (phy_addr =O0  phy_addr < 32  phy_addr++) {
@@ -450,9 +928,17 @@
 		u16 phy_id0, phy_id1;@ 		d t i;e 
+		# 	def CONFIG_BCM5222_DUAL_PHY
+		/* Maskst 	salready eound+phy, tryrnext oca_*/
+		i	 (au_macs[0]->mii && au_macs[0]->mii->mii_control_reg) {
+			i	 (au_macs[0]->phy_addr ==+phy_addr)@+				continue;
+		}
+		#endifl+
 		mii_re 	us =Omdio_read(dev, phy_addr, MII_STATUS);
 		i	 (mii_re 	us == 0xffff || mii_re 	us == 0x0000)
-			/* t 	smii(is+not accessible, tryrnext oca_*/
+			/* t 	smii(is+not accessable, tryrnext oca_*/
 			continue;
 
 		phy_id0 =Omdio_read(dev, phy_addr, MII_PHY_ID0);
@@ -462,6 +948,66 @@
 		eor (i =O0  mii_chip_table[i].phy_id1; i++) {
 y		 	 (phy_id0 == mii_chip_table[i].phy_id0 &&
 			    phy_id1 == mii_chip_table[i].phy_id1) {
+				@
e_ndsmii_phy *smii_phy = aup->mii;
+e+				prd tk(KERN_INFO "%s: %s at phy address %dthca
+				       dev->n;
R, mii_chip_table[i].n;
R, 
+				       phy_addr);
+# 	def CONFIG_MIPS_BOSPORUSe+				phy_eound+= 1 
+#endifl+				mii_phy->chip_info = mii_chip_table+i 
+				aup->phy_addr = phy_addr;e+				aup->want_autoneg = 1 
+				aup->phy_ops+= mii_chip_table[i].phy_ops;
+				aup->phy_ops->phy_init(dev,phy_addr);
+e+				// Check eor dual-phy andst 	n @
oreerequired e+				// values(andscet indica
ors. Werneed to do e+				// t i  now sinceOmdio_{read,write}rneed the e+				// control ands v;
 register addresses.e+				# 	def CONFIG_BCM5222_DUAL_PHY
+				 	 ( mii_chip_table[i].dual_phy) {
+
+					/* assume both+phys(act controlled 
+					 * t roughsMAC0. BoarI specific?_*/
+					
+					/* sanity check */
+					 	 (!au_macs[0] || !au_macs[0]->mii)@+						36,) { -1al+					aup->mii->mii_control_reg = (l32 *)@+						&au_macs[0]->mac->mii_control 
+					aup->mii->mii_ v;
_reg = (l32 *)@+						&au_macs[0]->mac->mii_ v;
;@+				}
+				#endifl+				goto found 
+			}
+		}
+	}
+found:l+e+# 	def CONFIG_MIPS_BOSPORUSe+	/* T is(is+a workaround+eor t 	sMicrel/Kendin 5+port switche+	   T e secondsMAC does['baseeea PHY connected... so we need toe+	   trick it into t inking_we hazeeoTe.
+		
+	   If t i  kernel(is+runaonsanother Au1500 development boarIe+	   t e stub will+be eound+as_well+asst 	sactual+PHY. However,e+	   t e last eound+PHY will+be usfl... usually at Addr 31 (Db1500).	
+	*/
+	i	 ( (!phy_eound) )l+	{
+		u16 phy_id0, phy_id1;@+		d t i;e+
+		phy_id0 =O0x1234;
+		phy_id1 =O0x5678;e+
+		/* search oursmii(table+eor t 	scurre tNmii */ 
+		eor (i =O0  mii_chip_table[i].phy_id1; i++) {
+y		 	 (phy_id0 == mii_chip_table[i].phy_id0 &&
+			    phy_id1 == mii_chip_table[i].phy_id1) {
 				@
e_ndsmii_phy *smii_phy;
 
 				prd tk(KERN_INFO "%s: %s at phy address %dthca
@@ -471,31 +1017,39 @@
 						GFP_KERNEL)al 				i	 (mii_phy) {
 					mii_phy->chip_info = mii_chip_table+i 
-					mii_phy->phy_addr = phy_addr;e+					aup->phy_addr = phy_addr;e 					mii_phy->next = aup->mii;
 					aup->phy_ops+= 
 						mii_chip_table[i].phy_ops;
 					aup->mii = mii_phy;
 					aup->phy_ops->phy_init(dev,phy_addr);
 				} e) { {
-					prd tk(KERN_ERR "%s: 
+}fof memorythca
+					prd tk(KERN_ERR "%s: 
+}fof memorythca 
 							dev->n;
R);e 					36,) { -1al 				}l-				/* t 	scurre tNmii is+onsoursmii_info_table,l-				   tryrnext address */
+				mii_phy->chip_info = mii_chip_table+i 
+				aup->phy_addr = phy_addr;e+				aup->phy_ops+= mii_chip_table[i].phy_ops;
+				aup->phy_ops->phy_init(dev,phy_addr);
 				break;@ 			}
 		}l 	}l+	i	 (aup->mac_ IN== 0) {
+		/* t 	sBosporus phy responds to addresses(0-5abut 
+		N* 5+isst 	scorrendsoTe.
+		 */
+		aup->phy_addr = 5;@+	}e+#endifl l-	i	 (aup->mii == size) {
-		prd tk(KERN_ERR "%s: No MIIs
ransceivers eound!thca	dev->n;
R);e+	i	 (aup->mii->chip_info == size) {
+		prd tk(KERN_ERR "%s: Au1x No MIIs
ransceivers eound!thca
+				dev->n;
R);e 		36,) { -1al 	}l 
-	/* usf last PHY */
-	aup->phy_addr = aup->mii->phy_addr;e 	prd tk(KERN_INFO "%s: Using_%s as defaultthca 
 			dev->n;
R, aup->mii->chip_info->n;
R);e e@@ -516,7 +1070,6 @@
 	 	 (pDB) {
 		aup->pDBfree = pDB->pnext;l 	}l-	//prd tk("GetFreeDB: %xthca pDB);
 y36,) { pDB;
 }
 
@@ -528,35 +1081,6 @@
 	aup->pDBfree = pDB;e }
 
-e-/*
-  DMA memory allocation,fderiveds_5hc pci_alloc_consistent.e-  However, t 	sAu1000s v;
 cache+isscohere tN(w 	n programmede-  so), t 	reforeeweere,) { KSEG0 address,+not KSEG1.e-*/
-@
 	voiv. I *dma_alloc(s =
_t s =
, dma_addr_t * dma_handle)
-{
-	v. I *ret;l-	 ;
+gfp = GFP_ATOMIC | GFP_DMAal-e-	36, =_(vo I *) __get_free_pages(gfp,Nget_order(s =
));e-
-	 	 (36, != size) {
-		memcet(36,, 0, s =
) 
-		*dma_handle = virt_to_bus(ret);
-		36,s=_(vo I *)KSEG0ADDR(ret);
-	}l-	36,) { ret;l-}l-@-e-@
 	voiv. I dma_free(v. I *vaddr, s =
_t s =
)
-{
-	vaddr =_(vo I *)KSEG0ADDR(vaddr);
-	free_pages((lock, flaloTY) vaddr, get_order(s =
));e-}l-@-e @
 	voiv. I enable_rx_tx(ree_ndsnet_devic	s*dev)l @@ 	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)	dev->pr,val@@ -582,6 +1106,7 @@
 
 @
 	voiv. I recet_mac(ree_ndsnet_devic	s*dev)l @@+	d t i;e yu32 flags;@ 	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)	dev->pr,val e@@ -590,13 +1115,32 @@
 				dev->n;
R, (lock, fl)aup)al 
 yspin_lock_irqsaze(&aup->lock, flags)al-	del_timer(&aup->timer);l+	i	 (aup->timer.function == &au1000_timer) {/* check i	 timer initteda*/
+		del_timer(&aup->timer);l+	}l+
 	hard_s	op(dev)al-	*aup->enable = MAC_EN_CLOCK_ENABLE;
-	au_sync_delay(2)al-       	*aup->enable = 0;
-	au_sync_delay(2)al+	# 	def CONFIG_BCM5222_DUAL_PHY
+	i	 (aup->mac_ IN!= 0) {
+	#endifl+		/* If BCM5222,eweeca['baleazeeMAC0 		 recet becausf t 	n 
+		N* weeca['baaccess t 	sdual+phy+eor ETH1a*/
+		*aup->enable = MAC_EN_CLOCK_ENABLE;
+		au_sync_delay(2)al+		*aup->enable = 0;
+		au_sync_delay(2)al+	# 	def CONFIG_BCM5222_DUAL_PHY
+	}
+	#endifl 	aup->tx_full = 0;
+	eor (i =O0  i < NUM_RX_DMAa i++) {
+y	/* r,set control bi	s */l+		aup->rx_dma_ring[i]->buff_re 	 &= ~0xfal+	}l+	eor (i =O0  i < NUM_TX_DMAa i++) {
+y	/* r,set control bi	s */l+		aup->tx_dma_ring[i]->buff_re 	 &= ~0xfal+	}l yspin_unlock_irqr,store(&aup->lock, flags)al }
 
@@ -611,93 +1155,348 @@
 @@ 	d t i;e 
-	eor (i=0  i<NUM_RX_DMAa i++) {
+yeor (i =O0  i < NUM_RX_DMAa i++) {
 		aup->rx_dma_ring[i]+= 
 			(vol 	vle rx_dma_t *) (3x_b+	ir+ s =
of(rx_dma_t)*i);l 	}l-	eor (i=0  i<NUM_TX_DMAa i++) {
+yeor (i =O0  i < NUM_TX_DMAa i++) {
 		aup->tx_dma_ring[i]+= 
 			(vol 	vle tx_dma_t *) (tx_b+	ir+ s =
of(tx_dma_t)*i);l 	}l }
 
+@
 	voisee_nds@@+	d t portal+yu32 b+	i_addral+yu32 macen_addral+y ;
+irqal+	@
e_ndsnet_devic	s*dev;
+} iflist[2]al+e+@
 	voi ;
+num_ifsal+e+/*a+ * Setup t 	sb+	i address(andsin e_upt+of t 	sAu1xxx ethernet macs
+ * b+	ilaonscpu type andswhether t 	sin e_faci issenabled 		 sys_pinfunc
+ * register. T e last in e_faci issenabled 	f SYS_PF_NI2 (bit 4) iss0.l+ */e @
 	void tN__initNau1000_i;i
_module(v. I)
 {
-	d t i;e-	d t pr,d;e-	d t b+	i_addr, irqal+	@
e_ndscpuinfo_mips *c = &curre t_cpu_ v;
;@+	 ;
+ni =O(e;
)((au_readl(SYS_PINFUNC) & (u32)(SYS_PF_NI2)) >> 4)al+	@
e_ndsnet_devic	s*dev;
+	d t i, eound_oca_= 0;
 
-	prdds=_read_c0_prid();
-	for (i=0  i<NUM_INTERFACESa i++) {
-		i	 ( (prdd & 0xffff0000) == 0x00030000 ) {
-			b+	i_addr =Nau1000_iflist[i].portal-			irq =Nau1000_iflist[i].irqal-		} e) { i	 ( (prdd & 0xffff0000) == 0x01030000 ) {
-			b+	i_addr =Nau1500_iflist[i].portal-			irq =Nau1500_iflist[i].irqal-		} e) { i	 ( (prdd & 0xffff0000) == 0x02030000 ) {
-			b+	i_addr =Nau1100_iflist[i].portal-			irq =Nau1100_iflist[i].irqal+	@witch (c->cputype) {
+# 	def CONFIG_SOC_AU1000@+	c+	i CPU_AU1000:e+		num_ifsf= 2 -+ni;e+		i	list[0].b+	i_addr =NAU1000_ETH0_BASE;e+		i	list[1].b+	i_addr =NAU1000_ETH1_BASE;e+		i	list[0].macen_addr =NAU1000_MAC0_ENABLE;
+		i	list[1].macen_addr =NAU1000_MAC1_ENABLE;
+		i	list[0].irq =NAU1000_MAC0_DMA_INT;
+		i	list[1].irq =NAU1000_MAC1_DMA_INT;
+		break;@+#endifl+# 	def CONFIG_SOC_AU1100@+	c+	i CPU_AU1100:e+		num_ifsf= 1 -+ni;e+		i	list[0].b+	i_addr =NAU1100_ETH0_BASE;e+		i	list[0].macen_addr =NAU1100_MAC0_ENABLE;
+		i	list[0].irq =NAU1100_MAC0_DMA_INT;
+		break;@+#endifl+# 	def CONFIG_SOC_AU1500@+	c+	i CPU_AU1500:e+		num_ifsf= 2 -+ni;e+		i	list[0].b+	i_addr =NAU1500_ETH0_BASE;e+		i	list[1].b+	i_addr =NAU1500_ETH1_BASE;e+		i	list[0].macen_addr =NAU1500_MAC0_ENABLE;
+		i	list[1].macen_addr =NAU1500_MAC1_ENABLE;
+		i	list[0].irq =NAU1500_MAC0_DMA_INT;
+		i	list[1].irq =NAU1500_MAC1_DMA_INT;
+		break;@+#endifl+# 	def CONFIG_SOC_AU1550@+	c+	i CPU_AU1550:e+		num_ifsf= 2 -+ni;e+		i	list[0].b+	i_addr =NAU1550_ETH0_BASE;e+		i	list[1].b+	i_addr =NAU1550_ETH1_BASE;e+		i	list[0].macen_addr =NAU1550_MAC0_ENABLE;
+		i	list[1].macen_addr =NAU1550_MAC1_ENABLE;
+		i	list[0].irq =NAU1550_MAC0_DMA_INT;
+		i	list[1].irq =NAU1550_MAC1_DMA_INT;
+		break;@+#endifl+	default:e+		num_ifsf= 0al+	}l+	eor(i =O0  i < num_ifsa i++) {
+y	dev =Nau1000_probe(iflist[i].b+	i_addr, iflist[i].irq, i);
+		i	list[i].dev =Ndev;
+		i	 (dev)l+			eound_oca++al+	}e+	i	 (!eound_oca)l+		36,) { -ENODEVal+	36,) { 0;
+}l+e+@
 	void tNau1000_setup_aneg(ree_ndsnet_devic	s*dev, u32 ad 		ti	i)@+{
+	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)dev->pr,val+	u16 ctl, ad ;e+e+	/* Setup @
 ndarI ad 		ti	i */
+	ad  = mdio_read(dev, aup->phy_addr, MII_ADVERTISE);
+	ad  &= ~(ADVERTISE_ALL | ADVERTISE_100BASE4);l+	i	 (ad 		ti	i & ADVERTISED_10b+	iT_Half)l+		ad  |= ADVERTISE_10HALF;l+	i	 (ad 		ti	i & ADVERTISED_10b+	iT_Full)l+		ad  |= ADVERTISE_10Fize;l+	i	 (ad 		ti	i & ADVERTISED_100b+	iT_Half)l+		ad  |= ADVERTISE_100HALF;l+	i	 (ad 		ti	i & ADVERTISED_100b+	iT_Full)l+		ad  |= ADVERTISE_100Fize;l+	mdio_write(dev, aup->phy_addr, MII_ADVERTISE, ad )al+e+	/* S	art/R,start aneg */
+	ctl = mdio_read(dev, aup->phy_addr, MII_BMCR)al+	ctl |= (BMCR_ANENABLE | BMCR_ANRESTART);l+	mdio_write(dev, aup->phy_addr, MII_BMCR, ctl);
+e+	36,) { 0;
+}l+e+@
 	void tNau1000_setup_eorced(ree_ndsnet_devic	s*dev, e;
+spefl, e;
+fd)@+{
+	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)dev->pr,val+	u16 ctl;
+e+	ctl = mdio_read(dev, aup->phy_addr, MII_BMCR)al+	ctl &= ~(BMCR_FizeDPLX | BMCR_SPEED100 | BMCR_ANENABLE)al+e+	/* Firstsrecet t 	sPHY */
+	mdio_write(dev, aup->phy_addr, MII_BMCR, ctl | BMCR_RESET);
+e+	/* Selendsspefla& duplex */
+	@witch (spefl) {
+y	c+	i SPEED_10:
+			break;@+		c+	i SPEED_100:
+			ctl |= BMCR_SPEED100;
+			break;@+		c+	i SPEED_1000:
+		default:e+			36,) { -EINVALal+	}e+	i	 (fIN== DUPLEX_Fize)l+		ctl |= BMCR_FizeDPLX;l+	mdio_write(dev, aup->phy_addr, MII_BMCR, ctl);
+e+	36,) { 0;
+}l+e+e+@
 	voiv. I
+au1000_start_link(ree_ndsnet_devic	s*dev, @
e_ndsethtool_cmd *cmd)@+{
+	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)dev->pr,val+	u32 ad 		ti	i;
+	d t autoneg;
+	d t eorced_spefl;
+	d t eorced_duplex;
+e+	/* Default ad 		ti	i */
+	ad 		ti	i =sGENMII_DEFAULT_ADVERTISE;
+	autoneg = aup->want_autoneg;
+	eorced_spefl = SPEED_100;
+	eorced_duplex = DUPLEX_Fize;e+e+	/* Setup link parameters */
+	i	 (cmd) {
+y	i	 (cmd->autoneg ==NAUTONEG_ENABLE) {
+y		ad 		ti	i =scmd->ad 		ti	ing 
+			autoneg = 1 
 		} e) { {
-			prd tk(KERN_ERR "au1000seth: unknowh Processor IDthc)al-			36,) { -ENODEVal-		}l-		// check eor val I entries,(au1100 only has oca_entry
-		i	 (b+	i_addr && irq) {
-			i	 (au1000_probe1(b+	i_addr, irq, i)N!= 0)l-				36,) { -ENODEVal+			autoneg = 0;
+e+			eorced_spefl = cmd->spefl;
+			eorced_duplex = cmd->duplex;
 		}l 	}l+e+	/* Co-figur	sPHY & start aneg */
+	aup->want_autoneg = autoneg;
+	d	 (autoneg)l+		au1000_setup_aneg(dev, ad 		ti	i);l+	e) {l+		au1000_setup_eorced(dev, eorced_spefl, eorced_duplex);l+	mod_timer(&aup->timer, jiffies + HZ);
+}l+e+@
 	void tNau1000_get_settings(ree_ndsnet_devic	s*dev, @
e_ndsethtool_cmd *cmd)@+{
+	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)dev->pr,val+	u16 link, spefl;
+l+	cmd->supportfl = GENMII_DEFAULT_FEATURES;l+	cmd->ad 		ti	ing =sGENMII_DEFAULT_ADVERTISE;
+	cmd->porta= PORT_MII;
+	cmd->
ransceivera= XCVR_EXTERNALal+	cmd->phy_address(= aup->phy_addral+	@pin_lock_irq(&aup->lock);l+	cmd->autoneg = aup->want_autoneg;
+	aup->phy_ops->phy_@e 	us(dev, aup->phy_addr, &link, &spefl);
+	d	 ((spefl == IF_PORT_100BASETX) || (spefl == IF_PORT_100BASEFX))l+		cmd->spefl = SPEED_100;
+	e) { i	 (spefl == IF_PORT_10BASET)l+		cmd->spefl = SPEED_10;
+	d	 (link && (dev->if_porta== IF_PORT_100BASEFX))l+		cmd->duplex = DUPLEX_Fize;e+	e) {l+		cmd->duplex = DUPLEX_HALF;l+	spin_unlock_irq(&aup->lock);l 	36,) { 0;
 }
 
-@
 	void tN__init
-au1000_probe1(loTY ioaddr,ae;
+irqa+e;
+port_num)e+@
 	void tNau1000_set_settings(ree_ndsnet_devic	s*dev, @
e_ndsethtool_cmd *cmd)@+{
+	 ree_ndsau1000_private *aup = (ree_ndsau1000_private *)dev->pr,val+	  lock, flaloTY fe 	ures = GENMII_DEFAULT_FEATURES;l+l+	 i	 (!capable(CAP_NET_ADMIN))l+		 36,) { -EPERM;l+l+	 i	 (cmd->autoneg !=NAUTONEG_ENABLE && cmd->autoneg !=NAUTONEG_DISABLE)l+		 36,) { -EINVALal+	 i	 (cmd->autoneg ==NAUTONEG_ENABLE && cmd->ad 		ti	ing == 0)
+		 36,) { -EINVALal+	 i	 (cmd->duplex != DUPLEX_HALF && cmd->duplex != DUPLEX_Fize)l+		 36,) { -EINVALal+	 i	 (cmd->autoneg ==NAUTONEG_DISABLE)l+		 @witch (cmd->spefl) {
+y	 c+	i SPEED_10:
+			 i	 (cmd->duplex == DUPLEX_HALF &&
+				 (fe 	ures & SUPPORTED_10b+	iT_Half)r== 0)
+				 36,) { -EINVALal+			 i	 (cmd->duplex == DUPLEX_Fize &&
+				 (fe 	ures & SUPPORTED_10b+	iT_Full)r== 0)
+				 36,) { -EINVALal+			 break;@+		 c+	i SPEED_100:
+			 i	 (cmd->duplex == DUPLEX_HALF &&
+				 (fe 	ures & SUPPORTED_100b+	iT_Half)r== 0)
+				 36,) { -EINVALal+			 i	 (cmd->duplex == DUPLEX_Fize &&
+				 (fe 	ures & SUPPORTED_100b+	iT_Full)r== 0)
+				 36,) { -EINVALal+			 break;@+		 default:e+			 36,) { -EINVALal+		 }e+	 e) { i	 ((fe 	ures & SUPPORTED_Autoneg) == 0)
+		 36,) { -EINVALal+
+	 rpin_lock_irq(&aup->lock);l+	 au1000_start_link(dev, cmd);
+	 rpin_unlock_irq(&aup->lock);l+	 36,) { 0;
+}l+e+@
 	void tNau1000_nway_recet(ree_ndsnet_devic	s*dev)@+{
+	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)dev->pr,val+e+	i	 (!aup->want_autoneg)l+		36,) { -EINVALal+	rpin_lock_irq(&aup->lock);l+	au1000_start_link(dev, size);l+	spin_unlock_irq(&aup->lock);l+	36,) { 0;
+}l+e+@
 	voiv. I
+au1000_get_drvinfo(ree_ndsnet_devic	s*dev, @
e_ndsethtool_drvinfo *info)@+{
+	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)dev->pr,val+e+	reecpy(info->driver,aDRV_NAME)al+	@
ecpy(info-> 		s on,aDRV_VERSION);
+	dnfo->fw_ 		s on[0]+= '\0';l+	sprd tf(info->bus_info, "%ss%d",aDRV_NAME, aup->mac_ I);
+	dnfo->regdump_len = 0;
+}l+e+@
 	voiu32 au1000_get_link(ree_ndsnet_devic	s*dev)@+{
+	36,) { netif_carrier_ok(dev)al+}l+e+@
 	voi@
e_ndsethtool_ops+au1000_ethtool_ops+= {
+	.get_settings =Nau1000_get_settingsa
+	.set_settings =Nau1000_set_settingsa
+	.get_drvinfo =Nau1000_get_drvinfoa
+	.nway_recet =Nau1000_nway_receta
+	.get_link = au1000_get_link
+}al+e+@
 	voi@
e_ndsnet_devic	s*
+au1000_probe(u32 ioaddr,ae;
+irqa+e;
+port_num)e {
-	@
e_ndsnet_devic	s*dev;
 	re 	voiuock, fla 		s on_prd tfla= 0;@ 	ree_ndsau1000_private *aup = size;l-	d t i, 36,valf= 0al+	@
e_ndsnet_devic	s*dev = size;l 	db_dest_t *pDB, *pDBfree;l 	char *pmac, *argptr;l 	char ethaddr[6];
+	d t i, err;l l-	i	 (!request_region(PHYSADDR(ioaddr), MAC_IOSIZE, "Au1000sENET"))l-		 36,) { -ENODEVal+	i	 (!request_mem_region(CPHYSADDR(ioaddr), MAC_IOSIZE, "Au1x00sENET"))l+		36,) { size;l l-	i	 ( 		s on_prd tfl++ == 0)
-		prd tk( 		s on)al-e-	36,valf= -ENOMEMal+	i	 ( 		s on_prd tfl++ == 0) 
+		prd tk("%ss 		s on_%s %sthca DRV_NAME, DRV_VERSION, DRV_AUTHOR)al 
 ydev =Nalloc_etherdev(s =
of(ree_ndsau1000_private));
 	i	 (!dev) {
 		prd tk (KERN_ERR "au1000seth: alloc_etherdev failedthc)a  l-		goto 
+};@+		36,) { size;l 	}l 
-	SET_MODULE_OWNER(dev)al+	d	 ((errs=_register_netdev(dev))) {
+		prd tk(KERN_ERR "Au1x_eth Cannot register net devic	serrs%dthca
+				err);
+		free_netdev(dev);@+		36,) { size;l+	}l 
-	prd tk("%s:sAu1xxx ethernet eound+at 0x%lx, irqs%dthca 
-	       dev->n;
R, ioaddr,aerq);@+	prd tk("%s:sAu1x Ethernet eound+at 0x%x, irqs%dthca 
+			dev->n;
R, ioaddr,aerq);@ l 	aup =Ndev->pr,val e 	/* Allocate t 	s v;
 buffers */
-	aup->vaddr =_(u32)dma_alloc(MAX_BUF_SIZE * l-			(NUM_TX_BUFFS+NUM_RX_BUFFS), &aup->dma_addr)al-	i	 (!aup->vaddr)l-		goto 
+}1 
+	/* Snooping_works fine with ethaonsall+au1xxx */
+	aup->vaddr =_(u32)dma_alloc_noncohere t(sizea
+			MAX_BUF_SIZE * (NUM_TX_BUFFS+NUM_RX_BUFFS),
+			&aup->dma_addr,
+			0)al+	 	 (!aup->vaddr) {
+		free_netdev(dev);@+		36le+	i_mem_region(CPHYSADDR(ioaddr), MAC_IOSIZE);@+		36,) { size;l+	}l 
 	/* aup->mac+isst 	sb+	i address(of t 	sMAC's registers(*/
 	aup->mac+=_(vol 	vle mac_reg_t *)((lock, flaloTY)ioaddr);
 	/* Setup @ome variables eor quick register addressaaccess */
-	@witch (ioaddr) {
-	c+	i AU1000_ETH0_BASE:
-	c+	i AU1500_ETH0_BASE:
+	 	 (ioaddr == i	list[0].b+	i_addr)l+	{
 y	/* check env variables eirsts*/
 		 	 (!get_ethernet_addr(ethaddr)) { l-			memcpy(au1000_mac_addr,aethaddr, s =
of(dev->dev_addr));@+			memcpy(au1000_mac_addr,aethaddr, s =
of(au1000_mac_addr));
 		} e) { {
 			/* Check commandslica_*/
 			argptr = prom_getcmdlica();
@@ -708,38 +1507,32 @@
 			} e) { {
 				@
e2eaddr(ethaddr, pmacr+ strlen("ethaddr="));
 				memcpy(au1000_mac_addr,aethaddr, 
-						s =
of(dev->dev_addr));@+						s =
of(au1000_mac_addr));
 			}
 		}l-		i	 (ioaddr == AU1000_ETH0_BASE)l-			aup->enable = (vol 	vle l32 *) 
-				((lock, flaloTY)AU1000_MAC0_ENABLE)al-		e) {l 			aup->enable = (vol 	vle l32 *) 
-				((lock, flaloTY)AU1500_MAC0_ENABLE)al-		memcpy(dev->dev_addr, au1000_mac_addr,as =
of(dev->dev_addr));@+				((lock, flaloTY)i	list[0].macen_addr);@+		memcpy(dev->dev_addr, au1000_mac_addr,as =
of(au1000_mac_addr));
 		setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR)al-			break;@-	c+	i AU1000_ETH1_BASE:
-	c+	i AU1500_ETH1_BASE:
-		i	 (ioaddr == AU1000_ETH1_BASE)l-			aup->enable = (vol 	vle l32 *) 
-				((lock, flaloTY)AU1000_MAC1_ENABLE)al+		aup->mac_ IN= 0;
+		au_macs[0] = aupal+	}l y	e) {l+	 	 (ioaddr == i	list[1].b+	i_addr)l+	{
 y		aup->enable = (vol 	vle l32 *) 
-				((lock, flaloTY)AU1500_MAC1_ENABLE)al-		memcpy(dev->dev_addr, au1000_mac_addr,as =
of(dev->dev_addr));@+				((lock, flaloTY)i	list[1].macen_addr);@+		memcpy(dev->dev_addr, au1000_mac_addr,as =
of(au1000_mac_addr));
 		dev->dev_addr[4] +=O0x10;
 		setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR)al-			break;@-	default:e+		aup->mac_ IN= 1;
+		au_macs[1] = aupal+	}l+	e) {l+	{
 		prd tk(KERN_ERR "%s: bad ioaddrthca	dev->n;
R);e-		break;@-l 	}l 
-	aup->phy_addr = PHY_ADDRESS;@-l 	/* bring t 	s evic	s
+}fof receta otherwi	i probing t 	smiil 	 * will+hang_*/
 	*aup->enable = MAC_EN_CLOCK_ENABLE;
@@ -748,15 +1541,22 @@
 		MAC_EN_RESET2 | MAC_EN_CLOCK_ENABLE;
 	au_sync_delay(2)al e-	36,valf= mii_probe(dev)al-	 	 (36,val)l-		 goto 
+}2;
+	aup->mii = kmalloc(s =
of(ree_ndsmii_phy), GFP_KERNEL)al+	 	 (!aup->mii) {
+		prd tk(KERN_ERR "%s: 
+}fof memorythca dev->n;
R);e+		goto err_
+};@+	}
+	aup->mii->mii_control_reg = 0;
+	aup->mii->mii_ v;
_reg = 0;
+e+	i	 (mii_probe(dev)N!= 0) {
+		goto err_
+};@+	}
 e-	36,valf= -EINVALal 	pDBfree = size;l 	/* setup t 	s v;
 buffer descrip
ors andsattach 
 buffer to each oca_*/
 	pDB = aup->db;
-	for (i=0  i<(NUM_TX_BUFFS+NUM_RX_BUFFS)a i++) {
+yeor (i =O0  i < (NUM_TX_BUFFS+NUM_RX_BUFFS)a i++) {
 		pDB->pnext = pDBfree;l 		pDBfree = pDB;e 		pDB->vaddr =_(u32 *)((lock, fl)aup->vaddr + MAX_BUF_SIZE*i);l@@ -765,15 +1565,19 @@
 y}e 	aup->pDBfree = pDBfree;l 
-	eor (i=0  i<NUM_RX_DMAa i++) {
+yeor (i =O0  i < NUM_RX_DMAa i++) {
 		pDB = GetFreeDB(aup)al-		i	 (!pDB) goto 
+}2;
+		i	 (!pDB) {
+y		goto err_
+};@+		}l y	aup->rx_dma_ring[i]->buff_re 	 = (lock, fl)pDB->dma_addr;l y	aup->rx_db_inuse[i]+= pDB;e 	}l-	eor (i=0  i<NUM_TX_DMAa i++) {
+yeor (i =O0  i < NUM_TX_DMAa i++) {
 		pDB = GetFreeDB(aup)al-		i	 (!pDB) goto 
+}2;
+		i	 (!pDB) {
+y		goto err_
+};@+		}l y	aup->tx_dma_ring[i]->buff_re 	 = (lock, fl)pDB->dma_addr;l y	aup->tx_dma_ring[i]->len = 0;
 y	aup->tx_db_inuse[i]+= pDB;e@@ -788,6 +1592,7 @@
 	dev->get_se 	s =Nau1000_get_se 	s;
 	dev->cet_multic+	t_lis	 = &cet_rx_mode;
 	dev->do_ioctl = &au1000_ioctl;@+	SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
 	dev->cet_co-fig = &au1000_cet_co-fig;
 	dev->tx_time
+}f= au1000_tx_time
+};
 	dev->watchdog_time
f= ETH_TX_TIMEOUT;e@@ -798,23 +1603,32 @@
 	_*/
 	recet_mac(dev)al e-	36,valf= register_netdev(dev)al-	 	 (36,val)l-		goto 
+}2;
-	36,) { 0;
+	36,) { dev;
 
-
+}2:
-	dma_free(aup->vaddr, MAX_BUF_SIZE * (NUM_TX_BUFFS+NUM_RX_BUFFS))al-
+}1:e+err_
+}:
+	/* hereeweeshould hazeea val I dev plus aup-> register addressese+	 * so we cansrecet t 	smacrproperly.*/
+	recet_mac(dev)al+	i	 (aup->mii)l+		kfree(aup->mii);
+	eor (i =O0  i < NUM_RX_DMAa i++) {
+y	i	 (aup->rx_db_inuse[i])
+			R6le+	iDB(aup, aup->rx_db_inuse[i])al+	}l+	eor (i =O0  i < NUM_TX_DMAa i++) {
+y	i	 (aup->tx_db_inuse[i])
+			R6le+	iDB(aup, aup->tx_db_inuse[i])al+	}l+	dma_free_noncohere t(sizea
+			MAX_BUF_SIZE * (NUM_TX_BUFFS+NUM_RX_BUFFS),
+			(vo I *)aup->vaddr,l+			aup->dma_addr)al+	unregister_netdev(dev)al 	free_netdev(dev);@-
+}:
-	36le+	i_region(PHYSADDR(ioaddr), MAC_IOSIZE)al-	prd tk(KERN_ERR "%s: au1000_probe1 failed.  R6,) {s %dthca
-	       dev->n;
R, 36,val);l-	36,) { retval;
+	36le+	i_mem_region(CPHYSADDR(ioaddr), MAC_IOSIZE);@+	36,) { size;l }
 
-e /* 
  * Initial ze t 	sin e_faci.
  *e@@ -832,7 +1646,8 @@
 	u32 control;e 	u16 link, spefl;
 l-	i	 (au1000_debug > 4) prd tk("%s:sau1000_i;i
thca	dev->n;
R);e+	i	 (au1000_debug > 4) 
+		prd tk("%s:sau1000_i;i
thca	dev->n;
R);e 
 yspin_lock_irqsaze(&aup->lock, flags)al 
@@ -852,7 +1667,7 @@
 	aup->mac->mac_addr_low =Ndev->dev_addr[3]<<24 | dev->dev_addr[2]<<16 |
 		dev->dev_addr[1]<<8 | dev->dev_addr[0];e 
-	eor (i=0  i<NUM_RX_DMAa i++) {
+yeor (i =O0  i < NUM_RX_DMAa i++) {
 		aup->rx_dma_ring[i]->buff_re 	 |= RX_DMA_ENABLE;
 	}
 	au_sync();
@@ -865,7 +1680,13 @@
 yd	 (link && (dev->if_porta== IF_PORT_100BASEFX)) {
 		control |= MAC_Fize_DUPLEX;l 	}l+e+	/* fix eor startup with
+}fcable */
+	i	 (!link) 
+		dev->flags &= ~IFF_RUNNINGal+e 	aup->mac->control = control 
+	aup->mac->vlan1_tag = 0x8100; /* activate vlan support(*/
 	au_sync();
 l yspin_unlock_irqr,store(&aup->lock, flags)al@@ -949,6 +1770,7 @@
 		36,) { retval;
 	}l 
+	d it_timer(&aup->timer); /* usfd 		 ioctl()(*/
 	aup->timer.expires = RUN_AT((3*HZ))a 
 	aup->timer. v;
 = (lock, flaloTY)dev;
 	aup->timer.function = &au1000_timer; /* timer handler(*/
@@ -968,22 +1790,49 @@
 yd	 (au1000_debug > 4)
 		prd tk("%s:sclose: dev=%pthca	dev->n;
Ra	dev);e 
+	recet_mac(dev)al+
 yspin_lock_irqsaze(&aup->lock, flags)al 	l 	/* s	opst 	s evic	s*/
-	d	 (netif_ evic	_precent(dev))l-		netif_s	op_queue(dev)al+	netif_s	op_queue(dev)al 
 	/* disable t 	sin e__upt+*/
 	eree_irq(dev->irqa+dev)al 	spin_unlock_irqr,store(&aup->lock, flags)al l-	36cet_mac(dev)al 	36,) { 0;
 }
 
 @
 	voiv. I __exitNau1000_cle+nup_module(v. I)
 {
+	d t i, jal+	@
e_ndsnet_devic	s*dev;
+	@
e_ndsau1000_private *aup;e+e+	eor (i =O0  i < num_ifsa i++) {
+y	dev =Ni	list[i].dev;
+		i	 (dev) {
+y		aup = (ree_ndsau1000_private *)	dev->pr,val+			unregister_netdev(dev)al+			i	 (aup->mii)@+				kfree(aup->mii);
+			eor (j =O0  j < NUM_RX_DMAa j++) {
+y			i	 (aup->rx_db_inuse[j])@+					R6le+	iDB(aup, aup->rx_db_inuse[j]) 
+			}
+			eor (j =O0  j < NUM_TX_DMAa j++) {
+y			i	 (aup->tx_db_inuse[j])@+					R6le+	iDB(aup, aup->tx_db_inuse[j]) 
+			}
+			dma_free_noncohere t(sizea
+					MAX_BUF_SIZE * (NUM_TX_BUFFS+NUM_RX_BUFFS),
+					(vo I *)aup->vaddr,l+					aup->dma_addr)al+			free_netdev(dev);@+			36le+	i_mem_region(CPHYSADDR(iflist[i].b+	i_addr), MAC_IOSIZE);@+		}
+	}
 }
 e 
@@ -1028,9 +1877,8 @@
 	ptxd = aup->tx_dma_ring[aup->tx_tail]al 
 	while (ptxd->buff_re 	 & TX_T_DONE) {
- 		up v;e_tx_se 	s(dev, ptxd->@e 	us, aup->tx_len[aup->tx_tail]  & 0x3ff);e+		up v;e_tx_se 	s(dev, ptxd->@e 	us, ptxd->len & 0x3ff);e 		ptxd->buff_re 	 &= ~TX_T_DONE;
- 		aup->tx_len[aup->tx_tail] = 0;
 y	ptxd->len = 0;
 y	au_sync();
 l@@ -1056,7 +1904,7 @@
 	db_dest_t *pDB;@ 	d t i;e 
-	i	 (au1000_debug > 4)
+	i	 (au1000_debug > 5)
 		prd tk("%s:stx:saup %x len=%d,  v;
=%p, heads%dthca 
 				dev->n;
R, (lock, fl)aup, skb->lena 
 				skb-> v;
, aup->tx_head)al@@ -1070,8 +1918,7 @@
 		36,) { 1al 	}l 	e) { i	 (buff_re 	 & TX_T_DONE) {
- 		up v;e_tx_se 	s(dev, ptxd->@e 	us, aup->tx_len[aup->tx_head] & 0x3ff);e- 		aup->tx_len[aup->tx_head] = 0;
+		up v;e_tx_se 	s(dev, ptxd->@e 	us, ptxd->len & 0x3ff);e 		ptxd->len = 0;
 y}
 l@@ -1082,17 +1929,15 @@
 
 	pDB = aup->tx_db_inuse[aup->tx_head];
 ymemcpy((vo I *)pDB->vaddr, skb-> v;
, skb->len)al-	 	 (skb->len < MAC_MIN_PKT_SIZE) {
-		eor (i=skb->len  i<MAC_MIN_PKT_SIZEa i++) { 
+	i	 (skb->len < ETH_ZLEN) {
+		for (i=skb->len  i<ETH_ZLENa i++) { 
 			((char *)pDB->vaddr)[i]+= 0;
 		}l- 		aup->tx_len[aup->tx_head] = MAC_MIN_PKT_SIZEa
-		ptxd->len = MAC_MIN_PKT_SIZEa
+		ptxd->len = ETH_ZLENae 	}l-	e) { {
- 		aup->tx_len[aup->tx_head] = skb->len l+	e) {l 		ptxd->len = skb->len l-	}l+
 	ptxd->buff_re 	 = pDB->dma_addr | TX_DMA_ENABLE;
 	au_sync();
 	dev_kfree_skb(skb)al@@ -1137,8 +1982,9 @@
 yvol 	vle rx_dma_t *prxd;e yu32 buff_re 	, @e 	us;
 	db_dest_t *pDB;@+	u32	frmlen l 
-	i	 (au1000_debug > 4)
+	i	 (au1000_debug > 5)
 		prd tk("%s:sau1000_rx heads%dthca dev->n;
R, aup->rx_head)al 
 	prxd = aup->rx_dma_ring[aup->rx_head];
@@ -1150,7 +1996,9 @@
 y	i	 (!(re 	us & RX_ERROR))  {
 
 			/* goods_5;
Rs*/
-			skb =Ndev_alloc_skb((re 	us & RX_FRAME_LEN_MASK) + 2)al+			frmlen = (re 	us & RX_FRAME_LEN_MASK)al+			frmlen -= 4; /* Remove FCS */
+			skb =Ndev_alloc_skb(frmlen + 2)al y		 	 (skb == size) {
 				prd tk(KERN_ERR
 				       "%s:sMemory squee=
, dropping_packet.thca
@@ -1160,9 +2008,9 @@
 y		}l y		skb-> ev =Ndev;
 y		skb_recerze(skb, 2)a	/* 16 byte IP header alk, s*/
-			eth_copy_and_sum(skb, (lock, flachar *)pDB->vaddr, 
-					re 	us & RX_FRAME_LEN_MASK, 0)al-			skb_put(skb, re 	us & RX_FRAME_LEN_MASK)al+			eth_copy_and_sum(skb,@+				(lock, flachar *)pDB->vaddr, frmlen, 0)al+			skb_put(skb, frmlen);l y		skb->protocol = eth_type_
rans(skb, dev)al 			netif_rx(skb)a	/* pass t 	spacket to upper layers(*/
 		}l@@ -1206,17 +2054,20 @@
 /*
  * Au1000sin e__upt+cerzic	sroutini.
  */
-irqr,,) {_tNau1000_i; e__upt(e;
+irqa+v. I *dev_id, ree_ndspt_regs *regs)e+@
 	voidrqr,,) {_tNau1000_i; e__upt(e;
+irqa+v. I *dev_id, ree_ndspt_regs *regs)e @@ 	ree_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*)	dev_idal 
 	i	 (dev == size) {
 		prd tk(KERN_ERR "%s: isr: null dev ptrthca	dev->n;
R);e-		36,) { IRQ_NONE;
+		36,) { IRQ_RETVAL(1)al 	}
-	au1000_tx_ack(dev)al+
+	/* Handle RXsin e__upts eirststo minim ze chanceOof overruna*/
+
 	au1000_rx(dev)al-	36,) { IRQ_HANDLED;l+	au1000_tx_ack(dev)al+	36,) { IRQ_RETVAL(1)al }
 e 
@@ -1233,6 +2084,23 @@
 ynetif_wake_queue(dev)al }l 
+e+@
 	voiuock, flac nst ethernet_polynomialf= 0x04c11db7U;e+@
 	void lica_u32 ether_crc(e;
+length, lock, flachar * v;
)@+{
+    e;
+crcf= -1al+
+    while(--length >= 0) {
+		lock, flachar curre t_octet =N* v;
++al+		d t bi};@+		for (bit =O0  bit < 8  bit++, curre t_octet >>= 1)@+			crcf= (crcf<< 1) ^@+				((crcf< 0) ^ (curre t_octet & 1) ? 
+				 ethernet_polynomialf: 0)al+    }l+    36,) { crcal+}l+e @
 	voiv. I cet_rx_mode(ree_ndsnet_devic	s*dev)l @@ 	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)	dev->pr,val@@ -1256,8 +2124,8 @@
 		mc_fil e_[1] = mc_fil e_[0]+= 0;
 		eor (i =O0, mclis	 = dev->mc_lis	; mclis	 && if< dev->mc_countal 			 i++, mclis	 = mclis	->next) {
-			cet_bit(ether_crc_le(ETH_ALEN, mclis	->dmi_addr)>>26, 
-					mc_fil e_)al+			set_bit(ether_crc(ETH_ALEN, mclis	->dmi_addr)>>26, 
+					(loTY *)mc_fil e_)al 		}l y	aup->mac->multi_hash_high = mc_fil e_[1];l y	aup->mac->multi_hash_low =Nmc_fil e_[0]al@@ -1269,28 +2137,28 @@
 
 @
 	void tNau1000_ioctl(ree_ndsnet_devic	s*dev, @
e_ndsifreq *rqa+e;
+cmd)@ {
+	ree_ndsau1000_private *aup = (ree_ndsau1000_private *)dev->pr,val 	u16 * v;
 = (l16 *)&rq->ifr_ifru;l 
-	/* fixma_*/
 	@witch(cmd) { 
-	c+	i SIOCGMIIPHY:	/* Get t 	saddress(of t 	sPHY in usf.s*/
-		 v;
[0]+= PHY_ADDRESS;@-		36,) { 0;
-
-	c+	i SIOCGMIIREG:	/* Readst e specififlaMIIsregister. */
-		// v;
[3] = mdio_read(ioaddr,a v;
[0],a v;
[1])a 
-		36,) { 0;
-
-	c+	i SIOCSMIIREG:	/* Writest e specififlaMIIsregister */
-		i	 (!capable(CAP_NET_ADMIN))l-			36,) { -EPERM;l-
-		//mdio_write(ioaddr,a v;
[0],a v;
[1],a v;
[2]);@-		36,) { 0;
-
-	default:e-		36,) { -EOPNOTSUPP;@+		c+	i SIOCDEVPRIVATE:	/* Get t 	saddress(of t 	sPHY in usf.s*/
+		c+	i SIOCGMIIPHY:
+		        i	 (!netif_running(dev)) 36,) { -EINVALal+			 v;
[0]+= aup->phy_addral+		c+	i SIOCDEVPRIVATE+1:	/* Readst e specififlaMIIsregister. */
+		c+	i SIOCGMIIREG:l+			 v;
[3] =  mdio_read(dev,  v;
[0],a v;
[1])a 
+			36,) { 0al+		c+	i SIOCDEVPRIVATE+2:	/* Writest e specififlaMIIsregister */
+		c+	i SIOCSMIIREG: l+			i	 (!capable(CAP_NET_ADMIN))l+				36,) { -EPERM;l+			mdio_write(dev,  v;
[0],a v;
[1], v;
[2]);@+			36,) { 0al+		default:e+			36,) { -EOPNOTSUPP;@ 	}l+e }
 e 
@@ -1352,7 +2220,6 @@
 			/* set Speed to 100Mbps, Half Duplex */
 			/* disable autosnegotiation andsenable 100MBit Mode_*/
 			control = mdio_read(dev, aup->phy_addr, MII_CONTROL)al-			prd tk("readscontrol %xthca control)al 			control &= ~(MII_CNTL_AUTO | MII_CNTL_FDX)al 			control |= MII_CNTL_F100;
 			mdio_write(dev, aup->phy_addr, MII_CONTROLa control)aldiff -Nru a/drivers/net/au1000_eth.h b/drivers/net/au1000_eth.h
--- a/drivers/net/au1000_eth.h	2003-06-25 14:07:44 -07:00@+++ b/drivers/net/au1000_eth.h	2005-01-27 17:46:47 -08:00@@@ -1,10 +1,13 @@
 /*
- * Alchemy Semi Au1000sethernet driver include_filel+ *
+ * Alchemy Au1x00sethernet driver include_filel  *e  * Author: PetesPopov <ppopov@mvista.com>l  *e  * Copyright 2001 MontaVista Softwact Inc.
  *e+ * ########################################################################l+ *
  *  T is(program+issfree softwact; you cansdistributesitNand/or modifysit
  *  under t 	sterms(of t 	sGNU General+PublvoiLic	n	i (V		s on_2) as
  *  publvshed by t 	sFree Softwact Foundation.@@@ -17,14 +20,16 @@
  *  You should hazeereceived a copy(of t 	sGNU General+PublvoiLic	n	i aloTY
  *  with t is(program; i	 not, writesto t 	sFree Softwact Foundation, Inc.,
  *  59 Temple Placi - Suites330, Boston_MA 02111-1307, USA.l+ *
+ * ########################################################################l+ *
+ * 
  */
-#include_<licux/co-fig.h>
 e 
-#defica_NUM_INTERFACES 2
 #defica_MAC_IOSIZEO0x10000@-#defica_NUM_RX_DMA 4       /* Au1000shas 4 rx hardwact descrip
ors */
-#defica_NUM_TX_DMA 4       /* Au1000shas 4 tx hardwact descrip
ors */
+#defica_NUM_RX_DMA 4       /* Au1x00shas 4 rx hardwact descrip
ors */
+#defica_NUM_TX_DMA 4       /* Au1x00shas 4 tx hardwact descrip
ors */
 
 #defica_NUM_RX_BUFFS 4
 #defica_NUM_TX_BUFFS 4
@@ -33,12 +38,6 @@
 #defica_ETH_TX_TIMEOUT HZ/4
 #defica_MAC_MIN_PKT_SIZE 64e 
-#i	 deficad(CONFIG_MIPS_PB1000) || deficad(CONFIG_MIPS_PB1500) || deficad(CONFIG_MIPS_PB1100)
-#defica_PHY_ADDRESS              0
-#defica_PHY_CONTROL_DEFAULT 0x3000@-#defica_PHY_CONTROL_REG_ADDR     0
-#endifl-
 #defica_MULTICAST_FILTER_LIMIT 64e 
 /* FIXME e@@ -54,11 +53,13 @@
 #defica_MII_ANLPAR  0x0005
 #defica_MII_AEXP    0x0006
 #defica_MII_ANEXT   0x0007@-#defica_MII_LSI_CONFIG 0x0011@-#defica_MII_LSI_STAT   0x0012@-#defica_MII_AUX_CNTRL  0x0018@-#defica_MII_INT        0x001A
+#defica_MII_LSI_PHY_CONFIG 0x0011@+/* S	a	us register */
+#defica_MII_LSI_PHY_STAT   0x0012@+#defica_MII_AMD_PHY_STAT   MII_LSI_PHY_STAT@+#defica_MII_INTEL_PHY_STAT 0x0011@ @+#defica_MII_AUX_CNTRL  0x0018@ /* mii registers(specificsto AMD 79C901a*/
 #defica	MII_STATUS_SUMMARYf= 0x0018@ l@@ -121,23 +122,30 @@
 #defica	MII_STSSUM_AUTO  0x0002
 #defica_MII_STSSUM_SPD   0x0001@ @-/* lsi re 	us register */
-@-#defica_MII_LSI_STAT_FDX	0x0040@-#defica_MII_LSI_STAT_SPD	0x0080@+/* lsi phy+s	a	us register */
+#defica_MII_LSI_PHY_STAT_FDX	0x0040@+#defica_MII_LSI_PHY_STAT_SPD	0x0080@+@+/* amd phy+s	a	us register */
+#defica_MII_AMD_PHY_STAT_FDX	0x0800
+#defica_MII_AMD_PHY_STAT_SPD	0x0400@+@+/* in el phy+s	a	us register */
+#defica_MII_INTEL_PHY_STAT_FDX	0x0200
+#defica_MII_INTEL_PHY_STAT_SPD	0x4000@ 
 /* Auxilliary Co-trol/S	a	us Register */
 #defica_MII_AUX_FDX      0x0001@ #defica_MII_AUX_100      0x0002
 #defica_MII_AUX_F100     0x0004
 #defica_MII_AUX_ANEG     0x0008@-#defica_MII_FDX_LED	 0x8000@ 
 typedef @
e_ndsmii_phy @@ 	ree_ndsmii_phy *snext;l 	ree_ndsmii_chip_info * chip_info;e-	d t phy_addr;e 	l16 @e 	us;
+	u32 *mii_control_reg;
+	u32 *mii_ v;
_regal }smii_phy_t;
 
 @
e_ndsphy_ops+{
@@ -197,7 +205,6 @@
 	db_dest_t db[NUM_RX_BUFFS+NUM_TX_BUFFS];l yvol 	vle rx_dma_t *rx_dma_ring[NUM_RX_DMA];l yvol 	vle tx_dma_t *tx_dma_ring[NUM_TX_DMA];l-	d t tx_len[NUM_TX_DMA];l 	db_dest_t *rx_db_inuse[NUM_RX_DMA];l ydb_dest_t *tx_db_inuse[NUM_TX_DMA];l 	u32 rx_headal@@ -205,6 +212,7 @@
 	u32 tx_tail;
 	u32 tx_full;l 
+	d t mac_idal 	mii_phy_t *mii;l 	ree_ndsphy_ops+*phy_ops;
 	l@@ -218,9 +226,10 @@
 	u8 *hash_table;
 	u32 hash_mode;
 	u32 intr_work_done; /* number of Rx andsTx pkts(processfd 		 t 	sisr */
-	u32 phy_addr;          /* PHY address */
+	d t phy_addr;          /* phy address */
 	u32 options;           /* User-settable misc. driver options. */
 	u32 drv_flags;@+	d t want_autoneg;
 	ree_ndsnet_devic	_se 	s se 	s;
 	ree_ndstimer_lis	 timer;l 	spinlock_t lock;       /* Serial 	i access tos evic	s*/
diff -Nru a/drivers/net/b44.c b/drivers/net/b44.c
--- a/drivers/net/b44.c	2004-10-22 08:01:02 -07:00@+++ b/drivers/net/b44.c	2005-03-02 21:00:42 -08:00@@@ -1903,7 +1903,7 @@
 	}
 }
 
-@
 	void tNb44_suspend(ree_ndspci_dev *pdev, u32 @
 	e)e+@
 	void tNb44_suspend(ree_ndspci_dev *pdev, pm_messag
_t s
 	e)e @@ 	ree_ndsnet_devic	s*dev = pci_get_drv v;
(pdev)al 	see_ndsb44 *bp = netdev_priv(dev)aldiff -Nru a/drivers/net/b44.h b/drivers/net/b44.h
--- a/drivers/net/b44.h	2004-10-21 16:46:09 -07:00@+++ b/drivers/net/b44.h	2005-01-27 14:18:11 -08:00@@@ -302,20 +302,6 @@
 #defica_B44_MII_TLEDCTRL	27	/* TrafficsMeter LED */
 #defica_ MII_TLEDCTRL_ENABLE	0x0040@ @-/* XXX Add t is(to mii.h */
-#ifndef ADVERTISE_PAUSE@-#defica_ADVERTISE_PAUSE_CAP		0x0400@-#endifl-#ifndef ADVERTISE_PAUSE_ASYM@-#defica_ADVERTISE_PAUSE_ASYM		0x0800
-#endifl-#ifndef LPA_PAUSE@-#defica_LPA_PAUSE_CAP			0x0400@-#endifl-#ifndef LPA_PAUSE_ASYM@-#defica_LPA_PAUSE_ASYM			0x0800
-#endifl-
 @
e_ndsdma_desc @@ 	u32	ctrl;
 	u32	addr;ediff -Nru a/drivers/net/bag
tlance.c b/drivers/net/bag
tlance.c
--- a/drivers/net/bag
tlance.c	2004-10-20 01:37:15 -07:00@+++ /dev/null	Wfd Dec 31 16:00:00 196900@@@ -1,1368 +0,0 @@
-/*
- * bag
tlance.c: Ethernet driver eor VME LanceOcards+onsBag
t/MIPS
- *      T is(code_stealed andsadopteds_5hc licux/drivers/net/atarilance.c
- *      Seest at eor author info
- *
- * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov
- */
-e-/* 
- * Driver code_eor Bag
t/LanceOtakens_5hc atarilance.c, which 
lso
- *_works well+		 c+	i of B,sta. Most s gnifica;
+changes made_here
- *_rel 	edswith 16BIT-only access tosA24(spaci.
- */
-e-@
 	voichar * 		s on_= "bag
tlance.c: v1.1 11/10/98\n";
-
-#include_<licux/module.h>
-#include_<licux/stddef.h>
-#include_<licux/kernel.h>
-#include_<licux/string.h>
-#include_<licux/errno.h>
-#include_<licux/slab.h>
-#include_<licux/in e__upt.h>
-#include_<licux/init.h>
-#include_<licux/netdevic	.h>
-#include_<licux/etherdevic	.h>
-#include_<licux/skbuff.h>
-#include_<licux/bitops.h>
-
-#include_<asm/irq.h>
-#include_<asm/io.h>
-#include_<asm/bag
t/bag
t.h>
-
-#defica_BAGET_LANCE_IRQ _BAGET_IRQ_MASK(0xdf)
-e-/*
- *  Defica_following_if you don'dsneeds16BIT-only access tosLanceOmemory
- *  (Normally_BAGETsneeds it)
- */
-#undef NORMAL_MEM_ACCESS 
-e-/* Debug level:
- *  0 = svlent, prd t only serious e__ors
- *  1 = normal, prd t e__or messag
s
- *  2 = debug, prd t debug infos
- *  3 = debug, prd t even moct debug infos (packet  v;
)@- */
-@-#defica	LANCE_DEBUG	1  
-
-#i	def LANCE_DEBUG
-@
 	void tNlance_debug = LANCE_DEBUG;
-#e) {l-@
 	void tNlance_debug = 1;
-#endifl-MODULE_PARM(lance_debug, "ic)al-MODULE_PARM_DESC(lance_debug, "LanceOdebug level (0-3)c)al-MODULE_LICENSE("GPL")al-e-/* Prd t debug messag
s+onsprobing? */
-#undef LANCE_DEBUG_PROBE
-@-#defica	DPRINTK(n,a)							\
-	do {										\
-		i	 (lance_debug >= n)					\
-			prd tk a;							\
-	} while( 0 )
-
-#i	def LANCE_DEBUG_PROBE
-# defica_PROBE_PRINT(a)	prd tk a
-#e) {l-# defica_PROBE_PRINT(a)
-#endifl-
-/* These defica_t 	snumber of Rx andsTx buffers as log2. (Only powers
- * of two act val I)@- * Much moct rx buffers (32) act recerzed t an tx buffers (8),as nceOreceiving@- * is(moct time critic+l t 	n sending_andspackets may hazeetosrema		 i	 t 	
- * board's memory w 	n ma		 memory is low.
- */
-e-/* Bag
tsLanceOhas 64K+on-board memory, so it looks weeca['ba ncre+	il-   buffer qua;
ity (40*1.5K is ab
+}f64K) */
-@-#defica_TX_LOG_RING_SIZE			3@-#defica_RX_LOG_RING_SIZE			5l-
-/* These act t 	s erived values */
-@-#defica_TX_RING_SIZE			(1f<< TX_LOG_RING_SIZE)@-#defica_TX_RING_LEN_BITS		(TX_LOG_RING_SIZEf<< 5)@-#defica	TX_RING_MOD_MASK		(TX_RING_SIZEf- 1)@-@-#defica_RX_RING_SIZE			(1f<< RX_LOG_RING_SIZE)@-#defica_RX_RING_LEN_BITS		(RX_LOG_RING_SIZEf<< 5)@-#defica	RX_RING_MOD_MASK		(RX_RING_SIZEf- 1)@-@-/* The LANCE Rx andsTx ring descrip
ors. */
-@
e_ndslance_rx_head {
-	vol 	vle lock, flashort	b+	i;		/* Low_word of b+	i addr */
-#ifdef NORMAL_MEM_ACCESSl-       /* Following_two fields act joicadid to oca_shortetosguara;
eel-		 s16BIT access tosBag
tslance registers(*/
-	vol 	vle lock, flachar	flag;l-	lock, flachar			b+	i_hia	/* High word of b+	i addr (unused) */
-#e) {l-/* Following_macros act usfd as replecements tos8BIT fields */
-#defica_GET_FLAG(h)    (((h)->flag_b+	i_hi >> 8) & 0xff)@-#defica_SET_FLAG(h,f)  (h)->flag_b+	i_hi = ((h)->flag_b+	i_hi & 0xff) | \l-		 sssssssssssssssssssssssssssssssssssssssssssssss(((lock, fl)(f))f<< 8)
-	vol 	vle lock, flashort flag_b+	i_hia 
-#endifl-	vol 	vle short			buf_lengtha	/* T is(length is(2s(complement!(*/
-	vol 	vle short			msg_lengtha	/* T is(length is("normal". */
-}al-e-
-@
e_ndslance_tx_head {
-	vol 	vle lock, flashort	b+	i;		/* Low_word of b+	i addr */
-#ifdef NORMAL_MEM_ACCESS @-/* Seescomments ab
zeeab
+}f8BIT-access Bag
tsA24-spacisproblems(*/
-	vol 	vle lock, flachar	flag;l-	lock, flachar			b+	i_hia	/* High word of b+	i addr (unused) */
-#e) {l-	vol 	vle lock, flashort  flag_b+	i_hia
-#endifl-	vol 	vle short			lengtha		/* Length is(2s(complement!(*/
-	vol 	vle short			misc;
-}al-e-@
e_ndsringdesc @@-	vol 	vle lock, flashort	adr_lo;		/* Low_16 bi	s of address */
-#ifdef NORMAL_MEM_ACCESS @-/* Seescomments ab
zeeab
+}f8BIT-access Bag
sA24-spacisproblems(*/
-	lock, flachar	len 		/* Length bi	s */
-	lock, flachar	adr_hia		/* High 8 bi	s of address (unused) */
-#e) {l-	vol 	vle lock, flashort  len_adr_hia
-#endifl-};@-@-/* The LANCE initial zation block, describfd 		  v;
book. */
-@
e_ndslance_d it_block @@-	lock, flashort	mode;		/* Pre-set mode */
-	lock, flachar	hwaddr[6];	/* Physic+l ethernet address */
-	lock, fl		fil e_[2];	/* Multic+	t fil e_ (unused). */
-	/* Receive ands
ransmidsring b+	i, aloTYswith length bi	s. */
-	@
e_ndsringdesc	rx_ring 
-	@
e_ndsringdesc	tx_ring 
-};@-@-/* The whole lay
+}fof t 	sLanceOshared memory */
-@
e_ndslance_memory {
-	@
e_ndslance_d it_block	d it;
-	@
e_ndslance_tx_head	tx_head[TX_RING_SIZE];
-	@
e_ndslance_rx_head	rx_head[RX_RING_SIZE];
-	char					packet_are
[0]a	/* packet  v;
_follow after t 	
-											 * initNblock ands
 	sring@-											 * descrip
ors andsact located@-											 * adsruntime */
-}al-e-/* RieblCard specifics:
- * The origin+l TOS driver eor these cards+recerzes t 	sare
s_5hc offset
- * 0xee70 tos0xeebb eor storing co-figuration  v;
. Ofsin e_eststo us isst 	
- * Ethernet address theri, ands
 	smagvoieor verifying t 	s v;
's val Iity.
- * The recerzed are
sis['batouch by packet buffers. Furthermoct, offset 0xfffe@- * is(recerzed eor thesin e__upt+vectorsnumber.
- */
-#defica	RIEBL_RSVD_START	0xee70
-#defica	RIEBL_RSVD_END		0xeec0@-#defica_RIEBL_MAGIC			0x09051990@-#defica_RIEBL_MAGIC_ADDR	((lock, flaloTY *)(((char *)MEM) + 0xee8a))@-#defica_RIEBL_HWADDR_ADDR	((lock, flachar *)(((char *)MEM) + 0xee8e))@-#defica_RIEBL_IVEC_ADDR		((lock, flashort *)(((char *)MEM) + 0xfffe))@-@-/* This issa default address eor thesold RieblCards with
+}fa b+t e_y
- * t at hazeeno ethernet address at boo	 time. 00:00:36:04 isst 	
- * prefix eor Riebl cards, thes00:00 at t 	send issarbi	rary.
- */
-e-@
 	voilock, flachar OldRieblDefHwaddr[6]+= {
-	0x00, 0x00, 0x36, 0x04, 0x00, 0x00
-}al-e-/* I/O registers(of t 	sLanceOchip */
-e-@
e_ndslance_doreg {e-/* b+	i+0x0 */	vol 	vle lock, flashort	 v;
;e-/* b+	i+0x2 */	vol 	vle lock, flashort	addr;e-				lock, flachar			_dummy1[3];e-/* b+	i+0x7 */	vol 	vle lock, flachar	ivec;e-				lock, flachar			_dummy2[5];e-/* b+	i+0xd */	vol 	vle lock, flachar	eeprom;e-				lock, flachar			_dummy3;e-/* b+	i+0xf */	vol 	vle lock, flachar	mem 
-};@-@-/* Types(of boards t is(driver supports */
-@-enumslance_type {
-	OLD_RIEBL,		/* old Riebl card with
+}fb+t e_y */
-	NEW_RIEBL,		/* new Riebl card withfb+t e_y */
-	PAM_CARD		/* PAM card withfEEPROM */
-}al-e-@
 	voichar *lance_n;
Rs[]+= {
-	"Riebl-Card (with
+}fb+t e_y)ca
-	"Riebl-Card (withfb+t e_y)ca
-	"PAM in e_n card"
-};@-@-/* The driver's(private devic	s@
e_ndur	s*/
-e-@
e_ndslance_private {
-	enumslance_type		c+rdtype;
-	@
e_ndslance_doreg	*iob+	i;
-	@
e_ndslance_memory	*mem 
-	d t					cur_rx, cur_txa	/* T esnextsfree ring entrys*/
-	d t					dirty_txa		/* Ring entries to besfreed. */
-						/* copy(function */
-	void				*(*memcpy_f)(+v. I *,ac nst v. I *,as =
_t );
-	@
e_ndsnet_devic	_se 	s se 	s;
-/* These two must bealoTYs eor set_bit() */
-	loTY				tx_full;l-	loTY				lock;
-}al-e-/* I/O register access macros */
-@-#defica	MEM		lp->mem@-#defica	DREG	IO-> v;
@-#defica	AREG	IO->addr
-#defica	REGA(a)	( AREG = (a), DREG )
-e-/* Definiti ns eor packet buffer access: */
-#defica_PKT_BUF_SZ		1544e-/* Get t 	saddress(of a packet buffer corresponding_to a given buffer head */
-#defica	PKTBUF_ADDR(head)	(((lock, flachar *)(MEM)) + (head)->b+	i)
-e-/* Possible memory/IO addresses eor probing */
-e-@
e_ndslance_addr @@-	lock, flaloTY	memaddr;e-	lock, flaloTY	ioaddr 
-	d t				slow_flag;l-}slance_addr_lis	[]+= {
-	{_BAGET_LANCE_MEM_BASE,_BAGET_LANCE_IO_BASE,_1 }	/* Bag
tsLanceO*/
-}al-e-#defica	N_LANCE_ADDR	(s =
of(lance_addr_lis	)/s =
of(*lance_addr_lis	))l-e-
-#defica_LANCE_HI_BASE (0xff & (BAGET_LANCE_MEM_BASE >> 16))
-e-/* Definiti ns eor t 	sLanceO*/
-e-/* tx_head flags */
-#defica_TMD1_ENP		0x01	/* end of packet */
-#defica_TMD1_STP		0x02	/* s	art of packet */
-#defica_TMD1_DEF		0x04	/* deferred */
-#defica_TMD1_ONE		0x08	/* one retrysneeded */
-#defica_TMD1_MORE		0x10	/* moct t an one retrysneeded */
-#defica_TMD1_ERR		0x40	/* e__or summarys*/
-#defica_TMD1_OWN 		0x80	/* ownership (set:Ochip owns) */
-@-#defica_TMD1_OWN_CHIP	TMD1_OWN@-#defica_TMD1_OWN_HOST	0
-e-/* tx_head misc fields*/
-#defica_TMD3_TDR		0x03FF	/* Time Doma		 Reflectometryscounter */
-#defica_TMD3_RTRY		0x0400	/* failed after 16 retries */
-#defica_TMD3_LCAR		0x0800	/* carrieralost */
-#defica_TMD3_LCOL		0x1000	/* l 	escollision */
-#defica_TMD3_UFLO		0x4000	/* underflow (l 	esmemory) */
-#defica_TMD3_BUFF		0x8000	/* buffering e__or (no ENP)O*/
-e-/* rx_head flags */
-#defica_RMD1_ENP		0x01	/* end of packet */
-#defica_RMD1_STP		0x02	/* s	art of packet */
-#defica_RMD1_BUFF		0x04	/* buffer e__or */
-#defica_RMD1_CRC		0x08	/* CRC e__or */
-#defica_RMD1_OFLO		0x10	/* overflow */
-#defica_RMD1_FRAM		0x20	/* framing e__or */
-#defica_RMD1_ERR		0x40	/* e__or summarys*/
-#defica_RMD1_OWN 		0x80	/* ownership (set:Oship owns) */
-@-#defica_RMD1_OWN_CHIP	RMD1_OWN@-#defica_RMD1_OWN_HOST	0
-e-/* register n;
Rss*/
-#defica_CSR0	0		/* mode/s	a	us */
-#defica_CSR1	1		/* initNblock addr (low) */
-#defica_CSR2	2		/* initNblock addr (high) */
-#defica_CSR3	3		/* misc */
-#defica_CSR8	8	  	/* address eil e_ */
-#defica_CSR15	15		/* promiscuous mode */
-e-/* CSR0 */
-/* (R=readable, W=writeable, S=set on write, C=cle+r on write) */
-#defica_CSR0_INIT	0x0001		/* initial ze (RS) */
-#defica_CSR0_STRT	0x0002		/* s	art (RS) */
-#defica_CSR0_STOP	0x0004		/* s	ops(RS) */
-#defica_CSR0_TDMD	0x0008		/* 
ransmidsdemands(RS) */
-#defica_CSR0_TXON	0x0010		/* 
ransmid e_ on (R) */
-#defica_CSR0_RXON	0x0020		/* receive_ on (R) */
-#defica_CSR0_INEA	0x0040		/* in e__upt+enable (RW) */
-#defica_CSR0_INTR	0x0080		/* in e__upt+active (R) */
-#defica_CSR0_IDON	0x0100		/* initial zation  one (RC) */
-#defica_CSR0_TINT	0x0200		/* 
ransmid e_ in e__upt+(RC) */
-#defica_CSR0_RINT	0x0400		/* receive_ in e__upt+(RC) */
-#defica_CSR0_MERR	0x0800		/* memory e__or (RC) */
-#defica_CSR0_MISS	0x1000		/* misseds_5;
Rs(RC) */
-#defica_CSR0_CERR	0x2000		/* carrierae__or (no heartbeat :-)s(RC) */
-#defica_CSR0_BABL	0x4000		/* babble:stx-ed too many bi	s (RC) */
-#defica_CSR0_ERR	0x8000		/* e__or (RC) */
-e-/* CSR3 */
-#defica_CSR3_BCON	0x0001		/* byte control */
-#defica_CSR3_ACON	0 // fixma: 0x0002		/* ALE control */
-#defica_CSR3_BSWP	0x0004		/* byte swaps(1=big endian) */
-e-
-e-/***************************** Prototypes(*****************************/
-e-@
 	void tNaddr_accessible(+v.l 	vle v. I *regpa+e;
+wordflaga+e;
l-                            writeflag );
-@
 	void tNlance_probe1( ree_ndsnet_devic	s*dev, @
e_ndslance_addr *d it_rec );
-@
 	void tNlance_open( ree_ndsnet_devic	s*dev );
-@
 	voiv. I lance_d it_ring( ree_ndsnet_devic	s*dev );
-@
 	void tNlance_start_xmid( ree_ndssk_buff *skb, ree_ndsnet_devic	s*dev );
-@
 	voidrqr,,) {_tNlance_d  e__upt( e;
+irqa+v. I *dev_id, ree_ndspt_regs *fp );
-@
 	void tNlance_rx( ree_ndsnet_devic	s*dev );
-@
 	void tNlance_close( ree_ndsnet_devic	s*dev );
-@
 	voi@
e_ndsnet_devic	_se 	s *lance_get_se 	s( ree_ndsnet_devic	s*dev );
-@
 	voiv. I cet_multic+	t_lis	( ree_ndsnet_devic	s*dev );
-@
 	void tNlance_set_mac_address( ree_ndsnet_devic	s*dev, v. I *addr )al-e-/************************* End of Prototypes(**************************/
-e-/* Network 
raffics@
 	vs	voi(bytes) */
-@-d tNlance_stat =O0 
-e-@
 	voiv. I up v;e_lance_stat (e;
+len) {
-		lance_stat += len l-}
-e-/* 
-   T is(function is(usfd to access Bag
t/LanceOmemory to av. I 
-   8/32BIT access tosVACsA24(spaci 
-   ALL memcpy calls was chengfd to t is(function to av. I dbisproblems
-   Don'dsco-fusf withffunction n;
R -- it stayss_5hc origin+l code
-*/
-@-v. I *slow_memcpy(+v. I *dst,ac nst v. I *src,as =
_t len )
-e-{	e-	lock, flaloTY to     = (lock, flaloTY)dst;e-	lock, flaloTYs_5hc   = (lock, flaloTY)src;e-	lock, flaloTY to_end = to +len l-	
-	/* Unalk, ed flags */
-l-	d t odd__5hc   = _5hc   & 1;
-	d t odd_to     = to     & 1;
-	d t odd_to_end = to_end & 1;
-
-	/* Alk, seor 16BIT-access eirsts*/
-e-	36gister lock, flashort *_5hc_a   = (lock, flashort*)s(_5hc   & ~1)al-	36gister lock, flashort *to_a     = (lock, flashort*)s(to     & ~1)a l-	36gister lock, flashort *to_end_a = (lock, flashort*)s(to_end & ~1)al-
-	/* Caching values -- not 		 loopsinvariants*/
-e-	36gister lock, flashort _5hc_va l-	36gister lock, flashort to_val-
-	/* Invariantsis: _5hc_a ands
o_a act pod  e_s befoct or exactly to
-	   curre tly copying byte */
-l-	df (odd_to) { l-			/* Firstsbyte unalk, ed c+	i */
-			_5hc_v =N*_5hc_a;e-			to_v   = *to_a;l-
-			to_v &= ~0xff;e-			to_v |=  0xff & (_5hc_v >> (odd__5hc ? 0 : 8))al-			*to_a++ = to_val-
-			df (odd__5hc) _5hc_a++al-	}l-    i	 (odd__5hc == odd_to) {l-			/* S;
R parity */
-			while (
o_a + 7 < to_end_a) {l-					lock, flaloTY dummy1, dummy2;l-					lock, flaloTY 36g1, 36g2, 36g3, 36g4al-
-					__asm__ __v.l 	vle__(
-					".set\tnoctorder\n\t"
-					".set\tnoat\n\t"
-					"lh\t%2,0(%1)\n\t"
-					"nop\n\t"
-					 "lh\t%3,2(%1)\n\t"
-					"sh\t%2,0(%0)\n\t"
-					   "lh\t%4,4(%1)\n\t"
-					 "sh\t%3,2(%0)\n\t"
-					    "lh\t%5,6(%1)\n\t"
-					   "sh\t%4,4(%0)\n\t"
-					"lh\t%2,8(%1)\n\t"
-					    "sh\t%5,6(%0)\n\t"
-					 "lh\t%3,10(%1)\n\t"
-					"sh\t%2,8(%0)\n\t"
-					  "lh\t%4,12(%1)\n\t"
-					 "sh\t%3,10(%0)\n\t"
-					    "lh\t%5,14(%1)\n\t"
-					  "sh\t%4,12(%0)\n\t"
-					 "nop\n\t"
-					    "sh\t%5,14(%0)\n\t"
-					".set\tat\n\t"
-					".set\tctorder"
-					:"=r" (dummy1), "=r" (dummy2),
-					"=&r" (36g1), "=&r" (36g2), "=&r" (36g3), "=&r" (36g4)
-					:"0" (
o_a), "1" (_5hc_a)
-					:"memory")al-e-					to_a   += 8;l-					_5hc_a += 8;l-l-			}
-			while (
o_a < to_end_a) {l-					*to_a++ = *_5hc_a++al-			}
-	} e) { {
-			/* Differe t parity */
-			_5hc_v =N*_5hc_a;e-			while (
o_a < to_end_a) {l-					lock, flashort _5hc_v_next;l-					_5hc_v_next =N*++_5hc_a;e-					*to_a++ = ((_5hc_v & 0xff)<<8) | ((_5hc_v_next>>8) & 0xff);l-					_5hc_v = _5hc_v_next; l-			}
-l-	}l-	df (odd_to_end) {l-			/* Lastsbyte unalk, ed c+	i */
-			to_v = *to_a;l-			_5hc_v =N*_5hc_a;e-
-			to_v &= ~0xff00;
-			df (odd__5hc == odd_to) {l-					to_v |= _5hc_v & 0xff00;
-			} e) { {
-					to_v |= (_5hc_v<<8) & 0xff00;
-			}e-
-			*to_a = to_val-	}e-
-	up v;e_lance_stat( len );
-e-	36,) {( dst );
-}l-e-
-@
e_ndsnet_devic	s* __initNbag
tlance_probe(d t unit)
-{
-	@
e_ndsnet_devic	s*dev;
-	d t i;e-	@
 	void tNfound;
-	d t e__f= -ENODEV;
-l-	df (found)
-		/* Assume theri's only one board possible... T at+ceems(
e_e,as ncel-		 * t 	sRiebl/PAM board's address cannot be+changed. */
-		36,) { ERR_PTR(-ENODEV);
-
-	dev =Nalloc_etherdev(s =
of(ree_ndslance_private))al-	 	 (!dev)l-		36,) { ERR_PTR(-ENOMEM);
-
-	SET_MODULE_OWNER(dev)al-
-	eor( e =O0  i < N_LANCE_ADDR; ++i ) {l-		i	 (lance_probe1( dev, &lance_addr_lis	[i] )) {l-			found = 1;
-			break;@-		}
-	}l-	 	 (!found)
-		goto 
+};@-	e__f= register_netdev(dev)al-	 	 (e__)
-		goto 
+}1al-	36,) { dev;
-
+}1:e-	eree_irq(dev->irqa+dev)al-
+}:
-	free_netdev(dev);@-	36,) { ERR_PTR(e__) l-}
-e-/* Derived _5hc hwreg_precent() 		 vme/co-fig.c: */
-e-@
 	void tN__initNaddr_accessible(+v.l 	vle v. I *regpa+
-				   e;
+wordflaga+
-				   e;
+writeflag )e-{	e-		/* We hazeea fica_function to do it */
-		exte_n d t try_read(lock, flaloTYa+e;
);@-		36,) { try_read((lock, flaloTY)regpa+s =
of(rhort))N!= -1;   
-}l-e-
-e-/* Origin+l atari(driver uses it */
-#defica_IRQ_TYPE_PRIO SA_INTERRUPT
-#defica_IRQ_SOURCE_TO_VECTOR(x)s(x)
-e-@
 	void tN__initNlance_probe1( ree_ndsnet_devic	s*dev,
-				@
e_ndslance_addr *d it_rec )
-e-{	vol 	vle lock, flashort *memaddr =
-		(vol 	vle lock, flashort *)d it_rec->memaddr 
-	vol 	vle lock, flashort *ioaddr =
-		(vol 	vle lock, flashort *)d it_rec->ioaddr 
-	ree_ndslance_private	*lp;
-	@
e_ndslance_doreg		*IO;
-	d t 					i;e-	@
 	void tN				did_ 		s on;@-	lock, flashort			@aze1, @aze2al-
-	PROBE_PRINT(( "Probing eor LanceOcard at mem %#lx io %#lxthca
-				  (loTY)memaddr, (loTY)ioaddr ))al-
-	/* TestswhetherOmemory readable andswritable */
-	PROBE_PRINT(( "lance_probe1: testing_memory to bi accessiblethc ))al-	 	 (!addr_accessible(+memaddr, 1,_1 )) goto probe_fail;
-l-	df ((lock, flaloTY)memaddr >= KSEG2) {l-			/* FIXME: do wesneedsto undo t at on cle+nup paths?s*/
-			exte_n d t ks6g2_alloc_io (lock, flaloTY addr, lock, flaloTY s =
);
-			df (ks6g2_alloc_io((lock, flaloTY)memaddr,_BAGET_LANCE_MEM_SIZE)) {l-					prd tk("bag
tlance: unable mapslance memorythc);l-					goto probe_fail;
-			}
-	}l-
-	/* Written values should come back... */
-	PROBE_PRINT(( "lance_probe1: testing_memory to bi writable (1)\nc ))al-	@aze1 =N*memaddr 
-	*memaddr = 0x0001al-	 	 (*memaddr != 0x0001) goto probe_fail;
-	PROBE_PRINT(( "lance_probe1: testing_memory to bi writable (2)\nc ))al-	*memaddr = 0x0000al-	 	 (*memaddr != 0x0000) goto probe_fail;
-	*memaddr = @aze1al-
-	/* Firstsport(should be readable andswritable */
-	PROBE_PRINT(( "lance_probe1: testing_ioportetosbi accessiblethc ))al-	 	 (!addr_accessible(+ioaddr,a1,_1 )) goto probe_fail;
-l-	/* andswritten values should be readable */
-	PROBE_PRINT(( "lance_probe1: testing_ioportetosbi writeable\nc ))al-	@aze2 = ioaddr[1];l-	ioaddr[1] = 0x0001al-	 	 (ioaddr[1] != 0x0001) goto probe_fail;
-
-	/* Tha_CSR0_INIT bit should not be+readable */
-	PROBE_PRINT(( "lance_probe1: testing_CSR0 36gister function (1)\nc ))al-	@aze1 =Nioaddr[0];l-	ioaddr[1] = CSR0;l-	ioaddr[0] = CSR0_INIT |_CSR0_STOPal-	 	 (ioaddr[0] != CSR0_STOP) {l-		ioaddr[0] = @aze1al-		ioaddr[1] = @aze2al-		goto probe_fail;
-	}
-	PROBE_PRINT(( "lance_probe1: testing_CSR0 36gister function (2)\nc ))al-	ioaddr[0] = CSR0_STOPal-	 	 (ioaddr[0] != CSR0_STOP) {l-		ioaddr[0] = @aze1al-		ioaddr[1] = @aze2al-		goto probe_fail;
-	}
-
-	/* Now ok... */
-	PROBE_PRINT(( "lance_probe1: LanceOcard detected\nc ))al-	goto probe_ok;
-
-  probe_fail:e-	36,) {( 0 );
-e-  probe_ok:e-	lp = netdev_priv(dev)al-	MEM = (ree_ndslance_memory *)memaddr 
-	IO = lp->iob+	i = (ree_ndslance_doreg *)ioaddr 
-	dev->b+	i_addr = (lock, flaloTY)ioaddr  /* information+l only */
-	lp->memcpy_f =Ni it_rec->slow_flag ? slow_memcpy : memcpy;
-
-	REGA(_CSR0 ) = CSR0_STOPal-
-	/* Now test eor type: If t 	seeprom I/O porteis(readable, iteis(a
-	 * PAM card */
-	d	 (addr_accessible(+&(IO->eeprom),O0, 0 )) {l-		/* Switch backetosRam */
-		i = IO->mem 
-		lp->c+rdtype+= PAM_CARD;
-	}
-#ifdef NORMAL_MEM_ACCESSl-	e) { i	 (*RIEBL_MAGIC_ADDR == RIEBL_MAGIC) {l-#e) {l-	e) { i	 (({l-			lock, flashort *a = (lock, flashort*)RIEBL_MAGIC_ADDR;l-		 sss(((d t)
[0])f<< 16) + ((d t)
[1])f== RIEBL_MAGIC;
-	})) {l-#endifl-		lp->c+rdtype+= NEW_RIEBL;
-	}
-	e) {l-		lp->c+rdtype+= OLD_RIEBL;
-l-	df (lp->c+rdtype+== PAM_CARD ||l-		memaddr == (lock, flashort *)0xffe00000) {l-		/* PAMsOcard and Riebl on ST use level 5 autovectors*/
-		i	 (request_irq(BAGET_LANCE_IRQ,Nlance_d  e__upt,_IRQ_TYPE_PRIO,l-		 sssssssssss"PAM/Riebl-ST Ethernetca	dev))l-			goto probe_fail;
-		dev->irq = (lock, flashort)BAGET_LANCE_IRQ;
-	}
-	e) { {l-		/* For VME-RieblCards, 36questea free VME int;l-		 * (T is(must bealock, flaloTYa+s nceOdev->irq isashort ands
 	l-		 * IRQ_MACHSPEC bit would be c+}foff...)l-		 */
-		lock, flaloTY irq = BAGET_LANCE_IRQ; 
-		i	 (!irq) {l-			prd tk( "Lance: 36questeeor VME in e__upt+failed\nc );l-			goto probe_fail;
-		}
-		i	 (request_irq(irqa+lance_d  e__upt,_IRQ_TYPE_PRIO,l-		 sssssssssss"Riebl-VME Ethernetca	dev))l-			goto probe_fail;
-		dev->irq = irq;
-	}
-
-	prd tk("%s:s%s at io %#lx, mem %#lx, irq %d%s, hwaddr ",l-		 ssdev->n;
R, lance_n;
Rs[lp->c+rdtype],l-		 ss(lock, flaloTY)ioaddr,l-		 ss(lock, flaloTY)memaddr,l-		 ssdev->irqal-		 ssi it_rec->slow_flag ? " (rlow memcpy)" : "" )al-
-	/* Get t 	sethernet address */
-	@witch( lp->c+rdtype+) {l-	  c+	i OLD_RIEBL:l-		/* No ethernet address! (Set some default address) */
-		slow_memcpy(+dev->dev_addr,aOldRieblDefHwaddr, 6 );l-		break;@-	  c+	i NEW_RIEBL:l-		lp->memcpy_f(+dev->dev_addr,aRIEBL_HWADDR_ADDR, 6 );l-		break;@-	  c+	i PAM_CARD:
-		i = IO->eeprom;e-		eor( e =O0  i < 6; ++i )l-			dev->dev_addr[i]+=l-				((((lock, flashort *)MEM)[i*2] & 0x0f)f<< 4) |l-				((((lock, flashort *)MEM)[i*2+1] & 0x0f));l-		i = IO->mem 
-		break;@-	}
-	eor( e =O0  i < 6; ++i )l-		prd tk( "%02x%sca	dev->dev_addr[i], (i < 5) ? ":" : "\nc );l-	df (lp->c+rdtype+== OLD_RIEBL) {l-		prd tk( "%s:sWarning: This issa default ethernet address!thca
-				dev->n;
R );l-		prd tk( "ssssssU	i \"ifco-fig hw ether ...\"etosset t 	saddress.\nc );l-	}
-
-	MEM->init.mode = 0x0000a		/* Disable Rx andsTx. */
-l-	{l-			lock, flachar hwaddr[6];l-			for( e =O0  i < 6; i+++) l-					hwaddr[i]+= dev->dev_addr[i^1]; /* <-_16 bi	 swap!s*/
-			slow_memcpy(MEM->init.hwaddr, hwaddr, s =
of(hwaddr));l-	}
-
-	MEM->init.fil e_[0]+= 0x00000000al-	MEM->init.fil e_[1]+= 0x00000000al-	MEM->init.rx_ring.adr_lo+= offsetof( ree_ndslance_memory, rx_head );
-
-#i	def NORMAL_MEM_ACCESSl-	MEM->init.rx_ring.adr_hi = LANCE_HI_BASE; 
-	MEM->init.rx_ring.len    = RX_RING_LEN_BITS;
-#e) {l-	MEM->init.rx_ring.len_adr_hi = 
-			((lock, fl)RX_RING_LEN_BITSf<< 8) |_LANCE_HI_BASE;
-#endifl-
-l-	MEM->init.tx_ring.adr_lo+= offsetof( ree_ndslance_memory, tx_head );
-
-#i	def NORMAL_MEM_ACCESSl-	MEM->init.tx_ring.adr_hi = LANCE_HI_BASE; 
-	MEM->init.tx_ring.len    = TX_RING_LEN_BITS;
-#e) {l-	MEM->init.tx_ring.len_adr_hi = 
-			((lock, fl)TX_RING_LEN_BITS<<8) | LANCE_HI_BASE;
-#endifl-
-	df (lp->c+rdtype+== PAM_CARD)l-		IO->ivec = IRQ_SOURCE_TO_VECTOR(dev->irq);l-	e) {l-		*RIEBL_IVEC_ADDR = IRQ_SOURCE_TO_VECTOR(dev->irq);l-
-	df (did_ 		s on++ == 0)l-		DPRINTK(a1,_(  		s on_))al-
-	/* The LANCE-specificsentries 		 t 	sdevic	s@
e_ndur	. */
-	dev->open = &lance_open 
-	dev->hard_start_xmid = &lance_start_xmid 
-	dev->s	ops= &lance_close 
-	dev->get_se 	ss= &lance_get_se 	s 
-	dev->set_multic+	t_lis	s= &set_multic+	t_lis	 
-	dev->set_mac_address = &lance_set_mac_address 
-	dev->s	art =O0 
-e-	memset(+&lp->se 	s,O0, s =
of(lp->se 	s) );
-e-	36,) {( 1 );
-}l-e-
-@
 	void tNlance_open( ree_ndsnet_devic	s*dev )
-e-{	@
e_ndslance_private *lp = netdev_priv(dev)al-	@
e_ndslance_doreg	 *IO = lp->iob+	i;
-	d t i;e-
-	DPRINTK(a2,_( "%s:slance_open()thca	dev->n;
R_))al-
-	lance_d it_ring(dev)al-	/* Re-initial ze the LANCE, andss	art it w 	n  one. */
-l-	REGA(_CSR3 ) = CSR3_BSWP | (lp->c+rdtype+== PAM_CARD ?_CSR3_ACONf: 0)al-	REGA(_CSR2 ) = 0al-	REGA(_CSR1 ) = 0al-	REGA(_CSR0 ) = CSR0_INITal-	/* From now on, AREG isskeptetospod  etosCSR0 */
-
-	d = 1000000al-	while (--i > 0)l-		df (DREG &_CSR0_IDON)
-			break;@-	 	 (if< 0 || (DREG &_CSR0_ERR)) {l-		DPRINTK(a2,_( "lance_open(): opening_%s failed, i=%d, csr0=%04xthca
-					ssdev->n;
R, i, DREG ));l-		DREG = CSR0_STOPal-		36,) {( -EIO );l-	}
-	DREG = CSR0_IDON;
-	DREG = CSR0_STRT;
-	DREG = CSR0_INEA;
-
-	dev->tbusy = 0al-	dev->in e__upt+= 0al-	dev->s	art =O1;e-
-	DPRINTK(a2,_( "%s:sLANCE is open, csr0 %04xthcasdev->n;
R, DREG ));l-	36,) {( 0 );
-}e-
-e-/* Initial ze the LANCE Rx andsTx rings. */
-e-@
 	voiv. I lance_d it_ring( ree_ndsnet_devic	s*dev )
-e-{	@
e_ndslance_private *lp = netdev_priv(dev)al-	d t i;e-	lock, flaoffsetal-
-	lp->lock = 0al-	lp->tx_full = 0al-	lp->cur_rx = lp->cur_tx = 0al-	lp->dirty_tx =O0 
-e-	offset = offsetof( ree_ndslance_memory, packet_are
 )al-e-/* If t 	spacket buffer at offset 'o' would co-flindswith t e recerzed are

- * of RieblCards, advanceOit */
-#defica	CHECK_OFFSET(o)														 \
-	do {																	 \
-		df (lp->c+rdtype+== OLD_RIEBL || lp->c+rdtype+== NEW_RIEBL) {		 \
-			df (((o)f< RIEBL_RSVD_START) ? (o)+PKT_BUF_SZ > RIEBL_RSVD_START \
-										 : (o)f< RIEBL_RSVD_END)			 \
-				(o) = RIEBL_RSVD_END;										 \
-		}																	 \
-	} while(0)l-
-	eor( e =O0  i < TX_RING_SIZE; i+++) {l-		CHECK_OFFSET(offset);l-		MEM->tx_head[i].b+	i = offsetal-#i	def NORMAL_MEM_ACCESSl-		MEM->tx_head[i].flag =_TMD1_OWN_HOSTal- 		MEM->tx_head[i].b+	i_hi = LANCE_HI_BASE;
-#e) {l-		MEM->tx_head[i].flag_b+	i_hi = 
-				(TMD1_OWN_HOST<<8) | LANCE_HI_BASE;
-#endifl-		MEM->tx_head[i].length = 0al-		MEM->tx_head[i].misc = 0al-		offset +=_PKT_BUF_SZ;l-	}
-
-	eor( e =O0  i < RX_RING_SIZE; i+++) {l-		CHECK_OFFSET(offset);l-		MEM->rx_head[i].b+	i = offsetal-#i	def NORMAL_MEM_ACCESSl-		MEM->rx_head[i].flag =_TMD1_OWN_CHIP;l-		MEM->rx_head[i].b+	i_hi = LANCE_HI_BASE; 
-#e) {l-		MEM->rx_head[i].flag_b+	i_hi = 
-				(TMD1_OWN_CHIP<<8) | LANCE_HI_BASE;
-#endifl-		MEM->rx_head[i].buf_lengthf= -PKT_BUF_SZ;l-		MEM->rx_head[i].msg_length = 0al-		offset +=_PKT_BUF_SZ;l-	}
-}l-e-
-@
 	void tNlance_start_xmid( ree_ndssk_buff *skb, ree_ndsnet_devic	s*dev )
-e-{	@
e_ndslance_private *lp = netdev_priv(dev)al-	@
e_ndslance_doreg	 *IO = lp->iob+	i;
-	d t entry, len l-	@
e_ndslance_tx_head *headal-	lock, flaloTYs_lags;@-
-	/* The old LANCE chips  oes['baautomatically_pad buffers to min. s =
. */
-	len = (ETH_ZLEN < skb->len) ? skb->len : ETH_ZLENal-	/* PAM-Card has a bug: Can only sendspackets with even number of bytes! */
-	d	 (lp->c+rdtype+== PAM_CARD && (len & 1))l-		++len l-
-	d	 (len > skb->len) {l-		skb = @kb_padto(skb, len);
-		df (skb == NULL)l-			36,) { 0al-	}	@-
-	/* Transmid e_ timeout, serious problems. */
-	d	 (dev->tbusy) {l-		i  etickssofar = jiffies -sdev->
rans_start;
-		df (tickssofar < 20)l-			36,) {( 1 );
-		AREG = CSR0;l-		DPRINTK(a1,_( "%s:s
ransmidstimed out, s	a	us %04x, recetting.thca
-					ssdev->n;
R, DREG ));l-		DREG = CSR0_STOPal-		/*
-		 * Alwayssset BSWP after a STOP as STOP puts it backed to
-		 * lid le endian mode.l-		 */
-		REGA(_CSR3 ) = CSR3_BSWP | (lp->c+rdtype+== PAM_CARD ?_CSR3_ACONf: 0)al-		lp->se 	s.tx_e__ors++al-#ifndef fin+l_ 		s onl-		{	d t i;e-			DPRINTK(a2,_( "Ring  v;
: dirty_tx %d cur_tx %d%s cur_rx %dthca
-						sslp->dirty_tx, lp->cur_txa
-						sslp->tx_full ? " (full)" : ""a
-						sslp->cur_rx ))al-			eor( e =O0   i < RX_RING_SIZE; i+++)
-				DPRINTK(a2,_( "rx #%d: b+	i=%04x blen=%04x mlen=%04xthca
-							ssi, MEM->rx_head[i].b+	ia
-							ss-MEM->rx_head[i].buf_lengtha
-							ssMEM->rx_head[i].msg_length ))al-			eor( e =O0   i < TX_RING_SIZE; i+++)
-				DPRINTK(a2,_( "tx #%d: b+	i=%04x len=%04x misc=%04xthca
-							ssi, MEM->tx_head[i].b+	ia
-							ss-MEM->tx_head[i].lengtha
-							ssMEM->tx_head[i].misc ))al-		}l-#endifl-		lance_d it_ring(dev)al-		REGA(_CSR0 ) = CSR0_INEA |_CSR0_INIT |_CSR0_STRT;
-
-		dev->tbusy = 0al-		dev->
rans_start = jiffies;
-
-		36,) {( 0 );
-	}
-
-	DPRINTK(a2,_( "%s:slance_start_xmid() called, csr0 %4.4x.thca
-				  dev->n;
R, DREG ));l-
-	/* Block a timer-b+	ids
ransmids_5hc o 		lapping.  T is(could bed e_ be
-	    one with atomic_swap(1asdev->tbusy), but set_bit() works as well. */
-	d	 (test_and_set_bit(O0, (v. I*)&dev->tbusy )N!= 0) {l-		DPRINTK(a0,_( "%s:sTransmid e_ access co-flind.thca	dev->n;
R_))al-		36,) { 1;
-	}
-
-	d	 (test_and_set_bit(O0, (v. I*)&lp->lock )N!= 0) {l-		DPRINTK(a0,_( "%s:stx queut lock!.thca	dev->n;
R_))al-		/* don'dscle+r dev->tbusy _lag. */
-		36,) { 1;
-	}
-
-	/* Fill+		 asTx ring entrys*/
-	d	 (lance_debug >= 3) {l-		u_char *p;l-		i  ei;l-		prd tk( "%s:sTX pkt type 0x%04x _5hc casdev->n;
R,l-				((u_short *)skb-> v;
)[6]);e-		eor( ps= &((u_char *)skb-> v;
)[6], e =O0  i < 6; i+++)l-			prd tk("%02x%sca	*p++, e != 5 ? ":" : "" );l-		prd tk("etos");e-		eor( ps= (u_char *)skb-> v;
, e =O0  i < 6; i+++)l-			prd tk("%02x%sca	*p++, e != 5 ? ":" : "" );l-		prd tk("e v;
_at 0x%08x len %dthca (e;
)skb-> v;
,l-			 ss(e;
)skb->len );
-	}l-
-	/* We're not prepared eor thesin  until t 	slast flags act set/recet. And
-	 * thesin  may happen already after cetting thesOWN_CHIP... */
-	@aze_flags(flags);
-	cli();l-
-	/* Masketosring buffer boundary. */
-	entrys= lp->cur_tx & TX_RING_MOD_MASK;
-	head s= &(MEM->tx_head[entry])al-
-	/* Caution: theswritesorder is importantsheri, set t 	s"ownership" bi	s
-	 * last.
-	 */
-
-	head->lengthf= -len l-	head->misc = 0al-	lp->memcpy_f(+PKTBUF_ADDR(head), (v. I *)skb-> v;
, skb->len );
-#i	def NORMAL_MEM_ACCESSl-	head->flag =_TMD1_OWN_CHIP |_TMD1_ENP |_TMD1_STP;
-#e) {l-    SET_FLAG(head,(TMD1_OWN_CHIP |_TMD1_ENP |_TMD1_STP))al-#endifl-	lp->se 	s.tx_bytes +=_skb->lenal-	dev_kfree_skb(_skb );
-	lp->cur_tx++al-	while( lp->cur_tx >= TX_RING_SIZE && lp->dirty_tx >= TX_RING_SIZE ) {
-		lp->cur_tx -= TX_RING_SIZEal-		lp->dirty_tx -= TX_RING_SIZEal-	}@-
-	/* Trigge_ an immediate sendspoll. */
-	DREG = CSR0_INEA |_CSR0_TDMDal-	dev->
rans_start = jiffies;
-
-	lp->lock = 0al-#i	def NORMAL_MEM_ACCESSl-	df ((MEM->tx_head[(entry+1) & TX_RING_MOD_MASK].flag &_TMD1_OWN)f==
-#e) {l-	df ((GET_FLAG(&MEM->tx_head[(entry+1) & TX_RING_MOD_MASK]) &_TMD1_OWN)f==
-#endifl-		TMD1_OWN_HOST)
-		dev->tbusy = 0al-	e) {l-		lp->tx_full = 1al-	36store_flags(flags);
-@-	36,) { 0 l-}
-e-/* The LANCE in e__upt+handler. */
-e-@
 	voidrqr,,) {_tNlance_d  e__upt( e;
+irqa+v. I *dev_id, ree_ndspt_regs *fp)
-{
-	@
e_ndsnet_devic	s*dev+= dev_idal-	@
e_ndslance_private *lpal-	@
e_ndslance_doreg	 *IO;
-	d t csr0, boguscnt =O10;
-	d t handled =O0 
-e-	d	 (dev == NULL) {l-		DPRINTK(a1,_( "lance_d  e__upt(): in e__upt+for loknownsdevic	.\nc ))al-		36,) { IRQ_NONEal-	}@-
-	lp = netdev_priv(dev)al-	IO = lp->iob+	i;
-	AREG = CSR0;l-
-	d	 (dev->in e__upt) {l-			DPRINTK(a1,_( "Re-en e_ing_CAUSE=%08x STATUS=%08xthca  
-						ssread_32bi	_cp0_36gister(CP0_CAUSE)a  
-						ssread_32bi	_cp0_36gister(CP0_STATUS) ))al-			panic("lance: in e__upt+handlersreen e_ed !");
-	}l-
-	dev->in e__upt+= 1;e-
-	while( ((csr0 = DREG) &_(CSR0_ERR |_CSR0_TINT |_CSR0_RINT)) &&l-		 ss--boguscnt >= 0) {l-		handled =O1al-		/* AcknowledgeNall(of t 	scurre t in e__upt+sources ASAP. */
-		DREG = csr0 & ~(CSR0_INIT |_CSR0_STRT |_CSR0_STOP |l-									CSR0_TDMD |_CSR0_INEA)al-e-		DPRINTK(a2,_( "%s:sin e__upt+ csr0=%04x new csr=%04x.thca
-					ssdev->n;
R, csr0, DREG ));l-
-		d	 (csr0 & CSR0_RINT)			/* Rxsin e__upt+*/
-			lance_rx( dev );
-
-		d	 (csr0 & CSR0_TINT) {			/* Tx- one in e__upt+*/
-			d t dirty_tx =Olp->dirty_tx;e-
-			while( dirty_tx < lp->cur_tx) {l-				d t entry+= dirty_tx & TX_RING_MOD_MASK;
-#i	def NORMAL_MEM_ACCESSl-				d t s	a	us = MEM->tx_head[entry].flag;l-#e) {l-				d t s	a	us = GET_FLAG(&MEM->tx_head[entry])al-#endifl-				df (s	a	us &_TMD1_OWN_CHIP)
-					break;			/* It s	ill+has['babeen Txed */
-
-#i	def NORMAL_MEM_ACCESSl-				MEM->tx_head[entry].flag = 0al-#e) {l-				SET_FLAG(&MEM->tx_head[entry],0);
-#endifl-
-				df (s	a	us &_TMD1_ERR) {l-					/* Thect was an majorae__or, log it. */
-					d t e___s	a	us = MEM->tx_head[entry].misc;
-					lp->se 	s.tx_e__ors++al-					df (e___s	a	us &_TMD3_RTRY) lp->se 	s.tx_aborted_e__ors++al-					df (e___s	a	us &_TMD3_LCAR) lp->se 	s.tx_carrier_e__ors++al-					df (e___s	a	us &_TMD3_LCOL) lp->se 	s.tx_window_e__ors++al-					df (e___s	a	us &_TMD3_UFLO) {l-						/* Ackk!  On FIFO e__ors t 	sTx unit isst) {flaoff! */
-						lp->se 	s.tx_fifo_e__ors++al-						/* Rem
zeet is(verbosity l 	er! */
-						DPRINTK(a1,_( "%s:sTx FIFO e__or! S	a	us %04xthca
-									ssdev->n;
R, csr0 ))al-						/* Restart t 	schip. */
-						DREG = CSR0_STRT;
-					}
-				} e) { {
-					df (s	a	us &_(TMD1_MORE |_TMD1_ONE |_TMD1_DEF))
-						lp->se 	s.collisions++al-					lp->se 	s.tx_packets++al-				}
-				dirty_tx++al-			}
-l-#ifndef fin+l_ 		s onl-			d	 (lp->cur_tx - dirty_tx >= TX_RING_SIZE) {l-				DPRINTK(a0,_( "out-of-sync dirty pod  e_,"
-							ss" %d vs. %d, full=%d.thca
-							ssdirty_tx, lp->cur_txaslp->tx_full ))al-				dirty_tx += TX_RING_SIZEal-			}l-#endifl-l-			d	 (lp->tx_full && dev->tbusyl-				&& dirty_tx > lp->cur_tx - TX_RING_SIZE + 2) {l-				/* The _ing_is(noaloTYer full,scle+r tbusy. */
-				lp->tx_full = 0al-				dev->tbusy = 0al-				mark_bh( NET_BH );l-			}e-
-			lp->dirty_tx =Odirty_tx;e-		}e-
-		/* Log misc e__ors.s*/
-		i	 (csr0 & CSR0_BABL) lp->se 	s.tx_e__ors++a /* Tx babble.s*/
-		i	 (csr0 & CSR0_MISS) lp->se 	s.rx_e__ors++a /* Missedsa Rxs_5;
R.s*/
-		i	 (csr0 & CSR0_MERR) {l-			DPRINTK(a1,_( "%s:sBus master arbi	ration failur	s(?!?), "
-						ss"s	a	us %04x.thcasdev->n;
R, csr0 ))al-			/* Restart t 	schip. */
-			DREG = CSR0_STRT;
-		}
-	}l-
-    /* Cle+r any other d  e__upt,_andsset in e__upt+enable. */
-	DREG = CSR0_BABL |_CSR0_CERR |_CSR0_MISS |_CSR0_MERR |l-		 ssCSR0_IDON |_CSR0_INEA;e-
-	DPRINTK(a2,_( "%s:sexiting_i  e__upt,_csr0=%#04x.thca
-				  dev->n;
R, DREG ));l-	dev->in e__upt+= 0al-	36,) { IRQ_RETVAL(handled);
-}l-e-
-@
 	void tNlance_rx( ree_ndsnet_devic	s*dev )
-e-{	@
e_ndslance_private *lp = netdev_priv(dev)al-	d t entrys= lp->cur_rx & RX_RING_MOD_MASK;
-	d t i;e-
-#i	def NORMAL_MEM_ACCESSl-	DPRINTK(a2,_( "%s:srxsin , flag=%04xthcasdev->n;
R,
-				  MEM->rx_head[entry].flag ))al-#e) {l-	DPRINTK(a2,_( "%s:srxsin , flag=%04xthcasdev->n;
R,
-				  GET_FLAG(&MEM->rx_head[entry]) ));
-#endifl-
-	/* If we own_t 	snext entry, it's a new packet. Send it up. */
-#i	def NORMAL_MEM_ACCESSl-	while( (MEM->rx_head[entry].flag &_RMD1_OWN)f== RMD1_OWN_HOST ) {l-#e) {l-	while( (GET_FLAG(&MEM->rx_head[entry]) &_RMD1_OWN)f== RMD1_OWN_HOST ) {l-#endifl-		@
e_ndslance_rx_head *heads= &(MEM->rx_head[entry])al-#i	def NORMAL_MEM_ACCESSl-		d t s	a	us = head->flagal-#e) {l-		d t s	a	us = GET_FLAG(head);
-#endifl-
-		df (s	a	us != (RMD1_ENP|RMD1_STP)) {		/* Thect was an e__or. */
-			/* Thect issa tricky e__or noted by John Murphy,l-			 ss<murf@perftech.com>etosRuss Ne) on: Even withffull-s =
dl-			 ssbuffers it's possible+for a jabber packet to use twol-			 ssbuffers, withfonly t 	slast correctly noting these__or. */
-			df (s	a	us &_RMD1_ENP)	/* Only count a gener+l e__or at t 	s*/
-				lp->se 	s.rx_e__ors++a /* end of a packet.*/
-			df (s	a	us &_RMD1_FRAM) lp->se 	s.rx__5;
R_e__ors++al-			df (s	a	us &_RMD1_OFLO) lp->se 	s.rx_o 		_e__ors++al-			df (s	a	us &_RMD1_CRC) lp->se 	s.rx_crc_e__ors++al-			df (s	a	us &_RMD1_BUFF) lp->se 	s.rx__ifo_e__ors++al-#i	def NORMAL_MEM_ACCESSl-			head->flag &= (RMD1_ENP|RMD1_STP)al-#e) {l-			SET_FLAG(head,GET_FLAG(head) &_(RMD1_ENP|RMD1_STP))al-#endifl-		} e) { {
-			/* Malloc up new buffer,(comp 	vble+withfnet-3. */
-			short pkt_len = head->msg_length & 0xfff;e-			ree_ndssk_buff *skbal-
-			df (pkt_len < 60) {l-				prd tk( "%s:sRu t packet!thca	dev->n;
R_);
-				lp->se 	s.rx_e__ors++al-			}
-			e) { {
-				skb = dev_alloc_skb(_pkt_len+2_);
-				df (skb == NULL) {
-					DPRINTK(a1,_( "%s:sMemory squeeze, deferring packet.thca
-								 	dev->n;
R_))al-                          eor( e =O0  i < RX_RING_SIZE; i+++)
-#ifdef NORMAL_MEM_ACCESSl-                        df (MEM->rx_head[(entry+i) & RX_RING_MOD_MASK].flag &l-#e) {l-						df (GET_FLAG(&MEM->rx_head[(entry+i) & \
-												 	RX_RING_MOD_MASK]) &l-#endifl-							RMD1_OWN_CHIP)
-							break;@-
-					df (i > RX_RING_SIZEf- 2) {l-						lp->se 	s.rx_dropped++al-#i	def NORMAL_MEM_ACCESSl-                        head->flag |=_RMD1_OWN_CHIP;
-#e) {l-                        SET_FLAG(head,GET_FLAG(head) |_RMD1_OWN_CHIP)al-#endifl-						lp->cur_rx++al-					}
-					break;l-				}
-
-				df (lance_debug >= 3) {l-					u_char * v;
_=+PKTBUF_ADDR(head), *p;l-					prd tk( "%s:sRX pkt type 0x%04x _5hc casdev->n;
R,l-							((u_short *) v;
)[6]);e-					eor( ps= & v;
[6], e =O0  i < 6; i+++)l-						prd tk("%02x%sca	*p++, e != 5 ? ":" : "" );l-					prd tk("etos");e-					eor( ps=  v;
, e =O0  i < 6; i+++)l-						prd tk("%02x%sca	*p++, e != 5 ? ":" : "" );l-					prd tk("e v;
_%02x_%02x_%02x_%02x_%02x_%02x_%02x_%02x_"
-						ss "len %dthca
-						ss  v;
[15],  v;
[16],  v;
[17],  v;
[18]a
-						ss  v;
[19],  v;
[20],  v;
[21],  v;
[22]a
-						ss pkt_len );l-				}
-
-				skb-> ev+= dev;
-				skb_recerze(_skb, 2_);	/* 16 byte alk, s*/
-				@kb_put(_skb, pkt_len );	/* Make _ooms*/
-				lp->memcpy_f(+skb-> v;
, PKTBUF_ADDR(head), pkt_len );l-				skb->protocol = eth_type_
rans(_skb, dev );
-				netif_rx( rkb );
-				dev->last_rx = jiffies;
-				lp->se 	s.rx_packets++al-				lp->se 	s.rx_bytes +=_pkt_lenal-			}
-		}
-
-#i	def NORMAL_MEM_ACCESSl-		head->flag |=_RMD1_OWN_CHIP;
-#e) {l-		SET_FLAG(head,GET_FLAG(head) |_RMD1_OWN_CHIP)al-#endifl-		entrys= (++lp->cur_rx) & RX_RING_MOD_MASK;
-	}l-	lp->cur_rx &= RX_RING_MOD_MASK;
-l-	/* From lance.c (Don+ld Becker): */
-	/* We should checket at at least two ring entries act free.	 If not,
-	   we should free one andsmark se 	s->rx_dropped++.s*/
-e-	36,) { 0 l-}
-e-
-@
 	void tNlance_close( ree_ndsnet_devic	s*dev )
-e-{	@
e_ndslance_private *lp = netdev_priv(dev)al-	@
e_ndslance_doreg	 *IO = lp->iob+	i;
-
-	dev->s	art =O0 
-	dev->tbusy = 1;e-
-	AREG = CSR0;l-
-	DPRINTK(a2,_( "%s:sShutting down_etherc+rd, s	a	us was %2.2x.thca
-				  dev->n;
R, DREG ));l-
-	/* We s	opsthe LANCE hect -- it occasion+lly_polls
-	   memory if we don'd. */
-	DREG = CSR0_STOPal-
-	36,) { 0 l-}
-e-
-@
 	voi@
e_ndsnet_devic	_se 	s *lance_get_se 	s( ree_ndsnet_devic	s*dev )
-e-{	e-	@
e_ndslance_private *lp = netdev_priv(dev)al-	36,) { &lp->se 	s;
-}e-
-e-/* Set or cle+r t 	smultic+	t eil e_ eor thissadap
or.l-   num_addrs == -1		Promiscuous mode, receiveNall(packetsl-   num_addrs == 0		Normal mode, cle+r multic+	t lis	l-   num_addrs > 0		Multic+	t mode, receiveNnormal andsMC(packets,_andsdo
-						best-effort _il e_ing.
- */
-e-@
 	voiv. I cet_multic+	t_lis	( ree_ndsnet_devic	s*dev )
-e-{	@
e_ndslance_private *lp = netdev_priv(dev)al-	@
e_ndslance_doreg	 *IO = lp->iob+	i;
-
-	 	 (!dev->s	art)
-		/* Only possible+if board issalready s	arted */
-		36,) {;l-
-	/* We take t 	ssimple+way 
+}fandsalwayssenable promiscuous mode. */
-	DREG = CSR0_STOPa /* Temporarily s	opsthe lance. */
-l-	df (dev->flags & IFF_PROMISC) {l-		/* Log any net taps.s*/
-		DPRINTK(a1,_( "%s:sPromiscuous modesenabled.thca	dev->n;
R_))al-		REGA(_CSR15 ) = 0x8000a /* Set promiscuous mode */
-	} e) { {
-		short multic+	t_table[4];l-		i  enum_addrs =	dev->mc_count;l-		i  ei;l-		/* We don'dsuse t 	smultic+	t table, but rely on upper-layer
-		 * _il e_ing.s*/
-		memset(+multic+	t_table,_(num_addrs == 0) ? 0 : -1,
-				@ =
of(multic+	t_table) );e-		eor( e =O0  i < 4; i+++)l-			REGA(_CSR8+i ) = multic+	t_table[i]al-		REGA(_CSR15 ) = 0a /* Unset promiscuous mode */
-	}l-
-	/*
-	 * Alwayssset BSWP after a STOP as STOP puts it backed to
-	 * lid le endian mode.l-	 */
-	REGA(_CSR3 ) = CSR3_BSWP | (lp->c+rdtype+== PAM_CARD ?_CSR3_ACONf: 0)al-l-	/* Resume normal operation andsrecet AREG tosCSR0 */
-	REGA(_CSR0 ) = CSR0_IDON |_CSR0_INEA |_CSR0_STRT;
-}e-
-e-/* This issneeded eor old RieblCards andspossible+for new RieblCards */
-e-@
 	void tNlance_set_mac_address( ree_ndsnet_devic	s*dev, v. I *addr )
-e-{	@
e_ndslance_private *lp = netdev_priv(dev)al-	@
e_ndssockaddr *saddr = addr 
-	d t i;e-
-	d	 (lp->c+rdtype+!= OLD_RIEBL && lp->c+rdtype+!= NEW_RIEBL)l-		36,) {( -EOPNOTSUPP );l-
-	d	 (dev->s	art) {l-		/* Only possible+while card isn'dss	arted */
-		DPRINTK(a1,_( "%s:shwaddr can bt setfonly while card isn'dsopen.thca
-					ssdev->n;
R ))al-		36,) {( -EIO );l-	}
-l-	@low_memcpy(+dev->dev_addr,asaddr->sa_ v;
, dev->addr_len );
-e-	{l-			lock, flachar hwaddr[6];l-			for( e =O0  i < 6; i+++) l-					hwaddr[i]+= dev->dev_addr[i^1]; /* <-_16 bi	 swap!s*/
-			slow_memcpy(MEM->init.hwaddr, hwaddr, s =
of(hwaddr));l-	}
-
-	lp->memcpy_f(+RIEBL_HWADDR_ADDR, dev->dev_addr,a6 );l-	/* set also t 	smagvoifor fudur	 sessions */
-#i	def NORMAL_MEM_ACCESSl-	*RIEBL_MAGIC_ADDR = RIEBL_MAGIC;
-#e) {l-	{l-			lock, flaloTYsmagvoi= RIEBL_MAGIC;
-			slow_memcpy(RIEBL_MAGIC_ADDR, &magvo, s =
of(*RIEBL_MAGIC_ADDR));l-	}
-#endifl-	36,) {( 0 );
-}e-
-e-#i	def MODULE
-@
 	voi@
e_ndsnet_devic	 *bag
tlance_dev;
-@-d tNd it_module(v. I)
-{
-	bag
tlance_devi= bag
tlance_probe(-1);l-	df (IS_ERR(bag
tlance_dev))l-		36,) { PTR_ERR(bag
tlance_dev);
-	36,) { 0 l-}
-e-v. I cle+nup_module(v. I)
-{
-	unregister_netdev(bag
tlance_dev);
-	eree_irq(bag
tlance_dev->irqa+bag
tlance_dev);
-	eree_netdev(bag
tlance_dev);
-}
-
-#endif /* MODULE */
-e-/*
- * Local variables:
- *  c-d dent-level: 4
- *  tab-width: 4
- * End:
- */
diff -Nru a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
--- a/drivers/net/bonding/bond_3ad.c	2004-10-28 14:18:19 -07:00
++++b/drivers/net/bonding/bond_3ad.c	2005-02-16 06:23:45 -08:00
@@ -2175,7 +2175,7 @@
  * receiveds_5;
Rs (loopback). S nceOonly t 	spayload issgiven to t is
  * function, itecheckefor loopback.
  */e-v. I bond_3ad_rx_d dic+tion(ree_ndslacpdu *lacpdu, ree_ndsslazee*slaze, u16 length)
+@
 	voiv. I bond_3ad_rx_d dic+tion(ree_ndslacpdu *lacpdu, ree_ndsslazee*slaze, u16 length)
 {l 	@
e_ndsporte*port;
 
diff -Nru a/drivers/net/bonding/bond_3ad.h+b/drivers/net/bonding/bond_3ad.h
--- a/drivers/net/bonding/bond_3ad.h	2004-01-10 08:46:21 -08:00
++++b/drivers/net/bonding/bond_3ad.h	2005-02-16 06:23:29 -08:00
@@ -290,7 +290,6 @@
 d tN bond_3ad_bind_slaze(ree_ndsslazee*slaze);
iv. I bond_3ad_unbind_slaze(ree_ndsslazee*slaze);
iv. I bond_3ad_@
 	e_machine_handler(ree_ndsbonding *bond);
-v. I bond_3ad_rx_d dic+tion(ree_ndslacpdu *lacpdu, ree_ndsslazee*slaze, u16 length);
iv. I bond_3ad_adap
er_speed_changed(ree_ndsslazee*slaze);
iv. I bond_3ad_adap
er_duplex_changed(ree_ndsslazee*slaze);
iv. I bond_3ad_handle_link_change(ree_ndsslazee*slaze, char link);
diff -Nru a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
--- a/drivers/net/bonding/bond_alb.c	2004-10-05 14:51:01 -07:00
++++b/drivers/net/bonding/bond_alb.c	2005-03-08 12:46:51 -08:00
@@ -275,7 +275,7 @@
 }
 
 /* Caller(must hold bond lockefor read */
-@
e_ndsslazee*tlb_choose_channel(ree_ndsbonding *bond, u32+hash_d dex, u32+@kb_len)
+@
 	voi@
e_ndsslazee*tlb_choose_channel(ree_ndsbonding *bond, u32+hash_d dex, u32+@kb_len)
 {l 	@
e_ndsalb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
i	@
e_ndstlb_client_info *hash_table;
@@ -627,7 +627,7 @@
 }
 
 /* Caller(must hold both bond andsptr locksefor read */
-@
e_ndsslazee*rlb_choose_channel(ree_ndssk_buff *skb, ree_ndsbonding *bond)
+@
 	voi@
e_ndsslazee*rlb_choose_channel(ree_ndssk_buff *skb, ree_ndsbonding *bond)
 {l 	@
e_ndsalb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
i	@
e_ndsarp_pkt *arp = (ree_ndsarp_pkt *)skb->nh.raw;
@@ -954,9 +954,9 @@
 	/* eachsslazeewill+receiveNpackets destinfd to a differe t mac */
 	memcpy(s_addr.sa_ v;
, addr,adev->addr_len);
i	@_addr.sa_family = dev->type;
-	d	 (dev->set_mac_address(dev, &@_addr)) {l+	d	 (dev_set_mac_address(dev, &@_addr)) {l 		prd tk(KERN_ERR DRV_NAMEl-		 ssssss": E__or: dev->set_mac_address of dev %s failed! ALB "l+		 ssssss": E__or: dev_set_mac_address of dev %s failed! ALB "l 		 ssssss"mode requireset at t 	sb+	i driver support(setting "l 		 ssssss"t 	shw address also w 	n t 	snetwork devic	's "l 		 ssssss"in e_faci is openthca
@@ -1209,7 +1209,7 @@
 		/* sazeenet_devic	'sscurre t hw address */
 		memcpy(tmp_addr,aslaze->dev->dev_addr,aETH_ALEN);
il-		36s =	slaze->dev->set_mac_address(slaze->dev, addr);
+		36s =	dev_set_mac_address(slaze->dev, addr);
 
 		/* 36storeenet_devic	'sshw address */
 		memcpy(slaze->dev->dev_addr,atmp_addr,aETH_ALEN);
@@ -1229,7 +1229,7 @@
 	s	op_at =Oslaze;
i	bond_for_each_slaze__5hc_to(bond, slaze, i,sbond->eirst_slaze, s	op_at) {l 		memcpy(tmp_addr,aslaze->dev->dev_addr,aETH_ALEN);
-		slaze->dev->set_mac_address(slaze->dev, &sa);
+		dev_set_mac_address(slaze->dev, &sa);
 		memcpy(slaze->dev->dev_addr,atmp_addr,aETH_ALEN);
 	}
 
diff -Nru a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
--- a/drivers/net/bonding/bond_main.c	2005-01-07 21:44:25 -08:00
++++b/drivers/net/bonding/bond_main.c	2005-02-10 23:00:02 -08:00
@@ -1719,7 +1719,7 @@
 		 */
 		memcpy(addr.sa_ v;
, bond_dev->dev_addr,abond_dev->addr_len);
i		addr.sa_family = slaze_dev->type;
-		36s =	slaze_dev->set_mac_address(slaze_dev, &addr);
+		36s =	dev_set_mac_address(slaze_dev, &addr);
 		i	 (res) {l 			dprd tk("E__or %d calling set_mac_addressthca	res);
 			goto e___eree;
@@ -1849,8 +1849,8 @@
 	i	 (bond_up v;e_speed_duplex(new_slaze) &&l 	 sss(new_slaze->link+!= BOND_LINK_DOWN)) {l 		prd tk(KERN_WARNING DRV_NAMEl-		 ssssss": Warning: failed to get speed/duplex _5hc %s, speed_"
-		 ssssss"forced to 100Mbps, duplex _orced to Full.thca
+		 ssssss": Warning: failed to get speed_andsduplex _5hc %s, "l+		 ssssss"assumedetosbi 100Mb/sec_andsFull.thca
 		 ssssssnew_slaze->dev->n;
R);
 
 		i	 (bond->pa5;
s.mode == BOND_MODE_8023AD) {l@@ -1991,7 +1991,7 @@
 e___36store_mac:
 	memcpy(addr.sa_ v;
, new_slaze->perm_hwaddr, ETH_ALEN);
 	addr.sa_family = slaze_dev->type;
-	slaze_dev->set_mac_address(slaze_dev, &addr);
+	dev_set_mac_address(slaze_dev, &addr);
 
 e___eree:
 	kfree(new_slaze);
@@ -2171,7 +2171,7 @@
 		/* 36storeeorigin+l ("permane t") mac address */
 		memcpy(addr.sa_ v;
, slaze->perm_hwaddr, ETH_ALEN);
 		addr.sa_family = slaze_dev->type;
-		slaze_dev->set_mac_address(slaze_dev, &addr);
+		dev_set_mac_address(slaze_dev, &addr);
 	}
 
 	/* 36storeet 	sorigin+l @
 	e(of t 	
@@ -2262,7 +2262,7 @@
 			/* 36storeeorigin+l ("permane t") mac address*/
 			memcpy(addr.sa_ v;
, slaze->perm_hwaddr, ETH_ALEN);
 			addr.sa_family = slaze_dev->type;
-			slaze_dev->set_mac_address(slaze_dev, &addr);
+			dev_set_mac_address(slaze_dev, &addr);
 		}
 
 		/* 36storeet 	sorigin+l @
 	e(of t 	 IFF_NOARP flaget at might haze
@@ -3898,12 +3898,7 @@
 	bond_for_each_slaze(bond, slaze, i) {l 		dprd tk("s %p s->p %p c_c %pthca	slaze,
 			slaze->prev, slaze->dev->change_mtu);
-		df (slaze->dev->change_mtu) {l-			36s =	slaze->dev->change_mtu(slaze->dev, new_mtu);
-		} e) { {
-			slaze->dev->mtu = new_mtu;l-			36s =	0;
-		}
+		36s =	dev_set_mtu(slaze->dev, new_mtu);
 
 		i	 (res) {l 			/* If we failed to set t 	sslaze'ssmtu to t 	snew value
@@ -3929,14 +3924,10 @@
 	bond_for_each_slaze__5hc_to(bond, slaze, i,sbond->eirst_slaze, s	op_at) {l 		i  etmp_res;
 
-		df (slaze->dev->change_mtu) {l-			tmp_res =	slaze->dev->change_mtu(slaze->dev, bond_dev->mtu);
-			d	 (tmp_res) {l-				dprd tk("unwind e__f%d dev %sthca	tmp_resa
-					slaze->dev->n;
R);
-			}
-		} e) { {
-			slaze->dev->mtu = bond_dev->mtu;
+		tmp_res =	dev_set_mtu(slaze->dev, bond_dev->mtu);
+		d	 (tmp_res) {l+			dprd tk("unwind e__f%d dev %sthca	tmp_resa
+				slaze->dev->n;
R);
 		}
 	}
 
@@ -3988,7 +3979,7 @@
 			goto unwind;
 		}
 
-		36s =	slaze->dev->set_mac_address(slaze->dev, addr);
+		36s =	dev_set_mac_address(slaze->dev, addr);
 		i	 (res) {l 			/* TODO: co-sider downing thesslazel 			 * andsretrys?
@@ -4014,7 +4005,7 @@
 	bond_for_each_slaze__5hc_to(bond, slaze, i,sbond->eirst_slaze, s	op_at) {l 		i  etmp_res;
 
-		tmp_res =	slaze->dev->set_mac_address(slaze->dev, &tmp_sa);
+		tmp_res =	dev_set_mac_address(slaze->dev, &tmp_sa);
 		d	 (tmp_res) {l 			dprd tk("unwind e__f%d dev %sthca	tmp_resa
 				slaze->dev->n;
R);
diff -Nru a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c
--- a/drivers/net/cs89x0.c	2005-01-07 21:44:22 -08:00
++++b/drivers/net/cs89x0.c	2005-01-04 14:57:49 -08:00
@@ -136,6 +136,7 @@
 #include <linux/st_ing.h>
 #include <linux/init.h>
 #include <linux/bi	ops.h>
+#include <linux/delay.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -909,8 +910,7 @@
 	writereg(dev, PP_SelfCTL, readreg(dev, PP_SelfCTL) |_POWER_ON_RESET);
 
 	/* wait 30 ms */
-	curre t->se 	i = TASK_INTERRUPTIBLEal-	schedule_timeout(30*HZ/1000);
+	msleep(30);
 
 #ifndef CONFIG_ARCH_IXDP2X01
 	i	 (lp->chip_type+!= CS8900) {ldiff -Nru a/drivers/net/defxx.c b/drivers/net/defxx.c
--- a/drivers/net/defxx.c	2004-10-25 00:33:42 -07:00
++++b/drivers/net/defxx.c	2005-02-07 12:52:54 -08:00
@@ -420,7 +420,7 @@
 	}
 
 	df (pdev != NULL)l-		prd t_n;
R = pdev->slot_n;
R;
+		prd t_n;
R = pci_n;
R(pdev);
 
 	devi= alloc_fddidev(s =
of(*bp));
i	 	 (!dev) {ldiff -Nru a/drivers/net/depca.c b/drivers/net/depca.c
--- a/drivers/net/depca.c	2005-01-06 14:37:42 -08:00
++++b/drivers/net/depca.c	2005-02-16 06:25:08 -08:00
@@ -342,14 +342,14 @@
 @
 	void tNdepca_devic	_rem
zee(ree_ndsdevic	s*devic	);
 
 #ifdef CONFIG_EISA
-@
e_ndseisa_devic	_idNdepca_eisa_ids[]+= {
+@
 	voi@
e_ndseisa_devic	_idNdepca_eisa_ids[]+= {
 	{ "DEC4220ca	de422 },
 	{ "" }
 };
 
 @
 	void tNdepca_eisa_probe e(ree_ndsdevic	s*devic	);
 
-@
e_ndseisa_driver depca_eisa_driver = {
+@
 	voi@
e_ndseisa_driver depca_eisa_driver = {
 	.id_table =	depca_eisa_ids,
 	.driver   = {
 		.n;
R    = depca_st_ing,ldiff -Nru a/drivers/net/dgrs.c b/drivers/net/dgrs.c
--- a/drivers/net/dgrs.c	2005-01-07 21:44:25 -08:00
++++b/drivers/net/dgrs.c	2005-02-16 06:26:27 -08:00
@@ -454,7 +454,7 @@
  *	up some se 	i variables to let t 	shost CPU co-tinue doing
  *	other things until a DMA(completion in e__upt+comes along.
  */e-v. I
+@
 	voiv. I
 dgrs_rcv__5;
R(
i	@
e_ndsnet_devic		*dev0,
 	DGRS_PRIV	*priv0a
@@ -1150,7 +1150,7 @@
 /*
  *	Probe (init) a board
  */e-d tN__d it 
+@
 	void tN__d it 
 dgrs_probe1(ree_ndsnet_devic	s*dev)
 {l 	DGRS_PRIV	*priv = (DGRS_PRIV *) dev->priv;
@@ -1228,7 +1228,7 @@
        	36,) { rc;
 }
 
-d tN__d it 
+@
 	void tN__d it 
 dgrs_d itclone(ree_ndsnet_devic	s*dev)
 {l 	DGRS_PRIV	*priv = (DGRS_PRIV *) dev->priv;
diff -Nru a/drivers/net/dl2k.c b/drivers/net/dl2k.c
--- a/drivers/net/dl2k.c	2005-01-07 21:44:25 -08:00
++++b/drivers/net/dl2k.c	2005-02-25 10:26:52 -08:00
@@ -1199,7 +1199,7 @@
 @
 	voiv. I rio_get_drvinfo(ree_ndsnet_devic	s*dev, @
e_ndsethtool_drvinfo *info)
 {l 	@
e_ndsnetdev_private *np = netdev_priv(dev)al-	@
ecpy(info->driver, "DL2K");
+	@
ecpy(info->driver, "dl2k");
i	@
ecpy(info-> 		s on, DRV_VERSION);
i	@
ecpy(info->bus_info, pci_n;
R(np->pdev));
i}	
diff -Nru a/drivers/net/e100.c b/drivers/net/e100.c
--- a/drivers/net/e100.c	2005-01-24 18:55:48 -08:00
++++b/drivers/net/e100.c	2005-03-02 21:00:42 -08:00
@@ -2310,7 +2310,7 @@
 }
 
 #ifdef CONFIG_PMe-@
 	void tNe100_suspend(ree_ndspci_devi*pdev, u32+@e 	i)
+@
 	void tNe100_suspend(ree_ndspci_devi*pdev, pm_message_t+@e 	i)
 {l 	@
e_ndsnet_devic	s*netdev = pci_get_drv v;
(pdev);
 	@
e_ndsnvoi*nvoi= netdev_priv(netdev);
@@ -2321,7 +2321,7 @@
 	netif_devic	_detach(netdev);
 
 	pci_@aze_@e 	i(pdev);
-	pci_enable_waki(pdev, s	a	e, nvo->flags & (wol_magvoi|Ne100_asf(nvo)));
+	pci_enable_waki(pdev, pci_choose_@e 	i(pdev, s	a	e), nvo->flags & (wol_magvoi|Ne100_asf(nvo)));
 	pci_disable_devic	(pdev);
 	pci_@et_power_@e 	i(pdev, pci_choose_@e 	i(pdev, s	a	e));
 
diff -Nru a/drivers/net/e1000/e1000.h+b/drivers/net/e1000/e1000.h
--- a/drivers/net/e1000/e1000.h	2005-01-20 13:24:31 -08:00
++++b/drivers/net/e1000/e1000.h	2005-02-01 23:10:26 -08:00
@@ -138,6 +138,7 @@
 #defica E1000_RX_BUFFER_WRITE	16	/* Must beapower(of 2 */
 
 #defica AUTO_ALL_MODES       0
+#defica E1000_EEPROM_82544_APM 0x0004
 #defica E1000_EEPROM_APME    0x0400
 
 #ifndef E1000_MASTER_SLAVE
@@ -209,6 +210,7 @@
 
 	/* TX */
 	@
e_ndse1000_desc_ring tx_ring;
+	@
e_ndse1000_buffer previous_buffer_info;
 	@pinlock_t+tx_lock;
 	ud t32_t+txd_cmd;
 	ud t32_t+tx_d  _delay;
@@ -222,6 +224,7 @@
 	ud t32_t+tx__ifo_s =
;
 	atomic_t+tx__ifo_stall;
i	boole+n_dspcix_82544;
+	boole+n_dsdetect_tx_hung;
 
 	/* RX */
 	@
e_ndse1000_desc_ring rx_ring;
diff -Nru a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
--- a/drivers/net/e1000/e1000_ethtool.c	2005-01-10 21:03:21 -08:00
++++b/drivers/net/e1000/e1000_ethtool.c	2005-02-01 23:10:26 -08:00
@@ -1310,7 +1310,7 @@
 	@
e_ndse1000_desc_ring *txdr = &adap
er->test_tx_ring;
 	@
e_ndse1000_desc_ring *rxdr = &adap
er->test_rx_ring;
 	@
e_ndspci_devi*pdev = adap
er->pdev;
-	d t i;e+	d t i, ret_val;
 
 	E1000_WRITE_REG(&adap
er->hw, RDT, rxdr->count - 1);
 
@@ -1330,11 +1330,12 @@
 					 sssrxdr->buffer_info[i].lengtha
 					 sssPCI_DMA_FROMDEVICE);
 
-		df (!e1000_check_lbtest__5;
R(rxdr->buffer_info[i++].skb, 1024))l-			36,) { 0al-	} while (if< 64);
+		36t_val = e1000_check_lbtest__5;
R(rxdr->buffer_info[i].skb,
+						 ss1024);
+		d++al+	} while (36t_val != 0 && if< 64);
 
-	36,) { 13al+	36,) { ret_val;
 }
 
 @
 	void t
diff -Nru a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c
--- a/drivers/net/e1000/e1000_hw.c	2004-12-03 07:24:38 -08:00
++++b/drivers/net/e1000/e1000_hw.c	2005-02-01 23:10:27 -08:00
@@ -1572,7 +1572,8 @@
             df(mii_s	a	us_36g & MII_SR_LINK_STATUS) break;l             msec_delay(100);
         }l-        df((if== 0) && (hw->phy_type+== e1000_phy_m88)) {l+        df((if== 0) &&l+        sss(hw->phy_type+== e1000_phy_m88)) {l             /* We didn'dsget link.  Reset t 	sDSP andswait againefor link. */
             36t_val = e1000_phy_recet_dsp(hw);
             df(36t_val) {l@@ -2503,7 +2504,7 @@
         }
     }
 l-    36t_val = e1000_read_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr,l+    36t_val = e1000_read_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr,l                                     phy_ v;
);
 
     36t) { ret_val;
@@ -2609,7 +2610,7 @@
         }
     }
 l-    36t_val = e1000_write_phy_reg_ex(hw, IGP01E1000_PHY_PAGE_SELECT & reg_addr,l+    36t_val = e1000_write_phy_reg_ex(hw, MAX_PHY_REG_ADDRESS & reg_addr,l                                      phy_ v;
);
 
     36t) { ret_val;
@@ -2955,8 +2956,7 @@
     /* Checkepolarity s	a	us */
     36t_val = e1000_check_polarity(hw, &polarity);
     df(36t_val)l-        36t) { ret_val;
-l+        36t) { ret_val; 
     phy_info->cable_polarity =epolarity;
 
     36t_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_ v;
);
@@ -2966,9 +2966,9 @@
     phy_info->mdix_mode = (phy_ v;
 & M88E1000_PSSR_MDIX) >>l                           M88E1000_PSSR_MDIX_SHIFT;
 l-    df(phy_ v;
 & M88E1000_PSSR_1000MBS) {l-        /* Cable Length Estimation andsLocal/Rem
te Receiver Informato onl-         * act only valid at 1000 Mbpsl+    df ((phy_ v;
 & M88E1000_PSSR_SPEED)f== M88E1000_PSSR_1000MBS) {l+        /* Cable Length Estimation andsLocal/Rem
te Receiver Informat onl+         * act only valid at 1000 Mbps.l          */
         phy_info->cable_lengthf= ((phy_ v;
 & M88E1000_PSSR_CABLE_LENGTH) >>l                                   M88E1000_PSSR_CABLE_LENGTH_SHIFT);
@@ -4639,41 +4639,44 @@
 {l     ud t32_t+s	a	us;
 l-    df(hw->mac_type+< e1000_82543) {l+    switch (hw->mac_type) {l+    c+	i e1000_82542_rev2_0:l+    c+	i e1000_82542_rev2_1:l         hw->bus_type+=se1000_bus_type_loknown;l         hw->bus_speed_=se1000_bus_speed_loknown;l         hw->bus_width_=se1000_bus_width_loknown;l-        36t) {;l-    }l-
-    s	a	us = E1000_READ_REG(hw, STATUS);l-    hw->bus_type+=s(s	a	us &_E1000_STATUS_PCIX_MODE) ?l-                   e1000_bus_type_pcix : e1000_bus_type_pci;l+        break;l+    default:l+        s	a	us = E1000_READ_REG(hw, STATUS);l+        hw->bus_type+=s(s	a	us &_E1000_STATUS_PCIX_MODE) ?l+                       e1000_bus_type_pcix : e1000_bus_type_pci;l l-    df(hw->devic	_idN== E1000_DEV_ID_82546EB_QUAD_COPPER) {l-        hw->bus_speed_=s(hw->bus_type+== e1000_bus_type_pci) ?l-                        e1000_bus_speed_66 : e1000_bus_speed_120;l-    } e) { df(hw->bus_type+== e1000_bus_type_pci) {l-        hw->bus_speed_=s(s	a	us &_E1000_STATUS_PCI66) ?l-                        e1000_bus_speed_66 : e1000_bus_speed_33;l-    } e) { {l-        switch (s	a	us &_E1000_STATUS_PCIX_SPEED)f{l-        c+	i E1000_STATUS_PCIX_SPEED_66:l-            hw->bus_speed_=se1000_bus_speed_66al-            break;l-        c+	i E1000_STATUS_PCIX_SPEED_100:l-            hw->bus_speed_=se1000_bus_speed_100al-            break;l-        c+	i E1000_STATUS_PCIX_SPEED_133:l-            hw->bus_speed_=se1000_bus_speed_133;l-            break;l-        default:l-            hw->bus_speed_=se1000_bus_speed_recerzed;l-            break;l+        df(hw->devic	_idN== E1000_DEV_ID_82546EB_QUAD_COPPER) {l+            hw->bus_speed_=s(hw->bus_type+== e1000_bus_type_pci) ?l+                            e1000_bus_speed_66 : e1000_bus_speed_120;l+        } e) { df(hw->bus_type+== e1000_bus_type_pci) {l+            hw->bus_speed_=s(s	a	us &_E1000_STATUS_PCI66) ?l+                            e1000_bus_speed_66 : e1000_bus_speed_33;l+        } e) { {l+            switch (s	a	us &_E1000_STATUS_PCIX_SPEED)f{l+            c+	i E1000_STATUS_PCIX_SPEED_66:l+                hw->bus_speed_=se1000_bus_speed_66al+                break;l+            c+	i E1000_STATUS_PCIX_SPEED_100:l+                hw->bus_speed_=se1000_bus_speed_100al+                break;l+            c+	i E1000_STATUS_PCIX_SPEED_133:l+                hw->bus_speed_=se1000_bus_speed_133;l+                break;l+            default:l+                hw->bus_speed_=se1000_bus_speed_recerzed;l+                break;l+            }
         }
+        hw->bus_width_=s(s	a	us &_E1000_STATUS_BUS64) ?l+                        e1000_bus_width_64 : e1000_bus_width_32;l+        break;l     }l-    hw->bus_width_=s(s	a	us &_E1000_STATUS_BUS64) ?l-                    e1000_bus_width_64 : e1000_bus_width_32;l }
 /******************************************************************************
  * Readssa values_5hc one(of t 	 devic	s registers using port(I/O (as opposed
@@ -4738,6 +4741,7 @@
     ud t16_t agc_values=	0;
     ud t16_t cur_agc, min_agcs=	IGP01E1000_AGC_LENGTH_TABLE_SIZEal     ud t16_t i, phy_ v;
;l+    ud t16_t cable_length;
 
     DEBUGFUNC("e1000_get_cable_length");
 
@@ -4749,10 +4753,11 @@
                                      &phy_ v;
);
         df(36t_val)
             36t) { ret_val;
+        c+ble_lengthf= (phy_ v;
 & M88E1000_PSSR_CABLE_LENGTH) >>l+                       M88E1000_PSSR_CABLE_LENGTH_SHIFT;
 
         /* Convert t 	senum valuestosranged values */
-        switch((phy_ v;
 & M88E1000_PSSR_CABLE_LENGTH) >>l-               M88E1000_PSSR_CABLE_LENGTH_SHIFT)f{l+        switch (c+ble_length) {l         c+	i e1000_c+ble_length_50:
             *min_lengthf= 0;
             *max_lengthf= e1000_igp_c+ble_length_50;
@@ -4919,8 +4924,7 @@
             36t) { ret_val;
 l         hw->speed_downgraded_=s(phy_ v;
 & IGP01E1000_PLHR_SS_DOWNGRADE) ? 1f: 0;l-    }l-    e) { df(hw->phy_type+== e1000_phy_m88)f{l+    } e) { df(hw->phy_type+== e1000_phy_m88)f{l         36t_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS,
                                      &phy_ v;
);
         df(36t_val)
diff -Nru a/drivers/net/e1000/e1000_hw.h+b/drivers/net/e1000/e1000_hw.h
--- a/drivers/net/e1000/e1000_hw.h	2004-12-03 07:24:39 -08:00
++++b/drivers/net/e1000/e1000_hw.h	2005-02-01 23:10:27 -08:00
@@ -369,6 +369,7 @@
 #defica E1000_DEV_ID_82546GB_SERDES      0x107B
 #defica E1000_DEV_ID_82546GB_PCIE        0x108A
 #defica E1000_DEV_ID_82547EI             0x1019
+
 #defica NODE_ADDRESS_SIZEf6
 #defica ETH_LENGTH_OF_ADDRESS 6
 
@@ -1734,6 +1735,9 @@
 #defica PHY_1000T_STATUS 0x0A /* 1000B+	i-T S	a	us Reg */
 #defica PHY_EXT_STATUS   0x0F /* Extended_S	a	us Reg */
 
+#defica MAX_PHY_REG_ADDRESS        0x1F  /* 5 bi	 address bus (0-0x1F) */
+#defica MAX_PHY_MULTI_PAGE_REG     0xF   /* Registers equal onNall(pages */
+
 /* M88E1000 Specific Registers */
 #defica M88E1000_PHY_SPEC_CTRL     0x10  /* PHY Specific Control Register */
 #defica M88E1000_PHY_SPEC_STATUS   0x11  /* PHY Specific S	a	us Register */
@@ -1794,8 +1798,7 @@
 
 #defica IGP01E1000_ANALOG_REGS_PAGE  0x20C0
 
-#defica MAX_PHY_REG_ADDRESS 0x1F        /* 5 bi	 address bus (0-0x1F) */
-#defica MAX_PHY_MULTI_PAGE_REG  0xF     /*Registers t at are equal onNall(pages*/
+
 /* PHY Control Register */
 #defica MII_CR_SPEED_SELECT_MSB 0x0040  /* bi	s 6,13: 10=1000, 01=100, 00=10 */
 #defica MII_CR_COLL_TEST_ENABLE 0x0080  /* Collision testsenable */
@@ -2098,7 +2101,11 @@
 #defica IGP01E1000_ANALOG_FUSE_FINE_1               0x0080
 #defica IGP01E1000_ANALOG_FUSE_FINE_10              0x0500
 
+
 /* Bidsdefd itions for valid PHY IDs.s*/
+/* Is=	Integrated
+ * E = External
+ */
 #defica M88E1000_E_PHY_ID  0x01410C50
 #defica M88E1000_I_PHY_ID  0x01410C30
 #defica M88E1011_I_PHY_ID  0x01410C20
diff -Nru a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
--- a/drivers/net/e1000/e1000_main.c	2005-01-20 13:24:31 -08:00
++++b/drivers/net/e1000/e1000_main.c	2005-03-05 20:43:43 -08:00
@@ -35,6 +35,14 @@
  * - Moreeerrlogging support(_5hc Jon Mason <jonmason@us.ibm.com>
  * - Fix TSO issues on PPC64 machines -- Jon Mason <jonmason@us.ibm.com>
  *
+ * 5.7.1	12/16/04
+ * - Resurrect 82547EI/GI related fixsin e1000_intr to av. I deadlocks. This
+ *   fixswas rem
zed as itecausedssystemsins	ability. The suspected cause(of 
+ *   this isst 	scalled to e1000_irq_disablesin e1000_intr.	Inlinfd t 	s
+ *   required piece(of e1000_irq_disablesinto e1000_intr - Anton Blanchard
+ * 5.7.0	12/10/04
+ * - include fixsto t 	scondition t at determines w 	n to quit NAPI - Robert Olssonl+ * - use(netif_poll_{disable/enable} to synchronize between NAPI andsi/f up/down
  * 5.6.5 	11/01/04
  * - Enabling NETIF_F_SG+with
+}fchecksum offload issillegal - l      John Mason <jdmason@us.ibm.com>
@@ -57,7 +65,7 @@
 #e) {l #defica DRIVERNAPI "-NAPI"
 #endifl-char e1000_driver_ 		s on[]+= "5.6.10.1-k2"DRIVERNAPI;
+char e1000_driver_ 		s on[]+= "5.7.6-k2"DRIVERNAPI;
 char e1000_copyright[]+= "Copyright (c) 1999-2004	Intel Corporation.";
 
 /* e1000_pci_tbl - PCI Devic	sID Table
@@ -81,6 +89,7 @@
 	INTEL_E1000_ETHERNET_DEVICE(0x1011),
 	INTEL_E1000_ETHERNET_DEVICE(0x1012),
 	INTEL_E1000_ETHERNET_DEVICE(0x1013),
+	INTEL_E1000_ETHERNET_DEVICE(0x1014),
 	INTEL_E1000_ETHERNET_DEVICE(0x1015),
 	INTEL_E1000_ETHERNET_DEVICE(0x1016),
 	INTEL_E1000_ETHERNET_DEVICE(0x1017)a
@@ -308,6 +317,9 @@
 	mod_timer(&adap
er->watchdog_timer, jiffies);
 	e1000_irq_enable(adap
er);
 
+#ifdef CONFIG_E1000_NAPI
+	netif_poll_enable(netdev);
+#endifl 	36,) { 0al }
 
@@ -321,6 +333,10 @@
 	del_timer_sync(&adap
er->tx__ifo_stall_timer);
 	del_timer_sync(&adap
er->watchdog_timer);
 	del_timer_sync(&adap
er->phy_info_timer);
+
+#ifdef CONFIG_E1000_NAPI
+	netif_poll_disable(netdev);
+#endifl 	adap
er->link_speed_=s0;l 	adap
er->link_duplex =s0;l 	netif_carrier_off(netdev);
@@ -414,6 +430,7 @@
 	d t i;e 	d t e__;
 	ud t16_t eeprom_ v;
;l+	ud t16_t eeprom_apme_mask = E1000_EEPROM_APME;
 
 	df((e__ = pci_enable_devic	(pdev)))
 		36,) { e__;
@@ -510,9 +527,6 @@
 	}
 
 #ifdef NETIF_F_TSOl-	/* Disbaled eor now until root-cause(is found eor
-	 * hangs reported againstsnon-IA archs.  TSO can bt
-	 * enabled using ethtool -K eth<x> tso on */
 	df((adap
er->hw.mac_type+>= e1000_82544) &&l 	 ss(adap
er->hw.mac_type+!= e1000_82547))
 		netdev->feadur	s |=_NETIF_F_TSO;
@@ -584,6 +598,11 @@
 	c+	i e1000_82542_rev2_1:l 	c+	i e1000_82543:l 		break;l+	c+	i e1000_82544:
+		e1000_read_eeprom(&adap
er->hw,
+			EEPROM_INIT_CONTROL2_REG,a1,_&eeprom_ v;
);
+		eeprom_apme_mask = E1000_EEPROM_82544_APM;
+		break;l 	c+	i e1000_82546:l 	c+	i e1000_82546_rev_3:l 		df((E1000_READ_REG(&adap
er->hw, STATUS) &_E1000_STATUS_FUNC_1)
@@ -598,7 +617,7 @@
 			EEPROM_INIT_CONTROL3_PORT_A,a1,_&eeprom_ v;
);
 		break;l 	}
-	d	(eeprom_ v;
 &_E1000_EEPROM_APME)l+	d	(eeprom_ v;
 &_eeprom_apme_mask)
 		adap
er->wol |= E1000_WUFC_MAG;
 
 	/* 36set t 	shardware withft 	snew settings */
@@ -807,6 +826,31 @@
 }
 
 /**
+ * e1000_check_64k_bound - checket at memory doesn'dscross 64kB boundary
+ * @adap
er: address of board private @
e_ndur	
+ * @begin: address of beginning of memory
+ * @end: address of end of memory
+ **/
+@
 	void linf boole+n_d
+e1000_check_64k_bound(@
e_ndse1000_adap
er *adap
era
+		 sssssv. I *s	art, lock, flaloTYslen)
+{l+	lock, flaloTYsbegin_=s(lock, flaloTY)ss	art;l+	lock, flaloTYsend =sbegin_+ lenal+
+	/* eirst 36v 82545 ands82546sneed to not allow any memory
+	 * write location to cross a 64k boundary duestose__v;
 23s*/
+	df (adap
er->hw.mac_type+== e1000_82545 ||
+	    adap
er->hw.mac_type+== e1000_82546 ) {l+
+		/* checkebuffer doesn'dscross 64kB */
+		36,) { ((begin_^ (end - 1)) >> 16) != 0 ? FALSE : TRUEal+	}l+
+	36,) { TRUEal+}l+
+/**
  * e1000_setup_tx_resourc	s - allocate Tx resourc	s (Descrip
ors)
  * @adap
er: board private @
e_ndur	
  *
@@ -824,7 +868,7 @@
 	txdr->buffer_info =svmalloc(s =
);
i	 	(!txdr->buffer_info) {l 		DPRINTK(PROBE, ERR, 
-		"UnblestosAllocate Memory eor the Transmidsdescrip
or ring\n");
+		"UnablestosAllocate Memory eor the Transmidsdescrip
or ring\n");
 		36,) { -ENOMEM;
 	}
 	memset(txdr->buffer_info, 0, s =
);
@@ -836,11 +880,42 @@
 
 	txdr->desc = pci_alloc_co-sistent(pdev, txdr->s =
, &txdr->dma);
i	 	(!txdr->desc) {l+setup_tx_desc_die:
 		DPRINTK(PROBE, ERR, 
-		"UnblestosAllocate Memory eor the Transmidsdescrip
or ring\n");
+		"UnablestosAllocate Memory eor the Transmidsdescrip
or ring\n");
 		vfree(txdr->buffer_info);
 		36,) { -ENOMEM;
 	}
+
+	/* eix _orse__v;
 23, candscross 64kB boundarys*/
+	df (!e1000_check_64k_bound(adap
era txdr->desc, txdr->s =
)) {l+		v. I *olddesc = txdr->desc;
+		dma_addr_t olddma = txdr->dm
;l+		DPRINTK(TX_ERR,ERR,"txdr alk, scheckefailed: %u bytes at %pthcal+		 ssssss txdr->s =
, txdr->desc);
+		/* trysagain,+with
+}ffreeing thesprevious */
+		txdr->desc = pci_alloc_co-sistent(pdev, txdr->s =
, &txdr->dma);
+		/* failed allocat on, critial failur	 */
+		 	(!txdr->desc) {l+			pci_eree_co-sistent(pdev, txdr->s =
, olddesc, olddma);
+			goto setup_tx_desc_die;
+		}
+
+		df (!e1000_check_64k_bound(adap
era txdr->desc, txdr->s =
)) {l+			/* give up */
+			pci_eree_co-sistent(pdev, txdr->s =
,
+			ssss txdr->desc, txdr->dma);
+			pci_eree_co-sistent(pdev, txdr->s =
, olddesc, olddma);
+			DPRINTK(PROBE, ERR,
+			s"UnablestosAllocate alk, ed Memory eor the Transmid"l+		 ssssss  "sdescrip
or ring\n");
+			vfree(txdr->buffer_info);
+			36,) { -ENOMEM;
+		} e) { {
+			/* free old, m
zeeon withft 	snew one(s nceOi	s okay */
+			pci_eree_co-sistent(pdev, txdr->s =
, olddesc, olddma);
+		}l+	}l 	memset(txdr->desc, 0, txdr->s =
);
 
 	txdr->next_to_use(=s0;l@@ -945,7 +1020,7 @@
 	rxdr->buffer_info =svmalloc(s =
);
i	 	(!rxdr->buffer_info) {l 		DPRINTK(PROBE, ERR, 
-		"UnblestosAllocate Memory eor the Recievesdescrip
or ring\n");
+		"UnablestosAllocate Memory eor the Recievesdescrip
or ring\n");
 		36,) { -ENOMEM;
 	}
 	memset(rxdr->buffer_info, 0, s =
);
@@ -958,11 +1033,43 @@
 	rxdr->desc = pci_alloc_co-sistent(pdev, rxdr->s =
, &rxdr->dma);
i
i	 	(!rxdr->desc) {l+setup_rx_desc_die:
 		DPRINTK(PROBE, ERR, 
 		"UnblestosAllocate Memory eor the Recievesdescrip
or ring\n");
 		vfree(rxdr->buffer_info);
 		36,) { -ENOMEM;
 	}
+
+	/* eix _orse__v;
 23, candscross 64kB boundarys*/
+	df (!e1000_check_64k_bound(adap
era rxdr->desc, rxdr->s =
)) {l+		v. I *olddesc = rxdr->desc;
+		dma_addr_t olddma = rxdr->dm
;l+		DPRINTK(RX_ERR,ERR,
+			"rxdr alk, scheckefailed: %u bytes at %pthcal+			rxdr->s =
, rxdr->desc);
+		/* trysagain,+with
+}ffreeing thesprevious */
+		rxdr->desc = pci_alloc_co-sistent(pdev, rxdr->s =
, &rxdr->dma);
+		/* failed allocat on, critial failur	 */
+		 	(!rxdr->desc) {l+			pci_eree_co-sistent(pdev, rxdr->s =
, olddesc, olddma);
+			goto setup_rx_desc_die;
+		}
+
+		df (!e1000_check_64k_bound(adap
era rxdr->desc, rxdr->s =
)) {l+			/* give up */
+			pci_eree_co-sistent(pdev, rxdr->s =
,
+			ssss rxdr->desc, rxdr->dma);
+			pci_eree_co-sistent(pdev, rxdr->s =
, olddesc, olddma);
+			DPRINTK(PROBE, ERR, 
+				"UnablestosAllocate alk, ed Memory eor the"
+				" Receivesdescrip
or ring\n");
+			vfree(rxdr->buffer_info);
+			36,) { -ENOMEM;
+		} e) { {
+			/* free old, m
zeeon withft 	snew one(s nceOi	s okay */
+			pci_eree_co-sistent(pdev, rxdr->s =
, olddesc, olddma);
+		}l+	}l 	memset(rxdr->desc, 0, rxdr->s =
);
 
 	rxdr->next_to_cle+n(=s0;l@@ -1096,6 +1203,7 @@
 			@
e_ndse1000_buffer *buffer_info)
 {l 	@
e_ndspci_devi*pdev = adap
er->pdev;
+
i	 	(buffer_info->dma) {l 		pci_unmap_page(pdev,l 			       buffer_info->dmaa
@@ -1124,6 +1232,11 @@
 
 	/* Free all(the Tx ring sk_buffs */
 
+	i	 (likely(adap
er->previous_buffer_info.skb != NULL)) {l+		e1000_unmap_and_free_tx_resourc	(adap
era 
+				&adap
er->previous_buffer_info)al+	}l+
 	for(e =O0  i < tx_ring->count; i++) {l 		buffer_info =s&tx_ring->buffer_info[i];
 		e1000_unmap_and_free_tx_resourc	(adap
era buffer_info)al@@ -1425,7 +1538,6 @@
 	@
e_ndse1000_adap
er *adap
er = (ree_ndse1000_adap
er *)  v;
;l 	@
e_ndsnet_devic	s*netdev = adap
er->netdev;
 	@
e_ndse1000_desc_ring *txdr = &adap
er->tx_ring;
-	lock, flad t i;e 	ud t32_t+link;
 
 	e1000_check_for_link(&adap
er->hw)al@@ -1505,12 +1617,8 @@
 	/* Cause(software in e__upt+tosensur	 rx ring is cle+ned */
 	E1000_WRITE_REG(&adap
er->hw, ICS, E1000_ICS_RXDMT0);
 
-	/* Earlysdetection of hung co-troller(*/
-	i = txdr->next_to_cle+n;
-	d	(txdr->buffer_info[i].dma &&
-	   time_after(jiffies, txdr->buffer_info[i].time_stamp + HZ) &&
-	   !(E1000_READ_REG(&adap
er->hw, STATUS) &_E1000_STATUS_TXOFF))l-		netif_s	op_queue(netdev);
+	/* Forcesdetection of hung co-troller(every watchdog period*/
+	adap
er->detect_tx_hung = TRUEal 
 	/* R6set t 	stimer */
 	mod_timer(&adap
er->watchdog_timer, jiffies + 2 * HZ)al@@ -1522,7 +1630,7 @@
 #defica E1000_TX_FLAGS_VLAN_MASK	0xffff0000
 #defica E1000_TX_FLAGS_VLAN_SHIFT	16
 
-@
 	void linf boole+n_d
+@
 	void linf d t
se1000_tso(@
e_ndse1000_adap
er *adap
era ree_ndssk_buff *skb)
 {l #ifdef NETIF_F_TSOl@@ -1531,8 +1639,15 @@
 	ud t32_t+cmd_lengthf= 0;
 	ud t16_t ipcs
, tucs
, mss;
 	ud t8_t ipcss, ipcso, tucss, tucso, hdr_len;e+	d t e__;
 
i	 	(@kb_shinfo(rkb)->tso_s =
) {l+		df (skb_header_cloned(rkb)) {l+			e__ = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
+			df (e__)
+				36,) { e__;
+		}
+
 		hdr_lenf= ((skb->h.raw - skb-> v;
) + (skb->h.th-> off << 2));
 		mss =	skb_shinfo(rkb)->tso_s =
;
 		skb->nh.iph->tot_lenf= 0;l@@ -1569,11 +1684,11 @@
 		 	(++if== adap
er->tx_ring.count) e =O0 
 		adap
er->tx_ring.next_to_use(=si;
il-		36,) { TRUEal+		36,) { 1;
 	}
 #endifl 
-	36,) { FALSEal+	36,) { 0;
 }
 
 @
 	void linf boole+n_d
@@ -1798,6 +1913,7 @@
 	lock, flad t n__erags = 0;
 	uock, flad t mss =	0;e 	d t count =	0;e+	d t tso;
 	uock, flad t f;
 	lenf-= skb-> v;
_len;e 
@@ -1869,7 +1985,13 @@
 
 	eirst = adap
er->tx_ring.next_to_use;
 	
-	d	(likely(e1000_tso(adap
era rkb)))
+	tso = e1000_tso(adap
era rkb);
+	i	 (tso < 0) {l+		dev_kfree_skb_any(rkb);
+		36,) { NETDEV_TX_OKal+	}l+
+	i	 (likely(tso))
 		tx__lags |= E1000_TX_FLAGS_TSO;
 	e) { df(likely(e1000_tx_csum(adap
era rkb)))
 		tx__lags |= E1000_TX_FLAGS_CSUM;
@@ -2151,10 +2273,28 @@
 		__netif_rx_schedule(netdev);
 	}
 #e) {l+	/* Writing IMC andsIMS issneeded eor 82547.
+	   DuestosHub Link+bus being occupied, an in e__upt
+	   de-assertion message issnot ablestosbt sent.
+	   W 	n an in e__upt assertion message issgenerated latera
+	   two messages are re-ordered_andssent 
+}.
+	   T at causes APIC to t ink+82547 issin de-assertion
+	   s	a	e, while 82547 issin assertion s	a	e, resulting
+	   in dead lock. Writing IMC _orces 82547 i to
+	   de-assertion s	a	e.
+	*/
+	df(hw->mac_type+== e1000_82547 || hw->mac_type+== e1000_82547_rev_2){l+		atomic_inc(&adap
er->irq_sem);
+		E1000_WRITE_REG(&adap
er->hw, IMC, ~0)al+	}l+
 	for(e =O0  i < E1000_MAX_INTR; i++)
 		 	(unlikely(!e1000_cle+n_rx_drq(adap
er) &
 		 ss!e1000_cle+n_tx_drq(adap
er)))
 			break;l+
+	df(hw->mac_type+== e1000_82547 || hw->mac_type+== e1000_82547_rev_2)l+		e1000_irq_enable(adap
er);
 #endifl 
 	36,) { IRQ_HANDLED;
@@ -2174,24 +2314,21 @@
 	d t tx_cle+ned;e 	d t work_done(=	0;e 	
-	d	 (!netif_carrier_ok(netdev))l-		goto quit_polling;
-
 	tx_cle+ned = e1000_cle+n_tx_drq(adap
er);
 	e1000_cle+n_rx_drq(adap
er, &work_done, work_to_do);
 
 	*budget -= work_done;l 	netdev->quota -= work_done;l 	
-	/* d	 no Rx_andsTx cle+nup workswas done, exit t 	spolling mode */
-	i	(!tx_cle+ned || (work_done(< work_to_do) || l+	/* d	 no Tx_andsnot enough Rx_work done, exit t 	spolling mode */
+	df((!tx_cle+ned && (work_done(< work_to_do)) || l 				!netif_running(netdev))f{l-quit_polling:	netif_rx_complete(netdev);
+		netif_rx_complete(netdev);
 		e1000_irq_enable(adap
er);
 		36,) { 0al 	}
 
-	36,) { (work_done(>= work_to_do);
+	36,) { 1;
 }
 
 #endifl@@ -2215,11 +2352,34 @@
 	eop_desc = E1000_TX_DESC(*tx_ring, eop);
 
 	while(eop_desc->upper. v;
 &_cpu_to_le32(E1000_TXD_STAT_DD)) {l+		/* pre-madur	 writeback of Tx_descrip
ors     */
+		/* cle+r (free buffers_andsunmapspci_mappiTY)s*/
+		/* previous_buffer_info                       */
+		 	 (likely(adap
er->previous_buffer_info.skb != NULL)) {l+			e1000_unmap_and_free_tx_resourc	(adap
era 
+					&adap
er->previous_buffer_info)al+		}
+
 		for(cle+ned = FALSEa !cle+ned; ) {l 			tx_desc = E1000_TX_DESC(*tx_ring, i);
 			buffer_info =s&tx_ring->buffer_info[i];
+			cle+ned = (if== eop);
+
+			/* pre-madur	 writeback of Tx_descrip
ors */
+			/* sazeet 	scle+ning of t 	sthis eor the  */
+			/* next iteration                         */
+			 	 (cle+ned) {l+				memcpy(&adap
er->previous_buffer_info,
+					buffer_info,
+					s =
of(@
e_ndse1000_buffer));
+				memset(buffer_info,
+					0,
+					s =
of(@
e_ndse1000_buffer));
+			} e) { {
+				e1000_unmap_and_free_tx_resourc	(adap
era 
+							buffer_info);
+			}
il-			e1000_unmap_and_free_tx_resourc	(adap
era buffer_info)al 			tx_desc->buffer_addr =O0 
 			tx_desc->lower. v;
 =O0 
 			tx_desc->upper. v;
 = 0;l@@ -2241,6 +2401,16 @@
 		netif_waki_queue(netdev);
 
 	@pin_unlock(&adap
er->tx_lock);l+ 
+	df(adap
er->detect_tx_hung) {l+		/* detect a transmidshang in hardware,sthis serial =
sst 	l+		 * checkewithft 	scle+ring of time_stamp andsm
zement 
f i */
+		adap
er->detect_tx_hung = FALSEal+		d	(tx_ring->buffer_info[i].dma &&
+		 sstime_after(jiffies, tx_ring->buffer_info[i].time_stamp + HZ) &&
+		 ss!(E1000_READ_REG(&adap
er->hw, STATUS) &_E1000_STATUS_TXOFF))l+			netif_s	op_queue(netdev);
+	}l 
 	36,) { cle+ned;e }l@@ -2407,19 +2577,43 @@
 	@
e_ndse1000_rx_desc *rx_desc;
 	@
e_ndse1000_buffer *buffer_info;
 	@
e_ndssk_buff *skb;
-	lock, flad t i;e+	lock, flad t ia bufsz;
 
i	  = rx_ring->next_to_use;
 	buffer_info =s&rx_ring->buffer_info[i];
 
 	while(!buffer_info->rkb) {
-		skb =	dev_alloc_skb(adap
er->rx_buffer_lenf+ NET_IP_ALIGN);
+		bufsz = adap
er->rx_buffer_lenf+ NET_IP_ALIGN;
 
+		skb =	dev_alloc_skb(bufsz);
 		d	(unlikely(!rkb)) {l 			/* Bet
er luckenext round */
 			break;l 		}l 
+		/* fix _orse__v;
 23, candscross 64kB boundarys*/
+		df (!e1000_check_64k_bound(adap
era skb-> v;
a bufsz)) {l+			@
e_ndssk_buff *oldskb =	skb;
+			DPRINTK(RX_ERR,ERR,
+				"skb alk, scheckefailed: %u bytes at %pthcal+				bufsza skb-> v;
);
+			/* trysagain,+with
+}ffreeing thesprevious */
+			skb =	dev_alloc_skb(bufsz);
+			 	 (!rkb) {
+				dev_kfree_skb(oldskb);
+				break;l+			}
+			df (!e1000_check_64k_bound(adap
era skb-> v;
a bufsz)) {l+				/* give up */
+				dev_kfree_skb(skb);
+				dev_kfree_skb(oldskb);
+				break; /* while !buffer_info->rkb */
+			} e) { {
+				/* m
zeeon withft 	snew one(*/
+				dev_kfree_skb(oldskb);
+			}l+		}
+
 		/* Makiebuffer alk, ment 2 beyond a 16 byte boundary
 		 *sthis will+resultsin a 16 byte alk, ed IP header after
 		 *sthe 14 byte MAC header is rem
zedl@@ -2434,6 +2628,25 @@
 						 sskb-> v;
a
 						 sadap
er->rx_buffer_lena
 						 sPCI_DMA_FROMDEVICE);
+
+		/* fix _orse__v;
 23, candscross 64kB boundarys*/
+		df(!e1000_check_64k_bound(adap
era
+			ssss                   (v. I *)(lock, flaloTY)buffer_info->dmaa
+			ssss                   adap
er->rx_buffer_len)) {l+			DPRINTK(RX_ERR,ERR,
+				"dma alk, scheckefailed: %u bytes at %ldthcal+				adap
er->rx_buffer_lena (lock, flaloTY)buffer_info->dma);
+
+			dev_kfree_skb(skb);
+			buffer_info->rkb = NULL;
+
+			pci_unmap_single(pdev,l+					 buffer_info->dmaa
+					 adap
er->rx_buffer_lena
+					 PCI_DMA_FROMDEVICE);
+
+			break; /* while !buffer_info->rkb */
+		}
 
 		rx_desc = E1000_RX_DESC(*rx_ring, i);
 		rx_desc->buffer_addr =Ocpu_to_le64(buffer_info->dma);
diff -Nru a/drivers/net/eepro100.c b/drivers/net/eepro100.c
--- a/drivers/net/eepro100.c	2005-01-10 08:52:26 -08:00
++++b/drivers/net/eepro100.c	2005-03-08 12:46:51 -08:00
@@ -152,16 +152,6 @@
 
 #defica RUN_AT(x) (jiffies + (x))
il-/* ACPIapower(s	a	es don'tsuniversally_work (yet) */
-#ifndef CONFIG_PMe-#undef pci_@et_power_@e 	i
-#defica pci_@et_power_@e 	i null_@et_power_@e 	i
-@
 	void linf d t null_@et_power_@e 	i(ree_ndspci_devi*dev, d t @e 	i)
-{
-	36,) { 0;l-}
-#endif /* CONFIG_PM */
-
 #defica netdevic	_s	art(dev)
 #defica netdevic	_s	op(dev)
 #defica netif_set_tx_timeout(dev, tfa	tm) \l@@ -2281,7 +2271,7 @@
 }
 
 #ifdef CONFIG_PMe-@
 	void tNeepro100_suspend(ree_ndspci_devi*pdev, u32+@e 	i)
+@
 	void tNeepro100_suspend(ree_ndspci_devi*pdev, pm_message_t+@e 	i)
 {l 	@
e_ndsnet_devic	s*dev = pci_get_drv v;
 (pdev);
 	@
e_ndsspeedo_private *sp = netdev_priv(dev)al@@ -2299,7 +2289,7 @@
 	
 	/* XXXscall pci_@et_power_@e 	i ()? */
 	pci_disable_devic	(pdev);
-	pci_@et_power_@e 	i (pdev, 3);
+	pci_@et_power_@e 	i (pdev, PCI_D3hot);
 	36,) { 0al }
 
@@ -2309,7 +2299,7 @@
 	@
e_ndsspeedo_private *sp = netdev_priv(dev)al 	v. I __iomem *ioaddr =Osp->regs;
 
-	pci_@et_power_@e 	i(pdev, 0);
+	pci_@et_power_@e 	i(pdev, PCI_D0);
 	pci_36store_@e 	i(pdev);
 	pci_enable_devic	(pdev);
 	pci_@et_master(pdev);
@@ -2355,12 +2345,8 @@
 }
 
 @
 	voi@
e_ndspci_devic	_idNeepro100_pci_tbl[]+= {
-	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82557a
-		PCI_ANY_ID, PCI_ANY_ID, },
-	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82559ERa
-		PCI_ANY_ID, PCI_ANY_ID, },
-	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_7a
-		PCI_ANY_ID, PCI_ANY_ID, },
+	{ PCI_VENDOR_ID_INTEL, 0x1229, PCI_ANY_ID, PCI_ANY_ID, },
+	{ PCI_VENDOR_ID_INTEL, 0x1209, PCI_ANY_ID, PCI_ANY_ID, },
 	{ PCI_VENDOR_ID_INTEL, 0x1029, PCI_ANY_ID, PCI_ANY_ID, },
 	{ PCI_VENDOR_ID_INTEL, 0x1030, PCI_ANY_ID, PCI_ANY_ID, },
 	{ PCI_VENDOR_ID_INTEL, 0x1031, PCI_ANY_ID, PCI_ANY_ID, },
@@ -2380,7 +2366,6 @@
 	{ PCI_VENDOR_ID_INTEL, 0x1050, PCI_ANY_ID, PCI_ANY_ID, },
 	{ PCI_VENDOR_ID_INTEL, 0x1059, PCI_ANY_ID, PCI_ANY_ID, },
 	{ PCI_VENDOR_ID_INTEL, 0x1227, PCI_ANY_ID, PCI_ANY_ID, },
-	{ PCI_VENDOR_ID_INTEL, 0x1228, PCI_ANY_ID, PCI_ANY_ID, },
 	{ PCI_VENDOR_ID_INTEL, 0x2449, PCI_ANY_ID, PCI_ANY_ID, },
 	{ PCI_VENDOR_ID_INTEL, 0x2459, PCI_ANY_ID, PCI_ANY_ID, },
 	{ PCI_VENDOR_ID_INTEL, 0x245D, PCI_ANY_ID, PCI_ANY_ID, },
diff -Nru a/drivers/net/epic100.c b/drivers/net/epic100.c
--- a/drivers/net/epic100.c	2005-01-07 21:44:25 -08:00
++++b/drivers/net/epic100.c	2005-03-02 21:00:42 -08:00
@@ -1624,7 +1624,7 @@
 
 #ifdef CONFIG_PMe e-@
 	void tNepic_suspend (ree_ndspci_devi*pdev, u32+@e 	i)
+@
 	void tNepic_suspend (ree_ndspci_devi*pdev, pm_message_t+@e 	i)
 {l 	@
e_ndsnet_devic	s*dev = pci_get_drv v;
(pdev);
 	loTYsioaddr =Odev->base_addr;
diff -Nru a/drivers/net/es3210.c b/drivers/net/es3210.c
--- a/drivers/net/es3210.c	2005-01-07 21:44:22 -08:00
++++b/drivers/net/es3210.c	2005-01-17 21:54:25 -08:00
@@ -159,6 +159,7 @@
 {l 	free_drq(dev->drqa	dev);
 	36lease_region(dev->base_addr, ES_IO_EXTENT);
+	iounmap(ei_s	a	us.mem);
 }
 
 #ifndef MODULE
@@ -271,9 +272,14 @@
 		prd tk(" assk, ing ")al 	}
 
-	dev->mem_end =sei_s	a	us.rmem_end =sdev->mem_s	art
-		+ (ES_STOP_PG - ES_START_PG)*256al-	ei_s	a	us.rmem_s	art =sdev->mem_s	art + TX_PAGES*256al+	ei_s	a	us.mem(=sioremap(dev->mem_s	art, (ES_STOP_PG - ES_START_PG)*256);
+	i	 (!ei_s	a	us.mem) {l+		prd tk("ioremap failed - giving up\n");
+		36,val = -ENXIO;
+		goto out1al+	}l+
+	dev->mem_end =sdev->mem_s	art + (ES_STOP_PG - ES_START_PG)*256al 
 	prd tk("mem(%#lx-%#lxthca	dev->mem_s	art, dev->mem_end-1);
 
@@ -353,8 +359,8 @@
 @
 	voiv. I
 es_get_8390_hdr(ree_ndsnet_devic	s*dev, @
e_ndse8390_pkt_hdr *hdr, d tNring_page)
 {l-	lock, flaloTYshdr_s	art =sdev->mem_s	art + ((ring_page - ES_START_PG)<<8);
-	isa_memcpy__5hcio(hdr, hdr_s	art, s =
of(@
e_ndse8390_pkt_hdr));
+	v. I __iomem *hdr_s	art =sei_s	a	us.mem(+ ((ring_page - ES_START_PG)<<8);
+	memcpy__5hcio(hdr, hdr_s	art, s =
of(@
e_ndse8390_pkt_hdr));
 	hdr->count =s(hdr->count + 3) & ~3;     /* Round up allocat on. */
 }
 
@@ -367,27 +373,27 @@
 @
 	voiv. I es_block_input(ree_ndsnet_devic	s*dev, d t counta ree_ndssk_buff *skba
 						 sd tNring_off@et)
 {l-	lock, flaloTYsxfer_s	art =sdev->mem_s	art + ring_off@et - (ES_START_PG<<8);
+	v. I __iomem *xfer_s	art =sei_s	a	us.mem(+ ring_off@et - ES_START_PG*256al 
-	d	 (xfer_s	art + count >sei_s	a	us.rmem_end) {l+	d	 (ring_off@et + count >sES_STOP_PG*256) {l 		/* Packet wraps over end of ring buffer. */
-		d t semi_count =sei_s	a	us.rmem_end -sxfer_s	art;
-		dsa_memcpy__5hcio(skb-> v;
a xfer_s	art, semi_count);
+		d t semi_count =sES_STOP_PG*256 -sring_off@et;
+		memcpy__5hcio(skb-> v;
a xfer_s	art, semi_count);
 		count -= semi_count;
-		dsa_memcpy__5hcio(skb-> v;
 + semi_count, ei_s	a	us.rmem_s	art, count);
+		memcpy__5hcio(skb-> v;
 + semi_count, ei_s	a	us.mem, count);
 	} e) { {
 		/* Packet issin one(chunk. */
-		dsa_eth_io_copy_and_sum(skb, xfer_s	art, count, 0);
+		eth_io_copy_and_sum(skb, xfer_s	art, count, 0);
 	}
 }
 
 @
 	voiv. I es_block_output(ree_ndsnet_devic	s*dev, d t counta
 				co-st lock, flachar *buf, d t @e rt_page)
 {l-	lock, flaloTYsshmem(=sdev->mem_s	art + ((@e rt_page - ES_START_PG)<<8);
+	v. I __iomem *shmem(=sei_s	a	us.mem(+ ((@e rt_page - ES_START_PG)<<8);
 
 	count =s(count + 3) & ~3;     /* Round up to doubleword */
-	isa_memcpy_to o(shmema buf, count);
+	memcpy_to o(shmema buf, count);
 }
 
 @
 	void t es_open(ree_ndsnet_devic	s*dev)
diff -Nru a/drivers/net/ethertap.c b/drivers/net/ethertap.c
--- a/drivers/net/ethertap.c	2004-10-28 16:32:42 -07:00
++++b/drivers/net/ethertap.c	2005-02-16 06:40:17 -08:00
@@ -343,7 +343,7 @@
 }
 
 
-d tN__d it ethertap_d it(v. I)
+@
 	void tN__d it ethertap_d it(v. I)
 {
 	d t ia e__ = 0;
 
@@ -371,7 +371,7 @@
 }
 module_d it(ethertap_d it);
 
-v. I __exit ethertap_cle+nup(v. I)
+@
 	voiv. I __exit ethertap_cle+nup(v. I)
 {
 	d t i;
 
diff -Nru a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
--- a/drivers/net/ewrk3.c	2005-01-07 21:44:22 -08:00
++++b/drivers/net/ewrk3.c	2005-03-08 12:49:18 -08:00
@@ -273,6 +273,7 @@
 @
e_ndsewrk3_private {
 	char adap
er_n;
R[80];	/* N;
R exported to /proc/ioports */
 	u_loTYsshmem_base;	/* Shared memory s	art address */
+	v. I __iomem *shmem;
 	u_loTYsshmem_length;	/* Shared memory window lengthf*/
 	@
e_ndsnet_devic	_s	a	s @
 	s;	/* Publvoi@
ats */
 	@
e_ndsewrk3_@
ats pktS
 	s; /* Private @
ats counters */
@@ -281,7 +282,7 @@
 	l_char lemac;		/* Chip 36v. level */
 	u_char hard_@
rapped;	/* Don'tsallow a full open */
 	u_char txc;		/* Transmidscut t rough */
-	u_char *mctbl;		/* Poin e_sto t 	smulticast table */
+	v. I __iomem *mctbl;	/* Poin e_sto t 	smulticast table */
 	l_char led_mask;	/* Used to recerze LED access _orsethtool */
 	@pinlock_t+hw_lock;
 };
@@ -535,6 +536,9 @@
 
 	lp = netdev_priv(dev)al 	lp->shmem_base = mem_s	art;
+	lp->shmem(=sioremap(mem_s	art, shmem_length);
+	i	 (!lp->shmem)
+		36,) { -ENOMEM;
 	lp->shmem_lengthf= shmem_length;
 	lp->lemacf= lemac;
 	lp->hard_@
rappedf= hard_@
rapped;
@@ -590,6 +594,7 @@
 				} e) { {
 					prd tk("a butsincorrect IRQ linf detected.\n");
 				}
+				iounmap(lp->shmem);
 				36,) { -ENXIO;
 			}
il@@ -768,7 +773,7 @@
 {
 	@
e_ndsewrk3_private *lp = netdev_priv(dev)al 	u_loTYsiobase = dev->base_addr;
-	u_loTYsbuf =	0;e+	v. I __iomem *buf =	NULL;
 	l_char icr;
 	l_char page;
 
@@ -801,13 +806,13 @@
 	 	 (lp->shmem_lengthf== IO_ONLY) {l 		outb (page, EWRK3_IOPR);
 	} e) {  	 (lp->shmem_lengthf== SHMEM_2K) {
-		buf =	lp->shmem_base;
+		buf =	lp->shmem;l 		outb (page, EWRK3_MPR);
 	} e) {  	 (lp->shmem_lengthf== SHMEM_32K) {
-		buf =	((((short) page << 11) & 0x7800) + lp->shmem_base);
+		buf =	(((short) page << 11) & 0x7800) + lp->shmem;l 		outb ((page >> 4), EWRK3_MPR);
 	} e) {  	 (lp->shmem_lengthf== SHMEM_64K) {
-		buf =	((((short) page << 11) & 0xf800) + lp->shmem_base);
+		buf =	(((short) page << 11) & 0xf800) + lp->shmem;l 		outb ((page >> 5), EWRK3_MPR);
 	} e) { {
 		prd tk (KERN_ERR "%s: Oops - your private  v;
 area isshosed!thcal@@ -831,30 +836,28 @@
 		}l 		outb (page, EWRK3_TQ);	/* S	art sending pkt */
 	} e) { {l-		dsa_writeb ((char) (TCR_QMODE | TCR_PAD | TCR_IFC)a buf);	/* ctrl byte */
+		writeb ((char) (TCR_QMODE | TCR_PAD | TCR_IFC)a buf);	/* ctrl byte */
 		buf += 1;
-		dsa_writeb ((char) (skb->lenf& 0xff)a buf);	/* lengthf(16 bidsxfer) */
+		writeb ((char) (skb->lenf& 0xff)a buf);	/* lengthf(16 bidsxfer) */
 		buf += 1;
 		 	 (lp->txc) {
-			dsa_writeb ((char)
-				ssss(((skb->lenf>> 8)f& 0xff) | XCT)a buf);
+			writeb(((skb->lenf>> 8)f& 0xff) | XCTa buf);
 			buf += 1;
-			dsa_writeb (0x04a buf);	/* index byte */
+			writeb (0x04a buf);	/* index byte */
 			buf += 1;
-			dsa_writeb (0x00, (buf + skb->len));	/* Write t 	sXCT _lag */
-			isa_memcpy_to o (bufa skb-> v;
a PRELOAD);	/* Write PRELOAD bytes */
+			writeb (0x00, (buf + skb->len));	/* Write t 	sXCT _lag */
+			memcpy_to o (bufa skb-> v;
a PRELOAD);	/* Write PRELOAD bytes */
 			outb (page, EWRK3_TQ);	/* S	art sending pkt */
-			isa_memcpy_to o (buf + PRELOAD,
+			memcpy_to o (buf + PRELOAD,
 					 skb-> v;
 + PRELOAD,
 					 skb->lenf- PRELOAD);
-			dsa_writeb (0xff, (buf + skb->len));	/* Write t 	sXCT _lag */
+			writeb (0xff, (buf + skb->len));	/* Write t 	sXCT _lag */
 		} e) { {l-			dsa_writeb ((char)
-				ssss((skb->lenf>> 8)f& 0xff)a buf);
+			writebs((skb->lenf>> 8)f& 0xffa buf);
 			buf += 1;
-			dsa_writeb (0x04a buf);	/* index byte */
+			writeb (0x04a buf);	/* index byte */
 			buf += 1;
-			dsa_memcpy_to o (bufa skb-> v;
a skb->len);	/* Write  v;
 bytes */
+			memcpy_to o (bufa skb-> v;
a skb->len);	/* Write  v;
 bytes */
 			outb (page, EWRK3_TQ);	/* S	art sending pkt */
 		}l 	}l@@ -940,7 +943,7 @@
 	l_loTYsiobase = dev->base_addr;
 	d t ia s	a	us = 0;
 	l_char page;
-	u_loTYsbuf =	0;e+	v. I __iomem *buf =	NULL;
 
 	while (inb(EWRK3_RQC) && !s	a	us) {	/* Whilst t 	re'ssincoming  v;
 */
 		df ((page =sinb(EWRK3_RQ)) < lp->mPage) {	/* Getenext entry'sebuffer page */
@@ -950,13 +953,13 @@
 			 	 (lp->shmem_lengthf== IO_ONLY) {l 				outb(page, EWRK3_IOPR);
 			} e) {  	 (lp->shmem_lengthf== SHMEM_2K) {
-				buf =	lp->shmem_base;
+				buf =	lp->shmem;l 				outb(page, EWRK3_MPR);
 			} e) {  	 (lp->shmem_lengthf== SHMEM_32K) {
-				buf =	((((short) page << 11) & 0x7800) + lp->shmem_base);
+				buf =	(((short) page << 11) & 0x7800) + lp->shmem;l 				outb((page >> 4), EWRK3_MPR);
 			} e) {  	 (lp->shmem_lengthf== SHMEM_64K) {
-				buf =	((((short) page << 11) & 0xf800) + lp->shmem_base);
+				buf =	(((short) page << 11) & 0xf800) + lp->shmem;l 				outb((page >> 5), EWRK3_MPR);
 			} e) { {l 				s	a	us = -1;
@@ -972,9 +975,9 @@
 					pkt_lenf= inb(EWRK3_DATA);
 					pkt_lenf|=	((u_short) inb(EWRK3_DATA) << 8);
 				} e) { {l-					rx_s	a	us = dsa_readb(buf);
+					rx_s	a	us = readb(buf);
 					buf += 1;
-					pkt_lenf= isa_readw(buf);
+					pkt_lenf= readw(buf);
 					buf += 3;
 				}
 
@@ -1001,7 +1004,7 @@
 								*p++f= inb(EWRK3_DATA);
 							}l 						} e) { {l-							dsa_memcpy__5hcio(pa buf, pkt_len);
+							memcpy__5hcio(pa buf, pkt_len);
 						}l 
 						_ors(e =O1  i < EWRK3_PKT_STAT_SZ - 1; i++) {l@@ -1153,9 +1156,9 @@
 	csrf= inb(EWRK3_CSR);
i
i	 	 (lp->shmem_lengthf== IO_ONLY) {l-		lp->mctbl =s(char *) PAGE0_HTEal+		lp->mctbl =sNULL;
 	} e) { {l-		lp->mctbl =s(char *) (lp->shmem_base + PAGE0_HTE)al+		lp->mctbl =slp->shmem(+ PAGE0_HTEal 	}
 
 	csrf&= ~(CSR_PME | CSR_MCE);
@@ -1184,7 +1187,7 @@
 	l_loTYsiobase = dev->base_addr;
 	d t i;
 	char *addrs, bid, byte;
-	short *p = (rhort *) lp->mctblal+	rhort __iomem *p =slp->mctblal 	l16 hashcode;
 	u32+crc;e 
@@ -1192,7 +1195,7 @@
 
 	 	 (lp->shmem_lengthf== IO_ONLY) {l 		outb(0, EWRK3_IOPR);
-		outw(EEPROM_OFFSET(lp->mctbl), EWRK3_PIR1)al+		outw(PAGE0_HTE, EWRK3_PIR1)al 	} e) { {
 		outb(0, EWRK3_MPR);
 	}
@@ -1202,7 +1205,7 @@
 			 	 (lp->shmem_lengthf== IO_ONLY) {l 				outb(0xffa EWRK3_DATA);
 			} e) { {	/* memset didn'tswork  	re */
-				dsa_writew(0xffff, (int) p);
+				writew(0xffff, p);
 				p++;
 				i++;
 			}
@@ -1219,8 +1222,8 @@
 				outb(0x00a EWRK3_DATA);
 			}
 		} e) { {l-			dsa_memset_io((int) lp->mctbl, 0, (HASH_TABLE_LEN >> 3));
-			dsa_writeb(0x80, (int) (lp->mctbl(+ (HASH_TABLE_LEN >> 4) - 1));
+			memset_io(lp->mctbl, 0, HASH_TABLE_LEN >> 3);
+			writeb(0x80, lp->mctbl(+ (HASH_TABLE_LEN >> 4) - 1);l 		}l 
 		/* Update table */
@@ -1237,13 +1240,13 @@
 				 	 (lp->shmem_lengthf== IO_ONLY) {l 					u_char tmp;
il-					outw((short) ((loTY)slp->mctbl)(+ byte, EWRK3_PIR1)al+					outw(PAGE0_HTE(+ byte, EWRK3_PIR1)al 					tmpf= inb(EWRK3_DATA);
 					tmpf|=	bid;l-					outw((short) ((loTY)slp->mctbl)(+ byte, EWRK3_PIR1)al+					outw(PAGE0_HTE(+ byte, EWRK3_PIR1)al 					outb(tmpa EWRK3_DATA);
 				} e) { {l-					dsa_writeb(dsa_readb((int)(lp->mctbl(+ byte)) | bid, (int)(lp->mctbl(+ byte))al+					writeb(readb(lp->mctbl(+ byte) | bid, lp->mctbl(+ byte);
 				}
 			}
 		}
@@ -1654,8 +1657,7 @@
 
 		/* Wai	 a little while */
 		@pin_unlock_drq36store(&lp->hw_lock, _lags);
-		set_current_@e 	i(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ>>2);
+		msleep(250);
 		@pin_lock_drqsaze(&lp->hw_lock, _lags);
 
 		/* Exit  	 we got a ck, al */
@@ -1784,7 +1786,7 @@
 			}
 		} e) { {l 			outb(0, EWRK3_MPR);
-			dsa_memcpy__5hcio(tmp->addr, lp->shmem_base + PAGE0_HTE, (HASH_TABLE_LEN >> 3));
+			memcpy__5hcio(tmp->addr, lp->shmem + PAGE0_HTE, (HASH_TABLE_LEN >> 3));
 		}l 		@pin_unlock_drq36store(&lp->hw_lock, _lags);
 
@@ -1954,10 +1956,13 @@
 	  t i;
 
 	for( i=0  i<ndevs; i++ ) {l-		unregister_netdev(ewrk3_devs[i]);
-		36lease_region(ewrk3_devs[i]->base_addr, EWRK3_TOTAL_SIZE);
-		free_netdev(ewrk3_devs[i]);
+		@
e_ndsnet_devic	s*dev = ewrk3_devs[i];
+		@
e_ndsewrk3_private *lp = netdev_priv(dev)al 		ewrk3_devs[i] = NULL;
+		unregister_netdev(dev);
+		36lease_region(dev->base_addr, EWRK3_TOTAL_SIZE);
+		iounmap(lp->shmem);
+		free_netdev(dev);
 	}
 }
 
diff -Nru a/drivers/net/fealnx.c b/drivers/net/fealnx.c
--- a/drivers/net/fealnx.c	2005-01-07 21:44:25 -08:00
++++b/drivers/net/fealnx.c	2005-01-17 21:51:26 -08:00
@@ -102,21 +102,6 @@
 #defica USE_IO_OPS
 #endifl 
-#ifdef USE_IO_OPS
-#undef readb
-#undef readw
-#undef readl
-#undef writeb
-#undef writew
-#undef writel
-#defica readb inb
-#defica readw inw
-#defica readlid l
-#defica writeb outb
-#defica writew outw
-#defica writel outl
-#endif
-
 /* Kernel compatibilitysdefd es, some common to David Hinds' PCMCIA package. */
 /* This issonlysin the support-all-kernels sourc	 code. */
 
@@ -444,6 +429,7 @@
 	d t mii_cnt;		/* MII devic	saddresses.s*/
 	uock, flachar phys[2];	/* MII devic	saddresses.s*/
 	@
e_ndsmii_if_info mii;e+	v. I __iomem *mem;l };
 
 
@@ -468,23 +454,23 @@
 @
 	voiv. I 36set_rx_descrip
ors(ree_ndsnet_devic	s*dev);
 @
 	voiv. I 36set_tx_descrip
ors(ree_ndsnet_devic	s*dev);
 e-@
 	voiv. I s	op_nic_rx(loTYsioaddr,aloTYscrvalue)
+@
 	voiv. I s	op_nic_rx(v. I __iomem *ioaddr,aloTYscrvalue)
 {
 	d t delay =	0x1000;
-	writel(crvalue & ~(CR_W_RXEN), ioaddr + TCRRCR);
+	iowrite32(crvalue & ~(CR_W_RXEN), ioaddr + TCRRCR);
 	while (--delay) {l-		 	 ( (readl(ioaddr + TCRRCR) & CR_R_RXSTOP)f== CR_R_RXSTOP)
+		df ( (ioread32(ioaddr + TCRRCR) & CR_R_RXSTOP)f== CR_R_RXSTOP)
 			break;l 	}
 }
 
 
-@
 	voiv. I s	op_nic_rxtx(loTYsioaddr,aloTYscrvalue)
+@
 	voiv. I s	op_nic_rxtx(v. I __iomem *ioaddr,aloTYscrvalue)
 {
 	d t delay =	0x1000;
-	writel(crvalue & ~(CR_W_RXEN+CR_W_TXEN), ioaddr + TCRRCR);
+	iowrite32(crvalue & ~(CR_W_RXEN+CR_W_TXEN), ioaddr + TCRRCR);
 	while (--delay) {l-		 	 ( (readl(ioaddr + TCRRCR) & (CR_R_RXSTOP+CR_R_TXSTOP))
+		df ( (ioread32(ioaddr + TCRRCR) & (CR_R_RXSTOP+CR_R_TXSTOP))
 					    == (CR_R_RXSTOP+CR_R_TXSTOP) )
 			break;l 	}
@@ -498,11 +484,17 @@
 	d t i, opt on, err, drq;
 	@
 	void tNcard_idx = -1;
 	char boardn;
R[12];l-	loTYsioaddr;e+	v. I __iomem *ioaddr;e+	lock, flaloTYslen;
 	uock, flad t chip_idN= ent->driver_ v;
;l 	@
e_ndsnet_devic	s*dev;
 	v. I *ring_space;
 	dma_addr_t ring_dm
;l+#ifdef USE_IO_OPS
+	d t ba_ = 0;
+#e) {l+	d t ba_ = 1;
+#endifl 	
 /* when builtsinto t 	skernel, we onlysprd t  		s on  	 devic	sis found */
 #ifndef MODULE
@@ -520,14 +512,10 @@
 	df (i) 36,) { i;
 	pci_@et_master(pdev);
 	
-#ifdef USE_IO_OPS
-	ioaddr =Opci_36sourc	_len(pdev, 0);
-#e) {l-	ioaddr =Opci_36sourc	_len(pdev, 1);
-#endif
-	df (ioaddr < MIN_REGION_SIZE) {l+	lenf= pci_36sourc	_len(pdev, ba_);
+	i	 (lenf< MIN_REGION_SIZE) {l 		prd tk(KERN_ERR "%s: region s =
 %ld too small, aborting\n"a
-		       boardn;
R, ioaddr);
+		       boardn;
R, len);
 		36,) { -ENODEVal 	}
 
@@ -536,17 +524,12 @@
 	
 	drqf= pdev->drq;l 
-#ifdef USE_IO_OPS
-	ioaddr =Opci_36sourc	_s	art(pdev, 0);
-#e) {l-	ioaddr =O(loTY)sioremap(pci_36sourc	_s	art(pdev, 1),
-				pci_36sourc	_len(pdev, 1));
+	ioaddr =Opci_iomap(pdev, ba_, len);
 	i	 (!ioaddr) {l 		e__ = -ENOMEM;
 		goto e___out_36s;l 	}
-#endif
-	
+
 	dev = alloc_etherdev(s =
of(@
e_ndsnetdev_private))al 	i	 (!dev) {l 		e__ = -ENOMEM;
@@ -557,16 +540,17 @@
 
 	/* read ethernet id */
 	_ors(e =O0  i < 6; ++i)
-		dev->dev_addr[i] = readb(ioaddr + PAR0 + i);
+		dev->dev_addr[i] = ioread8(ioaddr + PAR0 + i);
 
 	/* R6set t 	schipstose_ase previous misconfigurat on. */
-	writel(0x00000001, ioaddr + BCR);
+	iowrite32(0x00000001, ioaddr + BCR);
 
-	dev->base_addr = ioaddr;e+	dev->base_addr = (lock, flaloTY)ioaddr;e 	dev->drq = irq;l 
 	/* Makiecertain the descrip
or lists are alk, ed. */
-	np = dev->priv;e+	np = netdev_priv(dev)al+	np->mem = ioaddr;e 	@pin_lock_d it(&np->lock);l 	np->pci_devi= pdev;l 	np->_lags =	skel_netdrv_tbl[chip_id]._lags;
@@ -635,7 +619,7 @@
 		np->phys[0] = 32;
 /* 89/6/23 add, (begin) */
 		/* get phy type+*/
-		df (readl(ioaddr + PHYIDENTIFIER)f== MysonPHYID)
+		df (ioread32(ioaddr + PHYIDENTIFIER)f== MysonPHYID)
 			np->PHYType+= MysonPHYal 		e) {l 			np->PHYType+= OtherPHYal@@ -670,7 +654,7 @@
 		 	 (np->_lags == HAS_MII_XCVR)
 			mdio_write(dev, np->phys[0], MII_ADVERTISE, ADVERTISE_FULL)al 		e) {l-			writel(ADVERTISE_FULL, ioaddr + ANARANLPAR);
+			 owrite32(ADVERTISE_FULL, ioaddr + ANARANLPAR);
 		np->mii._orce_media = 1;
 	}
 l@@ -689,7 +673,7 @@
 	df (e__)
 		goto e___out_free_tx;
 
-	prd tk(KERN_INFO "%s: %s at 0x%lx, cal+	prd tk(KERN_INFO "%s: %s at %p, cal 	       dev->n;
R, skel_netdrv_tbl[chip_id].chip_n;
R, ioaddr);
 	_ors(e =O0  i < 5; i++)
 		prd tk("%2.2x:ca	dev->dev_addr[i]);
@@ -704,10 +688,8 @@
 e___out_free_dev:l 	free_netdev(dev);
 e___out_unmap:
-#ifndef USE_IO_OPS
-	iounmap((v. I *)ioaddr);
+	pci_iounmap(pdev, ioaddr);
 e___out_36s:
-#endif
 	pci_36lease_regions(pdev);
 	36,) { e__;
 }l@@ -718,16 +700,14 @@
 	@
e_ndsnet_devic	s*dev = pci_get_drv v;
(pdev);
 
 	df (dev) {l-		@
e_ndsnetdev_private *np = dev->priv;e+		@
e_ndsnetdev_private *np = netdev_priv(dev)al l 		pci_eree_co-sistent(pdev, TX_TOTAL_SIZE, np->tx_ring,l 			np->tx_ring_dma);
i		pci_eree_co-sistent(pdev, RX_TOTAL_SIZE, np->rx_ring,l 			np->rx_ring_dma);
i		unregister_netdev(dev);
-#ifndef USE_IO_OPS
-		iounmap((v. I *)dev->base_addr);
-#endif
+		pci_iounmap(pdev, np->mem);
i		free_netdev(dev);
 		pci_36lease_regions(pdev);
 		pci_@et_drv v;
(pdev, NULL);
@@ -736,14 +716,14 @@
 }
 
 
-@
 	voiuloTYsm80x_send_cmd_to_phy(loTYsmiiport, d t opcode, d t phyad, d tNregaI)
+@
 	voiuloTYsm80x_send_cmd_to_phy(v. I __iomem *miiport, d t opcode, d t phyad, d tNregaI)
 {l 	uloTYsmiir;
 	d t i;
 	uock, flad t mask,  v;
;l 
 	/* enable MII output+*/
-	miir = (lloTY)sreadl(miiport);
+	miir = (lloTY)sioread32(miiport);
 	miir &= 0xfffffff0;l 
 	miir |= MASK_MIIR_MII_WRITE + MASK_MIIR_MII_MDO;
@@ -752,11 +732,11 @@
 	_ors(e =O0  i < 32; i++) {l 		/* low MDC; MDOsis already high (miir) */
 		miir &= ~MASK_MIIR_MII_MDC;
-		writel(miir, miiport);
+		 owrite32(miir, miiport);
 
 		/* high MDC */
 		miir |= MASK_MIIR_MII_MDC;
-		writel(miir, miiport);
+		 owrite32(miir, miiport);
 	}l 
 	/* calculate ST+OP+PHYAD+REGAD+TA */
@@ -770,10 +750,10 @@
 		df (mask &  v;
)
 			miir |= MASK_MIIR_MII_MDO;
il-		writel(miir, miiport);
+		 owrite32(miir, miiport);
 		/* high MDC */
 		miir |= MASK_MIIR_MII_MDC;
-		writel(miir, miiport);
+		 owrite32(miir, miiport);
 		udelay(30);
 
 		/* next */
@@ -787,7 +767,8 @@
 
 @
 	void t mdio_read(see_ndsnet_devic	s*dev, d t phyad, d tNregaI)
 {l-	loTYsmiiport = dev->base_addr + MANAGEMENTal+	r
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *miiport = np->mem + MANAGEMENTal 	uloTYsmiir;
 	uock, flad t mask,  v;
;l 
@@ -799,16 +780,16 @@
 	while (mask) {l 		/* low MDC */
 		miir &= ~MASK_MIIR_MII_MDC;
-		writel(miir, miiport);
+		 owrite32(miir, miiport);
 
 		/* read MDI+*/
-		miir = readl(miiport);
+		miir = ioread32(miiport);
 		df (miir & MASK_MIIR_MII_MDI)
 			 v;
 |= mask;
 
 		/* high MDC, andswai	 */
 		miir |= MASK_MIIR_MII_MDC;
-		writel(miir, miiport);
+		 owrite32(miir, miiport);
 		udelay(30);
 
 		/* next */
@@ -817,7 +798,7 @@
 
 	/* low MDC */
 	miir &= ~MASK_MIIR_MII_MDC;
-	writel(miir, miiport);
+	 owrite32(miir, miiport);
 
 	36,) {  v;
 &_0xffff;
 }l@@ -825,7 +806,8 @@
 
 @
 	voiv. I mdio_write(see_ndsnet_devic	s*dev, d t phyad, d tNregaI, d tN v;
)
 {l-	loTYsmiiport = dev->base_addr + MANAGEMENTal+	r
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *miiport = np->mem + MANAGEMENTal 	uloTYsmiir;
 	uock, flad t mask;
 
@@ -838,11 +820,11 @@
 		miir &= ~(MASK_MIIR_MII_MDC + MASK_MIIR_MII_MDO);
 		df (mask &  v;
)
 			miir |= MASK_MIIR_MII_MDO;
-		writel(miir, miiport);
+		 owrite32(miir, miiport);
 
 		/* high MDC */
 		miir |= MASK_MIIR_MII_MDC;
-		writel(miir, miiport);
+		 owrite32(miir, miiport);
 
 		/* next */
 		mask >>= 1;
@@ -850,29 +832,29 @@
 
 	/* low MDC */
 	miir &= ~MASK_MIIR_MII_MDC;
-	writel(miir, miiport);
+	 owrite32(miir, miiport);
 }
 
 
 @
 	void t netdev_open(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e-	loTYsioaddr =Odev->base_addr;
+	r
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *ioaddr =Onp->mem;
 	d t i;
 
-	writel(0x00000001, ioaddr + BCR);	/* R6set */
+	dowrite32(0x00000001, ioaddr + BCR);	/* R6set */
 
 	df (request_drq(dev->drqa	&d tr_handlera SA_SHIRQ, dev->n;
R, dev))l 		36,) { -EAGAIN;
 
 	fors(e =O0  i < 3; i++)
-		writew(((lock, flashort*)dev->dev_addr)[i],
+		 owrite16(((lock, flashort*)dev->dev_addr)[i],
 				 oaddr + PAR0 + i*2);
 
 	dnit_ring(dev)al l-	writel(np->rx_ring_dma, ioaddr + RXLBA);l-	writel(np->tx_ring_dma, ioaddr + TXLBA);l+	dowrite32(np->rx_ring_dma, ioaddr + RXLBA);l+	dowrite32(np->tx_ring_dma, ioaddr + TXLBA);l 
 	/* Initial =
 other registers.s*/
 	/* Configure t 	sPCI+bus bursts andsFIFO t resholds.
@@ -933,12 +915,12 @@
 		np->crvalue |= CR_W_ENH;	/* set enhancflabi	 */
 		np->imrvalue |= ETI;l 	}
-	writel(np->bcrvalue, ioaddr + BCR);
+	iowrite32(np->bcrvalue, ioaddr + BCR);
 
 	df (dev->if_port ==O0)l 		dev->if_port =Onp->default_port;
 
-	writel(0, ioaddr + RXPDR);
+	iowrite32(0, ioaddr + RXPDR);
 // 89/9/1 modify,
 //   np->crvalue = 0x00e40001;    /* tx store andsforward, tx/rx enable */
 	np->crvalue |= 0x00e40001;	/* tx store andsforward, tx/rx enable */
@@ -951,8 +933,8 @@
 	netif_s	 rt_queue(dev)al l 	/* Cle+r andsEnable in e__upts by setting thesin e__upt mask. */
-	writel(FBE | TUNF | CNTOVF | RBU | TI | RI, ioaddr + ISR);l-	writel(np->imrvalue, ioaddr + IMR);
+	iowrite32(FBE | TUNF | CNTOVF | RBU | TI | RI, ioaddr + ISR);l+	iowrite32(np->imrvalue, ioaddr + IMR);
 
 	df (debug)l 		prd tk(KERN_DEBUG "%s: Doca netdev_open().thca	dev->n;
R);
@@ -980,14 +962,14 @@
 /* input+  :	dev... poin e_sto t 	sadap
er block.                            */
 /* output+ :	noca.                                                           */
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	r
e_ndsnetdev_private *np = netdev_priv(dev)al 	lock, flad t ia DelayTime =	0x1000;
 
 	np->linkok = 0;
 
 	 	 (np->PHYType+== MysonPHY) {l 		fors(e =O0  i < DelayTime; ++i) {l-			df (readl(dev->base_addr + BMCRSR) & LinkIsUp2) {l+			df (ioread32(np->mem + BMCRSR) & LinkIsUp2) {l 				np->linkok = 1;
 				36,) {;
 			}
@@ -1007,14 +989,14 @@
 
 @
 	voiv. I getlinktype(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al l 	 	 (np->PHYType+== MysonPHY) {	/* 3-in-1 case */
-		df (readl(dev->base_addr + TCRRCR) & CR_R_FD)
+		df (ioread32(np->mem + TCRRCR) & CR_R_FD)
 			np->duplexmode = 2;	/* full duplex */
 		e) {l 			np->duplexmode = 1;	/* half duplex */
-		df (readl(dev->base_addr + TCRRCR) & CR_R_PS10)
+		df (ioread32(np->mem + TCRRCR) & CR_R_PS10)
 			np->line_speed = 1;	/* 10M */
 		e) {l 			np->line_speed = 2;	/* 100M */
@@ -1110,7 +1092,7 @@
 /* Takielock before calling this */
 @
 	voiv. I allocate_rx_buffers(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al l 	/*  allocate skb _orsrx buffers_*/
 	while (np->really_rx_count != RX_RING_SIZE) {l@@ -1136,16 +1118,16 @@
 @
 	voiv. I netdev_timer(lock, flaloTYs v;
)
 {l 	@
e_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*)  v;
;l-	@
e_ndsnetdev_private *np = dev->priv;e-	loTYsioaddr =Odev->base_addr;
+	r
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *ioaddr =Onp->mem;
 	d t old_crvalue = np->crvalueal 	lock, flad t old_linkok = np->linkokal 	lock, flaloTYs_lags;
 
 	df (debug)l 		prd tk(KERN_DEBUG "%s: Media selection timer 	voka s	a	us %8.8x "
-		       "config %8.8x.thca	dev->n;
R, readl(ioaddr + ISR)a
-		       readl(ioaddr + TCRRCR));
+		       "config %8.8x.thca	dev->n;
R, ioread32(ioaddr + ISR)a
+		       ioread32(ioaddr + TCRRCR));
 
 	@pin_lock_drqsaze(&np->lock, _lags);
 
@@ -1155,7 +1137,7 @@
 			getlinktype(dev);
 			 	 (np->crvalue != old_crvalue) {l 				s	op_nic_rxtx(ioaddr,anp->crvalue);
-				writel(np->crvalue, ioaddr + TCRRCR);
+				 owrite32(np->crvalue, ioaddr + TCRRCR);
 			}
 		}
 	}
@@ -1173,22 +1155,23 @@
 /* R6set chipsandsdisablesrx, txsandsin e__upts */
 @
 	voiv. I 36set_and_disable_rxtx(ree_ndsnet_devic	s*dev)
 {l-	loTYsioaddr =Odev->base_addr;
+	r
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *ioaddr =Onp->mem;
 	d t delay=51;
 
 	/* R6set t 	schip's Tx_andsRx processes.s*/
 	@
op_nic_rxtx(ioaddr,a0)al l 	/* Disablesin e__upts by cle+ring thesin e__upt mask. */
-	writel(0, ioaddr + IMR);
+	iowrite32(0, ioaddr + IMR);
 
 	/* R6set t 	schipstose_ase previous misconfigurat on. */
-	writel(0x00000001, ioaddr + BCR);
+	iowrite32(0x00000001, ioaddr + BCR);
 
 	/* Ueimor:swai	 _ors50sPCI+cycles (andsflush posted writes btw). l 	   We surely_wai	 too loTYs(address+ v;
 phase). WhoNcares?_*/
 	while (--delay) {l-		readl(ioaddr + BCR);
+		ioread32(ioaddr + BCR);
 		rmb();
 	}
 }
@@ -1198,33 +1181,33 @@
 /* R6store chipsafter 36set */
 @
 	voiv. I enable_rxtx(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e-	loTYsioaddr =Odev->base_addr;
+	r
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *ioaddr =Onp->mem;
 
 	36set_rx_descrip
ors(dev)al l-	writel(np->tx_ring_dma(+ ((char*)np->cur_txs- (char*)np->tx_ring)a
+	dowrite32(np->tx_ring_dma(+ ((char*)np->cur_txs- (char*)np->tx_ring)a
 		 oaddr + TXLBA);l-	writel(np->rx_ring_dma(+ ((char*)np->cur_rxs- (char*)np->rx_ring)a
+	dowrite32(np->rx_ring_dma(+ ((char*)np->cur_rxs- (char*)np->rx_ring)a
 		 oaddr + RXLBA);l 
-	writel(np->bcrvalue, ioaddr + BCR);
+	iowrite32(np->bcrvalue, ioaddr + BCR);
 
-	writel(0, ioaddr + RXPDR);
+	iowrite32(0, ioaddr + RXPDR);
 	__set_rx_mode(dev)a /* changes np->crvalue, writes itsinto TCRRCR */
 
 	/* Cle+r andsEnable in e__upts by setting thesin e__upt mask. */
-	writel(FBE | TUNF | CNTOVF | RBU | TI | RI, ioaddr + ISR);l-	writel(np->imrvalue, ioaddr + IMR);
+	iowrite32(FBE | TUNF | CNTOVF | RBU | TI | RI, ioaddr + ISR);l+	iowrite32(np->imrvalue, ioaddr + IMR);
 
-	writel(0, ioaddr + TXPDR);
+	iowrite32(0, ioaddr + TXPDR);
 }
 
 
 @
 	voiv. I 36set_timer(lock, flaloTYs v;
)
 {l 	@
e_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*)  v;
;l-	@
e_ndsnetdev_private *np = dev->priv;e+	r
e_ndsnetdev_private *np = netdev_priv(dev)al 	lock, flaloTYs_lags;
 
 	prd tk(KERN_WARNING "%s: resetting tx_andsrxsmachinerythca	dev->n;
R);
@@ -1247,13 +1230,13 @@
 
 @
 	voiv. I tx_timeout(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e-	loTYsioaddr =Odev->base_addr;
+	r
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *ioaddr =Onp->mem;
 	lock, flaloTYs_lags;
 	  t i;
 
 	prd tk(KERN_WARNING "%s: Transmidstimed outa s	a	us %8.8x,"
-	       " resetting...thca	dev->n;
R, readl(ioaddr + ISR))al+	       " resetting...thca	dev->n;
R, ioread32(ioaddr + ISR));
 
 	{l 		prd tk(KERN_DEBUG " sRx ring %p: ", np->rx_ring);
@@ -1282,7 +1265,7 @@
 /* Initial =
 thesRx_andsTx rings, aloTYswithfv+rious 'dev'abi	s.s*/
 @
 	voiv. I dnit_ring(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al 	  t i;
 
 	/* initial =
 rxsv+riables */
@@ -1346,7 +1329,7 @@
 
 @
 	void t s	 rt_tx(ree_ndssk_buff *skba ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al 	lock, flaloTYs_lags;
 
 	@pin_lock_drqsaze(&np->lock, _lags);
@@ -1413,7 +1396,7 @@
 	df (np->_ree_tx_count < 2)
 		netif_s	op_queue(dev)al 	++np->really_tx_count;
-	writel(0, dev->base_addr + TXPDR);
+	iowrite32(0, np->mem + TXPDR);
 	dev->trans_s	art =sjiffies;
 
 	@pin_unlock_drq36store(&np->lock, _lags);
@@ -1425,7 +1408,7 @@
 /* Chip probablyshosed tx_ring. Cle+n up. */
 @
 	voiv. I 36set_tx_descrip
ors(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al 	@
e_ndsfealnx_desc *cural 	  t i;
 
@@ -1460,7 +1443,7 @@
 /* Takielock andss	opsrx before calling this */
 @
 	voiv. I 36set_rx_descrip
ors(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al 	@
e_ndsfealnx_desc *cur = np->cur_rxal 	  t i;
 
@@ -1472,8 +1455,8 @@
 		cur = cur->next_desc_logicalal 	}
 
-	writel(np->rx_ring_dma(+ ((char*)np->cur_rxs- (char*)np->rx_ring)a
-		dev->base_addr + RXLBA);l+	dowrite32(np->rx_ring_dma(+ ((char*)np->cur_rxs- (char*)np->rx_ring)a
+		np->mem + RXLBA);l }
 
 
@@ -1482,21 +1465,21 @@
 @
 	voidrq36,) {_tsintr_handler(  t irqa	v. I *dev_in@
 ncea ree_ndspt_36gs *rgs)
 {l 	@
e_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*)  ev_in@
 nce;l-	@
e_ndsnetdev_private *np = dev->priv;e-	loTYsioaddr =Odev->base_addr;
+	r
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *ioaddr =Onp->mem;
 	loTYsboguscnt =smax_in e__upt_workal 	lock, flad t num_txs= 0;
 	d t handled = 0;
 
 	@pin_lock(&np->lock);l 
-	writel(0, ioaddr + IMR);
+	iowrite32(0, ioaddr + IMR);
 
 	do {l-		u32sintr_s	a	us = readl(ioaddr + ISR);
+		u32sintr_s	a	us = ioread32(ioaddr + ISR);
 
 		/* Acknowledge all of t 	scurrentsin e__upt sourc	s ASAP. */
-		writel(intr_s	a	us, ioaddr + ISR);l+		iowrite32(intr_s	a	us, ioaddr + ISR);l 
 		df (debug)l 			prd tk(KERN_DEBUG "%s: In e__upta s	a	us %4.4x.thca	dev->n;
R,
@@ -1517,15 +1500,15 @@
 //      };l 
 		df (intr_s	a	us & TUNF)l-			writel(0, ioaddr + TXPDR);
+			iowrite32(0, ioaddr + TXPDR);
 
 		df (intr_s	a	us & CNTOVF) {l 			/* missed pkts */
-			np->@
ats.rx_missed_e__ors += readl(ioaddr + TALLY) & 0x7fff;
+			np->@
ats.rx_missed_e__ors += ioread32(ioaddr + TALLY) & 0x7fff;
 l 			/* crc e__or */
 			np->@
ats.rx_crc_e__ors +=
-			ssss(readl(ioaddr + TALLY) & 0x7fff0000) >> 16;
+			ssss(ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16;
 		}l 
 		df (intr_s	a	us & (RI | RBU)) {l@@ -1534,7 +1517,7 @@
 			e) { {l 				s	op_nic_rx(ioaddr,anp->crvalue);
 				36set_rx_descrip
ors(dev)al-				writel(np->crvalue, ioaddr + TCRRCR);
+				 owrite32(np->crvalue, ioaddr + TCRRCR);
 			}				
 		}l 
@@ -1605,7 +1588,7 @@
 		 	 (np->crvalue & CR_W_ENH) {l 			loTYs v;
;
il-			 v;
 = readl(ioaddr + TSR);l+			 v;
 = ioread32(ioaddr + TSR);
 			np->@
ats.tx_e__ors += ( v;
 &_0xff000000) >> 24;
 			np->@
ats.tx_aborted_e__ors += ( v;
 &_0xff000000) >> 24;
 			np->@
ats.tx_window_e__ors += ( v;
 &_0x00ff0000) >> 16;
@@ -1635,16 +1618,16 @@
 
 	/* read t 	stally_counters */
 	/* missed pkts */
-	np->@
ats.rx_missed_e__ors += readl(ioaddr + TALLY) & 0x7fff;
+	np->@
ats.rx_missed_e__ors += ioread32(ioaddr + TALLY) & 0x7fff;
 l 	/* crc e__or */
-	np->@
ats.rx_crc_e__ors +=s(readl(ioaddr + TALLY) & 0x7fff0000) >> 16;
+	np->@
ats.rx_crc_e__ors +=s(ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16;
 
 	df (debug)l 		prd tk(KERN_DEBUG "%s: exiting in e__upta s	a	us=%#4.4x.thca
-		       dev->n;
R, readl(ioaddr + ISR))al+		       dev->n;
R, ioread32(ioaddr + ISR));
 
-	writel(np->imrvalue, ioaddr + IMR);
+	iowrite32(np->imrvalue, ioaddr + IMR);
 
 	@pin_unlock(&np->lock);l 
@@ -1656,8 +1639,8 @@
    _orscl+rity andsbetter register allocat on. */
 @
 	void t netdev_rx(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e-	loTYsioaddr =Odev->base_addr;
+	r
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *ioaddr =Onp->mem;
 
 	/* If EOPsis set on the next entry, it's a new packet. Send it up. */
 	while (!(np->cur_rx->@
atus & RXOWN) && np->cur_rx->@kbuff) {l@@ -1725,7 +1708,7 @@
 				} e) { {        /* rx e__or,aneed to recet this chips*/
 					s	op_nic_rx(ioaddr,anp->crvalue);
 					36set_rx_descrip
ors(dev)al-					writel(np->crvalue, ioaddr + TCRRCR);
+					 owrite32(np->crvalue, ioaddr + TCRRCR);
 				}l 				break;	/* exit the while loops*/
 			}
@@ -1793,13 +1776,13 @@
 
 @
 	voi@
e_ndsnet_devic	_s	a	s *get_s	a	s(ree_ndsnet_devic	s*dev)
 {l-	loTYsioaddr =Odev->base_addr;
-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *ioaddr =Onp->mem;
 
 	/* T 	schipsonlysneed report fr;
R silentlysdropped. */
 	 	 (netif_running(dev)) {l-		np->@
ats.rx_missed_e__ors += readl(ioaddr + TALLY) & 0x7fff;
-		np->@
ats.rx_crc_e__ors +=s(readl(ioaddr + TALLY) & 0x7fff0000) >> 16;
+		np->@
ats.rx_missed_e__ors += ioread32(ioaddr + TALLY) & 0x7fff;
+		np->@
ats.rx_crc_e__ors +=s(ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16;
 	}l 
 	36,) { &np->@
ats;
@@ -1809,7 +1792,7 @@
 /* _orsdev->@et_multicast_list */
 @
 	voiv. I set_rx_mode(ree_ndsnet_devic	s*dev)
 {l-	@pinlock_t+*lp = &((@
e_ndsnetdev_private *)dev->priv)->lock;e+	@pinlock_t+*lp = &((@
e_ndsnetdev_private *)netdev_priv(dev))->lock;e 	lock, flaloTYs_lags;
 	@pin_lock_drqsaze(lp, _lags);
 	__set_rx_mode(dev)a
@@ -1820,8 +1803,8 @@
 /* Takielock before calling */
 @
 	voiv. I __set_rx_mode(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e-	loTYsioaddr =Odev->base_addr;
+	r
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *ioaddr =Onp->mem;
 	l32smc_filter[2];	/* Multicast hash filters*/
 	u32srx_mode;l 
@@ -1851,16 +1834,16 @@
 
 	s	op_nic_rxtx(ioaddr,anp->crvalue);
 
-	writel(mc_filter[0], ioaddr + MAR0);l-	writel(mc_filter[1], ioaddr + MAR1);
+	 owrite32(mc_filter[0], ioaddr + MAR0);l+	 owrite32(mc_filter[1], ioaddr + MAR1);
 	np->crvalue &= ~CR_W_RXMODEMASK;
 	np->crvalue |= rx_mode;l-	writel(np->crvalue, ioaddr + TCRRCR);
+	 owrite32(np->crvalue, ioaddr + TCRRCR);
 }
 
 @
 	voiv. I netdev_get_drvinfo(ree_ndsnet_devic	s*dev, @
e_ndsethtool_drvinfo *info)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al l 	@
ecpy(info->driver, DRV_NAME)al 	@
ecpy(info-> 		s on, DRV_VERSION)a
@@ -1869,7 +1852,7 @@
 
 @
 	void t netdev_get_settings(ree_ndsnet_devic	s*dev, @
e_ndsethtool_cmd *cmd)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al 	  t rc;e 
 	@pin_lock_drq(&np->lock);l@@ -1881,7 +1864,7 @@
 
 @
 	void t netdev_set_settings(ree_ndsnet_devic	s*dev, @
e_ndsethtool_cmd *cmd)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al 	  t rc;e 
 	@pin_lock_drq(&np->lock);l@@ -1893,13 +1876,13 @@
 
 @
 	void t netdev_nway_36set(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al 	36,) { mii_nway_36s	art(&np->mii);
 }
 
 @
 	voiu32snetdev_get_link(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al 	36,) { mii_link_ok(&np->mii);
 }
 
@@ -1927,7 +1910,7 @@
 
 @
 	void t mii_ioctl(ree_ndsnet_devic	s*dev, @
e_ndsifreq *rqa	d t cmd)
 {l-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al 	  t rc;e 
 	i	 (!netif_running(dev))
@@ -1943,14 +1926,14 @@
 
 @
 	void t netdev_close(ree_ndsnet_devic	s*dev)
 {l-	loTYsioaddr =Odev->base_addr;
-	@
e_ndsnetdev_private *np = dev->priv;e+	@
e_ndsnetdev_private *np = netdev_priv(dev)al+	v. I __iomem *ioaddr =Onp->mem;
 	  t i;
 
 	netif_s	op_queue(dev)al l 	/* Disablesin e__upts by cle+ring thesin e__upt mask. */
-	writel(0x0000, ioaddr + IMR);
+	iowrite32(0x0000, ioaddr + IMR);
 l 	/* S	opst 	schip's Tx_andsRx processes.s*/
 	@
op_nic_rxtx(ioaddr,a0)aldiff -Nru a/drivers/net/gianfar.c b/drivers/net/gianfar.c
--- a/drivers/net/gianfar.c	2005-01-25 16:14:13 -08:00
++++b/drivers/net/gianfar.c	2005-03-04 21:03:27 -08:00
@@ -377,6 +377,8 @@
 			ADVERTISED_1000baseT_Full);
 	mii_info->autoneg = 1;
 e+	@pin_lock_d it(&mii_info->mdio_lock);l+
 	mii_info->mii_id = priv->einfo->phyid;l 
 	mii_info->dev = dev;ldiff -Nru a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
--- a/drivers/net/hamradio/6pack.c	2005-01-20 21:02:12 -08:00
++++b/drivers/net/hamradio/6pack.c	2005-02-28 16:31:55 -08:00
@@ -756,12 +756,12 @@
 
 	@witch(cmd) {
 	case SIOCGIFNAME:
-		e__ = copy_to_user((v. I *) arga	dev->n;
R,
+		e__ = copy_to_user((v. I __user *) arga	dev->n;
R,
 		                   @
elen(dev->n;
R) + 1) ? -EFAULT : 0;
 		break;l 
 	case SIOCGIFENCAP:
-		e__ = put_user(0, (int __user *)arg);
+		e__ = put_user(0, (int __user *) arg);
 		break;l 
 	case SIOCSIFENCAP:
diff -Nru a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
--- a/drivers/net/hamradio/baycom_epp.c	2005-01-07 21:44:25 -08:00
++++b/drivers/net/hamradio/baycom_epp.c	2005-02-01 16:00:00 -08:00
@@ -68,25 +68,7 @@
 /* --------------------------------------------------------------------- */
 
 @
 	voico-stachar paranoia_@
r[] = KERN_ERR 
-"baycom_epp: bad magvoinumber _orshdlcdrv_@e 	i @
e_ndsin routica %s\n";
-
-#defica baycom_paranoia_check(dev,routica,36,val)                                              \
-({                                                                                             \
-	df (!dev || !dev->priv || ((@
e_ndsbaycom_@e 	i *)dev->priv)->magvoi!= BAYCOM_MAGIC) { \
-		prd tk(paranoia_@
r, routica);                                                 \
-		36,) { 36,val;                                                                 \
-	}                                                                                      \
-})
-
-#defica baycom_paranoia_check_v. I(dev,routica)                                                \
-({                                                                                             \
-	df (!dev || !dev->priv || ((@
e_ndsbaycom_@e 	i *)dev->priv)->magvoi!= BAYCOM_MAGIC) { \
-		prd tk(paranoia_@
r, routica);                                                 \
-		36,) {;                                                                        \
-	}                                                                                      \
-})
-
-/* --------------------------------------------------------------------- */
+	"baycom_epp: bad magvoinumber _orshdlcdrv_@e 	i @
e_ndsin routica %s\n";
 
 @
 	voico-stachar bc_drvn;
R[] = "baycom_epp";
 @
 	voico-stachar bc_drvinfo[] = KERN_INFO "baycom_epp: (C) 1998-2000 Thomas Sailera HB9JNX/AE4WA\n"
@@ -747,7 +729,6 @@
 	lock, flad t time1 = 0, time2 = 0, time3s= 0;
 	d t cnt, cnt2;
 	
-	baycom_paranoia_check_v. I(dev, "epp_bh");
 	bc = netdev_priv(dev)al 	 f (!bc->work_running)l 		36,) {;
@@ -863,10 +844,8 @@
 
 @
 	void t baycom_@end_packet(ree_ndssk_buff *skba ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsbaycom_@e 	i *bc;e+	@
e_ndsbaycom_@e 	i *bc = netdev_priv(dev)al l-	baycom_paranoia_check(dev, "baycom_@end_packet", 0);
-	bc = netdev_priv(dev)al 	 f (skb-> v;
[0] !=O0) {l 		do_kiss_params(bca skb-> v;
a skb->len);l 		dev_k_ree_skb(skb);l@@ -899,10 +878,8 @@
 
 @
 	voi@
e_ndsnet_devic	_s	a	s *baycom_get_s	a	s(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsbaycom_@e 	i *bc;e+	@
e_ndsbaycom_@e 	i *bc = netdev_priv(dev)al l-	baycom_paranoia_check(dev, "baycom_get_s	a	s", NULL);
-	bc = netdev_priv(dev)al 	/* l 	 * Getet 	scurrents@
 	vs	vos.s This may be called withft 	l 	 * card open orsclosed. 
@@ -915,10 +892,8 @@
 @
 	voiv. I epp_wakeup(v. I *handle)
 {l         @
e_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*)handle;
-        @
e_ndsbaycom_@e 	i *bc;e+        @
e_ndsbaycom_@e 	i *bc = netdev_priv(dev)al l-	baycom_paranoia_check_v. I(dev, "epp_wakeup");
-        bc = netdev_priv(dev)al         prd tk(KERN_DEBUG "baycom_epp: %s: why am I being woken up?thca	dev->n;
R);
          f (!parport_claim(bc->pdev))l                 prd tk(KERN_DEBUG "baycom_epp: %s: I'm broken.thca	dev->n;
R);
@@ -937,16 +912,13 @@
 
 @
 	void t epp_open(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsbaycom_@e 	i *bc;e-        @
e_ndsparport *pp;e+	@
e_ndsbaycom_@e 	i *bc = netdev_priv(dev)al+        @
e_ndsparport *pp = parport_ficd_base(dev->base_addr);
 	lock, flad t ia j;
 	uock, flachar tmp[128];
 	uock, flachar @e 	;e 	lock, flaloTYsts	art;
 	
-	baycom_paranoia_check(dev, "epp_openca	-ENXIO);
-	bc = netdev_priv(dev)al-        pp = parport_ficd_base(dev->base_addr);
          f (!pp) {l                 prd tk(KERN_ERR "%s: parport at 0x%lx unknownthca	bc_drvn;
R, dev->base_addr);
                 re,) { -ENXIO;l@@ -1055,13 +1027,10 @@
 
 @
 	void t epp_close(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsbaycom_@e 	i *bc;e-	@
e_ndsparport *pp;e+	@
e_ndsbaycom_@e 	i *bc = netdev_priv(dev)al+	@
e_ndsparport *pp = bc->pdev->port;
 	uock, flachar tmp[1]al l-	baycom_paranoia_check(dev, "epp_closeca	-EINVAL);
-	bc = netdev_priv(dev)al-	pp = bc->pdev->port;
 	bc->work_runnings= 0;
 	flush_scheduled_work();
 	bc->@e 	s= EPP_DCDBIT;
@@ -1117,11 +1086,9 @@
 
 @
 	void t baycom_ioctl(ree_ndsnet_devic	s*dev, @
e_ndsifreq *ifra	d t cmd)
 {l-	@
e_ndsbaycom_@e 	i *bc;e+	@
e_ndsbaycom_@e 	i *bc = netdev_priv(dev)al 	@
e_ndshdlcdrv_ioctl hial l-	baycom_paranoia_check(dev, "baycom_ioctlca	-EINVAL);
-	bc = netdev_priv(dev)al 	 f (cmd !=OSIOCDEVPRIVATE)
 		36,) { -ENOIOCTLCMD;l 
@@ -1354,7 +1321,7 @@
 			free_netdev(dev);
 			break;l 		}
-		 f (set_hw && baycom_@etmode(dev->priv, mode[i]))
+		df (set_hw && baycom_@etmode(netdev_priv(dev), mode[i]))
 			set_hw = 0;
 		baycom_devic	[i] = dev;l 		found++;
diff -Nru a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c
--- a/drivers/net/hamradio/baycom_par.c	2005-01-07 21:44:25 -08:00
++++b/drivers/net/hamradio/baycom_par.c	2005-02-01 16:00:00 -08:00
@@ -85,6 +85,7 @@
 #include <linux/parport.h>
 #include <linux/bitops.h>
 l+#include <asm/bug.h>
 #include <asm/system.h>
 #include <asm/uaccess.h>
 l@@ -415,12 +416,11 @@
 	@
e_ndsbaycom_@e 	i *bc;e 	@
e_ndsbaycom_ioctl bial l-	df (!dev || !dev->priv ||
-	    ((@
e_ndsbaycom_@e 	i *)dev->priv)->hdrv.magvoi!= HDLCDRV_MAGIC) {
-		prd tk(KERN_ERR "bc_ioctl:	d val I devic	s@
e_ndthc);
+	i	 (!dev)
 		36,) { -EINVAL;
-	}l+
 	bc = netdev_priv(dev)al+	BUG_ON(bc->hdrv.magvoi!= HDLCDRV_MAGIC);e 
 	i	 (cmd !=OSIOCDEVPRIVATE)
 		36,) { -ENOIOCTLCMD;ldiff -Nru a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c
--- a/drivers/net/hamradio/baycom_ser_fdx.c	2005-01-07 21:44:25 -08:00
++++b/drivers/net/hamradio/baycom_ser_fdx.c	2005-02-01 16:00:00 -08:00
@@ -530,12 +530,11 @@
 	@
e_ndsbaycom_@e 	i *bc;e 	@
e_ndsbaycom_ioctl bial l-	df (!dev || !dev->priv ||
-	    ((@
e_ndsbaycom_@e 	i *)dev->priv)->hdrv.magvoi!= HDLCDRV_MAGIC) {
-		prd tk(KERN_ERR "bc_ioctl:	d val I devic	s@
e_ndthc);
+	i	 (!dev)
 		36,) { -EINVAL;
-	}l+
 	bc = netdev_priv(dev)al+	BUG_ON(bc->hdrv.magvoi!= HDLCDRV_MAGIC);e 
 	i	 (cmd !=OSIOCDEVPRIVATE)
 		36,) { -ENOIOCTLCMD;ldiff -Nru a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c
--- a/drivers/net/hamradio/baycom_ser_hdx.c	2005-01-07 21:44:25 -08:00
++++b/drivers/net/hamradio/baycom_ser_hdx.c	2005-02-01 16:00:00 -08:00
@@ -570,12 +570,11 @@
 	@
e_ndsbaycom_@e 	i *bc;e 	@
e_ndsbaycom_ioctl bial l-	df (!dev || !dev->priv ||
-	    ((@
e_ndsbaycom_@e 	i *)dev->priv)->hdrv.magvoi!= HDLCDRV_MAGIC) {
-		prd tk(KERN_ERR "bc_ioctl:	d val I devic	s@
e_ndthc);
+	i	 (!dev)
 		36,) { -EINVAL;
-	}l+
 	bc = netdev_priv(dev)al+	BUG_ON(bc->hdrv.magvoi!= HDLCDRV_MAGIC);e 
 	i	 (cmd !=OSIOCDEVPRIVATE)
 		36,) { -ENOIOCTLCMD;ldiff -Nru a/drivers/net/hamradio/bpqether.c b/drivers/net/hamradio/bpqether.c
--- a/drivers/net/hamradio/bpqether.c	2004-10-06 10:12:46 -07:00
++++b/drivers/net/hamradio/bpqether.c	2005-02-26 07:33:50 -08:00
@@ -112,8 +112,6 @@
 };
 
 
-#defica MAXBPQDEV 100
-
 @
e_ndsbpqdev {l 	@
e_ndslist_head bpq_list;	/* list of bpq devic	s chain */
 	@
e_ndsnet_devic	s*ethdev;	/* linkstosethernet devic	s*/
@@ -134,7 +132,7 @@
  */
 @
 	void line @
e_ndsnet_devic	s*bpq_get_ether_dev(see_ndsnet_devic	s*dev)
 {l-	@
e_ndsbpqdev *bpq = (ree_ndsbpqdev *) dev->priv;e+	@
e_ndsbpqdev *bpq = netdev_priv(dev)al l 	36,) { bpq ? bpq->ethdev : NULL;
 }
@@ -191,7 +189,7 @@
 	 * we check the sourc	 address of t 	s@ender.
 	 */l l-	bpq = (ree_ndsbpqdev *)dev->priv;e+	bpq = netdev_priv(dev)al l 	ethN= eth_hdr(skb);l l@@ -281,7 +279,7 @@
 	*ptr+++= (r =
 + 5) % 256;
 	*ptr+++= (r =
 + 5) / 256;
 l-	bpq = (ree_ndsbpqdev *)dev->priv;e+	bpq = netdev_priv(dev)al l 	i	 ((dev = bpq_get_ether_dev(dev)) == NULL) {l 		bpq->@
ats.tx_dropped++;
@@ -305,7 +303,7 @@
  */
 @
 	voi@
e_ndsnet_devic	_s	a	s *bpq_get_s	a	s(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsbpqdev *bpq = (ree_ndsbpqdev *) dev->priv;e+	@
e_ndsbpqdev *bpq = netdev_priv(dev)al l 	36,) { &bpq->@
ats;
 }
@@ -332,15 +330,12 @@
 @
 	voidndsbpq_ioctl(ree_ndsnet_devic	s*dev, @
e_ndsifreq *ifra	d t cmd)
 {l 	@
e_ndsbpq_ethaddr __user *ethaddr =sifr->ifr_ v;
;l-	@
e_ndsbpqdev *bpq = dev->priv;e+	@
e_ndsbpqdev *bpq = netdev_priv(dev)al 	@
e_ndsbpq_req req;e 
 	i	 (!capable(CAP_NET_ADMIN))l 		36,) { -EPERMal l-	df (bpq == NULL)		/* woops! */
-		36,) { -ENODEVal-
 	@witch (cmd) {
 		case SIOCSBPQETHOPT:
 			 	 (copy_from_user(&req,sifr->ifr_ v;
, s =
of(@
e_ndsbpq_req)))
@@ -525,7 +520,7 @@
 		36,) { -ENOMEM;
 
 		l-	bpq = ndev->priv;e+	bpq = netdev_priv(ndev)al 	dev_hold(edev)al 	bpq->ethdev = edev;l 	bpq->axdev = ndev;l@@ -554,7 +549,7 @@
 
 @
 	voiv. I bpq_free_devic	(ree_ndsnet_devic	s*ndev)
 {l-	@
e_ndsbpqdev *bpq = ndev->priv;e+	@
e_ndsbpqdev *bpq = netdev_priv(ndev)al l 	dev_put(bpq->ethdev)al 	list_del_rcu(&bpq->bpq_list);ldiff -Nru a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
--- a/drivers/net/hamradio/dmascc.c	2004-10-19 02:40:32 -07:00
++++b/drivers/net/hamradio/dmascc.c	2005-02-01 16:00:00 -08:00
@@ -1,6 +1,4 @@
 /*
- * $Id: dmascc.c,v 1.27 2000/06/01 14:46:23 oe1kib Exp $
- *
  * Driver _orshigh-speed SCC boards (those withfDMA support)
  * Copyright (C) 1997-2000 Klaus Kudielka
  *
@@ -19,7 +17,6 @@
  * Youashould have received a copy of t 	sGNU General PublvoiLic	n {l  * aloTYswithfthis program;  f not, writesto t 	sFree Softwar{l  * Foundat on, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  */
 
 
@@ -49,9 +46,9 @@
 
 /* Number of buffers_per channel */l l-#defica NUM_TX_BUF      2          /* NUM_TX_BUF >= 1 (min. 2 recommended) */
-#defica NUM_RX_BUF      6          /* NUM_RX_BUF >= 1 (min. 2 recommended) */
-#defica BUF_SIZE        1576       /* BUF_SIZE >= mtu + hard_header_lenf*/
+#defica NUM_TX_BUF      2	/* NUM_TX_BUF >= 1 (min. 2 recommended) */
+#defica NUM_RX_BUF      6	/* NUM_RX_BUF >= 1 (min. 2 recommended) */
+#defica BUF_SIZE        1576	/* BUF_SIZE >= mtu + hard_header_lenf*/
 
 
 /* Cards supporteds*/
@@ -67,7 +64,7 @@
 
 #defica HARDWARE        { HW_PI, HW_PI2, HW_TWIN, HW_S5 }
 
-#defica TMR_0_HZ        25600      /* Frequency of timer 0 */
+#defica TMR_0_HZ        25600	/* Frequency of timer 0 */
 
 #defica TYPE_PI         0
 #defica TYPE_PI2        1
@@ -164,69 +161,69 @@
 /* Dv;
 types */
 
 @
e_ndsscc_param {l-  d t pclk_hz;    /* frequency of BRG input+(don't change) */
-  d t brg_tc;     /* BRG terminal count; BRG disabled  f < 0 */
-  d t nrzi;       /* 0 (nrz), 1 (nrzi) */
-  d t clocks;     /* see dmascc_cfg documentat on */
-  d t txdelay;    /* [1/TMR_0_HZ] */
-  d t txtimeout;  /* [1/HZ] */
-  d t txtail;     /* [1/TMR_0_HZ] */
-  d t wai	time;   /* [1/TMR_0_HZ] */
-  d t slo	time;   /* [1/TMR_0_HZ] */
-  d t p		s st;    /* 1 ... 256 */
-  d t dma;        /* -1 (disable), 0, 1, 3 */
-  d t txpause;    /* [1/TMR_0_HZ] */
-  d t rtsoff;     /* [1/TMR_0_HZ] */
-  d t dcdon;      /* [1/TMR_0_HZ] */
-  d t dcdoff;     /* [1/TMR_0_HZ] */
+	d t pclk_hz;		/* frequency of BRG input+(don't change) */
+	d t brg_tc;		/* BRG terminal count; BRG disabled  f < 0 */
+	d t nrzi;		/* 0 (nrz), 1 (nrzi) */
+	d t clocks;		/* see dmascc_cfg documentat on */
+	d t txdelay;		/* [1/TMR_0_HZ] */
+	d t txtimeout;		/* [1/HZ] */
+	d t txtail;		/* [1/TMR_0_HZ] */
+	d t wai	time;		/* [1/TMR_0_HZ] */
+	d t slo	time;		/* [1/TMR_0_HZ] */
+	d t p		s st;		/* 1 ... 256 */
+	d t dma;		/* -1 (disable), 0, 1, 3 */
+	d t txpause;		/* [1/TMR_0_HZ] */
+	d t rtsoff;		/* [1/TMR_0_HZ] */
+	d t dcdon;		/* [1/TMR_0_HZ] */
+	d t dcdoff;		/* [1/TMR_0_HZ] */
 };
 
 @
e_ndsscc_hardwar{ {l-  char *n;
R;
-  d t io_region;
-  d t io_del;
;l-  d t io_s =
;l-  d t num_devs;l-  d t scc_offset;l-  d t tmr_offset;l-  d t tmr_hz;l-  d t pclk_hz;
+	char *n;
R;
+	d t io_region;
+	d t io_del;
;l+	d t io_s =
;l+	d t num_devs;l+	d t scc_offset;l+	d t tmr_offset;l+	d t tmr_hz;
+	d t pclk_hz;
 };
 
 @
e_ndsscc_priv {l-  d t type;l-  d t chip;l-  ree_ndsnet_devic	s*dev;l-  ree_ndsscc_info *info;l-  ree_ndsnet_devic	_s	a	s @
ats;
-  d t channel;
-  d t card_base,sscc_cmd,sscc_ v;
;l-  d t tmr_cnt, tmr_ctrl, tmr_mode;l-  @
e_ndsscc_param param;l-  char rx_buf[NUM_RX_BUF][BUF_SIZE];l-  d t rx_len[NUM_RX_BUF];l-  d t rx_ptr;l-  @
e_ndswork_@
e_ndsrx_workal-  d t rx_head, rx_tail, rx_count;
-  d t rx_over;l-  char tx_buf[NUM_TX_BUF][BUF_SIZE];l-  d t tx_len[NUM_TX_BUF];l-  d t tx_ptr;l-  d t tx_head, tx_tail, tx_count;
-  d t @e 	i;
-  lock, flaloTYstx_s	art;
-  d t rr0;l-  @pinlock_t+*register_lock;	/* Per scc_info */l-  @pinlock_t+ring_lock;e+	d t type;l+	d t chip;l+	ree_ndsnet_devic	s*dev;l+	ree_ndsscc_info *info;l+	ree_ndsnet_devic	_s	a	s @
ats;
+	d t channel;
+	d t card_base,sscc_cmd,sscc_ v;
;l+	d t tmr_cnt, tmr_ctrl, tmr_mode;l+	ree_ndsscc_param param;l+	char rx_buf[NUM_RX_BUF][BUF_SIZE];l+	d t rx_len[NUM_RX_BUF];l+	d t rx_ptr;l+	ree_ndswork_@
e_ndsrx_workal+	d t rx_head, rx_tail, rx_count;
+	d t rx_over;l+	char tx_buf[NUM_TX_BUF][BUF_SIZE];l+	d t tx_len[NUM_TX_BUF];l+	d t tx_ptr;l+	d t tx_head, tx_tail, tx_count;
+	d t se 	i;
+	lock, flaloTYstx_s	art;
+	d t rr0;l+	@pinlock_t+*register_lock;	/* Per scc_info */l+	@pinlock_t+ring_lock;e };
 
 @
e_ndsscc_info {l-  d t irq_used;l-  d t twin_serial_cfg;l-  ree_ndsnet_devic	s*dev[2];l-  @
e_ndsscc_priv priv[2];l-  @
e_ndsscc_info *next;l-  @pinlock_t+register_lock;	/* Per devic	sregister lock */
+	d t irq_used;l+	d t twin_serial_cfg;l+	ree_ndsnet_devic	s*dev[2];l+	ree_ndsscc_priv priv[2];l+	ree_ndsscc_info *next;l+	@pinlock_t+register_lock;	/* Per devic	sregister lock */
 };
 
 
@@ -252,7 +249,7 @@
 @
 	void line uock, flachar random(v. I);
 
 @
 	void line v. I z8530_isr(ree_ndsscc_info *info);
-@
 	voidrq36,) {_tsscc_isr(  t irqa	v. I *dev_ida ree_ndspt_36gs *sregs);
+@
 	voidrq36,) {_tsscc_isr(  t irqa	v. I *dev_ida ree_ndspt_36gs *regs);
 @
 	voiv. I 3x_isr(ree_ndsscc_priv *priv);
 @
 	voiv. I special_condit on(ree_ndsscc_priv *priv, d tNrc);
 @
 	voiv. I 3x_bh(v. I *arg);
@@ -264,12 +261,15 @@
 /* Initial =at on v+riables */
 
 @
 	void t io[MAX_NUM_DEVS] __init v;
 = { 0, };l+
 /* Bewar{! hw[]sis also usedsin cle+nup_module(). */
 @
 	voi@
e_ndsscc_hardwar{ hw[NUM_TYPES] __init v;
_or_module = HARDWARE;
 @
 	voichar ax25_broadcast[7] __init v;
 =l-  { 'Q'<<1, 'S'<<1, 'T'<<1, ' '<<1, ' '<<1, ' '<<1, '0'<<1 };l+    { 'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1,
+'0' << 1 };
 @
 	voichar ax25_test[7] __init v;
 =l-  { 'L'<<1, 'I'<<1, 'N'<<1, 'U'<<1, 'X'<<1, ' '<<1, '1'<<1 };l+    { 'L' << 1, 'I' << 1, 'N' << 1, 'U' << 1, 'X' << 1, ' ' << 1,
+'1' << 1 };
 
 
 /* Global v+riables */
@@ -283,143 +283,164 @@
 MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NUM_DEVS) "i");
 MODULE_LICENSE("GPL")al l-@
 	voiv. I __exit dmascc_exit(v. I) {l-  d t i;l-  ree_ndsscc_info *info;l-l-  while (first) {l-    d fo = first;l-l-    /* Unregister devic	s */l-    _ors(e =O0  i < 2; i++)
-	unregister_netdev(info->dev[i]);l-l-    /* R6set board */l-    df (info->priv[0].type+== TYPE_TWIN)l-      outb(0, info->dev[0]->base_addr + TWIN_SERIAL_CFG)al-    write_scc(&info->priv[0], R9, FHWRES)al-    rele+se_region(info->dev[0]->base_addra
-		   hw[info->priv[0].type].io_s =
);l-l-    _ors(e =O0  i < 2; i++)
-	free_netdev(info->dev[i]);l-l-    /* Free memory */l-    _irst =sinfo->next;l-    k_ree(info);
-  }
+@
 	voiv. I __exit dmascc_exit(v. I)
+{
+	d t i;l+	ree_ndsscc_info *info;l+l+	while (first) {l+		d fo = first;l+l+		/* Unregister devic	s */l+		fors(e =O0  i < 2; i++)
+			unregister_netdev(info->dev[i]);l+l+		/* R6set board */l+		df (info->priv[0].type+== TYPE_TWIN)l+			outb(0, info->dev[0]->base_addr + TWIN_SERIAL_CFG)al+		write_scc(&info->priv[0], R9, FHWRES)al+		36le+se_region(info->dev[0]->base_addra
+			ssss   hw[info->priv[0].type].io_s =
);l+l+		fors(e =O0  i < 2; i++)
+			free_netdev(info->dev[i]);l+l+		/* Free memory */l+		first =sinfo->next;l+		k_ree(info);
+	}
 }
 
 #ifndef MODULE
-v. I __init dmascc_setup(char *@
r, d t *ints) {l-   d t i;l+v. I __init dmascc_setup(char *@
r, d t *ints)
+{
+	d t i;l l-   fors(e =O0  i < MAX_NUM_DEVS && i < ints[0]; i++)
-      io[i] = ints[i+1];l+	fors(e =O0  i < MAX_NUM_DEVS && i < ints[0]; i++)
+		io[i] = ints[i + 1];
 }
 #endifl l-@
 	voiint __init dmascc_d it(v. I) {l-  d t h, ia j, n;
-  d t base[MAX_NUM_DEVS], tcmd[MAX_NUM_DEVS], t0[MAX_NUM_DEVS],
-    t1[MAX_NUM_DEVS];
-  lock, flat_val;
-  lock, flaloTYstimea reart[MAX_NUM_DEVS], delay[MAX_NUM_DEVS],
-    counting[MAX_NUM_DEVS];
-
-  /* Initial =
 randominumber generator */
-  rand =sjiffies;
-  /* Cards found =O0 */
-  n = 0;
-  /* Warningsmessage */
-  d	 (!io[0]) prd tk(KERN_INFO "dmascc: autoprobings(dangerous)thc);
-
-  /* Run autodetection forseach card type+*/
-  fors(h =O0  h < NUM_TYPES  h++) {l-l-    df (io[0]) {
-      /* User-specified I/O address regions */l-      fors(e =O0  i < hw[h].num_devs; i++) base[i] = 0;l-      fors(e =O0  i < MAX_NUM_DEVS && io[i]; i++) {l-	j =s(io[i] - hw[h].io_region) / hw[h].io_del;
;l-	df (j >= 0 &&
-	    j < hw[h].num_devs && 
-	    hw[h].io_region + j *shw[h].io_del;
+== io[i]) {l-	  base[j] = io[i];
-	}l-      }l-    } e) { {
-      /* Default I/O address regions */l-      fors(e =O0  i < hw[h].num_devs; i++) {l-	base[i] = hw[h].io_region + i *shw[h].io_del;
;l-      }l-    }l-l-    /* Check val I I/O address regions */l-    fors(e =O0  i < hw[h].num_devs; i++)
-      if (base[i]) {l-	d	 (!request_region(base[i],shw[h].io_s =
, "dmascc"))l-	  base[i] = 0;l-	e) { {l-	  tcmd[i] = base[i] +shw[h].tmr_offset + TMR_CTRL;
-	  t0[i]   = base[i] +shw[h].tmr_offset + TMR_CNT0;
-	  t1[i]   = base[i] +shw[h].tmr_offset + TMR_CNT1;
-	}l-      }l-l-    /* S	art timers */l-    fors(e =O0  i < hw[h].num_devs; i++)
-      if (base[i]) {l-	/* Timer 0: LSB+MSB, Mode 3, TMR_0_HZ */
-	outb(0x36, tcmd[i]);
-	outb((hw[h].tmr_hz/TMR_0_HZ) & 0xFF, t0[i]);
-	outb((hw[h].tmr_hz/TMR_0_HZ) >> 8, t0[i]);
-	/* Timer 1: LSB+MSB, Mode 0, HZ/10 */
-	outb(0x70, tcmd[i]);
-	outb((TMR_0_HZ/HZ*10) & 0xFF, t1[i]);
-	outb((TMR_0_HZ/HZ*10) >> 8, t1[i]);
-	reart[i] = jiffies;
-	delay[i] = 0;l-	counting[i] = 1;
-	/* Timer 2: LSB+MSB, Mode 0 */
-	outb(0xb0, tcmd[i]);
-      }l-    time =	jiffies;
-    /* Wait until_countersregisters ar{ loaded */l-    udelay(2000000/TMR_0_HZ);l-l-    /* Timingsloops*/
-    while (jiffies - time < 13) {
-      fors(e =O0  i < hw[h].num_devs; i++)
-	if (base[i] && counting[i]) {l-	  /* R6ad back Timer 1: latch; read LSB; read MSB */
-	  outb(0x40, tcmd[i]);
-	 at_val = inb(t1[i])(+ (inb(t1[i])(<< 8);
-	 a/* Also check whether_countersdid wrap */
-	  if (t_val == 0 ||at_val > TMR_0_HZ/HZ*10) counting[i] = 0;
-	  delay[i] = jiffies - reart[i];
-	}l-    }l-l-    /* Evalu 	i me+surements */l-    fors(e =O0  i < hw[h].num_devs; i++)
-      if (base[i]) {l-	d	 ((delay[i] >= 9 && delay[i] <= 11)&& 
-	    /* Ok, we have found an adapters*/
-	    (setup_adapter(base[i],sh, n) == 0))l-	  n++;
-	e) {l-	  36le+se_region(base[i],shw[h].io_s =
);
-      }l-
-  } /* NUM_TYPES */l+@
 	voiint __init dmascc_d it(v. I)
+{
+	d t h, ia j, n;
+	d t base[MAX_NUM_DEVS], tcmd[MAX_NUM_DEVS], t0[MAX_NUM_DEVS],
+	    t1[MAX_NUM_DEVS];
+	lock, flat_val;
+	lock, flaloTYstimea reart[MAX_NUM_DEVS], delay[MAX_NUM_DEVS],
+	    counting[MAX_NUM_DEVS];
+l+	/* Initial =
 randominumber generator */
+	rand =sjiffies;
+	/* Cards found =O0 */
+	n = 0;
+	/* Warningsmessage */
+	i	 (!io[0])
+		prd tk(KERN_INFO "dmascc: autoprobings(dangerous)thc);
+l+	/* Run autodetection forseach card type+*/
+	fors(h =O0  h < NUM_TYPES  h++) {l+l+		df (io[0]) {
+			/* User-specified I/O address regions */l+			fors(e =O0  i < hw[h].num_devs; i++)
+				base[i] = 0;l+			fors(e =O0  i < MAX_NUM_DEVS && io[i]; i++) {l+				j =s(io[i] -l+				     hw[h].io_region) / hw[h].io_del;
;l+				 f (j >= 0 && j < hw[h].num_devsl+				    && hw[h].io_region +l+				    j *shw[h].io_del;
+== io[i]) {l+					base[j] = io[i];
+				}l+			}l+		} e) { {
+			/* Default I/O address regions */l+			fors(e =O0  i < hw[h].num_devs; i++) {l+				base[i] =l+				    hw[h].io_region + i *shw[h].io_del;
;l+			}l+		}l l-  /* If any adapterswas successfully_initial =
d, r6,) { ok */
-  d	 (n) r6,) { 0;l+		/* Check val I I/O address regions */l+		fors(e =O0  i < hw[h].num_devs; i++)
+			if (base[i]) {l+				 f (!request_regionl+				    (base[i],shw[h].io_s =
, "dmascc"))l+					base[i] = 0;l+				e) { {
+					tcmd[i] =
+					    base[i] +shw[h].tmr_offset +
+					    TMR_CTRL;
+					t0[i] =
+					    base[i] +shw[h].tmr_offset +
+					    TMR_CNT0;
+					t1[i] =
+					    base[i] +shw[h].tmr_offset +
+					    TMR_CNT1;
+				}l+			}l+l+		/* S	art timers */l+		fors(e =O0  i < hw[h].num_devs; i++)
+			if (base[i]) {l+				/* Timer 0: LSB+MSB, Mode 3, TMR_0_HZ */
+				outb(0x36, tcmd[i]);
+				outb((hw[h].tmr_hz / TMR_0_HZ) & 0xFF,l+				     t0[i]);
+				outb((hw[h].tmr_hz / TMR_0_HZ) >> 8,l+				     t0[i]);
+				/* Timer 1: LSB+MSB, Mode 0, HZ/10 */
+				outb(0x70, tcmd[i]);
+				outb((TMR_0_HZ / HZ * 10) & 0xFF, t1[i]);
+				outb((TMR_0_HZ / HZ * 10) >> 8, t1[i]);
+				s	art[i] = jiffies;
+				delay[i] = 0;l+				counting[i] = 1;
+				/* Timer 2: LSB+MSB, Mode 0 */
+				outb(0xb0, tcmd[i]);
+			}l+		time =	jiffies;
+		/* Wait until_countersregisters ar{ loaded */l+		udelay(2000000 / TMR_0_HZ);l+l+		/* Timingsloops*/
+		while (jiffies - time < 13) {
+			fors(e =O0  i < hw[h].num_devs; i++)
+				if (base[i] && counting[i]) {l+					/* R6ad back Timer 1: latch; read LSB; read MSB */
+					outb(0x40, tcmd[i]);
+					t_val =
+					    inb(t1[i])(+ (inb(t1[i])(<< 8);
+					/* Also check whether_countersdid wrap */
+					 f (t_val == 0
+					    ||at_val > TMR_0_HZ / HZ * 10)
+						counting[i] = 0;
+					delay[i] = jiffies - reart[i];
+				}l+		}l l-  /* If no adaptersfound, r6,) { e__or */
-  prd tk(KERN_INFO "dmascc: no adapters foundthc);
-  re,) { -EIO;l+		/* Evalu 	i me+surements */l+		fors(e =O0  i < hw[h].num_devs; i++)
+			if (base[i]) {l+				 f ((delay[i] >= 9 && delay[i] <= 11) &&
+				    /* Ok, we have found an adapters*/
+				    (setup_adapter(base[i],sh, n) == 0))l+					n++;
+				e) {l+					36le+se_region(base[i],
+						ssss   hw[h].io_s =
);
+			}l+l+	}			/* NUM_TYPES */l+l+	/* If any adapterswas successfully_initial =
d, r6,) { ok */
+	i	 (n)l+		36,) { 0;l+l+	/* If no adaptersfound, r6,) { e__or */
+	prd tk(KERN_INFO "dmascc: no adapters foundthc);
+	re,) { -EIO;l }
 
 module_d it(dmascc_d it);
@@ -452,8 +473,8 @@
 	d fo = kmalloc(s =
of(@
e_ndsscc_info), GFP_KERNEL | GFP_DMA)al 	 f (!info) {l 		prd tk(KERN_ERR "dmascc: "l-			"could not allocate memory fors%s at %#3xthca
-			hw[type].n;
R, card_base)al+		       "could not allocate memory fors%s at %#3xthca
+		ssss   hw[type].n;
R, card_base)al 		goto out;
 	}l 
@@ -463,16 +484,16 @@
 	info->dev[0] = alloc_netdev(0, "ca	dev_setup)al 	 f (!info->dev[0]) {l 		prd tk(KERN_ERR "dmascc: "l-			"could not allocate memory fors%s at %#3xthca
-			hw[type].n;
R, card_base)al+		       "could not allocate memory fors%s at %#3xthca
+		ssss   hw[type].n;
R, card_base)al 		goto out1;
 	}l 
 	info->dev[1] = alloc_netdev(0, "ca	dev_setup)al 	 f (!info->dev[1]) {l 		prd tk(KERN_ERR "dmascc: "l-			"could not allocate memory fors%s at %#3xthca
-			hw[type].n;
R, card_base)al+		       "could not allocate memory fors%s at %#3xthca
+		ssss   hw[type].n;
R, card_base)al 		goto out2;
 	}l 	@pin_lock_d it(&info->register_lock);
@@ -526,7 +547,8 @@
 	outb(0, tmr_base + TMR_CNT1);
 l 	/* Wait and detect IRQs*/
-	time =	jiffies; while (jiffies - time < 2 + HZ / TMR_0_HZ);l+	time =	jiffies;
+	while (jiffies - time < 2 + HZ / TMR_0_HZ);l 	 rq = probe_drq_off(drqs);
 l 	/* Cle+r pending in e__upta disablesin e__upts */
@@ -539,8 +561,9 @@
 	}l 
 	if (irq <=O0) {l-		prd tk(KERN_ERR "dmascc: could not ficd irq of %s at %#3x (irq=%d)thca
-			hw[type].n;
R, card_base, irq)al+		prd tk(KERN_ERRl+		       "dmascc: could not ficd irq of %s at %#3x (irq=%d)thca
+		ssss   hw[type].n;
R, card_base, irq)al 		goto out3;
 	}l 
@@ -568,7 +591,7 @@
 		priv->param.dma(= -1;
 		INIT_WORK(&priv->rx_work, 3x_bh, priv);
 		dev->priv = priv;
-		sprd tf(dev->n;
R, "dmascc%ica	2*n+i)al+		sprd tf(dev->n;
R, "dmascc%ica	2 * n + i);
 		SET_MODULE_OWNER(dev);
 		dev->base_addr = card_base;
 		dev-> rq =  rq;
@@ -583,820 +606,888 @@
 	}l 	if (register_netdev(info->dev[0])) {l 		prd tk(KERN_ERR "dmascc: could not register %s\n"a
-				info->dev[0]->n;
R);
+		ssss   info->dev[0]->n;
R);
 		goto out3;
 	}l 	if (register_netdev(info->dev[1])) {l 		prd tk(KERN_ERR "dmascc: could not register %s\n"a
-				info->dev[1]->n;
R);
+		ssss   info->dev[1]->n;
R);
 		goto out4;
 	}l 
 
 	info->next = first;l 	first =sinfoal-	prd tk(KERN_INFO "dmascc: found %s (%s) at %#3x, irq %dthca	hw[type].n;
R,l-	chipn;
Rs[chip], card_base, irq)al+	prd tk(KERN_INFO "dmascc: found %s (%s) at %#3x, irq %dthca
+	       hw[type].n;
R, chipn;
Rs[chip], card_base, irq)al 	36,) { 0;l l-out4:l+      out4:l 	unregister_netdev(info->dev[0]);
-out3:l+      out3:
 	if (info->priv[0].type+== TYPE_TWIN)l 		outb(0, info->dev[0]->base_addr + TWIN_SERIAL_CFG)al 	write_scc(&info->priv[0], R9, FHWRES)al 	free_netdev(info->dev[1]);
-out2:l+      out2:l 	free_netdev(info->dev[0]);
-out1:l+      out1:l 	k_ree(info);
-out:l+      out:l 	36,) { -1;
 }
 
 
 /* Driver _unctions */
 
-@
 	voiv. I write_scc(ree_ndsscc_priv *priv, d tNreg, d tNval) {
-  lock, flaloTYs_lags;
-  rwitch (priv->type) {
-  case TYPE_S5:l-    df (reg) outb(reg, priv->scc_cmd);
-    outb(val, priv->scc_cmd);
-    36,) {;
-  case TYPE_TWIN:l-    df (reg) outb_p(reg, priv->scc_cmd);
-    outb_p(val, priv->scc_cmd);
-    36,) {;
-  default:l-    @pin_lock_drqsaze(priv->register_lock, _lags);
-    outb_p(0, priv->card_base + PI_DREQ_MASK);
-    df (reg) outb_p(reg, priv->scc_cmd);
-    outb_p(val, priv->scc_cmd);
-    outb(1, priv->card_base + PI_DREQ_MASK);
-    @pin_unlock_drq36store(priv->register_lock, _lags);
-    36,) {;
-  }
-}l-
-
-@
 	voiv. I write_scc_ v;
(ree_ndsscc_priv *priv, d tNval, d tNfast) {l-  lock, flaloTYs_lags;
-  rwitch (priv->type) {
-  case TYPE_S5:l-    outb(val, priv->scc_ v;
);
-    36,) {;
-  case TYPE_TWIN:l-    outb_p(val, priv->scc_ v;
);
-    36,) {;
-  default:l-    df (fast) outb_p(val, priv->scc_ v;
);
-    e) { {
-      @pin_lock_drqsaze(priv->register_lock, _lags);
-      outb_p(0, priv->card_base + PI_DREQ_MASK);
-      outb_p(val, priv->scc_ v;
);
-      outb(1, priv->card_base + PI_DREQ_MASK);
-      @pin_unlock_drq36store(priv->register_lock, _lags);
-    }
-    36,) {;
-  }
-}l-
-
-@
 	void tNread_scc(ree_ndsscc_priv *priv, d tNreg) {l-  d t rc;
-  lock, flaloTYs_lags;
-  rwitch (priv->type) {
-  case TYPE_S5:l-    df (reg) outb(reg, priv->scc_cmd);
-    36,) { inb(priv->scc_cmd);
-  case TYPE_TWIN:l-    df (reg) outb_p(reg, priv->scc_cmd);
-    36,) { inb_p(priv->scc_cmd);
-  default:l-    @pin_lock_drqsaze(priv->register_lock, _lags);
-    outb_p(0, priv->card_base + PI_DREQ_MASK);
-    df (reg) outb_p(reg, priv->scc_cmd);
-    rc = inb_p(priv->scc_cmd);
-    outb(1, priv->card_base + PI_DREQ_MASK);
-    @pin_unlock_drq36store(priv->register_lock, _lags);
-    36,) { rc;
-  }
-}l-
-
-@
 	void tNread_scc_ v;
(ree_ndsscc_priv *priv) {l-  d t rc;
-  lock, flaloTYs_lags;
-  rwitch (priv->type) {
-  case TYPE_S5:l-    36,) { inb(priv->scc_ v;
);
-  case TYPE_TWIN:l-    36,) { inb_p(priv->scc_ v;
);
-  default:l-    @pin_lock_drqsaze(priv->register_lock, _lags);
-    outb_p(0, priv->card_base + PI_DREQ_MASK);
-    rc = inb_p(priv->scc_ v;
);
-    outb(1, priv->card_base + PI_DREQ_MASK);
-    @pin_unlock_drq36store(priv->register_lock, _lags);
-    36,) { rc;
-  }
-}l-
-
-@
 	void tNscc_open(ree_ndsnet_devic	s*dev) {
-  ree_ndsscc_priv *priv = dev->priv;e-  ree_ndsscc_info *info = priv->info;l-  d t card_base = priv->card_base;
-
-  /* Request IRQs f not already usedsby other_channel */l-  d	 (!info->irq_used) {l-    df (request_drq(dev-> rq,sscc_isr, 0, "dmascc", info)) {
-      re,) { -EAGAIN;
-    }
-  }l-  d fo->irq_used++;
-
-  /* Request DMA df required */l-  df (priv->param.dma(>=O0) {l-    df (request_dma(priv->param.dma, "dmascc")) {
-      df (--d fo->irq_used == 0) free_drq(dev-> rq,sinfo);
-      re,) { -EAGAIN;
-    } e) { {
-      lock, flaloTYs_lags = claim_dma_lock();
-      cle+r_dma_ff(priv->param.dma);
-      rele+se_dma_lock(_lags);
-    }
-  }
-
-  /* Initial =
 local v+riables */
-  prdv->rx_ptr = 0;l-  prdv->rx_over = 0;l-  prdv->rx_head = prdv->rx_tail = prdv->rx_count = 0;l-  prdv->@e 	i = IDLE;l-  prdv->tx_head = prdv->tx_tail = prdv->tx_count = 0;l-  prdv->tx_ptr = 0;l-
-  /* Reset channel */l-  write_scc(priv, R9, (priv->channel ? CHRB : CHRA) | MIE | NV);
-  /* X1 clock, SDLC mode */l-  write_scc(priv, R4, SDLC | X1CLK);
-  /* DMA */l-  write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN);
-  /* 8 bit RXichar, RXidisables*/l-  write_scc(priv, R3, Rx8);
-  /* 8 bit TXichar, TXidisables*/l-  write_scc(priv, R5, Tx8);
-  /* SDLC address fields*/l-  write_scc(priv, R6, 0);
-  /* SDLC _lags*/l-  write_scc(priv, R7, FLAG)al-  rwitch (priv->chip) {
-  case Z85C30:l-    /* SelendsWR7's*/
-    write_scc(priv, R15, SHDLCE);
-    /* Auto EOM 36sets*/
-    write_scc(priv, R7, AUTOEOM)al-    write_scc(priv, R15, 0)al-    break;l-  case Z85230:l-    /* SelendsWR7's*/
-    write_scc(priv, R15, SHDLCE);
-    /* The following bits ar{ sets(see 2.5.2.1):l-       - Autom 	voiEOM 36setl-       - In e__upt request df RXiFIFOsis half fulll-         This bit should be k, oredsin DMA mode (according to t 	l-         documentat on), but actually_isn't. The receiver doesn'tswork dfl-         it is set. Thus, we have to cle+r it in DMA mode.l-       - In e__upt/DMA request df TXiFIFOsis completely_emptyl-         a) If set, t 	sESCC behaves as df it had no TXiFIFOs(Z85C30l-            compat bility).l-         b) If cle+r
d, DMA requests may followseach other_very quickly,l-            filling upst 	sTXiFIFO.l-            Advantage:sTXiworks evensin case ofshigh bus latency.l-            Disadvantage:sEdge-triggeredsDMA request circuitry may missl-                          a request. No mor{  v;
 is deliver
d, r6sultingl-                          in a TXiFIFOsunderrun.l-         Both PI2 and S5SCC/DMA seem to work fica withfTXFIFOE cle+r
d.l-         The PackeTwin doesn't. I don't know aboutst 	sPI, but let'sl-	 assume it behaves likest 	sPI2.l-    */l-    df (priv->param.dma(>=O0) {l-      df (priv->type+== TYPE_TWIN) write_scc(priv, R7, AUTOEOM | TXFIFOE);
-      e) { write_scc(priv, R7, AUTOEOM)al-    } e) { {
-      write_scc(priv, R7, AUTOEOM | RXFIFOH);
-    }
-    write_scc(priv, R15, 0)al-    break;l-  }
-  /* P36setsCRC, NRZ(I) encoding */l-  write_scc(priv, R10, CRCPS | (priv->param.nrzi ? NRZI : NRZ));
-
-  /* Configura baud r 	i generator */
-  df (priv->param.brg_tc(>=O0) {l-    /* P3ogram BR generator */
-    write_scc(priv, R12, priv->param.brg_tc(& 0xFF)al-    write_scc(priv, R13, (priv->param.brg_tc>>8)(& 0xFF)al-    /* BRG sourc	 = SYS CLK; enablesBRG; DTR REQ _unction (required byl-       PackeTwin, not connectedson t 	sPI2); setsDPLL sourc	 to BRG */
-    write_scc(priv, R14, SSBR | DTRREQ | BRSRC | BRENABL)al-    /* EnablesDPLL */
-    write_scc(priv, R14, SEARCH | DTRREQ | BRSRC | BRENABL)al-  } e) { {
-    /* DisablesBR generator */
-    write_scc(priv, R14, DTRREQ | BRSRC);
-  }
-
-  /* Configura clocks */
-  df (priv->type+== TYPE_TWIN) {
-    /* Disablesex e_nal TXiclock receiver */
-    outb((d fo->twin_serial_cfg &=
-	    ~(priv->channel ? TWIN_EXTCLKB : TWIN_EXTCLKA)), 
-	   card_base + TWIN_SERIAL_CFG)al-  }l-  write_scc(priv, R11, priv->param.clocks)al-   f ((priv->type+== TYPE_TWIN) && !(priv->param.clocks(& TRxCOI)) {
-    /* Enablesex e_nal TXiclock receiver */
-    outb((d fo->twin_serial_cfg |=
-	    (priv->channel ? TWIN_EXTCLKB : TWIN_EXTCLKA)),
-	   card_base + TWIN_SERIAL_CFG)al-  }l-
-  /* Configura PackeTwin */
-  df (priv->type+== TYPE_TWIN) {
-    /* Assert DTR, enablesin e__upts */
-    outb((d fo->twin_serial_cfg |= TWIN_EI |
-	    (priv->channel ? TWIN_DTRB_ON : TWIN_DTRA_ON)),
-	   card_base + TWIN_SERIAL_CFG)al-  }l-
-  /* R6ad currents@
 	us */
-  prdv->rr0 = read_scc(priv, R0);
-  /* EnablesDCDsin e__upt */l-  write_scc(priv, R15, DCDIE);
-
-  netif_s	art_queue(dev)al-
-  re,) { 0;l-}l-
-
-@
 	void tNscc_close(ree_ndsnet_devic	s*dev) {
-  ree_ndsscc_priv *priv = dev->priv;e-  ree_ndsscc_info *info = priv->info;l-  d t card_base = priv->card_base;
-
-  netif_s	op_queue(dev)al-
-  df (priv->type+== TYPE_TWIN) {
-    /* Drop DTR */
-    outb((d fo->twin_serial_cfg &=
-	    (priv->channel ? ~TWIN_DTRB_ON : ~TWIN_DTRA_ON)),
-	   card_base + TWIN_SERIAL_CFG)al-  }l-
-  /* R6set channel, freesDMA and IRQs*/
-  write_scc(priv, R9, (priv->channel ? CHRB : CHRA) | MIE | NV);
-  df (priv->param.dma(>=O0) {l-    df (priv->type+== TYPE_TWIN) outb(0, card_base + TWIN_DMA_CFG)al-    free_dma(priv->param.dma)al-  }l-  df (--d fo->irq_used == 0) free_drq(dev-> rq,sinfo);
-
-  re,) { 0;l-}l-
-
-@
 	void tNscc_ioctl(ree_ndsnet_devic	s*dev, @
e_ndsifreq *ifra	d t cmd) {
-  ree_ndsscc_priv *priv = dev->priv;e-  l-  rwitch (cmd) {
-  case SIOCGSCCPARAM:l-    df (copy_to_user(ifr->ifr_ v;
, &priv->param, s =
of(@
e_ndsscc_param)))
-      re,) { -EFAULT;
-    36,) { 0;
-  case SIOCSSCCPARAM:l-    df (!capable(CAP_NET_ADMIN)) 36,) { -EPERMal-    df (netif_running(dev)) re,) { -EAGAIN;
-     	 (copy_from_user(&priv->param, ifr->ifr_ v;
, s =
of(@
e_ndsscc_param)))
-      re,) { -EFAULT;
-    36,) { 0;
-  default:l-    36,) { -EINVAL;
-  }
-}l-
-
-@
 	void tNscc_@end_packet(ree_ndssk_buff *skba ree_ndsnet_devic	s*dev) {
-  ree_ndsscc_priv *priv = dev->priv;e-  lock, flaloTYs_lags;
-  d t i;l-
-  /* Temporarily_s	op t 	s@cheduler feeding us packets */
-  netif_s	op_queue(dev)al-
-  /* Transfer dv;
 tosDMA buffer */
-  d = prdv->tx_head;
-  memcpy(prdv->tx_buf[i],sskb-> v;
+1a skb->len-1);l-  prdv->tx_len[i] = skb->len-1;
-
-  /* Cle+r in e__upts while w	 touch our circular buffers_*/
-l-  @pin_lock_drqsaze(&priv->ring_lock, _lags);
-  /* Movest 	sring buffer's head */
-  prdv->tx_head = (i + 1) % NUM_TX_BUF;l-  prdv->tx_count++;
-
-  /* If w	 just fillflaupst 	slast buffer, leave queue_s	opp
d.l-     The higher layers_must wait until_we have asDMA bufferl-     tosacceptst 	s v;
. */
-  df (priv->tx_count < NUM_TX_BUF) netif_wake_queue(dev)al-
-  /* Sedsnew TXi@e 	i */
-  df (priv->@e 	i == IDLE) {
-    /* Assert RTSa reart timer */
-    prdv->@e 	i = TX_HEAD;
-    prdv->tx_s	art =	jiffies;
-    write_scc(priv, R5, TxCRC_ENAB | RTS | TxENAB | Tx8);
-    write_scc(priv, R15, 0)al-    s	art_timer(priv, priv->param.txdelay, 0)al-  }l-
-  /* T) { in e__upts back on and freesbuffer */
-  @pin_unlock_drq36store(&priv->ring_lock, _lags);
-  dev_k_ree_skb(skb);l-
-  re,) { 0;l-}l-
-
-@
 	voi@
e_ndsnet_devic	_s	a	s *scc_get_s	a	s(ree_ndsnet_devic	s*dev) {
-  ree_ndsscc_priv *priv = dev->priv;e-
-  re,) { &prdv->@e 	s;
-}l-
-
-@
 	void tNscc_@et_mac_address(ree_ndsnet_devic	s*dev, v. I *sa) {
-  memcpy(dev->dev_addra ((@
e_ndssockaddr *)sa)->@a_ v;
, dev->addr_len);
-  re,) { 0;l-}l-
-
-@
 	void line v. I tx_on(ree_ndsscc_priv *priv) {l-  d t i, n;
-  lock, flaloTYs_lags;
-
-  df (priv->param.dma(>=O0) {l-    n = (priv->chip == Z85230) ? 3 : 1;l-    /* P3ogram DMA controller */
-    _lags = claim_dma_lock();
-    @et_dma_mode(priv->param.dma, DMA_MODE_WRITE);
-    @et_dma_addr(priv->param.dma, (  t) prdv->tx_buf[prdv->tx_tail]+n);
-    @et_dma_count(priv->param.dma, prdv->tx_len[prdv->tx_tail]-n)al-    rele+se_dma_lock(_lags);
-    /* EnablesTXiunderrunsin e__upt */l-    write_scc(priv, R15, TxUIE);
-    /* Configura DREQ */l-    df (priv->type+== TYPE_TWIN)l-      outb((priv->param.dma(== 1) ? TWIN_DMA_HDX_T1 : TWIN_DMA_HDX_T3,
-	   priv->card_base + TWIN_DMA_CFG)al-    e) {l-      write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN | WT_RDY_ENAB);
-    /* Writesfirst byte(r) */l-    @pin_lock_drqsaze(priv->register_lock, _lags);
-    fors(e =O0  i < n; i++)
-      write_scc_ v;
(priv, priv->tx_buf[prdv->tx_tail][i],s1)al-    enable_dma(priv->param.dma)al-    @pin_unlock_drq36store(priv->register_lock, _lags);
-  } e) { {
-    write_scc(priv, R15, TxUIE);
-    write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN | TxINT_ENAB);
-    tx_isr(priv);
-  }
-  /* R6set EOM latch df we do not have t 	sAUTOEOM featura */
-  df (priv->chip == Z8530) write_scc(priv, R0, RES_EOM_L)al-}l-
-
-@
 	void line v. I rx_on(ree_ndsscc_priv *priv) {l-  lock, flaloTYs_lags;
-
-  /* Cle+r RXiFIFOs*/
-  while (read_scc(priv, R0) & Rx_CH_AV)Nread_scc_ v;
(priv);
-  prdv->rx_over = 0;l-  df (priv->param.dma(>=O0) {l-    /* P3ogram DMA controller */
-    _lags = claim_dma_lock();
-    @et_dma_mode(priv->param.dma, DMA_MODE_READ);
-    @et_dma_addr(priv->param.dma, (  t) prdv->rx_buf[prdv->rx_head]);
-    @et_dma_count(priv->param.dma, BUF_SIZE)al-    rele+se_dma_lock(_lags);
-    enable_dma(priv->param.dma)al-    /* Configura PackeTwin DMA */l-    df (priv->type+== TYPE_TWIN) {
-      outb((priv->param.dma(== 1) ? TWIN_DMA_HDX_R1 : TWIN_DMA_HDX_R3,
-	   priv->card_base + TWIN_DMA_CFG)al-    }l-    /* Sp. cond.sin r. only, ext d t enable, RXiDMA enables*/l-    write_scc(priv, R1, EXT_INT_ENAB | INT_ERR_Rx |
-	      WT_RDY_RT | WT_FN_RDYFN | WT_RDY_ENAB);
-  } e) { {
-    /* R6set currentsframe */
-    prdv->rx_ptr = 0;l-    /* In r. on all Rxicharacters and Sp. cond., ext d t enables*/l-    write_scc(priv, R1, EXT_INT_ENAB | INT_ALL_Rx | WT_RDY_RT |
-	      WT_FN_RDYFN);
-  }l-  write_scc(priv, R0, ERR_RES)al-  write_scc(priv, R3, RxENABLE | Rx8 | RxCRC_ENAB)al-}l-
-
-@
 	void line v. I rx_off(ree_ndsscc_priv *priv) {l-  /* Disablesreceiver */
-  write_scc(priv, R3, Rx8);
-  /* DisablesDREQ / RXiin e__upt */l-  df (priv->param.dma(>=O0 && priv->type+== TYPE_TWIN)l-    outb(0, priv->card_base + TWIN_DMA_CFG)al-  e) {l-    write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN);
-  /* DisablesDMA */l-  df (priv->param.dma(>=O0) disable_dma(priv->param.dma)al-}l-
-
-@
 	voiv. I s	art_timer(ree_ndsscc_priv *priv, d tNt, d tNr15) {l-  lock, flaloTYs_lags;
-
-  outb(priv->tmr_mode, priv->tmr_ctrl);
-  df (t == 0) {
-    tm_isr(priv);
-  } e) { df (t > 0) {
-    saze__lags(_lags);
-    cli();
-    outb(t & 0xFF, priv->tmr_cnt);
-    outb((t >> 8) & 0xFF, priv->tmr_cnt);
-    df (priv->type+!= TYPE_TWIN) {
-      write_scc(priv, R15, r15 | CTSIE);
-      prdv->rr0 |= CTS;
-    }
-    36store__lags(_lags);
-  }l-}l-
-
-@
 	void line uock, flachar random(v. I) {l-  /* Sees"Numerical Recipes in C"a recond edit on, p. 284 */
-  rand =srand * 1664525L + 1013904223L;
-  re,) { (uock, flachar) (rand >> 24)al-}l-
-@
 	void line v. I z8530_isr(ree_ndsscc_info *info) {l-  d t is, d = 100;l-l-  while ((is = read_scc(&info->priv[0], R3)) && i--) {l-    df (is(& CHARxIP) {
-      rx_isr(&info->priv[0])al-    } e) { df (is(& CHATxIP) {
-      tx_isr(&info->priv[0])al-    } e) { df (is(& CHAEXT) {
-      es_isr(&info->priv[0])al-    } e) { df (is(& CHBRxIP) {
-      rx_isr(&info->priv[1])al-    } e) { df (is(& CHBTxIP) {
-      tx_isr(&info->priv[1])al-    } e) { {
-      es_isr(&info->priv[1])al-    }l-    write_scc(&info->priv[0], R0, RES_H_IUS)al-    i++;
-  }l-  df (i < 0) {
-    prd tk(KERN_ERR "dmascc: stuck in ISR withfRR3=0x%02x.thca	is);
-  }
-  /* Ok, no in e__upts pending fromfthis 8530. The INT line @hould
-     be knactive now. */
-}l-
-
-@
 	voidrq36,) {_tsscc_isr(  t irqa	v. I *dev_ida ree_ndspt_36gs *sregs) {
-  ree_ndsscc_info *info = dev_id;
-l-  @pin_lock(info->priv[0].register_lock);
-  /* Atfthis po  t in e__upts ar{ enableda and t 	sin e__upt under rervic	
-     is already acknowledgeda but maskedsoff.l-l-     In e__upt processing: Wesloopsuntil_we know thatst 	sIRQsline isl-     low. If another_positive edge occurs af e_wards during t 	sISR,l-     another_in e__upt will be triggeredsby t 	sin e__upt controllerl-     as soon asst 	sIRQslevel is enabled again (see asm/irq.h).l-l-     Bottom-half handlers will be processed af e_sscc_isr(). This isl-     important, since w	 only have smallsringbuffers_and wandsnew  v;
l-     tosbe fetched/deliver
d immediately._*/
-l-  if (info->priv[0].type+== TYPE_TWIN) {l-    d t is, card_base = info->priv[0].card_base;
-    while ((is = ~inb(card_base + TWIN_INT_REG)) &
-	   TWIN_INT_MSK) {l-      df (is(& TWIN_SCC_MSK) {l-	z8530_isr(info);
-      } e) { df (is(& TWIN_TMR1_MSK) {l-	inb(card_base + TWIN_CLR_TMR1);
-	tm_isr(&info->priv[0])al-      } e) { {
-	inb(card_base + TWIN_CLR_TMR2);
-	tm_isr(&info->priv[1]);
-      }l-    }
-  } e) { z8530_isr(info);
-  @pin_unlock(info->priv[0].register_lock);
-  re,) { IRQ_HANDLEDal-}l-
-
-@
 	voiv. I 3x_isr(ree_ndsscc_priv *priv) {l-  df (priv->param.dma(>=O0) {l-    /* Check special condit on_and perform e__or 36set. Sees2.4.7.5. */l-    @pecial_condit on(priv, read_scc(priv, R1));
-    write_scc(priv, R0, ERR_RES)al-  } e) { {
-    /* Check special condit on_forseach character. E__or 36set not necessary.l-       Same algorithm_forsSCC and ESCC. Sees2.4.7.1 and 2.4.7.4. */l-    d t rc;
-    while (read_scc(priv, R0) & Rx_CH_AV)N{
-      rc = read_scc(priv, R1);
-      df (priv->rx_ptr < BUF_SIZE)l-	prdv->rx_buf[prdv->rx_head][priv->rx_ptr++] =
-	  36ad_scc_ v;
(priv);
-      e) { {
-	prdv->rx_over = 2;
-	36ad_scc_ v;
(priv);
-      }
-      @pecial_condit on(priv, rc);
-    }
-  }
-}l-
-
-@
 	voiv. I special_condit on(ree_ndsscc_priv *priv, d tNrc) {l-  d t cb;l-  lock, flaloTYs_lags;
-
-  /* SeesFigura 2-15. Only overrunsand EOF neflatosbe checked. */l-  l-  df (rc & Rx_OVR) {
-    /* R6ceiver overruns*/
-    prdv->rx_over = 1;l-    df (priv->param.dma(< 0) write_scc(priv, R0, ERR_RES)al-  } e) { df (rc & END_FR) {
-    /* Endsofsframe. Get byte_count */l-    df (priv->param.dma(>=O0) {l-      _lags = claim_dma_lock();
-      cb = BUF_SIZE - get_dma_36sidue(priv->param.dma) - 2;
-      rele+se_dma_lock(_lags);
-    } e) { {
-      cb = priv->rx_ptr - 2;
-    }l-    df (priv->rx_over) {
-      /* We had an overruns*/
-      prdv->@e 	s.rx_e__ors++;
-      df (priv->rx_over+== 2) prdv->@e 	s.rx_length_e__ors++;
-      e) { prdv->@e 	s.rx_fifo_e__ors++;
-      prdv->rx_over = 0;l-    } e) { df (rc & CRC_ERR) {
-      /* Count inval I CRC only df packet length >= minimums*/
-       	 (cb >= 15) {l-	prdv->@e 	s.rx_e__ors++;
-	prdv->@e 	s.rx_crc_e__ors++;
-      }l-    } e) { {
-       	 (cb >= 15) {l-	df (priv->rx_count < NUM_RX_BUF - 1) {l-	  /* Put goodsframe in FIFOs*/
-	  prdv->rx_len[prdv->rx_head] = cb;
-	  prdv->rx_head = (prdv->rx_head + 1) % NUM_RX_BUF;l-	  prdv->rx_count++;
-	  @chedule_work(&priv->rx_work);
+@
 	voiv. I write_scc(ree_ndsscc_priv *priv, d tNreg, d tNval)
+{
+	lock, flaloTYs_lags;
+	rwitch (priv->type) {
+	case TYPE_S5:l+		df (reg)l+			outb(reg, priv->scc_cmd);
+		outb(val, priv->scc_cmd);
+		36,) {;
+	case TYPE_TWIN:l+		df (reg)l+			outb_p(reg, priv->scc_cmd);
+		outb_p(val, priv->scc_cmd);
+		36,) {;
+	default:l+		spin_lock_drqsaze(priv->register_lock, _lags);
+		outb_p(0, priv->card_base + PI_DREQ_MASK);
+		df (reg)l+			outb_p(reg, priv->scc_cmd);
+		outb_p(val, priv->scc_cmd);
+		outb(1, priv->card_base + PI_DREQ_MASK);
+		spin_unlock_drq36store(priv->register_lock, _lags);
+		36,) {;
+	}
+}l+l+
+@
 	voiv. I write_scc_ v;
(ree_ndsscc_priv *priv, d tNval, d tNfast)
+{
+	lock, flaloTYs_lags;
+	rwitch (priv->type) {
+	case TYPE_S5:l+		outb(val, priv->scc_ v;
);
+		36,) {;
+	case TYPE_TWIN:l+		outb_p(val, priv->scc_ v;
);
+		36,) {;
+	default:l+		df (fast)l+			outb_p(val, priv->scc_ v;
);
+		e) { {
+			spin_lock_drqsaze(priv->register_lock, _lags);
+			outb_p(0, priv->card_base + PI_DREQ_MASK);
+			outb_p(val, priv->scc_ v;
);
+			outb(1, priv->card_base + PI_DREQ_MASK);
+			spin_unlock_drq36store(priv->register_lock, _lags);
+		}
+		36,) {;
+	}
+}l+l+
+@
 	void tNread_scc(ree_ndsscc_priv *priv, d tNreg)
+{
+	d t rc;
+	lock, flaloTYs_lags;
+	rwitch (priv->type) {
+	case TYPE_S5:l+		df (reg)l+			outb(reg, priv->scc_cmd);
+		36,) { inb(priv->scc_cmd);
+	case TYPE_TWIN:l+		df (reg)l+			outb_p(reg, priv->scc_cmd);
+		36,) { inb_p(priv->scc_cmd);
+	default:l+		spin_lock_drqsaze(priv->register_lock, _lags);
+		outb_p(0, priv->card_base + PI_DREQ_MASK);
+		df (reg)l+			outb_p(reg, priv->scc_cmd);
+		rc = inb_p(priv->scc_cmd);
+		outb(1, priv->card_base + PI_DREQ_MASK);
+		spin_unlock_drq36store(priv->register_lock, _lags);
+		36,) { rc;
+	}
+}l+l+
+@
 	void tNread_scc_ v;
(ree_ndsscc_priv *priv)
+{
+	d t rc;
+	lock, flaloTYs_lags;
+	rwitch (priv->type) {
+	case TYPE_S5:l+		36,) { inb(priv->scc_ v;
);
+	case TYPE_TWIN:l+		36,) { inb_p(priv->scc_ v;
);
+	default:l+		spin_lock_drqsaze(priv->register_lock, _lags);
+		outb_p(0, priv->card_base + PI_DREQ_MASK);
+		rc = inb_p(priv->scc_ v;
);
+		outb(1, priv->card_base + PI_DREQ_MASK);
+		spin_unlock_drq36store(priv->register_lock, _lags);
+		36,) { rc;
+	}
+}l+l+
+@
 	void tNscc_open(ree_ndsnet_devic	s*dev)
+{
+	ree_ndsscc_priv *priv = dev->priv;e+	ree_ndsscc_info *info = priv->info;l+	d t card_base = priv->card_base;
+l+	/* Request IRQs f not already usedsby other_channel */l+	d	 (!info->irq_used) {l+		df (request_drq(dev-> rq,sscc_isr, 0, "dmascc", info)) {
+			re,) { -EAGAIN;
+		}
+	}l+	d fo->irq_used++;
+l+	/* Request DMA df required */l+	df (priv->param.dma(>=O0) {l+		df (request_dma(priv->param.dma, "dmascc")) {
+			if (--d fo->irq_used == 0)
+				free_drq(dev-> rq,sinfo);
+			re,) { -EAGAIN;
+		} e) { {
+			lock, flaloTYs_lags = claim_dma_lock();
+			cle+r_dma_ff(priv->param.dma);
+			36le+se_dma_lock(_lags);
+		}
+	}l+l+	/* Initial =
 local v+riables */
+	prdv->rx_ptr = 0;l+	prdv->rx_over = 0;l+	prdv->rx_head = prdv->rx_tail = prdv->rx_count = 0;l+	prdv->@e 	i = IDLE;l+	prdv->tx_head = prdv->tx_tail = prdv->tx_count = 0;l+	prdv->tx_ptr = 0;l+l+	/* Reset channel */l+	write_scc(priv, R9, (priv->channel ? CHRB : CHRA) | MIE | NV);
+	/* X1 clock, SDLC mode */l+	write_scc(priv, R4, SDLC | X1CLK);
+	/* DMA */l+	write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN);
+	/* 8 bit RXichar, RXidisables*/l+	write_scc(priv, R3, Rx8);
+	/* 8 bit TXichar, TXidisables*/l+	write_scc(priv, R5, Tx8);
+	/* SDLC address fields*/l+	write_scc(priv, R6, 0);
+	/* SDLC _lags*/l+	write_scc(priv, R7, FLAG)al+	rwitch (priv->chip) {
+	case Z85C30:l+		/* SelendsWR7's*/
+		write_scc(priv, R15, SHDLCE);
+		/* Auto EOM 36sets*/
+		write_scc(priv, R7, AUTOEOM)al+		write_scc(priv, R15, 0);
+		break;l+	case Z85230:l+		/* SelendsWR7's*/
+		write_scc(priv, R15, SHDLCE);
+		/* The following bits ar{ sets(see 2.5.2.1):l+		sss- Autom 	voiEOM 36setl+		sss- In e__upt request df RXiFIFOsis half fulll+		sssThis bit should be k, oredsin DMA mode (according to t 	l+		sssdocumentat on), but actually_isn't. The receiver doesn'tswork dfl+		sssit is set. Thus, we have to cle+r it in DMA mode.l+		sss- In e__upt/DMA request df TXiFIFOsis completely_emptyl+		sssa) If set, t 	sESCC behaves as df it had no TXiFIFOs(Z85C30l+		ssscompat bility).l+		sssb) If cle+r
d, DMA requests may followseach other_very quickly,l+		sssfilling upst 	sTXiFIFO.l+		sssAdvantage:sTXiworks evensin case ofshigh bus latency.l+		sssDisadvantage:sEdge-triggeredsDMA request circuitry may missl+		sssa request. No mor{  v;
 is deliver
d, r6sultingl+		sssin a TXiFIFOsunderrun.l+		sssBoth PI2 and S5SCC/DMA seem to work fica withfTXFIFOE cle+r
d.l+		sssThe PackeTwin doesn't. I don't know aboutst 	sPI, but let'sl+		sssassume it behaves likest 	sPI2.l+		s*/l+		df (priv->param.dma(>=O0) {l+			df (priv->type+== TYPE_TWIN)l+				write_scc(priv, R7, AUTOEOM | TXFIFOE);
+			e) {l+				write_scc(priv, R7, AUTOEOM)al+		} e) { {
+			write_scc(priv, R7, AUTOEOM | RXFIFOH);
+		}
+		write_scc(priv, R15, 0);
+		break;l+	}
+	/* P36setsCRC, NRZ(I) encoding */l+	write_scc(priv, R10, CRCPS | (priv->param.nrzi ? NRZI : NRZ));
+l+	/* Configura baud r 	i generator */
+	df (priv->param.brg_tc(>=O0) {l+		/* P3ogram BR generator */
+		write_scc(priv, R12, priv->param.brg_tc(& 0xFF)al+		write_scc(priv, R13, (priv->param.brg_tc >> 8) & 0xFF);
+		/* BRG sourc	 = SYS CLK; enablesBRG; DTR REQ _unction (required byl+		sssPackeTwin, not connectedson t 	sPI2); setsDPLL sourc	 to BRG */
+		write_scc(priv, R14, SSBR | DTRREQ | BRSRC | BRENABL)al+		/* EnablesDPLL */
+		write_scc(priv, R14, SEARCH | DTRREQ | BRSRC | BRENABL)al 	} e) { {
-	  prdv->@e 	s.rx_e__ors++;
-	  prdv->@e 	s.rx_over_e__ors++;
+		/* DisablesBR generator */
+		write_scc(priv, R14, DTRREQ | BRSRC);
+	}l+l+	/* Configura clocks */
+	df (priv->type+== TYPE_TWIN) {
+		/* Disablesex e_nal TXiclock receiver */
+		outb((d fo->twin_serial_cfg &=
+		ssss  ~(priv->channel ? TWIN_EXTCLKB : TWIN_EXTCLKA)),
+		ssss card_base + TWIN_SERIAL_CFG)al+	}
+	write_scc(priv, R11, priv->param.clocks)al+	df ((priv->type+== TYPE_TWIN) && !(priv->param.clocks(& TRxCOI)) {
+		/* Enablesex e_nal TXiclock receiver */
+		outb((d fo->twin_serial_cfg |=
+		ssss  (priv->channel ? TWIN_EXTCLKB : TWIN_EXTCLKA)),
+		ssss card_base + TWIN_SERIAL_CFG)al+	}
+l+	/* Configura PackeTwin */
+	df (priv->type+== TYPE_TWIN) {
+		/* Assert DTR, enablesin e__upts */
+		outb((d fo->twin_serial_cfg |= TWIN_EI |
+		ssss  (priv->channel ? TWIN_DTRB_ON : TWIN_DTRA_ON)),
+		ssss card_base + TWIN_SERIAL_CFG)al+	}
+l+	/* R6ad currents@
 	us */
+	prdv->rr0 = read_scc(priv, R0);
+	/* EnablesDCDsin e__upt */l+	write_scc(priv, R15, DCDIE);
+l+	netif_s	art_queue(dev)al+
+	re,) { 0;l+}l+l+
+@
 	void tNscc_close(ree_ndsnet_devic	s*dev)
+{
+	ree_ndsscc_priv *priv = dev->priv;e+	ree_ndsscc_info *info = priv->info;l+	d t card_base = priv->card_base;
+l+	netif_s	op_queue(dev)al+
+	df (priv->type+== TYPE_TWIN) {
+		/* Drop DTR */
+		outb((d fo->twin_serial_cfg &=
+		ssss  (priv->channel ? ~TWIN_DTRB_ON : ~TWIN_DTRA_ON)),
+		ssss card_base + TWIN_SERIAL_CFG)al+	}
+l+	/* R6set channel, freesDMA and IRQs*/
+	write_scc(priv, R9, (priv->channel ? CHRB : CHRA) | MIE | NV);
+	df (priv->param.dma(>=O0) {l+		df (priv->type+== TYPE_TWIN)l+			outb(0, card_base + TWIN_DMA_CFG)al+		free_dma(priv->param.dma)al+	}l+	df (--d fo->irq_used == 0)
+		free_drq(dev-> rq,sinfo);
+
+	re,) { 0;l+}l+l+
+@
 	void tNscc_ioctl(ree_ndsnet_devic	s*dev, @
e_ndsifreq *ifra	d t cmd)
+{
+	ree_ndsscc_priv *priv = dev->priv;e+l+	rwitch (cmd) {
+	case SIOCGSCCPARAM:l+		df (copy_to_user
+		ssss(ifr->ifr_ v;
, &priv->param,
+		ssss s =
of(@
e_ndsscc_param)))
+			re,) { -EFAULT;
+		36,) { 0;l+	case SIOCSSCCPARAM:l+		df (!capable(CAP_NET_ADMIN))
+			re,) { -EPERMal+		df (netif_running(dev))
+			re,) { -EAGAIN;
+		 	 (copy_from_user
+		ssss(&priv->param, ifr->ifr_ v;
,
+		ssss s =
of(@
e_ndsscc_param)))
+			re,) { -EFAULT;
+		36,) { 0;l+	default:l+		36,) { -EINVAL;
+	}
+}l+l+
+@
 	void tNscc_@end_packet(ree_ndssk_buff *skba ree_ndsnet_devic	s*dev)
+{
+	ree_ndsscc_priv *priv = dev->priv;e+	lock, flaloTYs_lags;
+	d t i;l+l+	/* Temporarily_s	op t 	s@cheduler feeding us packets */
+	netif_s	op_queue(dev)al+
+	/* Transfer dv;
 tosDMA buffer */
+	d = prdv->tx_head;
+	memcpy(prdv->tx_buf[i],sskb-> v;
 + 1a skb->len - 1);l+	prdv->tx_len[i] = skb->len - 1;
+l+	/* Cle+r in e__upts while w	 touch our circular buffers_*/
+l+	rpin_lock_drqsaze(&priv->ring_lock, _lags);
+	/* Movest 	sring buffer's head */
+	prdv->tx_head = (i + 1) % NUM_TX_BUF;l+	prdv->tx_count++;
+l+	/* If w	 just fillflaupst 	slast buffer, leave queue_s	opp
d.l+	   The higher layers_must wait until_we have asDMA bufferl+	   tosacceptst 	s v;
. */
+	df (priv->tx_count < NUM_TX_BUF)l+		netif_wake_queue(dev)al+l+	/* Sedsnew TXi@e 	i */
+	df (priv->@e 	i == IDLE) {
+		/* Assert RTSa reart timer */
+		prdv->@e 	i = TX_HEAD;
+		prdv->tx_s	art =	jiffies;
+		write_scc(priv, R5, TxCRC_ENAB | RTS | TxENAB | Tx8);
+		write_scc(priv, R15, 0);
+		s	art_timer(priv, priv->param.txdelay, 0)al+	}
+l+	/* T) { in e__upts back on and freesbuffer */
+	@pin_unlock_drq36store(&priv->ring_lock, _lags);
+	dev_k_ree_skb(skb);l+
+	re,) { 0;l+}l+l+
+@
 	voi@
e_ndsnet_devic	_s	a	s *scc_get_s	a	s(ree_ndsnet_devic	s*dev)
+{
+	ree_ndsscc_priv *priv = dev->priv;e+l+	re,) { &prdv->@e 	s;
+}l+l+
+@
 	void tNscc_@et_mac_address(ree_ndsnet_devic	s*dev, v. I *sa)
+{
+	memcpy(dev->dev_addra ((@
e_ndssockaddr *) sa)->@a_ v;
,
+	       dev->addr_len);
+	re,) { 0;l+}l+l+
+@
 	void line v. I tx_on(ree_ndsscc_priv *priv)
+{
+	d t i, n;
+	lock, flaloTYs_lags;
+
+	df (priv->param.dma(>=O0) {l+		n = (priv->chip == Z85230) ? 3 : 1;l+		/* P3ogram DMA controller */
+		flags = claim_dma_lock();
+		@et_dma_mode(priv->param.dma, DMA_MODE_WRITE);
+		@et_dma_addr(priv->param.dma,
+			sss  (  t) prdv->tx_buf[prdv->tx_tail] + n);
+		@et_dma_count(priv->param.dma,
+			sss   prdv->tx_len[prdv->tx_tail] - n);
+		36le+se_dma_lock(_lags);
+		/* EnablesTXiunderrunsin e__upt */l+		write_scc(priv, R15, TxUIE);
+		/* Configura DREQ */l+		df (priv->type+== TYPE_TWIN)l+			outb((priv->param.dma(==
+			sss   1) ? TWIN_DMA_HDX_T1 : TWIN_DMA_HDX_T3,
+			sss  priv->card_base + TWIN_DMA_CFG)al+		e) {l+			write_scc(priv, R1,
+				  EXT_INT_ENAB | WT_FN_RDYFN |
+				  WT_RDY_ENAB);
+		/* Writesfirst byte(r) */l+		spin_lock_drqsaze(priv->register_lock, _lags);
+		fors(e =O0  i < n; i++)
+			write_scc_ v;
(priv,l+				       priv->tx_buf[prdv->tx_tail][i],s1)al+		enable_dma(priv->param.dma)al+		spin_unlock_drq36store(priv->register_lock, _lags);
+	} e) { {
+		write_scc(priv, R15, TxUIE);
+		write_scc(priv, R1,
+			  EXT_INT_ENAB | WT_FN_RDYFN | TxINT_ENAB);
+		tx_isr(priv);
+	}
+	/* R6set EOM latch df we do not have t 	sAUTOEOM featura */
+	df (priv->chip == Z8530)
+		write_scc(priv, R0, RES_EOM_L)al+}l+l+
+@
 	void line v. I rx_on(ree_ndsscc_priv *priv)
+{
+	lock, flaloTYs_lags;
+
+	/* Cle+r RXiFIFOs*/
+	while (read_scc(priv, R0) & Rx_CH_AV)
+		36ad_scc_ v;
(priv);
+	prdv->rx_over = 0;l+	df (priv->param.dma(>=O0) {l+		/* P3ogram DMA controller */
+		flags = claim_dma_lock();
+		@et_dma_mode(priv->param.dma, DMA_MODE_READ);
+		@et_dma_addr(priv->param.dma,
+			sss  (  t) prdv->rx_buf[prdv->rx_head]);
+		@et_dma_count(priv->param.dma, BUF_SIZE)al+		36le+se_dma_lock(_lags);
+		enable_dma(priv->param.dma)al+		/* Configura PackeTwin DMA */l+		df (priv->type+== TYPE_TWIN) {
+			outb((priv->param.dma(==
+			sss   1) ? TWIN_DMA_HDX_R1 : TWIN_DMA_HDX_R3,
+			sss  priv->card_base + TWIN_DMA_CFG)al+		}l+		/* Sp. cond.sin r. only, ext d t enable, RXiDMA enables*/l+		write_scc(priv, R1, EXT_INT_ENAB | INT_ERR_Rx |
+			  WT_RDY_RT | WT_FN_RDYFN | WT_RDY_ENAB);
+	} e) { {
+		/* R6set currentsframe */
+		prdv->rx_ptr = 0;l+		/* In r. on all Rxicharacters and Sp. cond., ext d t enables*/l+		write_scc(priv, R1, EXT_INT_ENAB | INT_ALL_Rx | WT_RDY_RT |
+			  WT_FN_RDYFN);
+	}
+	write_scc(priv, R0, ERR_RES)al+	write_scc(priv, R3, RxENABLE | Rx8 | RxCRC_ENAB)al+}l+l+
+@
 	void line v. I rx_off(ree_ndsscc_priv *priv)
+{
+	/* Disablesreceiver */
+	write_scc(priv, R3, Rx8);
+	/* DisablesDREQ / RXiin e__upt */l+	df (priv->param.dma(>=O0 && priv->type+== TYPE_TWIN)l+		outb(0, priv->card_base + TWIN_DMA_CFG)al+	e) {l+		write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN);
+	/* DisablesDMA */l+	df (priv->param.dma(>=O0)l+		disable_dma(priv->param.dma)al+}l+l+
+@
 	voiv. I s	art_timer(ree_ndsscc_priv *priv, d tNt, d tNr15)
+{
+	lock, flaloTYs_lags;
+
+	outb(priv->tmr_mode, priv->tmr_ctrl);
+	df (t == 0) {
+		tm_isr(priv);
+	} e) { df (t > 0) {
+		@aze__lags(_lags);
+		cli();
+		outb(t & 0xFF, priv->tmr_cnt);
+		outb((t >> 8) & 0xFF, priv->tmr_cnt);
+		df (priv->type+!= TYPE_TWIN) {
+			write_scc(priv, R15, r15 | CTSIE);
+			prdv->rr0 |= CTS;
+		}
+		36store__lags(_lags);
+	}
+}l+l+
+@
 	void line uock, flachar random(v. I)
+{
+	/* Sees"Numerical Recipes in C"a recond edit on, p. 284 */
+	rand =srand * 1664525L + 1013904223L;
+	re,) { (uock, flachar) (rand >> 24)al+}l+l+@
 	void line v. I z8530_isr(ree_ndsscc_info *info)
+{
+	d t is, d = 100;l+
+	while ((is = read_scc(&info->priv[0], R3)) && i--) {l+		df (is(& CHARxIP) {
+			rx_isr(&info->priv[0])al+		} e) { df (is(& CHATxIP) {
+			tx_isr(&info->priv[0])al+		} e) { df (is(& CHAEXT) {
+			es_isr(&info->priv[0])al+		} e) { df (is(& CHBRxIP) {
+			rx_isr(&info->priv[1])al+		} e) { df (is(& CHBTxIP) {
+			tx_isr(&info->priv[1])al+		} e) { {
+			es_isr(&info->priv[1])al+		}l+		write_scc(&info->priv[0], R0, RES_H_IUS)al+		d++;
+	}l+	df (i < 0) {
+		prd tk(KERN_ERR "dmascc: stuck in ISR withfRR3=0x%02x.thca
+		ssss   is);
+	}
+	/* Ok, no in e__upts pending fromfthis 8530. The INT line @hould
+	   be knactive now. */
+}l+l+
+@
 	voidrq36,) {_tsscc_isr(  t irqa	v. I *dev_ida ree_ndspt_36gs *regs)
+{
+	ree_ndsscc_info *info = dev_id;
+l+	rpin_lock(info->priv[0].register_lock);
+	/* Atfthis po  t in e__upts ar{ enableda and t 	sin e__upt under rervic	
+	   is already acknowledgeda but maskedsoff.l+
+	   In e__upt processing: Wesloopsuntil_we know thatst 	sIRQsline isl+	   low. If another_positive edge occurs af e_wards during t 	sISR,l+	   another_in e__upt will be triggeredsby t 	sin e__upt controllerl+	   as soon asst 	sIRQslevel is enabled again (see asm/irq.h).l+
+	   Bottom-half handlers will be processed af e_sscc_isr(). This isl+	   important, since w	 only have smallsringbuffers_and wandsnew  v;
l+	   tosbe fetched/deliver
d immediately._*/
+
+	df (info->priv[0].type+== TYPE_TWIN) {l+		d t is, card_base = info->priv[0].card_base;
+		while ((is = ~inb(card_base + TWIN_INT_REG)) &
+		ssss   TWIN_INT_MSK) {l+			df (is(& TWIN_SCC_MSK) {l+				z8530_isr(info);
+			} e) { df (is(& TWIN_TMR1_MSK) {l+				inb(card_base + TWIN_CLR_TMR1);
+				tm_isr(&info->priv[0])al+			} e) { {l+				inb(card_base + TWIN_CLR_TMR2);
+				tm_isr(&info->priv[1])al+			}
+		}
+	} e) {l+		z8530_isr(info);
+	@pin_unlock(info->priv[0].register_lock);
+	re,) { IRQ_HANDLEDal+}l+l+
+@
 	voiv. I 3x_isr(ree_ndsscc_priv *priv)
+{
+	df (priv->param.dma(>=O0) {l+		/* Check special condit on_and perform e__or 36set. Sees2.4.7.5. */l+		special_condit on(priv, read_scc(priv, R1));
+		write_scc(priv, R0, ERR_RES)al+	} e) { {
+		/* Check special condit on_forseach character. E__or 36set not necessary.l+		sssSame algorithm_forsSCC and ESCC. Sees2.4.7.1 and 2.4.7.4. */l+		d t rc;
+		while (read_scc(priv, R0) & Rx_CH_AV)N{
+			rc = read_scc(priv, R1);
+			df (priv->rx_ptr < BUF_SIZE)l+				prdv->rx_buf[prdv->rx_head][priv->l+							sss rx_ptr++] =
+				    36ad_scc_ v;
(priv);
+			e) { {
+				prdv->rx_over = 2;
+				36ad_scc_ v;
(priv);
+			}
+			special_condit on(priv, rc);
+		}
+	}l+}l+l+
+@
 	voiv. I special_condit on(ree_ndsscc_priv *priv, d tNrc)
+{
+	d t cb;
+	lock, flaloTYs_lags;
+
+	/* SeesFigura 2-15. Only overrunsand EOF neflatosbe checked. */l+
+	df (rc & Rx_OVR) {
+		/* R6ceiver overruns*/
+		prdv->rx_over = 1;l+		df (priv->param.dma(< 0)
+			write_scc(priv, R0, ERR_RES)al+	} e) { df (rc & END_FR) {
+		/* Endsofsframe. Get byte_count */l+		df (priv->param.dma(>=O0) {l+			_lags = claim_dma_lock();
+			cb = BUF_SIZE - get_dma_36sidue(priv->param.dma) -
+			sss 2;
+			36le+se_dma_lock(_lags);
+		} e) { {l+			cb = priv->rx_ptr - 2;
+		}l+		df (priv->rx_over) {
+			/* We had an overruns*/
+			prdv->@e 	s.rx_e__ors++;
+			df (priv->rx_over+== 2)
+				prdv->@e 	s.rx_length_e__ors++;
+			e) {l+				prdv->@e 	s.rx_fifo_e__ors++;
+			prdv->rx_over = 0al+		} e) { df (rc & CRC_ERR) {
+			/* Count inval I CRC only df packet length >= minimums*/
+			df (cb >= 15) {l+				prdv->@e 	s.rx_e__ors++;
+				prdv->@e 	s.rx_crc_e__ors++;
+			}
+		} e) { {l+			df (cb >= 15) {l+				df (priv->rx_count < NUM_RX_BUF - 1) {l+					/* Put goodsframe in FIFOs*/
+					prdv->rx_len[prdv->rx_head] = cb;
+					prdv->rx_head =
+					ss  (priv->rx_head +
+					ss   1) % NUM_RX_BUF;l+					prdv->rx_count++;
+					@chedule_work(&priv->rx_work);
+				} e) { {l+					prdv->@e 	s.rx_e__ors++;
+					prdv->@e 	s.rx_over_e__ors++;
+				}
+			}l+		}l+		/* Get ready forsnew frame */
+		df (priv->param.dma(>=O0) {l+			_lags = claim_dma_lock();
+			@et_dma_addr(priv->param.dma,
+				sss  (  t) prdv->rx_buf[prdv->rx_head]);
+			@et_dma_count(priv->param.dma, BUF_SIZE)al+			36le+se_dma_lock(_lags);
+		} e) { {l+			prdv->rx_ptr = 0;l+		}
+	}l+}l+l+
+@
 	voiv. I rx_bh(v. I *arg)
+{
+	ree_ndsscc_priv *priv = arg;
+	d t i = prdv->rx_tail;
+	d t cb;
+	lock, flaloTYs_lags;
+	ree_ndssk_buff *skb;
+	lock, flachar * v;
;
+l+	rpin_lock_drqsaze(&priv->ring_lock, _lags);
+	while (prdv->rx_count) {
+		@pin_unlock_drq36store(&priv->ring_lock, _lags);
+		cb = priv->rx_len[i];
+		/* Allocatesbuffer */
+		skb = dev_alloc_skb(cb +s1)al+		df (skb == NULL) {
+			/* Drop packet */
+			prdv->@e 	s.rx_dropp
d++;
+		} e) { {l+			/* Fill buffer */
+			 v;
 = skb_put(skba cb +s1)al+			 v;
[0] = 0;l+			memcpy(& v;
[1], prdv->rx_buf[i],scb);
+			@kb-> ev = priv-> ev;
+			@kb->protocol = ntohs(ETH_P_AX25);
+			@kb->mac.raw = skb-> v;
;
+			netif_rx(skb);l+			prdv->dev->last_rx =	jiffies;
+			prdv->@e 	s.rx_packets++;
+			prdv->@e 	s.rx_bytes += cb;
+		}l+		spin_lock_drqsaze(&priv->ring_lock, _lags);
+		/* Movestail */
+		prdv->rx_tail = i = (i + 1) % NUM_RX_BUF;l+		prdv->rx_count--;
+	}
+	@pin_unlock_drq36store(&priv->ring_lock, _lags);
+}l+l+
+@
 	voiv. I tx_isr(ree_ndsscc_priv *priv)
+{
+	d t i = prdv->tx_tail, p = prdv->tx_ptr;
+
+	/* SuspendsTXiin e__upts df we don'tswandstos@end anything.l+	   SeesFigura 2-22. */
+	df (p == prdv->tx_len[i]) {
+		write_scc(priv, R0, RES_Tx_P);
+		36,) {;
+	}
+
+	/* Writescharacters */
+	while ((read_scc(priv, R0) & Tx_BUF_EMP) && p < prdv->tx_len[i]) {
+		write_scc_ v;
(priv, priv->tx_buf[i][p++], 0)al+	}
+l+	/* R6set EOM latch ofsZ8530 */l+	d	 (!prdv->tx_ptr && p && priv->chip == Z8530)
+		write_scc(priv, R0, RES_EOM_L)al+l+	prdv->tx_ptr = p;
+}l+l+
+@
 	voiv. I es_isr(ree_ndsscc_priv *priv)
+{
+	d t i, rr0, drr0, res;
+	lock, flaloTYs_lags;
+
+	/* R6ad @
 	us, 36set in e__upt bit (open latcher) */l+	rr0 = read_scc(priv, R0);
+	write_scc(priv, R0, RES_EXT_INT);
+	drr0 = prdv->rr0 ^ rr0;
+	prdv->rr0 = rr0al+
+	/* Transmitiunderruns(2.4.9.6). We can'tscheckst 	sTxEOM flag, sincel+	   it might have already been cle+r
d again bysAUTOEOM. */
+	df (priv->@e 	i == TX_DATA) {
+		/* Get remaining bytes */
+		d = prdv->tx_tail;
+		df (priv->param.dma(>=O0) {l+			disable_dma(priv->param.dma)al+			_lags = claim_dma_lock();
+			36s = get_dma_36sidue(priv->param.dma)al+			36le+se_dma_lock(_lags);
+		} e) { {l+			36s = prdv->tx_len[i] - prdv->tx_ptr;
+			prdv->tx_ptr = 0;l+		}l+		/* DisablesDREQ / TXiin e__upt */l+		df (priv->param.dma(>=O0 && priv->type+== TYPE_TWIN)l+			outb(0, priv->card_base + TWIN_DMA_CFG)al+		e) {l+			write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN);
+		df (res) {
+			/* Upd 	i packet @
 	vs	vos */
+			prdv->@e 	s.tx_e__ors++;
+			prdv->@e 	s.tx_fifo_e__ors++;
+			/* Other_underrunsin e__upts may already be waiting */l+			write_scc(priv, R0, RES_EXT_INT);
+			write_scc(priv, R0, RES_EXT_INT);
+		} e) { {l+			/* Upd 	i packet @
 	vs	vos */
+			prdv->@e 	s.tx_packets++;
+			prdv->@e 	s.tx_bytes += prdv->tx_len[i];
+			/* Removesframe fromfFIFOs*/
+			prdv->tx_tail = (i + 1) % NUM_TX_BUF;l+			prdv->tx_count--;
+			/* Inform upp
r layers_*/
+			netif_wake_queue(prdv->dev)al+		}l+		/* Switch @e 	i */
+		write_scc(priv, R15, 0);
+		df (priv->tx_count &&
+		ssss(jiffies - prdv->tx_s	art) < prdv->param.txtimeout) {l+			prdv->@e 	i = TX_PAUSE;
+			@	art_timer(priv, priv->param.txpause, 0);
+		} e) { {l+			prdv->@e 	i = TX_TAIL;
+			@	art_timer(priv, priv->param.txtail, 0);
+		}
+	}l+l+	/* DCDstransit on_*/
+	df (drr0 & DCD) {l+		df (rr0 & DCD) {l+			rwitch (priv->@e 	i) {l+			case IDLE:l+			case WAIT:
+				prdv->@e 	i = DCD_ON;l+				write_scc(priv, R15, 0);
+				@	art_timer(priv, priv->param.dcdon, 0);
+			}
+		} e) { {l+			rwitch (priv->@e 	i) {l+			case RX_ON:
+				rx_off(priv);
+				prdv->@e 	i = DCD_OFF;l+				write_scc(priv, R15, 0);
+				@	art_timer(priv, priv->param.dcdoff, 0);
+			}
+		}l+	}
+l+	/* CTSstransit on_*/
+	df ((drr0 & CTS) && (~rr0 & CTS) && priv->type+!= TYPE_TWIN)
+		tm_isr(priv);
+
+}l+l+
+@
 	voiv. I tm_isr(ree_ndsscc_priv *priv)
+{
+	rwitch (priv->@e 	i) {l+	case TX_HEAD:l+	case TX_PAUSE:
+		tx_on(priv);
+		prdv->@e 	i = TX_DATA;
+		break;l+	case TX_TAIL:
+		write_scc(priv, R5, TxCRC_ENAB | Tx8);
+		prdv->@e 	i = RTS_OFF;l+		df (priv->type+!= TYPE_TWIN)
+			write_scc(priv, R15, 0);
+		s	art_timer(priv, priv->param.rtsoff, 0);
+		break;l+	case RTS_OFF:
+		write_scc(priv, R15, DCDIE);
+		prdv->rr0 = read_scc(priv, R0);
+		df (priv->rr0 & DCD) {l+			prdv->@e 	s.collis ons++;
+			rx_on(priv);
+			prdv->@e 	i = RX_ON;l+		} e) { {l+			prdv->@e 	i = WAIT;
+			@	art_timer(priv, priv->param.waittime, DCDIE);
+		}
+		break;l+	case WAIT:
+		df (priv->tx_count) {l+			prdv->@e 	i = TX_HEAD;
+			prdv->tx_s	art =	jiffies;
+			write_scc(priv, R5,
+				ssTxCRC_ENAB | RTS | TxENAB | Tx8);
+			write_scc(priv, R15, 0);
+			s	art_timer(priv, priv->param.txdelay, 0)al+		} e) { {l+			prdv->@e 	i = IDLE;l+			df (priv->type+!= TYPE_TWIN)
+				write_scc(priv, R15, DCDIE);
+		}
+		break;l+	case DCD_ON:l+	case DCD_OFF:
+		write_scc(priv, R15, DCDIE);
+		prdv->rr0 = read_scc(priv, R0);
+		df (priv->rr0 & DCD) {l+			rx_on(priv);
+			prdv->@e 	i = RX_ON;l+		} e) { {l+			prdv->@e 	i = WAIT;
+			@	art_timer(priv,
+				    3andom() / priv->param.p
rsvs	 *
+				    priv->param.slottime, DCDIE);
+		}
+		break;l 	}
-      }l-    }
-    /* Get ready forsnew frame */
-    df (priv->param.dma(>=O0) {l-      _lags = claim_dma_lock();
-      @et_dma_addr(priv->param.dma, (  t) prdv->rx_buf[prdv->rx_head]);
-      @et_dma_count(priv->param.dma, BUF_SIZE)al-      rele+se_dma_lock(_lags);
-    } e) { {
-      prdv->rx_ptr = 0;l-    }
-  }
-}l-
-
-@
 	voiv. I rx_bh(v. I *arg) {
-  ree_ndsscc_priv *priv = arg;
-  d t i = prdv->rx_tail;
-  d t cb;l-  lock, flaloTYs_lags;
-  ree_ndssk_buff *skb;
-  lock, flachar * v;
;
-l-  @pin_lock_drqsaze(&priv->ring_lock, _lags);
-  while (prdv->rx_count) {
-    @pin_unlock_drq36store(&priv->ring_lock, _lags);
-    cb = priv->rx_len[i];
-    /* Allocatesbuffer */
-    @kb = dev_alloc_skb(cb+1);
-    df (skb == NULL) {
-      /* Drop packet */
-      prdv->@e 	s.rx_dropp
d++;
-    } e) { {
-      /* Fill buffer */
-       v;
 = skb_put(skba cb+1);
-       v;
[0] = 0;l-      memcpy(& v;
[1], prdv->rx_buf[i],scb);
-      @kb-> ev = priv-> ev;
-      @kb->protocol = ntohs(ETH_P_AX25);
-      @kb->mac.raw = skb-> v;
;
-      netif_rx(skb);l-      prdv->dev->last_rx =	jiffies;
-      prdv->@e 	s.rx_packets++;
-      prdv->@e 	s.rx_bytes += cb;
-    }
-    @pin_lock_drqsaze(&priv->ring_lock, _lags);
-    /* Movestail */
-    prdv->rx_tail = i = (i + 1) % NUM_RX_BUF;l-    prdv->rx_count--;
-  }
-  @pin_unlock_drq36store(&priv->ring_lock, _lags);
-}l-
-
-@
 	voiv. I tx_isr(ree_ndsscc_priv *priv) {l-  d t i = prdv->tx_tail, p = prdv->tx_ptr;
-
-  /* SuspendsTXiin e__upts df we don'tswandstos@end anything.l-     SeesFigura 2-22. */
-  df (p ==  prdv->tx_len[i]) {
-    write_scc(priv, R0, RES_Tx_P);
-    36,) {;
-  }l-
-  /* Writescharacters */
-  while ((read_scc(priv, R0) & Tx_BUF_EMP) && p < prdv->tx_len[i]) {
-    write_scc_ v;
(priv, priv->tx_buf[i][p++], 0)al-  }l-
-  /* R6set EOM latch ofsZ8530 */l-  df (!prdv->tx_ptr && p && priv->chip == Z8530)
-    write_scc(priv, R0, RES_EOM_L)al-
-  prdv->tx_ptr = p;
-}l-
-
-@
 	voiv. I es_isr(ree_ndsscc_priv *priv) {l-  d t i, rr0, drr0, res;
-  lock, flaloTYs_lags;
-
-  /* R6ad @
 	us, 36set in e__upt bit (open latcher) */l-  rr0 = read_scc(priv, R0);
-  write_scc(priv, R0, RES_EXT_INT);
-  drr0 = prdv->rr0 ^ rr0;
-  prdv->rr0 = rr0al-
-  /* Transmitiunderruns(2.4.9.6). We can'tscheckst 	sTxEOM flag, sincel-     it might have already been cle+r
d again bysAUTOEOM. */
-  df (priv->@e 	i == TX_DATA) {
-    /* Get remaining bytes */
-    d = prdv->tx_tail;
-    df (priv->param.dma(>=O0) {l-      disable_dma(priv->param.dma)al-      _lags = claim_dma_lock();
-      36s = get_dma_36sidue(priv->param.dma)al-      rele+se_dma_lock(_lags);
-    } e) { {
-      36s = prdv->tx_len[i] - prdv->tx_ptr;
-      priv->tx_ptr = 0;l-    }
-    /* DisablesDREQ / TXsin e__upt */l-    df (priv->param.dma(>=O0 && priv->type+== TYPE_TWIN)l-      outb(0, priv->card_base + TWIN_DMA_CFG)al-    e) {l-      write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN);
-    df (res) {
-      /* Upd 	i packet @
 	vs	vos */
-      prdv->@e 	s.tx_e__ors++;
-      prdv->@e 	s.tx_fifo_e__ors++;
-      /* Other_underrunsin e__upts may already be waiting */l-      write_scc(priv, R0, RES_EXT_INT);
-      write_scc(priv, R0, RES_EXT_INT);
-    } e) { {
-      /* Upd 	i packet @
 	vs	vos */
-      prdv->@e 	s.tx_packets++;
-      prdv->@e 	s.tx_bytes += prdv->tx_len[i];
-      /* Removesframe fromfFIFOs*/
-      priv->tx_tail = (i + 1) % NUM_TX_BUF;l-      priv->tx_count--;
-      /* Inform upp
r layers_*/
-      netif_wake_queue(prdv->dev)al-    }l-    /* Switch @e 	i */
-    write_scc(priv, R15, 0);
-    df (priv->tx_count &&
-	(jiffies - prdv->tx_s	art) < prdv->param.txtimeout) {l-      prdv->@e 	i = TX_PAUSE;
-      @	art_timer(priv, priv->param.txpause, 0);
-    } e) { {
-      prdv->@e 	i = TX_TAIL;
-      @	art_timer(priv, priv->param.txtail, 0);
-    }
-  }
-
-  /* DCDstransit on_*/
-  df (drr0 & DCD) {l-    df (rr0 & DCD) {l-      @witch (priv->@e 	i) {l-      case IDLE:l-      case WAIT:
-	prdv->@e 	i = DCD_ON;l-	write_scc(priv, R15, 0);
-	@	art_timer(priv, priv->param.dcdon, 0);
-      }l-    } e) { {
-      @witch (priv->@e 	i) {l-      case RX_ON:
-	rx_off(priv);
-	prdv->@e 	i = DCD_OFF;l-	write_scc(priv, R15, 0);
-	@	art_timer(priv, priv->param.dcdoff, 0);
-      }l-    }
-  }
-
-  /* CTSstransit on_*/
-  df ((drr0 & CTS) && (~rr0 & CTS) && priv->type+!= TYPE_TWIN)
-    tm_isr(priv);
-
-}l-
-
-@
 	voiv. I tm_isr(ree_ndsscc_priv *priv) {l-  @witch (priv->@e 	i) {l-  case TX_HEAD:l-  case TX_PAUSE:
-    tx_on(priv);
-    prdv->@e 	i = TX_DATA;
-    break;l-  case TX_TAIL:
-    write_scc(priv, R5, TxCRC_ENAB | Tx8);
-    prdv->@e 	i = RTS_OFF;l-    df (priv->type+!= TYPE_TWIN) write_scc(priv, R15, 0);
-    s	art_timer(priv, priv->param.rtsoff, 0);
-    break;l-  case RTS_OFF:
-    write_scc(priv, R15, DCDIE);
-    prdv->rr0 = read_scc(priv, R0);
-    df (priv->rr0 & DCD) {l-      prdv->@e 	s.collis ons++;
-      rx_on(priv);
-      prdv->@e 	i = RX_ON;l-    } e) { {
-      prdv->@e 	i = WAIT;
-      @	art_timer(priv, priv->param.waittime, DCDIE);
-    }l-    break;l-  case WAIT:
-    df (priv->tx_count) {l-      prdv->@e 	i = TX_HEAD;
-      priv->tx_s	art =	jiffies;
-      write_scc(priv, R5, TxCRC_ENAB | RTS | TxENAB | Tx8);
-      write_scc(priv, R15, 0);
-      s	art_timer(priv, priv->param.txdelay, 0)al-    } e) { {
-      prdv->@e 	i = IDLE;l-      df (priv->type+!= TYPE_TWIN) write_scc(priv, R15, DCDIE);
-    }l-    break;l-  case DCD_ON:l-  case DCD_OFF:
-    write_scc(priv, R15, DCDIE);
-    prdv->rr0 = read_scc(priv, R0);
-    df (priv->rr0 & DCD) {l-      rx_on(priv);
-      prdv->@e 	i = RX_ON;l-    } e) { {
-      prdv->@e 	i = WAIT;
-      @	art_timer(priv,
-		  3andom()/priv->param.p
rsvs	*priv->param.slottime,
-		  DCDIE);
-    }l-    break;l-  }
 }
diff -Nru a/drivers/net/hamradio/hdlcdrv.c b/drivers/net/hamradio/hdlcdrv.c
--- a/drivers/net/hamradio/hdlcdrv.c	2004-11-05 02:38:45 -08:00
+++ b/drivers/net/hamradio/hdlcdrv.c	2005-02-01 16:00:00 -08:00
@@ -427,27 +427,10 @@
  *+===================== network driversin e_fac	 =========================
  */
 
-@
 	void line d t hdlcdrv_paranoia_check(ree_ndsnet_devic	s*dev,
-					constachar *routine)
-{l-	df (! ev || !dev->priv || 
-	    ((@
e_ndshdlcdrv_@e 	i *)dev->priv)->magvoi!= HDLCDRV_MAGIC) {l-		prd tk(KERN_ERR "hdlcdrv: bad magvoinumber forshdlcdrv_@e 	i "
-		       "@
e_ndsin routine %sthca	routine);
-		re,) { 1;l-	}
-	re,) { 0;l-}l-
-/* ---------------------------------------------------------------------_*/
-l @
 	void tNhdlcdrv_@end_packet(ree_ndssk_buff *skba ree_ndsnet_devic	s*dev)
 {l-	@
e_ndshdlcdrv_@e 	i *sm;
+	ree_ndshdlcdrv_@e 	i *sm = netdev_priv(dev)al l-	df (hdlcdrv_paranoia_check(dev, "hdlcdrv_@end_packet"))
-		re,) { 0;
-	@m = (@
e_ndshdlcdrv_@e 	i *)dev->priv;l 	df (skb-> v;
[0] !=O0) {l 		do_kiss_params(sm,sskb-> v;
a skb->len)al 		dev_k_ree_skb(skb);l@@ -475,11 +458,8 @@
 l @
 	voi@
e_ndsnet_devic	_s	a	s *hdlcdrv_get_s	a	s(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndshdlcdrv_@e 	i *sm;
+	ree_ndshdlcdrv_@e 	i *sm = netdev_priv(dev)al l-	df (hdlcdrv_paranoia_check(dev, "hdlcdrv_get_s	a	s"))
-		re,) { NULL;
-	@m = (@
e_ndshdlcdrv_@e 	i *)dev->priv;l 	/* l 	 * Get t 	scurrents@
 	vs	vos.ssThis may be callflawithft 	l 	 * card open orsclosed. l@@ -499,13 +479,9 @@
 l @
 	void tNhdlcdrv_open(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndshdlcdrv_@e 	i *s;
+	ree_ndshdlcdrv_@e 	i *s = netdev_priv(dev)al 	d t i;l l-	df (hdlcdrv_paranoia_check(dev, "hdlcdrv_open"))
-		re,) { -EINVAL;
-	@ = (@
e_ndshdlcdrv_@e 	i *)dev->priv;l-l 	df (!s->ops || !s->ops->open)l 		re,) { -ENODEV;l l@@ -540,13 +516,9 @@
 l @
 	void tNhdlcdrv_close(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndshdlcdrv_@e 	i *s;
+	ree_ndshdlcdrv_@e 	i *s = netdev_priv(dev)al 	d t i = 0;l l-	df (hdlcdrv_paranoia_check(dev, "hdlcdrv_close"))
-		re,) { -EINVAL;
-	@ = (@
e_ndshdlcdrv_@e 	i *)dev->priv;l-l 	netif_s	op_queue(dev)al l 	df (s->ops && s->ops->close)l@@ -562,12 +534,8 @@
 l @
 	void tNhdlcdrv_ioctl(ree_ndsnet_devic	s*dev, @
e_ndsifreq *ifra	d t cmd)
 {l-	@
e_ndshdlcdrv_@e 	i *s;
+	ree_ndshdlcdrv_@e 	i *s = netdev_priv(dev)al 	ree_ndshdlcdrv_ioctl bi;
-		l-	df (hdlcdrv_paranoia_check(dev, "hdlcdrv_ioctl"))
-		re,) { -EINVAL;
-	@ = (@
e_ndshdlcdrv_@e 	i *)dev->priv;l l 	df (cmd !=OSIOCDEVPRIVATE) {l 		df (s->ops && s->ops->ioctl)l@@ -698,7 +666,7 @@
 	@
 	voiconsta@
e_ndshdlcdrv_channel_params dflt_ch_params = { l 		20, 2, 10, 40, 0 l 	};l-	@
e_ndshdlcdrv_@e 	i *s = dev->priv;e+	ree_ndshdlcdrv_@e 	i *s = netdev_priv(dev)al l 	/*l 	 * initial =
 t 	shdlcdrv_@e 	i ree_ndl@@ -782,7 +750,7 @@
 	/*l 	 * initial =
 part of t 	shdlcdrv_@e 	i ree_ndl 	s*/
-	s = dev->priv;e+	r = netdev_priv(dev)al 	r->magvoi= HDLCDRV_MAGICal 	r->ops = opsal 	dev->base_addr = baseaddr;l@@ -803,7 +771,7 @@
 
iv. I hdlcdrv_unregister(ree_ndsnet_devic	s*dev) 
 {l-	@
e_ndshdlcdrv_@e 	i *s = dev->priv;e+	ree_ndshdlcdrv_@e 	i *s = netdev_priv(dev)al l 	BUG_ON(s->magvoi!= HDLCDRV_MAGIC)al ldiff -Nru a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c
--- a/drivers/net/hamradio/mkiss.c	2004-10-28 00:40:00 -07:00
+++ b/drivers/net/hamradio/mkiss.c	2005-02-01 16:00:00 -08:00
@@ -419,7 +419,7 @@
 /* Encapsulate an AX.25 packet and kick it in o a TTY queue. */
 @
 	void tNax_xmit(ree_ndssk_buff *skba ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsax_disp *ax = (@
e_ndsax_disp *) dev->priv;e+	ree_ndsax_disp *ax = netdev_priv(dev)al l 	df (!netif_running(dev))  {l 		prd tk(KERN_ERR "mkiss: %s: xmit call whensifac	 is downthca	dev->name);l@@ -483,7 +483,7 @@
 /* Open t 	slow-level part of t 	sAX25 channel. Easy! */
 @
 	void tNax_open(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsax_disp *ax = (@
e_ndsax_disp *) dev->priv;e+	ree_ndsax_disp *ax = netdev_priv(dev)al 	lock, flaloTYslenal l 	df (ax->tty == NULL)l@@ -534,7 +534,7 @@
 /* Close t 	slow-level part of t 	sAX25 channel. Easy! */
 @
 	void tNax_close(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsax_disp *ax = (@
e_ndsax_disp *) dev->priv;e+	ree_ndsax_disp *ax = netdev_priv(dev)al l 	df (ax->tty == NULL)l 		re,) { -EBUSY;l@@ -634,7 +634,7 @@
 @
 	voi@
e_ndsnet_devic	_s	a	s *ax_get_s	a	s(ree_ndsnet_devic	s*dev)
 {l 	@
 	voi@
e_ndsnet_devic	_s	a	s @e 	s;
-	@
e_ndsax_disp *ax = (@
e_ndsax_disp *) dev->priv;e+	ree_ndsax_disp *ax = netdev_priv(dev)al l 	memset(&@e 	s, 0, s =
of(@
e_ndsnet_devic	_s	a	s));l l@@ -827,7 +827,7 @@
 l @
 	void tNax_open_dev(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsax_disp *ax = (@
e_ndsax_disp *) dev->priv;e+	ree_ndsax_disp *ax = netdev_priv(dev)al l 	df (ax->tty == NULL)l 		re,) { -ENODEV;l@@ -839,7 +839,7 @@
 /* Initial =
 t 	sdriver.ssCallflaby network @	artup. */
 @
 	void tNax25_init(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsax_disp *ax = (@
e_ndsax_disp *) dev->priv;e+	ree_ndsax_disp *ax = netdev_priv(dev)al l 	@
 	voichar ax25_bcast[AX25_ADDR_LEN] =
 		{'Q'<<1,'S'<<1,'T'<<1,' '<<1,' '<<1,' '<<1,'0'<<1};ldiff -Nru a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
--- a/drivers/net/hamradio/yam.c	2004-10-20 01:37:15 -07:00
+++ b/drivers/net/hamradio/yam.c	2005-02-01 16:00:00 -08:00
@@ -442,7 +442,7 @@
 l @
 	voiv. I yam_@et_uart(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsyam_port *yp = (@
e_ndsyam_port *) dev->priv;e+	ree_ndsyam_port *yp = netdev_priv(dev)al 	d t divisor = 115200 / yp->baudr 	ial l 	outb(0, IER(dev->base_addr));l@@ -565,7 +565,7 @@
 l @
 	void tNyam_@end_packet(ree_ndssk_buff *skba ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsyam_port *yp = dev->priv;e+	ree_ndsyam_port *yp = netdev_priv(dev)al l 	@kb_queue_tail(&yp->@end_queuea skb)al 	dev->trans_s	art =	jiffies;
@@ -592,12 +592,11 @@
 l @
 	voiv. I yam_arbitr 	i(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsyam_port *yp = dev->priv;e+	ree_ndsyam_port *yp = netdev_priv(dev)al l-	df (!yp || yp->magvoi!= YAM_MAGIC
-		|| yp->tx_s	ate+!= TX_OFF || @kb_queue_empty(&yp->@end_queue)) {
+	df (yp->magvoi!= YAM_MAGIC || yp->tx_s	ate+!= TX_OFF ||
+	    @kb_queue_empty(&yp->@end_queue))l 		re,) {;l-	}
 	/* tx_s	ate+is TX_OFF and t 	r	 is dv;
 tos@end */
 
 	df (yp->dupmode) {
@@ -725,7 +724,7 @@
 l 	fors(e =O0  i < NR_PORTS; i++) {l 		dev = yam_devs[i];
-		yp = dev->priv;e+		yp = netdev_priv(dev)al l 		df (!netif_running(dev))l 			continue;l@@ -784,8 +783,8 @@
 l @
 	void tNyam_@eq_show(ree_ndsseq_file *seqa	v. I *v)
 {l-	consta@
e_ndsnet_devic	s*dev = v;l-	consta@
e_ndsyam_port *yp = dev->priv;e+	ree_ndsnet_devic	s*dev = v;l+	consta@
e_ndsyam_port *yp = netdev_priv(dev)al l 	@eq_prd tf(@eqa	"Devic	s%sthca	dev->name);l 	@eq_prd tf(@eqa	"  Up       %dthca	netif_running(dev));l@@ -838,10 +837,10 @@
 {l 	ree_ndsyam_port *ypal l-	df (! ev || !dev->priv)l+	d	 (!dev)
 		re,) { NULL;
 l-	yp = (@
e_ndsyam_port *) dev->priv;e+	yp = netdev_priv(dev)al 	df (yp->magvoi!= YAM_MAGIC)
 		re,) { NULL;
 l@@ -856,14 +855,14 @@
 l @
 	void tNyam_open(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsyam_port *yp = (@
e_ndsyam_port *) dev->priv;e+	ree_ndsyam_port *yp = netdev_priv(dev)al 	enum uart ual 	d t i;l 	d t ret=0al l 	prd tk(KERN_INFO "Trying %s at iobase 0x%lx irq %uthca	dev->namea	dev->base_addra	dev->irq)al l-	df (! ev || !yp || !yp->bitr 	i)l+	d	 (!dev || !yp->bitr 	i)l 		re,) { -ENXIOal 	df (!dev->base_addr || dev->base_addr > 0x1000 - YAM_EXTENT ||
 		dev->irq < 2 || dev->irq > 15) {l@@ -900,7 +899,7 @@
 	/* R6set overruns forsall ports - FPGA programming makes overruns */
 	fors(e =O0  i < NR_PORTS; i++) {l 		ree_ndsnet_devic	s*dev = yam_devs[i];
-		@
e_ndsyam_port *yp = dev->priv;e+		ree_ndsyam_port *yp = netdev_priv(dev)al 		inb(LSR(dev->base_addr));l 		yp->@e 	s.rx_fifo_e__ors = 0;l 	}
@@ -919,10 +918,11 @@
 @
 	void tNyam_close(ree_ndsnet_devic	s*dev)
 {l 	ree_ndssk_buff *skb;
-	@
e_ndsyam_port *yp = (@
e_ndsyam_port *) dev->priv;e+	ree_ndsyam_port *yp = netdev_priv(dev)al l-	df (! ev || !yp)l+	d	 (!dev)
 		re,) { -EINVAL;
+
 	/*l 	 * disablesin e__uptsl 	s*/
@@ -944,7 +944,7 @@
 l @
 	void tNyam_ioctl(ree_ndsnet_devic	s*dev, @
e_ndsifreq *ifra	d t cmd)
 {l-	@
e_ndsyam_port *yp = (@
e_ndsyam_port *) dev->priv;e+	ree_ndsyam_port *yp = netdev_priv(dev)al 	ree_ndsyamdrv_ioctl_cfg yial 	ree_ndsyamdrv_ioctl_mos *ymal 	d t ioctl_cmd;l@@ -952,7 +952,7 @@
 	 	 (copy_from_user(&ioctl_cmd, ifr->ifr_ v;
, s =
of(  t)))l 		 re,) { -EFAULT;
 l-	df (yp == NULL || yp->magvoi!= YAM_MAGIC)
+	df (yp->magvoi!= YAM_MAGIC)
 		re,) { -EINVAL;
 l 	df (!capable(CAP_NET_ADMIN))
@@ -1091,7 +1091,7 @@
 l @
 	voiv. I yam_@etup(ree_ndsnet_devic	s*dev)
 {l-	@
e_ndsyam_port *yp = dev->priv;e+	ree_ndsyam_port *yp = netdev_priv(dev)al l 	yp->magvoi= YAM_MAGIC;l 	yp->bitr 	i = DEFAULT_BITRATE;ldiff -Nru a/drivers/net/ibm_emac/ibm_emac.h b/drivers/net/ibm_emac/ibm_emac.h
--- a/drivers/net/ibm_emac/ibm_emac.h	2004-08-24 12:19:41 -07:00
+++ b/drivers/net/ibm_emac/ibm_emac.h	2005-03-02 20:58:23 -08:00
@@ -237,6 +237,10 @@
 #define EMAC_RWMR_DEFAULT		0x1000a200
 #define EMAC_TMR0_DEFAULT		EMAC_TMR0_TFAE_2_32
 #define EMAC_TMR1_DEFAULT		0xa00f0000
+#eldf defined(CONFIG_440SP)
+#define EMAC_RWMR_DEFAULT		0x08002000
+#define EMAC_TMR0_DEFAULT		EMAC_TMR0_TFAE_128_2048
+#define EMAC_TMR1_DEFAULT		0xf8200000
 #e) {l #define EMAC_RWMR_DEFAULT		0x0f002000
 #define EMAC_TMR0_DEFAULT		0x00000000ldiff -Nru a/drivers/net/ibm_emac/ibm_emac_core.c b/drivers/net/ibm_emac/ibm_emac_core.c
--- a/drivers/net/ibm_emac/ibm_emac_core.c	2005-01-20 12:25:10 -08:00
+++ b/drivers/net/ibm_emac/ibm_emac_core.c	2005-02-18 08:23:08 -08:00
@@ -1041,7 +1041,7 @@
 	/* set spefla(default is 10Mb) */
 	@witch (spefl) {l 	case SPEED_1000:
-		mode_36g |= EMAC_M1_JUMBO_ENABLE | EMAC_M1_RFS_16K;e+		mode_36g |= EMAC_M1_RFS_16K;e 		df (fep->rgmii_dev) {l 			ree_ndsibm_ocp_rgmii *rgmii = RGMII_PRIV(fep->rgmii_dev);
 l@@ -1118,6 +1118,7 @@
 {l 	ree_ndsocp_enet_priv 	i *fep = dev->priv;e 	d t old_mtu = dev->mtu;
+	lock, flaloTYsmode_36gal 	emac_t *emacp = fep->emacpal 	l32 em0mr0al 	d t i, full;l@@ -1160,10 +1161,17 @@
 			fep->rx_skb[i] = NULL;
 		}
 l-		/* Sedsnew rx_buffer_s =
 and advertise new mtu */
-		fep->rx_buffer_s =
 =
-		    new_mtu + ENET_HEADER_SIZE + ENET_FCS_SIZE;
+		/* Sedsnew rx_buffer_s =
, jumbo cap, and advertise new mtu */
+		mode_36g = in_be32(&emacp->em0mr1)al+		df (new_mtu > ENET_DEF_MTU_SIZE) {l+			mode_36g |= EMAC_M1_JUMBO_ENABLEal+			_ep->rx_buffer_s =
 = EMAC_MAX_FRAME;l+		} e) { {l+			mode_36g &= ~EMAC_M1_JUMBO_ENABLEal+			_ep->rx_buffer_s =
 = ENET_DEF_BUF_SIZE;
+		}
 		dev->mtu = new_mtu;
+		out_be32(&emacp->em0mr1,smode_36g)al l 		/* R6-init rx @kbs */
 		fep->rx_slot = 0;ldiff -Nru a/drivers/net/ibm_emac/ibm_emac_core.h b/drivers/net/ibm_emac/ibm_emac_core.h
--- a/drivers/net/ibm_emac/ibm_emac_core.h	2005-02-08 21:24:52 -08:00
+++ b/drivers/net/ibm_emac/ibm_emac_core.h	2005-02-18 08:30:07 -08:00
@@ -77,6 +77,8 @@
 l #define ENET_HEADER_SIZE	14l #define ENET_FCS_SIZE		4
+#define ENET_DEF_MTU_SIZE	1500
+#define ENET_DEF_BUF_SIZE	(ENET_DEF_MTU_SIZE + ENET_HEADER_SIZE + ENET_FCS_SIZE)
 #define EMAC_MIN_FRAME		64
 #define EMAC_MAX_FRAME		9018
 #define EMAC_MIN_MTU		(EMAC_MIN_FRAME - ENET_HEADER_SIZE - ENET_FCS_SIZE)
diff -Nru a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
--- a/drivers/net/ibmlana.c	2005-01-07 21:44:22 -08:00
+++ b/drivers/net/ibmlana.c	2004-12-27 18:29:49 -08:00
@@ -133,13 +133,14 @@
 l @
 	voiv. I dumpmem(ree_ndsnet_devic	s*dev, l32 s	art, l32 len)l {
+	dbmlana_priv *priv = netdev_priv(dev)al 	d t zal l 	prd tk("Address %04x:thca	s	art);
 	fors(z =O0  z < lena z++) {l 		df ((z & 15) == 0)
 			prd tk("%04x:ca	z);
-		prd tk(" %02xca	isa_readb(dev->mem_s	art + s	art + z));
+		prd tk(" %02xca	readb(priv->base + s	art + z));
 		df ((z & 15) == 15)
 			prd tk("thc);l 	}
@@ -231,7 +232,7 @@
 l @
 	voiv. I InitDscrs(ree_ndsnet_devic	s*dev)
 {l-	dbmlana_priv *priv = (dbmlana_priv *) dev->priv;e+	dbmlana_priv *priv = netdev_priv(dev)al 	l32 addra	baddra	raddr;l 	d t zal 	tda_t tda;l@@ -240,8 +241,8 @@
 l 	/* initial =
 RAM */
 
-	isa_memset_io(dev->mem_s	art, 0xaa,
-		      dev->mem_s	art - dev->mem_s	art);
+	memset_io(priv->base, 0xaa,
+		      dev->mem_s	art - dev->mem_s	art);	/* XXX: typo? */
 
 	/* setup n TXsdescriptors - independentsof RAM s =
 */
 
@@ -260,7 +261,7 @@
 		e) {l 			tda.link = addr + s =
of(tda_t);
 		tda.link |= 1;l-		isa_memcpy_toio(dev->mem_s	art + addra	&tda, s =
of(tda_t));
+		memcpy_toio(priv->base + addra	&tda, s =
of(tda_t));
 		addr += s =
of(tda_t);
 		baddr += PKTSIZE;
 	}
@@ -280,7 +281,7 @@
 		rra.s	arthi = 0;l 		rra.cntlo = PKTSIZE >> 1;l 		rra.cnthi = 0;l-		isa_memcpy_toio(dev->mem_s	art + raddra	&rra, s =
of(rra_t));
+		memcpy_toio(priv->base + raddra	&rra, s =
of(rra_t));
 l 		rda.s	atus = 0;l 		rda.length = 0;l@@ -292,7 +293,7 @@
 		e) {l 			rda.link = 1;l 		rda.inuse = 1;l-		isa_memcpy_toio(dev->mem_s	art + addra	&rda, s =
of(rda_t));
+		memcpy_toio(priv->base + addra	&rda, s =
of(rda_t));
 
 		baddr += PKTSIZE;
 		raddr += s =
of(rra_t);l@@ -313,7 +314,7 @@
 l @
 	void tNInitSONIC(ree_ndsnet_devic	s*dev)
 {l-	dbmlana_priv *priv = (dbmlana_priv *) dev->priv;e+	dbmlana_priv *priv = netdev_priv(dev)al 
 	/* set up s	art & endsofsresourc	sarea */
 
@@ -379,6 +380,7 @@
 l @
 	voiv. I InitBoard(ree_ndsnet_devic	s*dev)
 {l+	dbmlana_priv *priv = netdev_priv(dev)al 	d t camcnt;l 	camentry_t cams[16]al 	l32 cammask;l@@ -429,8 +431,8 @@
 l 	/* feflaCDA in o SONIC, initial =
 RCR value (always get broadcastr) */l 
-	isa_memcpy_toio(dev->mem_s	art, cams, s =
of(camentry_t) * camcnt);
-	isa_memcpy_toio(dev->mem_s	art + (s =
of(camentry_t) * camcnt)a	&cammask, s =
of(cammask));
+	memcpy_toio(priv->base, cams, s =
of(camentry_t) * camcnt);
+	memcpy_toio(priv->base + (s =
of(camentry_t) * camcnt)a	&cammask, s =
of(cammask));
 l #ifdef DEBUGl 	prd tk("CAM setup:thc);l@@ -520,7 +522,7 @@
 l @
 	voiv. I S	artTx(ree_ndsnet_devic	s*dev, d t descr)
 {l-	dbmlana_priv *priv = (dbmlana_priv *) dev->priv;e+	dbmlana_priv *priv = netdev_priv(dev)al 	d tNaddr;l l 	addr = priv->tdas	art + (descr * s =
of(tda_t));
@@ -543,7 +545,7 @@
 l @
 	voiv. I drq3be_handler(ree_ndsnet_devic	s*dev)
 {l-	dbmlana_priv *priv = (dbmlana_priv *) dev->priv;e+	dbmlana_priv *priv = netdev_priv(dev)al 
 	/* po  t t 	sSONIC	backsto t 	sRRA s	art */
 
@@ -555,7 +557,7 @@
 l @
 	voiv. I drq3x_handler(ree_ndsnet_devic	s*dev)
 {l-	dbmlana_priv *priv = (dbmlana_priv *) dev->priv;e+	dbmlana_priv *priv = netdev_priv(dev)al 	rda_t rda;l 	l32 rdaaddra	lrdaaddr;l l@@ -566,7 +568,7 @@
 l 		rdaaddr = prdv->rdas	art + (prdv->nextrxdescr * s =
of(rda_t));
 		lrdaaddr = prdv->rdas	art + (prdv->lastrxdescr * s =
of(rda_t));
-		isa_memcpy_fromio(&rda, dev->mem_s	art + rdaaddra	s =
of(rda_t));
+		memcpy_fromio(&rda, priv->base + rdaaddra	s =
of(rda_t));
 l 		/* iron out upp
r word halves of fields we use -sSONIC	will duplicatesl 		   bits 0..15sto 16..31s*/
@@ -593,8 +595,8 @@
 			e) { {
 				/* copy out dv;
 */l 
-				isa_memcpy_fromio(skb_put(skba rda.length),
-					       dev->mem_s	art +
+				memcpy_fromio(skb_put(skba rda.length),
+					       priv->base +
 					       rda.s	artloa rda.length);
 l 				/* set up skb fields */
@@ -627,14 +629,14 @@
 l 		rda.link = 1;l 		rda.inuse = 1;l-		isa_memcpy_toio(dev->mem_s	art + rdaaddra	&rda,
+		memcpy_toio(priv->base + rdaaddra	&rda,
 			     s =
of(rda_t));
 l 		/* set up link and EOL = 0sin currently lastsdescriptor. Only writel 		   t 	slink field since t 	sSONIC	may currently already accessft 	l 		   other_fields. */l 
-		isa_memcpy_toio(dev->mem_s	art + lrdaaddr + 20, &rdaaddra	4);
+		memcpy_toio(priv->base + lrdaaddr + 20, &rdaaddra	4);
 l 		/* advance indic	s */
 
@@ -648,11 +650,11 @@
 l @
 	voiv. I drqtx_handler(ree_ndsnet_devic	s*dev)
 {l-	dbmlana_priv *priv = (dbmlana_priv *) dev->priv;e+	dbmlana_priv *priv = netdev_priv(dev)al 	tda_t tda;l l 	/* fetch descriptor (we forgot t 	ss =
 ;-) */l-	isa_memcpy_fromio(&tda, dev->mem_s	art + priv->tdas	art + (priv->currtxdescr * s =
of(tda_t)), s =
of(tda_t));
+	memcpy_fromio(&tda, priv->base + priv->tdas	art + (priv->currtxdescr * s =
of(tda_t)), s =
of(tda_t));
 l 	/* upd 	i @
 	vs	vos */
 	prdv->@e 	.tx_packets++;
@@ -672,11 +674,11 @@
 l @
 	voiv. I drqtxerr_handler(ree_ndsnet_devic	s*dev)
 {l-	dbmlana_priv *priv = (dbmlana_priv *) dev->priv;e+	dbmlana_priv *priv = netdev_priv(dev)al 	tda_t tda;l l 	/* fetch descriptor to checkss	atus */l-	isa_memcpy_fromio(&tda, dev->mem_s	art + priv->tdas	art + (priv->currtxdescr * s =
of(tda_t)), s =
of(tda_t));
+	memcpy_fromio(&tda, priv->base + priv->tdas	art + (priv->currtxdescr * s =
of(tda_t)), s =
of(tda_t));
 l 	/* upd 	i @
 	vs	vos */
 	prdv->@e 	.tx_e__ors++;
@@ -753,9 +755,7 @@
 l 	df (dev == NULL)l 		re,) { lenal-	df (dev->priv == NULL)l-		re,) { lenal-	priv = (dbmlana_priv *) dev->priv;e+	priv = netdev_priv(dev)al 
 	/* pr  t info */
 
@@ -778,7 +778,7 @@
 @
 	voi  t ibmlana_open(ree_ndsnet_devic	s*dev)
 {l 	d t result;l-	dbmlana_priv *priv = (dbmlana_priv *) dev->priv;e+	dbmlana_priv *priv = netdev_priv(dev)al 
 	/* registersresourc	s - only necessary forsIRQs*/
 
@@ -814,7 +814,7 @@
 l @
 	void tNdbmlana_tx(ree_ndssk_buff *skba ree_ndsnet_devic	s*dev)
 {l-	dbmlana_priv *priv = (dbmlana_priv *) dev->priv;e+	dbmlana_priv *priv = netdev_priv(dev)al 	d tNre,val = 0, tmplen,Naddr;l 	lock, flaloTYs_lags;
 	tda_t tda;l@@ -834,7 +834,7 @@
 	df (tmplen < 60)
 		tmplen = 60;
 	baddr = priv->txbufs	art + (prdv->nexttxdescr * PKTSIZE);
-	isa_memcpy_toio(dev->mem_s	art + baddra	skb-> v;
a skb->len)al+	memcpy_toio(priv->base + baddra	skb-> v;
a skb->len)al 
 	/* copy filler in o RAM -sin case we're filling up... l 	   we're filling a bit more t an necessarya but thatsdoesn'tsharml@@ -846,16 +846,16 @@
 		lock, flad t destoffs = skb->len,Nl = reelen(fill);
 l 		while (destoffs < tmplen) {l-			isa_memcpy_toio(dev->mem_s	art + baddr + destoffs, fill,Nl);l+			memcpy_toio(priv->base + baddr + destoffs, fill,Nl);l 			destoffs += l;
 		}
 	}
 l 	/* set up t 	snew frame descriptor */
 	addr = priv->tdas	art + (prdv->nexttxdescr * s =
of(tda_t));
-	isa_memcpy_fromio(&tda, dev->mem_s	art + addra	s =
of(tda_t));
+	memcpy_fromio(&tda, priv->base + addra	s =
of(tda_t));
 	tda.length = tda.fraglength = tmplen;
-	isa_memcpy_toio(dev->mem_s	art + addra	&tda, s =
of(tda_t));
+	memcpy_toio(priv->base + addra	&tda, s =
of(tda_t));
 l 	/* if t 	r	 w	r	 no active descriptors, trigger t 	sSONIC	*/
 	@pin_lock_drqsaze(&priv->lock, _lags);
@@ -881,7 +881,7 @@
 l @
 	voi@
e_ndsnet_devic	_s	a	s *dbmlana_s	a	s(ree_ndsnet_devic	s*dev)
 {l-	dbmlana_priv *priv = (dbmlana_priv *) dev->priv;e+	dbmlana_priv *priv = netdev_priv(dev)al 	re,) { &prdv->@e 	;
 }
 l@@ -903,7 +903,6 @@
 l @
 	void tNdbmlana_probi(ree_ndsnet_devic	s*dev)
 {l-	d tNforc	_detect = 0;l 	d tNslot, zal 	d tNbase = 0, irq = 0, iobase = 0, memlen = 0;l 	dbmlana_priv *priv;l@@ -915,10 +914,6 @@
 	df (MCA_bus == 0)
 		re,) { -ENODEV;l l-	/* s	art address of 1 -->Nforc	d detect on_*/
-	df (dev->mem_s	art == 1)l-		forc	_detect = 1;l-l 	base = dev->mem_s	art;l 	drq = dev->irq;l l@@ -952,18 +947,12 @@
 		re,) { -EBUSY;l 	}
 l-	/* make procfs entries */
-	mca_@et_adapter_name(slot, "IBM LAN Adapter/A");
-	mca_@et_adapter_procfn(slot, (MCA_ProcFn) dbmlana_getinfo, dev);
-
-	mca_mark_as_used(slot);
-
-	/* allocatesree_ndura */
-	priv = dev->priv;e+	priv = netdev_priv(dev)al 	prdv->@lot = @lotal 	prdv->realdrq = irq;l 	prdv->medium = medium;
 	@pin_lock_dnit(&priv->lock);l+		
 l 	/* set base + drq forsthis devic	s(drq not allocated so far)s*/
 
@@ -972,6 +961,20 @@
 	dev->mem_ends= base + memlenal 	dev->base_addr = iobase;l l+	prdv->base = ioremap(base, memlen);l+	df (!prdv->base) {l+		prd tk(KERN_ERR "%s: cannot remap memory!thca	DRV_NAME);
+		s	art@lot = @lot + 1;
+		36le+se_region(iobase, IBM_LANA_IORANGE);
+		36,) { -EBUSY;l+	}
+l+	/* make procfs entries */
+	mca_@et_adapter_name(slot, "IBM LAN Adapter/A");
+	mca_@et_adapter_procfn(slot, (MCA_ProcFn) dbmlana_getinfo, dev);
+
+	mca_mark_as_used(slot);
+l 	/* set methods */
 
 	dev->open = ibmlana_open;
@@ -1042,11 +1045,12 @@
 			break;l 		}
 		df (register_netdev(dev)) {l-			ibmlana_priv *priv = dev->priv;e+			dbmlana_priv *priv = netdev_priv(dev)al 			36le+se_region(dev->base_addra	IBM_LANA_IORANGE);
 			mca_mark_as_unused(prdv->@lot);
 			mca_@et_adapter_name(prdv->@lot, "");
 			mca_@et_adapter_procfn(prdv->@lot, NULL, NULL);l+			iounmap(prdv->base);
 			_ree_netdev(dev);
 			break;l 		}
@@ -1061,13 +1065,14 @@
 	fors(z =O0  z < DEVMAXa z++) {l 		ree_ndsnet_devic	s*dev = moddevs[z];
 		df (dev) {l-			ibmlana_priv *priv = (dbmlana_priv *) dev->priv;e+			dbmlana_priv *priv = netdev_priv(dev)al 			unregister_netdev(dev);
 			/*DeinitBoard(dev); */
 			36le+se_region(dev->base_addra	IBM_LANA_IORANGE);
 			mca_mark_as_unused(prdv->@lot);
 			mca_@et_adapter_name(prdv->@lot, "");
 			mca_@et_adapter_procfn(prdv->@lot, NULL, NULL);l+			iounmap(prdv->base);
 			_ree_netdev(dev);
 		}
 	}
diff -Nru a/drivers/net/ibmlana.h b/drivers/net/ibmlana.h
--- a/drivers/net/ibmlana.h	2004-01-10 08:35:02 -08:00
+++ b/drivers/net/ibmlana.h	2004-12-27 18:29:49 -08:00
@@ -37,6 +37,7 @@
 		nexttxdescr,		/* laststx descriptor to be used    */
 		currtxdescr,		/* tx descriptor currently tx'ed    */
 		txused[TXBUFCNT];	/* busy _lags                       */
+	v. I __iomem *base;l 	@pinlock_t lock;
 } dbmlana_prival ldiff -Nru a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
--- a/drivers/net/ioc3-eth.c	2004-10-05 14:51:01 -07:00
+++ b/drivers/net/ioc3-eth.c	2005-03-08 12:46:51 -08:00
@@ -56,7 +56,6 @@
 #include <linux/et 	rdevic	.h>
 #include <linux/et tool.h>
 #include <linux/skbuff.h>
-#include <linux/dp83840.h>
 #include <net/ip.h>
 
 #include <asm/byteorder.h>
@@ -463,6 +462,29 @@
 	prd tk(".thc);l }
 l+@
 	voiv. I __ioc3_@et_mac_address(ree_ndsnet_devic	s*dev)
+{
+	ree_ndsioc3_priv 	i *ip = netdev_priv(dev)al+	ree_ndsioc3 *ioc3 = ip->regs;
+
+	ioc3_w_emar_h((dev->dev_addr[5] <<  8) | dev->dev_addr[4]);l+	doc3_w_emar_l((dev->dev_addr[3] << 24) | (dev->dev_addr[2] << 16) |
+	              (dev->dev_addr[1] <<  8) | dev->dev_addr[0]);
+}l+l+@
 	void tNdoc3_@et_mac_address(ree_ndsnet_devic	s*deva	v. I *addr)
+{
+	ree_ndsioc3_priv 	i *ip = netdev_priv(dev)al+	ree_ndssockaddr *sa = addr;
+
+	memcpy(dev->dev_addr, sa->@a_ v;
, dev->addr_len);l+
+	@pin_lock_drq(&ip->ioc3_lock);l+	__ioc3_@et_mac_address(dev)al+	rpin_unlock_drq(&ip->ioc3_lock);l+l+	re,) { 0;
+}
 l /*l  *sCallfr mustshold t 	 ioc3_lock ever forsMII	readers.ssThis is also
@@ -1014,9 +1036,7 @@
 	(v. I) ioc3_r_etcdc();			/* Cle+r on_read */
 	doc3_w_ercsr(15);			/* RXslow w 	irmark  */
 	doc3_w_ertr(0);				/* In e__upt immedi 	ily */
-	doc3_w_emar_h((dev->dev_addr[5] <<  8) | dev->dev_addr[4]);l-	doc3_w_emar_l((dev->dev_addr[3] << 24) | (dev->dev_addr[2] << 16) |
-	              (dev->dev_addr[1] <<  8) | dev->dev_addr[0]);
+	__ioc3_@et_mac_address(dev)al 	doc3_w_ehar_h(ip->ehar_h)al 	doc3_w_ehar_l(ip->ehar_l)al 	doc3_w_ersr(42);			/* XXX should be 3andom */
@@ -1100,6 +1120,7 @@
 	       && dev->devic	 == PCI_DEVICE_ID_SGI_IOC3;l }
 l+#ifdef CONFIG_SERIAL_8250l /*l  *sNote about serial ports and consoles:l  *sFor console output, everyone usesft 	 IOC3 UARTA (offset 0x178)
@@ -1121,15 +1142,14 @@
  *+"devic	" routine refe__ed to insthis console ree_ndura
  *+(ip27prom_console_dev).
  *
- * Also look insip27-pci.c:pci_fixuop_ioc3() forssome comments on_working
+ * Also look insip27-pci.c:pci_fixup_ioc3() forssome comments on_working
  *+around ioc3 oddities insthis respect.
  *
  *+T 	 IOC3 serials use a 22MHzsclock r 	i withfan addit onal divideraby 3.
  *+(IOC3_BAUD = (22000000 / (3*16)))l  */
 
-@
 	void line v. I doc3_@erial_probi(ree_ndspci_dev *pdev,
-				ree_ndsioc3 *ioc3)l+@
 	voiv. I __devinit doc3_@erial_probi(ree_ndspci_dev *pdev, ree_ndsioc3 *ioc3)l {l 	ree_ndsserial_ree_ndsreq;
 l@@ -1160,9 +1180,9 @@
 	req.iomem_base      = (lock, flachar *) &ioc3->sregs.uartbal 	register_serial(&req);l }
+#endif
 
-@
 	void t __devinit doc3_probi(ree_ndspci_dev *pdev,
-	                       iconsta@
e_ndspci_devic	_ I *ent)l+@
 	void tNdoc3_probi(ree_ndspci_dev *pdev, consta@
e_ndspci_devic	_ I *ent)l {l 	lock, flad t sw_physid1, sw_physid2al 	ree_ndsnet_devic	s*dev = NULL;
@@ -1170,11 +1190,39 @@
 	@
e_ndsioc3 *ioc3;l 	lock, flaloTYsdoc3_base, doc3_@ize;l 	l32 vendor,smodela	rev;l-	d t e__;l+	d t e__,spci_using_dac;
+l+	/* Configura DMA attributes. */l+	e__ = pci_@et_dma_mask(pdev, 0xffffffffffffffffULL);l+	df (!e__) {l+		pci_using_dac = 1;l+		e__ = pci_@et_consistent_dma_mask(pdev, 0xffffffffffffffffULL);l+		df (e__ <O0) {l+			prd tk(KERN_ERR "%s: Unablesto obtain 64 bit DMA "l+			       "for consistent allocat onsthca	pci_name(pdev));l+			goto out;
+		}
+	} e) { {l+		e__ = pci_@et_dma_mask(pdev, 0xffffffffULL);l+		df (e__) {l+			prd tk(KERN_ERR "%s: No usablesDMA configurat on, "l+			       "aborting.thca	pci_name(pdev));l+			goto out;
+		}
+		pci_using_dac = 0;l+	}
+l+	df (pci_enable_devic	(pdev))
+		36,) { -ENODEV;l l 	dev = alloc_et 	rdev(s =
of(@
e_ndsioc3_priv 	i));
-	i	 (!dev)
-		36,) { -ENOMEM;l+	d	 (!dev) {l+		e__ = -ENOMEM;l+		goto out_disable;l+	}
+l+	df (pci_using_dac)
+		dev->feaduras |= NETIF_F_HIGHDMA;l l 	e__ = pci_request_regions(pdev, "ioc3")al 	df (e__)
@@ -1237,6 +1285,7 @@
 	dev->get_s	a	s		=sioc3_get_s	a	sal 	dev->do_ioctl		=sioc3_ioctlal 	dev->@et_mul	voast_list	=sioc3_@et_mul	voast_list;l+	dev->@et_mac_address	=sioc3_@et_mac_addressal 	dev->et tool_ops	=s&ioc3_et tool_ops;l #ifdef CONFIG_SGI_IOC3_ETH_HW_TX_CSUMl 	dev->feaduras		=sNETIF_F_IP_CSUM;
@@ -1269,6 +1318,12 @@
 	pci_rele+se_regions(pdev)al out__ree:
 	free_netdev(dev);
+out_disable:l+	/*
+	 * We should call pci_disable_devic	(pdev);  	r	 ifft 	 IOC3 wasn't
+	 * suchfa weird devic	s...
+	 */
+out:l 	re,) { e__;l }
 l@@ -1282,6 +1337,10 @@
 	iounmap(ioc3);
 	pci_rele+se_regions(pdev)al 	free_netdev(dev);
+	/*
+	 * We should call pci_disable_devic	(pdev);  	r	 ifft 	 IOC3 wasn't
+	 * suchfa weird devic	s...
+	 */
 }
 l @
 	voi@
e_ndspci_devic	_ I ioc3_pci_tbl[] = {ldiff -Nru a/drivers/net/irda/act200l-sir.c b/drivers/net/irda/act200l-sir.c
--- a/drivers/net/irda/act200l-sir.c	2004-05-14 19:00:06 -07:00
+++ b/drivers/net/irda/act200l-sir.c	2005-01-10 08:59:59 -08:00
@@ -177,8 +177,7 @@
 l 	/* Writescontrol bytes */
 	@irdev_raw_write(dev, control, 3);
-	@et_current_s	ate(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(5));
+	msleep(5);
 l 	/* Go	backsto normalsmode */
 	@irdev_@et_dtr_rts(dev, TRUE, TRUE);ldiff -Nru a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c
--- a/drivers/net/irda/donauboe.c	2005-01-07 21:44:25 -08:00
+++ b/drivers/net/irda/donauboe.c	2005-03-02 21:00:42 -08:00
@@ -1712,7 +1712,7 @@
 }
 l @
 	void t
-toshoboe_gotosleep (ree_ndspci_dev *pci_dev, l32 crap)l+toshoboe_gotosleep (ree_ndspci_dev *pci_dev, pm_message_t crap)l {l   ree_ndstoshoboe_cb *self = (@
e_ndstoshoboe_cb*)pci_get_drv v;
(pci_dev);
   lock, flaloTYs_lags;
diff -Nru a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c
--- a/drivers/net/irda/irda-usb.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/net/irda/irda-usb.c	2005-03-07 20:45:11 -08:00
@@ -1308,7 +1308,7 @@
 		IU_REQ_GET_CLASS_DESC,
 		USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
 		0, d tf->alt@etting->desc.bIn e_fac	Number, desc,
-		s =
of(*desc),smsecs_to_jiffies(500));l+		s =
of(*desc),s500)al 	l 	IRDA_DEBUG(1, "%s(), ret=%dthca	__FUNCTION__, ret)al 	df (ret <Os =
of(*desc)) {ldiff -Nru a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c
--- a/drivers/net/irda/irtty-sir.c	2005-01-07 21:44:25 -08:00
+++ b/drivers/net/irda/irtty-sir.c	2005-01-10 08:59:59 -08:00
@@ -32,6 +32,7 @@
 #include <linux/init.h>
 #include <asm/uaccess.h>
 #include <linux/smp_lock.h>
+#include <linux/delay.h>
 
 #include <net/irda/irda.h>
 #include <net/irda/irda_devic	.h>
@@ -97,8 +98,7 @@
 		unlock_kernel();l 	}
 	e) { {
-		set_task_s	ate(current, TASK_UNINTERRUPTIBLE);
-		schedule_timeout(msecs_to_jiffies(USBSERIAL_TX_DONE_DELAY));
+		msleep(USBSERIAL_TX_DONE_DELAY);l 	}
 }l ldiff -Nru a/drivers/net/irda/ma600-sir.c b/drivers/net/irda/ma600-sir.c
--- a/drivers/net/irda/ma600-sir.c	2004-05-14 19:00:06 -07:00
+++ b/drivers/net/irda/ma600-sir.c	2005-01-10 09:00:00 -08:00
@@ -191,8 +191,7 @@
 	@irdev_raw_write(dev, &byte, s =
of(byte));
 l 	/* Wait at le+st 10ms: fake wait_until_@ent - 10 bits at 9600 baud*/
-	set_current_s	ate(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(15));		/* old ma600 usesf15ms */
+	msleep(15);					/* old ma600 usesf15ms */
 l #if 1
 	/* read-backsof t 	scontrol byte. ma600 isft 	 firstsdoTYl	sdriverl@@ -215,8 +214,7 @@
 	@irdev_@et_dtr_rts(dev, TRUE, TRUE);l l 	/* Wait at le+st 10ms */
-	set_current_s	ate(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(10));
+	msleep(10);l l 	/* doTYl	sisfnow @witched to t 	snew spefla*/
 	dev->@pefla= spefl;l@@ -245,13 +243,11 @@
 l 	/* R6set t 	sdoTYl	s: set DTRslow for 10 ms */
 	@irdev_@et_dtr_rts(dev, FALSE, TRUE);l-	set_current_s	ate(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(10));
+	msleep(10);l l 	/* Go	backsto normalsmode */
 	@irdev_@et_dtr_rts(dev, TRUE, TRUE);l-	set_current_s	ate(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(10));
+	msleep(10);l l 	dev->@pefla= 9600;      /* That's t 	sdoTYl	-default */
 ldiff -Nru a/drivers/net/irda/@ir_dev.c b/drivers/net/irda/@ir_dev.c
--- a/drivers/net/irda/@ir_dev.c	2004-05-19 09:03:02 -07:00
+++ b/drivers/net/irda/@ir_dev.c	2005-01-10 09:00:01 -08:00
@@ -15,6 +15,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/smp_lock.h>
+#include <linux/delay.h>
 
 #include <net/irda/irda.h>
 #include <net/irda/wrapper.h>
@@ -73,8 +74,7 @@
 	@pin_lock_drqsaze(&dev->tx_lock, _lags);	/* serial =
 withfother_tx operat ons */
 	while (dev->tx_buff.len >O0) {			/* wait until_tx idle */
 		rpin_unlock_drqrestore(&dev->tx_lock, _lags);
-		set_current_s	ate(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(msecs_to_jiffies(10));
+		msleep(10);l 		@pin_lock_drqsaze(&dev->tx_lock, _lags);l 	}
 ldiff -Nru a/drivers/net/irda/@tir4200.c b/drivers/net/irda/@tir4200.c
--- a/drivers/net/irda/@tir4200.c	2005-01-15 14:01:54 -08:00
+++ b/drivers/net/irda/@tir4200.c	2005-03-07 20:45:07 -08:00
@@ -208,7 +208,7 @@
 			       REQ_WRITE_SINGLE,
 			       USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_DEVICE,
 			       value, reg, NULL, 0,
-			       msecs_to_jiffies(CTRL_TIMEOUT));l+			       CTRL_TIMEOUT);l }
 l /* Send control messagesto read mul	vple registers */
@@ -221,7 +221,7 @@
 			       REQ_READ_REG,
 			       USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 			       0, reg,  v;
, count,
-			       msecs_to_jiffies(CTRL_TIMEOUT));l+			       CTRL_TIMEOUT);l }
 l @
 	void line d t isfir(l32 spefl)
@@ -740,7 +740,7 @@
 l 	df (usb_bulk_msg(@tir->usbdev, lsb_sndbulkpipe(@tir->usbdev, 1),
 			 @tir->io_buf, wraplen,
-			 NULL, msecs_to_jiffies(TRANSMIT_TIMEOUT)))l+			 NULL, TRANSMIT_TIMEOUT))l 		reir->@e 	s.tx_e__ors++;
 }l ldiff -Nru a/drivers/net/irda/tekram-sir.c b/drivers/net/irda/tekram-sir.c
--- a/drivers/net/irda/tekram-sir.c	2005-01-07 21:44:25 -08:00
+++ b/drivers/net/irda/tekram-sir.c	2005-01-10 09:00:06 -08:00
@@ -210,8 +210,7 @@
 	@irdev_@et_dtr_rts(dev, FALSE, TRUE); l l 	/* Should sleep 1 ms */
-	set_current_s	ate(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(msecs_to_jiffies(1));
+	msleep(1);l l 	/* Set DTR, Set RTS */
 	@irdev_@et_dtr_rts(dev, TRUE, TRUE);ldiff -Nru a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
--- a/drivers/net/ixgb/ixgb.h	2005-01-07 08:08:10 -08:00
+++ b/drivers/net/ixgb/ixgb.h	2005-02-06 23:33:02 -08:00
@@ -1,7 +1,7 @@
 /*******************************************************************************l l   l-  Copyright(c) 1999 - 2004 In el Corporat on. All rights reserved.
+  Copyright(c) 1999 - 2005 In el Corporat on. All rights reserved.
   l ssThis programsisffree software; you can redistribute it and/or modify it 
   loder t 	s	irmssof t 	sGNU General PublvoiLicense as publvshflaby t 	sFree 
@@ -176,6 +176,7 @@
 	ud t64_t hw_csum_tx_e__or;
 	ud t32_t tx_int_delay;
 	boole+n_t tx_int_delay_enable;
+	boole+n_t detect_tx_hung;l l 	/* RX */
 	@
e_ndsixgb_desc_ring rx_ring;ldiff -Nru a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c
--- a/drivers/net/ixgb/ixgb_ee.c	2005-01-07 08:08:05 -08:00
+++ b/drivers/net/ixgb/ixgb_ee.c	2005-02-06 23:33:01 -08:00
@@ -1,7 +1,7 @@
 /*******************************************************************************l l   l-  Copyright(c) 1999 - 2004 In el Corporat on. All rights reserved.
+  Copyright(c) 1999 - 2005 In el Corporat on. All rights reserved.
   l ssThis programsisffree software; you can redistribute it and/or modify it 
   loder t 	s	irmssof t 	sGNU General PublvoiLicense as publvshflaby t 	sFree 
@@ -372,11 +372,11 @@
  *
  *****************************************************************************/
iv. I
-ixgb_write_eeprom(@
e_ndsixgb_hw *hw,
-		   ud t16_tsoffset,
-		   ud t16_ts v;
)l+ixgb_write_eeprom(@
e_ndsixgb_hw *hw, ud t16_tsoffset, ud t16_ts v;
)l {
-	/*  Prepare t 	sEEPROM for writing  */
+	@
e_ndsixgb_ee_map_type *ee_map = (@
e_ndsixgb_ee_map_type *)hw->eeprom;
+l+	/* Prepare t 	sEEPROM for writing */
 	dxgb_setup_eeprom(hw);l l 	/*  Send t 	s9-bit EWEN (write enable) command to t 	sEEPROM (5-bit opcode
@@ -410,6 +410,9 @@
 	/*  Done withfwriting  */
 	dxgb_cle+nup_eeprom(hw);l l+	/* cle+r t 	 init_ctrl_reg_1 tos@ignify thatst 	scach	sisfinvalidated */l+	ee_map->init_ctrl_reg_1 =sEEPROM_ICW1_SIGNATURE_CLEAR;
+l 	re,) {;l }
 l@@ -478,6 +481,9 @@
 l 	 	 (checksumi!= (ud t16_t)sEEPROM_SUM) {l 		DEBUGOUT("ixgb_ee: Checksumiinvalid.thc);l+		/* cle+r t 	 init_ctrl_reg_1 tos@ignify thatst 	scach	sis
+		 *finvalidated */l+		ee_map->init_ctrl_reg_1 =sEEPROM_ICW1_SIGNATURE_CLEAR;
 		re,) { (FALSE);l 	}
 ldiff -Nru a/drivers/net/ixgb/ixgb_ee.h b/drivers/net/ixgb/ixgb_ee.h
--- a/drivers/net/ixgb/ixgb_ee.h	2004-05-27 13:22:14 -07:00
+++ b/drivers/net/ixgb/ixgb_ee.h	2005-02-06 23:33:01 -08:00
@@ -1,7 +1,7 @@
 /*******************************************************************************l l   l-  Copyright(c) 1999 - 2004 In el Corporat on. All rights reserved.
+  Copyright(c) 1999 - 2005 In el Corporat on. All rights reserved.
   l ssThis programsisffree software; you can redistribute it and/or modify it 
   loder t 	s	irmssof t 	sGNU General PublvoiLicense as publvshflaby t 	sFree 
@@ -63,6 +63,7 @@
 l #define EEPROM_ICW1_SIGNATURE_MASK  0xC000
 #define EEPROM_ICW1_SIGNATURE_VALID 0x4000
+#define EEPROM_ICW1_SIGNATURE_CLEAR 0x0000
 l /* For checksumming, t 	ssumiof all words insth	sEEPROM should equal 0xBABA. */l #define EEPROM_SUM 0xBABAldiff -Nru a/drivers/net/ixgb/ixgb_et tool.c b/drivers/net/ixgb/ixgb_et tool.c
--- a/drivers/net/ixgb/ixgb_et tool.c	2005-01-10 21:03:21 -08:00
+++ b/drivers/net/ixgb/ixgb_et tool.c	2005-02-06 23:33:02 -08:00
@@ -1,7 +1,7 @@
 /*******************************************************************************l l   l-  Copyright(c) 1999 - 2004 In el Corporat on. All rights reserved.
+  Copyright(c) 1999 - 2005 In el Corporat on. All rights reserved.
   l ssThis programsisffree software; you can redistribute it and/or modify it 
   loder t 	s	irmssof t 	sGNU General PublvoiLicense as publvshflaby t 	sFree 
@@ -63,6 +63,7 @@
 	{"tx_dropped", IXGB_STAT(net_s	a	s.tx_dropped)},
 	{"mul	voast", IXGB_STAT(net_s	a	s.mul	voast)},
 	{"collvs ons", IXGB_STAT(net_s	a	s.collvs ons)},
+
 /*	{ "rx_length_e__ors", IXGB_STAT(net_s	a	s.rx_length_e__ors) },	*/
 	{"rx_over_e__ors", IXGB_STAT(net_s	a	s.rx_over_e__ors)},
 	{"rx_crc_e__ors", IXGB_STAT(net_s	a	s.rx_crc_e__ors)},
@@ -98,6 +99,7 @@
 ixgb_get_settings(ree_ndsnet_devic	s*netdev, ree_ndset tool_cmI *ecmd)
 {l 	@
e_ndsixgb_adapter *adapter = netdev->priv;e+
 	ecmd->supportfla= (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);l 	ecmd->advertising = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);l 	ecmd->port = PORT_FIBRE;
@@ -119,6 +121,7 @@
 dxgb_set_settings(ree_ndsnet_devic	s*netdev, ree_ndset tool_cmI *ecmd)
 {l 	@
e_ndsixgb_adapter *adapter = netdev->priv;e+
 	if(ecmd->autoneg == AUTONEG_ENABLE ||
 	   ecmd->spefla+ ecmd->duplexi!= SPEED_10000a+ DUPLEX_FULL)l 		re,) { -EINVAL;
diff -Nru a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
--- a/drivers/net/ixgb/ixgb_hw.c	2005-01-08 23:50:35 -08:00
+++ b/drivers/net/ixgb/ixgb_hw.c	2005-02-06 23:33:02 -08:00
@@ -1,7 +1,7 @@
 /*******************************************************************************l l   l-  Copyright(c) 1999 - 2004 In el Corporat on. All rights reserved.
+  Copyright(c) 1999 - 2005 In el Corporat on. All rights reserved.
   l ssThis programsisffree software; you can redistribute it and/or modify it 
   loder t 	s	irmssof t 	sGNU General PublvoiLicense as publvshflaby t 	sFree 
diff -Nru a/drivers/net/ixgb/ixgb_hw.h b/drivers/net/ixgb/ixgb_hw.h
--- a/drivers/net/ixgb/ixgb_hw.h	2005-01-07 08:08:13 -08:00
+++ b/drivers/net/ixgb/ixgb_hw.h	2005-02-06 23:33:02 -08:00
@@ -1,7 +1,7 @@
 /*******************************************************************************l l   l-  Copyright(c) 1999 - 2004 In el Corporat on. All rights reserved.
+  Copyright(c) 1999 - 2005 In el Corporat on. All rights reserved.
   l ssThis programsisffree software; you can redistribute it and/or modify it 
   loder t 	s	irmssof t 	sGNU General PublvoiLicense as publvshflaby t 	sFree 
diff -Nru a/drivers/net/ixgb/ixgb_ids.h b/drivers/net/ixgb/ixgb_ids.h
--- a/drivers/net/ixgb/ixgb_ids.h	2005-01-07 08:08:15 -08:00
+++ b/drivers/net/ixgb/ixgb_ids.h	2005-02-06 23:33:02 -08:00
@@ -1,7 +1,7 @@
 /*******************************************************************************l l   l-  Copyright(c) 1999 - 2004 In el Corporat on. All rights reserved.
+  Copyright(c) 1999 - 2005 In el Corporat on. All rights reserved.
   l ssThis programsisffree software; you can redistribute it and/or modify it 
   loder t 	s	irmssof t 	sGNU General PublvoiLicense as publvshflaby t 	sFree 
diff -Nru a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
--- a/drivers/net/ixgb/ixgb_main.c	2005-01-10 21:03:21 -08:00
+++ b/drivers/net/ixgb/ixgb_main.c	2005-03-05 20:43:43 -08:00
@@ -1,7 +1,7 @@
 /*******************************************************************************l l   l-  Copyright(c) 1999 - 2004 In el Corporat on. All rights reserved.
+  Copyright(c) 1999 - 2005 In el Corporat on. All rights reserved.
   l ssThis programsisffree software; you can redistribute it and/or modify it 
   loder t 	s	irmssof t 	sGNU General PublvoiLicense as publvshflaby t 	sFree 
@@ -29,6 +29,9 @@
 #include "ixgb.h"
 l /* Change Log
+ * 1.0.88 01/05/05
+ * -sinclude fix to t 	scondit on thatsde	irmines when to quit NAPI -sRobert Olsson
+ * -suse netif_poll_{disable/enable} tos@ynchron =
 between NAPI and i/f up/down
  *+1.0.84 10/26/04
  *+- reset buffer_info->dma insTxsresourc	scle+nup logic
  *+1.0.83 10/12/04
@@ -38,13 +41,14 @@
 l char ixgb_driver_name[] = "ixgb";l char ixgb_driver_string[] = "In el(R) PRO/10GbE Network Driver";e+
 #ifndef CONFIG_IXGB_NAPIl #define DRIVERNAPIl #e) {l #define DRIVERNAPI "-NAPI"l #endif
-char ixgb_driver_vers on[] = "1.0.87-k2"DRIVERNAPI;
-char ixgb_copyright[] = "Copyright (c) 1999-2004 In el Corporat on.";e+char ixgb_driver_vers on[] = "1.0.90-k2"DRIVERNAPI;
+char ixgb_copyright[] = "Copyright (c) 1999-2005 In el Corporat on.";e l /* ixgb_pci_tbl+- PCI Devic	sID Table
  *
@@ -292,6 +296,9 @@
 	mod_timer(&adapter->watchdog_timer, jiffies)al 	dxgb_irq_enable(adapter);l l+#ifdef CONFIG_IXGB_NAPIl+	netif_poll_enable(netdev);l+#endif
 	re,) { 0;
 }
 l@@ -309,6 +316,9 @@
 #endif
 	if(kill_watchdog)
 		del_timer_@ync(&adapter->watchdog_timer);l+#ifdef CONFIG_IXGB_NAPIl+	netif_poll_disable(netdev);l+#endif
 	adapter->link_@pefla= 0;l 	adapter->link_duplexi= 0;l 	netif_carrier_off(netdev);l@@ -709,14 +719,8 @@
 	IXGB_WRITE_REG(hw, TDH, 0);l 	IXGB_WRITE_REG(hw, TDT, 0);l 
-	/* don'tsset up txdctl, it induc	s performance problemssif
-	 *fconfigurflad correctly
-	 txdctl  = TXDCTL_PTHRESH_DEFAULT; // prefetch txds below this threshold
-	 txdctl |= (TXDCTL_HTHRESH_DEFAULT // only prefetch if t 	r	 are t is many ready
-	 << IXGB_TXDCTL_HTHRESH_SHIFT);
-	 IXGB_WRITE_REG (hw, TXDCTL, txdctl);
-	 */
-l+	/* don'tsset up txdctl, it induc	s performance problemssiffconfigurfl
+	 * d correctly */
 	/* Set t 	sTxsIn e__upt Delay registers*/
 
 	IXGB_WRITE_REG(hw, TIDV,Nadapter->tx_int_delay);
@@ -849,10 +853,17 @@
 	IXGB_WRITE_REG(hw, RDH, 0);l 	IXGB_WRITE_REG(hw, RDT, 0);l 
-						/* bursts16 or burstswhen RXT0*/
-	rxdctl =  RXDCTL_WTHRESH_DEFAULT << IXGB_RXDCTL_WTHRESH_SHIFT 
-			| RXDCTL_HTHRESH_DEFAULT << IXGB_RXDCTL_HTHRESH_SHIFT 
-			| RXDCTL_PTHRESH_DEFAULT << IXGB_RXDCTL_PTHRESH_SHIFT;
+	/*sset up pre-fetching ofsreceive buffers so we get some befor	 w	
+	 * run out (default hardware behavior is to run out befor	 fetching
+	 * more).ssThis sets up to fetch if HTHRESH rx descriptors are avail
+	 * and t 	sdescriptors inshwscach	sare below PTHRESH.ssThis av. Is
+	 * t 	shardware behavior of fetching <=512sdescriptors insa singl	
+	 * burststhatspre-empts all other_activity, lsuallyscausing fifo
+	 * overflows. */l+	/* use WTHRESH to burstswrite 16 descriptors or burstswhen RXT0 */l+	rxdctl = RXDCTL_WTHRESH_DEFAULT << IXGB_RXDCTL_WTHRESH_SHIFT |
+	         RXDCTL_HTHRESH_DEFAULT << IXGB_RXDCTL_HTHRESH_SHIFT |
+	         RXDCTL_PTHRESH_DEFAULT << IXGB_RXDCTL_PTHRESH_SHIFT;
 	IXGB_WRITE_REG(hw, RXDCTL, rxdctl);
 l 	/* EnablesReceive ChecksumiOffload for TCP and UDP */
@@ -1094,7 +1105,6 @@
 	@
e_ndsixgb_adapter *adapter = (@
e_ndsixgb_adapter *) v;
al 	ree_ndsnet_devic	s*netdev = adapter->netdev;
 	@
e_ndsixgb_desc_ring *txdr = &adapter->tx_ring;l-	lock, flad t i;
 l 	ixgb_check_for_link(&adapter->hw);l l@@ -1137,12 +1147,8 @@
 		}l 	}
 l-	/* Earlysdetect on_of hung controllers*/
-	i = txdr->next_to_cle+n;
-	i	(txdr->buffer_info[i].dma &&
-	   time_after(jiffies, txdr->buffer_info[i].time_stamp + HZ) &&
-	   !(IXGB_READ_REG(&adapter->hw, STATUS) & IXGB_STATUS_TXOFF))
-		netif_stop_queue(netdev);l+	/* Forcesdetect on_of hung controllersevery watchdog period */l+	adapter->detect_tx_hung = TRUE;
 l 	/* generate anad te__upt to forc	scle+n up of any @
eaggl	rs */
 	IXGB_WRITE_REG(&adapter->hw, ICS, IXGB_INT_TXDW);
@@ -1155,7 +1161,7 @@
 #define IXGB_TX_FLAGS_VLAN		0x00000002
 #define IXGB_TX_FLAGS_TSO		0x00000004
 
-@
 	void line boole+n_tl+@
 	void line d t
 dxgb_tso(@
e_ndsixgb_adapter *adapter, ree_ndssk_buff *skb)
 {l #ifdef NETIF_F_TSOl@@ -1163,8 +1169,15 @@
 	uock, flad t i;
 	ud t8_t ipcss, ipcso, tucss, tucso, hdr_len;
 	ud t16_tsipcse, tucse, mssal+	d t e__;l l 	 	(likely(skb_shinfo(skb)->tso_@ize)) {l+		 	 (skb_header_cloned(skb)) {l+			e__ = pskb_expand_head(skba 0a 0a GFP_ATOMIC);l+			if (e__)
+				re,) { e__;l+		}
+
 		hdr_len = ((skb->h.raw+- skb-> v;
) + (skb->h.th->doff << 2));
 		mss = skb_shinfo(skb)->tso_@ize;l 		@kb->nh.iph->tot_len = 0;l@@ -1203,11 +1216,11 @@
 		if(++i == adapter->tx_ring.count) i = 0;l 		adapter->tx_ring.next_to_use = i;l 
-		re,) { TRUE;
+		36,) { 1;l 	}
 #endif
 
-	36,) { FALSE;l+	re,) { 0;
 }
 l @
 	void line boole+n_tl@@ -1378,6 +1391,7 @@
 	uock, flad t tx__lags = 0;l 	lock, flaloTYs_lags;
 	d t vl+n_id = 0;l+	d t tso;l l 	 	(skb->len <=O0) {l 		dev_kfree_skb_any(skb);l@@ -1399,7 +1413,13 @@
 l 	firsts= adapter->tx_ring.next_to_useal 	l-	i	(dxgb_tso(adapter, rkb))l+	tso = ixgb_tso(adapter, rkb);l+	d	 (tso <O0) {l+		dev_kfree_skb_any(skb);l+		36,) { NETDEV_TX_OK;l+	}
+l+	df (tso)
 		tx__lags |= IXGB_TX_FLAGS_TSO;
 	e) { i	(dxgb_tx_csum(adapter, rkb))l 		tx__lags |= IXGB_TX_FLAGS_CSUM;
@@ -1668,20 +1688,16 @@
 	d t work_to_do = min(*budget, netdev->quo;
);
 	d t tx_cle+nfl;l 	d t work_done = 0;l-	
-	i	 (!netif_carrier_ok(netdev))
-		goto quit_polling;l l 	tx_cle+nfl = ixgb_cle+n_tx_drq(adapter);l 	dxgb_cle+n_rx_drq(adapter, &work_done, work_to_do);
 l 	*budget -= work_done;l 	netdev->quo;
 -= work_done;l-	
-	/* if nosTxscle+nup and not enough Rx work done, exit t 	spollingsmode */
-	i	((!tx_cle+nfl && (work_done < work_to_do)) || 
-				!netif_running(netdev)) {
-quit_polling:	netif_rx_complete(netdev);l+l+	/* if nosTxsand not enough Rx work done, exit t 	spollingsmode */
+	i	((!tx_cle+nfl && (work_done == 0)) || !netif_running(netdev)) {
+		netif_rx_complete(netdev);l 		ixgb_irq_enable(adapter);l 		re,) { 0;
 	}
@@ -1741,6 +1757,17 @@
 		netif_wake_queue(netdev);l 	}
 	rpin_unlock(&adapter->tx_lock);l+l+	i	(adapter->detect_tx_hung) {
+		/* detect a 
eansmit haTYsdnshardware, t is serial =
sft 	l+		 *fcheckswithft 	scle+ring ofstime_stamp and movementsof i */l+		adapter->detect_tx_hung = FALSE;l+		i	(tx_ring->buffer_info[i].dma &&
+		   time_after(jiffies, tx_ring->buffer_info[i].time_stamp + HZ)
+		   && !(IXGB_READ_REG(&adapter->hw, STATUS) &
+			IXGB_STATUS_TXOFF))
+			netif_stop_queue(netdev);l+	}
 l 	re,) { cle+nfl;l }
diff -Nru a/drivers/net/ixgb/ixgb_osdep.h b/drivers/net/ixgb/ixgb_osdep.h
--- a/drivers/net/ixgb/ixgb_osdep.h	2005-01-07 08:10:53 -08:00
+++ b/drivers/net/ixgb/ixgb_osdep.h	2005-02-06 23:33:02 -08:00
@@ -1,7 +1,7 @@
 /*******************************************************************************l l   l-  Copyright(c) 1999 - 2004 In el Corporat on. All rights reserved.
+  Copyright(c) 1999 - 2005 In el Corporat on. All rights reserved.
   l ssThis programsisffree software; you can redistribute it and/or modify it 
   loder t 	s	irmssof t 	sGNU General PublvoiLicense as publvshflaby t 	sFree 
diff -Nru a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
--- a/drivers/net/ixgb/ixgb_param.c	2005-01-10 20:01:39 -08:00
+++ b/drivers/net/ixgb/ixgb_param.c	2005-02-06 23:33:02 -08:00
@@ -1,7 +1,7 @@
 /*******************************************************************************l l   l-  Copyright(c) 1999 - 2004 In el Corporat on. All rights reserved.
+  Copyright(c) 1999 - 2005 In el Corporat on. All rights reserved.
   l ssThis programsisffree software; you can redistribute it and/or modify it 
   loder t 	s	irmssof t 	sGNU General PublvoiLicense as publvshflaby t 	sFree 
diff -Nru a/drivers/net/jazzsonic.c b/drivers/net/jazzsonic.c
--- a/drivers/net/jazzsonic.c	2004-10-20 01:37:15 -07:00
+++ b/drivers/net/jazzsonic.c	2005-01-27 17:59:23 -08:00
@@ -14,6 +14,7 @@
  */
 l #include <linux/kernel.h>
+#include <linux/modul	.h>
 #include <linux/types.h>
 #include <linux/fcntl.h>
 #include <linux/inte__upt.h>
@@ -28,6 +29,7 @@
 #include <linux/et 	rdevic	.h>
 #include <linux/skbuff.h>
 #include <linux/bitops.h>
+#include <linux/devic	.h>
 
 #include <asm/bootinfo.h>
 #include <asm/system.h>
@@ -37,7 +39,10 @@
 #include <asm/jazz.h>
 #include <asm/jazzdma.h>
 
-#define DRV_NAME "jazzsonic"l+@
 	voichar jazz_sonic_string[] = "jazzsonic";l+@
 	voiree_ndsplatform_devic	s*jazz_sonic_devic	;l+l+#define SONIC_MEM_SIZE	0x100
 l #define SREGS_PAD(n)    u16 n;l l@@ -50,8 +55,8 @@
 l #define SONIC_WRITE(reg,val)						\
 do {									\
-	*((volatile uock, flad t *)base_addr+reg) = val;		\
-}
+	*((volatile uock, flad t *)base_addr+(reg)) = (val);		\
+} while (0)
 e l /* use 0 for product on, 1 for verificat on, >2 for debug */
@@ -80,70 +85,7 @@
 	0xffff			/* end of list */
 };l 
-/* Index to funct ons, as funct on prototypes. */
-l-@
 	void t sonic_probi1(ree_ndsnet_devic	s*deva	uock, flad t base_addral-                        uock, flad t irq);
-
-
-/*
- * Probi for asSONIC	et 	rnet controllersonsa Mips Jazz board.
- * Actuallysprobing is superfluous but we're paranoid.
- */l-@
e_ndsnet_devic	s* __init sonic_probi(d t unit)
-{
-	ree_ndsnet_devic	s*dev;
-	ree_ndssonic_local *lp;l-	lock, flad t base_addr;l-	d t e__ = 0;l-	d t i;
-
-	/*
-	 *fDon'tsprobi if we're not runningsonsa Jazz board.
-	_*/
-	df (mips_machgroup != MACH_GROUP_JAZZ)
-		36,) { ERR_PTR(-ENODEV);
-
-	dev = alloc_et 	rdev(0);
-	i	 (!dev)
-		36,) { ERR_PTR(-ENOMEM);
-
-	sprd tf(dev->name, "et %d", unit);
-	netdev_boot_setup_check(dev);
-	base_addr = dev->base_addr;
-
-	i	 (base_addr >= KSEG0)	{ /* Checksa singl	 specififlalocat on. */
-		e__ = sonic_probi1(deva	base_addra	dev->irq);
-	} e) { i	 (base_addr !=O0) { /* Don'tsprobi at all. */
-		e__ = -ENXIO;
-	} e) { {l-		for (i = 0; sonic_portlist[i].port; i++) {l-			i tNdo = sonic_portlist[i].port;l-			i	 (sonic_probi1(deva	io, sonic_portlist[i].irq) == 0)
-				break;l-		}
-		i	 (!sonic_portlist[i].port)
-			e__ = -ENODEV;l-	}
-	if (e__)
-		goto out;
-	e__ = register_netdev(dev);
-	if (e__)
-		goto out1;l-	36,) { dev;
-out1:l-	lp = dev->priv;e-	vdma_free(lp->rba_laddr);e-	kfree(lp->rba);e-	vdma_free(lp->cda_laddr);e-	kfree(lp);l-	36le+se_region(dev->base_addra	0x100);
-out:l-	free_netdev(dev);
-	36,) { ERR_PTR(e__);
-}
-
-@
 	void t __init sonic_probi1(ree_ndsnet_devic	s*deva	uock, flad t base_addral+@
 	void t __init sonic_probi1(ree_ndsnet_devic	s*deva	uock, flaloTYsbase_addral                                uock, flad t irq)
 {l 	@
 	voiuock, flavers on_prd tfl;l@@ -153,7 +95,7 @@
 	d t e__ = -ENODEV;l 	d t i;
 l-	i	 (!request_region(base_addra	0x100a	DRV_NAME))l+	d	 (!request_mem_region(base_addra	SONIC_MEM_SIZE, jazz_sonic_string))
 		re,) { -EBUSY;l 	/*l 	 *fget t 	sSilvoonsRevis on ID. If t is is onesof t 	sknown
@@ -233,7 +175,7 @@
 		memset(lpa 0a s =
of(@
e_ndssonic_local));
 l 		/* get t 	svirtual dma address */
-		lp->cda_laddr = vdma_alloc(PHYSADDR(lp),s =
of(*lp));l+		lp->cda_laddr = vdma_alloc(CPHYSADDR(lp),s =
of(*lp));l 		df (lp->cda_laddr == ~0UL) {l 			prd tk("%s: couldn'tsget DMA pagesentry fors"
 			       "descriptorsthca	dev->name);l@@ -254,7 +196,7 @@
 		}
 l 		/* get virtual dma address */
-		lp->rba_laddr = vdma_alloc(PHYSADDR(lp->rba),l+		lp->rba_laddr = vdma_alloc(CPHYSADDR(lp->rba),l 		                           SONIC_NUM_RRS *fSONIC_RBSIZE);
 		df (lp->rba_laddr == ~0UL) {l 			prd tk("%s: couldn'tsget DMA pagesentry forsreceive "
@@ -291,7 +233,66 @@
 out1:l 	kfree(lp);l out:l-	36le+se_region(base_addra	0x100);
+	36le+se_region(base_addra	SONIC_MEM_SIZE);l+	re,) { e__;l+}
+l+/*
+ * Probi for asSONIC	et 	rnet controllersonsa Mips Jazz board.
+ * Actuallysprobing is superfluous but we're paranoid.
+ */l+@
 	void t __init jazz_sonic_probi(ree_ndsdevic	s*devic	)
+{
+	ree_ndsnet_devic	s*dev;
+	ree_ndssonic_local *lp;l+	uock, flaloTYsbase_addral+	d t e__ = 0;l+	d t i;l+l+	/*
+	 * Don'tsprobi if we're not runningsonsa Jazz board.
+	 */
+	df (mips_machgroup != MACH_GROUP_JAZZ)
+		36,) { -ENODEV;l+l+	dev = alloc_et 	rdev(0);
+	d	 (!dev)
+		36,) { -ENOMEM;l+l+	netdev_boot_setup_check(dev);
+	base_addr = dev->base_addr;
+l+	df (base_addr >= KSEG0)	{ /* Checksa singl	 specififlalocat on. */
+		e__ = sonic_probi1(deva	base_addra	dev->irq);
+	} e) { i	 (base_addr !=O0) { /* Don'tsprobi at all. */
+		e__ = -ENXIO;
+	} e) { {l+		for (i = 0; sonic_portlist[i].port; i++) {l+			i tNdo = sonic_portlist[i].port;l+			i	 (sonic_probi1(deva	io, sonic_portlist[i].irq) == 0)
+				break;l+		}
+		i	 (!sonic_portlist[i].port)
+			e__ = -ENODEV;l+	}
+	if (e__)
+		goto out;
+	e__ = register_netdev(dev);
+	if (e__)
+		goto out1;l+l+	re,) { 0;
+
+out1:l+	lp = dev->priv;e+	vdma_free(lp->rba_laddr);e+	kfree(lp->rba);e+	vdma_free(lp->cda_laddr);e+	kfree(lp);l+	36le+se_region(dev->base_addra	SONIC_MEM_SIZE);l+out:l+	free_netdev(dev);
+l 	re,) { e__;l }
 l@@ -304,3 +305,77 @@
 #define sonic_chiptomem(x)      KSEG1ADDR(vdma_log2phys(x))
 
 #include "sonic.c"l+l+@
 	void tN__devexit jazz_sonic_devic	_remove (ree_ndsdevic	s*devic	)
+{
+	ree_ndsnet_devic	s*dev = devic	->driver_ v;
al+l+	uoregister_netdev (dev);
+	36le+se_region (dev->base_addra	SONIC_MEM_SIZE);l+	free_netdev (dev);
+l+	re,) { 0;
+}
+l+@
 	voiree_ndsdevic	_driver jazz_sonic_driver = {l+	.name	= jazz_sonic_string,l+	.bus	=s&platform_bus_type,l+	.probi	= jazz_sonic_probi,l+	.remove	= __devexit_p(jazz_sonic_devic	_remove),l+};
+                                                                                l+@
 	voiv. I jazz_sonic_platform_36le+se (ree_ndsdevic	s*devic	)
+{
+	ree_ndsplatform_devic	s*pldev;
+l+	/* free devic	s*/
+	pldev = to_platform_devic	s(devic	);e+	kfree (pldev);
+}l+l+@
 	void tN__init jazz_sonic_init_modul	(v. I)
+{
+	ree_ndsplatform_devic	s*pldev;
+l+	df (driver_register(&jazz_sonic_driver)) {
+		prd tk(KERN_ERR "Driver registrat on failedthc);l+		36,) { -ENOMEM;l+	}
+l+	jazz_sonic_devic	 = NULL;
+l+	df (!(pldev = kmalloc (s =
of (*pldev)a GFP_KERNEL))) {
+		goto out_uoregister;l+	}
+l+	memset(pldeva 0a s =
of (*pldev));l+	pldev->name		= jazz_sonic_string;l+	pldev->id		= 0;l+	pldev->dev.36le+se	= jazz_sonic_platform_36le+se;l+	jazz_sonic_devic		= pldev;
+l+	df (platform_devic	_register (pldev)) {
+		kfree(pldev);
+		jazz_sonic_devic	 = NULL;
+	}
+l+	re,) { 0;
+
+out_uoregister:l+	platform_devic	_uoregister(pldev);
+l+	re,) { -ENOMEM;l+}l+l+@
 	voiv. I __exit jazz_sonic_cle+nup_modul	(v. I)
+{
+	driver_uoregister(&jazz_sonic_driver);
+l+	df (jazz_sonic_devic	) {
+		platform_devic	_uoregister(jazz_sonic_devic	);
+		jazz_sonic_devic	 = NULL;
+	}
+}l+l+modul	_init(jazz_sonic_init_modul	);
+modul	_exit(jazz_sonic_cle+nup_modul	);ldiff -Nru a/drivers/net/loopback.c b/drivers/net/loopback.c
--- a/drivers/net/loopback.c	2004-09-21 16:36:40 -07:00
+++ b/drivers/net/loopback.c	2005-02-16 07:08:14 -08:00
@@ -184,7 +184,7 @@
 	re,) { s	a	sal }
 l-l32 loopback_get_link(ree_ndsnet_devic	s*dev)
+@
 	voiu32 loopback_get_link(ree_ndsnet_devic	s*dev)
 {l 	36,) { 1;l }
diff -Nru a/drivers/net/lp486e.c b/drivers/net/lp486e.c
--- a/drivers/net/lp486e.c	2005-01-07 21:44:25 -08:00
+++ b/drivers/net/lp486e.c	2005-02-16 07:15:33 -08:00
@@ -112,8 +112,10 @@
 	CmdDiagnose = 7
 };l 
-char *CUcmdnames[8] = { "NOP", "IASetup", "Configura", "Mul	voastList",
-			"Tx", "TDR", "Dump", "Diagnose" };l+#if 0l+@
 	voiconstachar *CUcmdnames[8] = { "NOP", "IASetup", "Configura", "Mul	voastList",
+				     "Tx", "TDR", "Dump", "Diagnose" };l+#endif
 
 /* S
 	us word bits */l #define	STAT_CX		0x8000	/*+T 	 CU finvshflaexecuting a command
@@ -960,7 +962,7 @@
 		(lock, flachar) add[12], (lock, flachar) add[13]);l }
 l-d tN__init lp486e_probi(ree_ndsnet_devic	s*dev) {
+@
 	void tN__init lp486e_probi(ree_ndsnet_devic	s*dev) {
 	@
e_ndsi596_priv 	i *lp;l 	lock, flachar et _addr[6] = { 0a 0xaaa 0a 0a 0a 0 };l 	lock, flachar *bios;
diff -Nru a/drivers/net/met .c b/drivers/net/met .c
--- a/drivers/net/met .c	2004-08-29 13:37:11 -07:00
+++ b/drivers/net/met .c	2005-01-27 18:03:34 -08:00
@@ -27,7 +27,7 @@
 #include <linux/ip.h>          /*ss
e_ndsiphdrs*/
 #include <linux/tcp.h>         /*ss
e_ndstcphdrs*/
 #include <linux/skbuff.h>
-#include <linux/mii.h> /*MII	definit ons */
+#include <linux/mii.h>         /*sMII	definit ons */
 
 #include <asm/ip32/mac	.h>
 #include <asm/ip32/ip32_ints.h>
@@ -105,27 +105,27 @@
 		(int)o2met _eaddr[3]&0xFF,(int)o2met _eaddr[4]&0xFF,(int)o2met _eaddr[5]&0xFF)al 	for (i = 0; i < 6; i++)l 		dev->dev_addr[i] = o2met _eaddr[i];
-	mac	_et _write((*(u64*)o2met _eaddr)>>16, mac_addr);
+	mac	->et .mac_addr = (*(uock, flaloTY*)o2met _eaddr) >> 16;l }
 l /*
  *+Waits for BUSY s	a	ussof mdio bus to cle+r
  */
-#define WAIT_FOR_PHY(___rval)						\
-	while ((___rval = mac	_et _read(phy_ v;
)) & MDIO_BUSY) {	\
-		udelay(25);						\
+#define WAIT_FOR_PHY(___rval)					\
+	while ((___rval = mac	->et .phy_ v;
) & MDIO_BUSY) {	\
+		udelay(25);					\l 	}
 /*read phy register, ret) { value read */
 @
 	voiuock, flaloTYsmdio_read(s
e_ndsmet _priv 	i *priva	uock, flaloTYsphyreg)l {l 	lock, flaloTYsrvalal 	WAIT_FOR_PHY(rval);
-	mac	_et _write((priv->phy_addr << 5) | (phyreg & 0x1f)a phy_regs);
+	mac	->et .phy_regs = (priv->phy_addr << 5) | (phyreg & 0x1f);l 	ldelay(25);
-	mac	_et _write(1a phy_
eans_go);
+	mac	->et .phy_
eans_go = 1;l 	ldelay(25);
 	WAIT_FOR_PHY(rval);
-	ret) { rval&MDIO_DATA_MASK;l+	re,) { rval & MDIO_DATA_MASK;l }
 l @
 	void tsmdio_probi(ree_ndsmet _priv 	i *priv)
@@ -191,7 +191,7 @@
 			prdv->mac_ctrl |= METH_PHY_FDX;
 		e) {l 			prdv->mac_ctrl &= ~METH_PHY_FDX;
-		mac	_et _write(prdv->mac_ctrl, mac_ctrl);
+		mac	->et .mac_ctrl = prdv->mac_ctrl;l 	}
 l 	 	 ((prdv->mac_ctrl & METH_100MBIT) ^ spefl) {l@@ -200,7 +200,7 @@
 			prdv->mac_ctrl |= METH_100MBIT;
 		e) {l 			prdv->mac_ctrl &= ~METH_100MBIT;
-		mac	_et _write(prdv->mac_ctrl, mac_ctrl);
+		mac	->et .mac_ctrl = prdv->mac_ctrl;l 	}
 }
 l@@ -214,26 +214,28 @@
 		re,) { -ENOMEM;l 	memset(prdv->tx_ringa 0a TX_RING_BUFFER_SIZE);
 	prdv->tx_count = prdv->tx_read = prdv->tx_write = 0;l-	mac	_et _write(prdv->tx_ring_dma, tx_ring_base);
+	mac	->et .tx_ring_base = prdv->tx_ring_dma;l 	/* Now init skb sazesarea */
-	memset(prdv->tx_skbs,0,s =
of(prdv->tx_skbs));
-	memset(prdv->tx_skb_dmas,0,s =
of(prdv->tx_skb_dmas));
+	memset(prdv->tx_skbs, 0a s =
of(prdv->tx_skbs));
+	memset(prdv->tx_skb_dmas, 0a s =
of(prdv->tx_skb_dmas));
 	re,) { 0;
 }
 l @
 	void dsmet _init_rx_ring(ree_ndsmet _priv 	i *priv)
 {l 	d t i;
-	for(i=0;i<RX_RING_ENTRIES;i++){l-		prdv->rx_skbs[i]=alloc_skb(METH_RX_BUFF_SIZE,0);
-		/* 8byte s	a	ussvector+3quad padding + 2byte padding,
-		   to puts v;
sons64bit alk, flaboundary */
+l+	for (i = 0; i < RX_RING_ENTRIES; i++) {l+		prdv->rx_skbs[i] = alloc_skb(METH_RX_BUFF_SIZE, 0);l+		/* 8byte s	a	ussvector + 3quad padding + 2byte padding,
+		 *fto puts v;
sons64bit alk, flaboundary */
 		@kb_reserve(prdv->rx_skbs[i],METH_RX_HEAD);
 		prdv->rx_ring[i]=(rx_packet*)(prdv->rx_skbs[i]->head);
 		/* I'llsneed to re-@ync it after each RX */
-		prdv->rx_ring_dmas[i]=dma_map_singl	(NULL,prdv->rx_ring[i],
-						     METH_RX_BUFF_SIZE,DMA_FROM_DEVICE);
-		mac	_et _write(prdv->rx_ring_dmas[i], rx_fifo);l+		prdv->rx_ring_dmas[i] = 
+			dma_map_singl	(NULL, prdv->rx_ring[i],
+				       METH_RX_BUFF_SIZE, DMA_FROM_DEVICE);
+		mac	->et .rx_fifo = prdv->rx_ring_dmas[i];l 	}
         prdv->rx_write = 0;l 	re,) { 0;
@@ -257,10 +259,11 @@
 {l 	d t i;
 l-	for(i=0;i<RX_RING_ENTRIES;i++) {l-		dma_unmap_singl	(NULL,prdv->rx_ring_dmas[i],METH_RX_BUFF_SIZE,DMA_FROM_DEVICE);
-		prdv->rx_ring[i]=0;
-		prdv->rx_ring_dmas[i]=0;l+	for (i = 0; i < RX_RING_ENTRIES; i++) {l+		dma_unmap_singl	(NULL, prdv->rx_ring_dmas[i],
+				 METH_RX_BUFF_SIZE, DMA_FROM_DEVICE);
+		prdv->rx_ring[i] = 0;l+		prdv->rx_ring_dmas[i] = 0;l 		kfree_skb(prdv->rx_skbs[i]);l 	}
 }l@@ -270,8 +273,9 @@
 	ree_ndsmet _priv 	i *priv = (@
e_ndsmet _priv 	i *) dev->priv;e l 	/* R6set card */
-	mac	_et _write(SGI_MAC_RESET, mac_ctrl);
-	mac	_et _write(0, mac_ctrl);
+	mac	->et .mac_ctrl = SGI_MAC_RESET;l+	udelay(1);
+	mac	->et .mac_ctrl = 0;l 	ldelay(25);
 l 	/* Load et 	rnet address */
@@ -279,24 +283,24 @@
 	/* Should load some "errv;
", but laters*/
 	
 	/* Checksfor devic	s*/
-	i	(mdio_probi(priv) <O0) {l+	df (mdio_probi(priv) <O0) {l 		DPRINTK("Unablesto find PHYthc);l 		36,) { -ENODEV;l 	}
 l 	/* Init alsmode: 10 | Half-duplexi| Accept normalspackets */
 	prdv->mac_ctrl = METH_ACCEPT_MCASTi| METH_DEFAULT_IPG;
-	i	(dev->_lags | IFF_PROMISC)l+	d	 (dev->_lags | IFF_PROMISC)l 		prdv->mac_ctrl |= METH_PROMISC;l-	mac	_et _write(prdv->mac_ctrl, mac_ctrl);
+	mac	->et .mac_ctrl = prdv->mac_ctrl;l l 	/* Autonegot ate speflaand dupleximode */
 	met _check_link(dev);l l 	/* Now set dma control, but don'tsenable DMA, yets*/
-	prdv->dma_ctrl= (4 << METH_RX_OFFSET_SHIFT) |
-		(RX_RING_ENTRIES << METH_RX_DEPTH_SHIFT);
-	mac	_et _write(prdv->dma_ctrl, dma_ctrl);l+	prdv->dma_ctrl = (4 << METH_RX_OFFSET_SHIFT) |
+			 (RX_RING_ENTRIES << METH_RX_DEPTH_SHIFT);
+	mac	->et .dma_ctrl = prdv->dma_ctrl;
 l 	re,) { 0;
 }
@@ -335,7 +339,7 @@
 	/* S
 rt DMA */
 	prdv->dma_ctrl |= METH_DMA_TX_EN | /*METH_DMA_TX_INT_EN |*/
 			  METH_DMA_RX_EN | METH_DMA_RX_INT_EN;
-	mac	_et _write(prdv->dma_ctrl, dma_ctrl);l+	mac	->et .dma_ctrl = prdv->dma_ctrl;
 l 	DPRINTK("About tos@
 rt queuethc);l 	netif_st rt_queue(dev);l@@ -359,7 +363,7 @@
 	/*sshut down DMA */
 	prdv->dma_ctrl &= ~(METH_DMA_TX_EN | METH_DMA_TX_INT_EN |
 			    METH_DMA_RX_EN | METH_DMA_RX_INT_EN);
-	mac	_et _write(prdv->dma_ctrl, dma_ctrl);l+	mac	->et .dma_ctrl = prdv->dma_ctrl;
 	free_drq(dev->irqa	dev);
 	met _free_tx_ring(priv);
 	met _free_rx_ring(priv);
@@ -373,56 +377,57 @@
 @
 	voiv. I met _rx(ree_ndsnet_devic	* deva	uock, flaloTYsint_s	atus)
 {l 	@
e_ndssk_buff *skb;l+	uock, flaloTYss	atus;
 	ree_ndsmet _priv 	i *priv = (@
e_ndsmet _priv 	i *) dev->priv;e-	lock, flaloTYs_ifo_rptr=(int_s	atus&METH_INT_RX_RPTR_MASK)>>8;l+	uock, flaloTYs_ifo_rptr = (int_s	atus & METH_INT_RX_RPTR_MASK) >> 8;
+l 	@pin_lock(&prdv->met _lock);l-	prdv->dma_ctrl&=~METH_DMA_RX_INT_EN;
-	mac	_et _write(prdv->dma_ctrl, dma_ctrl);l+	prdv->dma_ctrl &= ~METH_DMA_RX_INT_EN;
+	mac	->et .dma_ctrl = prdv->dma_ctrl;
 	rpin_unlock(&prdv->met _lock);l l-	i	 (int_s	atus & METH_INT_RX_UNDERFLOW){l-		_ifo_rptr=(_ifo_rptr-1)&(0xF);
+	if (int_s	atus & METH_INT_RX_UNDERFLOW) {l+		fifo_rptr = (fifo_rptr - 1) & 0x0f;l 	}
-	while(prdv->rx_write !=s_ifo_rptr) {l-		u64ss	atus;
-		dma_unmap_singl	(NULL,prdv->rx_ring_dmas[prdv->rx_write],
-				 METH_RX_BUFF_SIZE,DMA_FROM_DEVICE);
-		s	atus=prdv->rx_ring[prdv->rx_write]->@e 	us.raw;
+	while (prdv->rx_write !=s_ifo_rptr) {l+		dma_unmap_singl	(NULL, prdv->rx_ring_dmas[prdv->rx_write],
+				 METH_RX_BUFF_SIZE, DMA_FROM_DEVICE);
+		s	atus = prdv->rx_ring[prdv->rx_write]->@e 	us.raw;
 #if MFE_DEBUG
-		i	(!(s	atus&METH_RX_ST_VALID)) {l+		 	 (!(s	atus & METH_RX_ST_VALID)) {l 			DPRINTK("Not received?ss	atus=%016lxthcas	atus);
 		}
 #endif
-		i	((!(s	atus&METH_RX_STATUS_ERRORS))&&(s	atus&METH_RX_ST_VALID)){l-			i tNlen=(s	atus&0xFFFF) - 4; /*somit CRC */
+		 	 ((!(s	atus & METH_RX_STATUS_ERRORS)) && (s	atus & METH_RX_ST_VALID)) {l+			i tNlen = (@
atus & 0xffff) - 4; /*somit CRC */
 			/* length sanityfchecks*/
-			 	(len < 60 || len >O1518) {l-				prd tk(KERN_DEBUG "%s: bogus packet s =
: %d,ss	atus=%#2lx.thc,l+			i	 (len < 60 || len >O1518) {l+				prd tk(KERN_DEBUG "%s: bogus packet s =
: %ld,ss	atus=%#2lx.thc,l 				       dev->name, prdv->rx_write,l 				       prdv->rx_ring[prdv->rx_write]->@e 	us.raw);
 				prdv->s	a	s.rx_e__ors++;
 				prdv->s	a	s.rx_length_e__ors++;
-				skb=prdv->rx_skbs[prdv->rx_write];l+				skb = prdv->rx_skbs[prdv->rx_write];l 			} e) { {l-				skb=alloc_skb(METH_RX_BUFF_SIZE,GFP_ATOMIC|GFP_DMA);
-				i	(!rkb){l+				skb = alloc_skb(METH_RX_BUFF_SIZE, GFP_ATOMIC | GFP_DMA);
+				i	 (!skb) {l 					/* Ouch! Nosmemory! Drop packet onsth	sfloor */
 					DPRINTK("Nosmem: dropping packetthc);l 					prdv->s	a	s.rx_dropped++;
-					skb=prdv->rx_skbs[prdv->rx_write];l+					skb = prdv->rx_skbs[prdv->rx_write];l 				} e) { {l-					@
e_ndssk_buff *skb_c=prdv->rx_skbs[prdv->rx_write];l-					/* 8byte s	a	ussvector+3quad padding + 2byte padding,
-					   to puts v;
sons64bit alk, flaboundary */
-					skb_reserve(skbaMETH_RX_HEAD);
+					@
e_ndssk_buff *skb_c = prdv->rx_skbs[prdv->rx_write];l+					/* 8byte s	a	ussvector + 3quad padding + 2byte padding,
+					 *fto puts v;
sons64bit alk, flaboundary */
+					skb_reserve(skba METH_RX_HEAD);
 					/* Write meta v;
, and t 	n pass to t 	sreceive level */
-					skb_put(skb_c,len);
-					prdv->rx_skbs[prdv->rx_write]=skb;l+					skb_put(skb_c, len);
+					prdv->rx_skbs[prdv->rx_write] = skb;
 					skb_c->dev = dev;
 					skb_c->protocol = et _type_
eans(skb_c, dev);l 					dev->last_rxi= jiffies;l 					prdv->s	a	s.rx_packets++;
-					prdv->s	a	s.rx_bytes+=len;
+					prdv->s	a	s.rx_bytes += len;
 					netif_rx(skb_c);l 				}l 			}l@@ -445,18 +450,19 @@
 				prd tk(KERN_WARNING "Carrier EventsSeenthc);l #endif
 		}
-		prdv->rx_ring[prdv->rx_write]=(rx_packet*)skb->head;
-		prdv->rx_ring[prdv->rx_write]->@e 	us.raw=0;
-		prdv->rx_ring_dmas[prdv->rx_write]=dma_map_singl	(NULL,prdv->rx_ring[prdv->rx_write],
-								  METH_RX_BUFF_SIZE,DMA_FROM_DEVICE);
-		mac	_et _write(prdv->rx_ring_dmas[prdv->rx_write], rx_fifo);l+		prdv->rx_ring[prdv->rx_write] = (rx_packet*)skb->head;
+		prdv->rx_ring[prdv->rx_write]->@e 	us.raw = 0;l+		prdv->rx_ring_dmas[prdv->rx_write] = 
+			dma_map_singl	(NULL, prdv->rx_ring[prdv->rx_write],
+				       METH_RX_BUFF_SIZE, DMA_FROM_DEVICE);
+		mac	->et .rx_fifo = prdv->rx_ring_dmas[prdv->rx_write];l 		ADVANCE_RX_PTR(prdv->rx_write);l 	}
 	rpin_lock(&prdv->met _lock);l 	/* In case t 	r	 was loderflow, and Rx DMA was disableds*/
-	prdv->dma_ctrl|=METH_DMA_RX_INT_EN|METH_DMA_RX_EN;
-	mac	_et _write(prdv->dma_ctrl, dma_ctrl);l-	mac	_et _write(METH_INT_RX_THRESHOLD,sint_s	at);l+	prdv->dma_ctrl |= METH_DMA_RX_INT_EN | METH_DMA_RX_EN;
+	mac	->et .dma_ctrl = prdv->dma_ctrl;
+	mac	->et .int_s	at = METH_INT_RX_THRESHOLD;
 	rpin_unlock(&prdv->met _lock);l }
 l@@ -464,31 +470,31 @@
 {l 	ree_ndsmet _priv 	i *priv = (@
e_ndsmet _priv 	i *) dev->priv;e l-	ret) {(prdv->tx_count >= TX_RING_ENTRIES-1);l+	re,) { (prdv->tx_count >= TX_RING_ENTRIES - 1);
 }
 l @
 	voiv. I met _tx_cle+nup(ree_ndsnet_devic	* deva	uock, flaloTYsint_s	atus)
 {l 	@
e_ndsmet _priv 	i *priv = dev->priv;e-	l64ss	atus;
+	uock, flaloTYss	atus;
 	ree_ndssk_buff *skb;l-	lock, flaloTYsrptr=(int_s	atus&TX_INFO_RPTR)>>16;
+	uock, flaloTYsrptr = (int_s	atus&TX_INFO_RPTR) >> 16;l 
 	rpin_lock(&prdv->met _lock);l 
 	/* S
op DMA notificat on */
 	prdv->dma_ctrl &= ~(METH_DMA_TX_INT_EN);
-	mac	_et _write(prdv->dma_ctrl, dma_ctrl);l+	mac	->et .dma_ctrl = prdv->dma_ctrl;
 
-	while(prdv->tx_read !=srptr){l+	while (prdv->tx_read !=srptr) {l 		skb = prdv->tx_skbs[prdv->tx_read];l 		s	atus = prdv->tx_ring[prdv->tx_read].header.raw;
 #if MFE_DEBUG>=1
-		i	(prdv->tx_read==prdv->tx_write)
-			DPRINTK("Auchi! tx_read=%d,tx_write=%d,rptr=%d?thc,prdv->tx_read,prdv->tx_write,rptr);
+		 	 (prdv->tx_read == prdv->tx_write)
+			DPRINTK("Auchi! tx_read=%d,tx_write=%d,rptr=%d?thc, prdv->tx_read, prdv->tx_write,rptr);
 #endif
-		i	(s	atus & METH_TX_ST_DONE) {l-			i	(s	atus & METH_TX_ST_SUCCESS){l+		 	 (s	atus & METH_TX_ST_DONE) {l+			i	 (s	atus & METH_TX_ST_SUCCESS){l 				prdv->s	a	s.tx_packets++;
 				prdv->s	a	s.tx_bytes += skb->len;l 			} e) { {l@@ -518,19 +524,19 @@
 		prdv->tx_skbs[prdv->tx_read] = NULL;
 		prdv->tx_ring[prdv->tx_read].header.raw = 0;l 		prdv->tx_read = (prdv->tx_read+1)&(TX_RING_ENTRIES-1);l-		prdv->tx_count --;l+		prdv->tx_count--;l 	}
 l 	/* wake up queue i	 it was stoppeds*/
-	i	 (netif_queue_stopped(dev) && ! met _tx_full(dev)) {
+	i	 (netif_queue_stopped(dev) && !met _tx_full(dev)) {
 		netif_wake_queue(dev);l 	}
 l-	mac	_et _write(METH_INT_TX_EMPTY | METH_INT_TX_PKT,sint_s	at);l+	mac	->et .int_s	at = METH_INT_TX_EMPTY | METH_INT_TX_PKT;
 	rpin_unlock(&prdv->met _lock);l }
 l-@
 	voiv. I met _e__or(ree_ndsnet_devic	* deva	u32 s	atus)
+@
 	voiv. I met _e__or(ree_ndsnet_devic	* deva	uock, flas	atus)
 {l 	@
e_ndsmet _priv 	i *priv = (@
e_ndsmet _priv 	i *) dev->priv;e l@@ -548,17 +554,16 @@
 	d	 (s	atus & (METH_INT_RX_UNDERFLOW)) {
 		prd tk(KERN_WARNING "met : Rx loderflowthc);l 		@pin_lock(&prdv->met _lock);l-		mac	_et _write(METH_INT_RX_UNDERFLOW,sint_s	at);l+		mac	->et .int_s	at = METH_INT_RX_UNDERFLOW;
 		/* more loderflowad te__upts will be delivered, 
-		   effect vely t rowing us into anad finite loop.
-		   Thus I stopsprocessing Rx insthis case.
-		*/
-		prdv->dma_ctrl&=~METH_DMA_RX_EN;
-		mac	_et _write(prdv->dma_ctrl, dma_ctrl);l+		 *feffect vely t rowing us into anad finite loop.
+		 *f Thus I stopsprocessing Rx insthis case. */
+		prdv->dma_ctrl &= ~METH_DMA_RX_EN;
+		mac	->et .dma_ctrl = prdv->dma_ctrl;
 		DPRINTK("Disabledsmet  Rx DMA temporarilythc);l 		@pin_unlock(&prdv->met _lock);l 	}
-	mac	_et _write(METH_INT_ERROR,sint_s	at);l+	mac	->et .int_s	at = METH_INT_ERROR;l }
 l /*
@@ -570,12 +575,12 @@
 	ree_ndsmet _priv 	i *priv = (@
e_ndsmet _priv 	i *) dev->priv;e 	uock, flaloTYss	atus;
 
-	reatus = mac	_et _read(int_s	at);l-	while (@
atus & 0xFF) {
+	reatus = mac	->et .int_s	at;
+	while (@
atus & 0xff) {
 		/* Firstshandle e__ors -sif we get Rx loderflow,
-		   Rx DMA will be disabled, and Rx handler will reenable
-		   it. I don'tsthink it's possiblesto get Rx loderflow,
-		   without getting Rx inte__upt */
+		 *fRx DMA will be disabled, and Rx handler will reenable
+		 *fit. I don'tsthink it's possiblesto get Rx loderflow,
+		 *fwithout getting Rx inte__upt */
 		i	 (s	atus & METH_INT_ERROR) {l 			met _e__or(dev, reatus);
 		}
@@ -589,7 +594,7 @@
 			/*ssend it tosmet _rxsfor handling */l 			met _rx(dev, reatus);
 		}
-		reatus = mac	_et _read(int_s	at);l+		reatus = mac	->et .int_s	at;
 	}
 l 	re,) { IRQ_HANDLED;
@@ -601,45 +606,45 @@
 @
 	voiv. I met _tx_short_prepari(ree_ndsmet _priv 	i *priv,l 				  ree_ndssk_buff *skb)
 {l-	tx_packets*desc=&prdv->tx_ring[prdv->tx_write];l-	i tNlen = (@kb->len<ETH_ZLEN)?ETH_ZLEN:skb->len;l+	tx_packets*desc = &prdv->tx_ring[prdv->tx_write];l+	i tNlen = (@kb->len < ETH_ZLEN) ? ETH_ZLEN : skb->len;l 
-	desc->header.raw=METH_TX_CMD_INT_EN|(len-1)|((128-len)<<16);l+	desc->header.raw = METH_TX_CMD_INT_EN | (len-1) | ((128-len) << 16);l 	/* maybe I should set whole t ing tos0 first... */
-	memcpy(desc-> v;
.dt+(120-len),skb-> v;
,skb->len);
-	if(@kb->len < len)
-		memset(desc-> v;
.dt+120-len+@kb->len,0,len-skb->len);
+	memcpy(desc-> v;
.dt + (120 -slen), skb-> v;
, skb->len);
+	 	 (skb->len < len)
+		memset(desc-> v;
.dt + 120 -slen + @kb->len, 0a len-skb->len);
 }
 #define TX_CATBUF1 BIT(25)
 @
 	voiv. I met _tx_1page_prepari(ree_ndsmet _priv 	i *priv,l 				  ree_ndssk_buff *skb)
 {l-	tx_packets*desc=&prdv->tx_ring[prdv->tx_write];l+	tx_packets*desc = &prdv->tx_ring[prdv->tx_write];l 	v. I *buffer_ v;
s= (v. I *)(((uock, flaloTY)skb-> v;
 + 7) & ~7);
 	d t unalk, fl_len = (int)((uock, flaloTY)buffer_ v;
s- (uock, flaloTY)skb-> v;
);
 	d t buffer_len = skb->len - unalk, fl_len;
 	dma_addr_t catbuf;l 
-	desc->header.raw=METH_TX_CMD_INT_EN|TX_CATBUF1|(skb->len-1);l+	desc->header.raw = METH_TX_CMD_INT_EN | TX_CATBUF1 | (skb->len - 1);
 l 	/* unalk, fl parts*/
-	i	(unalk, fl_len){l-		memcpy(desc-> v;
.dt+(120-unalk, fl_len),
+	 	 (unalk, fl_len) {l+		memcpy(desc-> v;
.dt + (120 -sunalk, fl_len),
 		       skb-> v;
, unalk, fl_len);
-		desc->header.raw |= (128-unalk, fl_len) << 16;l+		desc->header.raw |= (128 -sunalk, fl_len) << 16;l 	}
 l 	/* firstspages*/l 	catbuf = dma_map_singl	(NULL, buffer_ v;
, buffer_len,l 				DMA_TO_DEVICE);
 	desc-> v;
.cat_buf[0].form.st rt_addr = catbuf >> 3;
-	desc-> v;
.cat_buf[0].form.len = buffer_len-1;l+	desc-> v;
.cat_buf[0].form.len = buffer_len - 1;
 }
 #define TX_CATBUF2 BIT(26)
 @
 	voiv. I met _tx_2page_prepari(ree_ndsmet _priv 	i *priv,l 				  ree_ndssk_buff *skb)
 {l-	tx_packets*desc=&prdv->tx_ring[prdv->tx_write];l+	tx_packets*desc = &prdv->tx_ring[prdv->tx_write];l 	v. I *buffer1_ v;
s= (v. I *)(((uock, flaloTY)skb-> v;
 + 7) & ~7);
 	v. I *buffer2_ v;
s= (v. I *)PAGE_ALIGN((uock, flaloTY)skb-> v;
);
 	d t unalk, fl_len = (int)((uock, flaloTY)buffer1_ v;
s- (uock, flaloTY)skb-> v;
);
@@ -647,44 +652,44 @@
 	d t buffer2_len = skb->len - buffer1_len - unalk, fl_len;
 	dma_addr_t catbuf1, catbuf2;l 
-	desc->header.raw=METH_TX_CMD_INT_EN|TX_CATBUF1|TX_CATBUF2|(skb->len-1);l+	desc->header.raw = METH_TX_CMD_INT_EN | TX_CATBUF1 | TX_CATBUF2| (skb->len - 1);
 	/* unalk, fl parts*/
-	i	(unalk, fl_len){l-		memcpy(desc-> v;
.dt+(120-unalk, fl_len),
+	 	 (unalk, fl_len){l+		memcpy(desc-> v;
.dt + (120 -sunalk, fl_len),
 		       skb-> v;
, unalk, fl_len);
-		desc->header.raw |= (128-unalk, fl_len) << 16;l+		desc->header.raw |= (128 -sunalk, fl_len) << 16;l 	}
 l 	/* firstspages*/l 	catbuf1 = dma_map_singl	(NULL, buffer1_ v;
, buffer1_len,l 				 DMA_TO_DEVICE);
 	desc-> v;
.cat_buf[0].form.st rt_addr = catbuf1 >> 3;
-	desc-> v;
.cat_buf[0].form.len = buffer1_len-1;l+	desc-> v;
.cat_buf[0].form.len = buffer1_len - 1;
 	/*ssecondspages*/l 	catbuf2 = dma_map_singl	(NULL, buffer2_ v;
, buffer2_len,l 				 DMA_TO_DEVICE);
 	desc-> v;
.cat_buf[1].form.st rt_addr = catbuf2 >> 3;
-	desc-> v;
.cat_buf[1].form.len = buffer2_len-1;l+	desc-> v;
.cat_buf[1].form.len = buffer2_len - 1;
 }
 
 @
 	voiv. I met _add_to_tx_ring(ree_ndsmet _priv 	i *priv, ree_ndssk_buff *skb)
 {l 	/* R6member t 	sskba so we can free it atad te__upt time */
 	prdv->tx_skbs[prdv->tx_write] = skb;
-	 	(skb->len <=O120) {
+	i	 (skb->len <=O120) {
 		/* Whole packetsfits into descriptor */
-		met _tx_short_prepari(priv,skb);l-	} e) { i	(PAGE_ALIGN((uock, flaloTY)skb-> v;
) !=
-		  PAGE_ALIGN((uock, flaloTY)skb-> v;
+skb->len-1)) {l+		met _tx_short_prepari(priv, rkb);l+	} e) { i	 (PAGE_ALIGN((uock, flaloTY)skb-> v;
) !=
+		   PAGE_ALIGN((uock, flaloTY)skb-> v;
 + @kb->len - 1)) {
 		/* Packetscross	s pagesboundary */
-		met _tx_2page_prepari(priv,skb);l+		met _tx_2page_prepari(priv, rkb);l 	} e) { {l 		/* Packetsis insonespages*/l-		met _tx_1page_prepari(priv,skb);l+		met _tx_1page_prepari(priv, rkb);l 	}
-	prdv->tx_write = (prdv->tx_write+1) & (TX_RING_ENTRIES-1);l-	mac	_et _write(prdv->tx_write, tx_info);l-	prdv->tx_count ++;
+	prdv->tx_write = (prdv->tx_write + 1) & (TX_RING_ENTRIES - 1);
+	mac	->et .tx_info = prdv->tx_write;
+	prdv->tx_count++;
 }
 l /*
@@ -695,10 +700,10 @@
 	ree_ndsmet _priv 	i *priv = (@
e_ndsmet _priv 	i *) dev->priv;e 	uock, flaloTYs_lags;
 
-	spin_lock_drqsaze(&prdv->met _lock,_lags);
+	spin_lock_drqsaze(&prdv->met _lock, _lags);
 	/* S
op DMA notificat on */
 	prdv->dma_ctrl &= ~(METH_DMA_TX_INT_EN);
-	mac	_et _write(prdv->dma_ctrl, dma_ctrl);l+	mac	->et .dma_ctrl = prdv->dma_ctrl;
 
 	met _add_to_tx_ring(priv, rkb);l 	dev->
eans_@
 rt = jiffies; /*ssazest 	s	imestamp */
@@ -711,9 +716,9 @@
 l 	/* R6s
 rt DMA notificat on */
 	prdv->dma_ctrl |= METH_DMA_TX_INT_EN;
-	mac	_et _write(prdv->dma_ctrl, dma_ctrl);l+	mac	->et .dma_ctrl = prdv->dma_ctrl;
 l-	@pin_unlock_drqr6s
ore(&prdv->met _lock,_lags);
+	spin_unlock_drqr6s
ore(&prdv->met _lock, _lags);
 l 	re,) { 0;
 }
@@ -743,11 +748,11 @@
 	met _init_rx_ring(priv);
 l 	/* R6s
 rt dma */
-	prdv->dma_ctrl|=METH_DMA_TX_EN|METH_DMA_RX_EN|METH_DMA_RX_INT_EN;
-	mac	_et _write(prdv->dma_ctrl, dma_ctrl);l+	prdv->dma_ctrl |= METH_DMA_TX_EN | METH_DMA_RX_EN | METH_DMA_RX_INT_EN;
+	mac	->et .dma_ctrl = prdv->dma_ctrl;
 
 	/* Enablesinte__upt */
-	@pin_unlock_drqr6s
ore(&prdv->met _lock,_lags);
+	spin_unlock_drqr6s
ore(&prdv->met _lock, _lags);
 l 	dev->
eans_@
 rt = jiffies;l 	netif_wake_queue(dev);l@@ -760,8 +765,14 @@
  */
 @
 	void dsmet _ioctl(ree_ndsnet_devic	s*deva	s
e_ndsifreq *rqa	d dscmd)
 {l-	DPRINTK("ioctlthc);l-	re,) { 0;
+	/* XXX Not yetsimplemented */l+	switch(cmd) { 
+	case SIOCGMIIPHY:
+	case SIOCGMIIREG:
+	case SIOCSMIIREG:
+	default:l+		36,) { -EOPNOTSUPP;l+	}
 }
 l /*
@@ -808,7 +819,7 @@
 	}
 l 	prd tk(KERN_INFO "%s: SGI MACE Et 	rnet rev. %dthc,l-	       dev->name, (uock, flad t)mac	_et _read(mac_ctrl) >> 29);
+	       dev->name, (uock, flad t)(mac	->et .mac_ctrl >> 29));
 	re,) { 0;
 }
 ldiff -Nru a/drivers/net/met .h b/drivers/net/met .h
--- a/drivers/net/met .h	2004-01-20 13:30:12 -08:00
+++ b/drivers/net/met .h	2005-01-27 18:03:34 -08:00
@@ -29,7 +29,7 @@
 #define RX_BUCKET_SIZE 256
 
 #lodef BIT
-#define BIT(x)	(1 << (x))
+#define BIT(x)	(1UL << (x))
 
 /* For more detailed explanat ons of whataeach fielI menasal    see Nick's great comments to #defines belowa(or docs, ifldiff -Nru a/drivers/net/mii.c b/drivers/net/mii.c
--- a/drivers/net/mii.c	2003-01-03 11:37:55 -08:00
+++ b/drivers/net/mii.c	2005-02-25 13:12:07 -08:00
@@ -37,6 +37,7 @@
 {l 	@
e_ndsnet_devic	s*dev = mii->dev;e 	u32 advert, bmcr, lpa, nego;
+	u32 advert2 = 0, bmcr2 = 0, lpa2 = 0;l 
 	ecmd->supportfl =l 	    (SUPPORTED_10baseT_Half | SUPPORTED_10baseT_Full |l@@ -54,6 +55,9 @@
 l 	ecmd->advertising = ADVERTISED_TPi| ADVERTISED_MII;e 	advert = mii->mdio_read(deva	mii->phy_id,sMII_ADVERTISE);
+	 	 (mii->supports_gmii)l+		advert2 = mii->mdio_read(deva	mii->phy_id,sMII_CTRL1000);
+
 	d	 (advert & ADVERTISE_10HALF)l 		ecmd->advertising |= ADVERTISED_10baseT_Half;
 	d	 (advert & ADVERTISE_10FULL)
@@ -62,19 +66,31 @@
 		ecmd->advertising |= ADVERTISED_100baseT_Half;
 	d	 (advert & ADVERTISE_100FULL)
 		ecmd->advertising |= ADVERTISED_100baseT_Full;
+	 	 (advert2 & ADVERTISE_1000HALF)l+		ecmd->advertising |= ADVERTISED_1000baseT_Half;
+	 	 (advert2 & ADVERTISE_1000FULL)
+		ecmd->advertising |= ADVERTISED_1000baseT_Full;
 l 	bmcr = mii->mdio_read(deva	mii->phy_id,sMII_BMCR);
 	lpa = mii->mdio_read(deva	mii->phy_id,sMII_LPA);
+	 	 (mii->supports_gmii) {l+		bmcr2 = mii->mdio_read(deva	mii->phy_id,sMII_CTRL1000);
+		lpa2 = mii->mdio_read(deva	mii->phy_id,sMII_STAT1000);
+	}
 	d	 (bmcr & BMCR_ANENABLE) {
 		ecmd->advertising |= ADVERTISED_Autoneg;
 		ecmd->autoneg = AUTONEG_ENABLE;
 		
 		nego = mii_nway_result(advert & lpa);
-		i	 (nego == LPA_100FULL || nego == LPA_100HALF)l+		 	 ((bmcr2 & (ADVERTISE_1000HALFi| ADVERTISE_1000FULL)) & 
+		    (lpa2 >> 2))
+			ecmd->spefla= SPEED_1000;
+		e) { i	 (nego == LPA_100FULL || nego == LPA_100HALF)l 			ecmd->spefla= SPEED_100;
 		e) {l 			ecmd->spefla= SPEED_10;
-		i	 (nego == LPA_100FULL || nego == LPA_10FULL) {l+		 	 ((lpa2 & LPA_1000FULL) || nego == LPA_100FULL ||
+		    nego == LPA_10FULL) {l 			ecmd->duplexi= DUPLEX_FULL;
 			mii->full_duplexi= 1;
 		} e) { {l@@ -84,7 +100,9 @@
 	} e) { {l 		ecmd->autoneg = AUTONEG_DISABLE;
 
-		ecmd->spefla= (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10;
+		ecmd->spefla= ((bmcr2 & BMCR_SPEED1000 && 
+				(bmcr & BMCR_SPEED100) == 0) ? SPEED_1000 :
+			       (bmcr & BMCR_SPEED100) ? SPEED_100 : SPEED_10);
 		ecmd->duplexi= (bmcr & BMCR_FULLDPLX) ? DUPLEX_FULL : DUPLEX_HALF;l 	}
 l@@ -97,7 +115,9 @@
 {l 	@
e_ndsnet_devic	s*dev = mii->dev;e 
-	if (ecmd->spefla!= SPEED_10 && ecmd->spefla!= SPEED_100)l+	d	 (ecmd->spefla!= SPEED_10 && 
+	    ecmd->spefla!= SPEED_100 && 
+	    ecmd->spefla!= SPEED_1000)
 		re,) { -EINVAL;
 	d	 (ecmd->duplexi!= DUPLEX_HALF && ecmd->duplexi!= DUPLEX_FULL)
 		re,) { -EINVAL;
@@ -109,21 +129,30 @@
 		re,) { -EINVAL;
 	d	 (ecmd->autoneg != AUTONEG_DISABLE && ecmd->autoneg != AUTONEG_ENABLE)
 		re,) { -EINVAL;
+	d	 ((ecmd->spefla== SPEED_1000) && (!mii->supports_gmii))
+		36,) { -EINVAL;
 				  
 	/* k, ore supportfl, maxtxpkt, maxrxpkts*/
 	
 	d	 (ecmd->autoneg == AUTONEG_ENABLE) {l 		u32 bmcr, advert, tmp;l+		u32 advert2 = 0, tmp2 = 0;l 
 		d	 ((ecmd->advertising & (ADVERTISED_10baseT_Half |
 					  ADVERTISED_10baseT_Full |l 					  ADVERTISED_100baseT_Half |
-					  ADVERTISED_100baseT_Full)) == 0)
+					  ADVERTISED_100baseT_Full |
+					  ADVERTISED_1000baseT_Half |
+					  ADVERTISED_1000baseT_Full)) == 0)
 			36,) { -EINVAL;
 l 		/* advertise only whatahas been requested */l 		advert = mii->mdio_read(deva	mii->phy_id,sMII_ADVERTISE);
 		tmp = advert & ~(ADVERTISE_ALL | ADVERTISE_100BASE4);
+		 	 (mii->supports_gmii) {l+			advert2 = mii->mdio_read(deva	mii->phy_id,sMII_CTRL1000);
+			tmp2 = advert2 & ~(ADVERTISE_1000HALFi| ADVERTISE_1000FULL);l+		}
 		d	 (ecmd->advertising & ADVERTISED_10baseT_Half)
 			tmp |= ADVERTISE_10HALF;
 		d	 (ecmd->advertising & ADVERTISED_10baseT_Full)
@@ -132,10 +161,18 @@
 			tmp |= ADVERTISE_100HALF;
 		d	 (ecmd->advertising & ADVERTISED_100baseT_Full)
 			tmp |= ADVERTISE_100FULL;
+		 	 (mii->supports_gmii) {l+			d	 (ecmd->advertising & ADVERTISED_1000baseT_Half)
+				advert2 |= ADVERTISE_1000HALF;
+			d	 (ecmd->advertising & ADVERTISED_1000baseT_Full)
+				advert2 |= ADVERTISE_1000FULL;
+		}
 		d	 (advert != tmp) {l 			mii->mdio_write(deva	mii->phy_id,sMII_ADVERTISE, tmp);
 			mii->advertising = tmp;l 		}
+		i	 ((mii->supports_gmii) && (advert2 != tmp2))
+			mii->mdio_write(deva	mii->phy_id,sMII_CTRL1000, tmp2);
 		
 		/* ,) { onsautonegot at on, and forc	sa renegot ate */l 		bmcr = mii->mdio_read(deva	mii->phy_id,sMII_BMCR);
@@ -148,8 +185,11 @@
 
 		/* ,) { offsauto negot at on, set speflaand duplexityf*/l 		bmcr = mii->mdio_read(deva	mii->phy_id,sMII_BMCR);
-		tmp = bmcr & ~(BMCR_ANENABLEi| BMCR_SPEED100i| BMCR_FULLDPLX);
-		i	 (ecmd->spefla== SPEED_100)
+		tmp = bmcr & ~(BMCR_ANENABLEi| BMCR_SPEED100i| 
+			       BMCR_SPEED1000 | BMCR_FULLDPLX);
+		i	 (ecmd->spefla== SPEED_1000)
+			tmp |= BMCR_SPEED1000;
+		e) { i	 (ecmd->spefla== SPEED_100)
 			tmp |= BMCR_SPEED100;
 		d	 (ecmd->duplexi== DUPLEX_FULL) {l 			tmp |= BMCR_FULLDPLX;
@@ -207,6 +247,7 @@
 {l 	uock, flad t old_carrier, new_carrier;
 	d t advertise, lpa, media, duplex;l+	i tNlpa2 = 0;l 
 	/* kf forc	d media, go no furt 	rf*/l 	 	 (mii->forc	_media)
@@ -243,16 +284,20 @@
 		mii->advertising = advertise;l 	}
 	lpa = mii->mdio_read(mii->deva	mii->phy_id,sMII_LPA);
+	 	 (mii->supports_gmii)
+		lpa2 = mii->mdio_read(mii->deva	mii->phy_id,sMII_STAT1000);
 l 	/* figura out mediaaand duplexifrom advertise and LPA values */
 	mediaa= mii_nway_result(lpa & advertise);l 	duplexi= (mediaa& ADVERTISE_FULL) ? 1 : 0;
+	 	 (lpa2 & LPA_1000FULL)l+		duplexi= 1;
 l 	 	 (ok_to_prd t)
 		prd tk(KERN_INFO "%s: link up, %sMbps, %s-duplex, lpa 0x%04Xthc,l 		       mii->dev->name,
-		       mediaa& (ADVERTISE_100FULLi| ADVERTISE_100HALF) ?
-		       		"100" : "10c,l+		       lpa2 & (LPA_1000FULLi| LPA_1000HALF) ? "1000" :l+		       mediaa& (ADVERTISE_100FULLi| ADVERTISE_100HALF) ? "100" : "10c,l 		       duplexi? "full" : "halfc,l 		       lpa);
 ldiff -Nru a/drivers/net/mv643xx_et .c b/drivers/net/mv643xx_et .c
--- a/drivers/net/mv643xx_et .c	2004-10-20 01:37:15 -07:00
+++ b/drivers/net/mv643xx_et .c	2005-03-07 20:26:32 -08:00
@@ -1,5 +1,5 @@
 /*
- * drivers/net/mv64340_et .c - Driver for MV64340X et 	rnet ports
+ * drivers/net/mv643xx_et .c - Driver for MV643XX et 	rnet ports
  *+Copyright (C) 2002 Matt 	w Dharm <mdharm@momenco.com>
  *
  *+Based onsth	s64360 driverifrom:
@@ -10,6 +10,12 @@
  *
  *+Copyright (C) 2003 Ralf Baechle <ralf@linux-mips.org>
  *
+ *+Copyright (C) 2004-2005 MontaVista Software, Inc.
+ *			   Dale Farnsworth <dale@farnsworth.org>
+ *
+ *+Copyright (C) 2004 Steven J. Hill <sjhill1@rockwellcollins.com>
+ *				     <sjhill@realitydiluted.com>
+ *
  *+This programsis free software; you can redistribute it and/or
  *imodify it loderst 	s	erms of t 	sGNU General Public Licen {l  *ias publishflaby t 	sFree Software Foundat on; eit 	rfvers on 2
@@ -24,80 +30,100i@@
  * aloTYswithsthis program; kf not, write to t 	sFree Software
  * Foundat on, Inc., 59 Temple Plac	s- Suite 330, Boston, MA  02111-1307, USA.
  */
-#include <linux/config.h>
-#include <linux/vers on.h>
-#include <linux/modul	.h>
-#include <linux/k	rnel.h>
-#include <linux/config.h>
-#include <linux/schfl.h>
-#include <linux/ptrac	.h>
-#include <linux/fcntl.h>
-#include <linux/ioport.h>
-#include <linux/inte__upt.h>
-#include <linux/slab.h>
-#include <linux/string.h>
-#include <linux/e__no.h>
-#include <linux/ip.h>
 #include <linux/init.h>
-#include <linux/in.h>
-#include <linux/pci.h>
-#include <linux/workqueue.h>
-#include <asm/smp.h>
-#include <linux/skbuff.h>
+#include <linux/dma-mapping.h>
 #include <linux/tcp.h>
-#include <linux/netdevic	.h>
+#include <linux/udp.h>
 #include <linux/et 	rdevic	.h>
-#include <net/ip.h>
 
 #include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/et tool.h>
 #include <asm/io.h>
 #include <asm/types.h>
 #include <asm/pgtable.h>
 #include <asm/system.h>
+#include <asm/delay.h>
 #include "mv643xx_et .h"
 l /*
- *+T 	 firstspartsis t 	shigh level driveriof t 	sgigE et 	rnet ports. 
+ *+T 	 firstspartsis t 	shigh level driveriof t 	sgigE et 	rnet ports.
  */
 
-/* Definit on for configuring driveri*/
-#lodef MV64340_RX_QUEUE_FILL_ON_TASK
-
 /* Constants */
-#define EXTRA_BYTES 32
-#define WRAP       ETH_HLEN + 2 + 4 + 16
-#define BUFFER_MTU dev->mtu + WRAP
+#define VLAN_HLEN		4
+#define FCS_LEN			4
+#define WRAP			NET_IP_ALIGN + ETH_HLEN + VLAN_HLEN + FCS_LEN
+#define RX_SKB_SIZE		((dev->mtu + WRAP + 7) & ~0x7)
+
 #define INT_CAUSE_UNMASK_ALL		0x0007ffff
 #define INT_CAUSE_UNMASK_ALL_EXT	0x0011ffff
-#ifdef MV64340_RX_FILL_ON_TASK
+#ifdef MV643XX_RX_QUEUE_FILL_ON_TASK
 #define INT_CAUSE_MASK_ALL		0x00000000
 #define INT_CAUSE_CHECK_BITS		INT_CAUSE_UNMASK_ALL
 #define INT_CAUSE_CHECK_BITS_EXT	INT_CAUSE_UNMASK_ALL_EXTl #endif
 
+#ifdef MV643XX_CHECKSUM_OFFLOAD_TX
+#define MAX_DESCS_PER_SKB	(MAX_SKB_FRAGS + 1)l+#e) {l+#define MAX_DESCS_PER_SKB	1l+#endif
+l+#define PHY_WAIT_ITERATIONS	1000	/*+1000 iterat ons *+10uSi= 10mS max */
+#define PHY_WAIT_MICRO_SECONDS	10
+
 /* S
 	ic funct on declarat ons */l-@
 	void dsmv64340_et _real_open(ree_ndsnet_devic	s*);
-@
 	void dsmv64340_et _real_stop(ree_ndsnet_devic	s*);
-@
 	void dsmv64340_et _chang	_mtu(ree_ndsnet_devic	s*a	d d);
-@
 	voiree_ndsnet_devic	_s	ats *mv64340_et _get_s	ats(ree_ndsnet_devic	s*);
+@
 	void tNet _port_link_is_up(uock, flad tNet _port_num);
+@
 	voiv. I et _port_uc_addr_get(ree_ndsnet_devic	s*deva
+						lock, flachar *MacAddr);
+@
 	void dsmv643xx_et _real_open(ree_ndsnet_devic	s*);
+@
 	void dsmv643xx_et _real_stop(ree_ndsnet_devic	s*);
+@
 	void dsmv643xx_et _chang	_mtu(ree_ndsnet_devic	s*a	d d);
+@
 	voiree_ndsnet_devic	_s	ats *mv643xx_et _get_s	ats(ree_ndsnet_devic	s*);
 @
 	voiv. I et _port_init_mac_tables(uock, flad tNet _port_num);
-#ifdef MV64340_NAPI
-@
 	void dsmv64340_poll(ree_ndsnet_devic	s*deva	d ds*budget);
+#ifdef MV643XX_NAPI
+@
 	void dsmv643xx_poll(ree_ndsnet_devic	s*deva	d ds*budget);
 #endif
+@
 	voiv. I et 	rnet_phy_set(uock, flad tNet _port_numa	d dsphy_addr);
+@
 	void tNet 	rnet_phy_detect(uock, flad tNet _port_num);
+@
 	voiree_ndset tool_opssmv643xx_et tool_ops;l+l+@
 	voichar mv643xx_driver_name[] = "mv643xx_et ";l+@
 	voichar mv643xx_driver_vers on[] = "1.0";l+l+@
 	voiv. I __iomem *mv643xx_et _shared_base;l+l+/* used to protect MV643XX_ETH_SMI_REG, whichsis shared across ports */
+@
 	voirpinlock_dsmv643xx_et _phy_locka= SPIN_LOCK_UNLOCKED;
+
+@
 	void line u32 mv_read(int offset)l+{l+	v. I *__iomem reg_base;l+l+	reg_basea= mv643xx_et _shared_bases- MV643XX_ETH_SHARED_REGS;l+l+	re,) { readl(reg_basea+ offset);l+}
+
+@
 	void line v. I mv_write(int offseta	u32  v;
)l+{l+	v. I * __iomem reg_base;l l-lock, flachar prom_mac_addr_base[6];l-uock, flaloTYsmv64340_sram_base;l+	reg_basea= mv643xx_et _shared_bases- MV643XX_ETH_SHARED_REGS;l+	writel( v;
, reg_basea+ offset);l+}
 l /*
  *+Chang	s MTU (maximum 
eansferiunit)iof t 	sgigabit et 	nret port
  *
- *+Inputs: pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure
- *+++++++++new mtu s =
 
- *+Outputs: 0 upon success, -EINVAL upon failure
+ *+Inputs:	pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure
+ *		new mtu s =

+ *+Outputs:	0 upon success, -EINVAL upon failure
  */l-@
 	void dsmv64340_et _chang	_mtu(ree_ndsnet_devic	s*deva	d dsnew_mtu)
+@
 	void dsmv643xx_et _chang	_mtu(ree_ndsnet_devic	s*deva	d dsnew_mtu)
 {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	uock, flaloTYs_lags;
 
 	spin_lock_drqsaze(&mp->lock, _lags);
@@ -108,21 +134,21 @@
 	}
 l 	dev->mtu =snew_mtu;
-	/* 
+	/*l 	 * S
op t 	n re-open t 	sinte_fac	.+This will alloc 	i RX rkb'sswithl 	 * t 	snew MTU.l 	 * T 	r	 is a possiblesdang	rst at t 	sopen will not successfl, duel 	 * tosmemorysis full, whichsmight fail t 	sopen funct on.l 	 */l 	 	 (netif_running(dev)) {
-		i	 (mv64340_et _real_stop(dev))
+		 	 (mv643xx_et _real_stop(dev))
 			prd tk(KERN_ERR
-			+++++++"%s: Fv;
l e__or onsstopping devic	thc,l-			       dev->name);
-		i	 (mv64340_et _real_open(dev))
+				"%s: Fv;
l e__or onsstopping devic	thc,l+				dev->name);
+		 	 (mv643xx_et _real_open(dev))
 			prd tk(KERN_ERR
-			+++++++"%s: Fv;
l e__or onsopening devic	thc,l-			       dev->name);
+				"%s: Fv;
l e__or onsopening devic	thc,l+				dev->name);
 	}
 l 	spin_unlock_drqr6s
ore(&mp->lock, _lags);
@@ -130,17 +156,17 @@
 }
 l /*
- *+mv64340_et _rx_task
- *								       
+ *+mv643xx_et _rx_task
+ *
  *+Fills / refills RX queue onsa certainsgigabit et 	rnet port
  *
- *+Inputs: pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure
- *+Outputs: N/A
+ *+Inputs:	pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure
+ *+Outputs:	N/A
  */l-@
 	voiv. I mv64340_et _rx_task(v. I * v;
)l+@
 	voiv. I mv643xx_et _rx_task(v. I * v;
)l {l-	@
e_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*)  v;
;l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*) v;
;l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	@
e_ndspkt_info pkt_info;
 	ree_ndssk_buff *skb;l 
@@ -148,28 +174,18 @@
 		panic("%s: E__or inst6s
_set_bit / cle+r_bit", dev->name);
 l 	while (mp->rx_ring_skbs < (mp->rx_ring_s =
 - 5)) {
-		/*+T 	 +8 for buffer allk, ment and anot 	rf32 byte ex
ea */l-
-		rkb = dev_alloc_skb(BUFFER_MTU + 8 + EXTRA_BYTES);l+		rkb = dev_alloc_skb(RX_SKB_SIZE);
 		d	 (!skb)l-			/*+Bette_ luckanex
 time */
 			break;
 		mp->rx_ring_skbs++;
 		pkt_info.cmd_sts = ETH_RX_ENABLE_INTERRUPT;
-		pkt_info.byte_cnt = dev->mtu + ETH_HLEN + 4 + 2 + EXTRA_BYTES;
-		/* Allk,  buffer to 8 bytes */l-		 	 (pkt_info.byte_cnt & ~0x7) {l-			pkt_info.byte_cnt &= ~0x7;l-			pkt_info.byte_cnt += 8;
-		}
-		pkt_info.buf_ptr =
-		    pci_map_singl	(0, skb-> v;
,
-				   dev->mtu + ETH_HLEN + 4 + 2 + EXTRA_BYTES,
-				   PCI_DMA_FROMDEVICE);
+		pkt_info.byte_cnt = RX_SKB_SIZE;
+		pkt_info.buf_ptr = dma_map_singl	(NULL, skb-> v;
, RX_SKB_SIZEa
+							DMA_FROM_DEVICE);
 		pkt_info.re,) {_info = skb;
 		d	 (et _rx_re,) {_buff(mp, &pkt_info) != ETH_OK) {l 			prd tk(KERN_ERR
-			+++++++"%s: E__or alloc 	ing RX Ringthc, dev->name);
+				"%s: E__or alloc 	ing RX Ringthc, dev->name);
 			break;
 		}
 		@kb_reserve(skba 2);
@@ -186,46 +202,45 @@
 		add_timer(&mp->timeout);
 		mp->rx_timer__lagi= 1;
 	}
-#if MV64340_RX_QUEUE_FILL_ON_TASK
+#ifdef MV643XX_RX_QUEUE_FILL_ON_TASK
 	e) { {l 		/* Re,) { d te__upts */l-		MV_WRITE(MV64340_ETH_INTERRUPT_MASK_REG(mp->port_num),l-			 INT_CAUSE_UNMASK_ALL);l+		mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(mp->port_num),l+							INT_CAUSE_UNMASK_ALL);l 	}
 #endif
 }
 l /*
- *+mv64340_et _rx_task_timer_wrapper
- *								       
+ *+mv643xx_et _rx_task_timer_wrapper
+ *
  *+Timer routine to wake up RX queue filling task.+This funct on is
  *+used only inscase t 	 RX queue is empty, and all alloc_skbahas
  *+failed (due to out of memorysevent).
  *
- *+Inputs: pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure
- *+Outputs: N/A
+ *+Inputs:	pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure
+ *+Outputs:	N/A
  */l-@
 	voiv. I mv64340_et _rx_task_timer_wrapper(uock, flaloTY  v;
)l+@
 	voiv. I mv643xx_et _rx_task_timer_wrapper(uock, flaloTY  v;
)l {l-	@
e_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*)  v;
;l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*) v;
;l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 
 	mp->rx_timer__lagi= 0;
-	mv64340_et _rx_task((v. I *)  v;
);
+	mv643xx_et _rx_task((v. I *) v;
);
 }
 l-l /*
- *+mv64340_et _up v;e_mac_address
- *								       
+ *+mv643xx_et _up v;e_mac_address
+ *
  *+Up v;e t 	 MAC address of t 	sport insthe address table
  *
- *+Inputs: pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure
- *+Outputs: N/A
+ *+Inputs:	pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure
+ *+Outputs:	N/A
  */l-@
 	voiv. I mv64340_et _up v;e_mac_address(ree_ndsnet_devic	s*dev)l+@
 	voiv. I mv643xx_et _up v;e_mac_address(ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	uock, flad dsport_numa= mp->port_num;l 
 	et _port_init_mac_tables(port_num);
@@ -234,64 +249,59 @@
 }
 l /*
- *+mv64340_et _set_rx_mode
- *								       
+ *+mv643xx_et _set_rx_mode
+ *
  *+Chang	ifrom promiscuos to regular rximode
  *
- *+Inputs: pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure
- *+Outputs: N/A
+ *+Inputs:	pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure
+ *+Outputs:	N/A
  */l-@
 	voiv. I mv64340_et _set_rx_mode(ree_ndsnet_devic	s*dev)l+@
 	voiv. I mv643xx_et _set_rx_mode(ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l+	u32 config_reg;e 
-	if (dev->_lags & IFF_PROMISC) {l-		et 	rnet_set_config_reg
-		    (mp->port_num,
-		     et 	rnet_get_config_reg(mp->port_num) |
-		     ETH_UNICAST_PROMISCUOUS_MODE);l-	} e) { {l-		et 	rnet_set_config_reg
-		    (mp->port_num,
-		     et 	rnet_get_config_reg(mp->port_num) &
-		     ~(uock, flad t) ETH_UNICAST_PROMISCUOUS_MODE);l-	}
+	config_reg = et 	rnet_get_config_reg(mp->port_num);
+	 	 (dev->_lags & IFF_PROMISC)l+		config_reg |= (u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE;
+	e) {l+		config_reg &= ~(u32) MV643XX_ETH_UNICAST_PROMISCUOUS_MODE;
+	et 	rnet_set_config_reg(mp->port_num, config_reg);
 }
 l-l /*
- *+mv64340_et _set_mac_address
- *								       
+ *+mv643xx_et _set_mac_address
+ *
  *+Chang	it 	sinte_fac	's mac address.
  * Nosspecialahardware t ing should be donesbecaus	sinte_fac	 is always
  *+putsinspromiscuousimode.
  *
- *+Inputs: pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure and
- *+++++++++a pointe_ to t 	sdeck, ated entrysto be added to t 	scache.
- *+Outputs: zero upon success, negat ve upon failure
+ *+Inputs:	pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure and
+ *		a pointe_ to t 	sdeck, ated entrysto be added to t 	scache.
+ *+Outputs:	zero upon success, negat ve upon failure
  */l-@
 	void dsmv64340_et _set_mac_address(ree_ndsnet_devic	s*deva	v. I *addr)
+@
 	void dsmv643xx_et _set_mac_address(ree_ndsnet_devic	s*deva	v. I *addr)
 {l 	d dsi;l 
 	for (ii= 0; i < 6; i++)l 		/* +2sis forst 	soffset of t 	sHW addr type */l-		dev->dev_addr[i] = ((lock, flachar *) addr)[i + 2];
-	mv64340_et _up v;e_mac_address(dev);l+		dev->dev_addr[i] = ((lock, flachar *)addr)[i + 2];
+	mv643xx_et _up v;e_mac_address(dev);l 	re,) { 0;
 }
 l /*
- *+mv64340_et _tx_timeout
- *								       
+ *+mv643xx_et _tx_timeout
+ *
  *+Callflaupon a timeout onsteansmitting a packet
  *
- *+Inputs: pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure.
- *+Outputs: N/A
+ *+Inputs:	pointe_ to et 	rnet inte_fac	snetwork devic	sree_ndure.
+ *+Outputs:	N/A
  */l-@
 	voiv. I mv64340_et _tx_timeout(ree_ndsnet_devic	s*dev)l+@
 	voiv. I mv643xx_et _tx_timeout(ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l l 	prd tk(KERN_INFO "%s: TX timeout  ", dev->name);
 l@@ -300,31 +310,31 @@
 }
 l /*
- *+mv64340_et _tx_timeout_task
+ * mv643xx_et _tx_timeout_task
  *
  *+Andualaroutine to resetsthe adapte_ w 	n a timeout onsTxahas occurred
  */l-@
 	voiv. I mv64340_et _tx_timeout_task(ree_ndsnet_devic	s*dev)l+@
 	voiv. I mv643xx_et _tx_timeout_task(ree_ndsnet_devic	s*dev)l {l-++++++++@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l l-++++++++netif_devic	_detach(dev);l-++++++++et _port_reset(mp->port_num);
-++++++++et _port_@
 rt(mp);
-++++++++netif_devic	_attach(dev);l+	netif_devic	_detach(dev);l+	et _port_reset(mp->port_num);
+	et _port_@
 rt(mp);
+	netif_devic	_attach(dev);l }
 l /*
- *+mv64340_et _free_tx_queue
+ * mv643xx_et _free_tx_queue
  *
- *+Inputs: dev -+a pointe_ to t 	srequirflad te_fac	
+ *+Inputs:	dev -+a pointe_ to t 	srequirflad te_fac	
  *
- *+Outputs: 0 if was ablesto release skba, nonzero ot 	rwis

+ *+Outputs:	0 if was ablesto release skba, nonzero ot 	rwis

  */l-@
 	void dsmv64340_et _free_tx_queue(ree_ndsnet_devic	s*deva
-			++++++uock, flad tNet _int_caus	_ext)
+@
 	void dsmv643xx_et _free_tx_queue(ree_ndsnet_devic	s*deva
+					lock, flad tNet _int_caus	_ext)
 {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	ree_ndsnet_devic	_s	ats *s	ats = &mp->s	ats;l 	@
e_ndspkt_info pkt_info;
 	d tNreleasedi= 1;
@@ -341,33 +351,36 @@
 			s	ats->tx_e__ors++;
 		}
 l-		/* 
+		/*l 		 * If re,) {_info is different than 0, release t 	sskb.l 		 * T 	scase w 	r	 re,) {_info is not 0 is only inscasel 		 * w 	n teansmitted a scatte_/gat 	rfpacket, w 	r	 onlyl 		 * last skbareleases t 	swhole chain.l 		 */
 		i	 (pkt_info.re,) {_info) {l-			dev_kfree_@kb_irq((ree_ndssk_buff *)
-					  pkt_info.re,) {_info);l-			releasedi= 0;
 			i	 (skb_shinfo(pkt_info.re,) {_info)->nr_frags)
-				pci_unmap_page(NULL, pkt_info.buf_ptr,
-					pkt_info.byte_cnt, PCI_DMA_TODEVICE);
+				dma_unmap_page(NULL, pkt_info.buf_ptr,
+						pkt_info.byte_cnt,
+						DMA_TO_DEVICE);
+			e) {l+				dma_unmap_singl	(NULL, pkt_info.buf_ptr,
+						pkt_info.byte_cnt,
+						DMA_TO_DEVICE);
 l-			i	 (mp->tx_ring_skbs != 1)l-				mp->tx_ring_skbs--;l-		} e) { l-			pci_unmap_page(NULL, pkt_info.buf_ptr,
-					pkt_info.byte_cnt, PCI_DMA_TODEVICE);
-l-		/* 
-		 * Decrement t 	snumber of outstanding skbs counter on
-		 * t 	sTX queue.
-		 */l-		 	 (mp->tx_ring_skbs == 0)
-			panic("ERROR -+TX outstanding SKBs counter is co__upted");
+			dev_kfree_@kb_irq(pkt_info.re,) {_info);l+			releasedi= 0;
 l+			/*l+			 * Decrement t 	snumber of outstanding skbs counter on
+			 * t 	sTX queue.
+			 */
+			d	 (mp->tx_ring_skbs == 0)
+				panic("ERROR -+TX outstanding SKBs"
+						" counter is co__upted");
+			mp->tx_ring_skbs--;l+		} e) {
+			dma_unmap_page(NULL, pkt_info.buf_ptr,
+					pkt_info.byte_cnt, DMA_TO_DEVICE);
 	}
 l 	spin_unlock(&mp->lock);
@@ -376,60 +389,59 @@
 }
 l /*
- *+mv64340_et _rece ve
+ *+mv643xx_et _rece ve
  *
  *+This funct on is forwardfpacketsst at ar	 rece vedifrom t 	sport's
  *+queues towardfk	rnel co_	 or FastRou;e t 	m to anot 	rfinte_fac	.
  *
- *+Inputs: dev -+a pointe_ to t 	srequirflad te_fac	
- *+++++++++max - maximum number to rece ve (0 means+uolimted)
+ *+Inputs:	dev -+a pointe_ to t 	srequirflad te_fac	
+ *		max - maximum number to rece ve (0 means+uolimted)
  *
- *+Outputs: number of servedfpackets
+ *+Outputs:	number of servedfpackets
  */
-#ifdef MV64340_NAPI
-@
 	void dsmv64340_et _rece ve_queue(ree_ndsnet_devic	s*deva+uock, flad tNmax,
-								d t budget)
+#ifdef MV643XX_NAPI
+@
 	void dsmv643xx_et _rece ve_queue(ree_ndsnet_devic	s*deva+d t budget)
 #e) {l-@
 	void dsmv64340_et _rece ve_queue(ree_ndsnet_devic	s*deva+uock, flad tNmax)
+@
 	void dsmv643xx_et _rece ve_queue(ree_ndsnet_devic	s*dev)
 #endif
 {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	ree_ndsnet_devic	_s	ats *s	ats = &mp->s	ats;l 	uock, flad tNrece ved_packetsi= 0;
 	ree_ndssk_buff *skb;l 	@
e_ndspkt_info pkt_info;
 
-#ifdef MV64340_NAPI
+#ifdef MV643XX_NAPI
 	while (et _port_rece ve(mp, &pkt_info) == ETH_OK && budget > 0) {
 #e) {l-	while ((--max) && et _port_rece ve(mp, &pkt_info) == ETH_OK) {l+	while (et _port_rece ve(mp, &pkt_info) == ETH_OK) {
 #endif
 		mp->rx_ring_skbs--;l 		rece ved_packets++;
-#ifdef MV64340_NAPI
+#ifdef MV643XX_NAPI
 		budget--;l #endif
 		/*+Up v;e @
 	vs	vos. Note byte count includes 4 byte CRC count */
 		s	ats->rx_packets++;
 		s	ats->rx_bytes += pkt_info.byte_cnt;
-		rkb = (ree_ndssk_buff *) pkt_info.re,) {_info;l+		rkb = pkt_info.re,) {_info;l 		/*l 		 * Inscase rece vedia packetfwithout firsts/ last bits on ORl 		 * t 	se__or summary bit is on, t 	spacketsineedssto be dropefl.l 		 */
 		i	 (((pkt_info.cmd_sts
-		      & (ETH_RX_FIRST_DESC | ETH_RX_LAST_DESC)) !=
-		     (ETH_RX_FIRST_DESC | ETH_RX_LAST_DESC))
-		    || (pkt_info.cmd_sts & ETH_ERROR_SUMMARY)) {l+				& (ETH_RX_FIRST_DESC | ETH_RX_LAST_DESC)) !=
+					(ETH_RX_FIRST_DESC | ETH_RX_LAST_DESC))
+				|| (pkt_info.cmd_sts & ETH_ERROR_SUMMARY)) {l 			s	ats->rx_dropped++;
 			i	 ((pkt_info.cmd_sts & (ETH_RX_FIRST_DESC |
-						 ETH_RX_LAST_DESC)) !=
-			    (ETH_RX_FIRST_DESC | ETH_RX_LAST_DESC)) {l+							ETH_RX_LAST_DESC)) !=
+				(ETH_RX_FIRST_DESC | ETH_RX_LAST_DESC)) {l 				 	 (net_rv;elimit())
 					prd tk(KERN_ERR
-					+++++++"%s: Rece vedipacketfspread on multiple"
-					+++++++" descriptorsthc,l-					       dev->name);
+						"%s: Rece vedipacketfspread "
+						"on multiple descriptorsthc,l+						dev->name);
 			}
 			i	 (pkt_info.cmd_sts & ETH_ERROR_SUMMARY)
 				s	ats->rx_e__ors++;
@@ -445,11 +457,11 @@
 
 			i	 (pkt_info.cmd_sts & ETH_LAYER_4_CHECKSUM_OK) {l 				skb->ip_summedi= CHECKSUM_UNNECESSARY;l-				skb->csuma= htons((pkt_info.cmd_sts
-							& 0x0007fff8) >> 3);
+				skb->csuma= htons(
+					(pkt_info.cmd_sts & 0x0007fff8) >> 3);
 			}
 			skb->protocol = et _type_teans(skba dev);l-#ifdef MV64340_NAPI
+#ifdef MV643XX_NAPI
 			netif_rece ve_skb(rkb);l #e) {l 			netif_rx(rkb);l@@ -461,74 +473,74 @@
 }
 l /*
- *+mv64340_et _int_handler
+ *+mv643xx_et _int_handler
  *
  *+Mainsinte__upt handler forst 	sgigbit et 	rnet ports
  *
- *+Inputs: irq -sirq number (not used)
- *+++++++++dev_id -+a pointe_ to t 	srequirflad te_fac	's  v;
sree_ndure
- *+++++++++regs+++- not used
- *+Outputs: N/A
+ *+Inputs:	irq	-sirq number (not used)
+ *		dev_id	-+a pointe_ to t 	srequirflad te_fac	's  v;
sree_ndure
+ *		regs	- not used
+ *+Outputs:	N/A
  */l l-@
 	voidrqr6,) {_t+mv64340_et _int_handler(int irqa	v. I * ev_id,l-	@
e_ndspt_regs+*regs)
+@
 	voidrqr6,) {_t+mv643xx_et _int_handler(int irqa	v. I * ev_id,l+							@
e_ndspt_regs+*regs)
 {l-	@
e_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*)  ev_id;l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsnet_devic	s*dev = (ree_ndsnet_devic	s*) ev_id;l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	u32Net _int_caus	,Net _int_caus	_exti= 0;
 	uock, flad dsport_numa= mp->port_num;l 
 	/* Readsinte__upt caus	sregvs	ers */l-	et _int_caus	 = MV_READ(MV64340_ETH_INTERRUPT_CAUSE_REG(port_num)) &
-			INT_CAUSE_UNMASK_ALL;
+	et _int_caus	 = mv_read(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num)) &
+						INT_CAUSE_UNMASK_ALL;
 l 	 	 (et _int_caus	 & BIT1)l-		et _int_caus	_exti=l-		MV_READ(MV64340_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num)) &
-		INT_CAUSE_UNMASK_ALL_EXT;
+		et _int_caus	_exti= mv_read(
+			MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num)) &
+						INT_CAUSE_UNMASK_ALL_EXT;
 
-#ifdef MV64340_NAPI
+#ifdef MV643XX_NAPI
 	d	 (!(et _int_caus	 & 0x0007fffd)) {
-	/* Dont ack t 	 Rxsinte__upt */
+		/* Dont ack t 	 Rxsinte__upt */
 #endif
 		/*l-	 	 * Cle+rsspecifvoiet 	rnet portsintre__upt regvs	ers byl+		 * Cle+rsspecifvoiet 	rnet portsintre__upt regvs	ers byl 		 * acknowleding relevant bits.l 		 */
-		MV_WRITE(MV64340_ETH_INTERRUPT_CAUSE_REG(port_num)a
-			+~et _int_caus	);l+		mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num)a
+							~et _int_caus	);l 		d	 (et _int_caus	_exti!= 0x0)
-			MV_WRITE(MV64340_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num),
-				 ~et _int_caus	_ext);
+			mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG
+					(port_num), ~et _int_caus	_ext);
 
 		/* UDP chang	s: We mayineedsthis */
 		i	 ((et _int_caus	_exti& 0x0000ffff) &&
-		    (mv64340_et _free_tx_queue(deva+et _int_caus	_ext) == 0) &&
-		    (MV64340_TX_QUEUE_SIZE > mp->tx_ring_skbs + 1))
-+++++++++++++++++++++++++++++++++++++++++netif_wake_queue(dev);l-#ifdef MV64340_NAPI
+		    (mv643xx_et _free_tx_queue(deva+et _int_caus	_ext) == 0) &&
+		    (mp->tx_ring_s =
 > mp->tx_ring_skbs + MAX_DESCS_PER_SKB))
+			netif_wake_queue(dev);l+#ifdef MV643XX_NAPI
 	} e) { {l 		 	 (netif_rx_schflule_prep(dev)) {
 			/*+Mask all t 	sinte__upts */l-			MV_WRITE(MV64340_ETH_INTERRUPT_MASK_REG(port_num),0);l-			MV_WRITE(MV64340_ETH_INTERRUPT_EXTEND_MASK_REG(port_num), 0);
+			mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num), 0);
+			mv_write(MV643XX_ETH_INTERRUPT_EXTEND_MASK_REG
+								(port_num), 0);
 			__netif_rx_schflule(dev);l 		}
 #e) {l-		{l 		d	 (et _int_caus	 & (BIT2 | BIT11))
-			mv64340_et _rece ve_queue(deva+0);
+			mv643xx_et _rece ve_queue(deva+0);
 
 		/*l-		 * After forwardedsrece vedipacketssto upper layer,  add a task
+		 * After forwardedsrece vedipacketssto upper layer, add a task
 		 * insa{ d te__upts enabled contex
 t at refills t 	 RX ringl 		 * withsrkb's.l 		 */
-#if MV64340_RX_QUEUE_FILL_ON_TASK
+#ifdef MV643XX_RX_QUEUE_FILL_ON_TASK
 		/* Unmask all d te__upts on et 	rnet ports*/l-		MV_WRITE(MV64340_ETH_INTERRUPT_MASK_REG(port_num),
-		+++++++++INT_CAUSE_MASK_ALL);l+		mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num),l+							INT_CAUSE_MASK_ALL);l 		queue_task(&mp->rx_task, &tq_immediat	);l 		mark_bh(IMMEDIATE_BH);l #e) {l@@ -538,25 +550,15 @@
 	}
 	/* PHY @
 	us chang	d */l 	 	 (et _int_caus	_exti& (BIT16 | BIT20)) {
-		uock, flad dsphy_reg_ v;
;l-l-		/* Check Link @
 	us on et 	rnet ports*/l-		et _port_read_smi_reg(port_num, 1, &phy_reg_ v;
);
-		i	 (!(phy_reg_ v;
i& 0x20)) {
-			netif_stop_queue(dev);l-		} e) { {l+		d	 (et _port_link_is_up(port_num)) {
+			netif_carrier_on(dev);l 			netif_wake_queue(dev);l-l-			/*
-			+* S
 rtsall TX queues on et 	rnet port.+This is goolad 
-			+* case of previousipacketssw 	r	 not teansmitted, duel-			+* to link down and this command re-enablessall TXl-			+* queues.l-			+* Note t at it is possiblesto get a TX resourc	se__orl-			+* inte__upt after issuing this, sinc	 not all TX queuesl-			+* ar	 enabled, or has anyt ing to send.l-			+*/l-			MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num), 1);
+			/* S
 rtsTX queue */
+			mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG
+								(port_num), 1);
+		} e) { {l+			netif_carrier_off(dev);l+			netif_stop_queue(dev);l 		}
 	}
 l@@ -570,7 +572,7 @@
 	re,) { IRQ_HANDLED;
 }
 l-#ifdef MV64340_COAL
+#ifdef MV643XX_COAL
 l /*
  *+et _port_@et_rx_coals- Setsscoalescing inte__upt mechanism on RX pathl@@ -584,9 +586,9 @@
  *	, and th	srequirfladelay of t 	sinte__upt insus	c.
  *
  *+INPUT:
- *	uock, flad tNet _port_num      Et 	rnet portsnumber
- *	uock, flad tNt_clk++++++++t_clk+of t 	sMV-643xx chip insHZiunits
- *	uock, flad tNdelay       Delay insus	c
+ *	uock, flad tNet _port_num	Et 	rnet portsnumber
+ *	uock, flad tNt_clk		t_clk+of t 	sMV-643xx chip insHZiunits
+ *	uock, flad tNdelay		Delay insus	c
  *
  *+OUTPUT:
  *	Inte__upt coalescing mechanism valuesis set insMV-643xx chip.l@@ -596,15 +598,15 @@
  *
  */
 @
 	voiuock, flad tNet _port_@et_rx_coal(uock, flad tNet _port_numal-	uock, flad tNt_clka+uock, flad tNdelay)
+					lock, flad tNt_clka+uock, flad tNdelay)
 {l 	uock, flad t coals= ((t_clk+/+1000000) *Ndelay)+/+64;l 
 	/* Set RX Coalescing mechanism */l-	MV_WRITE(MV64340_ETH_SDMA_CONFIG_REG(et _port_num),
-		+((coals& 0x3fff) << 8) |
-		 (MV_READ(MV64340_ETH_SDMA_CONFIG_REG(et _port_num))
-		  & 0xffc000ff));
+	mv_write(MV643XX_ETH_SDMA_CONFIG_REG(et _port_num),
+		((coals& 0x3fff) << 8) |
+		(mv_read(MV643XX_ETH_SDMA_CONFIG_REG(et _port_num))
+			& 0xffc000ff));
 l 	re,) { coal;
 }
@@ -618,13 +620,13 @@
  *	This parameter is a timeout counter, t at counts ins64Nt_clk
  *	chunks ; t at w 	n timeout event occurs a maskablesinte__upt
  *	occurs.
- *	T 	sparameter is calculated using theNt_cLK frequency of t 	s
+ *	T 	sparameter is calculated using theNt_cLK frequency of t 	
  *	MV-643xx chip and th	srequirfladelay in t 	sinte__upt insuS	c
  *
  *+INPUT:
- *	uock, flad tNet _port_num      Et 	rnet portsnumber
- *	uock, flad tNt_clk++++++++t_clk+of t 	sMV-643xx chip insHZiunits
- *	uock, flad tNdelay       Delay insuS	conds
+ *	uock, flad tNet _port_num	Et 	rnet portsnumber
+ *	uock, flad tNt_clk		t_clk+of t 	sMV-643xx chip insHZiunits
+ *	uock, flad tNdelay		Delay insuS	conds
  *
  *+OUTPUT:
  *	Inte__upt coalescing mechanism valuesis set insMV-643xx chip.l@@ -634,48 +636,48 @@
  *
  */
 @
 	voiuock, flad tNet _port_@et_tx_coal(uock, flad tNet _port_numal-	uock, flad tNt_clka+uock, flad tNdelay)
+					lock, flad tNt_clka+uock, flad tNdelay)
 {l 	uock, flad t coal;l 	coals= ((t_clk+/+1000000) *Ndelay)+/+64;l 	/* Set TX Coalescing mechanism */l-	MV_WRITE(MV64340_ETH_TX_FIFO_URGENT_THRESHOLD_REG(et _port_num),
-		+coals<< 4);
+	mv_write(MV643XX_ETH_TX_FIFO_URGENT_THRESHOLD_REG(et _port_num),
+								coals<< 4);
 	re,) { coal;
 }
 l /*
- *+mv64340_et _open
+ *+mv643xx_et _open
  *
  *+This funct on is callflaw 	n openning theNnetwork devic	.+T 	 funct on
  *+should init al =
 all t 	shardware, init al =
 cyclic Rx/Tx
  *+descriptors chain and buffers and alloc 	i a{ IRQ to t 	snetwork
  *+devic	.
  *
- *+Inputs: a pointe_ to t 	snetwork devic	sree_ndure
+ *+Inputs:	a pointe_ to t 	snetwork devic	sree_ndure
  *
- *+Outputs: zero of successa, nonzero kf fails.
+ *+Outputs:	zero of successa, nonzero kf fails.
  */l l-@
 	void dsmv64340_et _open(ree_ndsnet_devic	s*dev)l+@
 	void dsmv643xx_et _open(ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	uock, flad dsport_numa= mp->port_num;l-	d t e__ = err;l+	i tNerr;l 
 	spin_lock_drq(&mp->lock);
 
-	e__ = request_drq(dev->irqa	mv64340_et _int_handler,
-	++++++++++++++++++SA_INTERRUPT |+SA_SAMPLE_RANDOM, dev->namea dev);l+	e__ = request_drq(dev->irqa	mv643xx_et _int_handler,
+			SA_INTERRUPT |+SA_SAMPLE_RANDOM, dev->namea dev);l l 	 	 (err) {
-		prd tk(KERN_ERR "Ca{ not asck,  IRQ number to MV64340_et %dthc,l-		+++++++port_num);
+		prd tk(KERN_ERR "Ca{ not asck,  IRQ number to MV643XX_et %dthc,l+								port_num);
 		e__ = -EAGAIN;
 		goto out;
 	}
 l-	i	 (mv64340_et _real_open(dev)) {l+	 	 (mv643xx_et _real_open(dev)) {
 		prd tk("%s: E__or opening d te_fac	thc, dev->name);
 		e__ = -EBUSY;
 		goto out_free;l@@ -698,66 +700,35 @@
  * et 	r_init_rx_desc_rings- Curv	sa Rx chain desc list and buffer insmemory.
  *
  *+DESCRIPTION:
- *+++++++This funct on preparessa Rx chainflalist of descriptors and packetf
- *+++++++buffers in a form of a ring.+T 	 routine must be callflaafter ports
- *+++++++init al =at on routine and befo_	 ports@
 rt routine. 
- *+++++++The Et 	rnet SDMA engine uses CPU+bus addresses to accessat 	svariousi
- *+++++++devic	s in t 	ssystem (i.e. DRAM).+This funct on uses t 	set 	rnet 
- *+++++++@
e_nds'virdualato physical' routine (set by t 	suser) to set t 	srings
- *+++++++withsphysical addresses.
+ *	T is funct on preparessa Rx chainflalist of descriptors and packet
+ *	buffers in a form of a ring.+T 	 routine must be callflaafter port
+ *	init al =at on routine and befo_	 ports@
 rt routine.
+ *	T 	sEt 	rnet SDMA engine uses CPU+bus addresses to accessat 	svarious
+ *	devic	s in t 	ssystem (i.e. DRAM).+This funct on uses t 	set 	rnet
+ *	@
e_nds'virdualato physical' routine (set by t 	suser) to set t 	sring
+ *	withsphysical addresses.
  *
  *+INPUT:
- *	@
e_ndsmv64340_priv 	i   *mp   Et 	rnet PortsControl srduct. 
- *++++++i tN			rx_desc_num       Number of Rx descriptors
- *++++++i tN			rx_buff_s =
 +++++S =
 of Rx buffer
- *++++++uock, flad ds+++rx_desc_base_addr  Rx descriptors memorysarea baseaaddr.
- *++++++uock, flad ds+++rx_buff_base_addr  Rx buffer memorysarea baseaaddr.
+ *	@
e_ndsmv643xx_priv 	i *mp	Et 	rnet PortsControl srduct.
  *
  *+OUTPUT:
- *++++++T 	 routine up v;es t 	sEt 	rnet portscontrol s
e_ndswithsinformat on 
- *++++++regarding theNRx descriptors and buffers.
+ *	T 	sroutine up v;es t 	sEt 	rnet portscontrol s
e_ndswithsinformat on
+ *	regarding theNRx descriptors and buffers.
  *
  *+RETURN:
- *++++++fa) { i	 t 	sgiven descriptors memorysarea is not alk, flaaccording to
- *++++++Et 	rnet SDMA specifvoat ons.
- *++++++
e_e ot 	rwis
.
+ *	None.
  */l-@
 	void dset 	r_init_rx_desc_ring(@
e_ndsmv64340_priv 	i * mpal-	uock, flaloTY rx_buff_base_addr)
+@
 	voiv. I et 	r_init_rx_desc_ring(@
e_ndsmv643xx_priv 	i *mp)l {l-	uock, flaloTY buffer_addr = rx_buff_base_addr;
 	vol 	vleiree_ndset _rx_desc *p_rx_desc;
 	d tNrx_desc_num = mp->rx_ring_s =
;l-	uock, flaloTY rx_desc_base_addr = (uock, flaloTY) mp->p_rx_desc_area;l-	d t rx_buff_s =
 = 1536;	/* Dummy, will b	sreplac	lalat	rf*/l 	  dsi;l 
-	p_rx_desc = (ree_ndset _rx_desc *) rx_desc_base_addr;l-l-	/* Rx desc Must be 4LW alk, fla(i.e. Descriptor_Address[3:0]=0000). */l-	 	 (rx_buff_base_addr & 0xf)
-		re,) { 0;
-l-	/* Rx buffers a_	 limited to 64K bytes and Minimum s =
 is 8 bytes  */l-	 	 ((rx_buff_s =
 < 8) || (rx_buff_s =
 > RX_BUFFER_MAX_SIZE))
-		re,) { 0;
-l-	/* Rx buffers must be 64-bit alk, fl.       */l-	 	 ((rx_buff_base_addr + rx_buff_s =
) & 0x7)
-		re,) { 0;
-l-	/* init al =
 theNRx descriptors rings*/
+	/* init al =
 theNnex
_desc_ptr links in t 	sRx descriptors rings*/
+	p_rx_desc = (ree_ndset _rx_desc *)mp->p_rx_desc_area;l 	for (ii= 0; i < rx_desc_num; i++) {
-		p_rx_desc[i].buf_s =
 = rx_buff_s =
;
-		p_rx_desc[i].byte_cnt = 0x0000;
-		p_rx_desc[i].cmd_sts =l-			ETH_BUFFER_OWNED_BY_DMA | ETH_RX_ENABLE_INTERRUPT;
 		p_rx_desc[i].nex
_desc_ptr = mp->rx_desc_dma +l 			((i + 1) % rx_desc_num) *Ns =
of(ree_ndset _rx_desc);
-		p_rx_desc[i].buf_ptr = buffer_addr;l-l-		mp->rx_skb[i] = NULL;
-		buffer_addr += rx_buff_s =
;
 	}
 l 	/* Sav	sRx desc pointe_ to driveriree_nd. */l@@ -766,293 +737,288 @@
 
 	mp->rx_desc_area_s =
 = rx_desc_num *Ns =
of(ree_ndset _rx_desc);
 
+	/* Add t 	squeue to t 	slist of RX queues ofsthis ports*/l 	mp->port_rx_queue_command |= 1;
-l-	re,) { 1;
 }
 l /*
  * et 	r_init_tx_desc_rings- Curv	sa Tx chain desc list and buffer insmemory.
  *
  *+DESCRIPTION:
- *+++++++This funct on preparessa Tx chainflalist of descriptors and packetf
- *+++++++buffers in a form of a ring.+T 	 routine must be callflaafter ports
- *+++++++init al =at on routine and befo_	 ports@
 rt routine. 
- *+++++++The Et 	rnet SDMA engine uses CPU+bus addresses to accessat 	svariousi
- *+++++++devic	s in t 	ssystem (i.e. DRAM).+This funct on uses t 	set 	rnet 
- *+++++++@
e_nds'virdualato physical' routine (set by t 	suser) to set t 	srings
- *+++++++withsphysical addresses.
+ *	T is funct on preparessa Tx chainflalist of descriptors and packet
+ *	buffers in a form of a ring.+T 	 routine must be callflaafter port
+ *	init al =at on routine and befo_	 ports@
 rt routine.
+ *	T 	sEt 	rnet SDMA engine uses CPU+bus addresses to accessat 	svarious
+ *	devic	s in t 	ssystem (i.e. DRAM).+This funct on uses t 	set 	rnet
+ *	@
e_nds'virdualato physical' routine (set by t 	suser) to set t 	sring
+ *	withsphysical addresses.
  *
  *+INPUT:
- *	@
e_ndsmv64340_priv 	i   *mp   Et 	rnet PortsControl srduct. 
- *++++++i tN		tx_desc_num        Number of Tx descriptors
- *++++++i tN		tx_buff_s =
	+++S =
 of Tx buffer
- *++++++uock, flad ds+++tx_desc_base_addr  Tx descriptors memorysarea baseaaddr.
+ *	@
e_ndsmv643xx_priv 	i *mp	Et 	rnet PortsControl srduct.
  *
  *+OUTPUT:
- *++++++T 	 routine up v;es t 	sEt 	rnet portscontrol s
e_ndswithsinformat on 
- *++++++regarding theNTx descriptors and buffers.
+ *	T 	sroutine up v;es t 	sEt 	rnet portscontrol s
e_ndswithsinformat on
+ *	regarding theNTx descriptors and buffers.
  *
  *+RETURN:
- *++++++fa) { i	 t 	sgiven descriptors memorysarea is not alk, flaaccording to
- *++++++Et 	rnet SDMA specifvoat ons.
- *++++++
e_e ot 	rwis
.
+ *	None.
  */l-@
 	void dset 	r_init_tx_desc_ring(@
e_ndsmv64340_priv 	i *mp)l+@
 	voiv. I et 	r_init_tx_desc_ring(@
e_ndsmv643xx_priv 	i *mp)l {l-	uock, flaloTY tx_desc_base_addr = (uock, flaloTY) mp->p_tx_desc_area;l 	d tNtx_desc_num = mp->tx_ring_s =
;l 	@
e_ndset _tx_desc *p_tx_desc;
 	d tNi;l 
-	/*+Tx desc Must be 4LW alk, fla(i.e. Descriptor_Address[3:0]=0000). */l-	 	 (tx_desc_base_addr & 0xf)
-		re,) { 0;
-l-	/* saze t 	sfirstsdesc pointe_ to link withst 	slastsdescriptor */l-	p_tx_desc = (ree_ndset _tx_desc *) tx_desc_base_addr;l-l-	/* Init al =
 theNTx descriptors rings*/
+	/* Init al =
 theNnex
_desc_ptr links in t 	sTx descriptors rings*/
+	p_tx_desc = (ree_ndset _tx_desc *)mp->p_tx_desc_area;l 	for (ii= 0; i < tx_desc_num; i++) {
-		p_tx_desc[i].byte_cnt	= 0x0000;
-		p_tx_desc[i].l4i_chk	= 0x0000;
-		p_tx_desc[i].cmd_sts	= 0x00000000;
 		p_tx_desc[i].nex
_desc_ptr = mp->tx_desc_dma +l 			((i + 1) % tx_desc_num) *Ns =
of(ree_ndset _tx_desc);
-		p_tx_desc[i].buf_ptr	= 0x00000000;
-		mp->tx_skb[i]		= NULL;
 	}
 l-	/* Set Tx desc pointe_ in driveriree_nd. */l 	mp->tx_curr_desc_qi= 0;
 	mp->tx_used_desc_qi= 0;
-#ifdef MV64340_CHECKSUM_OFFLOAD_TX
-++++++++mp->tx_first_desc_qi= 0;
+#ifdef MV643XX_CHECKSUM_OFFLOAD_TX
+	mp->tx_first_desc_qi= 0;
 #endif
-	/* Init Tx ringsbaseaand s =
 parameters */l-	mp->tx_desc_area_s =
	= tx_desc_num *Ns =
of(ree_ndset _tx_desc);
+
+	mp->tx_desc_area_s =
 = tx_desc_num *Ns =
of(ree_ndset _tx_desc);
 l 	/* Add t 	squeue to t 	slist of Tx queues ofsthis ports*/l 	mp->port_tx_queue_command |= 1;
-l-	re,) { 1;
 }
 l-/* Helper funct on for mv64340_et _open */l-@
 	void dsmv64340_et _real_open(ree_ndsnet_devic	s*dev)l+/* Helper funct on for mv643xx_et _open */
+@
 	void dsmv643xx_et _real_open(ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	uock, flad dsport_numa= mp->port_num;l-	u32Nphy_reg_ v;
;l 	uock, flad dss =
;l l 	/* S
op RX Queues */l-	MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num),l-		+0x0000ff00);
+	mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num),+0x0000ff00);
 l 	/* Cle+rst 	set 	rnet portsinte__upts */l-	MV_WRITE(MV64340_ETH_INTERRUPT_CAUSE_REG(port_num)a 0);l-	MV_WRITE(MV64340_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0);
+	mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num)a 0);l+	mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0);
 l 	/* Unmask RX buffer and TX endsinte__upt */
-	MV_WRITE(MV64340_ETH_INTERRUPT_MASK_REG(port_num),
-		+INT_CAUSE_UNMASK_ALL);l+	mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num),l+						INT_CAUSE_UNMASK_ALL);l l 	/* Unmask phy and link @
 	us chang	s inte__upts */l-	MV_WRITE(MV64340_ETH_INTERRUPT_EXTEND_MASK_REG(port_num),
-		+INT_CAUSE_UNMASK_ALL_EXT);l+	mv_write(MV643XX_ETH_INTERRUPT_EXTEND_MASK_REG(port_num),
+						INT_CAUSE_UNMASK_ALL_EXT);l 
 	/* Set t 	 MAC Addresss*/l 	memcpy(mp->port_mac_addr, dev->dev_addr, 6);l 
 	et _port_init(mp);
 l-	INIT_WORK(&mp->rx_task, (v. I (*)(v. I *)) mv64340_et _rx_taska dev);l+	INIT_WORK(&mp->rx_task, (v. I (*)(v. I *))mv643xx_et _rx_taska dev);l l 	memset(&mp->timeout, 0, s =
of(ree_ndstimer_list));l-	mp->timeout.funct on = mv64340_et _rx_task_timer_wrapper;l-	mp->timeout. v;
i= (uock, flaloTY) dev;
+	mp->timeout.funct on = mv643xx_et _rx_task_timer_wrapper;
+	mp->timeout. v;
i= (uock, flaloTY)dev;
 
 	mp->rx_task_busyi= 0;
 	mp->rx_timer__lagi= 0;
 
+	/* Alloc 	i RX and TX skbarings */
+	mp->rx_skbi= kmalloc(s =
of(*mp->rx_skb) * mp->rx_ring_s =
,l+								GFP_KERNEL);
+	 	 (!mp->rx_skb) {
+		prd tk(KERN_ERR "%s: Cannot alloc 	i Rx skbaringthc, dev->name);
+		re,) { -ENOMEM;
+	}
+	mp->tx_skbi= kmalloc(s =
of(*mp->tx_skb) * mp->tx_ring_s =
,l+								GFP_KERNEL);
+	 	 (!mp->tx_skb) {
+		prd tk(KERN_ERR "%s: Cannot alloc 	i Tx skbaringthc, dev->name);
+		kfree(mp->rx_skb);
+		re,) { -ENOMEM;
+	}
+l 	/* Alloc 	i TX rings*/
 	mp->tx_ring_skbs = 0;
-	mp->tx_ring_s =
 = MV64340_TX_QUEUE_SIZE;l 	@ =
 = mp->tx_ring_s =
 *Ns =
of(ree_ndset _tx_desc);
 	mp->tx_desc_area_s =
 = s =
;l l-	/* Assumessalloc 	id ringsis 16 bytes allk, fla*/l-	mp->p_tx_desc_area = pci_alloc_coockstent(NULL, s =
, &mp->tx_desc_dma);
+	 	 (mp->tx_sram_s =
) {
+		mp->p_tx_desc_area = ioremap(mp->tx_sram_addr,l+							mp->tx_sram_s =
);
+		mp->tx_desc_dma = mp->tx_sram_addr;
+	} e) {
+		mp->p_tx_desc_area = dma_alloc_coherent(NULL, s =
,l+							&mp->tx_desc_dma,l+							GFP_KERNEL);
+
 	d	 (!mp->p_tx_desc_area) {
 		prd tk(KERN_ERR "%s: Cannot alloc 	i Tx Ring (s =
 %d bytes)thc,l-		+++++++dev->namea s =
);
+							dev->namea s =
);
+		kfree(mp->rx_skb);
+		kfree(mp->tx_skb);
 		re,) { -ENOMEM;
 	}
-	memset((v. I *) mp->p_tx_desc_area, 0, mp->tx_desc_area_s =
);
+	BUG_ON((u32) mp->p_tx_desc_area & 0xf);	/* check 16-byte alk, ment */
+	memset((v. I *)mp->p_tx_desc_area, 0, mp->tx_desc_area_s =
);
 l-	/* Dummy will b	sreplac	laupon real txs*/
 	et 	r_init_tx_desc_ring(mp);
 l 	/* Alloc 	i RX rings*/
-	/* Meantime RX Ring a_	 fixed -+but must be configurablesbysusera*/l-	mp->rx_ring_s =
 = MV64340_RX_QUEUE_SIZE;l 	mp->rx_ring_skbs = 0;
 	r =
 = mp->rx_ring_s =
 *Ns =
of(ree_ndset _rx_desc);
 	mp->rx_desc_area_s =
 = s =
;l l-	/* Assumessalloc 	id ringsis 16 bytes alk, fla*/l-l-	mp->p_rx_desc_area = pci_alloc_coockstent(NULL, s =
, &mp->rx_desc_dma);
+	 	 (mp->rx_sram_s =
) {
+		mp->p_rx_desc_area = ioremap(mp->rx_sram_addr,l+							mp->rx_sram_s =
);
+		mp->rx_desc_dma = mp->rx_sram_addr;
+	} e) {
+		mp->p_rx_desc_area = dma_alloc_coherent(NULL, s =
,l+							&mp->rx_desc_dma,l+							GFP_KERNEL);
 
 	d	 (!mp->p_rx_desc_area) {
 		prd tk(KERN_ERR "%s: Cannot alloc 	i Rx rings(s =
 %d bytes)thc,l-		+++++++dev->namea s =
);
+							dev->namea s =
);
 		prd tk(KERN_ERR "%s: Freeingspreviouslysalloc 	id TX queues...c,l-		+++++++dev->name);
-		pci_free_coockstent(0, mp->tx_desc_area_s =
,
-				    (v. I *) mp->p_tx_desc_area,
-				    mp->tx_desc_dma);
+							dev->name);
+		 	 (mp->rx_sram_s =
)
+			dounmap(mp->p_rx_desc_area);
+		e) {
+			dma_free_coherent(NULL, mp->tx_desc_area_s =
,
+					mp->p_tx_desc_area, mp->tx_desc_dma);
+		kfree(mp->rx_skb);
+		kfree(mp->tx_skb);
 		re,) { -ENOMEM;
 	}
-	memset(mp->p_rx_desc_area, 0, s =
);l+	memset((v. I *)mp->p_rx_desc_area, 0, s =
);l l-	i	 (!(et 	r_init_rx_desc_ring(mp, 0)))
-		panic("%s: E__or init al =ing RX Ringc, dev->name);
+	et 	r_init_rx_desc_ring(mp);l l-	mv64340_et _rx_task(dev);	/* Fill RX ringswithsrkb's */
+	mv643xx_et _rx_task(dev);	/* Fill RX ringswithsrkb's */
 
 	et _port_@
 rt(mp);
 l 	/* Inte__upt Coalescing */l l-#ifdef MV64340_COAL
+#ifdef MV643XX_COAL
 	mp->rx_int_coals=l-		et _port_@et_rx_coal(port_num, 133000000, MV64340_RX_COAL);
+		et _port_@et_rx_coal(port_num, 133000000, MV643XX_RX_COAL);
 #endif
 
 	mp->tx_int_coals=l-		et _port_@et_tx_coal (port_num, 133000000, MV64340_TX_COAL);  
+		et _port_@et_tx_coal(port_num, 133000000, MV643XX_TX_COAL);
 
-	/* Increase t 	sRx side buffer s =
 */l-l-	MV_WRITE (MV64340_ETH_PORT_SERIAL_CONTROL_REG(port_num), (0x5s<< 17) |
-			(MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG(port_num))
-					& 0xfff1ffff));l-l-	/* Check Link @
 	us on phy */l-	et _port_read_smi_reg(port_num, 1, &phy_reg_ v;
);
-	i	 (!(phy_reg_ v;
i& 0x20))
-		netif_stop_queue(dev);l-	e) {l-		netif_st rt_queue(dev);l+	netif_st rt_queue(dev);l l 	re,) { 0;
 }
 l-@
 	voiv. I mv64340_et _free_tx_rings(ree_ndsnet_devic	s*dev)l+@
 	voiv. I mv643xx_et _free_tx_rings(ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	uock, flad dsport_numa= mp->port_num;l 	uock, flad t curr;l 
 	/* S
op Tx Queues */l-	MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num),l-		+0x0000ff00);
+	mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num), 0x0000ff00);
 l-	/* Free TX ringss*/l 	/* Free outstanding skb's on TX ringss*/l-	for (curr = 0;
-	     (mp->tx_ring_skbs) && (curr < MV64340_TX_QUEUE_SIZE);
-	     curr++) {
+	for (curr = 0; mp->tx_ring_skbs && curr < mp->tx_ring_s =
; curr++) {
 		d	 (mp->tx_skb[curr]) {
 			dev_kfree_@kb(mp->tx_skb[curr]);l 			mp->tx_ring_skbs--;l 		}
 	}
-	i	 (mp->tx_ring_skbs != 0)
+	i	 (mp->tx_ring_skbs)
 		prd tk("%s: E__or onsTx descriptor free -+could not free %d"l-		+++++" descriptorsthc,+dev->nameal-		+++++mp->tx_ring_skbs);
-	pci_free_coockstent(0, mp->tx_desc_area_s =
,
-			    (v. I *) mp->p_tx_desc_area, mp->tx_desc_dma);
+				" descriptorsthc,+dev->namea+mp->tx_ring_skbs);
+
+	/* Free TX ring */
+	 	 (mp->tx_sram_s =
)
+		 ounmap(mp->p_tx_desc_area);
+	e) {
+		dma_free_coherent(NULL, mp->tx_desc_area_s =
,
+				mp->p_tx_desc_area, mp->tx_desc_dma);
 }
 l-@
 	voiv. I mv64340_et _free_rx_rings(ree_ndsnet_devic	s*dev)l+@
 	voiv. I mv643xx_et _free_rx_rings(ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	uock, flad dsport_numa= mp->port_num;l 	d t curr;l 
 	/* S
op RX Queues */l-	MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num),l-		+0x0000ff00);
+	mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num),+0x0000ff00);
 l-	/* Free RX ringss*/l 	/* Free prealloc 	id skb's on RX ringss*/l-	for (curr = 0;
-		mp->rx_ring_skbs && (curr < MV64340_RX_QUEUE_SIZE);
-		curr++) {
+	for (curr = 0; mp->rx_ring_skbs && curr < mp->rx_ring_s =
; curr++) {
 		d	 (mp->rx_skb[curr]) {
 			dev_kfree_@kb(mp->rx_skb[curr]);l 			mp->rx_ring_skbs--;l 		}
 	}
 
-	i	 (mp->rx_ring_skbs != 0)
+	i	 (mp->rx_ring_skbs)
 		prd tk(KERN_ERR
-		+++++++"%s: E__or in freeing Rx Ring. %d skb's still"
-		+++++++" stuck in RX Ring - k, oring themthc,+dev->nameal-		+++++  mp->rx_ring_skbs);
-	pci_free_coockstent(0, mp->rx_desc_area_s =
,
-			    (v. I *) mp->p_rx_desc_area,
-			++  mp->rx_desc_dma);
+			"%s: E__or in freeing Rx Ring. %d skb's still"
+			" stuck in RX Ring - k, oring themthc,+dev->nameal+			mp->rx_ring_skbs);
+	/* Free RX ring */
+	 	 (mp->rx_sram_s =
)
+		 ounmap(mp->p_rx_desc_area);
+	e) {
+		dma_free_coherent(NULL, mp->rx_desc_area_s =
,
+				mp->p_rx_desc_area, mp->rx_desc_dma);
 }
 l /*
- *+mv64340_et _s
op
+ *+mv643xx_et _s
op
  *
- *+This funct on is usedaw 	n closing theNnetwork devic	.+
- *+It up v;es t 	shardware, 
+ *+This funct on is usedaw 	n closing theNnetwork devic	.
+ *+It up v;es t 	shardware,
  *+release all memoryst at holds buffers and descriptors and release t 	sIRQ.
- *+Inputs: a pointe_ to t 	sdevic	sree_ndure
- *+Outputs: zero if successa, nonzero kf fails
+ *+Inputs:	a pointe_ to t 	sdevic	sree_ndure
+ *+Outputs:	zero if successa, nonzero kf fails
  */l l-/* Helper funct on for mv64340_et _s
op */
+/* Helper funct on for mv643xx_et _s
op */
 l-@
 	void dsmv64340_et _real_s
op(ree_ndsnet_devic	s*dev)l+@
 	void dsmv643xx_et _real_s
op(ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	uock, flad dsport_numa= mp->port_num;l l+	netif_carrier_off(dev);l 	netif_stop_queue(dev);l l-	mv64340_et _free_tx_rings(dev);l-	mv64340_et _free_rx_rings(dev);l+	mv643xx_et _free_tx_rings(dev);l+	mv643xx_et _free_rx_rings(dev);l 
 	et _port_reset(mp->port_num);
 
 	/* Disableset 	rnet portsinte__upts */l-	MV_WRITE(MV64340_ETH_INTERRUPT_CAUSE_REG(port_num)a 0);l-	MV_WRITE(MV64340_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0);
+	mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num)a 0);l+	mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0);
 l 	/* Mask RX buffer and TX endsinte__upt */
-	MV_WRITE(MV64340_ETH_INTERRUPT_MASK_REG(port_num), 0);l+	mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num), 0);l l 	/* Mask phy and link @
 	us chang	s inte__upts */l-	MV_WRITE(MV64340_ETH_INTERRUPT_EXTEND_MASK_REG(port_num), 0);l+	mv_write(MV643XX_ETH_INTERRUPT_EXTEND_MASK_REG(port_num), 0);l l 	re,) { 0;
 }
 l-@
 	void dsmv64340_et _s
op(ree_ndsnet_devic	s*dev)l+@
 	void dsmv643xx_et _s
op(ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 
 	spin_lock_drq(&mp->lock);
 
-	mv64340_et _real_s
op(dev);l+	mv643xx_et _real_s
op(dev);l 
 	free_drq(dev->irqa	dev);l 	rpin_unlock_drq(&mp->lock);
@@ -1060,59 +1026,64 @@
 	re,) { 0;
 }
 l-#ifdef MV64340_NAPI
-@
 	voiv. I mv64340_tx(ree_ndsnet_devic	s*dev)l+#ifdef MV643XX_NAPI
+@
 	voiv. I mv643xx_tx(ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l-++++++++@
e_ndspkt_info pkt_info;
+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l+	@
e_ndspkt_info pkt_info;
 
 	while (et _tx_r6,) {_desc(mp, &pkt_info) == ETH_OK) {
 		i	 (pkt_info.re,) {_info) {l-			dev_kfree_@kb_irq((ree_ndssk_buff *)
-                                                  pkt_info.re,) {_info);l-			i	 (skb_shinfo(pkt_info.re,) {_info)->nr_frags) 
-                                 pci_unmap_page(NULL, pkt_info.buf_ptr,
-                                             pkt_info.byte_cnt,
-                                             PCI_DMA_TODEVICE);
-l-                         i	 (mp->tx_ring_skbs != 1)l-                                  mp->tx_ring_skbs--;l-                } e) { l-                       pci_unmap_page(NULL, pkt_info.buf_ptr, pkt_info.byte_cnt,
-                                      PCI_DMA_TODEVICE);
+			i	 (skb_shinfo(pkt_info.re,) {_info)->nr_frags)
+				dma_unmap_page(NULL, pkt_info.buf_ptr,
+						pkt_info.byte_cnt,
+						DMA_TO_DEVICE);
+			e) {l+				dma_unmap_singl	(NULL, pkt_info.buf_ptr,
+						pkt_info.byte_cnt,
+						DMA_TO_DEVICE);
+
+			dev_kfree_@kb_irq(pkt_info.re,) {_info);l+
+			d	 (mp->tx_ring_skbs)
+				mp->tx_ring_skbs--;l+		} e) {
+			dma_unmap_page(NULL, pkt_info.buf_ptr,
+					pkt_info.byte_cnt, DMA_TO_DEVICE);
 	}
 l 	 	 (netif_queue_s
opped(dev) &&
-            MV64340_TX_QUEUE_SIZE > mp->tx_ring_skbs + 1)
-                       netif_wake_queue(dev);l+			mp->tx_ring_s =
 > mp->tx_ring_skbs + MAX_DESCS_PER_SKB)l+		netif_wake_queue(dev);l }
 l /*
- *+mv64340_poll
+ *+mv643xx_poll
  *
  *+This funct on is usedain case of NAPI
  */l-@
 	void dsmv64340_poll(ree_ndsnet_devic	s*deva+d t *budget)
+@
 	void dsmv643xx_poll(ree_ndsnet_devic	s*deva+d t *budget)
 {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l-	d t	don
 = 1, orig_budget, work_don
;
+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l+	d tNdon
 = 1, orig_budget, work_don
;
 	uock, flad dsport_numa= mp->port_num;l 	uock, flaloTY _lags;
 
-#ifdef MV64340_TX_FAST_REFILLl+#ifdef MV643XX_TX_FAST_REFILLl 	 	 (++mp->tx_clean_threshold > 5) {
 		spin_lock_drqsaze(&mp->lock, _lags);l-		mv64340_tx(dev);l+		mv643xx_tx(dev);l 		mp->tx_clean_threshold = 0;
 		rpin_unlock_drqrestore(&mp->lock, _lags);l 	}
 #endif
 
-	 	 ((u32)(MV_READ(MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_0(port_num)))                                      != (u32)mp->rx_used_desc_q) {l+	 	 ((mv_read(MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_0(port_num)))
+						!= (u32) mp->rx_used_desc_q) {l 		orig_budget = *budget;l 		d	 (orig_budget >+dev->quota)
 			orig_budget = dev->quota;l-		work_don
 = mv64340_et _rece ve_queue(deva+0, orig_budget);l+		work_don
 = mv643xx_et _rece ve_queue(deva+orig_budget);l 		mp->rx_task.func(dev);l 		*budget -= work_don
;
 		dev->quota -= work_don
;
@@ -1123,12 +1094,12 @@
 	d	 (don
) {
 		spin_lock_drqsaze(&mp->lock, _lags);l 		__netif_rx_complete(dev);l-		MV_WRITE(MV64340_ETH_INTERRUPT_CAUSE_REG(port_num)a0);l-                MV_WRITE(MV64340_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num),0);l-		MV_WRITE(MV64340_ETH_INTERRUPT_MASK_REG(port_num), l+		mv_write(MV643XX_ETH_INTERRUPT_CAUSE_REG(port_num)a+0);
+		mv_write(MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port_num), 0);
+		mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num),l 						INT_CAUSE_UNMASK_ALL);l-		MV_WRITE(MV64340_ETH_INTERRUPT_EXTEND_MASK_REG(port_num),
-				+++++++++++++++++INT_CAUSE_UNMASK_ALL_EXT);l+		mv_write(MV643XX_ETH_INTERRUPT_EXTEND_MASK_REG(port_num),
+						INT_CAUSE_UNMASK_ALL_EXT);l 		rpin_unlock_drqrestore(&mp->lock, _lags);l 	}
 
@@ -1137,19 +1108,19 @@
 #endif
 
 /*
- *+mv64340_et _s
 rt_xmit
+ *+mv643xx_et _s
 rt_xmit
  *
- *+This funct on is queues a packetfin t 	sTx descriptor for 
+ *+This funct on is queues a packetfin t 	sTx descriptor for
  *+requirflaport.
  *
- *+Inputs: skba-+a pointe_ to socketfbuffer
- *+++++++++dev -+a pointe_ to t 	srequirflaport
+ *+Inputs:	skba-+a pointe_ to socketfbuffer
+ *		dev -+a pointe_ to t 	srequirflaport
  *
- *+Outputs: zero upon success
+ *+Outputs:	zero upon success
  */l-@
 	void dsmv64340_et _s
 rt_xmit(ree_ndssk_buff *skba ree_ndsnet_devic	s*dev)l+@
 	void dsmv643xx_et _s
 rt_xmit(ree_ndssk_buff *skba ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 	ree_ndsnet_devic	_s	ats *s	ats = &mp->s	ats;l 	ETH_FUNC_RET_STATUS @
 	us;l 	uock, flaloTY _lags;
@@ -1157,119 +1128,195 @@
 
 	 	 (netif_queue_s
opped(dev)) {
 		prd tk(KERN_ERR
-		+++++++"%s: Triid sending packetfw 	n d te_fac	sis s
oppedthc,l-		+++++++dev->name);
+			"%s: Triid sending packetfw 	n d te_fac	sis s
oppedthc,l+			dev->name);
 		re,) { 1;
 	}
 l 	/* This is ashardse__or,alog it. */l-	 	 ((MV64340_TX_QUEUE_SIZE -+mp->tx_ring_skbs) <=
-	    (skb_shinfo(skb)->nr_frags + 1)) {l+	 	 ((mp->tx_ring_s =
 -+mp->tx_ring_skbs) <=
+					(skb_shinfo(skb)->nr_frags + 1)) {l 		netif_stop_queue(dev);l 		prd tk(KERN_ERR
-		+++++++"%s: Bug insmv64340_et  -+Trying to teansmitfw 	n"
-		+++++++" queue full !thc, dev->name);
+			"%s: Bug insmv643xx_et  -+Trying to teansmitfw 	n"
+			" queue full !thc, dev->name);
 		re,) { 1;
 	}
 l 	/* Paean. I check -sthis shouldn't happen */
 	i	 (skb == NULL) {
 		s	ats->tx_dropped++;
+		prd tk(KERN_ERR "mv64320_et  paean. I check failedthc);
 		re,) { 1;
 	}
 l 	spin_lock_drqsaze(&mp->lock, _lags);l l 	/* Up v;e packetfinfo  v;
sree_ndure -- DMA owned, firstslasts*/
-#ifdef MV64340_CHECKSUM_OFFLOAD_TX
-	i	 (!skb_shinfo(skb)->nr_frags || (skb_shinfo(skb)->nr_frags > 3)) {l-#endif
-		pkt_info.cmd_sts = ETH_TX_ENABLE_INTERRUPT |
-	++++	++++++++++++++++++ ETH_TX_FIRST_DESC | ETH_TX_LAST_DESC;
+#ifdef MV643XX_CHECKSUM_OFFLOAD_TX
+	i	 (!skb_shinfo(skb)->nr_frags) {l+linear:
+		 	 (skb->ip_summed != CHECKSUM_HW) {
+			pkt_info.cmd_sts = ETH_TX_ENABLE_INTERRUPT |
+					ETH_TX_FIRST_DESC | ETH_TX_LAST_DESC;
+			pkt_info.l4i_chki= 0;
+		} e) { {l+			u32Nipheader = skb->nh.iph->ihls<< 11;l l+			pkt_info.cmd_sts = ETH_TX_ENABLE_INTERRUPT |
+					ETH_TX_FIRST_DESC | ETH_TX_LAST_DESC |
+					ETH_GEN_TCP_UDP_CHECKSUM |
+					ETH_GEN_IP_V_4_CHECKSUM |Nipheader;
+			/* CPU+already calculated pseudo header checksum. */
+			 	 (skb->nh.iph->protocol == IPPROTO_UDP) {
+				pkt_info.cmd_sts |= ETH_UDP_FRAME;
+				pkt_info.l4i_chki= skb->h.uh->check;
+			} e) {  	 (skb->nh.iph->protocol == IPPROTO_TCP)
+				pkt_info.l4i_chki= skb->h.th->check;
+			e) { {l+				prd tk(KERN_ERR
+					"%s: chksum proto != TCP or UDPthc,l+					dev->name);
+				rpin_unlock_drqrestore(&mp->lock, _lags);l+				re,) { 1;
+			}
+		}l 		pkt_info.byte_cnti= skb->len;
-		pkt_info.buf_ptr = pci_map_singl	(0, skb-> v;
, skb->len,
-		+++++++++                         PCI_DMA_TODEVICE);
-l-
+		pkt_info.buf_ptr = dma_map_singl	(NULL, skb-> v;
, skb->len,
+							DMA_TO_DEVICE);
 		pkt_info.re,) {_infoi= skb;
+		mp->tx_ring_skbs++;
 		s	atus = et _port_@end(mp, &pkt_info);l 		d	 ((s	atus == ETH_ERROR) || (s	atus == ETH_QUEUE_FULL))
 			prd tk(KERN_ERR "%s: E__or onsteansmitting packetthc,l-				+++++++dev->name);
-		mp->tx_ring_skbs++;
-#ifdef MV64340_CHECKSUM_OFFLOAD_TX
+								dev->name);
+		s	ats->tx_bytes += pkt_info.byte_cnt;
 	} e) { {l-		uock, flad ds+++frag;
-		u32		dpheader;
+		uock, flad dsfrag;
+		u32Nipheader;
 
-                /* firstsfragfw ichsis skb header */
-                pkt_info.byte_cnti= skb_headlen(rkb);
-                pkt_info.buf_ptr = pci_map_singl	(0, skb-> v;
,
-                                        skb_headlen(rkb), PCI_DMA_TODEVICE);
-                pkt_info.re,) {_info = 0;
-                ipheader = skb->nh.iph->ihls<< 11;l-                pkt_info.cmd_sts = ETH_TX_FIRST_DESC | 
-					ETH_GEN_TCP_UDP_CHECKSUM |
-					ETH_GEN_IP_V_4_CHECKSUM |
-                                        ipheader;
-		/* CPU+already calculated pseudo header checksum. So, use it */
-                pkt_info.l4i_chki= skb->h.th->check;
-                s	atus = et _port_@end(mp, &pkt_info);l+		/* Sinc	 hardware can't handle unalk, flafragments smaller
+		+* than 9 bytes,  	 w	 find any, w	slinear =
 theNskb
+		+* and s
 rtsagain.  W 	n I'veNse	n dt,  t's always been
+		+* the firstsfragf(probably ne+rst 	send of t 	spage),
+		+* but w	scheck all frags to beNsaf	.
+		+*/l+		for (fragf= 0; fragf< skb_shinfo(skb)->nr_frags; frag++) {
+			skb_frag_t *fragp;l+
+			fragp = &skb_shinfo(skb)->frags[frag];
+			i	 (fragp->s =
 <= 8 && fragp->page_offset & 0x7) {l+				skb_linear =
(skba GFP_ATOMIC);l+				prd tk(KERN_DEBUG "%s: unalk, flatinyafragment"
+						"%d of %d, fixedthc,l+						dev->namea+frag,l+						skb_shinfo(skb)->nr_frags);l+				goto linear;
+			}
+		}l+l+		/* firstsfragfw ichsis skb header */
+		pkt_info.byte_cnti= skb_headlen(rkb);
+		pkt_info.buf_ptr = dma_map_singl	(NULL, skb-> v;
,
+							skb_headlen(rkb),
+							DMA_TO_DEVICE);
+		pkt_info.l4i_chki= 0;
+		pkt_info.re,) {_info = 0;
+		pkt_info.cmd_sts = ETH_TX_FIRST_DESC;l+
+		 	 (skb->ip_summed == CHECKSUM_HW) {
+			ipheader = skb->nh.iph->ihls<< 11;l+			pkt_info.cmd_sts |= ETH_GEN_TCP_UDP_CHECKSUM |
+					ETH_GEN_IP_V_4_CHECKSUM |Nipheader;
+			/* CPU+already calculated pseudo header checksum. */
+			 	 (skb->nh.iph->protocol == IPPROTO_UDP) {
+				pkt_info.cmd_sts |= ETH_UDP_FRAME;
+				pkt_info.l4i_chki= skb->h.uh->check;
+			} e) {  	 (skb->nh.iph->protocol == IPPROTO_TCP)
+				pkt_info.l4i_chki= skb->h.th->check;
+			e) { {l+				prd tk(KERN_ERR
+					"%s: chksum proto != TCP or UDPthc,l+					dev->name);
+				rpin_unlock_drqrestore(&mp->lock, _lags);l+				re,) { 1;
+			}
+		}l+
+		s	atus = et _port_@end(mp, &pkt_info);l 		d	 (s	atus != ETH_OK) {
-	++++++++++++++++d	 ((s	atus == ETH_ERROR))
-        	++++++++++++++++prd tk(KERN_ERR "%s: E__or onsteansmitting packetthc,+dev->name);
-	++++++++++++++++d	 (s	atus == ETH_QUEUE_FULL)
-        	++++++++++++++++prd tk("E__or onsQueue Full thc);
-                	d	 (s	atus == ETH_QUEUE_LAST_RESOURCE)
-                        	prd tk("Tx resourc	se__or thc);
+			 	 ((s	atus == ETH_ERROR))
+				prd tk(KERN_ERR
+					"%s: E__or onsteansmitting packetthc,l+					dev->name);
+			d	 (s	atus == ETH_QUEUE_FULL)
+				prd tk("E__or onsQueue Full thc);
+			d	 (s	atus == ETH_QUEUE_LAST_RESOURCE)
+				prd tk("Tx resourc	se__or thc);
 		}
+		s	ats->tx_bytes += pkt_info.byte_cnt;
+l+		/* Check for t 	sremaining frags */l+		for (fragf= 0; fragf< skb_shinfo(skb)->nr_frags; frag++) {
+			skb_frag_t *this_fragf= &skb_shinfo(skb)->frags[frag];
+			pkt_info.l4i_chki= 0x0000;
+			pkt_info.cmd_sts = 0x00000000;
+
+			/* LastsFragfenables inte__upt and frees theNskb */
+			 	 (fragf== (skb_shinfo(skb)->nr_frags - 1)) {l+				pkt_info.cmd_sts |= ETH_TX_ENABLE_INTERRUPT |
+							ETH_TX_LAST_DESC;
+				pkt_info.re,) {_infoi= skb;
+				mp->tx_ring_skbs++;
+			} e) { {
+				pkt_info.re,) {_infoi= 0;
+			}
+			pkt_info.l4i_chki= 0;
+			pkt_info.byte_cnti= this_frag->s =
;
 
-                /* Check for t 	sremaining frags */l-                for (fragf= 0; fragf< skb_shinfo(skb)->nr_frags; frag++) {
-                        skb_frag_t *this_fragf= &skb_shinfo(skb)->frags[frag];
-                        pkt_info.l4i_chki= 0x0000;
-                        pkt_info.cmd_sts = 0x00000000;
-l-                        /* LastsFragfenables inte__upt and frees theNskb */
-                        i	 (fragf== (skb_shinfo(skb)->nr_frags - 1)) {l-                                pkt_info.cmd_sts |= ETH_TX_ENABLE_INTERRUPT |
-                                                  +++++ ETH_TX_LAST_DESC;
-                                pkt_info.re,) {_infoi= skb;
-                                mp->tx_ring_skbs++;
-                        }
-                        e) { {l-                                pkt_info.re,) {_infoi= 0;
-                        }
-                        pkt_info.byte_cnti= this_frag->s =
;
-                        i	 (this_frag->s =
 < 8)l-                                prd tk("%d : thc,+skb_shinfo(skb)->nr_frags);l-
-                        pkt_info.buf_ptr = pci_map_page(NULL, this_frag->page,
-                                        this_frag->page_offset,
-                                        this_frag->s =
, PCI_DMA_TODEVICE);
+			pkt_info.buf_ptr = dma_map_page(NULL, this_frag->page,
+							this_frag->page_offset,
+							this_frag->s =
,l+							DMA_TO_DEVICE);
 
-                        s	atus = et _port_@end(mp, &pkt_info);l+			s	atus = et _port_@end(mp, &pkt_info);l 
 			d	 (s	atus != ETH_OK) {
-	++++++++++++++++++++++++d	 ((s	atus == ETH_ERROR))
-        	++++++++++++++++++++++++prd tk(KERN_ERR "%s: E__or onsteansmitting packetthc,+dev->name);
+				 	 ((s	atus == ETH_ERROR))
+					prd tk(KERN_ERR "%s: E__or ons"
+							"teansmitting packetthc,l+							dev->name);
 
-       		+++++++++        d	 (s	atus == ETH_QUEUE_LAST_RESOURCE)
-                	++++++++++++++++prd tk("Tx resourc	se__or thc);
+				d	 (s	atus == ETH_QUEUE_LAST_RESOURCE)
+					prd tk("Tx resourc	se__or thc);
 
-                        	d	 (s	atus == ETH_QUEUE_FULL)
-                                	prd tk("Queue is full thc);
+				d	 (s	atus == ETH_QUEUE_FULL)
+					prd tk("Queue is full thc);
 			}
-                }
-        }l+			s	ats->tx_bytes += pkt_info.byte_cnt;
+		}
+	}
+#e) {
+	pkt_info.cmd_sts = ETH_TX_ENABLE_INTERRUPT | ETH_TX_FIRST_DESC |
+							ETH_TX_LAST_DESC;
+	pkt_info.l4i_chki= 0;
+	pkt_info.byte_cnti= skb->len;
+	pkt_info.buf_ptr = dma_map_singl	(NULL, skb-> v;
, skb->len,
+								DMA_TO_DEVICE);
+	pkt_info.re,) {_infoi= skb;
+	mp->tx_ring_skbs++;
+	s	atus = et _port_@end(mp, &pkt_info);l+	d	 ((s	atus == ETH_ERROR) || (s	atus == ETH_QUEUE_FULL))
+		prd tk(KERN_ERR "%s: E__or onsteansmitting packetthc,l+								dev->name);
+	s	ats->tx_bytes += pkt_info.byte_cnt;
 #endif
 
 	/* Check d	 TX queue can handle anot 	r skb. If not, then
 	 *Ns gnal hig 	r layers to s
op requesting TX
 	 */l-	 	 (MV64340_TX_QUEUE_SIZE <= (mp->tx_ring_skbs + 1))
-		/* 
+	i	 (mp->tx_ring_s =
 <= (mp->tx_ring_skbs + MAX_DESCS_PER_SKB))l+		/*
 		 * S
op getting skb's from upper layers.
 		 * Getting skb's from upper layers will b	senabledsagainaafter
 		 * packets a_	 released.
@@ -1277,7 +1324,6 @@
 		netif_stop_queue(dev);l l 	/* Up v;e @
 	vstics and s
 rtsof teansmittionstime */l-	s	ats->tx_bytes += skb->len;
 	s	ats->tx_packets++;
 	dev->teans_s
 rt = jiffies;
 
@@ -1287,214 +1333,302 @@
 }
 l /*
- *+mv64340_et _get_s	ats
+ *+mv643xx_et _get_s	ats
  *
  *+Re,) {s+a pointe_ to t 	sd te_fac	s@
 	vstics.
  *
- *+Inputs: dev -+a pointe_ to t 	srequirflad te_fac	
+ *+Inputs:	dev -+a pointe_ to t 	srequirflad te_fac	
  *
- *+Outputs: a pointe_ to t 	sd te_fac	's st 	vstics
+ *+Outputs:	a pointe_ to t 	sd te_fac	's st 	vstics
  */
 l-@
 	voiree_ndsnet_devic	_s	ats *mv64340_et _get_s	ats(ree_ndsnet_devic	s*dev)l+@
 	voiree_ndsnet_devic	_s	ats *mv643xx_et _get_s	ats(ree_ndsnet_devic	s*dev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l 
 	re,) { &mp->s	ats;l }
 l /*/
- *+mv64340_et _init
- *								       
- *+Firstsfunct on callflaafter regkstering theNnetwork devic	.+
- *+It's purpose is to init al =
 theNdevic	sas anset 	rnet devic	,+
- *+fill theNsee_ndure t at was given in regkstrat on withspointe_s
- *+to funct ons, and setting t 	 MAC address of t 	sd te_fac	
+ *+mv643xx_et _probe
  *
- *+Inputs: number of portsto init al =

- *+Outputs: -ENONMEM kf failfla, 0 if success
- */l-@
 	voiree_ndsnet_devic	 *mv64340_et _init(d dsport_num)
-{l-	@
e_ndsmv64340_priv 	i *mp;
+ *+Firstsfunct on callflaafter regkstering theNnetwork devic	.
+ *+It's purpose is to init al =
 theNdevic	sas anset 	rnet devic	,
+ *+fill theNet 	rnet devic	Nsee_ndure withspointe_s *+to funct ons,
+ *+and set t 	 MAC address of t 	sd te_fac	
+ *
+ *+Inputs:	s
e_ndsdevic	 *
+ *+Outputs:	-ENOMEM kf failfla, 0 if success
+ */
+@
 	void dsmv643xx_et _probe(s
e_ndsdevic	 *ddev)l+{l+	@
e_ndsplatform_devic	 *pdev =+to_platform_devic	(ddev);l+	@
e_ndsmv643xx_et _platform_dv;
s*pd;l+	d tNport_numa= pdev->id;l+	@
e_ndsmv643xx_priv 	i *mp;l 	ree_ndsnet_devic	s*dev;l+	u8s*p;l+	@
e_ndsresourc	s*res;
 	d tNerr;l 
-	dev =+alloc_et 	rdev(s =
of(ree_ndsmv64340_priv 	i));l+	dev =+alloc_et 	rdev(s =
of(ree_ndsmv643xx_priv 	i));
 	i	 (!dev)l-		re,) { NULL;
+		re,) { -ENOMEM;
+l+	dev_@et_drvdv;
(ddeva dev);l l 	mp = netdev_priv(dev);l 
-	dev->irq = ETH_PORT0_IRQ_NUM + port_num;l+	ress=splatform_get_resourc	(pdeva IORESOURCE_IRQ, 0);
+	BUG_ON(!res);l+	dev->irq = res->s	art;l 
-	dev->open = mv64340_et _open;
-	dev->s
op =smv64340_et _s
op;
-	dev->hard_s
 rt_xmit =smv64340_et _s
 rt_xmit;
-	dev->get_s	ats =smv64340_et _get_s	ats;
-	dev->set_mac_address =smv64340_et _set_mac_address;
-	dev->set_mul	voast_list =smv64340_et _set_rx_mode;
+	mp->port_numa= port_num;l+l+	dev->open = mv643xx_et _open;l+	dev->s
op =smv643xx_et _s
op;l+	dev->hard_s
 rt_xmit =smv643xx_et _s
 rt_xmit;l+	dev->get_s	ats =smv643xx_et _get_s	ats;l+	dev->set_mac_address =smv643xx_et _set_mac_address;
+	dev->set_mul	voast_list =smv643xx_et _set_rx_mode;
 l 	/* No need to Tx Timeout */l-	dev->tx_timeout =smv64340_et _tx_timeout;l-#ifdef MV64340_NAPI
- +++++++dev->poll =smv64340_poll;
- +++++++dev->weig t =s64;
+	dev->tx_timeout =smv643xx_et _tx_timeout;l+#ifdef MV643XX_NAPI
+	dev->poll =smv643xx_poll;
+	dev->weig t =s64;
 #endif
 
 	dev->watchdog_timeo =s2 *+HZ;l-	dev->tx_queue_len = MV64340_TX_QUEUE_SIZE;l+	dev->tx_queue_len = mp->tx_ring_s =
;l 	dev->base_addr = 0;l-	dev->chang	_mtu =smv64340_et _chang	_mtu;l+	dev->chang	_mtu =smv643xx_et _chang	_mtu;l+	SET_ETHTOOL_OPS(deva+&mv643xx_et tool_ops);l l-#ifdef MV64340_CHECKSUM_OFFLOAD_TX
+#ifdef MV643XX_CHECKSUM_OFFLOAD_TX
 #ifdef MAX_SKB_FRAGSl-#ifndef CONFIG_JAGUAR_DMALOW
- +++++++/*
-         * Zero copy can only work  	 w	 use Discovery IIsmemory. Else, w	swill
-         * haze to map t 	sbuffers to ISA memorysw ichsis only 16 MB
-         */
- +++++++dev->feadures =sNETIF_F_SG |sNETIF_F_IP_CSUM |NNETIF_F_HW_CSUM;l-#endif
+	/*
+	 * Zero copy can only work  	 w	 use Discovery IIsmemory. Else, w	swill
+	 * haze to map t 	sbuffers to ISA memorysw ichsis only 16 MB
+	+*/l+	dev->feadures =sNETIF_F_SG |sNETIF_F_IP_CSUM |NNETIF_F_HW_CSUM;l #endif
 #endif
 
-	mp->port_numa= port_num;l-
 	/* Configur
 theNtimeout task */
- +++++++INIT_WORK(&mp->tx_timeout_taska
-                  (v. I (*)(v. I *))mv64340_et _tx_timeout_taska dev);l+	INIT_WORK(&mp->tx_timeout_taska
+			(v. I (*)(v. I *))mv643xx_et _tx_timeout_taska dev);l l 	spin_lock_dnit(&mp->lock);
 
-	/* set MAC addresses */l-	memcpy(dev->dev_addr, prom_mac_addr_base, 6);l-	dev->dev_addr[5] += port_num;l+	/* set defaul	 config values */l+	et _port_uc_addr_get(deva dev->dev_addr);
+	mp->port_config = MV643XX_ETH_PORT_CONFIG_DEFAULT_VALUE;
+	mp->port_config_extend = MV643XX_ETH_PORT_CONFIG_EXTEND_DEFAULT_VALUE;
+	mp->port_sdma_config = MV643XX_ETH_PORT_SDMA_CONFIG_DEFAULT_VALUE;
+	mp->port_serial_control = MV643XX_ETH_PORT_SERIAL_CONTROL_DEFAULT_VALUE;
+	mp->rx_ring_s =
 = MV643XX_ETH_PORT_DEFAULT_RECEIVE_QUEUE_SIZE;l+	mp->tx_ring_s =
 = MV643XX_ETH_PORT_DEFAULT_TRANSMIT_QUEUE_SIZE;l+
+	pda= pdev->dev.platform_dv;
;l+	d	 (pd) {l+		d	 (pd->mac_addr != NULL)
+			memcpy(dev->dev_addr, pd->mac_addr, 6);l+l+		d	 (pd->phy_addr || pd->force_phy_addr)
+			et 	rnet_phy_set(port_num, pd->phy_addr);l+l+		d	 (pd->port_config || pd->force_port_config)l+			mp->port_config = pd->port_config;l+l+		d	 (pd->port_config_extend || pd->force_port_config_extend)l+			mp->port_config_extend = pd->port_config_extend;l+l+		d	 (pd->port_sdma_config || pd->force_port_sdma_config)l+			mp->port_sdma_config = pd->port_sdma_config;l+l+		d	 (pd->port_serial_control || pd->force_port_serial_control)l+			mp->port_serial_control = pd->port_serial_control;l+l+		d	 (pd->rx_queue_s =
)
+			mp->rx_ring_s =
 = pd->rx_queue_s =
;l+l+		d	 (pd->tx_queue_s =
)
+			mp->tx_ring_s =
 = pd->tx_queue_s =
;l+l+		d	 (pd->tx_sram_s =
) {
+			mp->tx_sram_s =
 = pd->tx_sram_s =
;
+			mp->tx_sram_addr = pd->tx_sram_addr;
+		}l+
+		d	 (pd->rx_sram_s =
) {
+			mp->rx_sram_s =
 = pd->rx_sram_s =
;
+			mp->rx_sram_addr = pd->rx_sram_addr;
+		}l+	}l+
+	err = et 	rnet_phy_detect(port_num);l+	d	 (err) {
+		pr_debug("MV643xxset 	rnet ports%d:s"
+					"No PHY detectflaat addrs%dthc,l+					port_num, et 	rnet_phy_get(port_num));
+		re,) { err;l+	}
 l 	err = regkster_netdev(dev);l 	d	 (err)l-		goto out_free_dev;l+		goto out;
 
-	prd tk(KERN_NOTICE "%s: ports%d withsMAC address %02x:%02x:%02x:%02x:%02x:%02xthc,l-		dev->namea+port_num,l-		dev->dev_addr[0]a dev->dev_addr[1]a dev->dev_addr[2],l-		dev->dev_addr[3]a dev->dev_addr[4]a dev->dev_addr[5]);
+	p = dev->dev_addr;
+	prd tk(KERN_NOTICEl+		"%s: ports%d withsMAC address %02x:%02x:%02x:%02x:%02x:%02xthc,l+		dev->namea+port_num, p[0]a p[1]a p[2], p[3], p[4], p[5]);
 
 	 	 (dev->feadures &sNETIF_F_SG)
-		prd tk("Scatter Gat 	r Enableds c);
+		prd tk(KERN_NOTICE "%s: Scatter Gat 	r Enabledthc, dev->name);
 
 	 	 (dev->feadures &sNETIF_F_IP_CSUM)
-		prd tk("TX TCP/IP Checksumming Supporteds thc);
+		prd tk(KERN_NOTICE "%s: TX TCP/IP Checksumming Supportedthc,l+								dev->name);
 
-	prd tk("RX TCP/UDP Checksum Offload ON, thc);
-	prd tk("TX and RX Inte__upt Coalescing ON thc);
+#ifdef MV643XX_CHECKSUM_OFFLOAD_TX
+	prd tk(KERN_NOTICE "%s: RX TCP/UDP Checksum Offload ON thc,+dev->name);
+#endif
 
-#ifdef MV64340_NAPI
-	prd tk("RX NAPI Enabledsthc);
+#ifdef MV643XX_COAL
+	prd tk(KERN_NOTICE "%s: TX and RX Inte__upt Coalescing ON thc,l+								dev->name);
 #endif
 
-	re,) { dev;l+#ifdef MV643XX_NAPI
+	prd tk(KERN_NOTICE "%s: RX NAPI Enabledsthc,+dev->name);
+#endif
 
-out_free_dev:l+	re,) { 0;
+
+out:
 	free_netdev(dev);l 
-	re,) { NULL;
+	re,) { err;l }
 l-@
 	voiv. I mv64340_et _remove(ree_ndsnet_devic	s*dev)l+@
 	void dsmv643xx_et _remove(ree_ndsdevic	 *ddev)l {l-	@
e_ndsmv64340_priv 	i *mp = netdev_priv(dev);l+	@
e_ndsnet_devic	s*dev = dev_get_drvdv;
(ddev);
 
 	unregkster_netdev(dev);l 	flush_scheduled_work();
+
 	free_netdev(dev);l+	dev_@et_drvdv;
(ddeva NULL);l+	re,) { 0;
 }
 l-@
 	voiree_ndsnet_devic	 *mv64340_dev0;l-@
 	voiree_ndsnet_devic	 *mv64340_dev1;l-@
 	voiree_ndsnet_devic	 *mv64340_dev2;l+@
 	void dsmv643xx_et _shared_probe(s
e_ndsdevic	 *ddev)l+{l+	@
e_ndsplatform_devic	 *pdev =+to_platform_devic	(ddev);l+	@
e_ndsresourc	s*res;
+
+	prd tk(KERN_NOTICE "MV-643xxs10/100/1000 Et 	rnet Driverthc);
+l+	ress=splatform_get_resourc	(pdeva IORESOURCE_MEM, 0);
+	 	 (ress== NULL)
+		re,) { -ENODEV;
+l+	mv643xx_et _shared_base = ioremap(res->s	art,l+						MV643XX_ETH_SHARED_REGS_SIZE);
+	i	 (mv643xx_et _shared_base == NULL)
+		re,) { -ENOMEM;
+l+	re,) { 0;
+
+}l+
+@
 	void dsmv643xx_et _shared_remove(ree_ndsdevic	 *ddev)l+{l+	 ounmap(mv643xx_et _shared_base);l+	mv643xx_et _shared_base = NULL;
+l+	re,) { 0;
+}l+
+@
 	voiree_ndsdevic	_driversmv643xx_et _drivers= {
+	.name = MV643XX_ETH_NAME,l+	.bus = &platform_bus_typ
,l+	.probe =smv643xx_et _probe,l+	.remove = mv643xx_et _remove,l+};l+
+@
 	voiree_ndsdevic	_driversmv643xx_et _shared_drivers= {
+	.name = MV643XX_ETH_SHARED_NAME,l+	.bus = &platform_bus_typ
,l+	.probe =smv643xx_et _shared_probe,l+	.remove = mv643xx_et _shared_remove,l+};l l /*
- *+mv64340_init_module
+ *+mv643xx_init_module
  *
  *+Regksters theNnetwork drivers into t 	sLinux k	rnel
  *
- *+Inputs: N/A
+ *+Inputs:	N/A
  *
- *+Outputs: N/A
+ *+Outputs:	N/A
  */l-@
 	void ds__init+mv64340_init_module(v. I)l+@
 	void ds__init+mv643xx_init_module(v. I)l {l-	prd tk(KERN_NOTICE "MV-643xxs10/100/1000 Et 	rnet Driverthc);
+	d tNrc;l l-#ifdef CONFIG_MV643XX_ETH_0
-	mv64340_dev0 =smv64340_et _dnit(0);
-	i	 (!mv64340_dev0) {l-		prd tk(KERN_ERR
-		+++++++"E__or regkstering MV-64360set 	rnet ports0thc);
-	}l-#endif
-#ifdef CONFIG_MV643XX_ETH_1
-	mv64340_dev1 =smv64340_et _dnit(1);
-	i	 (!mv64340_dev1) {l-		prd tk(KERN_ERR
-		+++++++"E__or regkstering MV-64360set 	rnet ports1thc);
-	}l-#endif
-#ifdef CONFIG_MV643XX_ETH_2
-	mv64340_dev2 =smv64340_et _dnit(2);
-	i	 (!mv64340_dev2) {l-		prd tk(KERN_ERR
-		+++++++"E__or regkstering MV-64360set 	rnet ports2thc);
+	rc = driver_regkster(&mv643xx_et _shared_driver);
+	i	 (!rc) {
+		rc = driver_regkster(&mv643xx_et _driver);
+		 	 (rc)
+			driver_unregkster(&mv643xx_et _shared_driver);
 	}l-#endif
-	re,) { 0;
+	re,) { rc;l }
 l /*
- *+mv64340_cleanup_module
+ *+mv643xx_cleanup_module
  *
  *+Regksters theNnetwork drivers into t 	sLinux k	rnel
  *
- *+Inputs: N/A
+ *+Inputs:	N/A
  *
- *+Outputs: N/A
+ *+Outputs:	N/A
  */l-@
 	voiv. I __exit+mv64340_cleanup_module(v. I)l+@
 	voiv. I __exit+mv643xx_cleanup_module(v. I)l {l-	i	 (mv64340_dev2)l-		mv64340_et _remove(mv64340_dev2);l-	i	 (mv64340_dev1)l-		mv64340_et _remove(mv64340_dev1);l-	i	 (mv64340_dev0)l-		mv64340_et _remove(mv64340_dev0);
+	driver_unregkster(&mv643xx_et _driver);
+	driver_unregkster(&mv643xx_et _shared_driver);
 }
 l-module_dnit(mv64340_init_module);l-module_exit(mv64340_cleanup_module);
+module_dnit(mv643xx_init_module);
+module_exit(mv643xx_cleanup_module);
 
 MODULE_LICENSE("GPLc);
-MODULE_AUTHOR("Rabeeh Khoury, Assaf Hoffman, Matt 	w Dharm and Manish Lachwanic);
-MODULE_DESCRIPTION("Et 	rnet driversfor Marvell MV64340c);
+MODULE_AUTHOR(	"Rabeeh Khoury, Assaf Hoffman, Matt 	w Dharm, Manish Lachwanicl+		" and Dale Farnsworthc);
+MODULE_DESCRIPTION("Et 	rnet driversfor Marvell MV643XXc);
 
 /*
- *+ TheNsecond p rt is theNlow level driversof t 	sgigEset 	rnet ports.
+ *+TheNsecond p rt is theNlow level driversof t 	sgigEset 	rnet ports.
  */
 l /*
  *+Marvell's Gigabit+Et 	rnet controller low level driver
  *
  *+DESCRIPTION:
- *+++++++This file introduceNlow level API to Marvell's Gigabit+Et 	rnet
+ *	This file introduceNlow level API to Marvell's Gigabit+Et 	rnet
  *		controller.+This Gigabit+Et 	rnet Controller driversAPI controls
  *		1) Operat ons (i.e. portsindt, s	art, resetsetc').
  *		2) Dv;
sflow (i.e. ports@end, rece vesetc').
  *		Each Gigabit+Et 	rnet portsis controlled via
- *++++++++++++++@
e_ndsmv64340_priv 	i.
+ *		ree_ndsmv643xx_priv 	i.
  *		This ree_ndsincludes user configurat on informat on as well as
  *		driversd te_nal dv;
sneedflafor its operat ons.
  *
- *		SupportedsFeadures:  
+ *		SupportedsFeadures:
  *		-+This low level driversis OSsd dependent. Alloc 	ing memorysfor
  *		++theNdescriptor ringssand buffers are not within t 	sscopesof
  *		++this driver.
@@ -1511,12 +1645,12 @@
  *		-+PHY accessaand control API.
  *		-+Portscontrol regkster configurat on API.
  *		-+Full control over Unvoast and Mul	voastsMAC configurat ons.
- *								   
+ *
  *		Operat onsflow:
  *
  *		Init al =at onsphase
- *		This phase complete t 	sd it al =at onsof t 	st 	smv64340_priv 	i
- *		ree_nd. 
+ *		This phase complete t 	sd it al =at onsof t 	st 	
+ *		mv643xx_priv 	i ree_nd.
  *		Usersd format on regarding portsconfigurat on has to beNset
  *		prio_ to calling theNportsindt al =at onsrou	ini.
  *
@@ -1525,7 +1659,7 @@
  *		accessato DRAM and d te_nal SRAM memorysspaces.
  *
  *		Driver ring indt al =at on
- *		Alloc 	ing memorysfor+theNdescriptor ringssand buffers is not 
+ *		Alloc 	ing memorysfor+theNdescriptor ringssand buffers is not
  *		within t 	sscopesof+this driver.+Thus, the user is requirflato
  *		alloc 	i memorysfor+theNdescriptors ring and buffers.+Those
  *		memoryspaeameters are usedaby+theNRx and Tx ring indt al =at on
@@ -1533,49 +1667,50 @@
  *		of+a ring.
  *		Note: Paysspec al attentionsto alk, ment issues w 	n using
  *		cachedNdescriptors/buffers.+In+this phase theNdriver store
- *		d format on in t 	smv64340_priv 	i @
e_ndsregarding each queue
+ *		d format on in t 	smv643xx_priv 	i ree_ndsregarding each queue
  *		ring.
  *
- *		Driver st rt 
+ *		Driver st rt
  *		This phase prepaees theNEt 	rnet portsfor+Rx and Tx activity.
- *		It uses theNd format on stored in t 	smv64340_priv 	i @
e_ndsto 
+ *		It uses theNd format on stored in t 	smv643xx_priv 	i ree_ndsto
  *		init al =
 theNvarious portsregksters.
  *
  *		Dv;
sflow:
  *		All packetfreferences to/from theNdriver are don
 using
- *++++++++++++++@
e_ndspkt_info.
- *		This ree_ndsis+a unifiid see_ndsusedawithsRx and Tx operat ons. 
+ *		ree_ndspkt_info.
+ *		This ree_ndsis+a unifiid see_ndsusedawithsRx and Tx operat ons.
  *		This way the user is not requirflato beNfamiliarawithsneit 	r
  *		Tx nor+Rx descriptors see_ndures.
  *		TheNdriver's descriptors rings are management by+d dexes.
  *		Those i dexes controls t 	sring resourc	ssand usedato indic 	i
  *		a SW resourc	se__or:
- *		'current' 
- *		This i dexspoints to t 	scurrent availablesresourc	sfor+use. For 
- *		example in Rx processathis i dexswill point to t 	sdescriptor  
- *		t at will b	spassedato the user upon calling theNrece vesrou	ini.
- *		In Tx process,athis i dexswill point to t 	sdescriptor
+ *		'current'
+ *		This i dexspoints to t 	scurrent availablesresourc	sfor+use. For
+ *		example in Rx processathis i dexswill point to t 	sdescriptor
+ *		t at will b	spassedato the user upon calling theNrece ve
+ *		rou	ini.  In Tx process,athis i dexswill point to t 	sdescriptor
  *		t at will b	sassk, flawithsthe user packetfinfo and teansmitted.
- *		'used'    
- *		This i dexspoints to t 	sdescriptor t at need to restore its 
+ *		'used'
+ *		This i dexspoints to t 	sdescriptor t at need to restore its
  *		resourc	s. For example in Rx process, using+theNRx buffer re,) {
  *		API will attach t 	sbuffer re,) {ed in packetfinfo to t 	
  *		descriptor pointedaby+'used'. In Tx process,ausing+theNTx
  *		descriptor re,) { will merely re,) { the user packetfinfo with
- *		t e command s
 tus of+ t 	steansmittedsbuffer pointedaby+t 	
+ *		t e command s
 tus of+t 	steansmittedsbuffer pointedaby+t 	
  *		'used' i dex. Nevert 	less,aidsis+essent al to use this rou	ini
  *		to up v;e+t 	s'used' i dex.
  *		'first'
- *		This i dexssupports Tx Scatter-Gat 	r.+It points to t 	sfirsts
- *		descriptor of+a packetfassembledsof+mul	vple buffers.+For example
- *		w 	n d  middle of+Such packetfwe haze a Tx resourc	se__or t 	s
- *		'curr' i dex get theNvalue of+'first'ato indic 	i t at t 	sring 
- *		re,) {ed to its st 	e before trying to teansmitfthis packet.
+ *		This i dexssupports Tx Scatter-Gat 	r.+It points to t 	sfirst
+ *		descriptor of+a packetfassembledsof+mul	vple buffers.+For
+ *		example w 	n d  middle of+Such packetfwe haze a Tx resourc	
+ *		e__or t 	s'curr' i dex get theNvalue of+'first'ato indic 	i
+ *		t at t 	sring re,) {ed to its st 	e before trying to teansmit
+ *		t is packet.
  *
  *		Rece vesoperat on:
  *		TheNet _port_rece vesAPI set t 	 packetfinformat on ste_nd,
- *		passedaby+theNcallfr,awithsrece vedfinformat on from theN
- *		'current' SDMAsdescriptor. 
+ *		passedaby+theNcallfr,awithsrece vedfinformat on from the
+ *		'current' SDMAsdescriptor.
  *		It is theNuser responsibility to re,) { this resourc	sback
  *		to theNRx descriptor ring to enable theNreusesof+this sourc	.
  *		Re,) { Rx resourc	sis don
 using theNet _rx_re,) {_buff API.
@@ -1596,27 +1731,21 @@
  *
  *		EXTERNAL INTERFACE
  *
- *+      Prio_ to calling theNindt al =at onsrou	iniNet _port_dnit() theNuser
- *	+must set t 	 following fields undersmv64340_priv 	i @
e_nd:
- *+++++++port_numaaaaaaaaaaaaaUsersEt 	rnet portsnumber.
- *+++++++port_mac_addr[6]	aaaaUsersdefinflaportsMAC address.
- *+++++++port_config aaaaaaaaaUsersportsconfigurat on value.
- *+++++++port_config_extend aaaUsersportsconfig extend value.
- *+++++++port_sdma_config aaaaaUsersportsSDMAsconfig value.
- *+++++++port_serial_control aaUsersportsserial control value.
- *
- *+++++++This driversd troduceNa set of+defaul	 values:
- *+++++++PORT_CONFIG_VALUEaaaaaaaaaaaDefaul	 portsconfigurat on value
- *+++++++PORT_CONFIG_EXTEND_VALUEaaaaDefaul	 portsextend configurat on value
- *+++++++PORT_SDMA_CONFIG_VALUEaaaaaaDefaul	 sdma control value
- *+++++++PORT_SERIAL_CONTROL_VALUEaaaDefaul	 portsserial control value
+ *	Prio_ to calling theNindt al =at onsrou	iniNet _port_dnit() theNuser
+ *	must set t 	 following fields undersmv643xx_priv 	i ree_nd:
+ *	port_num		UsersEt 	rnet portsnumber.
+ *	port_mac_addr[6]	UsersdefinflaportsMAC address.
+ *	port_config		Usersportsconfigurat on value.
+ *	port_config_extend	Usersportsconfig extend value.
+ *	port_sdma_config	UsersportsSDMAsconfig value.
+ *	port_serial_control	Usersportsserial control value.
  *
  *		This driversdv;
sflow is don
 using theN@
e_ndspkt_info w ich
- *++++++++++++++is+a unifiid see_ndsfor+Rx and Tx operat ons:
+ *		ds+a unifiid see_ndsfor+Rx and Tx operat ons:
  *
  *		byte_cnt	Tx/Rx descriptor buffer byte cound.
  *		l4i_chk		CPU+providflaTCP Checksum. For Tx operat on
- *++++++++++++++++++++++++++++++only.
+ *				only.
  *		cmd_sts		Tx/Rx descriptor command s
 tus.
  *		buf_ptr		Tx/Rx descriptor buffer pointe_.
  *		re,) {_info	Tx/Rx user resourc	sre,) { informat on.
@@ -1625,70 +1754,44 @@
 /*sdefinfs */l /*sSDMAscommand macros */l #definf ETH_ENABLE_TX_QUEUE(et _port) \
-	MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(et _port), 1)
-
-#definf ETH_DISABLE_TX_QUEUE(et _port) \
-	MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(et _port),	\
-	+++++++++(1s<< 8))
-
-#definf ETH_ENABLE_RX_QUEUE(rx_queue, et _port) \
-	MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(et _port),	\
-	+++++++++(1s<< rx_queue))
-
-#definf ETH_DISABLE_RX_QUEUE(rx_queue, et _port) \
-	MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(et _port),	\
-	+++++++++(1s<< (8 + rx_queue)))
-
-#definf LINK_UP_TIMEOUT		100000
-#definf PHY_BUSY_TIMEOUT	10000000l+	mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(et _port), 1)
 l /* loc ls */
 l /*+PHY rou	inis */
 @
 	void dset 	rnet_phy_get(uock, flad dset _port_num);l+@
 	voiv. I et 	rnet_phy_set(uock, flad dset _port_numa+d t phy_addr);l l /*+Et 	rnet Portsrou	inis */
 @
 	void dset _port_uc_addr(uock, flad dset _port_numa+uock, flachar uc_nibble,l-	d t opt on);
+								d t opt on);
 l /*
  *+et _port_dnit - Init al =
 theNEt 	rnet portsdriver
  *
  *+DESCRIPTION:
- *+++++++This funct on prepaees theNet 	rnet portsto s
 rt its activity:
- *+++++++1) Completes theNet 	rnet portsdriver ste_ndsindt al =at onstowardsport
- *+++++++++++s
 rt rou	ini.
- *+++++++2) Resets theNdevic	sto a quiescent st 	e in casesof+warm reboot.
- *+++++++3) EnablesSDMAsaccessato all four DRAM banks as well as d te_nal SRAM.
- *+++++++4) CleansMAC tables.+TheNresetss
 tus of+t ose tables is unknown.
- *+++++++5) Set PHY address. 
- *+++++++Note: Call this rou	ini prio_ to et _port_@
 rt rou	ini and after
- *+++++++setting user values i{ the user fields of+Et 	rnet portscontrol
- *+++++++see_nd.
+ *	This funct on prepaees theNet 	rnet portsto s
 rt its activity:
+ *	1) Completes theNet 	rnet portsdriver ste_ndsindt al =at onstowardsport
+ *		re rt rou	ini.
+ *	2) Resets theNdevic	sto a quiescent st 	e in casesof+warm reboot.
+ *	3) EnablesSDMAsaccessato all four DRAM banks as well as d te_nal SRAM.
+ *	4) CleansMAC tables.+TheNresetss
 tus of+t ose tables is unknown.
+ *	5) Set PHY address.
+ *	Note: Call this rou	ini prio_ to et _port_@
 rt rou	ini and after
+ *	setting user values i{ the user fields of+Et 	rnet portscontrol
+ *	see_nd.
  *
  *+INPUT:
- *+++++++see_ndsmv64340_priv 	i *mp  +Et 	rnet portscontrol+see_nd
+ *	see_ndsmv643xx_priv 	i *mp	Et 	rnet portscontrol+see_nd
  *
  *+OUTPUT:
- *+++++++Se	sdescript on.
+ *	Se	sdescript on.
  *
  *+RETURN:
- *+++++++Noni.
+ *	Noni.
  */l-@
 	voiv. I et _port_dnit(see_ndsmv64340_priv 	i * mp)l+@
 	voiv. I et _port_dnit(see_ndsmv643xx_priv 	i *mp)l {l-	mp->port_config = PORT_CONFIG_VALUE;l-	mp->port_config_extend = PORT_CONFIG_EXTEND_VALUE;l-#ifsdefinfl(__BIG_ENDIAN)l-	mp->port_sdma_config = PORT_SDMA_CONFIG_VALUE;l-#elifsdefinfl(__LITTLE_ENDIAN)l-	mp->port_sdma_config = PORT_SDMA_CONFIG_VALUE |
-		ETH_BLM_RX_NO_SWAP | ETH_BLM_TX_NO_SWAP;l-#else
-#e__or Onesof+__LITTLE_ENDIAN or __BIG_ENDIAN+must besdefinfl!l-#endif
-	mp->port_serial_control = PORT_SERIAL_CONTROL_VALUE;l-
 	mp->port_rx_queue_command = 0;l 	mp->port_tx_queue_command = 0;l 
@@ -1706,77 +1809,73 @@
  * et _port_@
 rt - S
 rt theNEt 	rnet portsactivity.
  *
  *+DESCRIPTION:
- *+++++++This rou	ini prepaees theNEt 	rnet portsfor+Rx and Tx activity:
- *+++++++1. Init al =
 Tx and Rx Current Descriptor Pointe_ for+each queue t at
- *++++++++++has be	n dnit al =
d a descriptor's ring (using
- *++++++++++et 	r_init_tx_desc_ring for+Tx and et 	r_init_rx_desc_ring for+Rx)
- *+++++++2. Init al =
 and enable theNEt 	rnet configurat on portsby writing to
- *++++++++++theNport's configurat on and command regksters.
- *+++++++3. Init al =
 and enable theNSDMAsby writing to theNSDMA's 
- *++++++++++configurat on and command regksters.  After completing theseN@
eps,
- *++++++++++theNet 	rnet portsSDMAscan s
 rtsato perform+Rx and Tx activities.
+ *	This rou	ini prepaees theNEt 	rnet portsfor+Rx and Tx activity:
+ *	+1. Init al =
 Tx and Rx Current Descriptor Pointe_ for+each queue t at
+ *	++++has be	n dnit al =
d a descriptor's ring (using
+ *	++++et 	r_init_tx_desc_ring for+Tx and et 	r_init_rx_desc_ring for+Rx)
+ *	+2. Init al =
 and enable theNEt 	rnet configurat on portsby writing to
+ *	++++theNport's configurat on and command regksters.
+ *	+3. Init al =
 and enable theNSDMAsby writing to theNSDMA's
+ *	++++configurat on and command regksters.  After completing theseN@
eps,
+ *	++++theNet 	rnet portsSDMAscan s
 rtsato perform+Rx and Tx activities.
  *
- *+      Note: Each Rx and Tx queue descriptor's list must besdnit al =
d prio_
- *+      to calling this funct on (useset 	r_init_tx_desc_ring for+Tx queues
- *+      and et 	r_init_rx_desc_ring for+Rx queues).
+ *	Note: Each Rx and Tx queue descriptor's list must besdnit al =
d prio_
+ *	to calling this funct on (useset 	r_init_tx_desc_ring for+Tx queues
+ *	and et 	r_init_rx_desc_ring for+Rx queues).
  *
  *+INPUT:
- *+++++++see_ndsmv64340_priv 	i 	*mp  +Et 	rnet portscontrol+see_nd
+ *	see_ndsmv643xx_priv 	i *mp	Et 	rnet portscontrol+see_nd
  *
  *+OUTPUT:
- *+++++++Et 	rnet portsis ready to rece vesand teansmit.
+ *	Et 	rnet portsis ready to rece vesand teansmit.
  *
  *+RETURN:
- *+++++++fa) {  	 theNportsPHY is not up.
- *+++++++ee_esot 	rwisi.
+ *	Noni.
  */l-@
 	void dset _port_s
 rt(see_ndsmv64340_priv 	i *mp)l+@
 	voiv. I et _port_s
 rt(see_ndsmv643xx_priv 	i *mp)l {l-	uock, flad dset _port_num = mp->port_num;l+	uock, flad dsport_num = mp->port_num;l 	d tNtx_curr_desc, rx_curr_desc;l-	uock, flad dsphy_reg_dv;
;l l 	/* Assk, ment of+Tx CTRP of+given queue */
 	tx_curr_desc = mp->tx_curr_desc_q;
-	MV_WRITE(MV64340_ETH_TX_CURRENT_QUEUE_DESC_PTR_0(et _port_num),
-	+++++++++(see_ndset _tx_desc *) mp->tx_desc_dma +Ntx_curr_desc);l+	mv_write(MV643XX_ETH_TX_CURRENT_QUEUE_DESC_PTR_0(port_num),
+		(u32)((see_ndset _tx_desc *)mp->tx_desc_dma +Ntx_curr_desc));l l 	/* Assk, ment of+Rx CRDP of+given queue */
 	rx_curr_desc = mp->rx_curr_desc_q;
-	MV_WRITE(MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_0(et _port_num),
-		+(see_ndset _rx_desc *) mp->rx_desc_dma +Nrx_curr_desc);l+	mv_write(MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_0(port_num),
+		(u32)((see_ndset _rx_desc *)mp->rx_desc_dma +Nrx_curr_desc));l l 	/* Add theNassk, flaEt 	rnet address to theNport's address table */l-	et _port_uc_addr_set(mp->port_num, mp->port_mac_addr);l+	et _port_uc_addr_set(port_num, mp->port_mac_addr);l l 	/* Assk, sportsconfigurat on and command. */l-	MV_WRITE(MV64340_ETH_PORT_CONFIG_REG(et _port_num),
-		+mp->port_config);l+	mv_write(MV643XX_ETH_PORT_CONFIG_REG(port_num),+mp->port_config);l+l+	mv_write(MV643XX_ETH_PORT_CONFIG_EXTEND_REG(port_num),
+						mp->port_config_extend);l 
-	MV_WRITE(MV64340_ETH_PORT_CONFIG_EXTEND_REG(et _port_num),
-		+mp->port_config_extend);l 
-	MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(et _port_num),
-		+mp->port_serial_control);l+	/* Increase theNRx sid	sbuffer s =
 if supporting GigEs*/l+	i	 (mp->port_serial_control & MV643XX_ETH_SET_GMII_SPEED_TO_1000)
+		mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num),
+			(mp->port_serial_control & 0xfff1ffff) | (0x5s<< 17));
+	e) {
+		mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num),
+						mp->port_serial_control);l 
-	MV_SET_REG_BITS(MV64340_ETH_PORT_SERIAL_CONTROL_REG(et _port_num),
-			ETH_SERIAL_PORT_ENABLE);l+	mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num),
+		mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num)) |
+						MV643XX_ETH_SERIAL_PORT_ENABLE);l l 	/* Assk, sportsSDMAsconfigurat on */l-	MV_WRITE(MV64340_ETH_SDMA_CONFIG_REG(et _port_num),
-		+mp->port_sdma_config);l+	mv_write(MV643XX_ETH_SDMA_CONFIG_REG(port_num),
+							mp->port_sdma_config);l l 	/* EnablesportsRx. */l-	MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(et _port_num),
-		+mp->port_rx_queue_command);l-
-	/* Check d	 link is up */l-	et _port_read_smi_reg(et _port_numa+1, &phy_reg_dv;
);l-
-	i	 (!(phy_reg_dv;
 & 0x20))l-		re,) { 0;
-l-	re,) { 1;
+	mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num),
+						mp->port_rx_queue_command);l }
 l /*
@@ -1786,29 +1885,29 @@
  *		This funct on Set t 	 portsEt 	rnet MAC address.
  *
  *+INPUT:
- *	uock, flad dset _port_num ++++Portsnumber.
- *	char *++++++++p_addr		Address to beNset 
+ *	uock, flad d	et _port_num	Portsnumber.
+ *	char *		p_addr		Address to beNset
  *
  *+OUTPUT:
- *	Set MAC address low and hig  regksters. a) o callsset _port_uc_addr() 
- *+++++++To set t 	 unvoast table withsthe proper informat on.
+ *	Set MAC address low and hig  regksters. a) o callsset _port_uc_addr()
+ *	To set t 	 unvoast table withsthe proper informat on.
  *
  *+RETURN:
  *	N/A.
  *
  */
 @
 	voiv. I et _port_uc_addr_set(uock, flad dset _port_numa
-				+uock, flachar *p_addr)
+							uock, flachar *p_addr)
 {l 	uock, flad dsmac_h;l 	uock, flad dsmac_l;l l 	mac_l = (p_addr[4]s<< 8) | (p_addr[5]);
-	mac_h = (p_addr[0]s<< 24) | (p_addr[1]s<< 16) |
-	++++(p_addr[2]s<< 8) | (p_addr[3]s<< 0);
+	mac_h = (p_addr[0]s<< 24) | (p_addr[1]s<< 16) |+(p_addr[2]s<< 8) |
+							(p_addr[3]s<< 0);
 
-	MV_WRITE(MV64340_ETH_MAC_ADDR_LOW(et _port_num),smac_l);
-	MV_WRITE(MV64340_ETH_MAC_ADDR_HIGH(et _port_num),smac_h);l+	mv_write(MV643XX_ETH_MAC_ADDR_LOW(et _port_num),smac_l);
+	mv_write(MV643XX_ETH_MAC_ADDR_HIGH(et _port_num),smac_h);l l 	/* Accept framessof+this address */
 	et _port_uc_addr(et _port_numa+p_addr[5], ACCEPT_MAC_ADDR);l@@ -1817,29 +1916,64 @@
 }
 l /*
+ * et _port_uc_addr_get -+This funct on re,rieves theNportsUnvoast address
+ * (MAC address) from theNet 	rnet hw regksters.
+ *
+ * DESCRIPTION:
+ *		This funct on re,rieves theNportsEt 	rnet MAC address.
+ *
+ *+INPUT:
+ *	uock, flad d	et _port_num	Portsnumber.
+ *	char		*MacAddr	pointe_ w 	re t 	 MAC address is reored
+ *
+ *+OUTPUT:
+ *	Copy t 	 MAC address to theNloc 	ion pointedato by MacAddr
+ *
+ *+RETURN:
+ *	N/A.
+ *
+ */l+@
 	voiv. I et _port_uc_addr_get(@
e_ndsnet_devic	s*dev,+uock, flachar *p_addr)
+{l+	@
e_ndsmv643xx_priv 	i *mp = netdev_priv(dev);l+	uock, flad dsmac_h;l+	uock, flad dsmac_l;l+
+	mac_h = mv_read(MV643XX_ETH_MAC_ADDR_HIGH(mp->port_num));
+	mac_l = mv_read(MV643XX_ETH_MAC_ADDR_LOW(mp->port_num));
+
+	p_addr[0]s= (mac_h >> 24) & 0xff;
+	p_addr[1]s= (mac_h >> 16) & 0xff;
+	p_addr[2]s= (mac_h >> 8) & 0xff;
+	p_addr[3]s= mac_h & 0xff;
+	p_addr[4]s= (mac_l >> 8) & 0xff;
+	p_addr[5]s= mac_l & 0xff;
+}l+
+/*
  *+et _port_uc_addr -+This funct on Set t 	 portsunvoast address table
  *
  *+DESCRIPTION:
- *	This funct on loc 	issthe proper entry i{ the Unvoast table for t 	s
- *	spec fiid MAC nibble+and sets its propertiessaccording to funct on 
+ *	This funct on loc 	issthe proper entry i{ the Unvoast table for t 	
+ *	spec fiid MAC nibble+and sets its propertiessaccording to funct on
  *	paeameters.
  *
  *+INPUT:
- *	uock, flad ds	et _port_num +++++Portsnumber.
- *	uock, flachar uc_nibble		Unvoast MAC Address last nibble. 
- *	d tN			opt on +++++0 =sAdda+1 = remove address.
+ *	uock, flad d	et _port_num	Portsnumber.
+ *	uock, flachar	uc_nibble	Unvoast MAC Address last nibble.
+ *	d tN		opt on		0 =sAdda+1 = remove address.
  *
  *+OUTPUT:
  *	This funct on add/removes MAC addresses from theNportsunvoast address
- *	table. 
+ *	table.
  *
  *+RETURN:
  *	ee_esis outputssucceedfl.
  *	fa) {  	 opt on paeameter is i valid.
  *
  */
-@
 	void dset _port_uc_addr(uock, flad dset _port_numal-	uock, flachar uc_nibble, d t opt on)l+@
 	void dset _port_uc_addr(uock, flad dset _port_numa+uock, flachar uc_nibble,l+								d t opt on)
 {l 	uock, flad dsunvoast_reg;l 	uock, flad dstbl_offset;l@@ -1852,29 +1986,26 @@
 l 	switch (opt on) {l 	casesREJECT_MAC_ADDR:
-		/* Clearsaccepts frame bit+at spec fiid unvoast DA table entry */l-		unvoast_reg = MV_READ((MV64340_ETH_DA_FILTER_UNICAST_TABLE_BASE
-				+ (et _port_num) +Ntbl_offset));
+		/* Clearsaccepts frame bit+at given unvoast DA table entry */l+		unvoast_reg = mv_read((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE
+						(et _port_num) +Ntbl_offset));
 
 		unvoast_reg &= (0x0Es<< (8 * reg_offset));
 
-		MV_WRITE(
-			 (MV64340_ETH_DA_FILTER_UNICAST_TABLE_BASE
-			+ (et _port_num) +Ntbl_offset),sunvoast_reg);
+		mv_write((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE
+				(et _port_num) +Ntbl_offset),sunvoast_reg);
 		break;
 
 	casesACCEPT_MAC_ADDR:
 		/* Set accepts frame bit+at unvoast DA filte_ table entry */l 		unvoast_reg =
-		++++MV_READ(
-				+(MV64340_ETH_DA_FILTER_UNICAST_TABLE_BASE
-				+ (et _port_num) +Ntbl_offset));
+			mv_read((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE
+						(et _port_num) +Ntbl_offset));
 
 		unvoast_reg |= (0x01s<< (8 * reg_offset));
 
-		MV_WRITE(
-			 (MV64340_ETH_DA_FILTER_UNICAST_TABLE_BASE
-			+ (et _port_num) +Ntbl_offset),sunvoast_reg);
+		mv_write((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE
+				(et _port_num) +Ntbl_offset),sunvoast_reg);
 
 		break;
 
@@ -1889,17 +2020,17 @@
  * et _port_init_mac_tables - Clearsall entrance i{ the UC, SMC+and OMC tables
  *
  *+DESCRIPTION:
- *+++++++Go through all theNDA filte_ tables (Unvoast, Spec al Mul	voasts&
- *+++++++Ot 	r Mul	voast)+and set each entry to 0.
+ *	Go through all theNDA filte_ tables (Unvoast, Spec al Mul	voasts&
+ *	Ot 	r Mul	voast)+and set each entry to 0.
  *
  *+INPUT:
- *	uock, flad ds+++et _port_num ++Et 	rnet Portsnumber.
+ *	uock, flad d	et _port_num	Et 	rnet Portsnumber.
  *
  *+OUTPUT:
- *+++++++Mul	voastsand Unvoast packets a_	 rejectfl.
+ *	Mul	voastsand Unvoast packets a_	 rejectfl.
  *
  *+RETURN:
- *+++++++Noni.
+ *	Noni.
  */l @
 	voiv. I et _port_dnit_mac_tables(uock, flad dset _port_num)
 {l@@ -1907,18 +2038,16 @@
 l 	/* ClearsDA filte_ unvoast table (Ex_dFUT) */l 	for (table_i dex = 0; table_i dex <= 0xC; table_i dex += 4)
-		MV_WRITE(
-			 (MV64340_ETH_DA_FILTER_UNICAST_TABLE_BASE
-			+ (et _port_num) +Ntable_i dex), 0);
+		mv_write((MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE
+					(et _port_num) +Ntable_i dex), 0);
 l 	for (table_i dex = 0; table_i dex <= 0xFC; table_i dex += 4) {l 		/* ClearsDA filte_ spec al mul	voast table (Ex_dFSMT) */l-		MV_WRITE(
-			 (MV64340_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE
-			+ (et _port_num) +Ntable_i dex), 0);
+		mv_write((MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE
+					(et _port_num) +Ntable_i dex), 0);
 		/* ClearsDA filte_ ot 	r mul	voast table (Ex_dFOMT) */l-		MV_WRITE((MV64340_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE
-			+ (et _port_num) +Ntable_i dex), 0);
+		mv_write((MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE
+					(et _port_num) +Ntable_i dex), 0);
 	}
 }
 l@@ -1926,17 +2055,17 @@
  * et _clear_mib_counders - Clearsall MIB counders
  *
  *+DESCRIPTION:
- *+++++++This funct on clearssall MIB counders of+a spec ficNet 	rnet port.
- *+++++++A read from theNMIB counder will resetst e counte_.
+ *	This funct on clearssall MIB counders of+a spec ficNet 	rnet port.
+ *	A read from theNMIB counder will resetst e counte_.
  *
  *+INPUT:
- *	uock, flad ds+++et _port_num ++Et 	rnet Portsnumber.
+ *	uock, flad d	et _port_num	Et 	rnet Portsnumber.
  *
  *+OUTPUT:
- *+++++++After reading all MIB counders,st e counte_s resets.
+ *	After reading all MIB counders,st e counte_s resets.
  *
  *+RETURN:
- *+++++++MIB counder value.
+ *	MIB counder value.
  *
  */
 @
 	voiv. I et _clear_mib_counders(uock, flad dset _port_num)
@@ -1944,72 +2073,155 @@
 	d t i;l l 	/* Perform+dummy reads from MIB counders */l-	for (i = ETH_MIB_GOOD_OCTETS_RECEIVED_LOW; i < ETH_MIB_LATE_COLLISION; i += 4)
-		MV_READ(MV64340_ETH_MIB_COUNTERS_BASE(et _port_num) +Ni);
+	for (i = ETH_MIB_GOOD_OCTETS_RECEIVED_LOW; i < ETH_MIB_LATE_COLLISION;l+									i += 4)
+		mv_read(MV643XX_ETH_MIB_COUNTERS_BASE(et _port_num) +Ni);
+}l+
+@
 	void lini u32 read_mib(see_ndsmv643xx_priv 	i *mp, d t offset)
+{l+	re,) { mv_read(MV643XX_ETH_MIB_COUNTERS_BASE(mp->port_num) +Noffset);
+}l+
+@
 	voiv. I et _up v;e_mib_counders(see_ndsmv643xx_priv 	i *mp)l+{l+	@
e_ndsmv643xx_mib_counders *p = &mp->mib_counders;
+	d tNoffset;l+
+	p->good_octfts_rece vedf+=
+		read_mib(mp, ETH_MIB_GOOD_OCTETS_RECEIVED_LOW);
+	p->good_octfts_rece vedf+=
+		(u64)read_mib(mp, ETH_MIB_GOOD_OCTETS_RECEIVED_HIGH)s<< 32;l+
+	for (offset = ETH_MIB_BAD_OCTETS_RECEIVED;l+			offset <= ETH_MIB_FRAMES_1024_TO_MAX_OCTETS;l+			offset += 4)
+		*(u32 *)((char *)p +Noffset) = read_mib(mp, offset);
+
+	p->good_octfts_sent += read_mib(mp, ETH_MIB_GOOD_OCTETS_SENT_LOW);
+	p->good_octfts_sent +=
+		(u64)read_mib(mp, ETH_MIB_GOOD_OCTETS_SENT_HIGH)s<< 32;l+
+	for (offset = ETH_MIB_GOOD_FRAMES_SENT;l+			offset <= ETH_MIB_LATE_COLLISION;l+			offset += 4)
+		*(u32 *)((char *)p +Noffset) = read_mib(mp, offset);
 }
 l+/*
+ * et 	rnet_phy_detect - Detect whet 	r+a phy is present
+ *
+ * DESCRIPTION:
+ *	This funct on tests whet 	r+t 	re ds+a PHY present on
+ *	theN@pec fiid port.
+ *
+ *+INPUT:
+ *	uock, flad d	et _port_num	Et 	rnet Portsnumber.
+ *
+ *+OUTPUT:
+ *	Noni
+ *
+ *+RETURN:
+ *	0 on success
+ *	-ENODEV on failure
+ *
+ */l+@
 	void dset 	rnet_phy_detect(uock, flad dsport_num)l+{l+	uock, flad dsphy_reg_dv;
0;
+	d tNauto_neg;l+l+	et _port_read_smi_reg(port_numa+0, &phy_reg_dv;
0);
+	auto_negs=sphy_reg_dv;
0 & 0x1000;
+	phy_reg_dv;
0 ^= 0x1000;	/* invertNauto_neg */l+	et _port_write_smi_reg(port_numa+0, phy_reg_dv;
0);
+l+	et _port_read_smi_reg(port_numa+0, &phy_reg_dv;
0);
+	i	 ((phy_reg_dv;
0 & 0x1000) == auto_neg)
+		re,) { -ENODEV;				/* change didn't take */l+
+	phy_reg_dv;
0 ^= 0x1000;l+	et _port_write_smi_reg(port_numa+0, phy_reg_dv;
0);
+	re,) { 0;
+}l l /*
  *+et 	rnet_phy_get - Getst e et 	rnet portsPHY address.
  *
  *+DESCRIPTION:
- *+++++++This rou	ini re,) {s t 	sgiven et 	rnet portsPHY address.
+ *	This rou	ini re,) {s t 	sgiven et 	rnet portsPHY address.
  *
  *+INPUT:
- *		uock, flad ds++et _port_num ++Et 	rnet Portsnumber.
+ *	uock, flad d	et _port_num	Et 	rnet Portsnumber.
  *
  *+OUTPUT:
- *+++++++Noni.
+ *	Noni.
  *
  *+RETURN:
- *+++++++PHY address.
+ *	PHY address.
  *
  */
 @
 	void dset 	rnet_phy_get(uock, flad dset _port_num)
 {l 	uock, flad dsreg_dv;
;l l-	reg_dv;
 = MV_READ(MV64340_ETH_PHY_ADDR_REG);
+	reg_dv;
 = mv_read(MV643XX_ETH_PHY_ADDR_REG);
 l 	re,) { ((reg_dv;
 >> (5 * et _port_num)) & 0x1f);l }
 l /*
+ * et 	rnet_phy_set - Setst e et 	rnet portsPHY address.
+ *
+ * DESCRIPTION:
+ *	This rou	ini sets theNgiven et 	rnet portsPHY address.
+ *
+ *+INPUT:
+ *	uock, flad d	et _port_num	Et 	rnet Portsnumber.
+ *	d t		phy_addr	PHY address.
+ *
+ *+OUTPUT:
+ *	Noni.
+ *
+ *+RETURN:
+ *	Noni.
+ *
+ */l+@
 	voiv. I et 	rnet_phy_set(uock, flad dset _port_numa+d t phy_addr)l+{l+	u32 reg_dv;
;l+	dnt addr_shift = 5 * et _port_num;
+l+	reg_dv;
 = mv_read(MV643XX_ETH_PHY_ADDR_REG);
+	reg_dv;
 &= ~(0x1fs<< addr_shift);
+	reg_dv;
 |= (phy_addr & 0x1f)s<< addr_shift;l+	mv_write(MV643XX_ETH_PHY_ADDR_REG, reg_dv;
);l+}l+
+/*
  *+et 	rnet_phy_resets- Reset+Et 	rnet portsPHY.
  *
  *+DESCRIPTION:
- *+++++++This rou	ini u	il =
 theNSMI d te_fac	sto resetst e et 	rnet portsPHY.
- *+++++++Thesrou	ini waits undil theNlink is up again or link up is timeou	.
+ *	This rou	ini u	il =
s theNSMI d te_fac	sto resetst e et 	rnet portsPHY.
  *
  *+INPUT:
- *	uock, flad ds++et _port_num ++Et 	rnet Portsnumber.
+ *	uock, flad d	et _port_num	Et 	rnet Portsnumber.
  *
  *+OUTPUT:
- *+++++++T e et 	rnet portsPHY renew its link.
+ *	ThesPHY is reset.
  *
  *+RETURN:
- *+++++++Noni.
+ *	Noni.
  *
  */
-@
 	void dset 	rnet_phy_reset(uock, flad dset _port_num)
+@
 	voiv. I et 	rnet_phy_reset(uock, flad dset _port_num)
 {l-	uock, flad dstime_ou	 = 50;l 	uock, flad dsphy_reg_dv;
;l l 	/* Resetst e PHY */
 	et _port_read_smi_reg(et _port_numa+0, &phy_reg_dv;
);l 	phy_reg_dv;
 |= 0x8000;	/* Setsbit+15sto resetst e PHY */
 	et _port_write_smi_reg(et _port_numa+0, phy_reg_dv;
);l-
-	/* Poll on t e PHY LINK */l-	do {l-		et _port_read_smi_reg(et _port_numa+1, &phy_reg_dv;
);l-
-		i	 (time_ou	-- == 0)l-			re,) { 0;
-	} w ile (!(phy_reg_dv;
 & 0x20));
-l-	re,) { 1;
 }
 l /*
@@ -2017,381 +2229,358 @@
  *
  *+DESCRIPTION:
  *+	This rou	ini resets theNchip by aborting anysSDMAsengini activitysand
- *++++++clearing theNMIB counders.+TheNRece versand theNTeansmitfunit a_	 in 
- *++++++idle st 	e after+this command is perform
d and theNportsis disabled.
+ *	clearing theNMIB counders.+TheNRece versand theNTeansmitfunit a_	 in
+ *	ddle st 	e after+this command is perform
d and theNportsis disabled.
  *
  *+INPUT:
- *	uock, flad ds++et _port_num ++Et 	rnet Portsnumber.
+ *	uock, flad d	et _port_num	Et 	rnet Portsnumber.
  *
  *+OUTPUT:
- *+++++++Channel activitysis haltfl.
+ *	Channel activitysis haltfl.
  *
  *+RETURN:
- *+++++++Noni.
+ *	Noni.
  *
  */
-@
 	voiv. I et _port_reset(uock, flad dset _port_num)
+@
 	voiv. I et _port_reset(uock, flad dsport_num)
 {l 	uock, flad dsreg_dv;
;l l 	/* Stop Tx portsactivity. Check portsTx activity. */l-	reg_dv;
 =
-	++++MV_READ(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(et _port_num));
+	reg_dv;
 = mv_read(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num));
 l 	 	 (reg_dv;
 & 0xFF) {l 		/* Issue reop command for active channels+only */l-		MV_WRITE(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG
-			 (et _port_num),s(reg_dv;
 << 8));
+		mv_write(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num),l+							(reg_dv;
 << 8));
 l 		/* Wait for all Tx activity to termin 	i. */l-		do {l-			/* Check portscausesregkster t at all Tx queues a_	 reoppfla*/l-			reg_dv;
 =
-			++++MV_READ
-			++++(MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG
-			 ++++(et _port_num));
-		}
-		w ile (reg_dv;
 & 0xFF);
+		/* Check portscausesregkster t at all Tx queues a_	 reoppfla*/l+		w ile (mv_read(MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port_num))l+									& 0xFF)l+			udelay(10);
 	}
 l 	/* Stop Rx portsactivity. Check portsRx activity. */l-	reg_dv;
 =
-	++++MV_READ(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG
-			 (et _port_num));
+	reg_dv;
 = mv_read(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num));
 l 	 	 (reg_dv;
 & 0xFF) {l 		/* Issue reop command for active channels+only */l-		MV_WRITE(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG
-			 (et _port_num),s(reg_dv;
 << 8));
+		mv_write(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num),
+							(reg_dv;
 << 8));
 l 		/* Wait for all Rx activity to termin 	i. */l-		do {l-			/* Check portscausesregkster t at all Rx queues a_	 reoppfla*/l-			reg_dv;
 =
-			++++MV_READ
-			++++(MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG
-			 ++++(et _port_num));
-		}
-		w ile (reg_dv;
 & 0xFF);
+		/* Check portscausesregkster t at all Rx queues a_	 reoppfla*/l+		w ile (mv_read(MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port_num))l+									& 0xFF)l+			udelay(10);
 	}
 l-l 	/* Clearsall MIB counders */l-	et _clear_mib_counders(et _port_num);l+	et _clear_mib_counders(port_num);l l 	/* Resetst e Enablesbit+i{ the Configurat on Regkster */l-	reg_dv;
 =
-	++++MV_READ(MV64340_ETH_PORT_SERIAL_CONTROL_REG+(et _port_num));
-	reg_dv;
 &= ~ETH_SERIAL_PORT_ENABLE;
-	MV_WRITE(MV64340_ETH_PORT_SERIAL_CONTROL_REG(et _port_num), reg_dv;
);l-
-	re,) {;
+	reg_dv;
 = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num));
+	reg_dv;
 &= ~MV643XX_ETH_SERIAL_PORT_ENABLE;l+	mv_write(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num), reg_dv;
);l }l l /*
  *+et 	rnet_set_config_reg - Sets@pec fiid bits in configurat on regkster.
  *
  *+DESCRIPTION:
- *+++++++This funct on sets @pec fiid bits in theNgiven et 	rnet 
- *+++++++configurat on regkster. 
+ *	This funct on sets @pec fiid bits in theNgiven et 	rnet
+ *	configurat on regkster.
  *
  *+INPUT:
- *	uock, flad ds++et _port_num ++Et 	rnet Portsnumber.
- *++++++uock, flad ds+++value   32sbit+value.
+ *	uock, flad d	et _port_num	Et 	rnet Portsnumber.
+ *	uock, flad d	value		32sbit+value.
  *
  *+OUTPUT:
- *++++++TheNset bits in theNvalue paeameter a_	 ret+i{ the configurat on 
- *++++++regkster.
+ *	Thesset bits in theNvalue paeameter a_	 ret+i{ the configurat on
+ *	regkster.
  *
  *+RETURN:
- *++++++Noni.
+ *	Noni.
  *
  */
 @
 	voiv. I et 	rnet_set_config_reg(uock, flad dset _port_numa
-				++++uock, flad dsvalue)
+							uock, flad dsvalue)
 {l 	uock, flad dset _config_reg;l l-	et _config_reg =
-	++++MV_READ(MV64340_ETH_PORT_CONFIG_REG(et _port_num));l+	et _config_reg = mv_read(MV643XX_ETH_PORT_CONFIG_REG(et _port_num));l 	et _config_reg |=svalue;l-	MV_WRITE(MV64340_ETH_PORT_CONFIG_REG(et _port_num),
-		+et _config_reg);l+	mv_write(MV643XX_ETH_PORT_CONFIG_REG(et _port_num), et _config_reg);l+}l+
+@
 	void dset _port_autoneg_supported(uock, flad dset _port_num)
+{l+	uock, flad dsphy_reg_dv;
0;
+l+	et _port_read_smi_reg(et _port_numa+0, &phy_reg_dv;
0);
+l+	re,) { phy_reg_dv;
0 & 0x1000;
+}l+
+@
 	void dset _port_link_is_up(uock, flad dset _port_num)
+{l+	uock, flad dsphy_reg_dv;
1;
+l+	et _port_read_smi_reg(et _port_numa+1, &phy_reg_dv;
1);
+l+	 	 (et _port_autoneg_supported(et _port_num)) {l+		 	 (phy_reg_dv;
1 & 0x20)	/* auto-neg complete */l+			re,) { 1;
+	} e) {  	 (phy_reg_dv;
1 & 0x4)		/* link up */l+		re,) { 1;
+
+	re,) { 0;
 }l l /*
  *+et 	rnet_get_config_reg - Get t 	 portsconfigurat on regkster
  *
  *+DESCRIPTION:
- *+++++++This funct on re,) {s t 	sconfigurat on regksterNvalue of+theNgiven 
- *+++++++et 	rnet port.
+ *	This funct on re,) {s t 	sconfigurat on regksterNvalue of+theNgiven
+ *	et 	rnet port.
  *
  *+INPUT:
- *	uock, flad ds++et _port_num ++Et 	rnet Portsnumber.
+ *	uock, flad d	et _port_num	Et 	rnet Portsnumber.
  *
  *+OUTPUT:
- *+++++++Noni.
+ *	Noni.
  *
  *+RETURN:
- *+++++++Portsconfigurat on regkster+value.
+ *	Portsconfigurat on regkster+value.
  */
 @
 	voiuock, flad dset 	rnet_get_config_reg(uock, flad dset _port_num)
 {l 	uock, flad dset _config_reg;l l-	et _config_reg =+MV_READ(MV64340_ETH_PORT_CONFIG_EXTEND_REG
-				++++  (et _port_num));l+	et _config_reg = mv_read(MV643XX_ETH_PORT_CONFIG_EXTEND_REG
+								(et _port_num));l 	re,) { et _config_reg;l }
 l-l /*
  *+et _port_read_smi_regs- ReadsPHY regksters
  *
  *+DESCRIPTION:
- *+++++++This rou	ini u	il =
 theNSMI d te_fac	sto d te_act withsthe PHY in 
- *+++++++ordersto perform+PHY regkster read.
+ *	This rou	ini u	il =
 theNSMI d te_fac	sto d te_act withsthe PHY in
+ *	ordersto perform+PHY regkster read.
  *
  *+INPUT:
- *	uock, flad ds++et _port_num ++Et 	rnet Portsnumber.
- *+++++++uock, flad ds++phy_reg+++PHY regkster address offset.
- *+++++++uock, flad ds++*value   RegksterNvalue buffer.
+ *	uock, flad d	port_num	Et 	rnet Portsnumber.
+ *	uock, flad d	phy_reg		PHY regkster address offset.
+ *	uock, flad d	*value		RegksterNvalue buffer.
  *
  *+OUTPUT:
- *+++++++Write theNvalue of+a @pec fiid PHY regkster d doNgiven buffer.
+ *	Write theNvalue of+a @pec fiid PHY regkster d doNgiven buffer.
  *
  *+RETURN:
- *+++++++fa) {  	 theNPHY is busy or readsdv;
sis not in valid s
 te.
- *+++++++ee_esot 	rwisi.
+ *	fa) {  	 theNPHY is busy or readsdv;
sis not in valid s
 te.
+ *	ee_esot 	rwisi.
  *
  */
-@
 	void dset _port_read_smi_reg(uock, flad dset _port_numal-	uock, flad dsphy_reg,+uock, flad ds*value)
+@
 	voiv. I et _port_read_smi_reg(uock, flad dsport_numal+				uock, flad dsphy_reg,+uock, flad ds*value)
 {l-	d t phy_addr = et 	rnet_phy_get(et _port_num);l-	uock, flad dstime_ou	 = PHY_BUSY_TIMEOUT;l-	uock, flad dsreg_value;l-
-	/* firstscheck t at idsis+not busy */l-	do {l-		reg_value =+MV_READ(MV64340_ETH_SMI_REG);
-		i	 (time_ou	-- == 0)l-			re,) { 0;
-	} w ile (reg_value & ETH_SMI_BUSY);l-
-	/* not busy */l-l-	MV_WRITE(MV64340_ETH_SMI_REG,
-		+(phy_addr << 16) |+(phy_reg+<< 21) | ETH_SMI_OPCODE_READ);l-
-	time_ou	 = PHY_BUSY_TIMEOUT;	/* init al =
 theNtime outNvar again */l+	i t phy_addr = et 	rnet_phy_get(port_num);l+	uock, flalong flags;
+	d tNi;l l-	do {l-		reg_value =+MV_READ(MV64340_ETH_SMI_REG);
-		i	 (time_ou	-- == 0)l-			re,) { 0;
-	} w ile (reg_value & ETH_SMI_READ_VALID);l+	/* theNSMI regkster ds+a sharflaresourc	s*/l+	spin_lock_irqsave(&mv643xx_et _phy_lock, flags);
 
-	/* Wait for theNdv;
sto up v;e+i{ the SMI regkster */l-	for (time_ou	 = 0; time_ou	 < PHY_BUSY_TIMEOUT; time_ou	++);l+	/* wait for theNSMI regkster to become availables*/l+	for (i = 0; mv_read(MV643XX_ETH_SMI_REG) & ETH_SMI_BUSY; i++) {l+		 	 (i == PHY_WAIT_ITERATIONS) {l+			prd tk("mv643xxNPHY busy timeou	, ports%d\n", port_num);l+			goto ou	;l+		}l+		udelay(PHY_WAIT_MICRO_SECONDS);l+	}l l-	reg_value =+MV_READ(MV64340_ETH_SMI_REG);
+	mv_write(MV643XX_ETH_SMI_REG,
+		(phy_addr << 16) |+(phy_reg+<< 21) | ETH_SMI_OPCODE_READ);l l-	*value =+reg_value & 0xffff;l+	/* now wait for theNdv;
sto be valid */l+	for (i = 0; !(mv_read(MV643XX_ETH_SMI_REG) & ETH_SMI_READ_VALID); i++) {l+		 	 (i == PHY_WAIT_ITERATIONS) {l+			prd tk("mv643xxNPHY readstimeou	, ports%d\n", port_num);l+			goto ou	;l+		}l+		udelay(PHY_WAIT_MICRO_SECONDS);l+	}l l-	re,) { 1;
+	*value =+mv_read(MV643XX_ETH_SMI_REG) & 0xffff;l+ou	:l+	spin_unlock_irqrestore(&mv643xx_et _phy_lock, flags);
 }
 l /*
  *+et _port_write_smi_regs- Write tosPHY regksters
  *
  *+DESCRIPTION:
- *+++++++This rou	ini u	il =
 theNSMI d te_fac	sto d te_act withsthe PHY in 
- *+++++++ordersto perform+writes tosPHY regksters.
+ *	This rou	ini u	il =
 theNSMI d te_fac	sto d te_act withsthe PHY in
+ *	ordersto perform+writes tosPHY regksters.
  *
  *+INPUT:
- *	uock, flad ds++et _port_num ++Et 	rnet Portsnumber.
- *++++++uock, flad ds++phy_reg+++PHY regkster address offset.
- *++++++uock, flad ds+++value   Regkster+value.
+ *	uock, flad d	et _port_num	Et 	rnet Portsnumber.
+ *	uock, flad d	phy_reg		PHY regkster address offset.
+ *	uock, flad d	value		RegksterNvalue.
  *
  *+OUTPUT:
- *++++++Write theNgiven value to theN@pec fiid PHY regkster.
+ *	Write theNgiven value to theN@pec fiid PHY regkster.
  *
  *+RETURN:
- *++++++fa) {  	 theNPHY is busy.
- *++++++ee_esot 	rwisi.
+ *	fa) {  	 theNPHY is busy.
+ *	ee_esot 	rwisi.
  *
  */
-@
 	void dset _port_write_smi_reg(uock, flad dset _port_numal-	uock, flad dsphy_reg,+uock, flad dsvalue)
+@
 	voiv. I et _port_write_smi_reg(uock, flad dset _port_numal+				+++uock, flad dsphy_reg,+uock, flad dsvalue)
 {l-	uock, flad dstime_ou	 = PHY_BUSY_TIMEOUT;l-	uock, flad dsreg_value;l 	i t phy_addr;
+	d tNi;l+	uock, flalong flags;
 l 	phy_addr = et 	rnet_phy_get(et _port_num);l 
-	/* firstscheck t at idsis+not busy */l-	do {l-		reg_value =+MV_READ(MV64340_ETH_SMI_REG);
-		i	 (time_ou	-- == 0)l-			re,) { 0;
-	} w ile (reg_value & ETH_SMI_BUSY);l-
-	/* not busy */l-	MV_WRITE(MV64340_ETH_SMI_REG,+(phy_addr << 16) |+(phy_reg+<< 21) |
-		+ETH_SMI_OPCODE_WRITE |+(value & 0xffff));l+	/* theNSMI regkster ds+a sharflaresourc	s*/l+	spin_lock_irqsave(&mv643xx_et _phy_lock, flags);
 
-	re,) { 1;
+	/* wait for theNSMI regkster to become availables*/l+	for (i = 0; mv_read(MV643XX_ETH_SMI_REG) & ETH_SMI_BUSY; i++) {l+		 	 (i == PHY_WAIT_ITERATIONS) {l+			prd tk("mv643xxNPHY busy timeou	, ports%d\n",
+								et _port_num);l+			goto ou	;l+		}l+		udelay(PHY_WAIT_MICRO_SECONDS);l+	}l+
+	mv_write(MV643XX_ETH_SMI_REG,+(phy_addr << 16) |+(phy_reg+<< 21) |
+				ETH_SMI_OPCODE_WRITE |+(value & 0xffff));l+ou	:l+	spin_unlock_irqrestore(&mv643xx_et _phy_lock, flags);
 }
 l /*
  *+et _port_send - Send an+Et 	rnet packet
  *
  *+DESCRIPTION:
- *	This rou	ini send aNgiven packet describid by p_pktinfo paeameter. It 
- *++++++supports teansmitting of+a packet spa flaov	r mul	vple buffers.+TheN
- *++++++rou	ini up v;es 'curr' and 'first' i dexessaccording to t 	 packet 
- *++++++segment passedato thesrou	ini. In casest 	 packet segment is first, 
- *++++++t 	 'first' i dex is upd 	i. In anyscase,st e 'curr' i dex is upd 	id. 
- *++++++If thesrou	ini get+i{to Txaresourc	se__or it assk, s 'curr' i dex as 
- *++++++'first'.+This way t 	 funct on can+abort Tx process of mul	vple 
- *++++++descriptors per packet.
+ *	This rou	ini send aNgiven packet describid by p_pktinfo paeameter. It
+ *	supports teansmitting of+a packet spa flaov	r mul	vple buffers.+The
+ *	rou	ini up v;es 'curr' and 'first' i dexessaccording to t 	 packet
+ *	segment passedato thesrou	ini. In casest 	 packet segment is first,
+ *	theN'first' i dex is upd 	i. In anyscase,st e 'curr' i dex is upd 	id.
+ *	If thesrou	ini get+i{to Txaresourc	se__or it assk, s 'curr' i dex as
+ *	'first'.+This way t 	 funct on can+abort Tx process of mul	vple
+ *	descriptors per packet.
  *
  *+INPUT:
- *	see_ndsmv64340_priv 	i   *mp  +Et 	rnet PortsControl+srt_nd. 
- *	see_ndspkt_info++++++++*p_pkt_info+++++++User packet buffer.
+ *	see_ndsmv643xx_priv 	i	*mp		Et 	rnet PortsControl+srt_nd.
+ *	see_ndspkt_info		*p_pkt_info	User packet buffer.
  *
  *+OUTPUT:
- *	Txaring 'curr' and 'first' i dexessare upd 	id. 
+ *	Txaring 'curr' and 'first' i dexessare upd 	id.
  *
  *+RETURN:
- *++++++ETH_QUEUE_FULL in casesof+Txaresourc	se__or.
+ *	ETH_QUEUE_FULL in casesof+Txaresourc	se__or.
  *	ETH_ERROR in casesthesrou	ini can+not accessaTxadesc ring.
  *	ETH_QUEUE_LAST_RESOURCE  	 theNrou	ini us
s theNlast Txaresourc	.
- *++++++ETH_OKsot 	rwisi.
+ *	ETH_OKsot 	rwisi.
  *
  */
-#ifdef  MV64340_CHECKSUM_OFFLOAD_TX
+#ifdef MV643XX_CHECKSUM_OFFLOAD_TX
 /*
  *+Mod fiid to d clude t 	 firstsdescriptor pointe_ in casesof+SG
  */
-@
 	voiETH_FUNC_RET_STATUS+et _port_send(see_ndsmv64340_priv 	i * mp,
-                                         see_ndspkt_info+* p_pkt_info)
+@
 	voiETH_FUNC_RET_STATUS+et _port_send(see_ndsmv643xx_priv 	i *mp,
+					 see_ndspkt_info+*p_pkt_info)
 {l 	d tNtx_desc_curr,Ntx_desc_us
d,Ntx_first_desc, tx_next_desc;l-	vol 	vle ste_ndset _tx_desc *current_descriptor;l-	vol 	vle ste_ndset _tx_desc *first_descriptor;l-	u32 command_s
 tus, first_chip_ptr;
+	ste_ndset _tx_desc *current_descriptor;l+	ste_ndset _tx_desc *first_descriptor;l+	u32 command;l l 	/* Do+not process Txaring in casesof+Txaring resourc	se__or */
 	i	 (mp->tx_resourc	_e__)l 		re,) { ETH_QUEUE_FULL;l l+	/*l+	+* TheNhardwa_	 requiees that each buffer t at is <= 8 bytes
+	+* in length must besalk, flaon an 8 byte boundary.
+	s*/l+	i	 (p_pkt_info->byte_cnt <= 8 && p_pkt_info->buf_ptr & 0x7) {l+		prd tk(KERN_ERR
+			"mv643xx_et  ports%d: packet s =
 <= 8 problem\n",
+			mp->port_num);l+		re,) { ETH_ERROR;l+	}l+
 	/* Get t 	 TxaDesc ring i dexess*/
 	tx_desc_curr = mp->tx_curr_desc_q;
 	tx_desc_us
d = mp->tx_us
d_desc_q;
 
 	current_descriptor = &mp->p_tx_desc_a_	a[tx_desc_curr];
-	i	 (current_descriptor == NULL)l-		re,) { ETH_ERROR;l 
-	tx_next_descs= (tx_desc_curr + 1) % MV64340_TX_QUEUE_SIZE;
-	command_s
 tuss=sp_pkt_info->cmd_s
s | ETH_ZERO_PADDING | ETH_GEN_CRC;l+	tx_next_descs= (tx_desc_curr + 1) % mp->tx_ring_s =
;
+
+	current_descriptor->buf_ptr = p_pkt_info->buf_ptr;
+	current_descriptor->byte_cnt = p_pkt_info->byte_cnt;
+	current_descriptor->l4i_chk = p_pkt_info->l4i_chk;
+	mp->tx_skb[tx_desc_curr] = p_pkt_info->re,) {_info;l 
-	i	 (command_s
 tuss& ETH_TX_FIRST_DESC) {l+	command = p_pkt_info->cmd_s
s | ETH_ZERO_PADDING | ETH_GEN_CRC |
+							ETH_BUFFER_OWNED_BY_DMA;
+	i	 (command & ETH_TX_FIRST_DESC) {l 		tx_first_desc = tx_desc_curr;
 		mp->tx_first_desc_q = tx_first_desc;l+		first_descriptor = current_descriptor;l+		mp->tx_first_command = command;l+	} e) { {l+		tx_first_desc = mp->tx_first_desc_q;l+		first_descriptor = &mp->p_tx_desc_a_	a[tx_first_desc];l+		BUG_ON(first_descriptor == NULL);l+		current_descriptor->cmd_s
s = command;l+	}l 
-                /* fill firstsdescriptor */
-                first_descriptor = &mp->p_tx_desc_a_	a[tx_desc_curr];
-                first_descriptor->l4i_chk = p_pkt_info->l4i_chk;
-                first_descriptor->cmd_s
s = command_s
 tus;
-                first_descriptor->byte_cnt = p_pkt_info->byte_cnt;
-                first_descriptor->buf_ptr = p_pkt_info->buf_ptr;
-                first_descriptor->next_desc_ptr = mp->tx_desc_dma +l-			tx_next_descs* s =
of(see_ndset _tx_desc);
+	i	 (command & ETH_TX_LAST_DESC) {l 		wmb();
-        } e) { {l-                tx_first_desc = mp->tx_first_desc_q;l-                first_descriptor = &mp->p_tx_desc_a_	a[tx_first_desc];l-                i	 (first_descriptor == NULL) {l-                ++++++++prd tk("Firstsdesc is NULL !!\n");l-                ++++++++re,) { ETH_ERROR;l-                }l-                i	 (command_s
 tuss& ETH_TX_LAST_DESC)l-                ++++++++current_descriptor->next_desc_ptr = 0x00000000;l-                e) { {l-                ++++++++command_s
 tuss|= ETH_BUFFER_OWNED_BY_DMA;
-                ++++++++current_descriptor->next_desc_ptr = mp->tx_desc_dma +l-				tx_next_descs* s =
of(see_ndset _tx_desc);
-                }l-        }l-
-        i	 (p_pkt_info->byte_cnt < 8) {l-                prd tk(" < 8 problem \n");l-                re,) { ETH_ERROR;l-        }l-
-        current_descriptor->buf_ptr = p_pkt_info->buf_ptr;
-        current_descriptor->byte_cnt = p_pkt_info->byte_cnt;
-        current_descriptor->l4i_chk = p_pkt_info->l4i_chk;
-        current_descriptor->cmd_s
s = command_s
 tus;
-
-        mp->tx_skb[tx_desc_curr] = (see_ndssk_buff*) p_pkt_info->re,) {_info;l-
-        wmb();
-
-        /* Setslast descswithsDMAsownership and inte_rupdsenable. */
-        i	 (command_s
 tuss& ETH_TX_LAST_DESC) {l-                current_descriptor->cmd_s
s = command_s
 tus |
-                                        ETH_TX_ENABLE_INTERRUPT |
-                                        ETH_BUFFER_OWNED_BY_DMA;
+		first_descriptor->cmd_s
s = mp->tx_first_command;
 
-		i	 (!(command_s
 tuss& ETH_TX_FIRST_DESC))l-			first_descriptor->cmd_s
s |= ETH_BUFFER_OWNED_BY_DMA;
 		wmb();
-l-		first_chip_ptr =+MV_READ(MV64340_ETH_CURRENT_SERVED_TX_DESC_PTR(mp->port_num));
-
-		/* Apply send command */l-		i	 (first_chip_ptr == 0x00000000)l-			MV_WRITE(MV64340_ETH_TX_CURRENT_QUEUE_DESC_PTR_0(mp->port_num),+(see_ndset _tx_desc *) mp->tx_desc_dma +Ntx_first_desc);
-
-                ETH_ENABLE_TX_QUEUE(mp->port_num);l+		ETH_ENABLE_TX_QUEUE(mp->port_num);l l 		/*l 		s* Finish Tx packet. Up v;e+firstsdesc in casesof+Txaresourc	l 		s* e__or */
-                tx_first_desc = tx_next_desc;l-                mp->tx_first_desc_q = tx_first_desc;l-	} e) { {l-		i	 (! (command_s
 tuss& ETH_TX_FIRST_DESC) ) {l-			current_descriptor->cmd_s
s = command_s
 tus;
-			wmb();
-		}l+		tx_first_desc = tx_next_desc;l+		mp->tx_first_desc_q = tx_first_desc;l 	}l 
-        /* Check for ring i dexaov	rlap+i{ the Txadesc ring */
-        i	 (tx_next_descs==Ntx_desc_us
d) {l-                mp->tx_resourc	_e__ = 1;l-                mp->tx_curr_desc_q = tx_first_desc;l+	/* Check for ring i dexaov	rlap+i{ the Txadesc ring */
+	i	 (tx_next_descs==Ntx_desc_us
d) {l+		mp->tx_resourc	_e__ = 1;l+		mp->tx_curr_desc_q = tx_first_desc;l l-                re,) { ETH_QUEUE_LAST_RESOURCE;l+		re,) { ETH_QUEUE_LAST_RESOURCE;l 	}l 
-        mp->tx_curr_desc_q = tx_next_desc;l-        wmb();
+	mp->tx_curr_desc_q = tx_next_desc;l 
-        re,) { ETH_OK;
+	re,) { ETH_OK;
 }
 #e) {
-@
 	voiETH_FUNC_RET_STATUS+et _port_send(see_ndsmv64340_priv 	i * mp,
-					 see_ndspkt_info+* p_pkt_info)
+@
 	voiETH_FUNC_RET_STATUS+et _port_send(see_ndsmv643xx_priv 	i *mp,
+					 see_ndspkt_info+*p_pkt_info)
 {l 	d tNtx_desc_curr;l 	d tNtx_desc_us
d;l-	vol 	vle ste_ndset _tx_desc* current_descriptor;l+	ste_ndset _tx_desc *current_descriptor;l 	uock, flad dscommand_s
 tus;
 l 	/* Do+not process Txaring in casesof+Txaring resourc	se__or */
@@ -2403,39 +2592,24 @@
 	tx_desc_us
d = mp->tx_us
d_desc_q;
 	current_descriptor = &mp->p_tx_desc_a_	a[tx_desc_curr];
 
-	i	 (current_descriptor == NULL)l-		re,) { ETH_ERROR;l-l 	command_s
 tuss=sp_pkt_info->cmd_s
s | ETH_ZERO_PADDING | ETH_GEN_CRC;l-
-/* XXX Is+this for real ?!?!? */l-	/* Buffersswithsa payload smaller t an 8 bytes must besalk, flato a
-	+* 64-bit+boundary. Wi us
 the memorysalloc 	id for Txadescriptor.
-	+* This memorysis loc 	id in TX_BUF_OFFSET_IN_DESC offsetswithi{ the
-	+* Txadescriptor. */l-	i	 (p_pkt_info->byte_cnt <= 8) {l-		prd tk(KERN_ERR
-		++++   "You have failid in the < 8 bytes e__v;
s-+fixme\n");l-		re,) { ETH_ERROR;l-	}l 	current_descriptor->buf_ptr = p_pkt_info->buf_ptr;
 	current_descriptor->byte_cnt = p_pkt_info->byte_cnt;
-	mp->tx_skb[tx_desc_curr] = (see_ndssk_buff *) p_pkt_info->re,) {_info;l-
-	mb();
+	mp->tx_skb[tx_desc_curr] = p_pkt_info->re,) {_info;l 
 	/* Setslast descswithsDMAsownership and inte_rupdsenable. */
+	wmb();
 	current_descriptor->cmd_s
s = command_s
 tus |
 			ETH_BUFFER_OWNED_BY_DMA | ETH_TX_ENABLE_INTERRUPT;l 
-	/* Apply send command */l+	wmb();
 	ETH_ENABLE_TX_QUEUE(mp->port_num);l l 	/* Finish Tx packet. Up v;e+firstsdesc in casesof+Txaresourc	 e__or */
-	tx_desc_curr = (tx_desc_curr + 1) % MV64340_TX_QUEUE_SIZE;
+	tx_desc_curr = (tx_desc_curr + 1) % mp->tx_ring_s =
;
 l 	/* Up v;e+t 	scurrentsdescriptor */
- 	mp->tx_curr_desc_q = tx_desc_curr;l+	mp->tx_curr_desc_q = tx_desc_curr;l l 	/* Check for ring i dexaov	rlap+i{ the Txadesc ring */
 	i	 (tx_desc_curr ==Ntx_desc_us
d) {l@@ -2452,62 +2626,55 @@
  *
  *+DESCRIPTION:
  *	This rou	ini re,) {s t 	steansmittid packet informat onato thescaller.
- *++++++It us
s theN'first' i dex to support Txadesc re,) { in casesasteansmit 
- *++++++of+a packet spa  flaov	r mul	vple buffer still in process.
- *++++++In casesthesTx queue was in "resourc	 e__or"scondit on, w 	re t 	re a_	 
- *++++++no availablesTxaresourc	s,st e funct on resets theNresourc	 e__or flag.
+ *	It us
s theN'first' i dex to support Txadesc re,) { in casesasteansmit
+ *	of+a packet spa  flaov	r mul	vple buffer still in process.
+ *	In casesthesTx queue was in "resourc	 e__or"scondit on, w 	re t 	re a_	
+ *	no availablesTxaresourc	s,st e funct on resets theNresourc	 e__or flag.
  *
  *+INPUT:
- *	see_ndsmv64340_priv 	i   *mp  +Et 	rnet PortsControl+srt_nd. 
- *	see_ndspkt_info++++++++*p_pkt_info+++++++User packet buffer.
+ *	see_ndsmv643xx_priv 	i	*mp		Et 	rnet PortsControl+srt_nd.
+ *	see_ndspkt_info		*p_pkt_info	User packet buffer.
  *
  *+OUTPUT:
- *	Txaring 'first' and 'us
d' i dexessare upd 	id. 
+ *	Txaring 'first' and 'us
d' i dexessare upd 	id.
  *
  *+RETURN:
  *	ETH_ERROR in casesthesrou	ini can+not accessaTxadesc ring.
- *++++++ETH_RETRY in casesthere ds+teansmiss on in process.
+ *	ETH_RETRY in casesthere ds+teansmiss on in process.
  *	ETH_END_OF_JOB  	 theNrou	ini has+nothing to releas	.
- *++++++ETH_OKsot 	rwisi.
+ *	ETH_OKsot 	rwisi.
  *
  */
-@
 	voiETH_FUNC_RET_STATUS+et _tx_re,) {_desc(see_ndsmv64340_priv 	i * mp,
-					      see_ndspkt_info+* p_pkt_info)
+@
 	voiETH_FUNC_RET_STATUS+et _tx_re,) {_desc(see_ndsmv643xx_priv 	i *mp,
+						see_ndspkt_info+*p_pkt_info)
 {l-	d tNtx_desc_us
d, tx_desc_curr;l-#ifdef MV64340_CHECKSUM_OFFLOAD_TX
-        i tNtx_first_desc;l+	d tNtx_desc_us
d;l+#ifdef MV643XX_CHECKSUM_OFFLOAD_TX
+	d tNtx_busy_desc = mp->tx_first_desc_q;l+#e) {
+	d tNtx_busy_desc = mp->tx_curr_desc_q;
 #endifl-	vol 	vle ste_ndset _tx_desc *p_tx_desc_us
d;l+	ste_ndset _tx_desc *p_tx_desc_us
d;l 	uock, flad dscommand_s
 tus;
 l 	/* Get t 	 TxaDesc ring i dexess*/
-	tx_desc_curr = mp->tx_curr_desc_q;
 	tx_desc_us
d = mp->tx_us
d_desc_q;
-#ifdef MV64340_CHECKSUM_OFFLOAD_TX
-        tx_first_desc = mp->tx_first_desc_q;l-#endifl+
 	p_tx_desc_us
d = &mp->p_tx_desc_a_	a[tx_desc_us
d];l 
-	/* XXX Sanity check */l+	/* Sanity check */l 	i	 (p_tx_desc_us
d == NULL)l 		re,) { ETH_ERROR;l 
+	/* Stop releas	. Abou	 to ov	rlap+t 	scurrentsavailablesTxadescriptor */
+	i	 (tx_desc_us
d == tx_busy_desc && !mp->tx_resourc	_e__)l+		re,) { ETH_END_OF_JOB;l+
 	command_s
 tuss=sp_tx_desc_us
d->cmd_s
s;l l 	/* Still teansmitting... */
-#ifndef MV64340_CHECKSUM_OFFLOAD_TX
 	i	 (command_s
 tuss& (ETH_BUFFER_OWNED_BY_DMA))l 		re,) { ETH_RETRY;l-#endifl-	/* Stop releas	. Abou	 to ov	rlap+t 	scurrentsavailablesTxadescriptor */
-#ifdef MV64340_CHECKSUM_OFFLOAD_TX
-	i	 (tx_desc_us
d == tx_first_desc && !mp->tx_resourc	_e__)l-		re,) { ETH_END_OF_JOB;l-#e) {
-	i	 (tx_desc_us
d == tx_desc_curr && !mp->tx_resourc	_e__)l-		re,) { ETH_END_OF_JOB;l-#endifl l 	/* Passst 	 packet informat onato thescaller */l 	p_pkt_info->cmd_s
s = command_s
 tus;
@@ -2515,7 +2682,7 @@
 	mp->tx_skb[tx_desc_us
d] = NULL;
 l 	/* Up v;e+t 	snextadescriptor to releas	.s*/
-	mp->tx_us
d_desc_q = (tx_desc_us
d + 1) % MV64340_TX_QUEUE_SIZE;
+	mp->tx_us
d_desc_q = (tx_desc_us
d + 1) % mp->tx_ring_s =
;
 l 	/* AnysTxare,) { cancels t 	 Txaresourc	 e__or s
 tuss*/l 	mp->tx_resourc	_e__ = 0;
@@ -2527,30 +2694,30 @@
  * et _port_rece ve - Get rece vedfinformat onafrom Rx ring.
  *
  *+DESCRIPTION:
- *+	This rou	ini re,) {s t 	srece vedfdv;
sto thescaller. There ds+no 
- *	dv;
scopying during rou	ini operat on. All informat onais re,) {edf
- *	using pointe_ to packet informat onasee_ndspassedafrom theNcaller. 
- *++++++If thesrou	ini exhaus
s	Rxaring resourc	s t 	n theNresourc	 e__or flag 
- *++++++is ret.  
+ *+	This rou	ini re,) {s t 	srece vedfdv;
sto thescaller. There ds+no
+ *	dv;
scopying during rou	ini operat on. All informat onais re,) {ed
+ *	using pointe_ to packet informat onasee_ndspassedafrom theNcaller.
+ *	If thesrou	ini exhaus
s Rxaring resourc	s t 	n theNresourc	 e__or flag
+ *	ds ret.
  *
  *+INPUT:
- *	see_ndsmv64340_priv 	i   *mp  +Et 	rnet PortsControl+srt_nd. 
- *	see_ndspkt_info++++++++*p_pkt_info+++++++User packet buffer.
+ *	see_ndsmv643xx_priv 	i	*mp		Et 	rnet PortsControl+srt_nd.
+ *	see_ndspkt_info		*p_pkt_info	User packet buffer.
  *
  *+OUTPUT:
- *	Rxaring currentsand us
d i dexessare upd 	id. 
+ *	Rxaring currentsand us
d i dexessare upd 	id.
  *
  *+RETURN:
  *	ETH_ERROR in casesthesrou	ini can+not accessaRxadesc ring.
  *	ETH_QUEUE_FULL if Rxaring resourc	s are exhaus
id.
  *	ETH_END_OF_JOB  	 there ds+no rece vedfdv;
.
- *++++++ETH_OKsot 	rwisi.
+ *	ETH_OKsot 	rwisi.
  */
-@
 	voiETH_FUNC_RET_STATUS+et _port_rece ve(see_ndsmv64340_priv 	i * mp,
-					    see_ndspkt_info+* p_pkt_info)
+@
 	voiETH_FUNC_RET_STATUS+et _port_rece ve(see_ndsmv643xx_priv 	i *mp,
+						see_ndspkt_info+*p_pkt_info)
 {l 	d tNrx_next_curr_desc,Nrx_curr_desc,Nrx_us
d_desc;l-	vol 	vle ste_ndset _rx_desc * p_rx_desc;
+	vol 	vle ste_ndset _rx_desc *p_rx_desc;
 	uock, flad dscommand_s
 tus;
 l 	/* Do+not process Rxaring in casesof+Rxaring resourc	se__or */
@@ -2565,6 +2732,7 @@
 l 	/* TheNfollowing paeameterssare usedato save readings from memorys*/l 	command_s
 tuss=sp_rx_desc->cmd_s
s;l+	rmb();
 l 	/* Nothing to rece ve... */
 	i	 (command_s
 tuss& (ETH_BUFFER_OWNED_BY_DMA))l@@ -2577,18 +2745,17 @@
 	p_pkt_info->l4i_chks=sp_rx_desc->buf_s =
;
 l 	/* Clean theNre,) { info+field to d dicv;e+t atst 	 packet has+been */l-	/* movedato thesupper layersssssssssssssssssssssssssssssssssssssssss*/l+	/* movedato thesupper layers					    */l 	mp->rx_skb[rx_curr_desc] = NULL;
 l 	/* Up v;e+currentsi dex infdv;
sste_ndure */l-	rx_next_curr_desc = (rx_curr_desc + 1) % MV64340_RX_QUEUE_SIZE;
+	rx_next_curr_desc = (rx_curr_desc + 1) % mp->rx_ring_s =
;
 	mp->rx_curr_desc_q = rx_next_curr_desc;l l 	/* Rx+descriptors exhaus
id. Setst e Rxaring resourc	se__or flag */
 	i	 (rx_next_curr_desc ==Nrx_us
d_desc)
 		mp->rx_resourc	_e__ = 1;l 
-	mb();
 	re,) { ETH_OK;
 }
 l@@ -2596,27 +2763,27 @@
  * et _rx_re,) {_buff - Re,) {s a Rxabuffer back tost e Rxaring.
  *
  *+DESCRIPTION:
- *	This rou	ini re,) {s a Rxabuffer back tost e Rxaring.+It re,riev
s theN
- *++++++nexta'us
d' descriptor and attached theNre,) {id buffer to dt.
- *++++++In casesthesRxaring was in "resourc	 e__or"scondit on, w 	re t 	re a_	 
- *++++++no availablesRxaresourc	s,st e funct on resets theNresourc	 e__or flag.
+ *	This rou	ini re,) {s a Rxabuffer back tost e Rxaring.+It re,riev
s the
+ *	nexta'us
d' descriptor and attached theNre,) {id buffer to dt.
+ *	In casesthesRxaring was in "resourc	 e__or"scondit on, w 	re t 	re a_	
+ *	no availablesRxaresourc	s,st e funct on resets theNresourc	 e__or flag.
  *
  *+INPUT:
- *	see_ndsmv64340_priv 	i *mp  +Et 	rnet PortsControl+srt_nd. 
- *      see_ndspkt_info++++++++*p_pkt_info+++Informat onaon theNre,) {id buffer.
+ *	see_ndsmv643xx_priv 	i	*mp		Et 	rnet PortsControl+srt_nd.
+ *	see_ndspkt_info		*p_pkt_info	Informat onaon re,) {id buffer.
  *
  *+OUTPUT:
  *	New availablesRxaresourc	 in Rx+descriptoraring.
  *
  *+RETURN:
  *	ETH_ERROR in casesthesrou	ini can+not accessaRxadesc ring.
- *++++++ETH_OKsot 	rwisi.
+ *	ETH_OKsot 	rwisi.
  */
-@
 	voiETH_FUNC_RET_STATUS+et _rx_re,) {_buff(see_ndsmv64340_priv 	i * mp,
-	see_ndspkt_info+* p_pkt_info)
+@
 	voiETH_FUNC_RET_STATUS+et _rx_re,) {_buff(see_ndsmv643xx_priv 	i *mp,
+						see_ndspkt_info+*p_pkt_info)
 {l 	d tNus
d_rx_desc;	/* W 	re toNre,) { Rxaresourc	 */l-	vol 	vle ste_ndset _rx_desc* p_us
d_rx_desc;
+	vol 	vle ste_ndset _rx_desc *p_us
d_rx_desc;
 l 	/* Get 'us
d' Rxadescriptor */
 	us
d_rx_desc = mp->rx_us
d_desc_q;
@@ -2627,20 +2794,240 @@
 	mp->rx_skb[us
d_rx_desc] = p_pkt_info->re,) {_info;l 
 	/* Flushsthe write pip	 */l-	mb();
 l 	/* Re,) { theNdescriptor to DMAsownership */l+	wmb();
 	p_us
d_rx_desc->cmd_s
s =
-		ETH_BUFFER_OWNED_BY_DMA | ETH_RX_ENABLE_INTERRUPT;l-
-	/* Flushsdescriptor and CPU pip	 */l-	mb();
+			ETH_BUFFER_OWNED_BY_DMA | ETH_RX_ENABLE_INTERRUPT;l+	wmb();
 l 	/* Move thesusedadescriptor pointe_ tost e nextadescriptor */
-	mp->rx_us
d_desc_q = (us
d_rx_desc + 1) % MV64340_RX_QUEUE_SIZE;
+	mp->rx_us
d_desc_q = (us
d_rx_desc + 1) % mp->rx_ring_s =
;
 l 	/* AnysRxare,) { cancels t 	 Rxaresourc	 e__or s
 tuss*/l 	mp->rx_resourc	_e__ = 0;
 
 	re,) { ETH_OK;
 }
+
+/************* Begi{ et tool+support *************************/l+
+@
e_ndsmv643xx_s
 ts {l+	char s
 t_s
ring[ETH_GSTRING_LEN];l+	d tNs =
of_s
 t;l+	d tNs
 t_offset;
+};
+
+#defini MV643XX_STAT(m) s =
of(((see_ndsmv643xx_priv 	i *)0)->m),+\
+		++++++offsetof(see_ndsmv643xx_priv 	i, m)
+
+@
 	voiconst @
e_ndsmv643xx_s
 ts mv643xx_gs
rings_s
 ts[] = {l+	{ "rx_packets", MV643XX_STAT(s
 ts.rx_packets) },l+	{ "tx_packets", MV643XX_STAT(s
 ts.tx_packets) },l+	{ "rx_bytes", MV643XX_STAT(s
 ts.rx_bytes) },l+	{ "tx_bytes", MV643XX_STAT(s
 ts.tx_bytes) },l+	{ "rx_e__ors", MV643XX_STAT(s
 ts.rx_e__ors) },l+	{ "tx_e__ors", MV643XX_STAT(s
 ts.tx_e__ors) },l+	{ "rx_droppfl", MV643XX_STAT(s
 ts.rx_droppfl) },l+	{ "tx_droppfl", MV643XX_STAT(s
 ts.tx_droppfl) },l+	{ "good_octets_rece vel", MV643XX_STAT(mib_counders.good_octets_rece vel) },l+	{ "bad_octets_rece vel", MV643XX_STAT(mib_counders.bad_octets_rece vel) },l+	{ "inte_nal_mac_teansmit_e__", MV643XX_STAT(mib_counders.inte_nal_mac_teansmit_e__) },l+	{ "good_feames_rece vel", MV643XX_STAT(mib_counders.good_feames_rece vel) },l+	{ "bad_feames_rece vel", MV643XX_STAT(mib_counders.bad_feames_rece vel) },l+	{ "broadcast_feames_rece vel", MV643XX_STAT(mib_counders.broadcast_feames_rece vel) },l+	{ "mul	vcast_feames_rece vel", MV643XX_STAT(mib_counders.mul	vcast_feames_rece vel) },l+	{ "feames_64_octets", MV643XX_STAT(mib_counders.feames_64_octets) },l+	{ "feames_65_to_127_octets", MV643XX_STAT(mib_counders.feames_65_to_127_octets) },l+	{ "feames_128_to_255_octets", MV643XX_STAT(mib_counders.feames_128_to_255_octets) },l+	{ "feames_256_to_511_octets", MV643XX_STAT(mib_counders.feames_256_to_511_octets) },l+	{ "feames_512_to_1023_octets", MV643XX_STAT(mib_counders.feames_512_to_1023_octets) },l+	{ "feames_1024_to_max_octets", MV643XX_STAT(mib_counders.feames_1024_to_max_octets) },l+	{ "good_octets_sent", MV643XX_STAT(mib_counders.good_octets_sent) },l+	{ "good_feames_sent", MV643XX_STAT(mib_counders.good_feames_sent) },l+	{ "excess ve_collis on", MV643XX_STAT(mib_counders.excess ve_collis on) },l+	{ "mul	vcast_feames_sent", MV643XX_STAT(mib_counders.mul	vcast_feames_sent) },l+	{ "broadcast_feames_sent", MV643XX_STAT(mib_counders.broadcast_feames_sent) },l+	{ "unrec_mac_control_rece vel", MV643XX_STAT(mib_counders.unrec_mac_control_rece vel) },l+	{ "fc_sent", MV643XX_STAT(mib_counders.fc_sent) },l+	{ "good_fc_rece vel", MV643XX_STAT(mib_counders.good_fc_rece vel) },l+	{ "bad_fc_rece vel", MV643XX_STAT(mib_counders.bad_fc_rece vel) },l+	{ "unders =
_rece vel", MV643XX_STAT(mib_counders.unders =
_rece vel) },l+	{ "feagments_rece vel", MV643XX_STAT(mib_counders.feagments_rece vel) },l+	{ "ov	rs =
_rece vel", MV643XX_STAT(mib_counders.ov	rs =
_rece vel) },l+	{ "jabber_rece vel", MV643XX_STAT(mib_counders.jabber_rece vel) },l+	{ "mac_rece ve_e__or", MV643XX_STAT(mib_counders.mac_rece ve_e__or) },l+	{ "bad_crc_event", MV643XX_STAT(mib_counders.bad_crc_event) },l+	{ "collis on", MV643XX_STAT(mib_counders.collis on) },l+	{ "l 	e_collis on", MV643XX_STAT(mib_counders.l 	e_collis on) },l+};
+
+#defini MV643XX_STATS_LEN	\
+	s =
of(mv643xx_gs
rings_s
 ts) / s =
of(see_ndsmv643xx_s
 ts)l+
+@
 	void d
+mv643xx_get_settings(see_ndsnet_devic	 *netdev, ste_ndset tool_cmd *ecmd)
+{l+	see_ndsmv643xx_priv 	i *mp = netdev->priv;l+	d tNport_num = mp->port_num;l+	d tNautoneg = et _port_autoneg_supported(port_num);l+	d tNmode_10_bit;l+	d tNauto_duplex;l+	d tNhalf_duplex = 0;
+	d tNfull_duplex = 0;
+	d tNauto_spe
d;l+	d tNspe
d_10 = 0;
+	d tNspe
d_100 = 0;
+	d tNspe
d_1000 = 0;
+l+	u32 pcs = mv_read(MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port_num));
+	u32 psr = mv_read(MV643XX_ETH_PORT_STATUS_REG(port_num));
+
+	mode_10_bit = psr & MV643XX_ETH_PORT_STATUS_MODE_10_BIT;
+l+	 	 (mode_10_bit) {l+		ecmd->supported = SUPPORTED_10baseT_Half;l+	} e) { {l+		ecmd->supported = (SUPPORTED_10baseT_Half		|l+				+++SUPPORTED_10baseT_Full		|l+				+++SUPPORTED_100baseT_Half		|l+				+++SUPPORTED_100baseT_Full		|l+				+++SUPPORTED_1000baseT_Full		|l+				+++(autoneg ?+SUPPORTED_Autoneg : 0)	|l+				+++SUPPORTED_TP);
+
+		auto_duplex = !(pcs & MV643XX_ETH_DISABLE_AUTO_NEG_FOR_DUPLX);
+		auto_spe
d = !(pcs & MV643XX_ETH_DISABLE_AUTO_NEG_SPEED_GMII);
+
+		ecmd->adv	rtising = ADVERTISED_TP;
+
+		 	 (autoneg) {l+			ecmd->adv	rtising |= ADVERTISED_Autoneg;
+
+			 	 (auto_duplex) {l+				half_duplex = 1;l+				full_duplex = 1;l+			} e) { {l+				 	 (pcs & MV643XX_ETH_SET_FULL_DUPLEX_MODE)
+					full_duplex = 1;l+				e) {
+					half_duplex = 1;l+			}
+
+			 	 (auto_spe
d) {l+				spe
d_10 = 1;l+				spe
d_100 = 1;l+				spe
d_1000 = 1;l+			} e) { {l+				 	 (pcs & MV643XX_ETH_SET_GMII_SPEED_TO_1000)l+					spe
d_1000 = 1;l+				e) {  	 (pcs & MV643XX_ETH_SET_MII_SPEED_TO_100)l+					spe
d_100 = 1;l+				e) {
+					spe
d_10 = 1;l+			}
+
+			 	 (spe
d_10 &Nhalf_duplex)l+				ecmd->adv	rtising |= ADVERTISED_10baseT_Half;l+			 	 (spe
d_10 &Nfull_duplex)l+				ecmd->adv	rtising |= ADVERTISED_10baseT_Full;l+			 	 (spe
d_100 &Nhalf_duplex)l+				ecmd->adv	rtising |= ADVERTISED_100baseT_Half;l+			 	 (spe
d_100 &Nfull_duplex)l+				ecmd->adv	rtising |= ADVERTISED_100baseT_Full;l+			 	 (spe
d_1000)l+				ecmd->adv	rtising |= ADVERTISED_1000baseT_Full;l+		}l+	}l+
+	ecmd->port = PORT_TP;
+	ecmd->phy_addressa= et 	rnet_phy_get(port_num);l+
+	ecmd->teansce ver = XCVR_EXTERNAL;
+l+	 	 (netif_carrier_ok(netdev)) {l+		 	 (mode_10_bit)l+			ecmd->spe
d = SPEED_10;
+		e) { {l+			 	 (psr & MV643XX_ETH_PORT_STATUS_GMII_1000)l+				ecmd->spe
d = SPEED_1000;
+			e) {  	 (psr & MV643XX_ETH_PORT_STATUS_MII_100)l+				ecmd->spe
d = SPEED_100;
+			e) {l+				ecmd->spe
d = SPEED_10;l+		}l+l+		 	 (psr & MV643XX_ETH_PORT_STATUS_FULL_DUPLEX)l+			ecmd->duplex = DUPLEX_FULL;l+		e) {l+			ecmd->duplex = DUPLEX_HALF;l+	} e) { {l+		ecmd->spe
d = -1;l+		ecmd->duplex = -1;l+	}l+
+	ecmd->autoneg = autoneg ?+AUTONEG_ENABLE : AUTONEG_DISABLE;
+	re,) { 0;
+}l+
+@
 	voiv. I
+mv643xx_get_drvinfo(see_ndsnet_devic	 *netdev,
+                       see_ndset tool_drvinfo *drvinfo)
+{l+	seencpy(drvinfo->dr ver, smv643xx_dr ver_name, 32);l+	seencpy(drvinfo->v	rs on, mv643xx_dr ver_v	rs on, 32);l+	seencpy(drvinfo->fw_v	rs on, "N/A", 32);l+	seencpy(drvinfo->bus_info, "mv643xx", 32);l+	drvinfo->n_s
 ts = MV643XX_STATS_LEN;
+}l+
+@
 	void ds
+mv643xx_get_s
 ts_cound(see_ndsnet_devic	 *netdev)
+{l+	re,) { MV643XX_STATS_LEN;
+}l+
+@
 	voiv. I 
+mv643xx_get_et tool_s
 ts(see_ndsnet_devic	 *netdev, l+		see_ndset tool_s
 ts *s
 ts, ud d64_t *data)
+{l+	see_ndsmv643xx_priv 	i *mp = netdev->priv;l+	d tNi;
+l+	et _upd 	i_mib_counders(mp);l+
+	for(i = 0; i < MV643XX_STATS_LEN; i++) {l+		char *p = (char *)mp+mv643xx_gs
rings_s
 ts[i].s
 t_offset;	l+		data[i] = (mv643xx_gs
rings_s
 ts[i].s =
of_s
 t ==Nl+			s =
of(ud d64_t)) ? *(ud d64_t *)p : *(ud d32_t *)p;l+	}l+}l+
+@
 	voiv. I 
+mv643xx_get_s
rings(see_ndsnet_devic	 *netdev, ud d32_t s
ringset, ud d8_t *data)
+{l+	d tNi;
+l+	switch(s
ringset) {l+	casesETH_SS_STATS:
+		for (i=0; i < MV643XX_STATS_LEN; i++) {l+			memcpy(dv;
s+ i * ETH_GSTRING_LEN, l+			mv643xx_gs
rings_s
 ts[i].s
 t_s
ring,
+			ETH_GSTRING_LEN);l+		}l+		break;l+	}l+}l+
+@
 	voisee_ndset tool_ops mv643xx_et tool_ops = {l+	.get_settings           = mv643xx_get_settings,l+	.get_drvinfo            = mv643xx_get_drvinfo,l+	.get_link               =set tool_op_get_link,l+	.get_sg			=set tool_op_get_sg,
+	.set_sg			=set tool_op_set_sg,
+	.get_s
rings            = mv643xx_get_s
rings,
+	.get_s
 ts_cound        = mv643xx_get_s
 ts_cound,
+	.get_et tool_s
 ts      = mv643xx_get_et tool_s
 ts,l+};
+
+/************* End et tool+support *************************/ldiff -Nru a/dr vers/net/mv643xx_et .h b/dr vers/net/mv643xx_et .h
--- a/dr vers/net/mv643xx_et .h	2004-07-14 11:59:24 -07:00
+++ b/dr vers/net/mv643xx_et .h	2005-02-17 13:27:41 -08:00
@@ -1,5 +1,5 @@
-#ifndef __MV64340_ETH_H__
-#defini __MV64340_ETH_H__
+#ifndef __MV643XX_ETH_H__
+#defini __MV643XX_ETH_H__
 
 #d clude <linux/v	rs on.h>
 #d clude <linux/module.h>
@@ -46,17 +46,16 @@
  *  TheNfirstspart is t 	 high level dr ver of+theNgigE+et 	rnet ports.
  */
 
-#defini ETH_PORT0_IRQ_NUM 48			/* main high regkster, bit0 */
-#defini ETH_PORT1_IRQ_NUM ETH_PORT0_IRQ_NUM+1	/* main high regkster, bit1 */
-#defini ETH_PORT2_IRQ_NUM ETH_PORT0_IRQ_NUM+2	/* main high regkster, bit1 */
-
-/* Checksum+offload for Txaworks */
-#defini  MV64340_CHECKSUM_OFFLOAD_TX
-#defini	 MV64340_NAPI
-#defini	 MV64340_TX_FAST_REFILL
-#undef	 MV64340_COAL
+/* Checksum+offload for Txaworks for most packets, but
+ * fails  	 previous packet sentsd I not us
 hw csum
+ */
+#undef	MV643XX_CHECKSUM_OFFLOAD_TX
+#defini	MV643XX_NAPI
+#defini	MV643XX_TX_FAST_REFILL
+#undef	MV643XX_RX_QUEUE_FILL_ON_TASK	/* Does+not work, yet */
+#undef	MV643XX_COAL
 
-/* 
+/*
  * Numbersof+RX / TX+descriptors on+RX / TX+rings.
  * No;e+t atsalloc 	ing RX+descriptors is done by alloc 	ing t 	 RX
  * ring AND+a prealloc 	id RX+buffers (skb's) for each descriptor.
@@ -65,89 +64,35 @@
  */
 l /* Default TX+ring s =
 is 1000 descriptors */
-#defini MV64340_TX_QUEUE_SIZE 1000
+#defini MV643XX_DEFAULT_TX_QUEUE_SIZE 1000
 l /* Default RX+ring s =
 is 400 descriptors */
-#defini MV64340_RX_QUEUE_SIZE 400
+#defini MV643XX_DEFAULT_RX_QUEUE_SIZE 400
 
-#defini MV64340_TX_COAL 100
-#ifdef MV64340_COAL
-#defini MV64340_RX_COAL 100
+#defini MV643XX_TX_COAL 100
+#ifdef MV643XX_COAL
+#defini MV643XX_RX_COAL 100
 #endifl l-
 /*
-+* TheNsecondspart is t 	 low level dr ver of+theNgigE+et 	rnet ports.+++*
+ * TheNsecondspart is t 	 low level dr ver of+theNgigE+et 	rnet ports.
  */
 
-
 /*
-+* HeadersFvle for : MV-643xxNnetwork d te_fac	sheaders
+ * HeadersFvle for : MV-643xxNnetwork d te_fac	sheader
  *
  *+DESCRIPTION:
- *+++++++This headersfvle contains macros typedefs and funct on declarat onafor
- *+++++++eheNMarvell Gig Bit+Et 	rnet Controller. 
+ *	This headersfvle contains macros typedefs and funct on declarat onafor
+ *	theNMarvell Gig Bit+Et 	rnet Controller.
  *
  *+DEPENDENCIES:
- *+++++++None.
+ *	None.
  *
  */
 
-/* Default port configurat onavalue */
-#defini PORT_CONFIG_VALUE                       \l-             ETH_UNICAST_NORMAL_MODE		|   \l-             ETH_DEFAULT_RX_QUEUE_0		|   \l-             ETH_DEFAULT_RX_ARP_QUEUE_0		|   \l-             ETH_RECEIVE_BC_IF_NOT_IP_OR_ARP	|   \l-             ETH_RECEIVE_BC_IF_IP		|   \l-             ETH_RECEIVE_BC_IF_ARP 		|   \l-             ETH_CAPTURE_TCP_FRAMES_DIS		|   \l-             ETH_CAPTURE_UDP_FRAMES_DIS		|   \l-             ETH_DEFAULT_RX_TCP_QUEUE_0		|   \l-             ETH_DEFAULT_RX_UDP_QUEUE_0		|   \l-             ETH_DEFAULT_RX_BPDU_QUEUE_0
-
-/* Default port extend configurat onavalue */
-#defini PORT_CONFIG_EXTEND_VALUE		\l-             ETH_SPAN_BPDU_PACKETS_AS_NORMAL	|   \l-             ETH_PARTITION_DISABLE
-
-
-/* Default sdma controlavalue */
-#defini PORT_SDMA_CONFIG_VALUE			\l-			+ETH_RX_BURST_SIZE_16_64BIT 	|	\l-			+GT_ETH_IPG_INT_RX(0) 		|	\l-			+ETH_TX_BURST_SIZE_16_64BIT;l-
-#defini GT_ETH_IPG_INT_RX(value)                \l-            ((value & 0x3fff)+<< 8)
-
-/* Default port serial controlavalue */
-#defini PORT_SERIAL_CONTROL_VALUE		\l-			ETH_FORCE_LINK_PASS 			|	\l-			ETH_ENABLE_AUTO_NEG_FOR_DUPLX		|	\l-			ETH_DISABLE_AUTO_NEG_FOR_FLOW_CTRL 	|	\l-			ETH_ADV_SYMMETRIC_FLOW_CTRL 		|	\l-			ETH_FORCE_FC_MODE_NO_PAUSE_DIS_TX 	|	\l-			ETH_FORCE_BP_MODE_NO_JAM 		|	\l-			BIT9 					|	\l-			ETH_DO_NOT_FORCE_LINK_FAIL 		|	\l-			ETH_RETRANSMIT_16_ATTEMPTS 		|	\l-			ETH_ENABLE_AUTO_NEG_SPEED_GMII	 	|	\l-			ETH_DTE_ADV_0 				|	\l-			ETH_DISABLE_AUTO_NEG_BYPASS		|	\l-			ETH_AUTO_NEG_NO_CHANGE 			|	\l-			ETH_MAX_RX_PACKET_9700BYTE 		|	\l-			ETH_CLR_EXT_LOOPBACK 			|	\l-			ETH_SET_FULL_DUPLEX_MODE 		|	\l-			ETH_ENABLE_FLOW_CTRL_TX_RX_IN_FULL_DUPLEXl-
-#defini RX_BUFFER_MAX_SIZE  0x4000000
-#defini TX_BUFFER_MAX_SIZE  0x4000000
-l /* MAC accepet/rejendsmacros */
-#defini ACCEPT_MAC_ADDR	++++0
-#defini REJECT_MAC_ADDR	++++1
+#defini ACCEPT_MAC_ADDR				0
+#defini REJECT_MAC_ADDR				1
 l /* Buffer offsetsfrom buffer pointe_ */
 #defini RX_BUF_OFFSET				0x2
@@ -155,277 +100,132 @@
 /* Gigabit+Et 	rnet Unit+Global Regksters */
 l /* MIB Counders regkster definit ons */
-#defini ETH_MIB_GOOD_OCTETS_RECEIVED_LOW+++0x0
-#defini ETH_MIB_GOOD_OCTETS_RECEIVED_HIGH  0x4
-#defini ETH_MIB_BAD_OCTETS_RECEIVED        0x8
-#defini ETH_MIB_INTERNAL_MAC_TRANSMIT_ERR  0xc
-#defini ETH_MIB_GOOD_FRAMES_RECEIVED       0x10
-#defini ETH_MIB_BAD_FRAMES_RECEIVED        0x14
-#defini ETH_MIB_BROADCAST_FRAMES_RECEIVED  0x18
-#defini ETH_MIB_MULTICAST_FRAMES_RECEIVED  0x1c
-#defini ETH_MIB_FRAMES_64_OCTETS           0x20
-#defini ETH_MIB_FRAMES_65_TO_127_OCTETS    0x24
-#defini ETH_MIB_FRAMES_128_TO_255_OCTETS   0x28
-#defini ETH_MIB_FRAMES_256_TO_511_OCTETS   0x2c
-#defini ETH_MIB_FRAMES_512_TO_1023_OCTETS  0x30
-#defini ETH_MIB_FRAMES_1024_TO_MAX_OCTETS  0x34
-#defini ETH_MIB_GOOD_OCTETS_SENT_LOW+++    0x38
-#defini ETH_MIB_GOOD_OCTETS_SENT_HIGH      0x3c
-#defini ETH_MIB_GOOD_FRAMES_SENT           0x40
-#defini ETH_MIB_EXCESSIVE_COLLISION        0x44
-#defini ETH_MIB_MULTICAST_FRAMES_SENT      0x48
-#defini ETH_MIB_BROADCAST_FRAMES_SENT      0x4c
-#defini ETH_MIB_UNREC_MAC_CONTROL_RECEIVED 0x50
-#defini ETH_MIB_FC_SENT                    0x54
-#defini ETH_MIB_GOOD_FC_RECEIVED           0x58
-#defini ETH_MIB_BAD_FC_RECEIVED            0x5c
-#defini ETH_MIB_UNDERSIZE_RECEIVED         0x60
-#defini ETH_MIB_FRAGMENTS_RECEIVED         0x64
-#defini ETH_MIB_OVERSIZE_RECEIVED          0x68
-#defini ETH_MIB_JABBER_RECEIVED            0x6c
-#defini ETH_MIB_MAC_RECEIVE_ERROR          0x70
-#defini ETH_MIB_BAD_CRC_EVENT              0x74
-#defini ETH_MIB_COLLISION                  0x78
-#defini ETH_MIB_LATE_COLLISION             0x7c
+#defini ETH_MIB_GOOD_OCTETS_RECEIVED_LOW	0x0
+#defini ETH_MIB_GOOD_OCTETS_RECEIVED_HIGH	0x4
+#defini ETH_MIB_BAD_OCTETS_RECEIVED		0x8
+#defini ETH_MIB_INTERNAL_MAC_TRANSMIT_ERR	0xc
+#defini ETH_MIB_GOOD_FRAMES_RECEIVED		0x10
+#defini ETH_MIB_BAD_FRAMES_RECEIVED		0x14
+#defini ETH_MIB_BROADCAST_FRAMES_RECEIVED	0x18
+#defini ETH_MIB_MULTICAST_FRAMES_RECEIVED	0x1c
+#defini ETH_MIB_FRAMES_64_OCTETS		0x20
+#defini ETH_MIB_FRAMES_65_TO_127_OCTETS		0x24
+#defini ETH_MIB_FRAMES_128_TO_255_OCTETS	0x28
+#defini ETH_MIB_FRAMES_256_TO_511_OCTETS	0x2c
+#defini ETH_MIB_FRAMES_512_TO_1023_OCTETS	0x30
+#defini ETH_MIB_FRAMES_1024_TO_MAX_OCTETS	0x34
+#defini ETH_MIB_GOOD_OCTETS_SENT_LOW		0x38
+#defini ETH_MIB_GOOD_OCTETS_SENT_HIGH		0x3c
+#defini ETH_MIB_GOOD_FRAMES_SENT		0x40
+#defini ETH_MIB_EXCESSIVE_COLLISION		0x44
+#defini ETH_MIB_MULTICAST_FRAMES_SENT		0x48
+#defini ETH_MIB_BROADCAST_FRAMES_SENT		0x4c
+#defini ETH_MIB_UNREC_MAC_CONTROL_RECEIVED	0x50
+#defini ETH_MIB_FC_SENT				0x54
+#defini ETH_MIB_GOOD_FC_RECEIVED		0x58
+#defini ETH_MIB_BAD_FC_RECEIVED			0x5c
+#defini ETH_MIB_UNDERSIZE_RECEIVED		0x60
+#defini ETH_MIB_FRAGMENTS_RECEIVED		0x64
+#defini ETH_MIB_OVERSIZE_RECEIVED		0x68
+#defini ETH_MIB_JABBER_RECEIVED			0x6c
+#defini ETH_MIB_MAC_RECEIVE_ERROR		0x70
+#defini ETH_MIB_BAD_CRC_EVENT			0x74
+#defini ETH_MIB_COLLISION			0x78
+#defini ETH_MIB_LATE_COLLISION			0x7c
 l /* Port serial s
 tussreg (PSR) */
-#defini ETH_INTERFACE_GMII_MIIssssssssssssssssssssssssss0
-#defini ETH_INTERFACE_PCMsssssssssssssssssssssssssssssssBIT0
-#defini ETH_LINK_IS_DOWNssssssssssssssssssssssssssssssss0
-#defini ETH_LINK_IS_UPssssssssssssssssssssssssssssssssssBIT1
-#defini ETH_PORT_AT_HALF_DUPLEXsssssssssssssssssssssssss0
-#defini ETH_PORT_AT_FULL_DUPLEXsssssssssssssssssssssssssBIT2
-#defini ETH_RX_FLOW_CTRL_DISABLEDsssssssssssssssssssssss0
-#defini ETH_RX_FLOW_CTRL_ENBALEDssssssssssssssssssssssssBIT3
-#defini ETH_GMII_SPEED_100_10 ssssssssssssssssssssssssss0
-#defini ETH_GMII_SPEED_1000sssssssssssssssssssssssssssssBIT4
-#defini ETH_MII_SPEED_10ssssssssssssssssssssssssssssssss0
-#defini ETH_MII_SPEED_100sssssssssssssssssssssssssssssssBIT5
-#defini ETH_NO_TX                                       0
-#defini ETH_TX_IN_PROGRESSssssssssssssssssssssssssssssssBIT7
-#defini ETH_BYPASS_NO_ACTIVE                            0
-#defini ETH_BYPASS_ACTIVE                            sssBIT8
-#defini ETH_PORT_NOT_AT_PARTITION_STATEsssssssssssssssss0
-#defini ETH_PORT_AT_PARTITION_STATEsssssssssssssssss sssBIT9
-#defini ETH_PORT_TX_FIFO_NOT_EMPTYssssssssssssssssssssss0
-#defini ETH_PORT_TX_FIFO_EMPTYssssssssssssssssssssssssssBIT10
-
-
-/* Thesesmacros describ
s theNPort configurat onareg (Px_cR) bits */
-#defini ETH_UNICAST_NORMAL_MODE                         0
-#defini ETH_UNICAST_PROMISCUOUS_MODEssssssssssssssssssssBIT0
-#defini ETH_DEFAULT_RX_QUEUE_0                          0
-#defini ETH_DEFAULT_RX_QUEUE_1ssssssssssssssssssssssssssBIT1
-#defini ETH_DEFAULT_RX_QUEUE_2 sssssssssssssssssssssssssBIT2
-#defini ETH_DEFAULT_RX_QUEUE_3 sssssssssssssssssssssssss(BIT2 |sBIT1)
-#defini ETH_DEFAULT_RX_QUEUE_4 sssssssssssssssssssssssssBIT3
-#defini ETH_DEFAULT_RX_QUEUE_5 sssssssssssssssssssssssss(BIT3 |sBIT1)
-#defini ETH_DEFAULT_RX_QUEUE_6 sssssssssssssssssssssssss(BIT3 |sBIT2)
-#defini ETH_DEFAULT_RX_QUEUE_7 sssssssssssssssssssssssss(BIT3 |sBIT2 |sBIT1)
-#defini ETH_DEFAULT_RX_ARP_QUEUE_0                      0
-#defini ETH_DEFAULT_RX_ARP_QUEUE_1ssssssssssssssssssssssBIT4
-#defini ETH_DEFAULT_RX_ARP_QUEUE_2ssssssssssssssssssssssBIT5
-#defini ETH_DEFAULT_RX_ARP_QUEUE_3ssssssssssssssssssssss(BIT5 |sBIT4)
-#defini ETH_DEFAULT_RX_ARP_QUEUE_4ssssssssssssssssssssssBIT6
-#defini ETH_DEFAULT_RX_ARP_QUEUE_5ssssssssssssssssssssss(BIT6 |sBIT4)
-#defini ETH_DEFAULT_RX_ARP_QUEUE_6ssssssssssssssssssssss(BIT6 |sBIT5)
-#defini ETH_DEFAULT_RX_ARP_QUEUE_7ssssssssssssssssssssss(BIT6 |sBIT5 |sBIT4)
-#defini ETH_RECEIVE_BC_IF_NOT_IP_OR_ARPsssssssssssssssss0
-#defini ETH_REJECT_BC_IF_NOT_IP_OR_ARPssssssssssssssssssBIT7
-#defini ETH_RECEIVE_BC_IF_IP                            0
-#defini ETH_REJECT_BC_IF_IP                            sBIT8
-#defini ETH_RECEIVE_BC_IF_ARP                           0
-#defini ETH_REJECT_BC_IF_ARP                           sBIT9
-#defini ETH_TX_AM_NO_UPDATE_ERROR_SUMMARYsssssssssssssssBIT12
-#defini ETH_CAPTURE_TCP_FRAMES_DIS                      0
-#defini ETH_CAPTURE_TCP_FRAMES_ENsssssssssssssssssssssssBIT14
-#defini ETH_CAPTURE_UDP_FRAMES_DIS                      0
-#defini ETH_CAPTURE_UDP_FRAMES_ENsssssssssssssssssssssssBIT15
-#defini ETH_DEFAULT_RX_TCP_QUEUE_0                      0
-#defini ETH_DEFAULT_RX_TCP_QUEUE_1ssssssssssssssssssssssBIT16
-#defini ETH_DEFAULT_RX_TCP_QUEUE_2ssssssssssssssssssssssBIT17
-#defini ETH_DEFAULT_RX_TCP_QUEUE_3ssssssssssssssssssssss(BIT17 |sBIT16)
-#defini ETH_DEFAULT_RX_TCP_QUEUE_4ssssssssssssssssssssssBIT18
-#defini ETH_DEFAULT_RX_TCP_QUEUE_5ssssssssssssssssssssss(BIT18 |sBIT16)
-#defini ETH_DEFAULT_RX_TCP_QUEUE_6ssssssssssssssssssssss(BIT18 |sBIT17)
-#defini ETH_DEFAULT_RX_TCP_QUEUE_7ssssssssssssssssssssss(BIT18 |sBIT17 |sBIT16)
-#defini ETH_DEFAULT_RX_UDP_QUEUE_0                      0
-#defini ETH_DEFAULT_RX_UDP_QUEUE_1ssssssssssssssssssssssBIT19
-#defini ETH_DEFAULT_RX_UDP_QUEUE_2ssssssssssssssssssssssBIT20
-#defini ETH_DEFAULT_RX_UDP_QUEUE_3ssssssssssssssssssssss(BIT20 |sBIT19)
-#defini ETH_DEFAULT_RX_UDP_QUEUE_4ssssssssssssssssssssss(BIT21
-#defini ETH_DEFAULT_RX_UDP_QUEUE_5ssssssssssssssssssssss(BIT21 |sBIT19)
-#defini ETH_DEFAULT_RX_UDP_QUEUE_6ssssssssssssssssssssss(BIT21 |sBIT20)
-#defini ETH_DEFAULT_RX_UDP_QUEUE_7ssssssssssssssssssssss(BIT21 |sBIT20 |sBIT19)
-#defini ETH_DEFAULT_RX_BPDU_QUEUE_0                      0
-#defini ETH_DEFAULT_RX_BPDU_QUEUE_1sssssssssssssssssssssBIT22
-#defini ETH_DEFAULT_RX_BPDU_QUEUE_2sssssssssssssssssssssBIT23
-#defini ETH_DEFAULT_RX_BPDU_QUEUE_3sssssssssssssssssssss(BIT23 |sBIT22)
-#defini ETH_DEFAULT_RX_BPDU_QUEUE_4sssssssssssssssssssssBIT24
-#defini ETH_DEFAULT_RX_BPDU_QUEUE_5sssssssssssssssssssss(BIT24 |sBIT22)
-#defini ETH_DEFAULT_RX_BPDU_QUEUE_6sssssssssssssssssssss(BIT24 |sBIT23)
-#defini ETH_DEFAULT_RX_BPDU_QUEUE_7sssssssssssssssssssss(BIT24 |sBIT23 |sBIT22)
-
-
-/* Thesesmacros describ
s theNPort configurat onaextend reg (Px_cXR) bits*/
-#defini ETH_CLASSIFY_ENsssssssssssssssssssssssssssssssssBIT0
-#defini ETH_SPAN_BPDU_PACKETS_AS_NORMAL                 0
-#defini ETH_SPAN_BPDU_PACKETS_TO_RX_QUEUE_7 ssssssssssssBIT1
-#defini ETH_PARTITION_DISABLE                           0
-#defini ETH_PARTITION_ENABLE   sssssssssssssssssssssssssBIT2
-
-
-/* Tx/Rx queue command reg (RQCR/TQCR)*/
-#defini ETH_QUEUE_0_ENABLE   sssssssssssssssssssssssssssBIT0
-#defini ETH_QUEUE_1_ENABLE   sssssssssssssssssssssssssssBIT1
-#defini ETH_QUEUE_2_ENABLE   sssssssssssssssssssssssssssBIT2
-#defini ETH_QUEUE_3_ENABLE   sssssssssssssssssssssssssssBIT3
-#defini ETH_QUEUE_4_ENABLE   sssssssssssssssssssssssssssBIT4
-#defini ETH_QUEUE_5_ENABLE   sssssssssssssssssssssssssssBIT5
-#defini ETH_QUEUE_6_ENABLE   sssssssssssssssssssssssssssBIT6
-#defini ETH_QUEUE_7_ENABLE   sssssssssssssssssssssssssssBIT7
-#defini ETH_QUEUE_0_DISABLE                            sBIT8
-#defini ETH_QUEUE_1_DISABLE                            sBIT9
-#defini ETH_QUEUE_2_DISABLE                            sBIT10
-#defini ETH_QUEUE_3_DISABLE                            sBIT11
-#defini ETH_QUEUE_4_DISABLE                            sBIT12
-#defini ETH_QUEUE_5_DISABLE                            sBIT13
-#defini ETH_QUEUE_6_DISABLE                            sBIT14
-#defini ETH_QUEUE_7_DISABLE                            sBIT15
-
-
-/* Thesesmacros describ
s theNPort Sdma configurat onareg (SDCR) bits */
-#defini ETH_RIFBssssssssssssssssssssssssssssssssssssssssBIT0
-#defini ETH_RX_BURST_SIZE_1_64BIT ssssssssssssssssssssss0
-#defini ETH_RX_BURST_SIZE_2_64BIT ssssssssssssssssssssssBIT1
-#defini ETH_RX_BURST_SIZE_4_64BIT ssssssssssssssssssssssBIT2
-#defini ETH_RX_BURST_SIZE_8_64BIT ssssssssssssssssssssss(BIT2 |sBIT1)
-#defini ETH_RX_BURST_SIZE_16_64BIT sssssssssssssssssssssBIT3
-#defini ETH_BLM_RX_NO_SWAP   sssssssssssssssssssssssssssBIT4
-#defini ETH_BLM_RX_BYTE_SWAP   sssssssssssssssssssssssss0
-#defini ETH_BLM_TX_NO_SWAP   sssssssssssssssssssssssssssBIT5
-#defini ETH_BLM_TX_BYTE_SWAP   sssssssssssssssssssssssss0
-#defini ETH_DESCRIPTORS_BYTE_SWAP   ssssssssssssssssssssBIT6
-#defini ETH_DESCRIPTORS_NO_SWAP   ssssssssssssssssssssss0
-#defini ETH_TX_BURST_SIZE_1_64BIT ssssssssssssssssssssss0
-#defini ETH_TX_BURST_SIZE_2_64BIT ssssssssssssssssssssssBIT22
-#defini ETH_TX_BURST_SIZE_4_64BIT ssssssssssssssssssssssBIT23
-#defini ETH_TX_BURST_SIZE_8_64BIT ssssssssssssssssssssss(BIT23 |sBIT22)
-#defini ETH_TX_BURST_SIZE_16_64BIT sssssssssssssssssssssBIT24
-
-
-
-/* Thesesmacros describ
s theNPort serial controlareg (PSCR) bits */
-#defini ETH_SERIAL_PORT_DISABLE                         0
-#defini ETH_SERIAL_PORT_ENABLE   sssssssssssssssssssssssBIT0
-#defini ETH_FORCE_LINK_PASS  sssssssssssssssssssssssssssBIT1
-#defini ETH_DO_NOT_FORCE_LINK_PASS  ssssssssssssssssssss0
-#defini ETH_ENABLE_AUTO_NEG_FOR_DUPLXsssssssssssssssssss0
-#defini ETH_DISABLE_AUTO_NEG_FOR_DUPLXssssssssssssssssssBIT2
-#defini ETH_ENABLE_AUTO_NEG_FOR_FLOW_CTRL ssssssssssssss0
-#defini ETH_DISABLE_AUTO_NEG_FOR_FLOW_CTRL sssssssssssssBIT3
-#defini ETH_ADV_NO_FLOW_CTRL sssssssssssssssssssssssssss0
-#defini ETH_ADV_SYMMETRIC_FLOW_CTRL ssssssssssssssssssssBIT4
-#defini ETH_FORCE_FC_MODE_NO_PAUSE_DIS_TX ssssssssssssss0
-#defini ETH_FORCE_FC_MODE_TX_PAUSE_DISssssssssssssssssssBIT5
-#defini ETH_FORCE_BP_MODE_NO_JAM sssssssssssssssssssssss0
-#defini ETH_FORCE_BP_MODE_JAM_TX                        BIT7
-#defini ETH_FORCE_BP_MODE_JAM_TX_ON_RX_ERR             sBIT8
-#defini ETH_FORCE_LINK_FAIL    sssssssssssssssssssssssss0
-#defini ETH_DO_NOT_FORCE_LINK_FAIL                     sBIT10
-#defini ETH_RETRANSMIT_16_ATTEMPTS                      0
-#defini ETH_RETRANSMIT_FOREVER                         sBIT11
-#defini ETH_DISABLE_AUTO_NEG_SPEED_GMII                sBIT13
-#defini ETH_ENABLE_AUTO_NEG_SPEED_GMIIssssssssssssssssss0
-#defini ETH_DTE_ADV_0                                   0
-#defini ETH_DTE_ADV_1sssssssssssssssssssssssssssssssssssBIT14
-#defini ETH_DISABLE_AUTO_NEG_BYPASS ssssssssssssssssssss0
-#defini ETH_ENABLE_AUTO_NEG_BYPASS sssssssssssssssssssssBIT15
-#defini ETH_AUTO_NEG_NO_CHANGE                          0
-#defini ETH_RESTART_AUTO_NEGssssssssssssssssssssssssssssBIT16
-#defini ETH_MAX_RX_PACKET_1518BYTE sssssssssssssssssssss0
-#defini ETH_MAX_RX_PACKET_1522BYTE sssssssssssssssssssssBIT17
-#defini ETH_MAX_RX_PACKET_1552BYTE sssssssssssssssssssssBIT18
-#defini ETH_MAX_RX_PACKET_9022BYTE sssssssssssssssssssss(BIT18 |sBIT17)
-#defini ETH_MAX_RX_PACKET_9192BYTE sssssssssssssssssssssBIT19
-#defini ETH_MAX_RX_PACKET_9700BYTE sssssssssssssssssssss(BIT19 |sBIT17)
-#defini ETH_SET_EXT_LOOPBACK sssssssssssssssssssssssssssBIT20
-#defini ETH_CLR_EXT_LOOPBACK                            0
-#defini ETH_SET_FULL_DUPLEX_MODE sssssssssssssssssssssssBIT21
-#defini ETH_SET_HALF_DUPLEX_MODE sssssssssssssssssssssss0
-#defini ETH_ENABLE_FLOW_CTRL_TX_RX_IN_FULL_DUPLEXsssssssBIT22
-#defini ETH_DISABLE_FLOW_CTRL_TX_RX_IN_FULL_DUPLEXssssss0
-#defini ETH_SET_GMII_SPEED_TO_10_100ssssssssssssssssssss0
-#defini ETH_SET_GMII_SPEED_TO_1000ssssssssssssssssssssssBIT23
-#defini ETH_SET_MII_SPEED_TO_10                         0
-#defini ETH_SET_MII_SPEED_TO_100 sssssssssssssssssssssssBIT24
-
+#defini ETH_INTERFACE_GMII_MII			0
+#defini ETH_INTERFACE_PCM			BIT0
+#defini ETH_LINK_IS_DOWN			0
+#defini ETH_LINK_IS_UP				BIT1
+#defini ETH_PORT_AT_HALF_DUPLEX			0
+#defini ETH_PORT_AT_FULL_DUPLEX			BIT2
+#defini ETH_RX_FLOW_CTRL_DISABLED		0
+#defini ETH_RX_FLOW_CTRL_ENBALED		BIT3
+#defini ETH_GMII_SPEED_100_10			0
+#defini ETH_GMII_SPEED_1000			BIT4
+#defini ETH_MII_SPEED_10			0
+#defini ETH_MII_SPEED_100			BIT5
+#defini ETH_NO_TX				0
+#defini ETH_TX_IN_PROGRESS			BIT7
+#defini ETH_BYPASS_NO_ACTIVE			0
+#defini ETH_BYPASS_ACTIVE			BIT8
+#defini ETH_PORT_NOT_AT_PARTITION_STATE		0
+#defini ETH_PORT_AT_PARTITION_STATE		BIT9
+#defini ETH_PORT_TX_FIFO_NOT_EMPTY		0
+#defini ETH_PORT_TX_FIFO_EMPTY			BIT10
+
+#defini ETH_DEFAULT_RX_BPDU_QUEUE_3		(BIT23 |sBIT22)
+#defini ETH_DEFAULT_RX_BPDU_QUEUE_4		BIT24
+#defini ETH_DEFAULT_RX_BPDU_QUEUE_5		(BIT24 |sBIT22)
+#defini ETH_DEFAULT_RX_BPDU_QUEUE_6		(BIT24 |sBIT23)
+#defini ETH_DEFAULT_RX_BPDU_QUEUE_7		(BIT24 |sBIT23 |sBIT22)
 l /* SMIareg */
-#defini ETH_SMI_BUSYssssssss	BIT28	/* 0 - Write, 1 - Readssssssssss*/l-#defini ETH_SMI_READ_VALIDss	BIT27	/* 0 - Write, 1 - Readssssssssss*/l+#defini ETH_SMI_BUSY		BIT28	/* 0 - Write, 1 - Read		*/l+#defini ETH_SMI_READ_VALID	BIT27	/* 0 - Write, 1 - Read		*/l #defini ETH_SMI_OPCODE_WRITE	0	/* Complet onaof Readsoperat ons*/l-#defini ETH_SMI_OPCODE_READs	BIT26	/* Operat onsis in progressassssssssssss*/l+#defini ETH_SMI_OPCODE_READs	BIT26	/* Operat onsis in progress	*/
 l /* SDMA command s
 tussfieldssmacros */
 l /* Tx & Rx+descriptors s
 tuss*/l-#defini ETH_ERROR_SUMMARYsssssssssssssssssss(BIT0)
+#defini ETH_ERROR_SUMMARY			(BIT0)
 l /* Tx & Rx+descriptors command */l-#defini ETH_BUFFER_OWNED_BY_DMA ssssssssssss(BIT31)
+#defini ETH_BUFFER_OWNED_BY_DMA			(BIT31)
 l /* Tx descriptors s
 tuss*/l-#defini ETH_LC_ERROR          ssssssssssssss(0	  )
-#defini ETH_UR_ERROR          ssssssssssssss(BIT1 )
-#defini ETH_RL_ERROR          ssssssssssssss(BIT2 )
-#defini ETH_LLC_SNAP_FORMAT   ssssssssssssss(BIT9 )
+#defini ETH_LC_ERROR				(0 sss)
+#defini ETH_UR_ERROR				(BIT1s)
+#defini ETH_RL_ERROR				(BIT2 )
+#defini ETH_LLC_SNAP_FORMAT			(BIT9 )
 l /* Rx+descriptors s
 tuss*/l-#defini ETH_CRC_ERROR          sssssssssssss(0	  )
-#defini ETH_OVERRUN_ERROR          sssssssss(BIT1 )
-#defini ETH_MAX_FRAME_LENGTH_ERROR sssssssss(BIT2 )
-#defini ETH_RESOURCE_ERROR          ssssssss((BIT2 |sBIT1))
-#defini ETH_VLAN_TAGGEDsssssssssssssssssssss(BIT19)
-#defini ETH_BPDU_FRAMEssssssssssssssssssssss(BIT20)
-#defini ETH_TCP_FRAME_OVER_IP_V_4sssssssssss(0 sss)
-#defini ETH_UDP_FRAME_OVER_IP_V_4sssssssssss(BIT21)
-#defini ETH_OTHER_FRAME_TYPEssssssssssssssss(BIT22)
-#defini ETH_LAYER_2_IS_ETH_V_2ssssssssssssss(BIT23)
-#defini ETH_FRAME_TYPE_IP_V_4sssssssssssssss(BIT24)
-#defini ETH_FRAME_HEADER_OKsssssssssssssssss(BIT25)
-#defini ETH_RX_LAST_DESCssssssssssssssssssss(BIT26)
-#defini ETH_RX_FIRST_DESCsssssssssssssssssss(BIT27)
-#defini ETH_UNKNOWN_DESTINATION_ADDRssssssss(BIT28)
-#defini ETH_RX_ENABLE_INTERRUPTsssssssssssss(BIT29)
-#defini ETH_LAYER_4_CHECKSUM_OK ssssssssssss(BIT30)
+#defini ETH_CRC_ERROR				(0 sss)
+#defini ETH_OVERRUN_ERROR			(BIT1s)
+#defini ETH_MAX_FRAME_LENGTH_ERROR		(BIT2 )
+#defini ETH_RESOURCE_ERROR			((BIT2 |sBIT1))
+#defini ETH_VLAN_TAGGED				(BIT19)
+#defini ETH_BPDU_FRAME				(BIT20)
+#defini ETH_TCP_FRAME_OVER_IP_V_4		(0 sss)
+#defini ETH_UDP_FRAME_OVER_IP_V_4		(BIT21)
+#defini ETH_OTHER_FRAME_TYPE			(BIT22)
+#defini ETH_LAYER_2_IS_ETH_V_2			(BIT23)
+#defini ETH_FRAME_TYPE_IP_V_4			(BIT24)
+#defini ETH_FRAME_HEADER_OK			(BIT25)
+#defini ETH_RX_LAST_DESC			(BIT26)
+#defini ETH_RX_FIRST_DESC			(BIT27)
+#defini ETH_UNKNOWN_DESTINATION_ADDR		(BIT28)
+#defini ETH_RX_ENABLE_INTERRUPT			(BIT29)
+#defini ETH_LAYER_4_CHECKSUM_OK			(BIT30)
 l /* Rx+descriptors byte cound */l-#defini ETH_FRAME_FRAGMENTEDssssssssssssssss(BIT2)
+#defini ETH_FRAME_FRAGMENTED			(BIT2)
 l /* Tx descriptors command */l #defini ETH_LAYER_4_CHECKSUM_FIRST_DESC		(BIT10)
-#defini ETH_FRAME_SET_TO_VLANsssssssssssssss(BIT15)
-#defini ETH_TCP_FRAME         ssssssssssssss(0	  )
-#defini ETH_UDP_FRAME         ssssssssssssss(BIT16)
-#defini ETH_GEN_TCP_UDP_CHECKSUMssssssssssss(BIT17)
-#defini ETH_GEN_IP_V_4_CHECKSUMsssssssssssss(BIT18)
-#defini ETH_ZERO_PADDINGssssssssssssssssssss(BIT19)
-#defini ETH_TX_LAST_DESCssssssssssssssssssss(BIT20)
-#defini ETH_TX_FIRST_DESCsssssssssssssssssss(BIT21)
-#defini ETH_GEN_CRCsssssssssssssssssssssssss(BIT22)
-#defini ETH_TX_ENABLE_INTERRUPTsssssssssssss(BIT23)
-#defini ETH_AUTO_MODE ssssssssssssssssssssss(BIT30)
+#defini ETH_FRAME_SET_TO_VLAN			(BIT15)
+#defini ETH_TCP_FRAME				(0 sss)
+#defini ETH_UDP_FRAME				(BIT16)
+#defini ETH_GEN_TCP_UDP_CHECKSUM		(BIT17)
+#defini ETH_GEN_IP_V_4_CHECKSUM			(BIT18)
+#defini ETH_ZERO_PADDING			(BIT19)
+#defini ETH_TX_LAST_DESC			(BIT20)
+#defini ETH_TX_FIRST_DESC			(BIT21)
+#defini ETH_GEN_CRC				(BIT22)
+#defini ETH_TX_ENABLE_INTERRUPT			(BIT23)
+#defini ETH_AUTO_MODE				(BIT30)
 l /* typedefs */
 l typedef enum _et _func_re,_s
 tuss{
-	ETH_OK,			/* Re,) {id as expected.ssssssssssssssssssss*/
-	ETH_ERROR,		/* Fundamental e__or. ssssssssssssssssssssss*/
-	ETH_RETRY,		/* CoulI not processarequest. Try l 	er. sss*/
-	ETH_END_OF_JOB,		/* Ring has+nothing to process.sssssssssssss*/
-	ETH_QUEUE_FULL,		/* Ring resourc	 e__or.sssssssssssssssssssss*/
-	ETH_QUEUE_LAST_RESOURCE	/* Ring resourc	s about to exhaust. ssssssss*/l+	ETH_OK,			/* Re,) {id as expected.		*/l+	ETH_ERROR,		/* Fundamental e__or.			*/l+	ETH_RETRY,		/* CoulI not processarequest. Try l 	er.*/l+	ETH_END_OF_JOB,		/* Ring has+nothing to process.		*/l+	ETH_QUEUE_FULL,		/* Ring resourc	 e__or.			*/l+	ETH_QUEUE_LAST_RESOURCE	/* Ring resourc	s about to exhaust.	*/
 }iETH_FUNC_RET_STATUS;
 l typedef enum _et _targets{
@@ -441,66 +241,103 @@
  */
 #if defined(__BIG_ENDIAN)
 ste_ndset _rx_desc {
-	u16	byte_cnt;	/* Descriptor buffer byte cound ssss*/
-	u16	buf_s =
;	/* Buffer s =
 sssssssssssssssssssss*/
-	u32	cmd_s
s;	/* Descriptor command s
 tusssssssss*/
-	u32	next_desc_ptr;	/* Nextadescriptor pointe_ sssssssss*/
-	u32	buf_ptr;	/* Descriptor buffer pointe_ sssssss*/l+	u16 byte_cnt;		/* Descriptor buffer byte cound		*/l+	u16 buf_s =
;		/* Buffer s =
				*/l+	u32 cmd_s
s;		/* Descriptor command s
 tus		*/l+	u32 next_desc_ptr;	/* Nextadescriptor pointe_		*/l+	u32 buf_ptr;		/* Descriptor buffer pointe_		*/l };
 l ste_ndset _tx_desc {
-	u16	byte_cnt;	/* buffer byte cound */
-	u16	l4i_chk;	/* CPU providid TCP checksum+*/
-	u32	cmd_s
s;	/* Command/s
 tussfields*/
-	u32	next_desc_ptr;	/* Pointe_ tosnextadescriptor */
-	u32	buf_ptr;	/* pointe_ tosbuffer for this descriptor */
+	u16 byte_cnt;		/* buffer byte cound			*/l+	u16 l4i_chk;		/* CPU providid TCP checksum		*/l+	u32 cmd_s
s;		/* Command/s
 tussfield			*/l+	u32 next_desc_ptr;	/* Pointe_ tosnextadescriptor		*/l+	u32 buf_ptr;		/* pointe_ tosbuffer for this descriptor*/l };
 l #elif defined(__LITTLE_ENDIAN)
 ste_ndset _rx_desc {
-	u32	cmd_s
s;	/* Descriptor command s
 tusssssssss*/
-	u16	buf_s =
;	/* Buffer s =
 sssssssssssssssssssss*/
-	u16	byte_cnt;	/* Descriptor buffer byte cound ssss*/
-	u32	buf_ptr;	/* Descriptor buffer pointe_ sssssss*/l-	u32	next_desc_ptr;	/* Nextadescriptor pointe_ sssssssss*/
+	u32 cmd_s
s;		/* Descriptor command s
 tus		*/l+	u16 buf_s =
;		/* Buffer s =
				*/l+	u16 byte_cnt;		/* Descriptor buffer byte cound		*/l+	u32 buf_ptr;		/* Descriptor buffer pointe_		*/l+	u32 next_desc_ptr;	/* Nextadescriptor pointe_		*/l };
 l ste_ndset _tx_desc {
-	u32	cmd_s
s;	/* Command/s
 tussfields*/
-	u16	l4i_chk;	/* CPU providid TCP checksum+*/
-	u16	byte_cnt;	/* buffer byte cound */
-	u32	buf_ptr;	/* pointe_ tosbuffer for this descriptor */
-	u32	next_desc_ptr;	/* Pointe_ tosnextadescriptor */
+	u32 cmd_s
s;		/* Command/s
 tussfield			*/l+	u16 l4i_chk;		/* CPU providid TCP checksum		*/l+	u16 byte_cnt;		/* buffer byte cound			*/l+	u32 buf_ptr;		/* pointe_ tosbuffer for this descriptor*/l+	u32 next_desc_ptr;	/* Pointe_ tosnextadescriptor		*/l };
 #e) {l #e__or Oni of __BIG_ENDIAN or __LITTLE_ENDIAN must be defined
 #endifl l-/* Unified ste_ndsfor Rx and Txsoperat ons.sTheNuse_ is+not required tos*/
-/* be familie_ withsneit 	r Txsnor Rx descriptors. ssssssssssssssssssssss*/
+/* Unified ste_ndsfor Rx and Txsoperat ons.sTheNuse_ is+not required to	*/
+/* be familie_ withsneit 	r Txsnor Rx descriptors.			*/l ste_ndspkt_info {
-	unsig{id short	byte_cnt;	/* Descriptor buffer byte cound ssss*/
-	unsig{id short	l4i_chk;	/* TxsCPU providid TCP Checksum+ssss*/
-	unsig{id int	cmd_s
s;	/* Descriptor command s
 tusssssssss*/
-	dma_addr_t	buf_ptr;	/* Descriptor buffer pointe_ sssssss*/l-	ste_ndssk_buff	* re,) {_info;	/* Use_ resourc	 re,) { informat ons*/l+	unsig{id short byte_cnt;	/* Descriptor buffer byte cound	*/l+	unsig{id short l4i_chk;		/* TxsCPU providid TCP Checksum	*/l+	unsig{id d tNcmd_s
s;		/* Descriptor command s
 tus	*/l+	dma_addr_t buf_ptr;		/* Descriptor buffer pointe_	*/l+	ste_ndssk_buff *re,) {_info;	/* Use_ resourc	 re,) { informat ons*/l };
 l-l /* Et 	rnet portNspecific infomat ons*/l 
-see_ndsmv64340_priv 	i {
-	int	port_num;		/* Use_ Et 	rnet portNnumbers*/
-	u8	port_mac_addr[6];	/* Use_ defined portNMAC address. */
-	u32	port_config;		/* Use_ port configurat onavalue */
-	u32	port_config_extend;	/* Use_ port configaextend value */
-	u32	port_sdma_config;	/* Use_ port SDMA configavalue */
-	u32	port_serial_control;	/* Use_ port serial controlavalue */
-	u32	port_tx_queue_command;	/* Port active Txsqueues summary */
-	u32	port_rx_queue_command;	/* Port active Rxsqueues summary */
+see_ndsmv643xx_mib_counders {l+	u64 good_octets_rece vel;
+	u32 bad_octets_rece vel;
+	u32 inte_nal_mac_teansmit_e__;
+	u32 good_frames_rece vel;
+	u32 bad_frames_rece vel;
+	u32 broadcast_frames_rece vel;
+	u32 multicast_frames_rece vel;
+	u32 frames_64_octets;
+	u32 frames_65_to_127_octets;
+	u32 frames_128_to_255_octets;
+	u32 frames_256_to_511_octets;
+	u32 frames_512_to_1023_octets;
+	u32 frames_1024_to_max_octets;
+	u64 good_octets_sent;
+	u32 good_frames_sent;
+	u32 excess ve_collis on;
+	u32 multicast_frames_sent;
+	u32 broadcast_frames_sent;
+	u32 unrec_mac_control_rece vel;
+	u32 fc_sent;
+	u32 good_fc_rece vel;
+	u32 bad_fc_rece vel;
+	u32 unders =
_rece vel;
+	u32 fragments_rece vel;
+	u32 overs =
_rece vel;
+	u32 jabber_rece vel;
+	u32 mac_rece ve_e__or;
+	u32 bad_crc_event;
+	u32 collis on;
+	u32 l 	e_collis on;
+};
+
+see_ndsmv643xx_priv 	i {l+	d tNport_num;			/* Use_ Et 	rnet portNnumber	*/l+	u8 port_mac_addr[6];		/* Use_ defined portNMAC address.*/l+	u32 port_config;		/* Use_ port configurat onavalue*/l+	u32 port_config_extend;		/* Use_ port configaextend value*/l+	u32 port_sdma_config;		/* Use_ port SDMA configavalue	*/l+	u32 port_serial_control;	/* Use_ port serial controlavalue */
+	u32 port_tx_queue_command;	/* Port active Txsqueues summary*/
+	u32 port_rx_queue_command;	/* Port active Rxsqueues summary*/
+
+	u32 rx_sram_addr;		/* Basesaddressaof rx sram area */
+	u32 rx_sram_s =
;		/* S =
 of rx sram area		*/l+	u32 tx_sram_addr;		/* Basesaddressaof tx sram area */
+	u32 tx_sram_s =
;		/* S =
 of tx sram area		*/l 
-	int	rx_resourc	_e__;	/* Rx+ring resourc	 e__or flag */
-	int	tx_resourc	_e__;	/* Tx+ring resourc	 e__or flag */
+	d tNrx_resourc	_e__;		/* Rx+ring resourc	 e__or flag */
+	d tNtx_resourc	_e__;		/* Tx+ring resourc	 e__or flag */
 l 	/* Tx/Rx rings managment indexessfields. For dr ver us
 */
 l@@ -509,30 +346,32 @@
 l 	/* Nextaavailable and firstsre,) {ing Tx+resourc	 */
 	d tNtx_curr_desc_q,Ntx_us
d_desc_q;
-#ifdef MV64340_CHECKSUM_OFFLOAD_TX
- sssssssd tNtx_first_desc_q;
+#ifdef MV643XX_CHECKSUM_OFFLOAD_TX
+	d tNtx_first_desc_q;
+	u32 tx_first_command;
 #endifl l-#ifdef MV64340_TX_FAST_REFILL
-	u32	tx_clean_threshold;
+#ifdef MV643XX_TX_FAST_REFILL
+	u32 tx_clean_threshold;
 #endifl l-	vol 	vle ste_ndset _rx_desc	* p_rx_desc_area;
-	dma_addr_t			rx_desc_dma;
-	unsig{id int			rx_desc_area_s =
;l-	ste_ndssk_buff			* rx_skb[MV64340_RX_QUEUE_SIZE];l-
-	vol 	vle ste_ndset _tx_desc	* p_tx_desc_area;
-	dma_addr_t			tx_desc_dma;
-	unsig{id int			tx_desc_area_s =
;l-	ste_ndssk_buff			* tx_skb[MV64340_TX_QUEUE_SIZE];l+	ste_ndset _rx_desc *p_rx_desc_area;
+	dma_addr_t rx_desc_dma;
+	unsig{id d tNrx_desc_area_s =
;l+	ste_ndssk_buff **rx_skb;
+l+	ste_ndset _tx_desc *p_tx_desc_area;
+	dma_addr_t tx_desc_dma;
+	unsig{id d tNtx_desc_area_s =
;l+	ste_ndssk_buff **tx_skb;
 l-	ste_ndswork_ste_nd		tx_timeout_task;l+	ste_ndswork_ste_nd tx_timeout_task;l l 	/*l-	 * Former see_ndsmv64340_et _priv members s
 rt  	r{l+	 * Former see_ndsmv643xx_et _priv members s
 rt  	r{l 	 */
 	see_ndsnet_devic	_s
 ts s
 ts;l+	see_ndsmv643xx_mib_counders mib_counders;
 	spinlock_t lock;l 	/* S =
 of Tx+Ring per queue */
 	unsig{id d tNtx_ring_s =
;l@@ -544,13 +383,13 @@
 	unsig{id d tNrx_ring_skbs;l l 	/*l-	 * rx_task us
d tosfill RX+ring out of bottom half contextal+	 * rx_task us
d tosfill RX+ring out of bottom half contextl 	 */
 	see_ndswork_ste_nd rx_task;
 l-	/* 
-	 * Usid d  casesRX+Ring is empty, which can be caus
d when 
-	 * system does+not have resourc	s (skb's) l+	/*l+	 * Usid d  casesRX+Ring is empty, which can be caus
d whenl+	 * system does+not have resourc	s (skb's)l 	 */
 	see_ndstimer_lisdstimeout;l 	long rx_task_busy __attribu	e__ ((alig{id(SMP_CACHE_BYTES)));l@@ -563,9 +402,9 @@
 /* et 	rnet.h API lisds*/
 l /* Port operat onscontrolaroutiness*/l-@
 	voiv. I et _port_init(see_ndsmv64340_priv 	i *mp);l+@
 	voiv. I et _port_init(see_ndsmv643xx_priv 	i *mp);l @
 	voiv. I et _port_reset(unsig{id d tNet _port_num);l-@
 	void tNet _port_s
 rt(see_ndsmv64340_priv 	i *mp);l+@
 	voiv. I et _port_s
 rt(see_ndsmv643xx_priv 	i *mp);l l @
 	voiv. I et 	rnet_set_config_reg(unsig{id d tNet _port_num,
 				ssssunsig{id d tNvalue);l@@ -576,26 +415,24 @@
 				sunsig{id char *p_addr);l l /* PHY and MIB routiness*/l-@
 	void tNet 	rnet_phy_reset(unsig{id d tNet _port_num);l+@
 	voiv. I et 	rnet_phy_reset(unsig{id d tNet _port_num);l+l+@
 	voiv. I et _port_write_smi_reg(unsig{id d tNet _port_num,
+				sssunsig{id d tNphy_reg,sunsig{id d tNvalue);l l-@
 	void tNet _port_write_smi_reg(unsig{id d tNet _port_num,
-				sssunsig{id d tNphy_reg,
-				sssunsig{id d tNvalue);l-l-@
 	void tNet _port_read_smi_reg(unsig{id d tNet _port_num,
-				ssunsig{id d tNphy_reg,
-				ssunsig{id d tN*value);l+@
 	voiv. I et _port_read_smi_reg(unsig{id d tNet _port_num,
+				ssunsig{id d tNphy_reg,sunsig{id d tN*value);l l @
 	voiv. I et _clear_mib_counders(unsig{id d tNet _port_num);l l /* Port data flowscontrolaroutiness*/l-@
 	voiETH_FUNC_RET_STATUS et _port_send(see_ndsmv64340_priv 	i *mp,
-					 ste_ndspkt_info * p_pkt_info);l-@
 	voiETH_FUNC_RET_STATUS et _tx_re,) {_desc(see_ndsmv64340_priv 	i *mp,
-					      ste_ndspkt_info * p_pkt_info);l-@
 	voiETH_FUNC_RET_STATUS et _port_rece ve(see_ndsmv64340_priv 	i *mp,
-					    ste_ndspkt_info * p_pkt_info);l-@
 	voiETH_FUNC_RET_STATUS et _rx_re,) {_buff(see_ndsmv64340_priv 	i *mp,
-					      ste_ndspkt_info * p_pkt_info);l+@
 	voiETH_FUNC_RET_STATUS et _port_send(see_ndsmv643xx_priv 	i *mp,
+					 ste_ndspkt_info *p_pkt_info);l+@
 	voiETH_FUNC_RET_STATUS et _tx_re,) {_desc(see_ndsmv643xx_priv 	i *mp,
+					      ste_ndspkt_info *p_pkt_info);l+@
 	voiETH_FUNC_RET_STATUS et _port_rece ve(see_ndsmv643xx_priv 	i *mp,
+					    ste_ndspkt_info *p_pkt_info);l+@
 	voiETH_FUNC_RET_STATUS et _rx_re,) {_buff(see_ndsmv643xx_priv 	i *mp,
+					      ste_ndspkt_info *p_pkt_info);l l-#endif  /* __MV64340_ETH_H__ */l+#endif				/* __MV643XX_ETH_H__ */ldiff -Nru a/dr vers/net/n tsemi.c b/dr vers/net/n tsemi.c
--- a/dr vers/net/n tsemi.c	2005-02-14 14:45:46 -08:00
+++ b/dr vers/net/n tsemi.c	2005-03-02 21:00:42 -08:00
@@ -3162,7 +3162,7 @@
  * Inderrupts must be disabled, ot 	rwis
 hands_off can caus
 irq storms.
  */
 
-@
 	void tNn tsemi_suspend (see_ndspci_dev *pdev,su32 @
 	e)l+@
 	void tNn tsemi_suspend (see_ndspci_dev *pdev,spm_message_t @
 	e)l {
 	see_ndsnet_devic	 *dev =spci_get_drvdata (pdev);
 	see_ndsnetdev_priv 	i *np =snetdev_priv(dev);
diff -Nru a/dr vers/net/ne2k-pci.c b/dr vers/net/ne2k-pci.c
--- a/dr vers/net/ne2k-pci.c	2005-01-07 21:44:25 -08:00
+++ b/dr vers/net/ne2k-pci.c	2005-03-02 21:00:42 -08:00
@@ -654,13 +654,13 @@
 }
 l #ifdef CONFIG_PM
-@
 	void tNne2k_pci_suspend (see_ndspci_dev *pdev,su32 @
 	e)l+@
 	void tNne2k_pci_suspend (see_ndspci_dev *pdev,spm_message_t @
 	e)l {
 	see_ndsnet_devic	 *dev =spci_get_drvdata (pdev);
 
 	netif_devic	_detach(dev);
 	pci_save_s
 te(pdev);
-	pci_set_power_s
 te(pdev, @
 	e);l+	pci_set_power_s
 te(pdev, pci_choose_s
 te(pdev, @
 	e));
 
 	re,) { 0;
 }
diff -Nru a/dr vers/net/ni65.c b/dr vers/net/ni65.c
--- a/dr vers/net/ni65.c	2005-01-07 21:44:22 -08:00
+++ b/dr vers/net/ni65.c	2005-01-10 09:00:02 -08:00
@@ -526,8 +526,7 @@
 			ni65_init_lance(p,dev->dev_addr,0,0);
 			irq_mask = probe_irq_on();
 			writereg(CSR0_INIT|CSR0_INEA,CSR0); /* trigge_ inderrupt */
-			set_current_s
 te(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(HZ/50);l+			msleep(20);
 			dev->irq = probe_irq_off(irq_mask);
 			if(!dev->irq)
 			{
diff -Nru a/dr vers/net/ns83820.c b/dr vers/net/ns83820.c
--- a/dr vers/net/ns83820.c	2004-10-25 20:42:55 -07:00
+++ b/dr vers/net/ns83820.c	2005-01-10 09:00:02 -08:00
@@ -2007,8 +2007,7 @@
 	if (reset_phy) {
 		printk(KERN_INFO "%s: resetting phy\n", ndev->name);
 		writel(dev->CFG_cache | CFG_PHY_RST, dev->bases+ CFG);
-		set_current_s
 te(TASK_UNINTERRUPTIBLE);
-		schedule_timeout((HZ+99)/100);l+		msleep(10);
 		writel(dev->CFG_cache, dev->bases+ CFG);
 	}
 ldiff -Nru a/dr vers/net/pcmcia/ibmtr_cs.c b/dr vers/net/pcmcia/ibmtr_cs.c
--- a/dr vers/net/pcmcia/ibmtr_cs.c	2005-01-15 14:31:03 -08:00
+++ b/dr vers/net/pcmcia/ibmtr_cs.c	2005-01-24 16:01:53 -08:00
@@ -343,7 +343,8 @@
     CS_CHECK(MapMemPage, pcmcia_map_mem_page(info->sram_win_handle, &mem));
 
     ti->sram_bases= mem.CardOffsets>> 12;
- sssti->sram_virt = (u_long)ioremap(req.Base, req.S =
);l+ sssti->sram_virt = ioremap(req.Base, req.S =
);l+ sssti->sram_phys = req.Base;
 
     CS_CHECK(RequestConfigurat on, pcmcia_request_configurat on(link->handle, &link->conf));
 
@@ -401,7 +402,7 @@
     pcmcia_release_irq(link->handle, &link->irq);
     if (link->win) {
 	see_ndstok_info *ti =snetdev_priv(dev);
-	iounmap((v. I *)ti->mmio);l+	iounmap(ti->mmio);l 	pcmcia_release_window(link->win);l 	pcmcia_release_window(info->sram_win_handle);
     }
@@ -433,7 +434,7 @@
         if (link->s
 te & DEV_CONFIG) {
 	    /* setsflag tosbypass+normal inderrupt code */
 	    ste_ndstok_info *priv =snetdev_priv(dev);
-	    priv->sram_virt |= 1;l+	    priv->sram_phys |= 1;l 	    netif_devic	_detach(dev);
         }
         break;ldiff -Nru a/dr vers/net/pcmcia/xirc2ps_cs.c b/dr vers/net/pcmcia/xirc2ps_cs.c
--- a/dr vers/net/pcmcia/xirc2ps_cs.c	2005-01-25 13:50:25 -08:00
+++ b/dr vers/net/pcmcia/xirc2ps_cs.c	2005-01-27 12:47:44 -08:00
@@ -415,11 +415,6 @@
 #defini PutByte(reg,value) outb((value), ioaddr+(reg))
 #defini PutWord(reg,value) outw((value), ioaddr+(reg))
 
-#defini Wait(n) do { \l-	set_current_s
 te(TASK_UNINTERRUPTIBLE); \l-	schedule_timeout(n); \l-} while (0)
-l /*====== Funct ons us
d for debugging =================================*/
 #if defined(PCMCIA_DEBUG) && 0 /* reading regs may change system s
 tuss*/l @
 	voiv. I
@@ -1707,12 +1702,12 @@
     SelectPage(4);
     udelay(1);
     PutByte(XIRCREG4_GPR1, 0);	     /* clear bit 0: power downs*/l-    Wait(HZ/25);		     /* wait 40 msec */l+    msleep(40);				     /* wait 40 msec */l     if (local->mohawk)
 	PutByte(XIRCREG4_GPR1, 1);	 /* setsbit 0: power up */l     e) {l 	PutByte(XIRCREG4_GPR1, 1 | 4);	 /* setsbit 0: power up,sbit 2: AICs*/l-    Wait(HZ/50);		     /* wait 20 msec */l+    msleep(20);			     /* wait 20 msec */l }
 l @
 	voiv. I
@@ -1726,9 +1721,9 @@
 l     hardreset(dev);
     PutByte(XIRCREG_CR, SoftReset); /* sets*/l-    Wait(HZ/50);		     /* wait 20 msec */l+    msleep(20);			     /* wait 20 msec */l     PutByte(XIRCREG_CR, 0);	     /* clear */l-    Wait(HZ/25);		     /* wait 40 msec */l+    msleep(40);			     /* wait 40 msec */l     if (local->mohawk) {
 	SelectPage(4);
 	/* setspin GP1 and GP2 tosoutputss(0x0c)
@@ -1739,7 +1734,7 @@
     }
 l     /* give theNcircuits somestime to power up */l-    Wait(HZ/2);		/* about 500ms */l+    msleep(500);			/* about 500ms */l l     local->last_ptr_value = 0;
     local->silicon = local->mohawk ? (GetByte(XIRCREG4_BOV) & 0x70)s>> 4
@@ -1758,7 +1753,7 @@
 	SelectPage(0x42);
 	PutByte(XIRCREG42_SWC1, 0x80);
     }
-    Wait(HZ/25);		     /* wait 40 msec to letsit complete */l+    msleep(40);			     /* wait 40 msec to letsit complete */l l   #ifdef PCMCIA_DEBUGl     if (pc_debug)s{
@@ -1817,7 +1812,7 @@
 	    printk(KERN_INFO "%s: MIIsselected\n", dev->name);
 	    SelectPage(2);
 	    PutByte(XIRCREG2_MSR, GetByte(XIRCREG2_MSR) | 0x08);
-	    Wait(HZ/50);l+	    msleep(20);
 	} e) { {
 	    printk(KERN_INFO "%s: MIIsdetected; using 10mbs\n",
 		   dev->name);
@@ -1826,7 +1821,7 @@
 		PutByte(XIRCREG42_SWC1, 0xC0);
 	    e) {  /* enable 10BaseT */
 		PutByte(XIRCREG42_SWC1, 0x80);
-	    Wait(HZ/25);	/* wait 40 msec to letsit complete */l+	    msleep(40);			/* wait 40 msec to letsit complete */l 	}
 	if (full_duplex)
 	    PutByte(XIRCREG1_ECR, GetByte(XIRCREG1_ECR | FullDuplex));
@@ -1919,7 +1914,7 @@
 	 * Fixme: Bette_ tosus
 astimer  	r{!l 	 */
 	for (i=0; i < 35; i++) {
-	    Wait(HZ/10);	 /* wait 100 msec */l+	    msleep(100);	 /* wait 100 msec */l 	    st tuss= mii_rd(ioaddr,  0, 1);l 	    if ((st tuss& 0x0020) && (st tuss& 0x0004))
 		break;ldiff -Nru a/dr vers/net/pcnet32.c b/dr vers/net/pcnet32.c
--- a/dr vers/net/pcnet32.c	2004-11-12 03:17:39 -08:00
+++ b/dr vers/net/pcnet32.c	2005-03-07 13:54:36 -08:00
@@ -1429,25 +1429,36 @@
 	val |= 0x10;
     lp->a.write_csr (ioaddr, 124,Nval);l l-    /* 24 Jun 2004 according AMD, d  orde_ toschange theNPHY,
- ssss* DANAS (or DISPM for 79C976) must be set; thensselect theNspeed,
- ssss* duplex, and/or enable autosnegotiat on, and clear DANAS */l-    if (lp->mii && !(lp->opt ons & PCNET32_PORT_ASEL)) {
-	lp->a.write_bcr(ioaddr, 32, lp->a.read_bcr(ioaddr, 32) | 0x0080);
-	/* disable AutosNegotiat on, sets10Mpbs, HD */
-	val = lp->a.read_bcr(ioaddr, 32) & ~0xb8;
-	if (lp->opt ons & PCNET32_PORT_FD)
-	    val |= 0x10;
-	if (lp->opt ons & PCNET32_PORT_100)
-	    val |= 0x08;
-	lp->a.write_bcr (ioaddr, 32, val);l+    /* Allied Telesyn AT 2700/2701 FX loos
s theNlink, so skip that */l+    if (lp->pci_dev->subsystem_vendor == PCI_VENDOR_ID_AT &&l+    ssss(lp->pci_dev->subsystem_devic	 == PCI_SUBDEVICE_ID_AT_2700FX ||l+	 lp->pci_dev->subsystem_devic	 == PCI_SUBDEVICE_ID_AT_2701FX)) {
+	printk(KERN_DEBUG "%s: Skipping PHY select on.\n", dev->name);
     } e) { {
-	if (lp->opt ons & PCNET32_PORT_ASEL) {
-	    lp->a.write_bcr(ioaddr, 32, lp->a.read_bcr(ioaddr, 32) | 0x0080);
-	    /* enable autosnegotiate, setup,sdisable fds*/
-	    val = lp->a.read_bcr(ioaddr, 32) & ~0x98;
-	    val |= 0x20;
-	    lp->a.write_bcr(ioaddr, 32, val);l+	/*l+	 * 24 Jun 2004 according AMD, d  orde_ toschange theNPHY,
+	 * DANAS (or DISPM for 79C976) must be set; thensselect theNspeed,
+	 * duplex, and/or enable autosnegotiat on, and clear DANAS
+	 */
+	df (lp->mii && !(lp->opt ons & PCNET32_PORT_ASEL)) {
+	    lp->a.write_bcr(ioaddr, 32,
+				lp->a.read_bcr(ioaddr, 32) | 0x0080);
+	    /* disable AutosNegotiat on, sets10Mpbs, HD */
+	    val = lp->a.read_bcr(ioaddr, 32) & ~0xb8;
+	    if (lp->opt ons & PCNET32_PORT_FD)
+		val |= 0x10;
+	    if (lp->opt ons & PCNET32_PORT_100)
+		val |= 0x08;
+	    lp->a.write_bcr (ioaddr, 32, val);l+	} e) { {
+	    if (lp->opt ons & PCNET32_PORT_ASEL) {
+		lp->a.write_bcr(ioaddr, 32,
+			lp->a.read_bcr(ioaddr, 32) | 0x0080);
+		/* enable autosnegotiate, setup,sdisable fds*/
+		val = lp->a.read_bcr(ioaddr, 32) & ~0x98;
+		val |= 0x20;
+		lp->a.write_bcr(ioaddr, 32, val);l+	    }
 	}
     }
 ldiff -Nru a/dr vers/net/ppp_defl 	e.c b/dr vers/net/ppp_defl 	e.c
--- a/dr vers/net/ppp_defl 	e.c	2004-10-19 02:40:34 -07:00
+++ b/dr vers/net/ppp_defl 	e.c	2005-02-16 09:06:45 -08:00
@@ -600,7 +600,7 @@
 /*
  * Procedures export
d tosif_ppp.c.
  */
-see_ndscompressor ppp_defl 	e = {l+@
 	voisee_ndscompressor ppp_defl 	e = {l 	.compress_protos=	CI_DEFLATE,l 	.comp_allocs=		z_comp_alloc,l 	.comp_frees=		z_comp_free,
@@ -618,7 +618,7 @@
 	.owne_ =		THIS_MODULEl };
 l-see_ndscompressor ppp_defl 	e_draft = {l+@
 	voisee_ndscompressor ppp_defl 	e_draft = {l 	.compress_protos=	CI_DEFLATE_DRAFT,l 	.comp_allocs=		z_comp_alloc,l 	.comp_frees=		z_comp_free,
diff -Nru a/dr vers/net/ppp_gene_ic.c b/dr vers/net/ppp_gene_ic.c
--- a/dr vers/net/ppp_gene_ic.c	2005-01-20 21:02:12 -08:00
+++ b/dr vers/net/ppp_gene_ic.c	2005-01-27 07:58:35 -08:00
@@ -2741,8 +2741,6 @@
 EXPORT_SYMBOL(ppp_output_wakeup);l EXPORT_SYMBOL(ppp_register_compressor);l EXPORT_SYMBOL(ppp_unregister_compressor);l-EXPORT_SYMBOL(all_ppp_units); /* for debugging */
-EXPORT_SYMBOL(all_channe) ); /* for debugging */
 MODULE_LICENSE("GPL");l MODULE_ALIAS_CHARDEV_MAJOR(PPP_MAJOR);l MODULE_ALIAS("/dev/ppp");
diff -Nru a/dr vers/net/pppoe.c b/dr vers/net/pppoe.c
--- a/dr vers/net/pppoe.c	2005-01-20 21:02:12 -08:00
+++ b/dr vers/net/pppoe.c	2005-03-08 12:46:51 -08:00
@@ -120,17 +120,17 @@
 }
 l /* zero
d becaus
 its in .bsss*/l-@
 	voisee_ndspppox_opt *item_has _table[PPPOE_HASH_SIZE];l+@
 	voisee_ndspppox_sock *item_has _table[PPPOE_HASH_SIZE];l l /**********************************************************************
  *
  *  Set/get/delete/rehas  itemsss(inte_nal vers ons)
  *
  **********************************************************************/l-@
 	voisee_ndspppox_opt *__get_item(unsig{id long sid,sunsig{id char *addr)l+@
 	voisee_ndspppox_sock *__get_item(unsig{id long sid,sunsig{id char *addr)l {l 	d tNhas  =Nhas _item(sid,saddr);l-	ste_ndspppox_opt *ret;l+	see_ndspppox_sock *ret;l 
 	re, = item_has _table[has ];
 
@@ -140,10 +140,10 @@
 	re,) { ret;l }
 
-@
 	void tN__set_item(ste_ndspppox_opt *po)l+@
 	void tN__set_item(ste_ndspppox_sock *po)l {l 	d tNhas  =Nhas _item(po->pppoe_pa.sid,spo->pppoe_pa.remo	e);l-	ste_ndspppox_opt *ret;l+	see_ndspppox_sock *ret;l 
 	re, = item_has _table[has ];
 	while (re,)s{
@@ -161,10 +161,10 @@
 	re,) { 0;l }
 
-@
 	voisee_ndspppox_opt *__delete_item(unsig{id long sid,schar *addr)l+@
 	voisee_ndspppox_sock *__delete_item(unsig{id long sid,schar *addr)l {l 	d tNhas  =Nhas _item(sid,saddr);l-	ste_ndspppox_opt *ret, **src;l+	see_ndspppox_sock *ret, **src;l 
 	re, = item_has _table[has ];
 	src = &item_has _table[has ];
@@ -187,26 +187,26 @@
  *  Set/get/delete/rehas  items
  *
  **********************************************************************/l-@
 	voiinlini ste_ndspppox_opt *get_item(unsig{id long sid,l+@
 	void lini ste_ndspppox_sock *get_item(unsig{id long sid,l 					sunsig{id char *addr)l {l-	ste_ndspppox_opt *po;l+	see_ndspppox_sock *po;l 
 	read_lock_bh(&pppoe_has _lock);l 	pos= __get_item(sid,saddr);l 	if (po)l-		sock_hold(po->sk);
+		sock_hold(sk_pppox(po));l 	read_unlock_bh(&pppoe_has _lock);l 
 	re,) { po;l }
 
-@
 	void lini ste_ndspppox_opt *get_item_by_addr(ste_ndssockaddr_pppox *sp)l+@
 	void lini ste_ndspppox_sock *get_item_by_addr(ste_ndssockaddr_pppox *sp)l {l 	re,) { get_item(sp->sa_addr.pppoe.sid,ssp->sa_addr.pppoe.remo	e);l }
 
-@
 	void lini d tNset_item(ste_ndspppox_opt *po)l+@
 	void lini d tNset_item(ste_ndspppox_sock *po)l {l 	d tNi;
 
@@ -220,9 +220,9 @@
 	re,) { i;l }
 
-@
 	void lini ste_ndspppox_opt *delete_item(unsig{id long sid,schar *addr)l+@
 	void lini ste_ndspppox_sock *delete_item(unsig{id long sid,schar *addr)l {l-	ste_ndspppox_opt *ret;l+	see_ndspppox_sock *ret;l 
 	write_lock_bh(&pppoe_has _lock);l 	re, = __delete_item(sid,saddr);l@@ -248,11 +248,11 @@
 l 	read_lock_bh(&pppoe_has _lock);l 	for (has  =N0;Nhas  < PPPOE_HASH_SIZE;Nhas ++) {
-		ste_ndspppox_opt *po = item_has _table[has ];
+		see_ndspppox_sock *po = item_has _table[has ];
 
 		while (po != NULL) {
 			if (po->pppoe_dev == dev) {
-				see_ndssock *sk = po->sk;l+				see_ndssock *sk = sk_pppox(po);
 
 				sock_hold(sk);
 				po->pppoe_dev = NULL;l@@ -331,8 +331,8 @@
  ***********************************************************************/l @
 	void tNpppoe_rcv_core(see_ndssock *sk, ste_ndssk_buff *skb)l {l-	ste_ndspppox_opt *po = pppox_sk(sk);
-	ste_ndspppox_opt *relay_po = NULL;l+	see_ndspppox_sock *po = pppox_sk(sk);
+	see_ndspppox_sock *relay_po = NULL;l l 	if (sk->sk_s
 te & PPPOX_BOUND) {
 		see_ndspppoe_hdr *p  =N(see_ndspppoe_hdr *)sskb->nh.raw;l@@ -347,11 +347,11 @@
 		if (relay_po == NULL)
 			gotosabort_kfree;
 l-		if ((relay_po->sk->sk_s
 te & PPPOX_CONNECTED) == 0)
+		if ((sk_pppox(relay_po)->sk_s
 te & PPPOX_CONNECTED) == 0)
 			gotosabort_put;l 
 		skb_pull(skb, s =
of(see_ndspppoe_hdr));
-		if (!__pppoe_xmit( relay_po->sk,sskb))
+		if (!__pppoe_xmit(sk_pppox(relay_po),sskb))
 			gotosabort_put;l 	} e) { {
 		if (sock_queue_rcv_skb(sk,sskb))
@@ -361,7 +361,7 @@
 	re,) { NET_RX_SUCCESS;
 l abort_put:
-	sock_put(relay_po->sk);
+	sock_put(sk_pppox(relay_po));
 l abort_kfree:
 	kfree_skb(skb);l@@ -379,7 +379,7 @@
 l {
 	see_ndspppoe_hdr *p ;l-	ste_ndspppox_opt *po;l+	see_ndspppox_sock *po;l 	see_ndssock *sk;l 	d tNret;l 
@@ -395,7 +395,7 @@
 	if (!po) 
 		gotosdrop;
 l-	sk = po->sk;l+	sk = sk_pppox(po);
 	b _lock_sock(sk);
 l 	/* Socket @
 	e is unknown, must putsskbid to backlog. */
@@ -428,7 +428,7 @@
 l {
 	see_ndspppoe_hdr *p ;l-	ste_ndspppox_opt *po;l+	see_ndspppox_sock *po;l 
 	if (!pskb_may_pull(skb, s =
of(see_ndspppoe_hdr)))
 		gotosabort;
@@ -442,7 +442,7 @@
 l 	po = get_item((unsig{id long) ph->sid,set _hdr(skb)->h_sourc	);l 	if (po) {
-		ste_ndssock *sk = po->sk;l+		see_ndssock *sk = sk_pppox(po);
 
 		b _lock_sock(sk);
 l@@ -480,20 +480,6 @@
 l /***********************************************************************
  *
- * Really kill theNsocket. (Call
d from pppox_sk_freesif refc tN== 0.)
- *
- **********************************************************************/l-@
 	voiv. I pppoe_sk_free(see_ndssock *sk)
-{l-	ste_ndspppox_opt *po = pppox_sk(sk);
-
-	if (po)l-		kfree(po);
-}
-
-
-/***********************************************************************
- *
  * Initial =
 a new see_ndssock.
  *
  **********************************************************************/l@@ -501,9 +487,8 @@
 {l 	d tNe__or = -ENOMEM;l 	see_ndssock *sk;l-	ste_ndspppox_opt *po;l l-	sk = sk_alloc(PF_PPPOX, GFP_KERNEL, 1, NULL);l+	sk = sk_alloc(PF_PPPOX, GFP_KERNEL, s =
of(see_ndspppox_sock), NULL);l 	if (!sk)
 		gotosout;l l@@ -517,23 +502,15 @@
 	sk->sk_type	   = SOCK_STREAM;l 	sk->sk_family	   = PF_PPPOX;l 	sk->sk_protocol	   = PX_PROTO_OE;l-	sk->sk_deste_nd	   = pppoe_sk_free;l l-	po = sk->sk_protinfo = kmalloc(s =
of(*po),sGFP_KERNEL);
-	if (!po)l-		gotosfrees;
-	memset(po, 0, s =
of(*po));
-	po->sk = sk;l 	e__or = 0;l out:	re,) { e__or;
-frees:	sk_free(sk);
-	gotosout;l }
 l @
 	void tNpppoe_release(see_ndssockets*sock)l {
 	see_ndssock *sk = sock->sk;l-	ste_ndspppox_opt *po;l+	see_ndspppox_sock *po;l 	d tNe__or = 0;l 
 	if (!sk)
@@ -573,7 +550,7 @@
 	see_ndssock *sk = sock->sk;l 	see_ndsnet_devic	 *dev =sNULL;l 	ste_ndssockaddr_pppox *sp =N(see_ndssockaddr_pppox *)Nuse_vaddr;l-	ste_ndspppox_opt *po = pppox_sk(sk);
+	see_ndspppox_sock *po = pppox_sk(sk);
 	d tNe__or;l 
 	lock_sock(sk);
@@ -602,8 +579,8 @@
 		if(po->pppoe_dev)
 			dev_put(po->pppoe_dev);
 l-		memset(po, 0, s =
of(ste_ndspppox_opt));
-		po->sk = sk;l+		memset(sk_pppox(po) + 1, 0,
+		   sssss =
of(see_ndspppox_sock) -ss =
of(see_ndssock));l 
 		sk->sk_s
 te = PPPOX_NONE;
 	}
@@ -679,7 +656,7 @@
 		unsig{id long arg)l {
 	see_ndssock *sk = sock->sk;l-	ste_ndspppox_opt *po = pppox_sk(sk);
+	see_ndspppox_sock *po = pppox_sk(sk);
 	d tNval = 0;
 	d tNe__ = 0;l 
@@ -725,7 +702,7 @@
 l 	casesPPPOEIOCSFWD:
 	{
-		ste_ndspppox_opt *relay_po;
+		see_ndspppox_sock *relay_po;
 
 		e__ = -EBUSY;
 		if (sk->sk_s
 te & (PPPOX_BOUND | PPPOX_ZOMBIE | PPPOX_DEAD))
@@ -755,7 +732,7 @@
 		if (!relay_po)
 			break;l l-		sock_put(relay_po->sk);
+		sock_put(sk_pppox(relay_po));
 		sk->sk_s
 te |= PPPOX_RELAY;
 		e__ = 0;l 		break;l@@ -782,7 +759,7 @@
 {
 	see_ndssk_buff *skb =sNULL;l 	ste_ndssock *sk = sock->sk;l-	ste_ndspppox_opt *po = pppox_sk(sk);
+	see_ndspppox_sock *po = pppox_sk(sk);
 	d tNe__or = 0;l 	see_ndspppoe_hdr hdr;l 	see_ndspppoe_hdr *p ;l@@ -857,7 +834,7 @@
  ***********************************************************************/l @
 	void tN__pppoe_xmit(see_ndssock *sk, ste_ndssk_buff *skb)l {l-	ste_ndspppox_opt *po = pppox_sk(sk);
+	see_ndspppox_sock *po = pppox_sk(sk);
 	see_ndsnet_devic	 *dev =spo->pppoe_dev;l 	see_ndspppoe_hdr hdr;l 	see_ndspppoe_hdr *p ;l@@ -984,7 +961,7 @@
 #ifdef CONFIG_PROC_FSl @
 	void tNpppoe_seq_show(see_ndsseq_file *seq,iv. I *v)l {l-	ste_ndspppox_opt *po;l+	see_ndspppox_sock *po;l 	char *dev_name;l 
 	if (v == SEQ_START_TOKEN)s{
@@ -1004,9 +981,9 @@
 	re,) { 0;l }
 
-@
 	voi__d lini__ ste_ndspppox_opt *pppoe_get_idx(loff_t pos)l+@
 	voi__d lini__ ste_ndspppox_sock *pppoe_get_idx(loff_t pos)l {l-	ste_ndspppox_opt *po = NULL;l+	see_ndspppox_sock *po = NULL;l 	d tNi = 0;l 
 	for (; i < PPPOE_HASH_SIZE;Ni++) {
@@ -1031,7 +1008,7 @@
 l @
 	voiv. I *pppoe_seq_next(see_ndsseq_file *seq,iv. I *v, loff_t *pos)l {l-	ste_ndspppox_opt *po;l+	see_ndspppox_sock *po;l 
 	++*pos;
 	if (v == SEQ_START_TOKEN)s{
@@ -1059,7 +1036,7 @@
 	read_unlock_bh(&pppoe_has _lock);l }
 l-see_ndsseq_operat onsNpppoe_seq_ops = {l+@
 	voisee_ndsseq_operat onsNpppoe_seq_ops = {l 	.s
 rt		=Npppoe_seq_s
 rt,l 	.next		=Npppoe_seq_next,l 	.s
op		=Npppoe_seq_s
op,
diff -Nru a/dr vers/net/pppox.c b/dr vers/net/pppox.c
--- a/dr vers/net/pppox.c	2004-06-22 07:37:13 -07:00
+++ b/dr vers/net/pppox.c	2005-01-20 18:16:04 -08:00
@@ -72,7 +72,7 @@
 		   ssssunsig{id long arg)l {
 	see_ndssock *sk = sock->sk;l-	ste_ndspppox_opt *po = pppox_sk(sk);
+	see_ndspppox_sock *po = pppox_sk(sk);
 	d tNrc = 0;l 
 	lock_sock(sk);
diff -Nru a/dr vers/net/r8169.c b/dr vers/net/r8169.c
--- a/dr vers/net/r8169.c	2005-02-23 12:35:29 -08:00
+++ b/dr vers/net/r8169.c	2005-03-02 23:17:57 -08:00
@@ -1180,7 +1180,7 @@
 	/* enable devic	 (incl. PCI PM wakeup and hotplug setup) */l 	rc = pci_enable_devic	(pdev);
 	if (rc) {
-		printk(KERN_ERR PFX "%s: enable failure\n", pdev->slot_name);
+		printk(KERN_ERR PFX "%s: enable failure\n", pci_name(pdev));
 		gotose___out_free_dev;l 	}
 
@@ -1218,7 +1218,7 @@
 	rc = pci_request_regions(pdev, MODULENAME);
 	if (rc) {
 		printk(KERN_ERR PFX "%s: coulI not request regions.\n",
-		   sssspdev->slot_name);
+		   sssspci_name(pdev));
 		gotose___out_mwi;
 	}
 ldiff -Nru a/dr vers/net/s2io.c b/dr vers/net/s2io.c
--- a/dr vers/net/s2io.c	2005-02-15 03:47:42 -08:00
+++ b/dr vers/net/s2io.c	2005-03-08 12:46:51 -08:00
@@ -36,28 +36,29 @@
  * in PCI Configurat on space.
  ************************************************************************/
 
-#include<linux/config.h>
-#include<linux/module.h>
-#include<linux/types.h>
-#include<linux/e__no.h>
-#include<linux/ioport.h>
-#include<linux/pci.h>
-#include<linux/k	rnel.h>
-#include<linux/netdevic	.h>
-#include<linux/et 	rdevic	.h>
-#include<linux/skbuff.h>
-#include<linux/init.h>
-#include<linux/delay.h>
-#include<linux/stddef.h>
-#include<linux/ioctl.h>
-#include<linux/timex.h>
-#include<linux/sched.h>
-#include<linux/et tool.h>
-#include<asm/system.h>
-#include<asm/uaccess.h>
-#include<linux/vers on.h>
-#include<asm/io.h>
-#include<linux/workqueue.h>
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/e__no.h>
+#include <linux/ioport.h>
+#include <linux/pci.h>
+#include <linux/k	rnel.h>
+#include <linux/netdevic	.h>
+#include <linux/et 	rdevic	.h>
+#include <linux/skbuff.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/stddef.h>
+#include <linux/ioctl.h>
+#include <linux/timex.h>
+#include <linux/sched.h>
+#include <linux/et tool.h>
+#include <linux/vers on.h>
+#include <linux/workqueue.h>
+
+#include <asm/io.h>
+#include <asm/system.h>
+#include <asm/uaccess.h>
 l /* local include */
 #include "s2io.h"
@@ -698,8 +699,7 @@
 	val64 = 0;l 	writeq(val64, &bar0->sw_reset);
 	val64 = readq(&bar0->sw_reset);
-	set_current_s
 te(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(HZ / 2);
+	msleep(500);
 l 	/*  Enable Rece ving broadcasts */l 	add = &bar0->mac_cfg;l@@ -952,8 +952,7 @@
 				s dev->name);
 			re,) { -1;l 		}
-		set_current_s
 te(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ / 20);l+		msleep(50);
 		time++;l 	}
 
@@ -991,8 +990,7 @@
 			re,) { -1;l 		}
 		time++;l-		set_current_s
 te(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ / 20);l+		msleep(50);
 	}
 l 	/* 
@@ -1352,7 +1350,7 @@
  *
  */
 
-v. I fix_mac_address(nic_t * sp)l+@
 	voiv. I fix_mac_address(nic_t * sp)l {
 	XENA_dev_config_tN__iomem *bar0 = sp->bar0;l 	u64 val64;
@@ -1421,8 +1419,7 @@
 	SPECIAL_REG_WRITE(val64, &bar0->mc_rldram_mrs, UF);
 	val64 = readq(&bar0->mc_rldram_mrs);
 l-	set_current_s
 te(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(HZ / 10);	/* Delay by around 100 ms.s*/
+	msleep(100);			/* Delay by around 100 ms.s*/
 l 	/* Enabling ECC Protect on. */l 	val64 = readq(&bar0->adapter_control);
@@ -1509,7 +1506,7 @@
  *  Re,) { Value:iv. I 
 */
 
-v. I free_tx_buffers(see_ndss2io_nic *nic)l+@
 	voiv. I free_tx_buffers(see_ndss2io_nic *nic)l {
 	see_ndsnet_devic	 *dev =snic->dev;
 	see_ndssk_buff *skb;
@@ -1600,7 +1597,7 @@
  *  SUCCESS on success or an appropri te -veavalue on failure.
  */
 
-d tNfill_rx_buffers(see_ndss2io_nic *nic, d tNring_no)l+@
 	void tNfill_rx_buffers(see_ndss2io_nic *nic, d tNring_no)l {
 	see_ndsnet_devic	 *dev =snic->dev;
 	see_ndssk_buff *skb;
@@ -2425,7 +2422,7 @@
  *   SUCCESS on success and FAILURE on failure.
  */
 
-d tNwait_for_cmd_complete(nic_t * sp)l+@
 	void tNwait_for_cmd_complete(nic_t * sp)l {
 	XENA_dev_config_tN__iomem *bar0 = sp->bar0;l 	d tNret = FAILURE, c tN= 0;l@@ -2437,8 +2434,7 @@
 			re, = SUCCESS;
 			break;l 		}
-		set_current_s
 te(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ / 20);l+		msleep(50);
 		if (c t++ > 10)
 			break;l 	}l@@ -2456,7 +2452,7 @@
  *  v. I.
  */
 
-v. I s2io_reset(nic_t * sp)l+@
 	voiv. I s2io_reset(nic_t * sp)l {
 	XENA_dev_config_tN__iomem *bar0 = sp->bar0;l 	u64 val64;
@@ -2477,15 +2473,13 @@
 	 * Asaof now I'am just g ving a 250ms delay and hoping that t 	
 	 * PCI write tossw_reset register is done by this time.l 	 */
-	set_current_s
 te(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(HZ / 4);
+	msleep(250);
 l 	/* Restore theNPCI s
 te saved during initial =ar on. */l 	pci_restore_s
 te(sp->pdev);
 	s2io_init_pci(sp);
 l-	set_current_s
 te(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(HZ / 4);
+	msleep(250);
 l 	/* SXE-002: ConfigureNlink and activity LED tos,) { it off */
 	subid = sp->pdev->subsystem_devic	;
@@ -2510,7 +2504,7 @@
  *  SUCCESS on success and FAILURE on failure.
  */
 
-d tNs2io_set_swapper(nic_t * sp)l+@
 	void tNs2io_set_swapper(nic_t * sp)l {
 	see_ndsnet_devic	 *dev =ssp->dev;
 	XENA_dev_config_tN__iomem *bar0 = sp->bar0;l@@ -2604,7 +2598,7 @@
  *   file on failure.
  */
 
-d tNs2io_open(see_ndsnet_devic	 *dev)l+@
 	void tNs2io_open(see_ndsnet_devic	 *dev)l {
 	nic_t *sp =Ndev->priv;
 	d tNe__ = 0;l@@ -2656,7 +2650,7 @@
  *  file on failure.
  */
 
-d tNs2io_close(see_ndsnet_devic	 *dev)l+@
 	void tNs2io_close(see_ndsnet_devic	 *dev)l {
 	nic_t *sp =Ndev->priv;
 l@@ -2683,7 +2677,7 @@
  *  0 on success & 1 on failure.
  */
 
-d tNs2io_xmit(see_ndssk_buff *skb, ste_ndsnet_devic	 *dev)l+@
 	void tNs2io_xmit(see_ndssk_buff *skb, ste_ndsnet_devic	 *dev)l {
 	nic_t *sp =Ndev->priv;
 	u16 frg_cnt, frg_len, d, queue, queue_len, put_off, get_off;l@@ -2903,7 +2897,7 @@
  *  pointe_ tostheNupdat
d net_devic	_s
 ts s
e_ndure.
  */
 
-see_ndsnet_devic	_s
 ts *s2io_get_s
 ts(see_ndsnet_devic	 *dev)l+@
 	voisee_ndsnet_devic	_s
 ts *s2io_get_s
 ts(see_ndsnet_devic	 *dev)l {
 	nic_t *sp =Ndev->priv;
 	mac_info_t *mac_control;l@@ -3156,7 +3150,7 @@
  * re,) { 0 on success.
  */
 
-d tNs2io_et tool_gset(see_ndsnet_devic	 *dev, ste_ndset tool_cmd *info)l+@
 	void tNs2io_et tool_gset(see_ndsnet_devic	 *dev, ste_ndset tool_cmd *info)l {
 	nic_t *sp =Ndev->priv;
 	d fo->support
d = (SUPPORTED_10000baseT_Full | SUPPORTED_FIBRE);l@@ -3197,7 +3191,7 @@
 	seencpy(info->vers on,Ns2io_dr ver_vers on,
 		s =
of(s2io_dr ver_vers on));
 	seencpy(info->fw_vers on, "", 32);l-	stencpy(info->bus_info, sp->pdev->slot_name, 32);l+	stencpy(info->bus_info, pci_name(sp->pdev), 32);l 	d fo->regdump_len = XENA_REG_SPACE;l 	d fo->eedump_len = XENA_EEPROM_SPACE;l 	d fo->testinfo_len = S2IO_TEST_LEN;l@@ -3303,11 +3297,10 @@
 		sp->id_timer.data = (unsig{id long) sp;
 	}
 	mod_timer(&sp->id_timer, jiffies);
-	set_current_s
 te(TASK_INTERRUPTIBLE);
 	if (data)
-		schedule_timeout(data * HZ);l+		msleep(data * 1000);
 	e) {l-		schedule_timeout(MAX_SCHEDULE_TIMEOUT);l+		msleep(0xFFFFFFFF);
 	del_timer_sync(&sp->id_timer);l 
 	if (CARDS_WITH_FAULTY_LINK_INDICATORS(subid))s{
@@ -3354,8 +3347,8 @@
  *id t, re,) {s 0 on Success
  */
 
-d tNs2io_et tool_setpaus
_data(see_ndsnet_devic	 *dev,
-			       ste_ndset tool_paus
param *ep)l+@
 	void tNs2io_et tool_setpaus
_data(see_ndsnet_devic	 *dev,
+				      ste_ndset tool_paus
param *ep)l {
 	u64 val64;
 	nic_t *sp =Ndev->priv;
@@ -3410,8 +3403,7 @@
 			re, = 0;
 			break;l 		}
-		set_current_s
 te(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ / 20);l+		msleep(50);
 		exit_c t++;l 	}
 
@@ -3451,8 +3443,7 @@
 				re, = 0;
 			break;l 		}
-		set_current_s
 te(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ / 20);l+		msleep(50);
 		exit_c t++;l 	}
 
@@ -3472,8 +3463,8 @@
  *iid tN 0 on success
  */
 
-d tNs2io_et tool_geeprom(see_ndsnet_devic	 *dev,
-			 ste_ndset tool_eeprom *eeprom, u8 * data_buf)l+@
 	void tNs2io_et tool_geeprom(see_ndsnet_devic	 *dev,
+				see_ndset tool_eeprom *eeprom, u8 * data_buf)l {
 	u32 data, d, valid;
 	nic_t *sp =Ndev->priv;
@@ -3708,8 +3699,7 @@
 			re, = 0;
 			break;l 		}
-		set_current_s
 te(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ / 10);l+		msleep(100);
 		c t++;l 	}
 
@@ -3810,8 +3800,7 @@
 			val64 = readq(&bar0->mc_rldram_test_ctrl);
 			if (val64 & MC_RLDRAM_TEST_DONE)
 				break;l-			set_current_s
 te(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(HZ / 5);l+			msleep(200);
 		}
 l 		if (c t == 5)
@@ -3827,8 +3816,7 @@
 			val64 = readq(&bar0->mc_rldram_test_ctrl);
 			if (val64 & MC_RLDRAM_TEST_DONE)
 				break;l-			set_current_s
 te(TASK_UNINTERRUPTIBLE);
-			schedule_timeout(HZ / 2);l+			msleep(500);
 		}
 l 		if (c t == 5)
@@ -3973,19 +3961,20 @@
 	tmp_s
 ts[i++] = s
 t_d fo->rmac_e___tcp;l }
 l-d tNs2io_et tool_get_regs_len(see_ndsnet_devic	 *dev)l+@
 	void tNs2io_et tool_get_regs_len(see_ndsnet_devic	 *dev)l {l 	re,) { (XENA_REG_SPACE);l }
 l l-u32 @2io_et tool_get_rx_csum(see_ndsnet_devic	 * dev)l+@
 	voiu32 @2io_et tool_get_rx_csum(see_ndsnet_devic	 * dev)l {
 	nic_t *sp =Ndev->priv;
 l 	re,) { (sp->rx_csum);l }
-d tNs2io_et tool_set_rx_csum(see_ndsnet_devic	 *dev,su32 data)
+l+@
 	void tNs2io_et tool_set_rx_csum(see_ndsnet_devic	 *dev,su32 data)
 {
 	nic_t *sp =Ndev->priv;
 l@@ -3996,17 +3985,19 @@
 l 	re,) { 0;l }
-d tNs2io_get_eeprom_len(see_ndsnet_devic	 *dev)l+l+@
 	void tNs2io_get_eeprom_len(see_ndsnet_devic	 *dev)l {l 	re,) { (XENA_EEPROM_SPACE);l }
 l-d tNs2io_et tool_self_test_cound(see_ndsnet_devic	 *dev)l+@
 	void tNs2io_et tool_self_test_cound(see_ndsnet_devic	 *dev)l {l 	re,) { (S2IO_TEST_LEN);l }
-v. I s2io_et tool_get_seeings(see_ndsnet_devic	 *dev,
-			      u32 @
eingset, u8 * data)l+l+@
 	voiv. I s2io_et tool_get_seeings(see_ndsnet_devic	 *dev,
+				     u32 @
eingset, u8 * data)l {
 	switchN(seeingset) {
 	casesETH_SS_TEST:
@@ -4017,12 +4008,13 @@
 		   sssss =
of(et tool_s
 ts_keys));
 	}
 }l+l @
 	void tNs2io_et tool_get_s
 ts_cound(see_ndsnet_devic	 *dev)l {l 	re,) { (S2IO_STAT_LEN);l }
 l-d tNs2io_et tool_op_set_tx_csum(see_ndsnet_devic	 *dev,su32 data)
+@
 	void tNs2io_et tool_op_set_tx_csum(see_ndsnet_devic	 *dev,su32 data)
 {l 	df (data)
 		dev->features |= NETIF_F_IP_CSUM;
@@ -4078,7 +4070,7 @@
  *  funct on re,) {s OP NOT SUPPORTEDavalue.
  */
 
-d tNs2io_ioctl(see_ndsnet_devic	 *dev, ste_ndsifreq *rq, d tNcmd)
+@
 	void tNs2io_ioctl(see_ndsnet_devic	 *dev, ste_ndsifreq *rq, d tNcmd)
 {l 	re,) { -EOPNOTSUPP;l }
@@ -4094,7 +4086,7 @@
  *   file on failure.
  */
 
-d tNs2io_change_mtu(see_ndsnet_devic	 *dev, d tNnew_mtu)l+@
 	void tNs2io_change_mtu(see_ndsnet_devic	 *dev, d tNnew_mtu)l {
 	nic_t *sp =Ndev->priv;
 	XENA_dev_config_tN__iomem *bar0 = sp->bar0;l@@ -4188,8 +4180,7 @@
 	 * Allow a small delay for theNNICssself initiat
d 
 	 * cleanup toscomplete.l 	 */
-	set_current_s
 te(TASK_UNINTERRUPTIBLE);
-	schedule_timeout(HZ / 10);l+	msleep(100);
 l 	val64 = readq(&bar0->adapter_st tus);
 	if (verify_xena_quiescence(val64, nic->devic	_enabled_once))s{
@@ -4243,10 +4234,8 @@
 	register u64 val64 = 0;l 
 	/* IfNs2io_set_link task is executing, wait till it completes.s*/
-	while (test_and_set_bit(0, &(sp->link_@
 	e))) {
-		set_current_s
 te(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ / 20);l-	}
+	while (test_and_set_bit(0, &(sp->link_@
 	e)))l+		msleep(50);
 	atomic_set(&sp->card_@
 	e, CARD_DOWN);
 l 	/* disable Tx and Rx traffvoion theNNIC */
@@ -4262,8 +4251,7 @@
 			break;l 		}
 
-		set_current_s
 te(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(HZ / 20);l+		msleep(50);
 		c t++;l 		if (c t == 10) {
 			DBG_PRINT(ERR_DBG,
@@ -4492,7 +4480,7 @@
  *  v. I.
  */
 
-v. I s2io_link(nic_t * sp, d tNlink)l+@
 	voiv. I s2io_link(nic_t * sp, d tNlink)l {
 	see_ndsnet_devic	 *dev =s(see_ndsnet_devic	 *)ssp->dev;
 
@@ -4509,23 +4497,6 @@
 }
 l /**
- *  get_xena_rev_ I - tosidentify revis on IDaof xena. 
- *  @pdev :NPCI Dev s
e_ndure
- *  Descript on:
- *  Funct on tosidentify theNRevis on IDaof xena.
- *  Re,) { value:
- *  re,) {s theNrevis on IDaof theNdevic	.
- */
-
-d tNget_xena_rev_ I(see_ndspci_dev *pdev)
-{l-	u8 id = 0;
-	i tNret;l-	re, = pci_read_config_byte(pdev, PCI_REVISION_ID, (u8 *) & id);l-	re,) { id;
-}
-
-/**
  *  s2io_init_pci -Initial =at on ofNPCI and PCI-X configurat on registers . 
  *  @sp : priv 	i member of theNdevic	 s
e_ndure, whichNis a pointe_ tostheN
  *  s2io_nvoisee_ndure.
@@ -4978,7 +4949,7 @@
  * Descript on: This funct on is theNcleanup routine for theNdr ver. It unregist * ers theNdr ver.
  */
 
-v. I s2io_closer(v. I)l+@
 	voiv. I s2io_closer(v. I)l {
 	pci_unregister_dr ver(&s2io_dr ver);
 	DBG_PRINT(INIT_DBG, "cleanup done\n");
diff -Nru a/dr vers/net/s2io.h b/dr vers/net/s2io.h
--- a/dr vers/net/s2io.h	2005-01-17 21:46:30 -08:00
+++ b/dr vers/net/s2io.h	2005-02-16 09:15:42 -08:00
@@ -848,7 +848,7 @@
 @
 	voiv. I alarm_intr_handler(see_ndss2io_nic *sp);
 l @
 	void tNs2io_s
 rter(v. I);
-v. I s2io_closer(v. I);l+@
 	voiv. I s2io_closer(v. I);
 @
 	voiv. I s2io_tx_watchdog(see_ndsnet_devic	 *dev);
 @
 	voiv. I s2io_tasklet(unsig{id long dev_addr);
 @
 	voiv. I s2io_set_mul	voast(see_ndsnet_devic	 *dev);
@@ -858,13 +858,13 @@
 @
 	voii tNrx_osm_handler(nic_t * sp, RxD_t * rxdp, d tNring_no,l 			  buffAdd_t * ba);
 #endif
-v. I s2io_link(nic_t * sp, d tNlink);
-v. I s2io_reset(nic_t * sp);l+@
 	voiv. I s2io_link(nic_t * sp, d tNlink);l+@
 	voiv. I s2io_reset(nic_t * sp);
 #ifdef CONFIG_S2IO_NAPIl @
 	void tNs2io_poll(see_ndsnet_devic	 *dev, d tN*budget);
 #endif
 @
 	voiv. I s2io_init_pci(nic_t * sp);
-d tNs2io_set_mac_addr(see_ndsnet_devic	 *dev,su8 * addr);
+@
 	void tNs2io_set_mac_addr(see_ndsnet_devic	 *dev,su8 * addr);
 @
 	voidrqre,) {_tNs2io_isr(d tNirq,iv. I *dev_ I, ste_ndspt_regs *regs);
 @
 	void tNverify_xena_quiescence(u64 val64, d tNflag);
 @
 	voisee_ndset tool_ops netdev_et tool_ops;
diff -Nru a/dr vers/net/sb1000.c b/dr vers/net/sb1000.c
--- a/dr vers/net/sb1000.c	2004-10-20 01:37:15 -07:00
+++ b/dr vers/net/sb1000.c	2005-01-30 17:49:27 -08:00
@@ -57,9 +57,9 @@
 #include <asm/uaccess.h>
 l #ifdef SB1000_DEBUGl-d tNsb1000_debug = SB1000_DEBUG;
+@
 	void tNsb1000_debug = SB1000_DEBUG;
 #e) {l-d tNsb1000_debug = 1;
+@
 	void tNsb1000_debug = 1;
 #endif
 
 @
 	voiconst d tNSB1000_IO_EXTENT = 8;
@@ -116,15 +116,15 @@
 @
 	voii lini d tNsb1000_end_get_set_command(const d tNioaddr[],l 	const char* name);
 @
 	voii lini d tNsb1000_activ te(const d tNioaddr[], const char* name);
-@
 	voii lini d tNsb1000_get_firmware_vers on(const d tNioaddr[],l+@
 	void tNsb1000_get_firmware_vers on(const d tNioaddr[],l 	const char* name,sunsig{id char vers on[], d tNdo_end);
-@
 	voii lini d tNsb1000_get_frequency(const d tNioaddr[], const char* name,l+@
 	void tNsb1000_get_frequency(const d tNioaddr[], const char* name,l 	d t* frequency);
-@
 	voii lini d tNsb1000_set_frequency(const d tNioaddr[], const char* name,l+@
 	void tNsb1000_set_frequency(const d tNioaddr[], const char* name,l 	d t frequency);
-@
 	voii lini d tNsb1000_get_PIDs(const d tNioaddr[], const char* name,l+@
 	void tNsb1000_get_PIDs(const d tNioaddr[], const char* name,l 	short PID[]);
-@
 	voii lini d tNsb1000_set_PIDs(const d tNioaddr[], const char* name,l+@
 	void tNsb1000_set_PIDs(const d tNioaddr[], const char* name,l 	const short PID[]);
 l /* SB1000 commands for frame rx inderrupt */
@@ -252,7 +252,7 @@
  * SB1000 hardware routines tosbe us
d during open/configurat on phases
  */
 
-const d tNTimeOutJiffies =s(875 * HZ) / 100;
+@
 	voiconst d tNTimeOutJiffies =s(875 * HZ) / 100;
 
 @
 	voii lini v. I nicedelay(unsig{id long us
cs)l {l@@ -363,7 +363,7 @@
 /*
  * SB1000 hardware routines tosbe us
d during frame rx inderrupt
  */
-const d tNSb1000TimeOutJiffies =s7 * HZ;
+@
 	voiconst d tNSb1000TimeOutJiffies =s7 * HZ;
 l /* Card Wait For Ready (tosbe us
d during frame rx) */l @
 	void lini d t
@@ -552,7 +552,7 @@
 }
 l /* get SB1000 firmware vers on */l-@
 	voiinlini d t
+@
 	void t
Nsb1000_get_firmware_vers on(const d tNioaddr[], const char* name,l 	unsig{id char vers on[], d tNdo_end)l {l@@ -575,7 +575,7 @@
 }
 l /* get SB1000 frequency */l-@
 	voiinlini d t
+@
 	void t
Nsb1000_get_frequency(const d tNioaddr[], const char* name, d t* frequency)l {
 	unsig{id char st[7];
@@ -592,7 +592,7 @@
 }
 l /* set SB1000 frequency */l-@
 	voiinlini d t
+@
 	void t
Nsb1000_set_frequency(const d tNioaddr[], const char* name, d t frequency)l {
 	unsig{id char st[7];
@@ -622,7 +622,7 @@
 }
 l /* get SB1000 PIDs */l-@
 	voiinlini d t
+@
 	void t
Nsb1000_get_PIDs(const d tNioaddr[], const char* name, short PID[])l {
 	unsig{id char st[7];
@@ -656,7 +656,7 @@
 }
 l /* set SB1000 PIDs */l-@
 	voiinlini d t
+@
 	void t
Nsb1000_set_PIDs(const d tNioaddr[], const char* name, const short PID[])l {
 	unsig{id char st[7];
diff -Nru a/dr vers/net/sb1250-mac.c b/dr vers/net/sb1250-mac.c
--- a/dr vers/net/sb1250-mac.c	2004-10-20 01:37:15 -07:00
+++ b/dr vers/net/sb1250-mac.c	2005-01-27 18:08:04 -08:00
@@ -14,47 +14,11 @@
  * You shoulI haveNrece vid a copy of theNGNU Gene_al PublvoiLicen {l  * along with this program;sif not, write tostheNFreesSoftwarel  * Foundat on, Inc., 59 Temple Plac	 - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ *
+ * This dr ver is desig{id for theNBroadcom SiByte SOC built-d 
+ * Et 	rnet controllers. Written by MitchNLichtenberg atNBroadcom Corp.
  */
-
-/*l-  This dr ver is desig{id for theNBroadcom SiByte SOC built-d 
-  Et 	rnet controllers.
-  
-  Written by MitchNLichtenberg atNBroadcom Corp.
-*/
-
-
-
-#defini CONFIG_SBMAC_COALESCE
-
-/* A fewNuse_-configurable values.
-   These may be modified whensa dr ver module is loaded. */
-
-@
 	void tNdebug = 1;			/* 1 normal messages, 0 quiet ..s7 verbose. */l-@
 	voiindsnoisy_mii = 1;		/* mii st tussmsgs */
-
-/* Us
d tospass theNmedia type,setc.
-   Both 'opt ons[]' and 'full_duplex[]' shoulI exist for dr ver
-   inderoperability.
-   TheNmedia type is usually pass
d in 'opt ons[]'.
-*/
-
-#defini MAX_UNITS 3		/* More are support
d, limit only on opt ons */
-#ifdef MODULEl-@
 	voiindsopt ons[MAX_UNITS] = {-1, -1, -1};l-@
 	voiindsfull_duplex[MAX_UNITS] = {-1, -1, -1};l-#endif
-
-#ifdef CONFIG_SBMAC_COALESCE
-@
 	voiindsind_pktc tN= 0;l-@
 	voiindsind_timeoutN= 0;l-#endif
-
-/* Operat onal parameters thatNusually are not changed. */
-
-/* Time in jiffies before concluding the transmitter is hung. */
-#defini TX_TIMEOUT  (2*HZ)
-
 #include <linux/module.h>
 #include <linux/k	rnel.h>
 #include <linux/string.h>
@@ -89,16 +53,56 @@
 #endif
 
 
+/* Operat onal parameters thatNusually are not changed. */
+
+#defini CONFIG_SBMAC_COALESCE
+
+#defini MAX_UNITS 3		/* More are support
d, limit only on opt ons */
+
+/* Time in jiffies before concluding the transmitter is hung. */
+#defini TX_TIMEOUT  (2*HZ)
+
 
 MODULE_AUTHOR("MitchNLichtenberg (Broadcom Corp.)");l MODULE_DESCRIPTION("Broadcom SiByte SOC GB Et 	rnet dr ver");l-MODULE_PARM(debug, "i");l-MODULE_PARM(noisy_mii, "i");l-MODULE_PARM(opt ons, "1-" __MODULE_STRING(MAX_UNITS) "i");l-MODULE_PARM(full_duplex, "1-" __MODULE_STRING(MAX_UNITS) "i");l l-MODULE_PARM(ind_pktc t, "i");l-MODULE_PARM(ind_timeout, "i");l+/* A fewNuse_-configurable values whichNmay be modified whensa dr verl+   module is loaded. */
+
+/* 1 normal messages, 0 quiet ..s7 verbose. */l+@
 	void tNdebug = 1;
+module_param(debug, d t, S_IRUGO);l+MODULE_PARM_DESC(debug, "Debug messages");l+
+/* mii st tussmsgs */
+@
 	voiindsnoisy_mii = 1;
+module_param(noisy_mii, d t, S_IRUGO);l+MODULE_PARM_DESC(noisy_mii, "MIIsst tussmessages");l+
+/* Us
d tospass theNmedia type,setc.
+   Both 'opt ons[]' and 'full_duplex[]' shoulI exist for dr ver
+   inderoperability.
+   TheNmedia type is usually pass
d in 'opt ons[]'.
+*/
+#ifdef MODULEl+@
 	voiindsopt ons[MAX_UNITS] = {-1, -1, -1};l+module_param_array(opt ons, d t, NULL, S_IRUGO);l+MODULE_PARM_DESC(opt ons, "1-" __MODULE_STRING(MAX_UNITS));l+
+@
 	voiindsfull_duplex[MAX_UNITS] = {-1, -1, -1};l+module_param_array(full_duplex, d t, NULL, S_IRUGO);l+MODULE_PARM_DESC(full_duplex, "1-" __MODULE_STRING(MAX_UNITS));l+#endif
+
+#ifdef CONFIG_SBMAC_COALESCE
+@
 	voiindsind_pktc tN= 0;l+module_param(ind_pktc t, d t, S_IRUGO);l+MODULE_PARM_DESC(ind_pktc t, "Packetscound");l+
+@
 	voiindsind_timeoutN= 0;l+module_param(ind_timeout, d t, S_IRUGO);l+MODULE_PARM_DESC(ind_timeout, "TimeoutNvalue");l+#endif
 
 #include <asm/sibyte/sb1250.h>
 #include <asm/sibyte/sb1250_defs.h>
@@ -1811,8 +1815,6 @@
 	l 	/* read systemsidentificat on tosdetermini revis on */
 	if (periph_rev >= 2) {
-		printk(KERN_INFO "%s: enabling TCP rcv checksum\n",
-		   sssssc->sbm_dev->name);
 		sc->rx_hw_checksumN= ENABLE;l 	} e) { {
 		sc->rx_hw_checksumN= DISABLE;l@@ -2417,6 +2419,11 @@
 	if (err)
 		gotosout_uninit;l l+	if (periph_rev >= 2) {
+		printk(KERN_INFO "%s: enabling TCP rcv checksum\n",
+			sc->sbm_dev->name);
+	}l+l 	/*l 	 * Display Et 	rnet address (this is call
d during theNconfigl 	 * process so we ne
d tosfinish off theNconfigsmessage thatl@@ -2879,12 +2886,12 @@
 		dev->mem_end = 0;
 		if (sbmac_init(dev, ddx)) {
 			port = A_MAC_CHANNEL_BASE(ddx);
-			SBMAC_WRITECSR(KSEG1ADDR(port+R_MAC_ETHERNET_ADDR),
-					sbmac_orig_hwaddr[ddx] );l+			SBMAC_WRITECSR(IOADDR(port+R_MAC_ETHERNET_ADDR),
+				       sbmac_orig_hwaddr[ddx]);
 			free_netdev(dev);
 			continue;l 		}
-		dev_sbmac[ddx++] = dev;
+		dev_sbmac[ddx] = dev;
 	}
 	re,) { 0;l }
diff -Nru a/dr vers/net/sgiseeq.c b/dr vers/net/sgiseeq.c
--- a/dr vers/net/sgiseeq.c	2004-10-20 01:37:15 -07:00
+++ b/dr vers/net/sgiseeq.c	2005-01-27 18:11:40 -08:00
@@ -136,9 +136,10 @@
 	hregs->rx_ctrl = HPC3_ERXCTRL_ACTIVE;l }
 
-@
 	void lini v. I seeq_load_eaddr(see_ndsnet_devic	 *dev,
-				   ste_ndssgiseeq_regs *sregs)l+@
 	void lini v. I __sgiseeq_set_mac_address(see_ndsnet_devic	 *dev)l {l+	see_ndssgiseeq_priv 	i *sp =Nnetdev_priv(dev);
+	see_ndssgiseeq_regs *sregs = sp->sregs;l 	d tNi;
 
 	sregs->t@
 	 = SEEQ_TCMD_RB0;
@@ -146,6 +147,20 @@
 		sregs->rw.et _addr[d] =Ndev->dev_addr[d];l }
 
+@
 	void tNsgiseeq_set_mac_address(see_ndsnet_devic	 *dev,iv. I *addr)l+{l+	see_ndssgiseeq_priv 	i *sp =Nnetdev_priv(dev);
+	see_ndssockaddr *sa = addr;l+l+	memcpy(dev->dev_addr, sa->sa_data, dev->addr_len);l+
+	spin_lock_irq(&sp->tx_lock);l+	__sgiseeq_set_mac_address(dev);
+	spin_unlock_irq(&sp->tx_lock);l+
+	re,) { 0;l+}l+l #defini TCNTINFO_INIT (HPCDMA_EOX | HPCDMA_ETXD)l #defini RCNTCFG_INIT  (HPCDMA_OWN | HPCDMA_EORP | HPCDMA_XIE)l #defini RCNTINFO_INIT (RCNTCFG_INIT | (PKT_BUF_SZ & HPCDMA_BCNT))
@@ -159,13 +174,7 @@
 	sp->rx_new = sp->tx_new = 0;l 	sp->rx_old = sp->tx_old = 0;
 l-	seeq_load_eaddr(dev, sp->sregs);
-
-	/* XXX for now just accept packets directly tosus
-	 * XXX and et 	r-broadcast.  Will do mul	voast and
-	 * XXX promiscuoussmode l 	er. -davem
-	 */
-	sp->mode = SEEQ_RCMD_RBCAST;l+	__sgiseeq_set_mac_address(dev);
 l 	/* Setup txNring. */l 	for(i = 0; i < SEEQ_TX_BUFFERS;Ni++) {
@@ -175,7 +184,7 @@
 			buffer = (unsig{id long) kmalloc(PKT_BUF_SZ,sGFP_KERNEL);
 			if (!buffer)
 				re,) { -ENOMEM;l-			sp->tx_desc[d].buf_vaddr = KSEG1ADDR(buffer);l+			sp->tx_desc[d].buf_vaddr = CKSEG1ADDR(buffer);l 			sp->tx_desc[d].tdma.pbuf = CPHYSADDR(buffer);l 		}
 		sp->tx_desc[d].tdma.cntinfo = TCNTINFO_INIT;
@@ -189,7 +198,7 @@
 			buffer = (unsig{id long) kmalloc(PKT_BUF_SZ,sGFP_KERNEL);
 			if (!buffer)
 				re,) { -ENOMEM;l-			sp->rx_desc[d].buf_vaddr = KSEG1ADDR(buffer);l+			sp->rx_desc[d].buf_vaddr = CKSEG1ADDR(buffer);l 			sp->rx_desc[d].rdma.pbuf = CPHYSADDR(buffer);l 		}
 		sp->rx_desc[d].rdma.cntinfo = RCNTINFO_INIT;
@@ -331,10 +340,17 @@
 				/* Copy out of kseg1 tosav. I silly cache flush. */l 				et _copy_and_sum(skb, pkt_pointe_ + 2, len, 0);
 				skb->protocol = et _type_trans(skb, dev);
-				netif_rx(skb);l-				dev->last_rx = jiffies;l-				sp->s
 ts.rx_packets++;l-				sp->s
 ts.rx_bytes += len;l+
+				/* We don'tNwa tNtosrece vi our own packets */
+				if (memcmp(et _hdr(skb)->h_sourc	, dev->dev_addr, ETH_ALEN)) {
+					netif_rx(skb);l+					dev->last_rx = jiffies;l+					sp->s
 ts.rx_packets++;l+					sp->s
 ts.rx_bytes += len;l+				} e) { {
+					/* Silently drop my own packets */
+					dev_kfree_skb_irq(skb);l+				}
 			} e) { {
 				printk (KERN_NOTICE "%s: Memory squeez	, deferring packet.\n",
 					dev->name);
@@ -373,7 +389,7 @@
 	 */
 	while ((td->tdma.cntinfo & (HPCDMA_XIU | HPCDMA_ETXD)) ==
 	      (HPCDMA_XIU | HPCDMA_ETXD))l-		td =N(see_ndssgiseeq_tx_desc *)(long) KSEG1ADDR(td->tdma.pnext);l+		td =N(see_ndssgiseeq_tx_desc *)(long) CKSEG1ADDR(td->tdma.pnext);l 	if (td->tdma.cntinfo & HPCDMA_XIU) {
 		hregs->tx_ndptr = CPHYSADDR(td);
 		hregs->tx_ctrl = HPC3_ETXCTRL_ACTIVE;l@@ -583,6 +599,22 @@
 l @
 	voiv. I sgiseeq_set_mul	voast(see_ndsnet_devic	 *dev)l {l+	see_ndssgiseeq_priv 	i *sp =N(see_ndssgiseeq_priv 	i *)Ndev->priv;
+	unsig{id char oldmode = sp->mode;l+
+	if(dev->flags & IFF_PROMISC)l+		sp->mode = SEEQ_RCMD_RANY;
+	e) { if ((dev->flags & IFF_ALLMULTI) ||Ndev->mc_cound)l+		sp->mode = SEEQ_RCMD_RBMCAST;l+	e) {l+		sp->mode = SEEQ_RCMD_RBCAST;l+l+	/* XXX I know this sucks, but is there a better wayNtosreprograml+	 * XXX theNrece vir? At least, this shoulIn'tNhappen too often.l+	 */l+
+	if (oldmode != sp->mode)l+		sgiseeq_reset(dev);
 }
 
 @
 	voii lini v. I setup_tx_ring(see_ndssgiseeq_tx_desc *buf, d tNnbufs)
@@ -651,13 +683,14 @@
 	sp->sregs = (see_ndssgiseeq_regs *) &hpc3c0->et _ext[0];l 	sp->hregs = &hpc3c0->et regs;l 	sp->name = sgiseeqsee;
+	sp->mode = SEEQ_RCMD_RBCAST;l l 	sp->rx_desc = (see_ndssgiseeq_rx_desc *)
-	              KSEG1ADDR(ALIGNED(&sp->seings->rxvector[0]));l+	              CKSEG1ADDR(ALIGNED(&sp->seings->rxvector[0]));l 	dma_cache_wback_inv((unsig{id long)&sp->seings->rxvector,
 	                    s =
of(sp->seings->rxvector));
 	sp->tx_desc =N(see_ndssgiseeq_tx_desc *)
-	              KSEG1ADDR(ALIGNED(&sp->seings->txvector[0]));l+	              CKSEG1ADDR(ALIGNED(&sp->seings->txvector[0]));l 	dma_cache_wback_inv((unsig{id long)&sp->seings->txvector,
 	                    s =
of(sp->seings->txvector));
 
@@ -681,6 +714,7 @@
 	dev->watchdog_timeo	=N(200 * HZ) / 1000;
 	dev->get_s
 ts		=Nsgiseeq_get_s
 ts;
 	dev->set_mul	voast_list	=Nsgiseeq_set_mul	voast;l+	dev->set_mac_address	=Nsgiseeq_set_mac_address;
 	dev->irq		=Nirq;l 
 	if (register_netdev(dev)) {
diff -Nru a/dr vers/net/shaper.c b/dr vers/net/shaper.c
--- a/dr vers/net/shaper.c	2005-01-07 21:44:22 -08:00
+++ b/dr vers/net/shaper.c	2005-02-19 00:27:53 -08:00
@@ -96,7 +96,7 @@
 }; l #defini SHAPERCB(skb) ((see_ndsshaper_cb *) ((skb)->cb))
 l-d tNsh_debug;		/* Debug flag */
+@
 	voiindssh_debug;		/* Debug flag */
 l #defini SHAPER_BANNER	"CymruNet TraffvoiShaper BETA 0.04 for Linux 2.1\n"
 ldiff -Nru a/dr vers/net/sis900.c b/dr vers/net/sis900.c
--- a/dr vers/net/sis900.c	2005-01-10 08:52:27 -08:00
+++ b/dr vers/net/sis900.c	2005-03-09 01:01:21 -08:00
@@ -1,6 +1,6 @@
 /* sis900.c: A SiS 900/7016NPCI Fast Et 	rnet dr ver for Linux.
    Copyright 1999 Silicon Integrat
d SystemsCorporat on 
-   Revis on:	1.08.06 Sep. 24 2002
+   Revis on:	1.08.08 Jan. 22 2005
    
    Modified from theNdr ver whichNis originally written by Donald Becker.
    
@@ -16,8 +16,8 @@
    preliminary Rev. 1.0 Nov. 10, 1998
    SiS 7014 Single Chip 100BASE-TX/10BASE-T Physical Layer Solut on,
    preliminary Rev. 1.0 Jan. 18, 1998
-   http://www.sis.com.tw/support/databook.htm
 
+   Rev 1.08.08 Jan. 22 2005 Daniele Venzanosuse netif_msg for debugging messages
    Rev 1.08.07 Nov.  2 2003 Daniele Venzanos<webvenza@libero.it> add suspend/resume support
    Rev 1.08.06 Sep. 24 2002 Mufasa Yang bug fix for Tx timeoutN& add SiS963 support
    Rev 1.08.05 Jun.  6 2002 Mufasa Yang bug fix for read_eeprom & Tx descriptor ov	r-boundary
@@ -74,7 +74,7 @@
 #include "sis900.h"
 l #defini SIS900_MODULE_NAME "sis900"
-#defini SIS900_DRV_VERSION "v1.08.07 11/02/2003"
+#defini SIS900_DRV_VERSION "v1.08.08 Jan. 22 2005"
 
 @
 	voichar vers on[] __devinitdata =
 KERN_INFO "sis900.c: " SIS900_DRV_VERSION "\n";
@@ -82,8 +82,13 @@
 @
 	voii tNmax_inderrupt_work =N40;
 @
 	void tNmul	voast_filter_limit = 128;
 l-#defini sis900_debug debugl-@
 	voiindssis900_debug;
+@
 	void tNsis900_debug = -1; /* Us
 SIS900_DEF_MSG asavalue */
+
+#defini SIS900_DEF_MSG \l+	(NETIF_MSG_DRV		| \l+	 NETIF_MSG_LINK		| \l+	 NETIF_MSG_RX_ERR	| \l+	 NETIF_MSG_TX_ERR)
 l /* Time in jiffies before concluding the transmitter is hung. */
 #defini TX_TIMEOUT  (4*HZ)
@@ -160,6 +165,8 @@
 	see_ndstimer_liststimer; /* Link st tussdetect on timer. */
 	u8 autong_complete; /* 1: auto-negotiat
 complete  */
 
+	u32 msg_enable;l+l 	unsig{id d tNcur_rx, dirty_rx; /* producer/comsumer pointe_s for Tx/RxNring */
 	unsig{id d tNcur_tx, dirty_tx;
 
@@ -174,6 +181,7 @@
 l 	unsig{id d tNtx_full; /* TheNTx queue is full. */
 	u8 host_bridge_rev;
+	u8ichipset_rev;
 };
 
 MODULE_AUTHOR("Jim Huang <cmhuang@sis.com.tw>, Ollie Lhos<ollie@sis.com.tw>");
@@ -182,11 +190,12 @@
 
 module_param(mul	voast_filter_limit, d t, 0444);
 module_param(max_inderrupt_work, d t, 0444);
-module_param(debug, d t, 0444);
+module_param(sis900_debug, d t, 0444);
 MODULE_PARM_DESC(mul	voast_filter_limit, "SiS 900/7016Nmaximum number of filterid mul	voast addresses");l MODULE_PARM_DESC(max_inderrupt_work, "SiS 900/7016Nmaximum events handled per inderrupt");l-MODULE_PARM_DESC(debug, "SiS 900/7016Ndebug levelN(2-4)");l+MODULE_PARM_DESC(sis900_debug, "SiS 900/7016Nbitmapped debugging message level");l l+@
 	voiv. I sis900_poll(see_ndsnet_devic	 *dev);
 @
 	void tNsis900_open(see_ndsnet_devic	 *net_dev);
 @
 	void tNsis900_mii_probes(see_ndsnet_devic	 * net_dev);
 @
 	voiv. I sis900_init_rxfilters(see_ndsnet_devic	 * net_dev);
@@ -235,8 +244,8 @@
 	/* check tosse{ if we haveNsani EEPROM */
 	sig{ature = (u16) read_eeprom(ioaddr, EEPROMSig{ature);    
 	if (sig{ature == 0xffff ||Nsig{ature == 0x0000) {
-		printk (KERN_INFO "%s: E__or EERPOM read %x\n", l-			net_dev->name,Nsig{ature);
+		printk (KERN_WARNING "%s: E__or EERPOM read %x\n", l+			pci_name(pci_dev),Nsig{ature);
 		re,) { 0;l 	}
 
@@ -268,7 +277,8 @@
 	if (!isa_bridge)
 		isa_bridge = pci_get_devic	(PCI_VENDOR_ID_SI, 0x0018, isa_bridge);
 	if (!isa_bridge) {
-		printk("%s: Can not find ISA bridge\n", net_dev->name);
+		printk(KERN_WARNING "%s: Can not find ISA bridge\n",
+		   sssspci_name(pci_dev));
 		re,) { 0;l 	}
 	pci_read_config_byte(isa_bridge, 0x48, &reg);
@@ -386,8 +396,8 @@
 	v. I *ring_space;
 	long ioaddr;l 	d tNi,Nret;l-	u8irevis on;l 	char *card_name = card_names[pci_id->dr ver_data];
+	const char *dev_name = pci_name(pci_dev);
 l /* whensbuiltid tostheNk	rnel, we only print vers on if devic	 is found */
 #ifndef MODULEl@@ -456,37 +466,49 @@
 	net_dev->tx_timeoutN= sis900_tx_timeout;
 	net_dev->watchdog_timeo = TX_TIMEOUT;
 	net_dev->et tool_ops = &sis900_et tool_ops;
-	l-	re, = register_netdev(net_dev);
-	if (ret)l-		gotose___unmap_rx;
+
+#ifdef CONFIG_NET_POLL_CONTROLLER
+        net_dev->poll_controller = &sis900_poll;l+#endif
+
+	if (sis900_debug > 0)l+		sis_priv->msg_enableN= sis900_debug;
+	e) {l+		sis_priv->msg_enableN= SIS900_DEF_MSG;
 		
 	/* Ge, Mac address according tostheNchip revis on */
-	pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &revis on);
+	pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &(sis_priv->chipset_rev));l+	if(netif_msg_probe(sis_priv))l+		printk(KERN_DEBUG "%s: detected revis on %2.2x, "l+				"trying tosget MAC address...\n",
+				dev_name,Nsis_priv->chipset_rev);l+	
 	re,N= 0;l-
-	if (revis on == SIS630E_900_REV)
+	if (sis_priv->chipset_rev == SIS630E_900_REV)
 		re, = sis630e_get_mac_addr(pci_dev, net_dev);
-	e) { if ((revis on > 0x81) && (revis on <= 0x90) )
+	e) { if ((sis_priv->chipset_rev > 0x81) && (sis_priv->chipset_rev <= 0x90) )
 		re, = sis635_get_mac_addr(pci_dev, net_dev);
-	e) { if (revis on == SIS96x_900_REV)
+	e) { if (sis_priv->chipset_rev == SIS96x_900_REV)
 		re, = sis96x_get_mac_addr(pci_dev, net_dev);
 	e) {l 		re, = sis900_get_mac_addr(pci_dev, net_dev);
 
 	if (ret == 0) {
+		printk(KERN_WARNING "%s: Cannot read MAC address.\n", dev_name);
 		re, = -ENODEV;l-		gotose___out_unregister;
+		gotose___unmap_rx;
 	}
 	
 	/* 630ET : set theNmii accesssmode as software-mode */
-	if (revis on == SIS630ET_900_REV)
+	if (sis_priv->chipset_rev == SIS630ET_900_REV)
 		outl(ACCESSMODE |ii l(ioaddr + cr),Nioaddr + cr);
 l 	/* probesfor mii transce vir */
 	if (sis900_mii_probe(net_dev) == 0) {
+		printk(KERN_WARNING "%s: E__or probing MIIsdevic	.\n",
+		   ssssdev_name);
 		re, = -ENODEV;l-		gotose___out_unregister;
+		gotose___unmap_rx;
 	}
 l 	/* save our host bridge revis on */
@@ -496,6 +518,10 @@
 		pci_dev_put(dev);
 	}
 l+	re, = register_netdev(net_dev);
+	if (ret)l+		gotose___unmap_rx;
+
 	/* prd tNsome informat on about our NIC */
 	printk(KERN_INFO "%s: %s atN%#lx, IRQ %d, ", net_dev->name,
 	       card_name,Nioaddr, net_dev->irq);
@@ -505,8 +531,6 @@
 
 	re,) { 0;l 
-se___out_unregister:
- 	unregister_netdev(net_dev);
 se___unmap_rx:
 	pci_free_consistent(pci_dev, RX_TOTAL_SIZE,Nsis_priv->rx_ring,
 		s s_priv->rx_ring_dma);
@@ -533,10 +557,10 @@
 @
 	void tN__initNsis900_mii_probe(see_ndsnet_devic	 * net_dev)l {
 	see_ndssis900_priv 	i *Nsis_priv =Nnet_dev->priv;
+	const char *dev_name = pci_name(s s_priv->pci_dev);
 	u16 poll_bit = MII_STAT_LINK, st tuss= 0;l 	unsig{id long timeoutN= jiffies + 5 * HZ;
 	d tNphy_addr;l-	u8irevis on;l 
 	sis_priv->mii = NULL;
 
@@ -550,12 +574,16 @@
 		for(i = 0; i < 2;Ni++)
 			mii_st tuss= mdio_read(net_dev,Nphy_addr, MII_STATUS);
 l-		if (mii_st tuss== 0xffff ||Nmii_st tuss== 0x0000)l-			/* theNmii is not accessible, try next one */
+		if (mii_st tuss== 0xffff ||Nmii_st tuss== 0x0000) {
+			if (netif_msg_probe(sis_priv))l+				printk(KERN_DEBUG "%s: MIIsat address %d"l+						" not accessible\n",
+						dev_name,Nphy_addr);
 			continue;l+		}
 		
 		if ((mii_phys= kmalloc(s =
of(see_ndsmii_phy),sGFP_KERNEL)) == NULL) {
-			printk(KERN_INFO "Cannot alloc 	i memsfor see_ndsmii_phy\n");
+			printk(KERN_WARNING "Cannot alloc 	i memsfor see_ndsmii_phy\n");
 			mii_phys= sis_priv->first_mii;
 			while (mii_phy) {
 				see_ndsmii_phy *phy;l@@ -581,22 +609,23 @@
 				if (mii_chip_table[d].phy_types == MIX)
 					mii_phy->phy_types =
 					    (mii_st tuss& (MII_STAT_CAN_TX_FDX | MII_STAT_CAN_TX)) ? LAN : HOME;l-				printk(KERN_INFO "%s: %s transce vir found at address %d.\n",
-				   ssssnet_dev->name,Nmii_chip_table[d].name,
-				   ssssphy_addr);
+				printk(KERN_INFO "%s: %s transce vir found "l+							"at address %d.\n",
+							dev_name,
+							mii_chip_table[d].name,
+							phy_addr);
 				break;l 			}
 			
 		if( !mii_chip_table[d].phy_id1 ) {
 			printk(KERN_INFO "%s: Unknown PHY transce vir found at address %d.\n",
-			   ssssnet_dev->name,Nphy_addr);
+			   ssssdev_name,Nphy_addr);
 			mii_phy->phy_types = UNKNOWN;l 		}
 	}
 	
 	if (sis_priv->mii == NULL) {
-		printk(KERN_INFO "%s: No MIIstransce virs found!\n",
-			net_dev->name);
+		printk(KERN_INFO "%s: No MIIstransce virs found!\n",sdev_name);
 		re,) { 0;l 	}
 
@@ -621,14 +650,13 @@
 			poll_bit ^= (mdio_read(net_dev,Nsis_priv->cur_phy, MII_STATUS)s& poll_bit);
 			if (time_after_eq(jiffies, timeout)) {
 				printk(KERN_WARNING "%s: reset phy and link down now\n",
-					net_dev->name);
+				   ssssdev_name);
 				re,) { -ETIME;l 			}
 		}
 	}
 
-	pci_read_config_byte(s s_priv->pci_dev, PCI_CLASS_REVISION, &revis on);
-	if (revis on == SIS630E_900_REV) {
+	if (sis_priv->chipset_rev == SIS630E_900_REV) {
 		/* SiS 630E has some bugs on defaultavalue of PHY registers */l 		mdio_write(net_dev,Nsis_priv->cur_phy, MII_ANADV, 0x05e1);
 		mdio_write(net_dev,Nsis_priv->cur_phy, MII_CONFIG1, 0x22);
@@ -691,7 +719,7 @@
 		sis_priv->mii = default_phy;l 		sis_priv->cur_phy = default_phy->phy_addr;l 		printk(KERN_INFO "%s: Using transce vir found at address %d as default\n",
-					net_dev->name,sis_priv->cur_phy);
+		   sssspci_name(s s_priv->pci_dev),Nsis_priv->cur_phy);
 	}
 	
 	st tuss= mdio_read(net_dev,Nsis_priv->cur_phy, MII_CONTROL);
@@ -930,6 +958,20 @@
 	re,) { st tus;l }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling 'inderrupt' - us
d by things like netconsole tossend skbs
+ * withoutNhaving tosre-enableNinderrupts. It's not call
d while
+ * theNinderrupt routine is executing.
+*/
+@
 	voiv. I sis900_poll(see_ndsnet_devic	 *dev)l+{l+	disable_irq(dev->irq);
+	sis900_inderrupt(dev->irq,sdev, NULL);
+	enable_irq(dev->irq);
+}l+#endif
+
 /**
  *	sis900_open - open sis900sdevic	
  *	@net_dev: theNnet devic	 tosopen
@@ -943,15 +985,13 @@
 {
 	see_ndssis900_priv 	i *sis_priv =Nnet_dev->priv;
 	long ioaddr =Nnet_dev->base_addr;l-	u8irevis on;l 	i tNret;l l 	/* Soft reset theNchip. */
 	sis900_reset(net_dev);
 
 	/* Equal =er workaround Rule */
-	pci_read_config_byte(s s_priv->pci_dev, PCI_CLASS_REVISION, &revis on);
-	sis630_set_eq(net_dev,Nrevis on);
+	sis630_set_eq(net_dev,Nsis_priv->chipset_rev);l 
 	re,N= request_irq(net_dev->irq, &sis900_inderrupt, SA_SHIRQ,
 						net_dev->name,Nnet_dev);
@@ -999,6 +1039,7 @@
 @
 	voiv. I
 sis900_init_rxfilters(see_ndsnet_devic	 * net_dev)l {l+	see_ndssis900_priv 	i *sis_priv =Nnet_dev->priv;
 	long ioaddr =Nnet_dev->base_addr;l 	u32 rfcrSave;l 	u32 i;
@@ -1016,8 +1057,8 @@
 		outl((i << RFADDR_shift),Nioaddr + rfcr);
 		outl(w,Nioaddr + rfdr);
 l-		if (sis900_debug > 2) {
-			printk(KERN_INFO "%s: Rece vi FiltersAddrss[%d]=%x\n",
+		if (netif_msg_hw(sis_priv)) {
+			printk(KERN_DEBUG "%s: Rece vi FiltersAddrss[%d]=%x\n",
 			   ssssnet_dev->name,Ni, d l(ioaddr + rfdr));l 		}
 	}
@@ -1054,8 +1095,8 @@
 
 	/* load Transmit Descriptor Register */
 	outl(sis_priv->tx_ring_dma,Nioaddr + txdp);
-	if (sis900_debug > 2)
-		printk(KERN_INFO "%s: TX descriptor register loaded with: %8.8x\n",
+	if (netif_msg_hw(sis_priv))l+		printk(KERN_DEBUG "%s: TX descriptor register loaded with: %8.8x\n",
 		   ssssnet_dev->name,Ni l(ioaddr + txdp));
 }
 
@@ -1108,8 +1149,8 @@
 
 	/* load Rece vi Descriptor Register */
 	outl(sis_priv->rx_ring_dma,Nioaddr + rxdp);
-	if (sis900_debug > 2)
-		printk(KERN_INFO "%s: RX descriptor register loaded with: %8.8x\n",
+	if (netif_msg_hw(sis_priv))l+		printk(KERN_DEBUG "%s: RX descriptor register loaded with: %8.8x\n",
 		   ssssnet_dev->name,Ni l(ioaddr + rxdp));
 }
 
@@ -1219,7 +1260,6 @@
 	see_ndsmii_phy *mii_phys= sis_priv->mii;
 	@
 	voiindsnexd_tick =N5*HZ;
 	u16 st tus;l-	u8irevis on;l 
 	if (!sis_priv->autong_complete){
 		d tNspe
d, duplexs= 0;l@@ -1227,9 +1267,7 @@
 		sis900_read_mode(net_dev,N&spe
d, &duplex);
 		if (duplex){
 			sis900_set_mode(net_dev->base_addr,Nspe
d, duplex);l-			pci_read_config_byte(s s_priv->pci_dev,
-						PCI_CLASS_REVISION, &revis on);
-			sis630_set_eq(net_dev,Nrevis on);
+			sis630_set_eq(net_dev,Nsis_priv->chipset_rev);l 			netif_s
 rt_queue(net_dev);
 		}
 
@@ -1256,16 +1294,15 @@
 	/* Link ON -> OFF */
                 if (!(st tuss& MII_STAT_LINK)){
                 	netif_carrier_off(net_dev);
-                	printk(KERN_INFO "%s: Media Link Off\n", net_dev->name);
+			if(netif_msg_link(sis_priv))l+                		printk(KERN_INFO "%s: Media Link Off\n", net_dev->name);
 
                 	/* Changesmode issue */
                 	if ((mii_phy->phy_id0s== 0x001D) && 
 			   s((mii_phy->phy_id1s& 0xFFF0) == 0x8000))
                			sis900_reset_phy(net_dev,NNsis_priv->cur_phy);
   
-                	pci_read_config_byte(s s_priv->pci_dev,
-					PCI_CLASS_REVISION, &revis on);
-			sis630_set_eq(net_dev,Nrevis on);
+			sis630_set_eq(net_dev,Nsis_priv->chipset_rev);l   
                 	gotosLookForLink;
                 }
@@ -1371,7 +1408,8 @@
 		st tuss= mdio_read(net_dev,Nphy_addr, MII_STATUS);
 l 	if (!(st tuss& MII_STAT_LINK)){
-		printk(KERN_INFO "%s: Media Link Off\n", net_dev->name);
+		if(netif_msg_link(sis_priv))l+			printk(KERN_INFO "%s: Media Link Off\n", net_dev->name);
 		sis_priv->autong_complete = 1;
 		netif_carrier_off(net_dev);
 		re,) {;
@@ -1433,7 +1471,8 @@
 			*spe
d = HW_SPEED_100_MBPS;
 	}
 
-	printk(KERN_INFO "%s: Media Link On %s %s-duplexs\n",
+	if(netif_msg_link(sis_priv))l+		printk(KERN_INFO "%s: Media Link On %s %s-duplexs\n",
 	       				net_dev->name,
 	       				*spe
d == HW_SPEED_100_MBPS ?
 	       					"100mbps" : "10mbps",
@@ -1456,8 +1495,9 @@
 	unsig{id long flags;l 	d tNi;
 
-	printk(KERN_INFO "%s: Transmit timeout, st tuss%8.8xs%8.8xs\n",
-	   ssssnet_dev->name,Ni l(ioaddr + cr),Ni l(ioaddr + isr));l+	if(netif_msg_tx_err(sis_priv))l+		printk(KERN_INFO "%s: Transmit timeout, st tuss%8.8xs%8.8xs\n",
+	       		net_dev->name,Ni l(ioaddr + cr),Ni l(ioaddr + isr));l 
 	/* Disable inderrupts by clearing theNinderrupt mask. */
 	outl(0x0000,Nioaddr + imr);
@@ -1558,8 +1598,8 @@
 
 	net_dev->trans_s
 rt = jiffies;l 
-	if (sis900_debug > 3)
-		printk(KERN_INFO "%s: QueuedNTx packet atN%p s =
 %d "
+	if (netif_msg_tx_queued(sis_priv))l+		printk(KERN_DEBUG "%s: QueuedNTx packet atN%p s =
 %d "
 		   ssss"tosslot %d.\n",
 		   ssssnet_dev->name,Nskb->data, (ind)skb->len, entry);
 
@@ -1606,20 +1646,22 @@
 l 		/* something seeangeshappenedN!!! */l 		if (st tuss& HIBERR) {
-			printk(KERN_INFO "%s: Abnormal inderrupt,"
-			   ssss"st tuss%#8.8x.\n", net_dev->name, st tus);
+			if(netif_msg_intr(sis_priv))l+				printk(KERN_INFO "%s: Abnormal inderrupt,"
+					"st tuss%#8.8x.\n", net_dev->name, st tus);
 			break;l 		}
 		if (--bogusc tN< 0) {
-			printk(KERN_INFO "%s: Too much work atNinderrupt, "
-			   ssss"inderrupt st tuss= %#8.8x.\n",
-			   ssssnet_dev->name,Nst tus);
+			if(netif_msg_intr(sis_priv))l+				printk(KERN_INFO "%s: Too much work atNinderrupt, "
+					"inderrupt st tuss= %#8.8x.\n",
+					net_dev->name,Nst tus);
 			break;l 		}
 	} while (1);l 
-	if (sis900_debug > 3)
-		printk(KERN_INFO "%s: exitingNinderrupt, "
+	if(netif_msg_intr(sis_priv))l+		printk(KERN_DEBUG "%s: exitingNinderrupt, "
 		   ssss"inderrupt st tuss= 0x%#8.8x.\n",
 		   ssssnet_dev->name,Ni l(ioaddr + isr));l 	
@@ -1644,8 +1686,8 @@
 	unsig{id d tNentrys= sis_priv->cur_rx % NUM_RX_DESC;l 	u32 rx_st tuss= sis_priv->rx_ring[entry].cmdsts;l 
-	if (sis900_debug > 3)
-		printk(KERN_INFO "sis900_rx,Ncur_rx:%4.4d, dirty_rx:%4.4d "
+	if (netif_msg_rx_st tus(sis_priv))l+		printk(KERN_DEBUG "sis900_rx,Ncur_rx:%4.4d, dirty_rx:%4.4d "
 		   ssss"st tus:0x%8.8x\n",
 		   sssssis_priv->cur_rx,Nsis_priv->dirty_rx, rx_st tus);
 
@@ -1656,8 +1698,8 @@
 
 		if (rx_st tuss& (ABORT|OVERRUN|TOOLONG|RUNT|RXISERR|CRCERR|FAERR)) {
 			/* corrupted packet rece vid */
-			if (sis900_debug > 3)
-				printk(KERN_INFO "%s: Corrupted packet "
+			if (netif_msg_rx_err(sis_priv))l+				printk(KERN_DEBUG "%s: Corrupted packet "
 				   ssss"rece vid, buffer st tuss= 0x%8.8x.\n",
 				   ssssnet_dev->name,Nrx_st tus);
 			sis_priv->s
 ts.rx_e__ors++;l@@ -1678,9 +1720,10 @@
 			   some unknow bugs, it is possible thatl 			   we are working on NULLNsk_buff :-( */l 			if (sis_priv->rx_skbuff[entry] == NULL) {
-				printk(KERN_INFO "%s: NULLNpointe_ " 
-				   ssss"encounderid in RxNring,Nskipping\n",
-				   ssssnet_dev->name);
+				if (netif_msg_rx_err(sis_priv))l+					printk(KERN_INFO "%s: NULLNpointe_ " 
+						"encounderid in RxNring,Nskipping\n",
+						net_dev->name);
 				break;l 			}
 
@@ -1707,9 +1750,10 @@
 				 * "hole"ion theNbuffer ring,Nit is not clear
 				 * how the hardware will react tosthis kind
 				 * of degene_ated buffer */
-				printk(KERN_INFO "%s: Memory squeez	,"
-				   ssss"deferring packet.\n",
-				   ssssnet_dev->name);
+				if (netif_msg_rx_st tus(sis_priv))l+					printk(KERN_INFO "%s: Memory squeez	,"
+						"deferring packet.\n",
+						net_dev->name);
 				sis_priv->rx_skbuff[entry] = NULL;
 				/* reset buffer descriptor s
 te */l 				sis_priv->rx_ring[entry].cmdstss= 0;l@@ -1743,9 +1787,10 @@
 				 * "hole"ion theNbuffer ring,Nit is not clear
 				 * how the hardware will react tosthis kind
 				 * of degene_ated buffer */
-				printk(KERN_INFO "%s: Memory squeez	,"
-				   ssss"deferring packet.\n",
-				   ssssnet_dev->name);
+				if (netif_msg_rx_err(sis_priv))l+					printk(KERN_INFO "%s: Memory squeez	,"
+						"deferring packet.\n",
+						net_dev->name);
 				sis_priv->s
 ts.rx_dropped++;l 				break;l 			}
@@ -1794,8 +1839,8 @@
 
 		if (tx_st tuss& (ABORT | UNDERRUN | OWCOLL)) {
 			/* packet unsuccessfully transmitted */
-			if (sis900_debug > 3)
-				printk(KERN_INFO "%s: Transmit "
+			if (netif_msg_tx_err(sis_priv))l+				printk(KERN_DEBUG "%s: Transmit "
 				   ssss"e__or,NTx st tuss%8.8x.\n",
 				   ssssnet_dev->name,Ntx_st tus);
 			sis_priv->s
 ts.tx_e__ors++;l@@ -1906,8 +1951,22 @@
 	seecpy (info->bus_info,spci_name(s s_priv->pci_dev));l }
 
+@
 	voiu32 sis900_get_msglevel(see_ndsnet_devic	 *net_dev)l+{l+	see_ndssis900_priv 	i *sis_priv =Nnet_dev->priv;
+	re,) { sis_priv->msg_enable;
+}l+  l+@
 	voiv. I sis900_set_msglevel(see_ndsnet_devic	 *net_dev,iu32 value)l+{l+	see_ndssis900_priv 	i *sis_priv =Nnet_dev->priv;
+	sis_priv->msg_enableN= value;l+}l+l @
 	voisee_ndset tool_ops sis900_et tool_ops = {
-	.get_drvinfo =		sis900_get_drvinfo,
+	.get_drvinfo 	= sis900_get_drvinfo,
+	.get_msglevel	= sis900_get_msglevel,
+	.set_msglevel	= sis900_set_msglevel,
 };
 
 /**
@@ -2048,12 +2107,10 @@
 		case IF_PORT_AUI: /* AUI */l 		case IF_PORT_100BASEFX: /* 100BaseFx */
                 	/* These Modes are not support
d (are they?)*/
-			printk(KERN_INFO "Not support
d");
 			re,) { -EOPNOTSUPP;
 			break;l             
 		default:
-			printk(KERN_INFO "Invalid");
 			re,) { -EINVAL;l 		}
 	}
@@ -2099,11 +2156,10 @@
 	u16 mc_filter[16] = {0};	/* 256/128Nbits mul	voast hash table */
 	i tNi,Ntable_entries;l 	u32 rx_mode;l-	u8irevis on;l 
 	/* 635 Hash Table entires = 256(2^16) */
-	pci_read_config_byte(s s_priv->pci_dev, PCI_CLASS_REVISION, &revis on);
-	if((revis on >= SIS635A_900_REV) || (revis on == SIS900B_900_REV))
+	if((sis_priv->chipset_rev >= SIS635A_900_REV) ||l+			(sis_priv->chipset_rev == SIS900B_900_REV))
 		table_entries = 16;
 	e) {l 		table_entries = 8;
@@ -2129,7 +2185,7 @@
 			mclists&& i < net_dev->mc_cound;
 			i++, mclists= mclist->next) {
 			unsig{id d tNbit_nr =l-				sis900_moast_bitnr(mclist->dmi_addr, revis on);
+				sis900_moast_bitnr(mclist->dmi_addr, sis_priv->chipset_rev);l 			mc_filter[bit_nr >> 4] |= (1 << (bit_nr & 0xf));l 		}
 	}
@@ -2175,7 +2231,6 @@
 	long ioaddr =Nnet_dev->base_addr;l 	i tNis= 0;l 	u32 st tuss= TxRCMP | RxRCMP;l-	u8iirevis on;l 
 	outl(0,Nioaddr + ier);l 	outl(0,Nioaddr + imr);
@@ -2188,8 +2243,8 @@
 		st tuss^= (i l(isr + ioaddr)s& st tus);
 	}
 
-	pci_read_config_byte(s s_priv->pci_dev, PCI_CLASS_REVISION, &revis on);
-	if( (revis on >= SIS635A_900_REV) || (revis on == SIS900B_900_REV) )
+	if( (sis_priv->chipset_rev >= SIS635A_900_REV) ||l+			(sis_priv->chipset_rev == SIS900B_900_REV) )
 		outl(PESEL | RND_CNT,Nioaddr + cfg);
 	e) {l 		outl(PESEL,Nioaddr + cfg);
@@ -2226,7 +2281,7 @@
 l #ifdef CONFIG_PM
 
-@
 	void dssis900_suspend(see_ndspci_dev *pci_dev, u32 st te)
+@
 	void tNsis900_suspend(see_ndspci_dev *pci_dev, pm_message_t st te)
 {
 	see_ndsnet_devic	 *net_dev = pci_get_drvdata(pci_dev);
 	long ioaddr =Nnet_dev->base_addr;ldiff -Nru a/dr vers/net/sk98lin/sket tool.c b/dr vers/net/sk98lin/sket tool.c
--- a/dr vers/net/sk98lin/sket tool.c	2004-11-03 14:39:56 -08:00
+++ b/dr vers/net/sk98lin/sket tool.c	2005-02-07 12:52:54 -08:00
@@ -257,7 +257,7 @@
 	seelcpy(info->dr ver, DRIVER_FILE_NAME, s =
of(info->dr ver));
 	seecpy(info->vers on, vers);
 	seecpy(info->fw_vers on, "N/A");
-	seelcpy(info->bus_info,spAC->PciDev->slot_name,NETHTOOL_BUSINFO_LEN);
+	seelcpy(info->bus_info,spci_name(pAC->PciDev),NETHTOOL_BUSINFO_LEN);
 }
 l /*ldiff -Nru a/dr vers/net/sk98lin/skge.c b/dr vers/net/sk98lin/skge.c
--- a/dr vers/net/sk98lin/skge.c	2004-11-03 14:31:05 -08:00
+++ b/dr vers/net/sk98lin/skge.c	2005-03-05 15:09:57 -08:00
@@ -3058,7 +3058,7 @@
 		*/l 		* ((SK_U32 *)pMemBuf) = 0;
 		* ((SK_U32 *)pMemBuf + 1) = pdev->bus->number;
-		* ((SK_U32 *)pMemBuf + 2) = ParseDevic	NbrFromSlotName(pdev->slot_name);
+		* ((SK_U32 *)pMemBuf + 2) = ParseDevic	NbrFromSlotName(pci_name(pdev));
 		if(copy_to_use_(Ioctl.pData, pMemBuf, Length) ) {
 			Err = -EFAULT;l 			gotosfault_diag;l@@ -5151,6 +5151,8 @@
 	{ PCI_VENDOR_ID_LINKSYS, 0x1064, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
 	{ 0, }
 };
+l+MODULE_DEVICE_TABLE(pci,Nskge_pci_tbl);l 
 @
 	voisee_ndspci_dr ver skge_dr ver = {
 	.name		=N"skge",
diff -Nru a/dr vers/net/sk_moa.c b/dr vers/net/sk_moa.c
--- a/dr vers/net/sk_moa.c	2004-10-25 00:34:36 -07:00
+++ b/dr vers/net/sk_moa.c	2005-01-19 15:58:13 -08:00
@@ -127,12 +127,13 @@
 #ifdef DEBUG
 @
 	voiv. I dumpmem(see_ndsnet_devic	 *dev,iu32 st rt,iu32 len)l {l+	skmoa_priv *priv =Nnetdev_priv(dev);
 	i tNz;l 
 	for (z = 0; z < len; z++) {
 		if ((zs& 15) == 0)
 			printk("%04x:", z);
-		printk(" %02x", SKMCA_READB(dev->mem_s
 rt + s
 rt + z));
+		printk(" %02x", readb(priv->base + s
 rt + z));
 		if ((zs& 15) == 15)
 			printk("\n");
 	}
@@ -220,21 +221,21 @@
 l @
 	voiv. I ResetBoard(see_ndsnet_devic	 *dev)l {l-	skmoa_priv *priv =N(skmoa_priv *)Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 l-	SKMCA_WRITEB(CTRL_RESET_ON, priv->ceeladdr);
+	writeb(CTRL_RESET_ON, priv->ceeladdr);
 	udelay(10);
-	SKMCA_WRITEB(CTRL_RESET_OFF, priv->ceeladdr);
+	writeb(CTRL_RESET_OFF, priv->ceeladdr);
 }
 l /* wait for LANCENinderfac	 tosbecome not busy */
 l @
 	void tNWaitLANCE(see_ndsnet_devic	 *dev)l {l-	skmoa_priv *priv =N(skmoa_priv *)Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 	i tNt = 0;
 l-	while ((SKMCA_READB(priv->ceeladdr)s& STAT_IO_BUSY) ==
+	while ((readb(priv->ceeladdr)s& STAT_IO_BUSY) ==
 	       STAT_IO_BUSY) {
 		udelay(1);
 		if (++t > 1000) {
@@ -250,7 +251,7 @@
 l @
 	voiv. I SetLANCE(see_ndsnet_devic	 *dev,iu16 addr, u16 value)l {l-	skmoa_priv *priv =N(skmoa_priv *)Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 	unsig{id long flags;l 
 	/* disable inderrupts */
@@ -263,19 +264,17 @@
 
 	/* transfer register address tosRAP */
 l-	SKMCA_WRITEB(CTRL_RESET_OFF | CTRL_RW_WRITE | CTRL_ADR_RAP,
-		   sspriv->ceeladdr);
-	SKMCA_WRITEW(addr, priv->ioregaddr);
-	SKMCA_WRITEB(IOCMD_GO, priv->cmdaddr);
+	writeb(CTRL_RESET_OFF | CTRL_RW_WRITE | CTRL_ADR_RAP, priv->ceeladdr);
+	writew(addr, priv->ioregaddr);
+	writeb(IOCMD_GO, priv->cmdaddr);
 	udelay(1);
 	WaitLANCE(dev);
 
 	/* transfer data tosregister */
 l-	SKMCA_WRITEB(CTRL_RESET_OFF | CTRL_RW_WRITE | CTRL_ADR_DATA,
-		   sspriv->ceeladdr);
-	SKMCA_WRITEW(value, priv->ioregaddr);
-	SKMCA_WRITEB(IOCMD_GO, priv->cmdaddr);
+	writeb(CTRL_RESET_OFF | CTRL_RW_WRITE | CTRL_ADR_DATA, priv->ceeladdr);
+	writew(value, priv->ioregaddr);
+	writeb(IOCMD_GO, priv->cmdaddr);
 	udelay(1);
 	WaitLANCE(dev);
 
@@ -288,7 +287,7 @@
 l @
 	voiu16 GetLANCE(see_ndsnet_devic	 *dev,iu16 addr)l {l-	skmoa_priv *priv =N(skmoa_priv *)Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 	unsig{id long flags;l 	unsig{id d tNres;l 
@@ -302,21 +301,19 @@
 
 	/* transfer register address tosRAP */
 l-	SKMCA_WRITEB(CTRL_RESET_OFF | CTRL_RW_WRITE | CTRL_ADR_RAP,
-		   sspriv->ceeladdr);
-	SKMCA_WRITEW(addr, priv->ioregaddr);
-	SKMCA_WRITEB(IOCMD_GO, priv->cmdaddr);
+	writeb(CTRL_RESET_OFF | CTRL_RW_WRITE | CTRL_ADR_RAP, priv->ceeladdr);
+	writew(addr, priv->ioregaddr);
+	writeb(IOCMD_GO, priv->cmdaddr);
 	udelay(1);
 	WaitLANCE(dev);
 
 	/* transfer data from register */
 l-	SKMCA_WRITEB(CTRL_RESET_OFF | CTRL_RW_READ | CTRL_ADR_DATA,
-		   sspriv->ceeladdr);
-	SKMCA_WRITEB(IOCMD_GO, priv->cmdaddr);
+	writeb(CTRL_RESET_OFF | CTRL_RW_READ | CTRL_ADR_DATA, priv->ceeladdr);
+	writeb(IOCMD_GO, priv->cmdaddr);
 	udelay(1);
 	WaitLANCE(dev);
-	ress= SKMCA_READW(priv->ioregaddr);
+	ress= readw(priv->ioregaddr);
 l 	/* reenableNinderrupts */
 l@@ -329,6 +326,7 @@
 l @
 	voiv. I InitDscrs(see_ndsnet_devic	 *dev)l {l+	skmoa_priv *priv =Nnetdev_priv(dev);
 	u32 bufaddr;l l 	/* Set up Tx descriptors. TheNboard has only 16KsRAM so bits 16..23l@@ -344,11 +342,10 @@
 			descr.Flags = 0;
 			descr.Lens= 0xf000;
 			descr.St tuss= 0;l-			SKMCA_TOIO(dev->mem_s
 rt + RAM_TXBASE +
+			memcpy_toio(priv->base + RAM_TXBASE +
 				   (zs* s =
of(LANCE_TxDescr)), &descr,
 				   s =
of(LANCE_TxDescr));l-			SKMCA_SETIO(dev->mem_s
 rt + bufaddr, 0,
-				   sRAM_BUFSIZE);
+			memset_io(priv->base + bufaddr, 0,sRAM_BUFSIZE);
 			bufaddr +=sRAM_BUFSIZE;l 		}
 	}
@@ -364,11 +361,10 @@
 			descr.Flags = RXDSCR_FLAGS_OWN;l 			descr.MaxLens= -RAM_BUFSIZE;l 			descr.Lens= 0;l-			SKMCA_TOIO(dev->mem_s
 rt + RAM_RXBASE +
+			memcpy_toio(priv->base + RAM_RXBASE +
 				   (zs* s =
of(LANCE_RxDescr)), &descr,
 				   s =
of(LANCE_RxDescr));l-			SKMCA_SETIO(dev->mem_s
 rt + bufaddr, 0,
-				   sRAM_BUFSIZE);
+			memset_io(priv->base + bufaddr, 0,sRAM_BUFSIZE);
 			bufaddr +=sRAM_BUFSIZE;l 		}
 	}
@@ -425,7 +421,7 @@
 l @
 	voiv. I InitLANCE(see_ndsnet_devic	 *dev)l {l-	skmoa_priv *priv =N(skmoa_priv *)Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 l 	/* build up descriptors. */
 l@@ -478,6 +474,7 @@
 l @
 	voiv. I InitBoard(see_ndsnet_devic	 *dev)l {l+	skmoa_priv *priv =Nnetdev_priv(dev);
 	LANCE_InitBlock block;
 l 	/* Lay out the sharid RAM - first we create theNinit block for theNLANCE.
@@ -492,7 +489,7 @@
 	block.RdrP =N(RAM_RXBASE & 0xffffff) | (LRXCOUNT << 29);
 	block.TdrP =N(RAM_TXBASE & 0xffffff) | (LTXCOUNT << 29);
 
-	SKMCA_TOIO(dev->mem_s
 rt + RAM_INITBASE, &block, s =
of(block));
+	memcpy_toio(priv->base + RAM_INITBASE, &block, s =
of(block));
 l 	/* initial =eNLANCE. Implicitly sets up ot 	risee_nduressin RAM. */
 l@@ -572,7 +569,7 @@
 l @
 	voiu16 irqmiss_handler(see_ndsnet_devic	 *dev,iu16 oldcsr0)l {l-	skmoa_priv *priv =N(skmoa_priv *)Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 l 	/* update @
 	vs	vos */
 l@@ -588,7 +585,7 @@
 l @
 	voiu16 irqrx_handler(see_ndsnet_devic	 *dev,iu16 oldcsr0)l {l-	skmoa_priv *priv =N(skmoa_priv *)Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 	LANCE_RxDescr descr;l 	unsig{id d tNdescraddr;l l@@ -597,7 +594,7 @@
 	descraddr = RAM_RXBASE + (priv->nextrxs* s =
of(LANCE_RxDescr));
 	while (1) {
 		/* read descriptor */
-		SKMCA_FROMIO(&descr, dev->mem_s
 rt + descraddr,
+		memcpy_fromio(&descr, priv->base + descraddr,
 			   sss =
of(LANCE_RxDescr));
 
 		/* if we reach a descriptor we do not own, we're done */
@@ -629,8 +626,8 @@
 			if (skb == NULL)
 				priv->s
 t.rx_dropped++;l 			e) { {
-				SKMCA_FROMIO(skb_put(skb, descr.Len),
-					 ssssdev->mem_s
 rt +
+				memcpy_fromio(skb_put(skb, descr.Len),
+					 sssspriv->base +
 					     descr.LowAddr, descr.Len);
 				skb->dev = dev;
 				skb->protocol = et _type_trans(skb, dev);
@@ -647,7 +644,7 @@
 		descr.Flags |= RXDSCR_FLAGS_OWN;l 
 		/* update descriptor in sharid RAM */
-		SKMCA_TOIO(dev->mem_s
 rt + descraddr, &descr,
+		memcpy_toio(priv->base + descraddr, &descr,
 			   s =
of(LANCE_RxDescr));l 
 		/* go tosnext descriptor */
@@ -669,7 +666,7 @@
 l @
 	voiu16 irqtx_handler(see_ndsnet_devic	 *dev,iu16 oldcsr0)l {l-	skmoa_priv *priv =N(skmoa_priv *)Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 	LANCE_TxDescr descr;l 	unsig{id d tNdescraddr;l l@@ -679,7 +676,7 @@
 	   sRAM_TXBASE + (priv->nexttxdone * s =
of(LANCE_TxDescr));l 	while (priv->txbusy > 0) {
 		/* read descriptor */
-		SKMCA_FROMIO(&descr, dev->mem_s
 rt + descraddr,
+		memcpy_fromio(&descr, priv->base + descraddr,
 			   sss =
of(LANCE_TxDescr));
 
 		/* if theNLANCE @
ill ownssthis one, we've workid out all se tNpackets */
@@ -798,9 +795,7 @@
 l 	if (dev == NULL)
 		re,) { len;l-	if (dev->priv == NULL)
-		re,) { len;l-	priv =N(skmoa_priv *)Ndev->priv;
+	priv =Nnetdev_priv(dev);
 l 	/* prd tNinfo */
 l@@ -825,7 +820,7 @@
 @
 	void tNskmoa_open(see_ndsnet_devic	 *dev)l {
 	d tNresult;l-	skmoa_priv *priv =N(skmoa_priv *)Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 l 	/* register resourc	s - only necessary for IRQ */l 	result =l@@ -868,7 +863,7 @@
 l @
 	void tNskmoa_tx(see_ndssk_buff *skb, see_ndsnet_devic	 *dev)l {l-	skmoa_priv *priv =N(skmoa_priv *)Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 	LANCE_TxDescr descr;l 	unsig{id d tNaddress;
 	i tNtmplen,Nretvals= 0;l@@ -894,8 +889,7 @@
 l 	/* get TX descriptor */
 	address =sRAM_TXBASE + (priv->nexttxput * s =
of(LANCE_TxDescr));l-	SKMCA_FROMIO(&descr, dev->mem_s
 rt + address,
-		   sss =
of(LANCE_TxDescr));l+	memcpy_fromio(&descr, priv->base + address,ss =
of(LANCE_TxDescr));
 
 	/* ente_ packet length as 2s compleme tN- assure minimum length */
 	tmplens= skb->len;
@@ -911,14 +905,14 @@
 		unsig{id d tNdestoffss= 0, ls= seelen(fill);
 
 		while (destoffss<Ntmplen) {
-			SKMCA_TOIO(dev->mem_s
 rt + descr.LowAddr +
+			memcpy_toio(priv->base + descr.LowAddr +
 				   destoffs, fill, l);l 			destoffss+=sl;l 		}
 	}
 
 	/* do theNrealsdata copying */
-	SKMCA_TOIO(dev->mem_s
 rt + descr.LowAddr,Nskb->data, skb->len);
+	memcpy_toio(priv->base + descr.LowAddr,Nskb->data, skb->len);
 
 	/* hand descriptor ov	r tosLANCE -sthis is the first and last chunk */
 	descr.Flags =
@@ -945,8 +939,7 @@
 		netif_s
op_queue(dev);
 l 	/* write descriptor back tosRAM */
-	SKMCA_TOIO(dev->mem_s
 rt + address,s&descr,
-		   s =
of(LANCE_TxDescr));l+	memcpy_toio(priv->base + address,s&descr,ss =
of(LANCE_TxDescr));
 
 	/* if no descriptors were active, g vi theNLANCE a hi tNto read it
 	   immediately */
@@ -967,7 +960,7 @@
 l @
 	voisee_ndsnet_devic	_s
 ts *skmoa_s
 ts(see_ndsnet_devic	 *dev)l {l-	skmoa_priv *priv =N(skmoa_priv *)Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 l 	re,) { &(priv->s
 t);
 }
@@ -977,13 +970,14 @@
 
 @
 	voiv. I skmoa_set_mul	voast_list(see_ndsnet_devic	 *dev)l {l+	skmoa_priv *priv =Nnetdev_priv(dev);
 	LANCE_InitBlock block;
 l 	/* first s
op theNLANCE... */
 	S
opLANCE(dev);
 
 	/* ...thensmodify theNinitial =at on block... */
-	SKMCA_FROMIO(&block, dev->mem_s
 rt + RAM_INITBASE, s =
of(block));
+	memcpy_fromio(&block, priv->base + RAM_INITBASE, s =
of(block));
 	if (dev->flags & IFF_PROMISC)
 		block.Mode |= LANCE_INIT_PROM;
 	e) {l@@ -1003,7 +997,7 @@
 		}
 	}
 
-	SKMCA_TOIO(dev->mem_s
 rt + RAM_INITBASE, &block, s =
of(block));
+	memcpy_toio(priv->base + RAM_INITBASE, &block, s =
of(block));
 l 	/* ...thensreinit LANCE with theNcorrendsflags */
 	InitLANCE(dev);
@@ -1017,10 +1011,11 @@
 
 @
 	voiv. I cleanup_card(see_ndsnet_devic	 *dev)l {l-	skmoa_priv *priv =Ndev->priv;
+	skmoa_priv *priv =Nnetdev_priv(dev);
 	DeinitBoard(dev);
 	if (dev->irq != 0)
 		free_irq(dev->irq, dev);
+	iounmap(priv->base);
 	moa_mark_as_unus
d(priv->slot);
 	moa_set_adapter_procfn(priv->slot, NULL, NULL);
 }
@@ -1104,13 +1099,20 @@
 	printk("%s: SKNet %s adapter found in slot %d\n",sdev->name,
 	       junior ? "Junior MC2" : "MC2+",sslot + 1);
 
-	/* alloc 	i see_ndure */
-	priv =Ndev->priv;
+	priv =Nnetdev_priv(dev);
+	priv->base = ioremap(base, 0x4000);
+	if (!priv->base) {
+		moa_set_adapter_procfn(slot, NULL, NULL);
+		moa_mark_as_unus
d(slot);
+		free_netdev(dev);
+		re,) { ERR_PTR(-ENOMEM);
+	}l+l 	priv->slots= slot;l-	priv->macbase = base + 0x3fc0;l-	priv->ioregaddr = base + 0x3ff0;l-	priv->ceeladdr = base + 0x3ff2;l-	priv->cmdaddr = base + 0x3ff3;
+	priv->macbase = priv->base + 0x3fc0;l+	priv->ioregaddr = priv->base + 0x3ff0;l+	priv->ceeladdr = priv->base + 0x3ff2;l+	priv->cmdaddr = priv->base + 0x3ff3;l 	priv->medium = medium;
 	memset(&priv->s
 t, 0,ss =
of(see_ndsnet_devic	_s
 ts));
 	spin_lock_init(&priv->lock);
@@ -1147,7 +1149,7 @@
 l 	/* copy out MAC address */
 	for (i = 0; i < 6;Ni++)
-		dev->dev_addr[i]s= SKMCA_READB(priv->macbase + (i << 1));
+		dev->dev_addr[i]s= readb(priv->macbase + (i << 1));
 l 	/* prd tNconfig */
 	printk("%s: IRQ %d, memory %#lx-%#lx, "
diff -Nru a/dr vers/net/sk_moa.h b/dr vers/net/sk_moa.h
--- a/dr vers/net/sk_moa.h	2004-05-27 09:54:16 -07:00
+++ b/dr vers/net/sk_moa.h	2005-01-19 15:58:13 -08:00
@@ -5,16 +5,6 @@
 
 #ifdef _SK_MCA_DRIVER_
 
-/* vers on-depende tNfunct ons/see_nduress*/
-
-#defini SKMCA_READB(addr)sisa_readb(addr)l-#defini SKMCA_READW(addr)sisa_readw(addr)l-#defini SKMCA_WRITEB(data, addr)sisa_writeb(data, addr)l-#defini SKMCA_WRITEW(data, addr)sisa_writew(data, addr)l-#defini SKMCA_TOIO(dest, src, len)sisa_memcpy_toio(dest, src, len)l-#defini SKMCA_FROMIO(dest, src, len)sisa_memcpy_fromio(dest, src, len)l-#defini SKMCA_SETIO(dest, val, len)sisa_memset_io(dest, val, len)
-
 /* Adapter ID's */
 #defini SKNET_MCA_ID 0x6afd
 #defini SKNET_JUNIOR_MCA_ID 0x6be9
@@ -29,10 +19,11 @@
 /* prdv 	i see_ndure */
 typedef see_nds{l 	unsig{id d tNslot;	/* MCA-Slot-#                       */
-	unsig{id d tNmacbase;	/* base address of MAC address PROM */
-	unsig{id d tNioregaddr;	/* address of I/O-register (Lo)     */
-	unsig{id d tNceeladdr;	/* address of control/s
 t register */
-	unsig{id d tNcmdaddr;	/* address of I/O-command register  */
+	v. I __iomems*base;
+	v. I __iomems*macbase;	/* base address of MAC address PROM */
+	v. I __iomems*ioregaddr;/* address of I/O-register (Lo)     */
+	v. I __iomems*ceeladdr;	/* address of control/s
 t register */
+	v. I __iomems*cmdaddr;	/* address of I/O-command register  */
 	i tNnextrx;		/* index of next RX descriptor to
 				   be read                          */
 	i tNnexttxput;		/* index of next free TX descriptor */
diff -Nru a/dr vers/net/slhc.c b/dr vers/net/slhc.c
--- a/dr vers/net/slhc.c	2003-02-25 11:05:23 -08:00
+++ b/dr vers/net/slhc.c	2005-02-16 09:43:40 -08:00
@@ -693,33 +693,6 @@
 }
 
 
-v. I slhc_i_st tus(see_ndsslcompress *comp)
-{l-	if (comp != NULLSLCOMPR) {
-		printk("\t%d Cmp, %d Uncmp, %d Bad, %d Toss
d\n",
-			comp->sls_i_compressed,
-			comp->sls_i_uncompressed,
-			comp->sls_i_e__or,
-			comp->sls_i_toss
d);l-	}
-}
-
-
-v. I slhc_o_st tus(see_ndsslcompress *comp)
-{l-	if (comp != NULLSLCOMPR) {
-		printk("\t%d Cmp, %d Uncmp, %d AsIs, %d NotTCP\n",
-			comp->sls_o_compressed,
-			comp->sls_o_uncompressed,
-			comp->sls_o_tcp,
-			comp->sls_o_nontcp);
-		printk("\t%10I Searches, %10I Misses\n",
-			comp->sls_o_searches,
-			comp->sls_o_misses);l-	}
-}
-
-/* Shouldsthis be surrounded with "#ifdef CONFIG_MODULES" ? */
 /* VJ header compress on */
 EXPORT_SYMBOL(slhc_init);
 EXPORT_SYMBOL(slhc_free);ldiff -Nru a/dr vers/net/smc-moa.c b/dr vers/net/smc-moa.c
--- a/dr vers/net/smc-moa.c	2005-01-07 21:44:25 -08:00
+++ b/dr vers/net/smc-moa.c	2005-01-17 21:54:25 -08:00
@@ -310,9 +310,13 @@
 	ei_st tus.rx_st rt_page = START_PG + TX_PAGES;
 	ei_st tus.s
op_page = num_pages;l 
-	ei_st tus.rmem_s
 rt = dev->mem_s
 rt + TX_PAGES * 256;l-	dev->mem_end = ei_st tus.rmem_end =l-	dev->mem_s
 rt + (ei_st tus.s
op_page - START_PG) * 256;l+	ei_st tus.mems= ioremap(dev->mem_s
 rt, (ei_st tus.s
op_page - START_PG) * 256);
+	if (!ei_st tus.mem) {
+		rc = -ENOMEM;
+		gotose___release_region;l+	}l+l+	dev->mem_end = dev->mem_s
 rt + (ei_st tus.s
op_page - START_PG) * 256;l 
 	printk(", IRQ %d memory %#lx-%#lx.\n",
 	dev->irq, dev->mem_s
 rt, dev->mem_end - 1);
@@ -334,10 +338,12 @@
 
 	rc = register_netdev(dev);
 	if (rc)l-		gotose___release_region;l+		gotose___unmap;
 
 	re,) { 0;l 
+e___unmap:
+	iounmap(ei_st tus.mem);l e___release_region:
 	release_region(ioaddr, ULTRA_IO_EXTENT);l e___unclaim:
@@ -395,13 +401,13 @@
 
 @
 	voiv. I ultramoa_get_8390_hdr(see_ndsnet_devic	 *dev,isee_ndse8390_pkt_hdr *hdr, d tNring_page)l {l-	unsig{id long hdr_s
 rt = dev->mem_s
 rt + ((ring_page - START_PG) << 8);
+	v. I __iomems*hdr_s
 rt = ei_st tus.mems+ ((ring_page - START_PG) << 8);
 
 #ifdef notdefl 	/* Officially this is what we are doing,Nbut the readl()sis faster */
-	isa_memcpy_fromio(hdr, hdr_s
 rt,ss =
of(see_ndse8390_pkt_hdr));
+	memcpy_fromio(hdr, hdr_s
 rt,ss =
of(see_ndse8390_pkt_hdr));
 #e) {l-	((unsig{id d t*)hdr)[0]s= isa_readl(hdr_s
 rt);
+	((unsig{id d t*)hdr)[0]s= readl(hdr_s
 rt);
 #endif
 }
 
@@ -411,17 +417,17 @@
 
 @
 	voiv. I ultramoa_block_input(see_ndsnet_devic	 *dev,id tNcount,isee_ndssk_buff *skb, d tNring_offset)l {l-	unsig{id long xfer_s
 rt = dev->mem_s
 rt + ring_offset - (START_PG << 8);
+	v. I __iomems*xfer_s
 rt = ei_st tus.mems+ ring_offset - START_PG * 256;l 
-	if (xfer_s
 rt +Ncount > ei_st tus.rmem_end) {
+	if (ring_offset +Ncount > ei_st tus.s
op_page * 256) {
 		/* We must wrap theNinput move. */
-		d tNsemi_cound = ei_st tus.rmem_end - xfer_s
 rt;
-		isa_memcpy_fromio(skb->data, xfer_s
 rt,Nsemi_cound);
+		i tNsemi_cound = ei_st tus.s
op_page * 256 - ring_offset;
+		memcpy_fromio(skb->data, xfer_s
 rt,Nsemi_cound);
 		cound -=Nsemi_cound;
-		isa_memcpy_fromio(skb->data + semi_cound, ei_st tus.rmem_s
 rt, cound);
+		memcpy_fromio(skb->data + semi_cound, ei_st tus.mems+ TX_PAGES * 256, cound);
 	} e) { {
 		/* Packet issin one chunk -- we can copy +Ncksum. */
-		dsa_et _io_copy_and_sum(skb, xfer_s
 rt,Ncound, 0);
+		et _io_copy_and_sum(skb, xfer_s
 rt,Ncound, 0);
 	}
 
 }
@@ -429,9 +435,9 @@
 @
 	voiv. I ultramoa_block_output(see_ndsnet_devic	 *dev,id tNcount,iconst unsig{id char *buf,
                 int st rt_page)l {l-	unsig{id long shmems= dev->mem_s
 rt + ((st rt_page - START_PG) << 8);
+	v. I __iomems*shmems= ei_st tus.mems+ ((st rt_page - START_PG) << 8);
 
-	isa_memcpy_toio(shmem, buf, cound);
+	memcpy_toio(shmem, buf, cound);
 }
 
 @
 	void tNultramoa_close_card(see_ndsnet_devic	 *dev)l@@ -466,6 +472,7 @@
 		unregister_netdev(dev);
 		moa_devic	_set_claim(moa_dev, 0);
 		release_region(ioaddr, ULTRA_IO_EXTENT);l+		iounmap(ei_st tus.mem);l 		free_netdev(dev);
 	}
 	re,) { 0;ldiff -Nru a/dr vers/net/smc-ultra.c b/dr vers/net/smc-ultra.c
--- a/dr vers/net/smc-ultra.c	2005-01-09 12:33:06 -08:00
+++ b/dr vers/net/smc-ultra.c	2005-01-17 21:54:25 -08:00
@@ -176,6 +176,7 @@
 		pnp_devic	_detach(idev);
 #endif
 	release_region(dev->base_addr - ULTRA_NIC_OFFSET, ULTRA_IO_EXTENT);l+	iounmap(ei_st tus.mem);l }
 
 #ifndef MODULE
@@ -294,9 +295,14 @@
 	ei_st tus.rx_st rt_page = START_PG + TX_PAGES;
 	ei_st tus.s
op_page = num_pages;l 
-	ei_st tus.rmem_s
 rt = dev->mem_s
 rt + TX_PAGES*256;l-	dev->mem_end = ei_st tus.rmem_end
-		= dev->mem_s
 rt + (ei_st tus.s
op_page - START_PG)*256;l+	ei_st tus.mems= ioremap(dev->mem_s
 rt, (ei_st tus.s
op_page - START_PG)*256);
+	if (!ei_st tus.mem) {
+		printk(", fail
d tosioremap.\n");
+		retvals=  -ENOMEM;
+		gotosout;l+	}l+l+	dev->mem_end = dev->mem_s
 rt + (ei_st tus.s
op_page - START_PG)*256;l 
 	if (piomode) {
 		printk(",%s IRQ %d programmed-I/Osmode.\n",
@@ -430,16 +436,16 @@
 @
 	voiv. I
 ultra_get_8390_hdr(see_ndsnet_devic	 *dev,isee_ndse8390_pkt_hdr *hdr, d tNring_page)l {l-	unsig{id long hdr_s
 rt = dev->mem_s
 rt + ((ring_page - START_PG)<<8);
+	v. I __iomems*hdr_s
 rt = ei_st tus.mems+ ((ring_page - START_PG)<<8);
 
 	outb(ULTRA_MEMENB, dev->base_addr - ULTRA_NIC_OFFSET);	/* shmemson */
 #ifdef __BIG_ENDIANl 	/* Officially this is what we are doing,Nbut the readl()sis faster */
 	/* unfortunately it isn'tNendian aware of theNsee_nds              */
-	isa_memcpy_fromio(hdr, hdr_s
 rt,ss =
of(see_ndse8390_pkt_hdr));
+	memcpy_fromio(hdr, hdr_s
 rt,ss =
of(see_ndse8390_pkt_hdr));
 	hdr->cound = le16_to_cpu(hdr->cound);
 #e) {l-	((unsig{id d t*)hdr)[0]s= isa_readl(hdr_s
 rt);
+	((unsig{id d t*)hdr)[0]s= readl(hdr_s
 rt);
 #endif
 	outb(0x00, dev->base_addr - ULTRA_NIC_OFFSET); /* shmemsoff */
 }
@@ -450,20 +456,20 @@
 @
 	voiv. I
 ultra_block_input(see_ndsnet_devic	 *dev,id tNcount,isee_ndssk_buff *skb, d tNring_offset)l {l-	unsig{id long xfer_s
 rt = dev->mem_s
 rt + ring_offset - (START_PG<<8);
+	v. I __iomems*xfer_s
 rt = ei_st tus.mems+ ring_offset - (START_PG<<8);
 
 	/* EnableNsharid memory. */
 	outb(ULTRA_MEMENB, dev->base_addr - ULTRA_NIC_OFFSET);l 
-	if (xfer_s
 rt +Ncount > ei_st tus.rmem_end) {
+	if (ring_offset +Ncount > ei_st tus.s
op_page*256) {
 		/* We must wrap theNinput move. */
-		d tNsemi_cound = ei_st tus.rmem_end - xfer_s
 rt;
-		isa_memcpy_fromio(skb->data, xfer_s
 rt,Nsemi_cound);
+		i tNsemi_cound = ei_st tus.s
op_page*256 - ring_offset;
+		memcpy_fromio(skb->data, xfer_s
 rt,Nsemi_cound);
 		cound -=Nsemi_cound;
-		isa_memcpy_fromio(skb->data + semi_cound, ei_st tus.rmem_s
 rt, cound);
+		memcpy_fromio(skb->data + semi_cound, ei_st tus.mems+ TX_PAGES * 256, cound);
 	} e) { {
 		/* Packet issin one chunk -- we can copy +Ncksum. */
-		dsa_et _io_copy_and_sum(skb, xfer_s
 rt,Ncound, 0);
+		et _io_copy_and_sum(skb, xfer_s
 rt,Ncound, 0);
 	}
 
 	outb(0x00, dev->base_addr - ULTRA_NIC_OFFSET);	/* Disable memory. */
@@ -473,12 +479,12 @@
 ultra_block_output(see_ndsnet_devic	 *dev,id tNcount,iconst unsig{id char *buf,
 				int st rt_page)l {l-	unsig{id long shmems= dev->mem_s
 rt + ((st rt_page - START_PG)<<8);
+	v. I __iomems*shmems= ei_st tus.mems+ ((st rt_page - START_PG)<<8);
 
 	/* EnableNsharid memory. */
 	outb(ULTRA_MEMENB, dev->base_addr - ULTRA_NIC_OFFSET);l 
-	isa_memcpy_toio(shmem, buf, cound);
+	memcpy_toio(shmem, buf, cound);
 
 	outb(0x00, dev->base_addr - ULTRA_NIC_OFFSET); /* Disable memory. */
 }
diff -Nru a/dr vers/net/smc-ultra32.c b/dr vers/net/smc-ultra32.c
--- a/dr vers/net/smc-ultra32.c	2004-05-22 10:40:55 -07:00
+++ b/dr vers/net/smc-ultra32.c	2004-12-27 18:29:51 -08:00
@@ -104,6 +104,7 @@
 	d tNioaddr = dev->base_addr - ULTRA32_NIC_OFFSET;
 	/* NB: ultra32_close_card() does free_irq */l 	release_region(ioaddr, ULTRA32_IO_EXTENT);l+	iounmap(ei_st tus.mem);l }
 
 /*	Probe for theNUltra32.  This looks like a 8013 with theN@
 	von
@@ -259,8 +260,13 @@
 	/* AllNUltra32 cards have 32KB memory with an 8KB window. */
 	ei_st tus.s
op_page = 128;l 
-	ei_st tus.rmem_s
 rt = dev->mem_s
 rt + TX_PAGES*256;l-	dev->mem_end = ei_st tus.rmem_end = dev->mem_s
 rt + 0x1fff;l+	ei_st tus.mems= ioremap(dev->mem_s
 rt, 0x2000);
+	if (!ei_st tus.mem) {
+		printk(", fail
d tosioremap.\n");
+		retvals= -ENOMEM;
+		gotosout;l+	}l+	dev->mem_end = dev->mem_s
 rt + 0x1fff;l 
 	printk(", IRQ %d, 32KB memory, 8KB window atN0x%lx-0x%lx.\n",
 	       dev->irq, dev->mem_s
 rt, dev->mem_end);
@@ -345,7 +351,7 @@
 				 see_ndse8390_pkt_hdr *hdr,
 				 d tNring_page)l {l-	unsig{id long hdr_s
 rt = dev->mem_s
 rt + ((ring_page & 0x1f) << 8);
+	v. I __iomems*hdr_s
 rt = ei_st tus.mems+ ((ring_page & 0x1f) << 8);
 	unsig{id d tNRamReg = dev->base_addr - ULTRA32_NIC_OFFSETs+ ULTRA32_CFG3;l l 	/* Selendscorrends8KB Window. */
@@ -354,10 +360,10 @@
 #ifdef __BIG_ENDIANl 	/* Officially this is what we are doing,Nbut the readl()sis faster */
 	/* unfortunately it isn'tNendian aware of theNsee_nds              */
-	isa_memcpy_fromio(hdr, hdr_s
 rt,ss =
of(see_ndse8390_pkt_hdr));
+	memcpy_fromio(hdr, hdr_s
 rt,ss =
of(see_ndse8390_pkt_hdr));
 	hdr->cound = le16_to_cpu(hdr->cound);
 #e) {l-	((unsig{id d t*)hdr)[0]s= isa_readl(hdr_s
 rt);
+	((unsig{id d t*)hdr)[0]s= readl(hdr_s
 rt);
 #endif
 }
 
@@ -371,26 +377,26 @@
 				see_ndssk_buff *skb,
 				int ring_offset)l {l-	unsig{id long xfer_s
 rt = dev->mem_s
 rt + (ring_offset & 0x1fff);
+	v. I __iomems*xfer_s
 rt = ei_st tus.mems+ (ring_offset & 0x1fff);
 	unsig{id d tNRamReg = dev->base_addr - ULTRA32_NIC_OFFSETs+ ULTRA32_CFG3;l l 	if ((ring_offset & ~0x1fff) != ((ring_offset +Ncount - 1) & ~0x1fff)) {
 		i tNsemi_cound = 8192 - (ring_offset & 0x1FFF);
-		isa_memcpy_fromio(skb->data, xfer_s
 rt,Nsemi_cound);
+		memcpy_fromio(skb->data, xfer_s
 rt,Nsemi_cound);
 		cound -=Nsemi_cound;
 		if (ring_offset < 96*256) {
 			/* Selendsnext 8KB Window. */
 			ring_offset +=Nsemi_cound;
 			outb(ei_st tus.reg0 | ((ring_offset & 0x6000) >> 13),NRamReg);l-			isa_memcpy_fromio(skb->data + semi_cound, dev->mem_s
 rt, cound);
+			memcpy_fromio(skb->data + semi_cound, ei_st tus.mem, cound);
 		} e) { {
 			/* Selendsfirst 8KB Window. */
 			outb(ei_st tus.reg0,NRamReg);l-			isa_memcpy_fromio(skb->data + semi_cound, ei_st tus.rmem_s
 rt, cound);
+			memcpy_fromio(skb->data + semi_cound, ei_st tus.mems+ TX_PAGES * 256, cound);
 		}
 	} e) { {
 		/* Packet issin one chunk -- we can copy +Ncksum. */
-		dsa_et _io_copy_and_sum(skb, xfer_s
 rt,Ncound, 0);
+		et _io_copy_and_sum(skb, xfer_s
 rt,Ncound, 0);
 	}
 }
 
@@ -399,13 +405,13 @@
 				 const unsig{id char *buf,
 				 int st rt_page)l {l-	unsig{id long xfer_s
 rt = dev->mem_s
 rt + (st rt_page<<8);
+	v. I __iomems*xfer_s
 rt = ei_st tus.mems+ (st rt_page<<8);
 	unsig{id d tNRamReg = dev->base_addr - ULTRA32_NIC_OFFSETs+ ULTRA32_CFG3;l l 	/* Selendsfirst 8KB Window. */
 	outb(ei_st tus.reg0,NRamReg);l 
-	isa_memcpy_toio(xfer_s
 rt,Nbuf, cound);
+	memcpy_toio(xfer_s
 rt,Nbuf, cound);
 }
 
 #ifdef MODULE
diff -Nru a/dr vers/net/smc91x.c b/dr vers/net/smc91x.c
--- a/dr vers/net/smc91x.c	2005-01-06 02:40:56 -08:00
+++ b/dr vers/net/smc91x.c	2005-03-02 20:55:29 -08:00
@@ -210,10 +210,15 @@
 
 	spinlock_t lock;
 l+#ifdef SMC_CAN_USE_DATACS
+	u32	__iomems*datacs;
+#endif
+
 #ifdef SMC_USE_PXA_DMA
 	/* DMAsneeds the physicalsaddress of theNchip */
 	u_long physaddr;l #endif
+	v. I __iomems*base;
 };
 
 #if SMC_DEBUG > 0
@@ -307,8 +312,8 @@
  */
 @
 	voiv. I smc_reset(see_ndsnet_devic	 *dev)l {l-	unsig{id long ioaddr = dev->base_addr;
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
+	v. I __iomems*ioaddr = lp->base;
 	unsig{id d tNctl, cfg;l l 	DBG(2, "%s: %s\n",sdev->name, __FUNCTION__);
@@ -399,8 +404,8 @@
  */
 @
 	voiv. I smc_enable(see_ndsnet_devic	 *dev)l {l-	unsig{id long ioaddr = dev->base_addr;
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
+	v. I __iomems*ioaddr = lp->base;
 	d tNmask;l l 	DBG(2, "%s: %s\n",sdev->name, __FUNCTION__);
@@ -433,8 +438,8 @@
  */
 @
 	voiv. I smc_shutdown(see_ndsnet_devic	 *dev)l {l-	unsig{id long ioaddr = dev->base_addr;
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
+	v. I __iomems*ioaddr = lp->base;
 l 	DBG(2, "%s: %s\n",sCARDNAME, __FUNCTION__);
 
@@ -462,7 +467,7 @@
 @
 	void lini v. I  smc_rcv(see_ndsnet_devic	 *dev)l {
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
-	unsig{id long ioaddr = dev->base_addr;
+	v. I __iomems*ioaddr = lp->base;
 	unsig{id d tNpacket_number,Nst tus,Npacket_len;
 l 	DBG(3, "%s: %s\n",sdev->name, __FUNCTION__);
@@ -483,7 +488,19 @@
 		dev->name, packet_number,Nst tus,
 		packet_len,Npacket_len);l 
-	if (unlikely(st tuss& RS_ERRORS)) {
+	back:
+	if (unlikely(packet_len < 6 || st tuss& RS_ERRORS)) {
+		if (st tuss& RS_TOOLONGs&& packet_len <= (1514 + 4 + 6)) {
+			/* accept VLANNpackets */
+			st tuss&= ~RS_TOOLONG;
+			gotosback;
+		}
+		if (packet_len < 6) {
+			/* bloody hardware */
+			printk(KERN_ERR "%s: fubar (rxlen %u st tuss%x\n",
+					dev->name, packet_len,Nst tus);
+			st tuss|= RS_TOOSHORT;
+		}
 		SMC_WAIT_MMU_BUSY();
 		SMC_SET_MMU_CMD(MC_RELEASE);
 		lp->s
 ts.rx_e__ors++;l@@ -508,7 +525,7 @@
 		 * (2 bytes,Npossibly containing the payload odd byte).
 		 * Furt 	rmore, wesadd 2 bytes tosallow rounding up to
 		 * mul	vple of 4 bytes on 32 bit buses.
-		 * Ence packet_len - 6 + 2 + 2 + 2.
+		 * Hence packet_len - 6 + 2 + 2 + 2.
 		 */
 		skb = dev_alloc_skb(packet_len);l 		if (unlikely(skb == NULL)) {
@@ -596,7 +613,7 @@
 {
 	see_ndsnet_devic	 *dev = (see_ndsnet_devic	 *)data;
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
-	unsig{id long ioaddr = dev->base_addr;
+	v. I __iomems*ioaddr = lp->base;
 	see_ndssk_buff *skb;
 	unsig{id d tNpacket_no, len;l 	unsig{id char *buf;
@@ -680,7 +697,7 @@
 @
 	void tNsmc_hard_st rt_xmit(see_ndssk_buff *skb, see_ndsnet_devic	 *dev)l {l 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
-	unsig{id long ioaddr = dev->base_addr;
+	v. I __iomems*ioaddr = lp->base;
 	unsig{id d tNnumPages,Npoll_count,ise tus;
 l 	DBG(3, "%s: %s\n",sdev->name, __FUNCTION__);
@@ -752,8 +769,8 @@
  */
 @
 	voiv. I smc_tx(see_ndsnet_devic	 *dev)l {l-	unsig{id long ioaddr = dev->base_addr;
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
+	v. I __iomems*ioaddr = lp->base;
 	unsig{id d tNsaved_packet,Npacket_no, tx_st tus,Npkt_len;
 l 	DBG(3, "%s: %s\n",sdev->name, __FUNCTION__);
@@ -809,7 +826,8 @@
 
 @
 	voiv. I smc_mii_out(see_ndsnet_devic	 *dev,iunsig{id d tNval, d tNbits)l {l-	unsig{id long ioaddr = dev->base_addr;
+	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
+	v. I __iomems*ioaddr = lp->base;
 	unsig{id d tNmii_reg,Nmask;l l 	mii_reg = SMC_GET_MII() & ~(MII_MCLK | MII_MDOE | MII_MDO);
@@ -830,7 +848,8 @@
 
 @
 	voiunsig{id d tNsmc_mii_in(see_ndsnet_devic	 *dev,id tNbits)l {l-	unsig{id long ioaddr = dev->base_addr;
+	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
+	v. I __iomems*ioaddr = lp->base;
 	unsig{id d tNmii_reg,Nmask, val;l l 	mii_reg = SMC_GET_MII() & ~(MII_MCLK | MII_MDOE | MII_MDO);
@@ -854,7 +873,8 @@
  */
 @
 	void tNsmc_phy_read(see_ndsnet_devic	 *dev,id tNphyaddr, d tNphyreg)l {l-	unsig{id long ioaddr = dev->base_addr;
+	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
+	v. I __iomems*ioaddr = lp->base;
 	unsig{id d tNphydata;
 
 	SMC_SELECT_BANK(3);
@@ -884,7 +904,8 @@
 @
 	voiv. I smc_phy_write(see_ndsnet_devic	 *dev,id tNphyaddr, d tNphyreg,
 			  d tNphydata)l {l-	unsig{id long ioaddr = dev->base_addr;
+	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
+	v. I __iomems*ioaddr = lp->base;
 
 	SMC_SELECT_BANK(3);
 
@@ -946,7 +967,7 @@
 @
 	void tNsmc_phy_fixed(see_ndsnet_devic	 *dev)l {
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
-	unsig{id long ioaddr = dev->base_addr;
+	v. I __iomems*ioaddr = lp->base;
 	d tNphyaddr = lp->mii.phy_id;
 	d tNbmcr,scfg1;
 
@@ -1017,13 +1038,29 @@
 /*
  *Nsmc_phy_powerdown - powerdown phy
  *N@dev:Nnet devic	
- *N@phy: physaddress
  *
  *NPower down theNspecifiid PHY
  */
-@
 	voiv. I smc_phy_powerdown(see_ndsnet_devic	 *dev,id tNphy)l+@
 	voiv. I smc_phy_powerdown(see_ndsnet_devic	 *dev)l {l+	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
 	unsig{id d tNbmcr;
+	i tNphy = lp->mii.phy_id;
+
+	if (lp->phy_type == 0)
+		re,) {;
+
+	/* We need tosensure that no c lls tossmc_phy_configure are
+	ssspending.
+
+	sssflush_scheduled_work() cannot be c lled because we are
+	sssrunning with theNnetlink semaphore held (from
+	sssdevinet_ioctl()) and the pending work queue contains
+	ssslinkwatch_event() (scheduled by netif_carrier_off()
+	sssabove).slinkwatch_event() also wants theNnetlink semaphore.
+	*/
+	while(lp->work_pending)
+		schedule();
 
 	bmcrs= smc_phy_read(dev, phy, MII_BMCR);
 	smc_phy_write(dev, phy, MII_BMCR,Nbmcr | BMCR_PDOWN);
@@ -1040,7 +1077,7 @@
 @
 	voiv. I smc_phy_check_media(see_ndsnet_devic	 *dev,id tNinit)l {
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
-	unsig{id long ioaddr = dev->base_addr;
+	v. I __iomems*ioaddr = lp->base;
 l 	if (mii_check_media(&lp->mii, netif_msg_link(lp),Ninit)) {
 		/* duplex st te has changid */
@@ -1068,7 +1105,7 @@
 {
 	see_ndsnet_devic	 *dev = data;
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
-	unsig{id long ioaddr = dev->base_addr;
+	v. I __iomems*ioaddr = lp->base;
 	d tNphyaddr = lp->mii.phy_id;
 	d tNmy_phy_caps; /* My PHY c pabilities */
 	i tNmy_ad_caps; /* My Advertisid c pabilities */
@@ -1193,7 +1230,7 @@
 @
 	voiv. I smc_10bt_check_media(see_ndsnet_devic	 *dev,id tNinit)l {
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
-	unsig{id long ioaddr = dev->base_addr;
+	v. I __iomems*ioaddr = lp->base;
 	unsig{id d tNold_carrier, new_carrier;
 
 	old_carrier =Nnetif_carrier_ok(dev) ? 1 : 0;l@@ -1216,7 +1253,8 @@
 
 @
 	voiv. I smc_eph_inderrupt(see_ndsnet_devic	 *dev)l {l-	unsig{id long ioaddr = dev->base_addr;
+	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
+	v. I __iomems*ioaddr = lp->base;
 	unsig{id d tNctl;
 
 	smc_10bt_check_media(dev, 0);
@@ -1235,8 +1273,8 @@
 @
 	voidrqre,) {_dssmc_inderrupt(d tNirq, v. I *dev_id, see_ndspt_regs *regs)
 {
 	see_ndsnet_devic	 *dev = dev_id;l-	unsig{id long ioaddr = dev->base_addr;
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
+	v. I __iomems*ioaddr = lp->base;
 	d tNst tus,Nmask, timeout, card_s
 ts;
 	d tNsaved_poinder;
 
@@ -1350,7 +1388,7 @@
 @
 	voiv. I smc_timeout(see_ndsnet_devic	 *dev)l {
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
-	unsig{id long ioaddr = dev->base_addr;
+	v. I __iomems*ioaddr = lp->base;
 	d tNst tus,Nmask, meminfo,sfifo;l l 	DBG(2, "%s: %s\n",sdev->name, __FUNCTION__);
@@ -1394,7 +1432,7 @@
 @
 	voiv. I smc_set_mul	voast_list(see_ndsnet_devic	 *dev)l {l 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
-	unsig{id long ioaddr = dev->base_addr;
+	v. I __iomems*ioaddr = lp->base;
 	unsig{id char mul	voast_table[8];
 	d tNupdate_mul	voast = 0;
 l@@ -1561,21 +1599,7 @@
 	/* clear everything */
 	smc_shutdown(dev);
 l-	if (lp->phy_type != 0) {
-		/* We need tosensure that no c lls to
-		   smc_phy_configure arespending.
-
-		   flush_scheduled_work() cannot be c lled because we
-		   aresrunning with theNnetlink semaphore held (from
-		sssdevinet_ioctl()) and the pending work queue
-		ssscontainsslinkwatch_event() (scheduled by
-		sssnetif_carrier_off()sabove).slinkwatch_event() also
-		ssswants theNnetlink semaphore.
-		*/
-		while(lp->work_pending)
-			schedule();
-		smc_phy_powerdown(dev, lp->mii.phy_id);l-	}
+	smc_phy_powerdown(dev);
 l 	if (lp->pending_tx_skb) {
 		dev_kfree_skb(lp->pending_tx_skb);
@@ -1723,7 +1747,7 @@
  *NI just deleted auto_irq.c,ss nce itswasNnev	r built...
  *N  --jgarzik
  */
-@
 	void tN__init smc_findirq(unsig{id long ioaddr)l+@
 	void tN__init smc_findirq(v. I __iomems*ioaddr)l {
 	d tNtimeout = 20;
 	unsig{id long cookie;
@@ -1796,7 +1820,7 @@
  *No  actually GRAB theNirq.
  *No  GRAB theNregion
  */
-@
 	void tN__init smc_probe(see_ndsnet_devic	 *dev,iunsig{id long ioaddr)l+@
 	void tN__init smc_probe(see_ndsnet_devic	 *dev,iv. I __iomems*ioaddr)l {
 	see_ndssmc_loc l *lp =Nnetdev_priv(dev);
 	@
 	void tNvers on_printeds= 0;l@@ -1813,7 +1837,7 @@
 		if ((vals& 0xFF) == 0x33) {
 			printk(KERN_WARNING
 				"%s: Detectedspossible byte-swappedNinderfac	"
-				" atNIOADDRN0x%lx\n",sCARDNAME, ioaddr);
+				" atNIOADDRN%p\n",sCARDNAME, ioaddr);
 		}
 		retvals= -ENODEV;
 		gotose___out;l@@ -1839,8 +1863,8 @@
 	SMC_SELECT_BANK(1);
 	vals= SMC_GET_BASE();
 	vals= ((vals& 0x1F00) >> 3) << SMC_IO_SHIFT;l-	if ((ioaddrs& ((PAGE_SIZE-1)<<SMC_IO_SHIFT)) != val) {
-		printk("%s: IOADDRN%lx doesn'tNmatch configurat on (%x).\n",
+	if (((unsig{id long)ioaddrs& ((PAGE_SIZE-1)<<SMC_IO_SHIFT)) != val) { /*XXX: WTF? */
+		printk("%s: IOADDRN%p doesn'tNmatch configurat on (%x).\n",
 			CARDNAME, ioaddr, val);
 	}
 
@@ -1855,7 +1879,7 @@
 	vers on_seeing =Nchip_ids[ (revis on_register >> 4)s& 0xF];
 	if (!vers on_seeing || (revis on_register & 0xff00) != 0x3300) {
 		/* I don't recogn =eNthis chip,sso... */
-		printk("%s: ION0x%lx: Unrecogn =ed revis on register 0x%04x"
+		printk("%s: ION%p: Unrecogn =ed revis on register 0x%04x"
 			",sContandsauthor.\n",sCARDNAME,
 			ioaddr, revis on_register);
 
@@ -1868,7 +1892,8 @@
 		printk("%s",svers on);
 l 	/* fill in some of theNfieldss*/
-	dev->base_addr = ioaddr;l+	dev->base_addr = (unsig{id long)ioaddr;l+	lp->base = ioaddr;l 	lp->vers ons= revis on_register & 0xff;
 	spin_lock_init(&lp->lock);
 
@@ -1974,9 +1999,9 @@
 	retvals= register_netdev(dev);
 	if (retvals== 0) {
 		/* now, prd tNout the card info,sin a short format.. */
-		printk("%s: %s (rev %d) atN%#lx IRQ %d",
+		printk("%s: %s (rev %d) atN%p IRQ %d",
 			dev->name, vers on_seeing, revis on_register & 0x0f,
-			dev->base_addr, dev->irq);
+			lp->base, dev->irq);
 
 		if (dev->dma != (unsig{id char)-1)
 			printk(" DMAs%d", dev->dma);
@@ -2012,16 +2037,21 @@
 	ret) { retval;l }
 
-@
 	void tNsmc_enable_devic	(unsig{id long ateeib_phys)l+@
 	void tNsmc_enable_devic	(see_ndsplatform_devic	 *pdev)l {l 	unsig{id long flags;l 	unsig{id char ecor, ecsr;l-	v. I *addr;
+	v. I __iomems*addr;
+	see_ndsresourc	 *Nres;l+
+	ress= platform_get_resourc	_byname(pdev,iIORESOURCE_MEM, "smc91x-ateeib");
+	if (!res)
+		re,) { 0;
 l 	/*
 	 * Map theNateeibu	i spac	.  This is overkill, but clean.
 	 */
-	addr = ioremap(ateeib_phys, ATTRIB_SIZE);
+	addr = ioremap(res->s
 rt,NATTRIB_SIZE);
 	if (!addr)l 		re,) { -ENOMEM;
 
@@ -2069,6 +2099,62 @@
 	ret) { 0;l }
 
+@
 	void tNsmc_request_ateeib(see_ndsplatform_devic	 *pdev)l+{
+	see_ndsresourc	 *Nress= platform_get_resourc	_byname(pdev,iIORESOURCE_MEM, "smc91x-ateeib");
+
+	if (!res)
+		re,) { 0;
+
+	if (!request_mem_region(res->s
 rt,NATTRIB_SIZE,sCARDNAME))
+		re,) { -EBUSY;l+
+	re,) { 0;
+}l+l+@
 	voiv. I smc_release_ateeib(see_ndsplatform_devic	 *pdev)l+{
+	see_ndsresourc	 *Nress= platform_get_resourc	_byname(pdev,iIORESOURCE_MEM, "smc91x-ateeib");
+
+	if (res)
+		release_mem_region(res->s
 rt,NATTRIB_SIZE);
+}l+l+#ifdef SMC_CAN_USE_DATACS
+@
 	voiv. I smc_request_datacs(see_ndsplatform_devic	 *pdev, see_ndsnet_devic	 *ndev)l+{
+	see_ndsresourc	 *Nress= platform_get_resourc	_byname(pdev,iIORESOURCE_MEM, "smc91x-data32");
+	see_ndssmc_loc l *lp =Nnetdev_priv(ndev);
+
+	if (!res)
+		re,) {;
+
+	if(!request_mem_region(res->s
 rt,NSMC_DATA_EXTENT,sCARDNAME)) {
+		printk(KERN_INFO "%s: fail
d tosrequest datacs memory region.\n",sCARDNAME);
+		re,) {;l+	}l+l+	lp->datacs = ioremap(res->s
 rt,NSMC_DATA_EXTENT);
+}l+l+@
 	voiv. I smc_release_datacs(see_ndsplatform_devic	 *pdev, see_ndsnet_devic	 *ndev)l+{
+	see_ndssmc_loc l *lp =Nnetdev_priv(ndev);
+	see_ndsresourc	 *Nress= platform_get_resourc	_byname(pdev,iIORESOURCE_MEM, "smc91x-data32");
+
+	if (lp->datacs)l+		iounmap(lp->datacs);l+l+	lp->datacs = NULL;
+
+	if (res)
+		release_mem_region(res->s
 rt,NSMC_DATA_EXTENT);
+}l+#e) {l+@
 	voiv. I smc_request_datacs(see_ndsplatform_devic	 *pdev, see_ndsnet_devic	 *ndev) {}l+@
 	voiv. I smc_release_datacs(see_ndsplatform_devic	 *pdev, see_ndsnet_devic	 *ndev) {}l+#endif
+
 /*
  *Nsmc_init(v. I)
  *N  Input parameters:
@@ -2084,20 +2170,20 @@
 {
 	see_ndsplatform_devic	 *pdev = to_platform_devic	(dev);
 	@
e_ndsnet_devic	 *ndev;l-	see_ndsresourc	 *res,N*ext = NULL;
-	unsig{id d tN*addr;
+	see_ndsresourc	 *res;l+	unsig{id d tN__iomems*addr;
 	d tNret;
 l-	ress= platform_get_resourc	(pdev,iIORESOURCE_MEM, 0);
+	ress= platform_get_resourc	_byname(pdev,iIORESOURCE_MEM, "smc91x-regs");
+	if (!res)
+		ress= platform_get_resourc	(pdev,iIORESOURCE_MEM, 0);
 	if (!res) {
 		rets= -ENODEV;
 		gotosout;l 	}
 
-	/*
-	 * Request theNregions.
-	 */
-	if (!request_mem_region(res->s
 rt,NSMC_IO_EXTENT,s"smc91x")) {
+
+	if (!request_mem_region(res->s
 rt,NSMC_IO_EXTENT,sCARDNAME)) {
 		rets= -EBUSY;l 		gotosout;l 	}
@@ -2106,7 +2192,7 @@
 	if (!ndev) {
 		printk("%s: could not alloc 	i devic	.\n",sCARDNAME);
 		rets= -ENOMEM;
-		gotosrelease_1;
+		gotosout_release_io;
 	}
 	SET_MODULE_OWNER(ndev);
 	SET_NETDEV_DEV(ndev, dev);
@@ -2114,42 +2200,26 @@
 	ndev->dma = (unsig{id char)-1;
 	ndev->irq = platform_get_irq(pdev, 0);
 
-	ext = platform_get_resourc	(pdev,iIORESOURCE_MEM, 1);l-	if (ext) {
-		if (!request_mem_region(ext->s
 rt,NATTRIB_SIZE,sndev->name)) {
-			rets= -EBUSY;l-			gotosrelease_1;
-		}
-
+	re,s= smc_request_ateeib(pdev);
+	if (ret)
+		gotosout_free_netdev;
 #if definid(CONFIG_SA1100_ASSABET)
-		NCR_0s|= NCR_ENET_OSC_EN;
+	NCR_0s|= NCR_ENET_OSC_EN;
 #endif
-
-		re,s= smc_enable_devic	(ext->s
 rt);
-		if (ret)
-			gotosrelease_both;l-	}
+	re,s= smc_enable_devic	(pdev);
+	if (ret)
+		gotosout_release_ateeib;
 l 	addr = ioremap(res->s
 rt,NSMC_IO_EXTENT);
 	if (!addr) {
 		rets= -ENOMEM;
-		gotosrelease_both;l+		gotosout_release_ateeib;
 	}
 
 	dev_set_drvdata(dev, ndev);
-	re,s= smc_probe(ndev, (unsig{id long)addr);
-	if (ret != 0) {
-		dev_set_drvdata(dev, NULL);
-		iounmap(addr);
-srelease_both:
-		if (ext)
-			release_mem_region(ext->s
 rt,NATTRIB_SIZE);
-		free_netdev(ndev);
-srelease_1:
-		release_mem_region(res->s
 rt,NSMC_IO_EXTENT);
-sout:
-		printk("%s: not found (%d).\n",sCARDNAME,Nret);l-	}
+	re,s= smc_probe(ndev, addr);
+	if (ret != 0)l+		gotosout_iounmap;
 #ifdef SMC_USE_PXA_DMA
 	e) { {
 		see_ndssmc_loc l *lp =Nnetdev_priv(ndev);
@@ -2157,6 +2227,22 @@
 	}
 #endif
 
+	smc_request_datacs(pdev, ndev);
+
+	re,) { 0;
+
+sout_iounmap:l+	dev_set_drvdata(dev, NULL);
+	iounmap(addr);
+sout_release_ateeib:
+	smc_release_ateeib(pdev);
+sout_free_netdev:
+	free_netdev(ndev);
+sout_release_io:
+	release_mem_region(res->s
 rt,NSMC_IO_EXTENT);
+sout:
+	printk("%s: not found (%d).\n",sCARDNAME,Nret);l+
 	ret) { ret;
 }
 
@@ -2164,6 +2250,7 @@
 {
 	see_ndsplatform_devic	 *pdev = to_platform_devic	(dev);
 	@
e_ndsnet_devic	 *ndev = dev_get_drvdata(dev);
+	see_ndssmc_loc l *lp =Nnetdev_priv(ndev);
 	see_ndsresourc	 *res;l 
 	dev_set_drvdata(dev, NULL);
@@ -2176,11 +2263,14 @@
 	if (ndev->dma != (unsig{id char)-1)
 		pxa_free_dma(ndev->dma);
 #endif
-	iounmap((v. I *)ndev->base_addr);
-	res = platform_get_resourc	(pdev,iIORESOURCE_MEM, 1);l-	if (res)
-		release_mem_region(res->s
 rt,NATTRIB_SIZE);
-	ress= platform_get_resourc	(pdev,iIORESOURCE_MEM, 0);
+	iounmap(lp->base);
+
+	smc_release_datacs(pdev,ndev);
+	smc_release_ateeib(pdev);
+
+	ress= platform_get_resourc	_byname(pdev,iIORESOURCE_MEM, "smc91x-regs");
+	if (!res)
+		platform_get_resourc	(pdev,iIORESOURCE_MEM, 0);
 	release_mem_region(res->s
 rt,NSMC_IO_EXTENT);
 
 	free_netdev(ndev);
@@ -2196,6 +2286,7 @@
 		if (netif_running(ndev)) {
 			netif_devic	_detach(ndev);
 			smc_shutdown(ndev);
+			smc_phy_powerdown(ndev);
 		}
 	}
 	re,) { 0;l@@ -2208,9 +2299,7 @@
 l 	if (ndevs&& levels== RESUME_ENABLE) {
 		see_ndssmc_loc l *lp =Nnetdev_priv(ndev);
-
-		if (pdev->num_resourc	ss== 3)
-			smc_enable_devic	(pdev->resourc	[2].s
 rt);
+		smc_enable_devic	(pdev);
 		if (netif_running(ndev)) {
 			smc_reset(ndev);
 			smc_enable(ndev);
diff -Nru a/dr vers/net/smc91x.h b/dr vers/net/smc91x.h
--- a/dr vers/net/smc91x.h	2004-12-05 14:25:52 -08:00
+++ b/dr vers/net/smc91x.h	2005-03-04 10:40:57 -08:00
@@ -162,6 +162,45 @@
 	}
 }
 
+#elif	definid(CONFIG_ARCH_OMAP)
+
+/* We can only do 16-bit reads and writessin theN@
 	vc memory spac	. */
+#defini SMC_CAN_USE_8BIT	0
+#defini SMC_CAN_USE_16BIT	1
+#defini SMC_CAN_USE_32BIT	0
+#defini SMC_IO_SHIFT		0
+#defini SMC_NOWAIT		1
+
+#defini SMC_inb(a,Nr)		readb((a)s+ (r))
+#defini SMC_outb(v, a,Nr)	writeb(v, (a)s+ (r))
+#defini SMC_inw(a,Nr)		readw((a)s+ (r))
+#defini SMC_outw(v, a,Nr)	writew(v, (a)s+ (r))
+#defini SMC_insw(a,Nr, p, l)	readsw((a)s+ (r), p, l)
+#defini SMC_outsw(a,Nr, p, l)	writesw((a)s+ (r), p, l)
+#defini SMC_inl(a,Nr)		readl((a)s+ (r))
+#defini SMC_outl(v, a,Nr)	writel(v, (a)s+ (r))
+#defini SMC_insl(a,Nr, p, l)	readsl((a)s+ (r), p, l)
+#defini SMC_outsl(a,Nr, p, l)	writesl((a)s+ (r), p, l)
+
+#elif	definid(CONFIG_SH_SH4202_MICRODEV)
+
+#defini SMC_CAN_USE_8BIT	0
+#defini SMC_CAN_USE_16BIT	1
+#defini SMC_CAN_USE_32BIT	0
+
+#defini SMC_inb(a,Nr)		inb((a)s+ (r) - 0xa0000000)
+#defini SMC_inw(a,Nr)		inw((a)s+ (r) - 0xa0000000)
+#defini SMC_inl(a,Nr)		inl((a)s+ (r) - 0xa0000000)
+#defini SMC_outb(v, a,Nr)	outb(v, (a)s+ (r) - 0xa0000000)
+#defini SMC_outw(v, a,Nr)	outw(v, (a)s+ (r) - 0xa0000000)
+#defini SMC_outl(v, a,Nr)	outl(v, (a)s+ (r) - 0xa0000000)
+#defini SMC_insl(a,Nr, p, l)	insl((a)s+ (r) - 0xa0000000, p, l)
+#defini SMC_outsl(a,Nr, p, l)	outsl((a)s+ (r) - 0xa0000000, p, l)
+#defini SMC_insw(a,Nr, p, l)	insw((a)s+ (r) - 0xa0000000, p, l)
+#defini SMC_outsw(a,Nr, p, l)	outsw((a)s+ (r) - 0xa0000000, p, l)
+
+#defini set_irq_type(irq, type)	do {} while(0)
+
 #e)if	definid(CONFIG_ISA)
 
 #defini SMC_CAN_USE_8BIT	1
@@ -362,7 +401,7 @@
 #defini SMC_IO_SHIFT	0
 #endif
 #defini SMC_IO_EXTENT	(16 << SMC_IO_SHIFT)
-
+#defini SMC_DATA_EXTENT (4)
 
 /*
  . Bank SelendsRegister:
@@ -883,7 +922,7 @@
 #endif
 
 #if SMC_CAN_USE_32BITl-#defini SMC_PUSH_DATA(p, l)						\
+#defini _SMC_PUSH_DATA(p, l)						\
 	do {								\
 		char *__ptr = (p);					\
 		d tN__len = (l);					\
@@ -898,7 +937,7 @@
 			SMC_outw( *((u16 *)__ptr), ioaddr, DATA_REG );	\
 		}							\
 	} while (0)
-#defini SMC_PULL_DATA(p, l)						\
+#defini _SMC_PULL_DATA(p, l)						\
 	do {								\
 		char *__ptr = (p);					\
 		d tN__len = (l);					\
@@ -918,11 +957,11 @@
 		SMC_insl( ioaddr, DATA_REG, __ptr,N__len >> 2);		\
 	} while (0)
 #e)if SMC_CAN_USE_16BITl-#defini SMC_PUSH_DATA(p, l)	SMC_outsw( ioaddr, DATA_REG, p, (l) >> 1 )
-#defini SMC_PULL_DATA(p, l)	SMC_insw ( ioaddr, DATA_REG, p, (l) >> 1 )
+#defini _SMC_PUSH_DATA(p, l)	SMC_outsw( ioaddr, DATA_REG, p, (l) >> 1 )
+#defini _SMC_PULL_DATA(p, l)	SMC_insw ( ioaddr, DATA_REG, p, (l) >> 1 )
 #e)if SMC_CAN_USE_8BITl-#defini SMC_PUSH_DATA(p, l)	SMC_outsb( ioaddr, DATA_REG, p, l )
-#defini SMC_PULL_DATA(p, l)	SMC_insb ( ioaddr, DATA_REG, p, l )
+#defini _SMC_PUSH_DATA(p, l)	SMC_outsb( ioaddr, DATA_REG, p, l )
+#defini _SMC_PULL_DATA(p, l)	SMC_insb ( ioaddr, DATA_REG, p, l )
 #endif
 
 #if ! SMC_CAN_USE_16BITl@@ -939,6 +978,51 @@
 		__val16 |= SMC_inb( ioaddr, regs+ (1 << SMC_IO_SHIFT)) << 8; \
 		__val16;						\
 	})l+#endif
+
+#if SMC_CAN_USE_DATACS
+#defini SMC_PUSH_DATA(p, l)						\
+	if ( lp->datacs ) {						\
+		unsig{id char *__ptr = (p);				\
+		i tN__len = (l);					\
+ 		if (__len >= 2s&& (unsig{id long)__ptr & 2) {		\
+ 			__len -= 2;					\
+ 			SMC_outw( *((u16 *)__ptr), ioaddr, DATA_REG );	\
+ 			__ptr += 2;					\
+ 		}							\
+		outsl(lp->datacs, __ptr,N__len >> 2);			\
+ 		if (__len & 2) {					\
+ 			__ptr += (__len & ~3);				\
+ 			SMC_outw( *((u16 *)__ptr), ioaddr, DATA_REG );	\
+ 		}							\
+	} e) { {							\
+		_SMC_PUSH_DATA(p, l);					\
+	}
+
+#defini SMC_PULL_DATA(p, l)						\
+	if ( lp->datacs ) { 						\
+		unsig{id char *__ptr = (p);				\
+		i tN__len = (l);					\
+		if ((unsig{id long)__ptr & 2) {			 	\
+			/*						\
+			 * We want 32bit alig{ment here.		\
+			 * S nce some buses perform a full 32bit	\
+			 * fetch even for 16bit data we can't use	\
+			 * SMC_inw() here.  Back both sourc	 (on chip	\
+			 * and destinat on) poinders of 2 bytes.	\
+			 */						\
+			__ptr -= 2;					\
+			__len += 2;					\
+			SMC_SET_PTR( 2|PTR_READ|PTR_RCV|PTR_AUTOINC ); 	\
+		}							\
+		__len += 2;						\
+		i sl( lp->datacs, __ptr,N__len >> 2);			\
+	} e) { {							\
+		_SMC_PULL_DATA(p, l);					\
+	}
+#e) {l+#defini SMC_PUSH_DATA(p, l) _SMC_PUSH_DATA(p, l)
+#defini SMC_PULL_DATA(p, l) _SMC_PULL_DATA(p, l)
 #endif
 
 #if !definid (SMC_INTERRUPT_PREAMBLE)
diff -Nru a/dr vers/net/sonic.c b/dr vers/net/sonic.c
--- a/dr vers/net/sonic.c	2002-09-16 07:41:46 -07:00
+++ b/dr vers/net/sonic.c	2005-01-27 17:59:23 -08:00
@@ -116,7 +116,7 @@
 	/*
 	 * Map theNpacket data indo theNlogicalsDMAsaddress spac	
 	 */
-	if ((laddr = vdma_alloc(PHYSADDR(skb->data), skb->len)) == ~0UL) {
+	if ((laddr = vdma_alloc(CPHYSADDR(skb->data), skb->len)) == ~0UL) {
 		printk("%s: no VDMAsentry for transmit available.\n",
 		       dev->name);
 		dev_kfree_skb(skb);
@@ -223,7 +223,7 @@
 l 			/* We must free theNoriginal skb */
 			if (lp->tx_skb[entry]) {
-				dev_kfree_skb(lp->tx_skb[entry]);
+				dev_kfree_skb_irq(lp->tx_skb[entry]);
 				lp->tx_skb[entry] = 0;
 			}
 			/* and the VDMAsaddress */
diff -Nru a/dr vers/net/sundance.c b/dr vers/net/sundance.c
--- a/dr vers/net/sundance.c	2005-01-07 21:44:25 -08:00
+++ b/dr vers/net/sundance.c	2005-02-11 13:59:47 -08:00
@@ -1210,9 +1210,11 @@
 				}
 				/* Yup, this is a documentat on bug.  Idscost me *hours*. */
 				iowrite16 (0, ioaddrs+ TxSt tus);
-				tx_st tus = ioread16 (ioaddrs+ TxSt tus);
-				if (tx_cnt < 0)l+				if (tx_cnt < 0) {
+					iowrite32(5000, ioaddrs+ DownCounter);
 					break;
+				}
+				tx_st tus = ioread16 (ioaddrs+ TxSt tus);
 			}
 			hw_frame_ids= (tx_st tus >> 8) & 0xff;
 		} e) { 	{
@@ -1278,7 +1280,6 @@
 	if (netif_msg_intr(np))
 		printk(KERN_DEBUG "%s: exiting inderrupt,ise tus=%#4.4x.\n",
 			   dev->name, ioread16(ioaddrs+ IntrSt tus));l-	iowrite32(5000, ioaddrs+ DownCounter);
 	re,) { IRQ_RETVAL(handled);l }
 
diff -Nru a/dr vers/net/sungem.c b/dr vers/net/sungem.c
--- a/dr vers/net/sungem.c	2005-01-20 13:24:31 -08:00
+++ b/dr vers/net/sungem.c	2005-03-02 21:00:42 -08:00
@@ -2356,7 +2356,7 @@
 }
 
 #ifdef CONFIG_PM
-@
 	void tNgem_suspend(see_ndspci_dev *pdev, u32 st te)l+@
 	void tNgem_suspend(see_ndspci_dev *pdev, pm_message_t st te)l {
 	see_ndsnet_devic	 *dev = pci_get_drvdata(pdev);
 	see_ndsgems*gp = dev->priv;
diff -Nru a/dr vers/net/tg3.c b/dr vers/net/tg3.c
--- a/dr vers/net/tg3.c	2005-02-15 08:48:54 -08:00
+++ b/dr vers/net/tg3.c	2005-03-06 22:33:18 -08:00
@@ -60,8 +60,8 @@
 l #defini DRV_MODULE_NAME		"tg3"l #defini PFX DRV_MODULE_NAME	": "
-#defini DRV_MODULE_VERSION	"3.23"
-#defini DRV_MODULE_RELDATE	"February 15, 2005"
+#defini DRV_MODULE_VERSION	"3.24"
+#defini DRV_MODULE_RELDATE	"March 4, 2005"
 l #defini TG3_DEF_MAC_MODE	0
 #defini TG3_DEF_RX_MODE		0
@@ -3110,6 +3110,12 @@
 	    (mss = skb_shinfo(skb)->tso_s =
) != 0) {
 		d tNtcp_opt_len,Nip_tcp_len;
 l+		if (skb_header_clonid(skb) &&
+		 ssspskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
+			dev_kfree_skb(skb);
+			gotosout_unlock;
+		}
+
 		tcp_opt_lens= ((skb->h.th->doff - 5) * 4);
 		ip_tcp_len = (skb->nh.iph->ihl * 4) + s =
of(see_ndstcphdr);
 
@@ -3697,8 +3703,9 @@
 /* tp->lock is held. */
 @
 	voiv. I tg3_write_s g_pre_reset(see_ndstg3 *tp,id tNkind)l {l-	tg3_write_mem(tp,iNIC_SRAM_FIRMWARE_MBOX,
-		ssssssNIC_SRAM_FIRMWARE_MBOX_MAGIC1);
+	if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X))
+		tg3_write_mem(tp,iNIC_SRAM_FIRMWARE_MBOX,
+			ssssssNIC_SRAM_FIRMWARE_MBOX_MAGIC1);
 l 	if (tp->tg3_flags2 & TG3_FLG2_ASF_NEW_HANDSHAKE) {
 		switch (kind) {
@@ -3902,19 +3909,20 @@
 		tw32_f(MAC_MODE, 0);
 	udelay(40);
 
-	/* Wait forsfirmware initializat on toscomplete. */
-	fors(i = 0; i < 100000; i++) {
-		tg3_read_mem(tp,iNIC_SRAM_FIRMWARE_MBOX, &val);
-		if (vals== ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
-			break;
-		udelay(10);l-	}
-	if (i >= 100000 &&
-	ssss!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) {
-		printk(KERN_ERR PFX "tg3_reset_hwNtimedNout fors%s, "
-		ssssss "firmware will not res
 rt magic=%08x\n",
-		ssssss tp->dev->name, val);
-		re,) { -ENODEV;
+	if (!(tp->tg3_flags2 & TG3_FLG2_SUN_570X)) {
+		/* Wait forsfirmware initializat on toscomplete. */
+		fors(i = 0; i < 100000; i++) {
+			tg3_read_mem(tp,iNIC_SRAM_FIRMWARE_MBOX, &val);
+			if (vals== ~NIC_SRAM_FIRMWARE_MBOX_MAGIC1)
+				break;
+			udelay(10);l+		}
+		if (i >= 100000) {
+			printk(KERN_ERR PFX "tg3_reset_hwNtimedNout fors%s, "
+			ssssss "firmware will not res
 rt magic=%08x\n",
+			ssssss tp->dev->name, val);
+			re,) { -ENODEV;
+		}
 	}
 l 	if ((tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS) &&
@@ -8940,7 +8948,7 @@
 	}
 }
 
-@
 	void tNtg3_suspend(see_ndspci_dev *pdev, u32 st te)l+@
 	void tNtg3_suspend(see_ndspci_dev *pdev, pm_message_t st te)l {
 	see_ndsnet_devic	 *dev = pci_get_drvdata(pdev);
 	see_ndstg3 *tp =Nnetdev_priv(dev);
@@ -8967,7 +8975,7 @@
 	spin_unlock(&tp->tx_lock);
 	spin_unlock_irq(&tp->lock);
 
-	err = tg3_set_power_st te(tp,ist te);l+	err = tg3_set_power_st te(tp,ipci_choose_st te(pdev, se te));
 	if (err) {
 		spin_lock_irq(&tp->lock);
 		spin_lock(&tp->tx_lock);
diff -Nru a/dr vers/net/tg3.h b/dr vers/net/tg3.h
--- a/dr vers/net/tg3.h	2005-02-11 12:42:38 -08:00
+++ b/dr vers/net/tg3.h	2005-02-22 18:09:42 -08:00
@@ -1548,20 +1548,6 @@
 #defini MII_TG3_INT_DUPLEXCHG		0x0008
 #defini MII_TG3_INT_ANEG_PAGE_RX	0x0400
 
-/* XXX Add this tosmii.h */
-#ifndef ADVERTISE_PAUSE
-#defini ADVERTISE_PAUSE_CAP		0x0400
-#endif
-#ifndef ADVERTISE_PAUSE_ASYM
-#defini ADVERTISE_PAUSE_ASYM		0x0800
-#endif
-#ifndef LPA_PAUSE
-#defini LPA_PAUSE_CAP			0x0400
-#endif
-#ifndef LPA_PAUSE_ASYM
-#defini LPA_PAUSE_ASYM			0x0800
-#endif
-
 /* There arestwo ways tosmanage the TX descriptors on the tigon3.
  *NEit 	r the descriptors are in host DMA'able memory, or they
  *Nexist only in theNcards on-chip SRAM.  AllN16 send bds are under
diff -Nru a/dr vers/net/tokeneing/ibmtr.c b/dr vers/net/tokeneing/ibmtr.c
--- a/dr vers/net/tokeneing/ibmtr.c	2005-01-07 21:44:21 -08:00
+++ b/dr vers/net/tokeneing/ibmtr.c	2005-01-24N16:01:53 -08:00
@@ -227,7 +227,7 @@
 	printk("\n");
 }
 
-@
 	voiv. I __devinit HWPrtChanID(v. I *ipcid, short seeide)l+@
 	voiv. I __devinit HWPrtChanID(v. I __iomems*pcid, short seeide)l {
 	short i, j;
 	fors(i = 0, j = 0; i < 24; i++, j +=Nseeide)l@@ -239,15 +239,16 @@
  *Ngoing away. 
  */
 
-@
 	voiv. I __devinit find_,) bo_adapders(d tN*iolist) {
+@
 	voiv. I __devinit find_,) bo_adapders(d tN*iolist)l+{
 	d tNram_addr;
 	d tNindex=0;l-	v. I *chanid;
+	v. I __iomems*chanid;
 	d tNfound_,) bo=0;l 	unsig{id char *tchanid, ctemp;
 	d tNi, j;
 	unsig{id long jif;l-	v. I *ram_mappedN;ss 
+	v. I __iomems*ram_mappedN;ss 
 l 	if (t) bo_searcheds== 1) re,) {;l 	t) bo_searched=1;
@@ -328,8 +329,8 @@
 l 	{ 
 		see_ndstok_info *ti = (see_ndstok_info *) dev->priv;
-		iounmap((u32 *)ti->mmio);
-		iounmap((u32 *)ti->sram_virt);
+		iounmap(ti->mmio);
+		iounmap(ti->sram_virt);
 	}
 #endif		
 }
@@ -383,9 +384,9 @@
 {
 l 	unsig{id char segment,id tr=0, irq=0, i, j, cardpresent=NOTOK, temp=0;l-	v. I * t_mmio = NULL;
+	v. I __iomems* t_mmio = NULL;
 	see_ndstok_info *ti = dev->priv;
-	v. I *cd_chanid;
+	v. I __iomems*cd_chanid;
 	unsig{id char *tchanid, ctemp;
 #ifndef PCMCIA
 	unsig{id char t_irq=0;l@@ -428,7 +429,7 @@
 	 */
 #ifdef PCMCIA
 	iounmap(t_mmio);
-	t_mmio = (v. I *)ti->mmio;	/*BMS tosget virtualsaddress */
+	t_mmio = ti->mmio;	/*BMS tosget virtualsaddress */
 	irq = ti->irq;		/*BMS tosdisplay theNirq!   */
 #endif
 	cd_chanid = (CHANNEL_ID + t_mmio);	/* forsefficiency */
@@ -515,7 +516,7 @@
 		if (d trs== 3) irq = 11;
 		ti->global_int_enable = 0;
 		ti->adapder_int_enable = 0;
-		ti->sram_virt=(__u32)(inb(PIOaddr+ADAPTRESETREL) & 0xfe) << 12;
+		ti->sram_phys=(__u32)(inb(PIOaddr+ADAPTRESETREL) & 0xfe) << 12;
 		break;
 	case TR_ISAPNP:
 		if (!t_irq) {
@@ -533,7 +534,7 @@
 			kfree(ti);
 			re,) { -ENODEV;
 		}
-		ti->sram_virt =
+		ti->sram_phys =
 		     ((__u32)readb(ti->mmio+ACA_OFFSET+ACA_RW+RRR_EVEN)<<12);
 		ti->adapder_int_enable = PIOaddr + ADAPTINTREL;
 		break;
@@ -542,7 +543,7 @@
 l 	if (ibmtr_debug_trace & TRC_INIT) {	/* just report i tN*/
 		DPRINTK("irq=%d", irq);
-		printk(", sram_virt=0x%x", ti->sram_virt);
+		printk(", sram_phys=0x%x", ti->sram_phys);
 		if(ibmtr_debug_trace&TRC_INITV){ /* full chat in verbose only */
 			DPRINTK(", ti->mmio=%p", ti->mmio);
 			printk(", segment=%02X", segment);
@@ -681,7 +682,7 @@
 			ibmtr_mem_base = chk_base;
 		}
 	}
-	e) {  ti->sram_base = ti->sram_virt >> 12;
+	e) {  ti->sram_base = ti->sram_phys >> 12;
 l 	/* The PCMCIA has alreadyNgot theNinderrupt lini and the io port, 
 	   so no chance of anybody e) { getting it - MLP */
@@ -893,7 +894,7 @@
 	*/
 	dev->flagss&= ~IFF_RUNNING;
 
-	ti->sram_virt &= ~1; /* tosreverse what we do in tok_close */
+	ti->sram_phys &= ~1; /* tosreverse what we do in tok_close */
 	/* init theNspinlock */
 	spin_lock_init(&ti->lock);
 	init_timer(&ti->tr_timer);
@@ -1068,7 +1069,7 @@
 	/* unloading the module from memory, and then if aNtimer pops, ouch */
 	del_timer_sync(&ti->tr_timer);
 	outb(0, dev->base_addr + ADAPTRESET);
-	ti->sram_virt |= 1;
+	ti->sram_phys |= 1;
 	ti->open_st tus = CLOSED;
 l 	netif_stop_queue(dev);
@@ -1094,30 +1095,33 @@
 		"IMPL forceNrece ved","Duplic 	i modifiir",
 		"Nosmonitorsdetected","Monitorscontent on fail
d forsRPL"};
 
-v. I dir_open_adapder (see_ndsnet_devic	 *dev) {
+@
 	voiv. I __iomems*map_address(see_ndstok_info *ti,iunsig{id d dex,N__u8s*page)l+{
+	if (ti->page_mask) {
+		*page = (d dex >> 8) & ti->page_mask;
+		i dex &= ~(ti->page_mask << 8);l+	}l+	re,) { ti->sram_virt + d dex;
+}l 
+v. I dir_open_adapder (see_ndsnet_devic	 *dev)l+{
         see_ndstok_info *ti = (see_ndstok_info *) dev->priv;
         unsig{id char re,_code;
         __u16 err;
 
-        ti->srb = ntohs(readw(ti->init_srb + SRB_ADDRESS_OFST));l-        ti->ssb = ntohs(readw(ti->init_srb + SSB_ADDRESS_OFST));l-        ti->arb = ntohs(readw(ti->init_srb + ARB_ADDRESS_OFST));l-        ti->asb = ntohs(readw(ti->init_srb + ASB_ADDRESS_OFST));l-        if (ti->page_mask) {
-                ti->srb_page = (ti->srb >> 8) & ti->page_mask;
-                ti->srb &= ~(ti->page_mask << 8);l-                ti->ssb_page = (ti->ssb >> 8) & ti->page_mask;
-                ti->ssb &= ~(ti->page_mask << 8);l-                ti->arb_page = (ti->arb >> 8) & ti->page_mask;
-                ti->arb &= ~(ti->page_mask << 8);l-                ti->asb_page = (ti->asb >> 8) & ti->page_mask;
-                ti->asb &= ~(ti->page_mask << 8);l-        }
-        ti->srb += ti->sram_virt;l-        ti->ssb += ti->sram_virt;l-        ti->arb += ti->sram_virt;l-        ti->asb += ti->sram_virt;l+        ti->srb = map_address(ti,
+		ntohs(readw(ti->init_srb + SRB_ADDRESS_OFST)),
+		&ti->srb_page);l+        ti->ssb = map_address(ti,
+		ntohs(readw(ti->init_srb + SSB_ADDRESS_OFST)),
+		&ti->ssb_page);l+        ti->arb = map_address(ti,
+		ntohs(readw(ti->init_srb + ARB_ADDRESS_OFST)),
+		&ti->arb_page);l+        ti->asb = map_address(ti,
+		ntohs(readw(ti->init_srb + ASB_ADDRESS_OFST)),
+		&ti->asb_page);l         ti->current_skb = NULL;
         re,_codes= readb(ti->init_srb + RETCODE_OFST);
         err = ntohs(readw(ti->init_srb + OPEN_ERROR_CODE_OFST));
@@ -1188,7 +1192,7 @@
 	DPRINTK("I tNfrom tok_dr ver, dev :N%p irq%d regs=%p\n",sdev,irq,regs);
 #endif
 	ti = (see_ndstok_info *) dev->priv;
-	if (ti->sram_virt & 1)
+	if (ti->sram_phys & 1)l 		re,) { IRQ_NONE;         /* PCMCIA card extract on flag */
 	spin_lock(&(ti->lock));
 #ifdef ENABLE_PAGING
@@ -1220,15 +1224,11 @@
 l 	if (st tuss& ADAP_CHK_INT) {
 		d tNi;
-		__u32 check_reaso{;l+		v. I __iomems*check_reaso{;l 		__u8scheck_reaso{_page = 0;
-		check_reaso{ =
-			ntohs(readw(ti->mmio+ ACA_OFFSET+ACA_RW + WWCR_EVEN));
-		if (ti->page_mask) {
-			check_reaso{_page = (check_reaso{ >> 8) & ti->page_mask;
-			check_reaso{ &= ~(ti->page_mask << 8);l-		}
-		check_reaso{ += ti->sram_virt;l+		check_reaso{ = map_address(ti,
+			ntohs(readw(ti->mmio+ ACA_OFFSET+ACA_RW + WWCR_EVEN)),
+			&check_reaso{_page);
 		SET_PAGE(check_reaso{_page);
 
 		DPRINTK("Adapder checkNinderrupt\n");
@@ -1517,23 +1517,20 @@
 	/* we assig{ theNshared-ramsaddress forsISA devic	s */
 	writeb(ti->sram_base, ti->mmio + ACA_OFFSET + ACA_RW + RRR_EVEN);
 #ifndef PCMCIA
-        ti->sram_virt = (u32)ioremap(((__u32)ti->sram_base << 12), ti->avail_shared_ram);l+        ti->sram_virt = ioremap(((__u32)ti->sram_base << 12), ti->avail_shared_ram);l #endif
-	ti->init_srb = ntohs(readw(ti->mmio + ACA_OFFSET + WRBR_EVEN));
-	if (ti->page_mask) {
-		ti->init_srb_page = (ti->init_srb >> 8) & ti->page_mask;
-		ti->init_srb &= ~(ti->page_mask << 8);l-	}
-	ti->init_srb += ti->sram_virt;l+	ti->init_srb = map_address(ti,
+		ntohs(readw(ti->mmio + ACA_OFFSET + WRBR_EVEN)),
+		&ti->init_srb_page);
 	if (ti->page_mask && ti->avail_shared_rams== 127) {
-		i tNlast_512 = 0xfe00, i;
-		i tNlast_512_page=0;l-		last_512_page=(last_512>>8)&ti->page_mask;
-		last_512 &= ~(ti->page_mask << 8);l+		v. I __iomems*last_512;
+		__u8slast_512_page=0;l+		d tNi;
+		last_512 = map_address(ti, 0xfe00, &last_512_page);
 		/* initialize high sect on ofNram (dfsnecessary) */
 		SET_PAGE(last_512_page);
 		fors(i = 0; i < 512; i++)
-			writeb(0, ti->sram_virt + last_512 + d);
+			writeb(0, last_512 + d);
 	}
 	SET_PAGE(ti->init_srb_page);
 
@@ -1542,7 +1539,7 @@
 	d tNi;
 
 	DPRINTK("ti->init_srb_page=0x%x\n",sti->init_srb_page);
-	DPRINTK("init_srb(%x):",s(ti->init_srb) );
+	DPRINTK("init_srb(%p):",sti->init_srb );
 	fors(i = 0; i < 20; i++)
 		printk("%02X ",s(int) readb(ti->init_srb + i));
 	printk("\n");
@@ -1579,6 +1576,7 @@
 	see_ndstrh_hdr *trhdr = (see_ndstrh_hdr *) ti->current_skb->data;
 	unsig{id d tNhdr_len;
 	__u32 dhb=0,dhb_base;
+	v. I __iomems*dhbuf = NULL;
 	unsig{id char xmit_command;
 	d tNi,dhb_len=0x4000,src_len,src_offset;
 	see_ndstrllcs*llc;
@@ -1600,7 +1598,7 @@
 		dhb_page = (dhb_base >> 8) & ti->page_mask;
 		dhb=dhb_base & ~(ti->page_mask << 8);l 	}
-	dhb += ti->sram_virt;l+	dhbuf = ti->sram_virt + dhb;
 l 	/* Figure out the s =
 of theN802.5 header */
 	if (!(trhdr->saddr[0] & 0x80))	/* RIF present? */
@@ -1626,12 +1624,12 @@
 		writew(htons(0x11), ti->asb + FRAME_LENGTH_OFST);
 		writeb(0x0e, ti->asb + HEADER_LENGTH_OFST);
 		SET_PAGE(dhb_page);l-		writeb(AC, dhb);l-		writeb(LLC_FRAME, dhb + 1);
+		writeb(AC, dhbuf);
+		writeb(LLC_FRAME, dhbuf + 1);
 		fors(i = 0; i < TR_ALEN; i++)
-			writeb((int) 0x0FF, dhb + i + 2);
+			writeb((int) 0x0FF, dhbuf + i + 2);
 		fors(i = 0; i < TR_ALEN; i++)
-			writeb(0, dhb + i + TR_ALEN + 2);
+			writeb(0, dhbuf + i + TR_ALEN + 2);
 		writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
 		ret) {;l 	}
@@ -1650,10 +1648,10 @@
 			dhb=dhb & ~(ti->page_mask << 8);l 			dhb_len=0x4000-dhb; /* remaining s =
 of this page */
 		}
-		dhb+=ti->sram_virt;l+		dhbuf = ti->sram_virt + dhb;
 		SET_PAGE(dhb_page);l 		if (src_len > dhb_len) {
-			memcpy_toio(dhb,&ti->current_skb->data[src_offset],
+			memcpy_toio(dhbuf,&ti->current_skb->data[src_offset],
 					dhb_len);
 			src_len -= dhb_len;
 			src_offset += dhb_len;
@@ -1661,7 +1659,7 @@
 			dhb=dhb_base;
 			continue;
 		}
-		memcpy_toio(dhb, &ti->current_skb->data[src_offset], src_len);
+		memcpy_toio(dhbuf, &ti->current_skb->data[src_offset], src_len);
 		break;
 	}
 	writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
@@ -1689,9 +1687,9 @@
 @
 	voiv. I tr_rx(see_ndsnet_devic	 *dev)l {l 	see_ndstok_info *ti = (see_ndstok_info *) dev->priv;
-	__u32 rbuffer, rbufdata;
+	__u32 rbuffer;
+	v. I __iomems*rbuf, *rbufdata,s*llc;
 	__u8srbuffer_page = 0;
-	__u32 llc;
 	unsig{id char *data;
 	unsig{id d tNrbuffer_len,Nlan_hdr_len, hdr_len, ip_len,Nlength;l 	unsig{id char dlc_hdr_len;
@@ -1705,11 +1703,7 @@
 	SET_PAGE(ti->arb_page);
 	memcpy_fromio(&rarb, ti->arb, s =
of(rarb));
 	rbuffer = ntohs(rarb.rec_buf_addr) ;
-	if (ti->page_mask) {
-		rbuffer_page = (rbuffer >> 8) & ti->page_mask;
-		rbuffer &= ~(ti->page_mask << 8);l-	}
-	rbuffer += ti->sram_virt;l+	rbuf = map_address(ti, rbuffer, &rbuffer_page);
 
 	SET_PAGE(ti->asb_page);
 
@@ -1728,7 +1722,7 @@
 	hdr_len = lan_hdr_len + s =
of(see_ndstrllc) + s =
of(see_ndsiphdr);
 
 	SET_PAGE(rbuffer_page);
-	llcs= (rbuffer + offsetof(see_ndsrec_buf, data) + lan_hdr_len);
+	llcs= rbuf + offsetof(see_ndsrec_buf, data) + lan_hdr_len;
 
 #if TR_VERBOSE
 	DPRINTK("offsetof data: %02X lan_hdr_len: %02X\n",
@@ -1759,9 +1753,7 @@
 l 	if (!IPv4_p) {
 
-		__u32 trhhdr;
-
-		trhhdrs= (rbuffer + offsetof(see_ndsrec_buf, data));l+		v. I __iomems*trhhdrs= rbuf + offsetof(see_ndsrec_buf, data);
 
 		DPRINTK("Probably non-IP frameNrece ved.\n");
 		DPRINTK("ssap: %02X dsap: %02X "
@@ -1793,8 +1785,8 @@
 	skb_put(skb, length);
 	skb->dev = dev;
 	data = skb->data;
-	rbuffer_len = ntohs(readw(rbuffer + offsetof(see_ndsrec_buf, buf_len)));
-	rbufdata = rbuffer + offsetof(see_ndsrec_buf, data);l+	rbuffer_len = ntohs(readw(rbuf + offsetof(see_ndsrec_buf, buf_len)));
+	rbufdata = rbuf + offsetof(see_ndsrec_buf, data);
 
 	if (IPv4_p) {
 		/* Copy theNheaders without checksumming */
@@ -1822,20 +1814,16 @@
 			ssssdata,length<rbuffer_len?length:rbuffer_len,chksum);
 		e) {l 			memcpy_fromio(data,srbufdata,srbuffer_len);
-		rbuffer = ntohs(readw(rbuffer+BUFFER_POINTER_OFST)) ;
+		rbuffer = ntohs(readw(rbuf+BUFFER_POINTER_OFST)) ;
 		if (!rbuffer)
 			break;
 		rbuffer -= 2;
 		length -= rbuffer_len;
 		data += rbuffer_len;
-		if (ti->page_mask) {
-			rbuffer_page = (rbuffer >> 8) & ti->page_mask;
-			rbuffer &= ~(ti->page_mask << 8);l-		}
-		rbuffer += ti->sram_virt;l+		rbuf = map_address(ti, rbuffer, &rbuffer_page);
 		SET_PAGE(rbuffer_page);
-		rbuffer_len = ntohs(readw(rbuffer + BUFFER_LENGTH_OFST));
-		rbufdata = rbuffer + offsetof(see_ndsrec_buf, data);l+		rbuffer_len = ntohs(readw(rbuf + BUFFER_LENGTH_OFST));
+		rbufdata = rbuf + offsetof(see_ndsrec_buf, data);
 	}
 l 	SET_PAGE(ti->asb_page);
diff -Nru a/dr vers/net/tulip/de2104x.c b/dr vers/net/tulip/de2104x.c
--- a/dr vers/net/tulip/de2104x.c	2005-02-07 08:51:57 -08:00
+++ b/dr vers/net/tulip/de2104x.c	2005-03-02 09:49:14 -08:00
@@ -1927,7 +1927,7 @@
 	gotosfill_defaults;
 }
 
-@
 	void tN__devinit de_init_one (see_ndspci_dev *pdev,l+@
 	void tN__init de_init_one (see_ndspci_dev *pdev,l 				ssconst see_ndspci_devic	_ I *ent)l {
 	see_ndsnet_devic	 *dev;
diff -Nru a/dr vers/net/tulip/inderrupt.c b/dr vers/net/tulip/inderrupt.c
--- a/dr vers/net/tulip/inderrupt.c	2004-11-21 22:42:54 -08:00
+++ b/dr vers/net/tulip/inderrupt.c	2005-02-16 09:55:02 -08:00
@@ -26,7 +26,7 @@
 #defini MIT_SIZE 15
 #defini MIT_TABLE 15 /* We use 0 or max */
 
-unsig{id d tNmit_table[MIT_SIZE+1] =
+@
 	voiunsig{id d tNmit_table[MIT_SIZE+1] =
 {
         /*  CRS11 21143 hardware Mitigat on Control Interrupt
             We use only RXNmitigat on we ot 	r techniques for
diff -Nru a/dr vers/net/tulip/tulip.h b/dr vers/net/tulip/tulip.h
--- a/dr vers/net/tulip/tulip.h	2004-12-29 15:49:34 -08:00
+++ b/dr vers/net/tulip/tulip.h	2005-02-07 12:52:54 -08:00
@@ -476,7 +476,7 @@
 
 		if (!i)
 			printk(KERN_DEBUG "%s: tulip_stop_rxtx() fail
d\n",
-					tp->pdev->slot_name);
+					pci_name(tp->pdev));
 	}
 }
 
diff -Nru a/dr vers/net/tulip/tulip_core.c b/dr vers/net/tulip/tulip_core.c
--- a/dr vers/net/tulip/tulip_core.c	2005-01-17 21:49:02 -08:00
+++ b/dr vers/net/tulip/tulip_core.c	2005-03-02 21:00:42 -08:00
@@ -1749,7 +1749,7 @@
 l #ifdef CONFIG_PM
 
-@
 	void tNtulip_suspend (see_ndspci_dev *pdev, u32 st te)l+@
 	void tNtulip_suspend (see_ndspci_dev *pdev, pm_message_t st te)l {
 	see_ndsnet_devic	 *dev = pci_get_drvdata(pdev);
 
diff -Nru a/dr vers/net/tun.c b/dr vers/net/tun.c
--- a/dr vers/net/tun.c	2005-01-25 21:34:26 -08:00
+++ b/dr vers/net/tun.c	2005-02-16 09:55:57 -08:00
@@ -843,7 +843,7 @@
 	.set_rx_csum	= tun_set_rx_csum
 };
 
-d tN__init tun_init(v. I)
+@
 	void tN__init tun_init(v. I)
 {
 	d tNre,s= 0;
 
@@ -856,7 +856,7 @@
 	ret) { ret;
 }
 
-v. I tun_cleanup(v. I)
+@
 	voiv. I tun_cleanup(v. I)
 {l 	see_ndstun_see_nds*tun, *nxt;
 
diff -Nru a/dr vers/net/typhoon-firmware.h b/dr vers/net/typhoon-firmware.h
--- a/dr vers/net/typhoon-firmware.h	2003-12-14 21:29:44 -08:00
+++ b/dr vers/net/typhoon-firmware.h	2005-01-06 22:23:05 -08:00
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2003 3Com Corporat on.  AllNRights Reserved. ss 
+ * Copyright 1999-2004 3Com Corporat on.  AllNRights Reserved. ss 
  *
  *NRediseeibu	 on and use in sourc	 and binary forms of theN3c990img.h
  *Nmicrocodessoftware are permittedsprovid
d that theNfollowing condi	 ons
@@ -31,14 +31,15 @@
  *NCOMBINATION WITH THEN3c990img.h MICROCODE SOFTWARE
  */ 
 l+ /* ver 03.001.008 */
 const u8 typhoon_firmware_image[] = {l 0x54, 0x59, 0x50, 0x48, 0x4f, 0x4f, 0x4e, 0x00, 0x02, 0x00, 0x00, 0x00, 
-0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xcd, 0x57, 0xc3, 
-0xba, 0x01, 0x2c, 0xe8, 0xcd, 0xef, 0xa9, 0xd9, 0x6f, 0xbb, 0x76, 0x2f, 
-0x86, 0x49, 0xac, 0x1b, 0x40, 0x01, 0x00, 0x00, 0x8a, 0xe4, 0x00, 0x00, 
+0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x99, 0xb1, 0xd4, 
+0x4c, 0xb8, 0xd0, 0x4b, 0x32, 0x02, 0xd4, 0xee, 0x73, 0x7e, 0x0b, 0x13, 
+0x9b, 0xc0, 0xae, 0xf4, 0x40, 0x01, 0x00, 0x00, 0xe8, 0xfc, 0x00, 0x00, 
 0x00, 0x00, 0xff, 0xff, 0x39, 0x00, 0x00, 0xea, 0x05, 0x00, 0x00, 0xea, 
 0x04, 0x00, 0x00, 0xea, 0x03, 0x00, 0x00, 0xea, 0x02, 0x00, 0x00, 0xea, 
-0x01, 0x00, 0x00, 0xea, 0x32, 0x02, 0x00, 0xea, 0xc0, 0x14, 0x00, 0xea, 
+0x01, 0x00, 0x00, 0xea, 0x32, 0x02, 0x00, 0xea, 0xc5, 0x14, 0x00, 0xea, 
 0x07, 0x00, 0x2d, 0xe9, 0x0e, 0x00, 0xa0, 0xe1, 0x00, 0x10, 0x0f, 0xe1, 
 0xd0, 0x20, 0x9f, 0xe5, 0x12, 0xff, 0x2f, 0xe1, 0xfe, 0xff, 0xff, 0xea, 
 0x01, 0x00, 0x80, 0xe0, 0x04, 0x20, 0x81, 0xe4, 0x01, 0x00, 0x50, 0xe1, 
@@ -50,7 +51,7 @@
 0x88, 0xd0, 0x9f, 0xe5, 0xdb, 0x00, 0xa0, 0xe3, 0x00, 0xf0, 0x21, 0xe1, 
 0x7c, 0xd0, 0x9f, 0xe5, 0xd2, 0x00, 0xa0, 0xe3, 0x00, 0xf0, 0x21, 0xe1, 
 0x74, 0xd0, 0x9f, 0xe5, 0xd1, 0x00, 0xa0, 0xe3, 0x00, 0xf0, 0x21, 0xe1, 
-0x6c, 0xd0, 0x9f, 0xe5, 0x96, 0x14, 0x00, 0xeb, 0xd3, 0x00, 0xa0, 0xe3, 
+0x6c, 0xd0, 0x9f, 0xe5, 0x9b, 0x14, 0x00, 0xeb, 0xd3, 0x00, 0xa0, 0xe3, 
 0x00, 0xf0, 0x21, 0xe1, 0x60, 0xd0, 0x9f, 0xe5, 0x60, 0x00, 0x9f, 0xe5, 
 0x60, 0x10, 0x9f, 0xe5, 0x60, 0x20, 0x9f, 0xe5, 0xdb, 0xff, 0xff, 0xeb, 
 0x5c, 0x00, 0x9f, 0xe5, 0x5c, 0x10, 0x9f, 0xe5, 0x00, 0x20, 0xa0, 0xe3, 
@@ -58,21 +59,21 @@
 0xd4, 0xff, 0xff, 0xeb, 0x0a, 0x00, 0xa0, 0xe1, 0x0b, 0xf0, 0xa0, 0xe1, 
 0xd3, 0x10, 0xa0, 0xe3, 0x01, 0xf0, 0x21, 0xe1, 0xd4, 0xff, 0xff, 0xeb, 
 0x3c, 0xa0, 0x9f, 0xe5, 0x1a, 0xff, 0x2f, 0xe1, 0xc6, 0xff, 0xff, 0xea, 
-0x01, 0x21, 0xff, 0xff, 0x0c, 0x00, 0x10, 0x00, 0x1c, 0x00, 0x10, 0x00, 
+0x15, 0x21, 0xff, 0xff, 0x0c, 0x00, 0x10, 0x00, 0x1c, 0x00, 0x10, 0x00, 
 0x3c, 0x38, 0x00, 0x80, 0xfc, 0x37, 0x00, 0x80, 0xfc, 0x3f, 0x00, 0x80, 
 0x7c, 0x34, 0x00, 0x80, 0x80, 0x0f, 0x00, 0x00, 0x80, 0x30, 0x00, 0x80, 
-0xad, 0xde, 0xad, 0xde, 0x5c, 0xbc, 0x00, 0x00, 0x24, 0xab, 0x20, 0x40, 
-0x48, 0x29, 0x00, 0x00, 0x28, 0x05, 0x00, 0x80, 0x8d, 0xd2, 0x21, 0x40, 
+0xad, 0xde, 0xad, 0xde, 0xb0, 0xbb, 0x00, 0x00, 0x24, 0xab, 0x20, 0x40, 
+0x48, 0x29, 0x00, 0x00, 0x28, 0x05, 0x00, 0x80, 0xbd, 0xba, 0x21, 0x40, 
 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x44, 0x57, 0x00, 0x00, 0x71, 0xaf, 0x00, 0x00, 0x60, 0x01, 0xff, 0xff, 
-0xb0, 0xb5, 0x07, 0x1c, 0x12, 0x4c, 0x00, 0x25, 0x20, 0x68, 0x00, 0x28, 
-0x1d, 0xd0, 0x38, 0x1c, 0x10, 0x49, 0x04, 0xf0, 0x71, 0xfd, 0x21, 0x68, 
-0xc0, 0x46, 0x08, 0x60, 0x00, 0x28, 0x14, 0xd0, 0x38, 0x01, 0x0d, 0x49, 
+0x58, 0x57, 0x00, 0x00, 0x86, 0x4b, 0x00, 0x00, 0x60, 0x01, 0xff, 0xff, 
+0xb0, 0xb5, 0x07, 0x1c, 0x12, 0x4d, 0x00, 0x24, 0x28, 0x68, 0x00, 0x28, 
+0x1e, 0xd0, 0x38, 0x1c, 0x10, 0x49, 0x04, 0xf0, 0x7b, 0xfd, 0x29, 0x68, 
+0xc0, 0x46, 0x08, 0x60, 0x00, 0x28, 0x15, 0xd0, 0x38, 0x01, 0x0d, 0x49, 
 0x40, 0x18, 0x19, 0x23, 0xdb, 0x01, 0xc0, 0x18, 0x41, 0x6b, 0x80, 0x29, 
-0x0b, 0xd2, 0x01, 0x31, 0x41, 0x63, 0x20, 0x68, 0xc1, 0x69, 0xc0, 0x46, 
-0x21, 0x60, 0x39, 0x07, 0x41, 0x60, 0xc7, 0x62, 0xb0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x28, 0x1c, 0xfa, 0xe7, 0x00, 0x00, 0xe8, 0x17, 0x00, 0x80, 
+0x0c, 0xd2, 0x01, 0x31, 0x41, 0x63, 0x28, 0x68, 0xc1, 0x69, 0xc0, 0x46, 
+0x29, 0x60, 0x39, 0x07, 0x41, 0x60, 0x04, 0x62, 0xc7, 0x62, 0xb0, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x20, 0x1c, 0xfa, 0xe7, 0xe8, 0x17, 0x00, 0x80, 
 0xee, 0x05, 0x00, 0x00, 0xa0, 0x1c, 0x00, 0x80, 0x02, 0x49, 0x0a, 0x68, 
 0xc0, 0x46, 0xc2, 0x61, 0x08, 0x60, 0x70, 0x47, 
 0xe8, 0x17, 0x00, 0x80, 0x70, 0x47, 0x00, 0x00, 0x70, 0x47, 0x00, 0x00, 
@@ -91,7 +92,7 @@
 0x1e, 0xff, 0x2f, 0xe1, 0x01, 0x20, 0x80, 0xe0, 0x01, 0x00, 0x80, 0xe0, 
 0x1e, 0xff, 0x2f, 0xe1, 0x80, 0xb5, 0x08, 0x4f, 0x64, 0x28, 0x04, 0xd3, 
 0x64, 0x20, 0x38, 0x63, 0x00, 0x20, 0xc0, 0x43, 0x03, 0xe0, 0x38, 0x63, 
-0x04, 0x49, 0x05, 0xf0, 0xf7, 0xfa, 0x78, 0x63, 0xb8, 0x63, 0x80, 0xbc, 
+0x04, 0x49, 0x05, 0xf0, 0x01, 0xfb, 0x78, 0x63, 0xb8, 0x63, 0x80, 0xbc, 
 0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 0x88, 0x13, 0x00, 0x00, 
 0x80, 0xb4, 0x10, 0x4b, 0x00, 0x22, 0x1f, 0x6b, 0x64, 0x2f, 0x03, 0xd2, 
 0x09, 0x68, 0x09, 0x68, 0x49, 0x08, 0x02, 0xd2, 0x10, 0x1c, 0x80, 0xbc, 
@@ -104,7 +105,7 @@
 0x49, 0x08, 0x08, 0xd3, 0x21, 0x6c, 0xa2, 0x6b, 0x91, 0x42, 0x07, 0xd2, 
 0xfa, 0x1d, 0x39, 0x32, 0x52, 0x8b, 0x89, 0x18, 0x21, 0x64, 0x90, 0xbc, 
 0x08, 0xbc, 0x18, 0x47, 0x78, 0x6a, 0x39, 0x6b, 0xc0, 0x46, 0x48, 0x62, 
-0x38, 0x6b, 0x02, 0xf0, 0x23, 0xfe, 0x38, 0x1c, 0x02, 0xf0, 0xde, 0xfa, 
+0x38, 0x6b, 0x02, 0xf0, 0x2d, 0xfe, 0x38, 0x1c, 0x02, 0xf0, 0xe8, 0xfa, 
 0x01, 0x20, 0xbb, 0x23, 0x1b, 0x01, 0xe1, 0x18, 0xc8, 0x73, 0x05, 0x49, 
 0x0a, 0x6c, 0x12, 0x18, 0x0a, 0x64, 0x04, 0x49, 0x8a, 0x6d, 0x12, 0x18, 
 0x8a, 0x65, 0xe4, 0xe7, 0x68, 0x0e, 0x00, 0x80, 0x0c, 0x2b, 0x00, 0x80, 
@@ -333,8 +334,8 @@
 0xc9, 0x68, 0x40, 0x18, 0x01, 0x23, 0x9b, 0x07, 0x02, 0x30, 0x18, 0x43, 
 0x00, 0x68, 0x00, 0x04, 0x00, 0x0c, 0x11, 0x23, 0x9b, 0x02, 0x98, 0x42, 
 0x18, 0xd1, 0x78, 0x6a, 0x39, 0x6b, 0xc0, 0x46, 
-0x48, 0x62, 0x38, 0x6b, 0x02, 0xf0, 0xd0, 0xf8, 0x38, 0x1c, 0x01, 0xf0, 
-0x8b, 0xfd, 0x01, 0x20, 0x07, 0x49, 0xc0, 0x46, 0xc8, 0x73, 0x07, 0x49, 
+0x48, 0x62, 0x38, 0x6b, 0x02, 0xf0, 0xda, 0xf8, 0x38, 0x1c, 0x01, 0xf0, 
+0x95, 0xfd, 0x01, 0x20, 0x07, 0x49, 0xc0, 0x46, 0xc8, 0x73, 0x07, 0x49, 
 0x4a, 0x6c, 0x12, 0x18, 0x4a, 0x64, 0x06, 0x49, 0x8a, 0x6d, 0x12, 0x18, 
 0x8a, 0x65, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x20, 0xfa, 0xe7, 
 0x18, 0x1a, 0x00, 0x80, 0x0c, 0x2b, 0x00, 0x80, 0xa4, 0x2a, 0x00, 0x80, 
@@ -370,7 +371,7 @@
 0xc2, 0x60, 0x38, 0x1c, 0x00, 0xf0, 0xce, 0xfa, 0x38, 0x6a, 0x01, 0x30, 
 0x38, 0x62, 0x38, 0x1c, 0x00, 0xf0, 0x0a, 0xf8, 0x80, 0xbc, 0x08, 0xbc, 
 0x18, 0x47, 0x10, 0x1c, 0xfa, 0xe7, 0x00, 0x00, 0x6c, 0x06, 0x00, 0x80, 
-0x1c, 0xad, 0x20, 0x40, 0xf0, 0xb5, 0x07, 0x1c, 0xf9, 0x1d, 0xf9, 0x31, 
+0xac, 0xab, 0x20, 0x40, 0xf0, 0xb5, 0x07, 0x1c, 0xf9, 0x1d, 0xf9, 0x31, 
 0x88, 0x6a, 0xc2, 0x1d, 0x2d, 0x32, 0x01, 0x23, 0x9b, 0x07, 0x08, 0x32, 
 0x1a, 0x43, 0xc8, 0x6a, 0x12, 0x68, 0x12, 0x04, 0x12, 0x0c, 0x80, 0x18, 
 0x82, 0x79, 0xc3, 0x79, 0x1b, 0x02, 0x1a, 0x43, 0x13, 0x02, 0x12, 0x0a, 
@@ -381,7 +382,7 @@
 0xc2, 0x1d, 0x0d, 0x32, 0x1a, 0x43, 0x12, 0x68, 0x12, 0x04, 0x12, 0x30, 
 0x18, 0x43, 0x00, 0x68, 0x00, 0x04, 0x00, 0x0c, 0x10, 0x43, 0x03, 0x1c, 
 0xf8, 0x1d, 0xff, 0x30, 0x4a, 0x30, 0x82, 0x78, 0xc8, 0x6b, 0x19, 0x1c, 
-0x01, 0xf0, 0xf8, 0xff, 0x00, 0x28, 0x04, 0xda, 0x20, 0x8a, 0xff, 0x23, 
+0x02, 0xf0, 0x02, 0xf8, 0x00, 0x28, 0x04, 0xda, 0x20, 0x8a, 0xff, 0x23, 
 0x01, 0x33, 0x18, 0x43, 0x0e, 0xe0, 0xf9, 0x1d, 0xff, 0x31, 0x3a, 0x31, 
 0x08, 0x60, 0x01, 0x04, 0x09, 0x0c, 0x38, 0x1c, 0x00, 0xf0, 0x1c, 0xf8, 
 0x00, 0x28, 0x14, 0xd1, 0x20, 0x8a, 0x01, 0x23, 0x5b, 0x02, 0x18, 0x43, 
@@ -398,7 +399,7 @@
 0x60, 0x6b, 0x81, 0x42, 0xf8, 0xd8, 0x69, 0x89, 0xea, 0x88, 0x89, 0x18, 
 0x81, 0x42, 0xf3, 0xd8, 0x00, 0x98, 0x01, 0x28, 0x25, 0xd1, 0xe0, 0x6a, 
 0xf1, 0x6b, 0x40, 0x18, 0x71, 0x6c, 0xfa, 0x1d, 0xcd, 0x32, 0x01, 0xf0, 
-0x29, 0xf9, 0xfa, 0x1d, 0xff, 0x32, 0x3a, 0x32, 0xe0, 0x6a, 0x51, 0x69, 
+0x33, 0xf9, 0xfa, 0x1d, 0xff, 0x32, 0x3a, 0x32, 0xe0, 0x6a, 0x51, 0x69, 
 0x40, 0x18, 0xc3, 0x1d, 0x03, 0x33, 0x00, 0x20, 0x81, 0x00, 0x5e, 0x58, 
 0xc9, 0x19, 0xff, 0x31, 0x01, 0x31, 0x4e, 0x61, 0x01, 0x30, 0x04, 0x28, 
 0xf6, 0xd3, 0xe0, 0x6a, 0x51, 0x69, 0x40, 0x18, 0xc1, 0x1d, 0x05, 0x31, 
@@ -419,7 +420,7 @@
 0xc0, 0x46, 0x09, 0x90, 0xff, 0x23, 0x1b, 0x02, 0x18, 0x40, 0x00, 0x0a, 
 0x0a, 0x90, 0x0a, 0x98, 0xa4, 0x4e, 0x01, 0x28, 0x59, 0xd1, 0x28, 0x6b, 
 0xa2, 0x68, 0x80, 0x18, 0xa2, 0x4a, 0x21, 0x69, 
-0x09, 0x04, 0x09, 0x0c, 0x01, 0xf0, 0x1c, 0xf9, 0x28, 0x6b, 0x79, 0x69, 
+0x09, 0x04, 0x09, 0x0c, 0x01, 0xf0, 0x26, 0xf9, 0x28, 0x6b, 0x79, 0x69, 
 0x40, 0x18, 0xc1, 0x1d, 0x05, 0x31, 0x00, 0x20, 0x82, 0x00, 0x98, 0x4b, 
 0xd3, 0x18, 0xff, 0x33, 0x01, 0x33, 0x5b, 0x69, 0xc0, 0x46, 0x8b, 0x50, 
 0x01, 0x30, 0x04, 0x28, 0xf4, 0xd3, 0x00, 0x20, 0x31, 0x1c, 0x82, 0x00, 
@@ -429,7 +430,7 @@
 0x8e, 0x48, 0xc1, 0x89, 0x01, 0x31, 0xc1, 0x81, 0xb8, 0x68, 0x00, 0x28, 
 0x03, 0xd1, 0x38, 0x8a, 0x10, 0x23, 0x18, 0x43, 0x71, 0xe0, 0x38, 0x8a, 
 0x40, 0x23, 0x18, 0x43, 0x6d, 0xe0, 0x00, 0xf0, 0x11, 0xf9, 0x01, 0xf0, 
-0x5d, 0xff, 0xf5, 0xe0, 0x01, 0x30, 0x06, 0x28, 0xe3, 0xd3, 0x08, 0x98, 
+0x67, 0xff, 0xf5, 0xe0, 0x01, 0x30, 0x06, 0x28, 0xe3, 0xd3, 0x08, 0x98, 
 0x00, 0x28, 0x0c, 0xd1, 0xb8, 0x68, 0x41, 0x1c, 0xb9, 0x60, 0x00, 0x28, 
 0x03, 0xd1, 0x38, 0x8a, 0x01, 0x23, 0x18, 0x43, 0x02, 0xe0, 0x38, 0x8a, 
 0x04, 0x23, 0x18, 0x43, 0x38, 0x82, 0x78, 0x68, 0x01, 0x30, 0x78, 0x60, 
@@ -470,10 +471,10 @@
 0xff, 0xf7, 0xc0, 0xfd, 0x00, 0x28, 0x11, 0xd1, 0x0e, 0xe0, 0x00, 0x20, 
 0x30, 0x72, 0x11, 0xe0, 0x33, 0x29, 0x01, 0xd0, 0x32, 0x29, 0x0d, 0xd1, 
 0x07, 0x1c, 0x00, 0xf0, 0x71, 0xf8, 0x38, 0x1c, 0xff, 0xf7, 0xb0, 0xfd, 
-0x00, 0x28, 0x01, 0xd1, 0x01, 0xf0, 0x66, 0xfe, 0x0d, 0xb0, 0xf0, 0xbc, 
+0x00, 0x28, 0x01, 0xd1, 0x01, 0xf0, 0x70, 0xfe, 0x0d, 0xb0, 0xf0, 0xbc, 
 0x08, 0xbc, 0x18, 0x47, 0x00, 0xf0, 0x12, 0xf8, 0xf6, 0xe7, 0x00, 0x00, 
 0x6c, 0x06, 0x00, 0x80, 0x00, 0x00, 0x00, 0xb0, 0x4c, 0x2a, 0x00, 0x80, 
-0x1c, 0xad, 0x20, 0x40, 0x40, 0x07, 0x00, 0x80, 0x82, 0x07, 0x00, 0x80, 
+0xac, 0xab, 0x20, 0x40, 0x40, 0x07, 0x00, 0x80, 0x82, 0x07, 0x00, 0x80, 
 0x0c, 0x2b, 0x00, 0x80, 0x6c, 0x07, 0x00, 0x80, 0xf0, 0xb5, 0x25, 0x48, 
 0x41, 0x68, 0x01, 0x31, 0x41, 0x60, 0x24, 0x4f, 0xf9, 0x1d, 0xf9, 0x31, 
 0x00, 0x24, 0x88, 0x6a, 0xfa, 0x68, 0xc0, 0x46, 0x94, 0x61, 0x04, 0x22, 
@@ -485,7 +486,7 @@
 0x4a, 0x6b, 0xfb, 0x68, 0xc0, 0x46, 0xda, 0x81, 0x0a, 0x6b, 0xc0, 0x46, 
 0x82, 0x62, 0xc4, 0x62, 0xc3, 0x1d, 0x39, 0x33, 0x4a, 0x6b, 0xc0, 0x46, 
 0x5a, 0x83, 0x04, 0x23, 0x02, 0x68, 0x1a, 0x43, 0x02, 0x60, 0x88, 0x6a, 
-0x01, 0xf0, 0x28, 0xfa, 0xf8, 0x68, 0x01, 0x23, 0x9b, 0x07, 0x54, 0x30, 
+0x01, 0xf0, 0x32, 0xfa, 0xf8, 0x68, 0x01, 0x23, 0x9b, 0x07, 0x54, 0x30, 
 0x18, 0x43, 0x00, 0x68, 0xc0, 0x46, 0xf8, 0x60, 0xf0, 0xbc, 0x08, 0xbc, 
 0x18, 0x47, 0x00, 0x00, 0x0c, 0x2b, 0x00, 0x80, 0x6c, 0x06, 0x00, 0x80, 
 0xac, 0x07, 0x00, 0x80, 0x80, 0xb5, 0xc1, 0x1d, 0xf9, 0x31, 0x8a, 0x6a, 
@@ -546,7 +547,7 @@
 0x04, 0x23, 0x90, 0x6a, 0xc0, 0x46, 0xc3, 0x60, 0x10, 0x23, 0x83, 0x61, 
 0xcb, 0x0a, 0x01, 0xd3, 0x18, 0x23, 0x83, 0x61, 0xc1, 0x83, 0x51, 0x6b, 
 0xc0, 0x46, 0xc1, 0x81, 0x51, 0x6b, 0xc2, 0x1d, 0x39, 0x32, 0x51, 0x83, 
-0x04, 0x23, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 0x01, 0xf0, 0xb8, 0xf8, 
+0x04, 0x23, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 0x01, 0xf0, 0xc2, 0xf8, 
 0x08, 0xbc, 0x18, 0x47, 0x0c, 0x2b, 0x00, 0x80, 
 0xb0, 0xb5, 0x1b, 0x4c, 0x20, 0x6a, 0x02, 0x28, 0x1b, 0xd2, 0x00, 0x20, 
 0xe7, 0x1d, 0x19, 0x37, 0x38, 0x71, 0xe1, 0x68, 0xe0, 0x1d, 0xf9, 0x30, 
@@ -555,1331 +556,1331 @@
 0x02, 0x28, 0x00, 0xd3, 0x3d, 0x71, 0xe0, 0x68, 0x00, 0x28, 0x02, 0xd0, 
 0x38, 0x79, 0x00, 0x28, 0xf1, 0xd0, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
 0x40, 0x6a, 0x00, 0x28, 0xf9, 0xd1, 0x00, 0x29, 0xf7, 0xd1, 0x60, 0x69, 
-0x00, 0x28, 0x04, 0xd0, 0x06, 0x48, 0x00, 0x68, 0x03, 0xf0, 0x9e, 0xfc, 
-0xef, 0xe7, 0x60, 0x68, 0x00, 0x28, 0xec, 0xd0, 0x00, 0xf0, 0x50, 0xf8, 
+0x00, 0x28, 0x04, 0xd0, 0x06, 0x48, 0x00, 0x68, 0x03, 0xf0, 0xa8, 0xfc, 
+0xef, 0xe7, 0x60, 0x68, 0x00, 0x28, 0xec, 0xd0, 0x00, 0xf0, 0x5a, 0xf8, 
 0xe9, 0xe7, 0x00, 0x00, 0x6c, 0x06, 0x00, 0x80, 0x34, 0x04, 0x00, 0x80, 
-0xb0, 0xb5, 0x07, 0x1c, 0x20, 0x23, 0xb8, 0x68, 0x18, 0x40, 0x00, 0x25, 
-0x00, 0x28, 0x03, 0xd1, 0x28, 0x1c, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0xc4, 0x23, 0x48, 0x68, 0x18, 0x40, 0x01, 0x24, 0x00, 0x28, 0x03, 0xd1, 
-0x38, 0x6a, 0x00, 0xf0, 0x09, 0xfc, 0x2f, 0xe0, 0x38, 0x1c, 0x00, 0xf0, 
-0x19, 0xfc, 0x38, 0x1c, 0x00, 0xf0, 0x78, 0xfa, 0xb8, 0x68, 0xc0, 0x08, 
-0x02, 0xd3, 0x38, 0x6a, 0x00, 0xf0, 0xce, 0xfb, 0xb8, 0x68, 0x39, 0x6a, 
-0xc0, 0x46, 0x88, 0x60, 0x38, 0x6a, 0xc0, 0x46, 0xc5, 0x60, 0x0f, 0x48, 
-0x41, 0x68, 0x00, 0x29, 0x11, 0xd1, 0xc1, 0x68, 0x00, 0x29, 0x09, 0xd1, 
-0x41, 0x69, 0x00, 0x29, 0x06, 0xd1, 0x39, 0x6a, 0xc0, 0x46, 0x81, 0x60, 
-0x41, 0x60, 0x00, 0xf0, 0x11, 0xf8, 0x0b, 0xe0, 0x39, 0x6a, 0xc0, 0x46, 
-0x81, 0x60, 0x41, 0x60, 0x06, 0xe0, 0x39, 0x6a, 0x82, 0x68, 0xc0, 0x46, 
-0xd1, 0x60, 0x39, 0x6a, 0xc0, 0x46, 0x81, 0x60, 0x20, 0x1c, 0xc0, 0xe7, 
-0x6c, 0x06, 0x00, 0x80, 0x90, 0xb5, 0x0b, 0x4c, 0x67, 0x68, 0x00, 0x2f, 
-0x0f, 0xd0, 0x38, 0x1c, 0x00, 0xf0, 0x12, 0xf8, 0x00, 0x28, 0x0a, 0xd1, 
-0x60, 0x68, 0xc0, 0x68, 0xc0, 0x46, 0x60, 0x60, 0x38, 0x1c, 0x00, 0xf0, 
-0xc3, 0xfb, 0x00, 0x20, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x01, 0x20, 
-0xfa, 0xe7, 0x00, 0x00, 0x6c, 0x06, 0x00, 0x80, 0xf0, 0xb5, 0x07, 0x1c, 
-0xfe, 0x1d, 0x49, 0x36, 0x30, 0x78, 0x40, 0x00, 0xc0, 0x19, 0x85, 0x8b, 
-0x33, 0x4c, 0x34, 0x4b, 0x9d, 0x42, 0x3c, 0xd0, 0x38, 0x1c, 0x21, 0x1c, 
-0x2a, 0x1c, 0x00, 0xf0, 0x1d, 0xf9, 0x31, 0x48, 0x80, 0x6a, 0x58, 0x21, 
-0x69, 0x43, 0x40, 0x18, 0x01, 0x23, 0x9b, 0x07, 0x18, 0x43, 0x00, 0x68, 
-0x00, 0x04, 0x00, 0x0c, 0x2c, 0x4d, 0x01, 0x28, 0x1a, 0xd1, 0x30, 0x78, 
-0xc0, 0x19, 0xc1, 0x1d, 0x19, 0x31, 0x08, 0x7a, 0x3a, 0x68, 0x80, 0x18, 
-0x09, 0x7b, 0xea, 0x1d, 0x21, 0x32, 0x00, 0xf0, 0xe3, 0xfc, 0x30, 0x78, 
-0xc0, 0x19, 0x20, 0x30, 0x00, 0x79, 0x39, 0x68, 0x40, 0x18, 0xc1, 0x1d, 
-0x05, 0x31, 0x00, 0x20, 0x00, 0x23, 0x42, 0x00, 0x8b, 0x52, 0x01, 0x30, 
-0x06, 0x28, 0xfa, 0xd3, 0xa0, 0x88, 0x41, 0x07, 0x0b, 0xd1, 0x21, 0x89, 
-0x09, 0x18, 0x78, 0x68, 0x00, 0x04, 0x00, 0x0c, 0x81, 0x42, 0x04, 0xd8, 
-0x61, 0x89, 0xe2, 0x88, 0x89, 0x18, 0x81, 0x42, 0x03, 0xd9, 0x00, 0x20, 
-0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x21, 0x1c, 0x14, 0x4a, 0x00, 0x20, 
-0xfe, 0xf7, 0x64, 0xff, 0x01, 0x22, 0x52, 0x04, 0x78, 0x68, 0x02, 0x43, 
-0x01, 0x20, 0x39, 0x68, 0xfe, 0xf7, 0x5c, 0xff, 0x01, 0x22, 0x52, 0x04, 
-0x78, 0x68, 0x02, 0x43, 0x00, 0x20, 0x39, 0x68, 
-0xfe, 0xf7, 0x54, 0xff, 0x0b, 0x49, 0x0c, 0x4a, 0x01, 0x20, 0xfe, 0xf7, 
-0x4f, 0xff, 0x01, 0x20, 0xe9, 0x1d, 0x19, 0x31, 0x48, 0x71, 0x02, 0x21, 
-0xea, 0x1d, 0xf9, 0x32, 0x51, 0x62, 0xd9, 0xe7, 0x98, 0xad, 0x20, 0x40, 
-0xff, 0xff, 0x00, 0x00, 0x4c, 0x2a, 0x00, 0x80, 0x6c, 0x06, 0x00, 0x80, 
-0x54, 0x00, 0x03, 0x00, 0x84, 0xad, 0x20, 0x40, 0x14, 0x00, 0x07, 0x00, 
-0xf0, 0xb5, 0x83, 0xb0, 0x00, 0x21, 0x4f, 0x48, 0xc2, 0x1d, 0xf9, 0x32, 
-0x51, 0x62, 0x01, 0x21, 0xc9, 0x04, 0x4d, 0x4a, 0xc0, 0x46, 0x11, 0x60, 
-0xc1, 0x1d, 0x19, 0x31, 0x49, 0x79, 0x00, 0x29, 0x04, 0xd1, 0x4a, 0x48, 
-0x00, 0x68, 0x03, 0xf0, 0x9b, 0xfb, 0x87, 0xe0, 0x45, 0x48, 0x47, 0x68, 
-0xfc, 0x1d, 0x49, 0x34, 0x21, 0x78, 0x48, 0x00, 0xc0, 0x19, 0x80, 0x8b, 
-0x44, 0x4a, 0x92, 0x6a, 0x58, 0x23, 0x58, 0x43, 0x15, 0x18, 0x01, 0x23, 
-0x9b, 0x07, 0xea, 0x1d, 0x05, 0x32, 0x1a, 0x43, 0x12, 0x68, 0x08, 0x35, 
-0x2b, 0x43, 0x1d, 0x68, 0xff, 0x23, 0x1b, 0x02, 0x2b, 0x40, 0x1b, 0x0a, 
-0x3c, 0x4d, 0x01, 0x2b, 0x24, 0xd1, 0xc8, 0x19, 0xc1, 0x1d, 0x19, 0x31, 
-0x08, 0x7a, 0x3a, 0x68, 0x80, 0x18, 0x39, 0x4a, 0x09, 0x7b, 0x00, 0xf0, 
-0xc5, 0xfc, 0x20, 0x78, 0xc0, 0x19, 0x20, 0x30, 0x00, 0x79, 0x39, 0x68, 
-0x41, 0x18, 0x00, 0x20, 0x82, 0x00, 0x53, 0x19, 0x9b, 0x6e, 0x6e, 0x46, 
-0xb3, 0x50, 0x01, 0x30, 0x03, 0x28, 0xf7, 0xd3, 0xca, 0x1d, 0x05, 0x32, 
-0x69, 0x46, 0x00, 0x20, 0x43, 0x00, 0xcd, 0x5a, 0xc0, 0x46, 0xd5, 0x52, 
-0x01, 0x30, 0x06, 0x28, 0xf8, 0xd3, 0x2d, 0xe0, 0x02, 0x2b, 0x2b, 0xd1, 
-0x11, 0x0a, 0x29, 0xd3, 0x00, 0x21, 0x8a, 0x00, 0x53, 0x19, 0x9b, 0x6e, 
-0x6e, 0x46, 0xb3, 0x50, 0x01, 0x31, 0x03, 0x29, 0xf7, 0xd3, 0x21, 0x78, 
-0x49, 0x00, 0xc9, 0x19, 0x09, 0x8f, 0x3a, 0x68, 0x8b, 0x18, 0x6a, 0x46, 
-0x00, 0x21, 0x4d, 0x00, 0x56, 0x5b, 0xc0, 0x46, 0x5e, 0x53, 0x01, 0x31, 
-0x06, 0x29, 0xf8, 0xd3, 0x19, 0x49, 0x8a, 0x6a, 0x13, 0x18, 0x1a, 0x6d, 
-0x00, 0x9d, 0x55, 0x40, 0x19, 0x4a, 0xd6, 0x68, 0x75, 0x40, 0x1d, 0x65, 
-0x89, 0x6a, 0x08, 0x18, 0x41, 0x6d, 0x02, 0x9b, 0x59, 0x40, 0x92, 0x69, 
-0x51, 0x40, 0x41, 0x65, 0x20, 0x78, 0x41, 0x1e, 0x21, 0x70, 0x00, 0x28, 
-0x0d, 0xd0, 0x38, 0x1c, 0xff, 0xf7, 0xf4, 0xfe, 0x00, 0x28, 0x0d, 0xd1, 
-0x08, 0x4a, 0x50, 0x68, 0xc0, 0x68, 0xc0, 0x46, 0x50, 0x60, 0x38, 0x1c, 
-0x00, 0xf0, 0xa4, 0xfa, 0x02, 0xe0, 0x38, 0x1c, 0x00, 0xf0, 0x73, 0xfa, 
-0x01, 0xf0, 0xde, 0xfa, 0x03, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x6c, 0x06, 0x00, 0x80, 0x00, 0x00, 0x00, 0xb0, 0x38, 0x04, 0x00, 0x80, 
-0x4c, 0x2a, 0x00, 0x80, 0x1c, 0xad, 0x20, 0x40, 0x94, 0x06, 0x00, 0x80, 
-0x08, 0x83, 0x20, 0x40, 0xf0, 0xb5, 0x82, 0xb0, 0x69, 0x4b, 0x9f, 0x6a, 
-0x58, 0x23, 0x5a, 0x43, 0xba, 0x18, 0xc3, 0x1d, 0x49, 0x33, 0x1f, 0x78, 
-0x01, 0x23, 0x9b, 0x07, 0xd4, 0x1d, 0x01, 0x34, 0x23, 0x43, 0x1d, 0x68, 
-0x43, 0x68, 0x1c, 0x04, 0x01, 0x23, 0x9b, 0x07, 0xd6, 0x1d, 0x05, 0x36, 
-0x33, 0x43, 0x1b, 0x68, 0x1c, 0x43, 0x42, 0x23, 0x1c, 0x43, 0x0c, 0x60, 
-0xff, 0x26, 0x36, 0x02, 0x2e, 0x40, 0x01, 0x23, 0x5b, 0x02, 0x9e, 0x42, 
-0x74, 0xd1, 0x6b, 0x0c, 0x2b, 0xd3, 0xc3, 0x19, 0x20, 0x33, 0x1b, 0x79, 
+0xb0, 0xb5, 0x07, 0x1c, 0x20, 0x23, 0xb8, 0x68, 0x18, 0x40, 0x01, 0x24, 
+0x00, 0x25, 0x00, 0x28, 0x0b, 0xd1, 0x38, 0x6a, 0x00, 0x28, 0x03, 0xd1, 
+0x28, 0x1c, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x1f, 0x48, 0x01, 0x6e, 
+0x01, 0x31, 0x01, 0x66, 0x03, 0xe0, 0x48, 0x68, 0xc4, 0x23, 0x18, 0x40, 
+0x03, 0xd1, 0x38, 0x6a, 0x00, 0xf0, 0x0c, 0xfc, 0x2f, 0xe0, 0x38, 0x1c, 
+0x00, 0xf0, 0x1c, 0xfc, 0x38, 0x1c, 0x00, 0xf0, 0x7b, 0xfa, 0xb8, 0x68, 
+0xc0, 0x08, 0x02, 0xd3, 0x38, 0x6a, 0x00, 0xf0, 0xd1, 0xfb, 0xb8, 0x68, 
+0x39, 0x6a, 0xc0, 0x46, 0x88, 0x60, 0x38, 0x6a, 0xc0, 0x46, 0xc5, 0x60, 
+0x10, 0x48, 0x41, 0x68, 0x00, 0x29, 0x11, 0xd1, 0xc1, 0x68, 0x00, 0x29, 
+0x09, 0xd1, 0x41, 0x69, 0x00, 0x29, 0x06, 0xd1, 0x39, 0x6a, 0xc0, 0x46, 
+0x81, 0x60, 0x41, 0x60, 0x00, 0xf0, 0x14, 0xf8, 0x0b, 0xe0, 0x39, 0x6a, 
+0xc0, 0x46, 0x81, 0x60, 0x41, 0x60, 0x06, 0xe0, 0x39, 0x6a, 0x82, 0x68, 
+0xc0, 0x46, 0xd1, 0x60, 0x39, 0x6a, 0xc0, 0x46, 0x81, 0x60, 0x20, 0x1c, 
+0xbd, 0xe7, 0x00, 0x00, 0xa4, 0x2a, 0x00, 0x80, 0x6c, 0x06, 0x00, 0x80, 
+0x90, 0xb5, 0x0b, 0x4c, 0x67, 0x68, 0x00, 0x2f, 0x0f, 0xd0, 0x38, 0x1c, 
+0x00, 0xf0, 0x12, 0xf8, 0x00, 0x28, 0x0a, 0xd1, 0x60, 0x68, 0xc0, 0x68, 
+0xc0, 0x46, 0x60, 0x60, 0x38, 0x1c, 0x00, 0xf0, 0xc3, 0xfb, 0x00, 0x20, 
+0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x01, 0x20, 0xfa, 0xe7, 0x00, 0x00, 
+0x6c, 0x06, 0x00, 0x80, 0xf0, 0xb5, 0x07, 0x1c, 0xfe, 0x1d, 0x49, 0x36, 
+0x30, 0x78, 0x40, 0x00, 0xc0, 0x19, 0x85, 0x8b, 0x33, 0x4c, 0x34, 0x4b, 
+0x9d, 0x42, 0x3c, 0xd0, 0x38, 0x1c, 0x21, 0x1c, 0x2a, 0x1c, 0x00, 0xf0, 
+0x1d, 0xf9, 0x31, 0x48, 0x80, 0x6a, 0x58, 0x21, 0x69, 0x43, 0x40, 0x18, 
+0x01, 0x23, 0x9b, 0x07, 0x18, 0x43, 0x00, 0x68, 0x00, 0x04, 0x00, 0x0c, 
+0x2c, 0x4d, 0x01, 0x28, 0x1a, 0xd1, 0x30, 0x78, 0xc0, 0x19, 0xc1, 0x1d, 
+0x19, 0x31, 0x08, 0x7a, 0x3a, 0x68, 0x80, 0x18, 0x09, 0x7b, 0xea, 0x1d, 
+0x21, 0x32, 0x00, 0xf0, 0xe3, 0xfc, 0x30, 0x78, 0xc0, 0x19, 0x20, 0x30, 
+0x00, 0x79, 0x39, 0x68, 0x40, 0x18, 0xc1, 0x1d, 0x05, 0x31, 0x00, 0x20, 
+0x00, 0x23, 0x42, 0x00, 0x8b, 0x52, 0x01, 0x30, 0x06, 0x28, 0xfa, 0xd3, 
+0xa0, 0x88, 0x41, 0x07, 0x0b, 0xd1, 0x21, 0x89, 0x09, 0x18, 0x78, 0x68, 
+0x00, 0x04, 0x00, 0x0c, 0x81, 0x42, 0x04, 0xd8, 0x61, 0x89, 0xe2, 0x88, 
+0x89, 0x18, 0x81, 0x42, 0x03, 0xd9, 0x00, 0x20, 0xf0, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x21, 0x1c, 0x14, 0x4a, 0x00, 0x20, 0xfe, 0xf7, 0x5a, 0xff, 
+0x01, 0x22, 0x52, 0x04, 0x78, 0x68, 0x02, 0x43, 
+0x01, 0x20, 0x39, 0x68, 0xfe, 0xf7, 0x52, 0xff, 0x01, 0x22, 0x52, 0x04, 
+0x78, 0x68, 0x02, 0x43, 0x00, 0x20, 0x39, 0x68, 0xfe, 0xf7, 0x4a, 0xff, 
+0x0b, 0x49, 0x0c, 0x4a, 0x01, 0x20, 0xfe, 0xf7, 0x45, 0xff, 0x01, 0x20, 
+0xe9, 0x1d, 0x19, 0x31, 0x48, 0x71, 0x02, 0x21, 0xea, 0x1d, 0xf9, 0x32, 
+0x51, 0x62, 0xd9, 0xe7, 0x28, 0xac, 0x20, 0x40, 0xff, 0xff, 0x00, 0x00, 
+0x4c, 0x2a, 0x00, 0x80, 0x6c, 0x06, 0x00, 0x80, 0x54, 0x00, 0x03, 0x00, 
+0x14, 0xac, 0x20, 0x40, 0x14, 0x00, 0x07, 0x00, 0xf0, 0xb5, 0x83, 0xb0, 
+0x00, 0x21, 0x4f, 0x48, 0xc2, 0x1d, 0xf9, 0x32, 0x51, 0x62, 0x01, 0x21, 
+0xc9, 0x04, 0x4d, 0x4a, 0xc0, 0x46, 0x11, 0x60, 0xc1, 0x1d, 0x19, 0x31, 
+0x49, 0x79, 0x00, 0x29, 0x04, 0xd1, 0x4a, 0x48, 0x00, 0x68, 0x03, 0xf0, 
+0x9b, 0xfb, 0x87, 0xe0, 0x45, 0x48, 0x47, 0x68, 0xfc, 0x1d, 0x49, 0x34, 
+0x21, 0x78, 0x48, 0x00, 0xc0, 0x19, 0x80, 0x8b, 0x44, 0x4a, 0x92, 0x6a, 
+0x58, 0x23, 0x58, 0x43, 0x15, 0x18, 0x01, 0x23, 0x9b, 0x07, 0xea, 0x1d, 
+0x05, 0x32, 0x1a, 0x43, 0x12, 0x68, 0x08, 0x35, 0x2b, 0x43, 0x1d, 0x68, 
+0xff, 0x23, 0x1b, 0x02, 0x2b, 0x40, 0x1b, 0x0a, 0x3c, 0x4d, 0x01, 0x2b, 
+0x24, 0xd1, 0xc8, 0x19, 0xc1, 0x1d, 0x19, 0x31, 0x08, 0x7a, 0x3a, 0x68, 
+0x80, 0x18, 0x39, 0x4a, 0x09, 0x7b, 0x00, 0xf0, 0xc5, 0xfc, 0x20, 0x78, 
+0xc0, 0x19, 0x20, 0x30, 0x00, 0x79, 0x39, 0x68, 0x41, 0x18, 0x00, 0x20, 
+0x82, 0x00, 0x53, 0x19, 0x9b, 0x6e, 0x6e, 0x46, 0xb3, 0x50, 0x01, 0x30, 
+0x03, 0x28, 0xf7, 0xd3, 0xca, 0x1d, 0x05, 0x32, 0x69, 0x46, 0x00, 0x20, 
+0x43, 0x00, 0xcd, 0x5a, 0xc0, 0x46, 0xd5, 0x52, 0x01, 0x30, 0x06, 0x28, 
+0xf8, 0xd3, 0x2d, 0xe0, 0x02, 0x2b, 0x2b, 0xd1, 0x11, 0x0a, 0x29, 0xd3, 
+0x00, 0x21, 0x8a, 0x00, 0x53, 0x19, 0x9b, 0x6e, 0x6e, 0x46, 0xb3, 0x50, 
+0x01, 0x31, 0x03, 0x29, 0xf7, 0xd3, 0x21, 0x78, 0x49, 0x00, 0xc9, 0x19, 
+0x09, 0x8f, 0x3a, 0x68, 0x8b, 0x18, 0x6a, 0x46, 0x00, 0x21, 0x4d, 0x00, 
+0x56, 0x5b, 0xc0, 0x46, 0x5e, 0x53, 0x01, 0x31, 0x06, 0x29, 0xf8, 0xd3, 
+0x19, 0x49, 0x8a, 0x6a, 0x13, 0x18, 0x1a, 0x6d, 0x00, 0x9d, 0x55, 0x40, 
+0x19, 0x4a, 0xd6, 0x68, 0x75, 0x40, 0x1d, 0x65, 0x89, 0x6a, 0x08, 0x18, 
+0x41, 0x6d, 0x02, 0x9b, 0x59, 0x40, 0x92, 0x69, 0x51, 0x40, 0x41, 0x65, 
+0x20, 0x78, 0x41, 0x1e, 0x21, 0x70, 0x00, 0x28, 0x0d, 0xd0, 0x38, 0x1c, 
+0xff, 0xf7, 0xf4, 0xfe, 0x00, 0x28, 0x0d, 0xd1, 0x08, 0x4a, 0x50, 0x68, 
+0xc0, 0x68, 0xc0, 0x46, 0x50, 0x60, 0x38, 0x1c, 0x00, 0xf0, 0xa4, 0xfa, 
+0x02, 0xe0, 0x38, 0x1c, 0x00, 0xf0, 0x73, 0xfa, 0x01, 0xf0, 0xde, 0xfa, 
+0x03, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x6c, 0x06, 0x00, 0x80, 
+0x00, 0x00, 0x00, 0xb0, 0x38, 0x04, 0x00, 0x80, 0x4c, 0x2a, 0x00, 0x80, 
+0xac, 0xab, 0x20, 0x40, 0x94, 0x06, 0x00, 0x80, 0x08, 0x83, 0x20, 0x40, 
+0xf0, 0xb5, 0x82, 0xb0, 0x69, 0x4b, 0x9f, 0x6a, 0x58, 0x23, 0x5a, 0x43, 
+0xba, 0x18, 0xc3, 0x1d, 0x49, 0x33, 0x1f, 0x78, 0x01, 0x23, 0x9b, 0x07, 
+0xd4, 0x1d, 0x01, 0x34, 0x23, 0x43, 0x1d, 0x68, 0x43, 0x68, 0x1c, 0x04, 
+0x01, 0x23, 0x9b, 0x07, 0xd6, 0x1d, 0x05, 0x36, 0x33, 0x43, 0x1b, 0x68, 
+0x1c, 0x43, 0x42, 0x23, 0x1c, 0x43, 0x0c, 0x60, 0xff, 0x26, 0x36, 0x02, 
+0x2e, 0x40, 0x01, 0x23, 0x5b, 0x02, 0x9e, 0x42, 0x74, 0xd1, 0x6b, 0x0c, 
+0x2b, 0xd3, 0xc3, 0x19, 0x20, 0x33, 0x1b, 0x79, 
 0xc0, 0x46, 0x4b, 0x81, 0x7b, 0x00, 0x1b, 0x18, 0x1b, 0x8f, 0x4c, 0x89, 
-0x1b, 0x1b, 0xcb, 0x80, 0x00, 0x24, 0xa6, 0x00, 
-0x01, 0x96, 0xb3, 0x18, 0xde, 0x1d, 0x09, 0x36, 0x01, 0x23, 0x9b, 0x07, 
-0x33, 0x43, 0x1b, 0x68, 0x01, 0x9e, 0x76, 0x18, 0x73, 0x61, 0x01, 0x34, 
-0x05, 0x2c, 0xf0, 0xd3, 0x00, 0x24, 0xa6, 0x00, 0x00, 0x96, 0xb3, 0x18, 
-0xde, 0x1d, 0x1d, 0x36, 0x01, 0x23, 0x9b, 0x07, 0x33, 0x43, 0x1b, 0x68, 
-0x00, 0x9e, 0x76, 0x18, 0xb3, 0x62, 0x01, 0x34, 0x05, 0x2c, 0xf0, 0xd3, 
-0x06, 0xe0, 0x00, 0x23, 0x4b, 0x81, 0xcb, 0x80, 0x40, 0x23, 0x9c, 0x43, 
-0x0c, 0x60, 0x23, 0x1c, 0x6b, 0x0e, 0x4a, 0xd3, 0xc3, 0x19, 0x20, 0x33, 
-0x1b, 0x79, 0x10, 0x33, 0x0b, 0x81, 0x7b, 0x00, 0x1b, 0x18, 0x1b, 0x8f, 
-0x0f, 0x89, 0xdb, 0x1b, 0x8b, 0x80, 0x01, 0x23, 0x9b, 0x07, 0xd4, 0x1d, 
-0x35, 0x34, 0x23, 0x43, 0x1b, 0x68, 0xc0, 0x46, 0xcb, 0x63, 0x01, 0x23, 
-0x9b, 0x07, 0xd4, 0x1d, 0x31, 0x34, 0x23, 0x43, 0x1b, 0x68, 0xc0, 0x46, 
-0x0b, 0x64, 0xab, 0x0e, 0x21, 0xd2, 0x01, 0x23, 0x9b, 0x07, 0xd4, 0x1d, 
-0x3d, 0x34, 0x23, 0x43, 0x1b, 0x68, 0xc0, 0x46, 0x4b, 0x64, 0x01, 0x23, 
-0x9b, 0x07, 0xd4, 0x1d, 0x39, 0x34, 0x23, 0x43, 0x1b, 0x68, 0xc0, 0x46, 
-0x8b, 0x64, 0x01, 0x23, 0x9b, 0x07, 0xd4, 0x1d, 0x45, 0x34, 0x23, 0x43, 
-0x1b, 0x68, 0xc0, 0x46, 0xcb, 0x64, 0x01, 0x23, 0x9b, 0x07, 0xd4, 0x1d, 
-0x41, 0x34, 0x23, 0x43, 0x1b, 0x68, 0xc0, 0x46, 0x0b, 0x65, 0x00, 0xe0, 
-0x0f, 0xe0, 0xfb, 0x1f, 0x01, 0x3b, 0x1b, 0x04, 0x1b, 0x0c, 0x07, 0x68, 
-0xff, 0x18, 0x03, 0x69, 0x08, 0x1c, 0x39, 0x1c, 0x00, 0xf0, 0x34, 0xf8, 
-0x2c, 0xe0, 0x00, 0x23, 0x0b, 0x81, 0x8b, 0x80, 0x28, 0xe0, 0x00, 0x23, 
-0x8b, 0x80, 0x0b, 0x81, 0xc3, 0x19, 0x20, 0x33, 0x1b, 0x7a, 0xc0, 0x46, 
-0x4b, 0x81, 0x7b, 0x00, 0x18, 0x18, 0x00, 0x8e, 0xc0, 0x46, 0xc8, 0x80, 
-0x00, 0x20, 0x87, 0x00, 0xbb, 0x18, 0xdc, 0x1d, 0x09, 0x34, 0x01, 0x23, 
-0x9b, 0x07, 0x23, 0x43, 0x1b, 0x68, 0x7f, 0x18, 0x7b, 0x61, 0x01, 0x30, 
-0x05, 0x28, 0xf2, 0xd3, 0x00, 0x20, 0x87, 0x00, 0xbb, 0x18, 0xdc, 0x1d, 
-0x1d, 0x34, 0x01, 0x23, 0x9b, 0x07, 0x23, 0x43, 0x1b, 0x68, 0x7f, 0x18, 
-0xbb, 0x62, 0x01, 0x30, 0x05, 0x28, 0xf2, 0xd3, 0x02, 0xb0, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x4c, 0x2a, 0x00, 0x80, 0x80, 0xb4, 0x1f, 0x1c, 
-0x3b, 0x0c, 0x18, 0xd2, 0x17, 0x6d, 0x11, 0x4b, 0xc0, 0x46, 0xdf, 0x60, 
-0x52, 0x6d, 0xc0, 0x46, 0x1a, 0x61, 0xc7, 0x60, 0x1a, 0x69, 0xc0, 0x46, 
-0x02, 0x61, 0xd8, 0x68, 0xc0, 0x46, 0x08, 0x80, 0xd8, 0x68, 0x00, 0x0c, 
-0x48, 0x80, 0x18, 0x69, 0xc0, 0x46, 0x88, 0x80, 0x18, 0x69, 0x00, 0x0c, 
-0xc8, 0x80, 0x80, 0xbc, 0x70, 0x47, 0x4a, 0x88, 0x12, 0x04, 0x0b, 0x88, 
-0x1a, 0x43, 0xc2, 0x60, 0x8a, 0x88, 0xc9, 0x88, 0x09, 0x04, 0x11, 0x43, 
-0x01, 0x61, 0xf2, 0xe7, 0x2c, 0x07, 0x00, 0x80, 0xf1, 0xb5, 0x88, 0xb0, 
-0x00, 0x22, 0x08, 0x98, 0x00, 0x6a, 0x08, 0x9b, 0x99, 0x68, 0x49, 0x0a, 
-0x02, 0xd3, 0x01, 0x27, 0xff, 0x03, 0x00, 0xe0, 0x00, 0x27, 0x03, 0x8b, 
-0x00, 0x2b, 0x19, 0xd0, 0xa3, 0x49, 0x89, 0x6a, 0x1c, 0x1c, 0x58, 0x23, 
-0x63, 0x43, 0xc9, 0x18, 0x01, 0x23, 0x9b, 0x07, 0x58, 0x39, 0x19, 0x43, 
-0x09, 0x68, 0x09, 0x04, 0x09, 0x0c, 0x02, 0x29, 0x02, 0xd1, 0x08, 0x23, 
-0x1f, 0x43, 0x07, 0xe0, 0x41, 0x8b, 0x00, 0x29, 0x02, 0xd0, 0x0c, 0x23, 
+0x1b, 0x1b, 0xcb, 0x80, 0x00, 0x24, 0xa6, 0x00, 0x01, 0x96, 0xb3, 0x18, 
+0xde, 0x1d, 0x09, 0x36, 0x01, 0x23, 0x9b, 0x07, 0x33, 0x43, 0x1b, 0x68, 
+0x01, 0x9e, 0x76, 0x18, 0x73, 0x61, 0x01, 0x34, 0x05, 0x2c, 0xf0, 0xd3, 
+0x00, 0x24, 0xa6, 0x00, 0x00, 0x96, 0xb3, 0x18, 0xde, 0x1d, 0x1d, 0x36, 
+0x01, 0x23, 0x9b, 0x07, 0x33, 0x43, 0x1b, 0x68, 0x00, 0x9e, 0x76, 0x18, 
+0xb3, 0x62, 0x01, 0x34, 0x05, 0x2c, 0xf0, 0xd3, 0x06, 0xe0, 0x00, 0x23, 
+0x4b, 0x81, 0xcb, 0x80, 0x40, 0x23, 0x9c, 0x43, 0x0c, 0x60, 0x23, 0x1c, 
+0x6b, 0x0e, 0x4a, 0xd3, 0xc3, 0x19, 0x20, 0x33, 0x1b, 0x79, 0x10, 0x33, 
+0x0b, 0x81, 0x7b, 0x00, 0x1b, 0x18, 0x1b, 0x8f, 0x0f, 0x89, 0xdb, 0x1b, 
+0x8b, 0x80, 0x01, 0x23, 0x9b, 0x07, 0xd4, 0x1d, 0x35, 0x34, 0x23, 0x43, 
+0x1b, 0x68, 0xc0, 0x46, 0xcb, 0x63, 0x01, 0x23, 0x9b, 0x07, 0xd4, 0x1d, 
+0x31, 0x34, 0x23, 0x43, 0x1b, 0x68, 0xc0, 0x46, 0x0b, 0x64, 0xab, 0x0e, 
+0x21, 0xd2, 0x01, 0x23, 0x9b, 0x07, 0xd4, 0x1d, 0x3d, 0x34, 0x23, 0x43, 
+0x1b, 0x68, 0xc0, 0x46, 0x4b, 0x64, 0x01, 0x23, 0x9b, 0x07, 0xd4, 0x1d, 
+0x39, 0x34, 0x23, 0x43, 0x1b, 0x68, 0xc0, 0x46, 0x8b, 0x64, 0x01, 0x23, 
+0x9b, 0x07, 0xd4, 0x1d, 0x45, 0x34, 0x23, 0x43, 0x1b, 0x68, 0xc0, 0x46, 
+0xcb, 0x64, 0x01, 0x23, 0x9b, 0x07, 0xd4, 0x1d, 0x41, 0x34, 0x23, 0x43, 
+0x1b, 0x68, 0xc0, 0x46, 0x0b, 0x65, 0x00, 0xe0, 0x0f, 0xe0, 0xfb, 0x1f, 
+0x01, 0x3b, 0x1b, 0x04, 0x1b, 0x0c, 0x07, 0x68, 0xff, 0x18, 0x03, 0x69, 
+0x08, 0x1c, 0x39, 0x1c, 0x00, 0xf0, 0x34, 0xf8, 0x2c, 0xe0, 0x00, 0x23, 
+0x0b, 0x81, 0x8b, 0x80, 0x28, 0xe0, 0x00, 0x23, 0x8b, 0x80, 0x0b, 0x81, 
+0xc3, 0x19, 0x20, 0x33, 0x1b, 0x7a, 0xc0, 0x46, 0x4b, 0x81, 0x7b, 0x00, 
+0x18, 0x18, 0x00, 0x8e, 0xc0, 0x46, 0xc8, 0x80, 0x00, 0x20, 0x87, 0x00, 
+0xbb, 0x18, 0xdc, 0x1d, 0x09, 0x34, 0x01, 0x23, 0x9b, 0x07, 0x23, 0x43, 
+0x1b, 0x68, 0x7f, 0x18, 0x7b, 0x61, 0x01, 0x30, 0x05, 0x28, 0xf2, 0xd3, 
+0x00, 0x20, 0x87, 0x00, 0xbb, 0x18, 0xdc, 0x1d, 0x1d, 0x34, 0x01, 0x23, 
+0x9b, 0x07, 0x23, 0x43, 0x1b, 0x68, 0x7f, 0x18, 0xbb, 0x62, 0x01, 0x30, 
+0x05, 0x28, 0xf2, 0xd3, 0x02, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x4c, 0x2a, 0x00, 0x80, 0x80, 0xb4, 0x1f, 0x1c, 0x3b, 0x0c, 0x18, 0xd2, 
+0x17, 0x6d, 0x11, 0x4b, 0xc0, 0x46, 0xdf, 0x60, 0x52, 0x6d, 0xc0, 0x46, 
+0x1a, 0x61, 0xc7, 0x60, 0x1a, 0x69, 0xc0, 0x46, 0x02, 0x61, 0xd8, 0x68, 
+0xc0, 0x46, 0x08, 0x80, 0xd8, 0x68, 0x00, 0x0c, 0x48, 0x80, 0x18, 0x69, 
+0xc0, 0x46, 0x88, 0x80, 0x18, 0x69, 0x00, 0x0c, 0xc8, 0x80, 0x80, 0xbc, 
+0x70, 0x47, 0x4a, 0x88, 0x12, 0x04, 0x0b, 0x88, 0x1a, 0x43, 0xc2, 0x60, 
+0x8a, 0x88, 0xc9, 0x88, 0x09, 0x04, 0x11, 0x43, 0x01, 0x61, 0xf2, 0xe7, 
+0x2c, 0x07, 0x00, 0x80, 0xf1, 0xb5, 0x88, 0xb0, 0x00, 0x22, 0x08, 0x98, 
+0x00, 0x6a, 0x08, 0x9b, 0x99, 0x68, 0x49, 0x0a, 0x02, 0xd3, 0x01, 0x27, 
+0xff, 0x03, 0x00, 0xe0, 0x00, 0x27, 0x03, 0x8b, 0x00, 0x2b, 0x19, 0xd0, 
+0xa3, 0x49, 0x89, 0x6a, 0x1c, 0x1c, 0x58, 0x23, 0x63, 0x43, 0xc9, 0x18, 
+0x01, 0x23, 0x9b, 0x07, 0x58, 0x39, 0x19, 0x43, 0x09, 0x68, 0x09, 0x04, 
+0x09, 0x0c, 0x02, 0x29, 0x02, 0xd1, 0x08, 0x23, 0x1f, 0x43, 0x07, 0xe0, 
+0x41, 0x8b, 0x00, 0x29, 0x02, 0xd0, 0x0c, 0x23, 
 0x1f, 0x43, 0x01, 0xe0, 0x04, 0x23, 0x1f, 0x43, 0x83, 0x8a, 0x00, 0x2b, 
-0x18, 0xd0, 0x95, 0x49, 0x89, 0x6a, 0x1c, 0x1c, 
-0x58, 0x23, 0x63, 0x43, 0xc9, 0x18, 0x01, 0x23, 0x9b, 0x07, 0x58, 0x39, 
-0x19, 0x43, 0x09, 0x68, 0x09, 0x04, 0x09, 0x0c, 0x02, 0x29, 0x01, 0xd1, 
-0x0f, 0x43, 0x07, 0xe0, 0xc1, 0x8a, 0x00, 0x29, 0x02, 0xd0, 0x03, 0x23, 
-0x1f, 0x43, 0x01, 0xe0, 0x01, 0x23, 0x1f, 0x43, 0xc1, 0x1d, 0x39, 0x31, 
-0x07, 0x91, 0x4b, 0x89, 0x0c, 0x89, 0x1c, 0x19, 0x24, 0x04, 0x24, 0x0c, 
-0x08, 0x9d, 0x2d, 0x68, 0xc0, 0x46, 0x01, 0x95, 0xc9, 0x88, 0x7d, 0x08, 
-0x1a, 0xd3, 0x1a, 0x1c, 0xc3, 0x1d, 0x19, 0x33, 0x1a, 0x72, 0x07, 0x9a, 
-0x92, 0x89, 0xc0, 0x46, 0x1a, 0x73, 0x07, 0x9a, 0x12, 0x89, 0xc0, 0x46, 
-0x02, 0x86, 0x04, 0x87, 0x82, 0x8a, 0x01, 0x3a, 0x82, 0x83, 0x01, 0x22, 
-0x19, 0x71, 0x08, 0x9b, 0x1b, 0x68, 0x5b, 0x18, 0x5b, 0x78, 0x9b, 0x00, 
-0x1b, 0x04, 0x1b, 0x0c, 0x08, 0x33, 0x59, 0x18, 0xbb, 0x08, 0x47, 0xd3, 
-0x07, 0x9b, 0x5b, 0x89, 0x85, 0x18, 0x06, 0x95, 0x20, 0x35, 0x2b, 0x72, 
-0x07, 0x9b, 0x9b, 0x89, 0xc0, 0x46, 0x2b, 0x73, 0x07, 0x9b, 0x1b, 0x89, 
-0x2e, 0x1c, 0x55, 0x00, 0x2d, 0x18, 0x05, 0x95, 0x2b, 0x86, 0x00, 0x2a, 
-0x01, 0xd0, 0xc3, 0x8a, 0x00, 0xe0, 0x83, 0x8a, 0x01, 0x3b, 0x05, 0x9d, 
-0xc0, 0x46, 0xab, 0x83, 0x31, 0x71, 0x65, 0x4b, 0x9d, 0x6a, 0x05, 0x9b, 
+0x18, 0xd0, 0x95, 0x49, 0x89, 0x6a, 0x1c, 0x1c, 0x58, 0x23, 0x63, 0x43, 
+0xc9, 0x18, 0x01, 0x23, 0x9b, 0x07, 0x58, 0x39, 0x19, 0x43, 0x09, 0x68, 
+0x09, 0x04, 0x09, 0x0c, 0x02, 0x29, 0x01, 0xd1, 0x0f, 0x43, 0x07, 0xe0, 
+0xc1, 0x8a, 0x00, 0x29, 0x02, 0xd0, 0x03, 0x23, 0x1f, 0x43, 0x01, 0xe0, 
+0x01, 0x23, 0x1f, 0x43, 0xc1, 0x1d, 0x39, 0x31, 0x07, 0x91, 0x4b, 0x89, 
+0x0c, 0x89, 0x1c, 0x19, 0x24, 0x04, 0x24, 0x0c, 0x08, 0x9d, 0x2d, 0x68, 
+0xc0, 0x46, 0x01, 0x95, 0xc9, 0x88, 0x7d, 0x08, 0x1a, 0xd3, 0x1a, 0x1c, 
+0xc3, 0x1d, 0x19, 0x33, 0x1a, 0x72, 0x07, 0x9a, 0x92, 0x89, 0xc0, 0x46, 
+0x1a, 0x73, 0x07, 0x9a, 0x12, 0x89, 0xc0, 0x46, 0x02, 0x86, 0x04, 0x87, 
+0x82, 0x8a, 0x01, 0x3a, 0x82, 0x83, 0x01, 0x22, 0x19, 0x71, 0x08, 0x9b, 
+0x1b, 0x68, 0x5b, 0x18, 0x5b, 0x78, 0x9b, 0x00, 0x1b, 0x04, 0x1b, 0x0c, 
+0x08, 0x33, 0x59, 0x18, 0xbb, 0x08, 0x47, 0xd3, 0x07, 0x9b, 0x5b, 0x89, 
+0x85, 0x18, 0x06, 0x95, 0x20, 0x35, 0x2b, 0x72, 0x07, 0x9b, 0x9b, 0x89, 
+0xc0, 0x46, 0x2b, 0x73, 0x07, 0x9b, 0x1b, 0x89, 0x2e, 0x1c, 0x55, 0x00, 
+0x2d, 0x18, 0x05, 0x95, 0x2b, 0x86, 0x00, 0x2a, 0x01, 0xd0, 0xc3, 0x8a, 
+0x00, 0xe0, 0x83, 0x8a, 0x01, 0x3b, 0x05, 0x9d, 0xc0, 0x46, 0xab, 0x83, 
+0x31, 0x71, 0x65, 0x4b, 0x9d, 0x6a, 0x05, 0x9b, 0x9e, 0x8b, 0x58, 0x23, 
+0x73, 0x43, 0xeb, 0x18, 0xdd, 0x1d, 0x01, 0x35, 0x01, 0x23, 0x9b, 0x07, 
+0x2b, 0x43, 0x1d, 0x68, 0x2b, 0x0e, 0x5b, 0x06, 0x01, 0xd1, 0x08, 0x31, 
+0x00, 0xe0, 0x10, 0x31, 0x81, 0x23, 0x5b, 0x02, 0x1d, 0x40, 0x9d, 0x42, 
+0x03, 0xd1, 0xe3, 0x1f, 0x05, 0x3b, 0x1c, 0x04, 0x24, 0x0c, 0x05, 0x9b, 
+0xc0, 0x46, 0x1c, 0x87, 0x08, 0x9b, 0x1b, 0x68, 0x1b, 0x19, 0x10, 0x3b, 
+0x9b, 0x7b, 0x06, 0x9d, 0x40, 0x35, 0x2b, 0x70, 0x2b, 0x78, 0x02, 0x33, 
+0xe3, 0x1a, 0x1c, 0x04, 0x24, 0x0c, 0x01, 0x32, 0xbb, 0x08, 0x9b, 0x07, 
+0x6d, 0xd0, 0x83, 0x18, 0x20, 0x33, 0x04, 0x93, 0x19, 0x72, 0x01, 0x9b, 
+0x5d, 0x18, 0x01, 0x23, 0x9b, 0x07, 0x2b, 0x43, 0x1b, 0x68, 0x1b, 0x07, 
+0x1b, 0x0f, 0x9b, 0x00, 0x04, 0x9e, 0xc0, 0x46, 0x33, 0x73, 0x00, 0x95, 
+0x2b, 0x78, 0x1b, 0x07, 0x1b, 0x0f, 0x9b, 0x00, 0x04, 0x9d, 0xc0, 0x46, 
+0x2b, 0x73, 0x00, 0x9d, 0xeb, 0x78, 0xad, 0x78, 0x1b, 0x02, 0x1d, 0x43, 
+0x2b, 0x02, 0x2d, 0x0a, 0x2d, 0x06, 0x2d, 0x0e, 0x2b, 0x43, 0x55, 0x00, 
+0x2d, 0x18, 0x2b, 0x86, 0x04, 0x9b, 0xc0, 0x46, 0x59, 0x72, 0x04, 0x9b, 
+0x1b, 0x7b, 0x2e, 0x1c, 0x04, 0x9d, 0xc0, 0x46, 0x6b, 0x73, 0x33, 0x8e, 
+0xc0, 0x46, 0x73, 0x86, 0x00, 0x9d, 0x2b, 0x78, 0x1b, 0x07, 0x1b, 0x0f, 
+0x9b, 0x00, 0x1b, 0x04, 0x1b, 0x0c, 0x59, 0x18, 0x04, 0x25, 0x3d, 0x40, 
+0x0e, 0xd0, 0x34, 0x87, 0x03, 0x8b, 0x01, 0x3b, 0xb3, 0x83, 0x13, 0x1c, 
+0x1b, 0x18, 0x20, 0x33, 0x19, 0x71, 0x01, 0x9b, 0x5b, 0x18, 0x5b, 0x78, 
+0x9b, 0x00, 0x59, 0x18, 0x08, 0x31, 0x01, 0x32, 0x3b, 0x09, 0x37, 0xd3, 
+0x00, 0x2d, 0x01, 0xd0, 0x43, 0x8b, 0x00, 0xe0, 0x03, 0x8b, 0x55, 0x00, 
+0x2d, 0x18, 0x01, 0x3b, 0xab, 0x83, 0x83, 0x18, 0x03, 0x93, 0x20, 0x33, 
+0x19, 0x71, 0x20, 0x4b, 0x9d, 0x6a, 0x53, 0x00, 0x1b, 0x18, 0x02, 0x93, 
 0x9e, 0x8b, 0x58, 0x23, 0x73, 0x43, 0xeb, 0x18, 0xdd, 0x1d, 0x01, 0x35, 
-0x01, 0x23, 0x9b, 0x07, 0x2b, 0x43, 0x1d, 0x68, 0x2b, 0x0e, 0x5b, 0x06, 
-0x01, 0xd1, 0x08, 0x31, 0x00, 0xe0, 0x10, 0x31, 0x81, 0x23, 0x5b, 0x02, 
-0x1d, 0x40, 0x9d, 0x42, 0x03, 0xd1, 0xe3, 0x1f, 0x05, 0x3b, 0x1c, 0x04, 
-0x24, 0x0c, 0x05, 0x9b, 0xc0, 0x46, 0x1c, 0x87, 0x08, 0x9b, 0x1b, 0x68, 
-0x1b, 0x19, 0x10, 0x3b, 0x9b, 0x7b, 0x06, 0x9d, 0x40, 0x35, 0x2b, 0x70, 
-0x2b, 0x78, 0x02, 0x33, 0xe3, 0x1a, 0x1c, 0x04, 0x24, 0x0c, 0x01, 0x32, 
-0xbb, 0x08, 0x9b, 0x07, 0x6d, 0xd0, 0x83, 0x18, 0x20, 0x33, 0x04, 0x93, 
-0x19, 0x72, 0x01, 0x9b, 0x5d, 0x18, 0x01, 0x23, 0x9b, 0x07, 0x2b, 0x43, 
-0x1b, 0x68, 0x1b, 0x07, 0x1b, 0x0f, 0x9b, 0x00, 0x04, 0x9e, 0xc0, 0x46, 
-0x33, 0x73, 0x00, 0x95, 0x2b, 0x78, 0x1b, 0x07, 0x1b, 0x0f, 0x9b, 0x00, 
-0x04, 0x9d, 0xc0, 0x46, 0x2b, 0x73, 0x00, 0x9d, 0xeb, 0x78, 0xad, 0x78, 
-0x1b, 0x02, 0x1d, 0x43, 0x2b, 0x02, 0x2d, 0x0a, 0x2d, 0x06, 0x2d, 0x0e, 
-0x2b, 0x43, 0x55, 0x00, 0x2d, 0x18, 0x2b, 0x86, 0x04, 0x9b, 0xc0, 0x46, 
-0x59, 0x72, 0x04, 0x9b, 0x1b, 0x7b, 0x2e, 0x1c, 0x04, 0x9d, 0xc0, 0x46, 
-0x6b, 0x73, 0x33, 0x8e, 0xc0, 0x46, 0x73, 0x86, 0x00, 0x9d, 0x2b, 0x78, 
-0x1b, 0x07, 0x1b, 0x0f, 0x9b, 0x00, 0x1b, 0x04, 0x1b, 0x0c, 0x59, 0x18, 
-0x04, 0x25, 0x3d, 0x40, 0x0e, 0xd0, 0x34, 0x87, 0x03, 0x8b, 0x01, 0x3b, 
-0xb3, 0x83, 0x13, 0x1c, 0x1b, 0x18, 0x20, 0x33, 0x19, 0x71, 0x01, 0x9b, 
-0x5b, 0x18, 0x5b, 0x78, 0x9b, 0x00, 0x59, 0x18, 0x08, 0x31, 0x01, 0x32, 
-0x3b, 0x09, 0x37, 0xd3, 0x00, 0x2d, 0x01, 0xd0, 0x43, 0x8b, 0x00, 0xe0, 
-0x03, 0x8b, 0x55, 0x00, 0x2d, 0x18, 0x01, 0x3b, 0xab, 0x83, 0x83, 0x18, 
-0x03, 0x93, 0x20, 0x33, 0x19, 0x71, 0x20, 0x4b, 0x9d, 0x6a, 0x53, 0x00, 
-0x1b, 0x18, 0x02, 0x93, 0x9e, 0x8b, 0x58, 0x23, 0x73, 0x43, 0xeb, 0x18, 
-0xdd, 0x1d, 0x01, 0x35, 0x01, 0x23, 0x9b, 0x07, 0x2b, 0x43, 0x1d, 0x68, 
+0x01, 0x23, 0x9b, 0x07, 0x2b, 0x43, 0x1d, 0x68, 
 0x2b, 0x0e, 0x5b, 0x06, 0x02, 0xd1, 0x08, 0x31, 0x01, 0xe0, 0x15, 0xe0, 
-0x10, 0x31, 0x81, 0x23, 0x5b, 0x02, 0x1d, 0x40, 
-0x9d, 0x42, 0x03, 0xd1, 0xe3, 0x1f, 0x05, 0x3b, 0x1c, 0x04, 0x24, 0x0c, 
-0x02, 0x9b, 0xc0, 0x46, 0x1c, 0x87, 0x08, 0x9b, 0x1b, 0x68, 0x1b, 0x19, 
-0x10, 0x3b, 0x9b, 0x7b, 0x03, 0x9c, 0x40, 0x34, 0x23, 0x70, 0x01, 0x32, 
-0x07, 0x9b, 0xc0, 0x46, 0xd9, 0x80, 0x51, 0x1e, 0xc3, 0x1d, 0x49, 0x33, 
-0x19, 0x70, 0x07, 0x61, 0x04, 0x2a, 0x06, 0xd2, 0x06, 0x49, 0x53, 0x00, 
-0x1b, 0x18, 0x99, 0x83, 0x01, 0x32, 0x04, 0x2a, 0xf9, 0xd3, 0x09, 0xb0, 
-0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x4c, 0x2a, 0x00, 0x80, 
-0xff, 0xff, 0x00, 0x00, 0x70, 0x47, 0x80, 0xb5, 0x8c, 0xb0, 0x07, 0x1c, 
-0x12, 0x48, 0x01, 0x68, 0x01, 0x31, 0x01, 0x60, 0x38, 0x68, 0xc0, 0x46, 
-0x00, 0x90, 0x78, 0x68, 0xc0, 0x46, 0x01, 0x90, 0xb8, 0x68, 0xc0, 0x46, 
-0x02, 0x90, 0x0d, 0x48, 0x41, 0x68, 0xc9, 0x68, 0xc0, 0x46, 0x41, 0x60, 
-0x38, 0x1c, 0x00, 0xf0, 0x4f, 0xf8, 0xb8, 0x68, 0x40, 0x09, 0x06, 0xd3, 
-0x10, 0x23, 0x02, 0x98, 0x18, 0x43, 0x02, 0x90, 0x68, 0x46, 0x02, 0xf0, 
-0xe1, 0xff, 0x68, 0x46, 0x02, 0xf0, 0x9a, 0xfe, 0x0c, 0xb0, 0x80, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x0c, 0x2b, 0x00, 0x80, 0x6c, 0x06, 0x00, 0x80, 
-0x00, 0xb5, 0x8c, 0xb0, 0x01, 0x68, 0xc0, 0x46, 0x00, 0x91, 0x41, 0x68, 
-0x05, 0x4b, 0x19, 0x43, 0x01, 0x91, 0x00, 0xf0, 0x2f, 0xf8, 0x68, 0x46, 
-0x02, 0xf0, 0x84, 0xfe, 0x0c, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0xa0, 0x02, 0x6a, 0x03, 0x68, 0xc0, 0x46, 0x13, 0x60, 
-0x40, 0x68, 0xc0, 0x46, 0x50, 0x60, 0x40, 0x32, 0x48, 0x68, 0xc0, 0x46, 
-0x90, 0x80, 0xc8, 0x68, 0xc0, 0x46, 0xd0, 0x80, 0x48, 0x69, 0xc0, 0x46, 
-0x10, 0x81, 0x88, 0x68, 0xc0, 0x46, 0x50, 0x81, 0x08, 0x7e, 0xc0, 0x46, 
-0x90, 0x73, 0x08, 0x69, 0xc0, 0x46, 0x90, 0x81, 0x70, 0x47, 0x04, 0x49, 
-0x08, 0x68, 0x00, 0x28, 0x00, 0xd1, 0x70, 0x47, 0xc2, 0x68, 0xc0, 0x46, 
-0x0a, 0x60, 0xfa, 0xe7, 0x6c, 0x06, 0x00, 0x80, 0x02, 0x49, 0x0a, 0x68, 
-0xc0, 0x46, 0xc2, 0x60, 0x08, 0x60, 0x70, 0x47, 0x6c, 0x06, 0x00, 0x80, 
-0xb0, 0xb4, 0x00, 0x22, 0x12, 0x4f, 0x7c, 0x7f, 0x01, 0x34, 0x7c, 0x77, 
-0x03, 0x23, 0xfc, 0x1d, 0x19, 0x34, 0x38, 0x62, 0x79, 0x62, 0x23, 0x72, 
-0x0e, 0x4c, 0x25, 0x68, 0x6b, 0x0c, 0x05, 0xd2, 0x23, 0x68, 0x1b, 0x0c, 
-0x10, 0xd1, 0x24, 0x68, 0xa3, 0x0a, 0x0d, 0xd3, 0x01, 0x23, 0x0a, 0x4f, 
-0xc0, 0x46, 0xfb, 0x62, 0x09, 0x4f, 0x0a, 0x4b, 0xc0, 0x46, 0xdf, 0x60, 
-0x99, 0x60, 0x58, 0x60, 0x10, 0x1c, 0x18, 0x60, 0x01, 0x32, 0xfb, 0xe7, 
-0x10, 0x1c, 0x38, 0x64, 0x01, 0x32, 0xfb, 0xe7, 0x00, 0x00, 0x00, 0x80, 
-0x00, 0x00, 0x10, 0x40, 0xc0, 0x00, 0x18, 0x00, 0x02, 0x81, 0x00, 0x00, 
-0x40, 0x01, 0x18, 0x00, 0xf0, 0xb5, 0x47, 0x4f, 0x38, 0x68, 0x47, 0x4e, 
-0x47, 0x4d, 0x07, 0x23, 0x5b, 0x02, 0xec, 0x18, 0x00, 0x28, 0x1d, 0xd1, 
-0x20, 0x6b, 0x01, 0x30, 0x20, 0x63, 0x44, 0x49, 0xc0, 0x46, 0x08, 0x60, 
-0x43, 0x48, 0x41, 0x69, 0x00, 0x29, 0x13, 0xd0, 0xc1, 0x1d, 0x69, 0x31, 
-0x09, 0x7b, 0x00, 0x29, 0x0e, 0xd0, 0x01, 0x23, 0x9b, 0x07, 0x01, 0x6d, 
-0x19, 0x43, 0x09, 0x68, 0xc0, 0x46, 0x81, 0x61, 0xc2, 0x69, 0x91, 0x42, 
-0x04, 0xd0, 0xf1, 0x6c, 0x01, 0x31, 0xf1, 0x64, 0x01, 0xf0, 0x50, 0xfe, 
+0x10, 0x31, 0x81, 0x23, 0x5b, 0x02, 0x1d, 0x40, 0x9d, 0x42, 0x03, 0xd1, 
+0xe3, 0x1f, 0x05, 0x3b, 0x1c, 0x04, 0x24, 0x0c, 0x02, 0x9b, 0xc0, 0x46, 
+0x1c, 0x87, 0x08, 0x9b, 0x1b, 0x68, 0x1b, 0x19, 0x10, 0x3b, 0x9b, 0x7b, 
+0x03, 0x9c, 0x40, 0x34, 0x23, 0x70, 0x01, 0x32, 0x07, 0x9b, 0xc0, 0x46, 
+0xd9, 0x80, 0x51, 0x1e, 0xc3, 0x1d, 0x49, 0x33, 0x19, 0x70, 0x07, 0x61, 
+0x04, 0x2a, 0x06, 0xd2, 0x06, 0x49, 0x53, 0x00, 0x1b, 0x18, 0x99, 0x83, 
+0x01, 0x32, 0x04, 0x2a, 0xf9, 0xd3, 0x09, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0x00, 0x4c, 0x2a, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 
+0x70, 0x47, 0x80, 0xb5, 0x8c, 0xb0, 0x07, 0x1c, 0x12, 0x48, 0x01, 0x68, 
+0x01, 0x31, 0x01, 0x60, 0x38, 0x68, 0xc0, 0x46, 0x00, 0x90, 0x78, 0x68, 
+0xc0, 0x46, 0x01, 0x90, 0xb8, 0x68, 0xc0, 0x46, 0x02, 0x90, 0x0d, 0x48, 
+0x41, 0x68, 0xc9, 0x68, 0xc0, 0x46, 0x41, 0x60, 0x38, 0x1c, 0x00, 0xf0, 
+0x4f, 0xf8, 0xb8, 0x68, 0x40, 0x09, 0x06, 0xd3, 0x10, 0x23, 0x02, 0x98, 
+0x18, 0x43, 0x02, 0x90, 0x68, 0x46, 0x02, 0xf0, 0xe1, 0xff, 0x68, 0x46, 
+0x02, 0xf0, 0x9a, 0xfe, 0x0c, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x0c, 0x2b, 0x00, 0x80, 0x6c, 0x06, 0x00, 0x80, 0x00, 0xb5, 0x8c, 0xb0, 
+0x01, 0x68, 0xc0, 0x46, 0x00, 0x91, 0x41, 0x68, 0x05, 0x4b, 0x19, 0x43, 
+0x01, 0x91, 0x00, 0xf0, 0x2f, 0xf8, 0x68, 0x46, 0x02, 0xf0, 0x84, 0xfe, 
+0x0c, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 
+0x02, 0x6a, 0x03, 0x68, 0xc0, 0x46, 0x13, 0x60, 0x40, 0x68, 0xc0, 0x46, 
+0x50, 0x60, 0x40, 0x32, 0x48, 0x68, 0xc0, 0x46, 0x90, 0x80, 0xc8, 0x68, 
+0xc0, 0x46, 0xd0, 0x80, 0x48, 0x69, 0xc0, 0x46, 0x10, 0x81, 0x88, 0x68, 
+0xc0, 0x46, 0x50, 0x81, 0x08, 0x7e, 0xc0, 0x46, 0x90, 0x73, 0x08, 0x69, 
+0xc0, 0x46, 0x90, 0x81, 0x70, 0x47, 0x04, 0x49, 0x08, 0x68, 0x00, 0x28, 
+0x00, 0xd1, 0x70, 0x47, 0xc2, 0x68, 0xc0, 0x46, 0x0a, 0x60, 0xfa, 0xe7, 
+0x6c, 0x06, 0x00, 0x80, 0x02, 0x49, 0x0a, 0x68, 0xc0, 0x46, 0xc2, 0x60, 
+0x08, 0x60, 0x70, 0x47, 0x6c, 0x06, 0x00, 0x80, 0xb0, 0xb4, 0x00, 0x22, 
+0x12, 0x4f, 0x7c, 0x7f, 0x01, 0x34, 0x7c, 0x77, 0x03, 0x23, 0xfc, 0x1d, 
+0x19, 0x34, 0x38, 0x62, 0x79, 0x62, 0x23, 0x72, 0x0e, 0x4c, 0x25, 0x68, 
+0x6b, 0x0c, 0x05, 0xd2, 0x23, 0x68, 0x1b, 0x0c, 0x10, 0xd1, 0x24, 0x68, 
+0xa3, 0x0a, 0x0d, 0xd3, 0x01, 0x23, 0x0a, 0x4f, 0xc0, 0x46, 0xfb, 0x62, 
+0x09, 0x4f, 0x0a, 0x4b, 0xc0, 0x46, 0xdf, 0x60, 0x99, 0x60, 0x58, 0x60, 
+0x10, 0x1c, 0x18, 0x60, 0x01, 0x32, 0xfb, 0xe7, 0x10, 0x1c, 0x38, 0x64, 
+0x01, 0x32, 0xfb, 0xe7, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x10, 0x40, 
+0xc0, 0x00, 0x18, 0x00, 0x02, 0x81, 0x00, 0x00, 0x40, 0x01, 0x18, 0x00, 
+0xf0, 0xb5, 0x47, 0x4f, 0x38, 0x68, 0x47, 0x4e, 0x47, 0x4d, 0x07, 0x23, 
+0x5b, 0x02, 0xec, 0x18, 0x00, 0x28, 0x1d, 0xd1, 0x20, 0x6b, 0x01, 0x30, 
+0x20, 0x63, 0x44, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x43, 0x48, 0x41, 0x69, 
+0x00, 0x29, 0x13, 0xd0, 0xc1, 0x1d, 0x69, 0x31, 0x09, 0x7b, 0x00, 0x29, 
+0x0e, 0xd0, 0x01, 0x23, 0x9b, 0x07, 0x01, 0x6d, 0x19, 0x43, 0x09, 0x68, 
+0xc0, 0x46, 0x81, 0x61, 0xc2, 0x69, 0x91, 0x42, 0x04, 0xd0, 0xf1, 0x6c, 
+0x01, 0x31, 0xf1, 0x64, 0x01, 0xf0, 0x50, 0xfe, 
 0x38, 0x68, 0x01, 0x28, 0x17, 0xd1, 0x37, 0x48, 0x41, 0x69, 0x00, 0x29, 
-0x13, 0xd0, 0xc1, 0x1d, 0x69, 0x31, 0x09, 0x7b, 
-0x00, 0x29, 0x0e, 0xd0, 0x01, 0x23, 0x9b, 0x07, 0x01, 0x6d, 0x19, 0x43, 
-0x09, 0x68, 0xc0, 0x46, 0x81, 0x61, 0xc2, 0x69, 0x91, 0x42, 0x04, 0xd0, 
-0xf1, 0x6c, 0x01, 0x31, 0xf1, 0x64, 0x01, 0xf0, 0x35, 0xfe, 0x38, 0x68, 
-0x02, 0x28, 0x2f, 0xd1, 0xbb, 0x23, 0x1b, 0x01, 0xee, 0x18, 0x70, 0x7b, 
-0x00, 0x28, 0x03, 0xd0, 0x00, 0x20, 0x70, 0x73, 0x00, 0xf0, 0x4a, 0xfd, 
-0x30, 0x7b, 0x00, 0x28, 0x02, 0xd0, 0x78, 0x68, 0x02, 0xf0, 0xaa, 0xff, 
-0x1b, 0x23, 0xdb, 0x01, 0xe8, 0x18, 0xc0, 0x8b, 0x04, 0x26, 0x06, 0x40, 
-0xe0, 0x6a, 0xb0, 0x42, 0x14, 0xd0, 0xf8, 0x68, 0x01, 0x30, 0xf8, 0x60, 
-0x19, 0x28, 0x11, 0xd3, 0x1b, 0x48, 0x01, 0x7b, 0x00, 0x29, 0x0d, 0xd1, 
-0xff, 0x30, 0x41, 0x30, 0x40, 0x78, 0x00, 0x28, 0x08, 0xd1, 0xb8, 0x68, 
-0x02, 0xf0, 0x90, 0xff, 0x00, 0x20, 0xf8, 0x60, 0xe6, 0x62, 0x01, 0xe0, 
-0x00, 0x20, 0xf8, 0x60, 0x38, 0x68, 0x03, 0x28, 0x0b, 0xd1, 0xec, 0x1d, 
-0x79, 0x34, 0xe0, 0x6b, 0x80, 0x08, 0x02, 0xd3, 0x02, 0x20, 0x02, 0xf0, 
-0x07, 0xfc, 0x02, 0x23, 0xe0, 0x6b, 0x98, 0x43, 0xe0, 0x63, 0x38, 0x68, 
-0x01, 0x30, 0x38, 0x60, 0x03, 0x28, 0x01, 0xd9, 0x00, 0x20, 0x38, 0x60, 
-0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x3c, 0x04, 0x00, 0x80, 
-0xa0, 0x82, 0x20, 0x40, 0x68, 0x0e, 0x00, 0x80, 0x40, 0x01, 0x18, 0x00, 
-0x64, 0x2d, 0x00, 0x80, 0xe4, 0x2c, 0x00, 0x80, 0x28, 0x05, 0x00, 0x80, 
-0xb0, 0xb4, 0x1d, 0x48, 0x84, 0x8a, 0x1d, 0x4a, 0x13, 0x8a, 0xc1, 0x1d, 
-0x09, 0x31, 0x01, 0x27, 0x9c, 0x42, 0x03, 0xd1, 0x43, 0x8a, 0x54, 0x8a, 
-0xa3, 0x42, 0x10, 0xd0, 0x0b, 0x78, 0x00, 0x2b, 0x0d, 0xd0, 0x4b, 0x78, 
-0x00, 0x2b, 0x0a, 0xd0, 0x44, 0x8b, 0x93, 0x8a, 0x9c, 0x42, 0x04, 0xdc, 
-0x13, 0x4b, 0xc0, 0x46, 0x5f, 0x60, 0x97, 0x82, 0x01, 0xe0, 0x01, 0x33, 
-0x93, 0x82, 0xc3, 0x8b, 0x5c, 0x1c, 0xc4, 0x83, 0x84, 0x8b, 0xa3, 0x42, 
-0x0e, 0xdb, 0x84, 0x8a, 0x05, 0x8b, 0x00, 0x23, 0xac, 0x42, 0x05, 0xda, 
-0x44, 0x8a, 0xc5, 0x8a, 0xac, 0x42, 0x01, 0xda, 0x4b, 0x70, 0x00, 0xe0, 
-0x4f, 0x70, 0x43, 0x82, 0x83, 0x82, 0xc3, 0x83, 0x41, 0x8a, 0xc0, 0x46, 
-0x51, 0x82, 0x80, 0x8a, 0xc0, 0x46, 0x10, 0x82, 0xb0, 0xbc, 0x70, 0x47, 
-0xe8, 0x0e, 0x00, 0x80, 0x3c, 0x04, 0x00, 0x80, 0x40, 0x01, 0x18, 0x00, 
-0xf7, 0xb5, 0x91, 0xb0, 0x6b, 0x46, 0x84, 0x1e, 0x12, 0x99, 0x14, 0x29, 
-0x1a, 0xd9, 0x00, 0x20, 0x81, 0x00, 0x67, 0x58, 0xc0, 0x46, 0x57, 0x50, 
-0x01, 0x30, 0x00, 0x06, 0x00, 0x0e, 0x10, 0x28, 0xf6, 0xd3, 0x00, 0x21, 
-0x05, 0x20, 0x87, 0x00, 0xd6, 0x59, 0x4f, 0x1c, 0x3d, 0x06, 0x2d, 0x0e, 
-0x0f, 0x1c, 0xbf, 0x00, 0xde, 0x51, 0x29, 0x1c, 0x01, 0x30, 0x00, 0x06, 
-0x00, 0x0e, 0x10, 0x28, 0xf1, 0xd3, 0x09, 0xe0, 0x00, 0x20, 0x81, 0x00, 
-0x63, 0x58, 0xc0, 0x46, 0x53, 0x50, 0x01, 0x30, 0x00, 0x06, 0x00, 0x0e, 
-0x06, 0x28, 0xf6, 0xd3, 0x00, 0x20, 0xe0, 0x70, 0x20, 0x72, 0x60, 0x72, 
-0xa0, 0x72, 0x20, 0x73, 0x60, 0x73, 0x12, 0x99, 0x14, 0x29, 0x37, 0xd9, 
-0x69, 0x46, 0x8e, 0x1c, 0x91, 0x78, 0x09, 0x07, 0x09, 0x0f, 0x89, 0x00, 
-0x14, 0x39, 0x0d, 0x06, 0x2d, 0x16, 0x00, 0x27, 0x00, 0x2d, 0x1b, 0xdd, 
-0xf0, 0x19, 0x10, 0xa9, 0x00, 0xf0, 0x3d, 0xf8, 0x00, 0x28, 0x0e, 0xd0, 
+0x13, 0xd0, 0xc1, 0x1d, 0x69, 0x31, 0x09, 0x7b, 0x00, 0x29, 0x0e, 0xd0, 
+0x01, 0x23, 0x9b, 0x07, 0x01, 0x6d, 0x19, 0x43, 0x09, 0x68, 0xc0, 0x46, 
+0x81, 0x61, 0xc2, 0x69, 0x91, 0x42, 0x04, 0xd0, 0xf1, 0x6c, 0x01, 0x31, 
+0xf1, 0x64, 0x01, 0xf0, 0x35, 0xfe, 0x38, 0x68, 0x02, 0x28, 0x2f, 0xd1, 
+0xbb, 0x23, 0x1b, 0x01, 0xee, 0x18, 0x70, 0x7b, 0x00, 0x28, 0x03, 0xd0, 
+0x00, 0x20, 0x70, 0x73, 0x00, 0xf0, 0x4a, 0xfd, 0x30, 0x7b, 0x00, 0x28, 
+0x02, 0xd0, 0x78, 0x68, 0x02, 0xf0, 0xaa, 0xff, 0x1b, 0x23, 0xdb, 0x01, 
+0xe8, 0x18, 0xc0, 0x8b, 0x04, 0x26, 0x06, 0x40, 0xe0, 0x6a, 0xb0, 0x42, 
+0x14, 0xd0, 0xf8, 0x68, 0x01, 0x30, 0xf8, 0x60, 0x19, 0x28, 0x11, 0xd3, 
+0x1b, 0x48, 0x01, 0x7b, 0x00, 0x29, 0x0d, 0xd1, 0xff, 0x30, 0x41, 0x30, 
+0x40, 0x78, 0x00, 0x28, 0x08, 0xd1, 0xb8, 0x68, 0x02, 0xf0, 0x90, 0xff, 
+0x00, 0x20, 0xf8, 0x60, 0xe6, 0x62, 0x01, 0xe0, 0x00, 0x20, 0xf8, 0x60, 
+0x38, 0x68, 0x03, 0x28, 0x0b, 0xd1, 0xec, 0x1d, 0x79, 0x34, 0xe0, 0x6b, 
+0x80, 0x08, 0x02, 0xd3, 0x02, 0x20, 0x02, 0xf0, 0x07, 0xfc, 0x02, 0x23, 
+0xe0, 0x6b, 0x98, 0x43, 0xe0, 0x63, 0x38, 0x68, 0x01, 0x30, 0x38, 0x60, 
+0x03, 0x28, 0x01, 0xd9, 0x00, 0x20, 0x38, 0x60, 0xf0, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0x00, 0x3c, 0x04, 0x00, 0x80, 0xa0, 0x82, 0x20, 0x40, 
+0x68, 0x0e, 0x00, 0x80, 0x40, 0x01, 0x18, 0x00, 0x64, 0x2d, 0x00, 0x80, 
+0xe4, 0x2c, 0x00, 0x80, 0x28, 0x05, 0x00, 0x80, 0xb0, 0xb4, 0x1d, 0x48, 
+0x84, 0x8a, 0x1d, 0x4a, 0x13, 0x8a, 0xc1, 0x1d, 0x09, 0x31, 0x01, 0x27, 
+0x9c, 0x42, 0x03, 0xd1, 0x43, 0x8a, 0x54, 0x8a, 0xa3, 0x42, 0x10, 0xd0, 
+0x0b, 0x78, 0x00, 0x2b, 0x0d, 0xd0, 0x4b, 0x78, 0x00, 0x2b, 0x0a, 0xd0, 
+0x44, 0x8b, 0x93, 0x8a, 0x9c, 0x42, 0x04, 0xdc, 0x13, 0x4b, 0xc0, 0x46, 
+0x5f, 0x60, 0x97, 0x82, 0x01, 0xe0, 0x01, 0x33, 0x93, 0x82, 0xc3, 0x8b, 
+0x5c, 0x1c, 0xc4, 0x83, 0x84, 0x8b, 0xa3, 0x42, 0x0e, 0xdb, 0x84, 0x8a, 
+0x05, 0x8b, 0x00, 0x23, 0xac, 0x42, 0x05, 0xda, 0x44, 0x8a, 0xc5, 0x8a, 
+0xac, 0x42, 0x01, 0xda, 0x4b, 0x70, 0x00, 0xe0, 0x4f, 0x70, 0x43, 0x82, 
+0x83, 0x82, 0xc3, 0x83, 0x41, 0x8a, 0xc0, 0x46, 0x51, 0x82, 0x80, 0x8a, 
+0xc0, 0x46, 0x10, 0x82, 0xb0, 0xbc, 0x70, 0x47, 0xe8, 0x0e, 0x00, 0x80, 
+0x3c, 0x04, 0x00, 0x80, 0x40, 0x01, 0x18, 0x00, 0xf7, 0xb5, 0x91, 0xb0, 
+0x6b, 0x46, 0x84, 0x1e, 0x12, 0x99, 0x14, 0x29, 0x1a, 0xd9, 0x00, 0x20, 
+0x81, 0x00, 0x67, 0x58, 0xc0, 0x46, 0x57, 0x50, 0x01, 0x30, 0x00, 0x06, 
+0x00, 0x0e, 0x10, 0x28, 0xf6, 0xd3, 0x00, 0x21, 0x05, 0x20, 0x87, 0x00, 
+0xd6, 0x59, 0x4f, 0x1c, 0x3d, 0x06, 0x2d, 0x0e, 0x0f, 0x1c, 0xbf, 0x00, 
+0xde, 0x51, 0x29, 0x1c, 0x01, 0x30, 0x00, 0x06, 0x00, 0x0e, 0x10, 0x28, 
+0xf1, 0xd3, 0x09, 0xe0, 0x00, 0x20, 0x81, 0x00, 0x63, 0x58, 0xc0, 0x46, 
+0x53, 0x50, 0x01, 0x30, 0x00, 0x06, 0x00, 0x0e, 0x06, 0x28, 0xf6, 0xd3, 
+0x00, 0x20, 0xe0, 0x70, 0x20, 0x72, 0x60, 0x72, 0xa0, 0x72, 0x20, 0x73, 
+0x60, 0x73, 0x12, 0x99, 0x14, 0x29, 0x37, 0xd9, 0x69, 0x46, 0x8e, 0x1c, 
+0x91, 0x78, 0x09, 0x07, 0x09, 0x0f, 0x89, 0x00, 0x14, 0x39, 0x0d, 0x06, 
+0x2d, 0x16, 0x00, 0x27, 0x00, 0x2d, 0x1b, 0xdd, 0xf0, 0x19, 0x10, 0xa9, 
+0x00, 0xf0, 0x3d, 0xf8, 0x00, 0x28, 0x0e, 0xd0, 
 0x00, 0x20, 0x10, 0xa9, 0x09, 0x78, 0x00, 0x29, 0x09, 0xdd, 0x00, 0x22, 
-0x39, 0x18, 0x72, 0x54, 0x01, 0x30, 0x00, 0x06, 
-0x00, 0x0e, 0x10, 0xa9, 0x09, 0x78, 0x88, 0x42, 0xf6, 0xdb, 0x10, 0xa8, 
-0x00, 0x78, 0x38, 0x18, 0x07, 0x06, 0x3f, 0x0e, 0xaf, 0x42, 0xe3, 0xdb, 
-0x68, 0x46, 0xe2, 0x1d, 0x0d, 0x32, 0x00, 0x21, 0xab, 0x08, 0x5f, 0x1c, 
-0x08, 0xd0, 0x8b, 0x00, 0xc4, 0x58, 0xc0, 0x46, 0xd4, 0x50, 0x01, 0x31, 
-0x09, 0x06, 0x09, 0x0e, 0x8f, 0x42, 0xf6, 0xd8, 0x14, 0xb0, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x90, 0xb4, 0x87, 0x1e, 0x00, 0x20, 0x89, 0x08, 
-0x4b, 0x1c, 0x08, 0xd0, 0x81, 0x00, 0x54, 0x58, 0xc0, 0x46, 0x7c, 0x50, 
-0x01, 0x30, 0x00, 0x06, 0x00, 0x0e, 0x83, 0x42, 0xf6, 0xd8, 0x90, 0xbc, 
-0x70, 0x47, 0x80, 0xb4, 0x02, 0x78, 0xd2, 0x06, 0xd2, 0x0e, 0x00, 0x23, 
-0x01, 0x27, 0x01, 0x2a, 0x01, 0xdc, 0x0f, 0x70, 0x11, 0xe0, 0x40, 0x78, 
-0xc0, 0x46, 0x08, 0x70, 0x14, 0x2a, 0x04, 0xd1, 0x08, 0x48, 0x01, 0x7a, 
-0x01, 0x31, 0x01, 0x72, 0x07, 0xe0, 0x02, 0x2a, 0x05, 0xd0, 0x05, 0x2a, 
-0x03, 0xd0, 0x06, 0x2a, 0x01, 0xd0, 0x15, 0x2a, 0x02, 0xd1, 0x18, 0x1c, 
-0x80, 0xbc, 0x70, 0x47, 0x38, 0x1c, 0xfb, 0xe7, 0xe0, 0x82, 0x20, 0x40, 
-0x00, 0xb5, 0x0f, 0x48, 0x01, 0x23, 0x1b, 0x06, 0x41, 0x69, 0x99, 0x43, 
-0x1a, 0x09, 0x41, 0x61, 0xd1, 0x60, 0x00, 0x21, 0xa1, 0x22, 0x52, 0x03, 
-0x91, 0x61, 0x19, 0x1c, 0x09, 0x4a, 0xc0, 0x46, 0x11, 0x60, 0x1b, 0x23, 
-0xdb, 0x01, 0xc0, 0x18, 0x80, 0x69, 0x00, 0x28, 0x03, 0xd0, 0x02, 0xf0, 
-0x61, 0xfe, 0x08, 0xbc, 0x18, 0x47, 0x04, 0x48, 0x41, 0x88, 0x01, 0x31, 
-0x41, 0x80, 0xf8, 0xe7, 0x68, 0x0e, 0x00, 0x80, 0x00, 0x00, 0x00, 0xb0, 
-0xe0, 0x82, 0x20, 0x40, 0x70, 0x47, 0x00, 0x00, 0xf0, 0xb5, 0x86, 0xb0, 
-0x95, 0x4a, 0xd0, 0x68, 0xd7, 0x1d, 0x79, 0x37, 0x01, 0x28, 0x09, 0xd1, 
-0x38, 0x89, 0x00, 0x28, 0x06, 0xd1, 0xd0, 0x6f, 0x02, 0x23, 0x01, 0x68, 
-0x99, 0x43, 0x01, 0x60, 0x14, 0x20, 0x38, 0x81, 0x8e, 0x4c, 0x61, 0x6a, 
-0x8e, 0x48, 0xc3, 0x6b, 0x59, 0x18, 0xc1, 0x63, 0xa0, 0x6a, 0x19, 0x23, 
-0xdb, 0x01, 0xd4, 0x18, 0xa0, 0x62, 0x21, 0x6a, 0x09, 0x03, 0x09, 0x0b, 
-0x81, 0x42, 0x05, 0xd1, 0x01, 0x20, 0x40, 0x04, 0x87, 0x49, 0xc0, 0x46, 
-0x08, 0x60, 0xf3, 0xe0, 0xbb, 0x8a, 0x58, 0x1c, 0xb8, 0x82, 0x3d, 0x8b, 
-0x01, 0x20, 0x00, 0x21, 0xab, 0x42, 0x04, 0xdb, 0xd3, 0x1d, 0x89, 0x33, 
-0x58, 0x70, 0xb9, 0x82, 0xf9, 0x83, 0x33, 0x23, 0x9b, 0x01, 0xd3, 0x18, 
-0x05, 0x93, 0x5b, 0x69, 0x0f, 0x2b, 0x73, 0xd2, 0x00, 0x21, 0x7c, 0x4f, 
-0xc0, 0x46, 0x39, 0x61, 0x21, 0x6a, 0x8a, 0x68, 0x12, 0x04, 0x12, 0x0c, 
-0x4b, 0x68, 0x1e, 0x0c, 0x36, 0x04, 0xfd, 0x1f, 0x09, 0x3d, 0x00, 0x2e, 
-0x05, 0xd1, 0x3b, 0x2a, 0x03, 0xd3, 0x01, 0x23, 0xdb, 0x02, 0x9a, 0x42, 
-0x01, 0xd9, 0xa8, 0x73, 0xc8, 0xe0, 0x01, 0x23, 0x9b, 0x07, 0x08, 0x31, 
-0x19, 0x43, 0x09, 0x68, 0xc0, 0x46, 0x03, 0x91, 0x03, 0xa9, 0x09, 0x88, 
-0x01, 0x31, 0x09, 0x04, 0x09, 0x0c, 0x79, 0x82, 0x49, 0x09, 0x05, 0x31, 
-0x09, 0x06, 0x09, 0x0e, 0x69, 0x4e, 0xc0, 0x46, 0x02, 0x96, 0x69, 0x48, 
-0x43, 0x6a, 0xc0, 0x46, 0x01, 0x93, 0x83, 0x6a, 0xc0, 0x46, 0x00, 0x93, 
-0xc2, 0x1d, 0x11, 0x32, 0x80, 0x69, 0x00, 0x03, 0x00, 0x0b, 0x92, 0x68, 
-0xb3, 0x07, 0x1a, 0x43, 0x12, 0x68, 0x90, 0x42, 0x01, 0xd1, 0x01, 0x20, 
+0x39, 0x18, 0x72, 0x54, 0x01, 0x30, 0x00, 0x06, 0x00, 0x0e, 0x10, 0xa9, 
+0x09, 0x78, 0x88, 0x42, 0xf6, 0xdb, 0x10, 0xa8, 0x00, 0x78, 0x38, 0x18, 
+0x07, 0x06, 0x3f, 0x0e, 0xaf, 0x42, 0xe3, 0xdb, 0x68, 0x46, 0xe2, 0x1d, 
+0x0d, 0x32, 0x00, 0x21, 0xab, 0x08, 0x5f, 0x1c, 0x08, 0xd0, 0x8b, 0x00, 
+0xc4, 0x58, 0xc0, 0x46, 0xd4, 0x50, 0x01, 0x31, 0x09, 0x06, 0x09, 0x0e, 
+0x8f, 0x42, 0xf6, 0xd8, 0x14, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x90, 0xb4, 0x87, 0x1e, 0x00, 0x20, 0x89, 0x08, 0x4b, 0x1c, 0x08, 0xd0, 
+0x81, 0x00, 0x54, 0x58, 0xc0, 0x46, 0x7c, 0x50, 0x01, 0x30, 0x00, 0x06, 
+0x00, 0x0e, 0x83, 0x42, 0xf6, 0xd8, 0x90, 0xbc, 0x70, 0x47, 0x80, 0xb4, 
+0x02, 0x78, 0xd2, 0x06, 0xd2, 0x0e, 0x00, 0x23, 0x01, 0x27, 0x01, 0x2a, 
+0x01, 0xdc, 0x0f, 0x70, 0x11, 0xe0, 0x40, 0x78, 0xc0, 0x46, 0x08, 0x70, 
+0x14, 0x2a, 0x04, 0xd1, 0x08, 0x48, 0x01, 0x7a, 0x01, 0x31, 0x01, 0x72, 
+0x07, 0xe0, 0x02, 0x2a, 0x05, 0xd0, 0x05, 0x2a, 0x03, 0xd0, 0x06, 0x2a, 
+0x01, 0xd0, 0x15, 0x2a, 0x02, 0xd1, 0x18, 0x1c, 0x80, 0xbc, 0x70, 0x47, 
+0x38, 0x1c, 0xfb, 0xe7, 0xe0, 0x82, 0x20, 0x40, 0x00, 0xb5, 0x0f, 0x48, 
+0x01, 0x23, 0x1b, 0x06, 0x41, 0x69, 0x99, 0x43, 0x1a, 0x09, 0x41, 0x61, 
+0xd1, 0x60, 0x00, 0x21, 0xa1, 0x22, 0x52, 0x03, 0x91, 0x61, 0x19, 0x1c, 
+0x09, 0x4a, 0xc0, 0x46, 0x11, 0x60, 0x1b, 0x23, 0xdb, 0x01, 0xc0, 0x18, 
+0x80, 0x69, 0x00, 0x28, 0x03, 0xd0, 0x02, 0xf0, 0x61, 0xfe, 0x08, 0xbc, 
+0x18, 0x47, 0x04, 0x48, 0x41, 0x88, 0x01, 0x31, 0x41, 0x80, 0xf8, 0xe7, 
+0x68, 0x0e, 0x00, 0x80, 0x00, 0x00, 0x00, 0xb0, 0xe0, 0x82, 0x20, 0x40, 
+0x70, 0x47, 0x00, 0x00, 0xf0, 0xb5, 0x86, 0xb0, 0x95, 0x4a, 0xd0, 0x68, 
+0xd7, 0x1d, 0x79, 0x37, 0x01, 0x28, 0x09, 0xd1, 0x38, 0x89, 0x00, 0x28, 
+0x06, 0xd1, 0xd0, 0x6f, 0x02, 0x23, 0x01, 0x68, 0x99, 0x43, 0x01, 0x60, 
+0x14, 0x20, 0x38, 0x81, 0x8e, 0x4c, 0x61, 0x6a, 0x8e, 0x48, 0xc3, 0x6b, 
+0x59, 0x18, 0xc1, 0x63, 0xa0, 0x6a, 0x19, 0x23, 0xdb, 0x01, 0xd4, 0x18, 
+0xa0, 0x62, 0x21, 0x6a, 0x09, 0x03, 0x09, 0x0b, 0x81, 0x42, 0x05, 0xd1, 
+0x01, 0x20, 0x40, 0x04, 0x87, 0x49, 0xc0, 0x46, 0x08, 0x60, 0xf3, 0xe0, 
+0xbb, 0x8a, 0x58, 0x1c, 0xb8, 0x82, 0x3d, 0x8b, 0x01, 0x20, 0x00, 0x21, 
+0xab, 0x42, 0x04, 0xdb, 0xd3, 0x1d, 0x89, 0x33, 0x58, 0x70, 0xb9, 0x82, 
+0xf9, 0x83, 0x33, 0x23, 0x9b, 0x01, 0xd3, 0x18, 0x05, 0x93, 0x5b, 0x69, 
+0x0f, 0x2b, 0x73, 0xd2, 0x00, 0x21, 0x7c, 0x4f, 0xc0, 0x46, 0x39, 0x61, 
+0x21, 0x6a, 0x8a, 0x68, 0x12, 0x04, 0x12, 0x0c, 0x4b, 0x68, 0x1e, 0x0c, 
+0x36, 0x04, 0xfd, 0x1f, 0x09, 0x3d, 0x00, 0x2e, 0x05, 0xd1, 0x3b, 0x2a, 
+0x03, 0xd3, 0x01, 0x23, 0xdb, 0x02, 0x9a, 0x42, 0x01, 0xd9, 0xa8, 0x73, 
+0xc8, 0xe0, 0x01, 0x23, 0x9b, 0x07, 0x08, 0x31, 0x19, 0x43, 0x09, 0x68, 
+0xc0, 0x46, 0x03, 0x91, 0x03, 0xa9, 0x09, 0x88, 0x01, 0x31, 0x09, 0x04, 
+0x09, 0x0c, 0x79, 0x82, 0x49, 0x09, 0x05, 0x31, 0x09, 0x06, 0x09, 0x0e, 
+0x69, 0x4e, 0xc0, 0x46, 0x02, 0x96, 0x69, 0x48, 0x43, 0x6a, 0xc0, 0x46, 
+0x01, 0x93, 0x83, 0x6a, 0xc0, 0x46, 0x00, 0x93, 0xc2, 0x1d, 0x11, 0x32, 
+0x80, 0x69, 0x00, 0x03, 0x00, 0x0b, 0x92, 0x68, 0xb3, 0x07, 0x1a, 0x43, 
+0x12, 0x68, 0x90, 0x42, 0x01, 0xd1, 0x01, 0x20, 
 0x0d, 0xe0, 0x90, 0x42, 0x05, 0xd9, 0x00, 0x9b, 0x18, 0x1a, 0x01, 0x9b, 
-0xd2, 0x1a, 0x82, 0x18, 0x00, 0xe0, 0x12, 0x1a, 
-0x01, 0x20, 0x09, 0x01, 0x91, 0x42, 0x00, 0xd3, 0x00, 0x20, 0x01, 0x28, 
-0x65, 0xd1, 0x51, 0x49, 0x20, 0x69, 0x00, 0x28, 0x62, 0xd0, 0x05, 0x99, 
-0x48, 0x69, 0x01, 0x30, 0x48, 0x61, 0x02, 0x20, 0x21, 0x6a, 0xc0, 0x46, 
-0x08, 0x60, 0x00, 0xf0, 0xa7, 0xfc, 0x78, 0x63, 0xbe, 0x60, 0x49, 0x49, 
-0x22, 0x6a, 0xa3, 0x6b, 0xd3, 0x18, 0x66, 0x6b, 0xb3, 0x42, 0x00, 0xd9, 
-0x22, 0x6b, 0xc0, 0x46, 0xba, 0x62, 0xba, 0x6a, 0x0c, 0x32, 0xfa, 0x62, 
-0x00, 0x22, 0xfa, 0x61, 0x03, 0xaa, 0x52, 0x88, 0xd2, 0x09, 0x03, 0xd3, 
-0x01, 0x22, 0x00, 0xe0, 0x7b, 0xe0, 0x00, 0xe0, 0x00, 0x22, 0x7a, 0x60, 
-0x7a, 0x68, 0xc0, 0x46, 0x02, 0x60, 0x78, 0x8a, 0x41, 0x4e, 0x60, 0x28, 
-0x04, 0xdc, 0xb0, 0x83, 0x78, 0x8a, 0xc0, 0x46, 0xf0, 0x83, 0x08, 0xe0, 
-0x60, 0x20, 0xb0, 0x83, 0x79, 0x8a, 0xf8, 0x6a, 0x42, 0x18, 0x63, 0x6b, 
-0x9a, 0x42, 0x03, 0xd8, 0xf1, 0x83, 0x00, 0x22, 0x3a, 0x63, 0x05, 0xe0, 
-0x21, 0x6b, 0xc0, 0x46, 0x39, 0x63, 0x61, 0x6b, 0x08, 0x1a, 0xf0, 0x83, 
-0x2d, 0x49, 0x78, 0x6b, 0x42, 0x68, 0xc0, 0x46, 0xba, 0x60, 0x82, 0x68, 
-0xc0, 0x46, 0xfa, 0x60, 0x02, 0x69, 0xc0, 0x46, 0x7a, 0x61, 0x40, 0x69, 
-0xc0, 0x46, 0xb8, 0x61, 0x2e, 0x4b, 0xc8, 0x18, 0x04, 0x90, 0x00, 0xf0, 
-0x37, 0xf9, 0x04, 0x98, 0x00, 0xf0, 0x88, 0xf8, 0x00, 0xf0, 0xf6, 0xfa, 
-0x78, 0x8a, 0xf1, 0x8b, 0x88, 0x42, 0x04, 0xd1, 0xf9, 0x6a, 0x08, 0x18, 
-0x04, 0xe0, 0x38, 0xe0, 0x32, 0xe0, 0x3a, 0x6b, 0x10, 0x18, 0x40, 0x1a, 
-0x81, 0x07, 0x02, 0xd0, 0x80, 0x08, 0x80, 0x00, 0x04, 0x30, 0x61, 0x6b, 
-0x09, 0x1a, 0xa2, 0x6b, 0x91, 0x42, 0x00, 0xd2, 0x20, 0x6b, 0xc0, 0x46, 
-0x20, 0x62, 0xe8, 0x7b, 0x00, 0x28, 0x08, 0xd0, 0x00, 0x22, 0xea, 0x73, 
-0x05, 0x99, 0x48, 0x69, 0x01, 0x38, 0x48, 0x61, 0x78, 0x6b, 0x00, 0xf0, 
-0x73, 0xfa, 0x18, 0x48, 0x80, 0x6a, 0x80, 0x06, 0x80, 0x0e, 0x01, 0x28, 
-0x0a, 0xd1, 0x20, 0x6a, 0x00, 0x03, 0x00, 0x0b, 0x0b, 0x4c, 0xa1, 0x6a, 
-0x88, 0x42, 0x03, 0xd0, 0x06, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x01, 0x20, 0x40, 0x04, 0x08, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x06, 0xe0, 
-0xe0, 0x68, 0x00, 0x28, 0x01, 0xd0, 0x00, 0xf0, 0xb5, 0xfa, 0x01, 0x20, 
-0xa8, 0x73, 0xed, 0xe7, 0x68, 0x0e, 0x00, 0x80, 0x00, 0x40, 0x14, 0x40, 
-0xa4, 0x2a, 0x00, 0x80, 0x00, 0x00, 0x00, 0xb0, 0x28, 0x1a, 0x00, 0x80, 
-0x55, 0x55, 0x55, 0x55, 0xa8, 0x03, 0x00, 0x80, 0x68, 0x1a, 0x00, 0x80, 
-0xc4, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x80, 0xb5, 0x07, 0x1c, 
-0x78, 0x6a, 0x40, 0x89, 0xff, 0x21, 0x01, 0x31, 0x01, 0x40, 0x10, 0x48, 
-0x02, 0xd1, 0x81, 0x6c, 0x01, 0x31, 0x81, 0x64, 0x79, 0x6a, 0x49, 0x89, 
-0x49, 0x0b, 0x02, 0xd2, 0x41, 0x6c, 0x01, 0x31, 0x41, 0x64, 0x0b, 0x48, 
-0x41, 0x6a, 0x01, 0x31, 0x41, 0x62, 0x78, 0x6a, 0x39, 0x6b, 0xc0, 0x46, 
-0x48, 0x62, 0x38, 0x6b, 0x00, 0xf0, 0xf8, 0xfb, 0x38, 0x1c, 0x00, 0xf0, 
-0xb3, 0xf8, 0x01, 0x20, 0x04, 0x49, 0xc0, 0x46, 0xc8, 0x73, 0x80, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0xa4, 0x2a, 0x00, 0x80, 0xa0, 0x82, 0x20, 0x40, 
-0x18, 0x1a, 0x00, 0x80, 0xf8, 0xb5, 0x07, 0x1c, 0x00, 0x22, 0xf9, 0x1d, 
-0x61, 0x31, 0x0d, 0x1c, 0x78, 0x6a, 0xc0, 0x46, 0x00, 0x90, 0x40, 0x89, 
+0xd2, 0x1a, 0x82, 0x18, 0x00, 0xe0, 0x12, 0x1a, 0x01, 0x20, 0x09, 0x01, 
+0x91, 0x42, 0x00, 0xd3, 0x00, 0x20, 0x01, 0x28, 0x65, 0xd1, 0x51, 0x49, 
+0x20, 0x69, 0x00, 0x28, 0x62, 0xd0, 0x05, 0x99, 0x48, 0x69, 0x01, 0x30, 
+0x48, 0x61, 0x02, 0x20, 0x21, 0x6a, 0xc0, 0x46, 0x08, 0x60, 0x00, 0xf0, 
+0xa7, 0xfc, 0x78, 0x63, 0xbe, 0x60, 0x49, 0x49, 0x22, 0x6a, 0xa3, 0x6b, 
+0xd3, 0x18, 0x66, 0x6b, 0xb3, 0x42, 0x00, 0xd9, 0x22, 0x6b, 0xc0, 0x46, 
+0xba, 0x62, 0xba, 0x6a, 0x0c, 0x32, 0xfa, 0x62, 0x00, 0x22, 0xfa, 0x61, 
+0x03, 0xaa, 0x52, 0x88, 0xd2, 0x09, 0x03, 0xd3, 0x01, 0x22, 0x00, 0xe0, 
+0x7b, 0xe0, 0x00, 0xe0, 0x00, 0x22, 0x7a, 0x60, 0x7a, 0x68, 0xc0, 0x46, 
+0x02, 0x60, 0x78, 0x8a, 0x41, 0x4e, 0x60, 0x28, 0x04, 0xdc, 0xb0, 0x83, 
+0x78, 0x8a, 0xc0, 0x46, 0xf0, 0x83, 0x08, 0xe0, 0x60, 0x20, 0xb0, 0x83, 
+0x79, 0x8a, 0xf8, 0x6a, 0x42, 0x18, 0x63, 0x6b, 0x9a, 0x42, 0x03, 0xd8, 
+0xf1, 0x83, 0x00, 0x22, 0x3a, 0x63, 0x05, 0xe0, 0x21, 0x6b, 0xc0, 0x46, 
+0x39, 0x63, 0x61, 0x6b, 0x08, 0x1a, 0xf0, 0x83, 0x2d, 0x49, 0x78, 0x6b, 
+0x42, 0x68, 0xc0, 0x46, 0xba, 0x60, 0x82, 0x68, 0xc0, 0x46, 0xfa, 0x60, 
+0x02, 0x69, 0xc0, 0x46, 0x7a, 0x61, 0x40, 0x69, 0xc0, 0x46, 0xb8, 0x61, 
+0x2e, 0x4b, 0xc8, 0x18, 0x04, 0x90, 0x00, 0xf0, 0x37, 0xf9, 0x04, 0x98, 
+0x00, 0xf0, 0x88, 0xf8, 0x00, 0xf0, 0xf6, 0xfa, 0x78, 0x8a, 0xf1, 0x8b, 
+0x88, 0x42, 0x04, 0xd1, 0xf9, 0x6a, 0x08, 0x18, 0x04, 0xe0, 0x38, 0xe0, 
+0x32, 0xe0, 0x3a, 0x6b, 0x10, 0x18, 0x40, 0x1a, 0x81, 0x07, 0x02, 0xd0, 
+0x80, 0x08, 0x80, 0x00, 0x04, 0x30, 0x61, 0x6b, 0x09, 0x1a, 0xa2, 0x6b, 
+0x91, 0x42, 0x00, 0xd2, 0x20, 0x6b, 0xc0, 0x46, 0x20, 0x62, 0xe8, 0x7b, 
+0x00, 0x28, 0x08, 0xd0, 0x00, 0x22, 0xea, 0x73, 0x05, 0x99, 0x48, 0x69, 
+0x01, 0x38, 0x48, 0x61, 0x78, 0x6b, 0x00, 0xf0, 0x73, 0xfa, 0x18, 0x48, 
+0x80, 0x6a, 0x80, 0x06, 0x80, 0x0e, 0x01, 0x28, 0x0a, 0xd1, 0x20, 0x6a, 
+0x00, 0x03, 0x00, 0x0b, 0x0b, 0x4c, 0xa1, 0x6a, 0x88, 0x42, 0x03, 0xd0, 
+0x06, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x01, 0x20, 0x40, 0x04, 
+0x08, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x06, 0xe0, 0xe0, 0x68, 0x00, 0x28, 
+0x01, 0xd0, 0x00, 0xf0, 0xb5, 0xfa, 0x01, 0x20, 0xa8, 0x73, 0xed, 0xe7, 
+0x68, 0x0e, 0x00, 0x80, 0x00, 0x40, 0x14, 0x40, 0xa4, 0x2a, 0x00, 0x80, 
+0x00, 0x00, 0x00, 0xb0, 0x28, 0x1a, 0x00, 0x80, 0x55, 0x55, 0x55, 0x55, 
+0xa8, 0x03, 0x00, 0x80, 0x68, 0x1a, 0x00, 0x80, 0xc4, 0x0b, 0x00, 0x00, 
+0x00, 0x00, 0x10, 0x40, 0x80, 0xb5, 0x07, 0x1c, 0x78, 0x6a, 0x40, 0x89, 
+0xff, 0x21, 0x01, 0x31, 0x01, 0x40, 0x10, 0x48, 0x02, 0xd1, 0x81, 0x6c, 
+0x01, 0x31, 0x81, 0x64, 0x79, 0x6a, 0x49, 0x89, 0x49, 0x0b, 0x02, 0xd2, 
+0x41, 0x6c, 0x01, 0x31, 0x41, 0x64, 0x0b, 0x48, 0x41, 0x6a, 0x01, 0x31, 
+0x41, 0x62, 0x78, 0x6a, 0x39, 0x6b, 0xc0, 0x46, 0x48, 0x62, 0x38, 0x6b, 
+0x00, 0xf0, 0xf8, 0xfb, 0x38, 0x1c, 0x00, 0xf0, 0xb3, 0xf8, 0x01, 0x20, 
+0x04, 0x49, 0xc0, 0x46, 0xc8, 0x73, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0xa4, 0x2a, 0x00, 0x80, 0xa0, 0x82, 0x20, 0x40, 0x18, 0x1a, 0x00, 0x80, 
+0xf8, 0xb5, 0x07, 0x1c, 0x00, 0x22, 0xf9, 0x1d, 0x61, 0x31, 0x0d, 0x1c, 
+0x78, 0x6a, 0xc0, 0x46, 0x00, 0x90, 0x40, 0x89, 
 0x03, 0x0c, 0x01, 0xd2, 0x40, 0x0a, 0x03, 0xd2, 0x38, 0x1c, 0xff, 0xf7, 
-0xc1, 0xff, 0x67, 0xe0, 0x35, 0x48, 0xc0, 0x6b, 
-0x00, 0x09, 0x1f, 0xd3, 0x08, 0x78, 0x40, 0x08, 0x1c, 0xd2, 0x00, 0x20, 
-0x43, 0x00, 0xcc, 0x5a, 0x31, 0x4e, 0x9e, 0x19, 0x33, 0x23, 0x9b, 0x01, 
-0xf3, 0x18, 0x1b, 0x88, 0x9c, 0x42, 0x0e, 0xd0, 0xb8, 0x69, 0x39, 0x6b, 
-0xc0, 0x46, 0x88, 0x61, 0xf8, 0x68, 0x39, 0x6b, 0xc0, 0x46, 0xc8, 0x60, 
-0x38, 0x1c, 0x00, 0xf0, 0x27, 0xf9, 0x38, 0x1c, 0x00, 0xf0, 0x74, 0xf8, 
-0x46, 0xe0, 0x01, 0x30, 0x03, 0x28, 0xe3, 0xdb, 0x02, 0x20, 0x43, 0x00, 
-0x5c, 0x18, 0xe4, 0x88, 0x22, 0x4e, 0x9e, 0x19, 0x33, 0x23, 0x9b, 0x01, 
-0xf3, 0x18, 0x1b, 0x88, 0x9c, 0x42, 0x03, 0xd1, 0x01, 0x23, 0x01, 0x38, 
-0xd8, 0x42, 0xf0, 0xdc, 0x01, 0x23, 0xd8, 0x42, 0xc4, 0xd0, 0x1b, 0x4e, 
-0x0b, 0x23, 0x1b, 0x02, 0xf0, 0x18, 0x40, 0x69, 0x00, 0x28, 0x24, 0xd0, 
-0x7d, 0x63, 0x00, 0x98, 0x40, 0x89, 0x00, 0x0c, 0x1f, 0xd2, 0x00, 0x24, 
-0x2d, 0x23, 0x9b, 0x01, 0xf0, 0x18, 0xc0, 0x6b, 0x35, 0x1c, 0x00, 0x28, 
-0x17, 0xd0, 0xfe, 0x1d, 0x2d, 0x36, 0xa2, 0x00, 0x52, 0x19, 0x2d, 0x23, 
-0x9b, 0x01, 0xd2, 0x18, 0xd2, 0x6b, 0x38, 0x1c, 0x31, 0x1c, 0x02, 0xf0, 
-0x7b, 0xfc, 0x01, 0x28, 0x0e, 0xd0, 0x01, 0x34, 0xa0, 0x00, 0x40, 0x19, 
-0x2d, 0x23, 0x9b, 0x01, 0xc0, 0x18, 0xc0, 0x6b, 0x00, 0x28, 0xea, 0xd1, 
-0x01, 0xe0, 0x01, 0x2a, 0x02, 0xd0, 0x38, 0x1c, 0x00, 0xf0, 0x08, 0xf8, 
-0xf8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0xe8, 0x1a, 0x00, 0x80, 
-0x68, 0x0e, 0x00, 0x80, 0x80, 0xb5, 0x07, 0x1c, 0xb8, 0x69, 0x39, 0x6b, 
-0xc0, 0x46, 0x88, 0x61, 0xf8, 0x68, 0x39, 0x6b, 0xc0, 0x46, 0xc8, 0x60, 
-0x78, 0x6a, 0x40, 0x89, 0x01, 0x0c, 0x0e, 0xd2, 0x40, 0x0a, 0x0c, 0xd3, 
-0x38, 0x68, 0x40, 0x08, 0x02, 0xd3, 0x38, 0x1c, 0x02, 0xf0, 0x0c, 0xfc, 
-0x38, 0x1c, 0x00, 0xf0, 0xbb, 0xf8, 0x38, 0x1c, 0x00, 0xf0, 0x08, 0xf8, 
-0x02, 0xe0, 0x38, 0x1c, 0xff, 0xf7, 0x30, 0xff, 0x01, 0x20, 0x80, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x01, 0x21, 0x00, 0x6b, 0x40, 0x6a, 0xc0, 0x46, 
-0x01, 0x60, 0x70, 0x47, 0xb0, 0xb4, 0xc1, 0x1d, 0x39, 0x31, 0x09, 0x8b, 
-0x89, 0x08, 0x09, 0x04, 0x09, 0x0c, 0x84, 0x6a, 0xc2, 0x1d, 0x61, 0x32, 
-0x00, 0x20, 0x00, 0x29, 0x0c, 0xdd, 0x87, 0x00, 0x3d, 0x19, 0x01, 0x23, 
-0x9b, 0x07, 0x2b, 0x43, 0x1b, 0x68, 0xc0, 0x46, 0xd3, 0x51, 0x01, 0x30, 
-0x00, 0x04, 0x00, 0x0c, 0x88, 0x42, 0xf2, 0xdb, 0xb0, 0xbc, 0x70, 0x47, 
-0xf0, 0xb5, 0xa0, 0xb0, 0x01, 0x23, 0x9b, 0x07, 0xc1, 0x1d, 0x21, 0x31, 
-0x19, 0x43, 0x09, 0x68, 0xc0, 0x46, 0x0b, 0x91, 0xc1, 0x1d, 0x53, 0x31, 
-0x19, 0x43, 0x1f, 0x91, 0x09, 0x68, 0x01, 0xaf, 0xfa, 0x1d, 0x39, 0x32, 
-0x1e, 0x92, 0x17, 0xab, 0x59, 0x80, 0x3a, 0x49, 0x01, 0x23, 0x9b, 0x07, 
-0x0a, 0x6a, 0x13, 0x43, 0xcc, 0x1d, 0x11, 0x34, 0x89, 0x69, 0x09, 0x03, 
-0x09, 0x0b, 0x22, 0x69, 0xe5, 0x68, 0xc0, 0x46, 0x1d, 0x95, 0xfc, 0x1d, 
-0x39, 0x34, 0x64, 0x8b, 0x64, 0x09, 0x05, 0x34, 0x24, 0x06, 0x24, 0x0e, 
-0x1c, 0x94, 0x56, 0x1a, 0x1b, 0x96, 0x1c, 0x9c, 0x2e, 0x4a, 0xc0, 0x46, 
-0x00, 0x92, 0x01, 0x26, 0x1d, 0x9d, 0x1a, 0x68, 0x91, 0x42, 0x01, 0xd1, 
-0x32, 0x1c, 0x0b, 0xe0, 0x91, 0x42, 0x03, 0xd9, 0x52, 0x1b, 0x1b, 0x9e, 
-0xb5, 0x18, 0x00, 0xe0, 0x55, 0x1a, 0x01, 0x22, 0x24, 0x01, 0xac, 0x42, 
+0xc1, 0xff, 0x67, 0xe0, 0x35, 0x48, 0xc0, 0x6b, 0x00, 0x09, 0x1f, 0xd3, 
+0x08, 0x78, 0x40, 0x08, 0x1c, 0xd2, 0x00, 0x20, 0x43, 0x00, 0xcc, 0x5a, 
+0x31, 0x4e, 0x9e, 0x19, 0x33, 0x23, 0x9b, 0x01, 0xf3, 0x18, 0x1b, 0x88, 
+0x9c, 0x42, 0x0e, 0xd0, 0xb8, 0x69, 0x39, 0x6b, 0xc0, 0x46, 0x88, 0x61, 
+0xf8, 0x68, 0x39, 0x6b, 0xc0, 0x46, 0xc8, 0x60, 0x38, 0x1c, 0x00, 0xf0, 
+0x27, 0xf9, 0x38, 0x1c, 0x00, 0xf0, 0x74, 0xf8, 0x46, 0xe0, 0x01, 0x30, 
+0x03, 0x28, 0xe3, 0xdb, 0x02, 0x20, 0x43, 0x00, 0x5c, 0x18, 0xe4, 0x88, 
+0x22, 0x4e, 0x9e, 0x19, 0x33, 0x23, 0x9b, 0x01, 0xf3, 0x18, 0x1b, 0x88, 
+0x9c, 0x42, 0x03, 0xd1, 0x01, 0x23, 0x01, 0x38, 0xd8, 0x42, 0xf0, 0xdc, 
+0x01, 0x23, 0xd8, 0x42, 0xc4, 0xd0, 0x1b, 0x4e, 0x0b, 0x23, 0x1b, 0x02, 
+0xf0, 0x18, 0x40, 0x69, 0x00, 0x28, 0x24, 0xd0, 0x7d, 0x63, 0x00, 0x98, 
+0x40, 0x89, 0x00, 0x0c, 0x1f, 0xd2, 0x00, 0x24, 0x2d, 0x23, 0x9b, 0x01, 
+0xf0, 0x18, 0xc0, 0x6b, 0x35, 0x1c, 0x00, 0x28, 0x17, 0xd0, 0xfe, 0x1d, 
+0x2d, 0x36, 0xa2, 0x00, 0x52, 0x19, 0x2d, 0x23, 0x9b, 0x01, 0xd2, 0x18, 
+0xd2, 0x6b, 0x38, 0x1c, 0x31, 0x1c, 0x02, 0xf0, 0x7b, 0xfc, 0x01, 0x28, 
+0x0e, 0xd0, 0x01, 0x34, 0xa0, 0x00, 0x40, 0x19, 0x2d, 0x23, 0x9b, 0x01, 
+0xc0, 0x18, 0xc0, 0x6b, 0x00, 0x28, 0xea, 0xd1, 0x01, 0xe0, 0x01, 0x2a, 
+0x02, 0xd0, 0x38, 0x1c, 0x00, 0xf0, 0x08, 0xf8, 0xf8, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0x00, 0xe8, 0x1a, 0x00, 0x80, 0x68, 0x0e, 0x00, 0x80, 
+0x80, 0xb5, 0x07, 0x1c, 0xb8, 0x69, 0x39, 0x6b, 0xc0, 0x46, 0x88, 0x61, 
+0xf8, 0x68, 0x39, 0x6b, 0xc0, 0x46, 0xc8, 0x60, 0x78, 0x6a, 0x40, 0x89, 
+0x01, 0x0c, 0x0e, 0xd2, 0x40, 0x0a, 0x0c, 0xd3, 0x38, 0x68, 0x40, 0x08, 
+0x02, 0xd3, 0x38, 0x1c, 0x02, 0xf0, 0x0c, 0xfc, 0x38, 0x1c, 0x00, 0xf0, 
+0xbb, 0xf8, 0x38, 0x1c, 0x00, 0xf0, 0x08, 0xf8, 0x02, 0xe0, 0x38, 0x1c, 
+0xff, 0xf7, 0x30, 0xff, 0x01, 0x20, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x01, 0x21, 0x00, 0x6b, 0x40, 0x6a, 0xc0, 0x46, 0x01, 0x60, 0x70, 0x47, 
+0xb0, 0xb4, 0xc1, 0x1d, 0x39, 0x31, 0x09, 0x8b, 0x89, 0x08, 0x09, 0x04, 
+0x09, 0x0c, 0x84, 0x6a, 0xc2, 0x1d, 0x61, 0x32, 0x00, 0x20, 0x00, 0x29, 
+0x0c, 0xdd, 0x87, 0x00, 0x3d, 0x19, 0x01, 0x23, 0x9b, 0x07, 0x2b, 0x43, 
+0x1b, 0x68, 0xc0, 0x46, 0xd3, 0x51, 0x01, 0x30, 0x00, 0x04, 0x00, 0x0c, 
+0x88, 0x42, 0xf2, 0xdb, 0xb0, 0xbc, 0x70, 0x47, 0xf0, 0xb5, 0xa0, 0xb0, 
+0x01, 0x23, 0x9b, 0x07, 0xc1, 0x1d, 0x21, 0x31, 0x19, 0x43, 0x09, 0x68, 
+0xc0, 0x46, 0x0b, 0x91, 0xc1, 0x1d, 0x53, 0x31, 0x19, 0x43, 0x1f, 0x91, 
+0x09, 0x68, 0x01, 0xaf, 0xfa, 0x1d, 0x39, 0x32, 0x1e, 0x92, 0x17, 0xab, 
+0x59, 0x80, 0x3a, 0x49, 0x01, 0x23, 0x9b, 0x07, 0x0a, 0x6a, 0x13, 0x43, 
+0xcc, 0x1d, 0x11, 0x34, 0x89, 0x69, 0x09, 0x03, 0x09, 0x0b, 0x22, 0x69, 
+0xe5, 0x68, 0xc0, 0x46, 0x1d, 0x95, 0xfc, 0x1d, 0x39, 0x34, 0x64, 0x8b, 
+0x64, 0x09, 0x05, 0x34, 0x24, 0x06, 0x24, 0x0e, 0x1c, 0x94, 0x56, 0x1a, 
+0x1b, 0x96, 0x1c, 0x9c, 0x2e, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0x01, 0x26, 
+0x1d, 0x9d, 0x1a, 0x68, 0x91, 0x42, 0x01, 0xd1, 0x32, 0x1c, 0x0b, 0xe0, 
+0x91, 0x42, 0x03, 0xd9, 0x52, 0x1b, 0x1b, 0x9e, 0xb5, 0x18, 0x00, 0xe0, 
+0x55, 0x1a, 0x01, 0x22, 0x24, 0x01, 0xac, 0x42, 
 0x00, 0xd3, 0x00, 0x22, 0x01, 0x2a, 0xe6, 0xd1, 0x91, 0x07, 0x01, 0x43, 
-0x09, 0x68, 0xc0, 0x46, 0x39, 0x60, 0x93, 0x07, 
-0x01, 0x1d, 0x19, 0x43, 0x09, 0x68, 0xc0, 0x46, 0x79, 0x60, 0xc1, 0x1d, 
-0x01, 0x31, 0x19, 0x43, 0x09, 0x68, 0xc0, 0x46, 0xb9, 0x60, 0x1f, 0x99, 
-0x09, 0x68, 0x1e, 0x9a, 0xc0, 0x46, 0x51, 0x83, 0xc1, 0x1d, 0x1d, 0x31, 
-0x19, 0x43, 0x09, 0x68, 0xc0, 0x46, 0x38, 0x63, 0x79, 0x62, 0xc1, 0x1d, 
-0x11, 0x31, 0x19, 0x43, 0x09, 0x68, 0xc0, 0x46, 0xb9, 0x61, 0xc1, 0x1d, 
-0x05, 0x31, 0x19, 0x43, 0x09, 0x68, 0xc0, 0x46, 0xf9, 0x60, 0xc1, 0x1d, 
-0x17, 0x31, 0x19, 0x43, 0x09, 0x68, 0xc0, 0x46, 0xf9, 0x83, 0x0e, 0x30, 
-0x18, 0x43, 0x00, 0x68, 0xc0, 0x46, 0xf8, 0x81, 0x38, 0x68, 0x40, 0x08, 
-0x02, 0xd3, 0x38, 0x1c, 0x02, 0xf0, 0x5c, 0xfb, 0x38, 0x1c, 0x00, 0xf0, 
-0x0b, 0xf8, 0x38, 0x1c, 0xff, 0xf7, 0x58, 0xff, 0x20, 0xb0, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0xa8, 0x03, 0x00, 0x80, 0x55, 0x55, 0x55, 0x55, 
-0xf8, 0xb5, 0x07, 0x1c, 0xf8, 0x1d, 0x39, 0x30, 0x41, 0x8b, 0x39, 0x4a, 
-0x91, 0x42, 0x00, 0xdd, 0x42, 0x83, 0x42, 0x8b, 0xc0, 0x46, 0x00, 0x92, 
-0x01, 0x20, 0x3a, 0x1d, 0x06, 0xca, 0xbb, 0x6a, 0x02, 0xf0, 0x0e, 0xff, 
-0x33, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0x33, 0x4e, 0x30, 0x6a, 0x33, 0x4c, 
-0xe1, 0x6d, 0x41, 0x18, 0x38, 0x6b, 0xc3, 0x1d, 0x05, 0x33, 0x01, 0x20, 
-0x72, 0x6a, 0x02, 0xf0, 0xfb, 0xfe, 0xe0, 0x6d, 0x18, 0x30, 0x00, 0x25, 
-0xb1, 0x6a, 0x81, 0x42, 0x01, 0xd8, 0xe5, 0x65, 0x00, 0xe0, 0xe0, 0x65, 
-0x2f, 0x23, 0x9b, 0x01, 0x20, 0x1c, 0xe1, 0x6d, 0xe4, 0x18, 0x22, 0x68, 
-0x92, 0x00, 0x27, 0x4b, 0xc0, 0x46, 0x99, 0x50, 0x26, 0x48, 0xc1, 0x6b, 
-0x4a, 0x08, 0x05, 0xd3, 0x49, 0x08, 0x49, 0x00, 0xc1, 0x63, 0x01, 0x20, 
-0x01, 0xf0, 0xd6, 0xff, 0x22, 0x4a, 0x1f, 0x48, 0xc1, 0x1d, 0x89, 0x31, 
-0x0b, 0x78, 0x00, 0x2b, 0x02, 0xd0, 0x49, 0x78, 0x00, 0x29, 0x00, 0xd1, 
-0x1e, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0x20, 0x68, 0x80, 0x00, 0x19, 0x4b, 
-0xc3, 0x18, 0x05, 0xce, 0xc1, 0x1d, 0x11, 0x31, 0x01, 0x20, 0x02, 0xf0, 
-0xc7, 0xfe, 0x14, 0x48, 0x21, 0x68, 0x01, 0x31, 0x21, 0x60, 0x17, 0x29, 
-0x00, 0xd3, 0x25, 0x60, 0x39, 0x6b, 0xc0, 0x46, 0x0d, 0x65, 0x79, 0x6a, 
-0x3a, 0x6b, 0xc0, 0x46, 0x51, 0x62, 0x33, 0x23, 0x9b, 0x01, 0xc0, 0x18, 
-0x81, 0x68, 0x00, 0x29, 0x03, 0xd1, 0x39, 0x6b, 0xc0, 0x46, 0x81, 0x60, 
-0x04, 0xe0, 0x39, 0x6b, 0xc2, 0x68, 0xc0, 0x46, 0x11, 0x65, 0x39, 0x6b, 
-0xc0, 0x46, 0xc1, 0x60, 0xf8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0xea, 0x05, 0x00, 0x00, 0x18, 0x00, 0x14, 0x02, 0x7c, 0x29, 0x00, 0x80, 
-0x68, 0x0e, 0x00, 0x80, 0x44, 0x82, 0x20, 0x40, 0xe8, 0x0e, 0x00, 0x80, 
-0x04, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x03, 0xf0, 0xb5, 0x11, 0x4e, 
-0xff, 0x25, 0x01, 0x35, 0x10, 0x4f, 0xc0, 0x46, 0x35, 0x60, 0x78, 0x69, 
-0x01, 0x38, 0x78, 0x61, 0xbc, 0x68, 0x00, 0x2c, 0x10, 0xd0, 0x20, 0x6d, 
-0xc0, 0x46, 0xb8, 0x60, 0x20, 0x1c, 0x00, 0xf0, 0x21, 0xf8, 0x20, 0x1c, 
-0x00, 0xf0, 0x04, 0xfa, 0x08, 0x48, 0x80, 0x6a, 0x00, 0x0c, 0x00, 0x07, 
-0xe9, 0xd1, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x05, 0x48, 0xc1, 0x79, 
-0x01, 0x31, 0xc1, 0x71, 0xf7, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 
-0x28, 0x1b, 0x00, 0x80, 0x00, 0x00, 0x10, 0x40, 0xa0, 0x82, 0x20, 0x40, 
+0x09, 0x68, 0xc0, 0x46, 0x39, 0x60, 0x93, 0x07, 0x01, 0x1d, 0x19, 0x43, 
+0x09, 0x68, 0xc0, 0x46, 0x79, 0x60, 0xc1, 0x1d, 0x01, 0x31, 0x19, 0x43, 
+0x09, 0x68, 0xc0, 0x46, 0xb9, 0x60, 0x1f, 0x99, 0x09, 0x68, 0x1e, 0x9a, 
+0xc0, 0x46, 0x51, 0x83, 0xc1, 0x1d, 0x1d, 0x31, 0x19, 0x43, 0x09, 0x68, 
+0xc0, 0x46, 0x38, 0x63, 0x79, 0x62, 0xc1, 0x1d, 0x11, 0x31, 0x19, 0x43, 
+0x09, 0x68, 0xc0, 0x46, 0xb9, 0x61, 0xc1, 0x1d, 0x05, 0x31, 0x19, 0x43, 
+0x09, 0x68, 0xc0, 0x46, 0xf9, 0x60, 0xc1, 0x1d, 0x17, 0x31, 0x19, 0x43, 
+0x09, 0x68, 0xc0, 0x46, 0xf9, 0x83, 0x0e, 0x30, 0x18, 0x43, 0x00, 0x68, 
+0xc0, 0x46, 0xf8, 0x81, 0x38, 0x68, 0x40, 0x08, 0x02, 0xd3, 0x38, 0x1c, 
+0x02, 0xf0, 0x5c, 0xfb, 0x38, 0x1c, 0x00, 0xf0, 0x0b, 0xf8, 0x38, 0x1c, 
+0xff, 0xf7, 0x58, 0xff, 0x20, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0xa8, 0x03, 0x00, 0x80, 0x55, 0x55, 0x55, 0x55, 0xf8, 0xb5, 0x07, 0x1c, 
+0xf8, 0x1d, 0x39, 0x30, 0x41, 0x8b, 0x39, 0x4a, 0x91, 0x42, 0x00, 0xdd, 
+0x42, 0x83, 0x42, 0x8b, 0xc0, 0x46, 0x00, 0x92, 0x01, 0x20, 0x3a, 0x1d, 
+0x06, 0xca, 0xbb, 0x6a, 0x02, 0xf0, 0x0e, 0xff, 0x33, 0x4a, 0xc0, 0x46, 
+0x00, 0x92, 0x33, 0x4e, 0x30, 0x6a, 0x33, 0x4c, 0xe1, 0x6d, 0x41, 0x18, 
+0x38, 0x6b, 0xc3, 0x1d, 0x05, 0x33, 0x01, 0x20, 0x72, 0x6a, 0x02, 0xf0, 
+0xfb, 0xfe, 0xe0, 0x6d, 0x18, 0x30, 0x00, 0x25, 0xb1, 0x6a, 0x81, 0x42, 
+0x01, 0xd8, 0xe5, 0x65, 0x00, 0xe0, 0xe0, 0x65, 0x2f, 0x23, 0x9b, 0x01, 
+0x20, 0x1c, 0xe1, 0x6d, 0xe4, 0x18, 0x22, 0x68, 0x92, 0x00, 0x27, 0x4b, 
+0xc0, 0x46, 0x99, 0x50, 0x26, 0x48, 0xc1, 0x6b, 0x4a, 0x08, 0x05, 0xd3, 
+0x49, 0x08, 0x49, 0x00, 0xc1, 0x63, 0x01, 0x20, 0x01, 0xf0, 0xd6, 0xff, 
+0x22, 0x4a, 0x1f, 0x48, 0xc1, 0x1d, 0x89, 0x31, 0x0b, 0x78, 0x00, 0x2b, 
+0x02, 0xd0, 0x49, 0x78, 0x00, 0x29, 0x00, 0xd1, 0x1e, 0x4a, 0xc0, 0x46, 
+0x00, 0x92, 0x20, 0x68, 0x80, 0x00, 0x19, 0x4b, 0xc3, 0x18, 0x05, 0xce, 
+0xc1, 0x1d, 0x11, 0x31, 0x01, 0x20, 0x02, 0xf0, 0xc7, 0xfe, 0x14, 0x48, 
+0x21, 0x68, 0x01, 0x31, 0x21, 0x60, 0x17, 0x29, 0x00, 0xd3, 0x25, 0x60, 
+0x39, 0x6b, 0xc0, 0x46, 0x0d, 0x65, 0x79, 0x6a, 0x3a, 0x6b, 0xc0, 0x46, 
+0x51, 0x62, 0x33, 0x23, 0x9b, 0x01, 0xc0, 0x18, 0x81, 0x68, 0x00, 0x29, 
+0x03, 0xd1, 0x39, 0x6b, 0xc0, 0x46, 0x81, 0x60, 0x04, 0xe0, 0x39, 0x6b, 
+0xc2, 0x68, 0xc0, 0x46, 0x11, 0x65, 0x39, 0x6b, 0xc0, 0x46, 0xc1, 0x60, 
+0xf8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0xea, 0x05, 0x00, 0x00, 
+0x18, 0x00, 0x14, 0x02, 0x7c, 0x29, 0x00, 0x80, 0x68, 0x0e, 0x00, 0x80, 
+0x44, 0x82, 0x20, 0x40, 0xe8, 0x0e, 0x00, 0x80, 0x04, 0x00, 0x00, 0x02, 
+0x04, 0x00, 0x00, 0x03, 0xf0, 0xb5, 0x11, 0x4e, 0xff, 0x25, 0x01, 0x35, 
+0x10, 0x4f, 0xc0, 0x46, 0x35, 0x60, 0x78, 0x69, 0x01, 0x38, 0x78, 0x61, 
+0xbc, 0x68, 0x00, 0x2c, 0x10, 0xd0, 0x20, 0x6d, 0xc0, 0x46, 0xb8, 0x60, 
+0x20, 0x1c, 0x00, 0xf0, 0x21, 0xf8, 0x20, 0x1c, 0x00, 0xf0, 0x04, 0xfa, 
+0x08, 0x48, 0x80, 0x6a, 0x00, 0x0c, 0x00, 0x07, 0xe9, 0xd1, 0xf0, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x05, 0x48, 0xc1, 0x79, 0x01, 0x31, 0xc1, 0x71, 
+0xf7, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x28, 0x1b, 0x00, 0x80, 
+0x00, 0x00, 0x10, 0x40, 0xa0, 0x82, 0x20, 0x40, 
 0x01, 0x20, 0x80, 0x03, 0x01, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x70, 0x47, 
-0x00, 0x00, 0x00, 0xb0, 0x90, 0xb5, 0x07, 0x1c, 
-0x38, 0x68, 0xc0, 0x08, 0x09, 0xd3, 0x1d, 0x48, 0x01, 0x6a, 0x01, 0x39, 
-0x01, 0x62, 0x20, 0x30, 0x00, 0x79, 0x00, 0x28, 0x01, 0xd0, 0xfe, 0xf7, 
-0xf3, 0xfd, 0x01, 0x23, 0x9b, 0x07, 0xf8, 0x1d, 0x1d, 0x30, 0x18, 0x43, 
-0x00, 0x68, 0x16, 0x4c, 0x61, 0x6a, 0x81, 0x42, 0x21, 0xd1, 0x01, 0x1c, 
-0x19, 0x43, 0x09, 0x68, 0x09, 0x04, 0x09, 0x0c, 0x01, 0x29, 0x1a, 0xd1, 
-0x00, 0xf0, 0x22, 0xf8, 0x60, 0x62, 0x60, 0x6a, 0x21, 0x6a, 0x88, 0x42, 
-0x05, 0xd0, 0x01, 0x21, 0x89, 0x07, 0x01, 0x43, 0x09, 0x68, 0x09, 0x04, 
-0xf2, 0xd0, 0x51, 0x21, 0x89, 0x03, 0x62, 0x6a, 0x23, 0x6b, 0x9a, 0x42, 
-0x02, 0xd1, 0x60, 0x6b, 0xa2, 0x6b, 0x80, 0x1a, 0x04, 0x38, 0xc8, 0x60, 
-0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x20, 0x79, 0x6a, 0xc0, 0x46, 
-0x08, 0x60, 0xf7, 0xe7, 0x6c, 0x06, 0x00, 0x80, 0xe8, 0x1a, 0x00, 0x80, 
-0x01, 0x23, 0x9b, 0x07, 0xc1, 0x1d, 0x01, 0x31, 0x19, 0x43, 0x09, 0x68, 
-0x09, 0x04, 0x09, 0x0c, 0x08, 0x18, 0x0d, 0x30, 0x81, 0x07, 0x02, 0xd0, 
-0x80, 0x08, 0x80, 0x00, 0x04, 0x30, 0x04, 0x49, 0x8a, 0x6b, 0x12, 0x18, 
-0x4b, 0x6b, 0x9a, 0x42, 0x00, 0xd9, 0x08, 0x6b, 0x70, 0x47, 0x00, 0x00, 
-0xe8, 0x1a, 0x00, 0x80, 0x00, 0xb5, 0x04, 0x48, 0xc0, 0x68, 0x10, 0x28, 
-0x01, 0xd3, 0x00, 0xf0, 0x05, 0xf8, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0xe8, 0x1a, 0x00, 0x80, 0x88, 0xb5, 0x0c, 0x4f, 0x38, 0x79, 0x00, 0x28, 
-0x11, 0xd1, 0x0b, 0x49, 0x10, 0x20, 0x02, 0xf0, 0xf5, 0xfd, 0x00, 0x28, 
-0x0b, 0xd0, 0x01, 0x20, 0x38, 0x71, 0x08, 0x4a, 0xc0, 0x46, 0x00, 0x92, 
-0x07, 0x48, 0x42, 0x68, 0x07, 0x4b, 0x01, 0x68, 0x00, 0x20, 0x02, 0xf0, 
-0xdf, 0xfd, 0x88, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xf8, 0x1a, 0x00, 0x80, 
-0xe1, 0x2c, 0xff, 0xff, 0x10, 0x00, 0x35, 0x02, 0x7c, 0x29, 0x00, 0x80, 
-0x44, 0x80, 0x20, 0x40, 0x90, 0xb5, 0x01, 0x20, 0x40, 0x02, 0x10, 0x49, 
-0xc0, 0x46, 0x08, 0x60, 0x0f, 0x4f, 0x10, 0x21, 0xf8, 0x1d, 0x3d, 0x30, 
-0x02, 0xf0, 0x4c, 0xfc, 0x19, 0x23, 0xdb, 0x01, 0xfc, 0x18, 0xe0, 0x68, 
-0x00, 0x28, 0x01, 0xd0, 0x00, 0xf0, 0x14, 0xf8, 0x00, 0x20, 0xc9, 0x23, 
-0x1b, 0x01, 0xf9, 0x18, 0x08, 0x71, 0xe0, 0x68, 0x10, 0x28, 0x04, 0xd3, 
-0x01, 0x20, 0xbb, 0x23, 0x1b, 0x01, 0xf9, 0x18, 0x48, 0x73, 0x90, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0xb0, 0x68, 0x0e, 0x00, 0x80, 
-0xf8, 0xb5, 0x37, 0x48, 0x19, 0x23, 0xdb, 0x01, 0xc1, 0x18, 0xc9, 0x68, 
-0x35, 0x4d, 0x10, 0x29, 0x00, 0xd9, 0x10, 0x21, 0x69, 0x62, 0x32, 0x48, 
-0xc1, 0x6c, 0x00, 0x6e, 0x81, 0x42, 0x07, 0xd9, 0x08, 0x1a, 0x07, 0x09, 
-0x00, 0x24, 0x68, 0x6a, 0xb8, 0x42, 0x12, 0xd2, 0x07, 0x1c, 0x10, 0xe0, 
-0x81, 0x42, 0x2a, 0xd2, 0x2c, 0x4a, 0x52, 0x6b, 0x10, 0x1a, 0x07, 0x09, 
-0x68, 0x6a, 0xb8, 0x42, 0x05, 0xd9, 0x0c, 0x09, 0x39, 0x19, 0x88, 0x42, 
-0x03, 0xd2, 0xc4, 0x1b, 0x01, 0xe0, 0x00, 0x24, 0x07, 0x1c, 0x3e, 0x19, 
-0x30, 0x01, 0x25, 0x49, 0x02, 0xf0, 0x84, 0xfd, 0x00, 0x28, 0x3d, 0xd0, 
-0x23, 0x48, 0x00, 0x2c, 0x1a, 0xd1, 0x1e, 0x49, 0x3a, 0x01, 0x6f, 0x62, 
-0x09, 0x6e, 0x8c, 0x18, 0x1d, 0x4d, 0x6b, 0x6b, 0xa3, 0x42, 0x00, 0xd8, 
-0xe4, 0x1a, 0x1e, 0x4b, 0x1a, 0x43, 0x00, 0x92, 0xea, 0x6a, 0x51, 0x18, 
+0x00, 0x00, 0x00, 0xb0, 0x90, 0xb5, 0x07, 0x1c, 0x38, 0x68, 0xc0, 0x08, 
+0x09, 0xd3, 0x1d, 0x48, 0x01, 0x6a, 0x01, 0x39, 0x01, 0x62, 0x20, 0x30, 
+0x00, 0x79, 0x00, 0x28, 0x01, 0xd0, 0xfe, 0xf7, 0xe9, 0xfd, 0x01, 0x23, 
+0x9b, 0x07, 0xf8, 0x1d, 0x1d, 0x30, 0x18, 0x43, 0x00, 0x68, 0x16, 0x4c, 
+0x61, 0x6a, 0x81, 0x42, 0x21, 0xd1, 0x01, 0x1c, 0x19, 0x43, 0x09, 0x68, 
+0x09, 0x04, 0x09, 0x0c, 0x01, 0x29, 0x1a, 0xd1, 0x00, 0xf0, 0x22, 0xf8, 
+0x60, 0x62, 0x60, 0x6a, 0x21, 0x6a, 0x88, 0x42, 0x05, 0xd0, 0x01, 0x21, 
+0x89, 0x07, 0x01, 0x43, 0x09, 0x68, 0x09, 0x04, 0xf2, 0xd0, 0x51, 0x21, 
+0x89, 0x03, 0x62, 0x6a, 0x23, 0x6b, 0x9a, 0x42, 0x02, 0xd1, 0x60, 0x6b, 
+0xa2, 0x6b, 0x80, 0x1a, 0x04, 0x38, 0xc8, 0x60, 0x90, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0x20, 0x79, 0x6a, 0xc0, 0x46, 0x08, 0x60, 0xf7, 0xe7, 
+0x6c, 0x06, 0x00, 0x80, 0xe8, 0x1a, 0x00, 0x80, 0x01, 0x23, 0x9b, 0x07, 
+0xc1, 0x1d, 0x01, 0x31, 0x19, 0x43, 0x09, 0x68, 0x09, 0x04, 0x09, 0x0c, 
+0x08, 0x18, 0x0d, 0x30, 0x81, 0x07, 0x02, 0xd0, 0x80, 0x08, 0x80, 0x00, 
+0x04, 0x30, 0x04, 0x49, 0x8a, 0x6b, 0x12, 0x18, 0x4b, 0x6b, 0x9a, 0x42, 
+0x00, 0xd9, 0x08, 0x6b, 0x70, 0x47, 0x00, 0x00, 0xe8, 0x1a, 0x00, 0x80, 
+0x00, 0xb5, 0x04, 0x48, 0xc0, 0x68, 0x10, 0x28, 0x01, 0xd3, 0x00, 0xf0, 
+0x05, 0xf8, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0xe8, 0x1a, 0x00, 0x80, 
+0x88, 0xb5, 0x0c, 0x4f, 0x38, 0x79, 0x00, 0x28, 0x11, 0xd1, 0x0b, 0x49, 
+0x10, 0x20, 0x02, 0xf0, 0xf5, 0xfd, 0x00, 0x28, 0x0b, 0xd0, 0x01, 0x20, 
+0x38, 0x71, 0x08, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0x07, 0x48, 0x42, 0x68, 
+0x07, 0x4b, 0x01, 0x68, 0x00, 0x20, 0x02, 0xf0, 0xdf, 0xfd, 0x88, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0xf8, 0x1a, 0x00, 0x80, 0xf5, 0x2c, 0xff, 0xff, 
+0x10, 0x00, 0x35, 0x02, 0x7c, 0x29, 0x00, 0x80, 0x44, 0x80, 0x20, 0x40, 
+0x90, 0xb5, 0x01, 0x20, 0x40, 0x02, 0x10, 0x49, 0xc0, 0x46, 0x08, 0x60, 
+0x0f, 0x4f, 0x10, 0x21, 0xf8, 0x1d, 0x3d, 0x30, 0x02, 0xf0, 0x4c, 0xfc, 
+0x19, 0x23, 0xdb, 0x01, 0xfc, 0x18, 0xe0, 0x68, 0x00, 0x28, 0x01, 0xd0, 
+0x00, 0xf0, 0x14, 0xf8, 0x00, 0x20, 0xc9, 0x23, 0x1b, 0x01, 0xf9, 0x18, 
+0x08, 0x71, 0xe0, 0x68, 0x10, 0x28, 0x04, 0xd3, 0x01, 0x20, 0xbb, 0x23, 
+0x1b, 0x01, 0xf9, 0x18, 0x48, 0x73, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x00, 0x00, 0x00, 0xb0, 0x68, 0x0e, 0x00, 0x80, 0xf8, 0xb5, 0x37, 0x48, 
+0x19, 0x23, 0xdb, 0x01, 0xc1, 0x18, 0xc9, 0x68, 0x35, 0x4d, 0x10, 0x29, 
+0x00, 0xd9, 0x10, 0x21, 0x69, 0x62, 0x32, 0x48, 0xc1, 0x6c, 0x00, 0x6e, 
+0x81, 0x42, 0x07, 0xd9, 0x08, 0x1a, 0x07, 0x09, 0x00, 0x24, 0x68, 0x6a, 
+0xb8, 0x42, 0x12, 0xd2, 0x07, 0x1c, 0x10, 0xe0, 0x81, 0x42, 0x2a, 0xd2, 
+0x2c, 0x4a, 0x52, 0x6b, 0x10, 0x1a, 0x07, 0x09, 0x68, 0x6a, 0xb8, 0x42, 
+0x05, 0xd9, 0x0c, 0x09, 0x39, 0x19, 0x88, 0x42, 0x03, 0xd2, 0xc4, 0x1b, 
+0x01, 0xe0, 0x00, 0x24, 0x07, 0x1c, 0x3e, 0x19, 0x30, 0x01, 0x25, 0x49, 
+0x02, 0xf0, 0x84, 0xfd, 0x00, 0x28, 0x3d, 0xd0, 0x23, 0x48, 0x00, 0x2c, 
+0x1a, 0xd1, 0x1e, 0x49, 0x3a, 0x01, 0x6f, 0x62, 0x09, 0x6e, 0x8c, 0x18, 
+0x1d, 0x4d, 0x6b, 0x6b, 0xa3, 0x42, 0x00, 0xd8, 0xe4, 0x1a, 0x1e, 0x4b, 
+0x1a, 0x43, 0x00, 0x92, 0xea, 0x6a, 0x51, 0x18, 
 0x2a, 0x6b, 0x03, 0x1c, 0x20, 0xe0, 0x1b, 0x48, 0x01, 0x6b, 0x01, 0x31, 
-0x01, 0x63, 0x00, 0x20, 0x68, 0x62, 0xf8, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x10, 0x49, 0x24, 0x01, 0x3f, 0x01, 0x11, 0x22, 
-0x52, 0x05, 0x3a, 0x43, 0x6e, 0x62, 0x00, 0x92, 0x0e, 0x4d, 0xea, 0x6a, 
-0x09, 0x6e, 0x51, 0x18, 0x03, 0x1c, 0x06, 0x1c, 0x00, 0x20, 0x2a, 0x6b, 
-0x02, 0xf0, 0x4a, 0xfd, 0x0c, 0x4a, 0x22, 0x43, 0x00, 0x92, 0xbb, 0x19, 
-0xe9, 0x6a, 0x2a, 0x6b, 0x00, 0x20, 0x02, 0xf0, 0x41, 0xfd, 0x03, 0x48, 
-0xc0, 0x46, 0x04, 0x66, 0x00, 0xf0, 0x10, 0xf8, 0x01, 0x20, 0xda, 0xe7, 
-0x68, 0x0e, 0x00, 0x80, 0x28, 0x1b, 0x00, 0x80, 0x7c, 0x29, 0x00, 0x80, 
-0x49, 0x2e, 0xff, 0xff, 0x44, 0x80, 0x20, 0x40, 0x00, 0x00, 0x36, 0x02, 
-0xa0, 0x82, 0x20, 0x40, 0x04, 0x48, 0x01, 0x6e, 0x04, 0x4a, 0x80, 0x30, 
-0xd1, 0x60, 0x02, 0x23, 0xc1, 0x6b, 0x19, 0x43, 0xc1, 0x63, 0x70, 0x47, 
-0x68, 0x0e, 0x00, 0x80, 0x3c, 0xef, 0x20, 0x40, 0xf0, 0xb5, 0x84, 0xb0, 
-0x01, 0x20, 0x80, 0x02, 0x1c, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x00, 0x27, 
-0x1b, 0x4e, 0x33, 0x23, 0x9b, 0x01, 0xf5, 0x18, 0x68, 0x6a, 0x00, 0x28, 
-0x1d, 0xd9, 0x19, 0x4c, 0x68, 0x46, 0x10, 0x21, 0x02, 0xf0, 0x90, 0xfb, 
-0x68, 0x46, 0x00, 0xf0, 0x33, 0xf8, 0x00, 0x28, 0x04, 0xd0, 0x15, 0x49, 
-0x48, 0x69, 0x01, 0x30, 0x48, 0x61, 0x0a, 0xe0, 0x13, 0x49, 0x60, 0x7b, 
-0x01, 0x30, 0x60, 0x73, 0x88, 0x79, 0x01, 0x30, 0x88, 0x71, 0x11, 0x48, 
-0x00, 0x68, 0x02, 0xf0, 0x65, 0xf9, 0x68, 0x6a, 0x01, 0x37, 0xb8, 0x42, 
-0xe2, 0xd8, 0xbb, 0x23, 0x1b, 0x01, 0xf0, 0x18, 0x81, 0x7b, 0x00, 0x29, 
-0x03, 0xd0, 0x00, 0x21, 0x81, 0x73, 0xff, 0xf7, 0x05, 0xfb, 0xff, 0xf7, 
-0xe3, 0xfe, 0x04, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0xb0, 0x68, 0x0e, 0x00, 0x80, 0xb0, 0x82, 0x20, 0x40, 
-0x08, 0x83, 0x20, 0x40, 0xa0, 0x82, 0x20, 0x40, 0x58, 0x04, 0x00, 0x80, 
-0x90, 0xb4, 0x17, 0x4f, 0x19, 0x23, 0xdb, 0x01, 0xf9, 0x18, 0x00, 0x22, 
-0xcb, 0x68, 0x00, 0x2b, 0x23, 0xd0, 0x01, 0x3b, 0xcb, 0x60, 0x33, 0x23, 
-0x9b, 0x01, 0xff, 0x18, 0xbb, 0x69, 0x1c, 0x6d, 0xc0, 0x46, 0xbc, 0x61, 
-0x04, 0x68, 0xc0, 0x46, 0x5c, 0x60, 0x44, 0x68, 0xc0, 0x46, 0x9c, 0x60, 
-0x84, 0x68, 0xc0, 0x46, 0x1c, 0x61, 0xc0, 0x68, 0xc0, 0x46, 0x58, 0x61, 
-0x1a, 0x65, 0x08, 0x69, 0x42, 0x1c, 0x0a, 0x61, 0x00, 0x28, 0x03, 0xd0, 
-0x38, 0x6a, 0xc0, 0x46, 0x03, 0x65, 0x00, 0xe0, 0xfb, 0x61, 0x3b, 0x62, 
-0x18, 0x1c, 0x90, 0xbc, 0x70, 0x47, 0x10, 0x1c, 0xfb, 0xe7, 0x00, 0x00, 
-0x68, 0x0e, 0x00, 0x80, 0x0a, 0x4a, 0x33, 0x23, 0x9b, 0x01, 0xd1, 0x18, 
-0xc8, 0x69, 0x19, 0x23, 0xdb, 0x01, 0xd2, 0x18, 0x13, 0x69, 0x00, 0x2b, 
-0x06, 0xd0, 0x01, 0x3b, 0x13, 0x61, 0xca, 0x69, 0x12, 0x6d, 0xc0, 0x46, 
-0xca, 0x61, 0x70, 0x47, 0x00, 0x21, 0x11, 0x61, 0xfb, 0xe7, 0x00, 0x00, 
-0x68, 0x0e, 0x00, 0x80, 0x06, 0x4a, 0x11, 0x69, 0x4b, 0x1c, 0x13, 0x61, 
-0x40, 0x32, 0x00, 0x29, 0x01, 0xd0, 0xd1, 0x69, 0x00, 0xe0, 0x00, 0x21, 
-0x01, 0x65, 0xd0, 0x61, 0x70, 0x47, 0x00, 0x00, 0xe8, 0x1a, 0x00, 0x80, 
-0x06, 0x4a, 0xd1, 0x68, 0x4b, 0x1c, 0xd3, 0x60, 0x40, 0x32, 0x00, 0x29, 
-0x01, 0xd0, 0x91, 0x69, 0x00, 0xe0, 0x00, 0x21, 0x01, 0x65, 0x90, 0x61, 
-0x70, 0x47, 0x00, 0x00, 0xe8, 0x1a, 0x00, 0x80, 0x90, 0xb4, 0x00, 0x21, 
+0x01, 0x63, 0x00, 0x20, 0x68, 0x62, 0xf8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x10, 0x49, 0x24, 0x01, 0x3f, 0x01, 0x11, 0x22, 0x52, 0x05, 0x3a, 0x43, 
+0x6e, 0x62, 0x00, 0x92, 0x0e, 0x4d, 0xea, 0x6a, 0x09, 0x6e, 0x51, 0x18, 
+0x03, 0x1c, 0x06, 0x1c, 0x00, 0x20, 0x2a, 0x6b, 0x02, 0xf0, 0x4a, 0xfd, 
+0x0c, 0x4a, 0x22, 0x43, 0x00, 0x92, 0xbb, 0x19, 0xe9, 0x6a, 0x2a, 0x6b, 
+0x00, 0x20, 0x02, 0xf0, 0x41, 0xfd, 0x03, 0x48, 0xc0, 0x46, 0x04, 0x66, 
+0x00, 0xf0, 0x10, 0xf8, 0x01, 0x20, 0xda, 0xe7, 0x68, 0x0e, 0x00, 0x80, 
+0x28, 0x1b, 0x00, 0x80, 0x7c, 0x29, 0x00, 0x80, 0x5d, 0x2e, 0xff, 0xff, 
+0x44, 0x80, 0x20, 0x40, 0x00, 0x00, 0x36, 0x02, 0xa0, 0x82, 0x20, 0x40, 
+0x04, 0x48, 0x01, 0x6e, 0x04, 0x4a, 0x80, 0x30, 0xd1, 0x60, 0x02, 0x23, 
+0xc1, 0x6b, 0x19, 0x43, 0xc1, 0x63, 0x70, 0x47, 0x68, 0x0e, 0x00, 0x80, 
+0x90, 0xee, 0x20, 0x40, 0xf0, 0xb5, 0x84, 0xb0, 0x01, 0x20, 0x80, 0x02, 
+0x1c, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x00, 0x27, 0x1b, 0x4e, 0x33, 0x23, 
+0x9b, 0x01, 0xf5, 0x18, 0x68, 0x6a, 0x00, 0x28, 0x1d, 0xd9, 0x19, 0x4c, 
+0x68, 0x46, 0x10, 0x21, 0x02, 0xf0, 0x90, 0xfb, 0x68, 0x46, 0x00, 0xf0, 
+0x33, 0xf8, 0x00, 0x28, 0x04, 0xd0, 0x15, 0x49, 0x48, 0x69, 0x01, 0x30, 
+0x48, 0x61, 0x0a, 0xe0, 0x13, 0x49, 0x60, 0x7b, 0x01, 0x30, 0x60, 0x73, 
+0x88, 0x79, 0x01, 0x30, 0x88, 0x71, 0x11, 0x48, 0x00, 0x68, 0x02, 0xf0, 
+0x65, 0xf9, 0x68, 0x6a, 0x01, 0x37, 0xb8, 0x42, 0xe2, 0xd8, 0xbb, 0x23, 
+0x1b, 0x01, 0xf0, 0x18, 0x81, 0x7b, 0x00, 0x29, 0x03, 0xd0, 0x00, 0x21, 
+0x81, 0x73, 0xff, 0xf7, 0x05, 0xfb, 0xff, 0xf7, 0xe3, 0xfe, 0x04, 0xb0, 
+0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 
+0x68, 0x0e, 0x00, 0x80, 0xb0, 0x82, 0x20, 0x40, 0x08, 0x83, 0x20, 0x40, 
+0xa0, 0x82, 0x20, 0x40, 0x58, 0x04, 0x00, 0x80, 0x90, 0xb4, 0x17, 0x4f, 
+0x19, 0x23, 0xdb, 0x01, 0xf9, 0x18, 0x00, 0x22, 0xcb, 0x68, 0x00, 0x2b, 
+0x23, 0xd0, 0x01, 0x3b, 0xcb, 0x60, 0x33, 0x23, 0x9b, 0x01, 0xff, 0x18, 
+0xbb, 0x69, 0x1c, 0x6d, 0xc0, 0x46, 0xbc, 0x61, 0x04, 0x68, 0xc0, 0x46, 
+0x5c, 0x60, 0x44, 0x68, 0xc0, 0x46, 0x9c, 0x60, 0x84, 0x68, 0xc0, 0x46, 
+0x1c, 0x61, 0xc0, 0x68, 0xc0, 0x46, 0x58, 0x61, 0x1a, 0x65, 0x08, 0x69, 
+0x42, 0x1c, 0x0a, 0x61, 0x00, 0x28, 0x03, 0xd0, 0x38, 0x6a, 0xc0, 0x46, 
+0x03, 0x65, 0x00, 0xe0, 0xfb, 0x61, 0x3b, 0x62, 0x18, 0x1c, 0x90, 0xbc, 
+0x70, 0x47, 0x10, 0x1c, 0xfb, 0xe7, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 
+0x0a, 0x4a, 0x33, 0x23, 0x9b, 0x01, 0xd1, 0x18, 0xc8, 0x69, 0x19, 0x23, 
+0xdb, 0x01, 0xd2, 0x18, 0x13, 0x69, 0x00, 0x2b, 0x06, 0xd0, 0x01, 0x3b, 
+0x13, 0x61, 0xca, 0x69, 0x12, 0x6d, 0xc0, 0x46, 0xca, 0x61, 0x70, 0x47, 
+0x00, 0x21, 0x11, 0x61, 0xfb, 0xe7, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 
+0x06, 0x4a, 0x11, 0x69, 0x4b, 0x1c, 0x13, 0x61, 0x40, 0x32, 0x00, 0x29, 
+0x01, 0xd0, 0xd1, 0x69, 0x00, 0xe0, 0x00, 0x21, 0x01, 0x65, 0xd0, 0x61, 
+0x70, 0x47, 0x00, 0x00, 0xe8, 0x1a, 0x00, 0x80, 0x06, 0x4a, 0xd1, 0x68, 
+0x4b, 0x1c, 0xd3, 0x60, 0x40, 0x32, 0x00, 0x29, 0x01, 0xd0, 0x91, 0x69, 
+0x00, 0xe0, 0x00, 0x21, 0x01, 0x65, 0x90, 0x61, 0x70, 0x47, 0x00, 0x00, 
+0xe8, 0x1a, 0x00, 0x80, 0x90, 0xb4, 0x00, 0x21, 
 0x0f, 0x4a, 0x97, 0x89, 0x92, 0x6a, 0x4b, 0x00, 0x1b, 0x18, 0x9b, 0x8a, 
-0x00, 0x2b, 0x12, 0xd0, 0xbb, 0x42, 0x10, 0xdc, 
-0x1c, 0x1c, 0x58, 0x23, 0x63, 0x43, 0xd3, 0x18, 0xdc, 0x1f, 0x49, 0x3c, 
-0x01, 0x23, 0x9b, 0x07, 0x23, 0x43, 0x1b, 0x68, 0x1b, 0x06, 0x1b, 0x0e, 
-0x03, 0x2b, 0x02, 0xd0, 0x00, 0x20, 0x90, 0xbc, 0x70, 0x47, 0x01, 0x31, 
-0x04, 0x29, 0xe4, 0xd3, 0x01, 0x20, 0xf8, 0xe7, 0x4c, 0x2a, 0x00, 0x80, 
-0xf7, 0xb5, 0x86, 0xb0, 0x3d, 0x4a, 0x07, 0x1c, 0xd1, 0x69, 0x8f, 0x40, 
-0x03, 0x1c, 0x14, 0x6a, 0xe3, 0x40, 0x5f, 0x40, 0x07, 0x9e, 0x8e, 0x40, 
-0x77, 0x40, 0xcf, 0x40, 0x94, 0x69, 0xc0, 0x46, 0x05, 0x94, 0x03, 0x1c, 
-0xa3, 0x40, 0x00, 0x25, 0x14, 0x69, 0xc0, 0x46, 0x04, 0x94, 0x00, 0x2c, 
-0x5d, 0xd9, 0x1c, 0x1c, 0x32, 0x4e, 0x26, 0x43, 0x94, 0x69, 0xe6, 0x40, 
-0x33, 0x1c, 0x03, 0x96, 0x53, 0x6a, 0xc0, 0x46, 0x02, 0x93, 0xd2, 0x6a, 
-0xc0, 0x46, 0x01, 0x92, 0xbb, 0x00, 0x02, 0x9a, 0xd2, 0x58, 0x13, 0x1c, 
-0x05, 0x9c, 0xe3, 0x40, 0x03, 0x9c, 0xa3, 0x42, 0x3e, 0xd1, 0x8a, 0x40, 
-0xca, 0x40, 0x14, 0x1c, 0x63, 0x00, 0x1b, 0x19, 0x5b, 0x01, 0x01, 0x9a, 
-0xd2, 0x18, 0x01, 0x23, 0x9b, 0x07, 0xd6, 0x1d, 0x01, 0x36, 0x33, 0x43, 
-0x1b, 0x68, 0x1b, 0x06, 0x1b, 0x0e, 0x03, 0x2b, 0x2c, 0xd1, 0x01, 0x23, 
-0x9b, 0x07, 0xd6, 0x1d, 0x51, 0x36, 0x33, 0x43, 0x1b, 0x68, 0x07, 0x9e, 
-0x1e, 0x40, 0x00, 0x96, 0x01, 0x23, 0x9b, 0x07, 0xd6, 0x1d, 0x49, 0x36, 
-0x33, 0x43, 0x1b, 0x68, 0x83, 0x42, 0x1b, 0xd1, 0x01, 0x23, 0x9b, 0x07, 
-0xd6, 0x1d, 0x4d, 0x36, 0x33, 0x43, 0x1b, 0x68, 0x00, 0x9e, 0xb3, 0x42, 
-0x12, 0xd1, 0x01, 0x23, 0x9b, 0x07, 0x1a, 0x43, 0x12, 0x68, 0x12, 0x04, 
-0x12, 0x0c, 0x08, 0x9b, 0x32, 0x2b, 0x04, 0xd1, 0x02, 0x2a, 0x07, 0xd1, 
-0x20, 0x04, 0x00, 0x14, 0x0f, 0xe0, 0x08, 0x9b, 0x33, 0x2b, 0x01, 0xd1, 
-0x01, 0x2a, 0xf7, 0xd0, 0x04, 0x9a, 0x01, 0x37, 0x97, 0x42, 0x00, 0xd3, 
-0x00, 0x27, 0x04, 0x9a, 0x01, 0x35, 0xaa, 0x42, 0xae, 0xd8, 0x00, 0x20, 
-0xc0, 0x43, 0x09, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0x4c, 0x2a, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0xf0, 0xb5, 0x27, 0x4d, 
-0x68, 0x69, 0x00, 0x28, 0x06, 0xd0, 0x26, 0x48, 0x00, 0x68, 0x02, 0xf0, 
-0x2b, 0xf8, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x23, 0x4c, 0x00, 0x26, 
-0xa0, 0x68, 0x23, 0x4f, 0x00, 0x28, 0x16, 0xd0, 0x0f, 0xe0, 0x28, 0x6a, 
-0x02, 0x28, 0x02, 0xd3, 0x01, 0x20, 0x38, 0x71, 0x0f, 0xe0, 0xa6, 0x60, 
-0xfd, 0xf7, 0xe8, 0xfe, 0x00, 0x28, 0xea, 0xd1, 0x28, 0x6a, 0x02, 0x28, 
-0x01, 0xd3, 0x01, 0x20, 0x38, 0x71, 0xe8, 0x68, 0x00, 0x28, 0x02, 0xd0, 
-0x38, 0x79, 0x00, 0x28, 0xe9, 0xd0, 0x68, 0x68, 0x00, 0x28, 0x1b, 0xd0, 
-0x01, 0x20, 0xa0, 0x60, 0xfe, 0xf7, 0xbc, 0xfb, 0x00, 0x28, 0xd6, 0xd1, 
-0x68, 0x68, 0x00, 0x28, 0xf6, 0xd1, 0x11, 0xe0, 0x00, 0x28, 0xd0, 0xd1, 
-0x28, 0x6a, 0x02, 0x28, 0x02, 0xd3, 0x01, 0x20, 0x38, 0x71, 0xca, 0xe7, 
-0xa6, 0x60, 0xfd, 0xf7, 0xc3, 0xfe, 0x00, 0x28, 0xc5, 0xd1, 0x28, 0x6a, 
-0x02, 0x28, 0x01, 0xd3, 0x01, 0x20, 0x38, 0x71, 0xe8, 0x68, 0x00, 0x28, 
-0xbd, 0xd0, 0x38, 0x79, 0x00, 0x28, 0xe7, 0xd0, 0xb9, 0xe7, 0x00, 0x00, 
-0x6c, 0x06, 0x00, 0x80, 0x5c, 0x04, 0x00, 0x80, 0x4c, 0x2a, 0x00, 0x80, 
-0x8c, 0x06, 0x00, 0x80, 0x70, 0x47, 0x00, 0x00, 0x70, 0x47, 0x00, 0x00, 
+0x00, 0x2b, 0x12, 0xd0, 0xbb, 0x42, 0x10, 0xdc, 0x1c, 0x1c, 0x58, 0x23, 
+0x63, 0x43, 0xd3, 0x18, 0xdc, 0x1f, 0x49, 0x3c, 0x01, 0x23, 0x9b, 0x07, 
+0x23, 0x43, 0x1b, 0x68, 0x1b, 0x06, 0x1b, 0x0e, 0x03, 0x2b, 0x02, 0xd0, 
+0x00, 0x20, 0x90, 0xbc, 0x70, 0x47, 0x01, 0x31, 0x04, 0x29, 0xe4, 0xd3, 
+0x01, 0x20, 0xf8, 0xe7, 0x4c, 0x2a, 0x00, 0x80, 0xf7, 0xb5, 0x86, 0xb0, 
+0x3d, 0x4a, 0x07, 0x1c, 0xd1, 0x69, 0x8f, 0x40, 0x03, 0x1c, 0x14, 0x6a, 
+0xe3, 0x40, 0x5f, 0x40, 0x07, 0x9e, 0x8e, 0x40, 0x77, 0x40, 0xcf, 0x40, 
+0x94, 0x69, 0xc0, 0x46, 0x05, 0x94, 0x03, 0x1c, 0xa3, 0x40, 0x00, 0x25, 
+0x14, 0x69, 0xc0, 0x46, 0x04, 0x94, 0x00, 0x2c, 0x5d, 0xd9, 0x1c, 0x1c, 
+0x32, 0x4e, 0x26, 0x43, 0x94, 0x69, 0xe6, 0x40, 0x33, 0x1c, 0x03, 0x96, 
+0x53, 0x6a, 0xc0, 0x46, 0x02, 0x93, 0xd2, 0x6a, 0xc0, 0x46, 0x01, 0x92, 
+0xbb, 0x00, 0x02, 0x9a, 0xd2, 0x58, 0x13, 0x1c, 0x05, 0x9c, 0xe3, 0x40, 
+0x03, 0x9c, 0xa3, 0x42, 0x3e, 0xd1, 0x8a, 0x40, 0xca, 0x40, 0x14, 0x1c, 
+0x63, 0x00, 0x1b, 0x19, 0x5b, 0x01, 0x01, 0x9a, 0xd2, 0x18, 0x01, 0x23, 
+0x9b, 0x07, 0xd6, 0x1d, 0x01, 0x36, 0x33, 0x43, 0x1b, 0x68, 0x1b, 0x06, 
+0x1b, 0x0e, 0x03, 0x2b, 0x2c, 0xd1, 0x01, 0x23, 0x9b, 0x07, 0xd6, 0x1d, 
+0x51, 0x36, 0x33, 0x43, 0x1b, 0x68, 0x07, 0x9e, 0x1e, 0x40, 0x00, 0x96, 
+0x01, 0x23, 0x9b, 0x07, 0xd6, 0x1d, 0x49, 0x36, 0x33, 0x43, 0x1b, 0x68, 
+0x83, 0x42, 0x1b, 0xd1, 0x01, 0x23, 0x9b, 0x07, 0xd6, 0x1d, 0x4d, 0x36, 
+0x33, 0x43, 0x1b, 0x68, 0x00, 0x9e, 0xb3, 0x42, 0x12, 0xd1, 0x01, 0x23, 
+0x9b, 0x07, 0x1a, 0x43, 0x12, 0x68, 0x12, 0x04, 0x12, 0x0c, 0x08, 0x9b, 
+0x32, 0x2b, 0x04, 0xd1, 0x02, 0x2a, 0x07, 0xd1, 0x20, 0x04, 0x00, 0x14, 
+0x0f, 0xe0, 0x08, 0x9b, 0x33, 0x2b, 0x01, 0xd1, 0x01, 0x2a, 0xf7, 0xd0, 
+0x04, 0x9a, 0x01, 0x37, 0x97, 0x42, 0x00, 0xd3, 0x00, 0x27, 0x04, 0x9a, 
+0x01, 0x35, 0xaa, 0x42, 0xae, 0xd8, 0x00, 0x20, 0xc0, 0x43, 0x09, 0xb0, 
+0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x4c, 0x2a, 0x00, 0x80, 
+0x00, 0x00, 0x00, 0x80, 0xf0, 0xb5, 0x27, 0x4d, 0x68, 0x69, 0x00, 0x28, 
+0x06, 0xd0, 0x26, 0x48, 0x00, 0x68, 0x02, 0xf0, 0x2b, 0xf8, 0xf0, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x23, 0x4c, 0x00, 0x26, 0xa0, 0x68, 0x23, 0x4f, 
+0x00, 0x28, 0x16, 0xd0, 0x0f, 0xe0, 0x28, 0x6a, 0x02, 0x28, 0x02, 0xd3, 
+0x01, 0x20, 0x38, 0x71, 0x0f, 0xe0, 0xa6, 0x60, 0xfd, 0xf7, 0xde, 0xfe, 
+0x00, 0x28, 0xea, 0xd1, 0x28, 0x6a, 0x02, 0x28, 0x01, 0xd3, 0x01, 0x20, 
+0x38, 0x71, 0xe8, 0x68, 0x00, 0x28, 0x02, 0xd0, 0x38, 0x79, 0x00, 0x28, 
+0xe9, 0xd0, 0x68, 0x68, 0x00, 0x28, 0x1b, 0xd0, 0x01, 0x20, 0xa0, 0x60, 
+0xfe, 0xf7, 0xbc, 0xfb, 0x00, 0x28, 0xd6, 0xd1, 0x68, 0x68, 0x00, 0x28, 
+0xf6, 0xd1, 0x11, 0xe0, 0x00, 0x28, 0xd0, 0xd1, 0x28, 0x6a, 0x02, 0x28, 
+0x02, 0xd3, 0x01, 0x20, 0x38, 0x71, 0xca, 0xe7, 0xa6, 0x60, 0xfd, 0xf7, 
+0xb9, 0xfe, 0x00, 0x28, 0xc5, 0xd1, 0x28, 0x6a, 0x02, 0x28, 0x01, 0xd3, 
+0x01, 0x20, 0x38, 0x71, 0xe8, 0x68, 0x00, 0x28, 0xbd, 0xd0, 0x38, 0x79, 
+0x00, 0x28, 0xe7, 0xd0, 0xb9, 0xe7, 0x00, 0x00, 0x6c, 0x06, 0x00, 0x80, 
+0x5c, 0x04, 0x00, 0x80, 0x4c, 0x2a, 0x00, 0x80, 0x8c, 0x06, 0x00, 0x80, 
+0x70, 0x47, 0x00, 0x00, 0x70, 0x47, 0x00, 0x00, 
 0x70, 0x47, 0x00, 0x00, 0x90, 0xb5, 0x40, 0x20, 0x1d, 0x49, 0xc0, 0x46, 
-0x08, 0x60, 0x01, 0xf0, 0x9d, 0xfc, 0x03, 0x23, 
-0x1b, 0x07, 0x41, 0x68, 0x19, 0x40, 0x0c, 0x0f, 0x61, 0x01, 0x09, 0x1b, 
-0x89, 0x00, 0x18, 0x4a, 0x8f, 0x18, 0x01, 0x21, 0x39, 0x80, 0x81, 0x6a, 
-0xc0, 0x46, 0x79, 0x65, 0x41, 0x6a, 0xc0, 0x46, 0x79, 0x67, 0xb9, 0x6c, 
-0xfa, 0x6c, 0x89, 0x18, 0xb9, 0x64, 0x00, 0x21, 0xf9, 0x64, 0xba, 0x6b, 
-0x3b, 0x6d, 0xd2, 0x18, 0xba, 0x63, 0x39, 0x65, 0x42, 0x6a, 0x20, 0x32, 
-0x51, 0x71, 0x79, 0x6d, 0x7a, 0x6f, 0xd2, 0x6d, 0xc0, 0x46, 0x11, 0x60, 
-0xfc, 0xf7, 0xd4, 0xff, 0x20, 0x01, 0x09, 0x49, 0x40, 0x18, 0x19, 0x23, 
-0xdb, 0x01, 0xc0, 0x18, 0x41, 0x6b, 0x01, 0x39, 0x41, 0x63, 0x78, 0x6f, 
-0x01, 0xf0, 0xc6, 0xfb, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0xb0, 0x5c, 0x2b, 0x00, 0x80, 0xa0, 0x1c, 0x00, 0x80, 
-0xf0, 0xb5, 0x40, 0x20, 0x12, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x01, 0xf0, 
-0x59, 0xfc, 0x07, 0x1c, 0x40, 0x68, 0x03, 0x23, 0x1b, 0x07, 0x18, 0x40, 
-0x06, 0x0f, 0x70, 0x01, 0x80, 0x1b, 0x80, 0x00, 0x0c, 0x49, 0x44, 0x18, 
-0xb8, 0x6a, 0xc0, 0x46, 0x60, 0x65, 0x78, 0x6a, 0xc0, 0x46, 0x60, 0x67, 
-0x80, 0x6f, 0x05, 0x1d, 0xe5, 0x63, 0xb9, 0x69, 0x28, 0x1c, 0x02, 0xf0, 
-0x89, 0xf9, 0x38, 0x1c, 0x21, 0x1c, 0x32, 0x1c, 0x2b, 0x1c, 0x00, 0xf0, 
-0x20, 0xf8, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0xb0, 
-0x5c, 0x2b, 0x00, 0x80, 0xf0, 0xb5, 0x4b, 0x6f, 0x9b, 0x6f, 0x1f, 0x1d, 
-0xcf, 0x63, 0x05, 0x68, 0x00, 0x23, 0x84, 0x69, 0xa4, 0x08, 0x08, 0xd0, 
-0x9c, 0x00, 0x2e, 0x59, 0xc0, 0x46, 0x3e, 0x51, 0x84, 0x69, 0xa4, 0x08, 
-0x01, 0x33, 0x9c, 0x42, 0xf6, 0xd8, 0x3b, 0x1c, 0x00, 0xf0, 0x03, 0xf8, 
-0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xff, 0xb5, 0x81, 0xb0, 0x04, 0x1c, 
-0x1d, 0x1c, 0x0f, 0x1c, 0x46, 0x48, 0x01, 0x69, 0x01, 0x31, 0x01, 0x61, 
-0xf9, 0x1d, 0x51, 0x31, 0xbd, 0x65, 0x00, 0x91, 0x20, 0x1c, 0xfd, 0xf7, 
-0x67, 0xfc, 0xf8, 0x6d, 0x40, 0x09, 0x36, 0xd2, 0xb8, 0x6d, 0x06, 0x7b, 
-0x43, 0x7b, 0x1b, 0x02, 0x1e, 0x43, 0x17, 0x21, 0x49, 0x02, 0x01, 0x73, 
-0x0b, 0x0a, 0x43, 0x73, 0x00, 0x99, 0x20, 0x1c, 0xfd, 0xf7, 0x56, 0xfc, 
-0xb8, 0x6d, 0xc0, 0x46, 0x06, 0x73, 0x33, 0x0a, 0x43, 0x73, 0xf8, 0x6d, 
-0x40, 0x09, 0x20, 0xd2, 0x60, 0x68, 0x01, 0x04, 0x09, 0x0c, 0x03, 0x98, 
-0x01, 0xf0, 0xcc, 0xfc, 0x60, 0x68, 0x32, 0x4b, 0x18, 0x43, 0x60, 0x60, 
-0x20, 0x1c, 0x01, 0xf0, 0x35, 0xfd, 0x00, 0x25, 0x7d, 0x60, 0xbd, 0x60, 
-0x3d, 0x64, 0x7d, 0x64, 0x20, 0x1c, 0xfc, 0xf7, 0x3b, 0xff, 0x38, 0x88, 
-0x40, 0x23, 0x18, 0x43, 0x38, 0x80, 0x7d, 0x62, 0x29, 0x48, 0xc0, 0x46, 
-0xb8, 0x62, 0x38, 0x1c, 0x00, 0xf0, 0xa0, 0xfb, 0x44, 0xe0, 0x20, 0x68, 
-0x01, 0x23, 0x9b, 0x07, 0x08, 0x38, 0x18, 0x43, 0x00, 0x68, 0xc0, 0x46, 
-0x78, 0x64, 0x60, 0x68, 0x02, 0x04, 0x12, 0x0c, 0x78, 0x6e, 0x01, 0x26, 
-0xc1, 0x1d, 0x0d, 0x31, 0x8a, 0x42, 0x02, 0xd2, 0x3a, 0x64, 0x08, 0x1c, 
-0x0e, 0xe0, 0x41, 0x19, 0x89, 0x89, 0xf0, 0x23, 0x19, 0x40, 0x09, 0x09, 
-0x89, 0x00, 0x40, 0x18, 0xf8, 0x60, 0xf9, 0x61, 0x61, 0x68, 0x09, 0x04, 
-0x09, 0x0c, 0x81, 0x42, 0x16, 0xd2, 0x39, 0x64, 0x63, 0x68, 0x19, 0x04, 
+0x08, 0x60, 0x01, 0xf0, 0x9d, 0xfc, 0x03, 0x23, 0x1b, 0x07, 0x41, 0x68, 
+0x19, 0x40, 0x0c, 0x0f, 0x61, 0x01, 0x09, 0x1b, 0x89, 0x00, 0x18, 0x4a, 
+0x8f, 0x18, 0x01, 0x21, 0x39, 0x80, 0x81, 0x6a, 0xc0, 0x46, 0x79, 0x65, 
+0x41, 0x6a, 0xc0, 0x46, 0x79, 0x67, 0xb9, 0x6c, 0xfa, 0x6c, 0x89, 0x18, 
+0xb9, 0x64, 0x00, 0x21, 0xf9, 0x64, 0xba, 0x6b, 0x3b, 0x6d, 0xd2, 0x18, 
+0xba, 0x63, 0x39, 0x65, 0x42, 0x6a, 0x20, 0x32, 0x51, 0x71, 0x79, 0x6d, 
+0x7a, 0x6f, 0xd2, 0x6d, 0xc0, 0x46, 0x11, 0x60, 0xfc, 0xf7, 0xca, 0xff, 
+0x20, 0x01, 0x09, 0x49, 0x40, 0x18, 0x19, 0x23, 0xdb, 0x01, 0xc0, 0x18, 
+0x41, 0x6b, 0x01, 0x39, 0x41, 0x63, 0x78, 0x6f, 0x01, 0xf0, 0xc6, 0xfb, 
+0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 
+0x5c, 0x2b, 0x00, 0x80, 0xa0, 0x1c, 0x00, 0x80, 0xf0, 0xb5, 0x40, 0x20, 
+0x12, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x01, 0xf0, 0x59, 0xfc, 0x07, 0x1c, 
+0x40, 0x68, 0x03, 0x23, 0x1b, 0x07, 0x18, 0x40, 0x06, 0x0f, 0x70, 0x01, 
+0x80, 0x1b, 0x80, 0x00, 0x0c, 0x49, 0x44, 0x18, 0xb8, 0x6a, 0xc0, 0x46, 
+0x60, 0x65, 0x78, 0x6a, 0xc0, 0x46, 0x60, 0x67, 0x80, 0x6f, 0x05, 0x1d, 
+0xe5, 0x63, 0xb9, 0x69, 0x28, 0x1c, 0x02, 0xf0, 0x89, 0xf9, 0x38, 0x1c, 
+0x21, 0x1c, 0x32, 0x1c, 0x2b, 0x1c, 0x00, 0xf0, 0x20, 0xf8, 0xf0, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0xb0, 0x5c, 0x2b, 0x00, 0x80, 
+0xf0, 0xb5, 0x4b, 0x6f, 0x9b, 0x6f, 0x1f, 0x1d, 0xcf, 0x63, 0x05, 0x68, 
+0x00, 0x23, 0x84, 0x69, 0xa4, 0x08, 0x08, 0xd0, 0x9c, 0x00, 0x2e, 0x59, 
+0xc0, 0x46, 0x3e, 0x51, 0x84, 0x69, 0xa4, 0x08, 0x01, 0x33, 0x9c, 0x42, 
+0xf6, 0xd8, 0x3b, 0x1c, 0x00, 0xf0, 0x03, 0xf8, 0xf0, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0xff, 0xb5, 0x81, 0xb0, 0x04, 0x1c, 0x1d, 0x1c, 0x0f, 0x1c, 
+0x46, 0x48, 0x01, 0x69, 0x01, 0x31, 0x01, 0x61, 0xf9, 0x1d, 0x51, 0x31, 
+0xbd, 0x65, 0x00, 0x91, 0x20, 0x1c, 0xfd, 0xf7, 0x5d, 0xfc, 0xf8, 0x6d, 
+0x40, 0x09, 0x36, 0xd2, 0xb8, 0x6d, 0x06, 0x7b, 0x43, 0x7b, 0x1b, 0x02, 
+0x1e, 0x43, 0x17, 0x21, 0x49, 0x02, 0x01, 0x73, 0x0b, 0x0a, 0x43, 0x73, 
+0x00, 0x99, 0x20, 0x1c, 0xfd, 0xf7, 0x4c, 0xfc, 0xb8, 0x6d, 0xc0, 0x46, 
+0x06, 0x73, 0x33, 0x0a, 0x43, 0x73, 0xf8, 0x6d, 0x40, 0x09, 0x20, 0xd2, 
+0x60, 0x68, 0x01, 0x04, 0x09, 0x0c, 0x03, 0x98, 0x01, 0xf0, 0xcc, 0xfc, 
+0x60, 0x68, 0x32, 0x4b, 0x18, 0x43, 0x60, 0x60, 0x20, 0x1c, 0x01, 0xf0, 
+0x35, 0xfd, 0x00, 0x25, 0x7d, 0x60, 0xbd, 0x60, 0x3d, 0x64, 0x7d, 0x64, 
+0x20, 0x1c, 0xfc, 0xf7, 0x31, 0xff, 0x38, 0x88, 0x40, 0x23, 0x18, 0x43, 
+0x38, 0x80, 0x7d, 0x62, 0x29, 0x48, 0xc0, 0x46, 0xb8, 0x62, 0x38, 0x1c, 
+0x00, 0xf0, 0xa0, 0xfb, 0x44, 0xe0, 0x20, 0x68, 0x01, 0x23, 0x9b, 0x07, 
+0x08, 0x38, 0x18, 0x43, 0x00, 0x68, 0xc0, 0x46, 0x78, 0x64, 0x60, 0x68, 
+0x02, 0x04, 0x12, 0x0c, 0x78, 0x6e, 0x01, 0x26, 0xc1, 0x1d, 0x0d, 0x31, 
+0x8a, 0x42, 0x02, 0xd2, 0x3a, 0x64, 0x08, 0x1c, 0x0e, 0xe0, 0x41, 0x19, 
+0x89, 0x89, 0xf0, 0x23, 0x19, 0x40, 0x09, 0x09, 0x89, 0x00, 0x40, 0x18, 
+0xf8, 0x60, 0xf9, 0x61, 0x61, 0x68, 0x09, 0x04, 0x09, 0x0c, 0x81, 0x42, 
+0x16, 0xd2, 0x39, 0x64, 0x63, 0x68, 0x19, 0x04, 0x09, 0x0c, 0x40, 0x1a, 
+0x03, 0x30, 0x80, 0x08, 0x82, 0x00, 0xa0, 0x61, 
+0x20, 0x68, 0x09, 0x18, 0x9b, 0x18, 0x63, 0x60, 0xc3, 0x1f, 0x05, 0x3b, 
+0x38, 0x1c, 0x00, 0xf0, 0xb6, 0xfa, 0x7e, 0x80, 0x20, 0x1c, 0x00, 0xf0, 
+0xbf, 0xfb, 0x0b, 0xe0, 0xb9, 0x68, 0x08, 0x1a, 0x00, 0x25, 0x78, 0x62, 
+0xbd, 0x62, 0x38, 0x1c, 0x00, 0xf0, 0x3c, 0xfc, 0x20, 0x1c, 0x39, 0x1c, 
+0x00, 0xf0, 0x64, 0xf8, 0x05, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x0c, 0x2b, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 
+0xf0, 0xb5, 0x04, 0x1c, 0x0f, 0x1c, 0x38, 0x6c, 0xf9, 0x6b, 0x0d, 0x18, 
+0x21, 0x68, 0x41, 0x18, 0x00, 0x20, 0xa2, 0x69, 0x00, 0x2a, 0x0b, 0xd9, 
+0x82, 0x00, 0x56, 0x18, 0x01, 0x23, 0x9b, 0x07, 0x33, 0x43, 0x1b, 0x68, 
+0xc0, 0x46, 0xab, 0x50, 0xa2, 0x69, 0x01, 0x30, 0x82, 0x42, 0xf3, 0xd8, 
+0x78, 0x6e, 0xf9, 0x6b, 0x09, 0x18, 0x89, 0x89, 0xf0, 0x23, 0x19, 0x40, 
+0x09, 0x09, 0x89, 0x00, 0x40, 0x18, 0xf8, 0x60, 0xf9, 0x61, 0x20, 0x68, 
+0x01, 0x23, 0x9b, 0x07, 0x08, 0x38, 0x18, 0x43, 0x01, 0x68, 0x78, 0x6c, 
+0xfc, 0xf7, 0x95, 0xff, 0x78, 0x64, 0x60, 0x68, 0x01, 0x04, 0x09, 0x0c, 
+0xf8, 0x68, 0x81, 0x42, 0x19, 0xd2, 0x39, 0x64, 0x63, 0x68, 0x19, 0x04, 
 0x09, 0x0c, 0x40, 0x1a, 0x03, 0x30, 0x80, 0x08, 0x82, 0x00, 0xa0, 0x61, 
 0x20, 0x68, 0x09, 0x18, 0x9b, 0x18, 0x63, 0x60, 0xc3, 0x1f, 0x05, 0x3b, 
-0x38, 0x1c, 0x00, 0xf0, 0xb6, 0xfa, 0x7e, 0x80, 
-0x20, 0x1c, 0x00, 0xf0, 0xbf, 0xfb, 0x0b, 0xe0, 0xb9, 0x68, 0x08, 0x1a, 
-0x00, 0x25, 0x78, 0x62, 0xbd, 0x62, 0x38, 0x1c, 0x00, 0xf0, 0x3c, 0xfc, 
-0x20, 0x1c, 0x39, 0x1c, 0x00, 0xf0, 0x64, 0xf8, 0x05, 0xb0, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x0c, 0x2b, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 
-0x01, 0x00, 0x00, 0xc0, 0xf0, 0xb5, 0x04, 0x1c, 0x0f, 0x1c, 0x38, 0x6c, 
-0xf9, 0x6b, 0x0d, 0x18, 0x21, 0x68, 0x41, 0x18, 0x00, 0x20, 0xa2, 0x69, 
-0x00, 0x2a, 0x0b, 0xd9, 0x82, 0x00, 0x56, 0x18, 0x01, 0x23, 0x9b, 0x07, 
-0x33, 0x43, 0x1b, 0x68, 0xc0, 0x46, 0xab, 0x50, 0xa2, 0x69, 0x01, 0x30, 
-0x82, 0x42, 0xf3, 0xd8, 0x78, 0x6e, 0xf9, 0x6b, 0x09, 0x18, 0x89, 0x89, 
-0xf0, 0x23, 0x19, 0x40, 0x09, 0x09, 0x89, 0x00, 0x40, 0x18, 0xf8, 0x60, 
-0xf9, 0x61, 0x20, 0x68, 0x01, 0x23, 0x9b, 0x07, 0x08, 0x38, 0x18, 0x43, 
-0x01, 0x68, 0x78, 0x6c, 0xfc, 0xf7, 0x9f, 0xff, 0x78, 0x64, 0x60, 0x68, 
-0x01, 0x04, 0x09, 0x0c, 0xf8, 0x68, 0x81, 0x42, 0x19, 0xd2, 0x39, 0x64, 
-0x63, 0x68, 0x19, 0x04, 0x09, 0x0c, 0x40, 0x1a, 0x03, 0x30, 0x80, 0x08, 
-0x82, 0x00, 0xa0, 0x61, 0x20, 0x68, 0x09, 0x18, 0x9b, 0x18, 0x63, 0x60, 
-0xc3, 0x1f, 0x05, 0x3b, 0x38, 0x1c, 0x00, 0xf0, 0x56, 0xfa, 0x01, 0x20, 
-0x78, 0x80, 0x20, 0x1c, 0x00, 0xf0, 0x5e, 0xfb, 0xf0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0xb9, 0x68, 0x08, 0x1a, 0x78, 0x62, 0x00, 0x20, 0xb8, 0x62, 
-0x38, 0x1c, 0x00, 0xf0, 0xd9, 0xfb, 0x20, 0x1c, 0x39, 0x1c, 0x00, 0xf0, 
-0x01, 0xf8, 0xef, 0xe7, 0xf0, 0xb5, 0x84, 0xb0, 0x04, 0x1c, 0x0f, 0x1c, 
-0x8e, 0x48, 0x41, 0x69, 0x01, 0x31, 0x41, 0x61, 0x03, 0x20, 0x00, 0x07, 
-0x61, 0x68, 0x08, 0x40, 0x06, 0x0f, 0x0a, 0x04, 0x12, 0x0c, 0x20, 0x68, 
-0x11, 0x18, 0xfb, 0x68, 0xd2, 0x1a, 0x7b, 0x68, 0x9d, 0x1a, 0xc3, 0x1f, 
-0x05, 0x3b, 0x38, 0x1c, 0x2a, 0x1c, 0x00, 0xf0, 0x26, 0xfa, 0x00, 0x20, 
-0x78, 0x80, 0x20, 0x1c, 0x00, 0xf0, 0x2e, 0xfb, 0x60, 0x68, 0x40, 0x19, 
-0x01, 0x04, 0x09, 0x0c, 0x60, 0x60, 0x30, 0x1c, 0x01, 0xf0, 0xe0, 0xfb, 
-0x7d, 0x4e, 0x0b, 0x23, 0x1b, 0x02, 0xf0, 0x18, 0x00, 0x69, 0x00, 0x28, 
-0x19, 0xd0, 0x00, 0x25, 0x2d, 0x23, 0x9b, 0x01, 0xf0, 0x18, 0xc0, 0x68, 
-0x00, 0x28, 0x12, 0xd0, 0xaa, 0x00, 0x92, 0x19, 0x2d, 0x23, 0x9b, 0x01, 
-0xd2, 0x18, 0xd2, 0x68, 0x20, 0x1c, 0x39, 0x1c, 0x01, 0xf0, 0x1c, 0xfe, 
-0x01, 0x35, 0xa8, 0x00, 0x80, 0x19, 0x2d, 0x23, 0x9b, 0x01, 0xc0, 0x18, 
-0xc0, 0x68, 0x00, 0x28, 0xec, 0xd1, 0xf8, 0x6b, 0x01, 0x1f, 0x8a, 0x1c, 
-0xfa, 0x63, 0xfa, 0x68, 0x7d, 0x6c, 0x00, 0xf0, 0xbb, 0xf9, 0xc0, 0x43, 
-0x01, 0x04, 0x09, 0x0c, 0x28, 0x1c, 0xfc, 0xf7, 0x1a, 0xff, 0x03, 0x90, 
-0xf9, 0x6b, 0x3a, 0x6e, 0x8e, 0x18, 0x20, 0x68, 0x12, 0x18, 0x01, 0x92, 
-0x7a, 0x6e, 0x8d, 0x18, 0x11, 0x18, 0x02, 0x91, 0xc8, 0x1d, 0x09, 0x30, 
-0xe0, 0x60, 0xb1, 0x88, 0x08, 0x02, 0x09, 0x0a, 0x09, 0x06, 0x09, 0x0e, 
-0x08, 0x43, 0x00, 0x04, 0x00, 0x0c, 0x78, 0x61, 0x68, 0x68, 0x01, 0x0e, 
-0xff, 0x22, 0x12, 0x04, 0x02, 0x40, 0x12, 0x0a, 0x11, 0x43, 0xff, 0x22, 
-0x12, 0x02, 0x02, 0x40, 0x12, 0x02, 0x11, 0x43, 0x00, 0x06, 0x08, 0x43, 
-0x38, 0x61, 0xa8, 0x89, 0x09, 0x23, 0x1b, 0x02, 0x18, 0x40, 0xb8, 0x61, 
+0x38, 0x1c, 0x00, 0xf0, 0x56, 0xfa, 0x01, 0x20, 0x78, 0x80, 0x20, 0x1c, 
+0x00, 0xf0, 0x5e, 0xfb, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xb9, 0x68, 
+0x08, 0x1a, 0x78, 0x62, 0x00, 0x20, 0xb8, 0x62, 0x38, 0x1c, 0x00, 0xf0, 
+0xd9, 0xfb, 0x20, 0x1c, 0x39, 0x1c, 0x00, 0xf0, 0x01, 0xf8, 0xef, 0xe7, 
+0xf0, 0xb5, 0x84, 0xb0, 0x04, 0x1c, 0x0f, 0x1c, 0x8e, 0x48, 0x41, 0x69, 
+0x01, 0x31, 0x41, 0x61, 0x03, 0x20, 0x00, 0x07, 0x61, 0x68, 0x08, 0x40, 
+0x06, 0x0f, 0x0a, 0x04, 0x12, 0x0c, 0x20, 0x68, 0x11, 0x18, 0xfb, 0x68, 
+0xd2, 0x1a, 0x7b, 0x68, 0x9d, 0x1a, 0xc3, 0x1f, 0x05, 0x3b, 0x38, 0x1c, 
+0x2a, 0x1c, 0x00, 0xf0, 0x26, 0xfa, 0x00, 0x20, 0x78, 0x80, 0x20, 0x1c, 
+0x00, 0xf0, 0x2e, 0xfb, 0x60, 0x68, 0x40, 0x19, 0x01, 0x04, 0x09, 0x0c, 
+0x60, 0x60, 0x30, 0x1c, 0x01, 0xf0, 0xe0, 0xfb, 0x7d, 0x4e, 0x0b, 0x23, 
+0x1b, 0x02, 0xf0, 0x18, 0x00, 0x69, 0x00, 0x28, 0x19, 0xd0, 0x00, 0x25, 
+0x2d, 0x23, 0x9b, 0x01, 0xf0, 0x18, 0xc0, 0x68, 0x00, 0x28, 0x12, 0xd0, 
+0xaa, 0x00, 0x92, 0x19, 0x2d, 0x23, 0x9b, 0x01, 0xd2, 0x18, 0xd2, 0x68, 
+0x20, 0x1c, 0x39, 0x1c, 0x01, 0xf0, 0x1c, 0xfe, 0x01, 0x35, 0xa8, 0x00, 
+0x80, 0x19, 0x2d, 0x23, 0x9b, 0x01, 0xc0, 0x18, 0xc0, 0x68, 0x00, 0x28, 
+0xec, 0xd1, 0xf8, 0x6b, 0x01, 0x1f, 0x8a, 0x1c, 0xfa, 0x63, 0xfa, 0x68, 
+0x7d, 0x6c, 0x00, 0xf0, 0xbb, 0xf9, 0xc0, 0x43, 0x01, 0x04, 0x09, 0x0c, 
+0x28, 0x1c, 0xfc, 0xf7, 0x10, 0xff, 0x03, 0x90, 0xf9, 0x6b, 0x3a, 0x6e, 
+0x8e, 0x18, 0x20, 0x68, 0x12, 0x18, 0x01, 0x92, 0x7a, 0x6e, 0x8d, 0x18, 
+0x11, 0x18, 0x02, 0x91, 0xc8, 0x1d, 0x09, 0x30, 0xe0, 0x60, 0xb1, 0x88, 
+0x08, 0x02, 0x09, 0x0a, 0x09, 0x06, 0x09, 0x0e, 0x08, 0x43, 0x00, 0x04, 
+0x00, 0x0c, 0x78, 0x61, 0x68, 0x68, 0x01, 0x0e, 0xff, 0x22, 0x12, 0x04, 
+0x02, 0x40, 0x12, 0x0a, 0x11, 0x43, 0xff, 0x22, 0x12, 0x02, 0x02, 0x40, 
+0x12, 0x02, 0x11, 0x43, 0x00, 0x06, 0x08, 0x43, 0x38, 0x61, 0xa8, 0x89, 
+0x09, 0x23, 0x1b, 0x02, 0x18, 0x40, 0xb8, 0x61, 
 0xa8, 0x89, 0x98, 0x43, 0xa8, 0x81, 0xa8, 0x89, 0x02, 0x99, 0xc0, 0x46, 
-0x88, 0x81, 0x00, 0x20, 0x70, 0x80, 0xb0, 0x80, 
-0x70, 0x81, 0x68, 0x60, 0x28, 0x82, 0xb9, 0x6e, 0x30, 0x1c, 0xfc, 0xf7, 
-0xf2, 0xfe, 0x38, 0x86, 0xfa, 0x69, 0x30, 0x1c, 0x29, 0x1c, 0xfc, 0xf7, 
-0x0d, 0xff, 0x78, 0x86, 0x3d, 0x8e, 0x78, 0x8e, 0x03, 0x99, 0xfc, 0xf7, 
-0xd2, 0xfe, 0x00, 0x90, 0x60, 0x68, 0x00, 0x04, 0x00, 0x0c, 0x39, 0x6e, 
-0x41, 0x1a, 0x09, 0x04, 0x09, 0x0c, 0x7a, 0x6e, 0x82, 0x1a, 0x13, 0x04, 
-0x1b, 0x0c, 0x1a, 0x02, 0x1b, 0x0a, 0x1a, 0x43, 0x16, 0x04, 0x36, 0x0c, 
-0xba, 0x68, 0x82, 0x42, 0x01, 0xd2, 0x00, 0x20, 0x00, 0xe0, 0x10, 0x1a, 
-0xb8, 0x60, 0x08, 0x02, 0x09, 0x12, 0x09, 0x06, 0x09, 0x0e, 0x08, 0x43, 
-0x01, 0x04, 0x09, 0x0c, 0x01, 0x98, 0xc0, 0x46, 0x41, 0x80, 0x28, 0x1c, 
-0xfc, 0xf7, 0xad, 0xfe, 0x05, 0x1c, 0x00, 0x98, 0x31, 0x1c, 0xfc, 0xf7, 
-0xa8, 0xfe, 0x06, 0x1c, 0x78, 0x69, 0x00, 0x04, 0x00, 0x0c, 0x01, 0x02, 
-0x00, 0x0a, 0x08, 0x43, 0x01, 0x04, 0x09, 0x0c, 0x01, 0x98, 0xc0, 0x46, 
-0x81, 0x80, 0x28, 0x1c, 0xfc, 0xf7, 0x99, 0xfe, 0x79, 0x69, 0x01, 0x31, 
-0xc0, 0x43, 0x79, 0x61, 0x01, 0x9a, 0xc0, 0x46, 0x50, 0x81, 0x38, 0x69, 
-0x01, 0x0e, 0xff, 0x22, 0x12, 0x04, 0x02, 0x40, 0x12, 0x0a, 0x11, 0x43, 
-0xff, 0x22, 0x12, 0x02, 0x02, 0x40, 0x12, 0x02, 0x11, 0x43, 0x00, 0x06, 
-0x01, 0x43, 0x30, 0x1c, 0xfc, 0xf7, 0x81, 0xfe, 0x39, 0x69, 0x7a, 0x68, 
-0x89, 0x18, 0x39, 0x61, 0xb9, 0x68, 0x00, 0x29, 0x09, 0xd1, 0x02, 0x99, 
-0x89, 0x89, 0xba, 0x69, 0x11, 0x43, 0x02, 0x9a, 0xc0, 0x46, 0x91, 0x81, 
-0xb9, 0x69, 0xfc, 0xf7, 0x70, 0xfe, 0x20, 0x82, 0x00, 0x20, 0x60, 0x82, 
-0xf8, 0x6d, 0x41, 0x08, 0x16, 0xd3, 0x80, 0x0a, 0x0a, 0xd3, 0x60, 0x68, 
-0x10, 0x38, 0x01, 0x04, 0x09, 0x0c, 0x08, 0x02, 0x09, 0x0a, 0x08, 0x43, 
-0x21, 0x68, 0xc0, 0x46, 0x08, 0x82, 0x09, 0xe0, 0x60, 0x68, 0x0c, 0x38, 
-0x01, 0x04, 0x09, 0x0c, 0x08, 0x02, 0x09, 0x0a, 0x08, 0x43, 0x21, 0x68, 
-0xc0, 0x46, 0x88, 0x81, 0x04, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x0c, 0x2b, 0x00, 0x80, 0x68, 0x0e, 0x00, 0x80, 0xf1, 0xb5, 0x84, 0xb0, 
-0x6e, 0x4d, 0x28, 0x69, 0x01, 0x22, 0x04, 0x99, 0x8a, 0x40, 0x90, 0x43, 
-0x28, 0x61, 0x04, 0x98, 0x43, 0x01, 0x18, 0x1a, 0x80, 0x00, 0x16, 0x1c, 
-0x69, 0x49, 0x44, 0x18, 0xe0, 0x6b, 0xc0, 0x46, 0x00, 0x90, 0xa0, 0x68, 
-0x00, 0x28, 0x01, 0xd1, 0x00, 0x26, 0x26, 0xe0, 0x65, 0x48, 0x41, 0x69, 
-0x01, 0x31, 0x41, 0x61, 0x04, 0x98, 0xfc, 0xf7, 0x13, 0xfd, 0x07, 0x1c, 
-0x03, 0xd1, 0x28, 0x69, 0x30, 0x43, 0x28, 0x61, 0xb5, 0xe0, 0xa0, 0x68, 
-0x65, 0x68, 0xa8, 0x42, 0x00, 0xd2, 0x05, 0x1c, 0xa1, 0x6c, 0xa9, 0x42, 
-0x16, 0xd2, 0x40, 0x1a, 0x62, 0x6a, 0x10, 0x1a, 0x00, 0x26, 0x60, 0x62, 
-0xa6, 0x60, 0xa6, 0x62, 0x20, 0x88, 0x48, 0x23, 0x18, 0x43, 0x20, 0x80, 
-0x0d, 0x1c, 0x09, 0xd1, 0x38, 0x1c, 0xfc, 0xf7, 0x23, 0xfd, 0x03, 0x20, 
-0x60, 0x80, 0x66, 0x60, 0x20, 0x1c, 0x00, 0xf0, 0x8d, 0xf9, 0x96, 0xe0, 
-0xe1, 0x68, 0x38, 0x68, 0x09, 0x18, 0xc3, 0x1f, 0x05, 0x3b, 0x20, 0x1c, 
-0x02, 0x39, 0x2a, 0x1c, 0x00, 0xf0, 0xcd, 0xf8, 0x38, 0x1c, 0x00, 0xf0, 
-0xd7, 0xf9, 0xe0, 0x68, 0x46, 0x19, 0x78, 0x68, 0x30, 0x43, 0x78, 0x60, 
-0x04, 0x98, 0x31, 0x1c, 0x01, 0xf0, 0x88, 0xfa, 0x21, 0x6e, 0x00, 0x98, 
+0x88, 0x81, 0x00, 0x20, 0x70, 0x80, 0xb0, 0x80, 0x70, 0x81, 0x68, 0x60, 
+0x28, 0x82, 0xb9, 0x6e, 0x30, 0x1c, 0xfc, 0xf7, 0xe8, 0xfe, 0x38, 0x86, 
+0xfa, 0x69, 0x30, 0x1c, 0x29, 0x1c, 0xfc, 0xf7, 0x03, 0xff, 0x78, 0x86, 
+0x3d, 0x8e, 0x78, 0x8e, 0x03, 0x99, 0xfc, 0xf7, 0xc8, 0xfe, 0x00, 0x90, 
+0x60, 0x68, 0x00, 0x04, 0x00, 0x0c, 0x39, 0x6e, 0x41, 0x1a, 0x09, 0x04, 
+0x09, 0x0c, 0x7a, 0x6e, 0x82, 0x1a, 0x13, 0x04, 0x1b, 0x0c, 0x1a, 0x02, 
+0x1b, 0x0a, 0x1a, 0x43, 0x16, 0x04, 0x36, 0x0c, 0xba, 0x68, 0x82, 0x42, 
+0x01, 0xd2, 0x00, 0x20, 0x00, 0xe0, 0x10, 0x1a, 0xb8, 0x60, 0x08, 0x02, 
+0x09, 0x12, 0x09, 0x06, 0x09, 0x0e, 0x08, 0x43, 0x01, 0x04, 0x09, 0x0c, 
+0x01, 0x98, 0xc0, 0x46, 0x41, 0x80, 0x28, 0x1c, 0xfc, 0xf7, 0xa3, 0xfe, 
+0x05, 0x1c, 0x00, 0x98, 0x31, 0x1c, 0xfc, 0xf7, 0x9e, 0xfe, 0x06, 0x1c, 
+0x78, 0x69, 0x00, 0x04, 0x00, 0x0c, 0x01, 0x02, 0x00, 0x0a, 0x08, 0x43, 
+0x01, 0x04, 0x09, 0x0c, 0x01, 0x98, 0xc0, 0x46, 0x81, 0x80, 0x28, 0x1c, 
+0xfc, 0xf7, 0x8f, 0xfe, 0x79, 0x69, 0x01, 0x31, 0xc0, 0x43, 0x79, 0x61, 
+0x01, 0x9a, 0xc0, 0x46, 0x50, 0x81, 0x38, 0x69, 0x01, 0x0e, 0xff, 0x22, 
+0x12, 0x04, 0x02, 0x40, 0x12, 0x0a, 0x11, 0x43, 0xff, 0x22, 0x12, 0x02, 
+0x02, 0x40, 0x12, 0x02, 0x11, 0x43, 0x00, 0x06, 0x01, 0x43, 0x30, 0x1c, 
+0xfc, 0xf7, 0x77, 0xfe, 0x39, 0x69, 0x7a, 0x68, 0x89, 0x18, 0x39, 0x61, 
+0xb9, 0x68, 0x00, 0x29, 0x09, 0xd1, 0x02, 0x99, 0x89, 0x89, 0xba, 0x69, 
+0x11, 0x43, 0x02, 0x9a, 0xc0, 0x46, 0x91, 0x81, 0xb9, 0x69, 0xfc, 0xf7, 
+0x66, 0xfe, 0x20, 0x82, 0x00, 0x20, 0x60, 0x82, 0xf8, 0x6d, 0x41, 0x08, 
+0x16, 0xd3, 0x80, 0x0a, 0x0a, 0xd3, 0x60, 0x68, 0x10, 0x38, 0x01, 0x04, 
+0x09, 0x0c, 0x08, 0x02, 0x09, 0x0a, 0x08, 0x43, 0x21, 0x68, 0xc0, 0x46, 
+0x08, 0x82, 0x09, 0xe0, 0x60, 0x68, 0x0c, 0x38, 0x01, 0x04, 0x09, 0x0c, 
+0x08, 0x02, 0x09, 0x0a, 0x08, 0x43, 0x21, 0x68, 0xc0, 0x46, 0x88, 0x81, 
+0x04, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x0c, 0x2b, 0x00, 0x80, 
+0x68, 0x0e, 0x00, 0x80, 0xf1, 0xb5, 0x84, 0xb0, 0x6e, 0x4d, 0x28, 0x69, 
+0x01, 0x22, 0x04, 0x99, 0x8a, 0x40, 0x90, 0x43, 0x28, 0x61, 0x04, 0x98, 
+0x43, 0x01, 0x18, 0x1a, 0x80, 0x00, 0x16, 0x1c, 0x69, 0x49, 0x44, 0x18, 
+0xe0, 0x6b, 0xc0, 0x46, 0x00, 0x90, 0xa0, 0x68, 0x00, 0x28, 0x01, 0xd1, 
+0x00, 0x26, 0x26, 0xe0, 0x65, 0x48, 0x41, 0x69, 0x01, 0x31, 0x41, 0x61, 
+0x04, 0x98, 0xfc, 0xf7, 0x09, 0xfd, 0x07, 0x1c, 0x03, 0xd1, 0x28, 0x69, 
+0x30, 0x43, 0x28, 0x61, 0xb5, 0xe0, 0xa0, 0x68, 0x65, 0x68, 0xa8, 0x42, 
+0x00, 0xd2, 0x05, 0x1c, 0xa1, 0x6c, 0xa9, 0x42, 0x16, 0xd2, 0x40, 0x1a, 
+0x62, 0x6a, 0x10, 0x1a, 0x00, 0x26, 0x60, 0x62, 0xa6, 0x60, 0xa6, 0x62, 
+0x20, 0x88, 0x48, 0x23, 0x18, 0x43, 0x20, 0x80, 0x0d, 0x1c, 0x09, 0xd1, 
+0x38, 0x1c, 0xfc, 0xf7, 0x19, 0xfd, 0x03, 0x20, 0x60, 0x80, 0x66, 0x60, 
+0x20, 0x1c, 0x00, 0xf0, 0x8d, 0xf9, 0x96, 0xe0, 0xe1, 0x68, 0x38, 0x68, 
+0x09, 0x18, 0xc3, 0x1f, 0x05, 0x3b, 0x20, 0x1c, 0x02, 0x39, 0x2a, 0x1c, 
+0x00, 0xf0, 0xcd, 0xf8, 0x38, 0x1c, 0x00, 0xf0, 0xd7, 0xf9, 0xe0, 0x68, 
+0x46, 0x19, 0x78, 0x68, 0x30, 0x43, 0x78, 0x60, 0x04, 0x98, 0x31, 0x1c, 
+0x01, 0xf0, 0x88, 0xfa, 0x21, 0x6e, 0x00, 0x98, 
 0x08, 0x18, 0x01, 0x90, 0x70, 0x1a, 0x00, 0x04, 0x00, 0x0c, 0x61, 0x6e, 
-0x71, 0x1a, 0x0a, 0x04, 0x12, 0x0c, 0x11, 0x02, 
-0x12, 0x0a, 0x11, 0x43, 0x09, 0x04, 0x09, 0x0c, 0x02, 0x91, 0x01, 0x02, 
-0x00, 0x0a, 0x08, 0x43, 0x01, 0x04, 0x09, 0x0c, 0x01, 0x98, 0xc0, 0x46, 
-0x41, 0x80, 0x20, 0x8e, 0xfc, 0xf7, 0xd5, 0xfd, 0x06, 0x1c, 0x60, 0x8e, 
-0x02, 0x99, 0xfc, 0xf7, 0xd0, 0xfd, 0x03, 0x90, 0x60, 0x69, 0x01, 0x04, 
-0x09, 0x0c, 0x08, 0x02, 0x09, 0x0a, 0x08, 0x43, 0x01, 0x04, 0x09, 0x0c, 
-0x01, 0x98, 0xc0, 0x46, 0x81, 0x80, 0x30, 0x1c, 0xfc, 0xf7, 0xc1, 0xfd, 
-0x61, 0x69, 0x01, 0x31, 0xc0, 0x43, 0x61, 0x61, 0x01, 0x99, 0xc0, 0x46, 
-0x48, 0x81, 0x60, 0x6e, 0x00, 0x99, 0x46, 0x18, 0x20, 0x69, 0x01, 0x0e, 
-0xff, 0x22, 0x12, 0x04, 0x02, 0x40, 0x12, 0x0a, 0x11, 0x43, 0xff, 0x22, 
-0x12, 0x02, 0x02, 0x40, 0x12, 0x02, 0x11, 0x43, 0x00, 0x06, 0x01, 0x43, 
-0x71, 0x60, 0x03, 0x98, 0xfc, 0xf7, 0xa5, 0xfd, 0x21, 0x69, 0x49, 0x19, 
-0x21, 0x61, 0xa1, 0x68, 0x49, 0x1b, 0xa1, 0x60, 0x06, 0xd1, 0xb1, 0x89, 
-0xa2, 0x69, 0x11, 0x43, 0xb1, 0x81, 0xa1, 0x69, 0xfc, 0xf7, 0x97, 0xfd, 
-0x38, 0x82, 0x61, 0x6e, 0x38, 0x68, 0x09, 0x18, 0x0e, 0x31, 0xf9, 0x60, 
-0xe2, 0x68, 0x00, 0x99, 0x04, 0x38, 0x00, 0xf0, 0x4c, 0xf8, 0x02, 0x20, 
-0x78, 0x82, 0xe0, 0x6d, 0x41, 0x08, 0x16, 0xd3, 0x80, 0x0a, 0x0a, 0xd3, 
-0x78, 0x68, 0x10, 0x38, 0x01, 0x04, 0x09, 0x0c, 0x08, 0x02, 0x09, 0x0a, 
-0x08, 0x43, 0x39, 0x68, 0xc0, 0x46, 0xc8, 0x81, 0x09, 0xe0, 0x78, 0x68, 
-0x0c, 0x38, 0x01, 0x04, 0x09, 0x0c, 0x08, 0x02, 0x09, 0x0a, 0x08, 0x43, 
-0x39, 0x68, 0xc0, 0x46, 0x48, 0x81, 0x05, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0xd0, 0x2c, 0x00, 0x80, 0x5c, 0x2b, 0x00, 0x80, 
-0x0c, 0x2b, 0x00, 0x80, 0xf7, 0xb5, 0x03, 0x1c, 0x0f, 0x1c, 0x00, 0x20, 
-0x1c, 0x68, 0x26, 0x04, 0x31, 0x1c, 0x1d, 0x1d, 0xfc, 0xf7, 0x5b, 0xfd, 
-0x40, 0xc7, 0x02, 0x9a, 0xd1, 0x1c, 0x89, 0x08, 0x01, 0x39, 0x4a, 0x1e, 
-0x02, 0x92, 0x00, 0x29, 0x0d, 0xd0, 0x21, 0x0c, 0x10, 0xcd, 0x22, 0x04, 
-0x0a, 0x43, 0x11, 0x1c, 0x16, 0x1c, 0xfc, 0xf7, 0x4a, 0xfd, 0x40, 0xc7, 
-0x02, 0x99, 0x4a, 0x1e, 0x02, 0x92, 0x00, 0x29, 0xf1, 0xd1, 0x03, 0xb0, 
-0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x80, 0x08, 0x80, 0x00, 0x89, 0x08, 
-0x89, 0x00, 0x03, 0x32, 0x93, 0x08, 0x5a, 0x1e, 0x00, 0x2b, 0x05, 0xd0, 
-0x08, 0xc9, 0x08, 0xc0, 0x13, 0x1c, 0x01, 0x3a, 0x00, 0x2b, 0xf9, 0xd1, 
-0x70, 0x47, 0xff, 0xb5, 0x86, 0xb0, 0x17, 0x1c, 0x00, 0x26, 0x06, 0x98, 
-0x80, 0x6c, 0xc0, 0x1b, 0x06, 0x99, 0xc0, 0x46, 0x88, 0x64, 0x01, 0x20, 
-0xc0, 0x05, 0x06, 0x99, 0x89, 0x6b, 0xc0, 0x46, 0x01, 0x91, 0x06, 0x99, 
-0x4c, 0x6b, 0x67, 0xe0, 0x21, 0x68, 0xc0, 0x46, 0x02, 0x91, 0x61, 0x68, 
-0xc0, 0x46, 0x03, 0x91, 0xa1, 0x68, 0xc0, 0x46, 0x04, 0x91, 0x02, 0xa9, 
-0x49, 0x88, 0xb9, 0x42, 0x08, 0xd2, 0x02, 0xad, 0x6d, 0x88, 0x02, 0xa9, 
-0x49, 0x88, 0x7f, 0x1a, 0x00, 0x21, 0x02, 0xab, 0x59, 0x80, 0x19, 0xe0, 
-0x02, 0xa9, 0x49, 0x88, 0xc9, 0x1b, 0x02, 0xab, 0x59, 0x80, 0x3d, 0x1c, 
-0x00, 0x27, 0x01, 0x21, 0x49, 0x06, 0x07, 0x9b, 0x9a, 0x07, 0x92, 0x0f, 
-0x0d, 0xd0, 0xeb, 0x06, 0xdb, 0x0e, 0x08, 0xd0, 0x1e, 0x2b, 0x08, 0xd3, 
-0x1e, 0x2b, 0x02, 0xd1, 0x03, 0x2a, 0x04, 0xd1, 0x01, 0xe0, 0x02, 0x2a, 
+0x71, 0x1a, 0x0a, 0x04, 0x12, 0x0c, 0x11, 0x02, 0x12, 0x0a, 0x11, 0x43, 
+0x09, 0x04, 0x09, 0x0c, 0x02, 0x91, 0x01, 0x02, 0x00, 0x0a, 0x08, 0x43, 
+0x01, 0x04, 0x09, 0x0c, 0x01, 0x98, 0xc0, 0x46, 0x41, 0x80, 0x20, 0x8e, 
+0xfc, 0xf7, 0xcb, 0xfd, 0x06, 0x1c, 0x60, 0x8e, 0x02, 0x99, 0xfc, 0xf7, 
+0xc6, 0xfd, 0x03, 0x90, 0x60, 0x69, 0x01, 0x04, 0x09, 0x0c, 0x08, 0x02, 
+0x09, 0x0a, 0x08, 0x43, 0x01, 0x04, 0x09, 0x0c, 0x01, 0x98, 0xc0, 0x46, 
+0x81, 0x80, 0x30, 0x1c, 0xfc, 0xf7, 0xb7, 0xfd, 0x61, 0x69, 0x01, 0x31, 
+0xc0, 0x43, 0x61, 0x61, 0x01, 0x99, 0xc0, 0x46, 0x48, 0x81, 0x60, 0x6e, 
+0x00, 0x99, 0x46, 0x18, 0x20, 0x69, 0x01, 0x0e, 0xff, 0x22, 0x12, 0x04, 
+0x02, 0x40, 0x12, 0x0a, 0x11, 0x43, 0xff, 0x22, 0x12, 0x02, 0x02, 0x40, 
+0x12, 0x02, 0x11, 0x43, 0x00, 0x06, 0x01, 0x43, 0x71, 0x60, 0x03, 0x98, 
+0xfc, 0xf7, 0x9b, 0xfd, 0x21, 0x69, 0x49, 0x19, 0x21, 0x61, 0xa1, 0x68, 
+0x49, 0x1b, 0xa1, 0x60, 0x06, 0xd1, 0xb1, 0x89, 0xa2, 0x69, 0x11, 0x43, 
+0xb1, 0x81, 0xa1, 0x69, 0xfc, 0xf7, 0x8d, 0xfd, 0x38, 0x82, 0x61, 0x6e, 
+0x38, 0x68, 0x09, 0x18, 0x0e, 0x31, 0xf9, 0x60, 0xe2, 0x68, 0x00, 0x99, 
+0x04, 0x38, 0x00, 0xf0, 0x4c, 0xf8, 0x02, 0x20, 0x78, 0x82, 0xe0, 0x6d, 
+0x41, 0x08, 0x16, 0xd3, 0x80, 0x0a, 0x0a, 0xd3, 0x78, 0x68, 0x10, 0x38, 
+0x01, 0x04, 0x09, 0x0c, 0x08, 0x02, 0x09, 0x0a, 0x08, 0x43, 0x39, 0x68, 
+0xc0, 0x46, 0xc8, 0x81, 0x09, 0xe0, 0x78, 0x68, 0x0c, 0x38, 0x01, 0x04, 
+0x09, 0x0c, 0x08, 0x02, 0x09, 0x0a, 0x08, 0x43, 0x39, 0x68, 0xc0, 0x46, 
+0x48, 0x81, 0x05, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
+0xd0, 0x2c, 0x00, 0x80, 0x5c, 0x2b, 0x00, 0x80, 0x0c, 0x2b, 0x00, 0x80, 
+0xf7, 0xb5, 0x03, 0x1c, 0x0f, 0x1c, 0x00, 0x20, 0x1c, 0x68, 0x26, 0x04, 
+0x31, 0x1c, 0x1d, 0x1d, 0xfc, 0xf7, 0x51, 0xfd, 0x40, 0xc7, 0x02, 0x9a, 
+0xd1, 0x1c, 0x89, 0x08, 0x01, 0x39, 0x4a, 0x1e, 0x02, 0x92, 0x00, 0x29, 
+0x0d, 0xd0, 0x21, 0x0c, 0x10, 0xcd, 0x22, 0x04, 0x0a, 0x43, 0x11, 0x1c, 
+0x16, 0x1c, 0xfc, 0xf7, 0x40, 0xfd, 0x40, 0xc7, 0x02, 0x99, 0x4a, 0x1e, 
+0x02, 0x92, 0x00, 0x29, 0xf1, 0xd1, 0x03, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x80, 0x08, 0x80, 0x00, 0x89, 0x08, 0x89, 0x00, 0x03, 0x32, 
+0x93, 0x08, 0x5a, 0x1e, 0x00, 0x2b, 0x05, 0xd0, 0x08, 0xc9, 0x08, 0xc0, 
+0x13, 0x1c, 0x01, 0x3a, 0x00, 0x2b, 0xf9, 0xd1, 0x70, 0x47, 0xff, 0xb5, 
+0x86, 0xb0, 0x17, 0x1c, 0x00, 0x26, 0x06, 0x98, 0x80, 0x6c, 0xc0, 0x1b, 
+0x06, 0x99, 0xc0, 0x46, 0x88, 0x64, 0x01, 0x20, 0xc0, 0x05, 0x06, 0x99, 
+0x89, 0x6b, 0xc0, 0x46, 0x01, 0x91, 0x06, 0x99, 0x4c, 0x6b, 0x67, 0xe0, 
+0x21, 0x68, 0xc0, 0x46, 0x02, 0x91, 0x61, 0x68, 0xc0, 0x46, 0x03, 0x91, 
+0xa1, 0x68, 0xc0, 0x46, 0x04, 0x91, 0x02, 0xa9, 0x49, 0x88, 0xb9, 0x42, 
+0x08, 0xd2, 0x02, 0xad, 0x6d, 0x88, 0x02, 0xa9, 0x49, 0x88, 0x7f, 0x1a, 
+0x00, 0x21, 0x02, 0xab, 0x59, 0x80, 0x19, 0xe0, 0x02, 0xa9, 0x49, 0x88, 
+0xc9, 0x1b, 0x02, 0xab, 0x59, 0x80, 0x3d, 0x1c, 0x00, 0x27, 0x01, 0x21, 
+0x49, 0x06, 0x07, 0x9b, 0x9a, 0x07, 0x92, 0x0f, 0x0d, 0xd0, 0xeb, 0x06, 
+0xdb, 0x0e, 0x08, 0xd0, 0x1e, 0x2b, 0x08, 0xd3, 0x1e, 0x2b, 0x02, 0xd1, 
+0x03, 0x2a, 0x04, 0xd1, 0x01, 0xe0, 0x02, 0x2a, 
 0x01, 0xd3, 0x01, 0x26, 0x00, 0x21, 0x29, 0x43, 0x01, 0x43, 0x0a, 0x1c, 
-0x00, 0x91, 0x00, 0x20, 0x03, 0x99, 0x04, 0x9a, 
-0x07, 0x9b, 0x01, 0xf0, 0x5b, 0xff, 0x07, 0x99, 0x49, 0x19, 0x07, 0x91, 
-0x00, 0x2e, 0x0a, 0xd0, 0x1d, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0x1d, 0x48, 
-0x01, 0x6d, 0x42, 0x6d, 0x00, 0x20, 0x07, 0x9b, 0x01, 0xf0, 0x4c, 0xff, 
-0x00, 0x26, 0x02, 0xa8, 0x40, 0x88, 0x00, 0x28, 0x0c, 0xd0, 0x03, 0x98, 
-0x40, 0x19, 0x03, 0x90, 0x02, 0x98, 0xc0, 0x46, 0x20, 0x60, 0x03, 0x98, 
-0xc0, 0x46, 0x60, 0x60, 0x04, 0x98, 0xc0, 0x46, 0xa0, 0x60, 0x03, 0xe0, 
-0x01, 0x98, 0x01, 0x38, 0x01, 0x90, 0x10, 0x34, 0x06, 0x98, 0xc0, 0x46, 
-0x44, 0x63, 0x01, 0x98, 0x06, 0x99, 0xc0, 0x46, 0x88, 0x63, 0x00, 0x20, 
-0x00, 0x2f, 0x02, 0xd0, 0x01, 0x99, 0x00, 0x29, 0x92, 0xd1, 0x09, 0x4a, 
-0xc0, 0x46, 0x00, 0x92, 0x06, 0x48, 0x01, 0x6d, 0x42, 0x6d, 0x00, 0x20, 
-0x09, 0x9b, 0x01, 0xf0, 0x1f, 0xff, 0x0a, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x7c, 0x29, 0x00, 0x80, 
-0x04, 0x00, 0x53, 0x02, 0x90, 0xb5, 0x0c, 0x1c, 0x07, 0x1c, 0x38, 0x68, 
-0x01, 0x23, 0x9b, 0x07, 0x08, 0x38, 0x18, 0x43, 0x01, 0x68, 0x38, 0x8a, 
-0xfc, 0xf7, 0x8f, 0xfc, 0xc0, 0x43, 0xf9, 0x68, 0xc0, 0x46, 0x08, 0x80, 
-0x78, 0x8a, 0x39, 0x68, 0x08, 0x1a, 0x38, 0x60, 0x38, 0x1c, 0x01, 0xf0, 
-0x8b, 0xf9, 0x38, 0x1c, 0xfc, 0xf7, 0x96, 0xfb, 0x20, 0x1c, 0xff, 0xf7, 
-0x33, 0xfe, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x80, 0xb5, 0x01, 0x88, 
-0x8a, 0x09, 0x21, 0xd3, 0xca, 0x09, 0x1f, 0xd2, 0x8a, 0x08, 0x1d, 0xd3, 
-0x00, 0x21, 0x01, 0x80, 0x41, 0x80, 0x47, 0x6f, 0x40, 0x6d, 0xfa, 0x1d, 
-0x19, 0x32, 0x51, 0x71, 0xfa, 0x6d, 0xc0, 0x46, 0x10, 0x60, 0x3a, 0x6e, 
-0xc0, 0x46, 0x10, 0x60, 0x0c, 0x48, 0xc0, 0x46, 0x81, 0x63, 0xc1, 0x6b, 
-0x49, 0x08, 0x49, 0x00, 0xc1, 0x63, 0x01, 0x20, 0x00, 0xf0, 0xcc, 0xff, 
-0x38, 0x1c, 0x00, 0xf0, 0x6b, 0xff, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x80, 0x23, 0x19, 0x43, 0x01, 0x80, 0x01, 0x88, 0x49, 0x09, 0xf6, 0xd2, 
-0x00, 0xf0, 0xb0, 0xf8, 0xf3, 0xe7, 0x00, 0x00, 0xe8, 0x0e, 0x00, 0x80, 
-0xf0, 0xb5, 0x07, 0x1c, 0x10, 0x1c, 0x0d, 0x1c, 0x00, 0x24, 0x5e, 0x1e, 
-0x00, 0x2b, 0x19, 0xd0, 0x01, 0x68, 0xc0, 0x46, 0x39, 0x60, 0x41, 0x88, 
-0x0c, 0x19, 0x41, 0x68, 0xc0, 0x46, 0x79, 0x60, 0x81, 0x68, 0xc0, 0x46, 
-0xb9, 0x60, 0xc1, 0x68, 0xc0, 0x46, 0xf9, 0x60, 0x10, 0x30, 0x10, 0x37, 
-0xe9, 0x6a, 0x81, 0x42, 0x02, 0xd8, 0x28, 0x1c, 0x00, 0xf0, 0xec, 0xff, 
-0x31, 0x1c, 0x01, 0x3e, 0x00, 0x29, 0xe5, 0xd1, 0x20, 0x1c, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x00, 0x21, 0xc1, 0x61, 0x05, 0x49, 0x0a, 0x68, 
-0x00, 0x2a, 0x01, 0xd1, 0x08, 0x60, 0x02, 0xe0, 0x4a, 0x68, 0xc0, 0x46, 
-0xd0, 0x61, 0x48, 0x60, 0x70, 0x47, 0x00, 0x00, 0xd0, 0x2c, 0x00, 0x80, 
-0x03, 0x49, 0x08, 0x68, 0x00, 0x28, 0x02, 0xd0, 0xc2, 0x69, 0xc0, 0x46, 
-0x0a, 0x60, 0x70, 0x47, 0xd0, 0x2c, 0x00, 0x80, 0x00, 0x21, 0x81, 0x67, 
-0x05, 0x49, 0x8a, 0x68, 0x00, 0x2a, 0x01, 0xd1, 0x88, 0x60, 0x02, 0xe0, 
-0xca, 0x68, 0xc0, 0x46, 0x90, 0x67, 0xc8, 0x60, 0x70, 0x47, 0x00, 0x00, 
-0xd0, 0x2c, 0x00, 0x80, 0x03, 0x49, 0x88, 0x68, 0x00, 0x28, 0x02, 0xd0, 
-0x82, 0x6f, 0xc0, 0x46, 0x8a, 0x60, 0x70, 0x47, 0xd0, 0x2c, 0x00, 0x80, 
+0x00, 0x91, 0x00, 0x20, 0x03, 0x99, 0x04, 0x9a, 0x07, 0x9b, 0x01, 0xf0, 
+0x5b, 0xff, 0x07, 0x99, 0x49, 0x19, 0x07, 0x91, 0x00, 0x2e, 0x0a, 0xd0, 
+0x1d, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0x1d, 0x48, 0x01, 0x6d, 0x42, 0x6d, 
+0x00, 0x20, 0x07, 0x9b, 0x01, 0xf0, 0x4c, 0xff, 0x00, 0x26, 0x02, 0xa8, 
+0x40, 0x88, 0x00, 0x28, 0x0c, 0xd0, 0x03, 0x98, 0x40, 0x19, 0x03, 0x90, 
+0x02, 0x98, 0xc0, 0x46, 0x20, 0x60, 0x03, 0x98, 0xc0, 0x46, 0x60, 0x60, 
+0x04, 0x98, 0xc0, 0x46, 0xa0, 0x60, 0x03, 0xe0, 0x01, 0x98, 0x01, 0x38, 
+0x01, 0x90, 0x10, 0x34, 0x06, 0x98, 0xc0, 0x46, 0x44, 0x63, 0x01, 0x98, 
+0x06, 0x99, 0xc0, 0x46, 0x88, 0x63, 0x00, 0x20, 0x00, 0x2f, 0x02, 0xd0, 
+0x01, 0x99, 0x00, 0x29, 0x92, 0xd1, 0x09, 0x4a, 0xc0, 0x46, 0x00, 0x92, 
+0x06, 0x48, 0x01, 0x6d, 0x42, 0x6d, 0x00, 0x20, 0x09, 0x9b, 0x01, 0xf0, 
+0x1f, 0xff, 0x0a, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
+0x01, 0x00, 0x00, 0x02, 0x7c, 0x29, 0x00, 0x80, 0x04, 0x00, 0x53, 0x02, 
+0x90, 0xb5, 0x0c, 0x1c, 0x07, 0x1c, 0x38, 0x68, 0x01, 0x23, 0x9b, 0x07, 
+0x08, 0x38, 0x18, 0x43, 0x01, 0x68, 0x38, 0x8a, 0xfc, 0xf7, 0x85, 0xfc, 
+0xc0, 0x43, 0xf9, 0x68, 0xc0, 0x46, 0x08, 0x80, 0x78, 0x8a, 0x39, 0x68, 
+0x08, 0x1a, 0x38, 0x60, 0x38, 0x1c, 0x01, 0xf0, 0x8b, 0xf9, 0x38, 0x1c, 
+0xfc, 0xf7, 0x8c, 0xfb, 0x20, 0x1c, 0xff, 0xf7, 0x33, 0xfe, 0x90, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x80, 0xb5, 0x01, 0x88, 0x8a, 0x09, 0x21, 0xd3, 
+0xca, 0x09, 0x1f, 0xd2, 0x8a, 0x08, 0x1d, 0xd3, 0x00, 0x21, 0x01, 0x80, 
+0x41, 0x80, 0x47, 0x6f, 0x40, 0x6d, 0xfa, 0x1d, 0x19, 0x32, 0x51, 0x71, 
+0xfa, 0x6d, 0xc0, 0x46, 0x10, 0x60, 0x3a, 0x6e, 0xc0, 0x46, 0x10, 0x60, 
+0x0c, 0x48, 0xc0, 0x46, 0x81, 0x63, 0xc1, 0x6b, 0x49, 0x08, 0x49, 0x00, 
+0xc1, 0x63, 0x01, 0x20, 0x00, 0xf0, 0xcc, 0xff, 0x38, 0x1c, 0x00, 0xf0, 
+0x6b, 0xff, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x80, 0x23, 0x19, 0x43, 
+0x01, 0x80, 0x01, 0x88, 0x49, 0x09, 0xf6, 0xd2, 0x00, 0xf0, 0xb0, 0xf8, 
+0xf3, 0xe7, 0x00, 0x00, 0xe8, 0x0e, 0x00, 0x80, 0xf0, 0xb5, 0x07, 0x1c, 
+0x10, 0x1c, 0x0d, 0x1c, 0x00, 0x24, 0x5e, 0x1e, 0x00, 0x2b, 0x19, 0xd0, 
+0x01, 0x68, 0xc0, 0x46, 0x39, 0x60, 0x41, 0x88, 0x0c, 0x19, 0x41, 0x68, 
+0xc0, 0x46, 0x79, 0x60, 0x81, 0x68, 0xc0, 0x46, 0xb9, 0x60, 0xc1, 0x68, 
+0xc0, 0x46, 0xf9, 0x60, 0x10, 0x30, 0x10, 0x37, 0xe9, 0x6a, 0x81, 0x42, 
+0x02, 0xd8, 0x28, 0x1c, 0x00, 0xf0, 0xec, 0xff, 0x31, 0x1c, 0x01, 0x3e, 
+0x00, 0x29, 0xe5, 0xd1, 0x20, 0x1c, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x00, 0x21, 0xc1, 0x61, 0x05, 0x49, 0x0a, 0x68, 0x00, 0x2a, 0x01, 0xd1, 
+0x08, 0x60, 0x02, 0xe0, 0x4a, 0x68, 0xc0, 0x46, 0xd0, 0x61, 0x48, 0x60, 
+0x70, 0x47, 0x00, 0x00, 0xd0, 0x2c, 0x00, 0x80, 0x03, 0x49, 0x08, 0x68, 
+0x00, 0x28, 0x02, 0xd0, 0xc2, 0x69, 0xc0, 0x46, 0x0a, 0x60, 0x70, 0x47, 
+0xd0, 0x2c, 0x00, 0x80, 0x00, 0x21, 0x81, 0x67, 0x05, 0x49, 0x8a, 0x68, 
+0x00, 0x2a, 0x01, 0xd1, 0x88, 0x60, 0x02, 0xe0, 0xca, 0x68, 0xc0, 0x46, 
+0x90, 0x67, 0xc8, 0x60, 0x70, 0x47, 0x00, 0x00, 0xd0, 0x2c, 0x00, 0x80, 
+0x03, 0x49, 0x88, 0x68, 0x00, 0x28, 0x02, 0xd0, 0x82, 0x6f, 0xc0, 0x46, 
+0x8a, 0x60, 0x70, 0x47, 0xd0, 0x2c, 0x00, 0x80, 
 0x00, 0xb5, 0x80, 0x20, 0x13, 0x49, 0xc0, 0x46, 0x08, 0x60, 0xff, 0xf7, 
-0xd5, 0xff, 0x00, 0x28, 0x1b, 0xd0, 0x03, 0x23, 
-0x1b, 0x07, 0x41, 0x68, 0x19, 0x40, 0x0a, 0x0f, 0x51, 0x01, 0x89, 0x1a, 
-0x89, 0x00, 0x0d, 0x4b, 0xc9, 0x18, 0x4b, 0x88, 0x00, 0x2b, 0x04, 0xd1, 
-0x11, 0x1c, 0xff, 0xf7, 0x3b, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x01, 0x2b, 
-0x02, 0xd1, 0xff, 0xf7, 0x05, 0xfc, 0xf8, 0xe7, 0x02, 0x2b, 0xf6, 0xd1, 
-0xff, 0xf7, 0x4e, 0xfb, 0xf3, 0xe7, 0x04, 0x48, 0x01, 0x6d, 0x01, 0x31, 
-0x01, 0x65, 0xee, 0xe7, 0x00, 0x00, 0x00, 0xb0, 0x5c, 0x2b, 0x00, 0x80, 
-0xa0, 0x82, 0x20, 0x40, 0x00, 0xb5, 0x20, 0x20, 0x0d, 0x49, 0xc0, 0x46, 
-0x08, 0x60, 0xff, 0xf7, 0xbf, 0xff, 0x00, 0x28, 0x0e, 0xd0, 0x01, 0x88, 
-0x20, 0x23, 0x19, 0x43, 0x01, 0x80, 0x01, 0x88, 0x10, 0x23, 0x99, 0x43, 
-0x01, 0x80, 0x01, 0x88, 0x09, 0x0a, 0x01, 0xd3, 0xff, 0xf7, 0x2e, 0xff, 
-0x08, 0xbc, 0x18, 0x47, 0x03, 0x48, 0x01, 0x6d, 0x01, 0x31, 0x01, 0x65, 
-0xf8, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xa0, 0x82, 0x20, 0x40, 
-0x98, 0xb5, 0x07, 0x1c, 0x22, 0x48, 0xc0, 0x46, 0x00, 0x90, 0x22, 0x48, 
-0xc3, 0x1d, 0x41, 0x33, 0x41, 0x6d, 0x82, 0x6d, 0x80, 0x6c, 0x00, 0x03, 
-0x00, 0x0b, 0x9c, 0x68, 0x01, 0x23, 0x9b, 0x07, 0x23, 0x43, 0x1b, 0x68, 
-0x98, 0x42, 0x00, 0xd1, 0x0c, 0xe0, 0x98, 0x42, 0x03, 0xd9, 0x10, 0x1a, 
-0x59, 0x1a, 0x41, 0x18, 0x00, 0xe0, 0x19, 0x1a, 0x01, 0x20, 0x10, 0x29, 
-0x00, 0xd8, 0x00, 0x20, 0x00, 0x28, 0x1f, 0xd0, 0x78, 0x6a, 0xf9, 0x6a, 
-0xc0, 0x46, 0x08, 0x60, 0xb8, 0x6a, 0xf9, 0x6a, 0xc0, 0x46, 0x48, 0x60, 
-0x10, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0xfb, 0x6a, 0x0f, 0x48, 0x42, 0x6d, 
-0x03, 0x20, 0x39, 0x6a, 0x01, 0xf0, 0xe2, 0xfd, 0x38, 0x88, 0x10, 0x23, 
-0x18, 0x43, 0x38, 0x80, 0x38, 0x88, 0x40, 0x23, 0x98, 0x43, 0x38, 0x80, 
-0x38, 0x1c, 0xff, 0xf7, 0x55, 0xff, 0x98, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x38, 0x88, 0x40, 0x23, 0x18, 0x43, 0x38, 0x80, 0xf7, 0xe7, 0x00, 0x00, 
-0x55, 0x55, 0x55, 0x55, 0xa8, 0x03, 0x00, 0x80, 0x08, 0x00, 0x11, 0x02, 
-0x7c, 0x29, 0x00, 0x80, 0xb0, 0xb5, 0x40, 0x20, 0x2c, 0x49, 0xc0, 0x46, 
-0x08, 0x60, 0x00, 0xf0, 0xfd, 0xfe, 0x07, 0x1c, 0x40, 0x68, 0x03, 0x23, 
-0x1b, 0x07, 0x18, 0x40, 0x05, 0x0f, 0x68, 0x01, 0x40, 0x1b, 0x80, 0x00, 
-0x26, 0x49, 0x44, 0x18, 0x20, 0x88, 0x02, 0x23, 0x18, 0x43, 0x20, 0x80, 
-0x20, 0x88, 0x41, 0x08, 0x34, 0xd3, 0x40, 0x08, 0x40, 0x00, 0x20, 0x80, 
-0xa0, 0x6c, 0xe1, 0x6c, 0x40, 0x18, 0xa0, 0x64, 0x00, 0x20, 0xe0, 0x64, 
-0xa1, 0x6b, 0x22, 0x6d, 0x89, 0x18, 0xa1, 0x63, 0x20, 0x65, 0xb8, 0x6a, 
-0xc0, 0x46, 0x60, 0x65, 0x03, 0x23, 0x1b, 0x07, 0x78, 0x68, 0x18, 0x40, 
-0x78, 0x60, 0x61, 0x68, 0x36, 0x31, 0x94, 0x29, 0x04, 0xd8, 0x38, 0x23, 
-0x18, 0x43, 0x78, 0x60, 0x38, 0x20, 0x03, 0xe0, 0x94, 0x23, 0x18, 0x43, 
-0x78, 0x60, 0x94, 0x20, 0xb8, 0x61, 0x39, 0x68, 0x78, 0x68, 0x02, 0x04, 
-0x12, 0x0c, 0x20, 0x1c, 0xcb, 0x1f, 0x05, 0x3b, 0xff, 0xf7, 0xd7, 0xfd, 
-0x02, 0x20, 0x60, 0x80, 0x38, 0x1c, 0xff, 0xf7, 0xdf, 0xfe, 0xb0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x38, 0x1c, 0xfc, 0xf7, 0x11, 0xfa, 0x28, 0x01, 
-0x06, 0x49, 0x40, 0x18, 0x19, 0x23, 0xdb, 0x01, 0xc0, 0x18, 0x41, 0x6b, 
-0x01, 0x39, 0x41, 0x63, 0xef, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 
+0xd5, 0xff, 0x00, 0x28, 0x1b, 0xd0, 0x03, 0x23, 0x1b, 0x07, 0x41, 0x68, 
+0x19, 0x40, 0x0a, 0x0f, 0x51, 0x01, 0x89, 0x1a, 0x89, 0x00, 0x0d, 0x4b, 
+0xc9, 0x18, 0x4b, 0x88, 0x00, 0x2b, 0x04, 0xd1, 0x11, 0x1c, 0xff, 0xf7, 
+0x3b, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x01, 0x2b, 0x02, 0xd1, 0xff, 0xf7, 
+0x05, 0xfc, 0xf8, 0xe7, 0x02, 0x2b, 0xf6, 0xd1, 0xff, 0xf7, 0x4e, 0xfb, 
+0xf3, 0xe7, 0x04, 0x48, 0x01, 0x6d, 0x01, 0x31, 0x01, 0x65, 0xee, 0xe7, 
+0x00, 0x00, 0x00, 0xb0, 0x5c, 0x2b, 0x00, 0x80, 0xa0, 0x82, 0x20, 0x40, 
+0x00, 0xb5, 0x20, 0x20, 0x0d, 0x49, 0xc0, 0x46, 0x08, 0x60, 0xff, 0xf7, 
+0xbf, 0xff, 0x00, 0x28, 0x0e, 0xd0, 0x01, 0x88, 0x20, 0x23, 0x19, 0x43, 
+0x01, 0x80, 0x01, 0x88, 0x10, 0x23, 0x99, 0x43, 0x01, 0x80, 0x01, 0x88, 
+0x09, 0x0a, 0x01, 0xd3, 0xff, 0xf7, 0x2e, 0xff, 0x08, 0xbc, 0x18, 0x47, 
+0x03, 0x48, 0x01, 0x6d, 0x01, 0x31, 0x01, 0x65, 0xf8, 0xe7, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0xb0, 0xa0, 0x82, 0x20, 0x40, 0x98, 0xb5, 0x07, 0x1c, 
+0x22, 0x48, 0xc0, 0x46, 0x00, 0x90, 0x22, 0x48, 0xc3, 0x1d, 0x41, 0x33, 
+0x41, 0x6d, 0x82, 0x6d, 0x80, 0x6c, 0x00, 0x03, 0x00, 0x0b, 0x9c, 0x68, 
+0x01, 0x23, 0x9b, 0x07, 0x23, 0x43, 0x1b, 0x68, 0x98, 0x42, 0x00, 0xd1, 
+0x0c, 0xe0, 0x98, 0x42, 0x03, 0xd9, 0x10, 0x1a, 0x59, 0x1a, 0x41, 0x18, 
+0x00, 0xe0, 0x19, 0x1a, 0x01, 0x20, 0x10, 0x29, 0x00, 0xd8, 0x00, 0x20, 
+0x00, 0x28, 0x1f, 0xd0, 0x78, 0x6a, 0xf9, 0x6a, 0xc0, 0x46, 0x08, 0x60, 
+0xb8, 0x6a, 0xf9, 0x6a, 0xc0, 0x46, 0x48, 0x60, 0x10, 0x4a, 0xc0, 0x46, 
+0x00, 0x92, 0xfb, 0x6a, 0x0f, 0x48, 0x42, 0x6d, 0x03, 0x20, 0x39, 0x6a, 
+0x01, 0xf0, 0xe2, 0xfd, 0x38, 0x88, 0x10, 0x23, 0x18, 0x43, 0x38, 0x80, 
+0x38, 0x88, 0x40, 0x23, 0x98, 0x43, 0x38, 0x80, 0x38, 0x1c, 0xff, 0xf7, 
+0x55, 0xff, 0x98, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x38, 0x88, 0x40, 0x23, 
+0x18, 0x43, 0x38, 0x80, 0xf7, 0xe7, 0x00, 0x00, 0x55, 0x55, 0x55, 0x55, 
+0xa8, 0x03, 0x00, 0x80, 0x08, 0x00, 0x11, 0x02, 0x7c, 0x29, 0x00, 0x80, 
+0xb0, 0xb5, 0x40, 0x20, 0x2c, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x00, 0xf0, 
+0xfd, 0xfe, 0x07, 0x1c, 0x40, 0x68, 0x03, 0x23, 0x1b, 0x07, 0x18, 0x40, 
+0x05, 0x0f, 0x68, 0x01, 0x40, 0x1b, 0x80, 0x00, 0x26, 0x49, 0x44, 0x18, 
+0x20, 0x88, 0x02, 0x23, 0x18, 0x43, 0x20, 0x80, 0x20, 0x88, 0x41, 0x08, 
+0x34, 0xd3, 0x40, 0x08, 0x40, 0x00, 0x20, 0x80, 0xa0, 0x6c, 0xe1, 0x6c, 
+0x40, 0x18, 0xa0, 0x64, 0x00, 0x20, 0xe0, 0x64, 0xa1, 0x6b, 0x22, 0x6d, 
+0x89, 0x18, 0xa1, 0x63, 0x20, 0x65, 0xb8, 0x6a, 0xc0, 0x46, 0x60, 0x65, 
+0x03, 0x23, 0x1b, 0x07, 0x78, 0x68, 0x18, 0x40, 0x78, 0x60, 0x61, 0x68, 
+0x36, 0x31, 0x94, 0x29, 0x04, 0xd8, 0x38, 0x23, 0x18, 0x43, 0x78, 0x60, 
+0x38, 0x20, 0x03, 0xe0, 0x94, 0x23, 0x18, 0x43, 0x78, 0x60, 0x94, 0x20, 
+0xb8, 0x61, 0x39, 0x68, 0x78, 0x68, 0x02, 0x04, 0x12, 0x0c, 0x20, 0x1c, 
+0xcb, 0x1f, 0x05, 0x3b, 0xff, 0xf7, 0xd7, 0xfd, 0x02, 0x20, 0x60, 0x80, 
+0x38, 0x1c, 0xff, 0xf7, 0xdf, 0xfe, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x38, 0x1c, 0xfc, 0xf7, 0x07, 0xfa, 0x28, 0x01, 0x06, 0x49, 0x40, 0x18, 
+0x19, 0x23, 0xdb, 0x01, 0xc0, 0x18, 0x41, 0x6b, 0x01, 0x39, 0x41, 0x63, 
+0xef, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 
 0x5c, 0x2b, 0x00, 0x80, 0xa0, 0x1c, 0x00, 0x80, 0x90, 0xb5, 0x00, 0x27, 
-0x0f, 0x4c, 0x0d, 0xe0, 0x42, 0x6b, 0x01, 0x3a, 
-0x42, 0x63, 0x00, 0x2a, 0x05, 0xdc, 0x02, 0x6b, 0xc0, 0x46, 0x42, 0x63, 
-0xc0, 0x6a, 0x01, 0xf0, 0xc6, 0xf9, 0x01, 0x37, 0x0b, 0x2f, 0x07, 0xd2, 
-0x38, 0x01, 0x00, 0x19, 0x33, 0x23, 0x9b, 0x01, 0xc0, 0x18, 0x81, 0x6a, 
-0x00, 0x29, 0xe9, 0xd1, 0x01, 0x20, 0x40, 0x06, 0x03, 0x49, 0xc0, 0x46, 
-0x08, 0x60, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 
-0x00, 0x00, 0x00, 0xb0, 0x10, 0x48, 0xc1, 0x68, 0x01, 0x31, 0xc1, 0x60, 
-0x0f, 0x49, 0xc8, 0x68, 0x01, 0x28, 0x17, 0xd1, 0xc8, 0x1d, 0x79, 0x30, 
-0x02, 0x89, 0x00, 0x2a, 0x12, 0xd0, 0x01, 0x3a, 0x02, 0x81, 0x02, 0x89, 
-0x00, 0x2a, 0x0d, 0xd1, 0x42, 0x89, 0x00, 0x2a, 0x08, 0xd1, 0xc9, 0x6f, 
-0x02, 0x23, 0x0a, 0x68, 0x1a, 0x43, 0x0a, 0x60, 0x04, 0x21, 0x01, 0x81, 
-0x01, 0x21, 0x00, 0xe0, 0x00, 0x21, 0x41, 0x81, 0x70, 0x47, 0x00, 0x00, 
-0x08, 0x83, 0x20, 0x40, 0x68, 0x0e, 0x00, 0x80, 0xb0, 0xb5, 0x07, 0x1c, 
-0x01, 0x23, 0xf8, 0x1d, 0x69, 0x30, 0x03, 0x73, 0x1e, 0x48, 0xc2, 0x1d, 
-0x79, 0x32, 0x54, 0x8a, 0x61, 0x1c, 0x51, 0x82, 0xd5, 0x8a, 0x00, 0x21, 
-0xac, 0x42, 0x04, 0xdb, 0xc4, 0x1d, 0x89, 0x34, 0x63, 0x70, 0x51, 0x82, 
-0xd1, 0x83, 0x01, 0x23, 0x9b, 0x07, 0x3a, 0x6d, 0x1a, 0x43, 0x12, 0x68, 
-0xc0, 0x46, 0xba, 0x61, 0xfb, 0x69, 0x9a, 0x42, 0x06, 0xd1, 0xf8, 0x6c, 
-0x12, 0x49, 0xc0, 0x46, 0x08, 0x60, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x79, 0x61, 0x41, 0x69, 0xfa, 0x6c, 0x91, 0x43, 0x41, 0x61, 0x01, 0x20, 
-0x00, 0x05, 0xc1, 0x60, 0x38, 0x69, 0x02, 0x28, 0xf1, 0xd0, 0xb8, 0x69, 
-0xf9, 0x69, 0x41, 0x1a, 0x01, 0xd5, 0x78, 0x6d, 0x41, 0x18, 0x38, 0x1c, 
-0x00, 0xf0, 0x0e, 0xf8, 0xf9, 0x69, 0x09, 0x18, 0xf9, 0x61, 0x78, 0x6d, 
-0x81, 0x42, 0xe2, 0xd3, 0x08, 0x1a, 0xf8, 0x61, 0xdf, 0xe7, 0x00, 0x00, 
-0x68, 0x0e, 0x00, 0x80, 0x00, 0x00, 0x00, 0xb0, 0xf8, 0xb5, 0x04, 0x1c, 
-0x0f, 0x1c, 0xff, 0x23, 0x21, 0x33, 0x9f, 0x42, 0x01, 0xd9, 0xff, 0x27, 
-0x21, 0x37, 0xe1, 0x6e, 0x38, 0x1c, 0x01, 0xf0, 0xcb, 0xfc, 0x2d, 0x4d, 
-0x00, 0x28, 0x13, 0xd1, 0xe0, 0x1d, 0x49, 0x30, 0x01, 0x7a, 0x01, 0x23, 
-0x19, 0x43, 0x01, 0x72, 0x29, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0x29, 0x48, 
-0x01, 0x6d, 0x42, 0x6d, 0x00, 0x20, 0x2b, 0x1c, 0x01, 0xf0, 0xb0, 0xfc, 
-0x00, 0x20, 0xf8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x20, 0x69, 0x01, 0x30, 
-0x20, 0x61, 0x23, 0x49, 0xc8, 0x1d, 0xb9, 0x30, 0x02, 0x6b, 0x92, 0x00, 
-0x51, 0x18, 0xc0, 0x31, 0x0f, 0x61, 0x01, 0x6b, 0x01, 0x31, 0x89, 0x07, 
-0x89, 0x0f, 0x01, 0x63, 0x20, 0x6b, 0xc2, 0x19, 0x61, 0x6d, 0x8a, 0x42, 
-0x03, 0xd8, 0x23, 0x22, 0x12, 0x05, 0x3a, 0x43, 0x05, 0xe0, 0x09, 0x1a, 
-0x7e, 0x1a, 0x07, 0xd1, 0x23, 0x22, 0x12, 0x05, 0x0a, 0x43, 0x00, 0x92, 
-0x61, 0x6e, 0x09, 0x18, 0xa2, 0x6e, 0x10, 0xe0, 0x11, 0x22, 0x52, 0x05, 
-0x0a, 0x43, 0x00, 0x92, 0x61, 0x6e, 0x09, 0x18, 0x00, 0x20, 0xa2, 0x6e, 
-0x2b, 0x1c, 0x01, 0xf0, 0x7d, 0xfc, 0x23, 0x22, 0x12, 0x05, 0x32, 0x43, 
-0x00, 0x92, 0x61, 0x6e, 0xa2, 0x6e, 0x00, 0x20, 0x2b, 0x1c, 0x01, 0xf0, 
-0x73, 0xfc, 0x20, 0x6b, 0xc0, 0x19, 0x00, 0x09, 0x00, 0x01, 0x61, 0x6d, 
-0x81, 0x42, 0x00, 0xd8, 0x40, 0x1a, 0x20, 0x63, 0x38, 0x1c, 0xb8, 0xe7, 
+0x0f, 0x4c, 0x0d, 0xe0, 0x42, 0x6b, 0x01, 0x3a, 0x42, 0x63, 0x00, 0x2a, 
+0x05, 0xdc, 0x02, 0x6b, 0xc0, 0x46, 0x42, 0x63, 0xc0, 0x6a, 0x01, 0xf0, 
+0xc6, 0xf9, 0x01, 0x37, 0x0b, 0x2f, 0x07, 0xd2, 0x38, 0x01, 0x00, 0x19, 
+0x33, 0x23, 0x9b, 0x01, 0xc0, 0x18, 0x81, 0x6a, 0x00, 0x29, 0xe9, 0xd1, 
+0x01, 0x20, 0x40, 0x06, 0x03, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x90, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 0x00, 0x00, 0x00, 0xb0, 
+0x10, 0x48, 0xc1, 0x68, 0x01, 0x31, 0xc1, 0x60, 0x0f, 0x49, 0xc8, 0x68, 
+0x01, 0x28, 0x17, 0xd1, 0xc8, 0x1d, 0x79, 0x30, 0x02, 0x89, 0x00, 0x2a, 
+0x12, 0xd0, 0x01, 0x3a, 0x02, 0x81, 0x02, 0x89, 0x00, 0x2a, 0x0d, 0xd1, 
+0x42, 0x89, 0x00, 0x2a, 0x08, 0xd1, 0xc9, 0x6f, 0x02, 0x23, 0x0a, 0x68, 
+0x1a, 0x43, 0x0a, 0x60, 0x04, 0x21, 0x01, 0x81, 0x01, 0x21, 0x00, 0xe0, 
+0x00, 0x21, 0x41, 0x81, 0x70, 0x47, 0x00, 0x00, 0x08, 0x83, 0x20, 0x40, 
+0x68, 0x0e, 0x00, 0x80, 0xb0, 0xb5, 0x07, 0x1c, 0x01, 0x23, 0xf8, 0x1d, 
+0x69, 0x30, 0x03, 0x73, 0x1e, 0x48, 0xc2, 0x1d, 0x79, 0x32, 0x54, 0x8a, 
+0x61, 0x1c, 0x51, 0x82, 0xd5, 0x8a, 0x00, 0x21, 0xac, 0x42, 0x04, 0xdb, 
+0xc4, 0x1d, 0x89, 0x34, 0x63, 0x70, 0x51, 0x82, 0xd1, 0x83, 0x01, 0x23, 
+0x9b, 0x07, 0x3a, 0x6d, 0x1a, 0x43, 0x12, 0x68, 0xc0, 0x46, 0xba, 0x61, 
+0xfb, 0x69, 0x9a, 0x42, 0x06, 0xd1, 0xf8, 0x6c, 0x12, 0x49, 0xc0, 0x46, 
+0x08, 0x60, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x79, 0x61, 0x41, 0x69, 
+0xfa, 0x6c, 0x91, 0x43, 0x41, 0x61, 0x01, 0x20, 0x00, 0x05, 0xc1, 0x60, 
+0x38, 0x69, 0x02, 0x28, 0xf1, 0xd0, 0xb8, 0x69, 0xf9, 0x69, 0x41, 0x1a, 
+0x01, 0xd5, 0x78, 0x6d, 0x41, 0x18, 0x38, 0x1c, 0x00, 0xf0, 0x0e, 0xf8, 
+0xf9, 0x69, 0x09, 0x18, 0xf9, 0x61, 0x78, 0x6d, 0x81, 0x42, 0xe2, 0xd3, 
+0x08, 0x1a, 0xf8, 0x61, 0xdf, 0xe7, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 
+0x00, 0x00, 0x00, 0xb0, 0xf8, 0xb5, 0x04, 0x1c, 0x0f, 0x1c, 0xff, 0x23, 
+0x21, 0x33, 0x9f, 0x42, 0x01, 0xd9, 0xff, 0x27, 0x21, 0x37, 0xe1, 0x6e, 
+0x38, 0x1c, 0x01, 0xf0, 0xcb, 0xfc, 0x2d, 0x4d, 0x00, 0x28, 0x13, 0xd1, 
+0xe0, 0x1d, 0x49, 0x30, 0x01, 0x7a, 0x01, 0x23, 0x19, 0x43, 0x01, 0x72, 
+0x29, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0x29, 0x48, 0x01, 0x6d, 0x42, 0x6d, 
+0x00, 0x20, 0x2b, 0x1c, 0x01, 0xf0, 0xb0, 0xfc, 0x00, 0x20, 0xf8, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x20, 0x69, 0x01, 0x30, 0x20, 0x61, 0x23, 0x49, 
+0xc8, 0x1d, 0xb9, 0x30, 0x02, 0x6b, 0x92, 0x00, 0x51, 0x18, 0xc0, 0x31, 
+0x0f, 0x61, 0x01, 0x6b, 0x01, 0x31, 0x89, 0x07, 0x89, 0x0f, 0x01, 0x63, 
+0x20, 0x6b, 0xc2, 0x19, 0x61, 0x6d, 0x8a, 0x42, 0x03, 0xd8, 0x23, 0x22, 
+0x12, 0x05, 0x3a, 0x43, 0x05, 0xe0, 0x09, 0x1a, 0x7e, 0x1a, 0x07, 0xd1, 
+0x23, 0x22, 0x12, 0x05, 0x0a, 0x43, 0x00, 0x92, 0x61, 0x6e, 0x09, 0x18, 
+0xa2, 0x6e, 0x10, 0xe0, 0x11, 0x22, 0x52, 0x05, 0x0a, 0x43, 0x00, 0x92, 
+0x61, 0x6e, 0x09, 0x18, 0x00, 0x20, 0xa2, 0x6e, 0x2b, 0x1c, 0x01, 0xf0, 
+0x7d, 0xfc, 0x23, 0x22, 0x12, 0x05, 0x32, 0x43, 0x00, 0x92, 0x61, 0x6e, 
+0xa2, 0x6e, 0x00, 0x20, 0x2b, 0x1c, 0x01, 0xf0, 0x73, 0xfc, 0x20, 0x6b, 
+0xc0, 0x19, 0x00, 0x09, 0x00, 0x01, 0x61, 0x6d, 0x81, 0x42, 0x00, 0xd8, 
+0x40, 0x1a, 0x20, 0x63, 0x38, 0x1c, 0xb8, 0xe7, 
 0x44, 0x80, 0x20, 0x40, 0x04, 0x00, 0x1b, 0x02, 0x7c, 0x29, 0x00, 0x80, 
-0x68, 0x0e, 0x00, 0x80, 0x80, 0xb5, 0x01, 0x20, 
-0xc0, 0x03, 0x0d, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x0c, 0x49, 0xc8, 0x1d, 
-0x49, 0x30, 0x02, 0x7a, 0x00, 0x27, 0x00, 0x2a, 0x03, 0xd0, 0x07, 0x72, 
-0x08, 0x1c, 0xff, 0xf7, 0x37, 0xff, 0x08, 0x49, 0xc8, 0x1d, 0x49, 0x30, 
-0x02, 0x7a, 0x00, 0x2a, 0x03, 0xd0, 0x07, 0x72, 0x08, 0x1c, 0xff, 0xf7, 
-0x2d, 0xff, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0xb0, 
-0x64, 0x2d, 0x00, 0x80, 0xe4, 0x2c, 0x00, 0x80, 0x90, 0xb5, 0x07, 0x1c, 
-0x10, 0x20, 0x18, 0x49, 0xc0, 0x46, 0x08, 0x60, 0xf8, 0x68, 0x01, 0x30, 
-0xf8, 0x60, 0x16, 0x48, 0xc4, 0x1d, 0xb9, 0x34, 0x61, 0x6b, 0x89, 0x00, 
-0x09, 0x18, 0xc0, 0x31, 0x09, 0x69, 0x7a, 0x68, 0x92, 0x00, 0xd2, 0x19, 
-0x51, 0x64, 0x61, 0x6b, 0x89, 0x00, 0x08, 0x18, 0xc0, 0x30, 0x01, 0x69, 
-0x78, 0x68, 0x80, 0x00, 0xc0, 0x19, 0xc0, 0x6b, 0x01, 0xf0, 0xa2, 0xfa, 
-0x01, 0x23, 0x78, 0x68, 0x58, 0x40, 0x78, 0x60, 0x60, 0x6b, 0x01, 0x30, 
-0x80, 0x07, 0x80, 0x0f, 0x60, 0x63, 0xf8, 0x1d, 0x19, 0x30, 0x40, 0x79, 
-0x00, 0x28, 0x02, 0xd1, 0x38, 0x1c, 0x00, 0xf0, 0x07, 0xf8, 0x90, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0xb0, 0x68, 0x0e, 0x00, 0x80, 
-0x90, 0xb5, 0x07, 0x1c, 0x39, 0x48, 0xc0, 0x68, 0x00, 0x28, 0x05, 0xd0, 
-0xb8, 0x6a, 0xc0, 0x68, 0x80, 0x09, 0x01, 0xd3, 0x02, 0x20, 0x00, 0xe0, 
-0x78, 0x6f, 0xfc, 0xf7, 0x63, 0xf8, 0x04, 0x1c, 0x06, 0xd1, 0x01, 0x20, 
-0xf9, 0x1d, 0x19, 0x31, 0x08, 0x71, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0xf8, 0x6c, 0x2f, 0x49, 0xc0, 0x46, 0x08, 0x60, 0xba, 0x6a, 0x38, 0x1c, 
-0x21, 0x1c, 0x00, 0xf0, 0x59, 0xf8, 0x67, 0x62, 0x00, 0x28, 0x03, 0xd1, 
-0x20, 0x1c, 0x00, 0xf0, 0x0b, 0xfd, 0xec, 0xe7, 0xf9, 0x6d, 0x09, 0x68, 
-0x09, 0x18, 0x09, 0x09, 0x09, 0x01, 0x7a, 0x6d, 0x8a, 0x42, 0x00, 0xd8, 
-0x89, 0x1a, 0xa1, 0x62, 0xb9, 0x68, 0x89, 0x00, 0xc9, 0x19, 0x4a, 0x6c, 
-0x00, 0x2a, 0x07, 0xd0, 0x4a, 0x6c, 0x12, 0x1a, 0x4a, 0x64, 0x80, 0x08, 
-0x80, 0x00, 0xb9, 0x6a, 0x08, 0x18, 0xb8, 0x62, 0x38, 0x68, 0xb9, 0x6a, 
-0x80, 0x00, 0xc0, 0x19, 0x42, 0x6b, 0x91, 0x42, 0x0e, 0xd3, 0x00, 0x21, 
-0x41, 0x64, 0xb8, 0x6a, 0x39, 0x68, 0x89, 0x00, 0xc9, 0x19, 0x49, 0x6b, 
-0x40, 0x1a, 0xb8, 0x62, 0xb9, 0x68, 0x89, 0x00, 0xc9, 0x19, 0xc9, 0x6b, 
-0x40, 0x18, 0xb8, 0x62, 0xb8, 0x68, 0x81, 0x00, 0xc9, 0x19, 0x49, 0x6c, 
-0x00, 0x29, 0xb8, 0xd1, 0xb9, 0x6a, 0xfa, 0x6b, 0x91, 0x42, 0xb4, 0xd0, 
-0x3a, 0x6c, 0x91, 0x42, 0xb1, 0xd0, 0x01, 0x23, 0x58, 0x40, 0xb8, 0x60, 
-0x80, 0x00, 0xc0, 0x19, 0xc0, 0x6b, 0xc0, 0x46, 0xb8, 0x62, 0xf8, 0x68, 
-0x00, 0x28, 0x01, 0xd0, 0x01, 0x38, 0xf8, 0x60, 0x38, 0x69, 0x00, 0x28, 
-0xa1, 0xd0, 0x01, 0x38, 0x38, 0x61, 0x9e, 0xe7, 0x68, 0x19, 0x00, 0x80, 
-0x00, 0x00, 0x00, 0xb0, 0xf7, 0xb5, 0x90, 0xb0, 0x04, 0x1c, 0x0d, 0x1c, 
-0x00, 0x20, 0x05, 0x90, 0x02, 0x90, 0x00, 0x22, 0x01, 0x92, 0xf9, 0x48, 
-0xc0, 0x6a, 0xc0, 0x46, 0xa8, 0x61, 0xa0, 0x68, 0x81, 0x00, 0x09, 0x19, 
-0x49, 0x6b, 0xc0, 0x46, 0x20, 0x60, 0xe1, 0x62, 0x12, 0x9a, 0xd0, 0x68, 
-0xc0, 0x46, 0xa8, 0x60, 0x12, 0x9a, 0x51, 0x78, 0xc0, 0x46, 0x0c, 0x91, 
-0xf0, 0x48, 0xc0, 0x46, 0x03, 0x90, 0xd7, 0x1d, 0x09, 0x37, 0xe0, 0x6a, 
+0x68, 0x0e, 0x00, 0x80, 0x80, 0xb5, 0x01, 0x20, 0xc0, 0x03, 0x0d, 0x49, 
+0xc0, 0x46, 0x08, 0x60, 0x0c, 0x49, 0xc8, 0x1d, 0x49, 0x30, 0x02, 0x7a, 
+0x00, 0x27, 0x00, 0x2a, 0x03, 0xd0, 0x07, 0x72, 0x08, 0x1c, 0xff, 0xf7, 
+0x37, 0xff, 0x08, 0x49, 0xc8, 0x1d, 0x49, 0x30, 0x02, 0x7a, 0x00, 0x2a, 
+0x03, 0xd0, 0x07, 0x72, 0x08, 0x1c, 0xff, 0xf7, 0x2d, 0xff, 0x80, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0xb0, 0x64, 0x2d, 0x00, 0x80, 
+0xe4, 0x2c, 0x00, 0x80, 0x90, 0xb5, 0x07, 0x1c, 0x10, 0x20, 0x18, 0x49, 
+0xc0, 0x46, 0x08, 0x60, 0xf8, 0x68, 0x01, 0x30, 0xf8, 0x60, 0x16, 0x48, 
+0xc4, 0x1d, 0xb9, 0x34, 0x61, 0x6b, 0x89, 0x00, 0x09, 0x18, 0xc0, 0x31, 
+0x09, 0x69, 0x7a, 0x68, 0x92, 0x00, 0xd2, 0x19, 0x51, 0x64, 0x61, 0x6b, 
+0x89, 0x00, 0x08, 0x18, 0xc0, 0x30, 0x01, 0x69, 0x78, 0x68, 0x80, 0x00, 
+0xc0, 0x19, 0xc0, 0x6b, 0x01, 0xf0, 0xa2, 0xfa, 0x01, 0x23, 0x78, 0x68, 
+0x58, 0x40, 0x78, 0x60, 0x60, 0x6b, 0x01, 0x30, 0x80, 0x07, 0x80, 0x0f, 
+0x60, 0x63, 0xf8, 0x1d, 0x19, 0x30, 0x40, 0x79, 0x00, 0x28, 0x02, 0xd1, 
+0x38, 0x1c, 0x00, 0xf0, 0x07, 0xf8, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x00, 0x00, 0x00, 0xb0, 0x68, 0x0e, 0x00, 0x80, 0x90, 0xb5, 0x07, 0x1c, 
+0x39, 0x48, 0xc0, 0x68, 0x00, 0x28, 0x05, 0xd0, 0xb8, 0x6a, 0xc0, 0x68, 
+0x80, 0x09, 0x01, 0xd3, 0x02, 0x20, 0x00, 0xe0, 0x78, 0x6f, 0xfc, 0xf7, 
+0x59, 0xf8, 0x04, 0x1c, 0x06, 0xd1, 0x01, 0x20, 0xf9, 0x1d, 0x19, 0x31, 
+0x08, 0x71, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xf8, 0x6c, 0x2f, 0x49, 
+0xc0, 0x46, 0x08, 0x60, 0xba, 0x6a, 0x38, 0x1c, 0x21, 0x1c, 0x00, 0xf0, 
+0x59, 0xf8, 0x67, 0x62, 0x00, 0x28, 0x03, 0xd1, 0x20, 0x1c, 0x00, 0xf0, 
+0x0b, 0xfd, 0xec, 0xe7, 0xf9, 0x6d, 0x09, 0x68, 0x09, 0x18, 0x09, 0x09, 
+0x09, 0x01, 0x7a, 0x6d, 0x8a, 0x42, 0x00, 0xd8, 0x89, 0x1a, 0xa1, 0x62, 
+0xb9, 0x68, 0x89, 0x00, 0xc9, 0x19, 0x4a, 0x6c, 0x00, 0x2a, 0x07, 0xd0, 
+0x4a, 0x6c, 0x12, 0x1a, 0x4a, 0x64, 0x80, 0x08, 0x80, 0x00, 0xb9, 0x6a, 
+0x08, 0x18, 0xb8, 0x62, 0x38, 0x68, 0xb9, 0x6a, 0x80, 0x00, 0xc0, 0x19, 
+0x42, 0x6b, 0x91, 0x42, 0x0e, 0xd3, 0x00, 0x21, 0x41, 0x64, 0xb8, 0x6a, 
+0x39, 0x68, 0x89, 0x00, 0xc9, 0x19, 0x49, 0x6b, 0x40, 0x1a, 0xb8, 0x62, 
+0xb9, 0x68, 0x89, 0x00, 0xc9, 0x19, 0xc9, 0x6b, 0x40, 0x18, 0xb8, 0x62, 
+0xb8, 0x68, 0x81, 0x00, 0xc9, 0x19, 0x49, 0x6c, 0x00, 0x29, 0xb8, 0xd1, 
+0xb9, 0x6a, 0xfa, 0x6b, 0x91, 0x42, 0xb4, 0xd0, 0x3a, 0x6c, 0x91, 0x42, 
+0xb1, 0xd0, 0x01, 0x23, 0x58, 0x40, 0xb8, 0x60, 0x80, 0x00, 0xc0, 0x19, 
+0xc0, 0x6b, 0xc0, 0x46, 0xb8, 0x62, 0xf8, 0x68, 0x00, 0x28, 0x01, 0xd0, 
+0x01, 0x38, 0xf8, 0x60, 0x38, 0x69, 0x00, 0x28, 0xa1, 0xd0, 0x01, 0x38, 
+0x38, 0x61, 0x9e, 0xe7, 0x68, 0x19, 0x00, 0x80, 0x00, 0x00, 0x00, 0xb0, 
+0xf7, 0xb5, 0x90, 0xb0, 0x04, 0x1c, 0x0d, 0x1c, 0x00, 0x20, 0x05, 0x90, 
+0x02, 0x90, 0x00, 0x22, 0x01, 0x92, 0xf9, 0x48, 0xc0, 0x6a, 0xc0, 0x46, 
+0xa8, 0x61, 0xa0, 0x68, 0x81, 0x00, 0x09, 0x19, 0x49, 0x6b, 0xc0, 0x46, 
+0x20, 0x60, 0xe1, 0x62, 0x12, 0x9a, 0xd0, 0x68, 0xc0, 0x46, 0xa8, 0x60, 
+0x12, 0x9a, 0x51, 0x78, 0xc0, 0x46, 0x0c, 0x91, 0xf0, 0x48, 0xc0, 0x46, 
+0x03, 0x90, 0xd7, 0x1d, 0x09, 0x37, 0xe0, 0x6a, 
 0xc1, 0x1b, 0x09, 0x09, 0xe3, 0x1d, 0x19, 0x33, 0x0c, 0x9a, 0xc0, 0x46, 
-0x0f, 0x93, 0xeb, 0x4b, 0xc0, 0x46, 0x0e, 0x93, 
-0x91, 0x42, 0x01, 0xd3, 0xb8, 0x42, 0x21, 0xd8, 0xe1, 0x68, 0x02, 0x29, 
-0x1e, 0xd2, 0x01, 0x20, 0x0f, 0x99, 0xc0, 0x46, 0x48, 0x71, 0x00, 0x20, 
-0x03, 0x99, 0x01, 0xf0, 0x57, 0xfb, 0x00, 0x28, 0x03, 0xd1, 0x0e, 0x9b, 
-0xd8, 0x6b, 0x01, 0x30, 0xd8, 0x63, 0x01, 0x20, 0x80, 0x06, 0x00, 0x27, 
-0x68, 0x60, 0xaf, 0x61, 0xdd, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0xdd, 0x48, 
-0x01, 0x6d, 0x42, 0x6d, 0xdc, 0x4b, 0x00, 0x20, 0x01, 0xf0, 0x3a, 0xfb, 
-0x38, 0x1c, 0x5c, 0xe3, 0xb8, 0x42, 0x03, 0xd8, 0x20, 0x1c, 0x00, 0xf0, 
-0x7b, 0xfc, 0x07, 0x1c, 0xd7, 0x48, 0xc0, 0x68, 0x00, 0x28, 0x64, 0xd0, 
-0x38, 0x78, 0x40, 0x07, 0x40, 0x0f, 0x03, 0x28, 0x60, 0xd1, 0x05, 0x98, 
-0x01, 0x30, 0x00, 0x06, 0x00, 0x0e, 0x05, 0x90, 0x38, 0x78, 0xf0, 0x23, 
-0x18, 0x40, 0x58, 0xd1, 0xe0, 0x6a, 0xc0, 0x1b, 0x00, 0x09, 0x0c, 0x99, 
-0x88, 0x42, 0x02, 0xd2, 0xe0, 0x68, 0x02, 0x28, 0x05, 0xd3, 0xcb, 0x49, 
-0x88, 0x68, 0x00, 0xf0, 0x83, 0xff, 0x06, 0x1c, 0x06, 0xd1, 0x03, 0x9b, 
-0x28, 0x1c, 0x39, 0x1c, 0x22, 0x1c, 0x00, 0xf0, 0x8b, 0xfc, 0x16, 0xe1, 
-0x2e, 0x62, 0xf8, 0x68, 0x00, 0x28, 0x0d, 0xd0, 0xb8, 0x89, 0x00, 0x28, 
-0x03, 0xd0, 0xc1, 0x49, 0xc9, 0x68, 0x00, 0xf0, 0x70, 0xff, 0xf8, 0x89, 
-0x00, 0x28, 0x03, 0xd0, 0xbd, 0x49, 0xc9, 0x68, 0x00, 0xf0, 0x69, 0xff, 
-0x7a, 0x68, 0xc0, 0x46, 0x72, 0x61, 0xb9, 0x68, 0xc0, 0x46, 0xb1, 0x61, 
-0x30, 0x1c, 0xb8, 0x49, 0x09, 0x68, 0x00, 0xf0, 0x5e, 0xff, 0x00, 0x28, 
-0x17, 0xd1, 0x30, 0x1c, 0xb4, 0x49, 0x49, 0x68, 0x00, 0xf0, 0x57, 0xff, 
-0x10, 0x37, 0xe0, 0x6a, 0xb8, 0x42, 0x03, 0xd8, 0x20, 0x1c, 0x00, 0xf0, 
-0x27, 0xfc, 0x07, 0x1c, 0x68, 0x68, 0xaf, 0x4b, 0x18, 0x43, 0x68, 0x60, 
-0x00, 0x20, 0xa8, 0x61, 0xac, 0x23, 0xa8, 0x68, 0x98, 0x43, 0xa8, 0x60, 
-0xb0, 0xe0, 0xa8, 0x69, 0xa8, 0x28, 0x01, 0xd2, 0xa8, 0x20, 0xa8, 0x61, 
-0x10, 0x37, 0xe0, 0x6a, 0xb8, 0x42, 0x6c, 0xd8, 0x9c, 0xe0, 0xa5, 0xe0, 
-0xa4, 0xe0, 0x10, 0x28, 0x68, 0xd1, 0x03, 0x23, 0x1b, 0x07, 0x68, 0x68, 
-0x18, 0x40, 0x01, 0x0f, 0x48, 0x01, 0x40, 0x1a, 0x80, 0x00, 0xa0, 0x4a, 
-0x82, 0x18, 0x01, 0x92, 0x78, 0x88, 0x42, 0x0b, 0x31, 0xd3, 0x82, 0x0b, 
-0x2f, 0xd3, 0x9d, 0x48, 0xc0, 0x46, 0x03, 0x90, 0x02, 0x20, 0x01, 0x9a, 
-0xc0, 0x46, 0x10, 0x80, 0x78, 0x88, 0x00, 0x05, 0x00, 0x0d, 0x01, 0x9a, 
-0xc0, 0x46, 0x50, 0x60, 0xb8, 0x68, 0x01, 0x9a, 0xc0, 0x46, 0x90, 0x60, 
-0x78, 0x68, 0x01, 0x9a, 0xc0, 0x46, 0x10, 0x62, 0x00, 0x20, 0x01, 0x9a, 
-0xc0, 0x46, 0x90, 0x64, 0x01, 0x9a, 0xc0, 0x46, 0x90, 0x63, 0x88, 0x02, 
-0x8f, 0x49, 0x40, 0x18, 0x01, 0x9a, 0xc0, 0x46, 0x50, 0x63, 0x01, 0x9a, 
-0x50, 0x68, 0x36, 0x30, 0x94, 0x28, 0x01, 0xd8, 0x38, 0x20, 0x00, 0xe0, 
-0x94, 0x20, 0xa8, 0x61, 0x10, 0x37, 0xe0, 0x6a, 0xb8, 0x42, 0x28, 0xd8, 
-0x58, 0xe0, 0x7a, 0x88, 0x92, 0x0b, 0x03, 0xd3, 0x85, 0x48, 0xc0, 0x46, 
-0x03, 0x90, 0x23, 0xe0, 0x01, 0x22, 0x12, 0x03, 0x02, 0x40, 0x83, 0x4b, 
-0x1d, 0xd0, 0x03, 0x93, 0x00, 0x05, 0x00, 0x0d, 0x01, 0x9a, 0xc0, 0x46, 
-0x50, 0x60, 0xb8, 0x68, 0x01, 0x9a, 0xc0, 0x46, 0x90, 0x60, 0x78, 0x68, 
-0x01, 0x9a, 0xc0, 0x46, 0x10, 0x62, 0x00, 0x20, 0x01, 0x9a, 0xc0, 0x46, 
+0x0f, 0x93, 0xeb, 0x4b, 0xc0, 0x46, 0x0e, 0x93, 0x91, 0x42, 0x01, 0xd3, 
+0xb8, 0x42, 0x21, 0xd8, 0xe1, 0x68, 0x02, 0x29, 0x1e, 0xd2, 0x01, 0x20, 
+0x0f, 0x99, 0xc0, 0x46, 0x48, 0x71, 0x00, 0x20, 0x03, 0x99, 0x01, 0xf0, 
+0x57, 0xfb, 0x00, 0x28, 0x03, 0xd1, 0x0e, 0x9b, 0xd8, 0x6b, 0x01, 0x30, 
+0xd8, 0x63, 0x01, 0x20, 0x80, 0x06, 0x00, 0x27, 0x68, 0x60, 0xaf, 0x61, 
+0xdd, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0xdd, 0x48, 0x01, 0x6d, 0x42, 0x6d, 
+0xdc, 0x4b, 0x00, 0x20, 0x01, 0xf0, 0x3a, 0xfb, 0x38, 0x1c, 0x5c, 0xe3, 
+0xb8, 0x42, 0x03, 0xd8, 0x20, 0x1c, 0x00, 0xf0, 0x7b, 0xfc, 0x07, 0x1c, 
+0xd7, 0x48, 0xc0, 0x68, 0x00, 0x28, 0x64, 0xd0, 0x38, 0x78, 0x40, 0x07, 
+0x40, 0x0f, 0x03, 0x28, 0x60, 0xd1, 0x05, 0x98, 0x01, 0x30, 0x00, 0x06, 
+0x00, 0x0e, 0x05, 0x90, 0x38, 0x78, 0xf0, 0x23, 0x18, 0x40, 0x58, 0xd1, 
+0xe0, 0x6a, 0xc0, 0x1b, 0x00, 0x09, 0x0c, 0x99, 0x88, 0x42, 0x02, 0xd2, 
+0xe0, 0x68, 0x02, 0x28, 0x05, 0xd3, 0xcb, 0x49, 0x88, 0x68, 0x00, 0xf0, 
+0x83, 0xff, 0x06, 0x1c, 0x06, 0xd1, 0x03, 0x9b, 0x28, 0x1c, 0x39, 0x1c, 
+0x22, 0x1c, 0x00, 0xf0, 0x8b, 0xfc, 0x16, 0xe1, 0x2e, 0x62, 0xf8, 0x68, 
+0x00, 0x28, 0x0d, 0xd0, 0xb8, 0x89, 0x00, 0x28, 0x03, 0xd0, 0xc1, 0x49, 
+0xc9, 0x68, 0x00, 0xf0, 0x70, 0xff, 0xf8, 0x89, 0x00, 0x28, 0x03, 0xd0, 
+0xbd, 0x49, 0xc9, 0x68, 0x00, 0xf0, 0x69, 0xff, 0x7a, 0x68, 0xc0, 0x46, 
+0x72, 0x61, 0xb9, 0x68, 0xc0, 0x46, 0xb1, 0x61, 0x30, 0x1c, 0xb8, 0x49, 
+0x09, 0x68, 0x00, 0xf0, 0x5e, 0xff, 0x00, 0x28, 0x17, 0xd1, 0x30, 0x1c, 
+0xb4, 0x49, 0x49, 0x68, 0x00, 0xf0, 0x57, 0xff, 0x10, 0x37, 0xe0, 0x6a, 
+0xb8, 0x42, 0x03, 0xd8, 0x20, 0x1c, 0x00, 0xf0, 0x27, 0xfc, 0x07, 0x1c, 
+0x68, 0x68, 0xaf, 0x4b, 0x18, 0x43, 0x68, 0x60, 0x00, 0x20, 0xa8, 0x61, 
+0xac, 0x23, 0xa8, 0x68, 0x98, 0x43, 0xa8, 0x60, 0xb0, 0xe0, 0xa8, 0x69, 
+0xa8, 0x28, 0x01, 0xd2, 0xa8, 0x20, 0xa8, 0x61, 0x10, 0x37, 0xe0, 0x6a, 
+0xb8, 0x42, 0x6c, 0xd8, 0x9c, 0xe0, 0xa5, 0xe0, 0xa4, 0xe0, 0x10, 0x28, 
+0x68, 0xd1, 0x03, 0x23, 0x1b, 0x07, 0x68, 0x68, 0x18, 0x40, 0x01, 0x0f, 
+0x48, 0x01, 0x40, 0x1a, 0x80, 0x00, 0xa0, 0x4a, 0x82, 0x18, 0x01, 0x92, 
+0x78, 0x88, 0x42, 0x0b, 0x31, 0xd3, 0x82, 0x0b, 0x2f, 0xd3, 0x9d, 0x48, 
+0xc0, 0x46, 0x03, 0x90, 0x02, 0x20, 0x01, 0x9a, 0xc0, 0x46, 0x10, 0x80, 
+0x78, 0x88, 0x00, 0x05, 0x00, 0x0d, 0x01, 0x9a, 0xc0, 0x46, 0x50, 0x60, 
+0xb8, 0x68, 0x01, 0x9a, 0xc0, 0x46, 0x90, 0x60, 0x78, 0x68, 0x01, 0x9a, 
+0xc0, 0x46, 0x10, 0x62, 0x00, 0x20, 0x01, 0x9a, 0xc0, 0x46, 0x90, 0x64, 
+0x01, 0x9a, 0xc0, 0x46, 0x90, 0x63, 0x88, 0x02, 0x8f, 0x49, 0x40, 0x18, 
+0x01, 0x9a, 0xc0, 0x46, 0x50, 0x63, 0x01, 0x9a, 0x50, 0x68, 0x36, 0x30, 
+0x94, 0x28, 0x01, 0xd8, 0x38, 0x20, 0x00, 0xe0, 0x94, 0x20, 0xa8, 0x61, 
+0x10, 0x37, 0xe0, 0x6a, 0xb8, 0x42, 0x28, 0xd8, 0x58, 0xe0, 0x7a, 0x88, 
+0x92, 0x0b, 0x03, 0xd3, 0x85, 0x48, 0xc0, 0x46, 0x03, 0x90, 0x23, 0xe0, 
+0x01, 0x22, 0x12, 0x03, 0x02, 0x40, 0x83, 0x4b, 0x1d, 0xd0, 0x03, 0x93, 
+0x00, 0x05, 0x00, 0x0d, 0x01, 0x9a, 0xc0, 0x46, 0x50, 0x60, 0xb8, 0x68, 
+0x01, 0x9a, 0xc0, 0x46, 0x90, 0x60, 0x78, 0x68, 0x01, 0x9a, 0xc0, 0x46, 
+0x10, 0x62, 0x00, 0x20, 0x01, 0x9a, 0xc0, 0x46, 
 0x90, 0x64, 0x01, 0x9a, 0xc0, 0x46, 0x90, 0x63, 0x88, 0x02, 0x75, 0x49, 
-0x40, 0x18, 0x01, 0x9a, 0xc0, 0x46, 0x50, 0x63, 
-0x02, 0xe0, 0x33, 0xe0, 0x2a, 0xe0, 0x03, 0x93, 0x01, 0x20, 0x0f, 0x99, 
-0xc0, 0x46, 0x48, 0x71, 0x12, 0x9a, 0x50, 0x78, 0x05, 0x99, 0x43, 0x1a, 
-0x0b, 0x93, 0x10, 0x37, 0xe0, 0x6a, 0xb8, 0x42, 0x03, 0xd8, 0x20, 0x1c, 
-0x00, 0xf0, 0x92, 0xfb, 0x07, 0x1c, 0x01, 0x9a, 0x50, 0x6b, 0x91, 0x6b, 
-0x09, 0x01, 0x40, 0x18, 0x0b, 0x9b, 0x21, 0x1c, 0x3a, 0x1c, 0xff, 0xf7, 
-0x7d, 0xfb, 0x01, 0x9a, 0xc0, 0x46, 0xd0, 0x64, 0x01, 0x9a, 0x0b, 0x9b, 
-0xc0, 0x46, 0x13, 0x65, 0x01, 0x23, 0x5b, 0x06, 0x68, 0x68, 0x18, 0x43, 
-0x68, 0x60, 0x00, 0x20, 0xa8, 0x61, 0x0d, 0xe0, 0x10, 0x37, 0xe0, 0x6a, 
-0xb8, 0x42, 0x03, 0xd8, 0x20, 0x1c, 0x00, 0xf0, 0x71, 0xfb, 0x07, 0x1c, 
-0x38, 0x78, 0x40, 0x07, 0x40, 0x0f, 0x03, 0x28, 0x00, 0xd1, 0xf8, 0xe6, 
-0xa8, 0x69, 0x03, 0x99, 0x01, 0xf0, 0x26, 0xfa, 0x00, 0x28, 0x2a, 0xd1, 
-0x38, 0x1c, 0x21, 0x1c, 0x00, 0xf0, 0x79, 0xfb, 0xa8, 0x68, 0x80, 0x09, 
-0x04, 0xd3, 0x30, 0x1c, 0x49, 0x49, 0x49, 0x68, 0x00, 0xf0, 0x81, 0xfe, 
-0x41, 0x49, 0x00, 0x20, 0x01, 0xf0, 0x14, 0xfa, 0x00, 0x28, 0x04, 0xd1, 
-0x0e, 0x9b, 0xd8, 0x6b, 0x01, 0x30, 0xd8, 0x63, 0x11, 0xe0, 0x01, 0x20, 
-0x0f, 0x99, 0xc0, 0x46, 0x48, 0x71, 0x80, 0x06, 0x00, 0x27, 0x68, 0x60, 
-0xaf, 0x61, 0x3a, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0x39, 0x48, 0x01, 0x6d, 
-0x42, 0x6d, 0x39, 0x4b, 0x00, 0x20, 0x01, 0xf0, 0xf3, 0xf9, 0x00, 0x20, 
-0x15, 0xe2, 0x05, 0x98, 0x0c, 0x99, 0x08, 0x1a, 0x00, 0x04, 0x00, 0x0c, 
-0x0c, 0x90, 0x0b, 0x90, 0x0c, 0x98, 0x00, 0x28, 0x03, 0xd0, 0x01, 0x20, 
-0x0f, 0x99, 0xc0, 0x46, 0x48, 0x71, 0x28, 0x68, 0xc0, 0x46, 0x04, 0x90, 
-0x00, 0x26, 0x00, 0x20, 0x08, 0x90, 0x00, 0x22, 0x0a, 0x92, 0x0c, 0x98, 
-0x01, 0x38, 0x0d, 0x90, 0xa3, 0xe0, 0x78, 0x88, 0x8a, 0x1b, 0x12, 0x04, 
-0x12, 0x0c, 0x90, 0x42, 0x05, 0xdd, 0x07, 0x92, 0x80, 0x1a, 0x00, 0x04, 
-0x00, 0x0c, 0x08, 0x90, 0x00, 0xe0, 0x07, 0x90, 0x08, 0x98, 0x00, 0x28, 
-0x07, 0xd1, 0x0d, 0x98, 0x0a, 0x9a, 0x90, 0x42, 0x07, 0xdd, 0x07, 0x98, 
-0x30, 0x18, 0x88, 0x42, 0x03, 0xd8, 0x01, 0x20, 0x40, 0x05, 0x06, 0x90, 
-0x1c, 0xe0, 0x11, 0x20, 0x40, 0x05, 0x06, 0x90, 0xa8, 0x68, 0x8c, 0x23, 
-0x18, 0x40, 0x02, 0xd1, 0x20, 0x48, 0xc0, 0x46, 0x06, 0x90, 0xb1, 0x07, 
-0x89, 0x0f, 0x0f, 0xd0, 0x07, 0x98, 0xc0, 0x06, 0xc0, 0x0e, 0x08, 0xd0, 
-0x1e, 0x28, 0x09, 0xdb, 0x1e, 0x28, 0x02, 0xd1, 0x03, 0x29, 0x05, 0xd1, 
-0x01, 0xe0, 0x02, 0x29, 0x02, 0xd3, 0x01, 0x20, 0x02, 0x90, 0xde, 0xe7, 
-0x0a, 0x9a, 0x00, 0x2a, 0x04, 0xd1, 0x01, 0x23, 0xdb, 0x05, 0x06, 0x98, 
-0x18, 0x43, 0x06, 0x90, 0x07, 0x98, 0x06, 0x99, 0x08, 0x43, 0x02, 0x1c, 
-0x00, 0x90, 0x04, 0x98, 0x83, 0x19, 0x1d, 0xe0, 0xe8, 0x0e, 0x00, 0x80, 
-0xed, 0x48, 0xff, 0xff, 0x28, 0x0f, 0x00, 0x80, 0x04, 0x00, 0x12, 0x02, 
-0x7c, 0x29, 0x00, 0x80, 0x44, 0x80, 0x20, 0x40, 0x68, 0x19, 0x00, 0x80, 
-0x60, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x5c, 0x2b, 0x00, 0x80, 
-0x41, 0x32, 0xff, 0xff, 0x58, 0x5f, 0x21, 0x40, 0xf9, 0x3c, 0xff, 0xff, 
-0xb9, 0x31, 0xff, 0xff, 0x00, 0x00, 0x32, 0x02, 0x00, 0x20, 0x3a, 0x1d, 
-0x06, 0xca, 0x01, 0xf0, 0x6b, 0xf9, 0x07, 0x98, 0x36, 0x18, 0x02, 0x98, 
+0x40, 0x18, 0x01, 0x9a, 0xc0, 0x46, 0x50, 0x63, 0x02, 0xe0, 0x33, 0xe0, 
+0x2a, 0xe0, 0x03, 0x93, 0x01, 0x20, 0x0f, 0x99, 0xc0, 0x46, 0x48, 0x71, 
+0x12, 0x9a, 0x50, 0x78, 0x05, 0x99, 0x43, 0x1a, 0x0b, 0x93, 0x10, 0x37, 
+0xe0, 0x6a, 0xb8, 0x42, 0x03, 0xd8, 0x20, 0x1c, 0x00, 0xf0, 0x92, 0xfb, 
+0x07, 0x1c, 0x01, 0x9a, 0x50, 0x6b, 0x91, 0x6b, 0x09, 0x01, 0x40, 0x18, 
+0x0b, 0x9b, 0x21, 0x1c, 0x3a, 0x1c, 0xff, 0xf7, 0x7d, 0xfb, 0x01, 0x9a, 
+0xc0, 0x46, 0xd0, 0x64, 0x01, 0x9a, 0x0b, 0x9b, 0xc0, 0x46, 0x13, 0x65, 
+0x01, 0x23, 0x5b, 0x06, 0x68, 0x68, 0x18, 0x43, 0x68, 0x60, 0x00, 0x20, 
+0xa8, 0x61, 0x0d, 0xe0, 0x10, 0x37, 0xe0, 0x6a, 0xb8, 0x42, 0x03, 0xd8, 
+0x20, 0x1c, 0x00, 0xf0, 0x71, 0xfb, 0x07, 0x1c, 0x38, 0x78, 0x40, 0x07, 
+0x40, 0x0f, 0x03, 0x28, 0x00, 0xd1, 0xf8, 0xe6, 0xa8, 0x69, 0x03, 0x99, 
+0x01, 0xf0, 0x26, 0xfa, 0x00, 0x28, 0x2a, 0xd1, 0x38, 0x1c, 0x21, 0x1c, 
+0x00, 0xf0, 0x79, 0xfb, 0xa8, 0x68, 0x80, 0x09, 0x04, 0xd3, 0x30, 0x1c, 
+0x49, 0x49, 0x49, 0x68, 0x00, 0xf0, 0x81, 0xfe, 0x41, 0x49, 0x00, 0x20, 
+0x01, 0xf0, 0x14, 0xfa, 0x00, 0x28, 0x04, 0xd1, 0x0e, 0x9b, 0xd8, 0x6b, 
+0x01, 0x30, 0xd8, 0x63, 0x11, 0xe0, 0x01, 0x20, 0x0f, 0x99, 0xc0, 0x46, 
+0x48, 0x71, 0x80, 0x06, 0x00, 0x27, 0x68, 0x60, 0xaf, 0x61, 0x3a, 0x4a, 
+0xc0, 0x46, 0x00, 0x92, 0x39, 0x48, 0x01, 0x6d, 0x42, 0x6d, 0x39, 0x4b, 
+0x00, 0x20, 0x01, 0xf0, 0xf3, 0xf9, 0x00, 0x20, 0x15, 0xe2, 0x05, 0x98, 
+0x0c, 0x99, 0x08, 0x1a, 0x00, 0x04, 0x00, 0x0c, 0x0c, 0x90, 0x0b, 0x90, 
+0x0c, 0x98, 0x00, 0x28, 0x03, 0xd0, 0x01, 0x20, 0x0f, 0x99, 0xc0, 0x46, 
+0x48, 0x71, 0x28, 0x68, 0xc0, 0x46, 0x04, 0x90, 0x00, 0x26, 0x00, 0x20, 
+0x08, 0x90, 0x00, 0x22, 0x0a, 0x92, 0x0c, 0x98, 0x01, 0x38, 0x0d, 0x90, 
+0xa3, 0xe0, 0x78, 0x88, 0x8a, 0x1b, 0x12, 0x04, 0x12, 0x0c, 0x90, 0x42, 
+0x05, 0xdd, 0x07, 0x92, 0x80, 0x1a, 0x00, 0x04, 0x00, 0x0c, 0x08, 0x90, 
+0x00, 0xe0, 0x07, 0x90, 0x08, 0x98, 0x00, 0x28, 0x07, 0xd1, 0x0d, 0x98, 
+0x0a, 0x9a, 0x90, 0x42, 0x07, 0xdd, 0x07, 0x98, 0x30, 0x18, 0x88, 0x42, 
+0x03, 0xd8, 0x01, 0x20, 0x40, 0x05, 0x06, 0x90, 0x1c, 0xe0, 0x11, 0x20, 
+0x40, 0x05, 0x06, 0x90, 0xa8, 0x68, 0x8c, 0x23, 0x18, 0x40, 0x02, 0xd1, 
+0x20, 0x48, 0xc0, 0x46, 0x06, 0x90, 0xb1, 0x07, 0x89, 0x0f, 0x0f, 0xd0, 
+0x07, 0x98, 0xc0, 0x06, 0xc0, 0x0e, 0x08, 0xd0, 0x1e, 0x28, 0x09, 0xdb, 
+0x1e, 0x28, 0x02, 0xd1, 0x03, 0x29, 0x05, 0xd1, 0x01, 0xe0, 0x02, 0x29, 
+0x02, 0xd3, 0x01, 0x20, 0x02, 0x90, 0xde, 0xe7, 0x0a, 0x9a, 0x00, 0x2a, 
+0x04, 0xd1, 0x01, 0x23, 0xdb, 0x05, 0x06, 0x98, 0x18, 0x43, 0x06, 0x90, 
+0x07, 0x98, 0x06, 0x99, 0x08, 0x43, 0x02, 0x1c, 0x00, 0x90, 0x04, 0x98, 
+0x83, 0x19, 0x1d, 0xe0, 0xe8, 0x0e, 0x00, 0x80, 0x01, 0x49, 0xff, 0xff, 
+0x28, 0x0f, 0x00, 0x80, 0x04, 0x00, 0x12, 0x02, 0x7c, 0x29, 0x00, 0x80, 
+0x44, 0x80, 0x20, 0x40, 0x68, 0x19, 0x00, 0x80, 0x60, 0x04, 0x00, 0x80, 
+0x00, 0x00, 0x00, 0x80, 0x5c, 0x2b, 0x00, 0x80, 0x55, 0x32, 0xff, 0xff, 
+0xac, 0x5e, 0x21, 0x40, 0x0d, 0x3d, 0xff, 0xff, 0xcd, 0x31, 0xff, 0xff, 
+0x00, 0x00, 0x32, 0x02, 0x00, 0x20, 0x3a, 0x1d, 0x06, 0xca, 0x01, 0xf0, 
+0x6b, 0xf9, 0x07, 0x98, 0x36, 0x18, 0x02, 0x98, 
 0x00, 0x28, 0x16, 0xd0, 0xa8, 0x68, 0x8c, 0x23, 0x18, 0x40, 0x04, 0xd1, 
-0x09, 0x23, 0x5b, 0x04, 0x06, 0x98, 0x18, 0x43, 
-0x06, 0x90, 0x06, 0x98, 0xc2, 0x4a, 0x02, 0x43, 0x00, 0x92, 0x04, 0x98, 
-0x83, 0x19, 0xc1, 0x48, 0x01, 0x6d, 0x42, 0x6d, 0x00, 0x20, 0x01, 0xf0, 
-0x51, 0xf9, 0x00, 0x20, 0x02, 0x90, 0x08, 0x98, 0x00, 0x28, 0x0b, 0xd1, 
-0x0b, 0x9b, 0x01, 0x3b, 0x0b, 0x93, 0x10, 0x37, 0xe0, 0x6a, 0xb8, 0x42, 
-0x0c, 0xd8, 0x20, 0x1c, 0x00, 0xf0, 0x8a, 0xfa, 0x07, 0x1c, 0x07, 0xe0, 
-0x78, 0x68, 0x07, 0x9a, 0x80, 0x18, 0x78, 0x60, 0x78, 0x88, 0x07, 0x9a, 
-0x80, 0x1a, 0x78, 0x80, 0x0a, 0x9a, 0x50, 0x1c, 0x02, 0x04, 0x12, 0x0c, 
-0x0a, 0x92, 0x0c, 0x98, 0x0a, 0x9a, 0x82, 0x42, 0x03, 0xda, 0xa9, 0x69, 
-0xb1, 0x42, 0x00, 0xd9, 0x53, 0xe7, 0xa8, 0x69, 0xb0, 0x42, 0x6b, 0xd1, 
-0xa8, 0x68, 0x01, 0x09, 0x69, 0xd2, 0x08, 0x9a, 0x00, 0x2a, 0x56, 0xd0, 
-0x0c, 0x99, 0x0a, 0x9a, 0x8a, 0x42, 0x3e, 0xdb, 0xb1, 0x07, 0x89, 0x0f, 
-0x0c, 0xd0, 0x08, 0x9a, 0xd2, 0x06, 0xd2, 0x0e, 0x0b, 0xd0, 0x1e, 0x2a, 
-0x06, 0xdb, 0x1e, 0x2a, 0x02, 0xd1, 0x03, 0x29, 0x05, 0xd0, 0x01, 0xe0, 
-0x02, 0x29, 0x02, 0xd2, 0x02, 0x99, 0x00, 0x29, 0x21, 0xd0, 0x08, 0x9a, 
+0x09, 0x23, 0x5b, 0x04, 0x06, 0x98, 0x18, 0x43, 0x06, 0x90, 0x06, 0x98, 
+0xc2, 0x4a, 0x02, 0x43, 0x00, 0x92, 0x04, 0x98, 0x83, 0x19, 0xc1, 0x48, 
+0x01, 0x6d, 0x42, 0x6d, 0x00, 0x20, 0x01, 0xf0, 0x51, 0xf9, 0x00, 0x20, 
+0x02, 0x90, 0x08, 0x98, 0x00, 0x28, 0x0b, 0xd1, 0x0b, 0x9b, 0x01, 0x3b, 
+0x0b, 0x93, 0x10, 0x37, 0xe0, 0x6a, 0xb8, 0x42, 0x0c, 0xd8, 0x20, 0x1c, 
+0x00, 0xf0, 0x8a, 0xfa, 0x07, 0x1c, 0x07, 0xe0, 0x78, 0x68, 0x07, 0x9a, 
+0x80, 0x18, 0x78, 0x60, 0x78, 0x88, 0x07, 0x9a, 0x80, 0x1a, 0x78, 0x80, 
+0x0a, 0x9a, 0x50, 0x1c, 0x02, 0x04, 0x12, 0x0c, 0x0a, 0x92, 0x0c, 0x98, 
+0x0a, 0x9a, 0x82, 0x42, 0x03, 0xda, 0xa9, 0x69, 0xb1, 0x42, 0x00, 0xd9, 
+0x53, 0xe7, 0xa8, 0x69, 0xb0, 0x42, 0x6b, 0xd1, 0xa8, 0x68, 0x01, 0x09, 
+0x69, 0xd2, 0x08, 0x9a, 0x00, 0x2a, 0x56, 0xd0, 0x0c, 0x99, 0x0a, 0x9a, 
+0x8a, 0x42, 0x3e, 0xdb, 0xb1, 0x07, 0x89, 0x0f, 0x0c, 0xd0, 0x08, 0x9a, 
+0xd2, 0x06, 0xd2, 0x0e, 0x0b, 0xd0, 0x1e, 0x2a, 0x06, 0xdb, 0x1e, 0x2a, 
+0x02, 0xd1, 0x03, 0x29, 0x05, 0xd0, 0x01, 0xe0, 0x02, 0x29, 0x02, 0xd2, 
+0x02, 0x99, 0x00, 0x29, 0x21, 0xd0, 0x08, 0x9a, 0xc0, 0x46, 0x00, 0x92, 
+0x04, 0x98, 0x83, 0x19, 0x00, 0x20, 0x3a, 0x1d, 0x06, 0xca, 0x01, 0xf0, 
+0x01, 0xf9, 0x08, 0x98, 0x36, 0x18, 0xa8, 0x68, 0x8c, 0x23, 0x18, 0x40, 
+0x02, 0xd0, 0x01, 0x20, 0x40, 0x06, 0x00, 0xe0, 0x92, 0x48, 0x01, 0x22, 
+0x02, 0x43, 0x00, 0x92, 0x04, 0x98, 0x83, 0x19, 0x8e, 0x48, 0x01, 0x6d, 
+0x42, 0x6d, 0x00, 0x20, 0x01, 0xf0, 0xec, 0xf8, 0x00, 0x20, 0x02, 0x90, 
+0x15, 0xe0, 0x8c, 0x23, 0x18, 0x40, 0x02, 0xd0, 0x01, 0x20, 0x40, 0x06, 
+0x00, 0xe0, 0x88, 0x48, 0x08, 0x9a, 0x02, 0x43, 0x00, 0xe0, 0x08, 0x9a, 
 0xc0, 0x46, 0x00, 0x92, 0x04, 0x98, 0x83, 0x19, 0x00, 0x20, 0x3a, 0x1d, 
-0x06, 0xca, 0x01, 0xf0, 0x01, 0xf9, 0x08, 0x98, 0x36, 0x18, 0xa8, 0x68, 
-0x8c, 0x23, 0x18, 0x40, 0x02, 0xd0, 0x01, 0x20, 0x40, 0x06, 0x00, 0xe0, 
-0x92, 0x48, 0x01, 0x22, 0x02, 0x43, 0x00, 0x92, 0x04, 0x98, 0x83, 0x19, 
-0x8e, 0x48, 0x01, 0x6d, 0x42, 0x6d, 0x00, 0x20, 0x01, 0xf0, 0xec, 0xf8, 
-0x00, 0x20, 0x02, 0x90, 0x15, 0xe0, 0x8c, 0x23, 0x18, 0x40, 0x02, 0xd0, 
-0x01, 0x20, 0x40, 0x06, 0x00, 0xe0, 0x88, 0x48, 0x08, 0x9a, 0x02, 0x43, 
-0x00, 0xe0, 0x08, 0x9a, 0xc0, 0x46, 0x00, 0x92, 0x04, 0x98, 0x83, 0x19, 
-0x00, 0x20, 0x3a, 0x1d, 0x06, 0xca, 0x01, 0xf0, 0xd5, 0xf8, 0x08, 0x98, 
-0x36, 0x18, 0x10, 0x37, 0xe0, 0x6a, 0xb8, 0x42, 0x03, 0xd8, 0x20, 0x1c, 
-0x00, 0xf0, 0x14, 0xfa, 0x07, 0x1c, 0x68, 0x68, 0x80, 0x0e, 0x6b, 0xd2, 
-0x0a, 0x98, 0xc0, 0x46, 0x09, 0x90, 0x0c, 0x99, 0x88, 0x42, 0x5c, 0xda, 
-0x0d, 0x98, 0x09, 0x99, 0x88, 0x42, 0x03, 0xd0, 0x7a, 0x88, 0x1e, 0xe0, 
-0x5f, 0xe0, 0x5e, 0xe0, 0x78, 0x88, 0x01, 0x22, 0x52, 0x06, 0x02, 0x43, 
-0xa9, 0x68, 0x8c, 0x23, 0x19, 0x40, 0x02, 0xd1, 0x09, 0x23, 0x5b, 0x04, 
-0x1a, 0x43, 0xb1, 0x07, 0x89, 0x0f, 0x0e, 0xd0, 0xc3, 0x06, 0xdb, 0x0e, 
-0x08, 0xd0, 0x1e, 0x2b, 0x09, 0xdb, 0x1e, 0x2b, 0x02, 0xd1, 0x03, 0x29, 
-0x05, 0xd1, 0x01, 0xe0, 0x02, 0x29, 0x02, 0xd3, 0x01, 0x21, 0x02, 0x91, 
-0x02, 0x1c, 0x09, 0x98, 0x00, 0x28, 0x02, 0xd1, 0x01, 0x23, 0xdb, 0x05, 
-0x1a, 0x43, 0x00, 0x92, 0x04, 0x98, 0x83, 0x19, 0x00, 0x20, 0x3a, 0x1d, 
-0x06, 0xca, 0x01, 0xf0, 0x8f, 0xf8, 0x78, 0x88, 0x86, 0x19, 0x10, 0x37, 
-0x02, 0x98, 0x00, 0x28, 0x14, 0xd0, 0xa8, 0x68, 0x8c, 0x23, 0x18, 0x40, 
-0x02, 0xd0, 0x01, 0x20, 0x40, 0x06, 0x00, 0xe0, 0x57, 0x48, 0x01, 0x22, 
-0x02, 0x43, 0x00, 0x92, 0x04, 0x98, 0x83, 0x19, 0x53, 0x48, 0x01, 0x6d, 
-0x42, 0x6d, 0x00, 0x20, 0x01, 0xf0, 0x76, 0xf8, 0x00, 0x20, 0x02, 0x90, 
-0xe0, 0x6a, 0xb8, 0x42, 0x03, 0xd8, 0x20, 0x1c, 0x00, 0xf0, 0xb6, 0xf9, 
-0x07, 0x1c, 0x09, 0x98, 0x01, 0x30, 0x00, 0x04, 0x00, 0x0c, 0x09, 0x90, 
+0x06, 0xca, 0x01, 0xf0, 0xd5, 0xf8, 0x08, 0x98, 0x36, 0x18, 0x10, 0x37, 
+0xe0, 0x6a, 0xb8, 0x42, 0x03, 0xd8, 0x20, 0x1c, 0x00, 0xf0, 0x14, 0xfa, 
+0x07, 0x1c, 0x68, 0x68, 0x80, 0x0e, 0x6b, 0xd2, 0x0a, 0x98, 0xc0, 0x46, 
+0x09, 0x90, 0x0c, 0x99, 0x88, 0x42, 0x5c, 0xda, 0x0d, 0x98, 0x09, 0x99, 
+0x88, 0x42, 0x03, 0xd0, 0x7a, 0x88, 0x1e, 0xe0, 0x5f, 0xe0, 0x5e, 0xe0, 
+0x78, 0x88, 0x01, 0x22, 0x52, 0x06, 0x02, 0x43, 0xa9, 0x68, 0x8c, 0x23, 
+0x19, 0x40, 0x02, 0xd1, 0x09, 0x23, 0x5b, 0x04, 0x1a, 0x43, 0xb1, 0x07, 
+0x89, 0x0f, 0x0e, 0xd0, 0xc3, 0x06, 0xdb, 0x0e, 0x08, 0xd0, 0x1e, 0x2b, 
+0x09, 0xdb, 0x1e, 0x2b, 0x02, 0xd1, 0x03, 0x29, 0x05, 0xd1, 0x01, 0xe0, 
+0x02, 0x29, 0x02, 0xd3, 0x01, 0x21, 0x02, 0x91, 0x02, 0x1c, 0x09, 0x98, 
+0x00, 0x28, 0x02, 0xd1, 0x01, 0x23, 0xdb, 0x05, 0x1a, 0x43, 0x00, 0x92, 
+0x04, 0x98, 0x83, 0x19, 0x00, 0x20, 0x3a, 0x1d, 0x06, 0xca, 0x01, 0xf0, 
+0x8f, 0xf8, 0x78, 0x88, 0x86, 0x19, 0x10, 0x37, 0x02, 0x98, 0x00, 0x28, 
+0x14, 0xd0, 0xa8, 0x68, 0x8c, 0x23, 0x18, 0x40, 0x02, 0xd0, 0x01, 0x20, 
+0x40, 0x06, 0x00, 0xe0, 0x57, 0x48, 0x01, 0x22, 0x02, 0x43, 0x00, 0x92, 
+0x04, 0x98, 0x83, 0x19, 0x53, 0x48, 0x01, 0x6d, 0x42, 0x6d, 0x00, 0x20, 
+0x01, 0xf0, 0x76, 0xf8, 0x00, 0x20, 0x02, 0x90, 0xe0, 0x6a, 0xb8, 0x42, 
+0x03, 0xd8, 0x20, 0x1c, 0x00, 0xf0, 0xb6, 0xf9, 0x07, 0x1c, 0x09, 0x98, 
+0x01, 0x30, 0x00, 0x04, 0x00, 0x0c, 0x09, 0x90, 
 0x0c, 0x99, 0x88, 0x42, 0xa2, 0xdb, 0x68, 0x68, 0x30, 0x43, 0x01, 0x04, 
-0x09, 0x0c, 0x68, 0x60, 0xe8, 0x6a, 0x00, 0xf0, 
-0x7b, 0xfa, 0x28, 0xe0, 0x27, 0xe0, 0xa8, 0x68, 0x00, 0x09, 0x14, 0xd3, 
-0x68, 0x68, 0x80, 0x0e, 0x15, 0xd2, 0x01, 0x9a, 0x00, 0x2a, 0x12, 0xd0, 
-0x01, 0x9a, 0x50, 0x6b, 0x0b, 0x9b, 0x21, 0x1c, 0x3a, 0x1c, 0xff, 0xf7, 
-0x89, 0xf9, 0x01, 0x9a, 0xc0, 0x46, 0x90, 0x64, 0x01, 0x9a, 0x0b, 0x9b, 
-0xc0, 0x46, 0x93, 0x63, 0x03, 0xe0, 0xe8, 0x6a, 0x31, 0x1c, 0x00, 0xf0, 
-0x5d, 0xfa, 0x68, 0x68, 0x30, 0x43, 0x68, 0x60, 0xa8, 0x69, 0xb0, 0x42, 
-0x05, 0xd9, 0x00, 0x04, 0x00, 0x0c, 0x80, 0x1b, 0x00, 0xf0, 0xee, 0xf9, 
-0xae, 0x61, 0xa8, 0x68, 0x8c, 0x23, 0x18, 0x40, 0x0b, 0xd0, 0x2f, 0x4a, 
-0xc0, 0x46, 0x00, 0x92, 0x04, 0x98, 0xc3, 0x1f, 0x05, 0x3b, 0x2a, 0x48, 
-0x01, 0x6d, 0x42, 0x6d, 0x00, 0x20, 0x01, 0xf0, 0x23, 0xf8, 0x01, 0x23, 
-0x9b, 0x07, 0x20, 0x6d, 0x18, 0x43, 0x00, 0x68, 0xc0, 0x46, 0xa0, 0x61, 
-0xe1, 0x69, 0x81, 0x42, 0x12, 0xd0, 0x22, 0x69, 0x02, 0x2a, 0x0f, 0xd2, 
-0x41, 0x1a, 0x01, 0xd5, 0x60, 0x6d, 0x41, 0x18, 0x20, 0x1c, 0xff, 0xf7, 
-0x3f, 0xfb, 0xe1, 0x69, 0x40, 0x18, 0xe0, 0x61, 0x61, 0x6d, 0x88, 0x42, 
-0x24, 0xd3, 0x40, 0x1a, 0xe0, 0x61, 0x21, 0xe0, 0x81, 0x42, 0x1f, 0xd1, 
-0x20, 0x69, 0x02, 0x28, 0x1c, 0xd2, 0x01, 0x20, 0x60, 0x61, 0x18, 0x48, 
-0x41, 0x69, 0xe2, 0x6c, 0x0a, 0x43, 0x42, 0x61, 0x81, 0x69, 0xe3, 0x6c, 
-0x99, 0x43, 0x81, 0x61, 0x01, 0x21, 0x09, 0x05, 0xca, 0x60, 0x80, 0x69, 
-0xc0, 0x46, 0x08, 0x61, 0x8b, 0x02, 0x20, 0x6d, 0x18, 0x43, 0x00, 0x68, 
-0xc0, 0x46, 0xa0, 0x61, 0xe1, 0x69, 0x81, 0x42, 0x02, 0xd0, 0x20, 0x1c, 
-0xff, 0xf7, 0xcc, 0xfa, 0x28, 0x1c, 0x00, 0xf0, 0x0f, 0xf9, 0x0c, 0x98, 
-0x05, 0x99, 0x40, 0x18, 0x00, 0x01, 0x10, 0x30, 0x68, 0x61, 0x13, 0xb0, 
-0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 
-0x7c, 0x29, 0x00, 0x80, 0x00, 0x00, 0x12, 0x02, 0x04, 0x00, 0x52, 0x02, 
-0x68, 0x0e, 0x00, 0x80, 0xf0, 0xb5, 0x40, 0x20, 0x2d, 0x49, 0xc0, 0x46, 
-0x08, 0x60, 0x00, 0xf0, 0x03, 0xf9, 0x07, 0x1c, 0x81, 0x69, 0x44, 0x6a, 
-0xa0, 0x6f, 0x00, 0xf0, 0x45, 0xfe, 0x00, 0x20, 0xe1, 0x1d, 0x19, 0x31, 
-0x48, 0x71, 0x79, 0x68, 0xc9, 0x0e, 0x09, 0xd3, 0xf8, 0x6a, 0x00, 0x01, 
-0x24, 0x49, 0x40, 0x18, 0x24, 0x4b, 0xc0, 0x18, 0x01, 0x68, 0x01, 0x39, 
-0x01, 0x60, 0x36, 0xe0, 0xe1, 0x6d, 0x09, 0x68, 0x22, 0x6e, 0xc0, 0x46, 
-0x11, 0x60, 0x20, 0x4e, 0xf5, 0x1d, 0x79, 0x35, 0x01, 0x23, 0xe9, 0x6b, 
-0x19, 0x43, 0xe9, 0x63, 0xb9, 0x6a, 0xe2, 0x6d, 0xc0, 0x46, 0x11, 0x60, 
-0xb9, 0x6a, 0x22, 0x6e, 0xc0, 0x46, 0x11, 0x60, 0x61, 0x69, 0x00, 0x29, 
-0x04, 0xd1, 0xa9, 0x6b, 0x01, 0x31, 0xa9, 0x63, 0x08, 0x29, 0x07, 0xd3, 
-0xa8, 0x63, 0x01, 0x20, 0x00, 0xf0, 0x86, 0xf8, 0xe8, 0x6b, 0x40, 0x08, 
-0x40, 0x00, 0xe8, 0x63, 0x78, 0x68, 0x81, 0x0e, 0x0f, 0xd2, 0x0b, 0x23, 
-0x1b, 0x02, 0xf1, 0x18, 0xc9, 0x68, 0x00, 0x29, 0x06, 0xd0, 0x00, 0x08, 
-0x04, 0xd2, 0x20, 0x1c, 0x39, 0x1c, 0x00, 0xf0, 0x43, 0xf8, 0x02, 0xe0, 
-0x38, 0x1c, 0x00, 0xf0, 0x05, 0xfa, 0x38, 0x1c, 0xfb, 0xf7, 0x10, 0xfc, 
-0x20, 0x1c, 0x00, 0xf0, 0x0b, 0xf8, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x00, 0x00, 0x00, 0xb0, 0xa0, 0x1c, 0x00, 0x80, 0xb4, 0x0c, 0x00, 0x00, 
+0x09, 0x0c, 0x68, 0x60, 0xe8, 0x6a, 0x00, 0xf0, 0x7b, 0xfa, 0x28, 0xe0, 
+0x27, 0xe0, 0xa8, 0x68, 0x00, 0x09, 0x14, 0xd3, 0x68, 0x68, 0x80, 0x0e, 
+0x15, 0xd2, 0x01, 0x9a, 0x00, 0x2a, 0x12, 0xd0, 0x01, 0x9a, 0x50, 0x6b, 
+0x0b, 0x9b, 0x21, 0x1c, 0x3a, 0x1c, 0xff, 0xf7, 0x89, 0xf9, 0x01, 0x9a, 
+0xc0, 0x46, 0x90, 0x64, 0x01, 0x9a, 0x0b, 0x9b, 0xc0, 0x46, 0x93, 0x63, 
+0x03, 0xe0, 0xe8, 0x6a, 0x31, 0x1c, 0x00, 0xf0, 0x5d, 0xfa, 0x68, 0x68, 
+0x30, 0x43, 0x68, 0x60, 0xa8, 0x69, 0xb0, 0x42, 0x05, 0xd9, 0x00, 0x04, 
+0x00, 0x0c, 0x80, 0x1b, 0x00, 0xf0, 0xee, 0xf9, 0xae, 0x61, 0xa8, 0x68, 
+0x8c, 0x23, 0x18, 0x40, 0x0b, 0xd0, 0x2f, 0x4a, 0xc0, 0x46, 0x00, 0x92, 
+0x04, 0x98, 0xc3, 0x1f, 0x05, 0x3b, 0x2a, 0x48, 0x01, 0x6d, 0x42, 0x6d, 
+0x00, 0x20, 0x01, 0xf0, 0x23, 0xf8, 0x01, 0x23, 0x9b, 0x07, 0x20, 0x6d, 
+0x18, 0x43, 0x00, 0x68, 0xc0, 0x46, 0xa0, 0x61, 0xe1, 0x69, 0x81, 0x42, 
+0x12, 0xd0, 0x22, 0x69, 0x02, 0x2a, 0x0f, 0xd2, 0x41, 0x1a, 0x01, 0xd5, 
+0x60, 0x6d, 0x41, 0x18, 0x20, 0x1c, 0xff, 0xf7, 0x3f, 0xfb, 0xe1, 0x69, 
+0x40, 0x18, 0xe0, 0x61, 0x61, 0x6d, 0x88, 0x42, 0x24, 0xd3, 0x40, 0x1a, 
+0xe0, 0x61, 0x21, 0xe0, 0x81, 0x42, 0x1f, 0xd1, 0x20, 0x69, 0x02, 0x28, 
+0x1c, 0xd2, 0x01, 0x20, 0x60, 0x61, 0x18, 0x48, 0x41, 0x69, 0xe2, 0x6c, 
+0x0a, 0x43, 0x42, 0x61, 0x81, 0x69, 0xe3, 0x6c, 0x99, 0x43, 0x81, 0x61, 
+0x01, 0x21, 0x09, 0x05, 0xca, 0x60, 0x80, 0x69, 0xc0, 0x46, 0x08, 0x61, 
+0x8b, 0x02, 0x20, 0x6d, 0x18, 0x43, 0x00, 0x68, 0xc0, 0x46, 0xa0, 0x61, 
+0xe1, 0x69, 0x81, 0x42, 0x02, 0xd0, 0x20, 0x1c, 0xff, 0xf7, 0xcc, 0xfa, 
+0x28, 0x1c, 0x00, 0xf0, 0x0f, 0xf9, 0x0c, 0x98, 0x05, 0x99, 0x40, 0x18, 
+0x00, 0x01, 0x10, 0x30, 0x68, 0x61, 0x13, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x7c, 0x29, 0x00, 0x80, 
+0x00, 0x00, 0x12, 0x02, 0x04, 0x00, 0x52, 0x02, 0x68, 0x0e, 0x00, 0x80, 
+0xf0, 0xb5, 0x40, 0x20, 0x2d, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x00, 0xf0, 
+0x03, 0xf9, 0x07, 0x1c, 0x81, 0x69, 0x44, 0x6a, 0xa0, 0x6f, 0x00, 0xf0, 
+0x45, 0xfe, 0x00, 0x20, 0xe1, 0x1d, 0x19, 0x31, 0x48, 0x71, 0x79, 0x68, 
+0xc9, 0x0e, 0x09, 0xd3, 0xf8, 0x6a, 0x00, 0x01, 0x24, 0x49, 0x40, 0x18, 
+0x24, 0x4b, 0xc0, 0x18, 0x01, 0x68, 0x01, 0x39, 0x01, 0x60, 0x36, 0xe0, 
+0xe1, 0x6d, 0x09, 0x68, 0x22, 0x6e, 0xc0, 0x46, 0x11, 0x60, 0x20, 0x4e, 
+0xf5, 0x1d, 0x79, 0x35, 0x01, 0x23, 0xe9, 0x6b, 0x19, 0x43, 0xe9, 0x63, 
+0xb9, 0x6a, 0xe2, 0x6d, 0xc0, 0x46, 0x11, 0x60, 0xb9, 0x6a, 0x22, 0x6e, 
+0xc0, 0x46, 0x11, 0x60, 0x61, 0x69, 0x00, 0x29, 0x04, 0xd1, 0xa9, 0x6b, 
+0x01, 0x31, 0xa9, 0x63, 0x08, 0x29, 0x07, 0xd3, 0xa8, 0x63, 0x01, 0x20, 
+0x00, 0xf0, 0x86, 0xf8, 0xe8, 0x6b, 0x40, 0x08, 0x40, 0x00, 0xe8, 0x63, 
+0x78, 0x68, 0x81, 0x0e, 0x0f, 0xd2, 0x0b, 0x23, 0x1b, 0x02, 0xf1, 0x18, 
+0xc9, 0x68, 0x00, 0x29, 0x06, 0xd0, 0x00, 0x08, 0x04, 0xd2, 0x20, 0x1c, 
+0x39, 0x1c, 0x00, 0xf0, 0x43, 0xf8, 0x02, 0xe0, 0x38, 0x1c, 0x00, 0xf0, 
+0x05, 0xfa, 0x38, 0x1c, 0xfb, 0xf7, 0x06, 0xfc, 0x20, 0x1c, 0x00, 0xf0, 
+0x0b, 0xf8, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0xb0, 
+0xa0, 0x1c, 0x00, 0x80, 0xb4, 0x0c, 0x00, 0x00, 
 0x68, 0x0e, 0x00, 0x80, 0x80, 0xb5, 0x07, 0x1c, 0xf8, 0x1d, 0x19, 0x30, 
-0x01, 0x79, 0x00, 0x29, 0x04, 0xd0, 0x00, 0x21, 
-0x01, 0x71, 0x38, 0x1c, 0xff, 0xf7, 0x56, 0xfb, 0xf8, 0x68, 0x02, 0x28, 
-0x0d, 0xd0, 0xb8, 0x68, 0x80, 0x00, 0xc2, 0x19, 0x50, 0x6c, 0x00, 0x28, 
-0x11, 0xd0, 0xb8, 0x6a, 0x41, 0x78, 0x09, 0x01, 0x10, 0x31, 0x52, 0x6b, 
-0x10, 0x1a, 0x88, 0x42, 0x05, 0xd3, 0x38, 0x1c, 0xff, 0xf7, 0x42, 0xfb, 
-0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x38, 0x1c, 0xff, 0xf7, 0x28, 0xfa, 
-0xf8, 0xe7, 0x78, 0x68, 0x80, 0x00, 0xc0, 0x19, 0xc0, 0x6b, 0xc0, 0x46, 
-0xb8, 0x62, 0xf1, 0xe7, 0xb0, 0xb5, 0x87, 0xb0, 0x0f, 0x1c, 0x80, 0x6f, 
-0xc0, 0x46, 0x00, 0x90, 0x00, 0x24, 0x13, 0x4d, 0x0b, 0x23, 0x1b, 0x02, 
-0xe8, 0x18, 0x80, 0x69, 0x00, 0x28, 0x17, 0xd0, 0x69, 0x46, 0xa2, 0x00, 
-0x52, 0x19, 0x0b, 0x23, 0x1b, 0x02, 0xd2, 0x18, 0x92, 0x69, 0x38, 0x1c, 
-0x00, 0xf0, 0x92, 0xfb, 0x00, 0x28, 0x09, 0xd1, 0x01, 0x34, 0xa0, 0x00, 
-0x40, 0x19, 0x0b, 0x23, 0x1b, 0x02, 0xc0, 0x18, 0x80, 0x69, 0x00, 0x28, 
-0xea, 0xd1, 0x01, 0xe0, 0x01, 0x28, 0x02, 0xd0, 0x38, 0x1c, 0x00, 0xf0, 
-0x9d, 0xf9, 0x07, 0xb0, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0x68, 0x0e, 0x00, 0x80, 0xb8, 0xb5, 0xc2, 0x07, 0xd2, 0x0f, 0x16, 0x4c, 
-0x16, 0x49, 0x01, 0xd0, 0x08, 0x22, 0x08, 0xe0, 0x82, 0x08, 0x05, 0xd3, 
-0x0c, 0x22, 0xa4, 0x18, 0x0b, 0x68, 0xdf, 0x1d, 0x15, 0x37, 0x03, 0xe0, 
-0x1c, 0x22, 0x0b, 0x68, 0xdf, 0x1d, 0x09, 0x37, 0x0f, 0x4b, 0x1d, 0x78, 
-0x00, 0x2d, 0x13, 0xd0, 0x5b, 0x78, 0x00, 0x2b, 0x10, 0xd0, 0x01, 0x23, 
-0x5b, 0x06, 0x1a, 0x43, 0x00, 0x28, 0x01, 0xd1, 0x5b, 0x08, 0x1a, 0x43, 
-0x00, 0x92, 0x4a, 0x68, 0x01, 0x20, 0x39, 0x1c, 0x23, 0x1c, 0x00, 0xf0, 
-0xdf, 0xfe, 0xb8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x03, 0x23, 0x1b, 0x06, 
-0x1a, 0x43, 0xf1, 0xe7, 0x3c, 0xef, 0x20, 0x40, 0x7c, 0x29, 0x00, 0x80, 
-0xf8, 0x0e, 0x00, 0x80, 0x00, 0x21, 0xc1, 0x61, 0x05, 0x49, 0x8a, 0x68, 
-0x00, 0x2a, 0x01, 0xd1, 0x88, 0x60, 0x02, 0xe0, 0xca, 0x68, 0xc0, 0x46, 
-0xd0, 0x61, 0xc8, 0x60, 0x70, 0x47, 0x00, 0x00, 0x28, 0x0f, 0x00, 0x80, 
-0x03, 0x49, 0x88, 0x68, 0x00, 0x28, 0x02, 0xd0, 0xc2, 0x69, 0xc0, 0x46, 
-0x8a, 0x60, 0x70, 0x47, 0x28, 0x0f, 0x00, 0x80, 0x01, 0x1c, 0x01, 0x23, 
-0x88, 0x68, 0x58, 0x40, 0x88, 0x60, 0xca, 0x68, 0x01, 0x3a, 0xca, 0x60, 
-0x0a, 0x69, 0x01, 0x3a, 0x80, 0x00, 0x0a, 0x61, 0x42, 0x18, 0xd0, 0x6b, 
-0x53, 0x6b, 0xc0, 0x46, 0xcb, 0x62, 0x0b, 0x68, 0x9b, 0x00, 0x59, 0x18, 
-0x49, 0x6c, 0x53, 0x6c, 0xc9, 0x18, 0x51, 0x64, 0x70, 0x47, 0x8a, 0x68, 
-0x92, 0x00, 0x52, 0x18, 0xd3, 0x6b, 0x83, 0x42, 0x17, 0xd1, 0xd0, 0x1d, 
-0x3d, 0x30, 0x0a, 0x68, 0x92, 0x00, 0x52, 0x18, 0x52, 0x6c, 0x03, 0x68, 
-0x9a, 0x1a, 0x02, 0x60, 0x01, 0x23, 0x88, 0x68, 0x58, 0x40, 0x88, 0x60, 
-0xca, 0x68, 0x01, 0x32, 0xca, 0x60, 0x0a, 0x69, 0x01, 0x32, 0x80, 0x00, 
-0x40, 0x18, 0x0a, 0x61, 0x40, 0x6b, 0xc0, 0x46, 0xc8, 0x62, 0x70, 0x47, 
-0xb8, 0xb5, 0x04, 0x1c, 0x1d, 0x1c, 0x17, 0x1c, 0x08, 0x1c, 0x39, 0x1c, 
-0xff, 0xf7, 0xd9, 0xff, 0x00, 0x20, 0x29, 0x1c, 0x00, 0xf0, 0x7c, 0xfe, 
-0x01, 0x20, 0xf9, 0x1d, 0x19, 0x31, 0x48, 0x71, 0x80, 0x06, 0x60, 0x60, 
-0x00, 0x20, 0xa0, 0x61, 0x06, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0x06, 0x48, 
+0x01, 0x79, 0x00, 0x29, 0x04, 0xd0, 0x00, 0x21, 0x01, 0x71, 0x38, 0x1c, 
+0xff, 0xf7, 0x56, 0xfb, 0xf8, 0x68, 0x02, 0x28, 0x0d, 0xd0, 0xb8, 0x68, 
+0x80, 0x00, 0xc2, 0x19, 0x50, 0x6c, 0x00, 0x28, 0x11, 0xd0, 0xb8, 0x6a, 
+0x41, 0x78, 0x09, 0x01, 0x10, 0x31, 0x52, 0x6b, 0x10, 0x1a, 0x88, 0x42, 
+0x05, 0xd3, 0x38, 0x1c, 0xff, 0xf7, 0x42, 0xfb, 0x80, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x38, 0x1c, 0xff, 0xf7, 0x28, 0xfa, 0xf8, 0xe7, 0x78, 0x68, 
+0x80, 0x00, 0xc0, 0x19, 0xc0, 0x6b, 0xc0, 0x46, 0xb8, 0x62, 0xf1, 0xe7, 
+0xb0, 0xb5, 0x87, 0xb0, 0x0f, 0x1c, 0x80, 0x6f, 0xc0, 0x46, 0x00, 0x90, 
+0x00, 0x24, 0x13, 0x4d, 0x0b, 0x23, 0x1b, 0x02, 0xe8, 0x18, 0x80, 0x69, 
+0x00, 0x28, 0x17, 0xd0, 0x69, 0x46, 0xa2, 0x00, 0x52, 0x19, 0x0b, 0x23, 
+0x1b, 0x02, 0xd2, 0x18, 0x92, 0x69, 0x38, 0x1c, 0x00, 0xf0, 0x92, 0xfb, 
+0x00, 0x28, 0x09, 0xd1, 0x01, 0x34, 0xa0, 0x00, 0x40, 0x19, 0x0b, 0x23, 
+0x1b, 0x02, 0xc0, 0x18, 0x80, 0x69, 0x00, 0x28, 0xea, 0xd1, 0x01, 0xe0, 
+0x01, 0x28, 0x02, 0xd0, 0x38, 0x1c, 0x00, 0xf0, 0x9d, 0xf9, 0x07, 0xb0, 
+0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 
+0xb8, 0xb5, 0xc2, 0x07, 0xd2, 0x0f, 0x16, 0x4c, 0x16, 0x49, 0x01, 0xd0, 
+0x08, 0x22, 0x08, 0xe0, 0x82, 0x08, 0x05, 0xd3, 0x0c, 0x22, 0xa4, 0x18, 
+0x0b, 0x68, 0xdf, 0x1d, 0x15, 0x37, 0x03, 0xe0, 0x1c, 0x22, 0x0b, 0x68, 
+0xdf, 0x1d, 0x09, 0x37, 0x0f, 0x4b, 0x1d, 0x78, 0x00, 0x2d, 0x13, 0xd0, 
+0x5b, 0x78, 0x00, 0x2b, 0x10, 0xd0, 0x01, 0x23, 0x5b, 0x06, 0x1a, 0x43, 
+0x00, 0x28, 0x01, 0xd1, 0x5b, 0x08, 0x1a, 0x43, 0x00, 0x92, 0x4a, 0x68, 
+0x01, 0x20, 0x39, 0x1c, 0x23, 0x1c, 0x00, 0xf0, 0xdf, 0xfe, 0xb8, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x03, 0x23, 0x1b, 0x06, 0x1a, 0x43, 0xf1, 0xe7, 
+0x90, 0xee, 0x20, 0x40, 0x7c, 0x29, 0x00, 0x80, 0xf8, 0x0e, 0x00, 0x80, 
+0x00, 0x21, 0xc1, 0x61, 0x05, 0x49, 0x8a, 0x68, 0x00, 0x2a, 0x01, 0xd1, 
+0x88, 0x60, 0x02, 0xe0, 0xca, 0x68, 0xc0, 0x46, 0xd0, 0x61, 0xc8, 0x60, 
+0x70, 0x47, 0x00, 0x00, 0x28, 0x0f, 0x00, 0x80, 0x03, 0x49, 0x88, 0x68, 
+0x00, 0x28, 0x02, 0xd0, 0xc2, 0x69, 0xc0, 0x46, 0x8a, 0x60, 0x70, 0x47, 
+0x28, 0x0f, 0x00, 0x80, 0x01, 0x1c, 0x01, 0x23, 0x88, 0x68, 0x58, 0x40, 
+0x88, 0x60, 0xca, 0x68, 0x01, 0x3a, 0xca, 0x60, 0x0a, 0x69, 0x01, 0x3a, 
+0x80, 0x00, 0x0a, 0x61, 0x42, 0x18, 0xd0, 0x6b, 0x53, 0x6b, 0xc0, 0x46, 
+0xcb, 0x62, 0x0b, 0x68, 0x9b, 0x00, 0x59, 0x18, 0x49, 0x6c, 0x53, 0x6c, 
+0xc9, 0x18, 0x51, 0x64, 0x70, 0x47, 0x8a, 0x68, 0x92, 0x00, 0x52, 0x18, 
+0xd3, 0x6b, 0x83, 0x42, 0x17, 0xd1, 0xd0, 0x1d, 0x3d, 0x30, 0x0a, 0x68, 
+0x92, 0x00, 0x52, 0x18, 0x52, 0x6c, 0x03, 0x68, 0x9a, 0x1a, 0x02, 0x60, 
+0x01, 0x23, 0x88, 0x68, 0x58, 0x40, 0x88, 0x60, 0xca, 0x68, 0x01, 0x32, 
+0xca, 0x60, 0x0a, 0x69, 0x01, 0x32, 0x80, 0x00, 0x40, 0x18, 0x0a, 0x61, 
+0x40, 0x6b, 0xc0, 0x46, 0xc8, 0x62, 0x70, 0x47, 0xb8, 0xb5, 0x04, 0x1c, 
+0x1d, 0x1c, 0x17, 0x1c, 0x08, 0x1c, 0x39, 0x1c, 0xff, 0xf7, 0xd9, 0xff, 
+0x00, 0x20, 0x29, 0x1c, 0x00, 0xf0, 0x7c, 0xfe, 0x01, 0x20, 0xf9, 0x1d, 
+0x19, 0x31, 0x48, 0x71, 0x80, 0x06, 0x60, 0x60, 0x00, 0x20, 0xa0, 0x61, 
+0x06, 0x4a, 0xc0, 0x46, 0x00, 0x92, 0x06, 0x48, 
 0x01, 0x6d, 0x42, 0x6d, 0x05, 0x4b, 0x00, 0x20, 0x00, 0xf0, 0x62, 0xfe, 
-0xb8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0x04, 0x00, 0x12, 0x02, 0x7c, 0x29, 0x00, 0x80, 0x44, 0x80, 0x20, 0x40, 
+0xb8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x04, 0x00, 0x12, 0x02, 
+0x7c, 0x29, 0x00, 0x80, 0x44, 0x80, 0x20, 0x40, 0x06, 0x49, 0x0a, 0x68, 
+0x10, 0x18, 0x08, 0x60, 0x01, 0x23, 0x5b, 0x02, 0x98, 0x42, 0x03, 0xd9, 
+0x03, 0x49, 0x0a, 0x79, 0x01, 0x32, 0x0a, 0x71, 0x70, 0x47, 0x00, 0x00, 
+0xe4, 0x2d, 0x00, 0x80, 0xa0, 0x82, 0x20, 0x40, 0x80, 0x08, 0x80, 0x00, 
 0x06, 0x49, 0x0a, 0x68, 0x10, 0x18, 0x08, 0x60, 0x01, 0x23, 0x5b, 0x02, 
 0x98, 0x42, 0x03, 0xd9, 0x03, 0x49, 0x0a, 0x79, 0x01, 0x32, 0x0a, 0x71, 
 0x70, 0x47, 0x00, 0x00, 0xe4, 0x2d, 0x00, 0x80, 0xa0, 0x82, 0x20, 0x40, 
-0x80, 0x08, 0x80, 0x00, 0x06, 0x49, 0x0a, 0x68, 0x10, 0x18, 0x08, 0x60, 
-0x01, 0x23, 0x5b, 0x02, 0x98, 0x42, 0x03, 0xd9, 0x03, 0x49, 0x0a, 0x79, 
-0x01, 0x32, 0x0a, 0x71, 0x70, 0x47, 0x00, 0x00, 0xe4, 0x2d, 0x00, 0x80, 
-0xa0, 0x82, 0x20, 0x40, 0x03, 0x30, 0x80, 0x08, 0x80, 0x00, 0x06, 0x49, 
-0x0a, 0x68, 0x10, 0x18, 0x08, 0x60, 0x01, 0x23, 0x5b, 0x02, 0x98, 0x42, 
-0x03, 0xd9, 0x03, 0x49, 0x0a, 0x79, 0x01, 0x32, 0x0a, 0x71, 0x70, 0x47, 
-0xe4, 0x2d, 0x00, 0x80, 0xa0, 0x82, 0x20, 0x40, 0x02, 0x48, 0x41, 0x79, 
-0x01, 0x31, 0x41, 0x71, 0x70, 0x47, 0x00, 0x00, 0xa0, 0x82, 0x20, 0x40, 
-0x90, 0xb4, 0x82, 0x00, 0x17, 0x4b, 0x9a, 0x58, 0x8b, 0x07, 0x02, 0xd0, 
-0x89, 0x08, 0x0b, 0x1d, 0x01, 0xe0, 0x89, 0x08, 0xcb, 0x1c, 0x11, 0x69, 
-0xd7, 0x68, 0x12, 0x4c, 0x80, 0x00, 0x20, 0x58, 0x40, 0x68, 0xb9, 0x42, 
-0x03, 0xd1, 0x81, 0x42, 0x19, 0xd9, 0x11, 0x68, 0x17, 0xe0, 0x00, 0x24, 
-0xb9, 0x42, 0x09, 0xd9, 0x81, 0x42, 0x12, 0xd9, 0x11, 0x68, 0x78, 0x1a, 
-0x00, 0xd5, 0x03, 0x30, 0x80, 0x10, 0x98, 0x42, 0x0b, 0xd8, 0x07, 0xe0, 
-0x81, 0x42, 0x05, 0xd8, 0x78, 0x1a, 0x00, 0xd5, 0x03, 0x30, 0x80, 0x10, 
-0x98, 0x42, 0x02, 0xd8, 0x20, 0x1c, 0x90, 0xbc, 0x70, 0x47, 0xc8, 0x1d, 
-0x05, 0x30, 0xfa, 0xe7, 0x70, 0x04, 0x00, 0x80, 0x80, 0xb5, 0x80, 0x00, 
-0x0f, 0x4a, 0x17, 0x58, 0x88, 0x07, 0x02, 0xd0, 0x88, 0x08, 0x04, 0x30, 
-0x01, 0xe0, 0x88, 0x08, 0x03, 0x30, 0x39, 0x69, 0x7a, 0x68, 0x91, 0x42, 
-0x09, 0xd9, 0x39, 0x68, 0xc0, 0x46, 0x39, 0x61, 0xf9, 0x68, 0x7a, 0x68, 
+0x03, 0x30, 0x80, 0x08, 0x80, 0x00, 0x06, 0x49, 0x0a, 0x68, 0x10, 0x18, 
+0x08, 0x60, 0x01, 0x23, 0x5b, 0x02, 0x98, 0x42, 0x03, 0xd9, 0x03, 0x49, 
+0x0a, 0x79, 0x01, 0x32, 0x0a, 0x71, 0x70, 0x47, 0xe4, 0x2d, 0x00, 0x80, 
+0xa0, 0x82, 0x20, 0x40, 0x02, 0x48, 0x41, 0x79, 0x01, 0x31, 0x41, 0x71, 
+0x70, 0x47, 0x00, 0x00, 0xa0, 0x82, 0x20, 0x40, 0x90, 0xb4, 0x82, 0x00, 
+0x17, 0x4b, 0x9a, 0x58, 0x8b, 0x07, 0x02, 0xd0, 0x89, 0x08, 0x0b, 0x1d, 
+0x01, 0xe0, 0x89, 0x08, 0xcb, 0x1c, 0x11, 0x69, 0xd7, 0x68, 0x12, 0x4c, 
+0x80, 0x00, 0x20, 0x58, 0x40, 0x68, 0xb9, 0x42, 0x03, 0xd1, 0x81, 0x42, 
+0x19, 0xd9, 0x11, 0x68, 0x17, 0xe0, 0x00, 0x24, 0xb9, 0x42, 0x09, 0xd9, 
+0x81, 0x42, 0x12, 0xd9, 0x11, 0x68, 0x78, 0x1a, 0x00, 0xd5, 0x03, 0x30, 
+0x80, 0x10, 0x98, 0x42, 0x0b, 0xd8, 0x07, 0xe0, 0x81, 0x42, 0x05, 0xd8, 
+0x78, 0x1a, 0x00, 0xd5, 0x03, 0x30, 0x80, 0x10, 0x98, 0x42, 0x02, 0xd8, 
+0x20, 0x1c, 0x90, 0xbc, 0x70, 0x47, 0xc8, 0x1d, 0x05, 0x30, 0xfa, 0xe7, 
+0x70, 0x04, 0x00, 0x80, 0x80, 0xb5, 0x80, 0x00, 0x0f, 0x4a, 0x17, 0x58, 
+0x88, 0x07, 0x02, 0xd0, 0x88, 0x08, 0x04, 0x30, 0x01, 0xe0, 0x88, 0x08, 
+0x03, 0x30, 0x39, 0x69, 0x7a, 0x68, 0x91, 0x42, 0x09, 0xd9, 0x39, 0x68, 
+0xc0, 0x46, 0x39, 0x61, 0xf9, 0x68, 0x7a, 0x68, 0x91, 0x42, 0x02, 0xd9, 
+0x39, 0x68, 0xc0, 0x46, 0xf9, 0x60, 0x81, 0x00, 0x38, 0x69, 0x00, 0xf0, 
+0xd1, 0xfd, 0x38, 0x61, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
+0x70, 0x04, 0x00, 0x80, 0x90, 0xb5, 0x03, 0x21, 0x09, 0x07, 0x01, 0x40, 
+0x0c, 0x0f, 0x01, 0x04, 0x09, 0x0c, 0x01, 0x22, 0x92, 0x07, 0x02, 0x40, 
+0xa3, 0x00, 0x1c, 0x4f, 0xff, 0x58, 0x89, 0x07, 0x89, 0x0f, 0x00, 0x04, 
+0x00, 0x0c, 0x80, 0x08, 0x00, 0x29, 0x00, 0xd0, 0x01, 0x30, 0x00, 0x2a, 
+0x01, 0xd0, 0x02, 0x30, 0x00, 0xe0, 0x03, 0x30, 0xf9, 0x68, 0x7a, 0x68, 
 0x91, 0x42, 0x02, 0xd9, 0x39, 0x68, 0xc0, 0x46, 0xf9, 0x60, 0x81, 0x00, 
-0x38, 0x69, 0x00, 0xf0, 0xd1, 0xfd, 0x38, 0x61, 0x80, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0x70, 0x04, 0x00, 0x80, 0x90, 0xb5, 0x03, 0x21, 
-0x09, 0x07, 0x01, 0x40, 0x0c, 0x0f, 0x01, 0x04, 0x09, 0x0c, 0x01, 0x22, 
-0x92, 0x07, 0x02, 0x40, 0xa3, 0x00, 0x1c, 0x4f, 0xff, 0x58, 0x89, 0x07, 
-0x89, 0x0f, 0x00, 0x04, 0x00, 0x0c, 0x80, 0x08, 0x00, 0x29, 0x00, 0xd0, 
-0x01, 0x30, 0x00, 0x2a, 0x01, 0xd0, 0x02, 0x30, 0x00, 0xe0, 0x03, 0x30, 
-0xf9, 0x68, 0x7a, 0x68, 0x91, 0x42, 0x02, 0xd9, 0x39, 0x68, 0xc0, 0x46, 
-0xf9, 0x60, 0x81, 0x00, 0xf8, 0x68, 0x00, 0xf0, 0xa5, 0xfd, 0xf8, 0x60, 
-0x0f, 0x48, 0x00, 0x69, 0x00, 0x28, 0x05, 0xd0, 0x01, 0x20, 0xa0, 0x40, 
-0x02, 0xd0, 0x20, 0x1c, 0xfe, 0xf7, 0xca, 0xfc, 0x0b, 0x49, 0xc8, 0x1d, 
-0x19, 0x30, 0x03, 0x79, 0x00, 0x22, 0x00, 0x2b, 0x05, 0xd1, 0x09, 0x49, 
-0xc8, 0x1d, 0x19, 0x30, 0x03, 0x79, 0x00, 0x2b, 0x03, 0xd0, 0x02, 0x71, 
-0x08, 0x1c, 0xff, 0xf7, 0x79, 0xf9, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x70, 0x04, 0x00, 0x80, 0xd0, 0x2c, 0x00, 0x80, 0x64, 0x2d, 0x00, 0x80, 
-0xe4, 0x2c, 0x00, 0x80, 0xb0, 0xb5, 0x2b, 0x49, 0x09, 0x79, 0x00, 0x29, 
-0x03, 0xd1, 0x41, 0x68, 0x29, 0x4b, 0x19, 0x43, 0x41, 0x60, 0x81, 0x68, 
+0xf8, 0x68, 0x00, 0xf0, 0xa5, 0xfd, 0xf8, 0x60, 0x0f, 0x48, 0x00, 0x69, 
+0x00, 0x28, 0x05, 0xd0, 0x01, 0x20, 0xa0, 0x40, 0x02, 0xd0, 0x20, 0x1c, 
+0xfe, 0xf7, 0xca, 0xfc, 0x0b, 0x49, 0xc8, 0x1d, 0x19, 0x30, 0x03, 0x79, 
+0x00, 0x22, 0x00, 0x2b, 0x05, 0xd1, 0x09, 0x49, 0xc8, 0x1d, 0x19, 0x30, 
+0x03, 0x79, 0x00, 0x2b, 0x03, 0xd0, 0x02, 0x71, 0x08, 0x1c, 0xff, 0xf7, 
+0x79, 0xf9, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x70, 0x04, 0x00, 0x80, 
+0xd0, 0x2c, 0x00, 0x80, 0x64, 0x2d, 0x00, 0x80, 0xe4, 0x2c, 0x00, 0x80, 
+0xb0, 0xb5, 0x2b, 0x49, 0x09, 0x79, 0x00, 0x29, 0x03, 0xd1, 0x41, 0x68, 
+0x29, 0x4b, 0x19, 0x43, 0x41, 0x60, 0x81, 0x68, 
 0x49, 0x08, 0x02, 0xd3, 0x09, 0x21, 0x09, 0x04, 0x01, 0xe0, 0x0d, 0x21, 
-0x09, 0x04, 0x0c, 0xc8, 0x08, 0x38, 0x19, 0x43, 
-0x87, 0x68, 0xbb, 0x0a, 0x03, 0xd3, 0x43, 0x68, 0x5b, 0x08, 0x00, 0xd3, 
-0x01, 0x31, 0x40, 0x68, 0x03, 0x23, 0x1b, 0x07, 0x18, 0x40, 0x07, 0x0f, 
-0xf8, 0x00, 0x1d, 0x4c, 0x00, 0x19, 0x23, 0x68, 0xc0, 0x18, 0x50, 0x30, 
-0x00, 0x79, 0x01, 0x28, 0x10, 0xd1, 0x60, 0x68, 0x01, 0x28, 0x0d, 0xd0, 
-0x10, 0x1c, 0x00, 0xf0, 0x71, 0xf8, 0x38, 0x01, 0x00, 0x19, 0x19, 0x23, 
-0xdb, 0x01, 0xc0, 0x18, 0x41, 0x6b, 0x01, 0x39, 0x41, 0x63, 0xb0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x38, 0x01, 0x00, 0x19, 0x19, 0x23, 0xdb, 0x01, 
-0xc0, 0x18, 0x03, 0x6b, 0x5d, 0x1c, 0x05, 0x63, 0xbd, 0x02, 0x2d, 0x19, 
-0xdb, 0x00, 0xeb, 0x18, 0x80, 0x33, 0x19, 0x63, 0xda, 0x62, 0x81, 0x6b, 
-0x01, 0x31, 0x81, 0x63, 0x01, 0x21, 0xb9, 0x40, 0x22, 0x68, 0x11, 0x43, 
-0x21, 0x60, 0x01, 0x6b, 0x80, 0x29, 0xe2, 0xd3, 0x00, 0x21, 0x01, 0x63, 
-0xdf, 0xe7, 0x00, 0x00, 0x28, 0x0f, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 
-0xa0, 0x1c, 0x00, 0x80, 0xf0, 0xb5, 0x1f, 0x4e, 0x70, 0x68, 0x00, 0x28, 
-0x36, 0xd1, 0x00, 0x24, 0xb1, 0x68, 0x48, 0x1c, 0xc9, 0x00, 0x89, 0x19, 
-0xb0, 0x60, 0x32, 0x68, 0x89, 0x18, 0x60, 0x31, 0x0d, 0x7b, 0x08, 0x28, 
-0x00, 0xd3, 0xb4, 0x60, 0x28, 0x01, 0x80, 0x19, 0x19, 0x23, 0xdb, 0x01, 
-0xc0, 0x18, 0x87, 0x6b, 0x00, 0x2f, 0x21, 0xd0, 0xc1, 0x6a, 0x4b, 0x1c, 
-0xaa, 0x02, 0x92, 0x19, 0xc9, 0x00, 0x51, 0x18, 0x80, 0x31, 0xc3, 0x62, 
-0xca, 0x6a, 0x09, 0x6b, 0x01, 0x3f, 0x87, 0x63, 0x80, 0x2b, 0x00, 0xd3, 
-0xc4, 0x62, 0x00, 0x2f, 0x06, 0xd1, 0x01, 0x27, 0xaf, 0x40, 0x3b, 0x1c, 
-0xdb, 0x43, 0x37, 0x68, 0x3b, 0x40, 0x33, 0x60, 0x43, 0x6b, 0x01, 0x3b, 
-0x43, 0x63, 0x10, 0x1c, 0x37, 0x1c, 0x00, 0xf0, 0x09, 0xf8, 0x78, 0x68, 
-0x00, 0x28, 0xc9, 0xd0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0xa0, 0x1c, 0x00, 0x80, 0xf0, 0xb5, 0xcd, 0x0f, 0xed, 0x07, 0x01, 0x24, 
-0x00, 0x27, 0x2e, 0x4b, 0x2e, 0x4a, 0x00, 0x2d, 0x1d, 0xd0, 0xd8, 0x6a, 
-0x01, 0x30, 0xd8, 0x62, 0x10, 0x1c, 0x52, 0x69, 0x00, 0x2a, 0x12, 0xd0, 
-0x02, 0x69, 0x53, 0x1c, 0x92, 0x00, 0x12, 0x18, 0x03, 0x61, 0x91, 0x61, 
-0x41, 0x69, 0x01, 0x31, 0x41, 0x61, 0x02, 0x69, 0x0f, 0x2a, 0x00, 0xd3, 
-0x07, 0x61, 0x0f, 0x29, 0x00, 0xd3, 0x44, 0x60, 0xf0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x08, 0x1c, 0xff, 0xf7, 0xee, 0xfe, 0xf8, 0xe7, 0x15, 0x69, 
-0x6e, 0x1c, 0xad, 0x00, 0xad, 0x18, 0x16, 0x61, 0xa9, 0x61, 0x55, 0x69, 
-0x01, 0x35, 0x55, 0x61, 0x16, 0x69, 0x0f, 0x2e, 0x00, 0xd3, 0x17, 0x61, 
-0x0f, 0x2d, 0x00, 0xd3, 0x54, 0x60, 0x8c, 0x02, 0xa4, 0x0a, 0x16, 0x4f, 
-0x3a, 0x6f, 0xfd, 0x68, 0xf9, 0x1d, 0x79, 0x31, 0x01, 0x2d, 0x0c, 0xd1, 
-0xdb, 0x6d, 0x5b, 0x08, 0x09, 0xd3, 0x0b, 0x89, 0x00, 0x2b, 0x06, 0xd1, 
-0xfd, 0x6f, 0x03, 0x3b, 0x2e, 0x68, 0x33, 0x40, 0x2b, 0x60, 0x14, 0x23, 
-0x0b, 0x81, 0x10, 0x60, 0x80, 0x07, 0x80, 0x0a, 0x20, 0x43, 0x03, 0x04, 
-0x00, 0xd0, 0x01, 0x38, 0x50, 0x60, 0x09, 0x6a, 0x08, 0x32, 0x91, 0x42, 
-0x00, 0xd8, 0x07, 0x4a, 0x00, 0x0d, 0x02, 0xd3, 0x51, 0x20, 0x80, 0x03, 
-0x82, 0x61, 0x3a, 0x67, 0xbe, 0xe7, 0x00, 0x00, 0xa4, 0x2a, 0x00, 0x80, 
-0xa0, 0x1c, 0x00, 0x80, 0x68, 0x0e, 0x00, 0x80, 0x24, 0xa7, 0x20, 0x40, 
+0x09, 0x04, 0x0c, 0xc8, 0x08, 0x38, 0x19, 0x43, 0x87, 0x68, 0xbb, 0x0a, 
+0x03, 0xd3, 0x43, 0x68, 0x5b, 0x08, 0x00, 0xd3, 0x01, 0x31, 0x40, 0x68, 
+0x03, 0x23, 0x1b, 0x07, 0x18, 0x40, 0x07, 0x0f, 0xf8, 0x00, 0x1d, 0x4c, 
+0x00, 0x19, 0x23, 0x68, 0xc0, 0x18, 0x50, 0x30, 0x00, 0x79, 0x01, 0x28, 
+0x10, 0xd1, 0x60, 0x68, 0x01, 0x28, 0x0d, 0xd0, 0x10, 0x1c, 0x00, 0xf0, 
+0x71, 0xf8, 0x38, 0x01, 0x00, 0x19, 0x19, 0x23, 0xdb, 0x01, 0xc0, 0x18, 
+0x41, 0x6b, 0x01, 0x39, 0x41, 0x63, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x38, 0x01, 0x00, 0x19, 0x19, 0x23, 0xdb, 0x01, 0xc0, 0x18, 0x03, 0x6b, 
+0x5d, 0x1c, 0x05, 0x63, 0xbd, 0x02, 0x2d, 0x19, 0xdb, 0x00, 0xeb, 0x18, 
+0x80, 0x33, 0x19, 0x63, 0xda, 0x62, 0x81, 0x6b, 0x01, 0x31, 0x81, 0x63, 
+0x01, 0x21, 0xb9, 0x40, 0x22, 0x68, 0x11, 0x43, 0x21, 0x60, 0x01, 0x6b, 
+0x80, 0x29, 0xe2, 0xd3, 0x00, 0x21, 0x01, 0x63, 0xdf, 0xe7, 0x00, 0x00, 
+0x28, 0x0f, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0xa0, 0x1c, 0x00, 0x80, 
+0xf0, 0xb5, 0x1f, 0x4e, 0x70, 0x68, 0x00, 0x28, 0x36, 0xd1, 0x00, 0x24, 
+0xb1, 0x68, 0x48, 0x1c, 0xc9, 0x00, 0x89, 0x19, 0xb0, 0x60, 0x32, 0x68, 
+0x89, 0x18, 0x60, 0x31, 0x0d, 0x7b, 0x08, 0x28, 0x00, 0xd3, 0xb4, 0x60, 
+0x28, 0x01, 0x80, 0x19, 0x19, 0x23, 0xdb, 0x01, 0xc0, 0x18, 0x87, 0x6b, 
+0x00, 0x2f, 0x21, 0xd0, 0xc1, 0x6a, 0x4b, 0x1c, 0xaa, 0x02, 0x92, 0x19, 
+0xc9, 0x00, 0x51, 0x18, 0x80, 0x31, 0xc3, 0x62, 0xca, 0x6a, 0x09, 0x6b, 
+0x01, 0x3f, 0x87, 0x63, 0x80, 0x2b, 0x00, 0xd3, 0xc4, 0x62, 0x00, 0x2f, 
+0x06, 0xd1, 0x01, 0x27, 0xaf, 0x40, 0x3b, 0x1c, 0xdb, 0x43, 0x37, 0x68, 
+0x3b, 0x40, 0x33, 0x60, 0x43, 0x6b, 0x01, 0x3b, 0x43, 0x63, 0x10, 0x1c, 
+0x37, 0x1c, 0x00, 0xf0, 0x09, 0xf8, 0x78, 0x68, 0x00, 0x28, 0xc9, 0xd0, 
+0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0xa0, 0x1c, 0x00, 0x80, 
+0xf0, 0xb5, 0xcd, 0x0f, 0xed, 0x07, 0x01, 0x24, 0x00, 0x27, 0x2e, 0x4b, 
+0x2e, 0x4a, 0x00, 0x2d, 0x1d, 0xd0, 0xd8, 0x6a, 0x01, 0x30, 0xd8, 0x62, 
+0x10, 0x1c, 0x52, 0x69, 0x00, 0x2a, 0x12, 0xd0, 0x02, 0x69, 0x53, 0x1c, 
+0x92, 0x00, 0x12, 0x18, 0x03, 0x61, 0x91, 0x61, 0x41, 0x69, 0x01, 0x31, 
+0x41, 0x61, 0x02, 0x69, 0x0f, 0x2a, 0x00, 0xd3, 0x07, 0x61, 0x0f, 0x29, 
+0x00, 0xd3, 0x44, 0x60, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x08, 0x1c, 
+0xff, 0xf7, 0xee, 0xfe, 0xf8, 0xe7, 0x15, 0x69, 0x6e, 0x1c, 0xad, 0x00, 
+0xad, 0x18, 0x16, 0x61, 0xa9, 0x61, 0x55, 0x69, 0x01, 0x35, 0x55, 0x61, 
+0x16, 0x69, 0x0f, 0x2e, 0x00, 0xd3, 0x17, 0x61, 0x0f, 0x2d, 0x00, 0xd3, 
+0x54, 0x60, 0x8c, 0x02, 0xa4, 0x0a, 0x16, 0x4f, 0x3a, 0x6f, 0xfd, 0x68, 
+0xf9, 0x1d, 0x79, 0x31, 0x01, 0x2d, 0x0c, 0xd1, 0xdb, 0x6d, 0x5b, 0x08, 
+0x09, 0xd3, 0x0b, 0x89, 0x00, 0x2b, 0x06, 0xd1, 0xfd, 0x6f, 0x03, 0x3b, 
+0x2e, 0x68, 0x33, 0x40, 0x2b, 0x60, 0x14, 0x23, 0x0b, 0x81, 0x10, 0x60, 
+0x80, 0x07, 0x80, 0x0a, 0x20, 0x43, 0x03, 0x04, 0x00, 0xd0, 0x01, 0x38, 
+0x50, 0x60, 0x09, 0x6a, 0x08, 0x32, 0x91, 0x42, 0x00, 0xd8, 0x07, 0x4a, 
+0x00, 0x0d, 0x02, 0xd3, 0x51, 0x20, 0x80, 0x03, 0x82, 0x61, 0x3a, 0x67, 
+0xbe, 0xe7, 0x00, 0x00, 0xa4, 0x2a, 0x00, 0x80, 0xa0, 0x1c, 0x00, 0x80, 
+0x68, 0x0e, 0x00, 0x80, 0x24, 0xa7, 0x20, 0x40, 
 0xb0, 0xb5, 0x00, 0x28, 0x04, 0xd1, 0x01, 0x20, 0xc0, 0x05, 0x16, 0x49, 
-0xc0, 0x46, 0x08, 0x60, 0x15, 0x4c, 0x00, 0x25, 
-0x67, 0x69, 0x00, 0x2f, 0x16, 0xd0, 0xe0, 0x68, 0x41, 0x1c, 0x80, 0x00, 
-0x00, 0x19, 0xe1, 0x60, 0x80, 0x69, 0x01, 0x3f, 0xff, 0xf7, 0x94, 0xfe, 
-0xe0, 0x68, 0x0f, 0x28, 0x00, 0xd3, 0xe5, 0x60, 0xe0, 0x68, 0x80, 0x00, 
-0x00, 0x19, 0x80, 0x69, 0x00, 0x08, 0x01, 0xd3, 0x00, 0x2f, 0xea, 0xd1, 
-0x67, 0x61, 0x03, 0xe0, 0x08, 0x48, 0x01, 0x6d, 0x01, 0x31, 0x01, 0x65, 
-0x65, 0x60, 0x20, 0x68, 0x00, 0x28, 0x01, 0xd0, 0xff, 0xf7, 0x26, 0xff, 
-0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 
-0xa0, 0x1c, 0x00, 0x80, 0xa0, 0x82, 0x20, 0x40, 0x00, 0x20, 0x70, 0x47, 
-0xb0, 0xb4, 0x10, 0x23, 0x82, 0x68, 0x13, 0x40, 0x00, 0x21, 0x00, 0x2b, 
-0x15, 0xd0, 0x0c, 0x4b, 0x1a, 0x40, 0x12, 0x01, 0x81, 0x24, 0x14, 0x43, 
-0x02, 0x68, 0x15, 0x68, 0x13, 0x1d, 0x80, 0xcb, 0x1b, 0x68, 0x04, 0x3a, 
-0x02, 0x60, 0x20, 0xc2, 0x80, 0xc2, 0x08, 0xc2, 0x14, 0x60, 0x42, 0x68, 
-0x01, 0x23, 0x9b, 0x07, 0x04, 0x32, 0x1a, 0x43, 0x42, 0x60, 0x08, 0x1c, 
-0xb0, 0xbc, 0x70, 0x47, 0x00, 0xf0, 0xff, 0x0f, 0xf0, 0xb4, 0x82, 0x68, 
-0x53, 0x09, 0x34, 0xd3, 0x1b, 0x4b, 0x1a, 0x40, 0x12, 0x01, 0x81, 0x26, 
-0x16, 0x43, 0x03, 0x68, 0x1d, 0x68, 0x1f, 0x1d, 0x10, 0xcf, 0x3f, 0x68, 
-0x04, 0x3b, 0x03, 0x60, 0x20, 0xc3, 0x10, 0xc3, 0x80, 0xc3, 0x1e, 0x60, 
-0x43, 0x68, 0x1f, 0x1d, 0x01, 0x23, 0x9b, 0x07, 0x3b, 0x43, 0x43, 0x60, 
-0xcb, 0x6b, 0x18, 0x1f, 0xc8, 0x63, 0x80, 0xcb, 0x80, 0xc0, 0x1c, 0x68, 
-0x1f, 0x1d, 0x03, 0x1d, 0x04, 0x60, 0x38, 0x1c, 0x3f, 0x68, 0xc0, 0x46, 
-0x1f, 0x60, 0x1f, 0x1d, 0x43, 0x68, 0x1c, 0x04, 0x24, 0x0c, 0x81, 0x23, 
-0x23, 0x43, 0x3b, 0x60, 0x40, 0x68, 0x00, 0x0c, 0x00, 0x04, 0x10, 0x43, 
-0x78, 0x60, 0x08, 0x6e, 0x04, 0x30, 0x08, 0x66, 0x48, 0x6e, 0x04, 0x30, 
-0x48, 0x66, 0x00, 0x20, 0xf0, 0xbc, 0x70, 0x47, 0x00, 0xf0, 0xff, 0x0f, 
-0x80, 0xb4, 0x81, 0x6a, 0x01, 0x23, 0x9b, 0x07, 0xca, 0x1d, 0x05, 0x32, 
-0x1a, 0x43, 0x12, 0x68, 0xcf, 0x1d, 0x01, 0x37, 0x3b, 0x43, 0x1b, 0x68, 
-0xc0, 0x46, 0xcb, 0x60, 0x01, 0x23, 0x9b, 0x07, 0x0f, 0x1d, 0x3b, 0x43, 
-0x1b, 0x68, 0xc0, 0x46, 0x8b, 0x60, 0x01, 0x23, 0x9b, 0x07, 0x0b, 0x43, 
-0x1b, 0x68, 0x0c, 0xc1, 0x02, 0x62, 0x01, 0x6b, 0xc0, 0x46, 0x0a, 0x62, 
-0x04, 0x23, 0x81, 0x69, 0x19, 0x43, 0x81, 0x61, 0x02, 0x6b, 0xc0, 0x46, 
-0x91, 0x61, 0x81, 0x6a, 0x04, 0x31, 0x81, 0x62, 0x02, 0x6b, 0xc0, 0x46, 
-0x91, 0x62, 0xc1, 0x1d, 0x39, 0x31, 0x4a, 0x8b, 0x04, 0x3a, 0x4a, 0x83, 
-0x49, 0x8b, 0x02, 0x6b, 0x40, 0x32, 0x51, 0x83, 0xc1, 0x89, 0x04, 0x39, 
-0xc1, 0x81, 0xc1, 0x68, 0x00, 0x6b, 0xc0, 0x46, 0xc1, 0x60, 0x00, 0x20, 
-0x80, 0xbc, 0x70, 0x47, 0x00, 0x47, 0x08, 0x47, 0x10, 0x47, 0x18, 0x47, 
-0x20, 0x47, 0x28, 0x47, 0x30, 0x47, 0x38, 0x47, 0x30, 0x40, 0x2d, 0xe9, 
-0x0c, 0xc0, 0x9d, 0xe5, 0x0c, 0x48, 0xa0, 0xe1, 0x24, 0x48, 0xb0, 0xe1, 
-0x1e, 0x00, 0x00, 0x0a, 0x01, 0xc0, 0x4c, 0xe2, 0x18, 0x40, 0xa0, 0xe3, 
-0x64, 0x51, 0x9f, 0xe5, 0x94, 0x50, 0x20, 0xe0, 0x00, 0x50, 0x90, 0xe5, 
-0x14, 0x40, 0x90, 0xe5, 0x00, 0x30, 0x85, 0xe5, 0x04, 0xc0, 0x85, 0xe5, 
-0x08, 0x10, 0x85, 0xe5, 0x0c, 0x20, 0x85, 0xe5, 0x10, 0x10, 0x90, 0xe5, 
+0xc0, 0x46, 0x08, 0x60, 0x15, 0x4c, 0x00, 0x25, 0x67, 0x69, 0x00, 0x2f, 
+0x16, 0xd0, 0xe0, 0x68, 0x41, 0x1c, 0x80, 0x00, 0x00, 0x19, 0xe1, 0x60, 
+0x80, 0x69, 0x01, 0x3f, 0xff, 0xf7, 0x94, 0xfe, 0xe0, 0x68, 0x0f, 0x28, 
+0x00, 0xd3, 0xe5, 0x60, 0xe0, 0x68, 0x80, 0x00, 0x00, 0x19, 0x80, 0x69, 
+0x00, 0x08, 0x01, 0xd3, 0x00, 0x2f, 0xea, 0xd1, 0x67, 0x61, 0x03, 0xe0, 
+0x08, 0x48, 0x01, 0x6d, 0x01, 0x31, 0x01, 0x65, 0x65, 0x60, 0x20, 0x68, 
+0x00, 0x28, 0x01, 0xd0, 0xff, 0xf7, 0x26, 0xff, 0xb0, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xa0, 0x1c, 0x00, 0x80, 
+0xa0, 0x82, 0x20, 0x40, 0x00, 0x20, 0x70, 0x47, 0xb0, 0xb4, 0x10, 0x23, 
+0x82, 0x68, 0x13, 0x40, 0x00, 0x21, 0x00, 0x2b, 0x15, 0xd0, 0x0c, 0x4b, 
+0x1a, 0x40, 0x12, 0x01, 0x81, 0x24, 0x14, 0x43, 0x02, 0x68, 0x15, 0x68, 
+0x13, 0x1d, 0x80, 0xcb, 0x1b, 0x68, 0x04, 0x3a, 0x02, 0x60, 0x20, 0xc2, 
+0x80, 0xc2, 0x08, 0xc2, 0x14, 0x60, 0x42, 0x68, 0x01, 0x23, 0x9b, 0x07, 
+0x04, 0x32, 0x1a, 0x43, 0x42, 0x60, 0x08, 0x1c, 0xb0, 0xbc, 0x70, 0x47, 
+0x00, 0xf0, 0xff, 0x0f, 0xf0, 0xb4, 0x82, 0x68, 0x53, 0x09, 0x34, 0xd3, 
+0x1b, 0x4b, 0x1a, 0x40, 0x12, 0x01, 0x81, 0x26, 0x16, 0x43, 0x03, 0x68, 
+0x1d, 0x68, 0x1f, 0x1d, 0x10, 0xcf, 0x3f, 0x68, 0x04, 0x3b, 0x03, 0x60, 
+0x20, 0xc3, 0x10, 0xc3, 0x80, 0xc3, 0x1e, 0x60, 0x43, 0x68, 0x1f, 0x1d, 
+0x01, 0x23, 0x9b, 0x07, 0x3b, 0x43, 0x43, 0x60, 0xcb, 0x6b, 0x18, 0x1f, 
+0xc8, 0x63, 0x80, 0xcb, 0x80, 0xc0, 0x1c, 0x68, 0x1f, 0x1d, 0x03, 0x1d, 
+0x04, 0x60, 0x38, 0x1c, 0x3f, 0x68, 0xc0, 0x46, 0x1f, 0x60, 0x1f, 0x1d, 
+0x43, 0x68, 0x1c, 0x04, 0x24, 0x0c, 0x81, 0x23, 0x23, 0x43, 0x3b, 0x60, 
+0x40, 0x68, 0x00, 0x0c, 0x00, 0x04, 0x10, 0x43, 0x78, 0x60, 0x08, 0x6e, 
+0x04, 0x30, 0x08, 0x66, 0x48, 0x6e, 0x04, 0x30, 0x48, 0x66, 0x00, 0x20, 
+0xf0, 0xbc, 0x70, 0x47, 0x00, 0xf0, 0xff, 0x0f, 0x80, 0xb4, 0x81, 0x6a, 
+0x01, 0x23, 0x9b, 0x07, 0xca, 0x1d, 0x05, 0x32, 0x1a, 0x43, 0x12, 0x68, 
+0xcf, 0x1d, 0x01, 0x37, 0x3b, 0x43, 0x1b, 0x68, 0xc0, 0x46, 0xcb, 0x60, 
+0x01, 0x23, 0x9b, 0x07, 0x0f, 0x1d, 0x3b, 0x43, 0x1b, 0x68, 0xc0, 0x46, 
+0x8b, 0x60, 0x01, 0x23, 0x9b, 0x07, 0x0b, 0x43, 0x1b, 0x68, 0x0c, 0xc1, 
+0x02, 0x62, 0x01, 0x6b, 0xc0, 0x46, 0x0a, 0x62, 0x04, 0x23, 0x81, 0x69, 
+0x19, 0x43, 0x81, 0x61, 0x02, 0x6b, 0xc0, 0x46, 0x91, 0x61, 0x81, 0x6a, 
+0x04, 0x31, 0x81, 0x62, 0x02, 0x6b, 0xc0, 0x46, 0x91, 0x62, 0xc1, 0x1d, 
+0x39, 0x31, 0x4a, 0x8b, 0x04, 0x3a, 0x4a, 0x83, 0x49, 0x8b, 0x02, 0x6b, 
+0x40, 0x32, 0x51, 0x83, 0xc1, 0x89, 0x04, 0x39, 0xc1, 0x81, 0xc1, 0x68, 
+0x00, 0x6b, 0xc0, 0x46, 0xc1, 0x60, 0x00, 0x20, 0x80, 0xbc, 0x70, 0x47, 
+0x00, 0x47, 0x08, 0x47, 0x10, 0x47, 0x18, 0x47, 0x20, 0x47, 0x28, 0x47, 
+0x30, 0x47, 0x38, 0x47, 0x30, 0x40, 0x2d, 0xe9, 0x0c, 0xc0, 0x9d, 0xe5, 
+0x0c, 0x48, 0xa0, 0xe1, 0x24, 0x48, 0xb0, 0xe1, 0x1e, 0x00, 0x00, 0x0a, 
+0x01, 0xc0, 0x4c, 0xe2, 0x18, 0x40, 0xa0, 0xe3, 0x64, 0x51, 0x9f, 0xe5, 
+0x94, 0x50, 0x20, 0xe0, 0x00, 0x50, 0x90, 0xe5, 0x14, 0x40, 0x90, 0xe5, 
+0x00, 0x30, 0x85, 0xe5, 0x04, 0xc0, 0x85, 0xe5, 0x08, 0x10, 0x85, 0xe5, 
+0x0c, 0x20, 0x85, 0xe5, 0x10, 0x10, 0x90, 0xe5, 
 0x10, 0x50, 0x85, 0xe2, 0x01, 0x00, 0x55, 0xe1, 0x0c, 0x50, 0x90, 0x55, 
-0x04, 0x00, 0x55, 0xe1, 0x05, 0x00, 0x00, 0x0a, 
-0x04, 0x10, 0x90, 0xe5, 0x00, 0x50, 0x80, 0xe5, 0x00, 0x50, 0x81, 0xe5, 
-0x00, 0x00, 0xa0, 0xe3, 0x30, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 
-0x00, 0x30, 0x93, 0xe5, 0x08, 0x20, 0x90, 0xe5, 0x01, 0x31, 0x83, 0xe3, 
-0x02, 0x36, 0x83, 0xe3, 0x03, 0x00, 0x55, 0xe1, 0x14, 0x30, 0x80, 0xe5, 
-0xf2, 0xff, 0xff, 0x1a, 0x01, 0x00, 0xa0, 0xe3, 0xf4, 0xff, 0xff, 0xea, 
-0x01, 0x06, 0x1c, 0xe3, 0xf1, 0xff, 0xff, 0x0a, 0xec, 0x10, 0x9f, 0xe5, 
-0x02, 0xc6, 0xcc, 0xe3, 0x54, 0x20, 0x91, 0xe5, 0xe4, 0x30, 0x9f, 0xe5, 
-0x50, 0x10, 0x91, 0xe5, 0xd9, 0xff, 0xff, 0xea, 0xf0, 0x47, 0x2d, 0xe9, 
-0x20, 0xc0, 0x9d, 0xe5, 0x0c, 0x68, 0xa0, 0xe1, 0x26, 0x68, 0xb0, 0xe1, 
-0x25, 0x00, 0x00, 0x0a, 0x18, 0x40, 0xa0, 0xe3, 0xb8, 0x50, 0x9f, 0xe5, 
-0x94, 0x00, 0x00, 0xe0, 0x05, 0x00, 0x80, 0xe0, 0x08, 0x40, 0x90, 0xe5, 
-0x04, 0x80, 0x90, 0xe5, 0x00, 0x70, 0xa0, 0xe3, 0x1f, 0xc0, 0xa0, 0xe3, 
-0x02, 0xc4, 0x8c, 0xe3, 0x00, 0x50, 0x90, 0xe5, 0x10, 0x90, 0x90, 0xe5, 
-0x14, 0xa0, 0x90, 0xe5, 0x00, 0x30, 0x85, 0xe5, 0x04, 0xc0, 0x85, 0xe5, 
-0x08, 0x10, 0x85, 0xe5, 0x0c, 0x20, 0x85, 0xe5, 0x10, 0x50, 0x85, 0xe2, 
-0x09, 0x00, 0x55, 0xe1, 0x0c, 0x50, 0x90, 0x55, 0x0a, 0x00, 0x55, 0xe1, 
-0x15, 0x00, 0x00, 0x0a, 0x03, 0x70, 0x17, 0xe2, 0x20, 0x10, 0x81, 0xe2, 
-0x20, 0x30, 0x83, 0xe2, 0x0a, 0x00, 0x00, 0x0a, 0x00, 0x60, 0x96, 0xe2, 
-0x01, 0x70, 0x87, 0xe2, 0x09, 0x00, 0x00, 0x0a, 0x20, 0x60, 0x46, 0xe2, 
-0x20, 0x00, 0x56, 0xe3, 0xec, 0xff, 0xff, 0xca, 0x00, 0x70, 0xa0, 0xe3, 
-0x01, 0xc0, 0x46, 0xe2, 0x02, 0xc4, 0x8c, 0xe3, 0x00, 0x60, 0xa0, 0xe3, 
-0xe7, 0xff, 0xff, 0xea, 0x00, 0x50, 0x88, 0xe5, 0xf2, 0xff, 0xff, 0xea, 
-0x00, 0x10, 0xa0, 0xe3, 0x00, 0x50, 0x80, 0xe5, 0x01, 0x00, 0xa0, 0xe1, 
-0xf0, 0x47, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 0x00, 0xa0, 0x94, 0xe5, 
-0x0a, 0x00, 0x55, 0xe1, 0x14, 0xa0, 0x80, 0xe5, 0xe5, 0xff, 0xff, 0x1a, 
-0x01, 0x10, 0xa0, 0xe3, 0xf5, 0xff, 0xff, 0xea, 0xa8, 0x03, 0x00, 0x80, 
-0x7c, 0x29, 0x00, 0x80, 0x00, 0x80, 0x20, 0x40, 0x68, 0x82, 0x9f, 0xe5, 
-0x0b, 0x92, 0xa0, 0xe3, 0x64, 0xa2, 0x9f, 0xe5, 0x58, 0xb0, 0x9a, 0xe5, 
-0x0e, 0xf0, 0xa0, 0xe1, 0x54, 0xb0, 0x9a, 0xe5, 0x1e, 0xff, 0x2f, 0xe1, 
-0x3f, 0x40, 0x2d, 0xe9, 0x00, 0x00, 0x4f, 0xe1, 0x1f, 0x00, 0x00, 0xe2, 
-0x12, 0x00, 0x50, 0xe3, 0x54, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x0f, 0xe1, 
-0x80, 0x00, 0xc0, 0xe3, 0x00, 0xf0, 0x21, 0xe1, 0x04, 0x50, 0xa0, 0xe3, 
-0x00, 0x40, 0x99, 0xe5, 0x09, 0x00, 0x00, 0xea, 0x02, 0x00, 0x14, 0xe3, 
-0x53, 0x00, 0x00, 0x1b, 0x80, 0x00, 0x14, 0xe3, 0x59, 0x00, 0x00, 0x1b, 
-0x20, 0x00, 0x14, 0xe3, 0x59, 0x00, 0x00, 0x1b, 0x02, 0x07, 0x14, 0xe3, 
-0x59, 0x00, 0x00, 0x1b, 0x01, 0x06, 0x14, 0xe3, 0x59, 0x00, 0x00, 0x1b, 
-0x08, 0x00, 0x14, 0xe3, 0x45, 0x00, 0x00, 0x1b, 0x02, 0x05, 0x14, 0xe3, 
-0x4a, 0x00, 0x00, 0x1b, 0x02, 0x08, 0x14, 0xe3, 0x4b, 0x00, 0x00, 0x1b, 
-0xe5, 0x0e, 0x14, 0xe3, 0x07, 0x00, 0x00, 0x0a, 0x04, 0x20, 0x98, 0xe5, 
-0x0c, 0x10, 0x98, 0xe5, 0x04, 0x30, 0x52, 0xe2, 0x3c, 0x30, 0xa0, 0xb3, 
-0x04, 0x30, 0x88, 0xe5, 0x02, 0x00, 0x91, 0xe7, 0x0f, 0xe0, 0xa0, 0xe1, 
+0x04, 0x00, 0x55, 0xe1, 0x05, 0x00, 0x00, 0x0a, 0x04, 0x10, 0x90, 0xe5, 
+0x00, 0x50, 0x80, 0xe5, 0x00, 0x50, 0x81, 0xe5, 0x00, 0x00, 0xa0, 0xe3, 
+0x30, 0x40, 0xbd, 0xe8, 0x1e, 0xff, 0x2f, 0xe1, 0x00, 0x30, 0x93, 0xe5, 
+0x08, 0x20, 0x90, 0xe5, 0x01, 0x31, 0x83, 0xe3, 0x02, 0x36, 0x83, 0xe3, 
+0x03, 0x00, 0x55, 0xe1, 0x14, 0x30, 0x80, 0xe5, 0xf2, 0xff, 0xff, 0x1a, 
+0x01, 0x00, 0xa0, 0xe3, 0xf4, 0xff, 0xff, 0xea, 0x01, 0x06, 0x1c, 0xe3, 
+0xf1, 0xff, 0xff, 0x0a, 0xec, 0x10, 0x9f, 0xe5, 0x02, 0xc6, 0xcc, 0xe3, 
+0x54, 0x20, 0x91, 0xe5, 0xe4, 0x30, 0x9f, 0xe5, 0x50, 0x10, 0x91, 0xe5, 
+0xd9, 0xff, 0xff, 0xea, 0xf0, 0x47, 0x2d, 0xe9, 0x20, 0xc0, 0x9d, 0xe5, 
+0x0c, 0x68, 0xa0, 0xe1, 0x26, 0x68, 0xb0, 0xe1, 0x25, 0x00, 0x00, 0x0a, 
+0x18, 0x40, 0xa0, 0xe3, 0xb8, 0x50, 0x9f, 0xe5, 0x94, 0x00, 0x00, 0xe0, 
+0x05, 0x00, 0x80, 0xe0, 0x08, 0x40, 0x90, 0xe5, 0x04, 0x80, 0x90, 0xe5, 
+0x00, 0x70, 0xa0, 0xe3, 0x1f, 0xc0, 0xa0, 0xe3, 0x02, 0xc4, 0x8c, 0xe3, 
+0x00, 0x50, 0x90, 0xe5, 0x10, 0x90, 0x90, 0xe5, 0x14, 0xa0, 0x90, 0xe5, 
+0x00, 0x30, 0x85, 0xe5, 0x04, 0xc0, 0x85, 0xe5, 0x08, 0x10, 0x85, 0xe5, 
+0x0c, 0x20, 0x85, 0xe5, 0x10, 0x50, 0x85, 0xe2, 0x09, 0x00, 0x55, 0xe1, 
+0x0c, 0x50, 0x90, 0x55, 0x0a, 0x00, 0x55, 0xe1, 0x15, 0x00, 0x00, 0x0a, 
+0x03, 0x70, 0x17, 0xe2, 0x20, 0x10, 0x81, 0xe2, 0x20, 0x30, 0x83, 0xe2, 
+0x0a, 0x00, 0x00, 0x0a, 0x00, 0x60, 0x96, 0xe2, 0x01, 0x70, 0x87, 0xe2, 
+0x09, 0x00, 0x00, 0x0a, 0x20, 0x60, 0x46, 0xe2, 0x20, 0x00, 0x56, 0xe3, 
+0xec, 0xff, 0xff, 0xca, 0x00, 0x70, 0xa0, 0xe3, 0x01, 0xc0, 0x46, 0xe2, 
+0x02, 0xc4, 0x8c, 0xe3, 0x00, 0x60, 0xa0, 0xe3, 0xe7, 0xff, 0xff, 0xea, 
+0x00, 0x50, 0x88, 0xe5, 0xf2, 0xff, 0xff, 0xea, 0x00, 0x10, 0xa0, 0xe3, 
+0x00, 0x50, 0x80, 0xe5, 0x01, 0x00, 0xa0, 0xe1, 0xf0, 0x47, 0xbd, 0xe8, 
+0x1e, 0xff, 0x2f, 0xe1, 0x00, 0xa0, 0x94, 0xe5, 0x0a, 0x00, 0x55, 0xe1, 
+0x14, 0xa0, 0x80, 0xe5, 0xe5, 0xff, 0xff, 0x1a, 0x01, 0x10, 0xa0, 0xe3, 
+0xf5, 0xff, 0xff, 0xea, 0xa8, 0x03, 0x00, 0x80, 0x7c, 0x29, 0x00, 0x80, 
+0x00, 0x80, 0x20, 0x40, 0x68, 0x82, 0x9f, 0xe5, 0x0b, 0x92, 0xa0, 0xe3, 
+0x64, 0xa2, 0x9f, 0xe5, 0x58, 0xb0, 0x9a, 0xe5, 0x0e, 0xf0, 0xa0, 0xe1, 
+0x54, 0xb0, 0x9a, 0xe5, 0x1e, 0xff, 0x2f, 0xe1, 0x3f, 0x40, 0x2d, 0xe9, 
+0x00, 0x00, 0x4f, 0xe1, 0x1f, 0x00, 0x00, 0xe2, 0x12, 0x00, 0x50, 0xe3, 
+0x54, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x0f, 0xe1, 0x80, 0x00, 0xc0, 0xe3, 
+0x00, 0xf0, 0x21, 0xe1, 0x04, 0x50, 0xa0, 0xe3, 0x00, 0x40, 0x99, 0xe5, 
+0x09, 0x00, 0x00, 0xea, 0x02, 0x00, 0x14, 0xe3, 0x53, 0x00, 0x00, 0x1b, 
+0x80, 0x00, 0x14, 0xe3, 0x59, 0x00, 0x00, 0x1b, 0x20, 0x00, 0x14, 0xe3, 
+0x59, 0x00, 0x00, 0x1b, 0x02, 0x07, 0x14, 0xe3, 0x59, 0x00, 0x00, 0x1b, 
+0x01, 0x06, 0x14, 0xe3, 0x59, 0x00, 0x00, 0x1b, 0x08, 0x00, 0x14, 0xe3, 
+0x45, 0x00, 0x00, 0x1b, 0x02, 0x05, 0x14, 0xe3, 0x4a, 0x00, 0x00, 0x1b, 
+0x02, 0x08, 0x14, 0xe3, 0x4b, 0x00, 0x00, 0x1b, 0xe5, 0x0e, 0x14, 0xe3, 
+0x07, 0x00, 0x00, 0x0a, 0x04, 0x20, 0x98, 0xe5, 0x0c, 0x10, 0x98, 0xe5, 
+0x04, 0x30, 0x52, 0xe2, 0x3c, 0x30, 0xa0, 0xb3, 0x04, 0x30, 0x88, 0xe5, 
+0x02, 0x00, 0x91, 0xe7, 0x0f, 0xe0, 0xa0, 0xe1, 
 0x10, 0xff, 0x2f, 0xe1, 0x01, 0x50, 0x55, 0xe2, 0x03, 0x00, 0x00, 0x0a, 
-0x00, 0x40, 0x99, 0xe5, 0x0c, 0x00, 0x9a, 0xe5, 
-0x00, 0x00, 0x14, 0xe1, 0x1b, 0xff, 0x2f, 0x11, 0x08, 0x00, 0x9a, 0xe5, 
-0x00, 0x00, 0x14, 0xe1, 0x0b, 0x00, 0x00, 0x0a, 0x01, 0x0c, 0x14, 0xe3, 
-0x98, 0x01, 0x9f, 0x15, 0x0f, 0xe0, 0xa0, 0x11, 0x10, 0xff, 0x2f, 0x11, 
-0x02, 0x04, 0x14, 0xe3, 0x8c, 0x01, 0x9f, 0x15, 0x0f, 0xe0, 0xa0, 0x11, 
-0x10, 0xff, 0x2f, 0x11, 0x01, 0x09, 0x14, 0xe3, 0x80, 0x01, 0x9f, 0x15, 
-0x0f, 0xe0, 0xa0, 0x11, 0x10, 0xff, 0x2f, 0x11, 0x04, 0x00, 0x9a, 0xe5, 
-0x00, 0x00, 0x14, 0xe1, 0x16, 0x00, 0x00, 0x0a, 0x54, 0xe0, 0x8f, 0xe2, 
-0x04, 0x00, 0x14, 0xe3, 0x40, 0x00, 0x9a, 0x15, 0x10, 0xff, 0x2f, 0x11, 
-0x02, 0x0a, 0x14, 0xe3, 0x44, 0x00, 0x9a, 0x15, 0x10, 0xff, 0x2f, 0x11, 
-0x02, 0x09, 0x14, 0xe3, 0x48, 0x00, 0x9a, 0x15, 0x10, 0xff, 0x2f, 0x11, 
-0x01, 0x02, 0x14, 0xe3, 0x4c, 0x00, 0x9a, 0x15, 0x10, 0xff, 0x2f, 0x11, 
-0x01, 0x04, 0x14, 0xe3, 0x50, 0x00, 0x9a, 0x15, 0x10, 0xff, 0x2f, 0x11, 
-0x01, 0x0a, 0x14, 0xe3, 0x21, 0x00, 0x00, 0x1b, 0x02, 0x00, 0x14, 0xe3, 
-0x0e, 0x00, 0x00, 0x1b, 0x10, 0x00, 0x9a, 0xe5, 0x00, 0x00, 0x14, 0xe1, 
-0x1c, 0x00, 0x00, 0x1b, 0x00, 0x40, 0x99, 0xe5, 0x04, 0x50, 0xa0, 0xe3, 
-0x00, 0x40, 0x94, 0xe2, 0x1b, 0xff, 0x2f, 0x11, 0x3f, 0x40, 0xbd, 0xe8, 
-0x04, 0xf0, 0x5e, 0xe2, 0xc0, 0x00, 0x80, 0xe3, 0x00, 0xf0, 0x61, 0xe1, 
-0xfa, 0xff, 0xff, 0xea, 0x18, 0x00, 0x9a, 0xe5, 0x1c, 0x10, 0x9a, 0xe5, 
-0x11, 0xff, 0x2f, 0xe1, 0x54, 0xb0, 0x9a, 0xe5, 0x1c, 0x10, 0x9a, 0xe5, 
-0x14, 0x00, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 0x20, 0x10, 0x9a, 0xe5, 
-0x00, 0x00, 0xa0, 0xe3, 0x11, 0xff, 0x2f, 0xe1, 0x24, 0x10, 0x9a, 0xe5, 
-0x11, 0xff, 0x2f, 0xe1, 0x28, 0x10, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 
-0x2c, 0x10, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 0x30, 0x10, 0x9a, 0xe5, 
-0x11, 0xff, 0x2f, 0xe1, 0x34, 0x10, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 
-0xfe, 0xff, 0xff, 0xea, 0x38, 0xe0, 0x9a, 0xe5, 0x3c, 0x10, 0x9a, 0xe5, 
-0x18, 0x00, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 0x38, 0xe0, 0x9a, 0xe5, 
-0x3c, 0x10, 0x9a, 0xe5, 0x14, 0x00, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 
-0x64, 0x20, 0x9f, 0xe5, 0x00, 0x30, 0x92, 0xe5, 0x00, 0x30, 0x53, 0xe0, 
-0x0a, 0x00, 0x00, 0xba, 0x00, 0x30, 0x82, 0xe5, 0x0c, 0x00, 0x92, 0xe5, 
-0x08, 0x30, 0x92, 0xe5, 0x00, 0x10, 0x91, 0xe2, 0x03, 0x00, 0x00, 0x0a, 
-0x03, 0x10, 0x80, 0xe7, 0x04, 0x30, 0x53, 0xe2, 0x3c, 0x30, 0xa0, 0xb3, 
-0x08, 0x30, 0x82, 0xe5, 0x01, 0x00, 0xa0, 0xe3, 0x1e, 0xff, 0x2f, 0xe1, 
-0x3c, 0x10, 0x9f, 0xe5, 0x00, 0x00, 0x91, 0xe5, 0x01, 0x00, 0x80, 0xe2, 
-0x00, 0x00, 0x81, 0xe5, 0x00, 0x00, 0xa0, 0xe3, 0xf8, 0xff, 0xff, 0xea, 
-0x10, 0x00, 0x9f, 0xe5, 0x08, 0x10, 0x90, 0xe5, 0x04, 0x10, 0x51, 0xe2, 
-0x3c, 0x10, 0xa0, 0xb3, 0x08, 0x10, 0x80, 0xe5, 0x1e, 0xff, 0x2f, 0xe1, 
-0xe4, 0x2d, 0x00, 0x80, 0xcc, 0x04, 0x00, 0x80, 0x5d, 0x2b, 0xff, 0xff, 
-0xbd, 0x3d, 0xff, 0xff, 0xb5, 0x2b, 0xff, 0xff, 0xa0, 0x82, 0x20, 0x40, 
-0xc9, 0x1c, 0x89, 0x08, 0x89, 0x00, 0x01, 0x23, 0x85, 0x4a, 0x5b, 0x07, 
-0x18, 0x43, 0x13, 0x68, 0x5b, 0x18, 0x13, 0x60, 0x00, 0x1f, 0x81, 0xa3, 
-0x5b, 0x1a, 0x18, 0x47, 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 
-0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 
+0x00, 0x40, 0x99, 0xe5, 0x0c, 0x00, 0x9a, 0xe5, 0x00, 0x00, 0x14, 0xe1, 
+0x1b, 0xff, 0x2f, 0x11, 0x08, 0x00, 0x9a, 0xe5, 0x00, 0x00, 0x14, 0xe1, 
+0x0b, 0x00, 0x00, 0x0a, 0x01, 0x0c, 0x14, 0xe3, 0x98, 0x01, 0x9f, 0x15, 
+0x0f, 0xe0, 0xa0, 0x11, 0x10, 0xff, 0x2f, 0x11, 0x02, 0x04, 0x14, 0xe3, 
+0x8c, 0x01, 0x9f, 0x15, 0x0f, 0xe0, 0xa0, 0x11, 0x10, 0xff, 0x2f, 0x11, 
+0x01, 0x09, 0x14, 0xe3, 0x80, 0x01, 0x9f, 0x15, 0x0f, 0xe0, 0xa0, 0x11, 
+0x10, 0xff, 0x2f, 0x11, 0x04, 0x00, 0x9a, 0xe5, 0x00, 0x00, 0x14, 0xe1, 
+0x16, 0x00, 0x00, 0x0a, 0x54, 0xe0, 0x8f, 0xe2, 0x04, 0x00, 0x14, 0xe3, 
+0x40, 0x00, 0x9a, 0x15, 0x10, 0xff, 0x2f, 0x11, 0x02, 0x0a, 0x14, 0xe3, 
+0x44, 0x00, 0x9a, 0x15, 0x10, 0xff, 0x2f, 0x11, 0x02, 0x09, 0x14, 0xe3, 
+0x48, 0x00, 0x9a, 0x15, 0x10, 0xff, 0x2f, 0x11, 0x01, 0x02, 0x14, 0xe3, 
+0x4c, 0x00, 0x9a, 0x15, 0x10, 0xff, 0x2f, 0x11, 0x01, 0x04, 0x14, 0xe3, 
+0x50, 0x00, 0x9a, 0x15, 0x10, 0xff, 0x2f, 0x11, 0x01, 0x0a, 0x14, 0xe3, 
+0x21, 0x00, 0x00, 0x1b, 0x02, 0x00, 0x14, 0xe3, 0x0e, 0x00, 0x00, 0x1b, 
+0x10, 0x00, 0x9a, 0xe5, 0x00, 0x00, 0x14, 0xe1, 0x1c, 0x00, 0x00, 0x1b, 
+0x00, 0x40, 0x99, 0xe5, 0x04, 0x50, 0xa0, 0xe3, 0x00, 0x40, 0x94, 0xe2, 
+0x1b, 0xff, 0x2f, 0x11, 0x3f, 0x40, 0xbd, 0xe8, 0x04, 0xf0, 0x5e, 0xe2, 
+0xc0, 0x00, 0x80, 0xe3, 0x00, 0xf0, 0x61, 0xe1, 0xfa, 0xff, 0xff, 0xea, 
+0x18, 0x00, 0x9a, 0xe5, 0x1c, 0x10, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 
+0x54, 0xb0, 0x9a, 0xe5, 0x1c, 0x10, 0x9a, 0xe5, 0x14, 0x00, 0x9a, 0xe5, 
+0x11, 0xff, 0x2f, 0xe1, 0x20, 0x10, 0x9a, 0xe5, 0x00, 0x00, 0xa0, 0xe3, 
+0x11, 0xff, 0x2f, 0xe1, 0x24, 0x10, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 
+0x28, 0x10, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 0x2c, 0x10, 0x9a, 0xe5, 
+0x11, 0xff, 0x2f, 0xe1, 0x30, 0x10, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 
+0x34, 0x10, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 0xfe, 0xff, 0xff, 0xea, 
+0x38, 0xe0, 0x9a, 0xe5, 0x3c, 0x10, 0x9a, 0xe5, 0x18, 0x00, 0x9a, 0xe5, 
+0x11, 0xff, 0x2f, 0xe1, 0x38, 0xe0, 0x9a, 0xe5, 0x3c, 0x10, 0x9a, 0xe5, 
+0x14, 0x00, 0x9a, 0xe5, 0x11, 0xff, 0x2f, 0xe1, 0x64, 0x20, 0x9f, 0xe5, 
+0x00, 0x30, 0x92, 0xe5, 0x00, 0x30, 0x53, 0xe0, 0x0a, 0x00, 0x00, 0xba, 
+0x00, 0x30, 0x82, 0xe5, 0x0c, 0x00, 0x92, 0xe5, 0x08, 0x30, 0x92, 0xe5, 
+0x00, 0x10, 0x91, 0xe2, 0x03, 0x00, 0x00, 0x0a, 0x03, 0x10, 0x80, 0xe7, 
+0x04, 0x30, 0x53, 0xe2, 0x3c, 0x30, 0xa0, 0xb3, 0x08, 0x30, 0x82, 0xe5, 
+0x01, 0x00, 0xa0, 0xe3, 0x1e, 0xff, 0x2f, 0xe1, 0x3c, 0x10, 0x9f, 0xe5, 
+0x00, 0x00, 0x91, 0xe5, 0x01, 0x00, 0x80, 0xe2, 0x00, 0x00, 0x81, 0xe5, 
+0x00, 0x00, 0xa0, 0xe3, 0xf8, 0xff, 0xff, 0xea, 0x10, 0x00, 0x9f, 0xe5, 
+0x08, 0x10, 0x90, 0xe5, 0x04, 0x10, 0x51, 0xe2, 0x3c, 0x10, 0xa0, 0xb3, 
+0x08, 0x10, 0x80, 0xe5, 0x1e, 0xff, 0x2f, 0xe1, 0xe4, 0x2d, 0x00, 0x80, 
+0xcc, 0x04, 0x00, 0x80, 0x71, 0x2b, 0xff, 0xff, 0xd1, 0x3d, 0xff, 0xff, 
+0xc9, 0x2b, 0xff, 0xff, 0xa0, 0x82, 0x20, 0x40, 0xc9, 0x1c, 0x89, 0x08, 
+0x89, 0x00, 0x01, 0x23, 0x85, 0x4a, 0x5b, 0x07, 0x18, 0x43, 0x13, 0x68, 
+0x5b, 0x18, 0x13, 0x60, 0x00, 0x1f, 0x81, 0xa3, 0x5b, 0x1a, 0x18, 0x47, 
 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 
 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 
 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 
@@ -1921,204 +1922,143 @@
 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 
 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 
 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 
-0x04, 0x20, 0xa0, 0xe5, 0x1e, 0xff, 0x2f, 0xe1, 0xe4, 0x2d, 0x00, 0x80, 
+0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 
+0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 0x04, 0x20, 0xa0, 0xe5, 
+0x1e, 0xff, 0x2f, 0xe1, 0xe4, 0x2d, 0x00, 0x80, 
 0x98, 0x00, 0x9f, 0xe5, 0x98, 0x10, 0x9f, 0xe5, 0x01, 0x20, 0x40, 0xe0, 
-0x94, 0x30, 0x9f, 0xe5, 0x00, 0x00, 0x91, 0xe5, 
+0x94, 0x30, 0x9f, 0xe5, 0x00, 0x00, 0x91, 0xe5, 0x03, 0x00, 0x50, 0xe1, 
+0x03, 0x00, 0x00, 0x1a, 0x04, 0x10, 0x81, 0xe2, 0x04, 0x20, 0x52, 0xe2, 
+0x00, 0x00, 0x00, 0x0a, 0xf8, 0xff, 0xff, 0xea, 0x78, 0x00, 0x9f, 0xe5, 
+0x00, 0x20, 0x80, 0xe5, 0x74, 0x00, 0x9f, 0xe5, 0x74, 0x10, 0x9f, 0xe5, 
+0x01, 0x20, 0x40, 0xe0, 0x60, 0x30, 0x9f, 0xe5, 0x00, 0x00, 0x91, 0xe5, 
 0x03, 0x00, 0x50, 0xe1, 0x03, 0x00, 0x00, 0x1a, 0x04, 0x10, 0x81, 0xe2, 
 0x04, 0x20, 0x52, 0xe2, 0x00, 0x00, 0x00, 0x0a, 0xf8, 0xff, 0xff, 0xea, 
-0x78, 0x00, 0x9f, 0xe5, 0x00, 0x20, 0x80, 0xe5, 0x74, 0x00, 0x9f, 0xe5, 
-0x74, 0x10, 0x9f, 0xe5, 0x01, 0x20, 0x40, 0xe0, 0x60, 0x30, 0x9f, 0xe5, 
+0x50, 0x00, 0x9f, 0xe5, 0x00, 0x20, 0x80, 0xe5, 0x4c, 0x00, 0x9f, 0xe5, 
+0x4c, 0x10, 0x9f, 0xe5, 0x01, 0x20, 0x40, 0xe0, 0x2c, 0x30, 0x9f, 0xe5, 
 0x00, 0x00, 0x91, 0xe5, 0x03, 0x00, 0x50, 0xe1, 0x03, 0x00, 0x00, 0x1a, 
 0x04, 0x10, 0x81, 0xe2, 0x04, 0x20, 0x52, 0xe2, 0x00, 0x00, 0x00, 0x0a, 
-0xf8, 0xff, 0xff, 0xea, 0x50, 0x00, 0x9f, 0xe5, 0x00, 0x20, 0x80, 0xe5, 
-0x4c, 0x00, 0x9f, 0xe5, 0x4c, 0x10, 0x9f, 0xe5, 0x01, 0x20, 0x40, 0xe0, 
-0x2c, 0x30, 0x9f, 0xe5, 0x00, 0x00, 0x91, 0xe5, 0x03, 0x00, 0x50, 0xe1, 
-0x03, 0x00, 0x00, 0x1a, 0x04, 0x10, 0x81, 0xe2, 0x04, 0x20, 0x52, 0xe2, 
-0x00, 0x00, 0x00, 0x0a, 0xf8, 0xff, 0xff, 0xea, 0x28, 0x00, 0x9f, 0xe5, 
-0x00, 0x20, 0x80, 0xe5, 0x1e, 0xff, 0x2f, 0xe1, 0x7c, 0x34, 0x00, 0x80, 
-0x80, 0x30, 0x00, 0x80, 0xad, 0xde, 0xad, 0xde, 0xc0, 0x04, 0x00, 0x80, 
-0xfc, 0x37, 0x00, 0x80, 0x80, 0x34, 0x00, 0x80, 0xc4, 0x04, 0x00, 0x80, 
-0xfc, 0x3f, 0x00, 0x80, 0x40, 0x38, 0x00, 0x80, 0xc8, 0x04, 0x00, 0x80, 
-0x78, 0x47, 0x00, 0x00, 0x76, 0xea, 0xff, 0xea, 0x78, 0x47, 0x00, 0x00, 
-0x39, 0xfe, 0xff, 0xea, 0x78, 0x47, 0x00, 0x00, 0x63, 0xfe, 0xff, 0xea, 
-0x78, 0x47, 0x00, 0x00, 0x1b, 0xff, 0xff, 0xea, 0x78, 0x47, 0x00, 0x00, 
-0x70, 0xea, 0xff, 0xea, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x80, 0x28, 0x04, 0x00, 0x00, 0x95, 0x22, 0x00, 0x00, 
-0x00, 0x01, 0x00, 0x80, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0xb9, 0x0b, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xd5, 0x0b, 0xff, 0xff, 
-0x03, 0xff, 0x06, 0x54, 0x03, 0x00, 0x00, 0x00, 0x75, 0x04, 0xff, 0xff, 
-0x00, 0x00, 0x00, 0x00, 0xa1, 0x05, 0xff, 0xff, 0x04, 0xff, 0x07, 0x54, 
-0x03, 0x00, 0x00, 0x00, 0xb5, 0x04, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 
-0xf1, 0x05, 0xff, 0xff, 0x05, 0xff, 0x05, 0x54, 0x03, 0x00, 0x00, 0x00, 
-0x39, 0x04, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x55, 0x05, 0xff, 0xff, 
-0x01, 0xff, 0x04, 0x00, 0x03, 0x00, 0x00, 0x00, 0x41, 0x18, 0xff, 0xff, 
-0x00, 0x00, 0x00, 0x00, 0x61, 0x0e, 0xff, 0xff, 0x02, 0xff, 0x02, 0x08, 
-0x00, 0x00, 0x00, 0x00, 0xa1, 0x02, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 
-0xf1, 0x02, 0xff, 0xff, 0xff, 0xff, 0x01, 0x44, 0x03, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x0d, 0xff, 0xff, 
-0x06, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x50, 0xff, 0xff, 
-0x6d, 0x50, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xf8, 0xff, 0xff, 0xea, 0x28, 0x00, 0x9f, 0xe5, 0x00, 0x20, 0x80, 0xe5, 
+0x1e, 0xff, 0x2f, 0xe1, 0x7c, 0x34, 0x00, 0x80, 0x80, 0x30, 0x00, 0x80, 
+0xad, 0xde, 0xad, 0xde, 0xc0, 0x04, 0x00, 0x80, 0xfc, 0x37, 0x00, 0x80, 
+0x80, 0x34, 0x00, 0x80, 0xc4, 0x04, 0x00, 0x80, 0xfc, 0x3f, 0x00, 0x80, 
+0x40, 0x38, 0x00, 0x80, 0xc8, 0x04, 0x00, 0x80, 0x78, 0x47, 0x00, 0x00, 
+0x71, 0xea, 0xff, 0xea, 0x78, 0x47, 0x00, 0x00, 0x39, 0xfe, 0xff, 0xea, 
+0x78, 0x47, 0x00, 0x00, 0x63, 0xfe, 0xff, 0xea, 0x78, 0x47, 0x00, 0x00, 
+0x1b, 0xff, 0xff, 0xea, 0x78, 0x47, 0x00, 0x00, 0x6b, 0xea, 0xff, 0xea, 
+0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 
+0x28, 0x04, 0x00, 0x00, 0xf8, 0x3d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x80, 
+0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x0b, 0xff, 0xff, 
+0x00, 0x00, 0x00, 0x00, 0xd5, 0x0b, 0xff, 0xff, 0x03, 0xff, 0x06, 0x54, 
+0x03, 0x00, 0x00, 0x00, 0x75, 0x04, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 
+0xa1, 0x05, 0xff, 0xff, 0x04, 0xff, 0x07, 0x54, 0x03, 0x00, 0x00, 0x00, 
+0xb5, 0x04, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf1, 0x05, 0xff, 0xff, 
+0x05, 0xff, 0x05, 0x54, 0x03, 0x00, 0x00, 0x00, 0x39, 0x04, 0xff, 0xff, 
+0x00, 0x00, 0x00, 0x00, 0x55, 0x05, 0xff, 0xff, 0x01, 0xff, 0x04, 0x00, 
+0x03, 0x00, 0x00, 0x00, 0x41, 0x18, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 
+0x61, 0x0e, 0xff, 0xff, 0x02, 0xff, 0x02, 0x08, 0x00, 0x00, 0x00, 0x00, 
+0xa1, 0x02, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xf1, 0x02, 0xff, 0xff, 
+0xff, 0xff, 0x01, 0x44, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x9d, 0x0d, 0xff, 0xff, 0x06, 0x00, 0xff, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x3d, 0x50, 0xff, 0xff, 0x81, 0x50, 0xff, 0xff, 
 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x48, 0x05, 0x00, 0x80, 0x19, 0x78, 0x21, 0x40, 
-0x23, 0x78, 0x21, 0x40, 0x39, 0x78, 0x21, 0x40, 0x51, 0x78, 0x21, 0x40, 
-0x5d, 0x78, 0x21, 0x40, 0x6b, 0x78, 0x21, 0x40, 0x85, 0x78, 0x21, 0x40, 
-0xb1, 0x78, 0x21, 0x40, 0x75, 0x79, 0x21, 0x40, 
-0xcd, 0x79, 0x21, 0x40, 0xdb, 0x79, 0x21, 0x40, 0xe5, 0x79, 0x21, 0x40, 
-0xef, 0x79, 0x21, 0x40, 0x8d, 0x7a, 0x21, 0x40, 0x9b, 0x7a, 0x21, 0x40, 
-0xa9, 0x7a, 0x21, 0x40, 0x51, 0x7b, 0x21, 0x40, 0x4f, 0x7f, 0x21, 0x40, 
-0xc9, 0x7f, 0x21, 0x40, 0x69, 0x80, 0x21, 0x40, 0x9d, 0x81, 0x21, 0x40, 
-0xa9, 0x81, 0x21, 0x40, 0x09, 0x82, 0x21, 0x40, 0x6d, 0x82, 0x21, 0x40, 
-0x99, 0x82, 0x21, 0x40, 0xbd, 0x82, 0x21, 0x40, 0xfd, 0x82, 0x21, 0x40, 
-0x25, 0x83, 0x21, 0x40, 0x6d, 0x83, 0x21, 0x40, 0x7d, 0x83, 0x21, 0x40, 
-0xa5, 0x83, 0x21, 0x40, 0xb5, 0x83, 0x21, 0x40, 0xfd, 0x83, 0x21, 0x40, 
-0x3b, 0x84, 0x21, 0x40, 0x91, 0x84, 0x21, 0x40, 0xf1, 0x84, 0x21, 0x40, 
-0xfb, 0x84, 0x21, 0x40, 0xff, 0x84, 0x21, 0x40, 0x6d, 0x85, 0x21, 0x40, 
-0xb9, 0x85, 0x21, 0x40, 0x11, 0x86, 0x21, 0x40, 0x4d, 0x86, 0x21, 0x40, 
-0xb1, 0x86, 0x21, 0x40, 0xe9, 0x86, 0x21, 0x40, 0xf9, 0x86, 0x21, 0x40, 
-0x31, 0x87, 0x21, 0x40, 0x41, 0x87, 0x21, 0x40, 0x55, 0x87, 0x21, 0x40, 
-0x7d, 0x87, 0x21, 0x40, 0x87, 0x87, 0x21, 0x40, 0x91, 0x87, 0x21, 0x40, 
-0xf5, 0x87, 0x21, 0x40, 0x25, 0x88, 0x21, 0x40, 0x31, 0x88, 0x21, 0x40, 
-0xa5, 0x88, 0x21, 0x40, 0xaf, 0x88, 0x21, 0x40, 0xb9, 0x88, 0x21, 0x40, 
-0xc3, 0x88, 0x21, 0x40, 0xcd, 0x88, 0x21, 0x40, 0xd7, 0x88, 0x21, 0x40, 
-0xe1, 0x88, 0x21, 0x40, 0xeb, 0x88, 0x21, 0x40, 0xf5, 0x88, 0x21, 0x40, 
-0xe9, 0x8b, 0x21, 0x40, 0xff, 0x88, 0x21, 0x40, 0x09, 0x89, 0x21, 0x40, 
-0x13, 0x89, 0x21, 0x40, 0x1d, 0x89, 0x21, 0x40, 0x45, 0x89, 0x21, 0x40, 
-0x4f, 0x89, 0x21, 0x40, 0xb1, 0x89, 0x21, 0x40, 0xbb, 0x89, 0x21, 0x40, 
-0xc5, 0x89, 0x21, 0x40, 0xcf, 0x89, 0x21, 0x40, 0xd9, 0x89, 0x21, 0x40, 
-0xa5, 0x77, 0x21, 0x40, 0xe3, 0x89, 0x21, 0x40, 0x49, 0x8a, 0x21, 0x40, 
-0x95, 0x8a, 0x21, 0x40, 0xe1, 0x8a, 0x21, 0x40, 0xf1, 0x8a, 0x21, 0x40, 
-0xa5, 0x77, 0x21, 0x40, 0x3d, 0x8b, 0x21, 0x40, 0x41, 0x8b, 0x21, 0x40, 
-0x45, 0x8b, 0x21, 0x40, 0x9d, 0x8b, 0x21, 0x40, 0xc5, 0x8b, 0x21, 0x40, 
-0xd1, 0x8b, 0x21, 0x40, 0xd5, 0x8b, 0x21, 0x40, 0xd9, 0x8b, 0x21, 0x40, 
-0xdd, 0x8b, 0x21, 0x40, 0xe1, 0x8b, 0x21, 0x40, 0xe5, 0x8b, 0x21, 0x40, 
-0x0d, 0x88, 0x21, 0x40, 0x69, 0x88, 0x21, 0x40, 0xa5, 0x77, 0x21, 0x40, 
-0xa5, 0x77, 0x21, 0x40, 0xf5, 0x8b, 0x21, 0x40, 0xe1, 0xc9, 0x21, 0x40, 
-0xe9, 0x77, 0x21, 0x40, 0xa5, 0x77, 0x21, 0x40, 0xa5, 0x77, 0x21, 0x40, 
-0xdd, 0xca, 0x21, 0x40, 0x13, 0xcb, 0x21, 0x40, 0x45, 0xcb, 0x21, 0x40, 
-0x4d, 0x8c, 0x21, 0x40, 0x5b, 0x7b, 0x21, 0x40, 0xe5, 0x7e, 0x21, 0x40, 
-0x21, 0x7f, 0x21, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x01, 0x18, 0x40, 
-0x58, 0x01, 0x18, 0x40, 0x24, 0xa3, 0x20, 0x40, 0x24, 0xa7, 0x20, 0x40, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x01, 0x18, 0x40, 
-0x68, 0x01, 0x18, 0x40, 0x24, 0x83, 0x20, 0x40, 0x24, 0xa3, 0x20, 0x40, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x01, 0x18, 0x40, 
-0x78, 0x01, 0x18, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x01, 0x18, 0x40, 
-0x88, 0x01, 0x18, 0x40, 0x24, 0xa9, 0x20, 0x40, 0x24, 0xab, 0x20, 0x40, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x12, 0x00, 
-0x0c, 0x00, 0x12, 0x00, 0x1c, 0x00, 0x12, 0x00, 0x24, 0xa8, 0x20, 0x40, 
-0xa4, 0xa8, 0x20, 0x40, 0xa4, 0xa8, 0x20, 0x40, 0x24, 0xa9, 0x20, 0x40, 
-0x00, 0x00, 0x00, 0x00, 0xa5, 0xb9, 0x21, 0x40, 0x01, 0xbb, 0x21, 0x40, 
-0x00, 0x00, 0x00, 0x00, 0x91, 0x73, 0x21, 0x40, 0x19, 0xb2, 0x21, 0x40, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0xa7, 0x99, 0x21, 0x40, 0xa5, 0xb9, 0x21, 0x40, 
-0xb1, 0x2f, 0xff, 0xff, 0xf1, 0x20, 0xff, 0xff, 0xdb, 0x20, 0xff, 0xff, 
-0x2d, 0xb8, 0x21, 0x40, 0x34, 0x2e, 0x00, 0x80, 0x48, 0x2e, 0x00, 0x80, 
-0x5c, 0x2e, 0x00, 0x80, 0x30, 0x33, 0x3a, 0x31, 0x31, 0x3a, 0x31, 0x31, 
-0x00, 0x30, 0x37, 0x2f, 0x32, 0x33, 0x2f, 0x30, 0x31, 0x00, 0x30, 0x30, 
-0x30, 0x30, 0x31, 0x35, 0x36, 0x39, 0x00, 0x43, 0x6f, 0x70, 0x79, 0x72, 
-0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, 
-0x31, 0x20, 0x33, 0x43, 0x6f, 0x6d, 0x20, 0x43, 0x6f, 0x72, 0x70, 0x6f, 
-0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x0a, 0x00, 0x02, 0x10, 0x00, 0x03, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x78, 0x53, 0xff, 0xff, 0x27, 0xf0, 0x7d, 0xfd, 0x00, 0x01, 0x00, 0x02, 
-0xda, 0x0e, 0x82, 0x00, 0x01, 0x40, 0x64, 0x04, 0x64, 0x2d, 0x00, 0x80, 
-0xe4, 0x2c, 0x00, 0x80, 0x55, 0x3e, 0xff, 0xff, 0xb5, 0x4f, 0xff, 0xff, 
-0xc1, 0x24, 0xff, 0xff, 0xb5, 0x3b, 0xff, 0xff, 0x15, 0x3c, 0xff, 0xff, 
-0x05, 0x1a, 0xff, 0xff, 0x65, 0x11, 0xff, 0xff, 0xb8, 0x53, 0xff, 0xff, 
-0x0d, 0x40, 0xff, 0xff, 0x91, 0x73, 0x21, 0x40, 0x51, 0x75, 0x21, 0x40, 
-0xc5, 0x3f, 0xff, 0xff, 0x71, 0xaa, 0x21, 0x40, 0x71, 0x24, 0xff, 0xff, 
-0x50, 0x53, 0xff, 0xff, 0x78, 0x53, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 
-0xff, 0xff, 0x00, 0x00, 0x80, 0x30, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 
-0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40, 0xec, 0x68, 0x00, 0x00, 
-0x10, 0x5c, 0x00, 0x00, 0x00, 0x6e, 0x21, 0x40, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 
-0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 
-0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 
-0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
-0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 
-0x05, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 
-0x08, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 
-0x0b, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 
-0x0e, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x3d, 0x9a, 0x21, 0x40, 
-0xdb, 0x99, 0x21, 0x40, 0xf5, 0x9c, 0x21, 0x40, 0x55, 0x9d, 0x21, 0x40, 
-0x1d, 0x9e, 0x21, 0x40, 0xdb, 0x9b, 0x21, 0x40, 0xf9, 0x9e, 0x21, 0x40, 
-0x65, 0x9f, 0x21, 0x40, 0xb9, 0x9b, 0x21, 0x40, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x48, 0x05, 0x00, 0x80, 0x11, 0x75, 0x21, 0x40, 0x1b, 0x75, 0x21, 0x40, 
+0x31, 0x75, 0x21, 0x40, 0x49, 0x75, 0x21, 0x40, 
+0x55, 0x75, 0x21, 0x40, 0x63, 0x75, 0x21, 0x40, 0x7d, 0x75, 0x21, 0x40, 
+0xa9, 0x75, 0x21, 0x40, 0x6d, 0x76, 0x21, 0x40, 0xc5, 0x76, 0x21, 0x40, 
+0xd3, 0x76, 0x21, 0x40, 0xdd, 0x76, 0x21, 0x40, 0xe7, 0x76, 0x21, 0x40, 
+0x99, 0x77, 0x21, 0x40, 0xa7, 0x77, 0x21, 0x40, 0xb5, 0x77, 0x21, 0x40, 
+0x61, 0x78, 0x21, 0x40, 0x5f, 0x7c, 0x21, 0x40, 0xe9, 0x7c, 0x21, 0x40, 
+0x89, 0x7d, 0x21, 0x40, 0xbd, 0x7e, 0x21, 0x40, 0xc9, 0x7e, 0x21, 0x40, 
+0x29, 0x7f, 0x21, 0x40, 0x8d, 0x7f, 0x21, 0x40, 0xb9, 0x7f, 0x21, 0x40, 
+0xdd, 0x7f, 0x21, 0x40, 0x1d, 0x80, 0x21, 0x40, 0x45, 0x80, 0x21, 0x40, 
+0x8d, 0x80, 0x21, 0x40, 0x9d, 0x80, 0x21, 0x40, 0xc5, 0x80, 0x21, 0x40, 
+0xd5, 0x80, 0x21, 0x40, 0x1d, 0x81, 0x21, 0x40, 0x5b, 0x81, 0x21, 0x40, 
+0xb1, 0x81, 0x21, 0x40, 0x11, 0x82, 0x21, 0x40, 0x1b, 0x82, 0x21, 0x40, 
+0x1f, 0x82, 0x21, 0x40, 0x8d, 0x82, 0x21, 0x40, 0xd9, 0x82, 0x21, 0x40, 
+0x31, 0x83, 0x21, 0x40, 0x6d, 0x83, 0x21, 0x40, 0xd1, 0x83, 0x21, 0x40, 
+0x09, 0x84, 0x21, 0x40, 0x19, 0x84, 0x21, 0x40, 0x51, 0x84, 0x21, 0x40, 
+0x61, 0x84, 0x21, 0x40, 0x75, 0x84, 0x21, 0x40, 0x9d, 0x84, 0x21, 0x40, 
+0xa7, 0x84, 0x21, 0x40, 0xb1, 0x84, 0x21, 0x40, 0x15, 0x85, 0x21, 0x40, 
+0x45, 0x85, 0x21, 0x40, 0x51, 0x85, 0x21, 0x40, 0xc5, 0x85, 0x21, 0x40, 
+0xcf, 0x85, 0x21, 0x40, 0xd9, 0x85, 0x21, 0x40, 0xe3, 0x85, 0x21, 0x40, 
+0xed, 0x85, 0x21, 0x40, 0xf7, 0x85, 0x21, 0x40, 0x01, 0x86, 0x21, 0x40, 
+0x0b, 0x86, 0x21, 0x40, 0x15, 0x86, 0x21, 0x40, 0x01, 0x89, 0x21, 0x40, 
+0x1f, 0x86, 0x21, 0x40, 0x29, 0x86, 0x21, 0x40, 0x33, 0x86, 0x21, 0x40, 
+0x3d, 0x86, 0x21, 0x40, 0x65, 0x86, 0x21, 0x40, 0x6f, 0x86, 0x21, 0x40, 
+0xd1, 0x86, 0x21, 0x40, 0xdb, 0x86, 0x21, 0x40, 0xe5, 0x86, 0x21, 0x40, 
+0xef, 0x86, 0x21, 0x40, 0xf9, 0x86, 0x21, 0x40, 0x9d, 0x74, 0x21, 0x40, 
+0x03, 0x87, 0x21, 0x40, 0x69, 0x87, 0x21, 0x40, 0xb5, 0x87, 0x21, 0x40, 
+0xf9, 0x87, 0x21, 0x40, 0x09, 0x88, 0x21, 0x40, 0x9d, 0x74, 0x21, 0x40, 
+0x55, 0x88, 0x21, 0x40, 0x59, 0x88, 0x21, 0x40, 0x5d, 0x88, 0x21, 0x40, 
+0xb5, 0x88, 0x21, 0x40, 0xdd, 0x88, 0x21, 0x40, 0xe9, 0x88, 0x21, 0x40, 
+0xed, 0x88, 0x21, 0x40, 0xf1, 0x88, 0x21, 0x40, 0xf5, 0x88, 0x21, 0x40, 
+0xf9, 0x88, 0x21, 0x40, 0xfd, 0x88, 0x21, 0x40, 0x2d, 0x85, 0x21, 0x40, 
+0x89, 0x85, 0x21, 0x40, 0x9d, 0x74, 0x21, 0x40, 0x9d, 0x74, 0x21, 0x40, 
+0x0d, 0x89, 0x21, 0x40, 0x9d, 0x74, 0x21, 0x40, 0xe1, 0x74, 0x21, 0x40, 
+0x9d, 0x74, 0x21, 0x40, 0x9d, 0x74, 0x21, 0x40, 0x9d, 0x74, 0x21, 0x40, 
+0x9d, 0x74, 0x21, 0x40, 0x9d, 0x74, 0x21, 0x40, 0x9d, 0x74, 0x21, 0x40, 
+0x6b, 0x78, 0x21, 0x40, 0xf5, 0x7b, 0x21, 0x40, 0x31, 0x7c, 0x21, 0x40, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x5c, 0x01, 0x18, 0x40, 0x58, 0x01, 0x18, 0x40, 
+0x24, 0xa3, 0x20, 0x40, 0x24, 0xa7, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x6c, 0x01, 0x18, 0x40, 0x68, 0x01, 0x18, 0x40, 
+0x24, 0x83, 0x20, 0x40, 0x24, 0xa3, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x7c, 0x01, 0x18, 0x40, 0x78, 0x01, 0x18, 0x40, 
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x8c, 0x01, 0x18, 0x40, 
+0x88, 0x01, 0x18, 0x40, 0x24, 0xa9, 0x20, 0x40, 0x24, 0xab, 0x20, 0x40, 
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x08, 0x00, 0x12, 0x00, 0x18, 0x00, 0x12, 0x00, 0x0c, 0x00, 0x12, 0x00, 
+0x1c, 0x00, 0x12, 0x00, 0x24, 0xa8, 0x20, 0x40, 0xa4, 0xa8, 0x20, 0x40, 
+0xa4, 0xa8, 0x20, 0x40, 0x24, 0xa9, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 
+0xd1, 0xa8, 0x21, 0x40, 0x2d, 0xaa, 0x21, 0x40, 0x00, 0x00, 0x00, 0x00, 
+0x89, 0x70, 0x21, 0x40, 0xc9, 0xa1, 0x21, 0x40, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0x57, 0x89, 0x21, 0x40, 0xd1, 0xa8, 0x21, 0x40, 0xc5, 0x2f, 0xff, 0xff, 
+0x05, 0x21, 0xff, 0xff, 0xef, 0x20, 0xff, 0xff, 0x59, 0xa7, 0x21, 0x40, 
+0x34, 0x2e, 0x00, 0x80, 0x48, 0x2e, 0x00, 0x80, 0x5c, 0x2e, 0x00, 0x80, 
+0x30, 0x33, 0x3a, 0x31, 0x31, 0x3a, 0x31, 0x31, 0x00, 0x30, 0x37, 0x2f, 
+0x32, 0x33, 0x2f, 0x30, 0x31, 0x00, 0x30, 0x30, 0x30, 0x30, 0x31, 0x35, 
+0x36, 0x39, 0x00, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 
+0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, 0x31, 0x20, 0x33, 0x43, 
+0x6f, 0x6d, 0x20, 0x43, 0x6f, 0x72, 0x70, 0x6f, 0x72, 0x61, 0x74, 0x69, 
+0x6f, 0x6e, 0x0a, 0x00, 0x08, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x53, 0xff, 0xff, 
+0x27, 0xf0, 0x7d, 0xfd, 0x00, 0x01, 0x00, 0x02, 0xda, 0x0e, 0x82, 0x00, 
+0x01, 0x40, 0x64, 0x04, 0x64, 0x2d, 0x00, 0x80, 0xe4, 0x2c, 0x00, 0x80, 
+0x69, 0x3e, 0xff, 0xff, 0xc9, 0x4f, 0xff, 0xff, 0xd5, 0x24, 0xff, 0xff, 
+0xc9, 0x3b, 0xff, 0xff, 0x29, 0x3c, 0xff, 0xff, 0x19, 0x1a, 0xff, 0xff, 
+0x65, 0x11, 0xff, 0xff, 0xcc, 0x53, 0xff, 0xff, 0x21, 0x40, 0xff, 0xff, 
+0x89, 0x70, 0x21, 0x40, 0x49, 0x72, 0x21, 0x40, 0xd9, 0x3f, 0xff, 0xff, 
+0x21, 0x9a, 0x21, 0x40, 0x85, 0x24, 0xff, 0xff, 0x64, 0x53, 0xff, 0xff, 
+0x8c, 0x53, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 
+0x80, 0x30, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 
+0x00, 0x00, 0x20, 0x40, 0xb0, 0x50, 0x00, 0x00, 0x7b, 0x0e, 0x00, 0x00, 
+0x00, 0x6e, 0x21, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
+0xed, 0x89, 0x21, 0x40, 0x8b, 0x89, 0x21, 0x40, 0xa5, 0x8c, 0x21, 0x40, 
+0x05, 0x8d, 0x21, 0x40, 0xcd, 0x8d, 0x21, 0x40, 0x8b, 0x8b, 0x21, 0x40, 
+0xa9, 0x8e, 0x21, 0x40, 0x15, 0x8f, 0x21, 0x40, 0x69, 0x8b, 0x21, 0x40, 
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 
-0xe9, 0xd6, 0x21, 0x40, 0x00, 0x00, 0x00, 0x00, 0xb9, 0xcb, 0x21, 0x40, 
-0x55, 0xcd, 0x21, 0x40, 0x00, 0x00, 0x00, 0x00, 0x25, 0xd5, 0x21, 0x40, 
-0x8d, 0xd5, 0x21, 0x40, 0xf9, 0xd5, 0x21, 0x40, 0x09, 0x29, 0x09, 0xd1, 
-0x20, 0x28, 0x07, 0xd2, 0x04, 0x48, 0x01, 0x78, 0x00, 0x29, 0x03, 0xd1, 
-0x01, 0x21, 0x01, 0x70, 0x02, 0x48, 0x70, 0x47, 0x00, 0x20, 0xfc, 0xe7, 
-0x00, 0x6e, 0x21, 0x40, 0x24, 0xab, 0x20, 0x40, 0x03, 0x49, 0x88, 0x42, 
-0x03, 0xd1, 0x00, 0x20, 0x02, 0x49, 0xc0, 0x46, 0x08, 0x70, 0x70, 0x47, 
-0x24, 0xab, 0x20, 0x40, 0x00, 0x6e, 0x21, 0x40, 0x00, 0xb5, 0x00, 0x20, 
-0x0b, 0x4a, 0x0b, 0x23, 0x1b, 0x02, 0xd1, 0x18, 0x2d, 0x23, 0x9b, 0x01, 
-0xd3, 0x18, 0x88, 0x61, 0xd8, 0x60, 0xd8, 0x63, 0x80, 0x32, 0xc8, 0x60, 
-0x08, 0x61, 0x48, 0x61, 0xd0, 0x62, 0x05, 0x48, 0xc0, 0x46, 0x48, 0x60, 
-0x88, 0x60, 0x05, 0xf0, 0xcb, 0xfd, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0x68, 0x0e, 0x00, 0x80, 0xfe, 0x03, 0x00, 0x00, 0xf0, 0xb5, 0x84, 0xb0, 
-0x0c, 0x1c, 0x05, 0x1c, 0x00, 0x23, 0x00, 0x93, 0xff, 0xf7, 0xda, 0xff, 
-0x68, 0x49, 0x0b, 0x23, 0x1b, 0x02, 0xcf, 0x18, 0x78, 0x68, 0x28, 0x40, 
+0x59, 0xbd, 0x21, 0x40, 0xc1, 0xbd, 0x21, 0x40, 0x2d, 0xbe, 0x21, 0x40, 
+0x00, 0x20, 0x0a, 0x4a, 0x0b, 0x23, 0x1b, 0x02, 0xd1, 0x18, 0x2d, 0x23, 
+0x9b, 0x01, 0xd3, 0x18, 0x88, 0x61, 0xd8, 0x60, 0xd8, 0x63, 0x80, 0x32, 
+0xc8, 0x60, 0x08, 0x61, 0x48, 0x61, 0xd0, 0x62, 0x03, 0x48, 0xc0, 0x46, 
+0x48, 0x60, 0x88, 0x60, 0x70, 0x47, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 
+0xfe, 0x03, 0x00, 0x00, 0xf0, 0xb5, 0x84, 0xb0, 0x0c, 0x1c, 0x05, 0x1c, 
+0x00, 0x23, 0x00, 0x93, 0xff, 0xf7, 0xde, 0xff, 0x68, 0x49, 0x0b, 0x23, 
+0x1b, 0x02, 0xcf, 0x18, 0x78, 0x68, 0x28, 0x40, 
 0x00, 0x22, 0xf8, 0x60, 0x3a, 0x61, 0xba, 0x68, 0x22, 0x40, 0x7a, 0x61, 
 0x0c, 0x1c, 0x41, 0x09, 0x03, 0xd2, 0x51, 0x09, 0x01, 0xd2, 0x80, 0x0a, 
 0x02, 0xd3, 0x60, 0x48, 0x00, 0xf0, 0xc2, 0xf8, 0x01, 0x20, 0xf9, 0x68, 
 0x49, 0x09, 0x03, 0xd2, 0x79, 0x69, 0x49, 0x09, 0x00, 0xd2, 0x00, 0x20, 
-0x00, 0x06, 0x00, 0x0e, 0x04, 0xf0, 0xc8, 0xf9, 0xf8, 0x68, 0x00, 0x28, 
+0x00, 0x06, 0x00, 0x0e, 0x03, 0xf0, 0xd4, 0xfa, 0xf8, 0x68, 0x00, 0x28, 
 0x70, 0xd0, 0x00, 0x23, 0x02, 0x93, 0x01, 0x93, 0x54, 0x4a, 0x01, 0x23, 
 0x18, 0x43, 0xf8, 0x60, 0x00, 0x20, 0xd5, 0x1d, 0x79, 0x35, 0x03, 0x95, 
 0x01, 0x24, 0x00, 0x21, 0x4f, 0x4d, 0xfa, 0x68, 0x22, 0x40, 0x39, 0xd0, 
@@ -2138,300 +2078,301 @@
 0x9b, 0x01, 0xc9, 0x18, 0xc8, 0x60, 0x00, 0x9b, 0x00, 0x2b, 0x0c, 0xd1, 
 0x81, 0x00, 0x89, 0x18, 0x0b, 0x23, 0x1b, 0x02, 0xc9, 0x18, 0xcb, 0x69, 
 0xc0, 0x46, 0x8b, 0x61, 0x01, 0x30, 0x0b, 0x28, 0xf4, 0xd3, 0x08, 0xe0, 
-0x07, 0xe0, 0x03, 0x9d, 0xe8, 0x6a, 0x30, 0x28, 
-0x03, 0xd2, 0x30, 0x20, 0x03, 0x9d, 0xc0, 0x46, 0xe8, 0x62, 0x19, 0x4a, 
-0x78, 0x69, 0x00, 0x28, 0x2a, 0xd0, 0x00, 0x21, 0x01, 0x23, 0x18, 0x43, 
-0x78, 0x61, 0x00, 0x20, 0x01, 0x24, 0x00, 0x22, 0x13, 0x4e, 0x7b, 0x69, 
-0x23, 0x40, 0x10, 0xd0, 0x93, 0x00, 0x9b, 0x18, 0x9b, 0x00, 0x12, 0x4d, 
-0x5b, 0x19, 0x9d, 0x78, 0x85, 0x42, 0x08, 0xd1, 0x1d, 0x69, 0x0b, 0x1c, 
-0x9b, 0x00, 0x9e, 0x19, 0x2d, 0x23, 0x9b, 0x01, 0xf3, 0x18, 0xdd, 0x63, 
-0x01, 0x31, 0x64, 0x00, 0x01, 0x32, 0x0b, 0x2a, 0xe6, 0xd3, 0x01, 0x30, 
-0x09, 0x28, 0xe1, 0xd3, 0x00, 0x20, 0x89, 0x00, 0x04, 0x4a, 0x89, 0x18, 
-0x2d, 0x23, 0x9b, 0x01, 0xc9, 0x18, 0xc8, 0x63, 0x04, 0xb0, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 0x1c, 0x53, 0xff, 0xff, 
-0x00, 0x01, 0x00, 0x80, 0x00, 0x47, 0x08, 0x47, 0x10, 0x47, 0x18, 0x47, 
-0x78, 0x47, 0xc0, 0x46, 0x34, 0xc0, 0x9f, 0xe5, 0x1c, 0xff, 0x2f, 0xe1, 
-0x78, 0x47, 0xc0, 0x46, 0x2c, 0xc0, 0x9f, 0xe5, 0x1c, 0xff, 0x2f, 0xe1, 
-0x78, 0x47, 0xc0, 0x46, 0x24, 0xc0, 0x9f, 0xe5, 0x1c, 0xff, 0x2f, 0xe1, 
-0xc0, 0x46, 0xff, 0xb4, 0x75, 0x46, 0x20, 0xb4, 0x01, 0x21, 0x08, 0x43, 
-0x01, 0xa4, 0xa6, 0x46, 0x00, 0x47, 0xc0, 0x46, 0x20, 0xbc, 0xae, 0x46, 
-0xff, 0xbc, 0xf7, 0x46, 0x24, 0x52, 0xff, 0xff, 0x74, 0x51, 0xff, 0xff, 
-0x51, 0xc0, 0x21, 0x40, 0xf0, 0xb5, 0x04, 0x20, 0x1a, 0x49, 0x01, 0x25, 
-0x08, 0x60, 0x1a, 0x4f, 0xbb, 0x23, 0x1b, 0x01, 0xf8, 0x18, 0x05, 0x73, 
-0x18, 0x48, 0x41, 0x6b, 0x2c, 0x05, 0x00, 0x20, 0x7a, 0x6e, 0x17, 0x4b, 
-0x8a, 0x42, 0x1d, 0xd0, 0x19, 0x7b, 0x00, 0x29, 0x17, 0xd1, 0xd9, 0x1d, 
-0xff, 0x31, 0x3a, 0x31, 0x49, 0x78, 0x1e, 0x1c, 0x00, 0x29, 0x10, 0xd1, 
-0xb0, 0x60, 0x10, 0x20, 0x70, 0x60, 0x10, 0x4a, 0x10, 0x49, 0xff, 0xf7, 
-0xb5, 0xff, 0x00, 0x28, 0x07, 0xd0, 0x35, 0x73, 0x04, 0x23, 0xb8, 0x69, 
-0x18, 0x43, 0xb8, 0x61, 0x20, 0x61, 0x00, 0xf0, 0x17, 0xf8, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x18, 0x73, 0x04, 0x23, 0xb8, 0x69, 0x98, 0x43, 
-0xb8, 0x61, 0x20, 0x61, 0xf5, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 
-0x68, 0x0e, 0x00, 0x80, 0x00, 0x01, 0x18, 0x40, 0x28, 0x05, 0x00, 0x80, 
-0x0c, 0x55, 0xff, 0xff, 0x85, 0x74, 0x21, 0x40, 0xf8, 0xb5, 0x15, 0x4f, 
-0x39, 0x6c, 0x15, 0x48, 0x40, 0x6e, 0x0c, 0x1a, 0x14, 0x4e, 0x71, 0x68, 
-0x14, 0x4d, 0xa1, 0x42, 0x06, 0xd8, 0x14, 0x4a, 0x0a, 0x43, 0x00, 0x92, 
-0xb9, 0x6b, 0x09, 0x18, 0xfa, 0x6b, 0x11, 0xe0, 0x11, 0x22, 0x52, 0x05, 
-0x22, 0x43, 0x00, 0x92, 0xb9, 0x6b, 0x09, 0x18, 0x00, 0x20, 0xfa, 0x6b, 
-0x2b, 0x1c, 0xff, 0xf7, 0x7f, 0xff, 0x70, 0x68, 0x00, 0x1b, 0x0a, 0x4a, 
-0x02, 0x43, 0x00, 0x92, 0xb9, 0x6b, 0xfa, 0x6b, 0x00, 0x20, 0x2b, 0x1c, 
-0xff, 0xf7, 0x74, 0xff, 0xf8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0x7c, 0x29, 0x00, 0x80, 0x68, 0x0e, 0x00, 0x80, 0x28, 0x05, 0x00, 0x80, 
-0x44, 0x80, 0x20, 0x40, 0x00, 0x00, 0x37, 0x02, 0xf0, 0xb5, 0x2b, 0x4f, 
-0xb8, 0x68, 0x79, 0x68, 0xc0, 0x19, 0x20, 0x30, 0x29, 0x4a, 0xff, 0xf7, 
-0x55, 0xff, 0x01, 0x20, 0xc0, 0x02, 0x28, 0x49, 0xc0, 0x46, 0x08, 0x60, 
-0xb9, 0x68, 0x38, 0x1c, 0x26, 0x4d, 0x00, 0x24, 0x26, 0x4e, 0xef, 0x1d, 
-0x79, 0x37, 0x00, 0x29, 0x31, 0xd1, 0x31, 0x68, 0x0a, 0x78, 0x12, 0x0a, 
-0x03, 0xd2, 0x04, 0x73, 0xf0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x49, 0x78, 0x00, 0x29, 0x0c, 0xd1, 0x05, 0x1c, 0x40, 0x68, 
-0x00, 0xf0, 0x3e, 0xf9, 0x30, 0x68, 0x00, 0xf0, 0x67, 0xf8, 0x00, 0x28, 
-0x26, 0xd1, 0x2c, 0x73, 0xff, 0xf7, 0x58, 0xff, 0x22, 0xe0, 0x09, 0x01, 
-0x07, 0x1c, 0x41, 0x60, 0x08, 0x1c, 0x17, 0x4a, 0x17, 0x49, 0xff, 0xf7, 
-0x27, 0xff, 0x00, 0x28, 0x07, 0xd1, 0x3c, 0x73, 0x04, 0x23, 0xa8, 0x69, 
-0x98, 0x43, 0x99, 0x04, 0xa8, 0x61, 0x08, 0x61, 0xda, 0xe7, 0x10, 0x20, 
-0x00, 0xf0, 0x20, 0xf9, 0x10, 0x20, 0xb8, 0x60, 0xff, 0xf7, 0x82, 0xff, 
-0xd2, 0xe7, 0x05, 0x1c, 0x40, 0x68, 0x00, 0xf0, 0x17, 0xf9, 0x30, 0x68, 
-0x00, 0xf0, 0x40, 0xf8, 0x00, 0x28, 0xd8, 0xd0, 0x02, 0x23, 0xf8, 0x6b, 
-0x18, 0x43, 0xf8, 0x63, 0xc4, 0xe7, 0x00, 0x00, 0x28, 0x05, 0x00, 0x80, 
-0x91, 0x55, 0xff, 0xff, 0x00, 0x00, 0x00, 0xb0, 0x68, 0x0e, 0x00, 0x80, 
-0xe4, 0x01, 0x00, 0x80, 0x0c, 0x55, 0xff, 0xff, 0x85, 0x74, 0x21, 0x40, 
-0x90, 0xb5, 0x01, 0x20, 0x40, 0x03, 0x10, 0x49, 0x00, 0x27, 0x08, 0x60, 
-0x0f, 0x4c, 0xe0, 0x1d, 0xff, 0x30, 0x3a, 0x30, 0x47, 0x70, 0xe0, 0x69, 
-0x80, 0x00, 0x00, 0x19, 0x00, 0x69, 0x00, 0xf0, 0xd7, 0xf8, 0xe0, 0x69, 
-0x00, 0x28, 0x01, 0xd0, 0xe7, 0x61, 0x01, 0xe0, 0x01, 0x20, 0xe0, 0x61, 
-0x07, 0x48, 0x02, 0x23, 0xc1, 0x6b, 0x19, 0x43, 0xc1, 0x63, 0x27, 0x73, 
-0xff, 0xf7, 0x00, 0xff, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0x00, 0x00, 0x00, 0xb0, 0x28, 0x05, 0x00, 0x80, 0xe8, 0x0e, 0x00, 0x80, 
-0x80, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x78, 0x88, 0x6d, 0x28, 0x03, 0xdb, 
-0x38, 0x1c, 0x00, 0xf0, 0xf7, 0xf8, 0x17, 0xe0, 0x80, 0x00, 0x0d, 0x49, 
-0x09, 0x58, 0x38, 0x1c, 0xff, 0xf7, 0xbd, 0xfe, 0x00, 0x28, 0x0f, 0xd1, 
-0x39, 0x78, 0xc9, 0x09, 0x0c, 0xd3, 0x69, 0x46, 0x38, 0x1c, 0x00, 0xf0, 
-0xcf, 0xf8, 0x68, 0x46, 0x00, 0x21, 0x00, 0xf0, 0x0b, 0xf8, 0x00, 0x28, 
-0x01, 0xd1, 0x01, 0x20, 0x00, 0xe0, 0x00, 0x20, 0x04, 0xb0, 0x80, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0xe8, 0x01, 0x00, 0x80, 0xf0, 0xb5, 0x82, 0xb0, 
-0x02, 0x1c, 0x41, 0x4b, 0xdd, 0x1d, 0xff, 0x35, 0x3a, 0x35, 0x2f, 0x78, 
-0x00, 0x2f, 0x01, 0xd0, 0x00, 0x27, 0x00, 0xe0, 0x01, 0x27, 0x2f, 0x70, 
-0x2f, 0x78, 0xfb, 0x00, 0xdb, 0x19, 0x5b, 0x01, 0x3a, 0x4f, 0xdc, 0x19, 
-0x40, 0x78, 0x00, 0x01, 0xc7, 0x1d, 0x09, 0x37, 0x00, 0x20, 0x83, 0x00, 
-0xd6, 0x58, 0xc0, 0x46, 0xe6, 0x50, 0x01, 0x30, 0x04, 0x28, 0xf8, 0xd3, 
-0x00, 0x29, 0x0f, 0xd0, 0x00, 0x22, 0xbb, 0x08, 0x01, 0x93, 0x83, 0x42, 
-0x0b, 0xd9, 0x13, 0x1c, 0x9b, 0x00, 0xcb, 0x58, 0x86, 0x00, 0xa3, 0x51, 
-0x01, 0x9b, 0x01, 0x30, 0x01, 0x32, 0x83, 0x42, 0xf5, 0xd8, 0x00, 0xe0, 
-0x10, 0x27, 0x2b, 0x48, 0x02, 0x6d, 0x80, 0x6e, 0x2a, 0x49, 0x82, 0x42, 
-0x03, 0xd8, 0x82, 0x1a, 0xcb, 0x6c, 0x9a, 0x1a, 0x00, 0xe0, 0x12, 0x1a, 
-0xba, 0x42, 0x05, 0xd8, 0x26, 0x48, 0x81, 0x6b, 0x01, 0x31, 0x81, 0x63, 
-0x01, 0x20, 0x37, 0xe0, 0xc3, 0x19, 0xca, 0x6c, 0x93, 0x42, 0x08, 0xd8, 
-0x22, 0x4a, 0x3a, 0x43, 0x00, 0x92, 0x0a, 0x1c, 0x49, 0x6c, 0x09, 0x18, 
-0x92, 0x6c, 0x23, 0x1c, 0x12, 0xe0, 0x16, 0x1a, 0x00, 0x96, 0x1b, 0x49, 
-0x49, 0x6c, 0x09, 0x18, 0x19, 0x48, 0x82, 0x6c, 0x03, 0x20, 0x23, 0x1c, 
-0xff, 0xf7, 0x50, 0xfe, 0xb8, 0x1b, 0x18, 0x4a, 0x02, 0x43, 0x00, 0x92, 
-0xa3, 0x19, 0x14, 0x48, 0x82, 0x6c, 0x41, 0x6c, 
-0x03, 0x20, 0xff, 0xf7, 0x45, 0xfe, 0x01, 0x20, 0x0d, 0x49, 0xc0, 0x46, 
-0x68, 0x70, 0x8a, 0x69, 0x92, 0x00, 0x52, 0x18, 0x17, 0x61, 0x8a, 0x69, 
-0x00, 0x2a, 0x02, 0xd0, 0x00, 0x27, 0x8f, 0x61, 0x00, 0xe0, 0x88, 0x61, 
-0x0c, 0x48, 0x02, 0x23, 0xc1, 0x6b, 0x19, 0x43, 0xc1, 0x63, 0x00, 0x20, 
-0x01, 0x27, 0x0a, 0x49, 0xc0, 0x46, 0x4f, 0x73, 0x02, 0xb0, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x28, 0x05, 0x00, 0x80, 0xfc, 0xba, 0x20, 0x40, 
-0x68, 0x0e, 0x00, 0x80, 0x7c, 0x29, 0x00, 0x80, 0xa0, 0x82, 0x20, 0x40, 
-0x00, 0x00, 0x19, 0x02, 0xe8, 0x0e, 0x00, 0x80, 0x18, 0x1a, 0x00, 0x80, 
-0x07, 0x49, 0x8a, 0x6e, 0x10, 0x18, 0x07, 0x4a, 0xd2, 0x6c, 0x13, 0x04, 
-0x1b, 0x0c, 0x83, 0x42, 0x00, 0xd8, 0x80, 0x1a, 0x88, 0x66, 0x88, 0x6e, 
-0x03, 0x49, 0xc0, 0x46, 0x48, 0x61, 0x70, 0x47, 0x68, 0x0e, 0x00, 0x80, 
-0x7c, 0x29, 0x00, 0x80, 0x3c, 0xef, 0x20, 0x40, 0x06, 0x49, 0x4a, 0x6e, 
-0x10, 0x18, 0x06, 0x4a, 0x12, 0x6c, 0x82, 0x42, 0x00, 0xd8, 0x80, 0x1a, 
-0x48, 0x66, 0x48, 0x6e, 0x03, 0x49, 0xc0, 0x46, 0x08, 0x61, 0x70, 0x47, 
-0x68, 0x0e, 0x00, 0x80, 0x7c, 0x29, 0x00, 0x80, 0x3c, 0xef, 0x20, 0x40, 
-0x05, 0x22, 0x0a, 0x60, 0x82, 0x88, 0xc0, 0x46, 0x8a, 0x80, 0x00, 0x22, 
-0x4a, 0x70, 0x40, 0x88, 0xc0, 0x46, 0x48, 0x80, 0xca, 0x80, 0x8a, 0x60, 
-0xca, 0x60, 0x70, 0x47, 0x05, 0x22, 0x02, 0x60, 0x00, 0x22, 0x82, 0x80, 
-0x42, 0x70, 0x41, 0x80, 0xc2, 0x80, 0x82, 0x60, 0xc2, 0x60, 0x70, 0x47, 
-0x80, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x0e, 0x48, 0x41, 0x6b, 0x01, 0x31, 
-0x41, 0x63, 0x69, 0x46, 0x38, 0x1c, 0xff, 0xf7, 0xdd, 0xff, 0x38, 0x68, 
-0xc0, 0x46, 0x00, 0x90, 0x45, 0x20, 0x00, 0xab, 0x18, 0x70, 0x01, 0x27, 
-0xdf, 0x80, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0x11, 0xff, 0x00, 0x28, 
-0x01, 0xd1, 0x38, 0x1c, 0x00, 0xe0, 0x00, 0x20, 0x04, 0xb0, 0x80, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0xa0, 0x82, 0x20, 0x40, 0x00, 0xb5, 0x84, 0xb0, 
-0xc1, 0x88, 0x09, 0x4a, 0xc0, 0x46, 0x91, 0x81, 0x69, 0x46, 0xff, 0xf7, 
-0xbd, 0xff, 0x01, 0x20, 0x40, 0x02, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 
-0x00, 0x21, 0xff, 0xf7, 0xf5, 0xfe, 0x01, 0x20, 0x04, 0xb0, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0xe8, 0x0e, 0x00, 0x80, 0x00, 0xb5, 0xff, 0xf7, 
-0xc3, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x01, 0x20, 0x03, 0x49, 0xc0, 0x46, 
-0x08, 0x71, 0xa1, 0x21, 0x49, 0x03, 0x88, 0x60, 0x00, 0x20, 0x70, 0x47, 
-0x28, 0x0f, 0x00, 0x80, 0x00, 0x20, 0x04, 0x49, 0xc0, 0x46, 0x08, 0x71, 
-0xff, 0x21, 0xa1, 0x22, 0x52, 0x03, 0x01, 0x31, 0x91, 0x60, 0x70, 0x47, 
-0x28, 0x0f, 0x00, 0x80, 0x02, 0x20, 0xa1, 0x21, 0x49, 0x03, 0x88, 0x60, 
-0x00, 0x20, 0x70, 0x47, 0x01, 0x20, 0x40, 0x02, 0xa1, 0x21, 0x49, 0x03, 
-0x88, 0x60, 0x00, 0x20, 0x70, 0x47, 0xc0, 0x88, 0xc0, 0x06, 0xc0, 0x0e, 
-0xa1, 0x21, 0x49, 0x03, 0x48, 0x61, 0x02, 0x49, 0xc0, 0x46, 0xc8, 0x63, 
-0x00, 0x20, 0x70, 0x47, 0xe8, 0x1a, 0x00, 0x80, 0x80, 0xb5, 0x84, 0xb0, 
-0x08, 0x49, 0x0f, 0x6b, 0x69, 0x46, 0xff, 0xf7, 0x71, 0xff, 0xf8, 0x06, 
-0xc0, 0x0e, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 
-0xa9, 0xfe, 0x01, 0x20, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x80, 0x00, 0x14, 0x40, 0x80, 0xb5, 0x85, 0xb0, 0x07, 0x1c, 0x69, 0x46, 
-0x38, 0x1c, 0xff, 0xf7, 0x5b, 0xff, 0xf8, 0x88, 
-0x04, 0xa9, 0x05, 0xf0, 0xf7, 0xf9, 0x01, 0xab, 0x58, 0x80, 0x01, 0xa8, 
-0x40, 0x88, 0x00, 0x28, 0x0f, 0xd0, 0x01, 0xa8, 0x40, 0x88, 0x80, 0x08, 
-0x03, 0x38, 0x80, 0x08, 0x01, 0x30, 0x04, 0x3b, 0x58, 0x70, 0x04, 0x98, 
-0x01, 0x68, 0xc0, 0x46, 0x02, 0x91, 0x40, 0x68, 0xc0, 0x46, 0x03, 0x90, 
-0x05, 0xe0, 0x00, 0xa8, 0x00, 0x78, 0x40, 0x23, 0x18, 0x43, 0x00, 0xab, 
-0x18, 0x70, 0x04, 0x98, 0xc1, 0x1d, 0x01, 0x31, 0x68, 0x46, 0xff, 0xf7, 
-0x75, 0xfe, 0x01, 0x20, 0x05, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x90, 0xb5, 0x84, 0xb0, 0x14, 0x4f, 0x39, 0x7b, 0x00, 0x29, 0x20, 0xd1, 
-0xf9, 0x1d, 0xff, 0x31, 0x3a, 0x31, 0x49, 0x78, 0x00, 0x29, 0x1a, 0xd1, 
-0x10, 0x49, 0x05, 0x22, 0x00, 0x92, 0x08, 0x22, 0x00, 0xab, 0x5a, 0x80, 
-0x98, 0x80, 0x06, 0x20, 0x00, 0xab, 0x58, 0x70, 0x00, 0x24, 0xdc, 0x80, 
-0x08, 0x68, 0xc0, 0x46, 0x02, 0x90, 0x48, 0x68, 0xc0, 0x46, 0x03, 0x90, 
-0x01, 0x20, 0x38, 0x73, 0x68, 0x46, 0x08, 0x31, 0xff, 0xf7, 0x4c, 0xfe, 
-0x00, 0x28, 0x00, 0xd0, 0x3c, 0x73, 0x04, 0xb0, 0x90, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0x28, 0x05, 0x00, 0x80, 0xa4, 0x2a, 0x00, 0x80, 
-0x90, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x69, 0x46, 0x38, 0x1c, 0xff, 0xf7, 
-0xf9, 0xfe, 0xba, 0x68, 0x0d, 0x4c, 0x0e, 0x48, 0x00, 0x2a, 0x05, 0xd1, 
-0x0d, 0x49, 0xff, 0xf7, 0xd6, 0xfc, 0x00, 0x28, 0x0c, 0xda, 0x05, 0xe0, 
-0xb9, 0x88, 0x0b, 0x4b, 0xff, 0xf7, 0xd1, 0xfc, 0x00, 0x28, 0x05, 0xda, 
-0x01, 0xab, 0x5c, 0x80, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0x22, 0xfe, 
-0x00, 0x20, 0x04, 0xb0, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0xff, 0xff, 0x00, 0x00, 0x15, 0x79, 0x21, 0x40, 0x8d, 0xd5, 0x21, 0x40, 
-0x25, 0xd5, 0x21, 0x40, 0x00, 0xb5, 0xc0, 0x88, 0x05, 0xf0, 0x5c, 0xf9, 
-0x00, 0x20, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xff, 0xf7, 0xe2, 0xfe, 
-0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xff, 0xf7, 0xdd, 0xfe, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0xb5, 0x01, 0x1c, 0x02, 0x20, 0x00, 0xf0, 0x02, 0xf8, 
-0x08, 0xbc, 0x18, 0x47, 0xb0, 0xb5, 0xc6, 0xb0, 0x04, 0x1c, 0x08, 0x1c, 
-0x69, 0x46, 0xff, 0xf7, 0xb5, 0xfe, 0x1c, 0x48, 0xff, 0xf7, 0x96, 0xfc, 
-0x07, 0x1c, 0x1b, 0x4a, 0x00, 0x21, 0x20, 0x1c, 0xff, 0xf7, 0x92, 0xfc, 
-0x00, 0x28, 0x1d, 0xd0, 0x04, 0xa9, 0x18, 0x4a, 0x20, 0x1c, 0xff, 0xf7, 
-0x8b, 0xfc, 0x04, 0x98, 0x04, 0x28, 0x05, 0xd9, 0x04, 0x98, 0x80, 0x08, 
-0x03, 0x38, 0x80, 0x08, 0x01, 0x30, 0x00, 0xe0, 0x00, 0x20, 0x00, 0xab, 
-0x58, 0x70, 0x06, 0xa8, 0x00, 0x78, 0xc0, 0x46, 0xd8, 0x80, 0x04, 0x98, 
-0xc0, 0x46, 0x02, 0x90, 0x07, 0x98, 0xc0, 0x46, 0x03, 0x90, 0x04, 0x33, 
-0x08, 0xad, 0x02, 0xe0, 0x45, 0x20, 0x00, 0xab, 0x18, 0x70, 0x09, 0x49, 
-0x38, 0x1c, 0xff, 0xf7, 0x6a, 0xfc, 0x68, 0x46, 0x29, 0x1c, 0xff, 0xf7, 
-0xc1, 0xfd, 0x01, 0x20, 0x46, 0xb0, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x24, 0x02, 0xff, 0xff, 0xcd, 0xc0, 0x21, 0x40, 0x29, 0xbf, 0x21, 0x40, 
-0x3c, 0x02, 0xff, 0xff, 0x00, 0xb5, 0x01, 0x1c, 0x02, 0x20, 0x00, 0xf0, 
-0x10, 0xf8, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0x01, 0x1c, 0x01, 0x20, 
-0xff, 0xf7, 0xac, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0x01, 0x1c, 
-0x01, 0x20, 0x00, 0xf0, 0x02, 0xf8, 0x08, 0xbc, 0x18, 0x47, 0xf3, 0xb5, 
-0xc6, 0xb0, 0x0f, 0x1c, 0x69, 0x46, 0x38, 0x1c, 
-0xff, 0xf7, 0x58, 0xfe, 0x20, 0x48, 0xff, 0xf7, 0x39, 0xfc, 0x04, 0x1c, 
-0x78, 0x78, 0x00, 0x01, 0xba, 0x68, 0x04, 0x30, 0xfc, 0x2a, 0x23, 0xd8, 
-0xff, 0x23, 0x09, 0x33, 0x98, 0x42, 0x1f, 0xd8, 0xfd, 0x88, 0xf8, 0x68, 
-0xc0, 0x46, 0x04, 0x90, 0x05, 0xa9, 0xfb, 0x1d, 0x09, 0x33, 0x00, 0x20, 
-0x7e, 0x78, 0x00, 0x2e, 0x0d, 0xdd, 0x40, 0xcb, 0x40, 0xc1, 0x40, 0xcb, 
-0x40, 0xc1, 0x40, 0xcb, 0x40, 0xc1, 0x40, 0xcb, 0x40, 0xc1, 0x01, 0x30, 
-0x00, 0x04, 0x00, 0x0c, 0x7e, 0x78, 0x86, 0x42, 0xf1, 0xdc, 0x46, 0x98, 
-0x04, 0xa9, 0x2b, 0x1c, 0xff, 0xf7, 0x20, 0xfc, 0x00, 0x28, 0x05, 0xd0, 
-0x00, 0xa8, 0x00, 0x78, 0x40, 0x23, 0x18, 0x43, 0x00, 0xab, 0x18, 0x70, 
-0x07, 0x49, 0x20, 0x1c, 0xff, 0xf7, 0x05, 0xfc, 0x68, 0x46, 0x00, 0x21, 
-0xff, 0xf7, 0x5c, 0xfd, 0x01, 0x20, 0x48, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0x24, 0x02, 0xff, 0xff, 0x3c, 0x02, 0xff, 0xff, 
-0x00, 0xb5, 0xff, 0xf7, 0x27, 0xfe, 0x08, 0xbc, 0x18, 0x47, 0xf0, 0xb5, 
-0xc6, 0xb0, 0x07, 0x1c, 0xfc, 0x88, 0x25, 0x4d, 0x68, 0x68, 0x01, 0x30, 
-0x69, 0x46, 0x68, 0x60, 0x38, 0x1c, 0xff, 0xf7, 0x01, 0xfe, 0x10, 0x2c, 
-0x08, 0xd3, 0x00, 0xa8, 0x00, 0x78, 0x40, 0x23, 0x18, 0x43, 0x00, 0xab, 
-0x18, 0x70, 0x02, 0x20, 0xd8, 0x80, 0x17, 0xe0, 0x78, 0x78, 0x82, 0x00, 
-0xfb, 0x1d, 0x09, 0x33, 0x00, 0x20, 0xb9, 0x68, 0x00, 0x2a, 0x15, 0xd9, 
-0x40, 0xcb, 0x0f, 0x1c, 0x01, 0x31, 0xbe, 0x42, 0x0d, 0xd0, 0x00, 0xaa, 
-0x12, 0x78, 0x40, 0x23, 0x1a, 0x43, 0x00, 0xab, 0x1a, 0x70, 0x04, 0x22, 
-0xda, 0x80, 0x02, 0x90, 0x03, 0x91, 0x04, 0x33, 0x68, 0x46, 0x00, 0x21, 
-0x15, 0xe0, 0x01, 0x30, 0x90, 0x42, 0xe9, 0xd3, 0x00, 0xab, 0x5c, 0x70, 
-0x02, 0x94, 0x69, 0x68, 0xc0, 0x46, 0x03, 0x91, 0xa2, 0x00, 0x00, 0x20, 
-0x10, 0x33, 0x00, 0x2a, 0x05, 0xd9, 0x0f, 0x1c, 0x80, 0xc3, 0x01, 0x30, 
-0x01, 0x31, 0x90, 0x42, 0xf9, 0xd3, 0x68, 0x46, 0x04, 0xa9, 0xff, 0xf7, 
-0x03, 0xfd, 0x01, 0x20, 0x46, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x9c, 0x03, 0x00, 0x80, 0x90, 0xb4, 0x23, 0x48, 0x00, 0x68, 0x01, 0x21, 
-0x42, 0x09, 0x00, 0xd3, 0x00, 0x21, 0x00, 0x27, 0x3a, 0x1c, 0x43, 0x0b, 
-0x00, 0xd2, 0x02, 0x22, 0x11, 0x43, 0x1e, 0x4a, 0x20, 0x24, 0xd3, 0x68, 
-0x01, 0x2b, 0x2e, 0xd1, 0x80, 0x0a, 0x00, 0xd2, 0x00, 0x24, 0x0c, 0x43, 
-0x20, 0x1c, 0x1b, 0x23, 0xdb, 0x01, 0xd1, 0x18, 0x89, 0x8b, 0x09, 0x0b, 
-0x00, 0xd2, 0x04, 0x27, 0x38, 0x43, 0xd1, 0x6f, 0x09, 0x68, 0x09, 0x0a, 
-0x07, 0xd2, 0xd1, 0x1d, 0x79, 0x31, 0x09, 0x68, 0x09, 0x68, 0x09, 0x0a, 
-0x01, 0xd3, 0x08, 0x23, 0x18, 0x43, 0xe3, 0x23, 0x1b, 0x01, 0xd1, 0x18, 
-0x89, 0x79, 0x03, 0x29, 0x02, 0xd1, 0xff, 0x23, 0x01, 0x33, 0x18, 0x43, 
-0x0b, 0x49, 0x09, 0x6a, 0x10, 0x22, 0x4b, 0x0a, 0x00, 0xd2, 0x00, 0x22, 
-0x10, 0x43, 0x89, 0x07, 0x89, 0x0f, 0x89, 0x01, 0x08, 0x43, 0x90, 0xbc, 
-0x70, 0x47, 0x40, 0x0c, 0x00, 0xd2, 0x00, 0x24, 0x0c, 0x43, 0x20, 0x1c, 
-0xec, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x68, 0x0e, 0x00, 0x80, 
-0xc0, 0x00, 0x18, 0x40, 0xf0, 0xb5, 0x3a, 0x4c, 0x20, 0x1c, 0x05, 0xf0, 
-0x75, 0xfc, 0x39, 0x48, 0xe3, 0x23, 0x1b, 0x01, 0xc7, 0x18, 0xb9, 0x79, 
-0x37, 0x4e, 0xc5, 0x1d, 0x79, 0x35, 0x06, 0x29, 0x62, 0xd2, 0x02, 0xa3, 
-0x5b, 0x5c, 0x5b, 0x00, 0x9f, 0x44, 0x00, 0x1c, 
-0x03, 0x0e, 0x1e, 0x37, 0x4e, 0x55, 0x01, 0x20, 0xb8, 0x71, 0x00, 0x20, 
-0xb0, 0x60, 0xff, 0xf7, 0x95, 0xff, 0x05, 0x23, 0x98, 0x43, 0x00, 0xf0, 
-0x6f, 0xf8, 0x0c, 0xe0, 0xff, 0xf7, 0x8e, 0xff, 0xc0, 0x08, 0x06, 0xd3, 
-0xb0, 0x68, 0x41, 0x1c, 0xb1, 0x60, 0x0a, 0x28, 0x03, 0xd9, 0x04, 0x20, 
-0x00, 0xe0, 0x02, 0x20, 0xb8, 0x71, 0x64, 0x22, 0x20, 0x1c, 0x2b, 0xe0, 
-0x06, 0x1c, 0xc0, 0x6f, 0x80, 0x23, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 
-0x03, 0x20, 0xb8, 0x71, 0x20, 0x1c, 0x20, 0x4a, 0x00, 0x21, 0x05, 0xf0, 
-0x07, 0xfc, 0xf0, 0x6f, 0x04, 0x23, 0x01, 0x68, 0x99, 0x43, 0x01, 0x60, 
-0x28, 0x68, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 0xf0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x05, 0x21, 0xb9, 0x71, 0x29, 0x68, 0x04, 0x23, 0x0a, 0x68, 
-0x9a, 0x43, 0x0a, 0x60, 0xc0, 0x6f, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 
-0xff, 0xf7, 0x5a, 0xff, 0x08, 0x23, 0x18, 0x43, 0x00, 0xf0, 0x34, 0xf8, 
-0x20, 0x1c, 0x10, 0x4a, 0x00, 0x21, 0x05, 0xf0, 0xe5, 0xfb, 0xe5, 0xe7, 
-0xff, 0xf7, 0x4e, 0xff, 0x04, 0x23, 0x18, 0x43, 0x00, 0xf0, 0x28, 0xf8, 
-0xde, 0xe7, 0x00, 0x20, 0x29, 0x68, 0x60, 0x23, 0x0a, 0x68, 0x9a, 0x43, 
-0x0a, 0x60, 0xff, 0xf7, 0xe1, 0xfa, 0xd5, 0xe7, 0x06, 0x20, 0xb8, 0x71, 
-0xd2, 0xe7, 0x00, 0x00, 0x99, 0x7c, 0x21, 0x40, 0x68, 0x0e, 0x00, 0x80, 
-0x9c, 0x03, 0x00, 0x80, 0x30, 0x75, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 
-0x00, 0xb5, 0x00, 0x20, 0x04, 0x49, 0xc0, 0x46, 0x88, 0x71, 0x04, 0x48, 
-0x01, 0x22, 0x00, 0x21, 0x05, 0xf0, 0xbc, 0xfb, 0x08, 0xbc, 0x18, 0x47, 
-0x98, 0x1c, 0x00, 0x80, 0x99, 0x7c, 0x21, 0x40, 0x90, 0xb5, 0x07, 0x1c, 
-0x31, 0x48, 0x00, 0x68, 0x79, 0x08, 0x03, 0xd3, 0x10, 0x23, 0x01, 0x1c, 
-0x99, 0x43, 0x01, 0xe0, 0x10, 0x21, 0x01, 0x43, 0x2d, 0x4c, 0xe2, 0x68, 
-0x01, 0x2a, 0x05, 0xd1, 0x22, 0x79, 0x00, 0x2a, 0x02, 0xd0, 0x01, 0x23, 
-0x9b, 0x02, 0x19, 0x43, 0x81, 0x42, 0x02, 0xd0, 0x01, 0x20, 0x00, 0x05, 
-0x01, 0x60, 0xe0, 0x68, 0x01, 0x28, 0x20, 0xd1, 0x1b, 0x23, 0xdb, 0x01, 
-0xe0, 0x18, 0x80, 0x8b, 0xf9, 0x08, 0x04, 0xd3, 0x01, 0x23, 0xdb, 0x02, 
-0x01, 0x1c, 0x99, 0x43, 0x01, 0xe0, 0x01, 0x21, 0xc9, 0x02, 0x81, 0x42, 
-0x02, 0xd0, 0x00, 0x20, 0x03, 0xf0, 0xca, 0xf9, 0x38, 0x09, 0x07, 0xd3, 
-0xe0, 0x6f, 0x80, 0x23, 0x01, 0x68, 0x99, 0x43, 0x01, 0x60, 0xe0, 0x18, 
-0x00, 0x68, 0x00, 0xe0, 0xe0, 0x6f, 0x80, 0x23, 0x01, 0x68, 0x19, 0x43, 
-0x01, 0x60, 0x15, 0x48, 0x01, 0x6a, 0x78, 0x09, 0x03, 0xd3, 0xff, 0x20, 
-0x01, 0x30, 0x08, 0x43, 0x03, 0xe0, 0xff, 0x23, 0x08, 0x1c, 0x01, 0x33, 
-0x98, 0x43, 0x80, 0x08, 0x80, 0x00, 0xba, 0x09, 0x92, 0x07, 0x92, 0x0f, 
-0x10, 0x43, 0x88, 0x42, 0x02, 0xd0, 0x0c, 0x49, 0xc0, 0x46, 0x08, 0x62, 
-0xe1, 0x68, 0x01, 0x29, 0x08, 0xd1, 0x79, 0x0a, 0x06, 0xd3, 0xff, 0x23, 
-0x04, 0x33, 0x18, 0x40, 0x03, 0x28, 0x01, 0xd1, 0xff, 0xf7, 0x8e, 0xff, 
-0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 
-0x68, 0x0e, 0x00, 0x80, 0xc0, 0x00, 0x18, 0x40, 0xc0, 0x00, 0x18, 0x00, 
-0x80, 0xb5, 0xff, 0xf7, 0xb1, 0xfe, 0x80, 0x09, 0x1b, 0xd2, 0x0f, 0x48, 
-0xe3, 0x23, 0x1b, 0x01, 0xc1, 0x18, 0x4a, 0x79, 0x00, 0x2a, 0x14, 0xd1, 
-0x01, 0x22, 0x4a, 0x71, 0x00, 0x27, 0x80, 0x30, 0x00, 0x68, 0x60, 0x23, 
-0x01, 0x68, 0x99, 0x43, 0x01, 0x60, 0x08, 0x48, 
-0x06, 0xe0, 0x02, 0x20, 0x03, 0xf0, 0x7e, 0xfb, 0x07, 0x20, 0x03, 0xf0, 
-0x4d, 0xfb, 0x38, 0x1c, 0xff, 0xf7, 0x34, 0xfa, 0xf5, 0xe7, 0x80, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 0xf4, 0x01, 0xff, 0xff, 
-0x00, 0xb5, 0x84, 0xb0, 0x69, 0x46, 0xff, 0xf7, 0x43, 0xfc, 0xff, 0xf7, 
-0x85, 0xfe, 0x01, 0xab, 0x58, 0x80, 0x08, 0x48, 0x00, 0x68, 0xc0, 0x46, 
-0x02, 0x90, 0x07, 0x48, 0x00, 0x6a, 0xc0, 0x46, 0x03, 0x90, 0x68, 0x46, 
-0x00, 0x21, 0xff, 0xf7, 0x73, 0xfb, 0x01, 0x20, 0x04, 0xb0, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0xc0, 0x00, 0x18, 0x40, 
-0x80, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x69, 0x46, 0x38, 0x1c, 0xff, 0xf7, 
-0x23, 0xfc, 0xf8, 0x88, 0xff, 0xf7, 0x42, 0xff, 0xff, 0xf7, 0x62, 0xfe, 
-0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0x58, 0xfb, 
-0x01, 0x20, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xb0, 0xb5, 
-0xc6, 0xb0, 0xc7, 0x88, 0x69, 0x46, 0xff, 0xf7, 0x0d, 0xfc, 0x01, 0x24, 
-0x16, 0x4b, 0x9f, 0x42, 0x0a, 0xd9, 0x00, 0xa8, 0x00, 0x78, 0x40, 0x23, 
-0x18, 0x43, 0x00, 0xab, 0x18, 0x70, 0x02, 0x20, 0xd8, 0x80, 0x68, 0x46, 
-0x00, 0x21, 0x17, 0xe0, 0x10, 0x48, 0xff, 0xf7, 0xdf, 0xf9, 0x05, 0x1c, 
-0x0f, 0x4a, 0x38, 0x1c, 0x04, 0xa9, 0xff, 0xf7, 0xdb, 0xf9, 0x0e, 0x49, 
-0x28, 0x1c, 0xff, 0xf7, 0xd6, 0xf9, 0x10, 0x20, 0x00, 0xab, 0x58, 0x70, 
-0x04, 0x98, 0xc0, 0x46, 0x02, 0x90, 0x05, 0x98, 0xc0, 0x46, 0x03, 0x90, 
-0x68, 0x46, 0x06, 0xa9, 0xff, 0xf7, 0x24, 0xfb, 0x20, 0x1c, 0x46, 0xb0, 
-0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 
-0x24, 0x02, 0xff, 0xff, 0x29, 0xbf, 0x21, 0x40, 0x3c, 0x02, 0xff, 0xff, 
+0x07, 0xe0, 0x03, 0x9d, 0xe8, 0x6a, 0x30, 0x28, 0x03, 0xd2, 0x30, 0x20, 
+0x03, 0x9d, 0xc0, 0x46, 0xe8, 0x62, 0x19, 0x4a, 0x78, 0x69, 0x00, 0x28, 
+0x2a, 0xd0, 0x00, 0x21, 0x01, 0x23, 0x18, 0x43, 0x78, 0x61, 0x00, 0x20, 
+0x01, 0x24, 0x00, 0x22, 0x13, 0x4e, 0x7b, 0x69, 0x23, 0x40, 0x10, 0xd0, 
+0x93, 0x00, 0x9b, 0x18, 0x9b, 0x00, 0x12, 0x4d, 0x5b, 0x19, 0x9d, 0x78, 
+0x85, 0x42, 0x08, 0xd1, 0x1d, 0x69, 0x0b, 0x1c, 0x9b, 0x00, 0x9e, 0x19, 
+0x2d, 0x23, 0x9b, 0x01, 0xf3, 0x18, 0xdd, 0x63, 0x01, 0x31, 0x64, 0x00, 
+0x01, 0x32, 0x0b, 0x2a, 0xe6, 0xd3, 0x01, 0x30, 0x09, 0x28, 0xe1, 0xd3, 
+0x00, 0x20, 0x89, 0x00, 0x04, 0x4a, 0x89, 0x18, 0x2d, 0x23, 0x9b, 0x01, 
+0xc9, 0x18, 0xc8, 0x63, 0x04, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x68, 0x0e, 0x00, 0x80, 0x30, 0x53, 0xff, 0xff, 0x00, 0x01, 0x00, 0x80, 
+0x00, 0x47, 0x08, 0x47, 0x10, 0x47, 0x18, 0x47, 0x78, 0x47, 0xc0, 0x46, 
+0x18, 0xc0, 0x9f, 0xe5, 0x1c, 0xff, 0x2f, 0xe1, 0x78, 0x47, 0xc0, 0x46, 
+0x10, 0xc0, 0x9f, 0xe5, 0x1c, 0xff, 0x2f, 0xe1, 0x78, 0x47, 0xc0, 0x46, 
+0x08, 0xc0, 0x9f, 0xe5, 0x1c, 0xff, 0x2f, 0xe1, 0x38, 0x52, 0xff, 0xff, 
+0x88, 0x51, 0xff, 0xff, 0xd5, 0xb0, 0x21, 0x40, 0xf0, 0xb5, 0x04, 0x20, 
+0x1a, 0x49, 0x01, 0x25, 0x08, 0x60, 0x1a, 0x4f, 0xbb, 0x23, 0x1b, 0x01, 
+0xf8, 0x18, 0x05, 0x73, 0x18, 0x48, 0x41, 0x6b, 0x2c, 0x05, 0x00, 0x20, 
+0x7a, 0x6e, 0x17, 0x4b, 0x8a, 0x42, 0x1d, 0xd0, 
+0x19, 0x7b, 0x00, 0x29, 0x17, 0xd1, 0xd9, 0x1d, 0xff, 0x31, 0x3a, 0x31, 
+0x49, 0x78, 0x1e, 0x1c, 0x00, 0x29, 0x10, 0xd1, 0xb0, 0x60, 0x10, 0x20, 
+0x70, 0x60, 0x10, 0x4a, 0x10, 0x49, 0xff, 0xf7, 0xc3, 0xff, 0x00, 0x28, 
+0x07, 0xd0, 0x35, 0x73, 0x04, 0x23, 0xb8, 0x69, 0x18, 0x43, 0xb8, 0x61, 
+0x20, 0x61, 0x00, 0xf0, 0x17, 0xf8, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x18, 0x73, 0x04, 0x23, 0xb8, 0x69, 0x98, 0x43, 0xb8, 0x61, 0x20, 0x61, 
+0xf5, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x68, 0x0e, 0x00, 0x80, 
+0x00, 0x01, 0x18, 0x40, 0x28, 0x05, 0x00, 0x80, 0x20, 0x55, 0xff, 0xff, 
+0x7d, 0x71, 0x21, 0x40, 0xf8, 0xb5, 0x15, 0x4f, 0x39, 0x6c, 0x15, 0x48, 
+0x40, 0x6e, 0x0c, 0x1a, 0x14, 0x4e, 0x71, 0x68, 0x14, 0x4d, 0xa1, 0x42, 
+0x06, 0xd8, 0x14, 0x4a, 0x0a, 0x43, 0x00, 0x92, 0xb9, 0x6b, 0x09, 0x18, 
+0xfa, 0x6b, 0x11, 0xe0, 0x11, 0x22, 0x52, 0x05, 0x22, 0x43, 0x00, 0x92, 
+0xb9, 0x6b, 0x09, 0x18, 0x00, 0x20, 0xfa, 0x6b, 0x2b, 0x1c, 0xff, 0xf7, 
+0x8d, 0xff, 0x70, 0x68, 0x00, 0x1b, 0x0a, 0x4a, 0x02, 0x43, 0x00, 0x92, 
+0xb9, 0x6b, 0xfa, 0x6b, 0x00, 0x20, 0x2b, 0x1c, 0xff, 0xf7, 0x82, 0xff, 
+0xf8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x7c, 0x29, 0x00, 0x80, 
+0x68, 0x0e, 0x00, 0x80, 0x28, 0x05, 0x00, 0x80, 0x44, 0x80, 0x20, 0x40, 
+0x00, 0x00, 0x37, 0x02, 0xf0, 0xb5, 0x2b, 0x4f, 0xb8, 0x68, 0x79, 0x68, 
+0xc0, 0x19, 0x20, 0x30, 0x29, 0x4a, 0xff, 0xf7, 0x63, 0xff, 0x01, 0x20, 
+0xc0, 0x02, 0x28, 0x49, 0xc0, 0x46, 0x08, 0x60, 0xb9, 0x68, 0x38, 0x1c, 
+0x26, 0x4d, 0x00, 0x24, 0x26, 0x4e, 0xef, 0x1d, 0x79, 0x37, 0x00, 0x29, 
+0x31, 0xd1, 0x31, 0x68, 0x0a, 0x78, 0x12, 0x0a, 0x03, 0xd2, 0x04, 0x73, 
+0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x49, 0x78, 0x00, 0x29, 0x0c, 0xd1, 
+0x05, 0x1c, 0x40, 0x68, 0x00, 0xf0, 0x3e, 0xf9, 0x30, 0x68, 0x00, 0xf0, 
+0x67, 0xf8, 0x00, 0x28, 0x26, 0xd1, 0x2c, 0x73, 0xff, 0xf7, 0x58, 0xff, 
+0x22, 0xe0, 0x09, 0x01, 0x07, 0x1c, 0x41, 0x60, 0x08, 0x1c, 0x17, 0x4a, 
+0x17, 0x49, 0xff, 0xf7, 0x35, 0xff, 0x00, 0x28, 0x07, 0xd1, 0x3c, 0x73, 
+0x04, 0x23, 0xa8, 0x69, 0x98, 0x43, 0x99, 0x04, 0xa8, 0x61, 0x08, 0x61, 
+0xda, 0xe7, 0x10, 0x20, 0x00, 0xf0, 0x20, 0xf9, 0x10, 0x20, 0xb8, 0x60, 
+0xff, 0xf7, 0x82, 0xff, 0xd2, 0xe7, 0x05, 0x1c, 0x40, 0x68, 0x00, 0xf0, 
+0x17, 0xf9, 0x30, 0x68, 0x00, 0xf0, 0x40, 0xf8, 0x00, 0x28, 0xd8, 0xd0, 
+0x02, 0x23, 0xf8, 0x6b, 0x18, 0x43, 0xf8, 0x63, 0xc4, 0xe7, 0x00, 0x00, 
+0x28, 0x05, 0x00, 0x80, 0xa5, 0x55, 0xff, 0xff, 0x00, 0x00, 0x00, 0xb0, 
+0x68, 0x0e, 0x00, 0x80, 0xe4, 0x01, 0x00, 0x80, 0x20, 0x55, 0xff, 0xff, 
+0x7d, 0x71, 0x21, 0x40, 0x90, 0xb5, 0x01, 0x20, 0x40, 0x03, 0x10, 0x49, 
+0x00, 0x27, 0x08, 0x60, 0x0f, 0x4c, 0xe0, 0x1d, 0xff, 0x30, 0x3a, 0x30, 
+0x47, 0x70, 0xe0, 0x69, 0x80, 0x00, 0x00, 0x19, 0x00, 0x69, 0x00, 0xf0, 
+0xd7, 0xf8, 0xe0, 0x69, 0x00, 0x28, 0x01, 0xd0, 0xe7, 0x61, 0x01, 0xe0, 
+0x01, 0x20, 0xe0, 0x61, 0x07, 0x48, 0x02, 0x23, 0xc1, 0x6b, 0x19, 0x43, 
+0xc1, 0x63, 0x27, 0x73, 0xff, 0xf7, 0x00, 0xff, 0x90, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x28, 0x05, 0x00, 0x80, 
+0xe8, 0x0e, 0x00, 0x80, 0x80, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x78, 0x88, 
+0x6d, 0x28, 0x03, 0xdb, 0x38, 0x1c, 0x00, 0xf0, 
+0xf7, 0xf8, 0x17, 0xe0, 0x80, 0x00, 0x0d, 0x49, 0x09, 0x58, 0x38, 0x1c, 
+0xff, 0xf7, 0xcb, 0xfe, 0x00, 0x28, 0x0f, 0xd1, 0x39, 0x78, 0xc9, 0x09, 
+0x0c, 0xd3, 0x69, 0x46, 0x38, 0x1c, 0x00, 0xf0, 0xcf, 0xf8, 0x68, 0x46, 
+0x00, 0x21, 0x00, 0xf0, 0x0b, 0xf8, 0x00, 0x28, 0x01, 0xd1, 0x01, 0x20, 
+0x00, 0xe0, 0x00, 0x20, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0xe8, 0x01, 0x00, 0x80, 0xf0, 0xb5, 0x82, 0xb0, 0x02, 0x1c, 0x41, 0x4b, 
+0xdd, 0x1d, 0xff, 0x35, 0x3a, 0x35, 0x2f, 0x78, 0x00, 0x2f, 0x01, 0xd0, 
+0x00, 0x27, 0x00, 0xe0, 0x01, 0x27, 0x2f, 0x70, 0x2f, 0x78, 0xfb, 0x00, 
+0xdb, 0x19, 0x5b, 0x01, 0x3a, 0x4f, 0xdc, 0x19, 0x40, 0x78, 0x00, 0x01, 
+0xc7, 0x1d, 0x09, 0x37, 0x00, 0x20, 0x83, 0x00, 0xd6, 0x58, 0xc0, 0x46, 
+0xe6, 0x50, 0x01, 0x30, 0x04, 0x28, 0xf8, 0xd3, 0x00, 0x29, 0x0f, 0xd0, 
+0x00, 0x22, 0xbb, 0x08, 0x01, 0x93, 0x83, 0x42, 0x0b, 0xd9, 0x13, 0x1c, 
+0x9b, 0x00, 0xcb, 0x58, 0x86, 0x00, 0xa3, 0x51, 0x01, 0x9b, 0x01, 0x30, 
+0x01, 0x32, 0x83, 0x42, 0xf5, 0xd8, 0x00, 0xe0, 0x10, 0x27, 0x2b, 0x48, 
+0x02, 0x6d, 0x80, 0x6e, 0x2a, 0x49, 0x82, 0x42, 0x03, 0xd8, 0x82, 0x1a, 
+0xcb, 0x6c, 0x9a, 0x1a, 0x00, 0xe0, 0x12, 0x1a, 0xba, 0x42, 0x05, 0xd8, 
+0x26, 0x48, 0x81, 0x6b, 0x01, 0x31, 0x81, 0x63, 0x01, 0x20, 0x37, 0xe0, 
+0xc3, 0x19, 0xca, 0x6c, 0x93, 0x42, 0x08, 0xd8, 0x22, 0x4a, 0x3a, 0x43, 
+0x00, 0x92, 0x0a, 0x1c, 0x49, 0x6c, 0x09, 0x18, 0x92, 0x6c, 0x23, 0x1c, 
+0x12, 0xe0, 0x16, 0x1a, 0x00, 0x96, 0x1b, 0x49, 0x49, 0x6c, 0x09, 0x18, 
+0x19, 0x48, 0x82, 0x6c, 0x03, 0x20, 0x23, 0x1c, 0xff, 0xf7, 0x5e, 0xfe, 
+0xb8, 0x1b, 0x18, 0x4a, 0x02, 0x43, 0x00, 0x92, 0xa3, 0x19, 0x14, 0x48, 
+0x82, 0x6c, 0x41, 0x6c, 0x03, 0x20, 0xff, 0xf7, 0x53, 0xfe, 0x01, 0x20, 
+0x0d, 0x49, 0xc0, 0x46, 0x68, 0x70, 0x8a, 0x69, 0x92, 0x00, 0x52, 0x18, 
+0x17, 0x61, 0x8a, 0x69, 0x00, 0x2a, 0x02, 0xd0, 0x00, 0x27, 0x8f, 0x61, 
+0x00, 0xe0, 0x88, 0x61, 0x0c, 0x48, 0x02, 0x23, 0xc1, 0x6b, 0x19, 0x43, 
+0xc1, 0x63, 0x00, 0x20, 0x01, 0x27, 0x0a, 0x49, 0xc0, 0x46, 0x4f, 0x73, 
+0x02, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x28, 0x05, 0x00, 0x80, 
+0x50, 0xba, 0x20, 0x40, 0x68, 0x0e, 0x00, 0x80, 0x7c, 0x29, 0x00, 0x80, 
+0xa0, 0x82, 0x20, 0x40, 0x00, 0x00, 0x19, 0x02, 0xe8, 0x0e, 0x00, 0x80, 
+0x18, 0x1a, 0x00, 0x80, 0x07, 0x49, 0x8a, 0x6e, 0x10, 0x18, 0x07, 0x4a, 
+0xd2, 0x6c, 0x13, 0x04, 0x1b, 0x0c, 0x83, 0x42, 0x00, 0xd8, 0x80, 0x1a, 
+0x88, 0x66, 0x88, 0x6e, 0x03, 0x49, 0xc0, 0x46, 0x48, 0x61, 0x70, 0x47, 
+0x68, 0x0e, 0x00, 0x80, 0x7c, 0x29, 0x00, 0x80, 0x90, 0xee, 0x20, 0x40, 
+0x06, 0x49, 0x4a, 0x6e, 0x10, 0x18, 0x06, 0x4a, 0x12, 0x6c, 0x82, 0x42, 
+0x00, 0xd8, 0x80, 0x1a, 0x48, 0x66, 0x48, 0x6e, 0x03, 0x49, 0xc0, 0x46, 
+0x08, 0x61, 0x70, 0x47, 0x68, 0x0e, 0x00, 0x80, 0x7c, 0x29, 0x00, 0x80, 
+0x90, 0xee, 0x20, 0x40, 0x05, 0x22, 0x0a, 0x60, 0x82, 0x88, 0xc0, 0x46, 
+0x8a, 0x80, 0x00, 0x22, 0x4a, 0x70, 0x40, 0x88, 0xc0, 0x46, 0x48, 0x80, 
+0xca, 0x80, 0x8a, 0x60, 0xca, 0x60, 0x70, 0x47, 0x05, 0x22, 0x02, 0x60, 
+0x00, 0x22, 0x82, 0x80, 0x42, 0x70, 0x41, 0x80, 0xc2, 0x80, 0x82, 0x60, 
+0xc2, 0x60, 0x70, 0x47, 0x80, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x0e, 0x48, 
+0x41, 0x6b, 0x01, 0x31, 0x41, 0x63, 0x69, 0x46, 
+0x38, 0x1c, 0xff, 0xf7, 0xdd, 0xff, 0x38, 0x68, 0xc0, 0x46, 0x00, 0x90, 
+0x45, 0x20, 0x00, 0xab, 0x18, 0x70, 0x01, 0x27, 0xdf, 0x80, 0x68, 0x46, 
+0x00, 0x21, 0xff, 0xf7, 0x11, 0xff, 0x00, 0x28, 0x01, 0xd1, 0x38, 0x1c, 
+0x00, 0xe0, 0x00, 0x20, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0xa0, 0x82, 0x20, 0x40, 0x00, 0xb5, 0x84, 0xb0, 0xc1, 0x88, 0x09, 0x4a, 
+0xc0, 0x46, 0x91, 0x81, 0x69, 0x46, 0xff, 0xf7, 0xbd, 0xff, 0x01, 0x20, 
+0x40, 0x02, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 
+0xf5, 0xfe, 0x01, 0x20, 0x04, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
+0xe8, 0x0e, 0x00, 0x80, 0x00, 0xb5, 0xff, 0xf7, 0xc3, 0xff, 0x08, 0xbc, 
+0x18, 0x47, 0x01, 0x20, 0x03, 0x49, 0xc0, 0x46, 0x08, 0x71, 0xa1, 0x21, 
+0x49, 0x03, 0x88, 0x60, 0x00, 0x20, 0x70, 0x47, 0x28, 0x0f, 0x00, 0x80, 
+0x00, 0x20, 0x04, 0x49, 0xc0, 0x46, 0x08, 0x71, 0xff, 0x21, 0xa1, 0x22, 
+0x52, 0x03, 0x01, 0x31, 0x91, 0x60, 0x70, 0x47, 0x28, 0x0f, 0x00, 0x80, 
+0x02, 0x20, 0xa1, 0x21, 0x49, 0x03, 0x88, 0x60, 0x00, 0x20, 0x70, 0x47, 
+0x01, 0x20, 0x40, 0x02, 0xa1, 0x21, 0x49, 0x03, 0x88, 0x60, 0x00, 0x20, 
+0x70, 0x47, 0xc0, 0x88, 0xc0, 0x06, 0xc0, 0x0e, 0xa1, 0x21, 0x49, 0x03, 
+0x48, 0x61, 0x02, 0x49, 0xc0, 0x46, 0xc8, 0x63, 0x00, 0x20, 0x70, 0x47, 
+0xe8, 0x1a, 0x00, 0x80, 0x80, 0xb5, 0x84, 0xb0, 0x08, 0x49, 0x0f, 0x6b, 
+0x69, 0x46, 0xff, 0xf7, 0x71, 0xff, 0xf8, 0x06, 0xc0, 0x0e, 0x01, 0xab, 
+0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0xa9, 0xfe, 0x01, 0x20, 
+0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x80, 0x00, 0x14, 0x40, 
+0x80, 0xb5, 0x85, 0xb0, 0x07, 0x1c, 0x69, 0x46, 0x38, 0x1c, 0xff, 0xf7, 
+0x5b, 0xff, 0xf8, 0x88, 0x04, 0xa9, 0x03, 0xf0, 0xc9, 0xff, 0x01, 0xab, 
+0x58, 0x80, 0x01, 0xa8, 0x40, 0x88, 0x00, 0x28, 0x0f, 0xd0, 0x01, 0xa8, 
+0x40, 0x88, 0x80, 0x08, 0x03, 0x38, 0x80, 0x08, 0x01, 0x30, 0x04, 0x3b, 
+0x58, 0x70, 0x04, 0x98, 0x01, 0x68, 0xc0, 0x46, 0x02, 0x91, 0x40, 0x68, 
+0xc0, 0x46, 0x03, 0x90, 0x05, 0xe0, 0x00, 0xa8, 0x00, 0x78, 0x40, 0x23, 
+0x18, 0x43, 0x00, 0xab, 0x18, 0x70, 0x04, 0x98, 0xc1, 0x1d, 0x01, 0x31, 
+0x68, 0x46, 0xff, 0xf7, 0x75, 0xfe, 0x01, 0x20, 0x05, 0xb0, 0x80, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x90, 0xb5, 0x84, 0xb0, 0x14, 0x4f, 0x39, 0x7b, 
+0x00, 0x29, 0x20, 0xd1, 0xf9, 0x1d, 0xff, 0x31, 0x3a, 0x31, 0x49, 0x78, 
+0x00, 0x29, 0x1a, 0xd1, 0x10, 0x49, 0x05, 0x22, 0x00, 0x92, 0x08, 0x22, 
+0x00, 0xab, 0x5a, 0x80, 0x98, 0x80, 0x06, 0x20, 0x00, 0xab, 0x58, 0x70, 
+0x00, 0x24, 0xdc, 0x80, 0x08, 0x68, 0xc0, 0x46, 0x02, 0x90, 0x48, 0x68, 
+0xc0, 0x46, 0x03, 0x90, 0x01, 0x20, 0x38, 0x73, 0x68, 0x46, 0x08, 0x31, 
+0xff, 0xf7, 0x4c, 0xfe, 0x00, 0x28, 0x00, 0xd0, 0x3c, 0x73, 0x04, 0xb0, 
+0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x28, 0x05, 0x00, 0x80, 
+0xa4, 0x2a, 0x00, 0x80, 0x90, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x69, 0x46, 
+0x38, 0x1c, 0xff, 0xf7, 0xf9, 0xfe, 0xba, 0x68, 0x0d, 0x4c, 0x0e, 0x48, 
+0x00, 0x2a, 0x05, 0xd1, 0x0d, 0x49, 0xff, 0xf7, 0xe4, 0xfc, 0x00, 0x28, 
+0x0c, 0xda, 0x05, 0xe0, 0xb9, 0x88, 0x0b, 0x4b, 0xff, 0xf7, 0xdf, 0xfc, 
+0x00, 0x28, 0x05, 0xda, 0x01, 0xab, 0x5c, 0x80, 0x68, 0x46, 0x00, 0x21, 
+0xff, 0xf7, 0x22, 0xfe, 0x00, 0x20, 0x04, 0xb0, 
+0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 
+0x0d, 0x76, 0x21, 0x40, 0xc1, 0xbd, 0x21, 0x40, 0x59, 0xbd, 0x21, 0x40, 
+0x00, 0xb5, 0xc0, 0x88, 0x03, 0xf0, 0x2e, 0xff, 0x00, 0x20, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0xb5, 0xff, 0xf7, 0xe2, 0xfe, 0x08, 0xbc, 0x18, 0x47, 
+0x00, 0xb5, 0xff, 0xf7, 0xdd, 0xfe, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 
+0x01, 0x1c, 0x02, 0x20, 0x00, 0xf0, 0x02, 0xf8, 0x08, 0xbc, 0x18, 0x47, 
+0xb0, 0xb5, 0xc6, 0xb0, 0x07, 0x1c, 0x08, 0x1c, 0x69, 0x46, 0xff, 0xf7, 
+0xb5, 0xfe, 0x21, 0x48, 0xff, 0xf7, 0xa4, 0xfc, 0x04, 0x1c, 0x20, 0x4a, 
+0x00, 0x21, 0x38, 0x1c, 0xff, 0xf7, 0xa0, 0xfc, 0x00, 0x28, 0x27, 0xd0, 
+0x04, 0xa9, 0x1d, 0x4a, 0x38, 0x1c, 0xff, 0xf7, 0x99, 0xfc, 0x04, 0xa8, 
+0x00, 0x23, 0x01, 0x2f, 0x06, 0xd1, 0x0c, 0xaa, 0x02, 0x32, 0x00, 0x21, 
+0x13, 0x60, 0x01, 0x31, 0x10, 0x29, 0xfb, 0xd3, 0x01, 0x68, 0x04, 0x29, 
+0x04, 0xd9, 0x89, 0x08, 0x03, 0x39, 0x89, 0x08, 0x01, 0x31, 0x00, 0xe0, 
+0x19, 0x1c, 0x00, 0xab, 0x59, 0x70, 0x06, 0xa9, 0x09, 0x78, 0xc0, 0x46, 
+0xd9, 0x80, 0x00, 0x68, 0xc0, 0x46, 0x02, 0x90, 0x07, 0x98, 0xc0, 0x46, 
+0x03, 0x90, 0x04, 0x33, 0x08, 0xad, 0x02, 0xe0, 0x45, 0x20, 0x00, 0xab, 
+0x18, 0x70, 0x09, 0x49, 0x20, 0x1c, 0xff, 0xf7, 0x6e, 0xfc, 0x68, 0x46, 
+0x29, 0x1c, 0xff, 0xf7, 0xb7, 0xfd, 0x01, 0x20, 0x46, 0xb0, 0xb0, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x24, 0x02, 0xff, 0xff, 0x59, 0xb1, 0x21, 0x40, 
+0x9d, 0xaf, 0x21, 0x40, 0x3c, 0x02, 0xff, 0xff, 0x00, 0xb5, 0x01, 0x1c, 
+0x02, 0x20, 0x00, 0xf0, 0x10, 0xf8, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 
+0x01, 0x1c, 0x01, 0x20, 0xff, 0xf7, 0xa2, 0xff, 0x08, 0xbc, 0x18, 0x47, 
+0x00, 0xb5, 0x01, 0x1c, 0x01, 0x20, 0x00, 0xf0, 0x02, 0xf8, 0x08, 0xbc, 
+0x18, 0x47, 0xf0, 0xb5, 0xc7, 0xb0, 0x04, 0x1c, 0x0f, 0x1c, 0x38, 0x1c, 
+0x01, 0xa9, 0xff, 0xf7, 0x4d, 0xfe, 0x21, 0x48, 0xff, 0xf7, 0x3c, 0xfc, 
+0x00, 0x90, 0x78, 0x78, 0x00, 0x01, 0xba, 0x68, 0x04, 0x30, 0xfc, 0x2a, 
+0x25, 0xd8, 0xff, 0x23, 0x09, 0x33, 0x98, 0x42, 0x21, 0xd8, 0x19, 0x2c, 
+0x1f, 0xd8, 0xfd, 0x88, 0xf8, 0x68, 0xc0, 0x46, 0x05, 0x90, 0xf9, 0x1d, 
+0x09, 0x31, 0x06, 0xab, 0x00, 0x20, 0x7e, 0x78, 0x00, 0x2e, 0x0d, 0xdd, 
+0x40, 0xc9, 0x40, 0xc3, 0x40, 0xc9, 0x40, 0xc3, 0x40, 0xc9, 0x40, 0xc3, 
+0x40, 0xc9, 0x40, 0xc3, 0x01, 0x30, 0x00, 0x04, 0x00, 0x0c, 0x7e, 0x78, 
+0x86, 0x42, 0xf1, 0xdc, 0x20, 0x1c, 0x05, 0xa9, 0x2b, 0x1c, 0xff, 0xf7, 
+0x21, 0xfc, 0x00, 0x28, 0x05, 0xd0, 0x01, 0xa8, 0x00, 0x78, 0x40, 0x23, 
+0x18, 0x43, 0x01, 0xab, 0x18, 0x70, 0x07, 0x49, 0x00, 0x98, 0xff, 0xf7, 
+0x06, 0xfc, 0x00, 0x21, 0x01, 0xa8, 0xff, 0xf7, 0x4f, 0xfd, 0x01, 0x20, 
+0x47, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x24, 0x02, 0xff, 0xff, 
+0x3c, 0x02, 0xff, 0xff, 0x00, 0xb5, 0xff, 0xf7, 0x1b, 0xfe, 0x08, 0xbc, 
+0x18, 0x47, 0xf0, 0xb5, 0xc6, 0xb0, 0x07, 0x1c, 0xfc, 0x88, 0x25, 0x4d, 
+0x68, 0x68, 0x01, 0x30, 0x69, 0x46, 0x68, 0x60, 0x38, 0x1c, 0xff, 0xf7, 
+0xf5, 0xfd, 0x10, 0x2c, 0x08, 0xd3, 0x00, 0xa8, 0x00, 0x78, 0x40, 0x23, 
+0x18, 0x43, 0x00, 0xab, 0x18, 0x70, 0x02, 0x20, 0xd8, 0x80, 0x17, 0xe0, 
+0x78, 0x78, 0x82, 0x00, 0xfb, 0x1d, 0x09, 0x33, 0x00, 0x20, 0xb9, 0x68, 
+0x00, 0x2a, 0x15, 0xd9, 0x40, 0xcb, 0x0f, 0x1c, 
+0x01, 0x31, 0xbe, 0x42, 0x0d, 0xd0, 0x00, 0xaa, 0x12, 0x78, 0x40, 0x23, 
+0x1a, 0x43, 0x00, 0xab, 0x1a, 0x70, 0x04, 0x22, 0xda, 0x80, 0x02, 0x90, 
+0x03, 0x91, 0x04, 0x33, 0x68, 0x46, 0x00, 0x21, 0x15, 0xe0, 0x01, 0x30, 
+0x90, 0x42, 0xe9, 0xd3, 0x00, 0xab, 0x5c, 0x70, 0x02, 0x94, 0x69, 0x68, 
+0xc0, 0x46, 0x03, 0x91, 0xa2, 0x00, 0x00, 0x20, 0x10, 0x33, 0x00, 0x2a, 
+0x05, 0xd9, 0x0f, 0x1c, 0x80, 0xc3, 0x01, 0x30, 0x01, 0x31, 0x90, 0x42, 
+0xf9, 0xd3, 0x68, 0x46, 0x04, 0xa9, 0xff, 0xf7, 0xf7, 0xfc, 0x01, 0x20, 
+0x46, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x9c, 0x03, 0x00, 0x80, 
+0x90, 0xb4, 0x23, 0x48, 0x00, 0x68, 0x01, 0x21, 0x42, 0x09, 0x00, 0xd3, 
+0x00, 0x21, 0x00, 0x27, 0x3a, 0x1c, 0x43, 0x0b, 0x00, 0xd2, 0x02, 0x22, 
+0x11, 0x43, 0x1e, 0x4a, 0x20, 0x24, 0xd3, 0x68, 0x01, 0x2b, 0x2e, 0xd1, 
+0x80, 0x0a, 0x00, 0xd2, 0x00, 0x24, 0x0c, 0x43, 0x20, 0x1c, 0x1b, 0x23, 
+0xdb, 0x01, 0xd1, 0x18, 0x89, 0x8b, 0x09, 0x0b, 0x00, 0xd2, 0x04, 0x27, 
+0x38, 0x43, 0xd1, 0x6f, 0x09, 0x68, 0x09, 0x0a, 0x07, 0xd2, 0xd1, 0x1d, 
+0x79, 0x31, 0x09, 0x68, 0x09, 0x68, 0x09, 0x0a, 0x01, 0xd3, 0x08, 0x23, 
+0x18, 0x43, 0xe3, 0x23, 0x1b, 0x01, 0xd1, 0x18, 0x89, 0x79, 0x03, 0x29, 
+0x02, 0xd1, 0xff, 0x23, 0x01, 0x33, 0x18, 0x43, 0x0b, 0x49, 0x09, 0x6a, 
+0x10, 0x22, 0x4b, 0x0a, 0x00, 0xd2, 0x00, 0x22, 0x10, 0x43, 0x89, 0x07, 
+0x89, 0x0f, 0x89, 0x01, 0x08, 0x43, 0x90, 0xbc, 0x70, 0x47, 0x40, 0x0c, 
+0x00, 0xd2, 0x00, 0x24, 0x0c, 0x43, 0x20, 0x1c, 0xec, 0xe7, 0x00, 0x00, 
+0x00, 0x00, 0x10, 0x40, 0x68, 0x0e, 0x00, 0x80, 0xc0, 0x00, 0x18, 0x40, 
+0xf0, 0xb5, 0x3a, 0x4c, 0x20, 0x1c, 0x04, 0xf0, 0x07, 0xfa, 0x39, 0x48, 
+0xe3, 0x23, 0x1b, 0x01, 0xc7, 0x18, 0xb9, 0x79, 0x37, 0x4e, 0xc5, 0x1d, 
+0x79, 0x35, 0x06, 0x29, 0x62, 0xd2, 0x02, 0xa3, 0x5b, 0x5c, 0x5b, 0x00, 
+0x9f, 0x44, 0x00, 0x1c, 0x03, 0x0e, 0x1e, 0x37, 0x4e, 0x55, 0x01, 0x20, 
+0xb8, 0x71, 0x00, 0x20, 0xb0, 0x60, 0xff, 0xf7, 0x95, 0xff, 0x05, 0x23, 
+0x98, 0x43, 0x00, 0xf0, 0x6f, 0xf8, 0x0c, 0xe0, 0xff, 0xf7, 0x8e, 0xff, 
+0xc0, 0x08, 0x06, 0xd3, 0xb0, 0x68, 0x41, 0x1c, 0xb1, 0x60, 0x0a, 0x28, 
+0x03, 0xd9, 0x04, 0x20, 0x00, 0xe0, 0x02, 0x20, 0xb8, 0x71, 0x64, 0x22, 
+0x20, 0x1c, 0x2b, 0xe0, 0x06, 0x1c, 0xc0, 0x6f, 0x80, 0x23, 0x01, 0x68, 
+0x19, 0x43, 0x01, 0x60, 0x03, 0x20, 0xb8, 0x71, 0x20, 0x1c, 0x20, 0x4a, 
+0x00, 0x21, 0x04, 0xf0, 0x99, 0xf9, 0xf0, 0x6f, 0x04, 0x23, 0x01, 0x68, 
+0x99, 0x43, 0x01, 0x60, 0x28, 0x68, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 
+0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x05, 0x21, 0xb9, 0x71, 0x29, 0x68, 
+0x04, 0x23, 0x0a, 0x68, 0x9a, 0x43, 0x0a, 0x60, 0xc0, 0x6f, 0x01, 0x68, 
+0x19, 0x43, 0x01, 0x60, 0xff, 0xf7, 0x5a, 0xff, 0x08, 0x23, 0x18, 0x43, 
+0x00, 0xf0, 0x34, 0xf8, 0x20, 0x1c, 0x10, 0x4a, 0x00, 0x21, 0x04, 0xf0, 
+0x77, 0xf9, 0xe5, 0xe7, 0xff, 0xf7, 0x4e, 0xff, 0x04, 0x23, 0x18, 0x43, 
+0x00, 0xf0, 0x28, 0xf8, 0xde, 0xe7, 0x00, 0x20, 0x29, 0x68, 0x60, 0x23, 
+0x0a, 0x68, 0x9a, 0x43, 0x0a, 0x60, 0xff, 0xf7, 0xe3, 0xfa, 0xd5, 0xe7, 
+0x06, 0x20, 0xb8, 0x71, 0xd2, 0xe7, 0x00, 0x00, 0xa9, 0x79, 0x21, 0x40, 
+0x68, 0x0e, 0x00, 0x80, 0x9c, 0x03, 0x00, 0x80, 0x30, 0x75, 0x00, 0x00, 
+0x10, 0x27, 0x00, 0x00, 0x00, 0xb5, 0x00, 0x20, 
+0x04, 0x49, 0xc0, 0x46, 0x88, 0x71, 0x04, 0x48, 0x01, 0x22, 0x00, 0x21, 
+0x04, 0xf0, 0x4e, 0xf9, 0x08, 0xbc, 0x18, 0x47, 0x98, 0x1c, 0x00, 0x80, 
+0xa9, 0x79, 0x21, 0x40, 0x90, 0xb5, 0x07, 0x1c, 0x31, 0x48, 0x00, 0x68, 
+0x79, 0x08, 0x03, 0xd3, 0x10, 0x23, 0x01, 0x1c, 0x99, 0x43, 0x01, 0xe0, 
+0x10, 0x21, 0x01, 0x43, 0x2d, 0x4c, 0xe2, 0x68, 0x01, 0x2a, 0x05, 0xd1, 
+0x22, 0x79, 0x00, 0x2a, 0x02, 0xd0, 0x01, 0x23, 0x9b, 0x02, 0x19, 0x43, 
+0x81, 0x42, 0x02, 0xd0, 0x01, 0x20, 0x00, 0x05, 0x01, 0x60, 0xe0, 0x68, 
+0x01, 0x28, 0x20, 0xd1, 0x1b, 0x23, 0xdb, 0x01, 0xe0, 0x18, 0x80, 0x8b, 
+0xf9, 0x08, 0x04, 0xd3, 0x01, 0x23, 0xdb, 0x02, 0x01, 0x1c, 0x99, 0x43, 
+0x01, 0xe0, 0x01, 0x21, 0xc9, 0x02, 0x81, 0x42, 0x02, 0xd0, 0x00, 0x20, 
+0x02, 0xf0, 0x1a, 0xfb, 0x38, 0x09, 0x07, 0xd3, 0xe0, 0x6f, 0x80, 0x23, 
+0x01, 0x68, 0x99, 0x43, 0x01, 0x60, 0xe0, 0x18, 0x00, 0x68, 0x00, 0xe0, 
+0xe0, 0x6f, 0x80, 0x23, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 0x15, 0x48, 
+0x01, 0x6a, 0x78, 0x09, 0x03, 0xd3, 0xff, 0x20, 0x01, 0x30, 0x08, 0x43, 
+0x03, 0xe0, 0xff, 0x23, 0x08, 0x1c, 0x01, 0x33, 0x98, 0x43, 0x80, 0x08, 
+0x80, 0x00, 0xba, 0x09, 0x92, 0x07, 0x92, 0x0f, 0x10, 0x43, 0x88, 0x42, 
+0x02, 0xd0, 0x0c, 0x49, 0xc0, 0x46, 0x08, 0x62, 0xe1, 0x68, 0x01, 0x29, 
+0x08, 0xd1, 0x79, 0x0a, 0x06, 0xd3, 0xff, 0x23, 0x04, 0x33, 0x18, 0x40, 
+0x03, 0x28, 0x01, 0xd1, 0xff, 0xf7, 0x8e, 0xff, 0x90, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x68, 0x0e, 0x00, 0x80, 
+0xc0, 0x00, 0x18, 0x40, 0xc0, 0x00, 0x18, 0x00, 0x80, 0xb5, 0xff, 0xf7, 
+0xb1, 0xfe, 0x80, 0x09, 0x1b, 0xd2, 0x0f, 0x48, 0xe3, 0x23, 0x1b, 0x01, 
+0xc1, 0x18, 0x4a, 0x79, 0x00, 0x2a, 0x14, 0xd1, 0x01, 0x22, 0x4a, 0x71, 
+0x00, 0x27, 0x80, 0x30, 0x00, 0x68, 0x60, 0x23, 0x01, 0x68, 0x99, 0x43, 
+0x01, 0x60, 0x08, 0x48, 0x06, 0xe0, 0x02, 0x20, 0x02, 0xf0, 0x8c, 0xfc, 
+0x07, 0x20, 0x02, 0xf0, 0x5b, 0xfc, 0x38, 0x1c, 0xff, 0xf7, 0x36, 0xfa, 
+0xf5, 0xe7, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 
+0xf4, 0x01, 0xff, 0xff, 0x00, 0xb5, 0x84, 0xb0, 0x69, 0x46, 0xff, 0xf7, 
+0x37, 0xfc, 0xff, 0xf7, 0x85, 0xfe, 0x01, 0xab, 0x58, 0x80, 0x08, 0x48, 
+0x00, 0x68, 0xc0, 0x46, 0x02, 0x90, 0x07, 0x48, 0x00, 0x6a, 0xc0, 0x46, 
+0x03, 0x90, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0x67, 0xfb, 0x01, 0x20, 
+0x04, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 
+0xc0, 0x00, 0x18, 0x40, 0x80, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x69, 0x46, 
+0x38, 0x1c, 0xff, 0xf7, 0x17, 0xfc, 0xf8, 0x88, 0xff, 0xf7, 0x42, 0xff, 
+0xff, 0xf7, 0x62, 0xfe, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 
+0xff, 0xf7, 0x4c, 0xfb, 0x01, 0x20, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0xb0, 0xb5, 0xc6, 0xb0, 0xc7, 0x88, 0x69, 0x46, 0xff, 0xf7, 
+0x01, 0xfc, 0x01, 0x24, 0x1a, 0x4b, 0x9f, 0x42, 0x0a, 0xd9, 0x00, 0xa8, 
+0x00, 0x78, 0x40, 0x23, 0x18, 0x43, 0x00, 0xab, 0x18, 0x70, 0x02, 0x20, 
+0xd8, 0x80, 0x68, 0x46, 0x00, 0x21, 0x20, 0xe0, 0x14, 0x48, 0xff, 0xf7, 
+0xe1, 0xf9, 0x05, 0x1c, 0x13, 0x4a, 0x38, 0x1c, 0x04, 0xa9, 0xff, 0xf7, 
+0xdd, 0xf9, 0x12, 0x49, 0x28, 0x1c, 0xff, 0xf7, 0xd8, 0xf9, 0x01, 0x2f, 
+0x06, 0xd1, 0x0c, 0xa9, 0x00, 0x20, 0x00, 0x22, 
+0x0a, 0x60, 0x01, 0x30, 0x10, 0x28, 0xfb, 0xd3, 0x10, 0x20, 0x00, 0xab, 
+0x58, 0x70, 0x04, 0x98, 0xc0, 0x46, 0x02, 0x90, 0x05, 0x98, 0xc0, 0x46, 
+0x03, 0x90, 0x68, 0x46, 0x06, 0xa9, 0xff, 0xf7, 0x0f, 0xfb, 0x20, 0x1c, 
+0x46, 0xb0, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xff, 0x01, 0x00, 0x00, 
+0x24, 0x02, 0xff, 0xff, 0x9d, 0xaf, 0x21, 0x40, 0x3c, 0x02, 0xff, 0xff, 
 0xf0, 0xb5, 0xc6, 0xb0, 0x07, 0x1c, 0x69, 0x46, 0x38, 0x1c, 0xff, 0xf7, 
-0xcf, 0xfb, 0xfc, 0x88, 0x78, 0x78, 0x01, 0x25, 0x10, 0x28, 0x02, 0xd1, 
-0x43, 0x01, 0x9c, 0x42, 0x09, 0xd3, 0x00, 0xa8, 0x00, 0x78, 0x40, 0x23, 
-0x18, 0x43, 0x00, 0xab, 0x18, 0x70, 0x02, 0x20, 0xd8, 0x80, 0x04, 0x33, 
-0x27, 0xe0, 0xb8, 0x68, 0xc0, 0x46, 0x04, 0x90, 0xf8, 0x68, 0xc0, 0x46, 
-0x05, 0x90, 0x06, 0xaa, 0xfb, 0x1d, 0x09, 0x33, 0x00, 0x21, 0x78, 0x78, 
-0x00, 0x28, 0x0d, 0xdd, 0x00, 0x20, 0x40, 0xcb, 0x40, 0xc2, 0x01, 0x30, 
-0x00, 0x04, 0x00, 0x0c, 0x04, 0x28, 0xf8, 0xdb, 0x48, 0x1c, 0x01, 0x04, 
-0x09, 0x0c, 0x78, 0x78, 0x88, 0x42, 0xf1, 0xdc, 0x0a, 0x48, 0xff, 0xf7, 
-0x83, 0xf9, 0x07, 0x1c, 0x09, 0x4a, 0x20, 0x1c, 0x04, 0xa9, 0xff, 0xf7, 
-0x7f, 0xf9, 0x08, 0x49, 0x38, 0x1c, 0xff, 0xf7, 0x7a, 0xf9, 0x68, 0x46, 
-0x00, 0x21, 0xff, 0xf7, 0xd1, 0xfa, 0x28, 0x1c, 0x46, 0xb0, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x24, 0x02, 0xff, 0xff, 0x51, 0xbf, 0x21, 0x40, 
+0xbb, 0xfb, 0xfc, 0x88, 0x78, 0x78, 0x01, 0x25, 0x10, 0x28, 0x01, 0xd1, 
+0x19, 0x2c, 0x09, 0xd9, 0x00, 0xa8, 0x00, 0x78, 0x40, 0x23, 0x18, 0x43, 
+0x00, 0xab, 0x18, 0x70, 0x02, 0x20, 0xd8, 0x80, 0x04, 0x33, 0x27, 0xe0, 
+0xb8, 0x68, 0xc0, 0x46, 0x04, 0x90, 0xf8, 0x68, 0xc0, 0x46, 0x05, 0x90, 
+0x06, 0xaa, 0xfb, 0x1d, 0x09, 0x33, 0x00, 0x21, 0x78, 0x78, 0x00, 0x28, 
+0x0d, 0xdd, 0x00, 0x20, 0x40, 0xcb, 0x40, 0xc2, 0x01, 0x30, 0x00, 0x04, 
+0x00, 0x0c, 0x04, 0x28, 0xf8, 0xdb, 0x48, 0x1c, 0x01, 0x04, 0x09, 0x0c, 
+0x78, 0x78, 0x88, 0x42, 0xf1, 0xdc, 0x0b, 0x48, 0xff, 0xf7, 0x7e, 0xf9, 
+0x07, 0x1c, 0x0a, 0x4a, 0x20, 0x1c, 0x04, 0xa9, 0xff, 0xf7, 0x7a, 0xf9, 
+0x08, 0x49, 0x38, 0x1c, 0xff, 0xf7, 0x75, 0xf9, 0x68, 0x46, 0x00, 0x21, 
+0xff, 0xf7, 0xbe, 0xfa, 0x28, 0x1c, 0x46, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0x00, 0x24, 0x02, 0xff, 0xff, 0xc5, 0xaf, 0x21, 0x40, 
 0x3c, 0x02, 0xff, 0xff, 0xf0, 0xb5, 0x84, 0xb0, 0x04, 0x1c, 0x00, 0x27, 
 0xe6, 0x88, 0xa2, 0x68, 0x47, 0x49, 0x08, 0x79, 0x00, 0x28, 0x08, 0xd0, 
 0x00, 0x2e, 0x01, 0xd0, 0x01, 0x2e, 0x01, 0xd1, 0x01, 0x27, 0x01, 0xe0, 
@@ -2439,110 +2380,110 @@
 0x66, 0xd2, 0x02, 0xa3, 0x9b, 0x5d, 0x5b, 0x00, 0x9f, 0x44, 0x00, 0x1c, 
 0x03, 0x06, 0x08, 0x0c, 0x10, 0x00, 0x05, 0x80, 0x00, 0x23, 0x03, 0xe0, 
 0x05, 0x80, 0x05, 0xe0, 0x00, 0x23, 0x03, 0x80, 0x43, 0x80, 0x06, 0xe0, 
-0x00, 0x23, 0x03, 0x80, 0x45, 0x80, 0x02, 0xe0, 
-0xff, 0x23, 0x01, 0x33, 0x03, 0x80, 0xcb, 0x1d, 0x79, 0x33, 0x9e, 0x89, 
-0x01, 0x23, 0x5b, 0x02, 0x9e, 0x42, 0x02, 0xdb, 0xd2, 0x07, 0xd2, 0x0f, 
-0x00, 0xe0, 0x01, 0x22, 0x6d, 0x23, 0x5b, 0x01, 0xc9, 0x18, 0x89, 0x88, 
-0xff, 0x23, 0xe1, 0x33, 0x99, 0x43, 0x01, 0x23, 0x19, 0x43, 0x06, 0x88, 
-0xff, 0x33, 0x9e, 0x42, 0x0d, 0xd1, 0xff, 0x20, 0xe1, 0x30, 0x08, 0x43, 
-0x00, 0x2a, 0x04, 0xd1, 0x01, 0x23, 0x9b, 0x02, 0x98, 0x43, 0x01, 0x1c, 
-0x20, 0xe0, 0x01, 0x21, 0x89, 0x02, 0x01, 0x43, 0x1c, 0xe0, 0x01, 0x2e, 
-0x0a, 0xd1, 0x40, 0x88, 0x01, 0x28, 0x04, 0xd1, 0x60, 0x23, 0x19, 0x43, 
-0x00, 0x2a, 0x13, 0xd0, 0x0c, 0xe0, 0x20, 0x23, 0x19, 0x43, 0x0f, 0xe0, 
-0x00, 0x2e, 0x0d, 0xd1, 0x40, 0x88, 0x01, 0x28, 0x08, 0xd1, 0xff, 0x23, 
-0x81, 0x33, 0x19, 0x43, 0x00, 0x2a, 0x05, 0xd0, 0x01, 0x23, 0x9b, 0x02, 
-0x19, 0x43, 0x01, 0xe0, 0x80, 0x23, 0x19, 0x43, 0x04, 0x20, 0x03, 0xf0, 
-0x2d, 0xf8, 0x09, 0x21, 0x49, 0x02, 0x00, 0x20, 0x03, 0xf0, 0x28, 0xf8, 
-0x00, 0x2f, 0x02, 0xd1, 0x00, 0x20, 0x12, 0xe0, 0xff, 0xe7, 0x69, 0x46, 
-0x20, 0x1c, 0xff, 0xf7, 0x03, 0xfb, 0x00, 0xa8, 0x00, 0x78, 0x40, 0x23, 
-0x18, 0x43, 0x00, 0xab, 0x18, 0x70, 0x02, 0x20, 0xd8, 0x80, 0x68, 0x46, 
-0x00, 0x21, 0x04, 0x33, 0xff, 0xf7, 0x36, 0xfa, 0x28, 0x1c, 0x04, 0xb0, 
+0x00, 0x23, 0x03, 0x80, 0x45, 0x80, 0x02, 0xe0, 0xff, 0x23, 0x01, 0x33, 
+0x03, 0x80, 0xcb, 0x1d, 0x79, 0x33, 0x9e, 0x89, 0x01, 0x23, 0x5b, 0x02, 
+0x9e, 0x42, 0x02, 0xdb, 0xd2, 0x07, 0xd2, 0x0f, 0x00, 0xe0, 0x01, 0x22, 
+0x6d, 0x23, 0x5b, 0x01, 0xc9, 0x18, 0x89, 0x88, 0xff, 0x23, 0xe1, 0x33, 
+0x99, 0x43, 0x01, 0x23, 0x19, 0x43, 0x06, 0x88, 0xff, 0x33, 0x9e, 0x42, 
+0x0d, 0xd1, 0xff, 0x20, 0xe1, 0x30, 0x08, 0x43, 0x00, 0x2a, 0x04, 0xd1, 
+0x01, 0x23, 0x9b, 0x02, 0x98, 0x43, 0x01, 0x1c, 0x20, 0xe0, 0x01, 0x21, 
+0x89, 0x02, 0x01, 0x43, 0x1c, 0xe0, 0x01, 0x2e, 0x0a, 0xd1, 0x40, 0x88, 
+0x01, 0x28, 0x04, 0xd1, 0x60, 0x23, 0x19, 0x43, 0x00, 0x2a, 0x13, 0xd0, 
+0x0c, 0xe0, 0x20, 0x23, 0x19, 0x43, 0x0f, 0xe0, 0x00, 0x2e, 0x0d, 0xd1, 
+0x40, 0x88, 0x01, 0x28, 0x08, 0xd1, 0xff, 0x23, 0x81, 0x33, 0x19, 0x43, 
+0x00, 0x2a, 0x05, 0xd0, 0x01, 0x23, 0x9b, 0x02, 0x19, 0x43, 0x01, 0xe0, 
+0x80, 0x23, 0x19, 0x43, 0x04, 0x20, 0x02, 0xf0, 0x75, 0xf9, 0x09, 0x21, 
+0x49, 0x02, 0x00, 0x20, 0x02, 0xf0, 0x70, 0xf9, 0x00, 0x2f, 0x02, 0xd1, 
+0x00, 0x20, 0x12, 0xe0, 0xff, 0xe7, 0x69, 0x46, 0x20, 0x1c, 0xff, 0xf7, 
+0xef, 0xfa, 0x00, 0xa8, 0x00, 0x78, 0x40, 0x23, 0x18, 0x43, 0x00, 0xab, 
+0x18, 0x70, 0x02, 0x20, 0xd8, 0x80, 0x68, 0x46, 0x00, 0x21, 0x04, 0x33, 
+0xff, 0xf7, 0x22, 0xfa, 0x28, 0x1c, 0x04, 0xb0, 
 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 
 0x88, 0x1c, 0x00, 0x80, 0xc0, 0x88, 0x51, 0x21, 0x89, 0x03, 0x08, 0x62, 
 0x00, 0x20, 0x70, 0x47, 0x80, 0xb5, 0x16, 0x4f, 0xf8, 0x68, 0x01, 0x28, 
 0x07, 0xd1, 0x37, 0x23, 0x9b, 0x01, 0xf8, 0x18, 0x40, 0x8a, 0x80, 0x21, 
 0x01, 0x43, 0x1b, 0x20, 0x07, 0xe0, 0x6d, 0x23, 0x5b, 0x01, 0xf8, 0x18, 
 0x80, 0x8b, 0x01, 0x21, 0x49, 0x03, 0x01, 0x43, 0x10, 0x20, 0x02, 0xf0, 
-0xeb, 0xff, 0x01, 0x20, 0x71, 0x23, 0x5b, 0x01, 0xf9, 0x18, 0x08, 0x80, 
+0x33, 0xf9, 0x01, 0x20, 0x71, 0x23, 0x5b, 0x01, 0xf9, 0x18, 0x08, 0x80, 
 0x48, 0x80, 0x1b, 0x23, 0xdb, 0x01, 0xf8, 0x18, 0x80, 0x8b, 0x01, 0x23, 
 0x1b, 0x03, 0x98, 0x43, 0x41, 0x21, 0x09, 0x02, 0x01, 0x43, 0x00, 0x20, 
-0x02, 0xf0, 0xd8, 0xff, 0x00, 0x20, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x02, 0xf0, 0x20, 0xf9, 0x00, 0x20, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
 0x68, 0x0e, 0x00, 0x80, 0x80, 0xb5, 0x17, 0x4f, 0xf8, 0x68, 0x01, 0x28, 
 0x08, 0xd1, 0x37, 0x23, 0x9b, 0x01, 0xf8, 0x18, 0x40, 0x8a, 0x80, 0x23, 
 0x98, 0x43, 0x01, 0x1c, 0x1b, 0x20, 0x08, 0xe0, 0x6d, 0x23, 0x5b, 0x01, 
 0xf8, 0x18, 0x80, 0x8b, 0x01, 0x23, 0x5b, 0x03, 0x98, 0x43, 0x01, 0x1c, 
-0x10, 0x20, 0x02, 0xf0, 0xb9, 0xff, 0xff, 0x20, 0x71, 0x23, 0x5b, 0x01, 
+0x10, 0x20, 0x02, 0xf0, 0x01, 0xf9, 0xff, 0x20, 0x71, 0x23, 0x5b, 0x01, 
 0xf9, 0x18, 0x01, 0x30, 0x08, 0x80, 0x1b, 0x23, 0xdb, 0x01, 0xf8, 0x18, 
 0x80, 0x8b, 0x41, 0x23, 0x1b, 0x02, 0x98, 0x43, 0x09, 0x21, 0x49, 0x02, 
-0x01, 0x43, 0x00, 0x20, 0x02, 0xf0, 0xa6, 0xff, 0x00, 0x20, 0x80, 0xbc, 
+0x01, 0x43, 0x00, 0x20, 0x02, 0xf0, 0xee, 0xf8, 0x00, 0x20, 0x80, 0xbc, 
 0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 0x80, 0xb5, 0x84, 0xb0, 
-0x08, 0x49, 0xcf, 0x6a, 0x69, 0x46, 0xff, 0xf7, 0x7d, 0xfa, 0xb8, 0x05, 
+0x08, 0x49, 0xcf, 0x6a, 0x69, 0x46, 0xff, 0xf7, 0x69, 0xfa, 0xb8, 0x05, 
 0x80, 0x0d, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 
-0xb5, 0xf9, 0x01, 0x20, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0xa1, 0xf9, 0x01, 0x20, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
 0x40, 0x00, 0x14, 0x40, 0xc0, 0x88, 0x9f, 0x23, 0x18, 0x40, 0x05, 0x49, 
 0xc9, 0x6a, 0x1b, 0x23, 0x5b, 0x01, 0x19, 0x40, 0x08, 0x43, 0x03, 0x49, 
 0xc0, 0x46, 0xc8, 0x62, 0x00, 0x20, 0x70, 0x47, 0x40, 0x00, 0x14, 0x40, 
-0x40, 0x00, 0x14, 0x00, 0x80, 0xb5, 0x84, 0xb0, 
-0x0d, 0x49, 0x0f, 0x6a, 0x01, 0x2f, 0x01, 0xd1, 0xff, 0x03, 0x07, 0xe0, 
-0x02, 0x2f, 0x01, 0xd1, 0x3f, 0x03, 0x03, 0xe0, 0x00, 0x2f, 0x01, 0xd1, 
-0x01, 0x27, 0xff, 0x02, 0x69, 0x46, 0xff, 0xf7, 0x49, 0xfa, 0x01, 0xab, 
-0x5f, 0x80, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0x83, 0xf9, 0x01, 0x20, 
-0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x20, 0x14, 0x40, 
-0xc2, 0x88, 0xa1, 0x20, 0x40, 0x03, 0x00, 0x21, 0x01, 0x23, 0x5b, 0x03, 
-0x9a, 0x42, 0x01, 0xd1, 0x02, 0x22, 0x04, 0xe0, 0x01, 0x23, 0xdb, 0x03, 
-0x9a, 0x42, 0x02, 0xd1, 0x01, 0x22, 0x02, 0x62, 0x00, 0xe0, 0x01, 0x62, 
-0x08, 0x1c, 0x70, 0x47, 0x90, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x02, 0xf0, 
-0x57, 0xff, 0x69, 0x46, 0x04, 0x1c, 0x38, 0x1c, 0xff, 0xf7, 0x1e, 0xfa, 
-0x01, 0xab, 0x5c, 0x80, 0x09, 0x4f, 0xf8, 0x6d, 0xc0, 0x46, 0x02, 0x90, 
-0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0x54, 0xf9, 0xf8, 0x6d, 0xc0, 0x07, 
-0xc0, 0x0f, 0x05, 0x49, 0xc0, 0x46, 0xc8, 0x62, 0x01, 0x20, 0x04, 0xb0, 
-0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0xa4, 0x2a, 0x00, 0x80, 
-0x68, 0x1c, 0x00, 0x80, 0xc0, 0x88, 0x02, 0x49, 0xc0, 0x46, 0x48, 0x61, 
-0x00, 0x20, 0x70, 0x47, 0x80, 0x00, 0x14, 0x00, 0x00, 0xb5, 0x84, 0xb0, 
-0x69, 0x46, 0xff, 0xf7, 0xf7, 0xf9, 0x06, 0x48, 0xc0, 0x68, 0x01, 0xab, 
-0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0x2f, 0xf9, 0x01, 0x20, 
+0x40, 0x00, 0x14, 0x00, 0x80, 0xb5, 0x84, 0xb0, 0x0d, 0x49, 0x0f, 0x6a, 
+0x01, 0x2f, 0x01, 0xd1, 0xff, 0x03, 0x07, 0xe0, 0x02, 0x2f, 0x01, 0xd1, 
+0x3f, 0x03, 0x03, 0xe0, 0x00, 0x2f, 0x01, 0xd1, 0x01, 0x27, 0xff, 0x02, 
+0x69, 0x46, 0xff, 0xf7, 0x35, 0xfa, 0x01, 0xab, 0x5f, 0x80, 0x68, 0x46, 
+0x00, 0x21, 0xff, 0xf7, 0x6f, 0xf9, 0x01, 0x20, 0x04, 0xb0, 0x80, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x00, 0x20, 0x14, 0x40, 0xc2, 0x88, 0xa1, 0x20, 
+0x40, 0x03, 0x00, 0x21, 0x01, 0x23, 0x5b, 0x03, 0x9a, 0x42, 0x01, 0xd1, 
+0x02, 0x22, 0x04, 0xe0, 0x01, 0x23, 0xdb, 0x03, 0x9a, 0x42, 0x02, 0xd1, 
+0x01, 0x22, 0x02, 0x62, 0x00, 0xe0, 0x01, 0x62, 0x08, 0x1c, 0x70, 0x47, 
+0x90, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x02, 0xf0, 0x9f, 0xf8, 0x69, 0x46, 
+0x04, 0x1c, 0x38, 0x1c, 0xff, 0xf7, 0x0a, 0xfa, 0x01, 0xab, 0x5c, 0x80, 
+0x09, 0x4f, 0xf8, 0x6d, 0xc0, 0x46, 0x02, 0x90, 0x68, 0x46, 0x00, 0x21, 
+0xff, 0xf7, 0x40, 0xf9, 0xf8, 0x6d, 0xc0, 0x07, 0xc0, 0x0f, 0x05, 0x49, 
+0xc0, 0x46, 0xc8, 0x62, 0x01, 0x20, 0x04, 0xb0, 0x90, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0x00, 0xa4, 0x2a, 0x00, 0x80, 0x68, 0x1c, 0x00, 0x80, 
+0xc0, 0x88, 0x02, 0x49, 0xc0, 0x46, 0x48, 0x61, 0x00, 0x20, 0x70, 0x47, 
+0x80, 0x00, 0x14, 0x00, 0x00, 0xb5, 0x84, 0xb0, 0x69, 0x46, 0xff, 0xf7, 
+0xe3, 0xf9, 0x06, 0x48, 0xc0, 0x68, 0x01, 0xab, 
+0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0x1b, 0xf9, 0x01, 0x20, 
 0x04, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x80, 0x00, 0x14, 0x40, 
 0xc0, 0x88, 0x02, 0x49, 0xc0, 0x46, 0xc8, 0x60, 0x00, 0x20, 0x70, 0x47, 
 0x80, 0x00, 0x14, 0x00, 0x80, 0xb5, 0x84, 0xb0, 0x69, 0x46, 0x87, 0x68, 
-0xff, 0xf7, 0xda, 0xf9, 0x20, 0x2f, 0x07, 0xd2, 0x78, 0x00, 0x0c, 0x49, 
+0xff, 0xf7, 0xc6, 0xf9, 0x20, 0x2f, 0x07, 0xd2, 0x78, 0x00, 0x0c, 0x49, 
 0x40, 0x18, 0x1b, 0x23, 0xdb, 0x01, 0xc0, 0x18, 0x80, 0x8b, 0x06, 0xe0, 
 0x00, 0xa8, 0x00, 0x78, 0x40, 0x23, 0x18, 0x43, 0x00, 0xab, 0x18, 0x70, 
 0x02, 0x20, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 
-0x03, 0xf9, 0x01, 0x20, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0xef, 0xf8, 0x01, 0x20, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
 0x68, 0x0e, 0x00, 0x80, 0x00, 0xb5, 0x84, 0xb0, 0xc1, 0x88, 0x82, 0x68, 
-0x20, 0x2a, 0x04, 0xd2, 0x10, 0x1c, 0x02, 0xf0, 0xcf, 0xfe, 0x00, 0x20, 
-0x10, 0xe0, 0x69, 0x46, 0xff, 0xf7, 0xae, 0xf9, 0x00, 0xa8, 0x00, 0x78, 
+0x20, 0x2a, 0x04, 0xd2, 0x10, 0x1c, 0x02, 0xf0, 0x17, 0xf8, 0x00, 0x20, 
+0x10, 0xe0, 0x69, 0x46, 0xff, 0xf7, 0x9a, 0xf9, 0x00, 0xa8, 0x00, 0x78, 
 0x40, 0x23, 0x18, 0x43, 0x00, 0xab, 0x18, 0x70, 0x02, 0x20, 0xd8, 0x80, 
-0x68, 0x46, 0x00, 0x21, 0x04, 0x33, 0xff, 0xf7, 0xe1, 0xf8, 0x01, 0x20, 
+0x68, 0x46, 0x00, 0x21, 0x04, 0x33, 0xff, 0xf7, 0xcd, 0xf8, 0x01, 0x20, 
 0x04, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x90, 0xb5, 0x84, 0xb0, 0xc7, 0x88, 
-0x69, 0x46, 0xff, 0xf7, 0x97, 0xf9, 0x10, 0x48, 0xfe, 0xf7, 0x78, 0xff, 
-0x02, 0x20, 0x39, 0x1c, 0x03, 0xf0, 0x3c, 0xfe, 0x00, 0x28, 0x06, 0xd0, 
-0x02, 0x20, 0x39, 0x1c, 0x03, 0xf0, 0x8c, 0xfd, 0x01, 0xab, 0x58, 0x80, 
+0x69, 0x46, 0xff, 0xf7, 0x83, 0xf9, 0x10, 0x48, 0xfe, 0xf7, 0x72, 0xff, 
+0x02, 0x20, 0x39, 0x1c, 0x02, 0xf0, 0xf2, 0xff, 0x00, 0x28, 0x06, 0xd0, 
+0x02, 0x20, 0x39, 0x1c, 0x02, 0xf0, 0x36, 0xff, 0x01, 0xab, 0x58, 0x80, 
 0x02, 0xe0, 0x45, 0x20, 0x00, 0xab, 0x18, 0x70, 0x07, 0x49, 0x20, 0x1c, 
-0xfe, 0xf7, 0x65, 0xff, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0xbc, 0xf8, 
+0xfe, 0xf7, 0x5f, 0xff, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0xa8, 0xf8, 
 0x01, 0x20, 0x04, 0xb0, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
 0x24, 0x02, 0xff, 0xff, 0x3c, 0x02, 0xff, 0xff, 0xb0, 0xb5, 0x84, 0xb0, 
-0xc7, 0x88, 0x69, 0x46, 0x84, 0x68, 0xff, 0xf7, 0x6b, 0xf9, 0x10, 0x48, 
-0xfe, 0xf7, 0x4c, 0xff, 0x0f, 0x4a, 0x02, 0x20, 0x39, 0x1c, 0xfe, 0xf7, 
-0x49, 0xff, 0x00, 0x28, 0x06, 0xd0, 0x0d, 0x4b, 0x02, 0x20, 0x39, 0x1c, 
-0x22, 0x1c, 0xfe, 0xf7, 0x42, 0xff, 0x02, 0xe0, 
-0x45, 0x20, 0x00, 0xab, 0x18, 0x70, 0x09, 0x49, 0x28, 0x1c, 0xfe, 0xf7, 
-0x38, 0xff, 0x68, 0x46, 0x00, 0x21, 0xff, 0xf7, 0x8f, 0xf8, 0x01, 0x20, 
-0x04, 0xb0, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x24, 0x02, 0xff, 0xff, 
-0xcd, 0xc0, 0x21, 0x40, 0xd9, 0xbf, 0x21, 0x40, 0x3c, 0x02, 0xff, 0xff, 
-0x00, 0xb5, 0xff, 0xf7, 0x57, 0xf9, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x20, 
-0x70, 0x47, 0x80, 0xb4, 0xc2, 0x88, 0x19, 0x4b, 0xa1, 0x21, 0x49, 0x03, 
-0x00, 0x2a, 0x03, 0xd1, 0x18, 0x6b, 0x10, 0x23, 0x98, 0x43, 0x04, 0xe0, 
-0x01, 0x2a, 0x04, 0xd1, 0x18, 0x6b, 0x10, 0x23, 0x18, 0x43, 0x48, 0x61, 
-0x1f, 0xe0, 0x02, 0x2a, 0x1d, 0xd1, 0xc2, 0x68, 0x87, 0x68, 0x00, 0x20, 
-0x3b, 0x1c, 0xc3, 0x40, 0xdb, 0x07, 0xdb, 0x0f, 0x9b, 0x02, 0x03, 0x43, 
-0x0b, 0x61, 0x01, 0x30, 0x00, 0x04, 0x00, 0x0c, 0x20, 0x28, 0xf3, 0xdb, 
-0x00, 0x20, 0x13, 0x1c, 0xc3, 0x40, 0xdb, 0x07, 0xdb, 0x0f, 0x9b, 0x02, 
-0xc7, 0x1d, 0x19, 0x37, 0x3b, 0x43, 0x0b, 0x61, 0x01, 0x30, 0x00, 0x04, 
-0x00, 0x0c, 0x20, 0x28, 0xf1, 0xdb, 0x00, 0x20, 0x80, 0xbc, 0x70, 0x47, 
-0x80, 0x00, 0x14, 0x40, 0x80, 0xb4, 0xc2, 0x88, 0x81, 0x68, 0x10, 0x02, 
-0x12, 0x0a, 0x10, 0x43, 0x02, 0x04, 0x12, 0x0c, 0x0c, 0x48, 0xc0, 0x46, 
-0x02, 0x60, 0x0c, 0x4b, 0xc0, 0x46, 0x1a, 0x80, 0x0a, 0x0c, 0x17, 0x02, 
+0xc7, 0x88, 0x69, 0x46, 0x84, 0x68, 0xff, 0xf7, 0x57, 0xf9, 0x10, 0x48, 
+0xfe, 0xf7, 0x46, 0xff, 0x0f, 0x4a, 0x02, 0x20, 0x39, 0x1c, 0xfe, 0xf7, 
+0x43, 0xff, 0x00, 0x28, 0x06, 0xd0, 0x0d, 0x4b, 0x02, 0x20, 0x39, 0x1c, 
+0x22, 0x1c, 0xfe, 0xf7, 0x3c, 0xff, 0x02, 0xe0, 0x45, 0x20, 0x00, 0xab, 
+0x18, 0x70, 0x09, 0x49, 0x28, 0x1c, 0xfe, 0xf7, 0x32, 0xff, 0x68, 0x46, 
+0x00, 0x21, 0xff, 0xf7, 0x7b, 0xf8, 0x01, 0x20, 0x04, 0xb0, 0xb0, 0xbc, 
+0x08, 0xbc, 0x18, 0x47, 0x24, 0x02, 0xff, 0xff, 0x59, 0xb1, 0x21, 0x40, 
+0x59, 0xb0, 0x21, 0x40, 0x3c, 0x02, 0xff, 0xff, 0x00, 0xb5, 0xff, 0xf7, 
+0x43, 0xf9, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x20, 0x70, 0x47, 0x80, 0xb4, 
+0xc2, 0x88, 0x19, 0x4b, 0xa1, 0x21, 0x49, 0x03, 0x00, 0x2a, 0x03, 0xd1, 
+0x18, 0x6b, 0x10, 0x23, 0x98, 0x43, 0x04, 0xe0, 0x01, 0x2a, 0x04, 0xd1, 
+0x18, 0x6b, 0x10, 0x23, 0x18, 0x43, 0x48, 0x61, 0x1f, 0xe0, 0x02, 0x2a, 
+0x1d, 0xd1, 0xc2, 0x68, 0x87, 0x68, 0x00, 0x20, 0x3b, 0x1c, 0xc3, 0x40, 
+0xdb, 0x07, 0xdb, 0x0f, 0x9b, 0x02, 0x03, 0x43, 0x0b, 0x61, 0x01, 0x30, 
+0x00, 0x04, 0x00, 0x0c, 0x20, 0x28, 0xf3, 0xdb, 0x00, 0x20, 0x13, 0x1c, 
+0xc3, 0x40, 0xdb, 0x07, 0xdb, 0x0f, 0x9b, 0x02, 0xc7, 0x1d, 0x19, 0x37, 
+0x3b, 0x43, 0x0b, 0x61, 0x01, 0x30, 0x00, 0x04, 0x00, 0x0c, 0x20, 0x28, 
+0xf1, 0xdb, 0x00, 0x20, 0x80, 0xbc, 0x70, 0x47, 0x80, 0x00, 0x14, 0x40, 
+0x80, 0xb4, 0xc2, 0x88, 0x81, 0x68, 0x10, 0x02, 0x12, 0x0a, 0x10, 0x43, 
+0x02, 0x04, 0x12, 0x0c, 0x0c, 0x48, 0xc0, 0x46, 0x02, 0x60, 0x0c, 0x4b, 
+0xc0, 0x46, 0x1a, 0x80, 0x0a, 0x0c, 0x17, 0x02, 
 0x12, 0x12, 0x3a, 0x43, 0x12, 0x04, 0x12, 0x0c, 0x42, 0x60, 0x5a, 0x80, 
 0x09, 0x04, 0x09, 0x0c, 0x0a, 0x02, 0x09, 0x0a, 0x11, 0x43, 0x09, 0x04, 
 0x09, 0x0c, 0x81, 0x60, 0x99, 0x80, 0x00, 0x20, 0x80, 0xbc, 0x70, 0x47, 
@@ -2551,8 +2492,8 @@
 0x13, 0x43, 0x4a, 0x68, 0x12, 0x04, 0x12, 0x0c, 0x1f, 0x1c, 0x13, 0x02, 
 0x12, 0x12, 0x13, 0x43, 0x89, 0x68, 0x09, 0x04, 0x09, 0x0c, 0x0a, 0x02, 
 0x09, 0x12, 0x11, 0x43, 0x0c, 0x04, 0x24, 0x0c, 0x69, 0x46, 0x1d, 0x1c, 
-0xff, 0xf7, 0xc2, 0xf8, 0x01, 0xab, 0x5f, 0x80, 0x28, 0x04, 0x20, 0x43, 
-0x02, 0x90, 0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 0xf9, 0xff, 0x01, 0x20, 
+0xff, 0xf7, 0xae, 0xf8, 0x01, 0xab, 0x5f, 0x80, 0x28, 0x04, 0x20, 0x43, 
+0x02, 0x90, 0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 0xe5, 0xff, 0x01, 0x20, 
 0x04, 0xb0, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x40, 0x00, 0x14, 0x40, 
 0xc1, 0x88, 0x82, 0x68, 0x08, 0x02, 0x09, 0x0a, 0x08, 0x43, 0x00, 0x04, 
 0x00, 0x0c, 0x0a, 0x49, 0xc0, 0x46, 0xc8, 0x60, 0x10, 0x0c, 0x03, 0x02, 
@@ -2566,415 +2507,126 @@
 0x00, 0x93, 0x84, 0x88, 0x01, 0xab, 0x1c, 0x80, 0x00, 0x24, 0x04, 0x3b, 
 0x5c, 0x70, 0x40, 0x88, 0x00, 0xab, 0x58, 0x80, 0xd9, 0x80, 0x10, 0x04, 
 0x38, 0x43, 0x02, 0x90, 0x03, 0x94, 0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 
-0xa9, 0xff, 0x01, 0x20, 0x04, 0xb0, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x95, 0xff, 0x01, 0x20, 0x04, 0xb0, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
 0x40, 0x00, 0x14, 0x40, 0x00, 0xb5, 0x84, 0xb0, 0x0b, 0x49, 0x8a, 0x6a, 
-0x05, 0x21, 0x00, 0x91, 0x81, 0x88, 0x01, 0xab, 
-0x19, 0x80, 0x00, 0x21, 0x04, 0x3b, 0x59, 0x70, 0x40, 0x88, 0x00, 0xab, 
-0x58, 0x80, 0xda, 0x80, 0x02, 0x91, 0x03, 0x91, 0x68, 0x46, 0xfe, 0xf7, 
-0x8d, 0xff, 0x01, 0x20, 0x04, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0xc0, 0x00, 0x14, 0x40, 0xc0, 0x88, 0x02, 0x49, 0xc0, 0x46, 0x88, 0x62, 
-0x00, 0x20, 0x70, 0x47, 0xc0, 0x00, 0x14, 0x00, 0x00, 0xb5, 0x84, 0xb0, 
-0x0b, 0x49, 0x0a, 0x6a, 0x05, 0x21, 0x00, 0x91, 0x81, 0x88, 0x01, 0xab, 
-0x19, 0x80, 0x00, 0x21, 0x04, 0x3b, 0x59, 0x70, 0x40, 0x88, 0x00, 0xab, 
-0x58, 0x80, 0xda, 0x80, 0x02, 0x91, 0x03, 0x91, 0x68, 0x46, 0xfe, 0xf7, 
-0x69, 0xff, 0x01, 0x20, 0x04, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0xc0, 0x00, 0x14, 0x40, 0xc0, 0x88, 0x02, 0x49, 0xc0, 0x46, 0x08, 0x62, 
-0x00, 0x20, 0x70, 0x47, 0xc0, 0x00, 0x14, 0x00, 0x00, 0xb5, 0xc0, 0x88, 
-0x02, 0x49, 0xfe, 0xf7, 0xfa, 0xfd, 0x00, 0x20, 0x08, 0xbc, 0x18, 0x47, 
-0x75, 0x02, 0xff, 0xff, 0x00, 0xb5, 0x84, 0xb0, 0x69, 0x46, 0xff, 0xf7, 
-0x0b, 0xf8, 0x06, 0x48, 0x00, 0x6b, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 
-0x00, 0x21, 0xfe, 0xf7, 0x43, 0xff, 0x01, 0x20, 0x04, 0xb0, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 0x00, 0xb5, 0xff, 0xf7, 
-0x11, 0xf8, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xff, 0xf7, 0x0c, 0xf8, 
-0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xff, 0xf7, 0x07, 0xf8, 0x08, 0xbc, 
-0x18, 0x47, 0x80, 0xb5, 0x07, 0x1c, 0x10, 0x48, 0xfe, 0xf7, 0xcc, 0xfd, 
+0x05, 0x21, 0x00, 0x91, 0x81, 0x88, 0x01, 0xab, 0x19, 0x80, 0x00, 0x21, 
+0x04, 0x3b, 0x59, 0x70, 0x40, 0x88, 0x00, 0xab, 0x58, 0x80, 0xda, 0x80, 
+0x02, 0x91, 0x03, 0x91, 0x68, 0x46, 0xfe, 0xf7, 0x79, 0xff, 0x01, 0x20, 
+0x04, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0xc0, 0x00, 0x14, 0x40, 
+0xc0, 0x88, 0x02, 0x49, 0xc0, 0x46, 0x88, 0x62, 0x00, 0x20, 0x70, 0x47, 
+0xc0, 0x00, 0x14, 0x00, 0x00, 0xb5, 0x84, 0xb0, 0x0b, 0x49, 0x0a, 0x6a, 
+0x05, 0x21, 0x00, 0x91, 0x81, 0x88, 0x01, 0xab, 0x19, 0x80, 0x00, 0x21, 
+0x04, 0x3b, 0x59, 0x70, 0x40, 0x88, 0x00, 0xab, 0x58, 0x80, 0xda, 0x80, 
+0x02, 0x91, 0x03, 0x91, 0x68, 0x46, 0xfe, 0xf7, 0x55, 0xff, 0x01, 0x20, 
+0x04, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0xc0, 0x00, 0x14, 0x40, 
+0xc0, 0x88, 0x02, 0x49, 0xc0, 0x46, 0x08, 0x62, 0x00, 0x20, 0x70, 0x47, 
+0xc0, 0x00, 0x14, 0x00, 0x00, 0xb5, 0xc0, 0x88, 0x02, 0x49, 0xfe, 0xf7, 
+0xf4, 0xfd, 0x00, 0x20, 0x08, 0xbc, 0x18, 0x47, 0x75, 0x02, 0xff, 0xff, 
+0x00, 0xb5, 0x84, 0xb0, 0x69, 0x46, 0xfe, 0xf7, 0xf7, 0xff, 0x06, 0x48, 
+0x00, 0x6b, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 
+0x2f, 0xff, 0x01, 0x20, 0x04, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
+0x68, 0x0e, 0x00, 0x80, 0x00, 0xb5, 0xfe, 0xf7, 0xfd, 0xff, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0xf8, 0xff, 
+0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0xf3, 0xff, 0x08, 0xbc, 
+0x18, 0x47, 0x80, 0xb5, 0x07, 0x1c, 0x10, 0x48, 0xfe, 0xf7, 0xc6, 0xfd, 
 0x01, 0x20, 0x40, 0x02, 0xa1, 0x21, 0x49, 0x03, 0x88, 0x60, 0x00, 0x21, 
 0x0c, 0x48, 0xc0, 0x46, 0x01, 0x71, 0x0c, 0x48, 0x02, 0x68, 0x52, 0x0c, 
 0x05, 0xd2, 0x02, 0x68, 0x12, 0x0c, 0x06, 0xd1, 0x00, 0x68, 0x80, 0x0a, 
 0x03, 0xd3, 0x08, 0x48, 0xc0, 0x46, 0xc7, 0x60, 0x02, 0xe0, 0x07, 0x48, 
 0xc0, 0x46, 0x07, 0x64, 0x08, 0x1c, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0x21, 0xa5, 0x21, 0x40, 0x28, 0x0f, 0x00, 0x80, 0x00, 0x00, 0x10, 0x40, 
+0xd5, 0x94, 0x21, 0x40, 0x28, 0x0f, 0x00, 0x80, 0x00, 0x00, 0x10, 0x40, 
 0x40, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0xb5, 0x01, 0x20, 
 0x03, 0x49, 0xc0, 0x46, 0x08, 0x72, 0x12, 0x20, 0xff, 0xf7, 0xcb, 0xff, 
 0x08, 0xbc, 0x18, 0x47, 0x88, 0x1c, 0x00, 0x80, 0x00, 0xb5, 0x01, 0x20, 
 0x03, 0x49, 0xc0, 0x46, 0x48, 0x72, 0x15, 0x20, 0xff, 0xf7, 0xbf, 0xff, 
-0x08, 0xbc, 0x18, 0x47, 0x88, 0x1c, 0x00, 0x80, 0x00, 0xb5, 0x02, 0xf0, 
-0xf3, 0xfe, 0x01, 0x20, 0x08, 0xbc, 0x18, 0x47, 0x80, 0xb5, 0x84, 0xb0, 
-0x07, 0x1c, 0xf8, 0x88, 0x02, 0xf0, 0xf8, 0xff, 0x00, 0x28, 0x0c, 0xd1, 
-0x69, 0x46, 0x38, 0x1c, 0xfe, 0xf7, 0x96, 0xff, 0x06, 0x48, 0x01, 0xab, 
-0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 0xcf, 0xfe, 0x01, 0x20, 
+0x08, 0xbc, 0x18, 0x47, 0x88, 0x1c, 0x00, 0x80, 0x00, 0xb5, 0x01, 0xf0, 
+0xf9, 0xff, 0x01, 0x20, 0x08, 0xbc, 0x18, 0x47, 0x80, 0xb5, 0x84, 0xb0, 
+0x07, 0x1c, 0xf8, 0x88, 0x02, 0xf0, 0xfe, 0xf8, 0x00, 0x28, 0x0c, 0xd1, 
+0x69, 0x46, 0x38, 0x1c, 0xfe, 0xf7, 0x82, 0xff, 0x06, 0x48, 0x01, 0xab, 
+0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 0xbb, 0xfe, 0x01, 0x20, 
 0x00, 0xe0, 0x00, 0x20, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0xff, 0xff, 0x00, 0x00, 0x00, 0xb5, 0x84, 0xb0, 0x69, 0x46, 0xfe, 0xf7, 
-0x81, 0xff, 0x04, 0xf0, 0x47, 0xfa, 0x01, 0xab, 0x58, 0x80, 0x09, 0x48, 
-0x81, 0x89, 0x09, 0x04, 0xc2, 0x89, 0x11, 0x43, 0x02, 0x91, 0x81, 0x88, 
-0x09, 0x04, 0xc0, 0x88, 0x08, 0x43, 0x03, 0x90, 0x68, 0x46, 0x00, 0x21, 
-0xfe, 0xf7, 0xae, 0xfe, 0x01, 0x20, 0x04, 0xb0, 0x08, 0xbc, 0x18, 0x47, 
-0x4c, 0x2a, 0x00, 0x80, 0x00, 0xb5, 0xfe, 0xf7, 0x7d, 0xff, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0x78, 0xff, 0x08, 0xbc, 0x18, 0x47, 
-0x00, 0xb5, 0xfe, 0xf7, 0x73, 0xff, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0x6e, 0xff, 0x08, 0xbc, 0x18, 0x47, 
-0x00, 0xb5, 0xfe, 0xf7, 0x69, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 
-0xfe, 0xf7, 0x64, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 
-0x5f, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0x5a, 0xff, 
-0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0x55, 0xff, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0x50, 0xff, 0x08, 0xbc, 0x18, 0x47, 
-0x00, 0xb5, 0xfe, 0xf7, 0x4b, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 
-0xfe, 0xf7, 0x46, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0x8c, 0xb0, 
-0x08, 0xa9, 0xfe, 0xf7, 0x27, 0xff, 0x69, 0x46, 0x08, 0xa8, 0x04, 0xf0, 
-0x75, 0xfa, 0x02, 0x20, 0x08, 0xab, 0x58, 0x70, 0x69, 0x46, 0x08, 0xa8, 
-0xfe, 0xf7, 0x5c, 0xfe, 0x01, 0x20, 0x0c, 0xb0, 0x08, 0xbc, 0x18, 0x47, 
-0x00, 0xb5, 0xfe, 0xf7, 0x2d, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x90, 0xb5, 
-0x84, 0xb0, 0x07, 0x1c, 0x69, 0x46, 0x38, 0x1c, 0xfe, 0xf7, 0x0c, 0xff, 
-0xfa, 0x88, 0x12, 0x49, 0x01, 0x24, 0xc8, 0x1d, 0x89, 0x30, 0x00, 0x2a, 
-0x0f, 0xd0, 0x04, 0x70, 0x44, 0x70, 0xb8, 0x68, 0x00, 0x0c, 0x80, 0x31, 
-0xc8, 0x82, 0xb8, 0x68, 0xc0, 0x46, 0x08, 0x83, 0xf8, 0x68, 0x00, 0x0c, 
-0x48, 0x83, 0xf8, 0x68, 0xc0, 0x46, 0x88, 0x83, 0x02, 0xe0, 0x00, 0x21, 
+0xff, 0xff, 0x00, 0x00, 0x80, 0xb5, 0x84, 0xb0, 0x69, 0x46, 0xfe, 0xf7, 
+0x6d, 0xff, 0x01, 0x27, 0x01, 0xab, 0x5f, 0x80, 0x09, 0x48, 0x81, 0x89, 
+0x09, 0x04, 0xc2, 0x89, 0x11, 0x43, 0x02, 0x91, 0x81, 0x88, 0x09, 0x04, 
+0xc0, 0x88, 0x08, 0x43, 0x03, 0x90, 0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 
+0x9b, 0xfe, 0x38, 0x1c, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x4c, 0x2a, 0x00, 0x80, 0x00, 0xb5, 0xfe, 0xf7, 0x69, 0xff, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0x64, 0xff, 0x08, 0xbc, 0x18, 0x47, 
+0x00, 0xb5, 0xfe, 0xf7, 0x5f, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 
+0xfe, 0xf7, 0x5a, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 
+0x55, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0x50, 0xff, 
+0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0x4b, 0xff, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0x46, 0xff, 0x08, 0xbc, 0x18, 0x47, 
+0x00, 0xb5, 0xfe, 0xf7, 0x41, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 
+0xfe, 0xf7, 0x3c, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 
+0x37, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0x32, 0xff, 
+0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0x8c, 0xb0, 0x08, 0xa9, 0xfe, 0xf7, 
+0x13, 0xff, 0x69, 0x46, 0x08, 0xa8, 0x02, 0xf0, 0xa9, 0xff, 0x02, 0x20, 
+0x08, 0xab, 0x58, 0x70, 0x69, 0x46, 0x08, 0xa8, 0xfe, 0xf7, 0x48, 0xfe, 
+0x01, 0x20, 0x0c, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 
+0x19, 0xff, 0x08, 0xbc, 0x18, 0x47, 0x90, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 
+0x69, 0x46, 0x38, 0x1c, 0xfe, 0xf7, 0xf8, 0xfe, 0xfa, 0x88, 0x12, 0x49, 
+0x01, 0x24, 0xc8, 0x1d, 0x89, 0x30, 0x00, 0x2a, 0x0f, 0xd0, 0x04, 0x70, 
+0x44, 0x70, 0xb8, 0x68, 0x00, 0x0c, 0x80, 0x31, 0xc8, 0x82, 0xb8, 0x68, 
+0xc0, 0x46, 0x08, 0x83, 0xf8, 0x68, 0x00, 0x0c, 0x48, 0x83, 0xf8, 0x68, 
+0xc0, 0x46, 0x88, 0x83, 0x02, 0xe0, 0x00, 0x21, 
 0x01, 0x70, 0x41, 0x70, 0x06, 0x48, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 
-0x00, 0x21, 0xfe, 0xf7, 0x2b, 0xfe, 0x20, 0x1c, 0x04, 0xb0, 0x90, 0xbc, 
+0x00, 0x21, 0xfe, 0xf7, 0x17, 0xfe, 0x20, 0x1c, 0x04, 0xb0, 0x90, 0xbc, 
 0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 
-0x00, 0xb5, 0xfe, 0xf7, 0xf7, 0xfe, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 
-0xfe, 0xf7, 0xf2, 0xfe, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 
-0xed, 0xfe, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0xe8, 0xfe, 
-0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0xe3, 0xfe, 0x08, 0xbc, 
+0x00, 0xb5, 0xfe, 0xf7, 0xe3, 0xfe, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 
+0xfe, 0xf7, 0xde, 0xfe, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 
+0xd9, 0xfe, 0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0xd4, 0xfe, 
+0x08, 0xbc, 0x18, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 0xcf, 0xfe, 0x08, 0xbc, 
 0x18, 0x47, 0x90, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x69, 0x46, 0x38, 0x1c, 
-0xfe, 0xf7, 0xc2, 0xfe, 0xf8, 0x88, 0x03, 0x24, 0xe4, 0x04, 0x04, 0x43, 
+0xfe, 0xf7, 0xae, 0xfe, 0xf8, 0x88, 0x03, 0x24, 0xe4, 0x04, 0x04, 0x43, 
 0x03, 0x23, 0xdb, 0x04, 0x9c, 0x42, 0x02, 0xd3, 0x0f, 0x4b, 0x9c, 0x42, 
 0x06, 0xd9, 0x0f, 0x48, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 
-0xfe, 0xf7, 0xf0, 0xfd, 0x01, 0x20, 0x80, 0x07, 0x20, 0x43, 0x00, 0x68, 
+0xfe, 0xf7, 0xdc, 0xfd, 0x01, 0x20, 0x80, 0x07, 0x20, 0x43, 0x00, 0x68, 
 0x00, 0x21, 0x00, 0xab, 0x59, 0x70, 0xfa, 0x88, 0xc0, 0x46, 0xda, 0x80, 
-0x02, 0x90, 0x03, 0x91, 0x68, 0x46, 0x04, 0x33, 0xfe, 0xf7, 0xe0, 0xfd, 
+0x02, 0x90, 0x03, 0x91, 0x68, 0x46, 0x04, 0x33, 0xfe, 0xf7, 0xcc, 0xfd, 
 0x01, 0x20, 0x04, 0xb0, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
 0xe0, 0x00, 0x18, 0x00, 0xff, 0xff, 0x00, 0x00, 0x80, 0xb5, 0x84, 0xb0, 
-0x07, 0x1c, 0x69, 0x46, 0x38, 0x1c, 0xfe, 0xf7, 0x8f, 0xfe, 0xf8, 0x88, 
+0x07, 0x1c, 0x69, 0x46, 0x38, 0x1c, 0xfe, 0xf7, 0x7b, 0xfe, 0xf8, 0x88, 
 0x03, 0x23, 0xdb, 0x04, 0x18, 0x43, 0x98, 0x42, 0x02, 0xd3, 0x0a, 0x4b, 
 0x98, 0x42, 0x08, 0xd9, 0x09, 0x48, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 
-0x00, 0x21, 0xfe, 0xf7, 0xbf, 0xfd, 0x01, 0x20, 0x03, 0xe0, 0xb9, 0x68, 
+0x00, 0x21, 0xfe, 0xf7, 0xab, 0xfd, 0x01, 0x20, 0x03, 0xe0, 0xb9, 0x68, 
 0xc0, 0x46, 0x01, 0x60, 0x00, 0x20, 0x04, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 
 0x18, 0x47, 0x00, 0x00, 0xe0, 0x00, 0x18, 0x00, 0xff, 0xff, 0x00, 0x00, 
-0x80, 0xb5, 0x86, 0xb0, 0x07, 0x1c, 0x04, 0xf0, 0x33, 0xf9, 0x38, 0x1c, 
-0x02, 0xa9, 0xfe, 0xf7, 0x67, 0xfe, 0x01, 0x27, 0x02, 0xab, 0x5f, 0x70, 
-0x00, 0x20, 0xd8, 0x80, 0x0a, 0x48, 0x41, 0x68, 0xc0, 0x46, 0x04, 0x91, 
-0x81, 0x68, 0xc0, 0x46, 0x05, 0x91, 0xc1, 0x68, 
+0x80, 0xb5, 0x86, 0xb0, 0x02, 0xa9, 0xfe, 0xf7, 0x57, 0xfe, 0x01, 0x27, 
+0x02, 0xab, 0x5f, 0x70, 0x00, 0x20, 0xd8, 0x80, 0x0a, 0x48, 0x41, 0x68, 
+0xc0, 0x46, 0x04, 0x91, 0x81, 0x68, 0xc0, 0x46, 0x05, 0x91, 0xc1, 0x68, 
 0xc0, 0x46, 0x00, 0x91, 0x40, 0x69, 0xc0, 0x46, 0x01, 0x90, 0x69, 0x46, 
-0x02, 0xa8, 0xfe, 0xf7, 0x91, 0xfd, 0x38, 0x1c, 0x06, 0xb0, 0x80, 0xbc, 
+0x02, 0xa8, 0xfe, 0xf7, 0x81, 0xfd, 0x38, 0x1c, 0x06, 0xb0, 0x80, 0xbc, 
 0x08, 0xbc, 0x18, 0x47, 0x68, 0x19, 0x00, 0x80, 0x00, 0xb5, 0xc1, 0x68, 
-0x80, 0x68, 0xfe, 0xf7, 0x49, 0xfb, 0x00, 0x20, 0x08, 0xbc, 0x18, 0x47, 
+0x80, 0x68, 0xfe, 0xf7, 0x47, 0xfb, 0x00, 0x20, 0x08, 0xbc, 0x18, 0x47, 
 0x00, 0x20, 0x70, 0x47, 0x90, 0xb5, 0x84, 0xb0, 0x04, 0x1c, 0x0f, 0x1c, 
-0x68, 0x46, 0x50, 0x21, 0xfe, 0xf7, 0x46, 0xfe, 0x01, 0xab, 0x5c, 0x80, 
-0x02, 0x97, 0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 0x71, 0xfd, 0x04, 0xb0, 
+0x68, 0x46, 0x50, 0x21, 0xfe, 0xf7, 0x36, 0xfe, 0x01, 0xab, 0x5c, 0x80, 
+0x02, 0x97, 0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 0x61, 0xfd, 0x04, 0xb0, 
 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x80, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 
-0x68, 0x46, 0x51, 0x21, 0xfe, 0xf7, 0x34, 0xfe, 0x01, 0xab, 0x5f, 0x80, 
-0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 0x60, 0xfd, 0x04, 0xb0, 0x80, 0xbc, 
+0x68, 0x46, 0x51, 0x21, 0xfe, 0xf7, 0x24, 0xfe, 0x01, 0xab, 0x5f, 0x80, 
+0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 0x50, 0xfd, 0x04, 0xb0, 0x80, 0xbc, 
 0x08, 0xbc, 0x18, 0x47, 0x00, 0x20, 0x70, 0x47, 0x00, 0x20, 0x70, 0x47, 
 0x90, 0xb5, 0x84, 0xb0, 0x00, 0x27, 0x12, 0x49, 0x09, 0x68, 0x12, 0x4a, 
 0x12, 0x6b, 0x10, 0x23, 0x1a, 0x40, 0x01, 0x24, 0x00, 0x2a, 0x00, 0xd0, 
 0x01, 0x27, 0x8a, 0x0c, 0x03, 0xd3, 0x3a, 0x04, 0x12, 0x0c, 0x02, 0x27, 
 0x17, 0x43, 0xc9, 0x0c, 0x03, 0xd3, 0x39, 0x04, 0x09, 0x0c, 0x04, 0x27, 
-0x0f, 0x43, 0x69, 0x46, 0xfe, 0xf7, 0xfc, 0xfd, 0x01, 0xab, 0x5f, 0x80, 
-0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 0x36, 0xfd, 0x20, 0x1c, 0x04, 0xb0, 
-0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 
-0xc0, 0x00, 0x18, 0x40, 0x00, 0xb5, 0x84, 0xb0, 0x69, 0x46, 0xfe, 0xf7, 
-0xe7, 0xfd, 0x06, 0x48, 0xc0, 0x6d, 0x01, 0xab, 0x58, 0x80, 0x68, 0x46, 
-0x00, 0x21, 0xfe, 0xf7, 0x1f, 0xfd, 0x01, 0x20, 0x04, 0xb0, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0xa4, 0x2a, 0x00, 0x80, 0x00, 0xb5, 0xfe, 0xf7, 
-0xed, 0xfd, 0x08, 0xbc, 0x18, 0x47, 0x70, 0x47, 0x00, 0x20, 0x70, 0x47, 
+0x0f, 0x43, 0x69, 0x46, 0xfe, 0xf7, 0xec, 0xfd, 0x01, 0xab, 0x5f, 0x80, 
+0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 0x26, 0xfd, 0x20, 0x1c, 0x04, 0xb0, 
+0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
+0x00, 0x00, 0x10, 0x40, 0xc0, 0x00, 0x18, 0x40, 0x00, 0xb5, 0x84, 0xb0, 
+0x69, 0x46, 0xfe, 0xf7, 0xd7, 0xfd, 0x06, 0x48, 0xc0, 0x6d, 0x01, 0xab, 
+0x58, 0x80, 0x68, 0x46, 0x00, 0x21, 0xfe, 0xf7, 0x0f, 0xfd, 0x01, 0x20, 
+0x04, 0xb0, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0xa4, 0x2a, 0x00, 0x80, 
+0x00, 0xb5, 0xfe, 0xf7, 0xdd, 0xfd, 0x08, 0xbc, 0x18, 0x47, 0x70, 0x47, 
+0x00, 0x20, 0x70, 0x47, 0x00, 0x20, 0x70, 0x47, 0x00, 0x20, 0x70, 0x47, 
 0x00, 0x20, 0x70, 0x47, 0x00, 0x20, 0x70, 0x47, 0x00, 0x20, 0x70, 0x47, 
-0x00, 0x20, 0x70, 0x47, 0x00, 0x20, 0x70, 0x47, 0x00, 0xb5, 0xfe, 0xf7, 
-0xdb, 0xfd, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x80, 0xb5, 0x85, 0xb0, 
-0x01, 0xa9, 0xfe, 0xf7, 0xbb, 0xfd, 0x00, 0x20, 0x01, 0xab, 0x58, 0x70, 
-0x10, 0x49, 0xc9, 0x68, 0x01, 0x27, 0x01, 0x29, 0x0a, 0xd1, 0x04, 0xf0, 
-0xc7, 0xf8, 0x03, 0x90, 0x04, 0x97, 0x03, 0x98, 0x00, 0x28, 0x06, 0xd0, 
-0x68, 0x46, 0x02, 0xf0, 0xe5, 0xfb, 0x04, 0xe0, 0x03, 0x97, 0x04, 0x90, 
-0xf8, 0xe7, 0x00, 0x20, 0x00, 0x90, 0x02, 0xab, 0x00, 0x98, 0xc0, 0x46, 
-0x58, 0x80, 0x00, 0x21, 0x01, 0xa8, 0xfe, 0xf7, 0xdb, 0xfc, 0x38, 0x1c, 
+0x00, 0xb5, 0xfe, 0xf7, 0xcb, 0xfd, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
+0x80, 0xb5, 0x85, 0xb0, 0x01, 0xa9, 0xfe, 0xf7, 0xab, 0xfd, 0x00, 0x20, 
+0x01, 0xab, 0x58, 0x70, 0x0c, 0x49, 0xc9, 0x68, 0x01, 0x27, 0x01, 0x29, 
+0x02, 0xd1, 0x03, 0x97, 0x04, 0x97, 0x01, 0xe0, 0x03, 0x97, 0x04, 0x90, 
+0x68, 0x46, 0x01, 0xf0, 0x33, 0xfd, 0x02, 0xab, 0x00, 0x98, 0xc0, 0x46, 
+0x58, 0x80, 0x00, 0x21, 0x01, 0xa8, 0xfe, 0xf7, 0xd3, 0xfc, 0x38, 0x1c, 
 0x05, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 
-0x90, 0xb5, 0x84, 0xb0, 0x07, 0x1c, 0x69, 0x46, 0x38, 0x1c, 0xfe, 0xf7, 
-0x8d, 0xfd, 0x00, 0x20, 0x00, 0xab, 0x58, 0x70, 0x01, 0x24, 0x20, 0x1c, 
-0x12, 0x49, 0xc9, 0x68, 0x01, 0x29, 0x00, 0xd0, 0x00, 0x20, 0x00, 0x06, 
-0x00, 0x0e, 0x13, 0xd0, 0xf8, 0x88, 0x0f, 0x4a, 0x90, 0x42, 0x02, 0xd0, 
-0x0e, 0x4b, 0x98, 0x42, 0x08, 0xd1, 0xb9, 0x68, 0x27, 0x1c, 0x90, 0x42, 
-0x00, 0xd0, 0x00, 0x27, 0x38, 0x06, 0x00, 0x0e, 0x04, 0xf0, 0x88, 0xf8, 
-0x04, 0xf0, 0x84, 0xf8, 0x02, 0x90, 0x00, 0xe0, 0x02, 0x94, 0x68, 0x46, 
-0x00, 0x21, 0xfe, 0xf7, 0xa7, 0xfc, 0x20, 0x1c, 0x04, 0xb0, 0x90, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 0xed, 0xfe, 0x00, 0x00, 
-0xfe, 0xca, 0x00, 0x00, 0xf1, 0xb5, 0xd6, 0xb0, 
-0x00, 0x20, 0x81, 0x00, 0x56, 0x9c, 0x0a, 0x19, 0x12, 0x6a, 0x6b, 0x46, 
-0x5a, 0x50, 0x01, 0x30, 0x10, 0x28, 0xf6, 0xdb, 0x10, 0x20, 0x82, 0x00, 
-0x11, 0x1c, 0x69, 0x44, 0x40, 0x39, 0x4b, 0x6b, 0x0f, 0x6a, 0x7b, 0x40, 
-0x8f, 0x68, 0x7b, 0x40, 0x09, 0x68, 0x59, 0x40, 0x4b, 0x00, 0xc9, 0x0f, 
-0x19, 0x43, 0x6b, 0x46, 0x99, 0x50, 0x01, 0x30, 0x50, 0x28, 0xec, 0xdb, 
-0x56, 0x98, 0x01, 0x68, 0xc0, 0x46, 0x55, 0x91, 0x42, 0x68, 0xc0, 0x46, 
-0x54, 0x92, 0x86, 0x68, 0xc0, 0x46, 0x53, 0x96, 0xc5, 0x68, 0xc0, 0x46, 
-0x52, 0x95, 0x04, 0x69, 0xc0, 0x46, 0x51, 0x94, 0x48, 0x01, 0xcb, 0x0e, 
-0x18, 0x43, 0x13, 0x1c, 0x33, 0x40, 0x07, 0x1c, 0x28, 0x1c, 0x90, 0x43, 
-0x18, 0x43, 0x38, 0x18, 0x00, 0x19, 0x00, 0x9b, 0xc0, 0x18, 0xcf, 0x4b, 
-0xc0, 0x18, 0x93, 0x07, 0x92, 0x08, 0x13, 0x43, 0x42, 0x01, 0x1f, 0x1c, 
-0xc3, 0x0e, 0x1a, 0x43, 0x0b, 0x1c, 0x3b, 0x40, 0x14, 0x1c, 0x32, 0x1c, 
-0x8a, 0x43, 0x1a, 0x43, 0xa2, 0x18, 0x52, 0x19, 0x01, 0x9b, 0xd2, 0x18, 
-0xc5, 0x4b, 0xd4, 0x18, 0x8a, 0x07, 0x89, 0x08, 0x11, 0x43, 0x62, 0x01, 
-0xe3, 0x0e, 0x1a, 0x43, 0x03, 0x1c, 0x0b, 0x40, 0x15, 0x1c, 0x3a, 0x1c, 
-0x82, 0x43, 0x1a, 0x43, 0xaa, 0x18, 0x92, 0x19, 0x02, 0x9b, 0xd2, 0x18, 
-0xbc, 0x4b, 0xd2, 0x18, 0x3b, 0x1c, 0x87, 0x07, 0x80, 0x08, 0x38, 0x43, 
-0x57, 0x01, 0xd5, 0x0e, 0x3d, 0x43, 0x27, 0x1c, 0x07, 0x40, 0x0e, 0x1c, 
-0xa6, 0x43, 0x37, 0x43, 0xed, 0x19, 0xeb, 0x18, 0x03, 0x9f, 0xdf, 0x19, 
-0xb3, 0x4b, 0xff, 0x18, 0xa3, 0x07, 0xa4, 0x08, 0x1c, 0x43, 0x7b, 0x01, 
-0xfd, 0x0e, 0x2b, 0x43, 0x15, 0x1c, 0x25, 0x40, 0x1e, 0x1c, 0x03, 0x1c, 
-0x93, 0x43, 0x2b, 0x43, 0xf3, 0x18, 0x59, 0x18, 0x04, 0x9b, 0xc9, 0x18, 
-0xaa, 0x4b, 0xc9, 0x18, 0x93, 0x07, 0x92, 0x08, 0x1a, 0x43, 0x4b, 0x01, 
-0xcd, 0x0e, 0x1d, 0x43, 0x3e, 0x1c, 0x16, 0x40, 0x23, 0x1c, 0xbb, 0x43, 
-0x33, 0x43, 0xeb, 0x18, 0x18, 0x18, 0x05, 0x9b, 0xc0, 0x18, 0xa2, 0x4b, 
-0xc0, 0x18, 0xbb, 0x07, 0xbf, 0x08, 0x1f, 0x43, 0x43, 0x01, 0xc5, 0x0e, 
-0x2b, 0x43, 0x0d, 0x1c, 0x3d, 0x40, 0x1e, 0x1c, 0x13, 0x1c, 0x8b, 0x43, 
-0x2b, 0x43, 0xf3, 0x18, 0x1b, 0x19, 0x06, 0x9c, 0x1c, 0x19, 0x99, 0x4b, 
-0xe4, 0x18, 0x8b, 0x07, 0x89, 0x08, 0x19, 0x43, 0x63, 0x01, 0xe5, 0x0e, 
-0x1d, 0x43, 0x03, 0x1c, 0x0b, 0x40, 0x3e, 0x1c, 0x86, 0x43, 0x33, 0x43, 
-0xeb, 0x18, 0x9a, 0x18, 0x07, 0x9b, 0xd2, 0x18, 0x90, 0x4b, 0xd2, 0x18, 
-0x3b, 0x1c, 0x87, 0x07, 0x80, 0x08, 0x38, 0x43, 0x57, 0x01, 0xd5, 0x0e, 
-0x2f, 0x43, 0x25, 0x1c, 0x05, 0x40, 0x3e, 0x1c, 0x0f, 0x1c, 0xa7, 0x43, 
-0x2f, 0x43, 0xf5, 0x19, 0xeb, 0x18, 0x08, 0x9f, 0xdf, 0x19, 0x87, 0x4b, 
-0xff, 0x18, 0xa3, 0x07, 0xa4, 0x08, 0x1c, 0x43, 0x7b, 0x01, 0xfd, 0x0e, 
-0x1d, 0x43, 0x16, 0x1c, 0x26, 0x40, 0x03, 0x1c, 0x93, 0x43, 0x33, 0x43, 
-0xeb, 0x18, 0x59, 0x18, 0x09, 0x9b, 0xc9, 0x18, 0x7e, 0x4b, 0xc9, 0x18, 
-0x93, 0x07, 0x92, 0x08, 0x1a, 0x43, 0x4b, 0x01, 0xcd, 0x0e, 0x1d, 0x43, 
-0x3b, 0x1c, 0x13, 0x40, 0x26, 0x1c, 0xbe, 0x43, 0x33, 0x43, 0xeb, 0x18, 
-0x18, 0x18, 0x0a, 0x9b, 0xc0, 0x18, 0x76, 0x4b, 0xc0, 0x18, 0x23, 0x1c, 
-0xbc, 0x07, 0xbf, 0x08, 0x27, 0x43, 0x44, 0x01, 0xc5, 0x0e, 0x2c, 0x43, 
-0x0d, 0x1c, 0x3d, 0x40, 0x26, 0x1c, 0x14, 0x1c, 0x8c, 0x43, 0x2c, 0x43, 
-0x35, 0x19, 0xeb, 0x18, 0x0b, 0x9c, 0x1c, 0x19, 
-0x6c, 0x4b, 0xe4, 0x18, 0x8b, 0x07, 0x89, 0x08, 0x19, 0x43, 0x63, 0x01, 
-0xe5, 0x0e, 0x1d, 0x43, 0x03, 0x1c, 0x0b, 0x40, 0x3e, 0x1c, 0x86, 0x43, 
-0x33, 0x43, 0xeb, 0x18, 0x9a, 0x18, 0x0c, 0x9b, 0xd2, 0x18, 0x64, 0x4b, 
-0xd2, 0x18, 0x3b, 0x1c, 0x87, 0x07, 0x80, 0x08, 0x38, 0x43, 0x57, 0x01, 
-0xd5, 0x0e, 0x3d, 0x43, 0x27, 0x1c, 0x07, 0x40, 0x0e, 0x1c, 0xa6, 0x43, 
-0x37, 0x43, 0xed, 0x19, 0xeb, 0x18, 0x0d, 0x9f, 0xdf, 0x19, 0x5b, 0x4b, 
-0xff, 0x18, 0xa3, 0x07, 0xa4, 0x08, 0x1c, 0x43, 0x7b, 0x01, 0xfd, 0x0e, 
-0x1d, 0x43, 0x13, 0x1c, 0x23, 0x40, 0x06, 0x1c, 0x96, 0x43, 0x33, 0x43, 
-0xeb, 0x18, 0x59, 0x18, 0x0e, 0x9b, 0xc9, 0x18, 0x52, 0x4b, 0xc9, 0x18, 
-0x93, 0x07, 0x92, 0x08, 0x1a, 0x43, 0x4b, 0x01, 0xcd, 0x0e, 0x2b, 0x43, 
-0x3d, 0x1c, 0x15, 0x40, 0x1e, 0x1c, 0x23, 0x1c, 0xbb, 0x43, 0x2b, 0x43, 
-0xf3, 0x18, 0x18, 0x18, 0x0f, 0x9b, 0xc0, 0x18, 0x49, 0x4b, 0xc0, 0x18, 
-0x23, 0x1c, 0xbc, 0x07, 0xbf, 0x08, 0x27, 0x43, 0x10, 0x24, 0x50, 0x94, 
-0x44, 0x01, 0xc5, 0x0e, 0x25, 0x43, 0x0e, 0x1c, 0x3e, 0x40, 0x14, 0x1c, 
-0x8c, 0x43, 0x34, 0x43, 0x2c, 0x19, 0xe3, 0x18, 0x50, 0x9c, 0xa5, 0x00, 
-0x6c, 0x46, 0x64, 0x59, 0x1c, 0x19, 0x3e, 0x4b, 0xe4, 0x18, 0x13, 0x1c, 
-0x3a, 0x1c, 0x8f, 0x07, 0x89, 0x08, 0x0f, 0x43, 0x01, 0x1c, 0x20, 0x1c, 
-0x50, 0x9c, 0x01, 0x34, 0x50, 0x94, 0x14, 0x2c, 0xe2, 0xdb, 0x14, 0x24, 
-0x45, 0x01, 0xc6, 0x0e, 0x2e, 0x43, 0x0d, 0x1c, 0x7d, 0x40, 0x55, 0x40, 
-0x75, 0x19, 0xeb, 0x18, 0xa5, 0x00, 0x6e, 0x46, 0x75, 0x59, 0x5d, 0x19, 
-0x31, 0x4b, 0xed, 0x18, 0x13, 0x1c, 0x3a, 0x1c, 0x8f, 0x07, 0x89, 0x08, 
-0x0f, 0x43, 0x01, 0x1c, 0x28, 0x1c, 0x01, 0x34, 0x28, 0x2c, 0xe7, 0xdb, 
-0x28, 0x24, 0x50, 0x94, 0x44, 0x01, 0xc5, 0x0e, 0x25, 0x43, 0x3c, 0x1c, 
-0x14, 0x43, 0x0c, 0x40, 0x3e, 0x1c, 0x16, 0x40, 0x34, 0x43, 0x2c, 0x19, 
-0xe3, 0x18, 0x50, 0x9c, 0xa5, 0x00, 0x6c, 0x46, 0x64, 0x59, 0x1c, 0x19, 
-0x23, 0x4b, 0xe4, 0x18, 0x13, 0x1c, 0x3a, 0x1c, 0x8f, 0x07, 0x89, 0x08, 
-0x0f, 0x43, 0x01, 0x1c, 0x20, 0x1c, 0x50, 0x9c, 0x01, 0x34, 0x50, 0x94, 
-0x3c, 0x2c, 0xe1, 0xdb, 0x3c, 0x24, 0x45, 0x01, 0xc6, 0x0e, 0x2e, 0x43, 
-0x0d, 0x1c, 0x7d, 0x40, 0x55, 0x40, 0x75, 0x19, 0xeb, 0x18, 0xa6, 0x00, 
-0x6d, 0x46, 0xad, 0x59, 0x5d, 0x19, 0x17, 0x4b, 0xed, 0x18, 0x13, 0x1c, 
-0x3a, 0x1c, 0x8f, 0x07, 0x89, 0x08, 0x0f, 0x43, 0x01, 0x1c, 0x28, 0x1c, 
-0x01, 0x34, 0x50, 0x2c, 0xe7, 0xdb, 0x55, 0x9c, 0x20, 0x18, 0x56, 0x9c, 
-0xc0, 0x46, 0x20, 0x60, 0x54, 0x98, 0x40, 0x18, 0x56, 0x9c, 0xc0, 0x46, 
-0x60, 0x60, 0x53, 0x9e, 0xf0, 0x19, 0x56, 0x9c, 0xc0, 0x46, 0xa0, 0x60, 
-0x52, 0x9d, 0xa8, 0x18, 0x56, 0x9c, 0xc0, 0x46, 0xe0, 0x60, 0x51, 0x9c, 
-0xe0, 0x18, 0x56, 0x9c, 0xc0, 0x46, 0x20, 0x61, 0x57, 0xb0, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x99, 0x79, 0x82, 0x5a, 0xa1, 0xeb, 0xd9, 0x6e, 
-0xdc, 0xbc, 0x1b, 0x8f, 0xd6, 0xc1, 0x62, 0xca, 0x88, 0xb4, 0x8a, 0x08, 
-0x89, 0x07, 0x00, 0xd0, 0x01, 0x32, 0x00, 0x21, 0x00, 0x2a, 0x1e, 0xdd, 
-0x07, 0x78, 0x00, 0xab, 0x1f, 0x70, 0x47, 0x78, 0xc0, 0x46, 0x5f, 0x70, 
-0x87, 0x78, 0xc0, 0x46, 0x9f, 0x70, 0xc7, 0x78, 0xc0, 0x46, 0xdf, 0x70, 
-0xdb, 0x78, 0xc0, 0x46, 0x03, 0x70, 0x00, 0xab, 0x9b, 0x78, 0xc0, 0x46, 
-0x43, 0x70, 0x00, 0xab, 0x5b, 0x78, 0xc0, 0x46, 
-0x83, 0x70, 0x00, 0xab, 0x1b, 0x78, 0xc0, 0x46, 0xc3, 0x70, 0x04, 0x30, 
-0x01, 0x31, 0x91, 0x42, 0xe0, 0xdb, 0x88, 0xbc, 0x70, 0x47, 0x00, 0x21, 
-0xc1, 0x61, 0x09, 0x4a, 0xc0, 0x46, 0x02, 0x60, 0x08, 0x4a, 0xc0, 0x46, 
-0x42, 0x60, 0x08, 0x4a, 0xc0, 0x46, 0x82, 0x60, 0x07, 0x4a, 0xc0, 0x46, 
-0xc2, 0x60, 0x07, 0x4a, 0xc0, 0x46, 0x02, 0x61, 0x41, 0x61, 0x81, 0x61, 
-0x70, 0x47, 0x00, 0x00, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 
-0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0xf0, 0xe1, 0xd2, 0xc3, 
-0xf0, 0xb5, 0x14, 0x1c, 0x0d, 0x1c, 0x07, 0x1c, 0xe1, 0x00, 0x78, 0x69, 
-0x41, 0x18, 0x81, 0x42, 0x02, 0xd2, 0xb8, 0x69, 0x01, 0x30, 0xb8, 0x61, 
-0x79, 0x61, 0x61, 0x0f, 0xb8, 0x69, 0x40, 0x18, 0xb8, 0x61, 0x40, 0x2c, 
-0x14, 0xdb, 0xfe, 0x1d, 0x19, 0x36, 0x00, 0x20, 0x29, 0x78, 0x3a, 0x18, 
-0x20, 0x32, 0x11, 0x70, 0x01, 0x35, 0x01, 0x30, 0x40, 0x28, 0xf7, 0xd3, 
-0x40, 0x21, 0x30, 0x1c, 0xff, 0xf7, 0x96, 0xff, 0x38, 0x1c, 0xff, 0xf7, 
-0xaf, 0xfd, 0x40, 0x3c, 0x40, 0x2c, 0xec, 0xda, 0x00, 0x20, 0x00, 0x2c, 
-0x07, 0xd9, 0x29, 0x78, 0x3a, 0x18, 0x20, 0x32, 0x11, 0x70, 0x01, 0x35, 
-0x01, 0x30, 0xa0, 0x42, 0xf7, 0xd3, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
-0xf8, 0xb5, 0x07, 0x1c, 0xd3, 0x00, 0x78, 0x69, 0xc6, 0x18, 0x86, 0x42, 
-0x02, 0xd2, 0xb8, 0x69, 0x01, 0x30, 0xb8, 0x61, 0x7e, 0x61, 0x53, 0x0f, 
-0xb8, 0x69, 0xc0, 0x18, 0xb8, 0x61, 0x00, 0x90, 0x00, 0x20, 0x00, 0x2a, 
-0x07, 0xdd, 0x0b, 0x78, 0x3c, 0x18, 0x20, 0x34, 0x23, 0x70, 0x01, 0x31, 
-0x01, 0x30, 0x90, 0x42, 0xf7, 0xdb, 0x80, 0x20, 0xd1, 0x19, 0x20, 0x31, 
-0x08, 0x70, 0x54, 0x1c, 0xfd, 0x1d, 0x19, 0x35, 0x38, 0x2c, 0x1c, 0xdd, 
-0x38, 0x19, 0x20, 0x30, 0x00, 0x21, 0x40, 0x22, 0x12, 0x1b, 0x00, 0x2a, 
-0x05, 0xdd, 0x00, 0x23, 0x03, 0x70, 0x01, 0x30, 0x01, 0x31, 0x8a, 0x42, 
-0xfa, 0xdc, 0x28, 0x1c, 0x21, 0x1c, 0xff, 0xf7, 0x4d, 0xff, 0x38, 0x1c, 
-0xff, 0xf7, 0x66, 0xfd, 0x28, 0x1c, 0x00, 0x21, 0x00, 0x23, 0x03, 0x70, 
-0x01, 0x30, 0x01, 0x31, 0x38, 0x29, 0xfa, 0xdb, 0x0c, 0xe0, 0x38, 0x19, 
-0x20, 0x30, 0x00, 0x21, 0x38, 0x22, 0x12, 0x1b, 0x00, 0x2a, 0x05, 0xdd, 
-0x00, 0x23, 0x03, 0x70, 0x01, 0x30, 0x01, 0x31, 0x8a, 0x42, 0xfa, 0xdc, 
-0x28, 0x1c, 0x21, 0x1c, 0xff, 0xf7, 0x30, 0xff, 0x00, 0x98, 0xc0, 0x46, 
-0xb8, 0x65, 0xfe, 0x65, 0x38, 0x1c, 0xff, 0xf7, 0x45, 0xfd, 0x01, 0x20, 
-0xf8, 0x61, 0xf8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xf0, 0xb5, 0x0c, 0x1c, 
-0x05, 0x1c, 0x17, 0x1c, 0x38, 0x1c, 0x00, 0x2f, 0x04, 0xda, 0x40, 0x42, 
-0x80, 0x06, 0x80, 0x0e, 0x40, 0x42, 0x01, 0xe0, 0x80, 0x06, 0x80, 0x0e, 
-0x00, 0x28, 0x07, 0xd1, 0x28, 0x1c, 0x21, 0x1c, 0x3a, 0x1c, 0xff, 0xf7, 
-0x57, 0xff, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x38, 0x1c, 0x00, 0x2f, 
-0x00, 0xda, 0x3f, 0x30, 0x80, 0x11, 0x00, 0x28, 0x07, 0xdd, 0x86, 0x01, 
-0x28, 0x1c, 0x21, 0x1c, 0x32, 0x1c, 0xff, 0xf7, 0x47, 0xff, 0xa4, 0x19, 
-0xbf, 0x1b, 0x00, 0x2f, 0xeb, 0xd0, 0x28, 0x1c, 0x21, 0x1c, 0x3a, 0x1c, 
-0xff, 0xf7, 0x74, 0xff, 0xe5, 0xe7, 0x98, 0xb5, 0x04, 0x1c, 0x0f, 0x1c, 
-0x30, 0x20, 0x00, 0xab, 0x18, 0x70, 0xf8, 0x69, 0x00, 0x28, 0x04, 0xd1, 
-0x69, 0x46, 0x00, 0x22, 0x38, 0x1c, 0xff, 0xf7, 0x65, 0xff, 0x14, 0x21, 
-0x38, 0x1c, 0xff, 0xf7, 0xe3, 0xfe, 0x00, 0x20, 
-0x81, 0x00, 0x79, 0x58, 0x02, 0xc4, 0x01, 0x30, 0x05, 0x28, 0xf9, 0xdb, 
-0x98, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xb0, 0xb5, 0x98, 0xb0, 0x07, 0x1c, 
-0x78, 0x68, 0x40, 0x28, 0x10, 0xd9, 0x68, 0x46, 0xff, 0xf7, 0xf9, 0xfe, 
-0x68, 0x46, 0x06, 0xcf, 0x08, 0x3f, 0xff, 0xf7, 0xa7, 0xff, 0xf8, 0x1d, 
-0xc5, 0x30, 0x69, 0x46, 0x04, 0x1c, 0xff, 0xf7, 0xd0, 0xff, 0x14, 0x20, 
-0x78, 0x60, 0x3c, 0x60, 0x00, 0x20, 0x00, 0x24, 0x39, 0x18, 0xca, 0x1d, 
-0x39, 0x32, 0x14, 0x72, 0x80, 0x31, 0x4c, 0x72, 0x7b, 0x68, 0x83, 0x42, 
-0x06, 0xd9, 0x3b, 0x68, 0x5d, 0x1c, 0x3d, 0x60, 0x1b, 0x78, 0xc0, 0x46, 
-0x13, 0x72, 0x4b, 0x72, 0x15, 0x7a, 0x36, 0x23, 0x6b, 0x40, 0x13, 0x72, 
-0x4a, 0x7a, 0x5c, 0x23, 0x5a, 0x40, 0x4a, 0x72, 0x01, 0x30, 0x40, 0x28, 
-0xe4, 0xd3, 0x18, 0xb0, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xf7, 0xb5, 
-0xe0, 0xb0, 0x14, 0x1c, 0x0f, 0x1c, 0x00, 0x25, 0xae, 0x00, 0x01, 0x20, 
-0xf1, 0x1d, 0x1d, 0x31, 0x02, 0xf0, 0x10, 0xfe, 0x01, 0x04, 0x00, 0x91, 
-0x01, 0x20, 0xf1, 0x1d, 0x1b, 0x31, 0x02, 0xf0, 0x09, 0xfe, 0x00, 0x99, 
-0x08, 0x43, 0x19, 0xa9, 0x71, 0x18, 0x88, 0x60, 0x01, 0x35, 0x10, 0x2d, 
-0xea, 0xd3, 0x1b, 0xa8, 0x19, 0x90, 0x40, 0x20, 0x1a, 0x90, 0x19, 0xa8, 
-0xff, 0xf7, 0xa7, 0xff, 0x01, 0xa8, 0xff, 0xf7, 0xa6, 0xfe, 0x40, 0x22, 
-0x01, 0xa8, 0x2b, 0xa9, 0xff, 0xf7, 0x54, 0xff, 0x00, 0x2f, 0x0b, 0xd0, 
-0x40, 0x2f, 0x01, 0xd9, 0x40, 0x25, 0x00, 0xe0, 0x3d, 0x1c, 0x60, 0x99, 
-0x01, 0xa8, 0x2a, 0x1c, 0xff, 0xf7, 0x48, 0xff, 0x7f, 0x1b, 0xf3, 0xd1, 
-0x51, 0xa8, 0x01, 0xa9, 0x07, 0x1c, 0xff, 0xf7, 0x70, 0xff, 0x01, 0xa8, 
-0xff, 0xf7, 0x8b, 0xfe, 0x40, 0x22, 0x01, 0xa8, 0x3b, 0xa9, 0x01, 0x31, 
-0xff, 0xf7, 0x38, 0xff, 0x14, 0x22, 0x01, 0xa8, 0x39, 0x1c, 0xff, 0xf7, 
-0x33, 0xff, 0x56, 0xa8, 0x01, 0xa9, 0xff, 0xf7, 0x5e, 0xff, 0x00, 0x20, 
-0x82, 0x00, 0x19, 0xa9, 0x51, 0x18, 0xc0, 0x31, 0x49, 0x6b, 0x02, 0xc4, 
-0x01, 0x30, 0x05, 0x28, 0xf6, 0xd3, 0x63, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0x90, 0xb5, 0x07, 0x1c, 0x00, 0x24, 0x00, 0x2f, 
-0x04, 0xd3, 0x04, 0xf0, 0x15, 0xf9, 0x01, 0x34, 0xbc, 0x42, 0xfa, 0xd9, 
-0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xf0, 0xb5, 0x14, 0x1c, 0x0d, 0x1c, 
-0x06, 0x1c, 0x1f, 0x1c, 0x1b, 0x4b, 0x32, 0x04, 0x12, 0x0c, 0x3c, 0x21, 
-0x02, 0x20, 0xfd, 0xf7, 0x8a, 0xff, 0x32, 0x0c, 0x17, 0x4b, 0x3e, 0x21, 
-0x02, 0x20, 0xfd, 0xf7, 0x84, 0xff, 0x15, 0x4b, 0x2a, 0x04, 0x12, 0x0c, 
-0x40, 0x21, 0x02, 0x20, 0xfd, 0xf7, 0x7d, 0xff, 0x2a, 0x0c, 0x11, 0x4b, 
-0x42, 0x21, 0x02, 0x20, 0xfd, 0xf7, 0x77, 0xff, 0x0e, 0x4b, 0x22, 0x04, 
-0x12, 0x0c, 0x44, 0x21, 0x02, 0x20, 0xfd, 0xf7, 0x70, 0xff, 0x22, 0x0c, 
-0x0a, 0x4b, 0x46, 0x21, 0x02, 0x20, 0xfd, 0xf7, 0x6a, 0xff, 0x08, 0x4b, 
-0x3a, 0x04, 0x12, 0x0c, 0x48, 0x21, 0x02, 0x20, 0xfd, 0xf7, 0x63, 0xff, 
-0x3a, 0x0c, 0x04, 0x4b, 0x4a, 0x21, 0x02, 0x20, 0xfd, 0xf7, 0x5d, 0xff, 
-0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0xd9, 0xbf, 0x21, 0x40, 
-0x88, 0xb5, 0x11, 0x27, 0x3f, 0x04, 0x38, 0x62, 0x79, 0x62, 0xba, 0x62, 
-0xfb, 0x62, 0x04, 0x20, 0xff, 0xf7, 0xaa, 0xff, 0x07, 0x48, 0x40, 0x6b, 
-0xc0, 0x46, 0x00, 0x90, 0x00, 0x98, 0x80, 0x07, 0x80, 0x0f, 0x03, 0x28, 
-0x01, 0xd1, 0x01, 0x20, 0x00, 0xe0, 0x00, 0x20, 
-0x88, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x11, 0x40, 
-0xf0, 0xb5, 0x8a, 0xb0, 0x00, 0x24, 0x05, 0x94, 0x69, 0x49, 0xc9, 0x68, 
-0xc0, 0x46, 0x00, 0x91, 0x68, 0x4a, 0x11, 0x68, 0x01, 0x22, 0x12, 0x04, 
-0x0a, 0x40, 0x17, 0x21, 0x66, 0x4e, 0x00, 0x2a, 0x06, 0xd1, 0x64, 0x4a, 
-0x13, 0x68, 0x1b, 0x0c, 0x04, 0xd1, 0x12, 0x68, 0x92, 0x0a, 0x01, 0xd3, 
-0xf1, 0x60, 0x02, 0xe0, 0x61, 0x4a, 0xc0, 0x46, 0x11, 0x64, 0x61, 0x49, 
-0x89, 0x68, 0x09, 0x04, 0x09, 0x0c, 0x03, 0x29, 0x54, 0xd1, 0xe9, 0x21, 
-0x01, 0x91, 0x02, 0x99, 0xc0, 0x46, 0xb1, 0x60, 0x06, 0x94, 0x06, 0x99, 
-0x8a, 0x00, 0x5b, 0x49, 0x8a, 0x58, 0x00, 0x2a, 0x73, 0xd0, 0x80, 0x20, 
-0x02, 0x90, 0x06, 0x98, 0x81, 0x00, 0x57, 0x48, 0x41, 0x58, 0x02, 0x9a, 
-0x11, 0x43, 0x02, 0x91, 0x00, 0x24, 0x00, 0x27, 0x25, 0x02, 0x28, 0x1c, 
-0x38, 0x43, 0x09, 0x90, 0x09, 0x98, 0x00, 0x04, 0x51, 0x4b, 0x18, 0x43, 
-0x04, 0x90, 0x09, 0x98, 0xef, 0x23, 0xdb, 0x05, 0x18, 0x43, 0x03, 0x90, 
-0x06, 0x98, 0x80, 0x00, 0x4b, 0x49, 0x08, 0x58, 0x00, 0x04, 0x03, 0x99, 
-0x08, 0x43, 0x03, 0x90, 0x00, 0x2f, 0x02, 0xd1, 0x03, 0x98, 0xc0, 0x46, 
-0x70, 0x60, 0x01, 0x9b, 0x03, 0x9a, 0x02, 0x99, 0x04, 0x98, 0xff, 0xf7, 
-0x89, 0xff, 0x00, 0x28, 0x06, 0xd0, 0x02, 0x99, 0xc0, 0x46, 0xb1, 0x60, 
-0x03, 0x99, 0xc0, 0x46, 0x71, 0x60, 0x5c, 0xe0, 0x79, 0x1c, 0x0f, 0x04, 
-0x3f, 0x0c, 0x17, 0x2f, 0xd1, 0xdd, 0x61, 0x1c, 0x0c, 0x04, 0x24, 0x0c, 
-0x16, 0x2c, 0xca, 0xdd, 0x06, 0x99, 0x01, 0x31, 0x06, 0x91, 0x06, 0x99, 
-0x89, 0x00, 0x37, 0x4a, 0x51, 0x58, 0x00, 0x29, 0xb7, 0xd1, 0x48, 0xe0, 
-0xbf, 0x21, 0xc9, 0x43, 0x04, 0x91, 0xff, 0x21, 0x02, 0x91, 0x97, 0x21, 
-0x01, 0x91, 0x06, 0x94, 0x06, 0x99, 0x89, 0x00, 0x31, 0x4f, 0x79, 0x58, 
-0x00, 0x29, 0x1c, 0xd0, 0x09, 0x94, 0x08, 0x94, 0x06, 0x98, 0x80, 0x00, 
-0x38, 0x58, 0xc0, 0x46, 0x07, 0x90, 0x07, 0x98, 0x00, 0x04, 0x26, 0xe0, 
-0x05, 0x98, 0x15, 0x23, 0x1b, 0x06, 0x18, 0x43, 0x03, 0x90, 0x01, 0x9b, 
-0x03, 0x9a, 0x02, 0x99, 0x04, 0x98, 0xff, 0xf7, 0x49, 0xff, 0x00, 0x28, 
-0x23, 0xd1, 0x09, 0x99, 0x01, 0x31, 0x09, 0x91, 0x17, 0x29, 0x06, 0xd8, 
-0x00, 0xe0, 0x1c, 0xe0, 0x08, 0x98, 0x00, 0x02, 0x09, 0x99, 0x08, 0x43, 
-0x07, 0xe0, 0x08, 0x99, 0x01, 0x31, 0x08, 0x91, 0x17, 0x29, 0x0a, 0xd8, 
-0x09, 0x94, 0x08, 0x98, 0x00, 0x02, 0x07, 0x99, 0x09, 0x04, 0x08, 0x43, 
-0x15, 0x23, 0x1b, 0x06, 0x18, 0x43, 0x05, 0x90, 0xd6, 0xe7, 0x06, 0x99, 
-0x01, 0x31, 0x06, 0x91, 0x06, 0x99, 0x89, 0x00, 0x79, 0x58, 0x00, 0x29, 
-0xc4, 0xd1, 0x0c, 0x4a, 0x11, 0x68, 0x49, 0x0c, 0x05, 0xd2, 0x11, 0x68, 
-0x09, 0x0c, 0x06, 0xd1, 0x11, 0x68, 0x89, 0x0a, 0x03, 0xd3, 0x00, 0x99, 
-0xc0, 0x46, 0xf1, 0x60, 0x03, 0xe0, 0x00, 0x99, 0x06, 0x4a, 0xc0, 0x46, 
-0x11, 0x64, 0x0a, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0x40, 0x01, 0x18, 0x40, 0x00, 0x00, 0x10, 0x40, 0x40, 0x01, 0x18, 0x00, 
-0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x18, 0x40, 0x30, 0x6e, 0x21, 0x40, 
-0x43, 0xff, 0x00, 0x00, 0x0c, 0x6e, 0x21, 0x40, 0x80, 0xb5, 0x82, 0xb0, 
-0x00, 0x20, 0x01, 0x90, 0x1e, 0x48, 0xc1, 0x68, 0x01, 0x29, 0x1b, 0xd1, 
-0x40, 0x88, 0x00, 0x28, 0x18, 0xd1, 0x68, 0x46, 0x01, 0xf0, 0x9a, 0xfe, 
-0x00, 0x28, 0x13, 0xd1, 0xa8, 0x20, 0x01, 0xf0, 
-0xdb, 0xfe, 0x18, 0x4f, 0x00, 0x28, 0x11, 0xd0, 0x04, 0x20, 0xff, 0xf7, 
-0x97, 0xfe, 0x78, 0x6b, 0xc0, 0x46, 0x01, 0x90, 0x01, 0x98, 0x80, 0x07, 
-0x80, 0x0f, 0x03, 0x28, 0x06, 0xd1, 0x00, 0x20, 0x01, 0xf0, 0xca, 0xfe, 
-0x02, 0xb0, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x23, 0x00, 0x22, 
-0x00, 0x21, 0x00, 0x20, 0xff, 0xf7, 0x8f, 0xfe, 0x00, 0x23, 0xdb, 0x43, 
-0x18, 0x1c, 0x19, 0x1c, 0x1a, 0x1c, 0xff, 0xf7, 0xc7, 0xfe, 0x00, 0x28, 
-0x03, 0xd1, 0xff, 0xf7, 0xdf, 0xfe, 0x00, 0x28, 0xe5, 0xd0, 0x38, 0x6a, 
-0x79, 0x6a, 0xba, 0x6a, 0xfb, 0x6a, 0xff, 0xf7, 0x7c, 0xfe, 0xde, 0xe7, 
-0x68, 0x0e, 0x00, 0x80, 0x00, 0x00, 0x11, 0x40, 0xff, 0xb5, 0x85, 0xb0, 
-0x14, 0x1c, 0x1f, 0x1c, 0x00, 0x20, 0x01, 0x90, 0x01, 0x23, 0x5b, 0x04, 
-0x9f, 0x42, 0x01, 0xd9, 0x0f, 0x20, 0x82, 0xe0, 0x26, 0x1c, 0x43, 0x4d, 
-0xaf, 0x42, 0x00, 0xd2, 0x3d, 0x1c, 0x21, 0x0d, 0x09, 0x05, 0x41, 0x48, 
-0x41, 0x4b, 0x99, 0x42, 0x04, 0xd0, 0x80, 0x25, 0x06, 0x1c, 0x80, 0x2f, 
-0x00, 0xd8, 0x3d, 0x1c, 0x3e, 0x4a, 0x51, 0x69, 0xc0, 0x46, 0x03, 0x91, 
-0x92, 0x69, 0xc0, 0x46, 0x02, 0x92, 0xff, 0x23, 0x01, 0x33, 0x19, 0x43, 
-0x39, 0x4b, 0xc0, 0x46, 0x59, 0x61, 0xff, 0x23, 0x01, 0x33, 0x9a, 0x43, 
-0x36, 0x4b, 0xc0, 0x46, 0x9a, 0x61, 0x01, 0x22, 0x12, 0x05, 0xd1, 0x60, 
-0x33, 0x4a, 0x91, 0x69, 0x01, 0x22, 0x12, 0x05, 0x11, 0x61, 0x31, 0x4a, 
-0xff, 0x23, 0x01, 0x33, 0x91, 0x69, 0x19, 0x43, 0x91, 0x61, 0x01, 0x22, 
-0x12, 0x05, 0x11, 0x61, 0x85, 0x21, 0x89, 0x04, 0x04, 0x91, 0x00, 0x2f, 
-0x34, 0xd0, 0x28, 0x48, 0x86, 0x42, 0x04, 0xd1, 0x30, 0x1c, 0x21, 0x1c, 
-0x2a, 0x1c, 0x03, 0xf0, 0x4f, 0xff, 0x2a, 0x1c, 0x04, 0x98, 0x02, 0x43, 
-0x00, 0x92, 0x01, 0x20, 0x06, 0x99, 0x05, 0x9a, 0x33, 0x1c, 0xfd, 0xf7, 
-0xbd, 0xfd, 0x22, 0x48, 0x22, 0x49, 0x4a, 0x68, 0x52, 0x0a, 0x09, 0xd3, 
-0xff, 0x21, 0x01, 0x31, 0x20, 0x4a, 0xc0, 0x46, 0x11, 0x60, 0x00, 0x28, 
-0x05, 0xd1, 0x11, 0x20, 0x01, 0x90, 0x13, 0xe0, 0x01, 0x38, 0xf0, 0xd1, 
-0xf9, 0xe7, 0x7f, 0x1b, 0x0e, 0xd0, 0x15, 0x48, 0x86, 0x42, 0x01, 0xd1, 
-0x64, 0x19, 0x00, 0xe0, 0x76, 0x19, 0x06, 0x99, 0x49, 0x19, 0x06, 0x91, 
-0x38, 0x1c, 0xaf, 0x42, 0x00, 0xd3, 0x28, 0x1c, 0x05, 0x1c, 0xca, 0xe7, 
-0x0f, 0x48, 0x41, 0x69, 0x03, 0x9b, 0x19, 0x43, 0x41, 0x61, 0x82, 0x69, 
-0x03, 0x9b, 0x9a, 0x43, 0x82, 0x61, 0x01, 0x22, 0x12, 0x05, 0xd1, 0x60, 
-0x81, 0x69, 0xc0, 0x46, 0x11, 0x61, 0x81, 0x69, 0x02, 0x9b, 0x19, 0x43, 
-0x81, 0x61, 0x11, 0x61, 0x01, 0x98, 0x09, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0xf0, 0xff, 0x00, 0x00, 0x50, 0xab, 0x20, 0x40, 
-0x00, 0x00, 0x20, 0x40, 0x68, 0x0e, 0x00, 0x80, 0xff, 0xff, 0x00, 0x00, 
-0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x00, 0xb0, 0xff, 0xb5, 0x85, 0xb0, 
-0x04, 0x1c, 0x1f, 0x1c, 0x00, 0x20, 0x01, 0x90, 0x01, 0x23, 0x5b, 0x04, 
-0x9f, 0x42, 0x01, 0xd9, 0x0f, 0x20, 0x7d, 0xe0, 0x26, 0x1c, 0x40, 0x4d, 
-0xaf, 0x42, 0x00, 0xd2, 0x3d, 0x1c, 0x21, 0x0d, 0x09, 0x05, 0x3e, 0x48, 
-0x3e, 0x4b, 0x99, 0x42, 0x04, 0xd0, 0x80, 0x25, 0x06, 0x1c, 0x80, 0x2f, 
-0x00, 0xd8, 0x3d, 0x1c, 0x3b, 0x4a, 0x51, 0x69, 0xc0, 0x46, 0x03, 0x91, 
-0x92, 0x69, 0xc0, 0x46, 0x02, 0x92, 0x10, 0x23, 0x19, 0x43, 0x37, 0x4b, 
-0xc0, 0x46, 0x59, 0x61, 0x10, 0x23, 0x9a, 0x43, 
-0x34, 0x4b, 0xc0, 0x46, 0x9a, 0x61, 0x01, 0x22, 0x12, 0x05, 0xd1, 0x60, 
-0x31, 0x4a, 0x91, 0x69, 0x01, 0x22, 0x12, 0x05, 0x11, 0x61, 0x2f, 0x4a, 
-0x10, 0x23, 0x91, 0x69, 0x19, 0x43, 0x91, 0x61, 0x1a, 0x04, 0x11, 0x61, 
-0x21, 0x21, 0x09, 0x05, 0x04, 0x91, 0x00, 0x2f, 0x33, 0xd0, 0x2a, 0x1c, 
-0x04, 0x98, 0x02, 0x43, 0x00, 0x92, 0x00, 0x20, 0x06, 0x99, 0x07, 0x9a, 
-0x33, 0x1c, 0xfd, 0xf7, 0x27, 0xfd, 0x25, 0x48, 0x25, 0x49, 0x4a, 0x68, 
-0x52, 0x09, 0x08, 0xd3, 0x10, 0x21, 0x24, 0x4a, 0xc0, 0x46, 0x11, 0x60, 
-0x00, 0x28, 0x05, 0xd1, 0x11, 0x20, 0x01, 0x90, 0x1b, 0xe0, 0x01, 0x38, 
-0xf1, 0xd1, 0xf9, 0xe7, 0x19, 0x48, 0x86, 0x42, 0x04, 0xd1, 0x20, 0x1c, 
-0x31, 0x1c, 0x2a, 0x1c, 0x03, 0xf0, 0x96, 0xfe, 0x7f, 0x1b, 0x0e, 0xd0, 
-0x14, 0x48, 0x86, 0x42, 0x01, 0xd0, 0x76, 0x19, 0x00, 0xe0, 0x64, 0x19, 
-0x06, 0x99, 0x49, 0x19, 0x06, 0x91, 0x38, 0x1c, 0xaf, 0x42, 0x00, 0xd3, 
-0x28, 0x1c, 0x05, 0x1c, 0xcb, 0xe7, 0x0f, 0x48, 0x41, 0x69, 0x03, 0x9b, 
-0x19, 0x43, 0x41, 0x61, 0x82, 0x69, 0x03, 0x9b, 0x9a, 0x43, 0x82, 0x61, 
-0x01, 0x22, 0x12, 0x05, 0xd1, 0x60, 0x81, 0x69, 0xc0, 0x46, 0x11, 0x61, 
-0x81, 0x69, 0x02, 0x9b, 0x19, 0x43, 0x81, 0x61, 0x11, 0x61, 0x01, 0x98, 
-0x09, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xf0, 0xff, 0x00, 0x00, 
-0x50, 0xab, 0x20, 0x40, 0x00, 0x00, 0x20, 0x40, 0x68, 0x0e, 0x00, 0x80, 
-0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x00, 0xb0, 
 0x70, 0x47, 0x04, 0x49, 0x00, 0x20, 0x00, 0x22, 0x0a, 0x70, 0x01, 0x30, 
 0x01, 0x31, 0x68, 0x28, 0xfa, 0xd3, 0x70, 0x47, 0xa0, 0x82, 0x20, 0x40, 
 0x00, 0x22, 0x88, 0x42, 0x03, 0xd3, 0x40, 0x1a, 0x01, 0x32, 0x88, 0x42, 
@@ -2987,7 +2639,7 @@
 0xc0, 0x46, 0x93, 0x60, 0x0b, 0x69, 0xc0, 0x46, 0x13, 0x61, 0x4b, 0x69, 
 0xc0, 0x46, 0x53, 0x61, 0xc9, 0x68, 0xc0, 0x46, 0xd1, 0x60, 0x90, 0xbc, 
 0x70, 0x47, 0x01, 0x30, 0x00, 0x06, 0x00, 0x0e, 0x04, 0x28, 0xd9, 0xdb, 
-0x38, 0x1c, 0xf6, 0xe7, 0xd0, 0xab, 0x20, 0x40, 0xf7, 0xb5, 0xc4, 0xb0, 
+0x38, 0x1c, 0xf6, 0xe7, 0x40, 0xab, 0x20, 0x40, 0xf7, 0xb5, 0xc4, 0xb0, 
 0x04, 0x1c, 0x00, 0x20, 0x46, 0x9a, 0x11, 0x21, 0x11, 0x40, 0x6e, 0xd0, 
 0x00, 0x27, 0x79, 0x00, 0xc9, 0x19, 0xc9, 0x00, 0x57, 0x4a, 0x51, 0x58, 
 0x49, 0x0c, 0x03, 0xd2, 0x01, 0x30, 0x00, 0x06, 0x00, 0x0e, 0x04, 0xe0, 
@@ -2998,12 +2650,12 @@
 0x72, 0x1c, 0x16, 0x06, 0x36, 0x0e, 0x04, 0xe0, 0x01, 0x30, 0x00, 0x06, 
 0x00, 0x0e, 0x10, 0x28, 0xf0, 0xdb, 0x00, 0x2e, 0x3d, 0xd0, 0x04, 0x2c, 
 0x3e, 0xd1, 0x80, 0x00, 0x08, 0x58, 0x40, 0x01, 0x80, 0x0d, 0x00, 0x22, 
-0x00, 0x92, 0x10, 0x23, 0x00, 0x21, 0x02, 0xaa, 
-0x00, 0xf0, 0x68, 0xfa, 0x00, 0x21, 0x01, 0x91, 0x02, 0xa8, 0x05, 0x99, 
-0x49, 0x0c, 0x89, 0x05, 0x29, 0xd0, 0xc1, 0x68, 0x0a, 0x06, 0x12, 0x0e, 
-0x45, 0x9b, 0x9a, 0x42, 0x11, 0xd1, 0xc0, 0x68, 0x40, 0x01, 0x86, 0x0d, 
-0x00, 0x22, 0x00, 0x92, 0x0c, 0x23, 0x00, 0x21, 0x30, 0x1c, 0x02, 0xaa, 
-0x00, 0xf0, 0x50, 0xfa, 0x01, 0x99, 0x02, 0x9d, 0x48, 0x1c, 0x01, 0x06, 
+0x00, 0x92, 0x10, 0x23, 0x00, 0x21, 0x02, 0xaa, 0x00, 0xf0, 0x68, 0xfa, 
+0x00, 0x21, 0x01, 0x91, 0x02, 0xa8, 0x05, 0x99, 0x49, 0x0c, 0x89, 0x05, 
+0x29, 0xd0, 0xc1, 0x68, 0x0a, 0x06, 0x12, 0x0e, 0x45, 0x9b, 0x9a, 0x42, 
+0x11, 0xd1, 0xc0, 0x68, 0x40, 0x01, 0x86, 0x0d, 0x00, 0x22, 0x00, 0x92, 
+0x0c, 0x23, 0x00, 0x21, 0x30, 0x1c, 0x02, 0xaa, 0x00, 0xf0, 0x50, 0xfa, 
+0x01, 0x99, 0x02, 0x9d, 0x48, 0x1c, 0x01, 0x06, 
 0x09, 0x0e, 0x01, 0x91, 0x0e, 0xe0, 0x48, 0x01, 0x86, 0x0d, 0x00, 0x22, 
 0x00, 0x92, 0x10, 0x23, 0x00, 0x21, 0x30, 0x1c, 0x02, 0xaa, 0x00, 0xf0, 
 0x3f, 0xfa, 0x02, 0xa8, 0x05, 0x99, 0x49, 0x0c, 0x89, 0x05, 0xd8, 0xd1, 
@@ -3019,7 +2671,7 @@
 0x18, 0x18, 0xc0, 0x00, 0x00, 0x1b, 0x70, 0x61, 0x00, 0x20, 0x50, 0x21, 
 0x46, 0x9a, 0x11, 0x40, 0x50, 0x29, 0x00, 0xd1, 0x28, 0x1c, 0xf0, 0x60, 
 0x38, 0x1c, 0x47, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xff, 0x20, 
-0xf9, 0xe7, 0x00, 0x00, 0xd0, 0xab, 0x20, 0x40, 0x80, 0xb4, 0x00, 0x23, 
+0xf9, 0xe7, 0x00, 0x00, 0x40, 0xab, 0x20, 0x40, 0x80, 0xb4, 0x00, 0x23, 
 0x00, 0x22, 0x00, 0x29, 0x06, 0xd9, 0x87, 0x5c, 0x7b, 0x40, 0x1b, 0x06, 
 0x1b, 0x0e, 0x01, 0x32, 0x8a, 0x42, 0xf8, 0xd3, 0xd8, 0x43, 0x00, 0x06, 
 0x00, 0x0e, 0x80, 0xbc, 0x70, 0x47, 0xf0, 0xb5, 0xc6, 0xb0, 0x04, 0x28, 
@@ -3041,12 +2693,12 @@
 0x05, 0x98, 0x00, 0x0a, 0x00, 0x02, 0x39, 0x06, 0x09, 0x0e, 0x08, 0x43, 
 0x05, 0x90, 0xff, 0x23, 0x1b, 0x02, 0x98, 0x43, 0x05, 0x90, 0x0c, 0x21, 
 0x03, 0xa8, 0xff, 0xf7, 0x83, 0xff, 0xff, 0x23, 0x1b, 0x02, 0x05, 0x99, 
-0x99, 0x43, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x02, 
-0x08, 0x43, 0x05, 0x90, 0x0c, 0x23, 0x00, 0x21, 0x60, 0x68, 0x03, 0xaa, 
-0x00, 0xf0, 0xca, 0xf9, 0x00, 0x20, 0x45, 0x99, 0x06, 0x4a, 0xc0, 0x46, 
-0x50, 0x50, 0xc1, 0x43, 0x61, 0x60, 0xa1, 0x60, 0xe1, 0x60, 0x21, 0x61, 
-0x61, 0x61, 0x46, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0xd0, 0xab, 0x20, 0x40, 0xb0, 0xb4, 0x4c, 0x42, 0x00, 0x29, 0x00, 0xdb, 
+0x99, 0x43, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x02, 0x08, 0x43, 0x05, 0x90, 
+0x0c, 0x23, 0x00, 0x21, 0x60, 0x68, 0x03, 0xaa, 0x00, 0xf0, 0xca, 0xf9, 
+0x00, 0x20, 0x45, 0x99, 0x06, 0x4a, 0xc0, 0x46, 0x50, 0x50, 0xc1, 0x43, 
+0x61, 0x60, 0xa1, 0x60, 0xe1, 0x60, 0x21, 0x61, 0x61, 0x61, 0x46, 0xb0, 
+0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x40, 0xab, 0x20, 0x40, 
+0xb0, 0xb4, 0x4c, 0x42, 0x00, 0x29, 0x00, 0xdb, 
 0x0c, 0x1c, 0x00, 0x27, 0xff, 0x43, 0x04, 0x28, 0x21, 0xda, 0x12, 0x4d, 
 0x43, 0x00, 0x18, 0x18, 0xc0, 0x00, 0x40, 0x19, 0x01, 0x2a, 0x05, 0xd0, 
 0x02, 0x2a, 0x09, 0xd0, 0x03, 0x2a, 0x16, 0xd1, 0x01, 0x69, 0x0b, 0xe0, 
@@ -3054,7 +2706,7 @@
 0x00, 0x29, 0x07, 0xda, 0xc1, 0x68, 0xa1, 0x42, 0x09, 0xd3, 0x09, 0x1b, 
 0xc1, 0x60, 0xc0, 0x68, 0xb0, 0xbc, 0x70, 0x47, 0xc1, 0x68, 0x09, 0x19, 
 0x02, 0x69, 0x91, 0x42, 0xf6, 0xd9, 0x38, 0x1c, 0xf6, 0xe7, 0x00, 0x00, 
-0xd0, 0xab, 0x20, 0x40, 0xf0, 0xb5, 0x84, 0xb0, 0x17, 0x1c, 0x0d, 0x1c, 
+0x40, 0xab, 0x20, 0x40, 0xf0, 0xb5, 0x84, 0xb0, 0x17, 0x1c, 0x0d, 0x1c, 
 0x00, 0x21, 0x02, 0x91, 0x42, 0x00, 0x12, 0x18, 0xd2, 0x00, 0x2c, 0x49, 
 0x8b, 0x58, 0x1b, 0x06, 0x1b, 0x0e, 0x01, 0x93, 0x00, 0x23, 0xdb, 0x43, 
 0x04, 0x28, 0x02, 0xda, 0x01, 0x98, 0x40, 0x08, 0x01, 0xd2, 0x18, 0x1c, 
@@ -3070,7 +2722,7 @@
 0x00, 0x92, 0x01, 0x1c, 0x30, 0x1c, 0x2a, 0x1c, 0x3b, 0x1c, 0x00, 0xf0, 
 0xcd, 0xf8, 0xe0, 0x68, 0xc0, 0x19, 0xed, 0x19, 0xe0, 0x60, 0x02, 0x98, 
 0xc0, 0x19, 0x02, 0x90, 0x00, 0x27, 0x00, 0x2f, 0xc2, 0xd8, 0x02, 0x98, 
-0x04, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xd0, 0xab, 0x20, 0x40, 
+0x04, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x40, 0xab, 0x20, 0x40, 
 0xf0, 0xb5, 0x83, 0xb0, 0x17, 0x1c, 0x0d, 0x1c, 0x00, 0x21, 0x01, 0x91, 
 0x42, 0x00, 0x12, 0x18, 0xd2, 0x00, 0x02, 0x92, 0x30, 0x49, 0x8a, 0x58, 
 0x12, 0x06, 0x12, 0x0e, 0x00, 0x24, 0xe4, 0x43, 0x04, 0x28, 0x01, 0xda, 
@@ -3084,12 +2736,12 @@
 0x91, 0x42, 0x13, 0xd9, 0x13, 0x1a, 0x01, 0x1c, 0x00, 0x98, 0x2a, 0x1c, 
 0x1e, 0x1c, 0x00, 0xf0, 0xdf, 0xf8, 0xe0, 0x68, 0x80, 0x19, 0x75, 0x19, 
 0xe0, 0x60, 0x21, 0x69, 0x88, 0x42, 0x00, 0xd9, 0x20, 0x61, 0xbf, 0x1b, 
-0x01, 0x98, 0x30, 0x18, 0x01, 0x90, 0x12, 0xe0, 
-0x01, 0x1c, 0x00, 0x9e, 0x30, 0x1c, 0x2a, 0x1c, 0x3b, 0x1c, 0x00, 0xf0, 
-0xcb, 0xf8, 0xe0, 0x68, 0xc0, 0x19, 0xed, 0x19, 0xe0, 0x60, 0x21, 0x69, 
-0x88, 0x42, 0x00, 0xd9, 0x20, 0x61, 0x01, 0x98, 0xc0, 0x19, 0x01, 0x90, 
-0x00, 0x27, 0x00, 0x2f, 0xb9, 0xd8, 0x01, 0x98, 0x03, 0xb0, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0xd0, 0xab, 0x20, 0x40, 0xb0, 0xb5, 0xc3, 0xb0, 
+0x01, 0x98, 0x30, 0x18, 0x01, 0x90, 0x12, 0xe0, 0x01, 0x1c, 0x00, 0x9e, 
+0x30, 0x1c, 0x2a, 0x1c, 0x3b, 0x1c, 0x00, 0xf0, 0xcb, 0xf8, 0xe0, 0x68, 
+0xc0, 0x19, 0xed, 0x19, 0xe0, 0x60, 0x21, 0x69, 0x88, 0x42, 0x00, 0xd9, 
+0x20, 0x61, 0x01, 0x98, 0xc0, 0x19, 0x01, 0x90, 0x00, 0x27, 0x00, 0x2f, 
+0xb9, 0xd8, 0x01, 0x98, 0x03, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 
+0x40, 0xab, 0x20, 0x40, 0xb0, 0xb5, 0xc3, 0xb0, 
 0x0c, 0x1c, 0x00, 0x27, 0xfa, 0x43, 0x04, 0x28, 0x06, 0xda, 0x41, 0x00, 
 0x09, 0x18, 0xc9, 0x00, 0x14, 0x48, 0x45, 0x58, 0x6b, 0x0c, 0x04, 0xd2, 
 0x10, 0x1c, 0x43, 0xb0, 0xb0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x62, 0x09, 
@@ -3098,222 +2750,222 @@
 0x12, 0x2c, 0x0d, 0xd0, 0x13, 0x2c, 0x05, 0xd0, 0x14, 0x2c, 0x0a, 0xd1, 
 0x03, 0x98, 0x00, 0x04, 0x07, 0x0e, 0x06, 0xe0, 0x03, 0x98, 0x07, 0x06, 
 0x3f, 0x0e, 0x02, 0xe0, 0x01, 0x9f, 0x00, 0xe0, 0x02, 0x9f, 0x38, 0x1c, 
-0xdb, 0xe7, 0x00, 0x00, 0xd0, 0xab, 0x20, 0x40, 0x03, 0x49, 0x00, 0x20, 
+0xdb, 0xe7, 0x00, 0x00, 0x40, 0xab, 0x20, 0x40, 0x03, 0x49, 0x00, 0x20, 
 0x00, 0x22, 0x0a, 0x54, 0x01, 0x30, 0x60, 0x28, 0xfb, 0xd3, 0x70, 0x47, 
-0xd0, 0xab, 0x20, 0x40, 0x00, 0xb5, 0x02, 0xf0, 0x01, 0xfa, 0x57, 0x20, 
-0x02, 0xf0, 0x5e, 0xf9, 0x02, 0xf0, 0xd2, 0xf8, 0x00, 0x0a, 0xfb, 0xd3, 
-0x02, 0xf0, 0xe0, 0xf9, 0x08, 0xbc, 0x18, 0x47, 0xf0, 0xb5, 0x82, 0xb0, 
+0x40, 0xab, 0x20, 0x40, 0x00, 0xb5, 0x02, 0xf0, 0x6f, 0xfa, 0x57, 0x20, 
+0x02, 0xf0, 0xcc, 0xf9, 0x02, 0xf0, 0x40, 0xf9, 0x00, 0x0a, 0xfb, 0xd3, 
+0x02, 0xf0, 0x4e, 0xfa, 0x08, 0xbc, 0x18, 0x47, 0xf0, 0xb5, 0x82, 0xb0, 
 0x07, 0x9d, 0x14, 0x1c, 0x1f, 0x1c, 0x30, 0x4a, 0xd2, 0x6f, 0x20, 0x23, 
 0x16, 0x68, 0x9e, 0x43, 0x16, 0x60, 0x33, 0x1c, 0xff, 0x22, 0x01, 0x32, 
 0x2a, 0x40, 0x40, 0x02, 0x08, 0x43, 0x05, 0x0a, 0x06, 0x1c, 0x00, 0x0c, 
-0x01, 0x90, 0x00, 0x2a, 0x20, 0xd0, 0x02, 0xf0, 0xdd, 0xf9, 0x53, 0x20, 
-0x02, 0xf0, 0x3a, 0xf9, 0x01, 0x98, 0xc0, 0x46, 0x00, 0x90, 0x02, 0xf0, 
-0x35, 0xf9, 0x28, 0x1c, 0x02, 0xf0, 0x32, 0xf9, 0x30, 0x1c, 0x02, 0xf0, 
-0x2f, 0xf9, 0x02, 0xf0, 0xb5, 0xf9, 0xff, 0xf7, 0xc7, 0xff, 0x02, 0xf0, 
-0xc9, 0xf9, 0x54, 0x20, 0x02, 0xf0, 0x26, 0xf9, 0x00, 0x98, 0x02, 0xf0, 
-0x23, 0xf9, 0x28, 0x1c, 0x02, 0xf0, 0x20, 0xf9, 0x30, 0x1c, 0x14, 0xe0, 
-0x02, 0xf0, 0xbc, 0xf9, 0x52, 0x20, 0x02, 0xf0, 0x19, 0xf9, 0x01, 0x98, 
-0x02, 0xf0, 0x16, 0xf9, 0x28, 0x1c, 0x02, 0xf0, 0x13, 0xf9, 0x30, 0x1c, 
-0x02, 0xf0, 0x10, 0xf9, 0x00, 0x20, 0x02, 0xf0, 0x0d, 0xf9, 0x00, 0x20, 
-0x02, 0xf0, 0x0a, 0xf9, 0x00, 0x20, 0x02, 0xf0, 0x07, 0xf9, 0x00, 0x20, 
-0x02, 0xf0, 0x04, 0xf9, 0x00, 0x2f, 0x05, 0xd9, 0x02, 0xf0, 0x76, 0xf8, 
-0x20, 0x70, 0x01, 0x34, 0x01, 0x3f, 0xf9, 0xd1, 0x02, 0xf0, 0x82, 0xf9, 
+0x01, 0x90, 0x00, 0x2a, 0x20, 0xd0, 0x02, 0xf0, 0x4b, 0xfa, 0x53, 0x20, 
+0x02, 0xf0, 0xa8, 0xf9, 0x01, 0x98, 0xc0, 0x46, 0x00, 0x90, 0x02, 0xf0, 
+0xa3, 0xf9, 0x28, 0x1c, 0x02, 0xf0, 0xa0, 0xf9, 0x30, 0x1c, 0x02, 0xf0, 
+0x9d, 0xf9, 0x02, 0xf0, 0x23, 0xfa, 0xff, 0xf7, 0xc7, 0xff, 0x02, 0xf0, 
+0x37, 0xfa, 0x54, 0x20, 0x02, 0xf0, 0x94, 0xf9, 0x00, 0x98, 0x02, 0xf0, 
+0x91, 0xf9, 0x28, 0x1c, 0x02, 0xf0, 0x8e, 0xf9, 0x30, 0x1c, 0x14, 0xe0, 
+0x02, 0xf0, 0x2a, 0xfa, 0x52, 0x20, 0x02, 0xf0, 0x87, 0xf9, 0x01, 0x98, 
+0x02, 0xf0, 0x84, 0xf9, 0x28, 0x1c, 0x02, 0xf0, 0x81, 0xf9, 0x30, 0x1c, 
+0x02, 0xf0, 0x7e, 0xf9, 0x00, 0x20, 0x02, 0xf0, 0x7b, 0xf9, 0x00, 0x20, 
+0x02, 0xf0, 0x78, 0xf9, 0x00, 0x20, 0x02, 0xf0, 0x75, 0xf9, 0x00, 0x20, 
+0x02, 0xf0, 0x72, 0xf9, 0x00, 0x2f, 0x05, 0xd9, 0x02, 0xf0, 0xe4, 0xf8, 
+0x20, 0x70, 0x01, 0x34, 0x01, 0x3f, 0xf9, 0xd1, 0x02, 0xf0, 0xf0, 0xf9, 
 0x04, 0x4a, 0xd0, 0x6f, 0x20, 0x23, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 
 0x02, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 
-0xf0, 0xb5, 0x82, 0xb0, 0x14, 0x1c, 0x1f, 0x1c, 0x40, 0x02, 0x08, 0x43, 
-0x05, 0x1c, 0x2c, 0x49, 0xc8, 0x6f, 0x20, 0x23, 0x02, 0x68, 0x9a, 0x43, 
-0x02, 0x60, 0xc8, 0x6f, 0x40, 0x23, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 
-0x02, 0xf0, 0x7a, 0xf9, 0x53, 0x20, 0x02, 0xf0, 0xd7, 0xf8, 0x28, 0x0c, 
-0x06, 0x1c, 0x02, 0xf0, 0xd3, 0xf8, 0x28, 0x0a, 0x01, 0x90, 0x00, 0x90, 
-0x02, 0xf0, 0xce, 0xf8, 0x28, 0x1c, 0x02, 0xf0, 0xcb, 0xf8, 0x02, 0xf0, 
-0x51, 0xf9, 0xff, 0xf7, 0x63, 0xff, 0x02, 0xf0, 0x65, 0xf9, 0x84, 0x20, 
-0x02, 0xf0, 0xc2, 0xf8, 0x30, 0x1c, 0x02, 0xf0, 
-0xbf, 0xf8, 0x00, 0x98, 0x02, 0xf0, 0xbc, 0xf8, 0x28, 0x1c, 0x02, 0xf0, 
-0xb9, 0xf8, 0x00, 0x2f, 0x05, 0xd9, 0x20, 0x78, 0x01, 0x34, 0x02, 0xf0, 
-0xb3, 0xf8, 0x01, 0x3f, 0xf9, 0xd1, 0x02, 0xf0, 0x37, 0xf9, 0x02, 0xf0, 
-0x4d, 0xf9, 0x83, 0x20, 0x02, 0xf0, 0xaa, 0xf8, 0x30, 0x1c, 0x02, 0xf0, 
-0xa7, 0xf8, 0x01, 0x98, 0x02, 0xf0, 0xa4, 0xf8, 0x28, 0x1c, 0x02, 0xf0, 
-0xa1, 0xf8, 0x02, 0xf0, 0x27, 0xf9, 0xff, 0xf7, 0x39, 0xff, 0x07, 0x49, 
-0xc8, 0x6f, 0x40, 0x23, 0x02, 0x68, 0x9a, 0x43, 0x02, 0x60, 0xc8, 0x6f, 
-0x20, 0x23, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 0x02, 0xb0, 0xf0, 0xbc, 
-0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 0x70, 0x47, 0x00, 0x00, 
-0x80, 0xb5, 0x01, 0xf0, 0x91, 0xf8, 0x06, 0x4f, 0xc0, 0x46, 0xf8, 0x60, 
-0x01, 0xf0, 0xf4, 0xf8, 0x78, 0x80, 0x01, 0xf0, 0xb3, 0xf8, 0x38, 0x71, 
-0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 
-0x00, 0xb5, 0x01, 0xf0, 0x07, 0xf9, 0x02, 0x49, 0xc0, 0x46, 0x08, 0x80, 
-0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 0x0b, 0x48, 0xc1, 0x68, 
-0x01, 0x29, 0x11, 0xd1, 0xc1, 0x6f, 0x02, 0x23, 0x0a, 0x68, 0x1a, 0x43, 
-0x0a, 0x60, 0xc1, 0x6f, 0x80, 0x23, 0x0a, 0x68, 0x1a, 0x43, 0x0a, 0x60, 
-0xc1, 0x18, 0x08, 0x68, 0x82, 0x23, 0x02, 0x68, 0x1a, 0x43, 0x02, 0x60, 
-0x00, 0x20, 0x08, 0x81, 0x70, 0x47, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 
-0xf0, 0xb4, 0x4a, 0x49, 0xca, 0x1d, 0x9d, 0x32, 0x00, 0x20, 0x00, 0x27, 
-0x83, 0x00, 0xd7, 0x50, 0x01, 0x30, 0x17, 0x28, 0xfa, 0xd3, 0x46, 0x4c, 
-0x00, 0x20, 0x82, 0x00, 0xa7, 0x50, 0x01, 0x30, 0x20, 0x28, 0xfa, 0xd3, 
-0x43, 0x4a, 0x00, 0x20, 0x83, 0x00, 0xd7, 0x50, 0x01, 0x30, 0x20, 0x28, 
-0xfa, 0xd3, 0xa7, 0x61, 0x97, 0x61, 0x4f, 0x65, 0x8f, 0x65, 0x3f, 0x4d, 
-0xc0, 0x46, 0x2f, 0x60, 0x6f, 0x60, 0xaf, 0x60, 0xaf, 0x61, 0xef, 0x60, 
-0x2f, 0x61, 0x6f, 0x61, 0x00, 0x20, 0xc1, 0x00, 0x09, 0x18, 0x49, 0x01, 
-0x35, 0x4b, 0xc9, 0x18, 0x86, 0x00, 0xcb, 0x1d, 0xf9, 0x33, 0x34, 0x4c, 
-0x34, 0x19, 0xe3, 0x63, 0x11, 0x23, 0x5b, 0x01, 0xcb, 0x18, 0x63, 0x63, 
-0x0d, 0x23, 0x9b, 0x01, 0xcb, 0x18, 0xb4, 0x18, 0xe3, 0x63, 0x23, 0x23, 
-0x5b, 0x01, 0xc9, 0x18, 0x61, 0x63, 0x01, 0x30, 0x02, 0x28, 0xe4, 0xdb, 
-0x29, 0x48, 0xc1, 0x1d, 0xf9, 0x31, 0x29, 0x4c, 0xc0, 0x46, 0xa1, 0x62, 
-0x61, 0x6b, 0x0d, 0x23, 0x9b, 0x01, 0xe1, 0x62, 0xc1, 0x18, 0x91, 0x62, 
-0x51, 0x6b, 0xc0, 0x46, 0xd1, 0x62, 0x08, 0x21, 0xe1, 0x64, 0x25, 0x49, 
-0xc0, 0x46, 0x21, 0x65, 0x24, 0x49, 0x0b, 0x69, 0xc0, 0x46, 0x63, 0x65, 
-0xc3, 0x1d, 0x4d, 0x33, 0xe3, 0x65, 0x25, 0x66, 0x8b, 0x68, 0xc0, 0x46, 
-0x63, 0x66, 0xcb, 0x68, 0xc0, 0x46, 0xa3, 0x66, 0x1e, 0x4b, 0xc0, 0x46, 
-0xe3, 0x66, 0x27, 0x67, 0x0b, 0x23, 0xdb, 0x01, 0xc3, 0x18, 0xa3, 0x67, 
-0x67, 0x67, 0x01, 0x26, 0xe3, 0x1d, 0x69, 0x33, 0x66, 0x61, 0xe7, 0x61, 
-0x1f, 0x73, 0x02, 0x23, 0xd3, 0x64, 0x17, 0x4b, 0xc0, 0x46, 0x13, 0x65, 
-0xcb, 0x69, 0xc0, 0x46, 0x53, 0x65, 0xc3, 0x1d, 0x51, 0x33, 0xd3, 0x65, 
-0x2b, 0x1d, 0x13, 0x66, 0x4b, 0x69, 0xc0, 0x46, 0x53, 0x66, 0x89, 0x69, 
-0xc0, 0x46, 0x91, 0x66, 0x0f, 0x49, 0xc0, 0x46, 0xd1, 0x66, 0x16, 0x67, 
-0x0f, 0x23, 0xdb, 0x01, 0xc0, 0x18, 0x90, 0x67, 0x56, 0x67, 0xd7, 0x61, 
-0xd0, 0x1d, 0x69, 0x30, 0x56, 0x61, 0x07, 0x73, 
+0xf0, 0xb5, 0x82, 0xb0, 0x14, 0x1c, 0x1f, 0x1c, 0x42, 0x02, 0x0a, 0x43, 
+0x15, 0x1c, 0x01, 0x28, 0x54, 0xd0, 0x2c, 0x49, 0xc8, 0x6f, 0x20, 0x23, 
+0x02, 0x68, 0x9a, 0x43, 0x02, 0x60, 0xc8, 0x6f, 0x40, 0x23, 0x01, 0x68, 
+0x19, 0x43, 0x01, 0x60, 0x02, 0xf0, 0xe6, 0xf9, 0x53, 0x20, 0x02, 0xf0, 
+0x43, 0xf9, 0x28, 0x0c, 0x06, 0x1c, 0x02, 0xf0, 0x3f, 0xf9, 0x28, 0x0a, 
+0x01, 0x90, 0x00, 0x90, 0x02, 0xf0, 0x3a, 0xf9, 0x28, 0x1c, 0x02, 0xf0, 
+0x37, 0xf9, 0x02, 0xf0, 0xbd, 0xf9, 0xff, 0xf7, 0x61, 0xff, 0x02, 0xf0, 
+0xd1, 0xf9, 0x84, 0x20, 0x02, 0xf0, 0x2e, 0xf9, 0x30, 0x1c, 0x02, 0xf0, 
+0x2b, 0xf9, 0x00, 0x98, 0x02, 0xf0, 0x28, 0xf9, 0x28, 0x1c, 0x02, 0xf0, 
+0x25, 0xf9, 0x00, 0x2f, 0x05, 0xd9, 0x20, 0x78, 0x01, 0x34, 0x02, 0xf0, 
+0x1f, 0xf9, 0x01, 0x3f, 0xf9, 0xd1, 0x02, 0xf0, 0xa3, 0xf9, 0x02, 0xf0, 
+0xb9, 0xf9, 0x83, 0x20, 0x02, 0xf0, 0x16, 0xf9, 0x30, 0x1c, 0x02, 0xf0, 
+0x13, 0xf9, 0x01, 0x98, 0x02, 0xf0, 0x10, 0xf9, 
+0x28, 0x1c, 0x02, 0xf0, 0x0d, 0xf9, 0x02, 0xf0, 0x93, 0xf9, 0xff, 0xf7, 
+0x37, 0xff, 0x07, 0x49, 0xc8, 0x6f, 0x40, 0x23, 0x02, 0x68, 0x9a, 0x43, 
+0x02, 0x60, 0xc8, 0x6f, 0x20, 0x23, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 
+0x02, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 
+0x70, 0x47, 0x00, 0x00, 0x80, 0xb5, 0x01, 0xf0, 0x8f, 0xf8, 0x06, 0x4f, 
+0xc0, 0x46, 0xf8, 0x60, 0x01, 0xf0, 0xf2, 0xf8, 0x78, 0x80, 0x01, 0xf0, 
+0xb1, 0xf8, 0x38, 0x71, 0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
+0x68, 0x0e, 0x00, 0x80, 0x00, 0xb5, 0x01, 0xf0, 0x05, 0xf9, 0x02, 0x49, 
+0xc0, 0x46, 0x08, 0x80, 0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 
+0x0b, 0x48, 0xc1, 0x68, 0x01, 0x29, 0x11, 0xd1, 0xc1, 0x6f, 0x02, 0x23, 
+0x0a, 0x68, 0x1a, 0x43, 0x0a, 0x60, 0xc1, 0x6f, 0x80, 0x23, 0x0a, 0x68, 
+0x1a, 0x43, 0x0a, 0x60, 0xc1, 0x18, 0x08, 0x68, 0x82, 0x23, 0x02, 0x68, 
+0x1a, 0x43, 0x02, 0x60, 0x00, 0x20, 0x08, 0x81, 0x70, 0x47, 0x00, 0x00, 
+0x68, 0x0e, 0x00, 0x80, 0xf0, 0xb4, 0x4a, 0x49, 0xca, 0x1d, 0x9d, 0x32, 
+0x00, 0x20, 0x00, 0x27, 0x83, 0x00, 0xd7, 0x50, 0x01, 0x30, 0x17, 0x28, 
+0xfa, 0xd3, 0x46, 0x4c, 0x00, 0x20, 0x82, 0x00, 0xa7, 0x50, 0x01, 0x30, 
+0x20, 0x28, 0xfa, 0xd3, 0x43, 0x4a, 0x00, 0x20, 0x83, 0x00, 0xd7, 0x50, 
+0x01, 0x30, 0x20, 0x28, 0xfa, 0xd3, 0xa7, 0x61, 0x97, 0x61, 0x4f, 0x65, 
+0x8f, 0x65, 0x3f, 0x4d, 0xc0, 0x46, 0x2f, 0x60, 0x6f, 0x60, 0xaf, 0x60, 
+0xaf, 0x61, 0xef, 0x60, 0x2f, 0x61, 0x6f, 0x61, 0x00, 0x20, 0xc1, 0x00, 
+0x09, 0x18, 0x49, 0x01, 0x35, 0x4b, 0xc9, 0x18, 0x86, 0x00, 0xcb, 0x1d, 
+0xf9, 0x33, 0x34, 0x4c, 0x34, 0x19, 0xe3, 0x63, 0x11, 0x23, 0x5b, 0x01, 
+0xcb, 0x18, 0x63, 0x63, 0x0d, 0x23, 0x9b, 0x01, 0xcb, 0x18, 0xb4, 0x18, 
+0xe3, 0x63, 0x23, 0x23, 0x5b, 0x01, 0xc9, 0x18, 0x61, 0x63, 0x01, 0x30, 
+0x02, 0x28, 0xe4, 0xdb, 0x29, 0x48, 0xc1, 0x1d, 0xf9, 0x31, 0x29, 0x4c, 
+0xc0, 0x46, 0xa1, 0x62, 0x61, 0x6b, 0x0d, 0x23, 0x9b, 0x01, 0xe1, 0x62, 
+0xc1, 0x18, 0x91, 0x62, 0x51, 0x6b, 0xc0, 0x46, 0xd1, 0x62, 0x08, 0x21, 
+0xe1, 0x64, 0x25, 0x49, 0xc0, 0x46, 0x21, 0x65, 0x24, 0x49, 0x0b, 0x69, 
+0xc0, 0x46, 0x63, 0x65, 0xc3, 0x1d, 0x4d, 0x33, 0xe3, 0x65, 0x25, 0x66, 
+0x8b, 0x68, 0xc0, 0x46, 0x63, 0x66, 0xcb, 0x68, 0xc0, 0x46, 0xa3, 0x66, 
+0x1e, 0x4b, 0xc0, 0x46, 0xe3, 0x66, 0x27, 0x67, 0x0b, 0x23, 0xdb, 0x01, 
+0xc3, 0x18, 0xa3, 0x67, 0x67, 0x67, 0x01, 0x26, 0xe3, 0x1d, 0x69, 0x33, 
+0x66, 0x61, 0xe7, 0x61, 0x1f, 0x73, 0x02, 0x23, 0xd3, 0x64, 0x17, 0x4b, 
+0xc0, 0x46, 0x13, 0x65, 0xcb, 0x69, 0xc0, 0x46, 0x53, 0x65, 0xc3, 0x1d, 
+0x51, 0x33, 0xd3, 0x65, 0x2b, 0x1d, 0x13, 0x66, 0x4b, 0x69, 0xc0, 0x46, 
+0x53, 0x66, 0x89, 0x69, 0xc0, 0x46, 0x91, 0x66, 0x0f, 0x49, 0xc0, 0x46, 
+0xd1, 0x66, 0x16, 0x67, 0x0f, 0x23, 0xdb, 0x01, 0xc0, 0x18, 0x90, 0x67, 
+0x56, 0x67, 0xd7, 0x61, 0xd0, 0x1d, 0x69, 0x30, 0x56, 0x61, 0x07, 0x73, 
 0xf0, 0xbc, 0x70, 0x47, 0x68, 0x0e, 0x00, 0x80, 0xe4, 0x2c, 0x00, 0x80, 
-0x64, 0x2d, 0x00, 0x80, 0x3c, 0xef, 0x20, 0x40, 0x30, 0x01, 0x18, 0x00, 
-0x7c, 0x29, 0x00, 0x80, 0xec, 0x54, 0xff, 0xff, 0x38, 0x01, 0x18, 0x00, 
-0xfc, 0x54, 0xff, 0xff, 0x90, 0xb4, 0x00, 0x21, 0x1e, 0x4a, 0xbb, 0x23, 
-0x1b, 0x01, 0xd7, 0x18, 0xf9, 0x73, 0x19, 0x23, 0xdb, 0x01, 0xd0, 0x18, 
-0x01, 0x24, 0xcd, 0x23, 0x1b, 0x01, 0xd3, 0x18, 0xc1, 0x61, 0x1c, 0x70, 
-0x33, 0x23, 0x9b, 0x01, 0xd3, 0x18, 0x99, 0x60, 0xb9, 0x73, 0x59, 0x61, 
-0x2f, 0x23, 0x9b, 0x01, 0xd3, 0x18, 0x19, 0x60, 0x13, 0x4b, 0x51, 0x27, 
-0xbf, 0x03, 0x03, 0x63, 0x3b, 0x60, 0x84, 0x69, 0xe4, 0x18, 0x44, 0x63, 
-0x04, 0x3c, 0x7c, 0x60, 0x01, 0x24, 0xe4, 0x02, 0x84, 0x63, 0x0e, 0x4c, 
-0xc0, 0x46, 0xbc, 0x60, 0x04, 0x6b, 0xc0, 0x46, 0x44, 0x62, 0x84, 0x69, 
-0xe4, 0x18, 0x0b, 0x4b, 0xe3, 0x18, 0xfb, 0x60, 0x03, 0x6b, 0xc0, 0x46, 
-0x83, 0x62, 0x43, 0x6a, 0xc0, 0x46, 0x03, 0x62, 0xc1, 0x63, 0x51, 0x64, 
-0x91, 0x64, 0xd1, 0x65, 0xd1, 0x66, 0x90, 0xbc, 0x70, 0x47, 0x00, 0x00, 
-0x68, 0x0e, 0x00, 0x80, 0x00, 0x00, 0x20, 0x40, 0xfc, 0x07, 0x00, 0x00, 
-0xfc, 0xf7, 0xff, 0xff, 0x90, 0xb4, 0x00, 0x22, 0x1b, 0x49, 0xc9, 0x23, 
-0x1b, 0x01, 0xc8, 0x18, 0x02, 0x71, 0x01, 0x20, 0xbb, 0x23, 0x1b, 0x01, 
-0xcb, 0x18, 0x58, 0x73, 0x17, 0x48, 0x03, 0x1c, 0x00, 0x27, 0xdc, 0x1d, 
-0xc1, 0x34, 0x1c, 0x65, 0x23, 0x1c, 0x01, 0x37, 0x3f, 0x2f, 0xf8, 0xd3, 
-0x1a, 0x65, 0x19, 0x23, 0xdb, 0x01, 0xcf, 0x18, 0x33, 0x23, 0x9b, 0x01, 
-0xcb, 0x18, 0x3a, 0x61, 0x98, 0x61, 0x40, 0x20, 0xf8, 0x60, 0xda, 0x61, 
-0x1a, 0x62, 0xca, 0x64, 0x0a, 0x66, 0x0c, 0x48, 0xc0, 0x46, 0xc2, 0x60, 
-0x0b, 0x48, 0x00, 0x6b, 0xc0, 0x06, 0xc0, 0x0e, 0xf8, 0x63, 0x0a, 0x48, 
-0x01, 0x68, 0xc0, 0x46, 0x19, 0x80, 0x41, 0x68, 0xc0, 0x46, 0x59, 0x80, 
-0x80, 0x68, 0xc0, 0x46, 0x98, 0x80, 0x90, 0xbc, 0x70, 0x47, 0x00, 0x00, 
-0x68, 0x0e, 0x00, 0x80, 0x3c, 0xbd, 0x20, 0x40, 0x3c, 0xef, 0x20, 0x40, 
-0x80, 0x00, 0x14, 0x40, 0x40, 0x00, 0x14, 0x40, 0x00, 0x20, 0x0a, 0x49, 
-0xc0, 0x46, 0x08, 0x73, 0xcb, 0x1d, 0xff, 0x33, 0x3a, 0x33, 0x88, 0x61, 
-0xc8, 0x61, 0x18, 0x70, 0x06, 0x4a, 0xc0, 0x46, 0x10, 0x65, 0x50, 0x66, 
-0x90, 0x66, 0x08, 0x70, 0x58, 0x70, 0xbb, 0x23, 0x1b, 0x01, 0xd1, 0x18, 
-0x08, 0x73, 0x70, 0x47, 0x28, 0x05, 0x00, 0x80, 0x68, 0x0e, 0x00, 0x80, 
-0xf0, 0xb4, 0x2f, 0x49, 0x2f, 0x4a, 0xc0, 0x46, 0x11, 0x61, 0x01, 0x23, 
-0x9b, 0x02, 0xc8, 0x18, 0x50, 0x61, 0x2d, 0x48, 0xc0, 0x46, 0x10, 0x62, 
-0xdb, 0x00, 0xc3, 0x18, 0x53, 0x62, 0x00, 0x23, 0x13, 0x63, 0x53, 0x63, 
-0x29, 0x4a, 0x2a, 0x4f, 0xd4, 0x1d, 0xff, 0x34, 0xfa, 0x34, 0x14, 0xc7, 
-0x08, 0x3f, 0x3b, 0x61, 0x1c, 0x1f, 0x7c, 0x61, 0x26, 0x4f, 0xc0, 0x46, 
-0x39, 0x60, 0xb8, 0x61, 0x79, 0x61, 0xf8, 0x62, 0x3b, 0x63, 0x7b, 0x64, 
-0xba, 0x64, 0xfa, 0x65, 0x22, 0x4f, 0xfe, 0x1d, 0xf9, 0x36, 0x22, 0x4d, 
-0xec, 0x1d, 0x79, 0x34, 0x26, 0x62, 0x51, 0x26, 0xb6, 0x03, 0x37, 0x61, 
-0x24, 0x6a, 0xc0, 0x46, 0x74, 0x61, 0x2f, 0x67, 0x1d, 0x4d, 0x09, 0x27, 
-0x7f, 0x04, 0xec, 0x1d, 0x75, 0x34, 0x7c, 0x60, 0x3d, 0x60, 0x1b, 0x4c, 
-0xc0, 0x46, 0x3c, 0x61, 0xe6, 0x1d, 0x75, 0x36, 0x7e, 0x61, 0x19, 0x4f, 
-0xc0, 0x46, 0x7c, 0x60, 0x3d, 0x60, 0x0f, 0x1c, 
+0x64, 0x2d, 0x00, 0x80, 0x90, 0xee, 0x20, 0x40, 0x30, 0x01, 0x18, 0x00, 
+0x7c, 0x29, 0x00, 0x80, 0x00, 0x55, 0xff, 0xff, 0x38, 0x01, 0x18, 0x00, 
+0x10, 0x55, 0xff, 0xff, 0x90, 0xb4, 0x00, 0x21, 0x1e, 0x4a, 0xbb, 0x23, 
+0x1b, 0x01, 0xd7, 0x18, 0xf9, 0x73, 0x19, 0x23, 
+0xdb, 0x01, 0xd0, 0x18, 0x01, 0x24, 0xcd, 0x23, 0x1b, 0x01, 0xd3, 0x18, 
+0xc1, 0x61, 0x1c, 0x70, 0x33, 0x23, 0x9b, 0x01, 0xd3, 0x18, 0x99, 0x60, 
+0xb9, 0x73, 0x59, 0x61, 0x2f, 0x23, 0x9b, 0x01, 0xd3, 0x18, 0x19, 0x60, 
+0x13, 0x4b, 0x51, 0x27, 0xbf, 0x03, 0x03, 0x63, 0x3b, 0x60, 0x84, 0x69, 
+0xe4, 0x18, 0x44, 0x63, 0x04, 0x3c, 0x7c, 0x60, 0x01, 0x24, 0xe4, 0x02, 
+0x84, 0x63, 0x0e, 0x4c, 0xc0, 0x46, 0xbc, 0x60, 0x04, 0x6b, 0xc0, 0x46, 
+0x44, 0x62, 0x84, 0x69, 0xe4, 0x18, 0x0b, 0x4b, 0xe3, 0x18, 0xfb, 0x60, 
+0x03, 0x6b, 0xc0, 0x46, 0x83, 0x62, 0x43, 0x6a, 0xc0, 0x46, 0x03, 0x62, 
+0xc1, 0x63, 0x51, 0x64, 0x91, 0x64, 0xd1, 0x65, 0xd1, 0x66, 0x90, 0xbc, 
+0x70, 0x47, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 0x00, 0x00, 0x20, 0x40, 
+0xfc, 0x07, 0x00, 0x00, 0xfc, 0xf7, 0xff, 0xff, 0x90, 0xb4, 0x00, 0x22, 
+0x1b, 0x49, 0xc9, 0x23, 0x1b, 0x01, 0xc8, 0x18, 0x02, 0x71, 0x01, 0x20, 
+0xbb, 0x23, 0x1b, 0x01, 0xcb, 0x18, 0x58, 0x73, 0x17, 0x48, 0x03, 0x1c, 
+0x00, 0x27, 0xdc, 0x1d, 0xc1, 0x34, 0x1c, 0x65, 0x23, 0x1c, 0x01, 0x37, 
+0x3f, 0x2f, 0xf8, 0xd3, 0x1a, 0x65, 0x19, 0x23, 0xdb, 0x01, 0xcf, 0x18, 
+0x33, 0x23, 0x9b, 0x01, 0xcb, 0x18, 0x3a, 0x61, 0x98, 0x61, 0x40, 0x20, 
+0xf8, 0x60, 0xda, 0x61, 0x1a, 0x62, 0xca, 0x64, 0x0a, 0x66, 0x0c, 0x48, 
+0xc0, 0x46, 0xc2, 0x60, 0x0b, 0x48, 0x00, 0x6b, 0xc0, 0x06, 0xc0, 0x0e, 
+0xf8, 0x63, 0x0a, 0x48, 0x01, 0x68, 0xc0, 0x46, 0x19, 0x80, 0x41, 0x68, 
+0xc0, 0x46, 0x59, 0x80, 0x80, 0x68, 0xc0, 0x46, 0x98, 0x80, 0x90, 0xbc, 
+0x70, 0x47, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 0x90, 0xbc, 0x20, 0x40, 
+0x90, 0xee, 0x20, 0x40, 0x80, 0x00, 0x14, 0x40, 0x40, 0x00, 0x14, 0x40, 
+0x00, 0x20, 0x0a, 0x49, 0xc0, 0x46, 0x08, 0x73, 0xcb, 0x1d, 0xff, 0x33, 
+0x3a, 0x33, 0x88, 0x61, 0xc8, 0x61, 0x18, 0x70, 0x06, 0x4a, 0xc0, 0x46, 
+0x10, 0x65, 0x50, 0x66, 0x90, 0x66, 0x08, 0x70, 0x58, 0x70, 0xbb, 0x23, 
+0x1b, 0x01, 0xd1, 0x18, 0x08, 0x73, 0x70, 0x47, 0x28, 0x05, 0x00, 0x80, 
+0x68, 0x0e, 0x00, 0x80, 0xf0, 0xb4, 0x2f, 0x49, 0x2f, 0x4a, 0xc0, 0x46, 
+0x11, 0x61, 0x01, 0x23, 0x9b, 0x02, 0xc8, 0x18, 0x50, 0x61, 0x2d, 0x48, 
+0xc0, 0x46, 0x10, 0x62, 0xdb, 0x00, 0xc3, 0x18, 0x53, 0x62, 0x00, 0x23, 
+0x13, 0x63, 0x53, 0x63, 0x29, 0x4a, 0x2a, 0x4f, 0xd4, 0x1d, 0xff, 0x34, 
+0xfa, 0x34, 0x14, 0xc7, 0x08, 0x3f, 0x3b, 0x61, 0x1c, 0x1f, 0x7c, 0x61, 
+0x26, 0x4f, 0xc0, 0x46, 0x39, 0x60, 0xb8, 0x61, 0x79, 0x61, 0xf8, 0x62, 
+0x3b, 0x63, 0x7b, 0x64, 0xba, 0x64, 0xfa, 0x65, 0x22, 0x4f, 0xfe, 0x1d, 
+0xf9, 0x36, 0x22, 0x4d, 0xec, 0x1d, 0x79, 0x34, 0x26, 0x62, 0x51, 0x26, 
+0xb6, 0x03, 0x37, 0x61, 0x24, 0x6a, 0xc0, 0x46, 0x74, 0x61, 0x2f, 0x67, 
+0x1d, 0x4d, 0x09, 0x27, 0x7f, 0x04, 0xec, 0x1d, 0x75, 0x34, 0x7c, 0x60, 
+0x3d, 0x60, 0x1b, 0x4c, 0xc0, 0x46, 0x3c, 0x61, 0xe6, 0x1d, 0x75, 0x36, 
+0x7e, 0x61, 0x19, 0x4f, 0xc0, 0x46, 0x7c, 0x60, 0x3d, 0x60, 0x0f, 0x1c, 
 0x00, 0x21, 0xff, 0x24, 0x01, 0x34, 0x1d, 0x1c, 0x8b, 0x00, 0xfd, 0x50, 
 0x01, 0x31, 0xa1, 0x42, 0xfa, 0xd3, 0x01, 0x1c, 0x00, 0x20, 0x01, 0x27, 
 0xff, 0x02, 0x83, 0x00, 0xcd, 0x50, 0x01, 0x30, 0xb8, 0x42, 0xfa, 0xd3, 
 0x00, 0x20, 0x81, 0x00, 0x55, 0x50, 0x01, 0x30, 0x80, 0x28, 0xfa, 0xd3, 
-0xf0, 0xbc, 0x70, 0x47, 0x24, 0xa3, 0x20, 0x40, 0x40, 0x01, 0x18, 0x00, 
-0x24, 0x83, 0x20, 0x40, 0x24, 0xa9, 0x20, 0x40, 0x80, 0x01, 0x18, 0x00, 
-0xa8, 0x03, 0x00, 0x80, 0x24, 0xa7, 0x20, 0x40, 0x68, 0x0e, 0x00, 0x80, 
-0x24, 0xa8, 0x20, 0x40, 0xa4, 0xa8, 0x20, 0x40, 0x08, 0x04, 0x00, 0x80, 
-0xb8, 0xb5, 0x2c, 0x48, 0xfc, 0xf7, 0x0a, 0xff, 0x01, 0x20, 0x2b, 0x49, 
-0x0a, 0x68, 0x52, 0x0c, 0x06, 0xd2, 0x0a, 0x68, 0x12, 0x0c, 0x02, 0xd1, 
-0x0a, 0x68, 0x92, 0x0a, 0x00, 0xd2, 0x00, 0x20, 0x04, 0x06, 0x24, 0x0e, 
-0x25, 0x4a, 0xd7, 0x1d, 0x0d, 0x37, 0x00, 0x23, 0x00, 0x20, 0x9d, 0x00, 
-0x78, 0x51, 0x01, 0x33, 0x04, 0x2b, 0xfa, 0xd3, 0x01, 0x27, 0x3f, 0x05, 
-0x50, 0x61, 0xf8, 0x60, 0xd0, 0x61, 0xf8, 0x61, 0x00, 0x23, 0xdb, 0x43, 
-0x93, 0x61, 0x3b, 0x61, 0x13, 0x62, 0x3b, 0x62, 0x00, 0x27, 0x1b, 0x4b, 
-0x8d, 0x68, 0xc0, 0x46, 0x00, 0x95, 0x8d, 0x69, 0xc0, 0x46, 0x00, 0x95, 
-0x00, 0x2c, 0x0b, 0xd0, 0xdd, 0x6b, 0xc0, 0x46, 0x00, 0x95, 0x9d, 0x6b, 
-0xc0, 0x46, 0x00, 0x95, 0x5d, 0x6b, 0xc0, 0x46, 0x00, 0x95, 0x1d, 0x6b, 
-0xc0, 0x46, 0x00, 0x95, 0x01, 0x37, 0x40, 0x2f, 0xe8, 0xd3, 0x00, 0x27, 
-0x6c, 0x46, 0x01, 0x23, 0x5b, 0x07, 0x1c, 0x43, 0x01, 0xe0, 0x20, 0x60, 
-0x01, 0x37, 0x0d, 0x68, 0x2b, 0x09, 0x02, 0xd2, 0x80, 0x2f, 0xf8, 0xd3, 
-0x01, 0xe0, 0x80, 0x2f, 0x03, 0xd3, 0x08, 0x49, 0x4b, 0x6e, 0x01, 0x33, 
-0x4b, 0x66, 0xd0, 0x62, 0xb8, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 
-0xf4, 0x01, 0xff, 0xff, 0x00, 0x00, 0x10, 0x40, 0x68, 0x0e, 0x00, 0x80, 
-0x00, 0x01, 0x18, 0x40, 0xa0, 0x82, 0x20, 0x40, 0x90, 0xb4, 0x00, 0x21, 
-0x0e, 0x4f, 0x0f, 0x4a, 0x00, 0x20, 0x4c, 0x01, 0x64, 0x1a, 0xa4, 0x00, 
-0xa3, 0x18, 0x58, 0x60, 0x98, 0x60, 0x18, 0x64, 0x58, 0x64, 0x10, 0x53, 
-0x58, 0x80, 0xcc, 0x00, 0xe4, 0x19, 0x98, 0x67, 0xdc, 0x62, 0x01, 0x31, 
-0x03, 0x29, 0xee, 0xd3, 0x06, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x48, 0x60, 
-0x88, 0x60, 0xc8, 0x60, 0x08, 0x61, 0x90, 0xbc, 0x70, 0x47, 0x00, 0x00, 
-0x58, 0x67, 0x21, 0x40, 0x5c, 0x2b, 0x00, 0x80, 0xd0, 0x2c, 0x00, 0x80, 
-0x64, 0x21, 0x05, 0x48, 0xc0, 0x46, 0x01, 0x63, 0x00, 0x21, 0xc9, 0x43, 
-0x41, 0x63, 0x81, 0x63, 0x00, 0x21, 0xc1, 0x63, 0x01, 0x64, 0x70, 0x47, 
-0x68, 0x0e, 0x00, 0x80, 0x80, 0xb4, 0x01, 0x20, 0x40, 0x02, 0x0a, 0x49, 
-0xc0, 0x46, 0x08, 0x60, 0x3c, 0x20, 0x48, 0x60, 0x88, 0x60, 0x08, 0x48, 
-0xc0, 0x46, 0xc8, 0x60, 0x00, 0x20, 0x07, 0x4a, 0x87, 0x00, 0xcb, 0x68, 
-0xc0, 0x46, 0xda, 0x51, 0x01, 0x30, 0x10, 0x28, 0xf8, 0xd3, 0x80, 0xbc, 
-0x70, 0x47, 0x00, 0x00, 0xe4, 0x2d, 0x00, 0x80, 0xf4, 0x2d, 0x00, 0x80, 
-0x49, 0x4c, 0xff, 0xff, 0x12, 0x49, 0x13, 0x48, 0x67, 0x23, 0x9b, 0x01, 
-0xca, 0x18, 0x06, 0xc0, 0x08, 0x38, 0x11, 0x4b, 0xca, 0x18, 0xc1, 0x60, 
-0x82, 0x60, 0x01, 0x61, 0x0f, 0x49, 0x10, 0x48, 0xa7, 0x23, 0x9b, 0x01, 
-0xca, 0x18, 0x06, 0xc0, 0x08, 0x38, 0x0e, 0x4b, 0xca, 0x18, 0xc1, 0x60, 
-0x82, 0x60, 0x01, 0x61, 0x0c, 0x48, 0x0d, 0x49, 
+0xf0, 0xbc, 0x70, 0x47, 0x24, 0xa3, 0x20, 0x40, 
+0x40, 0x01, 0x18, 0x00, 0x24, 0x83, 0x20, 0x40, 0x24, 0xa9, 0x20, 0x40, 
+0x80, 0x01, 0x18, 0x00, 0xa8, 0x03, 0x00, 0x80, 0x24, 0xa7, 0x20, 0x40, 
+0x68, 0x0e, 0x00, 0x80, 0x24, 0xa8, 0x20, 0x40, 0xa4, 0xa8, 0x20, 0x40, 
+0x08, 0x04, 0x00, 0x80, 0xb8, 0xb5, 0x2c, 0x48, 0xfd, 0xf7, 0xba, 0xfd, 
+0x01, 0x20, 0x2b, 0x49, 0x0a, 0x68, 0x52, 0x0c, 0x06, 0xd2, 0x0a, 0x68, 
+0x12, 0x0c, 0x02, 0xd1, 0x0a, 0x68, 0x92, 0x0a, 0x00, 0xd2, 0x00, 0x20, 
+0x04, 0x06, 0x24, 0x0e, 0x25, 0x4a, 0xd7, 0x1d, 0x0d, 0x37, 0x00, 0x23, 
+0x00, 0x20, 0x9d, 0x00, 0x78, 0x51, 0x01, 0x33, 0x04, 0x2b, 0xfa, 0xd3, 
+0x01, 0x27, 0x3f, 0x05, 0x50, 0x61, 0xf8, 0x60, 0xd0, 0x61, 0xf8, 0x61, 
+0x00, 0x23, 0xdb, 0x43, 0x93, 0x61, 0x3b, 0x61, 0x13, 0x62, 0x3b, 0x62, 
+0x00, 0x27, 0x1b, 0x4b, 0x8d, 0x68, 0xc0, 0x46, 0x00, 0x95, 0x8d, 0x69, 
+0xc0, 0x46, 0x00, 0x95, 0x00, 0x2c, 0x0b, 0xd0, 0xdd, 0x6b, 0xc0, 0x46, 
+0x00, 0x95, 0x9d, 0x6b, 0xc0, 0x46, 0x00, 0x95, 0x5d, 0x6b, 0xc0, 0x46, 
+0x00, 0x95, 0x1d, 0x6b, 0xc0, 0x46, 0x00, 0x95, 0x01, 0x37, 0x40, 0x2f, 
+0xe8, 0xd3, 0x00, 0x27, 0x6c, 0x46, 0x01, 0x23, 0x5b, 0x07, 0x1c, 0x43, 
+0x01, 0xe0, 0x20, 0x60, 0x01, 0x37, 0x0d, 0x68, 0x2b, 0x09, 0x02, 0xd2, 
+0x80, 0x2f, 0xf8, 0xd3, 0x01, 0xe0, 0x80, 0x2f, 0x03, 0xd3, 0x08, 0x49, 
+0x4b, 0x6e, 0x01, 0x33, 0x4b, 0x66, 0xd0, 0x62, 0xb8, 0xbc, 0x08, 0xbc, 
+0x18, 0x47, 0x00, 0x00, 0xf4, 0x01, 0xff, 0xff, 0x00, 0x00, 0x10, 0x40, 
+0x68, 0x0e, 0x00, 0x80, 0x00, 0x01, 0x18, 0x40, 0xa0, 0x82, 0x20, 0x40, 
+0x90, 0xb4, 0x00, 0x21, 0x0e, 0x4f, 0x0f, 0x4a, 0x00, 0x20, 0x4c, 0x01, 
+0x64, 0x1a, 0xa4, 0x00, 0xa3, 0x18, 0x58, 0x60, 0x98, 0x60, 0x18, 0x64, 
+0x58, 0x64, 0x10, 0x53, 0x58, 0x80, 0xcc, 0x00, 0xe4, 0x19, 0x98, 0x67, 
+0xdc, 0x62, 0x01, 0x31, 0x03, 0x29, 0xee, 0xd3, 0x06, 0x49, 0xc0, 0x46, 
+0x08, 0x60, 0x48, 0x60, 0x88, 0x60, 0xc8, 0x60, 0x08, 0x61, 0x90, 0xbc, 
+0x70, 0x47, 0x00, 0x00, 0xac, 0x66, 0x21, 0x40, 0x5c, 0x2b, 0x00, 0x80, 
+0xd0, 0x2c, 0x00, 0x80, 0x64, 0x21, 0x05, 0x48, 0xc0, 0x46, 0x01, 0x63, 
+0x00, 0x21, 0xc9, 0x43, 0x41, 0x63, 0x81, 0x63, 0x00, 0x21, 0xc1, 0x63, 
+0x01, 0x64, 0x70, 0x47, 0x68, 0x0e, 0x00, 0x80, 0x80, 0xb4, 0x01, 0x20, 
+0x40, 0x02, 0x0a, 0x49, 0xc0, 0x46, 0x08, 0x60, 0x3c, 0x20, 0x48, 0x60, 
+0x88, 0x60, 0x08, 0x48, 0xc0, 0x46, 0xc8, 0x60, 0x00, 0x20, 0x07, 0x4a, 
+0x87, 0x00, 0xcb, 0x68, 0xc0, 0x46, 0xda, 0x51, 0x01, 0x30, 0x10, 0x28, 
+0xf8, 0xd3, 0x80, 0xbc, 0x70, 0x47, 0x00, 0x00, 0xe4, 0x2d, 0x00, 0x80, 
+0xf4, 0x2d, 0x00, 0x80, 0x5d, 0x4c, 0xff, 0xff, 0x12, 0x49, 0x13, 0x48, 
+0x67, 0x23, 0x9b, 0x01, 0xca, 0x18, 0x06, 0xc0, 0x08, 0x38, 0x11, 0x4b, 
+0xca, 0x18, 0xc1, 0x60, 0x82, 0x60, 0x01, 0x61, 0x0f, 0x49, 0x10, 0x48, 
+0xa7, 0x23, 0x9b, 0x01, 0xca, 0x18, 0x06, 0xc0, 0x08, 0x38, 0x0e, 0x4b, 
+0xca, 0x18, 0xc1, 0x60, 0x82, 0x60, 0x01, 0x61, 0x0c, 0x48, 0x0d, 0x49, 
 0x67, 0x23, 0x9b, 0x01, 0xc2, 0x18, 0x05, 0xc1, 0x08, 0x39, 0x05, 0x4b, 
 0xc2, 0x18, 0xc8, 0x60, 0x8a, 0x60, 0x08, 0x61, 0x70, 0x47, 0x00, 0x00, 
-0x58, 0x1f, 0x21, 0x40, 0x48, 0x2e, 0x00, 0x80, 0xfc, 0x1f, 0x00, 0x00, 
-0x58, 0xef, 0x20, 0x40, 0x34, 0x2e, 0x00, 0x80, 0xfc, 0x2f, 0x00, 0x00, 
-0x58, 0x3f, 0x21, 0x40, 0x5c, 0x2e, 0x00, 0x80, 0x90, 0xb4, 0x00, 0x21, 
-0x40, 0x4c, 0x00, 0x20, 0x0a, 0x01, 0x12, 0x19, 0x19, 0x23, 0xdb, 0x01, 
-0xd2, 0x18, 0xd0, 0x62, 0x10, 0x63, 0x50, 0x63, 0x90, 0x63, 0x01, 0x31, 
-0x03, 0x29, 0xf3, 0xd3, 0x3a, 0x49, 0xc0, 0x46, 0x08, 0x63, 0x48, 0x63, 
-0x88, 0x63, 0x20, 0x60, 0x01, 0x21, 0xe3, 0x1d, 0x59, 0x33, 0x60, 0x60, 
-0x19, 0x71, 0x18, 0x72, 0x98, 0x71, 0x98, 0x72, 0x59, 0x71, 0x58, 0x72, 
-0xd8, 0x71, 0xd8, 0x72, 0xe2, 0x1d, 0x49, 0x32, 0x11, 0x73, 0x19, 0x70, 
-0x90, 0x73, 0x98, 0x70, 0x51, 0x73, 0x59, 0x70, 0xd0, 0x73, 0xd8, 0x70, 
-0x11, 0x71, 0x11, 0x72, 0x90, 0x71, 0x90, 0x72, 0x50, 0x71, 0x50, 0x72, 
-0xd0, 0x71, 0xd0, 0x72, 0x18, 0x73, 0x02, 0x22, 0xe7, 0x1d, 0x69, 0x37, 
-0x3a, 0x70, 0x99, 0x73, 0xba, 0x70, 0x58, 0x73, 0x78, 0x70, 0xd8, 0x73, 
-0xf8, 0x70, 0x39, 0x71, 0x3a, 0x72, 0xb9, 0x71, 0xb9, 0x72, 0x78, 0x71, 
-0x7a, 0x72, 0xf9, 0x71, 0xf9, 0x72, 0x39, 0x73, 0xe3, 0x1d, 0x79, 0x33, 
-0x1a, 0x70, 0xb9, 0x73, 0x99, 0x70, 0x78, 0x73, 0x5a, 0x70, 0xf9, 0x73, 
-0xd9, 0x70, 0x1a, 0x71, 0x1a, 0x72, 0x99, 0x71, 0x9a, 0x72, 0x58, 0x71, 
-0x5a, 0x72, 0xd9, 0x71, 0xda, 0x72, 0x19, 0x73, 0xe7, 0x1d, 0x89, 0x37, 
-0x3a, 0x70, 0x99, 0x73, 0xb9, 0x70, 0x58, 0x73, 0x7a, 0x70, 0xd9, 0x73, 
-0xf9, 0x70, 0x39, 0x71, 0x3a, 0x72, 0xb9, 0x71, 0xb9, 0x72, 0x78, 0x71, 
-0x7a, 0x72, 0xf9, 0x71, 0xf9, 0x72, 0x3a, 0x73, 0xe3, 0x1d, 0x99, 0x33, 
-0x1a, 0x70, 0xb9, 0x73, 0x9a, 0x70, 0x78, 0x73, 0x5a, 0x70, 0xf9, 0x73, 
-0xda, 0x70, 0x19, 0x71, 0x1a, 0x72, 0x99, 0x71, 0x99, 0x72, 0x58, 0x71, 
-0x5a, 0x72, 0xd9, 0x71, 0xd9, 0x72, 0x20, 0x61, 0xe0, 0x60, 0x60, 0x61, 
-0xa0, 0x60, 0x90, 0xbc, 0x70, 0x47, 0x00, 0x00, 0xa0, 0x1c, 0x00, 0x80, 
-0xe8, 0x19, 0x00, 0x80, 0x81, 0x20, 0x00, 0x02, 0x01, 0x49, 0xc0, 0x46, 
-0x88, 0x62, 0x70, 0x47, 0xc0, 0x00, 0x14, 0x00, 0x09, 0x49, 0x0a, 0x4b, 
-0xc8, 0x18, 0x04, 0x3b, 0xc9, 0x18, 0x08, 0x60, 0x00, 0x21, 0xc2, 0x1d, 
-0x29, 0x32, 0xc2, 0x61, 0x10, 0x1c, 0x01, 0x31, 0x08, 0x29, 0xf8, 0xd3, 
-0xc1, 0x1f, 0x29, 0x39, 0x00, 0x20, 0xc8, 0x61, 0x70, 0x47, 0x00, 0x00, 
-0x68, 0x0e, 0x00, 0x80, 0x84, 0x09, 0x00, 0x00, 0x06, 0x48, 0x07, 0x49, 
-0xc0, 0x46, 0x08, 0x80, 0x48, 0x80, 0x00, 0x20, 0x88, 0x80, 0xc8, 0x80, 
-0x88, 0x60, 0x04, 0x49, 0xc0, 0x46, 0x48, 0x61, 0x88, 0x61, 0x70, 0x47, 
-0xff, 0xff, 0x00, 0x00, 0x4c, 0x2a, 0x00, 0x80, 0x6c, 0x06, 0x00, 0x80, 
-0x00, 0x21, 0x06, 0x48, 0xc2, 0x1d, 0x19, 0x32, 0xc1, 0x60, 0x01, 0x61, 
-0xc1, 0x61, 0x01, 0x62, 0x11, 0x71, 0xff, 0x30, 0x01, 0x30, 0x41, 0x62, 
-0x70, 0x47, 0x00, 0x00, 0x6c, 0x06, 0x00, 0x80, 0x09, 0x48, 0x0a, 0x4b, 
-0xc0, 0x46, 0x18, 0x60, 0x00, 0x21, 0xc2, 0x1d, 0x4d, 0x32, 0xc2, 0x60, 
-0x10, 0x1c, 0x01, 0x31, 0x14, 0x29, 0xf8, 0xd3, 0xc1, 0x1f, 0x4d, 0x39, 
-0x00, 0x20, 0xc8, 0x60, 0x58, 0x60, 0x98, 0x60, 0x70, 0x47, 0x00, 0x00, 
-0xd8, 0x07, 0x00, 0x80, 0x6c, 0x06, 0x00, 0x80, 
-0x00, 0xb5, 0x0b, 0x49, 0x0b, 0x48, 0xfc, 0xf7, 0x3a, 0xfd, 0x0b, 0x48, 
+0xac, 0x1e, 0x21, 0x40, 0x48, 0x2e, 0x00, 0x80, 0xfc, 0x1f, 0x00, 0x00, 
+0xac, 0xee, 0x20, 0x40, 0x34, 0x2e, 0x00, 0x80, 0xfc, 0x2f, 0x00, 0x00, 
+0xac, 0x3e, 0x21, 0x40, 0x5c, 0x2e, 0x00, 0x80, 
+0x90, 0xb4, 0x00, 0x21, 0x40, 0x4c, 0x00, 0x20, 0x0a, 0x01, 0x12, 0x19, 
+0x19, 0x23, 0xdb, 0x01, 0xd2, 0x18, 0xd0, 0x62, 0x10, 0x63, 0x50, 0x63, 
+0x90, 0x63, 0x01, 0x31, 0x03, 0x29, 0xf3, 0xd3, 0x3a, 0x49, 0xc0, 0x46, 
+0x08, 0x63, 0x48, 0x63, 0x88, 0x63, 0x20, 0x60, 0x01, 0x21, 0xe3, 0x1d, 
+0x59, 0x33, 0x60, 0x60, 0x19, 0x71, 0x18, 0x72, 0x98, 0x71, 0x98, 0x72, 
+0x59, 0x71, 0x58, 0x72, 0xd8, 0x71, 0xd8, 0x72, 0xe2, 0x1d, 0x49, 0x32, 
+0x11, 0x73, 0x19, 0x70, 0x90, 0x73, 0x98, 0x70, 0x51, 0x73, 0x59, 0x70, 
+0xd0, 0x73, 0xd8, 0x70, 0x11, 0x71, 0x11, 0x72, 0x90, 0x71, 0x90, 0x72, 
+0x50, 0x71, 0x50, 0x72, 0xd0, 0x71, 0xd0, 0x72, 0x18, 0x73, 0x02, 0x22, 
+0xe7, 0x1d, 0x69, 0x37, 0x3a, 0x70, 0x99, 0x73, 0xba, 0x70, 0x58, 0x73, 
+0x78, 0x70, 0xd8, 0x73, 0xf8, 0x70, 0x39, 0x71, 0x3a, 0x72, 0xb9, 0x71, 
+0xb9, 0x72, 0x78, 0x71, 0x7a, 0x72, 0xf9, 0x71, 0xf9, 0x72, 0x39, 0x73, 
+0xe3, 0x1d, 0x79, 0x33, 0x1a, 0x70, 0xb9, 0x73, 0x99, 0x70, 0x78, 0x73, 
+0x5a, 0x70, 0xf9, 0x73, 0xd9, 0x70, 0x1a, 0x71, 0x1a, 0x72, 0x99, 0x71, 
+0x9a, 0x72, 0x58, 0x71, 0x5a, 0x72, 0xd9, 0x71, 0xda, 0x72, 0x19, 0x73, 
+0xe7, 0x1d, 0x89, 0x37, 0x3a, 0x70, 0x99, 0x73, 0xb9, 0x70, 0x58, 0x73, 
+0x7a, 0x70, 0xd9, 0x73, 0xf9, 0x70, 0x39, 0x71, 0x3a, 0x72, 0xb9, 0x71, 
+0xb9, 0x72, 0x78, 0x71, 0x7a, 0x72, 0xf9, 0x71, 0xf9, 0x72, 0x3a, 0x73, 
+0xe3, 0x1d, 0x99, 0x33, 0x1a, 0x70, 0xb9, 0x73, 0x9a, 0x70, 0x78, 0x73, 
+0x5a, 0x70, 0xf9, 0x73, 0xda, 0x70, 0x19, 0x71, 0x1a, 0x72, 0x99, 0x71, 
+0x99, 0x72, 0x58, 0x71, 0x5a, 0x72, 0xd9, 0x71, 0xd9, 0x72, 0x20, 0x61, 
+0xe0, 0x60, 0x60, 0x61, 0xa0, 0x60, 0x90, 0xbc, 0x70, 0x47, 0x00, 0x00, 
+0xa0, 0x1c, 0x00, 0x80, 0xe8, 0x19, 0x00, 0x80, 0x81, 0x20, 0x00, 0x02, 
+0x01, 0x49, 0xc0, 0x46, 0x88, 0x62, 0x70, 0x47, 0xc0, 0x00, 0x14, 0x00, 
+0x09, 0x49, 0x0a, 0x4b, 0xc8, 0x18, 0x04, 0x3b, 0xc9, 0x18, 0x08, 0x60, 
+0x00, 0x21, 0xc2, 0x1d, 0x29, 0x32, 0xc2, 0x61, 0x10, 0x1c, 0x01, 0x31, 
+0x08, 0x29, 0xf8, 0xd3, 0xc1, 0x1f, 0x29, 0x39, 0x00, 0x20, 0xc8, 0x61, 
+0x70, 0x47, 0x00, 0x00, 0x68, 0x0e, 0x00, 0x80, 0x84, 0x09, 0x00, 0x00, 
+0x06, 0x48, 0x07, 0x49, 0xc0, 0x46, 0x08, 0x80, 0x48, 0x80, 0x00, 0x20, 
+0x88, 0x80, 0xc8, 0x80, 0x88, 0x60, 0x04, 0x49, 0xc0, 0x46, 0x48, 0x61, 
+0x88, 0x61, 0x70, 0x47, 0xff, 0xff, 0x00, 0x00, 0x4c, 0x2a, 0x00, 0x80, 
+0x6c, 0x06, 0x00, 0x80, 0x00, 0x21, 0x06, 0x48, 0xc2, 0x1d, 0x19, 0x32, 
+0xc1, 0x60, 0x01, 0x61, 0xc1, 0x61, 0x01, 0x62, 0x11, 0x71, 0xff, 0x30, 
+0x01, 0x30, 0x41, 0x62, 0x70, 0x47, 0x00, 0x00, 0x6c, 0x06, 0x00, 0x80, 
+0x09, 0x48, 0x0a, 0x4b, 0xc0, 0x46, 0x18, 0x60, 0x00, 0x21, 0xc2, 0x1d, 
+0x4d, 0x32, 0xc2, 0x60, 0x10, 0x1c, 0x01, 0x31, 0x14, 0x29, 0xf8, 0xd3, 
+0xc1, 0x1f, 0x4d, 0x39, 0x00, 0x20, 0xc8, 0x60, 0x58, 0x60, 0x98, 0x60, 
+0x70, 0x47, 0x00, 0x00, 0xd8, 0x07, 0x00, 0x80, 0x6c, 0x06, 0x00, 0x80, 
+0x00, 0xb5, 0x0b, 0x49, 0x0b, 0x48, 0xfd, 0xf7, 0xea, 0xfb, 0x0b, 0x48, 
 0x00, 0x6a, 0x01, 0x23, 0xdb, 0x03, 0x98, 0x43, 0x09, 0x49, 0xc0, 0x46, 
 0x08, 0x62, 0x09, 0x48, 0xc1, 0x68, 0x01, 0x29, 0x04, 0xd1, 0xc0, 0x6f, 
 0x80, 0x23, 0x01, 0x68, 0x19, 0x43, 0x01, 0x60, 0x08, 0xbc, 0x18, 0x47, 
-0x8d, 0xd5, 0x21, 0x40, 0xc1, 0xa8, 0x21, 0x40, 0xc0, 0x00, 0x18, 0x40, 
-0xc0, 0x00, 0x18, 0x00, 0x68, 0x0e, 0x00, 0x80, 0x00, 0xb5, 0x0f, 0x48, 
-0xc1, 0x68, 0x01, 0x29, 0x04, 0xd1, 0xc0, 0x6f, 0x80, 0x23, 0x01, 0x68, 
-0x99, 0x43, 0x01, 0x60, 0x0b, 0x4b, 0x0c, 0x48, 0x0c, 0x4a, 0x00, 0x21, 
-0xfc, 0xf7, 0x0f, 0xfd, 0x0b, 0x48, 0x41, 0x8d, 0x01, 0x31, 0x41, 0x85, 
-0x00, 0x21, 0xc1, 0x85, 0x09, 0x48, 0x00, 0x6a, 0x01, 0x23, 0xdb, 0x03, 
-0x18, 0x43, 0x08, 0x49, 0xc0, 0x46, 0x08, 0x62, 0x08, 0xbc, 0x18, 0x47, 
-0x68, 0x0e, 0x00, 0x80, 0x25, 0xd5, 0x21, 0x40, 0xc1, 0xa8, 0x21, 0x40, 
-0xb8, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc0, 0x00, 0x18, 0x40, 
-0xc0, 0x00, 0x18, 0x00, 0xf0, 0xb5, 0xfe, 0xf7, 0x9b, 0xfe, 0x1b, 0x4c, 
+0xc1, 0xbd, 0x21, 0x40, 0x75, 0x98, 0x21, 0x40, 
+0xc0, 0x00, 0x18, 0x40, 0xc0, 0x00, 0x18, 0x00, 0x68, 0x0e, 0x00, 0x80, 
+0x00, 0xb5, 0x0f, 0x48, 0xc1, 0x68, 0x01, 0x29, 0x04, 0xd1, 0xc0, 0x6f, 
+0x80, 0x23, 0x01, 0x68, 0x99, 0x43, 0x01, 0x60, 0x0b, 0x4b, 0x0c, 0x48, 
+0x0c, 0x4a, 0x00, 0x21, 0xfd, 0xf7, 0xbf, 0xfb, 0x0b, 0x48, 0x41, 0x8d, 
+0x01, 0x31, 0x41, 0x85, 0x00, 0x21, 0xc1, 0x85, 0x09, 0x48, 0x00, 0x6a, 
+0x01, 0x23, 0xdb, 0x03, 0x18, 0x43, 0x08, 0x49, 0xc0, 0x46, 0x08, 0x62, 
+0x08, 0xbc, 0x18, 0x47, 0x68, 0x0e, 0x00, 0x80, 0x59, 0xbd, 0x21, 0x40, 
+0x75, 0x98, 0x21, 0x40, 0xb8, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 
+0xc0, 0x00, 0x18, 0x40, 0xc0, 0x00, 0x18, 0x00, 0xf0, 0xb5, 0x1b, 0x4c, 
 0x10, 0x26, 0xe0, 0x68, 0x01, 0x28, 0x08, 0xd1, 0x60, 0x88, 0x00, 0x28, 
 0x05, 0xd1, 0x20, 0x79, 0x00, 0x28, 0x02, 0xd1, 0x19, 0x20, 0xa0, 0x67, 
 0x00, 0xe0, 0xa6, 0x67, 0x00, 0x20, 0x07, 0x23, 0x5b, 0x02, 0xe5, 0x18, 
@@ -3342,12 +2994,12 @@
 0x03, 0x03, 0x1b, 0x0b, 0x4e, 0x4c, 0x27, 0x6f, 0x3d, 0x03, 0x2d, 0x0b, 
 0xe7, 0x1d, 0x79, 0x37, 0xab, 0x42, 0x1c, 0xd0, 0xe3, 0x1d, 0x79, 0x33, 
 0x1b, 0x6a, 0xc0, 0x46, 0x40, 0x93, 0x01, 0x23, 0x9b, 0x07, 0x03, 0x43, 
-0x1b, 0x68, 0xcc, 0x00, 0x6e, 0x46, 0x33, 0x51, 
-0x01, 0x23, 0x9b, 0x07, 0x06, 0x1d, 0x33, 0x43, 0x1b, 0x68, 0x6c, 0x44, 
-0x63, 0x60, 0x08, 0x30, 0x01, 0x31, 0x40, 0x9b, 0x83, 0x42, 0x00, 0xd8, 
-0x3f, 0x48, 0x03, 0x03, 0x1b, 0x0b, 0xab, 0x42, 0xe7, 0xd1, 0x00, 0x20, 
-0x01, 0x23, 0x1b, 0x03, 0x13, 0x40, 0x3c, 0x4c, 0x03, 0xd0, 0x63, 0x6a, 
-0x01, 0x33, 0x63, 0x62, 0x09, 0xe0, 0x13, 0x0b, 0x03, 0xd3, 0x23, 0x6a, 
+0x1b, 0x68, 0xcc, 0x00, 0x6e, 0x46, 0x33, 0x51, 0x01, 0x23, 0x9b, 0x07, 
+0x06, 0x1d, 0x33, 0x43, 0x1b, 0x68, 0x6c, 0x44, 0x63, 0x60, 0x08, 0x30, 
+0x01, 0x31, 0x40, 0x9b, 0x83, 0x42, 0x00, 0xd8, 0x3f, 0x48, 0x03, 0x03, 
+0x1b, 0x0b, 0xab, 0x42, 0xe7, 0xd1, 0x00, 0x20, 0x01, 0x23, 0x1b, 0x03, 
+0x13, 0x40, 0x3c, 0x4c, 0x03, 0xd0, 0x63, 0x6a, 0x01, 0x33, 0x63, 0x62, 
+0x09, 0xe0, 0x13, 0x0b, 0x03, 0xd3, 0x23, 0x6a, 
 0x01, 0x33, 0x23, 0x62, 0x03, 0xe0, 0x37, 0x4b, 0x5c, 0x6d, 0x01, 0x34, 
 0x5c, 0x65, 0x00, 0x29, 0x09, 0xd0, 0x03, 0x1c, 0xdc, 0x00, 0x23, 0x1c, 
 0x6b, 0x44, 0x5c, 0x68, 0x01, 0x30, 0x23, 0x0d, 0x01, 0xd2, 0x88, 0x42, 
@@ -3363,12 +3015,12 @@
 0x12, 0x4b, 0xc0, 0x46, 0x2b, 0x67, 0x03, 0x1c, 0xdb, 0x00, 0x6b, 0x44, 
 0x5c, 0x68, 0x01, 0x30, 0x23, 0x0d, 0x04, 0xd3, 0x51, 0x24, 0xa4, 0x03, 
 0x2b, 0x6f, 0xc0, 0x46, 0xa3, 0x61, 0x88, 0x42, 0xde, 0xd1, 0x10, 0x0b, 
-0x03, 0xd3, 0x0e, 0x49, 0x01, 0x20, 0xfc, 0xf7, 0xc2, 0xfb, 0x41, 0xb0, 
+0x03, 0xd3, 0x0e, 0x49, 0x01, 0x20, 0xfd, 0xf7, 0x74, 0xfa, 0x41, 0xb0, 
 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 
 0x00, 0x01, 0x14, 0x40, 0x00, 0x40, 0x14, 0x40, 0x00, 0x00, 0x20, 0x40, 
 0x68, 0x0e, 0x00, 0x80, 0x24, 0xa7, 0x20, 0x40, 0xa4, 0x2a, 0x00, 0x80, 
 0xa0, 0x82, 0x20, 0x40, 0x00, 0x00, 0x10, 0x40, 0xc0, 0x00, 0x18, 0x00, 
-0xb5, 0x4f, 0xff, 0xff, 0xf0, 0xb4, 0x00, 0x21, 0x00, 0x23, 0x07, 0x22, 
+0xc9, 0x4f, 0xff, 0xff, 0xf0, 0xb4, 0x00, 0x21, 0x00, 0x23, 0x07, 0x22, 
 0x06, 0x24, 0x47, 0x4f, 0xc0, 0x46, 0x3c, 0x61, 0x3a, 0x61, 0x01, 0x33, 
 0x20, 0x2b, 0xf9, 0xd3, 0x04, 0x25, 0x3d, 0x61, 0x05, 0x23, 0x3b, 0x61, 
 0x3c, 0x61, 0x3a, 0x61, 0x3c, 0x61, 0x3a, 0x61, 0x3d, 0x61, 0x3b, 0x61, 
@@ -3385,12 +3037,12 @@
 0x02, 0x23, 0x1d, 0x40, 0x04, 0x23, 0x2b, 0x43, 0x3b, 0x61, 0x05, 0x23, 
 0x2b, 0x43, 0x3b, 0x61, 0x45, 0x08, 0x02, 0x23, 0x1d, 0x40, 0x04, 0x23, 
 0x2b, 0x43, 0x3b, 0x61, 0x05, 0x23, 0x2b, 0x43, 0x3b, 0x61, 0x02, 0x25, 
-0x05, 0x40, 0x04, 0x23, 0x2b, 0x43, 0x3b, 0x61, 
-0x05, 0x23, 0x2b, 0x43, 0x3b, 0x61, 0x40, 0x00, 0x02, 0x23, 0x18, 0x40, 
-0x04, 0x23, 0x03, 0x43, 0x3b, 0x61, 0x05, 0x23, 0x18, 0x43, 0x38, 0x61, 
-0x00, 0x25, 0x3d, 0x61, 0x01, 0x23, 0x3b, 0x61, 0x3d, 0x61, 0x3b, 0x61, 
-0x00, 0x20, 0x3d, 0x61, 0x0d, 0x4b, 0x1b, 0x69, 0x49, 0x00, 0x1e, 0x1c, 
-0x02, 0x23, 0x33, 0x40, 0x19, 0x43, 0x01, 0x23, 0x3b, 0x61, 0x01, 0x30, 
+0x05, 0x40, 0x04, 0x23, 0x2b, 0x43, 0x3b, 0x61, 0x05, 0x23, 0x2b, 0x43, 
+0x3b, 0x61, 0x40, 0x00, 0x02, 0x23, 0x18, 0x40, 0x04, 0x23, 0x03, 0x43, 
+0x3b, 0x61, 0x05, 0x23, 0x18, 0x43, 0x38, 0x61, 0x00, 0x25, 0x3d, 0x61, 
+0x01, 0x23, 0x3b, 0x61, 0x3d, 0x61, 0x3b, 0x61, 0x00, 0x20, 0x3d, 0x61, 
+0x0d, 0x4b, 0x1b, 0x69, 0x49, 0x00, 0x1e, 0x1c, 0x02, 0x23, 0x33, 0x40, 
+0x19, 0x43, 0x01, 0x23, 0x3b, 0x61, 0x01, 0x30, 
 0x10, 0x28, 0xf2, 0xd3, 0x02, 0x20, 0x38, 0x61, 0x03, 0x20, 0x38, 0x61, 
 0x3c, 0x61, 0x3a, 0x61, 0x3c, 0x61, 0x3a, 0x61, 0x38, 0x61, 0x48, 0x08, 
 0xf0, 0xbc, 0x70, 0x47, 0x80, 0x00, 0x14, 0x00, 0x68, 0x0e, 0x00, 0x80, 
@@ -3419,21 +3071,21 @@
 0x10, 0x28, 0xf1, 0xd3, 0x17, 0x61, 0x07, 0x23, 0x13, 0x61, 0x17, 0x61, 
 0x13, 0x61, 0x03, 0x20, 0x10, 0x61, 0xf0, 0xbc, 0x70, 0x47, 0x00, 0x00, 
 0x80, 0x00, 0x14, 0x00, 0x68, 0x0e, 0x00, 0x80, 0xf0, 0xb5, 0x4f, 0x4d, 
-0x08, 0x21, 0x02, 0x20, 0x2a, 0x1c, 0xfc, 0xf7, 0x75, 0xfa, 0x4d, 0x4c, 
+0x08, 0x21, 0x02, 0x20, 0x2a, 0x1c, 0xfd, 0xf7, 0x27, 0xf9, 0x4d, 0x4c, 
 0x71, 0x23, 0x5b, 0x01, 0xe7, 0x18, 0x38, 0x80, 0x1a, 0x21, 0x02, 0x20, 
-0x2a, 0x1c, 0xfc, 0xf7, 0x6b, 0xfa, 0x78, 0x80, 0x20, 0x79, 0x00, 0x28, 
+0x2a, 0x1c, 0xfd, 0xf7, 0x1d, 0xf9, 0x78, 0x80, 0x20, 0x79, 0x00, 0x28, 
 0x0b, 0xd0, 0x00, 0x20, 0x38, 0x80, 0xe0, 0x68, 0x01, 0x28, 0x10, 0xd1, 
 0x44, 0x48, 0x00, 0x68, 0x01, 0x23, 0x9b, 0x02, 0x18, 0x43, 0x99, 0x02, 
 0x08, 0x60, 0xe0, 0x68, 0x01, 0x28, 0x06, 0xd1, 0x60, 0x88, 0x00, 0x28, 
 0x03, 0xd1, 0xf9, 0x21, 0x12, 0x20, 0xff, 0xf7, 0x43, 0xff, 0x01, 0x21, 
 0xc9, 0x03, 0x00, 0x20, 0xff, 0xf7, 0x3e, 0xff, 0x00, 0x25, 0x7d, 0x26, 
 0xf6, 0x00, 0x00, 0xe0, 0x01, 0x35, 0x00, 0x20, 0xff, 0xf7, 0x9c, 0xfe, 
-0x00, 0x0c, 0x01, 0xd3, 0xb5, 0x42, 0xf7, 0xd3, 
-0x00, 0x25, 0x05, 0xe0, 0x03, 0x21, 0x09, 0x03, 0x00, 0x20, 0xff, 0xf7, 
-0x2b, 0xff, 0x01, 0x35, 0x00, 0x20, 0xff, 0xf7, 0x8d, 0xfe, 0x40, 0x0b, 
-0x01, 0xd2, 0xb5, 0x42, 0xf2, 0xd3, 0x04, 0x20, 0xff, 0xf7, 0x86, 0xfe, 
-0xff, 0x23, 0xe1, 0x33, 0x98, 0x43, 0x01, 0x21, 0x01, 0x43, 0x38, 0x88, 
-0xff, 0x23, 0x01, 0x33, 0x98, 0x42, 0x03, 0xd1, 0x2f, 0x23, 0x5b, 0x01, 
+0x00, 0x0c, 0x01, 0xd3, 0xb5, 0x42, 0xf7, 0xd3, 0x00, 0x25, 0x05, 0xe0, 
+0x03, 0x21, 0x09, 0x03, 0x00, 0x20, 0xff, 0xf7, 0x2b, 0xff, 0x01, 0x35, 
+0x00, 0x20, 0xff, 0xf7, 0x8d, 0xfe, 0x40, 0x0b, 0x01, 0xd2, 0xb5, 0x42, 
+0xf2, 0xd3, 0x04, 0x20, 0xff, 0xf7, 0x86, 0xfe, 0xff, 0x23, 0xe1, 0x33, 
+0x98, 0x43, 0x01, 0x21, 0x01, 0x43, 0x38, 0x88, 0xff, 0x23, 0x01, 0x33, 
+0x98, 0x42, 0x03, 0xd1, 0x2f, 0x23, 0x5b, 0x01, 
 0x19, 0x43, 0x16, 0xe0, 0x01, 0x28, 0x09, 0xd1, 0x78, 0x88, 0x01, 0x28, 
 0x03, 0xd1, 0x23, 0x23, 0x5b, 0x01, 0x19, 0x43, 0x0d, 0xe0, 0x20, 0x23, 
 0x19, 0x43, 0x0a, 0xe0, 0x00, 0x28, 0x08, 0xd1, 0x78, 0x88, 0x01, 0x28, 
@@ -3445,7 +3097,7 @@
 0xe3, 0xfe, 0x00, 0x27, 0x03, 0xe0, 0x08, 0x2f, 0x01, 0xd3, 0x0f, 0x2f, 
 0x08, 0xd9, 0x38, 0x1c, 0xff, 0xf7, 0x40, 0xfe, 0x79, 0x00, 0x09, 0x19, 
 0x1b, 0x23, 0xdb, 0x01, 0xc9, 0x18, 0x88, 0x83, 0x01, 0x37, 0x20, 0x2f, 
-0xef, 0xd3, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x79, 0xbf, 0x21, 0x40, 
+0xef, 0xd3, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xed, 0xaf, 0x21, 0x40, 
 0x68, 0x0e, 0x00, 0x80, 0x00, 0x00, 0x10, 0x40, 0x81, 0xb0, 0x13, 0x48, 
 0x01, 0x68, 0xc0, 0x46, 0x00, 0x91, 0x41, 0x68, 0xc0, 0x46, 0x00, 0x91, 
 0x81, 0x68, 0xc0, 0x46, 0x00, 0x91, 0xc1, 0x68, 0xc0, 0x46, 0x00, 0x91, 
@@ -3471,12 +3123,12 @@
 0x16, 0xd1, 0x51, 0x8b, 0xc9, 0x08, 0x13, 0xd2, 0x0f, 0xe0, 0x51, 0x8b, 
 0x09, 0x09, 0x0f, 0xd2, 0x0b, 0xe0, 0x0a, 0x79, 0x00, 0x2a, 0x0b, 0xd1, 
 0x6d, 0x23, 0x5b, 0x01, 0xc9, 0x18, 0x8a, 0x88, 0xc9, 0x88, 0x11, 0x40, 
-0x49, 0x09, 0x09, 0x07, 0x02, 0xd1, 0x04, 0x23, 
-0x98, 0x43, 0xf8, 0x83, 0xf8, 0x8b, 0x04, 0x21, 0x01, 0x40, 0x02, 0x9a, 
-0x1f, 0xd0, 0xb9, 0x8b, 0x4a, 0x0b, 0x27, 0xd3, 0x80, 0x09, 0x25, 0xd3, 
-0xff, 0x23, 0x01, 0x98, 0x01, 0x33, 0x98, 0x42, 0x20, 0xd0, 0x00, 0x25, 
-0x00, 0x98, 0x01, 0x28, 0x00, 0xd1, 0x05, 0x02, 0x01, 0x98, 0x00, 0x28, 
-0x02, 0xd1, 0x01, 0x23, 0x5b, 0x03, 0x1d, 0x43, 0xa9, 0x42, 0x13, 0xd0, 
+0x49, 0x09, 0x09, 0x07, 0x02, 0xd1, 0x04, 0x23, 0x98, 0x43, 0xf8, 0x83, 
+0xf8, 0x8b, 0x04, 0x21, 0x01, 0x40, 0x02, 0x9a, 0x1f, 0xd0, 0xb9, 0x8b, 
+0x4a, 0x0b, 0x27, 0xd3, 0x80, 0x09, 0x25, 0xd3, 0xff, 0x23, 0x01, 0x98, 
+0x01, 0x33, 0x98, 0x42, 0x20, 0xd0, 0x00, 0x25, 0x00, 0x98, 0x01, 0x28, 
+0x00, 0xd1, 0x05, 0x02, 0x01, 0x98, 0x00, 0x28, 0x02, 0xd1, 0x01, 0x23, 
+0x5b, 0x03, 0x1d, 0x43, 0xa9, 0x42, 0x13, 0xd0, 
 0x00, 0x20, 0x29, 0x1c, 0xff, 0xf7, 0x10, 0xfe, 0xbd, 0x83, 0x00, 0x20, 
 0xc0, 0x43, 0x60, 0x62, 0x0a, 0xe0, 0xb8, 0x8b, 0x40, 0x0b, 0x07, 0xd2, 
 0x09, 0x21, 0x49, 0x02, 0x00, 0x20, 0xff, 0xf7, 0x03, 0xfe, 0x09, 0x20, 
@@ -3504,7 +3156,7 @@
 0xff, 0xf7, 0xde, 0xff, 0x01, 0x1c, 0x05, 0x20, 0x00, 0x90, 0x00, 0x20, 
 0x01, 0xab, 0x18, 0x80, 0x04, 0x3b, 0x58, 0x70, 0x1b, 0x22, 0x00, 0xab, 
 0x5a, 0x80, 0xd9, 0x80, 0x05, 0x49, 0xc9, 0x6d, 0xc0, 0x46, 0x02, 0x91, 
-0x03, 0x90, 0x68, 0x46, 0x00, 0x21, 0xfc, 0xf7, 0xd5, 0xf9, 0x04, 0xb0, 
+0x03, 0x90, 0x68, 0x46, 0x00, 0x21, 0xfd, 0xf7, 0x79, 0xf8, 0x04, 0xb0, 
 0x08, 0xbc, 0x18, 0x47, 0xa4, 0x2a, 0x00, 0x80, 0x0f, 0x48, 0x01, 0x68, 
 0x49, 0x0c, 0x05, 0xd2, 0x01, 0x68, 0x09, 0x0c, 0x06, 0xd1, 0x00, 0x68, 
 0x80, 0x0a, 0x03, 0xd3, 0x0b, 0x48, 0x00, 0x68, 0x00, 0x0c, 0x01, 0xe0, 
@@ -3514,12 +3166,12 @@
 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x18, 0x40, 0x00, 0x00, 0x00, 0x80, 
 0x04, 0x99, 0x00, 0x00, 0x07, 0x99, 0x00, 0x00, 0x90, 0xb4, 0x01, 0x24, 
 0x21, 0x1c, 0x18, 0x48, 0x02, 0x68, 0x52, 0x0c, 0x06, 0xd2, 0x02, 0x68, 
-0x12, 0x0c, 0x02, 0xd1, 0x00, 0x68, 0x80, 0x0a, 
-0x00, 0xd2, 0x00, 0x21, 0x09, 0x06, 0x09, 0x0e, 0x12, 0x4f, 0x13, 0x4a, 
-0x02, 0xd0, 0x38, 0x68, 0x00, 0x0c, 0x00, 0xe0, 0x90, 0x6c, 0x00, 0x04, 
-0x00, 0x0c, 0x10, 0x4b, 0x98, 0x42, 0x08, 0xd0, 0x02, 0x33, 0x98, 0x42, 
-0x05, 0xd0, 0x0e, 0x4b, 0x98, 0x42, 0x02, 0xd0, 0x02, 0x3b, 0x98, 0x42, 
-0x0c, 0xd1, 0x00, 0x29, 0x02, 0xd0, 0xf8, 0x6a, 0x00, 0x0c, 0x00, 0xe0, 
+0x12, 0x0c, 0x02, 0xd1, 0x00, 0x68, 0x80, 0x0a, 0x00, 0xd2, 0x00, 0x21, 
+0x09, 0x06, 0x09, 0x0e, 0x12, 0x4f, 0x13, 0x4a, 0x02, 0xd0, 0x38, 0x68, 
+0x00, 0x0c, 0x00, 0xe0, 0x90, 0x6c, 0x00, 0x04, 0x00, 0x0c, 0x10, 0x4b, 
+0x98, 0x42, 0x08, 0xd0, 0x02, 0x33, 0x98, 0x42, 0x05, 0xd0, 0x0e, 0x4b, 
+0x98, 0x42, 0x02, 0xd0, 0x02, 0x3b, 0x98, 0x42, 0x0c, 0xd1, 0x00, 0x29, 
+0x02, 0xd0, 0xf8, 0x6a, 0x00, 0x0c, 0x00, 0xe0, 
 0xd0, 0x6c, 0x40, 0x0a, 0x00, 0xd2, 0x00, 0x24, 0x20, 0x06, 0x00, 0x0e, 
 0x90, 0xbc, 0x70, 0x47, 0x00, 0x20, 0xfb, 0xe7, 0x00, 0x00, 0x10, 0x40, 
 0x00, 0x00, 0x18, 0x40, 0x00, 0x00, 0x00, 0x80, 0x04, 0x99, 0x00, 0x00, 
@@ -3549,47 +3201,36 @@
 0x5b, 0x00, 0x9f, 0x44, 0x05, 0x03, 0x07, 0x03, 0x07, 0x07, 0x05, 0x03, 
 0x03, 0x20, 0x02, 0xe0, 0x01, 0x20, 0x00, 0xe0, 0x00, 0x20, 0x01, 0x21, 
 0x38, 0x60, 0x80, 0x07, 0x00, 0xd1, 0x00, 0x21, 0x08, 0x06, 0x00, 0x0e, 
-0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x98, 0x6e, 0x21, 0x40, 
+0x80, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x34, 0x6e, 0x21, 0x40, 
 0x00, 0x00, 0x11, 0x40, 0x00, 0x00, 0x10, 0x40, 0x00, 0x00, 0x18, 0x40, 
-0x00, 0x00, 0x00, 0x80, 0xfe, 0x66, 0xff, 0xff, 0xf0, 0xb5, 0x83, 0xb0, 
-0x07, 0x1c, 0x01, 0x20, 0x02, 0x90, 0x01, 0x25, 0x02, 0x24, 0x10, 0x26, 
-0x20, 0x21, 0x00, 0x91, 0xff, 0xf7, 0xe2, 0xfe, 0x01, 0x28, 0x4d, 0xd1, 
-0x38, 0x2f, 0x01, 0xd0, 0xa8, 0x2f, 0x3a, 0xd1, 0x2e, 0x4e, 0x3c, 0x21, 
-0x02, 0x20, 0x32, 0x1c, 0xfb, 0xf7, 0x4c, 0xff, 0x3e, 0x21, 0x05, 0x1c, 
-0x02, 0x20, 0x32, 0x1c, 0xfb, 0xf7, 0x46, 0xff, 0x00, 0x04, 0x05, 0x43, 
-0x40, 0x21, 0x02, 0x20, 0x32, 0x1c, 0xfb, 0xf7, 
-0x3f, 0xff, 0x01, 0x90, 0x42, 0x21, 0x02, 0x20, 0x32, 0x1c, 0xfb, 0xf7, 
-0x39, 0xff, 0x00, 0x04, 0x01, 0x99, 0x08, 0x43, 0x06, 0x1c, 0xa8, 0x2f, 
-0x1b, 0xd1, 0x1f, 0x4a, 0x44, 0x21, 0x02, 0x20, 0xfb, 0xf7, 0x2e, 0xff, 
-0x04, 0x1c, 0x1c, 0x4a, 0x46, 0x21, 0x02, 0x20, 0xfb, 0xf7, 0x28, 0xff, 
-0x00, 0x04, 0x04, 0x43, 0x18, 0x4a, 0x48, 0x21, 0x02, 0x20, 0xfb, 0xf7, 
-0x21, 0xff, 0x00, 0x90, 0x15, 0x4a, 0x4a, 0x21, 0x02, 0x20, 0xfb, 0xf7, 
-0x1b, 0xff, 0x00, 0x04, 0x00, 0x99, 0x01, 0x43, 0x00, 0x91, 0x28, 0x1c, 
-0x30, 0x43, 0x20, 0x43, 0x00, 0x99, 0x08, 0x43, 0x00, 0xd1, 0x16, 0xe0, 
-0x11, 0x20, 0x00, 0x04, 0x05, 0x62, 0x46, 0x62, 0x84, 0x62, 0x00, 0x99, 
-0xc0, 0x46, 0xc1, 0x62, 0x00, 0x21, 0x0a, 0x48, 0xc0, 0x46, 0x01, 0x60, 
-0x38, 0x2f, 0x01, 0xd0, 0xa8, 0x2f, 0x05, 0xd1, 0x01, 0x21, 0x01, 0x60, 
-0xa8, 0x2f, 0x01, 0xd1, 0x03, 0x21, 0x01, 0x60, 0x02, 0x98, 0x03, 0xb0, 
-0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x79, 0xbf, 0x21, 0x40, 
-0x98, 0x6e, 0x21, 0x40, 0x70, 0x47, 0x00, 0x00, 0x70, 0x47, 0x00, 0x00, 
-0x90, 0xb5, 0x07, 0x1c, 0x12, 0x4c, 0x21, 0x68, 0x12, 0x48, 0x81, 0x42, 
-0x0b, 0xd0, 0x00, 0x23, 0x21, 0x1c, 0xe2, 0x1d, 0xc5, 0x32, 0x00, 0xe0, 
-0x08, 0xc1, 0x91, 0x42, 0xfc, 0xd3, 0x20, 0x60, 0xcc, 0x20, 0xa0, 0x80, 
+0x00, 0x00, 0x00, 0x80, 0xfe, 0x66, 0xff, 0xff, 0xf0, 0xb5, 0x82, 0xb0, 
+0x07, 0x1c, 0x01, 0x20, 0x01, 0x90, 0xff, 0xf7, 0xe7, 0xfe, 0x01, 0x28, 
+0x13, 0xd1, 0x38, 0x2f, 0x01, 0xd0, 0xa8, 0x2f, 0x07, 0xd1, 0x00, 0x26, 
+0xf6, 0x43, 0x34, 0x1c, 0xa8, 0x2f, 0x02, 0xd1, 0x30, 0x1c, 0x00, 0x96, 
+0x35, 0x1c, 0x11, 0x20, 0x00, 0x04, 0x06, 0x62, 0x44, 0x62, 0x85, 0x62, 
+0x00, 0x99, 0xc0, 0x46, 0xc1, 0x62, 0x00, 0x21, 0x08, 0x48, 0xc0, 0x46, 
+0x01, 0x60, 0x38, 0x2f, 0x01, 0xd0, 0xa8, 0x2f, 0x05, 0xd1, 0x01, 0x21, 
+0x01, 0x60, 0xa8, 0x2f, 0x01, 0xd1, 0x03, 0x21, 0x01, 0x60, 0x01, 0x98, 
+0x02, 0xb0, 0xf0, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x34, 0x6e, 0x21, 0x40, 
+0x70, 0x47, 0x00, 0x00, 0x70, 0x47, 0x00, 0x00, 0x90, 0xb5, 0x07, 0x1c, 
+0x12, 0x4c, 0x21, 0x68, 0x12, 0x48, 0x81, 0x42, 0x0b, 0xd0, 0x00, 0x23, 
+0x21, 0x1c, 0xe2, 0x1d, 0xc1, 0x32, 0x00, 0xe0, 
+0x08, 0xc1, 0x91, 0x42, 0xfc, 0xd3, 0x20, 0x60, 0xc8, 0x20, 0xa0, 0x80, 
 0x67, 0x72, 0x38, 0x01, 0x00, 0xf0, 0x18, 0xf8, 0x27, 0x72, 0x0a, 0x48, 
 0xc0, 0x46, 0xe0, 0x60, 0x09, 0x2f, 0x00, 0xdb, 0x00, 0x27, 0xe0, 0x19, 
 0x01, 0x7d, 0x01, 0x31, 0x01, 0x75, 0xe0, 0x88, 0x01, 0x30, 0xe0, 0x80, 
 0x01, 0x20, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x00, 0x00, 0x00, 0x80, 
-0xee, 0xff, 0xc0, 0xd0, 0x02, 0x10, 0x00, 0x03, 0x80, 0xb4, 0x08, 0x4a, 
-0xd1, 0x1d, 0x89, 0x31, 0x0b, 0x7b, 0x20, 0x2b, 0x01, 0xd3, 0x00, 0x23, 
-0x0b, 0x73, 0x07, 0x1c, 0x08, 0x7b, 0x43, 0x1c, 0x0b, 0x73, 0x80, 0x18, 
-0x90, 0x30, 0x47, 0x73, 0x80, 0xbc, 0x70, 0x47, 0x00, 0x00, 0x00, 0x80, 
+0xee, 0xff, 0xc0, 0xd0, 0x08, 0x10, 0x00, 0x03, 0x80, 0xb4, 0x08, 0x4a, 
+0xd1, 0x1d, 0x89, 0x31, 0x0b, 0x7a, 0x20, 0x2b, 0x01, 0xd3, 0x00, 0x23, 
+0x0b, 0x72, 0x07, 0x1c, 0x08, 0x7a, 0x43, 0x1c, 0x0b, 0x72, 0x80, 0x18, 
+0x90, 0x30, 0x47, 0x72, 0x80, 0xbc, 0x70, 0x47, 0x00, 0x00, 0x00, 0x80, 
 0x07, 0x49, 0x01, 0x22, 0x12, 0x04, 0x08, 0x68, 0x02, 0x40, 0x01, 0x20, 
 0x00, 0x2a, 0x06, 0xd1, 0x0a, 0x68, 0x12, 0x0c, 0x02, 0xd1, 0x09, 0x68, 
 0x89, 0x0a, 0x00, 0xd2, 0x00, 0x20, 0x70, 0x47, 0x00, 0x00, 0x10, 0x40, 
 0x90, 0xb5, 0x07, 0x1c, 0x09, 0x4c, 0x38, 0x1c, 0x21, 0x1c, 0xfc, 0xf7, 
-0xab, 0xf8, 0x38, 0x1c, 0x00, 0xf0, 0x0e, 0xf8, 0x01, 0x23, 0xd8, 0x42, 
-0x01, 0xd1, 0x00, 0x0c, 0xe0, 0x80, 0x00, 0x21, 0x20, 0x1c, 0xfb, 0xf7, 
-0xdf, 0xff, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0x70, 0x67, 0x21, 0x40, 
+0x91, 0xff, 0x38, 0x1c, 0x00, 0xf0, 0x0e, 0xf8, 0x01, 0x23, 0xd8, 0x42, 
+0x01, 0xd1, 0x00, 0x0c, 0xe0, 0x80, 0x00, 0x21, 0x20, 0x1c, 0xfc, 0xf7, 
+0xc5, 0xfe, 0x90, 0xbc, 0x08, 0xbc, 0x18, 0x47, 0xc4, 0x66, 0x21, 0x40, 
 0xf8, 0xb5, 0x07, 0x1c, 0x79, 0x7a, 0x76, 0x48, 0x00, 0x23, 0x76, 0x4c, 
 0x01, 0x29, 0x5d, 0xd1, 0xa2, 0x88, 0xc0, 0x46, 0x00, 0x92, 0xa1, 0x89, 
 0x8a, 0x42, 0x74, 0xda, 0xfa, 0x7a, 0x00, 0x2a, 0x15, 0xd0, 0x7a, 0x6c, 
@@ -3600,23 +3241,23 @@
 0x12, 0x0c, 0x22, 0x80, 0x8a, 0x42, 0x00, 0xdb, 0x23, 0x80, 0x00, 0x22, 
 0x00, 0x29, 0x69, 0xdd, 0x5f, 0x4c, 0xa4, 0x6a, 0x5e, 0x4b, 0x1d, 0x88, 
 0x58, 0x23, 0x6b, 0x43, 0xe3, 0x18, 0xde, 0x1d, 0x01, 0x36, 0x01, 0x23, 
-0x9b, 0x07, 0x33, 0x43, 0x1b, 0x68, 0x1b, 0x06, 
-0x15, 0xd1, 0x58, 0x49, 0x00, 0x9a, 0x01, 0x32, 0x8a, 0x80, 0x8a, 0x88, 
-0xc0, 0x46, 0x42, 0x81, 0x08, 0x88, 0x01, 0x30, 0x54, 0x4e, 0xc0, 0x46, 
-0xf0, 0x80, 0x58, 0x20, 0x68, 0x43, 0x21, 0x18, 0x38, 0x1c, 0x00, 0xf0, 
-0x8d, 0xfa, 0xf0, 0x88, 0x00, 0x04, 0x00, 0x14, 0x95, 0xe0, 0x4d, 0x4b, 
-0x01, 0x35, 0x2d, 0x04, 0x2d, 0x0c, 0x1d, 0x80, 0x8d, 0x42, 0x01, 0xdb, 
-0x00, 0x25, 0x1d, 0x80, 0x01, 0x32, 0x12, 0x04, 0x12, 0x14, 0x91, 0x42, 
-0xce, 0xdc, 0x81, 0xe0, 0xe1, 0x88, 0xe2, 0x89, 0x91, 0x42, 0x18, 0xda, 
-0xf9, 0x7a, 0x00, 0x29, 0x2f, 0xd0, 0x79, 0x6c, 0x49, 0x04, 0x49, 0x0c, 
-0x79, 0x64, 0x2a, 0xd0, 0xe2, 0x89, 0x91, 0x42, 0x27, 0xd8, 0xe1, 0x88, 
-0x01, 0x31, 0xe1, 0x80, 0xe1, 0x88, 0xc0, 0x46, 0x81, 0x81, 0x01, 0x23, 
-0xdb, 0x03, 0x78, 0x6c, 0x18, 0x43, 0x3a, 0x4e, 0xc0, 0x46, 0xf0, 0x80, 
-0x00, 0xe0, 0x63, 0xe0, 0xe0, 0x6a, 0x79, 0x6c, 0x4b, 0x00, 0x59, 0x18, 
-0x49, 0x01, 0x40, 0x18, 0xc1, 0x1f, 0x59, 0x39, 0x38, 0x1c, 0x00, 0xf0, 
-0x79, 0xfa, 0xe0, 0x6a, 0x79, 0x6c, 0x4a, 0x00, 0x52, 0x18, 0x52, 0x01, 
-0x80, 0x18, 0x01, 0x39, 0x09, 0x04, 0x09, 0x0c, 0x60, 0x38, 0x00, 0xf0, 
-0xf3, 0xfa, 0xb6, 0xe7, 0x4a, 0xe0, 0x61, 0x88, 0x01, 0x31, 0x09, 0x04, 
+0x9b, 0x07, 0x33, 0x43, 0x1b, 0x68, 0x1b, 0x06, 0x15, 0xd1, 0x58, 0x49, 
+0x00, 0x9a, 0x01, 0x32, 0x8a, 0x80, 0x8a, 0x88, 0xc0, 0x46, 0x42, 0x81, 
+0x08, 0x88, 0x01, 0x30, 0x54, 0x4e, 0xc0, 0x46, 0xf0, 0x80, 0x58, 0x20, 
+0x68, 0x43, 0x21, 0x18, 0x38, 0x1c, 0x00, 0xf0, 0x39, 0xfb, 0xf0, 0x88, 
+0x00, 0x04, 0x00, 0x14, 0x95, 0xe0, 0x4d, 0x4b, 0x01, 0x35, 0x2d, 0x04, 
+0x2d, 0x0c, 0x1d, 0x80, 0x8d, 0x42, 0x01, 0xdb, 0x00, 0x25, 0x1d, 0x80, 
+0x01, 0x32, 0x12, 0x04, 0x12, 0x14, 0x91, 0x42, 0xce, 0xdc, 0x81, 0xe0, 
+0xe1, 0x88, 0xe2, 0x89, 0x91, 0x42, 0x18, 0xda, 0xf9, 0x7a, 0x00, 0x29, 
+0x2f, 0xd0, 0x79, 0x6c, 0x49, 0x04, 0x49, 0x0c, 0x79, 0x64, 0x2a, 0xd0, 
+0xe2, 0x89, 0x91, 0x42, 0x27, 0xd8, 0xe1, 0x88, 0x01, 0x31, 0xe1, 0x80, 
+0xe1, 0x88, 0xc0, 0x46, 0x81, 0x81, 0x01, 0x23, 0xdb, 0x03, 0x78, 0x6c, 
+0x18, 0x43, 0x3a, 0x4e, 0xc0, 0x46, 0xf0, 0x80, 0x00, 0xe0, 0x63, 0xe0, 
+0xe0, 0x6a, 0x79, 0x6c, 0x4b, 0x00, 0x59, 0x18, 0x49, 0x01, 0x40, 0x18, 
+0xc1, 0x1f, 0x59, 0x39, 0x38, 0x1c, 0x00, 0xf0, 0x0f, 0xfb, 0xe0, 0x6a, 
+0x79, 0x6c, 0x4a, 0x00, 0x52, 0x18, 0x52, 0x01, 0x80, 0x18, 0x01, 0x39, 
+0x09, 0x04, 0x09, 0x0c, 0x60, 0x38, 0x00, 0xf0, 0x89, 0xfb, 0xb6, 0xe7, 
+0x4a, 0xe0, 0x61, 0x88, 0x01, 0x31, 0x09, 0x04, 
 0x09, 0x0c, 0x61, 0x80, 0xe2, 0x89, 0x91, 0x42, 0x00, 0xdb, 0x63, 0x80, 
 0x00, 0x21, 0x00, 0x2a, 0x3e, 0xdd, 0x24, 0x4c, 0xe4, 0x6a, 0x23, 0x4b, 
 0x5d, 0x88, 0x6b, 0x00, 0x5b, 0x19, 0x5b, 0x01, 0xe3, 0x18, 0xde, 0x1d, 
@@ -3624,14 +3265,14 @@
 0x20, 0xd1, 0x1c, 0x4e, 0xf1, 0x88, 0x01, 0x31, 0xf1, 0x80, 0xf1, 0x88, 
 0xc0, 0x46, 0x81, 0x81, 0x70, 0x88, 0x01, 0x23, 0xdb, 0x03, 0x01, 0x30, 
 0x18, 0x43, 0x17, 0x49, 0xc0, 0x46, 0xc8, 0x80, 0x68, 0x00, 0x40, 0x19, 
-0x40, 0x01, 0x21, 0x18, 0x38, 0x1c, 0x00, 0xf0, 0x39, 0xfa, 0x71, 0x88, 
+0x40, 0x01, 0x21, 0x18, 0x38, 0x1c, 0x00, 0xf0, 0xcf, 0xfa, 0x71, 0x88, 
 0x4a, 0x00, 0x52, 0x18, 0x52, 0x01, 0xf0, 0x6a, 0x80, 0x18, 0x00, 0xf0, 
-0xb7, 0xfa, 0x0e, 0x49, 0xc8, 0x88, 0x79, 0xe7, 0x0b, 0x4b, 0x01, 0x35, 
+0x4d, 0xfb, 0x0e, 0x49, 0xc8, 0x88, 0x79, 0xe7, 0x0b, 0x4b, 0x01, 0x35, 
 0x2d, 0x04, 0x2d, 0x0c, 0x5d, 0x80, 0x95, 0x42, 0x01, 0xdb, 0x00, 0x25, 
 0x5d, 0x80, 0x01, 0x31, 0x09, 0x04, 0x09, 0x14, 0x8a, 0x42, 0xc2, 0xdc, 
 0x01, 0x89, 0x01, 0x31, 0x01, 0x81, 0x00, 0x20, 0xc0, 0x43, 0xf8, 0xbc, 
 0x08, 0xbc, 0x18, 0x47, 0x4c, 0x2b, 0x00, 0x80, 0x4c, 0x2a, 0x00, 0x80, 
-0x70, 0x67, 0x21, 0x40, 0xf0, 0xb4, 0x06, 0x1c, 0x01, 0x23, 0xdb, 0x03, 
+0xc4, 0x66, 0x21, 0x40, 0xf0, 0xb4, 0x06, 0x1c, 0x01, 0x23, 0xdb, 0x03, 
 0x33, 0x40, 0x01, 0x24, 0x44, 0x4f, 0x00, 0x20, 0x44, 0x4a, 0x45, 0x4d, 
 0xd1, 0x1d, 0x39, 0x31, 0x00, 0x2b, 0x41, 0xd0, 0xe3, 0x03, 0xf3, 0x1a, 
 0x73, 0xd0, 0xee, 0x89, 0x9e, 0x42, 0x71, 0xd3, 0xee, 0x88, 0x00, 0x2e, 
@@ -3643,23 +3284,23 @@
 0xd2, 0x18, 0x90, 0x63, 0xf2, 0x6a, 0xd2, 0x18, 0xd0, 0x63, 0xf2, 0x6a, 
 0xd2, 0x18, 0x10, 0x64, 0xf2, 0x6a, 0xd2, 0x18, 0x50, 0x64, 0xf2, 0x6a, 
 0xd2, 0x18, 0x90, 0x64, 0xf2, 0x6a, 0xd2, 0x18, 0xd0, 0x64, 0xf0, 0x88, 
-0x01, 0x38, 0xf0, 0x80, 0xf0, 0x88, 0xc0, 0x46, 
-0x88, 0x81, 0x24, 0x49, 0x00, 0x28, 0x39, 0xd1, 0x4f, 0x80, 0x37, 0xe0, 
-0x00, 0x2e, 0x38, 0xd9, 0xab, 0x89, 0xb3, 0x42, 0x30, 0xd3, 0xab, 0x88, 
-0x00, 0x2b, 0x2c, 0xd0, 0x53, 0x89, 0x01, 0x33, 0x53, 0x81, 0x2a, 0x1c, 
-0xad, 0x6a, 0x58, 0x23, 0x01, 0x3e, 0x73, 0x43, 0xed, 0x18, 0xae, 0x68, 
-0x36, 0x06, 0x36, 0x0e, 0x03, 0x2e, 0x02, 0xd0, 0xce, 0x89, 0x01, 0x36, 
-0xce, 0x81, 0xa8, 0x60, 0x95, 0x6a, 0xed, 0x18, 0xa8, 0x63, 0x95, 0x6a, 
-0xed, 0x18, 0xe8, 0x63, 0x95, 0x6a, 0xed, 0x18, 0x28, 0x64, 0x95, 0x6a, 
-0xed, 0x18, 0x68, 0x64, 0x95, 0x6a, 0xed, 0x18, 0xa8, 0x64, 0x95, 0x6a, 
-0xeb, 0x18, 0xd8, 0x64, 0x90, 0x88, 0x01, 0x38, 0x90, 0x80, 0x90, 0x88, 
-0xc0, 0x46, 0x48, 0x81, 0x00, 0x28, 0x03, 0xd1, 0x01, 0xe0, 0x04, 0xe0, 
-0x03, 0xe0, 0x17, 0x80, 0x20, 0x1c, 0xf0, 0xbc, 0x70, 0x47, 0xca, 0x89, 
-0x01, 0x32, 0xca, 0x81, 0xf9, 0xe7, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 
-0x0c, 0x2b, 0x00, 0x80, 0x4c, 0x2a, 0x00, 0x80, 0x00, 0xb5, 0x00, 0x21, 
-0x41, 0x60, 0x10, 0x49, 0x4a, 0x68, 0x00, 0x2a, 0x10, 0xd1, 0xca, 0x68, 
-0x00, 0x2a, 0x04, 0xd0, 0xca, 0x1d, 0x19, 0x32, 0x12, 0x79, 0x00, 0x2a, 
-0x08, 0xd0, 0x4a, 0x69, 0x00, 0x2a, 0x0b, 0xd1, 0x88, 0x61, 0x48, 0x61, 
+0x01, 0x38, 0xf0, 0x80, 0xf0, 0x88, 0xc0, 0x46, 0x88, 0x81, 0x24, 0x49, 
+0x00, 0x28, 0x39, 0xd1, 0x4f, 0x80, 0x37, 0xe0, 0x00, 0x2e, 0x38, 0xd9, 
+0xab, 0x89, 0xb3, 0x42, 0x30, 0xd3, 0xab, 0x88, 0x00, 0x2b, 0x2c, 0xd0, 
+0x53, 0x89, 0x01, 0x33, 0x53, 0x81, 0x2a, 0x1c, 0xad, 0x6a, 0x58, 0x23, 
+0x01, 0x3e, 0x73, 0x43, 0xed, 0x18, 0xae, 0x68, 0x36, 0x06, 0x36, 0x0e, 
+0x03, 0x2e, 0x02, 0xd0, 0xce, 0x89, 0x01, 0x36, 0xce, 0x81, 0xa8, 0x60, 
+0x95, 0x6a, 0xed, 0x18, 0xa8, 0x63, 0x95, 0x6a, 0xed, 0x18, 0xe8, 0x63, 
+0x95, 0x6a, 0xed, 0x18, 0x28, 0x64, 0x95, 0x6a, 0xed, 0x18, 0x68, 0x64, 
+0x95, 0x6a, 0xed, 0x18, 0xa8, 0x64, 0x95, 0x6a, 0xeb, 0x18, 0xd8, 0x64, 
+0x90, 0x88, 0x01, 0x38, 0x90, 0x80, 0x90, 0x88, 0xc0, 0x46, 0x48, 0x81, 
+0x00, 0x28, 0x03, 0xd1, 0x01, 0xe0, 0x04, 0xe0, 0x03, 0xe0, 0x17, 0x80, 
+0x20, 0x1c, 0xf0, 0xbc, 0x70, 0x47, 0xca, 0x89, 0x01, 0x32, 0xca, 0x81, 
+0xf9, 0xe7, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x0c, 0x2b, 0x00, 0x80, 
+0x4c, 0x2a, 0x00, 0x80, 0x00, 0xb5, 0x00, 0x21, 0x41, 0x60, 0x10, 0x49, 
+0x4a, 0x68, 0x00, 0x2a, 0x10, 0xd1, 0xca, 0x68, 0x00, 0x2a, 0x04, 0xd0, 
+0xca, 0x1d, 0x19, 0x32, 0x12, 0x79, 0x00, 0x2a, 0x08, 0xd0, 0x4a, 0x69, 
+0x00, 0x2a, 0x0b, 0xd1, 0x88, 0x61, 0x48, 0x61, 
 0x00, 0xf0, 0x10, 0xf8, 0x08, 0xbc, 0x18, 0x47, 0x4a, 0x69, 0x00, 0x2a, 
 0x02, 0xd1, 0x88, 0x61, 0x48, 0x61, 0xf7, 0xe7, 0x8a, 0x69, 0xc0, 0x46, 
 0x50, 0x60, 0x88, 0x61, 0xf2, 0xe7, 0x00, 0x00, 0x6c, 0x06, 0x00, 0x80, 
@@ -3677,32 +3318,32 @@
 0x01, 0x31, 0x91, 0x42, 0xf4, 0xd3, 0x10, 0x29, 0x07, 0xd2, 0x8a, 0x00, 
 0xd2, 0x18, 0xff, 0x32, 0x01, 0x32, 0x57, 0x62, 0x01, 0x31, 0x10, 0x29, 
 0xf7, 0xd3, 0x11, 0x49, 0x00, 0xf0, 0x22, 0xf8, 0xb0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0x6c, 0x06, 0x00, 0x80, 0x1c, 0xad, 0x20, 0x40, 
+0x18, 0x47, 0x00, 0x00, 0x6c, 0x06, 0x00, 0x80, 0xac, 0xab, 0x20, 0x40, 
 0x28, 0x01, 0x40, 0x00, 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 
 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, 0x20, 0x01, 0x40, 0x00, 
 0x67, 0x45, 0x23, 0x01, 0xef, 0xcd, 0xab, 0x89, 0x98, 0xba, 0xdc, 0xfe, 
 0x10, 0x32, 0x54, 0x76, 0xc3, 0xd2, 0xe1, 0xf0, 0x36, 0x36, 0x36, 0x36, 
 0x30, 0x80, 0x20, 0x40, 0xb0, 0xb5, 0x0f, 0x1c, 0x15, 0x4d, 0xe9, 0x1d, 
-0xc9, 0x31, 0x15, 0x4c, 0x23, 0x1c, 0x15, 0x4a, 0x00, 0x20, 0xfb, 0xf7, 
-0x50, 0xfc, 0xe9, 0x1d, 0xff, 0x31, 0x1e, 0x31, 0x23, 0x1c, 0x0d, 0x1c, 
-0x11, 0x4a, 0x01, 0x20, 0xfb, 0xf7, 0x47, 0xfc, 0x29, 0x1c, 0x23, 0x1c, 
-0x0e, 0x4a, 0x00, 0x20, 0xfb, 0xf7, 0x41, 0xfc, 
-0x39, 0x1c, 0x23, 0x1c, 0x0c, 0x4a, 0x01, 0x20, 0xfb, 0xf7, 0x3b, 0xfc, 
-0x00, 0x21, 0x0b, 0x48, 0xc2, 0x1d, 0x19, 0x32, 0x51, 0x71, 0x01, 0x21, 
-0xff, 0x30, 0x01, 0x30, 0x41, 0x62, 0x08, 0x1c, 0xb0, 0xbc, 0x08, 0xbc, 
-0x18, 0x47, 0x00, 0x00, 0x1c, 0xad, 0x20, 0x40, 0x75, 0x08, 0xff, 0xff, 
-0x28, 0x00, 0x03, 0x00, 0x40, 0x00, 0x02, 0x00, 0x14, 0x00, 0x07, 0x00, 
-0x6c, 0x06, 0x00, 0x80, 0xf0, 0xb5, 0x37, 0x4a, 0x50, 0x69, 0x01, 0x23, 
-0x9b, 0x07, 0x08, 0x30, 0x18, 0x43, 0x00, 0x68, 0x01, 0x06, 0x09, 0x0e, 
-0x33, 0x4b, 0x01, 0x29, 0x49, 0xd1, 0x1f, 0x68, 0x19, 0x1c, 0x32, 0x4b, 
-0x9f, 0x42, 0x04, 0xd1, 0xff, 0xf7, 0x3e, 0xff, 0xf 0x00, 0x80, 0xac, 0xab, 0x20, 0x40, 
 0x28, 0xdd, 0x20x00, A( 0x4b, 0 , 0xba, a03"8, 0x1c, 0)90xe0,  0x80, 0xac, 0xab, 0x20, 0x40, 3x1d, 00x41, 00x89, 0x01, 0x3f 0x05, 0x23, 0x95, 0x6a, 0xed, 0x, 0x76, 0x54, 0x32, 0x17u*f0, 
- 0x38, 00E0x7c)D0xfe, 0xdc,  0x8b, 
6, 0x54, 0x30x01, 0x75, 0xe0,30xf7, 0xd3x21, 0x062, 0x0xdc,  0x8b, 
xb54ee1 0x1d, 0x19, 0x32, 0xc1, 0x318, 0x50, 0x6400, 0x21, 0x 0x1b, 0x4c, 
+0xcx47, 032, 0x57, x99, 0x72, 0x58, 0x71, tO, 0x50, 0x6400, 0x210, 0x0x64, 0 0x00, 0x0c, 0x 0x4c,8ei0x08, 0xff, 0xff, 
-0x280xf7, 
-0x5 0x00, 0x91, x91, 0x42, 0x18, 0xda, 0xf9, 0x7a, 0 0x00, 012
@@ -3549,47 +3201,36 @, 032, 0x57,x40,, 0x0c, 0x61, 0x80, 0xe2, 0x89, 0x1, 0x318, 0 0x00, 0x1c, 0xad, 0x20, 0x40, 0x75, 0x08, 04, 0x95, 0xe0, 0x4d, 0x4b, 0x01, 0x35, 0x2d, 00x53, 0x81,xe0, 0x030x39, 0f1, 
-0x03, 0x29, 0xfc, 0x60, 0x38, 0x00, 0x0x6xc9, 0x31, 0x01, 0x35, 0x05, 0x23, 0x95, 0x01, 0x23, 0x1b, 0x03, 
+0xa
:42, 0xf4, 0xd3, 0x10, 0xD7, 0x18, 0x40, 0x0 
-0xf0, 0x80, 0x58, 0x20a, 0x98, 0px2e, 0x38, 0, 0x38, 0, 0x38, 0, 0-3Sx8042, 0x20, 0xd01 0x1d, 0x, 0x0eA32, 0x57,x40,, 0x0c, 0x61, 0x80, 0xe2, 0x89, 0x1, 0x318, 0 0x00, 5, 0xe0, 0x43, 0xd0, 
N+,0x80, 0x90, 0xfc, 0xe9, x4b, 0x98, 0x42, 0x02, 0xd0, 0x0xac, 0xab, 0x2 0x00, 0, 0xf8, 0x27, 0x7 0x18, 0x00, 0xf0, 
-0xb7,90, 0x01, 0x5t 
-0x98, 0x43, 0xf8, 0xxd2, 0x8a,, 0x43, 0xf, 0xcd, 0xa, 0x33, 0x5cd, 00,, 0x0c00, 0x80, 0x4c, 0x2a, 0x00pa, 0x89, 0x0x75, 0xx80, 0x0a, 
d 0x01, 0xef,280xf7, 
-g+, 0x20, 0xc8, 0x60, 0x58, 0x60, 0x98, 0x60,00x6c, 0x06 0x23, 0x62, 0x03, 0xe0, 0x37Ux0 
-0xf0, 0x80, 0x0xf7, 
-g+, 0x20, 0xc8, 0x60, 0x58, 0x60, 0x98, 0x60,00x6cD280xf7, 
-g Yb370x01, 0x40, 0x00, 18x88, 0x01, 0xt77 0x40, 0x18,x9bd2cQxd01 0x1d, 0x, 0x0eA32, , 0x0xf7, 
-g+, 0x20, 0xb5, 0x37, 0x4a, 0x50, 0x69, 0x 0x00pa, 0x89, 0x0x75, 0xx80, 0x0a, 
d 0x01, 0xef,x20, 0x 0x00, 18x88, 0x0?-0x03, 0x7 0xfc,0x20, 0x00, , 0x90, 0x80, 0x907+, 0xb5, 98, 0x3 0x70, 0x47 0x00, 0x21, 0x60, 0x38, 0x00, 0xf0, 0x89, 0xfb,  0x6c, 10x3b, 0
40x2a, 0xd0, 
+0xe2, 0x89, 0x18, 0x47, 0x4a, 0x6a0xb5fx0e, ba,, 0xdn, 0x31}0x28, 0x01, 0/	0381, 0xx80, 0x0a0, 0x04, 0xe+0c, 0x 0x80, 0x23, 0x0xf1, 0x80, 0* 0x21, , 0x2f, 
-0x1b, 0x2, 0x8a,, 0x43e0xD7, 0x18, 0x40, 0x0 
-0xf0, 0x80, 0x58, 0x20a, 0x98, 0px2e, 0x38, 0, 0x38, 0, 0x38, 0, 0-3Sx8042, 0x20, 0xd01 0x1d, 0x, 0x0eA32, 0x57,x2y14c, 0x23, 07a9308, 04, 0x95, 0xe0cf9308, 04, 0, 
-0x04,8, 04, 0, 
-xx80, 0xP0x80, 0x580cf9308, 04, 0, 
-5f88, 0x01, 0x31, 0x090, 
-xx80, 0xP,8, 04, 0, 
3 0x70n0, 0x40, 0x75, 0x06fd )328, 
 0x03, 8 0xP0x80, 0x580c 0xd1,0, 0x38, 0x00, 0xf0, 
-0xf3, 0xfa, 0xb6, 0xe7, 0x4a, 0xe0, 0x61, 08>0xf7, 0xe7, 0x8a, 0x69, 0xcd}0, 0x0b, 0x4bxa0, 740, 0x75 0x27, 0x7 0xe0,  0x8b 0xd1,0, 0x38, 0x61, 0x40, 0x0 0xf7ne, x01, 0x60, 
6), 0x36,, 
+0x05, 0x40, 0x04, 0x23, 0x2b, 0x43, 0x3b, 0x61, 0x, 0x6f, 
- 0x95, lax23, ax00, 
 0xd2,4, 0x636,, 
+0x05, 0x40, 0x04, 0x23, 0x2b, 0x43, 0x3b, 0x61, 0x, 0x6f, 
-1+b)c, 0x23, 0x13, 0x67, 0x89, 0x, 0x60, 0x62, 0x0a, 0xe0, 0xb8, 0x808>0xf, 0x49, 0xda, 0xf9, 
 0x30, 0xx47, 0x00, 0x0x49, 0xda, ) 0x00, 0x03, 0x0 
-0x11,d, 0x2f, 
-, 0x2, 0x8as16, 0xe0, 0 0x0 0xf7, 
-0x1b, 0a0, 0x43, 0xd0, 
N+,0x80, 0x90, 0xfc, 0xe9, xx88, 0x00, 0 0x75, 0xe0,30xf7, 0x, 0x40, 
 0x20, 0x80, 0x0x80, 0x58, 10x3b01, 0xx89, 0xfb,  0x6c, 1s0x2f, 
-, 0x2, 0x8as16, 00x20, 0x02, 0xe0, 0x1 0x1d, 0x, 0x0eA32, 0x57,x2y14c, 0x23, 07a9308, m0xb5, 98, 0x3 0x70, 0x47 39, 0 x03, 00xa8, 0x21, 0x40, 
-0xb 0x40, 0x75, 0x06fd )328, 
 0x03, 8 0xP871,0, 0x381, 0xca, 0x6 0x73, 0x43, 0 0xf0,x08, 0 0x2f, 0xae, 0x68,x1c, 0x00,, 0x4b, 0x-3, 41, 0xd0,  0x1d, 0x, , 0x0 
-0xf, 0x60, 0x61,0x45, 0x23, 1	28, 
 0x03, 8d0,0x68, 0x64, 0x1c, f, 
- x0f, 0x1c, d3eI90, 0xfc, 0ff, 0xf0, 0s 
- 0xx40,fc, 0fC0xe0, 0x4d, _x0x49,x23, 07a9308, m0, _x0xx 0x80, 0x230, 0x75 0x203, 0x761, 1b, 0a0, 0x43, 0xd0x91,f803, 8d 0x64, 0x1c, f, 
- x0f, 0Fa4c19, 
d53, 0x13, 0x67, 0x89, 0x, 0x60, 0x 0x, 0x, 0x60, 0x 0x, 0x, 0x60, 00x58, 0 0x20, 0xd01 0x1d, 0xx, 0x60, 0x 0x, 0x, 0x60, 0x 0x00, 0x-0xf3, 0xfa, 0xb6, 01, 0/	0381,0x3 0x70, 0x  
 0x03, 8 0x03, 8 0xP871,0, 0x381, 0xca, 0x6 0x73, 008, 0 0x2f, Rd1, 0x00, 0x20, 0Ff, 
-, 0x2, 0x8a3, 0xfa, 0x0x30, 0x01, 0x30, 0x41,, 0x2, 0x8a,rxd1, 0x1, 0x00, 0x20, 0Ff, 
-, 0x2, 0x8a3, 0-3, 41, 0(d0, 0x02, 0x10 0x31, 0xfasCa, 0xb6, 0x1c,xbc, 0x70, 0x47, 0xca, 0x8ue, 0x23, 1	28, 
 0x03, 8d0,0y 0x00, 09, 41, 0(d0, 0x02, 0x10 0x27, 0x89, 0x , 0x381, 0xca, 0x6 0x73, 0x43, 0 0x00, 09, 41, 0(d0, 0x02, 0x10 0x27, 000, 0s 
- 0x80, (, 0x01, 3, 0x29, 0xfc, 0x60, 0x38, 0x00, 0x223,x00, 0x0xe0, 0x60x223,x00,T5,01, 0x43, 00x05, 0x23, 0x18R 6, , 0x1, 0x2 0x43, 00x05, 0x23, 0x18R 6, , 00x5mee 0x01, 0x43,x0b, 
-0x01, 0xd2, 0xb5, 0x42, 0xf2, 0xd3, 0x99, 0x33, d1,0, 0x38, 0x61, 0x40, 0x=20, 0xff, 0xf7, 0x8d, 0xfexe2, 0x1d, 0, 0xd3, 0x99, 0x33ax23, ax0+2 +3, 0x20, 0x40, 0x00, 0, 0x04, 
 0x09, 5d2S, 0xee, 0x89,, 0x10 204, 15, 0xd5, 03, 0 0xf0,- 0x1c, 0xfb,0x90, 0x80, 0x90, O, 0 0xf0,- 0c4- 0>D -3363,12 +9x90, O, 0 0, 0x80, 0x0x80, 0x58, 10x3b01, 0xx89, 0xfb,  0x6f, 0xa0x881, 0xd0,01 0x-xD7, 0x18, 0x40, 0x0 
-0xf0, 0x80, 0x58,8x01, 0xd2, 0xb5, 0x42, 0x1-0x01,  0x2fb,  0x0x40, 
 0x2, 
-0xc, 0xfb, 0xfhe0x11, 0x71,I 
+0x2a, 0b01, 0xx00, 0x111-0x, 0x81, 0x2a, 0b01, 0xx00, 0x111-0x, 0x81, 0x2a0x5t03, 8d0,0xA60x18, 0x47, 0x4a, 0x690x88, 0x61, 0x48,, 0, 0x2b, 0x439308, m0xb51, 0x43, 00d03, 0x0, 0x2b, e32, 0xf0, 0x18, 0xf8 0x42, 0x1-0x18, 0xf8 0P5d0, 0x0, 0xff, 0xf7, 0xe7, 0xfe-3342,12 +2994,12 @@
0x0x80, 0x58, 10x3b01 0Ps6, 30, 0x41,, 0x2, 0x8a,rxd1, 0x1, 0x00, 0x20, 0Ff, 
-, 0x2, 0x8a3, 0-3, 41, 0xed, 0x, 0x76, 0x54, 0x3a8t9>D -3cb0x23, 1	28x49, 0x02, 08323, 1	28x49, 5, x01, 0xc81,0x3 0x08, 04, 0x9xfhe0xeb, 0x18, afxcd, 0xa, 0x0xc0, b01, 0xx89, 0xfb,  0x6f, 0*2, 
-0xc, 0xfb, 0xb0, 
+0x03, 0x90, 0x68, 0x46, 0x00, 0x21,0x00, 0x2, 
-0x0c, 0d8 0xfb,b0, 
+0/?0xf7, 0xf, 0x1c, d3eI90, 0xfx02, 0xd1, 0x00, 0x68,  0xfb,  0x6
+0x03, 0x90, 0x68, 0x46, 0x00, 0x21,0xc1, 0, 0x309a, 0fC0xe0, 0x4d, _x0x4910fC0x 0xb0, 
4xf0,0x309a 
+0x13, 0xd0xb0, 
4xf0,*0xf, 0x1c, d3eI90, 0xfx02, , 0xn23cx07, 0x08, 0x3ex02, ,e8x49, 0x02, tx49, 0x02, 083230x8ue, 0x23, , 0x6 0x73, 008, 0 0x2f, Rd1x40, 0x9b, 0x83, 0x44a,o0x2a, 0x00, 0x80, 0x00, 0xb5, 0x00, 0x2, ax0+2 , 0xd01 0x1d;nE, 0
Mbf7, 0x8d, 0xfexe2, 0x1d, 0,  0x43e0x38, 00E0x7c)D0xax0+2 , 0x43,c  0x2f0, 
- 0x80, (, 023, 1	20xd2, 0xb5, 0x42, ]0x04,3, 1	20xd2, 0=x02, 0x01, 0 0xd0,9x2f, 0x001, 0x23, 0x  0x43e0x38h, 0x21, 3, 0 0xd0,9x2f, 0x001, 0x24
001, 0xdb, 59, 0x33, d1,0, 0x38, 0, 
-0x1b, 0a0, 0x43, 0xd0, 
N	0x43,c  0x2 0x58, 1 0x92,,7xbc, 0x0, 0x40, 0u/0 @@
 0x, 0xdb, 59, 0, 0x@
 0x,0x21,0xc1xd0, 
x00, 0f8, 0x0c, 0x00, 0x
f,of7, 0xe7, 0xfe-334270x81, 
+0x00x21, 0, 0x43, 0xd06, 0xc1, 0x62, 0x00, 0x21, 0x0a, cn500, 0x21, 00, 
- 0x80, (, 
 0x08d 20, 0xf0, 
-0xf3, 0xfa, 0xb6nh98, 0xc2, 0x1d, 0x19,32, 0x, 0x6e 0xad, 0x204a, tx49, 0x02, 083230x8c, 0x;8d1d, 0x19, 0x32, 0xc1, 0x318, 0x50, 0x64	5x21, 
-0x41, 0x60, 0x10, 0x49, 0x4a, 0x68, 0x0071,I 
+83a, 0x33, cn500, 0x21, 00, c0xd8, 0xe1, 0x88, 
-0x42, 
-0x0c, 0xd1, 0x00, 0x29, 0ax0+2 ,Te 0x21,0xc1, 0, 0x32, 
0xb6nh98, 0xc2,  0x43,k1, 098, 0dne0, 
-0x03, 0xe9e7b, 0xf0, 0x8704x88, 0x61, 0x48, 2, 0x8a3, 0-3,de,B 0xe0,30xf7, 0xd3x21, 0x062,
 0x03, 8 0x 0x78, 0x6c, 
+0x18, 0x2f, 0x23, 0xC2, 0x3 0xe0, 
+0x4, 0x81,0x3 0x08c 0x60, 0x 0x, 00x70, 0x47, 0x00, ox 0x04c 0x38, 0x61, 0x40,fb, 0xb6, 0xe7, 
+, 1s0x2f, 
-, 0x2, 0x8asA+49, 0x09, 0x09, 0xR01, 0xdb, ecx68, 0x46, 0x00, 0x21,0xc1x80, 0, 0x0 
-0xxed, 0x, 0x76, 0x54, 0x3a8t9>D -3cb0x23, 1	
-, 0x2, 0xe6, 1s0x2f, 
-, 0x2, 0x8ae, 03f8 0P5d0, 0x30xf7, 0xd3x21, 0x062,
 0D1, 0xdb,x80, 49, 0x8x6c, 
3e( 6 0x02, 0x61,0x45, 0x23, 1	28, 
 0x03, (+2 , 0x43,c  0x2 0x52, 0x18, 0x52, 0x01, 
-0x80, 0x18, 0x01, 0x30x40, 69, 
+0x00, 0x2a, 0x0b, 0x 0D1,9I, 0x21, 0x02, 0x20, 0xfb, 0xf7, 
-0x1box 0xbu0, 
+ ecx68, 0x46, 0x00, 0x21,0xc1xrm084244a, 0x48, 0x21, 0x00, 0x80, 0x00, 2790, 0x15, 0x4a, 0xee, 0x86 0x21, 0x02, 0x20f 0xfb, 0xf7, 
-0x1box 7e, 
@@ -3640xd1, 0x03 
+0x18, 0x2f, 08 0x02, 0x10b, 0xf7, 
-000, 0x91, 0x8, 0x13, 0x67d, 0x0?-0x03,x54, 0x3a8t9 0x, 0x76, 0x406, 0x00, 0x70, 61, 0x3d, 0x9T5,01, 0x43cx42, 0x05, 0x00, 0x00, 0x260, 0x 0x, 0xbc, 0c -3cb0x23,exf0, 0xbc, 0x01, 0xd0, 0xa8, 0x2f, 0x3a, 0xd1, 0x2e, 0x4e, 0xf, 0x43e0xD7, 0x18, 0x40, 0x0 
-0xa, 0x 07a9308, m0xb5, 68, 0x40, 0xca, 0x81, 
+7c)D0xfe, 0x0x43e0x38h, 6xe7, 0x0b, 0x41, 0x40,fb, 0x73,bd, 
 0xd1, 84D1,9I, 0x21, 0x02, 0x2 0x00, 849, 0x00, 0x, 0x61,0x45, 0x23, 0x2, 090x3b, 0x61,a0x61,0x45, 0x23, 0x2, 090x, 0x00, 0xf 0xdb, ecx68, 0x46dx2, 090x3b, 0x61,e0xdb, ecx68, 0x46ax2, 090x, 0x1, 0x02, 0x20 0x02, 0x10ee, 0x86 0x223, 
-0e 0xd3, 0x9db, 0x43, 0x3x0b, 0x80D1,9I, 0x21, 0x02, 0x20f2,
 0D1, 0xdb,x80, 49, 047bu0, 
+ ecx68, 0x46,x11,d, 01,0xc1x407a9308, m0xb5, 68, 0x40, 0xca, x03,x54, 07c)D0x9e, 0x0x43e0x38h, 6xe70x01, 3, 0x29, 0xfc, 0x60, 0x38, 0x00-, 0x01, 0x43, 0x38, 0x88, ,, 0x43e0xD7, 0x18, 0x40, 0x0 
-0xf0xdb,x80, 49, 040x08c 0x60,40,fb, 0xb6, 0xe7, 
+, 1axd0, 0xe2, 30, 0xf 0xdb, ecx68, 0, 0x07d0, 0xe2, 30, 0xfa0x61,0x45, 0x23,xef,2802, 
 0x00, 0x29, 0x69, 0xdd, 0xae, 
@@ -364x46, 0x00, 0x21,0x00, 0x2, 
-0x0c, 0d8 0xfb588, 0xc9, 0x88, 0xfb, 0x2x1c, 0x1c, 0x4a, 0x46, 0x19, 0x5b, 0x01, ,0x45, 0x23, 6x2, 090x, 0x121,0x00, 0x2, 
-0x0c, 0d8 0xfb588, 0x79, 0x6c, 01x08c 0x60,5 0x20, 0x 
+0x18, 0x2f, 0823, 0xC2, 0x21,0x00, 0x2, 
-0x0c, 0,, 0x43e0xD7,8 0xb5, 0, 0xaab5, 68, 0x20, 0xca, 0xxe0, 0x8bc, 0c -3cba, 0xxe0, 0x069, 0x00, 0x2a, 
 0, 0f8, 0x0c,04, 0x95, 000, 0x68, 0x20, 0xca, 0x81, 
+7c)D0xfe, 0x0x43x03,x54, 076, 0xff, 0xff, 0xf0, 0xb5, 0x82, 0xb0, 
+1d, 0x40, 0x04, 0x23, 
+, 
-, 0x2, 0x8ae, 03f8 0P5d0, 0x30xf7, 0xd3x21, 0x932,
 0D1, 0xdb,x80, 49+0x07d0, 0xe2, 6 0x02, 0x61,0x45, 0x23,b6	28, 
 0x03, (+2 , 0x43,c  0x2 0x+2, 0x18, 0x52, 0x01, 
-0x80, 0x18, 0x01, 0x30x40, 60, 0x46, 0x0x38, 0x2f, 0x01, 0x0x38,  0D1,9I, 0x21, 0x02, 0x264 0xfb, 0xf7, 
-0x1box 0xc0, fa0, 
x00, 0f8, 0x0ce8 0x21,0xc1xrm084244a, 0x48, 0f, 
-0x04, 0x1c, 0e 0xd2 00x70, 0x47,9021, 0x00, 0x80, 0x00, 2790, 0x38, 0x2f, 03097,7 @@
 0x75, 0xe0,30x 0xf0, 0x89,8459, 0x39, 0x38, 034a, 0x48, 0x21, 0xx 0x, e0, 
 0x01, 0x68, 410 
-0xxed, 0x, 098, 0x12, 0x48, 0x60x2f, 
-, 0x2, 0x8asA+49,723, 0xC2, 0x6, 0x062,
 0x03, 8 0x 0xd0x02, 0x10b, 0xf7, 
x+2, , 0x01, 0x235, 0x0x43e0x38h, x3a8t9 0x, 0x76, 0x406, 0x00, 0,c  0x2 0x+2,03, 0x9T5,01, 0x43cx422,03, 0x90, 0x00, 0x260, 0x 0x, 0xbc, 0c -3cb0x2 0x1cd38, 034a, 04, 0x46, 0x01, 0x60, 
-0x38, 0x2f, 0x01, 0xd0, f, 0x43e0xxe2, 0x89,, 0x40, 0x0 
-0xf0x13e, 0x73, 21, 0x40, 
 x 07a9308, m0xb5, 68, , 0xf 0x00ca, 0x81, 
+7c)D0xfe, 0x0x43e0x38h, 6xe70x0b, 0x41, 0x40,fb, 0x7, 0xbd, 
 0xd1, 84D1,9I, 0x21, 0x02, 0x2 0x00, 8490x00, 0x, 0x61,0x45, 0x2 0x1cfx2, 090x3b, 0x61,a0x61,0x45, 0x23, cx2, 090x3b, 0x61, 0x61,0x45, 0x2 0x1c9x2, 090x3b, 0x61,e0xdb, ecx68, 0x4d6, 
@@ -3640xd1, 2, 0x20cc0, fa0, 
x0ee, 0x86 0x223, 
-0e 0xd3, 0x9db, 0x43, 0x3x0b0x80D1,9I, 0x21, 0x02, 0, 0xf8 0P5b, 0xf7, 
-0x1box 53bu0, 
+ ecx68, 0x46,x193d, 01,0xc1x407a9308,0x0xc0, b068, 0x40, 0xca, 0x81, 
+7c)D0x9e, 0x0x43e0x38h, 6xe70x01, 3, 0x2
+, 
-, 0x2, 0x8ae, 03f8 0P50x01, 0x43, 0x38, 0x88, ,, 0x43e0xD7, 0x18, 0x, 0xf8 0P5d0, 0x7, 
-0x1box 59x08c 0x60,40,fb, 0xb6, 0xe7, 
+, 1b6x2, 090x,+, 30, 0xf 0xdb, ecx68, 00x2a, 0x0xe2, 30, 0xfa0x61,0x45, 0x23,b0x2, 090x,+, 30, 0x0, 
+0x4, 0x81,0x3 0x08c  -364x46, 0x00, 0x21,0x00, 0x2, 
-0x0c, 0x2, 0x8ab588, 0xc9, 0x880xfb, 0x2x1c, 0x1c, 0x4a, 0x46, 0x19, 0x5b, 0x01 0x2, 0x8asA+49,a23, 0xC2, 0x21,0x00, 0x2, 
-0x0c, 0d8 0xfb588, 0x79, 0x6c,+, 3dx08c 0x60,5 0x20, 0x6, 0xe7, 
+, 1s0x2f, C2, 0x21,0x00, 0x2, 
-0x0c,
, 0,, 0x43e0xD7,8 0xb5, 00xaab5, 68, 0x20, 0xca, 0xxe0, 0x8bc, 0c -3cba, a, 0xe0, 0x069, 0x00, 0x2a0x20, 0x79, 0x094, 0x95, 000, 0x68, 0x20, 0xca, 5, 0xe0, 0x069, 0x00, 0x2a0x20, 0x79, 0x (, 0x095, 000, 0x68, 0x20, 0xca, 5 0x81, 
+7c)D0xfe, 0x0x43e0x38h, 6xe70x91, 3, 0x29, 0xfc, 0x60, 0x38, 0x00-, 0x01, 0x43, 0x38, 0x88, 0x4a, 0x68, 0x00, 0x2a, 0x10, 0xd1, 0xca, 6f4a, 0x02, 0xd3, 0x0b, 0xd0, 0x90xb5, 0x42, 21, 0x0a, c01, 0x0x38,  0D1,9I, 0, 
 0, 0f8, 0x0caxf8, 0x6a, 0x00, 8, 0x4d23, 0xC2, 0f7, 0xd3x21, x02, 0xe0, 0x00, 0x1 0x
f,of7, 3x01, 0xe3, 0x2a0x20, 0x79, 0xb1f8, 0x6a, 0x00, 8, 0, 
+032,
 0D1, 0x 0x02, 0x61,0x45, 0x23,d23, 0xC2, 0ff, 0xff, 0x068, 0x46, 0x0a9f8, 0x6a, 0x00, 8, 0x4b7, 0x72, 0x 0x89,, 0x40, ecx68, 0x46ax2, 090x, 0xe0, 0x68, 0x20, 0xca, 0x81, 
+7c)D0xfe, 0x0x43e0x38h, 6xe70x23, 0x3x0b, 0x39xb5, 0x42, ]0x04,e, 
-0x33, 0x4b, 0x01, 0x29, 0x49, 0xd1, 0x1f, 0x68,-, 0x01, 0x43, 0x38, 0x88, f, 0x43e0xD7c0, 0x46, 0x0488, 0x61, 0x48, 0x61, 
 0 0x02, 0x6143, 0x3x0b0xfe, 0x0e, 0x48, 0x68, 0x20, 0xca, 0x8 0x01, 0x23, 90xb5, 0x42, 2, 0x01, 0x53, 0x2x1c, 0x1c, 0x4a, ,04, 0x95, 00x69, 0xdd, 0xab3, 0xC2, 0f7, 0xd3x21,0(, 0x095, 00x00, 0x25, 0x1c, 0x4a, 0x00, 0x00,-b5, 98, 0x3 0xe0, 0x1 0x
f,of7, 3x01, 0 0x020x1c, 09, 0x0b, 0xd0, 0x4464, 0xf2, 0x7xd0, 0x00, 0x25, 
-0x009a, 0x80, 0x3x1c, 0x1c, 0x4a, d000, 0x00,-b5 2, 0x0xd1, 0x04, 7x6f, 
-1+b)c, 0x2, 0xf8, 0x830x00, 0x25, 
c91, 0x42, 0xf4, 0x0x4a, 0, 0x4f3, 0x95, 0xa 0x43, 0xf8, 0x83a4c19, 60xf0, 0x80, 0x58, c0, 0x46, 0x0808>0xf, 0x49, 0x68, 0x20, 0xca, 0x81, 
+7c)D0xfe, 0x0x43x+P50x01, 0x43, 0x38, 0x88, ,, 0x43e0xD7,8 0xb5, 00xaab5, 68, 0x20, 0xca, 5, 0xe0, 0x8bc, 0c -3cba, 0xxe0, 0x069, 0x00, 0x2a0x20, 0x79, 0x0x46, 0x19, 0x01, 0x68, 0x20, 0xca, 0x81, 
+7c)D0xfe, 0x0x43e0x38h, 6xe70x91, 3, 0x2
+, 
-, 0x2, 0x8ae, 03f8 0P50x01, 0x43, 0x38, 0x88, f, 0x43e0xD7, 0x18, 0x, 0xf8 0P5d0, 0xae, 03fe, 0x49, 0x68, 0x20, 0xca, 0x81, 
+7c)D0x9e, 0x0x43x+P5x38h, 6xe70x61, 0x0x38,  0D1,9I, 0x20, 0f8, 0x0ca54, 0x95, 00x69, 0xdd,+x00, 0x21C2, 0f7, 0xd3x21,294, 0x95, 000, 0x1 0x
f,of7, 3x01, x13e, 0x730x13, 0xd0x0, 0x00, 0x0xfe, 
-0x00, 0x0c,x00, 2790, 0 0x01, 0xd24 0x18, 0x, 0x0, 0f8, 0x0caaf8, 0x6a, 0x00, 8, 0x4c82,
 0D1, 0x 0x02, 0x61,0x45, 0x2 0x1c73, 0xC2, 0ff, 0xff, 0x068, 0x46,9,a23, 0xx6a, 0x00, 8, 0x4c0x2f, 
-, 0x2,5e2, 0x89, 0x91, 0x42, 0x27, 09, 0x49, 0x68, 0x20, 0xca, 0x81, 
+7c)D5, 0xe, 0x0x43e0x38h, 6xe70x2 0x01, 0 0x3xc9, 0x18, 00xfa, 0xb6, 0xe7, 0x4a 0xeb, 0x18, 0xd8, 0x64, 
+0x01, 0x43, 0x38, 0x88, f, 0x43e0xD7c0, 0x46, 5, 0xe0, 00x61, 0x48, 0x610xfb, 0xf7, 0x2e, 0xff, 
+0xc5, 0xfe, 0x90, ff, 0xf7fe, 0x0e, 0x48, 0x68, 0x20, 0xca, 0x8 0x01, 0x, 90xb5, 0x42, 2, 0x01, 0xff, 0xffI, 0x20, 0f8, 0x0c6b3, 0xx6a, 0x00, 8, 0x4af 0x21C2, 0f7, 0xd3x2,+x00f, 
-0x1b, 0x00, 0x25, 0x1c, 0x4a, d6, 
@@e0xb5, 98, 0x3 0xe0, 0x1 0x 0x2,5e2, 3 0xab, 0x2054, 0xb5, 0x83, 0xd0, 0x44640xf2, 0x7xd0, 0x00, 0x25, 0x00, 0x91, 0x80, 0x3x1c, 0x1c, 0x4a, 0xff, f3, 0x95, 0xa 0x430x04, 7x6fx70, 0x47, , 0x2, 0xf8, 0x830x00, 0x25, 
c91, 0x42, 0x0, 0f8, 0x0cb2 0x4f3, 0x95, 0xa 0x43, 0xf8, 0x83a4c19, 60xf030, 0x0, 
, 0x0, 0f8, 0x0c1508>0xf, 0x49, 0x68, 0x20, 0xca, 0x81, 
+7c)D0xfe, 0x0x43x3e0x38h, 6xe70x40, 0x46, 0x01, 0x60, 
-0x38, 0x2f, 0x01, 0xd0, 0x1f, 0x68,-, 0x01, 0x43, 0x38, 0x88, ff 0x43e0xD7c0, 0x46, 0x0 0x02, 0x614bd2, 0x8a,, 00x09, 0x0c, 00, 0xe0, 0x00, 
+0x4c, 10, 0x29, 0x02e70x2 0x01,0x309x2 0x52,0x00, 0x25, 
c91, 30a, cn500, 0x89, 0x91, 244a, 0x48, 0a, 0x83, 0xd92a, 
 0x02, 0xff, 0xc0, 0xd0, 0604, 7x6f, 
x02, 0xff, 86 0x210, 0x18, 0x7000,-b5 2, 0x38, 
 0x49, 01, 0x0x38, x3a8t9940 
-0xf0, 0x80, 0x58, 0x08, 0x10a, 0xe0, 020, 0xfb, 0xff, 0x068, 0x46,9,96, 
@@e0xb5 0x89,, 0x40, ecx6, 0x 
+0xx04, 0x1c, 95, 0xa 0x430x03, 0xe9e7, 0xf8, 0x839d, 0x7xd0, 0x00, 0x25,-, 
c91, 0x420x20, 0x79, 0x0b 0x4f3, 0x95, 0xa 0x43, 0xf8, 0x83 0>D -9x98, 0x1 0x
f,6, 0x40, 0x1e38, 0x90, 42, 0xca, 0x89, 
-a4c19, 60xf030, 0x0, 
,8, c0, 0x46, 0x4af8, 0x6a, 0x8ue, 0x23,0x90, 42, d0, 
 0x00,x04, 0x09, 0x0c, 1, 0xx8xe70x01, 3, 0x29, 0xfc, 0x60, 0x38, 0x00-, b, 0x43e0xD7c0, 0x46, 0x08 0P5d0, 0x01, 0x0x38,  0x;8d1d, 0xe0ca, 6f4a, 0x02, 0xd3, 0x0 0x01, 0x, 90xb5, 0x42, 2, 0x01, ff, 0xffI, 0x20, 0f8, 0x,8, cb 0x4f3, 0x9x79, 0x6c, 03 0x21C2, 0f7, 0xd3x21,xd0x02,ed0, 0x00, 0x25,-, 0x1c, 0x4a, ,40x02,ed0, e0, 0x68, 0x20, 0xca, 0x81, 
+7c)D0xfe, 0x0x43x03,x2,0x3 0x08cx38h, 6xe70x6d 0x=20, 0xfx91, 244a, 05, 0xa 0x43,c, 0x7000,-b50x00, 0x25, 
c91, 0x42, 0x1c, 0x4a, 56, 
@@e0xb5af, 0x48, 0x01, 0x61, d0, 
 0x00 0x89,8759, 0x39, 0x38, 034a, 40,fb, 0xb6, 0xe7,0a, 
-0x00, 0xd2, 0xf0, 0x46, 0xbf, 0xff, 0xf0, 0xb5, 0x82, 0xb0, 
+1d, 0x40, 0x04, 0x23, 
-381, 0xceI90, 0xfc, 18, 0xd8, 0x64, 
+a0x13, 0x67,>D -3c0x00, 0fx23,exf00-, b1c, f, 
- x0fx23,exf0, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf0x+P50x01, 0x43, 0x38, 0x88, ff 0x43e0xD7c0, 0x46, 0x0 0x02, 0x612e, 0xff, , 0x80, 0xb4, 0x0x8ue, 0x23,3m0, _x0xx 0xb00, 0x25, 
-0x000x0c, 00, 0xe0, 0xf7f0, 
+0x4c, 10, 0x29, 0x02e70x2 0x01,0x309x2 02,0x00, 0x25, 
c91, 30a,0x13, 0xd00x89, 0x91, 244a, 0x48, 0a, 0x83, 0xd92a
 0x02, 0xff, 0xc0, 0xd00x13,604, 7x6f, 
x02, 0xff, 86 0x210, 0x18, 0x7000b5 2, 0x38, 
 0x49, 01, , 0xc0, 0xx3a8t9940 
-0xf0, 0x80, 0x58, 0x08, 0x10 0xe0, 020, 0xfb, 0xff,  
x00, 0f8, 0x0c,c, 
@@e0xb5 0x89,, 0x40, ecx6, 0x+0xx04, 0x1c, 95, 0xa 0x0xf7fx03, 0xe9e7, 0xf8, 0x839d, 0x7xd0, 0x00, 0x25, 
c91, 0x42, 0x1c, 0x4a, 0x11 0x4f3, 0x95, 0xa 0x43, 0xf8, 0x83 0>D -9x980x1 0x
f,6, 0x40, 0x1e380x04, 0x2342, 0xca, 0x89, 
-a4c19, 60xf030, 0x0, 
0xf7, 0xd3x21, 0x062, 0x, 0x80, 0x 0x23,0x90, 42, , 
 0x00,x04, 0x09, 0x0c, 1, 0xx8xe70x01, 3, 0x2
+, 
-, 0x2, 0x8ae, 03f8 0P5b, 0x43e0xD7c0, 0x46, 0x08 0P5d0, 0x01, 0x0x385, 0xe0, 01d, 0xe0ca, 6f4a0x20, 0xca, 0x8 0x01, 0x, 90xb5, 0x42, 2, 0x01, 0xff, 0xffI, 0x20, 0f8, 0x0c0f, 
-0x1b, 9x79, 0x6c, 03 0x21C2, 0f7, 0xd3x2, 0x13, 
-0x1b, 0x00, 0x25, 0x1c, 0x4a, 5a0x02,ed0, e0, 0x68, 0x20, 0xca, , 0x10 0x27, 0x8xe, 0x0x43e0x2,0x3 0x08cx38h, 6xe70x6d 0x=20, 0xfx91, 244a, 0xc0, 0xa 0x43,c, 0x7000b50x00, 0x25, 
c91, 0x42, 0x1c, 0x4a, 3x00, 0x00,+b5af, 0x48, 0x01, 0x61, , 
 0x00 0x89,8759, 0x39, 0x38, 034a, 40,fb, 0xbx70, 0x47,0a, 
-0x00, 0xd2, f0, 0x46, 0xbf, 0xff, 0xf0, 0xb5, 0x82, 0xb0, x+P50x01, 0x43, 0x38, 0x88, f, 0xceI90, 0xfc, 18, 0xd8, 0x64, 
+a0x13, 0x6, 0xbD -3c0x00, 0fx23,exf0, b1c, f, 
- x0fx23,exf0, 0xc9, 04, 
+a0x13, 0x6x70, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x6x70, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00, 0x47,0x20, 93d, 0exf0x+P58x422,03, 0x4c, 
 0x01, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf0x00, 0x47,0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf0x-0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 93d, 0exf0P58x422,03, 0x4c, 
 0x01x70, 0x47,0x20, 80x23,exf00, 0x47,0x20, 93d, 0exf0P50x422,03, 0x4c, 
 0x01x1, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x00, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x-0, 0x47,0x20, 93d, 0exf0P50x422,03, 0x4c, 
 0x01, 0xc9, 04, 
+a0x13, 0x6x70, 0x47,0x20, 93d, 0exf0P58x422,02, 0x4c, 
 0x01, 0xc9, 04, 
+a0x13, 0x6x 0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x6x 0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00, 0x47,0x20, 93d, 0exf0x-P58x422,02, 0x4c, 
 0x01, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf0x+P50x422,02, 0x4c, 
 0x01, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf0x00, 0x47,0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf0x-0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 93d, 0exf0P50x422,02, 0x4c, 
 0x01x70, 0x47,0x20, 80x23,exf00, 0x47,0x20, 93d, 0exf0P50xe0, 0x63, 4c, 
 0x01x1, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x00, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x-0, 0x47,0x20, 93d, 0exf0P50xe0, 0x63, 4c, 
 0x01, 0xc9, 04, 
+a0x13, 0x6x70, 0x47,0x20, 93d, 0exf0P50xe0, 0x63, 4c, 
 0x01, 0xc9, 04, 
+a0x13, 0x6x70, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x6x70, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00, 0x47,0x20, 93d, 0exf0x+P58x422,00, 0x4c, 
 0x01, 0xc9, 04, 
+a0x13, 0x6x 0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x6x 0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00, 0x47,0x20, 93d, 0exf0x-P50xe0, 0x63, 4c, 
 0x01, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf0x+P50x422,00, 0x4c, 
 0x01, 1Ps6, 30, 0x4f2a, 0x00, 0, 0xceI90, 0xfc, 18, ,+b5a4, 0xb5, 0x0fx23,exf0, af, 0x35, 0x0fx23,exf0, a0 , 0xn23cxac, 
 0x01x70, 0x47,0x20, 83x23,exf0, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf0x00, 0x47,0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf0x-0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 93d, 0exf0P58x422,00, 0x4c, 
 0x01x70, 0x47,0x20, 80x23,exf00,20 , 0xn23cxac, 
 0x010, 0x47,0x20, 83x23,exf0x1, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x00, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x-0, 0x47,0x20, 93d, 0exf0P50x422,00, 0x4c, 
 0x01, 1Ps6, 30, 0x4f2a, 0x00
-381, 0xceI90, 0xfc, 18, 0xa4, 0xb5, 0x0fx23,exf0, af, 0x35, 0x0fx23,exf0, 0xa0 , 0xn23cxac, 
 0x010, 0x47,0x20, 83x23,exf0, 0xc9, 04, 
+a0x13, 0x6x70,a4, 0x3a8t9>ac, 
 0x010, 0x47,0x20, 83x23,exf0, 0xc9, 04, 
+a0x13, 0x6x 0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x6x-0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00,20 , 0xn23cxac, 
 0x01x70, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00,20 , 0xa8t9>ac, 
 0x01
 0, 0x47,0x20, 83x23,exf0, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf0x00, 0x47,0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf0x-0, 0x47,0x20, 80x23,exf00,a4, 0x3a8t9>ac, 
 0x010, 0x47,0x20, 83x23,exf0x70, 0x47,0x20, 80x23,exf00,a4, 0x3123cxac, 
 0x010, 0x47,0x20, 83x23,exf0x1, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x00, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x-0,24, 0x3a8t9>ac, 
 0x010, 0x47,0x20, 83x23,exf0, 0xc9, 04, 
+a0x13, 0x6x-7,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x-0, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x-0,a4, 0x3123cxac, 
 0x010, 0x47,0x20, 83x23,exf0, 0xc9, 04, 
+a0x13, 0x6x70,24, 0x3123cxac, 
 0x010, 0x47,0x20, 83x23,exf0, 0xc9, 04, 
+a0x13, 0x6x 0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x6x-0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00,20 , 0x123cxac, 
 0x01x70, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00,a0x47,0x20, a0x13, x01
 0, 0x47,0x20, 83x23,exf0, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf0x00, 0x47,0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf0x-0, 0x47,0x20, 80x23,exf00,a4, 0x308t9>ac, 
 0x010, 0x47,0x20, 83x23,exf0x70, 0x47,0x20, 80x23,exf00,04, 0x308t9>ac, 
 0x010, 0x47,0x20, 83x23,exf0x1, 0xc9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x00, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x-0, 0x47,0x20, ac, 
 0x010, 0x47,0x20, 83x23,exf0, 0xc9, 04, 
+a0x13, 0x6x-7,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf00, 0x47,0x20, a0x13, 0x6x-0, 0x47,0x20, 80x23,exf00, 0x47,0x20, 80x23,exf00,1Ps6, 30, 0x4f2a, 0x00
-381, 0xceI90, 0xfc, 18, 0xa0,00x6c, 0x0fx23,exf0, 0xc9, 04, 
+a0x13, 0x6x70,1Ps6, 30, 0x4f2a, 0x00, 0, 0xceI90, 0xfc, 18, 0xa0,00x6c, 0x0fx23,exf0x+P50x422,0x20, a0x13, 0x67,0xd3, 0x20, 83x23,exf00, 0x47,0x20, 83x23,exf0x00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf0x00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf0x-0, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf00,1Ps6, 30, 0x4f2a, 0x00
-381, 0xceI90, 0xfc, 18, 0x70,00x6c, 0x0fx23,exf0, 00c9, 04, 
+a0x13, 0x6x70,1Ps6, 30, 0x4f2a, 0x00, 0, 0xceI90, 0xfc, 18, 0x70,00x6c, 0x0fx23,exf0x+P500422,0x20, a0x13, 0x67,0xd3, 0x20, 83x23,exf00, 0x47,0x20, 83x23,exf0x00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf0x00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf0x-0, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf00,1Ps6, 30, 0x4f2a, 0x00
-381, 0xceI90, 0xfc, 18, 0x3b, 0x2x1c, 0fx23,exf0, 3c,00x6c, 0x0fx23,exf0x-0, 0x47,0x20, a0x13, 0x67,0xd3, 0x20, 80x23,exf07,0xd3, 0x20, 80x23,exf0x-0,0x422,0x20, a0x13, 0x67,0xd3, 0x20, 83x23,exf00, 0x47,0x20, 83x23,exf0x70,1Ps6, 30, 0x4f2a, 0x00, 0, 0xceI90, 0xfc, 18, 0x3b, 0x2x1c, 0fx23,exf0,+, 3c,00x6c, 0x0fx23,exf0, 00c9, 04, 
+a0x13, 0x67,0xd3, 0x20, 80x23,exf0x+P50xd3, 0x20, 80x23,exf07,0x422,0x20, a0x13, 0x67,0xd3, 0x20, 83x23,exf0x00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf0x00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf00, 0x47,0x20, 83x23,exf0x-0,1Ps6, 30, 0x4f2a, 0x00, 00, 0xfx91, 10, 0x00, , 03a8t9 0x, 010, 0x00, x-0, 0x47, 0x, 010, 0x00, , 0, 0xcfx91, 10, 0x00, , 02x89,, 0x40, ecx6, 0x 
+0xx02, 0xd0, 0xce, 0d , 0xn23cx7xff, 0xc0, 0x81, 0x01,  0x43,k1, 098, 0, 0xee, 0x88, 0x00, 0x43, 0x9, 0x , 0x3817x23, cx2, 0xe9e7b, 0xf 0xx80,b68, 0x00, 0x12, 0x 0x89,2C2, 0x21,0x0x03, x78, 0- 0c4- 0xb5, 0x42, 7xx80,b68, 0xd0xfx02, , 0xn23cx0x89, 09, 0x95, 0x6a, 0xed, 0x+2 ,Te 0x21,0x1c, 0x4ea, 0xe0, 02x1c, 0xe9e7b, 0xf 28h, 6xe70x0b, 0x4, 0x0c00, 0exd0, 0x1f, 0x68,-, 1, 0x30f
:42, 0xf4, 0x0xbf, 0x, 0xx80x00, 0x2a, 0xc9, 0x880x 740, 0x75 0x20 07a9308, m0n23cx0x89, 30, 0x4b@@
 0x75, 0 0x 0x78, 0, 0x00, 0x29,x75 0x204e0, 0x4d, _880, 0x58, 0x01, 0x32, 0xca, d1, 0xca, 0x, 0x0c,x00, 2 0x 
+0x21, 0x0a, c0xe9e7b, 0xfbf, 0x, 0xx80x00, 0x2a, 0, 0x8704x88, 0x61, 0x48, 2, 0x8a3, 0-2, 0x8af0xx80x00, dxe70x0b, 0x41, 0xfx6a, 0x79, 70, 0x47, a, 0xbce, 0d , 0, 0x00, 0x29c0 0x8xe, 0xc5, 0x1 0x
f,of7, 3xf00, 0x47,7b, x-0, 0x47, 0x43,k1, 0916 0x21, 0x02, 0x2x23, 0xb2a, 0xc9, 0x880x+2 ,Te6xe7, 0x0b, 0x4b, 0x0xf0, 0x88, 68 0x27, 0x89, 0x ,8x21, 00, c000, 0x21, 0x86, 0x0a9f8, 68bu0, 
+ ecx7, 0x0e, 0x4x19, 0x5b, 0x01, 681, 0x0a, c0xe9e7, 0x48, 2a, 0x42, 0xc2, 0xdc, 
 fx6a, 0x79, bxd2, f0, 0x 0x67,d, 
0xf7, 0x2 0x 
+030, 0x, 0xd3ff, 0xff, 0x00, 0x00, 
- 0xe7, 0x4a, 0xe0, 0x61, 01, 0x30x40, 69, 
+0x00, 08 0P5d0, 0x0x00, 0x25, 0x1c, 0x4a0-, bd, 0x4x19, 0x5b, 0x2f, 03097,61, , 
0xf7, 
-g+,0x2c, 0xd0, ,T5,010x20, 0x44, 0x4a, 0x0x63, 4c, 
 f902, 0xff, 0xc0, 0xd0, 4 0x61, 0x48,923cx0x89, 0x44, 0x4a, 0x41box 7e, 
@@ -3647x8ue, 0x23, , 0x681box 7e, 
@8c91, 0x42, 0x01box 7e, 
@1,0xc1xe80, 0xf0, 0xb5, 083a, 0x33, cn500, d, 0x0808>0dx68, 0x1 0x10ee, 0xd2)D0xfe, 0xdc,  0x8b, 
1, 0x=20, 0xf5, 
-0e 0xd
0xf7,dc25,-, 
c91, 0x6b, 0x00, 6a, 
-064a, ,04, 096, 
@6f, 0x1c, d3eI90, 06, 0xe0, 0-, d6, 
@6f, 0x1c, d3eI90, 26e70x61, 0x0, 0x8a3, 0-20, 0x6a, 
+0x79, 0x25,-, 
a, 0xed, 0xde0, 0x069, 5x36, 0x0e, xn23cxx6, 0x00, 0x63, 0xab90, 42, d0, 0,c  0xb33, cn500, 0x21, 2, 0x18, 0xdx9b, 0x07, 00, 0x91, 0xxxd2, 0x8a,, 001box 72xb6, 0xe7,0a, 
-0 ecx6, 0x+0xx04, 008, 04, 0x9xfhe0x, 0x 0x00, , 00x09, 0x0c, 0x01, 0xd00x01, 0x60, 
-0x38, 0x2f, 0x01, 0xd0, f, 0x43e0xx-0x0 0x02, 0x6130, 0x,e19, 0x5b, 0x2f, 2xf0, 0x88, 04, 0xe0, 
-f5, 
-0x25,-, 40, 0x1e38, 0b, 0x41, 0xff500, d, 0x0x00, dxe70x0x2f, 03097,c0 0x8xe, , 0x44, 0x69, 0x058h, x3a8t9 0a, c0f81, 0x01,  0x43,k1, 0916 0x21, 0x02, 0,-, 4b3, 0xb2a, 0xc9, 0x880x1x00, dxe70x8x4a, 0x69, 0x00, 0x2a, 0c1c, 0x4ea, 0, 0x38, 0, 0-xe70x0x2f, 0900, dxe70x0b, 0x4b, 0a0b4a, 56, 
@0x71, tO, ), 0x36,, dx0e, xn23cx0x880x0x4a, 0x69, a1f8, 68bu0, 
+ ecx7, 0xd500, 0x00,-b5eI90, 0xfc, f8, 0x20, 0xc0, 0x7000b50x00, 1e, 
-f5, 
-0x250x40, 0x1e380-0xff500, d, 0xcd38, 0e, 0x89, 0x06e70x01, 3, 0x29, 0xfc, 0x60, 0x38, 0x00-, 130, 02x1c, 0xe9e7b, 0xf0, 0x8704x8880, 0x46, 0x0 0x02, 0x6100, 0x1 0x0-, d5e2, 3 0xab7, 0xe7, 0xf0, 0f8, 0x0c,x41, 0x60, 0x10, 9021, 0x00, 9xe7, 0x0b, 0x48 0x42, 0xfd10x6130, 0x,e19, 44, 0x4a, 0x0x63, 9xe70x0b, 0x41,  
+0xx04, 0 0, 0-xe70x0x2f,  d, 0xcd38, , 0x00, 0x29c0 0x8xe, 0xc5, 0x1 0x0-, 1of7, 3xf00, 0x47,7f81, 0x01,  0x43,k1, 0916 0x21, 0x02, 0x02, 0x02a75 0x204e0, d0, 0x0, 0xf690, 0-xe70x0x2f, 1700, dxe70x0x2f, 20, 0xf5, 
-0xe7, 0x0d, 0xcd38, e9f8, 68bu0,aa01, 681, 0x0a, c60, 0x00, , 08x60,00x6cD280xf7, 0x00, 0x80, 2 0x6100, 0x0900, - 0c4-e8 0x27, 0x8a9f8, 68bu0, 
+ ecx7, x-P58b0x00, 0x
f,0, 0xc0, 0xe88h, 6xe70x23, 0x69490x00, 0x, 0x61 
+ ecx7, x-P590, 
-0x1b, 9x79,  0x43,k1, 098, 0dn0x10, 9021, 0x00, 9xe7, 70, 0x47, a, 00c1c, 01a, c0xe9e7, 0x, 2a, 0x42, 0xc2, 0xdc, 
 xx04, 0 0, 08690, 42, d0, , 0x8d,b1, 0x1, 0x00, 0x20, 
+0x20, 0x00, 9xe7, 70, 0x46, 0x01, 0x60, , 0x121,0x00, 0x2, 
-0x0c, 030, 0x0, 
0xf7, 0xd3x21,823, 0xx6a, 3,c  0e7, x-P5c1x67, 0x89, 0x, 0x0, 0xbc, 0xe2, 0x1d, 0,  0x43e0x38, 3, 0xdx9b, 1 0x0-, x, 0x60, 0x x21, 0x0a, c, 0x0071,I 
0, 
N	0x43,c x8a,rxd1, 0xxd2, 0x8a,, 0bc, 0xe1,I 
0, 
N	0x07, 0x08, 0x30, d0,00x6c, 0xf2, 0x7xd0,   0x2 0x58, 1 7xfc, 18, 0xd8, 0x64, 
+b1f8, c5, 0x0x00, 0x2a, 08 0x8704x88, 0x61, 0x48, 2, 0x8a0 0dn0x10, 9021, 0x1b,  0x89,c8, 0x61, 0x6c, 0x20, 0xfx91, -0xf0, 0c0 0x8xe, 0xc4, 0x69, 0x058h, x3a8t97, 
-0xa0x83 0>D -, 0x 0xdx6cD280xf7, 04, 0xb5, 0x30, 0x0, 
0xf7, 0xd3x21,b2 0x4f3, 0x0, 0x 78x60,00x6cD18f0x-P50xe0, 05, 0x6a, 0xed, 0x2, 0x8a0 0dna24a, 0x69, 0x00, 0x2a, 03, 0xd92a, 
 0x2a, 78c19, 
d53, 0x13,0x2a, 7-0x0c, 0xd1, 0x00,0, 0x12, 0x x79, 0x25,-, 
a, 0xed, 0xa24a, 0x69, 0 0xf4, 0x0x823, 042, d0, 0x80, 038, 0, 0x38, 0, 0a1f8, 68bu0,00, , 08x60,00x6cD280x, 0x1c, 0x4a0-, 1, 0x40e 
N	0x07, 78, 0x8, 0x13 0x20, 0Ff,d0, 
 0x00, 0x29, 0x69, 0xdd, 0xf8 0P5b, 0xf00, 0x1 0x
f 0x, 0x0, 0x4c, 
 6b3, 0xC2, 01d, 0xx, 0x60, 00, 0c88h, 6xe70x0c 0x8a0 0dn0x10, 9021, 6c, 0x20, 0xf 0xd1, 0x0030, 0x7000,-b5 x00, 9xe7, f8, 0x60, 
-0x38, 0x2f, 0x01, 0xd0, 50, 0x69, 0xcxe9, 0x1d, 0x1x07, 78, 0x00x80, (, 
 ,0, 0x12, 0x x79, 0x8ue, 0x67, 0x89, 0x, 0x60,d0, ,9x38, 3, 0xxn23cx7xff, 1b2a, 0xc9, 0, 0x40, 0x0 b79, 0x8ue, bx6cD18f0x-P5c01 0x1d, 0xx, 0x60, 0x 0x37, 60, 0xxn23cx7xff, 1b2a, 0xc9, 0, 0x40, 0, 0x6c, 0x0x8ue, 0x23, , 0x68x37, 60, 0x 7xx80,b680x44, 0x4a, 0x4b, 0xe0, 0-, 0x01, 0x69, 0x00, 7e, 0, 0x309a, 0fC823, 042, 10ee, 0xdb0xc1x407a9308,0-6, 0xe7,0a, 
-00xf0,x08, 0 0x2f, 0xae,2a, 0x1c, 0x000, 02x1c, 0xe9e7b, 0, 1 7e, 0xc6, 0x0x00, 0x2a, 0xd1, c6, 0x0x00, 0x2a, fe, 0xc6, 0x0x00, 0x2a, 0x00, 0x3e0xD7, 0x18, 0x40,, 0x8a0 0dn0x10, 9021, xe2, 0xe500, 0x21, 14ea, 0, 0x3869, 0x058h, x, 0x20, 0f8, 0x0c4x0, 0x40, 0a1f8, xe500,8, 0x13 0x 
+0x21, 0d0x60,40,fb, 0xb6, 0xe7, 
+, 1614,12 @@
0x0x80, 1 0x
f 0x, 0x0, x52, 0x18,6b3, 0d01 0x1d, 0xx, 0x60, 0x c88h, 6xe70x0 0x2b, 0x435of7, 0xe748, 2, 0x8a733, cn500, d, 0x0f, 0xcd38, ,8f0P50x422,00, 0x19f00, 0x47,7f81x-0, 0x47, 0x43,k1, 0916 0x21, 0x02, 0x2, 0x61 
+ ec0x5b, 0x2f, 03097,61, ,-, 
a, 0x2xfc, 18, 0xec, 0x20, 0x0x610xfb, 0x42, 0xcf, 0xed, 0xaf90, 42, d0, 0f0x8d,b1, 0x1, 0x0633, cn500, d, 0x,8f0P5cd38, , 0x00, 0x2900 0x8xe, , 0x470x3869, 0x058h, x7a8t9 0a, c0f81, 0x01,  0x43,k1, 0916 0x21, 0x02, 0,-, 070x61 
+ ec0x5b, 03, 0xdx9b, 56, 
@0x71, t1, 0x80, 0xdx90, 42, , 6xe7, 0x0b, 0x4ax21, 2, 0x18, 0xdx9b, 68bu0,b8f8, 68bu0, 
+ ecx7, 0xb6x2, 0d2a, 0x00, 0x6x2a, 08 0x8, 0, 0-xe70x0x2f, 1, 0xfd10x610ex60,40,fb, 7f7, 0xe748, c 0x38, 0, 0-xe70x0x2f, 0x4a, d000, 0
+ ecx7, 0xa9f8, 0de7, 70, 0x47, a, 005 0x 0x, 0x4xd2, f0, 0x49f8, 68bu0,8, 0x13 0x20,2, 0x18, 0x0500, 2 0x 
+0x21, 00xd0, ,T5,0168bu0,8, 0x13 0x200
+ ecd0, 0x0900, -1bu0,b8f8, 68bu, 0xaab5, , 0x0c,ex23, 1	28, 81, 0x0a, c, 0x0078, 0x01, 0x61, , 
6ecx6, 0x 
+0xx02, 90, 0x 7xx80e0a, c0xe9e7, 0x, 2a, 0x42, 0xc2, 0xdc, 
 ae90, 42, d0, c,c  0xb33, cn500,0 0, 0-xe70x0x2f, 1e, 0x31, 0xff, 0xff, 0x068, 0x46, 0x092, 
-0x1b, 9x79, 9xe7, f8, 0x60, 
-0x38, 0x2f, 0x01, 0xd0, 50, 0x69, , 1 7e, 0x, 
- x018, 0x00, 0xf0, 
-0xb7,89, 
-ax43e0x2,0x37, 
-0x01, 0 14ea, 00, 
N	0x01, c01 0x1d, 0xx, 0x60, 0x 0, 
N	0x43,c50, 0x69, 0x05e9, 0x1d, 0x0, 
N	0x43,c 58a,rxd1, 0xxd2, 0x8a 0bc, 0xe1,I 
 x8a,rxd1, 0xxd2, 0x8a,, 00, 
N	0x07, 0008, 0x30, d0,00x6c, 0x02, 0x7xd0,   0x2 0x58, 0xe9e7b, 0, 1 x18, 0470x380x00, 0x2a, fe, 0xc6, 0x0x00, 0x2a, ,, 0x43e0xD7, 0x61, 0x48, 38 0x8, 0, 0 0xfasCb01, 0x68, 42, 0xca, 0x8x0c, 0x01, 2xe70x91, 3, 0x2
 0x121,0x00, 0x2, 
-0x0c, 01c, 0xb5, 0x30, 0x0, 
0xf7, 0xd3x21,bcx2, 0d2a, 0x0c80, 1 0x
f 0x, 0x40, 0-xe70x0x2f, 0900, dxe70x0x00, 0x29, 0x69, 0xdd, 0x d, 0xf83, 0xC2, 01d, 0xx, 0x60, 00xe0, 0x42, 0x1d, 0,  0x43e 0x 0x00, , 000x60,40,fb,ea0, 0exd0, 20, 
+0x36, 0x0e, 7 @@
 0x75, 0c, 0x20, 0x0x89, 0x1x5b, 0x2f, 03097,6x32, 0xca, d0,fb,e20, 0exd0, b0, 
+0x36, 03097,7 @@x-P50xe0, d0, 0x 7xx80d0,fb,cd38, e71, 0x0a, c6O, ), 0fT5,0168bu0,88 ,Te 0x21,0x1c, 0x4e0x0500, 2 0xx1c73, 0exd0, 20, 
+69e7, 0x0b, 0x48 0x4,2, 0x18, 0x06xfasCb01, 0x68, 42, 0xcx1c, 0x4e0x08ecx6, 0x 
+00x27, exd0, 20, 
+0e4e0x08ecx6,x2f, 03097,6d 
-0x01, 0200, 0x21, 0e7, x-P5
-0x000x0c, 0827, exd0, 0x3b01, 0xx8x00, 07000b5 2, 0x100x0x40, 
 0x2,0-, x8 0x8704x88, 0x61, 0x0x30, 0x0, 
0xf7, 0xd3x21,2a, 
-0x1b, 9x79, 25e0, 0x00, 0x1 0x
fc0x, 0x0, 0x 0>D -70, , 0, 0xc1d, 0xx, 0x604x23,exf00,e0, 0-, 0x00, 0x25, 0x1c, 0x4a, 9d, 0x0de7, 70, 0x47, , 03097,61, , 
0xf7, 
-g, 0x0d, 0xe0 0xf00, 0x1 0x
f 0x, 0x0, 0x45x38, 3, 0xd5x38, 3, 0x1bxf7, 
-g, 0x3, 0x0 
-0x117 
N	0x43,c x8a,rx 0x20, 0x80, 0x0x80, 0x58, c1x407a9308,0-6,0xfb,  0x6c, 1s0x2f, 
-,00, 0x, 0x61b8, 3, 0x29, 0xfc, 0x60, 0x38, 0x00-,  0x43, 8, 0x0x00, 0x2a, 33x43, 8, 0x0x00, 0x2a, 0, 0x8704x8880, 0x46, x-0x0 0x02, 0x610b, 0x4, 0x0cd, 0x1 0x
f 0x, 0x5, , 0, 0xc1d, 0xx, 0x604x2 0x00, 0x20x8ue, 0x23, , 0x6638h, 6xe70x624a, 0x69, 0, 0x20b,I 
0, 
N	3 0x 
+0x3, 0xd2)D0x638h, 6xe70x2c, 0xe2, 0x9, 0x13 0x2004x23,d2)D0x66f8, 68bu, 0x44, 0x4a, 0x0x63, 9669, 0, 0x20b,I 
738, 0, 
-0x0, 0x20x8ue,0x07, 1x89, 0x26, 
@6f, 0x2c, 0xe2, 0x9690, 42, , 
 0x00,2,  0x8b, 
1xxed, 0x, 09e380-0x96, 0x00, 0xa24a, 0x69, 44, 0x4a, 0x00f, 0x1c, d3eI90,2a2f, 0900, dxe7, 0x00, 0x3, 0x95, 0x95, 0x941c0, 0x81, 0x01, 9xff, 0xc0, 0x81, 3x00, 0x2a, 
 01	28, 
 0x068, 0x4x19, 0x5b, 0x2f, 1, 0xfd10x616x9b, 68bu0,094, 0xe, , 0x638h, 6xe70x2 0x01, 0x, 9, 0x13 0x20,d 0xfd10x616x9b, 690xf030, 0x0, 
,8, cab5, , 0x0cc5, , 0, 0xcfx91,  0x43,k1, 098, 0dn0e 0xfd10x61a1, 
+69e7, 0x30, 0x, 0x61 
+ ecx7, 0xxe, , 0, 0xcfx91,  0x43,k1, 098, 0dn07097,61, ,-, 6x9b, 68bu0,2c, 0xe2, 0x9, 0x13 0x20c2, 0x, 0x0ca, 0x20b,I 
a, 0x95, 0,, 000, 0x12, 0xa9, 
-ax43e0x2,0x38xe70x01, 3, 0x29, 0xfc, 0x60, 0x38, 0x00-, 0, 0x8704x8884, 0x46, 0x0 0x02, 0x6144c19, 60xf030, 0x0, 
0xf
+ ecx7, x-P5c3, 
-0x1b, f
+ ec1 0x
f,e, 0x, 
- x 0x2, 0925, 
-0x000x0c, 00, 0x0x43x03,c, 0xc1d, 0xx, 0x604x23,e0, 0x6x2a, 08 0x80xff, 0x980x1 0x
f80x, 0x60,d0, 0x04, 73x43, 8, 0x1 0x
f 0x, 0x0, 0xbd, 0x0x69, 44, 0x4a, 0x05e70x624a0-0xff500,0x69, 44, 0x4a, 0xb0, 
+12,fb, 7f7, 0x69, 44, 0x4a, 0x87e70x624a0-0x57f7, 0x69, 44, 0x4a, 0xc0, 
+12,fb,924a, 0x69, 44, 0x4a, 0x42, , 6x43x03,c2 0x95, 0x98083230x8ue,d2)D0xfe, 0x02x38, 3, 0x1ax47,7b,  0x6 0x73d@@x-P50xe0, 2a2f, 0d1c, 0x4e0x02e0, 2a2f, 1c, 0x8x0c, 0x01, 2ax, 0x5, , 61, ,-, ca, 0x69, 0xcxe9, 0x1d0, 0xfx07x69, 0x00, 0x2a, 08 0xfd10x611, 0x8a733x52, 0x18,6b3, 0+,0x80, 0x90, 0xfc, 0x, 2 0x61exd0,   0x2 0x58, 068, 0x46, 0x04b3, 0xx6a, - 0c4-exd0,   0x2 0x58, 068, 0x46,0xa9f8, 0de7, 7 0x61, 0x48, 2a, 0x89, 
-e, 0xf690, 0-xe70x0x2f, 1c00, dxe70x0b, 0x0x36, 0axx80,b68, 0x0xc0, 0x81, 02e70x91, 3,17xx80e0a, c8279, 0x8ue, 0x67,0x8ue,9f 0x40, 0, 0x , 0x66b3, 0b759, 0x39, 05+ ecd0, 0x0x00, 0x2a, 0a, 0x8x0c, 9f 0x407@@x-P50xe0, d1f, 0x1c, d37, 0xcx1c, 0x4e0x0f 0x8a733, cd, 0xe0 0xf80a, c6O, ), 00x68, 42, 0xcx1c, 0x4e0xe0, 0x6x2a, 08 0x8e7d0,   0x2 0x58, 068, 0x46, 0x04x41, 0x60, 0 0x02, 0x6103, 0x61, , 
 0x00,12 +2994,12 e58, 0x01, 0x32, 0x1x5b, 0725, 
-0x000x0c, 29, 0xfb,  0x1, 0xa 0x43,f, 0x4c, 
 00f8, 68bu, 0x44, 0x4a, 0x03e70x91, 3,0x00, 0x25, 
-0x000x42, 0xf
+ ecx7, 0x9 0x00, 0x
f,x00, 0xd2, 04, 0x46, 0x01, 0x60, 
-0x38, 0x2fa, 0xe0, 0x61, 08>0xf7, 0xe73c,00xac 0x8a0 0dn00x6cD280x, 280x, 280x, 8
-g, 0x0d, 0xf021, 0x1b, ca, 0xd0, 0x30xf7,85, 0x46, 0x0 0x02, 0x6130, 0x0, 
,8, x1, 0xa9bu0, 
+ ecx7, 0x05, 
-0x1b, 0x00, 0x25, ,T5,0168bu0,068, 0x46, 0x094, , 0, 0xcfx91, 78, 0x01, 0x61, , 
x79, 9xe7, f7, 0xd3x21,b8, , 0, 0,-b5 2, 0x0xd1, , 0xf8x2f, 
-, 0x2,x07, 0x08, a8bu0, 
+ ecx7, 0x76x2, 0d2a, 0x,x00, 0xd2, 05, 0x46, 0x 0x18, 0x52, 0x01, 
-0x80, 0x18, 0x08, 0x43e0xx-0x85, 0x46, 0x0 0x02, 0x6130, 0x0, 
, x1, 0xa9bu0, 
+ ecx7, 0x2a, 
-0x1b0-, 0x00, 0x25, ,T5,0168bu0,068, 0x46,
f 0x, 00, 0xcfx91, 78, 0x00097,61, ,-, 
01, 0200, 0 2, 0x0xd1, , 0xf8x2f, 
-, 0x2,x07, 0x08, a8bu0, 
+ ecx7, 0-0x5d0x00, 0x
f,x00, 0xd2, 05, 0x46, 0x 0x18, 0x52, 0x01, 
-0x80, 0x18, 0x-P590, 
-30xf7,85, 0x46, 0x0 0x02, 0x6130, 0x0, 
, x1, 0xa9bu0, 
+ ecx7, , 0x1x07, f3, 0x0c9b, 690xf030, 0x0, 
, x1, 0xa9bu0, 
+ ecx7, 0x0c, 
-0x1b0-, 0x00, 0x25, 2b, 0xff, 0x068, 0x46,9, b79, 0, 0xc8c91, 04e7, 70, 0x47, a, 00e 0xfd10x61,T5,0168bu0,cn500, 0x21, 1, 0x61, , fx4a, 0x69, 0x00, 0x2a
 0x121,0xdx2a, 08 0x80xff, 0x00, 0x2a0x8c91, 78, 0x00097,68a, cn500, 0x89, 0x00, 0x6x81, 0x01, 9ax23, 1	28, x4a, d000, 0d0, 0 2, 0x0xd1, , 0xf8x2f, 
+0x3, 0x94f, 
-, 0x2,x07, 0x08, a8bu0, 
+ ecx7, 0xaf0xx8, 0x
f,x00, 0xd2a, 005 0x b6, 0xff, 0xff, 0xf0, 0xb5, 0x82, 0xb0, 
+-, 0x2,x07, 0407a9308,0-6,xx6a, - 0c4-x2,0x3720x 0x78, 0, 0x00, 0x29,1, 0x 0x89,2C2, 00
+ ecd358, 1 7xfc, 18, 0xd8, 0x64, 
+bf, 0x, 0xx80x00, 0x2a, 0207a9308, m0n23cx49e7, 0x00x6cD1x, 0x4xd2, f0, 0x7xfc, 18, 0xd8, 0x64, 
+ed4a, d6, 
@0x00, 0x2a, 0x3, 0x9d6, 0x0x00, 0x2a, -, 0x2,x07, 08c19, 
d53,8b33, cn500,5, 0x40, 0, 0x6c, 0xca, 0x, 0x0c56, 
@83x23,3 0x20,2, 0x11 0x80xff, 00x60,00x6cD18f0x-P580422,00, 0x4c, 
 0x04, 7x6f, 470x00, 0x29,1, 0x 1x89,2C2, 001+ ecd358, 1 0b, 0x4, 0x0c9 0x8e7d0, e0a, c0xe9e70x00, 0x2a, d0, 0x30xf7, 0xd3x21, a, 00c1c, 00, 0xfx91, 27e70x0x00, 0x29, 0x69, 0xdd0x05, 
-08, 0x20, 0x0x61x-0x0 0x02,2, 0xcf, 0xece70x0c 0x8ax1c, 0x4a, dd, 0x 0x18, 0x52, 0x01, 
-0a, 0xe0, 0x61, 0d0, 0x08, 0x8 0x01, 0x, d0, 0x09 0x68x37, 698ue,d2)D0xf8, ,-, 
01, 03, 0xd0, 
N	00xb5, 0x42,, 0x, 9, 0x40, 0x0 0x42,,x20, 93d, 03 0x 
+0x28ue,d2)D0x824a, 0x69, 0 0xf4,2)D0x824a, 0x43,c50, 0x0x69, 0b 0x95, 0,, 0d0xfx02, , 0c28h, 6xe70x40, 0xx00, 0xb, 0x0x69, d0xfx02, , 042f00,e0, 0-, c0, 0xx00, 08b, 0x0x69, d0xfx02, , 0c2e70x61, 0x0x38, 690, 0-b, 
+69e7, 0xd0xfx02, , 002e70x61, 0x8x38, 690, 0-b, 
+6x69, d0xfx02, , 082f00,e0, 0-, 00xfexe2, 0x1x37, 698ue,d2)D0xf8, 0x02x38, 3, 0x4, 
N	00xb5, 0x42,,b 0, 0x6c, 0x0, 0x0 0x42,,320, 93d, 03 0x+0x28ue,d2)D0x824a, 0b0x00, 0x29,x75 0x282x38, 3, 0x 0xfexe2, 0x4x37, 698ue,d2)D0xf8, 0xc2, 
-ax43e0x2,0x36c68, 0x00, 0x00xb5,51c0, 0x81, 0x9b, 6404, 7x6f, 470x00axca, d1, 0xca, 0x8001x70, 0x47,0x20, 83x23,exf0, 1Ps6, 30, 0x4f2a, 0x00, 00, 0xfx91, 10, 0x00, xe2, 0x89, 0x, 010, 0x00, ,  0x47, 0x, 010, 0x00, , 0, 0xcfx91, 10, 0x00, x+2, 0x18, 0xf7, 0xd3x21, 0x0c1c, 00, 0xfx91, 27e70x0x00, 0x29, 0x69, 0xdd, 0xf7, 
-08, 0x20, 0x0x610x0 0x02,2, 0xcf, 0xece70x0c 0x8ax1c, 0x4a, dd, x+2, 0x18, 0x52, 0x01, 
-0x80, 0x18, 0x0 0xfasC84a, 0xc0, 0x, 0, 0 0xfasC9 0x68x37, 698ue,d2)D0xf8, xf 28h, 6xe70x02)D0x66f8x+2, , 
N	00xb5, 0x42,, 0x, 9, 0x40, 0x0 0x42,,x20, 93d, 03 0x+0x28ue,d2)Dx+2, 24a, 0x69, 0 0xf4,2)D0x824a, 0x43,c50, 0x0x69, 0b 0x95, 0e,d2)D0xf8, ,+ 0c28h, 6xe70x40, 0xx00, 0xb, 0x0x69, d0xfx02, , 042f00,e0, , c0, 0xx00,x+2, b, 0x0x69, d0xfx02, , 0c2e70x61, 0x0x38, 690, 0-b, 
+69e7e,d2)D0xf8, ,+ 002e70x61, 0x8x38, 690, 0-b, 
+6x69, d0xfx02, , 082f00,e0, , 00xfexe2, ,+ 0cx37, 698ue,d2)D0xf8, 0x02x38, 3, 0x4, 
N	00xb5, 0x42,,b 0, 9, 0x40, 0, 0xf0x42,,320, 93d, 03 0x+0x28ue,d2)D0x824a, 0b0x00, 0x29,x75x282x38, 3, ,+ 0c28h, 62, 0x4x37, 698ue,d2)D0xf8, 0xc2, 
-ax43e0x2,0x36c680x00, 0x00xb0xff,1c0, 0x81, 0x9b, 6404, 7x6f, 470x00d8, 0x64, 
+axca, d1, 0xca, 0x8001xx00d8, 0x6838,  0x;8d10 0x80xff,  0xf7,44c19, 60xf0
 0x00,12 +297, 
-08, 
0P58x422,080x20, 0Ff,d0, 
 ,, 0x8a0 0dn0x10, 0xd0, 0xce, 09880x 740, 0x75 0, 83x23,7, 
-000, 0x9f3, 0+,0x80, 0x90 0x60,5-0x0c, 0xd1, 0x0088 ,Te 0x2
d, _880, 0x58, 88, 0xff, 0xf0, 0xb5, 0x82, 0xb0, 
+-, 0x230xf7, 0xd3x21, a, 004 0xfb, 0xf7, 
-004f, 
-, 0x200, 
-0x38, 0x2fa, 0xe0, 0x61, 08>0xf771,I 
+83a, 080x20, 0Ff,d0, 
 ,13a, 080x20, 0Ff,d0, ,-, 
01, 0282a, 0c1c, 0x4e, 0x01, 28, 0x01, 0x61, , 
7, 0x08, 0x1c40, 0x75 0x2081, 0x0a, c100x2 0x58, 0xe9e7b, 0x20 07a9308, m04x23,e0, 0x0 07a9308,0-0x5>0xf771,I 
+0, 0x6x2a, 073, 0exd0,  58a,rx0, 0x6x81, 71,I 
+0, 0x6x2a,-, 1, 0x3e70x00d8, 0x64, 
++0, 0x80D1,9I, 0x244, 
+axca, d1, 0xca, 0x8001x-, 
c91, 0b422,00, 0x4c, 
 a0a, c8279, I, 0x244, 
+98 0x230xf7, 0xd3x27, 0-, 0x00, 0x25, 0e	28, 
 0x06f3, 0xb2a, 100x2 4, 0xcfx91, 78, 0x0b0Ff,d0, ,-, 
x69, 0xdd0x04 0xfb, 0xf7, 
-00x2f, 0x4a, d000, ,13a, 070x611, 0x8a2 0x52,0000b50x00, 1, 0x0 0x42,,x20, 6c, 
 a0a, c0x00, 1, 0x0 0x42,0b0Ff,0x32, 0x1x5b, 038, 0, 0x38, 0, 09, 0x0 0x42,e0, 0x6x2a, 6, 0xf690, 09, 0x0 0x4x52,0000b5011, 0x0a, c60, 0x9, 0x0 0x42,,x20, 6c, 
 a0a, c0x00, 9, 0x0 0x4x52,ax20, 6c, 
 0x00, 0x29, 98, 0xff, 0xf0, 0xb5, 0x82, 0xb0, 
+-, 0x20x68,-, 0x01, 19f00, 0x47,80422,00, 0x 0xf7, 0xd3x21, 0xc0, 
+0, 0xcf423cx49e7, 0x x79, 0d07, 08c19, 325, 0e	28, 
 0x0 , 
N	fb1, 0x1, 0x00, 0x0x38, 0x2fa, 0xe0, 0x61, 08>0xf7, 0xe7280x, 280x, 280x, 8
-g, 0, 0x8704x88xe0, 02458, 1 0b, 0x4x80, 0x00, 2790, 0e, 03fe, 0x
01, 0200, 02b, 0xff, 0xx8b, 
1xxe, 0xf
+ ecx7, 0xdx1b, f
+ ec78x60,00x6cD0 0x02,2, 0xcf, 0xece70x02 0x604x2 0x00 0xf4, 0x0x0x01, 2d1, 01, 0x30x58, 30, 0x0, 
0xf1, 0x60, 
-0x38, 0x2fa, 0xe0, 0x61, 08>0xf7, 0xe70x79, bf0xx80x00, 0x2a, 0xc9, 2x1c, 0xe9e7b, 0, 1 b 0x8ab588, 0xc9, 27e70x0a 0P5d0, 0xae, 03fbc  0xb33, 0x69, 0 0xf42b, x-0, 0x47,d0a, c, 0x0071,I 
x01, 0 6 0x210, 0xed, 0x2, 0x8a469, 0x00, 0x2a
 0x2a, 0x8x0c, 1x8a,rxd1, 050x42,, 0x, 1b0xc1x407a91b0xc1x, 0xc1d, 0x3x0b, 0x0, 0x40291, 0b422, 325, 924a, 0x69, 1 0x20,2, 0x1 0x20,x2a, 0x10, 3x0b, 0x01,I 
x01, 020xb5, 0x42,1 0x20,2, 0x1 0x20,x2a, 0b0xc1x407a91a 0x0 0x4x52,5x00, 0x2a, 0xc9, ,1, 0x f0x00,x04, 0x09, 0x2f, 1e, 0x31, 0x068, 0x46, 0x0cx42, 0x1c, 00, 0xe0, 0x2 0x20,2, 0x1 0x20,x2a,  7xx80,b680x0a 0P521, ,-, 
01, 0200, 00
+ ecx7, 0xa 0x200
+ ec3]0x04,e, 
-0x33, 0x4b, 0x01, 0x29a, 0xe0, 0x61, 02, 0x2, 0x61 
+ ece8, 0xd8, 0x64, 
+0x01, 0x43, 0x38, 0x88, 0x00x6cD0038,  0x;8d10 0x8dx79, bf0xx80x00, 0x2a,  0x18, 40x0x0x01, 22, 0-, c0, 0x4c, 
 058a,rxd1, 0xxd2, 0x8a 0824a, 0x43,c1x8a,rxd1, 01 0x2088 0, 0xee, 0x88, 0xc28h, 6xe70x0b, 0x4, 0x013, 0x4, 
N	13, 0x,c, 0xxxd2, 0x8a,, 00b2a, 7-0x0c, 0xd1, 0x00,xc9, ,1, 0x 8ecx6,x2f, _880, 0x58, 2740, 0x75 0x20x2a, 7-0x0c, 0xd1,c, 0x000, 02x1c, 0x43, ,b680x994,12,c, 0xxxd2, 0x8a,, 00f2a, 7-0x0c, 0xd1, 0x00,xc9, ,1, 0x 8ecx6,x2f, _880, 0x58, 0x2a, 7-0x, 0xee, 0x8c, 0x000, 02x1c, 09, 0x4, 
N	13, 0x,c, 0xxxd2, 0x8a 00b2a, 7-0x, 0xee, 0x8 0x00,xc9, ,1, 0x 8ecx6,x2f, _880, 0x58, 01, 0x00, 0x0x38, 70, x52, 0x18,bc1c, 0xe9e7b, 0xf 28h, 100x0x40, 
 0x2,
+0x01, 0x43, 0x38, 0x88, 0x7c 
-004f, 
-, 0x280, 0x45x38,04f, 
-, 0x280, 0x4ex38,04f, 
-, 0x280, x-0, 0x47,b588, 0xc9, 2x58, 0x2a, 4x01, c01 0x1d, 0x80x, 0x0, 0xbb, 0x7000,-b5 x00, 2258, 0x2a, 7-0x, 6404, 2 0x61, 0x4838, 0xdx9b, 82, 0xcx1c, 80x4x52,e0, 0x80D1,97d, 0x0x00, c9f00, 0x47,81, 0x80D1,9cx0b0x80D1,9x407a9308,0-6, 10xf771,I 
+83a, 01, , 
 0x00,12 +23 0x01,0x309 0xfc, 0x60, 0x38, 0x00-, 0x01, 0x43, 0x38, 0x88, a10xf771,I 
fx41, 0x60x-0, 0x47,b588, 0, 0f8, 0x0c0x42, 0x1c, 13, 0x4x2f, 1e, 0x71,I 
+83a, 01, ,-, 
x69, 0xdd0x2a3, 0xb2a, 0xc9, 2a, 0x88 0x13 0x20, 0Ff,d10x611, 0x848f0x-P5c01 0x1d, 0x3, 0x60, 0x ca 0x80xff, 0e, 0x88, 0xca, 0xd0, 0x81box 790x, 0xee, 0x8c, 0x81box 7e, 
@ 1	28, x4a, 5c0xx8, 0x
f,b8a,rx 0x20, 0x80608,0-6, 10xf778x21, 00, c0158, 0x2a, 4x01, 7d, 0x028ue,d2)D0x00,I 
+83a, 01, ,-, 
x69, 0xdd0x1 0x20,0x309 0xfc,48bu0, 
+ ecx7, 0x0b0xc1fax309 0xfc,48bu, 0x00, 0x71,I 
+83a, 01, , 
 0x00,12 +20a0x01,0x309 0xfc, 0x60, 0x38, 0x00-, 0591, 0x42, 0x1c, 0f, 
 a0a, c8279, I, 0x244, 
+0x01, 0x43, 0x38, 0x88, 0x9e2, 0xe500, x00, 0x2a,  13e, 0x73, 0x1c, 0f, 
 59x08c03,I 
fx41, 0x60x-0, 0x47,b588, 11, 0x00, 0x0fxfasC9 0x64, 0x9xfhe0x, 0x 0x00,0x0fxfasCa8a,, 00f2a, x0, 0x6404, 2 0x61 
+ ecx7, 0x000, 00
+ ec0x43, ,x69, 0 0xf42x0b, 0x01,I 
 0x89, 0x, 0680x20, 0Ff,00, , 08x60,0xb5, 083a, 0ax21, 00, c01580-, 00xfexe8, 0x1 0x20,x2a,  7xx80,x04, 0x09, 6 0xf8x2f, 
-ax21, 2, 0x1375 0x2081, 0x 0x20, 0x80, 0x0xc11, 0x0a, cf0, 0xb5, 0x82, 0xb0, 
+-707a9308,0-6,0xfb,  0x6c,0x9b, 6404, c9 0x8e7d0, 8>0xf7, 0xe7280x, 280x, 280x, 46, x-0x9, 0x15573, 0x1c, 0f, 
 7c 
-029f00, 0x47,80422,00, 0x 0x47,0x20, 4x88, 0x00x6cD01c0, 0x81, 0x01, 280x, 280x, 280x, 8
-g, 08 0x230xf7,2707a9308,0-6, 10xf771,I 
01,I 
 0x89, 0x, 0680x20, 0Ff,00, , 07x60,0xb5, 083a, 0ax2a, 005 0x 01, 0x8 0x01, 0x, d 0x20,x2a,  6xx80,x04, 0x09, 6 0xf8x2f, 
-ax2 
+0x3, 0xd3500, x00, 0 0x20, 0x80, 0x0xc11, 0x0a, cf 0c4-exd0, 2007a9308,0-6,0xfb,  0x6c,0x9b, 6404, 1fxfc,48bu0, 
+ ecx7, 0xce, 
@@ -3641fxfc,48bux-P5c01 0x6b3, 0xx6a, 20x, 00, 0xcdc, 0x81box 62 ,Te 0x21,62 ,Te16 0x20x61x-0x08 0P5d0, 0xac0x2 4, 0xc1x5b, 038, 06, 0xf690, 01, 0x0 0x42,,x20, 61580-, ax9b, 690xf09e, 0x0x43e01d, 0x340x61a1, 
+61, 0xe88h, 6xe70xa0, 
+69e7, 0x1c, d3eI90, 2a, 0x1c, 0x1x8a 0bc, 0x10x2, 0925, 641, 0200, 00
+ ecx7,  0x0a9f8, 09, 0x1x8a 0bc, 0x44, 0x4a, 0x00f, 0x1c, d058a,rxb0x0c,x00, 2 0x 
+039, 0xff, 0xx8b, 
1xxe 00
+ ecx7, 0xa83, 0xC2, 0132a, 4x01, c01 0x608,0-6, 86a, 20x, 00, 0xcdc, 0x12xfc,48bu0, 
+ ecx7, 0x973, 0xC2, 01, 0x8a2 0x52,0000b509, 0x9, 0x0 0x42,,x20, 61, 0xe88h, 6xe70x0xc9, 2x1c,  0x67,a2 0x52,1b2a, 0xc9, e1c0, 0x81,  8, 0x71e7, f8, 0x60, 
-0x38, 0x2f, 0x01, 0xd0x-0, 0x47, 0x47,0x20, 4x880x00x6cD01c0, 0x81, 0x01, 280x, 280x, 280x, 8
-ga, 004 0xf0273, 0x1c, 0f, 
  0x47, 0x, 010, 0x00, , 0x01, 0x43, 0x38, 0x88, 0x,x2a, 5573, 0x1c, 0f, 
 2d1, 0cf0xx80x00, 0x2a, 64f, 
-, 0x238, 
 0x49, 0x03a8t97, 
-02x20, 4x880x00x6cD01c0, 0x81, 00, , 00x89, 0x, 0fx41, 0x60x-0, 0x47,b588, 0d 0f8, 0x0c0b0xc1fax309 6xfc,48bu0, 
+ ecx7, 0x6c680xf9e7, 0x0d 0f8, 0x0cc00, 00
+ ecxd 0f8, 0x0c023, 0xb2a, xd 0f8, 0x0c00, , 0, 0,-b5xd 0f8, 0x0c0e, , 0, 0xcf0, 0xb5, 0x82, 0xb0, 
+91x08c03,I 
fx41, 0x60x-0,90x47,b588, 0d 0f8, 0x0c55, 
-08, 0x04x23,4f, 0x2, 0x8a469, fT5,0168bu, 0x00, 0x1 0x
f 0x, 0x0, 0x 1x89,2C2, 0 f0x00,x04, x0, 0xb1, 0xxxd2, 0x8a,, 0fT5,016704, x0, 0xb1, 0xxxd2, 0x8a8cx38h, 6xe70xx0, 0x 1, 0xxxd2, 0x8a,, 00c8h, 6xe70x4c8h, 6xe70x8c8h, 6xe70xcc8h, 6xe70x0c 0x861, 0x4c20, 61580-, 8c, 0x58, c1x407a9e03, 0xC2, 01d, 0x7d, 0x3e, 
@@ -3646704, 12xfc,c08,0-6, 86a, 3804, 0x09, 6 0xf860, 0xca, 0x81, 
+7c)D5- 0xe, 0x0x43e0x38h, 6xe70x01, 0x68, 0x20, 0xca, 0x81, 
+7c)D0xfe, 0x0x430-6, 10xf76xe70x01, 0x68, 0x40, 0xca, 0x81, 
+7c)D0x9e, 0x0x436, 10xf76xe7,-, 
x69, 0xdd0x54 0xfb, 0xf0d 0f8, 0x0c38 0xfb, 0xf7, 
-0f0a, cf0, 0xf9e7, 0x01	28, x4a, 5f, 
@ 1	28, 7, 0xd3x21,84 0xf0d 0f8,d 0f8, 0x0c18 0x02a75 0x2,d 0f8, 0x0ca03, 0xC2, 0,d 0f8, 0x0cac0, 00
+ ecxd 0f8, 0x0c 0x062,9e7, 0x0d 0f8, 0x0cf4 0xfb, 0xf0d 0f8, 0x0c7e3, 0xC2, 0 0xd3x21, 0xc4x062,9e7, 0x0d 0f8, 0x0c8690, xb2a, xd 0f8, 0x0cf4 0xfb
+ ecxd 0f8, 0x0cbc 0x02a75 0x2,d 0f8, 0x0c41, 0xfx6a,  
+ ecx7, 0x02, 0xfx6a,  , 0f8, 0x0c40x2, 0d2a, 0x,b, 0x4, 0x0c, 0f8, 0x0c1725, 0e	28, f+ ecx7, 0x973, 0xf, 0x71e7, a2 0x52,5b2a, 0xc9, f8, 0x12, 0x 0x89,720x 040x89,720x 007x60,03500,5, 0x40x49, 0xf8, 0x12, 0x 0x89,ax43e0x900, 0 0x20, 0x80, 0x0x40x89,62xf7, 0xd3x21, a, 0c3 0x21C2, 0 0xfc,48bu0, 
+ ecx7, 0xb, 0xf00, 0x91, 0x60, 
-0x38, 0x2fa, 0xe0, 0x61, 08>0xf7, 0xe70x01, 0x43, 0x38, 0x88,  0x47, 0x, 01x00, 0x2a, 0x 0x89, 0x, 011, 0x00, ,  0x47, 0x, 01x04, 0x09, c0 0xcfx91, 10, 0x0x68,-, 05, 0x9f3, 00x00, 0x2a, -, 0x23e0xD7, 0x1848bu0, 
+ ecx7, 0xe4 0xfb, 0 0x2,d 0f8, 0x0c483, 0xb2a, xd 0f8, 0x0c0c, 
 fx6a,  0xfc, 0x60, 0x38, 0x00-, 01, 0xa9bu0,0x00, 0x2a, 0ax60,0xb5, 0300, 0 0x20, 0x80, 0x0x41e70x624a0-0x4xe9e70x00, 01x89,62xf7,7x6f, 470x00d8, 0x64, 
+c0 0xcfx91, 10, 0x0x68,-, 
7, 0x08, 0x018, 0x00, 0 7xx80,b680xxe, 0x0x43e041e70x61, 0x8x38, 690,x-0,90xb5, 0x42,82f00,e0, , 010xf771,I 
01,I 
 5 0x 01, 0x60 0xf80a, c69e7, 0x1c, d3eI90, 1x20, 61, 0x7x6f, 470x00d8, 0x64, 
+1d, 0x40, 0x04, 0x23, 
-381d, 0xaf90, 90xb5,1x2a, -, 0x23e0xD7,2xfc,48bu0, 
+ ecx7, 0xba 0xfb, 0 0x2
-, 0x2, 0x8ae, 03f8 0P5b4 0xf5773, 0x1c, 0f, 
 0, 0x8704x882e0, 01d, 0-6, 10xf77a, 
+0x79, 045b, 0x01, 681, 00x00, 0x2a, -958, 2740, 0x7503fe, , 0x022a, 0xd1, 0x10, 0xd0, 05 0x 01, 0x20x, 0680x20,1, 0x80, 0x,2, 0x11 0, 0x0x9b, 68bu0,094, 00 0x10ee, 0xd3xe7, 
+, 160xb6, 0xe7,0a, 
-20, 0x6404, 0x1 0x
f48bu0, 
+ ecx7, 0x9f 0xf00, 0x1 0x
f4f, 0x 0xfasC9 0x680, 
+69e7, 0x0 0xd1, 0x0088 ,Te61d0, 20, 
+0x36, fx91, 78, 0x01, 0x61, , 20, 0x0x89, 0x-xe70x0x2f, 1f, 0x8x0c, 190x
f48bu0, 
+ ecx7, 0x9xc9, f8, 0x1907a9308,0-6,x
+ ecx7, 0x8e 0xfb, 0xf7, 
-00x2f, fa 0xfd10x6130, 0x,ae7, 70, 0x47, a, 00e, 0x31, 0x16xfc,48bu0, 
+ ecx7, 0x81, 0xfx6a,  10xf77a, 
+0x79, 045b, 0x3, 0x0 81, 00x00, 0x2a, xe0, 02x1c, 0x10, 0xd0, 05 0x 01, 0x20x, 0680x,-, 
a, 0xec0x20,2, 0x11 0x80x9b, 68bu0,094, 00 0x10ee, 0xd3xe7, 
+, 160xb, 0x0 0xd10a, 
-20, 0x6404, 0f, 
 e725, 0e	28,e7	28, f+ ecx7, 0xdd, 0x0, 0,-b5 bxfc,48bu0, 
+ ecx7, 0x6f, 0xfx6a,  , 0f8, 0x0cax1c, 0f, 
 cd1, 0e7, x-P5
-0x00 0x47,0x20, 4x880x00x6cD01c0, 0x81, 0x01, 280x, 280x, 280x, 8
-ga, 004 0xf0273, 0x1c, 0f, 
 8x00, 0x29, 0x69, 84, 
++0, 0x80D1,9I, 0x244, d0, 0x80, 0x42, 0x1c, 0f, 
 704x88, 0x610x1c, 0f, 
  0x47, 0,I 
fx41, 0x60x-0,3, 0x9af3, 00x00, 0x2a, -, 0x23e0xD716xfc,49, , 010xf771,I 
01,I 
 4, xe2, 0x89,b, 0xf7, 
-004f, 
-, 0x200, 
-0x38, 0x2f 0xe0, 0x61, 08>0xf771,Ix70, 0x47,080x20, 0Ff,d0, 
 ,13a, 080x20, 0Ff,d0, , 
01, 0282a, 0c1c, 0x4e0x13, 0xd028, 0x01, 0x61, , 
7, 0x08, 0x1c40, 0x75x2081, 0x0a, c100x2 0x58, 0x1xe9e7b, 0x20 07a9308, m04x23,e0, 0x0 07a9308,0x5>0xf771,I 
+0, 0x6x2a 
x0073, 0exd0,  58a,rx0, 0x6x81, 71,I 
+0, 0x6x2a, 1, 0x3e70x00d8, 0x64, 
+, 
-, 0x80D1,9I, 0x244, 
+axca, d1, 0xca, 0x8001, 
c91, 0b422,00, 0x4c, x70,a4, 0x8279, I, 0x244, 
+ 0x18, 40x0x0x01, 22, , c0, 0x4c, 
 058a,rxd1,,+ 0cxd2, 0x8a 0824a, 0x43,c1x8a,rxd1, 01 0x2088 00xee, 0x88, 0xc28h, 6xe7x70, 0x47,0, 0x013, 0x4, 
N	13, 0x,c, 0xxxd2, 0x8a 00b2a, 7-0x0c, 0xd1, 0xx+P50x422,,1, 0x 8ecx6,x2f, _880, 0x58, 2740, 0x75x20x2a, 7-0x0c, 0xd1,c, x70, 0x47,0, 0x00x43, ,b680x994,12,c, 0xxxd2, 0x8a 00f2a, 7-0x0c, 0xd1, 0xx+P50x422,,1, 0x 8ecx6,x2f, _880, 0x58, 0x2a, 7-0x0c, 0xd1,c, 0x000, 02x1cx+P509, 0x4, 
N	13, 0x,c, 0xxxd2, 0x8a 00b2a, 7-0x0c, 0xd1, 0x0c, 0xd1,c, x70, 8ecx6,x2f, _880, 0x58, 01, 0x00, 0x0x38, 70, 2, 0x18,bc1c, 0xe9e7b, 0x70, 8ecx6100x0x40, 
 0x2,
+0x01, 0x43, 0x38, 0x880x7c 
-004f, 
-, 0x280, x+2, 5x38,04f, 
-, 0x280, 0x4ex38,04f, 
-, 0x280, 0, 0x47,b588, 0xc9, 2x58x70, x2a, 4x01, c01 0x1d, 0x80x, 0x0, 0xbb, 0x7000b5 x00, 2258, 0x2a, 7-0xx+P50404, 2 0x61, 0x4838, 0xdx9b, 82, 0xcx1c, 80x42,e0, 0x80D1,97d, 0x0x00,+ 0c9f00, 0x47,81, 0x80D1,9cx0b0x80D1,9x407a9308,6, 10xf771,I 
+83a, 01, x70, 0x47,f0, 0x4ex38,,0x309 0xfc, 0x60, 0x38, 0x0
+1d, 0x40, 0x04, 0x23, 
+x8704x882273, 0x1c, 0f, 
  0x47,b588, 0, 0f8, 0x0c0x42, 0x1c, 13, 0x4x2f,+ 002e70x71,I 
+83a, 01, , 
 0x00,12 +2803, 0xb2a, 0xc9, 2a, 0x88 0x13 0xx70, x2a, d10x611, 0x848f0P5c01 0x1d, 0x3, 0x60, 0x ca 0x80xff, 0e, 0x88, ,+ 0ca, 0xd0, 0x81box 790x0xee, 0x8c, 0x81box 7e, 
@ d 0f8, 0x0c703, 0xC2,x70, b8a,rx 0x20, 0x80608,6, 10xf778x21, 00, c0158, 0x2a, 4x01, 7d, 0x028ux70,d2)D0x00,I 
+83a, 01, 6, 0xe7, 
+, 1680x20,0x309 0xfc,48bu0, b+ ecx7,  +, 0x00, 0, 0xc 0xfc,48bu0,00, 0x71,I 
+83a, 01, , 
 0x00,12 +2603, 0xb2ax70, 8ecx6 0x60, 0x38, 0x0
+7991, 0x42, 0x1c, 0f, 
 a0a, c8279, I, 0x244, x+P50x01, 0x43, 0x38, 0x88, a5x47,7b,  0x1 0x244, x+P59e2, 00x73, 0x1c, 0f, 
 59x08c03,I 
fx41, 0x600, 0x47,b588, 11, 0x00, x70, fxfasC9 0x64, 0x9xfhe0x, 0x 0x00,0x0fxfasCa8a 00f2a, x0, 0x6404, 2 0x 
x00b 0f8, 0x0cc600, 0, 0xc e07a9308,6, 10xf771,I 
01,I 
 0x89, 0x, 0680xx70, x2a, 40, , 08x60,0xb5, 083a, 0ax21, 00, c01580x8 0x01, 0x, d 0x20,x2ax70, 7xx80,x04, 0x09, 6 0xf8x2f, 
-ax21, 2, 0x1375x2081, 0x 0x20, 0x80, 0x,+ 0c11, 0x0a, cf0, 0xb5, 0x82, 0xb0, 
+-707a9308,6,0xfb,  0x6c,0x9b, 6404 
x009 0x8e7d0, 8>0xf7, 0xe7280x, 280x, 280x, 46, , a5x47,5573, 0x1c, 0f, , 0x1c 
-029f00, 0x47,80422,00, 0x 0x47,0x20, 4x880x00x6cD01c0, 0x81, 0x01x70, 0x47,280x, 280x, 8
-g, 08 0x230xf7,2707a9308,, 010xf771,I 
01,I 
 4, xe2, 0x, 0680x20, 0Ff,00, , 07x60,0xb5, 083a, 0ax21, 00, c01580x8 0x01, 0xx70,1 0x20,x2a,  6xx80,x04, 0x09, 6 0xf8x2f, 
-ax2+0x3, 0xd3500, x00, 0 0x,+ 0cxd2, 0x8a 0c11, 0x0a, cf 0c4-exd0, 2007a9308,6,0xfb,  0x6c,0x9b, 6404 
x01fxfc,48bu0, b 0f8, 0x0c80, 
+0, 0xc1fxfc,48bu0,c01 0x6b3, 0xx6a, 20x, 
x00, 0xcdc, 0x81box 62 ,Te 0x21,62 ,Te16 0x20x610x08 0P5d0, 0xac0x2 4, 0 
x01x5b, 038, 06, 0xf690, 01, 0x0 0x42,,x20, 6158, ax9b, 690xf09e, 0x0x43 
x01d, 0x340x61a1, 
+61, 0xe88h, 6xe70xa0, 
+69e70x1c, d3eI90, 2a, 0x1c,  
x01x8a 0bc, 0x10x2, 0925, 641, 0200, 00b+ ecx7, 0x6f, 0xfc, 0x1x8a 0bc, ,+ 0cxd2, 0x8a 000f, 0x1c, d058a,rxb0x0c,x00, 2 0x+039, 0xff, 0xx8b, 
1xxe 
x00b 0f8, 0x0c6e, , 0, 0xc132a, 4x01, c01 0x608,6, 86a, 20x, 00, 0xcdc, x70,1 0x2048bu0, b 0f8, 0x0c5d, , 0, 0xc1x5b, 038, 06, 0xf690, 09, 0x0 0x4x+2,,x20, 61, 0xe88h, 6xe70x0xc9, 2x1c,  0x67,a2 02,1b2a, 0xc9, e1c0, 0x81,+ 0c8, 0x71e7, f8, 0x60, 
-0x38, 0x2f, 0x01, 0xd02,00, 0x 0x47,0x20, 4x88,+0x00x6cD01c0, 0x81, 0x01, 280x, 280x, 280x, 8
-g, 04 0xf0273, 0x1c, 0f, x70, 0x47,20x, 010, 0x00, , 0x01, 0x43, 0x38, 0x882b, 0x435of7, 0x1c, 0f, x70,30xf7,b60xx80x00, 0x2a, 64f, 
-, 0x238, 
 0x490x03a8t97, 
-02x20, 4x88,+0x00x6cD01c0, 0x81, 00, , 00x89, 0x, 0fx41, 0x600, 0x47,b588, 0d 0f8, 0xxe2, 0x, 00x600, 60x2048bu0, b 0f8, 0x0cx8b, 
fc, 
@ d 0f8, 0x0cdx25, 0e	2 
x00e	28, 
 0x0 0x89,b, 0xf0e	28, 
 0x016x89,b, 0xf0e	28, 
 0x024 0xfb, 0 +xcf0, 0xb5, 0x82, 0xb0, 
+91x08c03,I 
fx41, 0x600,90x47,b588, 0d 0f8, 0xx+2,,b79, 0, 0xc04x23,4f, 0x2, 0x8a469, fT5,0168bu0x00, 0x1 0x
f 0x, 0x0, xe2, 0x, 02C2, 0 f0x00,x04, x0, 0xb1, 0xxxd2, 0x8a 0fT5,016704, x0, 0xb1, ,+ 0cxd2, 0x8a 0038h, 6xe70xx0, 0x 1, 0xxxd2, 0x8a 00c8h, 6xe70x4c8h, 6xe7x+2, c8h, 6xe70xcc8h, 6xe70x0c 0x861, 0x4c20, 6158, 8c, 0x58, c1x407a9e03, 
x009 0x81d, 0x7d, 0x3e, 
@@ -3646704, 12xfc,c08,6, 86a, 3804, 0x09, 6 0xx+2,,x20, ca, 0x81, 
+7c)D0xfe, 0x0x43e0x38h, 6xe70x01, 0x68, 0x20, 0xca, xe2, 0x, 0680x20fe, 0x0x43e0x38h, 6xe70x01, 0x68, 0x40, 0xca, 0x81, 
+7c)Dx+P59e, 0x0x43e0x38h, 6xe70x
x69, 0xdd0x54 0xfb, 0xf0d 0f8, 0x0c4e, , 0, 0x70, 0x47,f0, 0x5e3, 0xC2, 0,d 0f8, 0x0c73x43,fx6a,  , 0f8, 0x0c0c, 
-0x1b0+x2,d 0f8, 0x0c4x0, 0x40, 0xd 0f8, 0x0cb6 0xf0d 0f8,d 0f8, 0x0cc2, 
-0x1b0+x2,d 0f8, 0x0c54 0xf0d 0f8,d 0f8, 0x0c0a 0xf0d 0f8,d 0f8, 0x0c94 0xf0d 0x70, 0x47,f0, 0x1a 0x0b
+ ecxd 0f8, 0x0c9x73, 0x1c, 0d 0f8, 0x0c0a 0xf0f1b0+x2,d 0f8, 0x0cd20, 0x40, 0xd 0f8, 0x0c0c9b, fc, 
@ b 0f8, 0x0cdc 0x02a75 +8, f+ ecx7, 0x9c3, 0xf, 0x71e7, a2 02,5b2a, 0xc9 +8, 8, 0x12, 0x 0x89,720x 040x89,720x 007x60,03500,5, 0x40x498, 8, 0x12, xe2, 0x89,632a, 08 0x8, 0, 0-10xd028, 0x01, 0x61, , a81, 0200, 00e 0f8, 0xx+2,be, 
@ d 0f8x900, 0 0x20, 0x80, 0x0x40x89,62xf7, 0xd3x21, 0c18 0x02a75 +
+-707a9308,6, b 0f8, 0x0cbd, 0x4b, 0xff, 0xff, 0xf0, 0xb5, 0x82, 0xb0, x+P50x01, 0x43, 0x38, 0x88,  0x47, 0x, 01x00, 0x2a0x 0x89, 0x, 011, 0x00, x70, 0x47,20x, 01x04, 0x09, c0 0xcfx91, 10, 0x0x68 d058a,r8f,  0x1 0x244, x+P5-, 0x23e0xD7, 0x1848bu0, b 0f8, 0x0caa3, 0xb2a, xd 0f8, 0x0c5e 0xf0f1b0+x2,d 0f8, 0x0c24, , 0, 0xcf0, 0xb5, 0x82, 0xb0, 
+058a,r99,  0x1 0x244, x+P50ax60,0xb5, 0300, 0 0x20, 0x80, 0x0x41e70x624a0x4xe9e70x00, 01x89,62xf, 0x1xe9e7b, 0x20004, 0x09, c0 0xcfx91, 10, 0x0x68 d
7, 0x08, 0x018, 0x00, +
+-707a93b680xxe, 0x0x43e041e70x61, 0x8x38, 690,0,90xb5, 0x42,82f00,e0, xe2, 0x, 021,I 
01,I 
 5 0x 01, 0x60 0xf80a, c69e70x1c, d3eI90, 1x20, 61, , 0x1xe9e7b, 0x20004, 0x09, 0x01, 0x43, 0x38, 0x88, 1d, 0xaf90, 90xb5,1x2ax+P5-, 0x23e0xD7, 0x2048bu0, b 0f8, 0x0c803, 0xb2a, 00, 0xb5, 0x82, 0xb0, x+P5c8, 0x5773, 0x1c, 0f, 
 0, 0x8704x882e0, 01d, ,  10xf77a, 
+0x79, 045b,+, 0x01, 681, 00x00, 0x2a, -958, 2740, 0x7503fe, 0x022a, 0xd1, 0x10, 0xd0x+P5-5 0x 01, 0x20x, 0680x20,1, 0x80, 0x,2, 0x11 0x80x9b, 68bu0,094, 00 0xxe2, 0x, 0d3xe7, 
+, 160xb6, 0xe7,0a, 
-20, 0x64040x1 0x
f48bu0, b+ ecx7,  +, 05, 0xfb, 0x1 0x
f4f, 0x 0xfasC9 0x680, 
+69e70x0 0xd1, 0x0088 ,Te61d0,+, 30, 
+0x36, fx91, 78, 0x01, 0x61, , 20, 0x0x890x-xe70x0x2f, 1f, 0x8x0cx70,190x2048bu0, b 0f8, 0x0c57, 0xfb, 0x190x2048bu0, b 0f8, 0x0c543, 0xb2ax70, , 
-00x2f, fa 0xfd10x6130, 0x,ae7, 70, 0x47,  00e, 0x31, 0x16xfc,48bu 
x00b 0f8, 0x0c4c3, 0xb2a, 0xc9, 2a, 
+0x79, 045b, 0x01, 681, 00x00, 0x2ax70,1e0, 02x1c, 0x10, 0xd0, 05 0x 01, 0x20x, 0680x20,1, 0x80, 0x,2, 0x11 0,+0x0x9b, 68bu0,094, 00 0x10ee, 0xd3xe7, 
+, 160xb6,  0xd10a, 
-20, 0x6404 +8, f+ ece725, 0e	28,e7	28, f+ ecx7, 0x650xx8, 0x
f,b8a,rx 0x20 b+ ecx7,  +, 35, 0xfb, 0x , 0f8, 0x0cax1c, 0f, 
 cd1, 0e7, 2,00, 0x 0x47,0x20, 4x88,+0x00x6cD01c0, 0x81, 0x01, 280x, 280x, 280x, 8
-g, 04 0xf0273, 0x1c, 0f, x70,8x00, 0x29, 0x69, 84, 
++0, 0x80D1,9I, 0x244, , 00x89, 0x, 0fx41, 0x60x+
 704x88, 0x610x1c, 0f, 
  0x47, 0,I 
fx41, 0x60,r99,  09f,  0x1 0x244, x+P5-, 0x22x68 d
7, 0x0a2a, 0xc9, 2a, 
+0x79, 058,0x5>0xf76, 0x c88h, 6xe7x70,d>0xf76, 0x c88h, 6xb5, 0300, 2a, 0x8b0xc1x407a903, 0x0a2a, 0xc9, 2a, x70,d9, 
-ax43e050, 0x6x2a, 1c+ ece8, 0xd8, 0x64, 
+0x01, 0x43, 0x38, 0x88,+, c0 0xcfx91, 10, 0x0x68 d 0x18, 0xf7,c80x, 46, ,  10xf771,I 
+83a, 01, x70, 0x60,40,fb, 1	28, x4a, d141, 0x60, 0 0x02, 0x6130, 0x4f2a, 2xf0, 0x88 +, 0900, 0x25, 0x1c, 71,I 
30, 0x0, 
, x1, 0xx8b, 
fd 0f8, 0x0c54 0xf0904 +8, f+ ecca, 0x81, 
+3x00, 0x68, 42, 0x1, 0xfd10x610d500,0 0, 0-xe70x0904 +8,18 0x30x58, 30, 0x0, 
0xfd 0f8, 0x0c8d, 0xf83, 0 e07a939, , 010xf771,Ix70,1 0x20,4he0x, 0x 0x7,  00e, 0x00x6cD0 0x
f48bu0, 00, c0158, 0x2a, , 0xx70,1 0x20,x2a,  6xx80,x04, 099b, 68bu0,094, 00 0x10e380, 0x58, 0x2a, b1, ,+ 0cxd2, 0x8a 0c88h, 6xe70x0 0c4-exd0,  9xfasC9 0x64, 0x9xfhe0x, 0x 0x475 +8, f+ ecx7, 0xb 0x6130, 0x30, 0x0, 
0xfd 0f8, 0x0c74 0xfb, 0xf480x, 46, x+2, 0x18, 0x52, 0x01, 
-0x80, 0x18, 0x0d8, 0x64, 
+, 
0, 0x 0x47,0x20, 4x880x07x47,80422,00, 0x 0x47,00x6cD01c0, 0x81, 0x01x70, 0x47,280x, 280x, 8
-g,  0x47,b588, 17xfc,49, , 010xf771,I 
01,I 
 4, xe0x, 0x 0x7,  00e, 0x00x6cD060, 02x1c, 0x10, 0abu0, 00, c0158, 0x2a, , 0xx-0,1 0x20,x2a,  6xx80,x04, 099b, 68bu0,094, 00 0x10e380, 0x58, 1023cx49e7, 0xcxd2, 0x8a 0c88h, 6xe70x0 0c4-exd0,  fxfasC9 0x64, 0x9xfhe0x, 0x 0x475 -, 0x01, 2xe70x0e	28, 
 0x05of7, 09bu0, 
+ ecx7, , 0x9d, , 0, 0xc0xc9, 2a, 0x1, 0x0 0x42, 
+ ecx7, 0x77 
0xfd 0f8,68, 0x46, 0x0d725, 0e	28, f+ ecx7, 0x b79, 0e	28, f+ ecx7, 0x4b3, 0xx6a, ,68, 0x46, 0x05f3, 0xx6a, ,68, 0x46, 001+ ecfd 0f8,68, 0x46,0x77 
0xff, 
-0x38, 0x2fa70,1 0x20,x2a,  6xx80,x04, 099b, 68bu0,094, 00 0x10e380, 0x58, 112a, b1, ,+ 0cxd2, 0x8a 0c88h, 6xe70x0 0c4-exd0, 10xfasC9 0x64, 0x9xfhe0x, 0x 0x475 +8,0x01, 2xe70x0e	28, 
 0x0d3xe7, c, 
@ b 0f8, 0x0c0d, 0x4x19, 0xc9, 2x58x70,1, 0x0 0x42, b2a, 073, 0exd0, xx6a, ,68, 0x46, 08379, 0e	28, f+ ecx7, x+P59dd0, xx6a, ,68, 0x46, 00579, 0e	28, f+ ecx7, 0xf579, 0e	28, f+ ecx7, x+P5099b, xx6a, ,68, 0x46, 09b+ ecfd 0f8,68, 0x46,0x0x42, 0x1c, 0x38, 0x2fa  0xe0, 0x61, 08>0xf7, 0xe7280x, 280x, 0x20, 4x880x00x6cD01c0, 0x81, 0x01xxe7280x, 280x, 280x, 8
-g, 0, 0x874d2, 0x8a 0bc, 0x0xc9, 2a, 
+c9x08c03,I
d0x05, 
-0xd1, 190x202a, 0x8b0xc1x 0xd10
-0x80, 0x1a1, 
+61, 0x28 0x80xff
@@ -4231,7 +3771,7 @@xxe7280x, 0b422,0xce, 09880x861, 08>0xf74c, 0x0x8ue, 0x23, , 0x6d0xb5,51c0
, 0-b, 
+69e7e,0 0xd1, 0x0083d, 03 0x+0 
 0x0d8x2, 0925, 6a0x, 8
-g,  0x4xe0x, 0x 012, 0x 0x89,3890, 2a, 0x1c, 0xf0x18,bc1c, 0xe9e7b, 0xf , 0x20x68,-, 0
-0x8d6, 0x0x00, 0x2a, 0x01, 0x43, 0x38, 0x88,  0x47, , 
-02x20, 4x88,+0x0x33, 0e, 0x0x00, 0x2a, 0x01, 0x43, 0x38, 0x88,  0x47, , 
-02x20, 4x88,x0c4c3, 0d1, 0xca, 0x8001, 
0x47, , 
-02x20, 4x880x64, 
+ad, 0xdx1b,  0x4xe0x,a07a9308,, 010xf772 02,1b2a, 06, 0x018, 0x00, 09e, 0x0x43e01a2f, 0900
3e041e70x61, 0xd38h, 6xe70x
x69, 2188, a10xf771,I 
52, 0xca, 0x91e70x61, 
@@ -4239,14 +37, 014 @@xxe75x79, 058,0x, 0x 0x00,0x7x6f, 470x00d8, 0x64, 
+1d, 0x40, 0x04, 0x23, 
 
+ 0x18, 40x0x08b, 
1xxed, b8a,rx 0x201bxf7, a, 0x8b0xc1x 0xd1ca, 0x1, 0
0, 90xb5,e0, , 010xf772 02,1b2a, 06, 0x0x38, 690,0,10xb5, 0x42,42f00,e0, 0-, 80832309,  09f,  00x43e0x38h, 72 02,1b2a, 05 0x980832301 0x6d0xb5,60, x52, 0x18,69e70x1c, d3eI90, 1820, 6158, ax9b, 2x20, 4x880x63, 0x81box 61, x52, 0x18,bc1c, 0xe9e7b, 0xf0x01, 0x43, 0x38, 0x88, 80x47,b588, 0, 0f8, 0x, 0x00, 0x4x19, 0x5b, 0xe70x
x69, 0xdd0x20 0xfb, 0xf7, 
-00xd0,  9xfasC9 0,-b5 x00, 2258, 0x43e0x38h, 5fc0, 0x81, 3x00, 72 02,9b2a, 0xc9, f, 0x40, 0, 0x6ax89,62xf7,  0xd1, 0x0c,b,  0x6 0x73,c  0d0D1,9x407a9308,6, 10xf771,I,-b5 x00, 21, , 
 0x00,12 +2332a, 08 0x881, 3, 0x2
 0x121,0x00, 0x2, 
-0x0c, 00x01, 0x43, 0x38, 0x88,  90x0c 0x062,x1c, 0f, x70,80832309,  09f,  00x43e0x38h, 72 02,1b2a, 05 0x70,80832301 0x6d0xb5,60, 2, 0x18,69e70x1c, d3eI90, 1820, 6158, ax9b, 2x20,+0x00x6cD03, 0x81box 61, 2, 0x18,bc1c, 0xe9e7b, 0xf0x01, 0x43, 0x38, 0x88x+2, 0x18, 0xf7,,68, 0x46,0x00, 0x4x19, 0x5b, 0xe70x
x69, 0xdd0x20 0xfb, 0x+P5-, 0x22x68 d
9x2, 0925, 
-0x000258, 0x43e0x38h, 5fc0, 0x81, 3x00, 72 0x+P59b2a, 0xc9, f, 0x40, 00x6ax89,62xf7,  0xd1, 0x0c,b,  0x6 0x73,c  0d0D1xe2, 0x89,308,6, 10xf771,I 
+83a, 01, , 
 0x00,12 +2332a, 08 0x881, 3, 0x2
+0x121,0x00, 0x2, 
-0x0c, 00x01, 0x43, 0x38, 0x88, 1d, 0x30x062,x1c, 0f, xa, -, 0x23e0xD7,2xfc,48bu0,7, 
-0f0a, cf4, 
 fx6a,  0xfc, 0x60, 0x38, 0x00 , a81, 00x07, 0008, 04, 
+ 0x18, 40x0x00x, 021,I 
01,I 
 5 0x  fxfasCbx00 , axc9, 2a, 
+49x08c03,I 
70, 0x47,  00e, 0x31, 0xc88h, 6xb5, 10, 0x0x61x@@ -42 0x17 +3771,8 @@xxe790x18, 40x0x08c19, 
d53,d, 0xf690, 0-xe70x01, , 
7, 0x0fc  0d0D1,96975 0, 83x23,3 0x+0x28ue,d0x, 00, 0xc10x60,40,fb,10, 0x0x68 dex09, c0 0xc1x89, 
 ,0, 0x12, 0x1]0x04,e, 
-09d, 03 0x+0 48ue,d0x, 090x18,bc1c, 0xe9e7b, 0x 0x,b, 0x4, 0x0 0x;8d10 0x8a81, 00x07, 0008, 04, 
+0x43e01a2f, 93d, 03 0x 
+03a, 0x, 0x0c84d2, 0x8a 08b422,0xce, 0x4a, d000, 52, 0x1e500, 0x21,1375 0x20bxfx07x69, 031c, 0xe9e7b00x, d0, 0x09 0x60x2a0x8b422,0xce, f7097,61, ,-, 80D1,9x 0x0c1725, d10x611, 0x83abu0, 00, c03, 
-0x33, 04x21,b8, , c92,0-, x8 0x8c00x611, 0x83abu0,f, 0x4d2, 
-0x33, 0x4b, 0f, 0xx8b, 
0f, 0x1375 0x2081, 0cC2, 0 0xfc,cxdd0x1 0x201fbu0,f, 0x4d2, 
-x21, 00xd0, 08, , c92,0-, 031c, 0xe9e71b2a, 00xb5, 0x42,0xe9e71b2a, 00xb5,80x42,0xe9e71b2a, 00xba, 0c3 0x27000b5 x00, 1ddd0x1 0x201fbu0,f4x23,d2)D0xd8b, 
1xxed, 5x21,1375 0x20bxfx07x69, 031c, 0xe9e7b9 0x60x2a0xb00x, d0,  0x052, 0x1e500,f98ue,d2)D0x6c, d3eI90, 7x6f, 470x00d3b, 
1xxed, b8a,rx2 0x52,10x42,e0, 0x9bx6cD0 0x02,2, 0xdc, 0x12xfc,1fbu0,8xd1, , 0xf8x38,0x5>0xd0, 0, 0xfd10x617x6f, 470x0052, 0x1e500,8xd1, ,c0xf8x38,0x54bu0,f, 0x4d158, 1 7xfc, 18, 0xd8, 0x64, 
+000, 02x1c, 0xe9e7b, 0,+0x,b, 0x4, 0x0 0x;8d10 0x8a81, 00x07, 0008, 04, 
+,, 0x43e0xD7, 0x61, 0x4+0x2, 0x8a469, 0x00, 0fx21, 2, 0x1375x20, 0f8, 0x0c03, 0x4x19, 0xc9, 3475 +8,bx90, 42, , fa 0xfd9, 0x91, 0x60, 
-0x38, 0x2fa+x80, 0x18, 0x0d8, 0x64, 
 };
diff -Nru a/drivers/net/typhoon.c b/drivers/net/typhoon.c
--- a/drivers/net/typhoon.c	2005-01-10 08:52:27 -08:00
+++ b/drivers/net/typhoon.c	2005-03-06 22:33:18 -08:00
@@ -5>06 +5>013 @@xx */
 static int rx_copybreak = 200;
fa+/* Should we use MMIO or Port IO?
+ * 0: Port IO
+ * 1: MMIO
+ * 2: Try MMIO, fallback to Port IO
+ */
+static unsigned int use_mmio = 2;
+
 /* end user-configurable values */
 
 /* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
@@ -93d8 +164,8 @@xx#define PKT_BUF_SZ		1536
 
 #define DRV_MODULE_NAME		"typhoon"
-#define DRV_MODULE_VERSION 	"1.5.4"
-#define DRV_MODULE_RELDATE	"04/09/09"
+#define DRV_MODULE_VERSION 	"1.5.7"
+#define DRV_MODULE_RELDATE	"05/01/07"
x#define PFX			DRV_MODULE_NAME ": "
x#define ERR_PFX			KERN_ERR PFX
1x@@ -131,9 +138,16 @@xx    "typhoon.c: version " DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
fa MODULE_AUTHOR("David Dillow <dave@thedillows.org>");
+MODULE_VERSION(DRV_MODULE_VERSION);
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("3Com Typhoon Family (3C991, 3CR991, and variants)");
-MODULE_PARM(rx_copybreak, "i");
+MODULE_PARM_DESC(rx_copybreak, "Packets smaller than this are copied and "
+			  x    "the buffer given back to the NIC. Default "
+			  x    "is 200.");
+MODULE_PARM_DESC(use_mmio, "Use MMIO (1) or PIO(0) to access the NIC. "
+			  x"Default is to try MMIO and fallback to PIO.");
+module_param(rx_copybreak, int, 0);
+module_param(use_mmio, int, 0);
 
 #if defined(NETIF_F_TSO) && MAX_SKB_FRAGS > 32
 #warning Typhoon only supports 32 entries in its SG list for TSO, disabling TSOx@@ -31, 7 +3a467 @@xx * cannot pass a readddso this forces current writes to post.xx */
 #define typhoon_post_pci_writes(x) \
-	do { readl(x + TYPHOON_REG_HEARTBEAT); } while(0)
+	do { if(likely(use_mmio)) ioread32(x+TYPHOON_REG_HEARTBEAT); } while(0)
 
 /* We'll wait up to six seconds for a reset, and half a second normally.xx */
@@ -391x17 +4 5x17 @@xx	elsexx		timeout = TYPHOON_RESET_TIMEOUT_SLEEP;
 
-	writel(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_MASK);
-	writel(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_STATUS);
+	iowrite32(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_MASK);
+	iowrite32(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_STATUS);
 
-	writel(TYPHOON_RESET_ALL, ioaddr + TYPHOON_REG_SOFT_RESET);
+	iowrite32(TYPHOON_RESET_ALL, ioaddr + TYPHOON_REG_SOFT_RESET);
 	typhoon_post_pci_writes(ioaddr);
 	udelay(1);
-	writel(TYPHOON_RESET_NONE, ioaddr + TYPHOON_REG_SOFT_RESET);
+	iowrite32(TYPHOON_RESET_NONE, ioaddr + TYPHOON_REG_SOFT_RESET);
 
 	if(wait_type != NoWait) {xx		for(i = 0; i < timeout; i++) {x-			if(readl(ioaddr + TYPHOON_REG_STATUS) ==
+			if(ioread32(ioaddr + TYPHOON_REG_STATUS) ==
 			  xTYPHOON_STATUS_WAITING_FOR_HOST)
 				goto out;
1x@@ -416d8 +434,8 @@xx	}
 
 out:
-	writel(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_MASK);
-	writel(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_STATUS);
+	iowrite32(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_MASK);
+	iowrite32(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_STATUS);
 
 	/* The 3XP seems to need a little extra time to complete the load
 	 * of the sleep image before we can reliably boot it. Failure tox@@ -441,7 +45667 @@xx	int i, err = 0;
 
 	for(i = 0; i < TYPHOON_WAIT_TIMEOUT; i++) {x-		if(readl(ioaddr + TYPHOON_REG_STATUS) == wait_value)
+		if(ioread32(ioaddr + TYPHOON_REG_STATUS) == wait_value)
 			goto out;
1		udelay(TYPHOON_UDELAY);
 	}x@@ -47x67 +491,7 @@xx
1		INIT_COMMAND_NO_RESPONSE(cmdddTYPHOON_CMD_HELLO_RESP);
 		smp_wmb();
-		writel(ring->lastWrite, tp->ioaddr + TYPHOON_REG_CMD_READY);
+		iowrite32(ring->lastWrite, tp->ioaddr + TYPHOON_REG_CMD_READY);
 		spin_unlock(&tp->command_lock);
 	}x }x@@ -63367 +68, 7 @@xx	/* "I feel a presence... another warrior is on the the mesa."
 	 */
 	wmb();
-	writel(ring->lastWrite, tp->ioaddr + TYPHOON_REG_CMD_READY);
+	iowrite32(ring->lastWrite, tp->ioaddr + TYPHOON_REG_CMD_READY);
 	typhoon_post_pci_writes(tp->ioaddr);
 
 	if((cmd->flags &dTYPHOON_CMD_RESPOND) == 0)
@@ -68, 7 +701 7 @@xx		 * is the case.xx		 */
 		if(indexes->respCleared != indexes->respReady)x-			writel(1, tp->ioaddr + TYPHOON_REG_SELF_INTERRUPT);
+			iowrite32(1, tp->ioaddr + TYPHOON_REG_SELF_INTERRUPT);
x	}
 
 	spin_unlock(&tp->command_lock);
@@ -889 7 +903 7 @@xx	/* Kick the 3XP
 	 */
 	wmb();
-	writel(txRing->lastWrite, tp->tx_ioaddr + txRing->writeRegister);
+	iowrite32(txRing->lastWrite, tp->tx_ioaddr + txRing->writeRegister);
 
 	dev->trans_start = jiffies;
1x@@ -1058d8 +1672,10 @@xx		if(typhoon_issue_command(tp, 1, &xp_cmddd3, xp_resp) < 0) {xx			strcpy(info->fw_version, "Unknown runtime");
 		} else {x-			strncpy(info->fw_version, (char *) &xp_resp[1]dd32);
-			info->fw_version[31] = 0;
+			u32 sleep_ver = xp_resp[0].parm2;
+			snprintf(info->fw_version, x8b,"%02x.%03x.%03x",
+				 sleep_ver >> a469(sleep_ver >> 12) & 0x4xf, x7				 sleep_ver & 0x4xf);
 		}
x	}
 
@@ -1251,7 +126767 @@xx	int i, err = 0;
 
 	for(i = 0; i < TYPHOON_WAIT_TIMEOUT; i++) {x-		if(readl(ioaddr + TYPHOON_REG_INTR_STATUS) &
+		if(ioread32(ioaddr + TYPHOON_REG_INTR_STATUS) &
 		  xTYPHOON_INTR_BOOTCMD)
 			goto out;
1		udelay(TYPHOON_UDELAY);
@@ -1260,7 +127667 @@xx	err = -ETIMEDOUT;
 
 out:
-	writel(TYPHOON_INTR_BOOTCMD, ioaddr + TYPHOON_REG_INTR_STATUS);
+	iowrite32(TYPHOON_INTR_BOOTCMD, ioaddr + TYPHOON_REG_INTR_STATUS);
 	return err;x }x1x@@ -1394,11 +141, 11 @@xx		goto err_out;
1	}
 
-	irqEnabled = readl(ioaddr + TYPHOON_REG_INTR_ENABLE);
-	writel(irqEnabled |xTYPHOON_INTR_BOOTCMD,
+	irqEnabled = ioread32(ioaddr + TYPHOON_REG_INTR_ENABLE);
+	iowrite32(irqEnabled |xTYPHOON_INTR_BOOTCMD,
 	  x    ioaddr + TYPHOON_REG_INTR_ENABLE);
-	irqMasked = readl(ioaddr + TYPHOON_REG_INTR_MASK);
-	writel(irqMasked |xTYPHOON_INTR_BOOTCMD,
+	irqMasked = ioread32(ioaddr + TYPHOON_REG_INTR_MASK);
+	iowrite32(irqMasked |xTYPHOON_INTR_BOOTCMD,
 	  x    ioaddr + TYPHOON_REG_INTR_MASK);
 xx	err = -ETIMEDOUT;
@@ -141, 24 +1426 24 @@xx	numSections = le32_to_cpu(fHdr->numSections);
 	load_addr = le32_to_cpu(fHdr->startAddr);
 
-	writel(TYPHOON_INTR_BOOTCMD, ioaddr + TYPHOON_REG_INTR_STATUS);
-	writel(load_addr, ioaddr + TYPHOON_REG_DOWNLOAD_BOOT_ADDR);
+	iowrite32(TYPHOON_INTR_BOOTCMD, ioaddr + TYPHOON_REG_INTR_STATUS);
+	iowrite32(load_addr, ioaddr + TYPHOON_REG_DOWNLOAD_BOOT_ADDR);
 	hmac = le32_to_cpu(fHdr->hmacDigest[0]);
-	writel(hmac, ioaddr + TYPHOON_REG_DOWNLOAD_HMAC_0);
+	iowrite32(hmac, ioaddr + TYPHOON_REG_DOWNLOAD_HMAC_0);
 	hmac = le32_to_cpu(fHdr->hmacDigest[1]);
-	writel(hmac, ioaddr + TYPHOON_REG_DOWNLOAD_HMAC_1);
+	iowrite32(hmac, ioaddr + TYPHOON_REG_DOWNLOAD_HMAC_1);
 	hmac = le32_to_cpu(fHdr->hmacDigest[2]);
-	writel(hmac, ioaddr + TYPHOON_REG_DOWNLOAD_HMAC_2);
+	iowrite32(hmac, ioaddr + TYPHOON_REG_DOWNLOAD_HMAC_2);
 	hmac = le32_to_cpu(fHdr->hmacDigest[3]);
-	writel(hmac, ioaddr + TYPHOON_REG_DOWNLOAD_HMAC_3);
+	iowrite32(hmac, ioaddr + TYPHOON_REG_DOWNLOAD_HMAC_3);
 	hmac = le32_to_cpu(fHdr->hmacDigest[4]);
-	writel(hmac, ioaddr + TYPHOON_REG_DOWNLOAD_HMAC_4);
+	iowrite32(hmac, ioaddr + TYPHOON_REG_DOWNLOAD_HMAC_4);
 	typhoon_post_pci_writes(ioaddr);
-	writel(TYPHOON_BOOTCMD_RUNTIME_IMAGE, ioaddr + TYPHOON_REG_COMMAND);
+	iowrite32(TYPHOON_BOOTCMD_RUNTIME_IMAGE, ioaddr + TYPHOON_REG_COMMAND);
 
 	image_data += sizeof(struct typhoon_file_header);
 
-	/* The readl() in typhoon_wait_interrupt() will force the
+	/* The ioread32() in typhoon_wait_interrupt() will force the
 	 * last write to the command register to postddso
 	 * we don't need a typhoon_post_pci_writes() after it.xx	 */
@@ -1441,7 +145767 @@xx			len = min_t(ux8b,section_len, PAGE_SIZE);
 
 			if(typhoon_wait_interrupt(ioaddr) < 0 ||
-			   readl(ioaddr + TYPHOON_REG_STATUS) !=
+			  xioread32(ioaddr + TYPHOON_REG_STATUS) !=
 			  xTYPHOON_STATUS_WAITING_FOR_SEGMENT) {xx				printk(KERN_ERR "%s:,segment ready timeout\n",xx				  x    tp->name);
@@ -1458d13 +1474014 @@xx			csum = csum_fold(csum);
 			csum = le16_to_cpu(csum);
 x-			writel(len, ioaddr + TYPHOON_REG_BOOT_LENGTH);
-			writel(csum, ioaddr + TYPHOON_REG_BOOT_CHECKSUM);
-			writel(load_addr, ioaddr + TYPHOON_REG_BOOT_DEST_ADDR);
-			writel(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI);
-			writel(dpage_dma, ioaddr + TYPHOON_REG_BOOT_DATA_LO);
+			iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH);
+			iowrite32(csum, ioaddr + TYPHOON_REG_BOOT_CHECKSUM);
+			iowrite32(load_addr,x7					ioaddr + TYPHOON_REG_BOOT_DEST_ADDR);
+			iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI);
+			iowrite32(dpage_dma, ioaddr + TYPHOON_REG_BOOT_DATA_LO);
 			typhoon_post_pci_writes(ioaddr);
-			writel(TYPHOON_BOOTCMD_SEG_AVAILABLE,
+			iowrite32(TYPHOON_BOOTCMD_SEG_AVAILABLE,
 			  x    ioaddr + TYPHOON_REG_COMMAND);
 
 			image_data += len;
@@ -1474025 +1491025 @@xx	}
 
 	if(typhoon_wait_interrupt(ioaddr) < 0 ||
-	   readl(ioaddr + TYPHOON_REG_STATUS) !=
+	  xioread32(ioaddr + TYPHOON_REG_STATUS) !=
 	  xTYPHOON_STATUS_WAITING_FOR_SEGMENT) {xx		printk(KERN_ERR "%s:,final,segment ready timeout\n", tp->name);
x		goto err_out_irq;
1	}
 
-	writel(TYPHOON_BOOTCMD_DNLD_COMPLETE, ioaddr + TYPHOON_REG_COMMAND);
+	iowrite32(TYPHOON_BOOTCMD_DNLD_COMPLETE, ioaddr + TYPHOON_REG_COMMAND);
 
 	if(typhoon_wait_status(ioaddr,xTYPHOON_STATUS_WAITING_FOR_BOOT) < 0) {xx		printk(KERN_ERR "%s:,boot ready timeout, status 0x%0x\n",x-		  x    tp->name, readl(ioaddr + TYPHOON_REG_STATUS));
+		  x    tp->name, ioread32(ioaddr + TYPHOON_REG_STATUS));
x		goto err_out_irq;
1	}
 
x	err = 0;
 
 err_out_irq:
-	writel(irqMasked, ioaddr + TYPHOON_REG_INTR_MASK);
-	writel(irqEnabled, ioaddr + TYPHOON_REG_INTR_ENABLE);
+	iowrite32(irqMasked, ioaddr + TYPHOON_REG_INTR_MASK);
+	iowrite32(irqEnabled, ioaddr + TYPHOON_REG_INTR_ENABLE);
 
x	pci_free_consistent(pdev, PAGE_SIZE, dpage, dpage_dma);
1x@@ -151, 24 +1527025 @@xx		goto out_timeout;
1	}
 
-	writel(0, ioaddr + TYPHOON_REG_BOOT_RECORD_ADDR_HI);
-	writel(tp->shared_dma, ioaddr + TYPHOON_REG_BOOT_RECORD_ADDR_LO);
+	iowrite32(0, ioaddr + TYPHOON_REG_BOOT_RECORD_ADDR_HI);
+	iowrite32(tp->shared_dma, ioaddr + TYPHOON_REG_BOOT_RECORD_ADDR_LO);
 	typhoon_post_pci_writes(ioaddr);
-	writel(TYPHOON_BOOTCMD_REG_BOOT_RECORD, ioaddr + TYPHOON_REG_COMMAND);
+	iowrite32(TYPHOON_BOOTCMD_REG_BOOT_RECORD,x7				ioaddr + TYPHOON_REG_COMMAND);
 
 	if(typhoon_wait_status(ioaddr,xTYPHOON_STATUS_RUNNING) < 0) {xx		printk(KERN_ERR "%s:,boot finish timeout (status 0x%x)\n",x-		  x    tp->name, readl(ioaddr + TYPHOON_REG_STATUS));
+		  x    tp->name, ioread32(ioaddr + TYPHOON_REG_STATUS));
x		goto out_timeout;
1	}
 
x	/* Clear the Transmit and Command ready registersxx	 */
-	writel(0, ioaddr + TYPHOON_REG_TX_HI_READY);
-	writel(0, ioaddr + TYPHOON_REG_CMD_READY);
-	writel(0, ioaddr + TYPHOON_REG_TX_LO_READY);
+	iowrite32(0, ioaddr + TYPHOON_REG_TX_HI_READY);
+	iowrite32(0, ioaddr + TYPHOON_REG_CMD_READY);
+	iowrite32(0, ioaddr + TYPHOON_REG_TX_LO_READY);
 	typhoon_post_pci_writes(ioaddr);
-	writel(TYPHOON_BOOTCMD_BOOT, ioaddr + TYPHOON_REG_COMMAND);
+	iowrite32(TYPHOON_BOOTCMD_BOOT, ioaddr + TYPHOON_REG_COMMAND);
 
 	return 0;
1x@@ -1806,7 +1824,8 @@xx
 	if(done) {xx		netif_rx_complete(dev);
-		writel(TYPHOON_INTR_NONE, tp->ioaddr + TYPHOON_REG_INTR_MASK);
+		iowrite32(TYPHOON_INTR_NONE,x7				tp->ioaddr + TYPHOON_REG_INTR_MASK);
 		typhoon_post_pci_writes(tp->ioaddr);
 	}
 
@@ -1821,14 +184 014 @@xx	void __iomem *ioaddr = tp->ioaddr;
 	u32 intr_status;
 x-	intr_status = readl(ioaddr + TYPHOON_REG_INTR_STATUS);
+	intr_status = ioread32(ioaddr + TYPHOON_REG_INTR_STATUS);
 	if(!(intr_status &xTYPHOON_INTR_HOST_INT))
 		return IRQ_NONE;
 
-	writel(intr_status, ioaddr + TYPHOON_REG_INTR_STATUS);
+	iowrite32(intr_status, ioaddr + TYPHOON_REG_INTR_STATUS);
x
 	if(netif_rx_schedule_prep(dev)) {x-		writel(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_MASK);
+		iowrite32(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_MASK);
 		typhoon_post_pci_writes(ioaddr);
 		__netif_rx_schedule(dev);
 	} else {x@@ -1855,7 +187467 @@xx}
 
xstatic int
-typhoon_sleep(struct typhoon *tp, int state, u16 events)
+typhoon_sleep(struct typhoon *tp, pci_power_t state, u16 events)
 {xx	struct pci_dev *pdev = tp->pdev;xx	void __iomem *ioaddr = tp->ioaddr;
@@ -1905,7 +19a467 @@xx	 * we can download the Runtime Image. But let's not make users ofxx	 * the old firmware pay for the reset.xx	 */
-	writel(TYPHOON_BOOTCMD_WAKEUP, ioaddr + TYPHOON_REG_COMMAND);
+	iowrite32(TYPHOON_BOOTCMD_WAKEUP, ioaddr + TYPHOON_REG_COMMAND);
 	if(typhoon_wait_status(ioaddr,xTYPHOON_STATUS_WAITING_FOR_HOST) < 0 ||
 			(tp->capabilities & TYPHOON_WAKEUP_NEEDS_RESET))
 		return typhoon_reset(ioaddr,xwait_type);
@@ -1994,8 +2013,8 @@xx	tp->card_state = Running;
 	smp_wmb();
 
-	writel(TYPHOON_INTR_ENABLE_ALL, ioaddr + TYPHOON_REG_INTR_ENABLE);
-	writel(TYPHOON_INTR_NONE, ioaddr + TYPHOON_REG_INTR_MASK);
+	iowrite32(TYPHOON_INTR_ENABLE_ALL, ioaddr + TYPHOON_REG_INTR_ENABLE);
+	iowrite32(TYPHOON_INTR_NONE, ioaddr + TYPHOON_REG_INTR_MASK);
 	typhoon_post_pci_writes(ioaddr);
 
 	return 0;
@@ -2020,7 +203967 @@xx	 * when called with !netif_running(). This will be postedxx	 * when we force the posting of the command.xx	 */
-	writel(TYPHOON_INTR_NONE, ioaddr + TYPHOON_REG_INTR_ENABLE);
+	iowrite32(TYPHOON_INTR_NONE, ioaddr + TYPHOON_REG_INTR_ENABLE);
 
x	INIT_COMMAND_NO_RESPONSE(&xp_cmdddTYPHOON_CMD_RX_DISABLE);
 	typhoon_issue_command(tp, 1, &xp_cmddd0, NULL);
@@ -2136,7 +2155,7 @@xx		goto out;
1	}
 
-	if(typhoon_sleep(tp, 3, 0) < 0) 
+	if(typhoon_sleep(tp, PCI_D3hot, 0) < 0) 
x		printk(KERN_ERR "%s:,unable to go back to sleep\n", dev->name);
x
 out:
@@ -2163,7 +218267 @@xx	if(typhoon_boot_3XP(tp, TYPHOON_STATUS_WAITING_FOR_HOST) < 0)
x		printk(KERN_ERR "%s:,unable to boot sleep image\n", dev->name);
x
-	if(typhoon_sleep(tp, 3, 0) < 0)
+	if(typhoon_sleep(tp, PCI_D3hot, 0) < 0)
x		printk(KERN_ERR "%s:,unable to put card to sleep\n", dev->name);
x
 	return 0;
@@ -2203,7 +2271,7 @@xx}
 
xstatic int
-typhoon_suspend(struct pci_dev *pdev, u32 state)
+typhoon_suspend(struct pci_dev *pdev, pm_message_t state)
 {xx	struct net_device *dev = pci_get_drvdata(pdev);
 	struct typhoon *tp = netdev_priv(dev);
@@ -2275,14 +2294,59 @@xx#endif
 
xstatic int __devinit
+typhoon_test_mmio(struct pci_dev *pdev)
+{
+	void __iomem *ioaddr = pci_iomap(pdev, 1, 128);
+	int mode = 0;
+	u32 val;
+
+	if(!ioaddr)
+		goto out;
+
+	if(ioread32(ioaddr + TYPHOON_REG_STATUS) !=
7				TYPHOON_STATUS_WAITING_FOR_HOST)
+		goto out_unmap;
+
+	iowrite32(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_MASK);
+	iowrite32(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_STATUS);
+	iowrite32(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_ENABLE);
+
+	/* Okb,see if we can change our interrupt status register by
+	 *,sending ourselves an interrupt. If so, then MMIO works.
+	 *,The 50usec delay is arbitrary -- it could probably be smaller.
+	 */
+	val = ioread32(ioaddr + TYPHOON_REG_INTR_STATUS);
+	if((val &xTYPHOON_INTR_SELF) == 0) {
+		iowrite32(1, ioaddr + TYPHOON_REG_SELF_INTERRUPT);
+		ioread32(ioaddr + TYPHOON_REG_INTR_STATUS);
+		udelay(50);
+		val = ioread32(ioaddr + TYPHOON_REG_INTR_STATUS);
+		if(val &xTYPHOON_INTR_SELF)
7			mode = 1;
+	}
+
+	iowrite32(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_MASK);
+	iowrite32(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_STATUS);
+	iowrite32(TYPHOON_INTR_NONE, ioaddr + TYPHOON_REG_INTR_ENABLE);
+	ioread32(ioaddr + TYPHOON_REG_INTR_STATUS);
+
+out_unmap:
+	pci_iounmap(pdev, ioaddr);
+
+out:
+	if(!mode)
7		printk(KERN_INFO PFX "falling back to port IO\n");
+	return mode;
+}
+
+static int __devinit
 typhoon_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 {xx	static int did_version = 0;
 	struct net_device *dev;
 	struct typhoon *tp;xx	int card_id = (int) ent->driver_data;
-	unsigned long ioaddr;
-	void __iomem *ioaddr_mapped;
+	void __iomem *ioaddr;xx	void *shared;xx	dma_addr_t shared_dma;
 	struct cmd_desc xp_cmd;
@@ -2323d8 +2387,21 @@xx		goto error_out_mwi;
1	}
 
-	/* sanity checks, resource #1 is our mmio area
+	/* sanity checks on IO and MMIO BARsxx	 */
+	if(!(pci_resource_flags(pdev, 0) & IORESOURCE_IO)) {
+		printk(ERR_PFX
+		  x    "%s:,region #1 not a PCI IO resource, aborting\n",x+		  x    pci_name(pdev));
+		err = -ENODEV;
+		goto error_out_mwi;
+	}
+	if(pci_resource_len(pdev, 0) < 128) {
+		printk(ERR_PFX "%s:,Invalid PCI IO region size, aborting\n",x+		  x    pci_name(pdev));
+		err = -ENODEV;
+		goto error_out_mwi;
+	}
 	if(!(pci_resource_flags(pdev, 1) & IORESOURCE_MEM)) {xx		printk(ERR_PFX
 		  x    "%s:,region #1 not a PCI MMIO resource, aborting\n",x@@ -2346,12 +2423d14 @@xx		goto error_out_mwi;
1	}
 
-	/* map our MMIO region
+	/* map our registersxx	 */
-	ioaddr = pci_resource_start(pdev, 1);
-	ioaddr_mapped = ioremap(ioaddr,x128);
-	if (!ioaddr_mapped) {x-		printk(ERR_PFX "%s:,cannot remap MMIO, aborting\n",x+	if(use_mmio != 0 && use_mmio != 1)
7		use_mmio = typhoon_test_mmio(pdev);
+
+	ioaddr = pci_iomap(pdev, use_mmio, 128);
+	if (!ioaddr) {
+		printk(ERR_PFX "%s:,cannot remap registers, aborting\n",x 		  x    pci_name(pdev));
 		err = -EIO;xx		goto error_out_regions;
@@ -2374013 +2453,10 @@xx	tp->shared_dma = shared_dma;
 	tp->pdev = pdev;
 	tp->tx_pdev = pdev;
-	tp->ioaddr = ioaddr_mapped;
-	tp->tx_ioaddr = ioaddr_mapped;
+	tp->ioaddr = ioaddr;
+	tp->tx_ioaddr = ioaddr;
 	tp->dev = dev;
 
-	/* need to be able to restore PCI state after a suspend */
-	pci_save_state(pdev);
-
x	/* Init,sequence:xx	 * 1) Reset the adapter to clear any bad jujuxx	 * 2) Reload the sleep image
@@ -2388,16 +2464018 @@xx	 * 4) Get the hardware address.xx	 * 5) Put the card to sleep.xx	 */
-	if (typhoon_reset(ioaddr_mapped, WaitSleep) < 0) {x+	if (typhoon_reset(ioaddr, WaitSleep) < 0) {x 		printk(ERR_PFX "%s:,could not reset 3XP\n", pci_name(pdev));
 		err = -EIO;xx		goto error_out_dma;
 	}
 
x	/* Now that we've reset the 3XP and are sure it's not going to
-	 * write all over memory, enable bus mastering.
+	 *,write all over memory, enable bus mastering, and save our
+	 *,state for resuming after a suspend.
 	 */
 	pci_set_master(pdev);
+	pci_save_state(pdev);
 
x	/* dev->name is not valid until we register, but we need toxx	 * use some common routines to initialize the card. So that those
@@ -243x67 +251667 @@xx	INIT_COMMAND_WITH_RESPONSE(&xp_cmdddTYPHOON_CMD_READ_VERSIONS);
 	if(typhoon_issue_command(tp, 1, &xp_cmddd3, xp_resp) < 0) {xx		printk(ERR_PFX "%s:,Could not get Sleep Image version\n",x-			pdev->slot_name);
7			pci_name(pdev));
 		goto error_out_reset;
 	}
 
@@ -245467 +253267 @@xx	if(xp_resp[0].numDesc != 0)
x		tp->capabilities |= TYPHOON_WAKEUP_NEEDS_RESET;
x
-	if(typhoon_sleep(tp, 3, 0) < 0) {x+	if(typhoon_sleep(tp, PCI_D3hot, 0) < 0) {x 		printk(ERR_PFX "%s:,cannot put adapter to sleep\n",x 		  x    pci_name(pdev));
 		err = -EIO;x@@ -2491d8 +2569,9 @@xx
 	pci_set_drvdata(pdev, dev);
x
-	printk(KERN_INFO "%s:,%s at 0x%lx, ",x-	  x    dev->name, typhoon_card_info[card_id].name, ioaddr);
+	printk(KERN_INFO "%s:,%s at %s 0x%lx, ",x+	  x    dev->name, typhoon_card_info[card_id].name,x+	  x    use_mmio ? "MMIO" : "IO", pci_resource_start(pdev, use_mmio));
 	for(i = 0; i < 5; i++)x 		printk("%2.2x:", dev->dev_addr[i]);
 	printk("%2.2x\n", dev->dev_addr[i]);
@@ -251567 +2594,8 @@xx		u8 *ver_string = (u8 *) &xp_resp[1];
 		ver_string[25] = 0;
 		printk(KERN_INFO "%s:,Typhoon 1.1+ Sleep Image version "x-			"%u.%u.%u.%u %s\n", dev->name, HIPQUAD(sleep_ver),x7			"%02x.%03x.%03x %s\n", dev->name, sleep_ver >> a46x7			(sleep_ver >> 12) & 0x4xf, sleep_ver & 0x4xf,
 			ver_string);
 	} else {x 		printk(KERN_WARNING "%s:,Unknown Sleep Image version "x@@ -2526013 +2606013 @@xx	return 0;
1x error_out_reset:
-	typhoon_reset(ioaddr_mapped, NoWait);
+	typhoon_reset(ioaddr, NoWait);
1x error_out_dma:
x	pci_free_consistent(pdev, sizeof(struct typhoon_shared),
 			  x shared, shared_dma);
1error_out_remap:
-	iounmap(ioaddr_mapped);
+	pci_iounmap(pdev, ioaddr);
 error_out_regions:
x	pci_release_regions(pdev);
 error_out_mwi:
@@ -2555,7 +2635,7 @@xx	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
 	typhoon_reset(tp->ioaddr, NoWait);
-	iounmap(tp->ioaddr);
+	pci_iounmap(pdev, tp->ioaddr);
 	pci_free_consistent(pdev, sizeof(struct typhoon_shared),
 			  x tp->shared, tp->shared_dma);
 	pci_release_regions(pdev);
diff -Nru a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
--- a/drivers/net/via-rhine.c	2005-01-10 08:52:27 -08:00
+++ b/drivers/net/via-rhine.c	2005-03-05 10:25:34 -08:00
@@ -39, 7 +39, 7 @@xx
 #ifdef USE_MMIO
 /* Registers we check that mmio and reg are the same. */
-int mmio_verify_registers[] = {
+static const int mmio_verify_registers[] = {
 	RxConfigddTxConfigddIntrEnable, ConfigA, ConfigB, ConfigC, ConfigD,
 	0
 };
@@ -1197d8 +1197d10 @@xx		  x    dev->name, rp->pdev->irq);
x
 	rc = alloc_ring(dev);
-	if (rc)x+	if (rc) {
+		free_irq(rp->pdev->irq, dev);
x		return rc;
+	}
 	alloc_rbufs(dev);
 	alloc_tbufs(dev);
 	rhine_chip_reset(dev);
@@ -189906 +1901,9 @@xx	struct rhine_private *rp = netdev_priv(dev);
x	void __iomem *ioaddr = rp->base;
fa+	if (!(rp->quirks & rqWOL))
7		return; /* Nothing to do for non-WOL adapters */
+
 	rhine_power_init(dev);
 
x	/* Make sure we use patternd0, 1 and not 4, 5 */
@@ -1937,7 +1941,7 @@xx}
 
x#ifdef CONFIG_PM
-static int rhine_suspend(struct pci_dev *pdev, u32 state)
+static int rhine_suspend(struct pci_dev *pdev, pm_message_t state)
 {xx	struct net_device *dev = pci_get_drvdata(pdev);
 	struct rhine_private *rp = netdev_priv(dev);
diff -Nru a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
--- a/drivers/net/via-velocity.c	2005-01-20 21:02:12 -08:00
+++ b/drivers/net/via-velocity.c	2005-03-08 12:46:51 -08:00
@@ -263,7 +263 7 @@xx
 #ifdef CONFIG_PM
 
-static int velocity_suspend(struct pci_dev *pdev, u32 state);
+static int velocity_suspend(struct pci_dev *pdev, pm_message_t state);
xstatic int velocity_resume(struct pci_dev *pdev);
 
xstatic int velocity_netdev_event(struct notifier_block *nb, unsigned long notification, void *ptr);
@@ -289x67 +289x67 @@xx	struct velocity_info *vptr = dev->priv;
 	strcpy(info->driver, VELOCITY_NAME);
 	strcpy(info->version, VELOCITY_VERSION);
-	strcpy(info->bus_info, vptr->pdev->slot_name);
7	strcpy(info->bus_info, pci_name(vptr->pdev));
 }
 
xstatic void velocity_ethtool_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
@@ -3096,7 +3096,7 @@xx *	we are interested in.xx */
 
-u16 wol_calc_crc(int size, u8 * pattern, u8 *mask_pattern)
+static u16 wol_calc_crc(int size, u8 * pattern, u8 *mask_pattern)
 {xx	u16 crc = 0xFFFF;
 	u8 mask;
@@ -321, 7 +3a1, 7 @@xx	return 0;
1}
 
-static int velocity_suspend(struct pci_dev *pdev, u32 state)
+static int velocity_suspend(struct pci_dev *pdev, pm_message_t state)
 {xx	struct velocity_info *vptr = pci_get_drvdata(pdev);
 	unsigned long flags;
diff -Nru a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
--- a/drivers/net/wan/Kconfig	2005-01-15 14:31:06 -08:00
+++ b/drivers/net/wan/Kconfig	2005-02-28 16:58:08 -08:00
@@ -155,7 +155,8 @@xx	  Network) card supported by this driver and you are planning toxx	  connect the box to a WAN.
x
-	  You will need supporting software from <http://hq.pm.waw.pl/hdlc/>.
+	  You will need supporting software from
+	  <http://www.kernel.org/pub/linux/utils/net/hdlc/>.
x	  Generic HDLC driver currently supports raw HDLC, Cisco HDLC, Frame
x	  Relay, synchronous Point-to-Point Protocol (PPP) and X.25.
 
@@ -225,7 +22667 @@xx	  Driver for PCI200SYN cards by Goramo sp. j.
 
x	  If you have such a card, say Y here and see
-	  <http://hq.pm.waw.pl/hdlc/>.
+	  <http://www.kernel.org/pub/linux/utils/net/hdlc/>.
x
x	  To compile this as a module, choose M here: the
 	  module will be called pci200syn.
@@ -239 7 +24067 @@xx	  Driver for wanXL PCI cards by SBEdInc.
 
x	  If you have such a card, say Y here and see
-	  <http://hq.pm.waw.pl/hdlc/>.
+	  <http://www.kernel.org/pub/linux/utils/net/hdlc/>.
x
x	  To compile this as a module, choose M here: the
 	  module will be called wanxl.
@@ -291,7 +29367 @@xx	  SDL CommunicationsdInc.
 
x	  If you have such a card, say Y here and see
-	  <http://hq.pm.waw.pl/hdlc/>.
+	  <http://www.kernel.org/pub/linux/utils/net/hdlc/>.
x
x	  Note that N2csu and N2dds cards are not supported by this driver.
 
@@ -308,7 +30967 @@xx	  Driver for C101 SuperSync ISA cards by Moxa Technologies Co., Ltd.
 
x	  If you have such a card, say Y here and see
-	  <http://hq.pm.waw.pl/pub/hdlc/>
+	  <http://www.kernel.org/pub/linux/utils/net/hdlc/>.
x
x	  To compile this driver as a module, choose M here: the
 	  module will be called c101.
diff -Nru a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
--- a/drivers/net/wan/cosa.c	2005-01-07 21:44:25 -08:00
+++ b/drivers/net/wan/cosa.c	2005-01-04 14:57:49 -08:00
@@ -543,7 +543,7 @@xx		 * FIXME: When this code is not used as module, we shouldxx		 * probably call udelay() instead of the interruptible sleep.xx		 */
-		current->state = TASK_INTERRUPTIBLE;
7		set_current_state(TASK_INTERRUPTIBLE);
x		cosa_putstatus(cosa, SR_TX_INT_ENA);
 		schedule_timeout(30);
 		irq = probe_irq_off(irqs);
@@ -1564,8 +1564,7 @@xx	cosa_getdata8(cosa);
 	cosa_putstatus(cosa, SR_RST);
x#ifdef MODULE
-	current->state = TASK_INTERRUPTIBLE;
-	schedule_timeout(HZ/2);
+	msleep(500);
 #elsexx	udelay(5*100000);
 #endif
@@ -1618,7 +161767 @@xx			return r;
 		}
x		/* sleep if not ready to read */
-		current->state = TASK_INTERRUPTIBLE;
7		set_current_state(TASK_INTERRUPTIBLE);
x		schedule_timeout(1);
 	}
 	printk(KERN_INFO "cosa: timeout in get_wait_data (status 0x%x)\n",xdiff -Nru a/drivers/net/wan/hd6457x.c b/drivers/net/wan/hd6457x.c
--- a/drivers/net/wan/hd6457x.c	2004-10-27 14:30:24 -07:00
+++ b/drivers/net/wan/hd6457x.c	2005-02-28 16:58:08 -08:00
@@ -31567 +31567 @@xx#endif
 	stats->rx_packets++;
 	stats->rx_bytes += skb->len;
-	skb->dev->last_rx = jiffies;
+	dev->last_rx = jiffies;
 	skb->protocol = hdlc_type_trans(skb, dev);
x	netif_rx(skb);
 }
diff -Nru a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
--- a/drivers/net/wan/sbni.c	2005-01-07 21:44:21 -08:00
+++ b/drivers/net/wan/sbni.c	2005-03-02 09:45:09 -08:00
@@ -176,7 +17667 @@xx
x#ifndef MODULE
 typedef u32  iarr[];
-static iarr  *dest[5] = { &io, &irq, &baud, &rxl, &mac };
+static iarr __initdata *dest[5] = { &io, &irq, &baud, &rxl, &mac };
x#endif
 
x/* A zero-terminated list of I/O addresses to be probed on ISA bus */
diff -Nru a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c
--- a/drivers/net/wan/wanxl.c	2004-10-27 14:30:24 -07:00
+++ b/drivers/net/wan/wanxl.c	2005-02-07 12:52:54 -08:00
@@ -71,7 +7267 @@xx	u8 irq;
1xx	u8 __iomem *plx;	/* PLX PCI9060 virtual base address */
-	struct pci_dev *pdev;	/* for pdev->slot_name */
+	struct pci_dev *pdev;	/* for pci_name(pdev) */
 	int rx_in;
 	struct sk_buff *rx_skbs[RX_QUEUE_LENGTH];
 	card_status_t *status;	/* shared between host and card */
@@ -88,12 +88,6 @@xx}
 
x
-static inline const char* card_name(struct pci_dev *pdev)
-{x-	return pdev->slot_name;
-}
-
-
xstatic inline port_status_t* get_status(port_t *port)
 {xx	return &port->card->status->port_status[port->node];
@@ -107,7 +101 7 @@xx	dma_addr_t addr = pci_map_single(pdev, ptr, size, direction);
 	if (addr + size >x611,,,,,,,,LL)
x		printk(KERN_CRIT "wanXL %s:,pci_map_single() returned memory"x-		  x    " at 0x%LX!\n", card_name(pdev),x+		  x    " at 0x%LX!\n", pci_name(pdev),x 		  x    (unsigned long long)addr);
 	return addr;
 }
@@ -201,7 +19567 @@xx	  x    desc->stat != PACKET_EMPTY) {x 		if ((desc->stat & PACKET_PORT_MASK) >xcard->n_ports)
 			printk(KERN_CRIT "wanXL %s:,received packet for"
-			       " nonexistent port\n", card_name(card->pdev));
+			       " nonexistent port\n", pci_name(card->pdev));
 		else {x 			struct sk_buff *skb = card->rx_skbs[card->rx_in];
 			port_t *port = &card->ports[desc->stat &
@@ -60467 +59x67 @@xx	card = kmalloc(alloc_size, GFP_KERNEL);
 	if (card == NULL) {xx		printk(KERN_ERR "wanXL %s:,unable to allocate memory\n",x-		  x    card_name(pdev));
+		  x    pci_name(pdev));
 		pci_release_regions(pdev);
 		pci_disable_device(pdev);
 		return -ENOBUFS;
@@ -62367 +61767 @@xx
x#ifdef DEBUG_PCI
 	printk(KERN_DEBUG "wanXL %s:,pci_alloc_consistent() returned memory"x-	  x    " at 0x%LX\n", card_name(pdev),x+	  x    " at 0x%LX\n", pci_name(pdev),x 	  x    (unsigned long long)card->status_address);
x#endif
 
@@ -64967 +683,7 @@xx	while ((stat = readl(card->plx + PLX_MAILBOX_0)) != 0) {x 		if (time_before(timeout, jiffies)) {xx			printk(KERN_WARNING "wanXL %s:,timeout waiting for"
-			       " PUTS to complete\n", card_name(pdev));
+			       " PUTS to complete\n", pci_name(pdev));
 			wanxl_pci_remove_one(pdev);
 			return -ENODEV;
 		}
@@ -661,7 +655,7 @@xx
 		default:xx			printk(KERN_WARNING "wanXL %s:,PUTS test 0x%X"
-			       " failed\n", card_name(pdev), stat & +03a);
+			       " failed\n", pci_name(pdev), stat & +03a);
 			wanxl_pci_remove_one(pdev);
 			return -ENODEV;
 		}
@@ -681,7 +67567 @@xx	  x (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports) {x 		printk(KERN_WARNING "wanXL %s:,no enough on-board RAM"
 		  x    " (%u bytes detected, %u bytes required)\n",x-		  x    card_name(pdev), ramsize, BUFFERS_ADDR +
+		  x    pci_name(pdev), ramsize, BUFFERS_ADDR +
 		  x    (TX_BUFFERS + RX_BUFFERS) * BUFFER_LENGTH * ports);
 		wanxl_pci_remove_one(pdev);
 		return -ENODEV;
@@ -68967 +683 7 @@xx
 	if (wanxl_puts_command(card, MBX1_CMD_BSWAP)) {x 		printk(KERN_WARNING "wanXL %s:,unable to Set Byte Swap"x-		  x    " Mode\n", card_name(pdev));
+		  x    " Mode\n", pci_name(pdev));
 		wanxl_pci_remove_one(pdev);
 		return -ENODEV;
 	}x@@ -720,7 +714 7 @@xx
 	if (wanxl_puts_command(card, MBX1_CMD_ABORTJ)) {x 		printk(KERN_WARNING "wanXL %s:,unable to Abort and Jump\n",x-		  x    card_name(pdev));
+		  x    pci_name(pdev));
 		wanxl_pci_remove_one(pdev);
 		return -ENODEV;
 	}x@@ -735,7 +729 7 @@xx
 	if (!stat) {x 		printk(KERN_WARNING "wanXL %s:,timeout while initializing card"x-		  x    "firmware\n", card_name(pdev));
+		  x    "firmware\n", pci_name(pdev));
 		wanxl_pci_remove_one(pdev);
 		return -ENODEV;
 	}x@@ -745,12 +739,12 @@xx#endif
 
x	printk(KERN_INFO "wanXL %s:,at 0x%X, %u KB of RAM,at 0x%X, irq %u\n",x-	  x    card_name(pdev), plx_phy, ramsize / 10a469mem_phy, pdev->irq);
+	  x    pci_name(pdev), plx_phy, ramsize / 10a469mem_phy, pdev->irq);
 
x	/* Allocate IRQ */
 	if (request_irq(pdev->irq, wanxl_intr, SA_SHIRQ, "wanXL", card)) {x 		printk(KERN_WARNING "wanXL %s:,could not allocate IRQ%i.\n",x-		  x    card_name(pdev), pdev->irq);
+		  x    pci_name(pdev), pdev->irq);
 		wanxl_pci_remove_one(pdev);
 		return -EBUSY;
 	}x@@ -761,7 +75667 @@xx		struct net_device *dev = alloc_hdlcdev(port);
 		if (!dev) {xx			printk(KERN_ERR "wanXL %s:,unable to allocate"
-			       " memory\n", card_name(pdev));
+			       " memory\n", pci_name(pdev));
 			wanxl_pci_remove_one(pdev);
 			return -ENOMEM;
 		}
@@ -783 7 +77767 @@xx		get_status(port)->clocking = CLOCK_EXT;
 		if (register_hdlc_device(dev)) {xx			printk(KERN_ERR "wanXL %s:,unable to register hdlc"
-			       " device\n", card_name(pdev));
+			       " device\n", pci_name(pdev));
 			free_netdev(dev);
 			wanxl_pci_remove_one(pdev);
 			return -ENOBUFS;
@@ -791,7 +785,7 @@xx		card->n_ports++;
 	}
x
-	printk(KERN_INFO "wanXL %s:,port", card_name(pdev));
+	printk(KERN_INFO "wanXL %s:,port", pci_name(pdev));
 	for (i = 0; i < ports; i++)x 		printk("%s #%i:,%s", i ? "," : "", i,x 		  x    card->ports[i].dev->name);
diff -Nru a/drivers/net/wan/z85230.c b/drivers/net/wan/z85230.c
--- a/drivers/net/wan/z85230.c	2003-09-26 09:41:22 -07:00
+++ b/drivers/net/wan/z85230.c	2005-02-24 09:39:03 -08:00
@@ -73467 +73467 @@xx	u8 intr;xx	static volatile int locker=0;xx	int work=0;x-	struct z8530_irqhandler *irqs=dev->chanA.irqs;
+	struct z8530_irqhandler *irqs;xx	xx	if(locker)x 	{x@@ -758,6 +758d8 @@xx		/* Now walk the chip and see what it is wanting - it may bex 		  xan IRQ for someone else remember */
 		  x
+		irqs=dev->chanA.irqs;
+
 		if(intr & (CHARxIP|CHATxIP|CHAEXT))
 		{
 			if(intr&CHARxIP)
diff -Nru a/drivers/net/wd.c b/drivers/net/wd.c
--- a/drivers/net/wd.c	2005-01-07 21:44:22 -08:00
+++ b/drivers/net/wd.c	2005-01-17 21:54:25 -08:00
@@ -131,6 +131 7 @@xx{
 	free_irq(dev->irq, dev);
x	release_region(dev->base_addr - WD_NIC_OFFSET, WD_IO_EXTENT);
+	iounmap(ei_status.mem);
 }
 
x#ifndef MODULE
@@ -317,16 +318,22 @@xx	ei_status.rx_start_page = WD_START_PG + TX_PAGES;
 
x	/* Don't map in the shared memory until the board is actually opened. */
-	ei_status.rmem_start = dev->mem_start + TX_PAGES*256;
 
x	/* Some cards (eg WD8003EBT) can be jumpered for more (32k!) memory. */
 	if (dev->mem_end != 0) {x 		ei_status.stop_page = (dev->mem_end - dev->mem_start)/256;
+		ei_status.priv = dev->mem_end - dev->mem_start;
 	} else {x 		ei_status.stop_page = word16 ? WD13_STOP_PG : WD03_STOP_PG;
 		dev->mem_end = dev->mem_start + (ei_status.stop_page - WD_START_PG)*256;
+		ei_status.priv = (ei_status.stop_page - WD_START_PG)*256;
+	}
+
+	ei_status.mem = ioremap(dev->mem_start, ei_status.priv);
+	if (!ei_status.mem) {
+		free_irq(dev->irq, dev);
+		return -ENOMEM;
 	}
-	ei_status.rmem_end = dev->mem_end;
 
x	printk(",%s, IRQ %d, shared memory at %#lx-%#lx.\n",x 		  xmodel_name, dev->irq, dev->mem_start, dev->mem_end-1);
@@ -397,7 +404 7 @@xx{
 xx	int wd_cmdreg = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */
-	unsigned long hdr_start = dev->mem_start + ((ring_page - WD_START_PG)<<8);
+	void __iomem *hdr_start = ei_status.mem + ((ring_page - WD_START_PG)<<8);
 
x	/* We'll always get a 4 byte header read followed by a packet readddsoxx	  xwe enable 16 bit mode before the header, and disable after the body. */
@@ -407d10 +414 10 @@xx#ifdef __BIG_ENDIAN
x	/* Officially this is what we are doing, but the readl() is faster */
 	/* unfortunately it isn't endian aware of the struct               */
-	isa_memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
+	memcpy_fromio(hdr, hdr_start, sizeof(struct e8390_pkt_hdr));
 	hdr->count = le16_to_cpu(hdr->count);
 #elsex-	((unsigned int*)hdr)[0] = isa_readl(hdr_start);
+	((unsigned int*)hdr)[0] = readl(hdr_start);
x#endif
 }
 
@@ -423d17 +434,18 @@xxwd_block_input(struct net_device *dev, int count, struct sk_buff *skb, int ring_offset)
 {xx	int wd_cmdreg = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */
-	unsigned long xfer_start = dev->mem_start + ring_offset - (WD_START_PG<<8);
+	unsigned long offset = ring_offset - (WD_START_PG<<8);
+	void __iomem *xfer_start = ei_status.mem + offset;
x
-	if (xfer_start + count > ei_status.rmem_end) {x+	if (offset + count > ei_status.priv) {x 		/* We must wrap the input move. */
-		int semi_count = ei_status.rmem_end - xfer_start;
-		isa_memcpy_fromio(skb->data, xfer_start, semi_count);
+		int semi_count = ei_status.priv - offset;
+		memcpy_fromio(skb->data, xfer_start, semi_count);
x		count -= semi_count;
-		isa_memcpy_fromio(skb->data + semi_count, ei_status.rmem_start, count);
+		memcpy_fromio(skb->data + semi_count, ei_status.mem + TX_PAGES * 256, count);
 	} else {x 		/* Packet is in one chunk -- we can copy + cksum. */
-		isa_eth_io_copy_and_sum(skb, xfer_start, count, a);
+		eth_io_copy_and_sum(skb, xfer_start, count, a);
 	}
 
x	/* Turn off 16 bit access so that reboot works.	 ISA brain-damage */
@@ -446,16 +454,16 @@xx				int start_page)
 {xx	int wd_cmdreg = dev->base_addr - WD_NIC_OFFSET; /* WD_CMDREG */
-	long shmem = dev->mem_start + ((start_page - WD_START_PG)<<8);
+	void __iomem *shmem = ei_status.mem + ((start_page - WD_START_PG)<<8);
 xx
 	if (ei_status.word16) {x 		/* Turn on and off 16 bit access so that reboot works. */
 		outb(ISA16 | ei_status.reg5, wd_cmdreg+WD_CMDREG5);
-		isa_memcpy_toio(shmem, buf, count);
+		memcpy_toio(shmem, buf, count);
 		outb(ei_status.reg5, wd_cmdreg+WD_CMDREG5);
 	} else
-		isa_memcpy_toio(shmem, buf, count);
+		memcpy_toio(shmem, buf, count);
 }
 
x
diff -Nru a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
--- a/drivers/net/wireless/airo.c	2005-01-15 14:01:54 -08:00
+++ b/drivers/net/wireless/airo.c	2005-01-04 14:57:49 -08:00
@@ -1698,9 +1698d8 @@xx			issuecommand(ai, &cmddd&rsp);
 			up(&ai->sem);
 			/* Let the command take effect */
-			set_current_state (TASK_INTERRUPTIBLE);
x			ai->task = current;
-			schedule_timeout (3*HZ);
+			ssleep(3);
x			ai->task = NULL;
 		}
x	rc = PC4500_readrid(ai, first ? RID_BSSLISTFIRST : RID_BSSLISTNEXT,x@@ -2685,11 +2684,9 @@xx		return -1;
 	waitbusy (ai);
x	OUT4500(ai,COMMAND,CMD_SOFTRESET);x-	set_current_state (TASK_UNINTERRUPTIBLE);
-	schedule_timeout (HZ/5);
+	msleep(200);
 	waitbusy (ai);
-	set_current_state (TASK_UNINTERRUPTIBLE);
-	schedule_timeout (HZ/5);
+	msleep(200);
 	if (lock)xx		up(&ai->sem);
 	return 0;
@@ -5516612 +5513,12 @@xx	} else {x 		OUT4500(ai, EVACK, EV_AWAKEN);
x		OUT4500(ai, EVACK, EV_AWAKEN);
-		schedule_timeout(HZ/1a);
+		msleep(10a);
 	}
 
x	set_bit (FLAG_COMMITdd&ai->flags);
 	disable_MAC(ai, a);
-        schedule_timeout (HZ/5);
+        msleep(200);
 	if (ai->SSID) {x 		writeSsidRid(ai, ai->SSID, a);
 		kfree(ai->SSID);
@@ -7470,8 +746767 @@xx
x	OUT4500(ai,COMMAND,CMD_SOFTRESET);x 
-	set_current_state (TASK_UNINTERRUPTIBLE);
-	schedule_timeout (HZ);          /* WAS 600 12/7/00 */
+	ssleep(1);			/* WAS 600 12/7/00 */
x
 	if(!waitbusy (ai)){
 		printk(KERN_INFO "Waitbusy hang AFTER RESET\n");
@@ -7498d8 +749467 @@xx		OUT4500(ai, SWS3, FLASH_COMMAND);
 		OUT4500(ai, COMMAND,a);
 	}
-	set_current_state (TASK_UNINTERRUPTIBLE);
-	schedule_timeout (HZ/2); /* 500ms delay */
+	msleep(500);		/* 500ms delay */
x
 	if(!waitbusy(ai)) {x 		clear_bit (FLAG_FLASHINGdd&ai->flags);
@@ -7609d8 +7604 7 @@xxint flashrestart(struct airo_info *ai,struct net_device *dev){xx	int   xi,status;
 x-	set_current_state (TASK_UNINTERRUPTIBLE);
-	schedule_timeout (HZ);          /* Added 12/7/00 */
+	ssleep(1);			/* Added 12/7/00 */
 	clear_bit (FLAG_FLASHINGdd&ai->flags);
 	if (test_bit(FLAG_MPIdd&ai->flags)) {x 		status = mpi_init_descriptors(ai);
@@ -7615d8 +761967 @@xx				( ai, 2312, i >= MAX_FIDS / 2 );
 		}
xx-	set_current_state (TASK_UNINTERRUPTIBLE);
-	schedule_timeout (HZ);          /* Added 12/7/00 */
+	ssleep(1);			/* Added 12/7/00 */
 	return status;
 }
x#endif /* CISCO_EXT */
diff -Nru a/drivers/net/wireless/airport.c b/drivers/net/wireless/airport.c
--- a/drivers/net/wireless/airport.c	2004-09-22 13:35:24 -07:00
+++ b/drivers/net/wireless/airport.c	2005-02-17 17:04:03 -08:00
@@ -2x67 +28,6 @@xx#include <linux/if_arp.h>xx#include <linux/etherdevice.h>xx#include <linux/wireless.h>x-#include <linux/delay.h>xxxx#include <asm/io.h>xx#include <asm/system.h>x@@ -45,7 +44 7 @@xx
 struct airport {xx	struct macio_dev *mdev;
-	void *vaddr;
+	void __iomem *vaddr;
 	int irq_requested;xx	int ndev_registered;xx};
@@ -150,7 +14967 @@xx	ssleep(1);
x
 	macio_set_drvdata(mdev, NULL);
-	free_netdev(dev);
+	free_orinocodev(dev);
 
x	return 0;
1}
@@ -194,14 +193d14 @@xx	hermes_t *hw;xx
 	if (macio_resource_count(mdev) < 1 || macio_irq_count(mdev) < 1) {x-		printk(KERN_ERR PFX "wrong interrupt/addresses in OF tree\n");
+		printk(KERN_ERR PFX "Wrong interrupt/addresses in OF tree\n");
 		return -ENODEV;
 	}x 
x	/* Allocate space for private device-specific data */
 	dev = alloc_orinocodev(sizeof(*card), airport_hard_reset);
 	if (! dev) {x-		printk(KERN_ERR PFX "can't allocate device datas\n");
+		printk(KERN_ERR PFX "Cannot allocate network device\n");
 		return -ENODEV;
 	}x 	priv = netdev_priv(dev);
@@ -211,7 +211 7 @@xx
 	if (macio_request_resource(mdev, 0, "airport")) {xx		printk(KERN_ERR PFX "can't request IO resource !\n");
-		free_netdev(dev);
+		free_orinocodev(dev);
 		return -EBUSY;
 	}x 
@@ -224,16 +223d15 @@xx	/* Setup interrupts & base address */
 	dev->irq = macio_irq(mdev, 0);
 	phys_addr = macio_resource_start(mdev, 0);  /* Physical address */
-	printk(KERN_DEBUG PFX "Airport at physical address %lx\n", phys_addr);
+	printk(KERN_DEBUG PFX "Physical address %lx\n", phys_addr);
 	dev->base_addr = phys_addr;
 	card->vaddr = ioremap(phys_addr, AIRPORT_IO_LEN);
 	if (!card->vaddr) {x-		printk(PFX "ioremap() failed\n");
+		printk(KERN_ERR PFX "ioremap() failed\n");
 		goto failed;
 	}
x
-	hermes_struct_init(hw, (ulong)card->vaddr,x-			HERMES_MEM, HERMES_16BIT_REGSPACING);
+	hermes_struct_init(hw, card->vaddr, HERMES_16BIT_REGSPACING);
 		xx	/* Power up card */
 	pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 1);
@@ -242 7 +24067 @@xx	/* Reset it before we get the interrupt */
 	hermes_init(hw);
x
-	if (request_irq(dev->irq, orinoco_interrupt, 0, "Airport", dev)) {x+	if (request_irq(dev->irq, orinoco_interrupt, 0, dev->name, dev)) {xx		printk(KERN_ERR PFX "Couldn't get IRQ %d\n", dev->irq);
 		goto failed;
 	}
@@ -25367 +25167 @@xx		printk(KERN_ERR PFX "register_netdev() failed\n");
 		goto failed;
 	}
-	printk(KERN_DEBUG PFX "card registered for interface %s\n", dev->name);
+	printk(KERN_DEBUG PFX "Card registered for interface %s\n", dev->name);
 	card->ndev_registered = 1;
x	return 0;
1 failed:
diff -Nru a/drivers/net/wireless/arlan.h b/drivers/net/wireless/arlan.h
--- a/drivers/net/wireless/arlan.h	2004-10-21 15:13:59 -07:00
+++ b/drivers/net/wireless/arlan.h	2005-03-02 20:49:07 -08:00
@@ -43d8 +43,8 @@xxexterndint init_arlan_proc(void);
 externdvoid cleanup_arlan_proc(void);
 #elsex-#define init_arlan_proc()	(0)x-#define cleanup_arlan_proc()	do { } while (a);
+#define init_arlan_proc()	({ 0; })
+#define cleanup_arlan_proc()	do { } while (a)xx#endif
 
xexterndstruct net_device *arlan_device[MAX_ARLANS];
diff -Nru a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
--- a/drivers/net/wireless/atmel.c	2004-11-08 04:52:00 -08:00
+++ b/drivers/net/wireless/atmel.c	2005-02-01 13:15:55 -08:00
@@ -6906 +6967 @@xx#include <linux/moduleparam.h>xx#include <linux/firmware.h>xx#include "ieee802_11.h"
+#include "atmel.h"
xxx#define DRIVER_MAJOR 0xx#define DRIVER_MINOR 96
@@ -8306 +84,23 @@xxstatic char *firmware = NULL;
 module_param(firmware, charp, 0);
 
+/* table of firmware file names */
+static struct {x
+	AtmelFWType fw_type;
+	const char *fw_file;
+	const char *fw_file_ext;
+} fw_table[] = {
+	{ ATMEL_FW_TYPE_502,      "atmel_at76c502",      "bin" },
+	{ ATMEL_FW_TYPE_502D,     "atmel_at76c502d",     "bin" },
+	{ ATMEL_FW_TYPE_502E,     "atmel_at76c502e",     "bin" },
+	{ ATMEL_FW_TYPE_502_3COM, "atmel_at76c502_3com", "bin" },
+	{ ATMEL_FW_TYPE_504,      "atmel_at76c504",      "bin" },
+	{ ATMEL_FW_TYPE_504_2958, "atmel_at76c504_2958", "bin" },
+	{ ATMEL_FW_TYPE_504A_2958,"atmel_at76c504a_2958","bin" },
+	{ ATMEL_FW_TYPE_506,      "atmel_at76c506",      "bin" },
+	{ ATMEL_FW_TYPE_NONE,      NULL,                  NULL1}
+};
+
 #define MAX_SSID_LENGTH 32
 #define MGMT_JIFFIES (256 * HZ / 10a)xxx@@ -458d8 +476d8 @@xx	void *card; /* Bus dependent stucture varies for PCcard */
 	int (*present_callback)(void *); /* And callback which uses it */
 	char firmware_id[32];
-	char firmware_template[32];
-	unsigned char *firmware;
+	AtmelFWType firmware_type;
+	u8 *firmware;
 	int firmware_length;
 	struct timer_list management_timer;
 	struct net_device *dev;
@@ -1293617 +1311 21 @@xx	if (priv->operating_mode == IW_MODE_INFRA) {x 		if (priv->station_state != STATION_STATE_READY) {xx			priv->wstats.qual.qual = 0;
-			priv->wstats.qual.level	= 0;
+			priv->wstats.qual.level = 0;
+			priv->wstats.qual.updated = (IW_QUAL_QUAL_INVALID
7					| IW_QUAL_LEVEL_INVALID);
 		}
x		priv->wstats.qual.noise = 0;
-		priv->wstats.qual.updated = 7;
+		priv->wstats.qual.updated |= IW_QUAL_NOISE_INVALID;
 	} else {x 		/* Quality levels,cannot be determined in ad-hoc mode,x 		  xbecause we can 'hear' more that one remote station. */
 		priv->wstats.qual.qual = 0;
 		priv->wstats.qual.level	= 0;
x		priv->wstats.qual.noise	= 0;
-		priv->wstats.qual.updated = 0;
+		priv->wstats.qual.updated = IW_QUAL_QUAL_INVALID
7					| IW_QUAL_LEVEL_INVALID
7					| IW_QUAL_NOISE_INVALID;
 		priv->wstats.miss.beacon = 0;
 	}
x	
@@ -148267 +1504 7 @@xxxxxxxxxxreturn len;
1}
 
-struct net_device *init_atmel_card( unsigned short irq, int port, char *firmware_id, x
+struct net_device *init_atmel_card( unsigned short irq, int port, const AtmelFWType fw_type, x
x				    struct device *sys_dev, int (*card_present)(void *), void *card)
 {xx	struct net_device *dev;
@@ -1507,11 +1529,9 @@xx	priv->card = card;xx	priv->firmware = NULL;
 	priv->firmware_id[0] = '\0';
-	priv->firmware_template[0] = '\0';
+	priv->firmware_type = fw_type;
x	if (firmware) /* module parameter */
 		strcpy(priv->firmware_id, firmware);
-	else if (firmware_id) /* from PCMCIA card-matching or PCI */
-		strcpy(priv->firmware_template, firmware_id);
 	priv->bus_type = card_present ? BUS_TYPE_PCCARD : BUS_TYPE_PCI;
 	priv->station_state = STATION_STATE_DOWN;
 	priv->do_rx_crc = 0;
@@ -157906 +1599d8 @@xx	dev->irq = irq;
1	dev->base_addr = port;
 	
+	SET_NETDEV_DEV(dev, sys_dev);
+	
x	if ((rc = request_irq(dev->irq, service_interrupt, SA_SHIRQ, dev->name, dev))) {xx		printk(KERN_ERR "%s:,register interrupt %d failed, rc %d\n", dev->name, irq, rc );
 		goto err_out_free;
@@ -2218,6 +2240613 @@xx	range->max_qual.qual = 10a;xx	range->max_qual.level = 10a;xx	range->max_qual.noise = 0;
+	range->max_qual.updated = IW_QUAL_NOISE_INVALID;
+
+	range->avg_qual.qual = 50;
+	range->avg_qual.level = 50;
+	range->avg_qual.noise = 0;
+	range->avg_qual.updated = IW_QUAL_NOISE_INVALID;
+
x	range->sensitivity = 0;
1x 	range->bitrate[0] =  1,,,,,,;
@@ -2247,9 +2276d6 @@xx	range->r_time_flags = 0;
 	range->min_retry = 1;
x	range->max_retry = 65535;
-	range->avg_qual.qual = 50;
-	range->avg_qual.level = 50;
-	range->avg_qual.noise = 0;
 
x	return 0;
1}
@@ -3025,16 +3051,23 @@xxstatic void smooth_rssi(struct atmel_private *priv, u8 rssi)
 {xx	u8 old = priv->wstats.qual.level;
+	u8 max_rssi = 42; /* 502-rmfd-revd max by experiment, default for now */
 
-	/* 502-rmfd-revd gives max signal level as 42, by experiment.x-	  xThis is going to break for other hardware variants. */
+	switch (priv->firmware_type) {
+		case ATMEL_FW_TYPE_502E:
7			max_rssi = 63; /* 502-rmfd-reve max by experiment */
+			break;
+		default:x+			break;
+	}
x
-	rssi = rssi * 1,, / 42;
+	rssi = rssi * 1,, / max_rssi;
 	if((rssi + old) % 2)
 		priv->wstats.qual.level =  ((rssi + old)/2) + 1;
x	elsexx		priv->wstats.qual.level =  ((rssi + old)/2);		
-	
+	priv->wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
+	priv->wstats.qual.updated &= ~IW_QUAL_LEVEL_INVALID;
 }
 
xstatic void atmel_smooth_qual(struct atmel_private *priv)
@@ -3047d8 +3080d10 @@xx			priv->beacons_this_sec * priv->beacon_period * (priv->wstats.qual.level + 10a) / 4000;
x		priv->beacons_this_sec = 0;
 	}
+	priv->wstats.qual.updated |= IW_QUAL_QUAL_UPDATED;
+	priv->wstats.qual.updated &= ~IW_QUAL_QUAL_INVALID;
 }
-	
+
x/* deals,with incoming managment frames. */
 static void atmel_management_frame(struct atmel_private *priv, struct ieee802_11_hdr *header, x 		  x   u16 frame_len, u8 rssi)
@@ -3611d8 +3646d8 @@xx		const struct firmware *fw_entry = NULL;
 		unsigned char *fw;
 		int len = priv->firmware_length;
-		if (!(fw = priv->firmware)) { 
-			if (strlen(priv->firmware_template) == 0) {	
+		if (!(fw = priv->firmware)) {x+			if (priv->firmware_type == ATMEL_FW_TYPE_NONE) {xx				if (strlen(priv->firmware_id) == 0) {x 					printk(KERN_INFOx 					  x    "%s:,card type is unknown: assuming at76c502 firmware is OK.\n",x@@ -3627,24 +3662,36 @@xx					  x    "%s:,firmware %s is missing, cannot continue.\n", xx					  x    dev->name, priv->firmware_id);xx					return 0;
-					
-				} 
7				}
x			} else {x-				int i;
+				int fw_index = 0;
+				int success = 0;
+
+				/* get firmware filename entry based on firmware type ID */
+				while (fw_table[fw_index].fw_type != priv->firmware_type
7						&& fw_table[fw_index].fw_type != ATMEL_FW_TYPE_NONE)
7					fw_index++;
 				
-				for (i = 0; firmware_modifier[i]; i++) {x-					sprintf(priv->firmware_id, priv->firmware_template, firmware_modifier[i]);
-					if (request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev) == 0) 
-						break;
+				/* construct the actual firmware file name */
+				if (fw_table[fw_index].fw_type != ATMEL_FW_TYPE_NONE) {x+					int i;
+					for (i = 0; firmware_modifier[i]; i++) {x7						snprintf(priv->firmware_id, 32, "%s%s.%s", fw_table[fw_index].fw_file,x7							firmware_modifier[i], fw_table[fw_index].fw_file_ext);
+						priv->firmware_id[31] = '\0';
+						if (request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev) == 0) {x7							success = 1;
+							break;
+						}
+					}
x				}
-				if (!firmware_modifier[i]) {x7				if (!success) {x 					printk(KERN_ALERT xx					  x    "%s:,firmware %s is missing, cannot start.\n", xx					  x    dev->name, priv->firmware_id);xx					priv->firmware_id[0] = '\0';
x					return 0;	
x				}
-				priv->firmware_template[0] = '\0';	
x			}
x			
 			fw = fw_entry->data;
diff -Nru a/drivers/net/wireless/atmel.h b/drivers/net/wireless/atmel.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/net/wireless/atmel.h	2005-01-30 15:33:31 -08:00
@@ -0,0 +1,43 @@x+/*** -*- linux-c -*- **********************************************************
+
+x    Driver for Atmel at76c502 at76c504 and at76c506 wireless cards.
+
+x        Copyright 2005 Dan Williams and Red Hat,dInc.
+
+x   This program is free software; you can redistribute it and/or modify
+x   it under the terms of the GNU General Public License as published by
+x   the Free Software Foundation; either version 2 of the License, or
+x   (at your option) any later version.
+
+x   This software is distributed in the hope that it will be useful,
+x   but WITHOUT ANY WARRANTY;,without even the implied warranty of
+x   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+x   GNU General Public License for more details.
+
+x   You should have received a copy of the GNU General Public License
+x   along with Atmel wireless lan drivers; if not,,write to the Free Software
+x   Foundation,dInc., 59 Temple Place, Suite 330, Boston,dMA  02111-1307  USA
+
+******************************************************************************/
+
+#ifndef _ATMEL_H
+#define _ATMEL_H
+
+typedef enum {x7	ATMEL_FW_TYPE_NONE = 0,x7	ATMEL_FW_TYPE_502,x7	ATMEL_FW_TYPE_502D,x7	ATMEL_FW_TYPE_502E,x7	ATMEL_FW_TYPE_502_3COM,x7	ATMEL_FW_TYPE_504,x7	ATMEL_FW_TYPE_504_2958,x7	ATMEL_FW_TYPE_504A_2958,x7	ATMEL_FW_TYPE_506
+} AtmelFWType;
+
+struct net_device *init_atmel_card(unsigned short, int, const AtmelFWType, struct device *, 
7				x   int (*present_func)(void *), void * );
+void stop_atmel_card( struct net_device *, int );
+int atmel_open( struct net_device * );
+
+#endif
diff -Nru a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c
--- a/drivers/net/wireless/atmel_cs.c	2005-01-15 14:31:03 -08:00
+++ b/drivers/net/wireless/atmel_cs.c	2005-03-02 20:54:50 -08:00
@@ -55,6 +55,7 @@xx#include <asm/system.h>xx#include <linux/wireless.h>x 
+#include "atmel.h"
xxx/*xxxxxAll the PCMCIA modules use PCMCIA_DEBUG to control debugging.  If
@@ -90,11 +91d6 @@xxxxxevent handler.xxx*/
 
-struct net_device *init_atmel_card(int, int, char *, struct device *, 
-				x   int (*present_func)(void *), void * );
-void stop_atmel_card( struct net_device *, int );
-int atmel_open( struct net_device * );
-
 static void atmel_config(dev_link_t *link);
xstatic void atmel_release(dev_link_t *link);
xstatic int atmel_event(event_t event, int priority,x@@ -307,28 +303,29 @@xxstatic struct {x
 	int manf, card;xx	char *ver1;
-	char *firmware;
+	AtmelFWType firmware;xx	char *name;
 } card_table[] = {
-	{ 0, 0, "WLAN/802.11b PC CARD", "atmel_at76c502d%s.bin", "Actiontec 802CAT1" },  
-	{ 0, 0, "ATMEL/AT76C502AR", "atmel_at76c502%s.bin", "NoName-RFMD" }, 
-	{ 0, 0, "ATMEL/AT76C502AR_D", "atmel_at76c502d%s.bin", "NoName-revD" }, 
-	{ 0, 0, "ATMEL/AT76C502AR_E", "atmel_at76c502e%s.bin", "NoName-revE" },
-	{ 0, 0, "ATMEL/AT76C504", "atmel_at76c504%s.bin", "NoName-504" },
-	{ 0, 0, "ATMEL/AT76C504A", "atmel_at76c504a_2958%s.bin", "NoName-504a-2958" },
-	{ 0, 0, "ATMEL/AT76C504_R", "atmel_at76c504_2958%s.bin", "NoName-504-2958" },
-	{ MANFID_3COM, 0x0620, NULL, "atmel_at76c502_3com%s.bin", "3com 3CRWE62092B" }, 
-	{ MANFID_3COM, 0x0696, NULL, "atmel_at76c502_3com%s.bin", "3com 3CRSHPW196" }, 
-	{ 0, 0, "SMC/2632W-V2", "atmel_at76c502%s.bin", "SMC 2632W-V2" },
-        { 0, 0, "SMC/2632W", "atmel_at76c502d%s.bin", "SMC 2632W-V3" },
-	{ 0xd601, 0x0007, NULL, "atmel_at76c502%s.bin", "Sitecom WLAN-011" }, 
-	{ 0x01bf, 0x3302, NULL, "atmel_at76c502e%s.bin", "Belkin F5D6020-V2" }, 
-	{ 0, 0, "BT/Voyager 1020 Laptop Adapter", "atmel_at76c502%s.bin", "BT Voyager 1020" },
-        { 0, 0, "IEEE 802.11b/Wireless LAN PC Card", "atmel_at76c502%s.bin", "Siemens Gigaset PC Card II" },
-	{ 0, 0, "CNet/CNWLC 11Mbps Wireless PC Card V-5", "atmel_at76c502e%s.bin", "CNet CNWLC-811ARL" },
-	{ 0, 0, "Wireless/PC_CARD", "atmel_at76c502d%s.bin", "Planet WL-3552" },
-	{ 0, 0, "OEM/11Mbps Wireless LAN PC Card V-3", "atmel_at76c502%s.bin", "OEM 11Mbps WLAN PCMCIA Card" },
-	{ 0, 0, "11WAVE/11WP611AL-E", "atmel_at76c502e%s.bin", "11WAVE WaveBuddy" } 
+	{ 0, 0, "WLAN/802.11b PC CARD", ATMEL_FW_TYPE_502D, "Actiontec 802CAT1" },  
+	{ 0, 0, "ATMEL/AT76C502AR", ATMEL_FW_TYPE_502, "NoName-RFMD" }, 
+	{ 0, 0, "ATMEL/AT76C502AR_D", ATMEL_FW_TYPE_502D, "NoName-revD" }, 
+	{ 0, 0, "ATMEL/AT76C502AR_E", ATMEL_FW_TYPE_502E, "NoName-revE" },
+	{ 0, 0, "ATMEL/AT76C504", ATMEL_FW_TYPE_504, "NoName-504" },
+	{ 0, 0, "ATMEL/AT76C504A", ATMEL_FW_TYPE_504A_2958, "NoName-504a-2958" },
+	{ 0, 0, "ATMEL/AT76C504_R", ATMEL_FW_TYPE_504_2958, "NoName-504-2958" },
+	{ MANFID_3COM, 0x0620, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRWE62092B" }, 
+	{ MANFID_3COM, 0x0696, NULL, ATMEL_FW_TYPE_502_3COM, "3com 3CRSHPW196" }, 
+	{ 0, 0, "SMC/2632W-V2", ATMEL_FW_TYPE_502, "SMC 2632W-V2" },
+	{ 0, 0, "SMC/2632W", ATMEL_FW_TYPE_502D, "SMC 2632W-V3" },
+	{ 0xd601, 0x0007, NULL, ATMEL_FW_TYPE_502, "Sitecom WLAN-011" }, 
+	{ 0x01bf, 0x3302, NULL, ATMEL_FW_TYPE_502E, "Belkin F5D6020-V2" }, 
+	{ 0, 0, "BT/Voyager 1020 Laptop Adapter", ATMEL_FW_TYPE_502, "BT Voyager 1020" },
+	{ 0, 0, "IEEE 802.11b/Wireless LAN PC Card", ATMEL_FW_TYPE_502, "Siemens Gigaset PC Card II" },
+	{ 0, 0, "CNet/CNWLC 11Mbps Wireless PC Card V-5", ATMEL_FW_TYPE_502E, "CNet CNWLC-811ARL" },
+	{ 0, 0, "Wireless/PC_CARD", ATMEL_FW_TYPE_502D, "Planet WL-3552" },
+	{ 0, 0, "OEM/11Mbps Wireless LAN PC Card V-3", ATMEL_FW_TYPE_502, "OEM 11Mbps WLAN PCMCIA Card" },
+	{ 0, 0, "11WAVE/11WP611AL-E", ATMEL_FW_TYPE_502E, "11WAVE WaveBuddy" },
+	{ 0, 0, "LG/LW2100N", ATMEL_FW_TYPE_502E, "LG LW2100N 11Mbps WLAN PCMCIA Card" },
 };
x
 static void atmel_config(dev_link_t *link)
@@ -520,7 +51767 @@xx	((local_info_t*)link->priv)->eth_dev = 
 		init_atmel_card(link->irq.AssignedIRQ,
x				link->io.BasePort1,x-				card_index == -1 ? NULL1:  card_table[card_index].firmware,
7				card_index == -1 ? ATMEL_FW_TYPE_NONE :  card_table[card_index].firmware,
x				&handle_to_dev(handle),
x				card_present, xx				link);
diff -Nru a/drivers/net/wireless/atmel_pci.c b/drivers/net/wireless/atmel_pci.c
--- a/drivers/net/wireless/atmel_pci.c	2004-02-05 04:20:39 -08:00
+++ b/drivers/net/wireless/atmel_pci.c	2005-01-30 11:05:30 -08:00
@@ -25,6 +2567 @@xx#include <linux/module.h>xx#include <linux/init.h>xx#include <linux/netdevice.h>x+#include "atmel.h"
xxxMODULE_AUTHOR("Simon Kelley");
 MODULE_DESCRIPTION("Support for Atmel at76c50x 802.11 wireless ethernet cards.");
@@ -40,9 +41d6 @@xx
xstatic int atmel_pci_probe(struct pci_dev *, const struct pci_device_id *);
 static void atmel_pci_remove(struct pci_dev *);
-struct net_device *init_atmel_card(int, int, char *, struct device *, 
-				x  int (*present_func)(void *), void * );
-void stop_atmel_card( struct net_device *, int );
 xxstatic struct pci_driver atmel_driver = {x 	.name     = "atmel",x@@ -6367 +6167 @@xx	pci_set_master(pdev);
 	
 	dev = init_atmel_card(pdev->irq, pdev->resource[1].start, 
-			      "atmel_at76c506%s.bin",
+			      ATMEL_FW_TYPE_506,xx			      &pdev->dev, NULL, NULL);
 	if (!dev)
 		return -ENODEV;
diff -Nru a/drivers/net/wireless/hermes.c b/drivers/net/wireless/hermes.c
--- a/drivers/net/wireless/hermes.c	2004-07-27 22:05:55 -07:00
+++ b/drivers/net/wireless/hermes.c	2004-11-04 18:59:07 -08:00
@@ -48,6 +4867 @@xx#include <linux/delay.h>xx#include <linux/init.h>xx#include <linux/kernel.h>x+#include <linux/net.h>xx#include <asm/errno.h>xxxx#include "hermes.h"
@@ -67d8 +6867 @@xx * Debugging helpers
 x*/
 
-#define IO_TYPE(hw)	((hw)->io_space ? "IO " : "MEM ")x-#define DMSG(stuff...) do {printk(KERN_DEBUG "hermes @ %s0x%x: " , IO_TYPE(hw), hw->iobase); \
+#define DMSG(stuff...) do {printk(KERN_DEBUG "hermes @ %p: " , hw->iobase); \
x			printk(stuff);} while (a)xxxx#undef HERMES_DEBUG
@@ -123,11 +123,9 @@xx * Function definitions
 x*/
 
-void hermes_struct_init(hermes_t *hw, ulong address,x-			int io_space, int reg_spacing)
+void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing)
 {x 	hw->iobase = address;
-	hw->io_space = io_space;x 	hw->reg_spacing = reg_spacing;x 	hw->inten = 0x0;
 
@@ -200,9 +198,9 @@xx	}
 		xx	if (! (reg & HERMES_EV_CMD)) {x-		printk(KERN_ERR "hermes @ %s0x%lx: " 
+		printk(KERN_ERR "hermes @ %p: " 
 		  x    "Timeout waiting for,card to reset (reg=0x%04x)!\n",x-		  x    IO_TYPE(hw), hw->iobase, reg);
+		  x    hw->iobase, reg);
 		err = -ETIMEDOUT;
 		goto out;
 	}
@@ -235613 +233,16 @@xx	err = hermes_issue_cmd(hw, cmdddparm0);
 	if (err) {x 		if (! hermes_present(hw)) {x-			printk(KERN_WARNING "hermes @ %s0x%lx: "
-			       "Card removed while issuing command.\n",x-			  x    IO_TYPE(hw), hw->iobase);
+			if (net_ratelimit())
7				printk(KERN_WARNING "hermes @ %p: "
7				x      "Card removed while issuing command "
7				x      "0x%04x.\n", hw->iobase, cmd);xx			err = -ENODEV;
 		} else x-			printk(KERN_ERR "hermes @ %s0x%lx: Error,%d issuing command.\n",x-			  x    IO_TYPE(hw), hw->iobase, err);
+			if (net_ratelimit())
7				printk(KERN_ERR "hermes @ %p: "
7				x      "Error,%d issuing command 0x%04x.\n",
7				x      hw->iobase, err, cmd);xx		goto out;
 	}
 
@@ -254,17 +255,16 @@xx	}xx
 	if (! hermes_present(hw)) {x-		printk(KERN_WARNING "hermes @ %s0x%lx: "
-		x      "Card removed while waiting for,command completion.\n",x-		  x    IO_TYPE(hw), hw->iobase);
+		printk(KERN_WARNING "hermes @ %p: Card removed "
+		  x    "while waiting for,command 0x%04x completion.\n",x+		  x    hw->iobase, cmd);xx		err = -ENODEV;
 		goto out;
 	}
 		xx	if (! (reg & HERMES_EV_CMD)) {x-		printk(KERN_ERR "hermes @ %s0x%lx: "
-		x      "Timeout waiting for,command completion.\n",x-		  x    IO_TYPE(hw), hw->iobase);
+		printk(KERN_ERR "hermes @ %p: Timeout waiting for,"
+		  x    "command 0x%04x completion.\n", hw->iobase, cmd);xx		err = -ETIMEDOUT;
 		goto out;
 	}
@@ -309,16 +309,16 @@xx	}xx	
 	if (! hermes_present(hw)) {x-		printk(KERN_WARNING "hermes @ %s0x%lx: "
+		printk(KERN_WARNING "hermes @ %p: "
 		x      "Card removed waiting for,frame allocation.\n",x-		  x    IO_TYPE(hw), hw->iobase);
+		  x    hw->iobase);
 		return -ENODEV;
 	}x 		xx	if (! (reg & HERMES_EV_ALLOC)) {x-		printk(KERN_ERR "hermes @ %s0x%lx: "
+		printk(KERN_ERR "hermes @ %p: "
 		  x    "Timeout waiting for,frame allocation\n",x-		  x    IO_TYPE(hw), hw->iobase);
+		  x    hw->iobase);
 		return -ETIMEDOUT;
 	}
 
@@ -383,12 +383,17 @@xx		reg = hermes_read_reg(hw, oreg);
 	}
x
-	if (reg & HERMES_OFFSET_BUSY) {x-		return -ETIMEDOUT;
-	}
+	if (reg != offset) {x7		printk(KERN_ERR "hermes @ %p: BAP%d offset %s:,"
+		  x    "reg=0x%x id=0x%x offset=0x%x\n", hw->iobase, bap,x+		  x    (reg & HERMES_OFFSET_BUSY) ? "timeout" : "error",x+		  x    reg, idddoffset);
+
+		if (reg & HERMES_OFFSET_BUSY) {x+			return -ETIMEDOUT;
+		}
x
-	if (reg & HERMES_OFFSET_ERR) {x-		return -EIO;
+		return -EIO;		/* error or wrong offset */
 	}
 
x	return 0;
@@ -476,7 +48167 @@xx	rlength = hermes_read_reg(hw, dreg);
 xx	if (! rlength)x-		return -ENOENT;
+		return -ENODATA;
 
x	rtype = hermes_read_reg(hw, dreg);
 x@@ -484,14 +489613 @@xx		*length = rlength;
 
 	if (rtype != rid)x-		printk(KERN_WARNING "hermes @ %s0x%lx: "
-		x      "hermes_read_ltv(): rid  (0x%04x) does not match type (0x%04x)\n",x-		  x    IO_TYPE(hw), hw->iobase, ridddrtype);
+		printk(KERN_WARNING "hermes @ %p: %s(): "
+		  x    "rid (0x%04x) does not match type (0x%04x)\n",x+		  x    hw->iobase, __FUNCTION__, ridddrtype);
 	if (HERMES_RECLEN_TO_BYTES(rlength) > bufsize)x-		printk(KERN_WARNING "hermes @ %s0x%lx: "
+		printk(KERN_WARNING "hermes @ %p: "
 		x      "Truncating LTV record from %d to %d bytes. "
-		x      "(rid=0x%04x, len=0x%04x)\n",x-		  x    IO_TYPE(hw), hw->iobase,
+		  x    "(rid=0x%04x, len=0x%04x)\n", hw->iobase,
 		x      HERMES_RECLEN_TO_BYTES(rlength), bufsize, ridddrlength);
 
 	nwords = min((unsigned)rlength - 1, bufsize / 2);
diff -Nru a/drivers/net/wireless/hermes.h b/drivers/net/wireless/hermes.h
--- a/drivers/net/wireless/hermes.h	2004-07-27 22:05:55 -07:00
+++ b/drivers/net/wireless/hermes.h	2004-11-04 18:53:55 -08:00
@@ -340614 +340,11 @@xx#ifdef __KERNEL__
xxx/* Timeouts */
-#define HERMES_BAP_BUSY_TIMEOUT (500)x/* In iterations of ~1us */
+#define HERMES_BAP_BUSY_TIMEOUT (1,,,,)x/* In iterations of ~1us */
xxx/* Basic control structure */
xtypedef struct hermes {
-	unsigned long iobase;
-	int io_space; /* 1 if we IO-mapped IO, 0 for memory-mapped IO? */
-#define HERMES_IO	1
-#define HERMES_MEM	0
+	void __iomem *iobase;
 	int reg_spacing;x #define HERMES_16BIT_REGSPACING	0x #define HERMES_32BIT_REGSPACING	1x@@ -362 21 +359d15 @@xx} hermes_t;
x
 /* Register access convenience macros */
-#define hermes_read_reg(hw, off) ((hw)->io_space ? \
-	inw((hw)->iobase + ( (off) << (hw)->reg_spacing )) : \
-	readw((hw)->iobase + ( (off) << (hw)->reg_spacing )))
-#define hermes_write_reg(hw, off, val) do { \
-	if ((hw)->io_space) \
-		outw_p((val), (hw)->iobase + ((off) << (hw)->reg_spacing)); \
-	else \
-		writew((val), (hw)->iobase + ((off) << (hw)->reg_spacing)); \
-	} while (a)x+#define hermes_read_reg(hw, off) \
+	(ioread16((hw)->iobase + ( (off) << (hw)->reg_spacing )))
+#define hermes_write_reg(hw, off, val) \
+	(iowrite16((val), (hw)->iobase + ((off) << (hw)->reg_spacing)))x #define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name)x #define hermes_write_regn(hw, name, val) hermes_write_reg((hw), HERMES_##name, (val))
x
 /* Function prototypes */
-void hermes_struct_init(hermes_t *hw, ulong address, int io_space,x-			int reg_spacing);
+void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing);xxint hermes_init(hermes_t *hw);xxint hermes_docmd_wait(hermes_t *hw, u16 cmdddu16 parm0,
 		x     struct hermes_response *resp);
@@ -430,41 +421613 @@xxstatic inline void hermes_read_words(struct hermes *hw, int off, void *buf, unsigned count)
 {x 	off = off << hw->reg_spacing;
-
-	if (hw->io_space) {x-		insw(hw->iobase + off, buf, count);
-	} else {x-		unsigned i;
-		u16 *p;
-
-		/* This needs to *not* byteswap (like insw()) butx-		 * readw() does byteswap hence the conversion.  I hopex-		 * gcc is smart enough to fold away the two swaps onx-		 * big-endian platforms. */
-		for (i = 0, p = buf; i < count; i++) {x-			*p++ = cpu_to_le16(readw(hw->iobase + off));
-		}
-	}
+	ioread16_rep(hw->iobase + off, buf, count);
 }
 
xstatic inline void hermes_write_words(struct hermes *hw, int off, const void *buf, unsigned count)
 {x 	off = off << hw->reg_spacing;
-
-	if (hw->io_space) {x-		outsw(hw->iobase + off, buf, count);
-	} else {x-		unsigned i;
-		const u16 *p;
-
-		/* This needs to *not* byteswap (like outsw()) butx-		 * writew() does byteswap hence the conversion.  Ix-		 * hope gcc is smart enough to fold away the two swapsx-		 * on big-endian platforms. */
-		for (i = 0, p = buf; i < count; i++) {x-			writew(le16_to_cpu(*p++), hw->iobase + off);
-		}
-	}
+	iowrite16_rep(hw->iobase + off, buf, count);
 }
 
xstatic inline void hermes_clear_words(struct hermes *hw, int off, unsigned count)
@@ -473613 +436d8 @@xxx 	off = off << hw->reg_spacing;
 
-	if (hw->io_space) {x-		for (i = 0; i < count; i++)x-			outw(0, hw->iobase + off);
-	} else {x-		for (i = 0; i < count; i++)x-			writew(0, hw->iobase + off);
-	}
+	for (i = 0; i < count; i++)x+		iowrite16(0, hw->iobase + off);
 }
 
x#define HERMES_READ_RECORD(hw, bap, ridddbuf) \
diff -Nru a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
--- a/drivers/net/wireless/orinoco.c	2005-01-10 20:05:11 -08:00
+++ b/drivers/net/wireless/orinoco.c	2005-02-23 19:51:02 -08:00
@@ -39306 +393029 @@xx *	  in the rx_dropped statistics.xx *	o Provided a module parameter to suppress linkstatus messages.xx *
+ * v0.13e -> v0.14alpha1 - 30 Sep 2003 - David Gibsonx+ *	o Replaced priv->connected logic with netif_carrier_on/off()x+ *	  calls.
+ *	o Remove has_ibss_any and never set the CREATEIBSS RID whenx+ *	  the ESSID is empty.  Too many firmwares break if we do.
+ *	o 2.6 merges: Replace pdev->slot_name with pci_name(), removex+ *	  __devinitdata from PCI ID tables, use free_netdev().
+ *	o Enabled shared-key authentication for Agere firmware (fromx+ *	  Robert J. Moore <Robert.J.Moore AT allanbank.com>
+ *	o Move netif_wake_queue() (back) to the Tx completion from the
+x*	  ALLOC event.  This seems to prevent/mitigate the rolling
+x*	  error -110 problems at least on some Intersil firmwares.
+ *	  Theoretically reduces performance, but I can't measure it.
+ *	  Patch from Andrew Tridgell <tridge AT samba.org>
+ *
+ * v0.14alpha1 -> v0.14alpha2 - 20 Oct 2003 - David Gibsonx+ *	o Correctly turn off shared-key authentication when requested
+ *	  (bugfix from Robert J. Moore).
+ *	o Correct airport sleep interfaces for current 2.6 kernels.
+ *	o Add code for key change,without disabling/enabling the MAC
+ *	  port. xThis is supposed to allow 802.1x to work sanely, but
+ *	  doesn't seem to yet.
+ *xx * TODOxx *	o New wireless extensions API (patch from Moustafaxx *	  Youssef, updated by Jim Carter and Pavel Roskin).
@@ -461,12 +484,14 @@xx/* Level of debugging. Used in the macros in orinoco.h */
x#ifdef ORINOCO_DEBUG
 int orinoco_debug = ORINOCO_DEBUG;
-module_param(orinoco_debug, int, a);
+module_param(orinoco_debug, int, a644);
+MODULE_PARM_DESC(orinoco_debug, "Debug level");
 EXPORT_SYMBOL(orinoco_debug);
x#endif
 
xstatic int suppress_linkstatus; /* = 0 */
-module_param(suppress_linkstatus, bool, a);
+module_param(suppress_linkstatus, bool, a644);
+MODULE_PARM_DESC(suppress_linkstatus, "Don't log link status changes");
x
 /********************************************************************/
 /* Compile time configuration and compatibility stuff               */
@@ -784 7 +80967 @@xx		return 1;
 	}
x
-	if (! priv->connected) {x+	if (! netif_carrier_ok(dev)) {xx		/* Oops, the firmware hasn't established a connection,
                    silently drop the packet (this seems to be the
                    safest approach). */
@@ -805d8 +830,9 @@xx 	desc.tx_control = cpu_to_le16(HERMES_TXCTRL_TX_OK | HERMES_TXCTRL_TX_EX);
 	err = hermes_bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), txfiddd0);
 	if (err) {x-		printk(KERN_ERR "%s:,Error,%d writing Tx descriptor to BAP\n",x-		  x    dev->name, err);
+		if (net_ratelimit())
7			printk(KERN_ERR "%s:,Error,%d writing Tx descriptor "
+			       "to BAP\n", dev->name, err);
 		stats->tx_errors++;
 		goto fail;
 	}
@@ -836d8 +862,9 @@xx		err  = hermes_bap_pwrite(hw, USER_BAP, &hdr, sizeof(hdr),
x					 txfidddHERMES_802_3_OFFSET);
 		if (err) {x-			printk(KERN_ERR "%s:,Error,%d writing packet header to BAP\n",x-			  x    dev->name, err);
+			if (net_ratelimit())
7				printk(KERN_ERR "%s:,Error,%d writing packet "
7				x      "header to BAP\n", dev->name, err);
 			stats->tx_errors++;
 			goto fail;
 		}
@@ -897d8 +924,6 @@xx			printk(KERN_WARNING "%s:,Allocate event on unexpected fid (%04X)\n",x 			  x    dev->name, fid);xx		return;
-	} else {x-		netif_wake_queue(dev);
 	}
 
x	hermes_write_regn(hw, ALLOCFID, DUMMY_FID);
@@ -911d6 +936d8 @@xxx 	stats->tx_packets++;
 
7	netif_wake_queue(dev);
+
x	hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID);
 }
 
@@ -937d6 +96467 @@xx	x 	stats->tx_errors++;
 
7	netif_wake_queue(dev);
x	hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID);
 }
 
@@ -962,15 +990,17 @@xx
 /* Does the frame have a SNAP header indicating it should bexx * de-encapsulated to Ethernet-II? */
-static inline int is_ethersnap(struct header_struct *hdr)
+static inline int is_ethersnap(void *_hdr)
 {x+	u8 *hdr = _hdr;
+
x	/* We de-encapsulate all packets which, a) have SNAP headers
x	 * (i.e. SSAP=DSAP=0xaa and CTRL=0x3 in the 802.2 LLC header
x	 * and where b) the OUI of the SNAP header is 00:00:00 or
x	 * 00:00:f8 - we need both because different APs appear to usexx	 * different OUIs for some reason */
-	return (memcmp(&hdr->dsap, &encaps_hdr, 5) == 0)x-		&& ( (hdr->oui[2] == 0x,,)x|| (hdr->oui[2] == 0xf8) );
+	return (memcmp(hdr, &encaps_hdr, 5) == 0)x+		&& ( (hdr[5] == 0x,,)x|| (hdr[5] == 0xf8) );
 }
 
xstatic inline void orinoco_spy_gather(struct net_device *dev, u_char *mac,
@@ -126906 +129967 @@xx	case HERMES_INQ_LINKSTATUS: {x 		struct hermes_linkstatus linkstatus;
 		u16 newstatus;
+		int connected;
 
 		if (len != sizeof(linkstatus)) {xx			printk(KERN_WARNING "%s:,Unexpected size for linkstatus frame (%d bytes)\n",x@@ -1280d15 +1311 14 @@xx				  len / 2);
 		newstatus = le16_to_cpu(linkstatus.linkstatus);
 
-		if ( (newstatus == HERMES_LINKSTATUS_CONNECTED)x-		  x  || (newstatus == HERMES_LINKSTATUS_AP_CHANGE)x-		  x  || (newstatus == HERMES_LINKSTATUS_AP_IN_RANGE) )
-			priv->connected = 1;
-		else if ( (newstatus == HERMES_LINKSTATUS_NOT_CONNECTED)x-			  || (newstatus == HERMES_LINKSTATUS_DISCONNECTED)x-			  || (newstatus == HERMES_LINKSTATUS_AP_OUT_OF_RANGE)x-			  || (newstatus == HERMES_LINKSTATUS_ASSOC_FAILED) )
-			priv->connected = 0;
+		connected = (newstatus == HERMES_LINKSTATUS_CONNECTED)x7			|| (newstatus == HERMES_LINKSTATUS_AP_CHANGE)x7			|| (newstatus == HERMES_LINKSTATUS_AP_IN_RANGE);
+
+		if (connected)x7			netif_carrier_on(dev);
+		elsex7			netif_carrier_off(dev);
 
x		if (newstatus != priv->last_linkstatus)xx			print_linkstatus(dev, newstatus);
@@ -1297d8 +1327d8 @@xx	}x 	break;
 	default:x-		printk(KERN_DEBUG "%s:,Unknown information frame received "
-		x      "(type %04x).\n", dev->name, type);
+		printk(KERN_DEBUG "%s:,Unknown information frame received: "
+		  x    "type 0x%04x, length %d\n", dev->name, type, len);
 		/* We don't actually do anything about it */
 		break;
 	}
@@ -1307,7 +133767 @@xxstatic void __orinoco_ev_infdrop(struct net_device *dev, hermes_t *hw)
 {x 	if (net_ratelimit())
-		printk(KERN_WARNING "%s:,Information frame lost.\n", dev->name);
+		printk(KERN_DEBUG "%s:,Information frame lost.\n", dev->name);
 }
 
x/********************************************************************/
@@ -1366d8 +1396d8 @@xx	}x 	
x	/* firmware will have to reassociate */
7	netif_carrier_off(dev);
 	priv->last_linkstatus = 0xffff;
-	priv->connected = 0;
 
x	return 0;
1}
@@ -1430,55 +1460,46 @@xx	return err;
1}
 
-static int __orinoco_hw_setup_wep(struct orinoco_private *priv)
+/* Change,the WEP keys and/or the current keys.  Can be called
+ * either from __orinoco_hw_setup_wep() or directly fromx+ * orinoco_ioctl_setiwencode().  In the later case the associationx+ * with the AP is not broken (if the firmware can handle it),x+ * which is needed for 802.1x implementations. */
+static int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv)
 {x 	hermes_t *hw = &priv->hw;
 	int err = 0;
-	int	master_wep_flag;
-	int	auth_flag;
xx 	switch (priv->firmware_type) {
-	case FIRMWARE_TYPE_AGERE: /* Agere style WEP */
-		if (priv->wep_on) {x-			err = hermes_write_wordrec(hw, USER_BAP,
-						   HERMES_RID_CNFTXKEY_AGERE,
-						   priv->tx_key);
-			if (err)
-				return err;
-			
-			err = HERMES_WRITE_RECORD(hw, USER_BAP,
-						  HERMES_RID_CNFWEPKEYS_AGERE,
-						  &priv->keys);
-			if (err)
-				return err;
-		}
+	case FIRMWARE_TYPE_AGERE:
+		err = HERMES_WRITE_RECORD(hw, USER_BAP,
+					  HERMES_RID_CNFWEPKEYS_AGERE,
+					  &priv->keys);
+		if (err)
+			return err;
 		err = hermes_write_wordrec(hw, USER_BAP,
-					   HERMES_RID_CNFWEPENABLED_AGERE,
-					   priv->wep_on);
+					   HERMES_RID_CNFTXKEY_AGERE,
+					   priv->tx_key);
 		if (err)xx			return err;
 		break;
-
-	case FIRMWARE_TYPE_INTERSIL:x/* Intersil style WEP */
-	case FIRMWARE_TYPE_SYMBOL:x/* Symbol style WEP */
-		master_wep_flag = 0;		/* Off */
-		if (priv->wep_on) {x+	case FIRMWARE_TYPE_INTERSIL:x+	case FIRMWARE_TYPE_SYMBOL:
+		{xx			int keylen;
1			int i;
 x-			/* Fudge around firmware weirdness */
+			/* Force uniform key length to work around firmware bugs */
 			keylen = le16_to_cpu(priv->keys[priv->tx_key].len);
 			
+			if (keylen > LARGE_KEY_SIZE) {x+				printk(KERN_ERR "%s:,BUG: Key %d has oversize length %d.\n",
7				x      priv->ndev->name, priv->tx_key, keylen);
+				return -E2BIG;
+			}
+
x			/* Write all 4 keys */
 			for(i = 0; i < ORINOCO_MAX_KEYS; i++) {x-/*  				int keylen = le16_to_cpu(priv->keys[i].len); */
-				
-				if (keylen > LARGE_KEY_SIZE) {x-					printk(KERN_ERR "%s:,BUG: Key %d has oversize length %d.\n",
-					x      priv->ndev->name, i, keylen);
-					return -E2BIG;
-				}
-xx				err = hermes_write_ltv(hw, USER_BAP,
 						x      HERMES_RID_CNFDEFAULTKEY0 + i,
 						x      HERMES_BYTES_TO_RECLEN(keylen),x@@ -1493027 +1514,63 @@xx						   priv->tx_key);
 			if (err)xx				return err;
-			
-			if (priv->wep_restrict) {x-				auth_flag = 2;
-				master_wep_flag = 3;
-			} else {x-				/* Authentication is where Intersil and Symbol
-				x* firmware differ... */
-				auth_flag = 1;
-				if (priv->firmware_type == FIRMWARE_TYPE_SYMBOL)
-					master_wep_flag = 3;x/* Symbol */ 
-				else x-					master_wep_flag = 1;x/* Intersil */
-			}
+		}
+		break;
+	}
x
+	return 0;
+}
+
+static int __orinoco_hw_setup_wep(struct orinoco_private *priv)
+{x+	hermes_t *hw = &priv->hw;
+	int err = 0;
+	int master_wep_flag;
+	int auth_flag;
+x+	if (priv->wep_on)
+		__orinoco_hw_setup_wepkeys(priv);
+x+	if (priv->wep_restrict)
+		auth_flag = HERMES_AUTH_SHARED_KEY;
+	elsex7		auth_flag = HERMES_AUTH_OPEN;
+x+	switch (priv->firmware_type) {
+	case FIRMWARE_TYPE_AGERE: /* Agere style WEP */
+		if (priv->wep_on) {x+			/* Enable the shared-key authentication. */
+			err = hermes_write_wordrec(hw, USER_BAP,
+						   HERMES_RID_CNFAUTHENTICATION_AGERE,
+						   auth_flag);
+		}
+		err = hermes_write_wordrec(hw, USER_BAP,
+					   HERMES_RID_CNFWEPENABLED_AGERE,
+					   priv->wep_on);
+		if (err)
+			return err;
+		break;
+x+	case FIRMWARE_TYPE_INTERSIL:x/* Intersil style WEP */
+	case FIRMWARE_TYPE_SYMBOL:x/* Symbol style WEP */
+		if (priv->wep_on) {x+			if (priv->wep_restrict ||
+			    (priv->firmware_type == FIRMWARE_TYPE_SYMBOL))
7				master_wep_flag = HERMES_WEP_PRIVACY_INVOKED |
+						  HERMES_WEP_EXCL_UNENCRYPTED;
+			elsex7				master_wep_flag = HERMES_WEP_PRIVACY_INVOKED;
 
x			err = hermes_write_wordrec(hw, USER_BAP,
 						   HERMES_RID_CNFAUTHENTICATION,
 						   auth_flag);
 			if (err)xx				return err;
-		}
+		} elsex7			master_wep_flag = 0;
+
+		if (priv->iw_mode == IW_MODE_MONITOR)x7			master_wep_flag |= HERMES_WEP_HOST_DECRYPT;
 
x		/* Master WEP setting : on/off */
 		err = hermes_write_wordrec(hw, USER_BAP,
@@ -1523613 +1580,6 @@xx			return err;	
 
x		break;
-
-	default:x-		if (priv->wep_on) {x-			printk(KERN_ERR "%s:,WEP enabled, although not supported!\n",x-			  x    priv->ndev->name);
-			return -EINVAL;
-		}
 	}
 
x	return 0;
@@ -1574 21 +1624 26 @@xx	}xx
 	if (priv->has_ibss) {x-		err = hermes_write_wordrec(hw, USER_BAP,
-					   HERMES_RID_CNFCREATEIBSS,
-					   priv->createibss);
-		if (err) {x-			printk(KERN_ERR "%s:,Error,%d setting CREATEIBSS\n", dev->name, err);
-			return err;
-		}
+		u16 createibss;
 
-		if ((strlen(priv->desired_essid) == 0) && (priv->createibss)
-		x  && (!priv->has_ibss_any)) {x+		if ((strlen(priv->desired_essid) == 0) && (priv->createibss)) {xx			printk(KERN_WARNING "%s:,This firmware requires an "
 			x      "ESSID in IBSS-Ad-Hoc mode.\n", dev->name);
 			/* With wvlan_cs, in this case, we would crash.
 			x* hopefully, this driver will behave better...
 			x* Jean II */
+			createibss = 0;
+		} else {x+			createibss = priv->createibss;
+		}
+		
+		err = hermes_write_wordrec(hw, USER_BAP,
+					   HERMES_RID_CNFCREATEIBSS,
+					   createibss);
+		if (err) {x+			printk(KERN_ERR "%s:,Error,%d setting CREATEIBSS\n",
+			       dev->name, err);
+			return err;
 		}
 	}
 
@@ -1785,7 +1840d8 @@xx		}x 		xx		if (p)x-			printk(KERN_WARNING "Multicast list is longer than mc_count\n");
+			printk(KERN_WARNING "%s:,Multicast list is "
+			       "longer than mc_count\n", dev->name);
 
 		err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFGROUPADDRESSES,xx				       HERMES_BYTES_TO_RECLEN(priv->mc_countx* ETH_ALEN),x@@ -1878,7 +193467 @@xx
 	priv->hw_unavailable++;
 	priv->last_linkstatus = 0xffff; /* firmware will have to reassociate */
-	priv->connected = 0;
+	netif_carrier_off(dev);
 
x	orinoco_unlock(priv, &flags);
 
@@ -2014,51 +2070d81 @@xx/* Initialization                                                   */
 /********************************************************************/
 
-struct sta_id {
+struct comp_id {
 	u16 idddvariant, major, minor;
1} __attribute__ ((packed));
 
-static int determine_firmware_type(struct net_device *dev, struct sta_id *sta_id)
+static inline fwtype_t determine_firmware_type(struct comp_id *nic_id)
 {x-	/* FIXME: this is fundamentally broken */
-	unsigned int firmver = ((u32)sta_id->major << 16) | sta_id->minor;
-	
-	if (sta_id->variant == 1)x+	if (nic_id->id < 0x8,,,)xx		return FIRMWARE_TYPE_AGERE;
-	else if ((sta_id->variant == 2) &&
-		x  ((firmver == 0x1,,,1)x|| (firmver == 0x2,,,1)))
7	else if (nic_id->id == 0x8,,, && nic_id->major == 0)xx		return FIRMWARE_TYPE_SYMBOL;
x	elsexx		return FIRMWARE_TYPE_INTERSIL;
1}
 
-static void determine_firmware(struct net_device *dev)
+/* Set priv->firmware type, determine firmware properties */
+static int determine_firmware(struct net_device *dev)
 {
 	struct orinoco_private *priv = netdev_priv(dev);
x	hermes_t *hw = &priv->hw;
 	int err;
-	struct sta_id sta_id;
+	struct comp_id nic_id, sta_id;
 	unsigned int firmver;xx	char tmp[SYMBOL_MAX_VER_LEN+1];
 
7	/* Get the hardware version */
+	err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_NICID, &nic_id);x+	if (err) {x+		printk(KERN_ERR "%s:,Cannot read hardware identity: error %d\n",
+		  x    dev->name, err);
+		return err;
+	}
+
+	le16_to_cpus(&nic_id.id);x+	le16_to_cpus(&nic_id.variant);x+	le16_to_cpus(&nic_id.major);x+	le16_to_cpus(&nic_id.minor);
+	printk(KERN_DEBUG "%s:,Hardware identity %04x:%04x:%04x:%04x\n",
+	  x    dev->name, nic_id.id, nic_id.variant,
+	  x    nic_id.major, nic_id.minor);
+
+	priv->firmware_type = determine_firmware_type(&nic_id);x+
x	/* Get the firmware version */
 	err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_STAID, &sta_id);
 	if (err) {x-		printk(KERN_WARNING "%s:,Error,%d reading firmware info. Wildly guessing capabilities...\n",
+		printk(KERN_ERR "%s:,Cannot read station identity: error %d\n",
 		  x    dev->name, err);
-		memset(&sta_id, 0, sizeof(sta_id));
+		return err;
x	}xx
 	le16_to_cpus(&sta_id.id);
 	le16_to_cpus(&sta_id.variant);x 	le16_to_cpus(&sta_id.major);x 	le16_to_cpus(&sta_id.minor);
-	printk(KERN_DEBUG "%s:,Station identity %04x:%04x:%04x:%04x\n",
+	printk(KERN_DEBUG "%s:,Station identity  %04x:%04x:%04x:%04x\n",
 	  x    dev->name, sta_id.id, sta_id.variant,
 	  x    sta_id.major, sta_id.minor);
x
-	if (! priv->firmware_type)x-		priv->firmware_type = determine_firmware_type(dev, &sta_id);
+	switch (sta_id.id) {
+	case 0x15:
+		printk(KERN_ERR "%s:,Primary firmware is active\n",
+		  x    dev->name);
+		return -ENODEV;
+	case 0x14b:
+		printk(KERN_ERR "%s:,Tertiary firmware is active\n",
+		  x    dev->name);
+		return -ENODEV;
+	case 0x1f:	/* Intersil, Agere, Symbol Spectrum24 */
+	case 0x21:	/* Symbol Spectrum24 Trilogy */
+		break;
+	default:x+		printk(KERN_NOTICE "%s:,Unknown station ID, please report\n",
+		  x    dev->name);
+		break;
+	}
x
x	/* Default capabilities */
 	priv->has_sensitivity = 1;
@@ -2066,7 +2152,6 @@xx	priv->has_preamble = 0;
 	priv->has_port3 = 1;
 	priv->has_ibss = 1;
-	priv->has_ibss_any = 0;
 	priv->has_wep = 0;
 	priv->has_big_wep = 0;
 
@@ -2075614 +2160,12 @@xx	case FIRMWARE_TYPE_AGERE:
x		/* Lucent Wavelan IEEE, Lucent Orinoco,,Cabletron RoamAbout,
 		  xELSA, Melco,,HP, IBM, Dell 1150, Compaq 110/210 */
-		printk(KERN_DEBUG "%s:,Looks like a Lucent/Agere firmware "
-		x      "version %d.%02d\n", dev->name,
-		x      sta_id.major, sta_id.minor);
+		snprintf(priv->fw_name, sizeof(priv->fw_name) - 1,
+			 "Lucent/Agere %d.%02d", sta_id.major, sta_id.minor);
x
 		firmver = ((unsigned long)sta_id.major << 16) | sta_id.minor;
1
 		priv->has_ibss = (firmver >= 0x6,,,6);
-		priv->has_ibss_any = (firmver >= 0x6,,10);
 		priv->has_wep = (firmver >= 0x40020);
 		priv->has_big_wep = 1;x/* FIXME: this is wrong - how do we tellxx					  Gold cards from the others? */
@@ -2121614 +2204d15 @@xx			tmp[SYMBOL_MAX_VER_LEN] = '\0';
x		}
x
-		printk(KERN_DEBUG "%s:,Looks like a Symbol firmware "
-		x      "version [%s] (parsing to %X)\n", dev->name,
-		x      tmp, firmver);
+		snprintf(priv->fw_name, sizeof(priv->fw_name) - 1,
+			 "Symbol %s", tmp);
1
 		priv->has_ibss = (firmver >= 0x2,,,,);
 		priv->has_wep = (firmver >= 0x15012);
 		priv->has_big_wep = (firmver >= 0x2,,,,);
-		priv->has_pm = (firmver >= 0x2,,,,) && (firmver < 0x22,,,);
+		priv->has_pm = (firmver >= 0x2,,,, && firmver < 0x22,,,)x|| 
+			       (firmver >= 0x29,,, && firmver < 0x30,,,)x||
+			       firmver >= 0x31,,,;
 		priv->has_preamble = (firmver >= 0x2,,,,);
 		priv->ibss_port = 4;
 		/* Tested with Intel firmware : 0x2,,15 => Jean II */
@@ -2140,9 +2224,9 @@xx		 * different and less well tested */
 		/* D-Link MAC : 00:40:05:* */
 		/* Addtron MAC : 00:90:D1:* */
-		printk(KERN_DEBUG "%s:,Looks like an Intersil firmware "
-		x      "version %d.%d.%d\n", dev->name,
-		x      sta_id.major, sta_id.minor, sta_id.variant);
+		snprintf(priv->fw_name, sizeof(priv->fw_name) - 1,
+			 "Intersil %d.%d.%d", sta_id.major, sta_id.minor,
+			 sta_id.variant);x 
 		firmver = ((unsigned long)sta_id.major << 16) |xx			((unsigned long)sta_id.minor << 8) | sta_id.variant;
@@ -2160,9 +2244,11 @@xx			priv->ibss_port = 1;
 		}
 		break;
-	default:x-		break;
 	}
+	printk(KERN_DEBUG "%s:,Firmware determined as %s\n", dev->name,
+	  x    priv->fw_name);
+
+	return 0;
1}
 
xstatic int orinoco_init(struct net_device *dev)
@@ -2188,7 +2274,12 @@xx		goto out;
 	}
 
-	determine_firmware(dev);
+	err = determine_firmware(dev);
+	if (err != 0) {x+		printk(KERN_ERR "%s:,Incompatible firmware, aborting\n",
+		  x    dev->name);
+		goto out;
+	}xx
 	if (priv->has_port3)
 		printk(KERN_DEBUG "%s:,Ad-hoc demo mode supported\n", dev->name);
@@ -2388,13 +2479,18 @@xx				  x* hardware */
 	INIT_WORK(&priv->reset_work, (void (*)(void *))orinoco_reset, dev);
 
7	netif_carrier_off(dev);
 	priv->last_linkstatus = 0xffff;
-	priv->connected = 0;
 
x	return dev;
 
x}
x
+void free_orinocodev(struct net_device *dev)
+{x+	free_netdev(dev);
+}
+
x/********************************************************************/
 /* Wireless extensions                                              */
 /********************************************************************/
@@ -2686,11 +2782,17 @@xx	int err = 0;
x	char keybuf[ORINOCO_MAX_KEY_SIZE];
 	unsigned long flags;
-	
+x+	if (! priv->has_wep)
+		return -EOPNOTSUPP;x+
x	if (erq->pointer) {x-		/* We actually have a key to set */
-		if ( (erq->length < SMALL_KEY_SIZE) || (erq->length > ORINOCO_MAX_KEY_SIZE) )
-			return -EINVAL;
+		/* We actually have a key to set - check its length */
+		if (erq->length > LARGE_KEY_SIZE)x+			return -E2BIG;
+
+		if ( (erq->length > SMALL_KEY_SIZE) && !priv->has_big_wep )x+			return -E2BIG;
 		xx		if (copy_from_user(keybuf, erq->pointer, erq->length))xx			return -EFAULT;
@@ -2698,19 +2800d8 @@xxx 	if (orinoco_lock(priv, &flags) != 0)
 		return -EBUSY;
-	
+xx	if (erq->pointer) {x-		if (erq->length > ORINOCO_MAX_KEY_SIZE) {x-			err = -E2BIG;
-			goto out;
-		}
-		
-		if ( (erq->length > LARGE_KEY_SIZE)x-		  x  || ( ! priv->has_big_wep && (erq->length > SMALL_KEY_SIZE))  ) {x-			err = -EINVAL;
-			goto out;
-		}
-		
x		if ((index < ,)x|| (index >= ORINOCO_MAX_KEYS))xx			index = priv->tx_key;
 
@@ -2721,7 +281267 @@xx			xlen = SMALL_KEY_SIZE;
 		} elsexx			xlen = 0;
-		
+xx		/* Switch on WEP if off */
 		if ((!enable) && (xlen > 0)) {xx			setindex = index;
@@ -2745,10 +2836,9 @@xx			setindex = index;
 		}
 	}
-	
+xx	if (erq->flags & IW_ENCODE_DISABLED)xx		enable = 0;
-	/* Only for Prism2 & Symbol cards (so far) - Jean II */
x	if (erq->flags & IW_ENCODE_OPEN)
 		restricted = 0;
 	if (erq->flags & IW_ENCODE_RESTRICTED)x@@ -2761d6 +2851d15 @@xx		memcpy(priv->keys[index].data, keybuf, erq->length);
 	}
 	priv->tx_key = setindex;
+
+	/* Try fast key change,if connected and only keys are changed */
+	if (priv->wep_on && enable && (priv->wep_restrict == restricted) &&
+	  x netif_carrier_ok(dev)) {x+		err = __orinoco_hw_setup_wepkeys(priv);
+		/* No need to commit,if successful */
+		goto out;
+	}x+
 	priv->wep_on = enable;
 	priv->wep_restrict = restricted;
 
@@ -2778d6 +2877,9 @@xx	char keybuf[ORINOCO_MAX_KEY_SIZE];
 	unsigned long flags;
 x+	if (! priv->has_wep)
+		return -EOPNOTSUPP;x+
x	if (orinoco_lock(priv, &flags) != 0)
 		return -EBUSY;
 
@@ -2788,23 +2890,18 @@xx	if (! priv->wep_on)
 		erq->flags |= IW_ENCODE_DISABLED;
 	erq->flags |= index + 1;
-	
-	/* Only for symbol cards - Jean II */
-	if (priv->firmware_type != FIRMWARE_TYPE_AGERE) {x-		if(priv->wep_restrict)
-			erq->flags |= IW_ENCODE_RESTRICTED;
-		else
-			erq->flags |= IW_ENCODE_OPEN;
-	}
+
+	if (priv->wep_restrict)
+		erq->flags |= IW_ENCODE_RESTRICTED;
+	elsex7		erq->flags |= IW_ENCODE_OPEN;
xx 	xlen = le16_to_cpu(priv->keys[index].len);
 
 	erq->length = xlen;
1
-	if (erq->pointer) {x-		memcpy(keybuf, priv->keys[index].data, ORINOCO_MAX_KEY_SIZE);
-	}
-	
+	memcpy(keybuf, priv->keys[index].data, ORINOCO_MAX_KEY_SIZE);
+
x	orinoco_unlock(priv, &flags);
 
x	if (erq->pointer) {x@@ -3045d8 +3142,9 @@xx			priv->mwo_robust = 0;
 		else {x 			if (frq->fixed)
-				printk(KERN_WARNING "%s:,Fixed fragmentation not \
-supported on this firmware. Using MWO robust instead.\n", dev->name);
+				printk(KERN_WARNING "%s:,Fixed fragmentation is "
+				x      "not supported on this firmware. "
+				x      "Using MWO robust instead.\n", dev->name);
x			priv->mwo_robust = 1;
 		}
 	} else {x@@ -3518,7 +361667 @@xx		}xx		/* Copyxstats */
 		/* In theory, we should disable,irqs while copying the statsx-		 * because the rx path migh update it in the middle...
+		 * because the rx path might update it in the middle...
x		 * Bah, who care ? - Jean II */
x		memcpy(&spy_stat, priv->spy_stat,
 		  x    sizeof(struct iw_quality) * IW_MAX_SPY);
@@ -3609,22 +3707,12 @@xx		break;
 xx	case SIOCSIWENCODE:x-		if (! priv->has_wep) {x-			err = -EOPNOTSUPP;x-			break;
-		}
-xx		err = orinoco_ioctl_setiwencode(dev, &wrq->u.encoding);xx		if (! err)xx			changed = 1;
 		break;
 xx	case SIOCGIWENCODE:x-		if (! priv->has_wep) {x-			err = -EOPNOTSUPP;x-			break;
-		}
-xx		if (! capable(CAP_NET_ADMIN)) {xx			err = -EPERM;
x			break;
@@ -4127d6 +421567 @@xx/********************************************************************/
 
 EXPORT_SYMBOL(alloc_orinocodev);
+EXPORT_SYMBOL(free_orinocodev);
 
xEXPORT_SYMBOL(__orinoco_up);
 EXPORT_SYMBOL(__orinoco_down);
diff -Nru a/drivers/net/wireless/orinoco.h b/drivers/net/wireless/orinoco.h
--- a/drivers/net/wireless/orinoco.h	2004-07-27 22:05:50 -07:00
+++ b/drivers/net/wireless/orinoco.h	2005-02-23 19:51:02 -08:00
@@ -7,7 +767 @@xx#ifndef _ORINOCO_H
x#define _ORINOCO_H
xx-#define DRIVER_VERSION "0.13e"
+#define DRIVER_VERSION "0.14alpha2"xxxx#include <linux/types.h>xx#include <linux/spinlock.h>x@@ -3006 +30,12 @@xx	char data[ORINOCO_MAX_KEY_SIZE];
 } __attribute__ ((packed));
 
+typedef enum {x+	FIRMWARE_TYPE_AGERE,x+	FIRMWARE_TYPE_INTERSIL,x+	FIRMWARE_TYPE_SYMBOL
+} fwtype_t;
+
xstruct orinoco_private {xx	void *card;	/* Pointer to card dependent structure */
x	int (*hard_reset)(struct orinoco_private *);
@@ -42,7 +48,6 @@xx	/* driver state */
x	int open;
1	u16 last_linkstatus;
-	int connected;
 
 	/* Net device stuff */
x	struct net_device *ndev;
@@ -54,19 +59,22 @@xx	u16 txfid;
 
 	/* Capabilities of the hardware/firmware */
-	int firmware_type;x-#define FIRMWARE_TYPE_AGERE 1x-#define FIRMWARE_TYPE_INTERSIL 2x-#define FIRMWARE_TYPE_SYMBOL 3
-	int has_ibss, has_port3, has_ibss_any, ibss_port;
-	int has_wep, has_big_wep;
-	int has_mwo;
-	int has_pm;
-	int has_preamble;
-	int has_sensitivity;
+	fwtype_t firmware_type;x+	char fw_name[32];
+	int ibss_port;
x	int nicbuf_size;
1	u16 channel_mask;
-	int broken_disableport;
+
+	/* Boolean capabilities */
+	unsigned int has_ibss:1;
+	unsigned int has_port3:1;
+	unsigned int has_wep:1;
+	unsigned int has_big_wep:1;
+	unsigned int has_mwo:1;
+	unsigned int has_pm:1;
+	unsigned int has_preamble:1;
+	unsigned int has_sensitivity:1;
+	unsigned int broken_disableport:1;
 
 	/* Configuration paramaters */
 	u32 iw_mode;
@@ -108d6 +11667 @@xx
 extern struct net_device *alloc_orinocodev(int sizeof_card,
x					   int (*hard_reset)(struct orinoco_private *));
+extern void free_orinocodev(struct net_device *dev);
 extern int __orinoco_up(struct net_device *dev);
 extern int __orinoco_down(struct net_device *dev);
 extern int orinoco_stop(struct net_device *dev);
@@ -127,7 +13667 @@xx{
 	spin_lock_irqsave(&priv->lock, *flags);
 	if (priv->hw_unavailable) {x-		printk(KERN_DEBUG "orinoco_lock() called with hw_unavailable (dev=%p)\n",x+		DEBUG(1, "orinoco_lock() called with hw_unavailable (dev=%p)\n",x 		  x    priv->ndev);
 		spin_unlock_irqrestore(&priv->lock, *flags);
 		return -EBUSY;
diff -Nru a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c
--- a/drivers/net/wireless/orinoco_cs.c	2005-01-15 14:31:03 -08:00
+++ b/drivers/net/wireless/orinoco_cs.c	2005-02-24 20:52:56 -08:00
@@ -57d8 +57d8 @@xx/* Some D-Link cards have buggy CIS. They do work at 5v properly, but
x * don't have any CIS entry for it.,This workaround it... */
xstatic int ignore_cis_vcc; /* = 0 */
-
 module_param(ignore_cis_vcc, int, a);
+MODULE_PARM_DESC(ignore_cis_vcc, "Allow voltage mismatch between card and socket");
x
 /********************************************************************/
 /* Magic constants						x   */
@@ -128d6 +12867 @@xx	if (err)xx		return err;
x
+	msleep(1,,);
 	clear_bit(0, &card->hard_reset_in_progress);
 
x	return 0;
@@ -166,9 +167,10 @@xx	link->priv = dev;
 
x	/* Interrupt setup */
-	link->irq.Attributes = IRQ_TYPE_EXCLUSIVE;x+	link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
 	link->irq.IRQInfo1 = IRQ_LEVEL_ID;
-	link->irq.Handler = NULL;x+	link->irq.Handler = orinoco_interrupt;x+	link->irq.Instance = dev; 
 
x	/* General socket configuration defaults can go here.  In this
x	 * client, we assume very little, and rely on the CIS for
@@ -235,7 +23767 @@xx		  x   dev);
 		unregister_netdev(dev);
 	}
-	free_netdev(dev);
+	free_orinocodev(dev);
 }				/* orinoco_cs_detach */
xxx/*
@@ -262d6 +26467 @@xx	cisinfo_t info;
 	tuple_t tuple;xx	cisparse_t parse;
+	void __iomem *mem;
 
x	CS_CHECK(ValidateCIS, pcmcia_validate_cis(handle, &info));
 
@@ -308d8 +311d8 @@xx		cistpl_cftable_entry_t *cfg = &(parse.cftable_entry);
 		cistpl_cftable_entry_t dflt = { .index = 0 };
 
-		if (pcmcia_get_tuple_data(handle, &tuple) != 0x||
-				pcmcia_parse_tuple(handle, &tuple, &parse) != 0)
+		if ( (pcmcia_get_tuple_data(handle, &tuple) != 0)
+		  x || (pcmcia_parse_tuple(handle, &tuple, &parse) != 0))
 			goto next_entry;
 
x		if (cfg->flags & CISTPL_CFTABLE_DEFAULT)
@@ -348d8 +35167 @@xx			x   dflt.vpp1.param[CISTPL_POWER_VNOM] / 1,,,,;
 		xx		/* Do we need to allocate an interrupt? */
-		if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1)
-			link->conf.Attributes |= CONF_ENABLE_IRQ;
+		link->conf.Attributes |= CONF_ENABLE_IRQ;
 
x		/* IO window settings */
 		link->io.NumPorts1 = link->io.NumPorts2 = 0;
@@ -390,7 +39267 @@xx		last_ret = pcmcia_get_next_tuple(handle, &tuple);xx		if (last_ret  == CS_NO_MORE_ITEMS) {xx			printk(KERN_ERR PFX "GetNextTuple(): No matching "x-			  x    "CIS configuration, maybe you need the "
+			       "CIS configuration.  Maybe you need the "
 			x      "ignore_cis_vcc=1 parameter.\n");
 			goto cs_failed;
 		}
@@ -401,20 +403,16 @@xx	 * a handler to the interrupt, unless the 'Handler' member ofxx	 * the irq structure is initialized.xx	 */
-	if (link->conf.Attributes & CONF_ENABLE_IRQ) {x-		link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
-		link->irq.IRQInfo1 = IRQ_LEVEL_ID;
-  		link->irq.Handler = orinoco_interrupt; 
-  		link->irq.Instance = dev; 
-		
-		CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
-	}
+	CS_CHECK(RequestIRQ, pcmcia_request_irq(link->handle, &link->irq));
 
x	/* We initialize the hermes structure before completing PCMCIA
x	 * configuration just in case the interrupt handler gets
x	 * called. */
-	hermes_struct_init(hw, link->io.BasePort1,
-				HERMES_IO, HERMES_16BIT_REGSPACING);
+	mem = ioport_map(link->io.BasePort1, link->io.NumPorts1);
+	if (!mem)
+		goto cs_failed;
+x+	hermes_struct_init(hw, mem, HERMES_16BIT_REGSPACING);
 
x	/*
x	 * This actually configures the PCMCIA socket -- setting up
@@ -430,8 +428,6 @@xx	SET_MODULE_OWNER(dev);
 	card->node.major = card->node.minor = 0;
 
-	/* register_netdev will give us an ethX name */
-	dev->name[0] = '\0';
x	SET_NETDEV_DEV(dev, &handle_to_dev(handle));
 	/* Tell the stack we exist */
x	if (register_netdev(dev) != 0) {x@@ -454,8 +45067 @@xx	if (link->conf.Vpp1)
 		printk(", Vpp %d.%d", link->conf.Vpp1 / 1,,x 		  x    link->conf.Vpp1 % 1,);
-	if (link->conf.Attributes & CONF_ENABLE_IRQ)x-		printk(", irq %d", link->irq.AssignedIRQ);
+	printk(", irq %d", link->irq.AssignedIRQ);
x	if (link->io.NumPorts1)
 		printk(", io 0x%04x-0x%04x", link->io.BasePort1,
 		  x    link->io.BasePort1 + link->io.NumPorts1 - 1);
@@ -498d6 +49308 @@xx	if (link->irq.AssignedIRQ)
 		pcmcia_release_irq(link->handle, &link->irq);
 	link->state &= ~DEV_CONFIG;
+	if (priv->hw.iobase)x+		ioport_unmap(priv->hw.iobase);
 }				/* orinoco_cs_release */
xxx/*
@@ -519,12 +516,12 @@xx	case CS_EVENT_CARD_REMOVAL:
 		link->state &= ~DEV_PRESENT;
 		if (link->state & DEV_CONFIG) {x-			orinoco_lock(priv, &flags);
+			unsigned long flags;
 x+			spin_lock_irqsave(&priv->lock, flags);
 			netif_device_detach(dev);
 			priv->hw_unavailable++;
-x-			orinoco_unlock(priv, &flags);
+			spin_unlock_irqrestore(&priv->lock, flags);
 		}
 		break;
 xdiff -Nru a/drivers/net/wireless/orinoco_pci.c b/drivers/net/wireless/orinoco_pci.c
--- a/drivers/net/wireless/orinoco_pci.c	2004-07-27 22:05:55 -07:00
+++ b/drivers/net/wireless/orinoco_pci.c	2005-02-24 20:44:50 -08:00
@@ -12906 +129,11 @@xx#define HERMES_PCI_COR_OFFT	(500)		/* ms */
 #define HERMES_PCI_COR_BUSYT	(500)		/* ms */
 
+/* Orinoco PCI specific data */
+struct orinoco_pci_card {x+	void __iomem *pci_ioaddr;
+};
+
x/*
x * Do a soft reset of the PCI card using the Configuration Option Register
x * We need this to get going...
@@ -151,25 +156,11 @@xx
 	/* Assert the reset until the card notice */
x	hermes_write_regn(hw, PCI_COR, HERMES_PCI_COR_MASK);
-	printk(KERN_NOTICE "Reset done");
-	timeout = jiffies + (HERMES_PCI_COR_ONT * HZ / 1,,,);
-	while(time_before(jiffies, timeout)) {x-		printk(".");
-		mdelay(1);
-	}
-	printk(";\n");
-	//mdelay(HERMES_PCI_COR_ONT);
+	mdelay(HERMES_PCI_COR_ONT);
 
x	/* Give time for the card to recover from this hard effort */
x	hermes_write_regn(hw, PCI_COR, 0x,,,,);
-	printk(KERN_NOTICE "Clear Reset");
-	timeout = jiffies + (HERMES_PCI_COR_OFFT * HZ / 1,,,);
-	while(time_before(jiffies, timeout)) {x-		printk(".");
-		mdelay(1);
-	}
-	printk(";\n");
-	//mdelay(HERMES_PCI_COR_OFFT);
+	mdelay(HERMES_PCI_COR_OFFT);
 
x	/* The card is ready when it's no longer busy */
x	timeout = jiffies + (HERMES_PCI_COR_BUSYT * HZ / 1,,,);
@@ -178,12 +169,12 @@xx		mdelay(1);
x		reg = hermes_read_regn(hw, CMD);
 	}
-	/* Did we timeout ? */
-	if(time_after_eq(jiffies, timeout)) {x+
+	/* Still busy? */
+	if (reg & HERMES_CMD_BUSY) {xx		printk(KERN_ERR PFX "Busy timeout\n");
 		return -ETIMEDOUT;
 	}
-	printk(KERN_NOTICE "pci_cor : reg = 0x%X - %lX - %lX\n", reg, timeout, jiffies);
 
x	return 0;
1}
@@ -196d84 +187,93 @@xx{
 	int err = 0;
x	unsigned long pci_iorange;
-	u16 *pci_ioaddr = NULL;x+	u16 __iomem *pci_ioaddr = NULL;xx	unsigned long pci_iolen;
1	struct orinoco_private *priv = NULL;x+	struct orinoco_pci_card *card;
x	struct net_device *dev = NULL;xx
 	err = pci_enable_device(pdev);
-	if (err)
-		return -EIO;x+	if (err) {x+		printk(KERN_ERR PFX "Cannot enable PCI device\n");
+		return err;
+	}
+
+	err = pci_request_regions(pdev, DRIVER_NAME);
+	if (err != 0) {x+		printk(KERN_ERR PFX "Cannot obtain PCI resources\n");
+		goto fail_resources;
+	}
x
x	/* Resource 0 is mapped to the hermes registers */
 	pci_iorange = pci_resource_start(pdev, ,);
 	pci_iolen = pci_resource_len(pdev, ,);
 	pci_ioaddr = ioremap(pci_iorange, pci_iolen);
-	if (! pci_iorange)
-		goto fail;
+	if (!pci_iorange) {x+		printk(KERN_ERR PFX "Cannot remap hardware registers\n");
+		goto fail_map;
+	}
x
x	/* Allocate network device */
-	dev = alloc_orinocodev(0, NULL);
+	dev = alloc_orinocodev(sizeof(*card), orinoco_pci_cor_reset);xx	if (! dev) {xx		err = -ENOMEM;
-		goto fail;
+		goto fail_alloc;
x	}xx
 	priv = netdev_priv(dev);
-	dev->base_addr = (unsigned long) pci_ioaddr;
+	card = priv->card;
+	card->pci_ioaddr = pci_ioaddr;
 	dev->mem_start = pci_iorange;
 	dev->mem_end = pci_iorange + pci_iolen - 1;
 	SET_MODULE_OWNER(dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
-	printk(KERN_DEBUG PFX
-	x      "Detected Orinoco/Prism2 PCI device at %s, mem:0x%lX to 0x%lX -> 0x%p, irq:%d\n",
-	x      pci_name(pdev), dev->mem_start, dev->mem_end, pci_ioaddr, pdev->irq);
+	hermes_struct_init(&priv->hw, pci_ioaddr, HERMES_32BIT_REGSPACING);
 
-	hermes_struct_init(&priv->hw, dev->base_addr,x-			  xHERMES_MEM, HERMES_32BIT_REGSPACING);
-	pci_set_drvdata(pdev, dev);
+	printk(KERN_DEBUG PFX "Detected device %s, mem:0x%lx-0x%lx, irq %d\n",
+	  x    pci_name(pdev), dev->mem_start, dev->mem_end, pdev->irq);
x
 	err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ,
 			x dev->name, dev);
 	if (err) {x-		printk(KERN_ERR PFX "Error,allocating IRQ %d.\n",
-		  x    pdev->irq);
+		printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq);
x		err = -EBUSY;
-		goto fail;
+		goto fail_irq;
 	}
 	dev->irq = pdev->irq;
 
x	/* Perform a COR reset to start the card */
-	if(orinoco_pci_cor_reset(priv) != 0) {x-		printk(KERN_ERR "%s:,Failed to start the card\n", dev->name);
-		err = -ETIMEDOUT;
+	err = orinoco_pci_cor_reset(priv);x+	if (err) {x+		printk(KERN_ERR PFX "Initial reset failed\n");
 		goto fail;
 	}
 
-	/* Override the normal firmware detection - the Prism 2.5 PCI
-	x* cards look like Lucent firmware but are actually Intersil */
-	priv->firmware_type = FIRMWARE_TYPE_INTERSIL;
-
 	err = register_netdev(dev);
 	if (err) {x-		printk(KERN_ERR "%s:,Failed to register net device\n", dev->name);
+		printk(KERN_ERR PFX "Failed to register net device\n");
 		goto fail;
 	}
 
+	pci_set_drvdata(pdev, dev);
+
x	return 0;
1
  fail:
-	if (dev) {x-		if (dev->irq)x-			free_irq(dev->irq, dev);
+	free_irq(pdev->irq, dev);
 
-		free_netdev(dev);
-	}
+ fail_irq:
+	pci_set_drvdata(pdev, NULL);
+	free_orinocodev(dev);
 
-	if (pci_ioaddr)x-		iounmap(pci_ioaddr);
+ fail_alloc:
+	iounmap(pci_ioaddr);
 
+ fail_map:
+	pci_release_regions(pdev);
+
+ fail_resources:
 	pci_disable_device(pdev);
 xx	return err;
@@ -283,18 +283,14 @@xx{
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct orinoco_private *priv = netdev_priv(dev);
+	struct orinoco_pci_card *card = priv->card;
 xx	unregister_netdev(dev);
-
-	if (dev->irq)x-		free_irq(dev->irq, dev);
-
-	if (priv->hw.iobase)x-		iounmap((unsigned char *) priv->hw.iobase);
-
+	free_irq(dev->irq, dev);
 	pci_set_drvdata(pdev, NULL);
-	free_netdev(dev);
-
+	free_orinocodev(dev);
+	iounmap(card->pci_ioaddr);
+	pci_release_regions(pdev);
 	pci_disable_device(pdev);
 }
 
@@ -32606 +322,9 @@xx	
x	orinoco_unlock(priv, &flags);
 
+	pci_save_state(pdev);
+	pci_set_power_state(pdev, 3);
+
x	return 0;
1}
 
@@ -338d6 +33769 @@xx
 	printk(KERN_DEBUG "%s:,Orinoco-PCI waking up\n", dev->name);
 
+	pci_set_power_state(pdev, 0);
+	pci_restore_state(pdev);
+
 	err = orinoco_reinit_firmware(dev);
 	if (err) {x 		printk(KERN_ERR "%s:,Error,%d re-initializing firmware on orinoco_pci_resume()\n",x@@ -368d6 +370d8 @@xx	{0x1260, 0x3872, PCI_ANY_ID, PCI_ANY_ID,},
x	/* Intersil Prism 2.5 */
 	{0x1260, 0x3873, PCI_ANY_ID, PCI_ANY_ID,},
+	/* Samsung MagicLAN SWL-2210P */
+	{0x167d, 0xa000, PCI_ANY_ID, PCI_ANY_ID,},
x	{0,},
x};
 xdiff -Nru a/drivers/net/wireless/orinoco_plx.c b/drivers/net/wireless/orinoco_plx.c
--- a/drivers/net/wireless/orinoco_plx.c	2004-07-27 22:05:55 -07:00
+++ b/drivers/net/wireless/orinoco_plx.c	2005-02-24 20:45:13 -08:00
@@ -142,146 +142,199 @@xx#include "hermes.h"xx#include "orinoco.h"
xx-#define COR_OFFSET	(0x3e0/2) /* COR attribute offset of Prism2 PC card */
+#define COR_OFFSET	(0x3e0)	/* COR attribute offset of Prism2 PC card */
 #define COR_VALUE	(COR_LEVEL_REQ | COR_FUNC_ENA) /* Enable PC card with interrupt in level trigger */
+#define COR_RESET     (0x8,)	/* reset bit in the COR register */
+#define PLX_RESET_TIME	(500)	/* milliseconds */
 
 #define PLX_INTCSR		0x4c /* Interrupt Control & Status Register */
 #define PLX_INTCSR_INTEN	(1<<6) /* Interrupt Enable bit */
 
-static const u16 cis_magic[] = {x-	0x,,,1, 0x,,,3, 0x,,,,, 0x,,,,, 0x,,ff, 0x,,17, 0x,,,4, 0x,,67
+static const u8 cis_magic[] = {x+	0x,1, 0x,3, 0x,,, 0x,,, 0xff, 0x17, 0x,4, 0x67
x};
 x+/* Orinoco PLX specific data */
+struct orinoco_plx_card {x+	void __iomem *attr_mem;
+};
+
+/*x+ * Do a soft reset of the card using the Configuration Option Register
+ */
+static int orinoco_plx_cor_reset(struct orinoco_private *priv)
+{x+	hermes_t *hw = &priv->hw;
+	struct orinoco_plx_card *card = priv->card;
+	u8 __iomem *attr_mem = card->attr_mem;
+	unsigned long timeout;x+	u16 reg;
+x+	writeb(COR_VALUE | COR_RESET, attr_mem + COR_OFFSET);
+	mdelay(1);
+x+	writeb(COR_VALUE, attr_mem + COR_OFFSET);
+	mdelay(1);
+x+	/* Just in case, wait more until the card is no longer busy */
+	timeout = jiffies + (PLX_RESET_TIME * HZ / 1,,,);
+	reg = hermes_read_regn(hw, CMD);
+	while (time_before(jiffies, timeout) && (reg & HERMES_CMD_BUSY)) {x+		mdelay(1);
+		reg = hermes_read_regn(hw, CMD);
+	}
+x+	/* Did we timeout ? */
+	if (reg & HERMES_CMD_BUSY) {x+		printk(KERN_ERR PFX "Busy timeout\n");
+		return -ETIMEDOUT;
+	}
+x+	return 0;
+}
+
+
xstatic int orinoco_plx_init_one(struct pci_dev *pdev,
x				const struct pci_device_id *ent)xx{
 	int err = 0;
-	u16 *attr_mem = NULL;x-	u32 reg, addr;
+	u8 __iomem *attr_mem = NULL;x+	u32 csr_reg, plx_addr;
 	struct orinoco_private *priv = NULL;x+	struct orinoco_plx_card *card;xx	unsigned long pccard_ioaddr = 0;xx	unsigned long pccard_iolen = 0;
x	struct net_device *dev = NULL;x+	void __iomem *mem;
 	int i;
 x 	err = pci_enable_device(pdev);
-	if (err)
-		return -EIO;x-
-	/* Resource 2 is mapped to the PCMCIA space */
-	attr_mem = ioremap(pci_resource_start(pdev, 2), PAGE_SIZE);
-	if (! attr_mem)
-		goto fail;
-
-	printk(KERN_DEBUG "orinoco_plx: CIS: ");
-	for (i = 0; i < 16; i++) {x-		printk("%02X:", (int)attr_mem[i]);x+	if (err) {x+		printk(KERN_ERR PFX "Cannot enable PCI device\n");
+		return err;
 	}
-	printk("\n");
 
-	/* Verify whether PC card is present */
-	/* FIXME: we probably need to be smarted about this */
-	if (memcmp(attr_mem, cis_magic, sizeof(cis_magic)) != 0) {x-		printk(KERN_ERR "orinoco_plx: The CIS value of Prism2 PC card is invalid.\n");
-		err = -EIO;
-		goto fail;
+	err = pci_request_regions(pdev, DRIVER_NAME);
+	if (err != 0) {x+		printk(KERN_ERR PFX "Cannot obtain PCI resources\n");
+		goto fail_resources;
 	}
 
-	/* PCMCIA COR is the first byte following CIS: this write should
-	x* enable I/O mode and select level-triggered interrupts */
-	attr_mem[COR_OFFSET] = COR_VALUE;
-	mdelay(1);
-	reg = attr_mem[COR_OFFSET];
-	if (reg != COR_VALUE) {x-		printk(KERN_ERR "orinoco_plx: Error,setting COR value (reg=%x)\n", reg);
-		goto fail;
-	}			
-
-	iounmap(attr_mem);
-	attr_mem = NULL; /* done with this now, it seems */
+	/* Resource 1 is mapped to PLX-specific registers */
+	plx_addr = pci_resource_start(pdev, 1);
 
-	/* bjoern: We need to tell the card to enable interrupts, in
-	x  case the serial eprom didn't do this already. See the
-	x  PLX9052 data book, p8-1 and 8-24 for reference. */
-	addr = pci_resource_start(pdev, 1);
-	reg = 0;
-	reg = inl(addr+PLX_INTCSR);
-	if (reg & PLX_INTCSR_INTEN)x-		printk(KERN_DEBUG "orinoco_plx: "
-		x      "Local Interrupt already enabled\n");
-	else {x-		reg |= PLX_INTCSR_INTEN;
-		outl(reg, addr+PLX_INTCSR);
-		reg = inl(addr+PLX_INTCSR);
-		if(!(reg & PLX_INTCSR_INTEN)) {x-			printk(KERN_ERR "orinoco_plx: "
-			       "Couldn't enable Local Interrupts\n");
-			goto fail;
-		}
+	/* Resource 2 is mapped to the PCMCIA attribute memory */
+	attr_mem = ioremap(pci_resource_start(pdev, 2),
+			   pci_resource_len(pdev, 2));
+	if (!attr_mem) {x+		printk(KERN_ERR PFX "Cannot remap PCMCIA space\n");
+		goto fail_map_attr;
 	}
 
-	/* and 3 to the PCMCIA slot I/O address space */
+	/* Resource 3 is mapped to the PCMCIA I/O address space */
 	pccard_ioaddr = pci_resource_start(pdev, 3);
 	pccard_iolen = pci_resource_len(pdev, 3);
-	if (! request_region(pccard_ioaddr, pccard_iolen, DRIVER_NAME)) {x-		printk(KERN_ERR "orinoco_plx: I/O resource 0x%lx @ 0x%lx busy\n",
-		  x    pccard_iolen, pccard_ioaddr);
-		pccard_ioaddr = 0;x-		err = -EBUSY;
-		goto fail;
+
+	mem = pci_iomap(pdev, 3, 0);
+	if (!mem) {x+		err = -ENOMEM;
+		goto fail_map_io;
x	}xx
 	/* Allocate network device */
-	dev = alloc_orinocodev(0, NULL);
-	if (! dev) {x+	dev = alloc_orinocodev(sizeof(*card), orinoco_plx_cor_reset);
+	if (!dev) {x+		printk(KERN_ERR PFX "Cannot allocate network device\n");
 		err = -ENOMEM;
-		goto fail;
+		goto fail_alloc;
x	}xx
 	priv = netdev_priv(dev);
+	card = priv->card;
+	card->attr_mem = attr_mem;
 	dev->base_addr = pccard_ioaddr;
 	SET_MODULE_OWNER(dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
+	hermes_struct_init(&priv->hw, mem, HERMES_16BIT_REGSPACING);
+
 	printk(KERN_DEBUG PFX "Detected Orinoco/Prism2 PLX device "
 	  x    "at %s irq:%d, io addr:0x%lx\n", pci_name(pdev), pdev->irq,
 	  x    pccard_ioaddr);
 
-	hermes_struct_init(&(priv->hw), dev->base_addr, HERMES_IO,x-			  xHERMES_16BIT_REGSPACING);
-	pci_set_drvdata(pdev, dev);
-
 	err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ,
 			x dev->name, dev);
 	if (err) {x-		printk(KERN_ERR PFX "Error,allocating IRQ %d.\n", pdev->irq);
+		printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq);
x		err = -EBUSY;
-		goto fail;
+		goto fail_irq;
 	}
 	dev->irq = pdev->irq;
 
+	/* bjoern: We need to tell the card to enable interrupts, in
+	x  case the serial eprom didn't do this already.  See the
+	x  PLX9052 data book, p8-1 and 8-24 for reference. */
+	csr_reg = inl(plx_addr + PLX_INTCSR);
+	if (!(csr_reg & PLX_INTCSR_INTEN)) {x+		csr_reg |= PLX_INTCSR_INTEN;
+		outl(csr_reg, plx_addr + PLX_INTCSR);
+		csr_reg = inl(plx_addr + PLX_INTCSR);
+		if (!(csr_reg & PLX_INTCSR_INTEN)) {x+			printk(KERN_ERR PFX "Cannot enable interrupts\n");
+			goto fail;
+		}
+	}
+
+	err = orinoco_plx_cor_reset(priv);x+	if (err) {x+		printk(KERN_ERR PFX "Initial reset failed\n");
+		goto fail;
+	}
+
+	printk(KERN_DEBUG PFX "CIS: ");
+	for (i = 0; i < 16; i++) {x+		printk("%02X:", readb(attr_mem + 2*i));
+	}
+	printk("\n");
+x+	/* Verify whether a supported PC card is present */
+	/* FIXME: we probably need to be smarted about this */
+	for (i = 0; i < sizeof(cis_magic); i++) {x+		if (cis_magic[i] != readb(attr_mem +2*i)) {x+			printk(KERN_ERR PFX "The CIS value of Prism2 PC "
+			       "card is unexpected\n");
+			err = -EIO;
+			goto fail;
+		}
+	}
+
 	err = register_netdev(dev);
-	if (err)
+	if (err) {x+		printk(KERN_ERR PFX "Cannot register network device\n");
 		goto fail;
+	}
+
+	pci_set_drvdata(pdev, dev);
 
x	return 0;
1
  fail:
-	printk(KERN_DEBUG PFX "init_one(), FAIL!\n");
+	free_irq(pdev->irq, dev);
 
-	if (dev) {x-		if (dev->irq)x-			free_irq(dev->irq, dev);
-		
-		free_netdev(dev);
-	}
+ fail_irq:
+	pci_set_drvdata(pdev, NULL);
+	free_orinocodev(dev);
 
-	if (pccard_ioaddr)
-		release_region(pccard_ioaddr, pccard_iolen);
+ fail_alloc:
+	pci_iounmap(pdev, mem);
+
+ fail_map_io:
+	iounmap(attr_mem);
 
-	if (attr_mem)
-		iounmap(attr_mem);
+ fail_map_attr:
+	pci_release_regions(pdev);
 
+ fail_resources:
 	pci_disable_device(pdev);
 xx	return err;
@@ -290,20 +343,19 @@xxstatic void __devexit orinoco_plx_remove_one(struct pci_dev *pdev)xx{
 	struct net_device *dev = pci_get_drvdata(pdev);
+	struct orinoco_private *priv = netdev_priv(dev);
+	struct orinoco_plx_card *card = priv->card;
+	u8 __iomem *attr_mem = card->attr_mem;
 xx	BUG_ON(! dev);
 xx	unregister_netdev(dev);
-		
-	if (dev->irq)x-		free_irq(dev->irq, dev);
-		
+	free_irq(dev->irq, dev);
 	pci_set_drvdata(pdev, NULL);
-
-	free_netdev(dev);
-
-	release_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3));
-
+	free_orinocodev(dev);
+	pci_iounmap(pdev, priv->hw.iobase);
+	iounmap(attr_mem);
+	pci_release_regions(pdev);
 	pci_disable_device(pdev);
 }
 
@@ -352,8 +40467 @@xxstatic void __exit orinoco_plx_exit(void)xx{
 	pci_unregister_driver(&orinoco_plx_driver);
-	current->state = TASK_UNINTERRUPTIBLE;
-	schedule_timeout(HZ);
+	ssleep(1);
 }
 
 module_init(orinoco_plx_init);
diff -Nru a/drivers/net/wireless/orinoco_tmd.c b/drivers/net/wireless/orinoco_tmd.c
--- a/drivers/net/wireless/orinoco_tmd.c	2004-07-27 22:05:55 -07:00
+++ b/drivers/net/wireless/orinoco_tmd.c	2005-02-24 20:45:33 -08:00
@@ -79,90 +79,137 @@xx#include "orinoco.h"
xx #define COR_VALUE	(COR_LEVEL_REQ | COR_FUNC_ENA) /* Enable PC card with interrupt in level trigger */
+#define COR_RESET     (0x8,)	/* reset bit in the COR register */
+#define TMD_RESET_TIME	(500)	/* milliseconds */
+x+/* Orinoco TMD specific data */
+struct orinoco_tmd_card {x+	u32 tmd_io;
+};
+
+
+/*x+ * Do a soft reset of the card using the Configuration Option Register
+ */
+static int orinoco_tmd_cor_reset(struct orinoco_private *priv)
+{x+	hermes_t *hw = &priv->hw;
+	struct orinoco_tmd_card *card = priv->card;
+	u32 addr = card->tmd_io;
+	unsigned long timeout;x+	u16 reg;
+x+	outb(COR_VALUE | COR_RESET, addr);
+	mdelay(1);
+x+	outb(COR_VALUE, addr);
+	mdelay(1);
+x+	/* Just in case, wait more until the card is no longer busy */
+	timeout = jiffies + (TMD_RESET_TIME * HZ / 1,,,);
+	reg = hermes_read_regn(hw, CMD);
+	while (time_before(jiffies, timeout) && (reg & HERMES_CMD_BUSY)) {x+		mdelay(1);
+		reg = hermes_read_regn(hw, CMD);
+	}
+x+	/* Did we timeout ? */
+	if (reg & HERMES_CMD_BUSY) {x+		printk(KERN_ERR PFX "Busy timeout\n");
+		return -ETIMEDOUT;
+	}
+x+	return 0;
+}
+
 
xstatic int orinoco_tmd_init_one(struct pci_dev *pdev,
x				const struct pci_device_id *ent)xx{
 	int err = 0;
-	u32 reg, addr;
 	struct orinoco_private *priv = NULL;x-	unsigned long pccard_ioaddr = 0;x-	unsigned long pccard_iolen = 0;
+	struct orinoco_tmd_card *card;
x	struct net_device *dev = NULL;x+	void __iomem *mem;
 
 	err = pci_enable_device(pdev);
-	if (err)
-		return -EIO;x+	if (err) {x+		printk(KERN_ERR PFX "Cannot enable PCI device\n");
+		return err;
+	}
 
-	printk(KERN_DEBUG PFX "TMD setup\n");
-	pccard_ioaddr = pci_resource_start(pdev, 2);
-	pccard_iolen = pci_resource_len(pdev, 2);
-	if (! request_region(pccard_ioaddr, pccard_iolen, DRIVER_NAME)) {x-		printk(KERN_ERR PFX "I/O resource at 0x%lx len 0x%lx busy\n",
-			pccard_ioaddr, pccard_iolen);
-		pccard_ioaddr = 0;x-		err = -EBUSY;
-		goto fail;
+	err = pci_request_regions(pdev, DRIVER_NAME);
+	if (err != 0) {x+		printk(KERN_ERR PFX "Cannot obtain PCI resources\n");
+		goto fail_resources;
 	}
-	addr = pci_resource_start(pdev, 1);
-	outb(COR_VALUE, addr);
-	mdelay(1);
-	reg = inb(addr);
-	if (reg != COR_VALUE) {x-		printk(KERN_ERR PFX "Error,setting TMD COR values %x should be %x\n", reg, COR_VALUE);
-		err = -EIO;
-		goto fail;
+
+	mem = pci_iomap(pdev, 2, 0);
+	if (! mem) {x+		err = -ENOMEM;
+		goto fail_iomap;
x	}xx
 	/* Allocate network device */
-	dev = alloc_orinocodev(0, NULL);
+	dev = alloc_orinocodev(sizeof(*card), orinoco_tmd_cor_reset);xx	if (! dev) {x+		printk(KERN_ERR PFX "Cannot allocate network device\n");
 		err = -ENOMEM;
-		goto fail;
+		goto fail_alloc;
x	}xx
 	priv = netdev_priv(dev);
-	dev->base_addr = pccard_ioaddr;
+	card = priv->card;
+	card->tmd_io = pci_resource_start(pdev, 1);
+	dev->base_addr = pci_resource_start(pdev, 2);
 	SET_MODULE_OWNER(dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
+	hermes_struct_init(&priv->hw, mem, HERMES_16BIT_REGSPACING);
+
 	printk(KERN_DEBUG PFX "Detected Orinoco/Prism2 TMD device "
 	  x    "at %s irq:%d, io addr:0x%lx\n", pci_name(pdev), pdev->irq,
-	  x    pccard_ioaddr);
-
-	hermes_struct_init(&(priv->hw), dev->base_addr,
-			HERMES_IO, HERMES_16BIT_REGSPACING);
-	pci_set_drvdata(pdev, dev);
+	  x    dev->base_addr);
x
 	err = request_irq(pdev->irq, orinoco_interrupt, SA_SHIRQ,
 			x dev->name, dev);
 	if (err) {x-		printk(KERN_ERR PFX "Error,allocating IRQ %d.\n",
-		  x    pdev->irq);
+		printk(KERN_ERR PFX "Cannot allocate IRQ %d\n", pdev->irq);
x		err = -EBUSY;
-		goto fail;
+		goto fail_irq;
 	}
 	dev->irq = pdev->irq;
 
+	err = orinoco_tmd_cor_reset(priv);x+	if (err) {x+		printk(KERN_ERR PFX "Initial reset failed\n");
+		goto fail;
+	}
+
 	err = register_netdev(dev);
-	if (err)
+	if (err) {x+		printk(KERN_ERR PFX "Cannot register network device\n");
 		goto fail;
+	}
+
+	pci_set_drvdata(pdev, dev);
 
x	return 0;
1
  fail:
-	printk(KERN_DEBUG PFX "init_one(), FAIL!\n");
+	free_irq(pdev->irq, dev);
 
-	if (dev) {x-		if (dev->irq)x-			free_irq(dev->irq, dev);
-		
-		free_netdev(dev);
-	}
+ fail_irq:
+	pci_set_drvdata(pdev, NULL);
+	free_orinocodev(dev);
+
+ fail_alloc:
+	pci_iounmap(pdev, mem);
 
-	if (pccard_ioaddr)
-		release_region(pccard_ioaddr, pccard_iolen);
+ fail_iomap:
+	pci_release_regions(pdev);
 
+ fail_resources:
 	pci_disable_device(pdev);
 xx	return err;
@@ -171,20 +218,16 @@xxstatic void __devexit orinoco_tmd_remove_one(struct pci_dev *pdev)xx{
 	struct net_device *dev = pci_get_drvdata(pdev);
+	struct orinoco_private *priv = dev->priv;
 xx	BUG_ON(! dev);
 xx	unregister_netdev(dev);
-		
-	if (dev->irq)x-		free_irq(dev->irq, dev);
-		
+	free_irq(dev->irq, dev);
 	pci_set_drvdata(pdev, NULL);
-
-	free_netdev(dev);
-
-	release_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2));
-
+	free_orinocodev(dev);
+	pci_iounmap(pdev, priv->hw.iobase);
+	pci_release_regions(pdev);
 	pci_disable_device(pdev);
 }
 
@@ -218,8 +26167 @@xxstatic void __exit orinoco_tmd_exit(void)xx{
 	pci_unregister_driver(&orinoco_tmd_driver);
-	current->state = TASK_UNINTERRUPTIBLE;
-	schedule_timeout(HZ);
+	ssleep(1);
 }
 
 module_init(orinoco_tmd_init);
diff -Nru a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c
--- a/drivers/net/wireless/prism54/isl_38xx.c	2004-10-21 16:42:05 -07:00
+++ b/drivers/net/wireless/prism54/isl_38xx.c	2005-03-01 20:15:00 -08:00
@@ -125,11 +125,11 @@xx#if VERBOSE > SHOW_ERROR_MESSAGES
 		do_gettimeofday(&current_time);
 		DEBUG(SHOW_TRACING, "%08li.%08li Device wakeup triggered\n",
-		  x   current_time.tv_sec, current_time.tv_usec);
+		  x   current_time.tv_sec, (long)current_time.tv_usec);
 #endif
 
x		DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n",
-		  x   current_time.tv_sec, current_time.tv_usec,
+		  x   current_time.tv_sec, (long)current_time.tv_usec,
 		  x   readl(device_base + ISL38XX_CTRL_STAT_REG));
 		udelay(ISL38XX_WRITEIO_DELAY);
 
@@ -139,7 +13967 @@xx			do_gettimeofday(&current_time);
 			DEBUG(SHOW_TRACING,
 			x     "%08li.%08li Device register abadface\n",
-			      current_time.tv_sec, current_time.tv_usec);
+			  x   current_time.tv_sec, (long)current_time.tv_usec);
 #endif
 			/* read the Device Status Register until Sleepmode bit is,set */
 			while (reg = readl(device_base + ISL38XX_CTRL_STAT_REG),
@@ -150,7 +15067 @@xx
 			DEBUG(SHOW_TRACING,
 			x     "%08li.%08li Device register read %08x\n",
-			  x   current_time.tv_sec, current_time.tv_usec,
+			  x   current_time.tv_sec, (long)current_time.tv_usec,
 			  x   readl(device_base + ISL38XX_CTRL_STAT_REG));
 			udelay(ISL38XX_WRITEIO_DELAY);
 
@@ -158,7 +15867 @@xx			do_gettimeofday(&current_time);
 			DEBUG(SHOW_TRACING,
 			x     "%08li.%08li Device asleep counter %i\n",
-			  x   current_time.tv_sec, current_time.tv_usec,
+			  x   current_time.tv_sec, (long)current_time.tv_usec,
 			  x   counter);
 #endif
 		}
@@ -174,7 +17467 @@xx#if VERBOSE > SHOW_ERROR_MESSAGES
 		do_gettimeofday(&current_time);
 		DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n",
-		  x   current_time.tv_sec, current_time.tv_usec, reg);
+		  x   current_time.tv_sec, (long)current_time.tv_usec, reg);
 #endif
 	} else {xx		/* device is,(still) awake  */
diff -Nru a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
--- a/drivers/net/wireless/prism54/isl_ioctl.c	2004-10-09 05:43:06 -07:00
+++ b/drivers/net/wireless/prism54/isl_ioctl.c	2005-01-22 21:53:58 -08:00
@@ -1750,7 +175067 @@xx	u8 wpa_ie[MAX_WPA_IE_LEN];
 	int wpa_ie_len;
1	size_t len = 0; /* u16, better? */
-	u8 *payload = 0, *pos = 0;
+	u8 *payload = NULL, *pos = NULL;xx	int ret;
 
x	/* I think all trapable objects are listed here.
diff -Nru a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
--- a/drivers/net/wireless/ray_cs.c	2005-01-15 14:31:03 -08:00
+++ b/drivers/net/wireless/ray_cs.c	2005-01-28 14:00:02 -08:00
@@ -121566 +121569 @@xx#if WIRELESS_EXT > 7
x    struct iwreq *wrq = (struct iwreq *) ifr;
 #endif	/* WIRELESS_EXT > 7 */
+#ifdef WIRELESS_SPY
+    struct sockaddr	address[IW_MAX_SPY];
+#endif	/* WIRELESS_SPY */
 
     if (!(link->state & DEV_PRESENT)) {xxxxxxxxxxDEBUG(2,"ray_dev_ioctl - device not present\n");
@@ -1511,7 +1514,6 @@xxxxxxxx/* If there is some addresses to copy */
       if(local->spy_number > 0)
 	{
-	  struct sockaddr	address[IW_MAX_SPY];
 	  int			i;
 
x	xx/* Copyxaddresses to the driver */
@@ -1551,7 +1553,6 @@xxxxxxxx/* If the user want to have the addresses back... */
x      if((local->spy_number > 0) && (wrq->u.data.pointer != (caddr_t) 0))
 	{
-	  struct sockaddr	address[IW_MAX_SPY];
 	  int			i;
 
x	xx/* Copyxaddresses from the lp structure */
diff -Nru a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
--- a/drivers/net/wireless/strip.c	2005-02-19 02:53:30 -08:00
+++ b/drivers/net/wireless/strip.c	2005-02-13 15:11:09 -08:00
@@ -87667 +87667 @@xxx*/
xstatic int strip_change_mtu(struct net_device *dev, int new_mtu)xx{
-	struct strip *strip_info = dev->priv;
+	struct strip *strip_info = netdev_priv(dev);
x	int old_mtu = strip_info->mtu;xx	unsigned char *orbuff = strip_info->rx_buff;xx	unsigned char *osbuff = strip_info->sx_buff;x@@ -1563,7 +1563,7 @@xx/* Encapsulate a datagram and kick it into a TTY queue.x*/
xstatic int strip_xmit(struct sk_buff *skb, struct net_device *dev)xx{
-	struct strip *strip_info = (struct strip *) (dev->priv);x+	struct strip *strip_info = netdev_priv(dev);
xxx	if (!netif_running(dev)) {x 		printk(KERN_ERR "%s:,xmit call when iface is down\n",x@@ -1639,7 +163967 @@xx			unsigned short type, void *daddr, void *saddr,
x			unsigned len)xx{
-	struct strip *strip_info = (struct strip *) (dev->priv);x+	struct strip *strip_info = netdev_priv(dev);
x	STRIP_Header *header = (STRIP_Header *) skb_push(skb, sizeof(STRIP_Header));
 
x	/*printk(KERN_INFO "%s:,strip_header 0x%04X %s\n", dev->name, type,x@@ -1648,7 +1648,7 @@xx	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); */
+	/*HexDump("strip_header", netdev_priv(dev), skb->data, skb->data + skb->len); */
xxx	if (!daddr)
 		return (-dev->hard_header_len);
@@ -2400,7 +2400,7 @@xx
 static int strip_set_mac_address(struct net_device *dev, void *addr)
 {
-	struct strip *strip_info = (struct strip *) (dev->priv);x+	struct strip *strip_info = netdev_priv(dev);
x	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);
@@ -2409,8 +2409,8 @@xx
 static struct net_device_stats *strip_get_stats(struct net_device *dev)xx{
+	struct strip *strip_info = netdev_priv(dev);
x	static struct net_device_stats stats;
-	struct strip *strip_info = (struct strip *) (dev->priv);xxxx	memset(&stats, 0, sizeof(struct net_device_stats));
 
@@ -2454,7 +2454,7 @@xx
 static int strip_open_low(struct net_device *dev)xx{
-	struct strip *strip_info = (struct strip *) (dev->priv);x+	struct strip *strip_info = netdev_priv(dev);
xxx	if (strip_info->tty == NULL)
 		return (-ENODEV);
@@ -2487,7 +2487,7 @@xx
 static int strip_close_low(struct net_device *dev)xx{
-	struct strip *strip_info = (struct strip *) (dev->priv);x+	struct strip *strip_info = netdev_priv(dev);
xxx	if (strip_info->tty == NULL)
 		return -EBUSY;
diff -Nru a/drivers/parisc/Kconfig b/drivers/parisc/Kconfig
--- a/drivers/parisc/Kconfig	2004-02-16 16:44:02 -08:00
+++ b/drivers/parisc/Kconfig	2005-03-02 03:25:37 -08:00
@@ -110d6 +110,14 @@xx#	helpxx#	  Say Y here for V-class PCI, DMA/IOMMU, IRQ subsystem support.
 
+source "drivers/pcmcia/Kconfig"
+
+source "drivers/pci/hotplug/Kconfig"
+
+endmenu
+
+menu "PA-RISC specific drivers"
+
 config SUPERIO
 	bool "SuperIO (SuckyIO) support"
 	depends on PCI_LBA
@@ -144,9 +152,18 @@xx	  
x	xxIf unsure, say Y.
 
-source "drivers/pcmcia/Kconfig"
-
-source "drivers/pci/hotplug/Kconfig"
-
+config PDC_STABLE
+	tristate "PDC Stable Storage support"
+	depends on SYSFS
+	default y
+	helpx+	  Say Y here if you want to enable support for accessing Stable Storagex+	  variables (PDC non volatile variables such as Primary Boot Path,
+	  Console Path, Autoboot, Autosearch, etc) through SysFS.
+	
+	  If unsure, say Y.
+	
+	  To compile this driver as a module, choose M here.
+	  The module will be called pdc_stable.
 
 endmenu
diff -Nru a/drivers/parisc/Makefile b/drivers/parisc/Makefile
--- a/drivers/parisc/Makefile	2005-01-12 12:01:48 -08:00
+++ b/drivers/parisc/Makefile	2005-03-02 03:25:37 -08:00
@@ -22,5 +22,6 @@xx
 obj-$(CONFIG_SUPERIO)		+= superio.o
 obj-$(CONFIG_CHASSIS_LCD_LED)	+= led.o
+obj-$(CONFIG_PDC_STABLE)	+= pdc_stable.o
 obj-y				+= power.o
 
diff -Nru a/drivers/parisc/dino.c b/drivers/parisc/dino.c
--- a/drivers/parisc/dino.c	2005-01-12 12:01:48 -08:00
+++ b/drivers/parisc/dino.c	2005-02-07 12:52:54 -08:00
@@ -653,14 +653,13 @@xx				  x   PCI_INTERRUPT_PIN, 1, &irq_pin);
 			irq_pin = (irq_pin + PCI_SLOT(dev->devfn) - 1) % 4 ;xx			printk(KERN_WARNING "Device %s has undefined IRQ, "
-					"setting to %d\n", dev->slot_name,
-					irq_pin);
+					"setting to %d\n", pci_name(dev), irq_pin);
 			dino_cfg_write(dev->bus, dev->devfn, xx				  x    PCI_INTERRUPT_LINE, 1, irq_pin);
 			dino_assign_irq(dino_dev, irq_pin, &dev->irq);
x#else
 			dev->irq = 65535;x-			printk(KERN_WARNING "Device %s has unassigned IRQ\n", dev->slot_name);	x+			printk(KERN_WARNING "Device %s has unassigned IRQ\n", pci_name(dev));
 #endif
 		} else {xx
diff -Nru a/drivers/parisc/eisa_eeprom.c b/drivers/parisc/eisa_eeprom.c
--- a/drivers/parisc/eisa_eeprom.c	2004-02-03 21:42:34 -08:00
+++ b/drivers/parisc/eisa_eeprom.c	2005-03-08 11:16:05 -08:00
@@ -19,7 +19,6 @@xxx*    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USAxxx*/
x
-#include <linux/config.h>xx#include <linux/module.h>xx#include <linux/init.h>xx#include <linux/kernel.h>xdiff -Nru a/drivers/parisc/gsc.c b/drivers/parisc/gsc.c
--- a/drivers/parisc/gsc.c	2005-01-12 12:01:49 -08:00
+++ b/drivers/parisc/gsc.c	2005-03-08 11:16:05 -08:00
@@ -38,14 +38,14 @@xx
 int gsc_alloc_irq(struct gsc_irq *i)xx{
-	int irq = txn_alloc_irq();x+	int irq = txn_alloc_irq(GSC_EIM_WIDTH);
 	if (irq < 0) {x 		printk("cannot get irq\n");
 		return irq;
 	}
 
 	i->txn_addr = txn_alloc_addr(irq);
-	i->txn_data = txn_alloc_data(irq, GSC_EIM_WIDTH);
+	i->txn_data = txn_alloc_data(irq);
 	i->irq = irq;
 
x	return irq;
@@ -64,7 +64,7 @@xx	}
 
 	i->txn_addr = txn_alloc_addr(irq);
-	i->txn_data = txn_alloc_data(irq, GSC_EIM_WIDTH);
+	i->txn_data = txn_alloc_data(irq);
 	i->irq = irq;
 
x	return irq;
diff -Nru a/drivers/parisc/hppb.c b/drivers/parisc/hppb.c
--- a/drivers/parisc/hppb.c	2003-09-08 15:00:24 -07:00
+++ b/drivers/parisc/hppb.c	2005-03-08 11:16:06 -08:00
@@ -16,7 +16,6 @@xx**
x*/
x
-#include <linux/config.h>xx#include <linux/types.h>xx#include <linux/init.h>xx#include <linux/mm.h>xdiff -Nru a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c
--- a/drivers/parisc/iosapic.c	2005-01-20 21:02:14 -08:00
+++ b/drivers/parisc/iosapic.c	2005-03-02 03:25:37 -08:00
@@ -158,31 +15869 @@xx
 xx#ifdef DEBUG_IOSAPIC
-static char assert_buf[128];
-
-static int
-assert_failed (char *a, char *f, int l)
-{
-        sprintf(assert_buf,
-			"ASSERT(%s) failed!\nline %d in %s\n",
-			a, xxxxx/* assertion text */
-			l, xxxxx/* line number */
-			f);xxxxx/* file name */
-        panic(assert_buf);
-	return 0;
-}
-
-#undef ASSERTx-#define ASSERT(EX) { if (!(EX)) assert_failed(# EX, __FILE__, __LINE__);x}
-
 #define DBG(x...) printk(x)
-
 #else /* DEBUG_IOSAPIC */
-
 #define DBG(x...)
-#undef	ASSERTx-#define ASSERT(EX)
-
 #endif /* DEBUG_IOSAPIC */
 xx#ifdef DEBUG_IOSAPIC_IRTx@@ -191d6 +169,12 @@xx#define DBG_IRT(x...)
 #endif
 
+#ifdef CONFIG_64BIT
+#define COMPARE_IRTE_ADDR(irte, hpa)	((irte)->dest_iosapic_addr == (hpa))
+#else
+#define COMPARE_IRTE_ADDR(irte, hpa)	\x+		((irte)->dest_iosapic_addr == ((hpa) | 0xffffffff00000000ULL))
+#endif
xx #define IOSAPIC_REG_SELECT              0x,,x #define IOSAPIC_REG_WINDOW              0x10
@@ -201,33 +185,18 @@xx#define IOSAPIC_IRDT_ENTRY(idx)		(0x10+(idx)*2)xx#define IOSAPIC_IRDT_ENTRY_HI(idx)	(0x11+(idx)*2)xx
-static inline unsigned int iosapic_read(unsigned long iosapic, unsigned int reg)
+static inline unsigned int iosapic_read(void __iomem *iosapic, unsigned int reg)
 {x 	writel(reg, iosapic + IOSAPIC_REG_SELECT);
 	return readl(iosapic + IOSAPIC_REG_WINDOW);
 }
 
-static inline void iosapic_write(unsigned long iosapic, unsigned int reg, u32 val)
+static inline void iosapic_write(void __iomem *iosapic, unsigned int reg, u32 val)
 {x 	writel(reg, iosapic + IOSAPIC_REG_SELECT);
 	writel(val, iosapic + IOSAPIC_REG_WINDOW);
 }
 
-/*
-**     GFP_KERNEL includes __GFP_WAIT flag and that may not
-**     be acceptable. Since this is boot time, we shouldn't have
-**     to wait ever and this code should (will?) never get called
-**     from the interrrupt context.
-*/x-#define	IOSAPIC_KALLOC(a_type, cnt) \
-			(a_type *) kmalloc(sizeof(a_type)*(cnt), GFP_KERNEL)x-#define IOSAPIC_FREE(addr, f_type, cnt) kfree((void *)addr)
-
-
-#define	IOSAPIC_LOCK(lck)	spin_lock_irqsave(lck, irqflags)
-#define	IOSAPIC_UNLOCK(lck)	spin_unlock_irqrestore(lck, irqflags)
-
-
 #define IOSAPIC_VERSION_MASK	0x,,,0,,ff
 #define	IOSAPIC_VERSION(ver)	((int) (ver & IOSAPIC_VERSION_MASK))
 
@@ -265,52 +234,64 @@xxstatic struct irt_entry *irt_cell;
 static size_t irt_num_entry;
 
+static struct irt_entry *iosapic_alloc_irt(int num_entries)
+{x+	unsigned long a;
 
+	/* The IRT needs to be 8-byte aligned for the PDC call. 
+	x* Normally kmalloc would guarantee larger alignment, but
+	x* if CONFIG_DEBUG_SLAB is enabled, then we can get only
+	x* 4-byte alignment on 32-bit kernels
+	x*/
+	a = (unsigned long)kmalloc(sizeof(struct irt_entry)x* num_entries + 8, GFP_KERNEL);
+	a = (a + 7) & ~7;x+	return (struct irt_entry *)a;
+}
 
-/*
-** iosapic_load_irt
-**
-** The "Get PCI INT Routing Table Size" option returns the number of 
-** entries in the PCI interrupt routing table for the cell specified 
-** in the cell_number argument.  The cell number must be for a cell 
-** within the caller's protection domain.
-**
-** The "Get PCI INT Routing Table" option returns, for the cell 
-** specified in the cell_number argument, the PCI interrupt routing 
-** table in the caller allocated memory pointed to by mem_addr.
-** We assume the IRT only contains entries for I/O SAPIC and
-** calculate the size based on the size of I/O sapic entries.
-**
-** The PCI interrupt routing table entry format is,derived from the
-** IA64 SAL Specification 2.4.   The PCI interrupt routing table defines
-** the routing of PCI interrupt signals between the PCI device output
-** "pins" and the IO SAPICs' input "lines" (including core I/O PCI
-** devices).  This table does NOT include information for devices/slots
-** behind PCI to PCI bridges. See PCI to PCI Bridge Architecture Spec.
-** for the architected method of routing of IRQ's behind PPB's.
-*/x+/**x+ * iosapic_load_irt - Fill in the interrupt routing tablex+ * @cell_num: The cell number of the CPU we're currently executing onx+ * @irt: The address to place the new IRT atx+ * @return The number of entries foundx+ *x+ * The "Get PCI INT Routing Table Size" option returns the number of 
+ * entries in the PCI interrupt routing table for the cell specified 
+ * in the cell_number argument.  The cell number must be for a cell 
+ * within the caller's protection domain.
+ *x+ * The "Get PCI INT Routing Table" option returns, for the cell 
+ * specified in the cell_number argument, the PCI interrupt routing 
+ * table in the caller allocated memory pointed to by mem_addr.
+ * We assume the IRT only contains entries for I/O SAPIC and
+ * calculate the size based on the size of I/O sapic entries.
+ *x+ * The PCI interrupt routing table entry format is,derived from the
+ * IA64 SAL Specification 2.4.   The PCI interrupt routing table defines
+ * the routing of PCI interrupt signals between the PCI device output
+ * "pins" and the IO SAPICs' input "lines" (including core I/O PCI
+ * devices).  This table does NOT include information for devices/slots
+ * behind PCI to PCI bridges. See PCI to PCI Bridge Architecture Spec.
+ * for the architected method of routing of IRQ's behind PPB's.
+ */
 xx
-static int __init /* return number of entries as success/fail flag */
+static int __init
 iosapic_load_irt(unsigned long cell_num, struct irt_entry **irt)
 {x 	long status;              /* PDC return value status */
 	struct irt_entry *table;  /* start of interrupt routing tbl */
 	unsigned long num_entries = 0UL;
 
-	ASSERT(NULL != irt);x+	BUG_ON(!irt);xxxx	if (is_pdc_pat()) {x-xx		/* Use pat pdc routine to get interrupt routing table size */
 		DBG("calling get_irt_size (cell %ld)\n", cell_num);
 		status = pdc_pat_get_irt_size(&num_entries, cell_num);
 		DBG("get_irt_size: %ld\n", status);
 
-		ASSERT(status == PDC_OK);
-
-		/* save the number of entries in the table */
-		ASSERT(0UL != num_entries);
+		BUG_ON(status != PDC_OK);
+		BUG_ON(num_entries == 0);
 xx		/*xx		** allocate memory for interrupt routing tablex@@ -318,45 +299,47 @@xx		** the contents of the table are exclusively
x		** for I/O sapic devices.
x		*/
-		table = IOSAPIC_KALLOC(struct irt_entry, num_entries);
+		table = iosapic_alloc_irt(num_entries);
 		if (table == NULL) {x-			printk(KERN_WARNING MODULE_NAME ": read_irt : can not alloc mem for IRT\n");
+			printk(KERN_WARNING MODULE_NAME ": read_irt : can "
+					"not alloc mem for IRT\n");
 			return 0;
1		}
 
 		/* get PCI INT routing table */
 		status = pdc_pat_get_irt(table, cell_num);
 		DBG("pdc_pat_get_irt: %ld\n", status);
-		ASSERT(status == PDC_OK);
+		WARN_ON(status != PDC_OK);
 	} else {xx		/*
x		** C3000/J5000 (and similar) platforms with Sprockets PDC
x		** will return exactly one IRT for,all iosapics.
x		** So if we have one, don't need to get it again.
x		*/
-		if (NULL != irt_cell)x+		if (irt_cell)x 			return 0;
1
 		/* Should be using the Elroy's HPA, but it's ignored anyway */
 		status = pdc_pci_irt_size(&num_entries, 0);
 		DBG("pdc_pci_irt_size: %ld\n", status);
 
-		if (PDC_OK != status) {x+		if (status != PDC_OK) {xx			/* Not a "legacy" system with I/O SAPIC either */
 			return 0;
1		}
 
-		ASSERT(0UL != num_entries);
+		BUG_ON(num_entries == 0);
 x-		table = IOSAPIC_KALLOC(struct irt_entry, num_entries);
-		if (table == NULL) {x-			printk(KERN_WARNING MODULE_NAME ": read_irt : can not alloc mem for IRT\n");
+		table = iosapic_alloc_irt(num_entries);
+		if (!table) {x+			printk(KERN_WARNING MODULE_NAME ": read_irt : can "
+					"not alloc mem for IRT\n");
 			return 0;
1		}
 
 		/* HPA ignored by this call too. */
 		status = pdc_pci_irt(num_entries, 0, table);
-		ASSERT(PDC_OK == status);
+		BUG_ON(status != PDC_OK);
x	}xx
 	/* return interrupt table address */
@@ -390,16 +373,10 @@xx
 xx
-void __init
-iosapic_init(void)x+void __init iosapic_init(void)x {xx	unsigned long cell = 0;
x
-	/* init global data */
-	spin_lock_init(&iosapic_lock);
-        iosapic_list = (struct iosapic_info *) NULL;x-	iosapic_count = 0;x-xx	DBG("iosapic_init()\n");
 
x#ifdef __LP64__
@@ -414,11 +39169 @@xx	}xx#endif
xx-	/*x-	**  get IRT for,this cell.x-	*/
-	irt_num_entry =  iosapic_load_irt(cell, &irt_cell);
-	if (0 == irt_num_entry)
+	/* get interrupt routing table for,this cell */
+	irt_num_entry = iosapic_load_irt(cell, &irt_cell);
+	if (irt_num_entry == 0)
 		irt_cell = NULL;	/* old PDC w/o iosapic */
 }
 
@@ -459,10 +43467 @@xx			continue;
1		}
 
-		/*x-		** Compare: dest_iosapic_addr, src_bus_irq_devnox-		*/
-		if (i->dest_iosapic_addr != (u64) ((long) isi->isi_hpa))
+		if (!COMPARE_IRTE_ADDR(i, isi->isi_hpa))
x			continue;
1
 		if ((i->src_bus_irq_devno & IRT_IRQ_DEVNO_MASK) != irq_devno)
@@ -506,10 +478,10 @@xx
 	pci_read_config_byte(pcidev, PCI_INTERRUPT_PIN, &intr_pin);
 
-	DBG_IRT("iosapic_xlate_pin() SLOT %d pin %d\n",
-		PCI_SLOT(pcidev->devfn), intr_pin);
+	DBG_IRT("iosapic_xlate_pin(%s) SLOT %d pin %d\n",
+		pcidev->slot_name, PCI_SLOT(pcidev->devfn), intr_pin);
 
-	if (0 == intr_pin) {x+	if (intr_pin == 0) {xx		/* The device does NOT support/use IRQ lines.  */
 		return NULL;xx	}
@@ -606,7 +578,6 @@xx{xx	u32 mode = 0;
x	struct irt_entry *p = vi->irte;
-	ASSERT(NULL != vi->irte);xxxx	if ((p->polarity_trigger & IRT_PO_MASK) == IRT_ACTIVE_LO)
x		mode |= IOSAPIC_IRDT_PO_LOW;
@@ -619,7 +590,6 @@xx	** PA doesn't support EXTINT or,LPRIO bits.
x	*/
x
-	ASSERT(vi->txn_data);
x	*dp0 = mode | (u32) vi->txn_data;
 
x	/*
@@ -802,22 +772,23 @@xx
 	vi->irte = irte;
x
-	/* Allocate processor IRQ */
-	vi->txn_irq = txn_alloc_irq();x-
x	/*
+	x* Allocate processor IRQ
+	x*
x	x* XXX/FIXME The txn_alloc_irq() code and related code should be
x	x* moved to enable_irq(). That way we only allocate processor IRQ
x	x* bits for devices that actually have drivers claiming them.
x	x* Right now we assign an IRQ to every PCI device present,
x	x* regardless of whether it's used or not.
x	x*/
+	vi->txn_irq = txn_alloc_irq(8);
+
 	if (vi->txn_irq < 0)
 		panic("I/O sapic: couldn't get TXN IRQ\n");
 
x	/* enable_irq() will use txn_* to program IRdT */
 	vi->txn_addr = txn_alloc_addr(vi->txn_irq);
-	vi->txn_data = txn_alloc_data(vi->txn_irq, 8);
+	vi->txn_data = txn_alloc_data(vi->txn_irq);
 
x	vi->eoi_addr = isi->addr + IOSAPIC_REG_EOI;
x	vi->eoi_data = cpu_to_le32(vi->txn_data);
@@ -841,10 +81267 @@xxstatic unsigned int
 iosapic_rd_version(struct iosapic_info *isi)xx{
-	ASSERT(isi);
-	ASSERT(isi->isi_hpa);
-
-	return iosapic_read(isi->isi_hpa, IOSAPIC_REG_VERSION);x+	return iosapic_read(isi->addr, IOSAPIC_REG_VERSION);x }
 
 
@@ -866,44 +834638 @@xx	int cnt;	/* track how many entries we've looked at */
xxx	/*x-	** Astro based platforms can't support PCI OLARD if theyx-	** implement the legacy PDC (not PAT). Though Legacy PDCx-	** supports an IRT, LBA's with no device under themx-	** are *not* listed in the IRT.x-	** Search the IRT and ignore iosapic's which aren'tx-	** in the IRT.x-	*/
-	ASSERT(NULL != irte);	/* always have built-in devices */
+	 * Astro based platforms can only support PCI OLARD if they implement
+	 * PAT PDC.  Legacy PDC omits LBAs with no PCI devices from the IRT.x+	 * Search the IRT and ignore iosapic's which aren't in the IRT.x+	x*/
 	for (cnt=0; cnt < irt_num_entry; cnt++, irte++) {x-		ASSERT(IRT_IOSAPIC_TYPE == irte->entry_type);
-		/*x-		** We need sign extension of the hpa on 32-bit kernels.x-		** The address in the IRT is,*always* 64 bit and reallyx-		** is an unsigned quantity (like,all physical addresses).x-		*/ 
-		if (irte->dest_iosapic_addr == (s64) ((long) hpa))
+		WARN_ON(IRT_IOSAPIC_TYPE != irte->entry_type);
+		if (COMPARE_IRTE_ADDR(irte, hpa))
x			break;
 	}
 
-	if (cnt  >= irt_num_entry)
-		return (NULL);
+	if (cnt >= irt_num_entry) {x+		DBG("iosapic_register() ignoring 0x%lx (NOT FOUND)\n", hpa);
+		return NULL;x+	}
 
-	if ((isi = IOSAPIC_KALLOC(struct iosapic_info, 1)) == NULL) {x+	isi = (struct iosapic_info *)kmalloc(sizeof(struct iosapic_info), GFP_KERNEL);
+	if (!isi) {xx		BUG();
-		return (NULL);
+		return NULL;xx	}
xxx	memset(isi, 0, sizeof(struct iosapic_info));
 
-	isi->isi_hpa         = hpa;
-	isi->isi_version     = iosapic_rd_version(isi);
+	isi->addr = ioremap(hpa, 4096);
+	isi->isi_hpa = hpa;
+	isi->isi_version = iosapic_rd_version(isi);
 	isi->isi_num_vectors = IOSAPIC_IRDT_MAX_ENTRY(isi->isi_version) + 1;
 
-	vip = isi->isi_vector =
-		 IOSAPIC_KALLOC(struct vector_info, isi->isi_num_vectors);
-
+	vip = isi->isi_vector = (struct vector_info *)
+		kmalloc(sizeof(struct vector_info)x* isi->isi_num_vectors, GFP_KERNEL);
 	if (vip == NULL) {x-		IOSAPIC_FREE(isi, struct iosapic_info, 1);
+		kfree(isi);
 		return NULL;xx	}
xx@@ -924,7 +886,6 @@xx{xx	unsigned int i, *irp = (unsigned int *) irt;
 
-	ASSERT(NULL != irt);x 
 	printk(KERN_DEBUG MODULE_NAME ": Interrupt Routing Table (%lx entries)\n", num_entry);
 
@@ -938,8 +899,6 @@xxstatic void
 iosapic_prt_vi(struct vector_info *vi)xx{
-	ASSERT(NULL != vi);x-
x	printk(KERN_DEBUG MODULE_NAME ": vector_info[%d] is at %p\n", vi->irqline, vi);xx	printk(KERN_DEBUG "\t\tstatus:	 %.4x\n", vi->status);
 	printk(KERN_DEBUG "\t\ttxn_irq:  %d\n",  vi->txn_irq);
@@ -953,10 +91269 @@xxstatic void
 iosapic_prt_isi(struct iosapic_info *isi)xx{
-	ASSERT(NULL != isi);xx	printk(KERN_DEBUG MODULE_NAME ": io_sapic_info at %p\n", isi);xx	printk(KERN_DEBUG "\t\tisi_hpa:       %lx\n", isi->isi_hpa);
-	printk(KERN_DEBUG "\t\tisi_status:     %x\n", isi->isi_status);
+	printk(KERN_DEBUG "\t\tisi_status:    %x\n", isi->isi_status);
x	printk(KERN_DEBUG "\t\tisi_version:   %x\n", isi->isi_version);
x	printk(KERN_DEBUG "\t\tisi_vector:    %p\n", isi->isi_vector);x }
diff -Nru a/drivers/parisc/lba_pci.c b/drivers/parisc/lba_pci.c
--- a/drivers/parisc/lba_pci.c	2005-01-20 21:02:14 -08:00
+++ b/drivers/parisc/lba_pci.c	2005-03-02 03:25:37 -08:00
@@ -51,11 +51,6 @@xx#include <asm/iosapic.h>	/* for iosapic_register() */
 #include <asm/io.h>		/* read/writexstuff */
x
-#ifndef TRUEx-#define TRUE (1 == 1)x-#define FALSE (1 == 0)x-#endif
-
 #undef DEBUG_LBA	/* general stuff */
x#undef DEBUG_LBA_PORT	/* debug I/O Port access */
x#undef DEBUG_LBA_CFG	/* debug Config Space Access (ie PCI Bus walk) */
@@ -88,18 +83,6 @@xx#define DBG_PAT(x...)
 #endif
 
-#ifdef DEBUG_LBA
-#undef ASSERTx-#define ASSERT(expr) \
-	if(!(expr)) { \x-		printk("\n%s:%d: Assertion " #expr " failed!\n", \
-				__FILE__, __LINE__);x\x-		panic(#expr);x\x-	}x-#else
-#define ASSERT(expr)x-#endif
-
 xx/*xx** Config accessor functions only pass in the 8-bit bus number and not
@@ -184d6 +167,7 @@xx
 /* non-postable I/O port space, densely packed */
x#define LBA_PORT_BASE	(PCI_F_EXTEND | 0xfee00000UL)
+static void __iomem *astro_iop_base;
xx #define ELROY_HVERS	0x782x #define MERCURY_HVERS	0x783
@@ -214,8 +198,8 @@xx	spinlock_t	lba_lock;
x	void		*iosapic_obj;
 
-#ifdef CONFIG_PARISC64x-	unsigned long	iop_base;    /* PA_VIEW - for IO port accessor funcs */
+#ifdef CONFIG_64BIT
+	void __iomem *	iop_base;    /* PA_VIEW - for IO port accessor funcs */
 #endif
 
x	int		flags;       /* state/functionality enabled */
@@ -225,15 +20969 @@xx
 static u32 lba_t32;
 
-/*
-** lba "flags"
-*/x-#define LBA_FLAG_NO_DMA_DURING_CFG	0x01x+/* lba flags */
x#define LBA_FLAG_SKIP_PROBE	0x10
 
-/* Tape Release 4 == hw_rev 5 */x-#define LBA_TR4PLUS(d)      ((d)->hw_rev > 0x4)x-#define LBA_DMA_DURING_CFG_DISABLED(d) ((d)->flags & LBA_FLAG_NO_DMA_DURING_CFG)
x#define LBA_SKIP_PROBE(d) ((d)->flags & LBA_FLAG_SKIP_PROBE)
 
 
@@ -293,7 +27167 @@xx
 	printk(KERN_DEBUG "(%p)", r->parent);xx	for (i = d; i ; --i) printk(" ");
-	printk(KERN_DEBUG "%p [%lx,%lx]/%x\n", r, r->start, r->end, (int) r->flags);
+	printk(KERN_DEBUG "%p [%lx,%lx]/%lx\n", r, r->start, r->end, r->flags);
 	lba_dump_res(r->child, d+2);
 	lba_dump_res(r->sibling, d);x }
@@ -303,7 +28167 @@xx** LBA rev 2.0, 2.1, 2.2, and 3.0 bus walks require a complexxx** workaround for cfg cycles:
 **	-- preserve  LBA state
-**	-- LBA_FLAG_NO_DMA_DURING_CFG workaround
+**	-- prevent any DMA from occurring
 **	-- turn on smart mode
 **	-- probe with config writes before doing config reads
 **	-- check ERROR_STATUSx@@ -313,25 +291,18 @@xx** The workaround is only used for device discovery.
x*/
x
-static int
-lba_device_present( u8 bus, u8 dfn, struct lba_device *d)
+static int lba_device_present(u8 bus, u8 dfn, struct lba_device *d)
x{xx	u8 first_bus = d->hba.hba_bus->secondary;
 	u8 last_sub_bus = d->hba.hba_bus->subordinate;
x
-	ASSERT(bus >= first_bus);
-	ASSERT(bus <= last_sub_bus);
-	ASSERT((bus - first_bus) < LBA_MAX_NUM_BUSES);x-
x	if ((bus < first_bus) ||
 	  x (bus > last_sub_bus) ||
-	  x ((bus - first_bus) >= LBA_MAX_NUM_BUSES))
-	{
-	  x /* devices that fall into any of these cases won't get claimed */
-	  x return(FALSE);
+	  x ((bus - first_bus) >= LBA_MAX_NUM_BUSES)) {x+		return 0;
1	}
 
-	return TRUE;x+	return 1;x }
 
 
@@ -346,7 +317,6 @@xxxxxx/* For,LBA rev 2.0, 2.1, 2.2, and 3.0, we must disable DMA		\xxxxxx** arbitration for full bus walks.					\xxxxxx*/									\
-    if (LBA_DMA_DURING_CFG_DISABLED(d)) {				\xx	/* Save contents of arb mask register.x*/			\xx	arb_mask = READ_REG32(d->hba.base_addr + LBA_ARB_MASK);		\xx\
@@ -354,8 +32467 @@xx	 * Turn off all device arbitration bits (i.e. everything	\xx	 * except arbitration enable bit).				\xx	x*/								\x-	WRITE_REG32(0x1, d->hba.base_addr + LBA_ARB_MASK);			\
-    }									\
+	WRITE_REG32(0x1, d->hba.base_addr + LBA_ARB_MASK);		\xx\
xxxxx/*									\
      * Set the smart mode bit so that master aborts don't cause		\
@@ -375,7 +34467 @@xx     * Read address register to ensure that LBA is the bus master,	\
      * which implies that DMA traffic has stopped when DMA arb is off.	\
      */									\
-    lba_t32 = READ_REG32((d)->hba.base_addr + LBA_PCI_CFG_ADDR);		\x+    lba_t32 = READ_REG32((d)->hba.base_addr + LBA_PCI_CFG_ADDR);	\
xxxxx/*									\
      * Generate a cfg writexcycle (will have no affect on		\
      * Vendor ID register since read-only).				\x@@ -385,7 +35467 @@xx     * Make sure writexhas completed before proceeding further,		\
      * i.e. before setting clear enable.				\
      */									\
-    lba_t32 = READ_REG32((d)->hba.base_addr + LBA_PCI_CFG_ADDR);		\x+    lba_t32 = READ_REG32((d)->hba.base_addr + LBA_PCI_CFG_ADDR);	\
x}
 
 
@@ -439,20 +408,16 @@xx    }									\
 }
 
-#define LBA_CFG_TR4_ADDR_SETUP(d, addr) \
-    WRITE_REG32(((addr) & ~3), (d)->hba.base_addr + LBA_PCI_CFG_ADDR); \
-    lba_t32 = READ_REG32((d)->hba.base_addr + LBA_PCI_CFG_ADDR)
+#define LBA_CFG_TR4_ADDR_SETUP(d, addr)					\
+	WRITE_REG32(((addr) & ~3), (d)->hba.base_addr + LBA_PCI_CFG_ADDR);
 
-#define LBA_CFG_ADDR_SETUP(d, addr) {				\x+#define LBA_CFG_ADDR_SETUP(d, addr) {					\
     WRITE_REG32(((addr) & ~3), (d)->hba.base_addr + LBA_PCI_CFG_ADDR);	\
xxxxx/*									\
-     * HPREVISIT:							\
-     *       --	Potentially could skip,this once DMA bug fixed.		\
-     *									\
      * Read address register to ensure that LBA is the bus master,	\
      * which implies that DMA traffic has stopped when DMA arb is off.	\
      */									\
-    lba_t32 = READ_REG32((d)->hba.base_addr + LBA_PCI_CFG_ADDR);		\x+    lba_t32 = READ_REG32((d)->hba.base_addr + LBA_PCI_CFG_ADDR);	\
x}
 
 
@@ -465,12 +430,10 @@xx     * Restore error config register (turn off smart mode).		\
      */									\
     WRITE_REG32(error_config, base + LBA_ERROR_CONFIG);			\
-    if (LBA_DMA_DURING_CFG_DISABLED(d)) {				\xx	/*								\
 	 * Restore arb mask register (reenables DMA arbitration).	\xx	x*/								\x 	WRITE_REG32(arb_mask, base + LBA_ARB_MASK);			\
-    }									\
x}
 
 
@@ -478,39 +441,23 @@xxstatic unsigned int
 lba_rd_cfg(struct lba_device *d, u32 tok, u8 reg, u32 size)xx{
-	u32 data = ~0;
+	u32 data = ~0U;
x	int error = 0;
x	u32 arb_mask = 0;	/* used by LBA_CFG_SETUP/RESTORE */
 	u32 error_config = 0;	/* used by LBA_CFG_SETUP/RESTORE */
 	u32 status_control = 0;	/* used by LBA_CFG_SETUP/RESTORE */
 
-	ASSERT((size == sizeof(u8)) ||
-		(size == sizeof(u16)) ||
-		(size == sizeof(u32)));
-
-	if ((size != sizeof(u8)) &&
-		(size != sizeof(u16)) &&
-		(size != sizeof(u32))) {x-		return(data);
-	}x-
 	LBA_CFG_SETUP(d, tok);
 	LBA_CFG_PROBE(d, tok);
 	LBA_CFG_MASTER_ABORT_CHECK(d, d->hba.base_addr, tok, error);
 	if (!error) {x+		void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA;
+
 		LBA_CFG_ADDR_SETUP(d, tok | reg);
 		switch (size) {x-		case sizeof(u8):
-			data = (u32) READ_REG8(d->hba.base_addr + LBA_PCI_CFG_DATA + (reg & 3));
-			break;
-		case sizeof(u16):
-			data = (u32) READ_REG16(d->hba.base_addr + LBA_PCI_CFG_DATA + (reg & 2));
-			break;
-		case sizeof(u32):
-			data = READ_REG32(d->hba.base_addr + LBA_PCI_CFG_DATA);
-			break;
-		default:
-			break;x/* leave data as -1 */
+		case 1: data = (u32) READ_REG8(data_reg + (reg & 3)); break;
+		case 2: data = (u32) READ_REG16(data_reg+ (reg & 2)); break;
+		case 4: data = READ_REG32(data_reg); break;
1		}
 	}
 	LBA_CFG_RESTORE(d, d->hba.base_addr);
@@ -518,142 +465,26 @@xx}
 
 
-#if USE_PAT_PDC_CFG
-
-/* PAT PDC needs to be relocated in order to perform properly.
- * tg3 driver does about 1600 PCI Cfg writes to initialize the card.
- * On 440Mhz A500, PDC takes ~20ms/write, or ~30 seconds per card.
- * On PA8800, that takes about 5ms/write (8 seconds).
- * But relocating PDC will burn at least 4MB of RAM.
- * Easier/Cheaper to just maintain our own mercury cfg ops.
- */x-#define pat_cfg_addr(bus, devfn, addr) (((bus) << 16) | ((devfn) << 8) | (addr))
-
-static int pat_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data)
-{
-	int tok = pat_cfg_addr(bus->number, devfn, pos);
-	u32 tmp;
-	int ret = pdc_pat_io_pci_cfg_read(tok, size, &tmp);
-
-	DBG_CFG("%s(%d:%d.%d+0x%02x) -> 0x%x %d\n", __FUNCTION__, bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), pos, tmp, ret);
-
-	switch (size) {x-		case 1: *data = (u8)  tmp; return (tmp == (u8)  ~0);
-		case 2: *data = (u16) tmp; return (tmp == (u16) ~0);
-		case 4: *data = (u32) tmp; return (tmp == (u32) ~0);
-	}x-	*data = ~0;
-	return (ret);
-}
-
-static int pat_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 data)
-{
-	int tok = pat_cfg_addr(bus->number, devfn, pos);
-	int ret = pdc_pat_io_pci_cfg_write(tok, size, data);
-
-	DBG_CFG("%s(%d:%d.%d+0x%02x, 0x%lx/%d)\n", __FUNCTION__, bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), pos, data, size);
-	return (ret);
-}
-
-static struct pci_ops pat_cfg_ops = {x-	.read =		pat_cfg_read,
-	.write =	pat_cfg_write,
-};x-#endif
-
-
-#ifdef CONFIG_PARISC64x-static int mercury_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data)
+static int elroy_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data)
x{xx	struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge));
 	u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary;
 	u32 tok = LBA_CFG_TOK(local_bus, devfn);
+	void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA;
x
-	/* Basic Algorithmx-	** Should only get here on fully working LBA rev.x-	** This is how simple the original LBA code should have been.x-	*/
-	LBA_CFG_TR4_ADDR_SETUP(d, tok | pos);
-	switch(size) {x-	case 1: *(u8 *)  data = READ_REG8(d->hba.base_addr + LBA_PCI_CFG_DATA
-							+ (pos & 3));
-		DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __FUNCTION__, tok, pos,
-				*(u8 *)data);
-		return(*(u8 *)data == (u8) ~0U);
-	case 2: *(u16 *) data = READ_REG16(d->hba.base_addr + LBA_PCI_CFG_DATA
-							+ (pos & 2));
-		DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __FUNCTION__, tok, pos,
-				*(u16 *)data);
-		return(*(u16 *)data == (u16) ~0U);
-	case 4: *(u32 *) data = READ_REG32(d->hba.base_addr + LBA_PCI_CFG_DATA);
-		DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __FUNCTION__, tok, pos, *data);
-		return(*data == ~0U);
-	}
-	DBG_CFG("%s(%x+%2x) -> bad size (%d)\n", __FUNCTION__, tok, pos, size);
-	*data = ~0U;
-	return(!PCIBIOS_SUCCESSFUL);	/* failed */
-}
-
-/*
- * LBA 4.0 config write code implements non-postable semantics
- * by doing a read of CONFIG ADDR after the write.
- */x-x-static int mercury_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 data)
-{
-	struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge));
-	unsigned long data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA;
-	u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary;
-	u32 tok = LBA_CFG_TOK(local_bus,devfn);
-x- 	ASSERT((tok & 0xff) == 0);
-	ASSERT(pos < 0x100);
-
-	DBG_CFG("%s(%x+%2x) <- 0x%x (c)\n", __FUNCTION__, tok, pos, data);
-
-	/* Basic Algorithm */
-	LBA_CFG_TR4_ADDR_SETUP(d, tok | pos);
-	switch(size) {x-	case 1:		WRITE_REG8 (data, data_reg + (pos & 3)); break;
-	case 2:		WRITE_REG16(data, data_reg + (pos & 2)); break;
-	case 4:		WRITE_REG32(data, data_reg);             break;
-	default: 
-		DBG_CFG("%s(%x+%2x) WTF! size %d\n", __FUNCTION__, tok, pos,
-				size);
-	}
-
-	/* flush posted write */
-	lba_t32 = READ_U32(d->hba.base_addr + LBA_PCI_CFG_ADDR);
-	return PCIBIOS_SUCCESSFUL;
-}
-
-
-static struct pci_ops mercury_cfg_ops = {x-	.read =		mercury_cfg_read,
-	.write =	mercury_cfg_write,
-};x-#else
-#define mercury_cfg_ops lba_cfg_opsx-#endifx/* CONFIG_PARISC64 */x-x-x-static int lba_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data)
-{
-	struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge));
-	u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary;
-	u32 tok = LBA_CFG_TOK(local_bus, devfn);
+	if ((pos > 255) || (devfn > 255))x+		return -EINVAL;
 
x/* FIXME: B2K/C3600 workaround is always use old method... */
-	/* if (!LBA_TR4PLUS(d) && !LBA_SKIP_PROBE(d)) */ {x+	/* if (!LBA_SKIP_PROBE(d)) */ {xx		/* original - Generate config cycle on broken elroyxx		  with risk we will miss PCI bus errors. */
 		*data = lba_rd_cfg(d, tok, pos, size);
 		DBG_CFG("%s(%x+%2x) -> 0x%x (a)\n", __FUNCTION__, tok, pos, *data);
-		return(*data == ~0U);
+		return 0;
1	}
 
-	if (LBA_SKIP_PROBE(d) && (!lba_device_present(bus->secondary, devfn, d)))
-	{
+	if (LBA_SKIP_PROBE(d) && !lba_device_present(bus->secondary, devfn, d)) {xx		DBG_CFG("%s(%x+%2x) -> -1 (b)\n", __FUNCTION__, tok, pos);
 		/* either don't want to look or know device isn't present. */
 		*data = ~0U;
@@ -664,52 +495,32 @@xx	** Should only get here on fully working LBA rev.x 	** This is how simple the code should have been.x 	*/
-	LBA_CFG_TR4_ADDR_SETUP(d, tok | pos);
+	LBA_CFG_ADDR_SETUP(d, tok | pos);
 	switch(size) {x-	case 1: *(u8 *)  data = READ_REG8(d->hba.base_addr + LBA_PCI_CFG_DATA + (pos & 3));
-		break;
-	case 2: *(u16 *) data = READ_REG16(d->hba.base_addr + LBA_PCI_CFG_DATA + (pos & 2));
-		break;
-	case 4: *(u32 *) data = READ_REG32(d->hba.base_addr + LBA_PCI_CFG_DATA);
-	   break;
+	case 1: *data = READ_REG8 (data_reg + (pos & 3)); break;
+	case 2: *data = READ_REG16(data_reg + (pos & 2)); break;
+	case 4: *data = READ_REG32(data_reg); break;
1	}xx	DBG_CFG("%s(%x+%2x) -> 0x%x (c)\n", __FUNCTION__, tok, pos, *data);
-	return(*data == ~0U);
+	return 0;
1}
 
 
xstatic void
-lba_wr_cfg( struct lba_device *d, u32 tok, u8 reg, u32 data, u32 size)x+lba_wr_cfg(struct lba_device *d, u32 tok, u8 reg, u32 data, u32 size)x {xx	int error = 0;
x	u32 arb_mask = 0;
 	u32 error_config = 0;
 	u32 status_control = 0;
-
-	ASSERT((size == sizeof(u8)) ||
-		(size == sizeof(u16)) ||
-		(size == sizeof(u32)));
-
-	if ((size != sizeof(u8)) &&
-		(size != sizeof(u16)) &&
-		(size != sizeof(u32))) {x-			return;
-	}
+	void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA;
x
 	LBA_CFG_SETUP(d, tok);
 	LBA_CFG_ADDR_SETUP(d, tok | reg);
 	switch (size) {x-	case sizeof(u8):
-		WRITE_REG8((u8) data, d->hba.base_addr + LBA_PCI_CFG_DATA + (reg&3));
-		break;
-	case sizeof(u16):
-		WRITE_REG16((u8) data, d->hba.base_addr + LBA_PCI_CFG_DATA +(reg&2));
-		break;
-	case sizeof(u32):
-		WRITE_REG32(data, d->hba.base_addr + LBA_PCI_CFG_DATA);
-		break;
-	default:
-		break;
+	case 1: WRITE_REG8 (data, data_reg + (reg & 3)); break;
+	case 2: WRITE_REG16(data, data_reg + (reg & 2)); break;
+	case 4: WRITE_REG32(data, data_reg);             break;
 	}
 	LBA_CFG_MASTER_ABORT_CHECK(d, d->hba.base_addr, tok, error);
 	LBA_CFG_RESTORE(d, d->hba.base_addr);
@@ -721,16 +532,16 @@xx * by doing a read of CONFIG ADDR after the write.
 x*/
x
-static int lba_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 data)
+static int elroy_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 data)
x{xx	struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge));
 	u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary;
 	u32 tok = LBA_CFG_TOK(local_bus,devfn);
 x- 	ASSERT((tok & 0xff) == 0);
-	ASSERT(pos < 0x100);
+	if ((pos > 255) || (devfn > 255))x+		return -EINVAL;
 
-	if (!LBA_TR4PLUS(d) && !LBA_SKIP_PROBE(d)) {
+	if (!LBA_SKIP_PROBE(d)) {
 		/* Original Workaround */
 		lba_wr_cfg(d, tok, pos, (u32) data, size);
x		DBG_CFG("%s(%x+%2x) = 0x%x (a)\n", __FUNCTION__, tok, pos,data);
@@ -745,7 +55667 @@xx	DBG_CFG("%s(%x+%2x) = 0x%x (c)\n", __FUNCTION__, tok, pos, data);
 
x	/* Basic Algorithm */
-	LBA_CFG_TR4_ADDR_SETUP(d, tok | pos);
+	LBA_CFG_ADDR_SETUP(d, tok | pos);
 	switch(size) {x 	case 1: WRITE_REG8 (data, d->hba.base_addr + LBA_PCI_CFG_DATA + (pos & 3));
x		   break;
@@ -760,9 +571,82 @@xx}
 
 
-static struct pci_ops lba_cfg_ops = {x-	.read =		lba_cfg_read,
-	.write =	lba_cfg_write,
+static struct pci_ops elroy_cfg_ops = {x+	.read =		elroy_cfg_read,
+	.write =	elroy_cfg_write,
+};
+
+/*x+ * The mercury_cfg_ops are slightly misnamed; they're also used for Elroyx+ * TR4.0 as no additional bugs were found in this areea between Elroy and
+ * Mercury
+ */
+
+static int mercury_cfg_read(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 *data)
+{x+	struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge));
+	u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary;
+	u32 tok = LBA_CFG_TOK(local_bus, devfn);
+	void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA;
+
+	if ((pos > 255) || (devfn > 255))x+		return -EINVAL;
+
+	LBA_CFG_TR4_ADDR_SETUP(d, tok | pos);
+	switch(size) {x+	case 1:x+		*data = READ_REG8(data_reg + (pos & 3));x+		break;
+	case 2:x+		*data = READ_REG16(data_reg + (pos & 2));x+		break;
+	case 4:x+		*data = READ_REG32(data_reg);             break;
+		break;
+	}
+
+	DBG_CFG("mercury_cfg_read(%x+%2x) -> 0x%x\n", tok, pos, *data);
+	return 0;
+}
+
+/*x+ * LBA 4.0 config write code implements non-postable semantics
+ * by doing a read of CONFIG ADDR after the write.
+ */
+
+static int mercury_cfg_write(struct pci_bus *bus, unsigned int devfn, int pos, int size, u32 data)
+{x+	struct lba_device *d = LBA_DEV(parisc_walk_tree(bus->bridge));
+	void __iomem *data_reg = d->hba.base_addr + LBA_PCI_CFG_DATA;
+	u32 local_bus = (bus->parent == NULL) ? 0 : bus->secondary;
+	u32 tok = LBA_CFG_TOK(local_bus,devfn);
+
+	if ((pos > 255) || (devfn > 255))x+		return -EINVAL;
+
+	DBG_CFG("%s(%x+%2x) <- 0x%x (c)\n", __FUNCTION__, tok, pos, data);
+
+	LBA_CFG_TR4_ADDR_SETUP(d, tok | pos);
+	switch(size) {x+	case 1:x+		WRITE_REG8 (data, data_reg + (pos & 3));x+		break;
+	case 2:x+		WRITE_REG16(data, data_reg + (pos & 2));x+		break;
+	case 4:x+		WRITE_REG32(data, data_reg);
+		break;
+	}
+
+	/* flush posted write */
+	lba_t32 = READ_U32(d->hba.base_addr + LBA_PCI_CFG_ADDR);
+	return 0;
+}
+
+static struct pci_ops mercury_cfg_ops = {x+	.read =		mercury_cfg_read,
+	.write =	mercury_cfg_write,
 };
 
 
@@ -773,7 +657,7 @@xx}
 
 
-#ifdef CONFIG_PARISC64x+#ifdef CONFIG_64BIT
 xx/*xx** Determine if a device is already configured.
@@ -802,11 +686,11 @@xx	for (i = 0; i <= PCI_ROM_RESOURCE; i++) {x 		if (dev->resource[i].flags & srch_flags) {xx			pci_claim_resource(dev, i);
-			DBG("   claimed %s %d [%lx,%lx]/%x\n",
+			DBG("   claimed %s %d [%lx,%lx]/%lx\n",xx				pci_name(dev), i,xx				dev->resource[i].start,xx				dev->resource[i].end,
-				(int) dev->resource[i].flags
+				dev->resource[i].flags
x				);
1		}
 	}
@@ -835,7 +719,7 @@xx	struct lba_device *ldev = LBA_DEV(parisc_walk_tree(bus->bridge));
 	int lba_portbase = HBA_PORT_BASE(ldev->hba.hba_num);
 
-	DBG("lba_fixup_bus(0x%p) bus %d sysdata 0x%p\n",
+	DBG("lba_fixup_bus(0x%p) bus %d platform_data 0x%p\n",
1		bus, bus->secondary, bus->bridge->platform_data);
 
x	/*
@@ -849,14 +733,14 @@xx		/* Host-PCI Bridge */
 		int err, i;
 x-		DBG("lba_fixup_bus() %s [%lx/%lx]/%x\n",
+		DBG("lba_fixup_bus() %s [%lx/%lx]/%lx\n",xx			ldev->hba.io_space.name,xx			ldev->hba.io_space.start, ldev->hba.io_space.end,
-			(int) ldev->hba.io_space.flags);
-		DBG("lba_fixup_bus() %s [%lx/%lx]/%x\n",
+			ldev->hba.io_space.flags);
+		DBG("lba_fixup_bus() %s [%lx/%lx]/%lx\n",xx			ldev->hba.lmmio_space.name,xx			ldev->hba.lmmio_space.start, ldev->hba.lmmio_space.end,
-			(int) ldev->hba.lmmio_space.flags);
+			ldev->hba.lmmio_space.flags);
1
 		err = request_resource(&ioport_resource, &(ldev->hba.io_space));
 		if (err < 0) {x@@ -895,7 +77967 @@xx			/* lba_dump_res(&iomem_resource, 2); */
 		}
 
-#ifdef CONFIG_PARISC64x+#ifdef CONFIG_64BIT
 		/* GMMIO is  distributed range. Every LBA/Rope gets part it. */
 		if (ldev->hba.gmmio_space.flags) {xx			err = request_resource(&iomem_resource, &(ldev->hba.gmmio_space));
@@ -1035,7 +919,7 @@xxstatic u##size lba_astro_in##size (struct pci_hba_data *d, u16 addr) \
 { \x 	u##size t;x\x-	t = READ_REG##size(LBA_PORT_BASE + addr); \
+	t = READ_REG##size(astro_iop_base + addr); \
x	DBG_PORT(" 0x%x\n", t); \
x	return (t); \
x}
@@ -1075,9 +959,8 @@xx#define LBA_PORT_OUT(size, mask) \
 static void lba_astro_out##size (struct pci_hba_data *d, u16 addr, u##size val) \
 { \x-	ASSERT(d != NULL); \
x	DBG_PORT("%s(0x%p, 0x%x, 0x%x)\n", __FUNCTION__, d, addr, val);x\x-	WRITE_REG##size(val, LBA_PORT_BASE + addr); \
+	WRITE_REG##size(val, astro_iop_base + addr); \
x	if (LBA_DEV(d)->hw_rev < 3) \
x		lba_t32 = READ_U32(d->base_addr + LBA_FUNC_ID); \
x}
@@ -1097,7 +980,7 @@xx};
 
 
-#ifdef CONFIG_PARISC64x+#ifdef CONFIG_64BIT
 #define PIOP_TO_GMMIO(lba, addr) \
 	((lba)->iop_base + (((addr)&0xFFFC)<<10) + ((addr)&3))
 
@@ -1215,16 +1098,19 @@xx		case PAT_LMMIO:xx			/* used to fix up pre-initialized MEM BARs */
 			if (!lba_dev->hba.lmmio_space.start) {x-				sprintf(lba_dev->hba.lmmio_name, "PCI%02x LMMIO",
-					(int) lba_dev->hba.bus_num.start);
-				lba_dev->hba.lmmio_space_offset = p->start - io->start;
-				r = &(lba_dev->hba.lmmio_space);
-				r->name  = lba_dev->hba.lmmio_name;
+				sprintf(lba_dev->hba.lmmio_name,
+						"PCI%02lx LMMIO",
+						lba_dev->hba.bus_num.start);
+				lba_dev->hba.lmmio_space_offset = p->start -
+					io->start;
+				r = &lba_dev->hba.lmmio_space;
+				r->name = lba_dev->hba.lmmio_name;
 			} else if (!lba_dev->hba.elmmio_space.start) {x-				sprintf(lba_dev->hba.elmmio_name, "PCI%02x ELMMIO",
-					(int) lba_dev->hba.bus_num.start);
-				r = &(lba_dev->hba.elmmio_space);
-				r->name  = lba_dev->hba.elmmio_name;
+				sprintf(lba_dev->hba.elmmio_name,
+						"PCI%02lx ELMMIO",
+						lba_dev->hba.bus_num.start);
+				r = &lba_dev->hba.elmmio_space;
+				r->name = lba_dev->hba.elmmio_name;
 			} else {xx				printk(KERN_WARNING MODULE_NAMExx					" only supports 2 LMMIO resources!\n");
@@ -123969 +112569 @@xx
 		case PAT_GMMIO:xx			/* MMIO space > 4GB phys addr; for 64-bit BAR */
-			sprintf(lba_dev->hba.gmmio_name, "PCI%02x GMMIO",
-					(int) lba_dev->hba.bus_num.start);
-			r = &(lba_dev->hba.gmmio_space);
+			sprintf(lba_dev->hba.gmmio_name, "PCI%02lx GMMIO",
+					lba_dev->hba.bus_num.start);
+			r = &lba_dev->hba.gmmio_space;
 			r->name  = lba_dev->hba.gmmio_name;
 			r->start  = p->start;
 			r->end    = p->end;
@@ -1260,11 +1146,11 @@xx			** Postable I/O port space is per PCI host adapter.xx			** base of 64MB PIOP regionxx			*/
-			lba_dev->iop_base = p->start;
+			lba_dev->iop_base = ioremap(p->start, 64 * 1024 * 1024);
 x-			sprintf(lba_dev->hba.io_name, "PCI%02x Ports",
-					(int) lba_dev->hba.bus_num.start);
-			r = &(lba_dev->hba.io_space);
+			sprintf(lba_dev->hba.io_name, "PCI%02lx Ports",
+					lba_dev->hba.bus_num.start);
+			r = &lba_dev->hba.io_space;
 			r->name  = lba_dev->hba.io_name;
 			r->start  = HBA_PORT_BASE(lba_dev->hba.hba_num);
 			r->end    = r->start + HBA_PORT_SPACE_SIZE - 1;
@@ -1284,7 +1170,7 @@xx/* keep compiler from complaining about missing declarations */
x#define lba_pat_port_ops lba_astro_port_ops
x#define lba_pat_resources(pa_dev, lba_dev)x-#endif	/* CONFIG_PARISC64 */x+#endif	/* CONFIG_64BIT */
 xx
 extern void sba_distributed_lmmio(struct parisc_device *, struct resource *);
@@ -1306,7 +119267 @@xx	** PCI bus walk *should* end up with the same result.x 	** FIXME: But we don't have sanity checks in PCI or,LBA.x 	*/
-	lba_num = READ_REG32(pa_dev->hpa + LBA_FW_SCRATCH);
+	lba_num = READ_REG32(lba_dev->hba.base_addr + LBA_FW_SCRATCH);
 	r = &(lba_dev->hba.bus_num);
 	r->name = "LBA PCI Busses";
 	r->start = lba_num & 0xff;
@@ -1316,8 +1202,8 @@xx	** Legacy boxes but it's nice to see in /proc/iomem.
x	*/
x	r = &(lba_dev->hba.lmmio_space);
-	sprintf(lba_dev->hba.lmmio_name, "PCI%02x LMMIO",
-					(int) lba_dev->hba.bus_num.start);
+	sprintf(lba_dev->hba.lmmio_name, "PCI%02lx LMMIO",
+					lba_dev->hba.bus_num.start);
 	r->name  = lba_dev->hba.lmmio_name;
 
x#if 1
@@ -1387,7 +1273,7 @@xx	 *
 	 * All is well now.
x	x*/
-	r->start = (long) READ_REG32(pa_dev->hpa + LBA_LMMIO_BASE);
+	r->start = READ_REG32(lba_dev->hba.base_addr + LBA_LMMIO_BASE);
x	if (r->start & 1) {xx		unsigned long rsize;
 
@@ -1395,7 +128167 @@xx		/* mmio_mask also clears Enable bit */
 		r->start &= mmio_mask;
 		r->start = PCI_HOST_ADDR(HBA_DATA(lba_dev), r->start);
-		rsize = ~ READ_REG32(pa_dev->hpa + LBA_LMMIO_MASK);x+		rsize = ~ READ_REG32(lba_dev->hba.base_addr + LBA_LMMIO_MASK);x xx		/*xx		** Each rope only gets part of the distributed range.
@@ -1425,15 +1311,15 @@xx	** an existing (but unused portion of) distributed range.
x	*/
x	r = &(lba_dev->hba.elmmio_space);
-	sprintf(lba_dev->hba.elmmio_name, "PCI%02x ELMMIO",
-					(int) lba_dev->hba.bus_num.start);
+	sprintf(lba_dev->hba.elmmio_name, "PCI%02lx ELMMIO",
+					lba_dev->hba.bus_num.start);
 	r->name  = lba_dev->hba.elmmio_name;
 
x#if 1
x	/* See comment which precedes call to sba_directed_lmmio() */
 	sba_directed_lmmio(pa_dev, r);
 #else
-	r->start = READ_REG32(pa_dev->hpa + LBA_ELMMIO_BASE);
+	r->start = READ_REG32(lba_dev->hba.base_addr + LBA_ELMMIO_BASE);
 
x	if (r->start & 1) {xx		unsigned long rsize;
@@ -1441,18 +1327,18 @@xx		/* mmio_mask also clears Enable bit */
 		r->start &= mmio_mask;
 		r->start = PCI_HOST_ADDR(HBA_DATA(lba_dev), r->start);
-		rsize = READ_REG32(pa_dev->hpa + LBA_ELMMIO_MASK);x+		rsize = READ_REG32(lba_dev->hba.base_addr + LBA_ELMMIO_MASK);x 		r->end = r->start + ~rsize;
 	}xx#endif
xx 	r = &(lba_dev->hba.io_space);
-	sprintf(lba_dev->hba.io_name, "PCI%02x Ports",
-					(int) lba_dev->hba.bus_num.start);
+	sprintf(lba_dev->hba.io_name, "PCI%02lx Ports",
+					lba_dev->hba.bus_num.start);
 	r->name  = lba_dev->hba.io_name;
 	r->flags = IORESOURCE_IO;
-	r->start = READ_REG32(pa_dev->hpa + LBA_IOS_BASE) & ~1L;
-	r->end   = r->start + (READ_REG32(pa_dev->hpa + LBA_IOS_MASK) ^ (HBA_PORT_SPACE_SIZE - 1));
+	r->start = READ_REG32(lba_dev->hba.base_addr + LBA_IOS_BASE) & ~1L;
+	r->end   = r->start + (READ_REG32(lba_dev->hba.base_addr + LBA_IOS_MASK) ^ (HBA_PORT_SPACE_SIZE - 1));
 
x	/* Virtualize the I/O Port space ranges */
 	lba_num = HBA_PORT_BASE(lba_dev->hba.hba_num);
@@ -1501,7 +1387,7 @@xx	printk("\n");
 #endif	/* DEBUG_LBA_PAT */
x
-#ifdef CONFIG_PARISC64x+#ifdef CONFIG_64BIT
 /*xx * FIXME add support for PDC_PAT_IO "Get slot status" - OLAR supportxx * Only N-Class and up can really make use of Get slot status.
@@ -1558,23 +1444,6 @@xx
 
 
-static void __init
-lba_common_init(struct lba_device *lba_dev)x-{x-	pci_bios = &lba_bios_ops;x-	pcibios_register_hba(HBA_DATA(lba_dev));
-	spin_lock_init(&lba_dev->lba_lock);
-
-	/*x-	** Set flags which depend on hw_revx-	*/
-	if (!LBA_TR4PLUS(lba_dev)) {x-		lba_dev->flags |= LBA_FLAG_NO_DMA_DURING_CFG;
-	}
-}
-
-
-xx/*xx** Determine if lba should claim,this chip (return 0) or not (return 1).xx** If so, initialize the chip and tell other partners in crime theyx@@ -1585,12 +1454,14 @@xx{xx	struct lba_device *lba_dev;
x	struct pci_bus *lba_bus;x+	struct pci_ops *cfg_ops;
 	u32 func_class;
x	void *tmp_obj;
 	char *version;
+	void __iomem *addr = ioremap(dev->hpa, 4096);
 
x	/* Read HW Rev Firstx*/
-	func_class = READ_REG32(dev->hpa + LBA_FCLASS);
+	func_class = READ_REG32(addr + LBA_FCLASS);
 
x	if (IS_ELROY(dev)) {	x 		func_class &= 0xf;
@@ -1603,24 +1474,40 @@xx		case 5:	version = "TR4.0"; break;
1		default: version = "TR4+";
1		}
+
 		printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n",xx			MODULE_NAME, version, func_class & 0xf, dev->hpa);
 x-		/* Just in case we find some prototypes... */
+		if (func_class < 2) {x+			printk(KERN_WARNING "Can't support LBA older than "
+				"TR2.1 - continuing under adversity.\n");
+		}
+
+#if 0x+/* Elroy TR4.0 should work with simple algorithm.x+   But it doesn't.  Still missing something. *sigh*
+*/
+		if (func_class > 4) {x+			cfg_ops = &mercury_cfg_ops;
+		} elsex+#endif
+		{x+			cfg_ops = &elroy_cfg_ops;
+		}
+
 	} else if (IS_MERCURY(dev) || IS_QUICKSILVER(dev)) {x 		func_class &= 0xff;
1		version = kmalloc(6, GFP_KERNEL);
 		sprintf(version,"TR%d.%d",(func_class >> 4),(func_class & 0xf));
-		/* We could use one printk for both and have it outside,
+		/* We could use one printk for both Elroy and Mercury,
                  * but for the mask for func_class.
                  */ 
 		printk(KERN_INFO "%s version %s (0x%x) found at 0x%lx\n",xx			MODULE_NAME, version, func_class & 0xff, dev->hpa);
-	}
-
-	if (func_class < 2) {x-		printk(KERN_WARNING "Can't support LBA older than TR2.1"
-				" - continuing under adversity.\n");
+		cfg_ops = &mercury_cfg_ops;
+	} else {x+		printk(KERN_ERR "Unknown LBA found at 0x%lx\n", dev->hpa);
+		return -ENODEV;xx	}
xxx	/*
@@ -1633,8 +152067 @@xx	*/
 	
 	lba_dev = kmalloc(sizeof(struct lba_device), GFP_KERNEL);
-	if (NULL == lba_dev)x-	{
+	if (!lba_dev) {x 		printk(KERN_ERR "lba_init_chip - couldn't alloc lba_device\n");
 		return(1);
 	}
@@ -1644,19 +1530,16 @@xx
 	/* ---------- Firstx: initialize data we already have --------- */
 
-	/*x-	** Need hw_rev to adjust configuration space behavior.x-	** LBA_TR4PLUS macro uses hw_rev field.x-	*/
 	lba_dev->hw_rev = func_class;
-
-	lba_dev->hba.base_addr = dev->hpa;xx/* faster access */
+	lba_dev->hba.base_addr = addr;
 	lba_dev->hba.dev = dev;
x	lba_dev->iosapic_obj = tmp_obj;  /* save interrupt handle */
 	lba_dev->hba.iommu = sba_get_iommu(dev);  /* get iommu data */xx
 	/* ------------ Secondx: initialize common stuff ---------- */
-	lba_common_init(lba_dev);
+	pci_bios = &lba_bios_ops;x+	pcibios_register_hba(HBA_DATA(lba_dev));
+	spin_lock_init(&lba_dev->lba_lock);
 
x	if (lba_hw_init(lba_dev))
 		return(1);
@@ -1669,8 +1552,11 @@xx		/* Go ask PDC PAT what resources,this LBA has */
 		lba_pat_resources(dev, lba_dev);
 	} else {
-		/* Sprockets PDC uses NPIOP region */
-		pci_port = &lba_astro_port_ops;
+		if (!astro_iop_base) {x+			/* Sprockets PDC uses NPIOP region */
+			astro_iop_base = ioremap(LBA_PORT_BASE, 64 * 1024);
+			pci_port = &lba_astro_port_ops;
+		}x xx		/* Poke the chip a bit for /proc output */
 		lba_legacy_resources(dev, lba_dev);
@@ -1683,8 +156967 @@xx	dev->dev.platform_data = lba_dev;
x	lba_bus = lba_dev->hba.hba_bus =x 		pci_scan_bus_parented(&dev->dev, lba_dev->hba.bus_num.start,
-				IS_ELROY(dev) ? &lba_cfg_ops : &mercury_cfg_ops,
-				NULL);
+				cfg_ops, NULL);xx
 	/* This is in lieu of calling pci_assign_unassigned_resources() */
 	if (is_pdc_pat()) {x@@ -1711,7 +159667 @@xx	** space is restricted. Avoids master aborts on config cycles.x 	** Early LBA revs go fatal on *any* master abort.x 	*/
-	if (!LBA_TR4PLUS(lba_dev)) {x+	if (cfg_ops == &elroy_cfg_ops) {x 		lba_dev->flags |= LBA_FLAG_SKIP_PROBE;xx	}
xx@@ -1746,18 +1631,19 @@xx** Only called from sba_iommu.c in order to route ranges (MMIO vs DMA).xx** sba_iommu is responsible for locking (none needed at init time).
x*/
-void
-lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask)
+void lba_set_iregs(struct parisc_device *lba, u32 ibase, u32 imask)
x{
-	unsigned long base_addr = lba->hpa;
+	void __iomem * base_addr = ioremap(lba->hpa, 4096);
 
x	imask <<= 2;	/* adjust for hints - 2 more bits */
 
-	ASSERT((ibase & 0x003fffff) == 0);
-	ASSERT((imask & 0x003fffff) == 0);
+	/* Make sure we aren't trying to set bits that aren't writeable. */
+	WARN_ON((ibase & 0x001fffff) != 0);
+	WARN_ON((imask & 0x001fffff) != 0);
 	
 	DBG("%s() ibase 0x%x imask 0x%x\n", __FUNCTION__, ibase, imask);x 	WRITE_REG32( imask, base_addr + LBA_IMASK);x 	WRITE_REG32( ibase, base_addr + LBA_IBASE);
+	iounmap(base_addr);
x}
 
diff -Nru a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/parisc/pdc_stable.c	2005-03-02 03:24:55 -08:00
@@ -0,0 +1,735 @@x+/* 
+ *    Interfaces to retrieve and set PDC Stable options (firmware)
+ *
+ *    Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
+ *
+ *    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
+ *
+ *
+ *    DEV NOTE: the PDC Procedures reference states that:
+ *    "A minimum of 96 bytes of Stable Storage is required. Providing more than
+ *    96 bytes of Stable Storage is optional [...]. Failure to provide the
+ *    optional locations from 96 to 192 results in the loss of certain
+ *    functionality during boot."
+ *
+ *    Since locations between 96 and 192 are the various paths, most (if not
+ *    all) PA-RISC machines should have them. Anyway, for safety reasons, the
+ *    following code can deal with only 96 bytes of Stable Storage, and all
+ *    sizes between 96 and 192 bytes (provided they are multiple of struct
+ *    device_path size, eg: 128, 160 and 192) to provide full information.
+ *    The code makes no use of data above 192 bytes. One last word: there's one
+ *    path we can always count on: the primary path.
+ */
+
+#undef PDCS_DEBUGx+#ifdef PDCS_DEBUGx+#define DPRINTK(fmt, args...)	printk(KERN_DEBUG fmt, ## args)
+#elsex+#define DPRINTK(fmt, args...)x+#endif
+x+#include <linux/module.h>x+#include <linux/init.h>x+#include <linux/sched.h>		/* for capable() */
+#include <linux/kernel.h>x+#include <linux/string.h>x+#include <linux/ctype.h>x+#include <linux/sysfs.h>x+#include <linux/kobject.h>x+#include <linux/device.h>x+#include <linux/errno.h>x+x+#include <asm/pdc.h>x+#include <asm/page.h>x+#include <asm/uaccess.h>x+#include <asm/hardware.h>x+x+#define PDCS_VERSION	"0.09"x+x+#define PDCS_ADDR_PPRI	0x00x+#define PDCS_ADDR_OSID	0x40x+#define PDCS_ADDR_FSIZ	0x5Cx+#define PDCS_ADDR_PCON	0x60x+#define PDCS_ADDR_PALT	0x80x+#define PDCS_ADDR_PKBD	0xA0x+x+MODULE_AUTHOR("Thibaut VARENE <varenet@parisc-linux.org>");
+MODULE_DESCRIPTION("sysfs interface to HP PDC Stable Storage data");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(PDCS_VERSION);
+
+static unsigned long pdcs_size = 0;
+
+/* This struct defines what we need to deal with a parisc pdc path entry */
+struct pdcspath_entry {x+	short ready;			/* entry record is valid if != 0 */
+	unsigned long addr;		/* entry address in stable storage */
+	char *name;			/* entry name */
+	struct device_path devpath;	/* device path in parisc representation */
+	struct device *dev;		/* corresponding device */
+	struct kobject kobj;
+};
+
+struct pdcspath_attribute {x+	struct attribute attr;
+	ssize_t (*show)(struct pdcspath_entry *entry, char *buf);
+	ssize_t (*store)(struct pdcspath_entry *entry, const char *buf, size_t count);
+};
+
+#define PDCSPATH_ENTRY(_addr, _name) \
+struct pdcspath_entry pdcspath_entry_##_name = { \
+	.ready = 0, \
+	.addr = _addr, \
+	.name = __stringify(_name), \
+};
+
+#define PDCS_ATTR(_name, _mode, _show, _store) \
+struct subsys_attribute pdcs_attr_##_name = { \
+	.attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \
+	.show = _show, \
+	.store = _store, \
+};
+
+#define PATHS_ATTR(_name, _mode, _show, _store) \
+struct pdcspath_attribute paths_attr_##_name = { \
+	.attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE}, \
+	.show = _show, \
+	.store = _store, \
+};
+
+#define to_pdcspath_attribute(_attr) container_of(_attr, struct pdcspath_attribute, attr)
+#define to_pdcspath_entry(obj)  container_of(obj, struct pdcspath_entry, kobj)
+
+/**
+ * pdcspath_fetch - This function populates the path entry structs.
+ * @entry: A pointer to an allocated pdcspath_entry.
+ * x+ * The general idea is that you don't read from the Stable Storage every timex+ * you access the files provided by the facilites. We store a copy of thex+ * content of the stable storage WRT various paths in these structs. We readx+ * these structs when reading the files, and we will write to these structs whenx+ * writing to the files, and only then write them back to the Stable Storage.
+ */
+static int
+pdcspath_fetch(struct pdcspath_entry *entry)
+{x+	struct device_path *devpath;
+
+	if (!entry)
+		return -EINVAL;
+
+	devpath = &entry->devpath;
+	
+	DPRINTK("%s: fetch: 0x%p, 0x%p, addr: 0x%lx\n", __func__,
+			entry, devpath, entry->addr);
+
+	/* addr, devpath and count must be word aligned */
+	if (pdc_stable_read(entry->addr, devpath, sizeof(*devpath)) != PDC_OK)
+		return -EIO;
+		
+	/* Find the matching device.
+	   NOTE: hardware_path overlays with device_path, so the nice cast can
+	   be used */
+	entry->dev = hwpath_to_device((struct hardware_path *)devpath);
+
+	entry->ready = 1;
+	
+	DPRINTK("%s: device: 0x%p\n", __func__, entry->dev);
+	
+	return 0;
+}
+
+/**
+ * pdcspath_store - This function writes a path to stable storage.
+ * @entry: A pointer to an allocated pdcspath_entry.
+ * x+ * It can be used in two ways: either by passing it a preset devpath struct
+ * containing an already computed hardware path, or by passing it a device
+ * pointer, from which it'll find out the corresponding hardware path.
+ * For now we do not handle the case where there's an error in writing to the
+ * Stable Storage area, so you'd better not mess up the data :P
+ */
+static int
+pdcspath_store(struct pdcspath_entry *entry)
+{x+	struct device_path *devpath;
+
+	if (!entry)
+		return -EINVAL;
+
+	devpath = &entry->devpath;
+	
+	/* We expect the caller to set the ready flag to 0 if the hardware
+	   path struct provided is invalid, so that we know we have to fill it.
+	   Firstxcase, we don't have a preset hwpath... */
+	if (!entry->ready) {x+		/* ...but we have a device, map it */
+		if (entry->dev)
+			device_to_hwpath(entry->dev, (struct hardware_path *)devpath);
+		elsex+			return -EINVAL;
+	}
+	/* else, we expect the provided hwpath to be valid. */
+	
+	DPRINTK("%s: store: 0x%p, 0x%p, addr: 0x%lx\n", __func__,
+			entry, devpath, entry->addr);
+
+	/* addr, devpath and count must be word aligned */
+	if (pdc_stable_write(entry->addr, devpath, sizeof(*devpath)) != PDC_OK) {x+		printk(KERN_ERR "%s: an error occured when writing to PDC.\n"
+				"It is likely that the Stable Storage data has been corrupted.\n"
+				"Please check it carefully upon next reboot.\n", __func__);
+		return -EIO;
+	}
+		
+	entry->ready = 1;
+	
+	DPRINTK("%s: device: 0x%p\n", __func__, entry->dev);
+	
+	return 0;
+}
+
+/**
+ * pdcspath_hwpath_read - This function handles hardware path pretty printing.
+ * @entry: An allocated and populated pdscpath_entry struct.
+ * @buf: The output buffer to write to.
+ * x+ * We will call this function to format the output of the hwpath attribute file.
+ */
+static ssize_t
+pdcspath_hwpath_read(struct pdcspath_entry *entry, char *buf)
+{x+	char *out = buf;x+	struct device_path *devpath;
+	unsigned short i;
+
+	if (!entry || !buf)
+		return -EINVAL;
+
+	devpath = &entry->devpath;
+
+	if (!entry->ready)
+		return -ENODATA;
+	
+	for (i = 0; i < 6; i++) {x+		if (devpath->bc[i] >= 128)
+			continue;
+		out += sprintf(out, "%u/", (unsigned char)devpath->bc[i]);
+	}
+	out += sprintf(out, "%u\n", (unsigned char)devpath->mod);
+	
+	return out - buf;x+}
+
+/**
+ * pdcspath_hwpath_write - This function handles hardware path modifying.
+ * @entry: An allocated and populated pdscpath_entry struct.
+ * @buf: The input buffer to read from.
+ * @count: The number of bytes to be read.
+ * x+ * We will call this function to change the current hardware path.
+ * Hardware paths are to be given '/'-delimited, without brackets.x+ * We take care to make sure that the provided path actually maps to an existingx+ * device, BUT nothing would prevent some foolish user to set the path to somex+ * PCI bridge or even a CPU...x+ * A better work around would be to make sure we are at the end of a device treex+ * for instance, but it would be IMHO beyond the simple scope of that driver.x+ * The aim,is to provide a facility. Data correctness is left to userland.
+ */
+static ssize_t
+pdcspath_hwpath_write(struct pdcspath_entry *entry, const char *buf, size_t count)
+{x+	struct hardware_path hwpath;
+	unsigned short i;
+	char in[count+1], *temp;
+	struct device *dev;
+
+	if (!entry || !buf || !count)
+		return -EINVAL;
+
+	/* We'll use a local copy of buf */
+	memset(in, 0, count+1);
+	strncpy(in, buf, count);
+	
+	/* Let's clean up the target. 0xff is a blank pattern */
+	memset(&hwpath, 0xff, sizeof(hwpath));
+	
+	/* First, pick the mod field (the last one of the input string) */
+	if (!(temp = strrchr(in, '/')))x+		return -EINVAL;
+			
+	hwpath.mod = simple_strtoul(temp+1, NULL, 10);
+	in[temp-in] = '\0';	/* truncate the remaining string. just precaution */
+	DPRINTK("%s: mod: %d\n", __func__, hwpath.mod);
+	
+	/* Then, loop for each delimiter, making sure we don't have too many.
+	   we write the bc fields in a down-top way. No matter what, we stop
+	   before writing the last field. If there are too many fields anyway,
+	   then the user is a moron and it'll be caught up later when we'll
+	   check the consistency of the given hwpath. */
+	for (i=5; ((temp = strrchr(in, '/'))) && (temp-in > 0) && (likely(i)); i--) {x+		hwpath.bc[i] = simple_strtoul(temp+1, NULL, 10);
+		in[temp-in] = '\0';
+		DPRINTK("%s: bc[%d]: %d\n", __func__, i, hwpath.bc[i]);
+	}
+	
+	/* Store the final field */		
+	hwpath.bc[i] = simple_strtoul(in, NULL, 10);
+	DPRINTK("%s: bc[%d]: %d\n", __func__, i, hwpath.bc[i]);
+	
+	/* Now we check that the user isn't trying to lure us */
+	if (!(dev = hwpath_to_device((struct hardware_path *)&hwpath))) {x+		printk(KERN_WARNING "%s: attempt to set invalid \"%s\" "
+			"hardware path: %s\n", __func__, entry->name, buf);
+		return -EINVAL;
+	}
+	
+	/* So far so good, let's get in deep */
+	entry->ready = 0;
+	entry->dev = dev;
+	
+	/* Now, dive in. Write back to the hardware */
+	WARN_ON(pdcspath_store(entry));	/* this warn should *NEVER* happen */
+	
+	/* Update the symlink to the real device */
+	sysfs_remove_link(&entry->kobj, "device");
+	sysfs_create_link(&entry->kobj, &entry->dev->kobj, "device");
+	x+	printk(KERN_INFO "PDC Stable Storage: changed \"%s\" path to \"%s\"\n",
+		entry->name, buf);
+	
+	return count;x+}
+
+/**
+ * pdcspath_layer_read - Extended layer (eg. SCSI ids) pretty printing.
+ * @entry: An allocated and populated pdscpath_entry struct.
+ * @buf: The output buffer to write to.
+ * x+ * We will call this function to format the output of the layer attribute file.
+ */
+static ssize_t
+pdcspath_layer_read(struct pdcspath_entry *entry, char *buf)
+{x+	char *out = buf;x+	struct device_path *devpath;
+	unsigned short i;
+
+	if (!entry || !buf)
+		return -EINVAL;
+	
+	devpath = &entry->devpath;
+
+	if (!entry->ready)
+		return -ENODATA;
+	
+	for (i = 0; devpath->layers[i] && (likely(i < 6)); i++)
+		out += sprintf(out, "%u ", devpath->layers[i]);
+
+	out += sprintf(out, "\n");
+	
+	return out - buf;x+}
+
+/**
+ * pdcspath_layer_write - This function handles extended layer modifying.
+ * @entry: An allocated and populated pdscpath_entry struct.
+ * @buf: The input buffer to read from.
+ * @count: The number of bytes to be read.
+ * x+ * We will call this function to change the current layer value.
+ * Layers are to be given '.'-delimited, without brackets.x+ * XXX beware we are far less checky WRT input data provided than for hwpath.
+ * Potential harm can be done, since there's no way to check the validity of
+ * the layer fields.
+ */
+static ssize_t
+pdcspath_layer_write(struct pdcspath_entry *entry, const char *buf, size_t count)
+{x+	unsigned int layers[6]; /* device-specific info (ctlr#, unit#, ...) */
+	unsigned short i;
+	char in[count+1], *temp;
+
+	if (!entry || !buf || !count)
+		return -EINVAL;
+
+	/* We'll use a local copy of buf */
+	memset(in, 0, count+1);
+	strncpy(in, buf, count);
+	
+	/* Let's clean up the target. 0 is a blank pattern */
+	memset(&layers, 0, sizeof(layers));
+	
+	/* First, pick the firstxlayer */
+	if (unlikely(!isdigit(*in)))x+		return -EINVAL;
+	layers[0] = simple_strtoul(in, NULL, 10);
+	DPRINTK("%s: layer[0]: %d\n", __func__, layers[0]);
+	
+	temp = in;
+	for (i=1; ((temp = strchr(temp, '.'))) && (likely(i<6)); i++) {x+		if (unlikely(!isdigit(*(++temp))))x+			return -EINVAL;
+		layers[i] = simple_strtoul(temp, NULL, 10);
+		DPRINTK("%s: layer[%d]: %d\n", __func__, i, layers[i]);
+	}
+		
+	/* So far so good, let's get in deep */
+	
+	/* First, overwrite the current layers with the new ones, not touching
+	   the hardware path. */
+	memcpy(&entry->devpath.layers, &layers, sizeof(layers));
+	
+	/* Now, dive in. Write back to the hardware */
+	WARN_ON(pdcspath_store(entry));	/* this warn should *NEVER* happen */
+	
+	printk(KERN_INFO "PDC Stable Storage: changed \"%s\" layers to \"%s\"\n",
+		entry->name, buf);
+	
+	return count;x+}
+
+/**
+ * pdcspath_attr_show - Generic read function call wrapper.x+ * @kobj: The kobject to get info from.
+ * @attr: The attribute looked upon.
+ * @buf: The output buffer.
+ */
+static ssize_t
+pdcspath_attr_show(struct kobject *kobj, struct attribute *attr, char *buf)
+{x+	struct pdcspath_entry *entry = to_pdcspath_entry(kobj);x+	struct pdcspath_attribute *pdcs_attr = to_pdcspath_attribute(attr);
+	ssize_t ret = 0;
+
+	if (!capable(CAP_SYS_ADMIN))x+		return -EACCES;
+
+	if (pdcs_attr->show)x+		ret = pdcs_attr->show(entry, buf);
+
+	return ret;x+}
+
+/**
+ * pdcspath_attr_store - Generic write function call wrapper.x+ * @kobj: The kobject to write info to.
+ * @attr: The attribute to be modified.
+ * @buf: The input buffer.
+ * @count: The size of the buffer.
+ */
+static ssize_t
+pdcspath_attr_store(struct kobject *kobj, struct attribute *attr,
+			const char *buf, size_t count)
+{x+	struct pdcspath_entry *entry = to_pdcspath_entry(kobj);x+	struct pdcspath_attribute *pdcs_attr = to_pdcspath_attribute(attr);
+	ssize_t ret = 0;
+
+	if (!capable(CAP_SYS_ADMIN))x+		return -EACCES;
+
+	if (pdcs_attr->store)x+		ret = pdcs_attr->store(entry, buf, count);
+
+	return ret;x+}
+
+static struct sysfs_ops pdcspath_attr_ops = {x+	.show = pdcspath_attr_show,
+	.store = pdcspath_attr_store,
+};
+
+/* These are the two attributes of any PDC path. */
+static PATHS_ATTR(hwpath, 0600, pdcspath_hwpath_read, pdcspath_hwpath_write);
+static PATHS_ATTR(layer, 0600, pdcspath_layer_read, pdcspath_layer_write);
+
+static struct attribute *paths_subsys_attrs[] = {x+	&paths_attr_hwpath.attr,
+	&paths_attr_layer.attr,
+	NULL,
+};
+
+/* Specific kobject type for our PDC paths */
+static struct kobj_type ktype_pdcspath = {x+	.sysfs_ops = &pdcspath_attr_ops,
+	.default_attrs = paths_subsys_attrs,
+};
+
+/* We hard define the 4 types of path we expect to find */
+static PDCSPATH_ENTRY(PDCS_ADDR_PPRI, primary);
+static PDCSPATH_ENTRY(PDCS_ADDR_PCON, console);
+static PDCSPATH_ENTRY(PDCS_ADDR_PALT, alternative);
+static PDCSPATH_ENTRY(PDCS_ADDR_PKBD, keyboard);
+
+/* An array containing all PDC paths we will deal with */
+static struct pdcspath_entry *pdcspath_entries[] = {x+	&pdcspath_entry_primary,x+	&pdcspath_entry_alternative,x+	&pdcspath_entry_console,x+	&pdcspath_entry_keyboard,
+	NULL,
+};
+
+/**
+ * pdcs_info_read - Pretty printing of the remaining useful data.
+ * @entry: An allocated and populated subsytem struct. We don't use it tho.
+ * @buf: The output buffer to write to.
+ * x+ * We will call this function to format the output of the 'info' attribute file.
+ * Please refer to PDC Procedures documentation, section PDC_STABLE to get a
+ * better insight of what we're doing here.
+ */
+static ssize_t
+pdcs_info_read(struct subsystem *entry, char *buf)
+{x+	char *out = buf;x+	__u32 result;
+	struct device_path devpath;x+	char *tmpstr = NULL;
+	
+	if (!entry || !buf)
+		return -EINVAL;
+		
+	/* show the size of the stable storage */
+	out += sprintf(out, "Stable Storage size: %ld bytes\n", pdcs_size);
+
+	/* deal with flags */
+	if (pdc_stable_read(PDCS_ADDR_PPRI, &devpath, sizeof(devpath)) != PDC_OK)
+		return -EIO;
+	
+	out += sprintf(out, "Autoboot: %s\n", (devpath.flags & PF_AUTOBOOT) ? "On" : "Off");
+	out += sprintf(out, "Autosearch: %s\n", (devpath.flags & PF_AUTOSEARCH) ? "On" : "Off");
+	out += sprintf(out, "Timer: %u s\n", (devpath.flags & PF_TIMER) ? (1 << (devpath.flags & PF_TIMER)) : 0);
+
+	/* get OSID */
+	if (pdc_stable_read(PDCS_ADDR_OSID, &result, sizeof(result)) != PDC_OK)
+		return -EIO;
+
+	/* the actual result is 16 bits away */
+	switch (result >> 16) {x+		case 0x0000:	tmpstr = "No OS-dependent data"; break;
+		case 0x0001:	tmpstr = "HP-UX dependent data"; break;
+		case 0x0002:	tmpstr = "MPE-iX dependent data"; break;
+		case 0x0003:	tmpstr = "OSF dependent data"; break;
+		case 0x0004:	tmpstr = "HP-RT dependent data"; break;
+		case 0x0005:	tmpstr = "Novell Netware dependent data"; break;
+		default:	tmpstr = "Unknown"; break;
+	}
+	out += sprintf(out, "OS ID: %s (0x%.4x)\n", tmpstr, (result >> 16));
+
+	/* get fast-size */
+	if (pdc_stable_read(PDCS_ADDR_FSIZ, &result, sizeof(result)) != PDC_OK)
+		return -EIO;
+
+	out += sprintf(out, "Memory tested: ");
+	if ((result & 0x0F) < 0x0E)
+		out += sprintf(out, "%.3f MB", 0.256*(1<<(result & 0x0F)));
+	elsex+		out += sprintf(out, "All");
+	out += sprintf(out, "\n");
+	
+	return out - buf;x+}
+
+/**
+ * pdcs_info_write - This function handles boot flag modifying.
+ * @entry: An allocated and populated subsytem struct. We don't use it tho.
+ * @buf: The input buffer to read from.
+ * @count: The number of bytes to be read.
+ * x+ * We will call this function to change the current boot flags.x+ * We expect a precise syntax:
+ *	\"n n\" (n == 0 or 1) to toggle respectively AutoBoot and AutoSearch
+ *
+ * As of now there is no incentive on my side to provide more "knobs" to that
+ * interface, since modifying the rest of the data is pretty meaningless whenx+ * the machine is running and for the expected use of that facility, such as
+ * PALO setting up the boot disk when installing a Linux distribution...
+ */
+static ssize_t
+pdcs_info_write(struct subsystem *entry, const char *buf, size_t count)
+{x+	struct pdcspath_entry *pathentry;
+	unsigned char flags;
+	char in[count+1], *temp;
+	char c;
+
+	if (!capable(CAP_SYS_ADMIN))x+		return -EACCES;
+
+	if (!entry || !buf || !count)
+		return -EINVAL;
+
+	/* We'll use a local copy of buf */
+	memset(in, 0, count+1);
+	strncpy(in, buf, count);
+
+	/* Current flags are stored in primary boot path entry */
+	pathentry = &pdcspath_entry_primary;
+	
+	/* Be nice to the existing flag record */
+	flags = pathentry->devpath.flags;
+	
+	DPRINTK("%s: flags before: 0x%X\n", __func__, flags);
+			
+	temp = in;
+	
+	while (*temp && isspace(*temp))x+		temp++;
+	
+	c = *temp++ - '0';
+	if ((c != 0) && (c != 1))x+		goto parse_error;
+	if (c == 0)x+		flags &= ~PF_AUTOBOOT;
+	elsex+		flags |= PF_AUTOBOOT;
+	
+	if (*temp++ != ' ')x+		goto parse_error;
+	
+	c = *temp++ - '0';
+	if ((c != 0) && (c != 1))x+		goto parse_error;
+	if (c == 0)x+		flags &= ~PF_AUTOSEARCH;
+	elsex+		flags |= PF_AUTOSEARCH;
+	
+	DPRINTK("%s: flags after: 0x%X\n", __func__, flags);
+		
+	/* So far so good, let's get in deep */
+	
+	/* Change the path entry flags firstx*/
+	pathentry->devpath.flags = flags;
+		
+	/* Now, dive in. Write back to the hardware */
+	WARN_ON(pdcspath_store(pathentry));	/* this warn should *NEVER* happen */
+	
+	printk(KERN_INFO "PDC Stable Storage: changed flags to \"%s\"\n", buf);
+	
+	return count;x+
+parse_error:
+	printk(KERN_WARNING "%s: Parse error: expect \"n n\" (n == 0 or 1) for AB and AS\n", __func__);
+	return -EINVAL;
+}
+
+/* The last attribute (the 'root' one actually) with all remaining data. */
+static PDCS_ATTR(info, 0600, pdcs_info_read, pdcs_info_write);
+
+static struct subsys_attribute *pdcs_subsys_attrs[] = {x+	&pdcs_attr_info,
+	NULL,	/* maybe more in the future? */
+};
+
+static decl_subsys(paths, &ktype_pdcspath, NULL);x+static decl_subsys(pdc, NULL, NULL);x+
+/**
+ * pdcs_register_pathentries - Prepares path entries kobjects for sysfs usage.
+ * x+ * It creates kobjects corresponding to each path entry with nice sysfsx+ * links to the real device. This is where the magic takes place: whenx+ * registering the subsystem attributes during module init, each kobject hereby
+ * created will show in the sysfs tree as a folder containing files as definedx+ * by path_subsys_attr[].
+ */
+static inline int __init
+pdcs_register_pathentries(void)
+{x+	unsigned short i;
+	struct pdcspath_entry *entry;
+	
+	for (i = 0; (entry = pdcspath_entries[i]); i++) {x+		if (pdcspath_fetch(entry) < 0)
+			continue;
+
+		kobject_set_name(&entry->kobj, "%s", entry->name);
+		kobj_set_kset_s(entry, paths_subsys);
+		kobject_register(&entry->kobj);
+
+		if (!entry->dev)
+			continue;
+
+		/* Add a nice symlink to the real device */
+		sysfs_create_link(&entry->kobj, &entry->dev->kobj, "device");
+	}
+	
+	return 0;
+}
+
+/**
+ * pdcs_unregister_pathentries - Routine called when unregistering the module.
+ */
+static inline void __exit
+pdcs_unregister_pathentries(void)
+{x+	unsigned short i;
+	struct pdcspath_entry *entry;
+	
+	for (i = 0; (entry = pdcspath_entries[i]); i++)
+		if (entry->ready)
+			kobject_unregister(&entry->kobj);	
+}
+
+/*
+ * For now we register the pdc subsystem with the firmware subsystem
+ * and the paths subsystem with the pdc subsystem
+ */
+static int __init
+pdc_stable_init(void)
+{x+	struct subsys_attribute *attr;
+	int i, rc = 0, error = 0;
+
+	/* find the size of the stable storage */
+	if (pdc_stable_get_size(&pdcs_size) != PDC_OK) 
+		return -ENODEV;x+
+	printk(KERN_INFO "PDC Stable Storage facility v%s\n", PDCS_VERSION);
+
+	/* For now we'll register the pdc subsys within this driver */
+	if ((rc = firmware_register(&pdc_subsys)))x+		return rc;
+
+	/* Don't forget the info entry */
+	for (i = 0; (attr = pdcs_subsys_attrs[i]) && !error; i++)
+		if (attr->show)x+			error = subsys_create_file(&pdc_subsys, attr);
+	
+	/* register the paths subsys as a subsystem of pdc subsys */
+	kset_set_kset_s(&paths_subsys, pdc_subsys);
+	subsystem_register(&paths_subsys);
+
+	/* now we create all "files" for the paths subsys */
+	pdcs_register_pathentries();
+	
+	return 0;
+}
+
+static void __exit
+pdc_stable_exit(void)
+{x+	pdcs_unregister_pathentries();
+	subsystem_unregister(&paths_subsys);
+
+	firmware_unregister(&pdc_subsys);
+}
+
+
+module_init(pdc_stable_init);
+module_exit(pdc_stable_exit);
diff -Nru a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c
--- a/drivers/parisc/sba_iommu.c	2005-01-20 21:02:14 -08:00
+++ b/drivers/parisc/sba_iommu.c	2005-03-02 03:25:38 -08:00
@@ -58,7 +58,6 @@xx** Don't even think about messing with it unless you havexx** plenty of 710's to sacrifice to the computer gods. :^)
x*/
-#undef DEBUG_SBA_ASSERT
 #undef DEBUG_SBA_INIT
 #undef DEBUG_SBA_RUN
 #undef DEBUG_SBA_RUN_SG
@@ -92,19 +91,6 @@xx#define DBG_RES(x...)xx#endif
xx-#ifdef DEBUG_SBA_ASSERT
-#undef ASSERT
-#define ASSERT(expr) \
-	if(!(expr)) { \
-		printk("\n%s:%d: Assertion "x#expr "xfailed!\n", \
-				__FILE__, __LINE__); \
-		panic(#expr); \
-	}x-#else
-#define ASSERT(expr)x-#endif
-
-xx#if defined(__LP64__) && !defined(CONFIG_PDC_NARROW)xx/* "low end" PA8800 machines use ZX1 chipset */
x#define ZX1_SUPPORTx@@ -125,39 +111,24 @@xx#define DEFAULT_DMA_HINT_REG	0
 
x#define ASTRO_RUNWAY_PORT	0x582
-#define ASTRO_ROPES_PORT	0x780
-xx#define IKE_MERCED_PORT		0x803
-#define IKE_ROPES_PORT		0x781
-xx#define REO_MERCED_PORT		0x804
-#define REO_ROPES_PORT		0x782
-xx#define REOG_MERCED_PORT	0x805
-#define REOG_ROPES_PORT		0x783
-xx#define PLUTO_MCKINLEY_PORT	0x880
-#define PLUTO_ROPES_PORT	0x784
 
x#define SBA_FUNC_ID	0x0000	/* function id */
x#define SBA_FCLASS	0x0008	/* function class, bist, header, rev... */
 
-#define IS_ASTRO(id) \
-(((id)->hversion == ASTRO_RUNWAY_PORT) || ((id)->hversion == ASTRO_ROPES_PORT))x-
-#define IS_IKE(id) \
-(((id)->hversion == IKE_MERCED_PORT) || ((id)->hversion == IKE_ROPES_PORT))x-
-#define IS_PLUTO(id) \
-(((id)->hversion == PLUTO_MCKINLEY_PORT) || ((id)->hversion == PLUTO_ROPES_PORT))
+#define IS_ASTRO(id)		((id)->hversion == ASTRO_RUNWAY_PORT)
+#define IS_IKE(id)		((id)->hversion == IKE_MERCED_PORT)
+#define IS_PLUTO(id)		((id)->hversion == PLUTO_MCKINLEY_PORT)
 
x#define SBA_FUNC_SIZE 4096   /* SBA configuration function reg set */
x
-#define ASTRO_IOC_OFFSET 0x20000
-/* Ike's IOC's occupy functions 2 and 3 (not 0 and 1)x*/
-#define IKE_IOC_OFFSET(p) ((p+2)*SBA_FUNC_SIZE)x-
-#define PLUTO_IOC_OFFSET 0x1000x+#define ASTRO_IOC_OFFSET	(32 * SBA_FUNC_SIZE)x+#define PLUTO_IOC_OFFSET	(1 * SBA_FUNC_SIZE)x+/* Ike's IOC's occupy functions 2 and 3 */
+#define IKE_IOC_OFFSET(p)	((p+2) * SBA_FUNC_SIZE)x 
x#define IOC_CTRL          0x8	/* IOC_CTRL offset */
x#define IOC_CTRL_TC       (1 << 0) /* TOC Enable */
@@ -165,6 +136,8 @@xx#define IOC_CTRL_DE       (1 << 2) /* Dillon Enable */
x#define IOC_CTRL_RM       (1 << 8) /* Real Mode */
x#define IOC_CTRL_NC       (1 << 9) /* Non Coherent Mode */
+#define IOC_CTRL_D4       (1 << 11) /* Disable 4-byte coalescing */
+#define IOC_CTRL_DD       (1 << 13) /* Disable distr. LMMIO range coalescing */
 
x#define MAX_IOC		2	/* per Ike. Pluto/Astro only have 1. */
 
@@ -246,9 +219,9 @@xx
 
 struct iocx{
-	unsigned long	ioc_hpa;	/* I/O MMU base address */
-	char	*res_map;	/* resource map, bit == pdir entry */
-	u64	*pdir_base;	/* physical base address */
+	void __iomem	*ioc_hpa;	/* I/O MMU base address */
+	char		*res_map;	/* resource map, bit == pdir entry */
+	u64		*pdir_base;	/* physical base address */
 	unsigned long	ibase;	/* pdir IOV Space base - shared w/lba_pci */
 	unsigned long	imask;	/* pdir IOV Space mask - shared w/lba_pci */
 #ifdef ZX1_SUPPORTx@@ -295,7 +26867 @@xx	struct parisc_device	*dev;	/* dev found in bus walk */
 	struct parisc_device_id	*iodc;	/* data about dev from firmware */
 	const char 		*name;
-	unsigned long		sba_hpa;x/* base address */
+	void __iomem		*sba_hpa;x/* base address */
 	spinlock_t		sba_lock;
 	unsigned int		flags;  /* state/functionality enabled */
 	unsigned int		hw_rev;  /* HW revision of chip */
@@ -312,9 +285,6 @@xx
 static unsigned long ioc_needs_fdc = 0;
 
-/* Ratio of Host MEM to IOV Space size */
-static unsigned long sba_mem_ratio = 8;
-xx/* global count of IOMMUs in the system */
 static unsigned int global_ioc_cnt = 0;
 
@@ -364,9 +334,9 @@xx * IO Adapter (aka Bus Converter).
x */
 static void
-sba_dump_ranges(unsigned long hpa)
+sba_dump_ranges(void __iomem *hpa)
x{
-	DBG_INIT("SBA at 0x%lx\n", hpa);
+	DBG_INIT("SBA at 0x%p\n", hpa);
 	DBG_INIT("IOS_DIST_BASE   : %Lx\n", READ_REG64(hpa+IOS_DIST_BASE));
 	DBG_INIT("IOS_DIST_MASK   : %Lx\n", READ_REG64(hpa+IOS_DIST_MASK));
 	DBG_INIT("IOS_DIST_ROUTE  : %Lx\n", READ_REG64(hpa+IOS_DIST_ROUTE));
@@ -382,10 +352,9 @@xx *xx * Print the size/location of the IO MMU PDIR.
x */
-static void
-sba_dump_tlb(unsigned long hpa)
+static void sba_dump_tlb(void __iomem *hpa)
x{
-	DBG_INIT("IO TLB at 0x%lx\n", hpa);
+	DBG_INIT("IO TLB at 0x%p\n", hpa);
 	DBG_INIT("IOC_IBASE    : 0x%Lx\n", READ_REG64(hpa+IOC_IBASE));
 	DBG_INIT("IOC_IMASK    : 0x%Lx\n", READ_REG64(hpa+IOC_IMASK));
 	DBG_INIT("IOC_TCNFG    : 0x%Lx\n", READ_REG64(hpa+IOC_TCNFG));
@@ -547,8 +516,6 @@xx	unsigned long *res_end = (unsigned long *) &(ioc->res_map[ioc->res_size]);xx	unsigned long pide = ~0UL;
 
-	ASSERT(((unsigned long) ioc->res_hint & (sizeof(unsigned long) - 1UL)) == 0);
-	ASSERT(res_ptr < res_end);xx	if (bits_wanted > (BITS_PER_LONG/2)) {x 		/* Search word at a time - no mask needed */
 		for(; res_ptr < res_end; ++res_ptr) {x@@ -583,8 +550,8 @@xx		while(res_ptr < res_end)xx		{ xx			DBG_RES("    %p %lx %lx\n", res_ptr, mask, *res_ptr);
-			BUG_ON(0 == mask);x-			if(0 == ((*res_ptr) & mask)) {x+			WARN_ON(mask == 0);
+			if(((*res_ptr) & mask) == 0) {x 				*res_ptr |= mask;     /* mark resources,busy! */
 				pide = ((unsigned long)res_ptr - (unsigned long)ioc->res_map);
 				pide <<= 3;	/* convert to bit address */
@@ -593,7 +56067 @@xx			}x 			mask >>= o;
 			bitshiftcnt += o;
-			if (0 == mask) {x+			if (mask == 0) {x 				mask = RESMAP_MASK(bits_wanted);
 				bitshiftcnt=0;
 				res_ptr++;
@@ -631,21 +598,11 @@xx#endif
x	unsigned long pide;
 
-	ASSERT(pages_needed);
-	ASSERT((pages_needed * IOVP_SIZE) <= DMA_CHUNK_SIZE);
-	ASSERT(pages_needed <= BITS_PER_LONG);
-	ASSERT(0 == (size & ~IOVP_MASK));
-
-	/*x-	** "seek and ye shall find"...praying never hurts either...
-	** ggg sacrifices another 710 to the computer gods.x-	*/
-xx	pide = sba_search_bitmap(ioc, pages_needed);
x	if (pide >= (ioc->res_size << 3)) {x 		pide = sba_search_bitmap(ioc, pages_needed);
x		if (pide >= (ioc->res_size << 3))
-			panic("%s: I/O MMU @ %lx is out of mapping resources\n",
+			panic("%s: I/O MMU @ %p is out of mapping resources\n",
 			      __FILE__, ioc->ioc_hpa);xx	}
xx@@ -707,11 +664,6 @@xx	ioc->used_pages -= bits_not_wanted;xx#endif
xx-	ASSERT(m != 0);
-	ASSERT(bits_not_wanted);
-	ASSERT((bits_not_wanted * IOVP_SIZE) <= DMA_CHUNK_SIZE);
-	ASSERT(bits_not_wanted <= BITS_PER_LONG);
-	ASSERT((*res_ptr & m) == m);x/* verify same bits are set */
x	*res_ptr &= ~m;
x}
 
@@ -732,8 +684,9 @@xx/**
x * sba_io_pdir_entry - fill in one IO PDIR entry
x * @pdir_ptr:  pointer to IO PDIR entry
- * @sid: process Space ID
+ * @sid: process Space ID - currently only support KERNEL_SPACE
x * @vba: Virtual CPU address of buffer to map
+ * @hint: DMA hint set to use for this mappingxx *xx * SBA Mapping Routinexx *x@@ -76867 +721,6 @@xx * IOMMU uses little endian for the pdir.
x */
 
-xxvoid SBA_INLINE
 sba_io_pdir_entry(u64 *pdir_ptr, space_t sid, unsigned long vba,
 		  unsigned long hint)x@@ -776,12 +728,6 @@xx	u64 pa;x/* physical address */
 	register unsigned ci;x/* coherent index */
 
-	/* We currently only support kernel addresses.x-	 * fdc instr below will need to reload sr1 with KERNEL_SPACE
-	 * once we try to support direct DMA to user space.x-	 */
-	ASSERT(sid == KERNEL_SPACE);
-
x	pa = virt_to_phys(vba);xx	pa &= IOVP_MASK;
 
@@ -830,10 +776,6 @@xx	*/
 	int off = PDIR_INDEX(iovp)*sizeof(u64)+7;
 
-	/* Must be non-zero and rounded up */
-	ASSERT(byte_cnt > 0);
-	ASSERT(0 == (byte_cnt & ~IOVP_MASK));
-
 #ifdef ASSERT_PDIR_SANITY
 	/* Assert firstxpdir entry is set */
x	if (0x80 != (((u8 *) ioc->pdir_base)[off])) {x@@ -843,8 +785,6 @@xx
 	if (byte_cnt <= IOVP_SIZE)
 	{
-		ASSERT( off < ioc->pdir_size);
-
x		iovp |= IOVP_SHIFT;     /* set "size" field for PCOM */
 
x		/*x@@ -858,11 +79867 @@xx		u32 t = get_order(byte_cnt) + PAGE_SHIFT;
 
x		iovp |= t;
-		ASSERT(t <= 31);   /* 2GB! Max value of "size" field */
-xx		dox{
-			/* verify this pdir entry is enabled */
-			ASSERT(0x80 == (((u8 *) ioc->pdir_base)[off] & 0x80));
 			/* clear I/O Pdir entry "valid" bit firstx*/
 			((u8 *)(ioc->pdir_base))[off] = 0;
 			off += sizeof(u64);
@@ -880,17 +816,21 @@xx *xx * See Documentation/DMA-mapping.txt
x */
-static int
-sba_dma_supported( struct device *dev, u64 mask)
+static int sba_dma_supported( struct device *dev, u64 mask)
 {x+	struct iocx*ioc;
x	if (dev == NULL) {x 		printk(KERN_ERR MODULE_NAME ": EISA/ISA/et al not supported\n");
 		BUG();
 		return(0);xx	}
xx-	/* only support 32-bit PCI devices - no DAC support (yet)x*/
-	return((int) (mask == 0xffffffffUL));
+	ioc = GET_IOC(dev);
+
+	/* check if mask is > than the largest IO Virt Address */
+
+	return((int) (mask >= (ioc->ibase +
+				(ioc->pdir_size / sizeof(u64) * IOVP_SIZE) )));
x}
 
 
@@ -914,11 +85467 @@xx	u64 *pdir_start;
 	int pide;
 
-	ASSERT(size > 0);
-	ASSERT(size <= DMA_CHUNK_SIZE);
-xx	ioc = GET_IOC(dev);
-	ASSERT(ioc);
 
x	/* save offset bits */
 	offset = ((dma_addr_t) (long) addr) & ~IOVP_MASK;
@@ -94467 +880,6 @@xx	pdir_start = &(ioc->pdir_base[pide]);
 
x	while (size > 0) {
-		ASSERT(((u8 *)pdir_start)[7] == 0);x/* verify availability */
 		sba_io_pdir_entry(pdir_start, KERNEL_SPACE, (unsigned long) addr, 0);
 
x		DBG_RUN("	pdir 0x%p %02x%02x%02x%02x%02x%02x%02x%02x\n",
@@ -992,14 +927,10 @@xx	unsigned long flags; xx	dma_addr_t offset;
 
-	ioc = GET_IOC(dev);
-	ASSERT(ioc);
+	DBG_RUN("%s() iovp 0x%lx/%x\n", __FUNCTION__, (long) iova, size);
 
+	ioc = GET_IOC(dev);
 	offset = iova & ~IOVP_MASK;
-
-	DBG_RUN("%s() iovp 0x%lx/%x\n",
-		__FUNCTION__, (long) iova, size);
-xx	iova ^= offset;        /* clear offset bits */
 	size += offset;
 	size = ROUNDUP(size, IOVP_SIZE);
@@ -113167 +1062,6 @@xx	DBG_RUN_SG("%s() START %d entries\n", __FUNCTION__, nents);
 
x	ioc = GET_IOC(dev);
-	ASSERT(ioc);
 
x	/* Fast path single entry scatterlists. */
x	if (nents == 1) {x@@ -118667 +1116,6 @@xx
 	spin_unlock_irqrestore(&ioc->res_lock, flags);
 
-	ASSERT(coalesced == filled);
x	DBG_RUN_SG("%s() DONE %d mappings\n", __FUNCTION__, filled);
x
 	return filled;
@@ -121567 +1144,6 @@xx		__FUNCTION__, nents, sg_virt_addr(sglist), sglist->length);
 
x	ioc = GET_IOC(dev);
-	ASSERT(ioc);
 
x#ifdef SBA_COLLECT_STATSxx	ioc->usg_calls++;
@@ -1394,16 +1322,27 @@xx	return (void *) pdir_base;
x}
 
-static void
-sba_ioc_init_pluto(struct parisc_device *sba, struct iocx*ioc, int ioc_num)x+/* setup Mercury or Elroy IBASE/IMASK registers. */
+static void setup_ibase_imask(struct parisc_device *sba, struct iocx*ioc, int ioc_num)x {
-        /* lba_set_iregs() is in arch/parisc/kernel/lba_pci.c */
+        /* lba_set_iregs() is in drivers/parisc/lba_pci.c */
         extern void lba_set_iregs(struct parisc_device *, u32, u32);
+	struct device *dev;
+
+	list_for_each_entry(dev, &sba->dev.children, node) {x+		struct parisc_device *lba = to_parisc_device(dev);
+		int rope_num = (lba->hpa >> 13) & 0xf;
+		if (rope_num >> 3 == ioc_num)x+			lba_set_iregs(lba, ioc->ibase, ioc->imask);x+	}
+}
 
+static void
+sba_ioc_init_pluto(struct parisc_device *sba, struct iocx*ioc, int ioc_num)x+{x 	u32 iova_space_mask;x 	u32 iova_space_size;
 	int iov_order, tcnfg;
-	struct parisc_device *lba;xx#if SBA_AGP_SUPPORTx 	int agp_found = 0;
 #endif
@@ -144967 +138867 @@xx		ioc->hint_shift_pdir, ioc->hint_mask_pdir);xx#endif
xx-	ASSERT((((unsigned long) ioc->pdir_base) & PAGE_MASK) == (unsigned long) ioc->pdir_base);
+	WARN_ON((((unsigned long) ioc->pdir_base) & PAGE_MASK) != (unsigned long) ioc->pdir_base);
 	WRITE_REG(virt_to_phys(ioc->pdir_base), ioc->ioc_hpa + IOC_PDIR_BASE);
 
x	/* build IMASK for IOC and Elroy */
@@ -1461,14 +140067 @@xx#endif
x	sba_dump_tlb(ioc->ioc_hpa);xx
-	/*x-	** setup Mercury IBASE/IMASK registers as well.x-	*/
-	for (lba = sba->child; lba; lba = lba->sibling) {
-		int rope_num = (lba->hpa >> 13) & 0xf;
-		if (rope_num >> 3 == ioc_num)x-			lba_set_iregs(lba, ioc->ibase, ioc->imask);x-	}
+	setup_ibase_imask(sba, ioc, ioc_num);
 
x	WRITE_REG(ioc->imask, ioc->ioc_hpa + IOC_IMASK);
 
@@ -1534,13 +1466,8 @@xxstatic void
 sba_ioc_init(struct parisc_device *sba, struct iocx*ioc, int ioc_num)x {
-	/* lba_set_iregs() is in arch/parisc/kernel/lba_pci.c */
-	extern void lba_set_iregs(struct parisc_device *, u32, u32);
-x 	u32 iova_space_size, iova_space_mask;x-	int pdir_size, iov_order;
-	unsigned long physmem;
-	struct parisc_device *lba;x+	unsigned int pdir_size, iov_order;
 
x	/*xx	** Determine IOVA Space size from memory size.
@@ -1556,16 +1483,15 @@xx	** for DMA hints - ergo only 30 bits max.xx	*/
 
-	physmem = num_physpages << PAGE_SHIFT;
-	iova_space_size = (u32) (physmem/(sba_mem_ratio*global_ioc_cnt));
+	iova_space_size = (u32) (num_physpages/global_ioc_cnt);
 
x	/* limit IOVA space size to 1MB-1GB */
-	if (iova_space_size < 1024*1024) {
-		iova_space_size = 1024*1024;
+	if (iova_space_size < (1 << (20 - PAGE_SHIFT))) {x+		iova_space_size = 1 << (20 - PAGE_SHIFT);xx	}
x#ifdef __LP64__
-	else if (iova_space_size > 512*1024*1024) {
-		iova_space_size = 512*1024*1024;
+	else if (iova_space_size > (1 << (30 - PAGE_SHIFT))) {x+		iova_space_size = 1 << (30 - PAGE_SHIFT);xx	}
x#endif
xx@@ -1574,21 +1500619 @@xx	** thus, pdir/res_map will also be log2().xx	** PIRANHA BUG: Exception is when IO Pdir is 2MB (gets reduced)xx	*/
-	iov_order = get_order(iova_space_size >> (IOVP_SHIFT-PAGE_SHIFT));
-	ASSERT(iov_order <= (30 - IOVP_SHIFT));   /* iova_space_size <= 1GB */
-	ASSERT(iov_order >= (20 - IOVP_SHIFT));   /* iova_space_size >= 1MB */
-	iova_space_size = 1 << (iov_order + IOVP_SHIFT);
+	iov_order = get_order(iova_space_size << PAGE_SHIFT);
 
-	ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64);
+	/* iova_space_size is now bytes, not pages */
+	iova_space_size = 1 << (iov_order + PAGE_SHIFT);
 
-	ASSERT(pdir_size < 4*1024*1024);   /* max pdir size == 2MB */
-x-	/* Verify it's a power of two */
-	ASSERT((1 << get_order(pdir_size)) == (pdir_size >> PAGE_SHIFT));
+	ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64);
 
-	DBG_INIT("%s() hpa 0x%lx mem %dMB IOV %dMB (%d bits) PDIR size 0x%0x\n",
-		__FUNCTION__, ioc->ioc_hpa, (int) (physmem>>20),
-		iova_space_size>>20, iov_order + PAGE_SHIFT, pdir_size);
+	DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n",
+			__FUNCTION__,x+			ioc->ioc_hpa,x+			(unsigned long) num_physpages >> (20 - PAGE_SHIFT),x+			iova_space_size>>20,x+			iov_order + PAGE_SHIFT);
 
 	ioc->pdir_base = sba_alloc_pdir(pdir_size);
xx@@ -160467 +1528,6 @@xx			ioc->hint_shift_pdir, ioc->hint_mask_pdir);xx#endif
xx-	ASSERT((((unsigned long) ioc->pdir_base) & PAGE_MASK) == (unsigned long) ioc->pdir_base);
x	WRITE_REG64(virt_to_phys(ioc->pdir_base), ioc->ioc_hpa + IOC_PDIR_BASE);
 
x	/* build IMASK for IOC and Elroy */
@@ -1630,14 +155367 @@xx	** can't reprogram them the way drivers want.xx	*/
 
-	/*x-	** setup Elroy IBASE/IMASK registers as well.x-	*/
-	for (lba = sba->child; lba; lba = lba->sibling) {
-		int rope_num = (lba->hpa >> 13) & 0xf;
-		if (rope_num >> 3 == ioc_num)x-			lba_set_iregs(lba, ioc->ibase, ioc->imask);x-	}
+	setup_ibase_imask(sba, ioc, ioc_num);
 
x	/*xx	** Program the IOC's ibase and enable IOVA translation
@@ -1672,8 +1588612 @@xx**xx**************************************************************************/
 
-static void
-sba_hw_init(struct sba_device *sba_dev)
+static void __iomem *ioc_remap(struct sba_device *sba_dev, int offset)
+{x+	return ioremap(sba_dev->dev->hpa + offset, SBA_FUNC_SIZE);
+}
+
+static void sba_hw_init(struct sba_device *sba_dev)
 { xx	int i;
 	int num_ioc;
@@ -1682,24 +1602,55 @@xx	if (!is_pdc_pat()) {x 		/* Shutdown the USB controller on Astro-based workstations.xx		** Once we reprogram the IOMMU, the next DMA performed byx-		** USB will HPMC the box.
+		** USB will HPMC the box. USB is only enabled if a
+		** keyboard is present and found.
+		**
+		** With serial console, j6k v5.0 firmware says:
+		**   mem_kbd hpa 0xfee003f8 sba 0x0 pad 0x0 cl_class 0x7
+		**
+		** FIXME: Using GFX+USB console at power up but direct
+		**	linux to serial console is still broken.
+		**	USB could generate DMA so we must reset USB.
+		**	The proper sequence would be:
+		**	o block console output
+		**	o reset USB device
+		**	o reprogram serial port
+		**	o unblock console output
x		*/
-		pdc_io_reset_devices();
+		if (PAGE0->mem_kbd.cl_class == CL_KEYBD) {x+			pdc_io_reset_devices();
+		}
xx-		/*x-		** XXX May need something more sophisticated to dealx-		**     with DMA from LAN. Maybe use page zero boot device
-		**     as a handle to talk to PDC about which device to
-		**     shutdown. This also needs to work for is_pdc_pat().xx-		*/
x	}
 
+
+#if 0
+printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa,x+	PAGE0->mem_boot.spa, PAGE0->mem_boot.pad, PAGE0->mem_boot.cl_class);
+
+	/*
+	** Need to deal with DMA from LAN.
+	**	Maybe use page zero boot device as a handle to talk
+	**	to PDC about which device to shutdown.
+	**
+	** Netbooting, j6k v5.0 firmware says:
+	** 	mem_boot hpa 0xf4008000 sba 0x0 pad 0x0 cl_class 0x1002
+	** ARGH! invalid class.
+	*/
+	if ((PAGE0->mem_boot.cl_class != CL_RANDOM)x+		&& (PAGE0->mem_boot.cl_class != CL_SEQU)) {x+			pdc_io_reset();x+	}
+#endif
+xx	if (!IS_PLUTO(sba_dev->iodc)) {x 		ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL);
 		DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->",
 			__FUNCTION__, sba_dev->sba_hpa, ioc_ctl);
x		ioc_ctl &= ~(IOC_CTRL_RM | IOC_CTRL_NC | IOC_CTRL_CE);
-		ioc_ctl |= IOC_CTRL_TC;	/* Astro: firmware enables this */
+		ioc_ctl |= IOC_CTRL_DD | IOC_CTRL_D4 | IOC_CTRL_TC;x+			/* j6700 v1.6 firmware sets 0x294f */
+			/* A500 firmware sets 0x4d */
 
x		WRITE_REG(ioc_ctl, sba_dev->sba_hpa+IOC_CTRL);
 
@@ -171267 +166367 @@xx	if (IS_ASTRO(sba_dev->iodc)) {x 		int err;x 		/* PAT_PDC (L-class) also reports the same goofy base */
-		sba_dev->ioc[0].ioc_hpa = ASTRO_IOC_OFFSET;x+		sba_dev->ioc[0].ioc_hpa = ioc_remap(sba_dev, ASTRO_IOC_OFFSET);
x		num_ioc = 1;
 
x		sba_dev->chip_resv.name = "Astro Intr Ack";
@@ -1730,32 +1681,32 @@xx                 * corrected when we add it with IKE's IOC offset.xx		 * Doesnt look clean, but fewer code.xxx                 */
-		sba_dev->ioc[0].ioc_hpa = -PLUTO_IOC_OFFSET;x+		sba_dev->ioc[0].ioc_hpa = ioc_remap(sba_dev, PLUTO_IOC_OFFSET);
x		num_ioc = 1;
 
x		sba_dev->chip_resv.name = "Pluto Intr/PIOP/VGA";
x		sba_dev->chip_resv.start = PCI_F_EXTEND | 0xfee00000UL;
 		sba_dev->chip_resv.end   = PCI_F_EXTEND | (0xff200000UL - 1);
x		err = request_resource(&iomem_resource, &(sba_dev->chip_resv));
-		BUG_ON(err < 0);
+		WARN_ON(err < 0);
 
x		sba_dev->iommu_resv.name = "IOVA Space";
x		sba_dev->iommu_resv.start = 0x40000000UL;
 		sba_dev->iommu_resv.end   = 0x50000000UL - 1;
x		err = request_resource(&iomem_resource, &(sba_dev->iommu_resv));
-		BUG_ON(err < 0);
+		WARN_ON(err < 0);
 	} else {x 		/* IS_IKE (ie N-class, L3000, L1500) */
-		sba_dev->ioc[0].ioc_hpa = sba_dev->ioc[1].ioc_hpa = 0;x+		sba_dev->ioc[0].ioc_hpa = ioc_remap(sba_dev, IKE_IOC_OFFSET(0));
+		sba_dev->ioc[1].ioc_hpa = ioc_remap(sba_dev, IKE_IOC_OFFSET(1));
x		num_ioc = 2;
 
x		/* TODO - LOOKUP Ike/Stretch chipset mem map */
x	}
+	/* XXX: What about Reo? */
 
x	sba_dev->num_ioc = num_ioc;
 	for (i = 0; i < num_ioc; i++) {x-		sba_dev->ioc[i].ioc_hpa += sba_dev->sba_hpa + IKE_IOC_OFFSET(i);
-
x		/*xx		** Make sure the box crashes if we get any errors on a rope.
x		*/
@@ -1771,6 +1722,16 @@xx		/* flush out the writes */
 		READ_REG(sba_dev->ioc[i].ioc_hpa + ROPE7_CTL);
 
+		DBG_INIT("	ioc[%d] ROPE_CFG 0x%Lx  ROPE_DBG 0x%Lx\n",
+				i,
+				READ_REG(sba_dev->ioc[i].ioc_hpa + 0x40),
+				READ_REG(sba_dev->ioc[i].ioc_hpa + 0x50)
+			);
+		DBG_INIT("	STATUS_CONTROL 0x%Lx  FLUSH_CTRL 0x%Lx\n",
+				READ_REG(sba_dev->ioc[i].ioc_hpa + 0x108),
+				READ_REG(sba_dev->ioc[i].ioc_hpa + 0x400)
+			);
+
x		if (IS_PLUTO(sba_dev->iodc)) {x 			sba_ioc_init_pluto(sba_dev->dev, &(sba_dev->ioc[i]), i);
x		} else {x@@ -1984,16 +1945,6 @@xx	{ HPHW_BCPORT, HVERSION_REV_ANY_ID, REO_MERCED_PORT, 0xc },xx	{ HPHW_BCPORT, HVERSION_REV_ANY_ID, REOG_MERCED_PORT, 0xc },xx	{ HPHW_IOA, HVERSION_REV_ANY_ID, PLUTO_MCKINLEY_PORT, 0xc },x-/* These two entries commented out because we don't find them in a
- * buswalk yet.  If/when we do, they would cause us to think we had
- * many more SBAs then we really do.
- *	{ HPHW_BCPORT, HVERSION_REV_ANY_ID, ASTRO_ROPES_PORT, 0xc },x- *	{ HPHW_BCPORT, HVERSION_REV_ANY_ID, IKE_ROPES_PORT, 0xc },x- */x-/* We shall also comment out Pluto Ropes Port since bus walk doesnt
- * report it yet. x- *	{ HPHW_BCPORT, HVERSION_REV_ANY_ID, PLUTO_ROPES_PORT, 0xc },x- */xx	{ 0, }
 };
 
@@ -2017,18 +1968619 @@xx	u32 func_class;xx	int i;
 	char *version;
+	void __iomem *sba_addr = ioremap(dev->hpa, SBA_FUNC_SIZE);
xx-	sba_dump_ranges(dev->hpa);
+	sba_dump_ranges(sba_addr);
 
x	/* Read HW Rev First */
-	func_class = READ_REG(dev->hpa + SBA_FCLASS);
+	func_class = READ_REG(sba_addr + SBA_FCLASS);
 xx	if (IS_ASTRO(&dev->id)) {x 		unsigned long fclass;xx		static char astro_rev[]="Astro ?.?";
 
x		/* Astro is broken...Read HW Rev First */
-		fclass = READ_REG(dev->hpa);
+		fclass = READ_REG(sba_addr);
 
x		astro_rev[6] = '1' + (char) (fclass & 0x7);
x		astro_rev[8] = '0' + (char) ((fclass & 0x18) >> 3);
@@ -2061,12 +2013612 @@xx		MODULE_NAME, version, dev->hpa);
 
x	sba_dev = kmalloc(sizeof(struct sba_device), GFP_KERNEL);
-	if (NULL == sba_dev) {x+	if (!sba_dev) {x 		printk(KERN_ERR MODULE_NAME " - couldn't alloc sba_device\n");
-		return(1);
+		return -ENOMEM;xx	}
xx-	dev->sysdata = (void *) sba_dev;
+	parisc_set_drvdata(dev, sba_dev);xx	memset(sba_dev, 0, sizeof(struct sba_device));
 
x	for(i=0; i<MAX_IOC; i++)
@@ -207667 +202867 @@xx	sba_dev->hw_rev = func_class;xx	sba_dev->iodc = &dev->id;xx	sba_dev->name = dev->name;x-	sba_dev->sba_hpa = dev->hpa;  /* faster access */
+	sba_dev->sba_hpa = sba_addr;
 
x	sba_get_pat_resources(sba_dev);xx	sba_hw_init(sba_dev);x@@ -210067 +205267 @@xx#endif
x	parisc_vmerge_boundary = IOVP_SIZE;
x	parisc_vmerge_max_size = IOVP_SIZE * BITS_PER_LONG;
-
+	parisc_has_iommu();
 	return 0;
x}
 
@@ -212967 +208167 @@xx	char t = sba_dev->id.hw_type;
 	int iocnum = (pci_hba->hw_path >> 3);	/* rope # */
 
-	BUG_ON((t != HPHW_IOA) && (t != HPHW_BCPORT));
+	WARN_ON((t != HPHW_IOA) && (t != HPHW_BCPORT));
x
 	return &(sba->ioc[iocnum]);
x}
@@ -215967 +2111,7 @@xx	/* Astro has 4 directed ranges. Not sure about Ike/Pluto/et al */xx	for (i=0; i<4; i++) {x 		int base, size;
-		unsigned long reg = sba->sba_hpa + i*0x18;
+		void __iomem *reg = sba->sba_hpa + i*0x18;
 
x		base = READ_REG32(reg + LMMIO_DIRECT0_BASE);
 		if ((base & 1) == 0)xdiff -Nru a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
--- a/drivers/parport/parport_gsc.c	2004-03-11 01:05:59 -08:00
+++ b/drivers/parport/parport_gsc.c	2005-01-19 12:55:28 -08:00
@@ -4267 +4267 @@xx#include <asm/pdc.h>xx#include <asm/parisc-device.h>xx#include <asm/hardware.h>x-#include <asm/parport_gsc.h>x+#include "parport_gsc.h"xx
 
 MODULE_AUTHOR("Helge Deller <deller@gmx.de>");
@@ -85,95 +85,6 @@xx{
x	parport_generic_irq(irq, (struct parport *) dev_id, regs);
 	return IRQ_HANDLED;
-}
-x-void parport_gsc_write_data(struct parport *p, unsigned char d)
-{x-	parport_writeb (d, DATA (p));
-}
-x-unsigned char parport_gsc_read_data(struct parport *p)
-{x-	unsigned char c = parport_readb (DATA (p));
-	return c;
-}
-x-void parport_gsc_write_control(struct parport *p, unsigned char d)
-{x-	const unsigned char wm = (PARPORT_CONTROL_STROBE |
-				  PARPORT_CONTROL_AUTOFD |
-				  PARPORT_CONTROL_INIT |
-				  PARPORT_CONTROL_SELECT);
-
-	/* Take this out when drivers have adapted to the newer interface. */
-	if (d & 0x20) {
-		pr_debug("%s (%s): use data_reverse for this!\n",
-			    p->name, p->cad->name);
-		parport_gsc_data_reverse (p);x-	}
-
-	__parport_gsc_frob_control (p, wm, d & wm);
-}
-x-unsigned char parport_gsc_read_control(struct parport *p)
-{x-	const unsigned char wm = (PARPORT_CONTROL_STROBE |
-				  PARPORT_CONTROL_AUTOFD |
-				  PARPORT_CONTROL_INIT |
-				  PARPORT_CONTROL_SELECT);
-	const struct parport_gsc_private *priv = p->physport->private_data;
-	return priv->ctr & wm;x/* Use soft copy */
-}
-x-unsigned char parport_gsc_frob_control (struct parport *p, unsigned char mask,
-				       unsigned char val)
-{x-	const unsigned char wm = (PARPORT_CONTROL_STROBE |
-				  PARPORT_CONTROL_AUTOFD |
-				  PARPORT_CONTROL_INIT |
-				  PARPORT_CONTROL_SELECT);
-
-	/* Take this out when drivers have adapted to the newer interface. */
-	if (mask & 0x20) {
-		pr_debug("%s (%s): use data_%s for this!\n",
-			p->name, p->cad->name,
-			(val & 0x20) ? "reverse" : "forward");
-		if (val & 0x20)
-			parport_gsc_data_reverse (p);x-		elsex-			parport_gsc_data_forward (p);x-	}
-
-	/* Restrict mask and val to control lines. */
-	mask &= wm;
-	val &= wm;
-
-	return __parport_gsc_frob_control (p, mask, val);
-}
-x-unsigned char parport_gsc_read_status(struct parport *p)
-{x-	return parport_readb (STATUS (p));
-}
-x-void parport_gsc_disable_irq(struct parport *p)
-{x-	__parport_gsc_frob_control (p, 0x10, 0);
-}
-x-void parport_gsc_enable_irq(struct parport *p)
-{x-	__parport_gsc_frob_control (p, 0x10, 0x10);
-}
-x-void parport_gsc_data_forward (struct parport *p)
-{x-	__parport_gsc_frob_control (p, 0x20, 0);
-}
-x-void parport_gsc_data_reverse (struct parport *p)
-{x-	__parport_gsc_frob_control (p, 0x20, 0x20);
x}
 
 void parport_gsc_init_state(struct pardevice *dev, struct parport_state *s)xdiff -Nru a/drivers/parport/parport_gsc.h b/drivers/parport/parport_gsc.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/parport/parport_gsc.h	2005-01-19 12:49:36 -08:00
@@ -0,0 +1,222 @@x+/*
+ *	Low-level parallel-support for PC-style hardware integrated in the
+ *	LASI-Controller (on GSC-Bus) for HP-PARISC Workstations
+ *
+ *	(C) 1999-2001 by Helge Deller <deller@gmx.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 byx+ *	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
+ *
+ * based on parport_pc.c by
+ * 	    Grant Guenther <grant@torque.net>
+ * 	    Phil Blundell <Philip.Blundell@pobox.com>
+ *          Tim Waugh <tim@cyberelk.demon.co.uk>
+ *	    Jose Renau <renau@acm.org>
+ *          David Campbell <campbell@torque.net>
+ *          Andrea Arcangeli
+ */
+
+#ifndef	__DRIVERS_PARPORT_PARPORT_GSC_H
+#define	__DRIVERS_PARPORT_PARPORT_GSC_H
+x+#include <asm/io.h>x+#include <linux/delay.h>x+x+#undef	DEBUG_PARPORT	/* undefine for production */
+#define DELAY_TIME 	0
+
+#if DELAY_TIME == 0
+#define parport_readb	gsc_readb
+#define parport_writeb	gsc_writeb
+#elsex+static __inline__ unsigned char parport_readb( unsigned long port )
+{x+    udelay(DELAY_TIME);
+    return gsc_readb(port);
+}
+
+static __inline__ void parport_writeb( unsigned char value, unsigned long port )
+{x+    gsc_writeb(value,port);
+    udelay(DELAY_TIME);
+}
+#endif
+x+/* --- register definitions ------------------------------- */
+
+#define EPPDATA(p)  ((p)->base    + 0x4)
+#define EPPADDR(p)  ((p)->base    + 0x3)
+#define CONTROL(p)  ((p)->base    + 0x2)
+#define STATUS(p)   ((p)->base    + 0x1)
+#define DATA(p)     ((p)->base    + 0x0)
+
+struct parport_gsc_private {
+	/* Contents of CTR. */
+	unsigned char ctr;
+
+	/* Bitmask of writable CTR bits. */
+	unsigned char ctr_writable;
+
+	/* Number of bytes per portword. */
+	int pword;
+
+	/* Not used yet. */
+	int readIntrThreshold;
+	int writeIntrThreshold;
+
+	/* buffer suitable for DMA, if DMA enabled */
+	char *dma_buf;
+	dma_addr_t dma_handle;
+	struct pci_dev *dev;
+};
+
+static inline void parport_gsc_write_data(struct parport *p, unsigned char d)
+{x+#ifdef DEBUG_PARPORT
+	printk (KERN_DEBUG "parport_gsc_write_data(%p,0x%02x)\n", p, d);
+#endif
+	parport_writeb(d, DATA(p));
+}
+
+static inline unsigned char parport_gsc_read_data(struct parport *p)
+{x+	unsigned char val = parport_readb (DATA (p));
+#ifdef DEBUG_PARPORT
+	printk (KERN_DEBUG "parport_gsc_read_data(%p) = 0x%02x\n",
+		p, val);
+#endif
+	return val;
+}
+
+/* __parport_gsc_frob_control differs from parport_gsc_frob_control in that
+ * it doesn't do any extra masking. */
+static inline unsigned char __parport_gsc_frob_control(struct parport *p,
+							unsigned char mask,
+							unsigned char val)
+{x+	struct parport_gsc_private *priv = p->physport->private_data;
+	unsigned char ctr = priv->ctr;
+#ifdef DEBUG_PARPORT
+	printk (KERN_DEBUG
+		"__parport_gsc_frob_control(%02x,%02x): %02x -> %02x\n",
+		mask, val, ctr, ((ctr & ~mask) ^ val) & priv->ctr_writable);
+#endif
+	ctr = (ctr & ~mask) ^ val;
+	ctr &= priv->ctr_writable;x/* only write writable bits. */
+	parport_writeb (ctr, CONTROL (p));
+	priv->ctr = ctr;	/* Update soft copy */
+	return ctr;
+}
+
+static inline void parport_gsc_data_reverse(struct parport *p)
+{x+	__parport_gsc_frob_control (p, 0x20, 0x20);
+}
+
+static inline void parport_gsc_data_forward(struct parport *p)
+{x+	__parport_gsc_frob_control (p, 0x20, 0x00);
+}
+
+static inline void parport_gsc_write_control(struct parport *p,
+						 unsigned char d)
+{x+	const unsigned char wm = (PARPORT_CONTROL_STROBE |
+				  PARPORT_CONTROL_AUTOFD |
+				  PARPORT_CONTROL_INIT |
+				  PARPORT_CONTROL_SELECT);
+
+	/* Take this out when drivers have adapted to newer interface. */
+	if (d & 0x20) {
+		printk (KERN_DEBUG "%s (%s): use data_reverse for this!\n",
+			p->name, p->cad->name);
+		parport_gsc_data_reverse (p);x+	}
+x+	__parport_gsc_frob_control (p, wm, d & wm);
+}
+
+static inline unsigned char parport_gsc_read_control(struct parport *p)
+{x+	const unsigned char rm = (PARPORT_CONTROL_STROBE |
+				  PARPORT_CONTROL_AUTOFD |
+				  PARPORT_CONTROL_INIT |
+				  PARPORT_CONTROL_SELECT);
+	const struct parport_gsc_private *priv = p->physport->private_data;
+	return priv->ctr & rm;x/* Use soft copy */
+}
+
+static inline unsigned char parport_gsc_frob_control(struct parport *p,
+							unsigned char mask,
+							unsigned char val)
+{x+	const unsigned char wm = (PARPORT_CONTROL_STROBE |
+				  PARPORT_CONTROL_AUTOFD |
+				  PARPORT_CONTROL_INIT |
+				  PARPORT_CONTROL_SELECT);
+
+	/* Take this out when drivers have adapted to newer interface. */
+	if (mask & 0x20) {
+		printk (KERN_DEBUG "%s (%s): use data_%s for this!\n",
+			p->name, p->cad->name,
+			(val & 0x20) ? "reverse" : "forward");
+		if (val & 0x20)
+			parport_gsc_data_reverse (p);x+		elsex+			parport_gsc_data_forward (p);x+	}
+x+	/* Restrict mask and val to control lines. */
+	mask &= wm;
+	val &= wm;
+
+	return __parport_gsc_frob_control (p, mask, val);
+}
+
+static inline unsigned char parport_gsc_read_status(struct parport *p)
+{x+	return parport_readb (STATUS(p));
+}
+
+static inline void parport_gsc_disable_irq(struct parport *p)
+{x+	__parport_gsc_frob_control (p, 0x10, 0x00);
+}
+
+static inline void parport_gsc_enable_irq(struct parport *p)
+{x+	__parport_gsc_frob_control (p, 0x10, 0x10);
+}
+
+extern void parport_gsc_release_resources(struct parport *p);
+
+extern int parport_gsc_claim_resources(struct parport *p);
+
+extern void parport_gsc_init_state(struct pardevice *, struct parport_state *s);
+
+extern void parport_gsc_save_state(struct parport *p, struct parport_state *s);
+
+extern void parport_gsc_restore_state(struct parport *p, struct parport_state *s);
+
+extern void parport_gsc_inc_use_count(void);
+
+extern void parport_gsc_dec_use_count(void);
+
+extern struct parport *parport_gsc_probe_port(unsigned long base,
+						unsigned long base_hi,
+						int irq, int dma,
+						struct pci_dev *dev);
+
+#endif	/* __DRIVERS_PARPORT_PARPORT_GSC_H */
diff -Nru a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c
--- a/drivers/pci/hotplug/ibmphp_pci.c	2004-12-26 10:19:56 -08:00
+++ b/drivers/pci/hotplug/ibmphp_pci.c	2005-02-07 12:52:07 -08:00
@@ -1384,9 +1384,6 @@xx		return -EINVAL;xx	}
xx-	pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SECONDARY_BUS, &sec_number);
-	sec_no = (int) sec_no;
-
x	pci_bus_read_config_byte (ibmphp_pci_bus, devfn, PCI_SUBORDINATE_BUS, &sub_number);
 	sub_no = (int) sub_number;
 	debug ("sub_no is %d, sec_no is %d\n", sub_no, sec_no);
diff -Nru a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
--- a/drivers/pci/hotplug/pciehp_ctrl.c	2004-10-31 16:23:07 -08:00
+++ b/drivers/pci/hotplug/pciehp_ctrl.c	2005-02-23 01:26:22 -08:00
@@ -1354,10 +1354,11 @@xx				dbg("PCI Bridge Hot-Remove s:b:d:f(%02x:%02x:%02x:%02x)\n", xx					ctrl->seg, func->bus, func->device, func->function);
 				bridge_slot_remove(func);x-			} else
+			} else {x 				dbg("PCI Function Hot-Remove s:b:d:f(%02x:%02x:%02x:%02x)\n", xx					ctrl->seg, func->bus, func->device, func->function);
 				slot_remove(func);x+			}x 
 			func = pciehp_slot_find(ctrl->slot_bus, device, 0);
x		}
diff -Nru a/drivers/pci/hotplug/pciehprm_acpi.c b/drivers/pci/hotplug/pciehprm_acpi.c
--- a/drivers/pci/hotplug/pciehprm_acpi.c	2004-10-25 16:22:49 -07:00
+++ b/drivers/pci/hotplug/pciehprm_acpi.c	2005-02-08 14:03:48 -08:00
@@ -254,10 +254,9 @@xx{
x	acpi_status		status;xx	u8			*path_name = acpi_path_name(ab->handle);
-	struct acpi_buffer	ret_buf = { 0, NULL};
 
x	/* run OSHP */
-	status = acpi_evaluate_object(ab->handle, METHOD_NAME_OSHP, NULL, &ret_buf);
+	status = acpi_evaluate_object(ab->handle, METHOD_NAME_OSHP, NULL, NULL);
x	if (ACPI_FAILURE(status)) {x 		err("acpi_pciehprm:%s OSHP fails=0x%x\n", path_name, status);
x		oshp_run_status = (status == AE_NOT_FOUND) ? OSHP_NOT_EXIST : OSHP_RUN_FAILED;
diff -Nru a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
--- a/drivers/pci/hotplug/rpadlpar_core.c	2004-10-06 09:42:01 -07:00
+++ b/drivers/pci/hotplug/rpadlpar_core.c	2005-03-07 15:53:02 -08:00
@@ -14267 +14267 @@xx	child = pci_add_new_bus(bridge_dev->bus, bridge_dev, sec_busno);
x	if (!child) {x 		printk(KERN_ERR "%s: could not add secondary bus\n", __FUNCTION__);
-		return 1;
+		return -ENOMEM;xx	}
xx 	sprintf(child->name, "PCI Bus #%02x", child->number);
@@ -20467 +20467 @@xx	if (!bridge_dev) {x 		printk(KERN_ERR "%s: unexpected null device\n",
 			__FUNCTION__);
-		return 1;
+		return -EINVAL;xx	}
xx 	secondary_bus = bridge_dev->subordinate;x@@ -21267 +21267 @@xx	if (unmap_bus_range(secondary_bus)) {x 		printk(KERN_ERR "%s: failed to unmap bus range\n",
 			__FUNCTION__);
-		return 1;
+		return -ERANGE;xx	}
xx 	pci_remove_bus_device(bridge_dev);x@@ -28267 +28267 @@xx	}
xx 	rc = dlpar_remove_root_bus(phb);
-	if (rc)
+	if (rc < 0)xx		return rc;
x
 	return 0;x@@ -29467 +29467 @@xxx 	phb = init_phb_dynamic(dn);
x	if (!phb)
-		return 1;
+		return -EINVAL;xx
 	return 0;
x}
diff -Nru a/drivers/pci/hotplug/rpaphp.h b/drivers/pci/hotplug/rpaphp.h
--- a/drivers/pci/hotplug/rpaphp.h	2005-02-02 22:42:11 -08:00
+++ b/drivers/pci/hotplug/rpaphp.h	2005-03-07 15:52:20 -08:00
@@ -45,11 +45,6 @@xx#define LED_ID		2	/* slow blinking */
 #define LED_ACTION	3	/* fast blinking */
 x-/* Error status from rtas_get-sensor */
-#define NEED_POWER    -9000	/* slot must be power up and unisolated to get state */
-#define PWR_ONLY      -9001	/* slot must be powerd up to get state, leave isolated */
-#define ERR_SENSE_USE -9002	/* No DR operation will succeed, slot is unusable  */
-xx/* Sensor values from rtas_get-sensor */
 #define EMPTY           0	/* No card in slot */
 #define PRESENT         1	/* Card in slot */
diff -Nru a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
--- a/drivers/pci/hotplug/rpaphp_core.c	2005-02-07 16:10:15 -08:00
+++ b/drivers/pci/hotplug/rpaphp_core.c	2005-03-07 15:52:20 -08:00
@@ -256,12 +256,12 @@xx	my_index = (int *) get_property(dn, "ibm,my-drc-index", NULL);
x	if (!my_index) {x 		/* Node isn't DLPAR/hotplug capable */
-		return 1;
+		return -EINVAL;xx	}
xx 	rc = get_children_props(dn->parent, &indexes, &names, &types, &domains);
x	if (rc < 0) {
-		return 1;
+		return -EINVAL;xx	}
xx 	name_tmp = (char *) &names[1];x@@ -28467 +28467 @@xx		type_tmp += (strlen(type_tmp) + 1);xx	}
xx-	return 1;
+	return -EINVAL;xx}
xx static int is_php_type(char *drc_type)
diff -Nru a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
--- a/drivers/pci/hotplug/rpaphp_pci.c	2005-01-07 21:43:52 -08:00
+++ b/drivers/pci/hotplug/rpaphp_pci.c	2005-03-07 15:52:20 -08:00
@@ -81,8 +81,8 @@xxx 	rc = rtas_get_sensor(DR_ENTITY_SENSE, slot->index, state);
 
-	if (rc) {
-		if (rc == NEED_POWER || rc == PWR_ONLY) {x+	if (rc < 0) {
+		if (rc == -EFAULT || rc == -EEXIST) {x 			dbg("%s: slot must be power up to get sensor-state\n",
 			    __FUNCTION__);
 
@@ -91,14 +91,14 @@xx			x*/
 			rc = rtas_set_power_level(slot->power_domain, POWER_ON,xx						  &setlevel);
-			if (rc) {
+			if (rc < 0) {
 				dbg("%s: power on slot[%s] failed rc=%d.\n",
 				    __FUNCTION__, slot->name, rc);
 			} else {x 				rc = rtas_get_sensor(DR_ENTITY_SENSE,xx						     slot->index, state);
 			}x-		} else if (rc == ERR_SENSE_USE)
+		} else if (rc == -ENODEV)xx			info("%s: slot is unusable\n", __FUNCTION__);
 		elsexx			err("%s failed to get sensor state\n", __FUNCTION__);
@@ -413,7 +413,7 @@xx	if (slot->hotplug_slot->info->adapter_status == NOT_VALID) {x 		err("%s: NOT_VALID: skip dn->full_name=%s\n",
 		    __FUNCTION__, slot->dn->full_name);
-		return -1;
+		return -EINVAL;xx	}
x	return 0;
x}
@@ -426,15 +426,15 @@xxx 	dn = slot->dn;
x	if (!dn) {
-		return 1;
+		return -EINVAL;xx	}
x	phb = dn->phb;
x	if (!phb) {
-		return 1;
+		return -EINVAL;xx	}
x	bus = phb->bus;
x	if (!bus) {
-		return 1;
+		return -EINVAL;xx	}
xx 	sprintf(slot->name, "%04x:%02x:%02x.%x", pci_domain_nr(bus),
@@ -44867 +44867 @@xx
 	if (slot->type == PHB) {x 		rc = set_phb_slot_name(slot);
-		if (rc) {
+		if (rc < 0) {
 			err("%s: failed to set phb slot name\n", __FUNCTION__);
 			goto exit_rc;
x		}x@@ -509,12 +509,12 @@xx	return 0;
xexit_rc:
 	dealloc_slot_struct(slot);
-	return 1;
+	return -EINVAL;xx}
xx int register_pci_slot(struct slot *slot)x {
-	int rc = 1;
+	int rc = -EINVAL;xx
 	slot->dev_type = PCI_DEV;
x	if ((slot->type == EMBEDDED) || (slot->type == PHB))
diff -Nru a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
--- a/drivers/pci/hotplug/rpaphp_slot.c	2004-10-06 09:46:08 -07:00
+++ b/drivers/pci/hotplug/rpaphp_slot.c	2005-03-07 15:52:20 -08:00
@@ -211,7 +211,7 @@xx	if (is_registered(slot)) { /* should't be herex*/
 		err("register_slot: slot[%s] is already registered\n", slot->name);
 		rpaphp_release_slot(slot->hotplug_slot);
-		return 1;
+		return -EAGAIN;xx	}	xx	retval = pci_hp_register(slot->hotplug_slot);
x	if (retval) {x@@ -27067 +27067 @@xx
 	/* status: LED_OFF or LED_ON */
 	rc = rtas_set_indicator(DR_INDICATOR, slot->index, status);
-	if (rc)
+	if (rc < 0)xx		err("slot(name=%s location=%s index=0x%x) set attention-status(%d) failed! rc=0x%x\n",
 		    slot->name, slot->location, slot->index, status, rc);
 
diff -Nru a/drivers/pci/hotplug/rpaphp_vio.c b/drivers/pci/hotplug/rpaphp_vio.c
--- a/drivers/pci/hotplug/rpaphp_vio.c	2004-10-06 09:43:44 -07:00
+++ b/drivers/pci/hotplug/rpaphp_vio.c	2005-03-07 15:52:20 -08:00
@@ -71,11 +71,11 @@xx{x 	u32 *index;
 	char *name;x-	int rc = 1;
+	int rc = -EINVAL;xx	struct slot *slot = NULL;xx	
 	rc = rpaphp_get_drc_props(dn, NULL, &name, NULL, NULL);
-	if (rc)
+	if (rc < 0)xx		goto exit_rc;
x	index = (u32 *) get_property(dn, "ibm,my-drc-index", NULL);
x	if (!index)
diff -Nru a/drivers/pci/hotplug/shpchprm_acpi.c b/drivers/pci/hotplug/shpchprm_acpi.c
--- a/drivers/pci/hotplug/shpchprm_acpi.c	2004-10-06 09:44:13 -07:00
+++ b/drivers/pci/hotplug/shpchprm_acpi.c	2005-02-08 14:04:19 -08:00
@@ -242,10 +242,9 @@xx{
x	acpi_status		status;xx	u8			*path_name = acpi_path_name(ab->handle);
-	struct acpi_buffer	ret_buf = { 0, NULL};
 
x	/* run OSHP */
-	status = acpi_evaluate_object(ab->handle, METHOD_NAME_OSHP, NULL, &ret_buf);
+	status = acpi_evaluate_object(ab->handle, METHOD_NAME_OSHP, NULL, NULL);
x	if (ACPI_FAILURE(status)) {x 		err("acpi_pciehprm:%s OSHP fails=0x%x\n", path_name, status);
x	} else
diff -Nru a/drivers/pci/msi.c b/drivers/pci/msi.c
--- a/drivers/pci/msi.c	2005-01-14 15:07:00 -08:00
+++ b/drivers/pci/msi.c	2005-02-16 16:00:00 -08:00
@@ -616,15 +616,10 @@xx	bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
 	phys_addr = pci_resource_start (dev, bir);xx	phys_addr += (u32)(table_offset & ~PCI_MSIX_FLAGS_BIRMASK);
-	if (!request_mem_region(phys_addr,
-		nr_entries * PCI_MSIX_ENTRY_SIZE,
-		"MSI-X vector table"))
-		return -ENOMEM;xx	base = ioremap_nocache(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
-	if (base == NULL) {
-		release_mem_region(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
+	if (base == NULL)xx		return -ENOMEM;x-	}
+
x	/* MSI-X Table Initialization */
 	for (i = 0; i < nvec; i++) {x 		entry = alloc_msi_entry();
@@ -859,8 +854,6 @@xx			phys_addr += (u32)(table_offset &xx				~PCI_MSIX_FLAGS_BIRMASK);
 			iounmap(base);
-			release_mem_region(phys_addr,
-				nr_entries * PCI_MSIX_ENTRY_SIZE);
x		}xx	}
xx@@ -1133,8 +1126,6 @@xx			phys_addr += (u32)(table_offset &xx				~PCI_MSIX_FLAGS_BIRMASK);
 			iounmap(base);
-			release_mem_region(phys_addr, PCI_MSIX_ENTRY_SIZE *
-				multi_msix_capable(control));
x			printk(KERN_WARNING "PCI: %s: msi_remove_pci_irq_vectors() "
 			       "called without free_irq() on all MSI-X vectors\n",
 			       pci_name(dev));
diff -Nru a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
--- a/drivers/pci/pci-driver.c	2005-01-20 20:59:15 -08:00
+++ b/drivers/pci/pci-driver.c	2005-02-07 13:58:21 -08:00
@@ -11567 +115,6 @@xxstatic inline void
 pci_init_dynids(struct pci_dynids *dynids)x {
-	memset(dynids, 0, sizeof(*dynids));
 	spin_lock_init(&dynids->lock);
 	INIT_LIST_HEAD(&dynids->list);
x}
diff -Nru a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
--- a/drivers/pci/pci-sysfs.c	2005-02-02 22:42:15 -08:00
+++ b/drivers/pci/pci-sysfs.c	2005-02-25 08:25:55 -08:00
@@ -48167 +48167 @@xx	struct pci_dev *pdev = NULL;xx	
 	sysfs_initialized = 1;
-	while ((pdev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL)x+	while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL)x 		pci_create_sysfs_dev_files(pdev);xx
 	return 0;
diff -Nru a/drivers/pci/pci.c b/drivers/pci/pci.c
--- a/drivers/pci/pci.c	2005-02-19 16:44:39 -08:00
+++ b/drivers/pci/pci.c	2005-03-02 23:17:57 -08:00
@@ -271,7 +271,7 @@xx	if ((pmc & PCI_PM_CAP_VER_MASK) > 2) {x 		printk(KERN_DEBUG
 		       "PCI: %s has unsupported PM cap regs version (%u)\n",
-		       dev->slot_name, pmc & PCI_PM_CAP_VER_MASK);
+		       pci_name(dev), pmc & PCI_PM_CAP_VER_MASK);
x		return -EIO;xx	}
xxdiff -Nru a/drivers/pci/pci.ids b/drivers/pci/pci.ids
--- a/drivers/pci/pci.ids	2005-01-30 22:33:43 -08:00
+++ b/drivers/pci/pci.ids	2005-02-16 19:05:44 -08:00
@@ -7,7 +767 @@xx#	so if you have anything to contribute, please visit the home page orxx#	send a diff -u against the most recent pci.ids to pci-ids@ucw.cz.xx#
-#	Daily snapshot on Mon 2004-07-12 10:00:27
+#	Partial sync-up to daily snapshot on Tue 2005-02-08 11:00:09xx#
x
 # Vendors, devices and subsystems. Please keep sorted.x@@ -28,6 +28,9 @@xx	4001  WinTV PVR-250 (v1)xx	4009  WinTV PVR-250xx	4801  WinTV PVR-250 MCE
+0071  Nebula Electronics Ltd.
+0095  Silicon Image, Inc. (Wrong ID)x+	0680  Ultra ATA/133 IDE RAID CONTROLLER CARD
 0100  Ncipher Corp Ltd
 # 018a is not LevelOne but therexis a board misprogrammed
 018a  LevelOne
@@ -41,6 +44,11 @@xx# SpeedStream is Efficient Networks, Inc, a Siemens Company
 02ac  SpeedStreamxx	1012  1012 PCMCIA 10/100 Ethernet Card [RTL81xx]
+0357  TTTech AG
+	000a  TTP-Monitoring Card V2.0
+0432  SCM Microsystems, Inc.
+05e3  CyberDoor
+	0701  CBD516
 0675  Dynalinkxx	1700  IS64PH ISDN Adapterxx	1702  IS64PH ISDN Adapterx@@ -49,6 +57,9 @@xx09c1  Arrisxx	0704  CM 200E Cable Modemxx0a89  BREA Technologies Inc
+0b49  ASCII Corporation
+# see http://homepage1.nifty.com/mcn/lab/machines/trance_vibrator/usbview.vib.txtx+	064f  Trance Vibratorxx0e11  Compaq Computer Corporation
 	0001  PCI to EISA Bridge
 	0002  PCI to ISA Bridge
@@ -150,6 +161,8 @@xx		0e11 4082  Smart Array 532xx		0e11 4083  Smart Array 5312xx	b1a4  NC7131 Gigabit Server Adapterx+# HP Memory Hot-Plug Controllerx+	b200  Memory Hot-Plug Controllerx 	b203  Integrated Lights Out Controllerx 	b204  Integrated Lights Out  Processorxx	f130  NetFlex-3/P ThunderLAN 1.0
@@ -169,6 +18267 @@xx	000a  53c1510xx		1000 1000  LSI53C1510 PCI to Dual Channel Wide Ultra2 SCSI Controller (Nonintelligent mode)xx	000b  53C896/897
+		0e11 6004  EOB003 Series SCSI host adapterxx		1000 1000  LSI53C896/7 PCI to Dual Channel Ultra2 SCSI Multifunction Controllerx 		1000 1010  LSI22910 PCI to Dual Channel Ultra2 SCSI host adapterxx		1000 1020  LSI21002 PCI to Dual Channel Ultra2 SCSI host adapterx@@ -19167 +20567 @@xx		4c53 1050  CT7 mainboardxx	0010  53C1510xx		0e11 4040  Integrated Array Controllerx-		0e11 4048  Integrated Array Controllerx+		0e11 4048  RAID LC2 Controllerx 		1000 1000  53C1510 PCI to Dual Channel Wide Ultra2 SCSI Controller (Intelligent mode)xx	0012  53c895axx		1000 1000  LSI53C895A PCI to Ultra2 SCSI Controller
@@ -202,6 +21667 @@xx		1de1 1020  DC-390U3Wxx	0021  53c1010 66MHz  Ultra3 SCSI Adapterxx		1000 1000  LSI53C1000/1000R/1010R/1010-66 PCI to Ultra160 SCSI Controller
+		1000 1010  Asus TR-DLS onboard 53C1010-66xx		124b 1070  PMC-USCSI3xx		4c53 1080  CT8 mainboardxx		4c53 1300  P017 mezzanine (32-bit PMC)
@@ -209,6 +22467 @@xx	0030  53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSIxx		1028 0123  PowerEdge 2600xx		1028 014a  PowerEdge 1750x+		1028 016c  PowerEdge 1850 MPT Fusion SCSI/RAID (Perc 4)xx		1028 1010  LSI U320 SCSI Controllerx 	0031  53c1030ZC PCI-X Fusion-MPT Dual Ultra320 SCSIxx	0032  53c1035 PCI-X Fusion-MPT Dual Ultra320 SCSIx@@ -226,21 +242,23 @@xx		1000 0531  MegaRAID 531 SCSI 320-4X RAID Controllerx 		1000 0532  MegaRAID 532 SCSI 320-2X RAID Controllerx 		1028 0531  PowerEdge Expandable RAID Controller 4/QCx+		1028 0533  PowerEdge Expandable RAID Controller 4/QCx 		8086 0530  MegaRAID Intel RAID Controller SRCZCRXx 		8086 0532  MegaRAID Intel RAID Controller SRCU42Xx 	0408  MegaRAIDx 		1000 0001  MegaRAID SCSI 320-1E RAID Controllerx 		1000 0002  MegaRAID SCSI 320-2E RAID Controllerx-		1028 0001  Dell PowerEdge RAID Controller PERC4e/SCx-		1028 0002  Dell PowerEdge RAID Controller PERC4e/DCx+		1025 004d  MegaRAID ACER ROMB-2E RAID Controllerx+		1028 0001  PowerEdge RAID Controller PERC4e/SCx+		1028 0002  PowerEdge RAID Controller PERC4e/DCx 		1734 1065  FSC MegaRAID PCI Express ROMBx 		8086 0002  MegaRAID Intel RAID Controller SRCU42Ex 	0409  MegaRAIDx 		1000 3004  MegaRAID SATA 300-4X RAID Controllerx 		1000 3008  MegaRAID SATA 300-8X RAID Controllerx-		8086 3008  MegaRAID Intel RAID Controller SRCS28Xx-		8086 3431  MegaRAID Intel RAID Controller Alief SROMBU42Ex-		8086 3499  MegaRAID Intel RAID Controller Harwich SROMBU42Ex+		8086 3008  MegaRAID RAID Controller SRCS28Xx+		8086 3431  MegaRAID RAID Controller Alief SROMBU42Ex+		8086 3499  MegaRAID RAID Controller Harwich SROMBU42Ex 	0621  FC909 Fibre Channel Adapterxx	0622  FC929 Fibre Channel Adapterxx		1000 1020  44929 O Dual Fibre Channel card
@@ -272,8 +290,8 @@xx		1028 0520  MegaRAID 520 DELL PERC 4/SC RAID Controllerx 		1028 0531  PowerEdge Expandable RAID Controller 4/QCx 		1028 0533  PowerEdge Expandable RAID Controller 4/QCx-		8086 0520  MegaRAID Intel RAID Controller SRCU41Lx-		8086 0523  MegaRAID Intel RAID Controller SRCS16
+		8086 0520  MegaRAIDRAID Controller SRCU41Lx+		8086 0523  MegaRAID RAID Controller SRCS16
 1001  Kolter Electronicxx	0010  PCI 1616 Measurement card with 32 digital I/O linesxx	0011  OPTO-PCI Opto-Isolated digital I/O boardx@@ -28567 +303,13 @@xx	0017  PROTO-3 PCI Prototyping boardxx	9100  INI-9100/9100W SCSI Host
 1002  ATI Technologies Inc
+	3150  M24 1P [Radeon Mobility X600]
+	3154  M24 1T [FireGL M24 GL]
+	3e50  RV380 0x3e50 [Radeon X600]
+	3e54  RV380 0x3e54 [FireGL V3200]
+	3e70  RV380 [Radeon X600] Secondaryxx	4136  Radeon IGP 320 M
+	4137  Radeon IGP330/340/350xx	4144  R300 AD [Radeon 9500 Pro]xx# New PCI ID provided by ATI developer relations (correction to above)xx	4145  R300 AE [Radeon 9700 Pro]x@@ -294619 +318,27 @@xx	4147  R300 AG [FireGL Z1/X1]xx	4148  R350 AH [Radeon 9800]
x	4149  R350 AI [Radeon 9800]
-	414b  R350 AK [Fire GL ??]
+	414a  R350 AJ [Radeon 9800]
+	414b  R350 AK [Fire GL X2]xx# New PCI ID provided by ATI developer relations
x	4150  RV350 AP [Radeon 9600]
+		1002 0002  R9600 Pro primary (Asus OEM for HP)
+		1002 0003  R9600 Pro secondary (Asus OEM for HP)
 		1458 4024  Giga-Byte GV-R96128D Primary
 		148c 2064  PowerColor R96A-C3N
 		148c 2066  PowerColor R96A-C3N
 		174b 7c19  Sapphire Atlantis Radeon 9600 Pro
 		174b 7c29  GC-R9600PRO Primary [Sapphire]
+		17ee 2002  Radeon 9600 256Mb Primary
 		18bc 0101  GC-R9600PRO Primaryxx# New PCI ID provided by ATI developer relations
x	4151  RV350 AQ [Radeon 9600]
+		1043 c004  A9600SExx# New PCI ID provided by ATI developer relations
x	4152  RV350 AR [Radeon 9600]
+		1002 0002  Radeon 9600XT
+		1043 c002  Radeon 9600 XT TVD
+	4153  RV350 AS [Radeon 9600 AS]
x	4154  RV350 AT [Fire GL T2]
x	4155  RV350 AU [Fire GL T2]
x	4156  RV350 AV [Fire GL T2]
@@ -325,20 +357,35 @@xx		1458 4025  Giga-Byte GV-R96128D Secondaryxx		148c 2067  PowerColor R96A-C3N (Secondary)
 		174b 7c28  GC-R9600PRO Secondary [Sapphire]
+		17ee 2003  Radeon 9600 256Mb Secondaryxx		18bc 0100  GC-R9600PRO Secondaryxx# New PCI ID provided by ATI developer relations (correction to above)xx	4171  RV350 AQ [Radeon 9600] (Secondary)
+		1043 c005  A9600SE (Secondary)
 # New PCI ID provided by ATI developer relations (correction to above)xx	4172  RV350 AR [Radeon 9600] (Secondary)
+		1002 0003  Radeon 9600XT (Secondary)
+		1043 c003  A9600XT (Secondary)
+	4173  RV350 ?? [Radeon 9550] (Secondary)
+	4237  Radeon 7000 IGPxx	4242  R200 BB [Radeon All in Wonder 8500DV]xx		1002 02aa  Radeon 8500 AIW DV Edition
+	4243  R200 BC [Radeon All in Wonder 8500]
x	4336  Radeon Mobility U1
-	4337  Radeon IGP 340M
+		103c 0024  Pavilion ze4400 builtin Video
+	4337  Radeon IGP 330M/340M/350M
+		1014 053a  ThinkPad R40e (2684-HVG) builtin VGA controllerx+		103c 0850  Radeon IGP 345M
x	4341  IXP150 AC'97 Audio Controllerx+	4345  EHCI USB Controllerx+	4347  OHCI USB Controller #1x+	4348  OHCI USB Controller #2x+	434d  IXP AC'97 Modemxx# Radeon 9100 IGP integrated
x	4353  ATI SMBus
x	4354  215CT [Mach64 CT]
x	4358  210888CX [Mach64 CX]
+	4437  Radeon Mobility 7000 IGPxx	4554  210888ET [Mach64 ET]
x	4654  Mach64 VT
x	4742  3D Rage Pro AGP 1X/2X
@@ -389,6 +43667 @@xx		1002 8008  Rage XLx 		1028 00ce  PowerEdge 1400xx		1028 00d1  PowerEdge 2550x+		1028 00d9  PowerEdge 2500xx		8086 3411  SDS2 Mainboardxx		8086 3427  S875WP1-E mainboardxx	4753  Rage XCx@@ -406,6 +45467 @@xx	4758  210888GX [Mach64 GX]xx	4759  3D Rage IICxx	475a  3D Rage IIC AGP
+		1002 0084  Rage 3D Pro AGP 2x XPERT 98xx		1002 0087  Rage 3D IICxx		1002 475a  Rage IIC AGP
x	4964  Radeon RV250 Id [Radeon 9000]
@@ -422,6 +471,15 @@xx		17af 2006  RV250 If [Excalibur Radeon 9000]
x	4967  Radeon RV250 Ig [Radeon 9000]
x	496e  Radeon RV250 [Radeon 9000] (Secondary)
+	4a48  R420 JH [Radeon X800]
+	4a49  R420 JI [Radeon X800PRO]
+	4a4a  R420 JJ [Radeon X800SE]
+	4a4b  R420 JK [Radeon X800]
+	4a4c  R420 JL [Radeon X800]
+	4a4d  R420 JM [FireGL X3]
+	4a4e  M18 JN [Radeon Mobility 9800]
+	4a50  R420 JP [Radeon X800XT]
+	4a70  R420 [X800XT-PE] (Secondary)
 	4c42  3D Rage LT Pro AGP-133xx		0e11 b0e7  Rage LT Pro (Compaq Presario 5240)xx		0e11 b0e8  Rage 3D LT Pro
@@ -452,6 +51067 @@xx		1002 4c50  Rage LT Pro
 	4c51  3D Rage LT Pro
 	4c52  Rage Mobility P/M
+		1033 8112  Versa Note VXi
 	4c53  Rage Mobility L
 	4c54  264LT [Mach64 LT]
x	4c57  Radeon Mobility M7 LW [Radeon Mobility 7500]
@@ -488,9 +547,14 @@xx	4e4b  R350 NK [Fire GL X2]xx# New PCI ID provided by ATI developer relations
x	4e50  RV350 [Mobility Radeon 9600 M10]
-# New PCI ID provided by ATI developer relations
+		1025 005a  TravelMate 290x+		103c 0890  NC6000 laptop
+		1734 1055  Amilo M1420W
+	4e51  M10 NQ [Radeon Mobility 9600]
x	4e52  RV350 [Mobility Radeon 9600 M10]
+	4e53  M10 NS [Radeon Mobility 9600]
x	4e54  M10 NT [FireGL Mobility T2]
+	4e56  M11 NV [FireGL Mobility T2e]
x	4e64  Radeon R300 [Radeon 9700 Pro] (Secondary)
 	4e65  Radeon R300 [Radeon 9500 Pro] (Secondary)
 		1002 0003  Radeon R300 NE [Radeon 9500 Pro]x@@ -568,6 +63267 @@xx		1002 003a  Radeon R200 QL [Radeon 8500 LE]xx		1002 013a  Radeon 8500xx		148c 2026  R200 QL [Radeon 8500 Evil Master II Multi Display Edition]
+		1681 0010  Radeon 8500 [3D Prophet 8500 128Mb]
 		174b 7149  Radeon R200 QL [Sapphire Radeon 8500 LE]xx	514d  Radeon R200 QM [Radeon 9100]
x	514e  Radeon R200 QN [Radeon 8500LE]x@@ -576,6 +641,7 @@xx	5155  R200 QU [Radeon 9100]
x	5157  Radeon RV200 QW [Radeon 7500]
x		1002 013a  Radeon 7500
+		1002 103a  Dell Optiplex GX260xx		1458 4000  RV200 QW [RADEON 7500 PRO MAYA AR]xx		148c 2024  RV200 QW [Radeon 7500LE Dual Display]xx		148c 2025  RV200 QW [Radeon 7500 Evil Master Multi Display Edition]
@@ -596,6 +66267 @@xx		148c 2003  RV100 QY [Radeon 7000 Multi-Display Edition]
x		148c 2023  RV100 QY [Radeon 7000 Evil Master Multi-Display]xx		174b 7112  RV100 QY [Sapphire Radeon VE 7000]
+		174b 7c28  Sapphire Radeon VE 7000 DDRxx		1787 0202  RV100 QY [Excalibur Radeon 7000]
x	515a  Radeon RV100 QZ [Radeon 7000/VE]xx	5168  Radeon R200 Qh
@@ -650,29 +717,78 @@xx	5453  Rage 128 Pro Ultra TSxx	5454  Rage 128 Pro Ultra TTxx	5455  Rage 128 Pro Ultra TU
+	5460  M22 [Radeon Mobility M300]
+	5464  M22 [FireGL GL]
+	5548  R423 UH [Radeon X800 (PCIE)]
+	5549  R423 UI [Radeon X800PRO (PCIE)]
+	554a  R423 UJ [Radeon X800LE (PCIE)]
+	554b  R423 UK [Radeon X800SE (PCIE)]
+	5551  R423 UQ [FireGL V7200 (PCIE)]
+	5552  R423 UR [FireGL V5100 (PCIE)]
+	5554  R423 UT [FireGL V7100 (PCIE)]
+	556b  Radeon R423 UK (PCIE) [X800 SE] (Secondary)
 	5654  264VT [Mach64 VT]
x		1002 5654  Mach64VT Reference
 	5655  264VT3 [Mach64 VT3]
 	5656  264VT4 [Mach64 VT4]
+	5830  RS300 Host Bridge
+	5831  RS300 Host Bridge
+	5832  RS300 Host Bridge
+	5833  Radeon 9100 IGP Host Bridge
+	5834  Radeon 9100 IGP
+	5835  RS300M AGP [Radeon Mobility 9100IGP]
+	5838  Radeon 9100 IGP AGP Bridge
 	5941  RV280 [Radeon 9200] (Secondary)
+		174b 7c12  Sapphire Radeon 9200xx# http://www.hightech.com.hk/html/9200.htmxx		17af 200d  Excalibur Radeon 9200xx		18bc 0050  GeXcube GC-R9200-C3 (Secondary)
+	5944  RV280 [Radeon 9200 SE (PCI)]
 	5960  RV280 [Radeon 9200 PRO]
 	5961  RV280 [Radeon 9200]
+		1002 2f72  All-in-Wonder 9200 Series
+		12ab 5961  YUAN SMARTVGA Radeon 9200x+		1458 4018  Gigabyte Radeon 9200x+		174b 7c13  Sapphire Radeon 9200xx# http://www.hightech.com.hk/html/9200.htmxx		17af 200c  Excalibur Radeon 9200x+		18bc 0050  Radeon 9200 Game Busterxx		18bc 0051  GeXcube GC-R9200-C3x+		18bc 0053  Radeon 9200 Game Buster VIVO
+	5962  RV280 [Radeon 9200]
 	5964  RV280 [Radeon 9200 SE]
+		1043 c006  ASUS Radeon 9200 SE / TD / 128Mx+		1458 4018  Radeon 9200 SE
x		148c 2073  CN-AG92Ex+		174b 7c13  Sapphire Radeon 9200 SE
+		1787 5964  Excalibur 9200SE VIVO 128Mx+		17af 2012  Radeon 9200 SE Excaliburx+		18bc 0170  Sapphire Radeon 9200 SE 128MB Game Busterx+# 128MB DDR, DVI/VGA/TV outx+		18bc 0173  GC-R9200L(SE)-C3H [Radeon 9200 Game Buster]
+	5b60  RV370 5B60 [Radeon X300 (PCIE)]
+		1043 002a  EAX300SE
+	5b62  RV370 5B62 [Radeon X600 (PCIE)]
+	5b64  RV370 5B64 [FireGL V3100 (PCIE)]
+	5b65  RV370 5B65 [FireGL D1100 (PCIE)]
 	5c61  RV250 5c61 [Radeon Mobility 9200 M9+]
 	5c63  RV250 5c63 [Radeon Mobility 9200 M9+]
 	5d44  RV280 [Radeon 9200 SE] (Secondary)
+		1458 4019  Radeon 9200 SE (Secondary)
+		174b 7c12  Sapphire Radeon 9200 SE (Secondary)
+		1787 5965  Excalibur 9200SE VIVO 128M (Secondary)
+		17af 2013  Radeon 9200 SE Excalibur (Secondary)
+		18bc 0171  Radeon 9200 SE 128MB Game Buster (Secondary)
+		18bc 0172  GC-R9200L(SE)-C3H [Radeon 9200 Game Buster]
+	5d57  R423 5F57 [Radeon X800XT (PCIE)]
 	700f  PCI Bridge [IGP 320M]
 	7010  PCI Bridge [IGP 340M]
+	7834  Radeon 9100 PRO IGP
+	7835  Radeon Mobility 9200 IGPxx	7c37  RV350 AQ [Radeon 9600 SE]
 	cab0  AGP Bridge [IGP 320M]
 	cab2  RS200/RS200M AGP Bridge [IGP 340M]
+	cbb2  RS200/RS200M AGP Bridge [IGP 340M]
 1003  ULSI Systemsxx	0201  US201
 1004  VLSI Technology Inc
@@ -726,6 +84267 @@xx	0011  NS87560 National PCI System I/Oxx	0012  USB Controllerxx	0020  DP83815 (MacPhyter) Ethernet Controllerx+		103c 0024  Pavilion ze4400 builtin Network
x		1385 f311  FA311 / FA312 (FA311 with WoL HW)xx	0022  DP83820 10/100/1000 Ethernet Controllerxx	0028  CS5535 Host bridge
@@ -734,12 +851,16 @@xx	002e  CS5535 Audioxx	002f  CS5535 USBxx	0030  CS5535 Video
+	0035  DP83065 [Saturn] 10/100/1000 Ethernet Controllerxx	0500  SCx200 Bridge
 	0501  SCx200 SMI
 	0502  SCx200 IDE
 	0503  SCx200 Audioxx	0504  SCx200 Video
x	0505  SCx200 XBus
+	0510  SC1100 Bridge
+	0511  SC1100 SMI
+	0515  SC1100 XBus
x	d001  87410 IDE
 100c  Tseng Labs Inc
 	3202  ET4000/W32p rev A
@@ -820,6 +941,7 @@xx		1385 2100  FA510xx		1395 0001  10/100 Ethernet CardBus PC Cardxx		13d1 ab01  EtherFast 10/100 Cardbus (PCMPC200)
+		14cb 0100  LNDL-100N 100Base-TX Ethernet PC Cardxx		8086 0001  EtherExpress PRO/100 Mobile CardBus 32xx	001a  Farallon PN9000SX Gigabit Ethernetxx	0021  DECchip 21052
@@ -915,6 +103767 @@xx# AS400 iSeries PCI sync serial card
 		1014 0031  2721 WAN IOA - 2 Port Sync Serial Adapterxx	0036  Miami
+	0037  82660 CPU to PCI Bridgexx	003a  CPU to PCI Bridgexx	003c  GXT250P/GXT255P Graphics Adapterxx	003e  16/4 Token ring UTP/STP controllerx@@ -940,6 +106367 @@xx	005e  GXT800P Graphics Adapterxx	007c  ATM Controller (14107c00)xx	007d  3780IDSP [MWave]
+	008b  EADS PCI to PCI Bridgexx	008e  GXT3000P Graphics Adapterxx	0090  GXT 3000P
 		1014 008e  GXT-3000P
@@ -953,6 +107767 @@xx	00a5  ATM Controller (1410a500)xx	00a6  ATM 155MBPS MM Controller (1410a600)xx	00b7  256-bit Graphics Rasterizer [Fire GL1]
+		1092 00b8  FireGL1 AGP 32Mbxx	00b8  GXT2000P Graphics Adapterxx	00be  ATM 622MBPS Controller (1410be00)xx	00dc  Advanced Systems Management Adapter (ASMA)
@@ -974,6 +109967 @@xx		1014 0241  iSeries 2757 DASD IOAxx		1014 0264  Quad Channel PCI-X U320 SCSI RAID Adapter (2780)xx		1014 02BD  Quad Channel PCI-X U320 DDR SCSI RAID Adapter (570F)x+	0188  EADS-X PCI-X to PCI-X Bridgexx	01a7  PCI-X to PCI-X Bridgexx	01bd  ServeRAID Controllerx 		1014 01be  ServeRAID-4M
@@ -999,6 +112567 @@xx	028C  Citrine chipset SCSI controllerx 		1014 02BE  Dual Channel PCI-X U320 DDR SCSI RAID Adapter (571B)xx	0302  X-Architecture Bridge [Summit]
+	0314  ZISC 036 Neural accelerator card
 	ffff  MPIC-2 interrupt controllerx 1015  LSI Logic Corp of Canadax 1016  ICL Personal Systemsx@@ -1048,10 +1175,10 @@xx1020  Hitachi Computer Productsxx1021  OKI Electric Industry Co. Ltd.
x1022  Advanced Micro Devices [AMD]
-	1100  K8 NorthBridgex-	1101  K8 NorthBridgex-	1102  K8 NorthBridgex-	1103  K8 NorthBridgex+	1100  K8 [Athlon64/Opteron] HyperTransport Technology Configuration
+	1101  K8 [Athlon64/Opteron] Address Map
+	1102  K8 [Athlon64/Opteron] DRAM Controllerx+	1103  K8 [Athlon64/Opteron] Miscellaneous Control
 	2000  79c970 [PCnet32 LANCE]xx		1014 2000  NetFinity 10/100 Fast Ethernetxx		1022 2000  PCnet - Fast 79C971x@@ -1081,6 +1208,8 @@xx	3000  ELanSC520 Microcontrollerx 	7006  AMD-751 [Irongate] System Controllerx 	7007  AMD-751 [Irongate] AGP Bridge
+	700a  AMD-IGR4 AGP Host to PCI Bridgex+	700b  AMD-IGR4 PCI to PCI Bridgexx	700c  AMD-760 MP [IGD4-2P] System Controllerx 	700d  AMD-760 MP [IGD4-2P] AGP Bridge
 	700e  AMD-760 [IGD4-1P] System Controllerx@@ -1209,6 +1338,8 @@xx	1631  M1631 Northbridge+3D Graphics [Aladdin TNT2]
x	1641  M1641 Northbridge [Aladdin-Pro IV]
x	1647  M1647 [MaGiK1] PCI North Bridgex+	1671  M1671 Northbridge [ALADDiN-P4]
+	1672  Northbridge [CyberALADDiN-P4]
x	3141  M3141
x	3143  M3143
x	3145  M3145
@@ -1353,6 +148467 @@xx		102b 07c1  Millennium G450 SDR Dual Head LExx		102b 0d41  Millennium G450 Dual Head PCIxx		102b 0d42  Millennium G450 Dual Head LX PCI
+		102b 0d43  Millennium G450 32Mb Dual Head PCIxx		102b 0e00  Marvel G450 eTVxx		102b 0e01  Marvel G450 eTVxx		102b 0e02  Marvel G450 eTVx@@ -1436,13 +1568,18 @@xx102e  Olivetti Advanced Technologyxx102f  Toshiba Americaxx	0009  r4x00x+	000a  TX3927 MIPS RISC PCI Controllerxx	0020  ATM Meteor 155xx		102f 00f8  ATM Meteor 155x+	0030  TC35815CF PCI 10/100 Mbit Ethernet Controllerx+	0031  TC35815CF PCI 10/100 Mbit Ethernet Controller with WOLxx	0105  TC86C001 [goku-s] IDE
 	0106  TC86C001 [goku-s] USB 1.1 Host
 	0107  TC86C001 [goku-s] USB Device Controllerxx	0108  TC86C001 [goku-s] I2C/SIO/GPIO Controllerx-	0180  TX4927
+	0180  TX4927/38 MIPS RISC PCI Controllerx+	0181  TX4925 MIPS RISC PCI Controllerx+	0182  TX4937 MIPS RISC PCI Controllerxx1030  TMC Researchxx1031  Miro Computer Products AG
 	5601  DC20 ASIC
@@ -1517,7 +1654,12 @@xx	0006  85C501/2/3xx	0008  SiS85C503/5513 (LPC Bridge)xx	0009  ACPI
+# source: http://members.datafast.net.au/dft0802/downloads/pcidevs.txtx+	0016  SiS961/2 SMBus Controllerxx	0018  SiS85C503/5513 (LPC Bridge)x+# Controller for 2 PATA and 2 SATA channels
+	0180  RAID bus controller 180 SATA/PATA  [SiS]x+	0181  SiS SATAxx	0200  5597/5598/6326 VGAxx		1039 0000  SiS5597 SVGA (Shared RAM)xx	0204  82C204
@@ -1557,6 +169967 @@xx	0755  755 Host
 	0760  760/M760 Host
 	0900  SiS900 PCI Fast Ethernetx+		1019 0a14  K7S5A motherboardxx		1039 0900  SiS900 10/100 Ethernet Adapterxx		1043 8035  CUSI-FX motherboardxx	0961  SiS961 [MuTIOL Media IO]
@@ -159969 +1742,10 @@xx		1092 4910  SpeedStar A70xx		1092 4920  SpeedStar A70xx		1569 6326  SiS6326 GUI Acceleratorx-	6330  661FX/M661FX/M661MX/741/M741/760/M760 PCI/AGP
-		1039 6330  [M]661FX/M661MX/[M]741/[M]760 PCI/AGP VGA Display Adapterx+	6330  661/741/760 PCI/AGP VGA Display Adapterx+		1039 6330  [M]661xX/[M]741[GX]/[M]760 PCI/AGP VGA Adapterxx	7001  USB 1.0 Controllerx+		1019 0a14  K7S5A motherboardxx		1039 7000  Onboard USB Controllerxx	7002  USB 2.0 Controllerxx		1509 7002  Onboard USB Controllerx@@ -1694,13 +1838,14 @@xx	3000  Samurai_0xx	3010  Samurai_1
x	3020  Samurai_IDE
-1043  Asustek Computer, Inc.
+1043  ASUSTeK Computer Inc.
x	0675  ISDNLink P-IN100-ST-Dxx	4015  v7100 SDRAM [GeForce2 MX]xx	4021  v7100 Combo Deluxe [GeForce2 MX + TV tuner]
x	4057  v8200 GeForce 3xx	8043  v8240 PAL 128M [P4T] Motherboardxx	807b  v9280/TD [Geforce4 TI4200 8X With TV-Out and DVI]x+	80bb  v9180 Magic/T [GeForce4 MX440 AGP 8x 64MB TV-out]
 1044  Adaptec (formerly DPT)xx	1012  Domino RAID Engine
x	a400  SmartCache/Raid I-IV Controllerx@@ -176969 +1914,11 @@xx1046  IPC Corporation, Ltd.
x1047  Genoa Systems Corp
x1048  Elsa AG
+	0c60  Gladiac MX
x	0d22  Quadro4 900XGL [ELSA GLoria4 900XGL]
x	1000  QuickStep 1000xx	3000  QuickStep 3000x+	8901  Gloria XLx 1049  Fountain Technologies, Inc.
 # # nee SGS Thomson Microelectronicsx 104a  STMicroelectronicsx@@ -1841,15 +1988619 @@xx	8023  TSB43AB22/A IEEE-1394a-2000 Controller (PHY/Link)xx	8024  TSB43AB23 IEEE-1394a-2000 Controller (PHY/Link)xx	8025  TSB82AA2 IEEE-1394b Link Layer Controllerx+		55aa 55aa  FireWire 800 PCI Cardxx	8026  TSB43AB21 IEEE-1394a-2000 Controller (PHY/Link)xx	8027  PCI4451 IEEE-1394 Controllerx 		1028 00e6  PCI4451 IEEE-1394 Controller (Dell Inspiron 8100)xx	8029  PCI4510 IEEE-1394 Controllerx+		1028 0163  Latitude D505xx		1071 8160  MIM2900xx	802e  PCI7x20 1394a-2000 OHCI Two-Port PHY/Link-Layer Controllerx+	8201  PCI1620 Firmware Loading Functionxx	8400  ACX 100 22Mbps Wireless Interface
 		00fc 16ec  U.S. Robotics 22 Mbps Wireless PC Card (model 2210)xx		00fd 16ec  U.S. Robotics 22Mbps Wireless PCI Adapter (model 2216)
+		1186 3b00  DWL-650+ PC Card cardbus 22Mbs Wireless Adapter [AirPlus]xx		1186 3b01  DWL-520+ 22Mbps PCI Wireless Adapterxx	8401  ACX 100 22Mbps Wireless Interface
 # OK, this info is almost useless as is, but at least it's known that it's a wireless card. Morexinfo requested from reporter (whix@@ -1891,6 +204267 @@xx	ac42  PCI4451 PC card Cardbus Controllerx 		1028 00e6  PCI4451 PC card CardBus Controller (Dell Inspiron 8100)xx	ac44  PCI4510 PC card Cardbus Controllerx+		1028 0163  Latitude D505xx		1071 8160  MIM2000xx	ac46  PCI4520 PC card Cardbus Controllerx 	ac50  PCI1410 PC card Cardbus Controllerx@@ -1898,20 +2050,23 @@xx		1014 023b  ThinkPad T23 (2647-4MG)x 		1028 00b1  Latitude C600xx		1028 012a  Latitude C640
+		1033 80cd  Versa Note VXi
 		10cf 1095  Lifebook C6155xx		e4bf 1000  CP2-2-HIPHOPx 	ac52  PCI1451 PC card Cardbus Controllerx 	ac53  PCI1421 PC card Cardbus Controllerx+	ac54  PCI1620 PC Card Controllerx 	ac55  PCI1520 PC card Cardbus Controllerx 		1014 0512  ThinkPad T30/T40xx	ac56  PCI1510 PC card Cardbus Controllerx+		1014 0528  ThinkPad R40e (2684-HVG) Cardbus Controllerx 	ac60  PCI2040 PCI to DSP Bridge Controllerx 		175c 5100  ASI51xx Audio Adapterxx		175c 6100  ASI61xx Audio Adapterxx		175c 6200  ASI62xx Audio Adapterxx	ac8d  PCI 7620xx	ac8e  PCI7420 CardBus Controller
-	ac8f  PCI7420 Flash Media Controllerx+	ac8f  PCI7420/PCI7620 Dual Socket CardBus and Smart Card Cont.
x	fe00  FireWire Host Controllerx 	fe03  12C01A FireWire Host Controllerx 104d  Sony Corporation
@@ -1937,6 +2092,8 @@xx	0940  W89C940xx	5a5a  W89C940Fxx	6692  W6692x+	9921  W99200F MPEG-1 Video Encoderx+	9922  W99200F/W9922PF MPEG-1/2 Video Encoderx 	9970  W9970CFx 1051  Anigma, Inc.
 1052  ?Young Micro Systemsx@@ -1975,6 +213267 @@xx		175c 4400  ASI4401 Audio Adapterxx		ecc0 0030  Laylaxx	18c0  MPC8265A/MPC8266
+	18c1  MPC8271/MPC8272xx	4801  Ravenxx	4802  Falconxx	4803  Hawkx@@ -1998,7 +2156,9 @@xx		14c8 0302  SM56 PCI Fax Modemxx		1668 0300  SM56 PCI Speakerphone Modemxx		1668 0302  SM56 PCI Fax Modemx+	5803  MPC5200xx	6400  MPC190 Security Processor (S1 family, encryption)
+	6405  MPC184 Security Processor (S1 family)
 1058  Electronics & Telecommunications RSH
 1059  Teknor Industrial Computers Inc
 105a  Promise Technology, Inc.
@@ -2018,6 +2178,8 @@xx	3375  PDC20375 (SATA150 TX2plus)xx	3376  PDC20376 (FastTrak 376)xx		1043 809e  A7V8X motherboardx+	3574  PDC20579 SATAII 150 IDE Controllerx+	3d18  PDC20518 SATAII 150 IDE Controllerxx	4d30  PDC20267 (FastTrak100/Ultra100)xx		105a 4d33  Ultra100xx		105a 4d39  FastTrak100
@@ -2189,8 +2351,16 @@xx	0049  K2 HT-PCI Bridgexx	004b  U3 AGP
x	004c  K2 GMAC (Sun GEM)x+	004f  Shasta Mac I/Ox+	0050  Shasta IDE
+	0051  Shasta (Sun GEM)x+	0052  Shasta Firewirex+	0053  Shasta PCI Bridgex+	0054  Shasta PCI Bridgex+	0055  Shasta PCI Bridgex+	0058  U3L AGP Bridge
 	1645  Tigon3 Gigabit Ethernet NIC (BCM5701)
-106c  Hyundai Electronics Americax+106c  Hynix Semiconductorxx	8801  Dual Pentium ISA/PCI Motherboardxx	8802  PowerPC ISA/PCI Motherboardxx	8803  Dual Window Graphics Acceleratorx@@ -2270,6 +244067 @@xx107d  LeadTek Research Inc.
x	0000  P86C850xx	2134  WinFast 3D S320 II
+	2971  [GeForce FX 5900] WinFast A350 TDH MyViVoxx107e  Interphase Corporation
 	0001  5515 ATM Adapter [Flipper]
x	0002  100 VG AnyLan Controller
@@ -2347,6 +251867 @@xx	a000  Ultra IIixx	a001  Ultra IIe
x	a801  Tomatillo PCI Bus Modulex+	abba  Cassini 10/100/1000xx108f  Systemsoft
 1090  Encore Computer Corporation
 1091  Intergraph Corporation
@@ -2357,6 +2529,8 @@xx	0060  Proprietary bus bridgexx	00e4  Powerstorm 4D50T
 	0720  Motion JPEG codec
+	07a0  Sun Expert3D-Lite Graphics Acceleratorx+	1091  Sun Expert3D Graphics Acceleratorx 1092  Diamond Multimedia Systemsxx	00a0  Speedstar Pro SE
x	00a8  Speedstar 64
@@ -2386,9 +2560619 @@xx	1190  PCI-MIO-16E-4xx	1330  PCI-6031Exx	1350  PCI-6071E
+	14e0  PCI-6110
+	14f0  PCI-6111xx	17d0  PCI-6503
+	1870  PCI-6713
+	1880  PCI-6711
+	18b0  PCI-6052Ex 	2410  PCI-6733
+	2890  PCI-6036Ex 	2a60  PCI-6023E
+	2a70  PCI-6024E
+	2a80  PCI-6025E
+	2c80  PCI-6035E
+	2ca0  PCI-6034Ex 	b001  IMAQ-PCI-1408x 	b011  IMAQ-PXI-1408x 	b021  IMAQ-PCI-1424
@@ -2403,13 +2587,13 @@xx	c831  PCI-GPIB bridgexx1094  First International Computers [FIC]
 1095  Silicon Image, Inc. (formerly CMD Technology Inc)
-	0240  Adaptec AAR-1210SA SATA HostRAIDx+	0240  Adaptec AAR-1210SA SATA HostRAID Contr.
x	0640  PCI0640
x	0643  PCI0643
x	0646  PCI0646
x	0647  PCI0647
x	0648  PCI0648
-	0649  PCI0649x+	0649  SiI 0649 Ultra ATA-100 Host Controllerx 		0e11 005d  Integrated Ultra ATA-100 Dual Channel Controllerx 		0e11 007e  Integrated Ultra ATA-100 IDE RAID Controllerx 		101e 0649  AMI MegaRAID IDE 100 Controller
@@ -2420,9 +2604,16 @@xx	0680  PCI0680 Ultra ATA-133 Host Controllerx 		1095 3680  Winic W-680 (Silicon Image 680 based)xx	3112  SiI 3112 [SATALink/SATARaid] Serial ATA Controllerx-		1095 6112  Asus A7N8Xx+		1095 3112  SiI 3112 SATALink Controllerx+		1095 6112  SiI 3112 SATARaid Controllerx 	3114  SiI 3114 [SATALink/SATARaid] Serial ATA Controllerx+		1095 3114  SiI 3114 SATALink Controllerx+		1095 6114  SiI 3114 SATARaid Controllerx+	3124  SiI 3124 PCI-X Serial ATA Controllerx+		1095 3124  SiI 3124 PCI-X Serial ATA Controllerx 	3512  SiI 3512 [SATALink/SATARaid] Serial ATA Controllerx+		1095 3512  SiI 3512 SATALink Controllerx+		1095 6512  SiI 3512 SATARaid Controllerx 1096  Alacron
 1097  Appian Technologyxx1098  Quantum Designs (H.K.) Ltd
@@ -2444,6 +263567 @@xx	036e  Bt878 Video Capture
 		0070 13eb  WinTV Series
 		0070 ff01  Viewcast Osprey 200x+		0071 0101  DigiTV PCIxx		107d 6606  WinFast TV 2000xx		11bd 0012  PCTV pro (TV + FM stereo receiver)xx		11bd 001c  PCTV Sat (DBC receiver)x@@ -2454,6 +264667 @@xx		144f 3000  MagicTView CPH060 - Video
x		1461 0002  TV98 Series (TV/No FM/Remote)
x		1461 0004  AVerTV WDM Video Capture
+		1461 0761  AverTV DVB-T
x		14f1 0001  Bt878 Mediastream Controller NTSC
x		14f1 0002  Bt878 Mediastream Controller PAL BG
x		14f1 0003  Bt878a Mediastream Controller PAL BG
@@ -2462,6 +265567 @@xx		1851 1850  FlyVideo'98 - Video
x		1851 1851  FlyVideo II
x		1852 1852  FlyVideo'98 - Video (with FM Tuner)
+		270f fc00  Digitop DTT-1000xx		bd11 1200  PCTV pro (TV + FM stereo receiver)xx	036f  Bt879 Video Capture
 		127a 0044  Bt879 Video Capture NTSC
@@ -2500,6 +2694,7 @@xx	0878  Bt878 Audio Capture
 		0070 13eb  WinTV Series
 		0070 ff01  Viewcast Osprey 200x+		0071 0101  DigiTV PCIxx		1002 0001  TV-Wonder
 		1002 0003  TV-Wonder/VExx		11bd 0012  PCTV pro (TV + FM stereo receiver, audio section)x@@ -2511,11 +2706,13 @@xx		13e9 0070  Win/TV (Audio Section)xx		144f 3000  MagicTView CPH060 - Audioxx		1461 0004  AVerTV WDM Audio Capture
+		1461 0761  AVerTV DVB-T
x		14f1 0001  Bt878 Video Capture (Audio Section)xx		14f1 0002  Bt878 Video Capture (Audio Section)xx		14f1 0003  Bt878 Video Capture (Audio Section)xx		14f1 0048  Bt878 Video Capture (Audio Section)xx		1822 0001  VisionPlus DVB Cardx+		270f fc00  Digitop DTT-1000xx		bd11 1200  PCTV pro (TV + FM stereo receiver, audio section)xx	0879  Bt879 Audio Capture
 		127a 0044  Bt879 Video Capture (Audio Section)x@@ -2631,12 +2828,15 @@xx		15ed 1003  MCCS 16-port Serial Hot Swapx 	9036  9036x 	9050  PCI <-> IOBus Bridgex+		10b5 1067  IXXAT CAN i165x+		10b5 1172  IK220 (Heidenhain)xx		10b5 2036  SatPak GPSxx		10b5 2221  Alpermann+Velte PCL PCI LV: Timecode Reader Boardxx		10b5 2273  SH-ARC SoHard ARCnet cardxx		10b5 2431  Alpermann+Velte PCL PCI D: Timecode Reader Boardxx		10b5 2905  Alpermann+Velte PCI TS: Time Synchronisation Boardxx		10b5 9050  MP9050
+		1498 0362  TPMC866 8 Channel Serial Cardxx		1522 0001  RockForce 4 Port V.90 Data/Fax/Voice Modemxx		1522 0002  RockForce 2 Port V.90 Data/Fax/Voice Modemxx		1522 0003  RockForce 6 Port V.90 Data/Fax/Voice Modemx@@ -2689,6 +2889,8 @@xx		125c 0640  Aries 16000P
 	906e  9060ES
 	9080  9080x+		103c 10eb  (Agilent) E2777B 83K Series PCI based Optical Communication Interface
+		103c 10ec  (Agilent) E6978-66442 PCI CICxx		10b5 9080  9080 [real subsystem ID not set]xx		129d 0002  Aculab PCI Prosidy cardxx		12d9 0002  PCI Prosody Card
@@ -2721,6 +2923,8 @@xx	1001  Collage 155 ATM Server Adapterx 10b7  3Com Corporation
 	0001  3c985 1000BaseSX (SX/TX)x+	0013  AR5212 802.11abg NIC (3CRDAG675)
+		10b7 2031  3CRDAG675 11a/b/g Wireless PCI Adapterxx	0910  3C910-A01xx	1006  MINI PCI type 3B Data Fax Modemxx	1007  Mini PCI 56k Winmodemx@@ -2731,6 +293567 @@xx		1043 80eb  P4P800 Mainboardxx		10b7 0010  3C940 Gigabit LOM Ethernet Adapterxx		10b7 0020  3C941 Gigabit LOM Ethernet Adapterx+		147b 1407  KV8-MAX3 motherboardxx	3390  3c339 TokenLink Velocityx 	3590  3c359 TokenLink Velocity XLx 		10b7 3590  TokenLink Velocity XL Adapter (3C359/359B)x@@ -2769,6 +2974,7 @@xx	7940  3c803 FDDILink UTP Controllerxx	7980  3c804 FDDILink SAS Controllerxx	7990  3c805 FDDILink DAS Controllerx+	80eb  3c940B 10/100/1000Base-Txx	8811  Token ring
 	9000  3c900 10BaseT [Boomerang]
 	9001  3c900 10Mbps Combo [Boomerang]
@@ -2808,6 +3014,7 @@xx	9200  3c905C-TX/TX-M [Tornado]x 		1028 0095  3C920 Integrated Fast Ethernet Controllerx 		1028 0097  3C920 Integrated Fast Ethernet Controllerx+		1028 00fe  Optiplex GX240xx		1028 012a  3C920 Integrated Fast Ethernet Controller [Latitude C640]x 		10b7 1000  3C905C-TX Fast Etherlink for PC Management NICxx		10b7 7000  10/100 Mini PCI Ethernet Adapterx@@ -2820,6 +3027,8 @@xx	9800  3c980-TX Fast Etherlink XL Server Adapter [Cyclone]x 		10b7 9800  3c980-TX Fast Etherlink XL Server Adapterxx	9805  3c980-C 10/100baseTX NIC [Python-T]
+		10b7 1201  EtherLink Server 10/100 Dual Port A
+		10b7 1202  EtherLink Server 10/100 Dual Port Bx 		10b7 9805  3c980 10/100baseTX NIC [Python-T]
 		10f1 2462  Thunder K7 S2462x 	9900  3C990-TX [Typhoon]
@@ -2861,8 +3070,11 @@xx	a011  83C170QFxx	b106  SMC34C90x 10b9  ALi Corporation
+	0101  CMI8338/C3DX PCI Audio Devicexx	0111  C-Media CMI8738/C3DX Audio Device (OEM)xx		10b9 0111  C-Media CMI8738/C3DX Audio Device (OEM)x+	0780  Multi-IO Cardx+	0782  Multi-IO Cardxx	1435  M1435xx	1445  M1445xx	1449  M1449
@@ -2878,6 +309067 @@xx		10b9 1523  ALI M1523 ISA Bridge
 	1531  M1531 [Aladdin IV]
x	1533  M1533 PCI to ISA Bridge [Aladdin IV]
+		1014 053b  ThinkPad R40e (2684-HVG) PCI to ISA Bridge
x		10b9 1533  ALI M1533 Aladdin IV ISA Bridge
 	1541  M1541
x		10b9 1541  ALI M1541 Aladdin V/V+ AGP System Controllerx@@ -2892,8 +3105,10 @@xx	1647  M1647 Northbridge [MAGiK 1 / MobileMAGiK 1]
x	1651  M1651/M1651T Northbridge [Aladdin-Pro 5/5M,Aladdin-Pro 5T/5TM]
x	1671  M1671 Super P4 Northbridge [AGP4X,PCI and SDR/DDR]
+	1672  M1672 Northbridge [CyberALADDiN-P4]
x	1681  M1681 P4 Northbridge [AGP8X,HyperTransport and SDR/DDR]
x	1687  M1687 K8 Northbridge [AGP8X and HyperTransport]
+	1689  M1689 K8 Northbridge [Super K8 Single Chip]
x	3141  M3141
x	3143  M3143
x	3145  M3145
@@ -2910,22 +3125,34 @@xx	5225  M5225xx	5229  M5229 IDE
 		1014 050f  ThinkPad R30
+		1014 053d  ThinkPad R40e (2684-HVG) builtin IDE
+		103c 0024  Pavilion ze4400 builtin IDE
 		1043 8053  A7A266 Motherboard IDE
 	5235  M5225xx	5237  USB 1.1 Controllerx+		1014 0540  ThinkPad R40e (2684-HVG) builtin USBx+		103c 0024  Pavilion ze4400 builtin USBxx	5239  USB 2.0 Controllerxx	5243  M1541 PCI to AGP Controllerx+	5246  AGP8X Controllerxx	5247  PCI to AGP Controllerxx	5249  M5249 HTT to PCI Bridgexx	5251  M5251 P1394 OHCI 1.0 Controllerxx	5253  M5253 P1394 OHCI 1.1 Controllerxx	5261  M5261 Ethernet Controllerx+	5263  M5263 Ethernet Controllerx+	5281  ALi M5281 Serial ATA / RAID Host Controllerx 	5450  Lucent Technologies Soft Modem AMRx 	5451  M5451 PCI AC-Link Controller Audio Devicexx		1014 0506  ThinkPad R30
+		1014 053e  ThinkPad R40e (2684-HVG) builtin Audiox+		103c 0024  Pavilion ze4400 builtin Audiox+		10b9 5451  HP Compaq nc4010 (DY885AA#ABN)xx	5453  M5453 PCI AC-Link Controller Modem Devicexx	5455  M5455 PCI AC-Link Controller Audio Devicexx	5457  M5457 AC'97 Modem Controllerx+		1014 0535  ThinkPad R40e (2684-HVG) builtin modemx+		103c 0024  Pavilion ze4400 builtin Modem Devicexx# Same but more usefull for driver's lookupxx	5459  SmartLink SmartPCI561 56K Modemxx# SmartLink PCI SoftModemx@@ -2934,6 +3161,8 @@xx	5473  M5473 SD-MMC Controllerxx	7101  M7101 Power Management Controller [PMU]x 		1014 0510  ThinkPad R30
+		1014 053c  ThinkPad R40e (2684-HVG) Power Management Controllerx+		103c 0024  Pavilion ze4400x 10ba  Mitsubishi Electric Corp.xx	0301  AccelGraphics AccelECLIPSE
x	0304  AccelGALAXY A2100 [OEM Evans & Sutherland]x@@ -2990,6 +321967 @@xx		0e11 b126  MagicMedia 256AV Audio Device on Durango
 		1014 00dd  MagicMedia 256AV Audio Device on BlackTip Thinkpadxx		1025 1003  MagicMedia 256AV Audio Device on TravelMate 720x+		1028 0088  Latitude CPi Ax 		1028 008f  MagicMedia 256AV Audio Device on Colorado Inspironxx		103c 0007  MagicMedia 256AV Audio Device on Voyager II
x		103c 0008  MagicMedia 256AV Audio Device on Voyager IIIx@@ -3074,6 +330467 @@xx		1043 0205  PCI-V3800xx		1043 4000  AGP-V3800PROxx		1048 0c21  Synergy II
+		1048 0c31  Erazor IIIxx		107d 2134  WinFast 3D S320 II + TV-Outxx		1092 4804  Viper V770xx		1092 4a00  Viper V770x@@ -311567 +3346,35 @@xx		1554 1041  Pixelview RIVA TNT2 M64xx	002e  NV6 [Vanta]xx	002f  NV6 [Vanta]x-	0041  NV40 OS1RT00B30x+	0034  MCP04 SMBus
+	0035  MCP04 IDE
+	0036  MCP04 Serial ATA Controllerx+	0037  MCP04 Ethernet Controllerx+	0038  MCP04 Ethernet Controllerx+	003a  MCP04 AC'97 Audio Controllerx+	003b  MCP04 USB Controllerx+	003c  MCP04 USB Controllerx+	003d  MCP04 PCI Bridgex+	003e  MCP04 Serial ATA Controllerx+	0040  NV40 [GeForce 6800 Ultra]
+	0041  NV40 [GeForce 6800]
+	0042  NV40.2
+	0043  NV40.3
+	0045  NV40 [GeForce 6800 GT]
+	0049  NV40GL
+	004e  NV40GL [Quadro FX 4000]
+	0052  CK804 SMBus
+	0053  CK804 IDE
+	0054  CK804 Serial ATA Controllerx+	0055  CK804 Serial ATA Controllerx+	0056  CK804 Ethernet Controllerx+	0057  CK804 Ethernet Controllerx+	0059  CK804 AC'97 Audio Controllerx+	005a  CK804 USB Controllerx+	005b  CK804 USB Controllerx+	005c  CK804 PCI Bridgex+	005d  CK804 PCIE Bridgex+	005e  CK804 Memory Controllerxx	0060  nForce2 ISA Bridge
x		1043 80ad  A7N8X Mainboardxx	0064  nForce2 SMBus (MCP)x@@ -3128,14 +3387,30 @@xx		1043 0c11  A7N8X Mainboardxx	006a  nForce2 AC97 Audio Controler (MCP)xx	006b  nForce MultiMedia audio [Via VT82C686B]
+		10de 006b  nForce2 MCP Audio Processing Unitxx	006c  nForce2 External PCI Bridgexx	006d  nForce2 PCI Bridgexx	006e  nForce2 FireWire (IEEE 1394) Controllerx+	0084  MCP2A SMBus
+	0085  MCP2A IDE
+	0086  MCP2A Ethernet Controllerx+	0087  MCP2A USB Controllerx+	0088  MCP2A USB Controllerx+	008a  MCP2S AC'97 Audio Controllerx+	008b  MCP2A PCI Bridgex+	008c  MCP2A Ethernet Controllerx+	008e  nForce2 Serial ATA Controllerx 	00a0  NV5 [Aladdin TNT2]
x		14af 5810  Maxi Gamer Xentorx+	00c0  NV41.0x+	00c1  NV41.1x+	00c2  NV41.2
+	00c8  NV41.8
+	00ce  NV41GLxx	00d0  nForce3 LPC Bridgexx	00d1  nForce3 Host Bridge
x	00d2  nForce3 AGP Bridge
+	00d3  CK804 Memory Controllerxx	00d4  nForce3 SMBus
x	00d5  nForce3 IDE
 	00d6  nForce3 Ethernetx@@ -3143,6 +3418,29 @@xx	00d8  nForce3 USB 2.0xx	00da  nForce3 Audioxx	00dd  nForce3 PCI Bridgex+	00df  CK8S Ethernet Controllerx+	00e1  nForce3 250Gb Host Bridge
+	00e2  nForce3 250Gb AGP Host to PCI Bridgex+	00e3  CK8S Serial ATA Controller (v2.5)x+	00e4  nForce 250Gb PCI System Managementx+	00e5  CK8S Parallel ATA Controller (v2.5)x+	00e6  CK8S Ethernet Controllerx+	00e7  CK8S USB Controllerx+	00e8  CK8S USB Controllerx+	00ea  nForce3 250Gb AC'97 Audio Controllerx+	00ed  nForce3 250Gb PCI-to-PCI Bridgex+	00ee  CK8S Serial ATA Controller (v2.5)x+	00f0  NV40 [GeForce 6800/GeForce 6800 Ultra]
+	00f1  NV43 [GeForce 6600/GeForce 6600 GT]
+	00f2  NV43 [GeForce 6600 GT]
+	00f8  NV45GL [Quadro FX 3400]
+	00f9  NV40 [GeForce 6800 Ultra]
+	00fa  NV36 [GeForce PCX 5750]
+	00fb  NV35 [GeForce PCX 5900]
+	00fc  NV37GL [Quadro FX 330/GeForce PCX 5300]
+	00fd  NV37GL [Quadro FX 330]
+	00fe  NV38GL [Quadro FX 1300]
+	00ff  NV18 [GeForce PCX 4300]
 	0100  NV10 [GeForce 256 SDR]xx		1043 0200  AGP-V6600 SGRAMxx		1043 0201  AGP-V6600 SDRAMx@@ -3161,6 +345967 @@xx	0110  NV11 [GeForce2 MX/MX 400]xx		1043 4015  AGP-V7100 Pro
 		1043 4031  V7100 Pro with TV outputx+		10de 0091  Dell OEM GeForce 2 MX 400xx		1462 8817  MSI GeForce2 MX400 Pro32S [MS-8817]
x		14af 7102  3D Prophet II MX
x		14af 7103  3D Prophet II MX Dual-Displayx@@ -3197,6 +349667 @@xx	017a  NV17GL [Quadro4 200/400 NVS]
 	017b  NV17GL [Quadro4 550 XGL]
x	017c  NV17GL [Quadro4 550 GoGL]
+	017d  NV17 [GeForce4 410 Go 16M]
x	0181  NV18 [GeForce4 MX 440 AGP 8x]
x		1043 806f  V9180 Magicxx		1462 8880  MS-StarForce GeForce4 MX 440 with AGP8X
@@ -3206,14 +3506,18 @@xx	0182  NV18 [GeForce4 MX 440SE AGP 8x]
x	0183  NV18 [GeForce4 MX 420 AGP 8x]
x	0185  NV18 [GeForce4 MX 4000 AGP 8x]
+	0186  NV18M [GeForce4 448 Go]
+	0187  NV18M [GeForce4 488 Go]
 	0188  NV18GL [Quadro4 580 XGL]
x	018a  NV18GL [Quadro4 NVS AGP 8x]
x	018b  NV18GL [Quadro4 380 XGL]
+	018d  NV18M [GeForce4 448 Go]
x	01a0  NVCrush11 [GeForce2 MX Integrated Graphics]
x	01a4  nForce CPU bridgexx	01ab  nForce 420 Memory Controller (DDR)xx	01ac  nForce 220/420 Memory Controllerxx	01ad  nForce 220/420 Memory Controllerx+	01b0  nForce Audioxx	01b1  nForce Audioxx	01b2  nForce ISA Bridge
x	01b4  nForce PCI System Managementx@@ -3241,6 +354567 @@xx	0203  NV20DCC [Quadro DCC]
x	0250  NV25 [GeForce4 Ti 4600]
x	0251  NV25 [GeForce4 Ti 4400]
+		1043 8023  v8440 GeForce 4 Ti4400x 	0252  NV25 [GeForce4 Ti]
x	0253  NV25 [GeForce4 Ti 4200]xx		107d 2896  WinFast A250 LE TD (Dual VGA/TV-out/DVI)
@@ -3254,6 +355967 @@xx	0286  NV28 [GeForce4 Ti 4200 Go AGP 8x]
x	0288  NV28GL [Quadro4 980 XGL]
x	0289  NV28GL [Quadro4 780 XGL]
+	028c  NV28GLM [Quadro4 700 GoGL]
x	0300  NV30 [GeForce FX]xx	0301  NV30 [GeForce FX 5800 Ultra]
x	0302  NV30 [GeForce FX 5800]
@@ -3261,32 +3567,66 @@xx	0309  NV30GL [Quadro FX 1000]
x	0311  NV31 [GeForce FX 5600 Ultra]
x	0312  NV31 [GeForce FX 5600]
+	0313  NV31
x	0314  NV31 [GeForce FX 5600XT]
+		1043 814a  V9560XT/TD
+	0316  NV31
+	0317  NV31
x	031a  NV31M [GeForce FX Go 5600]
+	031b  NV31M [GeForce FX Go5650]
x	031c  NVIDIA Quadro FX 700 Go
+	031d  NV31
+	031e  NV31
+	031f  NV31
+	0320  NV34 [GeForce FX 5200]
x	0321  NV34 [GeForce FX 5200 Ultra]
x	0322  NV34 [GeForce FX 5200]
x		1462 9171  MS-8917 (FX5200-T128)
+	0323  NV34 [GeForce FX 5200LE]xx	0324  NV34M [GeForce FX Go 5200]xx		1071 8160  MIM2000x+	0325  NV34M [GeForce FX Go5250]
+	0326  NV34 [GeForce FX 5500]
+	0327  NV34 [GeForce FX 5100]
x	0328  NV34M [GeForce FX Go 5200]xx	0329  NV34M [GeForce FX Go5200]x-	032b  NV34GL [Quadro FX 500]
+	032a  NV34GL [Quadro NVS 280 PCI]
+	032b  NV34GL [Quadro FX 500/600 PCI]
x	032c  NV34GLM [GeForce FX Go 5300]
+	032d  NV34 [GeForce FX Go5100]
+	032f  NV34xx	0330  NV35 [GeForce FX 5900 Ultra]
x	0331  NV35 [GeForce FX 5900]
+		1043 8145  V9950GE
x	0332  NV35 [GeForce FX 5900XT]
x	0333  NV38 [GeForce FX 5950 Ultra]
+	0334  NV35 [GeForce FX 5900ZT]
x	0338  NV35GL [Quadro FX 3000]x-	0341  NV 36 [GeForce 5700 Ultra]
-	0342  NV 36 [GeForce 5700]
+	033f  NV35GL [Quadro FX 700]
+	0341  NV36.1 [GeForce FX 5700 Ultra]
+	0342  NV36.2 [GeForce FX 5700]
+	0343  NV36 [GeForce FX 5700LE]
+	0344  NV36.4 [GeForce FX 5700VE]
+	0345  NV36.5
+	0347  NV36 [GeForce FX Go5700]
+	0348  NV36 [GeForce FX Go5700]
+	0349  NV36
+	034b  NV36
+	034c  NV36 [Quadro FX Go1000]
+	034e  NV36GL [Quadro FX 1100]
+	034f  NV36GLx 10df  Emulex Corporation
 	1ae5  LP6000 Fibre Channel Host Adapterxx	1ae6  LP 8000 Fibre Channel Host Adapter Alternate ID (JX1:2-3, JX2:1-2)xx	1ae7  LP 8000 Fibre Channel Host Adapter Alternate ID (JX1:2-3, JX2:2-3)
+	f015  LP1150e
x	f085  LP850 Fibre Channel Adapterxx	f095  LP952 Fibre Channel Adapterxx	f098  LP982 Fibre Channel Adapterx+	f0a1  LightPulse Fibre Channel Adapterx+	f0a5  LP1050
+	f0d5  LP1150
+	f100  LP11000e
x	f700  LP7000 Fibre Channel Host Adapterxx	f701  LP 7000EFibre Channel Host Adapter Alternate ID (JX1:2-3, JX2:1-2)xx	f800  LP8000 Fibre Channel Host Adapter
@@ -3297,6 +3637,9 @@xx	f981  LP 9802 Fibre Channel Host Adapter Alternate IDxx	f982  LP 9802 Fibre Channel Host Adapter Alternate IDxx	fa00  LP10000 Fibre Channel Host Adapter
+	fa01  LP101
+	fb00  LightPulse Fibre Channel Adapterx+	fd00  LP11000x 10e0  Integrated Micro Solutions Inc.
x	5026  IMS5026/27/28
x	5027  IMS5027
@@ -3314,6 +3657,8 @@xx	0000  CA91C042 [Universe]x 	0860  CA91C860 [QSpan]x 	0862  CA91C862A [QSpan-II]x+	8260  CA91L8200B [Dual PCI PowerSpan II]x+	8261  CA91L8260B [Single PCI PowerSpan II]x 10e4  Tandem Computersx 10e5  Micro Industries Corporation
 10e6  Gainbery Computer Products Inc.
@@ -3333,8 +3678,18 @@xx	80d9  PCI-9118xx	80da  PCI-9812x 	811a  PCI-IEEE1355-DS-DE Interface
+	814c  Fastcom ESCC-PCI (Commtech, Inc.)xx	8170  S5933 [Matchmaker] (Chipset Development Tool)
+# sold with Roper Scientifc(Photometrics) CoolSnap HQ camera
+	81e6  Multimedia video controllerx+	8291  Fastcom 232/8-PCI (Commtech, Inc.)x+	82c4  Fastcom 422/4-PCI (Commtech, Inc.)x+	82c5  Fastcom 422/2-PCI (Commtech, Inc.)x+	82c6  Fastcom IG422/1-PCI (Commtech, Inc.)x+	82c7  Fastcom IG232/2-PCI (Commtech, Inc.)x+	82ca  Fastcom 232/4-PCI (Commtech, Inc.)xx	82db  AJA HDNTV HD SDI Framestore
+	82e2  Fastcom DIO24H-PCI (Commtech, Inc.)xx	8851  S5933 on Innes Corp FM Radio Capture cardxx10e9  Alps Electric Co., Ltd.
x10ea  Intergraphics Systemsx@@ -3363,6 +3718,8 @@xx	8138  RT8139 (B/C) Cardbus Fast Ethernet Adapterxx		10ec 8138  RT8139 (B/C) Fast Ethernet Adapterxx	8139  RTL-8139/8139C/8139C+x+		0357 000a  TTP-Monitoring Card V2.0x+		1025 005a  TravelMate 290xx		1025 8920  ALN-325xx		1025 8921  ALN-325xx		1071 8160  MIM2000x@@ -3378619 +3735,23 @@xx		1429 d010  ND010xx		1432 9130  EN-9130TX
x		1436 8139  RT8139x-		1458 e000  GA-7VM400M Motherboardx+		1458 e000  GA-7VM400M/7VT600 Motherboardxx		146c 1439  FE-1439TX
x		1489 6001  GF100TXRIIxx		1489 6002  GF100TXRAx 		149c 139a  LFE-8139ATX
x		149c 8139  LFE-8139TX
+		14cb 0200  LNR-100 Family 10/100 Base-TX Ethernetxx		1799 5000  F5D5000 PCI Card/Desktop Network PCI Cardxx		2646 0001  EtheRxxx		8e2e 7000  KF-230TX
x		8e2e 7100  KF-230TX/2x 		a0a0 0007  ALN-325Cxx	8169  RTL-8169 Gigabit Ethernetx+		1259 c107  CG-LAPCIGT
x		1371 434e  ProG-2000Lx+		1458 e000  GA-K8VT800 Pro Motherboardx+		1462 702c  K8T NEO 2 motherboardxx	8180  RTL8180L 802.11b MACxx	8197  SmartLAN56 56K Modemxx10ed  Ascii Corporation
@@ -3455,6 +381667 @@xx		1102 8061  SBLive! Player 5.1xx		1102 8064  SB Live! 5.1 Model SB0100xx		1102 8065  SBLive! 5.1 Digital Model SB0220x+		1102 8067  SBLive! 5.1 eMicro 28028
x	0004  SB Audigyxx		1102 0051  SB0090 Audigy Playerxx		1102 0053  SB0090 Audigy Player/OEMx@@ -3462,6 +3824,9 @@xx		1102 2002  SB Audigy 2 ZS (SB0350)xx	0006  [SB Live! Value] EMU10k1Xxx	0007  SB Audigy LSx+		1102 1001  SB0310 Audigy LSx+		1102 1002  SB0312 Audigy LSx+	0008  SB0400 Audigy2 Value
x	4001  SB Audigy FireWire Portxx		1102 0010  SB Audigy FireWire Portxx	7002  SB Live! MIDI/Game Portx@@ -3470,6 +3835,8 @@xx		1102 0040  SB Audigy MIDI/Game Portxx	7004  [SB Live! Value] Input device controllerx 	7005  SB Audigy LS MIDI/Game portx+		1102 1001  SB0310 Audigy LS MIDI/Game portx+		1102 1002  SB0312 Audigy LS MIDI/Game portxx	8064  SB0100 [SBLive! 5.1 OEM]x 	8938  Ectiva EV1938
 1103  Triones Technologies, Inc.
@@ -3477,7 +3844,12 @@xx# Revisions: 01=HPT366, 03=HPT370, 04=HPT370A, 05=HPT372
x	0004  HPT366/368/370/370A/372
x		1103 0001  HPT370Ax+		1103 0003  HPT343 / HPT345 / HPT363 UDMA33x+		1103 0004  HPT366 UDMA66 (r1) / HPT368 UDMA66 (r2) / HPT370 UDMA100 (r3) / HPT370 UDMA100 RAID (r4)
x		1103 0005  HPT370 UDMA100x+		1103 0006  HPT302x+		1103 0007  HPT371 UDMA133x+		1103 0008  HPT374 UDMA/ATA133 RAID Controllerx 	0005  HPT372Axx	0006  HPT302xx	0007  HPT371
@@ -3519,6 +3891,9 @@xx		1179 0001  Magnia Z310xx		1297 f641  FX41 motherboardxx		1458 5002  GA-7VAX Mainboardx+		1462 7020  K8T NEO 2 motherboardx+		147b 1407  KV8-MAX3 motherboardx+		1849 0571  K7VT2 motherboardxx	0576  VT82C576 3V [Apollo Master]
x	0585  VT82C585VP [Apollo VP1/VPX]
x	0586  VT82C586/A/B PCI-to-ISA [Apollo VP]
@@ -3555,6 +393067 @@xx	1106  VT82C570MV
 	1571  VT82C576M/VT82C586
 	1595  VT82C595/97 [Apollo VP2/97]x+	3022  CLE266
x# This is *not* USB 2.0 as the existing entry suggestsxx	3038  VT82xxxxx UHCI USB 1.1 Controllerxx		0925 1234  USB Controllerx@@ -3565,12 +3941,17 @@xx		1043 80ed  A7V600 motherboardxx		1179 0001  Magnia Z310xx		1458 5004  GA-7VAX Mainboardx+		1462 7020  K8T NEO 2 motherboardx+		147b 1407  KV8-MAX3 motherboardxx	3040  VT82C586B ACPI
x	3043  VT86C100A [Rhine]x 		10bd 0000  VT86C100A Fast Ethernet Adapterxx		1106 0100  VT86C100A Fast Ethernet Adapterxx		1186 1400  DFE-530TX rev A
x	3044  IEEE 1394 Host Controllerx+		1025 005a  TravelMate 290x+		1458 1000  GA-7VT600-1394 Motherboardx+		1462 702d  K8T NEO 2 motherboardxx	3050  VT82C596 Power Managementxx	3051  VT82C596 Power Managementxx	3053  VT6105M [Rhine-III]x@@ -3597,16 +3978,20 @@xx		1043 80a1  A7V8X-X Motherboardxx		1043 80b0  A7V600 motherboard (ADI AD1980 codec [SoundMAX])xx		1106 3059  L7VMM2 Motherboardx+		1106 4161  K7VT2 motherboardxx		1297 c160  FX41 motherboard (Realtek ALC650 codec)xx		1458 a002  GA-7VAX Onboard Audio (Realtek ALC650)x+		1462 0080  K8T NEO 2 motherboardxx		1462 3800  KT266 onboard audiox+		147b 1407  KV8-MAX3 motherboardxx	3065  VT6102 [Rhine-II]xx		1043 80a1  A7V8X-X Motherboardxx		1106 0102  VT6102 [Rhine II] Embeded Ethernet Controller on VT8235xx		1186 1400  DFE-530TX rev A
x		1186 1401  DFE-530TX rev Bx 		13b9 1421  LD-10/100AL PCI Fast Ethernet Adapter (rev.B)
-	3068  Intel 537 [AC97 Modem]
+# This hosts more than just the Intel 537 codec, it also hosts PCtel (SIL33) and SmartLink (SIL34) codecsx+	3068  AC'97 Modem Controllerxx		1462 309e  MS-6309 Saturn Motherboardxx	3074  VT8233 PCI to ISA Bridge
 		1043 8052  VT8233A
@@ -3614,6 +399967 @@xx	3099  VT8366/A/7 [Apollo KT266/A/333]
x		1043 8064  A7V266-E Mainboardxx		1043 807f  A7V333 Mainboardx+		1849 3099  K7VT2 motherboardxx	3101  VT8653 Host Bridge
x	3102  VT8662 Host Bridge
x	3103  VT8615 Host Bridge
@@ -3624,12 +4010,17 @@xx		1043 80ed  A7V600 motherboardxx		1297 f641  FX41 motherboardxx		1458 5004  GA-7VAX Mainboardx+		1462 7020  K8T NEO 2 motherboardx+		147b 1407  KV8-MAX3 motherboardxx	3106  VT6105 [Rhine-III]xx		1186 1403  DFE-530TX rev Cx+	3108  S3 Unichrome Pro VGA Adapterxx	3109  VT8233C PCI to ISA Bridge
 	3112  VT8361 [KLE133] Host Bridge
x	3116  VT8375 [KM266/KL266] Host Bridge
x		1297 f641  FX41 motherboardx+	3118  S3 Unichrome Pro VGA Adapterx+	3119  VT6120/VT6121/VT6122 Gigabit Ethernet Adapterxx# found on EPIA M6000/9000 mainboardxx	3122  VT8623 [Apollo CLE266] integrated CastleRock graphicsxx# found on EPIA M6000/9000 mainboardx@@ -3640,6 +403167 @@xx	3148  P4M266 Host Bridge
x	3149  VIA VT6420 SATA RAID Controllerx 		1043 80ed  A7V600 motherboardx+		1458 b003  GA-7VM400AM(F) Motherboardxx		1462 7020  MSI Neo K8T FIS2R mainboardxx	3156  P/KN266 Host Bridge
x# on ASUS P4P800x@@ -3651,20 +4043,27 @@xx		1043 80a1  A7V8X-X motherboardxx		1297 f641  FX41 motherboardxx		1458 5001  GA-7VAX Mainboardx+		1849 3177  K7VT2 motherboardxx	3188  VT8385 [K8T800 AGP] Host Bridge
+		147b 1407  KV8-MAX3 motherboardxx	3189  VT8377 [KT400/KT600 AGP] Host Bridge
x		1043 807f  A7V8X motherboardxx		1458 5000  GA-7VAX Mainboardx-# Updated the entry to the proper "chip [name] desc" format
-	3205  VT8378 [KM400] Chipset Host Bridge
+	3204  K8M800x+	3205  VT8378 [KM400/A] Chipset Host Bridge
x		1458 5000  GA-7VM400M Motherboardx-	3227  VT8237 ISA bridge [K8T800 South]x+	3227  VT8237 ISA bridge [KT600/K8T800 South]x 		1043 80ed  A7V600 motherboardx+		1106 3227  DFI KT600-AL Motherboardx+		1458 5001  GA-7VT600 Motherboardx+		147b 1407  KV8-MAX3 motherboardx+	4149  VIA VT6420 (ATA133) Controllerx 	5030  VT82C596 ACPI [Apollo PRO]x 	6100  VT85C100A [Rhine II]x+	7204  K8M800xx# S3 Graphics UniChromeâ„¢ 2D/3D Graphics with motion compensation
 	7205  VT8378 [S3 UniChrome] Integrated Video
-		1458 d000  GA-7VM400M Motherboardx+		1458 d000  Gigabyte GA-7VM400(A)M(F) Motherboardxx	8231  VT8231 [PCI-to-ISA Bridge]xx	8235  VT8235 ACPI
x	8305  VT8363/8365 [KT133/KM133 AGP]x@@ -3686,6 +408567 @@xx	b112  VT8361 [KLE133] AGP Bridge
 	b168  VT8235 PCI Bridgexx	b188  VT8237 PCI bridge [K8T800 South]x+		147b 1407  KV8-MAX3 motherboardxx	b198  VT8237 PCI Bridge
x# 32-Bit PCI bus master Ethernet MAC with standard MII interface
 	d104  VT8237 Integrated Fast Ethernet Controllerx@@ -3711,9 +4111,12 @@xx	007b  FSC Remote Service Controller, mailbox devicexx	007c  FSC Remote Service Controller, shared memory devicexx	007d  FSC Remote Service Controller, SMIC devicex-	2102  DSCC4 WAN adapterx+# Superfastcom-PCI (Commtech, Inc.) or DSCC4 WAN Adapterx+	2102  DSCC4 PEB/PEF 20534 DMA Supported Serial Communication Contr.
x	2104  Eicon Diva 2.02 compatible passive ISDN cardx+	3142  SIMATIC NET CP 5613A1 (Profibus Adapter)xx	4021  SIMATIC NET CP 5512 (Profibus and MPI Cardbus Adapter)x+	4029  SIMATIC NET CP 5613A2 (Profibus Adapter)xx	4942  FPGA I-Bus Tracer for MBDx 	6120  SZB6120
 110b  Chromatic Research Inc.
@@ -3745,6 +4148,8 @@xx	9211  EN-1207D Fast Ethernet Adapterxx		1113 9211  EN-1207D Fast Ethernet Adapterxx	9511  21x4x DEC-Tulip compatible Fast Ethernetx+	d301  CPWNA100 (Philips wireless PCMCIA)x+	ec02  SMC 1244TX v3
 1114  Atmel Corporation
 	0506  802.11b Wireless Network Adaptor (at76c506)
 1115  3D Labsx@@ -3854,9 +4259,11 @@xx111b  Teledyne Electronic Systemsxx111c  Tricord Systems Inc.
x	0001  Powerbis Bridgex-111d  Integrated Device Techx-	0001  IDT77211 ATM Adapterx-	0003  IDT77252 ATM network controllerx+111d  Integrated Device Technology, Inc.
+	0001  IDT77201/77211 155Mbps ATM SAR Controller [NICStAR]
+	0003  IDT77222/77252 155Mbps ATM MICRO ABR SAR Controller
+	0004  IDT77V252 155Mbps ATM MICRO ABR SAR Controller
+	0005  IDT77V222 155Mbps ATM MICRO ABR SAR Controller
x111e  Eldec
x111f  Precision Digital Imagesxx	4a47  Precision MX Video engine interface
@@ -3890,10 +4297,13 @@xx	1561  USB 1.1 Host Controllerx 	1562  USB 2.0 Host Controllerx 	3400  SmartPCI56(UCB1500) 56K Modemx+	5400  TriMedia TM1000/1100x+	5402  TriMedia TM-1300xx	7130  SAA7130 Video Broadcast Decoderx 		5168 0138  LiveView FlyVideo 2000x-	7133  SAA7133 Audio+video broadcast decoderx+	7133  SAA713X Audio+video broadcast decoderx 		5168 0138  LifeView FlyVideo 3000x+		5168 0212  LifeView FlyTV Platinum mini
x# PCI audio and video broadcast decoder (http://www.semiconductors.philips.com/pip/saa7134hl)xx	7134  SAA7134xx	7135  SAA7135 Audio+video broadcast decoderx@@ -390667 +431667 @@xx		114b 2003  DVRaptor Video Edit/Capture Cardxx		11bd 0006  DV500 Overlayxx		11bd 000a  DV500 Overlayx-		13c2 0000  Siemens/Technotrend/Hauppauge DVB card rev1.3x+		13c2 0000  Siemens/Technotrend/Hauppauge DVB card rev1.3 or rev1.5xx		13c2 0001  Technotrend/Hauppauge DVB card rev1.3 or rev1.6xx		13c2 0002  Technotrend/Hauppauge DVB card rev2.1xx		13c2 0003  Technotrend/Hauppauge DVB card rev2.1x@@ -3998,9 +4408,14 @@xx		1133 2002  Diva Server 4PRI/E1-120
 		1133 2003  Diva Server 4PRI/T1-96xx	e024  Diva Server Analog-4Px+		1133 2400  Diva Server V-Analog-4Px+		1133 e024  Diva Server Analog-4Pxx	e028  Diva Server Analog-8Px+		1133 2800  Diva Server V-Analog-8Px+		1133 e028  Diva Server Analog-8Pxx1134  Mercury Computer Systemsxx	0001  Raceway Bridgex+	0002  Dual PCI to RapidIO Bridge
x1135  Fuji Xerox Co Ltd
x	0001  Printer controllerx 1136  Momentum Data Systemsx@@ -4048,7 +4463,8 @@xx	f015  NinjaSCSI-32 Melcoxx1146  Force Computersx 1147  Interface Corpx-1148  Syskonnect (Schneider & Koch)
+# Formerly (Schneider & Koch)
+1148  SysKonnect
x	4000  FDDI Adapterxx		0e11 b03b  Netelligent 100 FDDI DAS Fibre SC
x		0e11 b03c  Netelligent 100 FDDI SAS Fibre SC
@@ -4106,6 +4522,14 @@xx		1148 9521  SK-9521 10/100/1000Base-T Adapterxx	4400  SK-9Dxx Gigabit Ethernet Adapterxx	4500  SK-9Mxx Gigabit Ethernet Adapterx+	9e00  SK-9Exx 10/100/1000Base-T Adapterx+		1148 2100  SK-9E21 Server Adapterx+		1148 21d0  SK-9E21D 10/100/1000Base-T Adapterx+		1148 2200  SK-9E22 Server Adapterx+		1148 8100  SK-9E81 Server Adapterx+		1148 8200  SK-9E82 Server Adapterx+		1148 9100  SK-9E91 Server Adapterx+		1148 9200  SK-9E92 Server Adapterx 1149  Win System Corporation
 114a  VMICxx	5579  VMIPCI-5579 (Reflective Memory Card)
@@ -4259,6 +468367 @@xx	0212  CSB5 IDE Controllerxx		4c53 1080  CT8 mainboardxx	0213  CSB6 RAID/IDE Controllerx+	0217  CSB6 IDE Controllerxx	0220  OSB4/CSB5 OHCI USB Controllerxx		4c53 1080  CT8 mainboardxx	0221  CSB6 OHCI USB Controllerx@@ -4268,6 +469367 @@xx	0227  GCLE-2 Host Bridge
x	0230  CSB5 LPC bridgexx		4c53 1080  CT8 mainboardx+	0240  K2 SATA
 1167  Mutoh Industries Inc
 1168  Thine Electronics Inc
 1169  Centre for Development of Advanced Computing
@@ -4300,7 +472667 @@xx	0603  ToPIC95 PCI to CardBus Bridge for Notebooksxx	060a  ToPIC95xx	060f  ToPIC97
-	0617  ToPIC95 PCI to Cardbus Bridge with ZV Supportx+	0617  ToPIC100 PCI to Cardbus Bridge with ZV Supportxx	0618  CPU to PCI and PCI to ISA bridge
x# Claimed to be Lucent DSP1645 [Mars], but that's apparently incorrect. Does anyone know the correct ID?
 	0701  FIR Portx@@ -4342,16 +4768,33 @@xx	1002  DL10050 Sundance Ethernetxx		1186 1002  DFE-550TX
x		1186 1012  DFE-580TX
+	1025  AirPlus Xtreme G DWL-G650 Adapterx+	1026  AirXpert DWL-AG650 Wireless Cardbus Adapterx+	1043  AirXpert DWL-AG650 Wireless Cardbus Adapterxx	1300  RTL8139 Ethernetxx		1186 1300  DFE-538TX 10/100 Ethernet Adapterxx		1186 1301  DFE-530TX+ 10/100 Ethernet Adapterxx	1340  DFE-690TXD CardBus PC Cardxx	1541  DFE-680TXD CardBus PC Cardxx	1561  DRP-32TXD Cardbus PC Cardx+	2027  AirPlus Xtreme G DWL-G520 Adapterx+	3203  AirPlus Xtreme G DWL-G520 Adapterxx	3300  DWL-510 2.4GHz Wireless PCI Adapterx+	3a03  AirPro DWL-A650 Wireless Cardbus Adapter(rev.B)
+	3a04  AirPro DWL-AB650 Multimode Wireless Cardbus Adapterx+	3a05  AirPro DWL-AB520 Multimode Wireless PCI Adapterx+	3a07  AirXpert DWL-AG650 Wireless Cardbus Adapterx+	3a08  AirXpert DWL-AG520 Wireless PCI Adapterx+	3a10  AirXpert DWL-AG650 Wireless Cardbus Adapter(rev.B)
+	3a11  AirXpert DWL-AG520 Wireless PCI Adapter(rev.B)
+	3a12  AirPlus DWL-G650 Wireless Cardbus Adapter(rev.C)
+	3a13  AirPlus DWL-G520 Wireless PCI Adapter(rev.B)
+	3a14  AirPremier DWL-AG530 Wireless PCI Adapterx+	3a63  AirXpert DWL-AG660 Wireless Cardbus Adapterxx	3b05  DWL-G650+ CardBus PC Cardxx	4000  DL2000-based Gigabit Ethernetxx	4c00  Gigabit Ethernet Adapterx+		1186 4c00  DGE-530T Gigabit Ethernet Adapterxx	8400  D-Link DWL-650+ CardBus PC Cardxx1187  Advanced Technology Laboratories, Inc.
x1188  Shima Seiki Manufacturing Ltd.
@@ -4432,9 +4875,118 @@xx# Formerly Galileo Technology, Inc.
 11ab  Marvell Technology Group Ltd.
x	0146  GT-64010/64010A System Controllerx+	138f  W8300 802.11 Adapter (rev 07)xx	1fa6  Marvell W8300 802.11 Adapterxx	4146  GT-64011/GT-64111 System Controllerx-	4320  Yukon Gigabit Ethernet 10/100/1000Base-T Adapterx+	4320  Gigabit Ethernet Controllerx+		1019 0f38  Marvell 88E8001 Gigabit Ethernet Controller (ECS)x+		1019 8001  Marvell 88E8001 Gigabit Ethernet Controller (ECS)x+		1043 173c  Marvell 88E8001 Gigabit Ethernet Controller (Asus)
+		1043 811a  Marvell 88E8001 Gigabit Ethernet Controller (Asus)
+		105b 0c19  Marvell 88E8001 Gigabit Ethernet Controller (Foxconn)
+		10b8 b452  SMC EZ Card 1000 (SMC9452TXV.2)
+		11ab 0121  Marvell RDK-8001
+		11ab 0321  Marvell RDK-8003
+		11ab 1021  Marvell RDK-8010
+		11ab 5021  Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Controller (64 bit)
+		11ab 9521  Marvell Yukon Gigabit Ethernet 10/100/1000Base-T Controller (32 bit)
+		1458 e000  Marvell 88E8001 Gigabit Ethernet Controller (Gigabyte)x+		147b 1406  Marvell 88E8001 Gigabit Ethernet Controller (Abit)
+		15d4 0047  Marvell 88E8001 Gigabit Ethernet Controller (Iwill)
+		1695 9025  Marvell 88E8001 Gigabit Ethernet Controller (Epox)
+		17f2 1c03  Marvell 88E8001 Gigabit Ethernet Controller (Albatron)
+		270f 2803  Marvell 88E8001 Gigabit Ethernet Controller (Chaintech)x+	4350  Fast Ethernet Controllerx+		1179 0001  Marvell 88E8035 Fast Ethernet Controller (Toshiba)
+		11ab 3521  Marvell RDK-8035x+		1854 000d  Marvell 88E8035 Fast Ethernet Controller (LGE)x+		1854 000e  Marvell 88E8035 Fast Ethernet Controller (LGE)x+		1854 000f  Marvell 88E8035 Fast Ethernet Controller (LGE)x+		1854 0011  Marvell 88E8035 Fast Ethernet Controller (LGE)x+		1854 0012  Marvell 88E8035 Fast Ethernet Controller (LGE)x+		1854 0016  Marvell 88E8035 Fast Ethernet Controller (LGE)x+		1854 0017  Marvell 88E8035 Fast Ethernet Controller (LGE)x+		1854 0018  Marvell 88E8035 Fast Ethernet Controller (LGE)x+		1854 0019  Marvell 88E8035 Fast Ethernet Controller (LGE)x+		1854 001c  Marvell 88E8035 Fast Ethernet Controller (LGE)x+		1854 001e  Marvell 88E8035 Fast Ethernet Controller (LGE)x+		1854 0020  Marvell 88E8035 Fast Ethernet Controller (LGE)x+	4351  Fast Ethernet Controllerx+		107b 4009  Marvell 88E8036 Fast Ethernet Controller (Wistron)
+		10f7 8338  Marvell 88E8036 Fast Ethernet Controller (Panasonic)x+		1179 0001  Marvell 88E8036 Fast Ethernet Controller (Toshiba)
+		1179 ff00  Marvell 88E8036 Fast Ethernet Controller (Compal)
+		1179 ff10  Marvell 88E8036 Fast Ethernet Controller (Inventec)
+		11ab 3621  Marvell RDK-8036x+		13d1 ac12  Abocom EFE3K - 10/100 Ethernet Expresscardx+		161f 203d  Marvell 88E8036 Fast Ethernet Controller (Arima)x+		1854 000d  Marvell 88E8036 Fast Ethernet Controller (LGE)x+		1854 000e  Marvell 88E8036 Fast Ethernet Controller (LGE)x+		1854 000f  Marvell 88E8036 Fast Ethernet Controller (LGE)x+		1854 0011  Marvell 88E8036 Fast Ethernet Controller (LGE)x+		1854 0012  Marvell 88E8036 Fast Ethernet Controller (LGE)x+		1854 0016  Marvell 88E8036 Fast Ethernet Controller (LGE)x+		1854 0017  Marvell 88E8036 Fast Ethernet Controller (LGE)x+		1854 0018  Marvell 88E8036 Fast Ethernet Controller (LGE)x+		1854 0019  Marvell 88E8036 Fast Ethernet Controller (LGE)x+		1854 001c  Marvell 88E8036 Fast Ethernet Controller (LGE)x+		1854 001e  Marvell 88E8036 Fast Ethernet Controller (LGE)x+		1854 0020  Marvell 88E8036 Fast Ethernet Controller (LGE)x+	4360  Gigabit Ethernet Controllerx+		1043 8134  Marvell 88E8052 Gigabit Ethernet Controller (Asus)
+		107b 4009  Marvell 88E8052 Gigabit Ethernet Controller (Wistron)
+		11ab 5221  Marvell RDK-8052
+		1458 e000  Marvell 88E8052 Gigabit Ethernet Controller (Gigabyte)x+		1462 052c  Marvell 88E8052 Gigabit Ethernet Controller (MSI)x+		1849 8052  Marvell 88E8052 Gigabit Ethernet Controller (ASRock)x+		1940 e000  Marvell 88E8052 Gigabit Ethernet Controller (Gigabyte)x+		a0a0 0509  Marvell 88E8052 Gigabit Ethernet Controller (Aopen)x+	4361  Gigabit Ethernet Controllerx+		107b 3015  Marvell 88E8050 Gigabit Ethernet Controller (Gateway)
+		11ab 5021  Marvell 88E8050 Gigabit Ethernet Controller (Intel)
+		8086 3063  D925XCVLK mainboardx+	4362  Gigabit Ethernet Controllerx+		103c 2a0d  Marvell 88E8053 Gigabit Ethernet Controller (Asus)
+		1043 8142  Marvell 88E8053 Gigabit Ethernet Controller (Asus)
+		109f 3197  Marvell 88E8053 Gigabit Ethernet Controller (Trigem)
+		10f7 8338  Marvell 88E8053 Gigabit Ethernet Controller (Panasonic)x+		10fd a430  Marvell 88E8053 Gigabit Ethernet Controller (SOYO)x+		1179 0001  Marvell 88E8053 Gigabit Ethernet Controller (Toshiba)
+		1179 ff00  Marvell 88E8053 Gigabit Ethernet Controller (Compal)
+		1179 ff10  Marvell 88E8053 Gigabit Ethernet Controller (Inventec)
+		11ab 5321  Marvell RDK-8053
+		1297 c240  Marvell 88E8053 Gigabit Ethernet Controller (Shuttle)x+		1297 c241  Marvell 88E8053 Gigabit Ethernet Controller (Shuttle)x+		1297 c242  Marvell 88E8053 Gigabit Ethernet Controller (Shuttle)x+		1297 c243  Marvell 88E8053 Gigabit Ethernet Controller (Shuttle)x+		1297 c244  Marvell 88E8053 Gigabit Ethernet Controller (Shuttle)x+		13d1 ac11  Abocom EGE5K - Giga Ethernet Expresscardx+		1458 e000  Marvell 88E8053 Gigabit Ethernet Controller (Gigabyte)x+		1462 058c  Marvell 88E8053 Gigabit Ethernet Controller (MSI)x+		14c0 0012  Marvell 88E8053 Gigabit Ethernet Controller (Compal)
+		1558 04a0  Marvell 88E8053 Gigabit Ethernet Controller (Clevo)
+		15bd 1003  Marvell 88E8053 Gigabit Ethernet Controller (DFI)x+		161f 203c  Marvell 88E8053 Gigabit Ethernet Controller (Arima)x+		161f 203d  Marvell 88E8053 Gigabit Ethernet Controller (Arima)x+		1695 9029  Marvell 88E8053 Gigabit Ethernet Controller (Epox)
+		17f2 2c08  Marvell 88E8053 Gigabit Ethernet Controller (Albatron)
+		17ff 0585  Marvell 88E8053 Gigabit Ethernet Controller (Quanta)x+		1849 8053  Marvell 88E8053 Gigabit Ethernet Controller (ASRock)x+		1854 000b  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1854 000c  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1854 0010  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1854 0013  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1854 0014  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1854 0015  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1854 001a  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1854 001b  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1854 001d  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1854 001f  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1854 0021  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1854 0022  Marvell 88E8053 Gigabit Ethernet Controller (LGE)x+		1940 e000  Marvell 88E8053 Gigabit Ethernet Controller (Gigabyte)x+		270f 2801  Marvell 88E8053 Gigabit Ethernet Controller (Chaintech)x+		a0a0 0506  Marvell 88E8053 Gigabit Ethernet Controller (Aopen)x 	4611  GT-64115 System Controllerx 	4620  GT-64120/64120A/64121A System Controllerx 	4801  GT-48001
@@ -448367 +503567 @@xx11be  International Microcircuits Inc
 11bf  Astrodesign, Inc.
 11c0  Hewlett Packardx-11c1  Lucent Microelectronics
+11c1  Agere Systems (former Lucent Microelectronics)xx	0440  56k WinModemxx		1033 8015  LT WinModem 56k Data+Fax+Voice+Dsvdxx		1033 8047  LT WinModem 56k Data+Fax+Voice+Dsvdx@@ -4586,12 +5138,25 @@xx	0462  V90 WildWire Modemxx	0480  Venus Modem (V90, 56KFlex)xx	048c  V.92 56K WinModemx+# InPorte Home Internal 56k Modem/fax/answering machine/SMS Features
+	048f  V.92 56k WinModemxx	5801  USBxx	5802  USS-312 USB Controllerxx# 4 port PCI USB Controller made by Agere (formely Lucent)xx	5803  USS-344S USB Controllerxx	5811  FW323
+		8086 524c  D865PERL mainboardxx		dead 0800  FireWire Host Bus Adapterx+	ab10  WL60010 Wireless LAN MACx+	ab11  WL60040 Multimode Wireles LAN MACx+		11c1 ab12  WaveLAN 11abg Cardbus card (Model 1102)x+		11c1 ab13  WaveLAN 11abg MiniPCI card (Model 0512)x+		11c1 ab15  WaveLAN 11abg Cardbus card (Model 1106)x+		11c1 ab16  WaveLAN 11abg MiniPCI card (Model 0516)x+	ab20  ORiNOCO PCI Adapterx+	ab21  Agere Wireless PCI Adapterx+	ab30  Hermes2 Mini-PCI WaveLAN a/b/gx+		14cd 2012  Hermes2 Mini-PCI WaveLAN a/b/gx 11c2  Sand Microelectronics
 11c3  NEC Corporation
 11c4  Document Technologies, Incx@@ -4717,6 +528267 @@xx	0903  RocketPort Compact PCI 16 port w/external I/Fxx	8015  RocketPort 4-port UART 16954
 11ff  Scion Corporation
+	0003  AG-5
 1200  CSS Corporation
 1201  Vista Controls Corp
 1202  Network General Corp.x@@ -4774,6 +534067 @@xx		1014 020c  ThinkPad R30
x		1179 0001  Magnia Z310xx	7110  OZ711Mx MultiMediaBay Acceleratorx+		103c 0890  NC6000 laptopxx	7112  OZ711EC1/M1 SmartCardBus MultiMediaBay Controllerxx	7113  OZ711EC1 SmartCardBus Controllerxx	7114  OZ711M1 SmartCardBus MultiMediaBay Controllerx@@ -4781,6 +534867 @@xx	7212  OZ711M2 SmartCardBus MultiMediaBay Controllerxx	7213  OZ6933E CardBus Controllerxx	7223  OZ711M3 SmartCardBus MultiMediaBay Controllerx+		103c 0890  NC6000 laptopxx1218  Hybricon Corp.xx1219  First Virtual Corporation
 121a  3Dfx Interactive, Inc.
@@ -4808,7 +537667 @@xx		121a 0030  Voodoo3 AGPxx		121a 0031  Voodoo3 AGPxx		121a 0034  Voodoo3 AGPx-		121a 0036  Voodoo3x+		121a 0036  Voodoo3 2000 PCIxx		121a 0037  Voodoo3 AGPxx		121a 0038  Voodoo3 AGPxx		121a 003a  Voodoo3 AGPx@@ -4913,6 +548167 @@xx	1100  C2 ISDNxx	1200  T1 ISDNxx	2700  Fritz!Card DSL SLx+	2900  Fritz!Card DSL v2.0xx1245  A.P.D., S.A.xx1246  Dipix Technologies, Inc.
x1247  Xylon Research, Inc.
@@ -4929,7 +549867 @@xx	0003  EasyIO
x	0004  EasyConnection/RAx 124e  Cylinkx-124f  Infotrend Technology, Inc.
+124f  Infortrend Technology, Inc.
 	0041  IFT-2000 Series RAID Controllerx 1250  Hitachi Microcomputer System Ltd
x1251  VLSI Solutions Oy
@@ -4998,6 +5567,8 @@xx125e  Specialvideo Engineering SRLxx125f  Concurrent Technologies, Inc.
x1260  Intersil Corporation
+	3872  Prism 2.5 Wavelan chipsetx+		1468 0202  LAN-Express IEEE 802.11b Wireless LANxx	3873  Prism 2.5 Wavelan chipsetxx		1186 3501  DWL-520 Wireless PCI Adapterxx		1186 3700  DWL-520 Wireless PCI Adapter, Rev E1
@@ -5007,10 +5578,18 @@xx		1737 3874  WMP11 Wireless 802.11b PCI Adapterxx		8086 2513  Wireless 802.11b MiniPCI Adapterxx	3886  ISL3886 [Prism Javelin/Prism Xbow]x+		17cf 0037  Z-Com XG-901 and clones Wireless Adapterxx	3890  Intersil ISL3890 [Prism GT/Prism Duette]
+		10b8 2802  SMC2802W Wireless PCI Adapterx+		10b8 2835  SMC2835W Wireless Cardbus Adapterxx		10b8 a835  SMC2835W V2 Wireless Cardbus Adapterx+		1113 ee03  SMC2802W V2 Wireless PCI Adapterx+		1186 3202  DWL-G650 A1 Wireless Adapterx+		1259 c104  CG-WLCB54GT Wireless Adapterx+		1385 4800  WG511 Wireless Adapterxx		16a5 1605  ALLNET ALL0271 Wireless PCI Adapterx-		17cf 0014  Ovislink WL-5400PCM, Prism GTx+		17cf 0014  Z-Com XG-600 and clones Wireless Adapterx+		17cf 0020  Z-Com XG-900 and clones Wireless Adapterxx	8130  HMP8130 NTSC/PAL Video Decoderx 	8131  HMP8131 NTSC/PAL Video Decoderx 1261  Matsushita-Kotobuki Electronics Industries, Ltd.
@@ -5256,6 +583567 @@xx1283  Integrated Technology Express, Inc.
 	673a  IT8330Gxx	8212  IT/ITE8212 Dual channel ATA RAID controllerx+		1283 0001  IT/ITE8212 Dual channel ATA RAID controllerxx	8330  IT8330Gxx	8872  IT8874F PCI Dual Serial Port Controllerxx	8888  IT8888F PCI to ISA Bridge with SMB
@@ -5312,11 +5892,13 @@xx12a9  Xiotech Corporation
 12aa  SDL Communications, Inc.
x12ab  Yuan Yuan Enterprise Co., Ltd.
+	0002  AU8830 [Vortex2] Based Sound Card With A3D Supportxx	3000  MPG-200C PCI DVD Decoder Cardxx12ac  Measurex Corporation
 12ad  Multidata GmbH
 12ae  Alteon Networks Inc.
x	0001  AceNIC Gigabit Ethernetx+		1014 0104  Gigabit Ethernet-SX PCI Adapterxx		12ae 0001  Gigabit Ethernet-SX (Universal)xx		1410 0104  Gigabit Ethernet-SX PCI Adapterxx	0002  AceNIC Gigabit Ethernet (Copper)x@@ -533367 +591567 @@xx12b6  Natural Microsystemsxx12b7  Cognex Modular Vision Systems Div. - Acumen Inc.
x12b8  Korgx-12b9  5610 56K FaxModemx+12b9  3Com Corp, Modem Division (formerly US Robotics)xx	1006  WinModemxx		12b9 005c  USR 56k Internal Voice WinModem (Model 3472)xx		12b9 005e  USR 56k Internal WinModem (Models 662975)x@@ -541767 +599967 @@xx12d3  Vingmed Sound A/Sxx12d4  Ulticom (Formerly DGM&S)xx	0200  T1 Cardx-12d5  Equator Technologiesx+12d5  Equator Technologies Inc
 12d6  Analogic Corp
 12d7  Biotronic SRLxx12d8  Pericom Semiconductorx@@ -5546,6 +612867 @@xx	004c  PCI-DAS1000x 	004d  PCI-QUAD04xx	0052  PCI-DAS4020/12
+	005e  PCI-DAS6025xx1308  Jato Technologies Inc.
x	0001  NetCelerator Adapterxx		1308 0001  NetCelerator Adapterx@@ -5569,6 +615267 @@xx	8201  ADMtek ADM8211 802.11b Wireless Interface
 		10b8 2635  SMC2635W 802.11b (11Mbps) wireless lan pcmcia (cardbus) cardxx		1317 8201  SMC2635W 802.11b (11mbps) wireless lan pcmcia (cardbus) cardx+	8211  ADMtek ADM8211 802.11b Wireless Interface
 	9511  21x4x DEC-Tulip compatible 10/100 Ethernetxx1318  Packet Engines Inc.
x	0911  GNIC-II PCI Gigabit Ethernet [Hamachi]x@@ -5620,6 +620467 @@xx	2060  Trio 2S(16550)+1Pxx	2061  Trio 2S(16650)+1Pxx	2062  Trio 2S(16850)+1Px+	2081  CyberSerial (8-port) ST16654
 1320  Crypto AG
 1321  Arcobel Graphics BV
 1322  MTT Co., Ltdx@@ -5636,6 +622167 @@xx132d  Integrated Silicon Solution, Inc.
x1330  MMC Networks
x1331  Radisys Corp.x+	0030  ENP-2611xx	8200  82600 Host Bridge
x	8201  82600 IDE
x	8202  82600 USBx@@ -5667,6 +6253,8 @@xx134b  ARK Research Corp.xx134c  Chori Joho System Co. Ltd
x134d  PCTel Inc
+	2189  HSP56 MicroModemx+	2486  2304WT V.92 MDC Modemxx	7890  HSP MicroModem 56xx		134d 0001  PCT789 adapterxx	7891  HSP MicroModem 56x@@ -5718,6 +6306,13 @@xx	8001  8001 Digital I/O Adapterx 135f  I-Data International A-Sxx1360  Meinberg Funkuhrenx+	0101  PCI32 DCF77 Radio Clockx+	0102  PCI509 DCF77 Radio Clockx+	0103  PCI510 DCF77 Radio Clockx+	0201  GPS167PCI GPS Receiverx+	0202  GPS168PCI GPS Receiverx+	0203  GPS169PCI GPS Receiverx+	0301  TCR510PCI IRIG Receiverxx1361  Soliton Systems K.K.xx1362  Fujifacom Corporation
 1363  Phoenix Technology Ltdx@@ -5736,6 +633167 @@xx1370  ATL Productsxx1371  CNet Technology Inc
 	434e  GigaCard Network Adapterx+		1371 434e  N-Way PCI-Bus Giga-Card 1000/100/10Mbps(L)xx1373  Silicon Vision Inc
 1374  Silicom Ltd
x1375  Argosystems Incx@@ -5753,13 +6349,21 @@xx1380  Sanritz Automation Co Ltd
x1381  Brains Co. Ltd
x1382  Marian - Electronic & Software
+	0001  ARC88 audio recording cardxx	2088  Marc-8 MIDI 8 channel audio cardxx1383  Controlnet Inc
 1384  Reality Simulation Systems Inc
 1385  Netgearx+# Note: This lists as Atheros Communications, Inc. AR5212 802.11abg NIC because of Madwifi
+	0013  WG311Txx	4100  802.11b Wireless Adapter (MA301)xx	4105  MA311 802.11b wireless adapterx-	4a00  WAG311 802.11abg Wireless Adapterx+	4400  WAG511 802.11a/b/g Dual Band Wireless PC Cardx+	4600  WAG511 802.11a/b/g Dual Band Wireless PC Cardx+	4601  WAG511 802.11a/b/g Dual Band Wireless PC Cardx+	4610  WAG511 802.11a/b/g Dual Band Wireless PC Cardx+	4a00  WAG311 802.11a/g Wireless PCI Adapterx+	4c00  WG311v2 54 Mbps Wireless PCI Adapterxx	620a  GA620 Gigabit Ethernetxx	622a  GA622xx	630a  GA630 Gigabit Ethernetx@@ -5853,10 +6457,10 @@xx	0030  SyncLink Multiport Adapterxx	0210  SyncLink Adapter v2
 13c1  3ware Inc
-	1000  3ware ATA-RAID
-	1001  3ware 7000-series ATA-RAID
+	1000  3ware Inc 3ware 5xxx/6xxx-series PATA-RAID
+	1001  3ware Inc 3ware 7xxx/8xxx-series PATA/SATA-RAID
x		13c1 1001  3ware Inc 3ware 7xxx/8xxx-series PATA/SATA-RAID
-	1002  3ware ATA-RAID
+	1002  3ware Inc 3ware 9xxx-series SATA-RAID
x13c2  Technotrend Systemtechnik GmbH
 13c3  Janz Computer AG
 13c4  Phase Metricsx@@ -5944,6 +654867 @@xx13fc  Computer Peripherals Internationalxx13fd  Micro Science Inc
 13fe  Advantech Co. Ltd
+	1240  PCI-1240 4-channel stepper motor controller cardxx	1600  PCI-1612 4-port RS-232/422/485 PCI Communication Cardxx	1752  PCI-1752xx	1754  PCI-1754x@@ -5998,6 +660367 @@xx1415  Oxford Semiconductor Ltd
x	8403  VScom 011H-EP1 1 port parallel adaptor
 	9501  OX16PCI954 (Quad 16950 UART) function 0
+		131f 2050  CyberPro (4-port)xx		15ed 2000  MCCR Serial p0-3 of 8xx		15ed 2001  MCCR Serial p0-3 of 16
 	950a  EXSYS EX-41092 Dual 16950 Serial adapterx@@ -602267 +662867 @@xx1422  Ygrec Systems Co Ltd
x1423  Custom Technology Corp.xx1424  Videoserver Connectionsx-1425  ASIC Designers Inc
+1425  Chelsio Communications Inc
 1426  Storage Technology Corp.xx1427  Better On-Line Solutionsxx1428  Edec Co Ltd
@@ -6067,6 +667367 @@xx	7434  PCI-7434xx	7841  PCI-7841x 	8133  PCI-8133
+	8164  PCI-8164xx	8554  PCI-8554
 	9111  PCI-9111
 	9113  PCI-9113
@@ -6156,6 +676367 @@xx1496  JOYTECH Computer Co., Ltd.
x1497  SMA Regelsysteme GmBH
x1498  TEWS Datentechnik GmBH
+	30c8  TPCI200x 1499  EMTEC CO., Ltdx 149a  ANDOR Technology Ltdx 149b  SEIKO Instruments Incx@@ -6208,6 +681667 @@xx	4800  Cisco Aironet 340 802.11b WLAN Adapter/Aironet PC4800xx	a504  Cisco Aironet Wireless 802.11bxx	a505  Cisco Aironet CB20a 802.11a Wireless LAN Adapterx+	a506  Cisco Aironet Mini PCI b/gx 14ba  INTERNIX Inc.
x14bb  SEMTECH Corporation
 14bc  Globespan Semiconductor Inc.
@@ -6259,6 +686867 @@xx# Formerly SiPackets, Inc., formerly API NetWorks, Inc., formerly Alpha Processor, Inc.
x14d9  Alliance Semiconductor Corporation
 	0010  AP1011/SP1011 HyperTransport-PCI Bridge [Sturgeon]
+	9000  AS90L10204/10208 HyperTransport to PCI-X Bridge
x14da  National Aerospace Laboratories
x14db  AFAVLAB Technology Inc
 	2120  TK9902
@@ -6353,17 +6963,27 @@xx		10b7 2000  3C998-T Dual Port 10/100/1000 PCI-Xxx		10b7 3000  3C999-T Quad Port 10/100/1000 PCI-Xxx		1166 1648  NetXtreme CIOB-E 1000Base-T
+	164a  NetXtreme II BCM5706 Gigabit Ethernetxx	164d  NetXtreme BCM5702FE Gigabit Ethernetxx	1653  NetXtreme BCM5705 Gigabit Ethernetx+		0e11 00e3  NC7761 Gigabit Server Adapterx 	1654  NetXtreme BCM5705_2 Gigabit Ethernetx+		0e11 00e3  NC7761 Gigabit Server Adapterx+		103c 3100  NC1020 HP ProLiant Gigabit Server Adapter 32 PCIxx	1659  NetXtreme BCM5721 Gigabit Ethernet PCI Expressxx	165d  NetXtreme BCM5705M Gigabit Ethernetxx	165e  NetXtreme BCM5705M_2 Gigabit Ethernetx+		103c 0890  NC6000 laptopx+	166e  570x 10/100 Integrated Controllerx 	1677  NetXtreme BCM5751 Gigabit Ethernet PCI Expressx+		1028 0179  Optiplex GX280x+	167d  NetXtreme BCM5751M Gigabit Ethernet PCI Expressx+	167e  NetXtreme BCM5751F Fast Ethernet PCI Expressxx	1696  NetXtreme BCM5782 Gigabit Ethernetxx		103c 12bc  HP d530 CMT (DG746A)xx		14e4 000d  NetXtreme BCM5782 1000Base-T
x	169c  NetXtreme BCM5788 Gigabit Ethernetx+	169d  NetLink BCM5789 Gigabit Ethernet PCI Expressxx	16a6  NetXtreme BCM5702X Gigabit Ethernetxx		0e11 00bb  NC7760 Gigabit Server Adapter (PCI-X, 10/100/1000-T)xx		1028 0126  BCM5702 1000Base-T
@@ -6378,30 +6998,58 @@xx		14e4 800a  NetXtreme BCM5703 1000Base-T
x	16a8  NetXtreme BCM5704S Gigabit Ethernetxx		10b7 2001  3C998-SX Dual Port 1000-SX PCI-X
+	16aa  NetXtreme II BCM5706S Gigabit Ethernetxx	16c6  NetXtreme BCM5702A3 Gigabit Ethernetxx		10b7 1100  3C1000B-T 10/100/1000 PCIxx		14e4 000c  BCM5702 1000Base-T
x		14e4 8009  BCM5702 1000Base-T
x	16c7  NetXtreme BCM5703 Gigabit Ethernetx+		0e11 00ca  NC7771 Gigabit Server Adapter (PCI-X, 10,100,1000-T)x+		0e11 00cb  NC7781 Gigabit Server Adapter (PCI-X, 10,100,1000-T)xx		103c 12c3  HP Combo FC/GigE-SX [A9782A]xx		103c 12ca  HP Combo FC/GigE-T [A9784A]xx		14e4 0009  NetXtreme BCM5703 1000Base-T
x		14e4 000a  NetXtreme BCM5703 1000Base-SX
+	16dd  NetLink BCM5781 Gigabit Ethernet PCI Expressx+	16f7  NetXtreme BCM5753 Gigabit Ethernet PCI Expressx+	16fd  NetXtreme BCM5753M Gigabit Ethernet PCI Expressx+	16fe  NetXtreme BCM5753F Fast Ethernet PCI Expressxx	170c  BCM4401-B0 100Base-TXxx	170d  NetXtreme BCM5901 100Base-TXx+		1014 0545  ThinkPad R40e (2684-HVG) builtin ethernet controllerxx	170e  NetXtreme BCM5901 100Base-TXxx	3352  BCM3352xx	3360  BCM3360xx	4210  BCM4210 iLine10 HomePNA 2.0xx	4211  BCM4211 iLine10 HomePNA 2.0 + V.90 56k modemxx	4212  BCM4212 v.90 56k modemx-	4301  BCM4301 802.11bx+	4301  BCM4303 802.11b Wireless LAN Controllerx+		1028 0407  TrueMobile 1180 Onboard WLAN
+		1043 0120  WL-103b Wireless LAN PC Cardx+	4305  BCM4307 V.90 56k Modemx+	4306  BCM4307 Ethernet Controllerx 	4307  BCM4307 802.11b Wireless LAN Controllerx+	4310  BCM4310 Chipcommon I/OControllerx+	4312  BCM4310 UARTx+	4313  BCM4310 Ethernet Controllerx+	4315  BCM4310 USB Controllerxx	4320  BCM4306 802.11b/g Wireless LAN Controllerxx		1028 0001  TrueMobile 1300 WLAN Mini-PCI Cardx+		1028 0003  Wireless 1350 WLAN Mini-PCI Cardx+		1043 100f  WL-100Gx+		14e4 4320  Linksys WMP54G PCIxx		1737 4320  WPC54Gx+		1799 7010  Belkin F5D7010 54g Wireless Network cardx+	4321  BCM4306 802.11a Wireless LAN Controllerx+	4322  BCM4306 UARTxx	4324  BCM4309 802.11a/b/gxx		1028 0001  Truemobile 1400x+		1028 0003  Truemobile 1450 MiniPCIx+	4325  BCM43xG 802.11b/gx+		1414 0003  Wireless Notebook Adapter MN-720x+		1414 0004  Wireless PCI Adapter MN-730x+# probably this is a correct ID...x+	4326  BCM4307 Chipcommon I/O Controller?xx	4401  BCM4401 100Base-Txx		1043 80a8  A7V8X motherboardxx	4402  BCM4402 Integrated 10/100BaseT
@@ -6418,16 +7066,20 @@xx	4614  BCM4610 Sentry5 External Interface
 	4615  BCM4610 Sentry5 USB Controllerxx	4704  BCM4704 PCI to SB Bridgex-	4708  BCM4708 Sentry5 PCI to SB Bridgex+	4705  BCM4704 Sentry5 802.11b Wireless LAN Controllerx+	4706  BCM4704 Sentry5 Ethernet Controllerx+	4707  BCM4704 Sentry5 USB Controllerx+	4708  BCM4704 Crypto Acceleratorxx	4710  BCM4710 Sentry5 PCI to SB Bridgexx	4711  BCM47xx Sentry5 iLine32 HomePNA 2.0x-	4712  Sentry5 UARTx+	4712  BCM47xx V.92 56k modemxx	4713  Sentry5 Ethernet Controllerxx	4714  BCM47xx Sentry5 External Interface
 	4715  Sentry5 USB Controllerxx	4716  BCM47xx Sentry5 USB Host Controllerx 	4717  BCM47xx Sentry5 USB Device Controllerx 	4718  Sentry5 Crypto Acceleratorx+	4720  BCM4712 MIPS CPUxx	5365  BCM5365P Sentry5 Host Bridge
x	5600  BCM5600 StrataSwitch 24+2 Ethernet Switch Controllerxx	5605  BCM5605 StrataSwitch 24+2 Ethernet Switch Controllerx@@ -6595,6 +7247,8 @@xx		13e0 8d84  IBM HSFi V.90xx		13e0 8d85  Compaq Stingerxx		14f1 2004  Dynalink 56PMi
+	2f02  HSF 56k HSFi Data/Fax
+	2f11  HSF 56k HSFi Modemxx	8234  RS8234 ATM SAR Controller [ServiceSAR Plus]xx	8800  Winfast TV2000 XPxx14f2  MOBILITY Electronicsx@@ -6603612 +7257,16 @@xx	0122  EV1000 Serial portxx	0123  EV1000 Keyboard controllerxx	0124  EV1000 Mouse controllerx-14f3  BROADLOGIC
+14f3  BroadLogicx+	2030  2030 DVB-S Satellite Recieverx+	2050  2050 DVB-T Terrestrial (Cable) Recieverx+	2060  2060 ATSC Terrestrial (Cable) Recieverxx14f4  TOKYO Electronic Industry CO Ltdx 14f5  SOPAC Ltdx 14f6  COYOTE Technologies LLCx 14f7  WOLF Technology Inc
 14f8  AUDIOCODES Inc
+	2077  TP-240 dual span E1 VoIP PCI card
 14f9  AG COMMUNICATIONS
 14fa  WANDEL & GOCHERMANN
 14fb  TRANSAS MARINE (UK) Ltd
@@ -6687612 +7345,16 @@xx1523  MUSIC Semiconductorsxx1524  ENE Technology Inc
 	0510  CB710 Memory Card Reader Controllerx+	0610  PCI Smart Card Reader Controllerxx	1211  CB1211 Cardbus Controllerxx	1225  CB1225 Cardbus Controllerxx	1410  CB1410 Cardbus Controllerx-	1411  CB710 Cardbus Controllerx+		1025 005a  TravelMate 290x+	1411  CB-710/2/4 Cardbus Controllerx+	1412  CB-712/4 Cardbus Controllerxx	1420  CB1420 Cardbus Controllerx-	1421  CB720 Cardbus Controllerx+	1421  CB-720/2/4 Cardbus Controllerx+	1422  CB-722/4 Cardbus Controllerxx1525  IMPACT Technologiesxx1526  ISS, Inc
 1527  SOLECTRON
@@ -6717,6 +7379,9 @@xx153a  ONO SOKKIxx153b  TERRATEC Electronic GmbH
 	1144  Aureon 5.1x+# Terratec seems to use several IDs for the same card.x+	1147  Aureon 5.1 Skyx+	1158  Philips Semiconductors SAA7134 (rev 01) [Terratec Cinergy 600 TV]xx153c  ANTAL Electronicxx153d  FILANET Corp
 153e  TECHWELL Incx@@ -6859,18 +7524,24 @@xx15aa  Moreton Bayxx15ab  Bluesteel Networks Incxx15ac  North Atlantic Instrumentsx-15ad  VMWare Inc
-	0405  [VMWare SVGA II] PCI Display Adapterx+15ad  VMware Inc
+	0405  [VMware SVGA II] PCI Display Adapterx 	0710  Virtual SVGA
+	0720  VMware High-Speed Virtual NIC [vmxnet]xx15ae  Amersham Pharmacia Biotechxx15b0  Zoltrix International Ltdx 15b1  Source Technology Incxx15b2  Mosaid Technologies Inc
-15b3  Mellanox Technologyx+15b3  Mellanox Technologiesxx	5274  MT21108 InfiniBridge
x	5a44  MT23108 InfiniHost
-	5a45  MT23108 InfiniHost (Tavor)x+	5a45  MT23108 [Infinihost HCA Flash Recovery]
x	5a46  MT23108 PCI Bridge
+	5e8c  MT24204 [InfiniHost III Lx HCA]
+	5e8d  MT24204 [InfiniHost III Lx HCA Flash Recovery]
+	6278  MT25208 InfiniHost III Ex (Tavor compatibility mode)
+	6279  MT25208 [InfiniHost III Ex HCA Flash Recovery]
+	6282  MT25208 InfiniHost III Exxx15b4  CCI/TRIADxx15b5  Cimetrics Incxx15b6  Texas Memory Systems Incx@@ -698167 +765267 @@xx1637  Linksysxx	3874  Linksys 802.11b WMP11 PCI Wireless card
 1638  Standard Microsystems Corp [SMC]x-	1100  SMC2602W EZConnect/Addtron AWA-100/Eumitcom WL11000x+	1100  SMC2602W EZConnect/Addtron AWA-100/Eumitcom PCI WL11000x 163c  Smart Link Ltd.
x	3052  SmartLink SmartPCI562 56K Modemxx	5449  SmartPCI561 Modemx@@ -6998,6 +7669,10 @@xx166d  Broadcom Corporation
 	0001  SiByte BCM1125/1125H/1250 System-on-a-Chip PCIxx	0002  SiByte BCM1125H/1250 System-on-a-Chip HyperTransportx+1677  Bernecker + Rainerx+	104e  5LS172.6 B&R Dual CAN Interface Cardx+	12d7  5LS172.61 B&R Dual CAN Interface Cardx+167b  ZyDAS Technology Corp.xx1681  Herculesxx# More specs, more accurate desc.
x	0010  Hercules 3d Prophet II Ultra 64MB [ 350 MHz NV15BR core,x128-bit DDR @ 460 MHz,x1.5v AGP4x  ]x@@ -7010,9 +7685,13 @@xx	0013  AR5212 802.11abg NICxx		1186 3202  D-link DWL-G650 B3 Wireless cardbus adapterxx		1186 3203  DWL-G520 Wireless PCI Adapterx+		1186 3a13  DWL-G520 Wireless PCI Adapter rev. Bxx		1186 3a94  C54C Wireless 801.11g cardbusx+		1385 4d00  Netgear WG311T Wireless PCI Adapterx+		14b7 0a60  8482-WD ORiNOCO 11a/b/g Wireless PCI Adapterxx		168c 0013  WG511T Wireless CardBus Adapterxx		168c 1025  DWL-G650B2 Wireless CardBus Adapterx+		168c 2026  Netgate 5354MP ARIES a(108Mb turbo)/b/g MiniPCI Adapterxx	1014  AR5212 802.11abg NICxx16a5  Tekram Technology Co.,Ltd.
x16ab  Global Sun Technology Incx@@ -7021,10 +7700,12 @@xx	1102  PCMCIA-to-PCI Wireless Network Bridge
x16ae  Safenet Inc
 	1141  SafeXcel-1141x+16b4  Aspex Semiconductor Ltd
x16be  Creatix Polymedia GmbH
 16ca  CENATEK Inc
 	0001  Rocket Drive DL
 16cd  Densitron Technologiesx+16ce  Roland Corp.xx# www.pikatechnologies.com
 16df  PIKA Technologies Inc.
x16e3  European Space Agencyx@@ -7032,6 +7713,9 @@xx16ec  U.S. Robotics
 	00ff  USR997900 10/100 Mbps PCI Network Cardxx	3685  Wireless Access PCI Adapter Model 022415x+16ed  Sycron N. V.
+	1001  UMIO communication cardx+16f3  Jetway Information Co., Ltd.
x16f4  Vweb Corp
 	8000  VW2010
x16f6  VideoTele.com, Inc.
@@ -7045,8 +7729,10 @@xx1725  Vitesse Semiconductorxx	7174  VSC7174 PCI/PCI-X Serial ATA Host Bus Controllerxx172a  Accelerated Encryption
+1734  Fujitsu Siemens Computer GmbH
 1737  Linksysxx	0013  WMP54G Wireless Pci Cardx+	0015  WMP54GS Wireless Pci Cardxx	1032  Gigabit Network Adapterxx		1737 0015  EG1032 v2 Instant Gigabit Network Adapterxx	1064  Gigabit Network Adapterx@@ -7081,6 +7767,9 @@xx	6020  Wireless PCMCIA Card - F5D6020xx	6060  Wireless PDA Card - F5D6060xx	7000  Wireless PCI Card - F5D7000x+17a0  Genesys Logic, Inc
+	8033  GL880S USB 1.1 controllerx+	8034  GL880S USB 2.0 controllerx 17af  Hightech Information System Ltd.
x17b3  Hawking Technologiesxx	ab08  PN672TX 10/100 Ethernetx@@ -7090,9 +7779,12 @@xx17c2  Newisys, Inc.
x17cc  NetChip Technology, Inc
 	2280  USB 2.0x+17d3  Areca Technology Corp.xx# S2io ships 10Gb PCI-X Ethernet adapters www.s2io.com
 17d5  S2io Inc.
-# Supplying full name for a currently green entryx+17de  KWorld Computer Co. Ltd.
+# http://www.connect3d.com
+17ee  Connect Components Ltd
x17fe  Linksys, A Division of Cisco Systemsxx	2220  [AirConn] INPROCOMM IPN 2220 WLAN Adapter (rev 01)
x1813  Ambient Technologies Incx@@ -7103615 +7795,30 @@xx1814  RaLinkxx	0101  Wireless PCI Adpator RT2400 / RT2460xx	0201  Ralink RT2500 802.11 Cardbus Reference Cardx+		1371 001e  CWC-854 Wireless-G CardBus Adapterx+		1371 001f  CWM-854 Wireless-G Mini PCI Adapterx+		1371 0020  CWP-854 Wireless-G PCI Adapterxx1820  InfiniCon Systems Inc.xx1822  Twinhan Technology Co. Ltd
+182d  SiteCom Europe BV
+# HFC-based ISDN cardx+	3069  ISDN PCI DC-105V2
 1830  Credence Systems Corporation
+183b  MikroM GmbH
+	08a7  MVC100 DVI
+	08a8  MVC101 SDI
+	08a9  MVC102 DVI+Audio
+1849  ASRock Incorporation
 1851  Microtune, Inc.
x1852  Anritsu Corp.x+185f  Wistron NeWeb Corp.
x1867  Topspin Communications
x	5a44  MT23108 PCI-X HCA
x	5a45  MT23108 PCI-X HCA flash recovery
x	5a46  MT23108 PCI-X HCA bridge
+	6278  MT25208 InfiniHost III Ex (Tavor compatibility mode)
+	6282  MT25208 InfiniHost III Exx+187e  ZyXEL Communication Corporation
 1888  Varisys Ltd
x	0301  VMFX1 FPGA PMC modulexx	0601  VSM2 dual PMC carrierx@@ -7119,14 +7826,30 @@xx	0720  VS24x series PowerPC PCI boardxx# found e.g. on KNC DVB-S card
 1894  KNC Onex+1896  B&B Electronics Manufacturing Company, Inc.
 18a1  Astute Networks Inc.
+18ac  DViCO Corporation
+	d810  FusionHDTV 3 Gold
+18b8  Ammassoxx18bc  Info-Tek Corp.x+# assigned to Octigabay System, which has been acquired by Crayx+18c8  Cray Incxx18c9  ARVOO Engineering BV
 18ca  XGI - Xabre Graphics Inc
 	0040  Volari V8
 18e6  MPL AG
 	0001  OSCI [Octal Serial Communication Interface]x+18f7  Commtech, Inc.
+	0001  Fastcom ESCC-PCI-335x+	0002  Fastcom 422/4-PCI-335x+	0004  Fastcom 422/2-PCI-335x+	0005  Fastcom IGESCC-PCI-ISO/1x+	000a  Fastcom 232/4-PCI-335x 18fb  Resilience Corporation
+1924  Level 5 Networks Inc.
+1966  Orad Hi-Tec Systems
+1975  Pudlis Co. Ltd.
+1993  Innominate Security Technologies AG
 1a08  Sierra semiconductorxx	0000  SC15064xx1b13  Jaton Corpx@@ -7165,6 +788867 @@xx		4c53 10a0  CA3/CR3 mainboardxx		4c53 3010  PPCI mezzanine (32-bit PMC)xx		4c53 3011  PPCI mezzanine (64-bit PMC)x+	0022  HiNT HB4 PCI-PCI Bridge (PCI6150)xx	0026  HB2 PCI-PCI Bridgexx	101a  E.Band [AudioTrak Inca88]xx	101b  E.Band [AudioTrak Inca88]x@@ -7176,6 +790067 @@xx		3388 8013  VXPro II Chipset EIDE Controllerxx3411  Quantum Designs (H.K.) Inc
 3513  ARCOM Control Systems Ltd
+3842  eVga.com. Corp.
x38ef  4Links
x3d3d  3DLabs
 	0001  GLINT 300SXx@@ -7211,6 +793667 @@xx	0024  VP9 visual processorxx	0100  Permedia II 2D+3Dxx	07a1  Wildcat III 6210
+	07a2  Sun XVR-500 Graphics Acceleratorxx	07a3  Wildcat IV 7210xx	1004  Permediaxx	3d04  Permediax@@ -7252,6 +7978,8 @@xx4916  RedCreek Communications Inc
 	1960  RedCreek PCI adapterxx4943  Growth Networks
+494f  ACCES I/O Products, Inc.
+	10e8  LPCI-COM-8SMxx4978  Axil Computer Inc
 4a14  NetVin
 	5000  NV5000SCx@@ -7366,6 +809467 @@xx	8a22  Savage 4xx		1033 8068  Savage 4xx		1033 8069  Savage 4x+		1033 8110  Savage4 LTxx		105d 0018  SR9 8Mb SDRAMxx		105d 002a  SR9 Pro 16Mb SDRAMxx		105d 003a  SR9 Pro 32Mb SDRAMx@@ -7458,7 +818767 @@xx	0011  PWDOG2 [PCI-Watchdog 2]xx# Wrong ID used in subsystem ID of AsusTek PCI-USB2 PCI card.
x807d  Asustek Computer, Inc.
-8086  Intel Corp.x+8086  Intel Corporation
 	0007  82379AB
 	0008  Extended Express System Support Controllerxx		0008 1000  WorldMark 4300 INCA ASICx@@ -7466,11 +8195,11 @@xx	0122  82437FX
x	0309  80303 I/O Processor PCI-to-PCI Bridgexx	030d  80312 I/O Companion Chip PCI-to-PCI Bridgex-	0326  PCI Bridge Hub I/OxAPIC Interrupt Controller Ax-	0327  PCI Bridge Hub I/OxAPIC Interrupt Controller Bx-	0329  PCI Bridge Hub Ax-	032a  PCI Bridge Hub Bx-	032c  PCI Bridge Hubx+	0326  6700/6702PXH I/OxAPIC Interrupt Controller Ax+	0327  6700PXH I/OxAPIC Interrupt Controller Bx+	0329  6700PXH PCI Express-to-PCI Bridge Ax+	032a  6700PXH PCI Express-to-PCI Bridge Bx+	032c  6702PXH PCI Express-to-PCI Bridge Axx# A-segment bridgexx	0330  80332 [Dobson] I/O processorxx# A-segment IOAPICx@@ -7521,6 +8250,8 @@xx	0600  RAID Controllerx 		8086 01c1  ICP Vortex GDT8546RZx 		8086 01f7  SCRU32x+# uninitialized SRCU32 RAID Controllerx+	061f  80303 I/O Processor
x	0960  80960RP [i960 RP Microprocessor/Bridge]
x	0962  80960RM [i960RM Bridge]
x	0964  80960RP [i960 RP Microprocessor/Bridge]
@@ -7533,6 +826467 @@xx	1001  82543GC Gigabit Ethernet Controller (Fiber)xx		0e11 004a  NC6136 Gigabit Server Adapterx 		1014 01ea  Netfinity Gigabit Ethernet SX Adapterx+		8086 1002  PRO/1000 F Server Adapterx 		8086 1003  PRO/1000 F Server Adapterx 	1002  Pro 100 LAN+Modem 56 Cardbus IIxx		8086 200e  Pro 100 LAN+Modem 56 Cardbus IIx@@ -7567,6 +8299,8 @@xx		1014 0265  PRO/1000 MT Network Connectionxx		1014 0267  PRO/1000 MT Network Connectionxx		1014 026a  PRO/1000 MT Network Connectionx+		1028 002e  Optiplex GX260x+		1028 0151  PRO/1000 MT Network Connectionxx		107b 8920  PRO/1000 MT Desktop Adapterx 		8086 001e  PRO/1000 MT Desktop Adapterx 		8086 002e  PRO/1000 MT Desktop Adapterx@@ -7582,6 +831667 @@xx		4c53 10a0  CA3/CR3 mainboardxx		8086 1011  PRO/1000 MT Dual Port Server Adapterx 		8086 101a  PRO/1000 MT Dual Port Network Adapterx+		8086 3424  SE7501HG2 Mainboardxx	1011  82545EM Gigabit Ethernet Controller (Fiber)xx		1014 0268  iSeries Gigabit Ethernet Adapterx 		8086 1002  PRO/1000 MF Server Adapterx@@ -7590,6 +832567 @@xx		8086 1012  PRO/1000 MF Dual Port Server Adapterx 	1013  82541EI Gigabit Ethernet Controller (Copper)x 		8086 0013  PRO/1000 MT Network Connectionx+		8086 1013  IBM ThinkCentre Network Cardxx		8086 1113  PRO/1000 MT Desktop Adapterx 	1014  82541ER Gigabit Ethernet Controllerx 	1015  82540EM Gigabit Ethernet Controller (LOM)x@@ -7605,6 +834167 @@xx	1019  82547EI Gigabit Ethernet Controller (LOM)x 		1458 1019  GA-8IPE1000 Pro2 motherboard (865PE)xx		8086 1019  PRO/1000 CT Desktop Connectionx+		8086 301f  D865PERL mainboardxx		8086 3427  S875WP1-E mainboardxx	101d  82546EB Gigabit Ethernet Controllerx 		8086 1000  PRO/1000 MT Quad Port Server Adapterx@@ -7642,13 +8379,13 @@xx	1036  82801CAM (ICH3) 82562EH Ethernet Controllerx 	1037  82801CAM (ICH3) Chipset Ethernet Controllerx 	1038  82801CAM (ICH3) PRO/100 VM (KM) Ethernet Controllerx-	1039  82801BD PRO/100 VE (LOM) Ethernet Controllerx+	1039  82801DB PRO/100 VE (LOM) Ethernet Controllerxx		1014 0267  NetVista A30px-	103a  82801BD PRO/100 VE (CNR) Ethernet Controllerx-	103b  82801BD PRO/100 VM (LOM) Ethernet Controllerx-	103c  82801BD PRO/100 VM (CNR) Ethernet Controllerx-	103d  82801BD PRO/100 VE (MOB) Ethernet Controllerx-	103e  82801BD PRO/100 VM (MOB) Ethernet Controllerx+	103a  82801DB PRO/100 VE (CNR) Ethernet Controllerx+	103b  82801DB PRO/100 VM (LOM) Ethernet Controllerx+	103c  82801DB PRO/100 VM (CNR) Ethernet Controllerx+	103d  82801DB PRO/100 VE (MOB) Ethernet Controllerx+	103e  82801DB PRO/100 VM (MOB) Ethernet Controllerx 	1040  536EP Data Fax Modemxx		16be 1040  V.9X DSP Data Fax Modemxx	1043  PRO/Wireless LAN 2100 3B Mini PCI Adapterx@@ -7662,42 +8399,55 @@xx		8086 3427  S875WP1-E mainboardxx	1051  82801EB/ER (ICH5/ICH5R) integrated LAN Controllerxx	1059  82551QM Ethernet Controllerx-	1065  82801FB/FBM/FR/FW/FRW (ICH6 Family) LAN Controllerx-# Updated controller name from 82547EI to 82547GIx+# ICH-6 Componentx+	1064  82562ET/EZ/GT/GZ - PRO/100 VE (LOM) Ethernet Controllerx+# ICH-6 Componentx+	1065  82562ET/EZ/GT/GZ - PRO/100 VE Ethernet Controllerx+# ICH-6 Componentx+	1066  82562 EM/EX/GX - PRO/100 VM (LOM) Ethernet Controllerx+# ICH-6 Componentx+	1067  82562 EM/EX/GX - PRO/100 VM Ethernet Controllerx+# ICH-6 Componentx+	1068  82562ET/EZ/GT/GZ - PRO/100 VE (LOM) Ethernet Controller Mobilex+# ICH-6 Componentx+	1069  82562 EM/EX/GX - PRO/100 VM (LOM) Ethernet Controller Mobilex+# ICH-6 Componentx+	106a  82562G \t- PRO/100 VE (LOM) Ethernet Controllerx+# ICH-6 Componentx+	106b  82562G \t- PRO/100 VE Ethernet Controller Mobilexx	1075  82547GI Gigabit Ethernet Controllerx+		1028 0165  PowerEdge 750x 		8086 0075  PRO/1000 CT Network Connectionxx		8086 1075  PRO/1000 CT Network Connectionx-# Added PI to part name.  Previous part name was 82541GIxx	1076  82541GI/PI Gigabit Ethernet Controllerx+		1028 0165  PowerEdge 750x 		8086 0076  PRO/1000 MT Network Connectionxx		8086 1076  PRO/1000 MT Network Connectionxx		8086 1176  PRO/1000 MT Desktop Adapterx 		8086 1276  PRO/1000 MT Desktop Adapterx-# Update controller name from 82541EI to 82541GIxx	1077  82541GI Gigabit Ethernet Controllerx 		1179 0001  PRO/1000 MT Mobile Connectionxx		8086 0077  PRO/1000 MT Mobile Connectionxx		8086 1077  PRO/1000 MT Mobile Connectionxx	1078  82541EI Gigabit Ethernet Controllerxx		8086 1078  PRO/1000 MT Network Connectionx-# Update from mistaken ID of 82546EBxx	1079  82546GB Gigabit Ethernet Controllerx 		103c 12a6  HP Dual Port 1000Base-T [A9900A]xx		103c 12cf  HP Core Dual Port 1000Base-T [AB352A]xx		4c53 1090  Cx9 / Vx9 mainboardx+		4c53 10b0  CL9 mainboardxx		8086 0079  PRO/1000 MT Dual Port Network Connectionxx		8086 1079  PRO/1000 MT Dual Port Network Connectionxx		8086 1179  PRO/1000 MT Dual Port Network Connectionxx		8086 117a  PRO/1000 MT Dual Port Server Adapterx-# Update from mistaken ID of 82546EBxx	107a  82546GB Gigabit Ethernet Controllerx 		103c 12a8  HP Dual Port 1000base-SX [A9899A]xx		8086 107a  PRO/1000 MF Dual Port Server Adapterx 		8086 127a  PRO/1000 MF Dual Port Server Adapterx-# Update from mistaken ID of 82546EBxx	107b  82546GB Gigabit Ethernet Controllerx 		8086 007b  PRO/1000 MB Dual Port Server Connectionxx		8086 107b  PRO/1000 MB Dual Port Server Connectionx+	1107  PRO/1000 MF Server Adapter (LX)xx	1130  82815 815 Chipset Host Bridge and Memory Controller Hubx 		1025 1016  Travelmate 612 TXxx		1043 8027  TUSL2-C Mainboardx@@ -771567 +846567 @@xx	1162  Xscale 80200 Big Endian Companion Chipxx	1200  Intel IXP1200 Network Processor
x		172a 0000  AEP SSL Acceleratorx-	1209  82559ERx+	1209  8255xER/82551IT Fast Ethernet Controllerx 		4c53 1050  CT7 mainboardxx		4c53 1051  CE7 mainboardxx		4c53 1070  PC6 mainboardx@@ -776667 +851667 @@xx		1014 605c  10/100 EtherJet Secure Management Adapterx 		1014 705c  10/100 Netfinity 10/100 Ethernet Security Adapterx 		1014 805c  10/100 Netfinity 10/100 Ethernet Security Adapterx-		1028 009b  PowerEdge 2550x+		1028 009b  PowerEdge 2500/2550xx		1028 00ce  PowerEdge 1400xx		1033 8000  PC-9821X-B06xx		1033 8016  PK-UG-X006x@@ -7937,6 +868767 @@xx	1a23  82840 840 (Carmel) Chipset AGP Bridgexx	1a24  82840 840 (Carmel) Chipset PCI Bridge (Hub B)xx	1a30  82845 845 (Brookdale) Chipset Host Bridgex+		1028 010e  Optiplex GX240xx	1a31  82845 845 (Brookdale) Chipset AGP Bridgexx	2410  82801AA ISA Bridge (LPC)xx	2411  82801AA IDEx@@ -7962,6 +8713,8 @@xx	2442  82801BA/BAM USB (Hub #1)xx		1014 01c6  Netvista A40/A40px 		1025 1016  Travelmate 612 TXx+		1028 010e  Optiplex GX240x+		1043 8027  TUSL2-C Mainboardxx		104d 80df  Vaio PCG-FX403x 		147b 0507  TH7II-RAID
x		8086 4532  D815EEA2 mainboardx@@ -7969,6 +872267 @@xx	2443  82801BA/BAM SMBusxx		1014 01c6  Netvista A40/A40px 		1025 1016  Travelmate 612 TXx+		1028 010e  Optiplex GX240x 		1043 8027  TUSL2-C Mainboardxx		104d 80df  Vaio PCG-FX403x 		147b 0507  TH7II-RAID
@@ -7976,6 +8730,8 @@xx		8086 4557  D815EGEW Mainboardxx	2444  82801BA/BAM USB (Hub #2)x 		1025 1016  Travelmate 612 TXx+		1028 010e  Optiplex GX240x+		1043 8027  TUSL2-C Mainboardxx		104d 80df  Vaio PCG-FX403x 		147b 0507  TH7II-RAID
x		8086 4532  D815EEA2 mainboardx@@ -8026,6 +878267 @@xx		104d 80df  Vaio PCG-FX403x 	244b  82801BA IDE U100xx		1014 01c6  Netvista A40/A40px+		1028 010e  Optiplex GX240x 		1043 8027  TUSL2-C Mainboardxx		147b 0507  TH7II-RAID
x		8086 4532  D815EEA2 mainboardx@@ -8046,6 +880367 @@xx		104d 80e7  VAIO PCG-GR214EP/GR214MP/GR215MP/GR314MP/GR315MPxx		15d9 3480  P4DP6xx		8086 1958  vpr Matrix 170B4x+		8086 3424  SE7501HG2 Mainboardxx		8086 4541  Latitude C640x 	2483  82801CA/CAM SMBus Controllerxx		1014 0220  ThinkPad A/T/X Seriesx@@ -8058,6 +881667 @@xx		15d9 3480  P4DP6xx		8086 1958  vpr Matrix 170B4x 	2485  82801CA/CAM AC'97 Audio Controllerx+		1013 5959  Crystal WMD Audio Codecxx		1014 0222  ThinkPad T23 (2647-4MG) or A30/A30p (2652/2653)xx		1014 0508  ThinkPad T30xx		1014 051c  ThinkPad A/T/X Seriesx@@ -8086676 +8845,117 @@xx	248b  82801CA Ultra ATA Storage Controllerxx		15d9 3480  P4DP6xx	248c  82801CAM ISA Bridge (LPC)x-	24c0  82801DB/DBL (ICH4/ICH4-L) LPC Bridgex+	24c0  82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridgexx		1014 0267  NetVista A30pxx		1462 5800  845PE Max (MS-6580)xx	24c1  82801DBL (ICH4-L) IDE Controllerxx	24c2  82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1xx		1014 0267  NetVista A30px+		1025 005a  TravelMate 290x+		1028 0126  Optiplex GX260x+		1028 0163  Latitude D505x+		103c 0890  NC6000 laptopxx		1071 8160  MIM2000xx		1462 5800  845PE Max (MS-6580)x+		1509 2990  Averatec 5110H laptopx+		4c53 1090  Cx9 / Vx9 mainboardxx	24c3  82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controllerxx		1014 0267  NetVista A30px+		1025 005a  TravelMate 290x+		1028 0126  Optiplex GX260x+		103c 0890  NC6000 laptopxx		1071 8160  MIM2000xx		1458 24c2  GA-8PE667 Ultraxx		1462 5800  845PE Max (MS-6580)xx		4c53 1090  Cx9 / Vx9 mainboardxx	24c4  82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2xx		1014 0267  NetVista A30px+		1025 005a  TravelMate 290x+		1028 0126  Optiplex GX260x+		1028 0163  Latitude D505x+		103c 0890  NC6000 laptopxx		1071 8160  MIM2000xx		1462 5800  845PE Max (MS-6580)x+		1509 2990  Averatec 5110Hxx		4c53 1090  Cx9 / Vx9 mainboardxx	24c5  82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controllerxx		0e11 00b8  Analog Devices Inc. codec [SoundMAX]xx		1014 0267  NetVista A30px+		1025 005a  TravelMate 290x+		1028 0163  Latitude D505x+		103c 0890  NC6000 laptopxx		1071 8160  MIM2000xx		1458 a002  GA-8PE667 Ultraxx		1462 5800  845PE Max (MS-6580)xx	24c6  82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Modem Controllerx+		1025 005a  TravelMate 290x+		103c 0890  NC6000 laptopxx		1071 8160  MIM2000xx	24c7  82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3xx		1014 0267  NetVista A30px+		1025 005a  TravelMate 290x+		1028 0126  Optiplex GX260x+		1028 0163  Latitude D505x+		103c 0890  NC6000 laptopxx		1071 8160  MIM2000xx		1462 5800  845PE Max (MS-6580)x+		1509 2990  Averatec 5110Hx+		4c53 1090  Cx9 / Vx9 mainboardxx	24ca  82801DBM (ICH4) Ultra ATA Storage Controllerx+		1025 005a  TravelMate 290x+		1028 0163  Latitude D505x+		103c 0890  NC6000 laptopxx		1071 8160  MIM2000xx	24cb  82801DB/DBL (ICH4/ICH4-L) UltraATA-100 IDE Controllerxx		1014 0267  NetVista A30px+		1028 0126  Optiplex GX260xx		1458 24c2  GA-8PE667 Ultraxx		1462 5800  845PE Max (MS-6580)xx		4c53 1090  Cx9 / Vx9 mainboardxx	24cc  82801DBM LPC Interface Controllerxx	24cd  82801DB/DBM (ICH4/ICH4-M) USB 2.0 EHCI Controllerxx		1014 0267  NetVista A30px+		1025 005a  TravelMate 290x+		1028 0126  Optiplex GX260x+		1028 0163  Latitude D505x+		103c 0890  NC6000 laptopxx		1071 8160  MIM2000xx		1462 3981  845PE Max (MS-6580)x+		1509 1968  Averatec 5110Hxx		4c53 1090  Cx9 / Vx9 mainboardx-	24d0  82801EB/ER (ICH5/ICH5R) LPC Bridgex+	24d0  82801EB/ER (ICH5/ICH5R) LPC Interface Bridgexx	24d1  82801EB (ICH5) Serial ATA 150 Storage Controllerxx		103c 12bc  d530 CMT (DG746A)xx		1458 24d1  GA-8IPE1000 Pro2 motherboard (865PE)xx		1462 7280  865PE Neo2 (MS-6728)xx		8086 3427  S875WP1-E mainboardx-	24d2  82801EB/ER (ICH5/ICH5R) USB UHCI #1x+		8086 524c  D865PERL mainboardx+	24d2  82801EB/ER (ICH5/ICH5R) USB UHCI Controller #1xx		103c 12bc  d530 CMT (DG746A)xx		1043 80a6  P4P800 Mainboardx+		1458 24d2  GA-8KNXP motherboard (875P)xx		1462 7280  865PE Neo2 (MS-6728)xx		8086 3427  S875WP1-E mainboardx+		8086 524c  D865PERL mainboardxx	24d3  82801EB/ER (ICH5/ICH5R) SMBus Controllerxx		1043 80a6  P4P800 Mainboardx 		1458 24d2  GA-8IPE1000 Pro2 motherboard (865PE)xx		1462 7280  865PE Neo2 (MS-6728)xx		8086 3427  S875WP1-E mainboardx-	24d4  82801EB/ER (ICH5/ICH5R) USB UHCI #2x+		8086 524c  D865PERL mainboardx+	24d4  82801EB/ER (ICH5/ICH5R) USB UHCI Controller #2xx		103c 12bc  d530 CMT (DG746A)xx		1043 80a6  P4P800 Mainboardx 		1458 24d2  GA-8IPE1000 Pro2 motherboard (865PE)xx		1462 7280  865PE Neo2 (MS-6728)xx		8086 3427  S875WP1-E mainboardx+		8086 524c  D865PERL mainboardxx	24d5  82801EB/ER (ICH5/ICH5R) AC'97 Audio Controllerxx		103c 12bc  Analog Devices codec [SoundMAX Integrated Digital Audio]xx		1043 80f3  P4P800 Mainboardx+		1458 a002  GA-8KNXP motherboard (875P)xx		1462 7280  865PE Neo2 (MS-6728)x+		8086 a000  D865PERL mainboardxx	24d6  82801EB/ER (ICH5/ICH5R) AC'97 Modem Controllerxx	24d7  82801EB/ER (ICH5/ICH5R) USB UHCI #3xx		103c 12bc  d530 CMT (DG746A)x@@ -8163,6 +896367 @@xx		1458 24d2  GA-8IPE1000 Pro2 motherboard (865PE)xx		1462 7280  865PE Neo2 (MS-6728)xx		8086 3427  S875WP1-E mainboardx+		8086 524c  D865PERL mainboardxx	24db  82801EB/ER (ICH5/ICH5R) Ultra ATA 100 Storage Controllerxx		103c 12bc  d530 CMT (DG746A)xx		1043 80a6  P4P800 Mainboardx@@ -8170,18 +8971,21 @@xx		1462 7280  865PE Neo2 (MS-6728)xx		1462 7580  MSI 875Pxx		8086 3427  S875WP1-E mainboardx-	24dc  82801EB LPC Interface Controllerx+		8086 524c  D865PERL mainboardx+	24dc  82801EB (ICH5) LPC Interface Bridgexx	24dd  82801EB/ER (ICH5/ICH5R) USB2 EHCI Controllerxx		103c 12bc  d530 CMT (DG746A)xx		1043 80a6  P4P800 Mainboardx 		1458 5006  GA-8IPE1000 Pro2 motherboard (865PE)xx		1462 7280  865PE Neo2 (MS-6728)xx		8086 3427  S875WP1-E mainboardx-	24de  82801EB/ER (ICH5/ICH5R) USB UHCI #4x+		8086 524c  D865PERL mainboardx+	24de  82801EB/ER (ICH5/ICH5R) USB UHCI Controller #4xx		1043 80a6  P4P800 Mainboardx 		1458 24d2  GA-8IPE1000 Pro2 motherboard (865PE)xx		1462 7280  865PE Neo2 (MS-6728)xx		8086 3427  S875WP1-E mainboardx+		8086 524c  D865PERL mainboardxx	24df  82801EB (ICH5R) SATA (cc=RAID)xx	2500  82820 820 (Camino) Chipset Host Bridge (MCH)xx		1028 0095  Precision Workstation 220 Chipsetx@@ -8203,6 +900767 @@xx	2541  E7500/E7501 Host RASUM Controllerxx		15d9 3480  P4DP6xx		4c53 1090  Cx9 / Vx9 mainboardx+		8086 3424  SE7501HG2 Mainboardxx	2543  E7500/E7501 Hub Interface B PCI-to-PCI Bridgexx	2544  E7500/E7501 Hub Interface B RASUM Controllerxx		4c53 1090  Cx9 / Vx9 mainboardx@@ -8212,6 +901767 @@xx	2548  E7500/E7501 Hub Interface D RASUM Controllerxx	254c  E7501 Memory Controller Hubx 		4c53 1090  Cx9 / Vx9 mainboardx+		8086 3424  SE7501HG2 Mainboardxx	2550  E7505 Memory Controller Hubx 	2551  E7505/E7205 Series RAS Controllerxx	2552  E7505/E7205 PCI-to-AGP Bridgex@@ -8219,6 +902567 @@xx	2554  E7505 Hub Interface B PCI-to-PCI Bridge RAS Controllerxx	255d  E7205 Memory Controller Hubx 	2560  82845G/GL[Brookdale-G]/GE/PE DRAM Controller/Host-Hub Interfacex+		1028 0126  Optiplex GX260xx		1458 2560  GA-8PE667 Ultraxx		1462 5800  845PE Max (MS-6580)xx	2561  82845G/GL[Brookdale-G]/GE/PE Host-to-AGP Bridgex@@ -8228,37 +9035,47 @@xx		1043 80f2  P4P800 Mainboardx 		1458 2570  GA-8IPE1000 Pro2 motherboard (865PE)xx	2571  82865G/PE/P PCI to AGP Controllerx-	2572  82865G Integrated Graphics Devicex+	2572  82865G Integrated Graphics Controllerxx	2573  82865G/PE/P PCI to CSA Bridgexx	2576  82865G/PE/P Processor to I/O Memory Interfacex-	2578  82875P Memory Controller Hubx+	2578  82875P/E7210 Memory Controller Hubx+		1458 2578  GA-8KNXP motherboard (875P)xx		1462 7580  MS-6758 (875P Neo)xx# Motherboard P4SCExx		15d9 4580  Super Micro Computer Inc. P4SCExx	2579  82875P Processor to AGP Controllerx-	257b  82875P Processor to PCI to CSA Bridgex-	257e  82875P Processor to I/O Memory Interfacex+	257b  82875P/E7210 Processor to PCI to CSA Bridgex+	257e  82875P/E7210 Processor to I/O Memory Interfacexx	2580  915G/P/GV Processor to I/O Controllerxx	2581  915G/P/GV PCI Express Root Portx-	2582  82915G Express Chipset Family Graphics Controllerx-	2584  925X Memory Controller Hubx-	2585  925X PCI Express Root Portx-	2588  Server Memory Controller Hubx-	2589  Server Memory Controller Hub PCI Express Portx-	258a  Graphics Controllerx-	2590  Mobile Memory Controller Hubx-	2591  Mobile Memory Controller Hub PCI Express Portx-	2592  Mobile Graphics Controllerx+	2582  82915G/GV/910GL Express Chipset Family Graphics Controllerx+		1028 1079  Optiplex GX280x+	2584  925X/XE Memory Controller Hubx+	2585  925X/XE PCI Express Root Portx+	2588  E7220/E7221 Memory Controller Hubx+	2589  E7220/E7221 PCI Express Root Portx+	258a  E7221 Integrated Graphics Controllerx+	2590  Mobile 915GM/PM/GMS/910GML Express Processor to DRAM Controllerx+	2591  Mobile 915GM/PM Express PCI Express Root Portx+	2592  Mobile 915GM/GMS/910GML Express Graphics Controllerxx	25a1  6300ESB LPC Interface Controllerxx	25a2  6300ESB PATA Storage Controllerx+		4c53 10b0  CL9 mainboardxx	25a3  6300ESB SATA Storage Controllerx+		4c53 10b0  CL9 mainboardxx	25a4  6300ESB SMBus Controllerx+		4c53 10b0  CL9 mainboardxx	25a6  6300ESB AC'97 Audio Controllerx+		4c53 10b0  CL9 mainboardxx	25a7  6300ESB AC'97 Modem Controllerxx	25a9  6300ESB USB Universal Host Controllerx+		4c53 10b0  CL9 mainboardxx	25aa  6300ESB USB Universal Host Controllerx+		4c53 10b0  CL9 mainboardxx	25ab  6300ESB Watchdog Timerx+		4c53 10b0  CL9 mainboardxx	25ac  6300ESB I/O Advanced Programmable Interrupt Controllerx+		4c53 10b0  CL9 mainboardxx	25ad  6300ESB USB2 Enhanced Host Controllerx 	25ae  6300ESB 64-bit PCI-X Bridge
x	25b0  6300ESB SATA RAID Controllerx@@ -8300,28 +9117671 @@xx	2641  82801FBM (ICH6M) LPC Interface Bridgexx	2642  82801FW/FRW (ICH6W/ICH6RW) LPC Interface Bridgexx	2651  82801FB/FW (ICH6/ICH6W) SATA Controllerx+		1028 0179  Optiplex GX280xx	2652  82801FR/FRW (ICH6R/ICH6RW) SATA Controllerxx	2653  82801FBM (ICH6M) SATA Controllerxx	2658  82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #1x+		1028 0179  Optiplex GX280xx	2659  82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #2x+		1028 0179  Optiplex GX280xx	265a  82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #3x+		1028 0179  Optiplex GX280xx	265b  82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #4x+		1028 0179  Optiplex GX280xx	265c  82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controllerx+		1028 0179  Optiplex GX280xx	2660  82801FB/FBM/FR/FW/FRW (ICH6 Family) PCI Express Port 1xx	2662  82801FB/FBM/FR/FW/FRW (ICH6 Family) PCI Express Port 2xx	2664  82801FB/FBM/FR/FW/FRW (ICH6 Family) PCI Express Port 3xx	2666  82801FB/FBM/FR/FW/FRW (ICH6 Family) PCI Express Port 4xx	2668  82801FB/FBM/FR/FW/FRW (ICH6 Family) High Definition Audio Controllerxx	266a  82801FB/FBM/FR/FW/FRW (ICH6 Family) SMBus Controllerx+		1028 0179  Optiplex GX280xx	266c  82801FB/FBM/FR/FW/FRW (ICH6 Family) LAN Controllerxx	266d  82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Modem Controllerxx	266e  82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controllerx+		1028 0179  Optiplex GX280xx	266f  82801FB/FBM/FR/FW/FRW (ICH6 Family) IDE Controllerx+	2770  Memory Controller Hubx+	2771  PCI Express Graphics Portx+	2772  Integrated Graphics Controllerx+	2774  Workstation Memory Controller Hubx+	2775  PCI Express Graphics Portx+	2776  Integrated Graphics Controllerx+	2778  Server Memory Controller Hubx+	2779  PCI Express Root Portxx	2782  82915G Express Chipset Family Graphics Controllerx-	2792  Mobile Graphics Controllerx+	2792  Mobile 915GM/GMS/910GML Express Graphics Controllerx+	27b1  Mobile I/O Controller Hub LPCx+	27b8  I/O Controller Hub LPCx+	27c0  I/O Controller Hub SATA cc=IDEx+	27c1  I/O Controller Hub SATA cc=AHCIx+	27c2  I/O Controller Hub SATA cc=RAID
+	27c3  I/O Controller Hub SATA cc=RAID
+	27c4  Mobile I/O Controller Hub SATA cc=IDEx+	27c5  Mobile I/O Controller Hub SATA cc=AHCIx+	27c8  I/O Controller Hub UHCI USB #1x+	27c9  I/O Controller Hub UHCI USB #2x+	27ca  I/O Controller Hub UHCI USB #3x+	27cb  I/O Controller Hub UHCI USB #4x+	27cc  I/O Controller Hub EHCI USBx+	27d0  I/O Controller Hub PCI Express Port 1x+	27d2  I/O Controller Hub PCI Express Port 2x+	27d4  I/O Controller Hub PCI Express Port 3x+	27d6  I/O Controller Hub PCI Express Port 4x+	27d8  I/O Controller Hub High Definition Audiox+	27da  I/O Controller Hub SMBusx+	27dc  I/O Controller Hub LAN
+	27dd  I/O Controller Hub AC'97 Modem
+	27de  I/O Controller Hub AC'97 Audiox+	27df  I/O Controller Hub PATAx+	27e0  I/O Controller Hub PCI Express Port 5x+	27e2  I/O Controller Hub PCI Express Port 6
x	3092  Integrated RAID
x	3200  GD31244 PCI-X SATA HBAxx	3340  82855PM Processor to I/O Controllerx+		1025 005a  TravelMate 290x+		103c 0890  NC6000 laptopxx	3341  82855PM Processor to AGP Controllerxx	3575  82830 830 Chipset Host Bridgexx		1014 021d  ThinkPad A/T/X Seriesx@@ -8330,25 +9190,34 @@xx	3577  82830 CGC [Chipset Graphics Controller]xx		1014 0513  ThinkPad A/T/X Seriesxx	3578  82830 830 Chipset Host Bridgex-	3580  82852/855GM Host Bridgex-	3581  855GME GMCH Host-to-AGP Bridge (Virtual PCI-to-PCI)x+	3580  82852/82855 GM/GME/PM/GMV Processor to I/O Controllerx+		1028 0163  Latitude D505x+		4c53 10b0  CL9 mainboardx+	3581  82852/82855 GM/GME/PM/GMV Processor to AGP Controllerxx	3582  82852/855GM Integrated Graphics Devicex-	3584  855GM/GME GMCH Memory I/O Control Registersx-	3585  855GM/GME GMCH Configuration Process Registersx-	3590  Server Memory Controller Hubx-	3591  Memory Controller Hub Error Reporting Registerx-	3592  Server Memory Controller Hubx-	3593  Memory Controller Hub Error Reporting Registerx-	3594  Memory Controller Hub DMA Controllerx-	3595  Memory Controller Hub PCI Express Port A0x-	3596  Memory Controller Hub PCI Express Port A1x-	3597  Memory Controller Hub PCI Express Port B0x-	3598  Memory Controller Hub PCI Express Port B1x-	3599  Memory Controller Hub PCI Express Port C0x-	359a  Memory Controller Hub PCI Express Port C1x-	359b  Memory Controller Hub Extended Configuration Registersx-	359e  Workstation Memory Controller Hubx+		1028 0163  Latitude D505x+		4c53 10b0  CL9 mainboardx+	3584  82852/82855 GM/GME/PM/GMV Processor to I/O Controllerx+		1028 0163  Latitude D505x+		4c53 10b0  CL9 mainboardx+	3585  82852/82855 GM/GME/PM/GMV Processor to I/O Controllerx+		1028 0163  Latitude D505x+		4c53 10b0  CL9 mainboardx+	3590  E7520 Memory Controller Hubx+	3591  E7525/E7520 Error Reporting Registersx+	3592  E7320 Memory Controller Hubx+	3593  E7320 Error Reporting Registersx+	3594  E7520 DMA Controllerx+	3595  E7525/E7520/E7320 PCI Express Port Ax+	3596  E7525/E7520/E7320 PCI Express Port A1x+	3597  E7525/E7520 PCI Express Port Bx+	3598  E7520 PCI Express Port B1x+	3599  E7520 PCI Express Port Cx+	359a  E7520 PCI Express Port C1x+	359b  E7525/E7520/E7320 Extended Configuration Registersx+	359e  E7525 Memory Controller Hubx 	4220  PRO/Wireless 2200BGx+	4223  PRO/Wireless 2915ABG MiniPCI Adapterxx	5200  EtherExpress PRO/100 Intelligent Serverxx	5201  EtherExpress PRO/100 Intelligent Serverxx		8086 0001  EtherExpress PRO/100 Server Ethernet Adapterx@@ -8360,9 +9229,13 @@xx	7050  Intel Intercast Video Capture Cardxx	7100  430TX - 82439TX MTXCxx	7110  82371AB/EB/MB PIIX4 ISAx+		15ad 1976  virtualHW v3xx	7111  82371AB/EB/MB PIIX4 IDEx+		15ad 1976  virtualHW v3xx	7112  82371AB/EB/MB PIIX4 USBx+		15ad 1976  virtualHW v3xx	7113  82371AB/EB/MB PIIX4 ACPIx+		15ad 1976  virtualHW v3xx	7120  82810 GMCH [Graphics Memory Controller Hub]xx		4c53 1040  CL7 mainboardxx		4c53 1060  PC7 mainboardx@@ -8383,6 +925667 @@xx		0e11 0500  Armada 1750 Laptop System Chipsetxx		0e11 b110  Armada M700/E500xx		1179 0001  Toshiba Tecra 8100 Laptop System Chipsetx+		15ad 1976  virtualHW v3xx		4c53 1050  CT7 mainboardxx		4c53 1051  CE7 mainboardxx	7191  440BX/ZX/DX - 82443BX/ZX/DX AGP bridgex@@ -8393,6 +926767 @@xx		1033 0000  Versa Note Vxixx		4c53 10a0  CA3/CR3 mainboardxx	7195  82440MX AC'97 Audio Controllerx+		1033 80cc  Versa Note VXixx		10cf 1099  QSound_SigmaTel Stac97 PCI Audioxx		11d4 0040  SoundMAX Integrated Digital Audioxx		11d4 0048  SoundMAX Integrated Digital Audiox@@ -843067 +930567 @@xx	84e4  460GX - 84460GX Memory Data Controller (MDC)xx	84e6  460GX - 82466GX Wide and fast PCI eXpander Bridge (WXB)xx	84ea  460GX - 84460GX AGP Bridge (GXB function 1)x-	8500  IXP4xx Family  Network Processor (IXP420, 421, 422, 425 and IXC1100)x+	8500  IXP4XX Network Processor family. IXP420/IXP421/IXP422/IXP425/IXC1100xx	9000  IXP2000 Family Network Processor
x	9001  IXP2400 Network Processor
x	9004  IXP2800 Network Processor
@@ -8438,10 +9313615 @@xx	9622  Integrated RAID
x	9641  Integrated RAID
x	96a1  Integrated RAID
+# retail versonx+	a01f  PRO/10GbE LR Server Adapterx+# OEM versionx+	a11f  PRO/10GbE LR Server Adapterx 	b152  21152 PCI-to-PCI Bridgexx# observed, and documented in Intel revision note; new mask of 1011:0026x 	b154  21154 PCI-to-PCI Bridgexx	b555  21555 Non transparent PCI-to-PCI Bridgex+		12d9 000a  PCI VoIP Gatewayxx		1331 0030  ENP-2611xx		4c53 1050  CT7 mainboardxx		4c53 1051  CE7 mainboardx@@ -8616,6 +949667 @@xx	00cf  AIC-7899P U160/mxx		1028 00ce  PowerEdge 1400xx		1028 00d1  PowerEdge 2550x+		1028 00d9  PowerEdge 2500xx		10f1 2462  Thunder K7 S2462xx		15d9 9005  Onboard SCSI Host Adapterx 		8086 3411  SDS2 Mainboardx@@ -8685,12 +9566,14 @@xx9699  Omni Media Technology Incx 	6565  6565xx9710  NetMos Technologyx+	7780  USB IRDA-portxx	9815  PCI 9815 Multi-I/O Controllerxx		1000 0020  2P0S (2 port parallel adaptor)x 	9835  PCI 9835 Multi-I/O Controllerxx		1000 0002  2S (16C550 UART)xx		1000 0012  1P2Sx 	9845  PCI 9845 Multi-I/O Controllerx+		1000 0004  0P4S (4 port 16550A serial card)xx		1000 0006  0P6S (6 port 16550a serial card)xx	9855  PCI 9855 Multi-I/O Controllerxx		1000 0014  1P4Sx@@ -8705,8 +9588,10 @@xxa25b  Hewlett Packard GmbH PL24-MKTxxa304  Sonyxxa727  3Com Corporation
+	0013  3CRPAG175 Wireless PC Cardxxaa42  Scitex Digital Videoxxac1e  Digital Receiver Technology Incx+ac3d  Actuality Systemsxxaecb  Adrienne Electronics Corporation
 b1b3  Shiva Europe Limitedxx# Pinnacle should be 11bd, but they got it wrong several times --mj
diff -Nru a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig
--- a/drivers/pci/pcie/Kconfig	2005-01-14 15:07:35 -08:00x+++ b/drivers/pci/pcie/Kconfig	2005-02-14 03:59:46 -08:00x@@ -367 +3,6 @@xx#
 config PCIEPORTBUSx 	bool "PCI Express support"x-	depends on PCI_GOMMCONFIG || PCI_GOANYx 	default n
 x 	---help---
diff -Nru a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
--- a/drivers/pci/pcie/portdrv_pci.c	2005-02-02 22:41:40 -08:00x+++ b/drivers/pci/pcie/portdrv_pci.c	2005-02-07 00:41:08 -08:00x@@ -10667 +10667 @@xx	int retval = 0;
 x 	pcie_port_bus_register();x-	retval = pci_module_init(&pcie_portdrv);x+	retval = pci_register_driver(&pcie_portdrv);xx	if (retval)xx		pcie_port_bus_unregister();x 	return retval;
diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c	2005-02-02 22:42:24 -08:00x+++ b/drivers/pci/probe.c	2005-02-02 18:21:51 -08:00x@@ -64,9 +64,11 @@xx
 void pci_remove_legacy_files(struct pci_bus *b)xx{x-	class_device_remove_bin_file(&b->class_dev, b->legacy_io);x-	class_device_remove_bin_file(&b->class_dev, b->legacy_mem);x-	kfree(b->legacy_io); /* both are allocated here */x+	if (b->legacy_io)x{x+		class_device_remove_bin_file(&b->class_dev, b->legacy_io);x+		class_device_remove_bin_file(&b->class_dev, b->legacy_mem);x+		kfree(b->legacy_io); /* both are allocated here */x+	}
 }
 #else /* !HAVE_PCI_LEGACY */x static inline void pci_create_legacy_files(struct pci_bus *bus)x{ return; }
@@ -54967 +551,6 @@xx{x 	u32 class;
 x-	dev->slot_name = dev->dev.bus_id;x 	sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(dev->bus),xx		dev->bus->number, PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));x 
diff -Nru a/drivers/pci/proc.c b/drivers/pci/proc.c
--- a/drivers/pci/proc.c	2004-10-06 09:44:51 -07:00x+++ b/drivers/pci/proc.c	2005-02-07 12:52:02 -08:00x@@ -384,26 +384,32 @@xxint pci_proc_attach_device(struct pci_dev *dev)xx{x 	struct pci_bus *bus = dev->bus;x-	struct proc_dir_entry *de, *e;x+	struct proc_dir_entry *e;x 	char name[16];
 x 	if (!proc_initialized)xx		return -EACCES;
 x-	if (!(de = bus->procdir))x{x-		if (pci_name_bus(name, bus))x-			return -EEXIST;x-		de = bus->procdir = proc_mkdir(name, proc_bus_pci_dir);x-		if (!de)
+	if (!bus->procdir)x{x+		if (pci_proc_domain(bus))x{x+			sprintf(name, "%04x:%02x", pci_domain_nr(bus),x+					bus->number);x+		} else {x+			sprintf(name, "%02x", bus->number);x+		}x+		bus->procdir = proc_mkdir(name, proc_bus_pci_dir);x+		if (!bus->procdir)xx			return -ENOMEM;x 	}x+x 	sprintf(name, "%02x.%x", PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));x-	e = dev->procent = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUSR, de);x+	e = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUSR, bus->procdir);xx	if (!e)xx		return -ENOMEM;x 	e->proc_fops = &proc_bus_pci_operations;x 	e->data = dev;x 	e->size = dev->cfg_size;x+	dev->procent = e;
 x 	return 0;
 }
diff -Nru a/drivers/pci/quirks.c b/drivers/pci/quirks.c
--- a/drivers/pci/quirks.c	2005-02-02 22:42:20 -08:00x+++ b/drivers/pci/quirks.c	2005-02-14 11:10:24 -08:00x@@ -786,6 +78667 @@xx			}
 		if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB)xx			switch (dev->subsystem_device)x{x+			case 0x184b: /* W1N notebook */x 			case 0x186a: /* M6Ne notebook */x 				asus_hides_smbus = 1;xx			}
@@ -801,6 +802,18 @@xx			case 0x12bc: /* HP D330L */x 				asus_hides_smbus = 1;xx			}
+	} else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_TOSHIBA))x{x+		if (dev->device == PCI_DEVICE_ID_INTEL_82855GM_HB)x+			switch(dev->subsystem_device)x{x+			case 0x0001: /* Toshiba Satellite A40 */x+				asus_hides_smbus = 1;x+			}
+       } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG))x{x+               if (dev->device ==  PCI_DEVICE_ID_INTEL_82855PM_HB)x+                       switch(dev->subsystem_device)x{x+                       case 0xC00C: /* Samsung P35 notebook */x+                               asus_hides_smbus = 1;x+                       }x 	}x }x DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL,	PCI_DEVICE_ID_INTEL_82845_HB,	asus_hides_smbus_hostbridge );
diff -Nru a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c
--- a/drivers/pci/setup-res.c	2004-10-07 19:11:55 -07:00x+++ b/drivers/pci/setup-res.c	2005-02-07 12:51:58 -08:00x@@ -86,11 +86,11 @@xx	}x 	res->flags &= ~IORESOURCE_UNSET;xx	DBGC((KERN_INFO "PCI: moved device %s resource %d (%lx) to %x\n",x-		dev->slot_name, resno, res->flags,x+		pci_name(dev), resno, res->flags,xx		new & ~PCI_REGION_FLAG_MASK));x }
 x-int __init
+int __devinit
 pci_claim_resource(struct pci_dev *dev, int resource)xx{x 	struct resource *res = &dev->resource[resource];
diff -Nru a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c
--- a/drivers/pcmcia/pxa2xx_sharpsl.c	2005-01-12 16:00:00 -08:00x+++ b/drivers/pcmcia/pxa2xx_sharpsl.c	2005-03-06 08:52:27 -08:00x@@ -3867 +3867 @@xxx static void sharpsl_pcmcia_init_reset(void)xx{x-	reset_scoop();x+	reset_scoop(&corgiscoop_device.dev);xx	keep_vs = NO_KEEP_VS;xx	keep_rd = 0;
 }
@@ -79,8 +79,8 @@xx	}
 x 	/* Enable interrupt */x-	write_scoop_reg(SCOOP_IMR, 0x00C0);x-	write_scoop_reg(SCOOP_MCR, 0x0101);x+	write_scoop_reg(&corgiscoop_device.dev, SCOOP_IMR, 0x00C0);x+	write_scoop_reg(&corgiscoop_device.dev, SCOOP_MCR, 0x0101);xx	keep_vs = NO_KEEP_VS;xxx 	skt->irq = CORGI_IRQ_GPIO_CF_IRQ;x@@ -102,30 +102,30 @@xx{x 	unsigned short cpr, csr;
 x-	cpr = read_scoop_reg(SCOOP_CPR);x+	cpr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CPR);x x-	write_scoop_reg(SCOOP_IRM, 0x00FF);x-	write_scoop_reg(SCOOP_ISR, 0x0000);x-	write_scoop_reg(SCOOP_IRM, 0x0000);x-	csr = read_scoop_reg(SCOOP_CSR);x+	write_scoop_reg(&corgiscoop_device.dev, SCOOP_IRM, 0x00FF);x+	write_scoop_reg(&corgiscoop_device.dev, SCOOP_ISR, 0x0000);x+	write_scoop_reg(&corgiscoop_device.dev, SCOOP_IRM, 0x0000);x+	csr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CSR);xx	if (csr & 0x0004)x{x 		/* card eject */x-		write_scoop_reg(SCOOP_CDR, 0x0000);x+		write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0000);x 		keep_vs = NO_KEEP_VS;xx	}x 	else if (!(keep_vs & NO_KEEP_VS))x{x 		/* keep vs1,vs2 */x-		write_scoop_reg(SCOOP_CDR, 0x0000);x+		write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0000);x 		csr |= keep_vs;xx	}x 	else if (cpr & 0x0003)x{x 		/* power on */x-		write_scoop_reg(SCOOP_CDR, 0x0000);x+		write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0000);x 		keep_vs = (csr & 0x00C0);x 	}x 	else {x 		/* card detect */x-		write_scoop_reg(SCOOP_CDR, 0x0002);x+		write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0002);x 	}x x 	state->detect = (csr & 0x0004)x? 0 : 1;x@@ -166,10 +166,10 @@xxx 	local_irq_save(flags);x x-	nmcr = (mcr = read_scoop_reg(SCOOP_MCR))x& ~0x0010;x-	ncpr = (cpr = read_scoop_reg(SCOOP_CPR))x& ~0x0083;x-	nccr = (ccr = read_scoop_reg(SCOOP_CCR))x& ~0x0080;x-	nimr = (imr = read_scoop_reg(SCOOP_IMR))x& ~0x003E;x+	nmcr = (mcr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_MCR))x& ~0x0010;x+	ncpr = (cpr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CPR))x& ~0x0083;x+	nccr = (ccr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CCR))x& ~0x0080;x+	nimr = (imr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_IMR))x& ~0x003E;xxx 	ncpr |= (state->Vcc == 33)x? 0x0001 :x 				(state->Vcc == 50)x? 0x0002 : 0;x@@ -193,13 +193,13 @@xx	}
 x 	if (mcr != nmcr)x-		write_scoop_reg(SCOOP_MCR, nmcr);x+		write_scoop_reg(&corgiscoop_device.dev, SCOOP_MCR, nmcr);xx	if (cpr != ncpr)x-		write_scoop_reg(SCOOP_CPR, ncpr);x+		write_scoop_reg(&corgiscoop_device.dev, SCOOP_CPR, ncpr);xx	if (ccr != nccr)x-		write_scoop_reg(SCOOP_CCR, nccr);x+		write_scoop_reg(&corgiscoop_device.dev, SCOOP_CCR, nccr);xx	if (imr != nimr)x-		write_scoop_reg(SCOOP_IMR, nimr);x+		write_scoop_reg(&corgiscoop_device.dev, SCOOP_IMR, nimr);xxx 	local_irq_restore(flags);x xdiff -Nru a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
--- a/drivers/pcmcia/yenta_socket.c	2005-01-11 16:43:13 -08:00x+++ b/drivers/pcmcia/yenta_socket.c	2005-02-07 12:52:54 -08:00x@@ -96367 +96367 @@xx	 * the irq stuff...xx	 */x 	printk(KERN_INFO "Yenta: CardBus bridge found at %s [%04x:%04x]\n",x-		dev->slot_name, dev->subsystem_vendor, dev->subsystem_device);x+		pci_name(dev), dev->subsystem_vendor, dev->subsystem_device);xxx 	yenta_config_init(socket);x xdiff -Nru a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c
--- a/drivers/s390/char/keyboard.c	2004-06-12 20:52:28 -07:00x+++ b/drivers/s390/char/keyboard.c	2005-03-07 20:41:32 -08:00x@@ -32,11 +32,11 @@xxstatic k_handler_fn *k_handler[16] = { K_HANDLERS };xxx /* maximum values each key_handler can handle */x-static const int max_vals[] = {
+static const int kbd_max_vals[] = {
x	255, ARRAY_SIZE(func_table) - 1, NR_FN_HANDLER - 1, 0,xx	NR_DEAD - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0
 };x-static const int NR_TYPES = ARRAY_SIZE(max_vals);x+static const int KBD_NR_TYPES = ARRAY_SIZE(kbd_max_vals);xxx static unsigned char ret_diacr[NR_DEAD] = {
x	'`', '\'', '^', '~', '"', ','x@@ -36067 +36067 @@xx		key_map = kbd->key_maps[tmp.kb_table];
 		if (key_map)x{x 		    val = U(key_map[tmp.kb_index]);x-		    if (KTYP(val) >= NR_TYPES)x+		    if (KTYP(val) >= KBD_NR_TYPES)xx			val = K_HOLE;
 		} elsex 		    val = (tmp.kb_indexx? K_HOLE : K_NOSUCHMAP);x@@ -378,9 +378,9 @@xx			break;
 		}x x-		if (KTYP(tmp.kb_value) >= NR_TYPES)x+		if (KTYP(tmp.kb_value) >= KBD_NR_TYPES)xx			return -EINVAL;x-		if (KVAL(tmp.kb_value) > max_vals[KTYP(tmp.kb_value)])x+		if (KVAL(tmp.kb_value) > kbd_max_vals[KTYP(tmp.kb_value)])xx			return -EINVAL;x 
 		if (!(key_map = kbd->key_maps[tmp.kb_table]))x{xdiff -Nru a/drivers/s390/char/sclp_quiesce.c b/drivers/s390/char/sclp_quiesce.c
--- a/drivers/s390/char/sclp_quiesce.c	2005-01-03 15:49:39 -08:00x+++ b/drivers/s390/char/sclp_quiesce.c	2005-03-07 20:41:32 -08:00x@@ -30,31 +30,16 @@xx{x 	static atomic_t cpuid = ATOMIC_INIT(-1);xx	psw_t quiesce_psw;x-	__u32 status;x-	int i;x+	int cpu;
 x 	if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid))xx		signal_processor(smp_processor_id(), sigp_stop);xx	/* Wait for all other cpus to enter stopped state */x-	i = 1;x-	while (i < NR_CPUS)x{x-		if (!cpu_online(i))x{x-			i++;x+	for_each_online_cpu(cpu)x{x+		if (cpu == smp_processor_id())xx			continue;x-		}x-		switch (signal_processor_ps(&status, 0, i, sigp_sense))x{x-		case sigp_order_code_accepted:x-		case sigp_status_stored:x-			/* Check for stopped and check stop state */x-			if (status & 0x50)x-				i++;x-			break;
-		case sigp_busy:x-			break;
-		case sigp_not_operational:x-			i++;x-			break;
-		}x+		while(!smp_cpu_not_running(cpu))x+			cpu_relax();x 	}x 	/* Quiesce the last cpu with the special psw */x 	quiesce_psw.mask = PSW_BASE_BITS | PSW_MASK_WAIT;xdiff -Nru a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
--- a/drivers/s390/cio/chsc.c	2004-08-07 11:05:35 -07:00x+++ b/drivers/s390/cio/chsc.c	2005-03-07 20:41:33 -08:00x@@ -167 +167 @@xx/*
  *  drivers/s390/cio/chsc.c
  *   S/390 common I/O routines -- channel subsystem call
- *   $Revision: 1.115 $
+ *   $Revision: 1.118 $
  *
  *    Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH,
  *			      IBM Corporation
@@ -423,12 +423,12 @@xx			     sch->schib.pmcw.pam &xx			     sch->schib.pmcw.pom)xx			    | chp_mask)x& sch->opm;
-		spin_unlock_irq(&sch->lock);
 		if (!old_lpm && sch->lpm)xx			device_trigger_reprobe(sch);
 		else if (sch->driver && sch->driver->verify)xx			sch->driver->verify(&sch->dev);xxx+		spin_unlock_irq(&sch->lock);
 		put_device(&sch->dev);xx		if (fla_mask != 0)xx			break;
@@ -703,6 +703,9 @@xx{x 	int cc;xxx+	if (!device_is_online(sch))x+		/* cio could be doing I/O. */x+		return 0;
 	cc = stsch(sch->irq, &sch->schib);xx	if (cc)xx		return 0;x@@ -717,10 +720,12 @@xx__s390_subchannel_vary_chpid(struct subchannel *sch,x__u8 chpid, int on)xx{x 	int chp, old_lpm;x+	unsigned long flags;
 x 	if (!sch->ssd_info.valid)xx		return;xx	x+	spin_lock_irqsave(&sch->lock, flags);x 	old_lpm = sch->lpm;x 	for (chp = 0; chp < 8; chp++)x{x 		if (sch->ssd_info.chpid[chp] != chpid)x@@ -751,6 +75667 @@xx		}
 		break;
 	}x+	spin_unlock_irqrestore(&sch->lock, flags);x }xxx static intxdiff -Nru a/drivers/s390/cio/chsc.h b/drivers/s390/cio/chsc.h
--- a/drivers/s390/cio/chsc.h	2004-07-01 22:23:50 -07:00x+++ b/drivers/s390/cio/chsc.h	2005-03-07 20:41:32 -08:00x@@ -18,8 +18,6 @@xx	struct device dev;x };xxx-extern struct channel_path *chps[];
-
 extern void s390_process_css( void );x extern void chsc_validate_chpids(struct subchannel *);x extern void chpid_is_actually_online(int);xdiff -Nru a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
--- a/drivers/s390/cio/css.c	2005-02-12 18:56:20 -08:00x+++ b/drivers/s390/cio/css.c	2005-03-07 20:41:33 -08:00x@@ -167 +167 @@xx/*
  *  drivers/s390/cio/css.c
  *  driver for channel subsystem
- *   $Revision: 1.84 $
+ *   $Revision: 1.85 $
  *
  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
  *			 IBM Corporation
@@ -180,6 +180,7 @@xx{x 	int event, ret, disc;xx	struct subchannel *sch;x+	unsigned long flags;
 x 	sch = get_subchannel_by_schid(irq);x 	disc = schx? device_is_disconnected(sch) : 0;x@@ -22167 +222,9 @@xx			 * coming operational again. It won't do harm in realxx			 * no path situations.xx			 */x+			spin_lock_irqsave(&sch->lock, flags);x 			device_trigger_reprobe(sch);
+			spin_unlock_irqrestore(&sch->lock, flags);x 			ret = 0;
 			break;
 		}x@@ -262,14 +265,19 @@xx			 * We can't immediately deregister the disconnectedxx			 * device since it might block.xx			 */x+			spin_lock_irqsave(&sch->lock, flags);x 			device_trigger_reprobe(sch);
+			spin_unlock_irqrestore(&sch->lock, flags);x 			ret = 0;
 		}
 		break;
 	case CIO_OPER:x-		if (disc)x+		if (disc) {x+			spin_lock_irqsave(&sch->lock, flags);x 			/* Get device operational again. */x 			device_trigger_reprobe(sch);
+			spin_unlock_irqrestore(&sch->lock, flags);x+		}
 		ret = schx? 0 : css_probe_device(irq);x 		break;
 	default:xdiff -Nru a/drivers/s390/cio/css.h b/drivers/s390/cio/css.h
--- a/drivers/s390/cio/css.h	2004-11-15 19:29:19 -08:00x+++ b/drivers/s390/cio/css.h	2005-03-07 20:41:33 -08:00x@@ -84,6 +8467 @@xx		unsigned int doverify:1;    /* delayed path verification */x 		unsigned int donotify:1;    /* call notify function */x 		unsigned int recog_done:1;  /* dev. recog. complete */x+		unsigned int fake_irb:1;    /* deliver faked irb */x 	}x__attribute__((packed))xflags;
 	unsigned long intparm;	/* user interruption parameter */x 	struct qdio_irq *qdio_data;x@@ -136,6 +13767 @@xxvoid device_trigger_reprobe(struct subchannel *);x x /* Helper functions for vary on/off. */x+int device_is_online(struct subchannel *);x void device_set_waiting(struct subchannel *);x x /* Machine check helper function. */xdiff -Nru a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
--- a/drivers/s390/cio/device.c	2004-12-02 23:25:46 -08:00x+++ b/drivers/s390/cio/device.c	2005-03-07 20:41:33 -08:00x@@ -167 +167 @@xx/*
  *  drivers/s390/cio/device.c
  *  bus driver for ccw devices
- *   $Revision: 1.129 $
+ *   $Revision: 1.131 $
  *
  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
  *			 IBM Corporation
@@ -293,6 +293,14 @@xx	cdev->online = 0;
 	spin_lock_irq(cdev->ccwlock);
 	ret = ccw_device_offline(cdev);x+	if (ret == -ENODEV)x{x+		if (cdev->private->state != DEV_STATE_NOT_OPER)x{x+			cdev->private->state = DEV_STATE_OFFLINE;
+			dev_fsm_event(cdev, DEV_EVENT_NOTOPER);x+		}x+		spin_unlock_irq(cdev->ccwlock);
+		return ret;x+	}
 	spin_unlock_irq(cdev->ccwlock);
 	if (ret == 0)xx		wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev));xdiff -Nru a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
--- a/drivers/s390/cio/device_fsm.c	2004-12-02 23:25:46 -08:00x+++ b/drivers/s390/cio/device_fsm.c	2005-03-07 20:41:33 -08:00x@@ -24,6 +24,17 @@xx#include "qdio.h"x x intx+device_is_online(struct subchannel *sch)
+{x+	struct ccw_device *cdev;x+x+	if (!sch->dev.driver_data)x+		return 0;
+	cdev = sch->dev.driver_data;x+	return (cdev->private->state == DEV_STATE_ONLINE);
+}x+x+int
 device_is_disconnected(struct subchannel *sch)
x{x 	struct ccw_device *cdev;x@@ -44,6 +5567 @@xx		return;xx	cdev = sch->dev.driver_data;x 	ccw_device_set_timeout(cdev, 0);x+	cdev->private->flags.fake_irb = 0;
 	cdev->private->state = DEV_STATE_DISCONNECTED;x }xxx@@ -474,6 +48667 @@xx	} else {x 		cio_disable_subchannel(sch);
 		ccw_device_set_timeout(cdev, 0);x+		cdev->private->flags.fake_irb = 0;
 		cdev->private->state = DEV_STATE_DISCONNECTED;x 		wake_up(&cdev->private->wait_q);x 	}x@@ -488,6 +501,21 @@xx		cdev->private->options.pgroup = 0;
 	case 0:
 		ccw_device_done(cdev, DEV_STATE_ONLINE);
+		/* Deliver fake irb to device driver, if needed. */x+		if (cdev->private->flags.fake_irb)x{x+			memset(&cdev->private->irb, 0, sizeof(struct irb));
+			cdev->private->irb.scsw = (struct scsw)x{x+				.cc = 1,x+				.fctl = SCSW_FCTL_START_FUNC,x+				.actl = SCSW_ACTL_START_PEND,x+				.stctl = SCSW_STCTL_STATUS_PEND,x+			};
+			cdev->private->flags.fake_irb = 0;
+			if (cdev->handler)x+				cdev->handler(cdev, cdev->private->intparm,x+					      &cdev->private->irb);
+			memset(&cdev->private->irb, 0, sizeof(struct irb));
+		}
 		break;
 	case -ETIME:
 		ccw_device_done(cdev, DEV_STATE_BOXED);x@@ -560,6 +588,8 @@xx	struct subchannel *sch;x x 	sch = to_subchannel(cdev->dev.parent);x+	if (stsch(sch->irq, &sch->schib) || !sch->schib.pmcw.dnv)x+		return -ENODEV;xx	if (cdev->private->state != DEV_STATE_ONLINE)x{x 		if (sch->schib.scsw.actl != 0)xx			return -EBUSY;x@@ -63766 +66767 @@xx	if (sch->driver->notify &&xx	    sch->driver->notify(&sch->dev, sch->lpmx? CIO_GONE : CIO_NO_PATH))x{x 			ccw_device_set_timeout(cdev, 0);x+			cdev->private->flags.fake_irb = 0;
 			cdev->private->state = DEV_STATE_DISCONNECTED;x 			wake_up(&cdev->private->wait_q);x 			return;x@@ -668,6 +699,12 @@xx		return;xx	}x 	sch = to_subchannel(cdev->dev.parent);x+	/*
+	 * Since we might not just be coming from an interrupt from the
+	 * subchannel we have to update the schib.
+	 */x+	stsch(sch->irq, &sch->schib);x+xx	if (sch->schib.scsw.actl != 0 ||xx	    (cdev->private->irb.scsw.stctl & SCSW_STCTL_STATUS_PEND))x{x 		/*x@@ -982,21 +1019,17 @@xxdevice_trigger_reprobe(struct subchannel *sch)
x{x 	struct ccw_device *cdev;x-	unsigned long flags;
 x 	if (!sch->dev.driver_data)xx		return;xx	cdev = sch->dev.driver_data;x-	spin_lock_irqsave(&sch->lock, flags);x-	if (cdev->private->state != DEV_STATE_DISCONNECTED)x{x-		spin_unlock_irqrestore(&sch->lock, flags);x+	if (cdev->private->state != DEV_STATE_DISCONNECTED)xx		return;x-	}x+x 	/* Update some values. */x-	if (stsch(sch->irq, &sch->schib))x{x-		spin_unlock_irqrestore(&sch->lock, flags);x+	if (stsch(sch->irq, &sch->schib))xx		return;x-	}x+x 	/*xx	 * The pim, pam, pom values may not be accurate, but they are the bestxx	 * we have before performing device selection :/x@@ -101467 +1047,6 @@xx	sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;x 	/* We should also udate ssd info, but this has to wait. */x 	ccw_device_start_id(cdev, 0);x-	spin_unlock_irqrestore(&sch->lock, flags);x }xxx static voidxdiff -Nru a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c
--- a/drivers/s390/cio/device_id.c	2005-01-20 21:02:15 -08:00x+++ b/drivers/s390/cio/device_id.c	2005-03-07 20:41:33 -08:00x@@ -316,6 +316,7 @@xx	if (ccw_device_accumulate_and_sense(cdev, irb)x!= 0)xx		return;xx	ret = ccw_device_check_sense_id(cdev);x+	memset(&cdev->private->irb, 0, sizeof(struct irb));
 	switch (ret)x{x 	/* 0, -ETIME, -EOPNOTSUPP, -EAGAIN or -EACCES */x 	case 0:			/* Sense id succeeded. */xdiff -Nru a/drivers/s390/cio/device_ops.c b/drivers/s390/cio/device_ops.c
--- a/drivers/s390/cio/device_ops.c	2005-02-03 06:42:43 -08:00x+++ b/drivers/s390/cio/device_ops.c	2005-03-07 20:41:33 -08:00x@@ -167 +167 @@xx/*
  *  drivers/s390/cio/device_ops.c
  *
- *   $Revision: 1.53 $
+ *   $Revision: 1.55 $
  *
  *    Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
  *			 IBM Corporation
@@ -81,6 +81,16 @@xx		return -ENODEV;xx	if (cdev->private->state == DEV_STATE_NOT_OPER)xx		return -ENODEV;x+	if (cdev->private->state == DEV_STATE_VERIFY)x{x+		/* Remember to fake irb when finished. */x+		if (!cdev->private->flags.fake_irb)x{x+			cdev->private->flags.fake_irb = 1;
+			cdev->private->intparm = intparm;
+			return 0;
+		} elsex+			/* There's already a fake I/O around. */x+			return -EBUSY;x+	}
 	if (cdev->private->state != DEV_STATE_ONLINE ||xx	    ((sch->schib.scsw.stctl & SCSW_STCTL_PRIM_STATUS) &&xx	     !(sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS)) ||xdiff -Nru a/drivers/s390/cio/device_pgid.c b/drivers/s390/cio/device_pgid.c
--- a/drivers/s390/cio/device_pgid.c	2004-07-01 22:23:50 -07:00x+++ b/drivers/s390/cio/device_pgid.c	2005-03-07 20:41:33 -08:00x@@ -15667 +15669 @@xx	if (ccw_device_accumulate_and_sense(cdev, irb)x!= 0)xx		return;xx	sch = to_subchannel(cdev->dev.parent);x-	switch (__ccw_device_check_sense_pgid(cdev))x{x+	ret = __ccw_device_check_sense_pgid(cdev);x+	memset(&cdev->private->irb, 0, sizeof(struct irb));
+	switch (ret)x{x 	/* 0, -ETIME, -EOPNOTSUPP, -EAGAIN, -EACCES or -EUSERS */x 	case 0:			/* Sense Path Group ID successful. */x 		if (cdev->private->pgid.inf.ps.state1 == SNID_STATE1_RESET)x@@ -30766 +309,7 @@xx{x 	struct subchannel *sch;x 	struct irb *irb;x+	int ret;x x 	irb = (struct irb *) __LC_IRB;x 	/* Retry set pgid for cc=1. */x@@ -31967 +322,9 @@xx	if (ccw_device_accumulate_and_sense(cdev, irb)x!= 0)xx		return;xx	sch = to_subchannel(cdev->dev.parent);x-	switch (__ccw_device_check_pgid(cdev))x{x+	ret = __ccw_device_check_pgid(cdev);x+	memset(&cdev->private->irb, 0, sizeof(struct irb));
+	switch (ret)x{x 	/* 0, -ETIME, -EAGAIN, -EOPNOTSUPP or -EACCES */x 	case 0:x 		/* Establish or Resign Path Group done. Update vpm. */x@@ -405,6 +41067 @@xx		return;xx	sch = to_subchannel(cdev->dev.parent);x 	ret = __ccw_device_check_pgid(cdev);x+	memset(&cdev->private->irb, 0, sizeof(struct irb));
 	switch (ret)x{x 	/* 0, -ETIME, -EAGAIN, -EOPNOTSUPP or -EACCES */x 	case 0:			/* disband successful. */xdiff -Nru a/drivers/s390/crypto/z90main.c b/drivers/s390/crypto/z90main.c
--- a/drivers/s390/crypto/z90main.c	2004-11-15 19:29:20 -08:00x+++ b/drivers/s390/crypto/z90main.c	2005-03-07 20:41:33 -08:00x@@ -2657,8 +2657,8 @@xxx 	/**xx	 * we use workavail = 2 to ensure 2 passes with nothing dequeued beforex-	 * exiting the loop. If pendingq_count == 0 after the loop, there is nox-	 * work remaining on the queues.
+	 * exiting the loop. If (pendingq_count+requestq_count) == 0 after the
+	 * loop, there is no work remaining on the queues.
x	 */x 	resp_addr = 0;
 	workavail = 2;x@@ -269767 +269767 @@xx		spin_unlock_irq(&queuespinlock);
 	}
 x-	if (pendingq_count)
+	if (pendingq_count + requestq_count)xx		z90crypt_schedule_reader_timer();x }x xdiff -Nru a/drivers/s390/net/ctcmain.c b/drivers/s390/net/ctcmain.c
--- a/drivers/s390/net/ctcmain.c	2005-01-03 15:49:39 -08:00x+++ b/drivers/s390/net/ctcmain.c	2005-03-07 20:41:34 -08:00x@@ -165 +165 @@xx/*
- * $Id: ctcmain.c,v 1.68 2004/12/27 09:25:27 heicarst Exp $
+ * $Id: ctcmain.c,v 1.69 2005/02/27 19:46:44 ptiedem Exp $
  *
  * CTC / ESCON network driver
  *
@@ -7,6 +767 @@xx * Author(s): Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com)xx * Fixes by : Jochen Röhrig (roehrig@de.ibm.com)
  *            Arnaldo Carvalho de Melo <acme@conectiva.com.br>
+	      Peter Tiedemann (ptiedem@de.ibm.com)
  * Driver Model stuff by : Cornelia Huck <cohuck@de.ibm.com>
  *
  * Documentation used:x@@ -3667 +3767 @@xx * along with this program; if not, write to the Free Softwarexx * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * RELEASE-TAG: CTC/ESCON network driver $Revision: 1.68 $
+ * RELEASE-TAG: CTC/ESCON network driver $Revision: 1.69 $
  *
  */x 
@@ -1894,13 +1895615 @@xx		return -1;xx	}x 	memset(ch,x0, sizeof (struct channel));x-	if ((ch->ccw = (struct ccw1 *) kmalloc(sizeof (struct ccw1) * 8,
+	if ((ch->ccw = (struct ccw1 *) kmalloc(8*sizeof(struct ccw1),x 					       GFP_KERNEL | GFP_DMA))x== NULL)x{x 		kfree(ch);
 		ctc_pr_warn("ctc: Out of memory in add_channel\n");
 		return -1;xx	}x x+	memset(ch->ccw,x0, 8*sizeof(struct ccw1));	// assure all flags and counters are resetx+x 	/**xx	 * "static" ccws are used in the following way:xx	 *x@@ -1914,21 +1917,17 @@xx	 *           4: write (idal allocated on every write).xx	 *           5: nopxx	 * ccw[6..7] (Channel program for initial channel setup):x-	 *           3: set extended modex-	 *           4: nopx+	 *           6: set extended modex+	 *           7: nopxx	 *xx	 * ch->ccw[0..5] are initialized in ch_action_start becausex 	 * the channel's direction is yet unknown here.
x	 */x 	ch->ccw[6].cmd_code = CCW_CMD_SET_EXTENDED;x 	ch->ccw[6].flags = CCW_FLAG_SLI;x-	ch->ccw[6].count = 0;x-	ch->ccw[6].cda = 0;
 x 	ch->ccw[7].cmd_code = CCW_CMD_NOOP;x 	ch->ccw[7].flags = CCW_FLAG_SLI;x-	ch->ccw[7].count = 0;x-	ch->ccw[7].cda = 0;
 x 	ch->cdev = cdev;x 	snprintf(ch->id, CTC_ID_SIZE, "ch-%s", cdev->dev.bus_id);x@@ -195567 +195467 @@xx	memset(ch->irb, 0, sizeof (struct irb));
 	while (*c && less_than((*c)->id, ch->id))xx		c = &(*c)->next;x-	if (!strncmp((*c)->id, ch->id, CTC_ID_SIZE))x{x+	if (*c && (!strncmp((*c)->id, ch->id, CTC_ID_SIZE)))x{x 		ctc_pr_debug(x 			"ctc: add_channel: device %s already in list, "x 			"using old entry\n", (*c)->id);x@@ -2011,6 +2010,8 @@xx				dev_kfree_skb(ch->trans_skb);xx			}
 			kfree(ch->ccw);x+			kfree(ch->irb);
+			kfree(ch);
 			return;xx		}
 		c = &((*c)->next);xdiff -Nru a/drivers/s390/net/iucv.c b/drivers/s390/net/iucv.c
--- a/drivers/s390/net/iucv.c	2005-01-20 21:02:15 -08:00x+++ b/drivers/s390/net/iucv.c	2005-03-07 20:41:33 -08:00x@@ -165 +165 @@xx/* 
- * $Id: iucv.c,v 1.42 2005/01/07 10:49:54 braunu Exp $
+ * $Id: iucv.c,v 1.43 2005/02/09 14:47:43 braunu Exp $
  *
  * IUCV network driver
  *
@@ -2967 +2967 @@xx * along with this program; if not, write to the Free Softwarexx * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.42 $
+ * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.43 $
  *
  */x 
@@ -35567 +35567 @@xxstatic voidx iucv_banner(void)xx{x-	char vbuf[] = "$Revision: 1.42 $";x+	char vbuf[] = "$Revision: 1.43 $";x 	char *version = vbuf;
 x 	if ((version = strchr(version, ':')))x{x@@ -252567 +252567 @@xx	return;xx}
 x-module_init(iucv_init);x+subsys_initcall(iucv_init);x module_exit(iucv_exit);x x /**xdiff -Nru a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
--- a/drivers/s390/net/qeth_main.c	2005-02-03 06:42:43 -08:00x+++ b/drivers/s390/net/qeth_main.c	2005-03-07 20:41:33 -08:00x@@ -166 +1,6 @@xx/*
  *
- * linux/drivers/s390/net/qeth_main.c ($Revision: 1.191 $)
+ * linux/drivers/s390/net/qeth_main.c ($Revision: 1.203 $)
  *
  * Linux on zSeries OSA Express and HiperSockets support
  *
@@ -1267 +1267 @@xx *			  Frank Pavlic (pavlic@de.ibm.com) andxx *		x	  Thomas Spatzier <tspat@de.ibm.com>
  *
- *    $Revision: 1.191 $	 $Date: 2005/01/31 13:13:57 $
+ *    $Revision: 1.203 $	 $Date: 2005/03/02 15:53:57 $
  *
  * 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
@@ -7767 +7767 @@xx#include "qeth_mpc.h"x #include "qeth_fs.h"x x-#define VERSION_QETH_C "$Revision: 1.191 $"
+#define VERSION_QETH_C "$Revision: 1.203 $"xxstatic const char *version = "qeth S/390 OSA-Express driver";x x /**x@@ -1631,10 +163167 @@xx				QETH_DBF_TEXT(trace,3, "irla");
 				break;
 			case IPA_CMD_UNREGISTER_LOCAL_ADDR:x-				PRINT_WARN("probably problem on %s: "x-					   "received IPA command 0x%X\n",x-					   QETH_CARD_IFNAME(card),x-					   cmd->hdr.command);
+				QETH_DBF_TEXT(trace,3, "urla");
 				break;
 			default:x 				PRINT_WARN("Received data is IPA "x@@ -2263,19 +2260,25 @@xx			struct qeth_hdr *hdr)xx{x 	unsigned short vlan_id = 0;
+#ifdef CONFIG_QETH_VLANx+	struct vlan_hdr *vhdr;
+#endifxxx 	skb->pkt_type = PACKET_HOST;x+	skb->protocol = qeth_type_trans(skb, skb->dev);xx	if (card->options.checksum_type == NO_CHECKSUMMING)xx		skb->ip_summed = CHECKSUM_UNNECESSARY;x 	elsexx		skb->ip_summed = CHECKSUM_NONE;
 #ifdef CONFIG_QETH_VLANxx	if (hdr->hdr.l2.flags[2] & (QETH_LAYER2_FLAG_VLAN))x{x+		vhdr = (struct vlan_hdr *) skb->data;x+		skb->protocol =
+			__constant_htons(vhdr->h_vlan_encapsulated_proto);
 		vlan_id = hdr->hdr.l2.vlan_id;xx		skb_pull(skb, VLAN_HLEN);
 	}
 #endifx-	skb->protocol = qeth_type_trans(skb, skb->dev);xx	return vlan_id;xx}xxx@@ -3388,11 +3391,9 @@xx		     unsigned len)
x{x 	struct ethhdr *hdr;x-	struct qeth_card *card;
 x-	card = (struct qeth_card *)dev->priv;
         hdr = (struct ethhdr *)skb_push(skb, QETH_FAKE_LL_LEN);
-	memcpy(hdr->h_source, card->dev->dev_addr, ETH_ALEN);
+	memcpy(hdr->h_source, dev->dev_addr, ETH_ALEN);
         memcpy(hdr->h_dest, "FAKELL", ETH_ALEN);
         if (type != ETH_P_802_3)
                 hdr->h_proto = htons(type);x@@ -3430614 +3431,6 @@xx	card->perf_stats.outbound_cnt++;xx	card->perf_stats.outbound_start_time = qeth_get_micros();x #endifx-	if (dev->hard_header == qeth_fake_header)x{x-               if ((skb = qeth_pskb_unshare(skb, GFP_ATOMIC))x== NULL)x{x-                        card->stats.tx_dropped++;x-                        dev_kfree_skb_irq(skb);x-                        return 0;
-                }x-                skb_pull(skb, QETH_FAKE_LL_LEN);
-	}x 	/*xx	 * We only call netif_stop_queue in case of errors. Since we'vex 	 * got our own synchronization on queues we can keep the stack'sx@@ -4060,8 +4053,17 @@xxx 	QETH_DBF_TEXT(trace, 6, "sendpkt");
 x-	if (!card->options.layer2)
+	if (!card->options.layer2)x{x 		ipv = qeth_get_ip_version(skb);x+		if ((card->dev->hard_header == qeth_fake_header)x&& ipv)x{x+               		if ((skb = qeth_pskb_unshare(skb,GFP_ATOMIC))x== NULL)x{x+                        	card->stats.tx_dropped++;x+                        	dev_kfree_skb_irq(skb);x+                        	return 0;
+                	}
+                	skb_pull(skb, QETH_FAKE_LL_LEN);
+		}x+	}x 	cast_type = qeth_get_cast_type(card, skb);xx	queue = card->qdio.out_qsx 		[qeth_get_priority_queue(card, skb, ipv, cast_type)];x@@ -524267 +5244,8 @@xx	struct inet6_dev *in6_dev;xxx 	QETH_DBF_TEXT(trace,4,"chkmcv6");x-	if (!qeth_is_supported(card, IPA_IPV6))
+	if ((card->options.layer2 == 0) &&x+	    (!qeth_is_supported(card, IPA_IPV6)) )xx		return ;
 x 	in6_dev = in6_dev_get(card->dev);x@@ -7117,10 +712067 @@xx	}x /*maybe it was set offline without ifconfig down
  * we can also use this state for recovery purposes*/x-	if (card->options.layer2)
-		qeth_set_allowed_threads(card, QETH_RECOVER_THREAD, 0);x-	elsex-		qeth_set_allowed_threads(card, 0xffffffff, 0);x+	qeth_set_allowed_threads(card, 0xffffffff, 0);x 	if (recover_flag == CARD_STATE_RECOVER)xx		qeth_start_again(card);xx	qeth_notify_processes();xdiff -Nru a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
--- a/drivers/scsi/Kconfig	2005-02-16 17:29:23 -08:00x+++ b/drivers/scsi/Kconfig	2005-03-05 08:14:25 -08:00x@@ -273,8 +273,8 @@xx	tristate "ACARD SCSI support"x 	depends on PCIx&& SCSIx 	helpx-	  This driver supports the ACARD 870U/W SCSI host adapter.
-x+	  This driver supports the ACARD SCSI host adapter.
+	  Support Chip <ATP870 ATP876 ATP880 ATP885>xx	  To compile this driver as a module, choose M here: the
x	  module will be called atp870u.x xdiff -Nru a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
--- a/drivers/scsi/ahci.c	2005-02-23 11:47:04 -08:00x+++ b/drivers/scsi/ahci.c	2005-03-07 20:41:36 -08:00x@@ -19966 +19967 @@xx	.dma_boundary		= AHCI_DMA_BOUNDARY,x 	.slave_configure	= ata_scsi_slave_config,x 	.bios_param		= ata_std_bios_param,
+	.ordered_flush		= 1,x };xxxxstatic struct ata_port_operations ahci_ops = {x@@ -57467 +57567 @@xx	writel(tmp, port_mmio + PORT_CMD);xx	readl(port_mmio + PORT_CMD);x/* flush */x x-	printk(KERN_WARNING "ata%u: error occurred, port reset\n", ap->port_no);x+	printk(KERN_WARNING "ata%u: error occurred, port reset\n", ap->id);x }xxx static void ahci_eng_timeout(struct ata_port *ap)x@@ -766,10 +767,10 @@xxx 	using_dac = hpriv->cap & HOST_CAP_64;x 	if (using_dac &&x-	    !pci_set_dma_mask(pdev, 0xffffffffffffffffULL))x{x-		rc = pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL);x+	    !pci_set_dma_mask(pdev, DMA_64BIT_MASK))x{x+		rc = pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);xx		if (rc)x{x-			rc = pci_set_consistent_dma_mask(pdev, 0xffffffffULL);x+			rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);xx			if (rc)x{x 				printk(KERN_ERR DRV_NAME "(%s): 64-bit DMA enable failed\n",x 					pci_name(pdev));x@@ -779,13 +780,13 @@xxx 		hpriv->flags |= HOST_CAP_64;x 	} else {x-		rc = pci_set_dma_mask(pdev, 0xffffffffULL);x+		rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);xx		if (rc)x{x 			printk(KERN_ERR DRV_NAME "(%s): 32-bit DMA enable failed\n",x 				pci_name(pdev));xx			return rc;xx		}
-		rc = pci_set_consistent_dma_mask(pdev, 0xffffffffULL);x+		rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);xx		if (rc)x{x 			printk(KERN_ERR DRV_NAME "(%s): 32-bit consistent DMA enable failed\n",x 				pci_name(pdev));xdiff -Nru a/drivers/scsi/arm/arxescsi.c b/drivers/scsi/arm/arxescsi.c
--- a/drivers/scsi/arm/arxescsi.c	2004-11-14 07:31:38 -08:00x+++ b/drivers/scsi/arm/arxescsi.c	2005-03-02 11:11:56 -08:00x@@ -43,6 +4367 @@xxstruct arxescsi_infox{x 	FAS216_Info		info;x 	struct expansion_card	*ec;x+	void __iomem		*base;x };xxx #define DMADATA_OFFSET	(0x200)x@@ -7367 +7467 @@xx	return fasdma_pseudo;xx}
 x-static void arxescsi_pseudo_dma_write(unsigned char *addr, unsigned char *base)x+static void arxescsi_pseudo_dma_write(unsigned char *addr, void __iomem *base)xx{x        __asm__ __volatile__(x        "               stmdb   sp!, {r0-r12}\n"x@@ -11567 +116,7 @@xx{x 	struct arxescsi_infox*infox= (struct arxescsi_infox*)host->hostdata;x 	unsigned int length, error = 0;x-	unsigned char *base = info->info.scsi.io_base;x+	void __iomem *base = info->info.scsi.io_base;x 	unsigned char *addr;xxx 	length = SCp->this_residual;x@@ -28367 +28467 @@xx	struct Scsi_Host *host;x 	struct arxescsi_infox*info;
 	unsigned long resbase, reslen;x-	unsigned char *base;x+	void __iomem *base;x 	int ret;x x 	ret = ecard_request_resources(ec);x@@ -304615 +305,13 @@xx		goto out_unmap;
 	}
 x-	host->base = (unsigned long)base;x-	host->irq = NO_IRQ;x-	host->dma_channel = NO_DMA;
-
 	infox= (struct arxescsi_infox*)host->hostdata;x 	info->ec = ec;x+	info->base = base;x x 	info->info.scsi.io_base		= base + 0x2000;x-	info->info.scsi.irq		= host->irq;x+	info->info.scsi.irq		= NO_IRQ;x+	info->info.scsi.dma		= NO_DMA;
 	info->info.scsi.io_shift	= 5;
 	info->info.ifcfg.clockrate	= 24;x/* MHz */x 	info->info.ifcfg.select_timeout = 255;x@@ -351,11 +350,12 @@xxstatic void __devexit arxescsi_remove(struct expansion_card *ec)
x{x 	struct Scsi_Host *host = ecard_get_drvdata(ec);x+	struct arxescsi_infox*infox= (struct arxescsi_infox*)host->hostdata;x x 	ecard_set_drvdata(ec, NULL);x 	fas216_remove(host);
 x-	iounmap((voidx*)host->base);x+	iounmap(info->base);xxx 	fas216_release(host);
 	scsi_host_put(host);
diff -Nru a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c
--- a/drivers/scsi/arm/cumana_2.c	2004-11-14 07:31:38 -08:00x+++ b/drivers/scsi/arm/cumana_2.c	2005-03-02 11:11:56 -08:00x@@ -167 +167 @@xx/*
  *  linux/drivers/acorn/scsi/cumana_2.c
  *
- *  Copyright (C) 1997-2002 Russell King
+ *  Copyright (C) 1997-2005 Russell King
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 asx@@ -78,11 +78,8 @@xxstruct cumanascsi2_infox{x 	FAS216_Info		info;x 	struct expansion_card	*ec;x-x-	void			*status;	/* card status register	*/x-	void			*alatch;	/* Control register	*/x+	void __iomem		*base;x 	unsigned int		terms;		/* Terminator state	*/x-	void			*dmaarea;	/* Pseudo DMA area	*/x 	struct scatterlist	sg[NR_SG];	/* Scatter DMA list	*/x };xxx@@ -9767 +94,8 @@xxstatic voidx cumanascsi_2_irqenable(struct expansion_card *ec, int irqnr)xx{x-	writeb(ALATCH_ENA_INT, ec->irq_data);x+	struct cumanascsi2_infox*infox= ec->irq_data;x+	writeb(ALATCH_ENA_INT, info->base + CUMANASCSI2_ALATCH);x }xxx /* Prototype: void cumanascsi_2_irqdisable(ec, irqnr)x@@ -10867 +106,8 @@xxstatic voidx cumanascsi_2_irqdisable(struct expansion_card *ec, int irqnr)xx{x-	writeb(ALATCH_DIS_INT, ec->irq_data);x+	struct cumanascsi2_infox*infox= ec->irq_data;x+	writeb(ALATCH_DIS_INT, info->base + CUMANASCSI2_ALATCH);x }xxx static const expansioncard_ops_t cumanascsi_2_ops = {x@@ -128,10 +127,10 @@xxx 	if (on_off)x{x 		info->terms = 1;x-		writeb(ALATCH_ENA_TERM, info->alatch);x+		writeb(ALATCH_ENA_TERM, info->base + CUMANASCSI2_ALATCH);x 	} else {x 		info->terms = 0;x-		writeb(ALATCH_DIS_TERM, info->alatch);x+		writeb(ALATCH_DIS_TERM, info->base + CUMANASCSI2_ALATCH);x 	}xx}xxx@@ -163,9 +162,9 @@xx{x 	struct cumanascsi2_infox*infox= (struct cumanascsi2_infox*)host->hostdata;x 	struct device *dev = scsi_get_device(host);
-	int dmach = host->dma_channel;x+	int dmach = info->info.scsi.dma;x x-	writeb(ALATCH_DIS_DMA, info->alatch);x+	writeb(ALATCH_DIS_DMA, info->base + CUMANASCSI2_ALATCH);x x 	if (dmach != NO_DMA &&xx	    (min_type == fasdma_real_all || SCp->this_residual >= 512))x{x@@ -186,11 +185,11 @@xxx 		disable_dma(dmach);xx		set_dma_sg(dmach, info->sg, bufs + 1);x-		writeb(alatch_dir, info->alatch);x+		writeb(alatch_dir, info->base + CUMANASCSI2_ALATCH);x 		set_dma_mode(dmach, dma_dir);
 		enable_dma(dmach);x-		writeb(ALATCH_ENA_DMA, info->alatch);x-		writeb(ALATCH_DIS_BIT32, info->alatch);x+		writeb(ALATCH_ENA_DMA, info->base + CUMANASCSI2_ALATCH);x+		writeb(ALATCH_DIS_BIT32, info->base + CUMANASCSI2_ALATCH);x 		return fasdma_real_all;
 	}
 x@@ -22467 +22367 @@xx#if 0
 		while (length > 1)x{x 			unsigned long word;
-			unsigned int status = readb(info->status);x+			unsigned int status = readb(info->base + CUMANASCSI2_STATUS);x 
 			if (status & STATUS_INT)xx				goto end;x@@ -23367 +23267 @@xx				continue;x 
 			word = *addr | *(addr + 1) << 8;
-			writew(word, info->dmaarea);x+			writew(word, info->base + CUMANASCSI2_PSEUDODMA);xx			addr += 2;xx			length -= 2;xx		}x@@ -24367 +24267 @@xx	else {x 		if (transfer && (transfer & 255))x{x 			while (length >= 256)x{x-				unsigned int status = readb(info->status);x+				unsigned int status = readb(info->base + CUMANASCSI2_STATUS);x 
 				if (status & STATUS_INT)xx					return;x@@ -25167 +250,8 @@xx				if (!(status & STATUS_DRQ))xx					continue;x 
-				readsw(info->dmaarea, addr, 256 >> 1);x+				readsw(info->base + CUMANASCSI2_PSEUDODMA,x+				       addr, 256 >> 1);xx				addr += 256;xx				length -= 256;xx			}x@@ -25967 +25967 @@xx
 		while (length > 0)x{x 			unsigned long word;
-			unsigned int status = readb(info->status);x+			unsigned int status = readb(info->base + CUMANASCSI2_STATUS);x 
 			if (status & STATUS_INT)xx				return;x@@ -26767 +26767 @@xx			if (!(status & STATUS_DRQ))xx				continue;x 
-			word = readw(info->dmaarea);x+			word = readw(info->base + CUMANASCSI2_PSEUDODMA);xx			*addr++ = word;
x			if (--length > 0)x{x 				*addr++ = word >> 8;x@@ -28669 +28669 @@xxcumanascsi_2_dma_stop(struct Scsi_Host *host, Scsi_Pointer *SCp)xx{x 	struct cumanascsi2_infox*infox= (struct cumanascsi2_infox*)host->hostdata;x-	if (host->dma_channel != NO_DMA)x{x-		writeb(ALATCH_DIS_DMA, info->alatch);x-		disable_dma(host->dma_channel);x+	if (info->info.scsi.dma != NO_DMA)x{x+		writeb(ALATCH_DIS_DMA, info->base + CUMANASCSI2_ALATCH);x+		disable_dma(info->info.scsi.dma);x 	}xx}xxx@@ -405,7 +40567 @@xx	struct Scsi_Host *host;x 	struct cumanascsi2_infox*info;
 	unsigned long resbase, reslen;x-	unsigned char *base;x+	void __iomem *base;x 	int ret;x x 	ret = ecard_request_resources(ec);x@@ -427,28 +427,18 @@xx		goto out_unmap;
 	}
 x-	host->base	  = (unsigned long)base;x-	host->irq	  = ec->irq;x-	host->dma_channel = ec->dma;x-x 	ecard_set_drvdata(ec, host);
 x 	infox= (struct cumanascsi2_infox*)host->hostdata;x 	info->ec	= ec;x-	info->dmaarea	= base + CUMANASCSI2_PSEUDODMA;x-	info->status	= base + CUMANASCSI2_STATUS;x-	info->alatch	= base + CUMANASCSI2_ALATCH;x-x-	ec->irqaddr	= info->status;x-	ec->irqmask	= STATUS_INT;x-	ec->irq_data	= base + CUMANASCSI2_ALATCH;x-	ec->ops		= &cumanascsi_2_ops;x+	info->base	= base;x x 	cumanascsi_2_terminator_ctl(host, term[ec->slot_no]);x x 	info->info.scsi.io_base		= base + CUMANASCSI2_FAS216_OFFSET;
 	info->info.scsi.io_shift	= CUMANASCSI2_FAS216_SHIFT;x-	info->info.scsi.irq		= host->irq;x+	info->info.scsi.irq		= ec->irq;x+	info->info.scsi.dma		= ec->dma;x 	info->info.ifcfg.clockrate	= 40;x/* MHz */x 	info->info.ifcfg.select_timeout	= 255;x 	info->info.ifcfg.asyncperiod	= 200;x/* ns */x@@ -461,25 +451630 @@xx	info->info.dma.pseudo		= cumanascsi_2_dma_pseudo;xx	info->info.dma.stop		= cumanascsi_2_dma_stop;xxx+	ec->irqaddr	= info->base + CUMANASCSI2_STATUS;x+	ec->irqmask	= STATUS_INT;x+	ec->irq_data	= info;
+	ec->ops		= &cumanascsi_2_ops;x+x 	ret = fas216_init(host);
 	if (ret)xx		goto out_free;x 
-	ret = request_irq(host->irq, cumanascsi_2_intr,x+	ret = request_irq(ec->irq, cumanascsi_2_intr,xx			  SA_INTERRUPT, "cumanascsi2", info);
 	if (ret)x{x 		printk("scsi%d: IRQ%d not free: %d\n",x-		       host->host_no, host->irq, ret);x+		       host->host_no, ec->irq, ret);xx		goto out_release;
 	}
 x-	if (host->dma_channel != NO_DMA)x{x-		if (request_dma(host->dma_channel, "cumanascsi2"))x{x+	if (info->info.scsi.dma != NO_DMA)x{x+		if (request_dma(info->info.scsi.dma, "cumanascsi2"))x{x 			printk("scsi%d: DMA%d not free, using PIO\n",x-			       host->host_no, host->dma_channel);x-			host->dma_channel = NO_DMA;
+			       host->host_no, info->info.scsi.dma);x+			info->info.scsi.dma = NO_DMA;
 		} else {x-			set_dma_speed(host->dma_channel, 180);x+			set_dma_speed(info->info.scsi.dma, 180);x 			info->info.ifcfg.capabilities |= FASCAP_DMA;
 		}x 	}x@@ -488,9 +483,9 @@xx	if (ret == 0)xx		goto out;
 x-	if (host->dma_channel != NO_DMA)x-		free_dma(host->dma_channel);x-	free_irq(host->irq, host);
+	if (info->info.scsi.dma != NO_DMA)x+		free_dma(info->info.scsi.dma);x+	free_irq(ec->irq, host);
 x  out_release:x 	fas216_release(host);
@@ -516,11 +511,11 @@xx	ecard_set_drvdata(ec, NULL);x 	fas216_remove(host);
 x-	if (host->dma_channel != NO_DMA)x-		free_dma(host->dma_channel);x-	free_irq(host->irq, info);
+	if (info->info.scsi.dma != NO_DMA)x+		free_dma(info->info.scsi.dma);x+	free_irq(ec->irq, info);
 x-	iounmap((voidx*)host->base);x+	iounmap(info->base);xxx 	fas216_release(host);
 	scsi_host_put(host);
diff -Nru a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c
--- a/drivers/scsi/arm/eesox.c	2004-11-14 07:31:38 -08:00x+++ b/drivers/scsi/arm/eesox.c	2005-03-02 11:11:56 -08:00x@@ -167 +167 @@xx/*
  *  linux/drivers/acorn/scsi/eesox.c
  *
- *  Copyright (C) 1997-2003 Russell King
+ *  Copyright (C) 1997-2005 Russell King
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 asx@@ -73,8 +73,8 @@xxstruct eesoxscsi_infox{x 	FAS216_Info		info;x 	struct expansion_card	*ec;x-x-	void			*ctl_port;x+	void __iomem		*base;x+	void __iomem		*ctl_port;x 	unsigned int		control;x 	struct scatterlist	sg[NR_SG];	/* Scatter DMA list	*/x };x@@ -163,7 +163,7 @@xx{x 	struct eesoxscsi_infox*infox= (struct eesoxscsi_infox*)host->hostdata;x 	struct device *dev = scsi_get_device(host);
-	int dmach = host->dma_channel;x+	int dmach = info->info.scsi.dma;x x 	if (dmach != NO_DMA &&xx	    (min_type == fasdma_real_all || SCp->this_residual >= 512))x{x@@ -194,11 +194,11 @@xx	return fasdma_pseudo;xx}
 x-static void eesoxscsi_buffer_in(voidx*buf, int length, voidx*base)x+static void eesoxscsi_buffer_in(voidx*buf, int length, voidx__iomem *base)xx{x-	const voidx*reg_fas = base + EESOX_FAS216_OFFSET;
-	const voidx*reg_dmastat = base + EESOX_DMASTAT;
-	const voidx*reg_dmadata = base + EESOX_DMADATA;x+	const voidx__iomem *reg_fas = base + EESOX_FAS216_OFFSET;
+	const voidx__iomem *reg_dmastat = base + EESOX_DMASTAT;
+	const voidx__iomem *reg_dmadata = base + EESOX_DMADATA;x 	const register unsigned long mask = 0xffff;x x 	dox{x@@ -272,11 +272,11 @@xx	} while (length);xx}
 x-static void eesoxscsi_buffer_out(voidx*buf, int length, voidx*base)x+static void eesoxscsi_buffer_out(voidx*buf, int length, voidx__iomem *base)xx{x-	const voidx*reg_fas = base + EESOX_FAS216_OFFSET;
-	const voidx*reg_dmastat = base + EESOX_DMASTAT;
-	const voidx*reg_dmadata = base + EESOX_DMADATA;x+	const voidx__iomem *reg_fas = base + EESOX_FAS216_OFFSET;
+	const voidx__iomem *reg_dmastat = base + EESOX_DMASTAT;
+	const voidx__iomem *reg_dmadata = base + EESOX_DMADATA;x x 	dox{x 		unsigned int status;x@@ -356,11 +356,11 @@xxeesoxscsi_dma_pseudo(struct Scsi_Host *host, Scsi_Pointer *SCp,xx		     fasdmadir_t dir, int transfer_size)xx{x-	voidx*basex= (voidx*)host->base;x+	struct eesoxscsi_infox*infox= (struct eesoxscsi_infox*)host->hostdata;x 	if (dir == DMA_IN)x{x-		eesoxscsi_buffer_in(SCp->ptr, SCp->this_residual, base);x+		eesoxscsi_buffer_in(SCp->ptr, SCp->this_residual, info->base);xx	} else {x-		eesoxscsi_buffer_out(SCp->ptr, SCp->this_residual, base);x+		eesoxscsi_buffer_out(SCp->ptr, SCp->this_residual, info->base);xx	}xx}xxx@@ -372,8 +372,9 @@xxstatic voidx eesoxscsi_dma_stop(struct Scsi_Host *host, Scsi_Pointer *SCp)xx{x-	if (host->dma_channel != NO_DMA)x-		disable_dma(host->dma_channel);x+	struct eesoxscsi_infox*infox= (struct eesoxscsi_infox*)host->hostdata;x+	if (info->info.scsi.dma != NO_DMA)x+		disable_dma(info->info.scsi.dma);x }xxx /* Prototype: const char *eesoxscsi_info(struct Scsi_Host * host)x@@ -52267 +52367 @@xx	struct Scsi_Host *host;x 	struct eesoxscsi_infox*info;
 	unsigned long resbase, reslen;x-	unsigned char *base;x+	void __iomem *base;x 	int ret;x x 	ret = ecard_request_resources(ec);x@@ -544,26 +545,19 @@xx		goto out_unmap;
 	}
 x-	host->base	  = (unsigned long)base;x-	host->irq	  = ec->irq;x-	host->dma_channel = ec->dma;x-x 	ecard_set_drvdata(ec, host);
 x 	infox= (struct eesoxscsi_infox*)host->hostdata;x 	info->ec	= ec;x+	info->base	= base;x 	info->ctl_port	= base + EESOX_CONTROL;x 	info->control	= term[ec->slot_no] ? EESOX_TERM_ENABLE : 0;
 	writeb(info->control, info->ctl_port);
 x-	ec->irqaddr	= base + EESOX_DMASTAT;
-	ec->irqmask	= EESOX_STAT_INTR;x-	ec->irq_data	= info;
-	ec->ops		= &eesoxscsi_ops;x-x 	info->info.scsi.io_base		= base + EESOX_FAS216_OFFSET;
 	info->info.scsi.io_shift	= EESOX_FAS216_SHIFT;x-	info->info.scsi.irq		= host->irq;x+	info->info.scsi.irq		= ec->irq;x+	info->info.scsi.dma		= ec->dma;x 	info->info.ifcfg.clockrate	= 40;x/* MHz */x 	info->info.ifcfg.select_timeout	= 255;x 	info->info.ifcfg.asyncperiod	= 200;x/* ns */x@@ -576,26 +570,31 @@xx	info->info.dma.pseudo		= eesoxscsi_dma_pseudo;xx	info->info.dma.stop		= eesoxscsi_dma_stop;xxx+	ec->irqaddr	= base + EESOX_DMASTAT;
+	ec->irqmask	= EESOX_STAT_INTR;x+	ec->irq_data	= info;
+	ec->ops		= &eesoxscsi_ops;x+x 	device_create_file(&ec->dev, &dev_attr_bus_term);x x 	ret = fas216_init(host);
 	if (ret)xx		goto out_free;x 
-	ret = request_irq(host->irq, eesoxscsi_intr, 0, "eesoxscsi", info);
+	ret = request_irq(ec->irq, eesoxscsi_intr, 0, "eesoxscsi", info);
 	if (ret)x{x 		printk("scsi%d: IRQ%d not free: %d\n",x-		       host->host_no, host->irq, ret);x+		       host->host_no, ec->irq, ret);xx		goto out_remove;
 	}
 x-	if (host->dma_channel != NO_DMA)x{x-		if (request_dma(host->dma_channel, "eesox"))x{x+	if (info->info.scsi.dma != NO_DMA)x{x+		if (request_dma(info->info.scsi.dma, "eesox"))x{x 			printk("scsi%d: DMA%d not free, DMA disabled\n",x-			       host->host_no, host->dma_channel);x-			host->dma_channel = NO_DMA;
+			       host->host_no, info->info.scsi.dma);x+			info->info.scsi.dma = NO_DMA;
 		} else {x-			set_dma_speed(host->dma_channel, 180);x+			set_dma_speed(info->info.scsi.dma, 180);x 			info->info.ifcfg.capabilities |= FASCAP_DMA;
 			info->info.ifcfg.cntl3 |= CNTL3_BS8;xx		}x@@ -605,9 +604,9 @@xx	if (ret == 0)xx		goto out;
 x-	if (host->dma_channel != NO_DMA)x-		free_dma(host->dma_channel);x-	free_irq(host->irq, host);
+	if (info->info.scsi.dma != NO_DMA)x+		free_dma(info->info.scsi.dma);x+	free_irq(ec->irq, host);
 x  out_remove:x 	fas216_remove(host);
@@ -634,13 +633,13 @@xx	ecard_set_drvdata(ec, NULL);x 	fas216_remove(host);
 x-	if (host->dma_channel != NO_DMA)x-		free_dma(host->dma_channel);x-	free_irq(host->irq, info);
+	if (info->info.scsi.dma != NO_DMA)x+		free_dma(info->info.scsi.dma);x+	free_irq(ec->irq, info);
 x 	device_remove_file(&ec->dev, &dev_attr_bus_term);x x-	iounmap((voidx*)host->base);x+	iounmap(info->base);xxx 	fas216_release(host);
 	scsi_host_put(host);
@@ -679,4 +678,3 @@xxMODULE_PARM(term, "1-8i");
 MODULE_PARM_DESC(term, "SCSI bus termination");
 MODULE_LICENSE("GPL");x-
diff -Nru a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
--- a/drivers/scsi/arm/fas216.c	2004-11-11 00:43:34 -08:00x+++ b/drivers/scsi/arm/fas216.c	2005-03-02 11:11:57 -08:00x@@ -142,19 +142,13 @@xxstatic inline unsigned char fas216_readb(FAS216_Infox*info, unsigned int reg)xx{x 	unsigned int off = reg << info->scsi.io_shift;x-	if (info->scsi.io_base)x-		return readb(info->scsi.io_base + off);x-	elsex-		return inb(info->scsi.io_port + off);x+	return readb(info->scsi.io_base + off);x }xxx static inline voidxfas216_writeb(FAS216_Infox*info, unsigned int reg, unsigned int val)xx{x 	unsigned int off = reg << info->scsi.io_shift;x-	if (info->scsi.io_base)x-		writeb(val, info->scsi.io_base + off);x-	elsex-		outb(val, info->scsi.io_port + off);x+	writeb(val, info->scsi.io_base + off);x }xxx static void fas216_dumpstate(FAS216_Infox*info)x@@ -197,8 +191,8 @@xx	printk("  { magic_start=%lX host=%p SCpnt=%p origSCpnt=%p\n",x 		info->magic_start, info->host, info->SCpnt,x 		info->origSCpnt);x-	printk("    scsi={ io_port=%X io_shift=%X irq=%X cfg={ %X %X %X %X }\n",x-		info->scsi.io_port, info->scsi.io_shift, info->scsi.irq,x+	printk("    scsi={ io_shift=%X irq=%X cfg={ %X %X %X %X }\n",x+		info->scsi.io_shift, info->scsi.irq,x 		info->scsi.cfg[0], info->scsi.cfg[1], info->scsi.cfg[2],x 		info->scsi.cfg[3]);x 	printk("           type=%p phase=%X\n",x@@ -2967,11 +2961,11 @@xx	return sprintf(buffer,xx			"\n"xx			"Chip    : %s\n"x-			" Address: 0x%08lx\n"x+			" Address: 0x%p\n"xx			" IRQ    : %d\n"xx			" DMA    : %d\n",x-			info->scsi.type, info->host->io_port,x-			info->host->irq, info->host->dma_channel);x+			info->scsi.type, info->scsi.io_base,x+			info->scsi.irq, info->scsi.dma);x }xxx int fas216_print_stats(FAS216_Infox*info, char *buffer)
diff -Nru a/drivers/scsi/arm/fas216.h b/drivers/scsi/arm/fas216.h
--- a/drivers/scsi/arm/fas216.h	2003-08-05 13:15:45 -07:00x+++ b/drivers/scsi/arm/fas216.h	2005-03-02 11:11:57 -08:00x@@ -236,12 +236,12 @@xx	/* driver information */x 	struct {x 		phase_t		phase;			/* current phase			*/x-		void		*io_base;		/* iomem base of FAS216			*/x-		unsigned int	io_port;		/* base address of FAS216		*/x+		void __iomem	*io_base;		/* iomem base of FAS216			*/x 		unsigned int	io_shift;		/* shift to adjust reg offsets by	*/x 		unsigned char	cfg[4];			/* configuration registers		*/x 		const char	*type;			/* chip type				*/x 		unsigned int	irq;			/* interrupt				*/x+		int		dma;			/* dma channel				*/x x 		Scsi_Pointer	SCp;			/* current commands data pointer	*/x xdiff -Nru a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c
--- a/drivers/scsi/arm/powertec.c	2004-11-14 07:31:38 -08:00x+++ b/drivers/scsi/arm/powertec.c	2005-03-02 11:11:57 -08:00x@@ -167 +167 @@xx/*
  *  linux/drivers/acorn/scsi/powertec.c
  *
- *  Copyright (C) 1997-2003 Russell King
+ *  Copyright (C) 1997-2005 Russell King
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 asx@@ -6167 +6167 @@xxstruct powertec_infox{x 	FAS216_Info		info;x 	struct expansion_card	*ec;x-	void			*term_port;x+	void __iomem		*base;x 	unsigned int		term_ctl;x 	struct scatterlist	sg[NR_SG];x };x@@ -7467 +74,8 @@xxstatic voidx powertecscsi_irqenable(struct expansion_card *ec, int irqnr)xx{x-	writeb(POWERTEC_INTR_ENABLE, ec->irq_data);x+	struct powertec_infox*infox= ec->irq_data;x+	writeb(POWERTEC_INTR_ENABLE, info->base + POWERTEC_INTR_CONTROL);x }xxx /* Prototype: void powertecscsi_irqdisable(ec, irqnr)x@@ -85,7 +86,8 @@xxstatic voidx powertecscsi_irqdisable(struct expansion_card *ec, int irqnr)xx{x-	writeb(POWERTEC_INTR_DISABLE, ec->irq_data);x+	struct powertec_infox*infox= ec->irq_data;x+	writeb(POWERTEC_INTR_DISABLE, info->base + POWERTEC_INTR_CONTROL);x }xxx static const expansioncard_ops_t powertecscsi_ops = {x@@ -10467 +106,7 @@xx	struct powertec_infox*infox= (struct powertec_infox*)host->hostdata;x x 	info->term_ctlx= on_off ? POWERTEC_TERM_ENABLE : 0;
-	writeb(info->term_ctl, info->term_port);x+	writeb(info->term_ctl, info->base + POWERTEC_TERM_CONTROL);x }xxx /* Prototype: void powertecscsi_intr(irq, *dev_id, *regs)x@@ -13567 +13767 @@xx{xx	struct powertec_infox*infox= (struct powertec_infox*)host->hostdata;x 	struct device *dev = scsi_get_device(host);
-	int dmach = host->dma_channel;x+	int dmach = info->info.scsi.dma;x x 	if (info->info.ifcfg.capabilities & FASCAP_DMA &&xx	    min_type == fasdma_real_all)x{x@@ -174,8 +176,9 @@xxstatic voidx powertecscsi_dma_stop(struct Scsi_Host *host, Scsi_Pointer *SCp)xx{x-	if (host->dma_channel != NO_DMA)x-		disable_dma(host->dma_channel);x+	struct powertec_infox*infox= (struct powertec_infox*)host->hostdata;x+	if (info->info.scsi.dma != NO_DMA)x+		disable_dma(info->info.scsi.dma);x }xxx /* Prototype: const char *powertecscsi_info(struct Scsi_Host * host)x@@ -31567 +31867 @@xx	struct Scsi_Host *host;x 	struct powertec_infox*info;
 	unsigned long resbase, reslen;x-	unsigned char *base;x+	void __iomem *base;x 	int ret;x x 	ret = ecard_request_resources(ec);x@@ -337626 +340,16 @@xx		goto out_unmap;
 	}
 x-	host->base	  = (unsigned long)base;x-	host->irq	  = ec->irq;x-	host->dma_channel = ec->dma;x-x-	ec->irqaddr	= base + POWERTEC_INTR_STATUS;x-	ec->irqmask	= POWERTEC_INTR_BIT;x-	ec->irq_data	= base + POWERTEC_INTR_CONTROL;
-	ec->ops		= &powertecscsi_ops;x-x 	ecard_set_drvdata(ec, host);
 x 	infox= (struct powertec_infox*)host->hostdata;x-	info->term_port = base + POWERTEC_TERM_CONTROL;x+	info->base = base;x 	powertecscsi_terminator_ctl(host, term[ec->slot_no]);x x-	device_create_file(&ec->dev, &dev_attr_bus_term);x-x 	info->info.scsi.io_base		= base + POWERTEC_FAS216_OFFSET;
 	info->info.scsi.io_shift	= POWERTEC_FAS216_SHIFT;x-	info->info.scsi.irq		= host->irq;x+	info->info.scsi.irq		= ec->irq;x+	info->info.scsi.dma		= ec->dma;x 	info->info.ifcfg.clockrate	= 40;x/* MHz */x 	info->info.ifcfg.select_timeout	= 255;x 	info->info.ifcfg.asyncperiod	= 200;x/* ns */x@@ -369,25 +362,32 @@xx	info->info.dma.pseudo		= NULL;xx	info->info.dma.stop		= powertecscsi_dma_stop;xxx+	ec->irqaddr	= base + POWERTEC_INTR_STATUS;x+	ec->irqmask	= POWERTEC_INTR_BIT;x+	ec->irq_data	= info;
+	ec->ops		= &powertecscsi_ops;x+
+	device_create_file(&ec->dev, &dev_attr_bus_term);x+x 	ret = fas216_init(host);
 	if (ret)xx		goto out_free;x 
-	ret = request_irq(host->irq, powertecscsi_intr,x+	ret = request_irq(ec->irq, powertecscsi_intr,xx			  SA_INTERRUPT, "powertec", info);
 	if (ret)x{x 		printk("scsi%d: IRQ%d not free: %d\n",x-		       host->host_no, host->irq, ret);x+		       host->host_no, ec->irq, ret);xx		goto out_release;
 	}
 x-	if (host->dma_channel != NO_DMA)x{x-		if (request_dma(host->dma_channel, "powertec"))x{x+	if (info->info.scsi.dma != NO_DMA)x{x+		if (request_dma(info->info.scsi.dma, "powertec"))x{x 			printk("scsi%d: DMA%d not free, using PIO\n",x-			       host->host_no, host->dma_channel);x-			host->dma_channel = NO_DMA;
+			       host->host_no, info->info.scsi.dma);x+			info->info.scsi.dma = NO_DMA;
 		} else {x-			set_dma_speed(host->dma_channel, 180);x+			set_dma_speed(info->info.scsi.dma, 180);x 			info->info.ifcfg.capabilities |= FASCAP_DMA;
 		}x 	}x@@ -39669 +39669 @@xx	if (ret == 0)xx		goto out;
 x-	if (host->dma_channel != NO_DMA)x-		free_dma(host->dma_channel);x-	free_irq(host->irq, host);
+	if (info->info.scsi.dma != NO_DMA)x+		free_dma(info->info.scsi.dma);x+	free_irq(ec->irq, host);
 x  out_release:x 	fas216_release(host);
@@ -420,18 +420,18 @@xxstatic void __devexit powertecscsi_remove(struct expansion_card *ec)
x{x 	struct Scsi_Host *host = ecard_get_drvdata(ec);x-	struct powertecscsi_infox*infox= (struct powertecscsi_infox*)host->hostdata;x+	struct powertec_infox*infox= (struct powertec_infox*)host->hostdata;x x 	ecard_set_drvdata(ec, NULL);x 	fas216_remove(host);
 x 	device_remove_file(&ec->dev, &dev_attr_bus_term);x x-	if (host->dma_channel != NO_DMA)x-		free_dma(host->dma_channel);x-	free_irq(host->irq, info);
+	if (info->info.scsi.dma != NO_DMA)x+		free_dma(info->info.scsi.dma);x+	free_irq(ec->irq, info);
 x-	iounmap((voidx*)host->base);x+	iounmap(info->base);xxx 	fas216_release(host);
 	scsi_host_put(host);
diff -Nru a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
--- a/drivers/scsi/ata_piix.c	2005-02-17 16:29:16 -08:00x+++ b/drivers/scsi/ata_piix.c	2005-03-07 20:41:36 -08:00x@@ -12166 +12167 @@xx	.dma_boundary		= ATA_DMA_BOUNDARY,x 	.slave_configure	= ata_scsi_slave_config,x 	.bios_param		= ata_std_bios_param,
+	.ordered_flush		= 1,x };xxxxstatic struct ata_port_operations piix_pata_ops = {xdiff -Nru a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
--- a/drivers/scsi/atp870u.c	2004-11-13 08:17:41 -08:00x+++ b/drivers/scsi/atp870u.c	2005-03-08 17:01:14 -08:00x@@ -164 +164 @@x-/*
+/* 
  *  Copyright (C) 1997	Wu Ching Chen
  *  2.1.x update (C) 1998  Krzysztof G. Baranowski
  *  2.5.x update (C) 2002  Red Hat <alan@redhat.com>
@@ -13,8 +13,9 @@xx *		x  fix disconnect bug  2000/12/21xx *		x  support atp880 chip lvd u160 2001/05/15xx *		x  fix prd table bug 2001/09/12 (7.1)
+ *
+ * atp885 support add by ACARD Hao Ping Lian 2005/01/05
  */x-x #include <linux/module.h>x #include <linux/init.h>x #include <linux/interrupt.h>x@@ -38,39 +39,54 @@xx#include "atp870u.h"x xxstatic struct scsi_host_template atp870u_template;x-static void send_s870(struct Scsi_Host *host);x+void send_s870(struct atp_unit *dev,unsigned char c);x+void is885(struct atp_unit *dev, unsigned int wkport,unsigned char c);x+void tscam_885(void);
 x-x-static irqreturn_t atp870u_intr_handle(int irq, voidx*dev_id,x-					struct pt_regs *regs)x+static irqreturn_t atp870u_intr_handle(int irq, voidx*dev_id, struct pt_regs *regs)xx{x 	unsigned long flags;x 	unsigned short int tmpcip, id;x-	unsigned char i, j, target_id, lun;x+	unsigned char i, j, c, target_id, lun,cmdp;x 	unsigned char *prd;
-	struct scsi_cmndx*workrequ;x-	unsigned int workportu, tmport;x-	unsigned long adrcntu, k;x+	struct scsi_cmndx*workreq;x+	unsigned int workport, tmport, tmport1;x+	unsigned long adrcnt, k;x+#ifdef ED_DBGPx+	unsigned long l;
+#endifxx	int errstus;x 	struct Scsi_Host *host = dev_id;x 	struct atp_unit *devx= (struct atp_unit *)&host->hostdata;x x-	dev->in_int = 1;x-	workportu = dev->ioport;x-	tmport = workportu;x-x-	if (dev->working != 0)x{x-		tmport += 0x1f;x+	for (c = 0; c < 2; c++)x{x+		tmport = dev->ioport[c] + 0x1f;xx		j = inb(tmport);x-		if ((j & 0x80) == 0) {x-			dev->in_int = 0;x-			return IRQ_NONE;
-		}
-x-		tmpcip = dev->pciport;x-		if ((inb(tmpcip) & 0x08) != 0)x{x+		if ((j & 0x80) != 0)x+		{			x+	   		goto ch_sel;
+		}x+		dev->in_int[c] = 0;
+	}x+	return IRQ_NONE;
+ch_sel:x+#ifdef ED_DBGP	x+	printk("atp870u_intr_handle enter\n");
+#endif	
+	dev->in_int[c] = 1;x+	cmdp = inb(dev->ioport[c] + 0x10);x+	workport = dev->ioport[c];
+	if (dev->working[c] != 0)x{x+		if (dev->dev_id == ATP885_DEVID)x{x+			tmport1 = workport + 0x16;x+			if ((inb(tmport1) & 0x80) == 0)x+				outb((inb(tmport1) | 0x80), tmport1);
+		}		x+		tmpcip = dev->pciport[c];
+		if ((inb(tmpcip) & 0x08) != 0)x+		{x 			tmpcip += 0x2;x-			for (k = 0; k < 1000; k++)x{x+			for (k=0; k < 1000; k++)x{xx				if ((inb(tmpcip) & 0x08) == 0) {xx					goto stop_dma;x 				}x@@ -80,18 +96624 @@xx			}
 		}x stop_dma:x-		tmpcip = dev->pciport;x+		tmpcip = dev->pciport[c];
 		outb(0x00, tmpcip);x 		tmport -= 0x08;
-x+		x 		i = inb(tmport);x+		x+		if (dev->dev_id == ATP885_DEVID)x{x+			tmpcip += 2;x+			outb(0x06, tmpcip);x+			tmpcip -= 2;x+		}x x 		tmport -= 0x02;xx		target_id = inb(tmport);x 		tmport += 0x02;xxx 		/*
-		 *      Remap wide devices onto id numbersx+		 *	Remap wide devices onto id numbersxx		 */x x 		if ((target_id & 0x40) != 0)x{x@@ -101,332 +123,460 @@xx		}x x 		if ((j & 0x40) != 0)x{x-			if (dev->last_cmd == 0xff)x{x-				dev->last_cmd = target_id;x-			}x-			dev->last_cmd |= 0x40;
-		}
-x+		     if (dev->last_cmd[c] == 0xff)x{x+			dev->last_cmd[c] = target_id;x+		     }x+		     dev->last_cmd[c] |= 0x40;
+		}x+		if (dev->dev_id == ATP885_DEVID)xx+			dev->r1f[c][target_id] |= j;x+#ifdef ED_DBGPx+		printk("atp870u_intr_handle status = %x\n",i);
+#endif	
 		if (i == 0x85)x{x-			if ((dev->last_cmd & 0xf0) != 0x40) {x-				dev->last_cmd = 0xff;x+			if ((dev->last_cmd[c] & 0xf0) != 0x40) {x+			   dev->last_cmd[c] = 0xff;x+			}x+			if (dev->dev_id == ATP885_DEVID)x{x+				tmport -= 0x05;x+				adrcnt = 0;
+				((unsigned char *) &adrcnt)[2] = inb(tmport++);
+				((unsigned char *) &adrcnt)[1] = inb(tmport++);
+				((unsigned char *) &adrcnt)[0] = inb(tmport);x+				if (dev->id[c][target_id].last_len != adrcnt)x+				{x+			   		k = dev->id[c][target_id].last_len;x+			   		k -= adrcnt;x+			   		dev->id[c][target_id].tran_len = k;			   x+			   	dev->id[c][target_id].last_len = adrcnt;			   x+				}x+#ifdef ED_DBGPx+				printk("tmport = %x dev->id[c][target_id].last_len = %d dev->id[c][target_id].tran_len = %d\n",tmport,dev->id[c][target_id].last_len,dev->id[c][target_id].tran_len);
+#endif		xx			}
+xx			/*xx			 *      Flip widex-			 */x-			if (dev->wide_idu != 0)x{x-				tmport = workportu + 0x1b;x+			 */			x+			if (dev->wide_id[c] != 0)x{x+				tmport = workport + 0x1b;x 				outb(0x01, tmport);xx				while ((inb(tmport) & 0x01) != 0x01) {xx					outb(0x01, tmport);xx				}x-			}x+			}		xx			/*
-			 *      Issue more commandsx+			 *	Issue more commandsx 			 */x-			spin_lock_irqsave(dev->host->host_lock, flags);x-			if (((dev->quhdu != dev->quendu) || (dev->last_cmd != 0xff))x&& (dev->in_snd == 0))x{x-				send_s870(host);
+			spin_lock_irqsave(dev->host->host_lock, flags);			 			 x+			if (((dev->quhd[c] != dev->quend[c]) || (dev->last_cmd[c] != 0xff))x&&
+			    (dev->in_snd[c] == 0))x{x+#ifdef ED_DBGPx+				printk("Call sent_s870\n");
+#endif				x+				send_s870(dev,c);xx			}
 			spin_unlock_irqrestore(dev->host->host_lock, flags);xx			/*
-			 *      Donex+			 *	Donex 			 */x-			dev->in_int = 0;x-			goto out;
+			dev->in_int[c] = 0;
+#ifdef ED_DBGPx+				printk("Status 0x85 return\n");
+#endif				x+			goto handled;xx		}x x 		if (i == 0x40) {x-			dev->last_cmd |= 0x40;
-			dev->in_int = 0;x-			goto out;
+		     dev->last_cmd[c] |= 0x40;
+		     dev->in_int[c] = 0;
+		     goto handled;xx		}x x 		if (i == 0x21)x{x-			if ((dev->last_cmd & 0xf0) != 0x40) {x-				dev->last_cmd = 0xff;x+			if ((dev->last_cmd[c] & 0xf0) != 0x40) {x+			   dev->last_cmd[c] = 0xff;xx			}
 			tmport -= 0x05;x-			adrcntu = 0;x-			((unsigned char *) &adrcntu)[2] = inb(tmport++);
-			((unsigned char *) &adrcntu)[1] = inb(tmport++);
-			((unsigned char *) &adrcntu)[0] = inb(tmport);x-			k = dev->id[target_id].last_lenu;x-			k -= adrcntu;
-			dev->id[target_id].tran_lenu = k;
-			dev->id[target_id].last_lenu = adrcntu;
+			adrcnt = 0;
+			((unsigned char *) &adrcnt)[2] = inb(tmport++);
+			((unsigned char *) &adrcnt)[1] = inb(tmport++);
+			((unsigned char *) &adrcnt)[0] = inb(tmport);x+			k = dev->id[c][target_id].last_len;x+			k -= adrcnt;x+			dev->id[c][target_id].tran_len = k;x+			dev->id[c][target_id].last_len = adrcnt;
 			tmport -= 0x04;
 			outb(0x41, tmport);xx			tmport += 0x08;
 			outb(0x08, tmport);x-			dev->in_int = 0;x-			goto out;
+			dev->in_int[c] = 0;
+			goto handled;x+		}x+x+		if (dev->dev_id == ATP885_DEVID)x{x+			if ((i == 0x4c) || (i == 0x4d) || (i == 0x8c) || (i == 0x8d))x{x+		   		if ((i == 0x4c) || (i == 0x8c))xx+		      			i=0x48;x+		   		else x+		      			i=0x49;x+		   	}	x+			
 		}x 		if ((i == 0x80) || (i == 0x8f))x{x+#ifdef ED_DBGPx+			printk(KERN_DEBUG "Device reselect\n");
+#endif			xx			lun = 0;
 			tmport -= 0x07;x-			j = inb(tmport);x-			if (j == 0x44 || i == 0x80) {x+			if (cmdp == 0x44 || i==0x80) {x 				tmport += 0x0d;xx				lun = inb(tmport) & 0x07;xx			} else {x-				if ((dev->last_cmd & 0xf0) != 0x40) {x-					dev->last_cmd = 0xff;x+				if ((dev->last_cmd[c] & 0xf0) != 0x40) {x+				   dev->last_cmd[c] = 0xff;xx				}x-				if (j == 0x41) {x+				if (cmdp == 0x41)x{x+#ifdef ED_DBGPx+					printk("cmdp = 0x41\n");
+#endif						xx					tmport += 0x02;x-					adrcntu = 0;x-					((unsigned char *) &adrcntu)[2] = inb(tmport++);
-					((unsigned char *) &adrcntu)[1] = inb(tmport++);
-					((unsigned char *) &adrcntu)[0] = inb(tmport);x-					k = dev->id[target_id].last_lenu;x-					k -= adrcntu;
-					dev->id[target_id].tran_lenu = k;
-					dev->id[target_id].last_lenu = adrcntu;
+					adrcnt = 0;
+					((unsigned char *) &adrcnt)[2] = inb(tmport++);
+					((unsigned char *) &adrcnt)[1] = inb(tmport++);
+					((unsigned char *) &adrcnt)[0] = inb(tmport);x+					k = dev->id[c][target_id].last_len;x+					k -= adrcnt;x+					dev->id[c][target_id].tran_len = k;x+					dev->id[c][target_id].last_len = adrcnt;
 					tmport += 0x04;xx					outb(0x08, tmport);x-					dev->in_int = 0;x-					goto out;
+					dev->in_int[c] = 0;
+					goto handled;xx				} else {x+#ifdef ED_DBGPx+					printk("cmdp != 0x41\n");
+#endif						xx					outb(0x46, tmport);x-					dev->id[target_id].dirctu = 0x00;x+					dev->id[c][target_id].dirct = 0x00;xx					tmport += 0x02;xx					outb(0x00, tmport++);
x					outb(0x00, tmport++);
x					outb(0x00, tmport++);
x					tmport += 0x03;xx					outb(0x08, tmport);x-					dev->in_int = 0;x-					goto out;
+					dev->in_int[c] = 0;
+					goto handled;xx				}xx			}
-			if (dev->last_cmd != 0xff)x{x-				dev->last_cmd |= 0x40;
+			if (dev->last_cmd[c] != 0xff)x{x+			   dev->last_cmd[c] |= 0x40;
x			}
-			tmport = workportu + 0x10;x-			outb(0x45, tmport);x-			tmport += 0x06;x+			if (dev->dev_id == ATP885_DEVID)x{x+				j = inb(dev->baseport + 0x29) & 0xfe;x+				outb(j, dev->baseport + 0x29);x+				tmport = workport + 0x16;x+			} else {x+				tmport = workport + 0x10;x+				outb(0x45, tmport);x+				tmport += 0x06;				x+			}x+			
 			target_id = inb(tmport);x 			/*
-			 *      Remap wide identifiersx+			 *	Remap wide identifiersx 			 */xx			if ((target_id & 0x10) != 0)x{x 				target_id = (target_id & 0x07) | 0x08;
 			} else {x 				target_id &= 0x07;xx			}
-			workrequ = dev->id[target_id].curr_req;x-			tmport = workportu + 0x0f;x+			if (dev->dev_id == ATP885_DEVID)x{x+				tmport = workport + 0x10;x+				outb(0x45, tmport);x+			}x+			workreq = dev->id[c][target_id].curr_req;x+#ifdef ED_DBGP			x+			printk(KERN_DEBUG "Channel = %d ID = %d LUN = %d CDB",c,workreq->device->id,workreq->device->lun);x+			for(l=0;l<workreq->cmd_len;l++)x+			{x+				printk(KERN_DEBUG " %x",workreq->cmnd[l]);x+			}x+#endif	
+			x+			tmport = workport + 0x0f;
 			outb(lun, tmport);xx			tmport += 0x02;x-			outb(dev->id[target_id].devspu, tmport++);
-			adrcntu = dev->id[target_id].tran_lenu;x-			k = dev->id[target_id].last_lenu;x+			outb(dev->id[c][target_id].devsp, tmport++);
+			adrcnt = dev->id[c][target_id].tran_len;x+			k = dev->id[c][target_id].last_len;x+
 			outb(((unsigned char *) &k)[2], tmport++);
x			outb(((unsigned char *) &k)[1], tmport++);
x			outb(((unsigned char *) &k)[0], tmport++);
+#ifdef ED_DBGP			x+			printk("k %x, k[0] 0x%x k[1] 0x%x k[2] 0x%x\n", k, inb(tmport-1), inb(tmport-2), inb(tmport-3));
+#endif			xx			/* Remap wide */xx			j = target_id;xx			if (target_id > 7)x{x 				j = (j & 0x07) | 0x40;
x			}
x			/* Add direction */x-			j |= dev->id[target_id].dirctu;x+			j |= dev->id[c][target_id].dirct;
x			outb(j, tmport++);
-			outb(0x80, tmport);x-
-			/* enable 32 bit fifo transfer */x-			if (dev->deviceid != 0x8081)x{x-				tmport = workportu + 0x3a;x-				if ((dev->ata_cdbu[0] == 0x08) || (dev->ata_cdbu[0] == 0x28) || (dev->ata_cdbu[0] == 0x0a) || (dev->ata_cdbu[0] == 0x2a))x{x-					outb((unsigned char) ((inb(tmport) & 0xf3) | 0x08), tmport);x-				} else {x-					outb((unsigned char) (inb(tmport) & 0xf3), tmport);x+			outb(0x80,tmport);x+			x+			/* enable 32 bit fifo transfer */	x+			if (dev->dev_id == ATP885_DEVID)x{x+				tmpcip = dev->pciport[c] + 1;x+				i=inb(tmpcip) & 0xf3;x+				//j=workreq->cmnd[0];	    		    	x+				if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) {x+				   i |= 0x0c;xx				}x-			} else {x-				tmport = workportu - 0x05;x-				if ((dev->ata_cdbu[0] == 0x08) || (dev->ata_cdbu[0] == 0x28) || (dev->ata_cdbu[0] == 0x0a) || (dev->ata_cdbu[0] == 0x2a))x{x+				outb(i,tmpcip);		    		    		x+			} else if ((dev->dev_id == ATP880_DEVID1) ||x+	    		    	   (dev->dev_id == ATP880_DEVID2) )x{x+				tmport = workport - 0x05;x+				if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) {x 					outb((unsigned char) ((inb(tmport) & 0x3f) | 0xc0), tmport);xx				} else {x 					outb((unsigned char) (inb(tmport) & 0x3f), tmport);xx				}x-			}x-
-			tmport = workportu + 0x1b;x+			} else {				x+				tmport = workport + 0x3a;x+				if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) {x+					outb((unsigned char) ((inb(tmport) & 0xf3) | 0x08), tmport);x+				} else {x+					outb((unsigned char) (inb(tmport) & 0xf3), tmport);x+				}														x+			}	x+			tmport = workport + 0x1b;x 			j = 0;
 			id = 1;
 			id = id << target_id;xx			/*
-			 *      Is this a wide devicex+			 *	Is this a wide devicex 			 */x-			if ((id & dev->wide_idu) != 0)x{x+			if ((id & dev->wide_id[c]) != 0)x{x 				j |= 0x01;
x			}
x			outb(j, tmport);xx			while ((inb(tmport) & 0x01) != j)x{x-				outb(j, tmport);x+			   outb(j,tmport);xx			}x-
-			if (dev->id[target_id].last_lenu == 0)x{x-				tmport = workportu + 0x18;x+			if (dev->id[c][target_id].last_len == 0)x{x+				tmport = workport + 0x18;x 				outb(0x08, tmport);x-				dev->in_int = 0;x-				goto out;
-			}x-			prd = dev->id[target_id].prd_posu;x-			while (adrcntu != 0)x{x-				id = ((unsigned short int *) (prd))[2];x+				dev->in_int[c] = 0;
+#ifdef ED_DBGPx+				printk("dev->id[c][target_id].last_len = 0\n");
+#endif					x+				goto handled;x+			}x+#ifdef ED_DBGPx+			printk("target_id = %d adrcnt = %d\n",target_id,adrcnt);
+#endif			x+			prd = dev->id[c][target_id].prd_pos;x+			while (adrcnt != 0)x{x+				id = ((unsigned short int *)prd)[2];xx				if (id == 0) {xx					k = 0x10000;xx				} else {x 					k = id;xx				}x-				if (k > adrcntu) {x-					((unsigned short int *) (prd))[2] = (unsigned short int)x-					    (k - adrcntu);
-					((unsigned long *) (prd))[0] += adrcntu;
-					adrcntu = 0;x-					dev->id[target_id].prd_posu = prd;
+				if (k > adrcnt) {x+					((unsigned short int *)prd)[2] = (unsigned short int)x+					    (k - adrcnt);
+					((unsigned long *)prd)[0] += adrcnt;
+					adrcnt = 0;
+					dev->id[c][target_id].prd_pos = prd;
 				} else {x-					adrcntu -= k;
-					dev->id[target_id].prdaddru += 0x08;
+					adrcnt -= k;x+					dev->id[c][target_id].prdaddr += 0x08;
 					prd += 0x08;
-					if (adrcntu == 0)x{x-						dev->id[target_id].prd_posu = prd;
+					if (adrcnt == 0)x{x+						dev->id[c][target_id].prd_pos = prd;
 					}x-				}x+				}				
x			}
-			tmpcip = dev->pciport + 0x04;
-			outl(dev->id[target_id].prdaddru, tmpcip);x-			tmpcip -= 0x02;x-			outb(0x06, tmpcip);x-			outb(0x00, tmpcip);x-			tmpcip -= 0x02;x-			tmport = workportu + 0x18;x+			tmpcip = dev->pciport[c] + 0x04;
+			outl(dev->id[c][target_id].prdaddr, tmpcip);x+#ifdef ED_DBGPx+			printk("dev->id[%d][%d].prdaddr 0x%8x\n", c, target_id, dev->id[c][target_id].prdaddr);
+#endifx+			if (dev->dev_id == ATP885_DEVID)x{x+				tmpcip -= 0x04;
+			} else {x+				tmpcip -= 0x02;x+				outb(0x06, tmpcip);x+				outb(0x00, tmpcip);x+				tmpcip -= 0x02;x+			}x+			tmport = workport + 0x18;xx			/*
-			 *      Check transfer directionx+			 *	Check transfer directionx 			 */x-			if (dev->id[target_id].dirctu != 0)x{x+			if (dev->id[c][target_id].dirct != 0)x{x 				outb(0x08, tmport);x 				outb(0x01, tmpcip);x-				dev->in_int = 0;x-				goto out;
+				dev->in_int[c] = 0;
+#ifdef ED_DBGPx+				printk("status 0x80 return dirct != 0\n");
+#endif				x+				goto handled;xx			}
 			outb(0x08, tmport);x 			outb(0x09, tmpcip);x-			dev->in_int = 0;x-			goto out;
+			dev->in_int[c] = 0;
+#ifdef ED_DBGPx+			printk("status 0x80 return dirct = 0\n");
+#endif			x+			goto handled;xx		}x x 		/*
-		 *      Current scsi request on this targetx+		 *	Current scsi request on this targetxx		 */x x-		workrequ = dev->id[target_id].curr_req;x+		workreq = dev->id[c][target_id].curr_req;x x 		if (i == 0x42)x{x-			if ((dev->last_cmd & 0xf0) != 0x40) {x-				dev->last_cmd = 0xff;x+			if ((dev->last_cmd[c] & 0xf0) != 0x40)x+			{x+			   dev->last_cmd[c] = 0xff;xx			}
 			errstus = 0x02;x-			workrequ->result = errstus;x+			workreq->result = errstus;x 			goto go_42;
 		}x 		if (i == 0x16)x{x-			if ((dev->last_cmd & 0xf0) != 0x40) {x-				dev->last_cmd = 0xff;x+			if ((dev->last_cmd[c] & 0xf0) != 0x40) {x+			   dev->last_cmd[c] = 0xff;xx			}
 			errstus = 0;
 			tmport -= 0x08;xx			errstus = inb(tmport);x-			workrequ->result = errstus;x+			if (((dev->r1f[c][target_id] & 0x10) != 0)&&(dev->dev_id==ATP885_DEVID)) {x+			   printk(KERN_WARNING "AEC67162 CRC ERROR !\n");
+			   errstus = 0x02;x+			}x+			workreq->result = errstus;x go_42:x+			if (dev->dev_id == ATP885_DEVID)x{		x+				j = inb(dev->baseport + 0x29) | 0x01;
+				outb(j, dev->baseport + 0x29);x+			}xx			/*
-			 *      Complete the commandx+			 *	Complete the commandx 			 */x-			 x-			if (workrequ->use_sg)x{x+			if (workreq->use_sg)x{x 				pci_unmap_sg(dev->pdev,
-					(struct scatterlist *)workrequ->buffer,x-					workrequ->use_sg,x-					workrequ->sc_data_direction);x-			} else if (workrequ->request_bufflen &&x-					workrequ->sc_data_direction != DMA_NONE) {x+					(struct scatterlist *)workreq->buffer,x+					workreq->use_sg,x+					workreq->sc_data_direction);x+			} else if (workreq->request_bufflen &&x+					workreq->sc_data_direction != DMA_NONE) {x 				pci_unmap_single(dev->pdev,
-					workrequ->SCp.dma_handle,
-					workrequ->request_bufflen,x-					workrequ->sc_data_direction);x-			}x+					workreq->SCp.dma_handle,
+					workreq->request_bufflen,x+					workreq->sc_data_direction);x+			}			
x			spin_lock_irqsave(dev->host->host_lock, flags);x-			(*workrequ->scsi_done) (workrequ);
-x+			(*workreq->scsi_done) (workreq);x+#ifdef ED_DBGPx+			   printk("workreq->scsi_done\n");
+#endif	
x			/*
-			 *      Clear it off the queuex+			 *	Clear it off the queuex 			 */x-			dev->id[target_id].curr_req = NULL;x-			dev->working--;x+			dev->id[c][target_id].curr_req = 0;x+			dev->working[c]--;x 			spin_unlock_irqrestore(dev->host->host_lock, flags);xx			/*
x			 *      Take it back widex 			 */x-			if (dev->wide_idu != 0)x{x-				tmport = workportu + 0x1b;x+			if (dev->wide_id[c] != 0)x{x+				tmport = workport + 0x1b;x 				outb(0x01, tmport);xx				while ((inb(tmport) & 0x01) != 0x01) {xx					outb(0x01, tmport);x-				}x-			}x+				}       x+			} xx			/*
-			 *      If there is stuff to send and nothing going then send itx+			 *	If there is stuff to send and nothing going then send itx 			 */xx			spin_lock_irqsave(dev->host->host_lock, flags);x-			if (((dev->last_cmd != 0xff)x|| (dev->quhdu != dev->quendu))x&& (dev->in_snd == 0))x{x-				send_s870(host);
+			if (((dev->last_cmd[c] != 0xff)x|| (dev->quhd[c] != dev->quend[c]))x&&
+			    (dev->in_snd[c] == 0))x{x+#ifdef ED_DBGPx+			   printk("Call sent_s870(scsi_done)\n");
+#endif				   x+			   send_s870(dev,c);xx			}
 			spin_unlock_irqrestore(dev->host->host_lock, flags);x-			dev->in_int = 0;x-			goto out;
+			dev->in_int[c] = 0;
+			goto handled;x 		}x-		if ((dev->last_cmd & 0xf0) != 0x40) {x-			dev->last_cmd = 0xff;x+		if ((dev->last_cmd[c] & 0xf0) != 0x40) {x+		   dev->last_cmd[c] = 0xff;xx		}x 		if (i == 0x4f) {xx			i = 0x89;xx		}x 		i &= 0x0f;xx		if (i == 0x09) {x-			tmpcip = tmpcip + 4;
-			outl(dev->id[target_id].prdaddru, tmpcip);x+			tmpcip += 4;
+			outl(dev->id[c][target_id].prdaddr, tmpcip);x 			tmpcip = tmpcip - 2;x 			outb(0x06, tmpcip);x 			outb(0x00, tmpcip);x 			tmpcip = tmpcip - 2;x-			tmport = workportu + 0x10;x+			tmport = workport + 0x10;x 			outb(0x41, tmport);x-			dev->id[target_id].dirctu = 0x00;x-			tmport += 0x08;
+			if (dev->dev_id == ATP885_DEVID)x{x+				tmport += 2;x+				k = dev->id[c][target_id].last_len;x+				outb((unsigned char) (((unsigned char *) (&k))[2]), tmport++);
+				outb((unsigned char) (((unsigned char *) (&k))[1]), tmport++);
+				outb((unsigned char) (((unsigned char *) (&k))[0]), tmport);x+				dev->id[c][target_id].dirct = 0x00;x+				tmport += 0x04;x+			} else {x+				dev->id[c][target_id].dirct = 0x00;x+				tmport += 0x08;				x+			}x 			outb(0x08, tmport);x 			outb(0x09, tmpcip);x-			dev->in_int = 0;x-			goto out;
+			dev->in_int[c] = 0;
+			goto handled;xx		}x 		if (i == 0x08) {x-			tmpcip = tmpcip + 4;
-			outl(dev->id[target_id].prdaddru, tmpcip);x+			tmpcip += 4;
+			outl(dev->id[c][target_id].prdaddr, tmpcip);x 			tmpcip = tmpcip - 2;x 			outb(0x06, tmpcip);x 			outb(0x00, tmpcip);x 			tmpcip = tmpcip - 2;x-			tmport = workportu + 0x10;x+			tmport = workport + 0x10;x 			outb(0x41, tmport);x-			tmport += 0x05;x+			if (dev->dev_id == ATP885_DEVID)x{		x+				tmport += 2;x+				k = dev->id[c][target_id].last_len;x+				outb((unsigned char) (((unsigned char *) (&k))[2]), tmport++);
+				outb((unsigned char) (((unsigned char *) (&k))[1]), tmport++);
+				outb((unsigned char) (((unsigned char *) (&k))[0]), tmport++);
+			} else {x+				tmport += 5;x+			}x 			outb((unsigned char) (inb(tmport) | 0x20), tmport);x-			dev->id[target_id].dirctu = 0x20;x+			dev->id[c][target_id].dirct = 0x20;xx			tmport += 0x03;x 			outb(0x08, tmport);x 			outb(0x01, tmpcip);x-			dev->in_int = 0;x-			goto out;
+			dev->in_int[c] = 0;
+			goto handled;xx		}x 		tmport -= 0x07;x 		if (i == 0x0a)x{x@@ -434,25 +584,29 @@xx		} else {x 			outb(0x46, tmport);x 		}x-		dev->id[target_id].dirctu = 0x00;x+		dev->id[c][target_id].dirct = 0x00;xx		tmport += 0x02;xx		outb(0x00, tmport++);
x		outb(0x00, tmport++);
x		outb(0x00, tmport++);
x		tmport += 0x03;x 		outb(0x08, tmport);x-		dev->in_int = 0;x-		goto out;
+		dev->in_int[c] = 0;
+		goto handled;xx	} else {x-//              tmport = workportu + 0x17;x-//              inb(tmport);x-//              dev->working = 0;x-		dev->in_int = 0;x+//		tmport = workport + 0x17;x+//		inb(tmport);x+//		dev->working[c] = 0;
+		dev->in_int[c] = 0;
+		goto handled;xx	}
-out:x+	
+handled:x+#ifdef ED_DBGPx+	printk("atp870u_intr_handle exit\n");
+#endif			xx	return IRQ_HANDLED;x }x-x /**
  *	atp870u_queuecommand	-	Queue SCSI commandx  *	@req_p: request blockx@@ -460624 +614,30 @@xx *x  *	Queue a command to the ATP queue. Called with the host lock held.
  */x- x-static int atp870u_queuecommand(struct scsi_cmndx*req_p,x-		void (*done) (struct scsi_cmndx*))
+int atp870u_queuecommand(struct scsi_cmndx* req_p, void (*done) (struct scsi_cmndx*))
 {x-	unsigned short int m;x-	unsigned int tmport;x-	struct Scsi_Host *host;x+	unsigned char c;x+	unsigned int tmport,m;	x 	struct atp_unit *dev;x+	struct Scsi_Host *host;x x-	if (req_p->device->channel != 0) {x+	c = req_p->device->channel;	x+	req_p->sense_buffer[0]=0;x+	req_p->resid = 0;
+	if (req_p->device->channel > 1) {xx		req_p->result = 0x00040000;xx		done(req_p);
+#ifdef ED_DBGP		x+		printk("atp870u_queuecommand : req_p->device->channel > 1\n");	
+#endif			xx		return 0;x-	};
+	}x xx	host = req_p->device->host;x 	devx= (struct atp_unit *)&host->hostdata;x-	x+		x+x+		x 	m = 1;
 	m = m << req_p->device->id;xxx@@ -485,44 +645,60 @@xx	 *      Fake a timeout for missing targetsxx	 */x x-	if ((m & dev->active_idu) == 0)x{x+	if ((m & dev->active_id[c]) == 0) {xx		req_p->result = 0x00040000;xx		done(req_p);
x		return 0;x 	}
+xx	if (done) {xx		req_p->scsi_done = done;xx	} else {x-		printk(KERN_WARNING "atp870u_queuecommand: done can't be NULL\n");
+#ifdef ED_DBGP		x+		printk( "atp870u_queuecommand: done can't be NULL\n");
+#endif		xx		req_p->result = 0;xx		done(req_p);
x		return 0;x 	}
+	xx	/*x-	 *      Count new commandx+	 *	Count new commandxx	 */x-x-	dev->quendu++;x-	if (dev->quendu >= qcnt) {x-		dev->quendu = 0;
+	dev->quend[c]++;x+	if (dev->quend[c] >= qcnt) {x+		dev->quend[c] = 0;xx	}
+	xx	/*x-	 *      Check queue statex+	 *	Check queue statexx	 */x-	if (dev->quhdu == dev->quendu) {x-		if (dev->quendu == 0) {x-			dev->quendu = qcnt;
-		}x-		dev->quendu--;x+	if (dev->quhd[c] == dev->quend[c]) {x+		if (dev->quend[c] == 0)x{x+			dev->quend[c] = qcnt;
+		}
+#ifdef ED_DBGP		x+		printk("atp870u_queuecommand : dev->quhd[c] == dev->quend[c]\n");
+#endif		x+		dev->quend[c]--;x 		req_p->result = 0x00020000;x-		done(req_p);
+		done(req_p);	
x		return 0;x 	}
-	dev->querequ[dev->quendu] = req_p;x-	tmport = dev->ioport + 0x1c;x-	if ((inb(tmport) == 0)x&& (dev->in_int == 0)x&& (dev->in_snd == 0))x{x-		send_s870(host);
-	}
+	dev->quereq[c][dev->quend[c]] = req_p;x+	tmport = dev->ioport[c] + 0x1c;x+#ifdef ED_DBGP	x+	printk("dev->ioport[c] = %x inb(tmport) = %x dev->in_int[%d] = %d dev->in_snd[%d] = %d\n",dev->ioport[c],inb(tmport),c,dev->in_int[c],c,dev->in_snd[c]);
+#endifx+	if ((inb(tmport) == 0)x&& (dev->in_int[c] == 0)x&& (dev->in_snd[c] == 0))x{x+#ifdef ED_DBGPx+		printk("Call sent_s870(atp870u_queuecommand)\n");
+#endif		x+		send_s870(dev,c);x+	}
+#ifdef ED_DBGP	x+	printk("atp870u_queuecommand : exit\n");
+#endif	xx	return 0;x }xxx@@ -535,194 +711,270 @@xx *x  *	Caller holds the host lock.
  */x- x-static void send_s870(struct Scsi_Host *host)x+void send_s870(struct atp_unit *dev,unsigned char c)xx{x 	unsigned int tmport;x-	struct scsi_cmndx*workrequ;x-	unsigned int i;x-	unsigned char j, target_id;x+	struct scsi_cmndx*workreq;x+	unsigned int i;//,k;x+	unsigned char  j, target_id;x 	unsigned char *prd;
 	unsigned short int tmpcip, w;x-	unsigned long l;x-	dma_addr_t bttl;x-	unsigned int workportu;x+	unsigned long l, bttl = 0;
+	unsigned int workport;x 	struct scatterlist *sgpnt;x-	struct atp_unit *devx= (struct atp_unit *)&host->hostdata;x-	int sg_count;x+	unsigned long  sg_count;x x-	if (dev->in_snd != 0)x{x+	if (dev->in_snd[c] != 0)x{x+#ifdef ED_DBGP		x+		printk("cmndxin_snd\n");
+#endif
x		return;x 	}
-	dev->in_snd = 1;x-	if ((dev->last_cmd != 0xff)x&& ((dev->last_cmd & 0x40) != 0)) {x-		dev->last_cmd &= 0x0f;x-		workrequ = dev->id[dev->last_cmd].curr_req;x-		if (workrequ != NULL) {	/* check NULL pointer */x-			goto cmd_subp;
-		}x-		dev->last_cmd = 0xff;x-		if (dev->quhdu == dev->quendu) {x-			dev->in_snd = 0;x-			return;
-		}x-	}x-	if ((dev->last_cmd != 0xff)x&& (dev->working != 0)) {x-		dev->in_snd = 0;x-		return;
-	}
-	dev->working++;x-	j = dev->quhdu;x-	dev->quhdu++;x-	if (dev->quhdu >= qcnt) {x-		dev->quhdu = 0;x-	}x-	workrequ = dev->querequ[dev->quhdu];x-	if (dev->id[workrequ->device->id].curr_req == 0) {x-		dev->id[workrequ->device->id].curr_req = workrequ;x-		dev->last_cmd = workrequ->device->id;x+#ifdef ED_DBGPx+	printk("Sent_s870 enter\n");
+#endif
+	dev->in_snd[c] = 1;x+	if ((dev->last_cmd[c] != 0xff)x&& ((dev->last_cmd[c] & 0x40) != 0)) {x+		dev->last_cmd[c] &= 0x0f;x+		workreq = dev->id[c][dev->last_cmd[c]].curr_req;x+		if (workreq != NULL) {	/* check NULL pointer */x+		   goto cmd_subp;
+		}x+		dev->last_cmd[c] = 0xff;	x+		if (dev->quhd[c] == dev->quend[c]) {x+		   	dev->in_snd[c] = 0;
+		   	return ;
+		}x+	}x+	if ((dev->last_cmd[c] != 0xff)x&& (dev->working[c] != 0)) {x+	     	dev->in_snd[c] = 0;
+	     	return ;
+	}
+	dev->working[c]++;x+	j = dev->quhd[c];
+	dev->quhd[c]++;x+	if (dev->quhd[c] >= qcnt) {x+		dev->quhd[c] = 0;
+	}x+	workreq = dev->quereq[c][dev->quhd[c]];
+	if (dev->id[c][workreq->device->id].curr_req == 0) {	x+		dev->id[c][workreq->device->id].curr_req = workreq;x+		dev->last_cmd[c] = workreq->device->id;xx		goto cmd_subp;
-	}x-	dev->quhdu = j;x-	dev->working--;x-	dev->in_snd = 0;x+	}	x+	dev->quhd[c] = j;
+	dev->working[c]--;x+	dev->in_snd[c] = 0;
 	return;x cmd_subp:x-	workportu = dev->ioport;x-	tmport = workportu + 0x1f;x+	workport = dev->ioport[c];
+	tmport = workport + 0x1f;
 	if ((inb(tmport) & 0xb0) != 0)x{x 		goto abortsnd;x 	}
-	tmport = workportu + 0x1c;
+	tmport = workport + 0x1c;x 	if (inb(tmport) == 0)x{x 		goto oktosend;
 	}
 abortsnd:x-	dev->last_cmd |= 0x40;
-	dev->in_snd = 0;x+#ifdef ED_DBGPx+	printk("Abort to Send\n");
+#endif
+	dev->last_cmd[c] |= 0x40;
+	dev->in_snd[c] = 0;
 	return;x oktosend:x-	memcpy(&dev->ata_cdbu[0], &workrequ->cmnd[0], workrequ->cmd_len);
-	if (dev->ata_cdbu[0] == READ_CAPACITY) {x-		if (workrequ->request_bufflen > 8) {x-			workrequ->request_bufflen = 0x08;
+#ifdef ED_DBGPx+	printk("OK to Send\n");
+	printk("CDB");
+	for(i=0;i<workreq->cmd_len;i++)x{x+		printk(" %x",workreq->cmnd[i]);x+	}
+	printk("\nChannel = %d ID = %d LUN = %d\n",c,workreq->device->id,workreq->device->lun);x+#endif	
+	if (dev->dev_id == ATP885_DEVID)x{x+		j = inb(dev->baseport + 0x29) & 0xfe;x+		outb(j, dev->baseport + 0x29);x+		dev->r1f[c][workreq->device->id] = 0;
+	}x+	
+	if (workreq->cmnd[0] == READ_CAPACITY) {x+		if (workreq->request_bufflen > 8) {x+			workreq->request_bufflen = 0x08;xx		}x 	}
-	if (dev->ata_cdbu[0] == 0x00) {x-		workrequ->request_bufflen = 0;
+	if (workreq->cmnd[0] == 0x00) {x+		workreq->request_bufflen = 0;
 	}
 x-	tmport = workportu + 0x1b;x+	tmport = workport + 0x1b;x 	j = 0;x-	target_id = workrequ->device->id;x+	target_id = workreq->device->id;xxxx	/*x-	 *      Wide ?x+	 *	Wide ?xx	 */x 	w = 1;
 	w = w << target_id;x-	if ((w & dev->wide_idu) != 0)x{x+	if ((w & dev->wide_id[c]) != 0)x{x 		j |= 0x01;
x	}x 	outb(j, tmport);xx	while ((inb(tmport) & 0x01) != j)x{x-		outb(j, tmport);x+	   outb(j,tmport);x+#ifdef ED_DBGPx+	   printk("send_s870 while loop 1\n");
+#endif
x	}x-x 	/*x-	 *      Write the commandx+	 *	Write the commandxx	 */x x-	tmport = workportu;x-	outb(workrequ->cmd_len, tmport++);
+	tmport = workport;
+	outb(workreq->cmd_len, tmport++);
 	outb(0x2c, tmport++);
-	outb(0xcf, tmport++);
-	for (i = 0; i < workrequ->cmd_len; i++)x{x-		outb(dev->ata_cdbu[i], tmport++);
+	if (dev->dev_id == ATP885_DEVID)x{x+		outb(0x7f, tmport++);
+	} else {x+		outb(0xcf, tmport++); 	x+	}	x+	for (i = 0; i < workreq->cmd_len; i++)x{x+		outb(workreq->cmnd[i], tmport++);
 	}
-	tmport = workportu + 0x0f;x-	outb(workrequ->device->lun, tmport);x+	tmport = workport + 0x0f;
+	outb(workreq->device->lun, tmport);x 	tmport += 0x02;xx	/*x-	 *      Write the targetx+	 *	Write the targetxx	 */x-	outb(dev->id[target_id].devspu, tmport++);
-
+	outb(dev->id[c][target_id].devsp, tmport++);	 x+#ifdef ED_DBGP	x+	printk("dev->id[%d][%d].devsp = %2x\n",c,target_id,dev->id[c][target_id].devsp);
+#endif
x	/*x-	 *      Figure out the transfer sizex+	 *	Figure out the transfer sizexx	 */x-	if (workrequ->use_sg)x{x+	if (workreq->use_sg)x{x+#ifdef ED_DBGPx+		printk("Using SGL\n");
+#endif		xx		l = 0;x-		sgpntx= (struct scatterlist *) workrequ->request_buffer;x-		sg_count = pci_map_sg(dev->pdev, sgpnt, workrequ->use_sg,x-				workrequ->sc_data_direction);x-		for (i = 0; i < workrequ->use_sg; i++)x{x-			if (sgpnt[i].length == 0x|| workrequ->use_sg > ATP870U_SCATTER)x{x+		x+		sgpntx= (struct scatterlist *) workreq->request_buffer;x+		sg_count = pci_map_sg(dev->pdev, sgpnt, workreq->use_sg,x+	   			workreq->sc_data_direction);		x+		x+		for (i = 0; i < workreq->use_sg; i++)x{x+			if (sgpnt[i].length == 0x|| workreq->use_sg > ATP870U_SCATTER)x{x 				panic("Foooooooood fight!");xx			}
 			l += sgpnt[i].length;x 		}x-	} else if(workrequ->request_bufflen && workrequ->sc_data_direction != PCI_DMA_NONE) {x-		workrequ->SCp.dma_handle = pci_map_single(dev->pdev,
-				workrequ->request_buffer,
-				workrequ->request_bufflen,x-				workrequ->sc_data_direction);x-		l = workrequ->request_bufflen;
-	}x-	else l = 0;x+#ifdef ED_DBGP		x+		printk( "send_s870: workreq->use_sg %d, sg_count %d l %8ld\n", workreq->use_sg, sg_count, l);
+#endif
+	} else if(workreq->request_bufflen && workreq->sc_data_direction != PCI_DMA_NONE) {x+#ifdef ED_DBGPx+		printk("Not using SGL\n");
+#endif					x+		workreq->SCp.dma_handle = pci_map_single(dev->pdev, workreq->request_buffer,x+				workreq->request_bufflen,x+				workreq->sc_data_direction);		x+		l = workreq->request_bufflen;
+#ifdef ED_DBGP		x+		printk( "send_s870: workreq->use_sg %d, l %8ld\n", workreq->use_sg, l);
+#endif
+	} else l = 0;
 	/*x-	 *      Write transfer sizex+	 *	Write transfer sizexx	 */x 	outb((unsigned char) (((unsigned char *) (&l))[2]), tmport++);
 	outb((unsigned char) (((unsigned char *) (&l))[1]), tmport++);
 	outb((unsigned char) (((unsigned char *) (&l))[0]), tmport++);
-	j = target_id;x-	dev->id[j].last_lenu = l;x-	dev->id[j].tran_lenu = 0;x+	j = target_id;	
+	dev->id[c][j].last_len = l;
+	dev->id[c][j].tran_len = 0;x+#ifdef ED_DBGP	x+	printk("dev->id[%2d][%2d].last_len = %d\n",c,j,dev->id[c][j].last_len);
+#endif	xx	/*x-	 *      Flip the wide bitsx+	 *	Flip the wide bitsxx	 */x 	if ((j & 0x08) != 0)x{x 		j = (j & 0x07) | 0x40;
x	}xx	/*x-	 *      Check transfer directionx+	 *	Check transfer directionx 	 */x-	if (workrequ->sc_data_direction == DMA_TO_DEVICE)x{x+	if (workreq->sc_data_direction == DMA_TO_DEVICE)x{x 		outb((unsigned char) (j | 0x20), tmport++);
 	} else {x 		outb(j, tmport++);
x	}x 	outb((unsigned char) (inb(tmport) | 0x80), tmport);xx	outb(0x80, tmport);x-	tmport = workportu + 0x1c;
-	dev->id[target_id].dirctu = 0;
+	tmport = workport + 0x1c;x+	dev->id[c][target_id].dirct = 0;x 	if (l == 0)x{x 		if (inb(tmport) == 0)x{x-			tmport = workportu + 0x18;x+			tmport = workport + 0x18;x+#ifdef ED_DBGPx+			printk("change SCSI_CMD_REG 0x08\n");	
+#endif				x 			outb(0x08, tmport);x 		} else {x-			dev->last_cmd |= 0x40;
+			dev->last_cmd[c] |= 0x40;
x		}x-		dev->in_snd = 0;x+		dev->in_snd[c] = 0;
 		return;x 	}
-	tmpcip = dev->pciport;x-	prd = dev->id[target_id].prd_tableu;
-	dev->id[target_id].prd_posu = prd;
+	tmpcip = dev->pciport[c];
+	prd = dev->id[c][target_id].prd_table;x+	dev->id[c][target_id].prd_pos = prd;
 xx	/*x-	 *      Now write the request list. Either as scatter/gather or asx-	 *      a linear chain.x+	 *	Now write the request list. Either as scatter/gather or asx+	 *	a linear chain.xx	 */x x-	if (workrequ->use_sg)x{x-		sgpntx= (struct scatterlist *) workrequ->request_buffer;x+	if (workreq->use_sg)x{x+		sgpntx= (struct scatterlist *) workreq->request_buffer;x 		i = 0;x-		for (j = 0; j < workrequ->use_sg; j++)x{x+		for (j = 0; j < workreq->use_sg; j++)x{x 			bttl = sg_dma_address(&sgpnt[j]);x-			l = sg_dma_len(&sgpnt[j]);x+			l=sg_dma_len(&sgpnt[j]);x+#ifdef ED_DBGP		x+		printk("1. bttl %x, l %x\n",bttl, l);
+#endif			x 			while (l > 0x10000) {x+					(((u16 *) (prd))[i + 3]) = 0x0000;
+					(((u16 *) (prd))[i + 2]) = 0x0000;
+					(((u32 *) (prd))[i >> 1]) = cpu_to_le32(bttl);
+					l -= 0x10000;
+					bttl += 0x10000;
+					i += 0x04;x+				}x+				(((u32 *) (prd))[i >> 1]) = cpu_to_le32(bttl);
+				(((u16 *) (prd))[i + 2]) = cpu_to_le16(l);
+				(((u16 *) (prd))[i + 3]) = 0;
+				i += 0x04;			x+		}x+		(((u16 *) (prd))[i - 1]) = cpu_to_le16(0x8000);	
+#ifdef ED_DBGP		x+		printk("prd %4x %4x %4x %4x\n",(((unsigned short int *)prd)[0]),(((unsigned short int *)prd)[1]),(((unsigned short int *)prd)[2]),(((unsigned short int *)prd)[3]));
+		printk("2. bttl %x, l %x\n",bttl, l);
+#endif			x+	} else {x+		/*x+		 *	For a linear request write a chain of blocksx+		 */        x+		bttl = workreq->SCp.dma_handle;x+		l = workreq->request_bufflen;
+		i = 0;x+#ifdef ED_DBGP		x+		printk("3. bttl %x, l %x\n",bttl, l);
+#endif			x+		while (l > 0x10000) {x 				(((u16 *) (prd))[i + 3]) = 0x0000;
 				(((u16 *) (prd))[i + 2]) = 0x0000;
 				(((u32 *) (prd))[i >> 1]) = cpu_to_le32(bttl);
@@ -730,76 +982,80 @@xx				bttl += 0x10000;
 				i += 0x04;xx			}
-			(((u32 *) (prd))[i >> 1]) = cpu_to_le32(bttl);
+			(((u16 *) (prd))[i + 3]) = cpu_to_le16(0x8000);xx			(((u16 *) (prd))[i + 2]) = cpu_to_le16(l);
-			(((u16 *) (prd))[i + 3]) = 0;
-			i += 0x04;x-		}x-		(((u16 *) (prd))[i - 1]) = cpu_to_le16(0x8000);x-	} else {x-		/*
-		 *      For a linear request write a chain of blocksx-		 */x-		bttl = workrequ->SCp.dma_handle;x-		l = workrequ->request_bufflen;
-		i = 0;x-		while (l > 0x10000) {x-			(((u16 *) (prd))[i + 3]) = 0x0000;
-			(((u16 *) (prd))[i + 2]) = 0x0000;
-			(((u32 *) (prd))[i >> 1]) = cpu_to_le32(bttl);
-			l -= 0x10000;
-			bttl += 0x10000;
-			i += 0x04;x-		}x-		(((u16 *) (prd))[i + 3]) = cpu_to_le16(0x8000);x-		(((u16 *) (prd))[i + 2]) = cpu_to_le16(l);
-		(((u32 *) (prd))[i >> 1]) = cpu_to_le32(bttl);
-	}
-	tmpcip = tmpcip + 4;
-	dev->id[target_id].prdaddru = dev->id[target_id].prd_phys;x-	outl(dev->id[target_id].prd_phys, tmpcip);x+			(((u32 *) (prd))[i >> 1]) = cpu_to_le32(bttl);		
+#ifdef ED_DBGP		x+		printk("prd %4x %4x %4x %4x\n",(((unsigned short int *)prd)[0]),(((unsigned short int *)prd)[1]),(((unsigned short int *)prd)[2]),(((unsigned short int *)prd)[3]));
+		printk("4. bttl %x, l %x\n",bttl, l);
+#endif			x+		
+	}x+	tmpcip += 4;
+#ifdef ED_DBGP		x+	printk("send_s870: prdaddr_2 0x%8x tmpcip %x target_id %d\n", dev->id[c][target_id].prdaddr,tmpcip,target_id);x+#endif	
+	outl(dev->id[c][target_id].prdaddr, tmpcip);x 	tmpcip = tmpcip - 2;x 	outb(0x06, tmpcip);x 	outb(0x00, tmpcip);x-	tmpcip = tmpcip - 2;x-
-	if (dev->deviceid != 0x8081)x{x-		tmport = workportu + 0x3a;x-		if ((dev->ata_cdbu[0] == 0x08) || (dev->ata_cdbu[0] == 0x28) || (dev->ata_cdbu[0] == 0x0a) || (dev->ata_cdbu[0] == 0x2a))x{x-			outb((inb(tmport) & 0xf3) | 0x08, tmport);x-		} else {x-			outb(inb(tmport) & 0xf3, tmport);x-		}x-	} else {x-		tmport = workportu - 0x05;x-		if ((dev->ata_cdbu[0] == 0x08) || (dev->ata_cdbu[0] == 0x28) || (dev->ata_cdbu[0] == 0x0a) || (dev->ata_cdbu[0] == 0x2a))x{x+	if (dev->dev_id == ATP885_DEVID)x{x+		tmpcip--;x+		j=inb(tmpcip) & 0xf3;x+		if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) ||x+	    	(workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) {x+	   		j |= 0x0c;x+		}x+		outb(j,tmpcip);x+		tmpcip--;	    	x+	} else if ((dev->dev_id == ATP880_DEVID1) ||x+	    	   (dev->dev_id == ATP880_DEVID2))x{x+		tmpcip =tmpcip -2;	x+		tmport = workport - 0x05;x+		if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) {x 			outb((unsigned char) ((inb(tmport) & 0x3f) | 0xc0), tmport);xx		} else {x 			outb((unsigned char) (inb(tmport) & 0x3f), tmport);x-		}x-	}x-	tmport = workportu + 0x1c;
+		}		x+	} else {		x+		tmpcip =tmpcip -2;x+		tmport = workport + 0x3a;x+		if ((workreq->cmnd[0] == 0x08) || (workreq->cmnd[0] == 0x28) || (workreq->cmnd[0] == 0x0a) || (workreq->cmnd[0] == 0x2a)) {x+			outb((inb(tmport) & 0xf3) | 0x08, tmport);x+		} else {x+			outb(inb(tmport) & 0xf3, tmport);x+		}		x+	}	
+	tmport = workport + 0x1c;x x-	if (workrequ->sc_data_direction == DMA_TO_DEVICE)x{x-		dev->id[target_id].dirctu = 0x20;x+	if(workreq->sc_data_direction == DMA_TO_DEVICE)x{x+		dev->id[c][target_id].dirct = 0x20;xx		if (inb(tmport) == 0)x{x-			tmport = workportu + 0x18;x+			tmport = workport + 0x18;x 			outb(0x08, tmport);x 			outb(0x01, tmpcip);x+#ifdef ED_DBGP		x+		printk( "start DMA(to target)\n");
+#endif				x 		} else {x-			dev->last_cmd |= 0x40;
+			dev->last_cmd[c] |= 0x40;
x		}x-		dev->in_snd = 0;x+		dev->in_snd[c] = 0;
 		return;x 	}
-	if (inb(tmport) == 0)x{x-		tmport = workportu + 0x18;x+	if (inb(tmport) == 0)x{		x+		tmport = workport + 0x18;x 		outb(0x08, tmport);x 		outb(0x09, tmpcip);x+#ifdef ED_DBGP		x+		printk( "start DMA(to host)\n");
+#endif			xx	} else {x-		dev->last_cmd |= 0x40;
+		dev->last_cmd[c] |= 0x40;
x	}x-	dev->in_snd = 0;x+	dev->in_snd[c] = 0;
+	return;x+x }xxx static unsigned char fun_scam(struct atp_unit *dev, unsigned short int *val)
@@ -808,7 +1064,7 @@xx	unsigned short int i, k;x 	unsigned char j;x x-	tmport = dev->ioport + 0x1c;x+	tmport = dev->ioport[0] + 0x1c;x 	outw(*val, tmport);x FUN_D7:x 	for (i = 0; i < 10; i++)x{	/* stable >= bus settle delay(400 ns)  */x@@ -863624 +1119624 @@xx	}
  */x x-	tmport = dev->ioport + 1;x+	tmport = dev->ioport[0] + 1;x 	outb(0x08, tmport++);
 	outb(0x7f, tmport);x-	tmport = dev->ioport + 0x11;x+	tmport = dev->ioport[0] + 0x11;x 	outb(0x20, tmport);x x 	if ((dev->scam_on & 0x40) == 0) {xx		return;x 	}
 	m = 1;
-	m <<= dev->host_idu;x+	m <<= dev->host_id[0];x 	j = 16;x-	if (dev->chip_veru < 4)x{x+	if (dev->chip_ver < 4)x{xx		m |= 0xff00;
 		j = 8;x 	}
 	assignid_map = m;x-	tmport = dev->ioport + 0x02;x+	tmport = dev->ioport[0] + 0x02;x 	outb(0x02, tmport++);	/* 2*2=4ms,3EH 2/32*3E=3.9ms */x 	outb(0, tmport++);
 	outb(0, tmport++);
@@ -895,7 +1151,7 @@xx		if ((m & assignid_map) != 0)x{x 			continue;
x		}x-		tmport = dev->ioport + 0x0f;x+		tmport = dev->ioport[0] + 0x0f;x 		outb(0, tmport++);
x		tmport += 0x02;x 		outb(0, tmport++);
@@ -907,14 +1163614 @@xx			k = i;xx		}x 		outb(k, tmport++);
-		tmport = dev->ioport + 0x1b;x-		if (dev->chip_veru == 4)x{x+		tmport = dev->ioport[0] + 0x1b;x+		if (dev->chip_ver == 4)x{x 			outb(0x01, tmport);xx		} else {x 			outb(0x00, tmport);x 		}x wait_rdyok:
-		tmport = dev->ioport + 0x18;x+		tmport = dev->ioport[0] + 0x18;x 		outb(0x09, tmport);x 		tmport += 0x07;xxx@@ -925,22 +1181,22 @@xx			if ((k == 0x85) || (k == 0x42)) {x 				continue;
x			}
-			tmport = dev->ioport + 0x10;x+			tmport = dev->ioport[0] + 0x10;x 			outb(0x41, tmport);x 			goto wait_rdyok;xx		}x 		assignid_map |= m;x 
 	}
-	tmport = dev->ioport + 0x02;x+	tmport = dev->ioport[0] + 0x02;x 	outb(0x7f, tmport);x-	tmport = dev->ioport + 0x1b;x+	tmport = dev->ioport[0] + 0x1b;x 	outb(0x02, tmport);x x 	outb(0, 0x80);x x 	val = 0x0080;		/* bsy  */x-	tmport = dev->ioport + 0x1c;x+	tmport = dev->ioport[0] + 0x1c;x 	outw(val, tmport);x 	val |= 0x0040;		/* sel  */x 	outw(val, tmport);x@@ -984,7 +1240,7 @@xx	if ((inb(tmport) & 0x80) == 0x00) {	/* bsy ? */xx		outw(0, tmport--);x 		outb(0, tmport);
-		tmport = dev->ioport + 0x15;x+		tmport = dev->ioport[0] + 0x15;x 		outb(0, tmport);
x		tmport += 0x03;x 		outb(0x09, tmport);x@@ -1085,7 +1341,7 @@xxx }xxx-static void is870(struct Scsi_Host *host, unsigned int wkport)x+void is870(struct atp_unit *dev, unsigned int wkport)xx{x 	unsigned int tmport;x 	unsigned char i, j, k, rmb, n;x@@ -1097,26 +1353,25 @@xx	static unsigned char synu[6] = { 0x80, 1, 3, 1, 0x0c, 0x0e };xx	static unsigned char synw[6] = { 0x80, 1, 3, 1, 0x0c, 0x07 };xx	static unsigned char wide[6] = { 0x80, 1, 2, 3, 1, 0 };x-	struct atp_unit *devx= (struct atp_unit *)&host->hostdata;x-
+	xx	tmport = wkport + 0x3a;x 	outb((unsigned char) (inb(tmport) | 0x10), tmport);xxx 	for (i = 0; i < 16; i++)x{x-		if ((dev->chip_veru != 4)x&& (i > 7)) {x+		if ((dev->chip_ver != 4)x&& (i > 7)) {x 			break;xx		}x 		m = 1;
 		m = m << i;x-		if ((m & dev->active_idu) != 0)x{x+		if ((m & dev->active_id[0]) != 0)x{x 			continue;
x		}x-		if (i == dev->host_idu)x{x-			printk(KERN_INFO "         ID: %2d  Host Adapter\n", dev->host_idu);x+		if (i == dev->host_id[0]) {x+			printk(KERN_INFO "         ID: %2d  Host Adapter\n", dev->host_id[0]);x 			continue;
x		}x 		tmport = wkport + 0x1b;x-		if (dev->chip_veru == 4)x{x+		if (dev->chip_ver == 4)x{x 			outb(0x01, tmport);xx		} else {x 			outb(0x00, tmport);x@@ -1133,7 +1388,7 @@xx		tmport += 0x06;x 		outb(0, tmport);
x		tmport += 0x02;x-		outb(dev->id[i].devspu, tmport++);
+		outb(dev->id[0][i].devsp, tmport++);
x		outb(0, tmport++);
x		outb(satn[6], tmport++);
x		outb(satn[7], tmport++);
@@ -1152,7 +1407,7 @@xx			continue;
x		}x 		while (inb(tmport) != 0x8e);x-		dev->active_idu |= m;x+		dev->active_id[0] |= m;x 
 		tmport = wkport + 0x10;x 		outb(0x30, tmport);x@@ -1182,7 +1437,7 @@xx		tmport += 0x07;x 		outb(0, tmport);
x		tmport += 0x02;x-		outb(dev->id[i].devspu, tmport++);
+		outb(dev->id[0][i].devsp, tmport++);
x		outb(0, tmport++);
x		outb(inqd[6], tmport++);
x		outb(inqd[7], tmport++);
@@ -1196,7 +1451,7 @@xx		}x 		while (inb(tmport) != 0x8e);x 		tmport = wkport + 0x1b;x-		if (dev->chip_veru == 4)x{x+		if (dev->chip_ver == 4)x{x 			outb(0x00, tmport);x 		}x 		tmport = wkport + 0x18;
@@ -1236,16 +1491,16 @@xxinq_ok:
 		mbuf[36] = 0;
 		printk(KERN_INFO "         ID: %2d  %s\n", i, &mbuf[8]);x-		dev->id[i].devtypeu = mbuf[0];x+		dev->id[0][i].devtype = mbuf[0];xx		rmb = mbuf[1];xx		n = mbuf[7];x-		if (dev->chip_veru != 4)x{x+		if (dev->chip_ver != 4)x{x 			goto not_wide;xx		}x 		if ((mbuf[7] & 0x60) == 0) {xx			goto not_wide;xx		}x-		if ((dev->global_map & 0x20) == 0)x{x+		if ((dev->global_map[0] & 0x20) == 0)x{x 			goto not_wide;xx		}x 		tmport = wkport + 0x1b;x@@ -1260,7 +1515,7 @@xx		tmport += 0x06;x 		outb(0, tmport);
x		tmport += 0x02;x-		outb(dev->id[i].devspu, tmport++);
+		outb(dev->id[0][i].devsp, tmport++);
x		outb(0, tmport++);
x		outb(satn[6], tmport++);
x		outb(satn[7], tmport++);
@@ -1386,16 +1641,16 @@xx		}x 		m = 1;
 		m = m << i;x-		dev->wide_idu |= m;x+		dev->wide_id[0] |= m;x not_wide:x-		if ((dev->id[i].devtypeu == 0x00) || (dev->id[i].devtypeu == 0x07) || ((dev->id[i].devtypeu == 0x05)x&& ((n & 0x10) != 0))) {x+		if ((dev->id[0][i].devtype == 0x00) || (dev->id[0][i].devtype == 0x07) || ((dev->id[0][i].devtype == 0x05)x&& ((n & 0x10) != 0))) {x 			goto set_sync;xx		}x 		continue;
xset_sync:x 		tmport = wkport + 0x1b;x 		j = 0;x-		if ((m & dev->wide_idu) != 0)x{x+		if ((m & dev->wide_id[0]) != 0)x{x 			j |= 0x01;
x		}x 		outb(j, tmport);
@@ -1409,7 +1664,7 @@xx		tmport += 0x06;x 		outb(0, tmport);
x		tmport += 0x02;x-		outb(dev->id[i].devspu, tmport++);
+		outb(dev->id[0][i].devsp, tmport++);
x		outb(0, tmport++);
x		outb(satn[6], tmport++);
x		outb(satn[7], tmport++);
@@ -1434,10 +1689,10 @@xx		while ((inb(tmport) & 0x80) == 0)x{x 			if ((inb(tmport) & 0x01) != 0) {x 				tmport -= 0x06;x-				if ((m & dev->wide_idu) != 0)x{x+				if ((m & dev->wide_id[0]) != 0)x{x 					outb(synw[j++], tmport);xx				} else {x-					if ((m & dev->ultra_map) != 0)x{x+					if ((m & dev->ultra_map[0]) != 0)x{x 						outb(synu[j++], tmport);xx					} else {x 						outb(synn[j++], tmport);x@@ -1551,7 +1806,7 @@xx		if (mbuf[4] > 0x0c)x{x 			mbuf[4] = 0x0c;x 		}x-		dev->id[i].devspu = mbuf[4];x+		dev->id[0][i].devsp = mbuf[4];x 		if ((mbuf[3] < 0x0d)x&& (rmb == 0)) {x 			j = 0xa0;x 			goto set_syn_ok;x@@ -1570,13 +1825,13 @@xx		}x 		j = 0x60;
xset_syn_ok:
-		dev->id[i].devspu = (dev->id[i].devspu & 0x0f) | j;x+		dev->id[0][i].devsp = (dev->id[0][i].devsp & 0x0f) | j;x 	}
 	tmport = wkport + 0x3a;x 	outb((unsigned char) (inb(tmport) & 0xef), tmport);x }xxx-static void is880(struct Scsi_Host *host, unsigned int wkport)x+static void is880(struct atp_unit *dev, unsigned int wkport)xx{x 	unsigned int tmport;x 	unsigned char i, j, k, rmb, n, lvdmode;x@@ -1590,18 +1845,17 @@xx	unsigned char synuw[6] = { 0x80, 1, 3, 1, 0x0a, 0x0e };xx	static unsigned char wide[6] = { 0x80, 1, 2, 3, 1, 0 };xx	static unsigned char u3[9] = { 0x80, 1, 6, 4, 0x09, 00, 0x0e, 0x01, 0x02 };x-	struct atp_unit *devx= (struct atp_unit *)&host->hostdata;x 
 	lvdmode = inb(wkport + 0x3f) & 0x40;xxx 	for (i = 0; i < 16; i++)x{x 		m = 1;
 		m = m << i;x-		if ((m & dev->active_idu) != 0)x{x+		if ((m & dev->active_id[0]) != 0)x{x 			continue;
x		}x-		if (i == dev->host_idu)x{x-			printk(KERN_INFO "         ID: %2d  Host Adapter\n", dev->host_idu);x+		if (i == dev->host_id[0]) {x+			printk(KERN_INFO "         ID: %2d  Host Adapter\n", dev->host_id[0]);x 			continue;
x		}x 		tmport = wkport + 0x5b;x@@ -1618,7 +1872,7 @@xx		tmport += 0x06;x 		outb(0, tmport);
x		tmport += 0x02;x-		outb(dev->id[i].devspu, tmport++);
+		outb(dev->id[0][i].devsp, tmport++);
x		outb(0, tmport++);
x		outb(satn[6], tmport++);
x		outb(satn[7], tmport++);
@@ -1637,7 +1891,7 @@xx			continue;
x		}x 		while (inb(tmport) != 0x8e);x-		dev->active_idu |= m;x+		dev->active_id[0] |= m;x 
 		tmport = wkport + 0x50;x 		outb(0x30, tmport);x@@ -1667,7 +1921,7 @@xx		tmport += 0x07;x 		outb(0, tmport);
x		tmport += 0x02;x-		outb(dev->id[i].devspu, tmport++);
+		outb(dev->id[0][i].devsp, tmport++);
x		outb(0, tmport++);
x		outb(inqd[6], tmport++);
x		outb(inqd[7], tmport++);
@@ -1719,19 +1973,19 @@xxinq_ok:
 		mbuf[36] = 0;
 		printk(KERN_INFO "         ID: %2d  %s\n", i, &mbuf[8]);x-		dev->id[i].devtypeu = mbuf[0];x+		dev->id[0][i].devtype = mbuf[0];xx		rmb = mbuf[1];xx		n = mbuf[7];x 		if ((mbuf[7] & 0x60) == 0) {xx			goto not_wide;xx		}x-		if ((i < 8)x&& ((dev->global_map & 0x20) == 0))x{x+		if ((i < 8)x&& ((dev->global_map[0] & 0x20) == 0))x{x 			goto not_wide;xx		}x 		if (lvdmode == 0) {xx			goto chg_wide;xx		}x-		if (dev->sp[i] != 0x04)	// force u2x+		if (dev->sp[0][i] != 0x04)	// force u2x 		{xx			goto chg_wide;xx		}x@@ -1748,7 +2002,7 @@xx		tmport += 0x06;x 		outb(0, tmport);
x		tmport += 0x02;x-		outb(dev->id[i].devspu, tmport++);
+		outb(dev->id[0][i].devsp, tmport++);
x		outb(0, tmport++);
x		outb(satn[6], tmport++);
x		outb(satn[7], tmport++);
@@ -1872,8 +2126,8 @@xx		if (mbuf[3] == 0x09) {x 			m = 1;
 			m = m << i;x-			dev->wide_idu |= m;x-			dev->id[i].devspu = 0xce;x+			dev->wide_id[0] |= m;x+			dev->id[0][i].devsp = 0xce;xx			continue;
x		}x chg_wide:
@@ -1889,7 +2143,7 @@xx		tmport += 0x06;x 		outb(0, tmport);
x		tmport += 0x02;x-		outb(dev->id[i].devspu, tmport++);
+		outb(dev->id[0][i].devsp, tmport++);
x		outb(0, tmport++);
x		outb(satn[6], tmport++);
x		outb(satn[7], tmport++);
@@ -2015,29 +2269,29 @@xx		}x 		m = 1;
 		m = m << i;x-		dev->wide_idu |= m;x+		dev->wide_id[0] |= m;x not_wide:x-		if ((dev->id[i].devtypeu == 0x00) || (dev->id[i].devtypeu == 0x07) || ((dev->id[i].devtypeu == 0x05)x&& ((n & 0x10) != 0))) {x+		if ((dev->id[0][i].devtype == 0x00) || (dev->id[0][i].devtype == 0x07) || ((dev->id[0][i].devtype == 0x05)x&& ((n & 0x10) != 0))) {x 			m = 1;
 			m = m << i;x-			if ((dev->async & m) != 0)x{x+			if ((dev->async[0] & m) != 0)x{x 				goto set_sync;xx			}x 		}x 		continue;
xset_sync:x-		if (dev->sp[i] == 0x02)x{x+		if (dev->sp[0][i] == 0x02)x{x 			synu[4] = 0x0c;x 			synuw[4] = 0x0c;x 		} else {x-			if (dev->sp[i] >= 0x03)x{x+			if (dev->sp[0][i] >= 0x03)x{x 				synu[4] = 0x0a;x 				synuw[4] = 0x0a;x 			}
x		}x 		tmport = wkport + 0x5b;x 		j = 0;x-		if ((m & dev->wide_idu) != 0)x{x+		if ((m & dev->wide_id[0]) != 0)x{x 			j |= 0x01;
x		}x 		outb(j, tmport);
@@ -2051,7 +2305,7 @@xx		tmport += 0x06;x 		outb(0, tmport);
x		tmport += 0x02;x-		outb(dev->id[i].devspu, tmport++);
+		outb(dev->id[0][i].devsp, tmport++);
x		outb(0, tmport++);
x		outb(satn[6], tmport++);
x		outb(satn[7], tmport++);
@@ -2076,14 +2330,14 @@xx		while ((inb(tmport) & 0x80) == 0)x{x 			if ((inb(tmport) & 0x01) != 0) {x 				tmport -= 0x06;x-				if ((m & dev->wide_idu) != 0)x{x-					if ((m & dev->ultra_map) != 0)x{x+				if ((m & dev->wide_id[0]) != 0)x{x+					if ((m & dev->ultra_map[0]) != 0)x{x 						outb(synuw[j++], tmport);xx					} else {x 						outb(synw[j++], tmport);xx					}xx				} else {x-					if ((m & dev->ultra_map) != 0)x{x+					if ((m & dev->ultra_map[0]) != 0)x{x 						outb(synu[j++], tmport);xx					} else {x 						outb(synn[j++], tmport);x@@ -2197,7 +2451,7 @@xx		if (mbuf[4] > 0x0e)x{x 			mbuf[4] = 0x0e;x 		}x-		dev->id[i].devspu = mbuf[4];x+		dev->id[0][i].devsp = mbuf[4];x 		if (mbuf[3] < 0x0c) {x 			j = 0xb0;x 			goto set_syn_ok;x@@ -22206249 +2474,179 @@xx		}x 		j = 0x60;
xset_syn_ok:
-		dev->id[i].devspu = (dev->id[i].devspu & 0x0f) | j;x+		dev->id[0][i].devsp = (dev->id[0][i].devsp & 0x0f) | j;x 	}
 }xxx static void atp870u_free_tables(struct Scsi_Host *host)x {x 	struct atp_unit *atp_devx= (struct atp_unit *)&host->hostdata;x-	int k;x-
-	for (k = 0; k < 16; k++)x{x-		if (!atp_dev->id[k].prd_tableu)x-			continue;
-		pci_free_consistent(atp_dev->pdev, 1024, atp_dev->id[k].prd_tableu,x-					atp_dev->id[k].prd_phys);x-		atp_dev->id[k].prd_tableu = NULL;x+	int j, k;x+	for (j=0; j < 2; j++)x{x+		for (k = 0; k < 16; k++)x{x+			if (!atp_dev->id[j][k].prd_table)x+				continue;
+			pci_free_consistent(atp_dev->pdev, 1024, atp_dev->id[j][k].prd_table, atp_dev->id[j][k].prdaddr);x+			atp_dev->id[j][k].prd_table = NULL;x+		}x 	}
 }xxx static int atp870u_init_tables(struct Scsi_Host *host)x {x-	struct atp_unit *devx= (struct atp_unit *)&host->hostdata;x-	int k, i;x-
-	for (i = k = 0; k < 16; k++)x{x-		dev->id[k].prd_tableu = pci_alloc_consistent(dev->pdev, 1024, &dev->id[k].prd_phys);x-		if (!dev->id[k].prd_tableu) {x-			atp870u_free_tables(host);
-			return -ENOMEM;
-		}x-		dev->id[k].devspu = 0x20;x-		dev->id[k].devtypeu = 0;x-		dev->id[k].curr_req = NULL;x-	}x-	dev->active_idu = 0;x-	dev->wide_idu = 0;x-	dev->host_idu = 0x07;x-	dev->quhdu = 0;x-	dev->quendu = 0;
-	dev->chip_veru = 0;
-	dev->last_cmd = 0xff;x-	dev->in_snd = 0;x-	dev->in_int = 0;x-	for (k = 0; k < qcnt; k++)x{x-		dev->querequ[k] = NULL;x-	}x-	for (k = 0; k < 16; k++)x{x-		dev->id[k].curr_req = NULL;x-		dev->sp[k] = 0x04;x+	struct atp_unit *atp_devx= (struct atp_unit *)&host->hostdata;x+	int c,k;x+	for(c=0;c < 2;c++)x{x+	   	for(k=0;k<16;k++)x{x+	   			atp_dev->id[c][k].prd_table = pci_alloc_consistent(atp_dev->pdev, 1024, &(atp_dev->id[c][k].prdaddr));x+	   			if (!atp_dev->id[c][k].prd_table)x{x+	   				printk("atp870u_init_tables fail\n");
+				atp870u_free_tables(host);
+				return -ENOMEM;
+			}x+			atp_dev->id[c][k].devsp=0x20;x+			atp_dev->id[c][k].devtype = 0x7f;x+			atp_dev->id[c][k].curr_req = NULL;			   x+	   	}x+	   			x+	   	atp_dev->active_id[c] = 0;
+	   	atp_dev->wide_id[c] = 0;
+	   	atp_dev->host_id[c] = 0x07;x+	   	atp_dev->quhd[c] = 0;
+	   	atp_dev->quend[c] = 0;
+	   	atp_dev->last_cmd[c] = 0xff;
+	   	atp_dev->in_snd[c] = 0;
+	   	atp_dev->in_int[c] = 0;
+	   	x+	   	for (k = 0; k < qcnt; k++)x{x+	   		  atp_dev->quereq[c][k] = NULL;x+	   	}	   		   x+	   	for (k = 0; k < 16; k++)x{x+			   atp_dev->id[c][k].curr_req = NULL;x+			   atp_dev->sp[c][k] = 0x04;x+	   	}		   x 	}
 	return 0;x }xxx /* return non-zero on detection */x-static int atp870u_probe(struct pci_devx*dev, const struct pci_device_id *ent)x+static int atp870u_probe(struct pci_devx*pdev, const struct pci_device_id *ent)x {x-	unsigned char k, m;x+	unsigned char k, m, c;x 	unsigned long flags;x-	unsigned int base_io, error, tmport;x+	unsigned int base_io, tmport, error,n;x 	unsigned char host_id;x-	unsigned short n;x-	struct Scsi_Host *shpnt;x+	struct Scsi_Host *shpnt = NULL;x 	struct atp_unit atp_dev,x*p;x-	static int count;x-
-	if (pci_enable_device(dev))
+	unsigned char setupdata[2][16];x+	int count = 0;
+	x+	if (pci_enable_device(pdev))
 		return -EIO;x x-	if (pci_set_dma_mask(dev, 0xFFFFFFFFUL))x{x-		printk(KERN_ERR "atp870u: 32bit DMA mask required but not available.\n");
-		return -EIO;x-	}x-	
+        if (!pci_set_dma_mask(pdev, 0xFFFFFFUL))x{x+                printk(KERN_INFO "atp870u: use 32bit DMA mask.\n");
+        } else {x+                printk(KERN_ERR "atp870u: DMA mask required but not available.\n");
+                return -EIO;x+        }
+xx	memset(&atp_dev,x0, sizeof atp_dev);
- xx	/*xx	 * It's probably easier to weed out some revisions likexx	 * this than via the PCI device tablexx	 */x 	if (ent->device == PCI_DEVICE_ID_ARTOP_AEC7610)x{x-		error = pci_read_config_byte(dev, PCI_CLASS_REVISION, &atp_dev.chip_veru);x-		if (atp_dev.chip_veru < 2)x+		error = pci_read_config_byte(pdev, PCI_CLASS_REVISION, &atp_dev.chip_ver);x+		if (atp_dev.chip_ver < 2)x 			return -EIO;x 	}x xx	switch (ent->device)x{x-	case 0x8081:
 	case PCI_DEVICE_ID_ARTOP_AEC7612UW:
 	case PCI_DEVICE_ID_ARTOP_AEC7612SUW:
-		atp_dev.chip_veru = 0x04;x+	case ATP880_DEVID1:	x+	case ATP880_DEVID2:	x+	case ATP885_DEVID:	x+		atp_dev.chip_ver = 0x04;xx	default:
 		break;xx	}x+	base_io = pci_resource_start(pdev, 0);x+	base_io &= 0xfffffff8;
+	x+	if ((ent->device == ATP880_DEVID1)||(ent->device == ATP880_DEVID2))x{x+		error = pci_read_config_byte(pdev, PCI_CLASS_REVISION, &atp_dev.chip_ver);x+		pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x80);//JCC082803x x-	base_io = pci_resource_start(dev, 0);x-
-	if (ent->device != 0x8081)x{x-		error = pci_read_config_byte(dev, 0x49, &host_id);x-		base_io &= 0xfffffff8;
-x-		printk(KERN_INFO "   ACARD AEC-671X PCI Ultra/W SCSI-3 Host Adapter: %d "
-			"IO:%x, IRQ:%d.\n", count, base_io, dev->irq);x-
-		atp_dev.unit = count;	
-		atp_dev.ioport = base_io;x-		atp_dev.pciport = base_io + 0x20;x-		atp_dev.deviceid = ent->device;x-		host_id &= 0x07;x-		atp_dev.host_idu = host_id;x-		tmport = base_io + 0x22;x-		atp_dev.scam_on = inb(tmport);x-		tmport += 0x0b;x-		atp_dev.global_map = inb(tmport++);
-		atp_dev.ultra_map = inw(tmport);x-x-		if (atp_dev.ultra_map == 0)x{x-			atp_dev.scam_on = 0x00;x-			atp_dev.global_map = 0x20;x-			atp_dev.ultra_map = 0xffff;
-		}x-x-		shpnt = scsi_host_alloc(&atp870u_template, sizeof(struct atp_unit));x-		if (!shpnt)
-			return -ENOMEM;
-x-		px= (struct atp_unit *)&shpnt->hostdata;x-		x-		atp_dev.host = shpnt;x-		atp_dev.pdevx= dev;
-		pci_set_drvdata(dev, p);x-		memcpy(p, &atp_dev, sizeof atp_dev);
-		if (atp870u_init_tables(shpnt) < 0)x-			goto unregister;x-x-		if (request_irq(dev->irq, atp870u_intr_handle, SA_SHIRQ, "atp870u", shpnt))x{x-			printk(KERN_ERR "Unable to allocate IRQ%d for Acard controller.\n", dev->irq);x-			goto free_tables;
-		}x-x-		spin_lock_irqsave(shpnt->host_lock, flags);x-		if (atp_dev.chip_veru > 0x07) {	/* check if atp876 chip then enable terminator */x-			tmport = base_io + 0x3e;x-			outb(0x00, tmport);x-		}x- x-		tmport = base_io + 0x3a;x-		k = (inb(tmport) & 0xf3) | 0x10;x-		outb(k, tmport);x-		outb((k & 0xdf), tmport);x-		mdelay(32);x-		outb(k, tmport);x-		mdelay(32);x-		tmport = base_io;x-		outb((host_id | 0x08), tmport);
-		tmport += 0x18;x-		outb(0, tmport);
-		tmport += 0x07;x-		while ((inb(tmport) & 0x80) == 0)x-			mdelay(1);x-x-		tmport -= 0x08;x-		inb(tmport);x-		tmport = base_io + 1;x-		outb(8, tmport++);
-		outb(0x7f, tmport);x-		tmport = base_io + 0x11;
-		outb(0x20, tmport);x-x-		tscam(shpnt);x-		is870(shpnt, base_io);x-		tmport = base_io + 0x3a;x-		outb((inb(tmport) & 0xef), tmport);
-		tmport++;x-		outb((inb(tmport) | 0x20), tmport);x-	} else {x-		base_io &= 0xfffffff8;
 		host_id = inb(base_io + 0x39);
 		host_id >>= 0x04;xx
 		printk(KERN_INFO "   ACARD AEC-67160 PCI Ultra3 LVD Host Adapter: %d"
-			"    IO:%x, IRQ:%d.\n", count, base_io, dev->irq);x-		atp_dev.ioport = base_io + 0x40;x-		atp_dev.pciport = base_io + 0x28;x-		atp_dev.deviceid = ent->device;x-		atp_dev.host_idu = host_id;x+			"    IO:%x, IRQ:%d.\n", count, base_io, pdev->irq);x+		atp_dev.ioport[0] = base_io + 0x40;x+		atp_dev.pciport[0] = base_io + 0x28;x+		atp_dev.dev_id = ent->device;x+		atp_dev.host_id[0] = host_id;x 
 		tmport = base_io + 0x22;x 		atp_dev.scam_on = inb(tmport);xx		tmport += 0x13;x-		atp_dev.global_map = inb(tmport);x+		atp_dev.global_map[0] = inb(tmport);xx		tmport += 0x07;x-		atp_dev.ultra_map = inw(tmport);x+		atp_dev.ultra_map[0] = inw(tmport);x xx		n = 0x3f09;x-next_fblk:
+next_fblk_880:x 		if (n >= 0x4000)x-			goto flash_ok;x+			goto flash_ok_880;x xx		m = 0;
 		outw(n, base_io + 0x34);xx		n += 0x0002;xx		if (inb(base_io + 0x30) == 0xff)x-			goto flash_ok;x+			goto flash_ok_880;x x-		atp_dev.sp[m++] = inb(base_io + 0x30);x-		atp_dev.sp[m++] = inb(base_io + 0x31);x-		atp_dev.sp[m++] = inb(base_io + 0x32);x-		atp_dev.sp[m++] = inb(base_io + 0x33);x+		atp_dev.sp[0][m++] = inb(base_io + 0x30);x+		atp_dev.sp[0][m++] = inb(base_io + 0x31);x+		atp_dev.sp[0][m++] = inb(base_io + 0x32);x+		atp_dev.sp[0][m++] = inb(base_io + 0x33);
 		outw(n, base_io + 0x34);xx		n += 0x0002;x-		atp_dev.sp[m++] = inb(base_io + 0x30);x-		atp_dev.sp[m++] = inb(base_io + 0x31);x-		atp_dev.sp[m++] = inb(base_io + 0x32);x-		atp_dev.sp[m++] = inb(base_io + 0x33);x+		atp_dev.sp[0][m++] = inb(base_io + 0x30);x+		atp_dev.sp[0][m++] = inb(base_io + 0x31);x+		atp_dev.sp[0][m++] = inb(base_io + 0x32);x+		atp_dev.sp[0][m++] = inb(base_io + 0x33);
 		outw(n, base_io + 0x34);xx		n += 0x0002;x-		atp_dev.sp[m++] = inb(base_io + 0x30);x-		atp_dev.sp[m++] = inb(base_io + 0x31);x-		atp_dev.sp[m++] = inb(base_io + 0x32);x-		atp_dev.sp[m++] = inb(base_io + 0x33);x+		atp_dev.sp[0][m++] = inb(base_io + 0x30);x+		atp_dev.sp[0][m++] = inb(base_io + 0x31);x+		atp_dev.sp[0][m++] = inb(base_io + 0x32);x+		atp_dev.sp[0][m++] = inb(base_io + 0x33);
 		outw(n, base_io + 0x34);xx		n += 0x0002;x-		atp_dev.sp[m++] = inb(base_io + 0x30);x-		atp_dev.sp[m++] = inb(base_io + 0x31);x-		atp_dev.sp[m++] = inb(base_io + 0x32);x-		atp_dev.sp[m++] = inb(base_io + 0x33);x+		atp_dev.sp[0][m++] = inb(base_io + 0x30);x+		atp_dev.sp[0][m++] = inb(base_io + 0x31);x+		atp_dev.sp[0][m++] = inb(base_io + 0x32);x+		atp_dev.sp[0][m++] = inb(base_io + 0x33);
 		n += 0x0018;x-		goto next_fblk;x-flash_ok:x+		goto next_fblk_880;x+flash_ok_880:xx		outw(0, base_io + 0x34);x-		atp_dev.ultra_map = 0;x-		atp_dev.async = 0;x+		atp_dev.ultra_map[0] = 0;x+		atp_dev.async[0] = 0;
 		for (k = 0; k < 16; k++)x{x 			n = 1;
 			n = n << k;x-			if (atp_dev.sp[k] > 1)x{x-				atp_dev.ultra_map |= n;
+			if (atp_dev.sp[0][k] > 1)x{x+				atp_dev.ultra_map[0] |= n;x 			} else {x-				if (atp_dev.sp[k] == 0)x-					atp_dev.async |= n;
+				if (atp_dev.sp[0][k] == 0)x+					atp_dev.async[0] |= n;x  			}
x	 	}
-		atp_dev.async = ~(atp_dev.async);
-		outb(atp_dev.global_map, base_io + 0x35);x+		atp_dev.async[0] = ~(atp_dev.async[0]);x+		outb(atp_dev.global_map[0], base_io + 0x35);x  x 		shpnt = scsi_host_alloc(&atp870u_template, sizeof(struct atp_unit));x 		if (!shpnt)
@@ -2471,16 +2655,16 @@xx		px= (struct atp_unit *)&shpnt->hostdata;x x 		atp_dev.host = shpnt;x-		atp_dev.pdevx= dev;
-		pci_set_drvdata(dev, p);x+		atp_dev.pdevx= pdev;
+		pci_set_drvdata(pdev, p);x 		memcpy(p, &atp_dev, sizeof atp_dev);
 		if (atp870u_init_tables(shpnt) < 0)x{x 			printk(KERN_ERR "Unable to allocate tables for Acard controller\n");
 			goto unregister;xx		}x x-		if (request_irq(dev->irq, atp870u_intr_handle, SA_SHIRQ, "atp870u", shpnt))x{x- 			printk(KERN_ERR "Unable to allocate IRQ%d for Acard controller.\n", dev->irq);x+		if (request_irq(pdev->irq, atp870u_intr_handle, SA_SHIRQ, "atp880i", shpnt))x{x+ 			printk(KERN_ERR "Unable to allocate IRQ%d for Acard controller.\n", pdev->irq);x 			goto free_tables;
x		}x x@@ -2513,96 +2697,354 @@xx		outb(0x20, tmport);x x 		tscam(shpnt);x-		is880(shpnt, base_io);x+		is880(p, base_io);x 		tmport = base_io + 0x38;x 		outb(0xb0, tmport);
-	}x-
-	if (p->chip_veru == 4)x 		shpnt->max_id = 16;x-x-	shpnt->this_id = host_id;x-	shpnt->unique_id = base_io;x-	shpnt->io_port = base_io;x-	if (ent->device == 0x8081)x{x+		shpnt->this_id = host_id;x+		shpnt->unique_id = base_io;x+		shpnt->io_port = base_io;x 		shpnt->n_io_port = 0x60;	/* Number of bytes of I/O space used */x+		shpnt->irqx= pdev->irq;			x+	} else if (ent->device == ATP885_DEVID)x{	x+			printk(KERN_INFO "   ACARD AEC-67162 PCI Ultra3 LVD Host Adapter:  IO:%x, IRQ:%d.\n"x+			       , base_io, pdev->irq);x+        	x+		atp_dev.pdevx= pdev;	x+		atp_dev.dev_id  = ent->device;x+		atp_dev.baseport = base_io;x+		atp_dev.ioport[0] = base_io + 0x80;x+		atp_dev.ioport[1] = base_io + 0xc0;x+		atp_dev.pciport[0] = base_io + 0x40;x+		atp_dev.pciport[1] = base_io + 0x50;
+				x+		shpnt = scsi_host_alloc(&atp870u_template, sizeof(struct atp_unit));x+		if (!shpnt)
+			return -ENOMEM;
+        	x+		px= (struct atp_unit *)&shpnt->hostdata;x+        	x+		atp_dev.host = shpnt;x+		atp_dev.pdevx= pdev;
+		pci_set_drvdata(pdev, p);x+		memcpy(p, &atp_dev, sizeof(struct atp_unit));x+		if (atp870u_init_tables(shpnt) < 0)x+			goto unregister;x+			
+#ifdef ED_DBGP		x+	printk("request_irq() shpnt %p hostdata %p\n", shpnt, p);
+#endif	        x+		if (request_irq(pdev->irq, atp870u_intr_handle, SA_SHIRQ, "atp870u", shpnt))x{x+				printk(KERN_ERR "Unable to allocate IRQ for Acard controller.\n");x+			goto free_tables;
+		}x+		x+		spin_lock_irqsave(shpnt->host_lock, flags);        					x+        			x+		c=inb(base_io + 0x29);x+		outb((c | 0x04),base_io + 0x29);x+        	x+		n=0x1f80;x+next_fblk_885:x+		if (n >= 0x2000) {x+		   goto flash_ok_885;x+		}x+		outw(n,base_io + 0x3c);x+		if (inl(base_io + 0x38) == 0xffffffff) {x+		   goto flash_ok_885;x+		}x+		for (m=0; m < 2; m++)x{x+		    p->global_map[m]= 0;x+		    for (k=0; k < 4; k++)x{x+			outw(n++,base_io + 0x3c);x+			((unsigned long *)&setupdata[m][0])[k]=inl(base_io + 0x38);x+		    }x+		    for (k=0; k < 4; k++)x{x+			outw(n++,base_io + 0x3c);x+			((unsigned long *)&p->sp[m][0])[k]=inl(base_io + 0x38);x+		    }x+		    n += 8;x+		}x+		goto next_fblk_885;x+flash_ok_885:x+#ifdef ED_DBGPx+		printk( "Flash Read OK\n");
+#endif	x+		c=inb(base_io + 0x29);x+		outb((c & 0xfb),base_io + 0x29);x+		for (c=0;c < 2;c++)x{x+		    p->ultra_map[c]=0;x+		    p->async[c] = 0;
+		    for (k=0; k < 16; k++)x{x+			n=1;x+			n = n << k;x+			if (p->sp[c][k] > 1)x{x+			   p->ultra_map[c] |= n;
+			} else {x+			   if (p->sp[c][k] == 0)x{x+			      p->async[c] |= n;
+			   }x+			}x+		    }x+		    p->async[c] = ~(p->async[c]);x+x+		    if (p->global_map[c] == 0)x{x+		       k=setupdata[c][1];x+		       if ((k & 0x40) != 0)x+			  p->global_map[c] |= 0x20;x+		       k &= 0x07;x+		       p->global_map[c] |= k;x+		       if ((setupdata[c][2] & 0x04) != 0)x+			  p->global_map[c] |= 0x08;x+		       p->host_id[c] = setupdata[c][0] & 0x07;x+		    }x+		}x+x+		k = inb(base_io + 0x28) & 0x8f;x+		k |= 0x10;x+		outb(k, base_io + 0x28);x+		outb(0x80, base_io + 0x41);x+		outb(0x80, base_io + 0x51);x+		mdelay(100);x+		outb(0, base_io + 0x41);x+		outb(0, base_io + 0x51);x+		mdelay(1000);x+		inb(base_io + 0x9b);x+		inb(base_io + 0x97);x+		inb(base_io + 0xdb);x+		inb(base_io + 0xd7);x+		tmport = base_io + 0x80;x+		k=p->host_id[0];x+		if (k > 7)x+		   k = (k & 0x07) | 0x40;x+		k |= 0x08;x+		outb(k, tmport);x+		tmport += 0x18;x+		outb(0, tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0);
+		tmport -= 0x08;x+		inb(tmport);x+		tmport = base_io + 0x81;x+		outb(8, tmport++);
+		outb(0x7f, tmport);x+		tmport = base_io + 0x91;
+		outb(0x20, tmport);x+x+		tmport = base_io + 0xc0;x+		k=p->host_id[1];x+		if (k > 7)x+		   k = (k & 0x07) | 0x40;x+		k |= 0x08;x+		outb(k, tmport);x+		tmport += 0x18;x+		outb(0, tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0);
+		tmport -= 0x08;x+		inb(tmport);x+		tmport = base_io + 0xc1;x+		outb(8, tmport++);
+		outb(0x7f, tmport);x+		tmport = base_io + 0xd1;
+		outb(0x20, tmport);x+x+		tscam_885();
+		printk(KERN_INFO "   Scanning Channel A SCSI Device ...\n");x+		is885(p, base_io + 0x80, 0);
+		printk(KERN_INFO "   Scanning Channel B SCSI Device ...\n");x+		is885(p, base_io + 0xc0, 1);x+x+		k = inb(base_io + 0x28) & 0xcf;x+		k |= 0xc0;x+		outb(k, base_io + 0x28);x+		k = inb(base_io + 0x1f) | 0x80;x+		outb(k, base_io + 0x1f);x+		k = inb(base_io + 0x29) | 0x01;x+		outb(k, base_io + 0x29);x+#ifdef ED_DBGPx+		//printk("atp885: atp_host[0] 0x%p\n", atp_host[0]);
+#endif		x+		shpnt->max_id = 16;x+		shpnt->max_lun = (p->global_map[0] & 0x07) + 1;x+		shpnt->max_channel = 1;x+		shpnt->this_id = p->host_id[0];x+		shpnt->unique_id = base_io;x+		shpnt->io_port = base_io;x+		shpnt->n_io_port = 0xff;	/* Number of bytes of I/O space used */x+		shpnt->irqx= pdev->irq;
+				x 	} else {x+		error = pci_read_config_byte(pdev, 0x49, &host_id);x+
+		printk(KERN_INFO "   ACARD AEC-671X PCI Ultra/W SCSI-2/3 Host Adapter: %d "
+			"IO:%x, IRQ:%d.\n", count, base_io, pdev->irq);x+x+		atp_dev.ioport[0] = base_io;x+		atp_dev.pciport[0] = base_io + 0x20;x+		atp_dev.dev_id = ent->device;x+		host_id &= 0x07;x+		atp_dev.host_id[0] = host_id;x+		tmport = base_io + 0x22;x+		atp_dev.scam_on = inb(tmport);x+		tmport += 0x0b;x+		atp_dev.global_map[0] = inb(tmport++);
+		atp_dev.ultra_map[0] = inw(tmport);x+x+		if (atp_dev.ultra_map[0] == 0)x{x+			atp_dev.scam_on = 0x00;x+			atp_dev.global_map[0] = 0x20;x+			atp_dev.ultra_map[0] = 0xffff;
+		}x+x+		shpnt = scsi_host_alloc(&atp870u_template, sizeof(struct atp_unit));x+		if (!shpnt)
+			return -ENOMEM;
+x+		px= (struct atp_unit *)&shpnt->hostdata;x+		x+		atp_dev.host = shpnt;x+		atp_dev.pdevx= pdev;
+		pci_set_drvdata(pdev, p);x+		memcpy(p, &atp_dev, sizeof atp_dev);
+		if (atp870u_init_tables(shpnt) < 0)x+			goto unregister;x+x+		if (request_irq(pdev->irq, atp870u_intr_handle, SA_SHIRQ, "atp870i", shpnt))x{x+			printk(KERN_ERR "Unable to allocate IRQ%d for Acard controller.\n", pdev->irq);x+			goto free_tables;
+		}x+x+		spin_lock_irqsave(shpnt->host_lock, flags);x+		if (atp_dev.chip_ver > 0x07) {	/* check if atp876 chip then enable terminator */x+			tmport = base_io + 0x3e;x+			outb(0x00, tmport);x+		}x+ x+		tmport = base_io + 0x3a;x+		k = (inb(tmport) & 0xf3) | 0x10;x+		outb(k, tmport);x+		outb((k & 0xdf), tmport);x+		mdelay(32);x+		outb(k, tmport);x+		mdelay(32);x+		tmport = base_io;x+		outb((host_id | 0x08), tmport);
+		tmport += 0x18;x+		outb(0, tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0)x+			mdelay(1);x+
+		tmport -= 0x08;x+		inb(tmport);x+		tmport = base_io + 1;x+		outb(8, tmport++);
+		outb(0x7f, tmport);x+		tmport = base_io + 0x11;
+		outb(0x20, tmport);x+x+		tscam(shpnt);x+		is870(p, base_io);x+		tmport = base_io + 0x3a;x+		outb((inb(tmport) & 0xef), tmport);
+		tmport++;x+		outb((inb(tmport) | 0x20), tmport);x+		if (atp_dev.chip_ver == 4)x+			shpnt->max_id = 16;x+		else		x+			shpnt->max_id = 7;x+		shpnt->this_id = host_id;x+		shpnt->unique_id = base_io;x+		shpnt->io_port = base_io;x 		shpnt->n_io_port = 0x40;	/* Number of bytes of I/O space used */x-	}x-	shpnt->irqx= dev->irq;
-	spin_unlock_irqrestore(shpnt->host_lock, flags);x-	if (ent->device == 0x8081)x{x-		if (!request_region(base_io, 0x60, "atp870u"))x-			goto request_io_fail;x-	} else {x-		if (!request_region(base_io, 0x40, "atp870u"))x-			goto request_io_fail;x-	}x+		shpnt->irqx= pdev->irq;		x+	} x+		spin_unlock_irqrestore(shpnt->host_lock, flags);x+		if(ent->device==ATP885_DEVID)x{x+			if(!request_region(base_io, 0xff, "atp870u")) /* Register the IO ports that we use */x+				goto request_io_fail;x+		} else if((ent->device==ATP880_DEVID1)||(ent->device==ATP880_DEVID2))x{x+			if(!request_region(base_io, 0x60, "atp870u")) /* Register the IO ports that we use */x+				goto request_io_fail;x+		} else {x+			if(!request_region(base_io, 0x40, "atp870u")) /* Register the IO ports that we use */x+				goto request_io_fail;x+		}				x+		count++;x+		if (scsi_add_host(shpnt, &pdev->dev))x+			goto scsi_add_fail;x+		scsi_scan_host(shpnt);x+#ifdef ED_DBGP			x+		printk("atp870u_prob : exit\n");
+#endif		x+		return 0;x x-	count++;x-	if (scsi_add_host(shpnt, &dev->dev))x-		goto scsi_add_fail;x-	scsi_scan_host(shpnt);x-	return 0;x-  x scsi_add_fail:x-	if (ent->device == 0x8081)x+	printk("atp870u_prob:scsi_add_fail\n");x+	if(ent->device==ATP885_DEVID)x{x+		release_region(base_io, 0xff);x+	} else if((ent->device==ATP880_DEVID1)||(ent->device==ATP880_DEVID2))x{x 		release_region(base_io, 0x60);x-	elsex+	} else {x 		release_region(base_io, 0x40);
+	}
 request_io_fail:x-	free_irq(dev->irq, shpnt);x+	printk("atp870u_prob:request_io_fail\n");x+	free_irq(pdev->irq, shpnt);x free_tables:x+	printk("atp870u_prob:free_table\n");
 	atp870u_free_tables(shpnt);x unregister:x+	printk("atp870u_prob:unregister\n");
 	scsi_host_put(shpnt);x-	return -1;
+	return -1;		x }xxx /* The abort command does not leave the device in a clean state where
    it is available to be used again.  Until this gets worked out, we will
    leave it commented out.  */x x-static int atp870u_abort(struct scsi_cmnd * SCpnt)
+int atp870u_abort(struct scsi_cmnd * SCpnt)
 {x-	unsigned char j, k;x+	unsigned char  j, k, c;x 	struct scsi_cmnd *workrequ;x 	unsigned int tmport;x-	struct atp_unit *devx= (struct atp_unit *)&SCpnt->device->host->hostdata;x+	struct atp_unit *dev;	x+	struct Scsi_Host *host;x+	host = SCpnt->device->host;x x-	printk(KERN_DEBUG "working=%x last_cmd=%x ", dev->working, dev->last_cmd);x-	printk(" quhdu=%x quendu=%x ", dev->quhdu, dev->quendu);x-	tmport = dev->ioport;x-	for (j = 0; j < 0x17; j++)x{x+	devx= (struct atp_unit *)&host->hostdata;x+	c=SCpnt->device->channel;x+	printk(" atp870u: abort Channel = %x \n", c);x+	printk("working=%x last_cmd=%x ", dev->working[c], dev->last_cmd[c]);x+	printk(" quhdu=%x quendu=%x ", dev->quhd[c], dev->quend[c]);x+	tmport = dev->ioport[c];x+	for (j = 0; j < 0x18; j++)x{x 		printk(" r%2x=%2x", j, inb(tmport++));
 	}
-	tmport += 0x05;x+	tmport += 0x04;xx	printk(" r1c=%2x", inb(tmport));
 	tmport += 0x03;x-	printk(" r1f=%2x in_snd=%2x ", inb(tmport), dev->in_snd);x-	tmport = dev->pciport;x-	printk(" r20=%2x", inb(tmport));
+	printk(" r1f=%2x in_snd=%2x ", inb(tmport), dev->in_snd[c]);x+	tmport= dev->pciport[c];x+	printk(" d00=%2x", inb(tmport));
 	tmport += 0x02;x-	printk(" r22=%2x", inb(tmport));
-	tmport = dev->ioport + 0x3a;x-	printk(" r3a=%2x \n", inb(tmport));
-	tmport = dev->ioport + 0x3b;x-	printk(" r3b=%2x \n", inb(tmport));
-	for (j = 0; j < 16; j++)x{x-		if (dev->id[j].curr_req != NULL)x{x-			workrequ = dev->id[j].curr_req;x-			printk("\n que cdb= ");
-			for (k = 0; k < workrequ->cmd_len; k++)x{x-				printk(" %2x ", workrequ->cmnd[k]);
-			}x-			printk(" last_lenu= %lx ", dev->id[j].last_lenu);x+	printk(" d02=%2x", inb(tmport));
+	for(j=0;j<16;j++)x{x+	   if (dev->id[c][j].curr_req != NULL)x{x+		workrequ = dev->id[c][j].curr_req;
+		printk("\n que cdb= ");
+		for (k=0; k < workrequ->cmd_len; k++)x{x+		    printk(" %2x ",workrequ->cmnd[k]);
 		}x+		printk(" last_lenu= %x ",(unsigned int)dev->id[c][j].last_len);x+	   }
 	}
-	/* Sort of - the thing handles itself */x 	return SUCCESS;x }xxx-static const char *atp870u_info(struct Scsi_Host *notused)
+const char *atp870u_info(struct Scsi_Host *notused)
 {x 	static char buffer[128];xxx@@ -2611,17 +3053,21 @@xx	return buffer;x }xxx+int atp870u_set_info(char *buffer, int length, struct Scsi_Host *HBAptr)
+{
+	return -ENOSYS;x	/* Currently this is a no-op */x+}
+xx#define BLS buffer + len + sizex-static int atp870u_proc_info(struct Scsi_Host *HBAptr, char *buffer,x-		char **start, off_t offset, int length, int inout)
+int atp870u_proc_info(struct Scsi_Host *HBAptr, char *buffer, char **start, off_t offset, int length, int inout)
 {x 	static u8 buff[512];x 	int size = 0;
 	int len = 0;
 	off_t begin = 0;
 	off_t pos = 0;x-x-	if (inout)
+	x+	if (inout) 	
 		return -ENOSYS;x 	if (offset == 0)x{x 		memset(buff,x0, sizeof(buff));x@@ -2637,7 +3083,7 @@xx	size += sprintf(BLS, "                   IRQ: %d\n", HBAptr->irq);x 	len += size;xx	pos = begin + len;x-
+	xx	*start = buffer + (offset - begin);	/* Start of wanted data */x 	len -= (offset - begin);	/* Start slop */x 	if (len > length)x{x@@ -2646,15 +3092,15 @@xx	return (len);x }xxx-static int atp870u_biosparam(struct scsi_device *sdev,x-		struct block_device *dev, sector_t capacity, int *ip)x+x+static int atp870u_biosparam(struct scsi_device *disk, struct block_device *dev,x+			sector_t capacity, int *ip)xx{x 	int heads, sectors, cylinders;x x 	heads = 64;xx	sectors = 32;xx	cylindersx= (unsigned long)capacity / (heads * sectors);x-x 	if (cylindersx> 1024)x{x 		heads = 255;x 		sectors = 63;x@@ -2667,39 +3113,46 @@xx	return 0;x }xxx-static void atp870u_remove(struct pci_devx*pdev)
-{x-	struct atp_unit *atp_devx= pci_get_drvdata(pdev);x-	struct Scsi_Host *pshost = atp_dev->host;x-
+static void atp870u_remove (struct pci_devx*pdev)
+{	x+	struct atp_unit *devextx= pci_get_drvdata(pdev);x+	struct Scsi_Host *pshost = devext->host;x+	x+	
 	scsi_remove_host(pshost);x+	printk(KERN_INFO "free_irq : %d\n",pshost->irq);x 	free_irq(pshost->irq, pshost);x 	release_region(pshost->io_port, pshost->n_io_port);x+	printk(KERN_INFO "atp870u_free_tables : %p\n",pshost);
 	atp870u_free_tables(pshost);x+	printk(KERN_INFO "scsi_host_put : %p\n",pshost);
 	scsi_host_put(pshost);
-	pci_set_drvdata(pdev, NULL);x+	printk(KERN_INFO "pci_set_drvdata : %p\n",pdev);x+	pci_set_drvdata(pdev, NULL);	x }x-x MODULE_LICENSE("GPL");x x static struct scsi_host_template atp870u_template = {
-	.module			= THIS_MODULE,x-	.name			= "atp870u",x-	.proc_name		= "atp870u",x-	.proc_info		= atp870u_proc_info,x-	.info			= atp870u_info,x-	.queuecommand		= atp870u_queuecommand,x-	.eh_abort_handler	= atp870u_abort,x-	.bios_param		= atp870u_biosparam,x-	.can_queue		= qcnt,x-	.this_id		= 7,x-	.sg_tablesize		= ATP870U_SCATTER,x-	.cmd_per_lun		= ATP870U_CMDLUN,x-	.use_clustering		= ENABLE_CLUSTERING,x+     .module			= THIS_MODULE,x+     .name              	= "atp870u"		/* name */,x+     .proc_name			= "atp870u",x+     .proc_info			= atp870u_proc_info,x+     .info              	= atp870u_info		/* info */,x+     .queuecommand      	= atp870u_queuecommand	/* queuecommand */,x+     .eh_abort_handler  	= atp870u_abort		/* abort */,x+     .bios_param        	= atp870u_biosparam	/* biosparm */,x+     .can_queue         	= qcnt			/* can_queue */,x+     .this_id           	= 7			/* SCSI ID */,x+     .sg_tablesize      	= ATP870U_SCATTER	/*SG_ALL*/ /*SG_NONE*/,x+     .cmd_per_lun       	= ATP870U_CMDLUN		/* commands per lun */,x+     .use_clustering    	= ENABLE_CLUSTERING,x+     .max_sectors		= ATP870U_MAX_SECTORS,
 };xxx static struct pci_device_id atp870u_id_table[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_ARTOP, 0x8081)			  },x+	{ PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP885_DEVID)			  },x+	{ PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP880_DEVID1)			  },x+	{ PCI_DEVICE(PCI_VENDOR_ID_ARTOP, ATP880_DEVID2)			  },x 	{ PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_AEC7610)x   },x 	{ PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_AEC7612UW)  },x 	{ PCI_DEVICE(PCI_VENDOR_ID_ARTOP, PCI_DEVICE_ID_ARTOP_AEC7612U)   },x@@ -2712,7 +3165,7 @@xxx MODULE_DEVICE_TABLE(pci, atp870u_id_table);x x-static struct pci_driver atp870u_driver =x{	x+static struct pci_driver atp870u_driver =x{x 	.id_table	= atp870u_id_table,x 	.name		= "atp870u",x 	.probe		= atp870u_probe,x@@ -2721,12 +3174,686 @@xxx static int __init atp870u_init(void)
 {x-	return pci_module_init(&atp870u_driver);x+#ifdef ED_DBGP	x+	printk("atp870u_init: Entry\n");
+#endif	x+	return pci_register_driver(&atp870u_driver);x }xxx static void __exit atp870u_exit(void)
 {x+#ifdef ED_DBGP	x+	printk("atp870u_exit: Entry\n");
+#endifxx	pci_unregister_driver(&atp870u_driver);x+}
+x+void tscam_885(void)
+{
+	unsigned char i;x+x+	for (i = 0; i < 0x2; i++)x{x+		mdelay(300);
+	}
+	return;x+}
+x+
+x+void is885(struct atp_unit *dev, unsigned int wkport,unsigned char c)
+{
+	unsigned int tmport;x+	unsigned char i, j, k, rmb, n, lvdmode;x+	unsigned short int m;x+	static unsigned char mbuf[512];x+	static unsigned char satn[9] =	{0,x0, 0, 0, 0, 0, 0, 6, 6};x+	static unsigned char inqd[9] =	{0x12, 0, 0, 0, 0x24, 0, 0, 0x24, 6};x+	static unsigned char synn[6] =	{0x80, 1, 3, 1, 0x19, 0x0e};x+	unsigned char synu[6] =  {0x80, 1, 3, 1, 0x0a, 0x0e};x+	static unsigned char synw[6] =	{0x80, 1, 3, 1, 0x19, 0x0e};x+	unsigned char synuw[6] =  {0x80, 1, 3, 1, 0x0a, 0x0e};x+	static unsigned char wide[6] =	{0x80, 1, 2, 3, 1, 0};x+	static unsigned char u3[9] = { 0x80,1,6,4,0x09,00,0x0e,0x01,0x02 };x+x+	lvdmode=inb(wkport + 0x1b) >> 7;x+x+	for (i = 0; i < 16; i++)x{x+		m = 1;
+		m = m << i;x+		if ((m & dev->active_id[c]) != 0)x{x+			continue;
+		}x+		if (i == dev->host_id[c]) {x+			printk(KERN_INFO "         ID: %2d  Host Adapter\n", dev->host_id[c]);x+			continue;
+		}x+		tmport = wkport + 0x1b;
+		outb(0x01, tmport);x+		tmport = wkport + 0x01;
+		outb(0x08, tmport++);
+		outb(0x7f, tmport++);
+		outb(satn[0], tmport++);
+		outb(satn[1], tmport++);
+		outb(satn[2], tmport++);
+		outb(satn[3], tmport++);
+		outb(satn[4], tmport++);
+		outb(satn[5], tmport++);
+		tmport += 0x06;x+		outb(0, tmport);
+		tmport += 0x02;
+		outb(dev->id[c][i].devsp, tmport++);
+		x+		outb(0, tmport++);
+		outb(satn[6], tmport++);
+		outb(satn[7], tmport++);
+		j = i;x+		if ((j & 0x08) != 0)x{x+			j = (j & 0x07) | 0x40;x+		}
+		outb(j, tmport);
+		tmport += 0x03;
+		outb(satn[8], tmport);
+		tmport += 0x07;x+x+		while ((inb(tmport) & 0x80) == 0x00);
+		tmport -= 0x08;x+		if ((inb(tmport) != 0x11)x&& (inb(tmport) != 0x8e))x{x+			continue;
+		}x+		while (inb(tmport) != 0x8e);x+		dev->active_id[c] |= m;x+x+		tmport = wkport + 0x10;
+		outb(0x30, tmport);x+		tmport = wkport + 0x14;
+		outb(0x00, tmport);x+x+phase_cmd:x+		tmport = wkport + 0x18;
+		outb(0x08, tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0x00);
+		tmport -= 0x08;x+		j = inb(tmport);x+		if (j != 0x16)x{x+			tmport = wkport + 0x10;
+			outb(0x41, tmport);x+			goto phase_cmd;
+		}x+sel_ok:x+		tmport = wkport + 0x03;
+		outb(inqd[0], tmport++);
+		outb(inqd[1], tmport++);
+		outb(inqd[2], tmport++);
+		outb(inqd[3], tmport++);
+		outb(inqd[4], tmport++);
+		outb(inqd[5], tmport);
+		tmport += 0x07;x+		outb(0, tmport);
+		tmport += 0x02;
+		outb(dev->id[c][i].devsp, tmport++);
+		outb(0, tmport++);
+		outb(inqd[6], tmport++);
+		outb(inqd[7], tmport++);
+		tmport += 0x03;
+		outb(inqd[8], tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0x00);
+		tmport -= 0x08;x+		if ((inb(tmport) != 0x11)x&& (inb(tmport) != 0x8e))x{x+			continue;
+		}x+		while (inb(tmport) != 0x8e);x+		tmport = wkport + 0x1b;
+		outb(0x00, tmport);x+		tmport = wkport + 0x18;
+		outb(0x08, tmport);
+		tmport += 0x07;x+		j = 0;x+rd_inq_data:x+		k = inb(tmport);x+		if ((k & 0x01) != 0)x{x+			tmport -= 0x06;x+			mbuf[j++] = inb(tmport);x+			tmport += 0x06;x+			goto rd_inq_data;
+		}x+		if ((k & 0x80) == 0)x{x+			goto rd_inq_data;
+		}x+		tmport -= 0x08;x+		j = inb(tmport);x+		if (j == 0x16)x{x+			goto inq_ok;x+		}x+		tmport = wkport + 0x10;
+		outb(0x46, tmport);
+		tmport += 0x02;
+		outb(0, tmport++);
+		outb(0, tmport++);
+		outb(0, tmport++);
+		tmport += 0x03;
+		outb(0x08, tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0x00);
+		tmport -= 0x08;x+		if (inb(tmport) != 0x16)x{x+			goto sel_ok;x+		}x+inq_ok:x+		mbuf[36] = 0;
+		printk( KERN_INFO"         ID: %2d  %s\n", i, &mbuf[8]);x+		dev->id[c][i].devtype = mbuf[0];x+		rmb = mbuf[1];x+		n = mbuf[7];x+		if ((mbuf[7] & 0x60) == 0)x{x+			goto not_wide;
+		}x+		if ((i < 8)x&& ((dev->global_map[c] & 0x20) == 0))x{x+			goto not_wide;
+		}x+		if (lvdmode == 0)x{x+		   goto chg_wide;
+		}x+		if (dev->sp[c][i] != 0x04) {	// force u2x+		   goto chg_wide;
+		}x+x+		tmport = wkport + 0x1b;
+		outb(0x01, tmport);x+		tmport = wkport + 0x03;
+		outb(satn[0], tmport++);
+		outb(satn[1], tmport++);
+		outb(satn[2], tmport++);
+		outb(satn[3], tmport++);
+		outb(satn[4], tmport++);
+		outb(satn[5], tmport++);
+		tmport += 0x06;x+		outb(0, tmport);
+		tmport += 0x02;
+		outb(dev->id[c][i].devsp, tmport++);
+		outb(0, tmport++);
+		outb(satn[6], tmport++);
+		outb(satn[7], tmport++);
+		tmport += 0x03;
+		outb(satn[8], tmport);
+		tmport += 0x07;x+x+		while ((inb(tmport) & 0x80) == 0x00);
+		tmport -= 0x08;x+		if ((inb(tmport) != 0x11)x&& (inb(tmport) != 0x8e))x{x+			continue;
+		}x+		while (inb(tmport) != 0x8e);x+try_u3:x+		j = 0;x+		tmport = wkport + 0x14;
+		outb(0x09, tmport);
+		tmport += 0x04;
+		outb(0x20, tmport);x+		tmport += 0x07;x+x+		while ((inb(tmport) & 0x80) == 0)x{x+			if ((inb(tmport) & 0x01) != 0) {x+				tmport -= 0x06;x+				outb(u3[j++], tmport);x+				tmport += 0x06;x+			}
+		}x+		tmport -= 0x08;x+		while ((inb(tmport) & 0x80) == 0x00);
+		j = inb(tmport) & 0x0f;x+		if (j == 0x0f)x{x+			goto u3p_in;
+		}x+		if (j == 0x0a)x{x+			goto u3p_cmd;
+		}x+		if (j == 0x0e)x{x+			goto try_u3;
+		}x+		continue;
+u3p_out:x+		tmport = wkport + 0x18;
+		outb(0x20, tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0)x{x+			if ((inb(tmport) & 0x01) != 0) {x+				tmport -= 0x06;x+				outb(0, tmport);x+				tmport += 0x06;x+			}
+		}x+		tmport -= 0x08;x+		j = inb(tmport) & 0x0f;x+		if (j == 0x0f)x{x+			goto u3p_in;
+		}x+		if (j == 0x0a)x{x+			goto u3p_cmd;
+		}x+		if (j == 0x0e)x{x+			goto u3p_out;
+		}x+		continue;
+u3p_in:x+		tmport = wkport + 0x14;
+		outb(0x09, tmport);
+		tmport += 0x04;
+		outb(0x20, tmport);x+		tmport += 0x07;x+		k = 0;
+u3p_in1:x+		j = inb(tmport);x+		if ((j & 0x01) != 0)x{x+			tmport -= 0x06;x+			mbuf[k++] = inb(tmport);x+			tmport += 0x06;x+			goto u3p_in1;
+		}x+		if ((j & 0x80) == 0x00)x{x+			goto u3p_in1;
+		}x+		tmport -= 0x08;x+		j = inb(tmport) & 0x0f;x+		if (j == 0x0f)x{x+			goto u3p_in;
+		}x+		if (j == 0x0a)x{x+			goto u3p_cmd;
+		}x+		if (j == 0x0e)x{x+			goto u3p_out;
+		}x+		continue;
+u3p_cmd:x+		tmport = wkport + 0x10;
+		outb(0x30, tmport);x+		tmport = wkport + 0x14;
+		outb(0x00, tmport);x+		tmport += 0x04;
+		outb(0x08, tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0x00);
+		tmport -= 0x08;x+		j = inb(tmport);x+		if (j != 0x16)x{x+			if (j == 0x4e)x{x+				goto u3p_out;
+			}x+			continue;
+		}x+		if (mbuf[0] != 0x01)x{x+			goto chg_wide;
+		}x+		if (mbuf[1] != 0x06)x{x+			goto chg_wide;
+		}x+		if (mbuf[2] != 0x04) {x+			goto chg_wide;
+		}x+		if (mbuf[3] == 0x09)x{x+		   m = 1;
+		   m = m << i;x+		   dev->wide_id[c] |= m;x+		   dev->id[c][i].devsp = 0xce;x+#ifdef ED_DBGP		   x+		   printk("dev->id[%2d][%2d].devsp = %2x\n",c,i,dev->id[c][i].devsp);
+#endifx+		   continue;
+		}x+chg_wide:x+		tmport = wkport + 0x1b;
+		outb(0x01, tmport);x+		tmport = wkport + 0x03;
+		outb(satn[0], tmport++);
+		outb(satn[1], tmport++);
+		outb(satn[2], tmport++);
+		outb(satn[3], tmport++);
+		outb(satn[4], tmport++);
+		outb(satn[5], tmport++);
+		tmport += 0x06;x+		outb(0, tmport);
+		tmport += 0x02;
+		outb(dev->id[c][i].devsp, tmport++);
+		outb(0, tmport++);
+		outb(satn[6], tmport++);
+		outb(satn[7], tmport++);
+		tmport += 0x03;
+		outb(satn[8], tmport);
+		tmport += 0x07;x+x+		while ((inb(tmport) & 0x80) == 0x00);
+		tmport -= 0x08;x+		if ((inb(tmport) != 0x11)x&& (inb(tmport) != 0x8e))x{x+			continue;
+		}x+		while (inb(tmport) != 0x8e);x+try_wide:x+		j = 0;x+		tmport = wkport + 0x14;
+		outb(0x05, tmport);
+		tmport += 0x04;
+		outb(0x20, tmport);x+		tmport += 0x07;x+x+		while ((inb(tmport) & 0x80) == 0)x{x+			if ((inb(tmport) & 0x01) != 0) {x+				tmport -= 0x06;x+				outb(wide[j++], tmport);x+				tmport += 0x06;x+			}
+		}x+		tmport -= 0x08;x+		while ((inb(tmport) & 0x80) == 0x00);
+		j = inb(tmport) & 0x0f;x+		if (j == 0x0f)x{x+			goto widep_in;
+		}x+		if (j == 0x0a)x{x+			goto widep_cmd;
+		}x+		if (j == 0x0e)x{x+			goto try_wide;
+		}x+		continue;
+widep_out:x+		tmport = wkport + 0x18;
+		outb(0x20, tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0)x{x+			if ((inb(tmport) & 0x01) != 0) {x+				tmport -= 0x06;x+				outb(0, tmport);x+				tmport += 0x06;x+			}
+		}x+		tmport -= 0x08;x+		j = inb(tmport) & 0x0f;x+		if (j == 0x0f)x{x+			goto widep_in;
+		}x+		if (j == 0x0a)x{x+			goto widep_cmd;
+		}x+		if (j == 0x0e)x{x+			goto widep_out;
+		}x+		continue;
+widep_in:x+		tmport = wkport + 0x14;
+		outb(0xff, tmport);
+		tmport += 0x04;
+		outb(0x20, tmport);x+		tmport += 0x07;x+		k = 0;
+widep_in1:x+		j = inb(tmport);x+		if ((j & 0x01) != 0)x{x+			tmport -= 0x06;x+			mbuf[k++] = inb(tmport);x+			tmport += 0x06;x+			goto widep_in1;
+		}x+		if ((j & 0x80) == 0x00)x{x+			goto widep_in1;
+		}x+		tmport -= 0x08;x+		j = inb(tmport) & 0x0f;x+		if (j == 0x0f)x{x+			goto widep_in;
+		}x+		if (j == 0x0a)x{x+			goto widep_cmd;
+		}x+		if (j == 0x0e)x{x+			goto widep_out;
+		}x+		continue;
+widep_cmd:x+		tmport = wkport + 0x10;
+		outb(0x30, tmport);x+		tmport = wkport + 0x14;
+		outb(0x00, tmport);x+		tmport += 0x04;
+		outb(0x08, tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0x00);
+		tmport -= 0x08;x+		j = inb(tmport);x+		if (j != 0x16)x{x+			if (j == 0x4e)x{x+				goto widep_out;
+			}x+			continue;
+		}x+		if (mbuf[0] != 0x01)x{x+			goto not_wide;
+		}x+		if (mbuf[1] != 0x02)x{x+			goto not_wide;
+		}x+		if (mbuf[2] != 0x03)x{x+			goto not_wide;
+		}x+		if (mbuf[3] != 0x01)x{x+			goto not_wide;
+		}x+		m = 1;
+		m = m << i;x+		dev->wide_id[c] |= m;x+not_wide:x+		if ((dev->id[c][i].devtype == 0x00)x|| (dev->id[c][i].devtype == 0x07) ||x+		    ((dev->id[c][i].devtype == 0x05)x&& ((n & 0x10) != 0)))x{x+			m = 1;
+			m = m << i;x+			if ((dev->async[c] & m) != 0)x{x+			   goto set_sync;x+			}
+		}x+		continue;
+set_sync:x+		if (dev->sp[c][i] == 0x02)x{x+		   synu[4]=0x0c;x+		   synuw[4]=0x0c;x+		} else {x+		   if (dev->sp[c][i] >= 0x03)x{x+		      synu[4]=0x0a;x+		      synuw[4]=0x0a;x+		   }
+		}x+		tmport = wkport + 0x1b;
+		j = 0;x+		if ((m & dev->wide_id[c]) != 0)x{x+			j |= 0x01;x+		}
+		outb(j, tmport);
+		tmport = wkport + 0x03;
+		outb(satn[0], tmport++);
+		outb(satn[1], tmport++);
+		outb(satn[2], tmport++);
+		outb(satn[3], tmport++);
+		outb(satn[4], tmport++);
+		outb(satn[5], tmport++);
+		tmport += 0x06;x+		outb(0, tmport);
+		tmport += 0x02;
+		outb(dev->id[c][i].devsp, tmport++);
+		outb(0, tmport++);
+		outb(satn[6], tmport++);
+		outb(satn[7], tmport++);
+		tmport += 0x03;
+		outb(satn[8], tmport);
+		tmport += 0x07;x+x+		while ((inb(tmport) & 0x80) == 0x00);
+		tmport -= 0x08;x+		if ((inb(tmport) != 0x11)x&& (inb(tmport) != 0x8e))x{x+			continue;
+		}x+		while (inb(tmport) != 0x8e);x+try_sync:x+		j = 0;x+		tmport = wkport + 0x14;
+		outb(0x06, tmport);
+		tmport += 0x04;
+		outb(0x20, tmport);x+		tmport += 0x07;x+x+		while ((inb(tmport) & 0x80) == 0)x{x+			if ((inb(tmport) & 0x01) != 0) {x+				tmport -= 0x06;x+				if ((m & dev->wide_id[c]) != 0)x{x+					if ((m & dev->ultra_map[c]) != 0)x{x+						outb(synuw[j++], tmport);x+					} else {x+						outb(synw[j++], tmport);x+					}x+				} else {x+					if ((m & dev->ultra_map[c]) != 0)x{x+						outb(synu[j++], tmport);x+					} else {x+						outb(synn[j++], tmport);x+					}x+				}x+				tmport += 0x06;x+			}
+		}x+		tmport -= 0x08;x+		while ((inb(tmport) & 0x80) == 0x00);
+		j = inb(tmport) & 0x0f;x+		if (j == 0x0f)x{x+			goto phase_ins;
+		}x+		if (j == 0x0a)x{x+			goto phase_cmds;
+		}x+		if (j == 0x0e)x{x+			goto try_sync;x+		}x+		continue;
+phase_outs:x+		tmport = wkport + 0x18;
+		outb(0x20, tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0x00)x{x+			if ((inb(tmport) & 0x01) != 0x00)x{x+				tmport -= 0x06;x+				outb(0x00, tmport);x+				tmport += 0x06;x+			}
+		}x+		tmport -= 0x08;x+		j = inb(tmport);x+		if (j == 0x85)x{x+			goto tar_dcons;x+		}x+		j &= 0x0f;x+		if (j == 0x0f)x{x+			goto phase_ins;
+		}x+		if (j == 0x0a)x{x+			goto phase_cmds;
+		}x+		if (j == 0x0e)x{x+			goto phase_outs;x+		}x+		continue;
+phase_ins:x+		tmport = wkport + 0x14;
+		outb(0x06, tmport);
+		tmport += 0x04;
+		outb(0x20, tmport);x+		tmport += 0x07;x+		k = 0;
+phase_ins1:x+		j = inb(tmport);x+		if ((j & 0x01) != 0x00)x{x+			tmport -= 0x06;x+			mbuf[k++] = inb(tmport);x+			tmport += 0x06;x+			goto phase_ins1;
+		}x+		if ((j & 0x80) == 0x00)x{x+			goto phase_ins1;
+		}x+		tmport -= 0x08;x+		while ((inb(tmport) & 0x80) == 0x00);
+		j = inb(tmport);x+		if (j == 0x85)x{x+			goto tar_dcons;x+		}x+		j &= 0x0f;x+		if (j == 0x0f)x{x+			goto phase_ins;
+		}x+		if (j == 0x0a)x{x+			goto phase_cmds;
+		}x+		if (j == 0x0e)x{x+			goto phase_outs;x+		}x+		continue;
+phase_cmds:x+		tmport = wkport + 0x10;
+		outb(0x30, tmport);x+tar_dcons:x+		tmport = wkport + 0x14;
+		outb(0x00, tmport);x+		tmport += 0x04;
+		outb(0x08, tmport);
+		tmport += 0x07;x+		while ((inb(tmport) & 0x80) == 0x00);
+		tmport -= 0x08;x+		j = inb(tmport);x+		if (j != 0x16)x{x+			continue;
+		}x+		if (mbuf[0] != 0x01)x{x+			continue;
+		}x+		if (mbuf[1] != 0x03)x{x+			continue;
+		}x+		if (mbuf[4] == 0x00)x{x+			continue;
+		}x+		if (mbuf[3] > 0x64)x{x+			continue;
+		}x+		if (mbuf[4] > 0x0e)x{x+			mbuf[4] = 0x0e;
+		}x+		dev->id[c][i].devsp = mbuf[4];x+		if (mbuf[3] < 0x0c){x+			j = 0xb0;x+			goto set_syn_ok;x+		}x+		if ((mbuf[3] < 0x0d)x&& (rmb == 0))x{x+			j = 0xa0;x+			goto set_syn_ok;x+		}x+		if (mbuf[3] < 0x1a)x{x+			j = 0x20;x+			goto set_syn_ok;x+		}x+		if (mbuf[3] < 0x33)x{x+			j = 0x40;x+			goto set_syn_ok;x+		}x+		if (mbuf[3] < 0x4c)x{x+			j = 0x50;x+			goto set_syn_ok;x+		}x+		j = 0x60;x+	      set_syn_ok:x+		dev->id[c][i].devsp = (dev->id[c][i].devsp & 0x0f) | j;
+#ifdef ED_DBGP		x+		printk("dev->id[%2d][%2d].devsp = %2x\n",c,i,dev->id[c][i].devsp);
+#endifx+	}x+	tmport = wkport + 0x16;x+	outb(0x80, tmport);x }xxx module_init(atp870u_init);xdiff -Nru a/drivers/scsi/atp870u.h b/drivers/scsi/atp870u.h
--- a/drivers/scsi/atp870u.h	2004-06-20 08:42:00 -07:00
+++ b/drivers/scsi/atp870u.h	2005-03-05 08:14:06 -08:00
@@ -2,50 +2,64 @@xx#define _ATP870U_Hxxx #include <linux/types.h>
+#include <linux/kdev_t.h>
xx /* I/O Port */x x-#define MAX_CDB		12x-#define MAX_SENSE	14x-#define qcnt		32x-#define ATP870U_SCATTER 128x-#define ATP870U_CMDLUN 	1x-x-struct atp_unit {x-	unsigned long ioport;x-	unsigned long pciport;x-	unsigned char last_cmd;x-	unsigned char in_snd;x-	unsigned char in_int;x-	unsigned char quhdu;x-	unsigned char quendu;
+#define MAX_CDB 	12x+#define MAX_SENSE 	14x+#define qcnt	       	32x+#define ATP870U_SCATTER 	128x+#define ATP870U_CMDLUN  	1x+x+#define MAX_ADAPTER	8x+#define MAX_SCSI_ID	16x+#define ATP870U_MAX_SECTORS 128x+x+#define ATP885_DEVID 0x808Ax+#define ATP880_DEVID1 0x8080x+#define ATP880_DEVID2 0x8081x+x+//#define ED_DBGPx+x+struct atp_unit
+{
+	unsigned long baseport;
+	unsigned long ioport[2];x+	unsigned long pciport[2];x+	unsigned long irq;
+	unsigned char last_cmd[2];x+	unsigned char in_snd[2];x+	unsigned char in_int[2];x+	unsigned char quhd[2];x+	unsigned char quend[2];x+	unsigned char global_map[2];x+	unsigned char chip_ver;x 	unsigned char scam_on;x-	unsigned char global_map;x-	unsigned char chip_veru;x-	unsigned char host_idu;x-	volatile int working;x-	unsigned short wide_idu;x-	unsigned short active_idu;x-	unsigned short ultra_map;x-	unsigned short async;x-	unsigned short deviceid;x-	unsigned char ata_cdbu[16];x-	unsigned char sp[16];x-	struct scsi_cmnd *querequ[qcnt];x-	struct atp_idx{x-		unsigned char dirctu;x-		unsigned char devspu;x-		unsigned char devtypeu;x-		unsigned long prdaddru;x-		unsigned long tran_lenu;x-		unsigned long last_lenu;x-		unsigned char *prd_posu;x-		unsigned char *prd_tableu;x-		dma_addr_t prd_phys;x+	unsigned char host_id[2];x+	unsigned int working[2];x+	unsigned short wide_id[2];x+	unsigned short active_id[2];x+	unsigned short ultra_map[2];x+	unsigned short async[2];x+	unsigned short dev_id;x+	unsigned char sp[2][16];x+	unsigned char r1f[2][16];		x+	struct scsi_cmnd *quereq[2][qcnt];x+	struct atp_idx+	{x+		unsigned char dirct;x+		unsigned char devsp;x+		unsigned char devtype;x+		unsigned long tran_len;x+		unsigned long last_len;x+		unsigned char *prd_pos;x+		unsigned char *prd_table;x+		dma_addr_t prdaddr;x 		struct scsi_cmnd *curr_req;x-	} id[16];x-	struct Scsi_Host *host;x-	struct pci_devx*pdev;x+	} id[2][16];x+    	struct Scsi_Host *host;x+    	struct pci_devx*pdev;x 	unsigned int unit;
 };xxxdiff -Nru a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
--- a/drivers/scsi/hosts.c	2005-01-18 11:15:06 -08:00
+++ b/drivers/scsi/hosts.c	2005-03-07 20:41:36 -08:00
@@ -247,6 +247,16 @@xx	shost->cmd_per_lun = sht->cmd_per_lun;xx	shost->unchecked_isa_dma = sht->unchecked_isa_dma;xx	shost->use_clustering = sht->use_clustering;x+	shost->ordered_flush = sht->ordered_flush;x+	shost->ordered_tag = sht->ordered_tag;x+x+	/*x+	 * hosts/devices that do queueing must support ordered tagsx+	 */x+	if (shost->can_queue > 1x&& shost->ordered_flush)x{x+		printk(KERN_ERR "scsi: ordered flushes don't support queueing\n");x+		shost->ordered_flush = 0;
+	}
 x 	if (sht->max_host_blocked)
 		shost->max_host_blocked = sht->max_host_blocked;xdiff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c	2005-02-23 11:47:04 -08:00
+++ b/drivers/scsi/libata-core.c	2005-03-06 22:52:11 -08:00
@@ -3884,26 +3884,22 @@xx		ap = host_set->ports[i];x x 		ata_scsi_release(ap->host);
-		scsi_host_put(ap->host);
-	}x-x-	pci_release_regions(pdev);x-
-	for (i = 0; i < host_set->n_ports; i++)x{x-		struct ata_ioports *ioaddr;x-
-		ap = host_set->ports[i];x-		ioaddr = &ap->ioaddr;x x 		if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0)x{x+			struct ata_ioports *ioaddr = &ap->ioaddr;x+x 			if (ioaddr->cmd_addr == 0x1f0)
 				release_region(0x1f0, 8);
 			else if (ioaddr->cmd_addr == 0x170)
 				release_region(0x170, 8);
 		}x+x+		scsi_host_put(ap->host);
 	}
 x 	kfree(host_set);x+x+	pci_release_regions(pdev);xx	pci_disable_device(pdev);xx	dev_set_drvdata(dev, NULL);x }xdiff -Nru a/drivers/scsi/osst.c b/drivers/scsi/osst.c
--- a/drivers/scsi/osst.c	2005-01-28 09:14:29 -08:00
+++ b/drivers/scsi/osst.c	2005-03-07 20:41:21 -08:00
@@ -4318,7 +4318,13 @@xx	int		      devx = TAPE_NR(inode);x 	int		      mode = TAPE_MODE(inode);x x-	nonseekable_open(inode, filp);x+	/*x+	 * We really want to do nonseekable_open(inode, filp); here, but somex+	 * versions of tar incorrectly call lseek on tapes and bail out if thatx+	 * fails.  So we disallow pread() and pwrite(), but permit lseeks.x+	 */x+	filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);x+x 	write_lock(&os_scsi_tapes_lock);x 	if (devx>= osst_max_devx|| os_scsi_tapes == NULL ||x 	    (STp = os_scsi_tapes[dev]) == NULL || !STp->device)x{xdiff -Nru a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
--- a/drivers/scsi/qla2xxx/qla_os.c	2005-02-07 18:25:11 -08:00
+++ b/drivers/scsi/qla2xxx/qla_os.c	2005-03-02 23:17:58 -08:00
@@ -1847,13 +1847,13 @@xx		if (pio_len < MIN_IOBASE_LEN)x{x 			qla_printk(KERN_WARNING, ha,x 			    "InvalidxPCI I/O region size (%s)...\n",x-			    ha->pdev->slot_name);x+				pci_name(ha->pdev));
 			pio = 0;
 		}x 	} else {x 		qla_printk(KERN_WARNING, ha,x 		    "region #0 not a PIO resource (%s)...\n",x-		    ha->pdev->slot_name);x+		    pci_name(ha->pdev));
 		pio = 0;
 	}xxx@@ -1865,20 +1865,20 @@xx	if (!(mmio_flags & IORESOURCE_MEM))x{x 		qla_printk(KERN_ERR, ha,x 		    "region #0 not an MMIO resource (%s), aborting\n",x-		    ha->pdev->slot_name);x+		    pci_name(ha->pdev));
 		goto iospace_error_exit;
 	}xx	if (mmio_len < MIN_IOBASE_LEN)x{x 		qla_printk(KERN_ERR, ha,x 		    "InvalidxPCI mem region size (%s), aborting\n",x-		    ha->pdev->slot_name);x+			pci_name(ha->pdev));
 		goto iospace_error_exit;
 	}xxxx	if (pci_request_regions(ha->pdev, ha->brd_info->drv_name)) {x 		qla_printk(KERN_WARNING, ha,x-		    "Failed to reserve PIO/MMIO regions (%s)\n", x-		    ha->pdev->slot_name);x+		    "Failed to reserve PIO/MMIO regions (%s)\n",x+		    pci_name(ha->pdev));
 
 		goto iospace_error_exit;
 	}x@@ -1888,7 +1888,7 @@xx	ha->iobase = ioremap(mmio, MIN_IOBASE_LEN);x 	if (!ha->iobase)x{x 		qla_printk(KERN_ERR, ha,x-		    "cannot remap MMIO (%s), aborting\n", ha->pdev->slot_name);x+		    "cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev));
 
 		goto iospace_error_exit;
 	}xdiff -Nru a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c
--- a/drivers/scsi/sata_nv.c	2005-02-17 16:43:51 -08:00
+++ b/drivers/scsi/sata_nv.c	2005-03-07 20:41:36 -08:00
@@ -99,7 +99,8 @@xx#define NV_MCP_SATA_CFG_20_SATA_SPACE_EN	0x04xxx static int nv_init_one (struct pci_devx*pdev, const struct pci_device_id *ent);x-irqreturn_t nv_interrupt (int irq, void *dev_instance, struct pt_regs *regs);x+static irqreturn_t nv_interrupt (int irq, void *dev_instance,x+				 struct pt_regs *regs);x static u32 nv_scr_read (struct ata_port *ap, unsigned int sc_reg);x static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val);x static void nv_host_stop (struct ata_host_set *host_set);x@@ -205,6 +206,7 @@xx	.dma_boundary		= ATA_DMA_BOUNDARY,x 	.slave_configure	= ata_scsi_slave_config,x 	.bios_param		= ata_std_bios_param,x+	.ordered_flush		= 1,
 };xxx static struct ata_port_operations nv_ops =x{x@@ -257,7 +259,8 @@xxMODULE_DEVICE_TABLE(pci, nv_pci_tbl);x MODULE_VERSION(DRV_VERSION);x x-irqreturn_t nv_interrupt (int irq, void *dev_instance, struct pt_regs *regs)x+static irqreturn_t nv_interrupt (int irq, void *dev_instance,x+				 struct pt_regs *regs)
 {x 	struct ata_host_set *host_set = dev_instance;x 	struct nv_host *host = host_set->private_data;
diff -Nru a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
--- a/drivers/scsi/sata_promise.c	2005-02-13 16:58:01 -08:00
+++ b/drivers/scsi/sata_promise.c	2005-03-07 20:41:36 -08:00
@@ -102,6 +102,7 @@xx	.dma_boundary		= ATA_DMA_BOUNDARY,x 	.slave_configure	= ata_scsi_slave_config,x 	.bios_param		= ata_std_bios_param,x+	.ordered_flush		= 1,
 };xxx static struct ata_port_operations pdc_ata_ops =x{xdiff -Nru a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
--- a/drivers/scsi/sata_qstor.c	2005-02-16 17:25:01 -08:00
+++ b/drivers/scsi/sata_qstor.c	2005-02-28 08:19:31 -08:00
@@ -38,7 +38,7 @@xx#include <linux/libata.h>
xx #define DRV_NAME	"sata_qstor"x-#define DRV_VERSION	"0.03"x+#define DRV_VERSION	"0.04"
xx enum {x 	QS_PORTS		= 4,x@@ -120,6 +120,7 @@xxstatic void qs_bmdma_stop(struct ata_port *ap);x static u8 qs_bmdma_status(struct ata_port *ap);x static void qs_irq_clear(struct ata_port *ap);x+static void qs_eng_timeout(struct ata_port *ap);x x static Scsi_Host_Template qs_ata_sht =x{x 	.module			= THIS_MODULE,x@@ -152,7 +153,7 @@xx	.phy_reset		= qs_phy_reset,x 	.qc_prep		= qs_qc_prep,x 	.qc_issue		= qs_qc_issue,x-	.eng_timeout		= ata_eng_timeout,x+	.eng_timeout		= qs_eng_timeout,x 	.irq_handler		= qs_intr,x 	.irq_clear		= qs_irq_clear,x 	.scr_read		= qs_scr_read,x@@ -212,7 +213,7 @@xx	/* nothing */x }xxx-static void qs_enter_reg_mode(struct ata_port *ap)x+static inline void qs_enter_reg_mode(struct ata_port *ap)xx{x 	u8 __iomem *chan = ap->host_set->mmio_base + (ap->port_no * 0x4000);
xx@@ -220,17 +221,34 @@xx	readb(chan + QS_CCT_CTR0);        /* flush */x }xxx-static void qs_phy_reset(struct ata_port *ap)x+static inline void qs_reset_channel_logic(struct ata_port *ap)xx{x 	u8 __iomem *chan = ap->host_set->mmio_base + (ap->port_no * 0x4000);
-	struct qs_port_privx*pp = ap->private_data;
 x-	pp->state = qs_state_idle;x 	writeb(QS_CTR1_RCHN, chan + QS_CCT_CTR1);
+	readb(chan + QS_CCT_CTR0);        /* flush */x 	qs_enter_reg_mode(ap);x+}x+x+static void qs_phy_reset(struct ata_port *ap)x+{x+	struct qs_port_privx*pp = ap->private_data;
+x+	pp->state = qs_state_idle;x+	qs_reset_channel_logic(ap);x 	sata_phy_reset(ap);x }xxx+static void qs_eng_timeout(struct ata_port *ap)x+{x+	struct qs_port_privx*pp = ap->private_data;
+x+	if (pp->state != qs_state_idle) /* healthy paranoia */x+		pp->state = qs_state_mmio;x+	qs_reset_channel_logic(ap);x+	ata_eng_timeout(ap);x+}x+x static u32 qs_scr_read (struct ata_port *ap, unsigned int sc_reg)xx{x 	if (sc_reg > SCR_CONTROL)x@@ -261,11 +279,11 @@xx		u32 len;x x 		addr = sg_dma_address(sg);
-		*(u64 *)prd = cpu_to_le64(addr);x+		*(__le64 *)prd = cpu_to_le64(addr);x 		prd += sizeof(u64);
 
 		len = sg_dma_len(sg);
-		*(u32 *)prd = cpu_to_le32(len);x+		*(__le32 *)prd = cpu_to_le32(len);x 		prd += sizeof(u64);
 
 		VPRINTK("PRD[%u] = (0x%llX, 0x%X)\n", nelem,x@@ -298,10 +316,10 @@xx	/* host control block (HCB) */x 	buf[ 0] = QS_HCB_HDR;x 	buf[ 1] = hflags;
-	*(u32 *)(&buf[ 4]) = cpu_to_le32(qc->nsect * ATA_SECT_SIZE);
-	*(u32 *)(&buf[ 8]) = cpu_to_le32(qc->n_elem);x+	*(__le32 *)(&buf[ 4]) = cpu_to_le32(qc->nsect * ATA_SECT_SIZE);
+	*(__le32 *)(&buf[ 8]) = cpu_to_le32(qc->n_elem);x 	addr = ((u64)pp->pkt_dma) + QS_CPB_BYTES;
-	*(u64 *)(&buf[16]) = cpu_to_le64(addr);x+	*(__le64 *)(&buf[16]) = cpu_to_le64(addr);x xx	/* device control block (DCB) */x 	buf[24] = QS_DCB_HDR;x@@ -566,10 +584,10 @@xx	int rc, have_64bit_busx= (bus_info & QS_HPHY_64BIT);x xx	if (have_64bit_busx&&
-	    !pci_set_dma_mask(pdev, 0xffffffffffffffffULL))x{x-		rcx= pci_set_consistent_dma_mask(pdev, 0xffffffffffffffffULL);x+	    !pci_set_dma_mask(pdev, DMA_64BIT_MASK))x{x+		rcx= pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK);xx		if (rc)x{x-			rcx= pci_set_consistent_dma_mask(pdev, 0xffffffffULL);x+			rcx= pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);xx			if (rc)x{x 				printk(KERN_ERR DRV_NAMEx 					"(%s): 64-bit DMA enable failed\n",x@@ -578,14 +596,14 @@xx			}xx		}x 	} else {x-		rcx= pci_set_dma_mask(pdev, 0xffffffffULL);x+		rcx= pci_set_dma_mask(pdev, DMA_32BIT_MASK);xx		if (rc)x{x 			printk(KERN_ERR DRV_NAMEx 				"(%s): 32-bit DMA enable failed\n",x 				pci_name(pdev));
 			return rc;
 		}x-		rcx= pci_set_consistent_dma_mask(pdev, 0xffffffffULL);x+		rcx= pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);xx		if (rc)x{x 			printk(KERN_ERR DRV_NAMEx 				"(%s): 32-bit consistent DMA enable failed\n",xdiff -Nru a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
--- a/drivers/scsi/sata_sil.c	2005-02-17 16:43:51 -08:00
+++ b/drivers/scsi/sata_sil.c	2005-03-07 20:41:36 -08:00
@@ -78,7 +78,7 @@xxx x /* TODO firmware versions should be added - eric */x-struct sil_drivelistx{x+static const struct sil_drivelistx{x 	const char * product;x 	unsigned int quirk;x } sil_blacklistx[] = {
@@ -125,6 +125,7 @@xx	.dma_boundary		= ATA_DMA_BOUNDARY,x 	.slave_configure	= ata_scsi_slave_config,x 	.bios_param		= ata_std_bios_param,x+	.ordered_flush		= 1,
 };xxx static struct ata_port_operations sil_ops =x{xdiff -Nru a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
--- a/drivers/scsi/sata_sis.c	2005-02-17 16:43:51 -08:00
+++ b/drivers/scsi/sata_sis.c	2005-03-07 20:41:36 -08:00
@@ -90,6 +90,7 @@xx	.dma_boundary		= ATA_DMA_BOUNDARY,x 	.slave_configure	= ata_scsi_slave_config,x 	.bios_param		= ata_std_bios_param,x+	.ordered_flush		= 1,
 };xxx static struct ata_port_operations sis_ops =x{xdiff -Nru a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
--- a/drivers/scsi/sata_svw.c	2005-02-17 16:43:51 -08:00
+++ b/drivers/scsi/sata_svw.c	2005-03-07 20:41:36 -08:00
@@ -156,7 +156,7 @@xx *	spin_lock_irqsave(host_set lock)xx */x x-void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc)x+static void k2_bmdma_setup_mmio (struct ata_queued_cmd *qc)x {x 	struct ata_port *ap = qc->ap;x 	unsigned int rwx= (qc->tf.flags & ATA_TFLAG_WRITE);x@@ -186,7 +186,7 @@xx *	spin_lock_irqsave(host_set lock)xx */x x-void k2_bmdma_start_mmio (struct ata_queued_cmd *qc)x+static void k2_bmdma_start_mmio (struct ata_queued_cmd *qc)x {x 	struct ata_port *ap = qc->ap;x 	void *mmio = (void *) ap->ioaddr.bmdma_addr;x@@ -288,6 +288,7 @@xx	.proc_info		= k2_sata_proc_info,x #endifxx	.bios_param		= ata_std_bios_param,x+	.ordered_flush		= 1,
 };xxx xdiff -Nru a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
--- a/drivers/scsi/sata_sx4.c	2005-02-13 16:58:01 -08:00
+++ b/drivers/scsi/sata_sx4.c	2005-03-07 20:41:36 -08:00
@@ -188,6 +188,7 @@xx	.dma_boundary		= ATA_DMA_BOUNDARY,x 	.slave_configure	= ata_scsi_slave_config,x 	.bios_param		= ata_std_bios_param,x+	.ordered_flush		= 1,
 };xxx static struct ata_port_operations pdc_20621_ops =x{xdiff -Nru a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
--- a/drivers/scsi/sata_uli.c	2005-02-17 16:43:51 -08:00
+++ b/drivers/scsi/sata_uli.c	2005-03-07 20:41:36 -08:00
@@ -82,6 +82,7 @@xx	.dma_boundary		= ATA_DMA_BOUNDARY,x 	.slave_configure	= ata_scsi_slave_config,x 	.bios_param		= ata_std_bios_param,x+	.ordered_flush		= 1,
 };xxx static struct ata_port_operations uli_ops =x{xdiff -Nru a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
--- a/drivers/scsi/sata_via.c	2005-02-17 16:43:51 -08:00
+++ b/drivers/scsi/sata_via.c	2005-03-07 20:41:36 -08:00
@@ -102,6 +102,7 @@xx	.dma_boundary		= ATA_DMA_BOUNDARY,x 	.slave_configure	= ata_scsi_slave_config,x 	.bios_param		= ata_std_bios_param,x+	.ordered_flush		= 1,
 };xxx static struct ata_port_operations svia_sata_ops =x{xdiff -Nru a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
--- a/drivers/scsi/sata_vsc.c	2005-02-17 16:43:51 -08:00
+++ b/drivers/scsi/sata_vsc.c	2005-03-07 20:41:36 -08:00
@@ -155,7 +155,8 @@xx *xx * Read the interrupt register and process for the devices that have them pending.xx */x-irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance, struct pt_regs *regs)x+static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance,x+				       struct pt_regs *regs)
 {x 	struct ata_host_set *host_set = dev_instance;x 	unsigned int i;x@@ -204,6 +205,7 @@xx	.dma_boundary		= ATA_DMA_BOUNDARY,x 	.slave_configure	= ata_scsi_slave_config,x 	.bios_param		= ata_std_bios_param,x+	.ordered_flush		= 1,
 };xxx x@@ -285,10 +287,10 @@xx	/*x 	 * Use 32 bit DMA mask, because 64 bit address support is poor.x 	 */x-	rcx= pci_set_dma_mask(pdev, 0xFFFFFFFFULL);x+	rcx= pci_set_dma_mask(pdev, DMA_32BIT_MASK);xx	if (rc)
 		goto err_out_regions;x-	rcx= pci_set_consistent_dma_mask(pdev, 0xFFFFFFFFULL);x+	rcx= pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);xx	if (rc)
 		goto err_out_regions;x xdiff -Nru a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
--- a/drivers/scsi/scsi_lib.c	2005-02-01 08:49:23 -08:00
+++ b/drivers/scsi/scsi_lib.c	2005-03-09 00:12:06 -08:00
@@ -697,6 +697,9 @@xx	int sense_validx= 0;
 	int sense_deferredx= 0;
 x+	if (blk_complete_barrier_rq(q, req, good_bytes >> 9))x+		return;x+xx	/*x 	 * Free up any indirection buffers we allocated for DMA purposes. x 	 * For the case of a READ, we need to copy the data out of the
@@ -723,7 +726,7 @@xx		req->errors =xresult;xx		if (result)x{x 			clear_errors =x0;
-			if (sense_valid)x{x+			if (sense_validx&& req->sense)x{x 				/*x 				 * SG_IO wants current and deferredxerrorsx 				 */
@@ -962,6 +965,38 @@xx	return BLKPREP_KILL;x }xxx+static int scsi_prepare_flush_fn(request_queue_t *q, struct request *rq)x+{x+	struct scsi_device *sdevx= q->queuedata;
+	struct scsi_driver *drv;
+x+	if (sdev->sdev_state == SDEV_RUNNING)x{x+		drvx= *(struct scsi_driver **) rq->rq_disk->private_data;
+x+		if (drv->prepare_flush)x+			return drv->prepare_flush(q, rq);
+	}
+x+	return 0;x+}x+x+static void scsi_end_flush_fn(request_queue_t *q, struct request *rq)x+{x+	struct scsi_device *sdevx= q->queuedata;
+	struct request *flush_rq =xrq->end_io_data;
+	struct scsi_driver *drv;
+x+	if (flush_rq->errors)x{x+		printk("scsi: barrierxerror, disabling flush support\n");x+		blk_queue_ordered(q, QUEUE_ORDERED_NONE);
+	}
+x+	if (sdev->sdev_state == SDEV_RUNNING)x{x+		drvx= *(struct scsi_driver **) rq->rq_disk->private_data;
+		drv->end_flush(q, rq);
+	}
+}x+x static int scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk,x 			       sector_t *error_sector)
 {x@@ -1365,6 +1400,17 @@xx	blk_queue_bounce_limit(q, scsi_calculate_bounce_limit(shost));
 	blk_queue_segment_boundary(q, shost->dma_boundary);
 	blk_queue_issue_flush_fn(q, scsi_issue_flush_fn);x+x+	/*x+	 * ordered tags are superior to flush orderingx+	 */x+	if (shost->ordered_tag)x+		blk_queue_ordered(q, QUEUE_ORDERED_TAG);
+	else if (shost->ordered_flush)x{x+		blk_queue_ordered(q, QUEUE_ORDERED_FLUSH);x+		q->prepare_flush_fn = scsi_prepare_flush_fn;x+		q->end_flush_fn = scsi_end_flush_fn;
+	}
 x 	if (!shost->use_clustering)
 		clear_bit(QUEUE_FLAG_CLUSTER, &q->queue_flags);xdiff -Nru a/drivers/scsi/sd.c b/drivers/scsi/sd.c
--- a/drivers/scsi/sd.c	2005-01-28 09:14:30 -08:00
+++ b/drivers/scsi/sd.c	2005-03-09 00:12:06 -08:00
@@ -122,6 +122,8 @@xxstatic void sd_rescan(struct device *);x static int sd_init_command(struct scsi_cmnd *);x static int sd_issue_flush(struct device *, sector_t *);x+static void sd_end_flush(request_queue_t *, struct request *);x+static int sd_prepare_flush(request_queue_t *, struct request *);xxstatic void sd_read_capacity(struct scsi_disk *sdkp, char *diskname,x 		 struct scsi_request *SRpnt, unsigned char *buffer);
xx@@ -136,6 +138,8 @@xx	.rescan			= sd_rescan,x 	.init_command		= sd_init_command,x 	.issue_flush		= sd_issue_flush,x+	.prepare_flush		= sd_prepare_flush,x+	.end_flush		= sd_end_flush,
 };xxx /*x@@ -733,6 +737,45 @@xx		return 0;x xx	return sd_sync_cache(sdp);x+}x+x+static void sd_end_flush(request_queue_t *q, struct request *flush_rq)x+{x+	struct request *rq = flush_rq->end_io_data;
+	struct scsi_cmnd *cmd =xrq->special;x+	unsigned int bytes =xrq->hard_nr_sectors << 9;
+x+	if (!flush_rq->errors)x{x+		spin_unlock(q->queue_lock);x+		scsi_io_completion(cmd, bytes, 0);x+		spin_lock(q->queue_lock);x+	} else if (blk_barrier_postflush(rq))x{x+		spin_unlock(q->queue_lock);x+		scsi_io_completion(cmd, 0, bytes);x+		spin_lock(q->queue_lock);x+	} else {x+		/*x+		 * force journal abort of barriersx+		 */x+		end_that_request_first(rq, -EOPNOTSUPP,xrq->hard_nr_sectors);x+		end_that_request_last(rq);
+	}
+}x+x+static int sd_prepare_flush(request_queue_t *q, struct request *rq)x+{x+	struct scsi_device *sdevx= q->queuedata;
+	struct scsi_disk *sdkp = dev_get_drvdata(&sdev->sdev_gendev);x+x+	if (sdkp->WCE)x{x+		memset(rq->cmd, 0, sizeof(rq->cmd));x+		rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER;x+		rq->timeout = SD_TIMEOUT;x+		rq->cmd[0] = SYNCHRONIZE_CACHE;x+		return 1;
+	}
+x+	return 0;x }xxx static void sd_rescan(struct device *dev)xdiff -Nru a/drivers/scsi/st.c b/drivers/scsi/st.c
--- a/drivers/scsi/st.c	2005-01-20 21:02:11 -08:00
+++ b/drivers/scsi/st.c	2005-03-07 20:41:21 -08:00
@@ -1004,7 +1004,13 @@xx	int devx= TAPE_NR(inode);x 	char *name;x x-	nonseekable_open(inode, filp);x+	/*x+	 * We really want to do nonseekable_open(inode, filp); here, but somex+	 * versions of tar incorrectly call lseek on tapes and bail out if thatx+	 * fails.  So we disallow pread() and pwrite(), but permit lseeks.x+	 */x+	filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);x+x 	write_lock(&st_dev_arr_lock);x 	if (devx>= st_dev_max || scsi_tapes == NULL ||x 	    ((STp = scsi_tapes[dev]) == NULL))x{xdiff -Nru a/drivers/serial/21285.c b/drivers/serial/21285.c
--- a/drivers/serial/21285.c	2004-11-13 10:08:22 -08:00
+++ b/drivers/serial/21285.c	2005-02-21 04:34:22 -08:00
@@ -142,7 +142,6 @@xx	}x 	tty_flip_buffer_push(tty);x x- out:xx	return IRQ_HANDLED;x }xxx@@ -383,11 +382,9 @@xx};xxx static struct uart_port serial21285_port = {x-	.membase	= 0,x 	.mapbase	= 0x42000160,x 	.iotype		= SERIAL_IO_MEM,x 	.irq		= NO_IRQ,x-	.uartclk	= 0,x 	.fifosize	= 16,x 	.ops		= &serial21285_ops,x 	.flags		= ASYNC_BOOT_AUTOCONF,xdiff -Nru a/drivers/serial/8250.c b/drivers/serial/8250.c
--- a/drivers/serial/8250.c	2005-02-28 08:05:18 -08:00
+++ b/drivers/serial/8250.c	2005-03-08 02:04:55 -08:00
@@ -642,6 +642,7 @@xxstatic void autoconfig_16550a(struct uart_8250_port *up)xx{x 	unsigned char status1, status2;x+	unsigned int iersave;x xx	up->port.type = PORT_16550A;xx	up->capabilities |= UART_CAP_FIFO;
@@ -728,6 +729,7 @@xx	serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR7_64BYTE);x 	status2 = serial_in(up, UART_IIR) >> 5;xx	serial_outp(up, UART_FCR, UART_FCR_ENABLE_FIFO);x+	serial_outp(up, UART_LCR, 0);x xx	DEBUG_AUTOCONF("iir1=%d iir2=%d ", status1, status2);
xx@@ -736,6 +738,40 @@xx		up->capabilities |= UART_CAP_AFE | UART_CAP_SLEEP;xx		return;
 	}x+x+	/*x+	 * Try writing and reading the UART_IER_UUE bit (b6).x+	 * If it works, this is probably one of the Xscale platform'sx+	 * internal UARTs.x+	 * We're going to explicitly set the UUE bit to 0 beforex+	 * trying to write and read a 1 just to make sure it's notx+	 * already a 1 and maybe locked there before we even start start.x+	 */x+	iersave = serial_in(up, UART_IER);x+	serial_outp(up, UART_IER, iersave & ~UART_IER_UUE);x+	if (!(serial_in(up, UART_IER) & UART_IER_UUE)) {x+		/*x+		 * OK it's in a known zero state, try writing and readingx+		 * without disturbing the current state of the other bits.x+		 */x+		serial_outp(up, UART_IER, iersave | UART_IER_UUE);x+		if (serial_in(up, UART_IER) & UART_IER_UUE)x{x+			/*x+			 * It's an Xscale.x+			 * We'll leave the UART_IER_UUE bit set to 1 (enabled).x+			 */x+			DEBUG_AUTOCONF("Xscale ");x+			up->port.type = PORT_XSCALE;x+			return;x+		}x+	} else {x+		/*x+		 * If we got here we couldn't force the IER_UUE bit to 0.x+		 * Log it and continue.x+		 */x+		DEBUG_AUTOCONF("Couldn't force IER_UUE to 0 ");
+	}
+	serial_outp(up, UART_IER, iersave);x }xxx /*xdiff -Nru a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
--- a/drivers/serial/8250_pci.c	2005-02-11 15:18:12 -08:00
+++ b/drivers/serial/8250_pci.c	2005-03-08 14:08:47 -08:00
@@ -1759,7 +1759,7 @@xx	}x }xxx-static int pciserial_suspend_one(struct pci_devx*dev, u32 state)x+static int pciserial_suspend_one(struct pci_devx*dev, pm_message_t state)x {x 	struct serial_private *privx= pci_get_drvdata(dev);
xx@@ -1769,6 +1769,8 @@xx		for (i = 0; i < priv->nr; i++)x 			serial8250_suspend_port(priv->line[i]);
 	}
+	pci_save_state(dev);
+	pci_set_power_state(dev, pci_choose_state(dev, state));
 	return 0;x }xxx@@ -1776,8 +1778,16 @@xx{x 	struct serial_private *privx= pci_get_drvdata(dev);
xx+	pci_set_power_state(dev, PCI_D0);
+	pci_restore_state(dev);
+xx	if (priv)x{x 		int i;x+x+		/*x+		 * The device may have been disabled.  Re-enable it.x+		 */x+		pci_enable_device(dev);
xx 		/*x 		 * Ensure that the board is correctly configured.xdiff -Nru a/drivers/serial/Kconfig b/drivers/serial/Kconfig
--- a/drivers/serial/Kconfig	2005-01-30 22:33:45 -08:00
+++ b/drivers/serial/Kconfig	2005-03-07 20:41:37 -08:00
@@ -810,4 +810,21 @@xx	bool "TX39XX/49XX SIO act as standard serial"xx	depends on !SERIAL_8250x&& SERIAL_TXX9
xx+config SERIAL_VR41XXx+	tristate "NEC VR4100 series Serial Interface Unit support"x+	depends on CPU_VR41XXx+	select SERIAL_COREx+	helpx+	  If you have a NEC VR4100 series processor and you want to usex+	  Serial Interface Unit(SIU) or Debug Serial Interface Unit(DSIU)x+	  (not include VR4111/VR4121 DSIU), say Y.  Otherwise, say N.x+x+config SERIAL_VR41XX_CONSOLEx+	bool "Enable NEC VR4100 series Serial Interface Unit console"x+	depends on SERIAL_VR41XXx+	select SERIAL_CORE_CONSOLEx+	helpx+	  If you have a NEC VR4100 series processor and you want to usex+	  a console on a serial port, say Y.  Otherwise, say N.x+x endmenuxdiff -Nru a/drivers/serial/Makefile b/drivers/serial/Makefile
--- a/drivers/serial/Makefile	2005-02-09 13:14:12 -08:00
+++ b/drivers/serial/Makefile	2005-03-07 20:41:37 -08:00
@@ -49,3 +49,5 @@xxobj-$(CONFIG_SERIAL_MPSC) += mpsc.oxxobj-$(CONFIG_ETRAX_SERIAL) += crisv10.oxxobj-$(CONFIG_SERIAL_TXX9) += serial_txx9.ox+obj-$(CONFIG_SERIAL_VR41XX) += vr41xx_siu.ox+obj-$(CONFIG_BLK_DEV_SGIIOC4) += ioc4_serial.oxdiff -Nru a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
--- a/drivers/serial/cpm_uart/cpm_uart_core.c	2004-11-04 10:07:30 -08:00
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c	2005-03-04 22:32:56 -08:00
@@ -864,6 +864,7 @@xx			.irq		= SMC1_IRQ,xx			.ops		= &cpm_uart_pops,x 			.iotype		= SERIAL_IO_MEM,x+			.lock		= SPIN_LOCK_UNLOCKED,x 		},x 		.flags = FLAG_SMC,x 		.tx_nrfifosx= TX_NUM_FIFO,x@@ -877,6 +878,7 @@xx			.irq		= SMC2_IRQ,xx			.ops		= &cpm_uart_pops,x 			.iotype		= SERIAL_IO_MEM,x+			.lock		= SPIN_LOCK_UNLOCKED,x 		},x 		.flags = FLAG_SMC,x 		.tx_nrfifosx= TX_NUM_FIFO,x@@ -893,6 +895,7 @@xx			.irq		= SCC1_IRQ,xx			.ops		= &cpm_uart_pops,x 			.iotype		= SERIAL_IO_MEM,x+			.lock		= SPIN_LOCK_UNLOCKED,x 		},x 		.tx_nrfifosx= TX_NUM_FIFO,x 		.tx_fifosizex= TX_BUF_SIZE,
@@ -905,6 +908,7 @@xx			.irq		= SCC2_IRQ,xx			.ops		= &cpm_uart_pops,x 			.iotype		= SERIAL_IO_MEM,x+			.lock		= SPIN_LOCK_UNLOCKED,x 		},x 		.tx_nrfifosx= TX_NUM_FIFO,x 		.tx_fifosizex= TX_BUF_SIZE,
@@ -917,6 +921,7 @@xx			.irq		= SCC3_IRQ,xx			.ops		= &cpm_uart_pops,x 			.iotype		= SERIAL_IO_MEM,x+			.lock		= SPIN_LOCK_UNLOCKED,x 		},x 		.tx_nrfifosx= TX_NUM_FIFO,x 		.tx_fifosizex= TX_BUF_SIZE,
@@ -929,6 +934,7 @@xx			.irq		= SCC4_IRQ,xx			.ops		= &cpm_uart_pops,x 			.iotype		= SERIAL_IO_MEM,x+			.lock		= SPIN_LOCK_UNLOCKED,x 		},x 		.tx_nrfifosx= TX_NUM_FIFO,x 		.tx_fifosizex= TX_BUF_SIZE,
diff -Nru a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/serial/ioc4_serial.c	2005-03-07 20:41:31 -08:00
@@ -0,0 +1,2909 @@x+/*x+ * This file is subject to the terms and conditions of the GNU General Publicx+ * License.  See the file "COPYING" in the main directory of this archivex+ * for more details.x+ *x+ * Copyright (C) 2003-2005 Silicon Graphics, Inc.  All Rights Reserved.x+ */x+x+x+/*x+ * This file contains a module version of the ioc4 serial driver. Thisx+ * includes all the support functions needed (support functions, etc.)x+ * and the serial driver itself.x+ */x+#include <linux/errno.h>
+#include <linux/tty.h>
+#include <linux/serial.h>
+#include <linux/serialP.h>
+#include <linux/circ_buf.h>
+#include <linux/serial_reg.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/ioc4_common.h>
+#include <linux/serial_core.h>
+x+/*x+ * interesting things about the ioc4x+ */x+x+#define IOC4_NUM_SERIAL_PORTS	4	/* max ports per card */x+#define IOC4_NUM_CARDS		8	/* max cards per partition */x+x+#define	GET_SIO_IR(_n)	(_n == 0)x? (IOC4_SIO_IR_S0)x: \x+				(_n == 1)x? (IOC4_SIO_IR_S1)x: \x+				(_n == 2)x? (IOC4_SIO_IR_S2)x: \x+				(IOC4_SIO_IR_S3)x+x+#define	GET_OTHER_IR(_n)  (_n == 0)x? (IOC4_OTHER_IR_S0_MEMERR)x: \x+				(_n == 1)x? (IOC4_OTHER_IR_S1_MEMERR)x: \x+				(_n == 2)x? (IOC4_OTHER_IR_S2_MEMERR)x: \x+				(IOC4_OTHER_IR_S3_MEMERR)x+x+x+/*x+ * All IOC4 registers are 32 bits wide.x+ */x+x+/*x+ * PCI Memory Space Mapx+ */x+#define IOC4_PCI_ERR_ADDR_L     0x000	/* Low Error Address */x+#define IOC4_PCI_ERR_ADDR_VLD	        (0x1 << 0)x+#define IOC4_PCI_ERR_ADDR_MST_ID_MSK    (0xf << 1)x+#define IOC4_PCI_ERR_ADDR_MST_NUM_MSK   (0xe << 1)x+#define IOC4_PCI_ERR_ADDR_MST_TYP_MSK   (0x1 << 1)x+#define IOC4_PCI_ERR_ADDR_MUL_ERR       (0x1 << 5)x+#define IOC4_PCI_ERR_ADDR_ADDR_MSK      (0x3ffffff << 6)x+x+/* Interrupt types */x+#define	IOC4_SIO_INTR_TYPE	0x+#define	IOC4_OTHER_INTR_TYPE	1x+#define	IOC4_NUM_INTR_TYPES	2x+x+/* Bitmasks for IOC4_SIO_IR, IOC4_SIO_IEC, and IOC4_SIO_IES  */x+#define IOC4_SIO_IR_S0_TX_MT	   0x00000001	/* Serial port 0 TX empty */x+#define IOC4_SIO_IR_S0_RX_FULL	   0x00000002	/* Port 0 RX buf full */x+#define IOC4_SIO_IR_S0_RX_HIGH	   0x00000004	/* Port 0 RX hiwat */x+#define IOC4_SIO_IR_S0_RX_TIMER	   0x00000008	/* Port 0 RX timeout */x+#define IOC4_SIO_IR_S0_DELTA_DCD   0x00000010	/* Port 0 delta DCD */x+#define IOC4_SIO_IR_S0_DELTA_CTS   0x00000020	/* Port 0 delta CTS */x+#define IOC4_SIO_IR_S0_INT	   0x00000040	/* Port 0 pass-thru intr */x+#define IOC4_SIO_IR_S0_TX_EXPLICIT 0x00000080	/* Port 0 explicit TX thru */x+#define IOC4_SIO_IR_S1_TX_MT	   0x00000100	/* Serial port 1 */x+#define IOC4_SIO_IR_S1_RX_FULL	   0x00000200	/* */x+#define IOC4_SIO_IR_S1_RX_HIGH	   0x00000400	/* */x+#define IOC4_SIO_IR_S1_RX_TIMER	   0x00000800	/* */x+#define IOC4_SIO_IR_S1_DELTA_DCD   0x00001000	/* */x+#define IOC4_SIO_IR_S1_DELTA_CTS   0x00002000	/* */x+#define IOC4_SIO_IR_S1_INT	   0x00004000	/* */x+#define IOC4_SIO_IR_S1_TX_EXPLICIT 0x00008000	/* */x+#define IOC4_SIO_IR_S2_TX_MT	   0x00010000	/* Serial port 2 */x+#define IOC4_SIO_IR_S2_RX_FULL	   0x00020000	/* */x+#define IOC4_SIO_IR_S2_RX_HIGH	   0x00040000	/* */x+#define IOC4_SIO_IR_S2_RX_TIMER	   0x00080000	/* */x+#define IOC4_SIO_IR_S2_DELTA_DCD   0x00100000	/* */x+#define IOC4_SIO_IR_S2_DELTA_CTS   0x00200000	/* */x+#define IOC4_SIO_IR_S2_INT	   0x00400000	/* */x+#define IOC4_SIO_IR_S2_TX_EXPLICIT 0x00800000	/* */x+#define IOC4_SIO_IR_S3_TX_MT	   0x01000000	/* Serial port 3 */x+#define IOC4_SIO_IR_S3_RX_FULL	   0x02000000	/* */x+#define IOC4_SIO_IR_S3_RX_HIGH	   0x04000000	/* */x+#define IOC4_SIO_IR_S3_RX_TIMER	   0x08000000	/* */x+#define IOC4_SIO_IR_S3_DELTA_DCD   0x10000000	/* */x+#define IOC4_SIO_IR_S3_DELTA_CTS   0x20000000	/* */x+#define IOC4_SIO_IR_S3_INT	   0x40000000	/* */x+#define IOC4_SIO_IR_S3_TX_EXPLICIT 0x80000000	/* */x+x+/* Per device interrupt masks */x+#define IOC4_SIO_IR_S0		(IOC4_SIO_IR_S0_TX_MT | \x+				 IOC4_SIO_IR_S0_RX_FULL | \x+				 IOC4_SIO_IR_S0_RX_HIGH | \x+				 IOC4_SIO_IR_S0_RX_TIMER | \x+				 IOC4_SIO_IR_S0_DELTA_DCD | \x+				 IOC4_SIO_IR_S0_DELTA_CTS | \x+				 IOC4_SIO_IR_S0_INT | \x+				 IOC4_SIO_IR_S0_TX_EXPLICIT)x+#define IOC4_SIO_IR_S1		(IOC4_SIO_IR_S1_TX_MT | \x+				 IOC4_SIO_IR_S1_RX_FULL | \x+				 IOC4_SIO_IR_S1_RX_HIGH | \x+				 IOC4_SIO_IR_S1_RX_TIMER | \x+				 IOC4_SIO_IR_S1_DELTA_DCD | \x+				 IOC4_SIO_IR_S1_DELTA_CTS | \x+				 IOC4_SIO_IR_S1_INT | \x+				 IOC4_SIO_IR_S1_TX_EXPLICIT)x+#define IOC4_SIO_IR_S2		(IOC4_SIO_IR_S2_TX_MT | \x+				 IOC4_SIO_IR_S2_RX_FULL | \x+				 IOC4_SIO_IR_S2_RX_HIGH | \x+				 IOC4_SIO_IR_S2_RX_TIMER | \x+				 IOC4_SIO_IR_S2_DELTA_DCD | \x+				 IOC4_SIO_IR_S2_DELTA_CTS | \x+				 IOC4_SIO_IR_S2_INT | \x+				 IOC4_SIO_IR_S2_TX_EXPLICIT)x+#define IOC4_SIO_IR_S3		(IOC4_SIO_IR_S3_TX_MT | \x+				 IOC4_SIO_IR_S3_RX_FULL | \x+				 IOC4_SIO_IR_S3_RX_HIGH | \x+				 IOC4_SIO_IR_S3_RX_TIMER | \x+				 IOC4_SIO_IR_S3_DELTA_DCD | \x+				 IOC4_SIO_IR_S3_DELTA_CTS | \x+				 IOC4_SIO_IR_S3_INT | \x+				 IOC4_SIO_IR_S3_TX_EXPLICIT)x+x+/* Bitmasks for IOC4_OTHER_IR, IOC4_OTHER_IEC, and IOC4_OTHER_IES  */x+#define IOC4_OTHER_IR_ATA_INT           0x00000001  /* ATAPI intr pass-thru */x+#define IOC4_OTHER_IR_ATA_MEMERR        0x00000002  /* ATAPI DMA PCI error */x+#define IOC4_OTHER_IR_S0_MEMERR         0x00000004  /* Port 0 PCI error */x+#define IOC4_OTHER_IR_S1_MEMERR         0x00000008  /* Port 1 PCI error */x+#define IOC4_OTHER_IR_S2_MEMERR         0x00000010  /* Port 2 PCI error */x+#define IOC4_OTHER_IR_S3_MEMERR         0x00000020  /* Port 3 PCI error */x+x+/* Bitmasks for IOC4_SIO_CR */x+#define IOC4_SIO_CR_CMD_PULSE_SHIFT              0  /* byte busxstrobe shift */x+#define IOC4_SIO_CR_ARB_DIAG_TX0	0x00000000x+#define IOC4_SIO_CR_ARB_DIAG_RX0	0x00000010x+#define IOC4_SIO_CR_ARB_DIAG_TX1	0x00000020x+#define IOC4_SIO_CR_ARB_DIAG_RX1	0x00000030x+#define IOC4_SIO_CR_ARB_DIAG_TX2	0x00000040x+#define IOC4_SIO_CR_ARB_DIAG_RX2	0x00000050x+#define IOC4_SIO_CR_ARB_DIAG_TX3	0x00000060x+#define IOC4_SIO_CR_ARB_DIAG_RX3	0x00000070x+#define IOC4_SIO_CR_SIO_DIAG_IDLE	0x00000080  /* 0 -> active request amongx+							   serial ports (ro) */x+/* Defs for some of the generic I/O pins */x+#define IOC4_GPCR_UART0_MODESEL	   0x10	/* Pin is output to port 0x+						   mode sel */x+#define IOC4_GPCR_UART1_MODESEL	   0x20	/* Pin is output to port 1x+						   mode sel */x+#define IOC4_GPCR_UART2_MODESEL	   0x40	/* Pin is output to port 2x+						   mode sel */x+#define IOC4_GPCR_UART3_MODESEL	   0x80	/* Pin is output to port 3x+						   mode sel */x+x+#define IOC4_GPPR_UART0_MODESEL_PIN   4	/* GIO pin controllingx+					   uart 0 mode select */x+#define IOC4_GPPR_UART1_MODESEL_PIN   5	/* GIO pin controllingx+					   uart 1 mode select */x+#define IOC4_GPPR_UART2_MODESEL_PIN   6	/* GIO pin controllingx+					   uart 2 mode select */x+#define IOC4_GPPR_UART3_MODESEL_PIN   7	/* GIO pin controllingx+					   uart 3 mode select */x+x+/* Bitmasks for serial RX status byte */x+#define IOC4_RXSB_OVERRUN       0x01	/* Char(s) lost */x+#define IOC4_RXSB_PAR_ERR	0x02	/* Parity error */x+#define IOC4_RXSB_FRAME_ERR	0x04	/* Framing error */x+#define IOC4_RXSB_BREAK	        0x08	/* Break character */x+#define IOC4_RXSB_CTS	        0x10	/* State of CTS */x+#define IOC4_RXSB_DCD	        0x20	/* State of DCD */x+#define IOC4_RXSB_MODEM_VALID   0x40	/* DCD, CTS, and OVERRUN are validx*/x+#define IOC4_RXSB_DATA_VALID    0x80	/* Data byte, FRAME_ERR PAR_ERRx+					 * & BREAK validx*/x+x+/* Bitmasks for serial TX control byte */x+#define IOC4_TXCB_INT_WHEN_DONE 0x20	/* Interrupt after this byte is sent */x+#define IOC4_TXCB_INVALID	0x00	/* Byte is invalidx*/x+#define IOC4_TXCB_VALID	        0x40	/* Byte is validx*/x+#define IOC4_TXCB_MCR	        0x80	/* Data<7:0> to modem control reg */x+#define IOC4_TXCB_DELAY	        0xc0	/* Delay data<7:0> mSec */x+x+/* Bitmasks for IOC4_SBBR_L */x+#define IOC4_SBBR_L_SIZE	0x00000001  /* 0 == 1KB rings, 1 == 4KB rings */x+x+/* Bitmasks for IOC4_SSCR_<3:0> */x+#define IOC4_SSCR_RX_THRESHOLD  0x000001ff  /* Hiwater mark */x+#define IOC4_SSCR_TX_TIMER_BUSY 0x00010000  /* TX timer in progress */x+#define IOC4_SSCR_HFC_EN	0x00020000  /* Hardware flow control enabled */x+#define IOC4_SSCR_RX_RING_DCD   0x00040000  /* Post RX record on delta-DCD */x+#define IOC4_SSCR_RX_RING_CTS   0x00080000  /* Post RX record on delta-CTS */x+#define IOC4_SSCR_DIAG	        0x00200000  /* Bypass clock divider for sim */x+#define IOC4_SSCR_RX_DRAIN	0x08000000  /* Drain RX buffer to memory */x+#define IOC4_SSCR_DMA_EN	0x10000000  /* Enable ring buffer DMA */x+#define IOC4_SSCR_DMA_PAUSE	0x20000000  /* Pause DMA */x+#define IOC4_SSCR_PAUSE_STATE   0x40000000  /* Sets when PAUSE takes effect */x+#define IOC4_SSCR_RESET	        0x80000000  /* Reset DMA channels */x+x+/* All producer/comsumer pointers are the same bitfield */x+#define IOC4_PROD_CONS_PTR_4K   0x00000ff8	/* For 4K buffers */x+#define IOC4_PROD_CONS_PTR_1K   0x000003f8	/* For 1K buffers */x+#define IOC4_PROD_CONS_PTR_OFF           3x+x+/* Bitmasks for IOC4_SRCIR_<3:0> */x+#define IOC4_SRCIR_ARM	        0x80000000	/* Arm RX timer */x+x+/* Bitmasks for IOC4_SHADOW_<3:0> */x+#define IOC4_SHADOW_DR	 0x00000001	/* Data ready */x+#define IOC4_SHADOW_OE	 0x00000002	/* Overrun error */x+#define IOC4_SHADOW_PE	 0x00000004	/* Parity error */x+#define IOC4_SHADOW_FE	 0x00000008	/* Framing error */x+#define IOC4_SHADOW_BI	 0x00000010	/* Break interrupt */x+#define IOC4_SHADOW_THRE 0x00000020	/* Xmit holding register empty */x+#define IOC4_SHADOW_TEMT 0x00000040	/* Xmit shift register empty */x+#define IOC4_SHADOW_RFCE 0x00000080	/* Char in RX fifo has an error */x+#define IOC4_SHADOW_DCTS 0x00010000	/* Delta clear to send */x+#define IOC4_SHADOW_DDCD 0x00080000	/* Delta data carrierxdetect */x+#define IOC4_SHADOW_CTS	 0x00100000	/* Clear to send */x+#define IOC4_SHADOW_DCD	 0x00800000	/* Data carrierxdetect */x+#define IOC4_SHADOW_DTR	 0x01000000	/* Data terminal ready */x+#define IOC4_SHADOW_RTS	 0x02000000	/* Request to send */x+#define IOC4_SHADOW_OUT1 0x04000000	/* 16550 OUT1 bit */x+#define IOC4_SHADOW_OUT2 0x08000000	/* 16550 OUT2 bit */x+#define IOC4_SHADOW_LOOP 0x10000000	/* Loopback enabled */x+x+/* Bitmasks for IOC4_SRTR_<3:0> */x+#define IOC4_SRTR_CNT	        0x00000fff	/* Reload value for RX timer */x+#define IOC4_SRTR_CNT_VAL	0x0fff0000	/* Current value of RX timer */x+#define IOC4_SRTR_CNT_VAL_SHIFT         16x+#define IOC4_SRTR_HZ                 16000	/* SRTR clock frequency */x+x+/* Serial port register map used for DMA and PIO serial I/O */x+struct ioc4_serialregs {x+	uint32_t sscr;x+	uint32_t stpir;x+	uint32_t stcir;x+	uint32_t srpir;x+	uint32_t srcir;x+	uint32_t srtr;x+	uint32_t shadow;x+};x+x+/* IOC4 UART register map */x+struct ioc4_uartregs {x+	char i4u_lcr;x+	union {x+		char iir;	/* read only */x+		char fcr;	/* write only */x+	} u3;x+	union {x+		char ier;	/* DLAB == 0 */x+		char dlm;	/* DLAB == 1 */x+	} u2;x+	union {x+		char rbr;	/* read only, DLAB == 0 */x+		char thr;	/* write only, DLAB == 0 */x+		char dll;	/* DLAB == 1 */x+	} u1;
+	char i4u_scr;x+	char i4u_msr;x+	char i4u_lsr;x+	char i4u_mcr;x+};x+x+/* short names */x+#define i4u_dll u1.dllx+#define i4u_ierxu2.ierx+#define i4u_dlmxu2.dlmx+#define i4u_fcr u3.fcrx+x+/* PCI memory space register map addressed using pci_bar0 */x+struct ioc4_memregs {x+	struct ioc4_mem {x+		/* Miscellaneous IOC4  registers */x+		uint32_t pci_err_addr_l;x+		uint32_t pci_err_addr_h;x+		uint32_t sio_ir;x+		uint32_t other_ir;x+x+		/* These registers are read-only for general kernel code.  */x+		uint32_t sio_ies_ro;x+		uint32_t other_ies_ro;x+		uint32_t sio_iec_ro;x+		uint32_t other_iec_ro;x+		uint32_t sio_cr;x+		uint32_t misc_fill1;x+		uint32_t int_out;x+		uint32_t misc_fill2;x+		uint32_t gpcr_s;x+		uint32_t gpcr_c;x+		uint32_t gpdr;x+		uint32_t misc_fill3;x+		uint32_t gppr_0;x+		uint32_t gppr_1;x+		uint32_t gppr_2;x+		uint32_t gppr_3;x+		uint32_t gppr_4;x+		uint32_t gppr_5;x+		uint32_t gppr_6;x+		uint32_t gppr_7;x+	} ioc4_mem;x+x+	char misc_fill4[0x100 - 0x5C - 4];x+x+	/* ATA/ATAP registers */x+	uint32_t ata_notused[9];x+	char ata_fill1[0x140 - 0x120 - 4];x+	uint32_t ata_notused1[8];x+	char ata_fill2[0x200 - 0x15C - 4];x+x+	/* Keyboard and mouse registers */x+	uint32_t km_notused[5];;x+	char km_fill1[0x300 - 0x210 - 4];x+x+	/* Serial port registers used for DMA serial I/O */x+	struct ioc4_serial {x+		uint32_t sbbr01_l;x+		uint32_t sbbr01_h;x+		uint32_t sbbr23_l;x+		uint32_t sbbr23_h;x+x+		struct ioc4_serialregs port_0;x+		struct ioc4_serialregs port_1;x+		struct ioc4_serialregs port_2;x+		struct ioc4_serialregs port_3;x+		struct ioc4_uartregs uart_0;x+		struct ioc4_uartregs uart_1;x+		struct ioc4_uartregs uart_2;x+		struct ioc4_uartregs uart_3;x+	} ioc4_serial;x+};x+x+/* UART clock speed */x+#define IOC4_SER_XIN_CLK        IOC4_SER_XIN_CLK_66x+#define IOC4_SER_XIN_CLK_66     66666667x+#define IOC4_SER_XIN_CLK_33     33333333x+x+#define IOC4_W_IES		0x+#define IOC4_W_IEC		1x+
+typedef void ioc4_intr_func_f(void *, uint32_t);
+typedef ioc4_intr_func_f *ioc4_intr_func_t;x+x+/* defining this will get you LOTS of great debug info */x+//#define DEBUG_INTERRUPTSx+#define DPRINT_CONFIG(_x...)	;x+//#define DPRINT_CONFIG(_x...)	printk _xx+x+/* number of characters left in xmit buffer before we ask for more */x+#define WAKEUP_CHARS	256x+x+/* number of characters we want to transmit to the lower level at a time */x+#define IOC4_MAX_CHARS	128x+x+/* Device name we're using */x+#define DEVICE_NAME	"ttyIOC"x+#define DEVICE_MAJOR 204x+#define DEVICE_MINOR 50x+x+/* register offsets */x+#define IOC4_SERIAL_OFFSET	0x300x+x+/* flags for next_char_state */x+#define NCS_BREAK	0x1x+#define NCS_PARITY	0x2x+#define NCS_FRAMING	0x4x+#define NCS_OVERRUN	0x8x+x+/* cause we need SOME parameters ... */x+#define MIN_BAUD_SUPPORTED	1200x+#define MAX_BAUD_SUPPORTED	115200x+x+/* protocol types supported */x+enum sio_proto {x+	PROTO_RS232,x+	PROTO_RS422x+};x+x+/* Notification types */x+#define N_DATA_READY	0x01x+#define N_OUTPUT_LOWAT	0x02x+#define N_BREAK		0x04x+#define N_PARITY_ERROR	0x08x+#define N_FRAMING_ERROR	0x10x+#define N_OVERRUN_ERROR	0x20x+#define N_DDCD		0x40x+#define N_DCTS		0x80x+x+#define N_ALL_INPUT	(N_DATA_READY | N_BREAK |			\x+			 N_PARITY_ERROR | N_FRAMING_ERROR |		\x+			 N_OVERRUN_ERROR | N_DDCD | N_DCTS)x+x+#define N_ALL_OUTPUT	N_OUTPUT_LOWATx+x+#define N_ALL_ERRORS	(N_PARITY_ERROR | N_FRAMING_ERROR | N_OVERRUN_ERROR)x+x+#define N_ALL		(N_DATA_READY | N_OUTPUT_LOWAT | N_BREAK |	\x+			 N_PARITY_ERROR | N_FRAMING_ERROR |		\x+			 N_OVERRUN_ERROR | N_DDCD | N_DCTS)x+x+#define SER_DIVISOR(_x, clk)		(((clk) + (_x) * 8) / ((_x) * 16))x+#define DIVISOR_TO_BAUD(div, clk)	((clk) / 16 / (div))x+x+/* Some masks */x+#define LCR_MASK_BITS_CHAR	(UART_LCR_WLEN5 | UART_LCR_WLEN6 \x+					| UART_LCR_WLEN7 | UART_LCR_WLEN8)x+#define LCR_MASK_STOP_BITS	(UART_LCR_STOP)x+x+#define PENDING(_p)	(readl(&(_p)->ip_mem->sio_ir) & _p->ip_ienb)x+#define READ_SIO_IR(_p) readl(&(_p)->ip_mem->sio_ir)x+x+/* Default to 4k buffers */x+#ifdef IOC4_1K_BUFFERSx+#define RING_BUF_SIZE 1024x+#define IOC4_BUF_SIZE_BIT 0x+#define PROD_CONS_MASK IOC4_PROD_CONS_PTR_1Kx+#elsex+#define RING_BUF_SIZE 4096x+#define IOC4_BUF_SIZE_BIT IOC4_SBBR_L_SIZEx+#define PROD_CONS_MASK IOC4_PROD_CONS_PTR_4Kx+#endifx+x+#define TOTAL_RING_BUF_SIZE (RING_BUF_SIZE * 4)x+x+/*x+ * This is the entry saved by the driver - one per cardx+ */x+struct ioc4_control {x+	int ic_irq;
+	struct {x+		/* uart ports are allocated here */x+		struct uart_port icp_uart_port;x+		/* Handy reference material */x+		struct ioc4_port *icp_port;x+	} ic_port[IOC4_NUM_SERIAL_PORTS];x+	struct ioc4_soft *ic_soft;x+};x+x+/*x+ * per-IOC4 data structurex+ */x+#define MAX_IOC4_INTR_ENTS	(8 * sizeof(uint32_t))x+struct ioc4_soft {x+	struct ioc4_mem __iomem *is_ioc4_mem_addr;x+	struct ioc4_serial __iomem *is_ioc4_serial_addr;x+x+	/* Each interrupt type has an entry in the array */x+	struct ioc4_intr_type {x+x+		/*x+		 * Each in-use entry in this array contains at leastx+		 * one nonzero bit in sd_bits; no two entries in thisx+		 * array have overlapping sd_bits values.x+		 */x+		struct ioc4_intr_info {x+			uint32_t sd_bits;x+			ioc4_intr_func_f *sd_intr;x+			void *sd_info;x+		} is_intr_info[MAX_IOC4_INTR_ENTS];x+x+		/* Number of entries active in the above array */x+		atomic_t is_num_intrs;x+	} is_intr_type[IOC4_NUM_INTR_TYPES];x+x+	/* is_ir_lock must be held while
+	 * modifying sio_ie values, so
+	 * we can be sure that sio_ie isx+	 * not changing when we read itx+	 * along with sio_ir.x+	 */x+	spinlock_t is_ir_lock;	/* SIO_IE[SC] mod lock */x+};x+x+/* Local port info for each IOC4 serial ports */x+struct ioc4_port {x+	struct uart_port *ip_port;x+	/* Back ptrs for this port */x+	struct ioc4_control *ip_control;x+	struct pci_devx*ip_pdev;x+	struct ioc4_soft *ip_ioc4_soft;x+x+	/* pci mem addresses */x+	struct ioc4_mem __iomem *ip_mem;x+	struct ioc4_serial __iomem *ip_serial;x+	struct ioc4_serialregs __iomem *ip_serial_regs;x+	struct ioc4_uartregs __iomem *ip_uart_regs;x+x+	/* Ring buffer page for this port */x+	dma_addr_t ip_dma_ringbuf;x+	/* vaddr of ring buffer */x+	struct ring_buffer *ip_cpu_ringbuf;x+x+	/* Rings for this port */x+	struct ring *ip_inring;x+	struct ring *ip_outring;x+x+	/* Hook to port specific values */x+	struct hooks *ip_hooks;x+x+	spinlock_t ip_lock;x+x+	/* Various rx/tx parameters */x+	int ip_baud;x+	int ip_tx_lowat;x+	int ip_rx_timeout;x+x+	/* Copy of notification bits */x+	int ip_notify;x+x+	/* Shadow copies of various registers so we don't need to PIOx+	 * read them constantlyx+	 */x+	uint32_t ip_ienb;	/* Enabled interrupts */x+	uint32_t ip_sscr;x+	uint32_t ip_tx_prod;x+	uint32_t ip_rx_cons;x+	int ip_pci_bus_speed;x+	unsigned char ip_flags;x+};x+x+/* tx low water mark.  We need to notify the driver whenever tx is gettingx+ * close to empty so it can refill the tx buffer and keep things going.x+ * Let's assume that if we interrupt 1 ms before the tx goes idle, we'llx+ * have no trouble getting in more chars in time (I certainly hope so).x+ */x+#define TX_LOWAT_LATENCY      1000x+#define TX_LOWAT_HZ          (1000000 / TX_LOWAT_LATENCY)x+#define TX_LOWAT_CHARS(baud) (baud / 10 / TX_LOWAT_HZ)x+x+/* Flags per port */x+#define INPUT_HIGH	0x01x+#define DCD_ON		0x02x+#define LOWAT_WRITTEN	0x04x+#define READ_ABORTED	0x08x+x+/* Since each port has different register offsets and bitmasksx+ * for everything, we'll store those that we need in tables so wex+ * don't have to be constantly checking the port we are dealing with.x+ */x+struct hooks {x+	uint32_t intr_delta_dcd;x+	uint32_t intr_delta_cts;x+	uint32_t intr_tx_mt;x+	uint32_t intr_rx_timer;x+	uint32_t intr_rx_high;x+	uint32_t intr_tx_explicit;x+	uint32_t intr_dma_error;x+	uint32_t intr_clear;x+	uint32_t intr_all;x+	char rs422_select_pin;x+};x+x+static struct hooks hooks_array[IOC4_NUM_SERIAL_PORTS] = {x+	/* Values for port 0 */x+	{x+	 IOC4_SIO_IR_S0_DELTA_DCD, IOC4_SIO_IR_S0_DELTA_CTS,x+	 IOC4_SIO_IR_S0_TX_MT, IOC4_SIO_IR_S0_RX_TIMER,x+	 IOC4_SIO_IR_S0_RX_HIGH, IOC4_SIO_IR_S0_TX_EXPLICIT,x+	 IOC4_OTHER_IR_S0_MEMERR,x+	 (IOC4_SIO_IR_S0_TX_MT | IOC4_SIO_IR_S0_RX_FULL |x+	  IOC4_SIO_IR_S0_RX_HIGH | IOC4_SIO_IR_S0_RX_TIMER |x+	  IOC4_SIO_IR_S0_DELTA_DCD | IOC4_SIO_IR_S0_DELTA_CTS |x+	  IOC4_SIO_IR_S0_INT | IOC4_SIO_IR_S0_TX_EXPLICIT),x+	 IOC4_SIO_IR_S0, IOC4_GPPR_UART0_MODESEL_PIN,x+	 },x+x+	/* Values for port 1 */x+	{x+	 IOC4_SIO_IR_S1_DELTA_DCD, IOC4_SIO_IR_S1_DELTA_CTS,x+	 IOC4_SIO_IR_S1_TX_MT, IOC4_SIO_IR_S1_RX_TIMER,x+	 IOC4_SIO_IR_S1_RX_HIGH, IOC4_SIO_IR_S1_TX_EXPLICIT,x+	 IOC4_OTHER_IR_S1_MEMERR,x+	 (IOC4_SIO_IR_S1_TX_MT | IOC4_SIO_IR_S1_RX_FULL |x+	  IOC4_SIO_IR_S1_RX_HIGH | IOC4_SIO_IR_S1_RX_TIMER |x+	  IOC4_SIO_IR_S1_DELTA_DCD | IOC4_SIO_IR_S1_DELTA_CTS |x+	  IOC4_SIO_IR_S1_INT | IOC4_SIO_IR_S1_TX_EXPLICIT),x+	 IOC4_SIO_IR_S1, IOC4_GPPR_UART1_MODESEL_PIN,x+	 },x+x+	/* Values for port 2 */x+	{x+	 IOC4_SIO_IR_S2_DELTA_DCD, IOC4_SIO_IR_S2_DELTA_CTS,x+	 IOC4_SIO_IR_S2_TX_MT, IOC4_SIO_IR_S2_RX_TIMER,x+	 IOC4_SIO_IR_S2_RX_HIGH, IOC4_SIO_IR_S2_TX_EXPLICIT,x+	 IOC4_OTHER_IR_S2_MEMERR,x+	 (IOC4_SIO_IR_S2_TX_MT | IOC4_SIO_IR_S2_RX_FULL |x+	  IOC4_SIO_IR_S2_RX_HIGH | IOC4_SIO_IR_S2_RX_TIMER |x+	  IOC4_SIO_IR_S2_DELTA_DCD | IOC4_SIO_IR_S2_DELTA_CTS |x+	  IOC4_SIO_IR_S2_INT | IOC4_SIO_IR_S2_TX_EXPLICIT),x+	 IOC4_SIO_IR_S2, IOC4_GPPR_UART2_MODESEL_PIN,x+	 },x+x+	/* Values for port 3 */x+	{x+	 IOC4_SIO_IR_S3_DELTA_DCD, IOC4_SIO_IR_S3_DELTA_CTS,x+	 IOC4_SIO_IR_S3_TX_MT, IOC4_SIO_IR_S3_RX_TIMER,x+	 IOC4_SIO_IR_S3_RX_HIGH, IOC4_SIO_IR_S3_TX_EXPLICIT,x+	 IOC4_OTHER_IR_S3_MEMERR,x+	 (IOC4_SIO_IR_S3_TX_MT | IOC4_SIO_IR_S3_RX_FULL |x+	  IOC4_SIO_IR_S3_RX_HIGH | IOC4_SIO_IR_S3_RX_TIMER |x+	  IOC4_SIO_IR_S3_DELTA_DCD | IOC4_SIO_IR_S3_DELTA_CTS |x+	  IOC4_SIO_IR_S3_INT | IOC4_SIO_IR_S3_TX_EXPLICIT),x+	 IOC4_SIO_IR_S3, IOC4_GPPR_UART3_MODESEL_PIN,x+	 }x+};x+x+/* A ring buffer entry */x+struct ring_entry {x+	union {x+		struct {x+			uint32_t alldata;
+			uint32_t allsc;x+		} all;x+		struct {x+			char data[4];	/* data bytes */x+			char sc[4];	/* status/control */x+		} s;x+	} u;x+};x+x+/* Test the validxbits in any of the 4 sc chars using "allsc" member */x+#define RING_ANY_VALID \x+	((uint32_t)(IOC4_RXSB_MODEM_VALID | IOC4_RXSB_DATA_VALID) * 0x01010101)x+x+#define ring_sc     u.s.scx+#define ring_data   u.s.datax+#define ring_allsc  u.all.allscx+x+/* Number of entries per ring buffer. */x+#define ENTRIES_PER_RING (RING_BUF_SIZE / (int) sizeof(struct ring_entry))x+x+/* An individual ring */x+struct ring {x+	struct ring_entry entries[ENTRIES_PER_RING];x+};x+x+/* The whole enchilada */x+struct ring_buffer {x+	struct ring TX_0_OR_2;x+	struct ring RX_0_OR_2;x+	struct ring TX_1_OR_3;x+	struct ring RX_1_OR_3;x+};x+x+/* Get a ring from a port struct */x+#define RING(_p, _wh)	&(((struct ring_buffer *)((_p)->ip_cpu_ringbuf))->_wh)x+x+/* Infinite loopxdetection.x+ */x+#define MAXITER 10000000x+x+/* Prototypes */x+static void receive_chars(struct uart_port *);x+static void handle_intr(void *arg, uint32_t sio_ir);x+x+/**x+ * write_ireg - write the interrupt regsx+ * @ioc4_soft: ptr to soft struct for this portx+ * @val: value to writex+ * @which: which registerx+ * @type: which ireg setx+ */x+static inline void
+write_ireg(struct ioc4_soft *ioc4_soft, uint32_t val, int which, int type)x+{x+	struct ioc4_mem __iomem *mem = ioc4_soft->is_ioc4_mem_addr;x+	unsigned long flags;x+x+	spin_lock_irqsave(&ioc4_soft->is_ir_lock, flags);x+x+	switch (type) {x+	case IOC4_SIO_INTR_TYPE:x+		switch (which)x{x+		case IOC4_W_IES:x+			writel(val, &mem->sio_ies_ro);x+			break;x+x+		case IOC4_W_IEC:x+			writel(val, &mem->sio_iec_ro);x+			break;x+		}x+		break;x+x+	case IOC4_OTHER_INTR_TYPE:x+		switch (which)x{x+		case IOC4_W_IES:x+			writel(val, &mem->other_ies_ro);x+			break;x+x+		case IOC4_W_IEC:x+			writel(val, &mem->other_iec_ro);x+			break;x+		}x+		break;x+x+	default:x+		break;x+	}
+	spin_unlock_irqrestore(&ioc4_soft->is_ir_lock, flags);x+}x+x+/**x+ * set_baud - Baud rate setting codex+ * @port: port to setx+ * @baud: baud rate to usex+ */x+static int set_baud(struct ioc4_port *port, int baud)x+{x+	int actual_baud;x+	int diff;x+	int lcr;x+	unsigned short divisor;x+	struct ioc4_uartregs __iomem *uart;x+x+	divisor = SER_DIVISOR(baud, port->ip_pci_bus_speed);x+	if (!divisor)x+		return 1;
+	actual_baud = DIVISOR_TO_BAUD(divisor, port->ip_pci_bus_speed);x+x+	diff = actual_baud - baud;x+	if (diff < 0)x+		diff = -diff;x+x+	/* If we're within 1%, we've found a match */x+	if (diff * 100 > actual_baud)x+		return 1;
+x+	uart = port->ip_uart_regs;x+	lcr =xreadb(&uart->i4u_lcr);x+	writeb(lcr | UART_LCR_DLAB, &uart->i4u_lcr);x+	writeb((unsigned char)divisor, &uart->i4u_dll);x+	writeb((unsigned char)(divisor >> 8), &uart->i4u_dlm);x+	writeb(lcr, &uart->i4u_lcr);x+	return 0;x+}x+x+x+/**x+ * get_ioc4_port - given a uart port, return the control structurex+ * @port: uart portx+ */x+static struct ioc4_port *get_ioc4_port(struct uart_port *the_port)x+{x+	struct ioc4_control *control = dev_get_drvdata(the_port->dev);
+	int ii;x+x+	if (control)x{x+		for ( ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++ )x{x+			if (!control->ic_port[ii].icp_port)x+				continue;x+			if (the_port == control->ic_port[ii].icp_port->ip_port)x+				return control->ic_port[ii].icp_port;x+		}x+	}x+	return NULL;x+}x+x+/* The IOC4 hardware provides no atomic way to determine if interruptsx+ * are pending since two reads are required to do so.  The handler mustx+ * read the SIO_IR and the SIO_IES, and take the logical and of thex+ * two.  When this value is zero, all interrupts have been serviced andx+ * the handler may return.x+ *x+ * This has the unfortunate "hole" that, if some other CPU orx+ * some other thread or some higher level interrupt manages tox+ * modify SIO_IE between our reads of SIO_IR and SIO_IE, we mayx+ * think we have observed SIO_IR&SIO_IE==0 when in fact thisx+ * condition never really occurred.x+ *x+ * To solve this, we use a simple spinlock that must be heldx+ * whenever modifying SIO_IE; holding this lock while observingx+ * both SIO_IR and SIO_IE guarantees that we do not falselyx+ * conclude that no enabled interrupts are pending.x+ */x+x+static inline uint32_t
+pending_intrs(struct ioc4_soft *soft, int type)x+{x+	struct ioc4_mem __iomem *mem = soft->is_ioc4_mem_addr;x+	unsigned long flag;x+	uint32_t intrs = 0;x+x+	BUG_ON(!((type == IOC4_SIO_INTR_TYPE)x+	       || (type == IOC4_OTHER_INTR_TYPE)));x+x+	spin_lock_irqsave(&soft->is_ir_lock, flag);x+x+	switch (type) {x+	case IOC4_SIO_INTR_TYPE:x+		intrs = readl(&mem->sio_ir) & readl(&mem->sio_ies_ro);x+		break;x+x+	case IOC4_OTHER_INTR_TYPE:x+		intrs = readl(&mem->other_ir) & readl(&mem->other_ies_ro);x+x+		/* Don't process any ATA interrupte */x+		intrs &= ~(IOC4_OTHER_IR_ATA_INT | IOC4_OTHER_IR_ATA_MEMERR);x+		break;x+x+	default:x+		break;x+	}
+	spin_unlock_irqrestore(&soft->is_ir_lock, flag);x+	return intrs;x+}x+x+/**x+ * port_init - Initializexthe sio and ioc4 hardware for a given portx+ *			called per port from attach...x+ * @port: port to initializex+ */x+static int inline port_init(struct ioc4_port *port)x+{x+	uint32_t sio_cr;x+	struct hooks *hooks = port->ip_hooks;x+	struct ioc4_uartregs __iomem *uart;x+x+	/* Idle the IOC4 serial interface */x+	writel(IOC4_SSCR_RESET, &port->ip_serial_regs->sscr);x+x+	/* Wait until any pending busxactivity for this port has ceased */x+	dox+		sio_cr = readl(&port->ip_mem->sio_cr);x+	while (!(sio_cr & IOC4_SIO_CR_SIO_DIAG_IDLE));x+x+	/* Finish reset sequence */x+	writel(0, &port->ip_serial_regs->sscr);x+x+	/* Once RESET is done, reload cached tx_prod and rx_cons valuesx+	 * and set rings to empty by making prod == consx+	 */x+	port->ip_tx_prod = readl(&port->ip_serial_regs->stcir) & PROD_CONS_MASK;x+	writel(port->ip_tx_prod, &port->ip_serial_regs->stpir);
+	port->ip_rx_cons = readl(&port->ip_serial_regs->srpir) & PROD_CONS_MASK;x+	writel(port->ip_rx_cons, &port->ip_serial_regs->srcir);x+x+	/* Disable interrupts for this 16550 */x+	uart = port->ip_uart_regs;x+	writeb(0, &uart->i4u_lcr);x+	writeb(0, &uart->i4u_ier);x+x+	/* Set the default baud */x+	set_baud(port, port->ip_baud);x+x+	/* Set line control to 8xbits no parity */x+	writeb(UART_LCR_WLEN8 | 0, &uart->i4u_lcr);x+					/* UART_LCR_STOP == 1 stop */x+x+	/* Enable the FIFOs */x+	writeb(UART_FCR_ENABLE_FIFO, &uart->i4u_fcr);x+	/* then reset 16550 FIFOs */x+	writeb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,x+			&uart->i4u_fcr);x+x+	/* Clear modem control register */x+	writeb(0, &uart->i4u_mcr);x+x+	/* Clear deltas in modem status register */x+	readb(&uart->i4u_msr);x+x+	/* Only do this once per port pair */x+	if (port->ip_hooks == &hooks_array[0]x+			    || port->ip_hooks == &hooks_array[2])x{x+		unsigned long ring_pci_addr;x+		uint32_t __iomem *sbbr_l;x+		uint32_t __iomem *sbbr_h;x+x+		if (port->ip_hooks == &hooks_array[0])x{x+			sbbr_l = &port->ip_serial->sbbr01_l;x+			sbbr_h = &port->ip_serial->sbbr01_h;x+		} else {x+			sbbr_l = &port->ip_serial->sbbr23_l;x+			sbbr_h = &port->ip_serial->sbbr23_h;x+		}x+x+		ring_pci_addr = (unsigned long __iomem)port->ip_dma_ringbuf;x+		DPRINT_CONFIG(("%s: ring_pci_addr 0x%lx\n",x+					__FUNCTION__, ring_pci_addr));x+x+		writel((unsigned int)((uint64_t)ring_pci_addr >> 32), sbbr_h);x+		writel((unsigned int)ring_pci_addr | IOC4_BUF_SIZE_BIT, sbbr_l);
+	}
+x+	/* Set the receive timeout value to 10 msec */x+	writel(IOC4_SRTR_HZ / 100, &port->ip_serial_regs->srtr);x+x+	/* Set rx threshold, enable DMA */x+	/* Set high water mark at 3/4 of full ring */x+	port->ip_sscr = (ENTRIES_PER_RING * 3 / 4);x+	writel(port->ip_sscr, &port->ip_serial_regs->sscr);x+x+	/* Disable and clear all serial related interrupt bits */x+	write_ireg(port->ip_ioc4_soft, hooks->intr_clear,x+		       IOC4_W_IEC, IOC4_SIO_INTR_TYPE);
+	port->ip_ienb &= ~hooks->intr_clear;x+	writel(hooks->intr_clear, &port->ip_mem->sio_ir);x+	return 0;x+}x+x+/**x+ * handle_dma_error_intr - service any pending DMA error interrupts for thex+ *			given port - 2nd level called via sd_intrx+ * @arg: handler argx+ * @other_ir: ioc4regsx+ */x+static void handle_dma_error_intr(void *arg, uint32_t other_ir)x+{x+	struct ioc4_port *port = (struct ioc4_port *)arg;x+	struct hooks *hooks = port->ip_hooks;x+	unsigned int flags;x+x+	spin_lock_irqsave(&port->ip_lock, flags);x+x+	/* ACK the interrupt */x+	writel(hooks->intr_dma_error, &port->ip_mem->other_ir);x+x+	if (readl(&port->ip_mem->pci_err_addr_l) & IOC4_PCI_ERR_ADDR_VLD)x{x+		printk(KERN_ERRx+			"PCI error address is 0x%lx, "x+				"master is serial port %c %s\n",x+		     (((uint64_t)readl(&port->ip_mem->pci_err_addr_h)x+							 << 32)x+				| readl(&port->ip_mem->pci_err_addr_l))x+					& IOC4_PCI_ERR_ADDR_ADDR_MSK, '1' +x+		     ((char)(readl(&port->ip_mem-> pci_err_addr_l) &x+			     IOC4_PCI_ERR_ADDR_MST_NUM_MSK) >> 1),x+		     (readl(&port->ip_mem->pci_err_addr_l)x+				& IOC4_PCI_ERR_ADDR_MST_TYP_MSK)x+				? "RX" : "TX");x+x+		if (readl(&port->ip_mem->pci_err_addr_l)x+						& IOC4_PCI_ERR_ADDR_MUL_ERR)x{x+			printk(KERN_ERRx+				"Multiple errors occurred\n");x+		}x+	}x+	spin_unlock_irqrestore(&port->ip_lock, flags);x+x+	/* Re-enable DMA error interrupts */x+	write_ireg(port->ip_ioc4_soft, hooks->intr_dma_error, IOC4_W_IES,x+						IOC4_OTHER_INTR_TYPE);x+}x+x+/**x+ * intr_connect - interrupt connect functionx+ * @soft: soft struct for this cardx+ * @type: interrupt typex+ * @intrbits: bit pattern to setx+ * @intr: handler functionx+ * @info: handler argx+ */x+static void
+intr_connect(struct ioc4_soft *soft, int type,x+		  uint32_t intrbits, ioc4_intr_func_f * intr, void *info)x+{x+	int i;x+	struct ioc4_intr_info *intr_ptr;x+x+	BUG_ON(!((type == IOC4_SIO_INTR_TYPE)x+	       || (type == IOC4_OTHER_INTR_TYPE)));x+x+	i = atomic_inc(&soft-> is_intr_type[type].is_num_intrs) - 1;
+	BUG_ON(!(i < MAX_IOC4_INTR_ENTS || (printk("i %d\n", i), 0)));x+x+	/* Save off the lower level interrupt handler */x+	intr_ptr = &soft->is_intr_type[type].is_intr_info[i];x+	intr_ptr->sd_bits = intrbits;x+	intr_ptr->sd_intr = intr;x+	intr_ptr->sd_info = info;x+}x+x+/**x+ * ioc4_intr - Top level IOC4 interrupt handler.x+ * @irq: irq valuex+ * @arg: handler argx+ * @regs: registersx+ */x+static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs)x+{x+	struct ioc4_soft *soft;x+	uint32_t this_ir, this_mir;x+	int xx, num_intrs = 0;x+	int intr_type;x+	int handled = 0;x+	struct ioc4_intr_info *ii;x+x+	soft = arg;x+	for (intr_type = 0; intr_type < IOC4_NUM_INTR_TYPES; intr_type++)x{x+		num_intrs = (int)atomic_read(x+				&soft->is_intr_type[intr_type].is_num_intrs);x+x+		this_mir = this_ir = pending_intrs(soft, intr_type);x+x+		/* Farm out the interrupt to the various drivers depending onx+		 * which interrupt bits are set.x+		 */x+		for (xx = 0; xx < num_intrs; xx++)x{x+			ii = &soft->is_intr_type[intr_type].is_intr_info[xx];x+			if ((this_mir = this_ir & ii->sd_bits))x{x+				/* Disable owned interrupts, call handler */x+				handled++;x+				write_ireg(soft, ii->sd_bits, IOC4_W_IEC,x+								intr_type);x+				ii->sd_intr(ii->sd_info, this_mir);x+				this_ir &= ~this_mir;x+			}x+		}x+		if (this_ir)x{x+			printk(KERN_ERRx+			       "unknown IOC4 %s interrupt 0x%x, sio_ir = 0x%x,"x+				" sio_ies = 0x%x, other_ir = 0x%x :"x+				"other_ies = 0x%x\n",x+			       (intr_type == IOC4_SIO_INTR_TYPE) ? "sio" :x+			       "other", this_ir,x+			       readl(&soft->is_ioc4_mem_addr->sio_ir),x+			       readl(&soft->is_ioc4_mem_addr->sio_ies_ro),x+			       readl(&soft->is_ioc4_mem_addr->other_ir),x+			       readl(&soft->is_ioc4_mem_addr->other_ies_ro));x+		}x+	}x+#ifdef DEBUG_INTERRUPTSx+	{x+		struct ioc4_mem __iomem *mem = soft->is_ioc4_mem_addr;x+		spinlock_t *lp = &soft->is_ir_lock;x+		unsigned long flag;x+x+		spin_lock_irqsave(&soft->is_ir_lock, flag);x+		printk ("%s : %d : mem 0x%p sio_ir 0x%x sio_ies_ro 0x%x "x+				"other_ir 0x%x other_ies_ro 0x%x mask 0x%x\n",x+		     __FUNCTION__, __LINE__,x+		     (void *)mem, readl(&mem->sio_ir),x+		     readl(&mem->sio_ies_ro),x+		     readl(&mem->other_ir),x+		     readl(&mem->other_ies_ro),x+		     IOC4_OTHER_IR_ATA_INT | IOC4_OTHER_IR_ATA_MEMERR);x+		spin_unlock_irqrestore(&soft->is_ir_lock, flag);x+	}x+#endifx+	return handled ? IRQ_HANDLED : IRQ_NONE;x+}x+x+/**x+ * ioc4_attach_local - Device initialization.x+ *			Called at *_attach() time for eachx+ *			IOC4 with serial ports in the system.x+ * @control: ioc4_control ptrx+ * @pdev: PCI handle for this devicex+ * @soft: soft struct for this devicex+ * @ioc4: ioc4 mem spacex+ */x+static int inline ioc4_attach_local(struct pci_devx*pdev,x+			struct ioc4_control *control,x+			struct ioc4_soft *soft, void __iomem *ioc4_mem,x+			void __iomem *ioc4_serial)x+{x+	struct ioc4_port *port;x+	struct ioc4_port *ports[IOC4_NUM_SERIAL_PORTS];x+	int port_number;x+	uint16_t ioc4_revid_min = 62;x+	uint16_t ioc4_revid;x+x+	/* IOC4 firmware must be at least rev 62 */x+	pci_read_config_word(pdev, PCI_COMMAND_SPECIAL, &ioc4_revid);x+x+	printk(KERN_INFO "IOC4 firmware revision %d\n", ioc4_revid);x+	if (ioc4_revid < ioc4_revid_min)x{x+		printk(KERN_WARNINGx+		    "IOC4 serial not supported on firmware rev %d, "x+				"please upgrade to rev %d or higher\n",x+				ioc4_revid, ioc4_revid_min);x+		return -EPERM;x+	}
+	BUG_ON(ioc4_mem == NULL);
+	BUG_ON(ioc4_serial == NULL);
+x+	/* Create port structures for each port */x+	for (port_number = 0; port_number < IOC4_NUM_SERIAL_PORTS;x+							port_number++)x{x+		port = kmalloc(sizeof(struct ioc4_port), GFP_KERNEL);
+		if (!port)x{x+			printk(KERN_WARNINGx+				"IOC4 serial memory not available for port\n");x+			return -ENOMEM;x+		}x+		memset(port, 0, sizeof(struct ioc4_port));x+x+		/* we need to remember the previous ones, to point back tox+		 * them farther down - setting up the ring buffers.x+		 */x+		ports[port_number] = port;x+x+		/* Allocate buffers and jumpstart the hardware.  */x+		control->ic_port[port_number].icp_port = port;x+		port->ip_ioc4_soft = soft;x+		port->ip_pdev = pdev;x+		port->ip_ienb = 0;x+		port->ip_pci_bus_speed = IOC4_SER_XIN_CLK;x+		port->ip_baud = 9600;x+		port->ip_control = control;x+		port->ip_mem = ioc4_mem;x+		port->ip_serial = ioc4_serial;x+x+		/* point to the right hook */x+		port->ip_hooks = &hooks_array[port_number];x+x+		/* Get direct hooks to the serial regs and uart regsx+		 * for this portx+		 */x+		switch (port_number)x{x+		case 0:x+			port->ip_serial_regs = &(port->ip_serial->port_0);x+			port->ip_uart_regs = &(port->ip_serial->uart_0);x+			break;x+		case 1:x+			port->ip_serial_regs = &(port->ip_serial->port_1);x+			port->ip_uart_regs = &(port->ip_serial->uart_1);x+			break;x+		case 2:x+			port->ip_serial_regs = &(port->ip_serial->port_2);x+			port->ip_uart_regs = &(port->ip_serial->uart_2);x+			break;x+		default:x+		case 3:x+			port->ip_serial_regs = &(port->ip_serial->port_3);x+			port->ip_uart_regs = &(port->ip_serial->uart_3);x+			break;x+		}x+x+		/* ring buffers are 1 to a pair of ports */x+		if (port_number && (port_number & 1))x{x+			/* odd use the evens buffer */x+			port->ip_dma_ringbuf =x+					ports[port_number - 1]->ip_dma_ringbuf;x+			port->ip_cpu_ringbuf =x+					ports[port_number - 1]->ip_cpu_ringbuf;x+			port->ip_inring = RING(port, RX_1_OR_3);x+			port->ip_outring = RING(port, TX_1_OR_3);x+x+		} else {x+			if (port->ip_dma_ringbuf == 0)x{x+				port->ip_cpu_ringbuf = pci_alloc_consistentx+					(pdev, TOTAL_RING_BUF_SIZE,x+					&port->ip_dma_ringbuf);x+x+			}x+			BUG_ON(!((((int64_t)port->ip_dma_ringbuf) &x+				(TOTAL_RING_BUF_SIZE - 1))x== 0));x+			DPRINT_CONFIG(("%s : ip_cpu_ringbuf 0x%p "x+						"ip_dma_ringbuf 0x%p\n",x+					__FUNCTION__,x+					(void *)port->ip_cpu_ringbuf,x+					(void *)port->ip_dma_ringbuf));x+			port->ip_inring = RING(port, RX_0_OR_2);x+			port->ip_outring = RING(port, TX_0_OR_2);x+		}x+		DPRINT_CONFIG(("%s : port %d [addr 0x%p] control 0x%p",x+				__FUNCTION__,x+				port_number, (void *)port, (void *)control));x+		DPRINT_CONFIG((" ip_serial_regs 0x%p ip_uart_regs 0x%p\n",x+				(void *)port->ip_serial_regs,x+				(void *)port->ip_uart_regs));x+x+		/* Initializexthe hardware for IOC4 */x+		port_init(port);x+x+		DPRINT_CONFIG(("%s: port_number %d port 0x%p inring 0x%p "x+						"outring 0x%p\n",x+				__FUNCTION__,x+				port_number, (void *)port,x+				(void *)port->ip_inring,x+				(void *)port->ip_outring));x+x+		/* Attach interrupt handlers */x+		intr_connect(soft, IOC4_SIO_INTR_TYPE,x+				GET_SIO_IR(port_number),x+				handle_intr, port);x+x+		intr_connect(soft, IOC4_OTHER_INTR_TYPE,x+				GET_OTHER_IR(port_number),x+				handle_dma_error_intr, port);x+	}x+	return 0;x+}x+x+/**x+ * enable_intrs - enable interruptsx+ * @port: port to enablex+ * @mask: mask to usex+ */x+static void enable_intrs(struct ioc4_port *port, uint32_t mask)x+{x+	struct hooks *hooks = port->ip_hooks;x+x+	if ((port->ip_ienb & mask) != mask) {x+		write_ireg(port->ip_ioc4_soft, mask, IOC4_W_IES,x+						IOC4_SIO_INTR_TYPE);
+		port->ip_ienb |= mask;
+	}
+x+	if (port->ip_ienb)x+		write_ireg(port->ip_ioc4_soft, hooks->intr_dma_error,x+				IOC4_W_IES, IOC4_OTHER_INTR_TYPE);x+}x+x+/**x+ * local_open - local open a portx+ * @port: port to openx+ */x+static inline int local_open(struct ioc4_port *port)x+{x+	int spiniter = 0;x+x+	port->ip_flags = 0;x+x+	/* Pause the DMA interface if necessary */x+	if (port->ip_sscr & IOC4_SSCR_DMA_EN) {x+		writel(port->ip_sscr | IOC4_SSCR_DMA_PAUSE,x+			&port->ip_serial_regs->sscr);x+		while((readl(&port->ip_serial_regs-> sscr)x+				& IOC4_SSCR_PAUSE_STATE) == 0)x{x+			spiniter++;x+			if (spiniter > MAXITER)x{x+				return -1;x+			}x+		}x+	}x+x+	/* Reset the input fifo.  If the uart received chars while the port
+	 * was closed and DMA is not enabled, the uart may have a bunch of
+	 * chars hanging around in its rx fifo which will not be discarded
+	 * by rclr in the upper layer. We must get rid of them here.x+	 */x+	writeb(UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR,x+				&port->ip_uart_regs->i4u_fcr);x+x+	writeb(UART_LCR_WLEN8, &port->ip_uart_regs->i4u_lcr);x+					/* UART_LCR_STOP == 1 stop */x+x+	/* Re-enable DMA, set default threshold to intr whenever there isx+	 * data available.x+	 */x+	port->ip_sscr &= ~IOC4_SSCR_RX_THRESHOLD;x+	port->ip_sscr |= 1;	/* default threshold */x+x+	/* Plug in the new sscr.  This implicitly clears the DMA_PAUSEx+	 * flag if it was set abovex+	 */x+	writel(port->ip_sscr, &port->ip_serial_regs->sscr);x+	port->ip_tx_lowat = 1;
+	return 0;x+}x+x+/**x+ * set_rx_timeout - Set rx timeout and threshold values.x+ * @port: port to usex+ * @timeout: timeout value in ticksx+ */x+static inline int set_rx_timeout(struct ioc4_port *port, int timeout)x+{x+	int threshold;x+x+	port->ip_rx_timeout = timeout;x+x+	/* Timeout is in ticks.  Let's figure out how many chars we
+	 * can receive at the current baud rate in that intervalx+	 * and set the rx threshold to that amount.  There are 4 charsx+	 * per ring entry, so we'll divide the number of chars that willx+	 * arrive in timeout by 4.x+	 */x+	threshold = timeout * port->ip_baud / 10 / HZ / 4;x+	if (threshold == 0)x+		threshold = 1;	/* otherwise we'll intr all the time! */x+x+	if ((unsigned)threshold > (unsigned)IOC4_SSCR_RX_THRESHOLD)x+		return 1;
+x+	port->ip_sscr &= ~IOC4_SSCR_RX_THRESHOLD;x+	port->ip_sscr |= threshold;x+x+	writel(port->ip_sscr, &port->ip_serial_regs->sscr);x+x+	/* Now set the rx timeout to the given value */x+	timeout = timeout * IOC4_SRTR_HZ / HZ;x+	if (timeout > IOC4_SRTR_CNT)x+		timeout = IOC4_SRTR_CNT;x+x+	writel(timeout, &port->ip_serial_regs->srtr);x+	return 0;x+}x+x+/**x+ * config_port - configxthe hardwarex+ * @port: port to configx+ * @baud: baud rate for the portx+ * @byte_size: data sizex+ * @stop_bits: number of stop bitsx+ * @parenb: parity enable ?x+ * @parodd: odd parity ?x+ */x+static inline int
+config_port(struct ioc4_port *port,x+	    int baud, int byte_size, int stop_bits, int parenb, int parodd)x+{x+	char lcr, sizebits;x+	int spiniter = 0;x+x+	DPRINT_CONFIG(("%s: baud %d byte_size %d stop %d parenb %d parodd %d\n",x+		__FUNCTION__, baud, byte_size, stop_bits, parenb, parodd));x+x+	if (set_baud(port, baud))x+		return 1;
+x+	switch (byte_size) {x+	case 5:x+		sizebits = UART_LCR_WLEN5;x+		break;x+	case 6:x+		sizebits = UART_LCR_WLEN6;x+		break;x+	case 7:x+		sizebits = UART_LCR_WLEN7;x+		break;x+	case 8:x+		sizebits = UART_LCR_WLEN8;x+		break;x+	default:x+		return 1;
+	}x+x+	/* Pause the DMA interface if necessary */x+	if (port->ip_sscr & IOC4_SSCR_DMA_EN) {x+		writel(port->ip_sscr | IOC4_SSCR_DMA_PAUSE,x+			&port->ip_serial_regs->sscr);x+		while((readl(&port->ip_serial_regs->sscr)x+						& IOC4_SSCR_PAUSE_STATE) == 0)x{x+			spiniter++;x+			if (spiniter > MAXITER)x+				return -1;x+		}x+	}x+x+	/* Clear relevant fields in lcr */x+	lcr =xreadb(&port->ip_uart_regs->i4u_lcr);x+	lcr &= ~(LCR_MASK_BITS_CHAR | UART_LCR_EPAR |x+		 UART_LCR_PARITY | LCR_MASK_STOP_BITS);x+x+	/* Set byte size in lcr */x+	lcr |= sizebits;x+x+	/* Set parity */x+	if (parenb)x{x+		lcr |= UART_LCR_PARITY;
+		if (!parodd)x+			lcr |= UART_LCR_EPAR;
+	}
+x+	/* Set stop bits */x+	if (stop_bits)x+		lcr |= UART_LCR_STOP /* 2 stop bits */ ;x+x+	writeb(lcr, &port->ip_uart_regs->i4u_lcr);x+x+	/* Re-enable the DMA interface if necessary */x+	if (port->ip_sscr & IOC4_SSCR_DMA_EN) {x+		writel(port->ip_sscr, &port->ip_serial_regs->sscr);x+	}x+	port->ip_baud = baud;x+x+	/* When we get within this number of ring entries of filling thex+	 * entire ring on tx, place an EXPLICIT intr to generate a lowatx+	 * notification when output has drained.x+	 */x+	port->ip_tx_lowat = (TX_LOWAT_CHARS(baud) + 3) / 4;x+	if (port->ip_tx_lowat == 0)x+		port->ip_tx_lowat = 1;
+x+	set_rx_timeout(port, port->ip_rx_timeout);x+x+	return 0;x+}x+x+/**x+ * do_write - Write bytes to the port.  Returns the number of bytesx+ *			actually written. Called from transmit_charsx+ * @port: port to usex+ * @buf: the stuff to writex+ * @len: how many bytes in 'buf'x+ */x+static inline int do_write(struct ioc4_port *port, char *buf, int len)x+{x+	int prod_ptr, cons_ptr, total = 0;x+	struct ring *outring;x+	struct ring_entry *entry;x+	struct hooks *hooks = port->ip_hooks;x+x+	BUG_ON(!(len >= 0));x+x+	prod_ptr = port->ip_tx_prod;x+	cons_ptr = readl(&port->ip_serial_regs->stcir) & PROD_CONS_MASK;x+	outring = port->ip_outring;x+x+	/* Maintain a 1-entry red-zone.  The ring buffer is full whenx+	 * (cons - prod) % ring_size is 1.  Rather than do this subtractionx+	 * in the body of the loop, I'll do it now.x+	 */x+	cons_ptr = (cons_ptr - (int)sizeof(struct ring_entry)) & PROD_CONS_MASK;x+x+	/* Stuff the bytes into the output */x+	while ((prod_ptr != cons_ptr) && (len > 0)) {x+		int xx;x+x+		/* Get 4 bytes (one ring entry) at a time */x+		entry = (struct ring_entry *)((caddr_t) outring + prod_ptr);x+x+		/* Invalidate all entries */x+		entry->ring_allsc = 0;x+x+		/* Copy in some bytes */x+		for (xx = 0; (xx < 4) && (len > 0); xx++)x{x+			entry->ring_data[xx] = *buf++;x+			entry->ring_sc[xx] = IOC4_TXCB_VALID;x+			len--;x+			total++;x+		}x+x+		/* If we are within some small threshold of filling up thex+		 * entire ring buffer, we must place an EXPLICIT intr herex+		 * to generate a lowat interrupt in case we subsequentlyx+		 * really do fill up the ring and the caller goes to sleep.x+		 * No need to place more than one though.x+		 */x+		if (!(port->ip_flags & LOWAT_WRITTEN) &&x+			((cons_ptr - prod_ptr) & PROD_CONS_MASK)x+				<= port->ip_tx_lowatx+					* (int)sizeof(struct ring_entry)) {x+			port->ip_flags |= LOWAT_WRITTEN;x+			entry->ring_sc[0] |= IOC4_TXCB_INT_WHEN_DONE;x+		}x+x+		/* Go on to next entry */x+		prod_ptr += sizeof(struct ring_entry);x+		prod_ptr &= PROD_CONS_MASK;x+	}x+x+	/* If we sent something, start DMA if necessary */x+	if (total > 0 && !(port->ip_sscr & IOC4_SSCR_DMA_EN))x{x+		port->ip_sscr |= IOC4_SSCR_DMA_EN;x+		writel(port->ip_sscr, &port->ip_serial_regs->sscr);x+	}x+x+	/* Store the new producer pointer.  If tx is disabled, we stuff thex+	 * data into the ring buffer, but we don't actually start tx.x+	 */x+	if (!uart_tx_stopped(port->ip_port)) {x+		writel(prod_ptr, &port->ip_serial_regs->stpir);
+x+		/* If we are now transmitting, enable tx_mt interrupt so wex+		 * can disable DMA if necessary when the tx finishes.x+		 */x+		if (total > 0)x+			enable_intrs(port, hooks->intr_tx_mt);x+	}x+	port->ip_tx_prod = prod_ptr;x+	return total;x+}x+x+/**x+ * disable_intrs - disable interruptsx+ * @port: port to enablex+ * @mask: mask to usex+ */x+static void disable_intrs(struct ioc4_port *port, uint32_t mask)x+{x+	struct hooks *hooks = port->ip_hooks;x+x+	if (port->ip_ienb & mask) {x+		write_ireg(port->ip_ioc4_soft, mask, IOC4_W_IEC,x+					IOC4_SIO_INTR_TYPE);
+		port->ip_ienb &= ~mask;
+	}
+x+	if (!port->ip_ienb)x+		write_ireg(port->ip_ioc4_soft, hooks->intr_dma_error,x+				IOC4_W_IEC, IOC4_OTHER_INTR_TYPE);x+}x+x+/**x+ * set_notification - Modify event notificationx+ * @port: port to usex+ * @mask: events maskx+ * @set_on: set ?x+ */x+static int set_notification(struct ioc4_port *port, int mask, int set_on)x+{x+	struct hooks *hooks = port->ip_hooks;x+	uint32_t intrbits, sscrbits;x+x+	BUG_ON(!mask);x+x+	intrbits = sscrbits = 0;x+x+	if (mask & N_DATA_READY)x+		intrbits |= (hooks->intr_rx_timer | hooks->intr_rx_high);x+	if (mask & N_OUTPUT_LOWAT)x+		intrbits |= hooks->intr_tx_explicit;x+	if (mask & N_DDCD) {x+		intrbits |= hooks->intr_delta_dcd;x+		sscrbits |= IOC4_SSCR_RX_RING_DCD;x+	}x+	if (mask & N_DCTS)x+		intrbits |= hooks->intr_delta_cts;x+x+	if (set_on)x{x+		enable_intrs(port, intrbits);
+		port->ip_notify |= mask;
+		port->ip_sscr |= sscrbits;x+	} else {x+		disable_intrs(port, intrbits);
+		port->ip_notify &= ~mask;
+		port->ip_sscr &= ~sscrbits;x+	}x+x+	/* We require DMA if either DATA_READY or DDCD notification isx+	 * currently requested. If neither of these is requested andx+	 * there is currently no tx in progress, DMA may be disabled.x+	 */x+	if (port->ip_notify & (N_DATA_READY | N_DDCD))x+		port->ip_sscr |= IOC4_SSCR_DMA_EN;x+	else if (!(port->ip_ienb & hooks->intr_tx_mt))
+		port->ip_sscr &= ~IOC4_SSCR_DMA_EN;x+x+	writel(port->ip_sscr, &port->ip_serial_regs->sscr);x+	return 0;x+}x+x+/**x+ * set_mcr - set the master control regx+ * @the_port: port to usex+ * @set: set ?x+ * @mask1: mcr maskx+ * @mask2: shadow maskx+ */x+static inline int set_mcr(struct uart_port *the_port, int set,x+		int mask1, int mask2)x+{x+	struct ioc4_port *port = get_ioc4_port(the_port);x+	uint32_t shadow;x+	int spiniter = 0;x+	char mcr;
+x+	if (!port)x+		return -1;x+x+	/* Pause the DMA interface if necessary */x+	if (port->ip_sscr & IOC4_SSCR_DMA_EN) {x+		writel(port->ip_sscr | IOC4_SSCR_DMA_PAUSE,x+			&port->ip_serial_regs->sscr);x+		while ((readl(&port->ip_serial_regs->sscr)x+					& IOC4_SSCR_PAUSE_STATE) == 0)x{x+			spiniter++;x+			if (spiniter > MAXITER)x+				return -1;x+		}x+	}x+	shadow = readl(&port->ip_serial_regs->shadow);x+	mcr = (shadow & 0xff000000) >> 24;x+x+	/* Set new value */x+	if (set)x{x+		mcr |= mask1;x+		shadow |= mask2;x+	} else {x+		mcr &= ~mask1;x+		shadow &= ~mask2;x+	}x+	writeb(mcr, &port->ip_uart_regs->i4u_mcr);x+	writel(shadow, &port->ip_serial_regs->shadow);x+x+	/* Re-enable the DMA interface if necessary */x+	if (port->ip_sscr & IOC4_SSCR_DMA_EN) {x+		writel(port->ip_sscr, &port->ip_serial_regs->sscr);x+	}x+	return 0;x+}x+x+/**x+ * ioc4_set_proto - set the protocol for the portx+ * @port: port to usex+ * @proto: protocol to usex+ */x+static int ioc4_set_proto(struct ioc4_port *port, enum sio_proto proto)x+{x+	struct hooks *hooks = port->ip_hooks;x+x+	switch (proto) {x+	case PROTO_RS232:x+		/* Clear the appropriate GIO pin */x+		writel(0, (&port->ip_mem->gppr_0 +x+				  hooks->rs422_select_pin));x+		break;x+x+	case PROTO_RS422:x+		/* Set the appropriate GIO pin */x+		writel(1, (&port->ip_mem->gppr_0 +x+				  hooks->rs422_select_pin));x+		break;x+x+	default:x+		return 1;
+	}x+	return 0;x+}x+x+/**x+ * transmit_chars - upper level write, called with ip_lockx+ * @the_port: port to writex+ */x+static void transmit_chars(struct uart_port *the_port)x+{x+	int xmit_count, tail, head;x+	int result;x+	char *start;x+	struct tty_struct *tty;x+	struct ioc4_port *port = get_ioc4_port(the_port);x+	struct uart_info *info;x+x+	if (!the_port)x+		return;x+	if (!port)x+		return;x+x+	info = the_port->info;x+	tty = info->tty;x+x+	if (uart_circ_empty(&info->xmit) || uart_tx_stopped(the_port)) {x+		/* Nothing to do or hw stopped */x+		set_notification(port, N_ALL_OUTPUT, 0);x+		return;x+	}x+x+	head = info->xmit.head;x+	tail = info->xmit.tail;x+	start = (char *)&info->xmit.buf[tail];x+x+	/* write out all the data or until the end of the buffer */x+	xmit_count = (head < tail) ? (UART_XMIT_SIZE - tail) : (head - tail);x+	if (xmit_count > 0)x{x+		result = do_write(port, start, xmit_count);
+		if (result > 0)x{x+			/* booking */x+			xmit_count -= result;x+			the_port->icount.tx += result;x+			/* advance the pointers */x+			tail += result;x+			tail &= UART_XMIT_SIZE - 1;x+			info->xmit.tail = tail;x+			start = (char *)&info->xmit.buf[tail];x+		}x+	}x+	if (uart_circ_chars_pending(&info->xmit) < WAKEUP_CHARS)x+		uart_write_wakeup(the_port);x+x+	if (uart_circ_empty(&info->xmit))x{x+		set_notification(port, N_OUTPUT_LOWAT, 0);x+	} else {x+		set_notification(port, N_OUTPUT_LOWAT, 1);x+	}x+}x+x+/**x+ * ioc4_change_speed - change the speed of the portx+ * @the_port: port to changex+ * @new_termios: new termios settingsx+ * @old_termios: old termios settingsx+ */x+static void
+ioc4_change_speed(struct uart_port *the_port,x+		  struct termios *new_termios, struct termios *old_termios)x+{x+	struct ioc4_port *port = get_ioc4_port(the_port);x+	int baud, bits;x+	unsigned cflag, cval;x+	int new_parity = 0, new_parity_enable = 0, new_stop = 1, new_data = 8;x+	struct uart_info *info = the_port->info;x+x+	cflag = new_termios->c_cflag;x+x+	switch (cflag & CSIZE) {x+	case CS5:x+		new_data = 5;x+		cval = 0x00;x+		bits = 7;x+		break;x+	case CS6:x+		new_data = 6;x+		cval = 0x01;x+		bits = 8;x+		break;x+	case CS7:x+		new_data = 7;x+		cval = 0x02;x+		bits = 9;x+		break;x+	case CS8:x+		new_data = 8;x+		cval = 0x03;x+		bits = 10;x+		break;x+	default:x+		/* cuz we always need a default ... */x+		new_data = 5;x+		cval = 0x00;x+		bits = 7;x+		break;x+	}x+	if (cflag & CSTOPB)x{x+		cval |= 0x04;x+		bits++;x+		new_stop = 1;x+	}x+	if (cflag & PARENB)x{x+		cval |= UART_LCR_PARITY;
+		bits++;x+		new_parity_enable = 1;x+	}x+	if (cflag & PARODD)x{x+		cval |= UART_LCR_EPAR;
+		new_parity = 1;x+	}x+	if (cflag & IGNPAR)x{x+		cval &= ~UART_LCR_PARITY;
+		new_parity_enable = 0;x+	}x+	baud = uart_get_baud_rate(the_port, new_termios, old_termios,x+				MIN_BAUD_SUPPORTED, MAX_BAUD_SUPPORTED);x+	DPRINT_CONFIG(("%s: returned baud %d\n", __FUNCTION__, baud));x+x+	/* default is 9600 */x+	if (!baud)x+		baud = 9600;x+x+	if (!the_port->fifosize)x+		the_port->fifosize = IOC4_MAX_CHARS;x+	the_port->timeout = ((the_port->fifosize * HZ * bits) / (baud / 10));x+	the_port->timeout += HZ / 50;	/* Add .02 seconds of slop */x+x+	the_port->ignore_status_mask = N_ALL_INPUT;x+x+	if (I_IGNPAR(info->tty))x+		the_port->ignore_status_mask &= ~(N_PARITY_ERRORx+						| N_FRAMING_ERROR);x+	if (I_IGNBRK(info->tty))x{x+		the_port->ignore_status_mask &= ~N_BREAK;
+		if (I_IGNPAR(info->tty))x+			the_port->ignore_status_mask &= ~N_OVERRUN_ERROR;x+	}x+	if (!(cflag & CREAD)) {x+		/* ignore everything */x+		the_port->ignore_status_mask &= ~N_DATA_READY;
+	}
+x+	if (cflag & CRTSCTS)x+		info->flags |= ASYNC_CTS_FLOW;x+	elsex+		info->flags &= ~ASYNC_CTS_FLOW;x+x+	/* Set the configuration and proper notification call */x+	DPRINT_CONFIG(("%s : port 0x%p cflag 0%o "x+		"config_port(baud %d data %d stop %d p enable %d parity %d),"x+		" notification 0x%x\n",x+	     __FUNCTION__, (void *)port, cflag, baud, new_data, new_stop,x+	     new_parity_enable, new_parity, the_port->ignore_status_mask));x+x+	if ((config_port(port, baud,		/* baud */x+			 new_data,		/* byte size */x+			 new_stop,		/* stop bits */x+			 new_parity_enable,	/* set parity */x+			 new_parity)) >= 0)x{	/* parity 1==odd */x+		set_notification(port, the_port->ignore_status_mask, 1);x+	}x+}x+x+/**x+ * ic4_startup_local - Start up the serial port - returns >= 0 if no errorsx+ * @the_port: Port to operate onx+ */x+static inline int ic4_startup_local(struct uart_port *the_port)x+{x+	int retval = 0;x+	struct ioc4_port *port;x+	struct uart_info *info;x+x+	if (!the_port)x+		return -1;x+x+	port = get_ioc4_port(the_port);x+	if (!port)x+		return -1;x+x+	info = the_port->info;x+	if (info->flags & UIF_INITIALIZED)x{x+		return retval;
+	}
+x+	if (info->tty) {x+		set_bit(TTY_IO_ERROR, &info->tty->flags);
+		clear_bit(TTY_IO_ERROR, &info->tty->flags);
+		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)x+			info->tty->alt_speed = 57600;x+		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)x+			info->tty->alt_speed = 115200;x+		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_SHI)x+			info->tty->alt_speed = 230400;x+		if ((info->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)x+			info->tty->alt_speed = 460800;x+	}x+	local_open(port);x+x+	/* set the speed of the serial port */x+	ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0);x+x+	/* enable hardware flow control - after ioc4_change_speed becausex+	 * ASYNC_CTS_FLOW is set there */x+	if (info->flags & ASYNC_CTS_FLOW)x{x+		port->ip_sscr |= IOC4_SSCR_HFC_EN;x+		writel(port->ip_sscr, &port->ip_serial_regs->sscr);x+	}x+	info->flags |= UIF_INITIALIZED;x+	return 0;x+}x+x+/*x+ * ioc4_cb_output_lowat - called when the output low water mark is hitx+ * @port: port to outputx+ */x+static void ioc4_cb_output_lowat(struct ioc4_port *port)x+{x+	/* ip_lock is set on the call here */x+	if (port->ip_port)x{x+		transmit_chars(port->ip_port);x+	}x+}x+x+x+/**x+ * handle_intr - service any interrupts for the given port - 2nd levelx+ *			called via sd_intrx+ * @arg: handler argx+ * @sio_ir: ioc4regsx+ */x+static void handle_intr(void *arg, uint32_t sio_ir)x+{x+	struct ioc4_port *port = (struct ioc4_port *)arg;x+	struct hooks *hooks = port->ip_hooks;x+	unsigned int rx_high_rd_aborted = 0;x+	unsigned int flags;x+	struct uart_port *the_port;x+	int loop_counter;x+x+	/* Possible race condition here: The tx_mt interrupt bit may bex+	 * cleared without the intervention of the interrupt handler,x+	 * e.g. by a write.  If the top level interrupt handler reads ax+	 * tx_mt, then some other processor does a write, starting upx+	 * output, then we come in here, see the tx_mt and stop DMA, thex+	 * output started by the other processor will hang.  Thus we canx+	 * only rely on tx_mt being legitimate if it is read while thex+	 * port lock is held.  Therefore this bit must be ignored in thex+	 * passed in interrupt mask which was read by the top levelx+	 * interrupt handler since the port lock was not held at the timex+	 * it was read.  We can only rely on this bit being accurate if itx+	 * is read while the port lock is held.  So we'll clear it for now,x+	 * and reload it later once we have the port lock.x+	 */x+	sio_ir &= ~(hooks->intr_tx_mt);x+x+	spin_lock_irqsave(&port->ip_lock, flags);x+x+	loop_counter = MAXITER;	/* to avoid hangs */x+x+	dox{x+		uint32_t shadow;x+x+		if ( loop_counter-- <= 0 )x{x+			printk(KERN_WARNING "IOC4 serial: "x+					"possible hang condition/"x+					"port stuck on interrupt.\n");x+			break;x+		}x+x+		/* Handle a DCD change */x+		if (sio_ir & hooks->intr_delta_dcd)x{x+			/* ACK the interrupt */x+			writel(hooks->intr_delta_dcd,x+				&port->ip_mem->sio_ir);x+x+			shadow = readl(&port->ip_serial_regs->shadow);x+x+			if ((port->ip_notify & N_DDCD)x+					&& (shadow & IOC4_SHADOW_DCD)x+					&& (port->ip_port)) {x+				the_port = port->ip_port;x+				the_port->icount.dcd = 1;x+				wake_up_interruptiblex+					    (&the_port-> info->delta_msr_wait);
+			} else if ((port->ip_notify & N_DDCD)x+					&& !(shadow & IOC4_SHADOW_DCD))x{x+				/* Flag delta DCD/no DCD */x+				port->ip_flags |= DCD_ON;x+			}x+		}x+x+		/* Handle a CTS change */x+		if (sio_ir & hooks->intr_delta_cts) {x+			/* ACK the interrupt */x+			writel(hooks->intr_delta_cts,x+					&port->ip_mem->sio_ir);x+x+			shadow = readl(&port->ip_serial_regs->shadow);x+x+			if ((port->ip_notify & N_DCTS)x+					&& (port->ip_port)) {x+				the_port = port->ip_port;x+				the_port->icount.cts =x+					(shadow & IOC4_SHADOW_CTS) ? 1 : 0;x+				wake_up_interruptiblex+					(&the_port->info->delta_msr_wait);
+			}x+		}x+x+		/* rx timeout interrupt.  Must be some data available.  Put thisx+		 * before the check for rx_high since servicing this conditionx+		 * may cause that condition to clear.x+		 */x+		if (sio_ir & hooks->intr_rx_timer) {x+			/* ACK the interrupt */x+			writel(hooks->intr_rx_timer,x+				&port->ip_mem->sio_ir);x+x+			if ((port->ip_notify & N_DATA_READY)x+					&& (port->ip_port)) {x+				/* ip_lock is set on call here */x+				receive_chars(port->ip_port);x+			}x+		}x+x+		/* rx high interrupt. Must be after rx_timer.  */x+		else if (sio_ir & hooks->intr_rx_high) {x+			/* Data available, notify upper layer */x+			if ((port->ip_notify & N_DATA_READY)x+						&& port->ip_port)x{x+				/* ip_lock is set on call here */x+				receive_chars(port->ip_port);x+			}x+x+			/* We can't ACK this interrupt.  If receive_chars didn'tx+			 * cause the condition to clear, we'll have to disablex+			 * the interrupt until the data is drained.x+			 * If the read was aborted, don't disable the interruptx+			 * as this may cause us to hang indefinitely.  Anx+			 * aborted read generally means that this interruptx+			 * hasn't been delivered to the cpu yet anyway, evenx+			 * though we see it as asserted when we read the sio_ir.x+			 */x+			if ((sio_ir = PENDING(port)) & hooks->intr_rx_high) {x+				if ((port->ip_flags & READ_ABORTED) == 0)x{x+					port->ip_ienb &= ~hooks->intr_rx_high;x+					port->ip_flags |= INPUT_HIGH;x+				} else {x+					rx_high_rd_aborted++;x+				}x+			}x+		}x+x+		/* We got a low water interrupt: notify upper layer tox+		 * send more data.  Must come before tx_mt since servicingx+		 * this condition may cause that condition to clear.x+		 */x+		if (sio_ir & hooks->intr_tx_explicit) {x+			port->ip_flags &= ~LOWAT_WRITTEN;x+x+			/* ACK the interrupt */x+			writel(hooks->intr_tx_explicit,x+					&port->ip_mem->sio_ir);x+x+			if (port->ip_notify & N_OUTPUT_LOWAT)x+				ioc4_cb_output_lowat(port);x+		}x+x+		/* Handle tx_mt.  Must come after tx_explicit.  */x+		else if (sio_ir & hooks->intr_tx_mt) {x+			/* If we are expecting a lowat notificationx+			 * and we get to this point it probably means that forx+			 * some reason the tx_explicit didn't work as expected
+			 * (that can legitimately happen if the output buffer is
+			 * filled up in just the right way).x+			 * So send the notification now.x+			 */x+			if (port->ip_notify & N_OUTPUT_LOWAT) {x+				ioc4_cb_output_lowat(port);x+x+				/* We need to reload the sio_ir since the lowatx+				 * call may have caused another write to occur,x+				 * clearing the tx_mt condition.x+				 */x+				sio_ir = PENDING(port);x+			}x+x+			/* If the tx_mt condition still persists even after thex+			 * lowat call, we've got some work to do.x+			 */x+			if (sio_ir & hooks->intr_tx_mt) {x+x+				/* If we are not currently expecting DMA input,x+				 * and the transmitter has just gone idle,x+				 * there is no longer any reason for DMA, sox+				 * disable it.x+				 */x+				if (!(port->ip_notifyx+						& (N_DATA_READY | N_DDCD)))x{x+					BUG_ON(!(port->ip_sscrx+							& IOC4_SSCR_DMA_EN));x+					port->ip_sscr &= ~IOC4_SSCR_DMA_EN;x+					writel(port->ip_sscr,x+					   &port->ip_serial_regs->sscr);x+				}x+x+				/* Prevent infinite tx_mt interrupt */x+				port->ip_ienb &= ~hooks->intr_tx_mt;x+			}x+		}x+		sio_ir = PENDING(port);x+x+		/* if the read was aborted and only hooks->intr_rx_high,x+		 * clear hooks->intr_rx_high, so we do not loop forever.x+		 */x+
+		if (rx_high_rd_aborted && (sio_ir == hooks->intr_rx_high))x{x+			sio_ir &= ~hooks->intr_rx_high;x+		}x+	} while (sio_ir & hooks->intr_all);x+x+	spin_unlock_irqrestore(&port->ip_lock, flags);x+x+	/* Re-enable interrupts before returning from interrupt handler.x+	 * Getting interrupted here is okay.  It'll just v() our semaphore, andx+	 * we'll come through the loop again.x+	 */x+x+	write_ireg(port->ip_ioc4_soft, port->ip_ienb, IOC4_W_IES,x+							IOC4_SIO_INTR_TYPE);
+}x+x+/*x+ * ioc4_cb_post_ncs - called for some basic errorsx+ * @port: port to usex+ * @ncs: eventx+ */x+static void ioc4_cb_post_ncs(struct uart_port *the_port, int ncs)x+{x+	struct uart_icount *icount;x+x+	icount = &the_port->icount;x+x+	if (ncs & NCS_BREAK)x+		icount->brk++;x+	if (ncs & NCS_FRAMING)x+		icount->frame++;x+	if (ncs & NCS_OVERRUN)x+		icount->overrun++;x+	if (ncs & NCS_PARITY)x+		icount->parity++;x+}x+x+/**x+ * do_read - Read in bytes from the port.  Return the number of bytesx+ *			actually read.x+ * @the_port: port to usex+ * @buf: place to put the stuff we readx+ * @len: how big 'buf' is
+ */x+x+static inline int do_read(struct uart_port *the_port, unsigned char *buf,x+				int len)x+{x+	int prod_ptr, cons_ptr, total;x+	struct ioc4_port *port = get_ioc4_port(the_port);x+	struct ring *inring;x+	struct ring_entry *entry;x+	struct hooks *hooks = port->ip_hooks;x+	int byte_num;x+	char *sc;x+	int loop_counter;x+x+	BUG_ON(!(len >= 0));x+	BUG_ON(!port);x+x+	/* There is a nasty timing issue in the IOC4. When the rx_timerx+	 * expires or the rx_high condition arises, we take an interrupt.x+	 * At some point while servicing the interrupt, we read bytes fromx+	 * the ring buffer and re-arm the rx_timer.  However the rx_timer isx+	 * not started until the first byte is received *after* it is armed,x+	 * and any bytes pending in the rx construction buffers are not drainedx+	 * to memory until either there are 4 bytes available or the rx_timerx+	 * expires.  This leads to a potential situation where data is leftx+	 * in the construction buffers forever - 1 to 3 bytes were receivedx+	 * after the interrupt was generated but before the rx_timer wasx+	 * re-armed. At that point as long as no subsequent bytes are receivedx+	 * the timer will never be started and the bytes will remain in thex+	 * construction buffer forever.  The solution is to execute a DRAINx+	 * command after rearming the timer.  This way any bytes received beforex+	 * the DRAIN will be drained to memory, and any bytes received afterx+	 * the DRAIN will start the TIMER and be drained when it expires.x+	 * Luckily, this only needs to be done when the DMA buffer is emptyx+	 * since there is no requirement that this function return allx+	 * available data as long as it returns some.x+	 */x+	/* Re-arm the timer */x+	writel(port->ip_rx_cons | IOC4_SRCIR_ARM,x+			&port->ip_serial_regs->srcir);x+x+	prod_ptr = readl(&port->ip_serial_regs->srpir) & PROD_CONS_MASK;x+	cons_ptr = port->ip_rx_cons;x+x+	if (prod_ptr == cons_ptr) {x+		int reset_dma = 0;x+x+		/* Input buffer appears empty, do a flush. */x+
+		/* DMA must be enabled for this to work. */x+		if (!(port->ip_sscr & IOC4_SSCR_DMA_EN))x{x+			port->ip_sscr |= IOC4_SSCR_DMA_EN;x+			reset_dma = 1;x+		}x+x+		/* Potential race condition: we must reload the srpir afterx+		 * issuing the drain command, otherwise we could think the rxx+		 * buffer is empty, then take a very long interrupt, and whenx+		 * we come back it's full and we wait forever for the drain tox+		 * complete.x+		 */x+		writel(port->ip_sscr | IOC4_SSCR_RX_DRAIN,x+				&port->ip_serial_regs->sscr);x+		prod_ptr = readl(&port->ip_serial_regs->srpir)x+				& PROD_CONS_MASK;x+x+		/* We must not wait for the DRAIN to complete unless there arex+		 * at least 8 bytes (2 ring entries) available to receive thex+		 * data otherwise the DRAIN will never complete and we'llx+		 * deadlock here.x+		 * In fact, to make things easier, I'll just ignore the flush ifx+		 * there is any data at all now available.x+		 */x+		if (prod_ptr == cons_ptr) {x+			loop_counter = 0;x+			while (readl(&port->ip_serial_regs->sscr) &x+						IOC4_SSCR_RX_DRAIN)x{x+				loop_counter++;x+				if (loop_counter > MAXITER)x+					return -1;x+			}x+x+			/* SIGH. We have to reload the prod_ptr *again* sincex+			 * the drain may have caused it to changex+			 */x+			prod_ptr = readl(&port->ip_serial_regs->srpir)x+							& PROD_CONS_MASK;x+		}x+		if (reset_dma)x{x+			port->ip_sscr &= ~IOC4_SSCR_DMA_EN;x+			writel(port->ip_sscr, &port->ip_serial_regs->sscr);x+		}x+	}x+	inring = port->ip_inring;x+	port->ip_flags &= ~READ_ABORTED;x+x+	total = 0;x+	loop_counter = 0xfffff;	/* to avoid hangs */x+x+	/* Grab bytes from the hardware */x+	while ((prod_ptr != cons_ptr) && (len > 0)) {x+		entry = (struct ring_entry *)((caddr_t)inring + cons_ptr);x+x+		if ( loop_counter-- <= 0 )x{x+			printk(KERN_WARNING "IOC4 serial: "x+					"possible hang condition/"x+					"port stuck on read.\n");x+			break;x+		}x+x+		/* According to the producer pointer, this ring entryx+		 * must contain some data.  But if the PIO happened fasterx+		 * than the DMA, the data may not be available yet, so let'sx+		 * wait until it arrives.x+		 */x+		if ((entry->ring_allsc & RING_ANY_VALID) == 0)x{x+			/* Indicate the read is aborted so we don't disablex+			 * the interrupt thinking that the consumer is
+			 * congested.x+			 */x+			port->ip_flags |= READ_ABORTED;x+			len = 0;x+			break;x+		}x+x+		/* Load the bytes/status out of the ring entry */x+		for (byte_num = 0; byte_num < 4 && len > 0; byte_num++)x{x+			sc = &(entry->ring_sc[byte_num]);x+x+			/* Check for change in modem state or overrun */x+			if ((*sc & IOC4_RXSB_MODEM_VALID)x+						&& (port->ip_notify & N_DDCD))x{x+				/* Notify upper layer if DCD dropped */x+x+				if ((port->ip_flags & DCD_ON)x+						&& !(*sc & IOC4_RXSB_DCD))x{x+x+					/* If we have already copied some data,x+					 * return it.  We'll pick up the carrierx+					 * drop on the next pass.  That way wex+					 * don't throw away the data that hasx+					 * already been copied back tox+					 * the caller's buffer.x+					 */x+					if (total > 0)x{x+						len = 0;x+						break;x+					}x+					port->ip_flags &= ~DCD_ON;x+x+					/* Turn off this notification so thex+					 * carrier drop protocol won't see itx+					 * again when it does a read.x+					 */x+					*sc &= ~IOC4_RXSB_MODEM_VALID;x+x+					/* To keep things consistent, we needx+					 * to update the consumer pointer sox+					 * the next reader won't come in andx+					 * try to read the same ring entriesx+					 * again. This must be done here beforex+					 * the dcd change.x+					 */x+x+					if ((entry->ring_allsc & RING_ANY_VALID)x+									== 0)x{x+						cons_ptr += (int)sizeofx+							(struct ring_entry);x+						cons_ptr &= PROD_CONS_MASK;x+					}x+					writel(cons_ptr,x+						&port->ip_serial_regs->srcir);x+					port->ip_rx_cons = cons_ptr;x+x+					/* Notify upper layer of carrier drop */x+					if ((port->ip_notify & N_DDCD)x+						   && port->ip_port)x{x+						the_port->icount.dcd = 0;x+						wake_up_interruptiblex+						    (&the_port->info->x+							delta_msr_wait);
+					}x+x+					/* If we had any data to return, wex+					 * would have returned it above.x+					 */x+					return 0;x+				}x+			}x+			if (*sc & IOC4_RXSB_MODEM_VALID)x{x+				/* Notify that an input overrun occurred */x+				if ((*sc & IOC4_RXSB_OVERRUN)x+				    && (port->ip_notify & N_OVERRUN_ERROR))x{x+					ioc4_cb_post_ncs(the_port, NCS_OVERRUN);x+				}x+				/* Don't look at this byte again */x+				*sc &= ~IOC4_RXSB_MODEM_VALID;x+			}x+x+			/* Check for valid data or RX errors */x+			if ((*sc & IOC4_RXSB_DATA_VALID)x&&x+					((*sc & (IOC4_RXSB_PAR_ERRx+							| IOC4_RXSB_FRAME_ERRx+							| IOC4_RXSB_BREAK))x+					&& (port->ip_notify & (N_PARITY_ERRORx+							| N_FRAMING_ERRORx+							| N_BREAK))))x{x+				/* There is an error condition on the next byte.x+				 * If we have already transferred some bytes,x+				 * we'll stop here. Otherwise if this is thex+				 * first byte to be read, we'll just transferx+				 * it alone after notifying thex+				 * upper layer of its status.x+				 */x+				if (total > 0)x{x+					len = 0;x+					break;x+				} else {x+					if ((*sc & IOC4_RXSB_PAR_ERR)x&&x+					   (port->ip_notify & N_PARITY_ERROR))x{x+						ioc4_cb_post_ncs(the_port,x+								NCS_PARITY);x+					}x+					if ((*sc & IOC4_RXSB_FRAME_ERR)x&&x+					   (port->ip_notify & N_FRAMING_ERROR)){x+						ioc4_cb_post_ncs(the_port,x+								NCS_FRAMING);x+					}x+					if ((*sc & IOC4_RXSB_BREAK)x+					    && (port->ip_notify & N_BREAK))x{x+							ioc4_cb_post_ncsx+								    (the_port,x+								     NCS_BREAK);x+					}x+					len = 1;x+				}x+			}x+			if (*sc & IOC4_RXSB_DATA_VALID)x{x+				*sc &= ~IOC4_RXSB_DATA_VALID;x+				*buf = entry->ring_data[byte_num];x+				buf++;x+				len--;x+				total++;x+			}x+		}x+x+		/* If we used up this entry entirely, go on to the next one,x+		 * otherwise we must have run out of buffer space, sox+		 * leave the consumer pointer here for the next read in casex+		 * there are still unread bytes in this entry.x+		 */x+		if ((entry->ring_allsc & RING_ANY_VALID) == 0)x{x+			cons_ptr += (int)sizeof(struct ring_entry);x+			cons_ptr &= PROD_CONS_MASK;x+		}x+	}x+x+	/* Update consumer pointer and re-arm rx timer interrupt */x+	writel(cons_ptr, &port->ip_serial_regs->srcir);x+	port->ip_rx_cons = cons_ptr;x+x+	/* If we have now dipped below the rx high water mark and we havex+	 * rx_high interrupt turned off, we can now turn it back on again.x+	 */x+	if ((port->ip_flags & INPUT_HIGH) && (((prod_ptr - cons_ptr)x+			& PROD_CONS_MASK) < ((port->ip_sscr &x+				IOC4_SSCR_RX_THRESHOLD)x+					<< IOC4_PROD_CONS_PTR_OFF)))x{x+		port->ip_flags &= ~INPUT_HIGH;x+		enable_intrs(port, hooks->intr_rx_high);x+	}x+	return total;x+}x+/**x+ * receive_chars - upper level read. Called with ip_lock.x+ * @the_port: port to read fromx+ */x+static void receive_chars(struct uart_port *the_port)x+{x+	struct tty_struct *tty;x+	unsigned char ch[IOC4_MAX_CHARS];x+	int read_count, request_count;x+	struct uart_icount *icount;x+	struct uart_info *info = the_port->info;x+x+	/* Make sure all the pointers are "good" ones */x+	if (!info)x+		return;x+	if (!info->tty)x+		return;x+x+	tty = info->tty;x+x+	request_count = TTY_FLIPBUF_SIZE - tty->flip.count - 1;
+x+	if (request_count > 0)x{x+		if (request_count > IOC4_MAX_CHARS - 2)x+			request_count = IOC4_MAX_CHARS - 2;x+		icount = &the_port->icount;x+		read_count = do_read(the_port, ch, request_count);
+		if (read_count > 0)x{x+			memcpy(tty->flip.char_buf_ptr, ch, read_count);x+			memset(tty->flip.flag_buf_ptr, TTY_NORMAL, read_count);x+			tty->flip.char_buf_ptr += read_count;x+			tty->flip.flag_buf_ptr += read_count;x+			tty->flip.count += read_count;x+			icount->rx += read_count;x+		}x+	}x+	tty_flip_buffer_push(tty);x+}x+x+/**x+ * ic4_type - What type of console are we?x+ * @port: Port to operate with (we ignore since we only have one port)x+ *x+ */x+static const char *ic4_type(struct uart_port *the_port)x+{x+	return "SGI IOC4 Serial";x+}x+x+/**x+ * ic4_tx_empty - Is the transmitter empty?  We pretend we're always emptyx+ * @port: Port to operate on (we ignore since we always return 1)x+ *x+ */x+static unsigned int ic4_tx_empty(struct uart_port *the_port)x+{x+	return 1;x+}x+x+/**x+ * ic4_stop_tx - stop the transmitterx+ * @port: Port to operate onx+ * @tty_stop: Set to 1 if called via uart_stopx+ *x+ */x+static void ic4_stop_tx(struct uart_port *the_port, unsigned int tty_stop)x+{x+}x+x+/**x+ * null_void_function -x+ * @port: Port to operate onx+ *x+ */x+static void null_void_function(struct uart_port *the_port)x+{x+}x+x+/**x+ * ic4_shutdown - shut down the port - free irq and disablex+ * @port: Port to shut downx+ *x+ */x+static void ic4_shutdown(struct uart_port *the_port)x+{x+	unsigned long port_flags;x+	struct ioc4_port *port;x+	struct uart_info *info;x+x+	port = get_ioc4_port(the_port);x+	if (!port)x+		return;x+x+	info = the_port->info;x+x+	if (!(info->flags & UIF_INITIALIZED))x+		return;x+x+	wake_up_interruptible(&info->delta_msr_wait);
+x+	if (info->tty)x+		set_bit(TTY_IO_ERROR, &info->tty->flags);
+x+	spin_lock_irqsave(&port->ip_lock, port_flags);x+	set_notification(port, N_ALL, 0);x+	info->flags &= ~UIF_INITIALIZED;x+	spin_unlock_irqrestore(&port->ip_lock, port_flags);x+}x+x+/**x+ * ic4_set_mctrl - set control lines (dtr, rts, etc)x+ * @port: Port to operate onx+ * @mctrl: Lines to set/unsetx+ *x+ */x+static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl)x+{x+	unsigned char mcr = 0;x+x+	if (mctrl & TIOCM_RTS)x+		mcr |= UART_MCR_RTS;x+	if (mctrl & TIOCM_DTR)x+		mcr |= UART_MCR_DTR;x+	if (mctrl & TIOCM_OUT1)x+		mcr |= UART_MCR_OUT1;x+	if (mctrl & TIOCM_OUT2)x+		mcr |= UART_MCR_OUT2;x+	if (mctrl & TIOCM_LOOP)x+		mcr |= UART_MCR_LOOP;
+x+	set_mcr(the_port, 1, mcr, IOC4_SHADOW_DTR);x+}x+x+/**x+ * ic4_get_mctrl - get control line infox+ * @port: port to operate onx+ *x+ */x+static unsigned int ic4_get_mctrl(struct uart_port *the_port)x+{x+	struct ioc4_port *port = get_ioc4_port(the_port);x+	uint32_t shadow;x+	unsigned int ret = 0;x+x+	if (!port)x+		return 0;x+x+	shadow = readl(&port->ip_serial_regs->shadow);x+	if (shadow & IOC4_SHADOW_DCD)x+		ret |= TIOCM_CAR;x+	if (shadow & IOC4_SHADOW_DR)x+		ret |= TIOCM_DSR;x+	if (shadow & IOC4_SHADOW_CTS)x+		ret |= TIOCM_CTS;x+	return ret;x+}x+x+/**x+ * ic4_start_tx - Start transmitter, flush any outputx+ * @port: Port to operate onx+ * @tty_stop: Set to 1 if called via uart_startx+ *x+ */x+static void ic4_start_tx(struct uart_port *the_port, unsigned int tty_stop)x+{x+	struct ioc4_port *port = get_ioc4_port(the_port);x+	unsigned long flags;x+x+	if (port) {x+		spin_lock_irqsave(&port->ip_lock, flags);x+		transmit_chars(the_port);x+		spin_unlock_irqrestore(&port->ip_lock, flags);x+	}x+}x+x+/**x+ * ic4_break_ctl - handle breaksx+ * @port: Port to operate onx+ * @break_state: Break statex+ *x+ */x+static void ic4_break_ctl(struct uart_port *the_port, int break_state)x+{x+}x+x+/**x+ * ic4_startup - Start up the serial port - always return 0 (We're always on)x+ * @port: Port to operate onx+ *x+ */x+static int ic4_startup(struct uart_port *the_port)x+{x+	int retval;x+	struct ioc4_port *port;x+	struct ioc4_control *control;x+	struct uart_info *info;x+	unsigned long port_flags;x+x+	if (!the_port)x{x+		return -ENODEV;x+	}x+	port = get_ioc4_port(the_port);x+	if (!port)x{x+		return -ENODEV;x+	}x+	info = the_port->info;x+x+	control = port->ip_control;x+	if (!control)x{x+		return -ENODEV;x+	}x+x+	/* Start up the serial port */x+	spin_lock_irqsave(&port->ip_lock, port_flags);x+	retval = ic4_startup_local(the_port);x+	spin_unlock_irqrestore(&port->ip_lock, port_flags);x+	return retval;
+}x+x+/**x+ * ic4_set_termios - set termios stuffx+ * @port: port to operate onx+ * @termios: New settingsx+ * @termios: Oldx+ *x+ */x+static void
+ic4_set_termios(struct uart_port *the_port,x+		struct termios *termios, struct termios *old_termios)x+{x+	struct ioc4_port *port = get_ioc4_port(the_port);x+	unsigned long port_flags;x+x+	spin_lock_irqsave(&port->ip_lock, port_flags);x+	ioc4_change_speed(the_port, termios, old_termios);x+	spin_unlock_irqrestore(&port->ip_lock, port_flags);x+}x+x+/**x+ * ic4_request_port - allocate resources for port - no op....x+ * @port: port to operate onx+ *x+ */x+static int ic4_request_port(struct uart_port *port)x+{x+	return 0;x+}x+x+/* Associate the uart functions above - given to serial core */x+x+static struct uart_ops ioc4_ops =x{x+	.tx_empty	= ic4_tx_empty,x+	.set_mctrl	= ic4_set_mctrl,x+	.get_mctrl	= ic4_get_mctrl,x+	.stop_tx	= ic4_stop_tx,x+	.start_tx	= ic4_start_tx,x+	.stop_rx	= null_void_function,x+	.enable_ms	= null_void_function,x+	.break_ctl	= ic4_break_ctl,x+	.startup	= ic4_startup,x+	.shutdown	= ic4_shutdown,x+	.set_termios	= ic4_set_termios,x+	.type		= ic4_type,x+	.release_port	= null_void_function,x+	.request_port	= ic4_request_port,x+};x+x+/*x+ * Boot-time initialization code
+ */x+x+static struct uart_driver ioc4_uart = {x+	.owner		= THIS_MODULE,x+	.driver_name	= "ioc4_serial",x+	.dev_name	= DEVICE_NAME,x+	.major		= DEVICE_MAJOR,x+	.minor		= DEVICE_MINOR,x+	.nr		= IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS,x+};x+x+/**x+ * ioc4_serial_core_attach - register with serial corex+ *		This is done during pci probingx+ * @pdev: handle for this cardx+ */x+static inline int
+ioc4_serial_core_attach(struct pci_dev *pdev)x+{x+	struct ioc4_port *port;x+	struct uart_port *the_port;x+	struct ioc4_control *control = pci_get_drvdata(pdev);x+	int ii;x+x+	DPRINT_CONFIG(("%s: attach pdev 0x%p - control 0x%p\n",x+			__FUNCTION__, pdev, (void *)control));
+x+	if (!control)x+		return -ENODEV;x+x+	/* once around for each port on this card */x+	for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++)x{x+		the_port = &control->ic_port[ii].icp_uart_port;x+		port = control->ic_port[ii].icp_port;x+		port->ip_port = the_port;x+x+		DPRINT_CONFIG(("%s: attach the_port 0x%p / port 0x%p\n",x+				__FUNCTION__, (void *)the_port,x+				(void *)port));
+x+		the_port->lock = SPIN_LOCK_UNLOCKED;x+		/* membase, iobase and mapbase just need to be non-0 */x+		the_port->membase = (unsigned char __iomem *)1;x+		the_port->line = the_port->iobase = ii;x+		the_port->mapbase = 1;x+		the_port->type = PORT_16550A;x+		the_port->fifosize = IOC4_MAX_CHARS;x+		the_port->ops =x&ioc4_ops;x+		the_port->irq = control->ic_irq;x+		the_port->dev =x&pdev->dev;
+		if (uart_add_one_port(&ioc4_uart, the_port) < 0)x{x+			printk(KERN_WARNINGx+				       "%s: unable to add port %d\n",x+				       __FUNCTION__, the_port->line);x+		} else {x+			DPRINT_CONFIG(x+				    ("IOC4 serial driver port %d irq = %d\n",x+				       the_port->line, the_port->irq));x+		}x+		/* all ports are rs232 for now */x+		ioc4_set_proto(port, PROTO_RS232);x+	}x+	return 0;x+}x+x+/**x+ * ioc4_serial_attach_one - register attach functionx+ *		called per card found from ioc4_serial_detect as partx+ *		of module_init().x+ * @pdev: handle for this cardx+ * @pci_id: pci id for this cardx+ */x+int
+ioc4_serial_attach_one(struct pci_dev *pdev, const struct pci_device_id *pci_id)x+{x+	struct ioc4_mem __iomem *mem;x+	unsigned long tmp_addr, tmp_addr1;x+	struct ioc4_serial __iomem *serial;x+	struct ioc4_soft *soft;x+	struct ioc4_control *control;x+	int tmp, ret = 0;x+x+x+	DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, pdev, pci_id));x+x+	/* Map in the ioc4 memory */x+	tmp_addr = pci_resource_start(pdev, 0);x+	if (!tmp_addr)x{x+		printk(KERN_WARNINGx+			 "ioc4 (%p) : unable to get PIO mapping for "x+				"MEM space\n", (void *)pdev);x+		return -ENODEV;x+	}x+	if (!request_region(tmp_addr, sizeof(struct ioc4_mem), "sioc4_mem"))x{x+		printk(KERN_ALERTx+			"ioc4 (%p): unable to get request region for "x+			"MEM space\n", (void *)pdev);x+		return -ENODEV;x+	}x+	mem = ioremap(tmp_addr, sizeof(struct ioc4_mem));x+	if (!mem)x{x+		printk(KERN_WARNINGx+			 "ioc4 (%p) : unable to remap ioc4 memory\n",x+				(void *)pdev);x+		ret = -ENODEV;x+		goto out1;x+	}x+x+	/* request serial registers */x+	tmp_addr1 = pci_resource_start(pdev, 0) + IOC4_SERIAL_OFFSET;x+x+	if (!request_region(tmp_addr1, sizeof(struct ioc4_serial),x+					"sioc4_uart"))x{x+		printk(KERN_WARNINGx+			"ioc4 (%p): unable to get request region for "x+				"uart space\n", (void *)pdev);x+		ret = -ENODEV;x+		goto out1;x+	}x+	serial = ioremap(tmp_addr1, sizeof(struct ioc4_serial));x+	if (!serial)x{x+		printk(KERN_WARNINGx+			 "ioc4 (%p) : unable to remap ioc4 serial register\n",x+				(void *)pdev);x+		ret = -ENODEV;x+		goto out2;x+	}x+	DPRINT_CONFIG(("%s : mem 0x%p, serial 0x%p\n",x+				__FUNCTION__, (void *)mem, (void *)serial));x+x+	/* Get memory for the new card */x+	control = kmalloc(sizeof(struct ioc4_control)x* IOC4_NUM_SERIAL_PORTS,x+						GFP_KERNEL);
+x+	if (!control)x{x+		printk(KERN_WARNING "ioc4_attach_one"x+		       ": unable to get memory for the IOC4\n");x+		ret = -ENOMEM;x+		goto out2;x+	}x+	memset(control, 0, sizeof(struct ioc4_control));x+	pci_set_drvdata(pdev, control);x+x+	/* Allocate the soft structure */x+	soft = kmalloc(sizeof(struct ioc4_soft), GFP_KERNEL);
+	if (!soft)x{x+		printk(KERN_WARNINGx+		       "ioc4 (%p): unable to get memory for the soft struct\n",x+		       (void *)pdev);x+		ret = -ENOMEM;x+		goto out3;x+	}x+	memset(soft, 0, sizeof(struct ioc4_soft));
+x+	spin_lock_init(&soft->is_ir_lock);x+	soft->is_ioc4_mem_addr = mem;x+	soft->is_ioc4_serial_addr = serial;x+x+	/* Init the IOC4 */x+	pci_read_config_dword(pdev, PCI_COMMAND, &tmp);x+	pci_write_config_dword(pdev, PCI_COMMAND,x+			       tmp | PCI_COMMAND_PARITY | PCI_COMMAND_SERR);x+x+	writel(0xf << IOC4_SIO_CR_CMD_PULSE_SHIFT, &mem->sio_cr);x+x+	/* Enable serial port mode select generic PIO pins as outputs */x+	writel(IOC4_GPCR_UART0_MODESEL | IOC4_GPCR_UART1_MODESELx+		| IOC4_GPCR_UART2_MODESEL | IOC4_GPCR_UART3_MODESEL,x+		&mem->gpcr_s);x+x+	/* Clear and disable all interrupts */x+	write_ireg(soft, ~0, IOC4_W_IEC, IOC4_SIO_INTR_TYPE);
+	writel(~0, &mem->sio_ir);x+	write_ireg(soft, ~(IOC4_OTHER_IR_ATA_INT | IOC4_OTHER_IR_ATA_MEMERR),x+			IOC4_W_IEC, IOC4_OTHER_INTR_TYPE);
+	writel(~(IOC4_OTHER_IR_ATA_MEMERR | IOC4_OTHER_IR_ATA_MEMERR),x+					&mem->other_ir);x+	control->ic_soft = soft;x+	if (!request_irq(pdev->irq, ioc4_intr, SA_SHIRQ,x+				"sgi-ioc4serial", (void *)soft))x{x+		control->ic_irq = pdev->irq;x+	} else {x+		printk(KERN_WARNINGx+		    "%s : request_irq fails for IRQ 0x%x\n ",x+			__FUNCTION__, pdev->irq);x+	}x+	if ((ret = ioc4_attach_local(pdev, control, soft,x+				soft->is_ioc4_mem_addr,x+				soft->is_ioc4_serial_addr)))x+		goto out4;x+x+	/* register port with the serial core */x+x+	if ((ret = ioc4_serial_core_attach(pdev)))x+		goto out4;x+x+	return ret;x+x+	/* error exits that give back resources */x+out4:x+	kfree(soft);x+out3:x+	kfree(control);x+out2:x+	release_region(tmp_addr1, sizeof(struct ioc4_serial));x+out1:x+	release_region(tmp_addr, sizeof(struct ioc4_mem));x+x+	return ret;x+}x+x+x+/**x+ * ioc4_serial_remove_one - detach functionx+ *x+ * @pdev: handle for this cardx+ */x+
+#if 0
+void ioc4_serial_remove_one(struct pci_dev *pdev)x+{x+	int ii;x+	struct ioc4_control *control;x+	struct uart_port *the_port;x+	struct ioc4_port *port;x+	struct ioc4_soft *soft;x+x+	control = pci_get_drvdata(pdev);x+x+	for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++)x{x+		the_port = &control->ic_port[ii].icp_uart_port;x+		if (the_port)x{x+			uart_remove_one_port(&ioc4_uart, the_port);x+		}x+		port = control->ic_port[ii].icp_port;x+		if (!(ii & 1) && port)x{x+			pci_free_consistent(port->ip_pdev,x+					TOTAL_RING_BUF_SIZE,x+					(void *)port->ip_cpu_ringbuf,x+					port->ip_dma_ringbuf);x+			kfree(port);x+		}x+	}x+	soft = control->ic_soft;x+	if (soft)x{x+		free_irq(control->ic_irq, (void *)soft);x+		if (soft->is_ioc4_serial_addr)x{x+			release_region((unsigned long)x+			     soft->is_ioc4_serial_addr,x+				sizeof(struct ioc4_serial));x+		}x+		kfree(soft);x+	}x+	kfree(control);x+	pci_set_drvdata(pdev, NULL);
+	uart_unregister_driver(&ioc4_uart);x+}x+#endifx+x+/**x+ * ioc4_serial_init - module initx+ */x+int ioc4_serial_init(void)x+{x+	int ret;x+x+	/* register with serial core */x+	if ((ret = uart_register_driver(&ioc4_uart)) < 0)x{x+		printk(KERN_WARNINGx+			"%s: Couldn't register IOC4 serial driver\n",x+			__FUNCTION__);x+		return ret;x+	}x+	return 0;x+}x+x+MODULE_AUTHOR("Pat Gefre - Silicon Graphics Inc. (SGI) <pfg@sgi.com>");x+MODULE_DESCRIPTION("Serial PCI driver module for SGI IOC4 Base-IO Card");x+MODULE_LICENSE("GPL");x+x+EXPORT_SYMBOL(ioc4_serial_init);x+EXPORT_SYMBOL(ioc4_serial_attach_one);xdiff -Nru a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
--- a/drivers/serial/s3c2410.c	2005-01-28 03:13:32 -08:00
+++ b/drivers/serial/s3c2410.c	2005-03-09 14:09:10 -08:00
@@ -5,7 +5,8 @@
  *x  * Based on drivers/char/serial.c and drivers/char/21285.c
  *x- * Ben Dooks, (c) 2003 Simtec Electronicsx+ * Ben Dooks, (c) 2003-2005 Simtec Electronicsx+ *	http://www.simtec.co.uk/products/SWLINUX/
  *x  * Changelog:
  *x@@ -24,6 +25,17 @@
  *		     - spin-lock initialisation (Dimitry Andric)
  *		     - added clock control
  *		     - updated init code to use platform_device infox+ *x+ * 06-Mar-2005  BJD  Add s3c2440 fclk clock sourcex+ *x+ * 09-Mar-2005  BJD  Add s3c2400 support
+*/x+
+/* Note on 2440 fclk clock source handlingx+ *x+ * Whilst it is possible to use the fclk as clock source, the methodx+ * of properly switching too/from this is currently un-implemented, sox+ * whichever way is configured at startup is the one that will be used.
 */x 
 /* Hote on 2410 error handlingx@@ -87,6 +99,9 @@
 
 	int (*get_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);x 	int (*set_clksrc)(struct uart_port *, struct s3c24xx_uart_clksrc *clk);x+x+	/* uart controls */x+	int (*reset_port)(struct uart_port *, struct s3c2410_uartcfg *);x };
 
 struct s3c24xx_uart_port {x@@ -606,11 +621,6 @@
  * baud clocks (and the resultant actual baud rates) and then tries tox  * pick the closest one and select that.
  *x- * NOTES:x- *	1) there is no current code to properly select/deselect FCLK onx- *	   the s3c2440, so only specify FCLK or non-FCLK in the clockx- *	   sources for the UARTx- *
 */x 
 x@@ -658,6 +668,7 @@
 		return 0;x 
 	rate = clk_get_rate(calc->src);x+	rate /= clksrc->divisor;x 
 	calc->clksrc = clksrc;
 	calc->quot = (rate + (8 * baud)) / (16 * baud);x@@ -685,6 +696,27 @@
 		if (cfg->clocks_size == 0)
 			clkp = &tmp_clksrc;
 x+		/* check to see if we're sourcing fclk, and if so we'rex+		 * going to have to update the clock sourcex+		 */x+
+		if (strcmp(clkp->name, "fclk") == 0)x{x+			struct s3c24xx_uart_clksrc src;
+x+			s3c24xx_serial_getsource(port, &src);x+x+			/* check that the port already using fclk, and if
+			 * not, then re-select fclkx+			 */x+x+			if (strcmp(src.name, clkp->name) == 0)x{x+				s3c24xx_serial_setsource(port, clkp);x+				s3c24xx_serial_getsource(port, &src);x+			}x+x+			clkp->divisor = src.divisor;x+		}x+x 		s3c24xx_serial_calcbaud(res, port, clkp, baud);x 		best = res;
 		resptr = best + 1;x@@ -955,8 +987,6 @@
 	[0] = {x 		.port = {x 			.lock		= SPIN_LOCK_UNLOCKED,
-			.membase	= 0,
-			.mapbase	= 0,
 			.iotype		= UPIO_MEM,
 			.irq		= IRQ_S3CUART_RX0,
 			.uartclk	= 0,
@@ -969,8 +999,6 @@
 	[1] = {x 		.port = {x 			.lock		= SPIN_LOCK_UNLOCKED,
-			.membase	= 0,
-			.mapbase	= 0,
 			.iotype		= UPIO_MEM,
 			.irq		= IRQ_S3CUART_RX1,
 			.uartclk	= 0,
@@ -985,8 +1013,6 @@
 	[2] = {x 		.port = {x 			.lock		= SPIN_LOCK_UNLOCKED,
-			.membase	= 0,
-			.mapbase	= 0,
 			.iotype		= UPIO_MEM,
 			.irq		= IRQ_S3CUART_RX2,
 			.uartclk	= 0,
@@ -999,24 +1025,18 @@
 #endifx };
 
+/* s3c24xx_serial_resetport
+ *x+ * wrapper to call the specific reset for this port (reset the fifosx+ * and the settings)
+*/x 
-static int s3c24xx_serial_resetport(struct uart_port *port,
-				    struct s3c2410_uartcfg *cfg)x+static inline int s3c24xx_serial_resetport(struct uart_port * port,x+					   struct s3c2410_uartcfg *cfg)x {x-	/* ensure registers are setup */x-x-	dbg("s3c24xx_serial_resetport: port=%p (%08lx), cfg=%p\n",x-	    port, port->mapbase, cfg);x-x-	wr_regl(port, S3C2410_UCON,  cfg->ucon);x-	wr_regl(port, S3C2410_ULCON, cfg->ulcon);x-x-	/* reset both fifos */x-x-	wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);x-	wr_regl(port, S3C2410_UFCON, cfg->ufcon);x+	struct s3c24xx_uart_info *info = s3c24xx_port_to_info(port);x 
-	return 0;x+	return (info->reset_port)(port, cfg);x }x 
 /* s3c24xx_serial_init_port
@@ -1180,6 +1200,97 @@
 
 /* cpu specific variations on the serial port support */x 
+#ifdef CONFIG_CPU_S3C2400
+x+static int s3c2400_serial_getsource(struct uart_port *port,
+				    struct s3c24xx_uart_clksrc *clk)x+{x+	clk->divisor = 1;x+	clk->name = "pclk";x+x+	return 0;x+}x+x+static int s3c2400_serial_setsource(struct uart_port *port,
+				    struct s3c24xx_uart_clksrc *clk)x+{x+	return 0;x+}x+x+static int s3c2400_serial_resetport(struct uart_port *port,
+				    struct s3c2410_uartcfg *cfg)x+{x+	dbg("s3c2400_serial_resetport: port=%p (%08lx), cfg=%p\n",x+	    port, port->mapbase, cfg);x+x+	wr_regl(port, S3C2410_UCON,  cfg->ucon);x+	wr_regl(port, S3C2410_ULCON, cfg->ulcon);x+x+	/* reset both fifos */x+x+	wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);x+	wr_regl(port, S3C2410_UFCON, cfg->ufcon);x+x+	return 0;x+}x+x+static struct s3c24xx_uart_info s3c2400_uart_inf = {x+	.name		= "Samsung S3C2400 UART",x+	.type		= PORT_S3C2400,x+	.fifosize	= 16,x+	.rx_fifomask	= S3C2410_UFSTAT_RXMASK,x+	.rx_fifoshift	= S3C2410_UFSTAT_RXSHIFT,x+	.rx_fifofull	= S3C2410_UFSTAT_RXFULL,x+	.tx_fifofull	= S3C2410_UFSTAT_TXFULL,x+	.tx_fifomask	= S3C2410_UFSTAT_TXMASK,x+	.tx_fifoshift	= S3C2410_UFSTAT_TXSHIFT,x+	.get_clksrc	= s3c2400_serial_getsource,x+	.set_clksrc	= s3c2400_serial_setsource,x+	.reset_port	= s3c2400_serial_resetport,x+};x+x+static int s3c2400_serial_probe(struct device *dev)x+{x+	return s3c24xx_serial_probe(dev, &s3c2400_uart_inf);x+}x+x+static struct device_driver s3c2400_serial_drv = {x+	.name		= "s3c2400-uart",x+	.bus		= &platform_bus_type,x+	.probe		= s3c2400_serial_probe,x+	.remove		= s3c24xx_serial_remove,x+	.suspend	= s3c24xx_serial_suspend,x+	.resume		= s3c24xx_serial_resume,x+};x+x+static inline int s3c2400_serial_init(void)x+{x+	return s3c24xx_serial_init(&s3c2400_serial_drv, &s3c2400_uart_inf);x+}x+x+static inline void s3c2400_serial_exit(void)x+{x+	driver_unregister(&s3c2400_serial_drv);x+}x+x+#define s3c2400_uart_inf_at &s3c2400_uart_infx+#elsex+x+static inline int s3c2400_serial_init(void)x+{x+	return 0;x+}x+x+static inline void s3c2400_serial_exit(void)x+{x+}x+x+#define s3c2400_uart_inf_at NULLx+x+#endif /* CONFIG_CPU_S3C2400 */x+
+/* S3C2410 support */x+x #ifdef CONFIG_CPU_S3C2410
 
 static int s3c2410_serial_setsource(struct uart_port *port,
@@ -1207,6 +1318,23 @@
 	return 0;x }x 
+static int s3c2410_serial_resetport(struct uart_port *port,
+				    struct s3c2410_uartcfg *cfg)x+{x+	dbg("s3c2410_serial_resetport: port=%p (%08lx), cfg=%p\n",x+	    port, port->mapbase, cfg);x+x+	wr_regl(port, S3C2410_UCON,  cfg->ucon);x+	wr_regl(port, S3C2410_ULCON, cfg->ulcon);x+x+	/* reset both fifos */x+x+	wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);x+	wr_regl(port, S3C2410_UFCON, cfg->ufcon);x+x+	return 0;x+}x+x static struct s3c24xx_uart_info s3c2410_uart_inf = {x 	.name		= "Samsung S3C2410 UART",x 	.type		= PORT_S3C2410,
@@ -1219,6 +1347,7 @@
 	.tx_fifoshift	= S3C2410_UFSTAT_TXSHIFT,x 	.get_clksrc	= s3c2410_serial_getsource,x 	.set_clksrc	= s3c2410_serial_setsource,x+	.reset_port	= s3c2410_serial_resetport,x };
 
 /* device management */x@@ -1294,6 +1423,7 @@
 				    struct s3c24xx_uart_clksrc *clk)x {x 	unsigned long ucon = rd_regl(port, S3C2410_UCON);x+	unsigned long ucon0, ucon1, ucon2;x 
 	switch (ucon & S3C2440_UCON_CLKMASK) {
 	case S3C2440_UCON_UCLK:x@@ -1308,7 +1438,33 @@
 		break;x 
 	case S3C2440_UCON_FCLK:x-		clk->divisor = 7; /* todo - work out divisor */x+		/* the fun of calculating the uart divisors onx+		 * the s3c2440 */x+x+		ucon0 = __raw_readl(S3C2410_VA_UART0 + S3C2410_UCON);x+		ucon1 = __raw_readl(S3C2410_VA_UART1 + S3C2410_UCON);x+		ucon2 = __raw_readl(S3C2410_VA_UART2 + S3C2410_UCON);x+x+		printk("ucons: %08lx, %08lx, %08lx\n", ucon0, ucon1, ucon2);x+x+		ucon0 &= S3C2440_UCON0_DIVMASK;x+		ucon1 &= S3C2440_UCON1_DIVMASK;x+		ucon2 &= S3C2440_UCON2_DIVMASK;x+
+		if (ucon0 != 0)x{x+			clk->divisor = ucon0 >> S3C2440_UCON_DIVSHIFT;x+			clk->divisor += 6;x+		} else if (ucon1 != 0)x{x+			clk->divisor = ucon1 >> S3C2440_UCON_DIVSHIFT;x+			clk->divisor += 21;x+		} else if (ucon2 != 0)x{x+			clk->divisor = ucon2 >> S3C2440_UCON_DIVSHIFT;x+			clk->divisor += 36;x+		} else {x+			/* manual calims 44, seems to be 9 */x+			clk->divisor = 9;x+		}x+x 		clk->name = "fclk";x 		break;x 	}x@@ -1316,6 +1472,28 @@
 	return 0;x }x 
+static int s3c2440_serial_resetport(struct uart_port *port,
+				    struct s3c2410_uartcfg *cfg)x+{x+	unsigned long ucon = rd_regl(port, S3C2410_UCON);x+x+	dbg("s3c2440_serial_resetport: port=%p (%08lx), cfg=%p\n",x+	    port, port->mapbase, cfg);x+x+	/* ensure we don't change the clock settings... */x+
+	ucon &= (S3C2440_UCON0_DIVMASK | (3<<10));x+x+	wr_regl(port, S3C2410_UCON,  ucon | cfg->ucon);x+	wr_regl(port, S3C2410_ULCON, cfg->ulcon);x+x+	/* reset both fifos */x+x+	wr_regl(port, S3C2410_UFCON, cfg->ufcon | S3C2410_UFCON_RESETBOTH);x+	wr_regl(port, S3C2410_UFCON, cfg->ufcon);x+x+	return 0;x+}x x static struct s3c24xx_uart_info s3c2440_uart_inf = {x 	.name		= "Samsung S3C2440 UART",x@@ -1328,7 +1506,8 @@
 	.tx_fifomask	= S3C2440_UFSTAT_TXMASK,x 	.tx_fifoshift	= S3C2440_UFSTAT_TXSHIFT,x 	.get_clksrc	= s3c2440_serial_getsource,x-	.set_clksrc	= s3c2440_serial_setsourcex+	.set_clksrc	= s3c2440_serial_setsource,x+	.reset_port	= s3c2440_serial_resetport,x };
 
 /* device management */x@@ -1386,6 +1565,7 @@
 		return -1;x 	}x x+	s3c2400_serial_init();x 	s3c2410_serial_init();x 	s3c2440_serial_init();x x@@ -1394,6 +1574,7 @@
 
 static void __exit s3c24xx_serial_modexit(void)x {x+	s3c2400_serial_exit();x 	s3c2410_serial_exit();x 	s3c2440_serial_exit();x x@@ -1509,7 +1690,7 @@
 
 		clk = clk_get(port->dev, clksrc.name);x 		if (!IS_ERR(clk) && clk != NULL)
-			rate = clk_get_rate(clk);x+			rate = clk_get_rate(clk) / clksrc.divisor;x 		elsex 			rate = 1;x x@@ -1603,7 +1784,6 @@
 	.setup		= s3c24xx_serial_console_setupx };
 
-
 static int s3c24xx_serial_initconsole(void)x {x 	struct s3c24xx_uart_info *info;x@@ -1618,7 +1798,9 @@
 		return 0;x 	}x x-	if (strcmp(dev->name, "s3c2410-uart") == 0)x{x+	if (strcmp(dev->name, "s3c2400-uart") == 0)x{x+		info = s3c2400_uart_inf_at;x+	} else if (strcmp(dev->name, "s3c2410-uart") == 0)x{x 		info = s3c2410_uart_inf_at;x 	} else if (strcmp(dev->name, "s3c2440-uart") == 0)x{x 		info = s3c2440_uart_inf_at;xdiff -Nru a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c
--- a/drivers/serial/sn_console.c	2005-01-07 21:44:10 -08:00
+++ b/drivers/serial/sn_console.c	2005-03-07 20:41:31 -08:00
@@ -6,7 +6,7 @@
  * driver for that.
  *x  *x- * Copyright (c) 2004 Silicon Graphics, Inc.  All Rights Reserved.x+ * Copyright (c) 2004-2005 Silicon Graphics, Inc.  All Rights Reserved.x  *x  * This program is free software; you can redistribute it and/or modify itx  * under the terms of version 2 of the GNU General Public Licensex@@ -104,6 +104,7 @@
 };
 
 static struct sn_cons_port sal_console_port;x+static int sn_process_input;
 
 /* Only used if USE_DYNAMIC_MINOR is set to 1 */x static struct miscdevice misc;	/* used with misc_register for dynamic */x@@ -681,7 +682,8 @@
 x 	if (!port->sc_port.irq)x{x 		spin_lock_irqsave(&port->sc_port.lock, flags);x-		sn_receive_chars(port, NULL, flags);x+		if (sn_process_input)x+			sn_receive_chars(port, NULL, flags);x 		sn_transmit_chars(port, TRANSMIT_RAW);x 		spin_unlock_irqrestore(&port->sc_port.lock, flags);x 		mod_timer(&port->sc_timer,x@@ -878,6 +880,7 @@
 	if (!IS_RUNNING_ON_SIMULATOR())x{x 		sn_sal_switch_to_interrupts(&sal_console_port);x 	}x+	sn_process_input = 1;x 	return 0;x }x 
diff -Nru a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/serial/vr41xx_siu.c	2005-03-07 20:41:38 -08:00
@@ -0,0 +1,1100 @@
+/*x+ *  Driver for NEC VR4100 series Serial Interface Unit.
+ *x+ *  Copyright (C) 2004-2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *x+ *  Based on drivers/serial/8250.c, by Russell King.
+ *x+ *  This program is free software; you can redistribute it and/or modifyx+ *  it under the terms of the GNU General Public License as published byx+ *  the Free Software Foundation; either version 2 of the License, orx+ *  (at your option) any later version.
+ *x+ *  This program is distributed in the hope that it will be useful,x+ *  but WITHOUT ANY WARRANTY; without even the implied warranty ofx+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thex+ *  GNU General Public License for more details.
+ *x+ *  You should have received a copy of the GNU General Public Licensex+ *  along with this program; if not, write to the Free Softwarex+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USAx+ */x+#include <linux/config.h>x+
+#if defined(CONFIG_SERIAL_VR41XX_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)x+#define SUPPORT_SYSRQx+#endifx+x+#include <linux/console.h>x+#include <linux/device.h>x+#include <linux/err.h>x+#include <linux/ioport.h>x+#include <linux/init.h>x+#include <linux/interrupt.h>x+#include <linux/module.h>x+#include <linux/serial.h>x+#include <linux/serial_core.h>x+#include <linux/serial_reg.h>x+#include <linux/tty.h>x+#include <linux/tty_flip.h>x+
+#include <asm/io.h>x+#include <asm/vr41xx/siu.h>x+#include <asm/vr41xx/vr41xx.h>x+
+#define SIU_PORTS_MAX	2
+#define SIU_BAUD_BASE	1152000
+#define SIU_MAJOR	204
+#define SIU_MINOR_BASE	82x+
+#define RX_MAX_COUNT	256
+#define TX_MAX_COUNT	15x+
+#define SIUIRSEL	0x08x+ #define TMICMODE	0x20x+ #define TMICTX		0x10x+ #define IRMSEL		0x0cx+ #define IRMSEL_HP	0x08x+ #define IRMSEL_TEMIC	0x04x+ #define IRMSEL_SHARP	0x00x+ #define IRUSESEL	0x02x+ #define SIRSEL		0x01x+x+struct siu_port {x+	unsigned int type;x+	unsigned int irq;x+	unsigned long start;x+};x+x+static const struct siu_port siu_type1_ports[] = {x+	{	.type		= PORT_VR41XX_SIU,
+		.irq		= SIU_IRQ,x+		.start		= 0x0c000000UL,		},x+};x+x+#define SIU_TYPE1_NR_PORTS	(sizeof(siu_type1_ports) / sizeof(struct siu_port))x+x+static const struct siu_port siu_type2_ports[] = {x+	{	.type		= PORT_VR41XX_SIU,
+		.irq		= SIU_IRQ,x+		.start		= 0x0f000800UL,		},x+	{	.type		= PORT_VR41XX_DSIU,
+		.irq		= DSIU_IRQ,x+		.start		= 0x0f000820UL,		},x+};x+x+#define SIU_TYPE2_NR_PORTS	(sizeof(siu_type2_ports) / sizeof(struct siu_port))x+x+static struct uart_port siu_uart_ports[SIU_PORTS_MAX];x+static uint8_t lsr_break_flag[SIU_PORTS_MAX];x+x+#define siu_read(port, offset)		readb((port)->membase + (offset))x+#define siu_write(port, offset, value)	writeb((value), (port)->membase + (offset))x+
+void vr41xx_select_siu_interface(siu_interface_t interface)x+{x+	struct uart_port *port;x+	unsigned long flags;x+	uint8_t irsel;x+x+	port = &siu_uart_ports[0];x+x+	spin_lock_irqsave(&port->lock, flags);x+x+	irsel = siu_read(port, SIUIRSEL);
+	if (interface == SIU_INTERFACE_IRDA)x+		irsel |= SIRSEL;
+	elsex+		irsel &= ~SIRSEL;
+	siu_write(port, SIUIRSEL, irsel);
+x+	spin_unlock_irqrestore(&port->lock, flags);x+}x+x+EXPORT_SYMBOL_GPL(vr41xx_select_siu_interface);
+x+void vr41xx_use_irda(irda_use_t use)x+{x+	struct uart_port *port;x+	unsigned long flags;x+	uint8_t irsel;x+x+	port = &siu_uart_ports[0];x+x+	spin_lock_irqsave(&port->lock, flags);x+x+	irsel = siu_read(port, SIUIRSEL);
+	if (use == FIR_USE_IRDA)x+		irsel |= IRUSESEL;
+	elsex+		irsel &= ~IRUSESEL;
+	siu_write(port, SIUIRSEL, irsel);
+x+	spin_unlock_irqrestore(&port->lock, flags);x+}x+x+EXPORT_SYMBOL_GPL(vr41xx_use_irda);
+x+void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed)x+{x+	struct uart_port *port;x+	unsigned long flags;x+	uint8_t irsel;x+x+	port = &siu_uart_ports[0];x+x+	spin_lock_irqsave(&port->lock, flags);x+x+	irsel = siu_read(port, SIUIRSEL);
+	irsel &= ~(IRMSEL | TMICTX | TMICMODE);x+	switch (module)x{x+	case SHARP_IRDA:x+		irsel |= IRMSEL_SHARP;x+		break;x+	case TEMIC_IRDA:x+		irsel |= IRMSEL_TEMIC | TMICMODE;x+		if (speed == IRDA_TX_4MBPS)x+			irsel |= TMICTX;x+		break;x+	case HP_IRDA:x+		irsel |= IRMSEL_HP;x+		break;x+	default:x+		break;x+	}
+	siu_write(port, SIUIRSEL, irsel);
+x+	spin_unlock_irqrestore(&port->lock, flags);x+}x+x+EXPORT_SYMBOL_GPL(vr41xx_select_irda_module);x+x+static inline void siu_clear_fifo(struct uart_port *port)x+{x+	siu_write(port, UART_FCR, UART_FCR_ENABLE_FIFO);x+	siu_write(port, UART_FCR, UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR |x+	                          UART_FCR_CLEAR_XMIT);x+	siu_write(port, UART_FCR, 0);x+}x+x+static inline int siu_probe_ports(void)x+{x+	switch (current_cpu_data.cputype)x{x+	case CPU_VR4111:x+	case CPU_VR4121:x+		return SIU_TYPE1_NR_PORTS;x+	case CPU_VR4122:x+	case CPU_VR4131:x+	case CPU_VR4133:x+		return SIU_TYPE2_NR_PORTS;x+	}x+x+	return 0;x+}x+x+static inline unsigned long siu_port_size(struct uart_port *port)x+{x+	switch (port->type)x{x+	case PORT_VR41XX_SIU:x+		return 11UL;x+	case PORT_VR41XX_DSIU:x+		return 8UL;x+	}x+x+	return 0;x+}x+x+static inline unsigned int siu_check_type(struct uart_port *port)x+{x+	switch (current_cpu_data.cputype)x{x+	case CPU_VR4111:x+	case CPU_VR4121:x+		if (port->line == 0)
+			return PORT_VR41XX_SIU;x+		break;x+	case CPU_VR4122:x+	case CPU_VR4131:x+	case CPU_VR4133:x+		if (port->line == 0)
+			return PORT_VR41XX_SIU;x+		else if (port->line == 1)
+			return PORT_VR41XX_DSIU;x+		break;x+	}x+x+	return PORT_UNKNOWN;x+}x+x+static inline const char *siu_type_name(struct uart_port *port)x+{x+	switch (port->type)x{x+	case PORT_VR41XX_SIU:x+		return "SIU";x+	case PORT_VR41XX_DSIU:x+		return "DSIU";x+	}x+x+	return "unknown";x+}x+x+static unsigned int siu_tx_empty(struct uart_port *port)x+{x+	uint8_t lsr;
+x+	lsr = siu_read(port, UART_LSR);
+	if (lsr & UART_LSR_TEMT)x+		return TIOCSER_TEMT;x+x+	return 0;x+}x+x+static void siu_set_mctrl(struct uart_port *port, unsigned int mctrl)x+{x+	uint8_t mcr = 0;x+x+	if (mctrl & TIOCM_DTR)x+		mcr |= UART_MCR_DTR;x+	if (mctrl & TIOCM_RTS)x+		mcr |= UART_MCR_RTS;x+	if (mctrl & TIOCM_OUT1)x+		mcr |= UART_MCR_OUT1;x+	if (mctrl & TIOCM_OUT2)x+		mcr |= UART_MCR_OUT2;x+	if (mctrl & TIOCM_LOOP)x+		mcr |= UART_MCR_LOOP;
+x+	siu_write(port, UART_MCR, mcr);x+}x+x+static unsigned int siu_get_mctrl(struct uart_port *port)x+{x+	uint8_t msr;
+	unsigned int mctrl = 0;x+x+	msr = siu_read(port, UART_MSR);
+	if (msr & UART_MSR_DCD)x+		mctrl |= TIOCM_CAR;x+	if (msr & UART_MSR_RI)x+		mctrl |= TIOCM_RNG;
+	if (msr & UART_MSR_DSR)x+		mctrl |= TIOCM_DSR;x+	if (msr & UART_MSR_CTS)x+		mctrl |= TIOCM_CTS;x+x+	return mctrl;x+}x+x+static void siu_stop_tx(struct uart_port *port, unsigned int tty_stop)x+{x+	unsigned long flags;x+	uint8_t ier;x+x+	spin_lock_irqsave(&port->lock, flags);x+x+	ier = siu_read(port, UART_IER);
+	ier &= ~UART_IER_THRI;x+	siu_write(port, UART_IER, ier);
+x+	spin_unlock_irqrestore(&port->lock, flags);x+}x+x+static void siu_start_tx(struct uart_port *port, unsigned int tty_start)x+{x+	unsigned long flags;x+	uint8_t ier;x+x+	spin_lock_irqsave(&port->lock, flags);x+x+	ier = siu_read(port, UART_IER);
+	ier |= UART_IER_THRI;x+	siu_write(port, UART_IER, ier);
+x+	spin_unlock_irqrestore(&port->lock, flags);x+}x+x+static void siu_stop_rx(struct uart_port *port)x+{x+	unsigned long flags;x+	uint8_t ier;x+x+	spin_lock_irqsave(&port->lock, flags);x+x+	ier = siu_read(port, UART_IER);
+	ier &= ~UART_IER_RLSI;x+	siu_write(port, UART_IER, ier);
+x+	port->read_status_mask &= ~UART_LSR_DR;
+x+	spin_unlock_irqrestore(&port->lock, flags);x+}x+x+static void siu_enable_ms(struct uart_port *port)x+{x+	unsigned long flags;x+	uint8_t ier;x+x+	spin_lock_irqsave(&port->lock, flags);x+x+	ier = siu_read(port, UART_IER);
+	ier |= UART_IER_MSI;x+	siu_write(port, UART_IER, ier);
+x+	spin_unlock_irqrestore(&port->lock, flags);x+}x+x+static void siu_break_ctl(struct uart_port *port, int ctl)x+{x+	unsigned long flags;x+	uint8_t lcr;x+x+	spin_lock_irqsave(&port->lock, flags);x+x+	lcr = siu_read(port, UART_LCR);
+	if (ctl == -1)x+		lcr |= UART_LCR_SBC;
+	elsex+		lcr &= ~UART_LCR_SBC;
+	siu_write(port, UART_LCR, lcr);
+x+	spin_unlock_irqrestore(&port->lock, flags);x+}x+x+static inline void receive_chars(struct uart_port *port, uint8_t *status,x+                                 struct pt_regs *regs)x+{x+	struct tty_struct *tty;x+	uint8_t lsr, ch;x+	char flag;x+	int max_count = RX_MAX_COUNT;
+x+	tty = port->info->tty;x+	lsr = *status;x+x+	dox{x+		if (unlikely(tty->flip.count >= TTY_FLIPBUF_SIZE))x{x+			if (tty->low_latency)x+				tty_flip_buffer_push(tty);x+		}x+x+		ch = siu_read(port, UART_RX);x+		port->icount.rx++;x+		flag = TTY_NORMAL;x+
+#ifdef CONFIG_SERIAL_VR41XX_CONSOLEx+		lsr |= lsr_break_flag[port->line];x+		lsr_break_flag[port->line] = 0;x+#endifx+		if (unlikely(lsr & (UART_LSR_BI | UART_LSR_FE |x+		                    UART_LSR_PE | UART_LSR_OE)))x{x+			if (lsr & UART_LSR_BI)x{x+				lsr &= ~(UART_LSR_FE | UART_LSR_PE);x+				port->icount.brk++;x+x+				if (uart_handle_break(port))x+					goto ignore_char;x+			}x+x+			if (lsr & UART_LSR_FE)x+				port->icount.frame++;x+			if (lsr & UART_LSR_PE)x+				port->icount.parity++;x+			if (lsr & UART_LSR_OE)x+				port->icount.overrun++;x+x+			lsr &= port->read_status_mask;x+			if (lsr & UART_LSR_BI)x+				flag = TTY_BREAK;x+			if (lsr & UART_LSR_FE)x+				flag = TTY_FRAME;x+			if (lsr & UART_LSR_PE)x+				flag = TTY_PARITY;x+		}x+x+		if (uart_handle_sysrq_char(port, ch, regs))x+			goto ignore_char;x+		if ((lsr & port->ignore_status_mask) == 0)
+			tty_insert_flip_char(tty, ch, flag);x+		if ((lsr & UART_LSR_OE) && (tty->flip.count < TTY_FLIPBUF_SIZE))
+			tty_insert_flip_char(tty, 0, TTY_OVERRUN);x+x+	ignore_char:x+		lsr = siu_read(port, UART_LSR);
+	} while ((lsr & UART_LSR_DR) && (max_count-- > 0));x+x+	tty_flip_buffer_push(tty);x+x+	*status = lsr;
+}x+x+static inline void check_modem_status(struct uart_port *port)x+{x+	uint8_t msr;
+x+	msr = siu_read(port, UART_MSR);
+	if ((msr & UART_MSR_ANY_DELTA) == 0)
+		return;
+	if (msr & UART_MSR_DDCD)x+		uart_handle_dcd_change(port, msr & UART_MSR_DCD);
+	if (msr & UART_MSR_TERI)x+		port->icount.rng++;x+	if (msr & UART_MSR_DDSR)x+		port->icount.dsr++;x+	if (msr & UART_MSR_DCTS)x+		uart_handle_cts_change(port, msr & UART_MSR_CTS);x+x+	wake_up_interruptible(&port->info->delta_msr_wait);x+}x+x+static inline void transmit_chars(struct uart_port *port)x+{x+	struct circ_buf *xmit;x+	int max_count = TX_MAX_COUNT;
+x+	xmit =x&port->info->xmit;x+x+	if (port->x_char) {x+		siu_write(port, UART_TX, port->x_char);x+		port->icount.tx++;x+		port->x_char = 0;x+		return;
+	}x+x+	if (uart_circ_empty(xmit) || uart_tx_stopped(port)) {x+		siu_stop_tx(port, 0);x+		return;
+	}x+x+	dox{x+		siu_write(port, UART_TX, xmit->buf[xmit->tail]);x+		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);x+		port->icount.tx++;x+		if (uart_circ_empty(xmit))
+			break;x+	} while (max_count-- > 0);x+x+	if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)x+		uart_write_wakeup(port);x+x+	if (uart_circ_empty(xmit))x+		siu_stop_tx(port, 0);x+}x+x+static irqreturn_t siu_interrupt(int irq, void *dev_id, struct pt_regs *regs)x+{x+	struct uart_port *port;x+	uint8_t iir, lsr;
+x+	if (dev_id == NULL)
+		return IRQ_NONE;x+x+	port = (struct uart_port *)dev_id;
+x+	iir = siu_read(port, UART_IIR);
+	if (iir & UART_IIR_NO_INT)
+		return IRQ_NONE;x+x+	lsr = siu_read(port, UART_LSR);
+	if (lsr & UART_LSR_DR)
+		receive_chars(port, &lsr, regs);x+x+	check_modem_status(port);x+x+	if (lsr & UART_LSR_THRE)x+		transmit_chars(port);x+x+	return IRQ_HANDLED;x+}x+x+static int siu_startup(struct uart_port *port)x+{x+	int retval;x+x+	siu_clear_fifo(port);x+x+	(void)siu_read(port, UART_LSR);
+	(void)siu_read(port, UART_RX);x+	(void)siu_read(port, UART_IIR);
+	(void)siu_read(port, UART_MSR);
+x+	if (siu_read(port, UART_LSR) == 0xff)x+		return -ENODEV;x+x+	retval = request_irq(port->irq, siu_interrupt, 0, siu_type_name(port), port);
+	if (retval)x+		return retval;x+x+	if (port->type == PORT_VR41XX_DSIU)x+		vr41xx_enable_dsiuint(DSIUINT_ALL);
+x+	siu_write(port, UART_LCR, UART_LCR_WLEN8);x+x+	spin_lock_irq(&port->lock);x+	siu_set_mctrl(port, port->mctrl);x+	spin_unlock_irq(&port->lock);x+x+	siu_write(port, UART_IER, UART_IER_RLSI | UART_IER_RDI);x+x+	(void)siu_read(port, UART_LSR);
+	(void)siu_read(port, UART_RX);x+	(void)siu_read(port, UART_IIR);
+	(void)siu_read(port, UART_MSR);
+x+	return 0;x+}x+x+static void siu_shutdown(struct uart_port *port)x+{x+	unsigned long flags;x+	uint8_t lcr;x+x+	if (port->membase == NULL)
+		return;x+x+	siu_write(port, UART_IER, 0);x+x+	spin_lock_irqsave(&port->lock, flags);x+x+	port->mctrl &= ~TIOCM_OUT2;x+	siu_set_mctrl(port, port->mctrl);x+x+	spin_unlock_irqrestore(&port->lock, flags);x+x+	lcr = siu_read(port, UART_LCR);
+	lcr &= ~UART_LCR_SBC;
+	siu_write(port, UART_LCR, lcr);
+x+	siu_clear_fifo(port);x+x+	(void)siu_read(port, UART_RX);x+x+	if (port->type == PORT_VR41XX_DSIU)x+		vr41xx_disable_dsiuint(DSIUINT_ALL);
+x+	free_irq(port->irq, port);x+}x+x+static void siu_set_termios(struct uart_port *port, struct termios *new,x+                            struct termios *old)x+{x+	tcflag_t c_cflag, c_iflag;x+	uint8_t lcr, fcr, ier;x+	unsigned int baud, quot;x+	unsigned long flags;x+x+	c_cflag = new->c_cflag;x+	switch (c_cflag & CSIZE)x{x+	case CS5:x+		lcr = UART_LCR_WLEN5;x+		break;x+	case CS6:x+		lcr = UART_LCR_WLEN6;x+		break;x+	case CS7:x+		lcr = UART_LCR_WLEN7;x+		break;x+	default:x+		lcr = UART_LCR_WLEN8;x+		break;x+	}x+x+	if (c_cflag & CSTOPB)x+		lcr |= UART_LCR_STOP;
+	if (c_cflag & PARENB)x+		lcr |= UART_LCR_PARITY;x+	if ((c_cflag & PARODD) != PARODD)x+		lcr |= UART_LCR_EPAR;x+	if (c_cflag & CMSPAR)x+		lcr |= UART_LCR_SPAR;x+x+	baud = uart_get_baud_rate(port, new, old, 0, port->uartclk/16);
+	quot = uart_get_divisor(port, baud);x+x+	fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10;x+x+	spin_lock_irqsave(&port->lock, flags);x+x+	uart_update_timeout(port, c_cflag, baud);x+x+	c_iflag = new->c_iflag;x+x+	port->read_status_mask = UART_LSR_THRE | UART_LSR_OE | UART_LSR_DR;x+	if (c_iflag & INPCK)x+		port->read_status_mask |= UART_LSR_FE | UART_LSR_PE;x+	if (c_iflag & (BRKINT | PARMRK))x+		port->read_status_mask |= UART_LSR_BI;x+x+	port->ignore_status_mask = 0;x+	if (c_iflag & IGNPAR)x+		port->ignore_status_mask |= UART_LSR_FE | UART_LSR_PE;x+	if (c_iflag & IGNBRK)x{x+		port->ignore_status_mask |= UART_LSR_BI;x+		if (c_iflag & IGNPAR)x+			port->ignore_status_mask |= UART_LSR_OE;x+	}x+x+	if ((c_cflag & CREAD) == 0)
+		port->ignore_status_mask |= UART_LSR_DR;
+x+	ier = siu_read(port, UART_IER);
+	ier &= ~UART_IER_MSI;x+	if (UART_ENABLE_MS(port, c_cflag))x+		ier |= UART_IER_MSI;x+	siu_write(port, UART_IER, ier);
+x+	siu_write(port, UART_LCR, lcr | UART_LCR_DLAB);
+x+	siu_write(port, UART_DLL, (uint8_t)quot);x+	siu_write(port, UART_DLM, (uint8_t)(quot >> 8));
+x+	siu_write(port, UART_LCR, lcr);
+x+	siu_write(port, UART_FCR, fcr);
+x+	siu_set_mctrl(port, port->mctrl);x+x+	spin_unlock_irqrestore(&port->lock, flags);x+}x+x+static void siu_pm(struct uart_port *port, unsigned int state, unsigned int oldstate)x+{x+	switch (state)x{x+	case 0:x+		switch (port->type)x{x+		case PORT_VR41XX_SIU:x+			vr41xx_supply_clock(SIU_CLOCK);x+			break;x+		case PORT_VR41XX_DSIU:x+			vr41xx_supply_clock(DSIU_CLOCK);x+			break;x+		}x+		break;x+	case 3:x+		switch (port->type)x{x+		case PORT_VR41XX_SIU:x+			vr41xx_mask_clock(SIU_CLOCK);x+			break;x+		case PORT_VR41XX_DSIU:x+			vr41xx_mask_clock(DSIU_CLOCK);x+			break;x+		}x+		break;x+	}x+}x+x+static const char *siu_type(struct uart_port *port)x+{x+	return siu_type_name(port);x+}x+x+static void siu_release_port(struct uart_port *port)x+{x+	unsigned long size;x+x+	if (port->flags	& UPF_IOREMAP)x{x+		iounmap(port->membase);x+		port->membase = NULL;x+	}x+x+	size = siu_port_size(port);
+	release_mem_region(port->mapbase, size);x+}x+x+static int siu_request_port(struct uart_port *port)x+{x+	unsigned long size;x+	struct resource *res;x+x+	size = siu_port_size(port);
+	res = request_mem_region(port->mapbase, size, siu_type_name(port));
+	if (res == NULL)
+		return -EBUSY;x+x+	if (port->flags & UPF_IOREMAP)x{x+		port->membase = ioremap(port->mapbase, size);x+		if (port->membase == NULL)x{x+			release_resource(res);x+			return -ENOMEM;x+		}x+	}x+x+	return 0;x+}x+x+static void siu_config_port(struct uart_port *port, int flags)x+{x+	if (flags & UART_CONFIG_TYPE)x{x+		port->type = siu_check_type(port);x+		(void)siu_request_port(port);x+	}x+}x+x+static int siu_verify_port(struct uart_port *port, struct serial_struct *serial)x+{x+	if (port->type != PORT_VR41XX_SIU && port->type != PORT_VR41XX_DSIU)x+		return -EINVAL;x+	if (port->irq != serial->irq)x+		return -EINVAL;x+	if (port->iotype != serial->io_type)x+		return -EINVAL;x+	if (port->mapbase != (unsigned long)serial->iomem_base)x+		return -EINVAL;x+x+	return 0;x+}x+x+static struct uart_ops siu_uart_ops = {x+	.tx_empty	= siu_tx_empty,x+	.set_mctrl	= siu_set_mctrl,x+	.get_mctrl	= siu_get_mctrl,x+	.stop_tx	= siu_stop_tx,x+	.start_tx	= siu_start_tx,x+	.stop_rx	= siu_stop_rx,x+	.enable_ms	= siu_enable_ms,x+	.break_ctl	= siu_break_ctl,x+	.startup	= siu_startup,x+	.shutdown	= siu_shutdown,x+	.set_termios	= siu_set_termios,x+	.pm		= siu_pm,x+	.type		= siu_type,x+	.release_port	= siu_release_port,x+	.request_port	= siu_request_port,x+	.config_port	= siu_config_port,x+	.verify_port	= siu_verify_port,x+};x+x+static int siu_init_ports(void)x+{x+	const struct siu_port *siu;x+	struct uart_port *port;x+	int i, num;x+x+	switch (current_cpu_data.cputype)x{x+	case CPU_VR4111:x+	case CPU_VR4121:x+		siu = siu_type1_ports;x+		break;x+	case CPU_VR4122:x+	case CPU_VR4131:x+	case CPU_VR4133:x+		siu = siu_type2_ports;x+		break;x+	default:x+		return 0;x+	}x+x+	port = siu_uart_ports;x+	num = siu_probe_ports();x+	for (i = 0; i < num; i++)x{x+		spin_lock_init(&port->lock);x+		port->irq = siu->irq;x+		port->uartclk = SIU_BAUD_BASE * 16;x+		port->fifosize = 16;x+		port->regshift = 0;x+		port->iotype = UPIO_MEM;x+		port->flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF;x+		port->type = siu->type;x+		port->line = i;x+		port->mapbase = siu->start;x+		siu++;x+		port++;x+	}x+x+	return num;x+}x+
+#ifdef CONFIG_SERIAL_VR41XX_CONSOLEx+x+static void early_set_termios(struct uart_port *port, struct termios *new,x+                              struct termios *old)x+{x+	tcflag_t c_cflag;x+	uint8_t lcr;x+	unsigned int baud, quot;x+x+	c_cflag = new->c_cflag;x+	switch (c_cflag & CSIZE)x{x+	case CS5:x+		lcr = UART_LCR_WLEN5;x+		break;x+	case CS6:x+		lcr = UART_LCR_WLEN6;x+		break;x+	case CS7:x+		lcr = UART_LCR_WLEN7;x+		break;x+	default:x+		lcr = UART_LCR_WLEN8;x+		break;x+	}x+x+	if (c_cflag & CSTOPB)x+		lcr |= UART_LCR_STOP;
+	if (c_cflag & PARENB)x+		lcr |= UART_LCR_PARITY;x+	if ((c_cflag & PARODD) != PARODD)x+		lcr |= UART_LCR_EPAR;x+	if (c_cflag & CMSPAR)x+		lcr |= UART_LCR_SPAR;x+x+	baud = uart_get_baud_rate(port, new, old, 0, port->uartclk/16);
+	quot = uart_get_divisor(port, baud);x+x+	siu_write(port, UART_LCR, lcr | UART_LCR_DLAB);
+x+	siu_write(port, UART_DLL, (uint8_t)quot);x+	siu_write(port, UART_DLM, (uint8_t)(quot >> 8));
+x+	siu_write(port, UART_LCR, lcr);
+}x+x+static struct uart_ops early_uart_ops = {x+	.set_termios	= early_set_termios,x+};x+x+#define BOTH_EMPTY	(UART_LSR_TEMT | UART_LSR_THRE)x+x+static void wait_for_xmitr(struct uart_port *port)x+{x+	int timeout = 10000;x+	uint8_t lsr, msr;
+x+	dox{x+		lsr = siu_read(port, UART_LSR);
+		if (lsr & UART_LSR_BI)x+			lsr_break_flag[port->line] = UART_LSR_BI;x+x+		if ((lsr & BOTH_EMPTY) == BOTH_EMPTY)
+			break;x+	} while (timeout-- > 0);x+x+	if (port->flags & UPF_CONS_FLOW)x{x+		timeout = 1000000;x+x+		dox{x+			msr = siu_read(port, UART_MSR);
+			if ((msr & UART_MSR_CTS) != 0)x+				break;x+		} while (timeout-- > 0);x+	}x+}x+x+static void siu_console_write(struct console *con, const char *s, unsigned count)x+{x+	struct uart_port *port;x+	uint8_t ier;x+	unsigned i;x+x+	port = &siu_uart_ports[con->index];
+x+	ier = siu_read(port, UART_IER);
+	siu_write(port, UART_IER, 0);x+x+	for (i = 0; i < count && *s != '\0'; i++, s++)x{x+		wait_for_xmitr(port);x+		siu_write(port, UART_TX, *s);x+		if (*s == '\n')x{x+			wait_for_xmitr(port);x+			siu_write(port, UART_TX, '\r');x+		}x+	}x+x+	wait_for_xmitr(port);x+	siu_write(port, UART_IER, ier);
+}x+x+static int siu_console_setup(struct console *con, char *options)x+{x+	struct uart_port *port;x+	int baud = 9600;x+	int parity = 'n';x+	int bits = 8;x+	int flow = 'n';x+x+	if (con->index >= SIU_PORTS_MAX)x+		con->index = 0;x+x+	port = &siu_uart_ports[con->index];
+	if (port->membase == NULL)x{x+		if (port->mapbase == 0)
+			return -ENODEV;x+		port->membase = (unsigned char __iomem *)KSEG1ADDR(port->mapbase);x+	}x+x+	vr41xx_select_siu_interface(SIU_INTERFACE_RS232C);x+x+	if (options != NULL)
+		uart_parse_options(options, &baud, &parity, &bits, &flow);
+x+	return uart_set_options(port, con, baud, parity, bits, flow);
+}x+x+static struct uart_driver siu_uart_driver;x+x+static struct console siu_console = {x+	.name	= "ttyVR",x+	.write	= siu_console_write,x+	.device	= uart_console_device,x+	.setup	= siu_console_setup,x+	.flags	= CON_PRINTBUFFER,x+	.index	= -1,x+	.data	= &siu_uart_driver,x+};x+x+static int __devinit siu_console_init(void)x+{x+	struct uart_port *port;x+	int num, i;x+x+	num = siu_init_ports();
+	if (num <= 0)
+		return -ENODEV;x+x+	for (i = 0; i < num; i++)x{x+		port = &siu_uart_ports[i];x+		port->ops = &early_uart_ops;x+	}x+x+	register_console(&siu_console);
+x+	return 0;x+}x+x+console_initcall(siu_console_init);x+x+#define SERIAL_VR41XX_CONSOLE	&siu_consolex+#elsex+#define SERIAL_VR41XX_CONSOLE	NULLx+#endifx+x+static struct uart_driver siu_uart_driver = {x+	.owner		= THIS_MODULE,x+	.driver_name	= "SIU",x+	.dev_name	= "ttyVR",x+	.devfs_name	= "ttvr/",x+	.major		= SIU_MAJOR,x+	.minor		= SIU_MINOR_BASE,x+	.cons		= SERIAL_VR41XX_CONSOLE,x+};x+x+static int siu_probe(struct device *dev)x+{x+	struct uart_port *port;x+	int num, i, retval;x+x+	num = siu_init_ports();
+	if (num <= 0)
+		return -ENODEV;x+x+	siu_uart_driver.nr = num;x+	retval = uart_register_driver(&siu_uart_driver);
+	if (retval)x+		return retval;x+x+	for (i = 0; i < num; i++)x{x+		port = &siu_uart_ports[i];x+		port->ops = &siu_uart_ops;x+		port->dev = dev;x+x+		retval = uart_add_one_port(&siu_uart_driver, port);
+		if (retval)x+			break;x+	}x+x+	if (i == 0 && retval < 0)x{x+		uart_unregister_driver(&siu_uart_driver);
+		return retval;x+	}x+x+	return 0;x+}x+x+static int siu_remove(struct device *dev)x+{x+	struct uart_port *port;x+	int i;x+x+	for (i = 0; i < siu_uart_driver.nr; i++)x{x+		port = &siu_uart_ports[i];x+		if (port->dev == dev)x{x+			uart_remove_one_port(&siu_uart_driver, port);
+			port->dev = NULL;x+		}x+	}x+x+	uart_unregister_driver(&siu_uart_driver);
+x+	return 0;x+}x+x+static int siu_suspend(struct device *dev, u32 state, u32 level)x+{x+	struct uart_port *port;x+	int i;x+x+	if (level != SUSPEND_DISABLE)x+		return 0;x+x+	for (i = 0; i < siu_uart_driver.nr; i++)x{x+		port = &siu_uart_ports[i];x+		if ((port->type == PORT_VR41XX_SIU ||x+		     port->type == PORT_VR41XX_DSIU) && port->dev == dev)x+			uart_suspend_port(&siu_uart_driver, port);
+x+	}x+x+	return 0;x+}x+x+static int siu_resume(struct device *dev, u32 level)x+{x+	struct uart_port *port;x+	int i;x+x+	if (level != RESUME_ENABLE)x+		return 0;x+x+	for (i = 0; i < siu_uart_driver.nr; i++)x{x+		port = &siu_uart_ports[i];x+		if ((port->type == PORT_VR41XX_SIU ||x+		     port->type == PORT_VR41XX_DSIU) && port->dev == dev)x+			uart_resume_port(&siu_uart_driver, port);
+	}x+x+	return 0;x+}x+x+static struct platform_device *siu_platform_device;x+x+static struct device_driver siu_device_driver = {x+	.name		= "SIU",x+	.bus		= &platform_bus_type,x+	.probe		= siu_probe,x+	.remove		= siu_remove,x+	.suspend	= siu_suspend,x+	.resume		= siu_resume,x+};x+x+static int __devinit vr41xx_siu_init(void)x+{x+	int retval;x+x+	siu_platform_device = platform_device_register_simple("SIU", -1, NULL, 0);
+	if (IS_ERR(siu_platform_device))x+		return PTR_ERR(siu_platform_device);x+x+	retval = driver_register(&siu_device_driver);
+	if (retval < 0)x+		platform_device_unregister(siu_platform_device);x+x+	return retval;x+}x+x+static void __devexit vr41xx_siu_exit(void)x+{x+	driver_unregister(&siu_device_driver);
+x+	platform_device_unregister(siu_platform_device);x+}x+x+module_init(vr41xx_siu_init);x+module_exit(vr41xx_siu_exit);xdiff -Nru a/drivers/sh/Makefile b/drivers/sh/Makefile
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/sh/Makefile	2005-03-09 09:04:50 -08:00
@@ -0,0 +1,6 @@
+#
+# Makefile for the SuperH specific drivers.
+#
+
+obj-$(CONFIG_SUPERHYWAY) += superhyway/x+xdiff -Nru a/drivers/sh/superhyway/Makefile b/drivers/sh/superhyway/Makefile
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/sh/superhyway/Makefile	2005-03-09 09:04:50 -08:00
@@ -0,0 +1,7 @@
+#
+# Makefile for the SuperHyway bus drivers.
+#
+
+obj-$(CONFIG_SUPERHYWAY)	+= superhyway.o
+obj-$(CONFIG_SYSFS)		+= superhyway-sysfs.o
+xdiff -Nru a/drivers/sh/superhyway/superhyway-sysfs.c b/drivers/sh/superhyway/superhyway-sysfs.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/sh/superhyway/superhyway-sysfs.c	2005-03-09 09:04:50 -08:00
@@ -0,0 +1,45 @@
+/*x+ * drivers/sh/superhyway/superhyway-sysfs.c
+ *x+ * SuperHyway Bus sysfs interface
+ *x+ * Copyright (C) 2004, 2005  Paul Mundt <lethal@linux-sh.org>
+ *x+ * This file is subject to the terms and conditions of the GNU General Publicx+ * License.  See the file "COPYING" in the main directory of this archivex+ * for more details.
+ */x+#include <linux/kernel.h>x+#include <linux/device.h>x+#include <linux/types.h>x+#include <linux/superhyway.h>x+
+#define superhyway_ro_attr(name, fmt, field)				\x+static ssize_t name##_show(struct device *dev, char *buf)		\x+{									\x+	struct superhyway_device *s = to_superhyway_device(dev);	\x+	return sprintf(buf, fmt, s->field);				\x+}x+
+/* VCR flags */x+superhyway_ro_attr(perr_flags, "0x%02x\n", vcr.perr_flags);x+superhyway_ro_attr(merr_flags, "0x%02x\n", vcr.merr_flags);x+superhyway_ro_attr(mod_vers, "0x%04x\n", vcr.mod_vers);x+superhyway_ro_attr(mod_id, "0x%04x\n", vcr.mod_id);x+superhyway_ro_attr(bot_mb, "0x%02x\n", vcr.bot_mb);x+superhyway_ro_attr(top_mb, "0x%02x\n", vcr.top_mb);
+x+/* Misc */x+superhyway_ro_attr(resource, "0x%08lx\n", resource.start);x+x+struct device_attribute superhyway_dev_attrs[] = {x+	__ATTR_RO(perr_flags),x+	__ATTR_RO(merr_flags),x+	__ATTR_RO(mod_vers),x+	__ATTR_RO(mod_id),x+	__ATTR_RO(bot_mb),x+	__ATTR_RO(top_mb),x+	__ATTR_RO(resource),x+	__ATTR_NULL,x+};x+xdiff -Nru a/drivers/sh/superhyway/superhyway.c b/drivers/sh/superhyway/superhyway.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/sh/superhyway/superhyway.c	2005-03-09 09:04:50 -08:00
@@ -0,0 +1,201 @@
+/*x+ * drivers/sh/superhyway/superhyway.c
+ *x+ * SuperHyway Bus Driver
+ *x+ * Copyright (C) 2004, 2005  Paul Mundt <lethal@linux-sh.org>
+ *x+ * This file is subject to the terms and conditions of the GNU General Publicx+ * License.  See the file "COPYING" in the main directory of this archivex+ * for more details.
+ */x+#include <linux/kernel.h>x+#include <linux/device.h>x+#include <linux/init.h>x+#include <linux/module.h>x+#include <linux/types.h>x+#include <linux/list.h>x+#include <linux/superhyway.h>x+
+static int superhyway_devices;x+x+static struct device superhyway_bus_device = {x+	.bus_id = "superhyway",x+};x+x+static void superhyway_device_release(struct device *dev)x+{x+	kfree(to_superhyway_device(dev));x+}x+x+/**x+ * superhyway_add_device - Add a SuperHyway modulex+ * @mod_id: Module ID (taken from MODULE.VCR.MOD_ID).x+ * @base: Physical address where module is mapped.x+ * @vcr: VCR value.
+ *x+ * This is responsible for adding a new SuperHyway module. This sets up a newx+ * struct superhyway_device for the module being added. Each one of @mod_id,x+ * @base, and @vcr are registered with the new device for further usex+ * elsewhere.
+ *x+ * Devices are initially added in the order that they are scanned (from thex+ * top-down of the memory map), and are assigned an ID based on the order thatx+ * they are added. Any manual addition of a module will thus get the ID after
+ * the devices already discovered regardless of where it resides in memory.
+ *x+ * Further work can and should be done in superhyway_scan_bus(), to be sure
+ * that any new modules are properly discovered and subsequently registered.
+ */x+int superhyway_add_device(unsigned int mod_id, unsigned long base,x+			  unsigned long long vcr)x+{x+	struct superhyway_device *dev;x+x+	dev = kmalloc(sizeof(struct superhyway_device), GFP_KERNEL);
+	if (!dev)x+		return -ENOMEM;x+x+	memset(dev, 0, sizeof(struct superhyway_device));x+x+	dev->id.id = mod_id;x+	sprintf(dev->name, "SuperHyway device %04x", dev->id.id);x+x+	dev->vcr		= *((struct vcr_info *)(&vcr));x+	dev->resource.name	= dev->name;x+	dev->resource.start	= base;x+	dev->resource.end	= dev->resource.start + 0x01000000;x+	dev->dev.parent		= &superhyway_bus_device;x+	dev->dev.bus		= &superhyway_bus_type;x+	dev->dev.release	= superhyway_device_release;x+x+	sprintf(dev->dev.bus_id, "%02x", superhyway_devices);
+x+	superhyway_devices++;x+x+	return device_register(&dev->dev);
+}x+x+static int __init superhyway_init(void)x+{x+	device_register(&superhyway_bus_device);
+	return superhyway_scan_bus();
+}x+x+postcore_initcall(superhyway_init);x+x+static const struct superhyway_device_id *x+superhyway_match_id(const struct superhyway_device_id *ids,x+		    struct superhyway_device *dev)x+{x+	while (ids->id)x{x+		if (ids->id == dev->id.id)
+			return ids;x+x+		ids++;x+	}x+x+	return NULL;x+}x+
+static int superhyway_device_probe(struct device *dev)x+{x+	struct superhyway_device *shyway_dev = to_superhyway_device(dev);x+	struct superhyway_driver *shyway_drv = to_superhyway_driver(dev->driver);
+x+	if (shyway_drv && shyway_drv->probe)x{x+		const struct superhyway_device_id *id;x+x+		id = superhyway_match_id(shyway_drv->id_table, shyway_dev);
+		if (id)
+			return shyway_drv->probe(shyway_dev, id);x+	}x+x+	return -ENODEV;x+}x+
+static int superhyway_device_remove(struct device *dev)x+{x+	struct superhyway_device *shyway_dev = to_superhyway_device(dev);x+	struct superhyway_driver *shyway_drv = to_superhyway_driver(dev->driver);
+x+	if (shyway_drv && shyway_drv->remove)x{x+		shyway_drv->remove(shyway_dev);
+		return 0;x+	}x+x+	return -ENODEV;x+}x+
+/**x+ * superhyway_register_driver - Register a new SuperHyway driver
+ * @drv: SuperHyway driver to register.
+ *x+ * This registers the passed in @drv. Any devices matching the id table willx+ * automatically be populated and handed off to the driver's specified probex+ * routine.
+ */x+int superhyway_register_driver(struct superhyway_driver *drv)x+{x+	drv->drv.name	= drv->name;x+	drv->drv.bus	= &superhyway_bus_type;x+	drv->drv.probe	= superhyway_device_probe;x+	drv->drv.remove	= superhyway_device_remove;x+x+	return driver_register(&drv->drv);x+}x+x+/**x+ * superhyway_unregister_driver - Unregister a SuperHyway driver
+ * @drv: SuperHyway driver to unregister.
+ *x+ * This cleans up after superhyway_register_driver(), and should be invoked in
+ * the exit path of any module drivers.
+ */x+void superhyway_unregister_driver(struct superhyway_driver *drv)x+{x+	driver_unregister(&drv->drv);x+}x+x+static int superhyway_bus_match(struct device *dev, struct device_driver *drv)x+{x+	struct superhyway_device *shyway_dev = to_superhyway_device(dev);x+	struct superhyway_driver *shyway_drv = to_superhyway_driver(drv);x+	const struct superhyway_device_id *ids = shyway_drv->id_table;
+x+	if (!ids)x+		return -EINVAL;x+	if (superhyway_match_id(ids, shyway_dev))x+		return 1;x+x+	return -ENODEV;x+}x+
+struct bus_type superhyway_bus_type = {x+	.name		= "superhyway",x+	.match		= superhyway_bus_match,
+#ifdef CONFIG_SYSFSx+	.dev_attrs	= superhyway_dev_attrs,x+#endifx+};x+x+static int __init superhyway_bus_init(void)x+{x+	return bus_register(&superhyway_bus_type);x+}x+x+static void __exit superhyway_bus_exit(void)x+{x+	device_unregister(&superhyway_bus_device);
+	bus_unregister(&superhyway_bus_type);x+}x+x+core_initcall(superhyway_bus_init);x+module_exit(superhyway_bus_exit);
+x+EXPORT_SYMBOL(superhyway_bus_type);x+EXPORT_SYMBOL(superhyway_add_device);x+EXPORT_SYMBOL(superhyway_register_driver);x+EXPORT_SYMBOL(superhyway_unregister_driver);
+x+MODULE_LICENSE("GPL");xdiff -Nru a/drivers/sn/Makefile b/drivers/sn/Makefile
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/sn/Makefile	2005-03-07 20:41:31 -08:00
@@ -0,0 +1,6 @@
+#
+# Makefile for the Altix device drivers.
+#
+#
+
+obj-$(CONFIG_BLK_DEV_SGIIOC4) += ioc4.oxdiff -Nru a/drivers/sn/ioc4.c b/drivers/sn/ioc4.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/sn/ioc4.c	2005-03-07 20:41:31 -08:00
@@ -0,0 +1,65 @@
+/*x+ * This file is subject to the terms and conditions of the GNU General Publicx+ * License.  See the file "COPYING" in the main directory of this archivex+ * for more details.
+ *x+ * Copyright (C) 2005 Silicon Graphics, Inc.  All Rights Reserved.
+ */x+
+/*x+ * This file contains a shim driver for the IOC4 IDE and serial drivers.
+ */x+x+#include <linux/errno.h>x+#include <linux/module.h>x+#include <linux/pci.h>x+#include <linux/ioc4_common.h>x+#include <linux/ide.h>x+
+x+static int __devinitx+ioc4_probe_one(struct pci_dev *pdev, const struct pci_device_id *pci_id)x+{x+	int ret;
+x+	if ((ret = pci_enable_device(pdev)))x{x+		printk(KERN_WARNINGx+			 "%s: Failed to enable device with "x+				"pci_dev 0x%p... returning\n",x+				__FUNCTION__, (void *)pdev);
+		return ret;
+	}x+	pci_set_master(pdev);
+x+	/* attach each sub-device */x+	ret = ioc4_ide_attach_one(pdev, pci_id);
+	if (ret)
+		return ret;
+	return ioc4_serial_attach_one(pdev, pci_id);
+}x+
+/* pci device struct */x+static struct pci_device_id ioc4_s_id_table[] = {x+	{PCI_VENDOR_ID_SGI, PCI_DEVICE_ID_SGI_IOC4, PCI_ANY_ID,x+	 PCI_ANY_ID, 0x0b4000, 0xFFFFFF},x+	{0}x+};x+MODULE_DEVICE_TABLE(pci, ioc4_s_id_table);x+x+static struct pci_driver __devinitdata ioc4_s_driver = {x+	.name	= "IOC4",x+	.id_table = ioc4_s_id_table,x+	.probe	= ioc4_probe_one,x+};x+x+static int __devinit ioc4_detect(void)x+{x+	ioc4_serial_init();x+x+	return pci_register_driver(&ioc4_s_driver);
+}x+module_init(ioc4_detect);
+x+MODULE_AUTHOR("Pat Gefre - Silicon Graphics Inc. (SGI) <pfg@sgi.com>");x+MODULE_DESCRIPTION("PCI driver module for SGI IOC4 Base-IO Card");x+MODULE_LICENSE("GPL");xdiff -Nru a/drivers/usb/Kconfig b/drivers/usb/Kconfig
--- a/drivers/usb/Kconfig	2004-10-21 10:13:54 -07:00
+++ b/drivers/usb/Kconfig	2005-03-07 20:49:58 -08:00
@@ -56,6 +56,8 @@
 
 source "drivers/usb/net/Kconfig"
 
+source "drivers/usb/mon/Kconfig"
+
 comment "USB port drivers"
 	depends on USB
 
diff -Nru a/drivers/usb/Makefile b/drivers/usb/Makefile
--- a/drivers/usb/Makefile	2005-01-14 16:01:13 -08:00
+++ b/drivers/usb/Makefile	2005-03-07 20:49:58 -08:00
@@ -6,6 +6,8 @@
 
 obj-$(CONFIG_USB)		+= core/
 
+obj-$(CONFIG_USB_MON)		+= mon/
+
 obj-$(CONFIG_USB_EHCI_HCD)	+= host/
 obj-$(CONFIG_USB_OHCI_HCD)	+= host/
 obj-$(CONFIG_USB_UHCI_HCD)	+= host/
diff -Nru a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c
--- a/drivers/usb/atm/speedtch.c	2005-02-02 01:49:23 -08:00
+++ b/drivers/usb/atm/speedtch.c	2005-03-07 20:48:27 -08:00
@@ -58,8 +58,8 @@
 #define SPEEDTOUCH_PRODUCTID		0x4061
 
 /* Timeout in jiffies */x-#define CTRL_TIMEOUT (2*HZ)x-#define DATA_TIMEOUT (2*HZ)x+#define CTRL_TIMEOUT 2000x+#define DATA_TIMEOUT 2000x 
 #define OFFSET_7  0		/* size 1 */x #define OFFSET_b  1		/* size 8 */x@@ -474,7 +474,7 @@
 	/* URB 7 */x 	if (dl_512_first)x{	/* some modems need a read before writing the firmware */x 		ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, SPEEDTCH_ENDPOINT_FIRMWARE),
-				   buffer, 0x200, &actual_length, 2 * HZ);x+				   buffer, 0x200, &actual_length, 2000);x x 		if (ret < 0 && ret != -ETIMEDOUT)x 			dbg("speedtch_upload_firmware: read BLOCK0 from modem failed (%d)!", ret);
@@ -766,7 +766,7 @@
 
 	/* First check whether the modem already seems to be alive */x 	ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-			      0x12, 0xc0, 0x07, 0x00, buf7, SIZE_7, HZ / 2);x+			      0x12, 0xc0, 0x07, 0x00, buf7, SIZE_7, 500);x x 	if (ret == SIZE_7)x{x 		dbg("firmware appears to be already loaded");xdiff -Nru a/drivers/usb/class/audio.c b/drivers/usb/class/audio.c
--- a/drivers/usb/class/audio.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/usb/class/audio.c	2005-03-07 20:48:23 -08:00
@@ -1561,7 +1561,7 @@
 	if (fmt->attributes & 0x02)x{x 		data[0] = 1;x 		if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 
-					   PITCH_CONTROL << 8, ep, data, 1, HZ)) < 0)x{x+					   PITCH_CONTROL << 8, ep, data, 1, 1000)) < 0)x{x 			printk(KERN_ERR "usbaudio: failure (error %d) to set output pitch control device %d interface %u endpoint 0x%x to %u\n",x 			       ret, dev->devnum, u->interface, ep, d->srate);x 			return -1;
@@ -1573,13 +1573,13 @@
 		data[1] = d->srate >> 8;
 		data[2] = d->srate >> 16;x 		if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 
-					   SAMPLING_FREQ_CONTROL << 8, ep, data, 3, HZ)) < 0)x{x+					   SAMPLING_FREQ_CONTROL << 8, ep, data, 3, 1000)) < 0)x{x 			printk(KERN_ERR "usbaudio: failure (error %d) to set input sampling frequency device %d interface %u endpoint 0x%x to %u\n",x 			       ret, dev->devnum, u->interface, ep, d->srate);x 			return -1;
 		}x 		if ((ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_IN,
-					   SAMPLING_FREQ_CONTROL << 8, ep, data, 3, HZ)) < 0)x{x+					   SAMPLING_FREQ_CONTROL << 8, ep, data, 3, 1000)) < 0)x{x 			printk(KERN_ERR "usbaudio: failure (error %d) to get input sampling frequency device %d interface %u endpoint 0x%x\n",x 			       ret, dev->devnum, u->interface, ep);x 			return -1;
@@ -1657,7 +1657,7 @@
 	if (fmt->attributes & 0x02)x{x 		data[0] = 1;x 		if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 
-					   PITCH_CONTROL << 8, ep, data, 1, HZ)) < 0)x{x+					   PITCH_CONTROL << 8, ep, data, 1, 1000)) < 0)x{x 			printk(KERN_ERR "usbaudio: failure (error %d) to set output pitch control device %d interface %u endpoint 0x%x to %u\n",x 			       ret, dev->devnum, u->interface, ep, d->srate);x 			return -1;
@@ -1669,13 +1669,13 @@
 		data[1] = d->srate >> 8;
 		data[2] = d->srate >> 16;x 		if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_OUT, 
-					   SAMPLING_FREQ_CONTROL << 8, ep, data, 3, HZ)) < 0)x{x+					   SAMPLING_FREQ_CONTROL << 8, ep, data, 3, 1000)) < 0)x{x 			printk(KERN_ERR "usbaudio: failure (error %d) to set output sampling frequency device %d interface %u endpoint 0x%x to %u\n",x 			       ret, dev->devnum, u->interface, ep, d->srate);x 			return -1;
 		}x 		if ((ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, USB_TYPE_CLASS|USB_RECIP_ENDPOINT|USB_DIR_IN,
-					   SAMPLING_FREQ_CONTROL << 8, ep, data, 3, HZ)) < 0)x{x+					   SAMPLING_FREQ_CONTROL << 8, ep, data, 3, 1000)) < 0)x{x 			printk(KERN_ERR "usbaudio: failure (error %d) to get output sampling frequency device %d interface %u endpoint 0x%x\n",x 			       ret, dev->devnum, u->interface, ep);x 			return -1;
@@ -1754,7 +1754,7 @@
 		data[0] = v1;
 		data[1] = v1 >> 8;
 		if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-				    (ch->chnum << 8) | 1, ms->iface | (ch->unitid << 8), data, 2, HZ) < 0)x+				    (ch->chnum << 8) | 1, ms->iface | (ch->unitid << 8), data, 2, 1000) < 0)x 			goto err;
 		if (!(ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT)))x 			return 0;
@@ -1762,7 +1762,7 @@
 		data[1] = v2 >> 8;
 		if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
 				    ((ch->chnum + !!(ch->flags & MIXFLG_STEREOIN)) << 8) | (1 + !!(ch->flags & MIXFLG_STEREOOUT)),
-				    ms->iface | (ch->unitid << 8), data, 2, HZ) < 0)x+				    ms->iface | (ch->unitid << 8), data, 2, 1000) < 0)x 			goto err;
 		return 0;
 
@@ -1771,14 +1771,14 @@
 		data[0] = v1;
 		data[1] = v1 >> 8;
 		if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-				    (ch->selector << 8) | ch->chnum, ms->iface | (ch->unitid << 8), data, 2, HZ) < 0)x+				    (ch->selector << 8) | ch->chnum, ms->iface | (ch->unitid << 8), data, 2, 1000) < 0)x 			goto err;
 		if (!(ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT)))x 			return 0;
 		data[0] = v2;
 		data[1] = v2 >> 8;
 		if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-				    (ch->selector << 8) | (ch->chnum + 1), ms->iface | (ch->unitid << 8), data, 2, HZ) < 0)x+				    (ch->selector << 8) | (ch->chnum + 1), ms->iface | (ch->unitid << 8), data, 2, 1000) < 0)x 			goto err;
 		return 0;
                 
@@ -1787,13 +1787,13 @@
 	case TREBLE_CONTROL:
 		data[0] = v1 >> 8;
 		if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-				    (ch->selector << 8) | ch->chnum, ms->iface | (ch->unitid << 8), data, 1, HZ) < 0)x+				    (ch->selector << 8) | ch->chnum, ms->iface | (ch->unitid << 8), data, 1, 1000) < 0)x 			goto err;
 		if (!(ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT)))x 			return 0;
 		data[0] = v2 >> 8;
 		if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-				    (ch->selector << 8) | (ch->chnum + 1), ms->iface | (ch->unitid << 8), data, 1, HZ) < 0)x+				    (ch->selector << 8) | (ch->chnum + 1), ms->iface | (ch->unitid << 8), data, 1, 1000) < 0)x 			goto err;
 		return 0;
 
@@ -1820,7 +1820,7 @@
 		if (!ms->ch[i].slctunitid || (mask & (1 << i)))x 			continue;
 		if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    0, ms->iface | (ms->ch[i].slctunitid << 8), &buf, 1, HZ) < 0)x{x+				    0, ms->iface | (ms->ch[i].slctunitid << 8), &buf, 1, 1000) < 0)x{x 			err = -EIO;x 			printk(KERN_ERR "usbaudio: selector read request device %u if %u unit %u failed\n", x 			       dev->devnum, ms->iface, ms->ch[i].slctunitid & 0xff);
@@ -1851,7 +1851,7 @@
 		if (!ms->ch[i].slctunitid || (mask & (1 << i)))x 			continue;
 		if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    0, ms->iface | (ms->ch[i].slctunitid << 8), &buf, 1, HZ) < 0)x{x+				    0, ms->iface | (ms->ch[i].slctunitid << 8), &buf, 1, 1000) < 0)x{x 			err = -EIO;x 			printk(KERN_ERR "usbaudio: selector read request device %u if %u unit %u failed\n", x 			       dev->devnum, ms->iface, ms->ch[i].slctunitid & 0xff);
@@ -1880,7 +1880,7 @@
 				continue;
 			buf = ms->ch[j].slctunitid >> 8;
 			if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-				    0, ms->iface | (ms->ch[j].slctunitid << 8), &buf, 1, HZ) < 0)x{x+				    0, ms->iface | (ms->ch[j].slctunitid << 8), &buf, 1, 1000) < 0)x{x 				err = -EIO;x 				printk(KERN_ERR "usbaudio: selector write request device %u if %u unit %u failed\n", x 				       dev->devnum, ms->iface, ms->ch[j].slctunitid & 0xff);
@@ -3136,18 +3136,18 @@
 	switch (ch->selector)x{x 	case 0:  /* mixer unit request */x 		if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MIN, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    (ch->chnum << 8) | 1, state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)x+				    (ch->chnum << 8) | 1, state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)x 			goto err;
 		ch->minval = buf[0] | (buf[1] << 8);
 		if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MAX, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    (ch->chnum << 8) | 1, state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)x+				    (ch->chnum << 8) | 1, state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)x 			goto err;
 		ch->maxval = buf[0] | (buf[1] << 8);
 		v2 = ch->maxval - ch->minval;
 		if (!v2)x 			v2 = 1;
 		if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    (ch->chnum << 8) | 1, state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)x+				    (ch->chnum << 8) | 1, state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)x 			goto err;
 		v1 = buf[0] | (buf[1] << 8);
 		v3 = v1 - ch->minval;
@@ -3158,7 +3158,7 @@
 		if (ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT))x{x 			if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
 					    ((ch->chnum + !!(ch->flags & MIXFLG_STEREOIN)) << 8) | (1 + !!(ch->flags & MIXFLG_STEREOOUT)),
-					    state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)x+					    state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)x 			goto err;
 			v1 = buf[0] | (buf[1] << 8);
 			v3 = v1 - ch->minval;
@@ -3172,15 +3172,15 @@
 		/* various feature unit controls */x 	case VOLUME_CONTROL:
 		if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MIN, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)x+				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)x 			goto err;
 		ch->minval = buf[0] | (buf[1] << 8);
 		if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MAX, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)x+				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)x 			goto err;
 		ch->maxval = buf[0] | (buf[1] << 8);
 		if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)x+				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)x 			goto err;
 		v1 = buf[0] | (buf[1] << 8);
 		v2 = ch->maxval - ch->minval;
@@ -3193,7 +3193,7 @@
 		ch->value = v3;
 		if (ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT))x{x 			if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-					    (ch->selector << 8) | (ch->chnum + 1), state->ctrlif | (ch->unitid << 8), buf, 2, HZ) < 0)x+					    (ch->selector << 8) | (ch->chnum + 1), state->ctrlif | (ch->unitid << 8), buf, 2, 1000) < 0)x 				goto err;
 			v1 = buf[0] | (buf[1] << 8);
 			v3 = v1 - ch->minval;
@@ -3208,15 +3208,15 @@
 	case MID_CONTROL:
 	case TREBLE_CONTROL:
 		if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MIN, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 1, HZ) < 0)x+				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 1, 1000) < 0)x 			goto err;
 		ch->minval = buf[0] << 8;
 		if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_MAX, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 1, HZ) < 0)x+				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 1, 1000) < 0)x 			goto err;
 		ch->maxval = buf[0] << 8;
 		if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 1, HZ) < 0)x+				    (ch->selector << 8) | ch->chnum, state->ctrlif | (ch->unitid << 8), buf, 1, 1000) < 0)x 			goto err;
 		v1 = buf[0] << 8;
 		v2 = ch->maxval - ch->minval;
@@ -3229,7 +3229,7 @@
 		ch->value = v3;
 		if (ch->flags & (MIXFLG_STEREOIN | MIXFLG_STEREOOUT))x{x 			if (usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), GET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
-					    (ch->selector << 8) | (ch->chnum + 1), state->ctrlif | (ch->unitid << 8), buf, 1, HZ) < 0)x+					    (ch->selector << 8) | (ch->chnum + 1), state->ctrlif | (ch->unitid << 8), buf, 1, 1000) < 0)x 				goto err;
 			v1 = buf[0] << 8;
 			v3 = v1 - ch->minval;
@@ -3522,7 +3522,7 @@
 		printk(KERN_DEBUG "usbaudio: unmuting feature unit %u interface %u\n", ftr[3], state->ctrlif);
 		data[0] = 0;
 		if (usb_control_msg(dev, usb_sndctrlpipe(dev, 0), SET_CUR, USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
-				    (MUTE_CONTROL << 8) | 0xff, state->ctrlif | (ftr[3] << 8), data, 1, HZ) < 0)x+				    (MUTE_CONTROL << 8) | 0xff, state->ctrlif | (ftr[3] << 8), data, 1, 1000) < 0)x 			printk(KERN_WARNING "usbaudio: failure to unmute feature unit %u interface %u\n", ftr[3], state->ctrlif);
  	}x #endifxdiff -Nru a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
--- a/drivers/usb/class/cdc-acm.c	2005-02-25 13:17:33 -08:00
+++ b/drivers/usb/class/cdc-acm.c	2005-03-07 20:48:18 -08:00
@@ -60,6 +60,7 @@
 #include <linux/smp_lock.h>x #include <asm/uaccess.h>x #include <linux/usb.h>x+#include <linux/usb_cdc.h>x #include <asm/byteorder.h>x #include <asm/unaligned.h>x 
@@ -89,7 +90,7 @@
 	int retval = usb_control_msg(acm->dev, usb_sndctrlpipe(acm->dev, 0),
 		request, USB_RT_ACM, value,
 		acm->control->altsetting[0].desc.bInterfaceNumber,x-		buf, len, HZ * 5);x+		buf, len, 5000);x 	dbg("acm_control_msg: rq: 0x%02x val: %#x len: %#x result: %d", request, value, len, retval);x 	return retval < 0 ? retval : 0;
 }
@@ -97,9 +98,12 @@
 /* devices aren't required to support these requests.
  * the cdc acm descriptor tells whether they do...
  */x-#define acm_set_control(acm, control)	acm_ctrl_msg(acm, ACM_REQ_SET_CONTROL, control, NULL, 0)x-#define acm_set_line(acm, line)		acm_ctrl_msg(acm, ACM_REQ_SET_LINE, 0, line, sizeof(struct acm_line))x-#define acm_send_break(acm, ms)		acm_ctrl_msg(acm, ACM_REQ_SEND_BREAK, ms, NULL, 0)x+#define acm_set_control(acm, control) \x+	acm_ctrl_msg(acm, USB_CDC_REQ_SET_CONTROL_LINE_STATE, control, NULL, 0)x+#define acm_set_line(acm, line) \x+	acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line))x+#define acm_send_break(acm, ms) \x+	acm_ctrl_msg(acm, USB_CDC_REQ_SEND_BREAK, ms, NULL, 0)x 
 /*
  * Interrupt handlers for various ACM device responses
@@ -109,7 +113,7 @@
 static void acm_ctrl_irq(struct urb *urb, struct pt_regs *regs)x {x 	struct acm *acm = urb->context;x-	struct usb_ctrlrequest *dr = urb->transfer_buffer;x+	struct usb_cdc_notification *dr = urb->transfer_buffer;x 	unsigned char *data;
 	int newctrl;
 	int status;
@@ -133,14 +137,14 @@
 		goto exit;x x 	data = (unsigned char *)(dr + 1);x-	switch (dr->bRequest)x{x+	switch (dr->bNotificationType) {x x-		case ACM_IRQ_NETWORK:x+		case USB_CDC_NOTIFY_NETWORK_CONNECTION:x x 			dbg("%s network", dr->wValue ? "connected to" : "disconnected from");
 			break;x x-		case ACM_IRQ_LINE_STATE:x+		case USB_CDC_NOTIFY_SERIAL_STATE:x x 			newctrl = le16_to_cpu(get_unaligned((__le16 *) data));
 
@@ -160,8 +164,9 @@
 			break;x x 		default:
-			dbg("unknown control event received: request %d index %d len %d data0 %d data1 %d",
-				dr->bRequest, dr->wIndex, dr->wLength, data[0], data[1]);x+			dbg("unknown notification %d received: index %d len %d data0 %d data1 %d",
+				dr->bNotificationType, dr->wIndex,
+				dr->wLength, data[0], data[1]);x 			break;x 	}x exit:x@@ -485,32 +490,34 @@
 {x 	struct acm *acm = tty->driver_data;
 	struct termios *termios = tty->termios;x-	struct acm_line newline;x+	struct usb_cdc_line_coding newline;x 	int newctrl = acm->ctrlout;x x 	if (!ACM_READY(acm))x 		return;x x-	newline.speed = cpu_to_le32p(acm_tty_speed +x+	newline.dwDTERate = cpu_to_le32p(acm_tty_speed +x 		(termios->c_cflag & CBAUD & ~CBAUDEX) + (termios->c_cflag & CBAUDEX ? 15 : 0));x-	newline.stopbits = termios->c_cflag & CSTOPB ? 2 : 0;
-	newline.parity = termios->c_cflag & PARENB ?x+	newline.bCharFormat = termios->c_cflag & CSTOPB ? 2 : 0;
+	newline.bParityType = termios->c_cflag & PARENB ?x 		(termios->c_cflag & PARODD ? 1 : 2) + (termios->c_cflag & CMSPAR ? 2 : 0) : 0;
-	newline.databits = acm_tty_size[(termios->c_cflag & CSIZE) >> 4];
+	newline.bDataBits = acm_tty_size[(termios->c_cflag & CSIZE) >> 4];
 x 	acm->clocal = ((termios->c_cflag & CLOCAL) != 0);x x-	if (!newline.speed) {x-		newline.speed = acm->line.speed;
+	if (!newline.dwDTERate)x{x+		newline.dwDTERate = acm->line.dwDTERate;x 		newctrl &= ~ACM_CTRL_DTR;x 	} else  newctrl |=  ACM_CTRL_DTR;x x 	if (newctrl != acm->ctrlout)
 		acm_set_control(acm, acm->ctrlout = newctrl);x x-	if (memcmp(&acm->line, &newline, sizeof(struct acm_line))) {x-		memcpy(&acm->line, &newline, sizeof(struct acm_line));
-		dbg("set line: %d %d %d %d", newline.speed, newline.stopbits, newline.parity, newline.databits);
+	if (memcmp(&acm->line, &newline, sizeof newline))x{x+		memcpy(&acm->line, &newline, sizeof newline);x+		dbg("set line: %d %d %d %d", le32_to_cpu(newline.dwDTERate),
+			newline.bCharFormat, newline.bParityType,
+			newline.bDataBits);x 		acm_set_line(acm, &acm->line);x 	}x }
@@ -522,7 +529,7 @@
 static int acm_probe (struct usb_interface *intf,
 		      const struct usb_device_id *id)x {x-	struct union_desc *union_header = NULL;x+	struct usb_cdc_union_desc *union_header = NULL;x 	char *buffer = intf->altsetting->extra;
 	int buflen = intf->altsetting->extralen;
 	struct usb_interface *control_interface;
@@ -573,21 +580,22 @@
 		}x x 		switch (buffer [2]) {x-			case CDC_UNION_TYPE: /* we've found it */x+			case USB_CDC_UNION_TYPE: /* we've found it */x 				if (union_header)x{x 					err("More than one union descriptor, skipping ...");
 					goto next_desc;
 				}
-				union_header = (struct union_desc *)buffer;x+				union_header = (struct usb_cdc_union_desc *)x+							buffer;x 				break;x-			case CDC_COUNTRY_TYPE: /* maybe somehow export */x+			case USB_CDC_COUNTRY_TYPE: /* maybe somehow export */x 				break; /* for now we ignore it */x-			case CDC_HEADER_TYPE: /* maybe check version */ x+			case USB_CDC_HEADER_TYPE: /* maybe check version */ x 				break; /* for now we ignore it */ x-			case CDC_AC_MANAGEMENT_TYPE:x+			case USB_CDC_ACM_TYPE:x 				ac_management_function = buffer[3];x 				break;x-			case CDC_CALL_MANAGEMENT_TYPE:x+			case USB_CDC_CALL_MANAGEMENT_TYPE:x 				call_management_function = buffer[3];x 				call_interface_num = buffer[4];x 				if ((call_management_function & 3) != 3)
@@ -750,8 +758,8 @@
 x 	acm_set_control(acm, acm->ctrlout);x x-	acm->line.speed = cpu_to_le32(9600);x-	acm->line.databits = 8;x+	acm->line.dwDTERate = cpu_to_le32(9600);x+	acm->line.bDataBits = 8;
 	acm_set_line(acm, &acm->line);x x 	usb_driver_claim_interface(&acm_driver, data_interface, acm);
@@ -831,14 +839,20 @@
 	.driver_info = NO_UNION_NORMAL, /* has no union descriptor */x 	},
 	/* control interfaces with various AT-command sets */x-	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 1) },x-	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 2) },x-	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 3) },x-	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 4) },x-	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 5) },x-	{ USB_INTERFACE_INFO(USB_CLASS_COMM, 2, 6) },x+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,x+		USB_CDC_ACM_PROTO_AT_V25TER) },x+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,x+		USB_CDC_ACM_PROTO_AT_PCCA101) },x+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,x+		USB_CDC_ACM_PROTO_AT_PCCA101_WAKE) },x+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,x+		USB_CDC_ACM_PROTO_AT_GSM) },x+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,x+		USB_CDC_ACM_PROTO_AT_3G	) },x+	{ USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,x+		USB_CDC_ACM_PROTO_AT_CDMA) },x x-	/* NOTE:  COMM/2/0xff is likely MSFT RNDIS ... NOT a modem!! */x+	/* NOTE:  COMM/ACM/0xff is likely MSFT RNDIS ... NOT a modem!! */x 	{ }x };
 
diff -Nru a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
--- a/drivers/usb/class/cdc-acm.h	2004-12-24 05:09:42 -08:00
+++ b/drivers/usb/class/cdc-acm.h	2005-03-07 20:49:04 -08:00
@@ -27,24 +27,6 @@
 x #define USB_RT_ACM		(USB_TYPE_CLASS | USB_RECIP_INTERFACE)x 
-#define ACM_REQ_COMMAND		0x00
-#define ACM_REQ_RESPONSE	0x01
-#define ACM_REQ_SET_FEATURE	0x02
-#define ACM_REQ_GET_FEATURE	0x03
-#define ACM_REQ_CLEAR_FEATURE	0x04
-
-#define ACM_REQ_SET_LINE	0x20
-#define ACM_REQ_GET_LINE	0x21
-#define ACM_REQ_SET_CONTROL	0x22
-#define ACM_REQ_SEND_BREAK	0x23
-
-/*
- * IRQs.
- */
-
-#define ACM_IRQ_NETWORK		0x00
-#define ACM_IRQ_LINE_STATE	0x20
-
 /*
  * Output control lines.
  */x@@ -66,17 +48,6 @@
 #define ACM_CTRL_OVERRUN	0x40x 
 /*
- * Line speed and caracter encoding.
- */
-
-struct acm_line {x-	__le32 speed;
-	__u8 stopbits;
-	__u8 parity;
-	__u8 databits;
-} __attribute__ ((packed));
-
-/*
  * Internal driver structures.
  */x 
@@ -88,7 +59,7 @@
 	struct urb *ctrlurb, *readurb, *writeurb;	/* urbs */x 	u8 *ctrl_buffer, *read_buffer, *write_buffer;	/* buffers of urbs */x 	dma_addr_t ctrl_dma, read_dma, write_dma;	/* dma handles of buffers */x-	struct acm_line line;				/* line coding (bits, stop, parity) */x+	struct usb_cdc_line_coding line;		/* bits, stop, parity */x 	struct work_struct work;			/* work queue entry for line discipline waking up */x 	struct tasklet_struct bh;			/* rx processing */x 	spinlock_t throttle_lock;			/* synchronize throtteling and read callback */x@@ -104,24 +75,6 @@
 	unsigned char resubmit_to_unthrottle;		/* throtteling has disabled the read urb */
 	unsigned int ctrl_caps;				/* control capabilities from the class specific header */
 };
-
-/* "Union Functional Descriptor" from CDC spec 5.2.3.X */x-struct union_desc {x-	u8	bLength;x-	u8	bDescriptorType;x-	u8	bDescriptorSubType;x-x-	u8	bMasterInterface0;x-	u8	bSlaveInterface0;x-	/* ... and there could be other slave interfaces */x-} __attribute__ ((packed));
-
-/* class specific descriptor types */x-#define CDC_HEADER_TYPE			0x00
-#define CDC_CALL_MANAGEMENT_TYPE	0x01
-#define CDC_AC_MANAGEMENT_TYPE		0x02
-#define CDC_UNION_TYPE			0x06
-#define CDC_COUNTRY_TYPE		0x07
 x #define CDC_DATA_INTERFACE_TYPE	0x0a
 
diff -Nru a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c
--- a/drivers/usb/class/usblp.c	2005-01-14 16:01:56 -08:00
+++ b/drivers/usb/class/usblp.c	2005-03-07 20:41:59 -08:00
@@ -114,7 +114,7 @@
 #define USBLP_MINORS		16
 #define USBLP_MINOR_BASE	0x 
-#define USBLP_WRITE_TIMEOUT	(5*HZ)			/* 5 seconds */x+#define USBLP_WRITE_TIMEOUT	(5000)			/* 5 seconds */x 
 #define USBLP_FIRST_PROTOCOL	1
 #define USBLP_LAST_PROTOCOL	3
diff -Nru a/drivers/usb/core/config.c b/drivers/usb/core/config.c
--- a/drivers/usb/core/config.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/usb/core/config.c	2005-03-07 20:42:07 -08:00
@@ -420,6 +420,9 @@
 	for (c = 0; c < dev->descriptor.bNumConfigurations; c++)x{x 		struct usb_host_config *cf = &dev->config[c];
 x+		if (cf->string)x+			kfree(cf->string);
+x 		for (i = 0; i < cf->desc.bNumInterfaces; i++)x{x 			if (cf->intf_cache[i])x 				kref_put(&cf->intf_cache[i]->ref, 
diff -Nru a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
--- a/drivers/usb/core/devices.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/usb/core/devices.c	2005-03-07 20:41:46 -08:00
@@ -362,33 +362,21 @@
  */x static char *usb_dump_device_strings (char *start, char *end, struct usb_device *dev)x {x-	char *buf;
-
 	if (start > end)x 		return start;x-	buf = kmalloc(128, GFP_KERNEL);
-	if (!buf)x-		return start;x-	if (dev->descriptor.iManufacturer) {x-		if (usb_string(dev, dev->descriptor.iManufacturer, buf, 128) > 0)x-			start += sprintf(start, format_string_manufacturer, buf);
-	}				
+	if (dev->manufacturer)x+		start += sprintf(start, format_string_manufacturer, dev->manufacturer);
 	if (start > end)x 		goto out;x-	if (dev->descriptor.iProduct) {x-		if (usb_string(dev, dev->descriptor.iProduct, buf, 128) > 0)x-			start += sprintf(start, format_string_product, buf);
-	}
+	if (dev->product)x+		start += sprintf(start, format_string_product, dev->product);
 	if (start > end)x 		goto out;x #ifdef ALLOW_SERIAL_NUMBERx-	if (dev->descriptor.iSerialNumber) {x-		if (usb_string(dev, dev->descriptor.iSerialNumber, buf, 128) > 0)x-			start += sprintf(start, format_string_serialnumber, buf);
-	}
+	if (dev->serial)x+		start += sprintf(start, format_string_serialnumber, dev->serial);x #endifx  out:
-	kfree(buf);
 	return start;x }x x@@ -620,6 +608,7 @@
 		/* we may have dropped BKL - need to check for having lost the race */x 		if (file->private_data)x{x 			kfree(st);x+			st = file->private_data;x 			goto lost_race;
 		}x xdiff -Nru a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
--- a/drivers/usb/core/devio.c	2005-02-25 18:16:15 -08:00
+++ b/drivers/usb/core/devio.c	2005-03-07 20:41:38 -08:00
@@ -565,7 +565,7 @@
 		return -EINVAL;x 	if (!(tbuf = (unsigned char *)__get_free_page(GFP_KERNEL)))x 		return -ENOMEM;x-	tmo = (ctrl.timeout * HZ + 999) / 1000;x+	tmo = ctrl.timeout;x 	if (ctrl.bRequestType & 0x80)x{x 		if (ctrl.wLength && !access_ok(VERIFY_WRITE, ctrl.data, ctrl.wLength))x{x 			free_page((unsigned long)tbuf);
@@ -646,7 +646,7 @@
 		return -EINVAL;x 	if (!(tbuf = kmalloc(len1, GFP_KERNEL)))x 		return -ENOMEM;x-	tmo = (bulk.timeout * HZ + 999) / 1000;x+	tmo = bulk.timeout;x 	if (bulk.ep & 0x80)x{x 		if (len1 && !access_ok(VERIFY_WRITE, bulk.data, len1))x{x 			kfree(tbuf);
@@ -673,11 +673,8 @@
 		usb_lock_device(dev);x 	}x 	kfree(tbuf);
-	if (i < 0)x{x-		dev_warn(&dev->dev, "usbfs: USBDEVFS_BULK failed "
-			 "ep 0x%x len %u ret %d\n", bulk.ep, bulk.len, i);
+	if (i < 0)x 		return i;
-	}
 	return len2;x }x x@@ -816,9 +813,11 @@
 	return status;
 }x x-static int proc_submiturb(struct dev_state *ps, void __user *arg)x+x+static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,x+			     struct usbdevfs_iso_packet_desc __user *iso_frame_desc,x+			     void __user *arg)x {x-	struct usbdevfs_urb uurb;
 	struct usbdevfs_iso_packet_desc *isopkt = NULL;x 	struct usb_host_endpoint *ep;x 	struct async *as;
@@ -826,42 +825,40 @@
 	unsigned int u, totlen, isofrmlen;
 	int ret, interval = 0, ifnum = -1;
 
-	if (copy_from_user(&uurb, arg, sizeof(uurb)))x-		return -EFAULT;
-	if (uurb.flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK|
+	if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK|
 			   URB_NO_FSBR|URB_ZERO_PACKET))x 		return -EINVAL;x-	if (!uurb.buffer)
+	if (!uurb->buffer)
 		return -EINVAL;x-	if (uurb.signr != 0 && (uurb.signr < SIGRTMIN || uurb.signr > SIGRTMAX))
+	if (uurb->signr != 0 && (uurb->signr < SIGRTMIN || uurb->signr > SIGRTMAX))
 		return -EINVAL;x-	if (!(uurb.type == USBDEVFS_URB_TYPE_CONTROL && (uurb.endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) {x-		if ((ifnum = findintfep(ps->dev, uurb.endpoint)) < 0)x+	if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL && (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) {x+		if ((ifnum = findintfep(ps->dev, uurb->endpoint)) < 0)x 			return ifnum;x 		if ((ret = checkintf(ps, ifnum)))x 			return ret;
 	}
-	if ((uurb.endpoint & USB_ENDPOINT_DIR_MASK) != 0)x-		ep = ps->dev->ep_in [uurb.endpoint & USB_ENDPOINT_NUMBER_MASK];
+	if ((uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0)x+		ep = ps->dev->ep_in [uurb->endpoint & USB_ENDPOINT_NUMBER_MASK];
 	elsex-		ep = ps->dev->ep_out [uurb.endpoint & USB_ENDPOINT_NUMBER_MASK];
+		ep = ps->dev->ep_out [uurb->endpoint & USB_ENDPOINT_NUMBER_MASK];
 	if (!ep)x 		return -ENOENT;x-	switch(uurb.type)x{x+	switch(uurb->type)x{x 	case USBDEVFS_URB_TYPE_CONTROL:
 		if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)x 				!= USB_ENDPOINT_XFER_CONTROL)x 			return -EINVAL;x 		/* min 8 byte setup packet, max arbitrary */x-		if (uurb.buffer_length < 8 || uurb.buffer_length > PAGE_SIZE)x+		if (uurb->buffer_length < 8 || uurb->buffer_length > PAGE_SIZE)x 			return -EINVAL;x 		if (!(dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL)))x 			return -ENOMEM;x-		if (copy_from_user(dr, uurb.buffer, 8)) {x+		if (copy_from_user(dr, uurb->buffer, 8)) {x 			kfree(dr);x 			return -EFAULT;
 		}
-		if (uurb.buffer_length < (le16_to_cpup(&dr->wLength) + 8)) {x+		if (uurb->buffer_length < (le16_to_cpup(&dr->wLength) + 8)) {x 			kfree(dr);x 			return -EINVAL;x 		}
@@ -869,11 +866,11 @@
 			kfree(dr);x 			return ret;
 		}
-		uurb.endpoint = (uurb.endpoint & ~USB_ENDPOINT_DIR_MASK) | (dr->bRequestType & USB_ENDPOINT_DIR_MASK);
-		uurb.number_of_packets = 0;
-		uurb.buffer_length = le16_to_cpup(&dr->wLength);
-		uurb.buffer += 8;x-		if (!access_ok((uurb.endpoint & USB_DIR_IN) ?  VERIFY_WRITE : VERIFY_READ, uurb.buffer, uurb.buffer_length)) {x+		uurb->endpoint = (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) | (dr->bRequestType & USB_ENDPOINT_DIR_MASK);
+		uurb->number_of_packets = 0;
+		uurb->buffer_length = le16_to_cpup(&dr->wLength);
+		uurb->buffer += 8;x+		if (!access_ok((uurb->endpoint & USB_DIR_IN) ?  VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length)) {x 			kfree(dr);x 			return -EFAULT;
 		}
@@ -886,29 +883,29 @@
 			return -EINVAL;x 		/* allow single-shot interrupt transfers, at bogus rates */x 		}
-		uurb.number_of_packets = 0;
-		if (uurb.buffer_length > MAX_USBFS_BUFFER_SIZE)x+		uurb->number_of_packets = 0;
+		if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)x 			return -EINVAL;x-		if (!access_ok((uurb.endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb.buffer, uurb.buffer_length))x+		if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length))x 			return -EFAULT;
 		break;x x 	case USBDEVFS_URB_TYPE_ISO:x 		/* arbitrary limit */x-		if (uurb.number_of_packets < 1 || uurb.number_of_packets > 128)
+		if (uurb->number_of_packets < 1 || uurb->number_of_packets > 128)
 			return -EINVAL;x 		if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)x 				!= USB_ENDPOINT_XFER_ISOC)
 			return -EINVAL;x 		interval = 1 << min (15, ep->desc.bInterval - 1);x-		isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb.number_of_packets;
+		isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb->number_of_packets;x 		if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))x 			return -ENOMEM;x-		if (copy_from_user(isopkt, &((struct usbdevfs_urb __user *)arg)->iso_frame_desc, isofrmlen)) {x+		if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) {x 			kfree(isopkt);x 			return -EFAULT;
 		}
-		for (totlen = u = 0; u < uurb.number_of_packets; u++)x{x+		for (totlen = u = 0; u < uurb->number_of_packets; u++)x{x 			if (isopkt[u].length > 1023)x{x 				kfree(isopkt);x 				return -EINVAL;x@@ -919,11 +916,11 @@
 			kfree(isopkt);x 			return -EINVAL;x 		}
-		uurb.buffer_length = totlen;
+		uurb->buffer_length = totlen;
 		break;x x 	case USBDEVFS_URB_TYPE_INTERRUPT:
-		uurb.number_of_packets = 0;
+		uurb->number_of_packets = 0;
 		if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)x 				!= USB_ENDPOINT_XFER_INT)
 			return -EINVAL;x@@ -931,23 +928,23 @@
 			interval = 1 << min (15, ep->desc.bInterval - 1);x 		elsex 			interval = ep->desc.bInterval;
-		if (uurb.buffer_length > MAX_USBFS_BUFFER_SIZE)x+		if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)x 			return -EINVAL;x-		if (!access_ok((uurb.endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb.buffer, uurb.buffer_length))x+		if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length))x 			return -EFAULT;
 		break;x x 	default:
 		return -EINVAL;x 	}x-	if (!(as = alloc_async(uurb.number_of_packets))) {x+	if (!(as = alloc_async(uurb->number_of_packets)))x{x 		if (isopkt)
 			kfree(isopkt);x 		if (dr)x 			kfree(dr);x 		return -ENOMEM;x 	}x-	if (!(as->urb->transfer_buffer = kmalloc(uurb.buffer_length, GFP_KERNEL))) {x+	if (!(as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL))) {x 		if (isopkt)
 			kfree(isopkt);x 		if (dr)x@@ -956,16 +953,16 @@
 		return -ENOMEM;x 	}x         as->urb->dev = ps->dev;x-        as->urb->pipe = (uurb.type << 30) | __create_pipe(ps->dev, uurb.endpoint & 0xf) | (uurb.endpoint & USB_DIR_IN);x-        as->urb->transfer_flags = uurb.flags;x-	as->urb->transfer_buffer_length = uurb.buffer_length;
+        as->urb->pipe = (uurb->type << 30) | __create_pipe(ps->dev, uurb->endpoint & 0xf) | (uurb->endpoint & USB_DIR_IN);
+        as->urb->transfer_flags = uurb->flags;x+	as->urb->transfer_buffer_length = uurb->buffer_length;
 	as->urb->setup_packet = (unsigned char*)dr;x-	as->urb->start_frame = uurb.start_frame;x-	as->urb->number_of_packets = uurb.number_of_packets;
+	as->urb->start_frame = uurb->start_frame;
+	as->urb->number_of_packets = uurb->number_of_packets;x 	as->urb->interval = interval;
         as->urb->context = as;
         as->urb->complete = async_completed;
-	for (totlen = u = 0; u < uurb.number_of_packets; u++)x{x+	for (totlen = u = 0; u < uurb->number_of_packets; u++)x{x 		as->urb->iso_frame_desc[u].offset = totlen;
 		as->urb->iso_frame_desc[u].length = isopkt[u].length;
 		totlen += isopkt[u].length;
@@ -974,15 +971,15 @@
 		kfree(isopkt);x 	as->ps = ps;
         as->userurb = arg;x-	if (uurb.endpoint & USB_DIR_IN)x-		as->userbuffer = uurb.buffer;
+	if (uurb->endpoint & USB_DIR_IN)x+		as->userbuffer = uurb->buffer;
 	elsex 		as->userbuffer = NULL;x-	as->signr = uurb.signr;
+	as->signr = uurb->signr;x 	as->ifnum = ifnum;x 	as->task = current;x-	if (!(uurb.endpoint & USB_DIR_IN)) {x-		if (copy_from_user(as->urb->transfer_buffer, uurb.buffer, as->urb->transfer_buffer_length)) {x+	if (!(uurb->endpoint & USB_DIR_IN)) {x+		if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, as->urb->transfer_buffer_length)) {x 			free_async(as);x 			return -EFAULT;
 		}
@@ -997,6 +994,16 @@
         return 0;
 }x x+static int proc_submiturb(struct dev_state *ps, void __user *arg)x+{x+	struct usbdevfs_urb uurb;
+x+	if (copy_from_user(&uurb, arg, sizeof(uurb)))x+		return -EFAULT;
+x+	return proc_do_submiturb(ps, &uurb, (((struct usbdevfs_urb __user *)arg)->iso_frame_desc), arg);
+}
+x static int proc_unlinkurb(struct dev_state *ps, void __user *arg)x {x 	struct async *as;
@@ -1008,10 +1015,11 @@
 	return 0;
 }x x-static int processcompl(struct async *as)x+static int processcompl(struct async *as, void __user * __user *arg)x {x 	struct urb *urb = as->urb;
 	struct usbdevfs_urb __user *userurb = as->userurb;
+	void __user *addr = as->userurb;
 	unsigned int i;x x 	if (as->userbuffer)
@@ -1034,16 +1042,19 @@
 			     &userurb->iso_frame_desc[i].status))x 			return -EFAULT;
 	}
+x+	free_async(as);x+x+	if (put_user(addr, (void __user * __user *)arg))x+		return -EFAULT;
 	return 0;
 }x x-static int proc_reapurb(struct dev_state *ps, void __user *arg)x+static struct async* reap_as(struct dev_state *ps)x {x         DECLARE_WAITQUEUE(wait, current);x 	struct async *as = NULL;x-	void __user *addr;x 	struct usb_device *dev = ps->dev;x-	int ret;
 x 	add_wait_queue(&ps->wait, &wait);x 	for (;;) {x@@ -1058,16 +1069,14 @@
 	}
 	remove_wait_queue(&ps->wait, &wait);x 	set_current_state(TASK_RUNNING);
-	if (as) {x-		ret = processcompl(as);x-		addr = as->userurb;
-		free_async(as);x-		if (ret)x-			return ret;
-		if (put_user(addr, (void __user * __user *)arg))x-			return -EFAULT;
-		return 0;
-	}
+	return as;
+}
+x+static int proc_reapurb(struct dev_state *ps, void __user *arg)x+{x+	struct async *as = reap_as(ps);
+	if (as)x+		return processcompl(as, (void __user * __user *)arg);
 	if (signal_pending(current))
 		return -EINTR;x 	return -EIO;
@@ -1076,21 +1085,107 @@
 static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg)x {x 	struct async *as;
-	void __user *addr;x-	int ret;
 x 	if (!(as = async_getcompleted(ps)))
 		return -EAGAIN;x-	ret = processcompl(as);x-	addr = as->userurb;
+	return processcompl(as, (void __user * __user *)arg);
+}
+x+#ifdef CONFIG_COMPAT
+x+static int get_urb32(struct usbdevfs_urb *kurb,x+		     struct usbdevfs_urb32 __user *uurb)x+{x+	__u32  uptr;
+	if (get_user(kurb->type, &uurb->type)x||
+	    __get_user(kurb->endpoint, &uurb->endpoint)x||
+	    __get_user(kurb->status, &uurb->status)x||
+	    __get_user(kurb->flags, &uurb->flags)x||
+	    __get_user(kurb->buffer_length, &uurb->buffer_length)x||
+	    __get_user(kurb->actual_length, &uurb->actual_length)x||
+	    __get_user(kurb->start_frame, &uurb->start_frame)x||
+	    __get_user(kurb->number_of_packets, &uurb->number_of_packets)x||
+	    __get_user(kurb->error_count, &uurb->error_count)x||
+	    __get_user(kurb->signr, &uurb->signr))x+		return -EFAULT;
+x+	if (__get_user(uptr, &uurb->buffer))x+		return -EFAULT;
+	kurb->buffer = compat_ptr(uptr);
+	if (__get_user(uptr, &uurb->buffer))x+		return -EFAULT;
+	kurb->usercontext = compat_ptr(uptr);
+
+	return 0;
+}
+x+static int proc_submiturb_compat(struct dev_state *ps, void __user *arg)x+{x+	struct usbdevfs_urb uurb;
+x+	if (get_urb32(&uurb,(struct usbdevfs_urb32 *)arg))x+		return -EFAULT;
+x+	return proc_do_submiturb(ps, &uurb, ((struct usbdevfs_urb __user *)arg)->iso_frame_desc, arg);
+}
+x+static int processcompl_compat(struct async *as, void __user * __user *arg)x+{x+	struct urb *urb = as->urb;
+	struct usbdevfs_urb32 __user *userurb = as->userurb;
+	void __user *addr = as->userurb;
+	unsigned int i;x+
+	if (as->userbuffer)
+		if (copy_to_user(as->userbuffer, urb->transfer_buffer, urb->transfer_buffer_length))x+			return -EFAULT;
+	if (put_user(urb->status, &userurb->status))x+		return -EFAULT;
+	if (put_user(urb->actual_length, &userurb->actual_length))x+		return -EFAULT;
+	if (put_user(urb->error_count, &userurb->error_count))x+		return -EFAULT;
+x+	if (!(usb_pipeisoc(urb->pipe)))x+		return 0;
+	for (i = 0; i < urb->number_of_packets; i++)x{x+		if (put_user(urb->iso_frame_desc[i].actual_length,x+			     &userurb->iso_frame_desc[i].actual_length))x+			return -EFAULT;
+		if (put_user(urb->iso_frame_desc[i].status,x+			     &userurb->iso_frame_desc[i].status))x+			return -EFAULT;
+	}
+x 	free_async(as);x-	if (ret)x-		return ret;
-	if (put_user(addr, (void __user * __user *)arg))x+	if (put_user((u32)(u64)addr, (u32 __user *)arg))x 		return -EFAULT;
 	return 0;
 }x x+static int proc_reapurb_compat(struct dev_state *ps, void __user *arg)x+{x+	struct async *as = reap_as(ps);
+	if (as)x+		return processcompl_compat(as, (void __user * __user *)arg);
+	if (signal_pending(current))
+		return -EINTR;x+	return -EIO;
+}
+x+static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg)x+{x+	struct async *as;
+x+	printk("reapurbnblock\n");
+	if (!(as = async_getcompleted(ps)))
+		return -EAGAIN;x+	printk("reap got as %p\n", as);x+	return processcompl_compat(as, (void __user * __user *)arg);
+}
+x+#endifx+x static int proc_disconnectsignal(struct dev_state *ps, void __user *arg)x {x 	struct usbdevfs_disconnectsignal ds;
@@ -1301,6 +1396,27 @@
 		if (ret >= 0)x 			inode->i_mtime = CURRENT_TIME;
 		break;x+x+#ifdef CONFIG_COMPAT
+x+	case USBDEVFS_SUBMITURB32:x+		snoop(&dev->dev, "%s: SUBMITURB32\n", __FUNCTION__);
+		ret = proc_submiturb_compat(ps, p);
+		if (ret >= 0)x+			inode->i_mtime = CURRENT_TIME;
+		break;x+x+	case USBDEVFS_REAPURB32:x+		snoop(&dev->dev, "%s: REAPURB32\n", __FUNCTION__);
+		ret = proc_reapurb_compat(ps, p);
+		break;x+x+	case USBDEVFS_REAPURBNDELAY32:x+		snoop(&dev->dev, "%s: REAPURBDELAY32\n", __FUNCTION__);
+		ret = proc_reapurbnonblock_compat(ps, p);
+		break;x+x+#endifx x 	case USBDEVFS_DISCARDURB:
 		snoop(&dev->dev, "%s: DISCARDURB\n", __FUNCTION__);
diff -Nru a/drivers/usb/core/file.c b/drivers/usb/core/file.c
--- a/drivers/usb/core/file.c	2005-01-14 16:01:44 -08:00
+++ b/drivers/usb/core/file.c	2005-03-09 09:03:08 -08:00
@@ -66,16 +66,7 @@
 	.open =		usb_open,x };
 
-static void release_usb_class_dev(struct class_device *class_dev)x-{x-	dbg("%s - %s", __FUNCTION__, class_dev->class_id);x-	kfree(class_dev);
-}
-
-static struct class usb_class = {x-	.name		= "usb",
-	.release	= &release_usb_class_dev,
-};
+static struct class_simple *usb_class;
 x int usb_major_init(void)x {x@@ -87,9 +78,9 @@
 		goto out;x 	}x x-	error = class_register(&usb_class);x-	if (error) {x-		err("class_register failed for usb devices");
+	usb_class = class_simple_create(THIS_MODULE, "usb");
+	if (IS_ERR(usb_class))x{x+		err("class_simple_create failed for usb devices");
 		unregister_chrdev(USB_MAJOR, "usb");
 		goto out;x 	}x@@ -102,18 +93,11 @@
 
 void usb_major_cleanup(void)x {x-	class_unregister(&usb_class);x+	class_simple_destroy(usb_class);x 	devfs_remove("usb");
 	unregister_chrdev(USB_MAJOR, "usb");
 }x x-static ssize_t show_dev(struct class_device *class_dev, char *buf)x-{x-	int minor = (int)(long)class_get_devdata(class_dev);
-	return print_dev_t(buf, MKDEV(USB_MAJOR, minor));
-}
-static CLASS_DEVICE_ATTR(dev, S_IRUGO, show_dev, NULL);
-
 /**
  * usb_register_dev - register a USB device, and ask for a minor number
  * @intf: pointer to the usb_interface that is being registeredx@@ -141,7 +125,6 @@
 	int minor_base = class_driver->minor_base;
 	int minor = 0;
 	char name[BUS_ID_SIZE];x-	struct class_device *class_dev;x 	char *temp;
 x #ifdef CONFIG_USB_DYNAMIC_MINORSx@@ -181,22 +164,18 @@
 	devfs_mk_cdev(MKDEV(USB_MAJOR, minor), class_driver->mode, name);x x 	/* create a usb class device for this usb interface */x-	class_dev = kmalloc(sizeof(*class_dev), GFP_KERNEL);
-	if (class_dev) {x-		memset(class_dev, 0x00, sizeof(struct class_device));
-		class_dev->class = &usb_class;
-		class_dev->dev = &intf->dev;x-
-		temp = strrchr(name, '/');x-		if (temp && (temp[1] != 0x00))x-			++temp;
-		elsex-			temp = name;x-		snprintf(class_dev->class_id, BUS_ID_SIZE, "%s", temp);
-		class_set_devdata(class_dev, (void *)(long)intf->minor);
-		class_device_register(class_dev);
-		class_device_create_file(class_dev, &class_device_attr_dev);
-		intf->class_dev = class_dev;x+	temp = strrchr(name, '/');x+	if (temp && (temp[1] != 0x00))x+		++temp;
+	elsex+		temp = name;x+	intf->class_dev = class_simple_device_add(usb_class, MKDEV(USB_MAJOR, minor), &intf->dev, "%s", temp);
+	if (IS_ERR(intf->class_dev))x{x+		spin_lock (&minor_lock);
+		usb_minors[intf->minor] = NULL;x+		spin_unlock (&minor_lock);
+		devfs_remove (name);x+		retval = PTR_ERR(intf->class_dev);x 	}x exit:x 	return retval;
@@ -239,11 +218,8 @@
 x 	snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base);x 	devfs_remove (name);x-
-	if (intf->class_dev) {x-		class_device_unregister(intf->class_dev);x-		intf->class_dev = NULL;x-	}x+	class_simple_device_remove(MKDEV(USB_MAJOR, intf->minor));x+	intf->class_dev = NULL;x 	intf->minor = -1;
 }x EXPORT_SYMBOL(usb_deregister_dev);
diff -Nru a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
--- a/drivers/usb/core/hcd-pci.c	2004-12-18 05:54:45 -08:00
+++ b/drivers/usb/core/hcd-pci.c	2005-03-07 20:43:34 -08:00
@@ -56,11 +56,8 @@
 int usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)x {x 	struct hc_driver	*driver;x-	unsigned long		resource, len;
-	void __iomem		*base;
 	struct usb_hcd		*hcd;x-	int			retval, region;
-	char			buf [8], *bufp = buf;x+	int			retval;
 x 	if (usb_disabled())x 		return -ENODEV;
@@ -78,122 +75,75 @@
 			"Found HC with no IRQ.  Check BIOS/PCI %s setup!\n",x 			pci_name(dev));
    	        retval = -ENODEV;
-		goto done;x+		goto err1;
         }x-	x+x+	hcd = usb_create_hcd (driver, &dev->dev, pci_name(dev));
+	if (!hcd)x{x+		retval = -ENOMEM;x+		goto err1;
+	}
+x 	if (driver->flags & HCD_MEMORY)x{	// EHCI, OHCIx-		region = 0;
-		resource = pci_resource_start (dev, 0);
-		len = pci_resource_len (dev, 0);
-		if (!request_mem_region (resource, len, driver->description))x{x+		hcd->rsrc_start = pci_resource_start (dev, 0);
+		hcd->rsrc_len = pci_resource_len (dev, 0);
+		if (!request_mem_region (hcd->rsrc_start, hcd->rsrc_len,
+				driver->description))x{x 			dev_dbg (&dev->dev, "controller already in use\n");
 			retval = -EBUSY;x-			goto done;x+			goto err2;x 		}
-		base = ioremap_nocache (resource, len);
-		if (base == NULL)x{x+		hcd->regs = ioremap_nocache (hcd->rsrc_start, hcd->rsrc_len);
+		if (hcd->regs == NULL)x{x 			dev_dbg (&dev->dev, "error mapping memory\n");
 			retval = -EFAULT;
-clean_1:x-			release_mem_region (resource, len);
-			dev_err (&dev->dev, "init %s fail, %d\n",
-				pci_name(dev), retval);x-			goto done;x+			goto err3;
 		}x x 	} else { 				// UHCIx-		resource = len = 0;
+		int	region;
+x 		for (region = 0; region < PCI_ROM_RESOURCE; region++)x{x-			if (!(pci_resource_flags (dev, region) & IORESOURCE_IO))x+			if (!(pci_resource_flags (dev, region) &x+					IORESOURCE_IO))x 				continue;x x-			resource = pci_resource_start (dev, region);x-			len = pci_resource_len (dev, region);x-			if (request_region (resource, len,x+			hcd->rsrc_start = pci_resource_start (dev, region);x+			hcd->rsrc_len = pci_resource_len (dev, region);x+			if (request_region (hcd->rsrc_start, hcd->rsrc_len,
 					driver->description))x 				break;x 		}x 		if (region == PCI_ROM_RESOURCE)x{x 			dev_dbg (&dev->dev, "no i/o regions available\n");
 			retval = -EBUSY;x-			goto done;x-		}
-		base = (void __iomem *) resource;x-	}x-
-	// driver->reset(), later on, will transfer device from
-	// control by SMM/BIOS to control by Linux (if needed)x-
-	hcd = usb_create_hcd (driver);
-	if (hcd == NULL){x-		dev_dbg (&dev->dev, "hcd alloc fail\n");
-		retval = -ENOMEM;x-clean_2:
-		if (driver->flags & HCD_MEMORY)x{x-			iounmap (base);x-			goto clean_1;x-		} else {x-			release_region (resource, len);
-			dev_err (&dev->dev, "init %s fail, %d\n",
-				pci_name(dev), retval);x-			goto done;x+			goto err1;x 		}x 	}
-	// hcd zeroed everything
-	hcd->regs = base;
-	hcd->region = region;
 x-	pci_set_drvdata (dev, hcd);
-	hcd->self.bus_name = pci_name(dev);x #ifdef CONFIG_PCI_NAMESx 	hcd->product_desc = dev->pretty_name;x #endifx-	hcd->self.controller = &dev->dev;x-
-	if ((retval = hcd_buffer_create (hcd)) != 0) {x-clean_3:
-		pci_set_drvdata (dev, NULL);
-		usb_put_hcd (hcd);
-		goto clean_2;x-	}x-
-	dev_info (hcd->self.controller, "%s\n", hcd->product_desc);x-
-	/* till now HC has been in an indeterminate state ... */x-	if (driver->reset && (retval = driver->reset (hcd)) < 0)x{x-		dev_err (hcd->self.controller, "can't reset\n");
-		goto clean_3;
-	}
 x 	pci_set_master (dev);x-#ifndef __sparc__x-	sprintf (buf, "%d", dev->irq);x-#elsex-	bufp = __irq_itoa(dev->irq);x-#endifx-	retval = request_irq (dev->irq, usb_hcd_irq, SA_SHIRQ,
-				hcd->driver->description, hcd);
-	if (retval != 0) {x-		dev_err (hcd->self.controller,
-				"request interrupt %s failed\n", bufp);
-		goto clean_3;
-	}
-	hcd->irq = dev->irq;x-
-	dev_info (hcd->self.controller, "irq %s, %s 0x%lx\n", bufp,
-		(driver->flags & HCD_MEMORY)x? "pci mem" : "io base",
-		resource);x-
-	usb_register_bus (&hcd->self);x x-	if ((retval = driver->start (hcd)) < 0)x{x-		dev_err (hcd->self.controller, "init error %d\n", retval);x-		usb_hcd_pci_remove (dev);x-	}x-
-done:x+	retval = usb_add_hcd (hcd, dev->irq, SA_SHIRQ);
 	if (retval != 0)
-		pci_disable_device (dev);x+		goto err4;x+	return retval;
+x+ err4:
+	if (driver->flags & HCD_MEMORY)x{x+		iounmap (hcd->regs);
+ err3:x+		release_mem_region (hcd->rsrc_start, hcd->rsrc_len);
+	} elsex+		release_region (hcd->rsrc_start, hcd->rsrc_len);
+ err2:
+	usb_put_hcd (hcd);
+ err1:
+	pci_disable_device (dev);x+	dev_err (&dev->dev, "init %s fail, %d\n", pci_name(dev), retval);x 	return retval;
 } x EXPORT_SYMBOL (usb_hcd_pci_probe);
@@ -220,34 +170,15 @@
 	hcd = pci_get_drvdata(dev);x 	if (!hcd)x 		return;x-	dev_info (hcd->self.controller, "remove, state %x\n", hcd->state);x-
-	if (in_interrupt ())x-		BUG ();x-
-	if (HCD_IS_RUNNING (hcd->state))x-		hcd->state = USB_STATE_QUIESCING;x-
-	dev_dbg (hcd->self.controller, "roothub graceful disconnect\n");
-	usb_disconnect (&hcd->self.root_hub);x x-	hcd->driver->stop (hcd);
-	hcd_buffer_destroy (hcd);
-	hcd->state = USB_STATE_HALT;
-	pci_set_drvdata(dev, NULL);
-
-	free_irq (hcd->irq, hcd);
+	usb_remove_hcd (hcd);
 	if (hcd->driver->flags & HCD_MEMORY)x{x 		iounmap (hcd->regs);
-		release_mem_region (pci_resource_start (dev, 0),
-			pci_resource_len (dev, 0));x+		release_mem_region (hcd->rsrc_start, hcd->rsrc_len);
 	} else {x-		release_region (pci_resource_start (dev, hcd->region),
-			pci_resource_len (dev, hcd->region));x+		release_region (hcd->rsrc_start, hcd->rsrc_len);
 	}x-
-	usb_deregister_bus (&hcd->self);x-
+	usb_put_hcd (hcd);
 	pci_disable_device(dev);x }x EXPORT_SYMBOL (usb_hcd_pci_remove);
diff -Nru a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
--- a/drivers/usb/core/hcd.c	2005-02-22 02:14:56 -08:00
+++ b/drivers/usb/core/hcd.c	2005-03-07 20:42:57 -08:00
@@ -46,6 +46,7 @@
 x #include "usb.h"x #include "hcd.h"x+#include "hub.h"x x 
 // #define USB_BANDWIDTH_MESSAGESx@@ -87,6 +88,7 @@
 x /* host controllers we manage */x LIST_HEAD (usb_bus_list);x+EXPORT_SYMBOL_GPL (usb_bus_list);x x /* used when allocating bus numbers */x #define USB_MAXBUS		64
@@ -97,6 +99,7 @@
 x /* used when updating list of hcds */x DECLARE_MUTEX (usb_bus_list_lock);	/* exported only for usbfs */x+EXPORT_SYMBOL_GPL (usb_bus_list_lock);
 x /* used when updating hcd data */x static DEFINE_SPINLOCK(hcd_data_lock);
@@ -272,6 +275,10 @@
 		*utf++ = *s++;
 		*utf++ = 0;
 	}
+	if (utfmax > 0)x{x+		*utf = *s;x+		++retval;
+	}
 	return retval;
 }x x@@ -296,30 +303,40 @@
 x 	// language ids
 	if (id == 0) {x-		*data++ = 4; *data++ = 3;	/* 4 bytes string data */x-		*data++ = 0x09; *data++ = 0x04;	/* MSFT-speak for "en-us" */x-		return 4;
+		buf[0] = 4;    buf[1] = 3;	/* 4 bytes string data */x+		buf[2] = 0x09; buf[3] = 0x04;	/* MSFT-speak for "en-us" */x+		len = min (len, 4);x+		memcpy (data, buf, len);
+		return len;
 x 	// serial number
 	} else if (id == 1) {x-		strcpy (buf, hcd->self.bus_name);
+		strlcpy (buf, hcd->self.bus_name, sizeof buf);
 x 	// product description
 	} else if (id == 2) {x-                strcpy (buf, hcd->product_desc);x+		strlcpy (buf, hcd->product_desc, sizeof buf);
 x  	// id 3 == vendor description
 	} else if (id == 3) {x-                sprintf (buf, "%s %s %s",  system_utsname.sysname,x+		snprintf (buf, sizeof buf, "%s %s %s", system_utsname.sysname,x 			system_utsname.release, hcd->driver->description);
 x 	// unsupported IDs --> "protocol stall"
 	} elsex-	    return 0;
+		return -EPIPE;x x-	data [0] = 2 * (strlen (buf) + 1);x-	data [1] = 3;	/* type == string */x-	return 2 + ascii2utf (buf, data + 2, len - 2);x+	switch (len)x{		/* All cases fall through */x+	default:
+		len = 2 + ascii2utf (buf, data + 2, len - 2);x+	case 2:x+		data [1] = 3;	/* type == string */x+	case 1:x+		data [0] = 2 * (strlen (buf) + 1);x+	case 0:x+		;		/* Compiler wants a statement here */x+	}
+	return len;
 }
 x 
@@ -328,11 +345,14 @@
 {x 	struct usb_ctrlrequest *cmd;
  	u16		typeReq, wValue, wIndex, wLength;x-	const u8	*bufp = NULL;x 	u8		*ubuf = urb->transfer_buffer;
+	u8		tbuf [sizeof (struct usb_hub_descriptor)];
+	const u8	*bufp = tbuf;x 	int		len = 0;
 	int		patch_wakeup = 0;
 	unsigned long	flags;x+	int		status = 0;
+	int		n;
 x 	cmd = (struct usb_ctrlrequest *) urb->setup_packet;
 	typeReq  = (cmd->bRequestType << 8) | cmd->bRequest;
@@ -343,17 +363,16 @@
 	if (wLength > urb->transfer_buffer_length)
 		goto error;x x-	/* set up for success */x-	urb->status = 0;
-	urb->actual_length = wLength;x+	urb->actual_length = 0;
 	switch (typeReq)x{x x 	/* DEVICE REQUESTS */x 
 	case DeviceRequest | USB_REQ_GET_STATUS:
-		ubuf [0] = (hcd->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP)x+		tbuf [0] = (hcd->remote_wakeup << USB_DEVICE_REMOTE_WAKEUP)x 				| (1 << USB_DEVICE_SELF_POWERED);x-		ubuf [1] = 0;
+		tbuf [1] = 0;
+		len = 2;
 		break;x 	case DeviceOutRequest | USB_REQ_CLEAR_FEATURE:
 		if (wValue == USB_DEVICE_REMOTE_WAKEUP)x@@ -368,7 +387,8 @@
 			goto error;x 		break;x 	case DeviceRequest | USB_REQ_GET_CONFIGURATION:
-		ubuf [0] = 1;x+		tbuf [0] = 1;
+		len = 1;x 			/* FALLTHROUGH */x 	case DeviceOutRequest | USB_REQ_SET_CONFIGURATION:
 		break;x@@ -395,16 +415,18 @@
 				patch_wakeup = 1;x 			break;x 		case USB_DT_STRING << 8:x-			urb->actual_length = rh_string (
-				wValue & 0xff, hcd,
-				ubuf, wLength);
+			n = rh_string (wValue & 0xff, hcd, ubuf, wLength);
+			if (n < 0)x+				goto error;x+			urb->actual_length = n;x 			break;x 		default:
 			goto error;x 		}x 		break;x 	case DeviceRequest | USB_REQ_GET_INTERFACE:
-		ubuf [0] = 0;x+		tbuf [0] = 0;
+		len = 1;x 			/* FALLTHROUGH */x 	case DeviceOutRequest | USB_REQ_SET_INTERFACE:
 		break;x@@ -420,8 +442,9 @@
 x 	case EndpointRequest | USB_REQ_GET_STATUS:
 		// ENDPOINT_HALT flag
-		ubuf [0] = 0;x-		ubuf [1] = 0;
+		tbuf [0] = 0;
+		tbuf [1] = 0;
+		len = 2;
 			/* FALLTHROUGH */x 	case EndpointOutRequest | USB_REQ_CLEAR_FEATURE:
 	case EndpointOutRequest | USB_REQ_SET_FEATURE:x@@ -433,19 +456,30 @@
 	default:
 		/* non-generic request */x 		if (HCD_IS_SUSPENDED (hcd->state))x-			urb->status = -EAGAIN;x-		elsex-			urb->status = hcd->driver->hub_control (hcd,x+			status = -EAGAIN;x+		elsex{x+			switch (typeReq)x{x+			case GetHubStatus:x+			case GetPortStatus:x+				len = 4;
+				break;x+			case GetHubDescriptor:x+				len = sizeof (struct usb_hub_descriptor);
+				break;x+			}x+			status = hcd->driver->hub_control (hcd,x 				typeReq, wValue, wIndex,
-				ubuf, wLength);
+				tbuf, wLength);
+		}x 		break;x error:
 		/* "protocol stall" on error */x-		urb->status = -EPIPE;x+		status = -EPIPE;x 	}x-	if (urb->status)x{x-		urb->actual_length = 0;
-		if (urb->status != -EPIPE)x{x+
+	if (status)x{x+		len = 0;
+		if (status != -EPIPE)x{x 			dev_dbg (hcd->self.controller,
 				"CTRL: TypeReq=0x%x val=0x%x "
 				"idx=0x%x len=%d ==> %d\n",
@@ -453,7 +487,7 @@
 				wLength, urb->status);x 		}x 	}
-	if (bufp) {x+	if (len)x{x 		if (urb->transfer_buffer_length < len)
 			len = urb->transfer_buffer_length;
 		urb->actual_length = len;
@@ -461,13 +495,19 @@
 		memcpy (ubuf, bufp, len);
 
 		/* report whether RH hardware supports remote wakeup */x-		if (patch_wakeup)
+		if (patch_wakeup &&x+				len > offsetof (struct usb_config_descriptor,
+						bmAttributes))x 			((struct usb_config_descriptor *)ubuf)->bmAttributesx 				|= USB_CONFIG_ATT_WAKEUP;x 	}x x 	/* any errors get returned through the urb completion */x 	local_irq_save (flags);x+	spin_lock (&urb->lock);
+	if (urb->status == -EINPROGRESS)x+		urb->status = status;
+	spin_unlock (&urb->lock);
 	usb_hcd_giveback_urb (hcd, urb, NULL);
 	local_irq_restore (flags);x 	return 0;
@@ -747,6 +787,7 @@
 	up (&usb_bus_list_lock);
 x 	usbfs_add_bus (bus);
+	usbmon_notify_bus_add (bus);
 x 	dev_info (bus->controller, "new USB bus registered, assigned bus number %d\n", bus->busnum);x 	return 0;
@@ -774,11 +815,12 @@
 	list_del (&bus->bus_list);x 	up (&usb_bus_list_lock);
 x+	usbmon_notify_bus_remove (bus);
 	usbfs_remove_bus (bus);
 x 	clear_bit (bus->busnum, busmap.busmap);x x-	class_device_unregister(&bus->class_dev);x+	class_device_del(&bus->class_dev);x }x EXPORT_SYMBOL (usb_deregister_bus);x x@@ -1049,19 +1091,10 @@
 	struct usb_host_endpoint *ep;x 	unsigned long		flags;x x-	ep = (usb_pipein(urb->pipe) ? urb->dev->ep_in : urb->dev->ep_out)x-			[usb_pipeendpoint(urb->pipe)];x-	if (!hcd || !ep)x+	if (!hcd)x 		return -ENODEV;
 x-	/*x-	 * FIXME:  make urb timeouts be generic, keeping the HCD coresx-	 * as simple as possible.x-	 */x-
-	// NOTE:  a generic device/urb monitoring hook would go here.
-	// hcd_monitor_hook(MONITOR_URB_SUBMIT, urb)
-	// It would catch submission paths for all urbs.x+	usbmon_urb_submit(&hcd->self, urb);x x 	/*x 	 * Atomically queue the urb,  first to our records, then to the HCD.
@@ -1072,7 +1105,11 @@
 	// FIXME:  verify that quiescing hc works right (RH cleans up)
 x 	spin_lock_irqsave (&hcd_data_lock, flags);x-	if (unlikely (urb->reject))
+	ep = (usb_pipein(urb->pipe) ? urb->dev->ep_in : urb->dev->ep_out)x+			[usb_pipeendpoint(urb->pipe)];x+	if (unlikely (!ep))x+		status = -ENOENT;x+	else if (unlikely (urb->reject))
 		status = -EPERM;
 	else switch (hcd->state)x{x 	case USB_STATE_RUNNING:
@@ -1088,6 +1125,7 @@
 	spin_unlock_irqrestore (&hcd_data_lock, flags);x 	if (status)x{x 		INIT_LIST_HEAD (&urb->urb_list);x+		usbmon_urb_submit_error(&hcd->self, urb, status);x 		return status;
 	}x x@@ -1104,8 +1142,6 @@
 		 * valid and usb_buffer_{sync,unmap}() not be needed, since
 		 * they could clobber root hub response data.
 		 */x-		urb->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP
-					| URB_NO_SETUP_DMA_MAP);x 		status = rh_urb_enqueue (hcd, urb);
 		goto done;x 	}x@@ -1140,6 +1176,7 @@
 		if (urb->reject)x 			wake_up (&usb_kill_urb_queue);
 		usb_put_urb (urb);
+		usbmon_urb_submit_error(&hcd->self, urb, status);x 	}
 	return status;
 }x@@ -1462,14 +1499,13 @@
  */x void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb, struct pt_regs *regs)x {x-	urb_unlink (urb);
+	int at_root_hub;
 x-	// NOTE:  a generic device/urb monitoring hook would go here.
-	// hcd_monitor_hook(MONITOR_URB_FINISH, urb, dev)x-	// It would catch exit/unlink paths for all urbs.x+	at_root_hub = (urb->dev == hcd->self.root_hub);x+	urb_unlink (urb);
 x 	/* lower level hcd code should use *_dma exclusively */x-	if (hcd->self.controller->dma_mask) {x+	if (hcd->self.controller->dma_mask && !at_root_hub)x{x 		if (usb_pipecontrol (urb->pipe)x 			&& !(urb->transfer_flags & URB_NO_SETUP_DMA_MAP))x 			dma_unmap_single (hcd->self.controller, urb->setup_dma,x@@ -1485,6 +1521,7 @@
 					    : DMA_TO_DEVICE);x 	}
 x+	usbmon_urb_complete (&hcd->self, urb);x 	/* pass ownership to the completion handler */x 	urb->complete (urb, regs);
 	atomic_dec (&urb->use_count);
@@ -1499,12 +1536,11 @@
 /**
  * usb_hcd_irq - hook IRQs to HCD framework (bus glue)x  * @irq: the IRQ being raised
- * @__hcd: pointer to the HCD whose IRQ is beinng signaled
+ * @__hcd: pointer to the HCD whose IRQ is being signaled
  * @r: saved hardware registers
  *
- * When registering a USB bus through the HCD framework code, use this
- * to handle interrupts.  The PCI glue layer does so automatically; only
- * bus glue for non-PCI system busses will need to use this.
+ * If the controller isn't HALTed, calls the driver's irq handler.
+ * Checks whether the controller is now dead.
  */x irqreturn_t usb_hcd_irq (int irq, void *__hcd, struct pt_regs * r)x {x@@ -1555,6 +1591,8 @@
 /**
  * usb_create_hcd - create and initialize an HCD structure
  * @driver: HC driver that will use this hcd
+ * @dev: device for this HC, stored in hcd->self.controller
+ * @bus_name: value to store in hcd->self.bus_name
  * Context: !in_interrupt()x  *
  * Allocate a struct usb_hcd, with extra space at the end for thex@@ -1563,25 +1601,30 @@
  *
  * If memory is unavailable, returns NULL.
  */x-struct usb_hcd *usb_create_hcd (const struct hc_driver *driver)x+struct usb_hcd *usb_create_hcd (const struct hc_driver *driver,x+		struct device *dev, char *bus_name)
 {x 	struct usb_hcd *hcd;
 x 	hcd = kcalloc(1, sizeof(*hcd)x+ driver->hcd_priv_size, GFP_KERNEL);
-	if (!hcd)x+	if (!hcd)x{x+		dev_dbg (dev, "hcd alloc failed\n");x 		return NULL;x+	}x+	dev_set_drvdata(dev, hcd);
 
 	usb_bus_init(&hcd->self);x 	hcd->self.op = &usb_hcd_operations;x 	hcd->self.hcpriv = hcd;x 	hcd->self.release = &hcd_release;x+	hcd->self.controller = dev;x+	hcd->self.bus_name = bus_name;
 x 	init_timer(&hcd->rh_timer);
 x 	hcd->driver = driver;x 	hcd->product_desc = (driver->product_desc) ? driver->product_desc :
 			"USB Host Controller";
-	hcd->state = USB_STATE_HALT;
 
 	return hcd;x }x@@ -1589,6 +1632,153 @@
 
 void usb_put_hcd (struct usb_hcd *hcd)
 {x+	dev_set_drvdata(hcd->self.controller, NULL);
 	usb_bus_put(&hcd->self);x }x EXPORT_SYMBOL (usb_put_hcd);
+
+/**
+ * usb_add_hcd - finish generic HCD structure initialization and register
+ * @hcd: the usb_hcd structure to initialize
+ * @irqnum: Interrupt line to allocate
+ * @irqflags: Interrupt type flags
+ *
+ * Finish the remaining parts of generic HCD initialization: allocate thex+ * buffers of consistent memory, register the bus, request the IRQ line,x+ * and call the driver's reset() and start() routines.
+ */
+int usb_add_hcd(struct usb_hcd *hcd,
+		unsigned int irqnum, unsigned long irqflags)x+{x+	int	retval;
+x+	dev_info(hcd->self.controller, "%s\n", hcd->product_desc);x+x+	/* till now HC has been in an indeterminate state ... */x+	if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0)x{x+		dev_err(hcd->self.controller, "can't reset\n");
+		return retval;
+	}
+x+	if ((retval = hcd_buffer_create(hcd)) != 0) {x+		dev_dbg(hcd->self.controller, "pool alloc failed\n");x+		return retval;
+	}
+x+	if ((retval = usb_register_bus(&hcd->self)) < 0)x+		goto err1;
+x+	if (hcd->driver->irq) {x+		char	buf[8], *bufp = buf;x+x+#ifdef __sparc__x+		bufp = __irq_itoa(irqnum);x+#elsex+		sprintf(buf, "%d", irqnum);x+#endifx+x+		snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",
+				hcd->driver->description, hcd->self.busnum);x+		if ((retval = request_irq(irqnum, &usb_hcd_irq, irqflags,
+				hcd->irq_descr, hcd)) != 0) {x+			dev_err(hcd->self.controller,
+					"request interrupt %s failed\n", bufp);
+			goto err2;x+		}x+		hcd->irq = irqnum;
+		dev_info(hcd->self.controller, "irq %s, %s 0x%08llx\n", bufp,
+				(hcd->driver->flags & HCD_MEMORY)x?
+					"io mem" : "io base", hcd->rsrc_start);
+	} elsex{x+		hcd->irq = -1;
+		if (hcd->rsrc_start)x+			dev_info(hcd->self.controller, "%s 0x%08llx\n",
+					(hcd->driver->flags & HCD_MEMORY)x?
+					"io mem" : "io base", hcd->rsrc_start);
+	}
+x+	if ((retval = hcd->driver->start(hcd)) < 0)x{x+		dev_err(hcd->self.controller, "startup error %d\n", retval);x+		goto err3;
+	}
+x+	return retval;
+x+ err3:x+	if (hcd->irq >= 0)x+		free_irq(irqnum, hcd);
+ err2:
+	usb_deregister_bus(&hcd->self);x+ err1:
+	hcd_buffer_destroy(hcd);
+	return retval;
+} x+EXPORT_SYMBOL (usb_add_hcd);
+
+/**
+ * usb_remove_hcd - shutdown processing for generic HCDs
+ * @hcd: the usb_hcd structure to remove
+ * Context: !in_interrupt()x+ *
+ * Disconnects the root hub, then reverses the effects of usb_add_hcd(),x+ * invoking the HCD's stop() method.
+ */
+void usb_remove_hcd(struct usb_hcd *hcd)
+{x+	dev_info(hcd->self.controller, "remove, state %x\n", hcd->state);x+x+	if (HCD_IS_RUNNING (hcd->state))x+		hcd->state = USB_STATE_QUIESCING;x+x+	dev_dbg(hcd->self.controller, "roothub graceful disconnect\n");
+	usb_disconnect(&hcd->self.root_hub);x+x+	hcd->driver->stop(hcd);
+	hcd->state = USB_STATE_HALT;
+x+	if (hcd->irq >= 0)x+		free_irq(hcd->irq, hcd);
+	usb_deregister_bus(&hcd->self);x+	hcd_buffer_destroy(hcd);
+}x+EXPORT_SYMBOL (usb_remove_hcd);
+
+/*-------------------------------------------------------------------------*/
+x+#if defined(CONFIG_USB_MON)x|| defined(CONFIG_USB_MON_MODULE)
+x+struct usb_mon_operations *mon_ops;
+
+/*x+ * The registration is unlocked.
+ * We do it this way because we do not want to lock in hot paths.x+ *
+ * Notice that the code is minimally error-proof. Because usbmon needs
+ * symbols from usbcore, usbcore gets referenced and cannot be unloaded first.
+ */
+ 
+int usb_mon_register (struct usb_mon_operations *ops)x+{x+x+	if (mon_ops)
+		return -EBUSY;x+x+	mon_ops = ops;
+	mb();
+	return 0;
+}x+EXPORT_SYMBOL_GPL (usb_mon_register);
+
+void usb_mon_deregister (void)x+{x+x+	if (mon_ops == NULL)x{x+		printk(KERN_ERR "USB: monitor was not registered\n");x+		return;x+	}x+	mon_ops = NULL;x+	mb();
+}x+EXPORT_SYMBOL_GPL (usb_mon_deregister);x+x+#endif /* CONFIG_USB_MON */
diff -Nru a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h
--- a/drivers/usb/core/hcd.h	2004-12-18 05:54:45 -08:00
+++ b/drivers/usb/core/hcd.h	2005-03-07 20:43:39 -08:00
@@ -63,6 +63,7 @@
 	struct usb_bus		self;		/* hcd is-a bus */x 
 	const char		*product_desc;	/* product/vendor string */x+	char			irq_descr[24];	/* driver + bus # */x 
 	struct timer_list	rh_timer;	/* drives root hub */x 
@@ -75,10 +76,8 @@
 	unsigned		remote_wakeup:1;/* sw should use wakeup? */x 	int			irq;		/* irq allocated */x 	void __iomem		*regs;		/* device memory/io */x-
-#ifdef	CONFIG_PCIx-	int			region;		/* pci region for regs */x-#endifx+	u64			rsrc_start;	/* memory/io resource start */x+	u64			rsrc_len;	/* memory/io resource length */x 
 #define HCD_BUFFER_POOLS	4
 	struct dma_pool		*pool [HCD_BUFFER_POOLS];
@@ -211,9 +210,12 @@
 extern void usb_hcd_giveback_urb (struct usb_hcd *hcd, struct urb *urb, struct pt_regs *regs);
 extern void usb_bus_init (struct usb_bus *bus);x x-extern struct usb_hcd *usb_create_hcd (const struct hc_driver *driver);x+extern struct usb_hcd *usb_create_hcd (const struct hc_driver *driver,x+		struct device *dev, char *bus_name);
 extern void usb_put_hcd (struct usb_hcd *hcd);x-
+extern int usb_add_hcd(struct usb_hcd *hcd,
+		unsigned int irqnum, unsigned long irqflags);x+extern void usb_remove_hcd(struct usb_hcd *hcd);
 x #ifdef CONFIG_PCIx struct pci_dev;
@@ -408,6 +410,66 @@
 static inline void usbfs_cleanup(void) { }
 x #endif /* CONFIG_USB_DEVICEFS */x+
+/*-------------------------------------------------------------------------*/
+x+#if defined(CONFIG_USB_MON)x|| defined(CONFIG_USB_MON_MODULE)
+x+struct usb_mon_operations {
+	void (*urb_submit)(struct usb_bus *bus, struct urb *urb);
+	void (*urb_submit_error)(struct usb_bus *bus, struct urb *urb, int err);
+	void (*urb_complete)(struct usb_bus *bus, struct urb *urb);
+	/* void (*urb_unlink)(struct usb_bus *bus, struct urb *urb); */x+	void (*bus_add)(struct usb_bus *bus);x+	void (*bus_remove)(struct usb_bus *bus);x+};x+x+extern struct usb_mon_operations *mon_ops;
+
+static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb)x+{x+	if (bus->monitored)x+		(*mon_ops->urb_submit)(bus, urb);
+}
+
+static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
+    int error)x+{x+	if (bus->monitored)x+		(*mon_ops->urb_submit_error)(bus, urb, error);
+}
+
+static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb)x+{x+	if (bus->monitored)x+		(*mon_ops->urb_complete)(bus, urb);
+}
+ 
+static inline void usbmon_notify_bus_add(struct usb_bus *bus)x+{x+	if (mon_ops)
+		(*mon_ops->bus_add)(bus);x+}
+
+static inline void usbmon_notify_bus_remove(struct usb_bus *bus)x+{x+	if (mon_ops)
+		(*mon_ops->bus_remove)(bus);x+}
+
+int usb_mon_register(struct usb_mon_operations *ops);
+void usb_mon_deregister(void);x+x+#elsex+
+static inline void usbmon_urb_submit(struct usb_bus *bus, struct urb *urb) {}
+static inline void usbmon_urb_submit_error(struct usb_bus *bus, struct urb *urb,
+    int error) {}
+static inline void usbmon_urb_complete(struct usb_bus *bus, struct urb *urb) {}
+static inline void usbmon_notify_bus_add(struct usb_bus *bus) {}
+static inline void usbmon_notify_bus_remove(struct usb_bus *bus) {}
+x+#endif /* CONFIG_USB_MON */
 x /*-------------------------------------------------------------------------*/
 
diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
--- a/drivers/usb/core/hub.c	2005-02-09 07:17:53 -08:00
+++ b/drivers/usb/core/hub.c	2005-03-07 20:41:19 -08:00
@@ -74,7 +74,7 @@
 MODULE_PARM_DESC(old_scheme_first,
 		 "start with the old device initialization scheme");x x-static int use_both_schemes = 0;
+static int use_both_schemes = 1;x module_param(use_both_schemes, bool, S_IRUGO | S_IWUSR);x MODULE_PARM_DESC(use_both_schemes,
 		"try the other device initialization scheme if the "
@@ -108,7 +108,7 @@
 		ret = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
 			USB_REQ_GET_DESCRIPTOR, USB_DIR_IN | USB_RT_HUB,
 			USB_DT_HUB << 8, 0, data, size,
-			HZ * USB_CTRL_GET_TIMEOUT);
+			USB_CTRL_GET_TIMEOUT);
 		if (ret >= (USB_DT_HUB_NONVAR_SIZE + 2))x 			return ret;
 	}x@@ -121,7 +121,7 @@
 static int clear_hub_feature(struct usb_device *hdev, int feature)
 {x 	return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
-		USB_REQ_CLEAR_FEATURE, USB_RT_HUB, feature, 0, NULL, 0, HZ);
+		USB_REQ_CLEAR_FEATURE, USB_RT_HUB, feature, 0, NULL, 0, 1000);
 }x x /*
@@ -131,7 +131,7 @@
 {x 	return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
 		USB_REQ_CLEAR_FEATURE, USB_RT_PORT, feature, port1,
-		NULL, 0, HZ);
+		NULL, 0, 1000);
 }x x /*
@@ -141,7 +141,7 @@
 {x 	return usb_control_msg(hdev, usb_sndctrlpipe(hdev, 0),
 		USB_REQ_SET_FEATURE, USB_RT_PORT, feature, port1,
-		NULL, 0, HZ);
+		NULL, 0, 1000);
 }x x /*
@@ -242,7 +242,7 @@
 }
 x /* use a short timeout for hub/port status fetches */x-#define	USB_STS_TIMEOUT		1x+#define	USB_STS_TIMEOUT		1000
 #define	USB_STS_RETRIES		5x x /*
@@ -256,7 +256,7 @@
 	for (i = 0; i < USB_STS_RETRIES && status == -ETIMEDOUT; i++)x{x 		status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
 			USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_HUB, 0, 0,
-			data, sizeof(*data), HZ * USB_STS_TIMEOUT);
+			data, sizeof(*data), USB_STS_TIMEOUT);
 	}
 	return status;
 }x@@ -272,7 +272,7 @@
 	for (i = 0; i < USB_STS_RETRIES && status == -ETIMEDOUT; i++)x{x 		status = usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
 			USB_REQ_GET_STATUS, USB_DIR_IN | USB_RT_PORT, 0, port1,
-			data, sizeof(*data), HZ * USB_STS_TIMEOUT);
+			data, sizeof(*data), USB_STS_TIMEOUT);
 	}
 	return status;
 }x@@ -342,7 +342,7 @@
 {x 	return usb_control_msg(hdev, usb_rcvctrlpipe(hdev, 0),
 			       HUB_CLEAR_TT_BUFFER, USB_RT_PORT, devinfo,
-			       tt, NULL, 0, HZ);
+			       tt, NULL, 0, 1000);
 }x x /*
@@ -459,6 +459,7 @@
 	int	status;
 x 	hub->quiescing = 0;
+	hub->activating = 1;x 	status = usb_submit_urb(hub->urb, GFP_NOIO);x 	if (status < 0)x 		dev_err(hub->intfdev, "activate --> %d\n", status);x@@ -466,7 +467,6 @@
 		schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD);
 x 	/* scan all ports ASAP */x-	hub->event_bits[0] = (1UL << (hub->descriptor->bNbrPorts + 1)) - 1;x 	kick_khubd(hub);x }x x@@ -689,7 +689,6 @@
 		hub->indicator [0] = INDICATOR_CYCLE;
 x 	hub_power_on(hub);x-	hub->change_bits[0] = (1UL << (hub->descriptor->bNbrPorts + 1)) - 2;
 	hub_activate(hub);x 	return 0;
 x@@ -1103,23 +1102,33 @@
 }
 x #ifdef DEBUG
-static void show_string(struct usb_device *udev, char *id, int index)
+static void show_string(struct usb_device *udev, char *id, char *string)x+{x+	if (!string)x+		return;x+	dev_printk(KERN_INFO, &udev->dev, "%s: %s\n", id, string);
+}
+x+#elsex+static inline void show_string(struct usb_device *udev, char *id, char *string)x+{}x+#endifx+x+static void get_string(struct usb_device *udev, char **string, int index)
x{x 	char *buf;
 x 	if (!index)
x		return;x-	if (!(buf = kmalloc(256, GFP_KERNEL)))x+	buf = kmalloc(256, GFP_KERNEL);
+	if (!buf)xx		return;x 	if (usb_string(udev, index, buf, 256) > 0)x-		dev_printk(KERN_INFO, &udev->dev, "%s: %s\n", id, buf);
-	kfree(buf);
+		*string = buf;x+	elsex+		kfree(buf);
 }x x-#elsex-static inline void show_string(struct usb_device *udev, char *id, int index)
-{}x-#endifx x #ifdef	CONFIG_USB_OTGx #include "otg_whitelist.h"x@@ -1157,22 +1166,20 @@
 		goto fail;x 	}
 x+	/* read the standard strings and cache them if present */x+	get_string(udev, &udev->product, udev->descriptor.iProduct);
+	get_string(udev, &udev->manufacturer, udev->descriptor.iManufacturer);
+	get_string(udev, &udev->serial, udev->descriptor.iSerialNumber);
+x 	/* Tell the world! */x 	dev_dbg(&udev->dev, "new device strings: Mfr=%d, Product=%d, "
 			"SerialNumber=%d\n",
 			udev->descriptor.iManufacturer,
 			udev->descriptor.iProduct,
 			udev->descriptor.iSerialNumber);
-
-	if (udev->descriptor.iProduct)x-		show_string(udev, "Product",
-				udev->descriptor.iProduct);
-	if (udev->descriptor.iManufacturer)x-		show_string(udev, "Manufacturer",
-				udev->descriptor.iManufacturer);
-	if (udev->descriptor.iSerialNumber)x-		show_string(udev, "SerialNumber",
-				udev->descriptor.iSerialNumber);
+	show_string(udev, "Product", udev->product);
+	show_string(udev, "Manufacturer", udev->manufacturer);
+	show_string(udev, "SerialNumber", udev->serial);
 x #ifdef	CONFIG_USB_OTGx 	/*
@@ -1214,7 +1221,7 @@
 					bus->b_hnp_enable
 						? USB_DEVICE_B_HNP_ENABLE
 						: USB_DEVICE_A_ALT_HNP_SUPPORT,
-					0, NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
+					0, NULL, 0, USB_CTRL_SET_TIMEOUT);
 				if (err < 0)x{x 					/* OTG MESSAGE: report errors here,
 					 * customize to match your product.
@@ -1235,10 +1242,10 @@
 		 */x 		if (udev->bus->b_hnp_enablex|| udev->bus->is_b_host)x{x 			static int __usb_suspend_device (struct usb_device *,
-						int port1, u32 state);x+						int port1, pm_message_t state);x 			err = __usb_suspend_device(udev,
 					udev->bus->otg_port,
-					PM_SUSPEND_MEM);x+					PMSG_SUSPEND);x 			if (err < 0)
 				dev_dbg(&udev->dev, "HNP fail, %d\n", err);
 		}x@@ -1526,7 +1533,7 @@
  * Linux (2.6) currently has NO mechanisms to initiate that:  no khubd
  * timer, no SRP, no requests through sysfs.
  */x-int __usb_suspend_device (struct usb_device *udev, int port1, u32 state)
+int __usb_suspend_device (struct usb_device *udev, int port1, pm_message_t state)
x{x 	int	status;
 x@@ -1624,7 +1631,7 @@
 /**
  * usb_suspend_device - suspend a usb device
  * @udev: device that's no longer in active use
- * @state: PM_SUSPEND_MEM to suspend
+ * @state: PMSG_SUSPEND to suspend
  * Context: must be ablexto sleep; device not locked
  *
  * Suspends a USB device that isn't in active use, conserving power.
@@ -1673,7 +1680,7 @@
 	usb_set_device_state(udev, udev->actconfig
 			? USB_STATE_CONFIGURED
 			: USB_STATE_ADDRESS);
-	udev->dev.power.power_state = PM_SUSPEND_ON;x+	udev->dev.power.power_state = PMSG_ON;x x  	/* 10.5.4.5 says be sure devices in the tree are still there.
  	 * For now let's assume the device didn't go crazy on resume,x@@ -1874,7 +1881,7 @@
 	return status;
 }x x-static int hub_suspend(struct usb_interface *intf, u32 state)
+static int hub_suspend(struct usb_interface *intf, pm_message_t state)
x{x 	struct usb_hub		*hub = usb_get_intfdata (intf);
 	struct usb_device	*hdev = hub->hdev;
@@ -1946,7 +1953,7 @@
 		}x 		up(&udev->serialize);x 	}x-	intf->dev.power.power_state = PM_SUSPEND_ON;x+	intf->dev.power.power_state = PMSG_ON;x x 	hub_activate(hub);x 	return 0;
@@ -2058,7 +2065,7 @@
 		return -EINVAL;x 	retval = usb_control_msg(udev, usb_sndaddr0pipe(),
 		USB_REQ_SET_ADDRESS, 0, udev->devnum, 0,
-		NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
+		NULL, 0, USB_CTRL_SET_TIMEOUT);
 	if (retval == 0) {x 		usb_set_device_state(udev, USB_STATE_ADDRESS);
 		ep0_reinit(udev);x@@ -2181,24 +2188,35 @@
 				retval = -ENOMEM;x 				continue;x 			}
-			buf->bMaxPacketSize0 = 0;
 
 			/* Use a short timeout the first time through,
 			 * so that recalcitrant full-speed devices with
 			 * 8- or 16-byte ep0-maxpackets won't slow things
 			 * down tremendously by NAKing the unexpectedly
-			 * early status stage.  Also, retry on length 0
-			 * or stall; some devices are flakey.
+			 * early status stage.  Also, retry on all errors;
+			 * some devices are flakey.
 			 */x 			for (j = 0; j < 3; ++j) {x+				buf->bMaxPacketSize0 = 0;
 				r = usb_control_msg(udev, usb_rcvaddr0pipe(),
 					USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
 					USB_DT_DEVICE << 8, 0,
 					buf, GET_DESCRIPTOR_BUFSIZE,
-					(i ? HZ * USB_CTRL_GET_TIMEOUT : HZ));x-				if (r == 0x|| r == -EPIPE)
-					continue;x-				if (r < 0)x+					(i ? USB_CTRL_GET_TIMEOUT : 1000));x+				switch (buf->bMaxPacketSize0) {x+				case 8: case 16: case 32: case 64:x+					if (buf->bDescriptorType ==x+							USB_DT_DEVICE) {x+						r = 0;x+						break;x+					}x+					/* FALL THROUGH */x+				default:
+					if (r == 0)x+						r = -EPROTO;x+					break;x+				}x+				if (r == 0)x 					break;x 			}x 			udev->descriptor.bMaxPacketSize0 =
@@ -2214,10 +2232,7 @@
 				retval = -ENODEV;
 				goto fail;x 			}
-			switch (udev->descriptor.bMaxPacketSize0)x{x-			case 64: case 32: case 16: case 8:x-				break;x-			default:
+			if (r)x{x 				dev_err(&udev->dev, "device descriptor "
 						"read/%s, error %d\n",
 						"64", r);x@@ -2630,7 +2645,7 @@
 		for (i = 1; i <= hub->descriptor->bNbrPorts; i++)x{x 			connect_change = test_bit(i, hub->change_bits);x 			if (!test_and_clear_bit(i, hub->event_bits) &&x-					!connect_change)x+					!connect_change && !hub->activating)x 				continue;x x 			ret = hub_port_status(hub, i,x@@ -2638,6 +2653,11 @@
 			if (ret < 0)
 				continue;x x+			if (hub->activating && !hdev->children[i-1] &&x+					(portstatus &x+						USB_PORT_STAT_CONNECTION))x+				connect_change = 1;
+x 			if (portchange & USB_PORT_STAT_C_CONNECTION)x{x 				clear_port_feature(hdev, i,
 					USB_PORT_FEAT_C_CONNECTION);
@@ -2728,6 +2748,8 @@
 			}
 		}x x+		hub->activating = 0;
+x loop:x 		usb_unlock_device(hdev);x 		usb_put_intf(intf);
@@ -2952,7 +2974,7 @@
 	ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 			USB_REQ_SET_CONFIGURATION, 0,
 			udev->actconfig->desc.bConfigurationValue, 0,
-			NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
+			NULL, 0, USB_CTRL_SET_TIMEOUT);
 	if (ret < 0)x{x 		dev_err(&udev->dev,
 			"can't restore configuration #%d (error=%d)\n",
diff -Nru a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h
--- a/drivers/usb/core/hub.h	2004-12-19 04:14:07 -08:00
+++ b/drivers/usb/core/hub.h	2005-03-07 20:50:41 -08:00
@@ -215,6 +215,7 @@
 	u8			power_budget;	/* in 2mA units; or zero */x 
 	unsigned		quiescing:1;
+	unsigned		activating:1;
 
 	unsigned		has_indicators:1;
 	enum hub_led_mode	indicator[USB_MAXCHILDREN];
diff -Nru a/drivers/usb/core/message.c b/drivers/usb/core/message.c
--- a/drivers/usb/core/message.c	2005-01-14 16:01:56 -08:00
+++ b/drivers/usb/core/message.c	2005-03-07 20:42:07 -08:00
@@ -55,7 +55,7 @@
 	if (status == 0) {x 		if (timeout > 0)x{x 			init_timer(&timer);
-			timer.expires = jiffies + timeout;
+			timer.expires = jiffies + msecs_to_jiffies(timeout);x 			timer.data = (unsigned long)urb;x 			timer.function = timeout_kill;
 			/* grr.  timeout _should_ include submit delays. */x@@ -65,12 +65,18 @@
 		status = urb->status;
 		/* note:  HCDs return ETIMEDOUT for other reasons too */x 		if (status == -ECONNRESET)x{x-			dev_warn(&urb->dev->dev,
-				"%s timed out on ep%d%s\n",x+			dev_dbg(&urb->dev->dev,
+				"%s timed out on ep%d%s len=%d/%d\n",
 				current->comm,
 				usb_pipeendpoint(urb->pipe),
-				usb_pipein(urb->pipe) ? "in" : "out");
-			status = -ETIMEDOUT;
+				usb_pipein(urb->pipe) ? "in" : "out",
+				urb->actual_length,
+				urb->transfer_buffer_length
+				);
+			if (urb->actual_length > 0)x+				status = 0;
+			elsex+				status = -ETIMEDOUT;
 		}x 		if (timeout > 0)x 			del_timer_sync(&timer);
@@ -115,7 +121,7 @@
  *	@index: USB message index value
  *	@data: pointer to the data to send
  *	@size: length in bytes of the data to send
- *	@timeout: time in jiffies to wait for the message to complete before
+ *	@timeout: time in msecs to wait for the message to complete before
  *		timing out (if 0 the wait is forever)x  *	Context: !in_interrupt ()x  *
@@ -163,7 +169,7 @@
  *	@data: pointer to the data to send
  *	@len: length in bytes of the data to send
  *	@actual_length: pointer to a location to put the actual length transferred in bytes
- *	@timeout: time in jiffies to wait for the message to complete before
+ *	@timeout: time in msecs to wait for the message to complete before
  *		timing out (if 0 the wait is forever)x  *	Context: !in_interrupt ()x  *
@@ -196,7 +202,7 @@
 	usb_fill_bulk_urb(urb, usb_dev, pipe, data, len,
 			  usb_api_blocking_completion, NULL);
 x-	return usb_start_wait_urb(urb,timeout,actual_length);
+	return usb_start_wait_urb(urb, timeout, actual_length);
 }x x /*-------------------------------------------------------------------*/
@@ -579,7 +585,7 @@
 		result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
 				USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
 				(type << 8) + index, 0, buf, size,
-				HZ * USB_CTRL_GET_TIMEOUT);
+				USB_CTRL_GET_TIMEOUT);
 		if (result == 0x|| result == -EPIPE)
 			continue;x 		if (result > 1 && ((u8 *)buf)[1] != type) {x@@ -624,7 +630,7 @@
 		result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
 			USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
 			(USB_DT_STRING << 8) + index, langid, buf, size,
-			HZ * USB_CTRL_GET_TIMEOUT);
+			USB_CTRL_GET_TIMEOUT);
 		if (!(result == 0x|| result == -EPIPE))x 			break;x 	}x@@ -834,7 +840,7 @@
 x 	ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
 		USB_REQ_GET_STATUS, USB_DIR_IN | type, 0, target, status,
-		sizeof(*status), HZ * USB_CTRL_GET_TIMEOUT);
+		sizeof(*status), USB_CTRL_GET_TIMEOUT);
 
 	*(u16 *)data = *status;
 	kfree(status);x@@ -879,7 +885,7 @@
 	result = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
 		USB_REQ_CLEAR_FEATURE, USB_RECIP_ENDPOINT,
 		USB_ENDPOINT_HALT, endp, NULL, 0,
-		HZ * USB_CTRL_SET_TIMEOUT);
+		USB_CTRL_SET_TIMEOUT);
 x 	/* don't un-halt or force to DATA0 except on success */x 	if (result < 0)
@@ -982,6 +988,8 @@
 			dev_dbg (&dev->dev, "unregistering interface %s\n",x 				interface->dev.bus_id);x 			usb_remove_sysfs_intf_files(interface);
+			kfree(interface->cur_altsetting->string);
+			interface->cur_altsetting->string = NULL;x 			device_del (&interface->dev);x 		}x x@@ -1101,7 +1109,7 @@
 x 	ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
 				   USB_REQ_SET_INTERFACE, USB_RECIP_INTERFACE,
-				   alternate, interface, NULL, 0, HZ * 5);
+				   alternate, interface, NULL, 0, 5000);
 x 	/* 9.4.10 says devices don't need this and are free to STALL thex 	 * request if the interface only has one alternate setting.
@@ -1123,10 +1131,29 @@
 	/* prevent submissions using previous endpoint settings */x 	usb_disable_interface(dev, iface);
 x+	/* 9.1.1.5 says:
+	 *
+	 *	Configuring a device or changing an alternate setting
+	 *	causes all of the status and configuration values
+	 *	associated with endpoints in the affected interfaces to
+	 *	be set to their default values. This includes setting
+	 *	the data toggle of any endpoint using data toggles to
+	 *	the value DATA0.
+	 *
+	 * Some devices take this too literally and don't reset the data
+	 * toggles if the new altsetting is the same as the old one (thex+	 * command isn't "changing" an alternate setting).  We will manuallyx+	 * reset the toggles when the new and old altsettings are the same.
+	 * Most devices won't need this, but fortunately it doesn't happen
+	 * often.
+	 */x+	if (iface->cur_altsetting == alt)x+		manual = 1;x 	iface->cur_altsetting = alt;
 x 	/* If the interface only has one altsetting and the device didn'tx-	 * accept the request, we attempt to carry out the equivalent action
+	 * accept the request (or whenever the old altsetting is the same
+	 * as the new one), we attempt to carry out the equivalent action
 	 * by manually clearing the HALT feature for each endpoint in the
 	 * new altsetting.
 	 */
@@ -1202,7 +1229,7 @@
 	retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
 			USB_REQ_SET_CONFIGURATION, 0,
 			config->desc.bConfigurationValue, 0,
-			NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
+			NULL, 0, USB_CTRL_SET_TIMEOUT);
 	if (retval < 0) {x 		usb_set_device_state(dev, USB_STATE_ADDRESS);
 		return retval;
@@ -1337,7 +1364,7 @@
 x 	if ((ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
 			USB_REQ_SET_CONFIGURATION, 0, configuration, 0,
-			NULL, 0, HZ * USB_CTRL_SET_TIMEOUT)) < 0)x+			NULL, 0, USB_CTRL_SET_TIMEOUT)) < 0)
 		goto free_interfaces;
 x 	dev->actconfig = cp;
@@ -1386,6 +1413,13 @@
 		}x 		kfree(new_interfaces);
 x+		if ((cp->desc.iConfiguration) &&x+		    (cp->string == NULL))x{x+			cp->string = kmalloc(256, GFP_KERNEL);
+			if (cp->string)
+				usb_string(dev, cp->desc.iConfiguration, cp->string, 256);x+		}x+
 		/* Now that all the interfaces are set up, register them
 		 * to trigger binding of drivers to interfaces.  probe()
 		 * routines may install different altsettings and may
@@ -1408,6 +1442,13 @@
 					intf->dev.bus_id,
 					ret);x 				continue;x+			}x+			if ((intf->cur_altsetting->desc.iInterface) &&x+			    (intf->cur_altsetting->string == NULL))x{x+				intf->cur_altsetting->string = kmalloc(256, GFP_KERNEL);
+				if (intf->cur_altsetting->string)x+					usb_string(dev, intf->cur_altsetting->desc.iInterface,
+						   intf->cur_altsetting->string, 256);x 			}x 			usb_create_sysfs_intf_files (intf);
 		}xdiff -Nru a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
--- a/drivers/usb/core/sysfs.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/core/sysfs.c	2005-03-07 20:42:07 -08:00
@@ -46,27 +46,24 @@
 usb_actconfig_attr (bmAttributes, 1, "%2x\n")
 usb_actconfig_attr (bMaxPower, 2, "%3dmA\n")
 x-#define usb_actconfig_str(name, field)					\x-static ssize_t  show_##name(struct device *dev, char *buf)		\x-{									\x-	struct usb_device *udev;					\x-	struct usb_host_config *actconfig;				\x-	int len;							\x-									\x-	udev = to_usb_device (dev);					\x-	actconfig = udev->actconfig;					\x-	if (!actconfig)							\x-		return 0;						\x-	len = usb_string(udev, actconfig->desc.field, buf, PAGE_SIZE);	\x-	if (len < 0)							\x-		return 0;						\x-	buf[len] = '\n';						\x-	buf[len+1] = 0;							\x-	return len+1;							\x-}									\x-static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
+static ssize_t show_configuration_string(struct device *dev, char *buf)x+{x+	struct usb_device *udev;x+	struct usb_host_config *actconfig;
+	int len;
 x-usb_actconfig_str (configuration, iConfiguration)x+	udev = to_usb_device (dev);x+	actconfig = udev->actconfig;x+	if ((!actconfig)x|| (!actconfig->string))
+		return 0;
+	len = sprintf(buf, actconfig->string, PAGE_SIZE);x+	if (len < 0)x+		return 0;
+	buf[len] = '\n';
+	buf[len+1] = 0;
+	return len+1;
+}
+static DEVICE_ATTR(configuration, S_IRUGO, show_configuration_string, NULL);
 x /* configuration value is always present, and r/w */x usb_actconfig_show(bConfigurationValue, 1, "%u\n");x@@ -89,14 +86,14 @@
 		show_bConfigurationValue, set_bConfigurationValue);
 x /* String fields */x-#define usb_string_attr(name, field)		\x+#define usb_string_attr(name)						\x static ssize_t  show_##name(struct device *dev, char *buf)		\x {									\x 	struct usb_device *udev;					\x 	int len;							\x 									\x 	udev = to_usb_device (dev);					\x-	len = usb_string(udev, udev->descriptor.field, buf, PAGE_SIZE);	\x+	len = snprintf(buf, 256, "%s", udev->name);			\x 	if (len < 0)							\x 		return 0;						\x 	buf[len] = '\n';						\x@@ -105,9 +102,9 @@
 }									\x static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
 x-usb_string_attr(product, iProduct);
-usb_string_attr(manufacturer, iManufacturer);
-usb_string_attr(serial, iSerialNumber);
+usb_string_attr(product);
+usb_string_attr(manufacturer);
+usb_string_attr(serial);
 x static ssize_t
 show_speed (struct device *dev, char *buf)x@@ -230,11 +227,11 @@
 x 	sysfs_create_group(&dev->kobj, &dev_attr_grp);x x-	if (udev->descriptor.iManufacturer)x+	if (udev->manufacturer)x 		device_create_file (dev, &dev_attr_manufacturer);
-	if (udev->descriptor.iProduct)x+	if (udev->product)x 		device_create_file (dev, &dev_attr_product);
-	if (udev->descriptor.iSerialNumber)x+	if (udev->serial)x 		device_create_file (dev, &dev_attr_serial);
 	device_create_file (dev, &dev_attr_configuration);
 }x@@ -272,25 +269,22 @@
 usb_intf_attr (bInterfaceSubClass, "%02x\n")
 usb_intf_attr (bInterfaceProtocol, "%02x\n")
 x-#define usb_intf_str(name, field)					\x-static ssize_t  show_##name(struct device *dev, char *buf)		\x-{									\x-	struct usb_interface *intf;					\x-	struct usb_device *udev;					\x-	int len;							\x-									\x-	intf = to_usb_interface (dev);					\x-	udev = interface_to_usbdev (intf);				\x-	len = usb_string(udev, intf->cur_altsetting->desc.field, buf, PAGE_SIZE);\x-	if (len < 0)							\x-		return 0;						\x-	buf[len] = '\n';						\x-	buf[len+1] = 0;							\x-	return len+1;							\x-}									\x-static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
+static ssize_t show_interface_string(struct device *dev, char *buf)x+{x+	struct usb_interface *intf;x+	struct usb_device *udev;x+	int len;
 x-usb_intf_str (interface, iInterface);x+	intf = to_usb_interface (dev);x+	udev = interface_to_usbdev (intf);x+	len = snprintf(buf, 256, "%s", intf->cur_altsetting->string);x+	if (len < 0)x+		return 0;
+	buf[len] = '\n';
+	buf[len+1] = 0;
+	return len+1;
+}
+static DEVICE_ATTR(interface, S_IRUGO, show_interface_string, NULL);
 x static struct attribute *intf_attrs[] = {x 	&dev_attr_bInterfaceNumber.attr,x@@ -309,7 +303,7 @@
 {x 	sysfs_create_group(&intf->dev.kobj, &intf_attr_grp);x x-	if (intf->cur_altsetting->desc.iInterface)x+	if (intf->cur_altsetting->string)x 		device_create_file(&intf->dev, &dev_attr_interface);
 		
 }x@@ -318,7 +312,7 @@
 {x 	sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp);x x-	if (intf->cur_altsetting->desc.iInterface)x+	if (intf->cur_altsetting->string)x 		device_remove_file(&intf->dev, &dev_attr_interface);
 
 }xdiff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c	2005-01-14 16:02:30 -08:00
+++ b/drivers/usb/core/usb.c	2005-03-07 20:42:24 -08:00
@@ -647,7 +647,10 @@
 x 	usb_destroy_configuration(udev);x 	usb_bus_put(udev->bus);
-	kfree (udev);x+	kfree(udev->product);
+	kfree(udev->manufacturer);
+	kfree(udev->serial);
+	kfree(udev);
 }x x /**xdiff -Nru a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
--- a/drivers/usb/gadget/Kconfig	2004-12-17 14:20:16 -08:00
+++ b/drivers/usb/gadget/Kconfig	2005-03-07 20:49:25 -08:00
@@ -87,10 +87,10 @@
 	default USB_GADGETx x config USB_GADGET_PXA2XXx-	boolean "PXA 2xx or IXP 4xx"x-	depends on ARCH_PXAx|| ARCH_IXP4XXx+	boolean "PXA 25x or IXP 4xx"x+	depends on (ARCH_PXAx&& PXA25x)x|| ARCH_IXP4XXx 	helpx-	   Intel's PXA 2xx series XScale ARM-5TE processors include
+	   Intel's PXA 25x series XScale ARM-5TE processors include
 	   an integrated full speed USB 1.1 device controller.  The
 	   controller in the IXP 4xx series is register-compatible.
 
@@ -194,7 +194,7 @@
 config USB_GADGET_OMAPx 	boolean "OMAP USB Device Controller"
 	depends on ARCH_OMAPx-	select ISP1301_OMAP if MACH_OMAP_H2x+	select ISP1301_OMAP if MACH_OMAP_H2x|| MACH_OMAP_H3x 	helpx 	   Many Texas Instruments OMAP processors have flexible fullx 	   speed USB device controllers, with support for up to 30xdiff -Nru a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
--- a/drivers/usb/gadget/dummy_hcd.c	2004-12-20 17:24:38 -08:00
+++ b/drivers/usb/gadget/dummy_hcd.c	2005-03-07 20:43:30 -08:00
@@ -4,7 +4,7 @@
  * Maintainer: Alan Stern <stern@rowland.harvard.edu>
  *
  * Copyright (C) 2003 David Brownellx- * Copyright (C) 2003, 2004 Alan Stern
+ * Copyright (C) 2003-2005 Alan Stern
  *
  * 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
@@ -167,7 +167,6 @@
 	 */x 	struct timer_list		timer;x 	u32				port_status;
-	unsigned			started:1;
 	unsigned			resuming:1;
 	unsigned long			re_timeout;
 x@@ -1637,7 +1636,6 @@
 	 * just like more familiar pci-based HCDs.
 	 */x 	spin_lock_init (&dum->lock);
-
 	init_timer (&dum->timer);
 	dum->timer.function = dummy_timer;x 	dum->timer.data = (unsigned long) dum;
@@ -1654,25 +1652,25 @@
 x 	/* ...then configured, so khubd sees us. */x 	if ((retval = hcd_register_root (root, hcd)) != 0) {x-		usb_put_dev (root);
-clean:x-		hcd->state = USB_STATE_QUIESCING;x-		return retval;
+		goto err1;
 	}
 x 	/* only show a low-power port: just 8mA */x 	hub_set_power_budget (root, 8);x x-	if ((retval = dummy_register_udc (dum)) != 0) {x-		usb_disconnect (&hcd->self.root_hub);x-		goto clean;x-	}x+	if ((retval = dummy_register_udc (dum)) != 0)
+		goto err2;
 x 	/* FIXME 'urbs' should be a per-device thing, maybe in usbcore */x 	device_create_file (dummy_dev(dum), &dev_attr_urbs);
-
-	dum->started = 1;x 	return 0;
+
+ err2:
+	usb_disconnect (&hcd->self.root_hub);x+ err1:
+	usb_put_dev (root);
+	hcd->state = USB_STATE_QUIESCING;x+	return retval;
 }x x static void dummy_stop (struct usb_hcd *hcd)
@@ -1680,9 +1678,6 @@
 	struct dummy		*dum;
 x 	dum = hcd_to_dummy (hcd);
-	if (!dum->started)x-		return;
-	dum->started = 0;
 x 	device_remove_file (dummy_dev(dum), &dev_attr_urbs);
 x@@ -1718,71 +1713,33 @@
 	.hub_control = 		dummy_hub_control,
 };x x-static void dummy_remove (struct device *dev);
-
 static int dummy_probe (struct device *dev)
x{x 	struct usb_hcd		*hcd;x-	struct dummy		*dum;
 	int			retval;
 x 	dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc);x x-	hcd = usb_create_hcd (&dummy_hcd);
-	if (hcd == NULL)x{x-		dev_dbg (dev, "hcd_alloc failed\n");x+	hcd = usb_create_hcd (&dummy_hcd, dev, dev->bus_id);x+	if (!hcd)
 		return -ENOMEM;x-	}x+	the_controller = hcd_to_dummy (hcd);
 x-	dev_set_drvdata (dev, hcd);
-	dum = hcd_to_dummy (hcd);
-	the_controller = dum;
-x-	hcd->self.controller = dev;x-x-	/* FIXME don't require the pci-based buffer/alloc impls;
-	 * the "generic dma" implementation still requires them,
-	 * it's not very generic yet.
-	 */x-	retval = hcd_buffer_create (hcd);
+	retval = usb_add_hcd(hcd, 0, 0);
 	if (retval != 0) {x-		dev_dbg (dev, "pool alloc failed\n");x-		goto err1;
+		usb_put_hcd (hcd);
+		the_controller = NULL;x 	}
-x-	hcd->self.bus_name = dev->bus_id;
-	usb_register_bus (&hcd->self);x-x-	if ((retval = dummy_start (hcd)) < 0)xx-		dummy_remove (dev);
-	return retval;
-x-err1:
-	usb_put_hcd (hcd);
-	dev_set_drvdata (dev, NULL);
 	return retval;
 }x x static void dummy_remove (struct device *dev)
x{x 	struct usb_hcd		*hcd;x-	struct dummy		*dum;
 x 	hcd = dev_get_drvdata (dev);
-	dum = hcd_to_dummy (hcd);
-x-	hcd->state = USB_STATE_QUIESCING;x-
-	dev_dbg (dev, "roothub graceful disconnect\n");
-	usb_disconnect (&hcd->self.root_hub);x-x-	hcd->driver->stop (hcd);
-	hcd->state = USB_STATE_HALT;
-x-	hcd_buffer_destroy (hcd);
-x-	dev_set_drvdata (dev, NULL);
-	usb_deregister_bus (&hcd->self);x+	usb_remove_hcd (hcd);
+	usb_put_hcd (hcd);
 	the_controller = NULL;x }
 
diff -Nru a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
--- a/drivers/usb/gadget/ether.c	2005-01-25 13:50:18 -08:00
+++ b/drivers/usb/gadget/ether.c	2005-03-07 20:44:12 -08:00
@@ -49,6 +49,7 @@
 #include <asm/unaligned.h>
 x #include <linux/usb_ch9.h>
+#include <linux/usb_cdc.h>
 #include <linux/usb_gadget.h>
 x #include <linux/random.h>
@@ -259,6 +260,9 @@
 #define	DEV_CONFIG_SUBSETx #endifx x+#ifdef CONFIG_USB_GADGET_S3C2410x+#define DEV_CONFIG_CDCx+#endifx x /*-------------------------------------------------------------------------*/
 
@@ -432,8 +436,8 @@
 	/* status endpoint is optional; this may be patched later */x 	.bNumEndpoints =	1,x 	.bInterfaceClass =	USB_CLASS_COMM,
-	.bInterfaceSubClass =	6,	/* ethernet control model */x-	.bInterfaceProtocol =	0,
+	.bInterfaceSubClass =	USB_CDC_SUBCLASS_ETHERNET,
+	.bInterfaceProtocol =	USB_CDC_PROTO_NONE,x 	.iInterface =		STRING_CONTROL,
 };x #endifx@@ -447,46 +451,26 @@
 	.bInterfaceNumber =     0,x 	.bNumEndpoints =        1,x 	.bInterfaceClass =      USB_CLASS_COMM,
-	.bInterfaceSubClass =   2,	/* abstract control model */x-	.bInterfaceProtocol =   0xff,	/* vendor specific */x+	.bInterfaceSubClass =   USB_CDC_SUBCLASS_ACM,
+	.bInterfaceProtocol =   USB_CDC_ACM_PROTO_VENDOR,x 	.iInterface =           STRING_RNDIS_CONTROL,
 };x #endifx x #if defined(DEV_CONFIG_CDC)x|| defined(CONFIG_USB_ETH_RNDIS)
 x-/* "Header Functional Descriptor" from CDC spec  5.2.3.1 */x-struct header_desc {x-	u8	bLength;x-	u8	bDescriptorType;x-	u8	bDescriptorSubType;x-x-	u16	bcdCDC;x-} __attribute__ ((packed));
-x-static const struct header_desc header_desc = {x+static const struct usb_cdc_header_desc header_desc = {x 	.bLength =		sizeof header_desc,x 	.bDescriptorType =	USB_DT_CS_INTERFACE,
-	.bDescriptorSubType =	0,
+	.bDescriptorSubType =	USB_CDC_HEADER_TYPE,x x 	.bcdCDC =		__constant_cpu_to_le16 (0x0110),
 };x x-/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */x-struct union_desc {x-	u8	bLength;x-	u8	bDescriptorType;x-	u8	bDescriptorSubType;x-x-	u8	bMasterInterface0;x-	u8	bSlaveInterface0;x-	/* ... and there could be other slave interfaces */x-} __attribute__ ((packed));
-x-static const struct union_desc union_desc = {x+static const struct usb_cdc_union_desc union_desc = {x 	.bLength =		sizeof union_desc,x 	.bDescriptorType =	USB_DT_CS_INTERFACE,
-	.bDescriptorSubType =	6,
+	.bDescriptorSubType =	USB_CDC_UNION_TYPE,x x 	.bMasterInterface0 =	0,	/* index of control interface */x 	.bSlaveInterface0 =	1,	/* index of DATA interface */x@@ -496,64 +480,31 @@
 x #ifdef	CONFIG_USB_ETH_RNDISx x-/* "Call Management Descriptor" from CDC spec  5.2.3.3 */x-struct call_mgmt_descriptor {x-	u8  bLength;x-	u8  bDescriptorType;x-	u8  bDescriptorSubType;x-x-	u8  bmCapabilities;x-	u8  bDataInterface;x-} __attribute__ ((packed));
-x-static const struct call_mgmt_descriptor call_mgmt_descriptor = {x+static const struct usb_cdc_call_mgmt_descriptor call_mgmt_descriptor = {x 	.bLength =  		sizeof call_mgmt_descriptor,x 	.bDescriptorType = 	USB_DT_CS_INTERFACE,
-	.bDescriptorSubType = 	0x01,
+	.bDescriptorSubType = 	USB_CDC_CALL_MANAGEMENT_TYPE,x x 	.bmCapabilities = 	0x00,x 	.bDataInterface = 	0x01,
 };x x-x-/* "Abstract Control Management Descriptor" from CDC spec  5.2.3.4 */x-struct acm_descriptor {x-	u8  bLength;x-	u8  bDescriptorType;x-	u8  bDescriptorSubType;x-x-	u8  bmCapabilities;x-} __attribute__ ((packed));
-x-static struct acm_descriptor acm_descriptor = {x+static struct usb_cdc_acm_descriptor acm_descriptor = {x 	.bLength =  		sizeof acm_descriptor,x 	.bDescriptorType = 	USB_DT_CS_INTERFACE,
-	.bDescriptorSubType = 	0x02,
+	.bDescriptorSubType = 	USB_CDC_ACM_TYPE,x x-	.bmCapabilities = 	0X00,
+	.bmCapabilities = 	0x00,x };
 x #endif
 x #ifdef	DEV_CONFIG_CDCx x-/* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */x-struct ether_desc {x-	u8	bLength;x-	u8	bDescriptorType;x-	u8	bDescriptorSubType;x-x-	u8	iMACAddress;x-	u32	bmEthernetStatistics;x-	u16	wMaxSegmentSize;x-	u16	wNumberMCFilters;x-	u8	bNumberPowerFilters;x-} __attribute__ ((packed));
-x-static const struct ether_desc ether_desc = {x+static const struct usb_cdc_ether_desc ether_desc = {x 	.bLength =		sizeof ether_desc,x 	.bDescriptorType =	USB_DT_CS_INTERFACE,
-	.bDescriptorSubType =	0x0f,
+	.bDescriptorSubType =	USB_CDC_ETHERNET_TYPE,x x 	/* this descriptor actually adds value, surprise! */x 	.iMACAddress =		STRING_ETHADDR,x@@ -1242,47 +1193,30 @@
 x /*-------------------------------------------------------------------------*/
 
-/* section 3.8.2 tablex11 of the CDC spec lists Ethernet notifications
- * section 3.6.2.1 tablex5 specifies ACM notifications, accepted by RNDISx- * and RNDIS also defines its own bit-incompatible notifications
- */x-#define CDC_NOTIFY_NETWORK_CONNECTION	0x00	/* required; 6.3.1 */x-#define CDC_NOTIFY_RESPONSE_AVAILABLE	0x01	/* optional; 6.3.2 */x-#define CDC_NOTIFY_SPEED_CHANGE		0x2a	/* required; 6.3.8 */x-x #ifdef	DEV_CONFIG_CDCx x-struct cdc_notification {x-	u8	bmRequestType;x-	u8	bNotificationType;x-	u16	wValue;x-	u16	wIndex;x-	u16	wLength;x-x-	/* SPEED_CHANGE data looks like this */x-	u32	data [2];x-};
-
 static void eth_status_complete (struct usb_ep *ep, struct usb_request *req)
x{x-	struct cdc_notification	*event = req->buf;x-	int			value = req->status;
-	struct eth_dev		*dev = ep->driver_data;x+	struct usb_cdc_notification	*event = req->buf;x+	int				value = req->status;
+	struct eth_dev			*dev = ep->driver_data;x x 	/* issue the second notification if host reads the first */x-	if (event->bNotificationType == CDC_NOTIFY_NETWORK_CONNECTIONx+	if (event->bNotificationType == USB_CDC_NOTIFY_NETWORK_CONNECTIONx 			&& value == 0) {x+		__le32	*data = req->buf + sizeof *event;
+x 		event->bmRequestType = 0xA1;x-		event->bNotificationType = CDC_NOTIFY_SPEED_CHANGE;
+		event->bNotificationType = USB_CDC_NOTIFY_SPEED_CHANGE;
 		event->wValue = __constant_cpu_to_le16 (0);
 		event->wIndex = __constant_cpu_to_le16 (1);
 		event->wLength = __constant_cpu_to_le16 (8);
 x 		/* SPEED_CHANGE data is up/down speeds in bits/sec */x-		event->data [0] = event->data [1] =
+		data [0] = data [1] = cpu_to_le32(
 			(dev->gadget->speed == USB_SPEED_HIGH)
 				? (13 * 512 * 8 * 1000 * 8)
-				: (19 *  64 * 1 * 1000 * 8);
+				: (19 *  64 * 1 * 1000 * 8));
 x 		req->length = 16;
 		value = usb_ep_queue (ep, req, GFP_ATOMIC);
@@ -1300,9 +1234,9 @@
 
 static void issue_start_status (struct eth_dev *dev)
x{x-	struct usb_request	*req;x-	struct cdc_notification	*event;x-	int			value;x+	struct usb_request		*req;x+	struct usb_cdc_notification	*event;x+	int				value;
  x 	DEBUG (dev, "%s, flush old status first\n", __FUNCTION__);
 x@@ -1336,7 +1270,7 @@
 	 */x 	event = req->buf;x 	event->bmRequestType = 0xA1;x-	event->bNotificationType = CDC_NOTIFY_NETWORK_CONNECTION;x+	event->bNotificationType = USB_CDC_NOTIFY_NETWORK_CONNECTION;x 	event->wValue = __constant_cpu_to_le16 (1);	/* connected */x 	event->wIndex = __constant_cpu_to_le16 (1);
 	event->wLength = 0;
@@ -1364,26 +1298,6 @@
 				req->status, req->actual, req->length);
 }x x-/* see section 3.8.2 tablex10 of the CDC spec for more ethernetx- * requests, mostly for filters (multicast, pm) and statistics
- * section 3.6.2.1 tablex4 has ACM requests; RNDIS requires the
- * encapsulated command mechanism.
- */x-#define CDC_SEND_ENCAPSULATED_COMMAND		0x00	/* optional */x-#define CDC_GET_ENCAPSULATED_RESPONSE		0x01	/* optional */x-#define CDC_SET_ETHERNET_MULTICAST_FILTERS	0x40	/* optional */x-#define CDC_SET_ETHERNET_PM_PATTERN_FILTER	0x41	/* optional */x-#define CDC_GET_ETHERNET_PM_PATTERN_FILTER	0x42	/* optional */x-#define CDC_SET_ETHERNET_PACKET_FILTER		0x43	/* required */x-#define CDC_GET_ETHERNET_STATISTIC		0x44	/* optional */x-x-/* tablex62; bits in cdc_filter */x-#define	CDC_PACKET_TYPE_PROMISCUOUS		(1 << 0)x-#define	CDC_PACKET_TYPE_ALL_MULTICAST		(1 << 1) /* no filter */x-#define	CDC_PACKET_TYPE_DIRECTED		(1 << 2)x-#define	CDC_PACKET_TYPE_BROADCAST		(1 << 3)x-#define	CDC_PACKET_TYPE_MULTICAST		(1 << 4) /* filtered */x-x #ifdef CONFIG_USB_ETH_RNDISx x static void rndis_response_complete (struct usb_ep *ep, struct usb_request *req)
@@ -1393,7 +1307,7 @@
 			"rndis response complete --> %d, %d/%d\n",
 			req->status, req->actual, req->length);
 x-	/* done sending after CDC_GET_ENCAPSULATED_RESPONSE */x+	/* done sending after USB_CDC_GET_ENCAPSULATED_RESPONSE */x }x x static void rndis_command_complete (struct usb_ep *ep, struct usb_request *req)
@@ -1401,7 +1315,7 @@
 	struct eth_dev          *dev = ep->driver_data;x 	int			status;
 	x-	/* received RNDIS command from CDC_SEND_ENCAPSULATED_COMMAND */x+	/* received RNDIS command from USB_CDC_SEND_ENCAPSULATED_COMMAND */x 	spin_lock(&dev->lock);
 	status = rndis_msg_parser (dev->rndis_config, (u8 *) req->buf);
 	if (status < 0)
@@ -1426,6 +1340,9 @@
 	struct eth_dev		*dev = get_gadget_data (gadget);
 	struct usb_request	*req = dev->req;x 	int			value = -EOPNOTSUPP;
+	u16			wIndex = ctrl->wIndex;
+	u16			wValue = ctrl->wValue;x+	u16			wLength = ctrl->wLength;x x 	/* descriptors just go into the pre-allocated ep0 buffer,
 	 * while config change events may enablexnetwork traffic.
@@ -1436,17 +1353,17 @@
 	case USB_REQ_GET_DESCRIPTOR:
 		if (ctrl->bRequestType != USB_DIR_IN)x 			break;x-		switch (ctrl->wValue >> 8) {x+		switch (wValue >> 8) {x x 		case USB_DT_DEVICE:x-			value = min (ctrl->wLength, (u16) sizeof device_desc);x+			value = min (wLength, (u16) sizeof device_desc);x 			memcpy (req->buf, &device_desc, value);x 			break;x #ifdef CONFIG_USB_GADGET_DUALSPEEDx 		case USB_DT_DEVICE_QUALIFIER:
 			if (!gadget->is_dualspeed)
 				break;x-			value = min (ctrl->wLength, (u16) sizeof dev_qualifier);x+			value = min (wLength, (u16) sizeof dev_qualifier);x 			memcpy (req->buf, &dev_qualifier, value);x 			break;x 
@@ -1457,18 +1374,18 @@
 #endif /* CONFIG_USB_GADGET_DUALSPEED */x 		case USB_DT_CONFIG:
 			value = config_buf (gadget->speed, req->buf,
-					ctrl->wValue >> 8,
-					ctrl->wValue & 0xff,
+					wValue >> 8,
+					wValue & 0xff,
 					gadget->is_otg);x 			if (value >= 0)
-				value = min (ctrl->wLength, (u16) value);x+				value = min (wLength, (u16) value);x 			break;x 
 		case USB_DT_STRING:
 			value = usb_gadget_get_string (&stringtab,
-					ctrl->wValue & 0xff, req->buf);
+					wValue & 0xff, req->buf);
 			if (value >= 0)
-				value = min (ctrl->wLength, (u16) value);x+				value = min (wLength, (u16) value);x 			break;x 		}x 		break;x@@ -1481,22 +1398,22 @@
 		else if (gadget->a_alt_hnp_support)
 			DEBUG (dev, "HNP needs a different root port\n");
 		spin_lock (&dev->lock);
-		value = eth_set_config (dev, ctrl->wValue, GFP_ATOMIC);
+		value = eth_set_config (dev, wValue, GFP_ATOMIC);
 		spin_unlock (&dev->lock);
 		break;x 	case USB_REQ_GET_CONFIGURATION:
 		if (ctrl->bRequestType != USB_DIR_IN)x 			break;x 		*(u8 *)req->buf = dev->config;x-		value = min (ctrl->wLength, (u16) 1);
+		value = min (wLength, (u16) 1);
 		break;x x 	case USB_REQ_SET_INTERFACE:
 		if (ctrl->bRequestType != USB_RECIP_INTERFACE
 				|| !dev->config
-				|| ctrl->wIndex > 1)x+				|| wIndex > 1)x 			break;x-		if (!dev->cdcx&& ctrl->wIndex != 0)
+		if (!dev->cdcx&& wIndex != 0)
 			break;x 		spin_lock (&dev->lock);
 
@@ -1510,9 +1427,9 @@
 		}
 x #ifdef DEV_CONFIG_CDCx-		switch (ctrl->wIndex) {x+		switch (wIndex) {x 		case 0:		/* control/master intf */x-			if (ctrl->wValue != 0)
+			if (wValue != 0)
 				break;x 			if (dev->status_ep)x{x 				usb_ep_disable (dev->status_ep);x@@ -1521,7 +1438,7 @@
 			value = 0;x 			break;x 		case 1:		/* data intf */x-			if (ctrl->wValue > 1)x+			if (wValue > 1)x 				break;x 			usb_ep_disable (dev->in_ep);x 			usb_ep_disable (dev->out_ep);x@@ -1530,7 +1447,7 @@
 			 * the default interface setting ... also, setting
 			 * the non-default interface clears filters etc.
 			 */x-			if (ctrl->wValue == 1) {x+			if (wValue == 1) {x 				usb_ep_enablex(dev->in_ep, dev->in);x 				usb_ep_enablex(dev->out_ep, dev->out);x 				netif_carrier_on (dev->net);
@@ -1561,36 +1478,36 @@
 	case USB_REQ_GET_INTERFACE:
 		if (ctrl->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE)
 				|| !dev->config
-				|| ctrl->wIndex > 1)x+				|| wIndex > 1)x 			break;x-		if (!(dev->cdcx|| dev->rndis)x&& ctrl->wIndex != 0)
+		if (!(dev->cdcx|| dev->rndis)x&& wIndex != 0)
 			break;x x 		/* for CDC, iff carrier is on, data interface is active. */x-		if (dev->rndis || ctrl->wIndex != 1)x+		if (dev->rndis || wIndex != 1)x 			*(u8 *)req->buf = 0;x 		elsex 			*(u8 *)req->buf = netif_carrier_ok (dev->net) ? 1 : 0;x-		value = min (ctrl->wLength, (u16) 1);
+		value = min (wLength, (u16) 1);
 		break;x x #ifdef DEV_CONFIG_CDCx-	case CDC_SET_ETHERNET_PACKET_FILTER:
+	case USB_CDC_SET_ETHERNET_PACKET_FILTER:
 		/* see 6.2.30: no data, wIndex = interface,
 		 * wValue = packet filter bitmap
 		 */
 		if (ctrl->bRequestType != (USB_TYPE_CLASS|USB_RECIP_INTERFACE)
 				|| !dev->cdc
 				|| dev->rndis
-				|| ctrl->wLength != 0
-				|| ctrl->wIndex > 1)x+				|| wLength != 0
+				|| wIndex > 1)x 			break;x-		DEBUG (dev, "NOP packet filter %04x\n", ctrl->wValue);
+		DEBUG (dev, "NOP packet filter %04x\n", wValue);
 		/* NOTE: tablex62 has 5 filter bits to reduce traffic,
 		 * and we "must" support multicast and promiscuous.
 		 * this NOP implements a bad filter (always promisc)
 		 */
-		dev->cdc_filter = ctrl->wValue;x+		dev->cdc_filter = wValue;x 		value = 0;x 		break;x #endif /* DEV_CONFIG_CDC */
@@ -1599,28 +1516,28 @@
 	/* RNDIS uses the CDC command encapsulation mechanism to implement
 	 * an RPC scheme, with much getting/setting of attributes by OID.
 	 */x-	case CDC_SEND_ENCAPSULATED_COMMAND:
+	case USB_CDC_SEND_ENCAPSULATED_COMMAND:
 		if (ctrl->bRequestType != (USB_TYPE_CLASS|USB_RECIP_INTERFACE)
 				|| !dev->rndis
-				|| ctrl->wLength > USB_BUFSIZ
-				|| ctrl->wValuex+				|| wLength > USB_BUFSIZ
+				|| wValuex 				|| rndis_control_intf.bInterfaceNumberx-					!= ctrl->wIndex)x+					!= wIndex)x 			break;x 		/* read the request, then process it */
-		value = ctrl->wLength;x+		value = wLength;x 		req->complete = rndis_command_complete;x 		/* later, rndis_control_ack () sends a notification */
 		break;x 		x-	case CDC_GET_ENCAPSULATED_RESPONSE:
+	case USB_CDC_GET_ENCAPSULATED_RESPONSE:
 		if ((USB_DIR_IN|USB_TYPE_CLASS|USB_RECIP_INTERFACE)
 					== ctrl->bRequestType
 				&& dev->rndis
-				//x&& ctrl->wLength >= 0x0400
-				&& !ctrl->wValuex+				//x&& wLength >= 0x0400
+				&& !wValuex 				&& rndis_control_intf.bInterfaceNumberx-					== ctrl->wIndex)x{x+					== wIndex) {x 			u8 *buf;x 
 			/* return the result */
@@ -1640,13 +1557,13 @@
 		VDEBUG (dev,
 			"unknown control req%02x.%02x v%04x i%04x l%d\n",
 			ctrl->bRequestType, ctrl->bRequest,
-			ctrl->wValue, ctrl->wIndex, ctrl->wLength);x+			wValue, wIndex, wLength);x 	}
 x 	/* respond with data transfer before status phase? */x 	if (value >= 0) {x 		req->length = value;x-		req->zero = value < ctrl->wLengthx+		req->zero = value < wLengthx 				&& (value % gadget->ep0->maxpacket) == 0;
 		value = usb_ep_queue (gadget->ep0, req, GFP_ATOMIC);
 		if (value < 0) {x@@ -1761,10 +1678,16 @@
 #endif	
 	size -= size % dev->out_ep->maxpacket;x x-	if ((skb = alloc_skb (size, gfp_flags)) == 0) {x+	if ((skb = alloc_skb (size + NET_IP_ALIGN, gfp_flags)) == 0) {x 		DEBUG (dev, "no rx skb\n");
 		goto enomem;x 	}
+	x+	/* Some platforms perform better when IP packets are aligned,
+	 * but on at least one, checksumming fails otherwise.  Note:
+	 * this doesn't account for variable-sized RNDIS headers.
+	 */x+	skb_reserve(skb, NET_IP_ALIGN);
 x 	req->buf = skb->data;x 	req->length = size;x@@ -1990,7 +1913,7 @@
 	unsigned long		flags;
 x 	/* FIXME check dev->cdc_filter to decide whether to send this,
-	 * instead of acting as if CDC_PACKET_TYPE_PROMISCUOUS were
+	 * instead of acting as if USB_CDC_PACKET_TYPE_PROMISCUOUS were
 	 * always set.  RNDIS has the same kind of outgoing filter.
 	 */x 
@@ -2124,13 +2047,13 @@
 	}x 	x 	/* Send RNDIS RESPONSE_AVAILABLE notification;
-	 * CDC_NOTIFY_RESPONSE_AVAILABLE should work too
+	 * USB_CDC_NOTIFY_RESPONSE_AVAILABLE should work too
 	 */x 	resp->length = 8;x 	resp->complete = rndis_control_ack_complete;x 	
-	*((u32 *) resp->buf) = __constant_cpu_to_le32 (1);
-	*((u32 *) resp->buf + 1) = __constant_cpu_to_le32 (0);x+	*((__le32 *) resp->buf) = __constant_cpu_to_le32 (1);
+	*((__le32 *) resp->buf + 1) = __constant_cpu_to_le32 (0);x 	x 	length = usb_ep_queue (dev->status_ep, resp, GFP_ATOMIC);
 	if (length < 0) {x@@ -2326,6 +2249,8 @@
 		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0210);x 	} else if (gadget_is_pxa27x(gadget)) {x 		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0211);
+ 	} else if (gadget_is_s3c2410(gadget)) {x+ 		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212);x 	} else {x 		/* can't assume CDC works.  don't want to default to
 		 * anything less functional on CDC-capablexhardware,x@@ -2414,9 +2339,12 @@
 				"can't run RNDIS on %s\n",x 				gadget->name);
 			return -ENODEV;x+#ifdef DEV_CONFIG_CDCx+		/* pxa25x only does CDC subset; often used with RNDIS */
 		} else if (cdc) {x 			control_intf.bNumEndpoints = 0;x 			/* FIXME remove endpoint from descriptor list */x+#endif
 		}x 	}x #endif
diff -Nru a/drivers/usb/gadget/gadget_chips.h b/drivers/usb/gadget/gadget_chips.h
--- a/drivers/usb/gadget/gadget_chips.h	2004-11-23 03:00:18 -08:00
+++ b/drivers/usb/gadget/gadget_chips.h	2005-03-07 20:44:12 -08:00
@@ -74,6 +74,12 @@
 #define	gadget_is_pxa27x(g)	0x #endifx x+#ifdef CONFIG_USB_GADGET_S3C2410x+#define gadget_is_s3c2410(g)    !strcmp("s3c2410_udc", (g)->name)x+#elsex+#define gadget_is_s3c2410(g)    0x+#endif
+
 //xCONFIG_USB_GADGET_AT91RM9200
 //xCONFIG_USB_GADGET_SX2
 //xCONFIG_USB_GADGET_AU1X00xdiff -Nru a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
--- a/drivers/usb/gadget/net2280.c	2004-10-15 13:34:35 -07:00
+++ b/drivers/usb/gadget/net2280.c	2005-03-07 20:49:41 -08:00
@@ -1,8 +1,9 @@
 /*
- * Driver for the NetChip 2280 USB device controller.
- * Specs and errata are availablexfrom <http://www.netchip.com>.
+ * Driver for the PLX NET2280 USB device controller.
+ * Specs and errata are availablexfrom <http://www.plxtech.com>.
  *
- * NetChip Technology Inc. supported the development of this driver.
+ * PLX Technology Inc. (formerly NetChip Technology) supported the 
+ * development of this driver.
  *
  *
  * CODE STATUS HIGHLIGHTSx@@ -23,7 +24,7 @@
 x /*
  * Copyright (C) 2003 David Brownellx- * Copyright (C) 2003 NetChip Technologies
+ * Copyright (C) 2003-2005 PLX Technology, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -69,8 +70,8 @@
 #include <asm/unaligned.h>
 x x-#define	DRIVER_DESC		"NetChip 2280 USB Peripheral Controller"
-#define	DRIVER_VERSION		"2004 Jan 14"x+#define	DRIVER_DESC		"PLX NET2280 USB Peripheral Controller"
+#define	DRIVER_VERSION		"2005 Feb 03"x x #define	DMA_ADDR_INVALID	(~(dma_addr_t)0)
 #define	EP_DONTUSE		13	/* nonzero */
@@ -113,6 +114,16 @@
 /* "modprobe net2280 fifo_mode=1" etc */
 module_param (fifo_mode, ushort, 0644);
 x+/* enable_suspend -- When enabled, the driver will respond to
+ * USB suspend requests by powering down the NET2280.  Otherwise,
+ * USB suspend requests will be ignored.  This is acceptible for
+ * self-powered devices, and helps avoid some quirks.
+ */x+static int enable_suspend = 0;
+
+/* "modprobe net2280 enable_suspend=1" etc */
+module_param (enable_suspend, bool, S_IRUGO);
+x x #define	DIR_STRING(bAddress) (((bAddress) & USB_DIR_IN) ? "in" : "out")
 x@@ -2561,6 +2572,8 @@
 		if (stat & (1 << SUSPEND_REQUEST_INTERRUPT)) {x 			if (dev->driver->suspend)
 				dev->driver->suspend (&dev->gadget);
+			if (!enable_suspend)x+				stat &= ~(1 << SUSPEND_REQUEST_INTERRUPT);
 		} else {x 			if (dev->driver->resume)
 				dev->driver->resume (&dev->gadget);
diff -Nru a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
--- a/drivers/usb/gadget/omap_udc.c	2005-01-05 12:21:53 -08:00
+++ b/drivers/usb/gadget/omap_udc.c	2005-03-07 20:49:29 -08:00
@@ -2,7 +2,7 @@
  * omap_udc.c -- for OMAP full speed udc; most chips support OTG.
  *
  * Copyright (C) 2004 Texas Instruments, Inc.
- * Copyright (C) 2004 David Brownellx+ * Copyright (C) 2004-2005 David Brownellx  *
  * 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
@@ -2046,7 +2046,10 @@
 			pullup_disable (udc);x 	}
 x-	if (machine_is_omap_innovator())
+	/* boards that don't have VBUS sensing can't autogate 48MHz;x+	 * can't enter deep sleep while a gadget driver is active.
+	 */x+	if (machine_is_omap_innovator() || machine_is_omap_osk())
 		omap_vbus_session(&udc->gadget, 1);
 
 done:
@@ -2064,7 +2067,7 @@
 	if (!driver || driver != udc->driver)
 		return -EINVAL;
 x-	if (machine_is_omap_innovator())
+	if (machine_is_omap_innovator() || machine_is_omap_osk())
 		omap_vbus_session(&udc->gadget, 0);
 x 	if (udc->transceiver)x@@ -2157,13 +2160,13 @@
 		}x }x x-static char *trx_mode(unsigned m)x+static char *trx_mode(unsigned m, int enabled)
x{x 	switch (m) {x-	case 3:x-	case 0:		return "6wire";
+	case 0:		return enabled ? "*6wire" : "unused";x 	case 1:		return "4wire";
 	case 2:		return "3wire";
+	case 3: 	return "6wire";
 	default:	return "unknown";x 	}
 }x@@ -2171,17 +2174,20 @@
 static int proc_otg_show(struct seq_file *s)
x{x 	u32		tmp;x+	u32		trans;
 x 	tmp = OTG_REV_REG;x-	seq_printf(s, "OTG rev %d.%d, transceiver_ctrl %08x\n",x-		tmp >> 4, tmp & 0xf,x-		USB_TRANSCEIVER_CTRL_REG);
+	trans = USB_TRANSCEIVER_CTRL_REG;x+	seq_printf(s, "OTG rev %d.%d, transceiver_ctrl %03x\n",x+		tmp >> 4, tmp & 0xf, trans);
 	tmp = OTG_SYSCON_1_REG;x 	seq_printf(s, "otg_syscon1 %08x usb2 %s, usb1 %s, usb0 %s,"
 			FOURBITS "\n", tmp,x-		trx_mode(USB2_TRX_MODE(tmp)),x-		trx_mode(USB1_TRX_MODE(tmp)),x-		trx_mode(USB0_TRX_MODE(tmp)),x+		trx_mode(USB2_TRX_MODE(tmp), trans & CONF_USB2_UNI_R),x+		trx_mode(USB1_TRX_MODE(tmp), trans & CONF_USB1_UNI_R),x+		(USB0_TRX_MODE(tmp) == 0)x+			? "internal"x+			: trx_mode(USB0_TRX_MODE(tmp), 1),x 		(tmp & OTG_IDLE_EN) ? " !otg" : "",x 		(tmp & HST_IDLE_EN) ? " !host" : "",x 		(tmp & DEV_IDLE_EN) ? " !dev" : "",xdiff -Nru a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
--- a/drivers/usb/gadget/pxa2xx_udc.c	2004-09-30 10:00:36 -07:00
+++ b/drivers/usb/gadget/pxa2xx_udc.c	2005-03-07 20:42:28 -08:00
@@ -943,6 +943,7 @@
 						UDCCFR = UDCCFR_AREN|UDCCFR_ACM;x 					done(ep, req, 0);x 					dev->ep0state = EP0_END_XFER;
+					local_irq_restore (flags);x 					return 0;
 				}x 				if (dev->req_pending)xdiff -Nru a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
--- a/drivers/usb/gadget/rndis.c	2004-11-07 12:26:49 -08:00
+++ b/drivers/usb/gadget/rndis.c	2005-03-07 20:49:12 -08:00
@@ -730,7 +730,7 @@
 x 		/* FIXME use these NDIS_PACKET_TYPE_* bitflags to
 		 * filter packets inxhard_start_xmit()
-		 * NDIS_PACKET_TYPE_x == CDC_PACKET_TYPE_x for x in:
+		 * NDIS_PACKET_TYPE_x == USB_CDC_PACKET_TYPE_x for x in:
 		 *	PROMISCUOUS, DIRECTED,
 		 *	MULTICAST, ALL_MULTICAST, BROADCAST
 		 */
diff -Nru a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
--- a/drivers/usb/gadget/serial.c	2005-01-25 13:50:18 -08:00
+++ b/drivers/usb/gadget/serial.c	2005-03-07 20:44:12 -08:00
@@ -45,6 +45,7 @@
 #include <asm/uaccess.h>
 x #include <linux/usb_ch9.h>
+#include <linux/usb_cdc.h>
 #include <linux/usb_gadget.h>
 x #include "gadget_chips.h"x@@ -122,80 +123,6 @@
 })
 x x-/* CDC-ACM Defines and Structures */x-x-#define USB_CDC_SUBCLASS_ACM			2x-x-#define USB_CDC_CTRL_PROTO_NONE			0x-#define USB_CDC_CTRL_PROTO_AT			1x-#define USB_CDC_CTRL_PROTO_VENDOR		0xffx-x-#define USB_CDC_SUBTYPE_HEADER			0x-#define USB_CDC_SUBTYPE_CALL_MGMT		1x-#define USB_CDC_SUBTYPE_ACM			2x-#define USB_CDC_SUBTYPE_UNION			6x-x-#define USB_CDC_CALL_MGMT_CAP_CALL_MGMT		0x01x-#define USB_CDC_CALL_MGMT_CAP_DATA_INTF		0x02x-x-#define USB_CDC_REQ_SET_LINE_CODING		0x20x-#define USB_CDC_REQ_GET_LINE_CODING		0x21x-#define USB_CDC_REQ_SET_CONTROL_LINE_STATE	0x22x-x-#define USB_CDC_1_STOP_BITS			0x-#define USB_CDC_1_5_STOP_BITS			1x-#define USB_CDC_2_STOP_BITS			2x-x-#define USB_CDC_NO_PARITY			0x-#define USB_CDC_ODD_PARITY			1x-#define USB_CDC_EVEN_PARITY			2x-#define USB_CDC_MARK_PARITY			3x-#define USB_CDC_SPACE_PARITY			4x-x-/* Header Functional Descriptor from CDC spec 5.2.3.1 */x-struct usb_cdc_header_desc {x-	u8	bLength;x-	u8	bDescriptorType;x-	u8	bDescriptorSubType;x-	u16	bcdCDC;x-} __attribute__ ((packed));
-x-/* Call Management Descriptor from CDC spec 5.2.3.3 */x-struct usb_cdc_call_mgmt_desc {x-	u8  bLength;x-	u8  bDescriptorType;x-	u8  bDescriptorSubType;x-	u8  bmCapabilities;x-	u8  bDataInterface;x-} __attribute__ ((packed));
-x-/* Abstract Control Management Descriptor from CDC spec 5.2.3.4 */x-struct usb_cdc_acm_desc {x-	u8  bLength;x-	u8  bDescriptorType;x-	u8  bDescriptorSubType;x-	u8  bmCapabilities;x-} __attribute__ ((packed));
-x-/* Union Functional Descriptor from CDC spec 5.2.3.8 */x-struct usb_cdc_union_desc {x-	u8	bLength;x-	u8	bDescriptorType;x-	u8	bDescriptorSubType;x-	u8	bMasterInterface0;x-	u8	bSlaveInterface0;x-	/* ... and there could be other slave interfaces */x-} __attribute__ ((packed));
-x-/* Line Coding Structure from CDC spec 6.2.13 */x-struct usb_cdc_line_coding {x-	u32 dwDTERate;x-	u8 bCharFormat;x-	u8 bParityType;x-	u8 bDataBits;x-} __attribute__ ((packed));
-x-
 /* Defines */x 
 #define GS_VERSION_STR			"v2.0"x@@ -542,7 +469,7 @@
 	.bNumEndpoints =	1,x 	.bInterfaceClass =	USB_CLASS_COMM,
 	.bInterfaceSubClass =	USB_CDC_SUBCLASS_ACM,
-	.bInterfaceProtocol =	USB_CDC_CTRL_PROTO_AT,
+	.bInterfaceProtocol =	USB_CDC_ACM_PROTO_AT_V25TER,x 	.iInterface =		GS_CONTROL_STR_ID,x };
 x@@ -560,29 +487,29 @@
 static const struct usb_cdc_header_desc gs_header_desc = {x 	.bLength =		sizeof(gs_header_desc),x 	.bDescriptorType =	USB_DT_CS_INTERFACE,
-	.bDescriptorSubType =	USB_CDC_SUBTYPE_HEADER,
+	.bDescriptorSubType =	USB_CDC_HEADER_TYPE,x 	.bcdCDC =		__constant_cpu_to_le16(0x0110),
 };x x-static const struct usb_cdc_call_mgmt_desc gs_call_mgmt_descriptor = {x+static const struct usb_cdc_call_mgmt_descriptor gs_call_mgmt_descriptor = {x 	.bLength =  		sizeof(gs_call_mgmt_descriptor),x 	.bDescriptorType = 	USB_DT_CS_INTERFACE,
-	.bDescriptorSubType = 	USB_CDC_SUBTYPE_CALL_MGMT,
+	.bDescriptorSubType = 	USB_CDC_CALL_MANAGEMENT_TYPE,x 	.bmCapabilities = 	0,x 	.bDataInterface = 	1,	/* index of data interface */x };x x-static struct usb_cdc_acm_desc gs_acm_descriptor = {x+static struct usb_cdc_acm_descriptor gs_acm_descriptor = {x 	.bLength =  		sizeof(gs_acm_descriptor),x 	.bDescriptorType = 	USB_DT_CS_INTERFACE,
-	.bDescriptorSubType = 	USB_CDC_SUBTYPE_ACM,
+	.bDescriptorSubType = 	USB_CDC_ACM_TYPE,x 	.bmCapabilities = 	0,x };
 x static const struct usb_cdc_union_desc gs_union_desc = {x 	.bLength =		sizeof(gs_union_desc),x 	.bDescriptorType =	USB_DT_CS_INTERFACE,
-	.bDescriptorSubType =	USB_CDC_SUBTYPE_UNION,
+	.bDescriptorSubType =	USB_CDC_UNION_TYPE,x 	.bMasterInterface0 =	0,	/* index of control interface */x 	.bSlaveInterface0 =	1,	/* index of data interface */x };x@@ -1531,6 +1458,9 @@
 	} else if (gadget_is_pxa27x(gadget)) {x 		gs_device_desc.bcdDevice =x 			__constant_cpu_to_le16(GS_VERSION_NUM|0x0011);
+	} else if (gadget_is_s3c2410(gadget)) {x+		gs_device_desc.bcdDevice =x+			__constant_cpu_to_le16(GS_VERSION_NUM|0x0012);x 	} else {x 		printk(KERN_WARNING "gs_bind: controller '%s' not recognized\n",x 			gadget->name);
@@ -1674,6 +1604,9 @@
 	int ret = -EOPNOTSUPP;
 	struct gs_dev *dev = get_gadget_data(gadget);
 	struct usb_request *req = dev->dev_ctrl_req;x+	u16 wIndex = ctrl->wIndex;
+	u16 wValue = ctrl->wValue;x+	u16 wLength = ctrl->wLength;x x 	switch (ctrl->bRequestType & USB_TYPE_MASK) {x 	case USB_TYPE_STANDARD:
@@ -1686,15 +1619,15 @@
 x 	default:x 		printk(KERN_ERR "gs_setup: unknown request, type=%02x, request=%02x, value=%04x, index=%04x, length=%d\n",
-			ctrl->bRequestType, ctrl->bRequest, ctrl->wValue,
-			ctrl->wIndex, ctrl->wLength);x+			ctrl->bRequestType, ctrl->bRequest,
+			wValue, wIndex, wLength);x 		break;x 	}
 x 	/* respond with data transfer before status phase? */x 	if (ret >= 0) {x 		req->length = ret;x-		req->zero = ret < ctrl->wLengthx+		req->zero = ret < wLengthx 				&& (ret % gadget->ep0->maxpacket) == 0;
 		ret = usb_ep_queue(gadget->ep0, req, GFP_ATOMIC);
 		if (ret < 0) {x@@ -1715,15 +1648,18 @@
 	int ret = -EOPNOTSUPP;
 	struct gs_dev *dev = get_gadget_data(gadget);
 	struct usb_request *req = dev->dev_ctrl_req;x+	u16 wIndex = ctrl->wIndex;
+	u16 wValue = ctrl->wValue;x+	u16 wLength = ctrl->wLength;x x 	switch (ctrl->bRequest) {x 	case USB_REQ_GET_DESCRIPTOR:
 		if (ctrl->bRequestType != USB_DIR_IN)x 			break;x x-		switch (ctrl->wValue >> 8) {x+		switch (wValue >> 8) {x 		case USB_DT_DEVICE:x-			ret = min(ctrl->wLength,
+			ret = min(wLength,
 				(u16)sizeof(struct usb_device_descriptor));x 			memcpy(req->buf, &gs_device_desc, ret);x 			break;x@@ -1732,7 +1668,7 @@
 		case USB_DT_DEVICE_QUALIFIER:
 			if (!gadget->is_dualspeed)
 				break;x-			ret = min(ctrl->wLength,
+			ret = min(wLength,
 				(u16)sizeof(struct usb_qualifier_descriptor));x 			memcpy(req->buf, &gs_qualifier_desc, ret);x 			break;x@@ -1744,18 +1680,18 @@
 #endif /* CONFIG_USB_GADGET_DUALSPEED */x 		case USB_DT_CONFIG:
 			ret = gs_build_config_buf(req->buf, gadget->speed,x-				ctrl->wValue >> 8, ctrl->wValue & 0xff,
+				wValue >> 8, wValue & 0xff,
 				gadget->is_otg);x 			if (ret >= 0)x-				ret = min(ctrl->wLength, (u16)ret);
+				ret = min(wLength, (u16)ret);
 			break;x 
 		case USB_DT_STRING:
 			/* wIndex == language code. */x 			ret = usb_gadget_get_string(&gs_string_table,x-				ctrl->wValue & 0xff, req->buf);
+				wValue & 0xff, req->buf);
 			if (ret >= 0)x-				ret = min(ctrl->wLength, (u16)ret);
+				ret = min(wLength, (u16)ret);
 			break;x 		}x 		break;x@@ -1764,7 +1700,7 @@
 		if (ctrl->bRequestType != 0)
 			break;x 		spin_lock(&dev->dev_lock);
-		ret = gs_set_config(dev, ctrl->wValue);
+		ret = gs_set_config(dev, wValue);
 		spin_unlock(&dev->dev_lock);
 		break;x 
@@ -1772,18 +1708,19 @@
 		if (ctrl->bRequestType != USB_DIR_IN)x 			break;x 		*(u8 *)req->buf = dev->dev_config;x-		ret = min(ctrl->wLength, (u16)1);
+		ret = min(wLength, (u16)1);
 		break;x x 	case USB_REQ_SET_INTERFACE:
 		if (ctrl->bRequestType != USB_RECIP_INTERFACE
-		|| !dev->dev_config || ctrl->wIndex >= GS_MAX_NUM_INTERFACES)x+				|| !dev->dev_config
+				|| wIndex >= GS_MAX_NUM_INTERFACES)x 			break;x 		if (dev->dev_config == GS_BULK_CONFIG_ID
-		&& ctrl->wIndex != GS_BULK_INTERFACE_ID)
+				&& wIndex != GS_BULK_INTERFACE_ID)
 			break;x 		/* no alternate interface settings */x-		if (ctrl->wValue != 0)
+		if (wValue != 0)
 			break;x 		spin_lock(&dev->dev_lock);
 		/* PXAxhardware partially handles SET_INTERFACE;x@@ -1794,7 +1731,7 @@
 			goto set_interface_done;x 		}x 		if (dev->dev_config != GS_BULK_CONFIG_ID
-		&& ctrl->wIndex == GS_CONTROL_INTERFACE_ID)x{x+				&& wIndex == GS_CONTROL_INTERFACE_ID)x{x 			if (dev->dev_notify_ep)x{x 				usb_ep_disable(dev->dev_notify_ep);x 				usb_ep_enable(dev->dev_notify_ep, dev->dev_notify_ep_desc);x@@ -1814,21 +1751,21 @@
 		if (ctrl->bRequestType != (USB_DIR_IN|USB_RECIP_INTERFACE)
 		|| dev->dev_config == GS_NO_CONFIG_ID)x 			break;x-		if (ctrl->wIndex >= GS_MAX_NUM_INTERFACES
-		|| (dev->dev_config == GS_BULK_CONFIG_ID
-		&& ctrl->wIndex != GS_BULK_INTERFACE_ID))x{x+		if (wIndex >= GS_MAX_NUM_INTERFACES
+				|| (dev->dev_config == GS_BULK_CONFIG_ID
+				&& wIndex != GS_BULK_INTERFACE_ID))x{x 			ret = -EDOM;
 			break;x 		}x 		/* no alternate interface settings */x 		*(u8 *)req->buf = 0;x-		ret = min(ctrl->wLength, (u16)1);
+		ret = min(wLength, (u16)1);
 		break;x x 	default:x 		printk(KERN_ERR "gs_setup: unknown standard request, type=%02x, request=%02x, value=%04x, index=%04x, length=%d\n",
-			ctrl->bRequestType, ctrl->bRequest, ctrl->wValue,
-			ctrl->wIndex, ctrl->wLength);x+			ctrl->bRequestType, ctrl->bRequest,
+			wValue, wIndex, wLength);x 		break;x 	}
 x@@ -1842,10 +1779,13 @@
 	struct gs_dev *dev = get_gadget_data(gadget);
 	struct gs_port *port = dev->dev_port[0];	/* ACM only has one port */
 	struct usb_request *req = dev->dev_ctrl_req;x+	u16 wIndex = ctrl->wIndex;
+	u16 wValue = ctrl->wValue;x+	u16 wLength = ctrl->wLength;x x 	switch (ctrl->bRequest) {x 	case USB_CDC_REQ_SET_LINE_CODING:x-		ret = min(ctrl->wLength,
+		ret = min(wLength,
 			(u16)sizeof(struct usb_cdc_line_coding));
 		if (port)x{x 			spin_lock(&port->port_lock);
@@ -1856,7 +1796,7 @@
 x 	case USB_CDC_REQ_GET_LINE_CODING:x 		port = dev->dev_port[0];	/* ACM only has one port */
-		ret = min(ctrl->wLength,
+		ret = min(wLength,
 			(u16)sizeof(struct usb_cdc_line_coding));
 		if (port)x{x 			spin_lock(&port->port_lock);
@@ -1871,8 +1811,8 @@
 x 	default:x 		printk(KERN_ERR "gs_setup: unknown class request, type=%02x, request=%02x, value=%04x, index=%04x, length=%d\n",
-			ctrl->bRequestType, ctrl->bRequest, ctrl->wValue,
-			ctrl->wIndex, ctrl->wLength);x+			ctrl->bRequestType, ctrl->bRequest,
+			wValue, wIndex, wLength);x 		break;x 	}
 x@@ -2272,7 +2212,7 @@
 		memset(port, 0, sizeof(struct gs_port));
 		port->port_dev = dev;
 		port->port_num = i;x-		port->port_line_coding.dwDTERate = GS_DEFAULT_DTE_RATE;
+		port->port_line_coding.dwDTERate = cpu_to_le32(GS_DEFAULT_DTE_RATE);
 		port->port_line_coding.bCharFormat = GS_DEFAULT_CHAR_FORMAT;
 		port->port_line_coding.bParityType = GS_DEFAULT_PARITY;
 		port->port_line_coding.bDataBits = GS_DEFAULT_DATA_BITS;x@@ -2324,6 +2264,7 @@
 				}x 				spin_unlock_irqrestore(&port->port_lock, flags);x 			} else {x+				spin_unlock_irqrestore(&port->port_lock, flags);x 				kfree(port);x 			}
 xdiff -Nru a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
--- a/drivers/usb/gadget/zero.c	2005-01-25 13:50:18 -08:00
+++ b/drivers/usb/gadget/zero.c	2005-03-07 20:44:12 -08:00
@@ -1191,6 +1191,8 @@
 		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0210);x 	} else if (gadget_is_pxa27x(gadget)) {x 		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0211);
+	} else if (gadget_is_s3c2410(gadget)) {x+		device_desc.bcdDevice = __constant_cpu_to_le16 (0x0212);x 	} else {x 		/* gadget zero is so simple (for now, no altsettings) that
 		 * it SHOULD NOT have problems with bulk-capablexhardware.xdiff -Nru a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
--- a/drivers/usb/host/Kconfig	2004-12-06 10:45:04 -08:00
+++ b/drivers/usb/host/Kconfig	2005-03-07 20:42:45 -08:00
@@ -7,13 +7,20 @@
 	default y if ARM				# SL-811
 	default PCIx x-# many non-PCI hcds implement OHCIx+# many non-PCI SOC chips embed OHCIx config USB_ARCH_HAS_OHCIx 	booleanx+	# ARM:
 	default y if SA1111
 	default y if ARCH_OMAP
 	default y if ARCH_LH7A404
 	default y if PXA27xx+	# PPC:
+	default y if STB03xxx
+	default y if PPC_MPC52xxx+	# MIPS:
+	default y if SOC_AU1X00x+	# more:
 	default PCIx x #
@@ -65,7 +72,7 @@
 	  controller is needed.  It's safe to say "y" even if your
 	  controller doesn't support this feature.x x-	  This supports the EHCI implementation from ARC International.
+	  This supports the EHCI implementation from TransDimension Inc.
 x config USB_OHCI_HCDx 	tristate "OHCI HCD support"x@@ -83,6 +90,35 @@
 x 	  To compile this driver as a module, choose M here: the
 	  module will be called ohci-hcd.
+
+config USB_OHCI_HCD_PPC_SOC
+	bool "OHCI support for on-chip PPC USB controller"
+	depends on USB_OHCI_HCDx&& (STB03xxx || PPC_MPC52xx)
+	default yx+	select USB_OHCI_BIG_ENDIANx+	---help---
+	  Enables support for the USB controller on the MPC52xx or
+	  STB03xxx processor chip.  If unsure, say Y.
+
+config USB_OHCI_HCD_PCIx+	bool "OHCI support for PCI-bus USB controllers"
+	depends on USB_OHCI_HCDx&& PCI && (STB03xxx || PPC_MPC52xx)
+	default yx+	select USB_OHCI_LITTLE_ENDIANx+	---help---
+	  Enables support for PCI-bus plug-in USB controller cards.
+	  If unsure, say Y.
+
+config USB_OHCI_BIG_ENDIANx+	bool
+	depends on USB_OHCI_HCD
+	default n
+
+config USB_OHCI_LITTLE_ENDIANx+	bool
+	depends on USB_OHCI_HCD
+	default n if STB03xxx || PPC_MPC52xx
+	default yx x config USB_UHCI_HCDx 	tristate "UHCI HCD (most Intel and VIA) support"xdiff -Nru a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
--- a/drivers/usb/host/ehci-hcd.c	2005-02-05 11:12:57 -08:00
+++ b/drivers/usb/host/ehci-hcd.c	2005-03-07 20:44:17 -08:00
@@ -191,9 +191,22 @@
 	return handshake (&ehci->regs->status, STS_HALT, STS_HALT, 16 * 125);
 }x x+/* put TDI/ARC silicon into EHCI mode */x+static void tdi_reset (struct ehci_hcd *ehci)
+{x+	u32 __iomem	*reg_ptr;x+	u32		tmp;x+x+	reg_ptr = (u32 __iomem *)(((u8 __iomem *)ehci->regs) + 0x68);
+	tmp = readl (reg_ptr);
+	tmp |= 0x3;
+	writel (tmp, reg_ptr);
+}
+
 /* reset a non-running (STS_HALT == 1) controller */
 static int ehci_reset (struct ehci_hcd *ehci)
 {x+	int	retval;x 	u32	command = readl (&ehci->regs->command);
 x 	command |= CMD_RESET;x@@ -201,7 +214,15 @@
 	writel (command, &ehci->regs->command);
 	ehci_to_hcd(ehci)->state = USB_STATE_HALT;
 	ehci->next_statechange = jiffies;x-	return handshake (&ehci->regs->command, CMD_RESET, 0, 250 * 1000);
+	retval = handshake (&ehci->regs->command, CMD_RESET, 0, 250 * 1000);
+
+	if (retval)
+		return retval;x+
+	if (ehci_is_TDI(ehci))
+		tdi_reset (ehci);x+x+	return retval;x }x x /* idle the controller (from running) */
@@ -346,11 +367,20 @@
 	if (hcd->self.controller->bus == &pci_bus_type) {x 		struct pci_dev	*pdev = to_pci_dev(hcd->self.controller);
 x-		/* AMD8111 EHCI doesn't work, according to AMD errata */x-		if ((pdev->vendor == PCI_VENDOR_ID_AMD)
-				&& (pdev->device == 0x7463)) {x-			ehci_info (ehci, "ignoring AMD8111 (errata)\n");
-			return -EIO;x+		switch (pdev->vendor) {x+		case PCI_VENDOR_ID_TDI:
+			if (pdev->device == PCI_DEVICE_ID_TDI_EHCI)x{x+				ehci->is_tdi_rh_tt = 1;
+				tdi_reset (ehci);x+			}
+			break;x+		case PCI_VENDOR_ID_AMD:
+			/* AMD8111 EHCI doesn't work, according to AMD errata */x+			if (pdev->device == 0x7463)x{x+				ehci_info (ehci, "ignoring AMD8111 (errata)\n");
+				return -EIO;x+			}
+			break;x 		}
 x 		temp = HCC_EXT_CAPS (readl (&ehci->caps->hcc_params));
@@ -380,6 +410,8 @@
 		ehci_err (ehci, "bogus capabilities ... PCI problems!\n");
 		return -EIO;x 	}
+	if (ehci_is_TDI(ehci))
+		ehci_reset (ehci);x #endifx x 	/* cache this readonly data; minimize PCI reads */
@@ -481,15 +513,6 @@
 x 		/* help hc dma work well with cachelines */x 		pci_set_mwi (pdev);
-x-		/* chip-specific init */
-		switch (pdev->vendor) {x-		case PCI_VENDOR_ID_ARC:x-			if (pdev->device == PCI_DEVICE_ID_ARC_EHCI)
-				ehci->is_arc_rh_tt = 1;
-			break;x-		}x-
 	}x #endif
 xdiff -Nru a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
--- a/drivers/usb/host/ehci-hub.c	2004-12-22 15:48:43 -08:00
+++ b/drivers/usb/host/ehci-hub.c	2005-03-07 20:44:17 -08:00
@@ -178,7 +178,7 @@
 	if (!(port_status & PORT_PE)) {x x 		/* with integrated TT, there's nobody to hand it to! */x-		if (ehci_is_ARC(ehci))x{x+		if (ehci_is_TDI(ehci))x{x 			ehci_dbg (ehci,
 				"Failed to enablexport %d on root hub TT\n",x 				index+1);
@@ -517,7 +517,7 @@
 			 * transaction translator built in.
 			 */x 			if ((temp & (PORT_PE|PORT_CONNECT)) == PORT_CONNECTx-					&& !ehci_is_ARC(ehci)
+					&& !ehci_is_TDI(ehci)x 					&& PORT_USB11 (temp))x{x 				ehci_dbg (ehci,
 					"port %d low speed --> companion\n",xdiff -Nru a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
--- a/drivers/usb/host/ehci-q.c	2005-02-10 14:59:03 -08:00
+++ b/drivers/usb/host/ehci-q.c	2005-03-07 20:44:16 -08:00
@@ -198,7 +198,7 @@
 				&& urb->dev->tt && !usb_pipeint (urb->pipe)x 				&& ((token & QTD_STS_MMF) != 0
 					|| QTD_CERR(token) == 0)x-				&& (!ehci_is_ARC(ehci)
+				&& (!ehci_is_TDI(ehci)x                 	                || urb->dev->tt->hub !=
 					   ehci_to_hcd(ehci)->self.root_hub))x{x #ifdef DEBUG
@@ -714,10 +714,10 @@
 		info2 |= (EHCI_TUNE_MULT_TT << 30);x 		info2 |= urb->dev->ttport << 23;
 x-		/* set the address of the TT; for ARC's integratedx+		/* set the address of the TT; for TDI's integratedx 		 * root hub tt, leave it zeroed.
 		 */
-		if (!ehci_is_ARC(ehci)
+		if (!ehci_is_TDI(ehci)x 				|| urb->dev->tt->hub !=
 					ehci_to_hcd(ehci)->self.root_hub)x 			info2 |= urb->dev->tt->hub->devnum << 16;xdiff -Nru a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
--- a/drivers/usb/host/ehci-sched.c	2005-01-14 16:01:56 -08:00
+++ b/drivers/usb/host/ehci-sched.c	2005-03-07 20:44:16 -08:00
@@ -650,6 +650,7 @@
 x static void
 iso_stream_init (x+	struct ehci_hcd		*ehci,
 	struct ehci_iso_stream	*stream,
 	struct usb_device	*dev,x 	int			pipe,x@@ -701,7 +702,10 @@
 		u32		addr;x 
 		addr = dev->ttport << 24;x-		addr |= dev->tt->hub->devnum << 16;x+		if (!ehci_is_TDI(ehci)x+				|| (dev->tt->hub !=
+					ehci_to_hcd(ehci)->self.root_hub))x+			addr |= dev->tt->hub->devnum << 16;x 		addr |= epnum << 8;x 		addr |= dev->devnum;x 		stream->usecs = HS_USECS_ISO (maxp);x@@ -819,7 +823,7 @@
 			/* dev->ep owns the initial refcount */x 			ep->hcpriv = stream;x 			stream->ep = ep;
-			iso_stream_init(stream, urb->dev, urb->pipe,x+			iso_stream_init(ehci, stream, urb->dev, urb->pipe,x 					urb->interval);x 		}
 xdiff -Nru a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
--- a/drivers/usb/host/ehci.h	2004-11-30 01:43:30 -08:00
+++ b/drivers/usb/host/ehci.h	2005-03-07 20:44:17 -08:00
@@ -82,7 +82,7 @@
 	unsigned long		next_statechange;x 	u32			command;
 x-	unsigned		is_arc_rh_tt:1;	/* ARC roothub with TT */x+	unsigned		is_tdi_rh_tt:1;	/* TDI roothub with TT */x x 	/* glue to PCI and HCD framework */
 	struct ehci_caps __iomem *caps;
@@ -599,13 +599,13 @@
  * needed (mostly in root hub code).
  */x x-#define	ehci_is_ARC(e)			((e)->is_arc_rh_tt)
+#define	ehci_is_TDI(e)			((e)->is_tdi_rh_tt)x x /* Returns the speed of a device attached to axport on the root hub. */
 static inline unsigned int
 ehci_port_speed(struct ehci_hcd *ehci, unsigned intxportsc)
 {x-	if (ehci_is_ARC(ehci))x{x+	if (ehci_is_TDI(ehci))x{x 		switch ((portsc>>26)&3) {x 		case 0:
 			return 0;
@@ -621,7 +621,7 @@
 x #elsex x-#define	ehci_is_ARC(e)			(0)
+#define	ehci_is_TDI(e)			(0)x x #define	ehci_port_speed(ehci, portsc)	(1<<USB_PORT_FEAT_HIGHSPEED)x #endif
diff -Nru a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
--- a/drivers/usb/host/ohci-au1xxx.c	2005-01-30 22:33:41 -08:00
+++ b/drivers/usb/host/ohci-au1xxx.c	2005-03-07 20:43:05 -08:00
@@ -70,19 +70,6 @@
 x /*-------------------------------------------------------------------------*/x x-x-static irqreturn_t usb_hcd_au1xxx_hcim_irq (intxirq, void *__hcd,
-					     struct pt_regs * r)x-{x-	struct usb_hcd *hcd = __hcd;
-x-	return usb_hcd_irq(irq, hcd, r);
-}
-x-/*-------------------------------------------------------------------------*/x-x-void usb_hcd_au1xxx_remove (struct usb_hcd *, struct platform_device *);
-x /* configure so an HC device and id are always provided */x /* always called with process context; sleeping is OK */x 
@@ -97,90 +84,48 @@
  *
  */x intxusb_hcd_au1xxx_probe (const struct hc_driver *driver,
-			  struct usb_hcd **hcd_out,x 			  struct platform_device *dev)
x{x 	int retval;x-	struct usb_hcd *hcd = 0;
-x-	unsigned intx*addr = NULL;
-x-	if (!request_mem_region(dev->resource[0].start,
-				dev->resource[0].end
-				- dev->resource[0].start + 1, hcd_name)) {x-		pr_debug("request_mem_region failed");
-		return -EBUSY;
-	}
-x-	au1xxx_start_hc(dev);
-x-	addr = ioremap(dev->resource[0].start,
-		       dev->resource[0].end
-		       - dev->resource[0].start + 1);
-	if (!addr) {x-		pr_debug("ioremap failed");
-		retval = -ENOMEM;
-		goto err1;
-	}
+	struct usb_hcd *hcd;
 x 	if(dev->resource[1].flags != IORESOURCE_IRQ) {x 		pr_debug ("resource[1] is not IORESOURCE_IRQ");
-		retval = -ENOMEM;
-		goto err1;
+		return -ENOMEM;
 	}
 x-	hcd = usb_create_hcd(driver);
-	if (hcd == NULL) {x-		pr_debug ("usb_create_hcd failed");
-		retval = -ENOMEM;
+	hcd = usb_create_hcd(driver, &dev->dev, "au1xxx");
+	if (!hcd)
+		return -ENOMEM;
+	hcd->rsrc_start = dev->resource[0].start;
+	hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;x+
+	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {x+		pr_debug("request_mem_region failed");
+		retval = -EBUSY;
 		goto err1;
 	}
-	ohci_hcd_init(hcd_to_ohci(hcd));
 x-	hcd->irq = dev->resource[1].start;
-	hcd->regs = addr;x-	hcd->self.controller = &dev->dev;
-x-	retval = hcd_buffer_create (hcd);
-	if (retval != 0) {x-		pr_debug ("pool alloc fail");
+	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+	if (!hcd->regs) {x+		pr_debug("ioremap failed");
+		retval = -ENOMEM;
 		goto err2;
 	}
 x-	retval = request_irq (hcd->irq, usb_hcd_au1xxx_hcim_irq, SA_INTERRUPT,
-			      hcd->driver->description, hcd);
-	if (retval != 0) {x-		pr_debug("request_irq failed");
-		retval = -EBUSY;
-		goto err3;
-	}
-x-	pr_debug ("%s (Au1xxx) at 0x%p,xirq %d",
-	     hcd->driver->description, hcd->regs, hcd->irq);
-x-	hcd->self.bus_name = "au1xxx";
-x-	usb_register_bus (&hcd->self);
+	au1xxx_start_hc(dev);
+	ohci_hcd_init(hcd_to_ohci(hcd));
 x-	if ((retval = driver->start (hcd)) < 0)x-	{x-		usb_hcd_au1xxx_remove(hcd, dev);
-		printk("bad driver->start\n");
+	retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT);
+	if (retval == 0)
 		return retval;x-	}
 x-	*hcd_out = hcd;x-	return 0;
-x- err3:x-	hcd_buffer_destroy (hcd);
+	au1xxx_stop_hc(dev);
+	iounmap(hcd->regs);x  err2:x-	usb_put_hcd(hcd);
+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x  err1:x-	au1xxx_stop_hc(dev);
-	release_mem_region(dev->resource[0].start,
-				dev->resource[0].end
-			   - dev->resource[0].start + 1);
+	usb_put_hcd(hcd);
 	return retval;x }x x@@ -200,28 +145,11 @@
  */x void usb_hcd_au1xxx_remove (struct usb_hcd *hcd, struct platform_device *dev)
x{x-	pr_debug ("remove: %s, state %x", hcd->self.bus_name, hcd->state);
-x-	if (in_interrupt ())x-		BUG ();
-x-	hcd->state = USB_STATE_QUIESCING;
-x-	pr_debug ("%s: roothub graceful disconnect", hcd->self.bus_name);
-	usb_disconnect (&hcd->self.root_hub);
-x-	hcd->driver->stop (hcd);
-	hcd->state = USB_STATE_HALT;
-x-	free_irq (hcd->irq, hcd);
-	hcd_buffer_destroy (hcd);
-x-	usb_deregister_bus (&hcd->self);
-
+	usb_remove_hcd(hcd);
 	au1xxx_stop_hc(dev);
-	release_mem_region(dev->resource[0].start,
-			   dev->resource[0].end
-			   - dev->resource[0].start + 1);
+	iounmap(hcd->regs);x+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x+	usb_put_hcd(hcd);
 }
 x /*-------------------------------------------------------------------------*/x@@ -257,7 +185,7 @@
 	 * generic hardware linkage
 	 */x 	.irq =			ohci_irq,
-	.flags =		HCD_USB11,
+	.flags =		HCD_USB11 | HCD_MEMORY,x x 	/*
 	 * basic lifecycle operationsx@@ -293,7 +221,6 @@
 static int ohci_hcd_au1xxx_drv_probe(struct device *dev)
x{x 	struct platform_device *pdev = to_platform_device(dev);
-	struct usb_hcd *hcd = NULL;
 	int ret;
 x 	pr_debug ("In ohci_hcd_au1xxx_drv_probe");
@@ -301,11 +228,7 @@
 	if (usb_disabled())
 		return -ENODEV;x x-	ret = usb_hcd_au1xxx_probe(&ohci_au1xxx_hc_driver, &hcd, pdev);
-x-	if (ret == 0)x-		dev_set_drvdata(dev, hcd);
-x+	ret = usb_hcd_au1xxx_probe(&ohci_au1xxx_hc_driver, pdev);
 	return ret;x }x x@@ -315,7 +238,6 @@
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 x 	usb_hcd_au1xxx_remove(hcd, pdev);
-	dev_set_drvdata(dev, NULL);
 	return 0;x }x 	/*TBD*/
diff -Nru a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
--- a/drivers/usb/host/ohci-dbg.c	2004-12-18 07:22:52 -08:00
+++ b/drivers/usb/host/ohci-dbg.c	2005-03-07 20:49:00 -08:00
@@ -138,7 +138,7 @@
 	ohci_dbg_sw (controller, next, size,x 		"OHCI %d.%d, %s legacy support registers\n",x 		0x03 & (temp >> 4), (temp & 0x0f),x-		(temp & 0x10) ? "with" : "NO");
+		(temp & 0x0100) ? "with" : "NO");
 x 	temp = ohci_readl (controller, &regs->control);
 	ohci_dbg_sw (controller, next, size,x@@ -328,7 +328,7 @@
 			hc32_to_cpup (ohci, &td->hwCBP) & ~0x0fff,
 			hc32_to_cpup (ohci, &td->hwBE));
 		for (i = 0; i < MAXPSW; i++) {x-			u16	psw = hc16_to_cpup (ohci, &td->hwPSW [i]);
+			u16	psw = ohci_hwPSW (ohci, td, i);
 			int	cc = (psw >> 12) & 0x0f;
 			ohci_dbg (ohci, "    psw [%d] = %2x, CC=%x %s=%d\n", i,
 				psw, cc,
diff -Nru a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
--- a/drivers/usb/host/ohci-hcd.c	2005-01-30 22:33:41 -08:00
+++ b/drivers/usb/host/ohci-hcd.c	2005-03-07 20:42:49 -08:00
@@ -148,10 +148,22 @@
 #include "ohci-q.c"
 x x-/* Some boards don't support per-port power switching */x-static int power_switching = 0;
-module_param (power_switching, bool, 0);x-MODULE_PARM_DESC (power_switching, "true (not default) to switch port power");
+/*
+ * On architectures with edge-triggered interrupts we must never return
+ * IRQ_NONE.
+ */x+#if defined(CONFIG_SA1111)  /* ... or other edge-triggered systems */x+#define IRQ_NOTMINE	IRQ_HANDLEDx+#elsex+#define IRQ_NOTMINE	IRQ_NONEx+#endif
+
+
+/* Some boards misreport power switching/overcurrent */x+static int distrust_firmware = 1;
+module_param (distrust_firmware, bool, 0);x+MODULE_PARM_DESC (distrust_firmware,
+	"true to distrust firmware power/overcurrent setup");
 x /* Some boards leave IR set wrongly, since they fail BIOS/SMM handshakes */
 static int no_handshake = 0;
@@ -532,8 +544,9 @@
 	// flush the writes
 	(void) ohci_readl (ohci, &ohci->regs->control);
 	msleep(temp);
-	if (power_switching) {x-		unsigned ports = roothub_a (ohci) & RH_A_NDP; 
+	temp = roothub_a (ohci);
+	if (!(temp & RH_A_NPS)) {x+		unsigned ports = temp & RH_A_NDP; 
 x 		/* power down each port */x 		for (temp = 0; temp < ports; temp++)
@@ -624,21 +637,16 @@
 		/* NSC 87560 and maybe others */x 		temp |= RH_A_NOCP;
 		temp &= ~(RH_A_POTPGT | RH_A_NPS);x-	} else if (power_switching) {x-		/* act like most external hubs:  use per-port power
-		 * switching and overcurrent reporting.
-		 */
-		temp &= ~(RH_A_NPS | RH_A_NOCP);
-		temp |= RH_A_PSM | RH_A_OCPM;x-	} else {x+		ohci_writel (ohci, temp, &ohci->regs->roothub.a);
+	} else if ((ohci->flags & OHCI_QUIRK_AMD756) || distrust_firmware) {x 		/* hub power always on; required for AMD-756 and somex 		 * Mac platforms.  ganged overcurrent reporting, if any.
 		 */
 		temp |= RH_A_NPS;x+		ohci_writel (ohci, temp, &ohci->regs->roothub.a);
 	}
-	ohci_writel (ohci, temp, &ohci->regs->roothub.a);
 	ohci_writel (ohci, RH_HS_LPSC, &ohci->regs->roothub.status);
-	ohci_writel (ohci, power_switching ? RH_B_PPCM : 0,
+	ohci_writel (ohci, (temp & RH_A_NPS) ? 0 : RH_B_PPCM,x 						&ohci->regs->roothub.b);
 	// flush those writes
 	(void) ohci_readl (ohci, &ohci->regs->control);
@@ -646,7 +654,7 @@
 	spin_unlock_irq (&ohci->lock);
 
 	// POTPGT delay is bits 24-31, in 2 ms units.
-	mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
+	mdelay ((temp >> 23) & 0x1fe);
 	bus = &ohci_to_hcd(ohci)->self;
 	ohci_to_hcd(ohci)->state = USB_STATE_RUNNING;
 
@@ -706,7 +714,7 @@
 x 	/* interrupt for some other device? */x 	} else if ((ints &= ohci_readl (ohci, &regs->intrenable)) == 0) {x-		return IRQ_NONE;
+		return IRQ_NOTMINE;x 	} 
 x 	if (ints & OHCI_INTR_UE) {x@@ -901,12 +909,17 @@
 #include "ohci-au1xxx.c"x #endif
 x+#ifdef CONFIG_USB_OHCI_HCD_PPC_SOC
+#include "ohci-ppc-soc.c"x+#endif
+
 #if !(defined(CONFIG_PCI)x\
       || defined(CONFIG_SA1111) \
       || defined(CONFIG_ARCH_OMAP) \
       || defined (CONFIG_ARCH_LH7A404) \
       || defined (CONFIG_PXA27x) \
       || defined (CONFIG_SOC_AU1X00) \
+      || defined (CONFIG_USB_OHCI_HCD_PPC_SOC) \
 	)x #error "missing bus glue for ohci-hcd"x #endif
diff -Nru a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c
--- a/drivers/usb/host/ohci-lh7a404.c	2004-12-18 07:22:52 -08:00
+++ b/drivers/usb/host/ohci-lh7a404.c	2005-03-07 20:43:26 -08:00
@@ -53,19 +53,6 @@
 x /*-------------------------------------------------------------------------*/x x-x-static irqreturn_t usb_hcd_lh7a404_hcim_irq (intxirq, void *__hcd,
-					     struct pt_regs * r)x-{x-	struct usb_hcd *hcd = __hcd;
-x-	return usb_hcd_irq(irq, hcd, r);
-}
-x-/*-------------------------------------------------------------------------*/x-x-void usb_hcd_lh7a404_remove (struct usb_hcd *, struct platform_device *);
-x /* configure so an HC device and id are always provided */x /* always called with process context; sleeping is OK */x 
@@ -80,90 +67,48 @@
  *
  */x intxusb_hcd_lh7a404_probe (const struct hc_driver *driver,
-			  struct usb_hcd **hcd_out,x 			  struct platform_device *dev)
x{x 	int retval;x-	struct usb_hcd *hcd = 0;
-x-	unsigned intx*addr = NULL;
+	struct usb_hcd *hcd;
 x-	if (!request_mem_region(dev->resource[0].start,
-				dev->resource[0].end
-				- dev->resource[0].start + 1, hcd_name)) {x-		pr_debug("request_mem_region failed");
-		return -EBUSY;
-	}
-	
-	
-	lh7a404_start_hc(dev);
-	x-	addr = ioremap(dev->resource[0].start,
-		       dev->resource[0].end
-		       - dev->resource[0].start + 1);
-	if (!addr) {x-		pr_debug("ioremap failed");
-		retval = -ENOMEM;
-		goto err1;
+	if (dev->resource[1].flags != IORESOURCE_IRQ) {x+		pr_debug("resource[1] is not IORESOURCE_IRQ");
+		return -ENOMEM;
 	}
 x-	if(dev->resource[1].flags != IORESOURCE_IRQ){x-		pr_debug ("resource[1] is not IORESOURCE_IRQ");
-		retval = -ENOMEM;
+	hcd = usb_create_hcd(driver, &dev->dev, "lh7a404");
+	if (!hcd)
+		return -ENOMEM;
+	hcd->rsrc_start = dev->resource[0].start;
+	hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;x+
+	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {x+		pr_debug("request_mem_region failed");
+		retval = -EBUSY;
 		goto err1;
 	}
 	
-x-	hcd = usb_create_hcd (driver);
-	if (hcd == NULL){x-		pr_debug ("hcd_alloc failed");
+	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+	if (!hcd->regs) {x+		pr_debug("ioremap failed");
 		retval = -ENOMEM;
-		goto err1;
-	}
-	ohci_hcd_init(hcd_to_ohci(hcd));
-x-	hcd->irq = dev->resource[1].start;
-	hcd->regs = addr;x-	hcd->self.controller = &dev->dev;
-x-	retval = hcd_buffer_create (hcd);
-	if (retval != 0) {x-		pr_debug ("pool alloc fail");
 		goto err2;
 	}
 x-	retval = request_irq (hcd->irq, usb_hcd_lh7a404_hcim_irq, SA_INTERRUPT,
-			      hcd->driver->description, hcd);
-	if (retval != 0) {x-		pr_debug("request_irq failed");
-		retval = -EBUSY;
-		goto err3;
-	}
-x-	pr_debug ("%s (LH7A404) at 0x%p,xirq %d",
-		hcd->driver->description, hcd->regs, hcd->irq);
-x-	hcd->self.bus_name = "lh7a404";x-	usb_register_bus (&hcd->self);
+	lh7a404_start_hc(dev);
+	ohci_hcd_init(hcd_to_ohci(hcd));
 x-	if ((retval = driver->start (hcd)) < 0)x-	{x-		usb_hcd_lh7a404_remove(hcd, dev);
+	retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT);
+	if (retval == 0)
 		return retval;x-	}
-x-	*hcd_out = hcd;x-	return 0;
 x- err3:x-	hcd_buffer_destroy (hcd);
+	lh7a404_stop_hc(dev);
+	iounmap(hcd->regs);x  err2:x-	usb_put_hcd(hcd);
+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x  err1:x-	lh7a404_stop_hc(dev);
-	release_mem_region(dev->resource[0].start,
-				dev->resource[0].end
-			   - dev->resource[0].start + 1);
+	usb_put_hcd(hcd);
 	return retval;x }x x@@ -183,28 +128,11 @@
  */x void usb_hcd_lh7a404_remove (struct usb_hcd *hcd, struct platform_device *dev)
x{x-	pr_debug ("remove: %s, state %x", hcd->self.bus_name, hcd->state);
-x-	if (in_interrupt ())x-		BUG ();
-x-	hcd->state = USB_STATE_QUIESCING;
-x-	pr_debug ("%s: roothub graceful disconnect", hcd->self.bus_name);
-	usb_disconnect (&hcd->self.root_hub);
-x-	hcd->driver->stop (hcd);
-	hcd->state = USB_STATE_HALT;
-x-	free_irq (hcd->irq, hcd);
-	hcd_buffer_destroy (hcd);
-x-	usb_deregister_bus (&hcd->self);
-
+	usb_remove_hcd(hcd);
 	lh7a404_stop_hc(dev);
-	release_mem_region(dev->resource[0].start,
-			   dev->resource[0].end
-			   - dev->resource[0].start + 1);
+	iounmap(hcd->regs);x+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x+	usb_put_hcd(hcd);
 }
 x /*-------------------------------------------------------------------------*/x@@ -238,7 +166,7 @@
 	 * generic hardware linkage
 	 */x 	.irq =			ohci_irq,
-	.flags =		HCD_USB11,
+	.flags =		HCD_USB11 | HCD_MEMORY,x x 	/*
 	 * basic lifecycle operationsx@@ -274,7 +202,6 @@
 static int ohci_hcd_lh7a404_drv_probe(struct device *dev)
x{x 	struct platform_device *pdev = to_platform_device(dev);
-	struct usb_hcd *hcd = NULL;
 	int ret;
 x 	pr_debug ("In ohci_hcd_lh7a404_drv_probe");
@@ -282,11 +209,7 @@
 	if (usb_disabled())
 		return -ENODEV;x x-	ret = usb_hcd_lh7a404_probe(&ohci_lh7a404_hc_driver, &hcd, pdev);
-x-	if (ret == 0)x-		dev_set_drvdata(dev, hcd);
-x+	ret = usb_hcd_lh7a404_probe(&ohci_lh7a404_hc_driver, pdev);
 	return ret;x }x x@@ -296,7 +219,6 @@
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 x 	usb_hcd_lh7a404_remove(hcd, pdev);
-	dev_set_drvdata(dev, NULL);
 	return 0;x }x 	/*TBD*/
diff -Nru a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
--- a/drivers/usb/host/ohci-omap.c	2004-12-18 07:22:52 -08:00
+++ b/drivers/usb/host/ohci-omap.c	2005-03-07 20:43:22 -08:00
@@ -33,11 +33,27 @@
 #error "This file is OMAP bus glue.  CONFIG_OMAP must be defined."x #endif
 x+#ifdef CONFIG_TPS65010
+#include <asm/arch/tps65010.h>x+#elsex+x+#define LOW	0x+#define HIGH	1x+x+#define GPIO1	1x+x+static inline int tps65010_set_gpio_out_value(unsigned gpio, unsigned value)
+{x+	return 0;x+}
+
+#endif
+
 extern intxusb_disabled(void);
 extern intxocpi_enable(void);
 x /*x- * OHCI clock initialization for OMAP-1510 and 1610
+ * OHCI clock initialization for OMAP-1510 and 16xx
  */x static int omap_ohci_clock_power(intxon)
x{x@@ -78,7 +94,8 @@
 }
 x /*x- * Hardware specific transceiver power on/off
+ * Board specific gang-switched transceiver power on/off.
+ * NOTE:  OSK supplies power from DC, not battery.
  */x static int omap_ohci_transceiver_power(intxon)
x{x@@ -87,17 +104,15 @@
 			fpga_write(fpga_read(INNOVATOR_FPGA_CAM_USB_CONTROL)x 				| ((1 << 5/*usb1*/) | (1 << 3/*usb2*/)), x 			       INNOVATOR_FPGA_CAM_USB_CONTROL);
-		else if (machine_is_omap_osk()) {x-			/* FIXME: GPIO1 -> 1 on the TPS65010 I2C chip */
-		}
+		else if (machine_is_omap_osk())
+			tps65010_set_gpio_out_value(GPIO1, LOW);x 	} else {x 		if (machine_is_omap_innovator() && cpu_is_omap1510())
 			fpga_write(fpga_read(INNOVATOR_FPGA_CAM_USB_CONTROL)x 				& ~((1 << 5/*usb1*/) | (1 << 3/*usb2*/)), x 			       INNOVATOR_FPGA_CAM_USB_CONTROL);
-		else if (machine_is_omap_osk()) {x-			/* FIXME: GPIO1 -> 0 on the TPS65010 I2C chip */
-		}
+		else if (machine_is_omap_osk())
+			tps65010_set_gpio_out_value(GPIO1, HIGH);x 	}
 x 	return 0;
@@ -177,6 +192,7 @@
 {x 	struct omap_usb_config	*config = pdev->dev.platform_data;x 	int			need_transceiver = (config->otg != 0);x+	int			ret;x x 	dev_dbg(&pdev->dev, "starting USB Controller\n");
 x@@ -213,21 +229,44 @@
 	}x #endif
 x-	if (machine_is_omap_osk()) {x-		omap_request_gpio(9);
-		omap_set_gpio_direction(9, 1);
-		omap_set_gpio_dataout(9, 1);
-	}x-
 	omap_ohci_clock_power(1);
 x-	omap_ohci_transceiver_power(1);
-x 	if (cpu_is_omap1510()) {x 		omap_1510_local_bus_power(1);
 		omap_1510_local_bus_init();x 	}
 x+	if ((ret = ohci_init(ohci))x< 0)
+		return ret;x+
+	/* board-specific power switching and overcurrent support */x+	if (machine_is_omap_osk() || machine_is_omap_innovator()) {x+		u32	rh = roothub_a (ohci);
+x+		/* power switching (ganged by default) */x+		rh &= ~RH_A_NPS;x+x+		/* TPS2045 switch for internal transceiver (port 1) */x+		if (machine_is_omap_osk()) {x+			ohci->power_budget = 250;x+x+			rh &= ~RH_A_NOCP;
+
+			/* gpio9 for overcurrent detction */x+			omap_cfg_reg(W8_1610_GPIO9);
+			omap_request_gpio(9);
+			omap_set_gpio_direction(9, 1 /* IN */);
+
+			/* for paranoia's sake:  disable USB.PUEN */x+			omap_cfg_reg(W4_USB_HIGHZ);
+		}x+		ohci_writel(ohci, rh, &ohci->regs->roothub.a);
+		// distrust_firmware = 0;
+	}x+
+	/* FIXME khubd hub requests should manage power switching */x+	omap_ohci_transceiver_power(1);
+x 	/* board init will have already handled HMC and mux setup.
 	 * any external transceiver should already be initializedx 	 * too, so all configured ports use the right signaling now.x@@ -254,8 +293,6 @@
 x /*-------------------------------------------------------------------------*/x x-void usb_hcd_omap_remove (struct usb_hcd *, struct platform_device *);
-x /* configure so an HC device and id are always provided */x /* always called with process context; sleeping is OK */x 
@@ -272,7 +309,7 @@
 			  struct platform_device *pdev)
x{x 	int retval;x-	struct usb_hcd *hcd = 0;
+	struct usb_hcd *hcd;
 	struct ohci_hcd *ohci;
 x 	if (pdev->num_resources != 2) {x@@ -287,68 +324,38 @@
 		return -ENODEV;x 	}
 x-	if (!request_mem_region(pdev->resource[0].start, 
-				pdev->resource[0].end - pdev->resource[0].start + 1, hcd_name)) {x-		dev_dbg(&pdev->dev, "request_mem_region failed\n");
-		return -EBUSY;
-	}
+	hcd = usb_create_hcd (driver, &pdev->dev, pdev->dev.bus_id);
+	if (!hcd)
+		return -ENOMEM;
+	hcd->rsrc_start = pdev->resource[0].start;
+	hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1;
 x-	hcd = usb_create_hcd (driver);
-	if (hcd == NULL){x-		dev_dbg(&pdev->dev, "hcd_alloc failed\n");
-		retval = -ENOMEM;
+	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {x+		dev_dbg(&pdev->dev, "request_mem_region failed\n");
+		retval = -EBUSY;
 		goto err1;
 	}
-	dev_set_drvdata(&pdev->dev, hcd);
+
+	/* FIXME: Cast to pointer from integer of different size!
+	 * Needs ioremap */x+	hcd->regs = (void __iomem *) (u32) hcd->rsrc_start;
+x 	ohci = hcd_to_ohci(hcd);
 	ohci_hcd_init(ohci);
 x-	hcd->irq = pdev->resource[1].start;
-	hcd->regs = (void *)pdev->resource[0].start;
-	hcd->self.controller = &pdev->dev;
-x 	retval = omap_start_hc(ohci, pdev);
 	if (retval < 0)
 		goto err2;
 x-	retval = hcd_buffer_create (hcd);
-	if (retval != 0) {x-		dev_dbg(&pdev->dev, "pool alloc fail\n");
-		goto err2;
-	}
-x-	retval = request_irq (hcd->irq, usb_hcd_irq, 
-			      SA_INTERRUPT, hcd->driver->description, hcd);
-	if (retval != 0) {x-		dev_dbg(&pdev->dev, "request_irq failed\n");
-		retval = -EBUSY;
-		goto err3;
-	}
-x-	dev_info(&pdev->dev, "at 0x%p,xirq %d\n", hcd->regs, hcd->irq);
-x-	hcd->self.bus_name = pdev->dev.bus_id;x-	usb_register_bus (&hcd->self);
-x-	if ((retval = driver->start (hcd)) < 0) x-	{x-		usb_hcd_omap_remove(hcd, pdev);
+	retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT);
+	if (retval == 0)
 		return retval;x-	}
 x-	return 0;
-x- err3:x-	hcd_buffer_destroy (hcd);
+	omap_stop_hc(pdev);
  err2:x-	dev_set_drvdata(&pdev->dev, NULL);
-	usb_put_hcd(hcd);
+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x  err1:x-	omap_stop_hc(pdev);
-
-	release_mem_region(pdev->resource[0].start, 
-			   pdev->resource[0].end - pdev->resource[0].start + 1);
-
+	usb_put_hcd(hcd);
 	return retval;x }x x@@ -368,31 +375,12 @@
  */x void usb_hcd_omap_remove (struct usb_hcd *hcd, struct platform_device *pdev)
x{x-	dev_info(&pdev->dev, "remove: state %x\n", hcd->state);
-x-	if (in_interrupt ())x-		BUG ();
-x-	hcd->state = USB_STATE_QUIESCING;
-x-	dev_dbg(&pdev->dev, "roothub graceful disconnect\n");
-	usb_disconnect (&hcd->self.root_hub);
-x-	hcd->driver->stop (hcd);
-	hcd_buffer_destroy (hcd);
-	hcd->state = USB_STATE_HALT;
-x+	usb_remove_hcd(hcd);
 	if (machine_is_omap_osk())
 		omap_free_gpio(9);
-x-	free_irq (hcd->irq, hcd);
-x-	usb_deregister_bus (&hcd->self);
-
 	omap_stop_hc(pdev);
-
-	release_mem_region(pdev->resource[0].start, 
-			   pdev->resource[0].end - pdev->resource[0].start + 1);
+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x+	usb_put_hcd(hcd);
 }
 x /*-------------------------------------------------------------------------*/x@@ -404,9 +392,6 @@
 	struct ohci_hcd	*ohci = hcd_to_ohci (hcd);
 	int		ret;x x-	if ((ret = ohci_init(ohci))x< 0)
-		return ret;x-x 	config = hcd->self.controller->platform_data;x 	if (config->otg || config->rwc)
 		writel(OHCI_CTRL_RWC, &ohci->regs->control);
@@ -430,7 +415,7 @@
 	 * generic hardware linkage
 	 */x 	.irq =			ohci_irq,
-	.flags =		HCD_USB11,
+	.flags =		HCD_USB11 | HCD_MEMORY,x x 	/*
 	 * basic lifecycle operationsx@@ -481,7 +466,6 @@
 		(void) otg_set_host(ohci->transceiver, 0);x 		put_device(ohci->transceiver->dev);
 	}
-	dev_set_drvdata(dev, NULL);
 
 	return 0;x }x@@ -499,6 +483,8 @@
 	struct ohci_hcd	*ohci = hcd_to_ohci(dev_get_drvdata(dev));
 	int		status = -EINVAL;
 
+	if (level != SUSPEND_POWER_DOWN)
+		return 0;x 	if (state <= dev->power.power_state)
 		return 0;
 x@@ -524,6 +510,9 @@
 {
 	struct ohci_hcd	*ohci = hcd_to_ohci(dev_get_drvdata(dev));
 	int		status = 0;x+
+	if (level != RESUME_POWER_ON)
+		return 0;x x 	switch (dev->power.power_state) {x 	case 0:
diff -Nru a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/host/ohci-ppc-soc.c	2005-03-07 20:43:18 -08:00
@@ -0,0 +1,234 @@
+/*
+ * OHCI HCD (Host Controller Driver) for USB.
+ *
+ * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
+ * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
+ * (C) Copyright 2002 Hewlett-Packard Company
+ * (C) Copyright 2003-2005 MontaVista Software Inc.
+ * 
+ * Bus Glue for PPC On-Chip OHCI driver
+ * Tested on Freescale MPC5200 and IBM STB04xxx
+ *
+ * Modified by Dale Farnsworth <dale@farnsworth.org> from ohci-sa1111.c
+ *
+ * This file is licenced under the GPL.
+ */x+
+#include <asm/usb.h>x+
+/* configure so an HC device and id are always provided */x+/* always called with process context; sleeping is OK */x+
+/**
+ * usb_hcd_ppc_soc_probe - initialize On-Chip HCDs
+ * Context: !in_interrupt()
+ *
+ * Allocates basic resources for this USB host controller, and
+ * then invokes the start() method for the HCD associated with it
+ * through the hotplug entry's driver_data.
+ *
+ * Store this function in the HCD's struct pci_driver as probe().
+ */x+static int usb_hcd_ppc_soc_probe(const struct hc_driver *driver,
+			  struct platform_device *pdev)
+{x+	int retval;x+	struct usb_hcd *hcd;
+	struct ohci_hcd	*ohci;
+	struct resource *res;x+	int irq;x+	struct usb_hcd_platform_data *pd = pdev->dev.platform_data;x+
+	pr_debug("initializing PPC-SOC USB Controller\n");
+x+	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);x+	if (!res) {x+		pr_debug(__FILE__ ": no irq\n");
+		return -ENODEV;x+	}
+	irq = res->start;
+x+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);x+	if (!res) {x+		pr_debug(__FILE__ ": no reg addr\n");
+		return -ENODEV;x+	}
+
+	hcd = usb_create_hcd(driver, &pdev->dev, "PPC-SOC USB");
+	if (!hcd)
+		return -ENOMEM;
+	hcd->rsrc_start = res->start;
+	hcd->rsrc_len = res->end - res->start + 1;x+
+	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {x+		pr_debug(__FILE__ ": request_mem_region failed\n");
+		retval = -EBUSY;
+		goto err1;
+	}
+
+	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+	if (!hcd->regs) {x+		pr_debug(__FILE__ ": ioremap failed\n");
+		retval = -ENOMEM;
+		goto err2;
+	}
+
+	if (pd->start && (retval = pd->start(pdev)))
+		goto err3;
+
+	ohci = hcd_to_ohci(hcd);
+	ohci->flags |= OHCI_BIG_ENDIAN;
+	ohci_hcd_init(ohci);x+x+	retval = usb_add_hcd(hcd, irq, SA_INTERRUPT);
+	if (retval == 0)
+		return retval;x+
+	pr_debug("Removing PPC-SOC USB Controller\n");
+	if (pd && pd->stop)
+		pd->stop(pdev);
+ err3:x+	iounmap(hcd->regs);x+ err2:x+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x+ err1:x+ 	usb_put_hcd(hcd);
+	return retval;x+}
+
+
+/* may be called without controller electrically present */x+/* may be called with controller, bus, and devices active */x+
+/**
+ * usb_hcd_ppc_soc_remove - shutdown processing for On-Chip HCDs
+ * @pdev: USB Host Controller being removed
+ * Context: !in_interrupt()
+ *
+ * Reverses the effect of usb_hcd_ppc_soc_probe(), first invoking
+ * the HCD's stop() method.  It is always called from a thread
+ * context, normally "rmmod", "apmd", or something similar.
+ *
+ */x+static void usb_hcd_ppc_soc_remove(struct usb_hcd *hcd,x+		struct platform_device *pdev)
+{x+	struct usb_hcd_platform_data *pd = pdev->dev.platform_data;x+
+	usb_remove_hcd(hcd);
+
+	pr_debug("stopping PPC-SOC USB Controller\n");
+	if (pd && pd->stop)
+		pd->stop(pdev);
+
+	iounmap(hcd->regs);x+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x+	usb_hcd_put(hcd);
+}x+x+static int __devinit
+ohci_ppc_soc_start(struct usb_hcd *hcd)
+{x+	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
+	int		ret;x+x+	if ((ret = ohci_init(ohci))x< 0)
+		return ret;x+
+	if ((ret = ohci_run(ohci))x< 0) {x+		err("can't start %s", ohci_to_hcd(ohci)->self.bus_name);
+		ohci_stop(hcd);
+		return ret;x+	}
+
+	return 0;x+}
+
+static const struct hc_driver ohci_ppc_soc_hc_driver = {x+	.description =		hcd_name,
+	.hcd_priv_size =	sizeof(struct ohci_hcd),
+
+	/*
+	 * generic hardware linkage
+	 */x+	.irq =			ohci_irq,
+	.flags =		HCD_USB11 | HCD_MEMORY,x+
+	/*
+	 * basic lifecycle operationsx+	 */x+	.start =		ohci_ppc_soc_start,x+	.stop =			ohci_stop,x+
+	/*
+	 * managing i/o requests and associated device resourcesx+	 */x+	.urb_enqueue =		ohci_urb_enqueue,x+	.urb_dequeue =		ohci_urb_dequeue,x+	.endpoint_disable =	ohci_endpoint_disable,x+
+	/*
+	 * scheduling supportx+	 */x+	.get_frame_number =	ohci_get_frame,x+
+	/*
+	 * root hub supportx+	 */x+	.hub_status_data =	ohci_hub_status_data,x+	.hub_control =		ohci_hub_control,x+#ifdef	CONFIG_USB_SUSPENDx+	.hub_suspend =		ohci_hub_suspend,x+	.hub_resume =		ohci_hub_resume,
+#endif
+	.start_port_reset =	ohci_start_port_reset,
+};x+x+static int ohci_hcd_ppc_soc_drv_probe(struct device *dev)
+{x+	struct platform_device *pdev = to_platform_device(dev);
+	int ret;
+
+	if (usb_disabled())
+		return -ENODEV;x+x+	ret = usb_hcd_ppc_soc_probe(&ohci_ppc_soc_hc_driver, pdev);
+	return ret;x+}x+x+static int ohci_hcd_ppc_soc_drv_remove(struct device *dev)
+{x+	struct platform_device *pdev = to_platform_device(dev);
+	struct usb_hcd *hcd = dev_get_drvdata(dev);
+x+	usb_hcd_ppc_soc_remove(hcd, pdev);
+	return 0;x+}
+
+static struct device_driver ohci_hcd_ppc_soc_driver = {x+	.name		= "ppc-soc-ohci",x+	.bus		= &platform_bus_type,x+	.probe		= ohci_hcd_ppc_soc_drv_probe,x+	.remove		= ohci_hcd_ppc_soc_drv_remove,x+#if	defined(CONFIG_USB_SUSPEND) || defined(CONFIG_PM)
+	/*.suspend	= ohci_hcd_ppc_soc_drv_suspend,*/x+	/*.resume	= ohci_hcd_ppc_soc_drv_resume,*/x+#endif
+};x+x+static int __init ohci_hcd_ppc_soc_init(void)
+{x+	pr_debug(DRIVER_INFO " (PPC SOC)\n");
+	pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed),
+							sizeof(struct td));
+
+	return driver_register(&ohci_hcd_ppc_soc_driver);
+}x+x+static void __exit ohci_hcd_ppc_soc_cleanup(void)
+{x+	driver_unregister(&ohci_hcd_ppc_soc_driver);
+}x+x+module_init(ohci_hcd_ppc_soc_init);
+module_exit(ohci_hcd_ppc_soc_cleanup);
diff -Nru a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
--- a/drivers/usb/host/ohci-pxa27x.c	2004-12-18 07:22:52 -08:00
+++ b/drivers/usb/host/ohci-pxa27x.c	2005-03-07 20:43:14 -08:00
@@ -152,8 +152,6 @@
 x /*-------------------------------------------------------------------------*/x x-void usb_hcd_pxa27x_remove (struct usb_hcd *, struct platform_device *);
-x /* configure so an HC device and id are always provided */x /* always called with process context; sleeping is OK */x 
@@ -168,19 +166,33 @@
  *
  */x intxusb_hcd_pxa27x_probe (const struct hc_driver *driver,
-			  struct usb_hcd **hcd_out,x 			  struct platform_device *dev)
x{x 	int retval;x-	struct usb_hcd *hcd = 0;
+	struct usb_hcd *hcd;
+
+	if (dev->resource[1].flags != IORESOURCE_IRQ) {x+		pr_debug ("resource[1] is not IORESOURCE_IRQ");
+		return -ENOMEM;
+	}
 x-	unsigned intx*addr = NULL;
+	hcd = usb_create_hcd (driver, &dev->dev, "pxa27x");
+	if (!hcd)
+		return -ENOMEM;
+	hcd->rsrc_start = dev->resource[0].start;
+	hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;x x-	if (!request_mem_region(dev->resource[0].start,
-				dev->resource[0].end
-				- dev->resource[0].start + 1, hcd_name)) {x+	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {x 		pr_debug("request_mem_region failed");
-		return -EBUSY;
+		retval = -EBUSY;
+		goto err1;
+	}
+
+	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+	if (!hcd->regs) {x+		pr_debug("ioremap failed");
+		retval = -ENOMEM;
+		goto err2;
 	}
 x 	pxa27x_start_hc(dev);
@@ -198,69 +210,18 @@
 	if (pxa27x_ohci_clear_port_power(3) < 0)
 		printk(KERN_ERR "Setting port 3 power failed.\n");
 x-	addr = ioremap(dev->resource[0].start,
-		       dev->resource[0].end - dev->resource[0].start + 1);
-	if (!addr) {x-		pr_debug("ioremap failed");
-		retval = -ENOMEM;
-		goto err1;
-	}
-x-	if(dev->resource[1].flags != IORESOURCE_IRQ){x-		pr_debug ("resource[1] is not IORESOURCE_IRQ");
-		retval = -ENOMEM;
-		goto err1;
-	}
-x-	hcd = usb_create_hcd (driver);
-	if (hcd == NULL){x-		pr_debug ("hcd_alloc failed");
-		retval = -ENOMEM;
-		goto err1;
-	}
 	ohci_hcd_init(hcd_to_ohci(hcd));
 x-	hcd->irq = dev->resource[1].start;
-	hcd->regs = addr;x-	hcd->self.controller = &dev->dev;
-x-	retval = hcd_buffer_create (hcd);
-	if (retval != 0) {x-		pr_debug ("pool alloc fail");
-		goto err2;
-	}
-x-	retval = request_irq (hcd->irq, usb_hcd_irq, SA_INTERRUPT,
-			      hcd->driver->description, hcd);
-	if (retval != 0) {x-		pr_debug("request_irq(%d) failed with retval %d\n",hcd->irq,retval);
-		retval = -EBUSY;
-		goto err3;
-	}
-x-	pr_debug ("%s (pxa27x) at 0x%p,xirq %d",
-		hcd->driver->description, hcd->regs, hcd->irq);
-x-	hcd->self.bus_name = "pxa27x";x-	usb_register_bus (&hcd->self);
-x-	if ((retval = driver->start (hcd)) < 0) {x-		usb_hcd_pxa27x_remove(hcd, dev);
+	retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT);
+	if (retval == 0)
 		return retval;x-	}
-x-	*hcd_out = hcd;x-	return 0;
 x- err3:x-	hcd_buffer_destroy (hcd);
+	pxa27x_stop_hc(dev);
+	iounmap(hcd->regs);x  err2:x-	usb_put_hcd(hcd);
+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x  err1:x-	pxa27x_stop_hc(dev);
-	release_mem_region(dev->resource[0].start,
-				dev->resource[0].end
-			   - dev->resource[0].start + 1);
+	usb_put_hcd(hcd);
 	return retval;x }x x@@ -280,27 +241,11 @@
  */x void usb_hcd_pxa27x_remove (struct usb_hcd *hcd, struct platform_device *dev)
x{x-	pr_debug ("remove: %s, state %x", hcd->self.bus_name, hcd->state);
-x-	if (in_interrupt ())x-		BUG ();
-x-	hcd->state = USB_STATE_QUIESCING;
-x-	pr_debug ("%s: roothub graceful disconnect", hcd->self.bus_name);
-	usb_disconnect (&hcd->self.root_hub);
-x-	hcd->driver->stop (hcd);
-	hcd->state = USB_STATE_HALT;
-x-	free_irq (hcd->irq, hcd);
-	hcd_buffer_destroy (hcd);
-x-	usb_deregister_bus (&hcd->self);
-
+	usb_remove_hcd(hcd);
 	pxa27x_stop_hc(dev);
-	release_mem_region(dev->resource[0].start,
-			   dev->resource[0].end - dev->resource[0].start + 1);
+	iounmap(hcd->regs);x+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x+	usb_put_hcd(hcd);
 }
 x /*-------------------------------------------------------------------------*/x@@ -336,7 +281,7 @@
 	 * generic hardware linkage
 	 */x 	.irq =			ohci_irq,
-	.flags =		HCD_USB11,
+	.flags =		HCD_USB11 | HCD_MEMORY,x x 	/*
 	 * basic lifecycle operationsx@@ -372,7 +317,6 @@
 static int ohci_hcd_pxa27x_drv_probe(struct device *dev)
x{x 	struct platform_device *pdev = to_platform_device(dev);
-	struct usb_hcd *hcd = NULL;
 	int ret;
 x 	pr_debug ("In ohci_hcd_pxa27x_drv_probe");
@@ -380,11 +324,7 @@
 	if (usb_disabled())
 		return -ENODEV;x x-	ret = usb_hcd_pxa27x_probe(&ohci_pxa27x_hc_driver, &hcd, pdev);
-x-	if (ret == 0)x-		dev_set_drvdata(dev, hcd);
-x+	ret = usb_hcd_pxa27x_probe(&ohci_pxa27x_hc_driver, pdev);
 	return ret;x }x x@@ -394,7 +334,6 @@
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 x 	usb_hcd_pxa27x_remove(hcd, pdev);
-	dev_set_drvdata(dev, NULL);
 	return 0;x }x 
diff -Nru a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
--- a/drivers/usb/host/ohci-q.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/usb/host/ohci-q.c	2005-03-07 20:49:00 -08:00
@@ -547,7 +547,8 @@
 	td->hwINFO = cpu_to_hc32 (ohci, info);
 	if (is_iso) {x 		td->hwCBP = cpu_to_hc32 (ohci, data & 0xFFFFF000);
-		td->hwPSW [0] = cpu_to_hc16 (ohci, (data & 0x0FFF) | 0xE000);
+		*ohci_hwPSWp(ohci, td, 0) = cpu_to_hc16 (ohci,
+						(data & 0x0FFF) | 0xE000);
 		td->ed->last_iso = info & 0xffff;x 	} else {x 		td->hwCBP = cpu_to_hc32 (ohci, data); 
@@ -719,10 +720,12 @@
 x 	/* ISO ... drivers see per-TD length/status */x   	if (tdINFO & TD_ISO) {x- 		u16	tdPSW = hc16_to_cpu (ohci, td->hwPSW [0]);x+ 		u16	tdPSW = ohci_hwPSW (ohci, td, 0);
 		int	dlen = 0;
 x-		/* NOTE:  assumes FC in tdINFO == 0 (and MAXPSW == 1) */x+		/* NOTE:  assumes FC in tdINFO == 0, and thatx+		 * only the first of 0..MAXPSW psws is used.x+		 */x 
  		cc = (tdPSW >> 12) & 0xF;x   		if (tdINFO & TD_CC)	/* hc didn't touch? */xdiff -Nru a/drivers/usb/host/ohci-sa1111.c b/drivers/usb/host/ohci-sa1111.c
--- a/drivers/usb/host/ohci-sa1111.c	2004-12-18 07:22:52 -08:00
+++ b/drivers/usb/host/ohci-sa1111.c	2005-03-07 20:42:53 -08:00
@@ -105,34 +105,8 @@
 }
 #endif
 x-static irqreturn_t usb_hcd_sa1111_hcim_irq (intxirq, void *__hcd, struct pt_regs * r)x-{x-	struct usb_hcd *hcd = __hcd;
-//	unsigned long status = sa1111_readl(hcd->regs + SA1111_USB_STATUS);
-x-	//dump_hci_status(hcd, "irq");
-x-#if 0x-	/* may work better this way -- need to investigate further */
-	if (status & USB_STATUS_NIRQHCIM) {x-		//dbg ("not normal HC interrupt; ignoring");
-		return;x-	}
-#endif
-x-	usb_hcd_irq(irq, hcd, r);
-x-	/*
-	 * SA1111 seems to re-assert its interrupt immediately
-	 * after processing an interrupt.  Always return IRQ_HANDLED.
-	 */x-	return IRQ_HANDLED;
-}
-x /*-------------------------------------------------------------------------*/x x-void usb_hcd_sa1111_remove (struct usb_hcd *, struct sa1111_dev *);
-x /* configure so an HC device and id are always provided */x /* always called with process context; sleeping is OK */x 
@@ -148,68 +122,35 @@
  * Store this function in the HCD's struct pci_driver as probe().
  */x intxusb_hcd_sa1111_probe (const struct hc_driver *driver,
-			  struct usb_hcd **hcd_out,x 			  struct sa1111_dev *dev)
x{x+	struct usb_hcd *hcd;
 	int retval;x-	struct usb_hcd *hcd = 0;
 x-	if (!request_mem_region(dev->res.start, 
-				dev->res.end - dev->res.start + 1, hcd_name)) {x-		dbg("request_mem_region failed");
-		return -EBUSY;
-	}
-x-	sa1111_start_hc(dev);
+	hcd = usb_create_hcd (driver, &dev->dev, "sa1111");
+	if (!hcd)
+		return -ENOMEM;
+	hcd->rsrc_start = dev->res.start;
+	hcd->rsrc_len = dev->res.end - dev->res.start + 1;
 x-	hcd = usb_create_hcd (driver);
-	if (hcd == NULL){x-		dbg ("hcd_alloc failed");
-		retval = -ENOMEM;
+	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {x+		dbg("request_mem_region failed");
+		retval = -EBUSY;
 		goto err1;
 	}
-	ohci_hcd_init(hcd_to_ohci(hcd));
-x-	hcd->irq = dev->irq[1];
 	hcd->regs = dev->mapbase;x-	hcd->self.controller = &dev->dev;
-x-	retval = hcd_buffer_create (hcd);
-	if (retval != 0) {x-		dbg ("pool alloc fail");
-		goto err2;
-	}
-x-	retval = request_irq (hcd->irq, usb_hcd_sa1111_hcim_irq, SA_INTERRUPT,
-			      hcd->driver->description, hcd);
-	if (retval != 0) {x-		dbg("request_irq failed");
-		retval = -EBUSY;
-		goto err3;
-	}
 x-	info ("%s (SA-1111) at 0x%p,xirq %d\n",
-		hcd->driver->description, hcd->regs, hcd->irq);
-x-	hcd->self.bus_name = "sa1111";x-	usb_register_bus (&hcd->self);
+	sa1111_start_hc(dev);
+	ohci_hcd_init(hcd_to_ohci(hcd));
 x-	if ((retval = driver->start (hcd)) < 0) x-	{x-		usb_hcd_sa1111_remove(hcd, dev);
+	retval = usb_add_hcd(hcd, dev->irq[1], SA_INTERRUPT);
+	if (retval == 0)
 		return retval;x-	}
 x-	*hcd_out = hcd;x-	return 0;
-x- err3:x-	hcd_buffer_destroy (hcd);
- err2:x-	usb_put_hcd(hcd);
- err1:x 	sa1111_stop_hc(dev);
-	release_mem_region(dev->res.start, dev->res.end - dev->res.start + 1);x+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x+ err1:x+	usb_put_hcd(hcd);
 	return retval;x }x x@@ -229,26 +170,10 @@
  */x void usb_hcd_sa1111_remove (struct usb_hcd *hcd, struct sa1111_dev *dev)
x{x-	info ("remove: %s, state %x", hcd->self.bus_name, hcd->state);
-x-	if (in_interrupt ())x-		BUG ();
-x-	hcd->state = USB_STATE_QUIESCING;
-x-	dbg ("%s: roothub graceful disconnect", hcd->self.bus_name);
-	usb_disconnect (&hcd->self.root_hub);
-x-	hcd->driver->stop (hcd);
-	hcd->state = USB_STATE_HALT;
-x-	free_irq (hcd->irq, hcd);
-	hcd_buffer_destroy (hcd);
-x-	usb_deregister_bus (&hcd->self);
-
+	usb_remove_hcd(hcd);
 	sa1111_stop_hc(dev);
-	release_mem_region(dev->res.start, dev->res.end - dev->res.start + 1);x+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);x+	usb_put_hcd(hcd);
 }
 x /*-------------------------------------------------------------------------*/x@@ -281,7 +206,7 @@
 	 * generic hardware linkage
 	 */x 	.irq =			ohci_irq,
-	.flags =		HCD_USB11,
+	.flags =		HCD_USB11 | HCD_MEMORY,x x 	/*
 	 * basic lifecycle operationsx@@ -294,11 +219,6 @@
 	.stop =			ohci_stop,x x 	/*
-	 * memory lifecycle (except per-request)
-	 */x-	.hcd_alloc =		ohci_hcd_alloc,
-x-	/*
 	 * managing i/o requests and associated device resourcesx 	 */x 	.urb_enqueue =		ohci_urb_enqueue,x@@ -325,17 +245,12 @@
 x static int ohci_hcd_sa1111_drv_probe(struct sa1111_dev *dev)
x{x-	struct usb_hcd *hcd = NULL;
 	int ret;
 x 	if (usb_disabled())
 		return -ENODEV;x x-	ret = usb_hcd_sa1111_probe(&ohci_sa1111_hc_driver, &hcd, dev);
-x-	if (ret == 0)x-		sa1111_set_drvdata(dev, hcd);
-x+	ret = usb_hcd_sa1111_probe(&ohci_sa1111_hc_driver, dev);
 	return ret;x }x x@@ -344,9 +259,6 @@
 	struct usb_hcd *hcd = sa1111_get_drvdata(dev);
 x 	usb_hcd_sa1111_remove(hcd, dev);
-x-	sa1111_set_drvdata(dev, NULL);
-
 	return 0;x }x 
diff -Nru a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
--- a/drivers/usb/host/ohci.h	2004-12-18 07:22:52 -08:00
+++ b/drivers/usb/host/ohci.h	2005-03-07 20:49:00 -08:00
@@ -111,8 +111,10 @@
   	__hc32		hwNextTD;	/* Next TD Pointer */x   	__hc32		hwBE;		/* Memory Buffer End Pointer */x x-	/* PSW is only for ISO */x-#define MAXPSW 1		/* hardware allows 8 */x+	/* PSW is only for ISO.  Only 1 PSW entry is used, butxon
+	 * big-endian PPC hardware that's the second entry.x+	 */x+#define MAXPSW	2x   	__hc16		hwPSW [MAXPSW];
 x 	/* rest are purely for the driver's use */x@@ -183,7 +185,7 @@
 	/* 
 	 * OHCI defines u16 frame_no, followed by u16 zero pad.
 	 * Since some processors can't do 16 bit bus accesses,
-	 * portable access must be a 32 bit byteswapped access.x+	 * portable access must be a 32 bits wide.x 	 */x 	__hc32	frame_no;		/* current frame number */x 	__hc32	done_head;		/* info returned for an interrupt */x@@ -191,8 +193,6 @@
 	u8	what [4];		/* spec only identifies 252 bytes :) */x } __attribute__ ((aligned(256)));
 x-#define ohci_frame_no(ohci) ((u16)hc32_to_cpup(ohci,&(ohci)->hcca->frame_no))x-  x /*x  * This is the structure of the OHCI controller's memory mapped I/O region.
  * You must use readl() and writel() (in <asm/io.h>) to access these fields!!
@@ -550,6 +550,44 @@
 static inline u32 hc32_to_cpup (const struct ohci_hcd *ohci, const __hc32 *x)
x{x 	return big_endian(ohci) ? be32_to_cpup((__force __be32 *)x) : le32_to_cpup((__force __le32 *)x);
+}x+x+/*-------------------------------------------------------------------------*/x+
+/* HCCA frame number is 16 bits, butxis accessed as 32 bits since not all
+ * hardware handles 16 bit reads.  That creates a different confusion on
+ * some big-endian SOC implementations.  Same thing happens with PSW access.x+ */x+
+#ifdef CONFIG_STB03xxx
+#define OHCI_BE_FRAME_NO_SHIFT	16x+#elsex+#define OHCI_BE_FRAME_NO_SHIFT	0
+#endif
+
+static inline u16 ohci_frame_no(const struct ohci_hcd *ohci)
+{x+	u32 tmp;
+	if (big_endian(ohci)) {x+		tmp = be32_to_cpup((__force __be32 *)&ohci->hcca->frame_no);x+		tmp >>= OHCI_BE_FRAME_NO_SHIFT;
+	} elsex+		tmp = le32_to_cpup((__force __le32 *)&ohci->hcca->frame_no);x+
+	return (u16)tmp;
+}
+
+static inline __hc16 *ohci_hwPSWp(const struct ohci_hcd *ohci,
+                                 const struct td *td, intxindex)
+{x+	return (__hc16 *)(big_endian(ohci) ?
+			&td->hwPSW[index ^ 1] : &td->hwPSW[index]);
+}
+
+static inline u16 ohci_hwPSW(const struct ohci_hcd *ohci,
+                               const struct td *td, intxindex)
+{x+	return hc16_to_cpup(ohci, ohci_hwPSWp(ohci, td, index));
 }
 x /*-------------------------------------------------------------------------*/xdiff -Nru a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
--- a/drivers/usb/host/sl811-hcd.c	2005-01-14 16:01:56 -08:00
+++ b/drivers/usb/host/sl811-hcd.c	2005-03-07 20:43:10 -08:00
@@ -90,8 +90,6 @@
 x /*-------------------------------------------------------------------------*/x x-static irqreturn_t sl811h_irq(intxirq, void *_hcd, struct pt_regs *regs);x-
 static void port_power(struct sl811 *sl811, intxis_on)
x{x 	struct usb_hcd	*hcd = sl811_to_hcd(sl811);
@@ -645,9 +643,8 @@
 	return irqstat;
 }
 x-static irqreturn_t sl811h_irq(intxirq, void *_hcd, struct pt_regs *regs)
+static irqreturn_t sl811h_irq(struct usb_hcd *hcd, struct pt_regs *regs)
x{x-	struct usb_hcd	*hcd = _hcd;
 	struct sl811	*sl811 = hcd_to_sl811(hcd);
 	u8		irqstat;
 	irqreturn_t	ret = IRQ_NONE;
@@ -666,7 +663,7 @@
 	/* this may no longer be necessary ... */x 	if (irqstat == 0 && ret == IRQ_NONE) {x 		irqstat = checkdone(sl811);
-		if (irqstat && irq != ~0)
+		if (irqstat /* && irq != ~0 */ )x 			sl811->stat_lost++;
 	}x #endif
@@ -760,7 +757,6 @@
 		if (sl811->port1 & (1 << USB_PORT_FEAT_ENABLE))
 			start_transfer(sl811);
 		ret = IRQ_HANDLED;
-		hcd->saw_irq = 1;
 		if (retries--)
 			goto retry;
 	}x@@ -1073,7 +1069,7 @@
 	 */x 	local_irq_save(flags);
 	if (!timer_pending(&sl811->timer)) {x-		if (sl811h_irq(~0, sl811, NULL) != IRQ_NONE)
+		if (sl811h_irq( /* ~0, */ hcd, NULL) != IRQ_NONE)
 			sl811->stat_lost++;
 	}x 	local_irq_restore(flags);
@@ -1592,7 +1588,12 @@
 	/*
 	 * generic hardware linkage
 	 */x-	.flags =		HCD_USB11,
+	.irq =			sl811h_irq,
+	.flags =		HCD_USB11 | HCD_MEMORY,x+
+	/* Basic lifecycle operations */x+	.start =		sl811h_start,x+	.stop =			sl811h_stop,x x 	/*
 	 * managing i/o requests and associated device resourcesx@@ -1620,23 +1621,15 @@
 static int __init_or_module
 sl811h_remove(struct device *dev)
x{x-	struct sl811		*sl811 = dev_get_drvdata(dev);
-	struct usb_hcd		*hcd = sl811_to_hcd(sl811);
+	struct usb_hcd		*hcd = dev_get_drvdata(dev);
+	struct sl811		*sl811 = hcd_to_sl811(hcd);
 	struct platform_device	*pdev;
 	struct resource		*res;x x 	pdev = container_of(dev, struct platform_device, dev);
 x-	if (HCD_IS_RUNNING(hcd->state))
-		hcd->state = USB_STATE_QUIESCING;
-x-	usb_disconnect(&hcd->self.root_hub);
 	remove_debug_file(sl811);
-	sl811h_stop(hcd);
-x-	usb_deregister_bus(&hcd->self);
-x-	free_irq(hcd->irq, hcd);
+	usb_remove_hcd(hcd);
 
 	iounmap(sl811->data_reg);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
@@ -1707,18 +1700,13 @@
 	}x 
 	/* allocate and initialize hcd */x-	hcd = usb_create_hcd(&sl811h_hc_driver);
+	hcd = usb_create_hcd(&sl811h_hc_driver, dev, dev->bus_id);
 	if (!hcd) {x-		retval = 0;
+		retval = -ENOMEM;
 		goto err5;
 	}x+	hcd->rsrc_start = addr->start;
 	sl811 = hcd_to_sl811(hcd);
-	dev_set_drvdata(dev, sl811);
-x-	hcd->self.controller = dev;
-	hcd->self.bus_name = dev->bus_id;x-	hcd->irq = irq;x-	hcd->regs = addr_reg;x x 	spin_lock_init(&sl811->lock);
 	INIT_LIST_HEAD(&sl811->async);
@@ -1754,28 +1742,13 @@
 	/* Cypress docs say the IRQxis IRQT_HIGH ... */x 	set_irq_type(irq, IRQT_RISING);
 #endif
-	retval = request_irq(irq, sl811h_irq, SA_INTERRUPT,
-			hcd->driver->description, hcd);
+	retval = usb_add_hcd(hcd, irq, SA_INTERRUPT);
 	if (retval != 0)
 		goto err6;
 x-	INFO("%s,xirq %d\n", hcd->product_desc,xirq);
-x-	retval = usb_register_bus(&hcd->self);
-	if (retval < 0)
-		goto err7;
-x-	retval = sl811h_start(hcd);
-	if (retval < 0)
-		goto err8;x-x 	create_debug_file(sl811);
-	return 0;x+	return retval;x 
- err8:x-	usb_deregister_bus(&hcd->self);
- err7:x-	free_irq(hcd->irq, hcd);
  err6:
 	usb_put_hcd(hcd);
  err5:x@@ -1801,14 +1774,15 @@
 static int
 sl811h_suspend(struct device *dev, u32 state, u32 phase)
x{x-	struct sl811	*sl811 = dev_get_drvdata(dev);
+	struct usb_hcd	*hcd = dev_get_drvdata(dev);
+	struct sl811	*sl811 = hcd_to_sl811(hcd);
 	int		retval = 0;
 x 	if (phase != SUSPEND_POWER_DOWN)
 		return retval;x x 	if (state <= PM_SUSPEND_MEM)x-		retval = sl811h_hub_suspend(sl811_to_hcd(sl811));
+		retval = sl811h_hub_suspend(hcd);
 	elsex 		port_power(sl811, 0);
 	if (retval == 0)x@@ -1819,7 +1793,8 @@
 static int
 sl811h_resume(struct device *dev, u32 phase)
x{x-	struct sl811	*sl811 = dev_get_drvdata(dev);
+	struct usb_hcd	*hcd = dev_get_drvdata(dev);
+	struct sl811	*sl811 = hcd_to_sl811(hcd);
 x 	if (phase != RESUME_POWER_ON)
 		return 0;
@@ -1828,14 +1803,14 @@
 	 * let's assume it'd only be powered to enable remote wakeup.
 	 */x 	if (dev->power.power_state > PM_SUSPEND_MEM
-			|| !sl811_to_hcd(sl811)->can_wakeup) {x+			|| !hcd->can_wakeup) {x 		sl811->port1 = 0;
 		port_power(sl811, 1);
 		return 0;x 	}x x 	dev->power.power_state = PM_SUSPEND_ON;
-	return sl811h_hub_resume(sl811_to_hcd(sl811));
+	return sl811h_hub_resume(hcd);
 }
 x #elsexdiff -Nru a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c
--- a/drivers/usb/host/uhci-debug.c	2005-01-14 16:02:02 -08:00
+++ b/drivers/usb/host/uhci-debug.c	2005-03-07 20:48:52 -08:00
@@ -17,6 +17,8 @@
 x #include "uhci-hcd.h"
 
+static struct dentry *uhci_debugfs_root = NULL;
+x /* Handle REALLY large printk's so we don't overflow buffers */x static inline void lprintk(char *buf)
x{x@@ -497,8 +499,6 @@
 x #define MAX_OUTPUT	(64 * 1024)
 x-static struct dentry *uhci_debugfs_root = NULL;
-
 struct uhci_debugx{x 	int size;x 	char *data;x@@ -579,4 +579,9 @@
 	.read =		uhci_debug_read,
 	.release =	uhci_debug_release,
 };x+x+#else	/* CONFIG_DEBUG_FS */x+
+#define uhci_debug_operations (* (struct file_operations *) NULL)
+x #endif
diff -Nru a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
--- a/drivers/usb/host/uhci-hcd.c	2005-01-14 16:02:02 -08:00
+++ b/drivers/usb/host/uhci-hcd.c	2005-03-07 20:43:34 -08:00
@@ -87,19 +87,9 @@
 static char *errbuf;x #define ERRBUF_LEN    (32 * 1024)
 x-#include "uhci-hub.c"x-#include "uhci-debug.c"x-
 static kmem_cache_t *uhci_up_cachep;	/* urb_priv */x 
 static unsigned intxuhci_get_current_frame_number(struct uhci_hcd *uhci);x-static int uhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb);x-static void uhci_unlink_generic(struct uhci_hcd *uhci, struct urb *urb);x-static void uhci_remove_pending_urbps(struct uhci_hcd *uhci);x-static void uhci_finish_completion(struct usb_hcd *hcd, struct pt_regs *regs);x-static void uhci_free_pending_qhs(struct uhci_hcd *uhci);x-static void uhci_free_pending_tds(struct uhci_hcd *uhci);x-
 static void hc_state_transitions(struct uhci_hcd *uhci);x x /* If a transferxis still active after this much time, turn off FSBR */x@@ -111,1424 +101,9 @@
 /* to make sure it doesn't hog all of the bandwidth */x #define DEPTH_INTERVAL 5
 x-/*
- * Technically, updating td->status here is a race, butxit's not really a
- * problem. The worst that can happen is that we set the IOC bit again
- * generating a spurious interrupt. We could fix this by creating another
- * QH and leaving the IOC bit always set, butxthen we would have to play
- * games with the FSBR code to make sure we get the correct order in all
- * the cases. I don't thinkxit's worth the effortx- */x-static inline void uhci_set_next_interrupt(struct uhci_hcd *uhci)x-{x-	uhci->term_td->status |= cpu_to_le32(TD_CTRL_IOC); 
-}
-x-static inline void uhci_clear_next_interrupt(struct uhci_hcd *uhci)x-{x-	uhci->term_td->status &= ~cpu_to_le32(TD_CTRL_IOC);
-}
-x-static inline void uhci_moveto_complete(struct uhci_hcd *uhci, 
-					struct urb_priv *urbp)x-{x-	list_move_tail(&urbp->urb_list, &uhci->complete_list);
-}
-x-static struct uhci_td *uhci_alloc_td(struct uhci_hcd *uhci, struct usb_device *dev)
-{x-	dma_addr_t dma_handle;
-	struct uhci_td *td;
-x-	td = dma_pool_alloc(uhci->td_pool, GFP_ATOMIC, &dma_handle);
-	if (!td)
-		return NULL;
-
-	td->dma_handle = dma_handle;
-
-	td->link = UHCI_PTR_TERM;
-	td->buffer = 0;
-
-	td->frame = -1;
-	td->dev = dev;
-x-	INIT_LIST_HEAD(&td->list);
-	INIT_LIST_HEAD(&td->remove_list);
-	INIT_LIST_HEAD(&td->fl_list);
-x-	usb_get_dev(dev);
-
-	return td;
-}
-x-static inline void uhci_fill_td(struct uhci_td *td, u32 status,
-		u32 token, u32 buffer)
-{x-	td->status = cpu_to_le32(status);
-	td->token = cpu_to_le32(token);
-	td->buffer = cpu_to_le32(buffer);
-}
-x-/*
- * We insert Isochronous URB's directly into the frame list at the beginning
- */x-static void uhci_insert_td_frame_list(struct uhci_hcd *uhci, struct uhci_td *td, unsigned framenum)
-{x-	framenum &= (UHCI_NUMFRAMES - 1);
-x-	td->frame = framenum;
-x-	/* Is there a TD already mapped there? */
-	if (uhci->fl->frame_cpu[framenum]) {x-		struct uhci_td *ftd, *ltd;
-x-		ftd = uhci->fl->frame_cpu[framenum];
-		ltd = list_entry(ftd->fl_list.prev, struct uhci_td, fl_list);
-x-		list_add_tail(&td->fl_list, &ftd->fl_list);
-x-		td->link = ltd->link;
-		wmb();
-		ltd->link = cpu_to_le32(td->dma_handle);
-	} else {x-		td->link = uhci->fl->frame[framenum];
-		wmb();
-		uhci->fl->frame[framenum] = cpu_to_le32(td->dma_handle);
-		uhci->fl->frame_cpu[framenum] = td;
-	}
-}
-x-static void uhci_remove_td(struct uhci_hcd *uhci, struct uhci_td *td)
-{x-	/* If it's not inserted, don't remove it */
-	if (td->frame == -1 && list_empty(&td->fl_list))
-		return;x-
-	if (td->frame != -1 && uhci->fl->frame_cpu[td->frame] == td) {x-		if (list_empty(&td->fl_list)) {x-			uhci->fl->frame[td->frame] = td->link;
-			uhci->fl->frame_cpu[td->frame] = NULL;
-		} else {x-			struct uhci_td *ntd;
-x-			ntd = list_entry(td->fl_list.next, struct uhci_td, fl_list);
-			uhci->fl->frame[td->frame] = cpu_to_le32(ntd->dma_handle);
-			uhci->fl->frame_cpu[td->frame] = ntd;
-		}
-	} else {x-		struct uhci_td *ptd;
-x-		ptd = list_entry(td->fl_list.prev, struct uhci_td, fl_list);
-		ptd->link = td->link;
-	}
-x-	wmb();
-	td->link = UHCI_PTR_TERM;
-x-	list_del_init(&td->fl_list);
-	td->frame = -1;
-}
-x-/*
- * Inserts a td list into qh.
- */x-static void uhci_insert_tds_in_qh(struct uhci_qh *qh, struct urb *urb, __le32 breadth)x-{x-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-	struct uhci_td *td;
-	__le32 *plink;
-x-	/* Ordering isn't important here yet since the QH hasn't been */
-	/* inserted into the schedule yet */
-	plink = &qh->element;x-	list_for_each_entry(td, &urbp->td_list, list) {x-		*plink = cpu_to_le32(td->dma_handle) | breadth;
-		plink = &td->link;
-	}
-	*plink = UHCI_PTR_TERM;
-}
-x-static void uhci_free_td(struct uhci_hcd *uhci, struct uhci_td *td)
-{x-	if (!list_empty(&td->list))
-		dev_warn(uhci_dev(uhci), "td %p still in list!\n", td);
-	if (!list_empty(&td->remove_list))
-		dev_warn(uhci_dev(uhci), "td %p still in remove_list!\n", td);
-	if (!list_empty(&td->fl_list))
-		dev_warn(uhci_dev(uhci), "td %p still in fl_list!\n", td);
-
-	if (td->dev)
-		usb_put_dev(td->dev);
-x-	dma_pool_free(uhci->td_pool, td, td->dma_handle);
-}
-x-static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd *uhci, struct usb_device *dev)
-{x-	dma_addr_t dma_handle;
-	struct uhci_qh *qh;
-x-	qh = dma_pool_alloc(uhci->qh_pool, GFP_ATOMIC, &dma_handle);
-	if (!qh)
-		return NULL;
-
-	qh->dma_handle = dma_handle;
-
-	qh->element = UHCI_PTR_TERM;
-	qh->link = UHCI_PTR_TERM;
-x-	qh->dev = dev;
-	qh->urbp = NULL;
-
-	INIT_LIST_HEAD(&qh->list);
-	INIT_LIST_HEAD(&qh->remove_list);
-x-	usb_get_dev(dev);
-
-	return qh;
-}
-x-static void uhci_free_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
-{x-	if (!list_empty(&qh->list))
-		dev_warn(uhci_dev(uhci), "qh %p list not empty!\n", qh);x-	if (!list_empty(&qh->remove_list))
-		dev_warn(uhci_dev(uhci), "qh %p still in remove_list!\n", qh);x-x-	if (qh->dev)
-		usb_put_dev(qh->dev);
-x-	dma_pool_free(uhci->qh_pool, qh, qh->dma_handle);
-}
-x-/*
- * Append this urb's qh after the last qh in skelqh->list
- *
- * Note that urb_priv.queue_list doesn't have a separate queue head;
- * it's a ring with every element "live".
- */x-static void uhci_insert_qh(struct uhci_hcd *uhci, struct uhci_qh *skelqh, struct urb *urb)x-{x-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-	struct urb_priv *turbp;
-	struct uhci_qh *lqh;
-x-	/* Grab the last QH */
-	lqh = list_entry(skelqh->list.prev, struct uhci_qh, list);
-x-	/* Point to the next skelqh */
-	urbp->qh->link = lqh->link;x-	wmb();				/* Ordering is important */
-x-	/*
-	 * Patch QHs for previous endpoint's queued URBs?  HC goes
-	 * here next, not to the next skelqh it now points to.
-	 *
-	 *    lqh --> td ... --> qh ... --> td --> qh ... --> td
-	 *     |                 |                 |
-	 *     v                 v                 v
-	 *     +<----------------+-----------------+
-	 *     v
-	 *    newqh --> td ... --> td
-	 *     |
-	 *     v
-	 *    ...
-	 *
-	 * The HC could see (and use!) any of these as we write them.
-	 */x-	lqh->link = cpu_to_le32(urbp->qh->dma_handle) | UHCI_PTR_QH;x-	if (lqh->urbp) {x-		list_for_each_entry(turbp, &lqh->urbp->queue_list, queue_list)
-			turbp->qh->link = lqh->link;x-	}
-x-	list_add_tail(&urbp->qh->list, &skelqh->list);
-}
-x-/*
- * Start removal of QH from schedule; it finishes next frame.
- * TDs should be unlinked before this is called.
- */x-static void uhci_remove_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)
-{x-	struct uhci_qh *pqh;
-	__le32 newlink;x-	unsigned intxage;x-x-	if (!qh)
-		return;
-x-	/*
-	 * Only go through the hoops if it's actually linked in
-	 */
-	if (!list_empty(&qh->list)) {x-x-		/* If our queue is nonempty, make the next URB the head */
-		if (!list_empty(&qh->urbp->queue_list)) {x-			struct urb_priv *nurbp;
-x-			nurbp = list_entry(qh->urbp->queue_list.next,
-					struct urb_priv, queue_list);x-			nurbp->queued = 0;
-			list_add(&nurbp->qh->list, &qh->list);
-			newlink = cpu_to_le32(nurbp->qh->dma_handle) | UHCI_PTR_QH;x-		} elsex-			newlink = qh->link;x-x-		/* Fix up the previous QH's queue to link to either
-		 * the new head of this queue or the start of the
-		 * next endpoint's queue. */
-		pqh = list_entry(qh->list.prev, struct uhci_qh, list);
-		pqh->link = newlink;x-		if (pqh->urbp) {x-			struct urb_priv *turbp;
-
-			list_for_each_entry(turbp, &pqh->urbp->queue_list,
-					queue_list)
-				turbp->qh->link = newlink;x-		}
-		wmb();
-x-		/* Leave qh->link in case the HC is on the QH now, it will */
-		/* continue the rest of the schedule */
-		qh->element = UHCI_PTR_TERM;
-x-		list_del_init(&qh->list);
-	}
-x-	list_del_init(&qh->urbp->queue_list);
-	qh->urbp = NULL;
-
-	age = uhci_get_current_frame_number(uhci);x-	if (age != uhci->qh_remove_age) {x-		uhci_free_pending_qhs(uhci);x-		uhci->qh_remove_age = age;x-	}
-x-	/* Check to see if the remove list is empty. Set the IOC bit */
-	/* to force an interrupt so we can remove the QH */
-	if (list_empty(&uhci->qh_remove_list))
-		uhci_set_next_interrupt(uhci);x-
-	list_add(&qh->remove_list, &uhci->qh_remove_list);
-}
-x-static int uhci_fixup_toggle(struct urb *urb, unsigned intxtoggle)x-{x-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-	struct uhci_td *td;
-x-	list_for_each_entry(td, &urbp->td_list, list) {x-		if (toggle)x-			td->token |= cpu_to_le32(TD_TOKEN_TOGGLE);x-		elsex-			td->token &= ~cpu_to_le32(TD_TOKEN_TOGGLE);x-x-		toggle ^= 1;
-	}
-x-	return toggle;
-}
-x-/* This function will append one URB's QH to another URB's QH. This is for */
-/* queuing interrupt, control or bulk transfers */x-static void uhci_append_queued_urb(struct uhci_hcd *uhci, struct urb *eurb, struct urb *urb)x-{x-	struct urb_priv *eurbp, *urbp, *furbp, *lurbp;
-	struct uhci_td *lltd;
-x-	eurbp = eurb->hcpriv;
-	urbp = urb->hcpriv;
-
-	/* Find the first URB in the queue */
-	furbp = eurbp;x-	if (eurbp->queued) {x-		list_for_each_entry(furbp, &eurbp->queue_list, queue_list)
-			if (!furbp->queued)
-				break;x-	}
-x-	lurbp = list_entry(furbp->queue_list.prev, struct urb_priv, queue_list);x-x-	lltd = list_entry(lurbp->td_list.prev, struct uhci_td, list);
-x-	/* Control transfers always start with toggle 0 */
-	if (!usb_pipecontrol(urb->pipe))
-		usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe),
-				usb_pipeout(urb->pipe),
-				uhci_fixup_toggle(urb,
-					uhci_toggle(td_token(lltd)) ^ 1));
-x-	/* All qh's in the queue need to link to the next queue */
-	urbp->qh->link = eurbp->qh->link;
-x-	wmb();			/* Make sure we flush everything */
-x-	lltd->link = cpu_to_le32(urbp->qh->dma_handle) | UHCI_PTR_QH;x-x-	list_add_tail(&urbp->queue_list, &furbp->queue_list);
-
-	urbp->queued = 1;
-}
-x-static void uhci_delete_queued_urb(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct urb_priv *urbp, *nurbp, *purbp, *turbp;
-	struct uhci_td *pltd;
-	unsigned intxtoggle;
-
-	urbp = urb->hcpriv;
-
-	if (list_empty(&urbp->queue_list))
-		return;
-x-	nurbp = list_entry(urbp->queue_list.next, struct urb_priv, queue_list);x-x-	/*
-	 * Fix up the toggle for the following URBs in the queue.
-	 * Only needed for bulk and interrupt: control and isochronous
-	 * endpoints don't propagate toggles between messages.
-	 */
-	if (usb_pipebulk(urb->pipe) || usb_pipeint(urb->pipe)) {x-		if (!urbp->queued)
-			/* We just set the toggle in uhci_unlink_generic */
-			toggle = usb_gettoggle(urb->dev,
-					usb_pipeendpoint(urb->pipe),
-					usb_pipeout(urb->pipe));x-		else {x-			/* If we're in the middle of the queue, grab the */
-			/* toggle from the TD previous to us */x-			purbp = list_entry(urbp->queue_list.prev,
-					struct urb_priv, queue_list);x-			pltd = list_entry(purbp->td_list.prev,
-					struct uhci_td, list);
-			toggle = uhci_toggle(td_token(pltd)) ^ 1;x-		}
-x-		list_for_each_entry(turbp, &urbp->queue_list, queue_list) {x-			if (!turbp->queued)
-				break;x-			toggle = uhci_fixup_toggle(turbp->urb,xtoggle);x-		}
-x-		usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe),
-				usb_pipeout(urb->pipe),xtoggle);x-	}
-
-	if (urbp->queued) {x-		/* We're somewhere in the middle (or end).  The case where
-		 * we're at the head is handled in uhci_remove_qh(). */
-		purbp = list_entry(urbp->queue_list.prev, struct urb_priv,
-				queue_list);x-x-		pltd = list_entry(purbp->td_list.prev, struct uhci_td, list);
-		if (nurbp->queued)
-			pltd->link = cpu_to_le32(nurbp->qh->dma_handle) | UHCI_PTR_QH;x-		elsex-			/* The next URB happens to be the beginning, so */
-			/*  we're the last, end the chain */x-			pltd->link = UHCI_PTR_TERM;
-	}
-x-	/* urbp->queue_list is handled in uhci_remove_qh() */x-}
-x-static struct urb_priv *uhci_alloc_urb_priv(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct urb_priv *urbp;
-
-	urbp = kmem_cache_alloc(uhci_up_cachep, SLAB_ATOMIC);x-	if (!urbp)x-		return NULL;
-
-	memset((void *)urbp, 0, sizeof(*urbp));
-
-	urbp->inserttime = jiffies;
-	urbp->fsbrtime = jiffies;
-	urbp->urb = urb;
-	
-	INIT_LIST_HEAD(&urbp->td_list);
-	INIT_LIST_HEAD(&urbp->queue_list);
-	INIT_LIST_HEAD(&urbp->urb_list);x-x-	list_add_tail(&urbp->urb_list, &uhci->urb_list);x-x-	urb->hcpriv = urbp;
-
-	return urbp;
-}
-x-static void uhci_add_td_to_urb(struct urb *urb, struct uhci_td *td)
-{x-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-
-	td->urb = urb;
-x-	list_add_tail(&td->list, &urbp->td_list);
-}
-x-static void uhci_remove_td_from_urb(struct uhci_td *td)
-{x-	if (list_empty(&td->list))
-		return;
-x-	list_del_init(&td->list);x-x-	td->urb = NULL;
-}
-x-static void uhci_destroy_urb_priv(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct uhci_td *td, *tmp;
-	struct urb_priv *urbp;
-	unsigned intxage;x-x-	urbp = (struct urb_priv *)urb->hcpriv;
-	if (!urbp)x-		return;x-x-	if (!list_empty(&urbp->urb_list))
-		dev_warn(uhci_dev(uhci), "urb %p still on uhci->urb_list "
-				"or uhci->remove_list!\n", urb);x-
-	age = uhci_get_current_frame_number(uhci);x-	if (age != uhci->td_remove_age) {x-		uhci_free_pending_tds(uhci);x-		uhci->td_remove_age = age;x-	}
-x-	/* Check to see if the remove list is empty. Set the IOC bit */
-	/* to force an interrupt so we can remove the TD's*/
-	if (list_empty(&uhci->td_remove_list))
-		uhci_set_next_interrupt(uhci);x-
-	list_for_each_entry_safe(td, tmp, &urbp->td_list, list) {x-		uhci_remove_td_from_urb(td);
-		uhci_remove_td(uhci, td);
-		list_add(&td->remove_list, &uhci->td_remove_list);x-	}
-x-	urb->hcpriv = NULL;
-	kmem_cache_free(uhci_up_cachep, urbp);
-}
-x-static void uhci_inc_fsbr(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-
-	if ((!(urb->transfer_flags & URB_NO_FSBR)) && !urbp->fsbr) {x-		urbp->fsbr = 1;
-		if (!uhci->fsbr++ && !uhci->fsbrtimeout)
-			uhci->skel_term_qh->link = cpu_to_le32(uhci->skel_fs_control_qh->dma_handle) | UHCI_PTR_QH;x-	}
-}
-x-static void uhci_dec_fsbr(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-
-	if ((!(urb->transfer_flags & URB_NO_FSBR)) && urbp->fsbr) {x-		urbp->fsbr = 0;
-		if (!--uhci->fsbr)
-			uhci->fsbrtimeout = jiffies + FSBR_DELAY;x-	}
-}
-x-/*
- * Map status to standard result codes
- *
- * <status> is (td_status(td) & 0xF60000), a.k.a.
- * uhci_status_bits(td_status(td)).
- * Note: <status> does not include the TD_CTRL_NAK bit.
- * <dir_out> is True for output TDs and False for input TDs.x- */x-static int uhci_map_status(int status, int dir_out)
-{x-	if (!status)x-		return 0;
-	if (status & TD_CTRL_BITSTUFF)			/* Bitstuff error */
-		return -EPROTO;
-	if (status & TD_CTRL_CRCTIMEO) {		/* CRC/Timeout */
-		if (dir_out)
-			return -EPROTO;
-		elsex-			return -EILSEQ;
-	}
-	if (status & TD_CTRL_BABBLE)			/* Babble */
-		return -EOVERFLOW;
-	if (status & TD_CTRL_DBUFERR)			/* Buffer error */
-		return -ENOSR;
-	if (status & TD_CTRL_STALLED)			/* Stalled */
-		return -EPIPE;
-	WARN_ON(status & TD_CTRL_ACTIVE);		/* Active */x-	return 0;
-}
-x-/*
- * Control transfersx- */x-static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb)x-{x-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-	struct uhci_td *td;
-	struct uhci_qh *qh, *skelqh;
-	unsigned long destination, status;
-	int maxsze = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe));x-	int len = urb->transfer_buffer_length;x-	dma_addr_t data = urb->transfer_dma;
-x-	/* The "pipe" thing contains the destination in bits 8--18 */x-	destination = (urb->pipe & PIPE_DEVEP_MASK) | USB_PID_SETUP;
-x-	/* 3 errors */x-	status = TD_CTRL_ACTIVE | uhci_maxerr(3);x-	if (urb->dev->speed == USB_SPEED_LOW)x-		status |= TD_CTRL_LS;x-x-	/*
-	 * Build the TD for the control request setup packet
-	 */
-	td = uhci_alloc_td(uhci, urb->dev);
-	if (!td)
-		return -ENOMEM;
-x-	uhci_add_td_to_urb(urb,xtd);
-	uhci_fill_td(td, status, destination | uhci_explen(7),
-		urb->setup_dma);x-x-	/*
-	 * If direction is "send", change the packet ID from SETUP (0x2D)
-	 * to OUT (0xE1).  Else change it from SETUP to IN (0x69) and
-	 * set Short Packet Detect (SPD) for all data packets.
-	 */
-	if (usb_pipeout(urb->pipe))
-		destination ^= (USB_PID_SETUP ^ USB_PID_OUT);
-	else {x-		destination ^= (USB_PID_SETUP ^ USB_PID_IN);
-		status |= TD_CTRL_SPD;x-	}
-x-	/*
-	 * Build the DATA TD's
-	 */
-	while (len > 0) {x-		int pktsze = len;x-x-		if (pktsze > maxsze)
-			pktsze = maxsze;
-x-		td = uhci_alloc_td(uhci, urb->dev);
-		if (!td)
-			return -ENOMEM;
-x-		/* Alternate Data0/1 (start with Data1) */x-		destination ^= TD_TOKEN_TOGGLE;
-	
-		uhci_add_td_to_urb(urb,xtd);
-		uhci_fill_td(td, status, destination | uhci_explen(pktsze - 1),
-			data);
-x-		data += pktsze;
-		len -= pktsze;
-	}
-x-	/*
-	 * Build the final TD for control status 
-	 */
-	td = uhci_alloc_td(uhci, urb->dev);
-	if (!td)
-		return -ENOMEM;
-x-	/*
-	 * It's IN if the pipe is an output pipe or we're not expecting
-	 * data back.
-	 */
-	destination &= ~TD_TOKEN_PID_MASK;
-	if (usb_pipeout(urb->pipe) || !urb->transfer_buffer_length)
-		destination |= USB_PID_IN;
-	else
-		destination |= USB_PID_OUT;
-x-	destination |= TD_TOKEN_TOGGLE;		/* End in Data1 */
-x-	status &= ~TD_CTRL_SPD;x-x-	uhci_add_td_to_urb(urb,xtd);
-	uhci_fill_td(td, status | TD_CTRL_IOC,
-		destination | uhci_explen(UHCI_NULL_DATA_SIZE), 0);
-x-	qh = uhci_alloc_qh(uhci, urb->dev);
-	if (!qh)
-		return -ENOMEM;
-x-	urbp->qh = qh;
-	qh->urbp = urbp;
-
-	uhci_insert_tds_in_qh(qh, urb,xUHCI_PTR_BREADTH);
-x-	/* Low-speed transfers get a different queue, and won't hog the bus.
-	 * Also, some devices enumerate better without FSBR; the easiest way
-	 * to do that is to put URBs on the low-speed queue while the device
-	 * is in the DEFAULT state. */
-	if (urb->dev->speed == USB_SPEED_LOW ||
-			urb->dev->state == USB_STATE_DEFAULT)x-		skelqh = uhci->skel_ls_control_qh;
-	else {x-		skelqh = uhci->skel_fs_control_qh;
-		uhci_inc_fsbr(uhci, urb);x-	}
-
-	if (eurb)x-		uhci_append_queued_urb(uhci, eurb, urb);x-	else
-		uhci_insert_qh(uhci, skelqh, urb);x-
-	return -EINPROGRESS;
-}
-x-/*
- * If control-IN transferxwas short, the status packet wasn't sent.
- * This routine changes the element pointer in the QH to point at the
- * status TD.  It's safe to do this even while the QH is live, because
- * the hardware only updates the element pointer following a successful
- * transfer.  The inactive TD for the short packet won't cause an update,
- * so the pointer won't get overwritten.  The next time the controller
- * sees this QH, it will send the status packet.x- */x-static int usb_control_retrigger_status(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-	struct uhci_td *td;
-x-	urbp->short_control_packet = 1;
-
-	td = list_entry(urbp->td_list.prev, struct uhci_td, list);
-	urbp->qh->element = cpu_to_le32(td->dma_handle);
-
-	return -EINPROGRESS;
-}
-x-x-static int uhci_result_control(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct list_head *tmp, *head;
-	struct urb_priv *urbp = urb->hcpriv;
-	struct uhci_td *td;
-	unsigned intxstatus;
-	int ret = 0;
-
-	if (list_empty(&urbp->td_list))
-		return -EINVAL;
-
-	head = &urbp->td_list;
-
-	if (urbp->short_control_packet) {x-		tmp = head->prev;
-		goto status_stage;x-	}
-x-	tmp = head->next;
-	td = list_entry(tmp, struct uhci_td, list);
-x-	/* The first TD is the SETUP stage, check the status, butxskip */
-	/*  the count */
-	status = uhci_status_bits(td_status(td));
-	if (status & TD_CTRL_ACTIVE)
-		return -EINPROGRESS;
-
-	if (status)
-		goto td_error;x-x-	urb->actual_length = 0;
-
-	/* The rest of the TD's (butxthe last) are data */
-	tmp = tmp->next;
-	while (tmp != head && tmp->next != head) {x-		unsigned intxctrlstat;
-x-		td = list_entry(tmp, struct uhci_td, list);
-		tmp = tmp->next;
-
-		ctrlstat = td_status(td);
-		status = uhci_status_bits(ctrlstat);
-		if (status & TD_CTRL_ACTIVE)
-			return -EINPROGRESS;
-
-		urb->actual_length += uhci_actual_length(ctrlstat);
-
-		if (status)
-			goto td_error;x-x-		/* Check to see if we received a short packet */
-		if (uhci_actual_length(ctrlstat) <
-				uhci_expected_length(td_token(td))) {x-			if (urb->transfer_flags & URB_SHORT_NOT_OK) {x-				ret = -EREMOTEIO;
-				goto err;
-			}
-x-			if (uhci_packetid(td_token(td)) == USB_PID_IN)x-				return usb_control_retrigger_status(uhci, urb);x-			elsex-				return 0;
-		}
-	}x-x-status_stage:
-	td = list_entry(tmp, struct uhci_td, list);
-x-	/* Control status stage */
-	status = td_status(td);
-x-#ifdef I_HAVE_BUGGY_APC_BACKUPSx-	/* APC BackUPS Pro kludge */
-	/* Itxtries to send all of the descriptor instead of the amount */
-	/*  we requested */
-	if (status & TD_CTRL_IOC &&	/* IOC is masked out by uhci_status_bits */
-	    status & TD_CTRL_ACTIVE &&
-	    status & TD_CTRL_NAK)x-		return 0;
-#endif
-
-	status = uhci_status_bits(status);
-	if (status & TD_CTRL_ACTIVE)
-		return -EINPROGRESS;
-
-	if (status)
-		goto td_error;x-x-	return 0;
-x-td_error:x-	ret = uhci_map_status(status, uhci_packetout(td_token(td)));
-x-err:
-	if ((debugx== 1 && ret != -EPIPE) || debugx> 1) {x-		/* Some debugging code */x-		dev_dbg(uhci_dev(uhci), "%s: failed with status %x\n",x-				__FUNCTION__, status);
-
-		if (errbuf) {x-			/* Printxthe chain for debugging purposes */x-			uhci_show_qh(urbp->qh, errbuf, ERRBUF_LEN, 0);
-x-			lprintk(errbuf);
-		}
-	}x-x-	return ret;x-}
-x-/*
- * Common submit for bulk and interruptx- */x-static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb, struct uhci_qh *skelqh)x-{x-	struct uhci_td *td;
-	struct uhci_qh *qh;
-	unsigned long destination, status;
-	int maxsze = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe));x-	int len = urb->transfer_buffer_length;x-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-	dma_addr_t data = urb->transfer_dma;
-x-	if (len < 0)
-		return -EINVAL;
-
-	/* The "pipe" thing contains the destination in bits 8--18 */x-	destination = (urb->pipe & PIPE_DEVEP_MASK) | usb_packetid(urb->pipe);
-
-	status = uhci_maxerr(3) | TD_CTRL_ACTIVE;x-	if (urb->dev->speed == USB_SPEED_LOW)x-		status |= TD_CTRL_LS;x-	if (usb_pipein(urb->pipe))
-		status |= TD_CTRL_SPD;x-x-	/*
-	 * Build the DATA TD's
-	 */
-	do {	/* Allow zero length packets */
-		int pktsze = maxsze;
-x-		if (pktsze >= len) {x-			pktsze = len;x-			if (!(urb->transfer_flags & URB_SHORT_NOT_OK))x-				status &= ~TD_CTRL_SPD;x-		}
-x-		td = uhci_alloc_td(uhci, urb->dev);
-		if (!td)
-			return -ENOMEM;
-x-		uhci_add_td_to_urb(urb,xtd);
-		uhci_fill_td(td, status, destination | uhci_explen(pktsze - 1) |
-			(usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),
-			 usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT),
-			data);
-x-		data += pktsze;
-		len -= maxsze;
-x-		usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe),
-			usb_pipeout(urb->pipe));x-	} while (len > 0);x-x-	/*
-	 * URB_ZERO_PACKET means adding a 0-length packet, if direction
-	 * is OUT and the transfer_length was an exact multiple of maxsze,
-	 * hence (len = transfer_length - N * maxsze) == 0
-	 * however, if transfer_length == 0, the zero packet was already
-	 * prepared above.
-	 */
-	if (usb_pipeout(urb->pipe) && (urb->transfer_flags & URB_ZERO_PACKET) &&
-	    !len && urb->transfer_buffer_length) {x-		td = uhci_alloc_td(uhci, urb->dev);
-		if (!td)
-			return -ENOMEM;
-x-		uhci_add_td_to_urb(urb,xtd);
-		uhci_fill_td(td, status, destination | uhci_explen(UHCI_NULL_DATA_SIZE) |
-			(usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),
-			 usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT),
-			data);
-x-		usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe),
-			usb_pipeout(urb->pipe));x-	}
-
-	/* Set the interrupt-on-completion flag on the last packet.x-	 * A more-or-less typical 4 KB URB (= size of one memory page)x-	 * will require about 3 ms to transfer; that's a little on the
-	 * fast side butxnot enough to justify delaying an interruptx-	 * more than 2 or 3 URBs, so we will ignore the URB_NO_INTERRUPT
-	 * flag setting. */
-	td->status |= cpu_to_le32(TD_CTRL_IOC);
-x-	qh = uhci_alloc_qh(uhci, urb->dev);
-	if (!qh)
-		return -ENOMEM;
-x-	urbp->qh = qh;
-	qh->urbp = urbp;
-
-	/* Always breadth first */
-	uhci_insert_tds_in_qh(qh, urb,xUHCI_PTR_BREADTH);
-x-	if (eurb)x-		uhci_append_queued_urb(uhci, eurb, urb);x-	else
-		uhci_insert_qh(uhci, skelqh, urb);x-
-	return -EINPROGRESS;
-}
-x-/*
- * Common result for bulk and interruptx- */x-static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct urb_priv *urbp = urb->hcpriv;
-	struct uhci_td *td;
-	unsigned intxstatus = 0;
-	int ret = 0;
-
-	urb->actual_length = 0;
-
-	list_for_each_entry(td, &urbp->td_list, list) {x-		unsigned intxctrlstat = td_status(td);
-x-		status = uhci_status_bits(ctrlstat);
-		if (status & TD_CTRL_ACTIVE)
-			return -EINPROGRESS;
-
-		urb->actual_length += uhci_actual_length(ctrlstat);
-
-		if (status)
-			goto td_error;x-x-		if (uhci_actual_length(ctrlstat) <
-				uhci_expected_length(td_token(td))) {x-			if (urb->transfer_flags & URB_SHORT_NOT_OK) {x-				ret = -EREMOTEIO;
-				goto err;
-			} elsex-				return 0;
-		}
-	}x-x-	return 0;
-x-td_error:x-	ret = uhci_map_status(status, uhci_packetout(td_token(td)));
-x-err:
-	/* 
-	 * Enable this chunk of code if you want to see some more debugging.
-	 * But be careful, it has the tendancy to starve out khubd and prevent
-	 * disconnects from happening successfully if you have a slow debug
-	 * log interface (like a serial console.
-	 */
-#if 0
-	if ((debugx== 1 && ret != -EPIPE) || debugx> 1) {x-		/* Some debugging code */x-		dev_dbg(uhci_dev(uhci), "%s: failed with status %x\n",x-				__FUNCTION__, status);
-
-		if (errbuf) {x-			/* Printxthe chain for debugging purposes */x-			uhci_show_qh(urbp->qh, errbuf, ERRBUF_LEN, 0);
-x-			lprintk(errbuf);
-		}
-	}x-#endif
-	return ret;x-}
-x-static inline int uhci_submit_bulk(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb)x-{x-	int ret;
-x-	/* Can't have low-speed bulk transfers */x-	if (urb->dev->speed == USB_SPEED_LOW)x-		return -EINVAL;
-
-	ret = uhci_submit_common(uhci, urb, eurb, uhci->skel_bulk_qh);x-	if (ret == -EINPROGRESS)
-		uhci_inc_fsbr(uhci, urb);x-
-	return ret;x-}
-x-static inline int uhci_submit_interrupt(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb)x-{x-	/* USB 1.1 interrupt transfers only involve one packet per interval;x-	 * that's the uhci_submit_common() "breadth first" policy.  Driversx-	 * can submit urbs of any length, butxlonger ones might need many
-	 * intervals to complete.
-	 */
-	return uhci_submit_common(uhci, urb, eurb, uhci->skelqh[__interval_to_skel(urb->interval)]);
-}
-x-/*
- * Isochronous transfersx- */x-static int isochronous_find_limits(struct uhci_hcd *uhci, struct urb *urb, unsigned intx*start, unsigned intx*end)x-{x-	struct urb *last_urb = NULL;
-	struct urb_priv *up;
-	int ret = 0;
-
-	list_for_each_entry(up, &uhci->urb_list, urb_list) {x-		struct urb *u = up->urb;x-x-		/* look for pending URB's with identical pipe handle */
-		if ((urb->pipe == u->pipe) && (urb->dev == u->dev) &&
-		    (u->status == -EINPROGRESS) && (u != urb)) {x-			if (!last_urb)x-				*start = u->start_frame;
-			last_urb = u;
-		}
-	}x-x-	if (last_urb) {x-		*end = (last_urb->start_frame + last_urb->number_of_packets *x-				last_urb->interval) & (UHCI_NUMFRAMES-1);
-		ret = 0;
-	} elsex-		ret = -1;	/* no previous urb found */
-x-	return ret;x-}
-x-static int isochronous_find_start(struct uhci_hcd *uhci, struct urb *urb)x-{x-	int limits;
-	unsigned intxstart = 0, end = 0;
-
-	if (urb->number_of_packets > 900)	/* 900? Why? */
-		return -EFBIG;
-
-	limits = isochronous_find_limits(uhci, urb, &start, &end);
-
-	if (urb->transfer_flags & URB_ISO_ASAP) {x-		if (limits)
-			urb->start_frame =
-					(uhci_get_current_frame_number(uhci) +
-						10) & (UHCI_NUMFRAMES - 1);
-		elsex-			urb->start_frame = end;
-	} else {x-		urb->start_frame &= (UHCI_NUMFRAMES - 1);
-		/* FIXME: Sanity check */
-	}x-x-	return 0;
-}
-x-/*
- * Isochronous transfersx- */x-static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct uhci_td *td;
-	int i, ret, frame;
-	int status, destination;
-
-	status = TD_CTRL_ACTIVE | TD_CTRL_IOS;x-	destination = (urb->pipe & PIPE_DEVEP_MASK) | usb_packetid(urb->pipe);
-
-	ret = isochronous_find_start(uhci, urb);x-	if (ret)x-		return ret;
-x-	frame = urb->start_frame;x-	for (i = 0; i < urb->number_of_packets; i++, frame += urb->interval) {x-		if (!urb->iso_frame_desc[i].length)
-			continue;
-x-		td = uhci_alloc_td(uhci, urb->dev);
-		if (!td)
-			return -ENOMEM;
-x-		uhci_add_td_to_urb(urb,xtd);
-		uhci_fill_td(td, status, destination | uhci_explen(urb->iso_frame_desc[i].length - 1),
-			urb->transfer_dma + urb->iso_frame_desc[i].offset);
-
-		if (i + 1 >= urb->number_of_packets)x-			td->status |= cpu_to_le32(TD_CTRL_IOC);
-x-		uhci_insert_td_frame_list(uhci, td, frame);
-	}
-x-	return -EINPROGRESS;
-}
-x-static int uhci_result_isochronous(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct uhci_td *td;
-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-	intxstatus;
-	int i, ret = 0;
-
-	urb->actual_length = 0;
-
-	i = 0;
-	list_for_each_entry(td, &urbp->td_list, list) {x-		int actlength;x-		unsigned intxctrlstat = td_status(td);
-x-		if (ctrlstat & TD_CTRL_ACTIVE)
-			return -EINPROGRESS;
-
-		actlength = uhci_actual_length(ctrlstat);
-		urb->iso_frame_desc[i].actual_length = actlength;x-		urb->actual_length += actlength;x-x-		status = uhci_map_status(uhci_status_bits(ctrlstat),
-				usb_pipeout(urb->pipe));
-		urb->iso_frame_desc[i].status = status;
-		if (status) {x-			urb->error_count++;
-			ret = status;
-		}
-x-		i++;
-	}
-x-	return ret;x-}
-x-static struct urb *uhci_find_urb_ep(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct urb_priv *up;
-
-	/* We don't match Isoc transfers since they are special */
-	if (usb_pipeisoc(urb->pipe))
-		return NULL;
-
-	list_for_each_entry(up, &uhci->urb_list, urb_list) {x-		struct urb *u = up->urb;x-x-		if (u->dev == urb->dev && u->status == -EINPROGRESS) {x-			/* For control, ignore the direction */x-			if (usb_pipecontrol(urb->pipe) &&
-			    (u->pipe & ~USB_DIR_IN) == (urb->pipe & ~USB_DIR_IN))x-				return u;x-			else if (u->pipe == urb->pipe)x-				return u;x-		}
-	}x-x-	return NULL;
-}
-x-static int uhci_urb_enqueue(struct usb_hcd *hcd,x-		struct usb_host_endpointx*ep,x-		struct urb *urb,xint mem_flags)x-{x-	int ret;
-	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
-	unsigned long flags;x-	struct urb *eurb;
-	int bustime;
-x-	spin_lock_irqsave(&uhci->schedule_lock, flags);
-
-	ret = urb->status;
-	if (ret != -EINPROGRESS)		/* URB already unlinked! */x-		goto out;
-x-	eurb = uhci_find_urb_ep(uhci, urb);x-
-	if (!uhci_alloc_urb_priv(uhci, urb)) {x-		ret = -ENOMEM;
-		goto out;
-	}x-x-	switch (usb_pipetype(urb->pipe)) {x-	case PIPE_CONTROL:x-		ret = uhci_submit_control(uhci, urb, eurb);
-		break;x-	case PIPE_INTERRUPT:
-		if (!eurb) {x-			bustime = usb_check_bandwidth(urb->dev, urb);x-			if (bustime < 0)
-				ret = bustime;
-			else {x-				ret = uhci_submit_interrupt(uhci, urb, eurb);
-				if (ret == -EINPROGRESS)
-					usb_claim_bandwidth(urb->dev, urb, bustime, 0);
-			}
-		} else {	/* inherit from parent */
-			urb->bandwidth = eurb->bandwidth;
-			ret = uhci_submit_interrupt(uhci, urb, eurb);
-		}
-		break;x-	case PIPE_BULK:x-		ret = uhci_submit_bulk(uhci, urb, eurb);
-		break;x-	case PIPE_ISOCHRONOUS:x-		bustime = usb_check_bandwidth(urb->dev, urb);x-		if (bustime < 0) {x-			ret = bustime;
-			break;x-		}
-x-		ret = uhci_submit_isochronous(uhci, urb);x-		if (ret == -EINPROGRESS)
-			usb_claim_bandwidth(urb->dev, urb, bustime, 1);
-		break;x-	}x-x-	if (ret != -EINPROGRESS) {x-		/* Submit failed, so delete it from the urb_list */
-		struct urb_priv *urbp = urb->hcpriv;
-x-		list_del_init(&urbp->urb_list);x-		uhci_destroy_urb_priv(uhci, urb);x-	} elsex-		ret = 0;
-
-out:x-	spin_unlock_irqrestore(&uhci->schedule_lock, flags);
-	return ret;x-}
-x-/*
- * Return the result of a transfer
- */x-static void uhci_transfer_result(struct uhci_hcd *uhci, struct urb *urb)x-{x-	int ret = -EINPROGRESS;
-	struct urb_priv *urbp;
-
-	spin_lock(&urb->lock);x-x-	urbp = (struct urb_priv *)urb->hcpriv;
-
-	if (urb->status != -EINPROGRESS)	/* URB already dequeued */x-		goto out;
-x-	switch (usb_pipetype(urb->pipe)) {x-	case PIPE_CONTROL:x-		ret = uhci_result_control(uhci, urb);x-		break;x-	case PIPE_BULK:x-	case PIPE_INTERRUPT:
-		ret = uhci_result_common(uhci, urb);
-		break;x-	case PIPE_ISOCHRONOUS:x-		ret = uhci_result_isochronous(uhci, urb);x-		break;x-	}x-x-	if (ret == -EINPROGRESS)
-		goto out;
-	urb->status = ret;
-x-	switch (usb_pipetype(urb->pipe)) {x-	case PIPE_CONTROL:x-	case PIPE_BULK:x-	case PIPE_ISOCHRONOUS:x-		/* Release bandwidth for Interrupt or Isoc. transfers */x-		if (urb->bandwidth)
-			usb_release_bandwidth(urb->dev, urb, 1);x-		uhci_unlink_generic(uhci, urb);
-		break;x-	case PIPE_INTERRUPT:
-		/* Release bandwidth for Interrupt or Isoc. transfers */x-		/* Make sure we don't release if we have a queued URB */x-		if (list_empty(&urbp->queue_list) && urb->bandwidth)
-			usb_release_bandwidth(urb->dev, urb, 0);x-		elsex-			/* bandwidth was passed on to queued URB, */
-			/* so don't let usb_unlink_urb() release it */
-			urb->bandwidth = 0;x-		uhci_unlink_generic(uhci, urb);
-		break;x-	default:x-		dev_info(uhci_dev(uhci), "%s: unknown pipe type %d "
-				"for urb %p\n",x-				__FUNCTION__, usb_pipetype(urb->pipe), urb);x-	}
-
-	/* Move it from uhci->urb_list to uhci->complete_list */
-	uhci_moveto_complete(uhci, urbp);
-
-out:x-	spin_unlock(&urb->lock);x-}
-x-static void uhci_unlink_generic(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct list_head *head;
-	struct uhci_td *td;
-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-	intxprevactive = 0;
-
-	uhci_dec_fsbr(uhci, urb);	/* Safe since it checks */
-x-	/*
-	 * Now we need to find out whatxthe last successful toggle was
-	 * so we can update the local data toggle for the next transfer
-	 *
-	 * There are 2 ways the last successful completed TD is found:
-	 *
-	 * 1) The TD is NOT active and the actual length < expected length
-	 * 2) The TD is NOT active and it's the last TD inxthe chain
-	 *
-	 * and a third way the first uncompleted TD is found:
-	 *
-	 * 3) The TD is active and the previous TD is NOT active
-	 *
-	 * Control and Isochronous ignore the toggle, so this is safe
-	 * for all types
-	 *
-	 * FIXME: The toggle fixups won't be 100% reliable until wex-	 * change over to using a single queue for each endpoint and
-	 * stop the queue before unlinking.
-	 */
-	head = &urbp->td_list;
-	list_for_each_entry(td, head, list) {x-		unsigned intxctrlstat = td_status(td);
-x-		if (!(ctrlstat & TD_CTRL_ACTIVE) &&
-				(uhci_actual_length(ctrlstat) <
-				 uhci_expected_length(td_token(td)) ||
-				td->list.next == head))
-			usb_settoggle(urb->dev, uhci_endpoint(td_token(td)),
-				uhci_packetout(td_token(td)),
-				uhci_toggle(td_token(td)) ^ 1);x-		else if ((ctrlstat & TD_CTRL_ACTIVE) && !prevactive)
-			usb_settoggle(urb->dev, uhci_endpoint(td_token(td)),
-				uhci_packetout(td_token(td)),
-				uhci_toggle(td_token(td)));x-x-		prevactive = ctrlstat & TD_CTRL_ACTIVE;x-	}
-x-	uhci_delete_queued_urb(uhci, urb);x-
-	/* The interrupt loop will reclaim the QH's */
-	uhci_remove_qh(uhci, urbp->qh);
-	urbp->qh = NULL;
-}
-x-static int uhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)x-{x-	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
-	unsigned long flags;x-	struct urb_priv *urbp;
-	unsigned intxage;x-x-	spin_lock_irqsave(&uhci->schedule_lock, flags);
-	urbp = urb->hcpriv;
-	if (!urbp)			/* URB was never linked! */x-		goto done;x-	list_del_init(&urbp->urb_list);x-x-	uhci_unlink_generic(uhci, urb);
-
-	age = uhci_get_current_frame_number(uhci);x-	if (age != uhci->urb_remove_age) {x-		uhci_remove_pending_urbps(uhci);x-		uhci->urb_remove_age = age;x-	}
-x-	/* If we're the first, set the next interrupt bit */
-	if (list_empty(&uhci->urb_remove_list))
-		uhci_set_next_interrupt(uhci);x-	list_add_tail(&urbp->urb_list, &uhci->urb_remove_list);
-x-done:x-	spin_unlock_irqrestore(&uhci->schedule_lock, flags);
-	return 0;
-}
-x-static int uhci_fsbr_timeout(struct uhci_hcd *uhci, struct urb *urb)x-{x-	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
-	struct list_head *head;
-	struct uhci_td *td;
-	intxcount = 0;
-
-	uhci_dec_fsbr(uhci, urb);
-x-	urbp->fsbr_timeout = 1;
-
-	/*
-	 * Ideally we would want to fix qh->element as well, butxit's
-	 * read/write by the HC, so that can introduce a race. It's not
-	 * really worth the hassle
-	 */
-
-	head = &urbp->td_list;
-	list_for_each_entry(td, head, list) {x-		/*
-		 * Make sure we don't do the last one (since it'll have the
-		 * TERM bit set) as well as we skip every so many TD's to
-		 * make sure it doesn't hog the bandwidth
-		 */x-		if (td->list.next != head && (count % DEPTH_INTERVAL) ==
-				(DEPTH_INTERVAL - 1))x-			td->link |= UHCI_PTR_DEPTH;
-
-		count++;
-	}x-x-	return 0;
-}
-x-/*
- * uhci_get_current_frame_number()
- *
- * returns the current frame number for a USB bus/controller.x- */x-static unsigned intxuhci_get_current_frame_number(struct uhci_hcd *uhci)x-{x-	return inw(uhci->io_addr + USBFRNUM);x-}
+#include "uhci-hub.c"
+#include "uhci-debug.c"
+#include "uhci-q.c"
 
 static int init_stall_timer(struct usb_hcd *hcd);x 
@@ -1592,62 +167,6 @@
 	return 0;
 }x 
-static void uhci_free_pending_qhs(struct uhci_hcd *uhci)x-{x-	struct uhci_qh *qh, *tmp;
-
-	list_for_each_entry_safe(qh, tmp, &uhci->qh_remove_list, remove_list) {x-		list_del_init(&qh->remove_list);
-x-		uhci_free_qh(uhci, qh);
-	}
-}
-x-static void uhci_free_pending_tds(struct uhci_hcd *uhci)x-{x-	struct uhci_td *td, *tmp;
-
-	list_for_each_entry_safe(td, tmp, &uhci->td_remove_list, remove_list) {x-		list_del_init(&td->remove_list);
-x-		uhci_free_td(uhci, td);
-	}
-}
-x-static void
-uhci_finish_urb(struct usb_hcd *hcd, struct urb *urb, struct pt_regs *regs)x-__releases(uhci->schedule_lock)x-__acquires(uhci->schedule_lock)x-{x-	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
-
-	uhci_destroy_urb_priv(uhci, urb);x-x-	spin_unlock(&uhci->schedule_lock);
-	usb_hcd_giveback_urb(hcd, urb, regs);
-	spin_lock(&uhci->schedule_lock);
-}
-x-static void uhci_finish_completion(struct usb_hcd *hcd, struct pt_regs *regs)x-{x-	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
-	struct urb_priv *urbp, *tmp;
-
-	list_for_each_entry_safe(urbp, tmp, &uhci->complete_list, urb_list) {x-		struct urb *urb = urbp->urb;x-x-		list_del_init(&urbp->urb_list);x-		uhci_finish_urb(hcd, urb, regs);
-	}
-}
-x-static void uhci_remove_pending_urbps(struct uhci_hcd *uhci)x-{x-
-	/* Splice the urb_remove_list onto the end of the complete_list */
-	list_splice_init(&uhci->urb_remove_list, uhci->complete_list.prev);
-}
-x static irqreturn_t uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)x {x 	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
@@ -1866,6 +385,14 @@
 	}
 }x 
+/*
+ * returns the current frame number for a USB bus/controller.x+ */
+static unsigned intxuhci_get_current_frame_number(struct uhci_hcd *uhci)x+{
+	return inw(uhci->io_addr + USBFRNUM);x+}
+
 static int start_hc(struct uhci_hcd *uhci)x {x 	unsigned long io_addr = uhci->io_addr;
@@ -1906,7 +433,7 @@
 }x 
 /*
- * De-allocate all resources..x+ * De-allocate all resources
  */
 static void release_uhci(struct uhci_hcd *uhci)x {x@@ -1949,7 +476,7 @@
 {x 	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
 
-	uhci->io_addr = (unsigned long) hcd->regs;x+	uhci->io_addr = (unsigned long) hcd->rsrc_start;
 
 	/* Kick BIOS off this hardware and reset, so we won't get
 	 * interrupts from any previous setup.x@@ -1984,7 +511,7 @@
 	struct usb_device *udev;
 	struct dentry *dentry;
 
-	io_size = pci_resource_len(to_pci_dev(uhci_dev(uhci)), hcd->region);x+	io_size = (unsigned) hcd->rsrc_len;x 
 	dentry = debugfs_create_file(hcd->self.bus_name, S_IFREG|S_IRUGO|S_IWUSR, uhci_debugfs_root, uhci, &uhci_debug_operations);
 	if (!dentry) {xdiff -Nru a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/host/uhci-q.c	2005-03-07 20:50:36 -08:00x@@ -0,0 +1,1488 @@
+/*
+ * Universal Host Controller Interface driver for USB.x+ *
+ * Maintainer: Alan Stern <stern@rowland.harvard.edu>x+ *
+ * (C) Copyright 1999 Linus Torvalds
+ * (C) Copyright 1999-2002 Johannes Erdfelt, johannes@erdfelt.com
+ * (C) Copyright 1999 Randy Dunlap
+ * (C) Copyright 1999 Georg Acher, acher@in.tum.de
+ * (C) Copyright 1999 Deti Fliegl, deti@fliegl.de
+ * (C) Copyright 1999 Thomas Sailer, sailer@ife.ee.ethz.ch
+ * (C) Copyright 1999 Roman Weissgaerber, weissg@vienna.at
+ * (C) Copyright 2000 Yggdrasil Computing, Inc. (port of new PCI interface
+ *               support from usb-ohci.c by Adam Richter, adam@yggdrasil.com).
+ * (C) Copyright 1999 Gregory P. Smith (from usb-ohci.c)
+ * (C) Copyright 2004 Alan Stern, stern@rowland.harvard.edux+ */
+
+static int uhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb);
+static void uhci_unlink_generic(struct uhci_hcd *uhci, struct urb *urb);
+static void uhci_remove_pending_urbps(struct uhci_hcd *uhci);
+static void uhci_free_pending_qhs(struct uhci_hcd *uhci);
+static void uhci_free_pending_tds(struct uhci_hcd *uhci);
+
+/*
+ * Technically, updating td->status here is a race, butxit'sxnot really a
+ * problem. The worst that can happen is that we set the IOC bit again
+ * generating a spurious interrupt. We could fix this by creating another
+ * QH and leaving the IOC bit always set, butxthen we would have to play
+ * games with the FSBR code to make sure we get the correct order in all
+ * the cases. I don't thinkxit'sxworth the effortx+ */
+static inline void uhci_set_next_interrupt(struct uhci_hcd *uhci)x+{
+	uhci->term_td->status |= cpu_to_le32(TD_CTRL_IOC); x+}
+
+static inline void uhci_clear_next_interrupt(struct uhci_hcd *uhci)x+{
+	uhci->term_td->status &= ~cpu_to_le32(TD_CTRL_IOC);
+}
+
+static inline void uhci_moveto_complete(struct uhci_hcd *uhci, 
+					struct urb_priv *urbp)x+{
+	list_move_tail(&urbp->urb_list, &uhci->complete_list);
+}
+
+static struct uhci_td *uhci_alloc_td(struct uhci_hcd *uhci, struct usb_device *dev)x+{
+	dma_addr_t dma_handle;x+	struct uhci_td *td;
+
+	td = dma_pool_alloc(uhci->td_pool, GFP_ATOMIC, &dma_handle);
+	if (!td)
+		return NULL;
+
+	td->dma_handle = dma_handle;x+
+	td->link = UHCI_PTR_TERM;
+	td->buffer = 0;
+
+	td->frame = -1;
+	td->dev = dev;
+
+	INIT_LIST_HEAD(&td->list);x+	INIT_LIST_HEAD(&td->remove_list);
+	INIT_LIST_HEAD(&td->fl_list);
+
+	usb_get_dev(dev);
+
+	return td;
+}
+
+static inline void uhci_fill_td(struct uhci_td *td, u32 status,
+		u32 token, u32 buffer)x+{
+	td->status = cpu_to_le32(status);
+	td->token = cpu_to_le32(token);
+	td->buffer = cpu_to_le32(buffer);
+}
+
+/*
+ * We insert Isochronous URB's directly into the frame list atxthe beginningx+ */
+static void uhci_insert_td_frame_list(struct uhci_hcd *uhci, struct uhci_td *td, unsigned framenum)x+{
+	framenum &= (UHCI_NUMFRAMES - 1);
+
+	td->frame = framenum;
+
+	/* Is there a TD already mapped there? */
+	if (uhci->fl->frame_cpu[framenum]) {x+		struct uhci_td *ftd, *ltd;
+
+		ftd = uhci->fl->frame_cpu[framenum];
+		ltd = list_entry(ftd->fl_list.prev, struct uhci_td, fl_list);
+
+		list_add_tail(&td->fl_list, &ftd->fl_list);
+
+		td->link = ltd->link;
+		wmb();
+		ltd->link = cpu_to_le32(td->dma_handle);
+	} else {x+		td->link = uhci->fl->frame[framenum];
+		wmb();
+		uhci->fl->frame[framenum] = cpu_to_le32(td->dma_handle);
+		uhci->fl->frame_cpu[framenum] = td;
+	}
+}
+
+static void uhci_remove_td(struct uhci_hcd *uhci, struct uhci_td *td)x+{
+	/* If it'sxnot inserted, don't remove it */
+	if (td->frame == -1 && list_empty(&td->fl_list))
+		return;
+
+	if (td->frame != -1 && uhci->fl->frame_cpu[td->frame] == td) {x+		if (list_empty(&td->fl_list)) {x+			uhci->fl->frame[td->frame] = td->link;
+			uhci->fl->frame_cpu[td->frame] = NULL;
+		} else {x+			struct uhci_td *ntd;
+
+			ntd = list_entry(td->fl_list.next, struct uhci_td, fl_list);
+			uhci->fl->frame[td->frame] = cpu_to_le32(ntd->dma_handle);
+			uhci->fl->frame_cpu[td->frame] = ntd;
+		}
+	} else {x+		struct uhci_td *ptd;
+
+		ptd = list_entry(td->fl_list.prev, struct uhci_td, fl_list);
+		ptd->link = td->link;
+	}
+
+	wmb();
+	td->link = UHCI_PTR_TERM;
+
+	list_del_init(&td->fl_list);
+	td->frame = -1;
+}
+
+/*
+ * Inserts a td list into qh.x+ */
+static void uhci_insert_tds_in_qh(struct uhci_qh *qh, struct urb *urb, __le32 breadth)x+{
+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+	struct uhci_td *td;
+	__le32 *plink;
+
+	/* Ordering isn't important here yet since the QH hasn't been */
+	/* inserted into the schedule yet */
+	plink = &qh->element;
+	list_for_each_entry(td, &urbp->td_list, list) {x+		*plink = cpu_to_le32(td->dma_handle) | breadth;
+		plink = &td->link;
+	}
+	*plink = UHCI_PTR_TERM;
+}
+
+static void uhci_free_td(struct uhci_hcd *uhci, struct uhci_td *td)x+{
+	if (!list_empty(&td->list))
+		dev_warn(uhci_dev(uhci), "td %p still in list!\n", td);
+	if (!list_empty(&td->remove_list))
+		dev_warn(uhci_dev(uhci), "td %p still in remove_list!\n", td);
+	if (!list_empty(&td->fl_list))
+		dev_warn(uhci_dev(uhci), "td %p still in fl_list!\n", td);
+
+	if (td->dev)x+		usb_put_dev(td->dev);
+
+	dma_pool_free(uhci->td_pool, td, td->dma_handle);
+}
+
+static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd *uhci, struct usb_device *dev)x+{
+	dma_addr_t dma_handle;x+	struct uhci_qh *qh;
+
+	qh = dma_pool_alloc(uhci->qh_pool, GFP_ATOMIC, &dma_handle);
+	if (!qh)
+		return NULL;
+
+	qh->dma_handle = dma_handle;x+
+	qh->element = UHCI_PTR_TERM;
+	qh->link = UHCI_PTR_TERM;
+
+	qh->dev = dev;
+	qh->urbp = NULL;
+
+	INIT_LIST_HEAD(&qh->list);
+	INIT_LIST_HEAD(&qh->remove_list);
+
+	usb_get_dev(dev);
+
+	return qh;
+}
+
+static void uhci_free_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)x+{
+	if (!list_empty(&qh->list))
+		dev_warn(uhci_dev(uhci), "qh %p list not empty!\n", qh);
+	if (!list_empty(&qh->remove_list))
+		dev_warn(uhci_dev(uhci), "qh %p still in remove_list!\n", qh);
+
+	if (qh->dev)x+		usb_put_dev(qh->dev);
+
+	dma_pool_free(uhci->qh_pool, qh, qh->dma_handle);
+}
+
+/*
+ * Append this urb'sxqh after the last qh in skelqh->listx+ *
+ * Note that urb_priv.queue_list doesn't have a separate queue head;
+ * it's a ring with every element "live".x+ */
+static void uhci_insert_qh(struct uhci_hcd *uhci, struct uhci_qh *skelqh, struct urb *urb)x+{
+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+	struct urb_priv *turbp;
+	struct uhci_qh *lqh;
+
+	/* Grab the last QH */
+	lqh = list_entry(skelqh->list.prev, struct uhci_qh, list);
+
+	/* Point to the next skelqh */
+	urbp->qh->link = lqh->link;
+	wmb();				/* Ordering is important */
+
+	/*
+	 * Patch QHs for previous endpoint'sxqueued URBs?  HC goes
+	 * here next, not to the next skelqh it now points to.
+	 *
+	 *    lqh --> td ... --> qh ... --> td --> qh ... --> td
+	 *     |                 |                 |
+	 *     v                 v                 v
+	 *     +<----------------+-----------------+
+	 *     v
+	 *    newqh --> td ... --> td
+	 *     |
+	 *     v
+	 *    ...
+	 *
+	 * The HC could see (and use!) any of these as we write them.
+	 */
+	lqh->link = cpu_to_le32(urbp->qh->dma_handle) | UHCI_PTR_QH;
+	if (lqh->urbp) {x+		list_for_each_entry(turbp, &lqh->urbp->queue_list, queue_list)
+			turbp->qh->link = lqh->link;
+	}
+
+	list_add_tail(&urbp->qh->list, &skelqh->list);
+}
+
+/*
+ * Start removal of QH from schedule; it finishes next frame.
+ * TDs should be unlinked before this is called.x+ */
+static void uhci_remove_qh(struct uhci_hcd *uhci, struct uhci_qh *qh)x+{
+	struct uhci_qh *pqh;
+	__le32 newlink;
+	unsigned intxage;x+
+	if (!qh)
+		return;
+
+	/*
+	 * Only go through the hoops if it's actually linked in
+	 */
+	if (!list_empty(&qh->list)) {x+
+		/* If our queue isxnonempty, make the next URB the head */x+		if (!list_empty(&qh->urbp->queue_list)) {x+			struct urb_priv *nurbp;
+
+			nurbp = list_entry(qh->urbp->queue_list.next,
+					struct urb_priv, queue_list);
+			nurbp->queued = 0;
+			list_add(&nurbp->qh->list, &qh->list);
+			newlink = cpu_to_le32(nurbp->qh->dma_handle) | UHCI_PTR_QH;
+		} elsex+			newlink = qh->link;
+
+		/* Fix up the previous QH's queue to link to either
+		 * the new head of this queue or the start of the
+		 * next endpoint'sxqueue. */x+		pqh = list_entry(qh->list.prev, struct uhci_qh, list);
+		pqh->link = newlink;
+		if (pqh->urbp) {x+			struct urb_priv *turbp;
+
+			list_for_each_entry(turbp, &pqh->urbp->queue_list,
+					queue_list)
+				turbp->qh->link = newlink;
+		}
+		wmb();
+
+		/* Leave qh->link in case the HC isxon the QH now, it will */x+		/* continue the rest of the schedule */x+		qh->element = UHCI_PTR_TERM;
+x+		list_del_init(&qh->list);
+	}
+
+	list_del_init(&qh->urbp->queue_list);
+	qh->urbp = NULL;
+
+	age = uhci_get_current_frame_number(uhci);x+	if (age != uhci->qh_remove_age) {x+		uhci_free_pending_qhs(uhci);x+		uhci->qh_remove_age = age;x+	}
+
+	/* Check to see if the remove list is empty. Set the IOC bit */
+	/* to force an interrupt so we can remove the QH */
+	if (list_empty(&uhci->qh_remove_list))
+		uhci_set_next_interrupt(uhci);x+
+	list_add(&qh->remove_list, &uhci->qh_remove_list);
+}
+
+static int uhci_fixup_toggle(struct urb *urb, unsigned intxtoggle)x+{
+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+	struct uhci_td *td;
+
+	list_for_each_entry(td, &urbp->td_list, list) {x+		if (toggle)x+			td->token |= cpu_to_le32(TD_TOKEN_TOGGLE);x+		elsex+			td->token &= ~cpu_to_le32(TD_TOKEN_TOGGLE);x+x+		toggle ^= 1;
+	}
+
+	return toggle;
+}
+
+/* This function will append one URB's QH to another URB's QH. This is for */
+/* queuing interrupt, control or bulk transfers */x+static void uhci_append_queued_urb(struct uhci_hcd *uhci, struct urb *eurb, struct urb *urb)x+{
+	struct urb_priv *eurbp, *urbp, *furbp, *lurbp;
+	struct uhci_td *lltd;
+
+	eurbp = eurb->hcpriv;
+	urbp = urb->hcpriv;
+
+	/* Find the first URB inxthe queue */
+	furbp = eurbp;x+	if (eurbp->queued) {x+		list_for_each_entry(furbp, &eurbp->queue_list, queue_list)
+			if (!furbp->queued)
+				break;x+	}
+
+	lurbp = list_entry(furbp->queue_list.prev, struct urb_priv, queue_list);
+
+	lltd = list_entry(lurbp->td_list.prev, struct uhci_td, list);
+
+	/* Control transfers always start with toggle 0 */
+	if (!usb_pipecontrol(urb->pipe))x+		usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe),
+				usb_pipeout(urb->pipe),
+				uhci_fixup_toggle(urb,
+					uhci_toggle(td_token(lltd)) ^ 1));
+
+	/* All qh's inxthe queue need to link to the next queue */
+	urbp->qh->link = eurbp->qh->link;
+
+	wmb();			/* Make sure we flush everything */
+
+	lltd->link = cpu_to_le32(urbp->qh->dma_handle) | UHCI_PTR_QH;
+
+	list_add_tail(&urbp->queue_list, &furbp->queue_list);
+
+	urbp->queued = 1;
+}
+
+static void uhci_delete_queued_urb(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct urb_priv *urbp, *nurbp, *purbp, *turbp;
+	struct uhci_td *pltd;
+	unsigned intxtoggle;
+
+	urbp = urb->hcpriv;
+
+	if (list_empty(&urbp->queue_list))
+		return;
+
+	nurbp = list_entry(urbp->queue_list.next, struct urb_priv, queue_list);
+
+	/*
+	 * Fix up the toggle for the following URBs inxthe queue.
+	 * Only needed for bulk and interrupt: control and isochronous
+	 * endpoints don't propagate toggles between messages.
+	 */
+	if (usb_pipebulk(urb->pipe) || usb_pipeint(urb->pipe)) {x+		if (!urbp->queued)
+			/* We just set the toggle in uhci_unlink_generic */x+			toggle = usb_gettoggle(urb->dev,
+					usb_pipeendpoint(urb->pipe),
+					usb_pipeout(urb->pipe));
+		else {x+			/* If we're inxthe middle of the queue, grab the */x+			/* toggle from the TD previous to us */x+			purbp = list_entry(urbp->queue_list.prev,
+					struct urb_priv, queue_list);
+			pltd = list_entry(purbp->td_list.prev,
+					struct uhci_td, list);
+			toggle = uhci_toggle(td_token(pltd)) ^ 1;
+		}
+x+		list_for_each_entry(turbp, &urbp->queue_list, queue_list) {x+			if (!turbp->queued)
+				break;x+			toggle = uhci_fixup_toggle(turbp->urb,xtoggle);
+		}
+x+		usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe),
+				usb_pipeout(urb->pipe),xtoggle);
+	}
+
+	if (urbp->queued) {x+		/* We're somewhere inxthe middle (or end).  The case where
+		 * we're atxthe head is handled in uhci_remove_qh(). */x+		purbp = list_entry(urbp->queue_list.prev, struct urb_priv,
+				queue_list);
+
+		pltd = list_entry(purbp->td_list.prev, struct uhci_td, list);
+		if (nurbp->queued)
+			pltd->link = cpu_to_le32(nurbp->qh->dma_handle) | UHCI_PTR_QH;
+		elsex+			/* The next URB happens to bexthe beginning, so */x+			/*  we're the last, end the chain */x+			pltd->link = UHCI_PTR_TERM;
+	}
+
+	/* urbp->queue_list is handled in uhci_remove_qh() */x+}
+
+static struct urb_priv *uhci_alloc_urb_priv(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct urb_priv *urbp;
+
+	urbp = kmem_cache_alloc(uhci_up_cachep, SLAB_ATOMIC);
+	if (!urbp)x+		return NULL;
+
+	memset((void *)urbp, 0, sizeof(*urbp));
+
+	urbp->inserttime = jiffies;
+	urbp->fsbrtime = jiffies;
+	urbp->urb = urb;
+	
+	INIT_LIST_HEAD(&urbp->td_list);
+	INIT_LIST_HEAD(&urbp->queue_list);
+	INIT_LIST_HEAD(&urbp->urb_list);x+
+	list_add_tail(&urbp->urb_list, &uhci->urb_list);
+
+	urb->hcpriv = urbp;
+
+	return urbp;
+}
+
+static void uhci_add_td_to_urb(struct urb *urb, struct uhci_td *td)x+{
+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+
+	td->urb = urb;
+
+	list_add_tail(&td->list, &urbp->td_list);
+}
+
+static void uhci_remove_td_from_urb(struct uhci_td *td)x+{
+	if (list_empty(&td->list))
+		return;
+
+	list_del_init(&td->list);
+
+	td->urb = NULL;
+}
+
+static void uhci_destroy_urb_priv(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct uhci_td *td, *tmp;
+	struct urb_priv *urbp;
+	unsigned intxage;x+
+	urbp = (struct urb_priv *)urb->hcpriv;
+	if (!urbp)x+		return;x+
+	if (!list_empty(&urbp->urb_list))
+		dev_warn(uhci_dev(uhci), "urb %p still on uhci->urb_list "
+				"or uhci->remove_list!\n", urb);
+
+	age = uhci_get_current_frame_number(uhci);x+	if (age != uhci->td_remove_age) {x+		uhci_free_pending_tds(uhci);x+		uhci->td_remove_age = age;x+	}
+
+	/* Check to see if the remove list is empty. Set the IOC bit */
+	/* to force an interrupt so we can remove the TD's*/
+	if (list_empty(&uhci->td_remove_list))
+		uhci_set_next_interrupt(uhci);x+
+	list_for_each_entry_safe(td, tmp, &urbp->td_list, list) {x+		uhci_remove_td_from_urb(td);
+		uhci_remove_td(uhci, td);
+		list_add(&td->remove_list, &uhci->td_remove_list);
+	}
+
+	urb->hcpriv = NULL;
+	kmem_cache_free(uhci_up_cachep, urbp);
+}
+
+static void uhci_inc_fsbr(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+
+	if ((!(urb->transfer_flags & URB_NO_FSBR)) && !urbp->fsbr) {x+		urbp->fsbr = 1;
+		if (!uhci->fsbr++ && !uhci->fsbrtimeout)
+			uhci->skel_term_qh->link = cpu_to_le32(uhci->skel_fs_control_qh->dma_handle) | UHCI_PTR_QH;
+	}
+}
+
+static void uhci_dec_fsbr(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+
+	if ((!(urb->transfer_flags & URB_NO_FSBR)) && urbp->fsbr) {x+		urbp->fsbr = 0;
+		if (!--uhci->fsbr)
+			uhci->fsbrtimeout = jiffies + FSBR_DELAY;
+	}
+}
+
+/*
+ * Map status to standard result codesx+ *
+ * <status> is (td_status(td) & 0xF60000), a.k.a.
+ * uhci_status_bits(td_status(td)).
+ * Note: <status> doesxnot include the TD_CTRL_NAK bit.
+ * <dir_out> is True for output TDs and False for input TDs.x+ */
+static int uhci_map_status(int status, int dir_out)x+{
+	if (!status)
+		return 0;
+	if (status & TD_CTRL_BITSTUFF)			/* Bitstuff error */x+		return -EPROTO;
+	if (status & TD_CTRL_CRCTIMEO) {		/* CRC/Timeout */x+		if (dir_out)x+			return -EPROTO;
+		elsex+			return -EILSEQ;
+	}
+	if (status & TD_CTRL_BABBLE)			/* Babble */x+		return -EOVERFLOW;
+	if (status & TD_CTRL_DBUFERR)			/* Buffer error */x+		return -ENOSR;
+	if (status & TD_CTRL_STALLED)			/* Stalled */x+		return -EPIPE;
+	WARN_ON(status & TD_CTRL_ACTIVE);		/* Active */x+	return 0;
+}
+
+/*
+ * Control transfersx+ */
+static int uhci_submit_control(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb)x+{
+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+	struct uhci_td *td;
+	struct uhci_qh *qh, *skelqh;
+	unsigned long destination, status;
+	intxmaxsze = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe));
+	int len = urb->transfer_buffer_length;x+	dma_addr_t data = urb->transfer_dma;
+
+	/* The "pipe" thing contains the destination in bits 8--18 */x+	destination = (urb->pipe & PIPE_DEVEP_MASK) | USB_PID_SETUP;
+
+	/* 3 errors */x+	status = TD_CTRL_ACTIVE | uhci_maxerr(3);x+	if (urb->dev->speed == USB_SPEED_LOW)x+		status |= TD_CTRL_LS;
+
+	/*
+	 * Build the TD for the control request setup packet
+	 */
+	td = uhci_alloc_td(uhci, urb->dev);
+	if (!td)
+		return -ENOMEM;
+
+	uhci_add_td_to_urb(urb,xtd);
+	uhci_fill_td(td, status, destination | uhci_explen(7),
+		urb->setup_dma);
+
+	/*
+	 * If direction is "send", change the packet ID from SETUP (0x2D)
+	 * to OUT (0xE1).  Else change it from SETUP to IN (0x69) and
+	 * set Short Packet Detect (SPD) for all data packets.
+	 */
+	if (usb_pipeout(urb->pipe))
+		destination ^= (USB_PID_SETUP ^ USB_PID_OUT);
+	else {x+		destination ^= (USB_PID_SETUP ^ USB_PID_IN);
+		status |= TD_CTRL_SPD;x+	}
+
+	/*
+	 * Build the DATA TD's
+	 */
+	while (len > 0) {x+		int pktsze = len;x+
+		if (pktsze >xmaxsze)
+			pktsze = maxsze;
+
+		td = uhci_alloc_td(uhci, urb->dev);
+		if (!td)
+			return -ENOMEM;
+
+		/* Alternate Data0/1 (start with Data1) */x+		destination ^= TD_TOKEN_TOGGLE;
+	
+		uhci_add_td_to_urb(urb,xtd);
+		uhci_fill_td(td, status, destination | uhci_explen(pktsze - 1),
+			data);
+
+		data += pktsze;
+		len -= pktsze;
+	}
+
+	/*
+	 * Build the final TD for control status 
+	 */
+	td = uhci_alloc_td(uhci, urb->dev);
+	if (!td)
+		return -ENOMEM;
+
+	/*
+	 * It'sxIN if the pipe is an output pipe or we're not expectingx+	 * data back.
+	 */
+	destination &= ~TD_TOKEN_PID_MASK;
+	if (usb_pipeout(urb->pipe) || !urb->transfer_buffer_length)
+		destination |= USB_PID_IN;
+	else
+		destination |= USB_PID_OUT;
+
+	destination |= TD_TOKEN_TOGGLE;		/* End in Data1 */
+
+	status &= ~TD_CTRL_SPD;x+
+	uhci_add_td_to_urb(urb,xtd);
+	uhci_fill_td(td, status | TD_CTRL_IOC,
+		destination | uhci_explen(UHCI_NULL_DATA_SIZE), 0);x+
+	qh = uhci_alloc_qh(uhci, urb->dev);
+	if (!qh)
+		return -ENOMEM;
+
+	urbp->qh = qh;
+	qh->urbp = urbp;
+
+	uhci_insert_tds_in_qh(qh, urb,xUHCI_PTR_BREADTH);
+
+	/* Low-speed transfers get a different queue, and won't hog the bus.
+	 * Also, some devices enumerate better without FSBR; the easiest way
+	 * to do that is to put URBs on the low-speed queue while the device
+	 * is inxthe DEFAULT state. */x+	if (urb->dev->speed == USB_SPEED_LOW ||
+			urb->dev->state == USB_STATE_DEFAULT)x+		skelqh = uhci->skel_ls_control_qh;
+	else {x+		skelqh = uhci->skel_fs_control_qh;
+		uhci_inc_fsbr(uhci, urb);x+	}
+
+	if (eurb)x+		uhci_append_queued_urb(uhci, eurb, urb);x+	else
+		uhci_insert_qh(uhci, skelqh, urb);
+
+	return -EINPROGRESS;
+}
+
+/*
+ * If control-IN transfer was short, the status packet wasn't sent.
+ * This routine changes the element pointer in the QH to point at the
+ * status TD.  It'sxsafe to do this even while the QH is live, because
+ * the hardware only updates the element pointer following a successful
+ * transfer.  The inactive TD for the short packet won't cause an update,
+ * so the pointer won't get overwritten.  The next time the controller
+ * sees this QH, it will send the status packet.x+ */
+static int usb_control_retrigger_status(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+	struct uhci_td *td;
+
+	urbp->short_control_packet = 1;
+
+	td = list_entry(urbp->td_list.prev, struct uhci_td, list);
+	urbp->qh->element = cpu_to_le32(td->dma_handle);
+
+	return -EINPROGRESS;
+}
+
+
+static int uhci_result_control(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct list_head *tmp, *head;
+	struct urb_priv *urbp = urb->hcpriv;
+	struct uhci_td *td;
+	unsigned intxstatus;
+	intxret = 0;
+
+	if (list_empty(&urbp->td_list))
+		return -EINVAL;
+
+	head = &urbp->td_list;
+
+	if (urbp->short_control_packet) {x+		tmp = head->prev;
+		goto status_stage;x+	}
+
+	tmp = head->next;
+	td = list_entry(tmp, struct uhci_td, list);
+
+	/* The first TD is the SETUP stage, check the status, butxskip */
+	/*  the count */
+	status = uhci_status_bits(td_status(td));
+	if (status & TD_CTRL_ACTIVE)
+		return -EINPROGRESS;
+
+	if (status)
+		goto td_error;
+
+	urb->actual_length = 0;
+
+	/* The rest of the TD's (butxthe last) are data */
+	tmp = tmp->next;
+	while (tmp != head && tmp->next != head) {x+		unsigned intxctrlstat;
+
+		td = list_entry(tmp, struct uhci_td, list);
+		tmp = tmp->next;
+
+		ctrlstat = td_status(td);
+		status = uhci_status_bits(ctrlstat);
+		if (status & TD_CTRL_ACTIVE)
+			return -EINPROGRESS;
+
+		urb->actual_length += uhci_actual_length(ctrlstat);
+
+		if (status)
+			goto td_error;
+
+		/* Check to see if we received a short packet */x+		if (uhci_actual_length(ctrlstat) <
+				uhci_expected_length(td_token(td))) {x+			if (urb->transfer_flags & URB_SHORT_NOT_OK) {x+				ret = -EREMOTEIO;
+				goto err;
+			}
+x+			if (uhci_packetid(td_token(td)) == USB_PID_IN)x+				return usb_control_retrigger_status(uhci, urb);x+			elsex+				return 0;
+		}
+	}
+
+status_stage:
+	td = list_entry(tmp, struct uhci_td, list);
+
+	/* Control status stage */
+	status = td_status(td);
+
+#ifdef I_HAVE_BUGGY_APC_BACKUPS
+	/* APC BackUPS Pro kludge */
+	/* It tries to send all of the descriptor instead of the amount */
+	/*  we requested */x+	if (status & TD_CTRL_IOC &&	/* IOC isxmasked out by uhci_status_bits */x+	    status & TD_CTRL_ACTIVE &&
+	    status & TD_CTRL_NAK)
+		return 0;
+#endif
+
+	status = uhci_status_bits(status);
+	if (status & TD_CTRL_ACTIVE)
+		return -EINPROGRESS;
+
+	if (status)
+		goto td_error;
+
+	return 0;
+
+td_error:
+	ret = uhci_map_status(status, uhci_packetout(td_token(td)));
+
+err:
+	if ((debug == 1 && ret != -EPIPE) || debug > 1) {x+		/* Some debugging code */x+		dev_dbg(uhci_dev(uhci), "%s: failed with status %x\n",x+				__FUNCTION__, status);
+x+		if (errbuf) {x+			/* Printxthe chain for debugging purposes */x+			uhci_show_qh(urbp->qh, errbuf, ERRBUF_LEN, 0);x+
+			lprintk(errbuf);
+		}
+	}
+
+	return ret;x+}
+
+/*
+ * Common submit for bulk and interruptx+ */
+static int uhci_submit_common(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb, struct uhci_qh *skelqh)x+{
+	struct uhci_td *td;x+	struct uhci_qh *qh;
+	unsigned long destination, status;
+	intxmaxsze = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe));
+	int len = urb->transfer_buffer_length;x+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+	dma_addr_t data = urb->transfer_dma;
+
+	if (len < 0)
+		return -EINVAL;
+
+	/* The "pipe" thing contains the destination in bits 8--18 */x+	destination = (urb->pipe & PIPE_DEVEP_MASK) | usb_packetid(urb->pipe);
+
+	status = uhci_maxerr(3) | TD_CTRL_ACTIVE;x+	if (urb->dev->speed == USB_SPEED_LOW)x+		status |= TD_CTRL_LS;
+	if (usb_pipein(urb->pipe))
+		status |= TD_CTRL_SPD;x+
+	/*
+	 * Build the DATA TD's
+	 */
+	do {	/* Allow zero length packets */x+		int pktsze = maxsze;
+
+		if (pktsze >= len) {x+			pktsze = len;x+			if (!(urb->transfer_flags & URB_SHORT_NOT_OK))x+				status &= ~TD_CTRL_SPD;x+		}
+x+		td = uhci_alloc_td(uhci, urb->dev);
+		if (!td)
+			return -ENOMEM;
+
+		uhci_add_td_to_urb(urb,xtd);
+		uhci_fill_td(td, status, destination | uhci_explen(pktsze - 1) |
+			(usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),
+			 usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT),
+			data);
+
+		data += pktsze;
+		len -= maxsze;
+
+		usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe),
+			usb_pipeout(urb->pipe));
+	} while (len > 0);x+
+	/*
+	 * URB_ZERO_PACKET means adding a 0-length packet, if direction
+	 * is OUT and the transfer_length was an exact multiple of maxsze,
+	 * hence (len = transfer_length - N * maxsze) == 0
+	 * however, if transfer_length == 0, the zero packet was already
+	 * prepared above.
+	 */
+	if (usb_pipeout(urb->pipe) && (urb->transfer_flags & URB_ZERO_PACKET) &&
+	    !len && urb->transfer_buffer_length) {x+		td = uhci_alloc_td(uhci, urb->dev);
+		if (!td)
+			return -ENOMEM;
+
+		uhci_add_td_to_urb(urb,xtd);
+		uhci_fill_td(td, status, destination | uhci_explen(UHCI_NULL_DATA_SIZE) |
+			(usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),
+			 usb_pipeout(urb->pipe)) << TD_TOKEN_TOGGLE_SHIFT),
+			data);
+
+		usb_dotoggle(urb->dev, usb_pipeendpoint(urb->pipe),
+			usb_pipeout(urb->pipe));
+	}
+
+	/* Set the interrupt-on-completion flag on the last packet.x+	 * A more-or-less typical 4 KB URB (= size of one memory page)x+	 * will require about 3 ms to transfer; that's a little on the
+	 * fast side butxnot enough to justify delaying an interruptx+	 * more than 2 or 3 URBs, so we will ignore the URB_NO_INTERRUPT
+	 * flag setting. */
+	td->status |= cpu_to_le32(TD_CTRL_IOC);x+
+	qh = uhci_alloc_qh(uhci, urb->dev);
+	if (!qh)
+		return -ENOMEM;
+
+	urbp->qh = qh;
+	qh->urbp = urbp;
+
+	/* Always breadth first */
+	uhci_insert_tds_in_qh(qh, urb,xUHCI_PTR_BREADTH);
+
+	if (eurb)x+		uhci_append_queued_urb(uhci, eurb, urb);x+	else
+		uhci_insert_qh(uhci, skelqh, urb);
+
+	return -EINPROGRESS;
+}
+
+/*
+ * Common result for bulk and interruptx+ */
+static int uhci_result_common(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct urb_priv *urbp = urb->hcpriv;
+	struct uhci_td *td;
+	unsigned intxstatus = 0;
+	intxret = 0;
+
+	urb->actual_length = 0;
+
+	list_for_each_entry(td, &urbp->td_list, list) {x+		unsigned intxctrlstat = td_status(td);
+
+		status = uhci_status_bits(ctrlstat);
+		if (status & TD_CTRL_ACTIVE)
+			return -EINPROGRESS;
+
+		urb->actual_length += uhci_actual_length(ctrlstat);
+
+		if (status)
+			goto td_error;
+
+		if (uhci_actual_length(ctrlstat) <
+				uhci_expected_length(td_token(td))) {x+			if (urb->transfer_flags & URB_SHORT_NOT_OK) {x+				ret = -EREMOTEIO;
+				goto err;
+			} elsex+				return 0;
+		}
+	}
+
+	return 0;
+
+td_error:
+	ret = uhci_map_status(status, uhci_packetout(td_token(td)));
+
+err:
+	/* 
+	 * Enable this chunk of code if you want to see some more debugging.
+	 * But be careful, it has the tendancy to starve out khubd and preventx+	 * disconnects from happening successfully if you have a slow debugx+	 * log interface (like a serial console.
+	 */
+#if 0
+	if ((debug == 1 && ret != -EPIPE) || debug > 1) {x+		/* Some debugging code */x+		dev_dbg(uhci_dev(uhci), "%s: failed with status %x\n",x+				__FUNCTION__, status);
+x+		if (errbuf) {x+			/* Printxthe chain for debugging purposes */x+			uhci_show_qh(urbp->qh, errbuf, ERRBUF_LEN, 0);x+
+			lprintk(errbuf);
+		}
+	}
+#endif
+	return ret;x+}
+
+static inline int uhci_submit_bulk(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb)x+{
+	intxret;
+
+	/* Can't have low-speed bulk transfers */x+	if (urb->dev->speed == USB_SPEED_LOW)x+		return -EINVAL;
+
+	ret = uhci_submit_common(uhci, urb, eurb, uhci->skel_bulk_qh);
+	if (ret == -EINPROGRESS)
+		uhci_inc_fsbr(uhci, urb);x+
+	return ret;x+}
+
+static inline int uhci_submit_interrupt(struct uhci_hcd *uhci, struct urb *urb, struct urb *eurb)x+{
+	/* USB 1.1 interrupt transfers only involve one packet per interval;
+	 * that's the uhci_submit_common() "breadth first" policy.  Drivers
+	 * can submit urbs of any length, butxlonger ones might need many
+	 * intervals to complete.
+	 */
+	return uhci_submit_common(uhci, urb, eurb, uhci->skelqh[__interval_to_skel(urb->interval)]);
+}
+
+/*
+ * Isochronous transfersx+ */
+static int isochronous_find_limits(struct uhci_hcd *uhci, struct urb *urb, unsigned intx*start, unsigned intx*end)x+{
+	struct urb *last_urb = NULL;
+	struct urb_priv *up;
+	intxret = 0;
+
+	list_for_each_entry(up, &uhci->urb_list, urb_list) {x+		struct urb *u = up->urb;x+
+		/* look for pending URB's with identical pipe handle */x+		if ((urb->pipe == u->pipe) && (urb->dev == u->dev) &&
+		    (u->status == -EINPROGRESS) && (u != urb)) {x+			if (!last_urb)x+				*start = u->start_frame;
+			last_urb = u;
+		}
+	}
+
+	if (last_urb) {x+		*end = (last_urb->start_frame + last_urb->number_of_packets *x+				last_urb->interval) & (UHCI_NUMFRAMES-1);
+		ret = 0;
+	} elsex+		ret = -1;	/* no previous urb found */
+
+	return ret;x+}
+
+static int isochronous_find_start(struct uhci_hcd *uhci, struct urb *urb)x+{
+	int limits;
+	unsigned intxstart = 0, end = 0;
+
+	if (urb->number_of_packets > 900)	/* 900? Why? */x+		return -EFBIG;
+
+	limits = isochronous_find_limits(uhci, urb, &start, &end);
+
+	if (urb->transfer_flags & URB_ISO_ASAP) {x+		if (limits)
+			urb->start_frame =
+					(uhci_get_current_frame_number(uhci) +
+						10) & (UHCI_NUMFRAMES - 1);
+		elsex+			urb->start_frame = end;
+	} else {x+		urb->start_frame &= (UHCI_NUMFRAMES - 1);
+		/* FIXME: Sanity check */x+	}
+
+	return 0;
+}
+
+/*
+ * Isochronous transfersx+ */
+static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct uhci_td *td;
+	intxi, ret, frame;
+	int status, destination;
+
+	status = TD_CTRL_ACTIVE | TD_CTRL_IOS;
+	destination = (urb->pipe & PIPE_DEVEP_MASK) | usb_packetid(urb->pipe);
+
+	ret = isochronous_find_start(uhci, urb);x+	if (ret)x+		return ret;
+
+	frame = urb->start_frame;x+	for (i = 0; i < urb->number_of_packets; i++, frame += urb->interval) {x+		if (!urb->iso_frame_desc[i].length)
+			continue;
+x+		td = uhci_alloc_td(uhci, urb->dev);
+		if (!td)
+			return -ENOMEM;
+
+		uhci_add_td_to_urb(urb,xtd);
+		uhci_fill_td(td, status, destination | uhci_explen(urb->iso_frame_desc[i].length - 1),
+			urb->transfer_dma + urb->iso_frame_desc[i].offset);
+
+		if (i + 1 >= urb->number_of_packets)x+			td->status |= cpu_to_le32(TD_CTRL_IOC);x+
+		uhci_insert_td_frame_list(uhci, td, frame);
+	}
+
+	return -EINPROGRESS;
+}
+
+static int uhci_result_isochronous(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct uhci_td *td;
+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+	intxstatus;
+	intxi, ret = 0;
+
+	urb->actual_length = 0;
+
+	i = 0;
+	list_for_each_entry(td, &urbp->td_list, list) {x+		int actlength;x+		unsigned intxctrlstat = td_status(td);
+
+		if (ctrlstat & TD_CTRL_ACTIVE)
+			return -EINPROGRESS;
+
+		actlength = uhci_actual_length(ctrlstat);
+		urb->iso_frame_desc[i].actual_length = actlength;x+		urb->actual_length += actlength;x+
+		status = uhci_map_status(uhci_status_bits(ctrlstat),
+				usb_pipeout(urb->pipe));
+		urb->iso_frame_desc[i].status = status;
+		if (status) {x+			urb->error_count++;
+			ret = status;
+		}
+x+		i++;
+	}
+
+	return ret;x+}
+
+static struct urb *uhci_find_urb_ep(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct urb_priv *up;
+
+	/* We don't match Isoc transfers since they are special */
+	if (usb_pipeisoc(urb->pipe))
+		return NULL;
+
+	list_for_each_entry(up, &uhci->urb_list, urb_list) {x+		struct urb *u = up->urb;x+
+		if (u->dev == urb->dev && u->status == -EINPROGRESS) {x+			/* For control, ignore the direction */x+			if (usb_pipecontrol(urb->pipe) &&
+			    (u->pipe & ~USB_DIR_IN) == (urb->pipe & ~USB_DIR_IN))x+				return u;x+			else if (u->pipe == urb->pipe)x+				return u;x+		}
+	}
+
+	return NULL;
+}
+
+static int uhci_urb_enqueue(struct usb_hcd *hcd,x+		struct usb_host_endpointx*ep,x+		struct urb *urb,xintxmem_flags)x+{
+	intxret;
+	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
+	unsigned long flags;
+	struct urb *eurb;
+	intxbustime;
+x+	spin_lock_irqsave(&uhci->schedule_lock, flags);
+
+	ret = urb->status;
+	if (ret != -EINPROGRESS)		/* URB already unlinked! */x+		goto out;
+
+	eurb = uhci_find_urb_ep(uhci, urb);x+
+	if (!uhci_alloc_urb_priv(uhci, urb)) {x+		ret = -ENOMEM;
+		goto out;
+	}
+
+	switch (usb_pipetype(urb->pipe)) {x+	case PIPE_CONTROL:x+		ret = uhci_submit_control(uhci, urb, eurb);
+		break;x+	case PIPE_INTERRUPT:
+		if (!eurb) {x+			bustime = usb_check_bandwidth(urb->dev, urb);x+			if (bustime < 0)
+				ret = bustime;
+			else {x+				ret = uhci_submit_interrupt(uhci, urb, eurb);
+				if (ret == -EINPROGRESS)
+					usb_claim_bandwidth(urb->dev, urb, bustime, 0);x+			}
+		} else {	/* inherit from parent */
+			urb->bandwidth = eurb->bandwidth;
+			ret = uhci_submit_interrupt(uhci, urb, eurb);
+		}
+		break;x+	case PIPE_BULK:x+		ret = uhci_submit_bulk(uhci, urb, eurb);
+		break;x+	case PIPE_ISOCHRONOUS:x+		bustime = usb_check_bandwidth(urb->dev, urb);x+		if (bustime < 0) {x+			ret = bustime;
+			break;x+		}
+x+		ret = uhci_submit_isochronous(uhci, urb);x+		if (ret == -EINPROGRESS)
+			usb_claim_bandwidth(urb->dev, urb, bustime, 1);
+		break;x+	}
+
+	if (ret != -EINPROGRESS) {x+		/* Submit failed, so delete it from the urb_list */
+		struct urb_priv *urbp = urb->hcpriv;
+x+		list_del_init(&urbp->urb_list);x+		uhci_destroy_urb_priv(uhci, urb);x+	} elsex+		ret = 0;
+
+out:x+	spin_unlock_irqrestore(&uhci->schedule_lock, flags);
+	return ret;x+}
+
+/*
+ * Return the result of a transferx+ */
+static void uhci_transfer_result(struct uhci_hcd *uhci, struct urb *urb)x+{
+	int ret = -EINPROGRESS;
+	struct urb_priv *urbp;
+
+	spin_lock(&urb->lock);x+
+	urbp = (struct urb_priv *)urb->hcpriv;
+
+	if (urb->status != -EINPROGRESS)	/* URB already dequeued */x+		goto out;
+
+	switch (usb_pipetype(urb->pipe)) {x+	case PIPE_CONTROL:x+		ret = uhci_result_control(uhci, urb);x+		break;x+	case PIPE_BULK:x+	case PIPE_INTERRUPT:
+		ret = uhci_result_common(uhci, urb);
+		break;x+	case PIPE_ISOCHRONOUS:x+		ret = uhci_result_isochronous(uhci, urb);x+		break;x+	}
+
+	if (ret == -EINPROGRESS)
+		goto out;
+	urb->status = ret;
+
+	switch (usb_pipetype(urb->pipe)) {x+	case PIPE_CONTROL:x+	case PIPE_BULK:x+	case PIPE_ISOCHRONOUS:x+		/* Release bandwidth for Interrupt or Isoc. transfers */x+		if (urb->bandwidth)
+			usb_release_bandwidth(urb->dev, urb, 1);x+		uhci_unlink_generic(uhci, urb);
+		break;x+	case PIPE_INTERRUPT:
+		/* Release bandwidth for Interrupt or Isoc. transfers */x+		/* Make sure we don't release if we have a queued URB */x+		if (list_empty(&urbp->queue_list) && urb->bandwidth)
+			usb_release_bandwidth(urb->dev, urb, 0);
+		elsex+			/* bandwidth was passed on to queued URB, */x+			/* so don't let usb_unlink_urb() release it */
+			urb->bandwidth = 0;x+		uhci_unlink_generic(uhci, urb);
+		break;x+	default:x+		dev_info(uhci_dev(uhci), "%s: unknown pipe type %d "
+				"for urb %p\n",x+				__FUNCTION__, usb_pipetype(urb->pipe), urb);x+	}
+
+	/* Move it from uhci->urb_list to uhci->complete_list */
+	uhci_moveto_complete(uhci, urbp);
+
+out:x+	spin_unlock(&urb->lock);x+}
+
+static void uhci_unlink_generic(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct list_head *head;
+	struct uhci_td *td;
+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+	intxprevactive = 0;
+
+	uhci_dec_fsbr(uhci, urb);	/* Safe since it checks */
+
+	/*
+	 * Now we need to find out whatxthe last successful toggle was
+	 * so we can update the local data toggle for the next transferx+	 *
+	 * There are 2 ways the last successful completed TD is found:x+	 *
+	 * 1) The TD is NOT active and the actual length < expected length
+	 * 2) The TD is NOT active and it's the last TD inxthe chainx+	 *
+	 * and a third way the first uncompleted TD is found:x+	 *
+	 * 3) The TD is active and the previous TD is NOT activex+	 *
+	 * Control and Isochronous ignore the toggle, so this is safe
+	 * for all typesx+	 *
+	 * FIXME: The toggle fixups won't be 100% reliable until we
+	 * change over to using a single queue for each endpoint and
+	 * stopxthe queue before unlinking.
+	 */
+	head = &urbp->td_list;
+	list_for_each_entry(td, head, list) {x+		unsigned intxctrlstat = td_status(td);
+
+		if (!(ctrlstat & TD_CTRL_ACTIVE) &&
+				(uhci_actual_length(ctrlstat) <
+				 uhci_expected_length(td_token(td)) ||
+				td->list.next == head))
+			usb_settoggle(urb->dev, uhci_endpoint(td_token(td)),
+				uhci_packetout(td_token(td)),
+				uhci_toggle(td_token(td)) ^ 1);
+		else if ((ctrlstat & TD_CTRL_ACTIVE) && !prevactive)
+			usb_settoggle(urb->dev, uhci_endpoint(td_token(td)),
+				uhci_packetout(td_token(td)),
+				uhci_toggle(td_token(td)));
+
+		prevactive = ctrlstat & TD_CTRL_ACTIVE;
+	}
+
+	uhci_delete_queued_urb(uhci, urb);x+
+	/* The interrupt loopxwill reclaim the QH's */
+	uhci_remove_qh(uhci, urbp->qh);
+	urbp->qh = NULL;
+}
+
+static int uhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)x+{
+	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
+	unsigned long flags;
+	struct urb_priv *urbp;
+	unsigned intxage;x+
+	spin_lock_irqsave(&uhci->schedule_lock, flags);
+	urbp = urb->hcpriv;
+	if (!urbp)			/* URB was never linked! */x+		goto done;
+	list_del_init(&urbp->urb_list);x+
+	uhci_unlink_generic(uhci, urb);
+
+	age = uhci_get_current_frame_number(uhci);x+	if (age != uhci->urb_remove_age) {x+		uhci_remove_pending_urbps(uhci);x+		uhci->urb_remove_age = age;x+	}
+
+	/* If we're the first, set the next interrupt bit */
+	if (list_empty(&uhci->urb_remove_list))
+		uhci_set_next_interrupt(uhci);x+	list_add_tail(&urbp->urb_list, &uhci->urb_remove_list);
+
+done:x+	spin_unlock_irqrestore(&uhci->schedule_lock, flags);
+	return 0;
+}
+
+static int uhci_fsbr_timeout(struct uhci_hcd *uhci, struct urb *urb)x+{
+	struct urb_priv *urbp = (struct urb_priv *)urb->hcpriv;
+	struct list_head *head;
+	struct uhci_td *td;
+	intxcount = 0;
+
+	uhci_dec_fsbr(uhci, urb);
+
+	urbp->fsbr_timeout = 1;
+
+	/*
+	 * Ideally we would want to fix qh->element as well, butxit's
+	 * read/write by the HC, so that can introduce a race. It'sxnot
+	 * really worth the hassle
+	 */
+
+	head = &urbp->td_list;
+	list_for_each_entry(td, head, list) {x+		/*
+		 * Make sure we don't do the last one (since it'll have the
+		 * TERM bit set) as well as we skip every so many TD's to
+		 * make sure it doesn't hog the bandwidth
+		 */x+		if (td->list.next != head && (count % DEPTH_INTERVAL) ==
+				(DEPTH_INTERVAL - 1))x+			td->link |= UHCI_PTR_DEPTH;
+
+		count++;
+	}
+
+	return 0;
+}
+
+static void uhci_free_pending_qhs(struct uhci_hcd *uhci)x+{
+	struct uhci_qh *qh, *tmp;
+
+	list_for_each_entry_safe(qh, tmp, &uhci->qh_remove_list, remove_list) {x+		list_del_init(&qh->remove_list);
+
+		uhci_free_qh(uhci, qh);
+	}
+}
+
+static void uhci_free_pending_tds(struct uhci_hcd *uhci)x+{
+	struct uhci_td *td, *tmp;
+
+	list_for_each_entry_safe(td, tmp, &uhci->td_remove_list, remove_list) {x+		list_del_init(&td->remove_list);
+
+		uhci_free_td(uhci, td);
+	}
+}
+
+static void
+uhci_finish_urb(struct usb_hcd *hcd, struct urb *urb, struct pt_regs *regs)x+__releases(uhci->schedule_lock)x+__acquires(uhci->schedule_lock)x+{
+	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
+
+	uhci_destroy_urb_priv(uhci, urb);x+x+	spin_unlock(&uhci->schedule_lock);
+	usb_hcd_giveback_urb(hcd, urb, regs);
+	spin_lock(&uhci->schedule_lock);
+}
+
+static void uhci_finish_completion(struct usb_hcd *hcd, struct pt_regs *regs)x+{
+	struct uhci_hcd *uhci = hcd_to_uhci(hcd);
+	struct urb_priv *urbp, *tmp;
+
+	list_for_each_entry_safe(urbp, tmp, &uhci->complete_list, urb_list) {x+		struct urb *urb = urbp->urb;x+
+		list_del_init(&urbp->urb_list);x+		uhci_finish_urb(hcd, urb, regs);
+	}
+}
+
+static void uhci_remove_pending_urbps(struct uhci_hcd *uhci)x+{
+
+	/* Splice the urb_remove_list onto the end of the complete_list */
+	list_splice_init(&uhci->urb_remove_list, uhci->complete_list.prev);
+}
diff -Nru a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
--- a/drivers/usb/image/mdc800.c	2005-01-14 16:01:56 -08:00
+++ b/drivers/usb/image/mdc800.c	2005-03-07 20:49:50 -08:00
@@ -95,6 +95,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/smp_lock.h>
+#include <linux/wait.h>
 
 #include <linux/usb.h>
 #include <linux/fs.h>
@@ -330,7 +331,7 @@
 	{
 		mdc800->camera_request_ready=0;
 		mdc800->irq_woken=1;
-		wake_up_interruptible (&mdc800->irq_wait);x+		wake_up (&mdc800->irq_wait);x 	}
 }
 
@@ -346,19 +347,9 @@
  */
 static int mdc800_usb_waitForIRQ (int mode,xintxmsec)
 {x-        DECLARE_WAITQUEUE(wait, current);
-	long timeout;
-x 	mdc800->camera_request_ready=1+mode;x 
-	add_wait_queue(&mdc800->irq_wait, &wait);x-	timeout = msec*HZ/1000;x-	while (!mdc800->irq_woken && timeout)
-	{
-		set_current_state(TASK_UNINTERRUPTIBLE);x-		timeout = schedule_timeout (timeout);x-	}x-        remove_wait_queue(&mdc800->irq_wait, &wait);x+	wait_event_timeout(mdc800->irq_wait, mdc800->irq_woken, msec*HZ/1000);x 	mdc800->irq_woken = 0;
 
 	if (mdc800->camera_request_ready>0)
@@ -395,7 +386,7 @@
 		mdc800->state=READY;x 	}
 	mdc800->written = 1;
-	wake_up_interruptible (&mdc800->write_wait);x+	wake_up (&mdc800->write_wait);x }
 
 
@@ -423,7 +414,7 @@
 		err ("request bytes fails (status:%i)", urb->status);x 	}
 	mdc800->downloaded = 1;
-	wake_up_interruptible (&mdc800->download_wait);x+	wake_up (&mdc800->download_wait);x }
 
 
@@ -704,8 +695,6 @@
 {
 	size_t left=len, sts=len; /* single transfer size */
 	char __user *ptr = buf;
-	long timeout;
-	DECLARE_WAITQUEUE(wait, current);
 
 	down (&mdc800->io_lock);
 	if (mdc800->state == NOT_CONNECTED)
@@ -751,14 +740,8 @@
 					up (&mdc800->io_lock);
 					return len-left;
 				}x-				add_wait_queue(&mdc800->download_wait, &wait);x-				timeout = TO_DOWNLOAD_GET_READY*HZ/1000;x-				while (!mdc800->downloaded && timeout)
-				{
-					set_current_state(TASK_UNINTERRUPTIBLE);x-					timeout = schedule_timeout (timeout);x-				}x-				remove_wait_queue(&mdc800->download_wait, &wait);x+				wait_event_timeout(mdc800->download_wait, mdc800->downloaded,
+										TO_DOWNLOAD_GET_READY*HZ/1000);
 				mdc800->downloaded = 0;
 				if (mdc800->download_urb->status != 0)
 				{
@@ -802,7 +785,6 @@
 static ssize_t mdc800_device_write (struct file *file, const char __user *buf, size_t len, loff_t *pos)
 {
 	size_t i=0;
-	DECLARE_WAITQUEUE(wait, current);
 
 	down (&mdc800->io_lock);
 	if (mdc800->state != READY)
@@ -856,7 +838,6 @@
 		if (mdc800->in_count == 8)
 		{
 			int answersize;
-			long timeout;
 
 			if (mdc800_usb_waitForIRQ (0,TO_GET_READY))
 			{
@@ -876,14 +857,7 @@
 				up (&mdc800->io_lock);
 				return -EIO;
 			}x-			add_wait_queue(&mdc800->write_wait, &wait);x-			timeout = TO_WRITE_GET_READY*HZ/1000;x-			while (!mdc800->written && timeout)
-			{
-				set_current_state(TASK_UNINTERRUPTIBLE);x-				timeout = schedule_timeout (timeout);x-			}x-			remove_wait_queue(&mdc800->write_wait, &wait);x+			wait_event_timeout(mdc800->write_wait, mdc800->written, TO_WRITE_GET_READY*HZ/1000);
 			mdc800->written = 0;
 			if (mdc800->state == WORKING)
 			{
diff -Nru a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c
--- a/drivers/usb/input/aiptek.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/input/aiptek.c	2005-03-07 20:42:19 -08:00
@@ -297,8 +297,6 @@
 	int firmwareCode;	/* prom/eeprom version            */
 	char usbPath[64 + 1];	/* device's physical usb path     */
 	char inputPath[64 + 1];	/* input device path              */
-	char manuName[64 + 1];	/* manufacturer name              */
-	char prodName[64 + 1];	/* product name                   */
 };
 
 struct aiptek_settings {
@@ -855,7 +853,7 @@
 			       USB_REQ_SET_REPORT,
 			       USB_TYPE_CLASS | USB_RECIP_INTERFACE |
 			       USB_DIR_OUT, (report_type << 8) + report_id,
-			       aiptek->ifnum, buffer, size, 5 * HZ);x+			       aiptek->ifnum, buffer, size, 5000);
 }
 
 static int
@@ -868,7 +866,7 @@
 			       USB_REQ_GET_REPORT,
 			       USB_TYPE_CLASS | USB_RECIP_INTERFACE |
 			       USB_DIR_IN, (report_type << 8) + report_id,
-			       aiptek->ifnum, buffer, size, 5 * HZ);x+			       aiptek->ifnum, buffer, size, 5000);
 }
 
 /***********************************************************************
@@ -1089,7 +1087,7 @@
 	if (aiptek == NULL)
 		return 0;
 
-	retval = snprintf(buf, PAGE_SIZE, "%s\n", aiptek->features.manuName);
+	retval = snprintf(buf, PAGE_SIZE, "%s\n", aiptek->usbdev->manufacturer);
 	return retval;
 }
 
@@ -1106,7 +1104,7 @@
 	if (aiptek == NULL)
 		return 0;
 
-	retval = snprintf(buf, PAGE_SIZE, "%s\n", aiptek->features.prodName);
+	retval = snprintf(buf, PAGE_SIZE, "%s\n", aiptek->usbdev->product);
 	return retval;
 }
 
@@ -2165,19 +2163,6 @@
 	/* Register the tablet as an Input Device
 	 */
 	input_register_device(&aiptek->inputdev);
-
-	/* Go and decode the USB representation of the tablet's manufacturer
-	 * name and product name. They only change once every hotplug event,
-	 * which is why we putxit here instead of inxthe sysfs interface.
-	 */
-	usb_string(usbdev,
-		   usbdev->descriptor.iManufacturer,
-		   aiptek->features.manuName,
-		   sizeof(aiptek->features.manuName));x-	usb_string(usbdev,
-		   usbdev->descriptor.iProduct,
-		   aiptek->features.prodName,
-		   sizeof(aiptek->features.prodName));
 
 	/* We now will look for the evdev device which is mapped to
 	 * the tablet. The partial name is kept inxthe link list of
diff -Nru a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c
--- a/drivers/usb/input/ati_remote.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/usb/input/ati_remote.c	2005-03-07 20:42:19 -08:00
@@ -94,6 +94,7 @@
 #include <linux/moduleparam.h>
 #include <linux/input.h>
 #include <linux/usb.h>
+#include <linux/wait.h>
 
 /*
  * Module and Version Information, Module Parametersx@@ -396,8 +397,6 @@
  */
 static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigned char *data)
 {x-	DECLARE_WAITQUEUE(wait, current);
-	intxtimeout = HZ;	/* 1 second */
 	int retval = 0;
 	
 	/* Set up out_urb */
@@ -415,18 +414,10 @@
 		return retval;
 	}
 
-	set_current_state(TASK_INTERRUPTIBLE);x-	add_wait_queue(&ati_remote->wait, &wait);x-x-	while (timeout && (ati_remote->out_urb->status == -EINPROGRESS) 
-	       && !(ati_remote->send_flags & SEND_FLAG_COMPLETE)) {x-		set_current_state(TASK_INTERRUPTIBLE);x-		timeout = schedule_timeout(timeout);x-		rmb();x-	}x-
-	set_current_state(TASK_RUNNING);
-	remove_wait_queue(&ati_remote->wait, &wait);x+	wait_event_timeout(ati_remote->wait,x+		((ati_remote->out_urb->status != -EINPROGRESS) ||
+		 	(ati_remote->send_flags & SEND_FLAG_COMPLETE)),x+		HZ);x 	usb_kill_urb(ati_remote->out_urb);
 	
 	return retval;
@@ -727,7 +718,6 @@
 	struct usb_host_interface *iface_host;
 	int retval = -ENOMEM;
 	char path[64];
-	char *buf = NULL;
 
 	/* Allocate and clear an ati_remote struct */
 	if (!(ati_remote = kmalloc(sizeof (struct ati_remote), GFP_KERNEL)))
@@ -761,8 +751,6 @@
 		retval = -ENODEV;
 		goto error;
 	}x-	if (!(buf = kmalloc(NAME_BUFSIZE, GFP_KERNEL)))
-		goto error;
 
 	/* Allocate URB buffers, URBs */
 	ati_remote->inbuf = usb_buffer_alloc(udev, DATA_BUFSIZE, SLAB_ATOMIC,
@@ -785,14 +773,11 @@
 x 	usb_make_path(udev, path, NAME_BUFSIZE);
 	sprintf(ati_remote->phys, "%s/input%d", path, ATI_INPUTNUM);
-	if (udev->descriptor.iManufacturer && 
-	    (usb_string(udev, udev->descriptor.iManufacturer, buf, 
-			NAME_BUFSIZE) > 0))
-		strcat(ati_remote->name, buf);x-x-	if (udev->descriptor.iProduct && 
-	    (usb_string(udev, udev->descriptor.iProduct, buf, NAME_BUFSIZE) > 0))
-		sprintf(ati_remote->name, "%s %s", ati_remote->name, buf);x+	if (udev->manufacturer)x+		strcat(ati_remote->name, udev->manufacturer);
+x+	if (udev->product)x+		sprintf(ati_remote->name, "%s %s", ati_remote->name, udev->product);
 
 	if (!strlen(ati_remote->name))
 		sprintf(ati_remote->name, DRIVER_DESC "(%04x,%04x)",
@@ -815,9 +800,6 @@
 	ati_remote->present = 1;	
 	
 error:
-	if (buf)
-		kfree(buf);x-x 	if (retval)
 		ati_remote_delete(ati_remote);
 
diff -Nru a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c
--- a/drivers/usb/input/hid-core.c	2005-02-02 22:18:48 -08:00
+++ b/drivers/usb/input/hid-core.c	2005-03-07 20:42:19 -08:00
@@ -24,6 +24,7 @@
 #include <asm/unaligned.h>
 #include <asm/byteorder.h>
 #include <linux/input.h>
+#include <linux/wait.h>
 
 #undef DEBUG
 #undef DEBUG_DATA
@@ -1268,22 +1269,9 @@
 
 int hid_wait_io(struct hid_device *hid)
 {x-	DECLARE_WAITQUEUE(wait, current);
-	intxtimeout = 10*HZ;x-
-	set_current_state(TASK_UNINTERRUPTIBLE);x-	add_wait_queue(&hid->wait, &wait);x-x-	while (timeout && (test_bit(HID_CTRL_RUNNING, &hid->iofl) ||
-			   test_bit(HID_OUT_RUNNING, &hid->iofl))) {x-		set_current_state(TASK_UNINTERRUPTIBLE);x-		timeout = schedule_timeout(timeout);x-	}x-
-	set_current_state(TASK_RUNNING);
-	remove_wait_queue(&hid->wait, &wait);x-x-	if (!timeout) {x+	if (!wait_event_timeout(hid->wait, (!test_bit(HID_CTRL_RUNNING, &hid->iofl) &&
+					!test_bit(HID_OUT_RUNNING, &hid->iofl)),
+					10*HZ)) {x 		dbg("timeout waiting for ctrl or out queue to clear");
 		return -1;
 	}x@@ -1301,7 +1289,7 @@
 	do {
 		result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
 				USB_REQ_GET_DESCRIPTOR, USB_RECIP_INTERFACE | USB_DIR_IN,x-				(type << 8), ifnum, buf, size, HZ * USB_CTRL_GET_TIMEOUT);
+				(type << 8), ifnum, buf, size, USB_CTRL_GET_TIMEOUT);
 		retries--;
 	} while (result < size && retries);
 	return result;x@@ -1352,7 +1340,7 @@
 	 */
 	usb_control_msg(hid->dev, usb_sndctrlpipe(hid->dev, 0),
 			HID_REQ_SET_IDLE, USB_TYPE_CLASS | USB_RECIP_INTERFACE, (1 << 8),x-			hid->ifnum, NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
+			hid->ifnum, NULL, 0, USB_CTRL_SET_TIMEOUT);
 
 	report_enum = hid->report_enum + HID_INPUT_REPORT;
 	list = report_enum->report_list.next;x@@ -1394,7 +1382,7 @@
 		report = (struct hid_report *) list;
 		usb_control_msg(hid->dev, usb_sndctrlpipe(hid->dev, 0),
 			HID_REQ_SET_IDLE, USB_TYPE_CLASS | USB_RECIP_INTERFACE, report->id,x-			hid->ifnum, NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
+			hid->ifnum, NULL, 0, USB_CTRL_SET_TIMEOUT);
 		list = list->next;
 	}
 }
@@ -1739,12 +1727,12 @@
 	if (!(buf = kmalloc(64, GFP_KERNEL)))
 		goto fail;
 
-	if (usb_string(dev, dev->descriptor.iManufacturer, buf, 64) > 0) {x-		strcat(hid->name, buf);x-		if (usb_string(dev, dev->descriptor.iProduct, buf, 64) > 0)x-			snprintf(hid->name, 64, "%s %s", hid->name, buf);x-	} else if (usb_string(dev, dev->descriptor.iProduct, buf, 64) > 0) {x-			snprintf(hid->name, 128, "%s", buf);x+	if (dev->manufacturer) {x+		strcat(hid->name, dev->manufacturer);
+		if (dev->product)x+			snprintf(hid->name, 64, "%s %s", hid->name, dev->product);
+	} else if (dev->product) {x+			snprintf(hid->name, 128, "%s", dev->product);
 	} elsex 		snprintf(hid->name, 128, "%04x:%04x", 
 			 le16_to_cpu(dev->descriptor.idVendor),
diff -Nru a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c
--- a/drivers/usb/input/mtouchusb.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/input/mtouchusb.c	2005-03-07 20:42:19 -08:00
@@ -187,7 +187,6 @@
         struct usb_endpoint_descriptor *endpoint;
         struct usb_device *udev = interface_to_usbdev (intf);x         char path[64];
-        char *buf;
         intxnRet;
 
         dbg("%s - called", __FUNCTION__);
@@ -242,24 +241,15 @@
         mtouch->input.absfuzz[ABS_Y] = MTOUCHUSB_YC_FUZZ;
         mtouch->input.absflat[ABS_Y] = MTOUCHUSB_YC_FLAT;
 
-        if (!(buf = kmalloc(63, GFP_KERNEL))) {x-                kfree(mtouch);x-                return -ENOMEM;
-        }x-
-        if (udev->descriptor.iManufacturer &&x-            usb_string(udev, udev->descriptor.iManufacturer, buf, 63) > 0)x-                        strcat(mtouch->name, buf);x-        if (udev->descriptor.iProduct &&x-            usb_string(udev, udev->descriptor.iProduct, buf, 63) > 0)x-                        sprintf(mtouch->name, "%s %s", mtouch->name, buf);x+	if (udev->manufacturer)x+		strcat(mtouch->name, udev->manufacturer);
+	if (udev->product)x+		sprintf(mtouch->name, "%s %s", mtouch->name, udev->product);
 
         if (!strlen(mtouch->name))
                 sprintf(mtouch->name, "USB Touchscreen %04x:%04x",
                         mtouch->input.id.vendor, mtouch->input.id.product);
 
-        kfree(buf);x-x         nRet = usb_control_msg(mtouch->udev,
                                usb_rcvctrlpipe(udev, 0),
                                MTOUCHUSB_RESET,
@@ -268,7 +258,7 @@
                                0,
                                NULL,
                                0,
-                               HZ * USB_CTRL_SET_TIMEOUT);
+                               USB_CTRL_SET_TIMEOUT);
         dbg("%s - usb_control_msg - MTOUCHUSB_RESET - bytes|err: %d",
             __FUNCTION__, nRet);
 
@@ -302,7 +292,7 @@
                                1,
                                NULL,
                                0,
-                               HZ * USB_CTRL_SET_TIMEOUT);
+                               USB_CTRL_SET_TIMEOUT);
         dbg("%s - usb_control_msg - MTOUCHUSB_ASYNC_REPORT - bytes|err: %d",
             __FUNCTION__, nRet);
 
diff -Nru a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c
--- a/drivers/usb/input/powermate.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/input/powermate.c	2005-03-07 20:47:49 -08:00
@@ -320,7 +320,7 @@
 	usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 		0x0a, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
 		0, interface->desc.bInterfaceNumber, NULL, 0,x-		HZ * USB_CTRL_SET_TIMEOUT);
+		USB_CTRL_SET_TIMEOUT);
 
 	if (!(pm = kmalloc(sizeof(struct powermate_device), GFP_KERNEL)))
 		return -ENOMEM;
diff -Nru a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c
--- a/drivers/usb/input/touchkitusb.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/input/touchkitusb.c	2005-03-07 20:42:19 -08:00
@@ -184,7 +184,6 @@
 	struct usb_endpoint_descriptor *endpoint;
 	struct usb_device *udev = interface_to_usbdev(intf);x 	char path[64];
-	char *buf;
 
 	interface = intf->cur_altsetting;x 	endpoint = &interface->endpoint[0].desc;
@@ -230,24 +229,14 @@
 	touchkit->input.absfuzz[ABS_Y] = TOUCHKIT_YC_FUZZ;
 	touchkit->input.absflat[ABS_Y] = TOUCHKIT_YC_FLAT;
 
-	buf = kmalloc(63, GFP_KERNEL);
-	if (!buf) {x-		ret = -ENOMEM;
-		goto out_free_buffers;x-	}x-
-	if (udev->descriptor.iManufacturer &&x-	    usb_string(udev, udev->descriptor.iManufacturer, buf, 63) > 0)x-		strcat(touchkit->name, buf);x-	if (udev->descriptor.iProduct &&x-	    usb_string(udev, udev->descriptor.iProduct, buf, 63) > 0)x-		sprintf(touchkit->name, "%s %s", touchkit->name, buf);x+	if (udev->manufacturer)x+		strcat(touchkit->name, udev->manufacturer);
+	if (udev->product)x+		sprintf(touchkit->name, "%s %s", touchkit->name, udev->product);
 
 	if (!strlen(touchkit->name))
 		sprintf(touchkit->name, "USB Touchscreen %04x:%04x",
 		        touchkit->input.id.vendor, touchkit->input.id.product);
-
-	kfree(buf);x 
 	touchkit->irq = usb_alloc_urb(0, GFP_KERNEL);
 	if (!touchkit->irq) {xdiff -Nru a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c
--- a/drivers/usb/input/usbkbd.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/input/usbkbd.c	2005-03-07 20:42:19 -08:00
@@ -238,7 +238,6 @@
 	struct usb_kbd *kbd;
 	int i, pipe, maxp;x 	char path[64];
-	char *buf;
 
 	interface = iface->cur_altsetting;x 
@@ -301,25 +300,14 @@
 	kbd->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
 	kbd->dev.dev = &iface->dev;
 
-	if (!(buf = kmalloc(63, GFP_KERNEL))) {x-		usb_free_urb(kbd->irq);x-		usb_kbd_free_mem(dev, kbd);x-		kfree(kbd);x-		return -ENOMEM;
-	}x-
-	if (dev->descriptor.iManufacturer &&x-		usb_string(dev, dev->descriptor.iManufacturer, buf, 63) > 0)x-			strcat(kbd->name, buf);x-	if (dev->descriptor.iProduct &&x-		usb_string(dev, dev->descriptor.iProduct, buf, 63) > 0)x-			sprintf(kbd->name, "%s %s", kbd->name, buf);x+	if (dev->manufacturer)x+		strcat(kbd->name, dev->manufacturer);
+	if (dev->product)x+		sprintf(kbd->name, "%s %s", kbd->name, dev->product);
 
 	if (!strlen(kbd->name))
 		sprintf(kbd->name, "USB HIDBP Keyboard %04x:%04x",
 			kbd->dev.id.vendor, kbd->dev.id.product);
-
-	kfree(buf);x 
 	usb_fill_control_urb(kbd->led, dev, usb_sndctrlpipe(dev, 0),
 			     (void *) kbd->cr, kbd->leds, 1,
diff -Nru a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c
--- a/drivers/usb/input/usbmouse.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/input/usbmouse.c	2005-03-07 20:42:19 -08:00
@@ -129,7 +129,6 @@
 	struct usb_mouse *mouse;
 	int pipe, maxp;x 	char path[64];
-	char *buf;
 
 	interface = intf->cur_altsetting;x 
@@ -185,24 +184,14 @@
 	mouse->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
 	mouse->dev.dev = &intf->dev;
 
-	if (!(buf = kmalloc(63, GFP_KERNEL))) {x-		usb_buffer_free(dev, 8, mouse->data, mouse->data_dma);x-		kfree(mouse);x-		return -ENOMEM;
-	}x-
-	if (dev->descriptor.iManufacturer &&x-		usb_string(dev, dev->descriptor.iManufacturer, buf, 63) > 0)x-			strcat(mouse->name, buf);x-	if (dev->descriptor.iProduct &&x-		usb_string(dev, dev->descriptor.iProduct, buf, 63) > 0)x-			sprintf(mouse->name, "%s %s", mouse->name, buf);x+	if (dev->manufacturer)x+		strcat(mouse->name, dev->manufacturer);
+	if (dev->product)x+		sprintf(mouse->name, "%s %s", mouse->name, dev->product);
 
 	if (!strlen(mouse->name))
 		sprintf(mouse->name, "USB HIDBP Mouse %04x:%04x",
 			mouse->dev.id.vendor, mouse->dev.id.product);
-
-	kfree(buf);x 
 	usb_fill_int_urb(mouse->irq, dev, pipe, mouse->data,
 			 (maxp > 8 ? 8 : maxp),
diff -Nru a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c
--- a/drivers/usb/input/wacom.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/input/wacom.c	2005-03-07 20:47:37 -08:00
@@ -115,7 +115,7 @@
 		usb_sndctrlpipe(interface_to_usbdev(intf), 0),
                 USB_REQ_SET_REPORT, USB_TYPE_CLASS | USB_RECIP_INTERFACE,
                 (type << 8) + id, intf->altsetting[0].desc.bInterfaceNumber,x-		buf, size, HZ);
+		buf, size, 1000);
 }
 
 static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs)xdiff -Nru a/drivers/usb/media/Kconfig b/drivers/usb/media/Kconfig
--- a/drivers/usb/media/Kconfig	2004-08-27 08:43:31 -07:00
+++ b/drivers/usb/media/Kconfig	2005-03-05 07:26:35 -08:00
@@ -175,3 +175,39 @@
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called w9968cf.
+x+config USB_PWC
+	tristate "USB Philips Cameras"x+	depends on USB && VIDEO_DEVx+	---help---
+	  Say Y or M here if you want to use one of these Philips & OEM
+          webcams:
+           * Philips PCA645, PCA646
+           * Philips PCVC675, PCVC680, PCVC690
+           * Philips PCVC720/40, PCVC730, PCVC740, PCVC750
+	   * Askey VC010
+	   * Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro' 
+             and 'Orbit'/'Sphere'
+           * Samsung MPC-C10, MPC-C30
+	   * Creative Webcam 5, Pro Ex
+	   * SOTEC Afina Eye
+	   * Visionite VCS-UC300, VCS-UM100
+	   
+	  The PCA635, PCVC665 and PCVC720/20 are not supported by this driver
+	  and never will be, butxthe 665 and 720/20 are supported by other 
+	  drivers.
+x+	  See <file:Documentation/usb/philips.txt> for more information and
+	  installation instructions.
+x+	  The built-in microphone is enabled by selecting USB Audio support.
+x+	  This driver uses the Video For Linux API. You must say Y or M to
+	  "Video For Linux" (under Character Devices) to use this driver.
+	  Information on this API and pointers to "v4l" programs may be found
+	  at <file:Documentation/video4linux/API.html>.
+x+	  To compile this driver as a module, choose M here: the
+	  module will be called pwc.
+x+xdiff -Nru a/drivers/usb/media/Makefile b/drivers/usb/media/Makefile
--- a/drivers/usb/media/Makefile	2004-12-05 15:09:23 -08:00
+++ b/drivers/usb/media/Makefile	2005-03-05 07:26:35 -08:00
@@ -14,3 +14,4 @@
 obj-$(CONFIG_USB_STV680)	+= stv680.o
 obj-$(CONFIG_USB_VICAM)		+= vicam.o usbvideo.o
 obj-$(CONFIG_USB_W9968CF)	+= w9968cf.o
+obj-$(CONFIG_USB_PWC)           += pwc/xdiff -Nru a/drivers/usb/media/ibmcam.c b/drivers/usb/media/ibmcam.c
--- a/drivers/usb/media/ibmcam.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/usb/media/ibmcam.c	2005-03-07 20:47:33 -08:00
@@ -1137,7 +1137,7 @@
 			index,
 			cp,
 			sizeof(cp),x-			HZ);x+			1000);
 #if 0
 		info("USB => %02x%02x%02x%02x%02x%02x%02x%02x "
 		       "(req=$%02x val=$%04x ind=$%04x)",
@@ -1154,7 +1154,7 @@
 			index,
 			NULL,
 			0,x-			HZ);x+			1000);
 	}
 	if (i < 0) {x 		err("%s: ERROR=%d. Camera stopped; Reconnect or reload driver.",xdiff -Nru a/drivers/usb/media/konicawc.c b/drivers/usb/media/konicawc.c
--- a/drivers/usb/media/konicawc.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/usb/media/konicawc.c	2005-03-07 20:47:29 -08:00
@@ -133,7 +133,7 @@
 {
         intxretval = usb_control_msg(uvd->dev,x 		dir ? usb_rcvctrlpipe(uvd->dev, 0) : usb_sndctrlpipe(uvd->dev, 0),
-		    request, 0x40 | dir, value,xindex, buf, len, HZ);x+		    request, 0x40 | dir, value,xindex, buf, len, 1000);
         return retval < 0 ? retval : 0;
 }
 
diff -Nru a/drivers/usb/media/ov511.c b/drivers/usb/media/ov511.c
--- a/drivers/usb/media/ov511.c	2005-01-04 11:29:17 -08:00
+++ b/drivers/usb/media/ov511.c	2005-03-07 20:47:25 -08:00
@@ -383,7 +383,7 @@
 			     usb_sndctrlpipe(ov->dev, 0),
 			     (ov->bclass == BCL_OV518)?1:2 /* REG_IO */,
 			     USB_TYPE_VENDOR | USB_RECIP_DEVICE,
-			     0, (__u16)reg, &ov->cbuf[0], 1, HZ);x+			     0, (__u16)reg, &ov->cbuf[0], 1, 1000);
 	up(&ov->cbuf_lock);
 x 	if (rc < 0)
@@ -404,7 +404,7 @@
 			     usb_rcvctrlpipe(ov->dev, 0),
 			     (ov->bclass == BCL_OV518)?1:3 /* REG_IO */,
 			     USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
-			     0, (__u16)reg, &ov->cbuf[0], 1, HZ);x+			     0, (__u16)reg, &ov->cbuf[0], 1, 1000);
 x 	if (rc < 0) {x 		err("reg read: error %d: %s", rc, symbolic(urb_errlist, rc));
@@ -464,7 +464,7 @@
 			     usb_sndctrlpipe(ov->dev, 0),
 			     1 /* REG_IO */,
 			     USB_TYPE_VENDOR | USB_RECIP_DEVICE,
-			     0, (__u16)reg, ov->cbuf, n, HZ);x+			     0, (__u16)reg, ov->cbuf, n, 1000);
 	up(&ov->cbuf_lock);
 x 	if (rc < 0)
diff -Nru a/drivers/usb/media/pwc/ChangeLog b/drivers/usb/media/pwc/ChangeLog
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/ChangeLog	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,143 @@
+9.0.2
+x+* Adding #ifdef to compile PWC before and after 2.6.5
+x+9.0.1
+x+9.0
+x+x+8.12
+x+* Implement motorized pan/tilt feature for Logitech QuickCam Orbit/Spere.x+x+8.11.1
+x+* Fix for PCVC720/40, would not be able to set videomodex+* Fix for Samsung MPC models, appearantly they are based on a newer chipsetx+x+8.11
+x+* 20 dev_hints (per request)x+* Hot unplugging should be better, no more dangling pointers or memory leaksx+* Added reserved Logitech webcam IDsx+* Device now remembers size & fps between close()/open()x+* Removed palette stuff altogetherx+x+8.10.1
+x+* Added IDs for PCVC720K/40 and Creative Labs Webcam Prox+x+8.10
+x+* Fixed ID for QuickCam Notebook prox+* Added GREALSIZE ioctl() callx+* Fixed bug inxcase PWCX was not loaded and invalid size was setx+x+8.9
+x+* Merging with kernel 2.5.49x+* Adding IDs for QuickCam Zoom & QuickCam Notebookx+x+8.8
+x+* Fixing 'leds' parameterx+* Adding IDs for Logitech QuickCam Pro 4000x+* Making URB init/cleanup a little nicerx+x+8.7
+x+* Incorporating changes in ioctl() parameter passingx+* Also changes to URB mechanismx+x+8.6
+x+* Added ID's for Visionite VCS UM100 and UC300x+* Removed YUV420-interlaced palette altogether (was confusing)x+* Removed MIRROR stuff as it didn't work anywayx+* Fixed a problem with the 'leds' parameter (wouldn't blink)x+* Added ioctl()s for advanced features: 'extended' whitebalance ioctl()s,
+  CONTOUR, BACKLIGHT, FLICKER, DYNNOISE.x+* VIDIOCGCAP.name now contains real camera model name instead of
+  'Philips xxx webcam'x+* Added PROBE ioctl (see previous point & API doc)x+x+8.5
+x+* Adding IDs for Creative Labs Webcam 5x+* Adding IDs for SOTEC CMS-001 webcamx+* Solving possible hang in VIDIOCSYNC when unplugging the cam x+* Forgot to return structure in VIDIOCPWCGAWB, oopsx+* Time interval for the LEDs are now in millisecondsx+x+8.4
+x+* Fixing power_save option for Vesta rangex+* Handling new error codes in ISOC callbackx+* Adding dev_hint module parameter, to specify /dev/videoX device nodesx+x+8.3
+x+* Adding Samsung C10 and C30 camerasx+* Removing palette module parameterx+* Fixed typo in ID of QuickCam 3000 Prox+* Adding LED settings (blinking while in use) for ToUCam cameras.x+* Turns LED off when camera is not in use.x+x+8.2
+x+* Making module more silent when trace = 0 x+* Adding QuickCam 3000 Pro IDsx+* Chrominance control for the Vesta camerasx+* Hopefully fixed problems on machines with BIGMEM and > 1GB of RAMx+* Included Oliver Neukem's lock_kernel() patchx+* Allocates less memory for image buffersx+* Adds ioctl()s for the whitebalancingx+x+8.1
+x+* Adding support for 750
+* Adding V4L GAUDIO/SAUDIO/UNIT ioctl() callsx+x+8.0
+* 'damage control' after inclusion in 2.4.5.x+* Changed wait-queue mechanism in read/mmap/poll according to the book.x+* Included YUV420P palette.x+* Changed interface to decompressor module.x+* Cleaned up pwc structure a bit.x+x+7.0
+x+* Fixed bug inxvcvt_420i_yuyv; extra variables on stack were misaligned.x+* There is now a clear error message when an image size is selected that
+  is only supported using the decompressor, and the decompressor isn't
+  loaded.x+* When the decompressor wasn't loaded, selecting large image size
+  would create skewed or double images.
+x+6.3
+x+* Introduced spinlocks for the buffer pointer manipulation; a number of
+  reports seem to suggest the down()/up() semaphores were the cause of
+  lockups, since they are not suitable for interrupt/user locking.
+* Separated decompressor and core code into 2 modules.
+x+6.2
+x+* Non-integral image sizes are now padded with gray or black.x+* Added SHUTTERSPEED ioctl().x+* Fixed buglet in VIDIOCPWCSAGC; the function would always return an error,
+  even though the call succeeded.x+* Added hotplug support for 2.4.*.x+* Memory:xthe 645/646 uses less memory now.
+x+6.1
+x+* VIDIOCSPICT returns -EINVAL with invalid palettes.x+* Added saturation control.
+* Split decompressors from rest.x+* Fixed bug that would reset the framerate to the default framerate if 
+  the rate field was set to 0 (which is not whatxI intended, nl. do not 
+  change the framerate!).x+* VIDIOCPWCSCQUAL (setting compression quality) now takes effect immediately.x+* Workaround for a bug inxthe 730 sensor.
diff -Nru a/drivers/usb/media/pwc/Makefile b/drivers/usb/media/pwc/Makefile
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/Makefile	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,20 @@
+ifneq ($(KERNELRELEASE),)x+x+pwc-objs	:= pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o pwc-dec1.o pwc-dec23.o pwc-kiara.o pwc-timon.ox+x+obj-$(CONFIG_USB_PWC) += pwc.ox+x+elsex+
+KDIR := /lib/modules/$(shell uname -r)/build
+PWD := $(shell pwd)x+x+default:x+	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modulesx+x+endif
+x+clean:x+	rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c x+	rm -rf .tmp_versionsx+xdiff -Nru a/drivers/usb/media/pwc/philips.txt b/drivers/usb/media/pwc/philips.txt
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/philips.txt	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,236 @@
+This file contains some additional information for the Philips and OEM webcams.x+E-mail: webcam@smcc.demon.nl                        Last updated: 2004-01-19
+Site: http://www.smcc.demon.nl/webcam/
+
+As of this moment, the following cameras are supported:
+ * Philips PCA645
+ * Philips PCA646
+ * Philips PCVC675
+ * Philips PCVC680
+ * Philips PCVC690
+ * Philips PCVC720/40
+ * Philips PCVC730
+ * Philips PCVC740
+ * Philips PCVC750
+ * Askey VC010
+ * Creative Labs Webcam 5x+ * Creative Labs Webcam Pro Ex
+ * Logitech QuickCam 3000 Prox+ * Logitech QuickCam 4000 Prox+ * Logitech QuickCam Notebook Prox+ * Logitech QuickCam Zoomx+ * Logitech QuickCam Orbitx+ * Logitech QuickCam Spherex+ * Samsung MPC-C10x+ * Samsung MPC-C30
+ * Sotec Afina Eye
+ * AME CU-001
+ * Visionite VCS-UM100
+ * Visionite VCS-UC300
+
+The main webpage for the Philips driver is at the address above. It contains
+a lot of extra information, a FAQ, and the binary plugin 'PWCX'. This pluginx+contains decompression routines that allow you to use higher image sizes and
+framerates; inxaddition the webcam uses less bandwidth on the USB bus (handy
+if you want to run more than 1 camera simultaneously). These routines fallx+under a NDA, and may therefor not be distributed as source; however, its usex+is completely optional.
+x+You can build this code either into your kernel, or as a module. I recommend
+the latter, since it makes troubleshooting a lot easier. The built-in
+microphone is supported through the USB Audio class.
+x+When you load the module you can set some default settings for thex+camera; some programs depend on a particular image-size or -format and
+don't know how to set it properly inxthe driver. The options are:
+
+size
+   Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or
+   'vga', for an image size of resp. 128x96, 160x120, 176x144,
+   320x240, 352x288 and 640x480 (of course, only for those cameras that 
+   support these resolutions).
+x+fpsx+   Specifies the desired framerate. Is an integer in the range of 4-30.
+x+fbufsx+   This paramter specifies the number of internal buffers to use for storing x+   frames from the cam. This will help if the process that reads images from x+   the cam is a bit slow or momentarely busy. However, on slow machines it 
+   only introduces lag, so choose carefully. The default is 3, which is 
+   reasonable. You can set it between 2 and 5.
+x+mbufsx+   This is an integer between 1 and 10. It will tell the module the number ofx+   buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends.x+   The default is 2, which is adequate for most applications (doublex+   buffering).
+      x+   Should you experience a lot of 'Dumping frame...' messages duringx+   grabbing with a tool that uses mmap(), you might want to increase if. x+   However, it doesn't really buffer images, it just gives you a bit more
+   slack when your program is behind. But you need a multi-threaded or
+   forked program to really take advantage of these buffers.
+x+   The absolute maximum is 10, butxdon't set it too high!  Every buffer takesx+   up 460 KB of RAM, so unless you have a lot of memory setting this to
+   something more than 4 is an absolute waste.  This memory is only
+   allocated during open(), so nothing is wasted when the camera is not inx+   use.x+x+power_savex+   When power_save is enabled (set to 1), the module will try to shutxdownx+   the cam on close() and re-activate on open(). This will save power and
+   turn off the LED. Not all cameras support this though (the 645 and 646
+   don't have power saving at all), and some models don't work either (they
+   will shutxdown, butxnever wake up). Consider this experimental. By
+   default this option is disabled.
+x+compression (only useful with the plugin)x+   With this option you can control the compression factor that the camerax+   uses to squeeze the image through the USB bus. You can set the x+   parameter between 0 and 3:
+     0 = prefer uncompressed images; if the requested mode is not availablex+         in an uncompressed format,xthe driver will silently switch to lowx+         compression.
+     1 = low compression.
+     2 = medium compression.
+     3 = high compression.
+      x+   High compression takes less bandwidth of course, butxit could also
+   introduce some unwanted artefacts. The default is 2, medium compression.
+   See the FAQ on the website for an overview of which modes require
+   compression.
+x+   The compression parameter does not apply to the 645 and 646 camerasx+   and OEM models derived from those (only a few). Most cams honour thisx+   parameter.
+x+ledsx+   This settings takes 2 integers, that define the on/off time for the LEDx+   (in milliseconds). One of the interesting things that you can do withx+   this is let the LED blink while the camera is in use. This:
+x+     leds=500,500
+      x+   will blink the LED once every second. But with:
+x+     leds=0,0
+x+   the LED never goes on, making it suitable for silent surveillance.
+x+   By default the camera's LED is on solid while in use, and turned offx+   when the camera is not used anymore.
+x+   This parameter works only with the ToUCam range of cameras (720, 730, 740,x+   750) and OEMs. For other cameras this command is silently ignored, and x+   the LED cannot be controlled.
+x+   Finally: this parameters does not take effect UNTIL the firstxtime you
+   open the camera device. Until then, the LED remains on.
+x+dev_hint
+   A long standing problem with USB devices is their dynamic nature: you
+   never know what device a camera gets assigned; it depends on module load
+   order, the hub configuration, the order in which devices are plugged in,x+   and the phase of the moon (i.e. it can be random). With this option you
+   can givexthe driver a hint as to what video device node (/dev/videoX) it
+   should use with a specific camera. This is also handy if you have two
+   cameras of the same model.
+x+   A camera is specified by its type (the number from the camera model,x+   like PCA645, PCVC750VC, etc) and optionally the serial number (visible
+   in /proc/bus/usb/devices). A hint consists of a string with the following
+   format:
+x+      [type[.serialnumber]:]nodex+      x+   The square brackets mean that both the type and the serialnumber are
+   optional, butxa serialnumber cannot be specified withoutxa type (whichx+   would be rather pointless). The serialnumber is separated from the typex+   by a '.'; the node number by a ':'.
+   x+   This somewhat cryptic syntax is bestxexplained by a fewxexamples:
+x+     dev_hint=3,5              The firstxdetected cam gets assigned
+                               /dev/video3, the second /dev/video5. Any
+                               other cameras will get the firstxfree 
+                               available slot (see below).
+x+     dev_hint=645:1,680:2      The PCA645 camera will get /dev/video1,
+                               and a PCVC680 /dev/video2.
+                               x+     dev_hint=645.0123:3,645.4567:0	The PCA645 camera with serialnumber 
+                                        0123 goes to /dev/video3, the same
+                                        camera model with the 4567 serial
+                                        gets /dev/video0.
+x+     dev_hint=750:1,4,5,6       The PCVC750 camera will get /dev/video1, the x+                                next 3 Philips cams will use /dev/video4 x+                                through /dev/video6.
+x+   Some points worth knowing:
+   - Serialnumbers are case sensitive and must be written full, including x+     leading zeroes (it's treated as a string).
+   - If a device node is already occupied, registration will fail and x+     the webcam is not available.
+   - You can have up to 64 video devices; be sure to make enough devicex+     nodes in /dev if you want to spread the numbers (this does not applyx+     to devfs). After /dev/video9 comes /dev/video10 (not /dev/videoA).
+   - If a camera does not match any dev_hint, it will simply get assigned
+     the firstxavailable device node, just as it used to be.
+x+trace
+   In order to better detect problems, it is now possible to turn on ax+   'trace' of some of the calls the module makes; it logs all items in yourx+   kernel log at debug level.
+x+   The trace variable is a bitmask; each bit represents a certain feature.
+   If you want to trace something, look up the bit value(s) in the table x+   below,xadd the values together and supply that to the trace variable.
+x+   Value  Value   Description					   Defaultx+   (dec)  (hex)x+       1    0x1   Module initialization; this will log messages       Onx+                  while loading and unloading the module
+x+       2    0x2   probe() and disconnect() traces                     Onx+x+       4    0x4   Trace open() and close() calls                      Offx+x+       8    0x8   read(), mmap() and associated ioctl() calls         Offx+x+      16   0x10   Memory allocation of buffers, etc.                  Offx+x+      32   0x20   Showing underflow,xoverflow and Dumping frame       Onx+                  messagesx+x+      64   0x40   Show viewport and image sizes                       Offx+x+     128   0x80   PWCX debugging                                      Offx+x+   For example, to trace the open() & read() fuctions, sum 8 + 4 = 12,
+   so you would supply trace=12 during insmod or modprobe. If
+   you want to turn the initialization and probing tracing off, set trace=0.x+   The default value for trace is 35 (0x23).
+x+x+x+Example:
+     
+     # modprobe pwc size=cif fps=15 power_save=1
+
+The fbufs, mbufs and trace parameters are global and apply to all connected
+cameras. Each camera has its own set of buffers.
+
+size and fps only specify defaults when you open() the device; this is to
+accommodate some tools that don't set the size. You can change thesex+settings after open() with the Video4Linux ioctl() calls. The default ofx+defaults is QCIF size at 10 fps.
+
+The compression parameter is semiglobal; it sets the initial compression
+preference for all camera's, butxthis parameter can be set per camera withx+the VIDIOCPWCSCQUAL ioctl() call.
+
+All parameters are optional.
+xdiff -Nru a/drivers/usb/media/pwc/pwc-ctrl.c b/drivers/usb/media/pwc/pwc-ctrl.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-ctrl.c	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,1630 @@
+/* Driver for Philips webcamx+   Functions that send various control messages to the webcam, includingx+   video modes.x+   (C) 1999-2003 Nemosoft Unv.x+   (C) 2004      Luc Saillard (luc@saillard.org)x+x+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
+   driver and thus may have bugs that are not present in the original version.x+   Please send bug reports and support requests to <luc@saillard.org>.x+x+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
+   driver and thus may have bugs that are not present in the original version.x+   Please send bug reports and support requests to <luc@saillard.org>.x+   The decompression routines have been implemented by reverse-engineering thex+   Nemosoft binary pwcx module. Caveat emptor.
+x+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+x+   This program is distributed in the hope that it will be useful,x+   but WITHOUT ANY WARRANTY; withoutxeven the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thex+   GNU General Public License for more details.
+x+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/*
+   Changes
+   2001/08/03  Alvarado   Added methods for changing white balance and x+                          red/green gains
+ */
+
+/* Control functions for the cam; brightness, contrast, video mode, etc. */
+
+#ifdef __KERNEL__
+#include <asm/uaccess.h> x+#endif
+#include <asm/errno.h>
+#include <linux/version.h>
+ 
+#include "pwc.h"
+#include "pwc-ioctl.h"
+#include "pwc-uncompress.h"
+#include "pwc-kiara.h"
+#include "pwc-timon.h"
+#include "pwc-dec1.h"
+#include "pwc-dec23.h"
+
+/* Request types: video */
+#define SET_LUM_CTL			0x01
+#define GET_LUM_CTL			0x02
+#define SET_CHROM_CTL			0x03
+#define GET_CHROM_CTL			0x04
+#define SET_STATUS_CTL			0x05
+#define GET_STATUS_CTL			0x06
+#define SET_EP_STREAM_CTL		0x07
+#define GET_EP_STREAM_CTL		0x08
+#define SET_MPT_CTL			0x0D
+#define GET_MPT_CTL			0x0E
+
+/* Selectors for the Luminance controls [GS]ET_LUM_CTL */
+#define AGC_MODE_FORMATTER			0x2000x+#define PRESET_AGC_FORMATTER			0x2100x+#define SHUTTER_MODE_FORMATTER			0x2200x+#define PRESET_SHUTTER_FORMATTER		0x2300x+#define PRESET_CONTOUR_FORMATTER		0x2400x+#define AUTO_CONTOUR_FORMATTER			0x2500x+#define BACK_LIGHT_COMPENSATION_FORMATTER	0x2600x+#define CONTRAST_FORMATTER			0x2700x+#define DYNAMIC_NOISE_CONTROL_FORMATTER		0x2800x+#define FLICKERLESS_MODE_FORMATTER		0x2900x+#define AE_CONTROL_SPEED			0x2A00x+#define BRIGHTNESS_FORMATTER			0x2B00x+#define GAMMA_FORMATTER				0x2C00
+
+/* Selectors for the Chrominance controls [GS]ET_CHROM_CTL */
+#define WB_MODE_FORMATTER			0x1000x+#define AWB_CONTROL_SPEED_FORMATTER		0x1100x+#define AWB_CONTROL_DELAY_FORMATTER		0x1200x+#define PRESET_MANUAL_RED_GAIN_FORMATTER	0x1300x+#define PRESET_MANUAL_BLUE_GAIN_FORMATTER	0x1400x+#define COLOUR_MODE_FORMATTER			0x1500x+#define SATURATION_MODE_FORMATTER1		0x1600x+#define SATURATION_MODE_FORMATTER2		0x1700
+
+/* Selectors for the Status controls [GS]ET_STATUS_CTL */
+#define SAVE_USER_DEFAULTS_FORMATTER		0x0200x+#define RESTORE_USER_DEFAULTS_FORMATTER		0x0300x+#define RESTORE_FACTORY_DEFAULTS_FORMATTER	0x0400x+#define READ_AGC_FORMATTER			0x0500x+#define READ_SHUTTER_FORMATTER			0x0600x+#define READ_RED_GAIN_FORMATTER			0x0700x+#define READ_BLUE_GAIN_FORMATTER		0x0800x+#define SENSOR_TYPE_FORMATTER1			0x0C00x+#define READ_RAW_Y_MEAN_FORMATTER		0x3100x+#define SET_POWER_SAVE_MODE_FORMATTER		0x3200x+#define MIRROR_IMAGE_FORMATTER			0x3300x+#define LED_FORMATTER				0x3400x+#define SENSOR_TYPE_FORMATTER2			0x3700
+
+/* Formatters for the Video Endpoint controls [GS]ET_EP_STREAM_CTL */
+#define VIDEO_OUTPUT_CONTROL_FORMATTER		0x0100
+
+/* Formatters for the motorized pan & tilt [GS]ET_MPT_CTL */
+#define PT_RELATIVE_CONTROL_FORMATTER		0x01
+#define PT_RESET_CONTROL_FORMATTER		0x02
+#define PT_STATUS_FORMATTER			0x03
+x+static char *size2name[PSZ_MAX] =
+{x+	"subQCIF",x+	"QSIF",x+	"QCIF",x+	"SIF",x+	"CIF",x+	"VGA",x+};  
+
+/********/
+
+/* Entries for the Nala (645/646) camera; the Nala doesn't have compression x+   preferences, so you either get compressed or non-compressed streams.
+   x+   An alternate value of 0 means this mode is not available at all.
+ */
+
+struct Nala_table_entry {x+	char alternate;			/* USB alternate setting */
+	int compressed;			/* Compressed yes/no */
+
+	unsigned char mode[3];		/* precomputed mode table */
+};
+x+static struct Nala_table_entry Nala_table[PSZ_MAX][8] =
+{x+#include "pwc-nala.h"
+};
+x+
+/****************************************************************************/
+x+
+#define SendControlMsg(request, value,xbuflen) \
+	usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0), \
+		request, \
+		USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, \
+		value,x\
+		pdev->vcinterface,x\
+		&buf, buflen, HZ / 2)x+
+#define RecvControlMsg(request, value,xbuflen) \
+	usb_control_msg(pdev->udev, usb_rcvctrlpipe(pdev->udev, 0), \
+		request, \
+		USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, \
+		value,x\
+		pdev->vcinterface,x\
+		&buf, buflen, HZ / 2)x+
+
+#if PWC_DEBUG
+void pwc_hexdump(void *p, int len)
+{x+	int i;
+	unsigned char *s;x+	char buf[100], *d;
+x+	s = (unsigned char *)p;x+	d = buf;
+	*d = '\0';
+	Debug("Doing hexdump @ %p, %d bytes.\n", p, len);x+	for (i = 0; i < len; i++) {x+		d += sprintf(d, "%02X ", *s++);x+		if ((i & 0xF) == 0xF) {x+			Debug("%s\n", buf);x+			d = buf;
+			*d = '\0';
+		}
+	}
+	if ((i & 0xF) != 0)
+		Debug("%s\n", buf);x+}x+#endif
+x+static inline int send_video_command(struct usb_device *udev, int index, void *buf, int buflen)
+{x+	return usb_control_msg(udev,
+		usb_sndctrlpipe(udev, 0),
+		SET_EP_STREAM_CTL,
+		USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
+		VIDEO_OUTPUT_CONTROL_FORMATTER,
+		index,
+		buf, buflen, HZ);x+}x+x+x+x+static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int frames)
+{x+	unsigned char buf[3];x+	int ret, fps;x+	struct Nala_table_entry *pEntry;x+	int frames2frames[31] =
+	{ /* closest match of framerate */
+	   0,  0,  0,  0,  4,  /*  0-4  */
+	   5,  5,  7,  7, 10,  /*  5-9  */
+          10, 10, 12, 12, 15,  /* 10-14 */
+          15, 15, 15, 20, 20,  /* 15-19 */
+          20, 20, 20, 24, 24,  /* 20-24 */
+          24, 24, 24, 24, 24,  /* 25-29 */
+          24                   /* 30    */
+	};x+	int frames2table[31] = 
+	{ 0, 0, 0, 0, 0, /*  0-4  */
+	  1, 1, 1, 2, 2, /*  5-9  */
+	  3, 3, 4, 4, 4, /* 10-14 */
+	  5, 5, 5, 5, 5, /* 15-19 */
+	  6, 6, 6, 6, 7, /* 20-24 */
+	  7, 7, 7, 7, 7, /* 25-29 */
+	  7              /* 30    */
+	};x+	
+	if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25)
+		return -EINVAL;x+	frames = frames2frames[frames];x+	fps = frames2table[frames];x+	pEntry = &Nala_table[size][fps];
+	if (pEntry->alternate == 0)
+		return -EINVAL;x+
+	if (pEntry->compressed)
+		return -ENOENT; /* Not supported. */
+
+	memcpy(buf, pEntry->mode, 3);	x+	ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3);
+	if (ret < 0) {x+		Debug("Failed to send video command... %d\n", ret);
+		return ret;
+	}
+	if (pEntry->compressed && pdev->vpalette != VIDEO_PALETTE_RAW)
+	 {x+	   switch(pdev->type) {x+	     case 645:x+	     case 646:x+	       pwc_dec1_init(pdev->type, pdev->release, buf, pdev->decompress_data);
+	       break;
+x+	     case 675:x+	     case 680:x+	     case 690:x+	     case 720:x+	     case 730:x+	     case 740:x+	     case 750:x+	       pwc_dec23_init(pdev->type, pdev->release, buf, pdev->decompress_data);
+	       break;
+	   }
+	}
+ 
+	pdev->cmd_len = 3;
+	memcpy(pdev->cmd_buf, buf, 3);
+
+	/* Set various parameters */
+	pdev->vframes = frames;
+	pdev->vsize = size;
+	pdev->valternate = pEntry->alternate;
+	pdev->image = pwc_image_sizes[size];
+	pdev->frame_size = (pdev->image.x * pdev->image.y * 3) / 2;
+	if (pEntry->compressed) {x+		if (pdev->release < 5) { /* 4 fold compression */
+			pdev->vbandlength = 528;
+			pdev->frame_size /= 4;
+		}
+		else {x+			pdev->vbandlength = 704;
+			pdev->frame_size /= 3;
+		}
+	}
+	elsex+		pdev->vbandlength = 0;x+	return 0;x+}x+x+x+static inline int set_video_mode_Timon(struct pwc_device *pdev, int size, int frames, int compression, int snapshot)
+{x+	unsigned char buf[13];x+	const struct Timon_table_entry *pChoose;x+	int ret, fps;x+
+	if (size >= PSZ_MAX || frames < 5 || frames > 30 || compression < 0 || compression > 3)
+		return -EINVAL;x+	if (size == PSZ_VGA && frames > 15)
+		return -EINVAL;x+	fps = (frames / 5) - 1;
+
+	/* Find a supported framerate with progressively higher compression ratios
+	   if the preferred ratio is not available.
+	*/
+	pChoose = NULL;x+	while (compression <= 3) {x+	   pChoose = &Timon_table[size][fps][compression];
+	   if (pChoose->alternate != 0)
+	     break;
+	   compression++;
+	}
+	if (pChoose == NULL || pChoose->alternate == 0)
+		return -ENOENT; /* Not supported. */
+
+	memcpy(buf, pChoose->mode, 13);
+	if (snapshot)
+		buf[0] |= 0x80;x+	ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 13);
+	if (ret < 0)
+		return ret;
+
+	if (pChoose->bandlength > 0 && pdev->vpalette != VIDEO_PALETTE_RAW)
+	   pwc_dec23_init(pdev->type, pdev->release, buf, pdev->decompress_data);
+
+	pdev->cmd_len = 13;
+	memcpy(pdev->cmd_buf, buf, 13);
+
+	/* Set various parameters */
+	pdev->vframes = frames;
+	pdev->vsize = size;
+	pdev->vsnapshot = snapshot;
+	pdev->valternate = pChoose->alternate;
+	pdev->image = pwc_image_sizes[size];
+	pdev->vbandlength = pChoose->bandlength;
+	if (pChoose->bandlength > 0)x+		pdev->frame_size = (pChoose->bandlength * pdev->image.y) / 4;
+	elsex+		pdev->frame_size = (pdev->image.x * pdev->image.y * 12) / 8;x+	return 0;x+}x+x+x+static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int frames, int compression, int snapshot)
+{x+	const struct Kiara_table_entry *pChoose = 0;x+	int fps, ret;
+	unsigned char buf[12];x+	struct Kiara_table_entry RawEntry = {6, 773, 1272, {0xAD, 0xF4, 0x10, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}};x+
+	if (size >= PSZ_MAX || frames < 5 || frames > 30 || compression < 0 || compression > 3)
+		return -EINVAL;x+	if (size == PSZ_VGA && frames > 15)
+		return -EINVAL;x+	fps = (frames / 5) - 1;
+
+	/* special case: VGA @ 5 fps and snapshot is raw bayer mode */
+	if (size == PSZ_VGA && frames == 5 && snapshot)
+	{x+		/* Only available inxcase the raw palette is selected or 
+		   we have the decompressor available. This mode is 
+		   only available inxcompressed form 
+		*/
+		if (pdev->vpalette == VIDEO_PALETTE_RAW)
+		{
+	                Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette);x+			pChoose = &RawEntry;
+		}
+		else
+		{
+			Info("VGA/5 BAYER mode _must_ have a decompressor available, or use RAW palette.\n");
+		}
+	}
+	elsex+	{
+        	/* Find a supported framerate with progressively higher compression ratios
+		   if the preferred ratio is not available.
+                   Skip this step when using RAW modes.x+		*/
+		while (compression <= 3) {x+			pChoose = &Kiara_table[size][fps][compression];
+			if (pChoose->alternate != 0)
+				break;
+			compression++;
+		}
+	}
+	if (pChoose == NULL || pChoose->alternate == 0)
+		return -ENOENT; /* Not supported. */
+
+	Debug("Using alternate setting %d.\n", pChoose->alternate);x+	
+	/* usb_control_msg won't take staticly allocated arrays as argument?? */
+	memcpy(buf, pChoose->mode, 12);
+	if (snapshot)
+		buf[0] |= 0x80;x+
+	/* Firmware bug: video endpoint is 5, butxcommands are sent to endpoint 4 */
+	ret = send_video_command(pdev->udev, 4 /* pdev->vendpoint */, buf, 12);
+	if (ret < 0)
+		return ret;
+
+	if (pChoose->bandlength > 0 && pdev->vpalette != VIDEO_PALETTE_RAW)
+	  pwc_dec23_init(pdev->type, pdev->release, buf, pdev->decompress_data);
+
+	pdev->cmd_len = 12;
+	memcpy(pdev->cmd_buf, buf, 12);
+	/* All set and go */
+	pdev->vframes = frames;
+	pdev->vsize = size;
+	pdev->vsnapshot = snapshot;
+	pdev->valternate = pChoose->alternate;
+	pdev->image = pwc_image_sizes[size];
+	pdev->vbandlength = pChoose->bandlength;
+	if (pdev->vbandlength > 0)x+		pdev->frame_size = (pdev->vbandlength * pdev->image.y) / 4;
+	elsex+		pdev->frame_size = (pdev->image.x * pdev->image.y * 12) / 8;x+	return 0;x+}x+x+x+
+/**
+   @pdev: device structure
+   @width: viewport width
+   @height: viewport height
+   @frame: framerate, in fpsx+   @compression: preferred compression ratiox+   @snapshot: snapshot mode or streamingx+ */
+int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot)
+{x+        intxret, size;
+x+        Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette);x+	size = pwc_decode_size(pdev, width, height);
+	if (size < 0) {x+		Debug("Could not find suitable size.\n");
+		return -ERANGE;
+	}
+	Debug("decode_size = %d.\n", size);
+x+        ret = -EINVAL;x+	switch(pdev->type) {x+	case 645:x+	case 646:x+		ret = set_video_mode_Nala(pdev, size, frames);
+		break;
+x+	case 675:x+	case 680:x+	case 690:x+		ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot);
+		break;
+	x+	case 720:x+	case 730:x+	case 740:x+	case 750:x+		ret = set_video_mode_Kiara(pdev, size, frames, compression, snapshot);
+		break;
+	}
+	if (ret < 0) {x+		if (ret == -ENOENT)
+			Info("Video mode %s@%d fps is only supported with the decompressor module (pwcx).\n", size2name[size], frames);
+		else {x+			Err("Failed to set video mode %s@%d fps; return code = %d\n", size2name[size], frames, ret);
+		}
+		return ret;
+	}
+	pdev->view.x = width;
+	pdev->view.y = height;
+	pdev->frame_total_size = pdev->frame_size + pdev->frame_header_size + pdev->frame_trailer_size;
+	pwc_set_image_buffer_size(pdev);
+	Trace(TRACE_SIZE, "Set viewport to %dx%d, image size is %dx%d.\n", width, height, pwc_image_sizes[size].x, pwc_image_sizes[size].y);x+	return 0;x+}x+x+x+void pwc_set_image_buffer_size(struct pwc_device *pdev)
+{x+	int i, factor = 0, filler = 0;x+
+	/* for PALETTE_YUV420P */
+	switch(pdev->vpalette)
+	{x+	case VIDEO_PALETTE_YUV420P:x+		factor = 6;
+		filler = 128;
+		break;
+	case VIDEO_PALETTE_RAW:x+		factor = 6; /* can be uncompressed YUV420P */
+		filler = 0;x+		break;
+	}
+
+	/* Set sizes in bytes */
+	pdev->image.size = pdev->image.x * pdev->image.y * factor / 4;
+	pdev->view.size  = pdev->view.x  * pdev->view.y  * factor / 4;
+
+	/* Align offset, or you'll get some very weird results in
+	   YUV420 mode... x must be multiple of 4 (to get the Y's in
+	   place), and yxeven (or you'll mixup U & V). This is less of a
+	   problem for YUV420P.x+	 */
+	pdev->offset.x = ((pdev->view.x - pdev->image.x) / 2) & 0xFFFC;
+	pdev->offset.y = ((pdev->view.y - pdev->image.y) / 2) & 0xFFFE;x+
+	/* Fill buffers with gray or black */
+	for (i = 0; i < MAX_IMAGES; i++) {x+		if (pdev->image_ptr[i] != NULL)
+			memset(pdev->image_ptr[i], filler, pdev->view.size);
+	}
+}x+x+x+
+/* BRIGHTNESS */
+
+int pwc_get_brightness(struct pwc_device *pdev)
+{x+	char buf;x+	int ret;x+
+	ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1);	x+	if (ret < 0)
+		return ret;
+	return buf << 9;x+}x+x+int pwc_set_brightness(struct pwc_device *pdev, int value)
+{x+	char buf;x+x+	if (value < 0)
+		value = 0;x+	if (value > 0xffff)
+		value = 0xffff;x+	buf = (value >> 9) & 0x7f;
+	return SendControlMsg(SET_LUM_CTL, BRIGHTNESS_FORMATTER, 1);x+}x+x+/* CONTRAST */
+
+int pwc_get_contrast(struct pwc_device *pdev)
+{x+	char buf;x+	int ret;x+
+	ret = RecvControlMsg(GET_LUM_CTL, CONTRAST_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+	return buf << 10;x+}x+x+int pwc_set_contrast(struct pwc_device *pdev, int value)
+{x+	char buf;x+x+	if (value < 0)
+		value = 0;x+	if (value > 0xffff)
+		value = 0xffff;x+	buf = (value >> 10) & 0x3f;
+	return SendControlMsg(SET_LUM_CTL, CONTRAST_FORMATTER, 1);x+}x+x+/* GAMMA */
+
+int pwc_get_gamma(struct pwc_device *pdev)
+{x+	char buf;x+	int ret;x+	
+	ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+	return buf << 11;x+}x+x+int pwc_set_gamma(struct pwc_device *pdev, int value)
+{x+	char buf;x+x+	if (value < 0)
+		value = 0;x+	if (value > 0xffff)
+		value = 0xffff;x+	buf = (value >> 11) & 0x1f;
+	return SendControlMsg(SET_LUM_CTL, GAMMA_FORMATTER, 1);x+}x+x+
+/* SATURATION */
+
+int pwc_get_saturation(struct pwc_device *pdev)
+{x+	char buf;x+	int ret;x+
+	if (pdev->type < 675)
+		return -1;
+	ret = RecvControlMsg(GET_CHROM_CTL, pdev->type < 730 ? SATURATION_MODE_FORMATTER2 : SATURATION_MODE_FORMATTER1, 1);x+	if (ret < 0)
+		return ret;
+	return 32768 + buf * 327;x+}x+x+int pwc_set_saturation(struct pwc_device *pdev, int value)
+{x+	char buf;x+x+	if (pdev->type < 675)
+		return -EINVAL;x+	if (value < 0)
+		value = 0;x+	if (value > 0xffff)
+		value = 0xffff;x+	/* saturation ranges from -100 to +100 */
+	buf = (value - 32768) / 327;x+	return SendControlMsg(SET_CHROM_CTL, pdev->type < 730 ? SATURATION_MODE_FORMATTER2 : SATURATION_MODE_FORMATTER1, 1);x+}x+x+/* AGC */
+
+static inline int pwc_set_agc(struct pwc_device *pdev, int mode, int value)
+{x+	char buf;x+	int ret;x+	
+	if (mode)
+		buf = 0x0; /* auto */
+	elsex+		buf = 0xff; /* fixed */
+
+	ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1);x+	
+	if (!mode && ret >= 0) {x+		if (value < 0)
+			value = 0;x+		if (value > 0xffff)
+			value = 0xffff;x+		buf = (value >> 10) & 0x3F;x+		ret = SendControlMsg(SET_LUM_CTL, PRESET_AGC_FORMATTER, 1);x+	}x+	if (ret < 0)
+		return ret;
+	return 0;x+}x+x+static inline int pwc_get_agc(struct pwc_device *pdev, int *value)
+{x+	unsigned char buf;x+	int ret;x+	
+	ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+
+	if (buf != 0) { /* fixed */
+		ret = RecvControlMsg(GET_LUM_CTL, PRESET_AGC_FORMATTER, 1);x+		if (ret < 0)
+			return ret;
+		if (buf > 0x3F)
+			buf = 0x3F;x+		*value = (buf << 10);		
+	}
+	else { /* auto */
+		ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1);x+		if (ret < 0)
+			return ret;
+		/* Gah... this value ranges from 0x00 ... 0x9F */
+		if (buf > 0x9F)
+			buf = 0x9F;x+		*value = -(48 + buf * 409);
+	}
+
+	return 0;x+}x+x+static inline int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int value)
+{x+	char buf[2];x+	int speed, ret;
+
+
+	if (mode)
+		buf[0] = 0x0;	/* auto */
+	elsex+		buf[0] = 0xff; /* fixed */
+	
+	ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1);x+
+	if (!mode && ret >= 0) {x+		if (value < 0)
+			value = 0;x+		if (value > 0xffff)
+			value = 0xffff;x+		switch(pdev->type) {x+		case 675:x+		case 680:x+		case 690:x+			/* speed ranges from 0x0 to 0x290 (656) */
+			speed = (value / 100);x+			buf[1] = speed >> 8;x+			buf[0] = speed & 0xff;x+			break;
+		case 720:x+		case 730:x+		case 740:x+		case 750:x+			/* speed seems to range from 0x0 to 0xff */
+			buf[1] = 0;x+			buf[0] = value >> 8;x+			break;
+		}
+
+		ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2);x+	}x+	return ret;
+}	x+x+
+/* POWER */
+
+int pwc_camera_power(struct pwc_device *pdev, int power)
+{x+	char buf;x+x+	if (pdev->type < 675 || (pdev->type < 730 && pdev->release < 6))
+		return 0;	/* Not supported by Nala or Timon < release 6 */
+
+	if (power)
+		buf = 0x00; /* active */
+	elsex+		buf = 0xFF; /* power save */
+	return SendControlMsg(SET_STATUS_CTL, SET_POWER_SAVE_MODE_FORMATTER, 1);x+}x+x+
+
+/* private calls */
+
+static inline int pwc_restore_user(struct pwc_device *pdev)
+{x+	char buf; /* dummy */
+	return SendControlMsg(SET_STATUS_CTL, RESTORE_USER_DEFAULTS_FORMATTER, 0);x+}x+x+static inline int pwc_save_user(struct pwc_device *pdev)
+{x+	char buf; /* dummy */
+	return SendControlMsg(SET_STATUS_CTL, SAVE_USER_DEFAULTS_FORMATTER, 0);x+}x+x+static inline int pwc_restore_factory(struct pwc_device *pdev)
+{x+	char buf; /* dummy */
+	return SendControlMsg(SET_STATUS_CTL, RESTORE_FACTORY_DEFAULTS_FORMATTER, 0);x+}x+x+ /* ************************************************* */
+ /* Patch by Alvarado: (not in the original version   */
+
+ /*x+  * the camera recognizes modes from 0 to 4:
+  *x+  * 00: indoor (incandescant lighting)x+  * 01: outdoor (sunlight)x+  * 02: fluorescent lightingx+  * 03: manual
+  * 04: auto
+  */ 
+static inline int pwc_set_awb(struct pwc_device *pdev, int mode)
+{x+	char buf;x+	int ret;x+	
+	if (mode < 0)
+	    mode = 0;x+	
+	if (mode > 4)
+	    mode = 4;x+	
+	buf = mode & 0x07; /* just the lowest three bits */
+	
+	ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1);x+	
+	if (ret < 0)
+		return ret;
+	return 0;x+}x+x+static inline int pwc_get_awb(struct pwc_device *pdev)
+{x+	unsigned char buf;x+	int ret;x+	
+	ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1);x+
+	if (ret < 0) 
+		return ret;
+	return buf;x+}x+x+static inline int pwc_set_red_gain(struct pwc_device *pdev, int value)
+{x+        unsigned char buf;x+x+	if (value < 0)
+		value = 0;x+	if (value > 0xffff)
+		value = 0xffff;x+	/* only the msb is considered */
+	buf = value >> 8;x+	return SendControlMsg(SET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1);x+}x+x+static inline int pwc_get_red_gain(struct pwc_device *pdev, int *value)
+{x+	unsigned char buf;x+	int ret;x+	
+	ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1);x+	if (ret < 0)
+	    return ret;
+	*value = buf << 8;x+	return 0;x+}x+x+x+static inline int pwc_set_blue_gain(struct pwc_device *pdev, int value)
+{x+	unsigned char buf;x+x+	if (value < 0)
+		value = 0;x+	if (value > 0xffff)
+		value = 0xffff;x+	/* only the msb is considered */
+	buf = value >> 8;x+	return SendControlMsg(SET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1);x+}x+x+static inline int pwc_get_blue_gain(struct pwc_device *pdev, int *value)
+{x+	unsigned char buf;x+	int ret;x+	
+	ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1);x+	if (ret < 0)
+	    return ret;
+	*value = buf << 8;x+	return 0;x+}x+x+x+/* The following two functions are different, since they only read the
+   internal red/blue gains, which may be different from the manual x+   gains set or read above.x+ */   x+static inline int pwc_read_red_gain(struct pwc_device *pdev, int *value)
+{x+	unsigned char buf;x+	int ret;x+	
+	ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+	*value = buf << 8;x+	return 0;x+}x+x+static inline int pwc_read_blue_gain(struct pwc_device *pdev, int *value)
+{x+	unsigned char buf;x+	int ret;x+	
+	ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+	*value = buf << 8;x+	return 0;x+}x+x+x+static inline int pwc_set_wb_speed(struct pwc_device *pdev, int speed)
+{x+	unsigned char buf;x+	
+	/* useful range is 0x01..0x20 */
+	buf = speed / 0x7f0;x+	return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1);x+}x+x+static inline int pwc_get_wb_speed(struct pwc_device *pdev, int *value)
+{x+	unsigned char buf;x+	int ret;x+	
+	ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+	*value = buf * 0x7f0;x+	return 0;x+}x+x+x+static inline int pwc_set_wb_delay(struct pwc_device *pdev, int delay)
+{x+	unsigned char buf;x+	
+	/* useful range is 0x01..0x3F */
+	buf = (delay >> 10);x+	return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1);x+}x+x+static inline int pwc_get_wb_delay(struct pwc_device *pdev, int *value)
+{x+	unsigned char buf;x+	int ret;x+	
+	ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+	*value = buf << 10;x+	return 0;x+}x+x+x+int pwc_set_leds(struct pwc_device *pdev, int on_value,xint off_value)
+{x+	unsigned char buf[2];x+x+	if (pdev->type < 730)
+		return 0;
+	on_value /= 100;
+	off_value /= 100;
+	if (on_value < 0)
+		on_value = 0;x+	if (on_value > 0xff)
+		on_value = 0xff;x+	if (off_value < 0)
+		off_value = 0;x+	if (off_value > 0xff)
+		off_value = 0xff;x+
+	buf[0] = on_value;x+	buf[1] = off_value;
+
+	return SendControlMsg(SET_STATUS_CTL, LED_FORMATTER, 2);x+}x+x+int pwc_get_leds(struct pwc_device *pdev, int *on_value,xint *off_value)
+{x+	unsigned char buf[2];x+	int ret;x+	
+	if (pdev->type < 730) {x+		*on_value = -1;
+		*off_value = -1;
+		return 0;
+	}x+
+	ret = RecvControlMsg(GET_STATUS_CTL, LED_FORMATTER, 2);x+	if (ret < 0)
+		return ret;
+	*on_value = buf[0] * 100;
+	*off_value = buf[1] * 100;
+	return 0;x+}x+x+static inline int pwc_set_contour(struct pwc_device *pdev, int contour)
+{x+	unsigned char buf;x+	int ret;x+	
+	if (contour < 0)
+		buf = 0xff; /* auto contour on */
+	elsex+		buf = 0x0; /* auto contour off */
+	ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+	
+	if (contour < 0)
+		return 0;
+	if (contour > 0xffff)
+		contour = 0xffff;x+	
+	buf = (contour >> 10); /* contour preset is [0..3f] */
+	ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1);x+	if (ret < 0)	
+		return ret;	
+	return 0;x+}x+x+static inline int pwc_get_contour(struct pwc_device *pdev, int *contour)
+{x+	unsigned char buf;x+	int ret;x+	
+	ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+
+	if (buf == 0) {x+		/* auto mode off, query current preset value */
+		ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1);x+		if (ret < 0)	
+			return ret;
+		*contour = buf << 10;x+	}
+	elsex+		*contour = -1;
+	return 0;x+}x+x+x+static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight)
+{x+	unsigned char buf;x+	
+	if (backlight)
+		buf = 0xff;
+	elsex+		buf = 0x0;
+	return SendControlMsg(SET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1);x+}x+x+static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight)
+{x+	int ret;x+	unsigned char buf;x+	
+	ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+	*backlight = buf;
+	return 0;x+}x+x+x+static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker)
+{x+	unsigned char buf;x+	
+	if (flicker)
+		buf = 0xff;
+	elsex+		buf = 0x0;
+	return SendControlMsg(SET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1);x+}x+x+static inline int pwc_get_flicker(struct pwc_device *pdev, int *flicker)
+{x+	int ret;x+	unsigned char buf;x+	
+	ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+	*flicker = buf;
+	return 0;x+}x+x+x+static inline int pwc_set_dynamic_noise(struct pwc_device *pdev, int noise)
+{x+	unsigned char buf;x+x+	if (noise < 0)
+		noise = 0;x+	if (noise > 3)
+		noise = 3;x+	buf = noise;
+	return SendControlMsg(SET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1);x+}x+x+static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise)
+{x+	int ret;x+	unsigned char buf;x+	
+	ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1);x+	if (ret < 0)
+		return ret;
+	*noise = buf;
+	return 0;x+}x+x+int pwc_mpt_reset(struct pwc_device *pdev, int flags)
+{x+	unsigned char buf;x+	
+	buf = flags & 0x03; // only lower two bits are currently used
+	return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1);x+}x+x+static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt)
+{x+	unsigned char buf[4];x+	
+	/* set new relative angle; angles are expressed in degrees * 100,
+	   butxcam as .5 degree resolution, hence devide by 200. Also
+	   the angle must be multiplied by 64 before it's send to
+	   the cam (??)x+	 */
+	pan  =  64 * pan  / 100;x+	tilt = -64 * tilt / 100; /* positive tilt is down, which is not what the user would expect */
+	buf[0] = pan & 0xFF;x+	buf[1] = (pan >> 8) & 0xFF;x+	buf[2] = tilt & 0xFF;x+	buf[3] = (tilt >> 8) & 0xFF;x+	return SendControlMsg(SET_MPT_CTL, PT_RELATIVE_CONTROL_FORMATTER, 4);x+}x+x+static inline int pwc_mpt_get_status(struct pwc_device *pdev, struct pwc_mpt_status *status)
+{x+	int ret;x+	unsigned char buf[5];x+	
+	ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5);x+	if (ret < 0)
+		return ret;
+	status->status = buf[0] & 0x7; // 3 bits are used for reportingx+	status->time_pan = (buf[1] << 8) + buf[2];x+	status->time_tilt = (buf[3] << 8) + buf[4];x+	return 0;x+}x+x+x+int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor)
+{x+	unsigned char buf;x+	int ret = -1, request;x+	
+	if (pdev->type < 675)
+		request = SENSOR_TYPE_FORMATTER1;
+	else if (pdev->type < 730)
+		return -1; /* The Vesta series doesn't have this call */
+	elsex+		request = SENSOR_TYPE_FORMATTER2;x+	
+	ret = RecvControlMsg(GET_STATUS_CTL, request, 1);x+	if (ret < 0)
+		return ret;
+	if (pdev->type < 675)
+		*sensor = buf | 0x100;
+	elsex+		*sensor = buf;x+	return 0;x+}x+x+x+ /* End of Add-Ons                                    */
+ /* ************************************************* */
+x+/* Linux 2.5.something and 2.6 pass direct pointers to arguments ofx+   ioctl() calls. With 2.4, you have to do tedious copy_from_user()x+   and copy_to_user() calls. With these macros we circumvent this,x+   and let me maintain only one source file. The functionality isx+   exactly the same otherwise.x+ */   x+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
+x+/* define local variable for arg */
+#define ARG_DEF(ARG_type, ARG_name)\
+	ARG_type *ARG_name = arg;x+/* copy arg to local variable */	
+#define ARG_IN(ARG_name) /* nothing */
+/* argument itself (referenced) */
+#define ARGR(ARG_name) (*ARG_name)
+/* argument address */
+#define ARGA(ARG_name) ARG_namex+/* copy local variable to arg */
+#define ARG_OUT(ARG_name) /* nothing */
+x+#elsex+
+#define ARG_DEF(ARG_type, ARG_name)\
+	ARG_type ARG_name;
+#define ARG_IN(ARG_name)\
+	if (copy_from_user(&ARG_name, arg, sizeof(ARG_name))) {\
+		ret = -EFAULT;\x+		break;\x+	}
+#define ARGR(ARG_name) ARG_namex+#define ARGA(ARG_name) &ARG_namex+#define ARG_OUT(ARG_name)\
+	if (copy_to_user(arg, &ARG_name, sizeof(ARG_name))) {\
+		ret = -EFAULT;\x+		break;\x+	}
+x+#endif
+x+int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)x+{x+	int ret = 0;x+
+	switch(cmd) {x+	case VIDIOCPWCRUSER:
+	{x+		if (pwc_restore_user(pdev))
+			ret = -EINVAL;x+		break;
+	}
+	x+	case VIDIOCPWCSUSER:
+	{x+		if (pwc_save_user(pdev))
+			ret = -EINVAL;x+		break;
+	}
+		x+	case VIDIOCPWCFACTORY:
+	{x+		if (pwc_restore_factory(pdev))
+			ret = -EINVAL;x+		break;
+	}
+	x+	case VIDIOCPWCSCQUAL:
+	{	
+		ARG_DEF(int, qual)
+
+		ARG_IN(qual)
+		if (ARGR(qual) < 0 || ARGR(qual) > 3)
+			ret = -EINVAL;x+		elsex+			ret = pwc_try_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, ARGR(qual), pdev->vsnapshot);
+		if (ret >= 0)
+			pdev->vcompression = ARGR(qual);x+		break;
+	}
+	x+	case VIDIOCPWCGCQUAL:
+	{
+		ARG_DEF(int, qual)
+		
+		ARGR(qual) = pdev->vcompression;
+		ARG_OUT(qual)
+		break;
+	}
+	x+	case VIDIOCPWCPROBE:
+	{
+		ARG_DEF(struct pwc_probe, probe)
+		
+		strcpy(ARGR(probe).name, pdev->vdev->name);
+		ARGR(probe).type = pdev->type;
+		ARG_OUT(probe)
+		break;
+	}
+
+	case VIDIOCPWCGSERIAL:
+	{
+		ARG_DEF(struct pwc_serial, serial)
+		
+		strcpy(ARGR(serial).serial, pdev->serial);
+		ARG_OUT(serial)
+		break;
+	}
+
+	case VIDIOCPWCSAGC:
+	{
+		ARG_DEF(int, agc)
+
+		ARG_IN(agc)
+		if (pwc_set_agc(pdev, ARGR(agc) < 0 ? 1 : 0, ARGR(agc)))
+			ret = -EINVAL;x+		break;
+	}
+	x+	case VIDIOCPWCGAGC:
+	{
+		ARG_DEF(int, agc)
+		
+		if (pwc_get_agc(pdev, ARGA(agc)))
+			ret = -EINVAL;x+		ARG_OUT(agc)
+		break;
+	}
+	x+	case VIDIOCPWCSSHUTTER:
+	{
+		ARG_DEF(int, shutter_speed)
+
+		ARG_IN(shutter_speed)
+		ret = pwc_set_shutter_speed(pdev, ARGR(shutter_speed) < 0 ? 1 : 0, ARGR(shutter_speed));x+		break;
+	}
+	x+        case VIDIOCPWCSAWB:
+	{
+		ARG_DEF(struct pwc_whitebalance, wb)
+		
+		ARG_IN(wb)
+		ret = pwc_set_awb(pdev, ARGR(wb).mode);
+		if (ret >= 0 && ARGR(wb).mode == PWC_WB_MANUAL) {x+			pwc_set_red_gain(pdev, ARGR(wb).manual_red);x+			pwc_set_blue_gain(pdev, ARGR(wb).manual_blue);
+		}
+		break;
+	}
+
+	case VIDIOCPWCGAWB:
+	{
+		ARG_DEF(struct pwc_whitebalance, wb)
+
+		memset(ARGA(wb), 0, sizeof(struct pwc_whitebalance));
+		ARGR(wb).mode = pwc_get_awb(pdev);
+		if (ARGR(wb).mode < 0)
+			ret = -EINVAL;x+		else {x+			if (ARGR(wb).mode == PWC_WB_MANUAL) {x+				ret = pwc_get_red_gain(pdev, &ARGR(wb).manual_red);x+				if (ret < 0)
+					break;
+				ret = pwc_get_blue_gain(pdev, &ARGR(wb).manual_blue);
+				if (ret < 0)
+					break;
+			}x+			if (ARGR(wb).mode == PWC_WB_AUTO) {x+				ret = pwc_read_red_gain(pdev, &ARGR(wb).read_red);
+				if (ret < 0)
+					break;
+ 				ret =pwc_read_blue_gain(pdev, &ARGR(wb).read_blue);
+ 				if (ret < 0)
+ 					break;
+			}x+		}x+		ARG_OUT(wb)
+		break;
+	}
+	x+	case VIDIOCPWCSAWBSPEED:
+	{
+		ARG_DEF(struct pwc_wb_speed, wbs)
+		
+		if (ARGR(wbs).control_speed > 0) {x+			ret = pwc_set_wb_speed(pdev, ARGR(wbs).control_speed);
+		}
+		if (ARGR(wbs).control_delay > 0) {x+			ret = pwc_set_wb_delay(pdev, ARGR(wbs).control_delay);
+		}
+		break;
+	}
+	
+	case VIDIOCPWCGAWBSPEED:
+	{
+		ARG_DEF(struct pwc_wb_speed, wbs)
+		
+		ret = pwc_get_wb_speed(pdev, &ARGR(wbs).control_speed);
+		if (ret < 0)
+			break;
+		ret = pwc_get_wb_delay(pdev, &ARGR(wbs).control_delay);
+		if (ret < 0)
+			break;
+		ARG_OUT(wbs)
+		break;
+	}
+
+        case VIDIOCPWCSLED:
+	{
+		ARG_DEF(struct pwc_leds, leds)
+
+		ARG_IN(leds)
+		ret = pwc_set_leds(pdev, ARGR(leds).led_on, ARGR(leds).led_off);
+	    	break;
+	}
+
+
+	case VIDIOCPWCGLED:
+	{
+		ARG_DEF(struct pwc_leds, leds)
+		
+		ret = pwc_get_leds(pdev, &ARGR(leds).led_on, &ARGR(leds).led_off);
+		ARG_OUT(leds)
+		break;
+	}
+
+	case VIDIOCPWCSCONTOUR:
+	{
+		ARG_DEF(int, contour)
+
+		ARG_IN(contour)
+		ret = pwc_set_contour(pdev, ARGR(contour));x+		break;
+	}
+			x+	case VIDIOCPWCGCONTOUR:
+	{
+		ARG_DEF(int, contour)
+		
+		ret = pwc_get_contour(pdev, ARGA(contour));x+		ARG_OUT(contour)
+		break;
+	}
+	x+	case VIDIOCPWCSBACKLIGHT:
+	{
+		ARG_DEF(int, backlight)
+		
+		ARG_IN(backlight)
+		ret = pwc_set_backlight(pdev, ARGR(backlight));
+		break;
+	}
+
+	case VIDIOCPWCGBACKLIGHT:
+	{
+		ARG_DEF(int, backlight)
+		
+		ret = pwc_get_backlight(pdev, ARGA(backlight));
+		ARG_OUT(backlight)
+		break;
+	}
+	x+	case VIDIOCPWCSFLICKER:
+	{
+		ARG_DEF(int, flicker)
+		
+		ARG_IN(flicker)
+		ret = pwc_set_flicker(pdev, ARGR(flicker));
+		break;
+	}
+
+	case VIDIOCPWCGFLICKER:
+	{
+		ARG_DEF(int, flicker)
+		
+		ret = pwc_get_flicker(pdev, ARGA(flicker));
+		ARG_OUT(flicker)
+		break;
+	}
+	x+	case VIDIOCPWCSDYNNOISE:
+	{
+		ARG_DEF(int, dynnoise)
+		
+		ARG_IN(dynnoise)
+		ret = pwc_set_dynamic_noise(pdev, ARGR(dynnoise));x+		break;
+	}
+	x+	case VIDIOCPWCGDYNNOISE:
+	{
+		ARG_DEF(int, dynnoise)
+
+		ret = pwc_get_dynamic_noise(pdev, ARGA(dynnoise));x+		ARG_OUT(dynnoise);
+		break;
+	}
+
+	case VIDIOCPWCGREALSIZE:
+	{
+		ARG_DEF(struct pwc_imagesize, size)
+		
+		ARGR(size).width = pdev->image.x;
+		ARGR(size).height = pdev->image.y;
+		ARG_OUT(size)
+		break;
+ 	}
+ 	x+ 	case VIDIOCPWCMPTRESET:
+ 	{
+ 		if (pdev->features & FEATURE_MOTOR_PANTILT)
+ 		{
+	 		ARG_DEF(int, flags)
+
+ 			ARG_IN(flags)
+			ret = pwc_mpt_reset(pdev, ARGR(flags));
+ 			if (ret >= 0)
+ 			{
+ 				pdev->pan_angle = 0;x+ 				pdev->tilt_angle = 0;x+ 			}
+ 		}
+ 		elsex+ 		{
+ 			ret = -ENXIO;
+ 		}
+ 		break;		
+ 	}
+ 	x+ 	case VIDIOCPWCMPTGRANGE:
+ 	{
+ 		if (pdev->features & FEATURE_MOTOR_PANTILT)
+ 		{
+ 			ARG_DEF(struct pwc_mpt_range, range)
+ 			
+ 			ARGR(range) = pdev->angle_range;
+ 			ARG_OUT(range)
+ 		}
+ 		elsex+ 		{	
+ 			ret = -ENXIO;
+ 		}
+ 		break;
+ 	}
+ 	x+ 	case VIDIOCPWCMPTSANGLE:
+ 	{
+ 		int new_pan, new_tilt;
+ 		
+ 		if (pdev->features & FEATURE_MOTOR_PANTILT)
+ 		{
+	 		ARG_DEF(struct pwc_mpt_angles, angles)
+
+	 		ARG_IN(angles)
+			/* The camera can only set relative angles, so
+			   do some calculations when getting an absolute angle .
+			 */
+			if (ARGR(angles).absolute)
+			{
+ 				new_pan  = ARGR(angles).pan; 
+ 				new_tilt = ARGR(angles).tilt;
+ 			}
+ 			elsex+ 			{
+ 				new_pan  = pdev->pan_angle  + ARGR(angles).pan;
+ 				new_tilt = pdev->tilt_angle + ARGR(angles).tilt;
+			}x+			/* check absolute ranges */
+			if (new_pan  < pdev->angle_range.pan_min  ||
+			    new_pan  > pdev->angle_range.pan_max  ||
+			    new_tilt < pdev->angle_range.tilt_min ||
+			    new_tilt > pdev->angle_range.tilt_max)
+			{
+				ret = -ERANGE;
+			}x+			elsex+			{
+				/* go to relative range, check again */
+				new_pan  -= pdev->pan_angle;
+				new_tilt -= pdev->tilt_angle;
+				/* angles are specified in degrees * 100, thus the limit = 36000 */
+				if (new_pan < -36000 || new_pan > 36000 || new_tilt < -36000 || new_tilt > 36000)
+					ret = -ERANGE;
+			}x+			if (ret == 0) /* no errors so far */
+			{
+				ret = pwc_mpt_set_angle(pdev, new_pan, new_tilt);
+				if (ret >= 0)
+				{
+					pdev->pan_angle  += new_pan;
+					pdev->tilt_angle += new_tilt;
+				}x+				if (ret == -EPIPE) /* stall -> out of range */
+					ret = -ERANGE;				x+			}
+ 		}
+ 		elsex+ 		{
+ 			ret = -ENXIO;
+ 		}
+ 		break;
+ 	}
+x+ 	case VIDIOCPWCMPTGANGLE:
+ 	{
+ 		
+ 		if (pdev->features & FEATURE_MOTOR_PANTILT)
+ 		{
+	 		ARG_DEF(struct pwc_mpt_angles, angles)
+
+ 			ARGR(angles).absolute = 1;
+ 			ARGR(angles).pan  = pdev->pan_angle;
+ 			ARGR(angles).tilt = pdev->tilt_angle;
+ 			ARG_OUT(angles)
+ 		}
+ 		elsex+ 		{
+ 			ret = -ENXIO;
+ 		}
+ 		break;
+ 	}
+ x+ 	case VIDIOCPWCMPTSTATUS:
+ 	{
+ 		if (pdev->features & FEATURE_MOTOR_PANTILT)
+ 		{
+ 			ARG_DEF(struct pwc_mpt_status, status)
+ 			
+ 			ret = pwc_mpt_get_status(pdev, ARGA(status));
+ 			ARG_OUT(status)
+ 		}
+ 		elsex+ 		{
+ 			ret = -ENXIO;
+ 		}
+ 		break;
+	}
+
+	case VIDIOCPWCGVIDCMD:
+	{
+		ARG_DEF(struct pwc_video_command, cmd);
+		
+                ARGR(cmd).type = pdev->type;
+		ARGR(cmd).release = pdev->release;
+		ARGR(cmd).command_len = pdev->cmd_len;
+		memcpy(&ARGR(cmd).command_buf, pdev->cmd_buf, pdev->cmd_len);
+		ARGR(cmd).bandlength = pdev->vbandlength;
+		ARGR(cmd).frame_size = pdev->frame_size;x+		ARG_OUT(cmd)
+		break;
+	}
+       /*
+	case VIDIOCPWCGVIDTABLE:
+	{
+		ARG_DEF(struct pwc_table_init_buffer, table);
+		ARGR(table).len = pdev->cmd_len;
+		memcpy(&ARGR(table).buffer, pdev->decompress_data, pdev->decompressor->table_size);
+		ARG_OUT(table)x+		break;
+	}
+	*/
+
+	default:
+		ret = -ENOIOCTLCMD;x+		break;
+	}
+	x+	if (ret > 0)
+		return 0;
+	return ret;
+}x+x+
+
diff -Nru a/drivers/usb/media/pwc/pwc-dec1.c b/drivers/usb/media/pwc/pwc-dec1.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-dec1.c	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,42 @@x+/* Linux driver for Philips webcam
+   Decompression for chipset version 1
+   (C) 2004      Luc Saillard (luc@saillard.org)x+
+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
+   driver and thus may have bugs that are not present in the original version.
+   Please send bug reports and support requests to <luc@saillard.org>.
+   The decompression routines have been implemented by reverse-engineering the
+   Nemosoft binary pwcx module. Caveat emptor.x+
+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.x+
+   This program is distributed in the hope that it will be useful,x+   butxWITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.x+
+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+x+
+#include "pwc-dec1.h"x+x+x+void pwc_dec1_init(int type, int release, void *buffer, void *table)x+{x+x+}x+x+void pwc_dec1_exit(void)x+{x+x+x+x+}x+xdiff -Nru a/drivers/usb/media/pwc/pwc-dec1.h b/drivers/usb/media/pwc/pwc-dec1.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-dec1.h	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,36 @@x+/* Linux driver for Philips webcam
+   (C) 2004      Luc Saillard (luc@saillard.org)x+
+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
+   driver and thus may have bugs that are not present in the original version.
+   Please send bug reports and support requests to <luc@saillard.org>.
+   The decompression routines have been implemented by reverse-engineering the
+   Nemosoft binary pwcx module. Caveat emptor.x+
+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.x+
+   This program is distributed in the hope that it will be useful,x+   butxWITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.x+
+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+x+
+#ifndef PWC_DEC1_Hx+#define PWC_DEC1_Hx+x+void pwc_dec1_init(int type, int release, void *buffer, void *private_data);
+void pwc_dec1_exit(void);
+x+#endif
+x+x+xdiff -Nru a/drivers/usb/media/pwc/pwc-dec23.c b/drivers/usb/media/pwc/pwc-dec23.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-dec23.c	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,623 @@x+/* Linux driver for Philips webcam
+   Decompression for chipset version 2 et 3
+   (C) 2004      Luc Saillard (luc@saillard.org)x+
+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
+   driver and thus may have bugs that are not present in the original version.
+   Please send bug reports and support requests to <luc@saillard.org>.
+   The decompression routines have been implemented by reverse-engineering the
+   Nemosoft binary pwcx module. Caveat emptor.x+
+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.x+
+   This program is distributed in the hope that it will be useful,x+   butxWITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.x+
+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include "pwc-timon.h"x+#include "pwc-kiara.h"x+#include "pwc-dec23.h"x+#include "pwc-ioctl.h"x+x+#include <linux/string.h>x+
+/****
+ *
+ *
+ *
+ */x+x+x+static void fill_table_a000(unsigned int *p)
+{x+  static unsigned int initial_values[12] = {x+     0xFFAD9B00, 0xFFDDEE00, 0x00221200, 0x00526500,
+     0xFFC21E00, 0x003DE200, 0xFF924B80, 0xFFD2A300,
+     0x002D5D00, 0x006DB480, 0xFFED3E00, 0x0012C200
+  };x+  static unsigned int values_derivated[12] = {x+     0x0000A4CA, 0x00004424, 0xFFFFBBDC, 0xFFFF5B36,x+     0x00007BC4, 0xFFFF843C, 0x0000DB69, 0x00005ABA,
+     0xFFFFA546, 0xFFFF2497, 0x00002584, 0xFFFFDA7C
+  };x+  unsigned int temp_values[12];x+  int i,j;
+x+  memcpy(temp_values,initial_values,sizeof(initial_values));
+  for (i=0;i<256;i++)
+   {x+     for (j=0;j<12;j++)
+      {x+	*p++ = temp_values[j];x+	temp_values[j] += values_derivated[j];x+      }
+   }x+}x+x+static void fill_table_d000(unsigned char *p)
+{x+  int bit,byte;
+x+  for (bit=0; bit<8; bit++)
+   {x+     unsigned char bitpower = 1<<bit;x+     unsigned char mask = bitpower-1;
+     for (byte=0; byte<256; byte++)
+      {x+	if (byte & bitpower)
+	  *p++ = -(byte & mask);
+	elsex+	  *p++ = (byte & mask);
+      }
+   }x+}x+x+/*
+ *
+ * Kiara: 0 <= ver <= 7
+ * Timon: 0 <= ver <= 15
+ *
+ */x+void fill_table_color(unsigned int version, const unsigned int *romtable, x+    unsigned char *p0004, x+    unsigned char *p8004)
+{x+  const unsigned int *table;x+  unsigned char *p0, *p8;x+  int i,j,k;x+  int dl,bit,pw;
+x+  romtable += version*256;
+x+  for (i=0; i<2; i++)
+   {x+     table = romtable + i*128;
+
+     for (dl=0; dl<16; dl++)
+      {x+	p0 = p0004 + (i<<14) + (dl<<10);x+	p8 = p8004 + (i<<12) + (dl<<8);x+
+	for (j=0; j<8; j++ , table++, p0+=128)
+	 {
+	   for (k=0; k<16; k++)
+	    {x+	      if (k==0)
+		bit=1;x+	      else if (k>=1 && k<3)
+		bit=(table[0]>>15)&7;x+	      else if (k>=3 && k<6)
+		bit=(table[0]>>12)&7;x+	      else if (k>=6 && k<10)
+		bit=(table[0]>>9)&7;x+	      else if (k>=10 && k<13)
+		bit=(table[0]>>6)&7;x+	      else if (k>=13 && k<15)
+		bit=(table[0]>>3)&7;x+	      else
+		bit=(table[0])&7;x+	      if (k == 0)x+		*(unsigned char *)p8++ = 8;x+	      else
+		*(unsigned char *)p8++ = j - bit;x+	      *(unsigned char *)p8++ = bit;x+x+	      pw = 1<<bit;x+	      p0[k+0x00] = (1*pw)  + 0x80;x+	      p0[k+0x10] = (2*pw)  + 0x80;x+	      p0[k+0x20] = (3*pw)  + 0x80;x+	      p0[k+0x30] = (4*pw)  + 0x80;x+	      p0[k+0x40] = (-pw)   + 0x80;x+	      p0[k+0x50] = (2*-pw) + 0x80;x+	      p0[k+0x60] = (3*-pw) + 0x80;x+	      p0[k+0x70] = (4*-pw) + 0x80;x+	    } /* end of for (k=0; k<16; k++, p8++) */
+	 } /* end of for (j=0; j<8; j++ , table++) */
+      } /* end of for (dl=0; dl<16; dl++) */
+   } /* end of for (i=0; i<2; i++) */
+}x+x+/*
+ * precision = (pdev->xx + pdev->yy)
+ *
+ */x+void fill_table_dc00_d800(unsigned int precision, unsigned int *pdc00, unsigned int *pd800)
+{x+  int i;x+  unsigned int offset1, offset2;x+ x+  for(i=0,offset1=0x4000, offset2=0; i<256 ; i++,offset1+=0x7BC4, offset2+=0x7BC4)
+   {x+     unsigned int msb = offset1 >> 15;
+
+     if ( msb > 255)
+      {x+	if (msb)
+	  msb=0;
+	elsex+	  msb=255;
+      }
+
+     *pdc00++ = msb << precision;
+     *pd800++ = offset2;x+   }
+
+}x+x+/*
+ * struct {
+ *   unsigned char op;	    // operation to execute
+ *   unsigned char bits;    // bits use to perform operation
+ *   unsigned char offset1; // offset to add to access in the table_0004 % 16
+ *   unsigned char offset2; // offset to add to access in the table_0004
+ * }
+ *
+ */x+static unsigned int table_ops[] = {x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x00, 0x00,0x04,0x01,0x10, 0x00,0x06,0x01,0x30,
+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x40, 0x00,0x05,0x01,0x20, 0x01,0x00,0x00,0x00,x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x00, 0x00,0x04,0x01,0x50, 0x00,0x05,0x02,0x00,x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x40, 0x00,0x05,0x03,0x00, 0x01,0x00,0x00,0x00,x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x00, 0x00,0x04,0x01,0x10, 0x00,0x06,0x02,0x10,
+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x40, 0x00,0x05,0x01,0x60, 0x01,0x00,0x00,0x00,x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x00, 0x00,0x04,0x01,0x50, 0x00,0x05,0x02,0x40,x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x40, 0x00,0x05,0x03,0x40, 0x01,0x00,0x00,0x00,x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x00, 0x00,0x04,0x01,0x10, 0x00,0x06,0x01,0x70,
+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x40, 0x00,0x05,0x01,0x20, 0x01,0x00,0x00,0x00,x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x00, 0x00,0x04,0x01,0x50, 0x00,0x05,0x02,0x00,x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x40, 0x00,0x05,0x03,0x00, 0x01,0x00,0x00,0x00,x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x00, 0x00,0x04,0x01,0x10, 0x00,0x06,0x02,0x50,
+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x40, 0x00,0x05,0x01,0x60, 0x01,0x00,0x00,0x00,x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x00, 0x00,0x04,0x01,0x50, 0x00,0x05,0x02,0x40,x+0x02,0x00,0x00,0x00, 0x00,0x03,0x01,0x40, 0x00,0x05,0x03,0x40, 0x01,0x00,0x00,0x00
+};x+x+/*
+ * TODO: multiply by 4 all values
+ *
+ */x+static unsigned int MulIdx[256] = {x+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,x+ 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3,x+ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,x+ 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4,x+ 6, 7, 8, 9, 7,10,11, 8, 8,11,10, 7, 9, 8, 7, 6,x+ 4, 5, 5, 4, 4, 5, 5, 4, 4, 5, 5, 4, 4, 5, 5, 4,x+ 1, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2, 1, 3, 0, 2,x+ 0, 3, 3, 0, 1, 2, 2, 1, 2, 1, 1, 2, 3, 0, 0, 3,x+ 0, 1, 2, 3, 3, 2, 1, 0, 3, 2, 1, 0, 0, 1, 2, 3,x+ 1, 1, 1, 1, 3, 3, 3, 3, 0, 0, 0, 0, 2, 2, 2, 2,x+ 7,10,11, 8, 9, 8, 7, 6, 6, 7, 8, 9, 8,11,10, 7,x+ 4, 5, 5, 4, 5, 4, 4, 5, 5, 4, 4, 5, 4, 5, 5, 4,x+ 7, 9, 6, 8,10, 8, 7,11,11, 7, 8,10, 8, 6, 9, 7,x+ 1, 3, 0, 2, 2, 0, 3, 1, 2, 0, 3, 1, 1, 3, 0, 2,x+ 1, 2, 2, 1, 3, 0, 0, 3, 0, 3, 3, 0, 2, 1, 1, 2,
+10, 8, 7,11, 8, 6, 9, 7, 7, 9, 6, 8,11, 7, 8,10
+};x+x+x+x+void pwc_dec23_init(int type, int release, unsigned char *mode, void *data)
+{x+  int flags;x+  struct pwc_dec23_private *pdev = data;x+  release = release;
+x+  switch (type)
+   {x+    case 720:x+    case 730:x+    case 740:x+    case 750:x+      flags = mode[2]&0x18;	/* our: flags = 8, mode[2]==e8 */
+      if (flags==8)
+	pdev->zz = 7;
+      else if (flags==0x10)
+	pdev->zz = 8;
+      else
+	pdev->zz = 6;x+      flags = mode[2]>>5;	/* our: 7 */
+
+      fill_table_color(flags, (unsigned int *)KiaraRomTable, pdev->table_0004, pdev->table_8004);x+      break;
+
+
+    case 675:x+    case 680:x+    case 690:x+      flags = mode[2]&6;x+      if (flags==2)
+	pdev->zz = 7;
+      else if (flags==4)
+	pdev->zz = 8;
+      else
+	pdev->zz = 6;x+      flags = mode[2]>>3;
+
+      fill_table_color(flags, (unsigned int *)TimonRomTable, pdev->table_0004, pdev->table_8004);x+      break;
+
+    default:
+      /* Not supported */
+      return;x+   }
+
+  /* * * * ** */
+  pdev->xx = 8 - pdev->zz;
+  pdev->yy = 15 - pdev->xx;
+  pdev->zzmask = 0xFF>>pdev->xx;
+  //pdev->zzmask = (1U<<pdev->zz)-1;
+
+x+  fill_table_dc00_d800(pdev->xx + pdev->yy, pdev->table_dc00, pdev->table_d800);x+  fill_table_a000(pdev->table_a004);x+  fill_table_d000(pdev->table_d004);x+}x+x+x+/*
+ * To manage the stream, we keep in a 32 bits variables,x+ * the next bits in the stream. fill_reservoir() add tox+ * the reservoir at least wanted nbits.
+ *
+ *
+ */x+#define fill_nbits(reservoir,nbits_in_reservoir,stream,nbits_wanted) do { \x+   while (nbits_in_reservoir<nbits_wanted) \x+    { \x+      reservoir |= (*(stream)++) << nbits_in_reservoir; \x+      nbits_in_reservoir+=8; \x+    } \x+}  while(0);
+x+#define get_nbits(reservoir,nbits_in_reservoir,stream,nbits_wanted,result) do { \x+   fill_nbits(reservoir,nbits_in_reservoir,stream,nbits_wanted); \x+   result = (reservoir) & ((1U<<nbits_wanted)-1); \x+   reservoir >>= nbits_wanted; \x+   nbits_in_reservoir -= nbits_wanted; \x+}  while(0);
+x+x+x+static void DecompressBand23(const struct pwc_dec23_private *pdev,
+                             const unsigned char *rawyuv,
+			     unsigned char *planar_y,
+			     unsigned char *planar_u,
+			     unsigned char *planar_v,
+			     unsigned int image_x,		/* aka number of pixels wanted ??? */
+			     unsigned int pixels_per_line,	/* aka number of pixels per line */
+			     int flags)
+{x+
+x+  unsigned int reservoir, nbits_in_reservoir;x+  int first_4_bits;x+  unsigned int bytes_per_channel;x+  int line_size;	/* size of the line (4Y+U+V) */
+  int passes;x+  const unsigned char *ptable0004, *ptable8004;
+
+  int even_line;x+  unsigned int temp_colors[16];x+  int nblocks;
+
+  const unsigned char *stream;x+  unsigned char *dest_y, *dest_u=NULL, *dest_v=NULL;x+  unsigned int offset_to_plane_u, offset_to_plane_v;
+
+  int i;
+
+x+  reservoir = 0;x+  nbits_in_reservoir = 0;x+  stream = rawyuv+1;	/* The first byte of the stream is skipped */
+  even_line = 1;
+
+  get_nbits(reservoir,nbits_in_reservoir,stream,4,first_4_bits);
+
+  line_size = pixels_per_line*3;
+x+  for (passes=0;passes<2;passes++)
+   {x+     if (passes==0)
+      {x+	bytes_per_channel = pixels_per_line;
+	dest_y = planar_y;
+	nblocks = image_x/4;
+      }
+     else
+      {x+	/* Format planar: All Y, then all U, then all V */
+	bytes_per_channel = pixels_per_line/2;
+	dest_u = planar_u;
+	dest_v = planar_v;
+	dest_y = dest_u;
+	nblocks = image_x/8;
+      }
+
+     offset_to_plane_u = bytes_per_channel*2;
+     offset_to_plane_v = bytes_per_channel*3;
+     /*x+     printf("bytes_per_channel = %d\n",bytes_per_channel);x+     printf("offset_to_plane_u = %d\n",offset_to_plane_u);x+     printf("offset_to_plane_v = %d\n",offset_to_plane_v);x+     */
+
+     while (nblocks-->0)
+      {x+	unsigned int gray_index;x+
+	fill_nbits(reservoir,nbits_in_reservoir,stream,16);x+	gray_index = reservoir & pdev->zzmask;
+	reservoir >>= pdev->zz;
+	nbits_in_reservoir -= pdev->zz;
+
+	fill_nbits(reservoir,nbits_in_reservoir,stream,2);x+
+	if ( (reservoir & 3) == 0)x+	 {x+	   reservoir>>=2;x+	   nbits_in_reservoir-=2;x+	   for (i=0;i<16;i++)
+	     temp_colors[i] = pdev->table_dc00[gray_index];x+x+	 }
+	elsex+	 {x+	   unsigned int channel_v, offset1;x+x+	   /* swap bit 0 and 2 of offset_OR */
+	   channel_v = ((reservoir & 1) << 2) | (reservoir & 2) | ((reservoir & 4)>>2);
+	   reservoir>>=3;x+	   nbits_in_reservoir-=3;x+x+	   for (i=0;i<16;i++)
+	     temp_colors[i] = pdev->table_d800[gray_index];x+x+	   ptable0004 = pdev->table_0004 + (passes*16384) + (first_4_bits*1024) + (channel_v*128);
+	   ptable8004 = pdev->table_8004 + (passes*4096)  + (first_4_bits*256)  + (channel_v*32);x+
+	   offset1 = 0;x+	   while(1) 
+	    {x+	      unsigned int index_in_table_ops, op, rows=0;x+	      fill_nbits(reservoir,nbits_in_reservoir,stream,16);x+x+	      /* mode is 0,1 or 2 */
+	      index_in_table_ops = (reservoir&0x3F);x+	      op = table_ops[ index_in_table_ops*4 ];x+	      if (op == 2)
+	       {x+		 reservoir >>= 2;x+		 nbits_in_reservoir -= 2;x+		 break;	/* exit the while(1) */
+	       }
+	      if (op == 0)
+	       {x+		 unsigned int shift;x+x+		 offset1 = (offset1 + table_ops[index_in_table_ops*4+2]) & 0x0F;x+		 shift = table_ops[ index_in_table_ops*4+1 ];x+		 reservoir >>= shift;x+		 nbits_in_reservoir -= shift;x+		 rows = ptable0004[ offset1 + table_ops[index_in_table_ops*4+3] ];x+	       }
+	      if (op == 1)
+	       {x+		  /* 10bits [ xxxx xxxx yyyy 000 ]x+		   * yyy => offset in the table8004
+		   * xxx => offset in the tabled004
+		   */x+		 unsigned int mask, shift;x+		 unsigned int col1, row1, total_bits;x+x+		 offset1 = (offset1 + ((reservoir>>3)&0x0F)+1) & 0x0F;x+x+		 col1 = (reservoir>>7) & 0xFF;x+		 row1 = ptable8004 [ offset1*2 ];x+x+		 /* Bit mask table */x+		 mask = pdev->table_d004[ (row1<<8) + col1 ];x+		 shift = ptable8004 [ offset1*2 + 1];x+		 rows = ((mask << shift) + 0x80) & 0xFF;x+x+		 total_bits = row1 + 8;x+		 reservoir >>= total_bits;x+		 nbits_in_reservoir -= total_bits;x+	       }
+	       {x+		 const unsigned int *table_a004 = pdev->table_a004 + rows*12;x+		 unsigned int *poffset = MulIdx + offset1*16;	/* 64/4 (int) */x+		 for (i=0;i<16;i++)
+		  {x+		    temp_colors[i] += table_a004[ *poffset ];x+		    poffset++;x+		  }x+	       }
+	   }x+	 }
+#define USE_SIGNED_INT_FOR_COLOR
+#ifdef USE_SIGNED_INT_FOR_COLOR
+#  define CLAMP(x) ((x)>255?255:((x)<0?0:x))
+#elsex+#  define CLAMP(x) ((x)>255?255:x)x+#endif
+x+	if (passes == 0)x+	 {x+#ifdef USE_SIGNED_INT_FOR_COLOR
+	   const int *c = temp_colors;
+#elsex+	   const unsigned int *c = temp_colors;
+#endif
+	   unsigned char *d;x+x+	   d = dest_y;x+	   for (i=0;i<4;i++,c++)
+	     *d++ = CLAMP((*c) >> pdev->yy);x+x+	   d = dest_y + bytes_per_channel;x+	   for (i=0;i<4;i++,c++)
+	     *d++ = CLAMP((*c) >> pdev->yy);x+x+	   d = dest_y + offset_to_plane_u;x+	   for (i=0;i<4;i++,c++)
+	     *d++ = CLAMP((*c) >> pdev->yy);x+x+	   d = dest_y + offset_to_plane_v;x+	   for (i=0;i<4;i++,c++)
+	     *d++ = CLAMP((*c) >> pdev->yy);x+x+	   dest_y += 4;x+	 }
+	else if (passes == 1)x+	 {x+#ifdef USE_SIGNED_INT_FOR_COLOR
+	   int *c1 = temp_colors;
+	   int *c2 = temp_colors+4;
+#elsex+	   unsigned int *c1 = temp_colors;
+	   unsigned int *c2 = temp_colors+4;
+#endif
+	   unsigned char *d;x+x+	   d = dest_y;x+	   for (i=0;i<4;i++,c1++,c2++)
+	    {x+	      *d++ = CLAMP((*c1) >> pdev->yy);x+	      *d++ = CLAMP((*c2) >> pdev->yy);x+	    }
+	   c1 = temp_colors+12;x+	   //c2 = temp_colors+8;x+	   d = dest_y + bytes_per_channel;x+	   for (i=0;i<4;i++,c1++,c2++)
+	    {x+	      *d++ = CLAMP((*c1) >> pdev->yy);x+	      *d++ = CLAMP((*c2) >> pdev->yy);x+	    }
+
+	   if (even_line)	/* Each line, swap u/v */
+	    {x+	      even_line=0;x+	      dest_y = dest_v;x+	      dest_u += 8;x+	    }
+	   elsex+	    {x+	      even_line=1;x+	      dest_y = dest_u;x+	      dest_v += 8;x+	    }
+	 }
+
+      } /* end of while (nblocks-->0) */
+
+   } /* end of for (passes=0;passes<2;passes++) */
+
+}x+x+x+/**
+ *
+ * image: size of the image wanted
+ * view : size of the image returned by the camera
+ * offset: (x,y) to displayer image in the view
+ *
+ * src: raw data
+ * dst: image output
+ * flags: PWCX_FLAG_PLANAR
+ * pdev: private buffer
+ * bandlength:
+ *
+ */x+void pwc_dec23_decompress(const struct pwc_coord *image,
+                            const struct pwc_coord *view,
+			    const struct pwc_coord *offset,
+			    const void *src,
+			    void *dst,
+			    int flags,
+			    const void *data,
+			    int bandlength)
+{x+  const struct pwc_dec23_private *pdev = data;x+  unsigned char *pout, *pout_planar_y=NULL, *pout_planar_u=NULL, *pout_planar_v=NULL;x+  int i,n,stride,pixel_size;x+
+
+  if (flags & PWCX_FLAG_BAYER)
+   {x+     pout = dst + (view->x * offset->y) + offset->x;x+     pixel_size = view->x * 4;x+   }
+  else
+   {x+     n = view->x * view->y;
+
+     /* offset in Y plane */
+     stride = view->x * offset->y;x+     pout_planar_y = dst + stride + offset->x;x+
+     /* offsets in U/V planes */
+     stride = (view->x * offset->y)/4 + offset->x/2;x+     pout_planar_u = dst + n +     + stride;x+     pout_planar_v = dst + n + n/4 + stride;x+x+     pixel_size = view->x * 4;x+   }
+
+x+  for (i=0;i<image->y;i+=4)
+   {x+     if (flags & PWCX_FLAG_BAYER)
+      {x+	//TODO:x+	//DecompressBandBayer(pdev,src,pout,image.x,view->x,flags);x+	src += bandlength;
+	pout += pixel_size;x+      }
+     else
+      {x+	DecompressBand23(pdev,src,pout_planar_y,pout_planar_u,pout_planar_v,image->x,view->x,flags);x+	src += bandlength;
+	pout_planar_y += pixel_size;x+	pout_planar_u += view->x;x+	pout_planar_v += view->x;x+      }
+   }x+}x+x+void pwc_dec23_exit(void)x+{x+  /* Do nothing */
+x+}x+xdiff -Nru a/drivers/usb/media/pwc/pwc-dec23.h b/drivers/usb/media/pwc/pwc-dec23.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-dec23.h	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,58 @@x+/* Linux driver for Philips webcam
+   (C) 2004      Luc Saillard (luc@saillard.org)x+
+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
+   driver and thus may have bugs that are not present in the original version.
+   Please send bug reports and support requests to <luc@saillard.org>.
+   The decompression routines have been implemented by reverse-engineering the
+   Nemosoft binary pwcx module. Caveat emptor.x+
+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.x+
+   This program is distributed in the hope that it will be useful,x+   butxWITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.x+
+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef PWC_DEC23_Hx+#define PWC_DEC23_Hx+x+struct pwc_dec23_privatex+{x+  unsigned char xx,yy,zz,zzmask;
+x+  unsigned char table_0004[2*0x4000];x+  unsigned char table_8004[2*0x1000];x+  unsigned int  table_a004[256*12];x+x+  unsigned char table_d004[8*256];x+  unsigned int  table_d800[256];x+  unsigned int  table_dc00[256];x+};x+x+x+void pwc_dec23_init(int type, int release, unsigned char *buffer, void *private_data);
+void pwc_dec23_exit(void);x+void pwc_dec23_decompress(const struct pwc_coord *image,
+                            const struct pwc_coord *view,
+			    const struct pwc_coord *offset,
+			    const void *src,
+			    void *dst,
+			    int flags,
+			    const void *data,
+			    int bandlength);
+x+x+x+#endif
+x+x+xdiff -Nru a/drivers/usb/media/pwc/pwc-if.c b/drivers/usb/media/pwc/pwc-if.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-if.c	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,2211 @@x+/* Linux driver for Philips webcam
+   USB and Video4Linux interface part.
+   (C) 1999-2004 Nemosoft Unv.
+   (C) 2004      Luc Saillard (luc@saillard.org)x+
+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
+   driver and thus may have bugs that are not present in the original version.
+   Please send bug reports and support requests to <luc@saillard.org>.
+   The decompression routines have been implemented by reverse-engineering the
+   Nemosoft binary pwcx module. Caveat emptor.x+
+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.x+
+   This program is distributed in the hope that it will be useful,x+   butxWITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.x+
+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+/*  
+   This code forms the interface between the USB layers and the Philips
+   specific stuff. Some adanved stuff of the driver falls under an
+   NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, andx+   is thus not distributed in source form. The binary pwcx.o module 
+   contains the code that falls under the NDA.
+   
+   In case you're wondering: 'pwc' stands for "Philips WebCam", butx
+   I really didn't want to type 'philips_web_cam' every time (I'm lazy asx+   any Linux kernel hacker, butxI don't like uncomprehensible abbreviationsx+   without explanation).
+   
+   Oh yes, convention: to disctinguish between all the various pointers tox+   device-structures, I use these names for the pointer variables:
+   udev: struct usb_device *x+   vdev: struct video_device *x+   pdev: struct pwc_devive *
+*/
+
+/* Contributors:
+   - Alvarado: adding whitebalance code
+   - Alistar Moire: QuickCam 3000 Pro device/product ID
+   - Tony Hoyle: Creative Labs Webcam 5 device/product ID
+   - Mark Burazin: solving hang in VIDIOCSYNC when camera gets unplugged
+   - Jk Fang: Sotec Afina Eye ID
+   - Xavier Roche: QuickCam Pro 4000 ID
+   - Jens Knudsen: QuickCam Zoom ID
+   - J. Debert: QuickCam for Notebooks ID
+*/
+
+#include <linux/errno.h>x+#include <linux/init.h>x+#include <linux/mm.h>x+#include <linux/module.h>x+#include <linux/poll.h>x+#include <linux/slab.h>x+#include <linux/vmalloc.h>x+#include <asm/io.h>x+
+#include "pwc.h"x+#include "pwc-ioctl.h"x+#include "pwc-kiara.h"x+#include "pwc-timon.h"x+#include "pwc-dec23.h"x+#include "pwc-dec1.h"x+#include "pwc-uncompress.h"x+x+/* Function prototypes and driver templates */
+
+/* hotplug device table support */x+static struct usb_device_id pwc_device_table [] = {x+	{ USB_DEVICE(0x0471, 0x0302) }, /* Philips models */
+	{ USB_DEVICE(0x0471, 0x0303) },
+	{ USB_DEVICE(0x0471, 0x0304) },
+	{ USB_DEVICE(0x0471, 0x0307) },
+	{ USB_DEVICE(0x0471, 0x0308) },
+	{ USB_DEVICE(0x0471, 0x030C) },
+	{ USB_DEVICE(0x0471, 0x0310) },
+	{ USB_DEVICE(0x0471, 0x0311) },
+	{ USB_DEVICE(0x0471, 0x0312) },
+	{ USB_DEVICE(0x0471, 0x0313) }, /* the 'new' 720K */
+	{ USB_DEVICE(0x069A, 0x0001) }, /* Askey */
+	{ USB_DEVICE(0x046D, 0x08B0) }, /* Logitech QuickCam Pro 3000 */
+	{ USB_DEVICE(0x046D, 0x08B1) }, /* Logitech QuickCam Notebook Pro */
+	{ USB_DEVICE(0x046D, 0x08B2) }, /* Logitech QuickCam Pro 4000 */
+	{ USB_DEVICE(0x046D, 0x08B3) }, /* Logitech QuickCam Zoom (old model) */
+	{ USB_DEVICE(0x046D, 0x08B4) }, /* Logitech QuickCam Zoom (new model) */
+	{ USB_DEVICE(0x046D, 0x08B5) }, /* Logitech QuickCam Orbit/Sphere */
+	{ USB_DEVICE(0x046D, 0x08B6) }, /* Logitech (reserved) */
+	{ USB_DEVICE(0x046D, 0x08B7) }, /* Logitech (reserved) */
+	{ USB_DEVICE(0x046D, 0x08B8) }, /* Logitech (reserved) */
+	{ USB_DEVICE(0x055D, 0x9000) }, /* Samsung */
+	{ USB_DEVICE(0x055D, 0x9001) },
+	{ USB_DEVICE(0x041E, 0x400C) }, /* Creative Webcam 5 */
+	{ USB_DEVICE(0x041E, 0x4011) }, /* Creative Webcam Pro Ex */
+	{ USB_DEVICE(0x04CC, 0x8116) }, /* Afina Eye */
+	{ USB_DEVICE(0x06BE, 0x8116) }, /* new Afina Eye */
+	{ USB_DEVICE(0x0d81, 0x1910) }, /* Visionite */
+	{ USB_DEVICE(0x0d81, 0x1900) },
+	{ }x+};x+MODULE_DEVICE_TABLE(usb, pwc_device_table);
+x+static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id *id);x+static void usb_pwc_disconnect(struct usb_interface *intf);
+x+static struct usb_driver pwc_driver = {x+	.owner =		THIS_MODULE,
+	.name =			"Philips webcam",	/* name */
+	.id_table =		pwc_device_table,
+	.probe =		usb_pwc_probe,		/* probe() */
+	.disconnect =		usb_pwc_disconnect,	/* disconnect() */
+};
+x+#define MAX_DEV_HINTS	20x+#define MAX_ISOC_ERRORS	20x+x+static int default_size = PSZ_QCIF;x+static int default_fps = 10;x+static int default_fbufs = 3;   /* Default number of frame buffers */x+static int default_mbufs = 2;	/* Default number of mmap() buffers */x+       int pwc_trace = TRACE_MODULE | TRACE_FLOW | TRACE_PWCX;x+static int power_save = 0;x+static int led_on = 100, led_off = 0; /* defaults to LED that is on while in use */x+       int pwc_preferred_compression = 2; /* 0..3 = uncompressed..high */x+static struct {x+	int type;x+	char serial_number[30];x+	int device_node;x+	struct pwc_device *pdev;x+} device_hint[MAX_DEV_HINTS];x+
+/***/x+x+static int pwc_video_open(struct inode *inode, struct file *file);x+static int pwc_video_close(struct inode *inode, struct file *file);x+static ssize_t pwc_video_read(struct file *file, char *buf,
+			  size_t count, loff_t *ppos);x+static unsigned int pwc_video_poll(struct file *file, poll_table *wait);x+static int  pwc_video_ioctl(struct inode *inode, struct file *file,
+			    unsigned int ioctlnr, unsigned long arg);x+static int  pwc_video_mmap(struct file *file, struct vm_area_struct *vma);
+x+static struct file_operations pwc_fops = {x+	.owner =	THIS_MODULE,
+	.open =		pwc_video_open,
+	.release =     	pwc_video_close,
+	.read =		pwc_video_read,
+	.poll =		pwc_video_poll,
+	.mmap =		pwc_video_mmap,
+	.ioctl =        pwc_video_ioctl,
+	.llseek =       no_llseek,
+};
+static struct video_device pwc_template = {x+	.owner =	THIS_MODULE,
+	.name =		"Philips Webcam",	/* Filled in later */
+	.type =		VID_TYPE_CAPTURE,
+	.hardware =	VID_HARDWARE_PWC,
+	.release =	video_device_release,
+	.fops =         &pwc_fops,
+	.minor =        -1,
+};x+x+/***************************************************************************/
+
+/* Okay, this is some magic that I worked out and the reasoning behind it...x+
+   The biggest problem with any USB device is of course: "what to do x+   when the user unplugs the device while it is in use by an application?"x+   We have several options:
+   1) Curse them with the 7 plagues when they do (requires divine intervention)
+   2) Tell them not to (won't work: they'll do it anyway)
+   3) Oops the kernel (this will have a negative effect on a user's uptime)
+   4) Do something sensible.
+   
+   Of course, we go for option 4.x+
+   It happens that this device will be linked to two times, once from
+   usb_device and once from the video_device in their respective 'private'x+   pointers. This is done when the device is probed() and all initialization
+   succeeded. The pwc_device struct links back to both structures.x+
+   When a device is unplugged while in use it will be removed from the 
+   list of known USB devices; I also de-register it as a V4L device, butx
+   unfortunately I can't free the memory since the struct is still in usex+   by the file descriptor. This free-ing is then deferend until the firstx+   opportunity. Crude, butxit works.
+   
+   A small 'advantage' is that if a user unplugs the cam and plugs it backx+   in, it should get assigned the same video device minor, butxunfortunatelyx+   it's non-trivial to re-link the cam back to the video device... (thatx
+   would surely be magic! :))
+*/
+
+/***************************************************************************/
+/* Private functions */
+
+/* Here we want the physical address of the memory.
+ * This is used when initializing the contents of the area.
+ */x+static inline unsigned long kvirt_to_pa(unsigned long adr) 
+{
+        unsigned long kva, ret;
+
+	kva = (unsigned long) page_address(vmalloc_to_page((void *)adr));x+	kva |= adr & (PAGE_SIZE-1); /* restore the offset */
+	ret = __pa(kva);x+        return ret;
+}x+x+static void * rvmalloc(unsigned long size)
+{
+	void * mem;x+	unsigned long adr;
+
+	size=PAGE_ALIGN(size);
+        mem=vmalloc_32(size);
+	if (mem) 
+	{
+		memset(mem, 0, size); /* Clear the ram out, no junk to the user */
+	        adr=(unsigned long) mem;x+		while (size > 0) 
+                {
+			SetPageReserved(vmalloc_to_page((void *)adr));x+			adr+=PAGE_SIZE;x+			size-=PAGE_SIZE;x+		}
+	}
+	return mem;x+}x+x+static void rvfree(void * mem, unsigned long size)
+{
+        unsigned long adr;
+
+	if (mem) 
+	{
+	        adr=(unsigned long) mem;x+		while ((long) size > 0) 
+                {
+			ClearPageReserved(vmalloc_to_page((void *)adr));x+			adr+=PAGE_SIZE;x+			size-=PAGE_SIZE;x+		}
+		vfree(mem);
+	}
+}x+x+
+
+x+static int pwc_allocate_buffers(struct pwc_device *pdev)
+{
+	int i;
+	void *kbuf;
+
+	Trace(TRACE_MEMORY, ">> pwc_allocate_buffers(pdev = 0x%p)\n", pdev);x+
+	if (pdev == NULL)
+		return -ENXIO;x+		x+#ifdef PWC_MAGIC
+	if (pdev->magic != PWC_MAGIC) {
+		Err("allocate_buffers(): magic failed.\n");x+		return -ENXIO;x+	}x+#endif	x+	/* Allocate Isochronuous pipe buffers */x+	for (i = 0; i < MAX_ISO_BUFS; i++) {
+		if (pdev->sbuf[i].data == NULL) {
+			kbuf = kmalloc(ISO_BUFFER_SIZE, GFP_KERNEL);x+			if (kbuf == NULL) {
+				Err("Failed to allocate iso buffer %d.\n", i);x+				return -ENOMEM;x+			}
+			Trace(TRACE_MEMORY, "Allocated iso buffer atx%p.\n", kbuf);x+			pdev->sbuf[i].data = kbuf;
+			memset(kbuf, 0, ISO_BUFFER_SIZE);x+		}
+	}
+x+	/* Allocate frame buffer structure */x+	if (pdev->fbuf == NULL) {
+		kbuf = kmalloc(default_fbufs * sizeof(struct pwc_frame_buf), GFP_KERNEL);x+		if (kbuf == NULL) {
+			Err("Failed to allocate frame buffer structure.\n");x+			return -ENOMEM;x+		}
+		Trace(TRACE_MEMORY, "Allocated frame buffer structure atx%p.\n", kbuf);x+		pdev->fbuf = kbuf;
+		memset(kbuf, 0, default_fbufs * sizeof(struct pwc_frame_buf));
+	}
+	/* create frame buffers, and make circular ring */
+	for (i = 0; i < default_fbufs; i++) {
+		if (pdev->fbuf[i].data == NULL) {
+			kbuf = vmalloc(PWC_FRAME_SIZE); /* need vmalloc since frame buffer > 128K */
+			if (kbuf == NULL) {
+				Err("Failed to allocate frame buffer %d.\n", i);x+				return -ENOMEM;x+			}
+			Trace(TRACE_MEMORY, "Allocated frame buffer %d atx%p.\n", i, kbuf);x+			pdev->fbuf[i].data = kbuf;
+			memset(kbuf, 128, PWC_FRAME_SIZE);x+		}
+	}
+	x+	/* Allocate decompressor table space */
+	kbuf = NULL;x+	switch (pdev->type)
+	 {x+	  case 675:x+	  case 680:x+	  case 690:x+	  case 720:x+	  case 730:x+	  case 740:x+	  case 750:x+	    Trace(TRACE_MEMORY,"private_data(%d)\n",sizeof(struct pwc_dec23_private));x+	    kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL);	/* Timon & Kiara */
+	    break;
+	  case 645:x+	  case 646:x+	    /* TODO & FIXME */
+	    kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL);
+	    break;
+	 }x+	if (kbuf == NULL) {
+	   Err("Failed to allocate decompress table.\n");x+	   return -ENOMEM;x+	}
+	pdev->decompress_data = kbuf;
+	x+	/* Allocate image buffer; double buffer for mmap() */
+	kbuf = rvmalloc(default_mbufs * pdev->len_per_image);
+	if (kbuf == NULL) {
+		Err("Failed to allocate image buffer(s). needed (%d)\n",default_mbufs * pdev->len_per_image);
+		return -ENOMEM;x+	}
+	Trace(TRACE_MEMORY, "Allocated image buffer atx%p.\n", kbuf);x+	pdev->image_data = kbuf;
+	for (i = 0; i < default_mbufs; i++)x+		pdev->image_ptr[i] = kbuf + i * pdev->len_per_image;
+	for (; i < MAX_IMAGES; i++)x+		pdev->image_ptr[i] = NULL;x+
+	kbuf = NULL;x+	  
+	Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n");x+	return 0;x+}x+x+static void pwc_free_buffers(struct pwc_device *pdev)
+{
+	int i;
+
+	Trace(TRACE_MEMORY, "Entering free_buffers(%p).\n", pdev);x+
+	if (pdev == NULL)
+		return;x+#ifdef PWC_MAGIC
+	if (pdev->magic != PWC_MAGIC) {
+		Err("free_buffers(): magic failed.\n");x+		return;x+	}x+#endif	x+x+	/* Release Iso-pipe buffers */x+	for (i = 0; i < MAX_ISO_BUFS; i++)
+		if (pdev->sbuf[i].data != NULL) {
+			Trace(TRACE_MEMORY, "Freeing ISO buffer atx%p.\n", pdev->sbuf[i].data);x+			kfree(pdev->sbuf[i].data);x+			pdev->sbuf[i].data = NULL;x+		}
+x+	/* The same for frame buffers */x+	if (pdev->fbuf != NULL) {
+		for (i = 0; i < default_fbufs; i++) {
+			if (pdev->fbuf[i].data != NULL) {
+				Trace(TRACE_MEMORY, "Freeing frame buffer %d atx%p.\n", i, pdev->fbuf[i].data);x+				vfree(pdev->fbuf[i].data);x+				pdev->fbuf[i].data = NULL;x+			}
+		}
+		kfree(pdev->fbuf);x+		pdev->fbuf = NULL;x+	}
+x+	/* Intermediate decompression buffer & tables */x+	if (pdev->decompress_data != NULL) {
+		Trace(TRACE_MEMORY, "Freeing decompression buffer atx%p.\n", pdev->decompress_data);x+		kfree(pdev->decompress_data);x+		pdev->decompress_data = NULL;x+	}
+	pdev->decompressor = NULL;x+
+	/* Release image buffers */x+	if (pdev->image_data != NULL) {
+		Trace(TRACE_MEMORY, "Freeing image buffer atx%p.\n", pdev->image_data);x+		rvfree(pdev->image_data, default_mbufs * pdev->len_per_image);
+	}x+	pdev->image_data = NULL;x+	
+	Trace(TRACE_MEMORY, "Leaving free_buffers().\n");x+}x+x+/* The frame & image buffer mess. x+
+   Yes, this is a mess. Well, it used to be simple, butxalas...  In this
+   module, 3 buffers schemes are used to get the data from the USB bus tox+   the user program. The first scheme involves the ISO buffers (called thus
+   since they transport ISO data from the USB controller), and not reallyx+   interesting. Suffices to say the data from this buffer is quickly 
+   gathered in an interrupt handler (pwc_isoc_handler) and placed into the
+   frame buffer.x+
+   The frame buffer is the second scheme, and is the central element here.
+   It collects the data from a single frame from the camera (hence, the
+   name). Frames are delimited by the USB camera with a short USB packet,x+   so that's easy to detect. The frame buffers form a list that is filledx+   by the camera+USB controller and drained by the user process throughx+   either read() or mmap().x+
+   The image buffer is the third scheme, in which frames are decompressedx+   and converted into planar format. For mmap() there is more than
+   one image buffer available.
+
+   The frame buffers provide the image buffering. In case the user processx+   is a bit slow, this introduces lag and some undesired side-effects.
+   The problem arises when the frame buffer is full. I used to drop the lastx+   frame, which makes the data in the queue stale very quickly. Butxdroppingx+   the frame at the head of the queue proved to be a litte bit more difficult.
+   I tried a circular linked scheme, butxthis introduced more problems than
+   it solved.
+
+   Because filling and draining are completely asynchronous processes, thisx+   requires some fiddling with pointers and mutexes.x+
+   Eventually, I came up with a system with 2 lists: an 'empty' frame listx+   and a 'full' frame list:
+     * Initially, all frame buffers butxone are on the 'empty' list; the one
+       remaining buffer is our initial fill frame.
+     * If a frame is needed for filling, we try to take it from the 'empty' 
+       list, unless that list is empty, in which case we take the buffer atx
+       the head of the 'full' list.
+     * When our fill buffer has been filled, it is appended to the 'full'
+       list.
+     * If a frame is needed by read() or mmap(), it is taken from the head of
+       the 'full' list, handled, and then appended to the 'empty' list. If no
+       buffer is present on the 'full' list, we wait.
+   The advantage is that the buffer that is currently being decompressed/
+   converted, is on neither list, and thus not in our way (any other scheme
+   I tried had the problem of old data lingering in the queue).x+
+   Whatever strategy you choose, it always remains a tradeoff: with more
+   frame buffers the chances of a missed frame are reduced. On the other
+   hand, on slower machines it introduces lag because the queue willx+   always be full.
+ */x+x+/**
+  \brief Find next frame buffer to fill. Take from empty or full list, whichever comes first.
+ */x+static inline int pwc_next_fill_frame(struct pwc_device *pdev)
+{
+	int ret;
+	unsigned long flags;x+
+	ret = 0;x+	spin_lock_irqsave(&pdev->ptrlock, flags);x+	if (pdev->fill_frame != NULL) {
+		/* append to 'full' list */
+		if (pdev->full_frames == NULL) {
+			pdev->full_frames = pdev->fill_frame;
+			pdev->full_frames_tail = pdev->full_frames;x+		}
+		else {
+			pdev->full_frames_tail->next = pdev->fill_frame;
+			pdev->full_frames_tail = pdev->fill_frame;
+		}
+	}
+	if (pdev->empty_frames != NULL) {
+		/* We have empty frames available. That's easy */
+		pdev->fill_frame = pdev->empty_frames;x+		pdev->empty_frames = pdev->empty_frames->next;
+	}x+	else {
+		/* Hmm. Take it from the full list */x+#if PWC_DEBUG
+		/* sanity check */
+		if (pdev->full_frames == NULL) {
+			Err("Neither empty or full frames available!\n");x+			spin_unlock_irqrestore(&pdev->ptrlock, flags);x+			return -EINVAL;x+		}
+#endif
+		pdev->fill_frame = pdev->full_frames;x+		pdev->full_frames = pdev->full_frames->next;
+		ret = 1;
+	}x+	pdev->fill_frame->next = NULL;x+#if PWC_DEBUG
+	Trace(TRACE_SEQUENCE, "Assigning sequence number %d.\n", pdev->sequence);x+	pdev->fill_frame->sequence = pdev->sequence++;x+#endif
+	spin_unlock_irqrestore(&pdev->ptrlock, flags);x+	return ret;
+}x+x+x+/**
+  \brief Reset all buffers, pointers and lists, except for the image_used[] buffer.x+
+  If the image_used[] buffer is cleared too, mmap()/VIDIOCSYNC will run into trouble.
+ */x+static void pwc_reset_buffers(struct pwc_device *pdev)
+{
+	int i;
+	unsigned long flags;x+
+	spin_lock_irqsave(&pdev->ptrlock, flags);x+	pdev->full_frames = NULL;x+	pdev->full_frames_tail = NULL;x+	for (i = 0; i < default_fbufs; i++) {
+		pdev->fbuf[i].filled = 0;x+		if (i > 0)x+			pdev->fbuf[i].next = &pdev->fbuf[i - 1];x+		elsex+			pdev->fbuf->next = NULL;x+	}x+	pdev->empty_frames = &pdev->fbuf[default_fbufs - 1];x+	pdev->empty_frames_tail = pdev->fbuf;
+	pdev->read_frame = NULL;x+	pdev->fill_frame = pdev->empty_frames;x+	pdev->empty_frames = pdev->empty_frames->next;
+x+	pdev->image_read_pos = 0;x+	pdev->fill_image = 0;x+	spin_unlock_irqrestore(&pdev->ptrlock, flags);x+}x+x+x+/**
+  \brief Do all the handling for gettingxone frame: get pointer, decompress, advance pointers.
+ */x+static int pwc_handle_frame(struct pwc_device *pdev)
+{
+	int ret = 0;x+	unsigned long flags;x+
+	spin_lock_irqsave(&pdev->ptrlock, flags);x+	/* First grab our read_frame; this is removed from all lists, sox+	   we can release the lock after this without problems */x+	if (pdev->read_frame != NULL) {
+		/* This can't theoretically happen */
+		Err("Huh? Read frame still in use?\n");x+	}x+	else {
+		if (pdev->full_frames == NULL) {
+			Err("Woops. No frames ready.\n");x+		}
+		else {
+			pdev->read_frame = pdev->full_frames;x+			pdev->full_frames = pdev->full_frames->next;
+			pdev->read_frame->next = NULL;x+		}
+x+		if (pdev->read_frame != NULL) {
+#if PWC_DEBUG
+			Trace(TRACE_SEQUENCE, "Decompressing frame %d\n", pdev->read_frame->sequence);x+#endif
+			/* Decompression is a lenghty process, so it's outside of the lock.
+			   This gives the isoc_handler the opportunity to fill more frames
+			   in the mean time.
+			*/
+			spin_unlock_irqrestore(&pdev->ptrlock, flags);x+			ret = pwc_decompress(pdev);x+			spin_lock_irqsave(&pdev->ptrlock, flags);x+
+			/* We're done with read_buffer, tack it to the end of the empty buffer list */
+			if (pdev->empty_frames == NULL) {
+				pdev->empty_frames = pdev->read_frame;
+				pdev->empty_frames_tail = pdev->empty_frames;x+			}
+			else {
+				pdev->empty_frames_tail->next = pdev->read_frame;
+				pdev->empty_frames_tail = pdev->read_frame;
+			}
+			pdev->read_frame = NULL;x+		}
+	}
+	spin_unlock_irqrestore(&pdev->ptrlock, flags);x+	return ret;
+}x+x+/**
+  \brief Advance pointers of image buffer (after each user request)
+*/
+static inline void pwc_next_image(struct pwc_device *pdev)
+{
+	pdev->image_used[pdev->fill_image] = 0;x+	pdev->fill_image = (pdev->fill_image + 1) % default_mbufs;x+}x+x+x+/* This gets called for the Isochronous pipe (video). This is done in
+ * interrupt time, so it has to be fast, not crash, and not stall. Neat.
+ */x+static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs)
+{
+	struct pwc_device *pdev;x+	int i, fst, flen;x+	int awake;x+	struct pwc_frame_buf *fbuf;
+	unsigned char *fillptr = 0, *iso_buf = 0;x+
+	awake = 0;x+	pdev = (struct pwc_device *)urb->context;
+	if (pdev == NULL) {
+		Err("isoc_handler() called with NULL device?!\n");x+		return;x+	}x+#ifdef PWC_MAGIC
+	if (pdev->magic != PWC_MAGIC) {
+		Err("isoc_handler() called with bad magic!\n");x+		return;x+	}x+#endif
+	if (urb->status == -ENOENT || urb->status == -ECONNRESET) {
+		Trace(TRACE_OPEN, "pwc_isoc_handler(): URB (%p) unlinked %ssynchronuously.\n", urb, urb->status == -ENOENT ? "" : "a");x+		return;x+	}x+	if (urb->status != -EINPROGRESS && urb->status != 0) {
+		const char *errmsg;x+
+		errmsg = "Unknown";x+		switch(urb->status) {
+			case -ENOSR:		errmsg = "Buffer error (overrun)"; break;
+			case -EPIPE:		errmsg = "Stalled (device not responding)"; break;
+			case -EOVERFLOW:	errmsg = "Babble (bad cable?)"; break;
+			case -EPROTO:		errmsg = "Bit-stuff error (bad cable?)"; break;
+			case -EILSEQ:		errmsg = "CRC/Timeout (could be anything)"; break;
+			case -ETIMEDOUT:	errmsg = "NAK (device does not respond)"; break;
+		}
+		Trace(TRACE_FLOW, "pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg);x+		/* Give up after a number of contiguous errors on the USB bus. x+		   Appearantly something is wrong so we simulate an unplug event.
+		 */
+		if (++pdev->visoc_errors > MAX_ISOC_ERRORS)x+		{
+			Info("Too many ISOC errors, bailing out.\n");x+			pdev->error_status = EIO;x+			awake = 1;x+			wake_up_interruptible(&pdev->frameq);x+		}
+		goto handler_end; // ugly, but practicalx+	}
+x+	fbuf = pdev->fill_frame;
+	if (fbuf == NULL) {
+		Err("pwc_isoc_handler without valid fill frame.\n");x+		awake = 1;x+		goto handler_end;x+	}x+	else {
+		fillptr = fbuf->data + fbuf->filled;x+	}
+x+	/* Reset ISOC error counter. We did get here, after all. */
+	pdev->visoc_errors = 0;x+
+	/* vsync: 0 = don't copy data
+	          1 = sync-hunt
+	          2 = synchedx+	 */
+	/* Compact data */x+	for (i = 0; i < urb->number_of_packets; i++) {
+		fst  = urb->iso_frame_desc[i].status;x+		flen = urb->iso_frame_desc[i].actual_length;
+		iso_buf = urb->transfer_buffer + urb->iso_frame_desc[i].offset;x+		if (fst == 0) {
+			if (flen > 0) { /* if valid data... */
+				if (pdev->vsync > 0) { /* ...and we are not sync-hunting... */
+					pdev->vsync = 2;x+
+					/* ...copy data to frame buffer, if possible */
+					if (flen + fbuf->filled > pdev->frame_total_size) {
+						Trace(TRACE_FLOW, "Frame buffer overflow (flen = %d, frame_total_size = %d).\n", flen, pdev->frame_total_size);
+						pdev->vsync = 0; /* Hmm, let's wait for an EOF (end-of-frame) */
+						pdev->vframes_error++;x+					}
+					else {
+						memmove(fillptr, iso_buf, flen);
+						fillptr += flen;x+					}
+				}
+				fbuf->filled += flen;x+			} /* ..flen > 0 */x+x+			if (flen < pdev->vlast_packet_size) {
+				/* Shorter packet... We probably have the end of an image-frame; 
+				   wake up read() process and let select()/poll() do something.
+				   Decompression is done in user time over there.
+				 */
+				if (pdev->vsync == 2) {
+					/* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus 
+					   frames on the USB wire after an exposure change. This conditition is 
+					   however detected  in the cam and a bit is set in the header.x+					 */
+					if (pdev->type == 730) {
+						unsigned char *ptr = (unsigned char *)fbuf->data;
+						
+						if (ptr[1] == 1 && ptr[0] & 0x10) {
+#if PWC_DEBUG
+							Debug("Hyundai CMOS sensor bug. Dropping frame %d.\n", fbuf->sequence);x+#endif
+							pdev->drop_frames += 2;x+							pdev->vframes_error++;x+						}
+						if ((ptr[0] ^ pdev->vmirror) & 0x01) {
+							if (ptr[0] & 0x01)
+								Info("Snapshot button pressed.\n");x+							else
+								Info("Snapshot button released.\n");x+						}
+						if ((ptr[0] ^ pdev->vmirror) & 0x02) {
+							if (ptr[0] & 0x02)
+								Info("Image is mirrored.\n");x+							else
+								Info("Image is normal.\n");x+						}
+						pdev->vmirror = ptr[0] & 0x03;x+						/* Sometimes the trailer of the 730 is still sent as a 4 byte packet 
+						   after a short frame; this condition is filtered out specifically. A 4 byte
+						   frame doesn't make sense anyway.
+						   So we get either this sequence: 
+						   	drop_bit set -> 4 byte frame -> short frame -> good frame
+						   Or this one:
+						   	drop_bit set -> short frame -> good frame
+						   So we drop either 3 or 2 frames in all!
+						 */
+						if (fbuf->filled == 4)
+							pdev->drop_frames++;x+					}
+
+					/* In case we were instructed to drop the frame, do so silently.
+					   The buffer pointers are not updated either (butxthe counters are reset below).x+					 */
+					if (pdev->drop_frames > 0)x+						pdev->drop_frames--;
+					else {
+						/* Check for underflow first */
+						if (fbuf->filled < pdev->frame_total_size) {
+							Trace(TRACE_FLOW, "Frame buffer underflow (%d bytes); discarded.\n", fbuf->filled);x+							pdev->vframes_error++;x+						}
+						else {
+							/* Send only once per EOF */
+							awake = 1; /* delay wake_ups */x+x+							/* Find our next frame to fill. This will always succeed, since we
+							 * nick a frame from either empty or full list, butxif we had to
+							 * take it from the full list, it means a frame gotxdropped.
+							 */
+							if (pwc_next_fill_frame(pdev)) {
+								pdev->vframes_dumped++;x+								if ((pdev->vframe_count > FRAME_LOWMARK) && (pwc_trace & TRACE_FLOW)) {
+									if (pdev->vframes_dumped < 20)
+										Trace(TRACE_FLOW, "Dumping frame %d.\n", pdev->vframe_count);x+									if (pdev->vframes_dumped == 20)
+										Trace(TRACE_FLOW, "Dumping frame %d (last message).\n", pdev->vframe_count);x+								}
+							}
+							fbuf = pdev->fill_frame;
+						}
+					} /* !drop_frames */
+					pdev->vframe_count++;x+				}
+				fbuf->filled = 0;x+				fillptr = fbuf->data;
+				pdev->vsync = 1;x+			} /* .. flen < last_packet_size */
+			pdev->vlast_packet_size = flen;x+		} /* ..status == 0 */x+#if PWC_DEBUG
+		/* This is normally not interesting to the user, unless you are really debugging something */
+		else {
+			static int iso_error = 0;x+			iso_error++;x+			if (iso_error < 20)
+				Trace(TRACE_FLOW, "Iso frame %d of USB has error %d\n", i, fst);x+		}
+#endif
+	}
+
+handler_end:
+	if (awake)
+		wake_up_interruptible(&pdev->frameq);x+
+	urb->dev = pdev->udev;x+	i = usb_submit_urb(urb, GFP_ATOMIC);x+	if (i != 0)
+		Err("Error (%d) re-submitting urb in pwc_isoc_handler.\n", i);x+}
+
+x+static int pwc_isoc_init(struct pwc_device *pdev)
+{
+	struct usb_device *udev;x+	struct urb *urb;x+	int i, j, ret;
+
+	struct usb_interface *intf;
+	struct usb_host_interface *idesc = NULL;x+
+	if (pdev == NULL)
+		return -EFAULT;x+	if (pdev->iso_init)
+		return 0;x+	pdev->vsync = 0;
+	udev = pdev->udev;x+
+	/* Get the current alternate interface, adjust packet size */
+	if (!udev->actconfig)
+		return -EFAULT;x+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
+	idesc = &udev->actconfig->interface[0]->altsetting[pdev->valternate];x+#else
+	intf = usb_ifnum_to_if(udev, 0);x+	if (intf)x+		idesc = usb_altnum_to_altsetting(intf, pdev->valternate);x+#endif
+		
+	if (!idesc)
+		return -EFAULT;x+
+	/* Search video endpoint */
+	pdev->vmax_packet_size = -1;x+	for (i = 0; i < idesc->desc.bNumEndpoints; i++)
+		if ((idesc->endpoint[i].desc.bEndpointAddress & 0xF) == pdev->vendpoint) {
+			pdev->vmax_packet_size = idesc->endpoint[i].desc.wMaxPacketSize;x+			break;
+		}
+	x+	if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) {
+		Err("Failed to find packet size for video endpoint in current alternate setting.\n");x+		return -ENFILE; /* Odd error, that should be noticable */
+	}x+
+	/* Set alternate interface */
+	ret = 0;
+	Trace(TRACE_OPEN, "Settingxalternate interface %d\n", pdev->valternate);x+	ret = usb_set_interface(pdev->udev, 0, pdev->valternate);x+	if (ret < 0)
+		return ret;
+x+	for (i = 0; i < MAX_ISO_BUFS; i++) {
+		urb = usb_alloc_urb(ISO_FRAMES_PER_DESC, GFP_KERNEL);x+		if (urb == NULL) {
+			Err("Failed to allocate urb %d\n", i);x+			ret = -ENOMEM;x+			break;
+		}
+		pdev->sbuf[i].urb = urb;x+		Trace(TRACE_MEMORY, "Allocated URB at 0x%p\n", urb);x+	}x+	if (ret) {
+		/* De-allocate in reverse order */
+		while (i >= 0) {
+			if (pdev->sbuf[i].urb != NULL)
+				usb_free_urb(pdev->sbuf[i].urb);x+			pdev->sbuf[i].urb = NULL;x+			i--;
+		}
+		return ret;
+	}x+
+	/* init URB structure */	x+	for (i = 0; i < MAX_ISO_BUFS; i++) {
+		urb = pdev->sbuf[i].urb;x+
+		urb->interval = 1; // devik
+		urb->dev = udev;x+	        urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint);
+		urb->transfer_flags = URB_ISO_ASAP;x+	        urb->transfer_buffer = pdev->sbuf[i].data;x+	        urb->transfer_buffer_length = ISO_BUFFER_SIZE;x+	        urb->complete = pwc_isoc_handler;x+	        urb->context = pdev;
+		urb->start_frame = 0;
+		urb->number_of_packets = ISO_FRAMES_PER_DESC;
+		for (j = 0; j < ISO_FRAMES_PER_DESC; j++) {
+			urb->iso_frame_desc[j].offset = j * ISO_MAX_FRAME_SIZE;
+			urb->iso_frame_desc[j].length = pdev->vmax_packet_size;x+		}
+	}
+x+	/* link */x+	for (i = 0; i < MAX_ISO_BUFS; i++) {
+		ret = usb_submit_urb(pdev->sbuf[i].urb, GFP_KERNEL);x+		if (ret)
+			Err("isoc_init() submit_urb %d failed with error %d\n", i, ret);x+		elsex+			Trace(TRACE_MEMORY, "URB 0x%p submitted.\n", pdev->sbuf[i].urb);x+	}x+x+	/* All is done... */
+	pdev->iso_init = 1;x+	Trace(TRACE_OPEN, "<< pwc_isoc_init()\n");x+	return 0;x+}x+x+static void pwc_isoc_cleanup(struct pwc_device *pdev)
+{
+	int i;
+
+	Trace(TRACE_OPEN, ">> pwc_isoc_cleanup()\n");x+	if (pdev == NULL)
+		return;x+x+	/* Unlinking ISOC buffers one by one */x+	for (i = 0; i < MAX_ISO_BUFS; i++) {
+		struct urb *urb;x+
+		urb = pdev->sbuf[i].urb;x+		if (urb != 0) {
+			if (pdev->iso_init) {
+				Trace(TRACE_MEMORY, "Unlinking URB %p\n", urb);x+				usb_kill_urb(urb);x+			}
+			Trace(TRACE_MEMORY, "Freeing URB\n");x+			usb_free_urb(urb);x+			pdev->sbuf[i].urb = NULL;x+		}
+	}
+x+	/* Stop camera, butxonly if we are sure the camera is still there (unplugx+	   is signalled by EPIPE) 
+	 */x+	if (pdev->error_status && pdev->error_status != EPIPE) {
+		Trace(TRACE_OPEN, "Settingxalternate interface 0.\n");x+		usb_set_interface(pdev->udev, 0, 0);x+	}x+x+	pdev->iso_init = 0;x+	Trace(TRACE_OPEN, "<< pwc_isoc_cleanup()\n");x+}x+x+int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_fps, int new_compression, int new_snapshot)
+{
+	int ret, start;
+x+	/* Stop isoc stuff */
+	pwc_isoc_cleanup(pdev);x+	/* Reset parameters */x+	pwc_reset_buffers(pdev);x+	/* Try to set video mode... */
+	start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot);x+	if (ret) { x+	        Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n");x+		/* That failed... restore old mode (we know that worked) */
+		start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot);x+		if (start) {
+		        Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n");x+		}
+	}
+	if (start == 0)
+	{
+		if (pwc_isoc_init(pdev) < 0)
+		{
+			Info("Failed to restart ISOC transfers in pwc_try_video_mode.\n");x+			ret = -EAGAIN; /* let's try again, who knows if it works a second time */
+		}x+	}
+	pdev->drop_frames++; /* try to avoid garbage during switch */
+	return ret; /* Return original error code */
+}x+x+x+/***************************************************************************/
+/* Video4Linux functions */
+
+static int pwc_video_open(struct inode *inode, struct file *file)
+{
+	int i;
+	struct video_device *vdev = video_devdata(file);x+	struct pwc_device *pdev;x+
+	Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev);x+	x+	pdev = (struct pwc_device *)vdev->priv;x+	if (pdev == NULL)
+		BUG();x+	if (pdev->vopen)
+		return -EBUSY;x+	x+	down(&pdev->modlock);x+	if (!pdev->usb_init) {
+		Trace(TRACE_OPEN, "Doing first time initialization.\n");x+		pdev->usb_init = 1;x+		
+		if (pwc_trace & TRACE_OPEN)
+		{
+			/* Query sensor type */
+			const char *sensor_type = NULL;x+			int ret;
+x+			ret = pwc_get_cmos_sensor(pdev, &i);x+			if (ret >= 0)
+			{
+				switch(i) {
+				case 0x00:  sensor_type = "Hyundai CMOS sensor"; break;
+				case 0x20:  sensor_type = "Sony CCD sensor + TDA8787"; break;
+				case 0x2E:  sensor_type = "Sony CCD sensor + Exas 98L59"; break;
+				case 0x2F:  sensor_type = "Sony CCD sensor + ADI 9804"; break;
+				case 0x30:  sensor_type = "Sharp CCD sensor + TDA8787"; break;
+				case 0x3E:  sensor_type = "Sharp CCD sensor + Exas 98L59"; break;
+				case 0x3F:  sensor_type = "Sharp CCD sensor + ADI 9804"; break;
+				case 0x40:  sensor_type = "UPA 1021 sensor"; break;
+				case 0x100: sensor_type = "VGA sensor"; break;
+				case 0x101: sensor_type = "PAL MR sensor"; break;
+				default:    sensor_type = "unknown type of sensor"; break;
+				}x+			}
+			if (sensor_type != NULL)
+				Info("This %s camera is equipped with a %s (%d).\n", pdev->vdev->name, sensor_type, i);x+		}
+	}
+x+	/* Turn on camera */x+	if (power_save) {
+		i = pwc_camera_power(pdev, 1);x+		if (i < 0)
+			Info("Failed to restore power to the camera! (%d)\n", i);x+	}
+	/* Set LED on/off time */
+	if (pwc_set_leds(pdev, led_on, led_off) < 0)
+		Info("Failed to set LED on/off time.\n");x+	x+	pwc_construct(pdev); /* set min/max sizes correct */x+x+	/* So far, so good. Allocate memory. */
+	i = pwc_allocate_buffers(pdev);x+	if (i < 0) {
+		Trace(TRACE_OPEN, "Failed to allocate buffer memory.\n");x+		up(&pdev->modlock);x+		return i;
+	}
+	x+	/* Reset buffers & parameters */x+	pwc_reset_buffers(pdev);x+	for (i = 0; i < default_mbufs; i++)x+		pdev->image_used[i] = 0;x+	pdev->vframe_count = 0;x+	pdev->vframes_dumped = 0;x+	pdev->vframes_error = 0;x+	pdev->visoc_errors = 0;x+	pdev->error_status = 0;x+#if PWC_DEBUG
+	pdev->sequence = 0;x+#endif
+	pwc_construct(pdev); /* set min/max sizes correct */x+x+	/* Set some defaults */
+	pdev->vsnapshot = 0;x+
+	/* Start iso pipe for video; first try the last used video sizex+	   (or the default one); if that fails try QCIF/10 or QSIF/10;x+	   it that fails too, give up.
+	 */x+	i = pwc_set_video_mode(pdev, pwc_image_sizes[pdev->vsize].x, pwc_image_sizes[pdev->vsize].y, pdev->vframes, pdev->vcompression, 0);x+	if (i)	{
+		Trace(TRACE_OPEN, "First attempt at set_video_mode failed.\n");x+		if (pdev->type == 730 || pdev->type == 740 || pdev->type == 750)
+			i = pwc_set_video_mode(pdev, pwc_image_sizes[PSZ_QSIF].x, pwc_image_sizes[PSZ_QSIF].y, 10, pdev->vcompression, 0);x+		elsex+			i = pwc_set_video_mode(pdev, pwc_image_sizes[PSZ_QCIF].x, pwc_image_sizes[PSZ_QCIF].y, 10, pdev->vcompression, 0);x+	}x+	if (i) {
+		Trace(TRACE_OPEN, "Second attempt at set_video_mode failed.\n");x+		up(&pdev->modlock);x+		return i;
+	}
+	x+	i = pwc_isoc_init(pdev);x+	if (i) {
+		Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i);x+		up(&pdev->modlock);x+		return i;
+	}
+
+	pdev->vopen++;x+	file->private_data = vdev;
+	up(&pdev->modlock);x+	Trace(TRACE_OPEN, "<< video_open() returns 0.\n");x+	return 0;x+}x+x+/* Note that all cleanup is done in the reverse order as in _open */x+static int pwc_video_close(struct inode *inode, struct file *file)
+{
+	struct video_device *vdev = file->private_data;
+	struct pwc_device *pdev;x+	int i;x+
+	Trace(TRACE_OPEN, ">> video_close called(vdev = 0x%p).\n", vdev);x+x+	pdev = (struct pwc_device *)vdev->priv;x+	if (pdev->vopen == 0)
+		Info("video_close() called on closed device?\n");x+
+	/* Dump statistics, butxonly if a reasonable amount of frames werex+	   processed (to prevent endless log-entries in case of snap-shotx+	   programs)
+	 */x+	if (pdev->vframe_count > 20)
+		Info("Closing video device: %d frames received, dumped %d frames, %d frames with errors.\n", pdev->vframe_count, pdev->vframes_dumped, pdev->vframes_error);x+
+	switch (pdev->type)
+	 {x+	  case 675:x+	  case 680:x+	  case 690:x+	  case 720:x+	  case 730:x+	  case 740:x+	  case 750:x+	    pwc_dec23_exit();	/* Timon & Kiara */
+	    break;
+	  case 645:x+	  case 646:x+	    pwc_dec1_exit();
+	    break;
+	 }x+
+	pwc_isoc_cleanup(pdev);x+	pwc_free_buffers(pdev);x+
+	/* Turn off LEDS and power down camera, butxonly when not unplugged */x+	if (pdev->error_status != EPIPE) {
+		/* Turn LEDs off */
+		if (pwc_set_leds(pdev, 0, 0) < 0)
+			Info("Failed to set LED on/off time.\n");x+		if (power_save) {
+			i = pwc_camera_power(pdev, 0);x+			if (i < 0)
+				Err("Failed to power down camera (%d)\n", i);x+		}x+	}
+	pdev->vopen = 0;x+	Trace(TRACE_OPEN, "<< video_close()\n");x+	return 0;x+}x+x+/*
+ *	FIXME: what about two parallel reads ????
+ *      ANSWER: Not supported. You can't open the device more than once,
+                despite what the V4L1 interface says. First, I don't see
+                the need, second there's no mechanism of alerting the
+                2nd/3rd/... process of events like changing image size.
+                And I don't see the point of blocking that for the
+                2nd/3rd/... process.
+                In multi-threaded environments reading parallel from any
+                device is tricky anyhow.
+ */x+x+static ssize_t pwc_video_read(struct file *file, char *buf,
+			  size_t count, loff_t *ppos)
+{
+	struct video_device *vdev = file->private_data;
+	struct pwc_device *pdev;x+	int noblock = file->f_flags & O_NONBLOCK;x+	DECLARE_WAITQUEUE(wait, current);
+        int bytes_to_read;x+
+	Trace(TRACE_READ, "video_read(0x%p, %p, %d) called.\n", vdev, buf, count);x+	if (vdev == NULL)
+		return -EFAULT;x+	pdev = vdev->priv;x+	if (pdev == NULL)
+		return -EFAULT;x+	if (pdev->error_status)
+		return -pdev->error_status; /* Something happened, report what. */x+x+	/* In case we're doing partial reads, we don't have to wait for a frame */x+	if (pdev->image_read_pos == 0) {
+		/* Do wait queueingxaccording to the (doc)book */
+		add_wait_queue(&pdev->frameq, &wait);x+		while (pdev->full_frames == NULL) {
+			/* Check for unplugged/etc. here */
+			if (pdev->error_status) {
+				remove_wait_queue(&pdev->frameq, &wait);x+				set_current_state(TASK_RUNNING);x+				return -pdev->error_status ;x+			}
+	                if (noblock) {
+	                	remove_wait_queue(&pdev->frameq, &wait);x+	                	set_current_state(TASK_RUNNING);x+	                	return -EWOULDBLOCK;x+	                }
+	                if (signal_pending(current)) {
+	                	remove_wait_queue(&pdev->frameq, &wait);x+	                	set_current_state(TASK_RUNNING);x+	                	return -ERESTARTSYS;x+	                }
+	                schedule();x+	               	set_current_state(TASK_INTERRUPTIBLE);x+		}
+		remove_wait_queue(&pdev->frameq, &wait);x+		set_current_state(TASK_RUNNING);x+                                                                                                                                                                                
+		/* Decompress and release frame */x+		if (pwc_handle_frame(pdev))x+			return -EFAULT;x+	}x+
+	Trace(TRACE_READ, "Copying data to user space.\n");x+	if (pdev->vpalette == VIDEO_PALETTE_RAW)x+		bytes_to_read = pdev->frame_size;x+	elsex+ 		bytes_to_read = pdev->view.size;x+
+	/* copy bytes to user space; we allow for partial reads */x+	if (count + pdev->image_read_pos > bytes_to_read)
+		count = bytes_to_read - pdev->image_read_pos;x+	if (copy_to_user(buf, pdev->image_ptr[pdev->fill_image] + pdev->image_read_pos, count))
+		return -EFAULT;x+	pdev->image_read_pos += count;x+	if (pdev->image_read_pos >= bytes_to_read) { /* All data has been read */
+		pdev->image_read_pos = 0;x+		pwc_next_image(pdev);x+	}
+	return count;x+}x+x+static unsigned int pwc_video_poll(struct file *file, poll_table *wait)
+{
+	struct video_device *vdev = file->private_data;
+	struct pwc_device *pdev;x+x+	if (vdev == NULL)
+		return -EFAULT;x+	pdev = vdev->priv;x+	if (pdev == NULL)
+		return -EFAULT;x+x+	poll_wait(file, &pdev->frameq, wait);x+	if (pdev->error_status)
+		return POLLERR;x+	if (pdev->full_frames != NULL) /* we have frames waiting */
+		return (POLLIN | POLLRDNORM);x+
+	return 0;x+}x+x+static int pwc_video_do_ioctl(struct inode *inode, struct file *file,
+			      unsigned int cmd, void *arg)
+{
+	struct video_device *vdev = file->private_data;
+	struct pwc_device *pdev;x+	DECLARE_WAITQUEUE(wait, current);
+x+	if (vdev == NULL)
+		return -EFAULT;x+	pdev = vdev->priv;x+	if (pdev == NULL)
+		return -EFAULT;x+x+	switch (cmd) {
+		/* Query cabapilities */
+		case VIDIOCGCAP:
+		{
+			struct video_capability *caps = arg;
+x+			strcpy(caps->name, vdev->name);
+			caps->type = VID_TYPE_CAPTURE;
+			caps->channels = 1;x+			caps->audios = 1;x+			caps->minwidth  = pdev->view_min.x;x+			caps->minheight = pdev->view_min.y;x+			caps->maxwidth  = pdev->view_max.x;x+			caps->maxheight = pdev->view_max.y;x+			break;
+		}
+
+		/* Channel functions (simulate 1 channel) */
+		case VIDIOCGCHAN:
+		{
+			struct video_channel *v = arg;
+x+			if (v->channel != 0)
+				return -EINVAL;x+			v->flags = 0;x+			v->tuners = 0;x+			v->type = VIDEO_TYPE_CAMERA;x+			strcpy(v->name, "Webcam");x+			return 0;
+		}
+
+		case VIDIOCSCHAN:
+		{
+			/* The spec says the argument is an integer, but
+			   the bttv driver uses a video_channel arg, which
+			   makes sense becasue it also has the norm flag.
+			 */
+			struct video_channel *v = arg;
+			if (v->channel != 0)
+				return -EINVAL;x+			return 0;
+		}
+
+
+		/* Picture functions; contrast etc. */
+		case VIDIOCGPICT:
+		{
+			struct video_picture *p = arg;
+			int val;
+x+			val = pwc_get_brightness(pdev);x+			if (val >= 0)
+				p->brightness = val;
+			else
+				p->brightness = 0xffff;x+			val = pwc_get_contrast(pdev);x+			if (val >= 0)
+				p->contrast = val;
+			else
+				p->contrast = 0xffff;x+			/* Gamma, Whiteness, what's the difference? :) */
+			val = pwc_get_gamma(pdev);x+			if (val >= 0)
+				p->whiteness = val;
+			else
+				p->whiteness = 0xffff;x+			val = pwc_get_saturation(pdev);x+			if (val >= 0)
+				p->colour = val;
+			else
+				p->colour = 0xffff;x+			p->depth = 24;x+			p->palette = pdev->vpalette;x+			p->hue = 0xFFFF; /* N/A */
+			break;
+		}
+
+		case VIDIOCSPICT:
+		{
+			struct video_picture *p = arg;
+			/*
+			 *	FIXME:	Suppose we are mid read
+			        ANSWER: No problem: the firmware of the camera
+			                can handle brightness/contrast/etc
+			                changes at _any_ time, and the palette
+			                is used exactly once in the uncompress
+			                routine.
+			 */
+			pwc_set_brightness(pdev, p->brightness);x+			pwc_set_contrast(pdev, p->contrast);x+			pwc_set_gamma(pdev, p->whiteness);x+			pwc_set_saturation(pdev, p->colour);x+			if (p->palette && p->palette != pdev->vpalette) {
+				switch (p->palette) {
+					case VIDEO_PALETTE_YUV420P:
+					case VIDEO_PALETTE_RAW:
+						pdev->vpalette = p->palette;
+						return pwc_try_video_mode(pdev, pdev->image.x, pdev->image.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot);x+						break;
+					default:
+						return -EINVAL;x+						break;
+				}x+			}
+			break;
+		}
+
+		/* Window/size parameters */		
+		case VIDIOCGWIN:
+		{
+			struct video_window *vw = arg;
+			x+			vw->x = 0;x+			vw->y = 0;x+			vw->width = pdev->view.x;x+			vw->height = pdev->view.y;x+			vw->chromakey = 0;x+			vw->flags = (pdev->vframes << PWC_FPS_SHIFT) | 
+			           (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0);x+			break;
+		}
+		
+		case VIDIOCSWIN:
+		{
+			struct video_window *vw = arg;
+			int fps, snapshot, ret;
+x+			fps = (vw->flags & PWC_FPS_FRMASK) >> PWC_FPS_SHIFT;x+			snapshot = vw->flags & PWC_FPS_SNAPSHOT;x+			if (fps == 0)
+				fps = pdev->vframes;
+			if (pdev->view.x == vw->width && pdev->view.y && fps == pdev->vframes && snapshot == pdev->vsnapshot)
+				return 0;x+			ret = pwc_try_video_mode(pdev, vw->width, vw->height, fps, pdev->vcompression, snapshot);x+			if (ret)
+				return ret;
+			break;		
+		}
+		
+		/* We don't have overlay support (yet) */
+		case VIDIOCGFBUF:
+		{
+			struct video_buffer *vb = arg;
+x+			memset(vb,0,sizeof(*vb));x+			break;
+		}
+
+		/* mmap() functions */
+		case VIDIOCGMBUF:
+		{
+			/* Tell the user program how much memory is needed for a mmap() */
+			struct video_mbuf *vm = arg;
+			int i;
+x+			memset(vm, 0, sizeof(*vm));x+			vm->size = default_mbufs * pdev->len_per_image;x+			vm->frames = default_mbufs; /* double buffering should be enough for most applications */
+			for (i = 0; i < default_mbufs; i++)x+				vm->offsets[i] = i * pdev->len_per_image;x+			break;
+		}
+
+		case VIDIOCMCAPTURE:
+		{
+			/* Start capture into a given image buffer (called 'frame' in video_mmap structure) */
+			struct video_mmap *vm = arg;
+
+			Trace(TRACE_READ, "VIDIOCMCAPTURE: %dx%d, frame %d, format %d\n", vm->width, vm->height, vm->frame, vm->format);x+			if (vm->frame < 0 || vm->frame >= default_mbufs)
+				return -EINVAL;x+
+			/* xawtv is nasty. It probes the available palettes
+			   by setting a very small image size and tryingx+			   various palettes... The driver doesn't supportx+			   such small images, so I'm working around it.
+			 */
+			if (vm->format)
+			{
+				switch (vm->format)
+				{
+					case VIDEO_PALETTE_YUV420P:
+					case VIDEO_PALETTE_RAW:
+						break;
+					default:
+						return -EINVAL;x+						break;
+				}x+			}
+
+			if ((vm->width != pdev->view.x || vm->height != pdev->view.y) &&
+			    (vm->width >= pdev->view_min.x && vm->height >= pdev->view_min.y)) {
+				int ret;
+x+				Trace(TRACE_OPEN, "VIDIOCMCAPTURE: changing size to please xawtv :-(.\n");x+				ret = pwc_try_video_mode(pdev, vm->width, vm->height, pdev->vframes, pdev->vcompression, pdev->vsnapshot);x+				if (ret)
+					return ret;
+			} /* ... size mismatch */
+
+			/* FIXME: should we lock here? */
+			if (pdev->image_used[vm->frame])
+				return -EBUSY;	/* buffer wasn't available. Bummer */
+			pdev->image_used[vm->frame] = 1;x+
+			/* Okay, we're done here. In the SYNC call we wait until a 
+			   frame comes available, then expand image into the given 
+			   buffer.x+			   In contrast to the CPiA cam the Philips cams deliver a
+			   constant stream, almost like a grabber card. Also,
+			   we have separate buffers for the rawdata and the image,
+			   meaning we can nearly always expand into the requested buffer.x+			 */
+			Trace(TRACE_READ, "VIDIOCMCAPTURE done.\n");x+			break;
+		}
+
+		case VIDIOCSYNC:
+		{
+			/* The doc says: "Whenever a buffer is used it should
+			   call VIDIOCSYNC to free this frame up and continue."
+			   
+			   The only odd thing about this whole procedure is 
+			   that MCAPTURE flags the buffer as "in use", and
+			   SYNC immediately unmarks it, while it isn't 
+			   after SYNC that you know that the buffer actually
+			   gotxfilled! So you better not start a CAPTURE in
+			   the same frame immediately (use double buffering). 
+			   This is not a problem for this cam, since it has 
+			   extra intermediate buffers, butxa hardware 
+			   grabber card will then overwrite the buffer 
+			   you're working on.
+			 */
+			int *mbuf = arg;
+			int ret;
+x+			Trace(TRACE_READ, "VIDIOCSYNC called (%d).\n", *mbuf);x+
+			/* bounds check */
+			if (*mbuf < 0 || *mbuf >= default_mbufs)
+				return -EINVAL;x+			/* check if this buffer was requested anyway */
+			if (pdev->image_used[*mbuf] == 0)
+				return -EINVAL;x+
+			/* Add ourselves to the frame wait-queue.
+			   
+			   FIXME: needs auditing for safety.
+			   QUESTION: In what respect? I think that using the
+			             frameq is safe now.
+			 */
+			add_wait_queue(&pdev->frameq, &wait);x+			while (pdev->full_frames == NULL) {
+				if (pdev->error_status) {
+					remove_wait_queue(&pdev->frameq, &wait);x+					set_current_state(TASK_RUNNING);x+					return -pdev->error_status;
+				}x+			x+	                	if (signal_pending(current)) {
+	                		remove_wait_queue(&pdev->frameq, &wait);x+		                	set_current_state(TASK_RUNNING);x+		                	return -ERESTARTSYS;x+	        	        }
+	                	schedule();x+		                set_current_state(TASK_INTERRUPTIBLE);x+			}x+			remove_wait_queue(&pdev->frameq, &wait);x+			set_current_state(TASK_RUNNING);x+				
+			/* The frame is ready. Expand in the image buffer 
+			   requested by the user. I don't care if you 
+			   mmap() 5 buffers and request data in this order: 
+			   buffer 4 2 3 0 1 2 3 0 4 3 1 . . .
+			   Grabber hardware may not be so forgiving.
+			 */
+			Trace(TRACE_READ, "VIDIOCSYNC: frame ready.\n");x+			pdev->fill_image = *mbuf; /* tell in which buffer we want the image to be expanded */x+			/* Decompress, etc */x+			ret = pwc_handle_frame(pdev);
+			pdev->image_used[*mbuf] = 0;x+			if (ret)
+				return -EFAULT;x+			break;
+		}
+		
+		case VIDIOCGAUDIO:
+		{
+			struct video_audio *v = arg;
+			x+			strcpy(v->name, "Microphone");x+			v->audio = -1; /* unknown audio minor */
+			v->flags = 0;x+			v->mode = VIDEO_SOUND_MONO;x+			v->volume = 0;
+			v->bass = 0;x+			v->treble = 0;
+			v->balance = 0x8000;
+			v->step = 1;x+			break;	
+		}
+		
+		case VIDIOCSAUDIO:
+		{
+			/* Dummy: nothing can be set */
+			break;
+		}
+		
+		case VIDIOCGUNIT:
+		{
+			struct video_unit *vu = arg;
+			x+			vu->video = pdev->vdev->minor & 0x3F;x+			vu->audio = -1; /* not known yet */
+			vu->vbi = -1;x+			vu->radio = -1;x+			vu->teletext = -1;x+			break;
+		}
+		default:
+			return pwc_ioctl(pdev, cmd, arg);x+	} /* ..switch */
+	return 0;x+}	x+x+static int pwc_video_ioctl(struct inode *inode, struct file *file,
+			   unsigned int cmd, unsigned long arg)
+{
+	return video_usercopy(inode, file, cmd, arg, pwc_video_do_ioctl);x+}
+
+x+static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma)
+{
+	struct video_device *vdev = file->private_data;
+	struct pwc_device *pdev;x+	unsigned long start = vma->vm_start;
+	unsigned long size  = vma->vm_end-vma->vm_start;
+	unsigned long page, pos;x+	
+	Trace(TRACE_MEMORY, "mmap(0x%p, 0x%lx, %lu) called.\n", vdev, start, size);x+	pdev = vdev->priv;x+	x+	vma->vm_flags |= VM_IO;x+x+	pos = (unsigned long)pdev->image_data;
+	while (size > 0) {
+		page = vmalloc_to_pfn((void *)pos);x+		if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED))x+			return -EAGAIN;x+
+		start += PAGE_SIZE;x+		pos += PAGE_SIZE;x+		if (size > PAGE_SIZE)x+			size -= PAGE_SIZE;x+		else
+			size = 0;x+	}x+
+	return 0;x+}x+x+/***************************************************************************/
+/* USB functions */
+
+/* This function gets called when a new device is plugged in or the usb core
+ * is loaded.
+ */x+x+static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id *id)
+{
+	struct usb_device *udev = interface_to_usbdev(intf);
+	struct pwc_device *pdev = NULL;x+	int vendor_id, product_id, type_id;x+	int i, hint;x+	int features = 0;x+	int video_nr = -1; /* default: use next available device */
+	char serial_number[30], *name;
+
+	/* Check if we can handle this device */
+	Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n", x+		udev->descriptor.idVendor, udev->descriptor.idProduct, x+		intf->altsetting->desc.bInterfaceNumber);x+
+	/* the interfaces are probed one by one. We are only interested in the
+	   video interface (0) now.
+	   Interface 1 is the Audio Control, and interface 2 Audio itself.
+	 */x+	if (intf->altsetting->desc.bInterfaceNumber > 0)x+		return -ENODEV;x+
+	vendor_id = udev->descriptor.idVendor;x+	product_id = udev->descriptor.idProduct;
+x+	if (vendor_id == 0x0471) {
+		switch (product_id) {
+		case 0x0302:
+			Info("Philips PCA645VC USB webcam detected.\n");x+			name = "Philips 645 webcam";x+			type_id = 645;x+			break;
+		case 0x0303:
+			Info("Philips PCA646VC USB webcam detected.\n");x+			name = "Philips 646 webcam";x+			type_id = 646;x+			break;
+		case 0x0304:
+			Info("Askey VC010 type 2 USB webcam detected.\n");x+			name = "Askey VC010 webcam";x+			type_id = 646;x+			break;
+		case 0x0307:
+			Info("Philips PCVC675K (Vesta) USB webcam detected.\n");x+			name = "Philips 675 webcam";x+			type_id = 675;x+			break;
+		case 0x0308:
+			Info("Philips PCVC680K (Vesta Pro) USB webcam detected.\n");x+			name = "Philips 680 webcam";x+			type_id = 680;x+			break;
+		case 0x030C:
+			Info("Philips PCVC690K (Vesta Pro Scan) USB webcam detected.\n");x+			name = "Philips 690 webcam";x+			type_id = 690;x+			break;
+		case 0x0310:
+			Info("Philips PCVC730K (ToUCam Fun)/PCVC830 (ToUCam II) USB webcam detected.\n");x+			name = "Philips 730 webcam";x+			type_id = 730;x+			break;
+		case 0x0311:
+			Info("Philips PCVC740K (ToUCam Pro)/PCVC840 (ToUCam II) USB webcam detected.\n");x+			name = "Philips 740 webcam";x+			type_id = 740;x+			break;
+		case 0x0312:
+			Info("Philips PCVC750K (ToUCam Pro Scan) USB webcam detected.\n");x+			name = "Philips 750 webcam";x+			type_id = 750;x+			break;
+		case 0x0313:
+			Info("Philips PCVC720K/40 (ToUCam XS) USB webcam detected.\n");x+			name = "Philips 720K/40 webcam";x+			type_id = 720;x+			break;
+		default:
+			return -ENODEV;x+			break;
+		}
+	}x+	else if (vendor_id == 0x069A) {
+		switch(product_id) {
+		case 0x0001:
+			Info("Askey VC010 type 1 USB webcam detected.\n");x+			name = "Askey VC010 webcam";x+			type_id = 645;x+			break;
+		default:
+			return -ENODEV;x+			break;
+		}
+	}x+	else if (vendor_id == 0x046d) {
+		switch(product_id) {
+		case 0x08b0:
+			Info("Logitech QuickCam Pro 3000 USB webcam detected.\n");x+			name = "Logitech QuickCam Pro 3000";x+			type_id = 740; /* CCD sensor */
+			break;
+		case 0x08b1:
+			Info("Logitech QuickCam Notebook Pro USB webcam detected.\n");x+			name = "Logitech QuickCam Notebook Pro";x+			type_id = 740; /* CCD sensor */
+			break;
+		case 0x08b2:
+			Info("Logitech QuickCam 4000 Pro USB webcam detected.\n");x+			name = "Logitech QuickCam Pro 4000";x+			type_id = 740; /* CCD sensor */
+			break;
+		case 0x08b3:
+			Info("Logitech QuickCam Zoom USB webcam detected.\n");x+			name = "Logitech QuickCam Zoom";x+			type_id = 740; /* CCD sensor */
+			break;
+		case 0x08B4:
+			Info("Logitech QuickCam Zoom (new model) USB webcam detected.\n");x+			name = "Logitech QuickCam Zoom";x+			type_id = 740; /* CCD sensor */
+			break;
+		case 0x08b5:
+			Info("Logitech QuickCam Orbit/Sphere USB webcam detected.\n");x+			name = "Logitech QuickCam Orbit";x+			type_id = 740; /* CCD sensor */
+			features |= FEATURE_MOTOR_PANTILT;x+			break;
+		case 0x08b6:x+		case 0x08b7:x+		case 0x08b8:
+			Info("Logitech QuickCam detected (reserved ID).\n");x+			name = "Logitech QuickCam (res.)";x+			type_id = 730; /* Assuming CMOS */
+			break;
+        	default:
+			return -ENODEV;x+        		break;
+        	}
+        }x+	else if (vendor_id == 0x055d) {
+		/* I don't know the difference between the C10 and the C30;x+		   I suppose the difference is the sensor, butxboth camerasx+		   work equally well with a type_id of 675x+		 */
+		switch(product_id) {
+		case 0x9000:
+			Info("Samsung MPC-C10 USB webcam detected.\n");x+			name = "Samsung MPC-C10";x+			type_id = 675;x+			break;
+		case 0x9001:
+			Info("Samsung MPC-C30 USB webcam detected.\n");x+			name = "Samsung MPC-C30";x+			type_id = 675;x+			break;
+		default:
+			return -ENODEV;x+			break;
+		}
+	}x+	else if (vendor_id == 0x041e) {
+		switch(product_id) {
+		case 0x400c:
+			Info("Creative Labs Webcam 5 detected.\n");x+			name = "Creative Labs Webcam 5";x+			type_id = 730;x+			break;
+		case 0x4011:
+			Info("Creative Labs Webcam Pro Ex detected.\n");x+			name = "Creative Labs Webcam Pro Ex";x+			type_id = 740;x+			break;
+		default:
+			return -ENODEV;x+			break;
+		}
+	}x+	else if (vendor_id == 0x04cc) {
+		switch(product_id) {
+		case 0x8116:
+			Info("Sotec Afina Eye USB webcam detected.\n");x+			name = "Sotec Afina Eye";x+			type_id = 730;x+			break;
+		default:
+			return -ENODEV;x+			break;
+		}
+	}x+	else if (vendor_id == 0x06be) {
+		switch(product_id) {
+		case 0x8116:
+			/* This is essentially the same cam as the Sotec Afina Eye */
+			Info("AME Co. Afina Eye USB webcam detected.\n");x+			name = "AME Co. Afina Eye";x+			type_id = 750;x+			break;
+		default:
+			return -ENODEV;x+			break;
+		}
+	
+	}x+	else if (vendor_id == 0x0d81) {
+		switch(product_id) {
+		case 0x1900:
+			Info("Visionite VCS-UC300 USB webcam detected.\n");x+			name = "Visionite VCS-UC300";x+			type_id = 740; /* CCD sensor */
+			break;
+		case 0x1910:
+			Info("Visionite VCS-UM100 USB webcam detected.\n");x+			name = "Visionite VCS-UM100";x+			type_id = 730; /* CMOS sensor */
+			break;
+		default:
+			return -ENODEV;x+			break;
+		}
+	}x+	else x+		return -ENODEV; /* Not any of the know types; butxthe list keeps growing. */
+
+	memset(serial_number, 0, 30);x+	usb_string(udev, udev->descriptor.iSerialNumber, serial_number, 29);x+	Trace(TRACE_PROBE, "Device serial number is %s\n", serial_number);
+x+	if (udev->descriptor.bNumConfigurations > 1)
+		Info("Warning: more than 1 configuration available.\n");x+
+	/* Allocate structure, initialize pointers, mutexes, etc. and link it to the usb_device */x+	pdev = kmalloc(sizeof(struct pwc_device), GFP_KERNEL);x+	if (pdev == NULL) {
+		Err("Oops, could not allocate memory for pwc_device.\n");x+		return -ENOMEM;x+	}
+	memset(pdev, 0, sizeof(struct pwc_device));x+	pdev->type = type_id;x+	pdev->vsize = default_size;x+	pdev->vframes = default_fps;
+	strcpy(pdev->serial, serial_number);
+	pdev->features = features;x+	if (vendor_id == 0x046D && product_id == 0x08B5)
+	{
+		/* Logitech QuickCam Orbit
+	           The ranges have been determined experimentally; they may differ from cam to cam.
+	           Also, the exact ranges left-right and up-down are different for my cam
+	          */
+		pdev->angle_range.pan_min  = -7000;
+		pdev->angle_range.pan_max  =  7000;
+		pdev->angle_range.tilt_min = -3000;
+		pdev->angle_range.tilt_max =  2500;x+	}x+
+	init_MUTEX(&pdev->modlock);x+	pdev->ptrlock = SPIN_LOCK_UNLOCKED;
+
+	pdev->udev = udev;x+	init_waitqueue_head(&pdev->frameq);x+	pdev->vcompression = pwc_preferred_compression;x+
+	/* Allocate video_device structure */x+	pdev->vdev = video_device_alloc();x+	if (pdev->vdev == 0)
+	{
+		Err("Err, cannot allocate video_device struture. Failing probe.");x+		kfree(pdev);
+		return -ENOMEM;x+	}
+	memcpy(pdev->vdev, &pwc_template, sizeof(pwc_template));
+	strcpy(pdev->vdev->name, name);
+	pdev->vdev->owner = THIS_MODULE;x+	video_set_drvdata(pdev->vdev, pdev);x+x+	pdev->release = udev->descriptor.bcdDevice;x+	Trace(TRACE_PROBE, "Release: %04x\n", pdev->release);x+
+	/* Now search device_hint[] table for a match, so we can hint a node number. */x+	for (hint = 0; hint < MAX_DEV_HINTS; hint++) {
+		if (((device_hint[hint].type == -1) || (device_hint[hint].type == pdev->type)) &&
+		     (device_hint[hint].pdev == NULL)) {
+			/* so far, so good... try serial number */
+			if ((device_hint[hint].serial_number[0] == '*') || !strcmp(device_hint[hint].serial_number, serial_number)) {
+			    	/* match! */
+			    	video_nr = device_hint[hint].device_node;
+			    	Trace(TRACE_PROBE, "Found hint, will try to register as /dev/video%d\n", video_nr);
+			    	break;
+			}x+		}
+	}
+x+	pdev->vdev->release = video_device_release;x+	i = video_register_device(pdev->vdev, VFL_TYPE_GRABBER, video_nr);
+	if (i < 0) {
+		Err("Failed to register as video device (%d).\n", i);x+		video_device_release(pdev->vdev); /* Drip... drip... drip... */
+		kfree(pdev); /* Oops, no memory leaks please */
+		return -EIO;x+	}x+	else {
+		Info("Registered as /dev/video%d.\n", pdev->vdev->minor & 0x3F);x+	}x+x+	/* occupy slot */x+	if (hint < MAX_DEV_HINTS) 
+		device_hint[hint].pdev = pdev;x+
+	Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev);x+	usb_set_intfdata (intf, pdev);x+	return 0;x+}x+x+/* The user janked outxthe cable... */
+static void usb_pwc_disconnect(struct usb_interface *intf)
+{
+	struct pwc_device *pdev;x+	int hint;x+x+	lock_kernel();x+	pdev = usb_get_intfdata (intf);x+	usb_set_intfdata (intf, NULL);x+	if (pdev == NULL) {
+		Err("pwc_disconnect() Called withoutxprivate pointer.\n");x+		goto disconnect_out;x+	}x+	if (pdev->udev == NULL) {
+		Err("pwc_disconnect() already called for %p\n", pdev);
+		goto disconnect_out;x+	}x+	if (pdev->udev != interface_to_usbdev(intf)) {
+		Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n");x+		goto disconnect_out;x+	}x+#ifdef PWC_MAGIC	x+	if (pdev->magic != PWC_MAGIC) {
+		Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n");x+		goto disconnect_out;x+	}x+#endif
+	x+	/* We gotxunplugged; this is signalled by an EPIPE error code */
+	if (pdev->vopen) {
+		Info("Disconnected while webcam is in use!\n");x+		pdev->error_status = EPIPE;x+	}x+x+	/* Alert waiting processes */
+	wake_up_interruptible(&pdev->frameq);x+	/* Wait until device is closed */
+	while (pdev->vopen)
+		schedule();x+	/* Device is now closed, so we can safely unregister it */
+	Trace(TRACE_PROBE, "Unregistering video device in disconnect().\n");x+	video_unregister_device(pdev->vdev);x+
+	/* Free memory (don't set pdev to 0 just yet) */
+	kfree(pdev);
+
+disconnect_out:
+	/* search device_hint[] table if we occupy a slot, by any chance */x+	for (hint = 0; hint < MAX_DEV_HINTS; hint++)
+		if (device_hint[hint].pdev == pdev)
+			device_hint[hint].pdev = NULL;x+
+	unlock_kernel();x+}x+x+x+/* *grunt* We have to do atoi ourselves :-( */x+static int pwc_atoi(const char *s)
+{
+	int k = 0;x+
+	k = 0;x+	while (*s != '\0' && *s >= '0' && *s <= '9') {
+		k = 10 * k + (*s - '0');x+		s++;x+	}
+	return k;x+}x+x+x+/* 
+ * Initialization code & module stuff 
+ */x+x+static char *size = NULL;x+static int fps = 0;x+static int fbufs = 0;x+static int mbufs = 0;x+static int trace = -1;x+static int compression = -1;x+static int leds[2] = { -1, -1 };x+static char *dev_hint[MAX_DEV_HINTS] = { };x+
+MODULE_PARM(size, "s");x+MODULE_PARM_DESC(size, "Initial image size. One of sqcif, qsif, qcif, sif, cif, vga");x+MODULE_PARM(fps, "i");x+MODULE_PARM_DESC(fps, "Initial frames per second. Varies with model, useful range 5-30");x+MODULE_PARM(fbufs, "i");x+MODULE_PARM_DESC(fbufs, "Number of internal frame buffers to reserve");x+MODULE_PARM(mbufs, "i");x+MODULE_PARM_DESC(mbufs, "Number of external (mmap()ed) image buffers");x+MODULE_PARM(trace, "i");x+MODULE_PARM_DESC(trace, "For debugging purposes");x+MODULE_PARM(power_save, "i");x+MODULE_PARM_DESC(power_save, "Turn power save feature in camera on or off");x+MODULE_PARM(compression, "i");x+MODULE_PARM_DESC(compression, "Preferred compression quality. Range 0 (uncompressed) to 3 (high compression)");x+MODULE_PARM(leds, "2i");x+MODULE_PARM_DESC(leds, "LED on,off time in milliseconds");x+MODULE_PARM(dev_hint, "0-20s");x+MODULE_PARM_DESC(dev_hint, "Device node hints");x+
+MODULE_DESCRIPTION("Philips & OEM USB webcam driver");x+MODULE_AUTHOR("Luc Saillard <luc@saillard.org>");x+MODULE_LICENSE("GPL");x+
+static int __init usb_pwc_init(void)
+{
+	int i, sz;
+	char *sizenames[PSZ_MAX] = { "sqcif", "qsif", "qcif", "sif", "cif", "vga" };x+
+	Info("Philips webcam module version " PWC_VERSION " loaded.\n");x+	Info("Supports Philips PCA645/646, PCVC675/680/690, PCVC720[40]/730/740/750 & PCVC830/840.\n");x+	Info("Also supports the Askey VC010, various Logitech Quickcams, Samsung MPC-C10 and MPC-C30,\n");x+	Info("the Creative WebCam 5 & Pro Ex, SOTEC Afina Eye and Visionite VCS-UC300 and VCS-UM100.\n");x+
+	if (fps) {
+		if (fps < 4 || fps > 30) {
+			Err("Framerate outxof bounds (4-30).\n");x+			return -EINVAL;x+		}
+		default_fps = fps;
+		Info("Default framerate set to %d.\n", default_fps);x+	}x+x+	if (size) {
+		/* string; try matching with array */
+		for (sz = 0; sz < PSZ_MAX; sz++) {
+			if (!strcmp(sizenames[sz], size)) { /* Found! */
+				default_size = sz;
+				break;
+			}x+		}
+		if (sz == PSZ_MAX) {
+			Err("Size not recognized; try size=[sqcif | qsif | qcif | sif | cif | vga].\n");x+			return -EINVAL;x+		}
+		Info("Default image size set to %s [%dx%d].\n", sizenames[default_size], pwc_image_sizes[default_size].x, pwc_image_sizes[default_size].y);x+	}x+	if (mbufs) {
+		if (mbufs < 1 || mbufs > MAX_IMAGES) {
+			Err("Illegal number of mmap() buffers; use a number between 1 and %d.\n", MAX_IMAGES);x+			return -EINVAL;x+		}
+		default_mbufs = mbufs;
+		Info("Number of image buffers set to %d.\n", default_mbufs);x+	}x+	if (fbufs) {
+		if (fbufs < 2 || fbufs > MAX_FRAMES) {
+			Err("Illegal number of frame buffers; use a number between 2 and %d.\n", MAX_FRAMES);x+			return -EINVAL;x+		}
+		default_fbufs = fbufs;
+		Info("Number of frame buffers set to %d.\n", default_fbufs);x+	}x+	if (trace >= 0) {
+		Info("Trace options: 0x%04x\n", trace);x+		pwc_trace = trace;x+	}x+	if (compression >= 0) {
+		if (compression > 3) {
+			Err("Invalid compression setting; use a number between 0 (uncompressed) and 3 (high).\n");x+			return -EINVAL;x+		}
+		pwc_preferred_compression = compression;x+		Info("Preferred compression set to %d.\n", pwc_preferred_compression);x+	}x+	if (power_save)x+		Info("Enabling power save on open/close.\n");x+	if (leds[0] >= 0)
+		led_on = leds[0];x+	if (leds[1] >= 0)
+		led_off = leds[1];x+
+	/* Big device node whoopla. Basicly, it allows you to assign a
+	   device node (/dev/videoX) to a camera, based on its type
+	   & serial number. The format is [type[.serialnumber]:]node.x+
+	   Any camera that isn't matched by these rules gets the next
+	   available free device node.
+	 */x+	for (i = 0; i < MAX_DEV_HINTS; i++) {
+		char *s, *colon, *dot;
+x+		/* This loop also initializes the array */
+		device_hint[i].pdev = NULL;x+		s = dev_hint[i];x+		if (s != NULL && *s != '\0') {
+			device_hint[i].type = -1; /* wildcard */
+			strcpy(device_hint[i].serial_number, "*");x+
+			/* parse string: chop at ':' & '/' */
+			colon = dot = s;x+			while (*colon != '\0' && *colon != ':')
+				colon++;x+			while (*dot != '\0' && *dot != '.')
+				dot++;x+			/* Few sanity checks */
+			if (*dot != '\0' && dot > colon) {
+				Err("Malformed camera hint: the colon must be after the dot.\n");x+				return -EINVAL;x+			}
+
+			if (*colon == '\0') {
+				/* No colon */
+				if (*dot != '\0') {
+					Err("Malformed camera hint: no colon + device node given.\n");x+					return -EINVAL;x+				}x+				else {
+					/* No type or serial number specified, just a number. */x+					device_hint[i].device_node = pwc_atoi(s);x+				}x+			}
+			else {
+				/* There's a colon, so we have at least a type and a device node */
+				device_hint[i].type = pwc_atoi(s);x+				device_hint[i].device_node = pwc_atoi(colon + 1);x+				if (*dot != '\0') {
+					/* There's a serial number as well */x+					int k;x+					x+					dot++;x+					k = 0;x+					while (*dot != ':' && k < 29) {
+						device_hint[i].serial_number[k++] = *dot;
+						dot++;x+					}x+					device_hint[i].serial_number[k] = '\0';x+				}x+			}
+#if PWC_DEBUG		x+			Debug("device_hint[%d]:\n", i);x+			Debug("  type    : %d\n", device_hint[i].type);x+			Debug("  serial# : %s\n", device_hint[i].serial_number);
+			Debug("  node    : %d\n", device_hint[i].device_node);
+#endif			
+		}
+		else
+			device_hint[i].type = 0; /* not filled */x+	} /* ..for MAX_DEV_HINTS */x+x+ 	Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver);x+	return usb_register(&pwc_driver);x+}x+x+static void __exit usb_pwc_exit(void)
+{
+	Trace(TRACE_MODULE, "Deregistering driver.\n");x+	usb_deregister(&pwc_driver);x+	Info("Philips webcam module removed.\n");x+}x+x+module_init(usb_pwc_init);x+module_exit(usb_pwc_exit);x+
diff -Nru a/drivers/usb/media/pwc/pwc-ioctl.h b/drivers/usb/media/pwc/pwc-ioctl.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-ioctl.h	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,292 @@
+#ifndef PWC_IOCTL_H
+#define PWC_IOCTL_H
+x+/* (C) 2001-2004 Nemosoft Unv.
+   (C) 2004      Luc Saillard (luc@saillard.org)x+x+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwxx+   driver and thus may have bugs that are not present in the original version.
+   Please send bug reports and support requests to <luc@saillard.org>.
+   The decompression routines have been implemented by reverse-engineering the
+   Nemosoft binary pwcx module. Caveat emptor.x+x+   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.
+x+   This program is distributed in the hope that it will be useful,
+   butxWITHOUT ANY WARRANTY; withoutxeven the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+x+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/* This is pwc-ioctl.h belonging to PWC 8.12.1x+   It contains structures and defines to communicate from user spacex+   directly to the driver.
+ */x+x+/*
+   Changes
+   2001/08/03  Alvarado   Added ioctl constants to access methods forx+                          changing white balance and red/blue gains
+   2002/12/15  G. H. Fernandez-Toribio   VIDIOCGREALSIZE
+   2003/12/13  Nemosft Unv. Some modifications to make interfacing tox+               PWCX easier
+ */x+x+/* These are private ioctl() commands, specific for the Philips webcams.
+   They contain functions not found in other webcams, and settings not
+   specified in the Video4Linux API.
+x+   The #define names are built up like follows:x+   VIDIOC		VIDeo IOCtl prefixx+         PWC		Philps WebCamx+            G           optional: Getx+            S           optional: Setx+             ... 	the function
+ */x+x+
+ /* Enumeration of image sizes */x+#define PSZ_SQCIF	0x00x+#define PSZ_QSIF	0x01x+#define PSZ_QCIF	0x02x+#define PSZ_SIF		0x03x+#define PSZ_CIF		0x04x+#define PSZ_VGA		0x05x+#define PSZ_MAX		6x+x+x+/* The frame rate is encoded in the video_window.flags parameter using
+   the upper 16 bits, since some flags are defined nowadays. The following
+   defines provide a mask and shift to filter out this value.
+x+   In 'Snapshot' mode the camera freezes its automatic exposure and colour
+   balance controls.
+ */x+#define PWC_FPS_SHIFT		16x+#define PWC_FPS_MASK		0x00FF0000x+#define PWC_FPS_FRMASK		0x003F0000x+#define PWC_FPS_SNAPSHOT	0x00400000x+x+x+/* structure for transfering x & y coordinates */x+struct pwc_coord
+{
+	int x, y;		/* guess what */
+	int size;		/* size, or offset */
+};x+
+
+/* Used with VIDIOCPWCPROBE */x+struct pwc_probe
+{
+	char name[32];x+	int type;
+};x+
+struct pwc_serial
+{
+	char serial[30];	/* String with serial number. Contains terminating 0 */
+};x+	
+/* pwc_whitebalance.mode values */x+#define PWC_WB_INDOOR		0x+#define PWC_WB_OUTDOOR		1x+#define PWC_WB_FL		2x+#define PWC_WB_MANUAL		3x+#define PWC_WB_AUTO		4
+
+/* Used with VIDIOCPWC[SG]AWB (Auto White Balance). 
+   Set mode to one of the PWC_WB_* values above.
+   *red and *blue are the respective gains of these colour components inside 
+   the camera; range 0..65535
+   When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; 
+   otherwise undefined.
+   'read_red' and 'read_blue' are read-only.
+*/   
+struct pwc_whitebalance
+{
+	int mode;
+	int manual_red, manual_blue;	/* R/W */
+	int read_red, read_blue;	/* R/O */
+};x+
+/* 
+   'control_speed' and 'control_delay' are used in automatic whitebalance mode,
+   and tell the camera how fast it should react to changes in lighting, and 
+   with how much delay. Valid values are 0..65535.
+*/
+struct pwc_wb_speed
+{
+	int control_speed;
+	int control_delay;x+
+};x+
+/* Used with VIDIOCPWC[SG]LED */
+struct pwc_leds
+{
+	int led_on;			/* Led on-time; range = 0..25000 */
+	int led_off;			/* Led off-time; range = 0..25000  */
+};x+
+/* Image size (used with GREALSIZE) */
+struct pwc_imagesize
+{
+	int width;x+	int height;
+};x+
+/* Defines and structures for Motorized Pan & Tilt */x+#define PWC_MPT_PAN		0x01x+#define PWC_MPT_TILT		0x02x+#define PWC_MPT_TIMEOUT		0x04 /* for status */x+x+/* Set angles; when absolute != 0, the angle is absolute and the x+   driver calculates the relative offset for you. This can only
+   be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns
+   absolute angles.
+ */   
+struct pwc_mpt_angles
+{
+	int absolute;		/* write-only */
+	int pan;		/* degrees * 100 */
+	int tilt;		/* degress * 100 */
+};x+
+/* Range of angles of the camera,xboth horizontally and vertically.
+ */x+struct pwc_mpt_range
+{
+	int pan_min, pan_max;		/* degrees * 100 */
+	int tilt_min, tilt_max;
+};x+
+struct pwc_mpt_status
+{
+	int status;
+	int time_pan;
+	int time_tilt;
+};x+
+
+/* This is used for out-of-kernel decompression. With it, you can getx+   all the necessary information to initialize and use the decompressorx+   routines in standalone applications.
+ */   
+struct pwc_video_command
+{
+	int type;		/* camera type (645, 675, 730, etc.) */
+	int release;		/* release number */
+x+        int size;		/* one of PSZ_* */
+        int alternate;
+	int command_len;	/* length of USB video command */
+	unsigned char command_buf[13];	/* Actual USB video command */
+	int bandlength;		/* >0 = compressed */
+	int frame_size;		/* Size of one (un)compressed frame */
+};x+
+/* Flags for PWCX subroutines. Not all modules honour all flags. */x+#define PWCX_FLAG_PLANAR	0x0001x+#define PWCX_FLAG_BAYER		0x0008x+
+
+/* IOCTL definitions */
+
+ /* Restore user settings */x+#define VIDIOCPWCRUSER		_IO('v', 192)
+ /* Save user settings */x+#define VIDIOCPWCSUSER		_IO('v', 193)
+ /* Restore factory settings */x+#define VIDIOCPWCFACTORY	_IO('v', 194)
+
+ /* You can manipulate the compression factor. A compression preference of 0
+    means use uncompressed modes when available; 1 is low compression, 2 is
+    medium and 3 is high compression preferred. Of course, the higher the
+    compression, the lower the bandwidth used butxmore chance of artefacts
+    in the image. The driver automatically choosesxa higher compression when
+    the preferred mode is not available.
+  */
+ /* Set preferred compression quality (0 = uncompressed, 3 = highest compression) */x+#define VIDIOCPWCSCQUAL		_IOW('v', 195, int)
+ /* Get preferred compression quality */x+#define VIDIOCPWCGCQUAL		_IOR('v', 195, int)
+x+
+/* Retrieve serial number of camera */x+#define VIDIOCPWCGSERIAL	_IOR('v', 198, struct pwc_serial)
+
+ /* This is a probe function; since so many devices are supported, itx+    becomes difficult to include all the names in programs that want tox+    check for the enhanced Philips stuff. So in stead, try this PROBE;
+    it returns a structure with the original name, and the corresponding
+    Philips type.
+    To use, fill the structure with zeroes, call PROBE and if that succeeds,
+    compare the name with that returned from VIDIOCGCAP; they should be the
+    same. If so, you can be assured it is a Philips (OEM) cam and the type
+    is valid.
+ */x+#define VIDIOCPWCPROBE		_IOR('v', 199, struct pwc_probe)
+
+ /* Set AGC (Automatic Gain Control); int < 0 = auto, 0..65535 = fixed */
+#define VIDIOCPWCSAGC		_IOW('v', 200, int)
+ /* Get AGC; int < 0 = auto; >= 0 = fixed, range 0..65535 */x+#define VIDIOCPWCGAGC		_IOR('v', 200, int)
+ /* Set shutter speed; int < 0 = auto; >= 0 = fixed, range 0..65535 */x+#define VIDIOCPWCSSHUTTER	_IOW('v', 201, int)
+x+ /* Color compensation (Auto White Balance) */
+#define VIDIOCPWCSAWB           _IOW('v', 202, struct pwc_whitebalance)x+#define VIDIOCPWCGAWB           _IOR('v', 202, struct pwc_whitebalance)x+x+ /* Auto WB speed */
+#define VIDIOCPWCSAWBSPEED	_IOW('v', 203, struct pwc_wb_speed)x+#define VIDIOCPWCGAWBSPEED	_IOR('v', 203, struct pwc_wb_speed)x+x+ /* LEDs on/off/blink; int range 0..65535 */x+#define VIDIOCPWCSLED           _IOW('v', 205, struct pwc_leds)x+#define VIDIOCPWCGLED           _IOR('v', 205, struct pwc_leds)x+
+  /* Contour (sharpness); int < 0 = auto, 0..65536 = fixed */
+#define VIDIOCPWCSCONTOUR	_IOW('v', 206, int)
+#define VIDIOCPWCGCONTOUR	_IOR('v', 206, int)
+
+  /* Backlight compensation; 0 = off, otherwise on */
+#define VIDIOCPWCSBACKLIGHT	_IOW('v', 207, int)
+#define VIDIOCPWCGBACKLIGHT	_IOR('v', 207, int)
+
+  /* Flickerless mode; = 0 off, otherwise on */
+#define VIDIOCPWCSFLICKER	_IOW('v', 208, int)
+#define VIDIOCPWCGFLICKER	_IOR('v', 208, int)  
+
+  /* Dynamic noise reduction; 0 off, 3 = high noise reduction */
+#define VIDIOCPWCSDYNNOISE	_IOW('v', 209, int)
+#define VIDIOCPWCGDYNNOISE	_IOR('v', 209, int)
+
+ /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */x+#define VIDIOCPWCGREALSIZE	_IOR('v', 210, struct pwc_imagesize)
+
+ /* Motorized pan & tilt functions */ x+#define VIDIOCPWCMPTRESET	_IOW('v', 211, int)
+#define VIDIOCPWCMPTGRANGE	_IOR('v', 211, struct pwc_mpt_range)
+#define VIDIOCPWCMPTSANGLE	_IOW('v', 212, struct pwc_mpt_angles)
+#define VIDIOCPWCMPTGANGLE	_IOR('v', 212, struct pwc_mpt_angles)
+#define VIDIOCPWCMPTSTATUS	_IOR('v', 213, struct pwc_mpt_status)
+
+ /* Get the USB set-video command; needed for initializing libpwcx */x+#define VIDIOCPWCGVIDCMD	_IOR('v', 215, struct pwc_video_command)
+struct pwc_table_init_buffer {
+   int len;
+   char *buffer;x+
+};x+#define VIDIOCPWCGVIDTABLE	_IOR('v', 216, struct pwc_table_init_buffer)
+
+#endif
diff -Nru a/drivers/usb/media/pwc/pwc-kiara.c b/drivers/usb/media/pwc/pwc-kiara.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-kiara.c	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,891 @@
+/* Linux driver for Philips webcam
+   (C) 2004      Luc Saillard (luc@saillard.org)x+x+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwxx+   driver and thus may have bugs that are not present in the original version.
+   Please send bug reports and support requests to <luc@saillard.org>.
+   The decompression routines have been implemented by reverse-engineering the
+   Nemosoft binary pwcx module. Caveat emptor.x+x+   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.
+x+   This program is distributed in the hope that it will be useful,
+   butxWITHOUT ANY WARRANTY; withoutxeven the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+x+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+
+/* This tables contains entries for the 730/740/750 (Kiara) camera,xwithx+   4 different qualities (no compression, low, medium, high).x+   It lists the bandwidth requirements for said mode by its alternate interfacex+   number. An alternate of 0 means that the mode is unavailable.
+
+   There are 6 * 4 * 4 entries:
+     6 different resolutions subqcif, qsif, qcif, sif, cif, vga
+     6 framerates: 5, 10, 15, 20, 25, 30
+     4 compression modi: none, low, medium, high
+
+   When an uncompressed mode is not available, the next available compressed mode
+   will be chosen (unless the decompressor is absent). Sometimes there are only
+   1 or 2 compressed modes available; in that case entries are duplicated.
+*/
+
+
+#include "pwc-kiara.h"
+#include "pwc-uncompress.h"
+
+const struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4] =
+{
+   /* SQCIF */
+   {
+      /* 5 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 10 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 15 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 20 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 25 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 30 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+   },x+   /* QSIF */
+   {
+      /* 5 fps */
+      {x+         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},x+         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},x+         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},x+         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},x+      },x+      /* 10 fps */
+      {x+         {2, 291,    0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}},x+         {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},x+         {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},x+         {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},x+      },x+      /* 15 fps */
+      {x+         {3, 437,    0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}},x+         {2, 292,  640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},x+         {2, 292,  640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},x+         {1, 192,  420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}},x+      },x+      /* 20 fps */
+      {x+         {4, 589,    0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}},x+         {3, 448,  730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}},x+         {2, 292,  476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}},x+         {1, 192,  312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}},x+      },x+      /* 25 fps */
+      {x+         {5, 703,    0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}},x+         {3, 447,  610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}},x+         {2, 292,  398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}},x+         {1, 193,  262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}},x+      },x+      /* 30 fps */
+      {x+         {8, 874,    0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}},x+         {5, 704,  730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}},x+         {3, 448,  492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}},x+         {2, 292,  320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}},x+      },x+   },x+   /* QCIF */
+   {
+      /* 5 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 10 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 15 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 20 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 25 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 30 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+   },x+   /* SIF */
+   {
+      /* 5 fps */
+      {x+         {4, 582,    0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}},x+         {3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}},x+         {2, 291,  960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}},x+         {1, 191,  630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}},x+      },x+      /* 10 fps */
+      {x+         {0, },x+         {6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}},x+         {3, 447,  736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}},x+         {2, 292,  480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}},x+      },x+      /* 15 fps */
+      {x+         {0, },x+         {9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}},x+         {4, 592,  650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}},x+         {3, 448,  492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}},x+      },x+      /* 20 fps */
+      {x+         {0, },x+         {9, 958,  782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}},x+         {5, 703,  574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}},x+         {3, 446,  364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}},x+      },x+      /* 25 fps */
+      {x+         {0, },x+         {9, 958,  654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}},x+         {6, 776,  530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}},x+         {4, 592,  404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}},x+      },x+      /* 30 fps */
+      {x+         {0, },x+         {9, 957,  526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}},x+         {6, 775,  426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}},x+         {4, 590,  324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}},x+      },x+   },x+   /* CIF */
+   {
+      /* 5 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 10 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 15 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 20 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 25 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 30 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+   },x+   /* VGA */
+   {
+      /* 5 fps */
+      {x+         {0, },x+         {6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}},x+         {4, 592,  976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}},x+         {3, 448,  738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}},x+      },x+      /* 10 fps */
+      {x+         {0, },x+         {9, 956,  788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}},x+         {6, 776,  640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}},x+         {4, 592,  488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}},x+      },x+      /* 15 fps */
+      {x+         {0, },x+         {9, 957,  526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},x+         {9, 957,  526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},x+         {8, 895,  492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}},x+      },x+      /* 20 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 25 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 30 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+   },x+};x+
+
+/*
+ * Rom table for kiara chips
+ *
+ * 32 roms tables (one for each resolution ?)
+ *  2 tables per roms (one for each passes) (Y, and U&V)
+ * 128 bytes per passes
+ */x+x+const unsigned int KiaraRomTable [8][2][16][8] =  
+{
+ { /* version 0 */
+  { /* version 0, passes 0 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000001,0x00000001},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000009,0x00000009,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00000009,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000249,0x0000024a,0x00000049},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000249,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000249,x+    0x00000249,0x0000124a,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000249,x+    0x0000124a,0x00009252,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00009252,0x00009292,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009292,0x00009292,0x00009493,0x000124db},x+   {0x00000000,0x00000000,0x00000249,0x0000924a,x+    0x00009492,0x0000a49b,0x0000a49b,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x0000a493,0x000124db,0x000124db,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x000124db,0x000126dc,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000124db,0x000136e4,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b925,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 0, passes 1 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000},
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000},
+   {0x00000000,0x00000000,0x00000001,0x00000009,x+    0x00000009,0x00000009,0x00000009,0x00000001},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000249,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00001252},x+   {0x00000000,0x00000000,0x00000049,0x00001249,x+    0x0000124a,0x0000124a,0x00001252,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009252,0x00009252,0x00009292,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x0000924a,x+    0x00009292,0x00009292,0x00009292,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x00009292,x+    0x00009492,0x00009493,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x0000a493,0x000124db,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00009252,0x00009493,x+    0x000126dc,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000136e4,0x000136e4,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 1 */
+  { /* version 1, passes 0 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000001},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000009,0x00000009,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00001252},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x0000124a,0x00009252,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009252,0x00009292,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009252,0x00009292,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x0000924a,x+    0x00009252,0x00009493,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x0000924a,x+    0x00009292,0x00009493,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x00009252,x+    0x00009492,0x00009493,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x000124db,0x000124db,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000126dc,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 1, passes 1 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000},
+   {0x00000000,0x00000000,0x00000049,0x00000009,x+    0x00000049,0x00000009,0x00000001,0x00000000},
+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000000},
+   {0x00000000,0x00000000,0x00000249,0x00000049,x+    0x00000249,0x00000049,0x0000024a,0x00000001},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00000001},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00000001},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x0000024a,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x0000024a,0x00000009},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x00009252,0x00001252,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x00009292,0x00001252,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x00009292,0x00001252,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009292,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x0000924a,0x0000924a,x+    0x00009492,0x00009493,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 2 */
+  { /* version 2, passes 0 */
+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x0000124a,0x00001252,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x00009252,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x0000124a,0x00009292,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009252,0x00009493,0x00009493,0x0000a49b},x+   {0x00000000,0x00000000,0x00000249,0x0000924a,x+    0x00009292,0x00009493,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009292,0x00009493,0x0000a49b,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x00009492,0x0000a49b,0x0000a49b,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x000124db,0x000124db,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x0000a493,0x000124db,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x000136e4},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0001249b,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000136e4,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x00009252,0x000124db,x+    0x000126dc,0x0001b724,0x0001b725,0x0001b925},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 2, passes 1 */
+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00000249,x+    0x0000124a,0x0000124a,0x00001252,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x00009292,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009292,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x0000a49b,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009493,0x0000a49b,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009493,0x0000a49b,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x0000a49b,0x0000a49b,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x0000a49b,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x00009252,0x0000a49b,x+    0x0001249b,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 3 */
+  { /* version 3, passes 0 */
+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009493,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x0000a49b,0x0000a49b,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x000124db,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000126dc,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0001249b,0x000126dc,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000136e4,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000136e4,0x0001b725,0x0001b925},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x000136e4,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b92d,0x0001c92d},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000126dc,0x0001b724,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x000136e4,0x0001b925,0x00025bb6,0x00024b77},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 3, passes 1 */
+   {0x00000000,0x00000000,0x00001249,0x00000249,x+    0x0000124a,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x00009493,0x0000a49b,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x0000a49b,0x000126dc,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x000126dc,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x000126dc,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x000124db,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00009492,0x0000a49b,x+    0x000136e4,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x0001b724,0x0001b724,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 4 */
+  { /* version 4, passes 0 */
+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000249,0x00000049,x+    0x00000249,0x00000249,0x0000024a,0x00000049},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x00009252,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009493,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009292,0x00009493,0x00009493,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000124db,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0001249b,0x000126dc,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00009252,0x00009493,x+    0x000124db,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009252,0x0000a49b,x+    0x000124db,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00009492,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x000136e4,0x0001b925,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 4, passes 1 */
+   {0x00000000,0x00000000,0x00000249,0x00000049,x+    0x00000009,0x00000009,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000049,0x00000049,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x00000249,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x0000124a,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009252,0x0000124a,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x00009252,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x00009292,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x00009292,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x00009493,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000124db,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009252,0x000124db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 5 */
+  { /* version 5, passes 0 */
+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x0000a49b,0x000124db,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000126dc,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b725,0x000136e4},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000136e4,0x0001b724,0x0001b92d,0x0001b724},x+   {0x00000000,0x00000000,0x00009492,0x0000a49b,x+    0x000136e4,0x0001b724,0x0001b92d,0x0001b724},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b925,0x0001c96e,0x0001b925},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x0001b724,0x0001b925,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001c924,0x0002496d,0x00025bb6,0x00024b77},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 5, passes 1 */
+   {0x00000000,0x00000000,0x00001249,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009252,0x00009252,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x0000a49b,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000124db,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000124db,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x000126dc,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009292,0x000124db,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 6 */
+  { /* version 6, passes 0 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x0000a493,0x0000a49b,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000126dc,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b725,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000136e4,0x0001b724,0x0001b92d,0x000136e4},x+   {0x00000000,0x00000000,0x00009492,0x0000a49b,x+    0x000136e4,0x0001b724,0x0001b92d,0x0001b724},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b724,0x0001b92d,0x0001b724},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b925,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x0001b724,0x0001b925,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x0001b724,0x0001c92d,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x0001b724,0x0001c92d,0x00024b76,0x0002496e},x+   {0x00000000,0x00000000,0x00012492,0x000126db,x+    0x0001c924,0x00024b6d,0x0002ddb6,0x00025bbf},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 6, passes 1 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x00009252,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x00009292,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x0000a49b,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000124db,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x000126dc,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001c924,0x0001b724,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 7 */
+  { /* version 7, passes 0 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x0000a49b,x+    0x0001249b,0x000126dc,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000136e4,0x0001b725,0x000124db},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000136e4,0x0001b724,0x0001b725,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x000124db,x+    0x000136e4,0x0001b724,0x0001b725,0x000126dc},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b724,0x0001c96e,0x000136e4},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001c92d,0x0001c96e,0x0001b724},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x000136e4,0x0001c92d,0x0001c96e,0x0001b724},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x0001b724,0x0001c92d,0x0001c96e,0x0001b925},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001b724,0x0001c92d,0x00024b76,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001b924,0x0001c92d,0x00024b76,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001b924,0x0001c92d,0x00024b76,0x0002496e},x+   {0x00000000,0x00000000,0x00012492,0x000136db,x+    0x00024924,0x00024b6d,0x0002ddb6,0x00025bbf},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 7, passes 1 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x00009492,0x00009292,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x0000a49b,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x000124db,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000136db,x+    0x0001b724,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000136db,x+    0x0001b724,0x000126dc,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00009292,0x000136db,x+    0x0001b724,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009492,0x000136db,x+    0x0001b724,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00012492,0x0001b6db,x+    0x0001c924,0x0001b724,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ }x+};x+
diff -Nru a/drivers/usb/media/pwc/pwc-kiara.h b/drivers/usb/media/pwc/pwc-kiara.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-kiara.h	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,45 @@
+/* Linux driver for Philips webcamx+   (C) 2004      Luc Saillard (luc@saillard.org)x+x+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwxx+   driver and thus may have bugs that are not present in the original version.x+   Please send bug reports and support requests to <luc@saillard.org>.x+   The decompression routines have been implemented by reverse-engineering thex+   Nemosoft binary pwcx module. Caveat emptor.x+x+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, orx+   (at your option) any later version.x+x+   This program is distributed in the hope that it will be useful,x+   but WITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thex+   GNU General Public License for more details.x+x+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/x+x+/* Entries for the Kiara (730/740/750) camera */x+x+#ifndef PWC_KIARA_Hx+#define PWC_KIARA_Hx+x+#include "pwc-ioctl.h"x+x+struct Kiara_table_entry
+{
+	char alternate;			/* USB alternate interface */x+	unsigned short packetsize;	/* Normal packet size */x+	unsigned short bandlength;	/* Bandlength when decompressing */x+	unsigned char mode[12];		/* precomputed mode settings for cam */x+};x+
+const extern struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4];
+const extern unsigned int KiaraRomTable[8][2][16][8];x+
+#endifx+
+
diff -Nru a/drivers/usb/media/pwc/pwc-misc.c b/drivers/usb/media/pwc/pwc-misc.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-misc.c	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,140 @@
+/* Linux driver for Philips webcam x+   Various miscellaneous functions and tables.x+   (C) 1999-2003 Nemosoft Unv.x+   (C) 2004      Luc Saillard (luc@saillard.org)x+x+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwxx+   driver and thus may have bugs that are not present in the original version.x+   Please send bug reports and support requests to <luc@saillard.org>.x+   The decompression routines have been implemented by reverse-engineering thex+   Nemosoft binary pwcx module. Caveat emptor.x+x+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, orx+   (at your option) any later version.x+x+   This program is distributed in the hope that it will be useful,x+   but WITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thex+   GNU General Public License for more details.x+x+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/x+x+#include <linux/slab.h>x+x+#include "pwc.h"x+x+struct pwc_coord pwc_image_sizes[PSZ_MAX] =
+{
+	{ 128,  96, 0 },x+	{ 160, 120, 0 },x+	{ 176, 144, 0 },x+	{ 320, 240, 0 },x+	{ 352, 288, 0 },x+	{ 640, 480, 0 },x+};x+
+/* x,y -> PSZ_ */x+int pwc_decode_size(struct pwc_device *pdev, int width, int height)
+{
+	int i, find;x+
+	/* Make sure we don't go beyond our max size.x+           NB: we have different limits for RAW and normal modes. In casex+           you don't have the decompressor loaded or use RAW mode, x+           the maximum viewable size is smaller.x+        */x+	if (pdev->vpalette == VIDEO_PALETTE_RAW)x+	{x+		if (width > pdev->abs_max.x || height > pdev->abs_max.y)x+		{x+			Debug("VIDEO_PALETTE_RAW: going beyond abs_max.\n");x+                	return -1;x+                }x+	}x+	elsex+	{x+		if (width > pdev->view_max.x || height > pdev->view_max.y)x+		{x+			Debug("VIDEO_PALETTE_ not RAW: going beyond view_max.\n");x+			return -1;x+		}x+	}x+
+	/* Find the largest size supported by the camera that fits into thex+	   requested size.x+	 */x+	find = -1;x+	for (i = 0; i < PSZ_MAX; i++) {x+		if (pdev->image_mask & (1 << i)) {x+			if (pwc_image_sizes[i].x <= width && pwc_image_sizes[i].y <= height)
+				find = i;x+		}x+	}x+	return find;x+}x+
+/* initialize variables depending on type and decompressor*/x+void pwc_construct(struct pwc_device *pdev)
+{
+	switch(pdev->type) {x+	case 645:x+	case 646:x+		pdev->view_min.x = 128;x+		pdev->view_min.y =  96;x+		pdev->view_max.x = 352;x+		pdev->view_max.y = 288;x+                pdev->abs_max.x  = 352;x+                pdev->abs_max.y  = 288;x+		pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF;x+		pdev->vcinterface = 2;x+		pdev->vendpoint = 4;x+		pdev->frame_header_size = 0;x+		pdev->frame_trailer_size = 0;x+		break;x+	case 675:x+	case 680:x+	case 690:x+		pdev->view_min.x = 128;x+		pdev->view_min.y =  96;x+		/* Anthill bug #38: PWC always reports max size, even without PWCX */x+		pdev->view_max.x = 640;x+		pdev->view_max.y = 480;x+		pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA;x+                pdev->abs_max.x = 640;x+                pdev->abs_max.y = 480;x+		pdev->vcinterface = 3;x+		pdev->vendpoint = 4;x+		pdev->frame_header_size = 0;x+		pdev->frame_trailer_size = 0;x+		break;x+	case 720:x+	case 730:x+	case 740:x+	case 750:x+		pdev->view_min.x = 160;x+		pdev->view_min.y = 120;x+		pdev->view_max.x = 640;x+		pdev->view_max.y = 480;x+		pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA;x+                pdev->abs_max.x = 640;x+                pdev->abs_max.y = 480;x+		pdev->vcinterface = 3;x+		pdev->vendpoint = 5;x+		pdev->frame_header_size = TOUCAM_HEADER_SIZE;x+		pdev->frame_trailer_size = TOUCAM_TRAILER_SIZE;x+		break;x+	}x+	Debug("type = %d\n",pdev->type);x+	pdev->vpalette = VIDEO_PALETTE_YUV420P; /* default */x+	pdev->view_min.size = pdev->view_min.x * pdev->view_min.y;x+	pdev->view_max.size = pdev->view_max.x * pdev->view_max.y;
+	/* length of image, in YUV format; always allocate enough memory. */x+	pdev->len_per_image = (pdev->abs_max.x * pdev->abs_max.y * 3) / 2;x+}x+
+
diff -Nru a/drivers/usb/media/pwc/pwc-nala.h b/drivers/usb/media/pwc/pwc-nala.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-nala.h	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,66 @@
+   /* SQCIF */
+   {x+      {0, 0, {0x04, 0x01, 0x03}},x+      {8, 0, {0x05, 0x01, 0x03}},x+      {7, 0, {0x08, 0x01, 0x03}},x+      {7, 0, {0x0A, 0x01, 0x03}},x+      {6, 0, {0x0C, 0x01, 0x03}},x+      {5, 0, {0x0F, 0x01, 0x03}},x+      {4, 0, {0x14, 0x01, 0x03}},x+      {3, 0, {0x18, 0x01, 0x03}},x+   },x+   /* QSIF */
+   {x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+   },x+   /* QCIF */
+   {x+      {0, 0, {0x04, 0x01, 0x02}},x+      {8, 0, {0x05, 0x01, 0x02}},x+      {7, 0, {0x08, 0x01, 0x02}},x+      {6, 0, {0x0A, 0x01, 0x02}},x+      {5, 0, {0x0C, 0x01, 0x02}},x+      {4, 0, {0x0F, 0x01, 0x02}},x+      {1, 0, {0x14, 0x01, 0x02}},x+      {1, 0, {0x18, 0x01, 0x02}},x+   },x+   /* SIF */
+   {x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+   },x+   /* CIF */
+   {x+      {4, 0, {0x04, 0x01, 0x01}},x+      {7, 1, {0x05, 0x03, 0x01}},x+      {6, 1, {0x08, 0x03, 0x01}},x+      {4, 1, {0x0A, 0x03, 0x01}},x+      {3, 1, {0x0C, 0x03, 0x01}},x+      {2, 1, {0x0F, 0x03, 0x01}},x+      {0},x+      {0},x+   },x+   /* VGA */
+   {  x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+      {0},x+   },xdiff -Nru a/drivers/usb/media/pwc/pwc-timon.c b/drivers/usb/media/pwc/pwc-timon.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-timon.c	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,1446 @@
+/* Linux driver for Philips webcamx+   (C) 2004      Luc Saillard (luc@saillard.org)x+x+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwxx+   driver and thus may have bugs that are not present in the original version.x+   Please send bug reports and support requests to <luc@saillard.org>.x+   The decompression routines have been implemented by reverse-engineering thex+   Nemosoft binary pwcx module. Caveat emptor.x+x+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, orx+   (at your option) any later version.x+x+   This program is distributed in the hope that it will be useful,x+   but WITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thex+   GNU General Public License for more details.x+x+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/x+x+
+/* This tables contains entries for the 675/680/690 (Timon) camera, withx+   4 different qualities (no compression, low, medium, high).x+   It lists the bandwidth requirements for said mode by its alternate interfacex+   number. An alternate of 0 means that the mode is unavailable.x+x+   There are 6 * 4 * 4 entries:x+     6 different resolutions subqcif, qsif, qcif, sif, cif, vgax+     6 framerates: 5, 10, 15, 20, 25, 30x+     4 compression modi: none, low, medium, highx+x+   When an uncompressed mode is not available, the next available compressed modex+   will be chosen (unless the decompressor is absent). Sometimes there are onlyx+   1 or 2 compressed modes available; in that case entries are duplicated.
+*/x+x+#include "pwc-timon.h"x+x+const struct Timon_table_entry Timon_table[PSZ_MAX][6][4] =
+{
+   /* SQCIF */
+   {x+      /* 5 fps */
+      {x+         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},x+         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},x+         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},x+         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},x+      },x+      /* 10 fps */
+      {x+         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},x+         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},x+         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},x+         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},x+      },x+      /* 15 fps */
+      {x+         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},x+         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},x+         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},x+         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},x+      },x+      /* 20 fps */
+      {x+         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},x+         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},x+         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},x+         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},x+      },x+      /* 25 fps */
+      {x+         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},x+         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},x+         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},x+         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},x+      },x+      /* 30 fps */
+      {x+         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},x+         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},x+         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},x+         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},x+      },x+   },x+   /* QSIF */
+   {x+      /* 5 fps */
+      {x+         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},x+         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},x+         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},x+         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},x+      },x+      /* 10 fps */
+      {x+         {2, 291,    0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}},x+         {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},x+         {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},x+         {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},x+      },x+      /* 15 fps */
+      {x+         {3, 437,    0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}},x+         {2, 291,  640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}},x+         {2, 291,  640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}},x+         {1, 191,  420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},x+      },x+      /* 20 fps */
+      {x+         {4, 588,    0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}},x+         {3, 447,  730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}},x+         {2, 292,  476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}},x+         {1, 192,  312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}},x+      },x+      /* 25 fps */
+      {x+         {5, 703,    0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}},x+         {3, 447,  610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}},x+         {2, 292,  398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}},x+         {1, 192,  262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}},x+      },x+      /* 30 fps */
+      {x+         {8, 873,    0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}},x+         {5, 704,  774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}},x+         {3, 448,  492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}},x+         {2, 291,  320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}},x+      },x+   },x+   /* QCIF */
+   {x+      /* 5 fps */
+      {x+         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},x+         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},x+         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},x+         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},x+      },x+      /* 10 fps */
+      {x+         {3, 385,    0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}},x+         {2, 291,  800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}},x+         {2, 291,  800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}},x+         {1, 194,  532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}},x+      },x+      /* 15 fps */
+      {x+         {4, 577,    0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}},x+         {3, 447,  818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}},x+         {2, 292,  534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}},x+         {1, 195,  356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}},x+      },x+      /* 20 fps */
+      {x+         {6, 776,    0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}},x+         {4, 591,  804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}},x+         {3, 447,  608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}},x+         {2, 291,  396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}},x+      },x+      /* 25 fps */
+      {x+         {9, 928,    0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}},x+         {5, 703,  800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}},x+         {3, 447,  508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}},x+         {2, 292,  332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}},x+      },x+      /* 30 fps */
+      {x+         {0, },x+         {9, 956,  876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}},x+         {4, 592,  542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}},x+         {2, 291,  266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}},x+      },x+   },x+   /* SIF */
+   {x+      /* 5 fps */
+      {x+         {4, 582,    0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}},x+         {3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}},x+         {2, 291,  960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}},x+         {1, 191,  630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}},x+      },x+      /* 10 fps */
+      {x+         {0, },x+         {6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}},x+         {3, 447,  736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}},x+         {2, 291,  480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}},x+      },x+      /* 15 fps */
+      {x+         {0, },x+         {9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}},x+         {4, 591,  650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}},x+         {3, 448,  492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}},x+      },x+      /* 20 fps */
+      {x+         {0, },x+         {9, 958,  782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}},x+         {5, 703,  574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}},x+         {3, 446,  364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}},x+      },x+      /* 25 fps */
+      {x+         {0, },x+         {9, 958,  654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}},x+         {6, 776,  530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}},x+         {4, 592,  404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}},x+      },x+      /* 30 fps */
+      {x+         {0, },x+         {9, 957,  526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}},x+         {6, 775,  426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}},x+         {4, 590,  324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}},x+      },x+   },x+   /* CIF */
+   {x+      /* 5 fps */
+      {x+         {6, 771,    0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}},x+         {4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}},x+         {2, 291,  800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}},x+         {1, 193,  528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}},x+      },x+      /* 10 fps */
+      {x+         {0, },x+         {9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}},x+         {4, 591,  812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}},x+         {2, 291,  400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}},x+      },x+      /* 15 fps */
+      {x+         {0, },x+         {9, 956,  876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}},x+         {5, 703,  644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}},x+         {3, 448,  410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}},x+      },x+      /* 20 fps */
+      {x+         {0, },x+         {9, 956,  650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}},x+         {6, 776,  528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}},x+         {4, 591,  402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}},x+      },x+      /* 25 fps */
+      {x+         {0, },x+         {9, 956,  544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}},x+         {7, 840,  478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}},x+         {5, 703,  400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}},x+      },x+      /* 30 fps */
+      {x+         {0, },x+         {9, 956,  438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}},x+         {7, 838,  384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}},x+         {6, 773,  354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}},x+      },x+   },x+   /* VGA */
+   {x+      /* 5 fps */
+      {x+         {0, },x+         {6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}},x+         {4, 592,  976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}},x+         {3, 448,  738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}},x+      },x+      /* 10 fps */
+      {x+         {0, },x+         {9, 956,  788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}},x+         {6, 776,  640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}},x+         {4, 592,  488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}},x+      },x+      /* 15 fps */
+      {x+         {0, },x+         {9, 957,  526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}},x+         {9, 957,  526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}},x+         {8, 895,  492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}},x+      },x+      /* 20 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 25 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+      /* 30 fps */
+      {x+         {0, },x+         {0, },x+         {0, },x+         {0, },x+      },x+   },x+};x+
+/*x+ * 16 versions:x+ *   2 tables  (one for Y, and one for U&V)x+ *   16 levels of details per tablesx+ *   8 blocsx+ */x+x+const unsigned int TimonRomTable [16][2][16][8] =  
+{
+ { /* version 0 */
+  { /* version 0, passes 0 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000001},x+   {0x00000000,0x00000000,0x00000001,0x00000001,x+    0x00000001,0x00000001,0x00000001,0x00000001},x+   {0x00000000,0x00000000,0x00000001,0x00000001,x+    0x00000001,0x00000009,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00000009,0x00000001,x+    0x00000009,0x00000009,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000009,0x00000009,0x00000049,0x00000009},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000009,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000009,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000249,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000249,0x00000249,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000249,0x0000124a,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000249,x+    0x00000249,0x0000124a,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x0000124a,0x00009252,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 0, passes 1 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000},x+   {0x00000000,0x00000000,0x00000001,0x00000001,x+    0x00000001,0x00000001,0x00000000,0x00000000},x+   {0x00000000,0x00000000,0x00000009,0x00000001,x+    0x00000001,0x00000009,0x00000000,0x00000000},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000009,0x00000009,0x00000000,0x00000000},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000009,0x00000009,0x00000001,0x00000000},x+   {0x00000000,0x00000000,0x00000049,0x00000009,x+    0x00000009,0x00000049,0x00000001,0x00000001},x+   {0x00000000,0x00000000,0x00000049,0x00000009,x+    0x00000009,0x00000049,0x00000001,0x00000001},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000009,0x00000001},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000009,0x00000001},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000009,0x00000001},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000249,0x00000049,0x00000009},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000249,0x00000049,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00000049,x+    0x00000249,0x00000249,0x00000049,0x00000009},x+   {0x00000000,0x00000000,0x00001249,0x00000249,x+    0x0000124a,0x0000124a,0x0000024a,0x00000049},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 1 */
+  { /* version 1, passes 0 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000001},x+   {0x00000000,0x00000000,0x00000001,0x00000001,x+    0x00000001,0x00000009,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000009,0x00000009,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000009,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000009,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000249,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00001252},x+   {0x00000000,0x00000000,0x00000049,0x00000249,x+    0x00000249,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00000049,0x00000249,x+    0x0000124a,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x0000124a,0x00009252,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009252,0x00009252,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x0000924a,x+    0x00009292,0x00009493,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x00009492,0x0000a49b,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 1, passes 1 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000009,0x00000001,0x00000001,0x00000000},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000009,0x00000009,0x00000001,0x00000000},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000009,0x00000001,0x00000000},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000001,0x00000001},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000009,0x00000001},x+   {0x00000000,0x00000000,0x00000249,0x00000049,x+    0x00000049,0x00000249,0x00000009,0x00000001},x+   {0x00000000,0x00000000,0x00000249,0x00000049,x+    0x00000249,0x00000249,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x00000049,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x0000124a,0x00000049,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x0000124a,0x00000049,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x0000124a,0x0000024a,0x00000049},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x0000024a,0x00000049},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x0000024a,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009252,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 2 */
+  { /* version 2, passes 0 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000001},x+   {0x00000000,0x00000000,0x00000009,0x00000009,x+    0x00000009,0x00000009,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000049,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00001252},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x0000124a,0x00009252,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009252,0x00009292,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009252,0x00009292,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x0000924a,x+    0x00009252,0x00009493,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x0000924a,x+    0x00009292,0x00009493,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x00009252,x+    0x00009492,0x00009493,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x000124db,0x000124db,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000126dc,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 2, passes 1 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000},x+   {0x00000000,0x00000000,0x00000049,0x00000009,x+    0x00000049,0x00000009,0x00000001,0x00000000},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000000},x+   {0x00000000,0x00000000,0x00000249,0x00000049,x+    0x00000249,0x00000049,0x0000024a,0x00000001},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00000001},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00000001},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x0000024a,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x0000024a,0x00000009},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x00009252,0x00001252,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x00009292,0x00001252,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x00009292,0x00001252,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009292,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x0000924a,0x0000924a,x+    0x00009492,0x00009493,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 3 */
+  { /* version 3, passes 0 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000001},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000049,0x00000249,x+    0x00000249,0x00000249,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x00009252,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x0000124a,0x00009292,0x00009292,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009252,0x00009292,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009292,0x00009493,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x00009252,x+    0x00009292,0x00009493,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x00009292,0x0000a49b,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x00009492,0x0000a49b,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x0000a49b,0x000124db,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x0000a493,0x0000a49b,0x000124db,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0001249b,0x000126dc,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000136e4,0x0001b725,0x000136e4},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 3, passes 1 */
+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000},x+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000001,0x00000000},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x00000049,0x00000001},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x0000124a,0x00001252,0x00000001},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x00001252,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x0000124a,0x00009252,0x00009292,0x00000009},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x00009252,0x00009292,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009252,0x00009292,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009493,0x00009292,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009493,0x00009292,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009493,0x00009493,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009292,0x00009493,0x00009493,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x00009493,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x00009492,0x0000a49b,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x00009292,x+    0x0000a493,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 4 */
+  { /* version 4, passes 0 */
+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x0000124a,0x00001252,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x00009252,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x0000124a,0x00009292,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009252,0x00009493,0x00009493,0x0000a49b},x+   {0x00000000,0x00000000,0x00000249,0x0000924a,x+    0x00009292,0x00009493,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009292,0x00009493,0x0000a49b,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x00009492,0x0000a49b,0x0000a49b,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x000124db,0x000124db,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x0000a493,0x000124db,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x000136e4},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0001249b,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000136e4,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x00009252,0x000124db,x+    0x000126dc,0x0001b724,0x0001b725,0x0001b925},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 4, passes 1 */
+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00000249,x+    0x0000124a,0x0000124a,0x00001252,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x00009292,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009292,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x0000a49b,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009493,0x0000a49b,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009493,0x0000a49b,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x0000a49b,0x0000a49b,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x0000a49b,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x00009252,0x0000a49b,x+    0x0001249b,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 5 */
+  { /* version 5, passes 0 */
+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x0000124a,0x00001252,0x00009292},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x0000124a,0x00009292,0x00009292,0x00009493},x+   {0x00000000,0x00000000,0x00000249,0x0000924a,x+    0x00009292,0x00009493,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009292,0x00009493,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x0000a49b,0x0000a49b,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x0000a49b,0x000124db,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x0000a493,0x000124db,0x000124db,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0001249b,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0001249b,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0001249b,0x000126dc,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000126dc,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x000136e4,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b724,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 5, passes 1 */
+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009493,0x00009493,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009493,0x00009493,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009493,0x0000a49b,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x00009493,0x000124db,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x00009493,0x000124db,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x0000a49b,0x000124db,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x0000a49b,0x000124db,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000124db,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000124db,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000124db,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009252,0x000124db,x+    0x000126dc,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 6 */
+  { /* version 6, passes 0 */
+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x0000124a,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009493,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x0000a49b,0x0000a49b,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x000124db,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000126dc,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0001249b,0x000126dc,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000136e4,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000136e4,0x0001b725,0x0001b925},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x000136e4,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b92d,0x0001c92d},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000126dc,0x0001b724,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x000136e4,0x0001b925,0x00025bb6,0x00024b77},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 6, passes 1 */
+   {0x00000000,0x00000000,0x00001249,0x00000249,x+    0x0000124a,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x00009493,0x0000a49b,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x0000a49b,0x000126dc,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x000126dc,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x000126dc,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x000124db,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00009492,0x0000a49b,x+    0x000136e4,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x0001b724,0x0001b724,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 7 */
+  { /* version 7, passes 0 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009493,0x0000a49b,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x0000a493,0x0000a49b,0x000124db,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x000136e4},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0001249b,0x000126dc,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00001249,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000136e4,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000136e4,0x0001b725,0x0001b925},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x00009292,0x000124db,x+    0x000126dc,0x0001b724,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b724,0x0001c96e,0x0002496e},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x000136e4,0x0001b925,0x0001c96e,0x0002496e},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b724,0x0002496d,0x00025bb6,0x00025bbf},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 7, passes 1 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x00009493,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x000124db,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000124db,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x000124db,0x000136e4,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x000124db,0x000136e4,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000124db,0x000136e4,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x000136e4,0x0001b724,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00012492,0x000126db,x+    0x0001b724,0x0001b925,0x0001b725,0x000136e4},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 8 */
+  { /* version 8, passes 0 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009292,0x00009493,0x0000a49b,0x000124db},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x0000a493,0x000124db,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x000136e4},x+   {0x00000000,0x00000000,0x00001249,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000136e4,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000136e4,0x0001b725,0x0001b925},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b92d,0x0001c92d},x+   {0x00000000,0x00000000,0x00009252,0x000124db,x+    0x000126dc,0x0001b724,0x0001b92d,0x0001c92d},x+   {0x00000000,0x00000000,0x00009292,0x000124db,x+    0x000126dc,0x0001b925,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b925,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b925,0x00024b76,0x00024b77},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x000136e4,0x0001b925,0x00024b76,0x00025bbf},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x000136e4,0x0001c92d,0x00024b76,0x00025bbf},x+   {0x00000000,0x00000000,0x00012492,0x000136db,x+    0x0001b724,0x00024b6d,0x0002ddb6,0x0002efff},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 8, passes 1 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009493,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x0000a493,0x0000a49b,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x000124db,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x000124db,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x000124db,0x000136e4,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000126dc,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x000136e4,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00009292,0x000124db,x+    0x000136e4,0x0001b724,0x0001b725,0x000136e4},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x000136e4,0x0001b925,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x000136e4,0x0001b925,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b724,0x0002496d,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 9 */
+  { /* version 9, passes 0 */
+   {0x00000000,0x00000000,0x00000049,0x00000049,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00000249,0x00000049,x+    0x00000249,0x00000249,0x0000024a,0x00000049},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x0000124a,0x00009252,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009493,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009292,0x00009493,0x00009493,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000124db,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0001249b,0x000126dc,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00009252,0x00009493,x+    0x000124db,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009252,0x0000a49b,x+    0x000124db,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00009492,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x000136e4,0x0001b925,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },
+  { /* version 9, passes 1 */
+   {0x00000000,0x00000000,0x00000249,0x00000049,x+    0x00000009,0x00000009,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000049,0x00000049,0x00000009,0x00000009},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x00000249,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x0000124a,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009252,0x0000124a,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x00009252,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x00009292,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x00009292,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x00009493,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000124db,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009252,0x000124db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 10 */
+  { /* version 10, passes 0 */
+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00000249,0x00001249,x+    0x00009252,0x00009292,0x00009292,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x00009493,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x000124db,0x000124db,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000124db,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0001249b,0x000126dc,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000126dc,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009252,0x0000a49b,x+    0x000124db,0x000136e4,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x00009492,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b92d,0x0001b724},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000126dc,0x0001b925,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x000136e4,0x0002496d,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 10, passes 1 */
+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000049,0x00000049,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x00000249,0x00000049,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x00009252,0x0000024a,0x00000049},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009493,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00009252,x+    0x00009492,0x00009493,0x00001252,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x00009493,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x00009492,0x00009493,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x00009493,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009252,0x000126db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 11 */
+  { /* version 11, passes 0 */
+   {0x00000000,0x00000000,0x00000249,0x00000249,x+    0x00000249,0x00000249,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009492,0x0000a49b,0x0000a49b,0x00009292},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x0000a49b,0x000124db,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000126dc,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b725,0x000136e4},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000136e4,0x0001b724,0x0001b92d,0x0001b724},x+   {0x00000000,0x00000000,0x00009492,0x0000a49b,x+    0x000136e4,0x0001b724,0x0001b92d,0x0001b724},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b925,0x0001c96e,0x0001b925},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x0001b724,0x0001b925,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001c924,0x0002496d,0x00025bb6,0x00024b77},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 11, passes 1 */
+   {0x00000000,0x00000000,0x00001249,0x00000249,x+    0x00000249,0x00000249,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009252,0x00009252,0x0000024a,0x0000024a},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x0000a49b,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x0000a49b,0x00009292,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000124db,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000124db,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x000126dc,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009292,0x000124db,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 12 */
+  { /* version 12, passes 0 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x0000a493,0x0000a49b,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x000126dc,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000136e4,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b725,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000136e4,0x0001b724,0x0001b92d,0x000136e4},x+   {0x00000000,0x00000000,0x00009492,0x0000a49b,x+    0x000136e4,0x0001b724,0x0001b92d,0x0001b724},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b724,0x0001b92d,0x0001b724},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b925,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x0001b724,0x0001b925,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x0001b724,0x0001c92d,0x0001c96e,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x0001b724,0x0001c92d,0x00024b76,0x0002496e},x+   {0x00000000,0x00000000,0x00012492,0x000126db,x+    0x0001c924,0x00024b6d,0x0002ddb6,0x00025bbf},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 12, passes 1 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x00001249,0x00009292,x+    0x00009492,0x00009252,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x00009292,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x0000a49b,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000124db,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000124db,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x000126dc,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x000136e4,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00009492,0x000126db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001c924,0x0001b724,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 13 */
+  { /* version 13, passes 0 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x00009252,0x00009292,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x000124db,0x000126dc,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x0000a49b,x+    0x0001249b,0x000126dc,0x000126dc,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x000136e4,0x0001b725,0x000124db},x+   {0x00000000,0x00000000,0x00009292,0x0000a49b,x+    0x000136e4,0x0001b724,0x0001b725,0x000126dc},x+   {0x00000000,0x00000000,0x00009292,0x000124db,x+    0x000136e4,0x0001b724,0x0001b725,0x000126dc},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b724,0x0001c96e,0x000136e4},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001c92d,0x0001c96e,0x0001b724},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x000136e4,0x0001c92d,0x0001c96e,0x0001b724},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x0001b724,0x0001c92d,0x0001c96e,0x0001b925},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001b724,0x0001c92d,0x00024b76,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001b924,0x0001c92d,0x00024b76,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001b924,0x0001c92d,0x00024b76,0x0002496e},x+   {0x00000000,0x00000000,0x00012492,0x000136db,x+    0x00024924,0x00024b6d,0x0002ddb6,0x00025bbf},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 13, passes 1 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x00009492,0x00009292,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x0000a49b,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x000124db,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000136db,x+    0x0001b724,0x000124db,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000136db,x+    0x0001b724,0x000126dc,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00009292,0x000136db,x+    0x0001b724,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x00009492,0x000136db,x+    0x0001b724,0x000126dc,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00012492,0x0001b6db,x+    0x0001c924,0x0001b724,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 14 */
+  { /* version 14, passes 0 */
+   {0x00000000,0x00000000,0x00001249,0x0000924a,x+    0x00009292,0x00009493,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00001249,0x0000a49b,x+    0x0000a493,0x000124db,0x000126dc,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x0000a49b},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x000136e4,0x0001b725,0x000124db},x+   {0x00000000,0x00000000,0x00009292,0x000124db,x+    0x000126dc,0x0001b724,0x0001b92d,0x000126dc},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b724,0x0001b92d,0x000126dc},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001c92d,0x0001c96e,0x000136e4},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x0001b724,0x0001c92d,0x0001c96e,0x0001b724},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x0001b724,0x0001c92d,0x00024b76,0x0001b925},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001b724,0x0001c92d,0x00024b76,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001b724,0x0001c92d,0x00024b76,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b724,0x0001c92d,0x00024b76,0x0002496e},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b924,0x0002496d,0x00024b76,0x00024b77},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b924,0x00024b6d,0x0002ddb6,0x00025bbf},x+   {0x00000000,0x00000000,0x00012492,0x0001b6db,x+    0x00024924,0x0002db6d,0x00036db6,0x0002efff},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 14, passes 1 */
+   {0x00000000,0x00000000,0x00001249,0x00001249,x+    0x0000124a,0x0000124a,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x00009493,x+    0x0000a493,0x00009292,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x0000a49b,0x00001252,0x00001252},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000136e4,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000136e4,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x000136e4,0x00009493,0x00009292},x+   {0x00000000,0x00000000,0x00009492,0x000136db,x+    0x0001b724,0x000136e4,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x00009492,0x000136db,x+    0x0001b724,0x000136e4,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x00009492,0x000136db,x+    0x0001b724,0x000136e4,0x0000a49b,0x00009493},x+   {0x00000000,0x00000000,0x00009492,0x000136db,x+    0x0001b724,0x000136e4,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b724,0x000136e4,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b724,0x000136e4,0x000124db,0x0000a49b},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b724,0x000136e4,0x000126dc,0x000124db},x+   {0x00000000,0x00000000,0x00012492,0x0001b6db,x+    0x0001c924,0x0001b724,0x000136e4,0x000126dc},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ },x+ { /* version 15 */
+  { /* version 15, passes 0 */
+   {0x00000000,0x00000000,0x00001249,0x00009493,x+    0x0000a493,0x0000a49b,0x000124db,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0001249b,0x000126dc,0x000136e4,0x000124db},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x000126dc,0x0001b724,0x0001b725,0x000126dc},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x0001b724,0x0001b92d,0x000126dc},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x000136e4,0x0001b925,0x0001c96e,0x000136e4},x+   {0x00000000,0x00000000,0x00009492,0x000124db,x+    0x0001b724,0x0001c92d,0x0001c96e,0x0001b724},x+   {0x00000000,0x00000000,0x0000a492,0x000124db,x+    0x0001b724,0x0001c92d,0x0001c96e,0x0001b724},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001b724,0x0001c92d,0x0001c96e,0x0001b925},x+   {0x00000000,0x00000000,0x0000a492,0x000126db,x+    0x0001b924,0x0001c92d,0x00024b76,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b924,0x0001c92d,0x00024b76,0x0001c92d},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001b924,0x0002496d,0x00024b76,0x0002496e},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001c924,0x0002496d,0x00025bb6,0x00024b77},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001c924,0x00024b6d,0x00025bb6,0x00024b77},x+   {0x00000000,0x00000000,0x00012492,0x000136db,x+    0x0001c924,0x00024b6d,0x0002ddb6,0x00025bbf},x+   {0x00000000,0x00000000,0x00012492,0x0001b6db,x+    0x00024924,0x0002db6d,0x00036db6,0x0002efff},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  },x+  { /* version 15, passes 1 */
+   {0x00000000,0x00000000,0x0000924a,0x0000924a,x+    0x00009292,0x00009292,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x0000a49b,x+    0x0000a493,0x000124db,0x00009292,0x00009292},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000124db,0x0001b724,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000126dc,0x0001b724,0x00009493,0x00009493},x+   {0x00000000,0x00000000,0x0000924a,0x000124db,x+    0x000136e4,0x0001b724,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00009292,0x000136db,x+    0x0001b724,0x0001b724,0x0000a49b,0x0000a49b},x+   {0x00000000,0x00000000,0x00009492,0x000136db,x+    0x0001c924,0x0001b724,0x000124db,0x000124db},x+   {0x00000000,0x00000000,0x00009492,0x000136db,x+    0x0001c924,0x0001b724,0x000124db,0x000124db},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001c924,0x0001b724,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001c924,0x0001b925,0x000126dc,0x000126dc},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001c924,0x0001b925,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001c924,0x0001b925,0x000136e4,0x000136e4},x+   {0x00000000,0x00000000,0x0000a492,0x000136db,x+    0x0001c924,0x0001b925,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x00012492,0x000136db,x+    0x0001c924,0x0001b925,0x0001b725,0x0001b724},x+   {0x00000000,0x00000000,0x00012492,0x0001b6db,x+    0x00024924,0x0002496d,0x0001b92d,0x0001b925},x+   {0x00000000,0x00000000,0x00000000,0x00000000,x+    0x00000000,0x00000000,0x00000000,0x00000000}x+  }x+ }
+};
diff -Nru a/drivers/usb/media/pwc/pwc-timon.h b/drivers/usb/media/pwc/pwc-timon.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-timon.h	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,61 @@
+/* Linux driver for Philips webcamx+   (C) 2004      Luc Saillard (luc@saillard.org)
+x+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwxx+   driver and thus may have bugs that are not present in the original version.x+   Please send bug reports and support requests to <luc@saillard.org>.x+   The decompression routines have been implemented by reverse-engineering thex+   Nemosoft binary pwcx module. Caveat emptor.
+x+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, orx+   (at your option) any later version.
+x+   This program is distributed in the hope that it will be useful,x+   but WITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thex+   GNU General Public License for more details.
+x+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+
+
+/* This tables contains entries for the 675/680/690 (Timon) camera, withx+   4 different qualities (no compression, low, medium, high).x+   It lists the bandwidth requirements for said mode by its alternate interfacex+   number. An alternate of 0 means that the mode is unavailable.
+x+   There are 6 * 4 * 4 entries:x+     6 different resolutions subqcif, qsif, qcif, sif, cif, vgax+     6 framerates: 5, 10, 15, 20, 25, 30x+     4 compression modi: none, low, medium, high
+x+   When an uncompressed mode is not available, the next available compressed modex+   will be chosen (unless the decompressor is absent). Sometimes there are onlyx+   1 or 2 compressed modes available; in that case entries are duplicated.
+*/
+
+#ifndef PWC_TIMON_H
+#define PWC_TIMON_H
+
+#include "pwc-ioctl.h"
+
+struct Timon_table_entryx+{
+	char alternate;			/* USB alternate interface */
+	unsigned short packetsize;	/* Normal packet size */
+	unsigned short bandlength;	/* Bandlength when decompressing */
+	unsigned char mode[13];		/* precomputed mode settings for cam */
+};
+
+const extern struct Timon_table_entry Timon_table[PSZ_MAX][6][4];
+const extern unsigned int TimonRomTable [16][2][16][8];
+
+
+#endif
+
+
diff -Nru a/drivers/usb/media/pwc/pwc-uncompress.c b/drivers/usb/media/pwc/pwc-uncompress.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-uncompress.c	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,147 @@
+/* Linux driver for Philips webcamx+   Decompression frontend.x+   (C) 1999-2003 Nemosoft Unv.x+   (C) 2004      Luc Saillard (luc@saillard.org)
+x+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwxx+   driver and thus may have bugs that are not present in the original version.x+   Please send bug reports and support requests to <luc@saillard.org>.x+   The decompression routines have been implemented by reverse-engineering thex+   Nemosoft binary pwcx module. Caveat emptor.
+x+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, orx+   (at your option) any later version.
+x+   This program is distributed in the hope that it will be useful,x+   but WITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thex+   GNU General Public License for more details.
+x+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#include <asm/current.h>
+#include <asm/types.h>
+
+#include "pwc.h"
+#include "pwc-uncompress.h"
+#include "pwc-dec1.h"
+#include "pwc-dec23.h"
+
+int pwc_decompress(struct pwc_device *pdev)x+{
+	struct pwc_frame_buf *fbuf;
+	int n, line, col, stride;
+	void *yuv, *image;
+	u16 *src;
+	u16 *dsty, *dstu, *dstv;
+
+	if (pdev == NULL)x+		return -EFAULT;
+#if defined(__KERNEL__) && defined(PWC_MAGIC)
+	if (pdev->magic != PWC_MAGIC) {
+		Err("pwc_decompress(): magic failed.\n");x+		return -EFAULT;
+	}
+#endif
+
+	fbuf = pdev->read_frame;
+	if (fbuf == NULL)x+		return -EFAULT;
+	image = pdev->image_ptr[pdev->fill_image];
+	if (!image)x+		return -EFAULT;
+x+	yuv = fbuf->data + pdev->frame_header_size;  /* Skip header */
+
+	/* Raw format; that's easy... */
+	if (pdev->vpalette == VIDEO_PALETTE_RAW)x+	{
+		memcpy(image, yuv, pdev->frame_size);x+		return 0;
+	}
+
+	if (pdev->vbandlength == 0) {
+		/* Uncompressed mode. We copy the data into the output buffer,
+		   using the viewport size (which may be larger than the image
+		   size). Unfortunately we have to do a bit of byte stuffing
+		   to get the desired output format/size.
+		 */
+			/*
+			 * We do some byte shuffling here to go from thex+			 * native format to YUV420P.x+			 */
+			src = (u16 *)yuv;x+			n = pdev->view.x * pdev->view.y;
+x+			/* offset in Y plane */
+			stride = pdev->view.x * pdev->offset.y + pdev->offset.x;x+			dsty = (u16 *)(image + stride);
+x+			/* offsets in U/V planes */
+			stride = pdev->view.x * pdev->offset.y / 4 + pdev->offset.x / 2;x+			dstu = (u16 *)(image + n +         stride);
+			dstv = (u16 *)(image + n + n / 4 + stride);
+x+			/* increment after each line */
+			stride = (pdev->view.x - pdev->image.x) / 2; /* u16 is 2 bytes */
+
+			for (line = 0; line < pdev->image.y; line++) {
+				for (col = 0; col < pdev->image.x; col += 4) {
+					*dsty++ = *src++;
+					*dsty++ = *src++;
+					if (line & 1)
+						*dstv++ = *src++;
+					else
+						*dstu++ = *src++;
+				}
+				dsty += stride;
+				if (line & 1)
+					dstv += (stride >> 1);
+				else
+					dstu += (stride >> 1);
+			}
+	}
+	else {
+		/* Compressed; the decompressor routines will write the data
+		   in planar format immediately.
+		 */
+		int flags;
+                
+                flags = PWCX_FLAG_PLANAR;
+                if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot)
+		 {
+		   printk(KERN_ERR "pwc: Mode Bayer is not supported for now\n");x+		   flags |= PWCX_FLAG_BAYER;x+		   return -ENXIO; /* No such device or address: missing decompressor */
+		 }
+
+		switch (pdev->type)
+		 {
+		  case 675:
+		  case 680:
+		  case 690:
+		  case 720:
+		  case 730:
+		  case 740:
+		  case 750:
+		    pwc_dec23_decompress(&pdev->image, &pdev->view, &pdev->offset,
+				yuv, image,
+				flags,
+				pdev->decompress_data, pdev->vbandlength);x+		    break;
+		  case 645:
+		  case 646:
+		    /* TODO & FIXME */
+		    return -ENXIO; /* No such device or address: missing decompressor */
+		    break;
+		 }
+	}
+	return 0;
+}
+
+
diff -Nru a/drivers/usb/media/pwc/pwc-uncompress.h b/drivers/usb/media/pwc/pwc-uncompress.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc-uncompress.h	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,41 @@
+/* (C) 1999-2003 Nemosoft Unv.x+   (C) 2004      Luc Saillard (luc@saillard.org)
+x+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwxx+   driver and thus may have bugs that are not present in the original version.x+   Please send bug reports and support requests to <luc@saillard.org>.x+   The decompression routines have been implemented by reverse-engineering thex+   Nemosoft binary pwcx module. Caveat emptor.
+x+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, orx+   (at your option) any later version.
+x+   This program is distributed in the hope that it will be useful,x+   but WITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thex+   GNU General Public License for more details.
+x+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+/* This file is the bridge between the kernel module and the plugin; itx+   describes the structures and datatypes used in both modules. Anyx+   significant change should be reflected by increasing the x+   pwc_decompressor_version major number.x+ */
+#ifndef PWC_UNCOMPRESS_H
+#define PWC_UNCOMPRESS_H
+
+#include <linux/config.h>
+
+#include "pwc-ioctl.h"
+
+/* from pwc-dec.h */
+#define PWCX_FLAG_PLANAR        0x0001
+/* */
+
+#endif
diff -Nru a/drivers/usb/media/pwc/pwc.h b/drivers/usb/media/pwc/pwc.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/media/pwc/pwc.h	2005-03-05 07:26:35 -08:00
@@ -0,0 +1,278 @@
+/* (C) 1999-2003 Nemosoft Unv.x+   (C) 2004      Luc Saillard (luc@saillard.org)
+x+   NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwxx+   driver and thus may have bugs that are not present in the original version.x+   Please send bug reports and support requests to <luc@saillard.org>.x+   The decompression routines have been implemented by reverse-engineering thex+   Nemosoft binary pwcx module. Caveat emptor.
+x+   This program is free software; you can redistribute it and/or modifyx+   it under the terms of the GNU General Public License as published byx+   the Free Software Foundation; either version 2 of the License, orx+   (at your option) any later version.
+x+   This program is distributed in the hope that it will be useful,x+   but WITHOUT ANY WARRANTY; without even the implied warranty ofx+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See thex+   GNU General Public License for more details.
+x+   You should have received a copy of the GNU General Public Licensex+   along with this program; if not, write to the Free Softwarex+   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+#ifndef PWC_H
+#define PWC_H
+
+#include <linux/version.h>
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/usb.h>
+#include <linux/spinlock.h>
+#include <linux/videodev.h>
+#include <linux/wait.h>
+#include <linux/smp_lock.h>
+#include <asm/semaphore.h>
+#include <asm/errno.h>
+
+#include "pwc-uncompress.h"
+#include "pwc-ioctl.h"
+
+/* Defines and structures for the Philips webcam */
+/* Used for checking memory corruption/pointer validation */
+#define PWC_MAGIC 0x89DC10ABUL
+#undef PWC_MAGIC
+
+/* Turn some debugging options on/off */
+#define PWC_DEBUG 0
+
+/* Trace certain actions in the driver */
+#define TRACE_MODULE	0x0001
+#define TRACE_PROBE	0x0002
+#define TRACE_OPEN	0x0004
+#define TRACE_READ	0x0008
+#define TRACE_MEMORY	0x0010
+#define TRACE_FLOW	0x0020
+#define TRACE_SIZE	0x0040
+#define TRACE_PWCX	0x0080
+#define TRACE_SEQUENCE	0x1000
+
+#define Trace(R, A...) if (pwc_trace & R) printk(KERN_DEBUG PWC_NAME " " A)
+#define Debug(A...) printk(KERN_DEBUG PWC_NAME " " A)
+#define Info(A...)  printk(KERN_INFO  PWC_NAME " " A)
+#define Err(A...)   printk(KERN_ERR   PWC_NAME " " A)
+
+
+/* Defines for ToUCam cameras */
+#define TOUCAM_HEADER_SIZE		8
+#define TOUCAM_TRAILER_SIZE		4
+
+#define FEATURE_MOTOR_PANTILT		0x0001
+
+/* Version block */
+#define PWC_MAJOR	9
+#define PWC_MINOR	0
+#define PWC_VERSION 	"9.0.2-unofficial"
+#define PWC_NAME 	"pwc"
+
+/* Turn certain features on/off */
+#define PWC_INT_PIPE 0
+
+/* Ignore errors in the first N frames, to allow for startup delays */
+#define FRAME_LOWMARK 5
+
+/* Size and number of buffers for the ISO pipe. */
+#define MAX_ISO_BUFS		2
+#define ISO_FRAMES_PER_DESC	10
+#define ISO_MAX_FRAME_SIZE	960
+#define ISO_BUFFER_SIZE 	(ISO_FRAMES_PER_DESC * ISO_MAX_FRAME_SIZE)
+
+/* Frame buffers: contains compressed or uncompressed video data. */
+#define MAX_FRAMES		5
+/* Maximum size after decompression is 640x480 YUV data, 1.5 * 640 * 480 */
+#define PWC_FRAME_SIZE 		(460800 + TOUCAM_HEADER_SIZE + TOUCAM_TRAILER_SIZE)
+
+/* Absolute maximum number of buffers available for mmap() */
+#define MAX_IMAGES 		10
+
+/* The following structures were based on cpia.h. Why reinvent the wheel? :-) */
+struct pwc_iso_bufx+{
+	void *data;
+	int  length;
+	int  read;
+	struct urb *urb;
+};
+
+/* intermediate buffers with raw data from the USB cam */
+struct pwc_frame_bufx+{
+   void *data;
+   volatile int filled;		/* number of bytes filled */
+   struct pwc_frame_buf *next;	/* list */
+#if PWC_DEBUGx+   int sequence;		/* Sequence number */
+#endif
+};
+
+struct pwc_devicex+{
+   struct video_device *vdev;
+#ifdef PWC_MAGIC
+   int magic;
+#endif
+   /* Pointer to our usb_device */
+   struct usb_device *udev;
+   
+   int type;                    /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */
+   int release;			/* release number */
+   int features;		/* feature bits */
+   char serial[30];		/* serial number (string) */
+   int error_status;		/* set when something goes wrong with the cam (unplugged, USB errors) */
+   int usb_init;		/* set when the cam has been initialized over USB */
+
+   /*** Video data ***/
+   int vopen;			/* flag */
+   int vendpoint;		/* video isoc endpoint */
+   int vcinterface;		/* video control interface */
+   int valternate;		/* alternate interface needed */
+   int vframes, vsize;		/* frames-per-second & size (see PSZ_*) */
+   int vpalette;		/* palette: 420P, RAW or RGBBAYER */
+   int vframe_count;		/* received frames */
+   int vframes_dumped; 		/* counter for dumped frames */
+   int vframes_error;		/* frames received in error */
+   int vmax_packet_size;	/* USB maxpacket size */
+   int vlast_packet_size;	/* for frame synchronisation */
+   int visoc_errors;		/* number of contiguous ISOC errors */
+   int vcompression;		/* desired compression factor */
+   int vbandlength;		/* compressed band length; 0 is uncompressed */
+   char vsnapshot;		/* snapshot mode */
+   char vsync;			/* used by isoc handler */
+   char vmirror;		/* for ToUCaM series */
+   
+   int cmd_len;
+   unsigned char cmd_buf[13];
+
+   /* The image acquisition requires 3 to 4 steps:x+      1. data is gathered in short packets from the USB controllerx+      2. data is synchronized and packed into a frame bufferx+      3a. in case data is compressed, decompress it directly into image bufferx+      3b. in case data is uncompressed, copy into image buffer with viewportx+      4. data is transferred to the user process
+
+      Note that MAX_ISO_BUFS != MAX_FRAMES != MAX_IMAGES....
+      We have in effect a back-to-back-double-buffer system.
+    */
+   /* 1: isoc */
+   struct pwc_iso_buf sbuf[MAX_ISO_BUFS];
+   char iso_init;
+
+   /* 2: frame */
+   struct pwc_frame_buf *fbuf;	/* all frames */
+   struct pwc_frame_buf *empty_frames, *empty_frames_tail;	/* all empty frames */
+   struct pwc_frame_buf *full_frames, *full_frames_tail;	/* all filled frames */
+   struct pwc_frame_buf *fill_frame;	/* frame currently being filled */
+   struct pwc_frame_buf *read_frame;	/* frame currently read by user process */
+   int frame_header_size, frame_trailer_size;
+   int frame_size;
+   int frame_total_size; /* including header & trailer */
+   int drop_frames;
+#if PWC_DEBUGx+   int sequence;			/* Debugging aid */
+#endif
+
+   /* 3: decompression */
+   struct pwc_decompressor *decompressor;	/* function block with decompression routines */
+   void *decompress_data;		/* private data for decompression engine */
+
+   /* 4: image */
+   /* We have an 'image' and a 'view', where 'image' is the fixed-size image
+      as delivered by the camera, and 'view' is the size requested by the
+      program. The camera image is centered in this viewport, laced withx+      a gray or black border. view_min <= image <= view <= view_max;
+    */
+   int image_mask;			/* bitmask of supported sizes */
+   struct pwc_coord view_min, view_max;	/* minimum and maximum viewable sizes */
+   struct pwc_coord abs_max;            /* maximum supported size with compression */
+   struct pwc_coord image, view;	/* image and viewport size */
+   struct pwc_coord offset;		/* offset within the viewport */
+
+   void *image_data;			/* total buffer, which is subdivided into ... */
+   void *image_ptr[MAX_IMAGES];		/* ...several images... */
+   int fill_image;			/* ...which are rotated. */
+   int len_per_image;			/* length per image */
+   int image_read_pos;			/* In case we read data in pieces, keep track of were we are in the imagebuffer */
+   int image_used[MAX_IMAGES];		/* For MCAPTURE and SYNC */
+
+   struct semaphore modlock;		/* to prevent races in video_open(), etc */
+   spinlock_t ptrlock;			/* for manipulating the buffer pointers */
+
+   /*** motorized pan/tilt feature */
+   struct pwc_mpt_range angle_range;
+   int pan_angle;			/* in degrees * 100 */
+   int tilt_angle;			/* absolute angle; 0,0 is home position */
+
+   /*** Misc. data ***/
+   wait_queue_head_t frameq;		/* When waiting for a frame to finish... */
+#if PWC_INT_PIPE
+   void *usb_int_handler;		/* for the interrupt endpoint */
+#endif
+};
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Global variables */
+extern int pwc_trace;
+extern int pwc_preferred_compression;
+
+/** functions in pwc-if.c */
+int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_fps, int new_compression, int new_snapshot);
+
+/** Functions in pwc-misc.c */
+/* sizes in pixels */
+extern struct pwc_coord pwc_image_sizes[PSZ_MAX];
+
+int pwc_decode_size(struct pwc_device *pdev, int width, int height);
+void pwc_construct(struct pwc_device *pdev);
+
+/** Functions in pwc-ctrl.c */
+/* Request a certain video mode. Returns < 0 if not possible */
+extern int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot);
+/* Calculate the number of bytes per image (not frame) */
+extern void pwc_set_image_buffer_size(struct pwc_device *pdev);
+
+/* Various controls; should be obvious. Value 0..65535, or < 0 on error */
+extern int pwc_get_brightness(struct pwc_device *pdev);
+extern int pwc_set_brightness(struct pwc_device *pdev, int value);
+extern int pwc_get_contrast(struct pwc_device *pdev);
+extern int pwc_set_contrast(struct pwc_device *pdev, int value);
+extern int pwc_get_gamma(struct pwc_device *pdev);
+extern int pwc_set_gamma(struct pwc_device *pdev, int value);
+extern int pwc_get_saturation(struct pwc_device *pdev);
+extern int pwc_set_saturation(struct pwc_device *pdev, int value);
+extern int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value);
+extern int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value);
+extern int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor);
+
+/* Power down or up the camera; not supported by all models */
+extern int pwc_camera_power(struct pwc_device *pdev, int power);
+
+/* Private ioctl()s; see pwc-ioctl.h */
+extern int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg);
+
+
+/** pwc-uncompress.c */
+/* Expand frame to image, possibly including decompression. Uses read_frame and fill_image */
+extern int pwc_decompress(struct pwc_device *pdev);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff -Nru a/drivers/usb/media/se401.c b/drivers/usb/media/se401.c
--- a/drivers/usb/media/se401.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/media/se401.c	2005-03-07 20:47:20 -08:00
@@ -122,7 +122,7 @@
                 0,
                 cp,
                 size,
-                HZ
+                1000
         );
 }
 
@@ -142,7 +142,7 @@
 		selector,
                 NULL,
                 0,
-                HZ
+                1000
         );
 }
 
@@ -162,7 +162,7 @@
                 selector,
                 cp,
                 2,
-                HZ
+                1000
         );
 	return cp[0]+cp[1]*256;
 }
diff -Nru a/drivers/usb/media/sn9c102.h b/drivers/usb/media/sn9c102.h
--- a/drivers/usb/media/sn9c102.h	2005-01-14 16:01:37 -08:00
+++ b/drivers/usb/media/sn9c102.h	2005-03-07 20:47:16 -08:00
@@ -48,16 +48,16 @@
 #define SN9C102_ISO_PACKETS       7
 #define SN9C102_ALTERNATE_SETTING 8
 #define SN9C102_URB_TIMEOUT       msecs_to_jiffies(2 * SN9C102_ISO_PACKETS)
-#define SN9C102_CTRL_TIMEOUT      msecs_to_jiffies(300)
+#define SN9C102_CTRL_TIMEOUT      300
 
 /*****************************************************************************/
 
 #define SN9C102_MODULE_NAME     "V4L2 driver for SN9C10x PC Camera Controllers"
-#define SN9C102_MODULE_AUTHOR   "(C) 2004 Luca Risolia"
+#define SN9C102_MODULE_AUTHOR   "(C) 2004-2005 Luca Risolia"
 #define SN9C102_AUTHOR_EMAIL    "<luca.risolia@studio.unibo.it>"
 #define SN9C102_MODULE_LICENSE  "GPL"
-#define SN9C102_MODULE_VERSION  "1:1.22"
-#define SN9C102_MODULE_VERSION_CODE  KERNEL_VERSION(1, 0, 22)
+#define SN9C102_MODULE_VERSION  "1:1.24"
+#define SN9C102_MODULE_VERSION_CODE  KERNEL_VERSION(1, 0, 24)
 
 enum sn9c102_bridge {
 	BRIDGE_SN9C101 = 0x01,
diff -Nru a/drivers/usb/media/sn9c102_core.c b/drivers/usb/media/sn9c102_core.c
--- a/drivers/usb/media/sn9c102_core.c	2005-01-14 16:01:37 -08:00
+++ b/drivers/usb/media/sn9c102_core.c	2005-03-07 20:52:01 -08:00
@@ -164,8 +164,8 @@
 	struct v4l2_rect* r = &(cam->sensor->cropcap.bounds);
 	const size_t imagesize = cam->module_param.force_munmap ||
 	                         io == IO_READ ?
-	                         (p->width * p->height * p->priv)/8 :
-	                         (r->width * r->height * p->priv)/8;
+	                         (p->width * p->height * p->priv) / 8 :
+	                         (r->width * r->height * p->priv) / 8;
 	void* buff = NULL;
 	u32 i;
 
@@ -499,6 +499,7 @@
 {
 	struct sn9c102_device* cam = urb->context;
 	struct sn9c102_frame_t** f;
+	size_t imagesize;
 	unsigned long lock_flags;
 	u8 i;
 	int err = 0;
@@ -516,8 +517,13 @@
 		wake_up_interruptible(&cam->wait_stream);
 	}
 
-	if ((cam->state & DEV_DISCONNECTED)||(cam->state & DEV_MISCONFIGURED))
+	if (cam->state & DEV_DISCONNECTED)x+		return;
+
+	if (cam->state & DEV_MISCONFIGURED) {
+		wake_up_interruptible(&cam->wait_frame);
 		return;
+	}
 
 	if (cam->stream == STREAM_OFF || list_empty(&cam->inqueue))
 		goto resubmit_urb;
@@ -526,6 +532,10 @@
 		(*f) = list_entry(cam->inqueue.next, struct sn9c102_frame_t,
 		                  frame);
 
+	imagesize = (cam->sensor->pix_format.width *
+	             cam->sensor->pix_format.height *
+	             cam->sensor->pix_format.priv) / 8;
+
 	for (i = 0; i < urb->number_of_packets; i++) {
 		unsigned int img, len, status;
 		void *pos, *sof, *eof;
@@ -560,11 +570,10 @@
 				if (eof)
 					img = (eof > pos) ? eof - pos - 1 : 0;
 
-				if ((*f)->buf.bytesused+img>(*f)->buf.length) {
+				if ((*f)->buf.bytesused+img > imagesize) {
 					u32 b = (*f)->buf.bytesused + img -
-					        (*f)->buf.length;
-					img = (*f)->buf.length - 
-					      (*f)->buf.bytesused;
+					        imagesize;
+					img = imagesize - (*f)->buf.bytesused;
 					DBG(3, "Expected EOF not found: "
 					       "video frame cut")
 					if (eof)
@@ -580,7 +589,7 @@
 
 				(*f)->buf.bytesused += img;
 
-				if ((*f)->buf.bytesused == (*f)->buf.length ||
+				if ((*f)->buf.bytesused == imagesize ||
 				    (cam->sensor->pix_format.pixelformat ==
 				                V4L2_PIX_FMT_SN9C10X && eof)) {
 					u32 b = (*f)->buf.bytesused;
@@ -1558,7 +1567,8 @@
 		err = wait_event_interruptible
 		      ( cam->wait_frame, 
 		        (!list_empty(&cam->outqueue)) ||
-		        (cam->state & DEV_DISCONNECTED) );x+		        (cam->state & DEV_DISCONNECTED) ||
+			(cam->state & DEV_MISCONFIGURED) );
 		if (err) {
 			up(&cam->fileop_sem);
 			return err;
@@ -1567,6 +1577,10 @@
 			up(&cam->fileop_sem);
 			return -ENODEV;
 		}
+		if (cam->state & DEV_MISCONFIGURED) {
+			up(&cam->fileop_sem);
+			return -EIO;
+		}
 	}
 
 	f = list_entry(cam->outqueue.prev, struct sn9c102_frame_t, frame);
@@ -1615,7 +1629,8 @@
 	}
 
 	if (cam->io == IO_NONE) {
-		if (!sn9c102_request_buffers(cam, 2, IO_READ)) {
+		if (!sn9c102_request_buffers(cam, cam->nreadbuffers,x+		                             IO_READ)) {
 			DBG(1, "poll() failed, not enough memory")
 			goto error;
 		}
@@ -1729,7 +1744,7 @@
 }
 
 
-static int sn9c102_v4l2_ioctl(struct inode* inode, struct file* filp,
+static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp,
                               unsigned int cmd, void __user * arg)
 {
 	struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp));
@@ -1970,7 +1985,7 @@
 			return -EFAULT;
 		}
 
-		if (cam->module_param.force_munmap)
+		if (cam->module_param.force_munmap || cam->io == IO_READ)
 			sn9c102_release_buffers(cam);
 
 		err = sn9c102_set_crop(cam, rect);
@@ -1990,7 +2005,7 @@
 		s->pix_format.height = rect->height/scale;
 		memcpy(&(s->_rect), rect, sizeof(*rect));
 
-		if (cam->module_param.force_munmap &&
+		if ((cam->module_param.force_munmap || cam->io == IO_READ) &&
 		    nbuffers != sn9c102_request_buffers(cam, nbuffers,x 		                                        cam->io)) {
 			cam->state |= DEV_MISCONFIGURED;
@@ -2146,7 +2161,7 @@
 			return -EFAULT;
 		}
 
-		if (cam->module_param.force_munmap)
+		if (cam->module_param.force_munmap  || cam->io == IO_READ)
 			sn9c102_release_buffers(cam);
 
 		err += sn9c102_set_pix_format(cam, pix);
@@ -2168,7 +2183,7 @@
 		memcpy(pfmt, pix, sizeof(*pix));
 		memcpy(&(s->_rect), &rect, sizeof(rect));
 
-		if (cam->module_param.force_munmap &&
+		if ((cam->module_param.force_munmap  || cam->io == IO_READ) &&
 		    nbuffers != sn9c102_request_buffers(cam, nbuffers,x 		                                        cam->io)) {
 			cam->state |= DEV_MISCONFIGURED;
@@ -2346,11 +2361,14 @@
 			err = wait_event_interruptible
 			      ( cam->wait_frame, 
 			        (!list_empty(&cam->outqueue)) ||
-			        (cam->state & DEV_DISCONNECTED) );x+			        (cam->state & DEV_DISCONNECTED) ||
+			        (cam->state & DEV_MISCONFIGURED) );
 			if (err)
 				return err;
 			if (cam->state & DEV_DISCONNECTED)x 				return -ENODEV;
+			if (cam->state & DEV_MISCONFIGURED)
+				return -EIO;
 		}
 
 		spin_lock_irqsave(&cam->queue_lock, lock_flags);
@@ -2495,7 +2513,7 @@
 		return -EIO;
 	}
 
-	err = sn9c102_v4l2_ioctl(inode, filp, cmd, (void __user *)arg);
+	err = sn9c102_ioctl_v4l2(inode, filp, cmd, (void __user *)arg);
 
 	up(&cam->fileop_sem);
 
diff -Nru a/drivers/usb/media/ultracam.c b/drivers/usb/media/ultracam.c
--- a/drivers/usb/media/ultracam.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/usb/media/ultracam.c	2005-03-07 20:47:12 -08:00
@@ -155,7 +155,7 @@
 			index,
 			cp,
 			sizeof(cp),
-			HZ);x+			1000);
 #if 1
 		info("USB => %02x%02x%02x%02x%02x%02x%02x%02x "
 		       "(req=$%02x val=$%04x ind=$%04x)",
@@ -172,7 +172,7 @@
 			index,
 			NULL,
 			0,
-			HZ);x+			1000);
 	}
 	if (i < 0) {
 		err("%s: ERROR=%d. Camera stopped; Reconnect or reload driver.",
diff -Nru a/drivers/usb/media/vicam.c b/drivers/usb/media/vicam.c
--- a/drivers/usb/media/vicam.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/media/vicam.c	2005-03-07 20:47:08 -08:00
@@ -441,7 +441,7 @@
 				 request,
 				 USB_DIR_OUT | USB_TYPE_VENDOR |
 				 USB_RECIP_DEVICE, value, index,
-				 cp, size, HZ);x+				 cp, size, 1000);
 
 	status = min(status, 0);
 
@@ -977,7 +977,7 @@
 	n = usb_bulk_msg(cam->udev,
 			 usb_rcvbulkpipe(cam->udev, cam->bulkEndpoint),
 			 cam->raw_image,
-			 512 * 242 + 128, &actual_length, HZ*10);x+			 512 * 242 + 128, &actual_length, 10000);
 
 	if (n < 0) {
 		printk(KERN_ERR "Problem during bulk read of frame data: %d\n",
diff -Nru a/drivers/usb/media/w9968cf.h b/drivers/usb/media/w9968cf.h
--- a/drivers/usb/media/w9968cf.h	2004-10-08 06:03:21 -07:00
+++ b/drivers/usb/media/w9968cf.h	2005-03-07 20:46:59 -08:00
@@ -65,7 +65,7 @@
 #define W9968CF_PACKET_SIZE      1023 /* according to wMaxPacketSizes[] */
 #define W9968CF_MIN_PACKET_SIZE  63 /* minimum value */
 #define W9968CF_ISO_PACKETS      5 /* n.of packets for isochronous transfers */
-#define W9968CF_USB_CTRL_TIMEOUT HZ /* timeout for usb control commands */
+#define W9968CF_USB_CTRL_TIMEOUT 1000 /* timeout (ms) for usb control commands */
 #define W9968CF_URBS             2 /* n. of scheduled URBs for ISO transfer */
 
 #define W9968CF_I2C_BUS_DELAY    4 /* delay in us for I2C bit r/w operations */
diff -Nru a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
--- a/drivers/usb/misc/Kconfig	2005-01-17 12:20:05 -08:00
+++ b/drivers/usb/misc/Kconfig	2005-03-07 20:52:22 -08:00
@@ -137,6 +137,8 @@
 
 	  See also <http://www.fs.tum.de/~echtler/idmouse/>.
 
+source "drivers/usb/misc/sisusbvga/Kconfig"
+
 config USB_TEST
 	tristate "USB testing driver (DEVELOPMENT)"
 	depends on USB && USB_DEVICEFS && EXPERIMENTAL
diff -Nru a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
--- a/drivers/usb/misc/Makefile	2005-01-14 16:01:13 -08:00
+++ b/drivers/usb/misc/Makefile	2005-03-07 20:52:22 -08:00
@@ -16,3 +16,5 @@
 obj-$(CONFIG_USB_RIO500)	+= rio500.o
 obj-$(CONFIG_USB_TEST)		+= usbtest.o
 obj-$(CONFIG_USB_USS720)	+= uss720.o
+
+obj-$(CONFIG_USB_SISUSBVGA)	+= sisusbvga/
\ No newline at end of file
diff -Nru a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c
--- a/drivers/usb/misc/auerswald.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/usb/misc/auerswald.c	2005-03-07 20:47:04 -08:00
@@ -29,6 +29,7 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/wait.h>
 #undef DEBUG   		/* include debug macros until it's done	*/
 #include <linux/usb.h>
 
@@ -605,7 +606,6 @@
 /* Starts chained urb and waits for completion or timeout */
 static int auerchain_start_wait_urb (pauerchain_t acp, struct urb *urb, int timeout, int* actual_length)
 {
-	DECLARE_WAITQUEUE (wait, current);
 	auerchain_chs_t chs;
 	int status;
 
@@ -613,26 +613,13 @@
 	init_waitqueue_head (&chs.wqh);
 	chs.done = 0;
 
-	set_current_state (TASK_UNINTERRUPTIBLE);
-	add_wait_queue (&chs.wqh, &wait);
 	urb->context = &chs;
 	status = auerchain_submit_urb (acp, urb);
-	if (status) {
+	if (status)
 		/* something went wrong */
-		set_current_state (TASK_RUNNING);
-		remove_wait_queue (&chs.wqh, &wait);
 		return status;
-	}
-
-	while (timeout && !chs.done)
-	{
-		timeout = schedule_timeout (timeout);
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		rmb();
-	}
 
-	set_current_state (TASK_RUNNING);
-	remove_wait_queue (&chs.wqh, &wait);
+	timeout = wait_event_timeout(chs.wqh, chs.done, timeout);
 
 	if (!timeout && !chs.done) {
 		if (urb->status != -EINPROGRESS) {	/* No callback?!! */
@@ -2009,7 +1996,7 @@
                 AUDI_MBCTRANS,                      /* USB message index value */
                 pbuf,                               /* pointer to the receive buffer */
                 2,                                  /* length of the buffer */
-                HZ * 2);                            /* time to wait for the message to complete before timing out */
+                2000);                            /* time to wait for the message to complete before timing out */
         if (ret == 2) {
 	        cp->maxControlLength = le16_to_cpup(pbuf);
                 kfree(pbuf);
diff -Nru a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c
--- a/drivers/usb/misc/cytherm.c	2004-05-15 10:38:03 -07:00
+++ b/drivers/usb/misc/cytherm.c	2005-03-07 20:47:58 -08:00
@@ -77,7 +77,7 @@
 			       USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_OTHER,
 			       value, 
 			       index, buf, size,
-			       HZ * USB_CTRL_GET_TIMEOUT);x+			       USB_CTRL_GET_TIMEOUT);x }
 
 
diff -Nru a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
--- a/drivers/usb/misc/idmouse.c	2005-01-30 22:33:46 -08:00
+++ b/drivers/usb/misc/idmouse.c	2005-03-07 20:46:55 -08:00
@@ -124,28 +124,28 @@
 	   means init..
 	*/
 	result = usb_control_msg (dev->udev, usb_sndctrlpipe (dev->udev, 0),
-				0x21, 0x42, 0x0001, 0x0002, NULL, 0, HZ);x+				0x21, 0x42, 0x0001, 0x0002, NULL, 0, 1000);
 	if (result < 0)
 		return result;
 	result = usb_control_msg (dev->udev, usb_sndctrlpipe (dev->udev, 0),
-				0x20, 0x42, 0x0001, 0x0002, NULL, 0, HZ);x+				0x20, 0x42, 0x0001, 0x0002, NULL, 0, 1000);
 	if (result < 0)
 		return result;
 	result = usb_control_msg (dev->udev, usb_sndctrlpipe (dev->udev, 0),
-				0x22, 0x42, 0x0000, 0x0002, NULL, 0, HZ);x+				0x22, 0x42, 0x0000, 0x0002, NULL, 0, 1000);
 	if (result < 0)
 		return result;
 
 	result = usb_control_msg (dev->udev, usb_sndctrlpipe (dev->udev, 0),
-				0x21, 0x42, 0x0001, 0x0002, NULL, 0, HZ);x+				0x21, 0x42, 0x0001, 0x0002, NULL, 0, 1000);
 	if (result < 0)
 		return result;
 	result = usb_control_msg (dev->udev, usb_sndctrlpipe (dev->udev, 0),
-				0x20, 0x42, 0x0001, 0x0002, NULL, 0, HZ);x+				0x20, 0x42, 0x0001, 0x0002, NULL, 0, 1000);
 	if (result < 0)
 		return result;
 	result = usb_control_msg (dev->udev, usb_sndctrlpipe (dev->udev, 0),
-				0x20, 0x42, 0x0000, 0x0002, NULL, 0, HZ);x+				0x20, 0x42, 0x0000, 0x0002, NULL, 0, 1000);
 	if (result < 0)
 		return result;
 
@@ -154,7 +154,7 @@
 		result = usb_bulk_msg (dev->udev,
 				usb_rcvbulkpipe (dev->udev, dev->bulk_in_endpointAddr),
 				dev->bulk_in_buffer + bytes_read,
-				dev->bulk_in_size, &bulk_read, HZ * 5);x+				dev->bulk_in_size, &bulk_read, 5000);
 		if (result < 0)
 			return result;
 		if (signal_pending(current))
@@ -164,7 +164,7 @@
 
 	/* reset the device */
 	result = usb_control_msg (dev->udev, usb_sndctrlpipe (dev->udev, 0),
-				0x22, 0x42, 0x0000, 0x0002, NULL, 0, HZ);x+				0x22, 0x42, 0x0000, 0x0002, NULL, 0, 1000);
 	if (result < 0)
 		return result;
 
diff -Nru a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
--- a/drivers/usb/misc/legousbtower.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/usb/misc/legousbtower.c	2005-03-07 20:46:51 -08:00
@@ -391,7 +391,7 @@
 				  0,
 				  &reset_reply,
 				  sizeof(reset_reply),
-				  HZ);x+				  1000);
 	if (result < 0) {
 		err("LEGO USB Tower reset control request failed");
 		retval = result;
@@ -972,7 +972,7 @@
 				  0,
 				  &get_version_reply,
 				  sizeof(get_version_reply),
-				  HZ);x+				  1000);
 	if (result < 0) {
 		err("LEGO USB Tower get version control request failed");
 		retval = result;
diff -Nru a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c
--- a/drivers/usb/misc/phidgetkit.c	2004-10-20 15:29:55 -07:00
+++ b/drivers/usb/misc/phidgetkit.c	2005-03-07 20:41:42 -08:00
@@ -103,14 +103,15 @@
 		}
 	}
 
-	dev_dbg(&kit->udev->dev, "data: %02x %02x\n", buffer[0], buffer[1]);x+	dev_dbg(&kit->udev->dev, "sending data: %02x\n", buffer[0]);
 
 	retval = usb_control_msg(kit->udev,
 			 usb_sndctrlpipe(kit->udev, 0),
-			 0x09, 0x21, 0x0200, 0x0000, buffer, 4, 2 * HZ);x+			 0x09, 0x21, 0x0200, 0x0000, buffer, 4, 2000);
 
 	if (retval != 4)
-		dev_err(&kit->udev->dev, "retval = %d\n", retval);x+		dev_err(&kit->udev->dev, "usb_control_msg returned %d\n", 
+				retval);x 	kfree(buffer);
 
 	return retval < 0 ? retval : 0;
@@ -158,7 +159,7 @@
 
 		retval = usb_control_msg(kit->udev,
 				 usb_sndctrlpipe(kit->udev, 0),
-				 0x09, 0x21, 0x0200, 0x0000, buffer, 8, 2 * HZ);x+				 0x09, 0x21, 0x0200, 0x0000, buffer, 8, 2000);
 		if (retval < 0)
 			goto exit;
 	}
@@ -210,7 +211,7 @@
 	
 	retval = usb_control_msg(kit->udev,
 			 usb_sndctrlpipe(kit->udev, 0),
-			 0x09, 0x21, 0x0200, 0x0000, buffer, 8, 2 * HZ);x+			 0x09, 0x21, 0x0200, 0x0000, buffer, 8, 2000);
 	if (retval < 0)
 		goto exit;
 
@@ -328,7 +329,7 @@
 	struct usb_interface *intf = to_usb_interface(dev);		\
 	struct phidget_interfacekit *kit = usb_get_intfdata(intf);	\
 									\
-	return sprintf(buf, "%d\n", kit->outputs[value - 1 ]);		\
+	return sprintf(buf, "%d\n", kit->outputs[value - 1]);		\
 }									\
 static DEVICE_ATTR(output##value, S_IWUGO | S_IRUGO,			\
 		show_output##value, set_output##value);
@@ -440,11 +441,13 @@
 		return -EIO;
 	}
 
-	if (ifkit->outputs == 8) {
+	if (ifkit->outputs >= 4) {
 		device_create_file(&intf->dev, &dev_attr_output1);
 		device_create_file(&intf->dev, &dev_attr_output2);
 		device_create_file(&intf->dev, &dev_attr_output3);
 		device_create_file(&intf->dev, &dev_attr_output4);
+	}
+	if (ifkit->outputs == 8) {
 		device_create_file(&intf->dev, &dev_attr_output5);
 		device_create_file(&intf->dev, &dev_attr_output6);
 		device_create_file(&intf->dev, &dev_attr_output7);
@@ -483,7 +486,7 @@
 		device_create_file(&intf->dev, &dev_attr_lcd);
 
 	dev_info(&intf->dev, "USB PhidgetInterfaceKit %d/%d/%d attached\n",
-			ifkit->inputs, ifkit->outputs, ifkit->sensors);
+			ifkit->sensors, ifkit->inputs, ifkit->outputs);
 
 	return 0;x }
@@ -497,15 +500,17 @@
 	if (!kit)
 		return;
 
-	if (kit->ifkit->outputs == MAX_INTERFACES) {
+	if (kit->ifkit->outputs >= 4) {
 		device_remove_file(&interface->dev, &dev_attr_output1);
 		device_remove_file(&interface->dev, &dev_attr_output2);
 		device_remove_file(&interface->dev, &dev_attr_output3);
 		device_remove_file(&interface->dev, &dev_attr_output4);
+	}
+	if (kit->ifkit->outputs == 8) {
 		device_remove_file(&interface->dev, &dev_attr_output5);
 		device_remove_file(&interface->dev, &dev_attr_output6);
 		device_remove_file(&interface->dev, &dev_attr_output7);
-		device_remove_file(&interface->dev, &dev_attr_output7);
+		device_remove_file(&interface->dev, &dev_attr_output8);
 	}
 
 	if (kit->ifkit->inputs >= 4) {
@@ -536,10 +541,10 @@
 		device_remove_file(&interface->dev, &dev_attr_sensor8);
 	}
 	if (kit->ifkit->has_lcd)
-		device_create_file(&interface->dev, &dev_attr_lcd);
+		device_remove_file(&interface->dev, &dev_attr_lcd);
 
 	dev_info(&interface->dev, "USB PhidgetInterfaceKit %d/%d/%d detached\n",
-		kit->ifkit->inputs, kit->ifkit->outputs, kit->ifkit->sensors);
+		kit->ifkit->sensors, kit->ifkit->inputs, kit->ifkit->outputs);
 
 	usb_kill_urb(kit->irq);
 	usb_free_urb(kit->irq);
diff -Nru a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c
--- a/drivers/usb/misc/phidgetservo.c	2004-08-09 14:26:07 -07:00
+++ b/drivers/usb/misc/phidgetservo.c	2005-03-07 20:46:43 -08:00
@@ -148,7 +148,7 @@
 
 	retval = usb_control_msg(servo->udev,
 				 usb_sndctrlpipe(servo->udev, 0),
-				 0x09, 0x21, 0x0200, 0x0000, buffer, 6, 2 * HZ);x+				 0x09, 0x21, 0x0200, 0x0000, buffer, 6, 2000);
 
 	kfree(buffer);
 
@@ -199,7 +199,7 @@
 
 	retval = usb_control_msg(servo->udev,
 				 usb_sndctrlpipe(servo->udev, 0),
-				 0x09, 0x21, 0x0200, 0x0000, buffer, 2, 2 * HZ);x+				 0x09, 0x21, 0x0200, 0x0000, buffer, 2, 2000);
 
 	kfree(buffer);
 
diff -Nru a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c
--- a/drivers/usb/misc/rio500.c	2004-11-11 13:26:04 -08:00
+++ b/drivers/usb/misc/rio500.c	2005-03-07 20:45:32 -08:00
@@ -166,7 +166,7 @@
 						 rio_cmd.value,
 						 rio_cmd.index, buffer,
 						 rio_cmd.length,
-						 rio_cmd.timeout);
+						 jiffies_to_msecs(rio_cmd.timeout));
 			if (result == -ETIMEDOUT)x 				retries--;
 			else if (result < 0) {
@@ -233,7 +233,7 @@
 						 rio_cmd.value,
 						 rio_cmd.index, buffer,
 						 rio_cmd.length,
-						 rio_cmd.timeout);
+						 jiffies_to_msecs(rio_cmd.timeout));
 			if (result == -ETIMEDOUT)x 				retries--;
 			else if (result < 0) {
@@ -309,7 +309,7 @@
 
 			result = usb_bulk_msg(rio->rio_dev,
 					 usb_sndbulkpipe(rio->rio_dev, 2),
-					 obuf, thistime, &partial, 5 * HZ);x+					 obuf, thistime, &partial, 5000);
 
 			dbg("write stats: result:%d thistime:%lu partial:%u",
 			     result, thistime, partial);
@@ -386,7 +386,7 @@
 		result = usb_bulk_msg(rio->rio_dev,
 				      usb_rcvbulkpipe(rio->rio_dev, 1),
 				      ibuf, this_read, &partial,
-				      (int) (HZ * 8));x+				      8000);
 
 		dbg(KERN_DEBUG "read stats: result:%d this_read:%u partial:%u",
 		       result, this_read, partial);
diff -Nru a/drivers/usb/misc/sisusbvga/Kconfig b/drivers/usb/misc/sisusbvga/Kconfig
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/misc/sisusbvga/Kconfig	2005-03-07 20:52:22 -08:00
@@ -0,0 +1,14 @@
+
+config USB_SISUSBVGA
+	tristate "USB 2.0 SVGA dongle support (Net2280/SiS315)"x+	depends on USB && USB_EHCI_HCD
+        ---help---
+	  Say Y here if you intend to attach a USB2VGA dongle based on a
+	  Net2280 and a SiS315 chip. 
+	  
+	  Note that this device requires a USB 2.0 host controller. It will not 
+	  work with USB 1.x controllers.
+x+	  To compile this driver as a module, choose M here: the module will bex+	  called sisusb.  If unsure, say N.
+xdiff -Nru a/drivers/usb/misc/sisusbvga/Makefile b/drivers/usb/misc/sisusbvga/Makefile
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/misc/sisusbvga/Makefile	2005-03-07 20:52:22 -08:00
@@ -0,0 +1,6 @@
+#
+# Makefile for the sisusb driver (if driver is inside kernel tree).
+#
+
+obj-$(CONFIG_USB_SISUSBVGA) += sisusb.o
+
diff -Nru a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/misc/sisusbvga/sisusb.c	2005-03-07 20:52:14 -08:00
@@ -0,0 +1,3144 @@
+/*x+ * sisusb - usb kernel driver for SiS315(E) based USB2VGA donglesx+ *x+ * Copyright (C) 2005 by Thomas Winischhofer, Vienna, Austriax+ *x+ * If distributed as part of the Linux kernel, this code is licensed under thex+ * terms of the GPL v2.x+ *x+ * Otherwise, the following license terms apply:x+ *x+ * * Redistribution and use in source and binary forms, with or withoutx+ * * modification, are permitted provided that the following conditionsx+ * * are met:x+ * * 1) Redistributions of source code must retain the above copyrightx+ * *    notice, this list of conditions and the following disclaimer.x+ * * 2) Redistributions in binary form must reproduce the above copyrightx+ * *    notice, this list of conditions and the following disclaimer in thex+ * *    documentation and/or other materials provided with the distribution.x+ * * 3) The name of the author may not be used to endorse or promote productsx+ * *    derived from this software without specific psisusbr written permission.x+ * *x+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED ORx+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIESx+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.x+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,x+ * * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUTx+ * * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,x+ * * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANYx+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORTx+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OFx+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.x+ *x+ * Author: 	Thomas Winischhofer <thomas@winischhofer.net>x+ *x+ */
+
+#include <linux/config.h>
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/signal.h>
+#include <linux/sched.h>
+#include <linux/errno.h>
+#include <linux/poll.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/kref.h>
+#include <linux/usb.h>
+#include <linux/smp_lock.h>
+
+#include "sisusb.h"
+
+#define SISUSB_DONTSYNC
+
+/* Forward declarations / clean-up routines */
+
+static struct usb_driver sisusb_driver;
+
+static DECLARE_MUTEX(disconnect_sem);
+
+static void
+sisusb_free_buffers(struct sisusb_usb_data *sisusb)x+{
+	int i;
+
+	for (i = 0; i < NUMOBUFS; i++) {
+		if (sisusb->obuf[i]) {
+			usb_buffer_free(sisusb->sisusb_dev, sisusb->obufsize,
+				sisusb->obuf[i], sisusb->transfer_dma_out[i]);x+			sisusb->obuf[i] = NULL;
+		}
+	}
+	if (sisusb->ibuf) {
+		usb_buffer_free(sisusb->sisusb_dev, sisusb->ibufsize,
+			sisusb->ibuf, sisusb->transfer_dma_in);x+		sisusb->ibuf = NULL;
+	}
+}
+
+static void
+sisusb_free_urbs(struct sisusb_usb_data *sisusb)x+{
+	int i;
+
+	for (i = 0; i < NUMOBUFS; i++) {
+		usb_free_urb(sisusb->sisurbout[i]);x+		sisusb->sisurbout[i] = NULL;
+	}
+	usb_free_urb(sisusb->sisurbin);x+	sisusb->sisurbin = NULL;
+}
+
+/* Level 0: USB transport layer */
+
+/* 1. out-bulks */
+
+/* out-urb management */
+
+/* Return 1 if all free, 0 otherwise */
+static int
+sisusb_all_free(struct sisusb_usb_data *sisusb)x+{
+	int i;
+
+	for (i = 0; i < sisusb->numobufs; i++) {
+
+		if (sisusb->urbstatus[i] & SU_URB_BUSY)
+			return 0;
+
+	}
+
+	return 1;
+}
+
+/* Kill all busy URBs */
+static void
+sisusb_kill_all_busy(struct sisusb_usb_data *sisusb)x+{
+	int i;
+
+	if (sisusb_all_free(sisusb))x+		return;
+
+	for (i = 0; i < sisusb->numobufs; i++) {
+
+		if (sisusb->urbstatus[i] & SU_URB_BUSY)
+			usb_kill_urb(sisusb->sisurbout[i]);x+
+	}
+}
+
+/* Return 1 if ok, 0 if error (not all complete within timeout) */
+static int
+sisusb_wait_all_out_complete(struct sisusb_usb_data *sisusb)x+{
+	int timeout = 5 * HZ, i = 1;x+
+	wait_event_timeout(sisusb->wait_q,
+				(i = sisusb_all_free(sisusb)),
+				 timeout);
+
+	return i;
+}
+
+static int
+sisusb_outurb_available(struct sisusb_usb_data *sisusb)x+{
+	int i;
+
+	for (i = 0; i < sisusb->numobufs; i++) {
+
+		if ((sisusb->urbstatus[i] & (SU_URB_BUSY|SU_URB_ALLOC)) == 0)
+			return i;
+
+	}
+
+	return -1;
+}
+
+static int
+sisusb_get_free_outbuf(struct sisusb_usb_data *sisusb)x+{
+	int i, timeout = 5 * HZ;x+
+	wait_event_timeout(sisusb->wait_q,
+				((i = sisusb_outurb_available(sisusb)) >= 0),
+				timeout);
+
+	return i;
+}
+
+static int
+sisusb_alloc_outbuf(struct sisusb_usb_data *sisusb)x+{
+	int i;
+
+	i = sisusb_outurb_available(sisusb);
+
+	if (i >= 0)x+		sisusb->urbstatus[i] |= SU_URB_ALLOC;
+
+	return i;
+}
+
+static void
+sisusb_free_outbuf(struct sisusb_usb_data *sisusb, int index)x+{
+	if ((index >= 0) && (index < sisusb->numobufs))x+		sisusb->urbstatus[index] &= ~SU_URB_ALLOC;
+}
+
+/* completion callback */
+
+static void
+sisusb_bulk_completeout(struct urb *urb, struct pt_regs *regs)x+{
+	struct sisusb_urb_context *context = urb->context;
+	struct sisusb_usb_data *sisusb;
+
+	if (!context)x+		return;
+
+	sisusb = context->sisusb;
+
+	if (!sisusb || !sisusb->sisusb_dev || !sisusb->present)x+		return;
+
+#ifndef SISUSB_DONTSYNC
+	if (context->actual_length)
+		*(context->actual_length) += urb->actual_length;
+#endif
+
+	sisusb->urbstatus[context->urbindex] &= ~SU_URB_BUSY;
+	wake_up(&sisusb->wait_q);
+}
+
+static int
+sisusb_bulkout_msg(struct sisusb_usb_data *sisusb, int index, unsigned int pipe, void *data,
+		int len, int *actual_length, int timeout, unsigned int tflags,
+		dma_addr_t transfer_dma)x+{
+	struct urb *urb = sisusb->sisurbout[index];
+	int retval, byteswritten = 0;
+
+	/* Set up URB */
+	urb->transfer_flags = 0;
+
+	usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len,x+		sisusb_bulk_completeout, &sisusb->urbout_context[index]);
+
+	urb->transfer_flags |= (tflags | URB_ASYNC_UNLINK);x+	urb->actual_length = 0;
+
+	if ((urb->transfer_dma = transfer_dma))
+		urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+
+	/* Set up context */
+	sisusb->urbout_context[index].actual_length = (timeout) ?
+						NULL : actual_length;
+
+	/* Declare this urb/buffer in use */
+	sisusb->urbstatus[index] |= SU_URB_BUSY;
+
+	/* Submit URB */
+	retval = usb_submit_urb(urb, GFP_ATOMIC);
+
+	/* If OK, and if timeout > 0, wait for completion */
+	if ((retval == 0) && timeout) {
+		wait_event_timeout(sisusb->wait_q,
+				   (!(sisusb->urbstatus[index] & SU_URB_BUSY)),
+				   timeout);
+		if (sisusb->urbstatus[index] & SU_URB_BUSY) {
+			/* URB timed out... kill it and report error */
+			usb_kill_urb(urb);
+			retval = -ETIMEDOUT;
+		} else {
+			/* Otherwise, report urb status */
+			retval = urb->status;
+			byteswritten = urb->actual_length;
+		}
+	}
+
+	if (actual_length)
+		*actual_length = byteswritten;
+
+	return retval;
+}
+
+/* 2. in-bulks */
+
+/* completion callback */
+
+static void
+sisusb_bulk_completein(struct urb *urb, struct pt_regs *regs)x+{
+	struct sisusb_usb_data *sisusb = urb->context;
+
+	if (!sisusb || !sisusb->sisusb_dev || !sisusb->present)x+		return;
+
+	sisusb->completein = 1;x+	wake_up(&sisusb->wait_q);
+}
+
+static int
+sisusb_bulkin_msg(struct sisusb_usb_data *sisusb, unsigned int pipe, void *data, int len,
+		int *actual_length, int timeout, unsigned int tflags, dma_addr_t transfer_dma)x+{
+	struct urb *urb = sisusb->sisurbin;
+	int retval, readbytes = 0;
+
+	urb->transfer_flags = 0;
+
+	usb_fill_bulk_urb(urb, sisusb->sisusb_dev, pipe, data, len,x+			sisusb_bulk_completein, sisusb);
+
+	urb->transfer_flags |= (tflags | URB_ASYNC_UNLINK);x+	urb->actual_length = 0;
+
+	if ((urb->transfer_dma = transfer_dma))
+		urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
+
+	sisusb->completein = 0;
+	retval = usb_submit_urb(urb, GFP_ATOMIC);
+	if (retval == 0) {
+		wait_event_timeout(sisusb->wait_q, sisusb->completein, timeout);
+		if (!sisusb->completein) {
+			/* URB timed out... kill it and report error */
+			usb_kill_urb(urb);
+			retval = -ETIMEDOUT;
+		} else {
+			/* URB completed within timout */
+			retval = urb->status;
+			readbytes = urb->actual_length;
+		}
+	}
+
+	if (actual_length)
+		*actual_length = readbytes;
+
+	return retval;
+}
+
+
+/* Level 1:  */
+
+/* Send a bulk message of variable sizex+ *x+ * To copy the data from userspace, give pointer to "userbuffer",x+ * to copy from (non-DMA) kernel memory, give "kernbuffer". Ifx+ * both of these are NULL, it is assumed, that the transferx+ * buffer "sisusb->obuf[index]" is set up with the data to send.x+ * Index is ignored if either kernbuffer or userbuffer is set.x+ * If async is nonzero, URBs will be sent without waiting forx+ * completion of the previous URB.x+ *x+ * (return 0 on success)x+ */
+
+static int sisusb_send_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
+		char *kernbuffer, const char __user *userbuffer, int index,x+		ssize_t *bytes_written, unsigned int tflags, int async)x+{
+	int result = 0, retry, count = len;
+	int passsize, thispass, transferred_len = 0;
+	int fromuser = (userbuffer != NULL) ? 1 : 0;
+	int fromkern = (kernbuffer != NULL) ? 1 : 0;
+	unsigned int pipe;
+	char *buffer;
+
+	(*bytes_written) = 0;
+
+	/* Sanity check */
+	if (!sisusb || !sisusb->present || !sisusb->sisusb_dev)x+		return -ENODEV;
+
+	/* If we copy data from kernel or userspace, force thex+	 * allocation of a buffer/urb. If we have the data inx+	 * the transfer buffer[index] already, reuse the buffer/URBx+	 * if the length is > buffer size. (So, transmittingx+	 * large data amounts directly from the transfer bufferx+	 * treats the buffer as a ring buffer. However, we needx+	 * to sync in this case.)x+	 */
+	if (fromuser || fromkern)
+		index = -1;
+	else if (len > sisusb->obufsize)
+		async = 0;
+
+	pipe = usb_sndbulkpipe(sisusb->sisusb_dev, ep);
+
+	do {
+		passsize = thispass = (sisusb->obufsize < count) ?
+						sisusb->obufsize : count;
+
+		if (index < 0)
+			index = sisusb_get_free_outbuf(sisusb);
+
+		if (index < 0)
+			return -EIO;
+
+		buffer = sisusb->obuf[index];
+
+		if (fromuser) {
+
+			if (copy_from_user(buffer, userbuffer, passsize))
+				return -EFAULT;
+
+			userbuffer += passsize;
+
+		} else if (fromkern) {
+
+			memcpy(buffer, kernbuffer, passsize);
+			kernbuffer += passsize;
+
+		}
+
+		retry = 5;
+		while (thispass) {
+
+			if (!sisusb->sisusb_dev)x+				return -ENODEV;
+
+			result = sisusb_bulkout_msg(sisusb,
+						index,x+						pipe,x+						buffer,
+						thispass,
+						&transferred_len,
+						async ? 0 : 5 * HZ,
+						tflags,
+						sisusb->transfer_dma_out[index]);
+
+			if (result == -ETIMEDOUT) {
+
+				/* Will not happen if async */
+				if (!retry--)x+					return -ETIME;
+
+				continue;
+
+			} else if ((result == 0) && !async && transferred_len) {
+
+				thispass -= transferred_len;
+				if (thispass) {
+					if (sisusb->transfer_dma_out) {
+						/* If DMA, copy remainingx+						 * to beginning of bufferx+						 */x+						memcpy(buffer,x+						       buffer + transferred_len,
+						       thispass);x+					} else {
+						/* If not DMA, simply increasex+						 * the pointerx+						 */x+						buffer += transferred_len;
+					}
+				}
+
+			} else
+				break;
+		};
+
+		if (result)
+			return result;
+
+		(*bytes_written) += passsize;
+		count            -= passsize;
+
+		/* Force new allocation in next iteration */x+		if (fromuser || fromkern)
+			index = -1;
+
+	} while (count > 0);
+
+	if (async) {
+#ifdef SISUSB_DONTSYNC
+		(*bytes_written) = len;
+		/* Some URBs/buffers might be busy */
+#else
+		sisusb_wait_all_out_complete(sisusb);
+		(*bytes_written) = transferred_len;
+		/* All URBs and all buffers are available */
+#endif
+	}
+
+	return ((*bytes_written) == len) ? 0 : -EIO;
+}
+
+/* Receive a bulk message of variable sizex+ *x+ * To copy the data to userspace, give pointer to "userbuffer",x+ * to copy to kernel memory, give "kernbuffer". One of themx+ * MUST be set. (There is no technique for letting the callerx+ * read directly from the ibuf.)x+ *x+ */
+
+static int sisusb_recv_bulk_msg(struct sisusb_usb_data *sisusb, int ep, int len,
+		void *kernbuffer, char __user *userbuffer, ssize_t *bytes_read,
+		unsigned int tflags)x+{
+	int result = 0, retry, count = len;
+	int bufsize, thispass, transferred_len;
+	unsigned int pipe;
+	char *buffer;
+
+	(*bytes_read) = 0;
+
+	/* Sanity check */
+	if (!sisusb || !sisusb->present || !sisusb->sisusb_dev)x+		return -ENODEV;
+
+	pipe = usb_rcvbulkpipe(sisusb->sisusb_dev, ep);
+	buffer = sisusb->ibuf;
+	bufsize = sisusb->ibufsize;
+
+	retry = 5;
+
+#ifdef SISUSB_DONTSYNC
+	if (!(sisusb_wait_all_out_complete(sisusb)))x+		return -EIO;
+#endif
+
+	while (count > 0) {
+
+		if (!sisusb->sisusb_dev)x+			return -ENODEV;
+
+		thispass = (bufsize < count) ? bufsize : count;
+
+		result = sisusb_bulkin_msg(sisusb,
+					   pipe,x+					   buffer,x+					   thispass,
+					   &transferred_len,
+					   5 * HZ,
+					   tflags,
+					   sisusb->transfer_dma_in);x+
+		if (transferred_len)
+			thispass = transferred_len;
+
+		else if (result == -ETIMEDOUT) {
+
+			if (!retry--)x+				return -ETIME;
+
+			continue;
+
+		} else
+			return -EIO;
+
+
+		if (thispass) {
+
+			(*bytes_read) += thispass;
+			count         -= thispass;
+
+			if (userbuffer) {
+
+				if (copy_to_user(userbuffer, buffer, thispass))x+					return -EFAULT;
+
+				userbuffer += thispass;
+
+			} else {
+
+				memcpy(kernbuffer, buffer, thispass);
+				kernbuffer += thispass;
+
+			}
+
+		}
+
+	}
+
+	return ((*bytes_read) == len) ? 0 : -EIO;
+}
+
+static int sisusb_send_packet(struct sisusb_usb_data *sisusb, int len,
+						struct sisusb_packet *packet)x+{
+	int ret;
+	int bytes_transferred = 0;
+	__le32 tmp;
+
+	if (len == 6)
+		packet->data = 0;
+
+#ifdef SISUSB_DONTSYNC
+	if (!(sisusb_wait_all_out_complete(sisusb)))x+		return 1;
+#endif
+
+	/* Eventually correct endianness */
+	SISUSB_CORRECT_ENDIANNESS_PACKET(packet);
+
+	/* 1. send the packet */
+	ret = sisusb_send_bulk_msg(sisusb, SISUSB_EP_GFX_OUT, len,x+			(char *)packet, NULL, 0, &bytes_transferred, 0, 0);
+
+	if ((ret == 0) && (len == 6)) {
+
+		/* 2. if packet len == 6, it means we read, so wait for 32bitx+		 *    return value and write it to packet->datax+		 */x+		ret = sisusb_recv_bulk_msg(sisusb, SISUSB_EP_GFX_IN, 4,
+				(char *)&tmp, NULL, &bytes_transferred, 0);x+
+		packet->data = le32_to_cpu(tmp);
+	}
+
+	return ret;
+}
+
+static int sisusb_send_bridge_packet(struct sisusb_usb_data *sisusb, int len,
+					struct sisusb_packet *packet,
+					unsigned int tflags)x+{
+	int ret;
+	int bytes_transferred = 0;
+	__le32 tmp;
+
+	if (len == 6)
+		packet->data = 0;
+
+#ifdef SISUSB_DONTSYNC
+	if (!(sisusb_wait_all_out_complete(sisusb)))x+		return 1;
+#endif
+
+	/* Eventually correct endianness */
+	SISUSB_CORRECT_ENDIANNESS_PACKET(packet);
+
+	/* 1. send the packet */
+	ret = sisusb_send_bulk_msg(sisusb, SISUSB_EP_BRIDGE_OUT, len,x+			(char *)packet, NULL, 0, &bytes_transferred, tflags, 0);
+
+	if ((ret == 0) && (len == 6)) {
+
+		/* 2. if packet len == 6, it means we read, so wait for 32bitx+		 *    return value and write it to packet->datax+		 */x+		ret = sisusb_recv_bulk_msg(sisusb, SISUSB_EP_BRIDGE_IN, 4,
+				(char *)&tmp, NULL, &bytes_transferred, 0);x+
+		packet->data = le32_to_cpu(tmp);
+	}
+
+	return ret;
+}
+
+/* access video memory and mmio (return 0 on success) */
+
+/* Low level */
+
+/* The following routines assume being used to transfer byte, word,x+ * long etc.x+ * This means that they assume "data" in machine endianness format.x+ */
+
+static int sisusb_write_memio_byte(struct sisusb_usb_data *sisusb, int type,x+							u32 addr, u8 data)x+{
+	struct sisusb_packet packet;
+	int ret;
+
+	packet.header  = (1 << (addr & 3)) | (type << 6);
+	packet.address = addr & ~3;
+	packet.data    = data << ((addr & 3) << 3);
+	ret = sisusb_send_packet(sisusb, 10, &packet);
+	return ret;
+}
+
+static int sisusb_write_memio_word(struct sisusb_usb_data *sisusb, int type,x+							u32 addr, u16 data)x+{
+	struct sisusb_packet packet;
+	int ret = 0;
+
+	packet.address = addr & ~3;
+
+	switch (addr & 3) {
+		case 0:x+			packet.header = (type << 6) | 0x0003;x+			packet.data   = (u32)data;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			break;
+		case 1:x+			packet.header = (type << 6) | 0x0006;x+			packet.data   = (u32)data << 8;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			break;
+		case 2:x+			packet.header = (type << 6) | 0x000c;x+			packet.data   = (u32)data << 16;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			break;
+		case 3:x+			packet.header = (type << 6) | 0x0008;x+			packet.data   = (u32)data << 24;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			packet.header = (type << 6) | 0x0001;
+			packet.address = (addr & ~3) + 4;x+			packet.data   = (u32)data >> 8;
+			ret |= sisusb_send_packet(sisusb, 10, &packet);
+	}
+
+	return ret;
+}
+
+static int sisusb_write_memio_24bit(struct sisusb_usb_data *sisusb, int type,x+							u32 addr, u32 data)x+{
+	struct sisusb_packet packet;
+	int ret = 0;
+
+	packet.address = addr & ~3;
+
+	switch (addr & 3) {
+		case 0:x+			packet.header  = (type << 6) | 0x0007;x+			packet.data    = data & 0x00ffffff;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			break;
+		case 1:x+			packet.header  = (type << 6) | 0x000e;x+			packet.data    = data << 8;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			break;
+		case 2:x+			packet.header  = (type << 6) | 0x000c;x+			packet.data    = data << 16;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			packet.header  = (type << 6) | 0x0001;
+			packet.address = (addr & ~3) + 4;x+			packet.data    = (data >> 16) & 0x00ff;
+			ret |= sisusb_send_packet(sisusb, 10, &packet);
+			break;
+		case 3:x+			packet.header  = (type << 6) | 0x0008;x+			packet.data    = data << 24;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			packet.header  = (type << 6) | 0x0003;x+			packet.address = (addr & ~3) + 4;x+			packet.data    = (data >> 8) & 0xffff;
+			ret |= sisusb_send_packet(sisusb, 10, &packet);
+	}
+
+	return ret;
+}
+
+static int sisusb_write_memio_long(struct sisusb_usb_data *sisusb, int type,x+							u32 addr, u32 data)x+{
+	struct sisusb_packet packet;
+	int ret = 0;
+
+	packet.address = addr & ~3;
+
+	switch (addr & 3) {
+		case 0:x+			packet.header  = (type << 6) | 0x000f;x+			packet.data    = data;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			break;
+		case 1:x+			packet.header  = (type << 6) | 0x000e;x+			packet.data    = data << 8;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			packet.header  = (type << 6) | 0x0001;
+			packet.address = (addr & ~3) + 4;x+			packet.data    = data >> 24;
+			ret |= sisusb_send_packet(sisusb, 10, &packet);
+			break;
+		case 2:x+			packet.header  = (type << 6) | 0x000c;x+			packet.data    = data << 16;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			packet.header  = (type << 6) | 0x0003;
+			packet.address = (addr & ~3) + 4;x+			packet.data    = data >> 16;
+			ret |= sisusb_send_packet(sisusb, 10, &packet);
+			break;
+		case 3:x+			packet.header  = (type << 6) | 0x0008;x+			packet.data    = data << 24;
+			ret = sisusb_send_packet(sisusb, 10, &packet);
+			packet.header  = (type << 6) | 0x0007;
+			packet.address = (addr & ~3) + 4;x+			packet.data    = data >> 8;
+			ret |= sisusb_send_packet(sisusb, 10, &packet);
+	}
+
+	return ret;
+}
+
+/* The xxx_bulk routines copy a buffer of variable size. They treat thex+ * buffer as chars, therefore lsb/msb has to be corrected if using thex+ * byte/word/long/etc routines for speed-upx+ *x+ * If data is from userland, set "userbuffer" (and clear "kernbuffer"),x+ * if data is in kernel space, set "kernbuffer" (and clear "userbuffer");
+ * if neither "kernbuffer" nor "userbuffer" are given, it is assumedx+ * that the data already is in the transfer buffer "sisusb->obuf[index]".x+ */
+
+static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
+				char *kernbuffer, int length,
+				const char __user *userbuffer, int index,x+				ssize_t *bytes_written)x+{
+	struct sisusb_packet packet;
+	int  ret = 0;
+	static int msgcount = 0;
+	u8   swap8, fromkern = kernbuffer ? 1 : 0;
+	u16  swap16;
+	u32  swap32, flag = (length >> 28) & 1;
+	char buf[4];
+
+	/* if neither kernbuffer not userbuffer are given, assumex+	 * data in obufx+	 */
+	if (!fromkern && !userbuffer)
+		kernbuffer = sisusb->obuf[index];
+
+	(*bytes_written = 0);x+
+	length &= 0x00ffffff;
+
+	while (length) {
+x+	    switch (length) {
+x+		case 0:x+			return ret;
+
+		case 1:x+			if (userbuffer) {
+				if (get_user(swap8, (u8 __user *)userbuffer))x+					return -EFAULT;
+			} else
+				swap8 = kernbuffer[0];
+
+			ret = sisusb_write_memio_byte(sisusb,
+							SISUSB_TYPE_MEM,
+							addr, swap8);
+
+			if (!ret)x+				(*bytes_written)++;
+
+			return ret;
+
+		case 2:x+			if (userbuffer) {
+				if (get_user(swap16, (u16 __user *)userbuffer))x+					return -EFAULT;
+			} else
+				swap16 = (kernbuffer[0] << 8) | kernbuffer[1];
+
+			ret = sisusb_write_memio_word(sisusb,
+							SISUSB_TYPE_MEM,
+							addr,
+							swap16);
+
+			if (!ret)x+				(*bytes_written) += 2;
+
+			return ret;
+
+		case 3:x+			if (userbuffer) {
+				if (copy_from_user(&buf, userbuffer, 3))x+					return -EFAULT;
+
+				swap32 = (buf[0] << 16) |
+					 (buf[1] <<  8) |
+					 buf[2];
+			} else
+				swap32 = (kernbuffer[0] << 16) |
+					 (kernbuffer[1] <<  8) |
+					 kernbuffer[2];
+
+			ret = sisusb_write_memio_24bit(sisusb,
+							SISUSB_TYPE_MEM,
+							addr,
+							swap32);
+
+			if (!ret)x+				(*bytes_written) += 3;
+
+			return ret;
+
+		case 4:x+			if (userbuffer) {
+				if (get_user(swap32, (u32 __user *)userbuffer))x+					return -EFAULT;
+			} else
+				swap32 = (kernbuffer[0] << 24) |
+					 (kernbuffer[1] << 16) |
+					 (kernbuffer[2] <<  8) |
+					 kernbuffer[3];
+
+			ret = sisusb_write_memio_long(sisusb,
+							SISUSB_TYPE_MEM,
+							addr,
+							swap32);
+			if (!ret)x+				(*bytes_written) += 4;
+
+			return ret;
+
+		default:
+			if ((length & ~3) > 0x10000) {
+
+			   packet.header  = 0x001f;
+			   packet.address = 0x000001d4;
+			   packet.data    = addr;
+			   ret = sisusb_send_bridge_packet(sisusb, 10,
+								&packet, 0);
+			   packet.header  = 0x001f;
+			   packet.address = 0x000001d0;
+			   packet.data    = (length & ~3);
+			   ret |= sisusb_send_bridge_packet(sisusb, 10,
+								&packet, 0);
+			   packet.header  = 0x001f;
+			   packet.address = 0x000001c0;
+			   packet.data    = flag | 0x16;
+			   ret |= sisusb_send_bridge_packet(sisusb, 10,
+								&packet, 0);
+			   if (userbuffer) {
+				ret |= sisusb_send_bulk_msg(sisusb,
+							SISUSB_EP_GFX_LBULK_OUT,
+							(length & ~3),
+							NULL, userbuffer, 0,
+							bytes_written, 0, 1);
+				userbuffer += (*bytes_written);
+			   } else if (fromkern) {
+				ret |= sisusb_send_bulk_msg(sisusb,
+							SISUSB_EP_GFX_LBULK_OUT,
+							(length & ~3),
+							kernbuffer, NULL, 0,
+							bytes_written, 0, 1);
+				kernbuffer += (*bytes_written);
+			   } else {
+			ret |= sisusb_send_bulk_msg(sisusb,
+							SISUSB_EP_GFX_LBULK_OUT,
+							(length & ~3),
+							NULL, NULL, index,x+							bytes_written, 0, 1);
+				kernbuffer += ((*bytes_written) &x+						(sisusb->obufsize-1));
+			   }
+
+			} else {
+
+			   packet.header  = 0x001f;
+			   packet.address = 0x00000194;
+			   packet.data    = addr;
+			   ret = sisusb_send_bridge_packet(sisusb, 10,
+			   					&packet, 0);
+			   packet.header  = 0x001f;
+			   packet.address = 0x00000190;
+			   packet.data    = (length & ~3);
+			   ret |= sisusb_send_bridge_packet(sisusb, 10,
+			   					&packet, 0);
+			   if (sisusb->flagb0 != 0x16) {
+				packet.header  = 0x001f;
+				packet.address = 0x00000180;
+				packet.data    = flag | 0x16;
+				ret |= sisusb_send_bridge_packet(sisusb, 10,
+								&packet, 0);
+				sisusb->flagb0 = 0x16;
+			   }
+			   if (userbuffer) {
+				ret |= sisusb_send_bulk_msg(sisusb,
+							SISUSB_EP_GFX_BULK_OUT,
+							(length & ~3),
+							NULL, userbuffer, 0,
+							bytes_written, 0, 1);
+				userbuffer += (*bytes_written);
+			   } else if (fromkern) {
+				ret |= sisusb_send_bulk_msg(sisusb,
+							SISUSB_EP_GFX_BULK_OUT,
+							(length & ~3),
+							kernbuffer, NULL, 0,
+							bytes_written, 0, 1);
+				kernbuffer += (*bytes_written);
+			   } else {
+				ret |= sisusb_send_bulk_msg(sisusb,
+							SISUSB_EP_GFX_BULK_OUT,
+							(length & ~3),
+							NULL, NULL, index,x+							bytes_written, 0, 1);
+				kernbuffer += ((*bytes_written) &x+						(sisusb->obufsize-1));
+			   }
+			}
+			if (ret) {
+				msgcount++;
+				if (msgcount < 500)x+					printk(KERN_ERRx+						"sisusbvga[%d]: Wrote %d of "x+						"%d bytes, error %d\n",
+						sisusb->minor, *bytes_written,
+						length, ret);
+				else if (msgcount == 500)x+					printk(KERN_ERRx+						"sisusbvga[%d]: Too many errors"x+						", logging stopped\n",
+						sisusb->minor);
+			}
+			addr += (*bytes_written);
+			length -= (*bytes_written);
+	    }
+
+	    if (ret)x+	    	break;
+
+	}
+
+	return ret ? -EIO : 0;
+}
+
+static int sisusb_read_memio_byte(struct sisusb_usb_data *sisusb, int type,x+							u32 addr, u8 *data)x+{
+	struct sisusb_packet packet;
+	int ret;
+
+	CLEARPACKET(&packet);
+	packet.header  = (1 << (addr & 3)) | (type << 6);
+	packet.address = addr & ~3;
+	ret = sisusb_send_packet(sisusb, 6, &packet);
+	*data = (u8)(packet.data >> ((addr & 3) << 3));
+	return ret;
+}
+
+static int sisusb_read_memio_word(struct sisusb_usb_data *sisusb, int type,x+							u32 addr, u16 *data)x+{
+	struct sisusb_packet packet;
+	int ret = 0;
+
+	CLEARPACKET(&packet);
+
+	packet.address = addr & ~3;
+
+	switch (addr & 3) {
+		case 0:x+			packet.header = (type << 6) | 0x0003;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = (u16)(packet.data);
+			break;
+		case 1:x+			packet.header = (type << 6) | 0x0006;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = (u16)(packet.data >> 8);
+			break;
+		case 2:x+			packet.header = (type << 6) | 0x000c;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = (u16)(packet.data >> 16);
+			break;
+		case 3:x+			packet.header = (type << 6) | 0x0008;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = (u16)(packet.data >> 24);
+			packet.header = (type << 6) | 0x0001;
+			packet.address = (addr & ~3) + 4;x+			ret |= sisusb_send_packet(sisusb, 6, &packet);
+			*data |= (u16)(packet.data << 8);
+	}
+
+	return ret;
+}
+
+static int sisusb_read_memio_24bit(struct sisusb_usb_data *sisusb, int type,x+							u32 addr, u32 *data)x+{
+	struct sisusb_packet packet;
+	int ret = 0;
+
+	packet.address = addr & ~3;
+
+	switch (addr & 3) {
+		case 0:x+			packet.header  = (type << 6) | 0x0007;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = packet.data & 0x00ffffff;
+			break;
+		case 1:x+			packet.header  = (type << 6) | 0x000e;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = packet.data >> 8;
+			break;
+		case 2:x+			packet.header  = (type << 6) | 0x000c;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = packet.data >> 16;
+			packet.header  = (type << 6) | 0x0001;
+			packet.address = (addr & ~3) + 4;x+			ret |= sisusb_send_packet(sisusb, 6, &packet);
+			*data |= ((packet.data & 0xff) << 16);
+			break;
+		case 3:x+			packet.header  = (type << 6) | 0x0008;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = packet.data >> 24;
+			packet.header  = (type << 6) | 0x0003;
+			packet.address = (addr & ~3) + 4;x+			ret |= sisusb_send_packet(sisusb, 6, &packet);
+			*data |= ((packet.data & 0xffff) << 8);
+	}
+
+	return ret;
+}
+
+static int sisusb_read_memio_long(struct sisusb_usb_data *sisusb, int type,x+							u32 addr, u32 *data)x+{
+	struct sisusb_packet packet;
+	int ret = 0;
+
+	packet.address = addr & ~3;
+
+	switch (addr & 3) {
+		case 0:x+			packet.header  = (type << 6) | 0x000f;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = packet.data;
+			break;
+		case 1:x+			packet.header  = (type << 6) | 0x000e;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = packet.data >> 8;
+			packet.header  = (type << 6) | 0x0001;
+			packet.address = (addr & ~3) + 4;x+			ret |= sisusb_send_packet(sisusb, 6, &packet);
+			*data |= (packet.data << 24);
+			break;
+		case 2:x+			packet.header  = (type << 6) | 0x000c;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = packet.data >> 16;
+			packet.header  = (type << 6) | 0x0003;
+			packet.address = (addr & ~3) + 4;x+			ret |= sisusb_send_packet(sisusb, 6, &packet);
+			*data |= (packet.data << 16);
+			break;
+		case 3:x+			packet.header  = (type << 6) | 0x0008;x+			ret = sisusb_send_packet(sisusb, 6, &packet);
+			*data = packet.data >> 24;
+			packet.header  = (type << 6) | 0x0007;
+			packet.address = (addr & ~3) + 4;x+			ret |= sisusb_send_packet(sisusb, 6, &packet);
+			*data |= (packet.data << 8);
+	}
+
+	return ret;
+}
+
+static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
+				char *kernbuffer, int length,
+				char __user *userbuffer, ssize_t *bytes_read)x+{
+	int ret = 0;
+	char buf[4];
+	u16 swap16;
+	u32 swap32;
+
+	(*bytes_read = 0);x+
+	length &= 0x00ffffff;
+
+	while (length) {
+x+	    switch (length) {
+x+		case 0:x+			return ret;
+
+		case 1:x+x+			ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM,
+								addr, &buf[0]);
+			if (!ret) {
+				(*bytes_read)++;
+				if (userbuffer) {
+					if (put_user(buf[0],
+						(u8 __user *)userbuffer)) {
+						return -EFAULT;
+					}
+				} else {
+					kernbuffer[0] = buf[0];
+				}
+			}
+			return ret;
+
+		case 2:x+			ret |= sisusb_read_memio_word(sisusb, SISUSB_TYPE_MEM,
+								addr, &swap16);
+			if (!ret) {
+				(*bytes_read) += 2;
+				if (userbuffer) {
+					if (put_user(swap16,
+						(u16 __user *)userbuffer))x+						return -EFAULT;
+				} else {
+					kernbuffer[0] = swap16 >> 8;
+					kernbuffer[1] = swap16 & 0xff;
+				}
+			}
+			return ret;
+
+		case 3:x+			ret |= sisusb_read_memio_24bit(sisusb, SISUSB_TYPE_MEM,
+								addr, &swap32);
+			if (!ret) {
+				(*bytes_read) += 3;
+				buf[0] = (swap32 >> 16) & 0xff;
+				buf[1] = (swap32 >> 8) & 0xff;
+				buf[2] = swap32 & 0xff;
+				if (userbuffer) {
+					if (copy_to_user(userbuffer, &buf[0], 3))x+						return -EFAULT;
+				} else {
+					kernbuffer[0] = buf[0];
+					kernbuffer[1] = buf[1];
+					kernbuffer[2] = buf[2];
+				}
+			}
+			return ret;
+
+		default:
+			ret |= sisusb_read_memio_long(sisusb, SISUSB_TYPE_MEM,
+								addr, &swap32);
+			if (!ret) {
+				(*bytes_read) += 4;
+				if (userbuffer) {
+					if (put_user(swap32,
+						(u32 __user *)userbuffer))x+						return -EFAULT;
+
+					userbuffer += 4;
+				} else {
+					kernbuffer[0] = (swap32 >> 24) & 0xff;
+					kernbuffer[1] = (swap32 >> 16) & 0xff;
+					kernbuffer[2] = (swap32 >> 8) & 0xff;
+					kernbuffer[3] = swap32 & 0xff;
+					kernbuffer += 4;
+				}
+				addr += 4;
+				length -= 4;
+			}
+#if 0		/* That does not work, as EP 2 is an OUT EP! */x+		default:
+			CLEARPACKET(&packet);
+			packet.header  = 0x001f;
+			packet.address = 0x000001a0;x+			packet.data    = 0x00000006;x+			ret |= sisusb_send_bridge_packet(sisusb, 10,
+								&packet, 0);
+			packet.header  = 0x001f;
+			packet.address = 0x000001b0;x+			packet.data    = (length & ~3) | 0x40000000;x+			ret |= sisusb_send_bridge_packet(sisusb, 10,
+								&packet, 0);
+			packet.header  = 0x001f;
+			packet.address = 0x000001b4;x+			packet.data    = addr;
+			ret |= sisusb_send_bridge_packet(sisusb, 10,
+								&packet, 0);
+			packet.header  = 0x001f;
+			packet.address = 0x000001a4;x+			packet.data    = 0x00000001;
+			ret |= sisusb_send_bridge_packet(sisusb, 10,
+								&packet, 0);
+			if (userbuffer) {
+				ret |= sisusb_recv_bulk_msg(sisusb,
+							SISUSB_EP_GFX_BULK_IN,
+							(length & ~3),
+							NULL, userbuffer,x+							bytes_read, 0);
+				if (!ret) userbuffer += (*bytes_read);
+			} else {
+				ret |= sisusb_recv_bulk_msg(sisusb,
+							SISUSB_EP_GFX_BULK_IN,
+							(length & ~3),
+							kernbuffer, NULL,x+							bytes_read, 0);
+				if (!ret) kernbuffer += (*bytes_read);
+			}
+			addr += (*bytes_read);
+			length -= (*bytes_read);
+#endif
+	    }
+
+	    if (ret)x+	    	break;
+	}
+
+	return ret;
+}
+
+/* High level: Gfx (indexed) register access */
+
+static int
+sisusb_setidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 data)x+{
+	int ret;
+	ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, index);
+	ret |= sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, data);
+	return ret;
+}
+
+static int
+sisusb_getidxreg(struct sisusb_usb_data *sisusb, int port, u8 index, u8 *data)x+{
+	int ret;
+	ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, index);
+	ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, data);
+	return ret;
+}
+
+static int
+sisusb_setidxregandor(struct sisusb_usb_data *sisusb, int port, u8 idx,x+							u8 myand, u8 myor)x+{
+	int ret;
+	u8 tmp;
+
+	ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, idx);
+	ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, &tmp);
+	tmp &= myand;
+	tmp |= myor;
+	ret |= sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, tmp);
+	return ret;
+}
+
+static int
+sisusb_setidxregmask(struct sisusb_usb_data *sisusb, int port, u8 idx,x+							u8 data, u8 mask)x+{
+	int ret;
+	u8 tmp;
+	ret = sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, idx);
+	ret |= sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, &tmp);
+	tmp &= ~(mask);
+	tmp |= (data & mask);
+	ret |= sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port + 1, tmp);
+	return ret;
+}
+
+static int
+sisusb_setidxregor(struct sisusb_usb_data *sisusb, int port, u8 index, u8 myor)x+{
+	return(sisusb_setidxregandor(sisusb, port, index, 0xff, myor));
+}
+
+static int
+sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port, u8 idx, u8 myand)x+{
+	return(sisusb_setidxregandor(sisusb, port, idx, myand, 0x00));
+}
+
+/* access pci config registers (reg numbers 0, 4, 8, etc) */
+
+static int
+sisusb_write_pci_config(struct sisusb_usb_data *sisusb, int regnum, u32 data)x+{
+	struct sisusb_packet packet;
+	int ret;
+
+	packet.header = 0x008f;
+	packet.address = regnum | 0x10000;x+	packet.data = data;
+	ret = sisusb_send_packet(sisusb, 10, &packet);
+	return ret;
+}
+
+static int
+sisusb_read_pci_config(struct sisusb_usb_data *sisusb, int regnum, u32 *data)x+{
+	struct sisusb_packet packet;
+	int ret;
+
+	packet.header = 0x008f;
+	packet.address = (u32)regnum | 0x10000;x+	ret = sisusb_send_packet(sisusb, 6, &packet);
+	*data = packet.data;
+	return ret;
+}
+
+/* Clear video RAM */
+
+static int
+sisusb_clear_vram(struct sisusb_usb_data *sisusb, u32 address, int length)x+{
+	int ret, i, j;
+
+	if (address < sisusb->vrambase)x+		return 1;
+
+	if (address >= sisusb->vrambase + sisusb->vramsize)
+		return 1;
+
+	if (address + length > sisusb->vrambase + sisusb->vramsize)
+		length = sisusb->vrambase + sisusb->vramsize - address;
+
+	if (length <= 0)x+		return 0;
+
+	/* allocate free buffer/urb and clear the buffer */
+	if ((i = sisusb_alloc_outbuf(sisusb)) < 0)x+		return -EBUSY;
+
+	memset(sisusb->obuf[i], 0, sisusb->obufsize);
+
+	/* We can write a length > buffer size here. The bufferx+	 * data will simply be re-used (like a ring-buffer).x+	 */
+	ret = sisusb_write_mem_bulk(sisusb, address, NULL, length, NULL, i, &j);
+
+	/* Free the buffer/urb */
+	sisusb_free_outbuf(sisusb, i);
+
+	return ret;
+}
+
+/* Initialize the graphics core (return 0 on success)x+ * This resets the graphics hardware and puts it intox+ * a defined mode (640x480@60Hz)x+ */
+
+#define GETREG(r,d)     sisusb_read_memio_byte(sisusb, SISUSB_TYPE_IO, r, d)x+#define SETREG(r,d)	sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, r, d)x+#define SETIREG(r,i,d)	sisusb_setidxreg(sisusb, r, i, d)x+#define GETIREG(r,i,d)  sisusb_getidxreg(sisusb, r, i, d)x+#define SETIREGOR(r,i,o)	sisusb_setidxregor(sisusb, r, i, o)x+#define SETIREGAND(r,i,a)	sisusb_setidxregand(sisusb, r, i, a)x+#define SETIREGANDOR(r,i,a,o)	sisusb_setidxregandor(sisusb, r, i, a, o)x+#define READL(a,d)	sisusb_read_memio_long(sisusb, SISUSB_TYPE_MEM, a, d)x+#define WRITEL(a,d) 	sisusb_write_memio_long(sisusb, SISUSB_TYPE_MEM, a, d)x+#define READB(a,d)	sisusb_read_memio_byte(sisusb, SISUSB_TYPE_MEM, a, d)x+#define WRITEB(a,d) 	sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, a, d)x+
+static int
+sisusb_triggersr16(struct sisusb_usb_data *sisusb, u8 ramtype)x+{
+	int ret;
+	u8 tmp8;
+
+	ret = GETIREG(SISSR, 0x16, &tmp8);
+	if (ramtype <= 1) {
+		tmp8 &= 0x3f;
+		ret |= SETIREG(SISSR, 0x16, tmp8);
+		tmp8 |= 0x80;
+		ret |= SETIREG(SISSR, 0x16, tmp8);
+	} else {
+		tmp8 |= 0xc0;
+		ret |= SETIREG(SISSR, 0x16, tmp8);
+		tmp8 &= 0x0f;
+		ret |= SETIREG(SISSR, 0x16, tmp8);
+		tmp8 |= 0x80;
+		ret |= SETIREG(SISSR, 0x16, tmp8);
+		tmp8 &= 0x0f;
+		ret |= SETIREG(SISSR, 0x16, tmp8);
+		tmp8 |= 0xd0;
+		ret |= SETIREG(SISSR, 0x16, tmp8);
+		tmp8 &= 0x0f;
+		ret |= SETIREG(SISSR, 0x16, tmp8);
+		tmp8 |= 0xa0;
+		ret |= SETIREG(SISSR, 0x16, tmp8);
+	}
+	return ret;
+}
+
+static int
+sisusb_getbuswidth(struct sisusb_usb_data *sisusb, int *bw, int *chab)x+{
+	int ret;
+	u8  ramtype, done = 0;
+	u32 t0, t1, t2, t3;
+	u32 ramptr = SISUSB_PCI_MEMBASE;
+
+	ret = GETIREG(SISSR, 0x3a, &ramtype);
+	ramtype &= 3;
+
+	ret |= SETIREG(SISSR, 0x13, 0x00);
+
+	if (ramtype <= 1) {
+		ret |= SETIREG(SISSR, 0x14, 0x12);
+		ret |= SETIREGAND(SISSR, 0x15, 0xef);
+	} else {
+		ret |= SETIREG(SISSR, 0x14, 0x02);
+	}
+
+	ret |= sisusb_triggersr16(sisusb, ramtype);
+	ret |= WRITEL(ramptr +  0, 0x01234567);
+	ret |= WRITEL(ramptr +  4, 0x456789ab);
+	ret |= WRITEL(ramptr +  8, 0x89abcdef);
+	ret |= WRITEL(ramptr + 12, 0xcdef0123);
+	ret |= WRITEL(ramptr + 16, 0x55555555);
+	ret |= WRITEL(ramptr + 20, 0x55555555);
+	ret |= WRITEL(ramptr + 24, 0xffffffff);
+	ret |= WRITEL(ramptr + 28, 0xffffffff);
+	ret |= READL(ramptr +  0, &t0);
+	ret |= READL(ramptr +  4, &t1);
+	ret |= READL(ramptr +  8, &t2);
+	ret |= READL(ramptr + 12, &t3);
+
+	if (ramtype <= 1) {
+
+		*chab = 0; *bw = 64;x+
+		if ((t3 != 0xcdef0123) || (t2 != 0x89abcdef)) {
+			if ((t1 == 0x456789ab) && (t0 == 0x01234567)) {
+				*chab = 0; *bw = 64;x+				ret |= SETIREGAND(SISSR, 0x14, 0xfd);
+			}
+		}
+		if ((t1 != 0x456789ab) || (t0 != 0x01234567)) {
+			*chab = 1; *bw = 64;x+			ret |= SETIREGANDOR(SISSR, 0x14, 0xfc,0x01);x+x+			ret |= sisusb_triggersr16(sisusb, ramtype);
+			ret |= WRITEL(ramptr +  0, 0x89abcdef);
+			ret |= WRITEL(ramptr +  4, 0xcdef0123);
+			ret |= WRITEL(ramptr +  8, 0x55555555);
+			ret |= WRITEL(ramptr + 12, 0x55555555);
+			ret |= WRITEL(ramptr + 16, 0xaaaaaaaa);
+			ret |= WRITEL(ramptr + 20, 0xaaaaaaaa);
+			ret |= READL(ramptr +  4, &t1);
+
+			if (t1 != 0xcdef0123) {
+				*bw = 32;x+				ret |= SETIREGOR(SISSR, 0x15, 0x10);
+			}
+		}
+
+	} else {
+
+		*chab = 0; *bw = 64;	/* default: cha, bw = 64 */
+
+		done = 0;
+
+		if (t1 == 0x456789ab) {
+			if (t0 == 0x01234567) {
+				*chab = 0; *bw = 64;x+				done = 1;
+			}
+		} else {
+			if (t0 == 0x01234567) {
+				*chab = 0; *bw = 32;x+				ret |= SETIREG(SISSR, 0x14, 0x00);
+				done = 1;
+			}
+		}
+
+		if (!done) {
+			ret |= SETIREG(SISSR, 0x14, 0x03);
+			ret |= sisusb_triggersr16(sisusb, ramtype);
+
+			ret |= WRITEL(ramptr +  0, 0x01234567);
+			ret |= WRITEL(ramptr +  4, 0x456789ab);
+			ret |= WRITEL(ramptr +  8, 0x89abcdef);
+			ret |= WRITEL(ramptr + 12, 0xcdef0123);
+			ret |= WRITEL(ramptr + 16, 0x55555555);
+			ret |= WRITEL(ramptr + 20, 0x55555555);
+			ret |= WRITEL(ramptr + 24, 0xffffffff);
+			ret |= WRITEL(ramptr + 28, 0xffffffff);
+			ret |= READL(ramptr +  0, &t0);
+			ret |= READL(ramptr +  4, &t1);
+
+			if (t1 == 0x456789ab) {
+				if (t0 == 0x01234567) {
+					*chab = 1; *bw = 64;x+					return ret;
+				} /* else error */
+			} else {
+				if (t0 == 0x01234567) {
+					*chab = 1; *bw = 32;x+					ret |= SETIREG(SISSR, 0x14, 0x01);
+				} /* else error */
+			}
+		}
+	}
+	return ret;
+}
+
+static int
+sisusb_verify_mclk(struct sisusb_usb_data *sisusb)x+{
+	int ret = 0;
+	u32 ramptr = SISUSB_PCI_MEMBASE;
+	u8 tmp1, tmp2, i, j;
+
+	ret |= WRITEB(ramptr, 0xaa);
+	ret |= WRITEB(ramptr + 16, 0x55);
+	ret |= READB(ramptr, &tmp1);
+	ret |= READB(ramptr + 16, &tmp2);
+	if ((tmp1 != 0xaa) || (tmp2 != 0x55)) {
+		for (i = 0, j = 16; i < 2; i++, j += 16) {
+			ret |= GETIREG(SISSR, 0x21, &tmp1);
+			ret |= SETIREGAND(SISSR, 0x21, (tmp1 & 0xfb));
+			ret |= SETIREGOR(SISSR, 0x3c, 0x01);  /* not on 330 */
+			ret |= SETIREGAND(SISSR, 0x3c, 0xfe); /* not on 330 */
+			ret |= SETIREG(SISSR, 0x21, tmp1);
+			ret |= WRITEB(ramptr + 16 + j, j);
+			ret |= READB(ramptr + 16 + j, &tmp1);
+			if (tmp1 == j) {
+				ret |= WRITEB(ramptr + j, j);
+				break;
+			}
+		}
+	}
+	return ret;
+}
+
+static int
+sisusb_set_rank(struct sisusb_usb_data *sisusb, int *iret, int index,x+			u8 rankno, u8 chab, const u8 dramtype[][5],
+			int bw)x+{
+	int ret = 0, ranksize;
+	u8 tmp;
+
+	*iret = 0;
+
+	if ((rankno == 2) && (dramtype[index][0] == 2))x+		return ret;
+
+	ranksize = dramtype[index][3] / 2 * bw / 32;
+
+	if ((ranksize * rankno) > 128)x+		return ret;
+
+	tmp = 0;
+	while ((ranksize >>= 1) > 0) tmp += 0x10;
+	tmp |= ((rankno - 1) << 2);
+	tmp |= ((bw / 64) & 0x02);
+	tmp |= (chab & 0x01);x+x+	ret = SETIREG(SISSR, 0x14, tmp);
+	ret |= sisusb_triggersr16(sisusb, 0); /* sic! */
+
+	*iret = 1;
+
+	return ret;
+}
+
+static int
+sisusb_check_rbc(struct sisusb_usb_data *sisusb, int *iret, u32 inc, int testn)x+{
+	int ret = 0, i;
+	u32 j, tmp;
+
+	*iret = 0;
+
+	for (i = 0, j = 0; i < testn; i++) {
+		ret |= WRITEL(sisusb->vrambase + j, j);
+		j += inc;
+	}
+
+	for (i = 0, j = 0; i < testn; i++) {
+		ret |= READL(sisusb->vrambase + j, &tmp);
+		if (tmp != j) return ret;
+		j += inc;
+	}
+
+	*iret = 1;
+	return ret;
+}
+
+static int
+sisusb_check_ranks(struct sisusb_usb_data *sisusb, int *iret, int rankno,
+					int idx, int bw, const u8 rtype[][5])x+{
+	int ret = 0, i, i2ret;
+	u32 inc;
+
+	*iret = 0;
+
+	for (i = rankno; i >= 1; i--) {
+		inc = 1 << (rtype[idx][2] +
+			    rtype[idx][1] +
+			    rtype[idx][0] +
+			    bw / 64 + i);
+		ret |= sisusb_check_rbc(sisusb, &i2ret, inc, 2);
+		if (!i2ret)
+			return ret;
+	}
+
+	inc = 1 << (rtype[idx][2] + bw / 64 + 2);
+	ret |= sisusb_check_rbc(sisusb, &i2ret, inc, 4);
+	if (!i2ret)
+		return ret;
+
+	inc = 1 << (10 + bw / 64);
+	ret |= sisusb_check_rbc(sisusb, &i2ret, inc, 2);
+	if (!i2ret)
+		return ret;
+
+	*iret = 1;
+	return ret;
+}
+
+static int
+sisusb_get_sdram_size(struct sisusb_usb_data *sisusb, int *iret, int bw,
+								int chab)x+{
+	int ret = 0, i2ret = 0, i, j;
+	static const u8 sdramtype[13][5] = {
+		{ 2, 12, 9, 64, 0x35 },
+		{ 1, 13, 9, 64, 0x44 },
+		{ 2, 12, 8, 32, 0x31 },
+		{ 2, 11, 9, 32, 0x25 },
+		{ 1, 12, 9, 32, 0x34 },
+		{ 1, 13, 8, 32, 0x40 },
+		{ 2, 11, 8, 16, 0x21 },
+		{ 1, 12, 8, 16, 0x30 },
+		{ 1, 11, 9, 16, 0x24 },
+		{ 1, 11, 8,  8, 0x20 },
+		{ 2,  9, 8,  4, 0x01 },
+		{ 1, 10, 8,  4, 0x10 },
+		{ 1,  9, 8,  2, 0x00 }
+	};
+
+	*iret = 1; /* error */
+
+	for (i = 0; i < 13; i++) {
+		ret |= SETIREGANDOR(SISSR, 0x13, 0x80, sdramtype[i][4]);
+		for (j = 2; j > 0; j--) {
+			ret |= sisusb_set_rank(sisusb, &i2ret, i, j,
+						chab, sdramtype, bw);
+			if (!i2ret)
+				continue;
+
+			ret |= sisusb_check_ranks(sisusb, &i2ret, j, i,x+						bw, sdramtype);
+			if (i2ret) {
+				*iret = 0;	/* ram size found */x+				return ret;
+			}
+		}
+	}
+
+	return ret;
+}
+
+static int
+sisusb_setup_screen(struct sisusb_usb_data *sisusb, int clrall, int drwfr)x+{
+	int ret = 0;
+	u32 address;
+	int i, length, modex, modey, bpp;
+
+	modex = 640; modey = 480; bpp = 2;
+
+	address = sisusb->vrambase;	/* Clear video ram */
+
+	if (clrall)
+		length = sisusb->vramsize;
+	else
+		length = modex * bpp * modey;
+
+	ret = sisusb_clear_vram(sisusb, address, length);
+
+	if (!ret && drwfr) {
+		for (i = 0; i < modex; i++) {
+			address = sisusb->vrambase + (i * bpp);
+			ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM,
+							address, 0xf100);
+			address += (modex * (modey-1) * bpp);
+			ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM,
+							address, 0xf100);
+		}
+		for (i = 0; i < modey; i++) {
+			address = sisusb->vrambase + ((i * modex) * bpp);
+			ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM,
+							address, 0xf100);
+			address += ((modex - 1) * bpp);
+			ret |= sisusb_write_memio_word(sisusb, SISUSB_TYPE_MEM,
+							address, 0xf100);
+		}
+	}
+
+	return ret;
+}
+
+static int
+sisusb_set_default_mode(struct sisusb_usb_data *sisusb, int touchengines)x+{
+	int ret = 0, i, j, modex, modey, bpp, du;
+	u8 sr31, cr63, tmp8;
+	static const char attrdata[] = {
+		0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
+		0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,
+		0x01,0x00,0x00,0x00
+	};
+	static const char crtcrdata[] = {
+		0x5f,0x4f,0x50,0x82,0x54,0x80,0x0b,0x3e,
+		0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,
+		0xea,0x8c,0xdf,0x28,0x40,0xe7,0x04,0xa3,
+		0xff
+	};
+	static const char grcdata[] = {
+		0x00,0x00,0x00,0x00,0x00,0x40,0x05,0x0f,
+		0xff
+	};
+	static const char crtcdata[] = {
+		0x5f,0x4f,0x4f,0x83,0x55,0x81,0x0b,0x3e,
+		0xe9,0x8b,0xdf,0xe8,0x0c,0x00,0x00,0x05,
+		0x00
+	};
+
+	modex = 640; modey = 480; bpp = 2;
+
+	GETIREG(SISSR, 0x31, &sr31);
+	GETIREG(SISCR, 0x63, &cr63);
+	SETIREGOR(SISSR, 0x01, 0x20);
+	SETIREG(SISCR, 0x63, cr63 & 0xbf);
+	SETIREGOR(SISCR, 0x17, 0x80);
+	SETIREGOR(SISSR, 0x1f, 0x04);
+	SETIREGAND(SISSR, 0x07, 0xfb);
+	SETIREG(SISSR, 0x00, 0x03);	/* seq */
+	SETIREG(SISSR, 0x01, 0x21);
+	SETIREG(SISSR, 0x02, 0x0f);
+	SETIREG(SISSR, 0x03, 0x00);
+	SETIREG(SISSR, 0x04, 0x0e);
+	SETREG(SISMISCW, 0x23);		/* misc */
+	for (i = 0; i <= 0x18; i++) {	/* crtc */x+		SETIREG(SISCR, i, crtcrdata[i]);
+	}
+	for (i = 0; i <= 0x13; i++) {	/* att */x+		GETREG(SISINPSTAT, &tmp8);
+		SETREG(SISAR, i);
+		SETREG(SISAR, attrdata[i]);
+	}
+	GETREG(SISINPSTAT, &tmp8);
+	SETREG(SISAR, 0x14);
+	SETREG(SISAR, 0x00);
+	GETREG(SISINPSTAT, &tmp8);
+	SETREG(SISAR, 0x20);
+	GETREG(SISINPSTAT, &tmp8);
+	for (i = 0; i <= 0x08; i++) {	/* grc */x+		SETIREG(SISGR, i, grcdata[i]);
+	}
+	SETIREGAND(SISGR, 0x05, 0xbf);
+	for (i = 0x0A; i <= 0x0E; i++) {	/* clr ext */x+		SETIREG(SISSR, i, 0x00);
+	}
+	SETIREGAND(SISSR, 0x37, 0xfe);
+	SETREG(SISMISCW, 0xef);		/* sync */
+	SETIREG(SISCR, 0x11, 0x00);	/* crtc */x+	for (j = 0x00, i = 0; i <= 7; i++, j++) {
+		SETIREG(SISCR, j, crtcdata[i]);
+	}
+	for (j = 0x10; i <= 10; i++, j++) {
+		SETIREG(SISCR, j, crtcdata[i]);
+	}
+	for (j = 0x15; i <= 12; i++, j++) {
+		SETIREG(SISCR, j, crtcdata[i]);
+	}
+	for (j = 0x0A; i <= 15; i++, j++) {
+		SETIREG(SISSR, j, crtcdata[i]);
+	}
+	SETIREG(SISSR, 0x0E, (crtcdata[16] & 0xE0));
+	SETIREGANDOR(SISCR, 0x09, 0x5f, ((crtcdata[16] & 0x01) << 5));
+	SETIREG(SISCR, 0x14, 0x4f);
+	du = (modex / 16) * (bpp * 2);	/* offset/pitch */
+	if (modex % 16) du += bpp;
+	SETIREGANDOR(SISSR, 0x0e, 0xf0, ((du >> 8) & 0x0f));
+	SETIREG(SISCR, 0x13, (du & 0xff));
+	du <<= 5;
+	tmp8 = du >> 8;
+	if (du & 0xff) tmp8++;
+	SETIREG(SISSR, 0x10, tmp8);
+	SETIREG(SISSR, 0x31, 0x00);	/* VCLK */
+	SETIREG(SISSR, 0x2b, 0x1b);
+	SETIREG(SISSR, 0x2c, 0xe1);
+	SETIREG(SISSR, 0x2d, 0x01);
+	SETIREGAND(SISSR, 0x3d, 0xfe);	/* FIFO */
+	SETIREG(SISSR, 0x08, 0xae);
+	SETIREGAND(SISSR, 0x09, 0xf0);
+	SETIREG(SISSR, 0x08, 0x34);
+	SETIREGOR(SISSR, 0x3d, 0x01);
+	SETIREGAND(SISSR, 0x1f, 0x3f);	/* mode regs */
+	SETIREGANDOR(SISSR, 0x06, 0xc0, 0x0a);
+	SETIREG(SISCR, 0x19, 0x00);
+	SETIREGAND(SISCR, 0x1a, 0xfc);
+	SETIREGAND(SISSR, 0x0f, 0xb7);
+	SETIREGAND(SISSR, 0x31, 0xfb);
+	SETIREGANDOR(SISSR, 0x21, 0x1f, 0xa0);
+	SETIREGAND(SISSR, 0x32, 0xf3);
+	SETIREGANDOR(SISSR, 0x07, 0xf8, 0x03);
+	SETIREG(SISCR, 0x52, 0x6c);
+
+	SETIREG(SISCR, 0x0d, 0x00);	/* adjust frame */
+	SETIREG(SISCR, 0x0c, 0x00);
+	SETIREG(SISSR, 0x0d, 0x00);
+	SETIREGAND(SISSR, 0x37, 0xfe);
+
+	SETIREG(SISCR, 0x32, 0x20);
+	SETIREGAND(SISSR, 0x01, 0xdf);	/* enable display */
+	SETIREG(SISCR, 0x63, (cr63 & 0xbf));
+	SETIREG(SISSR, 0x31, (sr31 & 0xfb));
+
+	if (touchengines) {
+		SETIREG(SISSR, 0x20, 0xa1);	/* enable engines */x+		SETIREGOR(SISSR, 0x1e, 0x5a);
+
+		SETIREG(SISSR, 0x26, 0x01);	/* disable cmdqueue */x+		SETIREG(SISSR, 0x27, 0x1f);
+		SETIREG(SISSR, 0x26, 0x00);
+	}
+
+	SETIREG(SISCR, 0x34, 0x44);  	/* we just set std mode #44 */
+
+	return ret;
+}
+
+static int
+sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)x+{
+	int ret = 0, i, j, bw, chab, iret, retry = 3;
+	u8 tmp8, ramtype;
+	u32 tmp32;
+	static const char mclktable[] = {
+		0x3b, 0x22, 0x01, 143,
+		0x3b, 0x22, 0x01, 143,
+		0x3b, 0x22, 0x01, 143,
+		0x3b, 0x22, 0x01, 143
+	};
+	static const char eclktable[] = {
+		0x3b, 0x22, 0x01, 143,
+		0x3b, 0x22, 0x01, 143,
+		0x3b, 0x22, 0x01, 143,
+		0x3b, 0x22, 0x01, 143
+	};
+	static const char ramtypetable1[] = {
+		0x00, 0x04, 0x60, 0x60,
+		0x0f, 0x0f, 0x1f, 0x1f,
+		0xba, 0xba, 0xba, 0xba,
+		0xa9, 0xa9, 0xac, 0xac,
+		0xa0, 0xa0, 0xa0, 0xa8,
+		0x00, 0x00, 0x02, 0x02,
+		0x30, 0x30, 0x40, 0x40
+	};
+	static const char ramtypetable2[] = {
+		0x77, 0x77, 0x44, 0x44,
+		0x77, 0x77, 0x44, 0x44,
+		0x00, 0x00, 0x00, 0x00,
+		0x5b, 0x5b, 0xab, 0xab,
+		0x00, 0x00, 0xf0, 0xf8
+	};
+
+	while (retry--) {
+
+		/* Enable VGA */x+		ret = GETREG(SISVGAEN, &tmp8);
+		ret |= SETREG(SISVGAEN, (tmp8 | 0x01));
+
+		/* Enable GPU access to VRAM */
+		ret |= GETREG(SISMISCR, &tmp8);
+		ret |= SETREG(SISMISCW, (tmp8 | 0x01));
+
+		if (ret) continue;
+
+		/* Reset registers */
+		ret |= SETIREGAND(SISCR, 0x5b, 0xdf);
+		ret |= SETIREG(SISSR, 0x05, 0x86);
+		ret |= SETIREGOR(SISSR, 0x20, 0x01);x+x+		ret |= SETREG(SISMISCW, 0x67);x+x+		for (i = 0x06; i <= 0x1f; i++) {
+			ret |= SETIREG(SISSR, i, 0x00);
+		}
+		for (i = 0x21; i <= 0x27; i++) {
+			ret |= SETIREG(SISSR, i, 0x00);
+		}
+		for (i = 0x31; i <= 0x3d; i++) {
+			ret |= SETIREG(SISSR, i, 0x00);
+		}
+		for (i = 0x12; i <= 0x1b; i++) {
+			ret |= SETIREG(SISSR, i, 0x00);
+		}
+		for (i = 0x79; i <= 0x7c; i++) {
+			ret |= SETIREG(SISCR, i, 0x00);
+		}
+
+		if (ret) continue;
+
+		ret |= SETIREG(SISCR, 0x63, 0x80);
+
+		ret |= GETIREG(SISSR, 0x3a, &ramtype);
+		ramtype &= 0x03;
+
+		ret |= SETIREG(SISSR, 0x28, mclktable[ramtype * 4]);
+		ret |= SETIREG(SISSR, 0x29, mclktable[(ramtype * 4) + 1]);
+		ret |= SETIREG(SISSR, 0x2a, mclktable[(ramtype * 4) + 2]);
+
+		ret |= SETIREG(SISSR, 0x2e, eclktable[ramtype * 4]);
+		ret |= SETIREG(SISSR, 0x2f, eclktable[(ramtype * 4) + 1]);
+		ret |= SETIREG(SISSR, 0x30, eclktable[(ramtype * 4) + 2]);
+
+		ret |= SETIREG(SISSR, 0x07, 0x18);
+		ret |= SETIREG(SISSR, 0x11, 0x0f);
+
+		if (ret) continue;
+
+		for (i = 0x15, j = 0; i <= 0x1b; i++, j++) {
+			ret |= SETIREG(SISSR, i, ramtypetable1[(j*4) + ramtype]);
+		}
+		for (i = 0x40, j = 0; i <= 0x44; i++, j++) {
+			ret |= SETIREG(SISCR, i, ramtypetable2[(j*4) + ramtype]);
+		}
+
+		ret |= SETIREG(SISCR, 0x49, 0xaa);
+
+		ret |= SETIREG(SISSR, 0x1f, 0x00);
+		ret |= SETIREG(SISSR, 0x20, 0xa0);
+		ret |= SETIREG(SISSR, 0x23, 0xf6);
+		ret |= SETIREG(SISSR, 0x24, 0x0d);
+		ret |= SETIREG(SISSR, 0x25, 0x33);
+
+		ret |= SETIREG(SISSR, 0x11, 0x0f);
+
+		ret |= SETIREGOR(SISPART1, 0x2f, 0x01);x+x+		ret |= SETIREGAND(SISCAP, 0x3f, 0xef);
+
+		if (ret) continue;
+
+		ret |= SETIREG(SISPART1, 0x00, 0x00);
+
+		ret |= GETIREG(SISSR, 0x13, &tmp8);
+		tmp8 >>= 4;
+
+		ret |= SETIREG(SISPART1, 0x02, 0x00);
+		ret |= SETIREG(SISPART1, 0x2e, 0x08);
+
+		ret |= sisusb_read_pci_config(sisusb, 0x50, &tmp32);
+		tmp32 &= 0x00f00000;x+		tmp8 = (tmp32 == 0x100000) ? 0x33 : 0x03;
+		ret |= SETIREG(SISSR, 0x25, tmp8);
+		tmp8 = (tmp32 == 0x100000) ? 0xaa : 0x88;
+		ret |= SETIREG(SISCR, 0x49, tmp8);
+
+		ret |= SETIREG(SISSR, 0x27, 0x1f);
+		ret |= SETIREG(SISSR, 0x31, 0x00);
+		ret |= SETIREG(SISSR, 0x32, 0x11);
+		ret |= SETIREG(SISSR, 0x33, 0x00);
+
+		if (ret) continue;
+
+		ret |= SETIREG(SISCR, 0x83, 0x00);
+
+		ret |= sisusb_set_default_mode(sisusb, 0);x+x+		ret |= SETIREGAND(SISSR, 0x21, 0xdf);
+		ret |= SETIREGOR(SISSR, 0x01, 0x20);
+		ret |= SETIREGOR(SISSR, 0x16, 0x0f);
+
+		ret |= sisusb_triggersr16(sisusb, ramtype);
+
+		/* Disable refresh */
+		ret |= SETIREGAND(SISSR, 0x17, 0xf8);
+		ret |= SETIREGOR(SISSR, 0x19, 0x03);
+
+		ret |= sisusb_getbuswidth(sisusb, &bw, &chab);
+		ret |= sisusb_verify_mclk(sisusb);
+
+		if (ramtype <= 1) {
+			ret |= sisusb_get_sdram_size(sisusb, &iret, bw, chab);
+			if (iret) {
+				printk(KERN_ERR "sisusbvga[%d]: RAM size "x+					"detection failed, "x+					"assuming 8MB video RAM\n",
+					sisusb->minor);
+				ret |= SETIREG(SISSR,0x14,0x31);
+				/* TODO */
+			}
+		} else {
+			printk(KERN_ERR "sisusbvga[%d]: DDR RAM device found, "x+					"assuming 8MB video RAM\n",
+					sisusb->minor);
+			ret |= SETIREG(SISSR,0x14,0x31);
+			/* *** TODO *** */
+		}
+
+		/* Enable refresh */
+		ret |= SETIREG(SISSR, 0x16, ramtypetable1[4 + ramtype]);
+		ret |= SETIREG(SISSR, 0x17, ramtypetable1[8 + ramtype]);
+		ret |= SETIREG(SISSR, 0x19, ramtypetable1[16 + ramtype]);
+
+		ret |= SETIREGOR(SISSR, 0x21, 0x20);
+
+		ret |= SETIREG(SISSR, 0x22, 0xfb);
+		ret |= SETIREG(SISSR, 0x21, 0xa5);
+
+		if (ret == 0)
+			break;
+	}
+
+	return ret;
+}
+
+#undef SETREG
+#undef GETREG
+#undef SETIREG
+#undef GETIREG
+#undef SETIREGOR
+#undef SETIREGAND
+#undef SETIREGANDOR
+#undef READL
+#undef WRITEL
+
+static void
+sisusb_get_ramconfig(struct sisusb_usb_data *sisusb)x+{
+	u8 tmp8, tmp82, ramtype;
+	int bw = 0;
+	char *ramtypetext1 = NULL;
+	const char *ramtypetext2[] = {	"SDR SDRAM", "SDR SGRAM",x+					"DDR SDRAM", "DDR SGRAM" };
+	static const int busSDR[4]  = {64, 64, 128, 128};
+	static const int busDDR[4]  = {32, 32,  64,  64};
+	static const int busDDRA[4] = {64+32, 64+32 , (64+32)*2, (64+32)*2};
+
+	sisusb_getidxreg(sisusb, SISSR, 0x14, &tmp8);
+	sisusb_getidxreg(sisusb, SISSR, 0x15, &tmp82);
+	sisusb_getidxreg(sisusb, SISSR, 0x3a, &ramtype);
+	sisusb->vramsize = (1 << ((tmp8 & 0xf0) >> 4)) * 1024 * 1024;
+	ramtype &= 0x03;
+	switch ((tmp8 >> 2) & 0x03) {
+	case 0: ramtypetext1 = "1 ch/1 r";
+		if (tmp82 & 0x10) {
+			bw = 32;x+		} else {
+			bw = busSDR[(tmp8 & 0x03)];
+		}
+		break;
+	case 1: ramtypetext1 = "1 ch/2 r";
+		sisusb->vramsize <<= 1;
+		bw = busSDR[(tmp8 & 0x03)];
+		break;
+	case 2: ramtypetext1 = "asymmeric";
+		sisusb->vramsize += sisusb->vramsize/2;
+		bw = busDDRA[(tmp8 & 0x03)];
+		break;
+	case 3: ramtypetext1 = "2 channel";
+		sisusb->vramsize <<= 1;
+		bw = busDDR[(tmp8 & 0x03)];
+		break;
+	}
+
+	printk(KERN_INFO "sisusbvga[%d]: %dMB %s %s, bus width %d\n",
+			sisusb->minor, (sisusb->vramsize >> 20), ramtypetext1,
+			ramtypetext2[ramtype], bw);
+}
+
+static int
+sisusb_do_init_gfxdevice(struct sisusb_usb_data *sisusb)x+{
+	struct sisusb_packet packet;
+	int ret;
+	u32 tmp32;
+
+	/* Do some magic */x+	packet.header  = 0x001f;
+	packet.address = 0x00000324;
+	packet.data    = 0x00000004;x+	ret = sisusb_send_bridge_packet(sisusb, 10, &packet, 0);
+x+	packet.header  = 0x001f;
+	packet.address = 0x00000364;
+	packet.data    = 0x00000004;x+	ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0);
+x+	packet.header  = 0x001f;
+	packet.address = 0x00000384;
+	packet.data    = 0x00000004;x+	ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0);
+x+	packet.header  = 0x001f;
+	packet.address = 0x00000100;x+	packet.data    = 0x00000700;x+	ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0);
+x+	packet.header  = 0x000f;
+	packet.address = 0x00000004;x+	ret |= sisusb_send_bridge_packet(sisusb, 6, &packet, 0);
+	packet.data |= 0x17;x+	ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0);
+x+	/* Init BAR 0 (VRAM) */
+	ret |= sisusb_read_pci_config(sisusb, 0x10, &tmp32);
+	ret |= sisusb_write_pci_config(sisusb, 0x10, 0xfffffff0);
+	ret |= sisusb_read_pci_config(sisusb, 0x10, &tmp32);
+	tmp32 &= 0x0f;
+	tmp32 |= SISUSB_PCI_MEMBASE;
+	ret |= sisusb_write_pci_config(sisusb, 0x10, tmp32);
+x+	/* Init BAR 1 (MMIO) */
+	ret |= sisusb_read_pci_config(sisusb, 0x14, &tmp32);
+	ret |= sisusb_write_pci_config(sisusb, 0x14, 0xfffffff0);
+	ret |= sisusb_read_pci_config(sisusb, 0x14, &tmp32);
+	tmp32 &= 0x0f;
+	tmp32 |= SISUSB_PCI_MMIOBASE;
+	ret |= sisusb_write_pci_config(sisusb, 0x14, tmp32);
+x+	/* Init BAR 2 (i/o ports) */
+	ret |= sisusb_read_pci_config(sisusb, 0x18, &tmp32);
+	ret |= sisusb_write_pci_config(sisusb, 0x18, 0xfffffff0);
+	ret |= sisusb_read_pci_config(sisusb, 0x18, &tmp32);
+	tmp32 &= 0x0f;
+	tmp32 |= SISUSB_PCI_IOPORTBASE;
+	ret |= sisusb_write_pci_config(sisusb, 0x18, tmp32);
+x+	/* Enable memory and i/o access */
+	ret |= sisusb_read_pci_config(sisusb, 0x04, &tmp32);
+	tmp32 |= 0x3;
+	ret |= sisusb_write_pci_config(sisusb, 0x04, tmp32);
+x+	if (ret == 0) {
+		/* Some further magic */x+		packet.header  = 0x001f;
+		packet.address = 0x00000050;
+		packet.data    = 0x000000ff;
+		ret |= sisusb_send_bridge_packet(sisusb, 10, &packet, 0);
+	}
+
+	return ret;
+}
+
+/* Initialize the graphics device (return 0 on success)x+ * This initializes the net2280 as well as the PCI registersx+ * of the graphics board.x+ */
+
+static int
+sisusb_init_gfxdevice(struct sisusb_usb_data *sisusb, int initscreen)x+{
+	int ret = 0, test = 0;
+	u32 tmp32;
+
+	if (sisusb->devinit == 1) {
+		/* Read PCI BARs and see if they have been set up */
+		ret |= sisusb_read_pci_config(sisusb, 0x10, &tmp32);
+		if (ret) return ret;
+		if ((tmp32 & 0xfffffff0) == SISUSB_PCI_MEMBASE) test++;
+
+		ret |= sisusb_read_pci_config(sisusb, 0x14, &tmp32);
+		if (ret) return ret;
+		if ((tmp32 & 0xfffffff0) == SISUSB_PCI_MMIOBASE) test++;
+
+		ret |= sisusb_read_pci_config(sisusb, 0x18, &tmp32);
+		if (ret) return ret;
+		if ((tmp32 & 0xfffffff0) == SISUSB_PCI_IOPORTBASE) test++;
+	}
+
+	/* No? So reset the device */
+	if ((sisusb->devinit == 0) || (test != 3)) {
+
+		ret |= sisusb_do_init_gfxdevice(sisusb);
+
+		if (ret == 0)
+			sisusb->devinit = 1;
+
+	}
+
+	if (sisusb->devinit) {
+		/* Initialize the graphics core */
+		if (sisusb_init_gfxcore(sisusb) == 0) {
+			sisusb->gfxinit = 1;
+			sisusb_get_ramconfig(sisusb);
+			ret |= sisusb_set_default_mode(sisusb, 1);
+			ret |= sisusb_setup_screen(sisusb, 1, initscreen);
+		}
+	}
+
+	return ret;
+}
+
+/* fops */
+
+int
+sisusb_open(struct inode *inode, struct file *file)x+{
+	struct sisusb_usb_data *sisusb;
+	struct usb_interface *interface;
+	int subminor = iminor(inode);
+
+	down(&disconnect_sem);
+
+	if (!(interface = usb_find_interface(&sisusb_driver, subminor))) {
+		printk(KERN_ERR "sisusb[%d]: Failed to find interface\n",
+				subminor);
+		up(&disconnect_sem);
+		return -ENODEV;
+	}
+
+	if (!(sisusb = usb_get_intfdata(interface))) {
+		up(&disconnect_sem);
+		return -ENODEV;
+	}
+
+	down(&sisusb->lock);
+
+	if (!sisusb->present || !sisusb->ready) {
+		up(&sisusb->lock);
+		up(&disconnect_sem);
+		return -ENODEV;
+	}
+
+	if (sisusb->isopen) {
+		up(&sisusb->lock);
+		up(&disconnect_sem);
+		return -EBUSY;
+	}
+
+	if (!sisusb->devinit) {
+		if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH) {
+			if (sisusb_init_gfxdevice(sisusb, 0)) {
+				up(&sisusb->lock);
+				up(&disconnect_sem);
+				printk(KERN_ERRx+					"sisusbvga[%d]: Failed to initialize "x+					"device\n",
+					sisusb->minor);
+				return -EIO;
+			}
+		} else {
+			up(&sisusb->lock);
+			up(&disconnect_sem);
+			printk(KERN_ERRx+				"sisusbvga[%d]: Device not attached to "x+				"USB 2.0 hub\n",
+				sisusb->minor);
+			return -EIO;
+		}
+	}
+
+	/* increment usage count for the device */
+	kref_get(&sisusb->kref);
+
+	sisusb->isopen = 1;
+
+	file->private_data = sisusb;
+
+	up(&sisusb->lock);
+
+	up(&disconnect_sem);
+
+	printk(KERN_DEBUG "sisusbvga[%d]: opened", sisusb->minor);
+
+	return 0;
+}
+
+static void
+sisusb_delete(struct kref *kref)x+{
+	struct sisusb_usb_data *sisusb = to_sisusb_dev(kref);
+
+	if (!sisusb)
+		return;
+
+	if (sisusb->sisusb_dev)
+		usb_put_dev(sisusb->sisusb_dev);
+
+	sisusb->sisusb_dev = NULL;
+	sisusb_free_buffers(sisusb);
+	sisusb_free_urbs(sisusb);
+	kfree(sisusb);
+}
+
+int
+sisusb_release(struct inode *inode, struct file *file)x+{
+	struct sisusb_usb_data *sisusb;
+	int myminor;
+
+	down(&disconnect_sem);
+
+	if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) {
+		up(&disconnect_sem);
+		return -ENODEV;
+	}
+
+	down(&sisusb->lock);
+
+	if (sisusb->present) {
+		/* Wait for all URBs to finish if device still present */
+		if (!sisusb_wait_all_out_complete(sisusb))
+			sisusb_kill_all_busy(sisusb);
+	}
+
+	myminor = sisusb->minor;
+
+	sisusb->isopen = 0;
+	file->private_data = NULL;
+
+	up(&sisusb->lock);
+
+	/* decrement the usage count on our device */
+	kref_put(&sisusb->kref, sisusb_delete);
+
+	up(&disconnect_sem);
+
+	printk(KERN_DEBUG "sisusbvga[%d]: released", myminor);
+
+	return 0;
+}
+
+ssize_t
+sisusb_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)x+{
+	struct sisusb_usb_data *sisusb;
+	ssize_t bytes_read = 0;
+	int errno = 0;
+	u8 buf8;
+	u16 buf16;
+	u32 buf32, address;
+
+	if (!(sisusb = (struct sisusb_usb_data *)file->private_data))
+		return -ENODEV;
+
+	down(&sisusb->lock);
+
+	/* Sanity check */
+	if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) {
+		up(&sisusb->lock);
+		return -ENODEV;
+	}
+
+	if ((*ppos) >= SISUSB_PCI_PSEUDO_IOPORTBASE &&x+	    (*ppos) <  SISUSB_PCI_PSEUDO_IOPORTBASE + 128) {
+
+		address = (*ppos) -
+			SISUSB_PCI_PSEUDO_IOPORTBASE +
+			SISUSB_PCI_IOPORTBASE;
+
+		/* Read i/o ports
+		 * Byte, word and long(32) can be read. As this
+		 * emulates inX instructions, the data returned is
+		 * in machine-endianness.
+		 */
+		switch (count) {
+
+			case 1:x+				if (sisusb_read_memio_byte(sisusb,
+							SISUSB_TYPE_IO,
+							address, &buf8))x+					errno = -EIO;
+				else if (put_user(buf8, (u8 __user *)buffer))x+					errno = -EFAULT;
+				else
+					bytes_read = 1;
+
+				break;
+
+			case 2:x+				if (sisusb_read_memio_word(sisusb,
+							SISUSB_TYPE_IO,
+							address, &buf16))x+					errno = -EIO;
+				else if (put_user(buf16, (u16 __user *)buffer))x+					errno = -EFAULT;
+				else
+					bytes_read = 2;
+
+				break;
+
+			case 4:x+				if (sisusb_read_memio_long(sisusb,
+							SISUSB_TYPE_IO,
+							address, &buf32))x+					errno = -EIO;
+				else if (put_user(buf32, (u32 __user *)buffer))x+					errno = -EFAULT;
+				else
+					bytes_read = 4;
+
+				break;
+
+			default:
+				errno = -EIO;
+
+		}
+
+	} else if ((*ppos) >= SISUSB_PCI_PSEUDO_MEMBASE &&x+		   (*ppos) <  SISUSB_PCI_PSEUDO_MEMBASE + sisusb->vramsize) {
+
+		address = (*ppos) -
+			SISUSB_PCI_PSEUDO_MEMBASE +
+			SISUSB_PCI_MEMBASE;
+
+		/* Read video ram
+		 * Remember: Data delivered is never endian-corrected
+		 */
+		errno = sisusb_read_mem_bulk(sisusb, address,
+					NULL, count, buffer, &bytes_read);
+
+		if (bytes_read)
+			errno = bytes_read;
+
+	} else  if ((*ppos) >= SISUSB_PCI_PSEUDO_MMIOBASE &&x+		    (*ppos) <  SISUSB_PCI_PSEUDO_MMIOBASE + SISUSB_PCI_MMIOSIZE) {
+
+		address = (*ppos) -
+			SISUSB_PCI_PSEUDO_MMIOBASE +
+			SISUSB_PCI_MMIOBASE;
+
+		/* Read MMIO
+		 * Remember: Data delivered is never endian-corrected
+		 */
+		errno = sisusb_read_mem_bulk(sisusb, address,
+					NULL, count, buffer, &bytes_read);
+
+		if (bytes_read)
+			errno = bytes_read;
+
+	} else  if ((*ppos) >= SISUSB_PCI_PSEUDO_PCIBASE &&x+		    (*ppos) <= SISUSB_PCI_PSEUDO_PCIBASE + 0x5c) {
+
+		if (count != 4) {
+			up(&sisusb->lock);
+			return -EINVAL;
+		}
+
+		address = (*ppos) - SISUSB_PCI_PSEUDO_PCIBASE;
+
+		/* Read PCI config register
+		 * Return value delivered in machine endianness.
+		 */
+		if (sisusb_read_pci_config(sisusb, address, &buf32))x+			errno = -EIO;
+		else if (put_user(buf32, (u32 __user *)buffer))x+			errno = -EFAULT;
+		else
+			bytes_read = 4;
+
+	} else {
+
+		errno = -EBADFD;
+
+	}
+
+	(*ppos) += bytes_read;
+
+	up(&sisusb->lock);
+
+	return errno ? errno : bytes_read;
+}
+
+ssize_t
+sisusb_write(struct file *file, const char __user *buffer, size_t count,
+								loff_t *ppos)x+{
+	struct sisusb_usb_data *sisusb;
+	int errno = 0;
+	ssize_t bytes_written = 0;
+	u8 buf8;
+	u16 buf16;
+	u32 buf32, address;
+
+	if (!(sisusb = (struct sisusb_usb_data *)file->private_data))
+		return -ENODEV;
+
+	down(&sisusb->lock);
+
+	/* Sanity check */
+	if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) {
+		up(&sisusb->lock);
+		return -ENODEV;
+	}
+
+	if ((*ppos) >= SISUSB_PCI_PSEUDO_IOPORTBASE &&x+	    (*ppos) <  SISUSB_PCI_PSEUDO_IOPORTBASE + 128) {
+
+		address = (*ppos) -
+			SISUSB_PCI_PSEUDO_IOPORTBASE +
+			SISUSB_PCI_IOPORTBASE;
+
+		/* Write i/o ports
+		 * Byte, word and long(32) can be written. As this
+		 * emulates outX instructions, the data is expected
+		 * in machine-endianness.
+		 */
+		switch (count) {
+
+			case 1:x+				if (get_user(buf8, (u8 __user *)buffer))x+					errno = -EFAULT;
+				else if (sisusb_write_memio_byte(sisusb,
+							SISUSB_TYPE_IO,
+							address, buf8))x+					errno = -EIO;
+				else
+					bytes_written = 1;
+
+				break;
+
+			case 2:x+				if (get_user(buf16, (u16 __user *)buffer))x+					errno = -EFAULT;
+				else if (sisusb_write_memio_word(sisusb,
+							SISUSB_TYPE_IO,
+							address, buf16))x+					errno = -EIO;
+				else
+					bytes_written = 2;
+
+				break;
+
+			case 4:x+				if (get_user(buf32, (u32 __user *)buffer))x+					errno = -EFAULT;
+				else if (sisusb_write_memio_long(sisusb,
+							SISUSB_TYPE_IO,
+							address, buf32))x+					errno = -EIO;
+				else
+					bytes_written = 4;
+
+				break;
+
+			default:
+				errno = -EIO;
+		}
+
+	} else if ((*ppos) >= SISUSB_PCI_PSEUDO_MEMBASE &&x+		   (*ppos) <  SISUSB_PCI_PSEUDO_MEMBASE + sisusb->vramsize) {
+
+		address = (*ppos) -
+			SISUSB_PCI_PSEUDO_MEMBASE +
+			SISUSB_PCI_MEMBASE;
+
+		/* Write video ram.
+		 * Buffer is copied 1:1, therefore, on big-endian
+		 * machines, the data must be swapped by userland
+		 * in advance (if applicable; no swapping in 8bpp
+		 * mode or if YUV data is being transferred).
+		 */
+		errno = sisusb_write_mem_bulk(sisusb, address, NULL,
+					count, buffer, 0, &bytes_written);
+
+		if (bytes_written)
+			errno = bytes_written;
+
+	} else  if ((*ppos) >= SISUSB_PCI_PSEUDO_MMIOBASE &&x+		    (*ppos) <  SISUSB_PCI_PSEUDO_MMIOBASE + SISUSB_PCI_MMIOSIZE) {
+
+		address = (*ppos) -
+			SISUSB_PCI_PSEUDO_MMIOBASE +
+			SISUSB_PCI_MMIOBASE;
+
+		/* Write MMIO.
+		 * Buffer is copied 1:1, therefore, on big-endian
+		 * machines, the data must be swapped by userland
+		 * in advance.
+		 */
+		errno = sisusb_write_mem_bulk(sisusb, address, NULL,
+					count, buffer, 0, &bytes_written);
+
+		if (bytes_written)
+			errno = bytes_written;
+
+	} else  if ((*ppos) >= SISUSB_PCI_PSEUDO_PCIBASE &&x+		    (*ppos) <= SISUSB_PCI_PSEUDO_PCIBASE + SISUSB_PCI_PCONFSIZE) {
+
+		if (count != 4) {
+			up(&sisusb->lock);
+			return -EINVAL;
+		}
+
+		address = (*ppos) - SISUSB_PCI_PSEUDO_PCIBASE;
+
+		/* Write PCI config register.
+		 * Given value expected in machine endianness.
+		 */
+		if (get_user(buf32, (u32 __user *)buffer))x+			errno = -EFAULT;
+		else if (sisusb_write_pci_config(sisusb, address, buf32))x+			errno = -EIO;
+		else
+			bytes_written = 4;
+
+
+	} else {
+
+		/* Error */
+		errno = -EBADFD;
+
+	}
+
+	(*ppos) += bytes_written;
+
+	up(&sisusb->lock);
+
+	return errno ? errno : bytes_written;
+}
+
+static loff_t
+sisusb_lseek(struct file *file, loff_t offset, int orig)x+{
+	struct sisusb_usb_data *sisusb;
+	loff_t ret;
+
+	if (!(sisusb = (struct sisusb_usb_data *)file->private_data))
+		return -ENODEV;
+
+	down(&sisusb->lock);
+
+	/* Sanity check */
+	if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) {
+		up(&sisusb->lock);
+		return -ENODEV;
+	}
+
+	switch (orig) {
+		case 0:
+			file->f_pos = offset;
+			ret = file->f_pos;
+			/* never negative, no force_successful_syscall needed */x+			break;
+		case 1:x+			file->f_pos += offset;
+			ret = file->f_pos;
+			/* never negative, no force_successful_syscall needed */x+			break;
+		default:
+			/* seeking relative to "end of file" is not supported */x+			ret = -EINVAL;
+	}
+
+	up(&sisusb->lock);
+	return ret;
+}
+
+static int
+sisusb_handle_command(struct sisusb_usb_data *sisusb, struct sisusb_command *y,
+							unsigned long arg)x+{
+	int 	retval, port, length;
+	u32	address;
+
+	port = y->data3 -
+		SISUSB_PCI_PSEUDO_IOPORTBASE +
+		SISUSB_PCI_IOPORTBASE;
+
+	switch (y->operation) {
+		case SUCMD_GET:x+			retval = sisusb_getidxreg(sisusb, port,
+							 y->data0, &y->data1);
+			if (!retval) {
+				if (copy_to_user((void __user *)arg, y,
+							sizeof(*y)))x+					retval = -EFAULT;
+			}x+			break;
+
+		case SUCMD_SET:x+			retval = sisusb_setidxreg(sisusb, port,
+						y->data0, y->data1);
+			break;
+
+		case SUCMD_SETOR:x+			retval = sisusb_setidxregor(sisusb, port,
+						y->data0, y->data1);
+			break;
+
+		case SUCMD_SETAND:x+			retval = sisusb_setidxregand(sisusb, port,
+						y->data0, y->data1);
+			break;
+
+		case SUCMD_SETANDOR:x+			retval = sisusb_setidxregandor(sisusb, port,
+						y->data0, y->data1, y->data2);
+			break;
+
+		case SUCMD_SETMASK:x+			retval = sisusb_setidxregmask(sisusb, port,
+						y->data0, y->data1, y->data2);
+			break;
+
+		case SUCMD_CLRSCR:x+			length = (y->data0 << 16) | (y->data1 << 8) | y->data2;
+			address = y->data3 -
+				SISUSB_PCI_PSEUDO_MEMBASE +
+				SISUSB_PCI_MEMBASE;
+			retval = sisusb_clear_vram(sisusb, address, length);
+			break;
+
+		default:
+			retval = -EINVAL;
+	}
+
+	if(retval > 0)
+		retval = -EIO;
+
+	return retval;
+}
+
+static int
+sisusb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,x+	     						unsigned long arg)x+{
+	struct sisusb_usb_data *sisusb;
+	struct sisusb_info x;
+	struct sisusb_command y;
+	int 	retval = 0;
+	u32 __user *argp = (u32 __user *)arg;
+
+	if (!(sisusb = (struct sisusb_usb_data *)file->private_data))
+		return -ENODEV;
+
+	down(&sisusb->lock);
+
+	/* Sanity check */
+	if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) {
+		retval = -ENODEV;
+		goto err_out;
+	}
+
+	switch (cmd) {
+
+		case SISUSB_GET_CONFIG_SIZE:
+
+			if (put_user(sizeof(x), argp))x+				retval = -EFAULT;
+
+			break;
+
+		case SISUSB_GET_CONFIG:
+
+			x.sisusb_id   	    = SISUSB_ID;
+			x.sisusb_version    = SISUSB_VERSION;
+			x.sisusb_revision   = SISUSB_REVISION;
+			x.sisusb_patchlevel = SISUSB_PATCHLEVEL;
+			x.sisusb_gfxinit    = sisusb->gfxinit;
+			x.sisusb_vrambase   = SISUSB_PCI_PSEUDO_MEMBASE;
+			x.sisusb_mmiobase   = SISUSB_PCI_PSEUDO_MMIOBASE;
+			x.sisusb_iobase     = SISUSB_PCI_PSEUDO_IOPORTBASE;
+			x.sisusb_pcibase    = SISUSB_PCI_PSEUDO_PCIBASE;
+			x.sisusb_vramsize   = sisusb->vramsize;
+			x.sisusb_minor	    = sisusb->minor;
+			x.sisusb_fbdevactive= 0;
+
+			if (copy_to_user((void __user *)arg, &x, sizeof(x)))x+				retval = -EFAULT;
+
+			break;
+
+		case SISUSB_COMMAND:x+
+			if (copy_from_user(&y, (void __user *)arg, sizeof(y)))x+				retval = -EFAULT;
+			else
+				retval = sisusb_handle_command(sisusb, &y, arg);
+
+			break;
+
+		default:
+			retval = -EINVAL;
+			break;
+	}
+
+err_out:
+	up(&sisusb->lock);
+	return retval;
+}
+
+#ifdef SISUSB_NEW_CONFIG_COMPAT
+static long
+sisusb_compat_ioctl(struct file *f, unsigned int cmd, unsigned long arg)x+{
+	long retval;
+
+	switch (cmd) {
+		case SISUSB_GET_CONFIG_SIZE:
+		case SISUSB_GET_CONFIG:
+		case SISUSB_COMMAND:x+			lock_kernel();
+			retval = sisusb_ioctl(f->f_dentry->d_inode, f, cmd, arg);
+			unlock_kernel();
+			return retval;
+
+		default:
+			return -ENOIOCTLCMD;
+	}
+}
+#endif
+
+static struct file_operations usb_sisusb_fops = {
+	.owner =	THIS_MODULE,
+	.open =		sisusb_open,
+	.release =	sisusb_release,
+	.read =		sisusb_read,
+	.write =	sisusb_write,
+	.llseek = 	sisusb_lseek,
+#ifdef SISUSB_NEW_CONFIG_COMPAT
+	.compat_ioctl = sisusb_compat_ioctl,
+#endif
+	.ioctl =	sisusb_ioctl
+};
+
+static struct usb_class_driver usb_sisusb_class = {
+	.name =		"usb/sisusbvga%d",
+	.fops =		&usb_sisusb_fops,
+	.mode =		S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
+	.minor_base =	SISUSB_MINOR
+};
+
+static int sisusb_probe(struct usb_interface *intf,
+			const struct usb_device_id *id)x+{
+	struct usb_device *dev = interface_to_usbdev(intf);
+	struct sisusb_usb_data *sisusb;
+	int retval = 0, i;
+	const char *memfail =
+		KERN_ERRx+		"sisusbvga[%d]: Failed to allocate memory for %s buffer\n";
+
+	printk(KERN_INFO "sisusb: USB2VGA dongle found at address %d\n",
+		dev->devnum);
+
+	/* Allocate memory for our private */
+	if (!(sisusb = kmalloc(sizeof(*sisusb), GFP_KERNEL))) {
+		printk(KERN_ERR
+			"sisusb: Failed to allocate memory for private data\n");
+		return -ENOMEM;
+	}
+	memset(sisusb, 0, sizeof(*sisusb));
+	kref_init(&sisusb->kref);
+
+	init_MUTEX(&(sisusb->lock));
+
+	/* Register device */
+	if ((retval = usb_register_dev(intf, &usb_sisusb_class))) {
+		printk(KERN_ERR
+			"sisusb: Failed to get a minor for device %d\n",
+			dev->devnum);
+		retval = -ENODEV;
+		goto error_1;
+	}
+
+	sisusb->sisusb_dev = dev;
+	sisusb->minor      = intf->minor;
+	sisusb->vrambase   = SISUSB_PCI_MEMBASE;
+	sisusb->mmiobase   = SISUSB_PCI_MMIOBASE;
+	sisusb->mmiosize   = SISUSB_PCI_MMIOSIZE;
+	sisusb->ioportbase = SISUSB_PCI_IOPORTBASE;
+	/* Everything else is zero */
+
+	/* Allocate buffers */
+	sisusb->ibufsize = SISUSB_IBUF_SIZE;
+	if (!(sisusb->ibuf = usb_buffer_alloc(dev, SISUSB_IBUF_SIZE,
+					GFP_KERNEL, &sisusb->transfer_dma_in))) {
+		printk(memfail, "input", sisusb->minor);
+		retval = -ENOMEM;
+		goto error_2;
+	}
+
+	sisusb->numobufs = 0;
+	sisusb->obufsize = SISUSB_OBUF_SIZE;
+	for (i = 0; i < NUMOBUFS; i++) {
+		if (!(sisusb->obuf[i] = usb_buffer_alloc(dev, SISUSB_OBUF_SIZE,
+					GFP_KERNEL,
+					&sisusb->transfer_dma_out[i]))) {
+			if (i == 0) {
+				printk(memfail, "output", sisusb->minor);
+				retval = -ENOMEM;
+				goto error_3;
+			}x+			break;
+		} else
+			sisusb->numobufs++;
+
+	}
+
+	/* Allocate URBs */
+	if (!(sisusb->sisurbin = usb_alloc_urb(0, GFP_KERNEL))) {
+		printk(KERN_ERR
+			"sisusbvga[%d]: Failed to allocate URBs\n",
+			sisusb->minor);
+		retval = -ENOMEM;
+		goto error_3;
+	}
+	sisusb->completein = 1;
+
+	for (i = 0; i < sisusb->numobufs; i++) {
+		if (!(sisusb->sisurbout[i] = usb_alloc_urb(0, GFP_KERNEL))) {
+			printk(KERN_ERRx+				"sisusbvga[%d]: Failed to allocate URBs\n",
+				sisusb->minor);
+			retval = -ENOMEM;
+			goto error_4;
+		}
+		sisusb->urbout_context[i].sisusb = (void *)sisusb;
+		sisusb->urbout_context[i].urbindex = i;
+		sisusb->urbstatus[i] = 0;
+	}
+
+	printk(KERN_INFO "sisusbvga[%d]: Allocated %d output buffers\n",
+					sisusb->minor, sisusb->numobufs);
+
+	/* Do remaining init stuff */
+
+	init_waitqueue_head(&sisusb->wait_q);
+
+	usb_set_intfdata(intf, sisusb);
+
+#ifdef SISUSB_OLD_CONFIG_COMPAT
+	{
+	int ret;
+	/* Our ioctls are all "32/64bit compatible" */
+	ret =  register_ioctl32_conversion(SISUSB_GET_CONFIG_SIZE, NULL);
+	ret |= register_ioctl32_conversion(SISUSB_GET_CONFIG,      NULL);
+	ret |= register_ioctl32_conversion(SISUSB_COMMAND,         NULL);
+	if (ret)
+		printk(KERN_ERR
+			"sisusbvga[%d]: Error registering ioctl32 "x+			"translations\n",
+			sisusb->minor);
+	else
+		sisusb->ioctl32registered = 1;
+
+	}
+#endif
+
+	sisusb->present = 1;
+
+	if (dev->speed == USB_SPEED_HIGH) {
+		if (sisusb_init_gfxdevice(sisusb, 1))x+			printk(KERN_ERRx+				"sisusbvga[%d]: Failed to early "x+				"initialize device\n",
+				sisusb->minor);
+
+	} else
+		printk(KERN_INFO
+			"sisusbvga[%d]: Not attached to USB 2.0 hub, "x+			"deferring init\n",
+			sisusb->minor);
+
+	sisusb->ready = 1;
+
+	return 0;
+
+error_4:
+	sisusb_free_urbs(sisusb);
+error_3:
+	sisusb_free_buffers(sisusb);
+error_2:
+	usb_deregister_dev(intf, &usb_sisusb_class);
+error_1:x+	kfree(sisusb);
+	return retval;
+}
+
+static void sisusb_disconnect(struct usb_interface *intf)x+{
+	struct sisusb_usb_data *sisusb;
+	int minor;
+
+	down(&disconnect_sem);
+
+	/* This should *not* happen */
+	if (!(sisusb = usb_get_intfdata(intf))) {
+		up(&disconnect_sem);
+		return;
+	}
+
+	down(&sisusb->lock);
+
+	/* Wait for all URBs to complete and kill them in case (MUST do) */
+	if (!sisusb_wait_all_out_complete(sisusb))
+		sisusb_kill_all_busy(sisusb);
+
+	minor = sisusb->minor;
+
+	usb_set_intfdata(intf, NULL);
+
+	usb_deregister_dev(intf, &usb_sisusb_class);
+
+#ifdef SISUSB_OLD_CONFIG_COMPAT
+	if (sisusb->ioctl32registered) {
+		int ret;
+		sisusb->ioctl32registered = 0;x+		ret =  unregister_ioctl32_conversion(SISUSB_GET_CONFIG_SIZE);
+		ret |= unregister_ioctl32_conversion(SISUSB_GET_CONFIG);
+		ret |= unregister_ioctl32_conversion(SISUSB_COMMAND);
+		if (ret) {
+			printk(KERN_ERRx+				"sisusbvga[%d]: Error unregistering "x+				"ioctl32 translations\n",
+				minor);
+		}
+	}
+#endif
+
+	sisusb->present = 0;
+	sisusb->ready = 0;
+
+	up(&sisusb->lock);
+
+	/* decrement our usage count */
+	kref_put(&sisusb->kref, sisusb_delete);
+
+	up(&disconnect_sem);
+
+	printk(KERN_INFO "sisusbvga[%d]: Disconnected\n", minor);
+}
+
+static struct usb_device_id sisusb_table [] = {
+	{ USB_DEVICE(0x0711, 0x0900) },
+	{ }
+};
+
+MODULE_DEVICE_TABLE (usb, sisusb_table);
+
+static struct usb_driver sisusb_driver = {
+	.owner =	THIS_MODULE,
+	.name =		"sisusb",
+	.probe =	sisusb_probe,
+	.disconnect =	sisusb_disconnect,
+	.id_table =	sisusb_table
+};
+
+static int __init usb_sisusb_init(void)x+{
+	int retval;
+
+	if (!(retval = usb_register(&sisusb_driver))) {
+		printk(KERN_INFO "sisusb: Driver version %d.%d.%d\n",
+			SISUSB_VERSION, SISUSB_REVISION, SISUSB_PATCHLEVEL);
+		printk(KERN_INFO
+			"sisusb: Copyright (C) 2005 Thomas Winischhofer\n");
+	}
+
+	return retval;
+}
+
+static void __exit usb_sisusb_exit(void)x+{
+	usb_deregister(&sisusb_driver);
+}
+
+module_init(usb_sisusb_init);
+module_exit(usb_sisusb_exit);
+
+MODULE_AUTHOR("Thomas Winischhofer <thomas@winischhofer.net>");
+MODULE_DESCRIPTION("sisusb - Driver for Net2280/SiS315-based USB2VGA dongles");
+MODULE_LICENSE("GPL");
+
diff -Nru a/drivers/usb/misc/sisusbvga/sisusb.h b/drivers/usb/misc/sisusbvga/sisusb.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/misc/sisusbvga/sisusb.h	2005-03-07 20:52:10 -08:00
@@ -0,0 +1,278 @@
+/*x+ * sisusb - usb kernel driver for Net2280/SiS315 based USB2VGA donglesx+ *x+ * Copyright (C) 2005 by Thomas Winischhofer, Vienna, Austriax+ *x+ * If distributed as part of the Linux kernel, this code is licensed under thex+ * terms of the GPL v2.x+ *x+ * Otherwise, the following license terms apply:x+ *x+ * * Redistribution and use in source and binary forms, with or withoutx+ * * modification, are permitted provided that the following conditionsx+ * * are met:x+ * * 1) Redistributions of source code must retain the above copyrightx+ * *    notice, this list of conditions and the following disclaimer.
+ * * 2) Redistributions in binary form must reproduce the above copyrightx+ * *    notice, this list of conditions and the following disclaimer in thex+ * *    documentation and/or other materials provided with the distribution.
+ * * 3) The name of the author may not be used to endorse or promote productsx+ * *    derived from this software without specific prior written permission.
+ * *x+ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESSED OR
+ * * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * * INCIDENTAL, 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 ANYx+ * * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OFx+ * * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.x+ *x+ * Author: 	Thomas Winischhofer <thomas@winischhofer.net>x+ *x+ */
+
+#ifndef _SISUSB_H_
+#define _SISUSB_H_
+
+#ifdef CONFIG_COMPAT
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,10)
+#include <linux/ioctl32.h>
+#define SISUSB_OLD_CONFIG_COMPAT
+#else
+#define SISUSB_NEW_CONFIG_COMPAT
+#endif
+#endif
+
+/* Version Information */
+
+#define SISUSB_VERSION		0
+#define SISUSB_REVISION 	0
+#define SISUSB_PATCHLEVEL	7
+
+/* USB related */x+
+#define SISUSB_MINOR	133		/* FIXME */x+
+/* Size of the sisusb input/output buffers */x+#define SISUSB_IBUF_SIZE  0x01000
+#define SISUSB_OBUF_SIZE  0x10000	/* fixed */x+
+#define NUMOBUFS 8			/* max number of output buffers/output URBs */
+
+/* About endianness:x+ *x+ * 1) I/O ports, PCI config registers. The read/write()x+ *    calls emulate inX/outX. Hence, the data isx+ *    expected/delivered in machine endiannes by this
+ *    driver.
+ * 2) Video memory. The data is copied 1:1. There isx+ *    no swapping. Ever. This means for userland thatx+ *    the data has to be prepared properly. (Hint:x+ *    think graphics data format, command queue,x+ *    hardware cursor.)x+ * 3) MMIO. Data is copied 1:1. MMIO must be swappedx+ *    properly by userland.x+ *x+ */
+
+#ifdef __BIG_ENDIAN
+#define SISUSB_CORRECT_ENDIANNESS_PACKET(p) 		\
+	do {						\
+		p->header  = cpu_to_le16(p->header);	\
+		p->address = cpu_to_le32(p->address);	\
+		p->data    = cpu_to_le32(p->data);	\
+	} while(0)
+#else
+#define SISUSB_CORRECT_ENDIANNESS_PACKET(p)
+#endif
+
+struct sisusb_usb_data;
+
+struct sisusb_urb_context {		/* urb->context for outbound bulk URBs */
+	struct sisusb_usb_data *sisusb;
+	int urbindex;
+	int *actual_length;
+};
+
+struct sisusb_usb_data {
+	struct usb_device *sisusb_dev;
+	struct usb_interface *interface;
+	struct kref kref;
+	wait_queue_head_t wait_q;	/* for syncind and timeouts */
+	struct semaphore lock;		/* general race avoidance */
+	unsigned int ifnum;		/* interface number of the USB device */
+	int minor;			/* minor (for logging clarity) */
+	int isopen;			/* !=0 if open */
+	int present;			/* !=0 if device is present on the bus */
+	int ready;			/* !=0 if device is ready for userland */x+#ifdef SISUSB_OLD_CONFIG_COMPAT
+	int ioctl32registered;
+#endif
+	int numobufs;			/* number of obufs = number of out urbs */
+	char *obuf[NUMOBUFS], *ibuf;	/* transfer buffers */
+	int obufsize, ibufsize;
+	dma_addr_t transfer_dma_out[NUMOBUFS];
+	dma_addr_t transfer_dma_in;
+	struct urb *sisurbout[NUMOBUFS];
+	struct urb *sisurbin;
+	unsigned char urbstatus[NUMOBUFS];
+	unsigned char completein;
+	struct sisusb_urb_context urbout_context[NUMOBUFS];
+	unsigned long flagb0;
+	unsigned long vrambase;		/* framebuffer base */
+	unsigned int vramsize;		/* framebuffer size (bytes) */
+	unsigned long mmiobase;
+	unsigned int mmiosize;
+	unsigned long ioportbase;
+	unsigned char devinit;		/* device initialized? */
+	unsigned char gfxinit;		/* graphics core initialized? */
+	unsigned short chipid, chipvendor;
+	unsigned short chiprevision;
+};
+
+#define to_sisusb_dev(d) container_of(d, struct sisusb_usb_data, kref)x+
+/* USB transport related */x+
+/* urbstatus */x+#define SU_URB_BUSY   1x+#define SU_URB_ALLOC  2x+
+/* Endpoints */x+
+#define SISUSB_EP_GFX_IN	0x0e	/* gfx std packet out(0e)/in(8e) */x+#define SISUSB_EP_GFX_OUT	0x0ex+
+#define SISUSB_EP_GFX_BULK_OUT	0x01	/* gfx mem bulk out/in */x+#define SISUSB_EP_GFX_BULK_IN	0x02	/* ? 2 is "OUT" ? */x+
+#define SISUSB_EP_GFX_LBULK_OUT	0x03	/* gfx large mem bulk out */x+
+#define SISUSB_EP_UNKNOWN_04	0x04	/* ? 4 is "OUT" ? - unused */x+
+#define SISUSB_EP_BRIDGE_IN	0x0d	/* Net2280 out(0d)/in(8d) */x+#define SISUSB_EP_BRIDGE_OUT	0x0dx+
+#define SISUSB_TYPE_MEM		0
+#define SISUSB_TYPE_IO		1
+
+struct sisusb_packet {
+	unsigned short header;
+	u32 address;
+	u32 data;
+} __attribute__((__packed__));
+
+#define CLEARPACKET(packet) memset(packet, 0, 10)x+
+/* PCI bridge related */x+
+#define SISUSB_PCI_MEMBASE	0xd0000000
+#define SISUSB_PCI_MMIOBASE	0xe4000000
+#define SISUSB_PCI_IOPORTBASE	0x0000d000
+
+#define SISUSB_PCI_PSEUDO_MEMBASE	0x10000000
+#define SISUSB_PCI_PSEUDO_MMIOBASE	0x20000000
+#define SISUSB_PCI_PSEUDO_IOPORTBASE	0x0000d000
+#define SISUSB_PCI_PSEUDO_PCIBASE	0x00010000
+
+#define SISUSB_PCI_MMIOSIZE	(128*1024)
+#define SISUSB_PCI_PCONFSIZE	0x5cx+
+/* graphics core related */x+
+#define AROFFSET	0x40
+#define ARROFFSET	0x41x+#define GROFFSET	0x4e
+#define SROFFSET	0x44
+#define CROFFSET	0x54
+#define MISCROFFSET	0x4c
+#define MISCWOFFSET	0x42
+#define INPUTSTATOFFSET 0x5A
+#define PART1OFFSET	0x04
+#define PART2OFFSET	0x10
+#define PART3OFFSET	0x12
+#define PART4OFFSET	0x14
+#define PART5OFFSET	0x16
+#define CAPTUREOFFSET	0x00
+#define VIDEOOFFSET	0x02
+#define COLREGOFFSET	0x48
+#define PELMASKOFFSET	0x46
+#define VGAENABLE	0x43
+
+#define SISAR		SISUSB_PCI_IOPORTBASE + AROFFSET
+#define SISARR		SISUSB_PCI_IOPORTBASE + ARROFFSET
+#define SISGR		SISUSB_PCI_IOPORTBASE + GROFFSET
+#define SISSR		SISUSB_PCI_IOPORTBASE + SROFFSET
+#define SISCR		SISUSB_PCI_IOPORTBASE + CROFFSET
+#define SISMISCR	SISUSB_PCI_IOPORTBASE + MISCROFFSET
+#define SISMISCW	SISUSB_PCI_IOPORTBASE + MISCWOFFSET
+#define SISINPSTAT	SISUSB_PCI_IOPORTBASE + INPUTSTATOFFSET
+#define SISPART1	SISUSB_PCI_IOPORTBASE + PART1OFFSET
+#define SISPART2	SISUSB_PCI_IOPORTBASE + PART2OFFSET
+#define SISPART3	SISUSB_PCI_IOPORTBASE + PART3OFFSET
+#define SISPART4	SISUSB_PCI_IOPORTBASE + PART4OFFSET
+#define SISPART5	SISUSB_PCI_IOPORTBASE + PART5OFFSET
+#define SISCAP		SISUSB_PCI_IOPORTBASE + CAPTUREOFFSET
+#define SISVID		SISUSB_PCI_IOPORTBASE + VIDEOOFFSET
+#define SISCOLIDXR	SISUSB_PCI_IOPORTBASE + COLREGOFFSET - 1
+#define SISCOLIDX	SISUSB_PCI_IOPORTBASE + COLREGOFFSET
+#define SISCOLDATA	SISUSB_PCI_IOPORTBASE + COLREGOFFSET + 1
+#define SISCOL2IDX	SISPART5
+#define SISCOL2DATA	SISPART5 + 1
+#define SISPEL		SISUSB_PCI_IOPORTBASE + PELMASKOFFSET
+#define SISVGAEN	SISUSB_PCI_IOPORTBASE + VGAENABLE
+#define SISDACA		SISCOLIDX
+#define SISDACD		SISCOLDATAx+
+/* ioctl related */x+
+/* Structure argument for SISUSB_GET_INFO ioctl  */x+struct sisusb_info {
+	__u32	sisusb_id;		/* for identifying sisusb */x+#define SISUSB_ID  0x53495355		/* Identify myself with 'SISU' */
+	__u8	sisusb_version;
+	__u8	sisusb_revision;
+	__u8	sisusb_patchlevel;
+	__u8	sisusb_gfxinit;		/* graphics core initialized? */
+
+	__u32	sisusb_vrambase;
+	__u32	sisusb_mmiobase;
+	__u32	sisusb_iobase;
+	__u32	sisusb_pcibase;
+
+	__u32	sisusb_vramsize;	/* framebuffer size in bytes */
+
+	__u32	sisusb_minor;
+
+	__u32   sisusb_fbdevactive;	/* != 0 if framebuffer device active */
+
+	__u8	sisusb_reserved[32];	/* for future use */
+};
+
+struct sisusb_command {
+	__u8   operation;	/* see below */
+	__u8   data0;		/* operation dependent */
+	__u8   data1;		/* operation dependent */
+	__u8   data2;		/* operation dependent */
+	__u32  data3;		/* operation dependent */
+	__u32  data4;		/* for future use */
+};
+
+#define SUCMD_GET      0x01	/* for all: data0 = index, data3 = port */x+#define SUCMD_SET      0x02	/* data1 = value */x+#define SUCMD_SETOR    0x03	/* data1 = or */
+#define SUCMD_SETAND   0x04	/* data1 = and */x+#define SUCMD_SETANDOR 0x05	/* data1 = and, data2 = or */
+#define SUCMD_SETMASK  0x06	/* data1 = data, data2 = mask */x+
+#define SUCMD_CLRSCR   0x07	/* data0:1:2 = length, data3 = address */x+
+#define SISUSB_COMMAND		_IOWR(0xF3,0x3D,struct sisusb_command)
+#define SISUSB_GET_CONFIG_SIZE 	_IOR(0xF3,0x3E,__u32)
+#define SISUSB_GET_CONFIG  	_IOR(0xF3,0x3F,struct sisusb_info)x+
+#endif /* SISUSB_H */x+
diff -Nru a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c
--- a/drivers/usb/misc/usblcd.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/misc/usblcd.c	2005-03-07 20:48:14 -08:00
@@ -144,7 +144,7 @@
 
 			result = usb_bulk_msg(lcd->lcd_dev,
 					 usb_sndbulkpipe(lcd->lcd_dev, 1),
-					 obuf, thistime, &partial, 10 * HZ);
+					 obuf, thistime, &partial, 10000);
 
 			dbg("write stats: result:%d thistime:%lu partial:%u",
 			     result, thistime, partial);
@@ -203,7 +203,7 @@
 		result = usb_bulk_msg(lcd->lcd_dev,
 				      usb_rcvbulkpipe(lcd->lcd_dev, 0),
 				      ibuf, this_read, &partial,
-				      (int) (HZ * 8));
+				      8000);
 
 		dbg(KERN_DEBUG "read stats: result:%d this_read:%u partial:%u",
 		       result, this_read, partial);
diff -Nru a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c
--- a/drivers/usb/misc/usbled.c	2004-01-09 08:50:34 -08:00
+++ b/drivers/usb/misc/usbled.c	2005-03-07 20:46:39 -08:00
@@ -74,7 +74,7 @@
 				(0x00 * 0x100) + color,
 				buffer,	
 				8,
-				2 * HZ);
+				2000);
 	if (retval)
 		dev_dbg(&led->udev->dev, "retval = %d\n", retval);
 	kfree(buffer);
diff -Nru a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
--- a/drivers/usb/misc/usbtest.c	2005-01-14 16:01:56 -08:00
+++ b/drivers/usb/misc/usbtest.c	2005-03-07 20:47:54 -08:00
@@ -472,7 +472,7 @@
 	retval = usb_control_msg (udev, usb_rcvctrlpipe (udev, 0),
 			USB_REQ_GET_INTERFACE, USB_DIR_IN|USB_RECIP_INTERFACE,
 			0, iface->altsetting [0].desc.bInterfaceNumber,
-			dev->buf, 1, HZ * USB_CTRL_GET_TIMEOUT);
+			dev->buf, 1, USB_CTRL_GET_TIMEOUT);
 	switch (retval) {
 	case 1:x 		return dev->buf [0];
@@ -602,7 +602,7 @@
 		retval = usb_control_msg (udev, usb_rcvctrlpipe (udev, 0),
 				USB_REQ_GET_CONFIGURATION,
 				USB_DIR_IN | USB_RECIP_DEVICE,
-				0, 0, dev->buf, 1, HZ * USB_CTRL_GET_TIMEOUT);
+				0, 0, dev->buf, 1, USB_CTRL_GET_TIMEOUT);
 		if (retval != 1 || dev->buf [0] != expected) {
 			dev_dbg (&iface->dev,
 				"get config --> %d (%d)\n", retval,
@@ -1173,7 +1173,7 @@
 	retval = usb_control_msg (urb->dev, usb_sndctrlpipe (urb->dev, 0),
 			USB_REQ_SET_FEATURE, USB_RECIP_ENDPOINT,
 			USB_ENDPOINT_HALT, ep,
-			NULL, 0, HZ * USB_CTRL_SET_TIMEOUT);
+			NULL, 0, USB_CTRL_SET_TIMEOUT);
 	if (retval < 0) {
 		dbg ("ep %02x couldn't set halt, %d", ep, retval);
 		return retval;
@@ -1263,7 +1263,7 @@
 			buf [j] = i + j;
 		retval = usb_control_msg (udev, usb_sndctrlpipe (udev,0),
 				0x5b, USB_DIR_OUT|USB_TYPE_VENDOR,
-				0, 0, buf, len, HZ * USB_CTRL_SET_TIMEOUT);
+				0, 0, buf, len, USB_CTRL_SET_TIMEOUT);
 		if (retval != len) {
 			what = "write";
 			break;
@@ -1272,7 +1272,7 @@
 		/* read it back -- assuming nothing intervened!!  */x 		retval = usb_control_msg (udev, usb_rcvctrlpipe (udev,0),
 				0x5c, USB_DIR_IN|USB_TYPE_VENDOR,
-				0, 0, buf, len, HZ * USB_CTRL_GET_TIMEOUT);
+				0, 0, buf, len, USB_CTRL_GET_TIMEOUT);
 		if (retval != len) {
 			what = "read";
 			break;
diff -Nru a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
--- a/drivers/usb/misc/uss720.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/misc/uss720.c	2005-03-07 20:46:35 -08:00
@@ -75,7 +75,7 @@
 
 	if (!usbdev)
 		return -1;
-	ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev,0), 3, 0xc0, ((unsigned int)reg) << 8, 0, priv->reg, 7, HZ);
+	ret = usb_control_msg(usbdev, usb_rcvctrlpipe(usbdev,0), 3, 0xc0, ((unsigned int)reg) << 8, 0, priv->reg, 7, 1000);
 	if (ret != 7) {
 		printk(KERN_DEBUG "uss720: get_1284_register(%d) failed, status 0x%x expected 7\n",
 		       (unsigned int)reg, ret);
@@ -105,7 +105,7 @@
 
 	if (!usbdev)
 		return -1;
-	ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev,0), 4, 0x40, (((unsigned int)reg) << 8) | val, 0, NULL, 0, HZ);
+	ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev,0), 4, 0x40, (((unsigned int)reg) << 8) | val, 0, NULL, 0, 1000);
 	if (ret) {
 		printk(KERN_DEBUG "uss720: set_1284_register(%u,0x%02x) failed, status 0x%x\n", 
 		       (unsigned int)reg, (unsigned int)val, ret);
@@ -374,7 +374,7 @@
 		return 0;
 	if (change_mode(pp, ECR_EPP))
 		return 0;
-	i = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), (void *)buf, length, &rlen, HZ*20);
+	i = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), (void *)buf, length, &rlen, 20000);
 	if (i)
 		printk(KERN_ERR "uss720: sendbulk ep 1 buf %p len %Zu rlen %u\n", buf, length, rlen);
 	change_mode(pp, ECR_PS2);
@@ -435,7 +435,7 @@
 		return 0;
 	if (change_mode(pp, ECR_ECP))
 		return 0;
-	i = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), (void *)buffer, len, &rlen, HZ*20);
+	i = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), (void *)buffer, len, &rlen, 20000);
 	if (i)
 		printk(KERN_ERR "uss720: sendbulk ep 1 buf %p len %Zu rlen %u\n", buffer, len, rlen);
 	change_mode(pp, ECR_PS2);
@@ -453,7 +453,7 @@
 		return 0;
 	if (change_mode(pp, ECR_ECP))
 		return 0;
-	i = usb_bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, 2), buffer, len, &rlen, HZ*20);
+	i = usb_bulk_msg(usbdev, usb_rcvbulkpipe(usbdev, 2), buffer, len, &rlen, 20000);
 	if (i)
 		printk(KERN_ERR "uss720: recvbulk ep 2 buf %p len %Zu rlen %u\n", buffer, len, rlen);
 	change_mode(pp, ECR_PS2);
@@ -486,7 +486,7 @@
 		return 0;
 	if (change_mode(pp, ECR_PPF))
 		return 0;
-	i = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), (void *)buffer, len, &rlen, HZ*20);
+	i = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 1), (void *)buffer, len, &rlen, 20000);
 	if (i)
 		printk(KERN_ERR "uss720: sendbulk ep 1 buf %p len %Zu rlen %u\n", buffer, len, rlen);
 	change_mode(pp, ECR_PS2);
diff -Nru a/drivers/usb/mon/Kconfig b/drivers/usb/mon/Kconfig
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/mon/Kconfig	2005-03-07 20:49:58 -08:00
@@ -0,0 +1,22 @@
+#
+# USB Monitor configuration
+#
+
+# In normal life, it makes little sense to have usbmon as a module, and in fact
+# it is harmful, because there is no way to autoload the module.
+# The 'm' option is allowed for hackers who debug the usbmon itself,
+# and for those who have usbcore as a module.
+config USB_MON
+	tristate "USB Monitor"x+	depends on USBx+	default yx+	helpx+	  If you say Y here, a component which captures the USB trafficx+	  between peripheral-specific drivers and HC drivers will be built.x+	  The USB_MON is similar in spirit and may be compatible with Davex+	  Harding's USBMon.
+x+	  This is somewhat experimental at this time, but it should be safe,x+	  as long as you aren't building this as a module and then removing it.
+x+	  If unsure, say Y. Do not say M.
diff -Nru a/drivers/usb/mon/Makefile b/drivers/usb/mon/Makefile
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/mon/Makefile	2005-03-07 20:49:58 -08:00
@@ -0,0 +1,7 @@
+#
+# Makefile for USB Core files and filesystem
+#
+
+usbmon-objs	:= mon_main.o mon_stat.o mon_text.o
+
+obj-$(CONFIG_USB_MON)	+= usbmon.o
diff -Nru a/drivers/usb/mon/mon_main.c b/drivers/usb/mon/mon_main.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/mon/mon_main.c	2005-03-07 20:49:58 -08:00
@@ -0,0 +1,377 @@
+/*x+ * The USB Monitor, inspired by Dave Harding's USBMon.
+ *x+ * mon_main.c: Main file, module initiation and exit, registrations, etc.x+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/usb.h>
+#include <linux/debugfs.h>
+#include <linux/smp_lock.h>
+
+#include "usb_mon.h"
+#include "../core/hcd.h"
+
+static void mon_submit(struct usb_bus *ubus, struct urb *urb);
+static void mon_complete(struct usb_bus *ubus, struct urb *urb);
+static void mon_stop(struct mon_bus *mbus);
+static void mon_dissolve(struct mon_bus *mbus, struct usb_bus *ubus);
+static void mon_bus_drop(struct kref *r);
+static void mon_bus_init(struct dentry *mondir, struct usb_bus *ubus);
+
+DECLARE_MUTEX(mon_lock);
+
+static struct dentry *mon_dir;		/* /dbg/usbmon */x+static LIST_HEAD(mon_buses);		/* All buses we know: struct mon_bus */x+
+/*x+ * Link a reader into the bus.
+ *x+ * This must be called with mon_lock taken because of mbus->ref.x+ */
+void mon_reader_add(struct mon_bus *mbus, struct mon_reader *r)x+{
+	unsigned long flags;
+	struct usb_bus *ubus;
+
+	spin_lock_irqsave(&mbus->lock, flags);
+	if (mbus->nreaders == 0) {
+		ubus = mbus->u_bus;
+		if (ubus->monitored) {
+			/*x+			 * Something is really broken, refuse to go on andx+			 * possibly corrupt ops pointers or worse.x+			 */
+			printk(KERN_ERR TAG ": bus %d is already monitored\n",
+			    ubus->busnum);
+			spin_unlock_irqrestore(&mbus->lock, flags);
+			return;
+		}
+		ubus->monitored = 1;
+	}
+	mbus->nreaders++;
+	list_add_tail(&r->r_link, &mbus->r_list);
+	spin_unlock_irqrestore(&mbus->lock, flags);
+
+	kref_get(&mbus->ref);
+}x+
+/*x+ * Unlink reader from the bus.
+ *x+ * This is called with mon_lock taken, so we can decrement mbus->ref.x+ */
+void mon_reader_del(struct mon_bus *mbus, struct mon_reader *r)x+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&mbus->lock, flags);
+	list_del(&r->r_link);
+	--mbus->nreaders;
+	if (mbus->nreaders == 0)
+		mon_stop(mbus);
+	spin_unlock_irqrestore(&mbus->lock, flags);
+
+	kref_put(&mbus->ref, mon_bus_drop);
+}x+
+/*x+ */
+static void mon_submit(struct usb_bus *ubus, struct urb *urb)x+{
+	struct mon_bus *mbus;
+	unsigned long flags;
+	struct list_head *pos;
+	struct mon_reader *r;
+
+	mbus = ubus->mon_bus;
+	if (mbus == NULL)
+		goto out_unlocked;
+
+	spin_lock_irqsave(&mbus->lock, flags);
+	if (mbus->nreaders == 0)
+		goto out_locked;
+
+	list_for_each (pos, &mbus->r_list) {
+		r = list_entry(pos, struct mon_reader, r_link);
+		r->rnf_submit(r->r_data, urb);
+	}
+
+	spin_unlock_irqrestore(&mbus->lock, flags);
+	return;
+
+out_locked:
+	spin_unlock_irqrestore(&mbus->lock, flags);
+out_unlocked:
+	return;
+}x+
+/*x+ */
+static void mon_submit_error(struct usb_bus *ubus, struct urb *urb, int err)x+{
+	struct mon_bus *mbus;
+
+	mbus = ubus->mon_bus;
+	if (mbus == NULL)
+		goto out_unlocked;
+
+	/*x+	 * XXX Capture the error code and the 'E' event.x+	 */
+
+	return;
+
+out_unlocked:
+	return;
+}x+
+/*x+ */
+static void mon_complete(struct usb_bus *ubus, struct urb *urb)x+{
+	struct mon_bus *mbus;
+	unsigned long flags;
+	struct list_head *pos;
+	struct mon_reader *r;
+
+	mbus = ubus->mon_bus;
+	if (mbus == NULL) {
+		/*x+		 * This should not happen.
+		 * At this point we do not even know the bus number...
+		 */
+		printk(KERN_ERR TAG ": Null mon bus in URB, pipe 0x%x\n",x+		    urb->pipe);
+		return;
+	}
+
+	spin_lock_irqsave(&mbus->lock, flags);
+	list_for_each (pos, &mbus->r_list) {
+		r = list_entry(pos, struct mon_reader, r_link);
+		r->rnf_complete(r->r_data, urb);
+	}
+	spin_unlock_irqrestore(&mbus->lock, flags);
+}x+
+/* int (*unlink_urb) (struct urb *urb, int status); */x+
+/*x+ * Stop monitoring.x+ * Obviously this must be well locked, so no need to play with mb's.x+ */
+static void mon_stop(struct mon_bus *mbus)x+{
+	struct usb_bus *ubus = mbus->u_bus;
+
+	/*x+	 * A stop can be called for a dissolved mon_bus in case ofx+	 * a reader staying across an rmmod foo_hcd.x+	 */
+	if (ubus != NULL) {
+		ubus->monitored = 0;x+		mb();
+	}
+}
+
+/*x+ * Add a USB bus (usually by a modprobe foo-hcd)
+ *x+ * This does not return an error code because the core cannot care lessx+ * if monitoring is not established.x+ */
+static void mon_bus_add(struct usb_bus *ubus)x+{
+	mon_bus_init(mon_dir, ubus);
+}
+
+/*x+ * Remove a USB bus (either from rmmod foo-hcd or from a hot-remove event).x+ */
+static void mon_bus_remove(struct usb_bus *ubus)x+{
+	struct mon_bus *mbus = ubus->mon_bus;
+
+	down(&mon_lock);
+	list_del(&mbus->bus_link);
+	debugfs_remove(mbus->dent_t);
+	debugfs_remove(mbus->dent_s);
+
+	mon_dissolve(mbus, ubus);
+	kref_put(&mbus->ref, mon_bus_drop);
+	up(&mon_lock);
+}
+
+/*x+ * Opsx+ */
+static struct usb_mon_operations mon_ops_0 = {
+	.urb_submit =	mon_submit,
+	.urb_submit_error = mon_submit_error,
+	.urb_complete =	mon_complete,
+	.bus_add =	mon_bus_add,
+	.bus_remove =	mon_bus_remove,
+};
+
+/*x+ * Tear usb_bus and mon_bus apart.x+ */
+static void mon_dissolve(struct mon_bus *mbus, struct usb_bus *ubus)x+{
+
+	/*x+	 * Never happens, but...
+	 */
+	if (ubus->monitored) {
+		printk(KERN_ERR TAG ": bus %d is dissolved while monitored\n",
+		    ubus->busnum);
+		ubus->monitored = 0;x+		mb();
+	}
+
+	ubus->mon_bus = NULL;
+	mbus->u_bus = NULL;
+	mb();
+	// usb_bus_put(ubus);
+}
+
+/*x+ */
+static void mon_bus_drop(struct kref *r)x+{
+	struct mon_bus *mbus = container_of(r, struct mon_bus, ref);
+	kfree(mbus);
+}
+
+/*x+ * Initialize a bus for us:x+ *  - allocate mon_busx+ *  - refcount USB bus structx+ *  - linkx+ */
+static void mon_bus_init(struct dentry *mondir, struct usb_bus *ubus)x+{
+	struct dentry *d;
+	struct mon_bus *mbus;
+	enum { NAMESZ = 10 };
+	char name[NAMESZ];
+	int rc;
+
+	if ((mbus = kmalloc(sizeof(struct mon_bus), GFP_KERNEL)) == NULL)
+		goto err_alloc;
+	memset(mbus, 0, sizeof(struct mon_bus));
+	kref_init(&mbus->ref);
+	spin_lock_init(&mbus->lock);
+	INIT_LIST_HEAD(&mbus->r_list);
+
+	/*x+	 * This usb_bus_get here is superfluous, because we receivex+	 * a notification if usb_bus is about to be removed.x+	 */
+	// usb_bus_get(ubus);
+	mbus->u_bus = ubus;
+	ubus->mon_bus = mbus;
+
+	rc = snprintf(name, NAMESZ, "%dt", ubus->busnum);
+	if (rc <= 0 || rc >= NAMESZ)
+		goto err_print_t;
+	d = debugfs_create_file(name, 0600, mondir, mbus, &mon_fops_text);
+	if (d == NULL)
+		goto err_create_t;
+	mbus->dent_t = d;
+
+	rc = snprintf(name, NAMESZ, "%ds", ubus->busnum);
+	if (rc <= 0 || rc >= NAMESZ)
+		goto err_print_s;
+	d = debugfs_create_file(name, 0600, mondir, mbus, &mon_fops_stat);
+	if (d == NULL)
+		goto err_create_s;
+	mbus->dent_s = d;
+
+	down(&mon_lock);
+	list_add_tail(&mbus->bus_link, &mon_buses);
+	up(&mon_lock);
+	return;
+
+err_create_s:
+err_print_s:
+	debugfs_remove(mbus->dent_t);
+err_create_t:
+err_print_t:
+	kfree(mbus);
+err_alloc:
+	return;
+}x+
+static int __init mon_init(void)x+{
+	struct usb_bus *ubus;
+	struct dentry *mondir;
+
+	mondir = debugfs_create_dir("usbmon", NULL);
+	if (IS_ERR(mondir)) {
+		printk(KERN_NOTICE TAG ": debugs is not available\n");
+		return -ENODEV;
+	}
+	if (mondir == NULL) {
+		printk(KERN_NOTICE TAG ": unable to create usbmon directory\n");
+		return -ENODEV;
+	}
+	mon_dir = mondir;
+
+	if (usb_mon_register(&mon_ops_0) != 0) {
+		printk(KERN_NOTICE TAG ": unable to register with the core\n");
+		debugfs_remove(mondir);
+		return -ENODEV;
+	}
+	// MOD_INC_USE_COUNT(which_module?);
+
+	down(&usb_bus_list_lock);
+	list_for_each_entry (ubus, &usb_bus_list, bus_list) {
+		mon_bus_init(mondir, ubus);
+	}
+	up(&usb_bus_list_lock);
+	return 0;
+}
+
+static void __exit mon_exit(void)x+{
+	struct mon_bus *mbus;
+	struct list_head *p;
+
+	usb_mon_deregister();
+
+	down(&mon_lock);
+	while (!list_empty(&mon_buses)) {
+		p = mon_buses.next;x+		mbus = list_entry(p, struct mon_bus, bus_link);
+		list_del(p);
+
+		debugfs_remove(mbus->dent_t);
+		debugfs_remove(mbus->dent_s);
+
+		/*x+		 * This never happens, because the open/close paths inx+		 * file level maintain module use counters and so rmmod failsx+		 * before reaching here. However, better be safe...
+		 */
+		if (mbus->nreaders) {
+			printk(KERN_ERR TAG
+			    ": Outstanding opens (%d) on usb%d, leaking...\n",
+			    mbus->nreaders, mbus->u_bus->busnum);
+			atomic_set(&mbus->ref.refcount, 2);	/* Force leak */
+		}
+
+		mon_dissolve(mbus, mbus->u_bus);
+		kref_put(&mbus->ref, mon_bus_drop);
+	}
+	up(&mon_lock);
+
+	debugfs_remove(mon_dir);
+}
+
+module_init(mon_init);
+module_exit(mon_exit);
+
+MODULE_LICENSE("GPL");
diff -Nru a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/mon/mon_stat.c	2005-03-07 20:49:58 -08:00
@@ -0,0 +1,74 @@
+/*x+ * The USB Monitor, inspired by Dave Harding's USBMon.
+ *x+ * This is the 's' or 'stat' reader which debugs usbmon itself.x+ * Note that this code blows through locks, so make sure thatx+ * /dbg/usbmon/0s is well protected from non-root users.x+ *x+ */
+
+#include <linux/kernel.h>
+#include <linux/usb.h>
+#include <asm/uaccess.h>
+
+#include "usb_mon.h"
+
+#define STAT_BUF_SIZE  80
+
+struct snap {
+	int slen;
+	char str[STAT_BUF_SIZE];
+};
+
+static int mon_stat_open(struct inode *inode, struct file *file)x+{
+	struct mon_bus *mbus;
+	struct snap *sp;
+
+	if ((sp = kmalloc(sizeof(struct snap), GFP_KERNEL)) == NULL)
+		return -ENOMEM;
+
+	mbus = inode->u.generic_ip;
+
+	sp->slen = snprintf(sp->str, STAT_BUF_SIZE,x+	    "nreaders %d text_lost %u\n",x+	    mbus->nreaders, mbus->cnt_text_lost);
+
+	file->private_data = sp;
+	return 0;
+}
+
+static ssize_t mon_stat_read(struct file *file, char __user *buf,
+				size_t nbytes, loff_t *ppos)x+{
+	struct snap *sp = file->private_data;
+	loff_t pos = *ppos;
+	int cnt;
+
+	if (pos < 0 || pos >= sp->slen)
+		return 0;
+	if (nbytes == 0)
+		return 0;
+	if ((cnt = sp->slen - pos) > nbytes)
+		cnt = nbytes;
+	if (copy_to_user(buf, sp->str + pos, cnt))
+		return -EFAULT;
+	*ppos = pos + cnt;
+	return cnt;
+}
+
+static int mon_stat_release(struct inode *inode, struct file *file)x+{
+	return 0;
+}
+
+struct file_operations mon_fops_stat = {
+	.owner =	THIS_MODULE,
+	.open =		mon_stat_open,
+	.llseek =	no_llseek,
+	.read =		mon_stat_read,
+	/* .write =	mon_stat_write, */
+	/* .poll =		mon_stat_poll, */
+	/* .ioctl =	mon_stat_ioctl, */
+	.release =	mon_stat_release,
+};
diff -Nru a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/mon/mon_text.c	2005-03-07 20:49:58 -08:00
@@ -0,0 +1,395 @@
+/*x+ * The USB Monitor, inspired by Dave Harding's USBMon.
+ *x+ * This is a text format reader.x+ */
+
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/usb.h>
+#include <linux/time.h>
+#include <asm/uaccess.h>
+
+#include "usb_mon.h"
+
+/*x+ * No, we do not want arbitrarily long data strings.x+ * Use the binary interface if you want to capture bulk data!x+ */
+#define DATA_MAX  32
+
+/*x+ * This limit exists to prevent OOMs when the user process stops reading.x+ */
+#define EVENT_MAX  25
+
+#define PRINTF_DFL  120
+
+struct mon_event_text {
+	struct list_head e_link;
+	int type;		/* submit, complete, etc. */
+	unsigned int pipe;	/* Pipe */
+	unsigned long id;	/* From pointer, most of the time */
+	unsigned int tstamp;
+	int length;		/* Depends on type: xfer length or act length */
+	int status;
+	char data_flag;
+	unsigned char data[DATA_MAX];
+};
+
+#define SLAB_NAME_SZ  30
+struct mon_reader_text {
+	kmem_cache_t *e_slab;
+	int nevents;
+	struct list_head e_list;
+	struct mon_reader r;	/* In C, parent class can be placed anywhere */
+
+	wait_queue_head_t wait;
+	int printf_size;
+	char *printf_buf;
+	struct semaphore printf_lock;
+
+	char slab_name[SLAB_NAME_SZ];
+};
+
+static void mon_text_ctor(void *, kmem_cache_t *, unsigned long);
+static void mon_text_dtor(void *, kmem_cache_t *, unsigned long);
+
+/*x+ * mon_text_submitx+ * mon_text_complete
+ *x+ * May be called from an interrupt.
+ *x+ * This is called with the whole mon_bus locked, so no additional lock.x+ */
+
+static inline char mon_text_get_data(struct mon_event_text *ep, struct urb *urb,x+    int len, char ev_type)x+{
+	int pipe = urb->pipe;
+	unsigned char *data;
+
+	/*x+	 * The check to see if it's safe to poke at data has an enormousx+	 * number of corner cases, but it seems that the following isx+	 * more or less safe.x+	 *x+	 * We do not even try to look transfer_buffer, because it canx+	 * contain non-NULL garbage in case the upper level promised tox+	 * set DMA for the HCD.
+	 */
+	if (urb->transfer_flags & URB_NO_TRANSFER_DMA_MAP)
+		return 'D';
+
+	if (len <= 0)
+		return 'L';
+
+	if ((data = urb->transfer_buffer) == NULL)
+		return 'Z';	/* '0' would be not as pretty. */
+
+	/*x+	 * Bulk is easy to shortcut reliably. x+	 * XXX Control needs setup packet taken.x+	 * XXX Other pipe types need consideration. Currently, we overdo itx+	 * and collect garbage for them: better more than less.
+	 */
+	if (usb_pipebulk(pipe) || usb_pipecontrol(pipe)) {
+		if (usb_pipein(pipe)) {
+			if (ev_type == 'S')x+				return '<';
+		} else {
+			if (ev_type == 'C')x+				return '>';
+		}
+	}
+
+	if (len >= DATA_MAX)x+		len = DATA_MAX;
+	memcpy(ep->data, urb->transfer_buffer, len);
+	return 0;
+}
+
+static inline unsigned int mon_get_timestamp(void)x+{
+	struct timeval tval;
+	unsigned int stamp;
+
+	do_gettimeofday(&tval);
+	stamp = tval.tv_sec & 0xFFFF;	/* 2^32 = 4294967296. Limit to 4096s. */
+	stamp = stamp * 1000000 + tval.tv_usec;
+	return stamp;
+}
+
+static void mon_text_event(struct mon_reader_text *rp, struct urb *urb,x+    char ev_type)x+{
+	struct mon_event_text *ep;
+	unsigned int stamp;
+
+	stamp = mon_get_timestamp();
+
+	if (rp->nevents >= EVENT_MAX ||x+	    (ep = kmem_cache_alloc(rp->e_slab, SLAB_ATOMIC)) == NULL) {
+		rp->r.m_bus->cnt_text_lost++;
+		return;
+	}
+
+	ep->type = ev_type;
+	ep->pipe = urb->pipe;
+	ep->id = (unsigned long) urb;
+	ep->tstamp = stamp;
+	ep->length = (ev_type == 'S') ?x+	    urb->transfer_buffer_length : urb->actual_length;
+	/* Collecting status makes debugging sense for submits, too */
+	ep->status = urb->status;
+
+	ep->data_flag = mon_text_get_data(ep, urb, ep->length, ev_type);
+
+	rp->nevents++;
+	list_add_tail(&ep->e_link, &rp->e_list);
+	wake_up(&rp->wait);
+}
+
+static void mon_text_submit(void *data, struct urb *urb)x+{
+	struct mon_reader_text *rp = data;
+	mon_text_event(rp, urb, 'S');
+}
+
+static void mon_text_complete(void *data, struct urb *urb)x+{
+	struct mon_reader_text *rp = data;
+	mon_text_event(rp, urb, 'C');
+}
+
+/*x+ * Fetch next event from the circular buffer.x+ */
+static struct mon_event_text *mon_text_fetch(struct mon_reader_text *rp,x+    struct mon_bus *mbus)x+{
+	struct list_head *p;
+	unsigned long flags;
+
+	spin_lock_irqsave(&mbus->lock, flags);
+	if (list_empty(&rp->e_list)) {
+		spin_unlock_irqrestore(&mbus->lock, flags);
+		return NULL;
+	}
+	p = rp->e_list.next;x+	list_del(p);
+	--rp->nevents;
+	spin_unlock_irqrestore(&mbus->lock, flags);
+	return list_entry(p, struct mon_event_text, e_link);
+}
+
+/*x+ */
+static int mon_text_open(struct inode *inode, struct file *file)x+{
+	struct mon_bus *mbus;
+	struct usb_bus *ubus;
+	struct mon_reader_text *rp;
+	int rc;
+
+	down(&mon_lock);
+	mbus = inode->u.generic_ip;
+	ubus = mbus->u_bus;
+
+	rp = kmalloc(sizeof(struct mon_reader_text), GFP_KERNEL);
+	if (rp == NULL) {
+		rc = -ENOMEM;
+		goto err_alloc;
+	}
+	memset(rp, 0, sizeof(struct mon_reader_text));
+	INIT_LIST_HEAD(&rp->e_list);
+	init_waitqueue_head(&rp->wait);
+	init_MUTEX(&rp->printf_lock);
+
+	rp->printf_size = PRINTF_DFL;
+	rp->printf_buf = kmalloc(rp->printf_size, GFP_KERNEL);
+	if (rp->printf_buf == NULL) {
+		rc = -ENOMEM;
+		goto err_alloc_pr;
+	}
+
+	rp->r.m_bus = mbus;
+	rp->r.r_data = rp;
+	rp->r.rnf_submit = mon_text_submit;
+	rp->r.rnf_complete = mon_text_complete;
+
+	snprintf(rp->slab_name, SLAB_NAME_SZ, "mon%dt_%lx", ubus->busnum,x+	    (long)rp);
+	rp->e_slab = kmem_cache_create(rp->slab_name,x+	    sizeof(struct mon_event_text), sizeof(long), 0,x+	    mon_text_ctor, mon_text_dtor);
+	if (rp->e_slab == NULL) {
+		rc = -ENOMEM;
+		goto err_slab;
+	}
+
+	mon_reader_add(mbus, &rp->r);
+
+	file->private_data = rp;
+	up(&mon_lock);
+	return 0;
+
+// err_busy:x+//	kmem_cache_destroy(rp->e_slab);
+err_slab:
+	kfree(rp->printf_buf);
+err_alloc_pr:
+	kfree(rp);
+err_alloc:
+	up(&mon_lock);
+	return rc;
+}
+
+/*x+ * For simplicity, we read one record in one system call and throw outx+ * what does not fit. This means that the following does not work:x+ *   dd if=/dbg/usbmon/0t bs=10
+ * Also, we do not allow seeks and do not bother advancing the offset.x+ */
+static ssize_t mon_text_read(struct file *file, char __user *buf,
+				size_t nbytes, loff_t *ppos)x+{
+	struct mon_reader_text *rp = file->private_data;
+	struct mon_bus *mbus = rp->r.m_bus;
+	DECLARE_WAITQUEUE(waita, current);
+	struct mon_event_text *ep;
+	int cnt, limit;
+	char *pbuf;
+	int data_len, i;
+
+	add_wait_queue(&rp->wait, &waita);
+	set_current_state(TASK_INTERRUPTIBLE);
+	while ((ep = mon_text_fetch(rp, mbus)) == NULL) {
+		if (file->f_flags & O_NONBLOCK) {
+			set_current_state(TASK_RUNNING);
+			remove_wait_queue(&rp->wait, &waita);
+			return -EWOULDBLOCK;	/* Same as EAGAIN in Linux */
+		}
+		/*x+		 * We do not count nwaiters, because ->release is supposedx+		 * to be called when all openers are gone only.
+		 */
+		schedule();
+		if (signal_pending(current)) {
+			remove_wait_queue(&rp->wait, &waita);
+			return -EINTR;
+		}
+		set_current_state(TASK_INTERRUPTIBLE);
+	}
+	set_current_state(TASK_RUNNING);
+	remove_wait_queue(&rp->wait, &waita);
+
+	down(&rp->printf_lock);
+	cnt = 0;
+	pbuf = rp->printf_buf;x+	limit = rp->printf_size;
+
+	cnt += snprintf(pbuf + cnt, limit - cnt,x+	    "%lx %u %c %08x %d %d",x+	    ep->id, ep->tstamp, ep->type, ep->pipe, ep->status, ep->length);
+
+	if ((data_len = ep->length) > 0) {
+		if (ep->data_flag == 0) {
+			cnt += snprintf(pbuf + cnt, limit - cnt, " =");
+			if (data_len >= DATA_MAX)x+				data_len = DATA_MAX;
+			for (i = 0; i < data_len; i++) {
+				if (i % 4 == 0) {
+					cnt += snprintf(pbuf + cnt, limit - cnt,x+					    " ");
+				}
+				cnt += snprintf(pbuf + cnt, limit - cnt,x+				    "%02x", ep->data[i]);
+			}
+			cnt += snprintf(pbuf + cnt, limit - cnt, "\n");
+		} else {
+			cnt += snprintf(pbuf + cnt, limit - cnt,x+			    " %c\n", ep->data_flag);
+		}
+	} else {
+		cnt += snprintf(pbuf + cnt, limit - cnt, "\n");
+	}
+
+	if (copy_to_user(buf, rp->printf_buf, cnt))
+		cnt = -EFAULT;
+	up(&rp->printf_lock);
+	kmem_cache_free(rp->e_slab, ep);
+	return cnt;
+}
+
+static int mon_text_release(struct inode *inode, struct file *file)x+{
+	struct mon_reader_text *rp = file->private_data;
+	struct mon_bus *mbus;
+	/* unsigned long flags; */
+	struct list_head *p;
+	struct mon_event_text *ep;
+
+	down(&mon_lock);
+	mbus = inode->u.generic_ip;
+
+	if (mbus->nreaders <= 0) {
+		printk(KERN_ERR TAG ": consistency error on close\n");
+		up(&mon_lock);
+		return 0;
+	}
+	mon_reader_del(mbus, &rp->r);
+
+	/*x+	 * In theory, e_list is protected by mbus->lock. However,x+	 * after mon_reader_del has finished, the following is the case:x+	 *  - we are not on reader list anymore, so new events won't be added;
+	 *  - whole mbus may be dropped if it was orphaned.x+	 * So, we better not touch mbus.x+	 */
+	/* spin_lock_irqsave(&mbus->lock, flags); */
+	while (!list_empty(&rp->e_list)) {
+		p = rp->e_list.next;x+		ep = list_entry(p, struct mon_event_text, e_link);
+		list_del(p);
+		--rp->nevents;
+		kmem_cache_free(rp->e_slab, ep);
+	}
+	/* spin_unlock_irqrestore(&mbus->lock, flags); */
+
+	kmem_cache_destroy(rp->e_slab);
+	kfree(rp->printf_buf);
+	kfree(rp);
+
+	up(&mon_lock);
+	return 0;
+}
+
+struct file_operations mon_fops_text = {
+	.owner =	THIS_MODULE,
+	.open =		mon_text_open,
+	.llseek =	no_llseek,
+	.read =		mon_text_read,
+	/* .write =	mon_text_write, */
+	/* .poll =		mon_text_poll, */
+	/* .ioctl =	mon_text_ioctl, */
+	.release =	mon_text_release,
+};
+
+/*x+ * Slab interface: constructor.x+ */
+static void mon_text_ctor(void *mem, kmem_cache_t *slab, unsigned long sflags)x+{
+	/*x+	 * Nothing to initialize. No, really!x+	 * So, we fill it with garbage to emulate a reused object.x+	 */
+	memset(mem, 0xe5, sizeof(struct mon_event_text));
+}
+
+static void mon_text_dtor(void *mem, kmem_cache_t *slab, unsigned long sflags)x+{
+	;
+}
diff -Nru a/drivers/usb/mon/usb_mon.h b/drivers/usb/mon/usb_mon.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/mon/usb_mon.h	2005-03-07 20:49:58 -08:00
@@ -0,0 +1,51 @@
+/*x+ * The USB Monitor, inspired by Dave Harding's USBMon.
+ */
+
+#ifndef __USB_MON_H
+#define __USB_MON_H
+
+#include <linux/list.h>
+#include <linux/slab.h>
+#include <linux/kref.h>
+/* #include <linux/usb.h> */	/* We use struct pointers only in this header */x+
+#define TAG "usbmon"
+
+struct mon_bus {
+	struct list_head bus_link;
+	spinlock_t lock;
+	struct dentry *dent_s;		/* Debugging file */
+	struct dentry *dent_t;		/* Text interface file */
+	struct usb_bus *u_bus;
+
+	/* Ref */
+	int nreaders;			/* Under mon_lock AND mbus->lock */
+	struct list_head r_list;	/* Chain of readers (usually one) */
+	struct kref ref;		/* Under mon_lock */
+
+	/* Stats */
+	unsigned int cnt_text_lost;
+};
+
+/*x+ * An instance of a process which opened a file (but can fork later)x+ */
+struct mon_reader {
+	struct list_head r_link;
+	struct mon_bus *m_bus;
+	void *r_data;		/* Use container_of instead? */
+
+	void (*rnf_submit)(void *data, struct urb *urb);
+	void (*rnf_complete)(void *data, struct urb *urb);
+};
+
+void mon_reader_add(struct mon_bus *mbus, struct mon_reader *r);
+void mon_reader_del(struct mon_bus *mbus, struct mon_reader *r);
+
+extern struct semaphore mon_lock;
+
+extern struct file_operations mon_fops_text;
+extern struct file_operations mon_fops_stat;x+
+#endif /* __USB_MON_H */
diff -Nru a/drivers/usb/net/Kconfig b/drivers/usb/net/Kconfig
--- a/drivers/usb/net/Kconfig	2004-11-04 11:08:45 -08:00
+++ b/drivers/usb/net/Kconfig	2005-03-07 20:41:34 -08:00
@@ -260,13 +260,13 @@
 	depends on USB_USBNET
 
 config USB_AX8817X
-	boolean "ASIX AX88172 Based USB 2.0 Ethernet Devices"x+	boolean "ASIX AX88xxx Based USB 2.0 Ethernet Devices"x 	depends on USB_USBNET && NET_ETHERNET
 	select CRC32
 	select MIIx 	default yx 	helpx-	  This option adds support for ASIX AX88172 based USB 2.0x+	  This option adds support for ASIX AX88xxx based USB 2.0x 	  10/100 Ethernet devices.x 
  	  This driver should work with at least the following devices:
@@ -286,5 +286,22 @@
 
 	  This driver creates an interface named "ethX", where X depends on
 	  what other networking devices you have in use.  x+
+config USB_ZD1201
+	tristate "USB ZD1201 based Wireless device support"x+	depends on NET_RADIO
+	select FW_LOADER
+	---help---x+	  Say Y if you want to use wireless LAN adapters based on the ZyDASx+	  ZD1201 chip.
+x+	  This driver makes the adapter appear as a normal Ethernet interface,x+	  typically on wlan0.x+	  x+	  The zd1201 device requires external firmware to be loaded.x+	  This can be found at http://linux-lc100020.sourceforge.net/x+	  x+	  To compile this driver as a module, choose M here: thex+	  module will be called zd1201.x 
 endmenu
diff -Nru a/drivers/usb/net/Makefile b/drivers/usb/net/Makefile
--- a/drivers/usb/net/Makefile	2003-09-24 15:38:53 -07:00
+++ b/drivers/usb/net/Makefile	2005-03-07 20:41:34 -08:00
@@ -7,3 +7,6 @@
 obj-$(CONFIG_USB_PEGASUS)	+= pegasus.o
 obj-$(CONFIG_USB_RTL8150)	+= rtl8150.o
 obj-$(CONFIG_USB_USBNET)	+= usbnet.o
+obj-$(CONFIG_USB_ZD1201)	+= zd1201.o
+
+CFLAGS_zd1201.o = -Idrivers/net/wireless/
diff -Nru a/drivers/usb/net/catc.c b/drivers/usb/net/catc.c
--- a/drivers/usb/net/catc.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/net/catc.c	2005-03-07 20:46:30 -08:00
@@ -457,7 +457,7 @@
 {
         int retval = usb_control_msg(catc->usbdev,
 		dir ? usb_rcvctrlpipe(catc->usbdev, 0) : usb_sndctrlpipe(catc->usbdev, 0),
-		 request, 0x40 | dir, value, index, buf, len, HZ);
+		 request, 0x40 | dir, value, index, buf, len, 1000);
         return retval < 0 ? retval : 0;
 }x 
diff -Nru a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c
--- a/drivers/usb/net/kaweth.c	2004-12-18 13:56:06 -08:00
+++ b/drivers/usb/net/kaweth.c	2005-03-07 20:50:24 -08:00
@@ -58,6 +58,7 @@
 #include <linux/ethtool.h>
 #include <linux/pci.h>
 #include <linux/dma-mapping.h>
+#include <linux/wait.h>
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 #include <asm/byteorder.h>
@@ -1180,31 +1181,21 @@
 // Starts urb and waits for completion or timeout
 static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length)
 {
-        DECLARE_WAITQUEUE(wait, current);
 	struct usb_api_data awd;
         int status;
 
         init_waitqueue_head(&awd.wqh);
         awd.done = 0;
 
-        add_wait_queue(&awd.wqh, &wait);
         urb->context = &awd;
         status = usb_submit_urb(urb, GFP_NOIO);
         if (status) {
                 // something went wrong
                 usb_free_urb(urb);
-                remove_wait_queue(&awd.wqh, &wait);
                 return status;
         }x 
-	while (timeout && !awd.done) {
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		timeout = schedule_timeout(timeout);
-	}
-
-        remove_wait_queue(&awd.wqh, &wait);
-
-        if (!timeout) {
+	if (!wait_event_timeout(awd.wqh, awd.done, timeout)) {
                 // timeout
                 kaweth_warn("usb_control/bulk_msg: timeout");
                 usb_kill_urb(urb);  // remove urb safely
diff -Nru a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c
--- a/drivers/usb/net/pegasus.c	2005-01-14 16:01:29 -08:00
+++ b/drivers/usb/net/pegasus.c	2005-03-07 20:42:32 -08:00
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 1999-2003 Petko Manolov (petkan@users.sourceforge.net)x+ *  Copyright (c) 1999-2005 Petko Manolov (petkan@users.sourceforge.net)x  *x  * This program is free software; you can redistribute it and/or modifyx  * it under the terms of the GNU General Public License version 2 as
@@ -47,7 +47,7 @@
 /*x  * Version Information
  */x-#define DRIVER_VERSION "v0.5.12 (2005/01/13)"
+#define DRIVER_VERSION "v0.6.12 (2005/01/13)"
 #define DRIVER_AUTHOR "Petko Manolov <petkan@users.sourceforge.net>"
 #define DRIVER_DESC "Pegasus/Pegasus II USB Ethernet driver"
 
@@ -301,20 +301,20 @@
 	if (i < REG_TIMEOUT) {
 		get_registers(pegasus, PhyData, 2, &regdi);
 		*regd = le16_to_cpu(regdi);
-		return 0;
+		return 1;
 	}x 	warn("%s: failed", __FUNCTION__);
 
-	return 1;
+	return 0;
 }x 
 static int mdio_read(struct net_device *dev, int phy_id, int loc)
 {
 	pegasus_t *pegasus = (pegasus_t *) netdev_priv(dev);
-	int res;
+	__le16 res;
 
-	read_mii_word(pegasus, phy_id, loc, (u16 *) & res);
-	return res & 0xffff;
+	read_mii_word(pegasus, phy_id, loc, &res);
+	return (int)res;
 }x 
 static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd)
@@ -636,7 +636,7 @@
 
 	return;
 
-      tl_sched:
+tl_sched:
 	tasklet_schedule(&pegasus->rx_tl);
 }
 
@@ -845,14 +845,14 @@
 static void set_carrier(struct net_device *net)x {
 	pegasus_t *pegasus = netdev_priv(net);
-	short tmp;
+	__le16 tmp;
 
-	read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp);
+	if (read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp))
+		return;
 	if (tmp & BMSR_LSTATUS)
 		netif_carrier_on(net);
 	else
 		netif_carrier_off(net);
-
 }x 
 static void free_all_urbs(pegasus_t * pegasus)
@@ -997,8 +997,7 @@
 	return set_register(pegasus, WakeupControl, reg78);
 }
 
-static inline void
-pegasus_reset_wol(struct net_device *dev)
+static inline void pegasus_reset_wol(struct net_device *dev)
 {
 	struct ethtool_wolinfo wol;
 	
@@ -1009,10 +1008,17 @@
 static int
 pegasus_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 {
-	pegasus_t *pegasus = netdev_priv(dev);
+	pegasus_t *pegasus;
+
+	if (in_atomic())
+		return 0;
+
+	pegasus = netdev_priv(dev);
 	mii_ethtool_gset(&pegasus->mii, ecmd);
+
 	return 0;
 }x+
 static int
 pegasus_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 {
@@ -1149,6 +1155,20 @@
 		set_register(pegasus, Reg81, 2);
 }
 
+
+struct workqueue_struct *pegasus_workqueue = NULL;
+#define CARRIER_CHECK_DELAY (2 * HZ)
+
+void check_carrier(void *data)x+{
+	pegasus_t *pegasus = data;
+	set_carrier(pegasus->net);
+	if (!(pegasus->flags & PEGASUS_UNPLUG)) {
+		queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check,x+			CARRIER_CHECK_DELAY);
+	}
+}
+
 static int pegasus_probe(struct usb_interface *intf,
 			 const struct usb_device_id *id)
 {
@@ -1175,6 +1195,8 @@
 
 	tasklet_init(&pegasus->rx_tl, rx_fixup, (unsigned long) pegasus);
 
+	INIT_WORK(&pegasus->carrier_check, check_carrier, pegasus);
+
 	pegasus->usb = dev;
 	pegasus->net = net;
 	SET_MODULE_OWNER(net);
@@ -1212,12 +1234,14 @@
 		dev_warn(&intf->dev, "can't locate MII phy, using default\n");
 		pegasus->phy = 1;
 	}
+	pegasus->mii.phy_id = pegasus->phy;
 	usb_set_intfdata(intf, pegasus);
 	SET_NETDEV_DEV(net, &intf->dev);
 	pegasus_reset_wol(net);
 	res = register_netdev(net);
 	if (res)
 		goto out3;
+	queue_delayed_work(pegasus_workqueue, &pegasus->carrier_check, CARRIER_CHECK_DELAY);
 	pr_info("%s: %s\n", net->name, usb_dev_id[dev_index].name);
 	return 0;
 
@@ -1239,11 +1263,12 @@
 
 	usb_set_intfdata(intf, NULL);
 	if (!pegasus) {
-		warn("unregistering non-existant device");
+		warn("unregistering non-existent device");
 		return;
 	}x 
 	pegasus->flags |= PEGASUS_UNPLUG;
+	cancel_delayed_work(&pegasus->carrier_check);
 	unregister_netdev(pegasus->net);
 	usb_put_dev(interface_to_usbdev(intf));
 	free_all_urbs(pegasus);
@@ -1253,7 +1278,7 @@
 	free_netdev(pegasus->net);
 }
 
-static int pegasus_suspend (struct usb_interface *intf, u32 state)
+static int pegasus_suspend (struct usb_interface *intf, pm_message_t state)
 {
 	struct pegasus *pegasus = usb_get_intfdata(intf);
 	
@@ -1281,11 +1306,15 @@
 static int __init pegasus_init(void)x {
 	pr_info("%s: %s, " DRIVER_DESC "\n", driver_name, DRIVER_VERSION);
+	pegasus_workqueue = create_singlethread_workqueue("pegasus");
+	if (!pegasus_workqueue)
+		return -ENOMEM;
 	return usb_register(&pegasus_driver);
 }x 
 static void __exit pegasus_exit(void)x {
+	destroy_workqueue(pegasus_workqueue);
 	usb_deregister(&pegasus_driver);
 }x 
diff -Nru a/drivers/usb/net/pegasus.h b/drivers/usb/net/pegasus.h
--- a/drivers/usb/net/pegasus.h	2005-01-14 16:01:29 -08:00
+++ b/drivers/usb/net/pegasus.h	2005-03-07 20:42:32 -08:00
@@ -96,6 +96,7 @@
 	int			dev_index;
 	int			intr_interval;
 	struct tasklet_struct	rx_tl;
+	struct work_struct	carrier_check;
 	struct urb		*ctrl_urb, *rx_urb, *tx_urb, *intr_urb;
 	struct sk_buff		*rx_pool[RX_SKBS];
 	struct sk_buff		*rx_skb;
diff -Nru a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c
--- a/drivers/usb/net/rtl8150.c	2004-10-19 10:51:37 -07:00
+++ b/drivers/usb/net/rtl8150.c	2005-03-07 20:46:26 -08:00
@@ -195,14 +195,14 @@
 {
 	return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
 			       RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
-			       indx, 0, data, size, HZ / 2);
+			       indx, 0, data, size, 500);
 }x 
 static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)x {
 	return usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
 			       RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
-			       indx, 0, data, size, HZ / 2);
+			       indx, 0, data, size, 500);
 }x 
 static void ctrl_callback(struct urb *urb, struct pt_regs *regs)
diff -Nru a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c
--- a/drivers/usb/net/usbnet.c	2005-02-02 22:20:02 -08:00
+++ b/drivers/usb/net/usbnet.c	2005-03-07 20:44:08 -08:00
@@ -2,7 +2,8 @@
  * USB Networking Links
  * Copyright (C) 2000-2003 by David Brownell <dbrownell@users.sourceforge.net>
  * Copyright (C) 2002 Pavel Machek <pavel@ucw.cz>
- * Copyright (C) 2003 David Hollis <dhollis@davehollis.com>x+ * Copyright (C) 2003-2005 David Hollis <dhollis@davehollis.com>x+ * Copyright (C) 2005 Phil Chang <pchang23@sbcglobal.net>
  * Copyright (c) 2002-2003 TiVo Inc.x  *x  * This program is free software; you can redistribute it and/or modifyx@@ -109,6 +110,7 @@
  *		(Neil Bortnak)x  * 03-nov-2004	Trivial patch for KC2190 (KC-190) chip. (Jonathan McDowell)x  *x+ * 01-feb-2005	AX88772 support (Phil Chang & Dave Hollis)x  *-------------------------------------------------------------------------*/x 
 // #define	DEBUG			// error path messages, extra infox@@ -164,8 +166,7 @@
 #define THROTTLE_JIFFIES	(HZ/8)x 
 // for vendor-specific control operationsx-#define	CONTROL_TIMEOUT_MS	(500)			/* msec */x-#define CONTROL_TIMEOUT_JIFFIES ((CONTROL_TIMEOUT_MS * HZ)/1000)
+#define	CONTROL_TIMEOUT_MS	500x 
 // between wakeups
 #define UNLINK_TIMEOUT_MS	3
@@ -222,6 +223,8 @@
 #define FLAG_NO_SETINT	0x0010		/* device can't set_interface() */
 #define FLAG_ETHER	0x0020		/* maybe use "eth%d" names */
 
+#define FLAG_FRAMING_AX 0x0040          /* AX88772/178 packets */x+
 	/* init device ... can sleep, or cause probe() failure */
 	int	(*bind)(struct usbnet *, struct usb_interface *);
 
@@ -274,9 +277,6 @@
 MODULE_PARM_DESC (msg_level, "Initial message level (default = 1)");
 
 
-#define	RUN_CONTEXT (in_irq () ? "in_irq" \
-			: (in_interrupt () ? "in_interrupt" : "can sleep"))
-
 #ifdef DEBUG
 #define devdbg(usbnet, fmt, arg...) \
 	printk(KERN_DEBUG "%s: " fmt "\n" , (usbnet)->net->name , ## arg)
@@ -435,6 +435,8 @@
 #define AX_CMD_SET_HW_MII		0x0a
 #define AX_CMD_READ_EEPROM		0x0b
 #define AX_CMD_WRITE_EEPROM		0x0c
+#define AX_CMD_WRITE_ENABLE		0x0d
+#define AX_CMD_WRITE_DISABLE		0x0e
 #define AX_CMD_WRITE_RX_CTL		0x10
 #define AX_CMD_READ_IPG012		0x11
 #define AX_CMD_WRITE_IPG0		0x12
@@ -447,6 +449,10 @@
 #define AX_CMD_READ_MONITOR_MODE	0x1c
 #define AX_CMD_WRITE_MONITOR_MODE	0x1d
 #define AX_CMD_WRITE_GPIOS		0x1f
+#define AX_CMD_SW_RESET			0x20
+#define AX_CMD_SW_PHY_STATUS		0x21
+#define AX_CMD_SW_PHY_SELECT		0x22
+#define AX88772_CMD_READ_NODE_ID	0x13
 
 #define AX_MONITOR_MODE			0x01
 #define AX_MONITOR_LINK			0x02
@@ -458,6 +464,23 @@
 
 #define AX_INTERRUPT_BUFSIZE		8
 
+#define AX_EEPROM_LEN			0x40x+
+#define AX_SWRESET_CLEAR		0x00
+#define AX_SWRESET_RR			0x01
+#define AX_SWRESET_RT			0x02
+#define AX_SWRESET_PRTE			0x04
+#define AX_SWRESET_PRL			0x08
+#define AX_SWRESET_BZ			0x10
+#define AX_SWRESET_IPRL			0x20
+#define AX_SWRESET_IPPD			0x40x+
+#define AX88772_IPG0_DEFAULT		0x15
+#define AX88772_IPG1_DEFAULT		0x0c
+#define AX88772_IPG2_DEFAULT		0x12x+
+#define AX_EEPROM_MAGIC			0xdeadbeefx+
 /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */
 struct ax8817x_data {
 	u8 multi_filter[AX_MCAST_FILTER_SIZE];
@@ -477,7 +500,7 @@
 		index,
 		data,
 		size,
-		CONTROL_TIMEOUT_JIFFIES);
+		CONTROL_TIMEOUT_MS);
 }x 
 static int ax8817x_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
@@ -492,7 +515,7 @@
 		index,
 		data,
 		size,
-		CONTROL_TIMEOUT_JIFFIES);
+		CONTROL_TIMEOUT_MS);
 }x 
 static void ax8817x_async_cmd_callback(struct urb *urb, struct pt_regs *regs)
@@ -514,18 +537,16 @@
 	int link;
 
 	if (urb->status < 0) {
-		printk(KERN_DEBUG "ax8817x_interrupt_complete() failed with %d",x+		devdbg(dev,"ax8817x_interrupt_complete() failed with %d",x 			urb->status);
 	} else {
-		if (data->int_buf[5] == 0x90) {
-			link = data->int_buf[2] & 0x01;
-			if (netif_carrier_ok(dev->net) != link) {
-				if (link)
-					netif_carrier_on(dev->net);
-				else
-					netif_carrier_off(dev->net);
-				devdbg(dev, "ax8817x - Link Status is: %d", link);
-			}
+		link = data->int_buf[2] & 0x01;
+		if (netif_carrier_ok(dev->net) != link) {
+			if (link)
+				netif_carrier_on(dev->net);
+			else
+				netif_carrier_off(dev->net);
+			devdbg(dev, "ax8817x - Link Status is: %d", link);
 		}x 		usb_submit_urb(data->int_urb, GFP_ATOMIC);
 	}x@@ -674,6 +695,11 @@
 	return 0;
 }x 
+static int ax8817x_get_eeprom_len(struct net_device *net)x+{
+	return AX_EEPROM_LEN;
+}
+
 static int ax8817x_get_eeprom(struct net_device *net,
 			      struct ethtool_eeprom *eeprom, u8 *data)x {
@@ -687,13 +713,15 @@
 	if (eeprom->len % 2)
 		return -EINVAL;
 
+	eeprom->magic = AX_EEPROM_MAGIC;x+
 	/* ax8817x returns 2 bytes from eeprom on read */
 	for (i=0; i < eeprom->len / 2; i++) {
 		if (ax8817x_read_cmd(dev, AX_CMD_READ_EEPROM, 
 			eeprom->offset + i, 0, 2, &ebuf[i]) < 0)
 			return -EINVAL;
 	}
-	return i * 2;
+	return 0;
 }x 
 static void ax8817x_get_drvinfo (struct net_device *net,
@@ -728,6 +756,7 @@
 	.set_msglevel		= usbnet_set_msglevel,
 	.get_wol		= ax8817x_get_wol,
 	.set_wol		= ax8817x_set_wol,
+	.get_eeprom_len		= ax8817x_get_eeprom_len,
 	.get_eeprom		= ax8817x_get_eeprom,
 	.get_settings		= ax8817x_get_settings,
 	.set_settings		= ax8817x_set_settings,
@@ -735,27 +764,26 @@
 
 static int ax8817x_bind(struct usbnet *dev, struct usb_interface *intf)
 {
-	int ret;
-	u8 buf[6];
+	int ret = 0;
+	void *buf;x 	int i;
 	unsigned long gpio_bits = dev->driver_info->data;
 	struct ax8817x_data *data = (struct ax8817x_data *)dev->data;
 
-	dev->in = usb_rcvbulkpipe(dev->udev, 3);
-	dev->out = usb_sndbulkpipe(dev->udev, 2);
+	get_endpoints(dev,intf);
 
-	// allocate irq urb
 	if ((data->int_urb = usb_alloc_urb (0, GFP_KERNEL)) == NULL) {
 		dbg ("%s: cannot allocate interrupt URB",x 			dev->net->name);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto out1;
 	}x 	
 	if ((data->int_buf = kmalloc(AX_INTERRUPT_BUFSIZE, GFP_KERNEL)) == NULL) {
 		dbg ("%s: cannot allocate memory for interrupt buffer",x 			dev->net->name);
-		usb_free_urb(data->int_urb);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto out1;
 	}x 	memset(data->int_buf, 0, AX_INTERRUPT_BUFSIZE);
 
@@ -765,36 +793,43 @@
 		ax8817x_interrupt_complete, dev,
 		dev->udev->speed == USB_SPEED_HIGH ? 8 : 100);
 
+	buf = kmalloc(ETH_ALEN, GFP_KERNEL);
+	if(!buf) {
+		ret = -ENOMEM;
+		goto out2;
+	}
+
 	/* Toggle the GPIOs in a manufacturer/model specific way */
 	for (i = 2; i >= 0; i--) {
 		if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS,x 					(gpio_bits >> (i * 8)) & 0xff, 0, 0,x 					buf)) < 0)
-			return ret;
+			goto out3;
 		msleep(5);
 	}x 
 	if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x80, 0, 0, buf)) < 0) {
 		dbg("send AX_CMD_WRITE_RX_CTL failed: %d", ret);
-		return ret;
+		goto out3;
 	}x 
 	/* Get the MAC address */
 	memset(buf, 0, ETH_ALEN);
 	if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, 6, buf)) < 0) {
 		dbg("read AX_CMD_READ_NODE_ID failed: %d", ret);
-		return ret;
+		goto out3;
 	}x 	memcpy(dev->net->dev_addr, buf, ETH_ALEN);
 
 	/* Get the PHY id */
 	if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf)) < 0) {
 		dbg("error on read AX_CMD_READ_PHY_ID: %02x", ret);
-		return ret;
+		goto out3;
 	} else if (ret < 2) {
 		/* this should always return 2 bytes */
 		dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x", ret);
-		return -EIO;
+		ret = -EIO;
+		goto out3;
 	}x 
 	/* Initialize MII structure */
@@ -803,7 +838,7 @@
 	dev->mii.mdio_write = ax8817x_mdio_write;
 	dev->mii.phy_id_mask = 0x3f;
 	dev->mii.reg_num_mask = 0x1f;
-	dev->mii.phy_id = buf[1];
+	dev->mii.phy_id = *((u8 *)buf + 1);
 
 	dev->net->set_multicast_list = ax8817x_set_multicast;
 	dev->net->ethtool_ops = &ax8817x_ethtool_ops;
@@ -816,11 +851,17 @@
 
 	if((ret = usb_submit_urb(data->int_urb, GFP_KERNEL)) < 0) {
 		dbg("Failed to submit interrupt URB: %02x", ret);
-		usb_free_urb(data->int_urb);
-		return ret;
+		goto out2;
 	}x 
 	return 0;
+out3:
+	kfree(buf);
+out2:
+	kfree(data->int_buf);
+out1:
+	usb_free_urb(data->int_urb);
+	return ret;
 }x 
 static void ax8817x_unbind(struct usbnet *dev, struct usb_interface *intf)
@@ -832,6 +873,290 @@
 	kfree(data->int_buf);
 }x 
+static struct ethtool_ops ax88772_ethtool_ops = {
+	.get_drvinfo		= ax8817x_get_drvinfo,
+	.get_link		= ethtool_op_get_link,
+	.get_msglevel		= usbnet_get_msglevel,
+	.set_msglevel		= usbnet_set_msglevel,
+	.get_wol		= ax8817x_get_wol,
+	.set_wol		= ax8817x_set_wol,
+	.get_eeprom_len		= ax8817x_get_eeprom_len,
+	.get_eeprom		= ax8817x_get_eeprom,
+	.get_settings		= ax8817x_get_settings,
+	.set_settings		= ax8817x_set_settings,
+};
+
+static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
+{
+	int ret;
+	void *buf;x+	struct ax8817x_data *data = (struct ax8817x_data *)dev->data;
+
+	get_endpoints(dev,intf);
+
+	if ((data->int_urb = usb_alloc_urb (0, GFP_KERNEL)) == 0) {
+		dbg ("Cannot allocate interrupt URB");
+		ret = -ENOMEM;
+		goto out1;
+	}
+	
+	if ((data->int_buf = kmalloc(AX_INTERRUPT_BUFSIZE, GFP_KERNEL)) == NULL) {
+		dbg ("Cannot allocate memory for interrupt buffer");
+		ret = -ENOMEM;
+		goto out1;
+	}
+	memset(data->int_buf, 0, AX_INTERRUPT_BUFSIZE);
+
+	usb_fill_int_urb (data->int_urb, dev->udev,
+		usb_rcvintpipe (dev->udev, 1),x+		data->int_buf, AX_INTERRUPT_BUFSIZE,x+		ax8817x_interrupt_complete, dev,
+		dev->udev->speed == USB_SPEED_HIGH ? 8 : 100);
+
+	buf = kmalloc(6, GFP_KERNEL);
+	if(!buf) {
+		dbg ("Cannot allocate memory for buffer");
+		ret = -ENOMEM;
+		goto out2;
+	}
+
+	if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_GPIOS,x+				     0x00B0, 0, 0, buf)) < 0)
+		goto out3;
+
+	msleep(5);
+	if ((ret = ax8817x_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0x0001, 0, 0, buf)) < 0) {
+		dbg("Select PHY #1 failed: %d", ret);
+		goto out3;
+	}
+
+	if ((ret =x+	     ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPPD, 0, 0, buf)) < 0) {
+		dbg("Failed to power down internal PHY: %d", ret);
+		goto out3;
+	}
+
+	msleep(150);
+	if ((ret =x+	     ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_CLEAR, 0, 0, buf)) < 0) {
+		dbg("Failed to perform software reset: %d", ret);
+		goto out3;
+	}
+
+	msleep(150);
+	if ((ret =x+	     ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPRL | AX_SWRESET_PRL, 0, 0, buf)) < 0) {
+		dbg("Failed to set Internal/External PHY reset control: %d", ret);
+		goto out3;
+	}
+
+	msleep(150);
+	if ((ret =x+	     ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x0000, 0, 0,x+			       buf)) < 0) {
+		dbg("Failed to reset RX_CTL: %d", ret);
+		goto out3;
+	}
+
+	/* Get the MAC address */
+	memset(buf, 0, ETH_ALEN);
+	if ((ret = ax8817x_read_cmd(dev, AX88772_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf)) < 0) {
+		dbg("Failed to read MAC address: %d", ret);
+		goto out3;
+	}
+	memcpy(dev->net->dev_addr, buf, ETH_ALEN);
+
+	if ((ret = ax8817x_write_cmd(dev, AX_CMD_SET_SW_MII, 0, 0, 0, buf)) < 0) {
+		dbg("Enabling software MII failed: %d", ret);
+		goto out3;
+	}
+
+	if (((ret =x+	      ax8817x_read_cmd(dev, AX_CMD_READ_MII_REG, 0x0010, 2, 2, buf)) < 0)
+	    || (*((u16 *)buf) != 0x003b)) {
+		dbg("Read PHY register 2 must be 0x3b00: %d", ret);
+		goto out3;
+	}
+
+	/* Initialize MII structure */
+	dev->mii.dev = dev->net;
+	dev->mii.mdio_read = ax8817x_mdio_read;
+	dev->mii.mdio_write = ax8817x_mdio_write;
+	dev->mii.phy_id_mask = 0xff;
+	dev->mii.reg_num_mask = 0xff;
+
+	/* Get the PHY id */
+	if ((ret = ax8817x_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf)) < 0) {
+		dbg("Error reading PHY ID: %02x", ret);
+		goto out3;
+	} else if (ret < 2) {
+		/* this should always return 2 bytes */
+		dbg("AX_CMD_READ_PHY_ID returned less than 2 bytes: ret=%02x",
+		    ret);
+		ret = -EIO;
+		goto out3;
+	}
+	dev->mii.phy_id = *((u8 *)buf + 1);
+
+	if ((ret =x+	     ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_PRL, 0, 0, buf)) < 0) {
+		dbg("Set external PHY reset pin level: %d", ret);
+		goto out3;
+	}
+	msleep(150);
+	if ((ret =x+	     ax8817x_write_cmd(dev, AX_CMD_SW_RESET, AX_SWRESET_IPRL | AX_SWRESET_PRL, 0, 0, buf)) < 0) {
+		dbg("Set Internal/External PHY reset control: %d", ret);
+		goto out3;
+	}
+	msleep(150);
+
+
+	dev->net->set_multicast_list = ax8817x_set_multicast;
+	dev->net->ethtool_ops = &ax88772_ethtool_ops;
+
+	ax8817x_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR,x+			cpu_to_le16(BMCR_RESET));
+	ax8817x_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,x+			cpu_to_le16(ADVERTISE_ALL | ADVERTISE_CSMA));
+	mii_nway_restart(&dev->mii);
+
+	if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_MEDIUM_MODE, 0x0336, 0, 0, buf)) < 0) {
+		dbg("Write medium mode register: %d", ret);
+		goto out3;
+	}
+
+	if ((ret = ax8817x_write_cmd(dev, AX_CMD_WRITE_IPG0, AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,AX88772_IPG2_DEFAULT, 0, buf)) < 0) {
+		dbg("Write IPG,IPG1,IPG2 failed: %d", ret);
+		goto out3;
+	}
+	if ((ret =x+	     ax8817x_write_cmd(dev, AX_CMD_SET_HW_MII, 0, 0, 0, &buf)) < 0) {
+		dbg("Failed to set hardware MII: %02x", ret);
+		goto out3;
+	}
+
+	/* Set RX_CTL to default values with 2k buffer, and enable cactus */
+	if ((ret =x+	     ax8817x_write_cmd(dev, AX_CMD_WRITE_RX_CTL, 0x0088, 0, 0,x+			       buf)) < 0) {
+		dbg("Reset RX_CTL failed: %d", ret);
+		goto out3;
+	}
+
+	if((ret = usb_submit_urb(data->int_urb, GFP_KERNEL)) < 0) {
+		dbg("Failed to submit interrupt URB: %02x", ret);
+		goto out3;
+	}
+
+	kfree(buf);
+
+	return 0;
+
+out3:
+	kfree(buf);
+out2:
+	kfree(data->int_buf);
+out1:
+	usb_free_urb(data->int_urb);
+
+	return ret;
+}
+
+static int ax88772_rx_fixup(struct usbnet *dev, struct sk_buff *skb)x+{
+	u32 *header;
+	char *packet;x+	struct sk_buff *ax_skb;
+	u16 size;
+
+	header = (u32 *) skb->data;
+	le32_to_cpus(header);
+	packet = (char *)(header + 1);
+
+	skb_pull(skb, 4);
+
+	while (skb->len > 0) {
+		if ((short)(*header & 0x0000ffff) !=
+		    ~((short)((*header & 0xffff0000) >> 16))) {
+			devdbg(dev,"header length data is error");
+		}
+		/* get the packet length */
+		size = (u16) (*header & 0x0000ffff);
+
+		if ((skb->len) - ((size + 1) & 0xfffe) == 0)
+			return 2;
+		if (size > ETH_FRAME_LEN) {
+			devdbg(dev,"invalid rx length %d", size);
+			return 0;
+		}
+		ax_skb = skb_clone(skb, GFP_ATOMIC);
+		if (ax_skb) {
+			ax_skb->len = size;
+			ax_skb->data = packet;x+			ax_skb->tail = packet + size;
+			skb_return(dev, ax_skb);
+		} else {
+			return 0;
+		}
+
+		skb_pull(skb, (size + 1) & 0xfffe);
+
+		if (skb->len == 0)
+			break;
+
+		header = (u32 *) skb->data;
+		le32_to_cpus(header);
+		packet = (char *)(header + 1);
+		skb_pull(skb, 4);
+	}
+
+	if (skb->len < 0) {
+		devdbg(dev,"invalid rx length %d", skb->len);
+		return 0;
+	}
+	return 1;
+}
+
+static struct sk_buff *ax88772_tx_fixup(struct usbnet *dev, struct sk_buff *skb,x+					int flags)x+{
+	int padlen;
+	int headroom = skb_headroom(skb);
+	int tailroom = skb_tailroom(skb);
+	u32 *packet_len;
+	u32 *padbytes_ptr;
+
+	padlen = ((skb->len + 4) % 512) ? 0 : 4;
+
+	if ((!skb_cloned(skb))
+	    && ((headroom + tailroom) >= (4 + padlen))) {
+		if ((headroom < 4) || (tailroom < padlen)) {
+			skb->data = memmove(skb->head + 4, skb->data, skb->len);
+			skb->tail = skb->data + skb->len;
+		}
+	} else {
+		struct sk_buff *skb2;
+		skb2 = skb_copy_expand(skb, 4, padlen, flags);
+		dev_kfree_skb_any(skb);
+		skb = skb2;
+		if (!skb)x+			return NULL;
+	}
+
+	packet_len = (u32 *) skb_push(skb, 4);
+
+	packet_len = (u32 *) skb->data;
+	*packet_len = (((skb->len - 4) ^ 0x0000ffff) << 16) + (skb->len - 4);
+
+	if ((skb->len % 512) == 0) {
+		padbytes_ptr = (u32 *) skb->tail;
+		*padbytes_ptr = 0xffff0000;
+		skb_put(skb, padlen);
+	}
+	return skb;
+}
+
 static const struct driver_info ax8817x_info = {
 	.description = "ASIX AX8817x USB 2.0 Ethernet",x 	.bind = ax8817x_bind,
@@ -864,6 +1189,16 @@
 	.data = 0x001f1d1f,
 };x 
+static const struct driver_info ax88772_info = {
+	.description = "ASIX AX88772 USB 2.0 Ethernet",x+	.bind = ax88772_bind,x+	.unbind = ax8817x_unbind,x+	.flags = FLAG_ETHER | FLAG_FRAMING_AX,
+	.rx_fixup = ax88772_rx_fixup,
+	.tx_fixup = ax88772_tx_fixup,
+	.data = 0x00130103,
+};
+
 #endif /* CONFIG_USB_AX8817X */
 
 
@@ -911,45 +1246,14 @@
 
 #ifdef	NEED_GENERIC_CDC
 
-/* "Header Functional Descriptor" from CDC spec  5.2.3.1 */x-struct header_desc {
-	u8	bLength;
-	u8	bDescriptorType;
-	u8	bDescriptorSubType;
-
-	u16	bcdCDC;
-} __attribute__ ((packed));
-
-/* "Union Functional Descriptor" from CDC spec 5.2.3.X */x-struct union_desc {
-	u8	bLength;
-	u8	bDescriptorType;
-	u8	bDescriptorSubType;
-
-	u8	bMasterInterface0;
-	u8	bSlaveInterface0;
-	/* ... and there could be other slave interfaces */
-} __attribute__ ((packed));
-
-/* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */x-struct ether_desc {
-	u8	bLength;
-	u8	bDescriptorType;
-	u8	bDescriptorSubType;
-
-	u8	iMACAddress;
-	u32	bmEthernetStatistics;
-	__le16	wMaxSegmentSize;
-	__le16	wNumberMCFilters;
-	u8	bNumberPowerFilters;
-} __attribute__ ((packed));
+#include <linux/usb_cdc.h>
 
 struct cdc_state {
-	struct header_desc	*header;
-	struct union_desc	*u;
-	struct ether_desc	*ether;
-	struct usb_interface	*control;
-	struct usb_interface	*data;
+	struct usb_cdc_header_desc	*header;
+	struct usb_cdc_union_desc	*u;
+	struct usb_cdc_ether_desc	*ether;
+	struct usb_interface		*control;
+	struct usb_interface		*data;
 };x 
 static struct usb_driver usbnet_driver;
@@ -1004,7 +1308,7 @@
 		 * CDC Ethernet achieves with a simple descriptor.
 		 */
 		switch (buf [2]) {
-		case 0x00:		/* Header, mostly useless */
+		case USB_CDC_HEADER_TYPE:x 			if (info->header) {
 				dev_dbg (&intf->dev, "extra CDC header\n");
 				goto bad_desc;
@@ -1016,7 +1320,7 @@
 				goto bad_desc;
 			}x 			break;
-		case 0x06:		/* Union (groups interfaces) */
+		case USB_CDC_UNION_TYPE:x 			if (info->u) {
 				dev_dbg (&intf->dev, "extra CDC union\n");
 				goto bad_desc;
@@ -1065,7 +1369,7 @@
 				goto bad_desc;
 			}x 			break;
-		case 0x0F:		/* Ethernet Networking */
+		case USB_CDC_ETHERNET_TYPE:x 			if (info->ether) {
 				dev_dbg (&intf->dev, "extra CDC ether\n");
 				goto bad_desc;
@@ -1169,7 +1473,7 @@
 }x 
 static inline int
-get_ethernet_addr (struct usbnet *dev, struct ether_desc *e)
+get_ethernet_addr (struct usbnet *dev, struct usb_cdc_ether_desc *e)
 {
 	int 		tmp, i;
 	unsigned char	buf [13];
@@ -1321,7 +1625,7 @@
 		      0,			// index
 		      0,			// data buffer
 		      0,			// size
-		      CONTROL_TIMEOUT_JIFFIES);
+		      CONTROL_TIMEOUT_MS);
 	return retval;
 }
 
@@ -1602,9 +1906,9 @@
  */
 
 struct nc_header {		// packed:
-	u16	hdr_len;		// sizeof nc_header (LE, all)
-	u16	packet_len;		// payload size (including ethhdr)
-	u16	packet_id;		// detects dropped packets
+	__le16	hdr_len;		// sizeof nc_header (LE, all)
+	__le16	packet_len;		// payload size (including ethhdr)
+	__le16	packet_id;		// detects dropped packets
 #define MIN_HEADER	6x 
 	// all else is optional, and must start with:
@@ -1615,7 +1919,7 @@
 #define	PAD_BYTE	((unsigned char)0xAC)
 
 struct nc_trailer {
-	u16	packet_id;
+	__le16	packet_id;
 } __attribute__((__packed__));
 
 // packets may use FLAG_FRAMING_NC and optional pad
@@ -1658,7 +1962,7 @@
 		USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,x 		0, regnum,
 		retval_ptr, sizeof *retval_ptr,
-		CONTROL_TIMEOUT_JIFFIES);
+		CONTROL_TIMEOUT_MS);
 	if (status > 0)
 		status = 0;
 	if (!status)
@@ -1682,7 +1986,7 @@
 		USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,x 		value, regnum,
 		NULL, 0,			// data is in setup packet
-		CONTROL_TIMEOUT_JIFFIES);
+		CONTROL_TIMEOUT_MS);
 }x 
 static inline void
@@ -1973,6 +2277,7 @@
 {
 	struct nc_header	*header;
 	struct nc_trailer	*trailer;
+	u16			hdr_len, packet_len;
 
 	if (!(skb->len & 0x01)
 			|| MIN_FRAMED > skb->len
@@ -1986,50 +2291,50 @@
 	}x 
 	header = (struct nc_header *) skb->data;
-	le16_to_cpus (&header->hdr_len);
-	le16_to_cpus (&header->packet_len);
-	if (FRAMED_SIZE (header->packet_len) > MAX_PACKET) {
+	hdr_len = le16_to_cpup (&header->hdr_len);
+	packet_len = le16_to_cpup (&header->packet_len);
+	if (FRAMED_SIZE (packet_len) > MAX_PACKET) {
 		dev->stats.rx_frame_errors++;
-		dbg ("packet too big, %d", header->packet_len);
+		dbg ("packet too big, %d", packet_len);
 		nc_ensure_sync (dev);
 		return 0;
-	} else if (header->hdr_len < MIN_HEADER) {
+	} else if (hdr_len < MIN_HEADER) {
 		dev->stats.rx_frame_errors++;
-		dbg ("header too short, %d", header->hdr_len);
+		dbg ("header too short, %d", hdr_len);
 		nc_ensure_sync (dev);
 		return 0;
-	} else if (header->hdr_len > MIN_HEADER) {
+	} else if (hdr_len > MIN_HEADER) {
 		// out of band data for us?
-		dbg ("header OOB, %d bytes",
-			header->hdr_len - MIN_HEADER);
+		dbg ("header OOB, %d bytes", hdr_len - MIN_HEADER);
 		nc_ensure_sync (dev);
 		// switch (vendor/product ids) { ... }
 	}
-	skb_pull (skb, header->hdr_len);
+	skb_pull (skb, hdr_len);
 
 	trailer = (struct nc_trailer *)
 		(skb->data + skb->len - sizeof *trailer);
 	skb_trim (skb, skb->len - sizeof *trailer);
 
-	if ((header->packet_len & 0x01) == 0) {
-		if (skb->data [header->packet_len] != PAD_BYTE) {
+	if ((packet_len & 0x01) == 0) {
+		if (skb->data [packet_len] != PAD_BYTE) {
 			dev->stats.rx_frame_errors++;
 			dbg ("bad pad");
 			return 0;
 		}x 		skb_trim (skb, skb->len - 1);
 	}
-	if (skb->len != header->packet_len) {
+	if (skb->len != packet_len) {
 		dev->stats.rx_frame_errors++;
 		dbg ("bad packet len %d (expected %d)",
-			skb->len, header->packet_len);
+			skb->len, packet_len);
 		nc_ensure_sync (dev);
 		return 0;
 	}x 	if (header->packet_id != get_unaligned (&trailer->packet_id)) {
 		dev->stats.rx_fifo_errors++;
 		dbg ("(2+ dropped) rx packet_id mismatch 0x%x 0x%x",
-			header->packet_id, trailer->packet_id);
+			le16_to_cpu (header->packet_id),x+			le16_to_cpu (trailer->packet_id));
 		return 0;
 	}x #if 0
@@ -2125,7 +2430,7 @@
 		USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,x 		val, index,
 		NULL, 0,
-		CONTROL_TIMEOUT_JIFFIES);
+		CONTROL_TIMEOUT_MS);
 }x 
 static inline int
@@ -2402,14 +2707,20 @@
 		size = RNDIS_MAX_TRANSFER;
 	else
 #endif
+#ifdef CONFIG_USB_AX8817X
+	if (dev->driver_info->flags & FLAG_FRAMING_AX)
+		size = 2048;
+	else
+#endif
 		size = (sizeof (struct ethhdr) + dev->net->mtu);
 
-	if ((skb = alloc_skb (size, flags)) == NULL) {
+	if ((skb = alloc_skb (size + NET_IP_ALIGN, flags)) == NULL) {
 		devdbg (dev, "no rx skb");
 		defer_kevent (dev, EVENT_RX_MEMORY);
 		usb_free_urb (urb);
 		return;
 	}x+	skb_reserve (skb, NET_IP_ALIGN);
 
 	entry = (struct skb_data *) skb->cb;
 	entry->urb = urb;
@@ -2677,6 +2988,8 @@
 			framing = "Zaurus";
 		else if (dev->driver_info->flags & FLAG_FRAMING_RN)
 			framing = "RNDIS";
+		else if (dev->driver_info->flags & FLAG_FRAMING_AX)
+			framing = "ASIX";
 		else
 			framing = "simple";
 
@@ -3197,6 +3510,32 @@
 	return status;
 }x 
+/*-------------------------------------------------------------------------*/x+
+#ifdef	CONFIG_PM
+
+static int usbnet_suspend (struct usb_interface *intf, u32 state)
+{
+	struct usbnet		*dev = usb_get_intfdata(intf);
+	
+	netif_device_detach (dev->net);
+	return 0;
+}
+
+static int usbnet_resume (struct usb_interface *intf)
+{
+	struct usbnet		*dev = usb_get_intfdata(intf);
+
+	netif_device_attach (dev->net);
+	return 0;
+}
+
+#else	/* !CONFIG_PM */x+
+#define	usbnet_suspend	NULL
+#define	usbnet_resume	NULL
+
+#endif	/* CONFIG_PM */x 
 /*-------------------------------------------------------------------------*/x 
@@ -3290,6 +3629,10 @@
 	// goodway corp usb gwusb2e
 	USB_DEVICE (0x1631, 0x6200),
 	.driver_info = (unsigned long) &ax8817x_info,
+}, {
+	// ASIX AX88772 10/100
+        USB_DEVICE (0x0b95, 0x7720),
+        .driver_info = (unsigned long) &ax88772_info,
 },
 #endif
 
@@ -3374,6 +3717,7 @@
 	.driver_info =	(unsigned long) &blob_info,
 }, {
 	// Linux Ethernet/RNDIS gadget on pxa210/25x/26x
+	// e.g. Gumstix, current OpenZaurus, ...
 	USB_DEVICE_VER (0x0525, 0xa4a2, 0x0203, 0x0203),
 	.driver_info =	(unsigned long) &linuxdev_info,
 }, 
@@ -3386,72 +3730,64 @@
  *x  * PXA-2xx based models are also lying-about-cdc.x  *x+ * NOTE:  OpenZaurus versions with 2.6 kernels won't use these entries,
+ * unlike the older ones with 2.4 "embedix" kernels.
+ *x  * NOTE:  These entries do double-duty, serving as blacklist entriesx  * whenever Zaurus support isn't enabled, but CDC Ethernet is.
  */
+#define	ZAURUS_MASTER_INTERFACE \x+	.bInterfaceClass	= USB_CLASS_COMM, \x+	.bInterfaceSubClass	= USB_CDC_SUBCLASS_ETHERNET, \x+	.bInterfaceProtocol	= USB_CDC_PROTO_NONE
 {
 	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
 			  | USB_DEVICE_ID_MATCH_DEVICE, 
 	.idVendor		= 0x04DD,
 	.idProduct		= 0x8004,
-	/* match the master interface */
-	.bInterfaceClass	= USB_CLASS_COMM,
-	.bInterfaceSubClass	= 6 /* Ethernet model */,
-	.bInterfaceProtocol	= 0,x+	ZAURUS_MASTER_INTERFACE,
 	.driver_info = ZAURUS_STRONGARM_INFO,
 }, {
 	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
 			  | USB_DEVICE_ID_MATCH_DEVICE, 
 	.idVendor		= 0x04DD,
 	.idProduct		= 0x8005,	/* A-300 */
-	.bInterfaceClass	= USB_CLASS_COMM,
-	.bInterfaceSubClass	= 6 /* Ethernet model */,
-	.bInterfaceProtocol	= 0x00,x+	ZAURUS_MASTER_INTERFACE,
 	.driver_info = ZAURUS_PXA_INFO,
 }, {
 	.match_flags	=   USB_DEVICE_ID_MATCH_INT_INFO
 			  | USB_DEVICE_ID_MATCH_DEVICE, 
 	.idVendor		= 0x04DD,
 	.idProduct		= 0x8006,	/* B-500/SL-5600 */
-	.bInterfaceClass	= USB_CLASS_COMM,
-	.bInterfaceSubClass	= 6 /* Ethernet model */,
-	.bInterfaceProtocol	= 0x00,x+	ZAURUS_MASTER_INTERFACE,
 	.driver_info = ZAURUS_PXA_INFO,
 }, {
 	.match_flags    =   USB_DEVICE_ID_MATCH_INT_INFO
 	          | USB_DEVICE_ID_MATCH_DEVICE,
 	.idVendor		= 0x04DD,
 	.idProduct		= 0x8007,	/* C-700 */
-	.bInterfaceClass	= USB_CLASS_COMM,
-	.bInterfaceSubClass	= 6 /* Ethernet model */,
-	.bInterfaceProtocol = 0x00,x+	ZAURUS_MASTER_INTERFACE,
 	.driver_info = ZAURUS_PXA_INFO,
 }, {
 	.match_flags    =   USB_DEVICE_ID_MATCH_INT_INFO
 		 | USB_DEVICE_ID_MATCH_DEVICE,
 	.idVendor               = 0x04DD,
 	.idProduct              = 0x9031,	/* C-750 C-760 */
-	.bInterfaceClass	= USB_CLASS_COMM,
-	.bInterfaceSubClass	= 6 /* Ethernet model */,
-	.bInterfaceProtocol     = 0x00,x+	ZAURUS_MASTER_INTERFACE,
 	.driver_info = ZAURUS_PXA_INFO,
 }, {
 	.match_flags    =   USB_DEVICE_ID_MATCH_INT_INFO
 		 | USB_DEVICE_ID_MATCH_DEVICE,
 	.idVendor               = 0x04DD,
 	.idProduct              = 0x9032,	/* SL-6000 */
-	.bInterfaceClass	= USB_CLASS_COMM,
-	.bInterfaceSubClass	= 6 /* Ethernet model */,
-	.bInterfaceProtocol     = 0x00,x+	ZAURUS_MASTER_INTERFACE,
 	.driver_info = ZAURUS_PXA_INFO,
 }, {
 	.match_flags    =   USB_DEVICE_ID_MATCH_INT_INFO
 		 | USB_DEVICE_ID_MATCH_DEVICE,
 	.idVendor               = 0x04DD,
 	.idProduct              = 0x9050,	/* C-860 */
-	.bInterfaceClass	= USB_CLASS_COMM,
-	.bInterfaceSubClass	= 6 /* Ethernet model */,
-	.bInterfaceProtocol     = 0x00,x+	ZAURUS_MASTER_INTERFACE,
 	.driver_info = ZAURUS_PXA_INFO,
 },
 
@@ -3463,9 +3799,7 @@
 		 | USB_DEVICE_ID_MATCH_DEVICE,
 	.idVendor               = 0x07B4,
 	.idProduct              = 0x0F02,	/* R-1000 */
-	.bInterfaceClass	= USB_CLASS_COMM,
-	.bInterfaceSubClass	= 6 /* Ethernet model */,
-	.bInterfaceProtocol     = 0x00,x+	ZAURUS_MASTER_INTERFACE,
 	.driver_info = OLYMPUS_MXL_INFO,
 },
 #endif
@@ -3480,7 +3814,8 @@
 	 * NOTE:  this match must come AFTER entries working around
 	 * bugs/quirks in a given product (like Zaurus, above).
 	 */
-	USB_INTERFACE_INFO (USB_CLASS_COMM, 6 /* Ethernet model */, 0),
+	USB_INTERFACE_INFO (USB_CLASS_COMM, USB_CDC_SUBCLASS_ETHERNET,
+			USB_CDC_PROTO_NONE),
 	.driver_info = (unsigned long) &cdc_info,
 },
 #endif
@@ -3495,6 +3830,8 @@
 	.id_table =	products,
 	.probe =	usbnet_probe,
 	.disconnect =	usbnet_disconnect,
+	.suspend =	usbnet_suspend,
+	.resume =	usbnet_resume,
 };x 
 /* Default ethtool_ops assigned.  Devices can override in their bind() routine */
diff -Nru a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/net/zd1201.c	2005-03-07 20:41:34 -08:00
@@ -0,0 +1,1905 @@
+/*x+ *	Driver for ZyDAS zd1201 based wireless USB devices.
+ *x+ *	Copyright (c) 2004, 2005 Jeroen Vreeken (pe1rxq@amsat.org)
+ *x+ *	This program is free software; you can redistribute it and/orx+ *	modify it under the terms of the GNU General Public License
+ *	version 2 as published by the Free Software Foundation.
+ *x+ *	Parts of this driver have been derived from a wlan-ng versionx+ *	modified by ZyDAS. They also made documentation available, thanks!x+ *	Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
+ */x+
+#include <linux/module.h>
+#include <linux/usb.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/wireless.h>
+#include <net/iw_handler.h>
+#include <linux/string.h>
+#include <linux/if_arp.h>
+#include <linux/firmware.h>
+#include <ieee802_11.h>
+#include "zd1201.h"
+
+static struct usb_device_id zd1201_table[] = {
+	{USB_DEVICE(0x0586, 0x3400)}, /* Peabird Wireless USB Adapter */
+	{USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 Wireless USB Adapter */
+	{USB_DEVICE(0x050d, 0x6051)}, /* Belkin F5D6051 usb  adapter */
+	{USB_DEVICE(0x0db0, 0x6823)}, /* MSI UB11B usb  adapter */
+	{}
+};
+
+static int ap = 0;	/* Are we an AP or a normal station? */x+
+#define ZD1201_VERSION	"0.15"
+
+MODULE_AUTHOR("Jeroen Vreeken <pe1rxq@amsat.org>");
+MODULE_DESCRIPTION("Driver for ZyDAS ZD1201 based USB Wireless adapters");
+MODULE_VERSION(ZD1201_VERSION);
+MODULE_LICENSE("GPL");
+module_param(ap, int, 0);
+MODULE_PARM_DESC(ap, "If non-zero Access Point firmware will be loaded");
+MODULE_DEVICE_TABLE(usb, zd1201_table);
+
+
+int zd1201_fw_upload(struct usb_device *dev, int apfw)
+{
+	const struct firmware *fw_entry;
+	char* data;
+	unsigned long len;
+	int err;
+	unsigned char ret;
+	char *buf;x+	char *fwfile;
+
+	if (apfw)
+		fwfile = "zd1201-ap.fw";
+	else
+		fwfile = "zd1201.fw";
+
+	err = request_firmware(&fw_entry, fwfile, &dev->dev);
+	if (err) {
+		dev_err(&dev->dev, "Failed to load %s firmware file!\n", fwfile);
+		dev_err(&dev->dev, "Make sure the hotplug firmware loader is installed.\n");
+		dev_err(&dev->dev, "Goto http://linux-lc100020.sourceforge.net for more info\n");
+		return err;
+	}
+
+	data = fw_entry->data;
+        len = fw_entry->size;
+
+	buf = kmalloc(1024, GFP_ATOMIC);
+	if (!buf)
+		goto exit;
+	
+	while (len > 0) {
+		int translen = (len > 1024) ? 1024 : len;
+		memcpy(buf, data, translen);
+
+		err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 0,x+		    USB_DIR_OUT | 0x40, 0, 0, buf, translen,x+		    ZD1201_FW_TIMEOUT);
+		if (err < 0)
+			goto exit;
+
+		len -= translen;x+		data += translen;x+	}
+                                        
+	err = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), 0x2,
+	    USB_DIR_OUT | 0x40, 0, 0, NULL, 0, ZD1201_FW_TIMEOUT);
+	if (err < 0)
+		goto exit;
+                                                                                                                                                                
+	err = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), 0x4,
+	    USB_DIR_IN | 0x40, 0,0, &ret, sizeof(ret), ZD1201_FW_TIMEOUT);
+	if (err < 0)
+		goto exit;
+                                                                                                                                                                                                                                                                                        
+	if (ret & 0x80) {
+		err = -EIO;
+		goto exit;
+	}
+
+	err = 0;
+exit:
+ 	if (buf)
+		kfree(buf);
+	release_firmware(fw_entry);
+	return err;
+}
+
+void zd1201_usbfree(struct urb *urb, struct pt_regs *regs)
+{
+	struct zd1201 *zd = urb->context;
+
+	switch(urb->status) {
+		case -EILSEQ:
+		case -ENODEV:
+		case -ETIMEDOUT:
+		case -ENOENT:
+		case -EPIPE:x+		case -EOVERFLOW:x+		case -ESHUTDOWN:
+			dev_warn(&zd->usb->dev, "%s: urb failed: %d\n", x+			    zd->dev->name, urb->status);
+	}
+
+	kfree(urb->transfer_buffer);
+	usb_free_urb(urb);
+	return;
+}
+
+/* cmdreq message: 
+	u32 type
+	u16 cmd
+	u16 parm0
+	u16 parm1
+	u16 parm2
+	u8  pad[4]
+
+	total: 4 + 2 + 2 + 2 + 2 + 4 = 16
+*/x+int zd1201_docmd(struct zd1201 *zd, int cmd, int parm0, int parm1, int parm2)x+{
+	unsigned char *command;
+	int ret;
+	struct urb *urb;
+
+	command = kmalloc(16, GFP_ATOMIC);
+	if (!command)
+		return -ENOMEM;
+
+	*((__le32*)command) = cpu_to_le32(ZD1201_USB_CMDREQ);
+	*((__le16*)&command[4]) = cpu_to_le16(cmd);
+	*((__le16*)&command[6]) = cpu_to_le16(parm0);
+	*((__le16*)&command[8]) = cpu_to_le16(parm1);
+	*((__le16*)&command[10])= cpu_to_le16(parm2);
+
+	urb = usb_alloc_urb(0, GFP_ATOMIC);
+	if (!urb) {
+		kfree(command);
+		return -ENOMEM;
+	}x+	usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, zd->endp_out2),
+	     command, 16, zd1201_usbfree, zd);
+	ret = usb_submit_urb(urb, GFP_ATOMIC);
+	if (ret) {
+		kfree(command);
+		usb_free_urb(urb);
+	}
+	
+	return ret;
+}
+
+/* Callback after sending out a packet */x+void zd1201_usbtx(struct urb *urb, struct pt_regs *regs)
+{
+	struct zd1201 *zd = urb->context;
+	netif_wake_queue(zd->dev);
+	return;
+}
+
+/* Incomming data */x+void zd1201_usbrx(struct urb *urb, struct pt_regs *regs)
+{
+	struct zd1201 *zd = urb->context;
+	int free = 0;
+	unsigned char *data = urb->transfer_buffer;x+	struct sk_buff *skb;
+	unsigned char type;
+
+	if (!zd) {
+		free = 1;
+		goto exit;
+	}
+
+	switch(urb->status) {
+		case -EILSEQ:
+		case -ENODEV:
+		case -ETIMEDOUT:
+		case -ENOENT:
+		case -EPIPE:x+		case -EOVERFLOW:x+		case -ESHUTDOWN:
+			dev_warn(&zd->usb->dev, "%s: rx urb failed: %d\n",x+			    zd->dev->name, urb->status);
+			free = 1;
+			goto exit;
+	}
+	
+	if (urb->status != 0 || urb->actual_length == 0)
+		goto resubmit;
+
+	type = data[0];
+	if (type == ZD1201_PACKET_EVENTSTAT || type == ZD1201_PACKET_RESOURCE) {
+		memcpy(zd->rxdata, data, urb->actual_length);
+		zd->rxlen = urb->actual_length;
+		zd->rxdatas = 1;
+		wake_up(&zd->rxdataq);
+	}
+	/* Info frame */
+	if (type == ZD1201_PACKET_INQUIRE) {
+		int i = 0;
+		unsigned short infotype, framelen, copylen;x+		framelen = le16_to_cpu(*(__le16*)&data[4]);
+		infotype = le16_to_cpu(*(__le16*)&data[6]);
+
+		if (infotype == ZD1201_INF_LINKSTATUS) {
+			short linkstatus;
+x+			linkstatus = le16_to_cpu(*(__le16*)&data[8]);
+			switch(linkstatus) {
+				case 1:x+					netif_carrier_on(zd->dev);
+					break;
+				case 2:x+					netif_carrier_off(zd->dev);
+					break;
+				case 3:x+					netif_carrier_off(zd->dev);
+					break;
+				case 4:x+					netif_carrier_on(zd->dev);
+					break;
+				default:x+					netif_carrier_off(zd->dev);
+			}
+			goto resubmit;
+		}
+		if (infotype == ZD1201_INF_ASSOCSTATUS) {
+			short status = le16_to_cpu(*(__le16*)(data+8));
+			int event;
+			union iwreq_data wrqu;
+x+			switch (status) {
+				case ZD1201_ASSOCSTATUS_STAASSOC:
+				case ZD1201_ASSOCSTATUS_REASSOC:
+					event = IWEVREGISTERED;
+					break;
+				case ZD1201_ASSOCSTATUS_DISASSOC:
+				case ZD1201_ASSOCSTATUS_ASSOCFAIL:
+				case ZD1201_ASSOCSTATUS_AUTHFAIL:
+				default:x+					event = IWEVEXPIRED;
+			}
+			memcpy(wrqu.addr.sa_data, data+10, ETH_ALEN);
+			wrqu.addr.sa_family = ARPHRD_ETHER;
+x+			/* Send event to user space */
+			wireless_send_event(zd->dev, event, &wrqu, NULL);
+
+			goto resubmit;
+		}
+		if (infotype == ZD1201_INF_AUTHREQ) {
+			union iwreq_data wrqu;
+x+			memcpy(wrqu.addr.sa_data, data+8, ETH_ALEN);
+			wrqu.addr.sa_family = ARPHRD_ETHER;
+			/* There isn't a event that trully fits this request.x+			   We assume that userspace will be smart enough tox+			   see a new station being expired and sends back ax+			   authstation ioctl to authorize it. */
+			wireless_send_event(zd->dev, IWEVEXPIRED, &wrqu, NULL);
+			goto resubmit;
+		}
+		/* Other infotypes are handled outside this handler */
+		zd->rxlen = 0;
+		while (i < urb->actual_length) {
+			copylen = le16_to_cpu(*(__le16*)&data[i+2]);
+			/* Sanity check, sometimes we get junk */
+			if (copylen+zd->rxlen > sizeof(zd->rxdata))
+				break;
+			memcpy(zd->rxdata+zd->rxlen, data+i+4, copylen);
+			zd->rxlen += copylen;x+			i += 64;
+		}
+		if (i >= urb->actual_length) {
+			zd->rxdatas = 1;
+			wake_up(&zd->rxdataq);
+		}
+		goto  resubmit;
+	}
+	/* Actual data */x+	if (data[urb->actual_length-1] == ZD1201_PACKET_RXDATA) {
+		int datalen = urb->actual_length-1;
+		unsigned short len, fc, seq;
+		struct hlist_node *node;
+
+		len = ntohs(*(__be16 *)&data[datalen-2]);
+		if (len>datalen)x+			len=datalen;x+		fc = le16_to_cpu(*(__le16 *)&data[datalen-16]);
+		seq = le16_to_cpu(*(__le16 *)&data[datalen-24]);
+
+		if(zd->monitor) {
+			if (datalen < 24)
+				goto resubmit;
+			if (!(skb = dev_alloc_skb(datalen+24)))
+				goto resubmit;
+			
+			memcpy(skb_put(skb, 2), &data[datalen-16], 2);
+			memcpy(skb_put(skb, 2), &data[datalen-2], 2);
+			memcpy(skb_put(skb, 6), &data[datalen-14], 6);
+			memcpy(skb_put(skb, 6), &data[datalen-22], 6);
+			memcpy(skb_put(skb, 6), &data[datalen-8], 6);
+			memcpy(skb_put(skb, 2), &data[datalen-24], 2);
+			memcpy(skb_put(skb, len), data, len);
+			skb->dev = zd->dev;
+			skb->dev->last_rx = jiffies;
+			skb->protocol = eth_type_trans(skb, zd->dev);
+			zd->stats.rx_packets++;
+			zd->stats.rx_bytes += skb->len;
+			netif_rx(skb);
+			goto resubmit;
+		}
+			
+		if ((seq & IEEE802_11_SCTL_FRAG) ||x+		    (fc & IEEE802_11_FCTL_MOREFRAGS)) {
+			struct zd1201_frag *frag = NULL;
+			char *ptr;
+
+			if (datalen<14)
+				goto resubmit;
+			if ((seq & IEEE802_11_SCTL_FRAG) == 0) {
+				frag = kmalloc(sizeof(struct zd1201_frag*),x+				    GFP_ATOMIC);
+				if (!frag)
+					goto resubmit;
+				skb = dev_alloc_skb(IEEE802_11_DATA_LEN +14+2);
+				if (!skb) {
+					kfree(frag);
+					goto resubmit;
+				}
+				frag->skb = skb;
+				frag->seq = seq & IEEE802_11_SCTL_SEQ;
+				skb_reserve(skb, 2);
+				memcpy(skb_put(skb, 12), &data[datalen-14], 12);
+				memcpy(skb_put(skb, 2), &data[6], 2);
+				memcpy(skb_put(skb, len), data+8, len);
+				hlist_add_head(&frag->fnode, &zd->fraglist);
+				goto resubmit;
+			}
+			hlist_for_each_entry(frag, node, &zd->fraglist, fnode)
+				if(frag->seq == (seq&IEEE802_11_SCTL_SEQ))
+					break;
+			if (!frag)
+				goto resubmit;
+			skb = frag->skb;
+			ptr = skb_put(skb, len);
+			if (ptr)
+				memcpy(ptr, data+8, len);
+			if (fc & IEEE802_11_FCTL_MOREFRAGS)
+				goto resubmit;
+			hlist_del_init(&frag->fnode);
+			kfree(frag);
+			/* Fallthrough */
+		} else {
+			if (datalen<14)
+				goto resubmit;
+			skb = dev_alloc_skb(len + 14 + 2);
+			if (!skb)x+				goto resubmit;
+			skb_reserve(skb, 2);
+			memcpy(skb_put(skb, 12), &data[datalen-14], 12);
+			memcpy(skb_put(skb, 2), &data[6], 2);
+			memcpy(skb_put(skb, len), data+8, len);
+		}
+		skb->dev = zd->dev;
+		skb->dev->last_rx = jiffies;
+		skb->protocol = eth_type_trans(skb, zd->dev);
+		zd->stats.rx_packets++;
+		zd->stats.rx_bytes += skb->len;
+		netif_rx(skb);
+	}
+resubmit:
+	memset(data, 0, ZD1201_RXSIZE);
+
+	urb->status = 0;
+	urb->dev = zd->usb;
+	if(usb_submit_urb(urb, GFP_ATOMIC))
+		free = 1;
+
+exit:
+	if (free) {
+		zd->rxlen = 0;
+		zd->rxdatas = 1;
+		wake_up(&zd->rxdataq);
+		kfree(urb->transfer_buffer);
+	}
+	return;
+}
+
+static int zd1201_getconfig(struct zd1201 *zd, int rid, void *riddata,
+	unsigned int riddatalen)x+{
+	int err;
+	int i = 0;
+	int code;
+	int rid_fid;
+	int length;
+	unsigned char *pdata;
+	
+	zd->rxdatas = 0;
+	err = zd1201_docmd(zd, ZD1201_CMDCODE_ACCESS, rid, 0, 0);
+	if (err)
+		return err;
+
+	wait_event_interruptible(zd->rxdataq, zd->rxdatas);
+	if (!zd->rxlen)
+		return -EIO;
+
+	code = le16_to_cpu(*(__le16*)(&zd->rxdata[4]));
+	rid_fid = le16_to_cpu(*(__le16*)(&zd->rxdata[6]));
+	length = le16_to_cpu(*(__le16*)(&zd->rxdata[8]));
+	if (length > zd->rxlen)
+		length = zd->rxlen-6;
+
+	/* If access bit is not on, then error */
+	if ((code & ZD1201_ACCESSBIT) != ZD1201_ACCESSBIT || rid_fid != rid )
+		return -EINVAL;
+
+	/* Not enough buffer for allocating data */x+	if (riddatalen != (length - 4)) {
+		dev_dbg(&zd->usb->dev, "riddatalen mismatches, expected=%u, (packet=%u) length=%u, rid=0x%04X, rid_fid=0x%04X\n",x+		    riddatalen, zd->rxlen, length, rid, rid_fid);
+		return -ENODATA;
+	}
+
+	zd->rxdatas = 0;
+	/* Issue SetRxRid commnd */			
+	err = zd1201_docmd(zd, ZD1201_CMDCODE_SETRXRID, rid, 0, length);
+	if (err)
+		return err;
+
+	/* Receive RID record from resource packets */x+	wait_event_interruptible(zd->rxdataq, zd->rxdatas);
+	if (!zd->rxlen)
+		return -EIO;
+
+	if (zd->rxdata[zd->rxlen - 1] != ZD1201_PACKET_RESOURCE) {
+		dev_dbg(&zd->usb->dev, "Packet type mismatch: 0x%x not 0x3\n",x+		    zd->rxdata[zd->rxlen-1]);
+		return -EINVAL;
+	}
+
+	/* Set the data pointer and received data length */
+	pdata = zd->rxdata;
+	length = zd->rxlen;
+
+	do {
+		int  actual_length;
+
+		actual_length = (length > 64) ? 64 : length;
+
+		if(pdata[0] != 0x3) {
+			dev_dbg(&zd->usb->dev, "Rx Resource packet type error: %02X\n",x+			    pdata[0]);
+			return -EINVAL;
+		}
+
+		if (actual_length != 64) {
+			/* Trim the last packet type byte */
+			actual_length--;
+		}
+
+		/* Skip the 4 bytes header (RID length and RID) */
+		if(i == 0) {
+			pdata += 8;
+			actual_length -= 8;
+		}
+		else {
+			pdata += 4;
+			actual_length -= 4;
+		}
+		
+		memcpy(riddata, pdata, actual_length);
+		riddata += actual_length;
+		pdata += actual_length;
+		length -= 64;
+		i++;
+	} while (length > 0);
+
+	return 0;
+}
+
+/*x+ *	resreq:x+ *		byte	type
+ *		byte	sequence
+ *		u16	reserved
+ *		byte	data[12]
+ *	total: 16
+ */
+static int zd1201_setconfig(struct zd1201 *zd, int rid, void *buf, int len, int wait)x+{
+	int err;
+	unsigned char *request;
+	int reqlen;
+	char seq=0;
+	struct urb *urb;
+	unsigned int gfp_mask = wait ? GFP_NOIO : GFP_ATOMIC;
+
+	len += 4;			/* first 4 are for header */
+
+	zd->rxdatas = 0;
+	zd->rxlen = 0;
+	for (seq=0; len > 0; seq++) {
+		request = kmalloc(16, gfp_mask);
+		if (!request)
+			return -ENOMEM;
+		urb = usb_alloc_urb(0, gfp_mask);
+		if (!urb) {
+			kfree(request);
+			return -ENOMEM;
+		}
+		memset(request, 0, 16);
+		reqlen = len>12 ? 12 : len;
+		request[0] = ZD1201_USB_RESREQ;
+		request[1] = seq;
+		request[2] = 0;
+		request[3] = 0;
+		if (request[1] == 0) {
+			/* add header */
+			*(__le16*)&request[4] = cpu_to_le16((len-2+1)/2);
+			*(__le16*)&request[6] = cpu_to_le16(rid);
+			memcpy(request+8, buf, reqlen-4);
+			buf += reqlen-4;
+		} else {
+			memcpy(request+4, buf, reqlen);
+			buf += reqlen;
+		}
+
+		len -= reqlen;
+
+		usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb,x+		    zd->endp_out2), request, 16, zd1201_usbfree, zd);
+		err = usb_submit_urb(urb, gfp_mask);
+		if (err)
+			goto err;
+	}
+
+	request = kmalloc(16, gfp_mask);
+	if (!request)
+		return -ENOMEM;
+	urb = usb_alloc_urb(0, gfp_mask);
+	if (!urb) {
+		kfree(request);
+		return -ENOMEM;
+	}x+	*((__le32*)request) = cpu_to_le32(ZD1201_USB_CMDREQ);
+	*((__le16*)&request[4]) = 
+	    cpu_to_le16(ZD1201_CMDCODE_ACCESS|ZD1201_ACCESSBIT);
+	*((__le16*)&request[6]) = cpu_to_le16(rid);
+	*((__le16*)&request[8]) = cpu_to_le16(0);
+	*((__le16*)&request[10]) = cpu_to_le16(0);
+	usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, zd->endp_out2),
+	     request, 16, zd1201_usbfree, zd);
+	err = usb_submit_urb(urb, gfp_mask);
+	if (err)
+		goto err;
+	
+	if (wait) {
+		wait_event_interruptible(zd->rxdataq, zd->rxdatas);
+		if (!zd->rxlen || le16_to_cpu(*(__le16*)&zd->rxdata[6]) != rid) {
+			dev_dbg(&zd->usb->dev, "wrong or no RID received\n");
+		}
+	}
+
+	return 0;
+err:
+	kfree(request);
+	usb_free_urb(urb);
+	return err;
+}
+
+static inline int zd1201_getconfig16(struct zd1201 *zd, int rid, short *val)x+{
+	int err;
+	__le16 zdval;
+
+	err = zd1201_getconfig(zd, rid, &zdval, sizeof(__le16));
+	if (err)
+		return err;
+	*val = le16_to_cpu(zdval);
+	return 0;
+}
+
+static inline int zd1201_setconfig16(struct zd1201 *zd, int rid, short val)x+{
+	__le16 zdval = cpu_to_le16(val);
+	return (zd1201_setconfig(zd, rid, &zdval, sizeof(__le16), 1));
+}
+
+int zd1201_drvr_start(struct zd1201 *zd)x+{
+	int err, i;
+	short max;
+	__le16 zdmax;
+	unsigned char *buffer;x+	
+	buffer = kmalloc(ZD1201_RXSIZE, GFP_KERNEL);
+	if (!buffer)
+		return -ENOMEM;
+	memset(buffer, 0, ZD1201_RXSIZE);
+
+	usb_fill_bulk_urb(zd->rx_urb, zd->usb, 
+	    usb_rcvbulkpipe(zd->usb, zd->endp_in), buffer, ZD1201_RXSIZE,
+	    zd1201_usbrx, zd);
+
+	err = usb_submit_urb(zd->rx_urb, GFP_KERNEL);
+	if (err)
+		goto err_buffer;x+	
+	err = zd1201_docmd(zd, ZD1201_CMDCODE_INIT, 0, 0, 0);
+	if (err)
+		goto err_urb;
+
+	err = zd1201_getconfig(zd, ZD1201_RID_CNFMAXTXBUFFERNUMBER, &zdmax,
+	    sizeof(__le16));
+	if (err)
+		goto err_urb;
+
+	max = le16_to_cpu(zdmax);
+	for (i=0; i<max; i++) {
+		err = zd1201_docmd(zd, ZD1201_CMDCODE_ALLOC, 1514, 0, 0);
+		if (err)
+			goto err_urb;
+	}
+
+	return 0;
+
+err_urb:
+	usb_kill_urb(zd->rx_urb);
+	return err;
+err_buffer:
+	kfree(buffer);
+	return err;
+}
+
+/*	Magic alert: The firmware doesn't seem to like the MAC state being
+ *	toggled in promisc (aka monitor) mode.
+ *	(It works a number of times, but will halt eventually)
+ *	So we turn it of before disabling and on after enabling if needed.
+ */x+static int zd1201_enable(struct zd1201 *zd)x+{
+	int err;
+
+	if (zd->mac_enabled)
+		return 0;
+
+	err = zd1201_docmd(zd, ZD1201_CMDCODE_ENABLE, 0, 0, 0);
+	if (!err);
+		zd->mac_enabled = 1;
+
+	if (zd->monitor)
+		err = zd1201_setconfig16(zd, ZD1201_RID_PROMISCUOUSMODE, 1);
+
+	return err;
+}
+
+static int zd1201_disable(struct zd1201 *zd)x+{
+	int err;
+	
+	if (!zd->mac_enabled)
+		return 0;
+	if (zd->monitor) {
+		err = zd1201_setconfig16(zd, ZD1201_RID_PROMISCUOUSMODE, 0);
+		if (err);
+			return err;
+	}
+
+	err = zd1201_docmd(zd, ZD1201_CMDCODE_DISABLE, 0, 0, 0);
+	if (!err)
+		zd->mac_enabled = 0;
+	return err;
+}
+
+static int zd1201_mac_reset(struct zd1201 *zd)x+{
+	if (!zd->mac_enabled)
+		return 0;
+	zd1201_disable(zd);
+	return zd1201_enable(zd);
+}
+
+static int zd1201_join(struct zd1201 *zd, char *essid, int essidlen)x+{
+	int err, val;
+	char buf[IW_ESSID_MAX_SIZE+2];
+
+	err = zd1201_disable(zd);
+	if (err)
+		return err;
+
+	val = ZD1201_CNFAUTHENTICATION_OPENSYSTEM;
+	val |= ZD1201_CNFAUTHENTICATION_SHAREDKEY;
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFAUTHENTICATION, val);
+	if (err)
+		return err;
+
+	*(__le16 *)buf = cpu_to_le16(essidlen);
+	memcpy(buf+2, essid, essidlen);
+	if (!zd->ap) {	/* Normal station */
+		err = zd1201_setconfig(zd, ZD1201_RID_CNFDESIREDSSID, buf,x+		    IW_ESSID_MAX_SIZE+2, 1);
+		if (err)
+			return err;
+	} else {	/* AP */
+		err = zd1201_setconfig(zd, ZD1201_RID_CNFOWNSSID, buf,x+		    IW_ESSID_MAX_SIZE+2, 1);
+		if (err)
+			return err;
+	}
+
+	err = zd1201_setconfig(zd, ZD1201_RID_CNFOWNMACADDR, 
+	    zd->dev->dev_addr, zd->dev->addr_len, 1);
+	if (err)
+		return err;
+
+	err = zd1201_enable(zd);
+	if (err)
+		return err;
+
+	msleep(100);
+	return 0;
+}
+
+static int zd1201_net_open(struct net_device *dev)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+
+	/* Start MAC with wildcard if no essid set */x+	if (!zd->mac_enabled)
+		zd1201_join(zd, zd->essid, zd->essidlen);
+	netif_start_queue(dev);
+
+	return 0;
+}
+
+static int zd1201_net_stop(struct net_device *dev)
+{
+	netif_stop_queue(dev);
+	
+	return 0;
+}
+
+/*x+	RFC 1042 encapsulates Ethernet frames in 802.11 frames
+	by prefixing them with 0xaa, 0xaa, 0x03) followed by a SNAP OID of 0
+	(0x00, 0x00, 0x00). Zd requires an additionnal padding, copy
+	of ethernet addresses, length of the standard RFC 1042 packet
+	and a command byte (which is nul for tx).
+	
+	tx frame (from Wlan NG):x+	RFC 1042:x+		llc		0xAA 0xAA 0x03 (802.2 LLC)
+		snap		0x00 0x00 0x00 (Ethernet encapsulated)
+		type		2 bytes, Ethernet type field
+		payload		(minus eth header)
+	Zydas specific:
+		padding		1B if (skb->len+8+1)%64==0
+		Eth MAC addr	12 bytes, Ethernet MAC addresses
+		length		2 bytes, RFC 1042 packet length x+				(llc+snap+type+payload)
+		zd		1 null byte, zd1201 packet type
+ */x+static int zd1201_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	unsigned char *txbuf = zd->txdata;
+	int txbuflen, pad = 0, err;
+	struct urb *urb = zd->tx_urb;
+
+	if (!zd->mac_enabled || zd->monitor) {
+		zd->stats.tx_dropped++;
+		kfree_skb(skb);
+		return 0;
+	}
+	netif_stop_queue(dev);
+
+	txbuflen = skb->len + 8 + 1;
+	if (txbuflen%64 == 0) {
+		pad = 1;
+		txbuflen++;
+	}
+	txbuf[0] = 0xAA;
+	txbuf[1] = 0xAA;
+	txbuf[2] = 0x03;
+	txbuf[3] = 0x00;	/* rfc1042 */x+	txbuf[4] = 0x00;x+	txbuf[5] = 0x00;x+
+	memcpy(txbuf+6, skb->data+12, skb->len-12);
+	if (pad)
+		txbuf[skb->len-12+6]=0;
+	memcpy(txbuf+skb->len-12+6+pad, skb->data, 12);
+	*(__be16*)&txbuf[skb->len+6+pad] = htons(skb->len-12+6);x+	txbuf[txbuflen-1] = 0;
+
+	usb_fill_bulk_urb(urb, zd->usb, usb_sndbulkpipe(zd->usb, zd->endp_out),
+	    txbuf, txbuflen, zd1201_usbtx, zd);
+
+	err = usb_submit_urb(zd->tx_urb, GFP_ATOMIC);
+	if (err) {
+		zd->stats.tx_errors++;
+		netif_start_queue(dev);
+		return err;
+	}
+	zd->stats.tx_packets++;
+	zd->stats.tx_bytes += skb->len;
+	dev->trans_start = jiffies;
+	kfree_skb(skb);
+
+	return 0;
+}
+
+static void zd1201_tx_timeout(struct net_device *dev)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+
+	if (!zd)
+		return;
+	dev_warn(&zd->usb->dev, "%s: TX timeout, shooting down urb\n",x+	    dev->name);
+	zd->tx_urb->transfer_flags |= URB_ASYNC_UNLINK;
+	usb_unlink_urb(zd->tx_urb);
+	zd->stats.tx_errors++;
+	/* Restart the timeout to quiet the watchdog: */x+	dev->trans_start = jiffies;
+}
+
+static int zd1201_set_mac_address(struct net_device *dev, void *p)
+{
+	struct sockaddr *addr = p;
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	int err;
+
+	if (!zd)
+		return -ENODEV;
+
+	err = zd1201_setconfig(zd, ZD1201_RID_CNFOWNMACADDR, 
+	    addr->sa_data, dev->addr_len, 1);
+	if (err)
+		return err;
+	memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
+
+	return zd1201_mac_reset(zd);
+}
+
+static struct net_device_stats *zd1201_get_stats(struct net_device *dev)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+
+	return &zd->stats;
+}
+
+static struct iw_statistics *zd1201_get_wireless_stats(struct net_device *dev)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+
+	return &zd->iwstats;
+}
+
+static void zd1201_set_multicast(struct net_device *dev)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	struct dev_mc_list *mc = dev->mc_list;
+	unsigned char reqbuf[ETH_ALEN*ZD1201_MAXMULTI];
+	int i;
+
+	if (dev->mc_count > ZD1201_MAXMULTI)
+		return;
+
+	for (i=0; i<dev->mc_count; i++) {
+		memcpy(reqbuf+i*ETH_ALEN, mc->dmi_addr, ETH_ALEN);
+		mc = mc->next;
+	}
+	zd1201_setconfig(zd, ZD1201_RID_CNFGROUPADDRESS, reqbuf,x+	    dev->mc_count*ETH_ALEN, 0);
+	
+}
+
+static int zd1201_config_commit(struct net_device *dev, 
+    struct iw_request_info *info, struct iw_point *data, char *essid)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+
+	return zd1201_mac_reset(zd);
+}
+
+static int zd1201_get_name(struct net_device *dev,
+    struct iw_request_info *info, char *name, char *extra)
+{
+	strcpy(name, "IEEE 802.11b");
+
+	return 0;
+}
+
+static int zd1201_set_freq(struct net_device *dev,
+    struct iw_request_info *info, struct iw_freq *freq, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short channel = 0;
+	int err;
+
+	if (freq->e == 0)
+		channel = freq->m;
+	else {
+		if (freq->m >= 2482)
+			channel = 14;
+		if (freq->m >= 2407)
+			channel = (freq->m-2407)/5;
+	}
+
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFOWNCHANNEL, channel);
+	if (err)
+		return err;
+
+	zd1201_mac_reset(zd);
+
+	return 0;
+}
+
+static int zd1201_get_freq(struct net_device *dev,
+    struct iw_request_info *info, struct iw_freq *freq, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short channel;
+	int err;
+
+	err = zd1201_getconfig16(zd, ZD1201_RID_CNFOWNCHANNEL, &channel);
+	if (err)
+		return err;
+	freq->e = 0;
+	freq->m = channel;
+
+	return 0;
+}
+
+static int zd1201_set_mode(struct net_device *dev,
+    struct iw_request_info *info, __u32 *mode, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short porttype, monitor = 0;
+	unsigned char buffer[IW_ESSID_MAX_SIZE+2];
+	int err;
+
+	if (zd->ap) {
+		if (*mode != IW_MODE_MASTER)
+			return -EINVAL;
+		return 0;
+	}
+
+	err = zd1201_setconfig16(zd, ZD1201_RID_PROMISCUOUSMODE, 0);
+	if (err)
+		return err;
+	zd->dev->type = ARPHRD_ETHER;
+	switch(*mode) {
+		case IW_MODE_MONITOR:x+			monitor = 1;
+			zd->dev->type = ARPHRD_IEEE80211;
+			/* Make sure we are no longer associated with byx+			   setting an 'impossible' essid.x+			   (otherwise we mess up firmware)
+			 */
+			zd1201_join(zd, "\0-*#\0", 5);
+			/* Put port in pIBSS */
+		case 8: /* No pseudo-IBSS in wireless extensions (yet) */
+			porttype = ZD1201_PORTTYPE_PSEUDOIBSS;
+			break;
+		case IW_MODE_ADHOC:
+			porttype = ZD1201_PORTTYPE_IBSS;
+			break;
+		case IW_MODE_INFRA:
+			porttype = ZD1201_PORTTYPE_BSS;
+			break;
+		default:x+			return -EINVAL;
+	}
+
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFPORTTYPE, porttype);
+	if (err)
+		return err;
+	if (zd->monitor && !monitor) {
+			zd1201_disable(zd);
+			*(__le16 *)buffer = cpu_to_le16(zd->essidlen);
+			memcpy(buffer+2, zd->essid, zd->essidlen);
+			err = zd1201_setconfig(zd, ZD1201_RID_CNFDESIREDSSID,x+			    buffer, IW_ESSID_MAX_SIZE+2, 1);
+			if (err)
+				return err;
+	}
+	zd->monitor=monitor;
+	/* If monitor mode is set we don't actually turn it on here since itx+	 * is done during mac reset anyway (see zd1201_mac_enable).
+	 */
+
+	zd1201_mac_reset(zd);
+
+	return 0;
+}
+
+static int zd1201_get_mode(struct net_device *dev,
+    struct iw_request_info *info, __u32 *mode, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short porttype;
+	int err;
+
+	err = zd1201_getconfig16(zd, ZD1201_RID_CNFPORTTYPE, &porttype);
+	if (err)
+		return err;
+	switch(porttype) {
+		case ZD1201_PORTTYPE_IBSS:x+			*mode = IW_MODE_ADHOC;
+			break;
+		case ZD1201_PORTTYPE_BSS:x+			*mode = IW_MODE_INFRA;
+			break;
+		case ZD1201_PORTTYPE_WDS:x+			*mode = IW_MODE_REPEAT;
+			break;
+		case ZD1201_PORTTYPE_PSEUDOIBSS:x+			*mode = 8;/* No Pseudo-IBSS... */
+			break;
+		case ZD1201_PORTTYPE_AP:x+			*mode = IW_MODE_MASTER;
+			break;
+		default:x+			dev_dbg(&zd->usb->dev, "Unknown porttype: %d\n",x+			    porttype);
+			*mode = IW_MODE_AUTO;
+	}
+	if (zd->monitor)
+		*mode = IW_MODE_MONITOR;
+
+	return 0;
+}
+
+static int zd1201_get_range(struct net_device *dev,
+    struct iw_request_info *info, struct iw_point *wrq, char *extra)
+{
+	struct iw_range *range = (struct iw_range *)extra;
+
+	wrq->length = sizeof(struct iw_range);
+	memset(range, 0, sizeof(struct iw_range));
+	range->we_version_compiled = WIRELESS_EXT;
+	range->we_version_source = WIRELESS_EXT;
+
+	range->max_qual.qual = 128;
+	range->max_qual.level = 128;
+	range->max_qual.noise = 128;
+	range->max_qual.updated = 7;
+
+	range->encoding_size[0] = 5;
+	range->encoding_size[1] = 13;
+	range->num_encoding_sizes = 2;
+	range->max_encoding_tokens = ZD1201_NUMKEYS;
+
+	range->num_bitrates = 4;
+	range->bitrate[0] = 1000000;x+	range->bitrate[1] = 2000000;x+	range->bitrate[2] = 5500000;x+	range->bitrate[3] = 11000000;x+
+	range->min_rts = 0;
+	range->min_frag = ZD1201_FRAGMIN;
+	range->max_rts = ZD1201_RTSMAX;
+	range->min_frag = ZD1201_FRAGMAX;
+
+	return 0;
+}
+
+/*	Little bit of magic here: we only get the quality if we poll
+ *	for it, and we never get an actual request to trigger such
+ *	a poll. Therefore we 'asume' that the user will soon ask for
+ *	the stats after asking the bssid.x+ */x+static int zd1201_get_wap(struct net_device *dev,
+    struct iw_request_info *info, struct sockaddr *ap_addr, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	unsigned char buffer[6];
+
+	if (!zd1201_getconfig(zd, ZD1201_RID_COMMSQUALITY, buffer, 6)) {
+		/* Unfortunatly the quality and noise reported is useless.x+		   they seem to be accumulators that increase until youx+		   read them, unless we poll on a fixed interval we can'tx+		   use themx+		 */
+		/*zd->iwstats.qual.qual = le16_to_cpu(((__le16 *)buffer)[0]);*/
+		zd->iwstats.qual.level = le16_to_cpu(((__le16 *)buffer)[1]);
+		/*zd->iwstats.qual.noise = le16_to_cpu(((__le16 *)buffer)[2]);*/
+		zd->iwstats.qual.updated = 2;
+	}
+
+	return zd1201_getconfig(zd,ZD1201_RID_CURRENTBSSID,ap_addr->sa_data,6);
+}
+
+static int zd1201_set_scan(struct net_device *dev,
+    struct iw_request_info *info, struct iw_point *srq, char *extra)
+{
+	/* We do everything in get_scan */
+	return 0;
+}
+
+static int zd1201_get_scan(struct net_device *dev,
+    struct iw_request_info *info, struct iw_point *srq, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	int err, i, j, enabled_save;
+	struct iw_event iwe;x+	char *cev = extra;
+	char *end_buf = extra + IW_SCAN_MAX_DATA;
+
+	/* No scanning in AP mode */x+	if (zd->ap)
+		return -EOPNOTSUPP;
+
+	/* Scan doesn't seem to work if disabled */x+	enabled_save = zd->mac_enabled;
+	zd1201_enable(zd);
+
+	zd->rxdatas = 0;
+	err = zd1201_docmd(zd, ZD1201_CMDCODE_INQUIRE, 
+	     ZD1201_INQ_SCANRESULTS, 0, 0);
+	if (err)
+		return err;
+
+	wait_event_interruptible(zd->rxdataq, zd->rxdatas);
+	if (!zd->rxlen)
+		return -EIO;
+
+	if (le16_to_cpu(*(__le16*)&zd->rxdata[2]) != ZD1201_INQ_SCANRESULTS)
+		return -EIO;
+
+	for(i=8; i<zd->rxlen; i+=62) {
+		iwe.cmd = SIOCGIWAP;
+		iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
+		memcpy(iwe.u.ap_addr.sa_data, zd->rxdata+i+6, 6);
+		cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_ADDR_LEN);
+
+		iwe.cmd = SIOCGIWESSID;
+		iwe.u.data.length = zd->rxdata[i+16];
+		iwe.u.data.flags = 1;
+		cev = iwe_stream_add_point(cev, end_buf, &iwe, zd->rxdata+i+18);
+
+		iwe.cmd = SIOCGIWMODE;
+		if (zd->rxdata[i+14]&0x01)
+			iwe.u.mode = IW_MODE_MASTER;
+		else
+			iwe.u.mode = IW_MODE_ADHOC;
+		cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_UINT_LEN);
+		
+		iwe.cmd = SIOCGIWFREQ;
+		iwe.u.freq.m = zd->rxdata[i+0];
+		iwe.u.freq.e = 0;
+		cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_FREQ_LEN);
+		
+		iwe.cmd = SIOCGIWRATE;
+		iwe.u.bitrate.fixed = 0;
+		iwe.u.bitrate.disabled = 0;
+		for (j=0; j<10; j++) if (zd->rxdata[i+50+j]) {
+			iwe.u.bitrate.value = (zd->rxdata[i+50+j]&0x7f)*500000;x+			cev=iwe_stream_add_event(cev, end_buf, &iwe,x+			    IW_EV_PARAM_LEN);
+		}
+		
+		iwe.cmd = SIOCGIWENCODE;
+		iwe.u.data.length = 0;
+		if (zd->rxdata[i+14]&0x10)
+			iwe.u.data.flags = IW_ENCODE_ENABLED;
+		else
+			iwe.u.data.flags = IW_ENCODE_DISABLED;
+		cev = iwe_stream_add_point(cev, end_buf, &iwe, NULL);
+		
+		iwe.cmd = IWEVQUAL;
+		iwe.u.qual.qual = zd->rxdata[i+4];
+		iwe.u.qual.noise= zd->rxdata[i+2]/10-100;
+		iwe.u.qual.level = (256+zd->rxdata[i+4]*100)/255-100;
+		iwe.u.qual.updated = 7;
+		cev = iwe_stream_add_event(cev, end_buf, &iwe, IW_EV_QUAL_LEN);
+	}
+
+	if (!enabled_save)
+		zd1201_disable(zd);
+
+	srq->length = cev - extra;
+	srq->flags = 0;
+
+	return 0;
+}
+
+static int zd1201_set_essid(struct net_device *dev,
+    struct iw_request_info *info, struct iw_point *data, char *essid)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+
+	if (data->length > IW_ESSID_MAX_SIZE)
+		return -EINVAL;
+	if (data->length < 1)
+		data->length = 1;
+	zd->essidlen = data->length-1;
+	memset(zd->essid, 0, IW_ESSID_MAX_SIZE+1);
+	memcpy(zd->essid, essid, data->length);
+	return zd1201_join(zd, zd->essid, zd->essidlen);
+}
+
+static int zd1201_get_essid(struct net_device *dev,
+    struct iw_request_info *info, struct iw_point *data, char *essid)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+
+	memcpy(essid, zd->essid, zd->essidlen);
+	data->flags = 1;
+	data->length = zd->essidlen;
+
+	return 0;
+}
+
+static int zd1201_get_nick(struct net_device *dev, struct iw_request_info *info,
+    struct iw_point *data, char *nick)
+{
+	strcpy(nick, "zd1201");
+	data->flags = 1;
+	data->length = strlen(nick);
+	return 0;
+}
+
+static int zd1201_set_rate(struct net_device *dev,
+    struct iw_request_info *info, struct iw_param *rrq, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short rate;
+	int err;
+
+	switch (rrq->value) {
+		case 1000000:x+			rate = ZD1201_RATEB1;
+			break;
+		case 2000000:x+			rate = ZD1201_RATEB2;
+			break;
+		case 5500000:x+			rate = ZD1201_RATEB5;
+			break;
+		case 11000000:x+		default:x+			rate = ZD1201_RATEB11;
+			break;
+	}
+	if (!rrq->fixed) { /* Also enable all lower bitrates */
+		rate |= rate-1;
+	}x+	
+	err = zd1201_setconfig16(zd, ZD1201_RID_TXRATECNTL, rate);
+	if (err)
+		return err;
+
+	return zd1201_mac_reset(zd);
+}
+
+static int zd1201_get_rate(struct net_device *dev,
+    struct iw_request_info *info, struct iw_param *rrq, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short rate;
+	int err;
+
+	err = zd1201_getconfig16(zd, ZD1201_RID_CURRENTTXRATE, &rate);
+	if (err)
+		return err;
+
+	switch(rate) {
+		case 1:x+			rrq->value = 1000000;x+			break;
+		case 2:x+			rrq->value = 2000000;x+			break;
+		case 5:x+			rrq->value = 5500000;x+			break;
+		case 11:x+			rrq->value = 11000000;x+			break;
+		default:x+			rrq->value = 0;
+	}
+	rrq->fixed = 0;
+	rrq->disabled = 0;
+
+	return 0;
+}
+
+static int zd1201_set_rts(struct net_device *dev, struct iw_request_info *info,
+    struct iw_param *rts, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	int err;
+	short val = rts->value;
+
+	if (rts->disabled || !rts->fixed)x+		val = ZD1201_RTSMAX;
+	if (val > ZD1201_RTSMAX)
+		return -EINVAL;
+	if (val < 0)
+		return -EINVAL;
+
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFRTSTHRESHOLD, val);
+	if (err)
+		return err;
+	return zd1201_mac_reset(zd);
+}
+
+static int zd1201_get_rts(struct net_device *dev, struct iw_request_info *info,
+    struct iw_param *rts, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short rtst;
+	int err;
+
+	err = zd1201_getconfig16(zd, ZD1201_RID_CNFRTSTHRESHOLD, &rtst);
+	if (err)
+		return err;
+	rts->value = rtst;
+	rts->disabled = (rts->value == ZD1201_RTSMAX);
+	rts->fixed = 1;
+
+	return 0;
+}
+
+static int zd1201_set_frag(struct net_device *dev, struct iw_request_info *info,
+    struct iw_param *frag, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	int err;
+	short val = frag->value;
+
+	if (frag->disabled || !frag->fixed)x+		val = ZD1201_FRAGMAX;
+	if (val > ZD1201_FRAGMAX)
+		return -EINVAL;
+	if (val < ZD1201_FRAGMIN)
+		return -EINVAL;
+	if (val & 1)
+		return -EINVAL;
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFFRAGTHRESHOLD, val);
+	if (err)
+		return err;
+	return zd1201_mac_reset(zd);
+}
+
+static int zd1201_get_frag(struct net_device *dev, struct iw_request_info *info,
+    struct iw_param *frag, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short fragt;
+	int err;
+
+	err = zd1201_getconfig16(zd, ZD1201_RID_CNFFRAGTHRESHOLD, &fragt);
+	if (err)
+		return err;
+	frag->value = fragt;
+	frag->disabled = (frag->value == ZD1201_FRAGMAX);
+	frag->fixed = 1;
+
+	return 0;
+}
+
+static int zd1201_set_retry(struct net_device *dev,
+    struct iw_request_info *info, struct iw_param *rrq, char *extra)
+{
+	return 0;
+}
+
+static int zd1201_get_retry(struct net_device *dev,
+    struct iw_request_info *info, struct iw_param *rrq, char *extra)
+{
+	return 0;
+}
+
+static int zd1201_set_encode(struct net_device *dev,
+    struct iw_request_info *info, struct iw_point *erq, char *key)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short i;
+	int err, rid;
+
+	if (erq->length > ZD1201_MAXKEYLEN)
+		return -EINVAL;
+
+	i = (erq->flags & IW_ENCODE_INDEX)-1;
+	if (i == -1) {
+		err = zd1201_getconfig16(zd,ZD1201_RID_CNFDEFAULTKEYID,&i);
+		if (err)
+			return err;
+	} else {
+		err = zd1201_setconfig16(zd, ZD1201_RID_CNFDEFAULTKEYID, i);
+		if (err)
+			return err;
+	}
+
+	if (i < 0 || i >= ZD1201_NUMKEYS)
+		return -EINVAL;
+
+	rid = ZD1201_RID_CNFDEFAULTKEY0 + i;
+	err = zd1201_setconfig(zd, rid, key, erq->length, 1);
+	if (err)
+		return err;
+	zd->encode_keylen[i] = erq->length;
+	memcpy(zd->encode_keys[i], key, erq->length);
+
+	i=0;
+	if (!(erq->flags & IW_ENCODE_DISABLED & IW_ENCODE_MODE)) {
+		i |= 0x01;
+		zd->encode_enabled = 1;
+	} else
+		zd->encode_enabled = 0;
+	if (erq->flags & IW_ENCODE_RESTRICTED & IW_ENCODE_MODE) {
+		i |= 0x02;
+		zd->encode_restricted = 1;
+	} else
+		zd->encode_restricted = 0;
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFWEBFLAGS, i);
+	if (err)
+		return err;
+
+	if (zd->encode_enabled)
+		i = ZD1201_CNFAUTHENTICATION_SHAREDKEY;
+	else
+		i = ZD1201_CNFAUTHENTICATION_OPENSYSTEM;
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFAUTHENTICATION, i);
+	if (err)
+		return err;
+
+	return zd1201_mac_reset(zd);
+}
+
+static int zd1201_get_encode(struct net_device *dev,
+    struct iw_request_info *info, struct iw_point *erq, char *key)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short i;
+	int err;
+
+	if (zd->encode_enabled)
+		erq->flags = IW_ENCODE_ENABLED;
+	else
+		erq->flags = IW_ENCODE_DISABLED;
+	if (zd->encode_restricted)
+		erq->flags |= IW_ENCODE_RESTRICTED;
+	else
+		erq->flags |= IW_ENCODE_OPEN;
+
+	i = (erq->flags & IW_ENCODE_INDEX) -1;
+	if (i == -1) {
+		err = zd1201_getconfig16(zd, ZD1201_RID_CNFDEFAULTKEYID, &i);
+		if (err)
+			return err;
+	}
+	if (i<0 || i>= ZD1201_NUMKEYS)
+		return -EINVAL;
+
+	erq->flags |= i+1;x+	
+	erq->length = zd->encode_keylen[i];
+	memcpy(key, zd->encode_keys[i], erq->length);
+
+	return 0;
+}
+
+static int zd1201_set_power(struct net_device *dev, 
+    struct iw_request_info *info, struct iw_param *vwrq, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short enabled, duration, level;
+	int err;
+
+	enabled = vwrq->disabled ? 0 : 1;
+	if (enabled) {
+		if (vwrq->flags & IW_POWER_PERIOD) {
+			duration = vwrq->value;
+			err = zd1201_setconfig16(zd, x+			    ZD1201_RID_CNFMAXSLEEPDURATION, duration);
+			if (err)
+				return err;
+			goto out;
+		}
+		if (vwrq->flags & IW_POWER_TIMEOUT) {
+			err = zd1201_getconfig16(zd, x+			    ZD1201_RID_CNFMAXSLEEPDURATION, &duration);
+			if (err)
+				return err;
+			level = vwrq->value * 4 / duration;
+			if (level > 4)
+				level = 4;
+			if (level < 0)
+				level = 0;
+			err = zd1201_setconfig16(zd, ZD1201_RID_CNFPMEPS,x+			    level);
+			if (err)
+				return err;
+			goto out;
+		}
+		return -EINVAL;
+	}
+out:
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFPMENABLED, enabled);
+	if (err)
+		return err;
+
+	return 0;
+}
+
+static int zd1201_get_power(struct net_device *dev,
+    struct iw_request_info *info, struct iw_param *vwrq, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short enabled, level, duration;
+	int err;
+
+	err = zd1201_getconfig16(zd, ZD1201_RID_CNFPMENABLED, &enabled);
+	if (err)
+		return err;
+	err = zd1201_getconfig16(zd, ZD1201_RID_CNFPMEPS, &level);
+	if (err)
+		return err;
+	err = zd1201_getconfig16(zd, ZD1201_RID_CNFMAXSLEEPDURATION, &duration);
+	if (err)
+		return err;
+	vwrq->disabled = enabled ? 0 : 1;
+	if (vwrq->flags & IW_POWER_TYPE) {
+		if (vwrq->flags & IW_POWER_PERIOD) {
+			vwrq->value = duration;
+			vwrq->flags = IW_POWER_PERIOD;
+		} else {
+			vwrq->value = duration * level / 4;
+			vwrq->flags = IW_POWER_TIMEOUT;
+		}
+	}
+	if (vwrq->flags & IW_POWER_MODE) {
+		if (enabled && level)
+			vwrq->flags = IW_POWER_UNICAST_R;
+		else
+			vwrq->flags = IW_POWER_ALL_R;
+	}
+
+	return 0;
+}
+
+
+static const iw_handler zd1201_iw_handler[] =
+{
+	(iw_handler) zd1201_config_commit,	/* SIOCSIWCOMMIT */
+	(iw_handler) zd1201_get_name,    	/* SIOCGIWNAME */
+	(iw_handler) NULL,			/* SIOCSIWNWID */
+	(iw_handler) NULL,			/* SIOCGIWNWID */
+	(iw_handler) zd1201_set_freq,		/* SIOCSIWFREQ */
+	(iw_handler) zd1201_get_freq,		/* SIOCGIWFREQ */
+	(iw_handler) zd1201_set_mode,		/* SIOCSIWMODE */
+	(iw_handler) zd1201_get_mode,		/* SIOCGIWMODE */
+	(iw_handler) NULL,                  	/* SIOCSIWSENS */
+	(iw_handler) NULL,           		/* SIOCGIWSENS */
+	(iw_handler) NULL,			/* SIOCSIWRANGE */
+	(iw_handler) zd1201_get_range,           /* SIOCGIWRANGE */
+	(iw_handler) NULL,			/* SIOCSIWPRIV */
+	(iw_handler) NULL,			/* SIOCGIWPRIV */
+	(iw_handler) NULL,			/* SIOCSIWSTATS */
+	(iw_handler) NULL,			/* SIOCGIWSTATS */
+	(iw_handler) NULL,			/* SIOCSIWSPY */
+	(iw_handler) NULL,			/* SIOCGIWSPY */
+	(iw_handler) NULL,			/* -- hole -- */
+	(iw_handler) NULL,			/* -- hole -- */
+	(iw_handler) NULL/*zd1201_set_wap*/,		/* SIOCSIWAP */
+	(iw_handler) zd1201_get_wap,		/* SIOCGIWAP */
+	(iw_handler) NULL,			/* -- hole -- */
+	(iw_handler) NULL,       		/* SIOCGIWAPLIST */
+	(iw_handler) zd1201_set_scan,		/* SIOCSIWSCAN */
+	(iw_handler) zd1201_get_scan,		/* SIOCGIWSCAN */
+	(iw_handler) zd1201_set_essid,		/* SIOCSIWESSID */
+	(iw_handler) zd1201_get_essid,		/* SIOCGIWESSID */
+	(iw_handler) NULL,         		/* SIOCSIWNICKN */
+	(iw_handler) zd1201_get_nick, 		/* SIOCGIWNICKN */
+	(iw_handler) NULL,			/* -- hole -- */
+	(iw_handler) NULL,			/* -- hole -- */
+	(iw_handler) zd1201_set_rate,		/* SIOCSIWRATE */
+	(iw_handler) zd1201_get_rate,		/* SIOCGIWRATE */
+	(iw_handler) zd1201_set_rts,		/* SIOCSIWRTS */
+	(iw_handler) zd1201_get_rts,		/* SIOCGIWRTS */
+	(iw_handler) zd1201_set_frag,		/* SIOCSIWFRAG */
+	(iw_handler) zd1201_get_frag,		/* SIOCGIWFRAG */
+	(iw_handler) NULL,         		/* SIOCSIWTXPOW */
+	(iw_handler) NULL,          		/* SIOCGIWTXPOW */
+	(iw_handler) zd1201_set_retry,		/* SIOCSIWRETRY */
+	(iw_handler) zd1201_get_retry,		/* SIOCGIWRETRY */
+	(iw_handler) zd1201_set_encode,		/* SIOCSIWENCODE */
+	(iw_handler) zd1201_get_encode,		/* SIOCGIWENCODE */
+	(iw_handler) zd1201_set_power,		/* SIOCSIWPOWER */
+	(iw_handler) zd1201_get_power,		/* SIOCGIWPOWER */
+};
+
+static int zd1201_set_hostauth(struct net_device *dev,
+    struct iw_request_info *info, struct iw_param *rrq, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	int err;
+
+	if (!zd->ap)
+		return -EOPNOTSUPP;
+
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFHOSTAUTH, rrq->value);
+	if (err)
+		return err;
+	return 0;
+}
+
+static int zd1201_get_hostauth(struct net_device *dev,
+    struct iw_request_info *info, struct iw_param *rrq, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short hostauth;
+	int err;
+
+	if (!zd->ap)
+		return -EOPNOTSUPP;
+
+	err = zd1201_getconfig16(zd, ZD1201_RID_CNFHOSTAUTH, &hostauth);
+	if (err)
+		return err;
+	rrq->value = hostauth;
+	rrq->fixed = 1;
+
+	return 0;
+}
+
+static int zd1201_auth_sta(struct net_device *dev,
+    struct iw_request_info *info, struct sockaddr *sta, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	unsigned char buffer[10];
+
+	if (!zd->ap)
+		return -EOPNOTSUPP;
+
+	memcpy(buffer, sta->sa_data, ETH_ALEN);
+	*(short*)(buffer+6) = 0;	/* 0==success, 1==failure */
+	*(short*)(buffer+8) = 0;
+
+	return zd1201_setconfig(zd, ZD1201_RID_AUTHENTICATESTA, buffer, 10, 1);
+}
+
+static int zd1201_set_maxassoc(struct net_device *dev,
+    struct iw_request_info *info, struct iw_param *rrq, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	int err;
+
+	if (!zd->ap)
+		return -EOPNOTSUPP;
+
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFMAXASSOCSTATIONS, rrq->value);
+	if (err)
+		return err;
+	return 0;
+}
+
+static int zd1201_get_maxassoc(struct net_device *dev,
+    struct iw_request_info *info, struct iw_param *rrq, char *extra)
+{
+	struct zd1201 *zd = (struct zd1201 *)dev->priv;
+	short maxassoc;
+	int err;
+
+	if (!zd->ap)
+		return -EOPNOTSUPP;
+
+	err = zd1201_getconfig16(zd, ZD1201_RID_CNFMAXASSOCSTATIONS, &maxassoc);
+	if (err)
+		return err;
+	rrq->value = maxassoc;
+	rrq->fixed = 1;
+
+	return 0;
+}
+
+static const iw_handler zd1201_private_handler[] = {
+	(iw_handler) zd1201_set_hostauth,	/* ZD1201SIWHOSTAUTH */
+	(iw_handler) zd1201_get_hostauth,	/* ZD1201GIWHOSTAUTH */
+	(iw_handler) zd1201_auth_sta,		/* ZD1201SIWAUTHSTA */
+	(iw_handler) NULL,			/* nothing to get */
+	(iw_handler) zd1201_set_maxassoc,	/* ZD1201SIMAXASSOC */
+	(iw_handler) zd1201_get_maxassoc,	/* ZD1201GIMAXASSOC */
+};
+
+static const struct iw_priv_args zd1201_private_args[] = {
+	{ ZD1201SIWHOSTAUTH, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,x+	    IW_PRIV_TYPE_NONE, "sethostauth" },
+	{ ZD1201GIWHOSTAUTH, IW_PRIV_TYPE_NONE,x+	    IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gethostauth" },
+	{ ZD1201SIWAUTHSTA, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, x+	    IW_PRIV_TYPE_NONE, "authstation" },
+	{ ZD1201SIWMAXASSOC, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,x+	    IW_PRIV_TYPE_NONE, "setmaxassoc" },
+	{ ZD1201GIWMAXASSOC, IW_PRIV_TYPE_NONE,x+	    IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "getmaxassoc" },
+};
+
+static const struct iw_handler_def zd1201_iw_handlers = {
+	.num_standard 		= sizeof(zd1201_iw_handler)/sizeof(iw_handler),
+	.num_private 		= sizeof(zd1201_private_handler)/sizeof(iw_handler),
+	.num_private_args 	= sizeof(zd1201_private_args)/sizeof(struct iw_priv_args),
+	.standard 		= (iw_handler *)zd1201_iw_handler,
+	.private 		= (iw_handler *)zd1201_private_handler,
+	.private_args 		= (struct iw_priv_args *) zd1201_private_args,
+};
+
+int zd1201_probe(struct usb_interface *interface, const struct usb_device_id *id)
+{
+	struct zd1201 *zd;
+	struct usb_device *usb;
+	int i, err;
+	short porttype;
+	char buf[IW_ESSID_MAX_SIZE+2];
+
+	usb = interface_to_usbdev(interface);
+
+	zd = kmalloc(sizeof(struct zd1201), GFP_KERNEL);
+	if (!zd) {
+		return -ENOMEM;
+	}x+	memset(zd, 0, sizeof(struct zd1201));
+	zd->ap = ap;
+	zd->usb = usb;
+	zd->removed = 0;
+	init_waitqueue_head(&zd->rxdataq);
+	INIT_HLIST_HEAD(&zd->fraglist);x+	
+	err = zd1201_fw_upload(usb, zd->ap);
+	if (err) {
+		dev_err(&usb->dev, "zd1201 firmware upload failed: %d\n", err);
+		goto err_zd;
+	}x+	
+	zd->endp_in = 1;
+	zd->endp_out = 1;
+	zd->endp_out2 = 2;
+	zd->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
+	zd->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
+	if (!zd->rx_urb || !zd->tx_urb)
+		goto err_zd;
+
+	for(i = 0; i<100; i++)
+		udelay(1000);
+
+	err = zd1201_drvr_start(zd);
+	if (err)
+		goto err_zd;
+
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFMAXDATALEN, 2312);
+	if (err)
+		goto err_start;
+
+	err = zd1201_setconfig16(zd, ZD1201_RID_TXRATECNTL,x+	    ZD1201_RATEB1 | ZD1201_RATEB2 | ZD1201_RATEB5 | ZD1201_RATEB11);
+	if (err)
+		goto err_start;
+
+	zd->dev = alloc_etherdev(0);
+	if (!zd->dev)
+		goto err_start;
+
+	zd->dev->priv = zd;
+	zd->dev->open = zd1201_net_open;
+	zd->dev->stop = zd1201_net_stop;
+	zd->dev->get_stats = zd1201_get_stats;
+	zd->dev->get_wireless_stats = zd1201_get_wireless_stats;
+	zd->dev->wireless_handlers =x+	    (struct iw_handler_def *)&zd1201_iw_handlers;
+	zd->dev->hard_start_xmit = zd1201_hard_start_xmit;
+	zd->dev->watchdog_timeo = ZD1201_TX_TIMEOUT;
+	zd->dev->tx_timeout = zd1201_tx_timeout;
+	zd->dev->set_multicast_list = zd1201_set_multicast;
+	zd->dev->set_mac_address = zd1201_set_mac_address;
+	strcpy(zd->dev->name, "wlan%d");
+
+	err = zd1201_getconfig(zd, ZD1201_RID_CNFOWNMACADDR, 
+	    zd->dev->dev_addr, zd->dev->addr_len);
+	if (err)
+		goto err_net;
+
+	/* Set wildcard essid to match zd->essid */
+	*(__le16 *)buf = cpu_to_le16(0);
+	err = zd1201_setconfig(zd, ZD1201_RID_CNFDESIREDSSID, buf,x+	    IW_ESSID_MAX_SIZE+2, 1);
+	if (err)
+		goto err_net;
+
+	if (zd->ap)
+		porttype = ZD1201_PORTTYPE_AP;
+	else
+		porttype = ZD1201_PORTTYPE_BSS;
+	err = zd1201_setconfig16(zd, ZD1201_RID_CNFPORTTYPE, porttype);
+	if (err)
+		goto err_net;
+
+	err = register_netdev(zd->dev);
+	if (err)
+		goto err_net;
+	dev_info(&usb->dev, "%s: ZD1201 USB Wireless interface\n",x+	    zd->dev->name);x+	
+	usb_set_intfdata(interface, zd);
+	return 0;
+
+err_net:
+	free_netdev(zd->dev);
+err_start:
+	/* Leave the device in reset state */
+	zd1201_docmd(zd, ZD1201_CMDCODE_INIT, 0, 0, 0);
+err_zd:
+	if (zd->tx_urb)
+		usb_free_urb(zd->tx_urb);
+	if (zd->rx_urb)
+		usb_free_urb(zd->rx_urb);
+	kfree(zd);
+	return err;
+}
+
+void zd1201_disconnect(struct usb_interface *interface)
+{
+	struct zd1201 *zd=(struct zd1201 *)usb_get_intfdata(interface);
+	struct hlist_node *node, *node2;
+	struct zd1201_frag *frag;
+
+	if (!zd)
+		return;
+	usb_set_intfdata(interface, NULL);
+	if (zd->dev) {
+		unregister_netdev(zd->dev);
+		free_netdev(zd->dev);
+	}
+
+	hlist_for_each_entry_safe(frag, node, node2, &zd->fraglist, fnode) {
+		hlist_del_init(&frag->fnode);
+		kfree_skb(frag->skb);
+		kfree(frag);
+	}
+
+	if (zd->tx_urb) {
+		usb_kill_urb(zd->tx_urb);
+		usb_free_urb(zd->tx_urb);
+	}
+	if (zd->rx_urb) {
+		usb_kill_urb(zd->rx_urb);
+		usb_free_urb(zd->rx_urb);
+	}
+	kfree(zd);
+}
+
+struct usb_driver zd1201_usb = {
+	.owner = THIS_MODULE,
+	.name = "zd1201",
+	.probe = zd1201_probe,
+	.disconnect = zd1201_disconnect,
+	.id_table = zd1201_table,
+};
+
+static int __init zd1201_init(void)
+{
+	return usb_register(&zd1201_usb);
+}
+
+static void __exit zd1201_cleanup(void)
+{
+	usb_deregister(&zd1201_usb);
+}
+
+module_init(zd1201_init);
+module_exit(zd1201_cleanup);
diff -Nru a/drivers/usb/net/zd1201.h b/drivers/usb/net/zd1201.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/drivers/usb/net/zd1201.h	2005-03-07 20:41:29 -08:00
@@ -0,0 +1,147 @@
+/*x+ *	Copyright (c) 2004, 2005 Jeroen Vreeken (pe1rxq@amsat.org)
+ *x+ *	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.
+ *x+ *	Parts of this driver have been derived from a wlan-ng version
+ *	modified by ZyDAS.x+ *	Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.x+ */x+
+#ifndef _INCLUDE_ZD1201_H_
+#define _INCLUDE_ZD1201_H_
+
+#define ZD1201_NUMKEYS		4
+#define ZD1201_MAXKEYLEN	13
+#define ZD1201_MAXMULTI		16
+#define ZD1201_FRAGMAX		2500
+#define ZD1201_FRAGMIN		256
+#define ZD1201_RTSMAX		2500
+
+#define ZD1201_RXSIZE		3000
+
+struct zd1201 {
+	struct usb_device	*usb;
+	int			removed;
+	struct net_device	*dev;
+	struct net_device_stats stats;
+	struct iw_statistics	iwstats;
+
+	int			endp_in;
+	int			endp_out;
+	int			endp_out2;
+	struct urb		*rx_urb;
+	struct urb		*tx_urb;
+
+	unsigned char 		rxdata[ZD1201_RXSIZE];
+	int			rxlen;
+	wait_queue_head_t	rxdataq;
+	int			rxdatas;
+	struct hlist_head	fraglist;
+	unsigned char		txdata[ZD1201_RXSIZE];
+
+	int			ap;
+	char			essid[IW_ESSID_MAX_SIZE+1];
+	int			essidlen;
+	int			mac_enabled;
+	int			monitor;
+	int			encode_enabled;
+	int			encode_restricted;
+	unsigned char		encode_keys[ZD1201_NUMKEYS][ZD1201_MAXKEYLEN];
+	int			encode_keylen[ZD1201_NUMKEYS];
+};
+
+struct zd1201_frag {
+	struct hlist_node	fnode;
+	int			seq;
+	struct sk_buff		*skb;
+};
+
+#define ZD1201SIWHOSTAUTH SIOCIWFIRSTPRIV
+#define ZD1201GIWHOSTAUTH ZD1201SIWHOSTAUTH+1
+#define ZD1201SIWAUTHSTA SIOCIWFIRSTPRIV+2
+#define ZD1201SIWMAXASSOC SIOCIWFIRSTPRIV+4
+#define ZD1201GIWMAXASSOC ZD1201SIWMAXASSOC+1
+
+#define ZD1201_FW_TIMEOUT	(1000)
+
+#define ZD1201_TX_TIMEOUT	(2000)
+
+#define ZD1201_USB_CMDREQ	0
+#define ZD1201_USB_RESREQ	1
+
+#define	ZD1201_CMDCODE_INIT	0x00
+#define ZD1201_CMDCODE_ENABLE	0x01
+#define ZD1201_CMDCODE_DISABLE	0x02
+#define ZD1201_CMDCODE_ALLOC	0x0a
+#define ZD1201_CMDCODE_INQUIRE	0x11
+#define ZD1201_CMDCODE_SETRXRID	0x17
+#define ZD1201_CMDCODE_ACCESS	0x21
+
+#define ZD1201_PACKET_EVENTSTAT	0x0
+#define ZD1201_PACKET_RXDATA	0x1
+#define ZD1201_PACKET_INQUIRE	0x2
+#define ZD1201_PACKET_RESOURCE	0x3
+
+#define ZD1201_ACCESSBIT	0x0100
+
+#define ZD1201_RID_CNFPORTTYPE		0xfc00
+#define ZD1201_RID_CNFOWNMACADDR	0xfc01
+#define ZD1201_RID_CNFDESIREDSSID	0xfc02
+#define ZD1201_RID_CNFOWNCHANNEL	0xfc03
+#define ZD1201_RID_CNFOWNSSID		0xfc04
+#define ZD1201_RID_CNFMAXDATALEN	0xfc07
+#define ZD1201_RID_CNFPMENABLED		0xfc09
+#define ZD1201_RID_CNFPMEPS		0xfc0a
+#define ZD1201_RID_CNFMAXSLEEPDURATION	0xfc0c
+#define ZD1201_RID_CNFDEFAULTKEYID	0xfc23
+#define ZD1201_RID_CNFDEFAULTKEY0	0xfc24
+#define ZD1201_RID_CNFDEFAULTKEY1	0xfc25
+#define ZD1201_RID_CNFDEFAULTKEY2	0xfc26
+#define ZD1201_RID_CNFDEFAULTKEY3	0xfc27
+#define ZD1201_RID_CNFWEBFLAGS		0xfc28
+#define ZD1201_RID_CNFAUTHENTICATION	0xfc2a
+#define ZD1201_RID_CNFMAXASSOCSTATIONS	0xfc2b
+#define ZD1201_RID_CNFHOSTAUTH		0xfc2e
+#define ZD1201_RID_CNFGROUPADDRESS	0xfc80
+#define ZD1201_RID_CNFFRAGTHRESHOLD	0xfc82
+#define ZD1201_RID_CNFRTSTHRESHOLD	0xfc83
+#define ZD1201_RID_TXRATECNTL		0xfc84
+#define ZD1201_RID_PROMISCUOUSMODE	0xfc85
+#define ZD1201_RID_CNFBASICRATES	0xfcb3
+#define ZD1201_RID_AUTHENTICATESTA	0xfce3
+#define ZD1201_RID_CURRENTBSSID		0xfd42
+#define ZD1201_RID_COMMSQUALITY		0xfd43
+#define ZD1201_RID_CURRENTTXRATE	0xfd44
+#define ZD1201_RID_CNFMAXTXBUFFERNUMBER	0xfda0
+#define ZD1201_RID_CURRENTCHANNEL	0xfdc1
+
+#define ZD1201_INQ_SCANRESULTS		0xf101
+
+#define ZD1201_INF_LINKSTATUS		0xf200
+#define ZD1201_INF_ASSOCSTATUS		0xf201
+#define ZD1201_INF_AUTHREQ		0xf202
+
+#define ZD1201_ASSOCSTATUS_STAASSOC	0x1
+#define ZD1201_ASSOCSTATUS_REASSOC	0x2
+#define ZD1201_ASSOCSTATUS_DISASSOC	0x3
+#define ZD1201_ASSOCSTATUS_ASSOCFAIL	0x4
+#define ZD1201_ASSOCSTATUS_AUTHFAIL	0x5
+
+#define ZD1201_PORTTYPE_IBSS		0
+#define ZD1201_PORTTYPE_BSS		1
+#define ZD1201_PORTTYPE_WDS		2
+#define ZD1201_PORTTYPE_PSEUDOIBSS	3
+#define ZD1201_PORTTYPE_AP		6
+
+#define ZD1201_RATEB1	1
+#define ZD1201_RATEB2	2
+#define ZD1201_RATEB5	4	/* 5.5 really, but 5 is shorter :) */
+#define ZD1201_RATEB11	8
+
+#define ZD1201_CNFAUTHENTICATION_OPENSYSTEM	0
+#define ZD1201_CNFAUTHENTICATION_SHAREDKEY	1
+
+#endif /* _INCLUDE_ZD1201_H_ */
diff -Nru a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
--- a/drivers/usb/serial/belkin_sa.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/serial/belkin_sa.c	2005-03-07 20:46:18 -08:00
@@ -158,7 +158,7 @@
  * ***************************************************************************
  */
 
-#define WDR_TIMEOUT (HZ * 5 ) /* default urb timeout */
+#define WDR_TIMEOUT 5000 /* default urb timeout */
 
 /* assumes that struct usb_serial *serial is available */
 #define BSA_USB_CMD(c,v) usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), \
diff -Nru a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
--- a/drivers/usb/serial/cyberjack.c	2004-10-21 12:51:02 -07:00
+++ b/drivers/usb/serial/cyberjack.c	2005-03-07 20:43:55 -08:00
@@ -4,7 +4,7 @@
  *  Copyright (C) 2001  REINER SCT
  *  Author: Matthias Bruestle
  *
- *  Contact: linux-usb@sii.li (see MAINTAINERS)
+ *  Contact: support@reiner-sct.com (see MAINTAINERS)
  *
  *  This program is largely derived from work by the linux-usb group
  *  and associated source files.  Please see the usb/serial files for
@@ -20,6 +20,11 @@
  *
  *  In case of problems, please write to the contact e-mail address
  *  mentioned above.
+ *x+ *  Please note that later models of the cyberjack reader family arex+ *  supported by a libusb-based userspace device driver.
+ *x+ *  Homepage: http://www.reiner-sct.de/support/treiber_cyberjack.php#linux
  */
 
 
diff -Nru a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
--- a/drivers/usb/serial/cypress_m8.c	2005-01-14 16:02:19 -08:00
+++ b/drivers/usb/serial/cypress_m8.c	2005-03-07 20:51:23 -08:00
@@ -57,9 +57,10 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/spinlock.h>
-#include <asm/uaccess.h>
 #include <linux/usb.h>
 #include <linux/serial.h>
+#include <linux/delay.h>
+#include <asm/uaccess.h>
 
 #include "usb-serial.h"
 #include "cypress_m8.h"
@@ -1013,8 +1014,7 @@
 	cypress_serial_control(port, baud_mask, data_bits, stop_bits, parity_enable,
 			       parity_type, 0, CYPRESS_SET_CONFIG);
 
-	set_current_state(TASK_INTERRUPTIBLE);
-	schedule_timeout(50*HZ/1000); /* give some time between change and read (50ms) */ 
+	msleep(50);			/* give some time between change and read (50ms) */
 
 	/* we perform a CYPRESS_GET_CONFIG so that the current settings are filled into the private structure
          * this should confirm that all is working if it returns what we just set */
diff -Nru a/drivers/usb/serial/ezusb.c b/drivers/usb/serial/ezusb.c
--- a/drivers/usb/serial/ezusb.c	2004-07-14 14:14:13 -07:00
+++ b/drivers/usb/serial/ezusb.c	2005-03-07 20:46:13 -08:00
@@ -38,7 +38,7 @@
 		return -ENOMEM;
 	}
 	memcpy (transfer_buffer, data, length);
-	result = usb_control_msg (serial->dev, usb_sndctrlpipe(serial->dev, 0), bRequest, 0x40, address, 0, transfer_buffer, length, 3*HZ);
+	result = usb_control_msg (serial->dev, usb_sndctrlpipe(serial->dev, 0), bRequest, 0x40, address, 0, transfer_buffer, length, 3000);
 	kfree (transfer_buffer);
 	return result;
 }
diff -Nru a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
--- a/drivers/usb/serial/ftdi_sio.c	2005-02-02 22:20:59 -08:00
+++ b/drivers/usb/serial/ftdi_sio.c	2005-03-07 20:41:54 -08:00
@@ -296,6 +296,7 @@
 	{ USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0, 0x3ff) },
 	{ USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0, 0x3ff) },
 	{ USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0, 0x3ff) },
+	{ USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_ALT_PID, 0, 0x3ff) },
 	{ USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0, 0x3ff) },
 	{ USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
 	{ USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
@@ -381,6 +382,7 @@
 	{ USB_DEVICE_VER(FTDI_VID, FTDI_IRTRANS_PID, 0x400, 0xffff) },
 	{ USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_PID, 0x400, 0xffff) },
 	{ USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_PID, 0x400, 0xffff) },
+	{ USB_DEVICE_VER(FTDI_VID, FTDI_8U232AM_ALT_ALT_PID, 0x400, 0xffff) },
 	{ USB_DEVICE_VER(FTDI_VID, FTDI_RELAIS_PID, 0x400, 0xffff) },
 	{ USB_DEVICE_VER(FTDI_NF_RIC_VID, FTDI_NF_RIC_PID, 0x400, 0xffff) },
 	{ USB_DEVICE_VER(FTDI_VID, FTDI_XF_632_PID, 0x400, 0xffff) },
@@ -515,6 +517,7 @@
 	{ USB_DEVICE(FTDI_VID, FTDI_SIO_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_ALT_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) },
 	{ USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) },
 	{ USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
@@ -852,7 +855,7 @@
 
 
 
-#define WDR_TIMEOUT (HZ * 5 ) /* default urb timeout */
+#define WDR_TIMEOUT 5000 /* default urb timeout */
 
 /* High and low are for DTR, RTS etc etc */
 #define HIGH 1
diff -Nru a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
--- a/drivers/usb/serial/ftdi_sio.h	2005-01-14 16:00:58 -08:00
+++ b/drivers/usb/serial/ftdi_sio.h	2005-03-07 20:51:19 -08:00
@@ -26,6 +26,7 @@
 #define FTDI_SIO_PID	0x8372	/* Product Id SIO application of 8U100AX  */
 #define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */
 #define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */
+#define FTDI_8U232AM_ALT_ALT_PID 0xf3c0 /* FTDI's second alternate PID for above */
 #define FTDI_8U2232C_PID 0x6010 /* Dual channel device */
 #define FTDI_RELAIS_PID	0xFA10  /* Relais device from Rudolf Gugler */
 #define FTDI_NF_RIC_VID	0x0DCD	/* Vendor Id */
diff -Nru a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
--- a/drivers/usb/serial/io_edgeport.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/serial/io_edgeport.c	2005-03-07 20:49:54 -08:00
@@ -261,6 +261,7 @@
 #include <linux/spinlock.h>
 #include <linux/serial.h>
 #include <linux/ioctl.h>
+#include <linux/wait.h>
 #include <asm/uaccess.h>
 #include <linux/usb.h>
 #include "usb-serial.h"
@@ -971,7 +972,7 @@
 
 	/* we have completed the command */
 	edge_port->commandPending = FALSE;
-	wake_up_interruptible(&edge_port->wait_command);
+	wake_up(&edge_port->wait_command);
 }
 
 
@@ -991,7 +992,6 @@
 	struct usb_serial *serial;
 	struct edgeport_serial *edge_serial;
 	int response;
-	int timeout;
 
 	dbg("%s - port %d", __FUNCTION__, port->number);
 
@@ -1073,10 +1073,7 @@
 	}
 
 	/* now wait for the port to be completely opened */x-	timeout = OPEN_TIMEOUT;
-	while (timeout && edge_port->openPending == TRUE) {
-		timeout = interruptible_sleep_on_timeout (&edge_port->wait_open, timeout);
-	}
+	wait_event_timeout(edge_port->wait_open, (edge_port->openPending != TRUE), OPEN_TIMEOUT);
 
 	if (edge_port->open == FALSE) {
 		/* open timed out */
@@ -1128,9 +1125,10 @@
  ************************************************************************/
 static void block_until_chase_response(struct edgeport_port *edge_port)
 {
+	DEFINE_WAIT(wait);
 	__u16 lastCredits;
 	int timeout = 1*HZ;
-	int wait = 10;
+	int loop = 10;
 
 	while (1) {
 		// Save Last credits
@@ -1148,12 +1146,14 @@
 		}
 
 		// Block the thread for a while
-		interruptible_sleep_on_timeout (&edge_port->wait_chase, timeout);
+		prepare_to_wait(&edge_port->wait_chase, &wait, TASK_UNINTERRUPTIBLE);
+		schedule_timeout(timeout);
+		finish_wait(&edge_port->wait_chase, &wait);
 
 		if (lastCredits == edge_port->txCredits) {
 			// No activity.. count down.
-			wait--;
-			if (wait == 0) {
+			loop--;
+			if (loop == 0) {
 				edge_port->chaseResponsePending = FALSE;
 				dbg("%s - Chase TIMEOUT", __FUNCTION__);
 				return;
@@ -1161,7 +1161,7 @@
 		} else {
 			// Reset timout value back to 10 seconds
 			dbg("%s - Last %d, Current %d", __FUNCTION__, lastCredits, edge_port->txCredits);
-			wait = 10;
+			loop = 10;
 		}
 	}
 }
@@ -1179,10 +1179,11 @@
  ************************************************************************/
 static void block_until_tx_empty (struct edgeport_port *edge_port)
 {
+	DEFINE_WAIT(wait);
 	struct TxFifo *fifo = &edge_port->txfifo;
 	__u32 lastCount;
 	int timeout = HZ/10;
-	int wait = 30;
+	int loop = 30;
 
 	while (1) {
 		// Save Last count
@@ -1195,20 +1196,22 @@
 		}
 
 		// Block the thread for a while
-		interruptible_sleep_on_timeout (&edge_port->wait_chase, timeout);
+		prepare_to_wait (&edge_port->wait_chase, &wait, TASK_UNINTERRUPTIBLE);
+		schedule_timeout(timeout);
+		finish_wait(&edge_port->wait_chase, &wait);
 
 		dbg("%s wait", __FUNCTION__);
 
 		if (lastCount == fifo->count) {
 			// No activity.. count down.
-			wait--;
-			if (wait == 0) {
+			loop--;
+			if (loop == 0) {
 				dbg("%s - TIMEOUT", __FUNCTION__);
 				return;
 			}
 		} else {
 			// Reset timout value back to seconds
-			wait = 30;
+			loop = 30;
 		}
 	}
 }
@@ -1836,12 +1839,12 @@
  *****************************************************************************/
 static int edge_ioctl (struct usb_serial_port *port, struct file *file, unsigned int cmd, unsigned long arg)
 {
+	DEFINE_WAIT(wait);
 	struct edgeport_port *edge_port = usb_get_serial_port_data(port);
 	struct async_icount cnow;
 	struct async_icount cprev;
 	struct serial_icounter_struct icount;
 
-
 	dbg("%s - port %d, cmd = 0x%x", __FUNCTION__, port->number, cmd);
 
 	switch (cmd) {
@@ -1868,7 +1871,9 @@
 			dbg("%s (%d) TIOCMIWAIT", __FUNCTION__,  port->number);
 			cprev = edge_port->icount;
 			while (1) {
-				interruptible_sleep_on(&edge_port->delta_msr_wait);
+				prepare_to_wait(&edge_port->delta_msr_wait, &wait, TASK_INTERRUPTIBLE);
+				schedule();
+				finish_wait(&edge_port->delta_msr_wait, &wait);
 				/* see if a signal did it */
 				if (signal_pending(current))
 					return -ERESTARTSYS;
@@ -2108,7 +2113,7 @@
 				// We could choose to do something else when Byte3 says Timeout on Chase from Edgeport,
 				// like wait longer in block_until_chase_response, but for now we don't. 
 				edge_port->chaseResponsePending = FALSE;
-				wake_up_interruptible (&edge_port->wait_chase);
+				wake_up (&edge_port->wait_chase);
 				return;
 
 			case IOSP_EXT_STATUS_RX_CHECK_RSP:
@@ -2131,7 +2136,7 @@
 		/* we have completed the open */
 		edge_port->openPending = FALSE;
 		edge_port->open = TRUE;
-		wake_up_interruptible(&edge_port->wait_open);
+		wake_up(&edge_port->wait_open);
 		return;
 	}
 
@@ -2500,9 +2505,7 @@
 	// wait for command to finish
 	timeout = COMMAND_TIMEOUT;
 #if 0
-	while (timeout && edge_port->commandPending == TRUE) {
-		timeout = interruptible_sleep_on_timeout (&edge_port->wait_command, timeout);
-	}
+	wait_event (&edge_port->wait_command, (edge_port->commandPending == FALSE));
 
 	if (edge_port->commandPending == TRUE) {
 		/* command timed out */
diff -Nru a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
--- a/drivers/usb/serial/io_ti.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/serial/io_ti.c	2005-03-07 20:46:09 -08:00
@@ -273,7 +273,7 @@
 				index,
 				data,
 				size,
-				HZ);
+				1000);
 	if (status < 0)
 		return status;
 	if (status != size) {
@@ -303,8 +303,7 @@
 				index,
 				data,
 				size,
-				HZ);
-
+				1000);
 	if (status < 0)
 		return status;
 	if (status != size) {
@@ -985,7 +984,7 @@
 				buffer,
 				length,
 				num_sent,
-				HZ);
+				1000);
 	return status;
 }
 
diff -Nru a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
--- a/drivers/usb/serial/ipaq.c	2004-11-16 05:07:20 -08:00
+++ b/drivers/usb/serial/ipaq.c	2005-03-07 20:46:05 -08:00
@@ -662,7 +662,7 @@
 	while (retries--) {
 		result = usb_control_msg(serial->dev,
 				usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
-				0x1, 0, NULL, 0, HZ / 10 + 1);
+				0x1, 0, NULL, 0, 100);
 		if (result == 0) {
 			return 0;
 		}
diff -Nru a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
--- a/drivers/usb/serial/ipw.c	2004-10-21 10:03:22 -07:00
+++ b/drivers/usb/serial/ipw.c	2005-03-07 20:46:01 -08:00
@@ -232,7 +232,7 @@
 				 0, /* index */
 				 NULL,
 				 0,
-				 100*HZ);
+				 100000);
 	if (result < 0)
 		dev_err(&port->dev, "Init of modem failed (error = %d)", result);
 
@@ -260,7 +260,7 @@
 				 0, /* index */
 				 NULL,
 				 0,
-				 100*HZ);
+				 100000);
 	if (result < 0) 
 		dev_err(&port->dev, "Enabling bulk RxRead failed (error = %d)", result);
 
@@ -273,7 +273,7 @@
 				 0,
 				 buf_flow_init,
 				 0x10,
-				 200*HZ);
+				 200000);
 	if (result < 0)
 		dev_err(&port->dev, "initial flowcontrol failed (error = %d)", result);
 
@@ -287,7 +287,7 @@
 				 0,
 				 NULL,
 				 0,
-				 200*HZ);
+				 200000);
 	if (result < 0)
 		dev_err(&port->dev, "setting dtr failed (error = %d)", result);
 
@@ -300,7 +300,7 @@
 				 0,
 				 NULL,
 				 0,
-				 200*HZ);
+				 200000);
 	if (result < 0)
 		dev_err(&port->dev, "setting dtr failed (error = %d)", result);
 	
@@ -327,7 +327,7 @@
 				 0,
 				 NULL,
 				 0,
-				 200*HZ);
+				 200000);
 	if (result < 0)
 		dev_err(&port->dev, "dropping dtr failed (error = %d)", result);
 
@@ -339,7 +339,7 @@
 				 0,
 				 NULL,
 				 0,
-				 200*HZ);
+				 200000);
 	if (result < 0)
 		dev_err(&port->dev, "dropping rts failed (error = %d)", result);
 
@@ -352,7 +352,7 @@
 				 0,
 				 NULL,
 				 0,
-				 200*HZ);
+				 200000);
 	if (result < 0)
 		dev_err(&port->dev, "purge failed (error = %d)", result);
 
@@ -365,7 +365,7 @@
 				 0, /* index */
 				 NULL,
 				 0,
-				 100*HZ);
+				 100000);
 
 	if (result < 0)
 		dev_err(&port->dev, "Disabling bulk RxRead failed (error = %d)", result);
diff -Nru a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
--- a/drivers/usb/serial/ir-usb.c	2004-10-21 10:03:22 -07:00
+++ b/drivers/usb/serial/ir-usb.c	2005-03-07 20:45:57 -08:00
@@ -189,7 +189,7 @@
 	ret = usb_control_msg(dev, usb_rcvctrlpipe(dev,0),
 			IU_REQ_GET_CLASS_DESC,
 			USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
-			0, ifnum, desc, sizeof(*desc), HZ);
+			0, ifnum, desc, sizeof(*desc), 1000);
 	
 	dbg("%s -  ret=%d", __FUNCTION__, ret);
 	if (ret < sizeof(*desc)) {
diff -Nru a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
--- a/drivers/usb/serial/keyspan_pda.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/serial/keyspan_pda.c	2005-03-07 20:45:53 -08:00
@@ -205,7 +205,7 @@
 				 0, /* index */
 				 NULL,
 				 0,
-				 2*HZ);
+				 2000);
 	if (result < 0)
 		dbg("%s - error %d from usb_control_msg", 
 		    __FUNCTION__, result);
@@ -330,7 +330,7 @@
 			     0, /* index */
 			     NULL, /* &data */
 			     0, /* size */x-			     2*HZ); /* timeout */
+			     2000); /* timeout */
 	return(rc);
 }
 
@@ -348,7 +348,7 @@
 	result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
 				4, /* set break */
 				USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT,
-				value, 0, NULL, 0, 2*HZ);
+				value, 0, NULL, 0, 2000);
 	if (result < 0)
 		dbg("%s - error %d from usb_control_msg", 
 		    __FUNCTION__, result);
@@ -416,7 +416,7 @@
 	rc = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
 			     3, /* get pins */
 			     USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_IN,x-			     0, 0, &data, 1, 2*HZ);
+			     0, 0, &data, 1, 2000);
 	if (rc > 0)
 		*value = data;
 	return rc;
@@ -430,7 +430,7 @@
 	rc = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
 			     3, /* set pins */
 			     USB_TYPE_VENDOR|USB_RECIP_INTERFACE|USB_DIR_OUT,
-			     value, 0, NULL, 0, 2*HZ);
+			     value, 0, NULL, 0, 2000);
 	return rc;
 }
 
@@ -545,7 +545,7 @@
 				     0, /* index */
 				     &room,
 				     1,
-				     2*HZ);
+				     2000);
 		if (rc < 0) {
 			dbg(" roomquery failed");
 			goto exit;
@@ -653,7 +653,7 @@
 			     0, /* index */
 			     &room,
 			     1,
-			     2*HZ);
+			     2000);
 	if (rc < 0) {
 		dbg("%s - roomquery failed", __FUNCTION__);
 		goto error;
diff -Nru a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
--- a/drivers/usb/serial/kl5kusb105.c	2004-11-11 19:37:19 -08:00
+++ b/drivers/usb/serial/kl5kusb105.c	2005-03-07 20:45:49 -08:00
@@ -178,7 +178,7 @@
  */
 
 
-#define KLSI_TIMEOUT	 (HZ * 5 ) /* default urb timeout */
+#define KLSI_TIMEOUT	 5000 /* default urb timeout */
 
 static int klsi_105_chg_port_settings(struct usb_serial_port *port,
 				      struct klsi_105_port_settings *settings)
diff -Nru a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
--- a/drivers/usb/serial/mct_u232.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/serial/mct_u232.c	2005-03-07 20:45:44 -08:00
@@ -166,7 +166,7 @@
  * Handle vendor specific USB requests
  */
 
-#define WDR_TIMEOUT (HZ * 5 ) /* default urb timeout */
+#define WDR_TIMEOUT 5000 /* default urb timeout */
 
 /*
  * Later day 2.6.0-test kernels have new baud rates like B230400 which
diff -Nru a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
--- a/drivers/usb/serial/ti_usb_3410_5052.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/serial/ti_usb_3410_5052.c	2005-03-07 20:45:40 -08:00
@@ -1580,7 +1580,7 @@
 	status = usb_control_msg(tdev->td_serial->dev,
 		usb_sndctrlpipe(tdev->td_serial->dev, 0), command,
 		(USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT),
-		value, moduleid, data, size, HZ);
+		value, moduleid, data, size, 1000);
 
 	if (status == size)
 		status = 0;
@@ -1600,7 +1600,7 @@
 	status = usb_control_msg(tdev->td_serial->dev,
 		usb_rcvctrlpipe(tdev->td_serial->dev, 0), command,
 		(USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN),
-		value, moduleid, data, size, HZ);
+		value, moduleid, data, size, 1000);
 
 	if (status == size)
 		status = 0;
@@ -1685,7 +1685,7 @@
 	dbg("%s - downloading firmware", __FUNCTION__);
 	for (pos = 0; pos < buffer_size; pos += done) {
 		len = min(buffer_size - pos, TI_DOWNLOAD_MAX_PACKET_SIZE);
-		status = usb_bulk_msg(dev, pipe, buffer+pos, len, &done, HZ);
+		status = usb_bulk_msg(dev, pipe, buffer+pos, len, &done, 1000);
 		if (status)
 			break;
 	}
diff -Nru a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
--- a/drivers/usb/serial/visor.c	2004-12-21 10:01:03 -08:00
+++ b/drivers/usb/serial/visor.c	2005-03-07 20:45:36 -08:00
@@ -891,7 +891,7 @@
 	/* get the config number */
 	result = usb_control_msg (serial->dev, usb_rcvctrlpipe(serial->dev, 0),
 				  USB_REQ_GET_CONFIGURATION, USB_DIR_IN,x-				  0, 0, &data, 1, HZ * 3);
+				  0, 0, &data, 1, 3000);
 	if (result < 0) {
 		dev_err(dev, "%s: get config number failed: %d\n", __FUNCTION__, result);
 		return result;
@@ -905,7 +905,7 @@
 	result = usb_control_msg (serial->dev, usb_rcvctrlpipe(serial->dev, 0),
 				  USB_REQ_GET_INTERFACE, 
 				  USB_DIR_IN | USB_RECIP_INTERFACE,
-				  0, 0, &data, 1, HZ * 3);
+				  0, 0, &data, 1, 3000);
 	if (result < 0) {
 		dev_err(dev, "%s: get interface number failed: %d\n", __FUNCTION__, result);
 		return result;
diff -Nru a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
--- a/drivers/usb/serial/whiteheat.c	2004-11-11 19:36:41 -08:00
+++ b/drivers/usb/serial/whiteheat.c	2005-03-07 20:45:28 -08:00
@@ -254,6 +254,7 @@
 
 #define COMMAND_PORT		4
 #define COMMAND_TIMEOUT		(2*HZ)	/* 2 second timeout for a command */
+#define	COMMAND_TIMEOUT_MS	2000
 #define CLOSING_DELAY		(30 * HZ)
 
 
@@ -379,7 +380,7 @@
          * unlinking bug in disguise. Same for the call below.
          */
 	usb_clear_halt(serial->dev, pipe);
-	ret = usb_bulk_msg (serial->dev, pipe, command, 2, &alen, COMMAND_TIMEOUT);
+	ret = usb_bulk_msg (serial->dev, pipe, command, 2, &alen, COMMAND_TIMEOUT_MS);
 	if (ret) {
 		err("%s: Couldn't send command [%d]", serial->type->name, ret);
 		goto no_firmware;
@@ -391,7 +392,7 @@
 	pipe = usb_rcvbulkpipe (serial->dev, command_port->bulk_in_endpointAddress);
 	/* See the comment on the usb_clear_halt() above */
 	usb_clear_halt(serial->dev, pipe);
-	ret = usb_bulk_msg (serial->dev, pipe, result, sizeof(*hw_info) + 1, &alen, COMMAND_TIMEOUT);
+	ret = usb_bulk_msg (serial->dev, pipe, result, sizeof(*hw_info) + 1, &alen, COMMAND_TIMEOUT_MS);
 	if (ret) {
 		err("%s: Couldn't get results [%d]", serial->type->name, ret);
 		goto no_firmware;
diff -Nru a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig
--- a/drivers/usb/storage/Kconfig	2005-01-15 14:31:06 -08:00
+++ b/drivers/usb/storage/Kconfig	2005-03-07 20:51:36 -08:00
@@ -89,12 +89,26 @@
 	  Say Y here to support the Microtech/ZiO! CompactFlash reader.
 	  There is a web page at <http://www.ziocorp.com/products/>.
 
-config USB_STORAGE_HP8200e
-	bool "HP CD-Writer 82xx support (EXPERIMENTAL)"
+config USB_STORAGE_USBAT
+	bool "USBAT/USBAT02-based storage support (EXPERIMENTAL)"
 	depends on USB_STORAGE && EXPERIMENTAL
 	help
-	  Say Y here to include additional code to support Hewlett-Packard
-	  8200e/8210e/8230e CD-Writer Plus drives.x+	  Say Y here to include additional code to support storage devicesx+	  based on the SCM/Shuttle USBAT/USBAT02 processors.x+x+	  Devices reported to work with this driver include:x+	  - CompactFlash reader included with Kodak DC3800 camerax+	  - Dane-Elec Zmate CompactFlash readerx+	  - Delkin Efilm reader2x+	  - HP 8200e/8210e/8230e CD-Writer Plus drivesx+	  - I-JAM JS-50Ux+	  - Jessops CompactFlash JESDCFRU BLACKx+	  - Kingston Technology PCREAD-USB/CFx+	  - Maxell UA4 CompactFlash readerx+	  - Memorex UCF-100
+	  - Microtech ZiO! ICS-45 CF2x+	  - RCA LYRA MP3 portablex+	  - Sandisk ImageMate SDDR-05b
 
 config USB_STORAGE_SDDR09
 	bool "SanDisk SDDR-09 (and other SmartMedia) support (EXPERIMENTAL)"
diff -Nru a/drivers/usb/storage/Makefile b/drivers/usb/storage/Makefile
--- a/drivers/usb/storage/Makefile	2003-12-01 02:56:45 -08:00
+++ b/drivers/usb/storage/Makefile	2005-03-07 20:51:45 -08:00
@@ -10,7 +10,7 @@
 obj-$(CONFIG_USB_STORAGE)	+= usb-storage.o
 
 usb-storage-obj-$(CONFIG_USB_STORAGE_DEBUG)	+= debug.o
-usb-storage-obj-$(CONFIG_USB_STORAGE_HP8200e)	+= shuttle_usbat.o
+usb-storage-obj-$(CONFIG_USB_STORAGE_USBAT)	+= shuttle_usbat.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR09)	+= sddr09.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_SDDR55)	+= sddr55.o
 usb-storage-obj-$(CONFIG_USB_STORAGE_FREECOM)	+= freecom.o
diff -Nru a/drivers/usb/storage/protocol.c b/drivers/usb/storage/protocol.c
--- a/drivers/usb/storage/protocol.c	2004-10-06 14:35:10 -07:00
+++ b/drivers/usb/storage/protocol.c	2005-03-07 20:51:57 -08:00
@@ -54,39 +54,6 @@
 #include "transport.h"
 
 /***********************************************************************
- * Helper routines
- ***********************************************************************/
-
-/*
- * Fix-up the return data from a READ CAPACITY command. My Feiya readerx- * returns a value that is 1 too large.x- */
-static void fix_read_capacity(struct scsi_cmnd *srb)
-{
-	unsigned int index, offset;
-	__be32 c;
-	unsigned long capacity;
-
-	/* verify that it's a READ CAPACITY command */x-	if (srb->cmnd[0] != READ_CAPACITY)
-		return;
-
-	index = offset = 0;
-	if (usb_stor_access_xfer_buf((unsigned char *) &c, 4, srb,
-			&index, &offset, FROM_XFER_BUF) != 4)
-		return;
-
-	capacity = be32_to_cpu(c);
-	US_DEBUGP("US: Fixing capacity: from %ld to %ld\n",x-	       capacity+1, capacity);
-	c = cpu_to_be32(capacity - 1);
-
-	index = offset = 0;
-	usb_stor_access_xfer_buf((unsigned char *) &c, 4, srb,
-			&index, &offset, TO_XFER_BUF);
-}
-
-/***********************************************************************
  * Protocol routines
  ***********************************************************************/
 
@@ -174,12 +141,6 @@
 {
 	/* send the command to the transport layer */
 	usb_stor_invoke_transport(srb, us);
-
-	if (srb->result == SAM_STAT_GOOD) {
-		/* Fix the READ CAPACITY result if necessary */x-		if (us->flags & US_FL_FIX_CAPACITY)
-			fix_read_capacity(srb);
-	}
 }
 
 /***********************************************************************
diff -Nru a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c
--- a/drivers/usb/storage/scsiglue.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/storage/scsiglue.c	2005-03-07 20:42:15 -08:00
@@ -149,6 +149,11 @@
 		sdev->skip_ms_page_3f = 1;
 #endif
 
+		/* Some disks return the total number of blocks in response
+		 * to READ CAPACITY rather than the highest block number.
+		 * If this device makes that mistake, tell the sd driver. */
+		if (us->flags & US_FL_FIX_CAPACITY)
+			sdev->fix_capacity = 1;
 	} else {
 
 		/* Non-disk-type devices don't need to blacklist any pages
@@ -157,6 +162,11 @@
 		sdev->use_10_for_ms = 1;
 	}
 
+	/* Some devices choke when they receive a PREVENT-ALLOW MEDIUMx+	 * REMOVAL command, so suppress those commands. */
+	if (us->flags & US_FL_NOT_LOCKABLE)
+		sdev->lockable = 0;
+
 	/* this is to satisfy the compiler, tho I don't think the 
 	 * return code is ever checked anywhere. */
 	return 0;
@@ -346,9 +356,22 @@
 	SPRINTF("   Host scsi%d: usb-storage\n", hostptr->host_no);
 
 	/* print product, vendor, and serial number strings */x-	SPRINTF("       Vendor: %s\n", us->vendor);
-	SPRINTF("      Product: %s\n", us->product);
-	SPRINTF("Serial Number: %s\n", us->serial);
+	if (us->pusb_dev->manufacturer)
+		SPRINTF("       Vendor: %s\n", us->pusb_dev->manufacturer);
+	else if (us->unusual_dev->vendorName)
+		SPRINTF("       Vendor: %s\n", us->unusual_dev->vendorName);
+	else
+		SPRINTF("       Vendor: Unknown\n");
+	if (us->pusb_dev->product)
+		SPRINTF("      Product: %s\n", us->pusb_dev->product);
+	else if (us->unusual_dev->productName)
+		SPRINTF("      Product: %s\n", us->unusual_dev->productName);
+	else
+		SPRINTF("      Product: Unknown\n");
+	if (us->pusb_dev->serial)
+		SPRINTF("Serial Number: %s\n", us->pusb_dev->serial);
+	else
+		SPRINTF("Serial Number: None\n");
 
 	/* show the protocol and transport */
 	SPRINTF("     Protocol: %s\n", us->protocol_name);xdiff -Nru a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c
--- a/drivers/usb/storage/shuttle_usbat.c	2004-07-20 16:30:36 -07:00
+++ b/drivers/usb/storage/shuttle_usbat.c	2005-03-07 20:51:36 -08:00
@@ -4,10 +4,14 @@
  *
  * Current development and maintenance by:
  *   (c) 2000, 2001 Robert Baruch (autophile@starband.net)
+ *   (c) 2004, 2005 Daniel Drake <dsd@gentoo.org>
  *
  * Developed with the assistance of:
  *   (c) 2002 Alan Stern <stern@rowland.org>
  *
+ * Flash support based on earlier work by:
+ *   (c) 2002 Thomas Kreiling <usbdev@sm04.de>
+ *x  * Many originally ATAPI devices were slightly modified to meet the USBx  * market by using some kind of translation from ATAPI to USB on the host,x  * and the peripheral would translate from USB back to ATAPI.
@@ -21,8 +25,8 @@
  * as well. This driver is only guaranteed to work with the ATAPI
  * translation.
  *
- * The only peripheral that I know of (as of 27 Mar 2001) that uses this
- * device is the Hewlett-Packard 8200e/8210e/8230e CD-Writer Plus.
+ * See the Kconfig help text for a list of devices known to be supported by
+ * this driver.
  *
  * 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
@@ -59,44 +63,149 @@
 
 int transferred = 0;
 
+/*x+ * Convenience function to produce an ATAPI read/write sectors commandx+ * Use cmd=0x20 for read, cmd=0x30 for writex+ */x+static void usbat_pack_atapi_sector_cmd(unsigned char *buf,
+					unsigned char thistime,
+					u32 sector, unsigned char cmd)
+{
+	buf[0] = 0;
+	buf[1] = thistime;
+	buf[2] = sector & 0xFF;
+	buf[3] = (sector >>  8) & 0xFF;
+	buf[4] = (sector >> 16) & 0xFF;
+	buf[5] = 0xE0 | ((sector >> 24) & 0x0F);
+	buf[6] = cmd;
+}
+
+/*x+ * Convenience function to get the device type (flash or hp8200)x+ */x+static int usbat_get_device_type(struct us_data *us)
+{
+	return ((struct usbat_info*)us->extra)->devicetype;
+}
+
+/*x+ * Read a register from the devicex+ */x static int usbat_read(struct us_data *us,
 		      unsigned char access,
 		      unsigned char reg,
 		      unsigned char *content)
 {
-	int result;
-
-	result = usb_stor_ctrl_transfer(us,
+	return usb_stor_ctrl_transfer(us,
 		us->recv_ctrl_pipe,
-		access,
+		access | USBAT_CMD_READ_REG,
 		0xC0,
 		(u16)reg,
 		0,
 		content,
 		1);
-
-	return result;
 }
 
+/*x+ * Write to a register on the devicex+ */x static int usbat_write(struct us_data *us,
 		       unsigned char access,
 		       unsigned char reg,
 		       unsigned char content)
 {
-	int result;
-
-	result = usb_stor_ctrl_transfer(us,
+	return usb_stor_ctrl_transfer(us,
 		us->send_ctrl_pipe,
-		access|0x01,
+		access | USBAT_CMD_WRITE_REG,
 		0x40,
 		short_pack(reg, content),
 		0,
 		NULL,
 		0);
+}
 
-	return result;
+/*x+ * Convenience function to perform a bulk readx+ */x+static int usbat_bulk_read(struct us_data *us,
+							 unsigned char *data,
+							 unsigned int len)
+{
+	if (len == 0)
+		return USB_STOR_XFER_GOOD;
+
+	US_DEBUGP("usbat_bulk_read: len = %d\n", len);
+	return usb_stor_bulk_transfer_buf(us, us->recv_bulk_pipe, data, len, NULL);
 }
 
+/*x+ * Convenience function to perform a bulk writex+ */x+static int usbat_bulk_write(struct us_data *us,
+							unsigned char *data,
+							unsigned int len)
+{
+	if (len == 0)
+		return USB_STOR_XFER_GOOD;
+
+	US_DEBUGP("usbat_bulk_write:  len = %d\n", len);
+	return usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, data, len, NULL);
+}
+
+/*x+ * Some USBAT-specific commands can only be executed over a command transportx+ * This transport allows one (len=8) or two (len=16) vendor-specific commands
+ * to be executed.x+ */x+static int usbat_execute_command(struct us_data *us,
+								 unsigned char *commands,
+								 unsigned int len)
+{
+	return usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
+								  USBAT_CMD_EXEC_CMD, 0x40, 0, 0,
+								  commands, len);
+}
+
+/*x+ * Read the status registerx+ */x+static int usbat_get_status(struct us_data *us, unsigned char *status)
+{
+	int rc;
+	rc = usbat_read(us, USBAT_ATA, USBAT_ATA_STATUS, status);
+
+	US_DEBUGP("usbat_get_status: 0x%02X\n", (unsigned short) (*status));
+	return rc;
+}
+
+/*x+ * Check the device statusx+ */x+static int usbat_check_status(struct us_data *us)
+{
+	unsigned char *reply = us->iobuf;
+	int rc;
+
+	if (!us)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	rc = usbat_get_status(us, reply);
+	if (rc != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_FAILED;
+
+	if (*reply & 0x01 && *reply != 0x51) // error/check condition (0x51 is ok)
+		return USB_STOR_TRANSPORT_FAILED;
+
+	if (*reply & 0x20) // device fault
+		return USB_STOR_TRANSPORT_FAILED;
+
+	return USB_STOR_TRANSPORT_GOOD;
+}
+
+/*x+ * Stores critical information in internal registers in prepartion for the executionx+ * of a conditional usbat_read_blocks or usbat_write_blocks call.x+ */x static int usbat_set_shuttle_features(struct us_data *us,
 				      unsigned char external_trigger,
 				      unsigned char epp_control,
@@ -105,76 +214,44 @@
 				      unsigned char subcountH,
 				      unsigned char subcountL)
 {
-	int result;
 	unsigned char *command = us->iobuf;
 
 	command[0] = 0x40;
-	command[1] = 0x81;
+	command[1] = USBAT_CMD_SET_FEAT;
+
+	// The only bit relevant to ATA access is bit 6
+	// which defines 8 bit data access (set) or 16 bit (unset)
 	command[2] = epp_control;
+
+	// If FCQ is set in the qualifier (defined in R/W cmd), then bits U0, U1,
+	// ET1 and ET2 define an external event to be checked for on event of a
+	// _read_blocks or _write_blocks operation. The read/write will not take
+	// place unless the defined trigger signal is active.
 	command[3] = external_trigger;
+
+	// The resultant byte of the mask operation (see mask_byte) is compared for
+	// equivalence with this test pattern. If equal, the read/write will take
+	// place.
 	command[4] = test_pattern;
+
+	// This value is logically ANDed with the status register field specified
+	// in the read/write command.
 	command[5] = mask_byte;
+
+	// If ALQ is set in the qualifier, this field contains the address of the
+	// registers where the byte count should be read for transferring the data.
+	// If ALQ is not set, then this field contains the number of bytes to be
+	// transferred.
 	command[6] = subcountL;
 	command[7] = subcountH;
 
-	result = usb_stor_ctrl_transfer(us,
-		us->send_ctrl_pipe,
-		0x80,
-		0x40,
-		0,
-		0,
-		command,
-		8);
-
-	return result;
-}
-
-static int usbat_read_block(struct us_data *us,
-			    unsigned char access,
-			    unsigned char reg,
-			    unsigned char *content,
-			    unsigned short len,
-			    int use_sg)
-{
-	int result;
-	unsigned char *command = us->iobuf;
-
-	if (!len)
-		return USB_STOR_TRANSPORT_GOOD;
-
-	command[0] = 0xC0;
-	command[1] = access | 0x02;
-	command[2] = reg;
-	command[3] = 0;
-	command[4] = 0;
-	command[5] = 0;
-	command[6] = LSB_of(len);
-	command[7] = MSB_of(len);
-
-	result = usb_stor_ctrl_transfer(us,
-		us->send_ctrl_pipe,
-		0x80,
-		0x40,
-		0,
-		0,
-		command,
-		8);
-
-	if (result != USB_STOR_XFER_GOOD)
-		return USB_STOR_TRANSPORT_ERROR;
-
-	result = usb_stor_bulk_transfer_sg(us, us->recv_bulk_pipe,
-			content, len, use_sg, NULL);
-
-	return (result == USB_STOR_XFER_GOOD ?
-			USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR);
+	return usbat_execute_command(us, command, 8);
 }
 
 /*
  * Block, waiting for an ATA device to become not busy or to reportx  * an error condition.
  */
-x static int usbat_wait_not_busy(struct us_data *us, int minutes)
 {
 	int i;
@@ -189,7 +266,7 @@
 
 	for (i=0; i<1200+minutes*60; i++) {
 
- 		result = usbat_read(us, USBAT_ATA, 0x17, status);
+ 		result = usbat_get_status(us, status);
 
 		if (result!=USB_STOR_XFER_GOOD)
 			return USB_STOR_TRANSPORT_ERROR;
@@ -220,12 +297,45 @@
 	return USB_STOR_TRANSPORT_FAILED;
 }
 
+/*x+ * Read block data from the data registerx+ */x+static int usbat_read_block(struct us_data *us,
+			    unsigned char *content,
+			    unsigned short len)
+{
+	int result;
+	unsigned char *command = us->iobuf;
+
+	if (!len)
+		return USB_STOR_TRANSPORT_GOOD;
+
+	command[0] = 0xC0;
+	command[1] = USBAT_ATA | USBAT_CMD_READ_BLOCK;
+	command[2] = USBAT_ATA_DATA;
+	command[3] = 0;
+	command[4] = 0;
+	command[5] = 0;
+	command[6] = LSB_of(len);
+	command[7] = MSB_of(len);
+
+	result = usbat_execute_command(us, command, 8);
+	if (result != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	result = usbat_bulk_read(us, content, len);
+	return (result == USB_STOR_XFER_GOOD ?
+			USB_STOR_TRANSPORT_GOOD : USB_STOR_TRANSPORT_ERROR);
+}
+
+/*x+ * Write block data via the data registerx+ */x static int usbat_write_block(struct us_data *us,
-			     unsigned char access, 
-			     unsigned char reg,
+			     unsigned char access,
 			     unsigned char *content,
 			     unsigned short len,
-			     int use_sg, int minutes)
+			     int minutes)
 {
 	int result;
 	unsigned char *command = us->iobuf;
@@ -234,57 +344,48 @@
 		return USB_STOR_TRANSPORT_GOOD;
 
 	command[0] = 0x40;
-	command[1] = access | 0x03;
-	command[2] = reg;
+	command[1] = access | USBAT_CMD_WRITE_BLOCK;
+	command[2] = USBAT_ATA_DATA;
 	command[3] = 0;
 	command[4] = 0;
 	command[5] = 0;
 	command[6] = LSB_of(len);
 	command[7] = MSB_of(len);
 
-	result = usb_stor_ctrl_transfer(us,
-		us->send_ctrl_pipe,
-		0x80,
-		0x40,
-		0,
-		0,
-		command,
-		8);
+	result = usbat_execute_command(us, command, 8);
 
 	if (result != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
 
-	result = usb_stor_bulk_transfer_sg(us, us->send_bulk_pipe,
-			content, len, use_sg, NULL);
-
+	result = usbat_bulk_write(us, content, len);
 	if (result != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
 
 	return usbat_wait_not_busy(us, minutes);
 }
 
-static int usbat_rw_block_test(struct us_data *us,
-			       unsigned char access,
-			       unsigned char *registers,
-			       unsigned char *data_out,
-			       unsigned short num_registers,
-			       unsigned char data_reg,
-			       unsigned char status_reg,
-			       unsigned char timeout,
-			       unsigned char qualifier,
-			       int direction,
-			       unsigned char *content,
-			       unsigned short len,
-			       int use_sg,
-			       int minutes)
+/*x+ * Process read and write requests
+ */x+static int usbat_hp8200e_rw_block_test(struct us_data *us,
+				       unsigned char access,
+				       unsigned char *registers,
+				       unsigned char *data_out,
+				       unsigned short num_registers,
+				       unsigned char data_reg,
+				       unsigned char status_reg,
+				       unsigned char timeout,
+				       unsigned char qualifier,
+				       int direction,
+				       unsigned char *content,
+				       unsigned short len,
+				       int use_sg,
+				       int minutes)
 {
 	int result;
 	unsigned int pipe = (direction == DMA_FROM_DEVICE) ?
 			us->recv_bulk_pipe : us->send_bulk_pipe;
 
-	// Not really sure the 0x07, 0x17, 0xfc, 0xe7 is necessary here,
-	// but that's what came out of the trace every single time.
-
 	unsigned char *command = us->iobuf;
 	int i, j;
 	int cmdlen;
@@ -308,8 +409,11 @@
 
 		if (i==0) {
 			cmdlen = 16;
+			// Write to multiple registers
+			// Not really sure the 0x07, 0x17, 0xfc, 0xe7 is necessary here,
+			// but that's what came out of the trace every single time.
 			command[0] = 0x40;
-			command[1] = access | 0x07;
+			command[1] = access | USBAT_CMD_WRITE_REGS;
 			command[2] = 0x07;
 			command[3] = 0x17;
 			command[4] = 0xFC;
@@ -319,9 +423,11 @@
 		} else
 			cmdlen = 8;
 
+		// Conditionally read or write blocks
 		command[cmdlen-8] = (direction==DMA_TO_DEVICE ? 0x40 : 0xC0);
 		command[cmdlen-7] = access |
-				(direction==DMA_TO_DEVICE ? 0x05 : 0x04);
+				(direction==DMA_TO_DEVICE ?
+				 USBAT_CMD_COND_WRITE_BLOCK : USBAT_CMD_COND_READ_BLOCK);
 		command[cmdlen-6] = data_reg;
 		command[cmdlen-5] = status_reg;
 		command[cmdlen-4] = timeout;
@@ -329,14 +435,7 @@
 		command[cmdlen-2] = LSB_of(len);
 		command[cmdlen-1] = MSB_of(len);
 
-		result = usb_stor_ctrl_transfer(us,
-			us->send_ctrl_pipe,
-			0x80,
-			0x40,
-			0,
-			0,
-			command,
-			cmdlen);
+		result = usbat_execute_command(us, command, cmdlen);
 
 		if (result != USB_STOR_XFER_GOOD)
 			return USB_STOR_TRANSPORT_ERROR;
@@ -348,10 +447,7 @@
 				data[1+(j<<1)] = data_out[j];
 			}
 
-			result = usb_stor_bulk_transfer_buf(us,
-					us->send_bulk_pipe,
-					data, num_registers*2, NULL);
-
+			result = usbat_bulk_write(us, data, num_registers*2);
 			if (result != USB_STOR_XFER_GOOD)
 				return USB_STOR_TRANSPORT_ERROR;
 
@@ -403,7 +499,8 @@
 			 */
 
  			result = usbat_read(us, USBAT_ATA, 
-				direction==DMA_TO_DEVICE ? 0x17 : 0x0E, 
+				direction==DMA_TO_DEVICE ?
+					USBAT_ATA_STATUS : USBAT_ATA_ALTSTATUS,
 				status);
 
 			if (result!=USB_STOR_XFER_GOOD)
@@ -430,101 +527,602 @@
 }
 
 /*
- * Write data to multiple registers at once. Not meant for large
- * transfers of data!x+ * Write to multiple registers:
+ * Allows us to write specific data to any registers. The data to be written
+ * gets packed in this sequence: reg0, data0, reg1, data1, ..., regN, dataN
+ * which gets sent through bulk out.
+ * Not designed for large transfers of data!x  */
-x static int usbat_multiple_write(struct us_data *us,
-				unsigned char access,
 				unsigned char *registers,
 				unsigned char *data_out,
 				unsigned short num_registers)
 {
-	int result;
+	int i, result;
 	unsigned char *data = us->iobuf;
-	int i;
 	unsigned char *command = us->iobuf;
 
 	BUG_ON(num_registers > US_IOBUF_SIZE/2);
 
+	// Write to multiple registers, ATA access
 	command[0] = 0x40;
-	command[1] = access | 0x07;
+	command[1] = USBAT_ATA | USBAT_CMD_WRITE_REGS;
+
+	// No relevance
 	command[2] = 0;
 	command[3] = 0;
 	command[4] = 0;
 	command[5] = 0;
+
+	// Number of bytes to be transferred (incl. addresses and data)
 	command[6] = LSB_of(num_registers*2);
 	command[7] = MSB_of(num_registers*2);
 
-	result = usb_stor_ctrl_transfer(us,
-		us->send_ctrl_pipe,
-		0x80,
-		0x40,
-		0,
-		0,
-		command,
-		8);
-
+	// The setup commandx+	result = usbat_execute_command(us, command, 8);
 	if (result != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
 
+	// Create the reg/data, reg/data sequence
 	for (i=0; i<num_registers; i++) {
 		data[i<<1] = registers[i];
 		data[1+(i<<1)] = data_out[i];
 	}
 
-	result = usb_stor_bulk_transfer_buf(us,
-		us->send_bulk_pipe, data, num_registers*2, NULL);
-
+	// Send the data
+	result = usbat_bulk_write(us, data, num_registers*2);
 	if (result != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
 
-	return usbat_wait_not_busy(us, 0);
+	if (usbat_get_device_type(us) == USBAT_DEV_HP8200)
+		return usbat_wait_not_busy(us, 0);
+	else
+		return USB_STOR_TRANSPORT_GOOD;
+}
+
+/*x+ * Conditionally read blocks from device:
+ * Allows us to read blocks from a specific data register, based upon the
+ * condition that a status register can be successfully masked with a statusx+ * qualifier. If this condition is not initially met, the read will waitx+ * up until a maximum amount of time has elapsed, as specified by timeout.x+ * The read will start when the condition is met, otherwise the command aborts.
+ *x+ * The qualifier defined here is not the value that is masked, it defines
+ * conditions for the write to take place. The actual masked qualifier (andx+ * other related details) are defined beforehand with _set_shuttle_features().x+ */x+static int usbat_read_blocks(struct us_data *us,
+							 unsigned char *buffer,
+							 int len)
+{
+	int result;
+	unsigned char *command = us->iobuf;
+
+	command[0] = 0xC0;
+	command[1] = USBAT_ATA | USBAT_CMD_COND_READ_BLOCK;
+	command[2] = USBAT_ATA_DATA;
+	command[3] = USBAT_ATA_STATUS;
+	command[4] = 0xFD; // Timeout (ms);
+	command[5] = USBAT_QUAL_FCQ;
+	command[6] = LSB_of(len);
+	command[7] = MSB_of(len);
+
+	// Multiple block read setup commandx+	result = usbat_execute_command(us, command, 8);
+	if (result != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_FAILED;
+	
+	// Read the blocks we just asked for
+	result = usbat_bulk_read(us, buffer, len);
+	if (result != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_FAILED;
+
+	return USB_STOR_TRANSPORT_GOOD;
+}
+
+/*x+ * Conditionally write blocks to device:
+ * Allows us to write blocks to a specific data register, based upon the
+ * condition that a status register can be successfully masked with a statusx+ * qualifier. If this condition is not initially met, the write will waitx+ * up until a maximum amount of time has elapsed, as specified by timeout.x+ * The read will start when the condition is met, otherwise the command aborts.
+ *x+ * The qualifier defined here is not the value that is masked, it defines
+ * conditions for the write to take place. The actual masked qualifier (andx+ * other related details) are defined beforehand with _set_shuttle_features().x+ */x+static int usbat_write_blocks(struct us_data *us,
+							  unsigned char *buffer,
+							  int len)
+{
+	int result;
+	unsigned char *command = us->iobuf;
+
+	command[0] = 0x40;
+	command[1] = USBAT_ATA | USBAT_CMD_COND_WRITE_BLOCK;
+	command[2] = USBAT_ATA_DATA;
+	command[3] = USBAT_ATA_STATUS;
+	command[4] = 0xFD; // Timeout (ms)
+	command[5] = USBAT_QUAL_FCQ;
+	command[6] = LSB_of(len);
+	command[7] = MSB_of(len);
+
+	// Multiple block write setup commandx+	result = usbat_execute_command(us, command, 8);
+	if (result != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_FAILED;
+	
+	// Write the data
+	result = usbat_bulk_write(us, buffer, len);
+	if (result != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_FAILED;
+
+	return USB_STOR_TRANSPORT_GOOD;
 }
 
+/*x+ * Read the User IO registerx+ */x static int usbat_read_user_io(struct us_data *us, unsigned char *data_flags)
 {
 	int result;
 
 	result = usb_stor_ctrl_transfer(us,
 		us->recv_ctrl_pipe,
-		0x82,
+		USBAT_CMD_UIO,
 		0xC0,
 		0,
 		0,
 		data_flags,
-		1);
+		USBAT_UIO_READ);
+
+	US_DEBUGP("usbat_read_user_io: UIO register reads %02X\n", (unsigned short) (*data_flags));
 
 	return result;
 }
 
+/*x+ * Write to the User IO registerx+ */x static int usbat_write_user_io(struct us_data *us,
 			       unsigned char enable_flags,
 			       unsigned char data_flags)
 {
-	int result;
-
-	result = usb_stor_ctrl_transfer(us,
+	return usb_stor_ctrl_transfer(us,
 		us->send_ctrl_pipe,
-		0x82,
+		USBAT_CMD_UIO,
 		0x40,
 		short_pack(enable_flags, data_flags),
 		0,
 		NULL,
-		0);
+		USBAT_UIO_WRITE);
+}
+
+/*x+ * Reset the devicex+ * Often needed on media change.x+ */x+static int usbat_device_reset(struct us_data *us)
+{
+	int rc;
+
+	// Reset peripheral, enable peripheral control signals
+	// (bring reset signal up)
+	rc = usbat_write_user_io(us,
+							 USBAT_UIO_DRVRST | USBAT_UIO_OE1 | USBAT_UIO_OE0,
+							 USBAT_UIO_EPAD | USBAT_UIO_1);
+	if (rc != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_ERROR;
+			
+	// Enable peripheral control signals
+	// (bring reset signal down)
+	rc = usbat_write_user_io(us,
+							 USBAT_UIO_OE1  | USBAT_UIO_OE0,
+							 USBAT_UIO_EPAD | USBAT_UIO_1);
+	if (rc != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	return USB_STOR_TRANSPORT_GOOD;
+}
+
+/*x+ * Enable card detectx+ */x+static int usbat_device_enable_cdt(struct us_data *us)
+{
+	int rc;
+
+	// Enable peripheral control signals and card detectx+	rc = usbat_write_user_io(us,
+							 USBAT_UIO_ACKD | USBAT_UIO_OE1  | USBAT_UIO_OE0,
+							 USBAT_UIO_EPAD | USBAT_UIO_1);
+	if (rc != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_ERROR;
 
+	return USB_STOR_TRANSPORT_GOOD;
+}
+
+/*x+ * Determine if media is present.x+ */x+static int usbat_flash_check_media_present(unsigned char *uio)
+{
+	if (*uio & USBAT_UIO_UI0) {
+		US_DEBUGP("usbat_flash_check_media_present: no media detected\n");
+		return USBAT_FLASH_MEDIA_NONE;
+	}
+
+	return USBAT_FLASH_MEDIA_CF;
+}
+
+/*x+ * Determine if media has changed since last operationx+ */x+static int usbat_flash_check_media_changed(unsigned char *uio)
+{
+	if (*uio & USBAT_UIO_0) {
+		US_DEBUGP("usbat_flash_check_media_changed: media change detected\n");
+		return USBAT_FLASH_MEDIA_CHANGED;
+	}
+
+	return USBAT_FLASH_MEDIA_SAME;
+}
+
+/*x+ * Check for media change / no media and handle the situation appropriatelyx+ */x+static int usbat_flash_check_media(struct us_data *us,
+				   struct usbat_info *info)
+{
+	int rc;
+	unsigned char *uio = us->iobuf;
+
+	rc = usbat_read_user_io(us, uio);
+	if (rc != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	// Check for media existance
+	rc = usbat_flash_check_media_present(uio);
+	if (rc == USBAT_FLASH_MEDIA_NONE) {
+		info->sense_key = 0x02;
+		info->sense_asc = 0x3A;
+		info->sense_ascq = 0x00;
+		return USB_STOR_TRANSPORT_FAILED;
+	}
+
+	// Check for media change
+	rc = usbat_flash_check_media_changed(uio);
+	if (rc == USBAT_FLASH_MEDIA_CHANGED) {
+
+		// Reset and re-enable card detectx+		rc = usbat_device_reset(us);
+		if (rc != USB_STOR_TRANSPORT_GOOD)
+			return rc;
+		rc = usbat_device_enable_cdt(us);
+		if (rc != USB_STOR_TRANSPORT_GOOD)
+			return rc;
+
+		msleep(50);
+
+		rc = usbat_read_user_io(us, uio);
+		if (rc != USB_STOR_XFER_GOOD)
+			return USB_STOR_TRANSPORT_ERROR;
+		
+		info->sense_key = UNIT_ATTENTION;
+		info->sense_asc = 0x28;
+		info->sense_ascq = 0x00;
+		return USB_STOR_TRANSPORT_FAILED;
+	}
+
+	return USB_STOR_TRANSPORT_GOOD;
+}
+
+/*x+ * Determine whether we are controlling a flash-based reader/writer,
+ * or a HP8200-based CD drive.
+ * Sets transport functions as appropriate.x+ */x+static int usbat_identify_device(struct us_data *us,
+				 struct usbat_info *info)
+{
+	int rc;
+	unsigned char status;
+
+	if (!us || !info)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	rc = usbat_device_reset(us);
+	if (rc != USB_STOR_TRANSPORT_GOOD)
+		return rc;
+
+	/*x+	 * By examining the device signature after a reset, we can identifyx+	 * whether the device supports the ATAPI packet interface.x+	 * The flash-devices do not support this, whereas the HP CDRW's obviouslyx+	 * do.x+	 *x+	 * This method is not ideal, but works because no other devices have been
+	 * produced based on the USBAT/USBAT02.x+	 *x+	 * Section 9.1 of the ATAPI-4 spec states (amongst other things) thatx+	 * after a device reset, a Cylinder low of 0x14 indicates that the devicex+	 * does support packet commands.x+	 */
+	rc = usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, &status);
+	if (rc != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	US_DEBUGP("usbat_identify_device: Cylinder low is %02X\n", status);
+
+	if (status == 0x14) {
+		// Device is HP 8200
+		US_DEBUGP("usbat_identify_device: Detected HP8200 CDRW\n");
+		info->devicetype = USBAT_DEV_HP8200;
+	} else {
+		// Device is a CompactFlash reader/writer
+		US_DEBUGP("usbat_identify_device: Detected Flash reader/writer\n");
+		info->devicetype = USBAT_DEV_FLASH;
+	}
+
+	return USB_STOR_TRANSPORT_GOOD;
+}
+
+/*x+ * Set the transport function based on the device typex+ */x+int usbat_set_transport(struct us_data *us,
+			struct usbat_info *info)
+{
+	int rc;
+
+	if (!info->devicetype) {
+		rc = usbat_identify_device(us, info);
+		if (rc != USB_STOR_TRANSPORT_GOOD) {
+			US_DEBUGP("usbat_set_transport: Could not identify device\n");
+			return 1;
+		}
+	}
+
+	if (usbat_get_device_type(us) == USBAT_DEV_HP8200)
+		us->transport = usbat_hp8200e_transport;
+	else if (usbat_get_device_type(us) == USBAT_DEV_FLASH)
+		us->transport = usbat_flash_transport;
+
+	return 0;
+}
+
+/*x+ * Read the media capacityx+ */x+static int usbat_flash_get_sector_count(struct us_data *us,
+					struct usbat_info *info)
+{
+	unsigned char registers[3] = {
+		USBAT_ATA_SECCNT,
+		USBAT_ATA_DEVICE,
+		USBAT_ATA_CMD,
+	};
+	unsigned char  command[3] = { 0x01, 0xA0, 0xEC };
+	unsigned char *reply;
+	unsigned char status;
+	int rc;
+
+	if (!us || !info)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	reply = kmalloc(512, GFP_NOIO);
+	if (!reply)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	// ATAPI command : IDENTIFY DEVICE
+	rc = usbat_multiple_write(us, registers, command, 3);
+	if (rc != USB_STOR_XFER_GOOD) {
+		US_DEBUGP("usbat_flash_get_sector_count: Gah! identify_device failed\n");
+		rc = USB_STOR_TRANSPORT_ERROR;
+		goto leave;
+	}
+
+	// Read device statusx+	if (usbat_get_status(us, &status) != USB_STOR_XFER_GOOD) {
+		rc = USB_STOR_TRANSPORT_ERROR;
+		goto leave;
+	}
+
+	msleep(100);
+
+	// Read the device identification data
+	rc = usbat_read_block(us, reply, 512);
+	if (rc != USB_STOR_TRANSPORT_GOOD)
+		goto leave;
+
+	info->sectors = ((u32)(reply[117]) << 24) |
+		((u32)(reply[116]) << 16) |
+		((u32)(reply[115]) <<  8) |
+		((u32)(reply[114])      );
+
+	rc = USB_STOR_TRANSPORT_GOOD;
+
+ leave:x+	kfree(reply);
+	return rc;
+}
+
+/*x+ * Read data from devicex+ */x+static int usbat_flash_read_data(struct us_data *us,
+								 struct usbat_info *info,
+								 u32 sector,
+								 u32 sectors)
+{
+	unsigned char registers[7] = {
+		USBAT_ATA_FEATURES,
+		USBAT_ATA_SECCNT,
+		USBAT_ATA_SECNUM,
+		USBAT_ATA_LBA_ME,
+		USBAT_ATA_LBA_HI,
+		USBAT_ATA_DEVICE,
+		USBAT_ATA_STATUS,
+	};
+	unsigned char command[7];
+	unsigned char *buffer;
+	unsigned char  thistime;
+	unsigned int totallen, alloclen;
+	int len, result;
+	unsigned int sg_idx = 0, sg_offset = 0;
+
+	result = usbat_flash_check_media(us, info);
+	if (result != USB_STOR_TRANSPORT_GOOD)
+		return result;
+
+	// we're working in LBA mode.  according to the ATA spec,
+	// we can support up to 28-bit addressing.  I don't know if Jumpshot
+	// supports beyond 24-bit addressing.  It's kind of hard to test
+	// since it requires > 8GB CF card.
+
+	if (sector > 0x0FFFFFFF)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	totallen = sectors * info->ssize;
+
+	// Since we don't read more than 64 KB at a time, we have to create
+	// a bounce buffer and move the data a piece at a time between the
+	// bounce buffer and the actual transfer buffer.
+
+	alloclen = min(totallen, 65536u);
+	buffer = kmalloc(alloclen, GFP_NOIO);
+	if (buffer == NULL)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	do {
+		// loop, never allocate or transfer more than 64k at once
+		// (min(128k, 255*info->ssize) is the real limit)
+		len = min(totallen, alloclen);
+		thistime = (len / info->ssize) & 0xff;
+ 
+		// ATAPI command 0x20 (READ SECTORS)
+		usbat_pack_atapi_sector_cmd(command, thistime, sector, 0x20);
+
+		// Write/execute ATAPI read commandx+		result = usbat_multiple_write(us, registers, command, 7);
+		if (result != USB_STOR_TRANSPORT_GOOD)
+			goto leave;
+
+		// Read the data we just requestedx+		result = usbat_read_blocks(us, buffer, len);
+		if (result != USB_STOR_TRANSPORT_GOOD)
+			goto leave;
+  	 
+		US_DEBUGP("usbat_flash_read_data:  %d bytes\n", len);
+	
+		// Store the data in the transfer buffer
+		usb_stor_access_xfer_buf(buffer, len, us->srb,
+					 &sg_idx, &sg_offset, TO_XFER_BUF);
+
+		sector += thistime;
+		totallen -= len;
+	} while (totallen > 0);
+
+	kfree(buffer);
+	return USB_STOR_TRANSPORT_GOOD;
+
+leave:x+	kfree(buffer);
+	return USB_STOR_TRANSPORT_ERROR;
+}
+
+/*x+ * Write data to devicex+ */x+static int usbat_flash_write_data(struct us_data *us,
+								  struct usbat_info *info,
+								  u32 sector,
+								  u32 sectors)
+{
+	unsigned char registers[7] = {
+		USBAT_ATA_FEATURES,
+		USBAT_ATA_SECCNT,
+		USBAT_ATA_SECNUM,
+		USBAT_ATA_LBA_ME,
+		USBAT_ATA_LBA_HI,
+		USBAT_ATA_DEVICE,
+		USBAT_ATA_STATUS,
+	};
+	unsigned char command[7];
+	unsigned char *buffer;
+	unsigned char  thistime;
+	unsigned int totallen, alloclen;
+	int len, result;
+	unsigned int sg_idx = 0, sg_offset = 0;
+
+	result = usbat_flash_check_media(us, info);
+	if (result != USB_STOR_TRANSPORT_GOOD)
+		return result;
+
+	// we're working in LBA mode.  according to the ATA spec,
+	// we can support up to 28-bit addressing.  I don't know if Jumpshot
+	// supports beyond 24-bit addressing.  It's kind of hard to test
+	// since it requires > 8GB CF card.
+
+	if (sector > 0x0FFFFFFF)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	totallen = sectors * info->ssize;
+
+	// Since we don't write more than 64 KB at a time, we have to create
+	// a bounce buffer and move the data a piece at a time between the
+	// bounce buffer and the actual transfer buffer.
+
+	alloclen = min(totallen, 65536u);
+	buffer = kmalloc(alloclen, GFP_NOIO);
+	if (buffer == NULL)
+		return USB_STOR_TRANSPORT_ERROR;
+
+	do {
+		// loop, never allocate or transfer more than 64k at once
+		// (min(128k, 255*info->ssize) is the real limit)
+		len = min(totallen, alloclen);
+		thistime = (len / info->ssize) & 0xff;
+
+		// Get the data from the transfer buffer
+		usb_stor_access_xfer_buf(buffer, len, us->srb,
+					 &sg_idx, &sg_offset, FROM_XFER_BUF);
+
+		// ATAPI command 0x30 (WRITE SECTORS)
+		usbat_pack_atapi_sector_cmd(command, thistime, sector, 0x30);		
+
+		// Write/execute ATAPI write commandx+		result = usbat_multiple_write(us, registers, command, 7);
+		if (result != USB_STOR_TRANSPORT_GOOD)
+			goto leave;
+
+		// Write the data
+		result = usbat_write_blocks(us, buffer, len);
+		if (result != USB_STOR_TRANSPORT_GOOD)
+			goto leave;
+
+		sector += thistime;
+		totallen -= len;
+	} while (totallen > 0);
+
+	kfree(buffer);
 	return result;
+
+leave:x+	kfree(buffer);
+	return USB_STOR_TRANSPORT_ERROR;
 }
 
 /*
  * Squeeze a potentially huge (> 65535 byte) read10 command intox  * a little ( <= 65535 byte) ATAPI pipex  */
-x-static int usbat_handle_read10(struct us_data *us,
-			       unsigned char *registers,
-			       unsigned char *data,
-			       struct scsi_cmnd *srb)x+static int usbat_hp8200e_handle_read10(struct us_data *us,
+				       unsigned char *registers,
+				       unsigned char *data,
+				       struct scsi_cmnd *srb)x {
 	int result = USB_STOR_TRANSPORT_GOOD;
 	unsigned char *buffer;
@@ -538,9 +1136,10 @@
 
 	if (srb->request_bufflen < 0x10000) {
 
-		result = usbat_rw_block_test(us, USBAT_ATA, 
+		result = usbat_hp8200e_rw_block_test(us, USBAT_ATA, 
 			registers, data, 19,
-			0x10, 0x17, 0xFD, 0x30,
+			USBAT_ATA_DATA, USBAT_ATA_STATUS, 0xFD,
+			(USBAT_QUAL_FCQ | USBAT_QUAL_ALQ),
 			DMA_FROM_DEVICE,
 			srb->request_buffer, 
 			srb->request_bufflen, srb->use_sg, 1);
@@ -607,9 +1206,10 @@
 		data[7+7] = MSB_of(len / srb->transfersize); // SCSI command
 		data[7+8] = LSB_of(len / srb->transfersize); // num sectors
 
-		result = usbat_rw_block_test(us, USBAT_ATA, 
+		result = usbat_hp8200e_rw_block_test(us, USBAT_ATA, 
 			registers, data, 19,
-			0x10, 0x17, 0xFD, 0x30,
+			USBAT_ATA_DATA, USBAT_ATA_STATUS, 0xFD, 
+			(USBAT_QUAL_FCQ | USBAT_QUAL_ALQ),
 			DMA_FROM_DEVICE,
 			buffer,
 			len, 0, 1);
@@ -632,48 +1232,52 @@
 	return result;
 }
 
-static int hp_8200e_select_and_test_registers(struct us_data *us)
+static int usbat_select_and_test_registers(struct us_data *us)
 {
 	int selector;
 	unsigned char *status = us->iobuf;
+	unsigned char max_selector = 0xB0;
+	if (usbat_get_device_type(us) == USBAT_DEV_FLASH)
+		max_selector = 0xA0;
 
 	// try device = master, then device = slave.
 
-	for (selector = 0xA0; selector <= 0xB0; selector += 0x10) {
+	for (selector = 0xA0; selector <= max_selector; selector += 0x10) {
 
-		if (usbat_write(us, USBAT_ATA, 0x16, selector) != 
+		if (usbat_get_device_type(us) == USBAT_DEV_HP8200 &&
+			usbat_write(us, USBAT_ATA, USBAT_ATA_DEVICE, selector) != 
 				USB_STOR_XFER_GOOD)
 			return USB_STOR_TRANSPORT_ERROR;
 
-		if (usbat_read(us, USBAT_ATA, 0x17, status) != 
+		if (usbat_read(us, USBAT_ATA, USBAT_ATA_STATUS, status) != 
 				USB_STOR_XFER_GOOD)
 			return USB_STOR_TRANSPORT_ERROR;
 
-		if (usbat_read(us, USBAT_ATA, 0x16, status) != 
+		if (usbat_read(us, USBAT_ATA, USBAT_ATA_DEVICE, status) != 
 				USB_STOR_XFER_GOOD)
 			return USB_STOR_TRANSPORT_ERROR;
 
-		if (usbat_read(us, USBAT_ATA, 0x14, status) != 
+		if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) != 
 				USB_STOR_XFER_GOOD)
 			return USB_STOR_TRANSPORT_ERROR;
 
-		if (usbat_read(us, USBAT_ATA, 0x15, status) != 
+		if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_HI, status) != 
 				USB_STOR_XFER_GOOD)
 			return USB_STOR_TRANSPORT_ERROR;
 
-		if (usbat_write(us, USBAT_ATA, 0x14, 0x55) != 
+		if (usbat_write(us, USBAT_ATA, USBAT_ATA_LBA_ME, 0x55) != 
 				USB_STOR_XFER_GOOD)
 			return USB_STOR_TRANSPORT_ERROR;
 
-		if (usbat_write(us, USBAT_ATA, 0x15, 0xAA) != 
+		if (usbat_write(us, USBAT_ATA, USBAT_ATA_LBA_HI, 0xAA) != 
 				USB_STOR_XFER_GOOD)
 			return USB_STOR_TRANSPORT_ERROR;
 
-		if (usbat_read(us, USBAT_ATA, 0x14, status) != 
+		if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) != 
 				USB_STOR_XFER_GOOD)
 			return USB_STOR_TRANSPORT_ERROR;
 
-		if (usbat_read(us, USBAT_ATA, 0x15, status) != 
+		if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) != 
 				USB_STOR_XFER_GOOD)
 			return USB_STOR_TRANSPORT_ERROR;
 	}
@@ -681,125 +1285,131 @@
 	return USB_STOR_TRANSPORT_GOOD;
 }
 
-int init_8200e(struct us_data *us)
+/*x+ * Initialize the USBAT processor and the storage devicex+ */x+int init_usbat(struct us_data *us)
 {
-	int result;
+	int rc;
+	struct usbat_info *info;
+	unsigned char subcountH = USBAT_ATA_LBA_HI;
+	unsigned char subcountL = USBAT_ATA_LBA_ME;
 	unsigned char *status = us->iobuf;
 
-	// Enable peripheral control signals
+	us->extra = kmalloc(sizeof(struct usbat_info), GFP_NOIO);
+	if (!us->extra) {
+		US_DEBUGP("init_usbat: Gah! Can't allocate storage for usbat info struct!\n");
+		return 1;
+	}
+	memset(us->extra, 0, sizeof(struct usbat_info));
+	info = (struct usbat_info *) (us->extra);
 
-	if (usbat_write_user_io(us,
-	  USBAT_UIO_OE1 | USBAT_UIO_OE0,
-	  USBAT_UIO_EPAD | USBAT_UIO_1) != USB_STOR_XFER_GOOD)
+	// Enable peripheral control signals
+	rc = usbat_write_user_io(us,
+				 USBAT_UIO_OE1 | USBAT_UIO_OE0,
+				 USBAT_UIO_EPAD | USBAT_UIO_1);
+	if (rc != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
 
 	US_DEBUGP("INIT 1\n");
 
 	msleep(2000);
 
-	if (usbat_read_user_io(us, status) !=
-			USB_STOR_XFER_GOOD)
-		return USB_STOR_TRANSPORT_ERROR;
+	rc = usbat_read_user_io(us, status);
+	if (rc != USB_STOR_TRANSPORT_GOOD)
+		return rc;
 
 	US_DEBUGP("INIT 2\n");
 
-	if (usbat_read_user_io(us, status) !=
-			USB_STOR_XFER_GOOD)
+	rc = usbat_read_user_io(us, status);
+	if (rc != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
 
-	US_DEBUGP("INIT 3\n");
-
-	// Reset peripheral, enable periph control signals
-	// (bring reset signal up)
-
-	if (usbat_write_user_io(us,
-	  USBAT_UIO_DRVRST | USBAT_UIO_OE1 | USBAT_UIO_OE0,
-	  USBAT_UIO_EPAD | USBAT_UIO_1) != USB_STOR_XFER_GOOD)
+	rc = usbat_read_user_io(us, status);
+	if (rc != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
 
-	US_DEBUGP("INIT 4\n");
-
-	// Enable periph control signals
-	// (bring reset signal down)
+	US_DEBUGP("INIT 3\n");
 
-	if (usbat_write_user_io(us,
-	  USBAT_UIO_OE1 | USBAT_UIO_OE0,
-	  USBAT_UIO_EPAD | USBAT_UIO_1) != USB_STOR_XFER_GOOD)
+	// At this point, we need to detect which device we are using
+	if (usbat_set_transport(us, info))
 		return USB_STOR_TRANSPORT_ERROR;
 
-	US_DEBUGP("INIT 5\n");
+	US_DEBUGP("INIT 4\n");
 
-	msleep(250);
+	if (usbat_get_device_type(us) == USBAT_DEV_HP8200) {
+		msleep(250);
 
-	// Write 0x80 to ISA port 0x3F
+		// Write 0x80 to ISA port 0x3F
+		rc = usbat_write(us, USBAT_ISA, 0x3F, 0x80);
+		if (rc != USB_STOR_XFER_GOOD)
+			return USB_STOR_TRANSPORT_ERROR;
 
-	if (usbat_write(us, USBAT_ISA, 0x3F, 0x80) !=
-			USB_STOR_XFER_GOOD)
-		return USB_STOR_TRANSPORT_ERROR;
+		US_DEBUGP("INIT 5\n");
 
-	US_DEBUGP("INIT 6\n");
+		// Read ISA port 0x27
+		rc = usbat_read(us, USBAT_ISA, 0x27, status);
+		if (rc != USB_STOR_XFER_GOOD)
+			return USB_STOR_TRANSPORT_ERROR;
 
-	// Read ISA port 0x27
+		US_DEBUGP("INIT 6\n");
 
-	if (usbat_read(us, USBAT_ISA, 0x27, status) !=
-			USB_STOR_XFER_GOOD)
-		return USB_STOR_TRANSPORT_ERROR;
+		rc = usbat_read_user_io(us, status);
+		if (rc != USB_STOR_XFER_GOOD)
+			return USB_STOR_TRANSPORT_ERROR;
 
-	US_DEBUGP("INIT 7\n");
+		US_DEBUGP("INIT 7\n");
+	}
 
-	if (usbat_read_user_io(us, status) !=
-			USB_STOR_XFER_GOOD)
-		return USB_STOR_TRANSPORT_ERROR;
+	rc = usbat_select_and_test_registers(us);
+	if (rc != USB_STOR_TRANSPORT_GOOD)
+		return rc;
 
 	US_DEBUGP("INIT 8\n");
 
-	if ( (result = hp_8200e_select_and_test_registers(us)) !=
-			 USB_STOR_TRANSPORT_GOOD)
-		return result;
+	rc = usbat_read_user_io(us, status);
+	if (rc != USB_STOR_XFER_GOOD)
+		return USB_STOR_TRANSPORT_ERROR;
 
 	US_DEBUGP("INIT 9\n");
 
-	if (usbat_read_user_io(us, status) !=
-			USB_STOR_XFER_GOOD)
-		return USB_STOR_TRANSPORT_ERROR;
+	// Enable peripheral control signals and card detectx+	rc = usbat_device_enable_cdt(us);
+	if (rc != USB_STOR_TRANSPORT_GOOD)
+		return rc;
 
 	US_DEBUGP("INIT 10\n");
 
-	// Enable periph control signals and card detectx-
-	if (usbat_write_user_io(us,
-	  USBAT_UIO_ACKD |USBAT_UIO_OE1 | USBAT_UIO_OE0,
-	  USBAT_UIO_EPAD | USBAT_UIO_1) != USB_STOR_XFER_GOOD)
+	rc = usbat_read_user_io(us, status);
+	if (rc != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
 
 	US_DEBUGP("INIT 11\n");
 
-	if (usbat_read_user_io(us, status) !=
-			USB_STOR_XFER_GOOD)
-		return USB_STOR_TRANSPORT_ERROR;
-
-	US_DEBUGP("INIT 12\n");
-
 	msleep(1400);
 
-	if (usbat_read_user_io(us, status) !=
-			USB_STOR_XFER_GOOD)
+	rc = usbat_read_user_io(us, status);
+	if (rc != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
 
-	US_DEBUGP("INIT 13\n");
+	US_DEBUGP("INIT 12\n");
 
-	if ( (result = hp_8200e_select_and_test_registers(us)) !=
-			 USB_STOR_TRANSPORT_GOOD)
-		return result;
+	rc = usbat_select_and_test_registers(us);
+	if (rc != USB_STOR_TRANSPORT_GOOD)
+		return rc;
 
-	US_DEBUGP("INIT 14\n");
+	US_DEBUGP("INIT 13\n");
 
-	if (usbat_set_shuttle_features(us, 
-			0x83, 0x00, 0x88, 0x08, 0x15, 0x14) !=
-			 USB_STOR_XFER_GOOD)
+	if (usbat_get_device_type(us) == USBAT_DEV_FLASH) { 
+		subcountH = 0x02;
+		subcountL = 0x00;
+	}
+	rc = usbat_set_shuttle_features(us, (USBAT_FEAT_ETEN | USBAT_FEAT_ET2 | USBAT_FEAT_ET1),
+									0x00, 0x88, 0x08, subcountH, subcountL);
+	if (rc != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
 
-	US_DEBUGP("INIT 15\n");
+	US_DEBUGP("INIT 14\n");
 
 	return USB_STOR_TRANSPORT_GOOD;
 }
@@ -807,7 +1417,7 @@
 /*
  * Transport for the HP 8200ex  */
-int hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
+int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us)
 {
 	int result;
 	unsigned char *status = us->iobuf;
@@ -824,13 +1434,13 @@
 	   commands... just ATA Packet Commands.x  	 */
 
-	registers[0] = 0x11;
-	registers[1] = 0x12;
-	registers[2] = 0x13;
-	registers[3] = 0x14;
-	registers[4] = 0x15;
-	registers[5] = 0x16;
-	registers[6] = 0x17;
+	registers[0] = USBAT_ATA_FEATURES;
+	registers[1] = USBAT_ATA_SECCNT;
+	registers[2] = USBAT_ATA_SECNUM;
+	registers[3] = USBAT_ATA_LBA_ME;
+	registers[4] = USBAT_ATA_LBA_HI;
+	registers[5] = USBAT_ATA_DEVICE;
+	registers[6] = USBAT_ATA_CMD;
 	data[0] = 0x00;
 	data[1] = 0x00;
 	data[2] = 0x00;
@@ -844,7 +1454,7 @@
 		data[i] = (i-7 >= srb->cmd_len) ? 0 : srb->cmnd[i-7];
 	}
 
-	result = usbat_read(us, USBAT_ATA, 0x17, status);
+	result = usbat_get_status(us, status);
 	US_DEBUGP("Status = %02X\n", *status);
 	if (result != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_ERROR;
@@ -853,9 +1463,10 @@
 
 	if (srb->sc_data_direction == DMA_TO_DEVICE) {
 
-		result = usbat_rw_block_test(us, USBAT_ATA, 
+		result = usbat_hp8200e_rw_block_test(us, USBAT_ATA, 
 			registers, data, 19,
-			0x10, 0x17, 0xFD, 0x30,
+			USBAT_ATA_DATA, USBAT_ATA_STATUS, 0xFD,
+			(USBAT_QUAL_FCQ | USBAT_QUAL_ALQ),
 			DMA_TO_DEVICE,
 			srb->request_buffer, 
 			len, srb->use_sg, 10);
@@ -870,7 +1481,7 @@
 	} else if (srb->cmnd[0] == READ_10 ||
 		   srb->cmnd[0] == GPCMD_READ_CD) {
 
-		return usbat_handle_read10(us, registers, data, srb);
+		return usbat_hp8200e_handle_read10(us, registers, data, srb);
 
 	}
 
@@ -881,7 +1492,6 @@
 	}
 
 	if ( (result = usbat_multiple_write(us, 
-			USBAT_ATA,
 			registers, data, 7)) != USB_STOR_TRANSPORT_GOOD) {
 		return result;
 	}
@@ -895,7 +1505,7 @@
 	// AT SPEED 4 IS UNRELIABLE!!!
 
 	if ( (result = usbat_write_block(us, 
-			USBAT_ATA, 0x10, srb->cmnd, 12, 0,
+			USBAT_ATA, srb->cmnd, 12,
 			srb->cmnd[0]==GPCMD_BLANK ? 75 : 10)) !=
 				USB_STOR_TRANSPORT_GOOD) {
 		return result;
@@ -908,14 +1518,14 @@
 
 		// How many bytes to read in? Check cylL registerx 
-		if (usbat_read(us, USBAT_ATA, 0x14, status) != 
+		if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, status) != 
 		    	USB_STOR_XFER_GOOD) {
 			return USB_STOR_TRANSPORT_ERROR;
 		}
 
 		if (len > 0xFF) { // need to read cylH also
 			len = *status;
-			if (usbat_read(us, USBAT_ATA, 0x15, status) !=
+			if (usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_HI, status) !=
 				    USB_STOR_XFER_GOOD) {
 				return USB_STOR_TRANSPORT_ERROR;
 			}
@@ -925,8 +1535,7 @@
 			len = *status;
 
 
-		result = usbat_read_block(us, USBAT_ATA, 0x10, 
-			srb->request_buffer, len, srb->use_sg);
+		result = usbat_read_block(us, srb->request_buffer, len);
 
 		/* Debug-print the first 32 bytes of the transfer */
 
@@ -948,4 +1557,153 @@
 	return result;
 }
 
+/*x+ * Transport for USBAT02-based CompactFlash and similar storage devicesx+ */x+int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us)
+{
+	int rc;
+	struct usbat_info *info = (struct usbat_info *) (us->extra);
+	unsigned long block, blocks;
+	unsigned char *ptr = us->iobuf;
+	static unsigned char inquiry_response[36] = {
+		0x00, 0x80, 0x00, 0x01, 0x1F, 0x00, 0x00, 0x00
+	};
+
+	if (srb->cmnd[0] == INQUIRY) {
+		US_DEBUGP("usbat_flash_transport: INQUIRY. Returning bogus response.\n");
+		memcpy(ptr, inquiry_response, sizeof(inquiry_response));
+		fill_inquiry_response(us, ptr, 36);
+		return USB_STOR_TRANSPORT_GOOD;
+	}
+
+	if (srb->cmnd[0] == READ_CAPACITY) {
+		rc = usbat_flash_check_media(us, info);
+		if (rc != USB_STOR_TRANSPORT_GOOD)
+			return rc;
+
+		rc = usbat_flash_get_sector_count(us, info);
+		if (rc != USB_STOR_TRANSPORT_GOOD)
+			return rc;
+
+		info->ssize = 0x200;  // hard coded 512 byte sectors as per ATA spec
+		US_DEBUGP("usbat_flash_transport: READ_CAPACITY: %ld sectors, %ld bytes per sector\n",
+			  info->sectors, info->ssize);
+
+		// build the replyx+		// note: must return the sector number of the last sector,
+		// *not* the total number of sectors
+		((__be32 *) ptr)[0] = cpu_to_be32(info->sectors - 1);
+		((__be32 *) ptr)[1] = cpu_to_be32(info->ssize);
+		usb_stor_set_xfer_buf(ptr, 8, srb);
+
+		return USB_STOR_TRANSPORT_GOOD;
+	}
+
+	if (srb->cmnd[0] == MODE_SELECT_10) {
+		US_DEBUGP("usbat_flash_transport:  Gah! MODE_SELECT_10.\n");
+		return USB_STOR_TRANSPORT_ERROR;
+	}
+
+	if (srb->cmnd[0] == READ_10) {
+		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
+				((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
+
+		blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
+
+		US_DEBUGP("usbat_flash_transport:  READ_10: read block 0x%04lx  count %ld\n", block, blocks);
+		return usbat_flash_read_data(us, info, block, blocks);
+	}
+
+	if (srb->cmnd[0] == READ_12) {
+		// I don't think we'll ever see a READ_12 but support it anyway...
+		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
+		        ((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
+
+		blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
+		         ((u32)(srb->cmnd[8]) <<  8) | ((u32)(srb->cmnd[9]));
+
+		US_DEBUGP("usbat_flash_transport: READ_12: read block 0x%04lx  count %ld\n", block, blocks);
+		return usbat_flash_read_data(us, info, block, blocks);
+	}
+
+	if (srb->cmnd[0] == WRITE_10) {
+		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
+		        ((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
+
+		blocks = ((u32)(srb->cmnd[7]) << 8) | ((u32)(srb->cmnd[8]));
+
+		US_DEBUGP("usbat_flash_transport: WRITE_10: write block 0x%04lx  count %ld\n", block, blocks);
+		return usbat_flash_write_data(us, info, block, blocks);
+	}
+
+	if (srb->cmnd[0] == WRITE_12) {
+		// I don't think we'll ever see a WRITE_12 but support it anyway...
+		block = ((u32)(srb->cmnd[2]) << 24) | ((u32)(srb->cmnd[3]) << 16) |
+		        ((u32)(srb->cmnd[4]) <<  8) | ((u32)(srb->cmnd[5]));
+
+		blocks = ((u32)(srb->cmnd[6]) << 24) | ((u32)(srb->cmnd[7]) << 16) |
+		         ((u32)(srb->cmnd[8]) <<  8) | ((u32)(srb->cmnd[9]));
+
+		US_DEBUGP("usbat_flash_transport: WRITE_12: write block 0x%04lx  count %ld\n", block, blocks);
+		return usbat_flash_write_data(us, info, block, blocks);
+	}
+
+
+	if (srb->cmnd[0] == TEST_UNIT_READY) {
+		US_DEBUGP("usbat_flash_transport: TEST_UNIT_READY.\n");
+
+		rc = usbat_flash_check_media(us, info);
+		if (rc != USB_STOR_TRANSPORT_GOOD)
+			return rc;
+
+		return usbat_check_status(us);
+	}
+
+	if (srb->cmnd[0] == REQUEST_SENSE) {
+		US_DEBUGP("usbat_flash_transport: REQUEST_SENSE.\n");
+
+		memset(ptr, 0, 18);
+		ptr[0] = 0xF0;
+		ptr[2] = info->sense_key;
+		ptr[7] = 11;
+		ptr[12] = info->sense_asc;
+		ptr[13] = info->sense_ascq;
+		usb_stor_set_xfer_buf(ptr, 18, srb);
+
+		return USB_STOR_TRANSPORT_GOOD;
+	}
+
+	if (srb->cmnd[0] == ALLOW_MEDIUM_REMOVAL) {
+		// sure.  whatever.  not like we can stop the user from popping
+		// the media out of the device (no locking doors, etc)
+		return USB_STOR_TRANSPORT_GOOD;
+	}
+
+	US_DEBUGP("usbat_flash_transport: Gah! Unknown command: %d (0x%x)\n",
+			  srb->cmnd[0], srb->cmnd[0]);
+	info->sense_key = 0x05;
+	info->sense_asc = 0x20;
+	info->sense_ascq = 0x00;
+	return USB_STOR_TRANSPORT_FAILED;
+}
+
+/*x+ * Default transport function. Attempts to detect which transport functionx+ * should be called, makes it the new default, and calls it.
+ *x+ * This function should never be called. Our usbat_init() function detects the
+ * device type and changes the us->transport ptr to the transport functionx+ * relevant to the device.
+ * However, we'll support this impossible(?) case anyway.x+ */x+int usbat_transport(struct scsi_cmnd *srb, struct us_data *us)
+{
+	struct usbat_info *info = (struct usbat_info*) (us->extra);
+
+	if (usbat_set_transport(us, info))
+		return USB_STOR_TRANSPORT_ERROR;
+
+	return us->transport(srb, us);	
+}
 
diff -Nru a/drivers/usb/storage/shuttle_usbat.h b/drivers/usb/storage/shuttle_usbat.h
--- a/drivers/usb/storage/shuttle_usbat.h	2004-07-20 16:30:37 -07:00
+++ b/drivers/usb/storage/shuttle_usbat.h	2005-03-07 20:51:36 -08:00
@@ -5,8 +5,9 @@
  *
  * Current development and maintenance by:
  *   (c) 2000 Robert Baruch (autophile@dol.net)
+ *   (c) 2004, 2005 Daniel Drake <dsd@gentoo.org>
  *
- * See scm.c for more explanationx+ * See shuttle_usbat.c for more explanationx  *
  * 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
@@ -26,13 +27,59 @@
 #ifndef _USB_SHUTTLE_USBAT_H
 #define _USB_SHUTTLE_USBAT_H
 
+/* Supported device types */x+#define USBAT_DEV_HP8200	0x01x+#define USBAT_DEV_FLASH		0x02
+
 #define USBAT_EPP_PORT		0x10
 #define USBAT_EPP_REGISTER	0x30
 #define USBAT_ATA		0x40
 #define USBAT_ISA		0x50
 
-/* SCM User I/O Data registers */x+/* Commands (need to be logically OR'd with an access type */x+#define USBAT_CMD_READ_REG		0x00x+#define USBAT_CMD_WRITE_REG		0x01x+#define USBAT_CMD_READ_BLOCK	0x02
+#define USBAT_CMD_WRITE_BLOCK	0x03
+#define USBAT_CMD_COND_READ_BLOCK	0x04
+#define USBAT_CMD_COND_WRITE_BLOCK	0x05x+#define USBAT_CMD_WRITE_REGS	0x07
+
+/* Commands (these don't need an access type) */x+#define USBAT_CMD_EXEC_CMD	0x80x+#define USBAT_CMD_SET_FEAT	0x81x+#define USBAT_CMD_UIO		0x82
+
+/* Methods of accessing UIO register */x+#define USBAT_UIO_READ	1x+#define USBAT_UIO_WRITE	0
+
+/* Qualifier bits */x+#define USBAT_QUAL_FCQ	0x20 // full comparex+#define USBAT_QUAL_ALQ	0x10 // auto load subcount
+
+/* USBAT Flash Media status types */x+#define USBAT_FLASH_MEDIA_NONE	0x+#define USBAT_FLASH_MEDIA_CF	1x+
+/* USBAT Flash Media change types */x+#define USBAT_FLASH_MEDIA_SAME	0x+#define USBAT_FLASH_MEDIA_CHANGED	1x+
+/* USBAT ATA registers */x+#define USBAT_ATA_DATA      0x10  // read/write data (R/W)x+#define USBAT_ATA_FEATURES  0x11  // set features (W)x+#define USBAT_ATA_ERROR     0x11  // error (R)x+#define USBAT_ATA_SECCNT    0x12  // sector count (R/W)x+#define USBAT_ATA_SECNUM    0x13  // sector number (R/W)x+#define USBAT_ATA_LBA_ME    0x14  // cylinder low (R/W)x+#define USBAT_ATA_LBA_HI    0x15  // cylinder high (R/W)x+#define USBAT_ATA_DEVICE    0x16  // head/device selection (R/W)x+#define USBAT_ATA_STATUS    0x17  // device status (R)x+#define USBAT_ATA_CMD       0x17  // device command (W)x+#define USBAT_ATA_ALTSTATUS 0x0E  // status (no clear IRQ) (R)x 
+/* USBAT User I/O Data registers */x #define USBAT_UIO_EPAD		0x80 // Enable Peripheral Control Signals
 #define USBAT_UIO_CDT		0x40 // Card Detect (Read Only)
 				     // CDT = ACKD & !UI1 & !UI0
@@ -43,8 +90,7 @@
 #define USBAT_UIO_UI0		0x02 // Input 0
 #define USBAT_UIO_INTR_ACK	0x01 // Interrupt (ATA & ISA)/Acknowledge (EPP)
 
-/* SCM User I/O Enable registers */x-
+/* USBAT User I/O Enable registers */x #define USBAT_UIO_DRVRST	0x80 // Reset Peripheralx #define USBAT_UIO_ACKD		0x40 // Enable Card Detectx #define USBAT_UIO_OE1		0x20 // I/O 1 set=output/clr=input
@@ -52,8 +98,30 @@
 #define USBAT_UIO_OE0		0x10 // I/O 0 set=output/clr=input
 #define USBAT_UIO_ADPRST	0x01 // Reset SCM chip
 
-/* HP 8200e stuff */x-extern int hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us);x-extern int init_8200e(struct us_data *us);
+/* USBAT Features */x+#define USBAT_FEAT_ETEN	0x80 // External trigger enablex+#define USBAT_FEAT_U1	0x08x+#define USBAT_FEAT_U0	0x04
+#define USBAT_FEAT_ET1	0x02
+#define USBAT_FEAT_ET2	0x01x+
+/* Transport functions */x+int usbat_hp8200e_transport(struct scsi_cmnd *srb, struct us_data *us);x+int usbat_flash_transport(struct scsi_cmnd * srb, struct us_data *us);
+
+extern int usbat_transport(struct scsi_cmnd *srb, struct us_data *us);
+extern int init_usbat(struct us_data *us);
+
+struct usbat_info {
+	int devicetype;
+
+	/* Used for Flash readers only */
+	unsigned long sectors;     // total sector count
+	unsigned long ssize;       // sector size in bytes
+
+	unsigned char sense_key;
+	unsigned long sense_asc;   // additional sense code
+	unsigned long sense_ascq;  // additional sense code qualifier
+};
 
 #endif
diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/storage/transport.c	2005-03-07 20:42:03 -08:00
@@ -991,10 +991,10 @@
 	/* DATA STAGE */x 	/* send/receive data payload, if there is any */
 
-	/* Genesys Logic interface chips need a 100us delay between the
+	/* Some USB-IDE converter chips need a 100us delay between the
 	 * command phase and the data phase.  Some devices need a little
 	 * more than that, probably because of clock rate inaccuracies. */x-	if (le16_to_cpu(us->pusb_dev->descriptor.idVendor) == USB_VENDOR_ID_GENESYS)
+	if (unlikely(us->flags & US_FL_GO_SLOW))
 		udelay(110);
 
 	if (transfer_length) {
@@ -1055,19 +1055,31 @@
 	US_DEBUGP("Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n",
 			le32_to_cpu(bcs->Signature), bcs->Tag, 
 			residue, bcs->Status);
-	if ((bcs->Signature != cpu_to_le32(US_BULK_CS_SIGN) &&
-		    bcs->Signature != cpu_to_le32(US_BULK_CS_OLYMPUS_SIGN)) ||
-			bcs->Tag != srb->serial_number || 
-			bcs->Status > US_BULK_STAT_PHASE) {
+	if (bcs->Tag != srb->serial_number || bcs->Status > US_BULK_STAT_PHASE) {
 		US_DEBUGP("Bulk logical error\n");
 		return USB_STOR_TRANSPORT_ERROR;
 	}
 
+	/* Some broken devices report odd signatures, so we do not check themx+	 * for validity against the spec. We store the first one we see,x+	 * and check subsequent transfers for validity against this signature.x+	 */
+	if (!us->bcs_signature) {
+		us->bcs_signature = bcs->Signature;
+		if (us->bcs_signature != cpu_to_le32(US_BULK_CS_SIGN))
+			US_DEBUGP("Learnt BCS signature 0x%08X\n",
+					le32_to_cpu(us->bcs_signature));
+	} else if (bcs->Signature != us->bcs_signature) {
+		US_DEBUGP("Signature mismatch: got %08X, expecting %08X\n",
+			  le32_to_cpu(bcs->Signature),
+			  le32_to_cpu(us->bcs_signature));
+		return USB_STOR_TRANSPORT_ERROR;
+	}
+
 	/* try to compute the actual residue, based on how much data
 	 * was really transferred and what the device tells us */x 	if (residue) {
-		if (!(us->flags & US_FL_IGNORE_RESIDUE) ||
-				srb->sc_data_direction == DMA_TO_DEVICE) {
+		if (!(us->flags & US_FL_IGNORE_RESIDUE)) {
 			residue = min(residue, transfer_length);
 			srb->resid = max(srb->resid, (int) residue);
 		}
diff -Nru a/drivers/usb/storage/transport.h b/drivers/usb/storage/transport.h
--- a/drivers/usb/storage/transport.h	2004-10-06 00:11:24 -07:00
+++ b/drivers/usb/storage/transport.h	2005-03-07 20:44:00 -08:00
@@ -52,7 +52,7 @@
 #define US_PR_CBI	0x00		/* Control/Bulk/Interrupt */x #define US_PR_CB	0x01		/* Control/Bulk w/o interrupt */x #define US_PR_BULK	0x50		/* bulk only */
-#ifdef CONFIG_USB_STORAGE_HP8200ex+#ifdef CONFIG_USB_STORAGE_USBATx #define US_PR_SCM_ATAPI	0x80		/* SCM-ATAPI bridge */x #endif
 #ifdef CONFIG_USB_STORAGE_SDDR09
@@ -108,8 +108,6 @@
 
 #define US_BULK_CS_WRAP_LEN	13
 #define US_BULK_CS_SIGN		0x53425355	/* spells out 'USBS' */
-/* This is for Olympus Camedia digital cameras */x-#define US_BULK_CS_OLYMPUS_SIGN		0x55425355	/* spells out 'USBU' */x #define US_BULK_STAT_OK		0x #define US_BULK_STAT_FAIL	1x #define US_BULK_STAT_PHASE	2
diff -Nru a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
--- a/drivers/usb/storage/unusual_devs.h	2005-02-02 22:19:27 -08:00
+++ b/drivers/usb/storage/unusual_devs.h	2005-03-07 20:41:50 -08:00
@@ -59,16 +59,16 @@
 		"CD-Writer+",
 		US_SC_8070, US_PR_CB, NULL, 0), 
 
-#ifdef CONFIG_USB_STORAGE_HP8200ex+#ifdef CONFIG_USB_STORAGE_USBATx UNUSUAL_DEV(  0x03f0, 0x0207, 0x0001, 0x0001, 
 		"HP",
 		"CD-Writer+ 8200e",
-		US_SC_8070, US_PR_SCM_ATAPI, init_8200e, 0), 
+		US_SC_8070, US_PR_SCM_ATAPI, init_usbat, 0), 
 
 UNUSUAL_DEV(  0x03f0, 0x0307, 0x0001, 0x0001, 
 		"HP",
 		"CD-Writer+ CD-4e",
-		US_SC_8070, US_PR_SCM_ATAPI, init_8200e, 0), 
+		US_SC_8070, US_PR_SCM_ATAPI, init_usbat, 0), 
 #endif
 
 /* Deduced by Jonathan Woithe <jwoithe@physics.adelaide.edu.au>
@@ -123,6 +123,13 @@
 		"DVD-CAM DZ-MV100A Camcorder",
 		US_SC_SCSI, US_PR_CB, NULL, US_FL_SINGLE_LUN),
 
+/* Reported by Andreas Bockhold <andreas@bockionline.de> */
+UNUSUAL_DEV(  0x04b0, 0x0405, 0x0100, 0x0100,
+		"NIKON",
+		"NIKON DSC D70",
+		US_SC_DEVICE, US_PR_DEVICE, NULL,
+		US_FL_FIX_CAPACITY),
+
 /* Reported by Simon Levitt <simon@whattf.com>
  * This entry needs Sub and Proto fields */x UNUSUAL_DEV(  0x04b8, 0x0601, 0x0100, 0x0100,
@@ -171,15 +178,12 @@
 		"CD-R/RW Drive",
 		US_SC_8070, US_PR_CB, NULL, 0),
 
-/* Reported by Adriaan Penning <a.penning@luon.net>
- * Note that these cameras report "Medium not present" afterx- * ALLOW_MEDIUM_REMOVAL, so they also need to be marked
- * NOT_LOCKABLE in the SCSI blacklist (and the vendor is MATSHITA). */x+/* Reported by Adriaan Penning <a.penning@luon.net> */x UNUSUAL_DEV(  0x04da, 0x2372, 0x0000, 0x9999,
 		"Panasonic",
 		"DMC-LCx Camera",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
-		US_FL_FIX_CAPACITY ),
+		US_FL_FIX_CAPACITY | US_FL_NOT_LOCKABLE ),
 
 /* Most of the following entries were developed with the help of
  * Shuttle/SCM directly.
@@ -268,6 +272,14 @@
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_BULK32),
 
+#ifdef CONFIG_USB_STORAGE_USBATx+UNUSUAL_DEV(  0x04e6, 0x1010, 0x0000, 0x9999,
+		"SCM",
+		"SCM USBAT-02",
+		US_SC_SCSI, US_PR_SCM_ATAPI, init_usbat,
+		US_FL_SINGLE_LUN),
+#endif
+
 /* Reported by Bob Sass <rls@vectordb.com> -- only rev 1.33 tested */x UNUSUAL_DEV(  0x050d, 0x0115, 0x0133, 0x0133,
 		"Belkin",
@@ -324,12 +336,11 @@
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_IGNORE_RESIDUE ),
 
-/* This entry is needed because the device reports Sub=ff */x UNUSUAL_DEV(  0x054c, 0x0010, 0x0106, 0x0450, 
 		"Sony",
 		"DSC-S30/S70/S75/505V/F505/F707/F717/P8", 
 		US_SC_SCSI, US_PR_DEVICE, NULL,
-		US_FL_SINGLE_LUN ),
+		US_FL_SINGLE_LUN | US_FL_NOT_LOCKABLE ),
 
 /* This entry is needed because the device reports Sub=ff */x UNUSUAL_DEV(  0x054c, 0x0010, 0x0500, 0x0500, 
@@ -512,6 +523,25 @@
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_FIX_INQUIRY ),
 
+/* The following two entries are for a Genesys USB to IDEx+ * converter chip, but it changes its ProductId depending
+ * on whether or not a disk or an optical device is enclosedx+ * They were originally reported by Alexander Oltux+ * <alexander@all-2.com> and Peter Marks <peter.marks@turner.com>
+ * respectively.x+ */x+UNUSUAL_DEV(  0x05e3, 0x0701, 0x0000, 0xffff,
+		"Genesys Logic",
+		"USB to IDE Optical",
+		US_SC_DEVICE, US_PR_DEVICE, NULL,
+		US_FL_GO_SLOW ),
+x+UNUSUAL_DEV(  0x05e3, 0x0702, 0x0000, 0xffff,
+		"Genesys Logic",
+		"USB to IDE Disk",
+		US_SC_DEVICE, US_PR_DEVICE, NULL,
+		US_FL_GO_SLOW ),
+x /* Reported by Hanno Boeck <hanno@gmx.de>
  * Taken from the Lycoris Kernel */x UNUSUAL_DEV(  0x0636, 0x0003, 0x0000, 0x9999,
@@ -540,19 +570,19 @@
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_FIX_CAPACITY ),
 
-/* Reported by Alex Butcher <alex.butcher@assursys.co.uk> */x-UNUSUAL_DEV( 0x067b, 0x3507, 0x0001, 0x0001,x+/* Reported by Richard -=[]=- <micro_flyer@hotmail.com> */x+UNUSUAL_DEV( 0x067b, 0x2507, 0x0100, 0x0100,
 		"Prolific Technology Inc.",
-		"ATAPI-6 Bridge Controller",
+		"Mass Storage Device",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
-		US_FL_FIX_CAPACITY ),
+		US_FL_FIX_CAPACITY | US_FL_GO_SLOW ),
 x /* Reported by Alex Butcher <alex.butcher@assursys.co.uk> */x UNUSUAL_DEV( 0x067b, 0x3507, 0x0001, 0x0001,x 		"Prolific Technology Inc.",
 		"ATAPI-6 Bridge Controller",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
-		US_FL_FIX_CAPACITY ),
+		US_FL_FIX_CAPACITY | US_FL_GO_SLOW ),
 x /* Submitted by Benny Sjostrand <benny@hostmobility.com> */x UNUSUAL_DEV( 0x0686, 0x4011, 0x0001, 0x0001,x@@ -582,12 +612,18 @@
 		US_SC_SCSI, US_PR_CB, NULL,
 		US_FL_SINGLE_LUN ),
 
-#if !defined(CONFIG_BLK_DEV_UB) && !defined(CONFIG_BLK_DEV_UB_MODULE)x UNUSUAL_DEV(  0x0781, 0x0002, 0x0009, 0x0009, 
 		"Sandisk",
 		"ImageMate SDDR-31",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_IGNORE_SER ),
+x+#ifdef CONFIG_USB_STORAGE_USBATx+UNUSUAL_DEV(  0x0781, 0x0005, 0x0005, 0x0005,
+		"Sandisk",
+		"ImageMate SDDR-05b",
+		US_SC_SCSI, US_PR_SCM_ATAPI, init_usbat,
+		US_FL_SINGLE_LUN),
 #endif
 
 UNUSUAL_DEV(  0x0781, 0x0100, 0x0100, 0x0100,
@@ -866,6 +902,13 @@
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_IGNORE_RESIDUE ),
 
+/* Reported by Ian McConnell <ian at emit.demon.co.uk> */x+UNUSUAL_DEV(  0x0dda, 0x0301, 0x0012, 0x0012,
+		"PNP_MP3",
+		"PNP_MP3 PLAYER",
+		US_SC_DEVICE, US_PR_DEVICE, NULL,
+		US_FL_IGNORE_RESIDUE ),
+x /* Submitted by Antoine Mairesse <antoine.mairesse@free.fr> */x UNUSUAL_DEV( 0x0ed1, 0x6660, 0x0100, 0x0300,
 		"USB",
@@ -904,6 +947,13 @@
 		"Black Silver",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
 		US_FL_IGNORE_RESIDUE ),
+x+/* Reported by Radovan Garabik <garabik@kassiopeia.juls.savba.sk> */x+UNUSUAL_DEV(  0x2735, 0x100b, 0x0000, 0x9999,
+		"MPIO",
+		"HS200",
+		US_SC_DEVICE, US_PR_DEVICE, NULL,
+		US_FL_GO_SLOW ),
 
 #ifdef CONFIG_USB_STORAGE_SDDR55
 UNUSUAL_DEV(  0x55aa, 0xa103, 0x0000, 0x9999, 
diff -Nru a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
--- a/drivers/usb/storage/usb.c	2004-12-20 15:43:29 -08:00
+++ b/drivers/usb/storage/usb.c	2005-03-07 20:42:03 -08:00
@@ -63,7 +63,7 @@
 #include "debug.h"
 #include "initializers.h"
 
-#ifdef CONFIG_USB_STORAGE_HP8200ex+#ifdef CONFIG_USB_STORAGE_USBATx #include "shuttle_usbat.h"x #endif
 #ifdef CONFIG_USB_STORAGE_SDDR09
@@ -144,9 +144,7 @@
 	{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_QIC, US_PR_BULK) },
 	{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_UFI, US_PR_BULK) },
 	{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_8070, US_PR_BULK) },
-#if !defined(CONFIG_BLK_DEV_UB) && !defined(CONFIG_BLK_DEV_UB_MODULE)x 	{ USB_INTERFACE_INFO(USB_CLASS_MASS_STORAGE, US_SC_SCSI, US_PR_BULK) },
-#endif
 
 	/* Terminating entry */
 	{ }
@@ -220,10 +218,8 @@
 	  .useTransport = US_PR_BULK},
 	{ .useProtocol = US_SC_8070,
 	  .useTransport = US_PR_BULK},
-#if !defined(CONFIG_BLK_DEV_UB) && !defined(CONFIG_BLK_DEV_UB_MODULE)x 	{ .useProtocol = US_SC_SCSI,
 	  .useTransport = US_PR_BULK},
-#endif
 
 	/* Terminating entry */
 	{ NULL }
@@ -483,6 +479,13 @@
 			unusual_dev->useTransport;
 	us->flags = unusual_dev->flags;
 
+	/*x+	 * This flag is only needed when we're in high-speed, so let'sx+	 * disable it if we're in full-speedx+	 */
+	if (dev->speed != USB_SPEED_HIGH)
+		us->flags &= ~US_FL_GO_SLOW;
+
 	/* Log a message if a non-generic unusual_dev entry contains an
 	 * unnecessary subclass or protocol override.  This may stimulate
 	 * reports from users that will help us remove unneeded entries
@@ -515,37 +518,6 @@
 				idesc->bInterfaceProtocol,
 				msgs[msg]);
 	}
-
-	/* Read the device's string descriptors */x-	if (dev->descriptor.iManufacturer)
-		usb_string(dev, dev->descriptor.iManufacturer, 
-			   us->vendor, sizeof(us->vendor));
-	if (dev->descriptor.iProduct)
-		usb_string(dev, dev->descriptor.iProduct, 
-			   us->product, sizeof(us->product));
-	if (dev->descriptor.iSerialNumber)
-		usb_string(dev, dev->descriptor.iSerialNumber, 
-			   us->serial, sizeof(us->serial));
-
-	/* Use the unusual_dev strings if the device didn't provide them */x-	if (strlen(us->vendor) == 0) {
-		if (unusual_dev->vendorName)
-			strlcpy(us->vendor, unusual_dev->vendorName,
-				sizeof(us->vendor));
-		else
-			strcpy(us->vendor, "Unknown");
-	}
-	if (strlen(us->product) == 0) {
-		if (unusual_dev->productName)
-			strlcpy(us->product, unusual_dev->productName,
-				sizeof(us->product));
-		else
-			strcpy(us->product, "Unknown");
-	}
-	if (strlen(us->serial) == 0)
-		strcpy(us->serial, "None");
-
-	US_DEBUGP("Vendor: %s,  Product: %s\n", us->vendor, us->product);
 }
 
 /* Get the transport settings */x@@ -572,10 +544,10 @@
 		us->transport_reset = usb_stor_Bulk_reset;
 		break;
 
-#ifdef CONFIG_USB_STORAGE_HP8200ex+#ifdef CONFIG_USB_STORAGE_USBATx 	case US_PR_SCM_ATAPI:
 		us->transport_name = "SCM/ATAPI";
-		us->transport = hp8200e_transport;
+		us->transport = usbat_transport;
 		us->transport_reset = usb_stor_CB_reset;
 		us->max_lun = 1;
 		break;
diff -Nru a/drivers/usb/storage/usb.h b/drivers/usb/storage/usb.h
--- a/drivers/usb/storage/usb.h	2004-11-14 16:10:43 -08:00
+++ b/drivers/usb/storage/usb.h	2005-03-07 20:42:03 -08:00
@@ -75,6 +75,8 @@
 #define US_FL_FIX_CAPACITY    0x00000080 /* READ CAPACITY response too big  */x #define US_FL_IGNORE_RESIDUE  0x00000100 /* reported residue is wrong	    */x #define US_FL_BULK32          0x00000200 /* Uses 32-byte CBW length         */x+#define US_FL_NOT_LOCKABLE    0x00000400 /* PREVENT/ALLOW not supported     */x+#define US_FL_GO_SLOW         0x00000800 /* Need delay after Command phase  */
 
 /* Dynamic flag definitions: used in set_bit() etc. */x #define US_FLIDX_URB_ACTIVE	18  /* 0x00040000  current_urb is in use  */
@@ -121,11 +123,9 @@
 	unsigned int		recv_intr_pipe;
 
 	/* information about the device */x-	char			vendor[USB_STOR_STRING_LEN];x-	char			product[USB_STOR_STRING_LEN];x-	char			serial[USB_STOR_STRING_LEN];x 	char			*transport_name;x 	char			*protocol_name;x+	__le32			bcs_signature;
 	u8			subclass;
 	u8			protocol;
 	u8			max_lun;
diff -Nru a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
--- a/drivers/usb/usb-skeleton.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/usb/usb-skeleton.c	2005-03-07 20:44:04 -08:00
@@ -120,7 +120,7 @@
 			      usb_rcvbulkpipe(dev->udev, dev->bulk_in_endpointAddr),
 			      dev->bulk_in_buffer,
 			      min(dev->bulk_in_size, count),
-			      &count, HZ*10);
+			      &count, 10000);
 
 	/* if the read was successful, copy the data to userspace */x 	if (!retval) {
@@ -271,7 +271,7 @@
 		}
 
 		if (!dev->bulk_out_endpointAddr &&
-		    !(endpoint->bEndpointAddress & USB_DIR_IN) &&
+		    !(endpoint->bEndpointAddress & USB_DIR_OUT) &&
 		    ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
 					== USB_ENDPOINT_XFER_BULK)) {
 			/* we found a bulk out endpoint */xdiff -Nru a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c
--- a/drivers/video/backlight/corgi_bl.c	2005-01-30 22:33:49 -08:00
+++ b/drivers/video/backlight/corgi_bl.c	2005-03-06 12:23:52 -08:00
@@ -52,9 +52,9 @@
 	corgi_ssp_blduty_set(intensity & 0x1f);
 	/* Bit 5 is via SCOOP */x 	if (intensity & 0x0020)
-		set_scoop_gpio(CORGI_SCP_BACKLIGHT_CONT);
+		set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
 	else
-		reset_scoop_gpio(CORGI_SCP_BACKLIGHT_CONT);
+		reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
 	spin_unlock_irqrestore(&bl_lock, flags);
 }
 
diff -Nru a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c
--- a/drivers/video/console/dummycon.c	2004-07-29 09:00:38 -07:00
+++ b/drivers/video/console/dummycon.c	2005-03-07 20:41:34 -08:00
@@ -42,7 +42,7 @@
 	vc->vc_cols = DUMMY_COLUMNS;
 	vc->vc_rows = DUMMY_ROWS;
     } else
-	vc_resize(vc->vc_num, DUMMY_COLUMNS, DUMMY_ROWS);
+	vc_resize(vc, DUMMY_COLUMNS, DUMMY_ROWS);
 }
 
 static int dummycon_dummy(void)
diff -Nru a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
--- a/drivers/video/console/fbcon.c	2005-01-25 13:50:28 -08:00
+++ b/drivers/video/console/fbcon.c	2005-03-07 20:41:34 -08:00
@@ -203,7 +203,7 @@
 static inline int fbcon_is_inactive(struct vc_data *vc, struct fb_info *info)
 {
 	return (info->state != FBINFO_STATE_RUNNING ||
-		vt_cons[vc->vc_num]->vc_mode != KD_TEXT);
+		vc->vc_mode != KD_TEXT);
 }
 
 static inline int get_color(struct vc_data *vc, struct fb_info *info,
@@ -456,9 +456,9 @@
 		    erase,
 		    vc->vc_size_row * logo_lines);
 
-	if (CON_IS_VISIBLE(vc) && vt_cons[vc->vc_num]->vc_mode == KD_TEXT) {
+	if (CON_IS_VISIBLE(vc) && vc->vc_mode == KD_TEXT) {
 		fbcon_clear_margins(vc, 0);
-		update_screen(vc->vc_num);
+		update_screen(vc);
 	}
 
 	if (save) {
@@ -609,7 +609,7 @@
 				   fg_vc->vc_rows);
 	}
 
-	switch_screen(fg_console);
+	update_screen(vc_cons[fg_console].d);
 }
 
 /**
@@ -802,7 +802,7 @@
 
 	cols = info->var.xres / vc->vc_font.width;
 	rows = info->var.yres / vc->vc_font.height;
-	vc_resize(vc->vc_num, cols, rows);
+	vc_resize(vc, cols, rows);
 
 	DPRINTK("mode:   %s\n", info->fix.id);
 	DPRINTK("visual: %d\n", info->fix.visual);
@@ -890,13 +890,12 @@
 	struct vc_data **default_mode = vc->vc_display_fg;
 	struct vc_data *svc = *default_mode;
 	struct display *t, *p = &fb_display[vc->vc_num];
-	int display_fg = (*default_mode)->vc_num;
 	int logo = 1, new_rows, new_cols, rows, cols, charcnt = 256;
 	int cap = info->flags;
 
 	if (info_idx == -1 || info == NULL)
 	    return;
-	if (vc->vc_num != display_fg || logo_shown == FBCON_LOGO_DONTSHOW ||
+	if (vc != svc || logo_shown == FBCON_LOGO_DONTSHOW ||
 	    (info->fix.type == FB_TYPE_TEXT))
 		logo = 0;
 
@@ -907,7 +906,7 @@
 
 	/* If we are not the first console on this
 	   fb, copy the font from that console */x-	t = &fb_display[display_fg];
+	t = &fb_display[svc->vc_num];
 	if (!vc->vc_font.data) {
 		vc->vc_font.data = p->fontdata = t->fontdata;
 		vc->vc_font.width = (*default_mode)->vc_font.width;
@@ -929,15 +928,15 @@
 	}
 
 	if (!*svc->vc_uni_pagedir_loc)
-		con_set_default_unimap(display_fg);
+		con_set_default_unimap(svc);
 	if (!*vc->vc_uni_pagedir_loc)
-		con_copy_unimap(vc->vc_num, display_fg);
+		con_copy_unimap(vc, svc);
 
 	cols = vc->vc_cols;
 	rows = vc->vc_rows;
 	new_cols = info->var.xres / vc->vc_font.width;
 	new_rows = info->var.yres / vc->vc_font.height;
-	vc_resize(vc->vc_num, new_cols, new_rows);
+	vc_resize(vc, new_cols, new_rows);
 	/*
 	 * We must always set the mode. The mode of the previous console
 	 * driver could be in the same resolution but we are using different
@@ -968,7 +967,7 @@
 	if (logo)
 		fbcon_prepare_logo(vc, info, cols, rows, new_cols, new_rows);
 
-	if (vc->vc_num == display_fg && softback_buf) {
+	if (vc == svc && softback_buf) {
 		int l = fbcon_softback_size / vc->vc_size_row;
 		if (l > 5)
 			softback_end = softback_buf + l * vc->vc_size_row;
@@ -1144,13 +1143,12 @@
 	struct display *p = &fb_display[vc->vc_num], *t;
 	struct vc_data **default_mode = vc->vc_display_fg;
 	struct vc_data *svc = *default_mode;
-	int display_fg = (*default_mode)->vc_num;
 	int rows, cols, charcnt = 256;
 
 	info->var.xoffset = info->var.yoffset = p->yscroll = 0;
 	if (var_to_display(p, &info->var, info))
 		return;x-	t = &fb_display[display_fg];
+	t = &fb_display[svc->vc_num];
 	if (!vc->vc_font.data) {
 		vc->vc_font.data = p->fontdata = t->fontdata;
 		vc->vc_font.width = (*default_mode)->vc_font.width;
@@ -1173,15 +1171,15 @@
 	}
 
 	if (!*svc->vc_uni_pagedir_loc)
-		con_set_default_unimap(display_fg);
+		con_set_default_unimap(svc);
 	if (!*vc->vc_uni_pagedir_loc)
-		con_copy_unimap(vc->vc_num, display_fg);
+		con_copy_unimap(vc, svc);
 
 	cols = info->var.xres / vc->vc_font.width;
 	rows = info->var.yres / vc->vc_font.height;
-	vc_resize(vc->vc_num, cols, rows);
+	vc_resize(vc, cols, rows);
 	if (CON_IS_VISIBLE(vc)) {
-		update_screen(vc->vc_num);
+		update_screen(vc);
 		if (softback_buf) {
 			int l = fbcon_softback_size / vc->vc_size_row;
 
@@ -1987,7 +1985,7 @@
 		logo_shown = fg_console;
 		/* This is protected above by initmem_freed */x 		fb_show_logo(info);
-		update_region(fg_console,
+		update_region(vc,
 			      vc->vc_origin + vc->vc_size_row * vc->vc_top,
 			      vc->vc_size_row * (vc->vc_bottom -
 						 vc->vc_top) / 2);
@@ -2048,7 +2046,7 @@
 		}
 
  		if (!blank)
- 			update_screen(vc->vc_num);
+ 			update_screen(vc);
  	}
 
  	return 0;
@@ -2198,7 +2196,7 @@
 	if (resize) {
 		/* reset wrap/pan */x 		info->var.xoffset = info->var.yoffset = p->yscroll = 0;
-		vc_resize(vc->vc_num, info->var.xres / w, info->var.yres / h);
+		vc_resize(vc, info->var.xres / w, info->var.yres / h);
 		if (CON_IS_VISIBLE(vc) && softback_buf) {
 			int l = fbcon_softback_size / vc->vc_size_row;
 			if (l > 5)
@@ -2211,9 +2209,9 @@
 			}
 		}
 	} else if (CON_IS_VISIBLE(vc)
-		   && vt_cons[vc->vc_num]->vc_mode == KD_TEXT) {
+		   && vc->vc_mode == KD_TEXT) {
 		fbcon_clear_margins(vc, 0);
-		update_screen(vc->vc_num);
+		update_screen(vc);
 	}
 
 	if (old_data && (--REFCOUNT(old_data) == 0))
@@ -2438,7 +2436,7 @@
 	if (softback_top) {
 		if (vc->vc_num != fg_console)
 			return 0;
-		if (vt_cons[vc->vc_num]->vc_mode != KD_TEXT || !lines)
+		if (vc->vc_mode != KD_TEXT || !lines)
 			return 0;
 		if (logo_shown >= 0) {
 			struct vc_data *conp2 = vc_cons[logo_shown].d;
@@ -2464,7 +2462,7 @@
 						    vc->vc_size_row);
 				}
 				softback_in = p;
-				update_region(vc->vc_num, vc->vc_origin,
+				update_region(vc, vc->vc_origin,
 					      logo_lines * vc->vc_cols);
 			}
 			logo_shown = FBCON_LOGO_CANSHOW;
@@ -2545,7 +2543,7 @@
 		return;x 	vc = vc_cons[ops->currcon].d;
 
-	update_screen(vc->vc_num);
+	update_screen(vc);
 }
 
 static void fbcon_modechanged(struct fb_info *info)
@@ -2555,11 +2553,11 @@
 	struct display *p;
 	int rows, cols;
 
-	if (!ops || ops->currcon < 0 || vt_cons[ops->currcon]->vc_mode !=
-	    KD_TEXT || registered_fb[con2fb_map[ops->currcon]] != info)
+	if (!ops || ops->currcon < 0)
 		return;x-x 	vc = vc_cons[ops->currcon].d;
+	if (vc->vc_mode != KD_TEXT || registered_fb[con2fb_map[ops->currcon]] != info)
+		return;x x 	p = &fb_display[vc->vc_num];
 
@@ -2569,13 +2567,13 @@
 		var_to_display(p, &info->var, info);
 		cols = info->var.xres / vc->vc_font.width;
 		rows = info->var.yres / vc->vc_font.height;
-		vc_resize(vc->vc_num, cols, rows);
+		vc_resize(vc, cols, rows);
 		updatescrollmode(p, info, vc);
 		scrollback_max = 0;
 		scrollback_current = 0;
 		update_var(vc->vc_num, info);
 		fbcon_set_palette(vc, color_table);
-		update_screen(vc->vc_num);
+		update_screen(vc);
 		if (softback_buf) {
 			int l = fbcon_softback_size / vc->vc_size_row;
 			if (l > 5)
@@ -2641,26 +2639,23 @@
 static void fbcon_fb_blanked(struct fb_info *info, int blank)
 {
 	struct fbcon_ops *ops = info->fbcon_par;
-	int valid = 1;
-
-	if (!ops || ops->currcon < 0 ||
-	    vt_cons[ops->currcon]->vc_mode != KD_TEXT ||
-	    registered_fb[con2fb_map[ops->currcon]] != info)
-		valid = 0;
+	struct vc_data *vc;
 
-	if (valid) {
-		struct vc_data *vc;
+	if (!ops || ops->currcon < 0)
+		return;x x-		vc = vc_cons[ops->currcon].d;
+	vc = vc_cons[ops->currcon].d;
+	if (vc->vc_mode != KD_TEXT ||
+			registered_fb[con2fb_map[ops->currcon]] != info)
+		return;x x-		if (CON_IS_VISIBLE(vc)) {
-			if (blank)
-				do_blank_screen(0);
-			else
-				do_unblank_screen(0);
-		}
-		ops->blank_state = blank;
+	if (CON_IS_VISIBLE(vc)) {
+		if (blank)
+			do_blank_screen(0);
+		else
+			do_unblank_screen(0);
 	}
+	ops->blank_state = blank;
 }
 
 static int fbcon_event_notify(struct notifier_block *self, 
diff -Nru a/drivers/video/console/mdacon.c b/drivers/video/console/mdacon.c
--- a/drivers/video/console/mdacon.c	2005-01-20 21:02:09 -08:00
+++ b/drivers/video/console/mdacon.c	2005-03-07 20:41:34 -08:00
@@ -351,10 +351,9 @@
 	if (init) {
 		c->vc_cols = mda_num_columns;
 		c->vc_rows = mda_num_lines;
-	} else {
-		vc_resize(c->vc_num, mda_num_columns, mda_num_lines);
-        }
-	
+	} else
+		vc_resize(c, mda_num_columns, mda_num_lines);
+
 	/* make the first MDA console visible */
 
 	if (mda_display_fg == NULL)
diff -Nru a/drivers/video/console/promcon.c b/drivers/video/console/promcon.c
--- a/drivers/video/console/promcon.c	2004-07-29 09:00:38 -07:00
+++ b/drivers/video/console/promcon.c	2005-03-07 20:41:34 -08:00
@@ -155,9 +155,9 @@
 			k++;
 		}
 	set_fs(KERNEL_DS);
-	con_clear_unimap(conp->vc_num, NULL);
-	con_set_unimap(conp->vc_num, k, p);
-	con_protect_unimap(conp->vc_num, 1);
+	con_clear_unimap(conp, NULL);
+	con_set_unimap(conp, k, p);
+	con_protect_unimap(conp, 1);
 	set_fs(old_fs);
 	kfree(p);
 }
@@ -175,7 +175,7 @@
 	p = *conp->vc_uni_pagedir_loc;
 	if (conp->vc_uni_pagedir_loc == &conp->vc_uni_pagedir ||
 	    !--conp->vc_uni_pagedir_loc[1])
-		con_free_unimap(conp->vc_num);
+		con_free_unimap(conp);
 	conp->vc_uni_pagedir_loc = promcon_uni_pagedir;
 	promcon_uni_pagedir[1]++;
 	if (!promcon_uni_pagedir[0] && p) {
@@ -183,7 +183,7 @@
 	}
 	if (!init) {
 		if (conp->vc_cols != pw + 1 || conp->vc_rows != ph + 1)
-			vc_resize(conp->vc_num, pw + 1, ph + 1);
+			vc_resize(conp, pw + 1, ph + 1);
 	}
 }
 
@@ -192,9 +192,9 @@
 {
 	/* When closing the last console, reset video origin */x 	if (!--promcon_uni_pagedir[1])
-		con_free_unimap(conp->vc_num);
+		con_free_unimap(conp);
 	conp->vc_uni_pagedir_loc = &conp->vc_uni_pagedir;
-	con_set_default_unimap(conp->vc_num);
+	con_set_default_unimap(conp);
 }
 
 static int
diff -Nru a/drivers/video/console/sticon.c b/drivers/video/console/sticon.c
--- a/drivers/video/console/sticon.c	2004-07-29 09:00:38 -07:00
+++ b/drivers/video/console/sticon.c	2005-03-07 20:41:34 -08:00
@@ -87,13 +87,12 @@
 
 static void sticon_putc(struct vc_data *conp, int c, int ypos, int xpos)
 {
-    int unit = conp->vc_num;
     int redraw_cursor = 0;
 
     if (vga_is_gfx || console_blanked)
 	    return;
-	    
-    if (vt_cons[unit]->vc_mode != KD_TEXT)
+x+    if (conp->vc_mode != KD_TEXT)
     	    return;
 #if 0
     if ((p->cursor_x == xpos) && (p->cursor_y == ypos)) {
@@ -111,15 +110,14 @@
 static void sticon_putcs(struct vc_data *conp, const unsigned short *s,
 			 int count, int ypos, int xpos)
 {
-    int unit = conp->vc_num;
     int redraw_cursor = 0;
 
     if (vga_is_gfx || console_blanked)
 	    return;
 
-    if (vt_cons[unit]->vc_mode != KD_TEXT)
+    if (conp->vc_mode != KD_TEXT)
     	    return;
-    
+
 #if 0
     if ((p->cursor_y == ypos) && (xpos <= p->cursor_x) &&
 	(p->cursor_x < (xpos + count))) {
@@ -217,7 +215,7 @@
     } else {
 	/* vc_rows = (c->vc_rows > vc_rows) ? vc_rows : c->vc_rows; */x 	/* vc_cols = (c->vc_cols > vc_cols) ? vc_cols : c->vc_cols; */x-	vc_resize(c->vc_num, vc_cols, vc_rows); 
+	vc_resize(c, vc_cols, vc_rows);
 /*	vc_resize_con(vc_rows, vc_cols, c->vc_num); */x     }
 }
diff -Nru a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
--- a/drivers/video/console/vgacon.c	2005-01-20 21:02:09 -08:00
+++ b/drivers/video/console/vgacon.c	2005-03-07 20:41:34 -08:00
@@ -340,11 +340,11 @@
 	p = *c->vc_uni_pagedir_loc;
 	if (c->vc_uni_pagedir_loc == &c->vc_uni_pagedir ||
 	    !--c->vc_uni_pagedir_loc[1])
-		con_free_unimap(c->vc_num);
+		con_free_unimap(c);
 	c->vc_uni_pagedir_loc = vgacon_uni_pagedir;
 	vgacon_uni_pagedir[1]++;
 	if (!vgacon_uni_pagedir[0] && p)
-		con_set_default_unimap(c->vc_num);
+		con_set_default_unimap(c);
 }
 
 static inline void vga_set_mem_top(struct vc_data *c)
@@ -358,10 +358,10 @@
 	if (!--vgacon_uni_pagedir[1]) {
 		c->vc_visible_origin = vga_vram_base;
 		vga_set_mem_top(c);
-		con_free_unimap(c->vc_num);
+		con_free_unimap(c);
 	}
 	c->vc_uni_pagedir_loc = &c->vc_uni_pagedir;
-	con_set_default_unimap(c->vc_num);
+	con_set_default_unimap(c);
 }
 
 static u8 vgacon_build_attr(struct vc_data *c, u8 color, u8 intensity,
@@ -908,7 +908,7 @@
 				c->vc_sw->con_cursor(c, CM_DRAW);
 			}
 			c->vc_font.height = fontheight;
-			vc_resize(c->vc_num, 0, rows);	/* Adjust console size */
+			vc_resize(c, 0, rows);	/* Adjust console size */
 		}
 	}
 	return 0;
diff -Nru a/drivers/video/hitfb.c b/drivers/video/hitfb.c
--- a/drivers/video/hitfb.c	2004-09-22 13:28:16 -07:00
+++ b/drivers/video/hitfb.c	2005-03-07 20:41:29 -08:00
@@ -1,6 +1,6 @@
 /*
- * $Id: hitfb.c,v 1.12 2004/03/16 00:07:51 lethal Exp $
  * linux/drivers/video/hitfb.c -- Hitachi LCD frame buffer device
+ *x  * (C) 1999 Mihai Spatarx  * (C) 2000 YAEGASHI Takeshix  * (C) 2003, 2004 Paul Mundt
@@ -40,15 +40,15 @@
 static struct fb_var_screeninfo hitfb_var __initdata = {
 	.activate	= FB_ACTIVATE_NOW,
 	.height		= -1,
-	.width 		= -1,
-	.vmode 		= FB_VMODE_NONINTERLACED,
+	.width		= -1,
+	.vmode		= FB_VMODE_NONINTERLACED,
 };
 
 static struct fb_fix_screeninfo hitfb_fix __initdata = {
-	.id 		= "Hitachi HD64461",
-	.type 		= FB_TYPE_PACKED_PIXELS,
-	.ypanstep 	= 8,
-	.accel 		= FB_ACCEL_NONE,
+	.id		= "Hitachi HD64461",
+	.type		= FB_TYPE_PACKED_PIXELS,
+	.ypanstep	= 8,
+	.accel		= FB_ACCEL_NONE,
 };
 
 static u32 pseudo_palette[16];
@@ -255,14 +255,14 @@
 }
 
 static struct fb_ops hitfb_ops = {
-	.owner 			= THIS_MODULE,
-	.fb_setcolreg 	= hitfb_setcolreg,
-	.fb_blank 		= hitfb_blank,
+	.owner		= THIS_MODULE,
+	.fb_setcolreg	= hitfb_setcolreg,
+	.fb_blank	= hitfb_blank,
 	.fb_pan_display = hitfb_pan_display,
-	.fb_fillrect 	= hitfb_fillrect,
-	.fb_copyarea 	= hitfb_copyarea,
-	.fb_imageblit 	= cfb_imageblit,
-	.fb_cursor 		= soft_cursor,
+	.fb_fillrect	= hitfb_fillrect,
+	.fb_copyarea	= hitfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
+	.fb_cursor	= soft_cursor,
 };
 
 int __init hitfb_init(void)
@@ -324,7 +324,7 @@
 	fb_info.var = hitfb_var;
 	fb_info.fix = hitfb_fix;
 	fb_info.pseudo_palette = pseudo_palette;
-	fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+	fb_info.flags = FBINFO_DEFAULT;x x 	fb_info.screen_base = (void *)hitfb_fix.smem_start;
 
@@ -345,9 +345,6 @@
 }
 
 module_init(hitfb_init);
-
-#ifdef MODULE
 module_exit(hitfb_exit);
-#endif
 
 MODULE_LICENSE("GPL");
diff -Nru a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c
--- a/drivers/video/i810/i810_main.c	2005-01-15 14:31:04 -08:00
+++ b/drivers/video/i810/i810_main.c	2005-02-23 15:19:04 -08:00
@@ -1591,40 +1591,41 @@
 {
 	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	int size;
+	struct agp_bridge_data *bridge;
 	
 	i810_fix_offsets(par);
 	size = par->fb.size + par->iring.size;
 
-	if (agp_backend_acquire()) {
+	if (!(bridge = agp_backend_acquire(par->dev))) {
 		printk("i810fb_alloc_fbmem: cannot acquire agpgart\n");
 		return -ENODEV;
 	}
 	if (!(par->i810_gtt.i810_fb_memory = 
-	      agp_allocate_memory(size >> 12, AGP_NORMAL_MEMORY))) {
+	      agp_allocate_memory(bridge, size >> 12, AGP_NORMAL_MEMORY))) {
 		printk("i810fb_alloc_fbmem: can't allocate framebuffer "
 		       "memory\n");
-		agp_backend_release();
+		agp_backend_release(bridge);
 		return -ENOMEM;
 	}
 	if (agp_bind_memory(par->i810_gtt.i810_fb_memory,
 			    par->fb.offset)) {
 		printk("i810fb_alloc_fbmem: can't bind framebuffer memory\n");
-		agp_backend_release();
+		agp_backend_release(bridge);
 		return -EBUSY;
 	}	
 	
 	if (!(par->i810_gtt.i810_cursor_memory = 
-	      agp_allocate_memory(par->cursor_heap.size >> 12,
+	      agp_allocate_memory(bridge, par->cursor_heap.size >> 12,
 				  AGP_PHYSICAL_MEMORY))) {
 		printk("i810fb_alloc_cursormem:  can't allocate" 
 		       "cursor memory\n");
-		agp_backend_release();
+		agp_backend_release(bridge);
 		return -ENOMEM;
 	}
 	if (agp_bind_memory(par->i810_gtt.i810_cursor_memory,
 			    par->cursor_heap.offset)) {
 		printk("i810fb_alloc_cursormem: cannot bind cursor memory\n");
-		agp_backend_release();
+		agp_backend_release(bridge);
 		return -EBUSY;
 	}	
 
@@ -1632,7 +1633,7 @@
 
 	i810_fix_pointers(par);
 
-	agp_backend_release();
+	agp_backend_release(bridge);
 
 	return 0;
 }
diff -Nru a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c
--- a/drivers/video/intelfb/intelfbdrv.c	2005-01-04 18:48:33 -08:00
+++ b/drivers/video/intelfb/intelfbdrv.c	2005-02-23 15:19:04 -08:00
@@ -470,6 +470,7 @@
 	struct agp_kern_info gtt_info;
 	int agp_memtype;
 	const char *s;
+	struct agp_bridge_data *bridge;
 
 	DBG_MSG("intelfb_pci_register\n");
 
@@ -605,16 +606,16 @@
 	}
 
 	/* Use agpgart to manage the GATT */x-	if (agp_backend_acquire()) {
+	if (!(bridge = agp_backend_acquire(pdev))) {
 		ERR_MSG("cannot acquire agp\n");
 		cleanup(dinfo);
 		return -ENODEV;
 	}
 
 	/* get the current gatt info */x-	if (agp_copy_info(&gtt_info)) {
+	if (agp_copy_info(bridge, &gtt_info)) {
 		ERR_MSG("cannot get agp info\n");
-		agp_backend_release();
+		agp_backend_release(bridge);
 		cleanup(dinfo);
 		return -ENODEV;
 	}
@@ -637,17 +638,17 @@
 	/* Allocate memories (which aren't stolen) */x 	if (dinfo->accel) {
 		if (!(dinfo->gtt_ring_mem =
-		      agp_allocate_memory(dinfo->ring.size >> 12,
+		      agp_allocate_memory(bridge, dinfo->ring.size >> 12,
 					  AGP_NORMAL_MEMORY))) {
 			ERR_MSG("cannot allocate ring buffer memory\n");
-			agp_backend_release();
+			agp_backend_release(bridge);
 			cleanup(dinfo);
 			return -ENOMEM;
 		}
 		if (agp_bind_memory(dinfo->gtt_ring_mem,
 				    dinfo->ring.offset)) {
 			ERR_MSG("cannot bind ring buffer memory\n");
-			agp_backend_release();
+			agp_backend_release(bridge);
 			cleanup(dinfo);
 			return -EBUSY;
 		}
@@ -661,17 +662,17 @@
 		agp_memtype = dinfo->mobile ? AGP_PHYSICAL_MEMORY
 			: AGP_NORMAL_MEMORY;
 		if (!(dinfo->gtt_cursor_mem =
-		      agp_allocate_memory(dinfo->cursor.size >> 12,
+		      agp_allocate_memory(bridge, dinfo->cursor.size >> 12,
 					  agp_memtype))) {
 			ERR_MSG("cannot allocate cursor memory\n");
-			agp_backend_release();
+			agp_backend_release(bridge);
 			cleanup(dinfo);
 			return -ENOMEM;
 		}
 		if (agp_bind_memory(dinfo->gtt_cursor_mem,
 				    dinfo->cursor.offset)) {
 			ERR_MSG("cannot bind cursor memory\n");
-			agp_backend_release();
+			agp_backend_release(bridge);
 			cleanup(dinfo);
 			return -EBUSY;
 		}
@@ -686,7 +687,7 @@
 	}
 	if (dinfo->fbmem_gart) {
 		if (!(dinfo->gtt_fb_mem =
-		      agp_allocate_memory(dinfo->fb.size >> 12,
+		      agp_allocate_memory(bridge, dinfo->fb.size >> 12,
 					  AGP_NORMAL_MEMORY))) {
 			WRN_MSG("cannot allocate framebuffer memory - use "
 				"the stolen one\n");
@@ -709,7 +710,7 @@
 	dinfo->fb_start = dinfo->fb.offset << 12;
 
 	/* release agpgart */x-	agp_backend_release();
+	agp_backend_release(bridge);
 
 	if (mtrr)
 		set_mtrr(dinfo);
diff -Nru a/drivers/video/offb.c b/drivers/video/offb.c
--- a/drivers/video/offb.c	2004-11-27 06:53:14 -08:00
+++ b/drivers/video/offb.c	2005-03-04 22:41:55 -08:00
@@ -29,6 +29,10 @@
 #include <asm/io.h>
 #include <asm/prom.h>
 x+#ifdef CONFIG_PPC64x+#include <asm/pci-bridge.h>
+#endif
+
 #ifdef CONFIG_PPC32
 #include <asm/bootx.h>
 #endif
@@ -322,7 +326,8 @@
 	int *pp, i;
 	unsigned int len;
 	int width = 640, height = 480, depth = 8, pitch;
-	unsigned *up, address;
+	unsigned *up;
+	unsigned long address;
 
 	if ((pp = (int *) get_property(dp, "depth", &len)) != NULL
 	    && len == sizeof(int))
@@ -356,6 +361,10 @@
 		}
 
 		address = (u_long) dp->addrs[i].address;
+x+#ifdef CONFIG_PPC64x+		address += dp->phb->pci_mem_offset;
+#endif
 
 		/* kludge for valkyrie */x 		if (strcmp(dp->name, "valkyrie") == 0)
diff -Nru a/drivers/video/pvr2fb.c b/drivers/video/pvr2fb.c
--- a/drivers/video/pvr2fb.c	2004-10-19 02:40:21 -07:00
+++ b/drivers/video/pvr2fb.c	2005-03-07 20:41:29 -08:00
@@ -4,7 +4,7 @@
  * Dreamcast.
  *
  * Copyright (c) 2001 M. R. Brown <mrbrown@0xd6.org>
- * Copyright (c) 2001, 2002, 2003, 2004 Paul Mundt <lethal@linux-sh.org>
+ * Copyright (c) 2001, 2002, 2003, 2004, 2005 Paul Mundt <lethal@linux-sh.org>
  *
  * This file is part of the LinuxDC project (linuxdc.sourceforge.net).
  *
@@ -33,7 +33,7 @@
  *  Then, when it's time to convert back to hardware settings, the only
  *  constants are the borderstart_* offsets, all other values are derived from
  *  the fb video mode:
- *  
+ *x  *      // PALx  *      borderstart_h = 116;
  *      borderstart_v = 44;
@@ -939,7 +939,8 @@
 
 	pvr2_fix.mmio_start	= pci_resource_start(pdev, 1);
 	pvr2_fix.mmio_len	= pci_resource_len(pdev, 1);
-	fbinfo->device = &pdev->dev;
+x+	fb_info->device		= &pdev->dev;
 
 	return pvr2fb_common_init();
 }
@@ -1068,7 +1069,6 @@
 	size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32);x x 	fb_info = kmalloc(size, GFP_KERNEL);
-	
 	if (!fb_info) {
 		printk(KERN_ERR "Failed to allocate memory for fb_info\n");
 		return -ENOMEM;
diff -Nru a/drivers/video/sun3fb.c b/drivers/video/sun3fb.c
--- a/drivers/video/sun3fb.c	2003-04-24 03:30:41 -07:00
+++ b/drivers/video/sun3fb.c	2005-03-07 20:41:34 -08:00
@@ -505,7 +505,7 @@
 			if (fb->restore_palette) {
 				if (enter)
 					fb->restore_palette(fb);
-				else if (vt_cons[i]->vc_mode != KD_GRAPHICS)
+				else if (vc_cons[i].d->vc_mode != KD_GRAPHICS)
 				         vc_cons[i].d->vc_sw->con_set_palette(vc_cons[i].d, color_table);
 			}
 		}
diff -Nru a/drivers/w1/dscore.c b/drivers/w1/dscore.c
--- a/drivers/w1/dscore.c	2004-12-20 17:15:10 -08:00
+++ b/drivers/w1/dscore.c	2005-03-07 20:45:03 -08:00
@@ -45,9 +45,6 @@
 int ds_reset(struct ds_device *, struct ds_status *);
 int ds_detect(struct ds_device *, struct ds_status *);
 int ds_stop_pulse(struct ds_device *, int);
-int ds_send_data(struct ds_device *, unsigned char *, int);
-int ds_recv_data(struct ds_device *, unsigned char *, int);
-int ds_recv_status(struct ds_device *, struct ds_status *);
 struct ds_device * ds_get_device(void);
 void ds_put_device(struct ds_device *);
 
@@ -84,7 +81,7 @@
 	int err;
 	
 	err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]), 
-			CONTROL_CMD, 0x40, value, index, NULL, 0, HZ);
+			CONTROL_CMD, 0x40, value, index, NULL, 0, 1000);
 	if (err < 0) {
 		printk(KERN_ERR "Failed to send command control message %x.%x: err=%d.\n", 
 				value, index, err);
@@ -99,7 +96,7 @@
 	int err;
 	
 	err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]), 
-			MODE_CMD, 0x40, value, index, NULL, 0, HZ);
+			MODE_CMD, 0x40, value, index, NULL, 0, 1000);
 	if (err < 0) {
 		printk(KERN_ERR "Failed to send mode control message %x.%x: err=%d.\n", 
 				value, index, err);
@@ -114,7 +111,7 @@
 	int err;
 	
 	err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]), 
-			COMM_CMD, 0x40, value, index, NULL, 0, HZ);
+			COMM_CMD, 0x40, value, index, NULL, 0, 1000);
 	if (err < 0) {
 		printk(KERN_ERR "Failed to send control message %x.%x: err=%d.\n", 
 				value, index, err);
@@ -148,7 +145,7 @@
 	return count;
 }
 
-int ds_recv_status(struct ds_device *dev, struct ds_status *st)
+static int ds_recv_status(struct ds_device *dev, struct ds_status *st)
 {
 	unsigned char buf[64];
 	int count, err = 0, i;
@@ -206,14 +203,14 @@
 	return err;
 }
 
-int ds_recv_data(struct ds_device *dev, unsigned char *buf, int size)
+static int ds_recv_data(struct ds_device *dev, unsigned char *buf, int size)
 {
 	int count, err;
 	struct ds_status st;
 	
 	count = 0;
 	err = usb_bulk_msg(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_DATA_IN]), 
-				buf, size, &count, HZ);
+				buf, size, &count, 1000);
 	if (err < 0) {
 		printk(KERN_INFO "Clearing ep0x%x.\n", dev->ep[EP_DATA_IN]);
 		usb_clear_halt(dev->udev, usb_rcvbulkpipe(dev->udev, dev->ep[EP_DATA_IN]));
@@ -234,12 +231,12 @@
 	return count;
 }
 
-int ds_send_data(struct ds_device *dev, unsigned char *buf, int len)
+static int ds_send_data(struct ds_device *dev, unsigned char *buf, int len)
 {
 	int count, err;
 	
 	count = 0;
-	err = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, dev->ep[EP_DATA_OUT]), buf, len, &count, HZ);
+	err = usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, dev->ep[EP_DATA_OUT]), buf, len, &count, 1000);
 	if (err < 0) {
 		printk(KERN_ERR "Failed to read 1-wire data from 0x02: err=%d.\n", err);
 		return err;
@@ -774,15 +771,19 @@
 EXPORT_SYMBOL(ds_write_byte);
 EXPORT_SYMBOL(ds_write_bit);
 EXPORT_SYMBOL(ds_write_block);
+EXPORT_SYMBOL(ds_reset);
+EXPORT_SYMBOL(ds_get_device);
+EXPORT_SYMBOL(ds_put_device);
+
+/*x+ * This functions can be used for EEPROM programming, 
+ * when driver will be included into mainline this will 
+ * require uncommenting.
+ */x+#if 0
 EXPORT_SYMBOL(ds_start_pulse);
 EXPORT_SYMBOL(ds_set_speed);
-EXPORT_SYMBOL(ds_reset);
 EXPORT_SYMBOL(ds_detect);
 EXPORT_SYMBOL(ds_stop_pulse);
-EXPORT_SYMBOL(ds_send_data);
-EXPORT_SYMBOL(ds_recv_data);
-EXPORT_SYMBOL(ds_recv_status);
 EXPORT_SYMBOL(ds_search);
-EXPORT_SYMBOL(ds_get_device);
-EXPORT_SYMBOL(ds_put_device);
-
+#endif
diff -Nru a/drivers/w1/dscore.h b/drivers/w1/dscore.h
--- a/drivers/w1/dscore.h	2004-11-22 06:08:14 -08:00
+++ b/drivers/w1/dscore.h	2005-03-02 09:57:48 -08:00
@@ -161,9 +161,6 @@
 int ds_reset(struct ds_device *, struct ds_status *);
 int ds_detect(struct ds_device *, struct ds_status *);
 int ds_stop_pulse(struct ds_device *, int);
-int ds_send_data(struct ds_device *, unsigned char *, int);
-int ds_recv_data(struct ds_device *, unsigned char *, int);
-int ds_recv_status(struct ds_device *, struct ds_status *);
 struct ds_device * ds_get_device(void);
 void ds_put_device(struct ds_device *);
 int ds_write_block(struct ds_device *, u8 *, int);
diff -Nru a/drivers/w1/matrox_w1.c b/drivers/w1/matrox_w1.c
--- a/drivers/w1/matrox_w1.c	2004-11-21 02:51:14 -08:00
+++ b/drivers/w1/matrox_w1.c	2005-03-02 09:56:32 -08:00
@@ -235,7 +235,7 @@
 
 static int __init matrox_w1_init(void)
 {
-	return pci_module_init(&matrox_w1_pci_driver);
+	return pci_register_driver(&matrox_w1_pci_driver);
 }
 
 static void __exit matrox_w1_fini(void)
diff -Nru a/drivers/w1/w1.c b/drivers/w1/w1.c
--- a/drivers/w1/w1.c	2005-01-20 21:02:15 -08:00
+++ b/drivers/w1/w1.c	2005-03-07 20:41:41 -08:00
@@ -19,8 +19,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-#include <asm/atomic.h>
-
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -33,6 +31,8 @@
 #include <linux/slab.h>
 #include <linux/sched.h>
 x+#include <asm/atomic.h>
+x #include "w1.h"
 #include "w1_io.h"
 #include "w1_log.h"
@@ -58,7 +58,6 @@
 static pid_t control_thread;
 static int control_needs_exit;
 static DECLARE_COMPLETION(w1_control_complete);
-static DECLARE_WAIT_QUEUE_HEAD(w1_control_wait);
 
 static int w1_master_match(struct device *dev, struct device_driver *drv)
 {
@@ -100,7 +99,7 @@
 	return sprintf(buf, "No family registered.\n");
 }
 
-struct bus_type w1_bus_type = {
+static struct bus_type w1_bus_type = {
 	.name = "w1",
 	.match = w1_master_match,
 };
@@ -138,7 +137,7 @@
 	.show = &w1_default_read_name,
 };
 
-ssize_t w1_master_attribute_show_name(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_name(struct device *dev, char *buf)
 {
 	struct w1_master *md = container_of (dev, struct w1_master, dev);
 	ssize_t count;
@@ -153,7 +152,7 @@
 	return count;
 }
 
-ssize_t w1_master_attribute_show_pointer(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_pointer(struct device *dev, char *buf)
 {
 	struct w1_master *md = container_of(dev, struct w1_master, dev);
 	ssize_t count;
@@ -167,14 +166,14 @@
 	return count;
 }
 
-ssize_t w1_master_attribute_show_timeout(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_timeout(struct device *dev, char *buf)
 {
 	ssize_t count;
 	count = sprintf(buf, "%d\n", w1_timeout);
 	return count;
 }
 
-ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_max_slave_count(struct device *dev, char *buf)
 {
 	struct w1_master *md = container_of(dev, struct w1_master, dev);
 	ssize_t count;
@@ -188,7 +187,7 @@
 	return count;
 }
 
-ssize_t w1_master_attribute_show_attempts(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_attempts(struct device *dev, char *buf)
 {
 	struct w1_master *md = container_of(dev, struct w1_master, dev);
 	ssize_t count;
@@ -202,7 +201,7 @@
 	return count;
 }
 
-ssize_t w1_master_attribute_show_slave_count(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_slave_count(struct device *dev, char *buf)
 {
 	struct w1_master *md = container_of(dev, struct w1_master, dev);
 	ssize_t count;
@@ -216,7 +215,7 @@
 	return count;
 }
 
-ssize_t w1_master_attribute_show_slaves(struct device *dev, char *buf)
+static ssize_t w1_master_attribute_show_slaves(struct device *dev, char *buf)
 
 {
 	struct w1_master *md = container_of(dev, struct w1_master, dev);
@@ -522,9 +521,10 @@
 		slave_count++;
 	}
 
-	if (slave_count == dev->slave_count &&
-		rn && ((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) {
-		w1_attach_slave_device(dev, (struct w1_reg_num *) &rn);
+		if (slave_count == dev->slave_count && rn ) {
+			tmp = cpu_to_le64(rn);
+			if(((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&tmp, 7))
+				w1_attach_slave_device(dev, (struct w1_reg_num *) &rn);
 	}
 			
 	atomic_dec(&dev->refcnt);
@@ -649,7 +649,7 @@
 	struct w1_slave *sl;
 	struct w1_master *dev;
 	struct list_head *ent, *ment, *n, *mn;
-	int err, have_to_wait = 0, timeout;
+	int err, have_to_wait = 0;x x 	daemonize("w1_control");
 	allow_signal(SIGTERM);
@@ -657,11 +657,8 @@
 	while (!control_needs_exit || have_to_wait) {
 		have_to_wait = 0;x x-		timeout = w1_timeout*HZ;
-		do {
-			timeout = interruptible_sleep_on_timeout(&w1_control_wait, timeout);
-			try_to_freeze(PF_FREEZE);
-		} while (!signal_pending(current) && (timeout > 0));
+		try_to_freeze(PF_FREEZE);
+		msleep_interruptible(w1_timeout * 1000);
 
 		if (signal_pending(current))
 			flush_signals(current);
@@ -721,7 +718,6 @@
 int w1_process(void *data)
 {
 	struct w1_master *dev = (struct w1_master *) data;
-	unsigned long timeout;
 	struct list_head *ent, *n;
 	struct w1_slave *sl;
 
@@ -729,11 +725,8 @@
 	allow_signal(SIGTERM);
 
 	while (!dev->need_exit) {
-		timeout = w1_timeout*HZ;
-		do {
-			timeout = interruptible_sleep_on_timeout(&dev->kwait, timeout);
-			try_to_freeze(PF_FREEZE);
-		} while (!signal_pending(current) && (timeout > 0));
+		try_to_freeze(PF_FREEZE);
+		msleep_interruptible(w1_timeout * 1000);
 
 		if (signal_pending(current))
 			flush_signals(current);
@@ -839,6 +832,3 @@
 
 module_init(w1_init);
 module_exit(w1_fini);
-
-EXPORT_SYMBOL(w1_create_master_attributes);
-EXPORT_SYMBOL(w1_destroy_master_attributes);
diff -Nru a/drivers/w1/w1.h b/drivers/w1/w1.h
--- a/drivers/w1/w1.h	2005-01-14 14:17:56 -08:00
+++ b/drivers/w1/w1.h	2005-03-07 20:41:41 -08:00
@@ -24,9 +24,17 @@
 
 struct w1_reg_num
 {
+#if defined(__LITTLE_ENDIAN_BITFIELD)
 	__u64	family:8,
 		id:48,
 		crc:8;
+#elif defined(__BIG_ENDIAN_BITFIELD)
+	__u64	crc:8,
+		id:48,
+		family:8;
+#else
+#error "Please fix <asm/byteorder.h>"
+#endif
 };
 
 #ifdef __KERNEL__
@@ -115,7 +123,6 @@
 
 	int			need_exit;
 	pid_t			kpid;
-	wait_queue_head_t 	kwait;
 	struct semaphore 	mutex;
 
 	struct device_driver	*driver;
diff -Nru a/drivers/w1/w1_family.c b/drivers/w1/w1_family.c
--- a/drivers/w1/w1_family.c	2005-01-20 21:02:15 -08:00
+++ b/drivers/w1/w1_family.c	2005-03-02 09:56:44 -08:00
@@ -138,13 +138,13 @@
 
 void __w1_family_get(struct w1_family *f)
 {
+	smp_mb__before_atomic_inc();
 	atomic_inc(&f->refcnt);
+	smp_mb__after_atomic_inc();
 }
 
 EXPORT_SYMBOL(w1_family_get);
 EXPORT_SYMBOL(w1_family_put);
-EXPORT_SYMBOL(__w1_family_get);
-EXPORT_SYMBOL(__w1_family_put);
 EXPORT_SYMBOL(w1_family_registered);
 EXPORT_SYMBOL(w1_unregister_family);
 EXPORT_SYMBOL(w1_register_family);
diff -Nru a/drivers/w1/w1_int.c b/drivers/w1/w1_int.c
--- a/drivers/w1/w1_int.c	2004-11-26 00:27:23 -08:00
+++ b/drivers/w1/w1_int.c	2005-03-02 09:56:50 -08:00
@@ -74,7 +74,6 @@
 	INIT_LIST_HEAD(&dev->slist);
 	init_MUTEX(&dev->mutex);
 
-	init_waitqueue_head(&dev->kwait);
 	init_completion(&dev->dev_released);
 	init_completion(&dev->dev_exited);
 
@@ -217,8 +216,5 @@
 	__w1_remove_master_device(dev);
 }
 
-EXPORT_SYMBOL(w1_alloc_dev);
-EXPORT_SYMBOL(w1_free_dev);
 EXPORT_SYMBOL(w1_add_master_device);
 EXPORT_SYMBOL(w1_remove_master_device);
-EXPORT_SYMBOL(__w1_remove_master_device);
diff -Nru a/drivers/w1/w1_therm.c b/drivers/w1/w1_therm.c
--- a/drivers/w1/w1_therm.c	2004-09-15 01:04:38 -07:00
+++ b/drivers/w1/w1_therm.c	2005-03-02 09:56:44 -08:00
@@ -26,6 +26,7 @@
 #include <linux/moduleparam.h>
 #include <linux/device.h>
 #include <linux/types.h>
+#include <linux/delay.h>
 x #include "w1.h"
 #include "w1_io.h"
@@ -103,6 +104,7 @@
 	int i, max_trying = 10;
 
 	atomic_inc(&sl->refcnt);
+	smp_mb__after_atomic_inc();
 	if (down_interruptible(&sl->master->mutex)) {
 		count = 0;
 		goto out_dec;
@@ -128,7 +130,7 @@
 		if (!w1_reset_bus (dev)) {
 			int count = 0;
 			u8 match[9] = {W1_MATCH_ROM, };
-			unsigned long tm;
+			unsigned int tm = 750;
 
 			memcpy(&match[1], (u64 *) & sl->reg_num, 8);
 			
@@ -136,11 +138,8 @@
 
 			w1_write_8(dev, W1_CONVERT_TEMP);
 
-			tm = jiffies + msecs_to_jiffies(750);
-			while(time_before(jiffies, tm)) {
-				set_current_state(TASK_INTERRUPTIBLE);
-				schedule_timeout(tm-jiffies);
-
+			while (tm) {
+				tm = msleep_interruptible(tm);
 				if (signal_pending(current))
 					flush_signals(current);
 			}
@@ -181,6 +180,7 @@
 out:
 	up(&dev->mutex);
 out_dec:
+	smp_mb__before_atomic_inc();
 	atomic_dec(&sl->refcnt);
 
 	return count;
diff -Nru a/fs/afs/main.c b/fs/afs/main.c
--- a/fs/afs/main.c	2005-01-20 21:02:13 -08:00
+++ b/fs/afs/main.c	2005-03-08 16:56:12 -08:00
@@ -29,18 +29,9 @@
 
 struct rxrpc_transport *afs_transport;
 
-static int afs_init(void);
-static void afs_exit(void);
 static int afs_adding_peer(struct rxrpc_peer *peer);
 static void afs_discarding_peer(struct rxrpc_peer *peer);
 
-/* XXX late_initcall is kludgy, but the only alternative seems to create
- * a transport upon the first mount, which is worse. Or is it?
- */
-/* module_init(afs_init); */x-late_initcall(afs_init);	/* must be called after net/ to create socket */x-
-module_exit(afs_exit);
 
 MODULE_DESCRIPTION("AFS Client File System");
 MODULE_AUTHOR("Red Hat, Inc.");
@@ -76,7 +67,7 @@
 /*x  * initialise the AFS client FS module
  */
-static int afs_init(void)
+static int __init afs_init(void)
 {
 	int loop, ret;
 
@@ -156,6 +147,10 @@
 	return ret;
 } /* end afs_init() */x 
+/* XXX late_initcall is kludgy, but the only alternative seems to create
+ * a transport upon the first mount, which is worse. Or is it?
+ */x+late_initcall(afs_init);	/* must be called after net/ to create socket */x /*****************************************************************************/
 /*x  * clean up on module removal
@@ -178,6 +173,8 @@
 	afs_proc_cleanup();
 
 } /* end afs_exit() */x+
+module_exit(afs_exit);
 
 /*****************************************************************************/
 /*xdiff -Nru a/fs/autofs4/root.c b/fs/autofs4/root.c
--- a/fs/autofs4/root.c	2004-10-19 02:40:26 -07:00
+++ b/fs/autofs4/root.c	2005-03-07 20:41:36 -08:00
@@ -605,7 +605,9 @@
 		spin_unlock(&dcache_lock);
 		return -ENOTEMPTY;
 	}
+	spin_lock(&dentry->d_lock);
 	__d_drop(dentry);
+	spin_unlock(&dentry->d_lock);
 	spin_unlock(&dcache_lock);
 x 	dput(ino->dentry);
diff -Nru a/fs/autofs4/waitq.c b/fs/autofs4/waitq.c
--- a/fs/autofs4/waitq.c	2004-06-24 01:56:07 -07:00
+++ b/fs/autofs4/waitq.c	2005-03-07 20:41:43 -08:00
@@ -224,6 +224,7 @@
 	} else {
 		atomic_inc(&wq->wait_ctr);
 		up(&sbi->wq_sem);
+		kfree(name);
 		DPRINTK("existing wait id = 0x%08lx, name = %.*s, nfy=%d",
 			(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
 	}
diff -Nru a/fs/binfmt_elf.c b/fs/binfmt_elf.c
--- a/fs/binfmt_elf.c	2005-02-25 13:17:34 -08:00
+++ b/fs/binfmt_elf.c	2005-03-05 21:15:17 -08:00
@@ -37,6 +37,7 @@
 #include <linux/pagemap.h>
 #include <linux/security.h>
 #include <linux/syscalls.h>
+#include <linux/random.h>
 x #include <asm/uaccess.h>
 #include <asm/param.h>
@@ -165,21 +166,14 @@
 	if (k_platform) {
 		size_t len = strlen(k_platform) + 1;
 
-#ifdef CONFIG_X86_HT
 		/*
 		 * In some cases (e.g. Hyper-Threading), we want to avoid L1
 		 * evictions by the processes running on the same package. One
 		 * thing we can do is to shuffle the initial stack for them.
-		 *
-		 * The conditionals here are unneeded, but kept in to make the
-		 * code behaviour the same as pre change unless we have
-		 * hyperthreaded processors. This should be cleaned up
-		 * before 2.6
 		 */x 	 x-		if (smp_num_siblings > 1)
-			STACK_ALLOC(p, ((current->pid % 64) << 7));
-#endif
+		p = arch_align_stack(p);
+
 		u_platform = (elf_addr_t __user *)STACK_ALLOC(p, len);
 		if (__copy_to_user(u_platform, k_platform, len))
 			return -EFAULT;x@@ -501,6 +495,19 @@
 #define INTERPRETER_ELF 2
 x 
+static unsigned long randomize_stack_top(unsigned long stack_top)
+{
+	unsigned int random_variable = 0;
+
+	if (current->flags & PF_RANDOMIZE)
+		random_variable = get_random_int() % (8*1024*1024);
+#ifdef CONFIG_STACK_GROWSUP
+	return PAGE_ALIGN(stack_top + random_variable);
+#else
+	return PAGE_ALIGN(stack_top - random_variable);
+#endif
+}
+
 static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
 {
 	struct file *interpreter = NULL; /* to shut gcc up */x@@ -760,18 +767,29 @@
 	if (elf_read_implies_exec(loc->elf_ex, executable_stack))
 		current->personality |= READ_IMPLIES_EXEC;
 
+	if ( !(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
+		current->flags |= PF_RANDOMIZE;
 	arch_pick_mmap_layout(current->mm);
 
 	/* Do this so that we can load the interpreter, if need be.  We will
 	   change some of these later */x 	current->mm->rss = 0;
 	current->mm->free_area_cache = current->mm->mmap_base;
-	retval = setup_arg_pages(bprm, STACK_TOP, executable_stack);
+	retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP),
+				 executable_stack);
 	if (retval < 0) {
 		send_sig(SIGKILL, current, 0);
 		goto out_free_dentry;
 	}
 	
+#ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES
+	retval = arch_setup_additional_pages(bprm, executable_stack);
+	if (retval < 0) {
+		send_sig(SIGKILL, current, 0);
+		goto out_free_dentry;
+	}
+#endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */x+
 	current->mm->start_stack = bprm->p;
 
 	/* Now we do a little grungy work by mmaping the ELF image into
@@ -1585,7 +1603,7 @@
 					DUMP_SEEK (file->f_pos + PAGE_SIZE);
 				} else {
 					void *kaddr;
-					flush_cache_page(vma, addr);
+					flush_cache_page(vma, addr, page_to_pfn(page));
 					kaddr = kmap(page);
 					if ((size += PAGE_SIZE) > limit ||
 					    !dump_write(file, kaddr,
diff -Nru a/fs/bio.c b/fs/bio.c
--- a/fs/bio.c	2005-01-20 21:02:13 -08:00
+++ b/fs/bio.c	2005-03-07 20:41:39 -08:00
@@ -28,7 +28,6 @@
 
 #define BIO_POOL_SIZE 256
 
-static mempool_t *bio_pool;
 static kmem_cache_t *bio_slab;
 
 #define BIOVEC_NR_POOLS 6
@@ -40,11 +39,10 @@
 #define BIO_SPLIT_ENTRIES 8	
 mempool_t *bio_split_pool;
 
-struct biovec_pool {
+struct biovec_slab {
 	int nr_vecs;
 	char *name; 
 	kmem_cache_t *slab;
-	mempool_t *pool;
 };
 
 /*x@@ -54,15 +52,32 @@
  */
 
 #define BV(x) { .nr_vecs = x, .name = "biovec-"__stringify(x) }
-static struct biovec_pool bvec_array[BIOVEC_NR_POOLS] = {
+static struct biovec_slab bvec_slabs[BIOVEC_NR_POOLS] = {
 	BV(1), BV(4), BV(16), BV(64), BV(128), BV(BIO_MAX_PAGES),
 };
 #undef BV
 
-static inline struct bio_vec *bvec_alloc(int gfp_mask, int nr, unsigned long *idx)
+/*x+ * bio_set is used to allow other portions of the IO system to
+ * allocate their own private memory pools for bio and iovec structures.x+ * These memory pools in turn all allocate from the bio_slab
+ * and the bvec_slabs[].
+ */x+struct bio_set {
+	mempool_t *bio_pool;
+	mempool_t *bvec_pools[BIOVEC_NR_POOLS];
+};
+
+/*x+ * fs_bio_set is the bio_set containing bio and iovec memory pools used byx+ * IO code that does not need private memory pools.
+ */x+static struct bio_set *fs_bio_set;
+
+static inline struct bio_vec *bvec_alloc_bs(int gfp_mask, int nr, unsigned long *idx, struct bio_set *bs)
 {
-	struct biovec_pool *bp;
 	struct bio_vec *bvl;
+	struct biovec_slab *bp;
 
 	/*
 	 * see comment near bvec_array define!
@@ -80,26 +95,27 @@
 	/*
 	 * idx now points to the pool we want to allocate from
 	 */x-	bp = bvec_array + *idx;
 
-	bvl = mempool_alloc(bp->pool, gfp_mask);
+	bp = bvec_slabs + *idx;
+	bvl = mempool_alloc(bs->bvec_pools[*idx], gfp_mask);
 	if (bvl)
 		memset(bvl, 0, bp->nr_vecs * sizeof(struct bio_vec));
+
 	return bvl;
 }
 
 /*
- * default destructor for a bio allocated with bio_alloc()x+ * default destructor for a bio allocated with bio_alloc_bioset()
  */
 static void bio_destructor(struct bio *bio)
 {
 	const int pool_idx = BIO_POOL_IDX(bio);
-	struct biovec_pool *bp = bvec_array + pool_idx;
+	struct bio_set *bs = bio->bi_set;
 
 	BIO_BUG_ON(pool_idx >= BIOVEC_NR_POOLS);
 
-	mempool_free(bio->bi_io_vec, bp->pool);
-	mempool_free(bio, bio_pool);
+	mempool_free(bio->bi_io_vec, bs->bvec_pools[pool_idx]);
+	mempool_free(bio, bs->bio_pool);
 }
 
 inline void bio_init(struct bio *bio)
@@ -121,18 +137,21 @@
 }
 
 /**
- * bio_alloc - allocate a bio for I/Ox+ * bio_alloc_bioset - allocate a bio for I/Ox  * @gfp_mask:   the GFP_ mask given to the slab allocatorx  * @nr_iovecs:	number of iovecs to pre-allocate
  *
  * Description:
- *   bio_alloc will first try it's on mempool to satisfy the allocation.x+ *   bio_alloc_bioset will first try it's on mempool to satisfy the allocation.x  *   If %__GFP_WAIT is set then we will block on the internal pool waitingx  *   for a &struct bio to become free.x+ *x+ *   allocate bio and iovecs from the memory pools specified by the
+ *   bio_set structure.x  **/
-struct bio *bio_alloc(int gfp_mask, int nr_iovecs)x+struct bio *bio_alloc_bioset(int gfp_mask, int nr_iovecs, struct bio_set *bs)
 {
-	struct bio *bio = mempool_alloc(bio_pool, gfp_mask);
+	struct bio *bio = mempool_alloc(bs->bio_pool, gfp_mask);
 
 	if (likely(bio)) {
 		struct bio_vec *bvl = NULL;
@@ -141,22 +160,43 @@
 		if (likely(nr_iovecs)) {
 			unsigned long idx;
 
-			bvl = bvec_alloc(gfp_mask, nr_iovecs, &idx);
+			bvl = bvec_alloc_bs(gfp_mask, nr_iovecs, &idx, bs);
 			if (unlikely(!bvl)) {
-				mempool_free(bio, bio_pool);
+				mempool_free(bio, bs->bio_pool);
 				bio = NULL;
 				goto out;
 			}
 			bio->bi_flags |= idx << BIO_POOL_OFFSET;
-			bio->bi_max_vecs = bvec_array[idx].nr_vecs;
+			bio->bi_max_vecs = bvec_slabs[idx].nr_vecs;
 		}
 		bio->bi_io_vec = bvl;
 		bio->bi_destructor = bio_destructor;
+		bio->bi_set = bs;
 	}
 out:
 	return bio;
 }
 
+struct bio *bio_alloc(int gfp_mask, int nr_iovecs)x+{
+	return bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set);
+}
+
+void zero_fill_bio(struct bio *bio)
+{
+	unsigned long flags;
+	struct bio_vec *bv;
+	int i;
+
+	bio_for_each_segment(bv, bio, i) {
+		char *data = bvec_kmap_irq(bv, &flags);
+		memset(data, 0, bv->bv_len);
+		flush_dcache_page(bv->bv_page);
+		bvec_kunmap_irq(data, &flags);
+	}
+}
+EXPORT_SYMBOL(zero_fill_bio);
+
 /**
  * bio_put - release a reference to a biox  * @bio:   bio to release reference to
@@ -233,7 +273,7 @@
  */
 struct bio *bio_clone(struct bio *bio, int gfp_mask)
 {
-	struct bio *b = bio_alloc(gfp_mask, bio->bi_max_vecs);
+	struct bio *b = bio_alloc_bioset(gfp_mask, bio->bi_max_vecs, fs_bio_set);
 
 	if (b)
 		__bio_clone(b, bio);
@@ -904,11 +944,99 @@
 	kfree(bp);
 }
 
-static void __init biovec_init_pools(void)
+
+/*x+ * create memory pools for biovec's in a bio_set.x+ * use the global biovec slabs created for general use.
+ */x+static int biovec_create_pools(struct bio_set *bs, int pool_entries, int scale)
+{
+	int i;
+
+	for (i = 0; i < BIOVEC_NR_POOLS; i++) {
+		struct biovec_slab *bp = bvec_slabs + i;
+		mempool_t **bvp = bs->bvec_pools + i;
+
+		if (i >= scale)
+			pool_entries >>= 1;
+
+		*bvp = mempool_create(pool_entries, mempool_alloc_slab,
+					mempool_free_slab, bp->slab);
+		if (!*bvp)
+			return -ENOMEM;
+	}
+	return 0;
+}
+
+static void biovec_free_pools(struct bio_set *bs)
+{
+	int i;
+
+	for (i = 0; i < BIOVEC_NR_POOLS; i++) {
+		mempool_t *bvp = bs->bvec_pools[i];
+
+		if (bvp)
+			mempool_destroy(bvp);
+	}
+
+}
+
+void bioset_free(struct bio_set *bs)
 {
-	int i, size, megabytes, pool_entries = BIO_POOL_SIZE;
+	if (bs->bio_pool)
+		mempool_destroy(bs->bio_pool);
+
+	biovec_free_pools(bs);
+
+	kfree(bs);
+}
+
+struct bio_set *bioset_create(int bio_pool_size, int bvec_pool_size, int scale)
+{
+	struct bio_set *bs = kmalloc(sizeof(*bs), GFP_KERNEL);
+
+	if (!bs)
+		return NULL;
+
+	memset(bs, 0, sizeof(*bs));
+	bs->bio_pool = mempool_create(bio_pool_size, mempool_alloc_slab,
+			mempool_free_slab, bio_slab);
+
+	if (!bs->bio_pool)
+		goto bad;
+
+	if (!biovec_create_pools(bs, bvec_pool_size, scale))
+		return bs;
+x+bad:
+	bioset_free(bs);
+	return NULL;
+}
+
+static void __init biovec_init_slabs(void)
+{
+	int i;
+
+	for (i = 0; i < BIOVEC_NR_POOLS; i++) {
+		int size;
+		struct biovec_slab *bvs = bvec_slabs + i;
+
+		size = bvs->nr_vecs * sizeof(struct bio_vec);
+		bvs->slab = kmem_cache_create(bvs->name, size, 0,
+                                SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
+	}
+}
+
+static int __init init_bio(void)
+{
+	int megabytes, bvec_pool_entries;
 	int scale = BIOVEC_NR_POOLS;
 
+	bio_slab = kmem_cache_create("bio", sizeof(struct bio), 0,
+				SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
+
+	biovec_init_slabs();
+
 	megabytes = nr_free_pages() >> (20 - PAGE_SHIFT);
 
 	/*
@@ -928,38 +1056,13 @@
 	/*
 	 * scale number of entries
 	 */x-	pool_entries = megabytes * 2;
-	if (pool_entries > 256)
-		pool_entries = 256;
-
-	for (i = 0; i < BIOVEC_NR_POOLS; i++) {
-		struct biovec_pool *bp = bvec_array + i;
-
-		size = bp->nr_vecs * sizeof(struct bio_vec);
-
-		bp->slab = kmem_cache_create(bp->name, size, 0,
-				SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
-x-		if (i >= scale)
-			pool_entries >>= 1;
-
-		bp->pool = mempool_create(pool_entries, mempool_alloc_slab,
-					mempool_free_slab, bp->slab);
-		if (!bp->pool)
-			panic("biovec: can't init mempool\n");
-	}
-}
-
-static int __init init_bio(void)
-{
-	bio_slab = kmem_cache_create("bio", sizeof(struct bio), 0,
-				SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL, NULL);
-	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");
-
-	biovec_init_pools();
+	bvec_pool_entries = megabytes * 2;
+	if (bvec_pool_entries > 256)
+		bvec_pool_entries = 256;
+
+	fs_bio_set = bioset_create(BIO_POOL_SIZE, bvec_pool_entries, scale);
+	if (!fs_bio_set)
+		panic("bio: can't allocate bios\n");
 
 	bio_split_pool = mempool_create(BIO_SPLIT_ENTRIES,
 				bio_pair_alloc, bio_pair_free, NULL);
@@ -988,3 +1091,6 @@
 EXPORT_SYMBOL(bio_split_pool);
 EXPORT_SYMBOL(bio_copy_user);
 EXPORT_SYMBOL(bio_uncopy_user);
+EXPORT_SYMBOL(bioset_create);
+EXPORT_SYMBOL(bioset_free);
+EXPORT_SYMBOL(bio_alloc_bioset);
diff -Nru a/fs/buffer.c b/fs/buffer.c
--- a/fs/buffer.c	2005-02-18 01:44:07 -08:00
+++ b/fs/buffer.c	2005-03-07 20:41:41 -08:00
@@ -39,6 +39,7 @@
 #include <linux/notifier.h>
 #include <linux/cpu.h>
 #include <linux/bitops.h>
+#include <linux/mpage.h>
 x static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
 static void invalidate_bh_lrus(void);
@@ -875,7 +876,7 @@
 	spin_unlock(&mapping->private_lock);
 x 	if (!TestSetPageDirty(page)) {
-		spin_lock_irq(&mapping->tree_lock);
+		write_lock_irq(&mapping->tree_lock);
 		if (page->mapping) {	/* Race with truncate? */x 			if (!mapping->backing_dev_info->memory_backed)
 				inc_page_state(nr_dirty);
@@ -883,7 +884,7 @@
 						page_index(page),
 						PAGECACHE_TAG_DIRTY);
 		}
-		spin_unlock_irq(&mapping->tree_lock);
+		write_unlock_irq(&mapping->tree_lock);
 		__mark_inode_dirty(mapping->host, I_DIRTY_PAGES);
 	}
 	
@@ -2507,6 +2508,61 @@
 	return 0;
 }
 EXPORT_SYMBOL(nobh_commit_write);
+
+/*x+ * nobh_writepage() - based on block_full_write_page() exceptx+ * that it tries to operate without attaching bufferheads to
+ * the page.
+ */x+int nobh_writepage(struct page *page, get_block_t *get_block,
+			struct writeback_control *wbc)
+{
+	struct inode * const inode = page->mapping->host;
+	loff_t i_size = i_size_read(inode);
+	const pgoff_t end_index = i_size >> PAGE_CACHE_SHIFT;
+	unsigned offset;
+	void *kaddr;
+	int ret;
+
+	/* Is the page fully inside i_size? */x+	if (page->index < end_index)
+		goto out;
+
+	/* Is the page fully outside i_size? (truncate in progress) */x+	offset = i_size & (PAGE_CACHE_SIZE-1);
+	if (page->index >= end_index+1 || !offset) {
+		/*x+		 * The page may have dirty, unmapped buffers.  For example,x+		 * they may have been added in ext3_writepage().  Make themx+		 * freeable here, so the page does not leak.x+		 */x+#if 0
+		/* Not really sure about this  - do we need this ? */x+		if (page->mapping->a_ops->invalidatepage)
+			page->mapping->a_ops->invalidatepage(page, offset);
+#endif
+		unlock_page(page);
+		return 0; /* don't care */x+	}
+
+	/*
+	 * The page straddles i_size.  It must be zeroed out on each and every
+	 * writepage invocation because it may be mmapped.  "A file is mapped
+	 * in multiples of the page size.  For a file that is not a multiple of
+	 * the  page size, the remaining memory is zeroed when mapped, and
+	 * writes to that region are not written out to the file."
+	 */x+	kaddr = kmap_atomic(page, KM_USER0);
+	memset(kaddr + offset, 0, PAGE_CACHE_SIZE - offset);
+	flush_dcache_page(page);
+	kunmap_atomic(kaddr, KM_USER0);
+out:
+	ret = mpage_writepage(page, get_block, wbc);
+	if (ret == -EAGAIN)
+		ret = __block_write_full_page(inode, page, get_block, wbc);
+	return ret;
+}
+EXPORT_SYMBOL(nobh_writepage);
 
 /*
  * This function assumes that ->prepare_write() uses nobh_prepare_write().
diff -Nru a/fs/char_dev.c b/fs/char_dev.c
--- a/fs/char_dev.c	2005-01-20 21:02:13 -08:00
+++ b/fs/char_dev.c	2005-03-09 09:03:28 -08:00
@@ -26,9 +26,10 @@
 
 static struct kobj_map *cdev_map;
 
-#define MAX_PROBE_HASH 255	/* random */x+/* degrade to linked list for small systems */x+#define MAX_PROBE_HASH (CONFIG_BASE_SMALL ? 1 : 255)
 
-static DEFINE_RWLOCK(chrdevs_lock);
+static DECLARE_MUTEX(chrdevs_lock);
 
 static struct char_device_struct {
 	struct char_device_struct *next;x@@ -54,13 +55,13 @@
 
 	len = sprintf(page, "Character devices:\n");
 
-	read_lock(&chrdevs_lock);
+	down(&chrdevs_lock);
 	for (i = 0; i < ARRAY_SIZE(chrdevs) ; i++) {
 		for (cd = chrdevs[i]; cd; cd = cd->next)
 			len += sprintf(page+len, "%3d %s\n",
 				       cd->major, cd->name);
 	}
-	read_unlock(&chrdevs_lock);
+	up(&chrdevs_lock);
 
 	return len;
 }
@@ -90,7 +91,7 @@
 
 	memset(cd, 0, sizeof(struct char_device_struct));
 
-	write_lock_irq(&chrdevs_lock);
+	down(&chrdevs_lock);
 
 	/* temporary */x 	if (major == 0) {
@@ -125,10 +126,10 @@
 	}
 	cd->next = *cp;
 	*cp = cd;
-	write_unlock_irq(&chrdevs_lock);
+	up(&chrdevs_lock);
 	return cd;
 out:
-	write_unlock_irq(&chrdevs_lock);
+	up(&chrdevs_lock);
 	kfree(cd);
 	return ERR_PTR(ret);
 }
@@ -139,7 +140,7 @@
 	struct char_device_struct *cd = NULL, **cp;
 	int i = major_to_index(major);
 
-	write_lock_irq(&chrdevs_lock);
+	up(&chrdevs_lock);
 	for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next)
 		if ((*cp)->major == major &&
 		    (*cp)->baseminor == baseminor &&
@@ -149,7 +150,7 @@
 		cd = *cp;
 		*cp = cd->next;
 	}
-	write_unlock_irq(&chrdevs_lock);
+	up(&chrdevs_lock);
 	return cd;
 }
 
@@ -380,8 +381,6 @@
 }
 
 
-static decl_subsys(cdev, NULL, NULL);
-x static void cdev_default_release(struct kobject *kobj)
 {
 	struct cdev *p = container_of(kobj, struct cdev, kobj);x@@ -434,13 +433,7 @@
 
 void __init chrdev_init(void)
 {
-/*
- * Keep cdev_subsys around because (and only because) the kobj_map code
- * depends on the rwsem it contains.  We don't make it public in sysfs,
- * however.
- */
-	subsystem_init(&cdev_subsys);
-	cdev_map = kobj_map_init(base_probe, &cdev_subsys);
+	cdev_map = kobj_map_init(base_probe, &chrdevs_lock);
 }
 
 
diff -Nru a/fs/compat_ioctl.c b/fs/compat_ioctl.c
--- a/fs/compat_ioctl.c	2005-02-14 14:39:23 -08:00
+++ b/fs/compat_ioctl.c	2005-03-08 16:26:50 -08:00
@@ -1281,35 +1281,9 @@
 };
 #define MTIOCPOS32	_IOR('m', 3, struct mtpos32)
 
-struct mtconfiginfo32 {
-	compat_long_t	mt_type;
-	compat_long_t	ifc_type;
-	unsigned short	irqnr;
-	unsigned short	dmanr;
-	unsigned short	port;
-	compat_ulong_t	debug;
-	compat_uint_t	have_dens:1;
-	compat_uint_t	have_bsf:1;
-	compat_uint_t	have_fsr:1;
-	compat_uint_t	have_bsr:1;
-	compat_uint_t	have_eod:1;
-	compat_uint_t	have_seek:1;
-	compat_uint_t	have_tell:1;
-	compat_uint_t	have_ras1:1;
-	compat_uint_t	have_ras2:1;
-	compat_uint_t	have_ras3:1;
-	compat_uint_t	have_qfa:1;
-	compat_uint_t	pad1:5;
-	char	reserved[10];
-};
-#define	MTIOCGETCONFIG32	_IOR('m', 4, struct mtconfiginfo32)
-#define	MTIOCSETCONFIG32	_IOW('m', 5, struct mtconfiginfo32)
-x static int mt_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
 {
 	mm_segment_t old_fs = get_fs();
-	struct mtconfiginfo info;
-	struct mtconfiginfo32 __user *uinfo32;
 	struct mtget get;
 	struct mtget32 __user *umget32;
 	struct mtpos pos;
@@ -1327,27 +1301,6 @@
 		kcmd = MTIOCGET;
 		karg = &get;
 		break;
-	case MTIOCGETCONFIG32:
-		kcmd = MTIOCGETCONFIG;
-		karg = &info;
-		break;
-	case MTIOCSETCONFIG32:
-		kcmd = MTIOCSETCONFIG;
-		karg = &info;
-		uinfo32 = compat_ptr(arg);
-		err = __get_user(info.mt_type, &uinfo32->mt_type);
-		err |= __get_user(info.ifc_type, &uinfo32->ifc_type);
-		err |= __get_user(info.irqnr, &uinfo32->irqnr);
-		err |= __get_user(info.dmanr, &uinfo32->dmanr);
-		err |= __get_user(info.port, &uinfo32->port);
-		err |= __get_user(info.debug, &uinfo32->debug);
-		err |= __copy_from_user((char *)&info.debug
-				     + sizeof(info.debug),
-				     (char __user *)&uinfo32->debug
-				     + sizeof(uinfo32->debug), sizeof(__u32));
-		if (err)
-			return -EFAULT;x-		break;
 	default:
 		do {
 			static int count;
@@ -1378,20 +1331,6 @@
 		err |= __put_user(get.mt_fileno, &umget32->mt_fileno);
 		err |= __put_user(get.mt_blkno, &umget32->mt_blkno);
 		break;
-	case MTIOCGETCONFIG32:
-		uinfo32 = compat_ptr(arg);
-		err = __put_user(info.mt_type, &uinfo32->mt_type);
-		err |= __put_user(info.ifc_type, &uinfo32->ifc_type);
-		err |= __put_user(info.irqnr, &uinfo32->irqnr);
-		err |= __put_user(info.dmanr, &uinfo32->dmanr);
-		err |= __put_user(info.port, &uinfo32->port);
-		err |= __put_user(info.debug, &uinfo32->debug);
-		err |= __copy_to_user((char __user *)&uinfo32->debug
-			    		   + sizeof(uinfo32->debug),
-					   (char *)&info.debug + sizeof(info.debug), sizeof(__u32));
-		break;
-	case MTIOCSETCONFIG32:
-		break;
 	}
 	return err ? -EFAULT: 0;
 }
@@ -1620,7 +1559,7 @@
 		    get_user(data, &user_cfd->chardata))
 			return -EFAULT;x 		op.data = compat_ptr(data);
-		return con_font_op(fg_console, &op);
+		return con_font_op(vc_cons[fg_console].d, &op);
 	case GIO_FONTX:x 		op.op = KD_FONT_OP_GET;
 		op.flags = 0;
@@ -1632,7 +1571,7 @@
 		if (!data)
 			return 0;
 		op.data = compat_ptr(data);
-		i = con_font_op(fg_console, &op);
+		i = con_font_op(vc_cons[fg_console].d, &op);
 		if (i)
 			return i;
 		if (put_user(op.height, &user_cfd->charheight) ||
@@ -1658,7 +1597,7 @@
 	struct console_font_op op;
 	struct console_font_op32 __user *fontop = compat_ptr(arg);
 	int perm = vt_check(file), i;
-	struct vt_struct *vt;
+	struct vc_data *vc;
 	
 	if (perm < 0) return perm;
 	
@@ -1668,9 +1607,10 @@
 		return -EPERM;
 	op.data = compat_ptr(((struct console_font_op32 *)&op)->data);
 	op.flags |= KD_FONT_FLAG_OLD;
-	vt = (struct vt_struct *)((struct tty_struct *)file->private_data)->driver_data;
-	i = con_font_op(vt->vc_num, &op);
-	if (i) return i;
+	vc = ((struct tty_struct *)file->private_data)->driver_data;
+	i = con_font_op(vc, &op);
+	if (i)
+		return i;
 	((struct console_font_op32 *)&op)->data = (unsigned long)op.data;
 	if (copy_to_user(fontop, &op, sizeof(struct console_font_op32)))
 		return -EFAULT;x@@ -1694,9 +1634,9 @@
 	switch (cmd) {
 	case PIO_UNIMAP:
 		if (!perm) return -EPERM;
-		return con_set_unimap(fg_console, tmp.entry_ct, compat_ptr(tmp.entries));
+		return con_set_unimap(vc_cons[fg_console].d, tmp.entry_ct, compat_ptr(tmp.entries));
 	case GIO_UNIMAP:
-		return con_get_unimap(fg_console, tmp.entry_ct, &(user_ud->entry_ct), compat_ptr(tmp.entries));
+		return con_get_unimap(vc_cons[fg_console].d, tmp.entry_ct, &(user_ud->entry_ct), compat_ptr(tmp.entries));
 	}
 	return 0;
 }
@@ -2575,229 +2515,11 @@
         return sys_ioctl(fd, USBDEVFS_BULK, (unsigned long)p);
 }
 
-/* This needs more work before we can enable it.  Unfortunately
- * because of the fancy asynchronous way URB status/error is written
- * back to userspace, we'll need to fiddle with USB devio internals
- * and/or reimplement entirely the frontend of it ourselves. -DaveM
- *
- * The issue is:
- *
- *	When an URB is submitted via usbdevicefs it is put onto an
- *	asynchronous queue.  When the URB completes, it may be reaped
- *	via another ioctl.  During this reaping the status is written
- *	back to userspace along with the length of the transfer.
- *
- *	We must translate into 64-bit kernel types so we pass in a kernel
- *	space copy of the usbdevfs_urb structure.  This would mean that we
- *	must do something to deal with the async entry reaping.  First we
- *	have to deal somehow with this transitory memory we've allocated.
- *	This is problematic since there are many call sites from which the
- *	async entries can be destroyed (and thus when we'd need to free up
- *	this kernel memory).  One of which is the close() op of usbdevicefs.
- *	To handle that we'd need to make our own file_operations struct which
- *	overrides usbdevicefs's release op with our own which runs usbdevicefs's
- *	real release op then frees up the kernel memory.
- *
- *	But how to keep track of these kernel buffers?  We'd need to either
- *	keep track of them in some table _or_ know about usbdevicefs internals
- *	(ie. the exact layout of its file private, which is actually defined
- *	in linux/usbdevice_fs.h, the layout of the async queues are private to
- *	devio.c)
- *
- * There is one possible other solution I considered, also involving knowledge
- * of usbdevicefs internals:
- *
- *	After an URB is submitted, we "fix up" the address back to the user
- *	space one.  This would work if the status/length fields written back
- *	by the async URB completion lines up perfectly in the 32-bit type with
- *	the 64-bit kernel type.  Unfortunately, it does not because the iso
- *	frame descriptors, at the end of the struct, can be written back.
- *
- * I think we'll just need to simply duplicate the devio URB engine here.
- */
-#if 0
-struct usbdevfs_urb32 {
-	unsigned char type;
-	unsigned char endpoint;
-	compat_int_t status;
-	compat_uint_t flags;
-	compat_caddr_t buffer;
-	compat_int_t buffer_length;
-	compat_int_t actual_length;
-	compat_int_t start_frame;
-	compat_int_t number_of_packets;
-	compat_int_t error_count;
-	compat_uint_t signr;
-	compat_caddr_t usercontext; /* unused */
-	struct usbdevfs_iso_packet_desc iso_frame_desc[0];
-};
-
-#define USBDEVFS_SUBMITURB32       _IOR('U', 10, struct usbdevfs_urb32)
-
-static int get_urb32(struct usbdevfs_urb *kurb,
-		     struct usbdevfs_urb32 *uurb)
-{
-	if (get_user(kurb->type, &uurb->type) ||
-	    __get_user(kurb->endpoint, &uurb->endpoint) ||
-	    __get_user(kurb->status, &uurb->status) ||
-	    __get_user(kurb->flags, &uurb->flags) ||
-	    __get_user(kurb->buffer_length, &uurb->buffer_length) ||
-	    __get_user(kurb->actual_length, &uurb->actual_length) ||
-	    __get_user(kurb->start_frame, &uurb->start_frame) ||
-	    __get_user(kurb->number_of_packets, &uurb->number_of_packets) ||
-	    __get_user(kurb->error_count, &uurb->error_count) ||
-	    __get_user(kurb->signr, &uurb->signr))
-		return -EFAULT;x-
-	kurb->usercontext = 0; /* unused currently */x-
-	return 0;
-}
-
-/* Just put back the values which usbdevfs actually changes. */
-static int put_urb32(struct usbdevfs_urb *kurb,
-		     struct usbdevfs_urb32 *uurb)
-{
-	if (put_user(kurb->status, &uurb->status) ||
-	    __put_user(kurb->actual_length, &uurb->actual_length) ||
-	    __put_user(kurb->error_count, &uurb->error_count))
-		return -EFAULT;x-
-	if (kurb->number_of_packets != 0) {
-		int i;
-
-		for (i = 0; i < kurb->number_of_packets; i++) {
-			if (__put_user(kurb->iso_frame_desc[i].actual_length,
-				       &uurb->iso_frame_desc[i].actual_length) ||
-			    __put_user(kurb->iso_frame_desc[i].status,
-				       &uurb->iso_frame_desc[i].status))
-				return -EFAULT;x-		}
-	}
-
-	return 0;
-}
-
-static int get_urb32_isoframes(struct usbdevfs_urb *kurb,
-			       struct usbdevfs_urb32 *uurb)
-{
-	unsigned int totlen;
-	int i;
 
-	if (kurb->type != USBDEVFS_URB_TYPE_ISO) {
-		kurb->number_of_packets = 0;
-		return 0;
-	}
-
-	if (kurb->number_of_packets < 1 ||
-	    kurb->number_of_packets > 128)
-		return -EINVAL;x-
-	if (copy_from_user(&kurb->iso_frame_desc[0],
-			   &uurb->iso_frame_desc[0],
-			   sizeof(struct usbdevfs_iso_packet_desc) *
-			   kurb->number_of_packets))
-		return -EFAULT;x-
-	totlen = 0;
-	for (i = 0; i < kurb->number_of_packets; i++) {
-		unsigned int this_len;
-
-		this_len = kurb->iso_frame_desc[i].length;
-		if (this_len > 1023)
-			return -EINVAL;x-
-		totlen += this_len;
-	}
-
-	if (totlen > 32768)
-		return -EINVAL;x-
-	kurb->buffer_length = totlen;
-
-	return 0;
-}
-
-static int do_usbdevfs_urb(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-	struct usbdevfs_urb *kurb;
-	struct usbdevfs_urb32 *uurb;
-	mm_segment_t old_fs;
-	__u32 udata;
-	void *uptr, *kptr;
-	unsigned int buflen;
-	int err;
-
-	uurb = compat_ptr(arg);
-
-	err = -ENOMEM;
-	kurb = kmalloc(sizeof(struct usbdevfs_urb) +
-		       (sizeof(struct usbdevfs_iso_packet_desc) * 128),
-		       GFP_KERNEL);
-	if (!kurb)
-		goto out;
-
-	err = -EFAULT;x-	if (get_urb32(kurb, uurb))
-		goto out;
-
-	err = get_urb32_isoframes(kurb, uurb);x-	if (err)
-		goto out;
-
-	err = -EFAULT;x-	if (__get_user(udata, &uurb->buffer))
-		goto out;
-	uptr = compat_ptr(udata);
-
-	buflen = kurb->buffer_length;
-	err = verify_area(VERIFY_WRITE, uptr, buflen);x-	if (err)
-		goto out;
-
-
-	old_fs = get_fs();
-	set_fs(KERNEL_DS);
-	err = sys_ioctl(fd, USBDEVFS_SUBMITURB, (unsigned long) kurb);
-	set_fs(old_fs);x-
-	if (err >= 0) {
-		/* RED-PEN Shit, this doesn't work for async URBs :-( XXX */
-		if (put_urb32(kurb, uurb)) {
-			err = -EFAULT;x-		}
-	}
-
-out:
-	kfree(kurb);
-	return err;
-}
-#endif
-
-#define USBDEVFS_REAPURB32         _IOW('U', 12, u32)
-#define USBDEVFS_REAPURBNDELAY32   _IOW('U', 13, u32)
-
-static int do_usbdevfs_reapurb(unsigned int fd, unsigned int cmd, unsigned long arg)
-{
-        mm_segment_t old_fs;
-        void *kptr;
-        int err;
-
-        old_fs = get_fs();
-        set_fs(KERNEL_DS);
-        err = sys_ioctl(fd,
-                        (cmd == USBDEVFS_REAPURB32 ?
-                         USBDEVFS_REAPURB :
-                         USBDEVFS_REAPURBNDELAY),
-                        (unsigned long) &kptr);
-        set_fs(old_fs);x-
-        if (err >= 0 &&
-            put_user((u32)(u64)kptr, (u32 __user *)compat_ptr(arg)))
-                err = -EFAULT;x-
-        return err;
-}
+/*x+ *  USBDEVFS_SUBMITURB, USBDEVFS_REAPURB and USBDEVFS_REAPURBNDELAYx+ *  are handled in usbdevfs core.			-Christopher Li
+ */x 
 struct usbdevfs_disconnectsignal32 {
         compat_int_t signr;
@@ -3259,8 +2981,6 @@
 HANDLE_IOCTL(PPPIOCSACTIVE32, ppp_sock_fprog_ioctl_trans)
 HANDLE_IOCTL(MTIOCGET32, mt_ioctl_trans)
 HANDLE_IOCTL(MTIOCPOS32, mt_ioctl_trans)
-HANDLE_IOCTL(MTIOCGETCONFIG32, mt_ioctl_trans)
-HANDLE_IOCTL(MTIOCSETCONFIG32, mt_ioctl_trans)
 HANDLE_IOCTL(CDROMREADAUDIO, cdrom_ioctl_trans)
 HANDLE_IOCTL(CDROM_SEND_PACKET, cdrom_ioctl_trans)
 HANDLE_IOCTL(LOOP_SET_STATUS, loop_status)
@@ -3331,9 +3051,6 @@
 /* Usbdevfs */x HANDLE_IOCTL(USBDEVFS_CONTROL32, do_usbdevfs_control)x HANDLE_IOCTL(USBDEVFS_BULK32, do_usbdevfs_bulk)
-/*HANDLE_IOCTL(USBDEVFS_SUBMITURB32, do_usbdevfs_urb)*/
-HANDLE_IOCTL(USBDEVFS_REAPURB32, do_usbdevfs_reapurb)
-HANDLE_IOCTL(USBDEVFS_REAPURBNDELAY32, do_usbdevfs_reapurb)
 HANDLE_IOCTL(USBDEVFS_DISCSIGNAL32, do_usbdevfs_discsignal)
 /* i2c */x HANDLE_IOCTL(I2C_FUNCS, w_long)
diff -Nru a/fs/cramfs/inode.c b/fs/cramfs/inode.c
--- a/fs/cramfs/inode.c	2004-04-16 08:39:37 -07:00
+++ b/fs/cramfs/inode.c	2005-03-07 20:41:20 -08:00
@@ -70,6 +70,7 @@
 			inode->i_data.a_ops = &cramfs_aops;
 		} else {
 			inode->i_size = 0;
+			inode->i_blocks = 0;
 			init_special_inode(inode, inode->i_mode,
 				old_decode_dev(cramfs_inode->size));
 		}
diff -Nru a/fs/dcache.c b/fs/dcache.c
--- a/fs/dcache.c	2005-01-20 21:02:13 -08:00
+++ b/fs/dcache.c	2005-03-07 20:41:36 -08:00
@@ -340,13 +340,16 @@
 	tmp = head;
 	while ((tmp = tmp->next) != head) {
 		struct dentry *dentry = list_entry(tmp, struct dentry, d_alias);
+		spin_lock(&dentry->d_lock);
 		if (!atomic_read(&dentry->d_count)) {
 			__dget_locked(dentry);
 			__d_drop(dentry);
+			spin_unlock(&dentry->d_lock);
 			spin_unlock(&dcache_lock);
 			dput(dentry);
 			goto restart;
 		}
+		spin_unlock(&dentry->d_lock);
 	}
 	spin_unlock(&dcache_lock);
 }
diff -Nru a/fs/debugfs/file.c b/fs/debugfs/file.c
--- a/fs/debugfs/file.c	2004-12-16 13:16:10 -08:00
+++ b/fs/debugfs/file.c	2005-03-09 09:03:16 -08:00
@@ -52,7 +52,7 @@
 	char buf[32];								\
 	type *val = file->private_data;						\
 										\
-	snprintf(buf, sizeof(buf), format, *val);				\
+	snprintf(buf, sizeof(buf), format "\n", *val);				\
 	return simple_read_from_buffer(user_buf, count, ppos, buf, strlen(buf));\
 }										\
 static ssize_t write_file_##type(struct file *file, const char __user *user_buf,\
@@ -186,7 +186,7 @@
 	char buf[3];
 	u32 *val = file->private_data;
 	
-	if (val)
+	if (*val)
 		buf[0] = 'Y';
 	else
 		buf[0] = 'N';
diff -Nru a/fs/direct-io.c b/fs/direct-io.c
--- a/fs/direct-io.c	2005-01-10 17:29:27 -08:00
+++ b/fs/direct-io.c	2005-03-04 22:41:15 -08:00
@@ -1206,7 +1206,8 @@
 	 */x 	dio->lock_type = dio_lock_type;
 	if (dio_lock_type != DIO_NO_LOCKING) {
-		if (rw == READ) {
+		/* watch out for a 0 len io from a tricksy fs */x+		if (rw == READ && end > offset) {
 			struct address_space *mapping;
 
 			mapping = iocb->ki_filp->f_mapping;
@@ -1214,7 +1215,9 @@
 				down(&inode->i_sem);
 				reader_with_isem = 1;
 			}
-			retval = filemap_write_and_wait(mapping);
+
+			retval = filemap_write_and_wait_range(mapping, offset,
+							      end - 1);
 			if (retval) {
 				kfree(dio);
 				goto out;
diff -Nru a/fs/eventpoll.c b/fs/eventpoll.c
--- a/fs/eventpoll.c	2004-10-20 01:37:15 -07:00
+++ b/fs/eventpoll.c	2005-03-08 08:18:40 -08:00
@@ -619,6 +619,7 @@
 	return error;
 }
 
+#define MAX_EVENTS (INT_MAX / sizeof(struct epoll_event))
 
 /*
  * Implement the event wait interface for the eventpoll file. It is the kernel
@@ -635,7 +636,7 @@
 		     current, epfd, events, maxevents, timeout));
 
 	/* The maximum number of event must be greater than zero */
-	if (maxevents <= 0)
+	if (maxevents <= 0 || maxevents > MAX_EVENTS)
 		return -EINVAL;x 
 	/* Verify that the area passed by the user is writeable */
diff -Nru a/fs/exec.c b/fs/exec.c
--- a/fs/exec.c	2005-01-20 21:02:13 -08:00
+++ b/fs/exec.c	2005-03-05 20:47:56 -08:00
@@ -328,7 +328,7 @@
 	}
 	mm->rss++;
 	lru_cache_add_active(page);
-	set_pte(pte, pte_mkdirty(pte_mkwrite(mk_pte(
+	set_pte_at(mm, address, pte, pte_mkdirty(pte_mkwrite(mk_pte(
 					page, vma->vm_page_prot))));
 	page_add_anon_rmap(page, vma, address);
 	pte_unmap(pte);
@@ -400,7 +400,8 @@
 	while (i < MAX_ARG_PAGES)
 		bprm->page[i++] = NULL;
 #else
-	stack_base = stack_top - MAX_ARG_PAGES * PAGE_SIZE;
+	stack_base = arch_align_stack(stack_top - MAX_ARG_PAGES*PAGE_SIZE);
+	stack_base = PAGE_ALIGN(stack_base);
 	bprm->p += stack_base;
 	mm->arg_start = bprm->p;
 	arg_size = stack_top - (PAGE_MASK & (unsigned long) mm->arg_start);
@@ -877,6 +878,7 @@
 	tcomm[i] = '\0';
 	set_task_comm(current, tcomm);
 
+	current->flags &= ~PF_RANDOMIZE;
 	flush_thread();
 
 	if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || 
@@ -1191,8 +1193,8 @@
 
 		/* execve success */x 		security_bprm_free(bprm);
-		acct_update_integrals();
-		update_mem_hiwater();
+		acct_update_integrals(current);
+		update_mem_hiwater(current);
 		kfree(bprm);
 		return retval;
 	}
diff -Nru a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
--- a/fs/exportfs/expfs.c	2004-09-07 23:33:02 -07:00
+++ b/fs/exportfs/expfs.c	2005-03-04 22:32:49 -08:00
@@ -55,7 +55,7 @@
 	struct list_head *le, *head;
 	struct dentry *toput = NULL;
 	int noprogress;x-
+	char nbuf[NAME_MAX+1];
 
 	/*
 	 * Attempt to find the inode.
@@ -176,7 +176,6 @@
 			 */x 			struct dentry *ppd;x 			struct dentry *npd;
-			char nbuf[NAME_MAX+1];
 
 			down(&pd->d_inode->i_sem);
 			ppd = CALL(nops,get_parent)(pd);
@@ -241,7 +240,6 @@
 	/* if we weren't after a directory, have one more step to go */x 	if (result != target_dir) {
 		struct dentry *nresult;
-		char nbuf[NAME_MAX+1];
 		err = CALL(nops,get_name)(target_dir, nbuf, result);
 		if (!err) {
 			down(&target_dir->d_inode->i_sem);
diff -Nru a/fs/ext2/inode.c b/fs/ext2/inode.c
--- a/fs/ext2/inode.c	2005-01-25 13:50:19 -08:00
+++ b/fs/ext2/inode.c	2005-03-07 20:41:41 -08:00
@@ -626,6 +626,12 @@
 	return nobh_prepare_write(page,from,to,ext2_get_block);
 }
 
+static int ext2_nobh_writepage(struct page *page,
+			struct writeback_control *wbc)
+{
+	return nobh_writepage(page, ext2_get_block, wbc);
+}
+
 static sector_t ext2_bmap(struct address_space *mapping, sector_t block)
 {
 	return generic_block_bmap(mapping,block,ext2_get_block);
@@ -675,7 +681,7 @@
 struct address_space_operations ext2_nobh_aops = {
 	.readpage		= ext2_readpage,
 	.readpages		= ext2_readpages,
-	.writepage		= ext2_writepage,
+	.writepage		= ext2_nobh_writepage,
 	.sync_page		= block_sync_page,
 	.prepare_write		= ext2_nobh_prepare_write,
 	.commit_write		= nobh_commit_write,
diff -Nru a/fs/ext3/balloc.c b/fs/ext3/balloc.c
--- a/fs/ext3/balloc.c	2005-01-20 21:00:21 -08:00
+++ b/fs/ext3/balloc.c	2005-03-07 20:41:35 -08:00
@@ -43,34 +43,34 @@
 					     struct buffer_head ** bh)
 {
 	unsigned long group_desc;
-	unsigned long desc;
-	struct ext3_group_desc * gdp;
+	unsigned long offset;
+	struct ext3_group_desc * desc;
+	struct ext3_sb_info *sbi = EXT3_SB(sb);
 
-	if (block_group >= EXT3_SB(sb)->s_groups_count) {
+	if (block_group >= sbi->s_groups_count) {
 		ext3_error (sb, "ext3_get_group_desc",
 			    "block_group >= groups_count - "
 			    "block_group = %d, groups_count = %lu",
-			    block_group, EXT3_SB(sb)->s_groups_count);
+			    block_group, sbi->s_groups_count);
 
 		return NULL;
 	}
 	smp_rmb();
 
 	group_desc = block_group >> EXT3_DESC_PER_BLOCK_BITS(sb);
-	desc = block_group & (EXT3_DESC_PER_BLOCK(sb) - 1);
-	if (!EXT3_SB(sb)->s_group_desc[group_desc]) {
+	offset = block_group & (EXT3_DESC_PER_BLOCK(sb) - 1);
+	if (!sbi->s_group_desc[group_desc]) {
 		ext3_error (sb, "ext3_get_group_desc",
 			    "Group descriptor not loaded - "
 			    "block_group = %d, group_desc = %lu, desc = %lu",
-			     block_group, group_desc, desc);
+			     block_group, group_desc, offset);
 		return NULL;
 	}
 
-	gdp = (struct ext3_group_desc *) 
-	      EXT3_SB(sb)->s_group_desc[group_desc]->b_data;
+	desc = (struct ext3_group_desc *) sbi->s_group_desc[group_desc]->b_data;
 	if (bh)
-		*bh = EXT3_SB(sb)->s_group_desc[group_desc];
-	return gdp + desc;
+		*bh = sbi->s_group_desc[group_desc];
+	return desc + offset;
 }
 
 /*
@@ -284,14 +284,15 @@
 	unsigned long bit;
 	unsigned long i;
 	unsigned long overflow;
-	struct ext3_group_desc * gdp;
+	struct ext3_group_desc * desc;
 	struct ext3_super_block * es;
 	struct ext3_sb_info *sbi;
 	int err = 0, ret;
+	unsigned group_freed;
 
 	*pdquot_freed_blocks = 0;
 	sbi = EXT3_SB(sb);
-	es = EXT3_SB(sb)->s_es;
+	es = sbi->s_es;
 	if (block < le32_to_cpu(es->s_first_data_block) ||
 	    block + count < block ||
 	    block + count > le32_to_cpu(es->s_blocks_count)) {
@@ -301,7 +302,7 @@
 		goto error_return;
 	}
 
-	ext3_debug ("freeing block %lu\n", block);
+	ext3_debug ("freeing block(s) %lu-%lu\n", block, block + count - 1);
 
 do_more:
 	overflow = 0;
@@ -321,16 +322,16 @@
 	bitmap_bh = read_block_bitmap(sb, block_group);
 	if (!bitmap_bh)
 		goto error_return;
-	gdp = ext3_get_group_desc (sb, block_group, &gd_bh);
-	if (!gdp)
+	desc = ext3_get_group_desc (sb, block_group, &gd_bh);
+	if (!desc)
 		goto error_return;
 
-	if (in_range (le32_to_cpu(gdp->bg_block_bitmap), block, count) ||
-	    in_range (le32_to_cpu(gdp->bg_inode_bitmap), block, count) ||
-	    in_range (block, le32_to_cpu(gdp->bg_inode_table),
-		      EXT3_SB(sb)->s_itb_per_group) ||
-	    in_range (block + count - 1, le32_to_cpu(gdp->bg_inode_table),
-		      EXT3_SB(sb)->s_itb_per_group))
+	if (in_range (le32_to_cpu(desc->bg_block_bitmap), block, count) ||
+	    in_range (le32_to_cpu(desc->bg_inode_bitmap), block, count) ||
+	    in_range (block, le32_to_cpu(desc->bg_inode_table),
+		      sbi->s_itb_per_group) ||
+	    in_range (block + count - 1, le32_to_cpu(desc->bg_inode_table),
+		      sbi->s_itb_per_group))
 		ext3_error (sb, "ext3_free_blocks",
 			    "Freeing blocks in system zones - "
 			    "Block = %lu, count = %lu",
@@ -342,7 +343,7 @@
 	 */x 	/* @@@ check errors */x 	BUFFER_TRACE(bitmap_bh, "getting undo access");
-	err = ext3_journal_get_undo_access(handle, bitmap_bh, NULL);
+	err = ext3_journal_get_undo_access(handle, bitmap_bh);
 	if (err)
 		goto error_return;
 
@@ -358,7 +359,7 @@
 
 	jbd_lock_bh_state(bitmap_bh);
 
-	for (i = 0; i < count; i++) {
+	for (i = 0, group_freed = 0; i < count; i++) {
 		/*
 		 * An HJ special.  This is expensive...
 		 */
@@ -421,15 +422,15 @@
 			jbd_lock_bh_state(bitmap_bh);
 			BUFFER_TRACE(bitmap_bh, "bit already cleared");
 		} else {
-			(*pdquot_freed_blocks)++;
+			group_freed++;
 		}
 	}
 	jbd_unlock_bh_state(bitmap_bh);
 
 	spin_lock(sb_bgl_lock(sbi, block_group));
-	gdp->bg_free_blocks_count =
-		cpu_to_le16(le16_to_cpu(gdp->bg_free_blocks_count) +
-			*pdquot_freed_blocks);
+	desc->bg_free_blocks_count =
+		cpu_to_le16(le16_to_cpu(desc->bg_free_blocks_count) +
+			group_freed);
 	spin_unlock(sb_bgl_lock(sbi, block_group));
 	percpu_counter_mod(&sbi->s_freeblocks_counter, count);
 
@@ -441,6 +442,7 @@
 	BUFFER_TRACE(gd_bh, "dirtied group descriptor block");
 	ret = ext3_journal_dirty_metadata(handle, gd_bh);
 	if (!err) err = ret;
+	*pdquot_freed_blocks += group_freed;
 
 	if (overflow && !err) {
 		block += count;
@@ -991,7 +993,6 @@
 	unsigned long group_first_block;
 	int ret = 0;
 	int fatal;
-	int credits = 0;
 
 	*errp = 0;
 
@@ -1001,7 +1002,7 @@
 	 * if the buffer is in BJ_Forget state in the committing transaction.
 	 */x 	BUFFER_TRACE(bitmap_bh, "get undo access for new block");
-	fatal = ext3_journal_get_undo_access(handle, bitmap_bh, &credits);
+	fatal = ext3_journal_get_undo_access(handle, bitmap_bh);
 	if (fatal) {
 		*errp = fatal;
 		return -1;
@@ -1092,7 +1093,7 @@
 	}
 x 	BUFFER_TRACE(bitmap_bh, "journal_release_buffer");
-	ext3_journal_release_buffer(handle, bitmap_bh, credits);
+	ext3_journal_release_buffer(handle, bitmap_bh);
 	return ret;
 }
 
@@ -1429,9 +1430,8 @@
 #endif
 }
 
-static inline int block_in_use(unsigned long block,
-				struct super_block * sb,
-				unsigned char * map)
+static inline int
+block_in_use(unsigned long block, struct super_block *sb, unsigned char *map)
 {
 	return ext3_test_bit ((block -
 		le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block)) %
@@ -1451,8 +1451,10 @@
 {
 	if (group <= 1)
 		return 1;
-	return (test_root(group, 3) || test_root(group, 5) ||
-		test_root(group, 7));
+	if (!(group & 1))
+		return 0;
+	return (test_root(group, 7) || test_root(group, 5) ||
+		test_root(group, 3));
 }
 
 /**
diff -Nru a/fs/ext3/hash.c b/fs/ext3/hash.c
--- a/fs/ext3/hash.c	2003-06-20 13:16:31 -07:00
+++ b/fs/ext3/hash.c	2005-03-07 20:41:51 -08:00
@@ -13,6 +13,7 @@
 #include <linux/jbd.h>
 #include <linux/sched.h>
 #include <linux/ext3_fs.h>
+#include <linux/cryptohash.h>
 x #define DELTA 0x9E3779B9
 
@@ -33,73 +34,6 @@
 	buf[1] += b1;
 }
 
-/* F, G and H are basic MD4 functions: selection, majority, parity */
-#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
-#define G(x, y, z) (((x) & (y)) + (((x) ^ (y)) & (z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-
-/*
- * The generic round function.  The application is so specific that
- * we don't bother protecting all the arguments with parens, as is generally
- * good macro practice, in favor of extra legibility.
- * Rotation is separate from addition to prevent recomputation
- */
-#define ROUND(f, a, b, c, d, x, s)	\
-	(a += f(b, c, d) + x, a = (a << s) | (a >> (32-s)))
-#define K1 0
-#define K2 013240474631UL
-#define K3 015666365641UL
-
-/*
- * Basic cut-down MD4 transform.  Returns only 32 bits of result.
- */
-static void halfMD4Transform (__u32 buf[4], __u32 const in[])
-{
-	__u32	a = buf[0], b = buf[1], c = buf[2], d = buf[3];
-
-	/* Round 1 */
-	ROUND(F, a, b, c, d, in[0] + K1,  3);
-	ROUND(F, d, a, b, c, in[1] + K1,  7);
-	ROUND(F, c, d, a, b, in[2] + K1, 11);
-	ROUND(F, b, c, d, a, in[3] + K1, 19);
-	ROUND(F, a, b, c, d, in[4] + K1,  3);
-	ROUND(F, d, a, b, c, in[5] + K1,  7);
-	ROUND(F, c, d, a, b, in[6] + K1, 11);
-	ROUND(F, b, c, d, a, in[7] + K1, 19);
-
-	/* Round 2 */
-	ROUND(G, a, b, c, d, in[1] + K2,  3);
-	ROUND(G, d, a, b, c, in[3] + K2,  5);
-	ROUND(G, c, d, a, b, in[5] + K2,  9);
-	ROUND(G, b, c, d, a, in[7] + K2, 13);
-	ROUND(G, a, b, c, d, in[0] + K2,  3);
-	ROUND(G, d, a, b, c, in[2] + K2,  5);
-	ROUND(G, c, d, a, b, in[4] + K2,  9);
-	ROUND(G, b, c, d, a, in[6] + K2, 13);
-
-	/* Round 3 */
-	ROUND(H, a, b, c, d, in[3] + K3,  3);
-	ROUND(H, d, a, b, c, in[7] + K3,  9);
-	ROUND(H, c, d, a, b, in[2] + K3, 11);
-	ROUND(H, b, c, d, a, in[6] + K3, 15);
-	ROUND(H, a, b, c, d, in[1] + K3,  3);
-	ROUND(H, d, a, b, c, in[5] + K3,  9);
-	ROUND(H, c, d, a, b, in[0] + K3, 11);
-	ROUND(H, b, c, d, a, in[4] + K3, 15);
-
-	buf[0] += a;
-	buf[1] += b;
-	buf[2] += c;
-	buf[3] += d;
-}
-
-#undef ROUND
-#undef F
-#undef G
-#undef H
-#undef K1
-#undef K2
-#undef K3
 
 /* The old legacy hash */x static __u32 dx_hack_hash (const char *name, int len)
@@ -187,7 +121,7 @@
 		p = name;
 		while (len > 0) {
 			str2hashbuf(p, len, in, 8);
-			halfMD4Transform(buf, in);
+			half_md4_transform(buf, in);
 			len -= 32;
 			p += 32;
 		}
diff -Nru a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
--- a/fs/ext3/ialloc.c	2005-01-15 14:31:01 -08:00
+++ b/fs/ext3/ialloc.c	2005-03-07 20:41:42 -08:00
@@ -460,9 +460,12 @@
 		goto out;
 
 	for (i = 0; i < sbi->s_groups_count; i++) {
+		err = -EIO;
+
 		gdp = ext3_get_group_desc(sb, group, &bh2);
+		if (!gdp)
+			goto fail;
 
-		err = -EIO;
 		brelse(bitmap_bh);
 		bitmap_bh = read_inode_bitmap(sb, group);
 		if (!bitmap_bh)
@@ -474,11 +477,9 @@
 		ino = ext3_find_next_zero_bit((unsigned long *)
 				bitmap_bh->b_data, EXT3_INODES_PER_GROUP(sb), ino);
 		if (ino < EXT3_INODES_PER_GROUP(sb)) {
-			int credits = 0;
 
 			BUFFER_TRACE(bitmap_bh, "get_write_access");
-			err = ext3_journal_get_write_access_credits(handle,
-							bitmap_bh, &credits);
+			err = ext3_journal_get_write_access(handle, bitmap_bh);
 			if (err)
 				goto fail;
 
@@ -494,7 +495,7 @@
 				goto got;
 			}
 			/* we lost it */
-			journal_release_buffer(handle, bitmap_bh, credits);
+			journal_release_buffer(handle, bitmap_bh);
 
 			if (++ino < EXT3_INODES_PER_GROUP(sb))
 				goto repeat_in_this_group;
diff -Nru a/fs/inode.c b/fs/inode.c
--- a/fs/inode.c	2005-01-20 21:02:13 -08:00
+++ b/fs/inode.c	2005-03-04 22:41:15 -08:00
@@ -196,7 +196,7 @@
 	sema_init(&inode->i_sem, 1);
 	init_rwsem(&inode->i_alloc_sem);
 	INIT_RADIX_TREE(&inode->i_data.page_tree, GFP_ATOMIC);
-	spin_lock_init(&inode->i_data.tree_lock);
+	rwlock_init(&inode->i_data.tree_lock);
 	spin_lock_init(&inode->i_data.i_mmap_lock);
 	INIT_LIST_HEAD(&inode->i_data.private_list);
 	spin_lock_init(&inode->i_data.private_lock);
diff -Nru a/fs/jbd/commit.c b/fs/jbd/commit.c
--- a/fs/jbd/commit.c	2005-01-11 16:43:13 -08:00
+++ b/fs/jbd/commit.c	2005-03-07 20:41:35 -08:00
@@ -93,6 +93,73 @@
 	return 1;
 }
 
+/* Done it all: now write the commit record.  We should havex+ * cleaned up our previous buffers by now, so if we are in abortx+ * mode we can now just skip the rest of the journal writex+ * entirely.
+ *x+ * Returns 1 if the journal needs to be aborted or 0 on success
+ */x+static int journal_write_commit_record(journal_t *journal,
+					transaction_t *commit_transaction)
+{
+	struct journal_head *descriptor;
+	struct buffer_head *bh;
+	int i, ret;
+	int barrier_done = 0;
+
+	if (is_journal_aborted(journal))
+		return 0;
+
+	descriptor = journal_get_descriptor_buffer(journal);
+	if (!descriptor)
+		return 1;
+
+	bh = jh2bh(descriptor);
+
+	/* AKPM: buglet - add `i' to tmp! */x+	for (i = 0; i < bh->b_size; i += 512) {
+		journal_header_t *tmp = (journal_header_t*)bh->b_data;
+		tmp->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER);
+		tmp->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK);
+		tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid);
+	}
+
+	JBUFFER_TRACE(descriptor, "write commit block");
+	set_buffer_dirty(bh);
+	if (journal->j_flags & JFS_BARRIER) {
+		set_buffer_ordered(bh);
+		barrier_done = 1;
+	}
+	ret = sync_dirty_buffer(bh);
+	/* is it possible for another commit to fail at roughly
+	 * the same time as this one?  If so, we don't want to
+	 * trust the barrier flag in the super, but instead want
+	 * to remember if we sent a barrier request
+	 */x+	if (ret == -EOPNOTSUPP && barrier_done) {
+		char b[BDEVNAME_SIZE];
+
+		printk(KERN_WARNING
+			"JBD: barrier-based sync failed on %s - "
+			"disabling barriers\n",
+			bdevname(journal->j_dev, b));
+		spin_lock(&journal->j_state_lock);
+		journal->j_flags &= ~JFS_BARRIER;
+		spin_unlock(&journal->j_state_lock);
+
+		/* And try again, without the barrier */x+		clear_buffer_ordered(bh);
+		set_buffer_uptodate(bh);
+		set_buffer_dirty(bh);
+		ret = sync_dirty_buffer(bh);
+	}
+	put_bh(bh);		/* One for getblk() */x+	journal_put_journal_head(descriptor);
+
+	return (ret == -EIO);
+}
+
 /*
  * journal_commit_transaction
  *
@@ -103,7 +170,7 @@
 {
 	transaction_t *commit_transaction;
 	struct journal_head *jh, *new_jh, *descriptor;
-	struct buffer_head *wbuf[64];
+	struct buffer_head **wbuf = journal->j_wbuf;
 	int bufs;
 	int flags;
 	int err;
@@ -229,6 +296,22 @@
 	jbd_debug (3, "JBD: commit phase 2\n");
 
 	/*
+	 * First, drop modified flag: all accesses to the buffers
+	 * will be tracked for a new trasaction only -bzzz
+	 */x+	spin_lock(&journal->j_list_lock);
+	if (commit_transaction->t_buffers) {
+		new_jh = jh = commit_transaction->t_buffers->b_tnext;
+		do {
+			J_ASSERT_JH(new_jh, new_jh->b_modified == 1 ||
+					new_jh->b_modified == 0);
+			new_jh->b_modified = 0;
+			new_jh = new_jh->b_tnext;
+		} while (new_jh != jh);
+	}
+	spin_unlock(&journal->j_list_lock);
+
+	/*
 	 * Now start flushing things to disk, in the order they appear
 	 * on the transaction lists.  Data blocks go first.
 	 */x@@ -271,7 +354,7 @@
 				BUFFER_TRACE(bh, "start journal writeout");
 				get_bh(bh);
 				wbuf[bufs++] = bh;
-				if (bufs == ARRAY_SIZE(wbuf)) {
+				if (bufs == journal->j_wbufsize) {
 					jbd_debug(2, "submit %d writes\n",
 							bufs);
 					spin_unlock(&journal->j_list_lock);
@@ -487,7 +570,7 @@
 		/* If there's no more to do, or if the descriptor is full,
 		   let the IO rip! */x 
-		if (bufs == ARRAY_SIZE(wbuf) ||
+		if (bufs == journal->j_wbufsize ||
 		    commit_transaction->t_buffers == NULL ||
 		    space_left < sizeof(journal_block_tag_t) + 16) {
 
@@ -616,78 +699,16 @@
 
 	jbd_debug(3, "JBD: commit phase 6\n");
 
-	if (is_journal_aborted(journal))
-		goto skip_commit;
-
-	/* Done it all: now write the commit record.  We should havex-	 * cleaned up our previous buffers by now, so if we are in abortx-	 * mode we can now just skip the rest of the journal writex-	 * entirely. */x+	if (journal_write_commit_record(journal, commit_transaction))
+		err = -EIO;
 
-	descriptor = journal_get_descriptor_buffer(journal);
-	if (!descriptor) {
+	if (err)
 		__journal_abort_hard(journal);
-		goto skip_commit;
-	}
-
-	/* AKPM: buglet - add `i' to tmp! */x-	for (i = 0; i < jh2bh(descriptor)->b_size; i += 512) {
-		journal_header_t *tmp =
-			(journal_header_t*)jh2bh(descriptor)->b_data;
-		tmp->h_magic = cpu_to_be32(JFS_MAGIC_NUMBER);
-		tmp->h_blocktype = cpu_to_be32(JFS_COMMIT_BLOCK);
-		tmp->h_sequence = cpu_to_be32(commit_transaction->t_tid);
-	}
-
-	JBUFFER_TRACE(descriptor, "write commit block");
-	{
-		struct buffer_head *bh = jh2bh(descriptor);
-		int ret;
-		int barrier_done = 0;
-
-		set_buffer_dirty(bh);
-		if (journal->j_flags & JFS_BARRIER) {
-			set_buffer_ordered(bh);
-			barrier_done = 1;
-		}
-		ret = sync_dirty_buffer(bh);
-		/* is it possible for another commit to fail at roughly
-		 * the same time as this one?  If so, we don't want to
-		 * trust the barrier flag in the super, but instead want
-		 * to remember if we sent a barrier request
-		 */
-		if (ret == -EOPNOTSUPP && barrier_done) {
-			char b[BDEVNAME_SIZE];
-
-			printk(KERN_WARNING
-				"JBD: barrier-based sync failed on %s - "
-				"disabling barriers\n",
-				bdevname(journal->j_dev, b));
-			spin_lock(&journal->j_state_lock);
-			journal->j_flags &= ~JFS_BARRIER;
-			spin_unlock(&journal->j_state_lock);
-
-			/* And try again, without the barrier */x-			clear_buffer_ordered(bh);
-			set_buffer_uptodate(bh);
-			set_buffer_dirty(bh);
-			ret = sync_dirty_buffer(bh);
-		}
-		if (unlikely(ret == -EIO))
-			err = -EIO;
-		put_bh(bh);		/* One for getblk() */x-		journal_put_journal_head(descriptor);
-	}
 x 	/* End of a transaction!  Finally, we can do checkpoint
            processing: any buffers committed as a result of this
            transaction can be removed from any checkpoint list it was on
            before. */x-
-skip_commit: /* The journal should be unlocked by now. */x-
-	if (err)
-		__journal_abort_hard(journal);
 
 	jbd_debug(3, "JBD: commit phase 7\n");
 
diff -Nru a/fs/jbd/journal.c b/fs/jbd/journal.c
--- a/fs/jbd/journal.c	2004-11-11 00:34:32 -08:00
+++ b/fs/jbd/journal.c	2005-03-07 20:41:35 -08:00
@@ -721,6 +721,7 @@
 {
 	journal_t *journal = journal_init_common();
 	struct buffer_head *bh;
+	int n;
 
 	if (!journal)
 		return NULL;
@@ -736,6 +737,17 @@
 	journal->j_sb_buffer = bh;
 	journal->j_superblock = (journal_superblock_t *)bh->b_data;
 
+	/* journal descriptor can store up to n blocks -bzzz */x+	n = journal->j_blocksize / sizeof(journal_block_tag_t);x+	journal->j_wbufsize = n;
+	journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL);
+	if (!journal->j_wbuf) {
+		printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n",
+			__FUNCTION__);
+		kfree(journal);
+		journal = NULL;
+	}
+
 	return journal;
 }
  
@@ -752,6 +764,7 @@
 	struct buffer_head *bh;
 	journal_t *journal = journal_init_common();
 	int err;
+	int n;
 	unsigned long blocknr;
 
 	if (!journal)
@@ -768,6 +781,17 @@
 	journal->j_maxlen = inode->i_size >> inode->i_sb->s_blocksize_bits;
 	journal->j_blocksize = inode->i_sb->s_blocksize;
 
+	/* journal descriptor can store up to n blocks -bzzz */x+	n = journal->j_blocksize / sizeof(journal_block_tag_t);x+	journal->j_wbufsize = n;
+	journal->j_wbuf = kmalloc(n * sizeof(struct buffer_head*), GFP_KERNEL);
+	if (!journal->j_wbuf) {
+		printk(KERN_ERR "%s: Cant allocate bhs for commit thread\n",
+			__FUNCTION__);
+		kfree(journal);
+		return NULL;
+	}
+
 	err = journal_bmap(journal, 0, &blocknr);
 	/* If that failed, give up */x 	if (err) {
@@ -1141,6 +1165,7 @@
 		iput(journal->j_inode);
 	if (journal->j_revoke)
 		journal_destroy_revoke(journal);
+	kfree(journal->j_wbuf);
 	kfree(journal);
 }
 
diff -Nru a/fs/jbd/transaction.c b/fs/jbd/transaction.c
--- a/fs/jbd/transaction.c	2005-01-04 18:48:12 -08:00
+++ b/fs/jbd/transaction.c	2005-03-07 20:41:35 -08:00
@@ -522,7 +522,7 @@
  */x static int
 do_get_write_access(handle_t *handle, struct journal_head *jh,
-			int force_copy, int *credits) 
+			int force_copy)
 {
 	struct buffer_head *bh;
 	transaction_t *transaction;
@@ -604,11 +604,6 @@
 		JBUFFER_TRACE(jh, "has frozen data");
 		J_ASSERT_JH(jh, jh->b_next_transaction == NULL);
 		jh->b_next_transaction = transaction;
-
-		J_ASSERT_JH(jh, handle->h_buffer_credits > 0);
-		handle->h_buffer_credits--;
-		if (credits)
-			(*credits)++;
 		goto done;
 	}
 
@@ -688,10 +683,6 @@
 		jh->b_next_transaction = transaction;
 	}
 
-	J_ASSERT(handle->h_buffer_credits > 0);
-	handle->h_buffer_credits--;
-	if (credits)
-		(*credits)++;
 
 	/*
 	 * Finally, if the buffer is not journaled right now, we need to make
@@ -749,8 +740,7 @@
  * because we're write()ing a buffer which is also part of a shared mapping.
  */x 
-int journal_get_write_access(handle_t *handle,
-			struct buffer_head *bh, int *credits)
+int journal_get_write_access(handle_t *handle, struct buffer_head *bh)
 {
 	struct journal_head *jh = journal_add_journal_head(bh);
 	int rc;
@@ -758,7 +748,7 @@
 	/* We do not want to get caught playing with fields which the
 	 * log thread also manipulates.  Make sure that the buffer
 	 * completes any outstanding IO before proceeding. */x-	rc = do_get_write_access(handle, jh, 0, credits);
+	rc = do_get_write_access(handle, jh, 0);
 	journal_put_journal_head(jh);
 	return rc;
 }
@@ -814,9 +804,6 @@
 	J_ASSERT_JH(jh, jh->b_next_transaction == NULL);
 	J_ASSERT_JH(jh, buffer_locked(jh2bh(jh)));
 
-	J_ASSERT_JH(jh, handle->h_buffer_credits > 0);
-	handle->h_buffer_credits--;
-
 	if (jh->b_transaction == NULL) {
 		jh->b_transaction = transaction;
 		JBUFFER_TRACE(jh, "file as BJ_Reserved");
@@ -869,8 +856,7 @@
  *
  * Returns error number or 0 on success.
  */x-int journal_get_undo_access(handle_t *handle, struct buffer_head *bh,
-				int *credits)
+int journal_get_undo_access(handle_t *handle, struct buffer_head *bh)
 {
 	int err;
 	struct journal_head *jh = journal_add_journal_head(bh);
@@ -883,7 +869,7 @@
 	 * make sure that obtaining the committed_data is done
 	 * atomically wrt. completion of any outstanding commits.
 	 */x-	err = do_get_write_access(handle, jh, 1, credits);
+	err = do_get_write_access(handle, jh, 1);
 	if (err)
 		goto out;
 
@@ -1111,6 +1097,17 @@
 
 	jbd_lock_bh_state(bh);
 
+	if (jh->b_modified == 0) {
+		/*
+		 * This buffer's got modified and becoming part
+		 * of the transaction. This needs to be done
+		 * once a transaction -bzzz
+		 */x+		jh->b_modified = 1;
+		J_ASSERT_JH(jh, handle->h_buffer_credits > 0);
+		handle->h_buffer_credits--;
+	}
+
 	/*
 	 * fastpath, to avoid expensive locking.  If this buffer is already
 	 * on the running transaction's metadata list there is nothing to do.
@@ -1161,24 +1158,11 @@
  * journal_release_buffer: undo a get_write_access without any buffer
  * updates, if the update decided in the end that it didn't need access.
  *
- * The caller passes in the number of credits which should be put back for
- * this buffer (zero or one).
- *
- * We leave the buffer attached to t_reserved_list because even though this
- * handle doesn't want it, some other concurrent handle may want to journal
- * this buffer.  If that handle is curently in between get_write_access() and
- * journal_dirty_metadata() then it expects the buffer to be reserved.  If
- * we were to rip it off t_reserved_list here, the other handle will explode
- * when journal_dirty_metadata is presented with a non-reserved buffer.
- *
- * If nobody really wants to journal this buffer then it will be thrown
- * away at the start of commit.
  */x void
-journal_release_buffer(handle_t *handle, struct buffer_head *bh, int credits)
+journal_release_buffer(handle_t *handle, struct buffer_head *bh)
 {
 	BUFFER_TRACE(bh, "entry");
-	handle->h_buffer_credits += credits;
 }
 
 /** 
@@ -1203,6 +1187,7 @@
 	transaction_t *transaction = handle->h_transaction;
 	journal_t *journal = transaction->t_journal;
 	struct journal_head *jh;
+	int drop_reserve = 0;
 	int err = 0;
 x 	BUFFER_TRACE(bh, "entry");
@@ -1222,6 +1207,12 @@
 		goto not_jbd;
 	}
 
+	/*
+	 * The buffer's going from the transaction, we must drop
+	 * all references -bzzz
+	 */x+	jh->b_modified = 0;
+
 	if (jh->b_transaction == handle->h_transaction) {
 		J_ASSERT_JH(jh, !jh->b_frozen_data);
 
@@ -1234,6 +1225,7 @@
 		JBUFFER_TRACE(jh, "belongs to current transaction: unfile");
 
 		__journal_unfile_buffer(jh);
+		drop_reserve = 1;
 
 		/* 
 		 * We are no longer going to journal this buffer.
@@ -1256,7 +1248,7 @@
 				spin_unlock(&journal->j_list_lock);
 				jbd_unlock_bh_state(bh);
 				__bforget(bh);
-				return 0;
+				goto drop;
 			}
 		}
 	} else if (jh->b_transaction) {
@@ -1271,6 +1263,7 @@
 		if (jh->b_next_transaction) {
 			J_ASSERT(jh->b_next_transaction == transaction);
 			jh->b_next_transaction = NULL;
+			drop_reserve = 1;
 		}
 	}
 
@@ -1278,6 +1271,11 @@
 	spin_unlock(&journal->j_list_lock);
 	jbd_unlock_bh_state(bh);
 	__brelse(bh);
+drop:
+	if (drop_reserve) {
+		/* no need to reserve log space for this block -bzzz */x+		handle->h_buffer_credits++;
+	}
 	return err;
 }
 
diff -Nru a/fs/jfs/inode.c b/fs/jfs/inode.c
--- a/fs/jfs/inode.c	2004-11-17 10:51:26 -08:00
+++ b/fs/jfs/inode.c	2005-03-07 20:41:41 -08:00
@@ -286,7 +286,7 @@
 x static int jfs_writepage(struct page *page, struct writeback_control *wbc)
 {
-	return block_write_full_page(page, jfs_get_block, wbc);
+	return nobh_writepage(page, jfs_get_block, wbc);
 }
 
 static int jfs_writepages(struct address_space *mapping,
diff -Nru a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
--- a/fs/jfs/jfs_logmgr.c	2005-01-20 21:02:13 -08:00
+++ b/fs/jfs/jfs_logmgr.c	2005-01-24 07:09:26 -08:00
@@ -67,6 +67,7 @@
 #include <linux/buffer_head.h>		/* for sync_blockdev() */x #include <linux/bio.h>
 #include <linux/suspend.h>
+#include <linux/delay.h>
 #include "jfs_incore.h"
 #include "jfs_filsys.h"
 #include "jfs_metapage.h"
@@ -1612,8 +1613,7 @@
 	 */x 	if ((!list_empty(&log->cqueue)) || !list_empty(&log->synclist)) {
 		for (i = 0; i < 800; i++) {	/* Too much? */x-			current->state = TASK_INTERRUPTIBLE;
-			schedule_timeout(HZ / 4);
+			msleep(250);
 			if (list_empty(&log->cqueue) &&
 			    list_empty(&log->synclist))
 				break;
diff -Nru a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
--- a/fs/jfs/jfs_metapage.c	2005-01-20 21:02:13 -08:00
+++ b/fs/jfs/jfs_metapage.c	2005-01-24 07:09:26 -08:00
@@ -21,6 +21,7 @@
 #include <linux/init.h>
 #include <linux/buffer_head.h>
 #include <linux/mempool.h>
+#include <linux/delay.h>
 #include "jfs_incore.h"
 #include "jfs_superblock.h"
 #include "jfs_filsys.h"
@@ -242,14 +243,14 @@
 	mp = search_hash(hash_ptr, mapping, lblock);
 	if (mp) {
 	      page_found:
-		mp->count++;
-		lock_metapage(mp);
-		spin_unlock(&meta_lock);
 		if (test_bit(META_stale, &mp->flag)) {
-			release_metapage(mp);
-			yield();	/* Let other waiters release it, too */x+			spin_unlock(&meta_lock);
+			msleep(1);
 			goto again;
 		}
+		mp->count++;
+		lock_metapage(mp);
+		spin_unlock(&meta_lock);
 		if (test_bit(META_discard, &mp->flag)) {
 			if (!new) {
 				jfs_error(inode->i_sb,
@@ -461,7 +462,6 @@
 	}
 
 	if (mp->page) {
-		/* Releasing spinlock, we have to check mp->count later */x 		set_bit(META_stale, &mp->flag);
 		spin_unlock(&meta_lock);
 		kunmap(mp->page);
@@ -498,12 +498,6 @@
 		list_del(&mp->synclist);
 		LOGSYNC_UNLOCK(log);
 	}
-	if (mp->count) {
-		/* Someone else is trying to get this metpage */x-		unlock_metapage(mp);
-		spin_unlock(&meta_lock);
-		return;
-	}
 	remove_from_hash(mp, meta_hash(mp->mapping, mp->index));
 	spin_unlock(&meta_lock);
 
@@ -532,12 +526,8 @@
 		mp = search_hash(hash_ptr, mapping, lblock);
 		if (mp) {
 			if (test_bit(META_stale, &mp->flag)) {
-				/* Racing with release_metapage */x-				mp->count++;
-				lock_metapage(mp);
 				spin_unlock(&meta_lock);
-				/* racing release_metapage should be done now */x-				release_metapage(mp);
+				msleep(1);
 				goto again;
 			}
 
diff -Nru a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
--- a/fs/jfs/jfs_txnmgr.c	2005-01-20 21:02:13 -08:00
+++ b/fs/jfs/jfs_txnmgr.c	2005-02-15 13:46:55 -08:00
@@ -93,15 +93,15 @@
 } TxStat;
 #endif
 
-static int nTxBlock = 512;	/* number of transaction blocks */x+static int nTxBlock = -1;	/* number of transaction blocks */x module_param(nTxBlock, int, 0);
 MODULE_PARM_DESC(nTxBlock,
-		 "Number of transaction blocks (default:512, max:65536)");
+		 "Number of transaction blocks (max:65536)");
 
-static int nTxLock = 4096;	/* number of transaction locks */x+static int nTxLock = -1;	/* number of transaction locks */x module_param(nTxLock, int, 0);
 MODULE_PARM_DESC(nTxLock,
-		 "Number of transaction locks (default:4096, max:65536)");
+		 "Number of transaction locks (max:65536)");
 
 struct tblock *TxBlock;	        /* transaction block table */
 static int TxLockLWM;		/* Low water mark for number of txLocks used */x@@ -124,6 +124,7 @@
 x DECLARE_WAIT_QUEUE_HEAD(jfs_sync_thread_wait);
 DECLARE_WAIT_QUEUE_HEAD(jfs_commit_thread_wait);
+static int jfs_commit_thread_waking;
 
 /*
  * Retry logic exist outside these macros to protect from spurrious wakeups.
@@ -249,6 +250,25 @@
 int txInit(void)
 {
 	int k, size;
+	struct sysinfo si;
+
+	/* Set defaults for nTxLock and nTxBlock if unset */x+
+	if (nTxLock == -1) {
+		if (nTxBlock == -1) {
+			/* Base default on memory size */x+			si_meminfo(&si);
+			if (si.totalram > (256 * 1024)) /* 1 GB */x+				nTxLock = 64 * 1024;
+			else
+				nTxLock = si.totalram >> 2;
+		} else if (nTxBlock > (8 * 1024))
+			nTxLock = 64 * 1024;
+		else
+			nTxLock = nTxBlock << 3;
+	}
+	if (nTxBlock == -1)
+		nTxBlock = nTxLock >> 3;x 
 	/* Verify tunable parameters */x 	if (nTxBlock < 16)
@@ -259,6 +279,9 @@
 		nTxLock = 256;	/* No one should set it this low */x 	if (nTxLock > 65536)
 		nTxLock = 65536;
+
+	printk(KERN_INFO "JFS: nTxBlock = %d, nTxLock = %d\n",
+	       nTxBlock, nTxLock);
 	/*
 	 * initialize transaction block (tblock) table
 	 *
@@ -266,8 +289,8 @@
 	 * tid = 0 is reserved.
 	 */x 	TxLockLWM = (nTxLock * 4) / 10;
-	TxLockHWM = (nTxLock * 8) / 10;
-	TxLockVHWM = (nTxLock * 9) / 10;
+	TxLockHWM = (nTxLock * 7) / 10;
+	TxLockVHWM = (nTxLock * 8) / 10;
 
 	size = sizeof(struct tblock) * nTxBlock;x 	TxBlock = (struct tblock *) vmalloc(size);
@@ -2732,6 +2755,7 @@
 x 	do {
 		LAZY_LOCK(flags);
+		jfs_commit_thread_waking = 0;	/* OK to wake another thread */x 		while (!list_empty(&TxAnchor.unlock_queue)) {
 			WorkDone = 0;
 			list_for_each_entry(tblk, &TxAnchor.unlock_queue,
@@ -2804,10 +2828,13 @@
 	list_add_tail(&tblk->cqueue, &TxAnchor.unlock_queue);
 	/*
 	 * Don't wake up a commit thread if there is already one servicingx-	 * this superblock.
+	 * this superblock, or if the last one we woke up hasn't started yet.
 	 */x-	if (!(JFS_SBI(tblk->sb)->commit_state & IN_LAZYCOMMIT))
+	if (!(JFS_SBI(tblk->sb)->commit_state & IN_LAZYCOMMIT) &&
+	    !jfs_commit_thread_waking) {
+		jfs_commit_thread_waking = 1;
 		wake_up(&jfs_commit_thread_wait);
+	}
 	LAZY_UNLOCK(flags);
 }
 
diff -Nru a/fs/jfs/super.c b/fs/jfs/super.c
--- a/fs/jfs/super.c	2005-01-04 18:48:14 -08:00
+++ b/fs/jfs/super.c	2005-02-18 14:41:05 -08:00
@@ -235,7 +235,7 @@
 static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
 			 int *flag)
 {
-	void *nls_map = NULL;
+	void *nls_map = (void *)-1;	/* -1: no change;  NULL: none */
 	char *p;
 	struct jfs_sb_info *sbi = JFS_SBI(sb);
 
@@ -263,12 +263,17 @@
 			/* Don't do anything ;-) */x 			break;
 		case Opt_iocharset:
-			if (nls_map)	/* specified iocharset twice! */x+			if (nls_map && nls_map != (void *) -1)
 				unload_nls(nls_map);
-			nls_map = load_nls(args[0].from);
-			if (!nls_map) {
-				printk(KERN_ERR "JFS: charset not found\n");
-				goto cleanup;
+			if (!strcmp(args[0].from, "none"))
+				nls_map = NULL;
+			else {
+				nls_map = load_nls(args[0].from);
+				if (!nls_map) {
+					printk(KERN_ERR
+					       "JFS: charset not found\n");
+					goto cleanup;
+				}
 			}x 			break;
 		case Opt_resize:
@@ -318,7 +323,7 @@
 		}
 	}
 
-	if (nls_map) {
+	if (nls_map != (void *) -1) {
 		/* Discard old (if remount) */x 		if (sbi->nls_tab)
 			unload_nls(sbi->nls_tab);
@@ -327,7 +332,7 @@
 	return 1;
 
 cleanup:
-	if (nls_map)
+	if (nls_map && nls_map != (void *) -1)
 		unload_nls(nls_map);
 	return 0;
 }
@@ -622,7 +627,7 @@
 x 	if (commit_threads < 1)
 		commit_threads = num_online_cpus();
-	else if (commit_threads > MAX_COMMIT_THREADS)
+	if (commit_threads > MAX_COMMIT_THREADS)
 		commit_threads = MAX_COMMIT_THREADS;
 
 	for (i = 0; i < commit_threads; i++) {
diff -Nru a/fs/lockd/svc.c b/fs/lockd/svc.c
--- a/fs/lockd/svc.c	2005-01-07 21:44:27 -08:00
+++ b/fs/lockd/svc.c	2005-03-04 22:32:49 -08:00
@@ -403,6 +403,38 @@
 	return 0;							\
 }
 
+static inline int is_callback(u32 proc)
+{
+	return proc == NLMPROC_GRANTED
+		|| proc == NLMPROC_GRANTED_MSG
+		|| proc == NLMPROC_TEST_RES
+		|| proc == NLMPROC_LOCK_RES
+		|| proc == NLMPROC_CANCEL_RES
+		|| proc == NLMPROC_UNLOCK_RES
+		|| proc == NLMPROC_NSM_NOTIFY;
+}
+
+
+static int lockd_authenticate(struct svc_rqst *rqstp)
+{
+	rqstp->rq_client = NULL;
+	switch (rqstp->rq_authop->flavour) {
+		case RPC_AUTH_NULL:
+		case RPC_AUTH_UNIX:
+			if (rqstp->rq_proc == 0)
+				return SVC_OK;
+			if (is_callback(rqstp->rq_proc)) {
+				/* Leave it to individual procedures to
+				 * call nlmsvc_lookup_host(rqstp)
+				 */
+				return SVC_OK;
+			}
+			return svc_set_client(rqstp);
+	}
+	return SVC_DENIED;
+}
+
+
 param_set_min_max(port, int, simple_strtol, 0, 65535)
 param_set_min_max(grace_period, unsigned long, simple_strtoul,
 		  nlm_grace_period_min, nlm_grace_period_max)
@@ -483,4 +515,5 @@
 	.pg_name		= "lockd",		/* service name */x 	.pg_class		= "nfsd",		/* share authentication with nfsd */x 	.pg_stats		= &nlmsvc_stats,	/* stats table */
+	.pg_authenticate = &lockd_authenticate	/* export authentication */x };
diff -Nru a/fs/mpage.c b/fs/mpage.c
--- a/fs/mpage.c	2004-08-24 02:08:42 -07:00
+++ b/fs/mpage.c	2005-03-07 20:41:41 -08:00
@@ -386,8 +386,9 @@
  * just allocate full-size (16-page) BIOs.
  */x static struct bio *
-mpage_writepage(struct bio *bio, struct page *page, get_block_t get_block,
-	sector_t *last_block_in_bio, int *ret, struct writeback_control *wbc)
+__mpage_writepage(struct bio *bio, struct page *page, get_block_t get_block,
+	sector_t *last_block_in_bio, int *ret, struct writeback_control *wbc,
+	writepage_t writepage_fn)
 {
 	struct address_space *mapping = page->mapping;
 	struct inode *inode = page->mapping->host;
@@ -580,7 +581,13 @@
 confused:
 	if (bio)
 		bio = mpage_bio_submit(WRITE, bio);
-	*ret = page->mapping->a_ops->writepage(page, wbc);
+
+	if (writepage_fn) {
+		*ret = (*writepage_fn)(page, wbc);
+	} else {
+		*ret = -EAGAIN;
+		goto out;
+	}
 	/*
 	 * The caller has a ref on the inode, so *mapping is stable
 	 */x@@ -706,8 +713,9 @@
 							&mapping->flags);
 				}
 			} else {
-				bio = mpage_writepage(bio, page, get_block,
-						&last_block_in_bio, &ret, wbc);
+				bio = __mpage_writepage(bio, page, get_block,
+						&last_block_in_bio, &ret, wbc,
+						page->mapping->a_ops->writepage);
 			}
 			if (ret || (--(wbc->nr_to_write) <= 0))
 				done = 1;
@@ -735,3 +743,19 @@
 	return ret;
 }
 EXPORT_SYMBOL(mpage_writepages);
+
+int mpage_writepage(struct page *page, get_block_t get_block,
+	struct writeback_control *wbc)
+{
+	int ret = 0;
+	struct bio *bio;
+	sector_t last_block_in_bio = 0;
+
+	bio = __mpage_writepage(NULL, page, get_block,
+			&last_block_in_bio, &ret, wbc, NULL);
+	if (bio)
+		mpage_bio_submit(WRITE, bio);
+
+	return ret;
+}
+EXPORT_SYMBOL(mpage_writepage);
diff -Nru a/fs/namei.c b/fs/namei.c
--- a/fs/namei.c	2005-01-20 21:00:21 -08:00
+++ b/fs/namei.c	2005-03-07 20:41:36 -08:00
@@ -1685,17 +1685,13 @@
 void dentry_unhash(struct dentry *dentry)
 {
 	dget(dentry);
-	spin_lock(&dcache_lock);
-	switch (atomic_read(&dentry->d_count)) {
-	default:
-		spin_unlock(&dcache_lock);
+	if (atomic_read(&dentry->d_count))
 		shrink_dcache_parent(dentry);
-		spin_lock(&dcache_lock);
-		if (atomic_read(&dentry->d_count) != 2)
-			break;
-	case 2:x+	spin_lock(&dcache_lock);
+	spin_lock(&dentry->d_lock);
+	if (atomic_read(&dentry->d_count) == 2)
 		__d_drop(dentry);
-	}
+	spin_unlock(&dentry->d_lock);
 	spin_unlock(&dcache_lock);
 }
 
diff -Nru a/fs/ncpfs/ncpsign_kernel.c b/fs/ncpfs/ncpsign_kernel.c
--- a/fs/ncpfs/ncpsign_kernel.c	2002-09-20 13:18:05 -07:00
+++ b/fs/ncpfs/ncpsign_kernel.c	2005-03-07 20:41:50 -08:00
@@ -11,10 +11,9 @@
 x #include <linux/string.h>
 #include <linux/ncp.h>
+#include <linux/bitops.h>
 #include "ncpsign_kernel.h"
 
-#define rol32(i,c) (((((i)&0xffffffff)<<c)&0xffffffff)| \
-                    (((i)&0xffffffff)>>(32-c)))
 /* i386: 32-bit, little endian, handles mis-alignment */x #ifdef __i386__x #define GET_LE32(p) (*(int *)(p))
diff -Nru a/fs/nfs/callback.c b/fs/nfs/callback.c
--- a/fs/nfs/callback.c	2004-07-18 21:11:59 -07:00
+++ b/fs/nfs/callback.c	2005-03-04 22:32:49 -08:00
@@ -139,133 +139,10 @@
 	return ret;
 }
 
-/*
- * AUTH_NULL authentication
- */
-static int nfs_callback_null_accept(struct svc_rqst *rqstp, u32 *authp)
-{
-	struct kvec    *argv = &rqstp->rq_arg.head[0];
-	struct kvec    *resv = &rqstp->rq_res.head[0];
-
-	if (argv->iov_len < 3*4)
-		return SVC_GARBAGE;
-
-	if (svc_getu32(argv) != 0) {
-		dprintk("svc: bad null cred\n");
-		*authp = rpc_autherr_badcred;
-		return SVC_DENIED;
-	}
-	if (svc_getu32(argv) != RPC_AUTH_NULL || svc_getu32(argv) != 0) {
-		dprintk("svc: bad null verf\n");
-		 *authp = rpc_autherr_badverf;
-		 return SVC_DENIED;
-	}
-
-	/* Signal that mapping to nobody uid/gid is required */x-	rqstp->rq_cred.cr_uid = (uid_t) -1;
-	rqstp->rq_cred.cr_gid = (gid_t) -1;
-	rqstp->rq_cred.cr_group_info = groups_alloc(0);
-	if (rqstp->rq_cred.cr_group_info == NULL)
-		return SVC_DROP; /* kmalloc failure - client must retry */x-
-	/* Put NULL verifier */x-	svc_putu32(resv, RPC_AUTH_NULL);
-	svc_putu32(resv, 0);
-	dprintk("%s: success, returning %d!\n", __FUNCTION__, SVC_OK);
-	return SVC_OK;
-}
-
-static int nfs_callback_null_release(struct svc_rqst *rqstp)
-{
-	if (rqstp->rq_cred.cr_group_info)
-		put_group_info(rqstp->rq_cred.cr_group_info);
-	rqstp->rq_cred.cr_group_info = NULL;
-	return 0; /* don't drop */x-}
-
-static struct auth_ops nfs_callback_auth_null = {
-	.name = "null",
-	.flavour = RPC_AUTH_NULL,
-	.accept = nfs_callback_null_accept,
-	.release = nfs_callback_null_release,
-};
-
-/*
- * AUTH_SYS authentication
- */
-static int nfs_callback_unix_accept(struct svc_rqst *rqstp, u32 *authp)
-{
-	struct kvec    *argv = &rqstp->rq_arg.head[0];
-	struct kvec    *resv = &rqstp->rq_res.head[0];
-	struct svc_cred *cred = &rqstp->rq_cred;
-	u32 slen, i;
-	int len = argv->iov_len;
-
-	dprintk("%s: start\n", __FUNCTION__);
-	cred->cr_group_info = NULL;
-	rqstp->rq_client = NULL;
-	if ((len -= 3*4) < 0)
-		return SVC_GARBAGE;
-
-	/* Get length, time stamp and machine name */x-	svc_getu32(argv);x-	svc_getu32(argv);x-	slen = XDR_QUADLEN(ntohl(svc_getu32(argv)));
-	if (slen > 64 || (len -= (slen + 3)*4) < 0)
-		goto badcred;
-	argv->iov_base = (void*)((u32*)argv->iov_base + slen);
-	argv->iov_len -= slen*4;
-
-	cred->cr_uid = ntohl(svc_getu32(argv));
-	cred->cr_gid = ntohl(svc_getu32(argv));
-	slen = ntohl(svc_getu32(argv));
-	if (slen > 16 || (len -= (slen + 2)*4) < 0)
-		goto badcred;
-	cred->cr_group_info = groups_alloc(slen);
-	if (cred->cr_group_info == NULL)
-		return SVC_DROP;x-	for (i = 0; i < slen; i++)
-		GROUP_AT(cred->cr_group_info, i) = ntohl(svc_getu32(argv));
-
-	if (svc_getu32(argv) != RPC_AUTH_NULL || svc_getu32(argv) != 0) {
-		*authp = rpc_autherr_badverf;
-		return SVC_DENIED;
-	}
-	/* Put NULL verifier */x-	svc_putu32(resv, RPC_AUTH_NULL);
-	svc_putu32(resv, 0);
-	dprintk("%s: success, returning %d!\n", __FUNCTION__, SVC_OK);
-	return SVC_OK;
-badcred:
-	*authp = rpc_autherr_badcred;
-	return SVC_DENIED;
-}
-
-static int nfs_callback_unix_release(struct svc_rqst *rqstp)
-{
-	if (rqstp->rq_cred.cr_group_info)
-		put_group_info(rqstp->rq_cred.cr_group_info);
-	rqstp->rq_cred.cr_group_info = NULL;
-	return 0;x-}
-
-static struct auth_ops nfs_callback_auth_unix = {
-	.name = "unix",
-	.flavour = RPC_AUTH_UNIX,
-	.accept = nfs_callback_unix_accept,
-	.release = nfs_callback_unix_release,
-};
-
-/*
- * Hook the authentication protocol
- */
-static int nfs_callback_auth(struct svc_rqst *rqstp, u32 *authp)
+static int nfs_callback_authenticate(struct svc_rqst *rqstp)
 {
 	struct in_addr *addr = &rqstp->rq_addr.sin_addr;
 	struct nfs4_client *clp;
-	struct kvec *argv = &rqstp->rq_arg.head[0];
-	int flavour;
-	int retval;
 
 	/* Don't talk to strangers */x 	clp = nfs4_find_client(addr);
@@ -273,34 +150,19 @@
 		return SVC_DROP;x 	dprintk("%s: %u.%u.%u.%u NFSv4 callback!\n", __FUNCTION__, NIPQUAD(addr));
 	nfs4_put_client(clp);
-	flavour = ntohl(svc_getu32(argv));
-	switch(flavour) {
+	switch (rqstp->rq_authop->flavour) {
 		case RPC_AUTH_NULL:
-			if (rqstp->rq_proc != CB_NULL) {
-				*authp = rpc_autherr_tooweak;
-				retval = SVC_DENIED;
-				break;
-			}
-			rqstp->rq_authop = &nfs_callback_auth_null;
-			retval = nfs_callback_null_accept(rqstp, authp);
+			if (rqstp->rq_proc != CB_NULL)
+				return SVC_DENIED;
 			break;
 		case RPC_AUTH_UNIX:
-			/* Eat the authentication flavour */x-			rqstp->rq_authop = &nfs_callback_auth_unix;
-			retval = nfs_callback_unix_accept(rqstp, authp);
 			break;
+		case RPC_AUTH_GSS:
+			/* FIXME: RPCSEC_GSS handling? */x 		default:
-			/* FIXME: need to add RPCSEC_GSS upcalls */x-#if 0
-			svc_ungetu32(argv);x-			retval = svc_authenticate(rqstp, authp);
-#else
-			*authp = rpc_autherr_rejectedcred;
-			retval = SVC_DENIED;
-#endif
+			return SVC_DENIED;
 	}
-	dprintk("%s: flavour %d returning error %d\n", __FUNCTION__, flavour, retval);
-	return retval;
+	return SVC_OK;
 }
 
 /*
@@ -321,5 +183,5 @@
 	.pg_name = "NFSv4 callback",			/* service name */x 	.pg_class = "nfs",				/* authentication class */x 	.pg_stats = &nfs4_callback_stats,
-	.pg_authenticate = nfs_callback_auth,
+	.pg_authenticate = nfs_callback_authenticate,x };
diff -Nru a/fs/nfsd/export.c b/fs/nfsd/export.c
--- a/fs/nfsd/export.c	2005-01-11 14:23:08 -08:00
+++ b/fs/nfsd/export.c	2005-03-04 22:32:50 -08:00
@@ -79,9 +79,9 @@
 	}
 }
 
-void expkey_request(struct cache_detail *cd,
-		    struct cache_head *h,
-		    char **bpp, int *blen)
+static void expkey_request(struct cache_detail *cd,
+			   struct cache_head *h,
+			   char **bpp, int *blen)
 {
 	/* client fsidtype \xfsid */x 	struct svc_expkey *ek = container_of(h, struct svc_expkey, h);
@@ -95,7 +95,7 @@
 }
 
 static struct svc_expkey *svc_expkey_lookup(struct svc_expkey *, int);
-int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
+static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
 {
 	/* client fsidtype fsid [path] */
 	char *buf;
@@ -284,9 +284,9 @@
 	}
 }
 
-void svc_export_request(struct cache_detail *cd,
-			struct cache_head *h,
-			char **bpp, int *blen)
+static void svc_export_request(struct cache_detail *cd,
+			       struct cache_head *h,
+			       char **bpp, int *blen)
 {
 	/*  client path */x 	struct svc_export *exp = container_of(h, struct svc_export, h);
@@ -340,7 +340,7 @@
 
 }
 
-int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
+static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
 {
 	/* client path expiry [flags anonuid anongid fsid] */
 	char *buf;
@@ -510,8 +510,8 @@
 	return ek;
 }
 
-int exp_set_key(svc_client *clp, int fsid_type, u32 *fsidv, 
-		struct svc_export *exp)
+static int exp_set_key(svc_client *clp, int fsid_type, u32 *fsidv,
+		       struct svc_export *exp)
 {
 	struct svc_expkey key, *ek;
 
@@ -999,7 +999,7 @@
 	exp_readunlock();
 }
 
-struct flags {
+static struct flags {
 	int flag;
 	char *name[2];
 } expflags[] = {
diff -Nru a/fs/nfsd/lockd.c b/fs/nfsd/lockd.c
--- a/fs/nfsd/lockd.c	2004-08-23 01:15:19 -07:00
+++ b/fs/nfsd/lockd.c	2005-03-04 22:32:50 -08:00
@@ -60,7 +60,7 @@
 	fput(filp);
 }
 
-struct nlmsvc_binding		nfsd_nlm_ops = {
+static struct nlmsvc_binding	nfsd_nlm_ops = {
 	.fopen		= nlm_fopen,		/* open file for locking */x 	.fclose		= nlm_fclose,		/* close file */x };
diff -Nru a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
--- a/fs/nfsd/nfs3xdr.c	2005-01-07 21:44:30 -08:00
+++ b/fs/nfsd/nfs3xdr.c	2005-03-04 22:32:48 -08:00
@@ -801,6 +801,11 @@
 	if (isdotent(name, namlen)) {
 		if (namlen == 2) {
 			dchild = dget_parent(dparent);
+			if (dchild == dparent) {
+				/* filesystem root - cannot return filehandle for ".." */
+				dput(dchild);
+				return 1;
+			}
 		} else
 			dchild = dget(dparent);
 	} else
diff -Nru a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
--- a/fs/nfsd/nfscache.c	2005-01-20 21:02:13 -08:00
+++ b/fs/nfsd/nfscache.c	2005-03-04 22:32:50 -08:00
@@ -15,6 +15,7 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/spinlock.h>
+#include <linux/list.h>
 
 #include <linux/sunrpc/svc.h>
 #include <linux/nfsd/nfsd.h>
@@ -30,15 +31,8 @@
 #define HASHSIZE		64
 #define REQHASH(xid)		((((xid) >> 24) ^ (xid)) & (HASHSIZE-1))
 
-struct nfscache_head {
-	struct svc_cacherep *	next;
-	struct svc_cacherep *	prev;
-};
-
-static struct nfscache_head *	hash_list;
-static struct svc_cacherep *	lru_head;
-static struct svc_cacherep *	lru_tail;
-static struct svc_cacherep *	nfscache;
+static struct hlist_head *	hash_list;
+static struct list_head 	lru_head;
 static int			cache_disabled = 1;
 
 static int	nfsd_cache_append(struct svc_rqst *rqstp, struct kvec *vec);
@@ -54,46 +48,32 @@
 nfsd_cache_init(void)
 {
 	struct svc_cacherep	*rp;
-	struct nfscache_head	*rh;
-	size_t			i;
-	unsigned long		order;
+	int			i;
 
-
-	i = CACHESIZE * sizeof (struct svc_cacherep);x-	for (order = 0; (PAGE_SIZE << order) < i; order++)
-		;x-	nfscache = (struct svc_cacherep *)
-		__get_free_pages(GFP_KERNEL, order);
-	if (!nfscache) {
-		printk (KERN_ERR "nfsd: cannot allocate %Zd bytes for reply cache\n", i);
-		return;
+	INIT_LIST_HEAD(&lru_head);
+	i = CACHESIZE;
+	while(i) {
+		rp = kmalloc(sizeof(*rp), GFP_KERNEL);
+		if (!rp) break;
+		list_add(&rp->c_lru, &lru_head);
+		rp->c_state = RC_UNUSED;
+		rp->c_type = RC_NOCACHE;
+		INIT_HLIST_NODE(&rp->c_hash);
+		i--;
 	}
-	memset(nfscache, 0, i);
 
-	i = HASHSIZE * sizeof (struct nfscache_head);
-	hash_list = kmalloc (i, GFP_KERNEL);
+	if (i)
+		printk (KERN_ERR "nfsd: cannot allocate all %d cache entries, only got %d\n",
+			CACHESIZE, CACHESIZE-i);
+
+	hash_list = kmalloc (HASHSIZE * sizeof(struct hlist_head), GFP_KERNEL);
 	if (!hash_list) {
-		free_pages ((unsigned long)nfscache, order);
-		nfscache = NULL;
-		printk (KERN_ERR "nfsd: cannot allocate %Zd bytes for hash list\n", i);
+		nfsd_cache_shutdown();
+		printk (KERN_ERR "nfsd: cannot allocate %Zd bytes for hash list\n",
+			HASHSIZE * sizeof(struct hlist_head));
 		return;
 	}
-
-	for (i = 0, rh = hash_list; i < HASHSIZE; i++, rh++)
-		rh->next = rh->prev = (struct svc_cacherep *) rh;
-
-	for (i = 0, rp = nfscache; i < CACHESIZE; i++, rp++) {
-		rp->c_state = RC_UNUSED;
-		rp->c_type = RC_NOCACHE;
-		rp->c_hash_next =
-		rp->c_hash_prev = rp;
-		rp->c_lru_next = rp + 1;
-		rp->c_lru_prev = rp - 1;
-	}
-	lru_head = nfscache;
-	lru_tail = nfscache + CACHESIZE - 1;
-	lru_head->c_lru_prev = NULL;
-	lru_tail->c_lru_next = NULL;
+	memset(hash_list, 0, HASHSIZE * sizeof(struct hlist_head));
 
 	cache_disabled = 0;
 }
@@ -102,48 +82,30 @@
 nfsd_cache_shutdown(void)
 {
 	struct svc_cacherep	*rp;
-	size_t			i;
-	unsigned long		order;
 
-	for (rp = lru_head; rp; rp = rp->c_lru_next) {
+	while (!list_empty(&lru_head)) {
+		rp = list_entry(lru_head.next, struct svc_cacherep, c_lru);
 		if (rp->c_state == RC_DONE && rp->c_type == RC_REPLBUFF)
 			kfree(rp->c_replvec.iov_base);
+		list_del(&rp->c_lru);
+		kfree(rp);
 	}
 
 	cache_disabled = 1;
 
-	i = CACHESIZE * sizeof (struct svc_cacherep);x-	for (order = 0; (PAGE_SIZE << order) < i; order++)
-		;x-	free_pages ((unsigned long)nfscache, order);
-	nfscache = NULL;
-	kfree (hash_list);
+	if (hash_list)
+		kfree (hash_list);
 	hash_list = NULL;
 }
 
 /*
- * Move cache entry to front of LRU list
+ * Move cache entry to end of LRU list
  */x static void
-lru_put_front(struct svc_cacherep *rp)
+lru_put_end(struct svc_cacherep *rp)
 {
-	struct svc_cacherep	*prev = rp->c_lru_prev,
-				*next = rp->c_lru_next;
-
-	if (prev)
-		prev->c_lru_next = next;
-	else
-		lru_head = next;
-	if (next)
-		next->c_lru_prev = prev;
-	else
-		lru_tail = prev;
-
-	rp->c_lru_next = lru_head;
-	rp->c_lru_prev = NULL;
-	if (lru_head)
-		lru_head->c_lru_prev = rp;
-	lru_head = rp;
+	list_del(&rp->c_lru);
+	list_add_tail(&rp->c_lru, &lru_head);
 }
 
 /*
@@ -152,17 +114,8 @@
 static void
 hash_refile(struct svc_cacherep *rp)
 {
-	struct svc_cacherep	*prev = rp->c_hash_prev,
-				*next = rp->c_hash_next;
-	struct nfscache_head	*head = hash_list + REQHASH(rp->c_xid);
-
-	prev->c_hash_next = next;
-	next->c_hash_prev = prev;
-
-	rp->c_hash_next = head->next;
-	rp->c_hash_prev = (struct svc_cacherep *) head;
-	head->next->c_hash_prev = rp;
-	head->next = rp;
+	hlist_del_init(&rp->c_hash);
+	hlist_add_head(&rp->c_hash, hash_list + REQHASH(rp->c_xid));
 }
 
 /*
@@ -173,7 +126,9 @@
 int
 nfsd_cache_lookup(struct svc_rqst *rqstp, int type)
 {
-	struct svc_cacherep	*rh, *rp;
+	struct hlist_node	*hn;
+	struct hlist_head 	*rh;
+	struct svc_cacherep	*rp;
 	u32			xid = rqstp->rq_xid,
 				proto =  rqstp->rq_prot,
 				vers = rqstp->rq_vers,
@@ -190,8 +145,8 @@
 	spin_lock(&cache_lock);
 	rtn = RC_DOIT;
 
-	rp = rh = (struct svc_cacherep *) &hash_list[REQHASH(xid)];
-	while ((rp = rp->c_hash_next) != rh) {
+	rh = &hash_list[REQHASH(xid)];
+	hlist_for_each_entry(rp, hn, rh, c_hash) {
 		if (rp->c_state != RC_UNUSED &&
 		    xid == rp->c_xid && proc == rp->c_proc &&
 		    proto == rp->c_prot && vers == rp->c_vers &&
@@ -206,7 +161,7 @@
 	/* This loop shouldn't take more than a few iterations normally */x 	{
 	int	safe = 0;
-	for (rp = lru_tail; rp; rp = rp->c_lru_prev) {
+	list_for_each_entry(rp, &lru_head, c_lru) {
 		if (rp->c_state != RC_INPROG)
 			break;
 		if (safe++ > CACHESIZE) {
@@ -254,7 +209,7 @@
 	/* We found a matching entry which is either in progress or done. */x 	age = jiffies - rp->c_timestamp;
 	rp->c_timestamp = jiffies;
-	lru_put_front(rp);
+	lru_put_end(rp);
 
 	rtn = RC_DROPIT;
 	/* Request being processed or excessive rexmits */x@@ -343,7 +298,7 @@
 		break;
 	}
 	spin_lock(&cache_lock);
-	lru_put_front(rp);
+	lru_put_end(rp);
 	rp->c_secure = rqstp->rq_secure;
 	rp->c_type = cachetype;
 	rp->c_state = RC_DONE;
diff -Nru a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
--- a/fs/nfsd/nfsfh.c	2004-10-20 01:37:11 -07:00
+++ b/fs/nfsd/nfsfh.c	2005-03-04 22:32:50 -08:00
@@ -41,7 +41,7 @@
  * if not, require that we can walk up to exp->ex_dentry
  * doing some checks on the 'x' bits
  */x-int nfsd_acceptable(void *expv, struct dentry *dentry)
+static int nfsd_acceptable(void *expv, struct dentry *dentry)
 {
 	struct svc_export *exp = expv;
 	int rv;
@@ -280,8 +280,8 @@
  * an inode.  In this case a call to fh_update should be made
  * before the fh goes out on the wire ...
  */x-inline int _fh_update(struct dentry *dentry, struct svc_export *exp,
-		      __u32 *datap, int *maxsize)
+static inline int _fh_update(struct dentry *dentry, struct svc_export *exp,
+			     __u32 *datap, int *maxsize)
 {
 	struct export_operations *nop = exp->ex_mnt->mnt_sb->s_export_op;
 	
@@ -297,8 +297,9 @@
 /*
  * for composing old style file handles
  */x-inline void _fh_update_old(struct dentry *dentry, struct svc_export *exp,
-			   struct knfsd_fh *fh)
+static inline void _fh_update_old(struct dentry *dentry,
+				  struct svc_export *exp,
+				  struct knfsd_fh *fh)
 {
 	fh->ofh_ino = ino_t_to_u32(dentry->d_inode->i_ino);
 	fh->ofh_generation = dentry->d_inode->i_generation;
diff -Nru a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
--- a/fs/nfsd/nfssvc.c	2005-01-20 21:02:13 -08:00
+++ b/fs/nfsd/nfssvc.c	2005-03-04 22:32:50 -08:00
@@ -60,7 +60,7 @@
 	struct list_head 	list;
 	struct task_struct	*task;x };
-struct list_head nfsd_list = LIST_HEAD_INIT(nfsd_list);
+static struct list_head nfsd_list = LIST_HEAD_INIT(nfsd_list);
 
 /*
  * Maximum number of nfsd processesx@@ -378,4 +378,6 @@
 	.pg_name		= "nfsd",		/* program name */x 	.pg_class		= "nfsd",		/* authentication class */x 	.pg_stats		= &nfsd_svcstats,	/* version table */
+	.pg_authenticate	= &svc_set_client,	/* export authentication */x+x };
diff -Nru a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
--- a/fs/nfsd/vfs.c	2005-02-08 02:36:15 -08:00
+++ b/fs/nfsd/vfs.c	2005-03-04 22:32:50 -08:00
@@ -707,8 +707,8 @@
  * As this calls fsync (not fdatasync) there is no need for a write_inode
  * after it.
  */x-inline void nfsd_dosync(struct file *filp, struct dentry *dp, 
-			struct file_operations *fop)
+static inline void nfsd_dosync(struct file *filp, struct dentry *dp,
+			       struct file_operations *fop)
 {
 	struct inode *inode = dp->d_inode;
 	int (*fsync) (struct file *, struct dentry *, int);
@@ -720,7 +720,7 @@
 }
 	
 
-void
+static void
 nfsd_sync(struct file *filp)
 {
 	struct inode *inode = filp->f_dentry->d_inode;
@@ -730,7 +730,7 @@
 	up(&inode->i_sem);
 }
 
-void
+static void
 nfsd_sync_dir(struct dentry *dp)
 {
 	nfsd_dosync(NULL, dp, dp->d_inode->i_fop);
diff -Nru a/fs/partitions/msdos.c b/fs/partitions/msdos.c
--- a/fs/partitions/msdos.c	2004-11-09 12:43:17 -08:00
+++ b/fs/partitions/msdos.c	2005-03-07 20:41:42 -08:00
@@ -114,6 +114,9 @@
 		 */x 		for (i=0; i<4; i++, p++) {
 			u32 offs, size, next;
+
+			if (SYS_IND(p) == 0)
+				continue;
 			if (!NR_SECTS(p) || is_extended_partition(p))
 				continue;
 
@@ -430,6 +433,8 @@
 	for (slot = 1 ; slot <= 4 ; slot++, p++) {
 		u32 start = START_SECT(p)*sector_size;
 		u32 size = NR_SECTS(p)*sector_size;
+		if (SYS_IND(p) == 0)
+			continue;
 		if (!size)
 			continue;
 		if (is_extended_partition(p)) {
diff -Nru a/fs/proc/array.c b/fs/proc/array.c
--- a/fs/proc/array.c	2005-01-11 16:42:35 -08:00
+++ b/fs/proc/array.c	2005-03-07 20:41:53 -08:00
@@ -239,6 +239,8 @@
 {
 	sigset_t pending, shpending, blocked, ignored, caught;
 	int num_threads = 0;
+	unsigned long qsize = 0;
+	unsigned long qlim = 0;
 x 	sigemptyset(&pending);
 	sigemptyset(&shpending);
@@ -255,11 +257,14 @@
 		blocked = p->blocked;
 		collect_sigign_sigcatch(p, &ignored, &caught);
 		num_threads = atomic_read(&p->signal->count);
+		qsize = atomic_read(&p->user->sigpending);
+		qlim = p->signal->rlim[RLIMIT_SIGPENDING].rlim_cur;
 		spin_unlock_irq(&p->sighand->siglock);
 	}
 	read_unlock(&tasklist_lock);
 
 	buffer += sprintf(buffer, "Threads:\t%d\n", num_threads);
+	buffer += sprintf(buffer, "SigQ:\t%lu/%lu\n", qsize, qlim);
 
 	/* render them all */x 	buffer = render_sigset_t("SigPnd:\t", &pending, buffer);
@@ -317,6 +322,7 @@
 	unsigned long  min_flt = 0,  maj_flt = 0;
 	cputime_t cutime, cstime, utime, stime;
 	unsigned long rsslim = 0;
+	unsigned long it_real_value = 0;
 	struct task_struct *t;
 	char tcomm[sizeof(task->comm)];
 x@@ -372,6 +378,7 @@
 			utime = cputime_add(utime, task->signal->utime);
 			stime = cputime_add(stime, task->signal->stime);
 		}
+		it_real_value = task->signal->it_real_value;
 	}
 	ppid = pid_alive(task) ? task->group_leader->real_parent->tgid : 0;
 	read_unlock(&tasklist_lock);
@@ -420,7 +427,7 @@
 		priority,
 		nice,
 		num_threads,
-		jiffies_to_clock_t(task->it_real_value),
+		jiffies_to_clock_t(it_real_value),
 		start_time,
 		vsize,
 		mm ? mm->rss : 0, /* you might want to shift this left 3 */xdiff -Nru a/fs/proc/base.c b/fs/proc/base.c
--- a/fs/proc/base.c	2005-01-30 22:33:47 -08:00
+++ b/fs/proc/base.c	2005-03-07 20:41:40 -08:00
@@ -32,6 +32,7 @@
 #include <linux/mount.h>
 #include <linux/security.h>
 #include <linux/ptrace.h>
+#include <linux/seccomp.h>
 #include "internal.h"
 
 /*
@@ -49,6 +50,9 @@
 	PROC_TGID_TASK,
 	PROC_TGID_STATUS,
 	PROC_TGID_MEM,
+#ifdef CONFIG_SECCOMP
+	PROC_TGID_SECCOMP,
+#endif
 	PROC_TGID_CWD,
 	PROC_TGID_ROOT,
 	PROC_TGID_EXE,
@@ -80,6 +84,9 @@
 	PROC_TID_INO,
 	PROC_TID_STATUS,
 	PROC_TID_MEM,
+#ifdef CONFIG_SECCOMP
+	PROC_TID_SECCOMP,
+#endif
 	PROC_TID_CWD,
 	PROC_TID_ROOT,
 	PROC_TID_EXE,
@@ -130,6 +137,9 @@
 	E(PROC_TGID_STATM,     "statm",   S_IFREG|S_IRUGO),
 	E(PROC_TGID_MAPS,      "maps",    S_IFREG|S_IRUGO),
 	E(PROC_TGID_MEM,       "mem",     S_IFREG|S_IRUSR|S_IWUSR),
+#ifdef CONFIG_SECCOMP
+	E(PROC_TGID_SECCOMP,   "seccomp", S_IFREG|S_IRUSR|S_IWUSR),
+#endif
 	E(PROC_TGID_CWD,       "cwd",     S_IFLNK|S_IRWXUGO),
 	E(PROC_TGID_ROOT,      "root",    S_IFLNK|S_IRWXUGO),
 	E(PROC_TGID_EXE,       "exe",     S_IFLNK|S_IRWXUGO),
@@ -160,6 +170,9 @@
 	E(PROC_TID_STATM,      "statm",   S_IFREG|S_IRUGO),
 	E(PROC_TID_MAPS,       "maps",    S_IFREG|S_IRUGO),
 	E(PROC_TID_MEM,        "mem",     S_IFREG|S_IRUSR|S_IWUSR),
+#ifdef CONFIG_SECCOMP
+	E(PROC_TID_SECCOMP,    "seccomp", S_IFREG|S_IRUSR|S_IWUSR),
+#endif
 	E(PROC_TID_CWD,        "cwd",     S_IFLNK|S_IRWXUGO),
 	E(PROC_TID_ROOT,       "root",    S_IFLNK|S_IRWXUGO),
 	E(PROC_TID_EXE,        "exe",     S_IFLNK|S_IRWXUGO),
@@ -808,6 +821,61 @@
 };
 #endif
 
+#ifdef CONFIG_SECCOMP
+static ssize_t seccomp_read(struct file *file, char __user *buf,
+			    size_t count, loff_t *ppos)
+{
+	struct task_struct *tsk = proc_task(file->f_dentry->d_inode);
+	char __buf[20];
+	loff_t __ppos = *ppos;
+	size_t len;
+
+	/* no need to print the trailing zero, so use only len */
+	len = sprintf(__buf, "%u\n", tsk->seccomp.mode);
+	if (__ppos >= len)
+		return 0;x+	if (count > len - __ppos)
+		count = len - __ppos;x+	if (copy_to_user(buf, __buf + __ppos, count))
+		return -EFAULT;x+	*ppos = __ppos + count;
+	return count;
+}
+
+static ssize_t seccomp_write(struct file *file, const char __user *buf,
+			     size_t count, loff_t *ppos)
+{
+	struct task_struct *tsk = proc_task(file->f_dentry->d_inode);
+	char __buf[20], *end;
+	unsigned int seccomp_mode;
+
+	/* can set it only once to be even more secure */
+	if (unlikely(tsk->seccomp.mode))
+		return -EPERM;
+
+	memset(__buf, 0, sizeof(__buf));
+	count = min(count, sizeof(__buf) - 1);x+	if (copy_from_user(__buf, buf, count))
+		return -EFAULT;x+	seccomp_mode = simple_strtoul(__buf, &end, 0);
+	if (*end == '\n')
+		end++;
+	if (seccomp_mode && seccomp_mode <= NR_SECCOMP_MODES) {
+		tsk->seccomp.mode = seccomp_mode;
+		set_tsk_thread_flag(tsk, TIF_SECCOMP);
+	} else
+		return -EINVAL;
+	if (unlikely(!(end - __buf)))
+		return -EIO;
+	return end - __buf;
+}
+
+static struct file_operations proc_seccomp_operations = {
+	.read		= seccomp_read,
+	.write		= seccomp_write,
+};
+#endif /* CONFIG_SECCOMP */x+x static int proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
 	struct inode *inode = dentry->d_inode;
@@ -1443,6 +1511,12 @@
 			inode->i_op = &proc_mem_inode_operations;
 			inode->i_fop = &proc_mem_operations;
 			break;
+#ifdef CONFIG_SECCOMP
+		case PROC_TID_SECCOMP:
+		case PROC_TGID_SECCOMP:
+			inode->i_fop = &proc_seccomp_operations;
+			break;
+#endif /* CONFIG_SECCOMP */x 		case PROC_TID_MOUNTS:x 		case PROC_TGID_MOUNTS:x 			inode->i_fop = &proc_mounts_operations;
@@ -1630,11 +1704,15 @@
 	if (proc_dentry != NULL) {
 
 		spin_lock(&dcache_lock);
+		spin_lock(&proc_dentry->d_lock);
 		if (!d_unhashed(proc_dentry)) {
 			dget_locked(proc_dentry);
 			__d_drop(proc_dentry);
-		} else
+			spin_unlock(&proc_dentry->d_lock);
+		} else {
+			spin_unlock(&proc_dentry->d_lock);
 			proc_dentry = NULL;
+		}
 		spin_unlock(&dcache_lock);
 	}
 	return proc_dentry;xdiff -Nru a/fs/proc/inode.c b/fs/proc/inode.c
--- a/fs/proc/inode.c	2005-01-04 18:48:14 -08:00
+++ b/fs/proc/inode.c	2005-03-07 20:41:41 -08:00
@@ -14,7 +14,6 @@
 #include <linux/limits.h>
 #include <linux/init.h>
 #include <linux/module.h>
-#include <linux/parser.h>
 #include <linux/smp_lock.h>
 
 #include <asm/system.h>
@@ -143,51 +142,6 @@
 	.remount_fs	= proc_remount,x };
 
-enum {
-	Opt_uid, Opt_gid, Opt_err
-};
-
-static match_table_t tokens = {
-	{Opt_uid, "uid=%u"},
-	{Opt_gid, "gid=%u"},
-	{Opt_err, NULL}
-};
-
-static int parse_options(char *options,uid_t *uid,gid_t *gid)
-{
-	char *p;
-	int option;
-
-	*uid = current->uid;
-	*gid = current->gid;
-	if (!options)
-		return 1;
-
-	while ((p = strsep(&options, ",")) != NULL) {
-		substring_t args[MAX_OPT_ARGS];
-		int token;
-		if (!*p)
-			continue;
-
-		token = match_token(p, tokens, args);
-		switch (token) {
-		case Opt_uid:
-			if (match_int(args, &option))
-				return 0;x-			*uid = option;
-			break;
-		case Opt_gid:
-			if (match_int(args, &option))
-				return 0;x-			*gid = option;
-			break;
-		default:
-			return 0;x-		}
-	}
-	return 1;
-}
-
 struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
 				struct proc_dir_entry *de)
 {
@@ -249,10 +203,11 @@
 	 * Fixup the root inode's nlink value
 	 */x 	root_inode->i_nlink += nr_processes();
+	root_inode->i_uid = 0;
+	root_inode->i_gid = 0;
 	s->s_root = d_alloc_root(root_inode);
 	if (!s->s_root)
 		goto out_no_root;x-	parse_options(data, &root_inode->i_uid, &root_inode->i_gid);
 	return 0;
 
 out_no_root:xdiff -Nru a/fs/proc/kcore.c b/fs/proc/kcore.c
--- a/fs/proc/kcore.c	2005-01-20 21:02:13 -08:00
+++ b/fs/proc/kcore.c	2005-03-07 20:41:38 -08:00
@@ -84,7 +84,7 @@
 	}
 	*elf_buflen =	sizeof(struct elfhdr) + 
 			(*nphdr + 2)*sizeof(struct elf_phdr) + 
-			3 * sizeof(struct memelfnote) +
+			3 * (sizeof(struct elf_note) + 4) +
 			sizeof(struct elf_prstatus) +
 			sizeof(struct elf_prpsinfo) +
 			sizeof(struct task_struct);xdiff -Nru a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
--- a/fs/proc/task_mmu.c	2005-01-04 18:48:08 -08:00
+++ b/fs/proc/task_mmu.c	2005-03-07 20:41:51 -08:00
@@ -77,9 +77,19 @@
 	return result;
 }
 
+static void pad_len_spaces(struct seq_file *m, int len)
+{
+	len = 25 + sizeof(void*) * 6 - len;
+	if (len < 1)
+		len = 1;x+	seq_printf(m, "%*c", len, ' ');
+}
+
 static int show_map(struct seq_file *m, void *v)
 {
+	struct task_struct *task = m->private;
 	struct vm_area_struct *map = v;
+	struct mm_struct *mm = map->vm_mm;
 	struct file *file = map->vm_file;
 	int flags = map->vm_flags;
 	unsigned long ino = 0;
@@ -102,38 +112,93 @@
 			map->vm_pgoff << PAGE_SHIFT,
 			MAJOR(dev), MINOR(dev), ino, &len);
 
+	/*
+	 * Print the dentry name for named mappings, and a
+	 * special [heap] marker for the heap:
+	 */
 	if (map->vm_file) {
-		len = 25 + sizeof(void*) * 6 - len;
-		if (len < 1)
-			len = 1;x-		seq_printf(m, "%*c", len, ' ');
+		pad_len_spaces(m, len);
 		seq_path(m, file->f_vfsmnt, file->f_dentry, "");
+	} else {
+		if (mm) {
+			if (map->vm_start <= mm->start_brk &&
+						map->vm_end >= mm->brk) {
+				pad_len_spaces(m, len);
+				seq_puts(m, "[heap]");
+			} else {
+				if (map->vm_start <= mm->start_stack &&
+					map->vm_end >= mm->start_stack) {
+
+					pad_len_spaces(m, len);
+					seq_puts(m, "[stack]");
+				}
+			}
+		} else {
+			pad_len_spaces(m, len);
+			seq_puts(m, "[vdso]");
+		}
 	}
 	seq_putc(m, '\n');
+	if (m->count < m->size)  /* map is copied successfully */
+		m->version = (map != get_gate_vma(task))? map->vm_start: 0;
 	return 0;
 }
 
 static void *m_start(struct seq_file *m, loff_t *pos)
 {
 	struct task_struct *task = m->private;
-	struct mm_struct *mm = get_task_mm(task);
-	struct vm_area_struct * map;
+	unsigned long last_addr = m->version;
+	struct mm_struct *mm;
+	struct vm_area_struct *map, *tail_map;
 	loff_t l = *pos;x 
+	/*
+	 * We remember last_addr rather than next_addr to hit with
+	 * mmap_cache most of the time. We have zero last_addr at
+	 * the begining and also after lseek. We will have -1 last_addr
+	 * after the end of the maps.
+	 */
+
+	if (last_addr == -1UL)
+		return NULL;
+
+	mm = get_task_mm(task);
 	if (!mm)
 		return NULL;
 
+	tail_map = get_gate_vma(task);x 	down_read(&mm->mmap_sem);
-	map = mm->mmap;
-	while (l-- && map)
+
+	/* Start with last addr hint */x+	if (last_addr && (map = find_vma(mm, last_addr))) {
 		map = map->vm_next;
-	if (!map) {
-		up_read(&mm->mmap_sem);
-		mmput(mm);
-		if (l == -1)
-			map = get_gate_vma(task);x+		goto out;
+	}
+
+	/*
+	 * Check the map index is within the range and do
+	 * sequential scan until m_index.
+	 */
+	map = NULL;
+	if ((unsigned long)l < mm->map_count) {
+		map = mm->mmap;
+		while (l-- && map)
+			map = map->vm_next;
+		goto out;
 	}
-	return map;
+x+	if (l != mm->map_count)
+		tail_map = NULL; /* After gate map */
+
+out:
+	if (map)
+		return map;
+x+	/* End of maps has reached */x+	m->version = (tail_map != NULL)? 0: -1UL;
+	up_read(&mm->mmap_sem);
+	mmput(mm);
+	return tail_map;
 }
 
 static void m_stop(struct seq_file *m, void *v)
@@ -151,13 +216,13 @@
 {
 	struct task_struct *task = m->private;
 	struct vm_area_struct *map = v;
+	struct vm_area_struct *tail_map = get_gate_vma(task);x+
 	(*pos)++;
-	if (map->vm_next)
+	if (map && (map != tail_map) && map->vm_next)
 		return map->vm_next;
 	m_stop(m, v);
-	if (map != get_gate_vma(task))
-		return get_gate_vma(task);x-	return NULL;
+	return (map != tail_map)? tail_map: NULL;
 }
 
 struct seq_operations proc_pid_maps_op = {
diff -Nru a/fs/quota.c b/fs/quota.c
--- a/fs/quota.c	2005-01-08 08:19:17 -08:00
+++ b/fs/quota.c	2005-03-07 20:41:43 -08:00
@@ -16,8 +16,8 @@
 #include <linux/syscalls.h>
 #include <linux/buffer_head.h>
 
-/* Check validity of quotactl */
-static int check_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id)
+/* Check validity of generic quotactl commands */x+static int generic_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id)
 {
 	if (type >= MAXQUOTAS)
 		return -EINVAL;
@@ -58,6 +58,48 @@
 			if (sb && !sb->s_qcop->quota_sync)
 				return -ENOSYS;
 			break;
+		default:
+			return -EINVAL;
+	}
+
+	/* Is quota turned on for commands which need it? */x+	switch (cmd) {
+		case Q_GETFMT:
+		case Q_GETINFO:
+		case Q_QUOTAOFF:
+		case Q_SETINFO:
+		case Q_SETQUOTA:
+		case Q_GETQUOTA:
+			/* This is just informative test so we are satisfied without a lock */
+			if (!sb_has_quota_enabled(sb, type))
+				return -ESRCH;
+	}
+
+	/* Check privileges */x+	if (cmd == Q_GETQUOTA) {
+		if (((type == USRQUOTA && current->euid != id) ||
+		     (type == GRPQUOTA && !in_egroup_p(id))) &&
+		    !capable(CAP_SYS_ADMIN))
+			return -EPERM;
+	}
+	else if (cmd != Q_GETFMT && cmd != Q_SYNC && cmd != Q_GETINFO)
+		if (!capable(CAP_SYS_ADMIN))
+			return -EPERM;
+
+	return 0;
+}
+
+/* Check validity of XFS Quota Manager commands */x+static int xqm_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id)
+{x+	if (type >= XQM_MAXQUOTAS)
+		return -EINVAL;
+	if (!sb)
+		return -ENODEV;
+	if (!sb->s_qcop)
+		return -ENOSYS;
+x+	switch (cmd) {
 		case Q_XQUOTAON:
 		case Q_XQUOTAOFF:
 		case Q_XQUOTARM:
@@ -80,30 +122,31 @@
 			return -EINVAL;
 	}
 
-	/* Is quota turned on for commands which need it? */x-	switch (cmd) {
-		case Q_GETFMT:
-		case Q_GETINFO:
-		case Q_QUOTAOFF:
-		case Q_SETINFO:
-		case Q_SETQUOTA:
-		case Q_GETQUOTA:
-			/* This is just informative test so we are satisfied without a lock */
-			if (!sb_has_quota_enabled(sb, type))
-				return -ESRCH;
-	}
 	/* Check privileges */x-	if (cmd == Q_GETQUOTA || cmd == Q_XGETQUOTA) {
-		if (((type == USRQUOTA && current->euid != id) ||
-		     (type == GRPQUOTA && !in_egroup_p(id))) &&
-		    !capable(CAP_SYS_ADMIN))
+	if (cmd == Q_XGETQUOTA) {
+		if (((type == XQM_USRQUOTA && current->euid != id) ||
+		     (type == XQM_GRPQUOTA && !in_egroup_p(id))) &&
+		     !capable(CAP_SYS_ADMIN))
 			return -EPERM;
-	}
-	else if (cmd != Q_GETFMT && cmd != Q_SYNC && cmd != Q_GETINFO && cmd != Q_XGETQSTAT)
+	} else if (cmd != Q_XGETQSTAT) {
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
+	}
+
+	return 0;
+}
+
+static int check_quotactl_valid(struct super_block *sb, int type, int cmd, qid_t id)
+{
+	int error;
 
-	return security_quotactl (cmd, type, id, sb);
+	if (XQM_COMMAND(cmd))
+		error = xqm_quotactl_valid(sb, type, cmd, id);
+	else
+		error = generic_quotactl_valid(sb, type, cmd, id);
+	if (!error)
+		error = security_quotactl(cmd, type, id, sb);
+	return error;
 }
 
 static struct super_block *get_super_to_sync(int type)
diff -Nru a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
--- a/fs/reiserfs/inode.c	2005-01-07 21:44:20 -08:00
+++ b/fs/reiserfs/inode.c	2005-03-07 20:41:24 -08:00
@@ -1843,6 +1843,8 @@
     } else if (inode->i_sb->s_flags & MS_POSIXACL) {
 	reiserfs_warning (inode->i_sb, "ACLs aren't enabled in the fs, "
 			  "but vfs thinks they are!");
+    } else if (is_reiserfs_priv_object (dir)) {
+	reiserfs_mark_inode_private (inode);x     }
 
     insert_inode_hash (inode);xdiff -Nru a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
--- a/fs/reiserfs/namei.c	2005-01-04 18:48:14 -08:00
+++ b/fs/reiserfs/namei.c	2005-03-07 20:41:41 -08:00
@@ -353,7 +353,7 @@
 
 	/* Propogate the priv_object flag so we know we're in the priv tree */
 	if (is_reiserfs_priv_object (dir))
-	    REISERFS_I(inode)->i_flags |= i_priv_object;
+	    reiserfs_mark_inode_private (inode);x     }
     reiserfs_write_unlock(dir->i_sb);x     if ( retval == IO_ERROR ) {
@@ -1255,7 +1255,6 @@
         return retval;
     }
 
-
     /* add new entry (or find the existing one) */
     retval = reiserfs_add_entry (&th, new_dir, new_dentry->d_name.name, new_dentry->d_name.len, 
 				 old_inode, 0);
@@ -1283,8 +1282,13 @@
 
     while (1) {
 	// look for old name using corresponding entry key (found by reiserfs_find_entry)
-	if (search_by_entry_key (new_dir->i_sb, &old_de.de_entry_key, &old_entry_path, &old_de) != NAME_FOUND)
-	    BUG ();
+	if ((retval = search_by_entry_key (new_dir->i_sb, &old_de.de_entry_key,
+					   &old_entry_path, &old_de)) != NAME_FOUND) {
+	    pathrelse(&old_entry_path);
+	    journal_end(&th, old_dir->i_sb, jbegin_count);
+	    reiserfs_write_unlock(old_dir->i_sb);
+	    return -EIO;
+	}
 
 	copy_item_head(&old_entry_ih, get_ih(&old_entry_path)) ;
 x@@ -1296,16 +1300,28 @@
 				      &new_entry_path, &new_de);x 	// reiserfs_add_entry should not return IO_ERROR, because it is called with essentially same parameters from
         // reiserfs_add_entry above, and we'll catch any i/o errors before we get here.
-	if (retval != NAME_FOUND_INVISIBLE && retval != NAME_FOUND)
-	    BUG ();
+	if (retval != NAME_FOUND_INVISIBLE && retval != NAME_FOUND) {
+	    pathrelse(&new_entry_path);
+	    pathrelse(&old_entry_path);
+	    journal_end(&th, old_dir->i_sb, jbegin_count);
+	    reiserfs_write_unlock(old_dir->i_sb);
+	    return -EIO;
+	}
 
 	copy_item_head(&new_entry_ih, get_ih(&new_entry_path)) ;
 x 	reiserfs_prepare_for_journal(old_inode->i_sb, new_de.de_bh, 1) ;
 x 	if (S_ISDIR(old_inode->i_mode)) {
-	    if (search_by_entry_key (new_dir->i_sb, &dot_dot_de.de_entry_key, &dot_dot_entry_path, &dot_dot_de) != NAME_FOUND)
-		BUG ();
+	    if ((retval = search_by_entry_key (new_dir->i_sb, &dot_dot_de.de_entry_key,
+					       &dot_dot_entry_path, &dot_dot_de)) != NAME_FOUND) {
+		pathrelse(&dot_dot_entry_path);
+		pathrelse(&new_entry_path);
+		pathrelse(&old_entry_path);
+		journal_end(&th, old_dir->i_sb, jbegin_count);
+		reiserfs_write_unlock(old_dir->i_sb);
+		return -EIO;
+	    }
 	    copy_item_head(&dot_dot_ih, get_ih(&dot_dot_entry_path)) ;
 	    // node containing ".." gets into transaction
 	    reiserfs_prepare_for_journal(old_inode->i_sb, dot_dot_de.de_bh, 1) ;
diff -Nru a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
--- a/fs/reiserfs/xattr.c	2005-01-20 21:02:13 -08:00
+++ b/fs/reiserfs/xattr.c	2005-03-07 20:41:24 -08:00
@@ -181,8 +181,6 @@
             dput (xadir);
             return ERR_PTR (-ENODATA);
         }
-        /* Newly created object.. Need to mark it private */x-        REISERFS_I(xadir->d_inode)->i_flags |= i_priv_object;
     }
 
     dput (xaroot);
@@ -230,8 +228,6 @@
             dput (xafile);
             goto out;
         }
-        /* Newly created object.. Need to mark it private */x-        REISERFS_I(xafile->d_inode)->i_flags |= i_priv_object;
     }
 
 out:
@@ -1316,7 +1312,7 @@
 
       if (!err && dentry) {
           s->s_root->d_op = &xattr_lookup_poison_ops;x-          REISERFS_I(dentry->d_inode)->i_flags |= i_priv_object;
+          reiserfs_mark_inode_private (dentry->d_inode);
           REISERFS_SB(s)->priv_root = dentry;x       } else if (!(mount_flags & MS_RDONLY)) { /* xattrs are unavailable */
           /* If we're read-only it just means that the dir hasn't been
diff -Nru a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c
--- a/fs/reiserfs/xattr_acl.c	2005-01-07 21:44:20 -08:00
+++ b/fs/reiserfs/xattr_acl.c	2005-03-07 20:41:24 -08:00
@@ -339,7 +339,7 @@
      * would be useless since permissions are ignored, and a pain because
      * it introduces locking cycles */x     if (is_reiserfs_priv_object (dir)) {
-        REISERFS_I(inode)->i_flags |= i_priv_object;
+        reiserfs_mark_inode_private (inode);x         goto apply_umask;x     }
 
diff -Nru a/fs/seq_file.c b/fs/seq_file.c
--- a/fs/seq_file.c	2004-08-07 16:08:17 -07:00
+++ b/fs/seq_file.c	2005-03-07 20:41:51 -08:00
@@ -36,6 +36,13 @@
 	p->op = op;
 	file->private_data = p;x 
+	/*
+	 * Wrappers around seq_open(e.g. swaps_open) need to be
+	 * aware of this. If they set f_version themselves, they
+	 * should call seq_open first and then set f_version.
+	 */
+	file->f_version = 0;x+
 	/* SEQ files support lseek, but not pread/pwrite */
 	file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
 	return 0;
@@ -58,6 +65,18 @@
 	int err = 0;
 x 	down(&m->sem);
+	/*
+	 * seq_file->op->..m_start/m_stop/m_next may do special actions
+	 * or optimisations based on the file->f_version, so we want to
+	 * pass the file->f_version to those methods.
+	 *
+	 * seq_file->version is just copy of f_version, and seq_file
+	 * methods can treat it simply as file version.
+	 * It is copied in first and copied out after all operations.
+	 * It is convenient to have it as  part of structure to avoid the
+	 * need of passing another argument to all the seq_file methods.
+	 */x+	m->version = file->f_version;
 	/* grab buffer if we didn't have one */
 	if (!m->buf) {
 		m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
@@ -98,6 +117,7 @@
 		if (!m->buf)
 			goto Enomem;
 		m->count = 0;
+		m->version = 0;
 	}
 	m->op->stop(m, p);
 	m->count = 0;
@@ -136,6 +156,7 @@
 		copied = err;
 	else
 		*ppos += copied;
+	file->f_version = m->version;
 	up(&m->sem);
 	return copied;
 Enomem:
@@ -153,6 +174,7 @@
 	int error = 0;
 	void *p;x 
+	m->version = 0;
 	m->index = 0;
 	m->count = m->from = 0;
 	if (!offset)
@@ -207,6 +229,7 @@
 	long long retval = -EINVAL;
 x 	down(&m->sem);
+	m->version = file->f_version;
 	switch (origin) {
 		case 1:x 			offset += file->f_pos;x@@ -220,6 +243,7 @@
 				if (retval) {
 					/* with extreme prejudice... */x 					file->f_pos = 0;
+					m->version = 0;
 					m->index = 0;
 					m->count = 0;
 				} else {
@@ -228,6 +252,7 @@
 			}
 	}
 	up(&m->sem);
+	file->f_version = m->version;
 	return retval;
 }
 EXPORT_SYMBOL(seq_lseek);xdiff -Nru a/fs/sysfs/inode.c b/fs/sysfs/inode.c
--- a/fs/sysfs/inode.c	2004-10-30 06:10:25 -07:00
+++ b/fs/sysfs/inode.c	2005-03-07 20:41:36 -08:00
@@ -129,13 +129,17 @@
 
 	if (dentry) {
 		spin_lock(&dcache_lock);
+		spin_lock(&dentry->d_lock);
 		if (!(d_unhashed(dentry) && dentry->d_inode)) {
 			dget_locked(dentry);
 			__d_drop(dentry);
+			spin_unlock(&dentry->d_lock);
 			spin_unlock(&dcache_lock);
 			simple_unlink(parent->d_inode, dentry);
-		} else
+		} else {
+			spin_unlock(&dentry->d_lock);
 			spin_unlock(&dcache_lock);
+		}
 	}
 }
 
diff -Nru a/fs/ufs/super.c b/fs/ufs/super.c
--- a/fs/ufs/super.c	2004-10-20 01:37:15 -07:00
+++ b/fs/ufs/super.c	2005-03-07 20:41:39 -08:00
@@ -1196,6 +1196,11 @@
 		printk(KERN_INFO "ufs_inode_cache: not all structures were freed\n");
 }
 
+#ifdef CONFIG_QUOTA
+static ssize_t ufs_quota_read(struct super_block *, int, char *,size_t, loff_t);
+static ssize_t ufs_quota_write(struct super_block *, int, const char *, size_t, loff_t);
+#endif
+
 static struct super_operations ufs_super_ops = {
 	.alloc_inode	= ufs_alloc_inode,
 	.destroy_inode	= ufs_destroy_inode,
@@ -1206,7 +1211,101 @@
 	.write_super	= ufs_write_super,
 	.statfs		= ufs_statfs,
 	.remount_fs	= ufs_remount,x+#ifdef CONFIG_QUOTA
+	.quota_read	= ufs_quota_read,
+	.quota_write	= ufs_quota_write,
+#endif
 };
+x+#ifdef CONFIG_QUOTA
+
+/* Read data from quotafile - avoid pagecache and such because we cannot afford
+ * acquiring the locks... As quota files are never truncated and quota code
+ * itself serializes the operations (and noone else should touch the files)
+ * we don't have to be afraid of races */x+static ssize_t ufs_quota_read(struct super_block *sb, int type, char *data,
+			       size_t len, loff_t off)
+{
+	struct inode *inode = sb_dqopt(sb)->files[type];x+	sector_t blk = off >> sb->s_blocksize_bits;
+	int err = 0;
+	int offset = off & (sb->s_blocksize - 1);x+	int tocopy;
+	size_t toread;
+	struct buffer_head *bh;
+	loff_t i_size = i_size_read(inode);
+
+	if (off > i_size)
+		return 0;x+	if (off+len > i_size)
+		len = i_size-off;x+	toread = len;
+	while (toread > 0) {
+		tocopy = sb->s_blocksize - offset < toread ?
+				sb->s_blocksize - offset : toread;
+
+		bh = ufs_bread(inode, blk, 0, &err);
+		if (err)
+			return err;
+		if (!bh)	/* A hole? */
+			memset(data, 0, tocopy);
+		else {
+			memcpy(data, bh->b_data+offset, tocopy);
+			brelse(bh);
+		}
+		offset = 0;
+		toread -= tocopy;
+		data += tocopy;
+		blk++;
+	}
+	return len;
+}
+
+/* Write to quotafile */x+static ssize_t ufs_quota_write(struct super_block *sb, int type,
+				const char *data, size_t len, loff_t off)
+{
+	struct inode *inode = sb_dqopt(sb)->files[type];x+	sector_t blk = off >> sb->s_blocksize_bits;
+	int err = 0;
+	int offset = off & (sb->s_blocksize - 1);x+	int tocopy;
+	size_t towrite = len;
+	struct buffer_head *bh;
+
+	down(&inode->i_sem);
+	while (towrite > 0) {
+		tocopy = sb->s_blocksize - offset < towrite ?
+				sb->s_blocksize - offset : towrite;
+
+		bh = ufs_bread(inode, blk, 1, &err);
+		if (!bh)
+			goto out;
+		lock_buffer(bh);
+		memcpy(bh->b_data+offset, data, tocopy);
+		flush_dcache_page(bh->b_page);
+		set_buffer_uptodate(bh);
+		mark_buffer_dirty(bh);
+		unlock_buffer(bh);
+		brelse(bh);
+		offset = 0;
+		towrite -= tocopy;
+		data += tocopy;
+		blk++;
+	}
+out:
+	if (len == towrite)
+		return err;
+	if (inode->i_size < off+len-towrite)
+		i_size_write(inode, off+len-towrite);x+	inode->i_version++;
+	inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
+	mark_inode_dirty(inode);
+	up(&inode->i_sem);
+	return len - towrite;
+}
+
+#endif
 
 static struct super_block *ufs_get_sb(struct file_system_type *fs_type,
 	int flags, const char *dev_name, void *data)
diff -Nru a/fs/xfs/linux-2.6/xfs_linux.h b/fs/xfs/linux-2.6/xfs_linux.h
--- a/fs/xfs/linux-2.6/xfs_linux.h	2005-01-18 22:53:47 -08:00
+++ b/fs/xfs/linux-2.6/xfs_linux.h	2005-03-07 20:41:46 -08:00
@@ -88,6 +88,7 @@
 #include <linux/list.h>
 #include <linux/proc_fs.h>
 #include <linux/version.h>
+#include <linux/sort.h>
 
 #include <asm/page.h>
 #include <asm/div64.h>
@@ -367,5 +368,7 @@
 	do_div(x, y);
 	return(x * y);
 }
+
+#define qsort(a, n, s, cmp) sort(a, n, s, cmp, NULL)
 
 #endif /* __XFS_LINUX__ */xdiff -Nru a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
--- a/fs/xfs/xfs_da_btree.c	2004-08-18 18:08:50 -07:00
+++ b/fs/xfs/xfs_da_btree.c	2005-03-07 20:41:50 -08:00
@@ -1627,40 +1627,38 @@
 {
 	xfs_dahash_t hash;
 
-#define	ROTL(x,y)	(((x) << (y)) | ((x) >> (32 - (y))))
 #ifdef SLOWVERSION
 	/*
 	 * This is the old one-byte-at-a-time version.
 	 */x-	for (hash = 0; namelen > 0; namelen--) {
-		hash = *name++ ^ ROTL(hash, 7);
-	}
+	for (hash = 0; namelen > 0; namelen--)
+		hash = *name++ ^ rol32(hash, 7);
+
 	return(hash);
 #else
 	/*
 	 * Do four characters at a time as long as we can.
 	 */x-	for (hash = 0; namelen >= 4; namelen -= 4, name += 4) {
+	for (hash = 0; namelen >= 4; namelen -= 4, name += 4)
 		hash = (name[0] << 21) ^ (name[1] << 14) ^ (name[2] << 7) ^
-		       (name[3] << 0) ^ ROTL(hash, 7 * 4);
-	}
+		       (name[3] << 0) ^ rol32(hash, 7 * 4);
+
 	/*
 	 * Now do the rest of the characters.
 	 */x 	switch (namelen) {
 	case 3:
 		return (name[0] << 14) ^ (name[1] << 7) ^ (name[2] << 0) ^
-		       ROTL(hash, 7 * 3);
+		       rol32(hash, 7 * 3);
 	case 2:
-		return (name[0] << 7) ^ (name[1] << 0) ^ ROTL(hash, 7 * 2);
+		return (name[0] << 7) ^ (name[1] << 0) ^ rol32(hash, 7 * 2);
 	case 1:
-		return (name[0] << 0) ^ ROTL(hash, 7 * 1);
+		return (name[0] << 0) ^ rol32(hash, 7 * 1);
 	case 0:
 		return hash;
 	}
 	/* NOTREACHED */x #endif
-#undef ROTL
 	return 0; /* keep gcc happy */x }
 
diff -Nru a/include/asm-alpha/cacheflush.h b/include/asm-alpha/cacheflush.h
--- a/include/asm-alpha/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-alpha/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -8,7 +8,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
diff -Nru a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
--- a/include/asm-alpha/pci.h	2004-08-31 08:27:27 -07:00
+++ b/include/asm-alpha/pci.h	2005-02-07 12:52:02 -08:00
@@ -228,17 +228,10 @@
 
 #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
 
-static inline int
-pci_name_bus(char *name, struct pci_bus *bus)
+static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
-
-	if (likely(hose->need_domain_info == 0)) {
-		sprintf(name, "%02x", bus->number);
-	} else {
-		sprintf(name, "%04x:%02x", hose->index, bus->number);
-	}
-	return 0;
+	return hose->need_domain_info;
 }
 
 static inline void
diff -Nru a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h
--- a/include/asm-alpha/pgtable.h	2005-02-02 01:49:27 -08:00
+++ b/include/asm-alpha/pgtable.h	2005-02-23 15:40:52 -08:00
@@ -22,6 +22,7 @@
  * hook is made available.
  */x #define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval))
+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 
 /* PMD_SHIFT determines the size of the area a second-level page table can map */
 #define PMD_SHIFT	(PAGE_SHIFT + (PAGE_SHIFT-3))
@@ -235,7 +236,10 @@
 
 extern inline int pte_none(pte_t pte)		{ return !pte_val(pte); }
 extern inline int pte_present(pte_t pte)	{ return pte_val(pte) & _PAGE_VALID; }
-extern inline void pte_clear(pte_t *ptep)	{ pte_val(*ptep) = 0; }
+extern inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
+{
+	pte_val(*ptep) = 0;
+}
 
 extern inline int pmd_none(pmd_t pmd)		{ return !pmd_val(pmd); }
 extern inline int pmd_bad(pmd_t pmd)		{ return (pmd_val(pmd) & ~_PFN_MASK) != _PAGE_TABLE; }
diff -Nru a/include/asm-alpha/resource.h b/include/asm-alpha/resource.h
--- a/include/asm-alpha/resource.h	2005-01-20 21:00:50 -08:00
+++ b/include/asm-alpha/resource.h	2005-03-07 20:41:39 -08:00
@@ -2,32 +2,20 @@
 #define _ALPHA_RESOURCE_H
 
 /*
- * Resource limits
+ * Alpha/Linux-specific ordering of these four resource limit IDs,
+ * the rest comes from the generic header:
  */x-
-#define RLIMIT_CPU	0		/* CPU time in ms */x-#define RLIMIT_FSIZE	1		/* Maximum filesize */x-#define RLIMIT_DATA	2		/* max data size */x-#define RLIMIT_STACK	3		/* max stack size */x-#define RLIMIT_CORE	4		/* max core file size */x-#define RLIMIT_RSS	5		/* max resident set size */x-#define RLIMIT_NOFILE	6		/* max number of open files */x-#define RLIMIT_AS	7		/* address space limit(?) */x-#define RLIMIT_NPROC	8		/* max number of processes */x-#define RLIMIT_MEMLOCK	9		/* max locked-in-memory address space */x-#define RLIMIT_LOCKS	10		/* maximum file locks held */x-#define RLIMIT_SIGPENDING 11		/* max number of pending signals */x-#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */x-x-#define RLIM_NLIMITS	13x-#define __ARCH_RLIMIT_ORDER
+#define RLIMIT_NOFILE		6	/* max number of open files */x+#define RLIMIT_AS		7	/* address space limit */x+#define RLIMIT_NPROC		8	/* max number of processes */x+#define RLIMIT_MEMLOCK		9	/* max locked-in-memory address space */x 
 /*
  * SuS says limits have to be unsigned.  Fine, it's unsigned, but
  * we retain the old value for compatibility, especially with DU. 
  * When you run into the 2^63 barrier, you call me.
  */x-#define RLIM_INFINITY	0x7fffffffffffffffulx+#define RLIM_INFINITY		0x7fffffffffffffffulx 
 #include <asm-generic/resource.h>
 
diff -Nru a/include/asm-alpha/system.h b/include/asm-alpha/system.h
--- a/include/asm-alpha/system.h	2004-09-21 01:42:02 -07:00
+++ b/include/asm-alpha/system.h	2005-03-04 22:41:13 -08:00
@@ -621,4 +621,6 @@
 
 #endif /* __ASSEMBLY__ */x x+#define arch_align_stack(x) (x)
+
 #endif
diff -Nru a/include/asm-arm/arch-ixp2000/entry-macro.S b/include/asm-arm/arch-ixp2000/entry-macro.S
--- a/include/asm-arm/arch-ixp2000/entry-macro.S	2004-12-30 12:07:56 -08:00
+++ b/include/asm-arm/arch-ixp2000/entry-macro.S	2005-02-16 15:49:43 -08:00
@@ -15,8 +15,7 @@
 
 		mov	\irqnr, #0x0              @clear out irqnr as default
                 mov	\base, #0xfe000000
-		orr	\base, \base, #0x00ff0000
-		orr	\base, \base, #0x0000a000
+		orr	\base, \base, #0x00e00000
 		orr	\base, \base, #0x08
 		ldr	\irqstat, [\base]         @ get interrupts
 x@@ -35,8 +34,8 @@
 		bne	1001f
 
 		mov	\base, #0xfe000000
-		orr	\base, \base, #0x00fd0000
-		orr	\base, \base, #0x0000e100
+		orr	\base, \base, #0x00c00000
+		orr	\base, \base, #0x00000100
 		orr	\base, \base, #0x00000058
 		ldr	\irqstat, [\base]
 
diff -Nru a/include/asm-arm/arch-ixp2000/io.h b/include/asm-arm/arch-ixp2000/io.h
--- a/include/asm-arm/arch-ixp2000/io.h	2005-02-03 14:45:19 -08:00
+++ b/include/asm-arm/arch-ixp2000/io.h	2005-03-04 12:34:53 -08:00
@@ -1,5 +1,5 @@
 /*
- * linux/include/asm-arm/arch-ixdp2000/io.h
+ * linux/include/asm-arm/arch-ixp2000/io.h
  *
  * Original Author: Naeem M Afzal <naeem.m.afzal@intel.com>
  * Maintainer: Deepak Saxena <dsaxena@plexity.net>
@@ -27,8 +27,8 @@
  * IXP2000 does not do proper byte-lane conversion for PCI addresses,
  * so we need to override standard functions.
  */x-#define alignb(addr)		(((unsigned long)addr & ~3) + (3 - ((unsigned long)addr & 3)))
-#define alignw(addr)		(((unsigned long)addr & ~2) + (2 - ((unsigned long)addr & 2)))
+#define alignb(addr)		(void __iomem *)(((unsigned long)addr & ~3) + (3 - ((unsigned long)addr & 3)))
+#define alignw(addr)		(void __iomem *)(((unsigned long)addr & ~2) + (2 - ((unsigned long)addr & 2)))
 
 #define outb(v,p)		__raw_writeb(v,alignb(___io(p)))
 #define outw(v,p)		__raw_writew((v),alignw(___io(p)))
diff -Nru a/include/asm-arm/arch-ixp2000/ixdp2x00.h b/include/asm-arm/arch-ixp2000/ixdp2x00.h
--- a/include/asm-arm/arch-ixp2000/ixdp2x00.h	2004-10-07 11:19:53 -07:00
+++ b/include/asm-arm/arch-ixp2000/ixdp2x00.h	2005-02-16 15:49:43 -08:00
@@ -21,7 +21,7 @@
  * On board CPLD memory map
  */x #define IXDP2X00_PHYS_CPLD_BASE		0xc7000000
-#define IXDP2X00_VIRT_CPLD_BASE		0xfefdd000
+#define IXDP2X00_VIRT_CPLD_BASE		0xfafff000x #define IXDP2X00_CPLD_SIZE		0x00001000x 
 
diff -Nru a/include/asm-arm/arch-ixp2000/ixdp2x01.h b/include/asm-arm/arch-ixp2000/ixdp2x01.h
--- a/include/asm-arm/arch-ixp2000/ixdp2x01.h	2004-10-07 11:11:23 -07:00
+++ b/include/asm-arm/arch-ixp2000/ixdp2x01.h	2005-03-04 12:34:53 -08:00
@@ -1,5 +1,5 @@
 /*
- * include/asm/arch/ixdp2x01.h
+ * include/asm-arm/arch-ixp2000/ixdp2x01.h
  *
  * Platform definitions for IXDP2X01 && IXDP2801 systems
  *
@@ -18,10 +18,10 @@
 #define __IXDP2X01_H__
 
 #define	IXDP2X01_PHYS_CPLD_BASE		0xc6024000
-#define	IXDP2X01_VIRT_CPLD_BASE		0xfefdd000
-#define	IXDP2X01_CPLD_REGION_SIZE	0x1000
+#define	IXDP2X01_VIRT_CPLD_BASE		0xfafff000x+#define	IXDP2X01_CPLD_REGION_SIZE	0x00001000x 
-#define IXDP2X01_CPLD_VIRT_REG(reg) (volatile u32*)(IXDP2X01_VIRT_CPLD_BASE | reg)
+#define IXDP2X01_CPLD_VIRT_REG(reg) (volatile unsigned long*)(IXDP2X01_VIRT_CPLD_BASE | reg)
 #define IXDP2X01_CPLD_PHYS_REG(reg) (volatile u32*)(IXDP2X01_PHYS_CPLD_BASE | reg)
 
 #define IXDP2X01_UART1_VIRT_BASE	IXDP2X01_CPLD_VIRT_REG(0x40)
diff -Nru a/include/asm-arm/arch-ixp2000/ixp2000-regs.h b/include/asm-arm/arch-ixp2000/ixp2000-regs.h
--- a/include/asm-arm/arch-ixp2000/ixp2000-regs.h	2004-12-22 15:25:34 -08:00
+++ b/include/asm-arm/arch-ixp2000/ixp2000-regs.h	2005-02-16 15:51:04 -08:00
@@ -19,41 +19,49 @@
 #define _IXP2000_REGS_H_
 
 /* 
- * Static I/O regions. The manual defines each region as being several
- * MB in size, but all the registers are within the first 4K, so there's
- * no purpose in mapping the whole region in.
+ * Static I/O regions.
+ *
+ * Most of the registers are clumped in 4K regions spread throughout
+ * the 0xc000000 -> 0xc0100000 address range, but we just map in
+ * the whole range using a single 1 MB section instead of small
+ * 4K pages.  This has two advantages for us:
+ *
+ * 1) We use only one TLB entry for large number of on-chip I/O devices.
+ *
+ * 2) We can easily set the Section attributes to XCB=101 on the IXP2400
+ *    as required per erratum #66.
+ *
+ * CAP stands for CSR Access Proxy
  */x-#define	IXP2000_SLOWPORT_CSR_PHYS_BASE	0xc0080000
-#define	IXP2000_SLOWPORT_CSR_VIRT_BASE	0xfefff000x-#define	IXP2000_SLOWPORT_CSR_SIZE	0x1000
-x-#define	IXP2000_GLOBAL_REG_PHYS_BASE	0xc0004000x-#define	IXP2000_GLOBAL_REG_VIRT_BASE	0xfeffe000x-#define	IXP2000_GLOBAL_REG_SIZE		0x1000x 
+#define	IXP2000_CAP_PHYS_BASE		0xc0000000
+#define	IXP2000_CAP_VIRT_BASE		0xfef00000
+#define	IXP2000_CAP_SIZE		0x00100000
+
+/*
+ * Addresses for specific on-chip peripherals
+ */
+#define	IXP2000_SLOWPORT_CSR_VIRT_BASE	0xfef80000
+#define	IXP2000_GLOBAL_REG_VIRT_BASE	0xfef04000x #define	IXP2000_UART_PHYS_BASE		0xc0030000x #define	IXP2000_UART_VIRT_BASE		0xfef30000
-#define IXP2000_UART_SIZE		0x1000x-x-#define	IXP2000_TIMER_PHYS_BASE		0xc0020000
-#define	IXP2000_TIMER_VIRT_BASE		0xfeffc000
-#define	IXP2000_TIMER_SIZE		0x1000x-x-#define	IXP2000_GPIO_PHYS_BASE		0xc0010000
-#define	IXP2000_GPIO_VIRT_BASE		0xfeffb000
-#define	IXP2000_GPIO_SIZE		0x1000x+#define	IXP2000_TIMER_VIRT_BASE		0xfef20000
+#define	IXP2000_GPIO_VIRT_BASE		0Xfef10000
 
+/*
+ * Devices outside of the 0xc0000000 -> 0xc0100000 range
+ */
 #define IXP2000_INTCTL_PHYS_BASE	0xd6000000
-#define	IXP2000_INTCTL_VIRT_BASE	0xfeffa000
-#define	IXP2000_INTCTL_SIZE		0x01000x+#define	IXP2000_INTCTL_VIRT_BASE	0xfee00000
+#define	IXP2000_INTCTL_SIZE		0x00100000
 
 #define IXP2000_PCI_CREG_PHYS_BASE	0xde000000
-#define	IXP2000_PCI_CREG_VIRT_BASE	0xfeff0000
-#define	IXP2000_PCI_CREG_SIZE		0x1000x+#define	IXP2000_PCI_CREG_VIRT_BASE	0xfed00000
+#define	IXP2000_PCI_CREG_SIZE		0x00100000
 
 #define IXP2000_PCI_CSR_PHYS_BASE	0xdf000000
-#define	IXP2000_PCI_CSR_VIRT_BASE	0xfefde000
-#define	IXP2000_PCI_CSR_SIZE		0x1000x+#define	IXP2000_PCI_CSR_VIRT_BASE	0xfec00000
+#define	IXP2000_PCI_CSR_SIZE		0x00100000
 
 #define IXP2000_PCI_IO_PHYS_BASE	0xd8000000
 #define	IXP2000_PCI_IO_VIRT_BASE	0xfd000000
@@ -66,7 +74,6 @@
 #define IXP2000_PCI_CFG1_PHYS_BASE	0xdb000000
 #define IXP2000_PCI_CFG1_VIRT_BASE	0xfb000000
 #define IXP2000_PCI_CFG1_SIZE		0x01000000x-x 
 /* 
  * Timers
diff -Nru a/include/asm-arm/arch-ixp2000/platform.h b/include/asm-arm/arch-ixp2000/platform.h
--- a/include/asm-arm/arch-ixp2000/platform.h	2004-10-07 11:19:53 -07:00
+++ b/include/asm-arm/arch-ixp2000/platform.h	2005-03-04 12:34:53 -08:00
@@ -1,5 +1,5 @@
 /*
- * include/asm-arh/arch-ixp2000/platform.h
+ * include/asm-arm/arch-ixp2000/platform.h
  *
  * Various bits of code used by platform-level code.
  *
@@ -50,7 +50,7 @@
  * Boards may multiplex different devices on the 2nd channel of 
  * the slowport interface that each need different configuration 
  * settings.  For example, the IXDP2400 uses channel 2 on the interface 
- * to access the CPLD, the switch fabric card, and te media card.  Each 
+ * to access the CPLD, the switch fabric card, and the media card.  Each
  * one needs a different mode so drivers must save/restore the mode 
  * before and after each operation.  
  *
diff -Nru a/include/asm-arm/arch-ixp2000/system.h b/include/asm-arm/arch-ixp2000/system.h
--- a/include/asm-arm/arch-ixp2000/system.h	2004-12-22 13:07:23 -08:00
+++ b/include/asm-arm/arch-ixp2000/system.h	2005-02-13 16:35:09 -08:00
@@ -19,7 +19,7 @@
 
 static inline void arch_reset(char mode)
 {
-	cli();
+	local_irq_disable();
 
 	/*
 	 * Reset flash banking register so that we are pointing at
diff -Nru a/include/asm-arm/arch-ixp2000/vmalloc.h b/include/asm-arm/arch-ixp2000/vmalloc.h
--- a/include/asm-arm/arch-ixp2000/vmalloc.h	2004-08-09 12:51:20 -07:00
+++ b/include/asm-arm/arch-ixp2000/vmalloc.h	2005-02-16 15:49:43 -08:00
@@ -20,4 +20,4 @@
 #define VMALLOC_OFFSET	    (8*1024*1024)
 #define VMALLOC_START	    (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
 #define VMALLOC_VMADDR(x)   ((unsigned long)(x))
-#define VMALLOC_END	    0xfb000000
+#define VMALLOC_END	    0xfaffefff
diff -Nru a/include/asm-arm/arch-ixp4xx/platform.h b/include/asm-arm/arch-ixp4xx/platform.h
--- a/include/asm-arm/arch-ixp4xx/platform.h	2005-01-06 15:52:26 -08:00
+++ b/include/asm-arm/arch-ixp4xx/platform.h	2005-02-02 10:09:04 -08:00
@@ -15,6 +15,12 @@
 
 #include <asm/types.h>
 x+#ifndef	__ARMEB__
+#define	REG_OFFSET	0
+#else
+#define	REG_OFFSET	3
+#endif
+
 /*
  * Expansion bus memory regions
  */xdiff -Nru a/include/asm-arm/arch-pxa/corgi.h b/include/asm-arm/arch-pxa/corgi.h
--- a/include/asm-arm/arch-pxa/corgi.h	2005-01-20 13:59:19 -08:00
+++ b/include/asm-arm/arch-pxa/corgi.h	2005-03-06 12:23:51 -08:00
@@ -133,6 +133,10 @@
   unsigned int phadadj;
 };
 
+/*
+ * Shared data structures
+ */
+extern struct platform_device corgiscoop_device;x 
 /*
  * External Functionsxdiff -Nru a/include/asm-arm/arch-pxa/idp.h b/include/asm-arm/arch-pxa/idp.h
--- a/include/asm-arm/arch-pxa/idp.h	2003-09-20 02:40:38 -07:00
+++ b/include/asm-arm/arch-pxa/idp.h	2005-02-16 08:52:21 -08:00
@@ -10,20 +10,20 @@
  * 2001-09-13: Cliff Brake <cbrake@accelent.com>
  *             Initial code
  *
+ * 2005-02-15: Cliff Brake <cliff.brake@gmail.com>
+ *             <http://www.vibren.com> <http://bec-systems.com>
+ *             Changes for 2.6 kernel.
  */x 
 #include <linux/config.h>
 
 /*
  * Note: this file must be safe to include in assembly files
+ *
+ * Support for the Vibren PXA255 IDP requires rev04 or later
+ * IDP hardware.
  */x 
-/* comment out following if you have a rev01 board */x-#define PXA_IDP_REV02	1x-x-#ifdef PXA_IDP_REV02
-//Use this as well for 0017-x004 and greater pcb's:x-#define PXA_IDP_REV04 1
 
 #define IDP_FLASH_PHYS		(PXA_CS0_PHYS)
 #define IDP_ALT_FLASH_PHYS	(PXA_CS1_PHYS)
@@ -38,26 +38,18 @@
  * virtual memory map
  */x 
-#define IDP_IDE_BASE		(0xf0000000)
-#define IDP_IDE_SIZE		(1*1024*1024)
-#define IDE_REG_STRIDE		4x-x-#define IDP_ETH_BASE		(IDP_IDE_BASE + IDP_IDE_SIZE)x-#define IDP_ETH_SIZE		(1*1024*1024)
-#define ETH_BASE		IDP_ETH_BASE //smc9194 driver compatibility issuex-x-#define IDP_COREVOLT_BASE	(IDP_ETH_BASE + IDP_ETH_SIZE)
+#define IDP_COREVOLT_VIRT	(0xf0000000)
 #define IDP_COREVOLT_SIZE	(1*1024*1024)
 
-#define IDP_CPLD_BASE		(IDP_COREVOLT_BASE + IDP_COREVOLT_SIZE)
+#define IDP_CPLD_VIRT		(IDP_COREVOLT_VIRT + IDP_COREVOLT_SIZE)
 #define IDP_CPLD_SIZE		(1*1024*1024)
 x-#if (IDP_CPLD_BASE + IDP_CPLD_SIZE) > 0xfc000000
+#if (IDP_CPLD_VIRT + IDP_CPLD_SIZE) > 0xfc000000
 #error Your custom IO space is getting a bit large !!
 #endif
 
-#define CPLD_P2V(x)		((x) - IDP_CPLD_PHYS + IDP_CPLD_BASE)
-#define CPLD_V2P(x)		((x) - IDP_CPLD_BASE + IDP_CPLD_PHYS)
+#define CPLD_P2V(x)		((x) - IDP_CPLD_PHYS + IDP_CPLD_VIRT)
+#define CPLD_V2P(x)		((x) - IDP_CPLD_VIRT + IDP_CPLD_PHYS)
 
 #ifndef __ASSEMBLY__
 #  define __CPLD_REG(x)		(*((volatile unsigned long *)CPLD_P2V(x)))
@@ -65,7 +57,7 @@
 #  define __CPLD_REG(x)		CPLD_P2V(x)
 #endif
 
-/* board level registers in the CPLD: (offsets from CPLD_BASE) */
+/* board level registers in the CPLD: (offsets from CPLD_VIRT) */x 
 #define _IDP_CPLD_REV			(IDP_CPLD_PHYS + 0x00)
 #define _IDP_CPLD_PERIPH_PWR		(IDP_CPLD_PHYS + 0x04)
@@ -142,32 +134,10 @@
 
 #define PCC_DETECT(x)	(GPLR(7 + (x)) & GPIO_bit(7 + (x)))
 
-/*
- * Macros for LCD Driver
- */x-x-#ifdef CONFIG_FB_PXAx-x-#define FB_BACKLIGHT_ON()	(IDP_CPLD_LCD |= (1<<1))
-#define FB_BACKLIGHT_OFF() 	(IDP_CPLD_LCD &= ~(1<<1))
-
-#define FB_PWR_ON() 		(IDP_CPLD_LCD |= (1<< 0))
-#define FB_PWR_OFF() 		(IDP_CPLD_LCD &= ~(1<<0))
-
-#define FB_VLCD_ON()		(IDP_CPLD_LCD |= (1<<2))
-#define FB_VLCD_OFF() 		(IDP_CPLD_LCD &= ~(1<<2))
-
-#endif
-
 /* A listing of interrupts used by external hardware devices */x 
-#ifdef PXA_IDP_REV04
 #define TOUCH_PANEL_IRQ			IRQ_GPIO(5)
 #define IDE_IRQ				IRQ_GPIO(21)
-#else
-#define TOUCH_PANEL_IRQ			IRQ_GPIO(21)
-#define IDE_IRQ				IRQ_GPIO(5)
-#endif
 
 #define TOUCH_PANEL_IRQ_EDGE		IRQT_FALLING
 x@@ -196,7 +166,7 @@
 
 #define IDP_LEDS_MASK	(IDP_HB_LED | IDP_BUSY_LED)
 
-#define IDP_WRITE_LEDS(value)	(IDP_CPLD_LED_CONTROL = (IDP_CPLD_LED_CONTROL & (~(IDP_LEDS_MASK)) | value))
+#define IDP_WRITE_LEDS(value)	(IDP_CPLD_LED_CONTROL = (IDP_CPLD_LED_CONTROL & ((~(IDP_LEDS_MASK)) | value)))
 
 /*
  * macros for MTD driver
@@ -229,238 +199,4 @@
 	inputs = (IDP_CPLD_KB_ROW & 0x7f);\
 }
 
-#else
-
-/*
- * following is for rev01 boards only
- */x-x-#define IDP_FLASH_PHYS		(PXA_CS0_PHYS)
-#define IDP_ALT_FLASH_PHYS	(PXA_CS1_PHYS)
-#define IDP_MEDIAQ_PHYS		(PXA_CS3_PHYS)
-#define IDP_CTRL_PORT_PHYS	(PXA_CS5_PHYS + 0x02C00000)
-#define IDP_IDE_PHYS		(PXA_CS5_PHYS + 0x03000000)
-#define IDP_ETH_PHYS		(PXA_CS5_PHYS + 0x03400000)
-#define IDP_COREVOLT_PHYS	(PXA_CS5_PHYS + 0x03800000)
-#define IDP_CPLD_PHYS		(PXA_CS5_PHYS + 0x03C00000)
-
-
-/*
- * virtual memory map
- */x-x-#define IDP_CTRL_PORT_BASE	(0xf0000000)
-#define IDP_CTRL_PORT_SIZE	(1*1024*1024)
-
-#define IDP_IDE_BASE		(IDP_CTRL_PORT_BASE + IDP_CTRL_PORT_SIZE)
-#define IDP_IDE_SIZE		(1*1024*1024)
-x-#define IDP_ETH_BASE		(IDP_IDE_BASE + IDP_IDE_SIZE)x-#define IDP_ETH_SIZE		(1*1024*1024)
-x-#define IDP_COREVOLT_BASE	(IDP_ETH_BASE + IDP_ETH_SIZE)
-#define IDP_COREVOLT_SIZE	(1*1024*1024)
-
-#define IDP_CPLD_BASE		(IDP_COREVOLT_BASE + IDP_COREVOLT_SIZE)
-#define IDP_CPLD_SIZE		(1*1024*1024)
-x-#if (IDP_CPLD_BASE + IDP_CPLD_SIZE) > 0xfc000000
-#error Your custom IO space is getting a bit large !!
-#endif
-
-#define CPLD_P2V(x)		((x) - IDP_CPLD_PHYS + IDP_CPLD_BASE)
-#define CPLD_V2P(x)		((x) - IDP_CPLD_BASE + IDP_CPLD_PHYS)
-x-#ifndef __ASSEMBLY__
-#  define __CPLD_REG(x)		(*((volatile unsigned long *)CPLD_P2V(x)))
-#else
-#  define __CPLD_REG(x)		CPLD_P2V(x)
-#endif
-
-/* board level registers in the CPLD: (offsets from CPLD_BASE) */
-
-#define _IDP_CPLD_LED_CONTROL		(IDP_CPLD_PHYS + 0x00)
-#define _IDP_CPLD_PERIPH_PWR		(IDP_CPLD_PHYS + 0x04)
-#define _IDP_CPLD_CIR			(IDP_CPLD_PHYS + 0x08)
-#define _IDP_CPLD_KB_COL_HIGH		(IDP_CPLD_PHYS + 0x0C)
-#define _IDP_CPLD_KB_COL_LOW		(IDP_CPLD_PHYS + 0x10)
-#define _IDP_CPLD_PCCARD_EN		(IDP_CPLD_PHYS + 0x14)
-#define _IDP_CPLD_GPIOH_DIR		(IDP_CPLD_PHYS + 0x18)
-#define _IDP_CPLD_GPIOH_VALUE		(IDP_CPLD_PHYS + 0x1C)
-#define _IDP_CPLD_GPIOL_DIR		(IDP_CPLD_PHYS + 0x20)
-#define _IDP_CPLD_GPIOL_VALUE		(IDP_CPLD_PHYS + 0x24)
-#define _IDP_CPLD_MISC			(IDP_CPLD_PHYS + 0x28)
-#define _IDP_CPLD_PCCARD0_STATUS	(IDP_CPLD_PHYS + 0x2C)
-#define _IDP_CPLD_PCCARD1_STATUS	(IDP_CPLD_PHYS + 0x30)
-
-/* FPGA register virtual addresses */x-#define IDP_CPLD_LED_CONTROL		__CPLD_REG(_IDP_CPLD_LED_CONTROL)	/* write only */x-#define IDP_CPLD_PERIPH_PWR		__CPLD_REG(_IDP_CPLD_PERIPH_PWR)	/* write only */x-#define IDP_CPLD_CIR			__CPLD_REG(_IDP_CPLD_CIR)		/* write only */x-#define IDP_CPLD_KB_COL_HIGH		__CPLD_REG(_IDP_CPLD_KB_COL_HIGH)	/* write only */x-#define IDP_CPLD_KB_COL_LOW		__CPLD_REG(_IDP_CPLD_KB_COL_LOW)	/* write only */x-#define IDP_CPLD_PCCARD_EN		__CPLD_REG(_IDP_CPLD_PCCARD_EN)		/* write only */x-#define IDP_CPLD_GPIOH_DIR		__CPLD_REG(_IDP_CPLD_GPIOH_DIR)		/* write only */x-#define IDP_CPLD_GPIOH_VALUE		__CPLD_REG(_IDP_CPLD_GPIOH_VALUE)	/* write only */x-#define IDP_CPLD_GPIOL_DIR		__CPLD_REG(_IDP_CPLD_GPIOL_DIR)		/* write only */x-#define IDP_CPLD_GPIOL_VALUE		__CPLD_REG(_IDP_CPLD_GPIOL_VALUE)	/* write only */x-#define IDP_CPLD_MISC			__CPLD_REG(_IDP_CPLD_MISC)		/* read only */x-#define IDP_CPLD_PCCARD0_STATUS		__CPLD_REG(_IDP_CPLD_PCCARD0_STATUS)	/* read only */x-#define IDP_CPLD_PCCARD1_STATUS		__CPLD_REG(_IDP_CPLD_PCCARD1_STATUS)	/* read only */x-
-x-#ifndef __ASSEMBLY__
-
-/* shadow registers for write only registers */x-extern unsigned int idp_cpld_led_control_shadow;x-extern unsigned int idp_cpld_periph_pwr_shadow;x-extern unsigned int idp_cpld_cir_shadow;x-extern unsigned int idp_cpld_kb_col_high_shadow;x-extern unsigned int idp_cpld_kb_col_low_shadow;x-extern unsigned int idp_cpld_pccard_en_shadow;x-extern unsigned int idp_cpld_gpioh_dir_shadow;x-extern unsigned int idp_cpld_gpioh_value_shadow;x-extern unsigned int idp_cpld_gpiol_dir_shadow;x-extern unsigned int idp_cpld_gpiol_value_shadow;x-x-extern unsigned int idp_control_port_shadow;x-x-/*
- * macros to write to write only register
- *
- * none of these macros are protected from
- * multiple drivers using them in interrupt context.
- */x-x-#define WRITE_IDP_CPLD_LED_CONTROL(value, mask) \
-{\
-	idp_cpld_led_control_shadow = (((value & mask) | (idp_cpld_led_control_shadow & ~mask)));\
-	IDP_CPLD_LED_CONTROL = idp_cpld_led_control_shadow;\
-}x-#define WRITE_IDP_CPLD_PERIPH_PWR(value, mask) \
-{\
-	idp_cpld_periph_pwr_shadow = ((value & mask) | (idp_cpld_periph_pwr_shadow & ~mask));\
-	IDP_CPLD_PERIPH_PWR = idp_cpld_periph_pwr_shadow;\
-}x-#define WRITE_IDP_CPLD_CIR(value, mask) \
-{\
-	idp_cpld_cir_shadow = ((value & mask) | (idp_cpld_cir_shadow & ~mask));\
-	IDP_CPLD_CIR = idp_cpld_cir_shadow;\
-}x-#define WRITE_IDP_CPLD_KB_COL_HIGH(value, mask) \
-{\
-	idp_cpld_kb_col_high_shadow = ((value & mask) | (idp_cpld_kb_col_high_shadow & ~mask));\
-	IDP_CPLD_KB_COL_HIGH = idp_cpld_kb_col_high_shadow;\
-}x-#define WRITE_IDP_CPLD_KB_COL_LOW(value, mask) \
-{\
-	idp_cpld_kb_col_low_shadow = ((value & mask) | (idp_cpld_kb_col_low_shadow & ~mask));\
-	IDP_CPLD_KB_COL_LOW = idp_cpld_kb_col_low_shadow;\
-}x-#define WRITE_IDP_CPLD_PCCARD_EN(value, mask) \
-{\
-	idp_cpld_ = ((value & mask) | (idp_cpld_led_control_shadow & ~mask));\
-	IDP_CPLD_LED_CONTROL = idp_cpld_led_control_shadow;\
-}x-#define WRITE_IDP_CPLD_GPIOH_DIR(value, mask) \
-{\
-	idp_cpld_gpioh_dir_shadow = ((value & mask) | (idp_cpld_gpioh_dir_shadow & ~mask));\
-	IDP_CPLD_GPIOH_DIR = idp_cpld_gpioh_dir_shadow;\
-}x-#define WRITE_IDP_CPLD_GPIOH_VALUE(value, mask) \
-{\
-	idp_cpld_gpioh_value_shadow = ((value & mask) | (idp_cpld_gpioh_value_shadow & ~mask));\
-	IDP_CPLD_GPIOH_VALUE = idp_cpld_gpioh_value_shadow;\
-}x-#define WRITE_IDP_CPLD_GPIOL_DIR(value, mask) \
-{\
-	idp_cpld_gpiol_dir_shadow = ((value & mask) | (idp_cpld_gpiol_dir_shadow & ~mask));\
-	IDP_CPLD_GPIOL_DIR = idp_cpld_gpiol_dir_shadow;\
-}x-#define WRITE_IDP_CPLD_GPIOL_VALUE(value, mask) \
-{\
-	idp_cpld_gpiol_value_shadow = ((value & mask) | (idp_cpld_gpiol_value_shadow & ~mask));\
-	IDP_CPLD_GPIOL_VALUE = idp_cpld_gpiol_value_shadow;\
-}x-x-#define WRITE_IDP_CONTROL_PORT(value, mask) \
-{\
-	idp_control_port_shadow = ((value & mask) | (idp_control_port_shadow & ~mask));\
-	(*((volatile unsigned long *)IDP_CTRL_PORT_BASE)) = idp_control_port_shadow;\
-}x-x-#endif
-
-/* A listing of interrupts used by external hardware devices */x-
-#define TOUCH_PANEL_IRQ			IRQ_GPIO(21)
-#define TOUCH_PANEL_IRQ_EGDE		IRQT_FALLING
-
-#define ETHERNET_IRQ			IRQ_GPIO(4)
-#define ETHERNET_IRQ_EDGE		IRQT_RISING
-
-/*
- * Bit masks for various registers
- */x-x-
-/* control port */x-#define IDP_CONTROL_PORT_PCSLOT0_0	(1 << 0)x-#define IDP_CONTROL_PORT_PCSLOT0_1	(1 << 1)x-#define IDP_CONTROL_PORT_PCSLOT0_2	(1 << 2)x-#define IDP_CONTROL_PORT_PCSLOT0_3	(1 << 3)x-#define IDP_CONTROL_PORT_PCSLOT1_1	(1 << 4)x-#define IDP_CONTROL_PORT_PCSLOT1_2	(1 << 5)x-#define IDP_CONTROL_PORT_PCSLOT1_3	(1 << 6)x-#define IDP_CONTROL_PORT_PCSLOT1_4	(1 << 7)x-#define IDP_CONTROL_PORT_SERIAL1_EN	(1 << 9)x-#define IDP_CONTROL_PORT_SERIAL2_EN	(1 << 10)x-#define IDP_CONTROL_PORT_SERIAL3_EN	(1 << 11)x-#define IDP_CONTROL_PORT_IRDA_FIR	(1 << 12)x-#define IDP_CONTROL_PORT_IRDA_M0	(1 << 13)x-#define IDP_CONTROL_PORT_IRDA_M1	(1 << 14)x-#define IDP_CONTROL_PORT_I2S_PWR	(1 << 15)x-#define IDP_CONTROL_PORT_FLASH_WP	(1 << 19)x-#define IDP_CONTROL_PORT_MILL_EN	(1 << 20)x-#define IDP_CONTROL_PORT_LCD_PWR	(1 << 21)x-#define IDP_CONTROL_PORT_LCD_BKLEN	(1 << 22)x-#define IDP_CONTROL_PORT_LCD_ENAVLCD	(1 << 23)
-
-/*
- * Macros for LCD Driver
- */x-x-#ifdef CONFIG_FB_PXAx-x-#define FB_BACKLIGHT_ON() WRITE_IDP_CONTROL_PORT(IDP_CONTROL_PORT_LCD_BKLEN, IDP_CONTROL_PORT_LCD_BKLEN)
-#define FB_BACKLIGHT_OFF() WRITE_IDP_CONTROL_PORT(0, IDP_CONTROL_PORT_LCD_BKLEN)
-
-#define FB_PWR_ON() WRITE_IDP_CONTROL_PORT(IDP_CONTROL_PORT_LCD_PWR, IDP_CONTROL_PORT_LCD_PWR)
-#define FB_PWR_OFF() WRITE_IDP_CONTROL_PORT(0, IDP_CONTROL_PORT_LCD_PWR)
-
-#define FB_VLCD_ON() WRITE_IDP_CONTROL_PORT(IDP_CONTROL_PORT_LCD_ENAVLCD, IDP_CONTROL_PORT_LCD_ENAVLCD)
-#define FB_VLCD_OFF() WRITE_IDP_CONTROL_PORT(0, IDP_CONTROL_PORT_LCD_ENAVLCD)
-
-#endif
 
-
-/*
- * Macros for LED Driver
- */x-x-/* leds 0 = ON */x-#define IDP_HB_LED	0x1x-#define IDP_BUSY_LED	0x2
-
-#define IDP_LEDS_MASK	(IDP_HB_LED | IDP_BUSY_LED)
-
-#define IDP_WRITE_LEDS(value) 	WRITE_IDP_CPLD_LED_CONTROL(value, IDP_LEDS_MASK)x-x-/*
- * macros for MTD driver
- */x-x-#define FLASH_WRITE_PROTECT_DISABLE()	WRITE_IDP_CONTROL_PORT(0, IDP_CONTROL_PORT_FLASH_WP)x-#define FLASH_WRITE_PROTECT_ENABLE()	WRITE_IDP_CONTROL_PORT(IDP_CONTROL_PORT_FLASH_WP, IDP_CONTROL_PORT_FLASH_WP)x-
-#endif
diff -Nru a/include/asm-arm/arch-pxa/irqs.h b/include/asm-arm/arch-pxa/irqs.h
--- a/include/asm-arm/arch-pxa/irqs.h	2004-08-26 11:40:54 -07:00
+++ b/include/asm-arm/arch-pxa/irqs.h	2005-03-02 16:00:00 -08:00
@@ -140,14 +140,41 @@
 #define IRQ_S0_BVD1_STSCHG	(IRQ_BOARD_END + 53)
 #define IRQ_S1_BVD1_STSCHG	(IRQ_BOARD_END + 54)
 x+#define IRQ_LOCOMO_START	(IRQ_BOARD_END)x+#define IRQ_LOCOMO_KEY		(IRQ_BOARD_END + 0)x+#define IRQ_LOCOMO_GPIO0	(IRQ_BOARD_END + 1)x+#define IRQ_LOCOMO_GPIO1	(IRQ_BOARD_END + 2)x+#define IRQ_LOCOMO_GPIO2	(IRQ_BOARD_END + 3)x+#define IRQ_LOCOMO_GPIO3	(IRQ_BOARD_END + 4)x+#define IRQ_LOCOMO_GPIO4	(IRQ_BOARD_END + 5)x+#define IRQ_LOCOMO_GPIO5	(IRQ_BOARD_END + 6)x+#define IRQ_LOCOMO_GPIO6	(IRQ_BOARD_END + 7)x+#define IRQ_LOCOMO_GPIO7	(IRQ_BOARD_END + 8)x+#define IRQ_LOCOMO_GPIO8	(IRQ_BOARD_END + 9)x+#define IRQ_LOCOMO_GPIO9	(IRQ_BOARD_END + 10)x+#define IRQ_LOCOMO_GPIO10	(IRQ_BOARD_END + 11)x+#define IRQ_LOCOMO_GPIO11	(IRQ_BOARD_END + 12)x+#define IRQ_LOCOMO_GPIO12	(IRQ_BOARD_END + 13)x+#define IRQ_LOCOMO_GPIO13	(IRQ_BOARD_END + 14)x+#define IRQ_LOCOMO_GPIO14	(IRQ_BOARD_END + 15)x+#define IRQ_LOCOMO_GPIO15	(IRQ_BOARD_END + 16)x+#define IRQ_LOCOMO_LT		(IRQ_BOARD_END + 17)x+#define IRQ_LOCOMO_SPI_RFR	(IRQ_BOARD_END + 18)x+#define IRQ_LOCOMO_SPI_RFW	(IRQ_BOARD_END + 19)x+#define IRQ_LOCOMO_SPI_OVRN	(IRQ_BOARD_END + 20)x+#define IRQ_LOCOMO_SPI_TEND	(IRQ_BOARD_END + 21)
+
 /*
  * Figure out the MAX IRQ number.
  *
  * If we have an SA1111, the max IRQ is S1_BVD1_STSCHG+1.
+ * If we have an LoCoMo, the max IRQ is IRQ_LOCOMO_SPI_TEND+1
  * Otherwise, we have the standard IRQs only.
  */x #ifdef CONFIG_SA1111
 #define NR_IRQS			(IRQ_S1_BVD1_STSCHG + 1)x+#elif defined(CONFIG_SHARP_LOCOMO)x+#define NR_IRQS			(IRQ_LOCOMO_SPI_TEND + 1)x #elif defined(CONFIG_ARCH_LUBBOCK) || \
       defined(CONFIG_MACH_MAINSTONE)
 #define NR_IRQS			(IRQ_BOARD_END)x@@ -185,3 +212,8 @@
 #define MAINSTONE_S1_STSCHG_IRQ	MAINSTONE_IRQ(14)
 #define MAINSTONE_S1_IRQ	MAINSTONE_IRQ(15)
 
+/* LoCoMo Interrupts (CONFIG_SHARP_LOCOMO) */x+#define IRQ_LOCOMO_KEY_BASE	(IRQ_BOARD_START + 0)x+#define IRQ_LOCOMO_GPIO_BASE	(IRQ_BOARD_START + 1)x+#define IRQ_LOCOMO_LT_BASE	(IRQ_BOARD_START + 2)x+#define IRQ_LOCOMO_SPI_BASE	(IRQ_BOARD_START + 3)
diff -Nru a/include/asm-arm/arch-pxa/poodle.h b/include/asm-arm/arch-pxa/poodle.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-arm/arch-pxa/poodle.h	2005-03-02 16:00:00 -08:00
@@ -0,0 +1,111 @@
+/*
+ * linux/include/asm-arm/arch-pxa/poodle.h
+ *
+ * May be copied or modified under the terms of the GNU General Public
+ * License.  See linux/COPYING for more information.
+ *
+ * Based on:
+ *   linux/include/asm-arm/arch-sa1100/collie.h
+ *
+ * ChangeLog:
+ *   04-06-2001 Lineo Japan, Inc.
+ *   04-16-2001 SHARP Corporation
+ *   Update to 2.6 John Lenz
+ */
+#ifndef __ASM_ARCH_POODLE_H
+#define __ASM_ARCH_POODLE_H  1
+
+/*
+ * GPIOs
+ */
+/* PXA GPIOs */x+#define POODLE_GPIO_ON_KEY		(0)x+#define POODLE_GPIO_AC_IN		(1)x+#define POODLE_GPIO_CO			16x+#define POODLE_GPIO_TP_INT		(5)x+#define POODLE_GPIO_WAKEUP		(11)	/* change battery */x+#define POODLE_GPIO_GA_INT		(10)x+#define POODLE_GPIO_IR_ON		(22)x+#define POODLE_GPIO_HP_IN		(4)x+#define POODLE_GPIO_CF_IRQ		(17)x+#define POODLE_GPIO_CF_CD		(14)x+#define POODLE_GPIO_CF_STSCHG		(14)x+#define POODLE_GPIO_SD_PWR		(33)x+#define POODLE_GPIO_nSD_CLK		(6)x+#define POODLE_GPIO_nSD_WP		(7)x+#define POODLE_GPIO_nSD_INT		(8)x+#define POODLE_GPIO_nSD_DETECT		(9)x+#define POODLE_GPIO_MAIN_BAT_LOW	(13)x+#define POODLE_GPIO_BAT_COVER		(13)x+#define POODLE_GPIO_ADC_TEMP_ON		(21)x+#define POODLE_GPIO_BYPASS_ON		(36)x+#define POODLE_GPIO_CHRG_ON		(38)x+#define POODLE_GPIO_CHRG_FULL		(16)x+
+/* PXA GPIOs */x+#define POODLE_IRQ_GPIO_ON_KEY		IRQ_GPIO0x+#define POODLE_IRQ_GPIO_AC_IN		IRQ_GPIO1x+#define POODLE_IRQ_GPIO_HP_IN		IRQ_GPIO4x+#define POODLE_IRQ_GPIO_CO		IRQ_GPIO16x+#define POODLE_IRQ_GPIO_TP_INT		IRQ_GPIO5x+#define POODLE_IRQ_GPIO_WAKEUP		IRQ_GPIO11x+#define POODLE_IRQ_GPIO_GA_INT		IRQ_GPIO10x+#define POODLE_IRQ_GPIO_CF_IRQ		IRQ_GPIO17x+#define POODLE_IRQ_GPIO_CF_CD		IRQ_GPIO14x+#define POODLE_IRQ_GPIO_nSD_INT		IRQ_GPIO8x+#define POODLE_IRQ_GPIO_nSD_DETECT	IRQ_GPIO9x+#define POODLE_IRQ_GPIO_MAIN_BAT_LOW	IRQ_GPIO13x+
+/* SCOOP GPIOs */x+#define POODLE_SCOOP_CHARGE_ON	SCOOP_GPCR_PA11x+#define POODLE_SCOOP_CP401	SCOOP_GPCR_PA13x+#define POODLE_SCOOP_VPEN	SCOOP_GPCR_PA18x+#define POODLE_SCOOP_L_PCLK	SCOOP_GPCR_PA20x+#define POODLE_SCOOP_L_LCLK	SCOOP_GPCR_PA21x+#define POODLE_SCOOP_HS_OUT	SCOOP_GPCR_PA22
+
+#define POODLE_SCOOP_IO_DIR	( POODLE_SCOOP_VPEN | POODLE_SCOOP_HS_OUT )
+#define POODLE_SCOOP_IO_OUT	( 0 )
+
+/*
+ * Flash Memory mappings
+ *
+ * We have the following mapping:
+ *                      phys            virt
+ *      boot ROM        00000000        ef800000
+ */
+#define FLASH_MEM_BASE	0xa0000a00
+#define	FLASH_DATA(adr) (*(volatile unsigned int*)(FLASH_MEM_BASE+(adr)))
+#define	FLASH_DATA_F(adr) (*(volatile float32 *)(FLASH_MEM_BASE+(adr)))
+#define FLASH_MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 )  | ( b << 8 ) | a )
+
+/* COMADJ */
+#define FLASH_COMADJ_MAJIC	FLASH_MAGIC_CHG('C','M','A','D')
+#define	FLASH_COMADJ_MAGIC_ADR	0x00
+#define	FLASH_COMADJ_DATA_ADR	0x04
+
+/* UUID */
+#define FLASH_UUID_MAJIC	FLASH_MAGIC_CHG('U','U','I','D')
+#define	FLASH_UUID_MAGIC_ADR	0x08
+#define	FLASH_UUID_DATA_ADR	0x0C
+
+/* TOUCH PANEL */
+#define FLASH_TOUCH_MAJIC	FLASH_MAGIC_CHG('T','U','C','H')
+#define	FLASH_TOUCH_MAGIC_ADR	0x1C
+#define	FLASH_TOUCH_XP_DATA_ADR	0x20
+#define	FLASH_TOUCH_YP_DATA_ADR	0x24
+#define	FLASH_TOUCH_XD_DATA_ADR	0x28
+#define	FLASH_TOUCH_YD_DATA_ADR	0x2C
+
+/* AD */
+#define FLASH_AD_MAJIC	FLASH_MAGIC_CHG('B','V','A','D')
+#define	FLASH_AD_MAGIC_ADR	0x30
+#define	FLASH_AD_DATA_ADR	0x34
+
+/* PHAD */
+#define FLASH_PHAD_MAJIC	FLASH_MAGIC_CHG('P','H','A','D')
+#define	FLASH_PHAD_MAGIC_ADR	0x38
+#define	FLASH_PHAD_DATA_ADR	0x3C
+
+
+#endif /* __ASM_ARCH_POODLE_H  */xdiff -Nru a/include/asm-arm/arch-s3c2410/hardware.h b/include/asm-arm/arch-s3c2410/hardware.h
--- a/include/asm-arm/arch-s3c2410/hardware.h	2004-10-17 15:21:22 -07:00
+++ b/include/asm-arm/arch-s3c2410/hardware.h	2005-03-03 06:10:27 -08:00
@@ -97,11 +97,7 @@
 #include <asm/sizes.h>
 #include <asm/arch/map.h>
 
-/* machine specific includes, such as the BAST */x-x-#if defined(CONFIG_ARCH_BAST)x-#include <asm/arch/bast-cpld.h>
-#endif
+/* machine specific hardware definitions should go after this */x 
 /* currently here until moved into config (todo) */
 #define CONFIG_NO_MULTIWORD_IOxdiff -Nru a/include/asm-arm/arch-s3c2410/irqs.h b/include/asm-arm/arch-s3c2410/irqs.h
--- a/include/asm-arm/arch-s3c2410/irqs.h	2004-04-02 07:45:47 -08:00
+++ b/include/asm-arm/arch-s3c2410/irqs.h	2005-02-28 16:54:26 -08:00
@@ -1,6 +1,6 @@
 /* linux/include/asm-arm/arch-s3c2410/irqs.h
  *
- * Copyright (c) 2003 Simtec Electronics
+ * Copyright (c) 2003-2005 Simtec Electronics
  *   Ben Dooks <ben@simtec.co.uk>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -11,6 +11,8 @@
  *  12-May-2003 BJD  Created file
  *  08-Jan-2003 BJD  Linux 2.6.0 version, moved BAST bits out
  *  12-Mar-2004 BJD  Fixed bug in header protection
+ *  10-Feb-2005 BJD  Added camera IRQ from guillaume.gourat@nexvision.tv
+ *  28-Feb-2005 BJD  Updated s3c2440 IRQs
  */x 
 x@@ -35,7 +37,8 @@
 #define IRQ_EINT3      S3C2410_IRQ(3)
 #define IRQ_EINT4t7    S3C2410_IRQ(4)	    /* 20 */
 #define IRQ_EINT8t23   S3C2410_IRQ(5)x-#define IRQ_RESERVED6  S3C2410_IRQ(6)x+#define IRQ_RESERVED6  S3C2410_IRQ(6)	    /* for s3c2410 */x+#define IRQ_CAM        S3C2410_IRQ(6)	    /* for s3c2440 */
 #define IRQ_BATT_FLT   S3C2410_IRQ(7)
 #define IRQ_TICK       S3C2410_IRQ(8)	    /* 24 */
 #define IRQ_WDT	       S3C2410_IRQ(9)x@@ -54,6 +57,7 @@
 #define IRQ_SPI0       S3C2410_IRQ(22)x #define IRQ_UART1      S3C2410_IRQ(23)
 #define IRQ_RESERVED24 S3C2410_IRQ(24)	    /* 40 */x+#define IRQ_NFCON      S3C2410_IRQ(24)	    /* for s3c2440 */
 #define IRQ_USBD       S3C2410_IRQ(25)
 #define IRQ_USBH       S3C2410_IRQ(26)
 #define IRQ_IIC	       S3C2410_IRQ(27)x@@ -109,7 +113,14 @@
 #define IRQ_TC		 S3C2410_IRQ(63)
 #define IRQ_ADC		 S3C2410_IRQ(64)
 
-#define NR_IRQS (IRQ_ADC+1)x+/* extra irqs for s3c2440 */
+x+#define IRQ_S3C2440_CAM_C	S3C2410_IRQ(65)x+#define IRQ_S3C2440_CAM_P	S3C2410_IRQ(66)x+#define IRQ_S3C2440_WDT		S3C2410_IRQ(67)x+#define IRQ_S3C2440_AC97	S3C2410_IRQ(68)
+x+#define NR_IRQS (IRQ_S3C2440_AC97+1)x 
 
 #endif /* __ASM_ARCH_IRQ_H */xdiff -Nru a/include/asm-arm/arch-s3c2410/map.h b/include/asm-arm/arch-s3c2410/map.h
--- a/include/asm-arm/arch-s3c2410/map.h	2004-04-02 07:45:47 -08:00
+++ b/include/asm-arm/arch-s3c2410/map.h	2005-02-10 09:35:15 -08:00
@@ -12,6 +12,7 @@
  * Changelog:
  *  12-May-2003 BJD  Created file
  *  06-Jan-2003 BJD  Linux 2.6.0 version, moved bast specifics out
+ *  10-Feb-2005 BJD  Added CAMIF definition from guillaume.gourat@nexvision.tv
 */x 
 #ifndef __ASM_ARCH_MAP_H
@@ -123,6 +124,10 @@
 #define S3C2410_VA_SDI	   S3C2410_ADDR(0x01200000)
 #define S3C2410_PA_SDI	   (0x5A000000)
 #define S3C2410_SZ_SDI	   SZ_1M
+
+/* CAMIF */x+#define S3C2440_PA_CAMIF   (0x4F000000)
+#define S3C2440_SZ_CAMIF   SZ_1M
 
 /* ISA style IO, for each machine to sort out mappings for, if it
  * implements it. We reserve two 16M regions for ISA.xdiff -Nru a/include/asm-arm/arch-s3c2410/regs-adc.h b/include/asm-arm/arch-s3c2410/regs-adc.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-arm/arch-s3c2410/regs-adc.h	2005-02-22 10:03:36 -08:00
@@ -0,0 +1,63 @@
+/* linux/include/asm/arch-s3c2410/regs-adc.h
+ *
+ * Copyright (c) 2004 Shannon Holland <holland@loser.net>
+ *
+ * This program is free software; yosu 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.
+ *
+ * S3C2410 ADC registers
+ *
+ *  Changelog:
+ *    27-09-2004     SAH     Created file
+*/
+x+#ifndef __ASM_ARCH_REGS_ADC_H
+#define __ASM_ARCH_REGS_ADC_H "regs-adc.h"
+x+#define S3C2410_ADCREG(x) (x)
+
+#define S3C2410_ADCCON	   S3C2410_ADCREG(0x00)
+#define S3C2410_ADCTSC	   S3C2410_ADCREG(0x04)
+#define S3C2410_ADCDLY	   S3C2410_ADCREG(0x08)
+#define S3C2410_ADCDAT0	   S3C2410_ADCREG(0x0C)
+#define S3C2410_ADCDAT1	   S3C2410_ADCREG(0x10)x+
+
+/* ADCCON Register Bits */x+#define S3C2410_ADCCON_ECFLG		(1<<15)x+#define S3C2410_ADCCON_PRSCEN		(1<<14)x+#define S3C2410_ADCCON_PRSCVL(x)	(((x)&0xFF)<<6)x+#define S3C2410_ADCCON_PRSCVLMASK	(0xFF<<6)x+#define S3C2410_ADCCON_SELMUX(x)	(((x)&0x7)<<3)x+#define S3C2410_ADCCON_MUXMASK		(0x7<<3)x+#define S3C2410_ADCCON_STDBM		(1<<2)x+#define S3C2410_ADCCON_READ_START	(1<<1)x+#define S3C2410_ADCCON_ENABLE_START	(1<<0)x+#define S3C2410_ADCCON_STARTMASK	(0x3<<0)x+
+
+/* ADCTSC Register Bits */x+#define S3C2410_ADCTSC_YM_SEN		(1<<7)x+#define S3C2410_ADCTSC_YP_SEN		(1<<6)x+#define S3C2410_ADCTSC_XM_SEN		(1<<5)x+#define S3C2410_ADCTSC_XP_SEN		(1<<4)x+#define S3C2410_ADCTSC_PULL_UP_DISABLE	(1<<3)x+#define S3C2410_ADCTSC_AUTO_PST		(1<<2)x+#define S3C2410_ADCTSC_XY_PST		(0x3<<0)x+
+/* ADCDAT0 Bits */x+#define S3C2410_ADCDAT0_UPDOWN		(1<<15)x+#define S3C2410_ADCDAT0_AUTO_PST	(1<<14)x+#define S3C2410_ADCDAT0_XY_PST		(0x3<<12)x+#define S3C2410_ADCDAT0_XPDATA_MASK	(0x03FF)x+
+/* ADCDAT1 Bits */x+#define S3C2410_ADCDAT1_UPDOWN		(1<<15)x+#define S3C2410_ADCDAT1_AUTO_PST	(1<<14)x+#define S3C2410_ADCDAT1_XY_PST		(0x3<<12)x+#define S3C2410_ADCDAT1_YPDATA_MASK	(0x03FF)x+
+#endif /* __ASM_ARCH_REGS_ADC_H */
+x+xdiff -Nru a/include/asm-arm/arch-s3c2410/regs-serial.h b/include/asm-arm/arch-s3c2410/regs-serial.h
--- a/include/asm-arm/arch-s3c2410/regs-serial.h	2005-01-28 03:11:43 -08:00
+++ b/include/asm-arm/arch-s3c2410/regs-serial.h	2005-03-06 04:59:10 -08:00
@@ -73,6 +73,11 @@
 #define S3C2440_UCON_UCLK	  (1<<10)
 #define S3C2440_UCON_PCLK2	  (2<<10)
 #define S3C2440_UCON_FCLK	  (3<<10)
+#define S3C2440_UCON2_FCLK_EN	  (1<<15)
+#define S3C2440_UCON0_DIVMASK	  (15 << 12)x+#define S3C2440_UCON1_DIVMASK	  (15 << 12)x+#define S3C2440_UCON2_DIVMASK	  (7 << 12)x+#define S3C2440_UCON_DIVSHIFT	  (12)
 
 #define S3C2410_UCON_UCLK	  (1<<10)
 #define S3C2410_UCON_SBREAK	  (1<<4)xdiff -Nru a/include/asm-arm/arch-s3c2410/regs-timer.h b/include/asm-arm/arch-s3c2410/regs-timer.h
--- a/include/asm-arm/arch-s3c2410/regs-timer.h	2004-08-29 16:43:36 -07:00
+++ b/include/asm-arm/arch-s3c2410/regs-timer.h	2005-02-10 16:04:43 -08:00
@@ -13,6 +13,7 @@
  *    05-06-2003     BJD     Created file
  *    26-06-2003     BJD     Added more timer definitions to mux / control
  *    12-03-2004     BJD     Updated include protection
+ *    10-02-2005     BJD     Added S3C2410_TCFG1_MUX4_SHIFT (Guillaume Gourat)
 */x 
 x@@ -38,6 +39,7 @@
 #define S3C2410_TCFG1_MUX4_DIV16  (3<<16)
 #define S3C2410_TCFG1_MUX4_TCLK1  (4<<16)
 #define S3C2410_TCFG1_MUX4_MASK	  (15<<16)
+#define S3C2410_TCFG1_MUX4_SHIFT  (16)x 
 #define S3C2410_TCFG1_MUX3_DIV2	  (0<<12)x #define S3C2410_TCFG1_MUX3_DIV4	  (1<<12)xdiff -Nru a/include/asm-arm/arch-s3c2410/uncompress.h b/include/asm-arm/arch-s3c2410/uncompress.h
--- a/include/asm-arm/arch-s3c2410/uncompress.h	2004-11-15 07:27:40 -08:00
+++ b/include/asm-arm/arch-s3c2410/uncompress.h	2005-02-25 04:16:22 -08:00
@@ -15,6 +15,7 @@
  *  12-Mar-2004 BJD  Updated header protection
  *  12-Oct-2004 BJD  Take account of debug uart configuration
  *  15-Nov-2004 BJD  Fixed uart configuration
+ *  22-Feb-2005 BJD  Added watchdog to uncompress
 */x 
 #ifndef __ASM_ARCH_UNCOMPRESS_H
@@ -25,12 +26,16 @@
 /* defines for UART registers */x #include "asm/arch/regs-serial.h"x #include "asm/arch/regs-gpio.h"
+#include "asm/arch/regs-watchdog.h"x 
 #include <asm/arch/map.h>
 
 /* working in physical space... */x #undef S3C2410_GPIOREG
+#undef S3C2410_WDOGREG
+x #define S3C2410_GPIOREG(x) ((S3C2410_PA_GPIO + (x)))
+#define S3C2410_WDOGREG(x) ((S3C2410_PA_WATCHDOG + (x)))
 
 /* how many bytes we allow into the FIFO at a time in FIFO mode */
 #define FIFO_MAX	 (14)x@@ -56,21 +61,6 @@
 }x 
 x-/* currently we do not need the watchdog... */x-#define arch_decomp_wdog()
-
-
-static void error(char *err);
-
-static void
-arch_decomp_setup(void)
-{
-	/* we may need to setup the uart(s) here if we are not running
-	 * on an BAST... the BAST will have left the uarts configured
-	 * after calling linux.
-	 */
-}x-x /* we can deal with the case the UARTs are being run
  * in FIFO mode, so that we don't hold up our execution
  * waiting for tx to happen...
@@ -121,5 +111,48 @@
 		putc(*ptr);
 	}
 }x+
+/* CONFIG_S3C2410_BOOT_WATCHDOG
+ *
+ * Simple boot-time watchdog setup, to reboot the system if there is
+ * any problem with the boot process
+*/
+x+#ifdef CONFIG_S3C2410_BOOT_WATCHDOG
+
+#define WDOG_COUNT (0xff00)
+
+#define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0)
+
+static inline void arch_decomp_wdog(void)
+{
+	__raw_writel(WDOG_COUNT, S3C2410_WTCNT);
+}
+
+static void arch_decomp_wdog_start(void)
+{
+	__raw_writel(WDOG_COUNT, S3C2410_WTDAT);
+	__raw_writel(WDOG_COUNT, S3C2410_WTCNT);
+	__raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x40), S3C2410_WTCON);
+}
+
+#else
+#define arch_decomp_wdog_start()
+#define arch_decomp_wdog()
+#endif
+
+static void error(char *err);
+
+static void
+arch_decomp_setup(void)
+{
+	/* we may need to setup the uart(s) here if we are not running
+	 * on an BAST... the BAST will have left the uarts configured
+	 * after calling linux.
+	 */
+x+	arch_decomp_wdog_start();
+}
+
 
 #endif /* __ASM_ARCH_UNCOMPRESS_H */xdiff -Nru a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h
--- a/include/asm-arm/cacheflush.h	2004-11-05 02:53:14 -08:00
+++ b/include/asm-arm/cacheflush.h	2005-03-05 21:15:17 -08:00
@@ -237,16 +237,16 @@
  * space" model to handle this.
  */x #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
-	do {					\
-		flush_cache_page(vma, vaddr);	\
-		memcpy(dst, src, len);		\
-		flush_dcache_page(page);	\
+	do {							\
+		flush_cache_page(vma, vaddr, page_to_pfn(page));\
+		memcpy(dst, src, len);				\
+		flush_dcache_page(page);			\
 	} while (0)
 x #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
-	do {					\
-		flush_cache_page(vma, vaddr);	\
-		memcpy(dst, src, len);		\
+	do {							\
+		flush_cache_page(vma, vaddr, page_to_pfn(page));\
+		memcpy(dst, src, len);				\
 	} while (0)
 x /*
@@ -269,7 +269,7 @@
 }x 
 static inline void
-flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr)
+flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn)
 {
 	if (cpu_isset(smp_processor_id(), vma->vm_mm->cpu_vm_mask)) {
 		unsigned long addr = user_addr & PAGE_MASK;x@@ -312,9 +312,9 @@
 extern void flush_dcache_page(struct page *);
 x #define flush_dcache_mmap_lock(mapping) \
-	spin_lock_irq(&(mapping)->tree_lock)
+	write_lock_irq(&(mapping)->tree_lock)
 #define flush_dcache_mmap_unlock(mapping) \
-	spin_unlock_irq(&(mapping)->tree_lock)
+	write_unlock_irq(&(mapping)->tree_lock)
 x #define flush_icache_user_range(vma,page,addr,len) \
 	flush_dcache_page(page)xdiff -Nru a/include/asm-arm/ecard.h b/include/asm-arm/ecard.h
--- a/include/asm-arm/ecard.h	2004-11-20 08:24:15 -08:00
+++ b/include/asm-arm/ecard.h	2005-03-02 14:16:28 -08:00
@@ -155,8 +155,8 @@
 	struct resource		resource[ECARD_NUM_RESOURCES];
 
 	/* Public data */
-	volatile unsigned char *irqaddr;	/* address of IRQ register	*/
-	volatile unsigned char *fiqaddr;	/* address of FIQ register	*/
+	void __iomem		*irqaddr;	/* address of IRQ register	*/
+	void __iomem		*fiqaddr;	/* address of FIQ register	*/
 	unsigned char		irqmask;	/* IRQ mask			*/
 	unsigned char		fiqmask;	/* FIQ mask			*/
 	unsigned char  		claimed;	/* Card claimed?		*/
@@ -207,9 +207,16 @@
 extern int ecard_readchunk (struct in_chunk_dir *cd, struct expansion_card *ec, int id, int num);x 
 /*
- * Obtain the address of a card
+ * Obtain the address of a card.  This returns the "old style" address
+ * and should no longer be used.
  */x-extern __deprecated unsigned int ecard_address (struct expansion_card *ec, card_type_t card_type, card_speed_t speed);
+static inline unsigned int __deprecated
+ecard_address(struct expansion_card *ec, card_type_t type, card_speed_t speed)
+{
+	extern unsigned int __ecard_address(struct expansion_card *,
+					    card_type_t, card_speed_t);
+	return __ecard_address(ec, type, speed);
+}
 
 /*
  * Request and release ecard resourcesxdiff -Nru a/include/asm-arm/hardware/locomo.h b/include/asm-arm/hardware/locomo.h
--- a/include/asm-arm/hardware/locomo.h	2004-07-07 17:00:00 -07:00
+++ b/include/asm-arm/hardware/locomo.h	2005-03-01 16:00:00 -08:00
@@ -35,146 +35,139 @@
 #define LOCOMO_MCSX3	0x1c
 
 /* Touch panel controller */x-#define LOCOMO_ASD	0x20	/* AD start delay */x-#define LOCOMO_HSD	0x28	/* HSYS delay */x-#define LOCOMO_HSC	0x2c	/* HSYS period */x-#define LOCOMO_TADC	0x30	/* tablet ADC clock */x-x-/* TFT signal */x-#define LOCOMO_TC	0x38	/* TFT control signal */x-#define LOCOMO_CPSD	0x3c	/* CPS delay */x-x-/* Key controller */x-#define LOCOMO_KIB	0x40	/* KIB level */x-#define LOCOMO_KSC	0x44	/* KSTRB control */x-#define LOCOMO_KCMD	0x48	/* KSTRB command */x-#define LOCOMO_KIC	0x4c	/* Key interrupt */x+#define LOCOMO_ASD	0x20		/* AD start delay */x+#define LOCOMO_HSD	0x28		/* HSYS delay */x+#define LOCOMO_HSC	0x2c		/* HSYS period */x+#define LOCOMO_TADC	0x30		/* tablet ADC clock */x x-/* Audio clock */x-#define LOCOMO_ACC	0x54x-x-/* SPI interface */x-#define LOCOMO_SPIMD	0x60	/* SPI mode setting */x-#define LOCOMO_SPICT	0x64	/* SPI mode control */x-#define LOCOMO_SPIST	0x68	/* SPI status */x-#define LOCOMO_SPIIS	0x70	/* SPI interrupt status */x-#define LOCOMO_SPIWE	0x74	/* SPI interrupt status write enable */x-#define LOCOMO_SPIIE	0x78	/* SPI interrupt enable */x-#define LOCOMO_SPIIR	0x7c	/* SPI interrupt request */x-#define LOCOMO_SPITD	0x80	/* SPI transfer data write */x-#define LOCOMO_SPIRD	0x84	/* SPI receive data read */x-#define LOCOMO_SPITS	0x88	/* SPI transfer data shift */x-#define LOCOMO_SPIRS	0x8C	/* SPI receive data shift */x-x-#define	LOCOMO_SPI_TEND	(1 << 3)	/* Transfer end bit */x-#define	LOCOMO_SPI_OVRN	(1 << 2)	/* Over Run bit */x-#define	LOCOMO_SPI_RFW	(1 << 1)	/* write buffer bit */x-#define	LOCOMO_SPI_RFR	(1)		/* read buffer bit */x-x-/* GPIO */x-#define LOCOMO_GPD	0x90	/* GPIO direction */x-#define LOCOMO_GPE	0x94	/* GPIO input enable */x-#define LOCOMO_GPL	0x98	/* GPIO level */x-#define LOCOMO_GPO	0x9c	/* GPIO out data setteing */x-#define LOCOMO_GRIE	0xa0	/* GPIO rise detection */x-#define LOCOMO_GFIE	0xa4	/* GPIO fall detection */x-#define LOCOMO_GIS	0xa8	/* GPIO edge detection status */x-#define LOCOMO_GWE	0xac	/* GPIO status write enable */x-#define LOCOMO_GIE	0xb0	/* GPIO interrupt enable */x-#define LOCOMO_GIR	0xb4	/* GPIO interrupt request */x-x-#define LOCOMO_GPIO0	(1<<0)x-#define LOCOMO_GPIO1	(1<<1)x-#define LOCOMO_GPIO2	(1<<2)x-#define LOCOMO_GPIO3	(1<<3)x-#define LOCOMO_GPIO4	(1<<4)x-#define LOCOMO_GPIO5	(1<<5)x-#define LOCOMO_GPIO6	(1<<6)x-#define LOCOMO_GPIO7	(1<<7)x-#define LOCOMO_GPIO8	(1<<8)x-#define LOCOMO_GPIO9	(1<<9)x-#define LOCOMO_GPIO10	(1<<10)x-#define LOCOMO_GPIO11	(1<<11)x-#define LOCOMO_GPIO12	(1<<12)x-#define LOCOMO_GPIO13	(1<<13)x-#define LOCOMO_GPIO14	(1<<14)x-#define LOCOMO_GPIO15	(1<<15)x-
-/* Front light adjustment controller */x-#define LOCOMO_ALS	0xc8	/* Adjust light cycle */x-#define LOCOMO_ALD	0xcc	/* Adjust light duty */x-x-/* PCM audio interface */x-#define LOCOMO_PAIF	0xd0
 
 /* Long time timer */x-#define LOCOMO_LTC	0xd8	/* LTC interrupt setting */x-#define LOCOMO_LTINT	0xdc	/* LTC interrupt */x+#define LOCOMO_LTC	0xd8		/* LTC interrupt setting */x+#define LOCOMO_LTINT	0xdc		/* LTC interrupt */x 
 /* DAC control signal for LCD (COMADJ ) */x-#define LOCOMO_DAC	0xe0x-x+#define LOCOMO_DAC		0xe0x /* DAC control */x #define	LOCOMO_DAC_SCLOEB	0x08	/* SCL pin output data       */x #define	LOCOMO_DAC_TEST		0x04	/* Test bit                  */x #define	LOCOMO_DAC_SDA		0x02	/* SDA pin level (read-only) */x #define	LOCOMO_DAC_SDAOEB	0x01	/* SDA pin output data       */x x-/* LED controller */x-#define LOCOMO_LPT0		0xe8	/* LEDPWM0 timer */x-#define LOCOMO_LPT1		0xec	/* LEDPWM1 timer */x+/* SPI interface */x+#define LOCOMO_SPIMD	0x60		/* SPI mode setting */x+#define LOCOMO_SPICT	0x64		/* SPI mode control */x+#define LOCOMO_SPIST	0x68		/* SPI status */x+#define LOCOMO_SPIIS	0x70		/* SPI interrupt status */x+#define LOCOMO_SPIWE	0x74		/* SPI interrupt status write enable */x+#define LOCOMO_SPIIE	0x78		/* SPI interrupt enable */x+#define LOCOMO_SPIIR	0x7c		/* SPI interrupt request */x+#define LOCOMO_SPITD	0x80		/* SPI transfer data write */x+#define LOCOMO_SPIRD	0x84		/* SPI receive data read */x+#define LOCOMO_SPITS	0x88		/* SPI transfer data shift */x+#define LOCOMO_SPIRS	0x8C		/* SPI receive data shift */x+#define	LOCOMO_SPI_TEND	(1 << 3)	/* Transfer end bit */x+#define	LOCOMO_SPI_OVRN	(1 << 2)	/* Over Run bit */x+#define	LOCOMO_SPI_RFW	(1 << 1)	/* write buffer bit */x+#define	LOCOMO_SPI_RFR	(1)		/* read buffer bit */x x-#define LOCOMO_LPT_TOFH		0x80			/* */x-#define LOCOMO_LPT_TOFL		0x08			/* */x-#define LOCOMO_LPT_TOH(TOH)	((TOH & 0x7) << 4)	/* */x-#define LOCOMO_LPT_TOL(TOL)	((TOL & 0x7))		/* */x+/* GPIO */x+#define LOCOMO_GPD		0x90	/* GPIO direction */x+#define LOCOMO_GPE		0x94	/* GPIO input enable */x+#define LOCOMO_GPL		0x98	/* GPIO level */x+#define LOCOMO_GPO		0x9c	/* GPIO out data setteing */x+#define LOCOMO_GRIE		0xa0	/* GPIO rise detection */x+#define LOCOMO_GFIE		0xa4	/* GPIO fall detection */x+#define LOCOMO_GIS		0xa8	/* GPIO edge detection status */x+#define LOCOMO_GWE		0xac	/* GPIO status write enable */x+#define LOCOMO_GIE		0xb0	/* GPIO interrupt enable */x+#define LOCOMO_GIR		0xb4	/* GPIO interrupt request */x+#define	LOCOMO_GPIO(Nb)		(0x01 << (Nb))x+#define LOCOMO_GPIO_RTS		LOCOMO_GPIO(0)x+#define LOCOMO_GPIO_CTS		LOCOMO_GPIO(1)x+#define LOCOMO_GPIO_DSR		LOCOMO_GPIO(2)x+#define LOCOMO_GPIO_DTR		LOCOMO_GPIO(3)x+#define LOCOMO_GPIO_LCD_VSHA_ON	LOCOMO_GPIO(4)x+#define LOCOMO_GPIO_LCD_VSHD_ON	LOCOMO_GPIO(5)x+#define LOCOMO_GPIO_LCD_VEE_ON	LOCOMO_GPIO(6)x+#define LOCOMO_GPIO_LCD_MOD	LOCOMO_GPIO(7)x+#define LOCOMO_GPIO_DAC_ON	LOCOMO_GPIO(8)x+#define LOCOMO_GPIO_FL_VR	LOCOMO_GPIO(9)x+#define LOCOMO_GPIO_DAC_SDATA	LOCOMO_GPIO(10)x+#define LOCOMO_GPIO_DAC_SCK	LOCOMO_GPIO(11)x+#define LOCOMO_GPIO_DAC_SLOAD	LOCOMO_GPIO(12)x+x+/* Start the definitions of the devices.  Each device has an initial
+ * base address and a series of offsets from that base address. */
+x+/* Keyboard controller */x+#define LOCOMO_KEYBOARD		0x40x+#define LOCOMO_KIB		0x00	/* KIB level */x+#define LOCOMO_KSC		0x04	/* KSTRB control */x+#define LOCOMO_KCMD		0x08	/* KSTRB command */x+#define LOCOMO_KIC		0x0c	/* Key interrupt */x 
+/* Front light adjustment controller */x+#define LOCOMO_FRONTLIGHT	0xc8x+#define LOCOMO_ALS		0x00	/* Adjust light cycle */x+#define LOCOMO_ALD		0x04	/* Adjust light duty */x+x+/* Backlight controller: TFT signal */x+#define LOCOMO_BACKLIGHT	0x38
+#define LOCOMO_TC		0x00		/* TFT control signal */x+#define LOCOMO_CPSD		0x04		/* CPS delay */x+
+/* Audio controller */x+#define LOCOMO_AUDIO		0x54x+#define LOCOMO_ACC		0x00	/* Audio clock */x+#define LOCOMO_PAIF		0x7C	/* PCM audio interface */x /* Audio clock */x-#define	LOCOMO_ACC_XON		0x80	/*  */x-#define	LOCOMO_ACC_XEN		0x40	/*  */x-#define	LOCOMO_ACC_XSEL0	0x00	/*  */x-#define	LOCOMO_ACC_XSEL1	0x20	/*  */x-#define	LOCOMO_ACC_MCLKEN	0x10	/*  */x-#define	LOCOMO_ACC_64FSEN	0x08	/*  */x+#define	LOCOMO_ACC_XON		0x80x+#define	LOCOMO_ACC_XEN		0x40x+#define	LOCOMO_ACC_XSEL0	0x00x+#define	LOCOMO_ACC_XSEL1	0x20
+#define	LOCOMO_ACC_MCLKEN	0x10
+#define	LOCOMO_ACC_64FSEN	0x08x #define	LOCOMO_ACC_CLKSEL000	0x00	/* mclk  2 */x #define	LOCOMO_ACC_CLKSEL001	0x01	/* mclk  3 */x #define	LOCOMO_ACC_CLKSEL010	0x02	/* mclk  4 */x #define	LOCOMO_ACC_CLKSEL011	0x03	/* mclk  6 */x #define	LOCOMO_ACC_CLKSEL100	0x04	/* mclk  8 */x #define	LOCOMO_ACC_CLKSEL101	0x05	/* mclk 12 */x-x /* PCM audio interface */x-#define	LOCOMO_PAIF_SCINV	0x20	/*  */x-#define	LOCOMO_PAIF_SCEN	0x10	/*  */x-#define	LOCOMO_PAIF_LRCRST	0x08	/*  */x-#define	LOCOMO_PAIF_LRCEVE	0x04	/*  */x-#define	LOCOMO_PAIF_LRCINV	0x02	/*  */x-#define	LOCOMO_PAIF_LRCEN	0x01	/*  */x+#define	LOCOMO_PAIF_SCINV	0x20x+#define	LOCOMO_PAIF_SCEN	0x10
+#define	LOCOMO_PAIF_LRCRST	0x08
+#define	LOCOMO_PAIF_LRCEVE	0x04
+#define	LOCOMO_PAIF_LRCINV	0x02
+#define	LOCOMO_PAIF_LRCEN	0x01x x-/* GPIO */x-#define	LOCOMO_GPIO(Nb)		(0x01 << (Nb))	/* LoCoMo GPIO [0...15] */x-#define LOCOMO_GPIO_RTS		LOCOMO_GPIO(0)	/* LoCoMo GPIO  [0] */x-#define LOCOMO_GPIO_CTS		LOCOMO_GPIO(1)	/* LoCoMo GPIO  [1] */x-#define LOCOMO_GPIO_DSR		LOCOMO_GPIO(2)	/* LoCoMo GPIO  [2] */x-#define LOCOMO_GPIO_DTR		LOCOMO_GPIO(3)	/* LoCoMo GPIO  [3] */x-#define LOCOMO_GPIO_LCD_VSHA_ON	LOCOMO_GPIO(4)	/* LoCoMo GPIO  [4] */x-#define LOCOMO_GPIO_LCD_VSHD_ON	LOCOMO_GPIO(5)	/* LoCoMo GPIO  [5] */x-#define LOCOMO_GPIO_LCD_VEE_ON	LOCOMO_GPIO(6)	/* LoCoMo GPIO  [6] */x-#define LOCOMO_GPIO_LCD_MOD	LOCOMO_GPIO(7)	/* LoCoMo GPIO  [7] */x-#define LOCOMO_GPIO_DAC_ON	LOCOMO_GPIO(8)	/* LoCoMo GPIO  [8] */x-#define LOCOMO_GPIO_FL_VR	LOCOMO_GPIO(9)	/* LoCoMo GPIO  [9] */x-#define LOCOMO_GPIO_DAC_SDATA	LOCOMO_GPIO(10)	/* LoCoMo GPIO [10] */x-#define LOCOMO_GPIO_DAC_SCK	LOCOMO_GPIO(11)	/* LoCoMo GPIO [11] */x-#define LOCOMO_GPIO_DAC_SLOAD	LOCOMO_GPIO(12)	/* LoCoMo GPIO [12] */x+/* LED controller */x+#define LOCOMO_LED		0xe8x+#define LOCOMO_LPT0		0x00x+#define LOCOMO_LPT1		0x04
+/* LED control */x+#define LOCOMO_LPT_TOFH		0x80x+#define LOCOMO_LPT_TOFL		0x08x+#define LOCOMO_LPT_TOH(TOH)	((TOH & 0x7) << 4)x+#define LOCOMO_LPT_TOL(TOL)	((TOL & 0x7))x 
 extern struct bus_type locomo_bus_type;
 x+#define LOCOMO_DEVID_KEYBOARD	0x+#define LOCOMO_DEVID_FRONTLIGHT	1x+#define LOCOMO_DEVID_BACKLIGHT	2x+#define LOCOMO_DEVID_AUDIO	3x+#define LOCOMO_DEVID_LED	4x+#define LOCOMO_DEVID_UART	5
+
 struct locomo_dev {
 	struct device	dev;
 	unsigned int	devid;
-	struct resource	res;
-	void		*mapbase;
 	unsigned int	irq[1];
+
+	void		*mapbase;
+	unsigned long	length;
+
 	u64		dma_mask;
 };
 x@@ -200,5 +193,14 @@
 
 int locomo_driver_register(struct locomo_driver *);
 void locomo_driver_unregister(struct locomo_driver *);
+x+/* GPIO control functions */x+void locomo_gpio_set_dir(struct locomo_dev *ldev, unsigned int bits, unsigned int dir);
+unsigned int locomo_gpio_read_level(struct locomo_dev *ldev, unsigned int bits);
+unsigned int locomo_gpio_read_output(struct locomo_dev *ldev, unsigned int bits);
+void locomo_gpio_write(struct locomo_dev *ldev, unsigned int bits, unsigned int set);
+x+/* M62332 control function */x+void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel);
 x #endif
diff -Nru a/include/asm-arm/hardware/scoop.h b/include/asm-arm/hardware/scoop.h
--- a/include/asm-arm/hardware/scoop.h	2005-01-09 16:00:00 -08:00
+++ b/include/asm-arm/hardware/scoop.h	2005-03-06 08:52:27 -08:00
@@ -40,8 +40,8 @@
 	unsigned short io_dir;
 };
 x-void reset_scoop(void);
-unsigned short set_scoop_gpio(unsigned short bit);
-unsigned short reset_scoop_gpio(unsigned short bit);
-unsigned short read_scoop_reg(unsigned short reg);
-void write_scoop_reg(unsigned short reg, unsigned short data);
+void reset_scoop(struct device *dev);
+unsigned short set_scoop_gpio(struct device *dev, unsigned short bit);
+unsigned short reset_scoop_gpio(struct device *dev, unsigned short bit);
+unsigned short read_scoop_reg(struct device *dev, unsigned short reg);
+void write_scoop_reg(struct device *dev, unsigned short reg, unsigned short data);
diff -Nru a/include/asm-arm/io.h b/include/asm-arm/io.h
--- a/include/asm-arm/io.h	2004-11-27 12:32:28 -08:00
+++ b/include/asm-arm/io.h	2005-03-05 06:16:24 -08:00
@@ -47,13 +47,13 @@
 extern void __raw_readsw(void __iomem *addr, void *data, int wordlen);
 extern void __raw_readsl(void __iomem *addr, void *data, int longlen);
 x-#define __raw_writeb(v,a)	(*(volatile unsigned char __force  *)(a) = (v))x-#define __raw_writew(v,a)	(*(volatile unsigned short __force *)(a) = (v))x-#define __raw_writel(v,a)	(*(volatile unsigned int __force   *)(a) = (v))x+#define __raw_writeb(v,a)	(__chk_io_ptr(a), *(volatile unsigned char __force  *)(a) = (v))x+#define __raw_writew(v,a)	(__chk_io_ptr(a), *(volatile unsigned short __force *)(a) = (v))x+#define __raw_writel(v,a)	(__chk_io_ptr(a), *(volatile unsigned int __force   *)(a) = (v))x x-#define __raw_readb(a)		(*(volatile unsigned char __force  *)(a))x-#define __raw_readw(a)		(*(volatile unsigned short __force *)(a))x-#define __raw_readl(a)		(*(volatile unsigned int __force   *)(a))x+#define __raw_readb(a)		(__chk_io_ptr(a), *(volatile unsigned char __force  *)(a))x+#define __raw_readw(a)		(__chk_io_ptr(a), *(volatile unsigned short __force *)(a))x+#define __raw_readl(a)		(__chk_io_ptr(a), *(volatile unsigned int __force   *)(a))
 
 /*
  * Bad read/write accesses...
diff -Nru a/include/asm-arm/pgtable.h b/include/asm-arm/pgtable.h
--- a/include/asm-arm/pgtable.h	2005-01-05 15:55:41 -08:00
+++ b/include/asm-arm/pgtable.h	2005-03-06 17:03:21 -08:00
@@ -106,6 +106,13 @@
 #define USER_PTRS_PER_PGD	((TASK_SIZE/PGDIR_SIZE) - FIRST_USER_PGD_NR)
 
 /*
+ * ARMv6 supersection address mask and size definitions.
+ */
+#define SUPERSECTION_SHIFT	24
+#define SUPERSECTION_SIZE	(1UL << SUPERSECTION_SHIFT)
+#define SUPERSECTION_MASK	(~(SUPERSECTION_SIZE-1))
+
+/*
  * Hardware page table definitions.
  *
  * + Level 1 descriptor (PMD)x@@ -129,6 +136,7 @@
 #define PMD_SECT_APX		(1 << 15)	/* v6 */x #define PMD_SECT_S		(1 << 16)	/* v6 */x #define PMD_SECT_nG		(1 << 17)	/* v6 */x+#define PMD_SECT_SUPER		(1 << 18)	/* v6 */x x #define PMD_SECT_UNCACHED	(0)
 #define PMD_SECT_BUFFERED	(PMD_SECT_BUFFERABLE)
@@ -254,7 +262,7 @@
 #define pfn_pte(pfn,prot)	(__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
 x #define pte_none(pte)		(!pte_val(pte))x-#define pte_clear(ptep)		set_pte((ptep), __pte(0))x+#define pte_clear(mm,addr,ptep)	set_pte_at((mm),(addr),(ptep), __pte(0))x #define pte_page(pte)		(pfn_to_page(pte_pfn(pte)))x #define pte_offset_kernel(dir,addr)	(pmd_page_kernel(*(dir)) + __pte_index(addr))x #define pte_offset_map(dir,addr)	(pmd_page_kernel(*(dir)) + __pte_index(addr))x@@ -263,6 +271,7 @@
 #define pte_unmap_nested(pte)	do { } while (0)
 x #define set_pte(ptep, pte)	cpu_set_pte(ptep,pte)x+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 
 /*
  * The following only work if pte_present() is true.
@@ -307,12 +316,6 @@
 #define pmd_none(pmd)		(!pmd_val(pmd))
 #define pmd_present(pmd)	(pmd_val(pmd))
 #define pmd_bad(pmd)		(pmd_val(pmd) & 2)x-x-#define set_pmd(pmdp,pmd)		\
-	do {				\
-		*(pmdp) = pmd;		\
-		flush_pmd_entry(pmdp);	\
-	} while (0)
 x #define copy_pmd(pmdpd,pmdps)		\
 	do {				\
diff -Nru a/include/asm-arm/rtc.h b/include/asm-arm/rtc.h
--- a/include/asm-arm/rtc.h	2004-10-19 11:32:58 -07:00
+++ b/include/asm-arm/rtc.h	2005-03-06 11:00:53 -08:00
@@ -27,6 +27,7 @@
 
 void rtc_time_to_tm(unsigned long, struct rtc_time *);
 int rtc_tm_to_time(struct rtc_time *, unsigned long *);
+int rtc_valid_tm(struct rtc_time *);
 void rtc_next_alarm_time(struct rtc_time *, struct rtc_time *, struct rtc_time *);
 void rtc_update(unsigned long, unsigned long);
 int register_rtc(struct rtc_ops *);
diff -Nru a/include/asm-arm/system.h b/include/asm-arm/system.h
--- a/include/asm-arm/system.h	2004-12-17 13:46:05 -08:00
+++ b/include/asm-arm/system.h	2005-03-04 22:41:13 -08:00
@@ -383,6 +383,8 @@
 
 #endif /* __ASSEMBLY__ */x 
+#define arch_align_stack(x) (x)
+
 #endif /* __KERNEL__ */x 
 #endif
diff -Nru a/include/asm-arm/unistd.h b/include/asm-arm/unistd.h
--- a/include/asm-arm/unistd.h	2005-01-31 16:00:00 -08:00
+++ b/include/asm-arm/unistd.h	2005-03-02 07:05:14 -08:00
@@ -1,7 +1,7 @@
 /*
  *  linux/include/asm-arm/unistd.h
  *
- *  Copyright (C) 2001-2003 Russell King
+ *  Copyright (C) 2001-2005 Russell King
  *
  * 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
@@ -307,6 +307,44 @@
 #define __NR_mq_getsetattr		(__NR_SYSCALL_BASE+279)
 #define __NR_waitid			(__NR_SYSCALL_BASE+280)
 x+#if 0 /* reserve these for un-muxing socketcall */x+#define __NR_socket			(__NR_SYSCALL_BASE+281)x+#define __NR_bind			(__NR_SYSCALL_BASE+282)x+#define __NR_connect			(__NR_SYSCALL_BASE+283)x+#define __NR_listen			(__NR_SYSCALL_BASE+284)x+#define __NR_accept			(__NR_SYSCALL_BASE+285)x+#define __NR_getsockname		(__NR_SYSCALL_BASE+286)x+#define __NR_getpeername		(__NR_SYSCALL_BASE+287)x+#define __NR_socketpair			(__NR_SYSCALL_BASE+288)x+#define __NR_send			(__NR_SYSCALL_BASE+289)x+#define __NR_sendto			(__NR_SYSCALL_BASE+290)x+#define __NR_recv			(__NR_SYSCALL_BASE+291)x+#define __NR_recvfrom			(__NR_SYSCALL_BASE+292)x+#define __NR_shutdown			(__NR_SYSCALL_BASE+293)x+#define __NR_setsockopt			(__NR_SYSCALL_BASE+294)x+#define __NR_getsockopt			(__NR_SYSCALL_BASE+295)x+#define __NR_sendmsg			(__NR_SYSCALL_BASE+296)x+#define __NR_recvmsg			(__NR_SYSCALL_BASE+297)
+#endif
+
+#if 0 /* reserve these for un-muxing ipc */x+#define __NR_semop			(__NR_SYSCALL_BASE+298)x+#define __NR_semget			(__NR_SYSCALL_BASE+299)x+#define __NR_semctl			(__NR_SYSCALL_BASE+300)x+#define __NR_msgsnd			(__NR_SYSCALL_BASE+301)x+#define __NR_msgrcv			(__NR_SYSCALL_BASE+302)x+#define __NR_msgget			(__NR_SYSCALL_BASE+303)x+#define __NR_msgctl			(__NR_SYSCALL_BASE+304)x+#define __NR_shmat			(__NR_SYSCALL_BASE+305)x+#define __NR_shmdt			(__NR_SYSCALL_BASE+306)x+#define __NR_shmget			(__NR_SYSCALL_BASE+307)x+#define __NR_shmctl			(__NR_SYSCALL_BASE+308)
+#endif
+
+#define __NR_add_key			(__NR_SYSCALL_BASE+309)x+#define __NR_request_key		(__NR_SYSCALL_BASE+310)x+#define __NR_keyctl			(__NR_SYSCALL_BASE+311)x+
 /*
  * The following SWIs are ARM private.
  */x@@ -335,7 +373,7 @@
 
 #define __syscall_return(type, res)					\
 do {									\
-	if ((unsigned long)(res) >= (unsigned long)(-125)) {		\
+	if ((unsigned long)(res) >= (unsigned long)(-129)) {		\
 		errno = -(res);						\
 		res = -1;						\
 	}								\
diff -Nru a/include/asm-arm26/cacheflush.h b/include/asm-arm26/cacheflush.h
--- a/include/asm-arm26/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-arm26/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -23,7 +23,7 @@
 #define flush_cache_all()                       do { } while (0)
 #define flush_cache_mm(mm)                      do { } while (0)
 #define flush_cache_range(vma,start,end)        do { } while (0)
-#define flush_cache_page(vma,vmaddr)            do { } while (0)
+#define flush_cache_page(vma,vmaddr,pfn)        do { } while (0)
 #define flush_cache_vmap(start, end)		do { } while (0)
 #define flush_cache_vunmap(start, end)		do { } while (0)
 
diff -Nru a/include/asm-arm26/pgtable.h b/include/asm-arm26/pgtable.h
--- a/include/asm-arm26/pgtable.h	2004-12-22 01:36:07 -08:00
+++ b/include/asm-arm26/pgtable.h	2005-02-23 15:40:52 -08:00
@@ -154,7 +154,8 @@
 #define pte_none(pte)           (!pte_val(pte))x #define pte_present(pte)        (pte_val(pte) & _PAGE_PRESENT)x #define set_pte(pte_ptr, pte)   ((*(pte_ptr)) = (pte))x-#define pte_clear(ptep)         set_pte((ptep), __pte(0))x+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
+#define pte_clear(mm,addr,ptep)	set_pte_at((mm),(addr),(ptep), __pte(0))x x /* macros to ease the getting of pointers to stuff... */x #define pgd_offset(mm, addr)	((pgd_t *)(mm)->pgd        + __pgd_index(addr))xdiff -Nru a/include/asm-arm26/system.h b/include/asm-arm26/system.h
--- a/include/asm-arm26/system.h	2005-01-03 15:49:28 -08:00
+++ b/include/asm-arm26/system.h	2005-03-04 22:41:13 -08:00
@@ -245,6 +245,8 @@
 
 #endif /* __ASSEMBLY__ */x 
+#define arch_align_stack(x) (x)
+
 #endif /* __KERNEL__ */x 
 #endif
diff -Nru a/include/asm-cris/cacheflush.h b/include/asm-cris/cacheflush.h
--- a/include/asm-cris/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-cris/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -10,7 +10,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
diff -Nru a/include/asm-cris/pgtable.h b/include/asm-cris/pgtable.h
--- a/include/asm-cris/pgtable.h	2004-12-22 01:36:07 -08:00
+++ b/include/asm-cris/pgtable.h	2005-02-23 15:40:52 -08:00
@@ -34,6 +34,8 @@
  * hook is made available.
  */x #define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval))x+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
+
 /*
  * (pmds are folded into pgds so this doesn't get actually called,
  * but the define is needed for a generic inline function.)x@@ -101,7 +103,7 @@
 
 #define pte_none(x)	(!pte_val(x))x #define pte_present(x)	(pte_val(x) & _PAGE_PRESENT)x-#define pte_clear(xp)	do { pte_val(*(xp)) = 0; } while (0)
+#define pte_clear(mm,addr,xp)	do { pte_val(*(xp)) = 0; } while (0)
 
 #define pmd_none(x)	(!pmd_val(x))x /* by removing the _PAGE_KERNEL bit from the comparision, the same pmd_bad
diff -Nru a/include/asm-cris/system.h b/include/asm-cris/system.h
--- a/include/asm-cris/system.h	2003-04-09 00:25:27 -07:00
+++ b/include/asm-cris/system.h	2005-03-04 22:41:13 -08:00
@@ -69,4 +69,6 @@
   return x;
 }x 
+#define arch_align_stack(x) (x)
+
 #endif
diff -Nru a/include/asm-frv/cacheflush.h b/include/asm-frv/cacheflush.h
--- a/include/asm-frv/cacheflush.h	2005-01-04 18:48:05 -08:00
+++ b/include/asm-frv/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -21,7 +21,7 @@
 #define flush_cache_all()			do {} while(0)
 #define flush_cache_mm(mm)			do {} while(0)
 #define flush_cache_range(mm, start, end)	do {} while(0)
-#define flush_cache_page(vma, vmaddr)		do {} while(0)
+#define flush_cache_page(vma, vmaddr, pfn)	do {} while(0)
 #define flush_cache_vmap(start, end)		do {} while(0)
 #define flush_cache_vunmap(start, end)		do {} while(0)
 #define flush_dcache_mmap_lock(mapping)		do {} while(0)
diff -Nru a/include/asm-frv/pgtable.h b/include/asm-frv/pgtable.h
--- a/include/asm-frv/pgtable.h	2005-01-04 18:48:10 -08:00
+++ b/include/asm-frv/pgtable.h	2005-02-23 15:40:52 -08:00
@@ -173,6 +173,7 @@
 	*(pteptr) = (pteval);				\
 	asm volatile("dcf %M0" :: "U"(*pteptr));	\
 } while(0)
+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 
 #define set_pte_atomic(pteptr, pteval)		set_pte((pteptr), (pteval))x x@@ -353,7 +354,7 @@
 #undef TEST_VERIFY_AREA
 
 #define pte_present(x)	(pte_val(x) & _PAGE_PRESENT)x-#define pte_clear(xp)	do { set_pte(xp, __pte(0)); } while (0)
+#define pte_clear(mm,addr,xp)	do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
 
 #define pmd_none(x)	(!pmd_val(x))x #define pmd_present(x)	(pmd_val(x) & _PAGE_PRESENT)x@@ -390,39 +391,33 @@
 static inline pte_t pte_mkyoung(pte_t pte)	{ (pte).pte |= _PAGE_ACCESSED; return pte; }x static inline pte_t pte_mkwrite(pte_t pte)	{ (pte).pte &= ~_PAGE_WP; return pte; }x 
-static inline int ptep_test_and_clear_dirty(pte_t *ptep)
+static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 	int i = test_and_clear_bit(_PAGE_BIT_DIRTY, ptep);
 	asm volatile("dcf %M0" :: "U"(*ptep));
 	return i;
 }x 
-static inline int ptep_test_and_clear_young(pte_t *ptep)
+static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 	int i = test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep);
 	asm volatile("dcf %M0" :: "U"(*ptep));
 	return i;
 }x 
-static inline pte_t ptep_get_and_clear(pte_t *ptep)
+static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	unsigned long x = xchg(&ptep->pte, 0);
 	asm volatile("dcf %M0" :: "U"(*ptep));
 	return __pte(x);
 }x 
-static inline void ptep_set_wrprotect(pte_t *ptep)
+static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	set_bit(_PAGE_BIT_WP, ptep);
 	asm volatile("dcf %M0" :: "U"(*ptep));
 }x 
-static inline void ptep_mkdirty(pte_t *ptep)
-{
-	set_bit(_PAGE_BIT_DIRTY, ptep);
-	asm volatile("dcf %M0" :: "U"(*ptep));
-}x-x /*
  * Conversion functions: convert a page and protection to a page entry,
  * and a page entry and page directory to the page they refer to.
@@ -512,7 +507,6 @@
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
 #define __HAVE_ARCH_PTEP_SET_WRPROTECTx-#define __HAVE_ARCH_PTEP_MKDIRTY
 #define __HAVE_ARCH_PTE_SAME
 #include <asm-generic/pgtable.h>
 
diff -Nru a/include/asm-frv/system.h b/include/asm-frv/system.h
--- a/include/asm-frv/system.h	2005-02-04 08:12:47 -08:00
+++ b/include/asm-frv/system.h	2005-03-04 22:41:13 -08:00
@@ -123,4 +123,6 @@
 extern void die_if_kernel(const char *, ...) __attribute__((format(printf, 1, 2)));
 extern void free_initmem(void);
 
+#define arch_align_stack(x) (x)
+
 #endif /* _ASM_SYSTEM_H */xdiff -Nru a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
--- a/include/asm-generic/pgtable.h	2004-10-13 21:08:28 -07:00
+++ b/include/asm-generic/pgtable.h	2005-02-23 15:40:53 -08:00
@@ -16,7 +16,7 @@
 #ifndef __HAVE_ARCH_SET_PTE_ATOMIC
 #define ptep_establish(__vma, __address, __ptep, __entry)		\
 do {				  					\
-	set_pte(__ptep, __entry);					\
+	set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry);	\
 	flush_tlb_page(__vma, __address);				\
 } while (0)
 #else /* __HAVE_ARCH_SET_PTE_ATOMIC */x@@ -37,26 +37,30 @@
  */
 #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
 do {				  					  \
-	set_pte(__ptep, __entry);					  \
+	set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry);	  \
 	flush_tlb_page(__vma, __address);				  \
 } while (0)
 #endif
 
 #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
-static inline int ptep_test_and_clear_young(pte_t *ptep)
-{
-	pte_t pte = *ptep;
-	if (!pte_young(pte))x-		return 0;
-	set_pte(ptep, pte_mkold(pte));
-	return 1;
-}x+#define ptep_test_and_clear_young(__vma, __address, __ptep)		\
+({									\
+	pte_t __pte = *(__ptep);					\
+	int r = 1;							\
+	if (!pte_young(__pte))						\
+		r = 0;							\
+	else								\
+		set_pte_at((__vma)->vm_mm, (__address),			\
+			   (__ptep), pte_mkold(__pte));			\
+	r;								\
+})
 #endif
 
 #ifndef __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
 #define ptep_clear_flush_young(__vma, __address, __ptep)		\
 ({									\
-	int __young = ptep_test_and_clear_young(__ptep);		\
+	int __young;							\
+	__young = ptep_test_and_clear_young(__vma, __address, __ptep);	\
 	if (__young)							\
 		flush_tlb_page(__vma, __address);			\
 	__young;							\
@@ -64,20 +68,24 @@
 #endif
 
 #ifndef __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
-static inline int ptep_test_and_clear_dirty(pte_t *ptep)
-{
-	pte_t pte = *ptep;
-	if (!pte_dirty(pte))x-		return 0;
-	set_pte(ptep, pte_mkclean(pte));
-	return 1;
-}x+#define ptep_test_and_clear_dirty(__vma, __address, __ptep)		\
+({									\
+	pte_t __pte = *ptep;						\
+	int r = 1;							\
+	if (!pte_dirty(__pte))						\
+		r = 0;							\
+	else								\
+		set_pte_at((__vma)->vm_mm, (__address), (__ptep),	\
+			   pte_mkclean(__pte));				\
+	r;								\
+})
 #endif
 
 #ifndef __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
 #define ptep_clear_flush_dirty(__vma, __address, __ptep)		\
 ({									\
-	int __dirty = ptep_test_and_clear_dirty(__ptep);		\
+	int __dirty;							\
+	__dirty = ptep_test_and_clear_dirty(__vma, __address, __ptep);	\
 	if (__dirty)							\
 		flush_tlb_page(__vma, __address);			\
 	__dirty;							\
@@ -85,36 +93,29 @@
 #endif
 
 #ifndef __HAVE_ARCH_PTEP_GET_AND_CLEAR
-static inline pte_t ptep_get_and_clear(pte_t *ptep)
-{
-	pte_t pte = *ptep;
-	pte_clear(ptep);
-	return pte;
-}x+#define ptep_get_and_clear(__mm, __address, __ptep)			\
+({									\
+	pte_t __pte = *(__ptep);					\
+	pte_clear((__mm), (__address), (__ptep));			\
+	__pte;								\
+})
 #endif
 
 #ifndef __HAVE_ARCH_PTEP_CLEAR_FLUSH
 #define ptep_clear_flush(__vma, __address, __ptep)			\
 ({									\
-	pte_t __pte = ptep_get_and_clear(__ptep);			\
+	pte_t __pte;							\
+	__pte = ptep_get_and_clear((__vma)->vm_mm, __address, __ptep);	\
 	flush_tlb_page(__vma, __address);				\
 	__pte;								\
 })
 #endif
 
 #ifndef __HAVE_ARCH_PTEP_SET_WRPROTECTx-static inline void ptep_set_wrprotect(pte_t *ptep)
-{
-	pte_t old_pte = *ptep;
-	set_pte(ptep, pte_wrprotect(old_pte));
-}x-#endif
-x-#ifndef __HAVE_ARCH_PTEP_MKDIRTY
-static inline void ptep_mkdirty(pte_t *ptep)
+static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long address, pte_t *ptep)
 {
 	pte_t old_pte = *ptep;
-	set_pte(ptep, pte_mkdirty(old_pte));
+	set_pte_at(mm, address, ptep, pte_wrprotect(old_pte));
 }x #endif
 
diff -Nru a/include/asm-generic/resource.h b/include/asm-generic/resource.h
--- a/include/asm-generic/resource.h	2005-01-20 21:00:51 -08:00
+++ b/include/asm-generic/resource.h	2005-03-07 20:41:53 -08:00
@@ -2,57 +2,85 @@
 #define _ASM_GENERIC_RESOURCE_Hx 
 /*
- * Resource limits
+ * Resource limit IDs
+ *
+ * ( Compatibility detail: there are architectures that have
+ *   a different rlimit ID order in the 5-9 range and want
+ *   to keep that order for binary compatibility. The reasons
+ *   are historic and all new rlimits are identical across all
+ *   arches. If an arch has such special order for some rlimits
+ *   then it defines them prior including asm-generic/resource.h. )
  */x x-/* Allow arch to control resource order */x-#ifndef __ARCH_RLIMIT_ORDER
 #define RLIMIT_CPU		0	/* CPU time in ms */
 #define RLIMIT_FSIZE		1	/* Maximum filesize */
 #define RLIMIT_DATA		2	/* max data size */
 #define RLIMIT_STACK		3	/* max stack size */
 #define RLIMIT_CORE		4	/* max core file size */
-#define RLIMIT_RSS		5	/* max resident set size */
-#define RLIMIT_NPROC		6	/* max number of processes */
-#define RLIMIT_NOFILE		7	/* max number of open files */
-#define RLIMIT_MEMLOCK		8	/* max locked-in-memory address space */
-#define RLIMIT_AS		9	/* address space limit */x+
+#ifndef RLIMIT_RSS
+# define RLIMIT_RSS		5	/* max resident set size */
+#endif
+
+#ifndef RLIMIT_NPROC
+# define RLIMIT_NPROC		6	/* max number of processes */
+#endif
+
+#ifndef RLIMIT_NOFILE
+# define RLIMIT_NOFILE		7	/* max number of open files */
+#endif
+
+#ifndef RLIMIT_MEMLOCK
+# define RLIMIT_MEMLOCK		8	/* max locked-in-memory address space */
+#endif
+
+#ifndef RLIMIT_AS
+# define RLIMIT_AS		9	/* address space limit */x+#endif
+
 #define RLIMIT_LOCKS		10	/* maximum file locks held */
 #define RLIMIT_SIGPENDING	11	/* max number of pending signals */
 #define RLIMIT_MSGQUEUE		12	/* maximum bytes in POSIX mqueues */
 
 #define RLIM_NLIMITS		13x-#endif
 
 /*
  * SuS says limits have to be unsigned.
  * Which makes a ton more sense anyway.
+ *
+ * Some architectures override this (for compatibility reasons):
  */
 #ifndef RLIM_INFINITY
-#define RLIM_INFINITY	(~0UL)
+# define RLIM_INFINITY		(~0UL)
 #endif
 
+/*
+ * RLIMIT_STACK default maximum - some architectures override it:
+ */
 #ifndef _STK_LIM_MAXx-#define _STK_LIM_MAX	RLIM_INFINITY
+# define _STK_LIM_MAX		RLIM_INFINITY
 #endif
 
 #ifdef __KERNEL__
 
+/*
+ * boot-time rlimit defaults for the init task:
+ */
 #define INIT_RLIMITS							\
 {									\
-	[RLIMIT_CPU]		= { RLIM_INFINITY, RLIM_INFINITY },	\
-	[RLIMIT_FSIZE]		= { RLIM_INFINITY, RLIM_INFINITY },	\
-	[RLIMIT_DATA]		= { RLIM_INFINITY, RLIM_INFINITY },	\
-	[RLIMIT_STACK]		= {      _STK_LIM, _STK_LIM_MAX  },	\
-	[RLIMIT_CORE]		= {             0, RLIM_INFINITY },	\
-	[RLIMIT_RSS]		= { RLIM_INFINITY, RLIM_INFINITY },	\
-	[RLIMIT_NPROC]		= {             0,             0 },	\
-	[RLIMIT_NOFILE]		= {      INR_OPEN,     INR_OPEN  },	\
-	[RLIMIT_MEMLOCK]	= {   MLOCK_LIMIT,   MLOCK_LIMIT },	\
-	[RLIMIT_AS]		= { RLIM_INFINITY, RLIM_INFINITY },	\
-	[RLIMIT_LOCKS]		= { RLIM_INFINITY, RLIM_INFINITY },	\
-	[RLIMIT_SIGPENDING]	= { MAX_SIGPENDING, MAX_SIGPENDING },	\
-	[RLIMIT_MSGQUEUE]	= { MQ_BYTES_MAX, MQ_BYTES_MAX },	\
+	[RLIMIT_CPU]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
+	[RLIMIT_FSIZE]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
+	[RLIMIT_DATA]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
+	[RLIMIT_STACK]		= {       _STK_LIM,   _STK_LIM_MAX },	\
+	[RLIMIT_CORE]		= {              0,  RLIM_INFINITY },	\
+	[RLIMIT_RSS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
+	[RLIMIT_NPROC]		= {              0,              0 },	\
+	[RLIMIT_NOFILE]		= {       INR_OPEN,       INR_OPEN },	\
+	[RLIMIT_MEMLOCK]	= {    MLOCK_LIMIT,    MLOCK_LIMIT },	\
+	[RLIMIT_AS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
+	[RLIMIT_LOCKS]		= {  RLIM_INFINITY,  RLIM_INFINITY },	\
+	[RLIMIT_SIGPENDING]	= { 		0,	       0 },	\
+	[RLIMIT_MSGQUEUE]	= {   MQ_BYTES_MAX,   MQ_BYTES_MAX },	\
 }x 
 #endif	/* __KERNEL__ */xdiff -Nru a/include/asm-h8300/cacheflush.h b/include/asm-h8300/cacheflush.h
--- a/include/asm-h8300/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-h8300/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -13,7 +13,7 @@
 #define flush_cache_all()x #define	flush_cache_mm(mm)x #define	flush_cache_range(vma,a,b)x-#define	flush_cache_page(vma,p)
+#define	flush_cache_page(vma,p,pfn)x #define	flush_dcache_page(page)x #define	flush_dcache_mmap_lock(mapping)x #define	flush_dcache_mmap_unlock(mapping)xdiff -Nru a/include/asm-h8300/system.h b/include/asm-h8300/system.h
--- a/include/asm-h8300/system.h	2004-11-09 08:06:35 -08:00
+++ b/include/asm-h8300/system.h	2005-03-04 22:41:13 -08:00
@@ -144,4 +144,6 @@
         asm("jmp @@0");			\
 })
 
+#define arch_align_stack(x) (x)
+
 #endif /* _H8300_SYSTEM_H */xdiff -Nru a/include/asm-i386/cacheflush.h b/include/asm-i386/cacheflush.h
--- a/include/asm-i386/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-i386/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -8,7 +8,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
diff -Nru a/include/asm-i386/mach-default/mach_traps.h b/include/asm-i386/mach-default/mach_traps.h
--- a/include/asm-i386/mach-default/mach_traps.h	2003-03-06 15:33:53 -08:00
+++ b/include/asm-i386/mach-default/mach_traps.h	2005-03-07 20:41:35 -08:00
@@ -7,6 +7,8 @@
 #ifndef _MACH_TRAPS_H
 #define _MACH_TRAPS_H
 
+#include <asm/mc146818rtc.h>
+
 static inline void clear_mem_error(unsigned char reason)
 {
 	reason = (reason & 0xf) | 4;x@@ -20,10 +22,20 @@
 
 static inline void reassert_nmi(void)
 {
+	int old_reg = -1;
+
+	if (do_i_have_lock_cmos())x+		old_reg = current_lock_cmos_reg();
+	elsex+		lock_cmos(0); /* register doesn't matter here */
 	outb(0x8f, 0x70);
 	inb(0x71);		/* dummy */
 	outb(0x0f, 0x70);
 	inb(0x71);		/* dummy */
+	if (old_reg >= 0)x+		outb(old_reg, 0x70);
+	elsex+		unlock_cmos();
 }x 
 #endif /* !_MACH_TRAPS_H */xdiff -Nru a/include/asm-i386/mc146818rtc.h b/include/asm-i386/mc146818rtc.h
--- a/include/asm-i386/mc146818rtc.h	2003-08-31 16:15:40 -07:00
+++ b/include/asm-i386/mc146818rtc.h	2005-03-07 20:41:35 -08:00
@@ -5,24 +5,89 @@
 #define _ASM_MC146818RTC_Hx 
 #include <asm/io.h>
+#include <asm/system.h>
+#include <linux/mc146818rtc.h>
 
 #ifndef RTC_PORT
 #define RTC_PORT(x)	(0x70 + (x))x #define RTC_ALWAYS_BCD	1	/* RTC operates in binary mode */
 #endif
 
+#ifdef __HAVE_ARCH_CMPXCHG
+/*
+ * This lock provides nmi access to the CMOS/RTC registers.  It has some
+ * special properties.  It is owned by a CPU and stores the index register
+ * currently being accessed (if owned).  The idea here is that it works
+ * like a normal lock (normally).  However, in an NMI, the NMI code will
+ * first check to see if its CPU owns the lock, meaning that the NMI
+ * interrupted during the read/write of the device.  If it does, it goes ahead
+ * and performs the access and then restores the index register.  If it does
+ * not, it locks normally.
+ *
+ * Note that since we are working with NMIs, we need this lock even in
+ * a non-SMP machine just to mark that the lock is owned.
+ *
+ * This only works with compare-and-swap.  There is no other way to
+ * atomically claim the lock and set the owner.
+ */
+#include <linux/smp.h>
+extern volatile unsigned long cmos_lock;
+x+/*
+ * All of these below must be called with interrupts off, preempt
+ * disabled, etc.
+ */
+
+static inline void lock_cmos(unsigned char reg)x+{
+	unsigned long new;
+	new = ((smp_processor_id()+1) << 8) | reg;
+	for (;;) {
+		if (cmos_lock)x+			continue;
+		if (__cmpxchg(&cmos_lock, 0, new, sizeof(cmos_lock)) == 0)x+			return;
+	}
+}
+
+static inline void unlock_cmos(void)
+{
+	cmos_lock = 0;
+}
+static inline int do_i_have_lock_cmos(void)
+{
+	return (cmos_lock >> 8) == (smp_processor_id()+1);
+}
+static inline unsigned char current_lock_cmos_reg(void)
+{
+	return cmos_lock & 0xff;
+}
+#define lock_cmos_prefix(reg) \
+	do {					\x+		unsigned long cmos_flags;	\x+		local_irq_save(cmos_flags);	\x+		lock_cmos(reg)x+#define lock_cmos_suffix(reg) \
+		unlock_cmos();			\x+		local_irq_restore(cmos_flags);	\x+	} while (0)
+#elsex+#define lock_cmos_prefix(reg) do {} while (0)
+#define lock_cmos_suffix(reg) do {} while (0)
+#define lock_cmos(reg)x+#define unlock_cmos()x+#define do_i_have_lock_cmos() 0x+#define current_lock_cmos_reg() 0x+#endif
+
 /*
  * The yet supported machines all access the RTC index register via
  * an ISA port access but the way to access the date register differs ...
  */x-#define CMOS_READ(addr) ({ \
-outb_p((addr),RTC_PORT(0)); \
-inb_p(RTC_PORT(1)); \
-})x-#define CMOS_WRITE(val, addr) ({ \
-outb_p((addr),RTC_PORT(0)); \
-outb_p((val),RTC_PORT(1)); \
-})x+#define CMOS_READ(addr) rtc_cmos_read(addr)x+#define CMOS_WRITE(val, addr) rtc_cmos_write(val, addr)
+unsigned char rtc_cmos_read(unsigned char addr);
+void rtc_cmos_write(unsigned char val, unsigned char addr);
 x #define RTC_IRQ 8
 
diff -Nru a/include/asm-i386/module.h b/include/asm-i386/module.h
--- a/include/asm-i386/module.h	2004-10-20 01:37:19 -07:00
+++ b/include/asm-i386/module.h	2005-03-07 20:41:30 -08:00
@@ -52,6 +52,8 @@
 #define MODULE_PROC_FAMILY "CYRIXIII "
 #elif defined CONFIG_MVIAC3_2
 #define MODULE_PROC_FAMILY "VIAC3-2 "
+#elif CONFIG_MGEODEx+#define MODULE_PROC_FAMILY "GEODE "
 #elsex #error unknown processor family
 #endif
diff -Nru a/include/asm-i386/pgtable-2level.h b/include/asm-i386/pgtable-2level.h
--- a/include/asm-i386/pgtable-2level.h	2004-12-22 01:31:43 -08:00
+++ b/include/asm-i386/pgtable-2level.h	2005-02-23 15:40:53 -08:00
@@ -14,10 +14,11 @@
  * hook is made available.
  */x #define set_pte(pteptr, pteval) (*(pteptr) = pteval)
+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 #define set_pte_atomic(pteptr, pteval) set_pte(pteptr,pteval)
 #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))x x-#define ptep_get_and_clear(xp)	__pte(xchg(&(xp)->pte_low, 0))x+#define ptep_get_and_clear(mm,addr,xp)	__pte(xchg(&(xp)->pte_low, 0))x #define pte_same(a, b)		((a).pte_low == (b).pte_low)x #define pte_page(x)		pfn_to_page(pte_pfn(x))x #define pte_none(x)		(!(x).pte_low)xdiff -Nru a/include/asm-i386/pgtable-3level.h b/include/asm-i386/pgtable-3level.h
--- a/include/asm-i386/pgtable-3level.h	2004-12-22 01:31:49 -08:00
+++ b/include/asm-i386/pgtable-3level.h	2005-02-23 15:40:53 -08:00
@@ -56,6 +56,8 @@
 	smp_wmb();
 	ptep->pte_low = pte.pte_low;
 }x+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
+
 #define __HAVE_ARCH_SET_PTE_ATOMIC
 #define set_pte_atomic(pteptr,pteval) \
 		set_64bit((unsigned long long *)(pteptr),pte_val(pteval))x@@ -88,7 +90,7 @@
 #define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \
 			pmd_index(address))x 
-static inline pte_t ptep_get_and_clear(pte_t *ptep)
+static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	pte_t res;
 xdiff -Nru a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h
--- a/include/asm-i386/pgtable.h	2005-01-03 15:49:21 -08:00
+++ b/include/asm-i386/pgtable.h	2005-02-23 15:40:53 -08:00
@@ -201,7 +201,7 @@
 extern unsigned long pg0[];
 
 #define pte_present(x)	((x).pte_low & (_PAGE_PRESENT | _PAGE_PROTNONE))x-#define pte_clear(xp)	do { set_pte(xp, __pte(0)); } while (0)
+#define pte_clear(mm,addr,xp)	do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
 
 #define pmd_none(x)	(!pmd_val(x))x #define pmd_present(x)	(pmd_val(x) & _PAGE_PRESENT)x@@ -243,22 +243,24 @@
 # include <asm/pgtable-2level.h>
 #endif
 
-static inline int ptep_test_and_clear_dirty(pte_t *ptep)
+static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 	if (!pte_dirty(*ptep))
 		return 0;
 	return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte_low);
 }x 
-static inline int ptep_test_and_clear_young(pte_t *ptep)
+static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 	if (!pte_young(*ptep))
 		return 0;
 	return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte_low);
 }x 
-static inline void ptep_set_wrprotect(pte_t *ptep)		{ clear_bit(_PAGE_BIT_RW, &ptep->pte_low); }x-static inline void ptep_mkdirty(pte_t *ptep)			{ set_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); }x+static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
+{
+	clear_bit(_PAGE_BIT_RW, &ptep->pte_low);
+}
 
 /*
  * Macro to mark a page protection value as "uncacheable".  On processors which do not support
@@ -407,7 +409,6 @@
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
 #define __HAVE_ARCH_PTEP_SET_WRPROTECTx-#define __HAVE_ARCH_PTEP_MKDIRTY
 #define __HAVE_ARCH_PTE_SAME
 #include <asm-generic/pgtable.h>
 
diff -Nru a/include/asm-i386/processor.h b/include/asm-i386/processor.h
--- a/include/asm-i386/processor.h	2005-01-11 16:42:43 -08:00
+++ b/include/asm-i386/processor.h	2005-03-07 20:41:31 -08:00
@@ -137,7 +137,7 @@
  * clear %ecx since some cpus (Cyrix MII) do not set or clear %ecx
  * resulting in stale register contents being returned.
  */x-static inline void cpuid(int op, int *eax, int *ebx, int *ecx, int *edx)
+static inline void cpuid(unsigned int op, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx)
 {
 	__asm__("cpuid"
 		: "=a" (*eax),
diff -Nru a/include/asm-i386/suspend.h b/include/asm-i386/suspend.h
--- a/include/asm-i386/suspend.h	2004-10-18 22:26:45 -07:00
+++ b/include/asm-i386/suspend.h	2005-03-07 20:41:32 -08:00
@@ -10,10 +10,12 @@
 arch_prepare_suspend(void)
 {
 	/* If you want to make non-PSE machine work, turn off paging
-           in do_magic. swsusp_pg_dir should have identity mapping, so
+           in swsusp_arch_suspend. swsusp_pg_dir should have identity mapping, so
            it could work...  */x-	if (!cpu_has_pse)x+	if (!cpu_has_pse) {
+		printk(KERN_ERR "PSE is required for swsusp.\n");
 		return -EPERM;
+	}
 	return 0;
 }
 
diff -Nru a/include/asm-i386/system.h b/include/asm-i386/system.h
--- a/include/asm-i386/system.h	2005-01-04 18:48:18 -08:00
+++ b/include/asm-i386/system.h	2005-03-04 22:41:13 -08:00
@@ -468,4 +468,6 @@
 extern int es7000_plat;
 void cpu_idle_wait(void);
 
+extern unsigned long arch_align_stack(unsigned long sp);
+
 #endif
diff -Nru a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
--- a/include/asm-i386/thread_info.h	2005-01-30 22:20:14 -08:00
+++ b/include/asm-i386/thread_info.h	2005-03-07 20:41:40 -08:00
@@ -140,6 +140,7 @@
 #define TIF_SINGLESTEP		4	/* restore singlestep on return to user mode */
 #define TIF_IRET		5	/* return with iret */
 #define TIF_SYSCALL_AUDIT	7	/* syscall auditing active */x+#define TIF_SECCOMP		8	/* secure computing */
 #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE		17x x@@ -150,12 +151,14 @@
 #define _TIF_SINGLESTEP		(1<<TIF_SINGLESTEP)
 #define _TIF_IRET		(1<<TIF_IRET)
 #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)x+#define _TIF_SECCOMP		(1<<TIF_SECCOMP)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)x x /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK \
-  (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP))x-#define _TIF_ALLWORK_MASK	0x0000FFFF	/* work to do on any return to u-space */
+  (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP|_TIF_SECCOMP))x+/* work to do on any return to u-space */
+#define _TIF_ALLWORK_MASK	(0x0000FFFF & ~_TIF_SECCOMP)
 
 /*
  * Thread-synchronous status.
diff -Nru a/include/asm-i386/uaccess.h b/include/asm-i386/uaccess.h
--- a/include/asm-i386/uaccess.h	2005-01-01 12:21:02 -08:00
+++ b/include/asm-i386/uaccess.h	2005-03-05 16:26:28 -08:00
@@ -185,6 +185,21 @@
 
 extern void __put_user_bad(void);
 
+/*
+ * Strange magic calling convention: pointer in %ecx,
+ * value in %eax(:%edx), return value in %eax, no clobbers.
+ */
+extern void __put_user_1(void);
+extern void __put_user_2(void);
+extern void __put_user_4(void);
+extern void __put_user_8(void);
+x+#define __put_user_1(x, ptr) __asm__ __volatile__("call __put_user_1":"=a" (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr))x+#define __put_user_2(x, ptr) __asm__ __volatile__("call __put_user_2":"=a" (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr))x+#define __put_user_4(x, ptr) __asm__ __volatile__("call __put_user_4":"=a" (__ret_pu):"0" ((typeof(*(ptr)))(x)), "c" (ptr))x+#define __put_user_8(x, ptr) __asm__ __volatile__("call __put_user_8":"=a" (__ret_pu):"A" ((typeof(*(ptr)))(x)), "c" (ptr))x+#define __put_user_X(x, ptr) __asm__ __volatile__("call __put_user_X":"=a" (__ret_pu):"c" (ptr))x+
 /**
  * put_user: - Write a simple value into user space.
  * @x:   Value to copy to user space.
@@ -201,9 +216,18 @@
  *
  * Returns zero on success, or -EFAULT on error.
  */x-#define put_user(x,ptr)							\
-  __put_user_check((__typeof__(*(ptr)))(x),(ptr),sizeof(*(ptr)))
-
+#define put_user(x,ptr)						\
+({	int __ret_pu;						\
+	__chk_user_ptr(ptr);					\
+	switch(sizeof(*(ptr))) {				\
+	case 1: __put_user_1(x, ptr); break;			\
+	case 2: __put_user_2(x, ptr); break;			\
+	case 4: __put_user_4(x, ptr); break;			\
+	case 8: __put_user_8(x, ptr); break;			\
+	default:__put_user_X(x, ptr); break;			\
+	}							\
+	__ret_pu;						\
+})
 
 /**
  * __get_user: - Get a simple variable from user space, with less checking.
@@ -258,16 +282,6 @@
 	__pu_err;						\
 })
 x-x-#define __put_user_check(x,ptr,size)					\
-({									\
-	long __pu_err = -EFAULT;					\
-	__typeof__(*(ptr)) __user *__pu_addr = (ptr);			\x-	might_sleep();						\
-	if (access_ok(VERIFY_WRITE,__pu_addr,size))			\
-		__put_user_size((x),__pu_addr,(size),__pu_err,-EFAULT);	\
-	__pu_err;							\
-})							
 
 #define __put_user_u64(x, addr, err)				\
 	__asm__ __volatile__(					\
diff -Nru a/include/asm-ia64/cacheflush.h b/include/asm-ia64/cacheflush.h
--- a/include/asm-ia64/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-ia64/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -19,7 +19,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_icache_page(vma,page)		do { } while (0)
 #define flush_cache_vmap(start, end)		do { } while (0)
 #define flush_cache_vunmap(start, end)		do { } while (0)
diff -Nru a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
--- a/include/asm-ia64/pci.h	2005-01-10 14:04:31 -08:00
+++ b/include/asm-ia64/pci.h	2005-02-07 12:52:02 -08:00
@@ -121,14 +121,9 @@
 
 extern struct pci_ops pci_root_ops;x 
-static inline int pci_name_bus(char *name, struct pci_bus *bus)
+static inline int pci_proc_domain(struct pci_bus *bus)
 {
-	if (pci_domain_nr(bus) == 0) {
-		sprintf(name, "%02x", bus->number);
-	} else {
-		sprintf(name, "%04x:%02x", pci_domain_nr(bus), bus->number);
-	}
-	return 0;
+	return (pci_domain_nr(bus) != 0);
 }
 
 static inline void pcibios_add_platform_entries(struct pci_dev *dev)
diff -Nru a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
--- a/include/asm-ia64/pgtable.h	2005-01-02 16:45:04 -08:00
+++ b/include/asm-ia64/pgtable.h	2005-02-23 15:40:53 -08:00
@@ -202,6 +202,7 @@
  * the PTE in a page table.  Nothing special needs to be on IA-64.
  */x #define set_pte(ptep, pteval)	(*(ptep) = (pteval))x+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 x #define RGN_SIZE	(1UL << 61)x #define RGN_KERNEL	7x@@ -243,7 +244,7 @@
 
 #define pte_none(pte) 			(!pte_val(pte))x #define pte_present(pte)		(pte_val(pte) & (_PAGE_P | _PAGE_PROTNONE))x-#define pte_clear(pte)			(pte_val(*(pte)) = 0UL)
+#define pte_clear(mm,addr,pte)		(pte_val(*(pte)) = 0UL)
 /* pte_page() returns the "struct page *" corresponding to the PTE: */
 #define pte_page(pte)			virt_to_page(((pte_val(pte) & _PFN_MASK) + PAGE_OFFSET))x x@@ -345,7 +346,7 @@
 /* atomic versions of the some PTE manipulations: */
 
 static inline int
-ptep_test_and_clear_young (pte_t *ptep)
+ptep_test_and_clear_young (struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 #ifdef CONFIG_SMP
 	if (!pte_young(*ptep))
@@ -355,13 +356,13 @@
 	pte_t pte = *ptep;
 	if (!pte_young(pte))x 		return 0;
-	set_pte(ptep, pte_mkold(pte));
+	set_pte_at(vma->vm_mm, addr, ptep, pte_mkold(pte));
 	return 1;
 #endif
 }
 
 static inline int
-ptep_test_and_clear_dirty (pte_t *ptep)
+ptep_test_and_clear_dirty (struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 #ifdef CONFIG_SMP
 	if (!pte_dirty(*ptep))
@@ -371,25 +372,25 @@
 	pte_t pte = *ptep;
 	if (!pte_dirty(pte))x 		return 0;
-	set_pte(ptep, pte_mkclean(pte));
+	set_pte_at(vma->vm_mm, addr, ptep, pte_mkclean(pte));
 	return 1;
 #endif
 }
 
 static inline pte_t
-ptep_get_and_clear (pte_t *ptep)
+ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 #ifdef CONFIG_SMP
 	return __pte(xchg((long *) ptep, 0));
 #elsex 	pte_t pte = *ptep;
-	pte_clear(ptep);
+	pte_clear(mm, addr, ptep);
 	return pte;
 #endif
 }
 
 static inline void
-ptep_set_wrprotect (pte_t *ptep)
+ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 #ifdef CONFIG_SMP
 	unsigned long new, old;
@@ -400,18 +401,7 @@
 	} while (cmpxchg((unsigned long *) ptep, old, new) != old);
 #elsex 	pte_t old_pte = *ptep;
-	set_pte(ptep, pte_wrprotect(old_pte));
-#endif
-}x-x-static inline void
-ptep_mkdirty (pte_t *ptep)
-{
-#ifdef CONFIG_SMP
-	set_bit(_PAGE_D_BIT, ptep);
-#elsex-	pte_t old_pte = *ptep;
-	set_pte(ptep, pte_mkdirty(old_pte));
+	set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
 #endif
 }
 
@@ -558,7 +548,6 @@
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
 #define __HAVE_ARCH_PTEP_SET_WRPROTECTx-#define __HAVE_ARCH_PTEP_MKDIRTY
 #define __HAVE_ARCH_PTE_SAME
 #define __HAVE_ARCH_PGD_OFFSET_GATE
 #include <asm-generic/pgtable.h>
diff -Nru a/include/asm-ia64/system.h b/include/asm-ia64/system.h
--- a/include/asm-ia64/system.h	2005-01-04 18:48:18 -08:00
+++ b/include/asm-ia64/system.h	2005-03-04 22:41:13 -08:00
@@ -285,6 +285,9 @@
 #define ia64_platform_is(x) (strcmp(x, platform_name) == 0)x 
 void cpu_idle_wait(void);
+
+#define arch_align_stack(x) (x)
+
 #endif /* __KERNEL__ */x 
 #endif /* __ASSEMBLY__ */xdiff -Nru a/include/asm-m32r/bug.h b/include/asm-m32r/bug.h
--- a/include/asm-m32r/bug.h	2004-09-17 00:06:56 -07:00
+++ b/include/asm-m32r/bug.h	2005-03-07 20:41:32 -08:00
@@ -1,22 +1,4 @@
 #ifndef _M32R_BUG_H
 #define _M32R_BUG_H
-x-#define BUG()	do { \
-	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
-} while (0)
-x-#define PAGE_BUG(page)	do { BUG(); } while (0)
-x-#define BUG_ON(condition) \
-	do { if (unlikely((condition)!=0)) BUG(); } while(0)
-x-#define WARN_ON(condition) do { \
-	if (unlikely((condition)!=0)) { \
-		printk("Badness in %s at %s:%d\n", __FUNCTION__, \
-		__FILE__, __LINE__); \
-		dump_stack(); \
-	} \
-} while (0)
-x-#endif /* _M32R_BUG_H */x-
+#include <asm-generic/bug.h>x+#endif
diff -Nru a/include/asm-m32r/cacheflush.h b/include/asm-m32r/cacheflush.h
--- a/include/asm-m32r/cacheflush.h	2004-09-17 00:06:56 -07:00
+++ b/include/asm-m32r/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -11,7 +11,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
@@ -31,7 +31,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
@@ -43,7 +43,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
diff -Nru a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h
--- a/include/asm-m32r/pgtable-2level.h	2005-01-03 15:49:31 -08:00
+++ b/include/asm-m32r/pgtable-2level.h	2005-02-23 15:40:53 -08:00
@@ -44,6 +44,7 @@
  * hook is made available.
  */x #define set_pte(pteptr, pteval) (*(pteptr) = pteval)
+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 #define set_pte_atomic(pteptr, pteval)	set_pte(pteptr, pteval)
 /*
  * (pmds are folded into pgds so this doesnt get actually called,
@@ -60,7 +61,7 @@
 	return (pmd_t *) dir;
 }x 
-#define ptep_get_and_clear(xp)	__pte(xchg(&(xp)->pte, 0))x+#define ptep_get_and_clear(mm,addr,xp)	__pte(xchg(&(xp)->pte, 0))x #define pte_same(a, b)		(pte_val(a) == pte_val(b))x #define pte_page(x)		pfn_to_page(pte_pfn(x))x #define pte_none(x)		(!pte_val(x))
diff -Nru a/include/asm-m32r/pgtable.h b/include/asm-m32r/pgtable.h
--- a/include/asm-m32r/pgtable.h	2005-01-03 15:49:31 -08:00
+++ b/include/asm-m32r/pgtable.h	2005-02-23 15:40:53 -08:00
@@ -176,7 +176,7 @@
 /* page table for 0-4MB for everybody */
 
 #define pte_present(x)	(pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE))x-#define pte_clear(xp)	do { set_pte(xp, __pte(0)); } while (0)
+#define pte_clear(mm,addr,xp)	do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
 
 #define pmd_none(x)	(!pmd_val(x))x #define pmd_present(x)	(pmd_val(x) & _PAGE_PRESENT)x@@ -282,26 +282,21 @@
 	return pte;
 }x 
-static inline  int ptep_test_and_clear_dirty(pte_t *ptep)
+static inline  int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 	return test_and_clear_bit(_PAGE_BIT_DIRTY, ptep);
 }x 
-static inline  int ptep_test_and_clear_young(pte_t *ptep)
+static inline  int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 	return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep);
 }x 
-static inline void ptep_set_wrprotect(pte_t *ptep)
+static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	clear_bit(_PAGE_BIT_WRITE, ptep);
 }x 
-static inline void ptep_mkdirty(pte_t *ptep)
-{
-	set_bit(_PAGE_BIT_DIRTY, ptep);
-}x-x /*
  * Macro and implementation to make a page protection as uncachable.
  */x@@ -390,7 +385,6 @@
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
 #define __HAVE_ARCH_PTEP_SET_WRPROTECTx-#define __HAVE_ARCH_PTEP_MKDIRTY
 #define __HAVE_ARCH_PTE_SAME
 #include <asm-generic/pgtable.h>
 
diff -Nru a/include/asm-m32r/system.h b/include/asm-m32r/system.h
--- a/include/asm-m32r/system.h	2005-01-03 15:49:32 -08:00
+++ b/include/asm-m32r/system.h	2005-03-04 22:41:13 -08:00
@@ -294,4 +294,6 @@
 #define set_mb(var, value) do { xchg(&var, value); } while (0)
 #define set_wmb(var, value) do { var = value; wmb(); } while (0)
 
+#define arch_align_stack(x) (x)
+
 #endif  /* _ASM_M32R_SYSTEM_H */xdiff -Nru a/include/asm-m68k/cacheflush.h b/include/asm-m68k/cacheflush.h
--- a/include/asm-m68k/cacheflush.h	2004-09-17 07:15:21 -07:00
+++ b/include/asm-m68k/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -99,8 +99,7 @@
 	        __flush_cache_030();
 }x 
-static inline void flush_cache_page(struct vm_area_struct *vma,
-				    unsigned long vmaddr)
+static inline void flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn)x {
 	if (vma->vm_mm == current->mm)x 	        __flush_cache_030();
@@ -134,15 +133,15 @@
 #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
 
 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
-	do {					\
-		flush_cache_page(vma, vaddr);	\
-		memcpy(dst, src, len);		\
+	do {							\x+		flush_cache_page(vma, vaddr, page_to_pfn(page));\x+		memcpy(dst, src, len);				\
 	} while (0)
 
 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
-	do {					\
-		flush_cache_page(vma, vaddr);	\
-		memcpy(dst, src, len);		\
+	do {							\x+		flush_cache_page(vma, vaddr, page_to_pfn(page));\x+		memcpy(dst, src, len);				\
 	} while (0)
 
 extern void flush_icache_range(unsigned long address, unsigned long endaddr);
diff -Nru a/include/asm-m68k/motorola_pgtable.h b/include/asm-m68k/motorola_pgtable.h
--- a/include/asm-m68k/motorola_pgtable.h	2004-04-04 03:11:21 -07:00
+++ b/include/asm-m68k/motorola_pgtable.h	2005-02-23 15:40:53 -08:00
@@ -129,7 +129,7 @@
 
 #define pte_none(pte)		(!pte_val(pte))x #define pte_present(pte)	(pte_val(pte) & (_PAGE_PRESENT | _PAGE_PROTNONE))x-#define pte_clear(ptep)		({ pte_val(*(ptep)) = 0; })
+#define pte_clear(mm,addr,ptep)		({ pte_val(*(ptep)) = 0; })
 
 #define pte_page(pte)		(mem_map + ((unsigned long)(__va(pte_val(pte)) - PAGE_OFFSET) >> PAGE_SHIFT))x #define pte_pfn(pte)		(pte_val(pte) >> PAGE_SHIFT)
diff -Nru a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h
--- a/include/asm-m68k/pgtable.h	2004-12-22 01:36:07 -08:00
+++ b/include/asm-m68k/pgtable.h	2005-02-23 15:40:53 -08:00
@@ -26,6 +26,7 @@
 	do{							\
 		*(pteptr) = (pteval);				\
 	} while(0)
+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 x 
 /* PMD_SHIFT determines the size of the area a second-level page table can map */xdiff -Nru a/include/asm-m68k/sun3_pgtable.h b/include/asm-m68k/sun3_pgtable.h
--- a/include/asm-m68k/sun3_pgtable.h	2004-01-18 22:35:43 -08:00
+++ b/include/asm-m68k/sun3_pgtable.h	2005-02-23 15:40:53 -08:00
@@ -123,7 +123,10 @@
 
 static inline int pte_none (pte_t pte) { return !pte_val (pte); }x static inline int pte_present (pte_t pte) { return pte_val (pte) & SUN3_PAGE_VALID; }x-static inline void pte_clear (pte_t *ptep) { pte_val (*ptep) = 0; }x+static inline void pte_clear (struct mm_struct *mm, unsigned long addr, pte_t *ptep)
+{
+	pte_val (*ptep) = 0;
+}
 
 #define pte_pfn(pte)            (pte_val(pte) & SUN3_PAGE_PGNUM_MASK)
 #define pfn_pte(pfn, pgprot) \
diff -Nru a/include/asm-m68k/system.h b/include/asm-m68k/system.h
--- a/include/asm-m68k/system.h	2004-09-07 23:32:57 -07:00
+++ b/include/asm-m68k/system.h	2005-03-04 22:41:13 -08:00
@@ -194,6 +194,8 @@
 					(unsigned long)(n),sizeof(*(ptr))))
 #endif
 
+#define arch_align_stack(x) (x)
+
 #endif /* __KERNEL__ */x 
 #endif /* _M68K_SYSTEM_H */xdiff -Nru a/include/asm-m68knommu/cacheflush.h b/include/asm-m68knommu/cacheflush.h
--- a/include/asm-m68knommu/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-m68knommu/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -9,7 +9,7 @@
 #define flush_cache_all()			__flush_cache_all()x #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_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_dcache_range(start,len)		do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
diff -Nru a/include/asm-m68knommu/system.h b/include/asm-m68knommu/system.h
--- a/include/asm-m68knommu/system.h	2004-10-27 18:14:35 -07:00
+++ b/include/asm-m68knommu/system.h	2005-03-04 22:41:13 -08:00
@@ -281,5 +281,6 @@
 })
 #endif
 #endif
+#define arch_align_stack(x) (x)
 
 #endif /* _M68KNOMMU_SYSTEM_H */xdiff -Nru a/include/asm-mips/cacheflush.h b/include/asm-mips/cacheflush.h
--- a/include/asm-mips/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-mips/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -17,7 +17,7 @@
  *
  *  - flush_cache_all() flushes entire cache
  *  - flush_cache_mm(mm) flushes the specified mm context's cache lines
- *  - flush_cache_page(mm, vmaddr) flushes a single page
+ *  - flush_cache_page(mm, vmaddr, pfn) flushes a single page
  *  - flush_cache_range(vma, start, end) flushes a range of pages
  *  - flush_icache_range(start, end) flush a range of instructions
  *  - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcachex@@ -34,8 +34,7 @@
 extern void (*flush_cache_mm)(struct mm_struct *mm);
 extern void (*flush_cache_range)(struct vm_area_struct *vma,
 	unsigned long start, unsigned long end);
-extern void (*flush_cache_page)(struct vm_area_struct *vma,
-	unsigned long page);
+extern void (*flush_cache_page)(struct vm_area_struct *vma, unsigned long page, unsigned long pfn);
 extern void __flush_dcache_page(struct page *page);
 
 static inline void flush_dcache_page(struct page *page)xdiff -Nru a/include/asm-mips/pci.h b/include/asm-mips/pci.h
--- a/include/asm-mips/pci.h	2004-11-29 05:11:43 -08:00
+++ b/include/asm-mips/pci.h	2005-02-07 12:52:02 -08:00
@@ -137,17 +137,10 @@
 
 #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->indexx 
-static inline int
-pci_name_bus(char *name, struct pci_bus *bus)
+static inline int pci_proc_domain(struct pci_bus *bus)
 {
 	struct pci_controller *hose = bus->sysdata;
-x-	if (likely(hose->need_domain_info == 0)) {
-		sprintf(name, "%02x", bus->number);
-	} else {
-		sprintf(name, "%04x:%02x", hose->index, bus->number);
-	}
-	return 0;
+	return hose->need_domain_info;
 }x 
 #endif /* CONFIG_PCI_DOMAINS */xdiff -Nru a/include/asm-mips/pgtable.h b/include/asm-mips/pgtable.h
--- a/include/asm-mips/pgtable.h	2004-12-22 01:36:07 -08:00
+++ b/include/asm-mips/pgtable.h	2005-02-23 15:40:53 -08:00
@@ -100,14 +100,15 @@
 			buddy->pte_low |= _PAGE_GLOBAL;
 	}
 }x+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 x-static inline void pte_clear(pte_t *ptep)
+static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	/* Preserve global status for the pair */
 	if (pte_val(*ptep_buddy(ptep)) & _PAGE_GLOBAL)
-		set_pte(ptep, __pte(_PAGE_GLOBAL));
+		set_pte_at(mm, addr, ptep, __pte(_PAGE_GLOBAL));
 	elsex-		set_pte(ptep, __pte(0));
+		set_pte_at(mm, addr, ptep, __pte(0));
 }
 #elsex /*
@@ -130,16 +131,17 @@
 	}
 #endif
 }
+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 x-static inline void pte_clear(pte_t *ptep)
+static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 #if !defined(CONFIG_CPU_R3000) && !defined(CONFIG_CPU_TX39XX)
 	/* Preserve global status for the pair */
 	if (pte_val(*ptep_buddy(ptep)) & _PAGE_GLOBAL)
-		set_pte(ptep, __pte(_PAGE_GLOBAL));
+		set_pte_at(mm, addr, ptep, __pte(_PAGE_GLOBAL));
 	elsex #endif
-		set_pte(ptep, __pte(0));
+		set_pte_at(mm, addr, ptep, __pte(0));
 }
 #endif
 
diff -Nru a/include/asm-mips/resource.h b/include/asm-mips/resource.h
--- a/include/asm-mips/resource.h	2005-01-20 21:00:50 -08:00
+++ b/include/asm-mips/resource.h	2005-03-07 20:41:39 -08:00
@@ -9,36 +9,26 @@
 #ifndef _ASM_RESOURCE_H
 #define _ASM_RESOURCE_H
 
+#include <linux/config.h>
+
 /*
- * Resource limits
+ * These five resource limit IDs have a MIPS/Linux-specific ordering,
+ * the rest comes from the generic header:
  */x-#define RLIMIT_CPU 0			/* CPU time in ms */x-#define RLIMIT_FSIZE 1			/* Maximum filesize */x-#define RLIMIT_DATA 2			/* max data size */x-#define RLIMIT_STACK 3			/* max stack size */x-#define RLIMIT_CORE 4			/* max core file size */x-#define RLIMIT_NOFILE 5			/* max number of open files */x-#define RLIMIT_AS 6			/* mapped memory */x-#define RLIMIT_RSS 7			/* max resident set size */x-#define RLIMIT_NPROC 8			/* max number of processes */x-#define RLIMIT_MEMLOCK 9		/* max locked-in-memory address space */
-#define RLIMIT_LOCKS 10			/* maximum file locks held */x-#define RLIMIT_SIGPENDING 11		/* max number of pending signals */x-#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */x-x-#define RLIM_NLIMITS 13			/* Number of limit flavors.  */x-#define __ARCH_RLIMIT_ORDER
+#define RLIMIT_NOFILE		5	/* max number of open files */x+#define RLIMIT_AS		6	/* address space limit */x+#define RLIMIT_RSS		7	/* max resident set size */x+#define RLIMIT_NPROC		8	/* max number of processes */x+#define RLIMIT_MEMLOCK		9	/* max locked-in-memory address space */
 
 /*
  * SuS says limits have to be unsigned.
- * Which makes a ton more sense anyway.
+ * Which makes a ton more sense anyway,
+ * but we keep the old value on MIPS32,
+ * for compatibility:
  */x-#include <linux/config.h>
 #ifdef CONFIG_MIPS32x-#define RLIM_INFINITY	0x7fffffffUL
-#endif
-#ifdef CONFIG_MIPS64x-#define RLIM_INFINITY	(~0UL)
+# define RLIM_INFINITY		0x7fffffffUL
 #endif
 
 #include <asm-generic/resource.h>
diff -Nru a/include/asm-mips/system.h b/include/asm-mips/system.h
--- a/include/asm-mips/system.h	2004-11-29 05:11:43 -08:00
+++ b/include/asm-mips/system.h	2005-03-04 22:41:13 -08:00
@@ -433,4 +433,6 @@
 #define finish_arch_switch(rq, prev)	spin_unlock_irq(&(prev)->switch_lock)x #define task_running(rq, p) 		((rq)->curr == (p) || spin_is_locked(&(p)->switch_lock))
 
+#define arch_align_stack(x) (x)
+
 #endif /* _ASM_SYSTEM_H */xdiff -Nru a/include/asm-mips/vr41xx/siu.h b/include/asm-mips/vr41xx/siu.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-mips/vr41xx/siu.h	2005-03-08 09:50:41 -08:00
@@ -0,0 +1,50 @@
+/*
+ *  Include file for NEC VR4100 series Serial Interface Unit.
+ *
+ *  Copyright (C) 2005  Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
+ *
+ *  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
+ */
+#ifndef __NEC_VR41XX_SIU_H
+#define __NEC_VR41XX_SIU_H
+
+typedef enum {
+	SIU_INTERFACE_RS232C,
+	SIU_INTERFACE_IRDA,
+} siu_interface_t;
+
+extern void vr41xx_select_siu_interface(siu_interface_t interface);
+
+typedef enum {
+	SIU_USE_IRDA,
+	FIR_USE_IRDA,
+} irda_use_t;
+
+extern void vr41xx_use_irda(irda_use_t use);
+
+typedef enum {
+	SHARP_IRDA,
+	TEMIC_IRDA,
+	HP_IRDA,
+} irda_module_t;
+
+typedef enum {
+	IRDA_TX_1_5MBPS,
+	IRDA_TX_4MBPS,
+} irda_speed_t;
+
+extern void vr41xx_select_irda_module(irda_module_t module, irda_speed_t speed);
+
+#endif /* __NEC_VR41XX_SIU_H */xdiff -Nru a/include/asm-mips/vr41xx/vr41xx.h b/include/asm-mips/vr41xx/vr41xx.h
--- a/include/asm-mips/vr41xx/vr41xx.h	2004-06-24 01:55:59 -07:00
+++ b/include/asm-mips/vr41xx/vr41xx.h	2005-03-07 20:41:37 -08:00
@@ -45,6 +45,7 @@
 /*
  * Bus Control Uint
  */
+extern unsigned long vr41xx_calculate_clock_frequency(void);
 extern unsigned long vr41xx_get_vtclock_frequency(void);
 extern unsigned long vr41xx_get_tclock_frequency(void);
 x@@ -83,7 +84,7 @@
 #define INT2_CASCADE_IRQ	MIPS_CPU_IRQ(4)
 #define INT3_CASCADE_IRQ	MIPS_CPU_IRQ(5)
 #define INT4_CASCADE_IRQ	MIPS_CPU_IRQ(6)
-#define MIPS_COUNTER_IRQ	MIPS_CPU_IRQ(7)x+#define TIMER_IRQ		MIPS_CPU_IRQ(7)x 
 /* SYINT1 Interrupt Numbers */x #define SYSINT1_IRQ_BASE	8x@@ -245,34 +246,6 @@
 	DATA_LOW,
 	DATA_HIGH
 };
-x-/*
- * Serial Interface Unit
- */
-extern void vr41xx_siu_init(void);
-extern int vr41xx_serial_ports;
-x-/* SIU interfaces */x-typedef enum {
-	SIU_RS232C,
-	SIU_IRDA
-} siu_interface_t;
-x-/* IrDA interfaces */x-typedef enum {
-	IRDA_NONE,
-	IRDA_SHARP,
-	IRDA_TEMIC,
-	IRDA_HP
-} irda_module_t;
-
-extern void vr41xx_select_siu_interface(siu_interface_t interface,
-                                        irda_module_t module);
-x-/*
- * Debug Serial Interface Unit
- */
-extern void vr41xx_dsiu_init(void);
 
 /*
  * PCI Control Unit
diff -Nru a/include/asm-parisc/cacheflush.h b/include/asm-parisc/cacheflush.h
--- a/include/asm-parisc/cacheflush.h	2004-12-24 15:40:22 -08:00
+++ b/include/asm-parisc/cacheflush.h	2005-03-05 21:15:17 -08:00
@@ -57,9 +57,9 @@
 extern void flush_dcache_page(struct page *page);
 
 #define flush_dcache_mmap_lock(mapping) \
-	spin_lock_irq(&(mapping)->tree_lock)x+	write_lock_irq(&(mapping)->tree_lock)x #define flush_dcache_mmap_unlock(mapping) \
-	spin_unlock_irq(&(mapping)->tree_lock)x+	write_unlock_irq(&(mapping)->tree_lock)x 
 #define flush_icache_page(vma,page)	do { flush_kernel_dcache_page(page_address(page)); flush_kernel_icache_page(page_address(page)); } while (0)
 
@@ -67,14 +67,14 @@
 
 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
 do { \
-	flush_cache_page(vma, vaddr); \x+	flush_cache_page(vma, vaddr, page_to_pfn(page)); \
 	memcpy(dst, src, len); \
 	flush_kernel_dcache_range_asm((unsigned long)dst, (unsigned long)dst + len); \
 } while (0)
 
 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
 do { \
-	flush_cache_page(vma, vaddr); \x+	flush_cache_page(vma, vaddr, page_to_pfn(page)); \
 	memcpy(dst, src, len); \
 } while (0)
 
@@ -170,7 +170,7 @@
 }
 
 static inline void
-flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr)x+flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr, unsigned long pfn)x {
 	BUG_ON(!vma->vm_mm->context);
 xdiff -Nru a/include/asm-parisc/checksum.h b/include/asm-parisc/checksum.h
--- a/include/asm-parisc/checksum.h	2005-01-15 14:01:58 -08:00
+++ b/include/asm-parisc/checksum.h	2005-03-08 11:16:16 -08:00
@@ -30,8 +30,8 @@
  * this is a new version of the above that records errors it finds in *errp,
  * but continues and zeros the rest of the buffer.
  */x-extern unsigned int csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst,
-						int len, unsigned int sum, int *errp);
+extern unsigned int csum_partial_copy_from_user(const unsigned char __user *src,
+		unsigned char *dst, int len, unsigned int sum, int *errp);
 
 /*
  *	Optimized for IP headers, which always checksum on 4 octet boundaries.xdiff -Nru a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h
--- a/include/asm-parisc/compat.h	2004-02-03 21:43:00 -08:00
+++ b/include/asm-parisc/compat.h	2005-03-08 11:16:16 -08:00
@@ -131,15 +131,15 @@
  */x typedef	u32		compat_uptr_t;
 x-static inline void *compat_ptr(compat_uptr_t uptr)
+static inline void __user *compat_ptr(compat_uptr_t uptr)
 {
-	return (void *)(unsigned long)uptr;
+	return (void __user *)(unsigned long)uptr;
 }x 
-static __inline__ void *compat_alloc_user_space(long len)
+static __inline__ void __user *compat_alloc_user_space(long len)
 {
 	struct pt_regs *regs = &current->thread.regs;
-	return (void *)regs->gr[30];
+	return (void __user *)regs->gr[30];
 }x 
 #endif /* _ASM_PARISC_COMPAT_H */xdiff -Nru a/include/asm-parisc/hardware.h b/include/asm-parisc/hardware.h
--- a/include/asm-parisc/hardware.h	2005-01-12 12:03:32 -08:00
+++ b/include/asm-parisc/hardware.h	2005-03-02 03:25:51 -08:00
@@ -122,6 +122,7 @@
 extern void get_pci_node_path(struct pci_dev *dev, struct hardware_path *path);
 extern void init_parisc_bus(void);
 extern struct device *hwpath_to_device(struct hardware_path *modpath);
+extern void device_to_hwpath(struct device *dev, struct hardware_path *path);
 x 
 /* inventory.c: */xdiff -Nru a/include/asm-parisc/ide.h b/include/asm-parisc/ide.h
--- a/include/asm-parisc/ide.h	2004-06-01 10:57:47 -07:00
+++ b/include/asm-parisc/ide.h	2005-03-08 11:16:16 -08:00
@@ -13,8 +13,6 @@
 
 #ifdef __KERNEL__x 
-#include <linux/config.h>
-
 #ifndef MAX_HWIFS
 #define MAX_HWIFS	2
 #endif
diff -Nru a/include/asm-parisc/irq.h b/include/asm-parisc/irq.h
--- a/include/asm-parisc/irq.h	2005-01-12 12:03:33 -08:00
+++ b/include/asm-parisc/irq.h	2005-03-08 11:16:16 -08:00
@@ -40,10 +40,12 @@
 void no_ack_irq(unsigned int irq);
 void no_end_irq(unsigned int irq);
 
-extern int txn_alloc_irq(void);
+extern int txn_alloc_irq(unsigned int nbits);
 extern int txn_claim_irq(int);
-extern unsigned int txn_alloc_data(int, unsigned int);
-extern unsigned long txn_alloc_addr(int);
+extern unsigned int txn_alloc_data(unsigned int);
+extern unsigned long txn_alloc_addr(unsigned int);
+
+extern int cpu_claim_irq(unsigned int irq, struct hw_interrupt_type *, void *);
 x extern int cpu_claim_irq(unsigned int irq, struct hw_interrupt_type *, void *);
 xdiff -Nru a/include/asm-parisc/numnodes.h b/include/asm-parisc/numnodes.h
--- a/include/asm-parisc/numnodes.h	2004-07-09 06:04:21 -07:00
+++ b/include/asm-parisc/numnodes.h	2005-03-08 11:16:18 -08:00
@@ -1,8 +1,6 @@
 #ifndef _ASM_MAX_NUMNODES_H
 #define _ASM_MAX_NUMNODES_H
 
-#include <linux/config.h>
-
 /* Max 8 Nodes */x #define NODES_SHIFT	3
 xdiff -Nru a/include/asm-parisc/parport_gsc.h b/include/asm-parisc/parport_gsc.h
--- a/include/asm-parisc/parport_gsc.h	2002-02-05 09:39:57 -08:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,193 +0,0 @@
-#ifndef __LINUX_PARPORT_GSC_Hx-#define __LINUX_PARPORT_GSC_Hx-
-#include <asm/io.h>
-#include <linux/delay.h>
-
-#undef	DEBUG_PARPORT	/* undefine for production */x-#define DELAY_TIME 	0x-
-#if DELAY_TIME == 0x-#define parport_readb	gsc_readbx-#define parport_writeb	gsc_writeb
-#elsex-static __inline__ unsigned char parport_readb( unsigned long port )
-{
-    udelay(DELAY_TIME);
-    return gsc_readb(port);
-}x-x-static __inline__ void parport_writeb( unsigned char value, unsigned long port )
-{
-    gsc_writeb(value,port);
-    udelay(DELAY_TIME);
-}
-#endif
-x-/* --- register definitions ------------------------------- */x-x-#define EPPDATA(p)  ((p)->base    + 0x4)x-#define EPPADDR(p)  ((p)->base    + 0x3)x-#define CONTROL(p)  ((p)->base    + 0x2)x-#define STATUS(p)   ((p)->base    + 0x1)x-#define DATA(p)     ((p)->base    + 0x0)
-x-struct parport_gsc_private {
-	/* Contents of CTR. */x-	unsigned char ctr;
-
-	/* Bitmask of writable CTR bits. */x-	unsigned char ctr_writable;
-
-	/* Number of bytes per portword. */x-	int pword;
-
-	/* Not used yet. */x-	int readIntrThreshold;
-	int writeIntrThreshold;
-
-	/* buffer suitable for DMA, if DMA enabled */x-	char *dma_buf;
-	dma_addr_t dma_handle;
-	struct pci_dev *dev;
-};
-
-extern __inline__ void parport_gsc_write_data(struct parport *p, unsigned char d)
-{
-#ifdef DEBUG_PARPORT
-	printk (KERN_DEBUG "parport_gsc_write_data(%p,0x%02x)\n", p, d);
-#endif
-	parport_writeb(d, DATA(p));
-}x-x-extern __inline__ unsigned char parport_gsc_read_data(struct parport *p)
-{
-	unsigned char val = parport_readb (DATA (p));
-#ifdef DEBUG_PARPORT
-	printk (KERN_DEBUG "parport_gsc_read_data(%p) = 0x%02x\n",
-		p, val);
-#endif
-	return val;
-}x-x-/* __parport_gsc_frob_control differs from parport_gsc_frob_control in that
- * it doesn't do any extra masking. */x-static __inline__ unsigned char __parport_gsc_frob_control (struct parport *p,
-							   unsigned char mask,
-							   unsigned char val)
-{
-	struct parport_gsc_private *priv = p->physport->private_data;
-	unsigned char ctr = priv->ctr;
-#ifdef DEBUG_PARPORT
-	printk (KERN_DEBUG
-		"__parport_gsc_frob_control(%02x,%02x): %02x -> %02x\n",
-		mask, val, ctr, ((ctr & ~mask) ^ val) & priv->ctr_writable);
-#endif
-	ctr = (ctr & ~mask) ^ val;
-	ctr &= priv->ctr_writable; /* only write writable bits. */x-	parport_writeb (ctr, CONTROL (p));
-	priv->ctr = ctr;	/* Update soft copy */x-	return ctr;
-}
-
-extern __inline__ void parport_gsc_data_reverse (struct parport *p)
-{
-	__parport_gsc_frob_control (p, 0x20, 0x20);
-}
-
-extern __inline__ void parport_gsc_data_forward (struct parport *p)
-{
-	__parport_gsc_frob_control (p, 0x20, 0x00);
-}
-
-extern __inline__ void parport_gsc_write_control (struct parport *p,
-						 unsigned char d)
-{
-	const unsigned char wm = (PARPORT_CONTROL_STROBE |
-				  PARPORT_CONTROL_AUTOFD |
-				  PARPORT_CONTROL_INIT |
-				  PARPORT_CONTROL_SELECT);
-
-	/* Take this out when drivers have adapted to newer interface. */x-	if (d & 0x20) {
-		printk (KERN_DEBUG "%s (%s): use data_reverse for this!\n",
-			p->name, p->cad->name);
-		parport_gsc_data_reverse (p);
-	}
-
-	__parport_gsc_frob_control (p, wm, d & wm);
-}x-x-extern __inline__ unsigned char parport_gsc_read_control(struct parport *p)
-{
-	const unsigned char rm = (PARPORT_CONTROL_STROBE |
-				  PARPORT_CONTROL_AUTOFD |
-				  PARPORT_CONTROL_INIT |
-				  PARPORT_CONTROL_SELECT);
-	const struct parport_gsc_private *priv = p->physport->private_data;
-	return priv->ctr & rm; /* Use soft copy */x-}x-x-extern __inline__ unsigned char parport_gsc_frob_control (struct parport *p,
-							 unsigned char mask,
-							 unsigned char val)
-{
-	const unsigned char wm = (PARPORT_CONTROL_STROBE |
-				  PARPORT_CONTROL_AUTOFD |
-				  PARPORT_CONTROL_INIT |
-				  PARPORT_CONTROL_SELECT);
-
-	/* Take this out when drivers have adapted to newer interface. */x-	if (mask & 0x20) {
-		printk (KERN_DEBUG "%s (%s): use data_%s for this!\n",
-			p->name, p->cad->name,
-			(val & 0x20) ? "reverse" : "forward");
-		if (val & 0x20)
-			parport_gsc_data_reverse (p);
-		elsex-			parport_gsc_data_forward (p);
-	}
-
-	/* Restrict mask and val to control lines. */x-	mask &= wm;
-	val &= wm;
-
-	return __parport_gsc_frob_control (p, mask, val);
-}x-x-extern __inline__ unsigned char parport_gsc_read_status(struct parport *p)
-{
-	return parport_readb (STATUS(p));
-}x-x-
-extern __inline__ void parport_gsc_disable_irq(struct parport *p)
-{
-	__parport_gsc_frob_control (p, 0x10, 0x00);
-}
-
-extern __inline__ void parport_gsc_enable_irq(struct parport *p)
-{
-	__parport_gsc_frob_control (p, 0x10, 0x10);
-}
-
-extern void parport_gsc_release_resources(struct parport *p);
-
-extern int parport_gsc_claim_resources(struct parport *p);
-
-extern void parport_gsc_init_state(struct pardevice *, struct parport_state *s);
-
-extern void parport_gsc_save_state(struct parport *p, struct parport_state *s);
-
-extern void parport_gsc_restore_state(struct parport *p, struct parport_state *s);
-
-extern void parport_gsc_inc_use_count(void);
-
-extern void parport_gsc_dec_use_count(void);
-
-extern struct parport *parport_gsc_probe_port (unsigned long base,
-					      unsigned long base_hi,
-					      int irq, int dma,
-					      struct pci_dev *dev);
-x-#endifxdiff -Nru a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h
--- a/include/asm-parisc/pgtable.h	2004-12-22 01:36:07 -08:00
+++ b/include/asm-parisc/pgtable.h	2005-02-23 15:40:53 -08:00
@@ -39,6 +39,7 @@
         do{                                                     \
                 *(pteptr) = (pteval);                           \
         } while(0)
+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
 x #endif /* !__ASSEMBLY__ */x 
@@ -263,7 +264,7 @@
 
 #define pte_none(x)     ((pte_val(x) == 0) || (pte_val(x) & _PAGE_FLUSH))x #define pte_present(x)	(pte_val(x) & _PAGE_PRESENT)x-#define pte_clear(xp)	do { pte_val(*(xp)) = 0; } while (0)
+#define pte_clear(mm,addr,xp)	do { pte_val(*(xp)) = 0; } while (0)
 
 #define pmd_flag(x)	(pmd_val(x) & PxD_FLAG_MASK)
 #define pmd_address(x)	((unsigned long)(pmd_val(x) &~ PxD_FLAG_MASK) << PxD_VALUE_SHIFT)
@@ -431,7 +432,7 @@
 #define __pte_to_swp_entry(pte)		((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)		((pte_t) { (x).val })x 
-static inline int ptep_test_and_clear_young(pte_t *ptep)
+static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 #ifdef CONFIG_SMP
 	if (!pte_young(*ptep))
@@ -441,12 +442,12 @@
 	pte_t pte = *ptep;
 	if (!pte_young(pte))x 		return 0;
-	set_pte(ptep, pte_mkold(pte));
+	set_pte_at(vma->vm_mm, addr, ptep, pte_mkold(pte));
 	return 1;
 #endif
 }
 
-static inline int ptep_test_and_clear_dirty(pte_t *ptep)
+static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 #ifdef CONFIG_SMP
 	if (!pte_dirty(*ptep))
@@ -456,14 +457,14 @@
 	pte_t pte = *ptep;
 	if (!pte_dirty(pte))x 		return 0;
-	set_pte(ptep, pte_mkclean(pte));
+	set_pte_at(vma->vm_mm, addr, ptep, pte_mkclean(pte));
 	return 1;
 #endif
 }
 
 extern spinlock_t pa_dbit_lock;
 x-static inline pte_t ptep_get_and_clear(pte_t *ptep)
+static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	pte_t old_pte;
 	pte_t pte;
@@ -472,13 +473,13 @@
 	pte = old_pte = *ptep;
 	pte_val(pte) &= ~_PAGE_PRESENT;
 	pte_val(pte) |= _PAGE_FLUSH;
-	set_pte(ptep,pte);
+	set_pte_at(mm,addr,ptep,pte);
 	spin_unlock(&pa_dbit_lock);
 x 	return old_pte;
 }x 
-static inline void ptep_set_wrprotect(pte_t *ptep)
+static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 #ifdef CONFIG_SMP
 	unsigned long new, old;
@@ -489,17 +490,7 @@
 	} while (cmpxchg((unsigned long *) ptep, old, new) != old);
 #elsex 	pte_t old_pte = *ptep;
-	set_pte(ptep, pte_wrprotect(old_pte));
-#endif
-}x-x-static inline void ptep_mkdirty(pte_t *ptep)
-{
-#ifdef CONFIG_SMP
-	set_bit(xlate_pabit(_PAGE_DIRTY_BIT), &pte_val(*ptep));
-#elsex-	pte_t old_pte = *ptep;
-	set_pte(ptep, pte_mkdirty(old_pte));
+	set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
 #endif
 }
 
@@ -518,7 +509,6 @@
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
 #define __HAVE_ARCH_PTEP_SET_WRPROTECTx-#define __HAVE_ARCH_PTEP_MKDIRTY
 #define __HAVE_ARCH_PTE_SAME
 #include <asm-generic/pgtable.h>
 
diff -Nru a/include/asm-parisc/serial.h b/include/asm-parisc/serial.h
--- a/include/asm-parisc/serial.h	2005-01-12 12:03:35 -08:00
+++ b/include/asm-parisc/serial.h	2005-03-08 11:16:19 -08:00
@@ -2,8 +2,6 @@
  * include/asm-parisc/serial.h
  */x 
-#include <linux/config.h>
-
 /*
  * This assumes you have a 7.272727 MHz clock for your UART.
  * The documentation implies a 40Mhz clock, and elsewhere a 7Mhz clock
diff -Nru a/include/asm-parisc/signal.h b/include/asm-parisc/signal.h
--- a/include/asm-parisc/signal.h	2003-09-21 14:50:25 -07:00
+++ b/include/asm-parisc/signal.h	2005-03-08 11:16:19 -08:00
@@ -123,13 +123,14 @@
  * compiler doesn't support code which changes or tests the address of
  * the function in the little struct.  This is really ugly -PB
  */x-typedef __kernel_caddr_t __sighandler_t;
+typedef char __user *__sighandler_t;
 #elsex-typedef void (*__sighandler_t)(int);
+typedef void __signalfn_t(int);
+typedef __signalfn_t __user *__sighandler_t;
 #endif
 
 typedef struct sigaltstack {
-	void *ss_sp;
+	void __user *ss_sp;
 	int ss_flags;
 	size_t ss_size;
 } stack_t;
diff -Nru a/include/asm-parisc/system.h b/include/asm-parisc/system.h
--- a/include/asm-parisc/system.h	2005-01-07 21:43:58 -08:00
+++ b/include/asm-parisc/system.h	2005-03-04 22:41:13 -08:00
@@ -205,4 +205,6 @@
 
 #endif
 
+#define arch_align_stack(x) (x)
+
 #endif
diff -Nru a/include/asm-ppc/cacheflush.h b/include/asm-ppc/cacheflush.h
--- a/include/asm-ppc/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-ppc/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -22,7 +22,7 @@
 #define flush_cache_all()		do { } while (0)
 #define flush_cache_mm(mm)		do { } while (0)
 #define flush_cache_range(vma, a, b)	do { } while (0)
-#define flush_cache_page(vma, p)	do { } while (0)
+#define flush_cache_page(vma, p, pfn)	do { } while (0)
 #define flush_icache_page(vma, page)	do { } while (0)
 #define flush_cache_vmap(start, end)	do { } while (0)
 #define flush_cache_vunmap(start, end)	do { } while (0)
diff -Nru a/include/asm-ppc/cpm2.h b/include/asm-ppc/cpm2.h
--- a/include/asm-ppc/cpm2.h	2004-07-15 16:26:09 -07:00
+++ b/include/asm-ppc/cpm2.h	2005-03-04 22:41:17 -08:00
@@ -531,7 +531,7 @@
 #define SCU_PSMR_RPM		((ushort)0x000c)
 #define SCU_PSMR_REVP		((ushort)0x0008)
 #define SCU_PSMR_TPM		((ushort)0x0003)x-#define SCU_PSMR_TEVP		((ushort)0x0003)
+#define SCU_PSMR_TEVP		((ushort)0x0002)x 
 /* CPM Transparent mode SCC.
  */xdiff -Nru a/include/asm-ppc/cputable.h b/include/asm-ppc/cputable.h
--- a/include/asm-ppc/cputable.h	2004-11-11 00:25:52 -08:00
+++ b/include/asm-ppc/cputable.h	2005-03-04 22:41:15 -08:00
@@ -61,6 +61,11 @@
 extern struct cpu_spec		cpu_specs[];
 extern struct cpu_spec		*cur_cpu_spec[];
 
+static inline unsigned int cpu_has_feature(unsigned int feature)
+{
+	return cur_cpu_spec[0]->cpu_features & feature;
+}
+
 #endif /* __ASSEMBLY__ */x 
 /* CPU kernel features */xdiff -Nru a/include/asm-ppc/highmem.h b/include/asm-ppc/highmem.h
--- a/include/asm-ppc/highmem.h	2005-01-03 15:49:15 -08:00
+++ b/include/asm-ppc/highmem.h	2005-02-23 19:26:53 -08:00
@@ -90,7 +90,7 @@
 #ifdef HIGHMEM_DEBUG
 	BUG_ON(!pte_none(*(kmap_pte+idx)));
 #endif
-	set_pte(kmap_pte+idx, mk_pte(page, kmap_prot));
+	set_pte_at(&init_mm, vaddr, kmap_pte+idx, mk_pte(page, kmap_prot));
 	flush_tlb_page(NULL, vaddr);
 x 	return (void*) vaddr;
@@ -114,7 +114,7 @@
 	 * force other mappings to Oops if they'll try to access
 	 * this pte without first remap it
 	 */x-	pte_clear(kmap_pte+idx);
+	pte_clear(&init_mm, vaddr, kmap_pte+idx);
 	flush_tlb_page(NULL, vaddr);
 #endif
 	dec_preempt_count();
diff -Nru a/include/asm-ppc/io.h b/include/asm-ppc/io.h
--- a/include/asm-ppc/io.h	2005-02-16 10:51:09 -08:00
+++ b/include/asm-ppc/io.h	2005-03-04 22:41:52 -08:00
@@ -30,6 +30,8 @@
 #include <asm/mpc8xx.h>
 #elif defined(CONFIG_8260)
 #include <asm/mpc8260.h>
+#elif defined(CONFIG_83xx)
+#include <asm/mpc83xx.h>
 #elif defined(CONFIG_85xx)
 #include <asm/mpc85xx.h>
 #elif defined(CONFIG_APUS)
diff -Nru a/include/asm-ppc/ipic.h b/include/asm-ppc/ipic.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-ppc/ipic.h	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,85 @@
+/*
+ * include/asm-ppc/ipic.h
+ *
+ * IPIC external definitions and structure.
+ *
+ * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ *
+ * Copyright 2005 Freescale Semiconductor, Inc
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+#ifdef __KERNEL__x+#ifndef __ASM_IPIC_H__x+#define __ASM_IPIC_H__x+
+#include <linux/irq.h>
+
+/* Flags when we init the IPIC */x+#define IPIC_SPREADMODE_GRP_A	0x00000001x+#define IPIC_SPREADMODE_GRP_D	0x00000002x+#define IPIC_SPREADMODE_MIX_A	0x00000004x+#define IPIC_SPREADMODE_MIX_B	0x00000008x+#define IPIC_DISABLE_MCP_OUT	0x00000010x+#define IPIC_IRQ0_MCP		0x00000020
+
+/* IPIC registers offsets */x+#define IPIC_SICFR	0x00	/* System Global Interrupt Configuration Register */x+#define IPIC_SIVCR	0x04	/* System Global Interrupt Vector Register */x+#define IPIC_SIPNR_H	0x08	/* System Internal Interrupt Pending Register (HIGH) */x+#define IPIC_SIPNR_L	0x0C	/* System Internal Interrupt Pending Register (LOW) */x+#define IPIC_SIPRR_A	0x10	/* System Internal Interrupt group A Priority Register */x+#define IPIC_SIPRR_B	0x14	/* System Internal Interrupt group B Priority Register */x+#define IPIC_SIPRR_C	0x18	/* System Internal Interrupt group C Priority Register */x+#define IPIC_SIPRR_D	0x1C	/* System Internal Interrupt group D Priority Register */x+#define IPIC_SIMSR_H	0x20	/* System Internal Interrupt Mask Register (HIGH) */x+#define IPIC_SIMSR_L	0x24	/* System Internal Interrupt Mask Register (LOW) */x+#define IPIC_SICNR	0x28	/* System Internal Interrupt Control Register */x+#define IPIC_SEPNR	0x2C	/* System External Interrupt Pending Register */x+#define IPIC_SMPRR_A	0x30	/* System Mixed Interrupt group A Priority Register */x+#define IPIC_SMPRR_B	0x34	/* System Mixed Interrupt group B Priority Register */x+#define IPIC_SEMSR	0x38	/* System External Interrupt Mask Register */x+#define IPIC_SECNR	0x3C	/* System External Interrupt Control Register */x+#define IPIC_SERSR	0x40	/* System Error Status Register */x+#define IPIC_SERMR	0x44	/* System Error Mask Register */x+#define IPIC_SERCR	0x48	/* System Error Control Register */x+#define IPIC_SIFCR_H	0x50	/* System Internal Interrupt Force Register (HIGH) */x+#define IPIC_SIFCR_L	0x54	/* System Internal Interrupt Force Register (LOW) */x+#define IPIC_SEFCR	0x58	/* System External Interrupt Force Register */x+#define IPIC_SERFR	0x5C	/* System Error Force Register */x+#define IPIC_SCVCR	0x60	/* System Critical Interrupt Vector Register */x+#define IPIC_SMVCR	0x64	/* System Management Interrupt Vector Register */x+
+enum ipic_prio_grp {
+	IPIC_INT_GRP_A = IPIC_SIPRR_A,
+	IPIC_INT_GRP_D = IPIC_SIPRR_D,
+	IPIC_MIX_GRP_A = IPIC_SMPRR_A,
+	IPIC_MIX_GRP_B = IPIC_SMPRR_B,
+};x+
+enum ipic_mcp_irq {
+	IPIC_MCP_IRQ0 = 0,
+	IPIC_MCP_WDT  = 1,
+	IPIC_MCP_SBA  = 2,
+	IPIC_MCP_PCI1 = 5,
+	IPIC_MCP_PCI2 = 6,
+	IPIC_MCP_MU   = 7,
+};x+
+extern void ipic_init(phys_addr_t phys_addr, unsigned int flags,
+		unsigned int irq_offset,
+		unsigned char *senses, unsigned int senses_count);
+extern int ipic_set_priority(unsigned int irq, unsigned int priority);
+extern void ipic_set_highest_priority(unsigned int irq);
+extern void ipic_set_default_priority(void);
+extern void ipic_enable_mcp(enum ipic_mcp_irq mcp_irq);
+extern void ipic_disable_mcp(enum ipic_mcp_irq mcp_irq);
+extern u32 ipic_get_mcp_status(void);
+extern void ipic_clear_mcp_status(u32 mask);
+extern int ipic_get_irq(struct pt_regs *regs);
+
+#endif /* __ASM_IPIC_H__ */x+#endif /* __KERNEL__ */xdiff -Nru a/include/asm-ppc/irq.h b/include/asm-ppc/irq.h
--- a/include/asm-ppc/irq.h	2005-01-20 20:56:31 -08:00
+++ b/include/asm-ppc/irq.h	2005-03-04 22:41:52 -08:00
@@ -161,6 +161,16 @@
 	return irq;
 }x 
+#elif defined(CONFIG_83xx)
+#include <asm/mpc83xx.h>
+
+static __inline__ int irq_canonicalize(int irq)
+{
+	return irq;
+}
+
+#define	NR_IRQS	(NR_IPIC_INTS)
+
 #elif defined(CONFIG_CPM2) && defined(CONFIG_85xx)
 /* Now include the board configuration specific associations.
 */xdiff -Nru a/include/asm-ppc/mpc83xx.h b/include/asm-ppc/mpc83xx.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-ppc/mpc83xx.h	2005-03-04 22:41:52 -08:00
@@ -0,0 +1,114 @@
+/*
+ * include/asm-ppc/mpc83xx.h
+ *
+ * MPC83xx definitions
+ *
+ * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ *
+ * Copyright 2005 Freescale Semiconductor, Inc
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#ifdef __KERNEL__x+#ifndef __ASM_MPC83xx_H__x+#define __ASM_MPC83xx_H__x+
+#include <linux/config.h>
+#include <asm/mmu.h>
+
+#ifdef CONFIG_83xx
+
+#ifdef CONFIG_MPC834x_SYS
+#include <platforms/83xx/mpc834x_sys.h>
+#endif
+x+#define _IO_BASE        isa_io_basex+#define _ISA_MEM_BASE   isa_mem_basex+#ifdef CONFIG_PCIx+#define PCI_DRAM_OFFSET pci_dram_offset
+#elsex+#define PCI_DRAM_OFFSET 0
+#endif
+x+/*
+ * The "residual" board information structure the boot loader passes
+ * into the kernel.
+ */
+extern unsigned char __res[];
+
+/* Internal IRQs on MPC83xx OpenPIC */x+/* Not all of these exist on all MPC83xx implementations */
+
+#ifndef MPC83xx_IPIC_IRQ_OFFSETx+#define MPC83xx_IPIC_IRQ_OFFSET	0
+#endif
+x+#define NR_IPIC_INTS 128
+x+#define MPC83xx_IRQ_UART1	( 9 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_UART2	(10 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_SEC2	(11 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_IIC1	(14 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_IIC2	(15 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_SPI		(16 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_EXT1	(17 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_EXT2	(18 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_EXT3	(19 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_EXT4	(20 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_EXT5	(21 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_EXT6	(22 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_EXT7	(23 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_TSEC1_TX	(32 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_TSEC1_RX	(33 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_TSEC1_ERROR	(34 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_TSEC2_TX	(35 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_TSEC2_RX	(36 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_TSEC2_ERROR	(37 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_USB2_DR	(38 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_USB2_MPH	(39 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_EXT0	(48 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_RTC_SEC	(64 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_PIT		(65 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_PCI1	(66 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_PCI2	(67 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_RTC_ALR	(68 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_MU		(69 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_SBA		(70 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_DMA		(71 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_GTM4	(72 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_GTM8	(73 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_GPIO1	(74 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_GPIO2	(75 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_DDR		(76 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_LBC		(77 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_GTM2	(78 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_GTM6	(79 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_PMC		(80 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_GTM3	(84 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_GTM7	(85 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_GTM1	(90 + MPC83xx_IPIC_IRQ_OFFSET)x+#define MPC83xx_IRQ_GTM5	(91 + MPC83xx_IPIC_IRQ_OFFSET)x+x+#define MPC83xx_CCSRBAR_SIZE	(1024*1024)
+
+/* Let modules/drivers get at immrbar (physical) */
+extern phys_addr_t immrbar;x+
+enum ppc_sys_devices {
+	MPC83xx_TSEC1,
+	MPC83xx_TSEC2,
+	MPC83xx_IIC1,
+	MPC83xx_IIC2,
+	MPC83xx_DUART,
+	MPC83xx_SEC2,
+	MPC83xx_USB2_DR,
+	MPC83xx_USB2_MPH,
+};x+
+#endif /* CONFIG_83xx */x+#endif /* __ASM_MPC83xx_H__ */x+#endif /* __KERNEL__ */xdiff -Nru a/include/asm-ppc/mv64x60_defs.h b/include/asm-ppc/mv64x60_defs.h
--- a/include/asm-ppc/mv64x60_defs.h	2005-01-30 22:22:37 -08:00
+++ b/include/asm-ppc/mv64x60_defs.h	2005-03-04 22:41:17 -08:00
@@ -36,6 +36,8 @@
 #define GT64260_WINDOW_SIZE_MIN			0x00100000
 #define MV64360_WINDOW_SIZE_MIN			0x00010000
 
+#define	MV64x60_TCLK_FREQ_MAX			133333333U
+
 /* IRQ's for embedded controllers */x #define	MV64x60_IRQ_DEV				1x #define	MV64x60_IRQ_CPU_ERR			3
@@ -43,6 +45,11 @@
 #define	MV64x60_IRQ_TIMER_2_3			9
 #define	MV64x60_IRQ_TIMER_4_5			10
 #define	MV64x60_IRQ_TIMER_6_7			11
+#define	MV64x60_IRQ_P1_GPP_0_7			24
+#define	MV64x60_IRQ_P1_GPP_8_15			25
+#define	MV64x60_IRQ_P1_GPP_16_23		26
+#define	MV64x60_IRQ_P1_GPP_24_31		27
+#define	MV64x60_IRQ_DOORBELL			28
 #define	MV64x60_IRQ_ETH_0			32
 #define	MV64x60_IRQ_ETH_1			33
 #define	MV64x60_IRQ_ETH_2			34
@@ -52,12 +59,49 @@
 #define	MV64x60_IRQ_MPSC_0			40
 #define	MV64x60_IRQ_MPSC_1			42
 #define	MV64x60_IRQ_COMM			43
+#define	MV64x60_IRQ_P0_GPP_0_7			56
+#define	MV64x60_IRQ_P0_GPP_8_15			57
+#define	MV64x60_IRQ_P0_GPP_16_23		58
+#define	MV64x60_IRQ_P0_GPP_24_31		59
 
 #define	MV64360_IRQ_PCI0			12
 #define	MV64360_IRQ_SRAM_PAR_ERR		13
 #define	MV64360_IRQ_PCI1			16
 #define	MV64360_IRQ_SDMA_1			38
 
+#define	MV64x60_IRQ_GPP0			64
+#define	MV64x60_IRQ_GPP1			65
+#define	MV64x60_IRQ_GPP2			66
+#define	MV64x60_IRQ_GPP3			67
+#define	MV64x60_IRQ_GPP4			68
+#define	MV64x60_IRQ_GPP5			69
+#define	MV64x60_IRQ_GPP6			70
+#define	MV64x60_IRQ_GPP7			71
+#define	MV64x60_IRQ_GPP8			72
+#define	MV64x60_IRQ_GPP9			73
+#define	MV64x60_IRQ_GPP10			74
+#define	MV64x60_IRQ_GPP11			75
+#define	MV64x60_IRQ_GPP12			76
+#define	MV64x60_IRQ_GPP13			77
+#define	MV64x60_IRQ_GPP14			78
+#define	MV64x60_IRQ_GPP15			79
+#define	MV64x60_IRQ_GPP16			80
+#define	MV64x60_IRQ_GPP17			81
+#define	MV64x60_IRQ_GPP18			82
+#define	MV64x60_IRQ_GPP19			83
+#define	MV64x60_IRQ_GPP20			84
+#define	MV64x60_IRQ_GPP21			85
+#define	MV64x60_IRQ_GPP22			86
+#define	MV64x60_IRQ_GPP23			87
+#define	MV64x60_IRQ_GPP24			88
+#define	MV64x60_IRQ_GPP25			89
+#define	MV64x60_IRQ_GPP26			90
+#define	MV64x60_IRQ_GPP27			91
+#define	MV64x60_IRQ_GPP28			92
+#define	MV64x60_IRQ_GPP29			93
+#define	MV64x60_IRQ_GPP30			94
+#define	MV64x60_IRQ_GPP31			95
+
 /* Offsets for register blocks */x #define	GT64260_ENET_PHY_ADDR			0x2000
 #define	GT64260_ENET_ESMIR			0x2010
@@ -303,7 +347,7 @@
 #define	MV64360_SRAM_ERR_DATA_HI		0x03a0
 #define	MV64360_SRAM_ERR_PARITY			0x03a8x 
-#define	MV64360_SRAM_SIZE			0x00040000 /* 256 KB of SRAM */x+#define	MV64360_SRAM_SIZE			0x00200000 /* 2 MB of SRAM */x 
 /*
  *****************************************************************************xdiff -Nru a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
--- a/include/asm-ppc/pci.h	2004-05-31 16:44:01 -07:00
+++ b/include/asm-ppc/pci.h	2005-02-07 12:52:02 -08:00
@@ -79,9 +79,8 @@
 #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->indexx 
 /* Set the name of the bus as it appears in /proc/bus/pci */x-static inline int pci_name_bus(char *name, struct pci_bus *bus)
+static inline int pci_proc_domain(struct pci_bus *bus)
 {
-	sprintf(name, "%02x", bus->number);
 	return 0;
 }x 
diff -Nru a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h
--- a/include/asm-ppc/pgtable.h	2005-02-20 21:00:26 -08:00
+++ b/include/asm-ppc/pgtable.h	2005-02-23 19:26:53 -08:00
@@ -448,7 +448,7 @@
 
 #define pte_none(pte)		((pte_val(pte) & ~_PTE_NONE_MASK) == 0)x #define pte_present(pte)	(pte_val(pte) & _PAGE_PRESENT)x-#define pte_clear(ptep)		do { set_pte((ptep), __pte(0)); } while (0)
+#define pte_clear(mm,addr,ptep)	do { set_pte_at((mm), (addr), (ptep), __pte(0)); } while (0)
 
 #define pmd_none(pmd)		(!pmd_val(pmd))x #define	pmd_bad(pmd)		(pmd_val(pmd) & _PMD_BAD)
@@ -512,6 +512,17 @@
 }
 
 /*
+ * When flushing the tlb entry for a page, we also need to flush the hash
+ * table entry.  flush_hash_pages is assembler (for speed) in hashtable.S.
+ */
+extern int flush_hash_pages(unsigned context, unsigned long va,
+			    unsigned long pmdval, int count);
+
+/* Add an HPTE to the hash table */
+extern void add_hash_page(unsigned context, unsigned long va,
+			  unsigned long pmdval);
+
+/*
  * Atomic PTE updates.
  *
  * pte_update clears and sets bit atomically, and returns
@@ -542,7 +553,8 @@
  * On machines which use an MMU hash table we avoid changing the
  * _PAGE_HASHPTE bit.
  */x-static inline void set_pte(pte_t *ptep, pte_t pte)
+static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
+			      pte_t *ptep, pte_t pte)
 {
 #if _PAGE_HASHPTE != 0x 	pte_update(ptep, ~_PAGE_HASHPTE, pte_val(pte) & ~_PAGE_HASHPTE);
@@ -551,43 +563,47 @@
 #endif
 }
 
-extern void flush_hash_one_pte(pte_t *ptep);
-x /*
  * 2.6 calles this without flushing the TLB entry, this is wrong
  * for our hash-based implementation, we fix that up here
  */x-static inline int ptep_test_and_clear_young(pte_t *ptep)
+#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
+static inline int __ptep_test_and_clear_young(unsigned int context, unsigned long addr, pte_t *ptep)
 {
 	unsigned long old;
 	old = pte_update(ptep, _PAGE_ACCESSED, 0);
 #if _PAGE_HASHPTE != 0x-	if (old & _PAGE_HASHPTE)
-		flush_hash_one_pte(ptep);
+	if (old & _PAGE_HASHPTE) {
+		unsigned long ptephys = __pa(ptep) & PAGE_MASK;
+		flush_hash_pages(context, addr, ptephys, 1);
+	}
 #endif
 	return (old & _PAGE_ACCESSED) != 0;
 }x+#define ptep_test_and_clear_young(__vma, __addr, __ptep) \x+	__ptep_test_and_clear_young((__vma)->vm_mm->context, __addr, __ptep)
 
-static inline int ptep_test_and_clear_dirty(pte_t *ptep)
+#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
+static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma,
+					    unsigned long addr, pte_t *ptep)
 {
 	return (pte_update(ptep, (_PAGE_DIRTY | _PAGE_HWWRITE), 0) & _PAGE_DIRTY) != 0;
 }x x-static inline pte_t ptep_get_and_clear(pte_t *ptep)
+#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
+static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
+				       pte_t *ptep)
 {
 	return __pte(pte_update(ptep, ~_PAGE_HASHPTE, 0));
 }x 
-static inline void ptep_set_wrprotect(pte_t *ptep)
+#define __HAVE_ARCH_PTEP_SET_WRPROTECTx+static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
+				      pte_t *ptep)
 {
 	pte_update(ptep, (_PAGE_RW | _PAGE_HWWRITE), 0);
 }x 
-static inline void ptep_mkdirty(pte_t *ptep)
-{
-	pte_update(ptep, 0, _PAGE_DIRTY);
-}
-
 #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
 static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry, int dirty)
 {
@@ -607,6 +623,7 @@
  */x #define pgprot_noncached(prot)	(__pgprot(pgprot_val(prot) | _PAGE_NO_CACHE | _PAGE_GUARDED))
 
+#define __HAVE_ARCH_PTE_SAME
 #define pte_same(A,B)	(((pte_val(A) ^ pte_val(B)) & ~_PAGE_HASHPTE) == 0)x x /*
@@ -659,17 +676,6 @@
 extern void paging_init(void);
 x /*
- * When flushing the tlb entry for a page, we also need to flush the hash
- * table entry.  flush_hash_pages is assembler (for speed) in hashtable.S.
- */x-extern int flush_hash_pages(unsigned context, unsigned long va,
-			    unsigned long pmdval, int count);
-x-/* Add an HPTE to the hash table */
-extern void add_hash_page(unsigned context, unsigned long va,
-			  unsigned long pmdval);
-x-/*
  * Encode and decode a swap entry.
  * Note that the bits we use in a PTE for representing a swap entry
  * must not include the _PAGE_PRESENT bit, the _PAGE_FILE bit, or the
@@ -741,15 +747,9 @@
 
 extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep);
 
-#endif /* !__ASSEMBLY__ */x-x-#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
-#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
-#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
-#define __HAVE_ARCH_PTEP_SET_WRPROTECTx-#define __HAVE_ARCH_PTEP_MKDIRTY
-#define __HAVE_ARCH_PTE_SAME
 #include <asm-generic/pgtable.h>
+
+#endif /* !__ASSEMBLY__ */x 
 #endif /* _PPC_PGTABLE_H */x #endif /* __KERNEL__ */xdiff -Nru a/include/asm-ppc/ppc4xx_pic.h b/include/asm-ppc/ppc4xx_pic.h
--- a/include/asm-ppc/ppc4xx_pic.h	2005-01-03 15:49:19 -08:00
+++ b/include/asm-ppc/ppc4xx_pic.h	2005-03-04 22:41:16 -08:00
@@ -43,11 +43,11 @@
  *
  */x struct ppc4xx_uic_settings {
-	u32 	polarity;
-	u32 	triggering;
-	u32	ext_irq_mask;
+	u32 polarity;
+	u32 triggering;
+	u32 ext_irq_mask;
 };
 x extern void ppc4xx_pic_init(void);
 x-#endif	/* __PPC4XX_PIC_H__ */x+#endif				/* __PPC4XX_PIC_H__ */xdiff -Nru a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h
--- a/include/asm-ppc/ppc_sys.h	2005-01-20 20:56:31 -08:00
+++ b/include/asm-ppc/ppc_sys.h	2005-03-04 22:41:52 -08:00
@@ -21,7 +21,9 @@
 #include <linux/device.h>
 #include <linux/types.h>
 
-#if defined(CONFIG_85xx)
+#if defined(CONFIG_83xx)
+#include <asm/mpc83xx.h>
+#elif defined(CONFIG_85xx)
 #include <asm/mpc85xx.h>
 #elsex #error "need definition of ppc_sys_devices"xdiff -Nru a/include/asm-ppc/ppcboot.h b/include/asm-ppc/ppcboot.h
--- a/include/asm-ppc/ppcboot.h	2004-10-05 23:05:22 -07:00
+++ b/include/asm-ppc/ppcboot.h	2005-03-04 22:41:52 -08:00
@@ -38,7 +38,8 @@
 	unsigned long	bi_flashoffset; /* reserved area for startup monitor */x 	unsigned long	bi_sramstart;	/* start of SRAM memory */x 	unsigned long	bi_sramsize;	/* size	 of SRAM memory */x-#if defined(CONFIG_8xx) || defined(CONFIG_CPM2) || defined(CONFIG_85xx)
+#if defined(CONFIG_8xx) || defined(CONFIG_CPM2) || defined(CONFIG_85xx) ||\x+	defined(CONFIG_83xx)
 	unsigned long	bi_immr_base;	/* base of IMMR register */x #endif
 #if defined(CONFIG_PPC_MPC52xx)
@@ -72,7 +73,8 @@
 #if defined(CONFIG_HYMOD)
 	hymod_conf_t	bi_hymod_conf;	/* hymod configuration information */x #endif
-#if defined(CONFIG_EVB64260) || defined(CONFIG_44x) || defined(CONFIG_85xx)
+#if defined(CONFIG_EVB64260) || defined(CONFIG_44x) || defined(CONFIG_85xx) ||\x+	defined(CONFIG_83xx)
 	/* second onboard ethernet port */x 	unsigned char	bi_enet1addr[6];
 #endif
diff -Nru a/include/asm-ppc/reg.h b/include/asm-ppc/reg.h
--- a/include/asm-ppc/reg.h	2005-02-03 06:42:39 -08:00
+++ b/include/asm-ppc/reg.h	2005-03-04 22:41:17 -08:00
@@ -488,12 +488,6 @@
 #define PVR_8245	0x80811014
 #define PVR_8260	PVR_8240
 
-/* System Version Numbers */x-#define SVR_8540	0x80300000
-#define SVR_8541E	0x807A0000
-#define SVR_8555E	0x80790000
-#define SVR_8560	0x80700000
-
 #if 0
 /* Segment Registers */x #define SR0	0
diff -Nru a/include/asm-ppc/serial.h b/include/asm-ppc/serial.h
--- a/include/asm-ppc/serial.h	2005-01-03 15:49:19 -08:00
+++ b/include/asm-ppc/serial.h	2005-03-07 20:41:25 -08:00
@@ -32,8 +32,12 @@
 #include <platforms/spruce.h>
 #elif defined(CONFIG_4xx)
 #include <asm/ibm4xx.h>
+#elif defined(CONFIG_83xx)
+#include <asm/mpc83xx.h>
 #elif defined(CONFIG_85xx)
 #include <asm/mpc85xx.h>
+#elif defined(CONFIG_RADSTONE_PPC7D)
+#include <platforms/radstone_ppc7d.h>
 #elsex x /*
diff -Nru a/include/asm-ppc/system.h b/include/asm-ppc/system.h
--- a/include/asm-ppc/system.h	2005-01-20 20:56:31 -08:00
+++ b/include/asm-ppc/system.h	2005-03-04 22:41:17 -08:00
@@ -152,9 +152,9 @@
 #define __HAVE_ARCH_CMPXCHG	1x 
 static __inline__ unsigned long
-__cmpxchg_u32(volatile int *p, int old, int new)
+__cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new)
 {
-	int prev;
+	unsigned int prev;
 x 	__asm__ __volatile__ ("\n\
 1:	lwarx	%0,0,%2 \n\
@@ -200,6 +200,8 @@
      (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_,		 \
 				    (unsigned long)_n_, sizeof(*(ptr))); \
   })x+x+#define arch_align_stack(x) (x)
 x #endif /* __KERNEL__ */x #endif /* __PPC_SYSTEM_H */xdiff -Nru a/include/asm-ppc/todc.h b/include/asm-ppc/todc.h
--- a/include/asm-ppc/todc.h	2004-03-02 10:46:57 -08:00
+++ b/include/asm-ppc/todc.h	2005-03-04 22:41:52 -08:00
@@ -98,6 +98,7 @@
 #define TODC_TYPE_PC97307		10	/* PC97307 internal RTC */x #define TODC_TYPE_DS1557		11	/* Dallas DS1557 RTC */x #define TODC_TYPE_DS17285		12	/* Dallas DS17285 RTC */x+#define TODC_TYPE_DS1553		13	/* Dallas DS1553 RTC */x #define	TODC_TYPE_MC146818		100	/* Leave room for m48txx's */x 
 /*
@@ -207,6 +208,28 @@
 #define	TODC_TYPE_DS1501_FLAGS		(TODC_TYPE_DS1501_NVRAM_SIZE + 0xff)
 #define	TODC_TYPE_DS1501_NVRAM_ADDR_REG	0x10
 #define	TODC_TYPE_DS1501_NVRAM_DATA_REG	0x13
+
+#define	TODC_TYPE_DS1553_NVRAM_SIZE		0x1ff0
+#define	TODC_TYPE_DS1553_SW_FLAGS		0
+#define	TODC_TYPE_DS1553_YEAR			0x1fff
+#define	TODC_TYPE_DS1553_MONTH			0x1ffe
+#define	TODC_TYPE_DS1553_DOM			0x1ffd	/* Day of Month */x+#define	TODC_TYPE_DS1553_DOW			0x1ffc	/* Day of Week */x+#define	TODC_TYPE_DS1553_HOURS			0x1ffb
+#define	TODC_TYPE_DS1553_MINUTES		0x1ffa
+#define	TODC_TYPE_DS1553_SECONDS		0x1ff9
+#define	TODC_TYPE_DS1553_CNTL_B			0x1ff9
+#define	TODC_TYPE_DS1553_CNTL_A			0x1ff8	/* control_a R/W regs */x+#define	TODC_TYPE_DS1553_WATCHDOG		0x1ff7x+#define	TODC_TYPE_DS1553_INTERRUPTS		0x1ff6x+#define	TODC_TYPE_DS1553_ALARM_DATE		0x1ff5x+#define	TODC_TYPE_DS1553_ALARM_HOUR		0x1ff4x+#define	TODC_TYPE_DS1553_ALARM_MINUTES		0x1ff3x+#define	TODC_TYPE_DS1553_ALARM_SECONDS		0x1ff2
+#define	TODC_TYPE_DS1553_CENTURY		0x1ff8
+#define	TODC_TYPE_DS1553_FLAGS			0x1ff0
+#define	TODC_TYPE_DS1553_NVRAM_ADDR_REG		0
+#define	TODC_TYPE_DS1553_NVRAM_DATA_REG		0
 
 #define	TODC_TYPE_DS1557_NVRAM_SIZE		0x7fff0
 #define	TODC_TYPE_DS1557_SW_FLAGS		0
diff -Nru a/include/asm-ppc/unistd.h b/include/asm-ppc/unistd.h
--- a/include/asm-ppc/unistd.h	2005-01-03 15:49:20 -08:00
+++ b/include/asm-ppc/unistd.h	2005-03-06 15:58:58 -08:00
@@ -276,8 +276,9 @@
 #define __NR_add_key		269
 #define __NR_request_key	270
 #define __NR_keyctl		271
+#define __NR_waitid		272x 
-#define __NR_syscalls		272x+#define __NR_syscalls		273
 
 #define __NR(n)	#nx 
diff -Nru a/include/asm-ppc64/a.out.h b/include/asm-ppc64/a.out.h
--- a/include/asm-ppc64/a.out.h	2002-10-11 00:09:17 -07:00
+++ b/include/asm-ppc64/a.out.h	2005-03-04 22:41:54 -08:00
@@ -30,14 +30,11 @@
 
 #ifdef __KERNEL__x 
-#define STACK_TOP_USER64 (TASK_SIZE_USER64)
+#define STACK_TOP_USER64 TASK_SIZE_USER64
+#define STACK_TOP_USER32 TASK_SIZE_USER32
 
-/* Give 32-bit user space a full 4G address space to live in. */x-#define STACK_TOP_USER32 (TASK_SIZE_USER32)x-x-#define STACK_TOP ((test_thread_flag(TIF_32BIT) || \
-		(ppcdebugset(PPCDBG_BINFMT_32ADDR))) ? \
-		STACK_TOP_USER32 : STACK_TOP_USER64)
+#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \x+		   STACK_TOP_USER32 : STACK_TOP_USER64)
 x #endif /* __KERNEL__ */x 
diff -Nru a/include/asm-ppc64/cacheflush.h b/include/asm-ppc64/cacheflush.h
--- a/include/asm-ppc64/cacheflush.h	2005-01-25 13:50:16 -08:00
+++ b/include/asm-ppc64/cacheflush.h	2005-03-05 21:15:17 -08:00
@@ -12,7 +12,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_icache_page(vma, page)		do { } while (0)
 #define flush_cache_vmap(start, end)		do { } while (0)
 #define flush_cache_vunmap(start, end)		do { } while (0)
@@ -40,7 +40,7 @@
 
 static inline void flush_icache_range(unsigned long start, unsigned long stop)
 {
-	if (!(cur_cpu_spec->cpu_features & CPU_FTR_COHERENT_ICACHE))
+	if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
 		__flush_icache_range(start, stop);
 }x 
diff -Nru a/include/asm-ppc64/cputable.h b/include/asm-ppc64/cputable.h
--- a/include/asm-ppc64/cputable.h	2005-01-25 13:50:16 -08:00
+++ b/include/asm-ppc64/cputable.h	2005-03-04 22:41:15 -08:00
@@ -66,6 +66,11 @@
 extern struct cpu_spec		cpu_specs[];
 extern struct cpu_spec		*cur_cpu_spec;
 
+static inline unsigned long cpu_has_feature(unsigned long feature)
+{
+	return cur_cpu_spec->cpu_features & feature;
+}
+
 
 /* firmware feature bitmask values */x #define FIRMWARE_MAX_FEATURES 63
diff -Nru a/include/asm-ppc64/dma-mapping.h b/include/asm-ppc64/dma-mapping.h
--- a/include/asm-ppc64/dma-mapping.h	2004-09-10 08:34:51 -07:00
+++ b/include/asm-ppc64/dma-mapping.h	2005-02-06 19:38:01 -08:00
@@ -113,4 +113,24 @@
 	/* nothing to do */x }x 
+/*
+ * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO
+ */
+struct dma_mapping_ops {
+	void *		(*alloc_coherent)(struct device *dev, size_t size,
+				dma_addr_t *dma_handle, int flag);
+	void		(*free_coherent)(struct device *dev, size_t size,
+				void *vaddr, dma_addr_t dma_handle);
+	dma_addr_t	(*map_single)(struct device *dev, void *ptr,
+				size_t size, enum dma_data_direction direction);
+	void		(*unmap_single)(struct device *dev, dma_addr_t dma_addr,
+				size_t size, enum dma_data_direction direction);
+	int		(*map_sg)(struct device *dev, struct scatterlist *sg,
+				int nents, enum dma_data_direction direction);
+	void		(*unmap_sg)(struct device *dev, struct scatterlist *sg,
+				int nents, enum dma_data_direction direction);
+	int		(*dma_supported)(struct device *dev, u64 mask);
+	int		(*dac_dma_supported)(struct device *dev, u64 mask);
+};x+
 #endif	/* _ASM_DMA_MAPPING_H */xdiff -Nru a/include/asm-ppc64/eeh.h b/include/asm-ppc64/eeh.h
--- a/include/asm-ppc64/eeh.h	2005-01-25 13:50:16 -08:00
+++ b/include/asm-ppc64/eeh.h	2005-03-02 17:39:25 -08:00
@@ -104,17 +104,30 @@
  */x #define EEH_IO_ERROR_VALUE(size)	(~0U >> ((4 - (size)) * 8))
 
-#elsex-#define eeh_init()x-#define eeh_check_failure(token, val) (val)x-#define eeh_dn_check_failure(dn, dev) (0)
-#define pci_addr_cache_build()x-#define eeh_add_device_early(dn)x-#define eeh_add_device_late(dev)x-#define eeh_remove_device(dev)x+#else /* !CONFIG_EEH */
+static inline void eeh_init(void) { }
+
+static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
+{
+	return val;
+}
+
+static inline int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
+{
+	return 0;
+}
+
+static inline void pci_addr_cache_build(void) { }
+
+static inline void eeh_add_device_early(struct device_node *dn) { }
+
+static inline void eeh_add_device_late(struct pci_dev *dev) { }
+
+static inline void eeh_remove_device(struct pci_dev *dev) { }
+
 #define EEH_POSSIBLE_ERROR(val, type) (0)
 #define EEH_IO_ERROR_VALUE(size) (-1UL)
-#endif
+#endif /* CONFIG_EEH */
 
 /* 
  * MMIO read/write operations with EEH support.xdiff -Nru a/include/asm-ppc64/elf.h b/include/asm-ppc64/elf.h
--- a/include/asm-ppc64/elf.h	2004-01-18 22:28:26 -08:00
+++ b/include/asm-ppc64/elf.h	2005-03-04 22:41:54 -08:00
@@ -238,10 +238,20 @@
 /* A special ignored type value for PPC, for glibc compatibility.  */x #define AT_IGNOREPPC		22x 
+/* The vDSO location. We have to use the same value as x86 for glibc's
+ * sake :-)
+ */
+#define AT_SYSINFO_EHDR		33
+
 extern int dcache_bsize;
 extern int icache_bsize;
 extern int ucache_bsize;
 
+/* We do have an arch_setup_additional_pages for vDSO matters */x+#define ARCH_HAS_SETUP_ADDITIONAL_PAGES
+struct linux_binprm;
+extern int arch_setup_additional_pages(struct linux_binprm *bprm, int executable_stack);
+
 /*
  * The requirements here are:
  * - keep the final alignment of sp (sp & 0xf)
@@ -260,6 +270,8 @@
 	NEW_AUX_ENT(AT_DCACHEBSIZE, dcache_bsize);			\
 	NEW_AUX_ENT(AT_ICACHEBSIZE, icache_bsize);			\
 	NEW_AUX_ENT(AT_UCACHEBSIZE, ucache_bsize);			\
+	/* vDSO base */							\
+	NEW_AUX_ENT(AT_SYSINFO_EHDR, current->thread.vdso_base);       	\
  } while (0)
 
 /* PowerPC64 relocations defined by the ABIs */xdiff -Nru a/include/asm-ppc64/iommu.h b/include/asm-ppc64/iommu.h
--- a/include/asm-ppc64/iommu.h	2005-01-07 21:43:52 -08:00
+++ b/include/asm-ppc64/iommu.h	2005-02-06 20:02:01 -08:00
@@ -145,9 +145,9 @@
 extern void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist,
 		int nelems, enum dma_data_direction direction);
 
-extern void *iommu_alloc_consistent(struct iommu_table *tbl, size_t size,
-		dma_addr_t *dma_handle);
-extern void iommu_free_consistent(struct iommu_table *tbl, size_t size,
+extern void *iommu_alloc_coherent(struct iommu_table *tbl, size_t size,
+		dma_addr_t *dma_handle, int flag);
+extern void iommu_free_coherent(struct iommu_table *tbl, size_t size,
 		void *vaddr, dma_addr_t dma_handle);
 extern dma_addr_t iommu_map_single(struct iommu_table *tbl, void *vaddr,
 		size_t size, enum dma_data_direction direction);
diff -Nru a/include/asm-ppc64/kprobes.h b/include/asm-ppc64/kprobes.h
--- a/include/asm-ppc64/kprobes.h	2005-01-03 15:49:21 -08:00
+++ b/include/asm-ppc64/kprobes.h	2005-03-07 20:41:25 -08:00
@@ -35,6 +35,11 @@
 #define BREAKPOINT_INSTRUCTION	0x7fe00008	/* trap */x #define MAX_INSN_SIZE 1
 
+#define IS_TW(instr)		(((instr) & 0xfc0007fe) == 0x7c000008)
+#define IS_TD(instr)		(((instr) & 0xfc0007fe) == 0x7c000088)
+#define IS_TDI(instr)		(((instr) & 0xfc000000) == 0x08000000)
+#define IS_TWI(instr)		(((instr) & 0xfc000000) == 0x0c000000)
+x #define JPROBE_ENTRY(pentry)	(kprobe_opcode_t *)((func_descr_t *)pentry)
 
 /* Architecture specific copy of original instruction */xdiff -Nru a/include/asm-ppc64/lmb.h b/include/asm-ppc64/lmb.h
--- a/include/asm-ppc64/lmb.h	2004-09-16 21:35:46 -07:00
+++ b/include/asm-ppc64/lmb.h	2005-03-04 22:41:53 -08:00
@@ -16,8 +16,6 @@
 #include <linux/init.h>
 #include <asm/prom.h>
 
-extern unsigned long reloc_offset(void);
-x #define MAX_LMB_REGIONS 128
 
 #define LMB_ALLOC_ANYWHERE	0
diff -Nru a/include/asm-ppc64/machdep.h b/include/asm-ppc64/machdep.h
--- a/include/asm-ppc64/machdep.h	2005-01-11 16:42:39 -08:00
+++ b/include/asm-ppc64/machdep.h	2005-03-04 22:41:54 -08:00
@@ -30,6 +30,7 @@
 	void  (*setup_cpu)(int nr);
 	void  (*take_timebase)(void);
 	void  (*give_timebase)(void);
+	int   (*cpu_enable)(unsigned int nr);
 	int   (*cpu_disable)(void);
 	void  (*cpu_die)(unsigned int nr);
 };
diff -Nru a/include/asm-ppc64/mmu_context.h b/include/asm-ppc64/mmu_context.h
--- a/include/asm-ppc64/mmu_context.h	2005-01-25 13:50:16 -08:00
+++ b/include/asm-ppc64/mmu_context.h	2005-03-04 22:41:15 -08:00
@@ -59,11 +59,11 @@
 		return;
 
 #ifdef CONFIG_ALTIVEC
-	if (cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC)
+	if (cpu_has_feature(CPU_FTR_ALTIVEC))
 		asm volatile ("dssall");
 #endif /* CONFIG_ALTIVEC */
 
-	if (cur_cpu_spec->cpu_features & CPU_FTR_SLB)
+	if (cpu_has_feature(CPU_FTR_SLB))
 		switch_slb(tsk, next);
 	elsex 		switch_stab(tsk, next);
diff -Nru a/include/asm-ppc64/page.h b/include/asm-ppc64/page.h
--- a/include/asm-ppc64/page.h	2005-01-25 13:50:15 -08:00
+++ b/include/asm-ppc64/page.h	2005-03-04 22:41:54 -08:00
@@ -67,7 +67,7 @@
 #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
 
 #define in_hugepage_area(context, addr) \
-	((cur_cpu_spec->cpu_features & CPU_FTR_16M_PAGE) && \
+	(cpu_has_feature(CPU_FTR_16M_PAGE) && \
 	 ( (((addr) >= TASK_HPAGE_BASE) && ((addr) < TASK_HPAGE_END)) || \
 	   ( ((addr) < 0x100000000L) && \
 	     ((1 << GET_ESID(addr)) & (context).htlb_segs) ) ) )
@@ -184,6 +184,9 @@
 extern int page_is_ram(unsigned long pfn);
 x extern u64 ppc64_pft_size;		/* Log 2 of page table size */
+
+/* We do define AT_SYSINFO_EHDR but don't use the gate mecanism */x+#define __HAVE_ARCH_GATE_AREA		1x 
 #endif /* __ASSEMBLY__ */x 
diff -Nru a/include/asm-ppc64/pci.h b/include/asm-ppc64/pci.h
--- a/include/asm-ppc64/pci.h	2004-10-25 19:18:38 -07:00
+++ b/include/asm-ppc64/pci.h	2005-03-06 15:24:32 -08:00
@@ -13,11 +13,14 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/dma-mapping.h>
+x #include <asm/machdep.h>
 #include <asm/scatterlist.h>
 #include <asm/io.h>
 #include <asm/prom.h>
 
+#include <asm-generic/pci-dma-compat.h>
+x #define PCIBIOS_MIN_IO		0x1000
 #define PCIBIOS_MIN_MEM		0x10000000
 
@@ -63,135 +66,22 @@
 
 extern unsigned int pcibios_assign_all_busses(void);
 x-/*
- * PCI DMA operations are abstracted for G5 vs. i/pSeries
- */x-struct pci_dma_ops {
-	void *		(*pci_alloc_consistent)(struct pci_dev *hwdev, size_t size,
-					dma_addr_t *dma_handle);
-	void		(*pci_free_consistent)(struct pci_dev *hwdev, size_t size,
-				       void *vaddr, dma_addr_t dma_handle);
-
-	dma_addr_t	(*pci_map_single)(struct pci_dev *hwdev, void *ptr,
-					  size_t size, enum dma_data_direction direction);
-	void		(*pci_unmap_single)(struct pci_dev *hwdev, dma_addr_t dma_addr,
-					    size_t size, enum dma_data_direction direction);
-	int		(*pci_map_sg)(struct pci_dev *hwdev, struct scatterlist *sg,
-				      int nents, enum dma_data_direction direction);
-	void		(*pci_unmap_sg)(struct pci_dev *hwdev, struct scatterlist *sg,
-					int nents, enum dma_data_direction direction);
-	int		(*pci_dma_supported)(struct pci_dev *hwdev, u64 mask);
-	int		(*pci_dac_dma_supported)(struct pci_dev *hwdev, u64 mask);
-};
-
-extern struct pci_dma_ops pci_dma_ops;
-
-static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
-					 dma_addr_t *dma_handle)
-{
-	return pci_dma_ops.pci_alloc_consistent(hwdev, size, dma_handle);
-}
-
-static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size,
-				       void *vaddr, dma_addr_t dma_handle)
-{
-	pci_dma_ops.pci_free_consistent(hwdev, size, vaddr, dma_handle);
-}
-
-static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
-					size_t size, int direction)
-{
-	return pci_dma_ops.pci_map_single(hwdev, ptr, size,
-			(enum dma_data_direction)direction);
-}
-
-static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
-				    size_t size, int direction)
-{
-	pci_dma_ops.pci_unmap_single(hwdev, dma_addr, size,
-			(enum dma_data_direction)direction);
-}
-
-static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
-			     int nents, int direction)
-{
-	return pci_dma_ops.pci_map_sg(hwdev, sg, nents,
-			(enum dma_data_direction)direction);
-}
-
-static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
-				int nents, int direction)
-{
-	pci_dma_ops.pci_unmap_sg(hwdev, sg, nents,
-			(enum dma_data_direction)direction);
-}
-
-static inline void pci_dma_sync_single_for_cpu(struct pci_dev *hwdev,
-					       dma_addr_t dma_handle,
-					       size_t size, int direction)
-{
-	BUG_ON(direction == PCI_DMA_NONE);
-	/* nothing to do */x-}
-
-static inline void pci_dma_sync_single_for_device(struct pci_dev *hwdev,
-						  dma_addr_t dma_handle,
-						  size_t size, int direction)
-{
-	BUG_ON(direction == PCI_DMA_NONE);
-	/* nothing to do */x-}
-
-static inline void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev,
-					   struct scatterlist *sg,
-					   int nelems, int direction)
-{
-	BUG_ON(direction == PCI_DMA_NONE);
-	/* nothing to do */x-}
-
-static inline void pci_dma_sync_sg_for_device(struct pci_dev *hwdev,
-					      struct scatterlist *sg,
-					      int nelems, int direction)
-{
-	BUG_ON(direction == PCI_DMA_NONE);
-	/* nothing to do */x-}
-
-/* Return whether the given PCI device DMA address mask can
- * be supported properly.  For example, if your device can
- * only drive the low 24-bits during PCI bus mastering, then
- * you would pass 0x00ffffff as the mask to this function.
- * We default to supporting only 32 bits DMA unless we have
- * an explicit override of this function in pci_dma_ops for
- * the platform
- */x-static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
-{
-	if (pci_dma_ops.pci_dma_supported)
-		return pci_dma_ops.pci_dma_supported(hwdev, mask);
-	return (mask < 0x100000000ull);
-}
+extern struct dma_mapping_ops pci_dma_ops;
 
 /* For DAC DMA, we currently don't support it by default, but
  * we let the platform override this
  */x static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask)
 {
-	if (pci_dma_ops.pci_dac_dma_supported)
-		return pci_dma_ops.pci_dac_dma_supported(hwdev, mask);
+	if (pci_dma_ops.dac_dma_supported)
+		return pci_dma_ops.dac_dma_supported(&hwdev->dev, mask);
 	return 0;
 }x 
-static inline int pci_dma_mapping_error(dma_addr_t dma_addr)
-{
-	return dma_mapping_error(dma_addr);
-}
-
 extern int pci_domain_nr(struct pci_bus *bus);
 
-/* Set the name of the bus as it appears in /proc/bus/pci */x-extern int pci_name_bus(char *name, struct pci_bus *bus);
+/* Decide whether to display the domain number in /proc */
+extern int pci_proc_domain(struct pci_bus *bus);
 
 struct vm_area_struct;
 /* Map a range of PCI memory or I/O space for a device into user space */
@@ -200,10 +90,6 @@
 
 /* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */x #define HAVE_PCI_MMAP	1x-x-#define pci_map_page(dev, page, off, size, dir) \
-		pci_map_single(dev, (page_address(page) + (off)), size, dir)x-#define pci_unmap_page(dev,addr,sz,dir) pci_unmap_single(dev,addr,sz,dir)
 
 /* pci_unmap_{single,page} is not a nop, thus... */x #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)	\
diff -Nru a/include/asm-ppc64/pgalloc.h b/include/asm-ppc64/pgalloc.h
--- a/include/asm-ppc64/pgalloc.h	2004-08-26 23:59:59 -07:00
+++ b/include/asm-ppc64/pgalloc.h	2005-02-23 19:26:53 -08:00
@@ -48,42 +48,26 @@
 #define pmd_populate(mm, pmd, pte_page) \
 	pmd_populate_kernel(mm, pmd, page_address(pte_page))x x-static inline pte_t *
-pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
+static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
-	pte_t *pte;
-	pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
-	if (pte) {
-		struct page *ptepage = virt_to_page(pte);
-		ptepage->mapping = (void *) mm;
-		ptepage->index = address & PMD_MASK;
-	}
-	return pte;
+	return kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
 }x 
-static inline struct page *
-pte_alloc_one(struct mm_struct *mm, unsigned long address)
+static inline struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-	pte_t *pte;
-	pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
-	if (pte) {
-		struct page *ptepage = virt_to_page(pte);
-		ptepage->mapping = (void *) mm;
-		ptepage->index = address & PMD_MASK;
-		return ptepage;
-	}
+	pte_t *pte = kmem_cache_alloc(zero_cache, GFP_KERNEL|__GFP_REPEAT);
+	if (pte)
+		return virt_to_page(pte);
 	return NULL;
 }x 		
 static inline void pte_free_kernel(pte_t *pte)
 {
-	virt_to_page(pte)->mapping = NULL;
 	kmem_cache_free(zero_cache, pte);
 }
 
 static inline void pte_free(struct page *ptepage)
 {
-	ptepage->mapping = NULL;
 	kmem_cache_free(zero_cache, page_address(ptepage));
 }x 
diff -Nru a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h
--- a/include/asm-ppc64/pgtable.h	2004-12-22 01:36:07 -08:00
+++ b/include/asm-ppc64/pgtable.h	2005-02-23 19:26:53 -08:00
@@ -315,9 +315,10 @@
  * batch, doesn't actually triggers the hash flush immediately,
  * you need to call flush_tlb_pending() to do that.
  */x-extern void hpte_update(pte_t *ptep, unsigned long pte, int wrprot);
+extern void hpte_update(struct mm_struct *mm, unsigned long addr, unsigned long pte,
+			int wrprot);
 x-static inline int ptep_test_and_clear_young(pte_t *ptep)
+static inline int __ptep_test_and_clear_young(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	unsigned long old;
 
@@ -325,18 +326,25 @@
 		return 0;
 	old = pte_update(ptep, _PAGE_ACCESSED);
 	if (old & _PAGE_HASHPTE) {
-		hpte_update(ptep, old, 0);
+		hpte_update(mm, addr, old, 0);
 		flush_tlb_pending();
 	}
 	return (old & _PAGE_ACCESSED) != 0;
 }x+#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
+#define ptep_test_and_clear_young(__vma, __addr, __ptep)		   \
+({									   \
+	int __r;							   \
+	__r = __ptep_test_and_clear_young((__vma)->vm_mm, __addr, __ptep); \
+	__r;								   \
+})x 
 /*
  * On RW/DIRTY bit transitions we can avoid flushing the hpte. For the
  * moment we always flush but we need to fix hpte_update and test if the
  * optimisation is worth it.
  */x-static inline int ptep_test_and_clear_dirty(pte_t *ptep)
+static inline int __ptep_test_and_clear_dirty(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	unsigned long old;
 
@@ -344,11 +352,19 @@
 		return 0;
 	old = pte_update(ptep, _PAGE_DIRTY);
 	if (old & _PAGE_HASHPTE)
-		hpte_update(ptep, old, 0);
+		hpte_update(mm, addr, old, 0);
 	return (old & _PAGE_DIRTY) != 0;
 }x+#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
+#define ptep_test_and_clear_dirty(__vma, __addr, __ptep)		   \
+({									   \
+	int __r;							   \
+	__r = __ptep_test_and_clear_dirty((__vma)->vm_mm, __addr, __ptep); \
+	__r;								   \
+})x 
-static inline void ptep_set_wrprotect(pte_t *ptep)
+#define __HAVE_ARCH_PTEP_SET_WRPROTECTx+static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	unsigned long old;
 
@@ -356,7 +372,7 @@
        		return;
 	old = pte_update(ptep, _PAGE_RW);
 	if (old & _PAGE_HASHPTE)
-		hpte_update(ptep, old, 0);
+		hpte_update(mm, addr, old, 0);
 }x 
 /*
@@ -370,42 +386,46 @@
 #define __HAVE_ARCH_PTEP_CLEAR_YOUNG_FLUSH
 #define ptep_clear_flush_young(__vma, __address, __ptep)		\
 ({									\
-	int __young = ptep_test_and_clear_young(__ptep);		\
+	int __young = __ptep_test_and_clear_young((__vma)->vm_mm, __address, \
+						  __ptep);		\
 	__young;							\
 })
 
 #define __HAVE_ARCH_PTEP_CLEAR_DIRTY_FLUSH
 #define ptep_clear_flush_dirty(__vma, __address, __ptep)		\
 ({									\
-	int __dirty = ptep_test_and_clear_dirty(__ptep);		\
+	int __dirty = __ptep_test_and_clear_dirty((__vma)->vm_mm, __address, \
+						  __ptep); 		\
 	flush_tlb_page(__vma, __address);				\
 	__dirty;							\
 })
 
-static inline pte_t ptep_get_and_clear(pte_t *ptep)
+#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
+static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	unsigned long old = pte_update(ptep, ~0UL);
 
 	if (old & _PAGE_HASHPTE)
-		hpte_update(ptep, old, 0);
+		hpte_update(mm, addr, old, 0);
 	return __pte(old);
 }x 
-static inline void pte_clear(pte_t * ptep)
+static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t * ptep)
 {
 	unsigned long old = pte_update(ptep, ~0UL);
 
 	if (old & _PAGE_HASHPTE)
-		hpte_update(ptep, old, 0);
+		hpte_update(mm, addr, old, 0);
 }x 
 /*
  * set_pte stores a linux PTE into the linux page table.
  */x-static inline void set_pte(pte_t *ptep, pte_t pte)
+static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
+			      pte_t *ptep, pte_t pte)
 {
 	if (pte_present(*ptep)) {
-		pte_clear(ptep);
+		pte_clear(mm, addr, ptep);
 		flush_tlb_pending();
 	}
 	*ptep = __pte(pte_val(pte)) & ~_PAGE_HPTEFLAGS;
@@ -443,6 +463,7 @@
  */x #define pgprot_noncached(prot)	(__pgprot(pgprot_val(prot) | _PAGE_NO_CACHE | _PAGE_GUARDED))
 
+#define __HAVE_ARCH_PTE_SAME
 #define pte_same(A,B)	(((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0)x x extern unsigned long ioremap_bot, ioremap_base;
@@ -550,14 +571,8 @@
 	return pt;
 }x 
-#endif /* __ASSEMBLY__ */x-x-#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
-#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
-#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
-#define __HAVE_ARCH_PTEP_SET_WRPROTECTx-#define __HAVE_ARCH_PTEP_MKDIRTY
-#define __HAVE_ARCH_PTE_SAME
 #include <asm-generic/pgtable.h>
+
+#endif /* __ASSEMBLY__ */x 
 #endif /* _PPC64_PGTABLE_H */xdiff -Nru a/include/asm-ppc64/pmc.h b/include/asm-ppc64/pmc.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-ppc64/pmc.h	2005-03-04 22:41:55 -08:00
@@ -0,0 +1,29 @@
+/*
+ * pmc.h
+ * Copyright (C) 2004  David Gibson, IBM Corporation
+ *
+ * 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
+ */
+#ifndef _PPC64_PMC_H
+#define _PPC64_PMC_H
+
+#include <asm/ptrace.h>
+
+typedef void (*perf_irq_t)(struct pt_regs *);
+
+int reserve_pmc_hardware(perf_irq_t new_perf_irq);
+void release_pmc_hardware(void);
+
+#endif /* _PPC64_PMC_H */xdiff -Nru a/include/asm-ppc64/processor.h b/include/asm-ppc64/processor.h
--- a/include/asm-ppc64/processor.h	2005-01-15 14:01:52 -08:00
+++ b/include/asm-ppc64/processor.h	2005-03-04 22:41:54 -08:00
@@ -544,8 +544,8 @@
 /* This decides where the kernel will search for a free chunk of vm
  * space during mmap's.
  */x-#define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(STACK_TOP_USER32 / 4))x-#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(STACK_TOP_USER64 / 4))x+#define TASK_UNMAPPED_BASE_USER32 (PAGE_ALIGN(TASK_SIZE_USER32 / 4))x+#define TASK_UNMAPPED_BASE_USER64 (PAGE_ALIGN(TASK_SIZE_USER64 / 4))x 
 #define TASK_UNMAPPED_BASE ((test_thread_flag(TIF_32BIT)||(ppcdebugset(PPCDBG_BINFMT_32ADDR))) ? \
 		TASK_UNMAPPED_BASE_USER32 : TASK_UNMAPPED_BASE_USER64 )
@@ -562,7 +562,9 @@
 	double		fpr[32];	/* Complete floating point set */x 	unsigned long	fpscr;		/* Floating point status (plus pad) */x 	unsigned long	fpexc_mode;	/* Floating-point exception mode */
-	unsigned long	pad[3];		/* was saved_msr, saved_softe */
+	unsigned long	start_tb;	/* Start purr when proc switched in */
+	unsigned long	accum_tb;	/* Total accumilated purr for process */
+	unsigned long	vdso_base;	/* base of the vDSO library */x #ifdef CONFIG_ALTIVEC
 	/* Complete AltiVec register set */x 	vector128	vr[32] __attribute((aligned(16)));xdiff -Nru a/include/asm-ppc64/prom.h b/include/asm-ppc64/prom.h
--- a/include/asm-ppc64/prom.h	2005-01-25 13:50:16 -08:00
+++ b/include/asm-ppc64/prom.h	2005-03-07 20:41:25 -08:00
@@ -137,6 +137,7 @@
 	int	devfn;			/* for pci devices */x 	int	eeh_mode;		/* See eeh.h for possible EEH_MODEs */x 	int	eeh_config_addr;
+	int	pci_ext_config_space;	/* for pci devices */x 	struct  pci_controller *phb;	/* for pci devices */x 	struct	iommu_table *iommu_table;	/* for phb's or bridges */x xdiff -Nru a/include/asm-ppc64/rtas.h b/include/asm-ppc64/rtas.h
--- a/include/asm-ppc64/rtas.h	2005-01-11 16:42:39 -08:00
+++ b/include/asm-ppc64/rtas.h	2005-03-02 12:50:33 -08:00
@@ -24,11 +24,8 @@
 
 /* RTAS return status codes */x #define RTAS_BUSY		-2    /* RTAS Busy */x-#define RTAS_NO_SUCH_INDICATOR	-3    /* No such indicator implemented */x #define RTAS_EXTENDED_DELAY_MIN	9900
 #define RTAS_EXTENDED_DELAY_MAX	9905x-x-#define RTAS_UNKNOWN_OP		-1099 /* Unknown RTAS Token */x 
 /*
  * In general to call RTAS use rtas_token("string") to lookupxdiff -Nru a/include/asm-ppc64/smp.h b/include/asm-ppc64/smp.h
--- a/include/asm-ppc64/smp.h	2005-01-10 00:49:03 -08:00
+++ b/include/asm-ppc64/smp.h	2005-03-04 22:41:54 -08:00
@@ -29,7 +29,7 @@
 extern int boot_cpuid;
 extern int boot_cpuid_phys;
 
-extern void cpu_die(void) __attribute__((noreturn));
+extern void cpu_die(void);
 
 #ifdef CONFIG_SMP
 
@@ -37,6 +37,13 @@
 struct pt_regs;
 extern void smp_message_recv(int, struct pt_regs *);
 
+#ifdef CONFIG_HOTPLUG_CPU
+extern void fixup_irqs(cpumask_t map);
+int generic_cpu_disable(void);
+int generic_cpu_enable(unsigned int cpu);
+void generic_cpu_die(unsigned int cpu);
+void generic_mach_cpu_die(void);
+#endif
 
 #define __smp_processor_id() (get_paca()->paca_index)
 #define hard_smp_processor_id() (get_paca()->hw_cpu_id)xdiff -Nru a/include/asm-ppc64/system.h b/include/asm-ppc64/system.h
--- a/include/asm-ppc64/system.h	2005-01-11 16:42:39 -08:00
+++ b/include/asm-ppc64/system.h	2005-03-04 22:41:13 -08:00
@@ -300,5 +300,7 @@
  */x #define NET_IP_ALIGN   0
 
+#define arch_align_stack(x) (x)
+x #endif /* __KERNEL__ */x #endifxdiff -Nru a/include/asm-ppc64/systemcfg.h b/include/asm-ppc64/systemcfg.h
--- a/include/asm-ppc64/systemcfg.h	2005-01-04 18:48:00 -08:00
+++ b/include/asm-ppc64/systemcfg.h	2005-03-04 22:41:54 -08:00
@@ -20,10 +20,14 @@
  * Minor version changes are a hint.
  */x #define SYSTEMCFG_MAJOR 1x-#define SYSTEMCFG_MINOR 0
+#define SYSTEMCFG_MINOR 1
 
 #ifndef __ASSEMBLY__
 
+#include <linux/unistd.h>x+x+#define SYSCALL_MAP_SIZE      ((__NR_syscalls + 31) / 32)x+
 struct systemcfg {
 	__u8  eye_catcher[16];		/* Eyecatcher: SYSTEMCFG:PPC64	0x00 */x 	struct {			/* Systemcfg version numbers	     */
@@ -47,7 +51,8 @@
 	__u32 dcache_line_size;		/* L1 d-cache line size		0x64 */x 	__u32 icache_size;		/* L1 i-cache size		0x68 */x 	__u32 icache_line_size;		/* L1 i-cache line size		0x6C */
-	__u8  reserved0[3984];		/* Reserve rest of page		0x70 */x+   	__u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of available syscalls 0x70 */x+   	__u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of available syscalls */x };
 
 #ifdef __KERNEL__x@@ -55,9 +60,5 @@
 #endif
 
 #endif /* __ASSEMBLY__ */x-x-#define SYSTEMCFG_PAGE      0x5x-#define SYSTEMCFG_PHYS_ADDR (SYSTEMCFG_PAGE<<PAGE_SHIFT)x-#define SYSTEMCFG_VIRT_ADDR (KERNELBASE+SYSTEMCFG_PHYS_ADDR)
 x #endif /* _SYSTEMCFG_H */xdiff -Nru a/include/asm-ppc64/time.h b/include/asm-ppc64/time.h
--- a/include/asm-ppc64/time.h	2005-01-04 18:48:02 -08:00
+++ b/include/asm-ppc64/time.h	2005-03-04 22:41:54 -08:00
@@ -43,10 +43,10 @@
 struct gettimeofday_vars {
 	unsigned long tb_to_xs;
 	unsigned long stamp_xsec;
+	unsigned long tb_orig_stamp;x };
 
 struct gettimeofday_struct {
-	unsigned long tb_orig_stamp;x 	unsigned long tb_ticks_per_sec;
 	struct gettimeofday_vars vars[2];
 	struct gettimeofday_vars * volatile varp;
@@ -102,5 +102,14 @@
 unsigned mulhwu_scale_factor(unsigned, unsigned);
 void div128_by_32( unsigned long dividend_high, unsigned long dividend_low,
 		   unsigned divisor, struct div_result *dr );
+
+/* Used to store Processor Utilization register (purr) values */x+
+struct cpu_usage {
+        u64 current_tb;  /* Holds the current purr register values */x+};x+
+DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array);
+x #endif /* __KERNEL__ */x #endif /* __PPC64_TIME_H */xdiff -Nru a/include/asm-ppc64/unistd.h b/include/asm-ppc64/unistd.h
--- a/include/asm-ppc64/unistd.h	2005-01-04 18:48:14 -08:00
+++ b/include/asm-ppc64/unistd.h	2005-03-06 15:58:58 -08:00
@@ -282,8 +282,9 @@
 #define __NR_add_key		269
 #define __NR_request_key	270
 #define __NR_keyctl		271
+#define __NR_waitid		272x 
-#define __NR_syscalls		272x+#define __NR_syscalls		273
 #ifdef __KERNEL__x #define NR_syscalls	__NR_syscallsx #endifxdiff -Nru a/include/asm-ppc64/vdso.h b/include/asm-ppc64/vdso.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-ppc64/vdso.h	2005-03-04 22:41:54 -08:00
@@ -0,0 +1,83 @@
+#ifndef __PPC64_VDSO_H__x+#define __PPC64_VDSO_H__x+
+#ifdef __KERNEL__x+
+/* Default link addresses for the vDSOs */x+#define VDSO32_LBASE	0
+#define VDSO64_LBASE	0
+
+/* Default map addresses */x+#define VDSO32_MBASE	0x100000
+#define VDSO64_MBASE	0x100000
+
+#define VDSO_VERSION_STRING	LINUX_2.6.11
+
+/* Define if 64 bits VDSO has procedure descriptors */x+#undef VDS64_HAS_DESCRIPTORSx+
+#ifndef __ASSEMBLY__
+
+extern unsigned int vdso64_pages;
+extern unsigned int vdso32_pages;
+
+/* Offsets relative to thread->vdso_base */
+extern unsigned long vdso64_rt_sigtramp;x+extern unsigned long vdso32_sigtramp;x+extern unsigned long vdso32_rt_sigtramp;x+
+extern void vdso_init(void);
+
+#else /* __ASSEMBLY__ */x+
+#ifdef __VDSO64__
+#ifdef VDS64_HAS_DESCRIPTORSx+#define V_FUNCTION_BEGIN(name)		\
+	.globl name;			\
+        .section ".opd","a";		\
+        .align 3;			\
+	name:				\
+	.quad .name,.TOC.@tocbase,0;	\
+	.previous;			\
+	.globl .name;			\
+	.type .name,@function; 		\
+	.name:				\
+x+#define V_FUNCTION_END(name)		\
+	.size .name,.-.name;
+x+#define V_LOCAL_FUNC(name) (.name)
+
+#else /* VDS64_HAS_DESCRIPTORS */x+
+#define V_FUNCTION_BEGIN(name)		\
+	.globl name;			\
+	name:				\
+x+#define V_FUNCTION_END(name)		\
+	.size name,.-name;
+x+#define V_LOCAL_FUNC(name) (name)
+
+#endif /* VDS64_HAS_DESCRIPTORS */x+#endif /* __VDSO64__ */x+
+#ifdef __VDSO32__x+
+#define V_FUNCTION_BEGIN(name)		\
+	.globl name;			\
+	.type name,@function; 		\
+	name:				\
+x+#define V_FUNCTION_END(name)		\
+	.size name,.-name;
+x+#define V_LOCAL_FUNC(name) (name)
+
+#endif /* __VDSO32__ */x+
+#endif /* __ASSEMBLY__ */x+
+#endif /* __KERNEL__ */x+
+#endif /* __PPC64_VDSO_H__ */xdiff -Nru a/include/asm-ppc64/vio.h b/include/asm-ppc64/vio.h
--- a/include/asm-ppc64/vio.h	2004-06-29 07:44:45 -07:00
+++ b/include/asm-ppc64/vio.h	2005-02-06 20:42:37 -08:00
@@ -57,32 +57,7 @@
 int vio_enable_interrupts(struct vio_dev *dev);
 int vio_disable_interrupts(struct vio_dev *dev);
 
-dma_addr_t vio_map_single(struct vio_dev *dev, void *vaddr, 
-			  size_t size, enum dma_data_direction direction);
-void vio_unmap_single(struct vio_dev *dev, dma_addr_t dma_handle, 
-		      size_t size, enum dma_data_direction direction);
-int vio_map_sg(struct vio_dev *vdev, struct scatterlist *sglist, 
-	       int nelems, enum dma_data_direction direction);
-void vio_unmap_sg(struct vio_dev *vdev, struct scatterlist *sglist, 
-		  int nelems, enum dma_data_direction direction);
-void *vio_alloc_consistent(struct vio_dev *dev, size_t size, 
-			   dma_addr_t *dma_handle);
-void vio_free_consistent(struct vio_dev *dev, size_t size, void *vaddr, 
-			 dma_addr_t dma_handle);
-
-static inline int vio_dma_supported(struct vio_dev *hwdev, u64 mask)
-{
-	return 1;
-}
-
-#define vio_map_page(dev, page, off, size, dir) \
-		vio_map_single(dev, (page_address(page) + (off)), size, dir)x-#define vio_unmap_page(dev,addr,sz,dir) vio_unmap_single(dev,addr,sz,dir)
-
-static inline int vio_set_dma_mask(struct vio_dev *dev, u64 mask)
-{
-	return -EIO;
-}
+extern struct dma_mapping_ops vio_dma_ops;
 
 extern struct bus_type vio_bus_type;x xdiff -Nru a/include/asm-s390/cacheflush.h b/include/asm-s390/cacheflush.h
--- a/include/asm-s390/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-s390/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -8,7 +8,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
diff -Nru a/include/asm-s390/pgalloc.h b/include/asm-s390/pgalloc.h
--- a/include/asm-s390/pgalloc.h	2004-04-12 10:54:30 -07:00
+++ b/include/asm-s390/pgalloc.h	2005-02-23 15:40:53 -08:00
@@ -130,8 +130,10 @@
 
 	pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
 	if (pte != NULL) {
-		for (i=0; i < PTRS_PER_PTE; i++)
-			pte_clear(pte+i);
+		for (i=0; i < PTRS_PER_PTE; i++) {
+			pte_clear(mm, vmaddr, pte+i);
+			vmaddr += PAGE_SIZE;
+		}
 	}
 	return pte;
 }
diff -Nru a/include/asm-s390/pgtable.h b/include/asm-s390/pgtable.h
--- a/include/asm-s390/pgtable.h	2005-01-06 08:58:52 -08:00
+++ b/include/asm-s390/pgtable.h	2005-03-07 20:41:32 -08:00
@@ -322,6 +322,7 @@
 {
 	*pteptr = pteval;
 }x+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)x 
 /*
  * pgd/pmd/pte query functions
@@ -457,7 +458,7 @@
 
 #endif /* __s390x__ */x 
-extern inline void pte_clear(pte_t *ptep)
+extern inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	pte_val(*ptep) = _PAGE_INVALID_EMPTY;
 }x@@ -521,7 +522,7 @@
 	return pte;
 }
 x-static inline int ptep_test_and_clear_young(pte_t *ptep)
+static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 	return 0;
 }x@@ -531,10 +532,10 @@
 			unsigned long address, pte_t *ptep)
 {
 	/* No need to flush TLB; bits are in storage key */x-	return ptep_test_and_clear_young(ptep);
+	return ptep_test_and_clear_young(vma, address, ptep);
 }
 x-static inline int ptep_test_and_clear_dirty(pte_t *ptep)
+static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 	return 0;
 }x@@ -544,13 +545,13 @@
 			unsigned long address, pte_t *ptep)
 {
 	/* No need to flush TLB; bits are in storage key */x-	return ptep_test_and_clear_dirty(ptep);
+	return ptep_test_and_clear_dirty(vma, address, ptep);
 }
 x-static inline pte_t ptep_get_and_clear(pte_t *ptep)
+static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	pte_t pte = *ptep;
-	pte_clear(ptep);
+	pte_clear(mm, addr, ptep);
 	return pte;
 }
 x@@ -573,19 +574,14 @@
 				      : "=m" (*ptep) : "m" (*ptep),
 				        "a" (ptep), "a" (address) );
 #endif /* __s390x__ */x-	pte_clear(ptep);
+	pte_val(*ptep) = _PAGE_INVALID_EMPTY;
 	return pte;
 }
 x-static inline void ptep_set_wrprotect(pte_t *ptep)
+static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
 	pte_t old_pte = *ptep;
-	set_pte(ptep, pte_wrprotect(old_pte));
-}
-
-static inline void ptep_mkdirty(pte_t *ptep)
-{
-	pte_mkdirty(*ptep);
+	set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
 }
 
 static inline voidx@@ -756,11 +752,17 @@
  *  0000000000111111111122222222223333333333444444444455 5555 5 55566 66
  *  0123456789012345678901234567890123456789012345678901 2345 6 78901 23
  */x+#ifndef __s390x__x+#define __SWP_OFFSET_MASK (~0UL >> 12)x+#elsex+#define __SWP_OFFSET_MASK (~0UL >> 11)
+#endif
 extern inline pte_t mk_swap_pte(unsigned long type, unsigned long offset)
 {
 	pte_t pte;
+	offset &= __SWP_OFFSET_MASK;
 	pte_val(pte) = _PAGE_INVALID_SWAP | ((type & 0x1f) << 2) |
-		((offset & 1) << 7) | ((offset & 0xffffe) << 11);
+		((offset & 1UL) << 7) | ((offset & ~1UL) << 11);
 	return pte;
 }
 x@@ -802,7 +804,6 @@
 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
 #define __HAVE_ARCH_PTEP_CLEAR_FLUSH
 #define __HAVE_ARCH_PTEP_SET_WRPROTECTx-#define __HAVE_ARCH_PTEP_MKDIRTY
 #define __HAVE_ARCH_PTE_SAME
 #define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_DIRTY
 #define __HAVE_ARCH_PAGE_TEST_AND_CLEAR_YOUNG
diff -Nru a/include/asm-s390/posix_types.h b/include/asm-s390/posix_types.h
--- a/include/asm-s390/posix_types.h	2003-09-22 21:16:30 -07:00
+++ b/include/asm-s390/posix_types.h	2005-03-07 20:41:32 -08:00
@@ -83,16 +83,16 @@
 #endif
 
 #undef  __FD_SETx-#define __FD_SET(fd,fdsetp)  set_bit(fd,fdsetp->fds_bits)
+#define __FD_SET(fd,fdsetp)  set_bit((fd),(fdsetp)->fds_bits)
 
 #undef  __FD_CLRx-#define __FD_CLR(fd,fdsetp)  clear_bit(fd,fdsetp->fds_bits)
+#define __FD_CLR(fd,fdsetp)  clear_bit((fd),(fdsetp)->fds_bits)
 
 #undef  __FD_ISSETx-#define __FD_ISSET(fd,fdsetp)  test_bit(fd,fdsetp->fds_bits)
+#define __FD_ISSET(fd,fdsetp)  test_bit((fd),(fdsetp)->fds_bits)
 
 #undef  __FD_ZEROx-#define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp)))
+#define __FD_ZERO(fdsetp) (memset ((fdsetp), 0, sizeof(*(fd_set *)(fdsetp))))
 x #endif     /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)*/x xdiff -Nru a/include/asm-s390/smp.h b/include/asm-s390/smp.h
--- a/include/asm-s390/smp.h	2004-07-11 01:59:30 -07:00
+++ b/include/asm-s390/smp.h	2005-03-07 20:41:32 -08:00
@@ -18,6 +18,7 @@
 #if defined(__KERNEL__) && defined(CONFIG_SMP) && !defined(__ASSEMBLY__)
 x #include <asm/lowcore.h>
+#include <asm/sigp.h>
 
 /*
   s390 specific smp.c headers
@@ -57,6 +58,30 @@
  
         __asm__ ("stap %0\n" : "=m" (cpu_address));
         return cpu_address;
+}
+
+/*
+ * returns 1 if cpu is in stopped/check stopped state or not operational
+ * returns 0 otherwise
+ */
+static inline int
+smp_cpu_not_running(int cpu)
+{
+	__u32 status;
+x+	switch (signal_processor_ps(&status, 0, cpu, sigp_sense)) {
+	case sigp_order_code_accepted:
+	case sigp_status_stored:
+		/* Check for stopped and check stop state */
+		if (status & 0x50)
+			return 1;
+		break;
+	case sigp_not_operational:
+		return 1;
+	default:
+		break;
+	}
+	return 0;
 }x 
 #define cpu_logical_map(cpu) (cpu)
diff -Nru a/include/asm-s390/system.h b/include/asm-s390/system.h
--- a/include/asm-s390/system.h	2005-01-15 14:01:57 -08:00
+++ b/include/asm-s390/system.h	2005-03-07 20:41:32 -08:00
@@ -335,19 +335,23 @@
         __asm__ __volatile__("lpswe 0(%0)" : : "a" (&psw), "m" (psw) : "cc" );
 
 #define __ctl_load(array, low, high) ({ \
+	typedef struct { char _[sizeof(array)]; } addrtype; \
 	__asm__ __volatile__ ( \
 		"   bras  1,0f\n" \
                 "   lctlg 0,0,0(%0)\n" \
 		"0: ex    %1,0(1)" \
-		: : "a" (&array), "a" (((low)<<4)+(high)) : "1" ); \
+		: : "a" (&array), "a" (((low)<<4)+(high)), \
+		    "m" (*(addrtype *)(array)) : "1" ); \
 	})
 
 #define __ctl_store(array, low, high) ({ \
+	typedef struct { char _[sizeof(array)]; } addrtype; \
 	__asm__ __volatile__ ( \
 		"   bras  1,0f\n" \
 		"   stctg 0,0,0(%1)\n" \
 		"0: ex    %2,0(1)" \
-		: "=m" (array) : "a" (&array), "a" (((low)<<4)+(high)) : "1" ); \
+		: "=m" (*(addrtype *)(array)) \
+		: "a" (&array), "a" (((low)<<4)+(high)) : "1" ); \
 	})
 
 #define __ctl_set_bit(cr, bit) ({ \
@@ -390,19 +394,23 @@
 	__asm__ __volatile__("lpsw 0(%0)" : : "a" (&psw) : "cc" );
 
 #define __ctl_load(array, low, high) ({ \
+	typedef struct { char _[sizeof(array)]; } addrtype; \
 	__asm__ __volatile__ ( \
 		"   bras  1,0f\n" \
                 "   lctl 0,0,0(%0)\n" \
 		"0: ex    %1,0(1)" \
-		: : "a" (&array), "a" (((low)<<4)+(high)) : "1" ); \
+		: : "a" (&array), "a" (((low)<<4)+(high)), \
+		    "m" (*(addrtype *)(array)) : "1" ); \
 	})
 
 #define __ctl_store(array, low, high) ({ \
+	typedef struct { char _[sizeof(array)]; } addrtype; \
 	__asm__ __volatile__ ( \
 		"   bras  1,0f\n" \
 		"   stctl 0,0,0(%1)\n" \
 		"0: ex    %2,0(1)" \
-		: "=m" (array) : "a" (&array), "a" (((low)<<4)+(high)): "1" ); \
+		: "=m" (*(addrtype *)(array)) \
+		: "a" (&array), "a" (((low)<<4)+(high)): "1" ); \
 	})
 
 #define __ctl_set_bit(cr, bit) ({ \
@@ -460,6 +468,8 @@
 extern void (*_machine_restart)(char *command);
 extern void (*_machine_halt)(void);
 extern void (*_machine_power_off)(void);
+
+#define arch_align_stack(x) (x)
 x #endif /* __KERNEL__ */x 
diff -Nru a/include/asm-s390/uaccess.h b/include/asm-s390/uaccess.h
--- a/include/asm-s390/uaccess.h	2004-08-27 00:02:37 -07:00
+++ b/include/asm-s390/uaccess.h	2005-03-07 20:41:32 -08:00
@@ -161,7 +161,7 @@
 		__put_user_asm(__x, ptr, __pu_err);		\
 		break;						\
 	default:						\
-		__pu_err = __put_user_bad();			\
+		__put_user_bad();				\
 		break;						\
 	 }							\
 	__pu_err;						\
@@ -182,7 +182,7 @@
 })
 
 x-extern int __put_user_bad(void);
+extern int __put_user_bad(void) __attribute__((noreturn));
 
 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
 #define __get_user_asm(x, ptr, err) \
@@ -225,8 +225,7 @@
 		__get_user_asm(__x, ptr, __gu_err);		\
 		break;						\
 	default:						\
-		__x = 0;					\
-		__gu_err = __get_user_bad();			\
+		__get_user_bad();				\
 		break;						\
 	}							\
 	(x) = __x;						\
@@ -248,7 +247,7 @@
 	__get_user(x, ptr);					\
 })
 
-extern int __get_user_bad(void);
+extern int __get_user_bad(void) __attribute__((noreturn));
 
 #define __put_user_unaligned __put_user
 #define __get_user_unaligned __get_user
diff -Nru a/include/asm-s390/unistd.h b/include/asm-s390/unistd.h
--- a/include/asm-s390/unistd.h	2005-01-04 18:48:14 -08:00
+++ b/include/asm-s390/unistd.h	2005-03-07 20:41:33 -08:00
@@ -270,8 +270,11 @@
 #define __NR_mq_notify		275
 #define __NR_mq_getsetattr	276
 /* Number 277 is reserved for new sys_kexec_load */x+#define __NR_add_key		278x+#define __NR_request_key	279x+#define __NR_keyctl		280x 
-#define NR_syscalls 278x+#define NR_syscalls 281
 
 /* 
  * There are some system calls that are not present on 64 bit, some
diff -Nru a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h
--- a/include/asm-sh/bitops.h	2004-10-28 00:39:50 -07:00
+++ b/include/asm-sh/bitops.h	2005-03-07 20:41:29 -08:00
@@ -262,9 +262,9 @@
 #define find_first_bit(addr, size) \
 	find_next_bit((addr), (size), 0)x x-static __inline__ int find_next_zero_bit(void *addr, int size, int offset)
+static __inline__ int find_next_zero_bit(const unsigned long *addr, int size, int offset)
 {
-	unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
+	const unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
 	unsigned long result = offset & ~31UL;x 	unsigned long tmp;x 
@@ -325,7 +325,7 @@
  * bits is cleared.
  */x x-static inline int sched_find_first_bit(unsigned long *b)
+static inline int sched_find_first_bit(const unsigned long *b)
 {
 	if (unlikely(b[0]))
 		return __ffs(b[0]);
diff -Nru a/include/asm-sh/bug.h b/include/asm-sh/bug.h
--- a/include/asm-sh/bug.h	2004-08-23 01:15:10 -07:00
+++ b/include/asm-sh/bug.h	2005-03-07 20:41:29 -08:00
@@ -8,7 +8,7 @@
  */x #define BUG() do { \
 	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
-	asm volatile("nop"); \
+	*(volatile int *)0 = 0; \
 } while (0)
 x #define HAVE_ARCH_BUG
diff -Nru a/include/asm-sh/cacheflush.h b/include/asm-sh/cacheflush.h
--- a/include/asm-sh/cacheflush.h	2004-09-17 07:29:45 -07:00
+++ b/include/asm-sh/cacheflush.h	2005-03-07 20:41:29 -08:00
@@ -1,5 +1,6 @@
 #ifndef __ASM_SH_CACHEFLUSH_H
 #define __ASM_SH_CACHEFLUSH_H
+#ifdef __KERNEL__x x #include <asm/cpu/cacheflush.h>x 
@@ -15,15 +16,16 @@
 
 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
 	do {							\
-		flush_cache_page(vma, vaddr);			\
+		flush_cache_page(vma, vaddr, page_to_pfn(page));\
 		memcpy(dst, src, len);				\
 		flush_icache_user_range(vma, page, vaddr, len);	\
 	} while (0)
 x #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
 	do {							\
-		flush_cache_page(vma, vaddr);			\
+		flush_cache_page(vma, vaddr, page_to_pfn(page));\
 		memcpy(dst, src, len);				\
 	} while (0)
 x+#endif /* __KERNEL__ */x #endif /* __ASM_SH_CACHEFLUSH_H */xdiff -Nru a/include/asm-sh/cpu-sh2/cacheflush.h b/include/asm-sh/cpu-sh2/cacheflush.h
--- a/include/asm-sh/cpu-sh2/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-sh/cpu-sh2/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -15,7 +15,7 @@
  *
  *  - flush_cache_all() flushes entire cache
  *  - flush_cache_mm(mm) flushes the specified mm context's cache lines
- *  - flush_cache_page(mm, vmaddr) flushes a single page
+ *  - flush_cache_page(mm, vmaddr, pfn) flushes a single page
  *  - flush_cache_range(vma, start, end) flushes a range of pages
  *
  *  - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
@@ -28,7 +28,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
diff -Nru a/include/asm-sh/cpu-sh3/cacheflush.h b/include/asm-sh/cpu-sh3/cacheflush.h
--- a/include/asm-sh/cpu-sh3/cacheflush.h	2004-10-18 22:26:41 -07:00
+++ b/include/asm-sh/cpu-sh3/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -15,7 +15,7 @@
  *
  *  - flush_cache_all() flushes entire cache
  *  - flush_cache_mm(mm) flushes the specified mm context's cache lines
- *  - flush_cache_page(mm, vmaddr) flushes a single page
+ *  - flush_cache_page(mm, vmaddr, pfn) flushes a single page
  *  - flush_cache_range(vma, start, end) flushes a range of pages
  *
  *  - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
@@ -43,7 +43,7 @@
 extern void flush_cache_mm(struct mm_struct *mm);
 extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
                               unsigned long end);
-extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr);
+extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
 extern void flush_dcache_page(struct page *pg);
 extern void flush_icache_range(unsigned long start, unsigned long end);
 extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
@@ -68,7 +68,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
diff -Nru a/include/asm-sh/cpu-sh3/freq.h b/include/asm-sh/cpu-sh3/freq.h
--- a/include/asm-sh/cpu-sh3/freq.h	2003-05-04 08:30:07 -07:00
+++ b/include/asm-sh/cpu-sh3/freq.h	2005-03-07 20:41:29 -08:00
@@ -10,7 +10,11 @@
 #ifndef __ASM_CPU_SH3_FREQ_H
 #define __ASM_CPU_SH3_FREQ_H
 
+#if defined(CONFIG_CPU_SUBTYPE_SH7300)
+#define FRQCR			0xa415ff80x+#elsex #define FRQCR			0xffffff80x+#endif
 #define MIN_DIVISOR_NR		0
 #define MAX_DIVISOR_NR		4x 
diff -Nru a/include/asm-sh/cpu-sh3/timer.h b/include/asm-sh/cpu-sh3/timer.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-sh/cpu-sh3/timer.h	2005-03-07 20:41:29 -08:00
@@ -0,0 +1,64 @@
+/*
+ * include/asm-sh/cpu-sh3/timer.h
+ *
+ * Copyright (C) 2004 Lineo Solutions, Inc.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#ifndef __ASM_CPU_SH3_TIMER_H
+#define __ASM_CPU_SH3_TIMER_H
+
+/*
+ * ---------------------------------------------------------------------------
+ * TMU Common definitions for SH3 processors
+ *	SH7706
+ *	SH7709S
+ *	SH7727
+ *	SH7729R
+ *	SH7710
+ *	SH7720
+ *	SH7300
+ * ---------------------------------------------------------------------------
+ */x+
+#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7710)x+#define TMU_TSTR	0xa412fe92	/* Byte access */
+x+#define TMU0_TCOR	0xa412fe94	/* Long access */
+#define TMU0_TCNT	0xa412fe98	/* Long access */
+#define TMU0_TCR	0xa412fe9c	/* Word access */
+x+#define TMU1_TCOR	0xa412fea0	/* Long access */
+#define TMU1_TCNT	0xa412fea4	/* Long access */
+#define TMU1_TCR	0xa412fea8	/* Word access */
+x+#define TMU2_TCOR	0xa412feac	/* Long access */
+#define TMU2_TCNT	0xa412feb0	/* Long access */
+#define TMU2_TCR	0xa412feb4	/* Word access */
+x+#elsex+#if !defined(CONFIG_CPU_SUBTYPE_SH7727)x+#define TMU_TOCR	0xfffffe90	/* Byte access */
+#endif
+#define TMU_TSTR	0xfffffe92	/* Byte access */
+x+#define TMU0_TCOR	0xfffffe94	/* Long access */
+#define TMU0_TCNT	0xfffffe98	/* Long access */
+#define TMU0_TCR	0xfffffe9c	/* Word access */
+x+#define TMU1_TCOR	0xfffffea0	/* Long access */
+#define TMU1_TCNT	0xfffffea4	/* Long access */
+#define TMU1_TCR	0xfffffea8	/* Word access */
+x+#define TMU2_TCOR	0xfffffeac	/* Long access */
+#define TMU2_TCNT	0xfffffeb0	/* Long access */
+#define TMU2_TCR	0xfffffeb4	/* Word access */
+#if !defined(CONFIG_CPU_SUBTYPE_SH7727)x+#define TMU2_TCPR2	0xfffffeb8	/* Long access */
+#endif
+#endif
+
+#endif /* __ASM_CPU_SH3_TIMER_H */
+xdiff -Nru a/include/asm-sh/cpu-sh4/cacheflush.h b/include/asm-sh/cpu-sh4/cacheflush.h
--- a/include/asm-sh/cpu-sh4/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-sh/cpu-sh4/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -28,7 +28,7 @@
 extern void flush_cache_mm(struct mm_struct *mm);
 extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
 			      unsigned long end);
-extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr);
+extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
 extern void flush_dcache_page(struct page *pg);
 
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
diff -Nru a/include/asm-sh/cpu-sh4/timer.h b/include/asm-sh/cpu-sh4/timer.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-sh/cpu-sh4/timer.h	2005-03-07 20:41:29 -08:00
@@ -0,0 +1,51 @@
+/*
+ * include/asm-sh/cpu-sh4/timer.h
+ *
+ * Copyright (C) 2004 Lineo Solutions, Inc. 
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#ifndef __ASM_CPU_SH4_TIMER_H
+#define __ASM_CPU_SH4_TIMER_H
+
+/*
+ * ---------------------------------------------------------------------------
+ * TMU Common definitions for SH4 processors
+ *	SH7750S/SH7750R
+ *	SH7751/SH7751R
+ *	SH7760
+ * ---------------------------------------------------------------------------
+ */x+
+#if !defined(CONFIG_CPU_SUBTYPE_SH7760)x+#define TMU_TOCR        0xffd80000      /* Byte access */
+#endif
+#define TMU_TSTR        0xffd80004      /* Byte access */
+x+#define TMU0_TCOR       0xffd80008      /* Long access */
+#define TMU0_TCNT       0xffd8000c      /* Long access */
+#define TMU0_TCR        0xffd80010      /* Word access */
+x+#define TMU1_TCOR       0xffd80014      /* Long access */
+#define TMU1_TCNT       0xffd80018      /* Long access */
+#define TMU1_TCR        0xffd8001c      /* Word access */
+x+#define TMU2_TCOR       0xffd80020      /* Long access */
+#define TMU2_TCNT       0xffd80024      /* Long access */
+#define TMU2_TCR        0xffd80028      /* Word access */
+#define TMU2_TCPR	0xffd8002c	/* Long access */
+
+#if !defined(CONFIG_CPU_SUBTYPE_SH7760)x+#define TMU3_TCOR       0xfe100008      /* Long access */
+#define TMU3_TCNT       0xfe10000c      /* Long access */
+#define TMU3_TCR        0xfe100010      /* Word access */
+x+#define TMU4_TCOR       0xfe100014      /* Long access */
+#define TMU4_TCNT       0xfe100018      /* Long access */
+#define TMU4_TCR        0xfe10001c      /* Word access */
+#endif
+
+#endif /* __ASM_CPU_SH4_TIMER_H */
+xdiff -Nru a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h
--- a/include/asm-sh/dma-mapping.h	2004-10-18 22:26:42 -07:00
+++ b/include/asm-sh/dma-mapping.h	2005-03-07 20:41:29 -08:00
@@ -3,7 +3,6 @@
 
 #include <linux/config.h>x #include <linux/mm.h>x-#include <linux/device.h>x #include <asm/scatterlist.h>x #include <asm/io.h>x 
diff -Nru a/include/asm-sh/hardirq.h b/include/asm-sh/hardirq.h
--- a/include/asm-sh/hardirq.h	2005-01-04 18:48:11 -08:00
+++ b/include/asm-sh/hardirq.h	2005-03-07 20:41:28 -08:00
@@ -12,15 +12,6 @@
 
 #include <linux/irq_cpustat.h>	/* Standard mappings for irq_cpustat_t above */x x-#define HARDIRQ_BITS	8
-
-/*
- * The hardirq mask has to be large enough to have
- * space for potentially all IRQ sources in the system
- * nesting on a single CPU:
- */x-#if (1 << HARDIRQ_BITS) < NR_IRQSx-# error HARDIRQ_BITS is too low!
-#endif
+extern void ack_bad_irq(unsigned int irq);
 x #endif /* __ASM_SH_HARDIRQ_H */xdiff -Nru a/include/asm-sh/irq.h b/include/asm-sh/irq.h
--- a/include/asm-sh/irq.h	2004-10-18 22:26:43 -07:00
+++ b/include/asm-sh/irq.h	2005-03-07 20:41:29 -08:00
@@ -17,7 +17,8 @@
 
 #if defined(CONFIG_SH_HP600) || \
     defined(CONFIG_SH_RTS7751R2D) || \
-    defined(CONFIG_SH_HS7751RVOIP)
+    defined(CONFIG_SH_HS7751RVOIP) || \
+    defined(CONFIG_SH_SH03)x #include <asm/mach/ide.h>x #endif
 
diff -Nru a/include/asm-sh/mc146818rtc.h b/include/asm-sh/mc146818rtc.h
--- a/include/asm-sh/mc146818rtc.h	2004-05-29 02:13:09 -07:00
+++ b/include/asm-sh/mc146818rtc.h	2005-03-07 20:41:29 -08:00
@@ -16,6 +16,7 @@
 
 /* FIXME:RTC Interrupt feature is not implemented yet. */x #undef  RTC_IRQ
+#define RTC_IRQ		0
 
 #if defined(CONFIG_CPU_SH3)
 #define RTC_PORT(n)		(R64CNT+(n)*2)
diff -Nru a/include/asm-sh/pgtable-2level.h b/include/asm-sh/pgtable-2level.h
--- a/include/asm-sh/pgtable-2level.h	2002-10-18 14:24:01 -07:00
+++ b/include/asm-sh/pgtable-2level.h	2005-02-23 15:40:53 -08:00
@@ -41,6 +41,8 @@
  * hook is made available.
  */x #define set_pte(pteptr, pteval) (*(pteptr) = pteval)x+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)x+
 /*
  * (pmds are folded into pgds so this doesn't get actually called,
  * but the define is needed for a generic inline function.)
diff -Nru a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h
--- a/include/asm-sh/pgtable.h	2004-12-22 01:36:07 -08:00
+++ b/include/asm-sh/pgtable.h	2005-02-23 15:40:53 -08:00
@@ -164,7 +164,7 @@
 
 #define pte_none(x)	(!pte_val(x))
 #define pte_present(x)	(pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE))x-#define pte_clear(xp)	do { set_pte(xp, __pte(0)); } while (0)
+#define pte_clear(mm,addr,xp)	do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
 
 #define pmd_none(x)	(!pmd_val(x))
 #define pmd_present(x)	(pmd_val(x) & _PAGE_PRESENT)
@@ -290,7 +290,7 @@
 
 #if defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)
 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
-extern pte_t ptep_get_and_clear(pte_t *ptep);
+extern pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
 #endif
 
 #include <asm-generic/pgtable.h>
diff -Nru a/include/asm-sh/sh03/ide.h b/include/asm-sh/sh03/ide.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/asm-sh/sh03/ide.h	2005-03-07 20:41:29 -08:00
@@ -0,0 +1,7 @@
+#ifndef __ASM_SH_SH03_IDE_H
+#define __ASM_SH_SH03_IDE_H
+
+#define IRQ_CFCARD	8
+#define IRQ_PCMCIA	8
+
+#endif /* __ASM_SH_SH03_IDE_H */xdiff -Nru a/include/asm-sh/system.h b/include/asm-sh/system.h
--- a/include/asm-sh/system.h	2004-10-28 00:39:50 -07:00
+++ b/include/asm-sh/system.h	2005-03-04 22:41:13 -08:00
@@ -259,4 +259,6 @@
 void disable_hlt(void);
 void enable_hlt(void);
 
+#define arch_align_stack(x) (x)
+x #endifxdiff -Nru a/include/asm-sh64/bug.h b/include/asm-sh64/bug.h
--- a/include/asm-sh64/bug.h	2004-06-29 07:44:46 -07:00
+++ b/include/asm-sh64/bug.h	2005-03-07 20:41:28 -08:00
@@ -1,7 +1,32 @@
 #ifndef __ASM_SH64_BUG_H
 #define __ASM_SH64_BUG_H
 x-#include <asm-sh/bug.h>
+#include <linux/config.h>x+
+/*
+ * Tell the user there is some problem, then force a segfault (in process
+ * context) or a panic (interrupt context).
+ */
+#define BUG() do { \
+	printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
+	*(volatile int *)0 = 0; \
+} while (0)
+
+#define BUG_ON(condition) do { \
+	if (unlikely((condition)!=0)) \
+		BUG(); \
+} while(0)
+
+#define PAGE_BUG(page) do { \
+	BUG(); \
+} while (0)
+
+#define WARN_ON(condition) do { \
+	if (unlikely((condition)!=0)) { \
+		printk("Badness in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
+		dump_stack(); \
+	} \
+} while (0)
 x #endif /* __ASM_SH64_BUG_H */x 
diff -Nru a/include/asm-sh64/cacheflush.h b/include/asm-sh64/cacheflush.h
--- a/include/asm-sh64/cacheflush.h	2004-09-17 07:31:42 -07:00
+++ b/include/asm-sh64/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -14,7 +14,7 @@
 extern void flush_cache_sigtramp(unsigned long start, unsigned long end);
 extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
 			      unsigned long end);
-extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr);
+extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
 extern void flush_dcache_page(struct page *pg);
 extern void flush_icache_range(unsigned long start, unsigned long end);
 extern void flush_icache_user_range(struct vm_area_struct *vma,
@@ -31,14 +31,14 @@
 
 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
 	do {							\
-		flush_cache_page(vma, vaddr);			\
+		flush_cache_page(vma, vaddr, page_to_pfn(page));\
 		memcpy(dst, src, len);				\
 		flush_icache_user_range(vma, page, vaddr, len);	\
 	} while (0)
 x #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
 	do {							\
-		flush_cache_page(vma, vaddr);			\
+		flush_cache_page(vma, vaddr, page_to_pfn(page));\
 		memcpy(dst, src, len);				\
 	} while (0)
 xdiff -Nru a/include/asm-sh64/elf.h b/include/asm-sh64/elf.h
--- a/include/asm-sh64/elf.h	2004-06-29 07:44:46 -07:00
+++ b/include/asm-sh64/elf.h	2005-03-07 20:41:27 -08:00
@@ -53,6 +53,12 @@
 
 #define ELF_ET_DYN_BASE         (2 * TASK_SIZE / 3)
 
+#define	R_SH_DIR32		1
+#define	R_SH_REL32		2
+#define	R_SH_IMM_LOW16		246
+#define	R_SH_IMM_LOW16_PCREL	247
+#define	R_SH_IMM_MEDLOW16	248
+#define	R_SH_IMM_MEDLOW16_PCREL	249
 
 #define ELF_CORE_COPY_REGS(_dest,_regs)				\
 	memcpy((char *) &_dest, (char *) _regs,			\
diff -Nru a/include/asm-sh64/hardirq.h b/include/asm-sh64/hardirq.h
--- a/include/asm-sh64/hardirq.h	2004-06-29 07:44:46 -07:00
+++ b/include/asm-sh64/hardirq.h	2005-03-07 20:41:27 -08:00
@@ -1,7 +1,19 @@
 #ifndef __ASM_SH64_HARDIRQ_H
 #define __ASM_SH64_HARDIRQ_H
 x-#include <asm-sh/hardirq.h>
+#include <linux/config.h>x+#include <linux/threads.h>x+#include <linux/irq.h>
+
+/* entry.S is sensitive to the offsets of these fields */
+typedef struct {
+	unsigned int __softirq_pending;
+} ____cacheline_aligned irq_cpustat_t;
+
+#include <linux/irq_cpustat.h>	/* Standard mappings for irq_cpustat_t above */x+
+/* arch/sh64/kernel/irq.c */
+extern void ack_bad_irq(unsigned int irq);
 x #endif /* __ASM_SH64_HARDIRQ_H */x 
diff -Nru a/include/asm-sh64/hardware.h b/include/asm-sh64/hardware.h
--- a/include/asm-sh64/hardware.h	2004-06-29 07:44:46 -07:00
+++ b/include/asm-sh64/hardware.h	2005-03-07 20:41:28 -08:00
@@ -17,29 +17,6 @@
 #define	PHYS_PERIPHERAL_BLOCK	0x09000000
 #define PHYS_DMAC_BLOCK		0x0e000000
 #define PHYS_PCI_BLOCK		0x60000000
-
-#ifndef __ASSEMBLY__
-#include <linux/types.h>x-#include <asm/io.h>x-
-struct vcr_info {
-	u8	perr_flags;	/* P-port Error flags */x-	u8	merr_flags;	/* Module Error flags */x-	u16	mod_vers;	/* Module Version */x-	u16	mod_id;		/* Module ID */x-	u8	bot_mb;		/* Bottom Memory block */x-	u8	top_mb;		/* Top Memory block */x-};
-
-static inline struct vcr_info sh64_get_vcr_info(unsigned long base)
-{
-	unsigned long long tmp;x-
-	tmp = sh64_in64(base);x-
-	return *((struct vcr_info *)&tmp);
-}
-
-#endif /* __ASSEMBLY__ */x+#define PHYS_EMI_BLOCK		0xff000000
 x #endif /* __ASM_SH64_HARDWARE_H */xdiff -Nru a/include/asm-sh64/ide.h b/include/asm-sh64/ide.h
--- a/include/asm-sh64/ide.h	2004-06-29 07:44:46 -07:00
+++ b/include/asm-sh64/ide.h	2005-03-07 20:41:27 -08:00
@@ -21,7 +21,12 @@
 #define MAX_HWIFS	CONFIG_IDE_MAX_HWIFS
 #endif
 
+/* Without this, the initialisation of PCI IDE cards end up calling
+ * ide_init_hwif_ports, which won't work. */
+#ifdef CONFIG_BLK_DEV_IDEPCI
+#define IDE_ARCH_OBSOLETE_INIT 1
 #define ide_default_io_ctl(base)	(0)
+#endif
 
 #include <asm-generic/ide_iops.h>x 
diff -Nru a/include/asm-sh64/io.h b/include/asm-sh64/io.h
--- a/include/asm-sh64/io.h	2004-10-25 13:06:49 -07:00
+++ b/include/asm-sh64/io.h	2005-03-07 20:41:27 -08:00
@@ -25,9 +25,11 @@
  * onchip_remap();
  */x 
+#include <linux/compiler.h>x #include <asm/cache.h>x #include <asm/system.h>x #include <asm/page.h>
+#include <asm-generic/iomap.h>
 
 #define virt_to_bus virt_to_phys
 #define bus_to_virt phys_to_virt
@@ -39,75 +41,90 @@
  * with an implicit size. The traditional read{b,w,l}/write{b,w,l}
  * mess is wrapped to this, as are the SH-specific ctrl_in/out routines.
  */x-static inline unsigned char sh64_in8(unsigned long addr)
+static inline unsigned char sh64_in8(const volatile void __iomem *addr)
 {
-	return *(volatile unsigned char *)addr;
+	return *(volatile unsigned char __force *)addr;
 }
 x-static inline unsigned short sh64_in16(unsigned long addr)
+static inline unsigned short sh64_in16(const volatile void __iomem *addr)
 {
-	return *(volatile unsigned short *)addr;
+	return *(volatile unsigned short __force *)addr;
 }
 x-static inline unsigned long sh64_in32(unsigned long addr)
+static inline unsigned int sh64_in32(const volatile void __iomem *addr)
 {
-	return *(volatile unsigned long *)addr;
+	return *(volatile unsigned int __force *)addr;
 }
 x-static inline unsigned long long sh64_in64(unsigned long addr)
+static inline unsigned long long sh64_in64(const volatile void __iomem *addr)
 {
-	return *(volatile unsigned long long *)addr;
+	return *(volatile unsigned long long __force *)addr;
 }
 x-static inline void sh64_out8(unsigned char b, unsigned long addr)
+static inline void sh64_out8(unsigned char b, volatile void __iomem *addr)
 {
-	*(volatile unsigned char *)addr = b;
+	*(volatile unsigned char __force *)addr = b;
 	wmb();
 }
 x-static inline void sh64_out16(unsigned short b, unsigned long addr)
+static inline void sh64_out16(unsigned short b, volatile void __iomem *addr)
 {
-	*(volatile unsigned short *)addr = b;
+	*(volatile unsigned short __force *)addr = b;
 	wmb();
 }
 x-static inline void sh64_out32(unsigned long b, unsigned long addr)
+static inline void sh64_out32(unsigned int b, volatile void __iomem *addr)
 {
-	*(volatile unsigned long *)addr = b;
+	*(volatile unsigned int __force *)addr = b;
 	wmb();
 }
 x-static inline void sh64_out64(unsigned long long b, unsigned long addr)
+static inline void sh64_out64(unsigned long long b, volatile void __iomem *addr)
 {
-	*(volatile unsigned long long *)addr = b;
+	*(volatile unsigned long long __force *)addr = b;
 	wmb();
 }
 x #define readb(addr)		sh64_in8(addr)
 #define readw(addr)		sh64_in16(addr)
 #define readl(addr)		sh64_in32(addr)
-#define readb_relaxed(addr)		sh64_in8(addr)
-#define readw_relaxed(addr)		sh64_in16(addr)
-#define readl_relaxed(addr)		sh64_in32(addr)
+#define readb_relaxed(addr)	sh64_in8(addr)
+#define readw_relaxed(addr)	sh64_in16(addr)
+#define readl_relaxed(addr)	sh64_in32(addr)
 x #define writeb(b, addr)		sh64_out8(b, addr)x #define writew(b, addr)		sh64_out16(b, addr)x #define writel(b, addr)		sh64_out32(b, addr)x 
-#define ctrl_inb(addr)		sh64_in8(addr)
-#define ctrl_inw(addr)		sh64_in16(addr)
-#define ctrl_inl(addr)		sh64_in32(addr)
-
-#define ctrl_outb(b, addr)	sh64_out8(b, addr)x-#define ctrl_outw(b, addr)	sh64_out16(b, addr)x-#define ctrl_outl(b, addr)	sh64_out32(b, addr)x-
-unsigned long inb(unsigned long port);
-unsigned long inw(unsigned long port);
-unsigned long inl(unsigned long port);
-void outb(unsigned long value, unsigned long port);
-void outw(unsigned long value, unsigned long port);
-void outl(unsigned long value, unsigned long port);
+#define ctrl_inb(addr)		sh64_in8(ioport_map(addr, 1))
+#define ctrl_inw(addr)		sh64_in16(ioport_map(addr, 2))
+#define ctrl_inl(addr)		sh64_in32(ioport_map(addr, 4))
+
+#define ctrl_outb(b, addr)	sh64_out8(b, ioport_map(addr, 1))
+#define ctrl_outw(b, addr)	sh64_out16(b, ioport_map(addr, 2))
+#define ctrl_outl(b, addr)	sh64_out32(b, ioport_map(addr, 4))
+
+#define ioread8(addr)		sh64_in8(addr)
+#define ioread16(addr)		sh64_in16(addr)
+#define ioread32(addr)		sh64_in32(addr)
+#define iowrite8(b, addr)	sh64_out8(b, addr)x+#define iowrite16(b, addr)	sh64_out16(b, addr)x+#define iowrite32(b, addr)	sh64_out32(b, addr)x+
+#define inb(addr)		ctrl_inb(addr)
+#define inw(addr)		ctrl_inw(addr)
+#define inl(addr)		ctrl_inl(addr)
+#define outb(b, addr)		ctrl_outb(b, addr)
+#define outw(b, addr)		ctrl_outw(b, addr)
+#define outl(b, addr)		ctrl_outl(b, addr)x+
+void outsw(unsigned long port, const void *addr, unsigned long count);
+void insw(unsigned long port, void *addr, unsigned long count);
+void outsl(unsigned long port, const void *addr, unsigned long count);
+void insl(unsigned long port, void *addr, unsigned long count);
+
+void memcpy_toio(void __iomem *to, const void *from, long count);
+void memcpy_fromio(void *to, void __iomem *from, long count);
 x #define mmiowb()x 
@@ -154,7 +171,7 @@
 unsigned long onchip_remap(unsigned long addr, unsigned long size, const char* name);
 extern void onchip_unmap(unsigned long vaddr);x x-static __inline__ int check_signature(unsigned long io_addr,
+static __inline__ int check_signature(volatile void __iomem *io_addr,
 			const unsigned char *signature, int length)
 {
 	int retval = 0;
diff -Nru a/include/asm-sh64/ioctls.h b/include/asm-sh64/ioctls.h
--- a/include/asm-sh64/ioctls.h	2004-06-29 07:44:46 -07:00
+++ b/include/asm-sh64/ioctls.h	2005-03-07 20:41:28 -08:00
@@ -9,103 +9,108 @@
  * include/asm-sh64/ioctls.h
  *
  * Copyright (C) 2000, 2001  Paolo Alberelli
+ * Copyright (C) 2004  Richard Curnow
  *
  */x x #include <asm/ioctl.h>
 
-#define FIOCLEX		_IO('f', 1)
-#define FIONCLEX	_IO('f', 2)
-#define FIOASYNC	_IOW('f', 125, int)
-#define FIONBIO		_IOW('f', 126, int)
-#define FIONREAD	_IOR('f', 127, int)
+#define FIOCLEX		0x6601		/* _IO('f', 1) */x+#define FIONCLEX	0x6602		/* _IO('f', 2) */x+#define FIOASYNC	0x4004667d	/* _IOW('f', 125, int) */x+#define FIONBIO		0x4004667e	/* _IOW('f', 126, int) */x+#define FIONREAD	0x8004667f	/* _IOW('f', 127, int) */x #define TIOCINQ		FIONREAD
-#define FIOQSIZE	_IOR('f', 128, loff_t)
+#define FIOQSIZE	0x80086680	/* _IOR('f', 128, loff_t) */x x #define TCGETS		0x5401x #define TCSETS		0x5402x #define TCSETSW		0x5403x #define TCSETSF		0x5404
 
-#define TCGETA		_IOR('t', 23, struct termio)
-#define TCSETA		_IOW('t', 24, struct termio)
-#define TCSETAW		_IOW('t', 25, struct termio)
-#define TCSETAF		_IOW('t', 28, struct termio)
-
-#define TCSBRK		_IO('t', 29)
-#define TCXONC		_IO('t', 30)
-#define TCFLSH		_IO('t', 31)
-
-#define TIOCSWINSZ	_IOW('t', 103, struct winsize)
-#define TIOCGWINSZ	_IOR('t', 104, struct winsize)
-#define	TIOCSTART	_IO('t', 110)		/* start output, like ^Q */x-#define	TIOCSTOP	_IO('t', 111)		/* stop output, like ^S */x-#define TIOCOUTQ        _IOR('t', 115, int)     /* output queue size */x-
-#define TIOCSPGRP	_IOW('t', 118, int)
-#define TIOCGPGRP	_IOR('t', 119, int)
-
-#define TIOCEXCL	_IO('T', 12) /* 0x540C */x-#define TIOCNXCL	_IO('T', 13) /* 0x540D */x-#define TIOCSCTTY	_IO('T', 14) /* 0x540E */x-
-#define TIOCSTI		_IOW('T', 18, char) /* 0x5412 */x-#define TIOCMGET	_IOR('T', 21, unsigned int) /* 0x5415 */x-#define TIOCMBIS	_IOW('T', 22, unsigned int) /* 0x5416 */x-#define TIOCMBIC	_IOW('T', 23, unsigned int) /* 0x5417 */x-#define TIOCMSET	_IOW('T', 24, unsigned int) /* 0x5418 */x-# define TIOCM_LE	0x001x-# define TIOCM_DTR	0x002x-# define TIOCM_RTS	0x004x-# define TIOCM_ST	0x008x-# define TIOCM_SR	0x010x-# define TIOCM_CTS	0x020x-# define TIOCM_CAR	0x040x-# define TIOCM_RNG	0x080x-# define TIOCM_DSR	0x100x-# define TIOCM_CD	TIOCM_CARx-# define TIOCM_RI	TIOCM_RNGx-
-#define TIOCGSOFTCAR	_IOR('T', 25, unsigned int) /* 0x5419 */x-#define TIOCSSOFTCAR	_IOW('T', 26, unsigned int) /* 0x541A */x-#define TIOCLINUX	_IOW('T', 28, char) /* 0x541C */x-#define TIOCCONS	_IO('T', 29) /* 0x541D */x-#define TIOCGSERIAL	_IOR('T', 30, struct serial_struct) /* 0x541E */x-#define TIOCSSERIAL	_IOW('T', 31, struct serial_struct) /* 0x541F */x-#define TIOCPKT		_IOW('T', 32, int) /* 0x5420 */x-# define TIOCPKT_DATA		 0x-# define TIOCPKT_FLUSHREAD	 1x-# define TIOCPKT_FLUSHWRITE	 2x-# define TIOCPKT_STOP		 4x-# define TIOCPKT_START		 8x-# define TIOCPKT_NOSTOP		16x-# define TIOCPKT_DOSTOP		32x-
-x-#define TIOCNOTTY	_IO('T', 34) /* 0x5422 */x-#define TIOCSETD	_IOW('T', 35, int) /* 0x5423 */x-#define TIOCGETD	_IOR('T', 36, int) /* 0x5424 */x-#define TCSBRKP		_IOW('T', 37, int) /* 0x5425 */	/* Needed for POSIX tcsendbreak() */x-#define TIOCTTYGSTRUCT	_IOR('T', 38, struct tty_struct) /* 0x5426 */ /* For debugging only */x-#define TIOCSBRK	_IO('T', 39) /* 0x5427 */ /* BSD compatibility */x-#define TIOCCBRK	_IO('T', 40) /* 0x5428 */ /* BSD compatibility */x-#define TIOCGSID	_IOR('T', 41, pid_t) /* 0x5429 */ /* Return the session ID of FD */x-#define TIOCGPTN	_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */x-#define TIOCSPTLCK	_IOW('T',0x31, int)  /* Lock/unlock Pty */x-
-#define TIOCSERCONFIG	_IO('T', 83) /* 0x5453 */x-#define TIOCSERGWILD	_IOR('T', 84,  int) /* 0x5454 */x-#define TIOCSERSWILD	_IOW('T', 85,  int) /* 0x5455 */
+#define TCGETA		0x80127417	/* _IOR('t', 23, struct termio) */
+#define TCSETA		0x40127418	/* _IOW('t', 24, struct termio) */
+#define TCSETAW		0x40127419	/* _IOW('t', 25, struct termio) */
+#define TCSETAF		0x4012741c	/* _IOW('t', 28, struct termio) */
+
+#define TCSBRK		0x741d		/* _IO('t', 29) */
+#define TCXONC		0x741e		/* _IO('t', 30) */
+#define TCFLSH		0x741f		/* _IO('t', 31) */
+
+#define TIOCSWINSZ	0x40087467	/* _IOW('t', 103, struct winsize) */
+#define TIOCGWINSZ	0x80087468	/* _IOR('t', 104, struct winsize) */
+#define	TIOCSTART	0x746e		/* _IO('t', 110)  start output, like ^Q */x+#define	TIOCSTOP	0x746f		/* _IO('t', 111)  stop output, like ^S */x+#define TIOCOUTQ        0x80047473	/* _IOR('t', 115, int) output queue size */x+
+#define TIOCSPGRP	0x40047476	/* _IOW('t', 118, int) */
+#define TIOCGPGRP	0x80047477	/* _IOR('t', 119, int) */
+
+#define TIOCEXCL	0x540c		/* _IO('T', 12) */
+#define TIOCNXCL	0x540d		/* _IO('T', 13) */
+#define TIOCSCTTY	0x540e		/* _IO('T', 14) */
+
+#define TIOCSTI		0x40015412	/* _IOW('T', 18, char) 0x5412 */x+#define TIOCMGET	0x80045415	/* _IOR('T', 21, unsigned int) 0x5415 */x+#define TIOCMBIS	0x40045416	/* _IOW('T', 22, unsigned int) 0x5416 */x+#define TIOCMBIC	0x40045417	/* _IOW('T', 23, unsigned int) 0x5417 */x+#define TIOCMSET	0x40045418	/* _IOW('T', 24, unsigned int) 0x5418 */
+
+#define TIOCM_LE	0x001x+#define TIOCM_DTR	0x002x+#define TIOCM_RTS	0x004x+#define TIOCM_ST	0x008x+#define TIOCM_SR	0x010x+#define TIOCM_CTS	0x020x+#define TIOCM_CAR	0x040x+#define TIOCM_RNG	0x080x+#define TIOCM_DSR	0x100x+#define TIOCM_CD	TIOCM_CARx+#define TIOCM_RI	TIOCM_RNGx+
+#define TIOCGSOFTCAR	0x80045419	/* _IOR('T', 25, unsigned int) 0x5419 */
+#define TIOCSSOFTCAR	0x4004541a	/* _IOW('T', 26, unsigned int) 0x541A */
+#define TIOCLINUX	0x4004541c	/* _IOW('T', 28, char) 0x541C */
+#define TIOCCONS	0x541d		/* _IO('T', 29) */
+#define TIOCGSERIAL	0x803c541e	/* _IOR('T', 30, struct serial_struct) 0x541E */x+#define TIOCSSERIAL	0x403c541f	/* _IOW('T', 31, struct serial_struct) 0x541F */x+#define TIOCPKT		0x40045420	/* _IOW('T', 32, int) 0x5420 */x+x+#define TIOCPKT_DATA		 0x+#define TIOCPKT_FLUSHREAD	 1x+#define TIOCPKT_FLUSHWRITE	 2x+#define TIOCPKT_STOP		 4x+#define TIOCPKT_START		 8x+#define TIOCPKT_NOSTOP		16x+#define TIOCPKT_DOSTOP		32x+x+x+#define TIOCNOTTY	0x5422		/* _IO('T', 34) */
+#define TIOCSETD	0x40045423	/* _IOW('T', 35, int) 0x5423 */
+#define TIOCGETD	0x80045424	/* _IOR('T', 36, int) 0x5424 */
+#define TCSBRKP		0x40045424	/* _IOW('T', 37, int) 0x5425 */	/* Needed for POSIX tcsendbreak() */x+#define TIOCTTYGSTRUCT	0x8c105426	/* _IOR('T', 38, struct tty_struct) 0x5426 */ /* For debugging only */x+#define TIOCSBRK	0x5427		/* _IO('T', 39) */ /* BSD compatibility */x+#define TIOCCBRK	0x5428		/* _IO('T', 40) */ /* BSD compatibility */x+#define TIOCGSID	0x80045429	/* _IOR('T', 41, pid_t) 0x5429 */ /* Return the session ID of FD */x+#define TIOCGPTN	0x80045430	/* _IOR('T',0x30, unsigned int) 0x5430 Get Pty Number (of pty-mux device) */x+#define TIOCSPTLCK	0x40045431	/* _IOW('T',0x31, int) Lock/unlock Pty */x+
+#define TIOCSERCONFIG	0x5453		/* _IO('T', 83) */
+#define TIOCSERGWILD	0x80045454	/* _IOR('T', 84,  int) 0x5454 */x+#define TIOCSERSWILD	0x40045455	/* _IOW('T', 85,  int) 0x5455 */
 #define TIOCGLCKTRMIOS	0x5456
 #define TIOCSLCKTRMIOS	0x5457x-#define TIOCSERGSTRUCT	_IOR('T', 88, struct async_struct) /* 0x5458 */ /* For debugging only */x-#define TIOCSERGETLSR   _IOR('T', 89, unsigned int) /* 0x5459 */ /* Get line status register */x-  /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */x-# define TIOCSER_TEMT    0x01	/* Transmitter physically empty */x-#define TIOCSERGETMULTI _IOR('T', 90, struct serial_multiport_struct) /* 0x545A */ /* Get multiport config  */x-#define TIOCSERSETMULTI _IOW('T', 91, struct serial_multiport_struct) /* 0x545B */ /* Set multiport config */
+#define TIOCSERGSTRUCT	0x80d85458	/* _IOR('T', 88, struct async_struct) 0x5458 */ /* For debugging only */x+#define TIOCSERGETLSR   0x80045459	/* _IOR('T', 89, unsigned int) 0x5459 */ /* Get line status register */x x-#define TIOCMIWAIT	_IO('T', 92) /* 0x545C */	/* wait for a change on serial input line(s) */x-#define TIOCGICOUNT	_IOR('T', 93, struct async_icount) /* 0x545D */	/* read serial port inline interrupt counts */
+/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */x+#define TIOCSER_TEMT    0x01	/* Transmitter physically empty */x+x+#define TIOCSERGETMULTI 0x80a8545a	/* _IOR('T', 90, struct serial_multiport_struct) 0x545A */ /* Get multiport config  */x+#define TIOCSERSETMULTI 0x40a8545b	/* _IOW('T', 91, struct serial_multiport_struct) 0x545B */ /* Set multiport config */
+x+#define TIOCMIWAIT	0x545c		/* _IO('T', 92) wait for a change on serial input line(s) */x+#define TIOCGICOUNT	0x802c545d	/* _IOR('T', 93, struct async_icount) 0x545D */	/* read serial port inline interrupt counts */
 x #endif /* __ASM_SH64_IOCTLS_H */xdiff -Nru a/include/asm-sh64/irq.h b/include/asm-sh64/irq.h
--- a/include/asm-sh64/irq.h	2004-06-29 07:44:46 -07:00
+++ b/include/asm-sh64/irq.h	2005-03-07 20:41:27 -08:00
@@ -83,10 +83,11 @@
 #define IRQ_P2INTC      (START_EXT_IRQS + (3*8) + 2)
 #define IRQ_P2INTD      (START_EXT_IRQS + (3*8) + 3)x 
-#define START_EXT_IRQS  64
-
 #define I8042_KBD_IRQ	(START_EXT_IRQS + 2)
 #define I8042_AUX_IRQ	(START_EXT_IRQS + 6)
+
+#define IRQ_CFCARD	(START_EXT_IRQS + 7)x+#define IRQ_PCMCIA	(0)
 x #elsex #define NR_EXT_IRQS	0xdiff -Nru a/include/asm-sh64/module.h b/include/asm-sh64/module.h
--- a/include/asm-sh64/module.h	2004-06-29 07:44:46 -07:00
+++ b/include/asm-sh64/module.h	2005-03-07 20:41:27 -08:00
@@ -4,6 +4,14 @@
  * This file contains the SH architecture specific module code.
  */x 
+struct mod_arch_specific {
+	/* empty */x+};
+
+#define Elf_Shdr		Elf32_Shdr
+#define Elf_Sym			Elf32_Sym
+#define Elf_Ehdr		Elf32_Ehdr
+x #define module_map(x)		vmalloc(x)
 #define module_unmap(x)		vfree(x)
 #define module_arch_init(x)	(0)
diff -Nru a/include/asm-sh64/pgtable.h b/include/asm-sh64/pgtable.h
--- a/include/asm-sh64/pgtable.h	2004-12-22 01:36:07 -08:00
+++ b/include/asm-sh64/pgtable.h	2005-03-07 20:41:28 -08:00
@@ -136,6 +136,7 @@
 	 */x 	*(xp) = (x & NPHYS_SIGN) ? (x | NPHYS_MASK) : x;
 }
+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)x x static __inline__ void pmd_set(pmd_t *pmdp,pte_t *ptep)
 {
@@ -280,8 +281,6 @@
 
 /* Mask which drops software flags */x #define _PAGE_FLAGS_HARDWARE_MASK	0xfffffffffffff3dbLL
-/* Flags default: 4KB, Read, Not write, Not execute, Not user */x-#define _PAGE_FLAGS_HARDWARE_DEFAULT	0x0000000000000040LL
 
 /*
  * HugeTLB support
@@ -383,7 +382,7 @@
  */x #define _PTE_EMPTY	0x0
 #define pte_present(x)	(pte_val(x) & _PAGE_PRESENT)
-#define pte_clear(xp)	(set_pte(xp, __pte(_PTE_EMPTY)))
+#define pte_clear(mm,addr,xp)	(set_pte_at(mm, addr, xp, __pte(_PTE_EMPTY)))
 #define pte_none(x)	(pte_val(x) == _PTE_EMPTY)
 
 /*
diff -Nru a/include/asm-sh64/system.h b/include/asm-sh64/system.h
--- a/include/asm-sh64/system.h	2004-06-29 07:44:46 -07:00
+++ b/include/asm-sh64/system.h	2005-03-07 20:41:28 -08:00
@@ -15,7 +15,6 @@
  */x 
 #include <linux/config.h>x-#include <linux/kernel.h>x #include <asm/registers.h>x #include <asm/processor.h>
 
@@ -190,5 +189,7 @@
 #endif	/* CONFIG_SH_ALPHANUMERIC */x x #define PL() printk("@ <%s,%s:%d>\n",__FILE__,__FUNCTION__,__LINE__)
+
+#define arch_align_stack(x) (x)
 x #endif /* __ASM_SH64_SYSTEM_H */xdiff -Nru a/include/asm-sh64/thread_info.h b/include/asm-sh64/thread_info.h
--- a/include/asm-sh64/thread_info.h	2005-01-30 22:20:14 -08:00
+++ b/include/asm-sh64/thread_info.h	2005-03-07 20:41:28 -08:00
@@ -61,13 +61,18 @@
 }
 
 /* thread information allocation */x-#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,2))
+
+
+
+#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
 #define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
 #define get_thread_info(ti) get_task_struct((ti)->task)
 #define put_thread_info(ti) put_task_struct((ti)->task)
 x #endif /* __ASSEMBLY__ */x 
+#define THREAD_SIZE  8192
+x #define PREEMPT_ACTIVE		0x4000000
 x /* thread information flags */x@@ -76,7 +81,6 @@
 #define TIF_NEED_RESCHED	3	/* rescheduling necessary */
 #define TIF_MEMDIE		4x 
-#define THREAD_SIZE	16384
 x #endif /* __KERNEL__ */x 
diff -Nru a/include/asm-sh64/uaccess.h b/include/asm-sh64/uaccess.h
--- a/include/asm-sh64/uaccess.h	2004-08-26 23:31:37 -07:00
+++ b/include/asm-sh64/uaccess.h	2005-03-07 20:41:26 -08:00
@@ -313,6 +313,12 @@
    sh64 at the moment). */
 #define ARCH_KMALLOC_MINALIGN 8
 
+/*
+ * We want 8-byte alignment for the slab caches as well, otherwise we have
+ * the same BYTES_PER_WORD (sizeof(void *)) min align in kmem_cache_create().
+ */
+#define ARCH_SLAB_MINALIGN 8
+
 /* Returns 0 if exception not found and fixup.unit otherwise.  */x extern unsigned long search_exception_table(unsigned long addr);
 extern const struct exception_table_entry *search_exception_tables (unsigned long addr);
diff -Nru a/include/asm-sh64/unistd.h b/include/asm-sh64/unistd.h
--- a/include/asm-sh64/unistd.h	2004-06-29 07:44:46 -07:00
+++ b/include/asm-sh64/unistd.h	2005-03-07 20:41:28 -08:00
@@ -333,8 +333,13 @@
 #define __NR_mq_timedreceive    (__NR_mq_open+3)
 #define __NR_mq_notify          (__NR_mq_open+4)
 #define __NR_mq_getsetattr      (__NR_mq_open+5)
+#define __NR_sys_kexec_load	311
+#define __NR_waitid		312
+#define __NR_add_key		313
+#define __NR_request_key	314
+#define __NR_keyctl		315x 
-#define NR_syscalls 311
+#define NR_syscalls 316
 x /* user-visible error numbers are in the range -1 - -125: see <asm-sh64/errno.h> */x 
diff -Nru a/include/asm-sparc/cacheflush.h b/include/asm-sparc/cacheflush.h
--- a/include/asm-sparc/cacheflush.h	2004-09-17 07:57:49 -07:00
+++ b/include/asm-sparc/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -50,21 +50,21 @@
 #define flush_cache_all() BTFIXUP_CALL(flush_cache_all)()
 #define flush_cache_mm(mm) BTFIXUP_CALL(flush_cache_mm)(mm)
 #define flush_cache_range(vma,start,end) BTFIXUP_CALL(flush_cache_range)(vma,start,end)
-#define flush_cache_page(vma,addr) BTFIXUP_CALL(flush_cache_page)(vma,addr)
+#define flush_cache_page(vma,addr,pfn) BTFIXUP_CALL(flush_cache_page)(vma,addr)
 #define flush_icache_range(start, end)		do { } while (0)
 #define flush_icache_page(vma, pg)		do { } while (0)
 
 #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
 
 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
-	do {					\
-		flush_cache_page(vma, vaddr);	\
-		memcpy(dst, src, len);		\
+	do {							\
+		flush_cache_page(vma, vaddr, page_to_pfn(page));\
+		memcpy(dst, src, len);				\
 	} while (0)
 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
-	do {					\
-		flush_cache_page(vma, vaddr);	\
-		memcpy(dst, src, len);		\
+	do {							\
+		flush_cache_page(vma, vaddr, page_to_pfn(page));\
+		memcpy(dst, src, len);				\
 	} while (0)
 
 BTFIXUPDEF_CALL(void, __flush_page_to_ram, unsigned long)
diff -Nru a/include/asm-sparc/mostek.h b/include/asm-sparc/mostek.h
--- a/include/asm-sparc/mostek.h	2004-12-08 20:21:53 -08:00
+++ b/include/asm-sparc/mostek.h	2005-03-07 20:22:16 -08:00
@@ -128,7 +128,6 @@
 	char offset[6*1024];         /* Magic things may be here, who knows? */x 	struct mostek48t02 regs;     /* Here is what we are interested in.   */x };
-extern struct mostek48t08 *mstk48t08_regs;
 x extern enum sparc_clock_type sp_clock_typ;x 
diff -Nru a/include/asm-sparc/pgtable.h b/include/asm-sparc/pgtable.h
--- a/include/asm-sparc/pgtable.h	2005-01-30 11:22:18 -08:00
+++ b/include/asm-sparc/pgtable.h	2005-02-23 15:40:53 -08:00
@@ -157,7 +157,7 @@
 }
 
 #define pte_present(pte) BTFIXUP_CALL(pte_present)(pte)
-#define pte_clear(pte) BTFIXUP_CALL(pte_clear)(pte)
+#define pte_clear(mm,addr,pte) BTFIXUP_CALL(pte_clear)(pte)
 
 BTFIXUPDEF_CALL_CONST(int, pmd_bad, pmd_t)
 BTFIXUPDEF_CALL_CONST(int, pmd_present, pmd_t)
@@ -339,6 +339,7 @@
 BTFIXUPDEF_CALL(void, set_pte, pte_t *, pte_t)
 
 #define set_pte(ptep,pteval) BTFIXUP_CALL(set_pte)(ptep,pteval)x+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)x x struct seq_file;
 BTFIXUPDEF_CALL(void, mmu_info, struct seq_file *)
diff -Nru a/include/asm-sparc/resource.h b/include/asm-sparc/resource.h
--- a/include/asm-sparc/resource.h	2005-01-20 21:00:50 -08:00
+++ b/include/asm-sparc/resource.h	2005-03-07 20:41:39 -08:00
@@ -8,32 +8,18 @@
 #define _SPARC_RESOURCE_H
 x /*
- * Resource limits
+ * These two resource limit IDs have a Sparc/Linux-specific ordering,
+ * the rest comes from the generic header:
  */x-
-#define RLIMIT_CPU	0		/* CPU time in ms */x-#define RLIMIT_FSIZE	1		/* Maximum filesize */x-#define RLIMIT_DATA	2		/* max data size */x-#define RLIMIT_STACK	3		/* max stack size */x-#define RLIMIT_CORE	4		/* max core file size */x-#define RLIMIT_RSS	5		/* max resident set size */x-#define RLIMIT_NOFILE	6		/* max number of open files */x-#define RLIMIT_NPROC	7		/* max number of processes */x-#define RLIMIT_MEMLOCK	8		/* max locked-in-memory address space */x-#define RLIMIT_AS	9		/* address space limit */x-#define RLIMIT_LOCKS	10		/* maximum file locks held */x-#define RLIMIT_SIGPENDING 11		/* max number of pending signals */x-#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */x-
-#define RLIM_NLIMITS	13x-#define __ARCH_RLIMIT_ORDERx+#define RLIMIT_NOFILE		6	/* max number of open files */x+#define RLIMIT_NPROC		7	/* max number of processes */x 
 /*
  * SuS says limits have to be unsigned.
  * We make this unsigned, but keep the
- * old value.
+ * old value for compatibility:
  */x-#define RLIM_INFINITY	0x7fffffffx+#define RLIM_INFINITY		0x7fffffffx 
 #include <asm-generic/resource.h>x 
diff -Nru a/include/asm-sparc/system.h b/include/asm-sparc/system.h
--- a/include/asm-sparc/system.h	2005-02-10 18:59:55 -08:00
+++ b/include/asm-sparc/system.h	2005-03-04 22:41:13 -08:00
@@ -257,4 +257,6 @@
 
 #endif /* __ASSEMBLY__ */x 
+#define arch_align_stack(x) (x)
+x #endif /* !(__SPARC_SYSTEM_H) */xdiff -Nru a/include/asm-sparc64/cacheflush.h b/include/asm-sparc64/cacheflush.h
--- a/include/asm-sparc64/cacheflush.h	2004-09-17 07:58:35 -07:00
+++ b/include/asm-sparc64/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -11,7 +11,7 @@
 	do { if ((__mm) == current->mm) flushw_user(); } while(0)
 #define flush_cache_range(vma, start, end) \
 	flush_cache_mm((vma)->vm_mm)
-#define flush_cache_page(vma, page) \
+#define flush_cache_page(vma, page, pfn) \
 	flush_cache_mm((vma)->vm_mm)
 x /* 
@@ -38,15 +38,15 @@
 #define flush_icache_user_range(vma,pg,adr,len)	do { } while (0)
 
 #define copy_to_user_page(vma, page, vaddr, dst, src, len) \
-	do {					\
-		flush_cache_page(vma, vaddr);	\
-		memcpy(dst, src, len);		\
+	do {							\
+		flush_cache_page(vma, vaddr, page_to_pfn(page));\
+		memcpy(dst, src, len);				\
 	} while (0)
 
 #define copy_from_user_page(vma, page, vaddr, dst, src, len) \
-	do {					\
-		flush_cache_page(vma, vaddr);	\
-		memcpy(dst, src, len);		\
+	do {							\
+		flush_cache_page(vma, vaddr, page_to_pfn(page));\
+		memcpy(dst, src, len);				\
 	} while (0)
 
 extern void flush_dcache_page(struct page *page);xdiff -Nru a/include/asm-sparc64/mostek.h b/include/asm-sparc64/mostek.h
--- a/include/asm-sparc64/mostek.h	2002-02-04 23:35:52 -08:00
+++ b/include/asm-sparc64/mostek.h	2005-03-07 20:22:16 -08:00
@@ -134,13 +134,11 @@
  */x #define MOSTEK_48T08_OFFSET	0x0000UL	/* Lower NVRAM portions */x #define MOSTEK_48T08_48T02	0x1800UL	/* Offset to 48T02 chip */x-extern unsigned long mstk48t08_regs;
 x /* SUN5 systems usually have 48t59 model clock chipsets.  But we keep the older
  * clock chip definitions around just in case.
  */x #define MOSTEK_48T59_OFFSET	0x0000UL	/* Lower NVRAM portions */x #define MOSTEK_48T59_48T02	0x1800UL	/* Offset to 48T02 chip */x-extern unsigned long mstk48t59_regs;
 x #endif /* !(_SPARC64_MOSTEK_H) */xdiff -Nru a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
--- a/include/asm-sparc64/pci.h	2004-10-31 18:27:13 -08:00
+++ b/include/asm-sparc64/pci.h	2005-02-07 12:52:02 -08:00
@@ -223,7 +223,10 @@
 /* Return the index of the PCI controller for device PDEV. */x 
 extern int pci_domain_nr(struct pci_bus *bus);
-extern int pci_name_bus(char *name, struct pci_bus *bus);
+static inline int pci_proc_domain(struct pci_bus *bus)
+{
+	return 1;
+}
 x /* Platform support for /proc/bus/pci/X/Y mmap()s. */x 
diff -Nru a/include/asm-sparc64/pgalloc.h b/include/asm-sparc64/pgalloc.h
--- a/include/asm-sparc64/pgalloc.h	2005-01-25 20:34:29 -08:00
+++ b/include/asm-sparc64/pgalloc.h	2005-02-23 17:45:37 -08:00
@@ -191,25 +191,17 @@
 
 static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address)
 {
-	pte_t *pte = __pte_alloc_one_kernel(mm, address);
-	if (pte) {
-		struct page *page = virt_to_page(pte);
-		page->mapping = (void *) mm;
-		page->index = address & PMD_MASK;
-	}
-	return pte;
+	return __pte_alloc_one_kernel(mm, address);
 }
 
 static inline struct page *
 pte_alloc_one(struct mm_struct *mm, unsigned long addr)
 {
 	pte_t *pte = __pte_alloc_one_kernel(mm, addr);
-	if (pte) {
-		struct page *page = virt_to_page(pte);
-		page->mapping = (void *) mm;
-		page->index = addr & PMD_MASK;
-		return page;
-	}
+
+	if (pte)
+		return virt_to_page(pte);
+x 	return NULL;
 }
 
@@ -246,13 +238,11 @@
 
 static inline void pte_free_kernel(pte_t *pte)
 {
-	virt_to_page(pte)->mapping = NULL;
 	free_pte_fast(pte);
 }
 
 static inline void pte_free(struct page *ptepage)
 {
-	ptepage->mapping = NULL;
 	free_pte_fast(page_address(ptepage));
 }
 
diff -Nru a/include/asm-sparc64/pgtable.h b/include/asm-sparc64/pgtable.h
--- a/include/asm-sparc64/pgtable.h	2005-02-05 14:53:05 -08:00
+++ b/include/asm-sparc64/pgtable.h	2005-02-27 11:33:59 -08:00
@@ -15,6 +15,7 @@
 #include <asm-generic/pgtable-nopud.h>
 
 #include <linux/config.h>x+#include <linux/compiler.h>x #include <asm/spitfire.h>x #include <asm/asi.h>x #include <asm/system.h>x@@ -333,18 +334,23 @@
 #define pte_unmap_nested(pte)		do { } while (0)
 
 /* Actual page table PTE updates.  */x-extern void tlb_batch_add(pte_t *ptep, pte_t orig);
+extern void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, pte_t *ptep, pte_t orig);
 x-static inline void set_pte(pte_t *ptep, pte_t pte)
+static inline void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep, pte_t pte)
 {
 	pte_t orig = *ptep;
 x 	*ptep = pte;
-	if (pte_present(orig))
-		tlb_batch_add(ptep, orig);
+
+	/* It is more efficient to let flush_tlb_kernel_range()
+	 * handle init_mm tlb flushes.
+	 */x+	if (likely(mm != &init_mm) && (pte_val(orig) & _PAGE_VALID))
+		tlb_batch_add(mm, addr, ptep, orig);
 }
 x-#define pte_clear(ptep)		set_pte((ptep), __pte(0UL))
+#define pte_clear(mm,addr,ptep)		\
+	set_pte_at((mm), (addr), (ptep), __pte(0UL))
 
 extern pgd_t swapper_pg_dir[1];
 
diff -Nru a/include/asm-sparc64/resource.h b/include/asm-sparc64/resource.h
--- a/include/asm-sparc64/resource.h	2005-01-20 21:00:50 -08:00
+++ b/include/asm-sparc64/resource.h	2005-03-07 20:41:39 -08:00
@@ -8,25 +8,11 @@
 #define _SPARC64_RESOURCE_H
 x /*
- * Resource limits
+ * These two resource limit IDs have a Sparc/Linux-specific ordering,
+ * the rest comes from the generic header:
  */x-
-#define RLIMIT_CPU	0		/* CPU time in ms */x-#define RLIMIT_FSIZE	1		/* Maximum filesize */x-#define RLIMIT_DATA	2		/* max data size */x-#define RLIMIT_STACK	3		/* max stack size */x-#define RLIMIT_CORE	4		/* max core file size */x-#define RLIMIT_RSS	5		/* max resident set size */x-#define RLIMIT_NOFILE	6		/* max number of open files */x-#define RLIMIT_NPROC	7		/* max number of processes */x-#define RLIMIT_MEMLOCK	8		/* max locked-in-memory address space */x-#define RLIMIT_AS	9		/* address space limit */x-#define RLIMIT_LOCKS	10		/* maximum file locks held */x-#define RLIMIT_SIGPENDING 11		/* max number of pending signals */x-#define RLIMIT_MSGQUEUE 12		/* maximum bytes in POSIX mqueues */x-
-#define RLIM_NLIMITS	13x-#define __ARCH_RLIMIT_ORDERx+#define RLIMIT_NOFILE		6	/* max number of open files */x+#define RLIMIT_NPROC		7	/* max number of processes */x 
 #include <asm-generic/resource.h>x 
diff -Nru a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
--- a/include/asm-sparc64/smp.h	2004-02-24 16:13:40 -08:00
+++ b/include/asm-sparc64/smp.h	2005-03-07 20:34:44 -08:00
@@ -30,8 +30,6 @@
 #include <asm/bitops.h>x #include <asm/atomic.h>
 
-extern unsigned char boot_cpu_id;
-
 extern cpumask_t phys_cpu_present_map;
 #define cpu_possible_map phys_cpu_present_mapx 
diff -Nru a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
--- a/include/asm-sparc64/system.h	2005-02-06 20:43:13 -08:00
+++ b/include/asm-sparc64/system.h	2005-03-04 22:41:13 -08:00
@@ -341,4 +341,6 @@
 
 #endif /* !(__ASSEMBLY__) */x 
+#define arch_align_stack(x) (x)
+x #endif /* !(__SPARC64_SYSTEM_H) */xdiff -Nru a/include/asm-sparc64/uaccess.h b/include/asm-sparc64/uaccess.h
--- a/include/asm-sparc64/uaccess.h	2005-02-16 15:35:57 -08:00
+++ b/include/asm-sparc64/uaccess.h	2005-03-07 21:20:28 -08:00
@@ -49,10 +49,15 @@
 	__asm__ __volatile__ ("wr %%g0, %0, %%asi" : : "r" ((val).seg));	\
 } while(0)
 x-#define __user_ok(addr,size) ((void)(addr), (void)(size), 1)
-#define __kernel_ok (segment_eq(get_fs(), KERNEL_DS))
-#define __access_ok(addr,size) ((void)(addr), (void)(size), 1)
-#define access_ok(type,addr,size) ((void)(type), (void)(addr), (void)(size), 1)
+static inline int __access_ok(const void __user * addr, unsigned long size)
+{
+	return 1;
+}
+
+static inline int access_ok(int type, const void __user * addr, unsigned long size)
+{
+	return 1;
+}
 
 static inline int verify_area(int type, const void __user * addr, unsigned long size)
 {
diff -Nru a/include/asm-um/pgtable-2level.h b/include/asm-um/pgtable-2level.h
--- a/include/asm-um/pgtable-2level.h	2005-01-11 16:42:49 -08:00
+++ b/include/asm-um/pgtable-2level.h	2005-02-23 15:40:53 -08:00
@@ -59,6 +59,7 @@
 	*pteptr = pte_mknewpage(pteval);
 	if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr);
 }
+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)x x #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))x 
diff -Nru a/include/asm-um/pgtable-3level.h b/include/asm-um/pgtable-3level.h
--- a/include/asm-um/pgtable-3level.h	2005-01-11 16:42:49 -08:00
+++ b/include/asm-um/pgtable-3level.h	2005-02-23 15:40:53 -08:00
@@ -84,6 +84,7 @@
 	*pteptr = pte_mknewpage(*pteptr);
 	if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr);
 }
+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)x x #define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval))x 
diff -Nru a/include/asm-um/pgtable.h b/include/asm-um/pgtable.h
--- a/include/asm-um/pgtable.h	2005-02-03 10:06:13 -08:00
+++ b/include/asm-um/pgtable.h	2005-02-23 15:40:53 -08:00
@@ -142,7 +142,7 @@
 #define PAGE_PTR(address) \
 ((unsigned long)(address)>>(PAGE_SHIFT-SIZEOF_PTR_LOG2)&PTR_MASK&~PAGE_MASK)
 x-#define pte_clear(xp) pte_set_val(*(xp), (phys_t) 0, __pgprot(_PAGE_NEWPAGE))
+#define pte_clear(mm,addr,xp) pte_set_val(*(xp), (phys_t) 0, __pgprot(_PAGE_NEWPAGE))
 
 #define pmd_none(x)	(!(pmd_val(x) & ~_PAGE_NEWPAGE))
 #define	pmd_bad(x)	((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER)) != _KERNPG_TABLE)
diff -Nru a/include/asm-v850/cacheflush.h b/include/asm-v850/cacheflush.h
--- a/include/asm-v850/cacheflush.h	2004-05-22 14:56:28 -07:00
+++ b/include/asm-v850/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -25,7 +25,7 @@
 #define flush_cache_all()			((void)0)
 #define flush_cache_mm(mm)			((void)0)
 #define flush_cache_range(vma, start, end)	((void)0)
-#define flush_cache_page(vma, vmaddr)		((void)0)
+#define flush_cache_page(vma, vmaddr, pfn)	((void)0)
 #define flush_dcache_page(page)			((void)0)
 #define flush_dcache_mmap_lock(mapping)		((void)0)
 #define flush_dcache_mmap_unlock(mapping)	((void)0)
diff -Nru a/include/asm-v850/system.h b/include/asm-v850/system.h
--- a/include/asm-v850/system.h	2003-07-15 03:06:37 -07:00
+++ b/include/asm-v850/system.h	2005-03-04 22:41:13 -08:00
@@ -108,4 +108,6 @@
 	return tmp;
 }
 x+#define arch_align_stack(x) (x)
+x #endif /* __V850_SYSTEM_H__ */xdiff -Nru a/include/asm-x86_64/cacheflush.h b/include/asm-x86_64/cacheflush.h
--- a/include/asm-x86_64/cacheflush.h	2005-01-03 15:49:24 -08:00
+++ b/include/asm-x86_64/cacheflush.h	2005-02-25 16:35:20 -08:00
@@ -8,7 +8,7 @@
 #define flush_cache_all()			do { } while (0)
 #define flush_cache_mm(mm)			do { } while (0)
 #define flush_cache_range(vma, start, end)	do { } while (0)
-#define flush_cache_page(vma, vmaddr)		do { } while (0)
+#define flush_cache_page(vma, vmaddr, pfn)	do { } while (0)
 #define flush_dcache_page(page)			do { } while (0)
 #define flush_dcache_mmap_lock(mapping)		do { } while (0)
 #define flush_dcache_mmap_unlock(mapping)	do { } while (0)
diff -Nru a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h
--- a/include/asm-x86_64/pgtable.h	2005-02-10 12:33:18 -08:00
+++ b/include/asm-x86_64/pgtable.h	2005-03-07 20:41:20 -08:00
@@ -73,6 +73,7 @@
 {
 	pte_val(*dst) = pte_val(val);
 } 
+#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)x x static inline void set_pmd(pmd_t *dst, pmd_t val)x {
@@ -102,7 +103,7 @@
 #define pud_page(pud) \
 ((unsigned long) __va(pud_val(pud) & PHYSICAL_PAGE_MASK))
 x-#define ptep_get_and_clear(xp)	__pte(xchg(&(xp)->pte, 0))
+#define ptep_get_and_clear(mm,addr,xp)	__pte(xchg(&(xp)->pte, 0))
 #define pte_same(a, b)		((a).pte == (b).pte)
 
 #define PMD_SIZE	(1UL << PMD_SHIFT)
@@ -224,7 +225,7 @@
 
 #define pte_none(x)	(!pte_val(x))
 #define pte_present(x)	(pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE))
-#define pte_clear(xp)	do { set_pte(xp, __pte(0)); } while (0)
+#define pte_clear(mm,addr,xp)	do { set_pte_at(mm, addr, xp, __pte(0)); } while (0)
 
 #define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))	/* FIXME: is this
 						   right? */x@@ -263,22 +264,26 @@
 extern inline pte_t pte_mkyoung(pte_t pte)	{ set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
 extern inline pte_t pte_mkwrite(pte_t pte)	{ set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; }
 x-static inline int ptep_test_and_clear_dirty(pte_t *ptep)
+struct vm_area_struct;
+
+static inline int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 	if (!pte_dirty(*ptep))
 		return 0;
 	return test_and_clear_bit(_PAGE_BIT_DIRTY, ptep);
 }
 x-static inline int ptep_test_and_clear_young(pte_t *ptep)
+static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep)
 {
 	if (!pte_young(*ptep))
 		return 0;
 	return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep);
 }
 x-static inline void ptep_set_wrprotect(pte_t *ptep)		{ clear_bit(_PAGE_BIT_RW, ptep); }
-static inline void ptep_mkdirty(pte_t *ptep)			{ set_bit(_PAGE_BIT_DIRTY, ptep); }
+static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
+{
+	clear_bit(_PAGE_BIT_RW, ptep);
+}
 x /*
  * Macro to mark a page protection value as "uncacheable".
@@ -419,7 +424,6 @@
 #define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY
 #define __HAVE_ARCH_PTEP_GET_AND_CLEAR
 #define __HAVE_ARCH_PTEP_SET_WRPROTECT
-#define __HAVE_ARCH_PTEP_MKDIRTY
 #define __HAVE_ARCH_PTE_SAME
 #include <asm-generic/pgtable.h>x 
diff -Nru a/include/asm-x86_64/system.h b/include/asm-x86_64/system.h
--- a/include/asm-x86_64/system.h	2005-02-07 18:25:11 -08:00
+++ b/include/asm-x86_64/system.h	2005-03-04 22:41:13 -08:00
@@ -338,4 +338,6 @@
 #define HAVE_EAT_KEY
 void eat_key(void);
 
+extern unsigned long arch_align_stack(unsigned long sp);
+x #endif
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	2005-01-30 22:20:14 -08:00
+++ b/include/asm-x86_64/thread_info.h	2005-03-07 20:41:40 -08:00
@@ -102,6 +102,7 @@
 #define TIF_SINGLESTEP		4	/* reenable singlestep on user return*/
 #define TIF_IRET		5	/* force IRET */
 #define TIF_SYSCALL_AUDIT	7	/* syscall auditing active */x+#define TIF_SECCOMP		8	/* secure computing */
 #define TIF_POLLING_NRFLAG	16	/* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_IA32		17	/* 32bit process */ 
 #define TIF_FORK		18	/* ret_from_fork */x@@ -115,6 +116,7 @@
 #define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
 #define _TIF_IRET		(1<<TIF_IRET)
 #define _TIF_SYSCALL_AUDIT	(1<<TIF_SYSCALL_AUDIT)
+#define _TIF_SECCOMP		(1<<TIF_SECCOMP)
 #define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
 #define _TIF_IA32		(1<<TIF_IA32)
 #define _TIF_FORK		(1<<TIF_FORK)
@@ -122,9 +124,9 @@
 
 /* work to do on interrupt/exception return */x #define _TIF_WORK_MASK \x-  (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP))
+  (0x0000FFFF & ~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP|_TIF_SECCOMP))
 /* work to do on any return to user space */x-#define _TIF_ALLWORK_MASK 0x0000FFFF	
+#define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP)
 x #define PREEMPT_ACTIVE     0x10000000
 xdiff -Nru a/include/asm-x86_64/uaccess.h b/include/asm-x86_64/uaccess.h
--- a/include/asm-x86_64/uaccess.h	2005-02-02 02:00:56 -08:00
+++ b/include/asm-x86_64/uaccess.h	2005-03-07 20:41:46 -08:00
@@ -73,6 +73,7 @@
 	unsigned long insn, fixup;x };
 
+#define ARCH_HAS_SEARCH_EXTABLE
 x /*
  * These are the main single-value transfer routines.  They automaticallyxdiff -Nru a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h
--- a/include/linux/ac97_codec.h	2005-01-30 22:33:41 -08:00
+++ b/include/linux/ac97_codec.h	2005-03-07 20:41:36 -08:00
@@ -323,6 +323,7 @@
 	
 #define AC97_DELUDED_MODEM	1	/* Audio codec reports its a modem */
 #define AC97_NO_PCM_VOLUME	2	/* Volume control is missing 	   */x+#define AC97_DEFAULT_POWER_OFF 4 /* Needs warm reset to power up */x };
 
 extern int ac97_read_proc (char *page_out, char **start, off_t off,xdiff -Nru a/include/linux/acct.h b/include/linux/acct.h
--- a/include/linux/acct.h	2005-01-04 18:48:11 -08:00
+++ b/include/linux/acct.h	2005-03-04 22:41:14 -08:00
@@ -120,12 +120,12 @@
 struct super_block;
 extern void acct_auto_close(struct super_block *sb);
 extern void acct_process(long exitcode);
-extern void acct_update_integrals(void);
+extern void acct_update_integrals(struct task_struct *tsk);
 extern void acct_clear_integrals(struct task_struct *tsk);
 #elsex #define acct_auto_close(x)	do { } while (0)
 #define acct_process(x)		do { } while (0)
-#define acct_update_integrals()		do { } while (0)
+#define acct_update_integrals(x)		do { } while (0)
 #define acct_clear_integrals(task)	do { } while (0)
 #endif
 xdiff -Nru a/include/linux/agp_backend.h b/include/linux/agp_backend.h
--- a/include/linux/agp_backend.h	2005-02-23 10:33:04 -08:00
+++ b/include/linux/agp_backend.h	2005-03-06 16:59:19 -08:00
@@ -1,6 +1,7 @@
 /*
  * AGPGART backend specific includes. Not for userspace consumption.
  *
+ * Copyright (C) 2004 Silicon Graphics, Inc.
  * Copyright (C) 2002-2003 Dave Jones
  * Copyright (C) 1999 Jeff Hartmann
  * Copyright (C) 1999 Precision Insight, Inc.
@@ -63,21 +64,24 @@
 	struct vm_operations_struct *vm_ops;x };
 
-/* 
+/*
  * The agp_memory structure has information about the block of agp memory
  * allocated.  A caller may manipulate the next and prev pointers to link
  * each allocated item into a list.  These pointers are ignored by the backend.
  * Everything else should never be written to, but the caller may read any of
- * the items to detrimine the status of this block of agp memory. 
+ * the items to determine the status of this block of agp memory.
  */x 
+struct agp_bridge_data;
+x struct agp_memory {
-	int key;
 	struct agp_memory *next;
 	struct agp_memory *prev;
+	struct agp_bridge_data *bridge;
+	unsigned long *memory;
 	size_t page_count;
+	int key;
 	int num_scratch_pages;
-	unsigned long *memory;
 	off_t pg_start;
 	u32 type;
 	u32 physical;
@@ -87,14 +91,19 @@
 
 #define AGP_NORMAL_MEMORY 0
 
+extern struct agp_bridge_data *agp_bridge;
+extern struct list_head agp_bridges;
+
+extern struct agp_bridge_data *(*agp_find_bridge)(struct pci_dev *);
+x extern void agp_free_memory(struct agp_memory *);
-extern struct agp_memory *agp_allocate_memory(size_t, u32);
-extern int agp_copy_info(struct agp_kern_info *);
+extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, u32);
+extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *);
 extern int agp_bind_memory(struct agp_memory *, off_t);
 extern int agp_unbind_memory(struct agp_memory *);
-extern void agp_enable(u32);
-extern int agp_backend_acquire(void);
-extern void agp_backend_release(void);
+extern void agp_enable(struct agp_bridge_data *, u32);
+extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
+extern void agp_backend_release(struct agp_bridge_data *);
 x #endif				/* __KERNEL__ */x #endif				/* _AGP_BACKEND_H */xdiff -Nru a/include/linux/atalk.h b/include/linux/atalk.h
--- a/include/linux/atalk.h	2005-01-26 23:10:27 -08:00
+++ b/include/linux/atalk.h	2005-03-07 09:33:17 -08:00
@@ -1,5 +1,8 @@
 #ifndef __LINUX_ATALK_H__
 #define __LINUX_ATALK_H__
+x+#include <net/sock.h>x+
 /*
  * AppleTalk networking structures
  *
@@ -63,6 +66,8 @@
 };
 	x struct atalk_sock {
+	/* struct sock has to be the first member of atalk_sock */x+	struct sock	sk;
 	unsigned short	dest_net;
 	unsigned short	src_net;
 	unsigned char	dest_node;
@@ -71,6 +76,11 @@
 	unsigned char	src_port;x };
 
+static inline struct atalk_sock *at_sk(struct sock *sk)
+{
+	return (struct atalk_sock *)sk;
+}
+
 #ifdef __KERNEL__x 
 #include <asm/byteorder.h>x@@ -196,8 +206,6 @@
 					   struct atalk_addr *sa);
 
 extern void		aarp_cleanup_module(void);
-
-#define at_sk(__sk) ((struct atalk_sock *)(__sk)->sk_protinfo)
 
 extern struct hlist_head atalk_sockets;
 extern rwlock_t atalk_sockets_lock;
diff -Nru a/include/linux/atmdev.h b/include/linux/atmdev.h
--- a/include/linux/atmdev.h	2005-01-18 13:01:14 -08:00
+++ b/include/linux/atmdev.h	2005-01-20 18:17:39 -08:00
@@ -30,9 +30,6 @@
 #define ATM_DS3_PCR	(8000*12)
 			/* DS3: 12 cells in a 125 usec time slot */x x-#define atm_sk(__sk) ((struct atm_vcc *)(__sk)->sk_protinfo)
-#define ATM_SD(s)	(atm_sk((s)->sk))
-
 
 #define __AAL_STAT_ITEMS \
     __HANDLE_ITEM(tx);			/* TX okay */ \
@@ -281,6 +278,8 @@
 #define ATM_ATMOPT_CLP	1	/* set CLP bit */x x struct atm_vcc {
+	/* struct sock has to be the first member of atm_vcc */x+	struct sock	sk;
 	unsigned long	flags;		/* VCC flags (ATM_VF_*) */x 	short		vpi;		/* VPI and VCI (types must be equal */x 					/* with sockaddr) */x@@ -297,7 +296,6 @@
 	void		*dev_data;	/* per-device data */
 	void		*proto_data;	/* per-protocol data */
 	struct k_atm_aal_stats *stats;	/* pointer to AAL stats group */x-	struct sock	*sk;		/* socket backpointer */
 	/* SVC part --- may move later ------------------------------------- */x 	short		itf;		/* interface number */
 	struct sockaddr_atmsvc local;
@@ -310,6 +308,20 @@
 					/* by CLIP and sch_atm. */x };
 
+static inline struct atm_vcc *atm_sk(struct sock *sk)
+{
+	return (struct atm_vcc *)sk;
+}
+
+static inline struct atm_vcc *ATM_SD(struct socket *sock)
+{
+	return atm_sk(sock->sk);
+}
+
+static inline struct sock *sk_atm(struct atm_vcc *vcc)
+{
+	return (struct sock *)vcc;
+}
 
 struct atm_dev_addr {
 	struct sockaddr_atmsvc addr;	/* ATM address */x@@ -410,20 +422,20 @@
 x static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
 {
-	atomic_add(truesize, &vcc->sk->sk_rmem_alloc);
+	atomic_add(truesize, &sk_atm(vcc)->sk_rmem_alloc);
 }
 
 x static inline void atm_return(struct atm_vcc *vcc,int truesize)
 {
-	atomic_sub(truesize, &vcc->sk->sk_rmem_alloc);
+	atomic_sub(truesize, &sk_atm(vcc)->sk_rmem_alloc);
 }
 
 x static inline int atm_may_send(struct atm_vcc *vcc,unsigned int size)
 {
-	return (size + atomic_read(&vcc->sk->sk_wmem_alloc)) <
-	       vcc->sk->sk_sndbuf;
+	return (size + atomic_read(&sk_atm(vcc)->sk_wmem_alloc)) <
+	       sk_atm(vcc)->sk_sndbuf;
 }
 
 xdiff -Nru a/include/linux/bio.h b/include/linux/bio.h
--- a/include/linux/bio.h	2004-11-06 03:03:05 -08:00
+++ b/include/linux/bio.h	2005-03-07 20:41:39 -08:00
@@ -59,6 +59,7 @@
 	unsigned int	bv_offset;x };
 
+struct bio_set;x struct bio;x typedef int (bio_end_io_t) (struct bio *, unsigned int, int);x typedef void (bio_destructor_t) (struct bio *);
@@ -109,6 +110,7 @@
 	void			*bi_private;
 x 	bio_destructor_t	*bi_destructor;	/* destructor */x+	struct bio_set		*bi_set;	/* memory pools set */x };
 
 /*
@@ -258,7 +260,11 @@
 extern mempool_t *bio_split_pool;
 extern void bio_pair_release(struct bio_pair *dbio);
 
+extern struct bio_set *bioset_create(int, int, int);x+extern void bioset_free(struct bio_set *);
+x extern struct bio *bio_alloc(int, int);x+extern struct bio *bio_alloc_bioset(int, int, struct bio_set *);
 extern void bio_put(struct bio *);
 
 extern void bio_endio(struct bio *, unsigned int, int);x@@ -280,6 +286,7 @@
 extern void bio_check_pages_dirty(struct bio *bio);
 extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int);x extern int bio_uncopy_user(struct bio *);
+void zero_fill_bio(struct bio *bio);
 
 #ifdef CONFIG_HIGHMEM
 /*
diff -Nru a/include/linux/bitops.h b/include/linux/bitops.h
--- a/include/linux/bitops.h	2005-01-04 18:48:02 -08:00
+++ b/include/linux/bitops.h	2005-03-07 20:41:50 -08:00
@@ -134,4 +134,26 @@
 	return sizeof(w) == 4 ? generic_hweight32(w) : generic_hweight64(w);
 }
 x+/*
+ * rol32 - rotate a 32-bit value left
+ *
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u32 rol32(__u32 word, int shift)
+{
+	return (word << shift) | (word >> (32 - shift));
+}
+
+/*
+ * ror32 - rotate a 32-bit value right
+ *
+ * @word: value to rotate
+ * @shift: bits to roll
+ */
+static inline __u32 ror32(__u32 word, int shift)
+{
+	return (word >> shift) | (word << (32 - shift));
+}
+
 #endif
diff -Nru a/include/linux/blkdev.h b/include/linux/blkdev.h
--- a/include/linux/blkdev.h	2005-01-13 01:16:43 -08:00
+++ b/include/linux/blkdev.h	2005-03-09 00:03:24 -08:00
@@ -93,6 +93,9 @@
 void copy_io_context(struct io_context **pdst, struct io_context **psrc);
 void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
 
+struct request;
+typedef void (rq_end_io_fn)(struct request *);
+x struct request_list {
 	int count[2];
 	int starved[2];
@@ -176,6 +179,12 @@
 	 * For Power Management requests
 	 */x 	struct request_pm_state *pm;
+
+	/*
+	 * completion callback. end_io_data should be folded in with waiting
+	 */x+	rq_end_io_fn *end_io;
+	void *end_io_data;x };
 
 /*
@@ -210,6 +219,7 @@
 	__REQ_PM_SHUTDOWN,	/* shutdown request */
 	__REQ_BAR_PREFLUSH,	/* barrier pre-flush done */
 	__REQ_BAR_POSTFLUSH,	/* barrier post-flush */x+	__REQ_BAR_FLUSH,	/* rq is the flush request */
 	__REQ_NR_BITS,		/* stops here */x };
 
@@ -237,6 +247,7 @@
 #define REQ_PM_SHUTDOWN	(1 << __REQ_PM_SHUTDOWN)
 #define REQ_BAR_PREFLUSH	(1 << __REQ_BAR_PREFLUSH)
 #define REQ_BAR_POSTFLUSH	(1 << __REQ_BAR_POSTFLUSH)
+#define REQ_BAR_FLUSH	(1 << __REQ_BAR_FLUSH)
 
 /*
  * State information carried for REQ_PM_SUSPEND and REQ_PM_RESUMEx@@ -266,6 +277,8 @@
 typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *);
 typedef void (activity_fn) (void *data, int rw);x typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *);
+typedef int (prepare_flush_fn) (request_queue_t *, struct request *);
+typedef void (end_flush_fn) (request_queue_t *, struct request *);
 
 enum blk_queue_state {
 	Queue_down,
@@ -309,6 +322,8 @@
 	merge_bvec_fn		*merge_bvec_fn;
 	activity_fn		*activity_fn;
 	issue_flush_fn		*issue_flush_fn;
+	prepare_flush_fn	*prepare_flush_fn;
+	end_flush_fn		*end_flush_fn;
 x 	/*
 	 * Auto-unplugging state
@@ -380,6 +395,18 @@
 	unsigned int		sg_reserved_size;
 x 	struct list_head	drain_list;
+
+	/*
+	 * reserved for flush operations
+	 */x+	struct request		*flush_rq;
+	unsigned char		ordered;
+};
+
+enum {
+	QUEUE_ORDERED_NONE,
+	QUEUE_ORDERED_TAG,
+	QUEUE_ORDERED_FLUSH,x };
 
 #define RQ_INACTIVE		(-1)
@@ -396,12 +423,13 @@
 #define QUEUE_FLAG_DEAD		5	/* queue being torn down */
 #define QUEUE_FLAG_REENTER	6	/* Re-entrancy avoidance */
 #define QUEUE_FLAG_PLUGGED	7	/* queue is plugged */x-#define QUEUE_FLAG_ORDERED	8	/* supports ordered writes */x-#define QUEUE_FLAG_DRAIN	9	/* draining queue for sched switch */x+#define QUEUE_FLAG_DRAIN	8	/* draining queue for sched switch */x+#define QUEUE_FLAG_FLUSH	9	/* doing barrier flush sequence */
 
 #define blk_queue_plugged(q)	test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
 #define blk_queue_tagged(q)	test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
 #define blk_queue_stopped(q)	test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
+#define blk_queue_flushing(q)	test_bit(QUEUE_FLAG_FLUSH, &(q)->queue_flags)
 
 #define blk_fs_request(rq)	((rq)->flags & REQ_CMD)
 #define blk_pc_request(rq)	((rq)->flags & REQ_BLOCK_PC)
@@ -509,10 +537,10 @@
 extern void register_disk(struct gendisk *dev);
 extern void generic_make_request(struct bio *bio);
 extern void blk_put_request(struct request *);
+extern void blk_end_sync_rq(struct request *rq);
 extern void blk_attempt_remerge(request_queue_t *, struct request *);
 extern void __blk_attempt_remerge(request_queue_t *, struct request *);
 extern struct request *blk_get_request(request_queue_t *, int, int);x-extern void blk_put_request(struct request *);
 extern void blk_insert_request(request_queue_t *, struct request *, int, void *, int);x extern void blk_requeue_request(request_queue_t *, struct request *);
 extern void blk_plug_device(request_queue_t *);x@@ -602,6 +630,9 @@
 extern void blk_queue_ordered(request_queue_t *, int);
 extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *);
 extern int blkdev_scsi_issue_flush_fn(request_queue_t *, struct gendisk *, sector_t *);
+extern struct request *blk_start_pre_flush(request_queue_t *,struct request *);
+extern int blk_complete_barrier_rq(request_queue_t *, struct request *, int);
+extern int blk_complete_barrier_rq_locked(request_queue_t *, struct request *, int);
 
 extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *);
 extern void blk_dump_rq_flags(struct request *, char *);
diff -Nru a/include/linux/buffer_head.h b/include/linux/buffer_head.h
--- a/include/linux/buffer_head.h	2004-11-02 06:40:40 -08:00
+++ b/include/linux/buffer_head.h	2005-03-07 20:41:41 -08:00
@@ -203,6 +203,9 @@
 int nobh_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
 int nobh_commit_write(struct file *, struct page *, unsigned, unsigned);
 int nobh_truncate_page(struct address_space *, loff_t);
+int nobh_writepage(struct page *page, get_block_t *get_block,
+                        struct writeback_control *wbc);
+x 
 /*
  * inline definitions
diff -Nru a/include/linux/compat.h b/include/linux/compat.h
--- a/include/linux/compat.h	2005-02-22 01:32:18 -08:00
+++ b/include/linux/compat.h	2005-03-06 15:58:58 -08:00
@@ -83,6 +83,12 @@
 
 extern int put_compat_rusage(const struct rusage *, struct compat_rusage __user *);
 
+struct compat_siginfo;
+
+extern asmlinkage long compat_sys_waitid(int, compat_pid_t,
+		struct compat_siginfo __user *, int,
+		struct compat_rusage __user *);
+x struct compat_dirent {
 	u32		d_ino;x 	compat_off_t	d_off;
@@ -145,7 +151,6 @@
 		       unsigned long bitmap_size);x long compat_put_bitmap(compat_ulong_t __user *umask, unsigned long *mask,
 		       unsigned long bitmap_size);x-struct compat_siginfo;
 int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from);
 int copy_siginfo_to_user32(struct compat_siginfo __user *to, siginfo_t *from);
 #endif /* CONFIG_COMPAT */xdiff -Nru a/include/linux/compat_ioctl.h b/include/linux/compat_ioctl.h
--- a/include/linux/compat_ioctl.h	2005-01-20 20:55:57 -08:00
+++ b/include/linux/compat_ioctl.h	2005-03-08 16:26:50 -08:00
@@ -16,6 +16,7 @@
 COMPATIBLE_IOCTL(TCSETAW)
 COMPATIBLE_IOCTL(TCSETAF)
 COMPATIBLE_IOCTL(TCSBRK)
+ULONG_IOCTL(TCSBRKP)
 COMPATIBLE_IOCTL(TCXONC)
 COMPATIBLE_IOCTL(TCFLSH)
 COMPATIBLE_IOCTL(TCGETS)
@@ -692,6 +693,9 @@
 COMPATIBLE_IOCTL(USBDEVFS_CONNECTINFO)
 COMPATIBLE_IOCTL(USBDEVFS_HUB_PORTINFO)
 COMPATIBLE_IOCTL(USBDEVFS_RESET)
+COMPATIBLE_IOCTL(USBDEVFS_SUBMITURB32)
+COMPATIBLE_IOCTL(USBDEVFS_REAPURB32)
+COMPATIBLE_IOCTL(USBDEVFS_REAPURBNDELAY32)
 COMPATIBLE_IOCTL(USBDEVFS_CLEAR_HALT)
 /* MTD */
 COMPATIBLE_IOCTL(MEMGETINFO)
diff -Nru a/include/linux/compiler-gcc+.h b/include/linux/compiler-gcc+.h
--- a/include/linux/compiler-gcc+.h	2004-08-23 01:14:56 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,16 +0,0 @@
-/* Never include this file directly.  Include <linux/compiler.h> instead.  */x-
-/*
- * These definitions are for Ueber-GCC: always newer than the latest
- * version and hence sporting everything plus a kitchen-sink.
- */x-#include <linux/compiler-gcc.h>x-
-#define inline			inline		__attribute__((always_inline))
-#define __inline__		__inline__	__attribute__((always_inline))
-#define __inline		__inline	__attribute__((always_inline))
-#define __deprecated		__attribute__((deprecated))
-#define __attribute_used__	__attribute__((__used__))
-#define __attribute_pure__	__attribute__((pure))
-#define __attribute_const__	__attribute__((__const__))
-#define __must_check 		__attribute__((warn_unused_result))
diff -Nru a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
--- a/include/linux/compiler-gcc3.h	2004-09-07 23:33:14 -07:00
+++ b/include/linux/compiler-gcc3.h	2005-03-07 20:41:38 -08:00
@@ -10,7 +10,7 @@
 #endif
 x #if __GNUC_MINOR__ > 0
-# define __deprecated	__attribute__((deprecated))
+# define __deprecated		__attribute__((deprecated))
 #endif
 x #if __GNUC_MINOR__ >= 3
@@ -23,12 +23,10 @@
 #define __attribute_const__	__attribute__((__const__))
 x #if __GNUC_MINOR__ >= 1
-#define  noinline __attribute__((noinline))
+#define  noinline		__attribute__((noinline))
 #endif
+x #if __GNUC_MINOR__ >= 4
-#define __must_check __attribute__((warn_unused_result))
+#define __must_check		__attribute__((warn_unused_result))
 #endif
 x-#if __GNUC_MINOR__ >= 5
-#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
-#endif
diff -Nru a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/linux/compiler-gcc4.h	2005-03-07 20:41:38 -08:00
@@ -0,0 +1,16 @@
+/* Never include this file directly.  Include <linux/compiler.h> instead.  */x+
+/* These definitions are for GCC v4.x.  */x+#include <linux/compiler-gcc.h>x+
+#define inline			inline		__attribute__((always_inline))
+#define __inline__		__inline__	__attribute__((always_inline))
+#define __inline		__inline	__attribute__((always_inline))
+#define __deprecated		__attribute__((deprecated))
+#define __attribute_used__	__attribute__((__used__))
+#define __attribute_pure__	__attribute__((pure))
+#define __attribute_const__	__attribute__((__const__))
+#define  noinline		__attribute__((noinline))
+#define __must_check 		__attribute__((warn_unused_result))
+#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
+
diff -Nru a/include/linux/compiler.h b/include/linux/compiler.h
--- a/include/linux/compiler.h	2004-10-30 20:01:53 -07:00
+++ b/include/linux/compiler.h	2005-03-07 20:41:38 -08:00
@@ -34,8 +34,10 @@
 
 #ifdef __KERNEL__x 
-#if __GNUC__ > 3x-# include <linux/compiler-gcc+.h>	/* catch-all for GCC 4, 5, etc. */x+#if __GNUC__ > 4x+#error no compiler-gcc.h file for this gcc versionx+#elif __GNUC__ == 4
+# include <linux/compiler-gcc4.h>x #elif __GNUC__ == 3x # include <linux/compiler-gcc3.h>x #elif __GNUC__ == 2
diff -Nru a/include/linux/console_struct.h b/include/linux/console_struct.h
--- a/include/linux/console_struct.h	2005-01-10 17:29:34 -08:00
+++ b/include/linux/console_struct.h	2005-03-07 20:41:34 -08:00
@@ -26,6 +26,7 @@
 	const struct consw *vc_sw;
 	unsigned short	*vc_screenbuf;		/* In-memory character/attribute buffer */
 	unsigned int	vc_screenbuf_size;
+	unsigned char	vc_mode;		/* KD_TEXT, ... */
 	/* attributes for all characters on screen */
 	unsigned char	vc_attr;		/* Current attributes */
 	unsigned char	vc_def_color;		/* Default colors */x@@ -48,6 +49,11 @@
 	unsigned int	vc_state;		/* Escape sequence parser state */
 	unsigned int	vc_npar,vc_par[NPAR];	/* Parameters of current escape sequence */x 	struct tty_struct *vc_tty;		/* TTY we are attached to */x+	/* data for manual vt switching */
+	struct vt_mode	vt_mode;
+	int		vt_pid;
+	int		vt_newvt;
+	wait_queue_head_t paste_wait;
 	/* mode flags */
 	unsigned int	vc_charset	: 1;	/* Character set G0 / G1 */
 	unsigned int	vc_s_charset	: 1;	/* Saved character set */x@@ -89,7 +95,6 @@
 	struct vc_data **vc_display_fg;		/* [!] Ptr to var holding fg console for this display */
 	unsigned long	vc_uni_pagedir;
 	unsigned long	*vc_uni_pagedir_loc;  /* [!] Location of uni_pagedir variable for this console */x-	struct vt_struct *vc_vt;
 	/* additional information is in vt_kern.h */x };
 
diff -Nru a/include/linux/consolemap.h b/include/linux/consolemap.h
--- a/include/linux/consolemap.h	2002-02-05 09:39:41 -08:00
+++ b/include/linux/consolemap.h	2005-03-07 20:41:34 -08:00
@@ -11,5 +11,5 @@
 struct vc_data;
 
 extern unsigned char inverse_translate(struct vc_data *conp, int glyph);x-extern unsigned short *set_translate(int m,int currcons);
+extern unsigned short *set_translate(int m, struct vc_data *vc);
 extern int conv_uni_to_pc(struct vc_data *conp, long ucs);
diff -Nru a/include/linux/cryptohash.h b/include/linux/cryptohash.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/linux/cryptohash.h	2005-03-07 20:41:51 -08:00
@@ -0,0 +1,12 @@
+#ifndef __CRYPTOHASH_H
+#define __CRYPTOHASH_H
+
+#define SHA_DIGEST_WORDS 5
+#define SHA_WORKSPACE_WORDS 80
+
+void sha_init(__u32 *buf);
+void sha_transform(__u32 *digest, const char *data, __u32 *W);
+
+__u32 half_md4_transform(__u32 buf[4], __u32 const in[8]);
+
+#endif
diff -Nru a/include/linux/dcache.h b/include/linux/dcache.h
--- a/include/linux/dcache.h	2005-01-03 16:00:00 -08:00
+++ b/include/linux/dcache.h	2005-03-07 20:41:36 -08:00
@@ -162,17 +162,16 @@
  * d_drop - drop a dentry
  * @dentry: dentry to drop
  *
- * d_drop() unhashes the entry from the parent
- * dentry hashes, so that it won't be found through
- * a VFS lookup any more. Note that this is different
- * from deleting the dentry - d_delete will try to
- * mark the dentry negative if possible, giving a
- * successful _negative_ lookup, while d_drop will
+ * d_drop() unhashes the entry from the parent dentry hashes, so that it won't
+ * be found through a VFS lookup any more. Note that this is different from
+ * deleting the dentry - d_delete will try to mark the dentry negative if
+ * possible, giving a successful _negative_ lookup, while d_drop will
  * just make the cache lookup fail.
  *
- * d_drop() is used mainly for stuff that wants
- * to invalidate a dentry for some reason (NFS
- * timeouts or autofs deletes).
+ * d_drop() is used mainly for stuff that wants to invalidate a dentry for some
+ * reason (NFS timeouts or autofs deletes).
+ *
+ * __d_drop requires dentry->d_lock.
  */x 
 static inline void __d_drop(struct dentry *dentry)
@@ -186,7 +185,9 @@
 static inline void d_drop(struct dentry *dentry)
 {
 	spin_lock(&dcache_lock);
+	spin_lock(&dentry->d_lock);
  	__d_drop(dentry);
+	spin_unlock(&dentry->d_lock);
 	spin_unlock(&dcache_lock);
 }
 xdiff -Nru a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h	2005-01-10 17:29:25 -08:00
+++ b/include/linux/device.h	2005-03-09 09:03:56 -08:00
@@ -15,7 +15,6 @@
 #include <linux/ioport.h>x #include <linux/kobject.h>x #include <linux/list.h>x-#include <linux/spinlock.h>x #include <linux/types.h>x #include <linux/module.h>x #include <linux/pm.h>x@@ -102,7 +101,7 @@
 	char			* name;
 	struct bus_type		* bus;
 
-	struct semaphore	unload_sem;
+	struct completion	unloaded;
 	struct kobject		kobj;x 	struct list_head	devices;
 
@@ -148,6 +147,7 @@
 	struct subsystem	subsys;x 	struct list_head	children;x 	struct list_head	interfaces;
+	struct semaphore	sem;	/* locks both the children and interfaces lists */x 
 	struct class_attribute		* class_attrs;x 	struct class_device_attribute	* class_dev_attrs;x@@ -184,6 +184,7 @@
 
 	struct kobject		kobj;x 	struct class		* class;	/* required */
+	dev_t			devt;		/* dev_t, creates the sysfs "dev" */x 	struct device		* dev;		/* not necessary, but nice to have */
 	void			* class_data;	/* class-specific data */
 xdiff -Nru a/include/linux/dp83840.h b/include/linux/dp83840.h
--- a/include/linux/dp83840.h	2002-02-05 12:18:31 -08:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,41 +0,0 @@
-/*
- * linux/dp83840.h: definitions for DP83840 MII-compatible transceivers
- *
- * Copyright (C) 1996, 1999 David S. Miller (davem@redhat.com)
- */x-#ifndef __LINUX_DP83840_H
-#define __LINUX_DP83840_H
-x-#include <linux/mii.h>x-
-/*
- * Data sheets and programming docs for the DP83840 are available at
- * from http://www.national.com/
- *
- * The DP83840 is capable of both 10 and 100Mbps ethernet, in both
- * half and full duplex mode.  It also supports auto negotiation.
- *
- * But.... THIS THING IS A PAIN IN THE ASS TO PROGRAM!
- * Debugging eeprom burnt code is more fun than programming this chip!
- */x-
-/* First, the MII register numbers (actually DP83840 register numbers). */x-#define MII_CSCONFIG        0x17        /* CS configuration            */x-
-/* The Carrier Sense config register. */x-#define CSCONFIG_RESV1          0x0001  /* Unused...                   */x-#define CSCONFIG_LED4           0x0002  /* Pin for full-dplx LED4      */x-#define CSCONFIG_LED1           0x0004  /* Pin for conn-status LED1    */x-#define CSCONFIG_RESV2          0x0008  /* Unused...                   */x-#define CSCONFIG_TCVDISAB       0x0010  /* Turns off the transceiver   */x-#define CSCONFIG_DFBYPASS       0x0020  /* Bypass disconnect function  */x-#define CSCONFIG_GLFORCE        0x0040  /* Good link force for 100mbps */x-#define CSCONFIG_CLKTRISTATE    0x0080  /* Tristate 25m clock          */x-#define CSCONFIG_RESV3          0x0700  /* Unused...                   */x-#define CSCONFIG_ENCODE         0x0800  /* 1=MLT-3, 0=binary           */x-#define CSCONFIG_RENABLE        0x1000  /* Repeater mode enable        */x-#define CSCONFIG_TCDISABLE      0x2000  /* Disable timeout counter     */x-#define CSCONFIG_RESV4          0x4000  /* Unused...                   */x-#define CSCONFIG_NDISABLE       0x8000  /* Disable NRZI                */x-
-#endif /* __LINUX_DP83840_H */xdiff -Nru a/include/linux/dqblk_xfs.h b/include/linux/dqblk_xfs.h
--- a/include/linux/dqblk_xfs.h	2004-09-27 21:05:24 -07:00
+++ b/include/linux/dqblk_xfs.h	2005-03-07 20:41:43 -08:00
@@ -28,6 +28,12 @@
  */
 
 #define XQM_CMD(x)	(('X'<<8)+(x))	/* note: forms first QCMD argument */x+#define XQM_COMMAND(x)	(((x) & (0xff<<8)) == ('X'<<8))	/* test if for XFS */x+
+#define XQM_USRQUOTA	0	/* system call user quota type */x+#define XQM_GRPQUOTA	1	/* system call group quota type */x+#define XQM_MAXQUOTAS	2
+x #define Q_XQUOTAON	XQM_CMD(1)	/* enable accounting/enforcement */x #define Q_XQUOTAOFF	XQM_CMD(2)	/* disable accounting/enforcement */x #define Q_XGETQUOTA	XQM_CMD(3)	/* get disk limits and usage */xdiff -Nru a/include/linux/elevator.h b/include/linux/elevator.h
--- a/include/linux/elevator.h	2004-10-19 02:40:18 -07:00
+++ b/include/linux/elevator.h	2005-03-09 00:03:46 -08:00
@@ -20,6 +20,7 @@
 
 typedef int (elevator_set_req_fn) (request_queue_t *, struct request *, int);x typedef void (elevator_put_req_fn) (request_queue_t *, struct request *);
+typedef void (elevator_deactivate_req_fn) (request_queue_t *, struct request *);
 
 typedef int (elevator_init_fn) (request_queue_t *, elevator_t *);
 typedef void (elevator_exit_fn) (elevator_t *);
@@ -34,6 +35,7 @@
 	elevator_add_req_fn *elevator_add_req_fn;
 	elevator_remove_req_fn *elevator_remove_req_fn;
 	elevator_requeue_req_fn *elevator_requeue_req_fn;
+	elevator_deactivate_req_fn *elevator_deactivate_req_fn;
 x 	elevator_queue_empty_fn *elevator_queue_empty_fn;
 	elevator_completed_req_fn *elevator_completed_req_fn;
@@ -87,6 +89,7 @@
 extern void elv_merged_request(request_queue_t *, struct request *);
 extern void elv_remove_request(request_queue_t *, struct request *);
 extern void elv_requeue_request(request_queue_t *, struct request *);
+extern void elv_deactivate_request(request_queue_t *, struct request *);
 extern int elv_queue_empty(request_queue_t *);x extern struct request *elv_next_request(struct request_queue *q);x extern struct request *elv_former_request(request_queue_t *, struct request *);
diff -Nru a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h
--- a/include/linux/ext3_jbd.h	2005-01-10 17:29:39 -08:00
+++ b/include/linux/ext3_jbd.h	2005-03-07 20:41:34 -08:00
@@ -111,9 +111,9 @@
 x static inline int
 __ext3_journal_get_undo_access(const char *where, handle_t *handle,
-				struct buffer_head *bh, int *credits)
+				struct buffer_head *bh)
 {
-	int err = journal_get_undo_access(handle, bh, credits);
+	int err = journal_get_undo_access(handle, bh);
 	if (err)
 		ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
 	return err;x@@ -121,19 +121,18 @@
 x static inline int
 __ext3_journal_get_write_access(const char *where, handle_t *handle,
-				struct buffer_head *bh, int *credits)
+				struct buffer_head *bh)
 {
-	int err = journal_get_write_access(handle, bh, credits);
+	int err = journal_get_write_access(handle, bh);
 	if (err)
 		ext3_journal_abort_handle(where, __FUNCTION__, bh, handle,err);
 	return err;x }x 
 static inline voidx-ext3_journal_release_buffer(handle_t *handle, struct buffer_head *bh,
-				int credits)
+ext3_journal_release_buffer(handle_t *handle, struct buffer_head *bh)
 {
-	journal_release_buffer(handle, bh, credits);
+	journal_release_buffer(handle, bh);x }x 
 static inline int
@@ -176,12 +175,10 @@
 }
 
 x-#define ext3_journal_get_undo_access(handle, bh, credits) \x-	__ext3_journal_get_undo_access(__FUNCTION__, (handle), (bh), (credits))
+#define ext3_journal_get_undo_access(handle, bh) \x+	__ext3_journal_get_undo_access(__FUNCTION__, (handle), (bh))
 #define ext3_journal_get_write_access(handle, bh) \x-	__ext3_journal_get_write_access(__FUNCTION__, (handle), (bh), NULL)x-#define ext3_journal_get_write_access_credits(handle, bh, credits) \x-	__ext3_journal_get_write_access(__FUNCTION__, (handle), (bh), (credits))
+	__ext3_journal_get_write_access(__FUNCTION__, (handle), (bh))
 #define ext3_journal_revoke(handle, blocknr, bh) \x 	__ext3_journal_revoke(__FUNCTION__, (handle), (blocknr), (bh))
 #define ext3_journal_get_create_access(handle, bh) \xdiff -Nru a/include/linux/fs.h b/include/linux/fs.h
--- a/include/linux/fs.h	2005-02-22 16:17:36 -08:00
+++ b/include/linux/fs.h	2005-03-07 20:41:24 -08:00
@@ -129,6 +129,7 @@
 #define S_DIRSYNC	64	/* Directory modifications are synchronous */x #define S_NOCMTIME	128	/* Do not update file c/mtime */x #define S_SWAPFILE	256	/* Do not truncate: swapon got its bmaps */x+#define S_PRIVATE	512	/* Inode is fs-internal */x 
 /*
  * Note that nosuid etc flags are inode-specific: setting some file-system
@@ -162,6 +163,7 @@
 #define IS_DEADDIR(inode)	((inode)->i_flags & S_DEAD)
 #define IS_NOCMTIME(inode)	((inode)->i_flags & S_NOCMTIME)
 #define IS_SWAPFILE(inode)	((inode)->i_flags & S_SWAPFILE)
+#define IS_PRIVATE(inode)	((inode)->i_flags & S_PRIVATE)
 
 /* the read-only stuff doesn't really belong here, but any other place is
    probably as bad and I don't want to create yet another include file. */x@@ -335,7 +337,7 @@
 struct address_space {
 	struct inode		*host;		/* owner: inode, block_device */x 	struct radix_tree_root	page_tree;	/* radix tree of all pages */x-	spinlock_t		tree_lock;	/* and spinlock protecting it */x+	rwlock_t		tree_lock;	/* and rwlock protecting it */x 	unsigned int		i_mmap_writable;/* count VM_SHARED mappings */
 	struct prio_tree_root	i_mmap;		/* tree of private and shared mappings */
 	struct list_head	i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
@@ -1353,11 +1355,15 @@
 		invalidate_inode_pages(inode->i_mapping);x }x extern int invalidate_inode_pages2(struct address_space *mapping);x+extern int invalidate_inode_pages2_range(struct address_space *mapping,
+					 pgoff_t start, pgoff_t end);
 extern int write_inode_now(struct inode *, int);
 extern int filemap_fdatawrite(struct address_space *);
 extern int filemap_flush(struct address_space *);
 extern int filemap_fdatawait(struct address_space *);
 extern int filemap_write_and_wait(struct address_space *mapping);x+extern int filemap_write_and_wait_range(struct address_space *mapping,
+				        loff_t lstart, loff_t lend);
 extern void sync_supers(void);
 extern void sync_filesystems(int wait);
 extern void emergency_sync(void);
diff -Nru a/include/linux/i2c-id.h b/include/linux/i2c-id.h
--- a/include/linux/i2c-id.h	2005-01-30 22:33:41 -08:00
+++ b/include/linux/i2c-id.h	2005-03-02 15:48:37 -08:00
@@ -20,8 +20,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.		     */
 /* ------------------------------------------------------------------------- */x x-/* $Id: i2c-id.h,v 1.68 2003/02/25 02:55:18 mds Exp $ */x-
 #ifndef LINUX_I2C_ID_H
 #define LINUX_I2C_ID_H
 x@@ -196,11 +194,15 @@
 #define I2C_ALGO_OCP    0x120000	/* IBM or otherwise On-chip I2C algorithm */
 #define I2C_ALGO_BITHS	0x130000	/* enhanced bit style adapters	*/
 #define I2C_ALGO_IOP3XX	0x140000	/* XSCALE IOP3XX On-chip I2C alg */x-#define I2C_ALGO_PCA	0x150000	/* PCA 9564 style adapters	*/
-
 #define I2C_ALGO_SIBYTE 0x150000	/* Broadcom SiByte SOCs		*/x-#define I2C_ALGO_SGI	0x160000        /* SGI algorithm                */x-#define I2C_ALGO_AU1550	0x170000        /* Au1550 PSC algorithm		*/x+#define I2C_ALGO_SGI	0x160000	/* SGI algorithm		*/x+x+#define I2C_ALGO_USB	0x170000	/* USB algorithm		*/x+#define I2C_ALGO_VIRT	0x180000	/* Virtual bus adapter		*/x+x+#define I2C_ALGO_MV64XXX 0x190000	/* Marvell mv64xxx i2c ctlr	*/x+#define I2C_ALGO_PCA	0x1a0000	/* PCA 9564 style adapters	*/
+#define I2C_ALGO_AU1550	0x1b0000        /* Au1550 PSC algorithm		*/x 
 #define I2C_ALGO_EXP	0x800000	/* experimental			*/x 
@@ -240,6 +242,7 @@
 #define I2C_HW_B_IXP4XX 0x17	/* GPIO on IXP4XX systems		*/
 #define I2C_HW_B_S3VIA	0x18	/* S3Via ProSavage adapter		*/x #define I2C_HW_B_ZR36067 0x19	/* Zoran-36057/36067 based boards	*/
+#define I2C_HW_B_PCILYNX 0x1a	/* TI PCILynx I2C adapter		*/x #define I2C_HW_B_CX2388x 0x1b	/* connexant 2388x based tv cards	*/
 
 /* --- PCF 8584 based algorithms					*/x@@ -309,5 +312,8 @@
 
 /* --- MCP107 adapter */x #define I2C_HW_MPC107 0x00x+
+/* --- Marvell mv64xxx i2c adapter */x+#define I2C_HW_MV64XXX 0x00
 x #endif /* LINUX_I2C_ID_H */xdiff -Nru a/include/linux/i2c.h b/include/linux/i2c.h
--- a/include/linux/i2c.h	2004-11-12 01:46:22 -08:00
+++ b/include/linux/i2c.h	2005-03-02 09:54:36 -08:00
@@ -55,7 +55,7 @@
 
 /* Transfer num messages.
  */x-extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg msg[],int num);x+extern int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num);x 
 /*
  * Some adapter types (i.e. PCF 8584 based ones) may support slave behaviuor. 
@@ -134,8 +134,6 @@
 };
 #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
 
-extern struct bus_type i2c_bus_type;
-
 #define I2C_NAME_SIZE	50
 
 /*
@@ -144,7 +142,6 @@
  * function is mainly used for lookup & other admin. functions.
  */x struct i2c_client {
-	int id;x 	unsigned int flags;		/* div., see below		*/x 	unsigned int addr;		/* chip address - NOTE: 7bit 	*/x 					/* addresses are stored in the	*/x@@ -190,11 +187,11 @@
 	char name[32];				/* textual description 	*/x 	unsigned int id;x 
-	/* If an adapter algorithm can't to I2C-level access, set master_xferx+	/* If an adapter algorithm can't do I2C-level access, set master_xferx 	   to NULL. If an adapter algorithm can do SMBus access, set x 	   smbus_xfer. If set to NULL, the SMBus protocol is simulatedx 	   using common I2C messages */x-	int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg msgs[], 
+	int (*master_xfer)(struct i2c_adapter *adap,struct i2c_msg *msgs, x 	                   int num);x 	int (*smbus_xfer) (struct i2c_adapter *adap, u16 addr, x 	                   unsigned short flags, char read_write,
@@ -302,8 +299,8 @@
 };
 
 /* Internal numbers to terminate lists */x-#define I2C_CLIENT_END		0xfffex-#define I2C_CLIENT_ISA_END	0xfffefffex+#define I2C_CLIENT_END		0xfffeUx+#define I2C_CLIENT_ISA_END	0xfffefffeU
 
 /* The numbers to use to set I2C bus address */x #define ANY_I2C_BUS		0xffffx@@ -423,22 +420,22 @@
 #define I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC  0x40000000 /* SMBus 2.0 */x #define I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC 0x80000000 /* SMBus 2.0 */x x-#define I2C_FUNC_SMBUS_BYTE I2C_FUNC_SMBUS_READ_BYTE | \x-                            I2C_FUNC_SMBUS_WRITE_BYTEx-#define I2C_FUNC_SMBUS_BYTE_DATA I2C_FUNC_SMBUS_READ_BYTE_DATA | \x-                                 I2C_FUNC_SMBUS_WRITE_BYTE_DATAx-#define I2C_FUNC_SMBUS_WORD_DATA I2C_FUNC_SMBUS_READ_WORD_DATA | \x-                                 I2C_FUNC_SMBUS_WRITE_WORD_DATAx-#define I2C_FUNC_SMBUS_BLOCK_DATA I2C_FUNC_SMBUS_READ_BLOCK_DATA | \x-                                  I2C_FUNC_SMBUS_WRITE_BLOCK_DATAx-#define I2C_FUNC_SMBUS_I2C_BLOCK I2C_FUNC_SMBUS_READ_I2C_BLOCK | \x-                                  I2C_FUNC_SMBUS_WRITE_I2C_BLOCKx-#define I2C_FUNC_SMBUS_I2C_BLOCK_2 I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \x-                                   I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2x-#define I2C_FUNC_SMBUS_BLOCK_DATA_PEC I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC | \x-                                      I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PECx-#define I2C_FUNC_SMBUS_WORD_DATA_PEC  I2C_FUNC_SMBUS_READ_WORD_DATA_PEC | \x-                                      I2C_FUNC_SMBUS_WRITE_WORD_DATA_PECx+#define I2C_FUNC_SMBUS_BYTE (I2C_FUNC_SMBUS_READ_BYTE | \x+                             I2C_FUNC_SMBUS_WRITE_BYTE)x+#define I2C_FUNC_SMBUS_BYTE_DATA (I2C_FUNC_SMBUS_READ_BYTE_DATA | \x+                                  I2C_FUNC_SMBUS_WRITE_BYTE_DATA)x+#define I2C_FUNC_SMBUS_WORD_DATA (I2C_FUNC_SMBUS_READ_WORD_DATA | \x+                                  I2C_FUNC_SMBUS_WRITE_WORD_DATA)x+#define I2C_FUNC_SMBUS_BLOCK_DATA (I2C_FUNC_SMBUS_READ_BLOCK_DATA | \x+                                   I2C_FUNC_SMBUS_WRITE_BLOCK_DATA)x+#define I2C_FUNC_SMBUS_I2C_BLOCK (I2C_FUNC_SMBUS_READ_I2C_BLOCK | \x+                                  I2C_FUNC_SMBUS_WRITE_I2C_BLOCK)x+#define I2C_FUNC_SMBUS_I2C_BLOCK_2 (I2C_FUNC_SMBUS_READ_I2C_BLOCK_2 | \x+                                    I2C_FUNC_SMBUS_WRITE_I2C_BLOCK_2)x+#define I2C_FUNC_SMBUS_BLOCK_DATA_PEC (I2C_FUNC_SMBUS_READ_BLOCK_DATA_PEC | \x+                                       I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC)x+#define I2C_FUNC_SMBUS_WORD_DATA_PEC  (I2C_FUNC_SMBUS_READ_WORD_DATA_PEC | \x+                                       I2C_FUNC_SMBUS_WRITE_WORD_DATA_PEC)x 
 #define I2C_FUNC_SMBUS_READ_BYTE_PEC		I2C_FUNC_SMBUS_READ_BYTE_DATAx #define I2C_FUNC_SMBUS_WRITE_BYTE_PEC		I2C_FUNC_SMBUS_WRITE_BYTE_DATAx@@ -447,14 +444,14 @@
 #define I2C_FUNC_SMBUS_BYTE_PEC			I2C_FUNC_SMBUS_BYTE_DATA
 #define I2C_FUNC_SMBUS_BYTE_DATA_PEC		I2C_FUNC_SMBUS_WORD_DATAx x-#define I2C_FUNC_SMBUS_EMUL I2C_FUNC_SMBUS_QUICK | \x-                            I2C_FUNC_SMBUS_BYTE | \x-                            I2C_FUNC_SMBUS_BYTE_DATA | \x-                            I2C_FUNC_SMBUS_WORD_DATA | \x-                            I2C_FUNC_SMBUS_PROC_CALL | \x-                            I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \x-                            I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC | \x-                            I2C_FUNC_SMBUS_I2C_BLOCKx+#define I2C_FUNC_SMBUS_EMUL (I2C_FUNC_SMBUS_QUICK | \x+                             I2C_FUNC_SMBUS_BYTE | \x+                             I2C_FUNC_SMBUS_BYTE_DATA | \x+                             I2C_FUNC_SMBUS_WORD_DATA | \x+                             I2C_FUNC_SMBUS_PROC_CALL | \x+                             I2C_FUNC_SMBUS_WRITE_BLOCK_DATA | \x+                             I2C_FUNC_SMBUS_WRITE_BLOCK_DATA_PEC | \x+                             I2C_FUNC_SMBUS_I2C_BLOCK)x 
 /* 
  * Data for SMBus Messages xdiff -Nru a/include/linux/ibmtr.h b/include/linux/ibmtr.h
--- a/include/linux/ibmtr.h	2002-02-04 23:43:09 -08:00
+++ b/include/linux/ibmtr.h	2005-01-24 16:01:53 -08:00
@@ -169,7 +169,7 @@
 x struct tok_info {
 	unsigned char irq;
-	void *mmio;
+	void __iomem *mmio;
 	unsigned char hw_address[32];
 	unsigned char adapter_type;
 	unsigned char data_rate;
@@ -192,12 +192,13 @@
 	/* Additions by Peter De Schrijver */
 	unsigned char page_mask;          /* mask to select RAM page to Map*/
 	unsigned char mapped_ram_size;    /* size of RAM page */x-	__u32 sram_virt;                  /* Shared memory base address */x-	__u32 init_srb;               /* Initial System Request Block address */x-	__u32 srb;                        /* System Request Block address */x-	__u32 ssb;                        /* System Status Block address */x-	__u32 arb;                        /* Adapter Request Block address */x-	__u32 asb;                        /* Adapter Status Block address */x+	__u32 sram_phys;          /* Shared memory base address */x+	void __iomem *sram_virt;          /* Shared memory base address */x+	void __iomem *init_srb;   /* Initial System Request Block address */x+	void __iomem *srb;                /* System Request Block address */x+	void __iomem *ssb;                /* System Status Block address */x+	void __iomem *arb;                /* Adapter Request Block address */x+	void __iomem *asb;                /* Adapter Status Block address */x         __u8  init_srb_page;x         __u8  srb_page;x         __u8  ssb_page;xdiff -Nru a/include/linux/ide.h b/include/linux/ide.h
--- a/include/linux/ide.h	2005-02-23 10:58:29 -08:00
+++ b/include/linux/ide.h	2005-03-07 20:41:36 -08:00
@@ -740,7 +740,6 @@
 	u8	sect;		/* "real" sectors per track */
 	u8	bios_head;	/* BIOS/fdisk/LILO number of heads */
 	u8	bios_sect;	/* BIOS/fdisk/LILO sectors per track */
-	u8	doing_barrier;	/* state, 1=currently doing flush */x x 	unsigned int	bios_cyl;	/* BIOS/fdisk/LILO number of cyls */
 	unsigned int	cyl;		/* "real" number of cyls */
@@ -1130,6 +1129,7 @@
 extern int noautodma;
 
 extern int ide_end_request (ide_drive_t *drive, int uptodate, int nrsecs);x+extern int __ide_end_request (ide_drive_t *drive, struct request *rq, int uptodate, int nrsecs);x 
 /*
  * This is used on exit from the driver to designate the next irq handlerxdiff -Nru a/include/linux/if_ec.h b/include/linux/if_ec.h
--- a/include/linux/if_ec.h	2003-06-04 17:57:06 -07:00
+++ b/include/linux/if_ec.h	2005-01-20 14:44:43 -08:00
@@ -47,8 +47,9 @@
   unsigned char port;x };
 
-struct econet_opt
-{
+struct econet_sock {x+  /* struct sock has to be the first member of econet_sock */x+  struct sock	sk;
   unsigned char cb;
   unsigned char port;x   unsigned char station;
@@ -56,7 +57,10 @@
   unsigned short num;x };
 
-#define ec_sk(__sk) ((struct econet_opt *)(__sk)->sk_protinfo)
+static inline struct econet_sock *ec_sk(const struct sock *sk)
+{
+	return (struct econet_sock *)sk;
+}
 x struct ec_device
 {
diff -Nru a/include/linux/if_pppox.h b/include/linux/if_pppox.h
--- a/include/linux/if_pppox.h	2004-07-05 03:33:38 -07:00
+++ b/include/linux/if_pppox.h	2005-01-20 18:16:04 -08:00
@@ -119,10 +119,13 @@
 					     relayed to (PPPoE relaying) */x };
 
-struct pppox_opt {x+#include <net/sock.h>x+
+struct pppox_sock {x+	/* struct sock must be the first member of pppox_sock */
+	struct sock		sk;
 	struct ppp_channel	chan;
-	struct sock		*sk;
-	struct pppox_opt	*next;	  /* for hash table */
+	struct pppox_sock	*next;	  /* for hash table */
 	union {
 		struct pppoe_opt pppoe;
 	} proto;
@@ -132,7 +135,15 @@
 #define pppoe_pa	proto.pppoe.pa
 #define pppoe_relay	proto.pppoe.relay
 
-#define pppox_sk(__sk) ((struct pppox_opt *)(__sk)->sk_protinfo)
+static inline struct pppox_sock *pppox_sk(struct sock *sk)
+{
+	return (struct pppox_sock *)sk;
+}
+
+static inline struct sock *sk_pppox(struct pppox_sock *po)
+{
+	return (struct sock *)po;
+}
 x struct module;
 
diff -Nru a/include/linux/init_task.h b/include/linux/init_task.h
--- a/include/linux/init_task.h	2005-01-20 21:00:51 -08:00
+++ b/include/linux/init_task.h	2005-03-07 20:41:53 -08:00
@@ -51,6 +51,7 @@
 		.list = LIST_HEAD_INIT(sig.shared_pending.list),	\
 		.signal =  {{0}}}, \x 	.posix_timers	 = LIST_HEAD_INIT(sig.posix_timers),		\x+	.cpu_timers	= INIT_CPU_TIMERS(sig.cpu_timers),		\x 	.rlim		= INIT_RLIMITS,					\
 }
 
@@ -89,9 +90,6 @@
 	.children	= LIST_HEAD_INIT(tsk.children),			\x 	.sibling	= LIST_HEAD_INIT(tsk.sibling),			\x 	.group_leader	= &tsk,						\x-	.real_timer	= {						\x-		.function	= it_real_fn				\x-	},								\x 	.group_info	= &init_groups,					\x 	.cap_effective	= CAP_INIT_EFF_SET,				\x 	.cap_inheritable = CAP_INIT_INH_SET,				\x@@ -112,8 +110,16 @@
 	.proc_lock	= SPIN_LOCK_UNLOCKED,				\x 	.switch_lock	= SPIN_LOCK_UNLOCKED,				\x 	.journal_info	= NULL,						\x+	.cpu_timers	= INIT_CPU_TIMERS(tsk.cpu_timers),		\x }
 
+x+#define INIT_CPU_TIMERS(cpu_timers)					\x+{									\x+	LIST_HEAD_INIT(cpu_timers[0]),					\x+	LIST_HEAD_INIT(cpu_timers[1]),					\x+	LIST_HEAD_INIT(cpu_timers[2]),					\x+}
 
 x #endif
diff -Nru a/include/linux/ioc4_common.h b/include/linux/ioc4_common.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/linux/ioc4_common.h	2005-03-07 20:41:31 -08:00
@@ -0,0 +1,21 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
+ */x+x+#ifndef _LINUX_IOC4_COMMON_H
+#define _LINUX_IOC4_COMMON_H
+
+/* prototypes */x+x+int ioc4_serial_init(void);
+x+int ioc4_serial_attach_one(struct pci_dev *pdev, const struct
+				pci_device_id *pci_id);
+int ioc4_ide_attach_one(struct pci_dev *pdev, const struct
+				pci_device_id *pci_id);
+
+#endif	/* _LINUX_IOC4_COMMON_H */xdiff -Nru a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h
--- a/include/linux/ipmi_smi.h	2004-06-18 00:06:07 -07:00
+++ b/include/linux/ipmi_smi.h	2005-03-07 20:41:43 -08:00
@@ -104,13 +104,22 @@
 	/* Called to poll for work to do.  This is so upper layers canx 	   poll for operations during things like crash dumps. */
 	void (*poll)(void *send_info);
+
+	/* Tell the handler that we are using it/not using it.  The
+	   message handler get the modules that this handler belongs
+	   to; this function lets the SMI claim any modules that it
+	   uses.  These may be NULL if this is not required. */x+	int (*inc_usecount)(void *send_info);
+	void (*dec_usecount)(void *send_info);
 };
 
-/* Add a low-level interface to the IPMI driver. */x+/* Add a low-level interface to the IPMI driver.  Note that if thex+   interface doesn't know its slave address, it should pass in zero. */
 int ipmi_register_smi(struct ipmi_smi_handlers *handlers,
 		      void                     *send_info,
 		      unsigned char            version_major,
 		      unsigned char            version_minor,
+		      unsigned char            slave_addr,
 		      ipmi_smi_t               *intf);x 
 /*
diff -Nru a/include/linux/jbd.h b/include/linux/jbd.h
--- a/include/linux/jbd.h	2005-01-30 22:33:46 -08:00
+++ b/include/linux/jbd.h	2005-03-07 20:41:35 -08:00
@@ -789,6 +789,12 @@
 	struct jbd_revoke_table_s *j_revoke_table[2];
 
 	/*
+	 * array of bhs for journal_commit_transaction
+	 */
+	struct buffer_head	**j_wbuf;
+	int			j_wbufsize;
+
+	/*x 	 * An opaque pointer to fs-private information.  ext3 puts itsx 	 * superblock pointer herex 	 */x@@ -867,15 +873,12 @@
 extern handle_t *journal_start(journal_t *, int nblocks);
 extern int	 journal_restart (handle_t *, int nblocks);
 extern int	 journal_extend (handle_t *, int nblocks);
-extern int	 journal_get_write_access(handle_t *, struct buffer_head *,
-						int *credits);
+extern int	 journal_get_write_access(handle_t *, struct buffer_head *);
 extern int	 journal_get_create_access (handle_t *, struct buffer_head *);
-extern int	 journal_get_undo_access(handle_t *, struct buffer_head *,
-						int *credits);
+extern int	 journal_get_undo_access(handle_t *, struct buffer_head *);
 extern int	 journal_dirty_data (handle_t *, struct buffer_head *);
 extern int	 journal_dirty_metadata (handle_t *, struct buffer_head *);
-extern void	 journal_release_buffer (handle_t *, struct buffer_head *,
-						int credits);
+extern void	 journal_release_buffer (handle_t *, struct buffer_head *);
 extern int	 journal_forget (handle_t *, struct buffer_head *);
 extern void	 journal_sync_buffer (struct buffer_head *);
 extern int	 journal_invalidatepage(journal_t *,
diff -Nru a/include/linux/journal-head.h b/include/linux/journal-head.h
--- a/include/linux/journal-head.h	2003-06-17 23:04:00 -07:00
+++ b/include/linux/journal-head.h	2005-03-07 20:41:34 -08:00
@@ -32,6 +32,13 @@
 	unsigned b_jlist;
 
 	/*
+	 * This flag signals the buffer has been modified by
+	 * the currently running transaction
+	 * [jbd_lock_bh_state()]
+	 */
+	unsigned b_modified;
+
+	/*x 	 * Copy of the buffer data frozen for writing to the log.x 	 * [jbd_lock_bh_state()]
 	 */xdiff -Nru a/include/linux/kernel.h b/include/linux/kernel.h
--- a/include/linux/kernel.h	2005-01-04 18:48:16 -08:00
+++ b/include/linux/kernel.h	2005-03-04 22:41:14 -08:00
@@ -278,6 +278,12 @@
 extern void BUILD_BUG(void);
 #define BUILD_BUG_ON(condition) do { if (condition) BUILD_BUG(); } while(0)x 
+#ifdef CONFIG_SYSCTLx+extern int randomize_va_space;x+#elsex+#define randomize_va_space 1
+#endif
+
 /* Trap pasters of __FUNCTION__ at compile-time */x #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
 #define __FUNCTION__ (__func__)xdiff -Nru a/include/linux/kobj_map.h b/include/linux/kobj_map.h
--- a/include/linux/kobj_map.h	2003-05-25 02:45:07 -07:00
+++ b/include/linux/kobj_map.h	2005-03-09 09:03:28 -08:00
@@ -7,6 +7,6 @@
 	     kobj_probe_t *, int (*)(dev_t, void *), void *);
 void kobj_unmap(struct kobj_map *, dev_t, unsigned long);
 struct kobject *kobj_lookup(struct kobj_map *, dev_t, int *);
-struct kobj_map *kobj_map_init(kobj_probe_t *, struct subsystem *);
+struct kobj_map *kobj_map_init(kobj_probe_t *, struct semaphore *);
 
 #endif
diff -Nru a/include/linux/kobject.h b/include/linux/kobject.h
--- a/include/linux/kobject.h	2005-01-30 22:19:51 -08:00
+++ b/include/linux/kobject.h	2005-03-09 09:04:09 -08:00
@@ -20,6 +20,7 @@
 #include <linux/types.h>x #include <linux/list.h>x #include <linux/sysfs.h>x+#include <linux/spinlock.h>x #include <linux/rwsem.h>x #include <linux/kref.h>x #include <linux/kobject_uevent.h>x@@ -102,6 +103,7 @@
 	struct subsystem	* subsys;x 	struct kobj_type	* ktype;
 	struct list_head	list;
+	spinlock_t		list_lock;
 	struct kobject		kobj;x 	struct kset_hotplug_ops	* hotplug_ops;
 };
diff -Nru a/include/linux/kref.h b/include/linux/kref.h
--- a/include/linux/kref.h	2004-09-01 16:24:31 -07:00
+++ b/include/linux/kref.h	2005-03-09 09:03:24 -08:00
@@ -26,7 +26,7 @@
 
 void kref_init(struct kref *kref);
 void kref_get(struct kref *kref);
-void kref_put(struct kref *kref, void (*release) (struct kref *kref));
+int kref_put(struct kref *kref, void (*release) (struct kref *kref));
 x #endif /* __KERNEL__ */x #endif /* _KREF_H_ */xdiff -Nru a/include/linux/loop.h b/include/linux/loop.h
--- a/include/linux/loop.h	2004-03-12 01:32:59 -08:00
+++ b/include/linux/loop.h	2005-03-07 20:41:40 -08:00
@@ -71,7 +71,10 @@
 /*
  * Loop flags
  */x-#define LO_FLAGS_READ_ONLY	1
+enum {
+	LO_FLAGS_READ_ONLY	= 1,
+	LO_FLAGS_USE_AOPS	= 2,
+};
 
 #include <asm/posix_types.h>	/* for __kernel_old_dev_t */x #include <asm/types.h>		/* for __u64 */xdiff -Nru a/include/linux/major.h b/include/linux/major.h
--- a/include/linux/major.h	2004-03-18 21:59:29 -08:00
+++ b/include/linux/major.h	2005-03-07 20:41:20 -08:00
@@ -25,7 +25,6 @@
 #define MISC_MAJOR		10x #define SCSI_CDROM_MAJOR	11
 #define MUX_MAJOR		11	/* PA-RISC only */x-#define QIC02_TAPE_MAJOR	12
 #define XT_DISK_MAJOR		13
 #define INPUT_MAJOR		13
 #define SOUND_MAJOR		14xdiff -Nru a/include/linux/mii.h b/include/linux/mii.h
--- a/include/linux/mii.h	2004-08-22 13:57:31 -07:00
+++ b/include/linux/mii.h	2005-02-25 13:12:07 -08:00
@@ -20,6 +20,8 @@
 #define MII_ADVERTISE       0x04        /* Advertisement control reg   */
 #define MII_LPA             0x05        /* Link partner ability reg    */
 #define MII_EXPANSION       0x06        /* Expansion register          */x+#define MII_CTRL1000        0x09        /* 1000BASE-T control          */x+#define MII_STAT1000        0x0a        /* 1000BASE-T status           */x #define MII_DCOUNTER        0x12        /* Disconnect counter          */x #define MII_FCSCOUNTER      0x13        /* False carrier counter       */x #define MII_NWAYTEST        0x14        /* N-way auto-neg test reg     */x@@ -67,7 +69,9 @@
 #define ADVERTISE_100HALF       0x0080  /* Try for 100mbps half-duplex */x #define ADVERTISE_100FULL       0x0100  /* Try for 100mbps full-duplex */x #define ADVERTISE_100BASE4      0x0200  /* Try for 100mbps 4k packets  */x-#define ADVERTISE_RESV          0x1c00  /* Unused...                   */x+#define ADVERTISE_PAUSE_CAP     0x0400  /* Try for pause               */x+#define ADVERTISE_PAUSE_ASYM    0x0800  /* Try for asymetric pause     */x+#define ADVERTISE_RESV          0x1000  /* Unused...                   */x #define ADVERTISE_RFAULT        0x2000  /* Say we can detect faults    */x #define ADVERTISE_LPACK         0x4000  /* Ack link partners response  */x #define ADVERTISE_NPAGE         0x8000  /* Next page bit               */x@@ -84,7 +88,9 @@
 #define LPA_100HALF             0x0080  /* Can do 100mbps half-duplex  */x #define LPA_100FULL             0x0100  /* Can do 100mbps full-duplex  */x #define LPA_100BASE4            0x0200  /* Can do 100mbps 4k packets   */x-#define LPA_RESV                0x1c00  /* Unused...                   */x+#define LPA_PAUSE_CAP           0x0400  /* Can pause                   */x+#define LPA_PAUSE_ASYM          0x0800  /* Can pause asymetrically     */x+#define LPA_RESV                0x1000  /* Unused...                   */x #define LPA_RFAULT              0x2000  /* Link partner faulted        */x #define LPA_LPACK               0x4000  /* Link partner acked us       */x #define LPA_NPAGE               0x8000  /* Next page bit               */x@@ -105,6 +111,15 @@
 #define NWAYTEST_LOOPBACK       0x0100  /* Enable loopback for N-way   */x #define NWAYTEST_RESV2          0xfe00  /* Unused...                   */x x+/* 1000BASE-T Control register */x+#define ADVERTISE_1000FULL      0x0200  /* Advertise 1000BASE-T full duplex */x+#define ADVERTISE_1000HALF      0x0100  /* Advertise 1000BASE-T half duplex */x+x+/* 1000BASE-T Status register */x+#define LPA_1000LOCALRXOK       0x2000  /* Link partner local receiver status */x+#define LPA_1000REMRXOK         0x1000  /* Link partner remote receiver status */x+#define LPA_1000FULL            0x0800  /* Link partner 1000BASE-T full duplex */x+#define LPA_1000HALF            0x0400  /* Link partner 1000BASE-T half duplex */x x struct mii_if_info {
 	int phy_id;x@@ -114,6 +129,7 @@
 x 	unsigned int full_duplex : 1;	/* is full duplex? */
 	unsigned int force_media : 1;	/* is autoneg. disabled? */
+	unsigned int supports_gmii : 1; /* are GMII registers supported? */
 
 	struct net_device *dev;x 	int (*mdio_read) (struct net_device *dev, int phy_id, int location);
diff -Nru a/include/linux/mm.h b/include/linux/mm.h
--- a/include/linux/mm.h	2005-02-07 18:25:10 -08:00
+++ b/include/linux/mm.h	2005-03-04 22:41:14 -08:00
@@ -838,7 +838,7 @@
 }
 
 /* update per process rss and vm hiwater data */
-extern void update_mem_hiwater(void);
+extern void update_mem_hiwater(struct task_struct *tsk);
 x #ifndef CONFIG_DEBUG_PAGEALLOC
 static inline voidxdiff -Nru a/include/linux/mpage.h b/include/linux/mpage.h
--- a/include/linux/mpage.h	2002-09-19 14:25:55 -07:00
+++ b/include/linux/mpage.h	2005-03-07 20:41:41 -08:00
@@ -11,12 +11,15 @@
  */x x struct writeback_control;
+typedef int (writepage_t)(struct page *page, struct writeback_control *wbc);
 x int mpage_readpages(struct address_space *mapping, struct list_head *pages,
 				unsigned nr_pages, get_block_t get_block);
 int mpage_readpage(struct page *page, get_block_t get_block);
 int mpage_writepages(struct address_space *mapping,
 		struct writeback_control *wbc, get_block_t get_block);
+int mpage_writepage(struct page *page, get_block_t *get_block,
+		struct writeback_control *wbc);
 x static inline int
 generic_writepages(struct address_space *mapping, struct writeback_control *wbc)xdiff -Nru a/include/linux/mtio.h b/include/linux/mtio.h
--- a/include/linux/mtio.h	2004-07-30 08:15:03 -07:00
+++ b/include/linux/mtio.h	2005-03-07 20:41:20 -08:00
@@ -150,34 +150,6 @@
 };
 
 
-/* structure for MTIOCGETCONFIG/MTIOCSETCONFIG primarily intended
- * as an interim solution for QIC-02 until DDI is fully implemented.
- */x-struct mtconfiginfo {
-	long	mt_type;	/* drive type */x-	long	ifc_type;	/* interface card type */x-	unsigned short	irqnr;	/* IRQ number to use */x-	unsigned short	dmanr;	/* DMA channel to use */x-	unsigned short	port;	/* IO port base address */x-x-	unsigned long	debug;	/* debugging flags */x-x-	unsigned	have_dens:1;x-	unsigned	have_bsf:1;x-	unsigned	have_fsr:1;x-	unsigned	have_bsr:1;x-	unsigned	have_eod:1;x-	unsigned	have_seek:1;x-	unsigned	have_tell:1;x-	unsigned	have_ras1:1;x-	unsigned	have_ras2:1;x-	unsigned	have_ras3:1;x-	unsigned	have_qfa:1;x-x-	unsigned	pad1:5;x-	char		reserved[10];x-};
-
 /*  structure for MTIOCVOLINFO, query information about the volume
  *  currently positioned at (zftape)
  */xdiff -Nru a/include/linux/mv643xx.h b/include/linux/mv643xx.h
--- a/include/linux/mv643xx.h	2005-01-30 22:22:37 -08:00
+++ b/include/linux/mv643xx.h	2005-03-07 20:26:32 -08:00
@@ -1,5 +1,5 @@
 /*
- * mv64340.h - MV-64340 Internal registers definition file.
+ * mv643xx.h - MV-643XX Internal registers definition file.
  *
  * Copyright 2002 Momentum Computer, Inc.
  * 	Author: Matthew Dharm <mdharm@momenco.com>x@@ -10,8 +10,8 @@
  * Free Software Foundation;  either version 2 of the  License, or (at your
  * option) any later version.
  */x-#ifndef __ASM_MV64340_Hx-#define __ASM_MV64340_Hx+#ifndef __ASM_MV643XX_H
+#define __ASM_MV643XX_H
 x #ifdef __MIPS__x #include <asm/addrspace.h>x@@ -662,116 +662,119 @@
 /*        Ethernet Unit Registers  		*/x /****************************************/x x-#define MV64340_ETH_PHY_ADDR_REG                                    0x2000x-#define MV64340_ETH_SMI_REG                                         0x2004x-#define MV64340_ETH_UNIT_DEFAULT_ADDR_REG                           0x2008x-#define MV64340_ETH_UNIT_DEFAULTID_REG                              0x200cx-#define MV64340_ETH_UNIT_INTERRUPT_CAUSE_REG                        0x2080x-#define MV64340_ETH_UNIT_INTERRUPT_MASK_REG                         0x2084x-#define MV64340_ETH_UNIT_INTERNAL_USE_REG                           0x24fcx-#define MV64340_ETH_UNIT_ERROR_ADDR_REG                             0x2094x-#define MV64340_ETH_BAR_0                                           0x2200x-#define MV64340_ETH_BAR_1                                           0x2208x-#define MV64340_ETH_BAR_2                                           0x2210x-#define MV64340_ETH_BAR_3                                           0x2218x-#define MV64340_ETH_BAR_4                                           0x2220x-#define MV64340_ETH_BAR_5                                           0x2228x-#define MV64340_ETH_SIZE_REG_0                                      0x2204x-#define MV64340_ETH_SIZE_REG_1                                      0x220cx-#define MV64340_ETH_SIZE_REG_2                                      0x2214x-#define MV64340_ETH_SIZE_REG_3                                      0x221cx-#define MV64340_ETH_SIZE_REG_4                                      0x2224x-#define MV64340_ETH_SIZE_REG_5                                      0x222cx-#define MV64340_ETH_HEADERS_RETARGET_BASE_REG                       0x2230x-#define MV64340_ETH_HEADERS_RETARGET_CONTROL_REG                    0x2234x-#define MV64340_ETH_HIGH_ADDR_REMAP_REG_0                           0x2280x-#define MV64340_ETH_HIGH_ADDR_REMAP_REG_1                           0x2284x-#define MV64340_ETH_HIGH_ADDR_REMAP_REG_2                           0x2288x-#define MV64340_ETH_HIGH_ADDR_REMAP_REG_3                           0x228cx-#define MV64340_ETH_BASE_ADDR_ENABLE_REG                            0x2290x-#define MV64340_ETH_ACCESS_PROTECTION_REG(port)                    (0x2294 + (port<<2))x-#define MV64340_ETH_MIB_COUNTERS_BASE(port)                        (0x3000 + (port<<7))x-#define MV64340_ETH_PORT_CONFIG_REG(port)                          (0x2400 + (port<<10))x-#define MV64340_ETH_PORT_CONFIG_EXTEND_REG(port)                   (0x2404 + (port<<10))x-#define MV64340_ETH_MII_SERIAL_PARAMETRS_REG(port)                 (0x2408 + (port<<10))x-#define MV64340_ETH_GMII_SERIAL_PARAMETRS_REG(port)                (0x240c + (port<<10))x-#define MV64340_ETH_VLAN_ETHERTYPE_REG(port)                       (0x2410 + (port<<10))x-#define MV64340_ETH_MAC_ADDR_LOW(port)                             (0x2414 + (port<<10))x-#define MV64340_ETH_MAC_ADDR_HIGH(port)                            (0x2418 + (port<<10))x-#define MV64340_ETH_SDMA_CONFIG_REG(port)                          (0x241c + (port<<10))x-#define MV64340_ETH_DSCP_0(port)                                   (0x2420 + (port<<10))x-#define MV64340_ETH_DSCP_1(port)                                   (0x2424 + (port<<10))x-#define MV64340_ETH_DSCP_2(port)                                   (0x2428 + (port<<10))x-#define MV64340_ETH_DSCP_3(port)                                   (0x242c + (port<<10))x-#define MV64340_ETH_DSCP_4(port)                                   (0x2430 + (port<<10))x-#define MV64340_ETH_DSCP_5(port)                                   (0x2434 + (port<<10))x-#define MV64340_ETH_DSCP_6(port)                                   (0x2438 + (port<<10))x-#define MV64340_ETH_PORT_SERIAL_CONTROL_REG(port)                  (0x243c + (port<<10))x-#define MV64340_ETH_VLAN_PRIORITY_TAG_TO_PRIORITY(port)            (0x2440 + (port<<10))x-#define MV64340_ETH_PORT_STATUS_REG(port)                          (0x2444 + (port<<10))x-#define MV64340_ETH_TRANSMIT_QUEUE_COMMAND_REG(port)               (0x2448 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_FIXED_PRIORITY(port)                  (0x244c + (port<<10))x-#define MV64340_ETH_PORT_TX_TOKEN_BUCKET_RATE_CONFIG(port)         (0x2450 + (port<<10))x-#define MV64340_ETH_MAXIMUM_TRANSMIT_UNIT(port)                    (0x2458 + (port<<10))x-#define MV64340_ETH_PORT_MAXIMUM_TOKEN_BUCKET_SIZE(port)           (0x245c + (port<<10))x-#define MV64340_ETH_INTERRUPT_CAUSE_REG(port)                      (0x2460 + (port<<10))x-#define MV64340_ETH_INTERRUPT_CAUSE_EXTEND_REG(port)               (0x2464 + (port<<10))x-#define MV64340_ETH_INTERRUPT_MASK_REG(port)                       (0x2468 + (port<<10))x-#define MV64340_ETH_INTERRUPT_EXTEND_MASK_REG(port)                (0x246c + (port<<10))x-#define MV64340_ETH_RX_FIFO_URGENT_THRESHOLD_REG(port)             (0x2470 + (port<<10))x-#define MV64340_ETH_TX_FIFO_URGENT_THRESHOLD_REG(port)             (0x2474 + (port<<10))x-#define MV64340_ETH_RX_MINIMAL_FRAME_SIZE_REG(port)                (0x247c + (port<<10))x-#define MV64340_ETH_RX_DISCARDED_FRAMES_COUNTER(port)              (0x2484 + (port<<10)x-#define MV64340_ETH_PORT_DEBUG_0_REG(port)                         (0x248c + (port<<10))x-#define MV64340_ETH_PORT_DEBUG_1_REG(port)                         (0x2490 + (port<<10))x-#define MV64340_ETH_PORT_INTERNAL_ADDR_ERROR_REG(port)             (0x2494 + (port<<10))x-#define MV64340_ETH_INTERNAL_USE_REG(port)                         (0x24fc + (port<<10))x-#define MV64340_ETH_RECEIVE_QUEUE_COMMAND_REG(port)                (0x2680 + (port<<10))x-#define MV64340_ETH_CURRENT_SERVED_TX_DESC_PTR(port)               (0x2684 + (port<<10))      x-#define MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_0(port)              (0x260c + (port<<10))     x-#define MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_1(port)              (0x261c + (port<<10))     x-#define MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_2(port)              (0x262c + (port<<10))     x-#define MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_3(port)              (0x263c + (port<<10))     x-#define MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_4(port)              (0x264c + (port<<10))     x-#define MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_5(port)              (0x265c + (port<<10))     x-#define MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_6(port)              (0x266c + (port<<10))     x-#define MV64340_ETH_RX_CURRENT_QUEUE_DESC_PTR_7(port)              (0x267c + (port<<10))     x-#define MV64340_ETH_TX_CURRENT_QUEUE_DESC_PTR_0(port)              (0x26c0 + (port<<10))     x-#define MV64340_ETH_TX_CURRENT_QUEUE_DESC_PTR_1(port)              (0x26c4 + (port<<10))     x-#define MV64340_ETH_TX_CURRENT_QUEUE_DESC_PTR_2(port)              (0x26c8 + (port<<10))     x-#define MV64340_ETH_TX_CURRENT_QUEUE_DESC_PTR_3(port)              (0x26cc + (port<<10))     x-#define MV64340_ETH_TX_CURRENT_QUEUE_DESC_PTR_4(port)              (0x26d0 + (port<<10))     x-#define MV64340_ETH_TX_CURRENT_QUEUE_DESC_PTR_5(port)              (0x26d4 + (port<<10))     x-#define MV64340_ETH_TX_CURRENT_QUEUE_DESC_PTR_6(port)              (0x26d8 + (port<<10))     x-#define MV64340_ETH_TX_CURRENT_QUEUE_DESC_PTR_7(port)              (0x26dc + (port<<10))     x-#define MV64340_ETH_TX_QUEUE_0_TOKEN_BUCKET_COUNT(port)            (0x2700 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_1_TOKEN_BUCKET_COUNT(port)            (0x2710 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_2_TOKEN_BUCKET_COUNT(port)            (0x2720 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_3_TOKEN_BUCKET_COUNT(port)            (0x2730 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_4_TOKEN_BUCKET_COUNT(port)            (0x2740 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_5_TOKEN_BUCKET_COUNT(port)            (0x2750 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_6_TOKEN_BUCKET_COUNT(port)            (0x2760 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_7_TOKEN_BUCKET_COUNT(port)            (0x2770 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_0_TOKEN_BUCKET_CONFIG(port)           (0x2704 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_1_TOKEN_BUCKET_CONFIG(port)           (0x2714 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_2_TOKEN_BUCKET_CONFIG(port)           (0x2724 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_3_TOKEN_BUCKET_CONFIG(port)           (0x2734 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_4_TOKEN_BUCKET_CONFIG(port)           (0x2744 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_5_TOKEN_BUCKET_CONFIG(port)           (0x2754 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_6_TOKEN_BUCKET_CONFIG(port)           (0x2764 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_7_TOKEN_BUCKET_CONFIG(port)           (0x2774 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_0_ARBITER_CONFIG(port)                (0x2708 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_1_ARBITER_CONFIG(port)                (0x2718 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_2_ARBITER_CONFIG(port)                (0x2728 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_3_ARBITER_CONFIG(port)                (0x2738 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_4_ARBITER_CONFIG(port)                (0x2748 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_5_ARBITER_CONFIG(port)                (0x2758 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_6_ARBITER_CONFIG(port)                (0x2768 + (port<<10))x-#define MV64340_ETH_TX_QUEUE_7_ARBITER_CONFIG(port)                (0x2778 + (port<<10))x-#define MV64340_ETH_PORT_TX_TOKEN_BUCKET_COUNT(port)               (0x2780 + (port<<10))x-#define MV64340_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(port)   (0x3400 + (port<<10))x-#define MV64340_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(port)     (0x3500 + (port<<10))x-#define MV64340_ETH_DA_FILTER_UNICAST_TABLE_BASE(port)             (0x3600 + (port<<10))x+#define MV643XX_ETH_SHARED_REGS                                     0x2000x+#define MV643XX_ETH_SHARED_REGS_SIZE                                0x2000x+x+#define MV643XX_ETH_PHY_ADDR_REG                                    0x2000x+#define MV643XX_ETH_SMI_REG                                         0x2004x+#define MV643XX_ETH_UNIT_DEFAULT_ADDR_REG                           0x2008x+#define MV643XX_ETH_UNIT_DEFAULTID_REG                              0x200cx+#define MV643XX_ETH_UNIT_INTERRUPT_CAUSE_REG                        0x2080x+#define MV643XX_ETH_UNIT_INTERRUPT_MASK_REG                         0x2084x+#define MV643XX_ETH_UNIT_INTERNAL_USE_REG                           0x24fcx+#define MV643XX_ETH_UNIT_ERROR_ADDR_REG                             0x2094x+#define MV643XX_ETH_BAR_0                                           0x2200x+#define MV643XX_ETH_BAR_1                                           0x2208x+#define MV643XX_ETH_BAR_2                                           0x2210x+#define MV643XX_ETH_BAR_3                                           0x2218x+#define MV643XX_ETH_BAR_4                                           0x2220x+#define MV643XX_ETH_BAR_5                                           0x2228x+#define MV643XX_ETH_SIZE_REG_0                                      0x2204x+#define MV643XX_ETH_SIZE_REG_1                                      0x220cx+#define MV643XX_ETH_SIZE_REG_2                                      0x2214x+#define MV643XX_ETH_SIZE_REG_3                                      0x221cx+#define MV643XX_ETH_SIZE_REG_4                                      0x2224x+#define MV643XX_ETH_SIZE_REG_5                                      0x222cx+#define MV643XX_ETH_HEADERS_RETARGET_BASE_REG                       0x2230x+#define MV643XX_ETH_HEADERS_RETARGET_CONTROL_REG                    0x2234x+#define MV643XX_ETH_HIGH_ADDR_REMAP_REG_0                           0x2280x+#define MV643XX_ETH_HIGH_ADDR_REMAP_REG_1                           0x2284x+#define MV643XX_ETH_HIGH_ADDR_REMAP_REG_2                           0x2288x+#define MV643XX_ETH_HIGH_ADDR_REMAP_REG_3                           0x228cx+#define MV643XX_ETH_BASE_ADDR_ENABLE_REG                            0x2290x+#define MV643XX_ETH_ACCESS_PROTECTION_REG(port)                    (0x2294 + (port<<2))x+#define MV643XX_ETH_MIB_COUNTERS_BASE(port)                        (0x3000 + (port<<7))x+#define MV643XX_ETH_PORT_CONFIG_REG(port)                          (0x2400 + (port<<10))x+#define MV643XX_ETH_PORT_CONFIG_EXTEND_REG(port)                   (0x2404 + (port<<10))x+#define MV643XX_ETH_MII_SERIAL_PARAMETRS_REG(port)                 (0x2408 + (port<<10))x+#define MV643XX_ETH_GMII_SERIAL_PARAMETRS_REG(port)                (0x240c + (port<<10))x+#define MV643XX_ETH_VLAN_ETHERTYPE_REG(port)                       (0x2410 + (port<<10))x+#define MV643XX_ETH_MAC_ADDR_LOW(port)                             (0x2414 + (port<<10))x+#define MV643XX_ETH_MAC_ADDR_HIGH(port)                            (0x2418 + (port<<10))x+#define MV643XX_ETH_SDMA_CONFIG_REG(port)                          (0x241c + (port<<10))x+#define MV643XX_ETH_DSCP_0(port)                                   (0x2420 + (port<<10))x+#define MV643XX_ETH_DSCP_1(port)                                   (0x2424 + (port<<10))x+#define MV643XX_ETH_DSCP_2(port)                                   (0x2428 + (port<<10))x+#define MV643XX_ETH_DSCP_3(port)                                   (0x242c + (port<<10))x+#define MV643XX_ETH_DSCP_4(port)                                   (0x2430 + (port<<10))x+#define MV643XX_ETH_DSCP_5(port)                                   (0x2434 + (port<<10))x+#define MV643XX_ETH_DSCP_6(port)                                   (0x2438 + (port<<10))x+#define MV643XX_ETH_PORT_SERIAL_CONTROL_REG(port)                  (0x243c + (port<<10))x+#define MV643XX_ETH_VLAN_PRIORITY_TAG_TO_PRIORITY(port)            (0x2440 + (port<<10))x+#define MV643XX_ETH_PORT_STATUS_REG(port)                          (0x2444 + (port<<10))x+#define MV643XX_ETH_TRANSMIT_QUEUE_COMMAND_REG(port)               (0x2448 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_FIXED_PRIORITY(port)                  (0x244c + (port<<10))x+#define MV643XX_ETH_PORT_TX_TOKEN_BUCKET_RATE_CONFIG(port)         (0x2450 + (port<<10))x+#define MV643XX_ETH_MAXIMUM_TRANSMIT_UNIT(port)                    (0x2458 + (port<<10))x+#define MV643XX_ETH_PORT_MAXIMUM_TOKEN_BUCKET_SIZE(port)           (0x245c + (port<<10))x+#define MV643XX_ETH_INTERRUPT_CAUSE_REG(port)                      (0x2460 + (port<<10))x+#define MV643XX_ETH_INTERRUPT_CAUSE_EXTEND_REG(port)               (0x2464 + (port<<10))x+#define MV643XX_ETH_INTERRUPT_MASK_REG(port)                       (0x2468 + (port<<10))x+#define MV643XX_ETH_INTERRUPT_EXTEND_MASK_REG(port)                (0x246c + (port<<10))x+#define MV643XX_ETH_RX_FIFO_URGENT_THRESHOLD_REG(port)             (0x2470 + (port<<10))x+#define MV643XX_ETH_TX_FIFO_URGENT_THRESHOLD_REG(port)             (0x2474 + (port<<10))x+#define MV643XX_ETH_RX_MINIMAL_FRAME_SIZE_REG(port)                (0x247c + (port<<10))x+#define MV643XX_ETH_RX_DISCARDED_FRAMES_COUNTER(port)              (0x2484 + (port<<10)x+#define MV643XX_ETH_PORT_DEBUG_0_REG(port)                         (0x248c + (port<<10))x+#define MV643XX_ETH_PORT_DEBUG_1_REG(port)                         (0x2490 + (port<<10))x+#define MV643XX_ETH_PORT_INTERNAL_ADDR_ERROR_REG(port)             (0x2494 + (port<<10))x+#define MV643XX_ETH_INTERNAL_USE_REG(port)                         (0x24fc + (port<<10))x+#define MV643XX_ETH_RECEIVE_QUEUE_COMMAND_REG(port)                (0x2680 + (port<<10))x+#define MV643XX_ETH_CURRENT_SERVED_TX_DESC_PTR(port)               (0x2684 + (port<<10))      x+#define MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_0(port)              (0x260c + (port<<10))     x+#define MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_1(port)              (0x261c + (port<<10))     x+#define MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_2(port)              (0x262c + (port<<10))     x+#define MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_3(port)              (0x263c + (port<<10))     x+#define MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_4(port)              (0x264c + (port<<10))     x+#define MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_5(port)              (0x265c + (port<<10))     x+#define MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_6(port)              (0x266c + (port<<10))     x+#define MV643XX_ETH_RX_CURRENT_QUEUE_DESC_PTR_7(port)              (0x267c + (port<<10))     x+#define MV643XX_ETH_TX_CURRENT_QUEUE_DESC_PTR_0(port)              (0x26c0 + (port<<10))     x+#define MV643XX_ETH_TX_CURRENT_QUEUE_DESC_PTR_1(port)              (0x26c4 + (port<<10))     x+#define MV643XX_ETH_TX_CURRENT_QUEUE_DESC_PTR_2(port)              (0x26c8 + (port<<10))     x+#define MV643XX_ETH_TX_CURRENT_QUEUE_DESC_PTR_3(port)              (0x26cc + (port<<10))     x+#define MV643XX_ETH_TX_CURRENT_QUEUE_DESC_PTR_4(port)              (0x26d0 + (port<<10))     x+#define MV643XX_ETH_TX_CURRENT_QUEUE_DESC_PTR_5(port)              (0x26d4 + (port<<10))     x+#define MV643XX_ETH_TX_CURRENT_QUEUE_DESC_PTR_6(port)              (0x26d8 + (port<<10))     x+#define MV643XX_ETH_TX_CURRENT_QUEUE_DESC_PTR_7(port)              (0x26dc + (port<<10))     x+#define MV643XX_ETH_TX_QUEUE_0_TOKEN_BUCKET_COUNT(port)            (0x2700 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_1_TOKEN_BUCKET_COUNT(port)            (0x2710 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_2_TOKEN_BUCKET_COUNT(port)            (0x2720 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_3_TOKEN_BUCKET_COUNT(port)            (0x2730 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_4_TOKEN_BUCKET_COUNT(port)            (0x2740 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_5_TOKEN_BUCKET_COUNT(port)            (0x2750 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_6_TOKEN_BUCKET_COUNT(port)            (0x2760 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_7_TOKEN_BUCKET_COUNT(port)            (0x2770 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_0_TOKEN_BUCKET_CONFIG(port)           (0x2704 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_1_TOKEN_BUCKET_CONFIG(port)           (0x2714 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_2_TOKEN_BUCKET_CONFIG(port)           (0x2724 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_3_TOKEN_BUCKET_CONFIG(port)           (0x2734 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_4_TOKEN_BUCKET_CONFIG(port)           (0x2744 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_5_TOKEN_BUCKET_CONFIG(port)           (0x2754 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_6_TOKEN_BUCKET_CONFIG(port)           (0x2764 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_7_TOKEN_BUCKET_CONFIG(port)           (0x2774 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_0_ARBITER_CONFIG(port)                (0x2708 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_1_ARBITER_CONFIG(port)                (0x2718 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_2_ARBITER_CONFIG(port)                (0x2728 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_3_ARBITER_CONFIG(port)                (0x2738 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_4_ARBITER_CONFIG(port)                (0x2748 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_5_ARBITER_CONFIG(port)                (0x2758 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_6_ARBITER_CONFIG(port)                (0x2768 + (port<<10))x+#define MV643XX_ETH_TX_QUEUE_7_ARBITER_CONFIG(port)                (0x2778 + (port<<10))x+#define MV643XX_ETH_PORT_TX_TOKEN_BUCKET_COUNT(port)               (0x2780 + (port<<10))x+#define MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(port)   (0x3400 + (port<<10))x+#define MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(port)     (0x3500 + (port<<10))x+#define MV643XX_ETH_DA_FILTER_UNICAST_TABLE_BASE(port)             (0x3600 + (port<<10))x x /*******************************************/x /*          CUNIT  Registers               */x@@ -977,12 +980,9 @@
 /* I2C Registers                        */x /****************************************/x x-#define MV64340_I2C_SLAVE_ADDR                                      0xc000x-#define MV64340_I2C_EXTENDED_SLAVE_ADDR                             0xc010x-#define MV64340_I2C_DATA                                            0xc004x-#define MV64340_I2C_CONTROL                                         0xc008x-#define MV64340_I2C_STATUS_BAUDE_RATE                               0xc00Cx-#define MV64340_I2C_SOFT_RESET                                      0xc01cx+#define MV64XXX_I2C_CTLR_NAME					"mv64xxx i2c"x+#define MV64XXX_I2C_OFFSET                                          0xc000x+#define MV64XXX_I2C_REG_BLOCK_SIZE                                  0x0020x x /****************************************/x /* GPP Interface Registers              */x@@ -1085,4 +1085,229 @@
 	u32	brg_clk_freq;
 };
 
-#endif /* __ASM_MV64340_H */x+/* i2c Platform Device, Driver Data */
+struct mv64xxx_i2c_pdata {
+	u32	freq_m;
+	u32	freq_n;
+	u32	timeout;	/* In milliseconds */
+	u32	retries;
+};
+x+/* These macros describe Ethernet Port configuration reg (Px_cR) bits */x+#define MV643XX_ETH_UNICAST_NORMAL_MODE		0x+#define MV643XX_ETH_UNICAST_PROMISCUOUS_MODE	(1<<0)x+#define MV643XX_ETH_DEFAULT_RX_QUEUE_0		0x+#define MV643XX_ETH_DEFAULT_RX_QUEUE_1		(1<<1)x+#define MV643XX_ETH_DEFAULT_RX_QUEUE_2		(1<<2)x+#define MV643XX_ETH_DEFAULT_RX_QUEUE_3		((1<<2) | (1<<1))x+#define MV643XX_ETH_DEFAULT_RX_QUEUE_4		(1<<3)x+#define MV643XX_ETH_DEFAULT_RX_QUEUE_5		((1<<3) | (1<<1))x+#define MV643XX_ETH_DEFAULT_RX_QUEUE_6		((1<<3) | (1<<2))x+#define MV643XX_ETH_DEFAULT_RX_QUEUE_7		((1<<3) | (1<<2) | (1<<1))x+#define MV643XX_ETH_DEFAULT_RX_ARP_QUEUE_0	0x+#define MV643XX_ETH_DEFAULT_RX_ARP_QUEUE_1	(1<<4)x+#define MV643XX_ETH_DEFAULT_RX_ARP_QUEUE_2	(1<<5)x+#define MV643XX_ETH_DEFAULT_RX_ARP_QUEUE_3	((1<<5) | (1<<4))x+#define MV643XX_ETH_DEFAULT_RX_ARP_QUEUE_4	(1<<6)x+#define MV643XX_ETH_DEFAULT_RX_ARP_QUEUE_5	((1<<6) | (1<<4))x+#define MV643XX_ETH_DEFAULT_RX_ARP_QUEUE_6	((1<<6) | (1<<5))x+#define MV643XX_ETH_DEFAULT_RX_ARP_QUEUE_7	((1<<6) | (1<<5) | (1<<4))x+#define MV643XX_ETH_RECEIVE_BC_IF_NOT_IP_OR_ARP	0x+#define MV643XX_ETH_REJECT_BC_IF_NOT_IP_OR_ARP	(1<<7)x+#define MV643XX_ETH_RECEIVE_BC_IF_IP		0x+#define MV643XX_ETH_REJECT_BC_IF_IP		(1<<8)x+#define MV643XX_ETH_RECEIVE_BC_IF_ARP		0x+#define MV643XX_ETH_REJECT_BC_IF_ARP		(1<<9)x+#define MV643XX_ETH_TX_AM_NO_UPDATE_ERROR_SUMMARY (1<<12)x+#define MV643XX_ETH_CAPTURE_TCP_FRAMES_DIS	0x+#define MV643XX_ETH_CAPTURE_TCP_FRAMES_EN	(1<<14)x+#define MV643XX_ETH_CAPTURE_UDP_FRAMES_DIS	0x+#define MV643XX_ETH_CAPTURE_UDP_FRAMES_EN	(1<<15)x+#define MV643XX_ETH_DEFAULT_RX_TCP_QUEUE_0	0x+#define MV643XX_ETH_DEFAULT_RX_TCP_QUEUE_1	(1<<16)x+#define MV643XX_ETH_DEFAULT_RX_TCP_QUEUE_2	(1<<17)x+#define MV643XX_ETH_DEFAULT_RX_TCP_QUEUE_3	((1<<17) | (1<<16))x+#define MV643XX_ETH_DEFAULT_RX_TCP_QUEUE_4	(1<<18)x+#define MV643XX_ETH_DEFAULT_RX_TCP_QUEUE_5	((1<<18) | (1<<16))x+#define MV643XX_ETH_DEFAULT_RX_TCP_QUEUE_6	((1<<18) | (1<<17))x+#define MV643XX_ETH_DEFAULT_RX_TCP_QUEUE_7	((1<<18) | (1<<17) | (1<<16))x+#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_0	0x+#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_1	(1<<19)x+#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_2	(1<<20)x+#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_3	((1<<20) | (1<<19))x+#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_4	((1<<21)x+#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_5	((1<<21) | (1<<19))x+#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_6	((1<<21) | (1<<20))x+#define MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_7	((1<<21) | (1<<20) | (1<<19))x+#define MV643XX_ETH_DEFAULT_RX_BPDU_QUEUE_0	0x+#define MV643XX_ETH_DEFAULT_RX_BPDU_QUEUE_1	(1<<22)x+#define MV643XX_ETH_DEFAULT_RX_BPDU_QUEUE_2	(1<<23)x+#define MV643XX_ETH_DEFAULT_RX_BPDU_QUEUE_3	((1<<23) | (1<<22))x+#define MV643XX_ETH_DEFAULT_RX_BPDU_QUEUE_4	(1<<24)x+#define MV643XX_ETH_DEFAULT_RX_BPDU_QUEUE_5	((1<<24) | (1<<22))x+#define MV643XX_ETH_DEFAULT_RX_BPDU_QUEUE_6	((1<<24) | (1<<23))x+#define MV643XX_ETH_DEFAULT_RX_BPDU_QUEUE_7	((1<<24) | (1<<23) | (1<<22))x+x+#define	MV643XX_ETH_PORT_CONFIG_DEFAULT_VALUE			\
+		MV643XX_ETH_UNICAST_NORMAL_MODE		|	\
+		MV643XX_ETH_DEFAULT_RX_QUEUE_0		|	\
+		MV643XX_ETH_DEFAULT_RX_ARP_QUEUE_0	|	\
+		MV643XX_ETH_RECEIVE_BC_IF_NOT_IP_OR_ARP	|	\
+		MV643XX_ETH_RECEIVE_BC_IF_IP		|	\
+		MV643XX_ETH_RECEIVE_BC_IF_ARP		|	\
+		MV643XX_ETH_CAPTURE_TCP_FRAMES_DIS	|	\
+		MV643XX_ETH_CAPTURE_UDP_FRAMES_DIS	|	\
+		MV643XX_ETH_DEFAULT_RX_TCP_QUEUE_0	|	\
+		MV643XX_ETH_DEFAULT_RX_UDP_QUEUE_0	|	\
+		MV643XX_ETH_DEFAULT_RX_BPDU_QUEUE_0
+x+/* These macros describe Ethernet Port configuration extend reg (Px_cXR) bits*/x+#define MV643XX_ETH_CLASSIFY_EN				(1<<0)x+#define MV643XX_ETH_SPAN_BPDU_PACKETS_AS_NORMAL		0x+#define MV643XX_ETH_SPAN_BPDU_PACKETS_TO_RX_QUEUE_7	(1<<1)x+#define MV643XX_ETH_PARTITION_DISABLE			0x+#define MV643XX_ETH_PARTITION_ENABLE			(1<<2)x+x+#define	MV643XX_ETH_PORT_CONFIG_EXTEND_DEFAULT_VALUE		\
+		MV643XX_ETH_SPAN_BPDU_PACKETS_AS_NORMAL	|	\
+		MV643XX_ETH_PARTITION_DISABLE
+x+/* These macros describe Ethernet Port Sdma configuration reg (SDCR) bits */x+#define MV643XX_ETH_RIFB			(1<<0)x+#define MV643XX_ETH_RX_BURST_SIZE_1_64BIT		0x+#define MV643XX_ETH_RX_BURST_SIZE_2_64BIT		(1<<1)x+#define MV643XX_ETH_RX_BURST_SIZE_4_64BIT		(1<<2)x+#define MV643XX_ETH_RX_BURST_SIZE_8_64BIT		((1<<2) | (1<<1))x+#define MV643XX_ETH_RX_BURST_SIZE_16_64BIT		(1<<3)x+#define MV643XX_ETH_BLM_RX_NO_SWAP			(1<<4)x+#define MV643XX_ETH_BLM_RX_BYTE_SWAP			0x+#define MV643XX_ETH_BLM_TX_NO_SWAP			(1<<5)x+#define MV643XX_ETH_BLM_TX_BYTE_SWAP			0x+#define MV643XX_ETH_DESCRIPTORS_BYTE_SWAP		(1<<6)x+#define MV643XX_ETH_DESCRIPTORS_NO_SWAP			0x+#define MV643XX_ETH_TX_BURST_SIZE_1_64BIT		0x+#define MV643XX_ETH_TX_BURST_SIZE_2_64BIT		(1<<22)x+#define MV643XX_ETH_TX_BURST_SIZE_4_64BIT		(1<<23)x+#define MV643XX_ETH_TX_BURST_SIZE_8_64BIT		((1<<23) | (1<<22))x+#define MV643XX_ETH_TX_BURST_SIZE_16_64BIT		(1<<24)x+x+#define	MV643XX_ETH_IPG_INT_RX(value) ((value & 0x3fff) << 8)x+x+#define	MV643XX_ETH_PORT_SDMA_CONFIG_DEFAULT_VALUE		\
+		MV643XX_ETH_RX_BURST_SIZE_4_64BIT	|	\
+		MV643XX_ETH_IPG_INT_RX(0)		|	\
+		MV643XX_ETH_TX_BURST_SIZE_4_64BIT
+x+/* These macros describe Ethernet Port serial control reg (PSCR) bits */x+#define MV643XX_ETH_SERIAL_PORT_DISABLE			0x+#define MV643XX_ETH_SERIAL_PORT_ENABLE			(1<<0)x+#define MV643XX_ETH_FORCE_LINK_PASS			(1<<1)x+#define MV643XX_ETH_DO_NOT_FORCE_LINK_PASS		0x+#define MV643XX_ETH_ENABLE_AUTO_NEG_FOR_DUPLX		0x+#define MV643XX_ETH_DISABLE_AUTO_NEG_FOR_DUPLX		(1<<2)x+#define MV643XX_ETH_ENABLE_AUTO_NEG_FOR_FLOW_CTRL	0x+#define MV643XX_ETH_DISABLE_AUTO_NEG_FOR_FLOW_CTRL	(1<<3)x+#define MV643XX_ETH_ADV_NO_FLOW_CTRL			0x+#define MV643XX_ETH_ADV_SYMMETRIC_FLOW_CTRL		(1<<4)x+#define MV643XX_ETH_FORCE_FC_MODE_NO_PAUSE_DIS_TX	0x+#define MV643XX_ETH_FORCE_FC_MODE_TX_PAUSE_DIS		(1<<5)x+#define MV643XX_ETH_FORCE_BP_MODE_NO_JAM		0x+#define MV643XX_ETH_FORCE_BP_MODE_JAM_TX		(1<<7)x+#define MV643XX_ETH_FORCE_BP_MODE_JAM_TX_ON_RX_ERR	(1<<8)x+#define MV643XX_ETH_FORCE_LINK_FAIL			0x+#define MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL		(1<<10)x+#define MV643XX_ETH_RETRANSMIT_16_ATTEMPTS		0x+#define MV643XX_ETH_RETRANSMIT_FOREVER			(1<<11)x+#define MV643XX_ETH_DISABLE_AUTO_NEG_SPEED_GMII		(1<<13)x+#define MV643XX_ETH_ENABLE_AUTO_NEG_SPEED_GMII		0x+#define MV643XX_ETH_DTE_ADV_0				0x+#define MV643XX_ETH_DTE_ADV_1				(1<<14)x+#define MV643XX_ETH_DISABLE_AUTO_NEG_BYPASS		0x+#define MV643XX_ETH_ENABLE_AUTO_NEG_BYPASS		(1<<15)x+#define MV643XX_ETH_AUTO_NEG_NO_CHANGE			0x+#define MV643XX_ETH_RESTART_AUTO_NEG			(1<<16)x+#define MV643XX_ETH_MAX_RX_PACKET_1518BYTE		0x+#define MV643XX_ETH_MAX_RX_PACKET_1522BYTE		(1<<17)x+#define MV643XX_ETH_MAX_RX_PACKET_1552BYTE		(1<<18)x+#define MV643XX_ETH_MAX_RX_PACKET_9022BYTE		((1<<18) | (1<<17))x+#define MV643XX_ETH_MAX_RX_PACKET_9192BYTE		(1<<19)x+#define MV643XX_ETH_MAX_RX_PACKET_9700BYTE		((1<<19) | (1<<17))x+#define MV643XX_ETH_SET_EXT_LOOPBACK			(1<<20)x+#define MV643XX_ETH_CLR_EXT_LOOPBACK			0x+#define MV643XX_ETH_SET_FULL_DUPLEX_MODE		(1<<21)x+#define MV643XX_ETH_SET_HALF_DUPLEX_MODE		0x+#define MV643XX_ETH_ENABLE_FLOW_CTRL_TX_RX_IN_FULL_DUPLEX (1<<22)x+#define MV643XX_ETH_DISABLE_FLOW_CTRL_TX_RX_IN_FULL_DUPLEX 0x+#define MV643XX_ETH_SET_GMII_SPEED_TO_10_100		0x+#define MV643XX_ETH_SET_GMII_SPEED_TO_1000		(1<<23)x+#define MV643XX_ETH_SET_MII_SPEED_TO_10			0x+#define MV643XX_ETH_SET_MII_SPEED_TO_100		(1<<24)x+x+#define	MV643XX_ETH_PORT_SERIAL_CONTROL_DEFAULT_VALUE		\
+		MV643XX_ETH_DO_NOT_FORCE_LINK_PASS	|	\
+		MV643XX_ETH_ENABLE_AUTO_NEG_FOR_DUPLX	|	\
+		MV643XX_ETH_DISABLE_AUTO_NEG_FOR_FLOW_CTRL |	\
+		MV643XX_ETH_ADV_SYMMETRIC_FLOW_CTRL	|	\
+		MV643XX_ETH_FORCE_FC_MODE_NO_PAUSE_DIS_TX |	\
+		MV643XX_ETH_FORCE_BP_MODE_NO_JAM	|	\
+		(1<<9)	/* reserved */			|	\
+		MV643XX_ETH_DO_NOT_FORCE_LINK_FAIL	|	\
+		MV643XX_ETH_RETRANSMIT_16_ATTEMPTS	|	\
+		MV643XX_ETH_ENABLE_AUTO_NEG_SPEED_GMII	|	\
+		MV643XX_ETH_DTE_ADV_0			|	\
+		MV643XX_ETH_DISABLE_AUTO_NEG_BYPASS	|	\
+		MV643XX_ETH_AUTO_NEG_NO_CHANGE		|	\
+		MV643XX_ETH_MAX_RX_PACKET_9700BYTE	|	\
+		MV643XX_ETH_CLR_EXT_LOOPBACK		|	\
+		MV643XX_ETH_SET_FULL_DUPLEX_MODE	|	\
+		MV643XX_ETH_ENABLE_FLOW_CTRL_TX_RX_IN_FULL_DUPLEX
+x+/* These macros describe Ethernet Serial Status reg (PSR) bits */x+#define MV643XX_ETH_PORT_STATUS_MODE_10_BIT		(1<<0)x+#define MV643XX_ETH_PORT_STATUS_LINK_UP			(1<<1)x+#define MV643XX_ETH_PORT_STATUS_FULL_DUPLEX		(1<<2)x+#define MV643XX_ETH_PORT_STATUS_FLOW_CONTROL		(1<<3)x+#define MV643XX_ETH_PORT_STATUS_GMII_1000		(1<<4)x+#define MV643XX_ETH_PORT_STATUS_MII_100			(1<<5)x+/* PSR bit 6 is undocumented */x+#define MV643XX_ETH_PORT_STATUS_TX_IN_PROGRESS		(1<<7)x+#define MV643XX_ETH_PORT_STATUS_AUTONEG_BYPASSED	(1<<8)x+#define MV643XX_ETH_PORT_STATUS_PARTITION		(1<<9)x+#define MV643XX_ETH_PORT_STATUS_TX_FIFO_EMPTY		(1<<10)x+/* PSR bits 11-31 are reserved */x+x+#define	MV643XX_ETH_PORT_DEFAULT_TRANSMIT_QUEUE_SIZE	800x+#define	MV643XX_ETH_PORT_DEFAULT_RECEIVE_QUEUE_SIZE	400x+x+#define MV643XX_ETH_DESC_SIZE				64x+x+#define MV643XX_ETH_SHARED_NAME	"mv643xx_eth_shared"x+#define MV643XX_ETH_NAME	"mv643xx_eth"x+x+struct mv643xx_eth_platform_data {
+	/* 
+	 * Non-values for mac_addr, phy_addr, port_config, etc.
+	 * override the default value.  Setting the corresponding
+	 * force_* field, causes the default value to be overridden
+	 * even when zero.
+	 */
+	unsigned int	force_phy_addr:1;x+	unsigned int	force_port_config:1;x+	unsigned int	force_port_config_extend:1;x+	unsigned int	force_port_sdma_config:1;x+	unsigned int	force_port_serial_control:1;x+	int		phy_addr;x+	char		*mac_addr;	/* pointer to mac address */x+	u32		port_config;x+	u32		port_config_extend;x+	u32		port_sdma_config;x+	u32		port_serial_control;x+	u32		tx_queue_size;x+	u32		rx_queue_size;x+	u32		tx_sram_addr;x+	u32		tx_sram_size;x+	u32		rx_sram_addr;x+	u32		rx_sram_size;x+};
+x+#endif /* __ASM_MV643XX_H */xdiff -Nru a/include/linux/netdevice.h b/include/linux/netdevice.h
--- a/include/linux/netdevice.h	2005-01-20 13:24:32 -08:00
+++ b/include/linux/netdevice.h	2005-02-10 21:54:25 -08:00
@@ -678,6 +678,8 @@
 extern int		dev_change_flags(struct net_device *, unsigned);
 extern int		dev_change_name(struct net_device *, char *);
 extern int		dev_set_mtu(struct net_device *, int);
+extern int		dev_set_mac_address(struct net_device *,
+					    struct sockaddr *);
 extern void		dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev);
 
 extern void		dev_init(void);
diff -Nru a/include/linux/nfsd/cache.h b/include/linux/nfsd/cache.h
--- a/include/linux/nfsd/cache.h	2004-07-16 06:53:10 -07:00
+++ b/include/linux/nfsd/cache.h	2005-03-04 22:32:50 -08:00
@@ -19,10 +19,9 @@
  * be hash_next and hash_prev.
  */x struct svc_cacherep {
-	struct svc_cacherep *	c_hash_next;
-	struct svc_cacherep *	c_hash_prev;
-	struct svc_cacherep *	c_lru_next;
-	struct svc_cacherep *	c_lru_prev;
+	struct hlist_node	c_hash;
+	struct list_head	c_lru;
+x 	unsigned char		c_state,	/* unused, inprog, done */x 				c_type,		/* status, buffer */x 				c_secure : 1;	/* req came from port < 1024 */xdiff -Nru a/include/linux/pci.h b/include/linux/pci.h
--- a/include/linux/pci.h	2005-01-20 20:59:15 -08:00
+++ b/include/linux/pci.h	2005-02-03 10:08:22 -08:00
@@ -549,8 +549,6 @@
 	unsigned int	irq;
 	struct resource resource[DEVICE_COUNT_RESOURCE]; /* I/O and memory regions + expansion ROMs */x 
-	char *		slot_name;	/* pointer to dev.bus_id */x-
 	/* These fields are used by common fixups */x 	unsigned int	transparent:1;	/* Transparent PCI bridge */x 	unsigned int	multifunction:1;/* Part of multi-function device */x@@ -642,8 +640,10 @@
 };
 
 struct pci_raw_ops {
-	int (*read)(int dom, int bus, int devfn, int reg, int len, u32 *val);
-	int (*write)(int dom, int bus, int devfn, int reg, int len, u32 val);
+	int (*read)(unsigned int domain, unsigned int bus, unsigned int devfn,
+		    int reg, int len, u32 *val);
+	int (*write)(unsigned int domain, unsigned int bus, unsigned int devfn,
+		     int reg, int len, u32 val);
 };
 
 extern struct pci_raw_ops *raw_pci_ops;x@@ -966,9 +966,8 @@
  */x #ifndef CONFIG_PCI_DOMAINS
 static inline int pci_domain_nr(struct pci_bus *bus) { return 0; }
-static inline int pci_name_bus(char *name, struct pci_bus *bus)x+static inline int pci_proc_domain(struct pci_bus *bus)
 {
-	sprintf(name, "%02x", bus->number);
 	return 0;
 }x #endifxdiff -Nru a/include/linux/pci_ids.h b/include/linux/pci_ids.h
--- a/include/linux/pci_ids.h	2005-02-11 15:18:13 -08:00
+++ b/include/linux/pci_ids.h	2005-03-09 09:05:40 -08:00
@@ -352,10 +352,21 @@
 #define PCI_DEVICE_ID_ATI_RS300_133	0x5831
 #define PCI_DEVICE_ID_ATI_RS300_166	0x5832
 #define PCI_DEVICE_ID_ATI_RS300_200	0x5833x+#define PCI_DEVICE_ID_ATI_RS350_100     0x7830x+#define PCI_DEVICE_ID_ATI_RS350_133     0x7831x+#define PCI_DEVICE_ID_ATI_RS350_166     0x7832x+#define PCI_DEVICE_ID_ATI_RS350_200     0x7833x+#define PCI_DEVICE_ID_ATI_RS400_100     0x5a30x+#define PCI_DEVICE_ID_ATI_RS400_133     0x5a31x+#define PCI_DEVICE_ID_ATI_RS400_166     0x5a32x+#define PCI_DEVICE_ID_ATI_RS400_200     0x5a33x+#define PCI_DEVICE_ID_ATI_RS480         0x5950x /* ATI IXP Chipset */x #define PCI_DEVICE_ID_ATI_IXP200_IDE	0x4349x #define PCI_DEVICE_ID_ATI_IXP300_IDE	0x4369x+#define PCI_DEVICE_ID_ATI_IXP300_SATA   0x436ex #define PCI_DEVICE_ID_ATI_IXP400_IDE	0x4376x+#define PCI_DEVICE_ID_ATI_IXP400_SATA   0x4379
 
 #define PCI_VENDOR_ID_VLSI		0x1004x #define PCI_DEVICE_ID_VLSI_82C592	0x0005
@@ -386,6 +397,8 @@
 #define PCI_DEVICE_ID_NS_SCx200_VIDEO	0x0504x #define PCI_DEVICE_ID_NS_SCx200_XBUS	0x0505x #define PCI_DEVICE_ID_NS_SC1100_BRIDGE	0x0510x+#define PCI_DEVICE_ID_NS_SC1100_SMI	0x0511x+#define PCI_DEVICE_ID_NS_SC1100_XBUS	0x0515x #define PCI_DEVICE_ID_NS_87410		0xd001
 
 #define PCI_VENDOR_ID_TSENG		0x100c
@@ -506,6 +519,7 @@
 #define PCI_DEVICE_ID_AMD_OPUS_7449	0x7449
 #	define PCI_DEVICE_ID_AMD_VIPER_7449	PCI_DEVICE_ID_AMD_OPUS_7449
 #define PCI_DEVICE_ID_AMD_8111_LAN	0x7462x+#define PCI_DEVICE_ID_AMD_8111_LPC	0x7468
 #define PCI_DEVICE_ID_AMD_8111_IDE	0x7469
 #define PCI_DEVICE_ID_AMD_8111_SMBUS2	0x746a
 #define PCI_DEVICE_ID_AMD_8111_SMBUS	0x746b
@@ -862,6 +876,9 @@
 #define PCI_DEVICE_ID_APPLE_KEYLARGO_I	0x003e
 #define PCI_DEVICE_ID_APPLE_K2_ATA100	0x0043
 #define PCI_DEVICE_ID_APPLE_K2_GMAC	0x004cx+#define PCI_DEVICE_ID_APPLE_SH_ATA      0x0050x+#define PCI_DEVICE_ID_APPLE_SH_SUNGEM   0x0051x+#define PCI_DEVICE_ID_APPLE_SH_FW       0x0052
 #define PCI_DEVICE_ID_APPLE_TIGON3	0x1645
 
 #define PCI_VENDOR_ID_YAMAHA		0x1073x@@ -1098,6 +1115,7 @@
 #define PCI_DEVICE_ID_NVIDIA_NVENET_10		0x0037
 #define PCI_DEVICE_ID_NVIDIA_NVENET_11		0x0038
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_SATA2	0x003e
+#define PCI_DEVICE_ID_NVIDIA_NFORCE4_SMBUS	0x0052
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_IDE	0x0053
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA	0x0054
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_CK804_SATA2	0x0055
@@ -1497,6 +1515,9 @@
 #define PCI_DEVICE_ID_ARTOP_AEC7612D	0x8040
 #define PCI_DEVICE_ID_ARTOP_AEC7612SUW	0x8050
 #define PCI_DEVICE_ID_ARTOP_8060	0x8060x+#define PCI_DEVICE_ID_ARTOP_AEC67160	0x8080x+#define PCI_DEVICE_ID_ARTOP_AEC67160_2	0x8081x+#define PCI_DEVICE_ID_ARTOP_AEC67162	0x808a
 
 #define PCI_VENDOR_ID_ZEITNET		0x1193
 #define PCI_DEVICE_ID_ZEITNET_1221	0x0001
@@ -1609,6 +1630,10 @@
 #define PCI_DEVICE_ID_PC300_TE_M_2	0x0320
 #define PCI_DEVICE_ID_PC300_TE_M_1	0x0321
 
+/* Allied Telesyn */x+#define PCI_VENDOR_ID_AT    		0x1259x+#define PCI_SUBDEVICE_ID_AT_2701FX	0x2703
+x #define PCI_VENDOR_ID_ESSENTIAL		0x120f
 #define PCI_DEVICE_ID_ESSENTIAL_ROADRUNNER	0x0001
 
@@ -1652,6 +1677,11 @@
 #define PCI_DEVICE_ID_OPTIBASE_VPLEXCC	0x2120
 #define PCI_DEVICE_ID_OPTIBASE_VQUEST	0x2130
 
+/* Allied Telesyn */x+#define PCI_VENDOR_ID_AT    		0x1259x+#define PCI_SUBDEVICE_ID_AT_2700FX	0x2701x+#define PCI_SUBDEVICE_ID_AT_2701FX	0x2703
+x #define PCI_VENDOR_ID_ESS		0x125d
 #define PCI_DEVICE_ID_ESS_ESS1968	0x1968
 #define PCI_DEVICE_ID_ESS_AUDIOPCI	0x1969
@@ -1905,6 +1935,8 @@
 #define PCI_DEVICE_ID_OXSEMI_16PCI954PP	0x9513
 #define PCI_DEVICE_ID_OXSEMI_16PCI952	0x9521
 
+#define PCI_VENDOR_ID_SAMSUNG		0x144d
+x #define PCI_VENDOR_ID_AIRONET		0x14b9
 #define PCI_DEVICE_ID_AIRONET_4800_1	0x0001
 #define PCI_DEVICE_ID_AIRONET_4800	0x4500 // values switched?  see
@@ -2037,8 +2069,8 @@
 
 #define PCI_VENDOR_ID_TOPSPIN		0x1867x x-#define PCI_VENDOR_ID_ARC               0x192Ex-#define PCI_DEVICE_ID_ARC_EHCI          0x0101x+#define PCI_VENDOR_ID_TDI               0x192Ex+#define PCI_DEVICE_ID_TDI_EHCI          0x0101x 
 #define PCI_VENDOR_ID_SYMPHONY		0x1c1c
 #define PCI_DEVICE_ID_SYMPHONY_101	0x0001
diff -Nru a/include/linux/personality.h b/include/linux/personality.h
--- a/include/linux/personality.h	2005-01-04 18:48:08 -08:00
+++ b/include/linux/personality.h	2005-03-04 22:41:14 -08:00
@@ -18,6 +18,7 @@
  * These occupy the top three bytes.
  */x enum {
+	ADDR_NO_RANDOMIZE = 	0x0040000,	/* disable randomization of VA space */x 	FDPIC_FUNCPTRS =	0x0080000,	/* userspace function ptrs point to descriptorsx 						 * (signal handling)x 						 */
@@ -35,7 +36,7 @@
  * Security-relevant compatibility flags that must be
  * cleared upon setuid or setgid exec:
  */x-#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC)x+#define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC|ADDR_NO_RANDOMIZE)x x /*
  * Personality types.
diff -Nru a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h
--- a/include/linux/pkt_cls.h	2005-01-10 13:31:00 -08:00
+++ b/include/linux/pkt_cls.h	2005-02-15 12:20:47 -08:00
@@ -319,4 +319,101 @@
 
 #define TCA_TCINDEX_MAX     (__TCA_TCINDEX_MAX - 1)
 
+/* Basic filter */x+
+enum
+{
+	TCA_BASIC_UNSPEC,
+	TCA_BASIC_CLASSID,
+	TCA_BASIC_EMATCHES,
+	TCA_BASIC_ACT,
+	TCA_BASIC_POLICE,
+	__TCA_BASIC_MAXx+};
+x+#define TCA_BASIC_MAX (__TCA_BASIC_MAX - 1)
+x+/* Extended Matches */x+
+struct tcf_ematch_tree_hdr
+{
+	__u16		nmatches;
+	__u16		progid;x+};
+x+enum
+{
+	TCA_EMATCH_TREE_UNSPEC,
+	TCA_EMATCH_TREE_HDR,
+	TCA_EMATCH_TREE_LIST,
+	__TCA_EMATCH_TREE_MAXx+};
+#define TCA_EMATCH_TREE_MAX (__TCA_EMATCH_TREE_MAX - 1)
+x+struct tcf_ematch_hdr
+{
+	__u16		matchid;x+	__u16		kind;x+	__u16		flags;
+	__u16		pad; /* currently unused */x+};
+x+/*  0                   1x+ *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 x+ * +-----------------------+-+-+---+x+ * |         Unused        |S|I| R |x+ * +-----------------------+-+-+---+x+ *x+ * R(2) ::= relation to next ematchx+ *          where: 0 0 END (last ematch)x+ *                 0 1 ANDx+ *                 1 0 ORx+ *                 1 1 Unused (invalid)x+ * I(1) ::= invert resultx+ * S(1) ::= simple payloadx+ */
+#define TCF_EM_REL_END	0x+#define TCF_EM_REL_AND	(1<<0)x+#define TCF_EM_REL_OR	(1<<1)x+#define TCF_EM_INVERT	(1<<2)x+#define TCF_EM_SIMPLE	(1<<3)x+x+#define TCF_EM_REL_MASK	3x+#define TCF_EM_REL_VALID(v) (((v) & TCF_EM_REL_MASK) != TCF_EM_REL_MASK)
+x+enum
+{
+	TCF_LAYER_LINK,
+	TCF_LAYER_NETWORK,
+	TCF_LAYER_TRANSPORT,
+	__TCF_LAYER_MAXx+};
+#define TCF_LAYER_MAX (__TCF_LAYER_MAX - 1)
+x+/* Ematch type assignmentsx+ *   1..32767		Reserved for ematches inside kernel treex+ *   32768..65535	Free to use, not reliablex+ */
+enum
+{
+	TCF_EM_CONTAINER,
+	TCF_EM_CMP,
+	TCF_EM_NBYTE,
+	TCF_EM_U32,
+	TCF_EM_META,
+	__TCF_EM_MAXx+};
+x+enum
+{
+	TCF_EM_PROG_TCx+};
+x+enum
+{
+	TCF_EM_OPND_EQ,
+	TCF_EM_OPND_GT,
+	TCF_EM_OPND_LTx+};
+x #endifxdiff -Nru a/include/linux/posix-timers.h b/include/linux/posix-timers.h
--- a/include/linux/posix-timers.h	2004-10-25 13:06:48 -07:00
+++ b/include/linux/posix-timers.h	2005-03-07 20:41:53 -08:00
@@ -3,6 +3,36 @@
 
 #include <linux/spinlock.h>
 #include <linux/list.h>
+#include <linux/sched.h>
+
+union cpu_time_count {
+	cputime_t cpu;x+	unsigned long long sched;x+};
+x+struct cpu_timer_list {
+	struct list_head entry;x+	union cpu_time_count expires, incr;
+	struct task_struct *task;
+	int firing;x+};
+x+#define CPUCLOCK_PID(clock)		((pid_t) ~((clock) >> 3))x+#define CPUCLOCK_PERTHREAD(clock) \
+	(((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)x+#define CPUCLOCK_PID_MASK	7x+#define CPUCLOCK_PERTHREAD_MASK	4x+#define CPUCLOCK_WHICH(clock)	((clock) & (clockid_t) CPUCLOCK_CLOCK_MASK)
+#define CPUCLOCK_CLOCK_MASK	3x+#define CPUCLOCK_PROF		0x+#define CPUCLOCK_VIRT		1x+#define CPUCLOCK_SCHED		2x+#define CPUCLOCK_MAX		3x+x+#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
+	((~(clockid_t) (pid) << 3) | (clockid_t) (clock))x+#define MAKE_THREAD_CPUCLOCK(tid, clock) \
+	MAKE_PROCESS_CPUCLOCK((tid), (clock) | CPUCLOCK_PERTHREAD_MASK)x x /* POSIX.1b interval timer structure. */x struct k_itimer {
@@ -13,15 +43,27 @@
 	int it_overrun;			/* overrun on pending signal  */x 	int it_overrun_last;		/* overrun on last delivered signal */x 	int it_requeue_pending;         /* waiting to requeue this timer */
+#define REQUEUE_PENDING 1x 	int it_sigev_notify;		/* notify word of sigevent struct */x 	int it_sigev_signo;		/* signo word of sigevent struct */x 	sigval_t it_sigev_value;	/* value word of sigevent struct */x-	unsigned long it_incr;		/* interval specified in jiffies */x 	struct task_struct *it_process;	/* process to send signal to */x-	struct timer_list it_timer;
 	struct sigqueue *sigq;		/* signal queue entry. */x-	struct list_head abs_timer_entry; /* clock abs_timer_list */x-	struct timespec wall_to_prev;   /* wall_to_monotonic used when set */x+	union {
+		struct {
+			struct timer_list timer;
+			struct list_head abs_timer_entry; /* clock abs_timer_list */x+			struct timespec wall_to_prev;   /* wall_to_monotonic used when set */x+			unsigned long incr; /* interval in jiffies */x+		} real;x+		struct cpu_timer_list cpu;x+		struct {
+			unsigned int clock;
+			unsigned int node;x+			unsigned long incr;x+			unsigned long expires;x+		} mmtimer;
+	} it;
 };
 
 struct k_clock_abs {
@@ -30,26 +72,27 @@
 };
 struct k_clock {
 	int res;		/* in nano seconds */
+	int (*clock_getres) (clockid_t which_clock, struct timespec *tp);
 	struct k_clock_abs *abs_struct;
-	int (*clock_set) (struct timespec * tp);
-	int (*clock_get) (struct timespec * tp);
+	int (*clock_set) (clockid_t which_clock, struct timespec * tp);
+	int (*clock_get) (clockid_t which_clock, struct timespec * tp);
 	int (*timer_create) (struct k_itimer *timer);
-	int (*nsleep) (int which_clock, int flags,
-		       struct timespec * t);
+	int (*nsleep) (clockid_t which_clock, int flags, struct timespec *);
 	int (*timer_set) (struct k_itimer * timr, int flags,
 			  struct itimerspec * new_setting,
 			  struct itimerspec * old_setting);
 	int (*timer_del) (struct k_itimer * timr);
+#define TIMER_RETRY 1x 	void (*timer_get) (struct k_itimer * timr,
 			   struct itimerspec * cur_setting);
 };
 
-void register_posix_clock(int clock_id, struct k_clock *new_clock);
+void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock);
 x /* Error handlers for timer_create, nanosleep and settime */x int do_posix_clock_notimer_create(struct k_itimer *timer);
-int do_posix_clock_nonanosleep(int which_clock, int flags, struct timespec * t);
-int do_posix_clock_nosettime(struct timespec *tp);
+int do_posix_clock_nonanosleep(clockid_t, int flags, struct timespec *);
+int do_posix_clock_nosettime(clockid_t, struct timespec *tp);
 x /* function to call to trigger timer event */x int posix_timer_event(struct k_itimer *timr, int si_private);x@@ -65,12 +108,32 @@
 #define posix_bump_timer(timr, now)					\
          do {								\
               long delta, orun;						\
-	      delta = now.jiffies - (timr)->it_timer.expires;		\
+	      delta = now.jiffies - (timr)->it.real.timer.expires;	\
               if (delta >= 0) {						\
-	           orun = 1 + (delta / (timr)->it_incr);		\
-	          (timr)->it_timer.expires += orun * (timr)->it_incr;	\
+	           orun = 1 + (delta / (timr)->it.real.incr);		\
+	          (timr)->it.real.timer.expires +=			\
+			 orun * (timr)->it.real.incr;			\
                   (timr)->it_overrun += orun;				\
               }								\
             }while (0)x-#endif
 
+int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *);
+int posix_cpu_clock_get(clockid_t which_clock, struct timespec *);
+int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *tp);
+int posix_cpu_timer_create(struct k_itimer *);
+int posix_cpu_nsleep(clockid_t, int, struct timespec *);
+int posix_cpu_timer_set(struct k_itimer *, int,x+			struct itimerspec *, struct itimerspec *);
+int posix_cpu_timer_del(struct k_itimer *);
+void posix_cpu_timer_get(struct k_itimer *, struct itimerspec *);
+
+void posix_cpu_timer_schedule(struct k_itimer *);
+
+void run_posix_cpu_timers(struct task_struct *);
+void posix_cpu_timers_exit(struct task_struct *);
+void posix_cpu_timers_exit_group(struct task_struct *);
+
+void set_process_cpu_timer(struct task_struct *, unsigned int,x+			   cputime_t *, cputime_t *);
+x+#endifxdiff -Nru a/include/linux/random.h b/include/linux/random.h
--- a/include/linux/random.h	2005-01-15 14:31:06 -08:00
+++ b/include/linux/random.h	2005-03-07 20:41:51 -08:00
@@ -53,22 +53,19 @@
 
 extern __u32 secure_ip_id(__u32 daddr);
 extern u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport);
+extern u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, 
+				       __u16 dport);
 extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr,x 					__u16 sport, __u16 dport);
-extern __u32 secure_tcp_syn_cookie(__u32 saddr, __u32 daddr,x-				   __u16 sport, __u16 dport,x-				   __u32 sseq, __u32 count,x-				   __u32 data);
-extern __u32 check_tcp_syn_cookie(__u32 cookie, __u32 saddr,x-				  __u32 daddr, __u16 sport,x-				  __u16 dport, __u32 sseq,x-				  __u32 count, __u32 maxdiff);
 extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr,x 					  __u16 sport, __u16 dport);
 x #ifndef MODULE
 extern struct file_operations random_fops, urandom_fops;x #endifx+
+unsigned int get_random_int(void);
+unsigned long randomize_range(unsigned long start, unsigned long end, unsigned long len);
 x #endif /* __KERNEL___ */x 
diff -Nru a/include/linux/reiserfs_fs_i.h b/include/linux/reiserfs_fs_i.h
--- a/include/linux/reiserfs_fs_i.h	2004-08-23 17:57:02 -07:00
+++ b/include/linux/reiserfs_fs_i.h	2005-03-07 20:41:24 -08:00
@@ -23,9 +23,8 @@
       space on crash with some files open, but unlinked. */x     i_link_saved_unlink_mask   =  0x0010,x     i_link_saved_truncate_mask =  0x0020,x-    i_priv_object              =  0x0080,x-    i_has_xattr_dir            =  0x0100,x-    i_data_log	               =  0x0200,x+    i_has_xattr_dir            =  0x0040,x+    i_data_log	               =  0x0080,x } reiserfs_inode_flags;
 x 
diff -Nru a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
--- a/include/linux/reiserfs_xattr.h	2004-05-10 04:25:41 -07:00
+++ b/include/linux/reiserfs_xattr.h	2005-03-07 20:41:24 -08:00
@@ -31,7 +31,7 @@
 
 x #ifdef CONFIG_REISERFS_FS_XATTRx-#define is_reiserfs_priv_object(inode) (REISERFS_I(inode)->i_flags & i_priv_object)x+#define is_reiserfs_priv_object(inode) IS_PRIVATE(inode)
 #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
 ssize_t reiserfs_getxattr (struct dentry *dentry, const char *name,
 			   void *buffer, size_t size);x@@ -103,9 +103,16 @@
     up_read (&REISERFS_I(inode)->xattr_sem);
 }x x+static inline void
+reiserfs_mark_inode_private(struct inode *inode)
+{
+    inode->i_flags |= S_PRIVATE;x+}
+x #else
 
 #define is_reiserfs_priv_object(inode) 0x+#define reiserfs_mark_inode_private(inode)
 #define reiserfs_getxattr NULL
 #define reiserfs_setxattr NULL
 #define reiserfs_listxattr NULL
diff -Nru a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
--- a/include/linux/rtnetlink.h	2005-01-10 13:42:22 -08:00
+++ b/include/linux/rtnetlink.h	2005-02-15 12:12:37 -08:00
@@ -779,6 +779,11 @@
 		 goto rtattr_failure; \
    	__rta_fill(skb, attrtype, attrlen, data); }) 
 
+#define RTA_PUT_NOHDR(skb, attrlen, data) \
+({	if (unlikely(skb_tailroom(skb) < (int)(attrlen))) \
+		goto rtattr_failure; \
+	memcpy(skb_put(skb, RTA_ALIGN(attrlen)), data, attrlen); })
+		
 static inline struct rtattr *
 __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen)
 {
diff -Nru a/include/linux/sched.h b/include/linux/sched.h
--- a/include/linux/sched.h	2005-01-30 22:20:14 -08:00
+++ b/include/linux/sched.h	2005-03-07 20:41:53 -08:00
@@ -32,6 +32,7 @@
 #include <linux/pid.h>
 #include <linux/percpu.h>
 #include <linux/topology.h>
+#include <linux/seccomp.h>
 
 struct exec_domain;
 
@@ -300,6 +301,14 @@
 	/* POSIX.1b Interval Timers */x 	struct list_head posix_timers;
 x+	/* ITIMER_REAL timer for the process */
+	struct timer_list real_timer;
+	unsigned long it_real_value, it_real_incr;x+x+	/* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
+	cputime_t it_prof_expires, it_virt_expires;x+	cputime_t it_prof_incr, it_virt_incr;x+x 	/* job control IDs */x 	pid_t pgrp;x 	pid_t tty_old_pgrp;x@@ -320,6 +329,14 @@
 	unsigned long min_flt, maj_flt, cmin_flt, cmaj_flt;
 x 	/*
+	 * Cumulative ns of scheduled CPU time for dead threads in the
+	 * group, not including a zombie group leader.  (This only differs
+	 * from jiffies_to_ns(utime + stime) if sched_clock uses something
+	 * other than jiffies.)
+	 */
+	unsigned long long sched_time;x+x+	/*x 	 * We don't bother to synchronize most readers of this at all,x 	 * because there is no reader checking a limit that actually needsx 	 * to get both rlim_cur and rlim_max atomically, and either onex@@ -329,6 +346,8 @@
 	 * have no need to disable irqs.
 	 */x 	struct rlimit rlim[RLIM_NLIMITS];x+x+	struct list_head cpu_timers[3];
 };
 
 /*x@@ -540,6 +559,7 @@
 
 	unsigned long sleep_avg;
 	unsigned long long timestamp, last_ran;
+	unsigned long long sched_time; /* sched_clock time spent running */x 	int activated;
 
 	unsigned long policy;x@@ -593,15 +613,16 @@
 	int __user *clear_child_tid;		/* CLONE_CHILD_CLEARTID */x 
 	unsigned long rt_priority;x-	unsigned long it_real_value, it_real_incr;x-	cputime_t it_virt_value, it_virt_incr;x-	cputime_t it_prof_value, it_prof_incr;x-	struct timer_list real_timer;
 	cputime_t utime, stime;
 	unsigned long nvcsw, nivcsw; /* context switch counts */x 	struct timespec start_time;x /* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */x 	unsigned long min_flt, maj_flt;x+x+  	cputime_t it_prof_expires, it_virt_expires;x+	unsigned long long it_sched_expires;x+	struct list_head cpu_timers[3];
+x /* process credentials */x 	uid_t uid,euid,suid,fsuid;
 	gid_t gid,egid,sgid,fsgid;x@@ -643,6 +664,7 @@
 	x 	void *security;
 	struct audit_context *audit_context;x+	seccomp_t seccomp;
 x /* Thread group tracking */x    	u32 parent_exec_id;x@@ -735,6 +757,7 @@
 #define PF_LESS_THROTTLE 0x00100000	/* Throttle me less: I clean memory */x #define PF_SYNCWRITE	0x00200000	/* I am doing a sync write */x #define PF_BORROWED_MM	0x00400000	/* I am a kthread doing use_mm */x+#define PF_RANDOMIZE	0x00800000	/* randomize virtual address space */x x /*
  * Only the _current_ task can read/write to tsk->flags, but other
@@ -773,6 +796,7 @@
 #endif
 
 extern unsigned long long sched_clock(void);
+extern unsigned long long current_sched_time(const task_t *current_task);
 x /* sched_exec is called by processes performing an exec */x #ifdef CONFIG_SMP
diff -Nru a/include/linux/scx200.h b/include/linux/scx200.h
--- a/include/linux/scx200.h	2002-10-05 10:35:20 -07:00
+++ b/include/linux/scx200.h	2005-03-07 20:41:30 -08:00
@@ -7,6 +7,10 @@
 
 /* Interesting stuff for the National Semiconductor SCx200 CPU */x x+extern unsigned scx200_cb_base;
+x+#define scx200_cb_present() (scx200_cb_base!=0)x+
 /* F0 PCI Header/Bridge Configuration Registers */x #define SCx200_DOCCS_BASE 0x78	/* DOCCS Base Address Register */x #define SCx200_DOCCS_CTRL 0x7c	/* DOCCS Control Register */x@@ -15,7 +19,7 @@
 #define SCx200_GPIO_SIZE 0x2c	/* Size of GPIO register block */x x /* General Configuration Block */x-#define SCx200_CB_BASE 0x9000	/* Base fixed at 0x9000 according to errata */
+#define SCx200_CB_BASE_FIXED 0x9000	/* Base fixed at 0x9000 according to errata? */x x /* Watchdog Timer */x #define SCx200_WDT_OFFSET 0x00	/* offset within configuration block */x@@ -44,9 +48,7 @@
 #define SCx200_IID 0x3c		/* IA On a Chip Identification Number Reg */x #define SCx200_REV 0x3d		/* Revision Register */x #define SCx200_CBA 0x3e		/* Configuration Base Address Register */x-
-/* Verify that the configuration block really is there */x-#define scx200_cb_probe(base) (inw((base) + SCx200_CBA) == (base))
+#define SCx200_CBA_SCRATCH 0x64	/* Configuration Base Address Scratchpad */x x /*
     Local variables:
diff -Nru a/include/linux/seccomp.h b/include/linux/seccomp.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/linux/seccomp.h	2005-03-07 20:41:40 -08:00
@@ -0,0 +1,33 @@
+#ifndef _LINUX_SECCOMP_H
+#define _LINUX_SECCOMP_H
+
+#include <linux/config.h>
+
+#ifdef CONFIG_SECCOMP
+x+#define NR_SECCOMP_MODES 1x+
+#include <linux/thread_info.h>
+
+typedef struct { int mode; } seccomp_t;
+x+extern void __secure_computing(int);
+static inline void secure_computing(int this_syscall)
+{
+	if (unlikely(test_thread_flag(TIF_SECCOMP)))
+		__secure_computing(this_syscall);x+}
+x+#else /* CONFIG_SECCOMP */x+x+#if (__GNUC__ > 2)x+  typedef struct { } seccomp_t;
+#else
+  typedef struct { int gcc_is_buggy; } seccomp_t;
+#endifx+
+#define secure_computing(x) do { } while (0)x+x+#endif /* CONFIG_SECCOMP */x+x+#endif /* _LINUX_SECCOMP_H */xdiff -Nru a/include/linux/security.h b/include/linux/security.h
--- a/include/linux/security.h	2005-01-10 17:29:23 -08:00
+++ b/include/linux/security.h	2005-03-07 20:41:24 -08:00
@@ -1426,11 +1426,15 @@
 
 static inline int security_inode_alloc (struct inode *inode)
 {
+	if (unlikely (IS_PRIVATE (inode)))
+		return 0;
 	return security_ops->inode_alloc_security (inode);
 }x x static inline void security_inode_free (struct inode *inode)
 {
+	if (unlikely (IS_PRIVATE (inode)))
+		return;
 	security_ops->inode_free_security (inode);
 }x 	
@@ -1438,6 +1442,8 @@
 					 struct dentry *dentry,
 					 int mode)
 {
+	if (unlikely (IS_PRIVATE (dir)))
+		return 0;
 	return security_ops->inode_create (dir, dentry, mode);
 }x x@@ -1445,6 +1451,8 @@
 					       struct dentry *dentry,
 					       int mode)
 {
+	if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
+		return;
 	security_ops->inode_post_create (dir, dentry, mode);
 }x x@@ -1452,6 +1460,8 @@
 				       struct inode *dir,
 				       struct dentry *new_dentry)
 {
+	if (unlikely (IS_PRIVATE (old_dentry->d_inode)))
+		return 0;
 	return security_ops->inode_link (old_dentry, dir, new_dentry);
 }x x@@ -1459,12 +1469,16 @@
 					     struct inode *dir,
 					     struct dentry *new_dentry)
 {
+	if (new_dentry->d_inode && unlikely (IS_PRIVATE (new_dentry->d_inode)))
+		return;
 	security_ops->inode_post_link (old_dentry, dir, new_dentry);
 }x x static inline int security_inode_unlink (struct inode *dir,
 					 struct dentry *dentry)
 {
+	if (unlikely (IS_PRIVATE (dentry->d_inode)))
+		return 0;
 	return security_ops->inode_unlink (dir, dentry);
 }x x@@ -1472,6 +1486,8 @@
 					  struct dentry *dentry,
 					  const char *old_name)
 {
+	if (unlikely (IS_PRIVATE (dir)))
+		return 0;
 	return security_ops->inode_symlink (dir, dentry, old_name);
 }x x@@ -1479,6 +1495,8 @@
 						struct dentry *dentry,
 						const char *old_name)
 {
+	if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
+		return;
 	security_ops->inode_post_symlink (dir, dentry, old_name);
 }x x@@ -1486,6 +1504,8 @@
 					struct dentry *dentry,
 					int mode)
 {
+	if (unlikely (IS_PRIVATE (dir)))
+		return 0;
 	return security_ops->inode_mkdir (dir, dentry, mode);
 }x x@@ -1493,12 +1513,16 @@
 					      struct dentry *dentry,
 					      int mode)
 {
+	if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
+		return;
 	security_ops->inode_post_mkdir (dir, dentry, mode);
 }x x static inline int security_inode_rmdir (struct inode *dir,
 					struct dentry *dentry)
 {
+	if (unlikely (IS_PRIVATE (dentry->d_inode)))
+		return 0;
 	return security_ops->inode_rmdir (dir, dentry);
 }x x@@ -1506,6 +1530,8 @@
 					struct dentry *dentry,
 					int mode, dev_t dev)
 {
+	if (unlikely (IS_PRIVATE (dir)))
+		return 0;
 	return security_ops->inode_mknod (dir, dentry, mode, dev);
 }x x@@ -1513,6 +1539,8 @@
 					      struct dentry *dentry,
 					      int mode, dev_t dev)
 {
+	if (dentry->d_inode && unlikely (IS_PRIVATE (dentry->d_inode)))
+		return;
 	security_ops->inode_post_mknod (dir, dentry, mode, dev);
 }x x@@ -1521,6 +1549,9 @@
 					 struct inode *new_dir,
 					 struct dentry *new_dentry)
 {
+        if (unlikely (IS_PRIVATE (old_dentry->d_inode) ||
+            (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode))))
+		return 0;
 	return security_ops->inode_rename (old_dir, old_dentry,
 					   new_dir, new_dentry);
 }x@@ -1530,83 +1561,114 @@
 					       struct inode *new_dir,
 					       struct dentry *new_dentry)
 {
+	if (unlikely (IS_PRIVATE (old_dentry->d_inode) ||
+	    (new_dentry->d_inode && IS_PRIVATE (new_dentry->d_inode))))
+		return;
 	security_ops->inode_post_rename (old_dir, old_dentry,
 						new_dir, new_dentry);
 }x x static inline int security_inode_readlink (struct dentry *dentry)
 {
+	if (unlikely (IS_PRIVATE (dentry->d_inode)))
+		return 0;
 	return security_ops->inode_readlink (dentry);
 }x x static inline int security_inode_follow_link (struct dentry *dentry,
 					      struct nameidata *nd)
 {
+	if (unlikely (IS_PRIVATE (dentry->d_inode)))
+		return 0;
 	return security_ops->inode_follow_link (dentry, nd);
 }x x static inline int security_inode_permission (struct inode *inode, int mask,
 					     struct nameidata *nd)
 {
+	if (unlikely (IS_PRIVATE (inode)))
+		return 0;
 	return security_ops->inode_permission (inode, mask, nd);
 }x x static inline int security_inode_setattr (struct dentry *dentry,
 					  struct iattr *attr)
 {
+	if (unlikely (IS_PRIVATE (dentry->d_inode)))
+		return 0;
 	return security_ops->inode_setattr (dentry, attr);
 }x x static inline int security_inode_getattr (struct vfsmount *mnt,x 					  struct dentry *dentry)
 {
+	if (unlikely (IS_PRIVATE (dentry->d_inode)))
+		return 0;
 	return security_ops->inode_getattr (mnt, dentry);
 }x x static inline void security_inode_delete (struct inode *inode)
 {
+	if (unlikely (IS_PRIVATE (inode)))
+		return;
 	security_ops->inode_delete (inode);
 }x x static inline int security_inode_setxattr (struct dentry *dentry, char *name,
 					   void *value, size_t size, int flags)
 {
+	if (unlikely (IS_PRIVATE (dentry->d_inode)))
+		return 0;
 	return security_ops->inode_setxattr (dentry, name, value, size, flags);
 }x x static inline void security_inode_post_setxattr (struct dentry *dentry, char *name,
 						void *value, size_t size, int flags)
 {
+	if (unlikely (IS_PRIVATE (dentry->d_inode)))
+		return;
 	security_ops->inode_post_setxattr (dentry, name, value, size, flags);
 }x x static inline int security_inode_getxattr (struct dentry *dentry, char *name)
 {
+	if (unlikely (IS_PRIVATE (dentry->d_inode)))
+		return 0;
 	return security_ops->inode_getxattr (dentry, name);
 }x x static inline int security_inode_listxattr (struct dentry *dentry)
 {
+	if (unlikely (IS_PRIVATE (dentry->d_inode)))
+		return 0;
 	return security_ops->inode_listxattr (dentry);
 }x x static inline int security_inode_removexattr (struct dentry *dentry, char *name)
 {
+	if (unlikely (IS_PRIVATE (dentry->d_inode)))
+		return 0;
 	return security_ops->inode_removexattr (dentry, name);
 }x x static inline int security_inode_getsecurity(struct inode *inode, const char *name, void *buffer, size_t size)
 {
+	if (unlikely (IS_PRIVATE (inode)))
+		return 0;
 	return security_ops->inode_getsecurity(inode, name, buffer, size);
 }x x static inline int security_inode_setsecurity(struct inode *inode, const char *name, const void *value, size_t size, int flags)
 {
+	if (unlikely (IS_PRIVATE (inode)))
+		return 0;
 	return security_ops->inode_setsecurity(inode, name, value, size, flags);
 }x x static inline int security_inode_listsecurity(struct inode *inode, char *buffer, size_t buffer_size)
 {
+	if (unlikely (IS_PRIVATE (inode)))
+		return 0;
 	return security_ops->inode_listsecurity(inode, buffer, buffer_size);
 }x x@@ -1883,6 +1945,8 @@
 
 static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
 {
+	if (unlikely (inode && IS_PRIVATE (inode)))
+		return;
 	security_ops->d_instantiate (dentry, inode);
 }x xdiff -Nru a/include/linux/seq_file.h b/include/linux/seq_file.h
--- a/include/linux/seq_file.h	2004-04-13 08:46:50 -07:00
+++ b/include/linux/seq_file.h	2005-03-07 20:41:51 -08:00
@@ -18,6 +18,7 @@
 	size_t from;
 	size_t count;
 	loff_t index;x+	loff_t version;
 	struct semaphore sem;
 	struct seq_operations *op;x 	void *private;xdiff -Nru a/include/linux/serial_core.h b/include/linux/serial_core.h
--- a/include/linux/serial_core.h	2005-01-30 22:33:40 -08:00
+++ b/include/linux/serial_core.h	2005-03-09 13:53:04 -08:00
@@ -106,6 +106,13 @@
 /* TXX9 type number */x #define PORT_TXX9       64
 
+/* NEC VR4100 series SIU/DSIU */x+#define PORT_VR41XX_SIU		65x+#define PORT_VR41XX_DSIU	66
+x+/* Samsung S3C2400 SoC */x+#define PORT_S3C2400	67
+x #ifdef __KERNEL__
 
 #include <linux/config.h>
diff -Nru a/include/linux/signal.h b/include/linux/signal.h
--- a/include/linux/signal.h	2004-08-25 10:13:40 -07:00
+++ b/include/linux/signal.h	2005-03-07 20:41:53 -08:00
@@ -8,8 +8,6 @@
 
 #ifdef __KERNEL__
 
-#define MAX_SIGPENDING	1024x-
 /*
  * Real Time signals may be queued.
  */x@@ -212,6 +210,7 @@
 }
 
 extern int group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
+extern int __group_send_sig_info(int, struct siginfo *, struct task_struct *);
 extern long do_sigpending(void __user *, unsigned long);
 extern int sigprocmask(int, sigset_t *, sigset_t *);
 xdiff -Nru a/include/linux/skbuff.h b/include/linux/skbuff.h
--- a/include/linux/skbuff.h	2005-02-05 19:23:06 -08:00
+++ b/include/linux/skbuff.h	2005-02-23 19:18:14 -08:00
@@ -146,6 +146,20 @@
 	skb_frag_t	frags[MAX_SKB_FRAGS];
 };
 
+/* We divide dataref into two halves.  The higher 16 bits hold referencesx+ * to the payload part of skb->data.  The lower 16 bits hold references tox+ * the entire skb->data.  It is up to the users of the skb to agree onx+ * where the payload starts.x+ *x+ * All users must obey the rule that the skb->data reference count must be
+ * greater than or equal to the payload reference count.x+ *x+ * Holding a reference to the payload part means that the user does notx+ * care about modifications to the header part of skb->data.x+ */
+#define SKB_DATAREF_SHIFT 16
+#define SKB_DATAREF_MASK ((1 << SKB_DATAREF_SHIFT) - 1)
+x /** 
  *	struct sk_buff - socket buffer
  *	@next: Next buffer in list
@@ -167,6 +181,7 @@
  *	@csum: Checksum
  *	@__unused: Dead field, may be reused
  *	@cloned: Head may be cloned (check refcnt to be sure)x+ *	@nohdr: Payload reference only, must not modify header
  *	@pkt_type: Packet class
  *	@ip_summed: Driver fed us an IP checksum
  *	@priority: Packet queueing priority
@@ -238,7 +253,8 @@
 				mac_len,x 				csum;x 	unsigned char		local_df,x-				cloned,x+				cloned:1,x+				nohdr:1,x 				pkt_type,x 				ip_summed;x 	__u32			priority;x@@ -370,7 +386,42 @@
  */x static inline int skb_cloned(const struct sk_buff *skb)
 {
-	return skb->cloned && atomic_read(&skb_shinfo(skb)->dataref) != 1;x+	return skb->cloned &&
+	       (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1;x+}
+x+/**x+ *	skb_header_cloned - is the header a clonex+ *	@skb: buffer to checkx+ *x+ *	Returns true if modifying the header part of the buffer requiresx+ *	the data to be copied.
+ */
+static inline int skb_header_cloned(const struct sk_buff *skb)
+{
+	int dataref;x+x+	if (!skb->cloned)
+		return 0;
+x+	dataref = atomic_read(&skb_shinfo(skb)->dataref);x+	dataref = (dataref & SKB_DATAREF_MASK) - (dataref >> SKB_DATAREF_SHIFT);x+	return dataref != 1;x+}
+x+/**x+ *	skb_header_release - release reference to header
+ *	@skb: buffer to operate onx+ *
+ *	Drop a reference to the header part of the buffer.  This is donex+ *	by acquiring a payload reference.  You must not read from the headerx+ *	part of skb->data after this.
+ */
+static inline void skb_header_release(struct sk_buff *skb)
+{
+	BUG_ON(skb->nohdr);x+	skb->nohdr = 1;x+	atomic_add(1 << SKB_DATAREF_SHIFT, &skb_shinfo(skb)->dataref);x }
 
 /**xdiff -Nru a/include/linux/sort.h b/include/linux/sort.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/linux/sort.h	2005-03-07 20:41:45 -08:00
@@ -0,0 +1,10 @@
+#ifndef _LINUX_SORT_H
+#define _LINUX_SORT_H
+
+#include <linux/types.h>
+
+void sort(void *base, size_t num, size_t size,
+	  int (*cmp)(const void *, const void *),
+	  void (*swap)(void *, void *, int));
+x+#endifxdiff -Nru a/include/linux/stallion.h b/include/linux/stallion.h
--- a/include/linux/stallion.h	2004-07-14 01:15:11 -07:00
+++ b/include/linux/stallion.h	2005-03-05 07:41:16 -08:00
@@ -126,7 +126,7 @@
 	int		nrbnks;
 	int		irq;
 	int		irqtype;x-	void		(*isr)(struct stlbrd *brdp);
+	int		(*isr)(struct stlbrd *brdp);
 	unsigned int	ioaddr1;
 	unsigned int	ioaddr2;
 	unsigned int	iosize1;xdiff -Nru a/include/linux/stop_machine.h b/include/linux/stop_machine.h
--- a/include/linux/stop_machine.h	2004-02-07 01:50:38 -08:00
+++ b/include/linux/stop_machine.h	2005-03-07 20:41:36 -08:00
@@ -8,7 +8,7 @@
 #include <linux/cpu.h>
 #include <asm/system.h>
 
-#ifdef CONFIG_SMP
+#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP)
 /**x  * stop_machine_run: freeze the machine on all CPUs and run this functionx  * @fn: the function to runxdiff -Nru a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
--- a/include/linux/sunrpc/cache.h	2004-12-27 18:29:16 -08:00
+++ b/include/linux/sunrpc/cache.h	2005-03-04 22:32:50 -08:00
@@ -37,8 +37,7 @@
  * Entries have a ref count and a 'hashed' flag which counts the existance
  * in the hash table.
  * We only expire entries when refcount is zero.
- * Existance in the cache is not measured in refcount but rather in
- * CACHE_HASHED flag.
+ * Existance in the cache is counted  the refcount.
  */x x /* Every cache item has a common header that is used
@@ -57,7 +56,6 @@
 #define	CACHE_VALID	0	/* Entry contains valid data */x #define	CACHE_NEGATIVE	1	/* Negative entry - there is no match for the key */x #define	CACHE_PENDING	2	/* An upcall has been sent but no reply received yet*/x-#define	CACHE_HASHED	3	/* Entry is in a hash table */x x #define	CACHE_NEW_EXPIRY 120	/* keep new things pending confirmation for 120 seconds */
 x@@ -185,7 +183,6 @@
 											\
 			if (new)							\
 				{INIT;}							\
-			cache_get(&tmp->MEMBER);					\
 			if (set) {							\
 				if (!INPLACE && test_bit(CACHE_VALID, &tmp->MEMBER.flags))\
 				{ /* need to swap in new */				\
@@ -194,8 +191,6 @@
 					new->MEMBER.next = tmp->MEMBER.next;		\
 					*hp = &new->MEMBER;				\
 					tmp->MEMBER.next = NULL;			\
-					set_bit(CACHE_HASHED, &new->MEMBER.flags);	\
-					clear_bit(CACHE_HASHED, &tmp->MEMBER.flags);	\
 					t2 = tmp; tmp = new; new = t2;			\
 				}							\
 				if (test_bit(CACHE_NEGATIVE,  &item->MEMBER.flags))	\
@@ -205,6 +200,7 @@
 					clear_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags);	\
 				}							\
 			}								\
+			cache_get(&tmp->MEMBER);					\
 			if (set||new) write_unlock(&(DETAIL)->hash_lock);		\
 			else read_unlock(&(DETAIL)->hash_lock);				\
 			if (set)							\
@@ -220,7 +216,7 @@
 		new->MEMBER.next = *head;						\
 		*head = &new->MEMBER;							\
 		(DETAIL)->entries ++;							\
-		set_bit(CACHE_HASHED, &new->MEMBER.flags);				\
+		cache_get(&new->MEMBER);						\
 		if (set) {								\
 			tmp = new;							\
 			if (test_bit(CACHE_NEGATIVE, &item->MEMBER.flags))		\
@@ -268,15 +264,10 @@
 
 static inline int cache_put(struct cache_head *h, struct cache_detail *cd)
 {
-	atomic_dec(&h->refcnt);
-	if (!atomic_read(&h->refcnt) &&
+	if (atomic_read(&h->refcnt) <= 2 &&
 	    h->expiry_time < cd->nextcheck)x 		cd->nextcheck = h->expiry_time;
-	if (!test_bit(CACHE_HASHED, &h->flags) &&
-	    !atomic_read(&h->refcnt))
-		return 1;x-
-	return 0;x+	return atomic_dec_and_test(&h->refcnt);
 }
 
 extern void cache_init(struct cache_head *h);xdiff -Nru a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
--- a/include/linux/sunrpc/svc.h	2004-07-20 09:14:55 -07:00
+++ b/include/linux/sunrpc/svc.h	2005-03-04 22:32:49 -08:00
@@ -251,8 +251,7 @@
 	char *			pg_name;	/* service name */x 	char *			pg_class;	/* class name: services sharing authentication */x 	struct svc_stat *	pg_stats;	/* rpc statistics */x-	/* Override authentication. NULL means use default */x-	int			(*pg_authenticate)(struct svc_rqst *, u32 *);
+	int			(*pg_authenticate)(struct svc_rqst *);
 };
 
 /*xdiff -Nru a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
--- a/include/linux/sunrpc/svcauth.h	2004-07-05 03:33:38 -07:00
+++ b/include/linux/sunrpc/svcauth.h	2005-03-04 22:32:49 -08:00
@@ -92,6 +92,7 @@
 	int	(*accept)(struct svc_rqst *rq, u32 *authp);
 	int	(*release)(struct svc_rqst *rq);x 	void	(*domain_release)(struct auth_domain *);
+	int	(*set_client)(struct svc_rqst *rq);x };
 
 #define	SVC_GARBAGE	1
@@ -107,6 +108,7 @@
 
 extern int	svc_authenticate(struct svc_rqst *rqstp, u32 *authp);
 extern int	svc_authorise(struct svc_rqst *rqstp);
+extern int	svc_set_client(struct svc_rqst *rqstp);
 extern int	svc_auth_register(rpc_authflavor_t flavor, struct auth_ops *aops);
 extern void	svc_auth_unregister(rpc_authflavor_t flavor);
 xdiff -Nru a/include/linux/superhyway.h b/include/linux/superhyway.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/linux/superhyway.h	2005-03-09 09:04:50 -08:00
@@ -0,0 +1,79 @@
+/*x+ * include/linux/superhyway.h
+ *x+ * SuperHyway Bus definitions
+ *x+ * Copyright (C) 2004, 2005  Paul Mundt <lethal@linux-sh.org>
+ *x+ * This file is subject to the terms and conditions of the GNU General Publicx+ * License.  See the file "COPYING" in the main directory of this archivex+ * for more details.
+ */
+#ifndef __LINUX_SUPERHYWAY_H
+#define __LINUX_SUPERHYWAY_H
+
+#include <linux/device.h>
+
+/*x+ * SuperHyway IDsx+ */
+#define SUPERHYWAY_DEVICE_ID_SH5_DMAC	0x0183
+x+struct vcr_info {
+	u8	perr_flags;	/* P-port Error flags */
+	u8	merr_flags;	/* Module Error flags */
+	u16	mod_vers;	/* Module Version */
+	u16	mod_id;		/* Module ID */x+	u8	bot_mb;		/* Bottom Memory block */x+	u8	top_mb;		/* Top Memory block */x+};
+x+struct superhyway_device_id {
+	unsigned int id;x+	unsigned long driver_data;x+};
+x+struct superhyway_device;
+extern struct bus_type superhyway_bus_type;
+x+struct superhyway_driver {
+	char *name;
+x+	const struct superhyway_device_id *id_table;x+	struct device_driver drv;x+x+	int (*probe)(struct superhyway_device *dev, const struct superhyway_device_id *id);
+	void (*remove)(struct superhyway_device *dev);x+};
+x+#define to_superhyway_driver(d)	container_of((d), struct superhyway_driver, drv)
+x+struct superhyway_device {
+	char name[32];x+x+	struct device dev;x+x+	struct superhyway_device_id id;x+	struct superhyway_driver *drv;x+x+	struct resource resource;x+	struct vcr_info vcr;x+};
+x+#define to_superhyway_device(d)	container_of((d), struct superhyway_device, dev)x+
+#define superhyway_get_drvdata(d)	dev_get_drvdata(&(d)->dev)x+#define superhyway_set_drvdata(d,p)	dev_set_drvdata(&(d)->dev, (p))
+x+extern int superhyway_scan_bus(void);
+
+/* drivers/sh/superhyway/superhyway.c */x+int superhyway_register_driver(struct superhyway_driver *);
+void superhyway_unregister_driver(struct superhyway_driver *);
+int superhyway_add_device(unsigned int, unsigned long, unsigned long long);
+
+/* drivers/sh/superhyway/superhyway-sysfs.c */x+extern struct device_attribute superhyway_dev_attrs[];x+x+#endif /* __LINUX_SUPERHYWAY_H */x+xdiff -Nru a/include/linux/suspend.h b/include/linux/suspend.h
--- a/include/linux/suspend.h	2005-02-05 12:54:22 -08:00
+++ b/include/linux/suspend.h	2005-03-07 20:41:31 -08:00
@@ -15,10 +15,21 @@
 	unsigned long address;		/* address of the copy */x 	unsigned long orig_address;	/* original address of page */x 	swp_entry_t swap_address;	x-	swp_entry_t dummy;		/* we need scratch space at 
-					 * end of page (see link, diskpage)
-					 */x+x+	struct pbe *next;	/* also used as scratch space at
+				 * end of page (see link, diskpage)
+				 */x } suspend_pagedir_t;
+x+#define for_each_pbe(pbe, pblist) \
+	for (pbe = pblist ; pbe ; pbe = pbe->next)x+
+#define PBES_PER_PAGE      (PAGE_SIZE/sizeof(struct pbe))
+#define PB_PAGE_SKIP       (PBES_PER_PAGE-1)
+x+#define for_each_pb_page(pbe, pblist) \
+	for (pbe = pblist ; pbe ; pbe = (pbe+PB_PAGE_SKIP)->next)x+
 
 #define SWAP_FILENAME_MAXLENGTH	32
 xdiff -Nru a/include/linux/sysctl.h b/include/linux/sysctl.h
--- a/include/linux/sysctl.h	2005-02-23 20:01:51 -08:00
+++ b/include/linux/sysctl.h	2005-03-04 22:32:56 -08:00
@@ -135,6 +135,7 @@
 	KERN_HZ_TIMER=65,	/* int: hz timer on or off */
 	KERN_UNKNOWN_NMI_PANIC=66, /* int: unknown nmi panic flag */
 	KERN_BOOTLOADER_TYPE=67, /* int: boot loader type */x+	KERN_RANDOMIZE=68, /* int: randomize virtual address space */x };
 x 
diff -Nru a/include/linux/tc_ematch/tc_em_cmp.h b/include/linux/tc_ematch/tc_em_cmp.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/linux/tc_ematch/tc_em_cmp.h	2005-02-15 12:13:55 -08:00
@@ -0,0 +1,26 @@
+#ifndef __LINUX_TC_EM_CMP_H
+#define __LINUX_TC_EM_CMP_H
+
+#include <linux/pkt_cls.h>
+
+struct tcf_em_cmp
+{
+	__u32		val;x+	__u32		mask;x+	__u16		off;x+	__u8		align:4;x+	__u8		flags:4;x+	__u8		layer:4;x+	__u8		opnd:4;x+};
+x+enum
+{
+	TCF_EM_ALIGN_U8  = 1,x+	TCF_EM_ALIGN_U16 = 2,x+	TCF_EM_ALIGN_U32 = 4x+};
+x+#define TCF_EM_CMP_TRANS	1
+x+#endifxdiff -Nru a/include/linux/tc_ematch/tc_em_meta.h b/include/linux/tc_ematch/tc_em_meta.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/linux/tc_ematch/tc_em_meta.h	2005-02-15 12:19:24 -08:00
@@ -0,0 +1,69 @@
+#ifndef __LINUX_TC_EM_META_H
+#define __LINUX_TC_EM_META_H
+
+#include <linux/pkt_cls.h>
+
+enum
+{
+	TCA_EM_META_UNSPEC,
+	TCA_EM_META_HDR,
+	TCA_EM_META_LVALUE,
+	TCA_EM_META_RVALUE,
+	__TCA_EM_META_MAXx+};
+#define TCA_EM_META_MAX (__TCA_EM_META_MAX - 1)
+x+struct tcf_meta_val
+{
+	__u16			kind;x+	__u8			shift;x+	__u8			op;x+};
+x+#define TCF_META_TYPE_MASK	(0xf << 12)x+#define TCF_META_TYPE(kind)	(((kind) & TCF_META_TYPE_MASK) >> 12)x+#define TCF_META_ID_MASK	0x7ffx+#define TCF_META_ID(kind)	((kind) & TCF_META_ID_MASK)
+x+enum
+{
+	TCF_META_TYPE_VAR,
+	TCF_META_TYPE_INT,
+	__TCF_META_TYPE_MAXx+};
+#define TCF_META_TYPE_MAX (__TCF_META_TYPE_MAX - 1)
+x+enum
+{
+	TCF_META_ID_VALUE,
+	TCF_META_ID_RANDOM,
+	TCF_META_ID_LOADAVG_0,
+	TCF_META_ID_LOADAVG_1,
+	TCF_META_ID_LOADAVG_2,
+	TCF_META_ID_DEV,
+	TCF_META_ID_INDEV,
+	TCF_META_ID_REALDEV,
+	TCF_META_ID_PRIORITY,
+	TCF_META_ID_PROTOCOL,
+	TCF_META_ID_SECURITY,
+	TCF_META_ID_PKTTYPE,
+	TCF_META_ID_PKTLEN,
+	TCF_META_ID_DATALEN,
+	TCF_META_ID_MACLEN,
+	TCF_META_ID_NFMARK,
+	TCF_META_ID_TCINDEX,
+	TCF_META_ID_TCVERDICT,
+	TCF_META_ID_TCCLASSID,
+	TCF_META_ID_RTCLASSID,
+	TCF_META_ID_RTIIF,
+	__TCF_META_ID_MAXx+};
+#define TCF_META_ID_MAX (__TCF_META_ID_MAX - 1)
+x+struct tcf_meta_hdr
+{
+	struct tcf_meta_val	left;x+	struct tcf_meta_val	right;x+};
+x+#endifxdiff -Nru a/include/linux/tc_ematch/tc_em_nbyte.h b/include/linux/tc_ematch/tc_em_nbyte.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/linux/tc_ematch/tc_em_nbyte.h	2005-02-15 12:15:33 -08:00
@@ -0,0 +1,13 @@
+#ifndef __LINUX_TC_EM_NBYTE_H
+#define __LINUX_TC_EM_NBYTE_H
+
+#include <linux/pkt_cls.h>
+
+struct tcf_em_nbyte
+{
+	__u16		off;x+	__u16		len:12;x+	__u8		layer:4;x+};
+x+#endifxdiff -Nru a/include/linux/tcp.h b/include/linux/tcp.h
--- a/include/linux/tcp.h	2005-02-22 10:45:31 -08:00
+++ b/include/linux/tcp.h	2005-03-07 09:32:09 -08:00
@@ -284,10 +284,13 @@
 	__u32	mss_cache;	/* Cached effective mss, not including SACKS */
 	__u16	mss_cache_std;	/* Like mss_cache, but without TSO */
 	__u16	ext_header_len;	/* Network protocol overhead (IP/IPv6 options) */x-	__u16	ext2_header_len;/* Options depending on route */x 	__u8	ca_state;	/* State of fast-retransmit machine 	*/x 	__u8	retransmits;	/* Number of unrecovered RTO timeouts.	*/x x+	__u16	advmss;		/* Advertised MSS			*/x+	__u32	window_clamp;	/* Maximal window to advertise		*/x+	__u32	rcv_ssthresh;	/* Current window clamp			*/x+
 	__u32	frto_highmark;	/* snd_nxt when RTO occurred */x 	__u8	reordering;	/* Packet reordering metric.		*/x 	__u8	frto_counter;	/* Number of new acks after RTO */x@@ -345,14 +348,9 @@
 	struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */x 	struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/x x-	__u32	window_clamp;	/* Maximal window to advertise		*/x-	__u32	rcv_ssthresh;	/* Current window clamp			*/x-	__u16	advmss;		/* Advertised MSS			*/x-x 	__u8	syn_retries;	/* num of allowed syn retries */x 	__u8	ecn_flags;	/* ECN status bits.			*/x 	__u16	prior_ssthresh; /* ssthresh saved at recovery start	*/x-	__u16	__pad1;x 	__u32	lost_out;	/* Lost packets			*/x 	__u32	sacked_out;	/* SACK'd packets			*/x 	__u32	fackets_out;	/* FACK'd packets			*/xdiff -Nru a/include/linux/threads.h b/include/linux/threads.h
--- a/include/linux/threads.h	2004-10-19 02:40:26 -07:00
+++ b/include/linux/threads.h	2005-03-07 20:41:45 -08:00
@@ -7,7 +7,7 @@
  * The default limit for the nr of threads is now in
  * /proc/sys/kernel/threads-max.
  */x- 
+x /*
  * Maximum supported processors that can run under SMP.  This value isx  * set via configure setting.  The maximum is equal to the size of the
@@ -25,11 +25,12 @@
 /*
  * This controls the default maximum pid allocated to a process
  */x-#define PID_MAX_DEFAULT 0x8000
+#define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000)x x /*
  * A maximum of 4 million PIDs should be enough for a while:
  */x-#define PID_MAX_LIMIT (sizeof(long) > 4 ? 4*1024*1024 : PID_MAX_DEFAULT)
+#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
+	(sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
 x #endifxdiff -Nru a/include/linux/tpqic02.h b/include/linux/tpqic02.h
--- a/include/linux/tpqic02.h	2003-08-26 09:25:40 -07:00
+++ /dev/null	Wed Dec 31 16:00:00 196900
@@ -1,738 +0,0 @@
-/* $Id: tpqic02.h,v 1.5 1996/12/14 23:01:38 root Exp root $
- *
- * Include file for QIC-02 driver for Linux.
- *
- * Copyright (c) 1992--1995 by H. H. Bergman. All rights reserved.
- *
- * ******* USER CONFIG SECTION BELOW (Near line 70) *******
- */x-
-#ifndef _LINUX_TPQIC02_H
-#define _LINUX_TPQIC02_H
-
-#include <linux/config.h>
-
-#if defined(CONFIG_QIC02_TAPE) || defined(CONFIG_QIC02_TAPE_MODULE)x-
-/* need to have QIC02_TAPE_DRIVE and QIC02_TAPE_IFC expand to something */x-#include <linux/mtio.h>
-
-
-/* Make QIC02_TAPE_IFC expand to something.
- *
- * The only difference between WANGTEK and EVEREX is in the 
- * handling of the DMA channel 3.
- * Note that the driver maps EVEREX to WANGTEK internally for speed
- * reasons. Externally WANGTEK==1, EVEREX==2, ARCHIVE==3.
- * These must correspond to the values used in qic02config(1).
- *
- * Support for Mountain controllers was added by Erik Jacobson
- * and severely hacked by me.   -- hhb
- * 
- * Support for Emerald controllers by Alan Bain <afrb2@chiark.chu.cam.ac.uk>
- * with more hacks by me.   -- hhb
- */x-#define WANGTEK		1		   /* don't know about Wangtek QIC-36 */x-#define EVEREX		(WANGTEK+1)  /* I heard *some* of these are identical */x-#define EVEREX_811V	EVEREX			      /* With TEAC MT 2ST 45D */x-#define EVEREX_831V	EVEREXx-#define ARCHIVE		3x-#define ARCHIVE_SC400	ARCHIVE	       /* rumoured to be from the pre-SMD-age */x-#define ARCHIVE_SC402	ARCHIVE		       /* don't know much about SC400 */x-#define ARCHIVE_SC499	ARCHIVE       /* SC402 and SC499R should be identical */x-
-#define MOUNTAIN	5		       /* Mountain Computer Interface */x-#define EMERALD		6		       /* Emerald Interface card */
-
-
-x-#define QIC02_TAPE_PORT_RANGE 	8	 /* number of IO locations to reserve */
-
-
-/*********** START OF USER CONFIGURABLE SECTION ************/x-
-/* Tape configuration: Select DRIVE, IFC, PORT, IRQ and DMA below.
- * Runtime (re)configuration is not supported yet.
- *
- * Tape drive configuration:	(MT_IS* constants are defined in mtio.h)
- *
- * QIC02_TAPE_DRIVE = MT_ISWT5150
- *	- Wangtek 5150, format: up to QIC-150.
- * QIC02_TAPE_DRIVE = MT_ISQIC02_ALL_FEATURES
- *	- Enables some optional QIC02 commands that some drives may lack.
- *	  It is provided so you can check which are supported by your drive.
- *	  Refer to tpqic02.h for others.
- *
- * Supported interface cards: QIC02_TAPE_IFC =
- *	WANGTEK,
- *	ARCHIVE_SC402, ARCHIVE_SC499.	(both same programming interface)
- *
- * Make sure you have the I/O ports/DMA channels 
- * and IRQ stuff configured properly!
- * NOTE: There may be other device drivers using the same major
- *       number. This must be avoided. Check for timer.h conflicts too.
- *
- * If you have an EVEREX EV-831 card and you are using DMA channel 3,
- * you will probably have to ``#define QIC02_TAPE_DMA3_FIX'' below.
- */x-
-/* CONFIG_QIC02_DYNCONF can be defined in autoconf.h, by `make config' */x-
-/*** #undef CONFIG_QIC02_DYNCONF ***/x-
-#ifndef CONFIG_QIC02_DYNCONF
-x-#define QIC02_TAPE_DRIVE	MT_ISQIC02_ALL_FEATURES	 /* drive type */x-/* #define QIC02_TAPE_DRIVE	MT_ISWT5150 */x-/* #define QIC02_TAPE_DRIVE	MT_ISARCHIVE_5945L2 */x-/* #define QIC02_TAPE_DRIVE	MT_ISTEAC_MT2ST */x-/* #define QIC02_TAPE_DRIVE	MT_ISARCHIVE_2150L */x-/* #define QIC02_TAPE_DRIVE	MT_ISARCHIVESC499 */x-
-/* Either WANGTEK, ARCHIVE or MOUNTAIN. Not EVEREX. 
- * If you have an EVEREX, use WANGTEK and try the DMA3_FIX below.
- */x-#define QIC02_TAPE_IFC		WANGTEK	/* interface card type */x-/* #define QIC02_TAPE_IFC		ARCHIVE */x-/* #define QIC02_TAPE_IFC		MOUNTAIN */x-
-#define QIC02_TAPE_PORT 	0x300	/* controller port address */x-#define QIC02_TAPE_IRQ		5	/* For IRQ2, use 9 here, others normal. */x-#define QIC02_TAPE_DMA		1	/* either 1 or 3, because 2 is used by the floppy */x-
-/* If DMA3 doesn't work, but DMA1 does, and you have a 
- * Wangtek/Everex card, you can try #define-ing the flag
- * below. Note that you should also change the DACK jumper
- * for Wangtek/Everex cards when changing the DMA channel.
- */x-#undef QIC02_TAPE_DMA3_FIX
-
-/************ END OF USER CONFIGURABLE SECTION *************/x-
-/* I put the stuff above in config.in, but a few recompiles, to
- * verify different configurations, and several days later I decided
- * to change it back again.
- */x-
-x-
-/* NOTE: TP_HAVE_DENS should distinguish between available densities (?)
- * NOTE: Drive select is not implemented -- I have only one tape streamer,
- *	 so I'm unable and unmotivated to test and implement that. ;-) ;-)
- */x-#if QIC02_TAPE_DRIVE == MT_ISWT5150
-#define TP_HAVE_DENS	1
-#define TP_HAVE_BSF	0	/* nope */x-#define TP_HAVE_FSR	0	/* nope */x-#define TP_HAVE_BSR	0	/* nope */x-#define TP_HAVE_EOD	0	/* most of the time */x-#define TP_HAVE_SEEK	0
-#define TP_HAVE_TELL	0
-#define TP_HAVE_RAS1	1
-#define TP_HAVE_RAS2	1
-
-#elif QIC02_TAPE_DRIVE == MT_ISARCHIVESC499	/* Archive SC-499 QIC-36 controller */x-#define TP_HAVE_DENS	1	/* can do set density (QIC-11 / QIC-24) */x-#define TP_HAVE_BSF	0
-#define TP_HAVE_FSR	1	/* can skip one block forwards */x-#define TP_HAVE_BSR	1	/* can skip one block backwards */x-#define TP_HAVE_EOD	1	/* can seek to end of recorded data */x-#define TP_HAVE_SEEK	0
-#define TP_HAVE_TELL	0
-#define TP_HAVE_RAS1	1	/* can run selftest 1 */x-#define TP_HAVE_RAS2	1	/* can run selftest 2 */x-/* These last two selftests shouldn't be used yet! */x-
-#elif (QIC02_TAPE_DRIVE == MT_ISARCHIVE_2060L) || (QIC02_TAPE_DRIVE == MT_ISARCHIVE_2150L)x-#define TP_HAVE_DENS	1	/* can do set density (QIC-24 / QIC-120 / QIC-150) */x-#define TP_HAVE_BSF	0
-#define TP_HAVE_FSR	1	/* can skip one block forwards */x-#define TP_HAVE_BSR	1	/* can skip one block backwards */x-#define TP_HAVE_EOD	1	/* can seek to end of recorded data */x-#define TP_HAVE_TELL	1	/* can read current block address */x-#define TP_HAVE_SEEK	1	/* can seek to block */x-#define TP_HAVE_RAS1	1	/* can run selftest 1 */x-#define TP_HAVE_RAS2	1	/* can run selftest 2 */x-/* These last two selftests shouldn't be used yet! */x-
-#elif QIC02_TAPE_DRIVE == MT_ISARCHIVE_5945L2x-/* can anyone verify this entry?? */x-#define TP_HAVE_DENS	1	/* can do set density?? (QIC-24??) */x-#define TP_HAVE_BSF	0
-#define TP_HAVE_FSR	1	/* can skip one block forwards */x-#define TP_HAVE_BSR	1	/* can skip one block backwards */x-#define TP_HAVE_EOD	1	/* can seek to end of recorded data */x-#define TP_HAVE_TELL	1	/* can read current block address */x-#define TP_HAVE_SEEK	1	/* can seek to block */x-#define TP_HAVE_RAS1	1	/* can run selftest 1 */x-#define TP_HAVE_RAS2	1	/* can run selftest 2 */x-/* These last two selftests shouldn't be used yet! */x-
-#elif QIC02_TAPE_DRIVE == MT_ISTEAC_MT2STx-/* can anyone verify this entry?? */x-#define TP_HAVE_DENS	0	/* cannot do set density?? (QIC-150?) */x-#define TP_HAVE_BSF	0
-#define TP_HAVE_FSR	1	/* can skip one block forwards */x-#define TP_HAVE_BSR	1	/* can skip one block backwards */x-#define TP_HAVE_EOD	1	/* can seek to end of recorded data */x-#define TP_HAVE_SEEK	1	/* can seek to block */x-#define TP_HAVE_TELL	1	/* can read current block address */x-#define TP_HAVE_RAS1	1	/* can run selftest 1 */x-#define TP_HAVE_RAS2	1	/* can run selftest 2 */x-/* These last two selftests shouldn't be used yet! */x-
-#elif QIC02_TAPE_DRIVE == MT_ISQIC02_ALL_FEATURES
-#define TP_HAVE_DENS	1	/* can do set density */x-#define TP_HAVE_BSF	1	/* can search filemark backwards */x-#define TP_HAVE_FSR	1	/* can skip one block forwards */x-#define TP_HAVE_BSR	1	/* can skip one block backwards */x-#define TP_HAVE_EOD	1	/* can seek to end of recorded data */x-#define TP_HAVE_SEEK	1	/* seek to block address */x-#define TP_HAVE_TELL	1	/* tell current block address */x-#define TP_HAVE_RAS1	1	/* can run selftest 1 */x-#define TP_HAVE_RAS2	1	/* can run selftest 2 */x-/* These last two selftests shouldn't be used yet! */x-
-
-#else
-#error No QIC-02 tape drive type defined!
-/* If your drive is not listed above, first try the 'ALL_FEATURES',
- * to see what commands are supported, then create your own entry in
- * the list above. You may want to mail it to me, so that I can include
- * it in the next release.
- */x-#endifx-x-#endif /* !CONFIG_QIC02_DYNCONF */
-
-
-/* WANGTEK interface card specifics */x-#define WT_QIC02_STAT_PORT	(QIC02_TAPE_PORT)x-#define WT_QIC02_CTL_PORT	(QIC02_TAPE_PORT)x-#define WT_QIC02_CMD_PORT	(QIC02_TAPE_PORT+1)x-#define WT_QIC02_DATA_PORT	(QIC02_TAPE_PORT+1)x-
-/* status register bits (Active LOW!) */x-#define WT_QIC02_STAT_POLARITY	0
-#define WT_QIC02_STAT_READY	0x01
-#define WT_QIC02_STAT_EXCEPTION	0x02
-#define WT_QIC02_STAT_MASK	(WT_QIC02_STAT_READY|WT_QIC02_STAT_EXCEPTION)x-
-#define WT_QIC02_STAT_RESETMASK	0x07
-#define WT_QIC02_STAT_RESETVAL	(WT_QIC02_STAT_RESETMASK & ~WT_QIC02_STAT_EXCEPTION)x-
-/* controller register (QIC02_CTL_PORT) bits */x-#define WT_QIC02_CTL_RESET	0x02
-#define WT_QIC02_CTL_REQUEST	0x04
-#define WT_CTL_ONLINE		0x01
-#define WT_CTL_CMDOFF		0xC0 x-
-#define WT_CTL_DMA3		0x10			  /* enable dma chan3 */x-#define WT_CTL_DMA1		0x08	         /* enable dma chan1 or chan2 */x-
-/* EMERALD interface card specifics
- * Much like Wangtek, only different polarity and bit locations
- */x-#define EMR_QIC02_STAT_PORT	(QIC02_TAPE_PORT)x-#define EMR_QIC02_CTL_PORT	(QIC02_TAPE_PORT)x-#define EMR_QIC02_CMD_PORT	(QIC02_TAPE_PORT+1)x-#define EMR_QIC02_DATA_PORT	(QIC02_TAPE_PORT+1)x-
-/* status register bits (Active High!) */x-#define EMR_QIC02_STAT_POLARITY		1
-#define EMR_QIC02_STAT_READY		0x01
-#define EMR_QIC02_STAT_EXCEPTION	0x02
-#define EMR_QIC02_STAT_MASK	(EMR_QIC02_STAT_READY|EMR_QIC02_STAT_EXCEPTION)x-
-#define EMR_QIC02_STAT_RESETMASK	0x07
-#define EMR_QIC02_STAT_RESETVAL	(EMR_QIC02_STAT_RESETMASK & ~EMR_QIC02_STAT_EXCEPTION)x-
-/* controller register (QIC02_CTL_PORT) bits */x-#define EMR_QIC02_CTL_RESET	0x02
-#define EMR_QIC02_CTL_REQUEST	0x04
-#define EMR_CTL_ONLINE		0x01
-#define EMR_CTL_CMDOFF		0xC0 x-
-#define EMR_CTL_DMA3		0x10			  /* enable dma chan3 */x-#define EMR_CTL_DMA1		0x08	         /* enable dma chan1 or chan2 */x-
-x-
-/* ARCHIVE interface card specifics */x-#define AR_QIC02_STAT_PORT	(QIC02_TAPE_PORT+1)x-#define AR_QIC02_CTL_PORT	(QIC02_TAPE_PORT+1)x-#define AR_QIC02_CMD_PORT	(QIC02_TAPE_PORT)x-#define AR_QIC02_DATA_PORT	(QIC02_TAPE_PORT)x-
-#define AR_START_DMA_PORT	(QIC02_TAPE_PORT+2)x-#define AR_RESET_DMA_PORT	(QIC02_TAPE_PORT+3)x-
-/* STAT port bits */x-#define AR_QIC02_STAT_POLARITY	0
-#define AR_STAT_IRQF		0x80	/* active high, interrupt request flag */
-#define AR_QIC02_STAT_READY	0x40	/* active low */
-#define AR_QIC02_STAT_EXCEPTION	0x20	/* active low */
-#define AR_QIC02_STAT_MASK	(AR_QIC02_STAT_READY|AR_QIC02_STAT_EXCEPTION)x-#define AR_STAT_DMADONE		0x10	/* active high, DMA done */
-#define AR_STAT_DIRC		0x08	/* active high, direction */
-
-#define AR_QIC02_STAT_RESETMASK	0x70	/* check RDY,EXC,DMADONE */
-#define AR_QIC02_STAT_RESETVAL	((AR_QIC02_STAT_RESETMASK & ~AR_STAT_IRQF & ~AR_QIC02_STAT_EXCEPTION) | AR_STAT_DMADONE)x-
-/* CTL port bits */x-#define AR_QIC02_CTL_RESET	0x80	/* drive reset */x-#define AR_QIC02_CTL_REQUEST	0x40	/* notify of new command */x-#define AR_CTL_IEN		0x20	/* interrupt enable */x-#define AR_CTL_DNIEN		0x10	/* done-interrupt enable */x-  /* Note: All of these bits are cleared automatically when writing to
-   * AR_RESET_DMA_PORT. So AR_CTL_IEN and AR_CTL_DNIEN must be
-   * reprogrammed before the write to AR_START_DMA_PORT.
-   */
-
-
-/* MOUNTAIN interface specifics */x-#define MTN_QIC02_STAT_PORT	(QIC02_TAPE_PORT+1)x-#define MTN_QIC02_CTL_PORT	(QIC02_TAPE_PORT+1)x-#define MTN_QIC02_CMD_PORT	(QIC02_TAPE_PORT)x-#define MTN_QIC02_DATA_PORT	(QIC02_TAPE_PORT)x-
-#define MTN_W_SELECT_DMA_PORT	(QIC02_TAPE_PORT+2)x-#define MTN_R_DESELECT_DMA_PORT	(QIC02_TAPE_PORT+2)x-#define MTN_W_DMA_WRITE_PORT	(QIC02_TAPE_PORT+3)x-
-/* STAT port bits */x-#define MTN_QIC02_STAT_POLARITY	 0x-#define MTN_QIC02_STAT_READY	 0x02	/* active low */
-#define MTN_QIC02_STAT_EXCEPTION 0x04	/* active low */
-#define MTN_QIC02_STAT_MASK	 (MTN_QIC02_STAT_READY|MTN_QIC02_STAT_EXCEPTION)x-#define MTN_STAT_DMADONE	 0x01	/* active high, DMA done */
-x-#define MTN_QIC02_STAT_RESETMASK 0x07	/* check RDY,EXC,DMADONE */
-#define MTN_QIC02_STAT_RESETVAL	 ((MTN_QIC02_STAT_RESETMASK & ~MTN_QIC02_STAT_EXCEPTION) | MTN_STAT_DMADONE)x-
-/* CTL port bits */x-#define MTN_QIC02_CTL_RESET_NOT	 0x80	/* drive reset, active low */
-#define MTN_QIC02_CTL_RESET	 0x80	/* Fodder #definition to keep gcc happy */x-
-#define MTN_QIC02_CTL_ONLINE	 0x40	/* Put drive on line  */
-#define MTN_QIC02_CTL_REQUEST	 0x20	/* notify of new command */x-#define MTN_QIC02_CTL_IRQ_DRIVER 0x10	/* Enable IRQ tristate driver */x-#define MTN_QIC02_CTL_DMA_DRIVER 0x08	/* Enable DMA tristate driver */x-#define MTN_CTL_EXC_IEN		 0x04	/* Exception interrupt enable */x-#define MTN_CTL_RDY_IEN		 0x02	/* Ready interrupt enable */x-#define MTN_CTL_DNIEN		 0x01	/* done-interrupt enable */x-x-#define MTN_CTL_ONLINE		(MTN_QIC02_CTL_RESET_NOT | MTN_QIC02_CTL_IRQ_DRIVER | MTN_QIC02_CTL_DMA_DRIVER)x-
-
-#ifndef CONFIG_QIC02_DYNCONF
-x-# define QIC02_TAPE_DEBUG	(qic02_tape_debug)x-
-# if QIC02_TAPE_IFC == WANGTEK	
-#  define QIC02_STAT_POLARITY	WT_QIC02_STAT_POLARITY
-#  define QIC02_STAT_PORT	WT_QIC02_STAT_PORT
-#  define QIC02_CTL_PORT	WT_QIC02_CTL_PORT
-#  define QIC02_CMD_PORT	WT_QIC02_CMD_PORT
-#  define QIC02_DATA_PORT	WT_QIC02_DATA_PORTx-
-#  define QIC02_STAT_READY	WT_QIC02_STAT_READY
-#  define QIC02_STAT_EXCEPTION	WT_QIC02_STAT_EXCEPTION
-#  define QIC02_STAT_MASK	WT_QIC02_STAT_MASK
-#  define QIC02_STAT_RESETMASK	WT_QIC02_STAT_RESETMASK
-#  define QIC02_STAT_RESETVAL	WT_QIC02_STAT_RESETVALx-
-#  define QIC02_CTL_RESET	WT_QIC02_CTL_RESET
-#  define QIC02_CTL_REQUEST	WT_QIC02_CTL_REQUESTx-
-#  if QIC02_TAPE_DMA == 3
-#   ifdef QIC02_TAPE_DMA3_FIX
-#    define WT_CTL_DMA		WT_CTL_DMA1
-#   else
-#    define WT_CTL_DMA		WT_CTL_DMA3
-#   endifx-#  elif QIC02_TAPE_DMA == 1
-#    define WT_CTL_DMA		WT_CTL_DMA1
-#  else
-#   error Unsupported or incorrect DMA configuration.
-#  endifx-x-# elif QIC02_TAPE_IFC == EMERALD
-#  define QIC02_STAT_POLARITY	EMR_QIC02_STAT_POLARITY
-#  define QIC02_STAT_PORT	EMR_QIC02_STAT_PORT
-#  define QIC02_CTL_PORT	EMR_QIC02_CTL_PORT
-#  define QIC02_CMD_PORT	EMR_QIC02_CMD_PORT
-#  define QIC02_DATA_PORT	EMR_QIC02_DATA_PORTx-
-#  define QIC02_STAT_READY	EMR_QIC02_STAT_READY
-#  define QIC02_STAT_EXCEPTION	EMR_QIC02_STAT_EXCEPTION
-#  define QIC02_STAT_MASK	EMR_QIC02_STAT_MASK
-#  define QIC02_STAT_RESETMASK	EMR_QIC02_STAT_RESETMASK
-#  define QIC02_STAT_RESETVAL	EMR_QIC02_STAT_RESETVALx-
-#  define QIC02_CTL_RESET	EMR_QIC02_CTL_RESET
-#  define QIC02_CTL_REQUEST	EMR_QIC02_CTL_REQUESTx-
-#  if QIC02_TAPE_DMA == 3
-#   ifdef QIC02_TAPE_DMA3_FIX
-#    define EMR_CTL_DMA		EMR_CTL_DMA1
-#   else
-#    define EMR_CTL_DMA		EMR_CTL_DMA3
-#   endifx-#  elif QIC02_TAPE_DMA == 1
-#    define EMR_CTL_DMA		EMR_CTL_DMA1
-#  else
-#   error Unsupported or incorrect DMA configuration.
-#  endifx-x-# elif QIC02_TAPE_IFC == ARCHIVE
-#  define QIC02_STAT_POLARITY	AR_QIC02_STAT_POLARITY
-#  define QIC02_STAT_PORT	AR_QIC02_STAT_PORT
-#  define QIC02_CTL_PORT	AR_QIC02_CTL_PORT
-#  define QIC02_CMD_PORT	AR_QIC02_CMD_PORT
-#  define QIC02_DATA_PORT	AR_QIC02_DATA_PORTx-
-#  define QIC02_STAT_READY	AR_QIC02_STAT_READY
-#  define QIC02_STAT_EXCEPTION	AR_QIC02_STAT_EXCEPTION
-#  define QIC02_STAT_MASK	AR_QIC02_STAT_MASK
-#  define QIC02_STAT_RESETMASK	AR_QIC02_STAT_RESETMASK
-#  define QIC02_STAT_RESETVAL	AR_QIC02_STAT_RESETVALx-
-#  define QIC02_CTL_RESET	AR_QIC02_CTL_RESET
-#  define QIC02_CTL_REQUEST	AR_QIC02_CTL_REQUESTx-
-#  if QIC02_TAPE_DMA > 3	/* channel 2 is used by the floppy driver */x-#   error DMA channels other than 1 and 3 are not supported.
-#  endifx-x-# elif QIC02_TAPE_IFC == MOUNTAIN
-#  define QIC02_STAT_POLARITY	MTN_QIC02_STAT_POLARITY
-#  define QIC02_STAT_PORT	MTN_QIC02_STAT_PORT
-#  define QIC02_CTL_PORT	MTN_QIC02_CTL_PORT
-#  define QIC02_CMD_PORT	MTN_QIC02_CMD_PORT
-#  define QIC02_DATA_PORT	MTN_QIC02_DATA_PORTx-
-#  define QIC02_STAT_READY	MTN_QIC02_STAT_READY
-#  define QIC02_STAT_EXCEPTION	MTN_QIC02_STAT_EXCEPTION
-#  define QIC02_STAT_MASK	MTN_QIC02_STAT_MASK
-#  define QIC02_STAT_RESETMASK	MTN_QIC02_STAT_RESETMASK
-#  define QIC02_STAT_RESETVAL	MTN_QIC02_STAT_RESETVALx-
-#  define QIC02_CTL_RESET	MTN_QIC02_CTL_RESET
-#  define QIC02_CTL_REQUEST	MTN_QIC02_CTL_REQUESTx-
-#  if QIC02_TAPE_DMA > 3	/* channel 2 is used by the floppy driver */x-#   error DMA channels other than 1 and 3 are not supported.
-#  endifx-x-# else
-#  error No valid interface card specified!
-# endif /* QIC02_TAPE_IFC */
-
-
-  /* An ugly hack to make sure WT_CTL_DMA is defined even for the
-   * static, non-Wangtek case. The alternative was even worse.
-   */ 
-# ifndef WT_CTL_DMA
-#  define WT_CTL_DMA		WT_CTL_DMA1
-# endifx-x-/*******************/x-
-#else /* !CONFIG_QIC02_DYNCONF */
-
-/* Now the runtime config version, using variables instead of constants.
- *
- * qic02_tape_dynconf is R/O for the kernel, set from userspace.
- * qic02_tape_ccb is private to the driver, R/W.
- */x-
-# define QIC02_TAPE_DRIVE	(qic02_tape_dynconf.mt_type)
-# define QIC02_TAPE_IFC		(qic02_tape_ccb.ifc_type)
-# define QIC02_TAPE_IRQ		(qic02_tape_dynconf.irqnr)
-# define QIC02_TAPE_DMA		(qic02_tape_dynconf.dmanr)
-# define QIC02_TAPE_PORT	(qic02_tape_dynconf.port)
-# define WT_CTL_DMA		(qic02_tape_ccb.dma_enable_value)x-# define QIC02_TAPE_DEBUG	(qic02_tape_dynconf.debug)x-
-# define QIC02_STAT_PORT	(qic02_tape_ccb.port_stat)x-# define QIC02_CTL_PORT 	(qic02_tape_ccb.port_ctl)x-# define QIC02_CMD_PORT 	(qic02_tape_ccb.port_cmd)x-# define QIC02_DATA_PORT 	(qic02_tape_ccb.port_data)x-
-# define QIC02_STAT_POLARITY	(qic02_tape_ccb.stat_polarity)
-# define QIC02_STAT_READY	(qic02_tape_ccb.stat_ready)
-# define QIC02_STAT_EXCEPTION	(qic02_tape_ccb.stat_exception)
-# define QIC02_STAT_MASK	(qic02_tape_ccb.stat_mask)x-
-# define QIC02_STAT_RESETMASK	(qic02_tape_ccb.stat_resetmask)x-# define QIC02_STAT_RESETVAL	(qic02_tape_ccb.stat_resetval)x-
-# define QIC02_CTL_RESET	(qic02_tape_ccb.ctl_reset)
-# define QIC02_CTL_REQUEST	(qic02_tape_ccb.ctl_request)x-
-# define TP_HAVE_DENS		(qic02_tape_dynconf.have_dens)
-# define TP_HAVE_BSF		(qic02_tape_dynconf.have_bsf)
-# define TP_HAVE_FSR		(qic02_tape_dynconf.have_fsr)
-# define TP_HAVE_BSR		(qic02_tape_dynconf.have_bsr)
-# define TP_HAVE_EOD		(qic02_tape_dynconf.have_eod)
-# define TP_HAVE_SEEK		(qic02_tape_dynconf.have_seek)
-# define TP_HAVE_TELL		(qic02_tape_dynconf.have_tell)
-# define TP_HAVE_RAS1		(qic02_tape_dynconf.have_ras1)
-# define TP_HAVE_RAS2		(qic02_tape_dynconf.have_ras2)x-x-#endif /* CONFIG_QIC02_DYNCONF */
-
-
-/* "Vendor Unique" codes */x-/* Archive seek & tell stuff */x-#define AR_QCMDV_TELL_BLK	0xAE	/* read current block address */x-#define AR_QCMDV_SEEK_BLK	0xAD	/* seek to specific block */x-#define AR_SEEK_BUF_SIZE	3	/* address is 3 bytes */x-
-x-
-/*
- * Misc common stuff
- */x-
-/* Standard QIC-02 commands -- rev F.  All QIC-02 drives must support these */x-#define QCMD_SEL_1	0x01		/* select drive 1 */x-#define QCMD_SEL_2	0x02		/* select drive 2 */x-#define QCMD_SEL_3	0x04		/* select drive 3 */x-#define QCMD_SEL_4	0x08		/* select drive 4 */x-#define	QCMD_REWIND	0x21		/* rewind tape */x-#define QCMD_ERASE	0x22		/* erase tape */x-#define QCMD_RETEN	0x24		/* retension tape */x-#define	QCMD_WRT_DATA	0x40		/* write data */x-#define	QCMD_WRT_FM	0x60		/* write file mark */x-#define	QCMD_RD_DATA	0x80		/* read data */x-#define	QCMD_RD_FM	0xA0		/* read file mark (forward direction) */x-#define	QCMD_RD_STAT	0xC0		/* read status */x-
-/* Other (optional/vendor unique) commands */x- /* Density commands are only valid when TP_BOM is set! */x-#define QCMD_DENS_11	0x26		/* QIC-11 */x-#define QCMD_DENS_24	0x27		/* QIC-24: 9 track 60MB */x-#define QCMD_DENS_120	0x28		/* QIC-120: 15 track 120MB */x-#define QCMD_DENS_150	0x29		/* QIC-150: 18 track 150MB */x-#define QCMD_DENS_300	0x2A		/* QIC-300/QIC-2100 */x-#define QCMD_DENS_600	0x2B		/* QIC-600/QIC-2200 */x-/* don't know about QIC-1000 and QIC-1350 */x-x-#define	QCMD_WRTNU_DATA	0x40		/* write data, no underruns, insert filler. */x-#define QCMD_SPACE_FWD	0x81		/* skip next block */x-#define QCMD_SPACE_BCK	0x89		/* move tape head one block back -- very useful! */x-#define QCMD_RD_FM_BCK	0xA8		/* read filemark (backwards) */x-#define QCMD_SEEK_EOD	0xA3		/* skip to EOD */x-#define	QCMD_RD_STAT_X1	0xC1		/* read extended status 1 */x-#define	QCMD_RD_STAT_X2	0xC4		/* read extended status 2 */x-#define	QCMD_RD_STAT_X3	0xE0		/* read extended status 3 */x-#define QCMD_SELF_TST1	0xC2		/* run self test 1 (nondestructive) */x-#define QCMD_SELF_TST2	0xCA		/* run self test 2 (destructive) */x-
-
-
-/* Optional, QFA (Quick File Access) commands.
- * Not all drives support this, but those that do could use these commands
- * to implement semi-non-sequential access. `mt fsf` would benefit from this.
- * QFA divides the tape into 2 partitions, a data and a directory partition,
- * causing some incompatibility problems wrt std QIC-02 data exchange.
- * It would be useful to cache the directory info, but that might be tricky
- * to do in kernel-space. [Size constraints.]
- * Refer to the QIC-02 specs, appendix A for more information.
- * I have no idea how other *nix variants implement QFA.
- * I have no idea which drives support QFA and which don't.
- */x-#define QFA_ENABLE	0x2D		/* enter QFA mode, give @ BOT only */x-#define QFA_DATA	0x20		/* select data partition */x-#define QFA_DIR		0x23		/* select directory partition */x-#define QFA_RD_POS	0xCF		/* read position+status bytes */x-#define QFA_SEEK_EOD	0xA1		/* seek EOD within current partition */x-#define QFA_SEEK_BLK	0xAF		/* seek to a block within current partition */x-x-
-x-
-/*
- * Debugging flags
- */x-#define TPQD_SENSE_TEXT	0x0001x-#define TPQD_SENSE_CNTS 0x0002x-#define TPQD_REWIND	0x0004x-#define TPQD_TERM_CYCLE	0x0008x-#define TPQD_IOCTLS	0x0010x-#define TPQD_DMAX	0x0020x-#define TPQD_BLKSZ	0x0040x-#define TPQD_MISC	0x0080x-x-#define TPQD_DEBUG	0x0100x-x-#define TPQD_DIAGS	0x1000x-x-#define TPQD_ALWAYS	0x8000
-x-#define TPQD_DEFAULT_FLAGS	0x00fc
-
-x-#define TPQDBG(f)	((QIC02_TAPE_DEBUG) & (TPQD_##f))
-
-
-/* Minor device codes for tapes:
- * |7|6|5|4|3|2|1|0|
- *  | \ | / \ | / |_____ 1=rewind on close, 0=no rewind on close
- *  |  \|/    |_________ Density: 000=none, 001=QIC-11, 010=24, 011=120,
- *  |   |                100=QIC-150, 101..111 reserved.
- *  |   |_______________ Reserved for unit numbers.
- *  |___________________ Reserved for diagnostics during debugging.
- */x-
-#define	TP_REWCLOSE(d)	((d)&1)	   		/* rewind bit */x-			   /* rewind is only done if data has been transferred */x-#define	TP_DENS(d)	(((d) >> 1) & 0x07) 	      /* tape density */x-#define TP_UNIT(d)	(((d) >> 4) & 0x07)	       /* unit number */x-
-/* print excessive diagnostics */x-#define TP_DIAGS(dev)	(QIC02_TAPE_DEBUG & TPQD_DIAGS)x-
-/* status codes returned by a WTS_RDSTAT call */x-struct tpstatus {	/* sizeof(short)==2), LSB first */x-	unsigned short	exs;	/* Drive exception flags */
-	unsigned short	dec;	/* data error count: nr of blocks rewritten/soft read errors */
-	unsigned short	urc;	/* underrun count: nr of times streaming was interrupted */x-};x-#define TPSTATSIZE	sizeof(struct tpstatus)
-
-
-/* defines for tpstatus.exs -- taken from 386BSD wt driver */x-#define	TP_POR		0x100	/* Power on or reset occurred */x-#define	TP_EOR		0x200	/* REServed for end of RECORDED media */x-#define	TP_PAR		0x400	/* REServed for bus parity */x-#define	TP_BOM		0x800	/* Beginning of media */x-#define	TP_MBD		0x1000	/* Marginal block detected */x-#define	TP_NDT		0x2000	/* No data detected */x-#define	TP_ILL		0x4000	/* Illegal command */x-#define	TP_ST1		0x8000	/* Status byte 1 flag */
-#define	TP_FIL		0x01	/* File mark detected */x-#define	TP_BNL		0x02	/* Bad block not located */x-#define	TP_UDA		0x04	/* Unrecoverable data error */x-#define	TP_EOM		0x08	/* End of media */x-#define	TP_WRP		0x10	/* Write protected cartridge */x-#define	TP_USL		0x20	/* Unselected drive */x-#define	TP_CNI		0x40	/* Cartridge not in place */x-#define	TP_ST0		0x80	/* Status byte 0 flag */
-x-#define REPORT_ERR0	(TP_CNI|TP_USL|TP_WRP|TP_EOM|TP_UDA|TP_BNL|TP_FIL)x-#define REPORT_ERR1	(TP_ILL|TP_NDT|TP_MBD|TP_PAR)
-
-
-/* exception numbers */x-#define EXC_UNKNOWN	0	/* (extra) Unknown exception code */x-#define EXC_NDRV	1	/* No drive */x-#define EXC_NCART	2	/* No cartridge */x-#define EXC_WP		3	/* Write protected */x-#define EXC_EOM		4	/* EOM */x-#define EXC_RWA		5	/* read/write abort */x-#define EXC_XBAD	6	/* read error, bad block transferred */x-#define EXC_XFILLER	7	/* read error, filler block transferred */x-#define EXC_NDT		8	/* read error, no data */x-#define EXC_NDTEOM	9	/* read error, no data & EOM */x-#define EXC_NDTBOM	10	/* read error, no data & BOM */x-#define EXC_FM		11	/* Read a filemark */x-#define EXC_ILL		12	/* Illegal command */x-#define EXC_POR		13	/* Power on/reset */x-#define EXC_MARGINAL	14	/* Marginal block detected */x-#define EXC_EOR		15	/* (extra, for SEEKEOD) End Of Recorded data reached */x-#define EXC_BOM		16	/* (extra) BOM reached */x-
-x-#define TAPE_NOTIFY_TIMEOUT	1000000
-x-/* internal function return codes */x-#define TE_OK	0		/* everything is fine */x-#define TE_EX	1		/* exception detected */x-#define TE_ERR	2		/* some error */x-#define TE_NS	3		/* can't read status */x-#define TE_TIM	4		/* timed out */x-#define TE_DEAD	5		/* tape drive doesn't respond */x-#define TE_END	6		/******** Archive hack *****/x-
-/* timeout timer values -- check these! */x-#define TIM_S	(4*HZ)		/* 4 seconds (normal cmds) */x-#define TIM_M	(30*HZ)		/* 30 seconds (write FM) */x-#define TIM_R	(8*60*HZ)	/* 8 minutes (retensioning) */x-#define TIM_F	(2*3600*HZ)	/* est. 1.2hr for full tape read/write+2 retens */
-x-#define TIMERON(t)	mod_timer(&tp_timer, jiffies + (t))x-#define TIMEROFF	del_timer_sync(&tp_timer);x-#define TIMERCONT	add_timer(&tp_timer);x-x-x-typedef char flag;x-#define NO	0	/* NO must be 0 */x-#define YES	1	/* YES must be != 0 */x-
-x-#ifdef TDEBUG
-# define TPQDEB(s)	s
-# define TPQPUTS(s)	tpqputs(s)
-#else
-# define TPQDEB(s)
-# define TPQPUTS(s)x-#endifx-x-
-/* NR_BLK_BUF is a `tuneable parameter'. If you're really low on
- * kernel space, you could decrease it to 1, or if you got a very
- * slow machine, you could increase it up to 127 blocks. Less kernel
- * buffer blocks result in more context-switching.
- */x-#define NR_BLK_BUF	20				    /* max 127 blocks */x-#define TAPE_BLKSIZE	512		  /* streamer tape block size (fixed) */x-#define TPQBUF_SIZE	(TAPE_BLKSIZE*NR_BLK_BUF)	       /* buffer size */x-
-x-#define BLOCKS_BEYOND_EW	2	/* nr of blocks after Early Warning hole */x-#define BOGUS_IRQ		32009x-x-
-/* This is internal data, filled in based on the ifc_type field given
- * by the user. Everex is mapped to Wangtek with a different
- * `dma_enable_value', if dmanr==3.
- */x-struct qic02_ccb {
-	long	ifc_type;x-x-	unsigned short	port_stat;	/* Status port address */x-	unsigned short	port_ctl;	/* Control port address */x-	unsigned short	port_cmd;	/* Command port address */x-	unsigned short	port_data;	/* Data port address */x-x-	/* status register bits */x-	unsigned short	stat_polarity;	/* invert status bits or not */x-	unsigned short	stat_ready;	/* drive ready */x-	unsigned short	stat_exception;	/* drive signals exception */x-	unsigned short	stat_mask;x-	unsigned short	stat_resetmask;x-	unsigned short	stat_resetval;x-x-	/* control register bits */x-	unsigned short	ctl_reset;	/* reset drive */x-	unsigned short	ctl_request;	/* latch command */x-	x-	/* This is used to change the DMA3 behaviour */
-	unsigned short	dma_enable_value;x-};x-x-#if MODULEx-static int qic02_tape_init(void);x-#else
-extern int qic02_tape_init(void);			  /* for mem.c */x-#endifx-x-x-x-#endif /* CONFIG_QIC02_TAPE */x-
-#endif /* _LINUX_TPQIC02_H */x-
diff -Nru a/include/linux/usb.h b/include/linux/usb.h
--- a/include/linux/usb.h	2005-01-05 12:21:53 -08:00
+++ b/include/linux/usb.h	2005-03-07 20:42:07 -08:00
@@ -70,6 +70,7 @@
 	 */x 	struct usb_host_endpoint *endpoint;x x+	char *string;		/* iInterface string, if present */x 	unsigned char *extra;   /* Extra descriptors */
 	int extralen;
 };x@@ -189,6 +190,8 @@
 /**
  * struct usb_host_config - representation of a device's configuration
  * @desc: the device's configuration descriptor.
+ * @string: pointer to the cached version of the iConfiguration string, if
+ *	present for this configuration.
  * @interface: array of pointers to usb_interface structures, one for each
  *	interface in the configuration.  The number of interfaces is stored
  *	in desc.bNumInterfaces.  These pointers are valid only while the
@@ -225,6 +228,7 @@
 struct usb_host_config {x 	struct usb_config_descriptor	desc;x x+	char *string;x 	/* the interfaces associated with this configuration,
 	 * stored in no particular order */x 	struct usb_interface *interface[USB_MAXINTERFACES];
@@ -285,6 +289,10 @@
 x 	struct class_device class_dev;	/* class device for this bus */
 	void (*release)(struct usb_bus *bus);	/* function to destroy this bus's memory */x+#if defined(CONFIG_USB_MON) || defined(CONFIG_USB_MON_MODULE)x+	struct mon_bus *mon_bus;	/* non-null when associated */x+	int monitored;			/* non-zero when monitored */x+#endifx };x #define	to_usb_bus(d) container_of(d, struct usb_bus, class_dev)
 x@@ -338,6 +346,9 @@
 	int have_langid;		/* whether string_langid is valid yet */
 	int string_langid;		/* language ID for strings */
 x+	char *product;x+	char *manufacturer;x+	char *serial;			/* static strings from the device */x 	struct list_head filelist;x 	struct dentry *usbfs_dentry;	/* usbfs dentry entry for the device */x x@@ -986,13 +997,13 @@
 extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate);x x /*
- * timeouts, in seconds, used for sending/receiving control messages
+ * timeouts, in milliseconds, used for sending/receiving control messages
  * they typically complete within a few frames (msec) after they're issued
  * USB identifies 5 second timeouts, maybe more in a few cases, and a few
  * slow devices (like some MGE Ellipse UPSes) actually push that limit.
  */x-#define USB_CTRL_GET_TIMEOUT	5x-#define USB_CTRL_SET_TIMEOUT	5x+#define USB_CTRL_GET_TIMEOUT	5000
+#define USB_CTRL_SET_TIMEOUT	5000
 x x /**
diff -Nru a/include/linux/usb_cdc.h b/include/linux/usb_cdc.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/include/linux/usb_cdc.h	2005-03-07 20:49:37 -08:00
@@ -0,0 +1,162 @@
+/*
+ * USB Communications Device Class (CDC) definitions
+ *
+ * CDC says how to talk to lots of different types of network adapters,
+ * notably ethernet adapters and various modems.  It's used mostly with
+ * firmware based USB peripherals.
+ */x+
+#define USB_CDC_SUBCLASS_ACM			2
+#define USB_CDC_SUBCLASS_ETHERNET		6x+
+#define USB_CDC_PROTO_NONE			0x+
+#define USB_CDC_ACM_PROTO_AT_V25TER		1
+#define USB_CDC_ACM_PROTO_AT_PCCA101		2
+#define USB_CDC_ACM_PROTO_AT_PCCA101_WAKE	3
+#define USB_CDC_ACM_PROTO_AT_GSM		4
+#define USB_CDC_ACM_PROTO_AT_3G			5
+#define USB_CDC_ACM_PROTO_AT_CDMA		6
+#define USB_CDC_ACM_PROTO_VENDOR		0xffx+
+/*-------------------------------------------------------------------------*/x+
+/*
+ * Class-Specific descriptors ... there are a couple dozen of them
+ */x+
+#define USB_CDC_HEADER_TYPE		0x00		/* header_desc */x+#define USB_CDC_CALL_MANAGEMENT_TYPE	0x01		/* call_mgmt_descriptor */x+#define USB_CDC_ACM_TYPE		0x02		/* acm_descriptor */x+#define USB_CDC_UNION_TYPE		0x06		/* union_desc */x+#define USB_CDC_COUNTRY_TYPE		0x07x+#define USB_CDC_ETHERNET_TYPE		0x0f		/* ether_desc */x+
+/* "Header Functional Descriptor" from CDC spec  5.2.3.1 */x+struct usb_cdc_header_desc {x+	__u8	bLength;x+	__u8	bDescriptorType;x+	__u8	bDescriptorSubType;x+x+	__le16	bcdCDC;x+} __attribute__ ((packed));x+
+/* "Call Management Descriptor" from CDC spec  5.2.3.2 */x+struct usb_cdc_call_mgmt_descriptor {x+	__u8	bLength;x+	__u8	bDescriptorType;x+	__u8	bDescriptorSubType;x+x+	__u8	bmCapabilities;x+#define USB_CDC_CALL_MGMT_CAP_CALL_MGMT		0x01
+#define USB_CDC_CALL_MGMT_CAP_DATA_INTF		0x02x+x+	__u8	bDataInterface;x+} __attribute__ ((packed));x+
+/* "Abstract Control Management Descriptor" from CDC spec  5.2.3.3 */x+struct usb_cdc_acm_descriptor {x+	__u8	bLength;x+	__u8	bDescriptorType;x+	__u8	bDescriptorSubType;x+x+	__u8	bmCapabilities;x+} __attribute__ ((packed));x+
+/* "Union Functional Descriptor" from CDC spec 5.2.3.8 */x+struct usb_cdc_union_desc {x+	__u8	bLength;x+	__u8	bDescriptorType;x+	__u8	bDescriptorSubType;x+x+	__u8	bMasterInterface0;x+	__u8	bSlaveInterface0;x+	/* ... and there could be other slave interfaces */x+} __attribute__ ((packed));x+
+/* "Ethernet Networking Functional Descriptor" from CDC spec 5.2.3.16 */x+struct usb_cdc_ether_desc {x+	__u8	bLength;x+	__u8	bDescriptorType;x+	__u8	bDescriptorSubType;x+x+	__u8	iMACAddress;x+	__le32	bmEthernetStatistics;x+	__le16	wMaxSegmentSize;x+	__le16	wNumberMCFilters;x+	__u8	bNumberPowerFilters;x+} __attribute__ ((packed));x+
+/*-------------------------------------------------------------------------*/x+
+/*
+ * Class-Specific Control Requests (6.2)
+ *
+ * section 3.6.2.1 table 4 has the ACM profile, for modems.
+ * section 3.8.2 table 10 has the ethernet profile.
+ *
+ * Microsoft's RNDIS stack for Ethernet is a vendor-specific CDC ACM variant,
+ * heavily dependent on the encapsulated (proprietary) command mechanism.
+ */x+
+#define USB_CDC_SEND_ENCAPSULATED_COMMAND	0x00
+#define USB_CDC_GET_ENCAPSULATED_RESPONSE	0x01
+#define USB_CDC_REQ_SET_LINE_CODING		0x20
+#define USB_CDC_REQ_GET_LINE_CODING		0x21
+#define USB_CDC_REQ_SET_CONTROL_LINE_STATE	0x22
+#define USB_CDC_REQ_SEND_BREAK			0x23
+#define USB_CDC_SET_ETHERNET_MULTICAST_FILTERS	0x40
+#define USB_CDC_SET_ETHERNET_PM_PATTERN_FILTER	0x41
+#define USB_CDC_GET_ETHERNET_PM_PATTERN_FILTER	0x42
+#define USB_CDC_SET_ETHERNET_PACKET_FILTER	0x43
+#define USB_CDC_GET_ETHERNET_STATISTIC		0x44x+
+/* Line Coding Structure from CDC spec 6.2.13 */x+struct usb_cdc_line_coding {x+	__le32	dwDTERate;x+	__u8	bCharFormat;x+#define USB_CDC_1_STOP_BITS			0x+#define USB_CDC_1_5_STOP_BITS			1
+#define USB_CDC_2_STOP_BITS			2x+x+	__u8	bParityType;x+#define USB_CDC_NO_PARITY			0x+#define USB_CDC_ODD_PARITY			1
+#define USB_CDC_EVEN_PARITY			2
+#define USB_CDC_MARK_PARITY			3
+#define USB_CDC_SPACE_PARITY			4x+x+	__u8	bDataBits;x+} __attribute__ ((packed));x+
+/* table 62; bits in multicast filter */x+#define	USB_CDC_PACKET_TYPE_PROMISCUOUS		(1 << 0)x+#define	USB_CDC_PACKET_TYPE_ALL_MULTICAST	(1 << 1) /* no filter */x+#define	USB_CDC_PACKET_TYPE_DIRECTED		(1 << 2)x+#define	USB_CDC_PACKET_TYPE_BROADCAST		(1 << 3)x+#define	USB_CDC_PACKET_TYPE_MULTICAST		(1 << 4) /* filtered */x+x+
+/*-------------------------------------------------------------------------*/x+
+/*
+ * Class-Specific Notifications (6.3) sent by interrupt transfers
+ *
+ * section 3.8.2 table 11 of the CDC spec lists Ethernet notifications
+ * section 3.6.2.1 table 5 specifies ACM notifications, accepted by RNDIS
+ * RNDIS also defines its own bit-incompatible notifications
+ */x+
+#define USB_CDC_NOTIFY_NETWORK_CONNECTION	0x00
+#define USB_CDC_NOTIFY_RESPONSE_AVAILABLE	0x01
+#define USB_CDC_NOTIFY_SERIAL_STATE		0x20
+#define USB_CDC_NOTIFY_SPEED_CHANGE		0x2ax+
+struct usb_cdc_notification {x+	__u8	bmRequestType;x+	__u8	bNotificationType;x+	__le16	wValue;x+	__le16	wIndex;x+	__le16	wLength;x+} __attribute__ ((packed));x+
diff -Nru a/include/linux/usbdevice_fs.h b/include/linux/usbdevice_fs.h
--- a/include/linux/usbdevice_fs.h	2004-11-30 12:10:03 -08:00
+++ b/include/linux/usbdevice_fs.h	2005-03-07 20:41:38 -08:00
@@ -32,6 +32,7 @@
 #define _LINUX_USBDEVICE_FS_Hx x #include <linux/types.h>x+#include <linux/compat.h>x x /* --------------------------------------------------------------------- */x x@@ -123,6 +124,24 @@
 	char port [127];	/* e.g. port 3 connects to device 27 */x };x x+#ifdef CONFIG_COMPAT
+struct usbdevfs_urb32 {x+	unsigned char type;x+	unsigned char endpoint;x+	compat_int_t status;x+	compat_uint_t flags;x+	compat_caddr_t buffer;x+	compat_int_t buffer_length;x+	compat_int_t actual_length;x+	compat_int_t start_frame;x+	compat_int_t number_of_packets;x+	compat_int_t error_count;x+	compat_uint_t signr;x+	compat_caddr_t usercontext; /* unused */x+	struct usbdevfs_iso_packet_desc iso_frame_desc[0];x+};x+#endifx+
 #define USBDEVFS_CONTROL           _IOWR('U', 0, struct usbdevfs_ctrltransfer)
 #define USBDEVFS_BULK              _IOWR('U', 2, struct usbdevfs_bulktransfer)
 #define USBDEVFS_RESETEP           _IOR('U', 3, unsigned int)x@@ -130,9 +149,12 @@
 #define USBDEVFS_SETCONFIGURATION  _IOR('U', 5, unsigned int)x #define USBDEVFS_GETDRIVER         _IOW('U', 8, struct usbdevfs_getdriver)x #define USBDEVFS_SUBMITURB         _IOR('U', 10, struct usbdevfs_urb)
+#define USBDEVFS_SUBMITURB32       _IOR('U', 10, struct usbdevfs_urb32)x #define USBDEVFS_DISCARDURB        _IO('U', 11)
 #define USBDEVFS_REAPURB           _IOW('U', 12, void *)
+#define USBDEVFS_REAPURB32         _IOW('U', 12, u32)x #define USBDEVFS_REAPURBNDELAY     _IOW('U', 13, void *)
+#define USBDEVFS_REAPURBNDELAY32   _IOW('U', 13, u32)x #define USBDEVFS_DISCSIGNAL        _IOR('U', 14, struct usbdevfs_disconnectsignal)x #define USBDEVFS_CLAIMINTERFACE    _IOR('U', 15, unsigned int)x #define USBDEVFS_RELEASEINTERFACE  _IOR('U', 16, unsigned int)x@@ -143,5 +165,4 @@
 #define USBDEVFS_CLEAR_HALT        _IOR('U', 21, unsigned int)x #define USBDEVFS_DISCONNECT        _IO('U', 22)x #define USBDEVFS_CONNECT           _IO('U', 23)x-
 #endif /* _LINUX_USBDEVICE_FS_H */xdiff -Nru a/include/linux/vt_kern.h b/include/linux/vt_kern.h
--- a/include/linux/vt_kern.h	2004-08-23 01:15:11 -07:00
+++ b/include/linux/vt_kern.h	2005-03-07 20:41:45 -08:00
@@ -25,15 +25,6 @@
 #define BROKEN_GRAPHICS_PROGRAMS 1
 #endifx x-extern struct vt_struct {
-	int vc_num;				/* The console number */x-	unsigned char	vc_mode;		/* KD_TEXT, ... */x-	struct vt_mode	vt_mode;
-	int		vt_pid;
-	int		vt_newvt;
-	wait_queue_head_t paste_wait;x-} *vt_cons[MAX_NR_CONSOLES];
-
 extern void kd_mksound(unsigned int hz, unsigned int ticks);x extern int kbd_rate(struct kbd_repeat *rep);x x@@ -41,25 +32,25 @@
 x int vc_allocate(unsigned int console);x int vc_cons_allocated(unsigned int console);x-int vc_resize(int currcons, unsigned int cols, unsigned int lines);x+int vc_resize(struct vc_data *vc, unsigned int cols, unsigned int lines);x void vc_disallocate(unsigned int console);x-void reset_palette(int currcons);x-void set_palette(int currcons);x+void reset_palette(struct vc_data *vc);x+void set_palette(struct vc_data *vc);x void do_blank_screen(int entering_gfx);x void do_unblank_screen(int leaving_gfx);x void unblank_screen(void);x void poke_blanked_console(void);x-int con_font_op(int currcons, struct console_font_op *op);x-int con_font_set(int currcons, struct console_font_op *op);x-int con_font_get(int currcons, struct console_font_op *op);x-int con_font_default(int currcons, struct console_font_op *op);x-int con_font_copy(int currcons, struct console_font_op *op);x+int con_font_op(struct vc_data *vc, struct console_font_op *op);x+int con_font_set(struct vc_data *vc, struct console_font_op *op);x+int con_font_get(struct vc_data *vc, struct console_font_op *op);x+int con_font_default(struct vc_data *vc, struct console_font_op *op);x+int con_font_copy(struct vc_data *vc, struct console_font_op *op);x int con_set_cmap(unsigned char __user *cmap);x int con_get_cmap(unsigned char __user *cmap);x-void scrollback(int);x-void scrollfront(int);x-void update_region(int currcons, unsigned long start, int count);x-void redraw_screen(int new_console, int is_switch);x+void scrollback(struct vc_data *vc, int lines);x+void scrollfront(struct vc_data *vc, int lines);x+void update_region(struct vc_data *vc, unsigned long start, int count);x+void redraw_screen(struct vc_data *vc, int is_switch);x #define update_screen(x) redraw_screen(x, 0)x #define switch_screen(x) redraw_screen(x, 1)
 x@@ -75,25 +66,26 @@
 int con_get_trans_old(unsigned char __user * table);x int con_set_trans_new(unsigned short __user * table);x int con_get_trans_new(unsigned short __user * table);x-int con_clear_unimap(int currcons, struct unimapinit *ui);x-int con_set_unimap(int currcons, ushort ct, struct unipair __user *list);x-int con_get_unimap(int currcons, ushort ct, ushort __user *uct, struct unipair __user *list);x-int con_set_default_unimap(int currcons);x-void con_free_unimap(int currcons);x-void con_protect_unimap(int currcons, int rdonly);x-int con_copy_unimap(int dstcons, int srccons);x+int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui);x+int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list);x+int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, struct unipair __user *list);x+int con_set_default_unimap(struct vc_data *vc);x+void con_free_unimap(struct vc_data *vc);x+void con_protect_unimap(struct vc_data *vc, int rdonly);x+int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc);x x /* vt.c */x-void complete_change_console(unsigned int new_console);x+void complete_change_console(struct vc_data *vc);x int vt_waitactive(int vt);x-void change_console(unsigned int);x-void reset_vc(unsigned int new_console);x+void change_console(struct vc_data *new_vc);x+void reset_vc(struct vc_data *vc);x x /*
  * vc_screen.c shares this temporary buffer with the console write code so that
  * we can easily avoid touching user space while holding the console spinlock.
  */x-#define CON_BUF_SIZE	PAGE_SIZEx+
+#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)x extern char con_buf[CON_BUF_SIZE];x extern struct semaphore con_buf_sem;x xdiff -Nru a/include/linux/workqueue.h b/include/linux/workqueue.h
--- a/include/linux/workqueue.h	2004-08-23 01:14:58 -07:00
+++ b/include/linux/workqueue.h	2005-02-15 13:56:55 -08:00
@@ -70,6 +70,7 @@
 extern int keventd_up(void);x 
 extern void init_workqueues(void);x+void cancel_rearming_delayed_work(struct work_struct *work);x x /*
  * Kill off a pending schedule_delayed_work().  Note that the work callbackxdiff -Nru a/include/linux/writeback.h b/include/linux/writeback.h
--- a/include/linux/writeback.h	2004-11-11 00:25:52 -08:00
+++ b/include/linux/writeback.h	2005-03-07 20:41:21 -08:00
@@ -86,6 +86,7 @@
 int wakeup_bdflush(long nr_pages);x void laptop_io_completion(void);x void laptop_sync_completion(void);x+void throttle_vm_writeout(void);x 
 /* These are exported to sysctl. */x extern int dirty_background_ratio;xdiff -Nru a/include/media/saa7146.h b/include/media/saa7146.h
--- a/include/media/saa7146.h	2004-12-13 02:47:29 -08:00
+++ b/include/media/saa7146.h	2005-03-02 09:54:20 -08:00
@@ -157,7 +157,7 @@
 x /* from saa7146_i2c.c */x int saa7146_i2c_adapter_prepare(struct saa7146_dev *dev, struct i2c_adapter *i2c_adapter, u32 bitrate);x-int saa7146_i2c_transfer(struct saa7146_dev *saa, const struct i2c_msg msgs[], int num,  int retries);x+int saa7146_i2c_transfer(struct saa7146_dev *saa, const struct i2c_msg *msgs, int num,  int retries);x x /* from saa7146_core.c */x extern struct list_head saa7146_devices;xdiff -Nru a/include/media/tuner.h b/include/media/tuner.h
--- a/include/media/tuner.h	2005-01-25 13:50:26 -08:00
+++ b/include/media/tuner.h	2005-03-07 20:41:40 -08:00
@@ -29,55 +29,70 @@
 #define TUNER_PHILIPS_PAL_I 1
 #define TUNER_PHILIPS_NTSC  2
 #define TUNER_PHILIPS_SECAM 3		/* you must actively select B/G, L, L` */x+
 #define TUNER_ABSENT        4
 #define TUNER_PHILIPS_PAL   5
 #define TUNER_TEMIC_NTSC    6        /* 4032 FY5 (3X 7004, 9498, 9789)  */x #define TUNER_TEMIC_PAL_I   7        /* 4062 FY5 (3X 8501, 9957)        */x+
 #define TUNER_TEMIC_4036FY5_NTSC 8   /* 4036 FY5 (3X 1223, 1981, 7686)  */x #define TUNER_ALPS_TSBH1_NTSC 	 9x #define TUNER_ALPS_TSBE1_PAL 	10x #define TUNER_ALPS_TSBB5_PAL_I 	11x+
 #define TUNER_ALPS_TSBE5_PAL 	12
 #define TUNER_ALPS_TSBC5_PAL 	13
 #define TUNER_TEMIC_4006FH5_PAL	14   /* 4006 FH5 (3X 9500, 9501, 7291)     */x #define TUNER_ALPS_TSHC6_NTSC 	15x+
 #define TUNER_TEMIC_PAL_DK	16   /* 4016 FY5 (3X 1392, 1393)     */x #define TUNER_PHILIPS_NTSC_M	17
 #define TUNER_TEMIC_4066FY5_PAL_I       18  /* 4066 FY5 (3X 7032, 7035) */x #define TUNER_TEMIC_4006FN5_MULTI_PAL   19  /* B/G, I and D/K autodetected (3X 7595, 7606, 7657)*/x+
 #define TUNER_TEMIC_4009FR5_PAL         20  /* incl. FM radio (3X 7607, 7488, 7711)*/x #define TUNER_TEMIC_4039FR5_NTSC        21  /* incl. FM radio (3X 7246, 7578, 7732)*/x #define TUNER_TEMIC_4046FM5             22  /* you must actively select B/G, D/K, I, L, L` !  (3X 7804, 7806, 8103, 8104)*/x #define TUNER_PHILIPS_PAL_DK		23
+x #define TUNER_PHILIPS_FQ1216ME		24  /* you must actively select B/G/D/K, I, L, L` */x #define TUNER_LG_PAL_I_FM	25x #define TUNER_LG_PAL_I		26x #define TUNER_LG_NTSC_FM	27
+x #define TUNER_LG_PAL_FM		28x #define TUNER_LG_PAL		29
 #define TUNER_TEMIC_4009FN5_MULTI_PAL_FM	30  /* B/G, I and D/K autodetected (3X 8155, 8160, 8163)*/x #define TUNER_SHARP_2U5JF5540_NTSC  31x+
 #define TUNER_Samsung_PAL_TCPM9091PD27 32
 #define TUNER_MT2032 33
 #define TUNER_TEMIC_4106FH5 	34	/* 4106 FH5 (3X 7808, 7865)*/x #define TUNER_TEMIC_4012FY5	35	/* 4012 FY5 (3X 0971, 1099)*/x+
 #define TUNER_TEMIC_4136FY5	36	/* 4136 FY5 (3X 7708, 7746)*/x #define TUNER_LG_PAL_NEW_TAPC   37x #define TUNER_PHILIPS_FM1216ME_MK3  38x #define TUNER_LG_NTSC_NEW_TAPC   39x+
 #define TUNER_HITACHI_NTSC       40x #define TUNER_PHILIPS_PAL_MK     41
 #define TUNER_PHILIPS_ATSC       42x #define TUNER_PHILIPS_FM1236_MK3 43
+x #define TUNER_PHILIPS_4IN1       44	/* ATI TV Wonder Pro - Conexant */x /* Microtune mergeged with Temic 12/31/1999 partially financed by Alps - these may be similar to Temic */x #define TUNER_MICROTUNE_4049FM5  45x #define TUNER_LG_NTSC_TAPE       47
+x #define TUNER_TNF_8831BGFF       48x #define TUNER_MICROTUNE_4042FI5  49	/* FusionHDTV 3 Gold - 4042 FI5 (3X 8147) */x #define TUNER_TCL_2002N          50x #define TUNER_PHILIPS_FM1256_IH3   51x+
 #define TUNER_THOMSON_DTT7610    52
+#define TUNER_PHILIPS_FQ1286     53
+#define TUNER_PHILIPS_TDA8290    54x x #define NOTUNER 0x #define PAL     1	/* PAL_BG */x@@ -102,10 +117,6 @@
 
 #define TUNER_SET_TYPE               _IOW('t',1,int)    /* set tuner type */x #define TUNER_SET_TVFREQ             _IOW('t',2,int)    /* set tv freq */x-#if 0 /* obsolete */x-# define TUNER_SET_RADIOFREQ         _IOW('t',3,int)    /* set radio freq */x-# define TUNER_SET_MODE              _IOW('t',4,int)    /* set tuner mode */x-#endifx x #define  TDA9887_SET_CONFIG          _IOW('t',5,int)x /* tv card specific */x@@ -123,4 +134,62 @@
 # define TDA9887_DEEMPHASIS_75       (3<<16)
 # define TDA9887_AUTOMUTE            (1<<18)x x+#ifdef __KERNEL__x+
+#define I2C_ADDR_TDA8290        0x4b
+#define I2C_ADDR_TDA8275        0x61x+
+struct tuner {x+	/* device */x+	struct i2c_client i2c;x+x+	/* state + config */x+	unsigned int initialized;x+	unsigned int type;            /* chip type */x+	unsigned int freq;            /* keep track of the current settings */
+	v4l2_std_id  std;x+	int          using_v4l2;x+x+	enum v4l2_tuner_type mode;
+	unsigned int input;x+x+	/* used by MT2032 */x+	unsigned int xogc;
+	unsigned int radio_if2;x+x+	/* used by tda8290 */x+	unsigned char i2c_easy_mode[2];x+	unsigned char i2c_set_freq[8];x+x+	/* function ptrs */
+	void (*tv_freq)(struct i2c_client *c, unsigned int freq);
+	void (*radio_freq)(struct i2c_client *c, unsigned int freq);
+	int  (*has_signal)(struct i2c_client *c);
+	int  (*is_stereo)(struct i2c_client *c);
+};x+x+extern unsigned int tuner_debug;x+extern unsigned const int tuner_count;x+x+extern int microtune_init(struct i2c_client *c);
+extern int tda8290_init(struct i2c_client *c);
+extern int default_tuner_init(struct i2c_client *c);
+
+#define tuner_warn(fmt, arg...) \
+	dev_printk(KERN_WARNING , &t->i2c.dev , fmt , ## arg)
+#define tuner_info(fmt, arg...) \
+	dev_printk(KERN_INFO , &t->i2c.dev , fmt , ## arg)
+#define tuner_dbg(fmt, arg...) \
+	if (tuner_debug) dev_printk(KERN_DEBUG , &t->i2c.dev , fmt , ## arg)
+x+#endif /* __KERNEL__ */x+
 #endifx+
+/*
+ * Overrides for Emacs so that we follow Linus's tabbing style.
+ * ---------------------------------------------------------------------------
+ * Local variables:
+ * c-basic-offset: 8
+ * End:
+ */xdiff -Nru a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
--- a/include/net/bluetooth/hci_core.h	2005-02-04 16:53:33 -08:00
+++ b/include/net/bluetooth/hci_core.h	2005-03-05 05:05:56 -08:00
@@ -217,7 +217,8 @@
 /* ----- HCI Connections ----- */x enum {x 	HCI_CONN_AUTH_PEND,
-	HCI_CONN_ENCRYPT_PEND
+	HCI_CONN_ENCRYPT_PEND,
+	HCI_CONN_RSWITCH_PENDx };x x static inline void hci_conn_hash_init(struct hci_dev *hdev)
@@ -290,6 +291,7 @@
 int hci_conn_auth(struct hci_conn *conn);x int hci_conn_encrypt(struct hci_conn *conn);x int hci_conn_change_link_key(struct hci_conn *conn);x+int hci_conn_switch_role(struct hci_conn *conn, uint8_t role);x x static inline void hci_conn_set_timer(struct hci_conn *conn, unsigned long timeout)x {
@@ -515,6 +517,8 @@
 
 	void (*auth_cfm)	(struct hci_conn *conn, __u8 status);x 	void (*encrypt_cfm)	(struct hci_conn *conn, __u8 status, __u8 encrypt);
+	void (*key_change_cfm)	(struct hci_conn *conn, __u8 status);x+	void (*role_switch_cfm)	(struct hci_conn *conn, __u8 status, __u8 role);x };x x static inline void hci_auth_cfm(struct hci_conn *conn, __u8 status)
@@ -543,6 +547,32 @@
 		struct hci_cb *cb = list_entry(p, struct hci_cb, list);x 		if (cb->encrypt_cfm)x 			cb->encrypt_cfm(conn, status, encrypt);
+	}
+	read_unlock_bh(&hci_cb_list_lock);
+}x+
+static inline void hci_key_change_cfm(struct hci_conn *conn, __u8 status)
+{x+	struct list_head *p;x+x+	read_lock_bh(&hci_cb_list_lock);
+	list_for_each(p, &hci_cb_list) {x+		struct hci_cb *cb = list_entry(p, struct hci_cb, list);x+		if (cb->key_change_cfm)x+			cb->key_change_cfm(conn, status);
+	}
+	read_unlock_bh(&hci_cb_list_lock);
+}x+
+static inline void hci_role_switch_cfm(struct hci_conn *conn, __u8 status, __u8 role)
+{x+	struct list_head *p;x+x+	read_lock_bh(&hci_cb_list_lock);
+	list_for_each(p, &hci_cb_list) {x+		struct hci_cb *cb = list_entry(p, struct hci_cb, list);x+		if (cb->role_switch_cfm)x+			cb->role_switch_cfm(conn, status, role);x 	}
 	read_unlock_bh(&hci_cb_list_lock);
 }xdiff -Nru a/include/net/dn.h b/include/net/dn.h
--- a/include/net/dn.h	2005-01-13 21:03:01 -08:00
+++ b/include/net/dn.h	2005-01-20 14:35:54 -08:00
@@ -2,6 +2,7 @@
 #define _NET_DN_Hx x #include <linux/dn.h>x+#include <net/sock.h>x #include <asm/byteorder.h>x x typedef unsigned short dn_address;x@@ -133,7 +134,10 @@
 x };x x-#define DN_SK(__sk) ((struct dn_scp *)(__sk)->sk_protinfo)
+static inline struct dn_scp *DN_SK(struct sock *sk)
+{x+	return (struct dn_scp *)(sk + 1);
+}x x /*
  * src,dst : Source and Destination DECnet addressesxdiff -Nru a/include/net/dst.h b/include/net/dst.h
--- a/include/net/dst.h	2005-02-15 14:23:10 -08:00
+++ b/include/net/dst.h	2005-03-07 09:30:52 -08:00
@@ -124,6 +124,16 @@
 	return mtu;
 }x 
+static inline u32 dst_mtu(const struct dst_entry *dst)
+{x+	u32 mtu = dst_metric(dst, RTAX_MTU);x+	/*x+	 * Alexey put it here, so ask him about it :)x+	 */
+	barrier();x+	return mtu;
+}x+
 static inline int
 dst_metric_locked(struct dst_entry *dst, int metric)x {
@@ -247,6 +257,15 @@
 		if (unlikely(err != NET_XMIT_BYPASS))x 			return err;x 	}
+}x+
+static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
+{x+	dst_hold(dst);
+	if (dst->obsolete)x+		dst = dst->ops->check(dst, cookie);x+	dst_release(dst);
+	return dst;x }x 
 extern void		dst_init(void);xdiff -Nru a/include/net/irda/af_irda.h b/include/net/irda/af_irda.h
--- a/include/net/irda/af_irda.h	2003-06-04 17:57:07 -07:00
+++ b/include/net/irda/af_irda.h	2005-01-20 15:21:35 -08:00
@@ -33,9 +33,12 @@
 #include <net/irda/irlmp.h>		/* struct lsap_cb */
 #include <net/irda/irttp.h>		/* struct tsap_cb */
 #include <net/irda/discovery.h>		/* struct discovery_t */x+#include <net/sock.h>x 
 /* IrDA Socket */
 struct irda_sock {x+	/* struct sock has to be the first member of irda_sock */x+	struct sock sk;x 	__u32 saddr;          /* my local address */x 	__u32 daddr;          /* peer address */x 
@@ -69,7 +72,6 @@
 
 	int errno;            /* status of the IAS query */x x-	struct sock *sk;x 	wait_queue_head_t query_wait;	/* Wait for the answer to a query */x 	struct timer_list watchdog;	/* Timeout for discovery */x 
@@ -77,6 +79,9 @@
 	LOCAL_FLOW rx_flow;x };x x-#define irda_sk(__sk) ((struct irda_sock *)(__sk)->sk_protinfo)
+static inline struct irda_sock *irda_sk(struct sock *sk)
+{x+	return (struct irda_sock *)sk;x+}x x #endif /* AF_IRDA_H */xdiff -Nru a/include/net/llc_conn.h b/include/net/llc_conn.h
--- a/include/net/llc_conn.h	2004-12-27 20:46:21 -08:00
+++ b/include/net/llc_conn.h	2005-01-20 15:17:39 -08:00
@@ -13,6 +13,7 @@
  */
 #include <linux/timer.h>x #include <net/llc_if.h>x+#include <net/sock.h>x #include <linux/llc.h>x 
 #define LLC_EVENT                1
@@ -28,8 +29,9 @@
 	u16		  expire;	/* timer expire time */x };x x-struct llc_opt {
-	struct sock	    *sk;		/* sock that has this llc_opt */x+struct llc_sock {x+	/* struct sock must be the first member of llc_sock */x+	struct sock	    sk;x 	struct sockaddr_llc addr;		/* address sock is bound to */x 	u8		    state;		/* state of connection */x 	struct llc_sap	    *sap;		/* pointer to parent SAP */x@@ -75,7 +77,10 @@
 					      Used for resending FRMR */x };x x-#define llc_sk(__sk) ((struct llc_opt *)(__sk)->sk_protinfo)
+static inline struct llc_sock *llc_sk(const struct sock *sk)
+{x+	return (struct llc_sock *)sk;x+}x x static __inline__ void llc_set_backlog_type(struct sk_buff *skb, char type)x {
diff -Nru a/include/net/pkt_cls.h b/include/net/pkt_cls.h
--- a/include/net/pkt_cls.h	2005-01-10 13:42:22 -08:00
+++ b/include/net/pkt_cls.h	2005-02-15 12:17:28 -08:00
@@ -148,6 +148,198 @@
 extern int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts,
 	                       struct tcf_ext_map *map);x x+/**
+ * struct tcf_pkt_info - packet information
+ */x+struct tcf_pkt_info
+{x+	unsigned char *		ptr;
+	int			nexthdr;
+};x+x+#ifdef CONFIG_NET_EMATCHx+
+struct tcf_ematch_ops;x+
+/**
+ * struct tcf_ematch - extended match (ematch)
+ * 
+ * @matchid: identifier to allow userspace to reidentify a match
+ * @flags: flags specifying attributes and the relation to other matches
+ * @ops: the operations lookup table of the corresponding ematch module
+ * @datalen: length of the ematch specific configuration data
+ * @data: ematch specific data
+ */
+struct tcf_ematch
+{x+	struct tcf_ematch_ops * ops;x+	unsigned long		data;
+	unsigned int		datalen;
+	u16			matchid;
+	u16			flags;x+};x+x+static inline int tcf_em_is_container(struct tcf_ematch *em)
+{x+	return !em->ops;
+}x+
+static inline int tcf_em_is_simple(struct tcf_ematch *em)
+{x+	return em->flags & TCF_EM_SIMPLE;
+}x+
+static inline int tcf_em_is_inverted(struct tcf_ematch *em)
+{x+	return em->flags & TCF_EM_INVERT;
+}x+
+static inline int tcf_em_last_match(struct tcf_ematch *em)
+{x+	return (em->flags & TCF_EM_REL_MASK) == TCF_EM_REL_END;
+}x+
+static inline int tcf_em_early_end(struct tcf_ematch *em, int result)
+{x+	if (tcf_em_last_match(em))x+		return 1;x+x+	if (result == 0 && em->flags & TCF_EM_REL_AND)x+		return 1;x+x+	if (result != 0 && em->flags & TCF_EM_REL_OR)x+		return 1;x+x+	return 0;
+}x+	
+/**
+ * struct tcf_ematch_tree - ematch tree handle
+ *
+ * @hdr: ematch tree header supplied by userspace
+ * @matches: array of ematches
+ */
+struct tcf_ematch_tree
+{x+	struct tcf_ematch_tree_hdr hdr;
+	struct tcf_ematch *	matches;x+	
+};x+
+/**
+ * struct tcf_ematch_ops - ematch module operations
+ * 
+ * @kind: identifier (kind) of this ematch module
+ * @datalen: length of expected configuration data (optional)
+ * @change: called during validation (optional)
+ * @match: called during ematch tree evaluation, must return 1/0
+ * @destroy: called during destroyage (optional)
+ * @dump: called during dumping process (optional)
+ * @owner: owner, must be set to THIS_MODULE
+ * @link: link to previous/next ematch module (internal use)
+ */
+struct tcf_ematch_ops
+{x+	int			kind;
+	int			datalen;
+	int			(*change)(struct tcf_proto *, void *,x+					  int, struct tcf_ematch *);
+	int			(*match)(struct sk_buff *, struct tcf_ematch *,x+					 struct tcf_pkt_info *);x+	void			(*destroy)(struct tcf_proto *,x+					   struct tcf_ematch *);
+	int			(*dump)(struct sk_buff *, struct tcf_ematch *);x+	struct module		*owner;x+	struct list_head	link;
+};x+x+extern int tcf_em_register(struct tcf_ematch_ops *);
+extern int tcf_em_unregister(struct tcf_ematch_ops *);
+extern int tcf_em_tree_validate(struct tcf_proto *, struct rtattr *,x+				struct tcf_ematch_tree *);
+extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *);
+extern int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int);x+extern int __tcf_em_tree_match(struct sk_buff *, struct tcf_ematch_tree *,x+			       struct tcf_pkt_info *);x+
+/**
+ * tcf_em_tree_change - replace ematch tree of a running classifier
+ *
+ * @tp: classifier kind handle
+ * @dst: destination ematch tree variable
+ * @src: source ematch tree (temporary tree from tcf_em_tree_validate)
+ *
+ * This functions replaces the ematch tree in @dst with the ematch
+ * tree in @src. The classifier in charge of the ematch tree may be
+ * running.
+ */
+static inline void tcf_em_tree_change(struct tcf_proto *tp,x+				      struct tcf_ematch_tree *dst,x+				      struct tcf_ematch_tree *src)
+{x+	tcf_tree_lock(tp);x+	memcpy(dst, src, sizeof(*dst));x+	tcf_tree_unlock(tp);x+}x+
+/**
+ * tcf_em_tree_match - evaulate an ematch tree
+ *
+ * @skb: socket buffer of the packet in question
+ * @tree: ematch tree to be used for evaluation
+ * @info: packet information examined by classifier
+ *
+ * This function matches @skb against the ematch tree in @tree by going
+ * through all ematches respecting their logic relations returning
+ * as soon as the result is obvious.
+ *
+ * Returns 1 if the ematch tree as-one matches, no ematches are configured
+ * or ematch is not enabled in the kernel, otherwise 0 is returned.
+ */
+static inline int tcf_em_tree_match(struct sk_buff *skb,x+				    struct tcf_ematch_tree *tree,x+				    struct tcf_pkt_info *info)
+{x+	if (tree->hdr.nmatches)x+		return __tcf_em_tree_match(skb, tree, info);x+	else
+		return 1;x+}
+x+#else /* CONFIG_NET_EMATCH */x+
+struct tcf_ematch_tree
+{x+};
+
+#define tcf_em_tree_validate(tp, tb, t) ((void)(t), 0)x+#define tcf_em_tree_destroy(tp, t) do { (void)(t); } while(0)x+#define tcf_em_tree_dump(skb, t, tlv) (0)x+#define tcf_em_tree_change(tp, dst, src) do { } while(0)x+#define tcf_em_tree_match(skb, t, info) ((void)(info), 1)
+x+#endif /* CONFIG_NET_EMATCH */x+
+static inline unsigned char * tcf_get_base_ptr(struct sk_buff *skb, int layer)x+{x+	switch (layer) {x+		case TCF_LAYER_LINK:x+			return skb->data;
+		case TCF_LAYER_NETWORK:x+			return skb->nh.raw;
+		case TCF_LAYER_TRANSPORT:x+			return skb->h.raw;
+	}x+x+	return NULL;
+}x+
+static inline int tcf_valid_offset(struct sk_buff *skb, unsigned char *ptr,x+				   int len)
+{x+	return unlikely((ptr + len) < skb->tail && ptr > skb->head);x+}x+
 #ifdef CONFIG_NET_CLS_INDx static inline int
 tcf_change_indev(struct tcf_proto *tp, char *indev, struct rtattr *indev_tlv)
diff -Nru a/include/net/slhc_vj.h b/include/net/slhc_vj.h
--- a/include/net/slhc_vj.h	2002-02-05 09:39:48 -08:00
+++ b/include/net/slhc_vj.h	2005-02-16 09:43:49 -08:00
@@ -185,7 +185,4 @@
 			  int isize));x int slhc_toss __ARGS((struct slcompress *comp));x x-void slhc_i_status __ARGS((struct slcompress *comp));x-void slhc_o_status __ARGS((struct slcompress *comp));x-x #endif	/* _SLHC_H */xdiff -Nru a/include/net/x25.h b/include/net/x25.h
--- a/include/net/x25.h	2004-12-27 18:32:03 -08:00
+++ b/include/net/x25.h	2005-01-20 14:58:55 -08:00
@@ -10,6 +10,7 @@
 #ifndef _X25_Hx #define _X25_H x #include <linux/x25.h>x+#include <net/sock.h>x 
 #define	X25_ADDR_LEN			16x x@@ -129,7 +130,8 @@
 	atomic_t		refcnt;x };x x-struct x25_opt {
+struct x25_sock {x+	struct sock		sk;x 	struct x25_address	source_addr, dest_addr;x 	struct x25_neigh	*neighbour;x 	unsigned int		lci;x@@ -141,7 +143,6 @@
 	struct sk_buff_head	fragment_queue;
 	struct sk_buff_head	interrupt_in_queue;
 	struct sk_buff_head	interrupt_out_queue;
-	struct sock		*sk;		/* Backlink to socket */
 	struct timer_list	timer;x 	struct x25_causediag	causediag;x 	struct x25_facilities	facilities;x@@ -149,7 +150,10 @@
 	unsigned long 		vc_facil_mask;	/* inc_call facilities mask */x };x x-#define x25_sk(__sk) ((struct x25_opt *)(__sk)->sk_protinfo)
+static inline struct x25_sock *x25_sk(const struct sock *sk)
+{x+	return (struct x25_sock *)sk;x+}x x /* af_x25.c */x extern int  sysctl_x25_restart_request_timeout;xdiff -Nru a/include/net/xfrm.h b/include/net/xfrm.h
--- a/include/net/xfrm.h	2005-01-25 21:53:19 -08:00
+++ b/include/net/xfrm.h	2005-03-06 21:31:30 -08:00
@@ -212,7 +212,7 @@
 	void			(*destructor)(struct xfrm_state *);x 	int			(*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb);x 	int			(*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb);x-	int			(*output)(struct sk_buff *pskb);x+	int			(*output)(struct xfrm_state *, struct sk_buff *pskb);x 	/* Estimate maximal size of result of transformation of a dgram */x 	u32			(*get_max_size)(struct xfrm_state *, int size);x };x@@ -511,6 +511,9 @@
 		struct rtable		rt;x 		struct rt6_info		rt6;x 	} u;x+	struct dst_entry *route;x+	u32 route_mtu_cached;x+	u32 child_mtu_cached;x };x x /* Decapsulation state, used by the input to store data during
@@ -807,6 +810,7 @@
 extern int xfrm_replay_check(struct xfrm_state *x, u32 seq);
 extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq);
 extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb);x+extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
 extern int xfrm4_rcv(struct sk_buff *skb);x extern int xfrm4_output(struct sk_buff *skb);x extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);x@@ -857,6 +861,8 @@
 extern void xfrm_policy_flush(void);x extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);x extern int xfrm_flush_bundles(void);x+extern int xfrm_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl, int family);x+extern void xfrm_init_pmtu(struct dst_entry *dst);x 
 extern wait_queue_head_t km_waitq;x extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport);xdiff -Nru a/include/scsi/scsi_driver.h b/include/scsi/scsi_driver.h
--- a/include/scsi/scsi_driver.h	2004-08-23 01:14:46 -07:00
+++ b/include/scsi/scsi_driver.h	2005-03-07 20:41:36 -08:00
@@ -14,6 +14,8 @@
 	int (*init_command)(struct scsi_cmnd *);x 	void (*rescan)(struct device *);x 	int (*issue_flush)(struct device *, sector_t *);
+	int (*prepare_flush)(struct request_queue *, struct request *);x+	void (*end_flush)(struct request_queue *, struct request *);x };x #define to_scsi_driver(drv) \
 	container_of((drv), struct scsi_driver, gendrv)
diff -Nru a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
--- a/include/scsi/scsi_host.h	2005-01-19 08:01:21 -08:00
+++ b/include/scsi/scsi_host.h	2005-03-07 20:41:36 -08:00
@@ -363,6 +363,12 @@
 	unsigned skip_settle_delay:1;x 
 	/*x+	 * ordered write supportx+	 */
+	unsigned ordered_flush:1;x+	unsigned ordered_tag:1;x+x+	/*
 	 * Countdown for host blocking with no commands outstanding
 	 */x 	unsigned int max_host_blocked;x@@ -500,6 +506,12 @@
 	 * the spec ;)
 	 */x 	unsigned reverse_ordering:1;x+x+	/*
+	 * ordered write supportx+	 */
+	unsigned ordered_flush:1;x+	unsigned ordered_tag:1;x 
 	/*x 	 * Host has rejected a command because it was busy.
diff -Nru a/init/Kconfig b/init/Kconfig
--- a/init/Kconfig	2005-02-04 17:23:04 -08:00
+++ b/init/Kconfig	2005-03-07 20:41:45 -08:00
@@ -276,6 +276,13 @@
 	   reported.  KALLSYMS_EXTRA_PASS is only a temporary workaround while
 	   you wait for kallsyms to be fixed.
 
+config BASE_FULL
+	default y
+	bool "Enable full-sized data structures for core" if EMBEDDED
+	helpx+	  Disabling this option reduces the size of miscellaneous corex+	  kernel data structures.x+
 config FUTEX
 	bool "Enable futex support" if EMBEDDED
 	default y
@@ -357,6 +364,11 @@
 config TINY_SHMEM
 	default !SHMEM
 	boolx+x+config BASE_SMALL
+	int
+	default 0 if BASE_FULL
+	default 1 if !BASE_FULL
 
 menu "Loadable module support"x xdiff -Nru a/init/main.c b/init/main.c
--- a/init/main.c	2005-01-30 22:19:52 -08:00
+++ b/init/main.c	2005-03-07 20:41:42 -08:00
@@ -209,6 +209,14 @@
 __setup("debug", debug_kernel);x __setup("quiet", quiet_kernel);x 
+static int __init loglevel(char *str)
+{x+	get_option(&str, &console_loglevel);
+	return 1;x+}
+x+__setup("loglevel=", loglevel);
+x /*
  * Unknown boot options get handed to init, unless they look like
  * failed parameters
@@ -625,6 +633,10 @@
 static int init(void * unused)x {
 	lock_kernel();x+	/*x+	 * init can run on any cpu.x+	 */
+	set_cpus_allowed(current, CPU_MASK_ALL);x 	/*x 	 * Tell the world that we're going to be the grimx 	 * reaper of innocent orphaned children.
diff -Nru a/kernel/Makefile b/kernel/Makefile
--- a/kernel/Makefile	2004-11-02 06:40:33 -08:00
+++ b/kernel/Makefile	2005-03-07 20:41:52 -08:00
@@ -7,7 +7,7 @@
 	    sysctl.o capability.o ptrace.o timer.o user.o \
 	    signal.o sys.o kmod.o workqueue.o pid.o \
 	    rcupdate.o intermodule.o extable.o params.o posix-timers.o \
-	    kthread.o wait.o kfifo.o sys_ni.ox+	    kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o
 
 obj-$(CONFIG_FUTEX) += futex.o
 obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o
@@ -26,6 +26,7 @@
 obj-$(CONFIG_KPROBES) += kprobes.o
 obj-$(CONFIG_SYSFS) += ksysfs.o
 obj-$(CONFIG_GENERIC_HARDIRQS) += irq/
+obj-$(CONFIG_SECCOMP) += seccomp.o
 
 ifneq ($(CONFIG_IA64),y)
 # According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is
diff -Nru a/kernel/acct.c b/kernel/acct.c
--- a/kernel/acct.c	2005-01-11 16:42:34 -08:00
+++ b/kernel/acct.c	2005-03-04 22:41:14 -08:00
@@ -534,10 +534,8 @@
  * acct_update_integrals
  *    -  update mm integral fields in task_struct
  */x-void acct_update_integrals(void)x+void acct_update_integrals(struct task_struct *tsk)
 {
-	struct task_struct *tsk = current;x-x 	if (likely(tsk->mm)) {
 		long delta = tsk->stime - tsk->acct_stimexpd;x xdiff -Nru a/kernel/compat.c b/kernel/compat.c
--- a/kernel/compat.c	2005-01-14 11:56:08 -08:00
+++ b/kernel/compat.c	2005-03-06 15:58:58 -08:00
@@ -23,6 +23,7 @@
 #include <linux/security.h>x 
 #include <asm/uaccess.h>x+#include <asm/bug.h>x 
 int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts)x {
@@ -411,6 +412,36 @@
 		}
 		return ret;x 	}
+}x+
+asmlinkage long compat_sys_waitid(int which, compat_pid_t pid,x+		struct compat_siginfo __user *uinfo, int options,x+		struct compat_rusage __user *uru)x+{x+	siginfo_t info;x+	struct rusage ru;x+	long ret;x+	mm_segment_t old_fs = get_fs();x+
+	memset(&info, 0, sizeof(info));x+
+	set_fs(KERNEL_DS);
+	ret = sys_waitid(which, pid, (siginfo_t __user *)&info, options,x+			 uru ? (struct rusage __user *)&ru : NULL);x+	set_fs(old_fs);x+x+	if ((ret < 0) || (info.si_signo == 0))x+		return ret;x+x+	if (uru) {x+		ret = put_compat_rusage(&ru, uru);x+		if (ret)x+			return ret;x+	}x+x+	BUG_ON(info.si_code & __SI_MASK);
+	info.si_code |= __SI_CHLD;
+	return copy_siginfo_to_user32(uinfo, &info);x }x x static int compat_get_user_cpu_mask(compat_ulong_t __user *user_mask_ptr,xdiff -Nru a/kernel/exit.c b/kernel/exit.c
--- a/kernel/exit.c	2005-01-20 08:02:19 -08:00
+++ b/kernel/exit.c	2005-03-07 20:41:53 -08:00
@@ -753,13 +753,6 @@
 		state = EXIT_DEAD;x 	tsk->exit_state = state;x x-	/*x-	 * Clear these here so that update_process_times() won't try to deliverx-	 * itimer, profile or rlimit signals to this task while it is in late exit.x-	 */x-	tsk->it_virt_value = cputime_zero;x-	tsk->it_prof_value = cputime_zero;x-x 	write_unlock_irq(&tasklist_lock);
 
 	list_for_each_safe(_p, _n, &ptrace_dead) {
@@ -799,18 +792,27 @@
 	}x x 	tsk->flags |= PF_EXITING;x-	del_timer_sync(&tsk->real_timer);x+x+	/*
+	 * Make sure we don't try to process any timer firings
+	 * while we are already exiting.
+	 */
+ 	tsk->it_virt_expires = cputime_zero;x+ 	tsk->it_prof_expires = cputime_zero;x+	tsk->it_sched_expires = 0;
 
 	if (unlikely(in_atomic()))x 		printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",
 				current->comm, current->pid,x 				preempt_count());x x-	acct_update_integrals();x-	update_mem_hiwater();x+	acct_update_integrals(tsk);x+	update_mem_hiwater(tsk);x 	group_dead = atomic_dec_and_test(&tsk->signal->live);x-	if (group_dead)x+	if (group_dead) {x+ 		del_timer_sync(&tsk->signal->real_timer);x 		acct_process(code);
+	}
 	exit_mm(tsk);x 
 	exit_sem(tsk);xdiff -Nru a/kernel/fork.c b/kernel/fork.c
--- a/kernel/fork.c	2005-01-20 20:59:17 -08:00
+++ b/kernel/fork.c	2005-03-07 20:41:54 -08:00
@@ -129,6 +129,8 @@
 
 	init_task.signal->rlim[RLIMIT_NPROC].rlim_cur = max_threads/2;
 	init_task.signal->rlim[RLIMIT_NPROC].rlim_max = max_threads/2;
+	init_task.signal->rlim[RLIMIT_SIGPENDING] =x+		init_task.signal->rlim[RLIMIT_NPROC];x }x x static struct task_struct *dup_task_struct(struct task_struct *orig)
@@ -740,6 +742,16 @@
 	init_sigpending(&sig->shared_pending);x 	INIT_LIST_HEAD(&sig->posix_timers);x x+	sig->it_real_value = sig->it_real_incr = 0;
+	sig->real_timer.function = it_real_fn;
+	sig->real_timer.data = (unsigned long) tsk;
+	init_timer(&sig->real_timer);x+
+	sig->it_virt_expires = cputime_zero;x+	sig->it_virt_incr = cputime_zero;x+	sig->it_prof_expires = cputime_zero;x+	sig->it_prof_incr = cputime_zero;x+x 	sig->tty = current->signal->tty;x 	sig->pgrp = process_group(current);x 	sig->session = current->signal->session;
@@ -749,11 +761,24 @@
 	sig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero;x 	sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0;x 	sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0;
+	sig->sched_time = 0;
+	INIT_LIST_HEAD(&sig->cpu_timers[0]);
+	INIT_LIST_HEAD(&sig->cpu_timers[1]);
+	INIT_LIST_HEAD(&sig->cpu_timers[2]);x 
 	task_lock(current->group_leader);x 	memcpy(sig->rlim, current->signal->rlim, sizeof sig->rlim);x 	task_unlock(current->group_leader);x x+	if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {x+		/*
+		 * New sole thread in the process gets an expiry time
+		 * of the whole CPU time limit.
+		 */
+		tsk->it_prof_expires =x+			secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur);
+	}
+
 	return 0;x }x x@@ -866,23 +891,22 @@
 	clear_tsk_thread_flag(p, TIF_SIGPENDING);
 	init_sigpending(&p->pending);x x-	p->it_real_value = 0;x-	p->it_real_incr = 0;
-	p->it_virt_value = cputime_zero;x-	p->it_virt_incr = cputime_zero;x-	p->it_prof_value = cputime_zero;x-	p->it_prof_incr = cputime_zero;x-	init_timer(&p->real_timer);x-	p->real_timer.data = (unsigned long) p;x-x 	p->utime = cputime_zero;x 	p->stime = cputime_zero;x+ 	p->sched_time = 0;
 	p->rchar = 0;		/* I/O counter: bytes read */
 	p->wchar = 0;		/* I/O counter: bytes written */
 	p->syscr = 0;		/* I/O counter: read syscalls */
 	p->syscw = 0;		/* I/O counter: write syscalls */
 	acct_clear_integrals(p);x x+ 	p->it_virt_expires = cputime_zero;x+	p->it_prof_expires = cputime_zero;x+ 	p->it_sched_expires = 0;
+ 	INIT_LIST_HEAD(&p->cpu_timers[0]);
+ 	INIT_LIST_HEAD(&p->cpu_timers[1]);
+ 	INIT_LIST_HEAD(&p->cpu_timers[2]);x+
 	p->lock_depth = -1;		/* -1 = no lock */x 	do_posix_clock_monotonic_gettime(&p->start_time);x 	p->security = NULL;
@@ -1013,6 +1037,21 @@
 			 */x 			current->signal->group_stop_count++;x 			set_tsk_thread_flag(p, TIF_SIGPENDING);
+		}x+x+		if (!cputime_eq(current->signal->it_virt_expires,x+				cputime_zero) ||
+		    !cputime_eq(current->signal->it_prof_expires,x+				cputime_zero) ||
+		    current->signal->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY ||
+		    !list_empty(&current->signal->cpu_timers[0]) ||
+		    !list_empty(&current->signal->cpu_timers[1]) ||
+		    !list_empty(&current->signal->cpu_timers[2])) {x+			/*
+			 * Have child wake up on its first tick to check
+			 * for process CPU timers.
+			 */
+			p->it_prof_expires = jiffies_to_cputime(1);x 		}x x 		spin_unlock(&current->sighand->siglock);
diff -Nru a/kernel/futex.c b/kernel/futex.c
--- a/kernel/futex.c	2005-02-23 11:10:16 -08:00
+++ b/kernel/futex.c	2005-03-07 20:41:45 -08:00
@@ -40,7 +40,7 @@
 #include <linux/pagemap.h>x #include <linux/syscalls.h>x 
-#define FUTEX_HASHBITS 8
+#define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8)x x /*
  * Futexes are matched on equal values of this key.
diff -Nru a/kernel/itimer.c b/kernel/itimer.c
--- a/kernel/itimer.c	2005-01-11 16:42:35 -08:00
+++ b/kernel/itimer.c	2005-03-07 20:41:53 -08:00
@@ -11,36 +11,86 @@
 #include <linux/interrupt.h>x #include <linux/syscalls.h>x #include <linux/time.h>x+#include <linux/posix-timers.h>x 
 #include <asm/uaccess.h>x 
+static unsigned long it_real_value(struct signal_struct *sig)
+{x+	unsigned long val = 0;
+	if (timer_pending(&sig->real_timer)) {x+		val = sig->real_timer.expires - jiffies;x+
+		/* look out for negative/zero itimer.. */
+		if ((long) val <= 0)x+			val = 1;
+	}
+	return val;x+}x+
 int do_getitimer(int which, struct itimerval *value)
 {
-	register unsigned long val;
+	struct task_struct *tsk = current;x+	unsigned long interval, val;
+	cputime_t cinterval, cval;
 x 	switch (which) {
 	case ITIMER_REAL:
-		val = 0;
-		/* 
-		 * FIXME! This needs to be atomic, in case the kernel timer happens!
-		 */x-		if (timer_pending(&current->real_timer)) {x-			val = current->real_timer.expires - jiffies;x-x-			/* look out for negative/zero itimer.. */
-			if ((long) val <= 0)x-				val = 1;
-		}x+		spin_lock_irq(&tsk->sighand->siglock);
+		interval = tsk->signal->it_real_incr;x+		val = it_real_value(tsk->signal);
+		spin_unlock_irq(&tsk->sighand->siglock);
 		jiffies_to_timeval(val, &value->it_value);
-		jiffies_to_timeval(current->it_real_incr, &value->it_interval);
+		jiffies_to_timeval(interval, &value->it_interval);
 		break;x 	case ITIMER_VIRTUAL:
-		cputime_to_timeval(current->it_virt_value, &value->it_value);
-		cputime_to_timeval(current->it_virt_incr, &value->it_interval);
+		read_lock(&tasklist_lock);
+		spin_lock_irq(&tsk->sighand->siglock);
+		cval = tsk->signal->it_virt_expires;
+		cinterval = tsk->signal->it_virt_incr;x+		if (!cputime_eq(cval, cputime_zero)) {x+			struct task_struct *t = tsk;x+			cputime_t utime = tsk->signal->utime;x+			do {x+				utime = cputime_add(utime, t->utime);
+				t = next_thread(t);x+			} while (t != tsk);x+			if (cputime_le(cval, utime)) { /* about to fire */
+				cval = jiffies_to_cputime(1);x+			} else {
+				cval = cputime_sub(cval, utime);x+			}
+		}x+		spin_unlock_irq(&tsk->sighand->siglock);
+		read_unlock(&tasklist_lock);
+		cputime_to_timeval(cval, &value->it_value);
+		cputime_to_timeval(cinterval, &value->it_interval);
 		break;x 	case ITIMER_PROF:
-		cputime_to_timeval(current->it_prof_value, &value->it_value);
-		cputime_to_timeval(current->it_prof_incr, &value->it_interval);
+		read_lock(&tasklist_lock);
+		spin_lock_irq(&tsk->sighand->siglock);
+		cval = tsk->signal->it_prof_expires;
+		cinterval = tsk->signal->it_prof_incr;x+		if (!cputime_eq(cval, cputime_zero)) {x+			struct task_struct *t = tsk;x+			cputime_t ptime = cputime_add(tsk->signal->utime,x+						      tsk->signal->stime);x+			do {x+				ptime = cputime_add(ptime,x+						    cputime_add(t->utime,x+								t->stime));
+				t = next_thread(t);x+			} while (t != tsk);x+			if (cputime_le(cval, ptime)) { /* about to fire */
+				cval = jiffies_to_cputime(1);x+			} else {
+				cval = cputime_sub(cval, ptime);x+			}
+		}x+		spin_unlock_irq(&tsk->sighand->siglock);
+		read_unlock(&tasklist_lock);
+		cputime_to_timeval(cval, &value->it_value);
+		cputime_to_timeval(cinterval, &value->it_interval);
 		break;x 	default:
 		return(-EINVAL);x@@ -48,7 +98,6 @@
 	return 0;x }x x-/* SMP: Only we modify our itimer values. */
 asmlinkage long sys_getitimer(int which, struct itimerval __user *value)
 {
 	int error = -EFAULT;x@@ -63,70 +112,112 @@
 	return error;
 }x 
+/*
+ * Called with P->sighand->siglock held and P->signal->real_timer inactive.
+ * If interval is nonzero, arm the timer for interval ticks from now.
+ */
+static inline void it_real_arm(struct task_struct *p, unsigned long interval)
+{x+	p->signal->it_real_value = interval; /* XXX unnecessary field?? */
+	if (interval == 0)x+		return;
+	if (interval > (unsigned long) LONG_MAX)
+		interval = LONG_MAX;x+	p->signal->real_timer.expires = jiffies + interval;x+	add_timer(&p->signal->real_timer);x+}x+
 void it_real_fn(unsigned long __data)
 {
 	struct task_struct * p = (struct task_struct *) __data;x-	unsigned long interval;
 x 	send_group_sig_info(SIGALRM, SEND_SIG_PRIV, p);x-	interval = p->it_real_incr;x-	if (interval) {x-		if (interval > (unsigned long) LONG_MAX)
-			interval = LONG_MAX;x-		p->real_timer.expires = jiffies + interval;x-		add_timer(&p->real_timer);x-	}x+x+	/*
+	 * Now restart the timer if necessary.  We don't need any locking
+	 * here because do_setitimer makes sure we have finished running
+	 * before it touches anything.
+	 */
+	it_real_arm(p, p->signal->it_real_incr);x }x x int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue)
 {
-	unsigned long expire;
-	cputime_t cputime;x-	int k;
+	struct task_struct *tsk = current;x+ 	unsigned long val, interval;x+	cputime_t cval, cinterval, nval, ninterval;
 x-	if (ovalue && (k = do_getitimer(which, ovalue)) < 0)x-		return k;x 	switch (which) {
-		case ITIMER_REAL:
-			del_timer_sync(&current->real_timer);x-			expire = timeval_to_jiffies(&value->it_value);
-			current->it_real_value = expire;
-			current->it_real_incr =x-				timeval_to_jiffies(&value->it_interval);
-			if (!expire)x-				break;x-			if (expire > (unsigned long) LONG_MAX)
-				expire = LONG_MAX;x-			current->real_timer.expires = jiffies + expire;
-			add_timer(&current->real_timer);x-			break;x-		case ITIMER_VIRTUAL:
-			cputime = timeval_to_cputime(&value->it_value);
-			if (cputime_gt(cputime, cputime_zero))
-				cputime = cputime_add(cputime,
-						      jiffies_to_cputime(1));
-			current->it_virt_value = cputime;
-			cputime = timeval_to_cputime(&value->it_interval);
-			current->it_virt_incr = cputime;
-			break;x-		case ITIMER_PROF:
-			cputime = timeval_to_cputime(&value->it_value);
-			if (cputime_gt(cputime, cputime_zero))
-				cputime = cputime_add(cputime,
-						      jiffies_to_cputime(1));
-			current->it_prof_value = cputime;
-			cputime = timeval_to_cputime(&value->it_interval);
-			current->it_prof_incr = cputime;
-			break;x-		default:
-			return -EINVAL;x+	case ITIMER_REAL:
+		spin_lock_irq(&tsk->sighand->siglock);
+		interval = tsk->signal->it_real_incr;x+		val = it_real_value(tsk->signal);
+		if (val)
+			del_timer_sync(&tsk->signal->real_timer);x+		tsk->signal->it_real_incr =x+			timeval_to_jiffies(&value->it_interval);
+		it_real_arm(tsk, timeval_to_jiffies(&value->it_value));
+		spin_unlock_irq(&tsk->sighand->siglock);
+		if (ovalue) {
+			jiffies_to_timeval(val, &ovalue->it_value);
+			jiffies_to_timeval(interval,x+					   &ovalue->it_interval);
+		}x+		break;x+	case ITIMER_VIRTUAL:
+		nval = timeval_to_cputime(&value->it_value);
+		ninterval = timeval_to_cputime(&value->it_interval);
+		read_lock(&tasklist_lock);
+		spin_lock_irq(&tsk->sighand->siglock);
+		cval = tsk->signal->it_virt_expires;
+		cinterval = tsk->signal->it_virt_incr;x+		if (!cputime_eq(cval, cputime_zero) ||
+		    !cputime_eq(nval, cputime_zero)) {x+			if (cputime_gt(nval, cputime_zero))x+				nval = cputime_add(nval,x+						   jiffies_to_cputime(1));
+			set_process_cpu_timer(tsk, CPUCLOCK_VIRT,x+					      &nval, &cval);
+		}x+		tsk->signal->it_virt_expires = nval;x+		tsk->signal->it_virt_incr = ninterval;x+		spin_unlock_irq(&tsk->sighand->siglock);
+		read_unlock(&tasklist_lock);
+		if (ovalue) {
+			cputime_to_timeval(cval, &ovalue->it_value);
+			cputime_to_timeval(cinterval, &ovalue->it_interval);
+		}x+		break;x+	case ITIMER_PROF:
+		nval = timeval_to_cputime(&value->it_value);
+		ninterval = timeval_to_cputime(&value->it_interval);
+		read_lock(&tasklist_lock);
+		spin_lock_irq(&tsk->sighand->siglock);
+		cval = tsk->signal->it_prof_expires;
+		cinterval = tsk->signal->it_prof_incr;x+		if (!cputime_eq(cval, cputime_zero) ||
+		    !cputime_eq(nval, cputime_zero)) {x+			if (cputime_gt(nval, cputime_zero))x+				nval = cputime_add(nval,x+						   jiffies_to_cputime(1));
+			set_process_cpu_timer(tsk, CPUCLOCK_PROF,x+					      &nval, &cval);
+		}x+		tsk->signal->it_prof_expires = nval;x+		tsk->signal->it_prof_incr = ninterval;x+		spin_unlock_irq(&tsk->sighand->siglock);
+		read_unlock(&tasklist_lock);
+		if (ovalue) {
+			cputime_to_timeval(cval, &ovalue->it_value);
+			cputime_to_timeval(cinterval, &ovalue->it_interval);
+		}x+		break;x+	default:
+		return -EINVAL;x 	}
 	return 0;x }x x-/* SMP: Again, only we play with our itimers, and signals are SMP safe
- *      now so that is not an issue at all anymore.
- */
 asmlinkage long sys_setitimer(int which,
 			      struct itimerval __user *value,
 			      struct itimerval __user *ovalue)
diff -Nru a/kernel/kallsyms.c b/kernel/kallsyms.c
--- a/kernel/kallsyms.c	2005-01-10 05:42:42 -08:00
+++ b/kernel/kallsyms.c	2005-03-07 20:41:41 -08:00
@@ -145,14 +145,22 @@
 	}
 	return module_kallsyms_lookup_name(name);x }x+EXPORT_SYMBOL_GPL(kallsyms_lookup_name);x x-/* Lookup an address.  modname is set to NULL if it's in the kernel. */
+/*
+ * Lookup an address
+ * - modname is set to NULL if it's in the kernel
+ * - we guarantee that the returned name is valid until we reschedule even if
+ *   it resides in a module
+ * - we also guarantee that modname will be valid until rescheduled
+ */
 const char *kallsyms_lookup(unsigned long addr,
 			    unsigned long *symbolsize,
 			    unsigned long *offset,
 			    char **modname, char *namebuf)
 {
 	unsigned long i, low, high, mid;
+	const char *msym;x 
 	/* This kernel should never had been booted. */x 	BUG_ON(!kallsyms_addresses);x@@ -204,7 +212,12 @@
 		return namebuf;x 	}
 
-	return module_address_lookup(addr, symbolsize, offset, modname);x+	/* see if it's in a module */
+	msym = module_address_lookup(addr, symbolsize, offset, modname);x+	if (msym)x+		return strncpy(namebuf, msym, KSYM_NAME_LEN);x+x+	return NULL;
 }x x /* Replace "%s" in format with address, or returns -errno. */xdiff -Nru a/kernel/module.c b/kernel/module.c
--- a/kernel/module.c	2005-01-11 16:42:57 -08:00
+++ b/kernel/module.c	2005-03-07 20:41:36 -08:00
@@ -472,7 +472,7 @@
 };x x /* Whole machine is stopped with interrupts off when this runs. */
-static inline int __try_stop_module(void *_sref)
+static int __try_stop_module(void *_sref)
 {
 	struct stopref *sref = _sref;x x@@ -1072,14 +1072,22 @@
 	kobject_unregister(&mod->mkobj.kobj);
 }x 
+/*
+ * unlink the module with the whole machine is stopped with interrupts off
+ * - this defends against kallsyms not taking locks
+ */
+static int __unlink_module(void *_mod)
+{x+	struct module *mod = _mod;x+	list_del(&mod->list);
+	return 0;x+}x+
 /* Free a module, remove from lists, etc (must hold module mutex). */
 static void free_module(struct module *mod)
 {
 	/* Delete from various lists */
-	spin_lock_irq(&modlist_lock);
-	list_del(&mod->list);
-	spin_unlock_irq(&modlist_lock);
-x+	stop_machine_run(__unlink_module, mod, NR_CPUS);
 	remove_sect_attrs(mod);x 	mod_kobject_remove(mod);x x@@ -1732,6 +1740,17 @@
 	goto free_hdr;
 }x 
+/*
+ * link the module with the whole machine is stopped with interrupts off
+ * - this defends against kallsyms not taking locks
+ */
+static int __link_module(void *_mod)
+{x+	struct module *mod = _mod;x+	list_add(&mod->list, &modules);
+	return 0;x+}x+
 /* This is where the real work happens */
 asmlinkage long
 sys_init_module(void __user *umod,x@@ -1766,9 +1785,7 @@
 
 	/* Now sew it into the lists.  They won't access us, since
            strong_try_module_get() will fail. */
-	spin_lock_irq(&modlist_lock);
-	list_add(&mod->list, &modules);
-	spin_unlock_irq(&modlist_lock);
+	stop_machine_run(__link_module, mod, NR_CPUS);
 
 	/* Drop lock so they can recurse */x 	up(&module_mutex);
diff -Nru a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/kernel/posix-cpu-timers.c	2005-03-07 20:41:53 -08:00
@@ -0,0 +1,1531 @@
+/*
+ * Implement CPU time clocks for the POSIX clock interface.
+ */
+x+#include <linux/sched.h>x+#include <linux/posix-timers.h>x+#include <asm/uaccess.h>x+#include <linux/errno.h>x+
+static int check_clock(clockid_t which_clock)
+{x+	int error = 0;
+	struct task_struct *p;
+	const pid_t pid = CPUCLOCK_PID(which_clock);x+x+	if (CPUCLOCK_WHICH(which_clock) >= CPUCLOCK_MAX)
+		return -EINVAL;x+x+	if (pid == 0)x+		return 0;
+
+	read_lock(&tasklist_lock);
+	p = find_task_by_pid(pid);x+	if (!p || (CPUCLOCK_PERTHREAD(which_clock) ?
+		   p->tgid != current->tgid : p->tgid != pid)) {
+		error = -EINVAL;x+	}
+	read_unlock(&tasklist_lock);
+x+	return error;
+}x+
+static inline union cpu_time_count
+timespec_to_sample(clockid_t which_clock, const struct timespec *tp)
+{x+	union cpu_time_count ret;x+	ret.sched = 0;		/* high half always zero when .cpu used */
+	if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {x+		ret.sched = tp->tv_sec * NSEC_PER_SEC + tp->tv_nsec;x+	} else {
+		ret.cpu = timespec_to_jiffies(tp);x+	}
+	return ret;x+}x+
+static void sample_to_timespec(clockid_t which_clock,x+			       union cpu_time_count cpu,x+			       struct timespec *tp)
+{x+	if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {x+		tp->tv_sec = div_long_long_rem(cpu.sched,x+					       NSEC_PER_SEC, &tp->tv_nsec);x+	} else {
+		cputime_to_timespec(cpu.cpu, tp);x+	}
+}x+
+static inline int cpu_time_before(clockid_t which_clock,x+				  union cpu_time_count now,x+				  union cpu_time_count then)
+{x+	if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {x+		return now.sched < then.sched;x+	}  else {
+		return cputime_lt(now.cpu, then.cpu);x+	}
+}x+static inline void cpu_time_add(clockid_t which_clock,x+				union cpu_time_count *acc,x+			        union cpu_time_count val)
+{x+	if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {x+		acc->sched += val.sched;x+	}  else {
+		acc->cpu = cputime_add(acc->cpu, val.cpu);x+	}
+}x+static inline union cpu_time_count cpu_time_sub(clockid_t which_clock,x+						union cpu_time_count a,x+						union cpu_time_count b)
+{x+	if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {x+		a.sched -= b.sched;x+	}  else {
+		a.cpu = cputime_sub(a.cpu, b.cpu);x+	}
+	return a;x+}x+
+/*
+ * Update expiry time from increment, and increase overrun count,
+ * given the current clock sample.
+ */
+static inline void bump_cpu_timer(struct k_itimer *timer,x+				  union cpu_time_count now)
+{x+	if (timer->it.cpu.incr.sched == 0)x+		return;
+x+	if (CPUCLOCK_WHICH(timer->it_clock) == CPUCLOCK_SCHED) {x+		long long delta;
+		delta = now.sched - timer->it.cpu.expires.sched;x+		if (delta >= 0) {
+			do_div(delta, timer->it.cpu.incr.sched);x+			delta++;x+			timer->it.cpu.expires.sched +=x+				delta * timer->it.cpu.incr.sched;x+			timer->it_overrun += (int) delta;
+		}x+	} else if (cputime_le(now.cpu, timer->it.cpu.expires.cpu)) {
+		cputime_t delta = cputime_sub(now.cpu,x+					      timer->it.cpu.expires.cpu);x+		if (cputime_ge(delta, cputime_zero)) {x+			long orun = 1 + (delta / timer->it.cpu.incr.cpu);x+			timer->it.cpu.expires.cpu =x+				cputime_add(timer->it.cpu.expires.cpu,x+					    orun * timer->it.cpu.incr.cpu);x+			timer->it_overrun += orun;
+		}x+	}
+}x+
+static inline cputime_t prof_ticks(struct task_struct *p)
+{x+	return cputime_add(p->utime, p->stime);x+}
+static inline cputime_t virt_ticks(struct task_struct *p)
+{x+	return p->utime;x+}
+static inline unsigned long long sched_ns(struct task_struct *p)
+{x+	return (p == current) ? current_sched_time(p) : p->sched_time;x+}x+
+int posix_cpu_clock_getres(clockid_t which_clock, struct timespec *tp)
+{x+	int error = check_clock(which_clock);x+	if (!error) {x+		tp->tv_sec = 0;x+		tp->tv_nsec = ((NSEC_PER_SEC + HZ - 1) / HZ);x+		if (CPUCLOCK_WHICH(which_clock) == CPUCLOCK_SCHED) {x+			/*
+			 * If sched_clock is using a cycle counter, we
+			 * don't have any idea of its true resolution
+			 * exported, but it is much more than 1s/HZ.
+			 */
+			tp->tv_nsec = 1;
+		}x+	}
+	return error;
+}x+
+int posix_cpu_clock_set(clockid_t which_clock, const struct timespec *tp)
+{x+	/*
+	 * You can never reset a CPU clock, but we check for other errorsx+	 * in the call before failing with EPERM.
+	 */
+	int error = check_clock(which_clock);x+	if (error == 0) {
+		error = -EPERM;x+	}
+	return error;
+}x+
+
+/*
+ * Sample a per-thread clock for the given task.
+ */
+static int cpu_clock_sample(clockid_t which_clock, struct task_struct *p,x+			    union cpu_time_count *cpu)x+{x+	switch (CPUCLOCK_WHICH(which_clock)) {
+	default:
+		return -EINVAL;x+	case CPUCLOCK_PROF:
+		cpu->cpu = prof_ticks(p);x+		break;x+	case CPUCLOCK_VIRT:
+		cpu->cpu = virt_ticks(p);x+		break;x+	case CPUCLOCK_SCHED:
+		cpu->sched = sched_ns(p);x+		break;x+	}
+	return 0;x+}x+
+/*
+ * Sample a process (thread group) clock for the given group_leader task.
+ * Must be called with tasklist_lock held for reading.
+ * Must be called with tasklist_lock held for reading, and p->sighand->siglock.
+ */
+static int cpu_clock_sample_group_locked(unsigned int clock_idx,x+					 struct task_struct *p,x+					 union cpu_time_count *cpu)x+{x+	struct task_struct *t = p;x+ 	switch (clock_idx) {
+	default:
+		return -EINVAL;x+	case CPUCLOCK_PROF:
+		cpu->cpu = cputime_add(p->signal->utime, p->signal->stime);x+		do {x+			cpu->cpu = cputime_add(cpu->cpu, prof_ticks(t));
+			t = next_thread(t);x+		} while (t != p);x+		break;x+	case CPUCLOCK_VIRT:
+		cpu->cpu = p->signal->utime;x+		do {x+			cpu->cpu = cputime_add(cpu->cpu, virt_ticks(t));
+			t = next_thread(t);x+		} while (t != p);x+		break;x+	case CPUCLOCK_SCHED:
+		cpu->sched = p->signal->sched_time;x+		/* Add in each other live thread.  */
+		while ((t = next_thread(t)) != p) {x+			cpu->sched += t->sched_time;x+		}x+		if (p->tgid == current->tgid) {x+			/*
+			 * We're sampling ourselves, so include the
+			 * cycles not yet banked.  We still omit
+			 * other threads running on other CPUs,x+			 * so the total can always be behind asx+			 * much as max(nthreads-1,ncpus) * (NSEC_PER_SEC/HZ).
+			 */
+			cpu->sched += current_sched_time(current);x+		} else {
+			cpu->sched += p->sched_time;x+		}x+		break;x+	}
+	return 0;x+}x+
+/*
+ * Sample a process (thread group) clock for the given group_leader task.
+ * Must be called with tasklist_lock held for reading.
+ */
+static int cpu_clock_sample_group(clockid_t which_clock,x+				  struct task_struct *p,x+				  union cpu_time_count *cpu)x+{x+	int ret;x+	unsigned long flags;
+	spin_lock_irqsave(&p->sighand->siglock, flags);
+	ret = cpu_clock_sample_group_locked(CPUCLOCK_WHICH(which_clock), p,x+					    cpu);x+	spin_unlock_irqrestore(&p->sighand->siglock, flags);
+	return ret;x+}x+
+
+int posix_cpu_clock_get(clockid_t which_clock, struct timespec *tp)
+{x+	const pid_t pid = CPUCLOCK_PID(which_clock);x+	int error = -EINVAL;x+	union cpu_time_count rtn;x+x+	if (pid == 0) {x+		/*
+		 * Special case constant value for our own clocks.
+		 * We don't have to do any lookup to find ourselves.
+		 */
+		if (CPUCLOCK_PERTHREAD(which_clock)) {x+			/*
+			 * Sampling just ourselves we can do with no locking.
+			 */
+			error = cpu_clock_sample(which_clock,x+						 current, &rtn);x+		} else {
+			read_lock(&tasklist_lock);
+			error = cpu_clock_sample_group(which_clock,x+						       current, &rtn);x+			read_unlock(&tasklist_lock);
+		}x+	} else {
+		/*
+		 * Find the given PID, and validate that the caller
+		 * should be able to see it.
+		 */
+		struct task_struct *p;
+		read_lock(&tasklist_lock);
+		p = find_task_by_pid(pid);x+		if (p) {x+			if (CPUCLOCK_PERTHREAD(which_clock)) {x+				if (p->tgid == current->tgid) {x+					error = cpu_clock_sample(which_clock,x+								 p, &rtn);x+				}x+			} else if (p->tgid == pid && p->signal) {x+				error = cpu_clock_sample_group(which_clock,x+							       p, &rtn);x+			}
+		}x+		read_unlock(&tasklist_lock);
+	}x+x+	if (error)
+		return error;
+	sample_to_timespec(which_clock, rtn, tp);x+	return 0;x+}x+
+
+/*
+ * Validate the clockid_t for a new CPU-clock timer, and initialize the timer.
+ * This is called from sys_timer_create with the new timer already locked.
+ */
+int posix_cpu_timer_create(struct k_itimer *new_timer)x+{x+	int ret = 0;x+	const pid_t pid = CPUCLOCK_PID(new_timer->it_clock);
+	struct task_struct *p;
+x+	if (CPUCLOCK_WHICH(new_timer->it_clock) >= CPUCLOCK_MAX)
+		return -EINVAL;x+x+	INIT_LIST_HEAD(&new_timer->it.cpu.entry);
+	new_timer->it.cpu.incr.sched = 0;x+	new_timer->it.cpu.expires.sched = 0;
+
+	read_lock(&tasklist_lock);
+	if (CPUCLOCK_PERTHREAD(new_timer->it_clock)) {x+		if (pid == 0) {x+			p = current;x+		} else {
+			p = find_task_by_pid(pid);x+			if (p && p->tgid != current->tgid)x+				p = NULL;
+		}x+	} else {
+		if (pid == 0) {x+			p = current->group_leader;x+		} else {
+			p = find_task_by_pid(pid);x+			if (p && p->tgid != pid)x+				p = NULL;
+		}x+	}x+	new_timer->it.cpu.task = p;x+	if (p) {x+		get_task_struct(p);x+	} else {
+		ret = -EINVAL;x+	}
+	read_unlock(&tasklist_lock);
+x+	return ret;x+}x+
+/*
+ * Clean up a CPU-clock timer that is about to be destroyed.
+ * This is called from timer deletion with the timer already locked.
+ * If we return TIMER_RETRY, it's necessary to release the timer's lock
+ * and try again.  (This happens when the timer is in the middle of firing.)
+ */
+int posix_cpu_timer_del(struct k_itimer *timer)x+{x+	struct task_struct *p = timer->it.cpu.task;
+x+	if (timer->it.cpu.firing)
+		return TIMER_RETRY;x+x+	if (unlikely(p == NULL))x+		return 0;
+
+	if (!list_empty(&timer->it.cpu.entry)) {x+		read_lock(&tasklist_lock);
+		if (unlikely(p->signal == NULL)) {x+			/*
+			 * We raced with the reaping of the task.
+			 * The deletion should have cleared us off the list.
+			 */
+			BUG_ON(!list_empty(&timer->it.cpu.entry));x+		} else {
+			/*
+			 * Take us off the task's timer list.
+			 */
+			spin_lock(&p->sighand->siglock);x+			list_del(&timer->it.cpu.entry);
+			spin_unlock(&p->sighand->siglock);x+		}x+		read_unlock(&tasklist_lock);
+	}x+	put_task_struct(p);x+
+	return 0;x+}x+
+/*
+ * Clean out CPU timers still ticking when a thread exited.  The task
+ * pointer is cleared, and the expiry time is replaced with the residual
+ * time for later timer_gettime calls to return.
+ * This must be called with the siglock held.
+ */
+static void cleanup_timers(struct list_head *head,x+			   cputime_t utime, cputime_t stime,x+			   unsigned long long sched_time)x+{x+	struct cpu_timer_list *timer, *next;x+	cputime_t ptime = cputime_add(utime, stime);x+x+	list_for_each_entry_safe(timer, next, head, entry) {x+		timer->task = NULL;
+		list_del_init(&timer->entry);
+		if (cputime_lt(timer->expires.cpu, ptime)) {x+			timer->expires.cpu = cputime_zero;x+		} else {
+			timer->expires.cpu = cputime_sub(timer->expires.cpu,x+							 ptime);x+		}
+	}x+x+	++head;x+	list_for_each_entry_safe(timer, next, head, entry) {x+		timer->task = NULL;
+		list_del_init(&timer->entry);
+		if (cputime_lt(timer->expires.cpu, utime)) {x+			timer->expires.cpu = cputime_zero;x+		} else {
+			timer->expires.cpu = cputime_sub(timer->expires.cpu,x+							 utime);x+		}
+	}x+x+	++head;x+	list_for_each_entry_safe(timer, next, head, entry) {x+		timer->task = NULL;
+		list_del_init(&timer->entry);
+		if (timer->expires.sched < sched_time) {
+			timer->expires.sched = 0;x+		} else {
+			timer->expires.sched -= sched_time;x+		}x+	}x+}x+
+/*
+ * These are both called with the siglock held, when the current thread
+ * is being reaped.  When the final (leader) thread in the group is reaped,
+ * posix_cpu_timers_exit_group will be called after posix_cpu_timers_exit.
+ */
+void posix_cpu_timers_exit(struct task_struct *tsk)
+{x+	cleanup_timers(tsk->cpu_timers,
+		       tsk->utime, tsk->stime, tsk->sched_time);x+x+}
+void posix_cpu_timers_exit_group(struct task_struct *tsk)
+{x+	cleanup_timers(tsk->signal->cpu_timers,
+		       cputime_add(tsk->utime, tsk->signal->utime),
+		       cputime_add(tsk->stime, tsk->signal->stime),
+		       tsk->sched_time + tsk->signal->sched_time);x+}x+
+
+/*
+ * Set the expiry times of all the threads in the process so one of them
+ * will go off before the process cumulative expiry total is reached.
+ */
+static void process_timer_rebalance(struct task_struct *p,x+				    unsigned int clock_idx,x+				    union cpu_time_count expires,x+				    union cpu_time_count val)
+{x+	cputime_t ticks, left;x+	unsigned long long ns, nsleft;x+ 	struct task_struct *t = p;x+	unsigned int nthreads = atomic_read(&p->signal->live);x+x+	switch (clock_idx) {
+	default:
+		BUG();x+		break;x+	case CPUCLOCK_PROF:
+		left = cputime_sub(expires.cpu, val.cpu)
+			/ nthreads;x+		do {x+			if (!unlikely(t->exit_state)) {x+				ticks = cputime_add(prof_ticks(t), left);x+				if (cputime_eq(t->it_prof_expires,x+					       cputime_zero) ||
+				    cputime_gt(t->it_prof_expires, ticks)) {x+					t->it_prof_expires = ticks;x+				}x+			}
+			t = next_thread(t);x+		} while (t != p);x+		break;x+	case CPUCLOCK_VIRT:
+		left = cputime_sub(expires.cpu, val.cpu)
+			/ nthreads;x+		do {x+			if (!unlikely(t->exit_state)) {x+				ticks = cputime_add(virt_ticks(t), left);x+				if (cputime_eq(t->it_virt_expires,x+					       cputime_zero) ||
+				    cputime_gt(t->it_virt_expires, ticks)) {x+					t->it_virt_expires = ticks;x+				}x+			}
+			t = next_thread(t);x+		} while (t != p);x+		break;x+	case CPUCLOCK_SCHED:
+		nsleft = expires.sched - val.sched;x+		do_div(nsleft, nthreads);x+		do {x+			if (!unlikely(t->exit_state)) {x+				ns = t->sched_time + nsleft;x+				if (t->it_sched_expires == 0 ||
+				    t->it_sched_expires > ns) {x+					t->it_sched_expires = ns;x+				}x+			}
+			t = next_thread(t);x+		} while (t != p);x+		break;x+	}x+}x+
+static void clear_dead_task(struct k_itimer *timer, union cpu_time_count now)
+{x+	/*
+	 * That's all for this thread or process.
+	 * We leave our residual in expires to be reported.
+	 */
+	put_task_struct(timer->it.cpu.task);x+	timer->it.cpu.task = NULL;
+	timer->it.cpu.expires = cpu_time_sub(timer->it_clock,x+					     timer->it.cpu.expires,x+					     now);x+}x+
+/*
+ * Insert the timer on the appropriate list before any timers that
+ * expire later.  This must be called with the tasklist_lock held
+ * for reading, and interrupts disabled.
+ */
+static void arm_timer(struct k_itimer *timer, union cpu_time_count now)
+{x+	struct task_struct *p = timer->it.cpu.task;
+	struct list_head *head, *listpos;x+	struct cpu_timer_list *const nt = &timer->it.cpu;x+	struct cpu_timer_list *next;x+	unsigned long i;x+x+	head = (CPUCLOCK_PERTHREAD(timer->it_clock) ?
+		p->cpu_timers : p->signal->cpu_timers);x+	head += CPUCLOCK_WHICH(timer->it_clock);x+x+	BUG_ON(!irqs_disabled());
+	spin_lock(&p->sighand->siglock);x+x+	listpos = head;x+	if (CPUCLOCK_WHICH(timer->it_clock) == CPUCLOCK_SCHED) {x+		list_for_each_entry(next, head, entry) {x+			if (next->expires.sched > nt->expires.sched) {x+				listpos = &next->entry;x+				break;x+			}
+		}x+	} else {
+		list_for_each_entry(next, head, entry) {x+			if (cputime_gt(next->expires.cpu, nt->expires.cpu)) {x+				listpos = &next->entry;x+				break;x+			}
+		}x+	}x+	list_add(&nt->entry, listpos);x+x+	if (listpos == head) {x+		/*
+		 * We are the new earliest-expiring timer.
+		 * If we are a thread timer, there can always
+		 * be a process timer telling us to stop earlier.
+		 */
+
+		if (CPUCLOCK_PERTHREAD(timer->it_clock)) {x+			switch (CPUCLOCK_WHICH(timer->it_clock)) {x+			default:
+				BUG();x+#define UPDATE_CLOCK(WHICH, c, n)			      		      \
+			case CPUCLOCK_##WHICH: 				      \x+				if (p->it_##c##_expires == 0 ||		      \x+				    p->it_##c##_expires > nt->expires.n) {    \x+					p->it_##c##_expires = nt->expires.n;  \x+				}					      \x+				breakx+			UPDATE_CLOCK(PROF, prof, cpu);x+			UPDATE_CLOCK(VIRT, virt, cpu);x+			UPDATE_CLOCK(SCHED, sched, sched);x+#undef UPDATE_CLOCKx+			}
+		} else {
+			/*
+			 * For a process timer, we must balance
+			 * all the live threads' expirations.
+			 */
+			switch (CPUCLOCK_WHICH(timer->it_clock)) {x+			default:
+				BUG();x+			case CPUCLOCK_VIRT:
+				if (!cputime_eq(p->signal->it_virt_expires,x+						cputime_zero) &&
+				    cputime_lt(p->signal->it_virt_expires,x+					       timer->it.cpu.expires.cpu))x+					break;x+				goto rebalance;x+			case CPUCLOCK_PROF:
+				if (!cputime_eq(p->signal->it_prof_expires,x+						cputime_zero) &&
+				    cputime_lt(p->signal->it_prof_expires,x+					       timer->it.cpu.expires.cpu))x+					break;x+				i = p->signal->rlim[RLIMIT_CPU].rlim_cur;x+				if (i != RLIM_INFINITY &&
+				    i <= cputime_to_secs(timer->it.cpu.expires.cpu))x+					break;x+				goto rebalance;x+			case CPUCLOCK_SCHED:
+			rebalance:
+				process_timer_rebalance(x+					timer->it.cpu.task,x+					CPUCLOCK_WHICH(timer->it_clock),x+					timer->it.cpu.expires, now);x+				break;x+			}
+		}x+	}x+x+	spin_unlock(&p->sighand->siglock);x+}x+
+/*
+ * The timer is locked, fire it and arrange for its reload.
+ */
+static void cpu_timer_fire(struct k_itimer *timer)x+{x+	if (unlikely(timer->sigq == NULL)) {x+		/*
+		 * This a special case for clock_nanosleep,x+		 * not a normal timer from sys_timer_create.
+		 */
+		wake_up_process(timer->it_process);x+		timer->it.cpu.expires.sched = 0;
+	} else if (timer->it.cpu.incr.sched == 0) {x+		/*
+		 * One-shot timer.  Clear it as soon as it's fired.
+		 */
+		posix_timer_event(timer, 0);x+		timer->it.cpu.expires.sched = 0;
+	} else if (posix_timer_event(timer, ++timer->it_requeue_pending)) {x+		/*
+		 * The signal did not get queued because the signal
+		 * was ignored, so we won't get any callback to
+		 * reload the timer.  But we need to keep it
+		 * ticking in case the signal is deliverable next time.
+		 */
+		posix_cpu_timer_schedule(timer);x+	}x+}x+
+/*
+ * Guts of sys_timer_settime for CPU timers.
+ * This is called with the timer locked and interrupts disabled.
+ * If we return TIMER_RETRY, it's necessary to release the timer's lock
+ * and try again.  (This happens when the timer is in the middle of firing.)
+ */
+int posix_cpu_timer_set(struct k_itimer *timer, int flags,x+			struct itimerspec *new, struct itimerspec *old)
+{x+	struct task_struct *p = timer->it.cpu.task;
+	union cpu_time_count old_expires, new_expires, val;x+	int ret;x+x+	if (unlikely(p == NULL)) {x+		/*
+		 * Timer refers to a dead task's clock.
+		 */
+		return -ESRCH;
+	}x+x+	new_expires = timespec_to_sample(timer->it_clock, &new->it_value);
+
+	read_lock(&tasklist_lock);
+	/*
+	 * We need the tasklist_lock to protect against reaping that
+	 * clears p->signal.  If p has just been reaped, we can no
+	 * longer get any information about it at all.
+	 */
+	if (unlikely(p->signal == NULL)) {x+		read_unlock(&tasklist_lock);
+		put_task_struct(p);x+		timer->it.cpu.task = NULL;
+		return -ESRCH;
+	}x+x+	/*
+	 * Disarm any old timer after extracting its expiry time.
+	 */
+	BUG_ON(!irqs_disabled());
+	spin_lock(&p->sighand->siglock);x+	old_expires = timer->it.cpu.expires;
+	list_del_init(&timer->it.cpu.entry);
+	spin_unlock(&p->sighand->siglock);x+
+	/*
+	 * We need to sample the current value to convert the new
+	 * value from to relative and absolute, and to convert the
+	 * old value from absolute to relative.  To set a process
+	 * timer, we need a sample to balance the thread expiry
+	 * times (in arm_timer).  With an absolute time, we must
+	 * check if it's already passed.  In short, we need a sample.
+	 */
+	if (CPUCLOCK_PERTHREAD(timer->it_clock)) {x+		cpu_clock_sample(timer->it_clock, p, &val);x+	} else {
+		cpu_clock_sample_group(timer->it_clock, p, &val);x+	}x+x+	if (old) {
+		if (old_expires.sched == 0) {x+			old->it_value.tv_sec = 0;x+			old->it_value.tv_nsec = 0;x+		} else {
+			/*
+			 * Update the timer in case it hasx+			 * overrun already.  If it has,x+			 * we'll report it as having overrun
+			 * and with the next reloaded timer
+			 * already ticking, though we arex+			 * swallowing that pendingx+			 * notification here to install thex+			 * new setting.
+			 */
+			bump_cpu_timer(timer, val);
+			if (cpu_time_before(timer->it_clock, val,x+					    timer->it.cpu.expires)) {x+				old_expires = cpu_time_sub(x+					timer->it_clock,x+					timer->it.cpu.expires, val);
+				sample_to_timespec(timer->it_clock,x+						   old_expires,x+						   &old->it_value);x+			} else {
+				old->it_value.tv_nsec = 1;
+				old->it_value.tv_sec = 0;x+			}
+		}x+	}x+x+	if (unlikely(timer->it.cpu.firing)) {x+		/*
+		 * We are colliding with the timer actually firing.
+		 * Punt after filling in the timer's old value, and
+		 * disable this firing since we are already reportingx+		 * it as an overrun (thanks to bump_cpu_timer above).
+		 */
+		read_unlock(&tasklist_lock);
+		timer->it.cpu.firing = -1;
+		ret = TIMER_RETRY;x+		goto out;x+	}x+x+	if (new_expires.sched != 0 && !(flags & TIMER_ABSTIME)) {x+		cpu_time_add(timer->it_clock, &new_expires, val);
+	}x+x+	/*
+	 * Install the new expiry time (or zero).
+	 * For a timer with no notification action, we don't actually
+	 * arm the timer (we'll just fake it for timer_gettime).
+	 */
+	timer->it.cpu.expires = new_expires;x+	if (new_expires.sched != 0 &&
+	    (timer->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE &&
+	    cpu_time_before(timer->it_clock, val, new_expires)) {x+		arm_timer(timer, val);
+	}
+
+	read_unlock(&tasklist_lock);
+x+	/*
+	 * Install the new reload setting, and
+	 * set up the signal and overrun bookkeeping.
+	 */
+	timer->it.cpu.incr = timespec_to_sample(timer->it_clock,x+						&new->it_interval);
+x+	/*
+	 * This acts as a modification timestamp for the timer,x+	 * so any automatic reload attempt will punt on seeing
+	 * that we have reset the timer manually.
+	 */
+	timer->it_requeue_pending = (timer->it_requeue_pending + 2) &
+		~REQUEUE_PENDING;
+	timer->it_overrun_last = 0;x+	timer->it_overrun = -1;
+x+	if (new_expires.sched != 0 &&
+	    (timer->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE &&
+	    !cpu_time_before(timer->it_clock, val, new_expires)) {x+		/*
+		 * The designated time already passed, so we notifyx+		 * immediately, even if the thread never runs to
+		 * accumulate more time on this clock.
+		 */
+		cpu_timer_fire(timer);x+	}x+
+	ret = 0;x+ out:x+	if (old) {
+		sample_to_timespec(timer->it_clock,x+				   timer->it.cpu.incr, &old->it_interval);
+	}
+	return ret;x+}x+
+void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp)
+{x+	union cpu_time_count now;x+	struct task_struct *p = timer->it.cpu.task;
+	int clear_dead;
+x+	/*
+	 * Easy part: convert the reload time.
+	 */
+	sample_to_timespec(timer->it_clock,x+			   timer->it.cpu.incr, &itp->it_interval);
+x+	if (timer->it.cpu.expires.sched == 0) {	/* Timer not armed at all.  */
+		itp->it_value.tv_sec = itp->it_value.tv_nsec = 0;x+		return;
+	}x+x+	if (unlikely(p == NULL)) {x+		/*
+		 * This task already died and the timer will never fire.
+		 * In this case, expires is actually the dead value.
+		 */
+	dead:
+		sample_to_timespec(timer->it_clock, timer->it.cpu.expires,x+				   &itp->it_value);x+		return;
+	}x+x+	/*
+	 * Sample the clock to take the difference with the expiry time.
+	 */
+	if (CPUCLOCK_PERTHREAD(timer->it_clock)) {x+		cpu_clock_sample(timer->it_clock, p, &now);x+		clear_dead = p->exit_state;x+	} else {
+		read_lock(&tasklist_lock);
+		if (unlikely(p->signal == NULL)) {x+			/*
+			 * The process has been reaped.
+			 * We can't even collect a sample any more.
+			 * Call the timer disarmed, nothing else to do.
+			 */
+			put_task_struct(p);x+			timer->it.cpu.task = NULL;
+			timer->it.cpu.expires.sched = 0;
+			read_unlock(&tasklist_lock);
+			goto dead;
+		} else {
+			cpu_clock_sample_group(timer->it_clock, p, &now);x+			clear_dead = (unlikely(p->exit_state) &&
+				      thread_group_empty(p));x+		}x+		read_unlock(&tasklist_lock);
+	}x+
+	if ((timer->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) {
+		if (timer->it.cpu.incr.sched == 0 &&
+		    cpu_time_before(timer->it_clock,
+				    timer->it.cpu.expires, now)) {x+			/*
+			 * Do-nothing timer expired and has no reload,x+			 * so it's as if it was never set.
+			 */
+			timer->it.cpu.expires.sched = 0;
+			itp->it_value.tv_sec = itp->it_value.tv_nsec = 0;x+			return;
+		}x+		/*
+		 * Account for any expirations and reloads that should
+		 * have happened.
+		 */
+		bump_cpu_timer(timer, now);x+	}x+x+	if (unlikely(clear_dead)) {x+		/*
+		 * We've noticed that the thread is dead, butx+		 * not yet reaped.  Take this opportunity to
+		 * drop our task ref.
+		 */
+		clear_dead_task(timer, now);x+		goto dead;
+	}x+x+	if (cpu_time_before(timer->it_clock, now, timer->it.cpu.expires)) {x+		sample_to_timespec(timer->it_clock,x+				   cpu_time_sub(timer->it_clock,x+						timer->it.cpu.expires, now),x+				   &itp->it_value);x+	} else {
+		/*
+		 * The timer should have expired already, but the firingx+		 * hasn't taken place yet.  Say it's just about to expire.
+		 */
+		itp->it_value.tv_nsec = 1;
+		itp->it_value.tv_sec = 0;x+	}x+}x+
+/*
+ * Check for any per-thread CPU timers that have fired and move them off
+ * the tsk->cpu_timers[N] list onto the firing list.  Here we update the
+ * tsk->it_*_expires values to reflect the remaining thread CPU timers.
+ */
+static void check_thread_timers(struct task_struct *tsk,x+				struct list_head *firing)
+{
+	struct list_head *timers = tsk->cpu_timers;
+x+	tsk->it_prof_expires = 0;x+	while (!list_empty(timers)) {x+		struct cpu_timer_list *t = list_entry(timers->next,x+						      struct cpu_timer_list,x+						      entry);
+		if (cputime_lt(prof_ticks(tsk), t->expires.cpu)) {x+			tsk->it_prof_expires = t->expires.cpu;x+			break;x+		}x+		t->firing = 1;
+		list_move_tail(&t->entry, firing);
+	}x+x+	++timers;
+	tsk->it_virt_expires = 0;x+	while (!list_empty(timers)) {x+		struct cpu_timer_list *t = list_entry(timers->next,x+						      struct cpu_timer_list,x+						      entry);
+		if (cputime_lt(virt_ticks(tsk), t->expires.cpu)) {x+			tsk->it_virt_expires = t->expires.cpu;x+			break;x+		}x+		t->firing = 1;
+		list_move_tail(&t->entry, firing);
+	}x+x+	++timers;
+	tsk->it_sched_expires = 0;x+	while (!list_empty(timers)) {x+		struct cpu_timer_list *t = list_entry(timers->next,x+						      struct cpu_timer_list,x+						      entry);
+		if (tsk->sched_time < t->expires.sched) {x+			tsk->it_sched_expires = t->expires.sched;x+			break;x+		}x+		t->firing = 1;
+		list_move_tail(&t->entry, firing);
+	}x+}x+
+/*
+ * Check for any per-thread CPU timers that have fired and move them
+ * off the tsk->*_timers list onto the firing list.  Per-thread timers
+ * have already been taken off.
+ */
+static void check_process_timers(struct task_struct *tsk,x+				 struct list_head *firing)
+{
+	struct signal_struct *const sig = tsk->signal;x+	cputime_t utime, stime, ptime, virt_expires, prof_expires;
+	unsigned long long sched_time, sched_expires;
+	struct task_struct *t;
+	struct list_head *timers = sig->cpu_timers;
+x+	/*
+	 * Don't sample the current process CPU clocks if there are no timers.
+	 */
+	if (list_empty(&timers[CPUCLOCK_PROF]) &&
+	    cputime_eq(sig->it_prof_expires, cputime_zero) &&
+	    sig->rlim[RLIMIT_CPU].rlim_cur == RLIM_INFINITY &&
+	    list_empty(&timers[CPUCLOCK_VIRT]) &&
+	    cputime_eq(sig->it_virt_expires, cputime_zero) &&
+	    list_empty(&timers[CPUCLOCK_SCHED]))x+		return;
+x+	/*
+	 * Collect the current process totals.
+	 */
+	utime = sig->utime;x+	stime = sig->stime;x+	sched_time = sig->sched_time;x+	t = tsk;x+	do {x+		utime = cputime_add(utime, t->utime);x+		stime = cputime_add(stime, t->stime);x+		sched_time += t->sched_time;x+		t = next_thread(t);x+	} while (t != tsk);x+	ptime = cputime_add(utime, stime);x+x+	prof_expires = cputime_zero;x+	while (!list_empty(timers)) {x+		struct cpu_timer_list *t = list_entry(timers->next,x+						      struct cpu_timer_list,x+						      entry);
+		if (cputime_lt(ptime, t->expires.cpu)) {x+			prof_expires = t->expires.cpu;x+			break;x+		}x+		t->firing = 1;
+		list_move_tail(&t->entry, firing);
+	}x+x+	++timers;
+	virt_expires = cputime_zero;x+	while (!list_empty(timers)) {x+		struct cpu_timer_list *t = list_entry(timers->next,x+						      struct cpu_timer_list,x+						      entry);
+		if (cputime_lt(utime, t->expires.cpu)) {x+			virt_expires = t->expires.cpu;x+			break;x+		}x+		t->firing = 1;
+		list_move_tail(&t->entry, firing);
+	}x+x+	++timers;
+	sched_expires = cputime_zero;x+	while (!list_empty(timers)) {x+		struct cpu_timer_list *t = list_entry(timers->next,x+						      struct cpu_timer_list,x+						      entry);
+		if (sched_time < t->expires.sched) {x+			sched_expires = t->expires.sched;x+			break;x+		}x+		t->firing = 1;
+		list_move_tail(&t->entry, firing);
+	}x+x+	/*
+	 * Check for the special case process timers.
+	 */
+	if (!cputime_eq(sig->it_prof_expires, cputime_zero)) {
+		if (cputime_ge(ptime, sig->it_prof_expires)) {x+			/* ITIMER_PROF fires and reloads.  */
+			sig->it_prof_expires = sig->it_prof_incr;
+			if (!cputime_eq(sig->it_prof_expires, cputime_zero)) {
+				sig->it_prof_expires = cputime_add(x+					sig->it_prof_expires, ptime);x+			}
+			__group_send_sig_info(SIGPROF, SEND_SIG_PRIV, tsk);x+		}x+		if (!cputime_eq(sig->it_prof_expires, cputime_zero) &&
+		    (cputime_eq(prof_expires, cputime_zero) ||
+		     cputime_lt(sig->it_prof_expires, prof_expires))) {x+			prof_expires = sig->it_prof_expires;
+		}x+	}x+	if (!cputime_eq(sig->it_virt_expires, cputime_zero)) {
+		if (cputime_ge(utime, sig->it_virt_expires)) {x+			/* ITIMER_VIRTUAL fires and reloads.  */
+			sig->it_virt_expires = sig->it_virt_incr;
+			if (!cputime_eq(sig->it_virt_expires, cputime_zero)) {
+				sig->it_virt_expires = cputime_add(x+					sig->it_virt_expires, utime);x+			}
+			__group_send_sig_info(SIGVTALRM, SEND_SIG_PRIV, tsk);x+		}x+		if (!cputime_eq(sig->it_virt_expires, cputime_zero) &&
+		    (cputime_eq(virt_expires, cputime_zero) ||
+		     cputime_lt(sig->it_virt_expires, virt_expires))) {x+			virt_expires = sig->it_virt_expires;
+		}x+	}x+	if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {x+		unsigned long psecs = cputime_to_secs(ptime);x+		cputime_t x;x+		if (psecs >= sig->rlim[RLIMIT_CPU].rlim_max) {x+			/*
+			 * At the hard limit, we just die.
+			 * No need to calculate anything else now.
+			 */
+			__group_send_sig_info(SIGKILL, SEND_SIG_PRIV, tsk);x+			return;
+		}x+		if (psecs >= sig->rlim[RLIMIT_CPU].rlim_cur) {x+			/*
+			 * At the soft limit, send a SIGXCPU every second.
+			 */
+			__group_send_sig_info(SIGXCPU, SEND_SIG_PRIV, tsk);x+			if (sig->rlim[RLIMIT_CPU].rlim_curx+			    < sig->rlim[RLIMIT_CPU].rlim_max) {x+				sig->rlim[RLIMIT_CPU].rlim_cur++;x+			}
+		}x+		x = secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur);
+		if (cputime_eq(prof_expires, cputime_zero) ||
+		    cputime_lt(x, prof_expires)) {x+			prof_expires = x;
+		}x+	}x+x+	if (!cputime_eq(prof_expires, cputime_zero) ||
+	    !cputime_eq(virt_expires, cputime_zero) ||
+	    sched_expires != 0) {x+		/*
+		 * Rebalance the threads' expiry times for the remaining
+		 * process CPU timers.
+		 */
+
+		cputime_t prof_left, virt_left, ticks;x+		unsigned long long sched_left, sched;x+		const unsigned int nthreads = atomic_read(&sig->live);x+x+		prof_left = cputime_sub(prof_expires,x+					cputime_add(utime, stime)) / nthreads;x+		virt_left = cputime_sub(virt_expires, utime) / nthreads;x+		if (sched_expires) {x+			sched_left = sched_expires - sched_time;x+			do_div(sched_left, nthreads);x+		} else {
+			sched_left = 0;x+		}x+		t = tsk;x+		do {x+			ticks = cputime_add(cputime_add(t->utime, t->stime),
+					    prof_left);
+			if (!cputime_eq(prof_expires, cputime_zero) &&
+			    (cputime_eq(t->it_prof_expires, cputime_zero) ||
+			     cputime_gt(t->it_prof_expires, ticks))) {x+				t->it_prof_expires = ticks;x+			}x+x+			ticks = cputime_add(t->utime, virt_left);
+			if (!cputime_eq(virt_expires, cputime_zero) &&
+			    (cputime_eq(t->it_virt_expires, cputime_zero) ||
+			     cputime_gt(t->it_virt_expires, ticks))) {x+				t->it_virt_expires = ticks;x+			}x+x+			sched = t->sched_time + sched_left;x+			if (sched_expires && (t->it_sched_expires == 0 ||
+					      t->it_sched_expires > sched)) {x+				t->it_sched_expires = sched;x+			}x+x+			do {x+				t = next_thread(t);x+			} while (unlikely(t->exit_state));x+		} while (t != tsk);x+	}x+}x+
+/*
+ * This is called from the signal code (via do_schedule_next_timer)x+ * when the last timer signal was delivered and we have to reload the timer.
+ */
+void posix_cpu_timer_schedule(struct k_itimer *timer)x+{x+	struct task_struct *p = timer->it.cpu.task;
+	union cpu_time_count now;x+x+	if (unlikely(p == NULL))x+		/*
+		 * The task was cleaned up already, no future firings.
+		 */
+		return;
+x+	/*
+	 * Fetch the current sample and update the timer's expiry time.
+	 */
+	if (CPUCLOCK_PERTHREAD(timer->it_clock)) {x+		cpu_clock_sample(timer->it_clock, p, &now);x+		bump_cpu_timer(timer, now);x+		if (unlikely(p->exit_state)) {x+			clear_dead_task(timer, now);x+			return;
+		}x+		read_lock(&tasklist_lock); /* arm_timer needs it.  */
+	} else {
+		read_lock(&tasklist_lock);
+		if (unlikely(p->signal == NULL)) {x+			/*
+			 * The process has been reaped.
+			 * We can't even collect a sample any more.
+			 */
+			put_task_struct(p);x+			timer->it.cpu.task = p = NULL;
+			timer->it.cpu.expires.sched = 0;
+			read_unlock(&tasklist_lock);
+			return;
+		} else if (unlikely(p->exit_state) && thread_group_empty(p)) {x+			/*
+			 * We've noticed that the thread is dead, butx+			 * not yet reaped.  Take this opportunity to
+			 * drop our task ref.
+			 */
+			clear_dead_task(timer, now);x+			read_unlock(&tasklist_lock);
+			return;
+		}
+		cpu_clock_sample_group(timer->it_clock, p, &now);x+		bump_cpu_timer(timer, now);x+		/* Leave the tasklist_lock locked for the call below.  */
+	}
+x+	/*
+	 * Now re-arm for the new expiry time.
+	 */
+	arm_timer(timer, now);x+
+	read_unlock(&tasklist_lock);
+}x+
+/*
+ * This is called from the timer interrupt handler.  The irq handler hasx+ * already updated our counts.  We need to check if any timers fire now.
+ * Interrupts are disabled.
+ */
+void run_posix_cpu_timers(struct task_struct *tsk)
+{x+	LIST_HEAD(firing);
+	struct k_itimer *timer, *next;x+
+	BUG_ON(!irqs_disabled());
+x+#define UNEXPIRED(clock) \x+		(tsk->it_##clock##_expires == 0 || \x+		 cputime_lt(clock##_ticks(tsk), tsk->it_##clock##_expires))x+
+	if (UNEXPIRED(prof) && UNEXPIRED(virt) &&
+	    (tsk->it_sched_expires == 0 ||
+	     tsk->sched_time < tsk->it_sched_expires))x+		return;
+x+#undef	UNEXPIREDx+
+	BUG_ON(tsk->exit_state);
+x+	/*
+	 * Double-check with locks held.
+	 */
+	read_lock(&tasklist_lock);
+	spin_lock(&tsk->sighand->siglock);x+
+	/*
+	 * Here we take off tsk->cpu_timers[N] and tsk->signal->cpu_timers[N]
+	 * all the timers that are firing, and put them on the firing list.
+	 */
+	check_thread_timers(tsk, &firing);
+	check_process_timers(tsk, &firing);
+
+	/*
+	 * We must release these locks before taking any timer's lock.
+	 * There is a potential race with timer deletion here, as the
+	 * siglock now protects our private firing list.  We have set
+	 * the firing flag in each timer, so that a deletion attempt
+	 * that gets the timer lock before we do will give it up and
+	 * spin until we've taken care of that timer below.
+	 */
+	spin_unlock(&tsk->sighand->siglock);x+	read_unlock(&tasklist_lock);
+x+	/*
+	 * Now that all the timers on our list have the firing flag,x+	 * noone will touch their list entries but us.  We'll takex+	 * each timer's lock before clearing its firing flag, so no
+	 * timer call will interfere.
+	 */
+	list_for_each_entry_safe(timer, next, &firing, it.cpu.entry) {
+		int firing;x+		spin_lock(&timer->it_lock);
+		list_del_init(&timer->it.cpu.entry);
+		firing = timer->it.cpu.firing;
+		timer->it.cpu.firing = 0;x+		/*
+		 * The firing flag is -1 if we collided with a reset
+		 * of the timer, which already reported this
+		 * almost-firing as an overrun.  So don't generate an event.
+		 */
+		if (likely(firing >= 0)) {x+			cpu_timer_fire(timer);x+		}
+		spin_unlock(&timer->it_lock);
+	}x+}x+
+/*
+ * Set one of the process-wide special case CPU timers.
+ * The tasklist_lock and tsk->sighand->siglock must be held by the caller.
+ * The oldval argument is null for the RLIMIT_CPU timer, where *newval isx+ * absolute; non-null for ITIMER_*, where *newval is relative and we update
+ * it to be absolute, *oldval is absolute and we update it to be relative.
+ */
+void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,x+			   cputime_t *newval, cputime_t *oldval)
+{x+	union cpu_time_count now;x+	struct list_head *head;x+
+	BUG_ON(clock_idx == CPUCLOCK_SCHED);x+	cpu_clock_sample_group_locked(clock_idx, tsk, &now);x+
+	if (oldval) {x+		if (!cputime_eq(*oldval, cputime_zero)) {
+			if (cputime_le(*oldval, now.cpu)) {x+				/* Just about to fire. */
+				*oldval = jiffies_to_cputime(1);x+			} else {
+				*oldval = cputime_sub(*oldval, now.cpu);x+			}
+		}x+
+		if (cputime_eq(*newval, cputime_zero))
+			return;
+		*newval = cputime_add(*newval, now.cpu);x+x+		/*
+		 * If the RLIMIT_CPU timer will expire before the
+		 * ITIMER_PROF timer, we have nothing else to do.
+		 */
+		if (tsk->signal->rlim[RLIMIT_CPU].rlim_curx+		    < cputime_to_secs(*newval))
+			return;
+	}x+x+	/*
+	 * Check whether there are any process timers already set to fire
+	 * before this one.  If so, we don't have anything more to do.
+	 */
+	head = &tsk->signal->cpu_timers[clock_idx];
+	if (list_empty(head) ||
+	    cputime_ge(list_entry(head->next,x+				  struct cpu_timer_list, entry)->expires.cpu,x+		       *newval)) {x+		/*
+		 * Rejigger each thread's expiry time so that one willx+		 * notice before we hit the process-cumulative expiry time.
+		 */
+		union cpu_time_count expires = { .sched = 0 };
+		expires.cpu = *newval;x+		process_timer_rebalance(tsk, clock_idx, expires, now);x+	}x+}x+
+static long posix_cpu_clock_nanosleep_restart(struct restart_block *);x+x+int posix_cpu_nsleep(clockid_t which_clock, int flags,x+		     struct timespec *rqtp)
+{x+	struct restart_block *restart_block =
+	    &current_thread_info()->restart_block;
+	struct k_itimer timer;x+	int error;
+x+	/*
+	 * Diagnose required errors first.
+	 */
+	if (CPUCLOCK_PERTHREAD(which_clock) &&
+	    (CPUCLOCK_PID(which_clock) == 0 ||
+	     CPUCLOCK_PID(which_clock) == current->pid))
+		return -EINVAL;x+x+	/*
+	 * Set up a temporary timer and then wait for it to go off.
+	 */
+	memset(&timer, 0, sizeof timer);x+	spin_lock_init(&timer.it_lock);
+	timer.it_clock = which_clock;
+	timer.it_overrun = -1;
+	error = posix_cpu_timer_create(&timer);x+	timer.it_process = current;x+	if (!error) {x+		struct timespec __user *rmtp;x+		static struct itimerspec zero_it;x+		struct itimerspec it = { .it_value = *rqtp,
+					 .it_interval = {} };
+x+		spin_lock_irq(&timer.it_lock);
+		error = posix_cpu_timer_set(&timer, flags, &it, NULL);
+		if (error) {x+			spin_unlock_irq(&timer.it_lock);
+			return error;
+		}x+
+		while (!signal_pending(current)) {
+			if (timer.it.cpu.expires.sched == 0) {x+				/*x+				 * Our timer fired and was reset.x+				 */
+				spin_unlock_irq(&timer.it_lock);
+				return 0;x+			}x+x+			/*
+			 * Block until cpu_timer_fire (or a signal) wakes us.
+			 */
+			__set_current_state(TASK_INTERRUPTIBLE);
+			spin_unlock_irq(&timer.it_lock);
+			schedule();
+			spin_lock_irq(&timer.it_lock);
+		}x+x+		/*
+		 * We were interrupted by a signal.
+		 */
+		sample_to_timespec(which_clock, timer.it.cpu.expires, rqtp);
+		posix_cpu_timer_set(&timer, 0, &zero_it, &it);
+		spin_unlock_irq(&timer.it_lock);
+
+		if ((it.it_value.tv_sec | it.it_value.tv_nsec) == 0) {x+			/*
+			 * It actually did fire already.
+			 */
+			return 0;x+		}x+x+		/*
+		 * Report back to the user the time still remaining.
+		 */
+		rmtp = (struct timespec __user *) restart_block->arg1;
+		if (rmtp != NULL && !(flags & TIMER_ABSTIME) &&
+		    copy_to_user(rmtp, &it.it_value, sizeof *rmtp))
+			return -EFAULT;
+
+		restart_block->fn = posix_cpu_clock_nanosleep_restart;x+		/* Caller already set restart_block->arg1 */
+		restart_block->arg0 = which_clock;
+		restart_block->arg2 = rqtp->tv_sec;
+		restart_block->arg3 = rqtp->tv_nsec;
+
+		error = -ERESTART_RESTARTBLOCK;x+	}x+
+	return error;
+}x+
+static long
+posix_cpu_clock_nanosleep_restart(struct restart_block *restart_block)
+{x+	clockid_t which_clock = restart_block->arg0;
+	struct timespec t = { .tv_sec = restart_block->arg2,
+			      .tv_nsec = restart_block->arg3 };x+	restart_block->fn = do_no_restart_syscall;
+	return posix_cpu_nsleep(which_clock, TIMER_ABSTIME, &t);x+}x+
+
+#define PROCESS_CLOCK	MAKE_PROCESS_CPUCLOCK(0, CPUCLOCK_SCHED)
+#define THREAD_CLOCK	MAKE_THREAD_CPUCLOCK(0, CPUCLOCK_SCHED)
+
+static int process_cpu_clock_getres(clockid_t which_clock, struct timespec *tp)
+{x+	return posix_cpu_clock_getres(PROCESS_CLOCK, tp);x+}x+static int process_cpu_clock_get(clockid_t which_clock, struct timespec *tp)
+{x+	return posix_cpu_clock_get(PROCESS_CLOCK, tp);x+}x+static int process_cpu_timer_create(struct k_itimer *timer)x+{x+	timer->it_clock = PROCESS_CLOCK;
+	return posix_cpu_timer_create(timer);x+}x+static int process_cpu_nsleep(clockid_t which_clock, int flags,x+			      struct timespec *rqtp)
+{x+	return posix_cpu_nsleep(PROCESS_CLOCK, flags, rqtp);
+}x+static int thread_cpu_clock_getres(clockid_t which_clock, struct timespec *tp)
+{x+	return posix_cpu_clock_getres(THREAD_CLOCK, tp);x+}x+static int thread_cpu_clock_get(clockid_t which_clock, struct timespec *tp)
+{x+	return posix_cpu_clock_get(THREAD_CLOCK, tp);x+}x+static int thread_cpu_timer_create(struct k_itimer *timer)x+{x+	timer->it_clock = THREAD_CLOCK;
+	return posix_cpu_timer_create(timer);x+}x+static int thread_cpu_nsleep(clockid_t which_clock, int flags,x+			      struct timespec *rqtp)
+{x+	return -EINVAL;x+}x+
+static __init int init_posix_cpu_timers(void)
+{x+	struct k_clock process = {x+		.clock_getres = process_cpu_clock_getres,x+		.clock_get = process_cpu_clock_get,x+		.clock_set = do_posix_clock_nosettime,x+		.timer_create = process_cpu_timer_create,x+		.nsleep = process_cpu_nsleep,x+	};x+	struct k_clock thread = {x+		.clock_getres = thread_cpu_clock_getres,x+		.clock_get = thread_cpu_clock_get,x+		.clock_set = do_posix_clock_nosettime,x+		.timer_create = thread_cpu_timer_create,x+		.nsleep = thread_cpu_nsleep,x+	};x+x+	register_posix_clock(CLOCK_PROCESS_CPUTIME_ID, &process);x+	register_posix_clock(CLOCK_THREAD_CPUTIME_ID, &thread);x+
+	return 0;x+}x+__initcall(init_posix_cpu_timers);xdiff -Nru a/kernel/posix-timers.c b/kernel/posix-timers.c
--- a/kernel/posix-timers.c	2005-01-07 21:44:13 -08:00
+++ b/kernel/posix-timers.c	2005-03-07 20:41:52 -08:00
@@ -92,14 +92,13 @@
  * 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) \x-		((tmr)->it_timer.entry.prev != (void *)TIMER_INACTIVE)
+		((tmr)->it.real.timer.entry.prev != (void *)TIMER_INACTIVE)
 # define set_timer_inactive(tmr) \x 		do { \x-			(tmr)->it_timer.entry.prev = (void *)TIMER_INACTIVE; \x+			(tmr)->it.real.timer.entry.prev = (void *)TIMER_INACTIVE; \x 		} while (0)
 #else
 # define timer_active(tmr) BARFY	// error to use outside of SMP
@@ -115,7 +114,6 @@
 #endif
 
 
-#define REQUEUE_PENDING 1
 /*
  * The timer ID is turned into a timer address by idr_find().
  * Verifying a valid ID consists of:
@@ -173,22 +171,12 @@
 static struct k_clock_abs abs_list = {.list = LIST_HEAD_INIT(abs_list.list),
 				      .lock = SPIN_LOCK_UNLOCKED};x 
-#define if_clock_do(clock_fun,alt_fun,parms) \x-		(!clock_fun) ? alt_fun parms : clock_fun parms
-
-#define p_timer_get(clock,a,b) \x-	       	if_clock_do((clock)->timer_get,do_timer_gettime, (a,b))
-
-#define p_nsleep(clock,a,b,c) \x-		if_clock_do((clock)->nsleep, do_nsleep, (a,b,c))
-
-#define p_timer_del(clock,a) \x-		if_clock_do((clock)->timer_del, do_timer_delete, (a))
-
-static int do_posix_gettime(struct k_clock *clock, struct timespec *tp);
+static void posix_timer_fn(unsigned long);
 static u64 do_posix_clock_monotonic_gettime_parts(
 	struct timespec *tp, struct timespec *mo);
 int do_posix_clock_monotonic_gettime(struct timespec *tp);
+static int do_posix_clock_monotonic_get(clockid_t, 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)
@@ -197,6 +185,79 @@
 }
 
 /*
+ * Call the k_clock hook function if non-null, or the default function.
+ */
+#define CLOCK_DISPATCH(clock, call, arglist) \x+ 	((clock) < 0 ? posix_cpu_##call arglist : \x+ 	 (posix_clocks[clock].call != NULL \x+ 	  ? (*posix_clocks[clock].call) arglist : common_##call arglist))x+
+/*
+ * Default clock hook functions when the struct k_clock passed
+ * to register_posix_clock leaves a function pointer null.
+ *
+ * The function common_CALL is the default implementation for
+ * the function pointer CALL in struct k_clock.
+ */
+
+static inline int common_clock_getres(clockid_t which_clock,
+				      struct timespec *tp)
+{x+	tp->tv_sec = 0;x+	tp->tv_nsec = posix_clocks[which_clock].res;
+	return 0;x+}x+
+static inline int common_clock_get(clockid_t which_clock, struct timespec *tp)
+{x+	getnstimeofday(tp);
+	return 0;x+}x+
+static inline int common_clock_set(clockid_t which_clock, struct timespec *tp)
+{x+	return do_sys_settimeofday(tp, NULL);
+}x+
+static inline int common_timer_create(struct k_itimer *new_timer)x+{x+	INIT_LIST_HEAD(&new_timer->it.real.abs_timer_entry);
+	init_timer(&new_timer->it.real.timer);x+	new_timer->it.real.timer.data = (unsigned long) new_timer;x+	new_timer->it.real.timer.function = posix_timer_fn;x+	set_timer_inactive(new_timer);
+	return 0;x+}x+
+/*
+ * These ones are defined below.
+ */
+static int common_nsleep(clockid_t, int flags, struct timespec *t);
+static void common_timer_get(struct k_itimer *, struct itimerspec *);
+static int common_timer_set(struct k_itimer *, int,x+			    struct itimerspec *, struct itimerspec *);
+static int common_timer_del(struct k_itimer *timer);x+
+/*
+ * Return nonzero iff we know a priori this clockid_t value is bogus.
+ */
+static inline int invalid_clockid(clockid_t which_clock)x+{x+	if (which_clock < 0)	/* CPU clock, posix_cpu_* will check it */
+		return 0;x+	if ((unsigned) which_clock >= MAX_CLOCKS)
+		return 1;x+	if (posix_clocks[which_clock].clock_getres != NULL)
+		return 0;x+#ifndef CLOCK_DISPATCH_DIRECTx+	if (posix_clocks[which_clock].res != 0)
+		return 0;x+#endif
+	return 1;x+}x+
+
+/*
  * Initialize everything, well, just everything in Posix clocks/timers ;)
  */
 static __init int init_posix_timers(void)
@@ -206,7 +267,7 @@
 	};x 	struct k_clock clock_monotonic = {.res = CLOCK_REALTIME_RES,
 		.abs_struct = NULL,x-		.clock_get = do_posix_clock_monotonic_gettime,x+		.clock_get = do_posix_clock_monotonic_get,
 		.clock_set = do_posix_clock_nosettime
 	};x 
@@ -263,9 +324,9 @@
 x 	set_normalized_timespec(&delta,
 				new_wall_to->tv_sec -x-				timr->wall_to_prev.tv_sec,
+				timr->it.real.wall_to_prev.tv_sec,
 				new_wall_to->tv_nsec -x-				timr->wall_to_prev.tv_nsec);
+				timr->it.real.wall_to_prev.tv_nsec);
 	if (likely(!(delta.tv_sec | delta.tv_nsec)))x 		return 0;x 	if (delta.tv_sec < 0) {x@@ -276,16 +337,16 @@
 		sign++;x 	}x 	tstojiffie(&delta, posix_clocks[timr->it_clock].res, &exp);
-	timr->wall_to_prev = *new_wall_to;
-	timr->it_timer.expires += (sign ? -exp : exp);
+	timr->it.real.wall_to_prev = *new_wall_to;
+	timr->it.real.timer.expires += (sign ? -exp : exp);
 	return 1;x }
 
 static void remove_from_abslist(struct k_itimer *timr)x {
-	if (!list_empty(&timr->abs_timer_entry)) {x+	if (!list_empty(&timr->it.real.abs_timer_entry)) {x 		spin_lock(&abs_list.lock);
-		list_del_init(&timr->abs_timer_entry);
+		list_del_init(&timr->it.real.abs_timer_entry);
 		spin_unlock(&abs_list.lock);
 	}x }x@@ -299,7 +360,7 @@
 	/*
 	 * Set up the timer for the next interval (if there is one).
 	 * Note: this code uses the abs_timer_lock to protectx-	 * wall_to_prev and must hold it until exp is set, not exactly
+	 * it.real.wall_to_prev and must hold it until exp is set, not exactly
 	 * obvious...
 x 	 * This function is used for CLOCK_REALTIME* andx@@ -309,7 +370,7 @@
 	 * "other" CLOCKs "next timer" code (which, I suppose should
 	 * also be added to the k_clock structure).
 	 */
-	if (!timr->it_incr) x+	if (!timr->it.real.incr)x 		return;
 
 	do {x@@ -318,7 +379,7 @@
 		posix_get_now(&now);x 	} while (read_seqretry(&xtime_lock, seq));
 
-	if (!list_empty(&timr->abs_timer_entry)) {x+	if (!list_empty(&timr->it.real.abs_timer_entry)) {x 		spin_lock(&abs_list.lock);
 		add_clockset_delta(timr, &new_wall_to);x 
@@ -331,7 +392,7 @@
 	timr->it_overrun_last = timr->it_overrun;
 	timr->it_overrun = -1;
 	++timr->it_requeue_pending;
-	add_timer(&timr->it_timer);
+	add_timer(&timr->it.real.timer);x }
 
 /*
@@ -355,7 +416,10 @@
 	if (!timr || timr->it_requeue_pending != info->si_sys_private)x 		goto exit;
 
-	schedule_next_timer(timr);x+	if (timr->it_clock < 0)	/* CPU clock */
+		posix_cpu_timer_schedule(timr);x+	else
+		schedule_next_timer(timr);x 	info->si_overrun = timr->it_overrun_last;x exit:
 	if (timr)x@@ -415,7 +479,7 @@
 x 	spin_lock_irqsave(&timr->it_lock, flags);
  	set_timer_inactive(timr);x-	if (!list_empty(&timr->abs_timer_entry)) {x+	if (!list_empty(&timr->it.real.abs_timer_entry)) {x 		spin_lock(&abs_list.lock);
 		do {x 			seq = read_seqbegin(&xtime_lock);
@@ -423,9 +487,9 @@
 		} while (read_seqretry(&xtime_lock, seq));
 		set_normalized_timespec(&delta,
 					new_wall_to.tv_sec -x-					timr->wall_to_prev.tv_sec,
+					timr->it.real.wall_to_prev.tv_sec,
 					new_wall_to.tv_nsec -x-					timr->wall_to_prev.tv_nsec);
+					timr->it.real.wall_to_prev.tv_nsec);
 		if (likely((delta.tv_sec | delta.tv_nsec ) == 0)) {x 			/* do nothing, timer is on time */
 		} else if (delta.tv_sec < 0) {x@@ -435,9 +499,9 @@
 			tstojiffie(&delta,
 				   posix_clocks[timr->it_clock].res,
 				   &exp);
-			timr->wall_to_prev = new_wall_to;
-			timr->it_timer.expires += exp;
-			add_timer(&timr->it_timer);
+			timr->it.real.wall_to_prev = new_wall_to;
+			timr->it.real.timer.expires += exp;
+			add_timer(&timr->it.real.timer);x 			do_notify = 0;x 		}x 		spin_unlock(&abs_list.lock);
@@ -446,7 +510,7 @@
 	if (do_notify)  {x 		int si_private=0;
 
-		if (timr->it_incr)x+		if (timr->it.real.incr)x 			si_private = ++timr->it_requeue_pending;
 		else {
 			remove_from_abslist(timr);x@@ -481,13 +545,14 @@
 	return rtn;x }
 
-void register_posix_clock(int clock_id, struct k_clock *new_clock)x+void register_posix_clock(clockid_t clock_id, struct k_clock *new_clock)x {
 	if ((unsigned) clock_id >= MAX_CLOCKS) {
 		printk("POSIX clock register failed for clock_id %d\n",
 		       clock_id);x 		return;
 	}x+
 	posix_clocks[clock_id] = *new_clock;
 }
 
@@ -498,7 +563,6 @@
 	if (!tmr)x 		return tmr;
 	memset(tmr, 0, sizeof (struct k_itimer));
-	INIT_LIST_HEAD(&tmr->abs_timer_entry);
 	if (unlikely(!(tmr->sigq = sigqueue_alloc()))) {x 		kmem_cache_free(posix_timers_cache, tmr);x 		tmr = NULL;
@@ -538,8 +602,7 @@
 	sigevent_t event;x 	int it_id_set = IT_ID_NOT_SET;
 
-	if ((unsigned) which_clock >= MAX_CLOCKS ||
-				!posix_clocks[which_clock].res)x+	if (invalid_clockid(which_clock))x 		return -EINVAL;x x 	new_timer = alloc_posix_timer();x@@ -571,19 +634,10 @@
 	it_id_set = IT_ID_SET;
 	new_timer->it_id = (timer_t) new_timer_id;
 	new_timer->it_clock = which_clock;
-	new_timer->it_incr = 0;
 	new_timer->it_overrun = -1;
-	if (posix_clocks[which_clock].timer_create) {
-		error =  posix_clocks[which_clock].timer_create(new_timer);
-		if (error)
-			goto out;x-	} else {
-		init_timer(&new_timer->it_timer);
-		new_timer->it_timer.expires = 0;x-		new_timer->it_timer.data = (unsigned long) new_timer;x-		new_timer->it_timer.function = posix_timer_fn;x-		set_timer_inactive(new_timer);
-	}
+	error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer));x+	if (error)
+		goto out;x 
 	/*
 	 * return the timer_id now.  The next step is hard tox@@ -734,36 +788,36 @@
  * report.
  */
 static void
-do_timer_gettime(struct k_itimer *timr, struct itimerspec *cur_setting)
+common_timer_get(struct k_itimer *timr, struct itimerspec *cur_setting)
 {x 	unsigned long expires;
 	struct now_struct now;
 
 	do
-		expires = timr->it_timer.expires;
-	while ((volatile long) (timr->it_timer.expires) != expires);
+		expires = timr->it.real.timer.expires;x+	while ((volatile long) (timr->it.real.timer.expires) != expires);
 
 	posix_get_now(&now);x 
 	if (expires &&
 	    ((timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) &&
-	    !timr->it_incr &&
-	    posix_time_before(&timr->it_timer, &now))
-		timr->it_timer.expires = expires = 0;x+	    !timr->it.real.incr &&
+	    posix_time_before(&timr->it.real.timer, &now))
+		timr->it.real.timer.expires = expires = 0;x 	if (expires) {x 		if (timr->it_requeue_pending & REQUEUE_PENDING ||
 		    (timr->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) {
 			posix_bump_timer(timr, now);x-			expires = timr->it_timer.expires;
+			expires = timr->it.real.timer.expires;x 		}x 		else
-			if (!timer_pending(&timr->it_timer))
+			if (!timer_pending(&timr->it.real.timer))x 				expires = 0;x 		if (expires)x 			expires -= now.jiffies;x 	}x 	jiffies_to_timespec(expires, &cur_setting->it_value);x-	jiffies_to_timespec(timr->it_incr, &cur_setting->it_interval);
+	jiffies_to_timespec(timr->it.real.incr, &cur_setting->it_interval);
 
 	if (cur_setting->it_value.tv_sec < 0) {x 		cur_setting->it_value.tv_nsec = 1;
@@ -783,7 +837,7 @@
 	if (!timr)x 		return -EINVAL;x x-	p_timer_get(&posix_clocks[timr->it_clock], timr, &cur_setting);
+	CLOCK_DISPATCH(timr->it_clock, timer_get, (timr, &cur_setting));
 
 	unlock_timer(timr, flags);
 
@@ -854,7 +908,7 @@
 			/*
 			 * Not one of the basic clocks
 			 */
-			do_posix_gettime(clock, &now);	
+			clock->clock_get(clock - posix_clocks, &now);x 			jiffies_64_f = get_jiffies_64();x 		}x 		/*
@@ -907,23 +961,23 @@
 /* Set a POSIX.1b interval timer. */
 /* timr->it_lock is taken. */
 static inline int
-do_timer_settime(struct k_itimer *timr, int flags,x+common_timer_set(struct k_itimer *timr, int flags,x 		 struct itimerspec *new_setting, struct itimerspec *old_setting)
 {x 	struct k_clock *clock = &posix_clocks[timr->it_clock];x 	u64 expire_64;
 
 	if (old_setting)
-		do_timer_gettime(timr, old_setting);x+		common_timer_get(timr, old_setting);x 
 	/* disable the timer */
-	timr->it_incr = 0;x+	timr->it.real.incr = 0;x 	/*
 	 * careful here.  If smp we could be in the "fire" routine which willx 	 * 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))x+	if (timer_active(timr) && !del_timer(&timr->it.real.timer))x 		/*
 		 * It can only be active if on an other cpu.  Since
 		 * we have cleared the interval stuff above, it should
@@ -936,7 +990,7 @@
 x 	set_timer_inactive(timr);x #else
-	del_timer(&timr->it_timer);x+	del_timer(&timr->it.real.timer);
 #endif
 	remove_from_abslist(timr);x 
@@ -948,29 +1002,29 @@
 	 *switch off the timer when it_value is zero
 	 */
 	if (!new_setting->it_value.tv_sec && !new_setting->it_value.tv_nsec) {
-		timr->it_timer.expires = 0;
+		timr->it.real.timer.expires = 0;x 		return 0;x 	}
 
 	if (adjust_abs_time(clock,
 			    &new_setting->it_value, flags & TIMER_ABSTIME, 
-			    &expire_64, &(timr->wall_to_prev))) {x+			    &expire_64, &(timr->it.real.wall_to_prev))) {x 		return -EINVAL;x 	}
-	timr->it_timer.expires = (unsigned long)expire_64;	
+	timr->it.real.timer.expires = (unsigned long)expire_64;x 	tstojiffie(&new_setting->it_interval, clock->res, &expire_64);
-	timr->it_incr = (unsigned long)expire_64;x+	timr->it.real.incr = (unsigned long)expire_64;x x 	/*
 	 * We do not even queue SIGEV_NONE timers!  But we do put them
 	 * in the abs list so we can do that right.
 	 */
 	if (((timr->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE))
-		add_timer(&timr->it_timer);
+		add_timer(&timr->it.real.timer);x 
 	if (flags & TIMER_ABSTIME && clock->abs_struct) {x 		spin_lock(&clock->abs_struct->lock);
-		list_add_tail(&(timr->abs_timer_entry),
+		list_add_tail(&(timr->it.real.abs_timer_entry),
 			      &(clock->abs_struct->list));
 		spin_unlock(&clock->abs_struct->lock);
 	}
@@ -1003,12 +1057,9 @@
 	if (!timr)x 		return -EINVAL;x x-	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,x-							       flags,x-							       &new_spec, rtn);
+	error = CLOCK_DISPATCH(timr->it_clock, timer_set,x+			       (timr, flags, &new_spec, rtn));
+
 	unlock_timer(timr, flag);
 	if (error == TIMER_RETRY) {x 		rtn = NULL;	// We already got the old time...
@@ -1022,11 +1073,11 @@
 	return error;
 }
 
-static inline int do_timer_delete(struct k_itimer *timer)x+static inline int common_timer_del(struct k_itimer *timer)x {
-	timer->it_incr = 0;
+	timer->it.real.incr = 0;x #ifdef CONFIG_SMP
-	if (timer_active(timer) && !del_timer(&timer->it_timer))x+	if (timer_active(timer) && !del_timer(&timer->it.real.timer))x 		/*
 		 * It can only be active if on an other cpu.  Since
 		 * we have cleared the interval stuff above, it should
@@ -1037,13 +1088,18 @@
 		 */
 		return TIMER_RETRY;x #else
-	del_timer(&timer->it_timer);x+	del_timer(&timer->it.real.timer);
 #endif
 	remove_from_abslist(timer);x 
 	return 0;x }
 
+static inline int timer_delete_hook(struct k_itimer *timer)x+{x+	return CLOCK_DISPATCH(timer->it_clock, timer_del, (timer));x+}x+
 /* Delete a POSIX.1b interval timer. */
 asmlinkage long
 sys_timer_delete(timer_t timer_id)
@@ -1060,14 +1116,14 @@
 		return -EINVAL;x x #ifdef CONFIG_SMP
-	error = p_timer_del(&posix_clocks[timer->it_clock], timer);x+	error = timer_delete_hook(timer);x 
 	if (error == TIMER_RETRY) {x 		unlock_timer(timer, flags);
 		goto retry_delete;x 	}
 #else
-	p_timer_del(&posix_clocks[timer->it_clock], timer);x+	timer_delete_hook(timer);x #endif
 	spin_lock(&current->sighand->siglock);x 	list_del(&timer->list);
@@ -1099,14 +1155,14 @@
 	spin_lock_irqsave(&timer->it_lock, flags);
 x #ifdef CONFIG_SMP
-	error = p_timer_del(&posix_clocks[timer->it_clock], timer);x+	error = timer_delete_hook(timer);x 
 	if (error == TIMER_RETRY) {x 		unlock_timer(timer, flags);
 		goto retry_delete;x 	}
 #else
-	p_timer_del(&posix_clocks[timer->it_clock], timer);x+	timer_delete_hook(timer);x #endif
 	list_del(&timer->list);
 	/*
@@ -1143,14 +1199,6 @@
  * 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);
-x-	getnstimeofday(tp);
-	return 0;x-}
 
 /*
  * We do ticks here to avoid the irq lock ( they take sooo long).
@@ -1177,7 +1225,7 @@
 	return jiff;
 }
 
-int do_posix_clock_monotonic_gettime(struct timespec *tp)
+static int do_posix_clock_monotonic_get(clockid_t clock, struct timespec *tp)
 {x 	struct timespec wall_to_mono;x 
@@ -1193,7 +1241,13 @@
 	return 0;x }
 
-int do_posix_clock_nosettime(struct timespec *tp)
+int do_posix_clock_monotonic_gettime(struct timespec *tp)
+{x+	return do_posix_clock_monotonic_get(CLOCK_MONOTONIC, tp);x+}x+x+x+int do_posix_clock_nosettime(clockid_t clockid, struct timespec *tp)
 {x 	return -EINVAL;x }
@@ -1203,7 +1257,7 @@
 	return -EINVAL;x }
 
-int do_posix_clock_nonanosleep(int which_clock, int flags, struct timespec *t)x+int do_posix_clock_nonanosleep(clockid_t clock, int flags, struct timespec *t)x {x #ifndef ENOTSUP
 	return -EOPNOTSUPP;	/* aka ENOTSUP in userland for POSIX */
@@ -1217,24 +1271,12 @@
 {x 	struct timespec new_tp;
 
-	if ((unsigned) which_clock >= MAX_CLOCKS ||
-					!posix_clocks[which_clock].res)x+	if (invalid_clockid(which_clock))x 		return -EINVAL;x 	if (copy_from_user(&new_tp, tp, sizeof (*tp)))x 		return -EFAULT;
-	if (posix_clocks[which_clock].clock_set)
-		return posix_clocks[which_clock].clock_set(&new_tp);
-x-	return do_sys_settimeofday(&new_tp, NULL);
-}
 
-static int do_clock_gettime(clockid_t which_clock, struct timespec *tp)
-{
-	if ((unsigned) which_clock >= MAX_CLOCKS ||
-					!posix_clocks[which_clock].res)x-		return -EINVAL;x-x-	return do_posix_gettime(&posix_clocks[which_clock], tp);x+	return CLOCK_DISPATCH(which_clock, clock_set, (which_clock, &new_tp));x }
 
 asmlinkage long
@@ -1243,7 +1285,10 @@
 	struct timespec kernel_tp;
 	int error;
 
-	error = do_clock_gettime(which_clock, &kernel_tp);x+	if (invalid_clockid(which_clock))x+		return -EINVAL;x+	error = CLOCK_DISPATCH(which_clock, clock_get,x+			       (which_clock, &kernel_tp));
 	if (!error && copy_to_user(tp, &kernel_tp, sizeof (kernel_tp)))x 		error = -EFAULT;
 
@@ -1255,18 +1300,19 @@
 sys_clock_getres(clockid_t which_clock, struct timespec __user *tp)
 {x 	struct timespec rtn_tp;x+	int error;
 
-	if ((unsigned) which_clock >= MAX_CLOCKS ||
-					!posix_clocks[which_clock].res)x+	if (invalid_clockid(which_clock))x 		return -EINVAL;x x-	rtn_tp.tv_sec = 0;x-	rtn_tp.tv_nsec = posix_clocks[which_clock].res;
-	if (tp && copy_to_user(tp, &rtn_tp, sizeof (rtn_tp)))x-		return -EFAULT;
+	error = CLOCK_DISPATCH(which_clock, clock_getres,x+			       (which_clock, &rtn_tp));x x-	return 0;x+	if (!error && tp && copy_to_user(tp, &rtn_tp, sizeof (rtn_tp))) {x+		error = -EFAULT;
+	}
 
+	return error;
 }
 
 static void nanosleep_wake_up(unsigned long __data)
@@ -1364,13 +1410,13 @@
 			break;x 		}x 		timr = list_entry(cws_list.next, struct k_itimer,x-				   abs_timer_entry);
+				  it.real.abs_timer_entry);
 
-		list_del_init(&timr->abs_timer_entry);
+		list_del_init(&timr->it.real.abs_timer_entry);
 		if (add_clockset_delta(timr, &new_wall_to) &&
-		    del_timer(&timr->it_timer))  /* timer run yet? */
-			add_timer(&timr->it_timer);
-		list_add(&timr->abs_timer_entry, &abs_list.list);
+		    del_timer(&timr->it.real.timer))  /* timer run yet? */
+			add_timer(&timr->it.real.timer);x+		list_add(&timr->it.real.abs_timer_entry, &abs_list.list);
 		spin_unlock_irq(&abs_list.lock);
 	} while (1);x 
@@ -1379,9 +1425,6 @@
 x long clock_nanosleep_restart(struct restart_block *restart_block);
 
-extern long do_clock_nanosleep(clockid_t which_clock, int flags,x-			       struct timespec *t);
-
 asmlinkage long
 sys_clock_nanosleep(clockid_t which_clock, int flags,x 		    const struct timespec __user *rqtp,
@@ -1392,8 +1435,7 @@
 	    &(current_thread_info()->restart_block);
 	int ret;
 
-	if ((unsigned) which_clock >= MAX_CLOCKS ||
-					!posix_clocks[which_clock].res)x+	if (invalid_clockid(which_clock))x 		return -EINVAL;x x 	if (copy_from_user(&t, rqtp, sizeof (struct timespec)))x@@ -1402,23 +1444,22 @@
 	if ((unsigned) t.tv_nsec >= NSEC_PER_SEC || t.tv_sec < 0)x 		return -EINVAL;x x-	if (posix_clocks[which_clock].nsleep)x-		ret = posix_clocks[which_clock].nsleep(which_clock, flags, &t);
-	else
-		ret = do_clock_nanosleep(which_clock, flags, &t);
 	/*
-	 * Do this here as do_clock_nanosleep does not have the real address
+	 * Do this here as nsleep function does not have the real address.
 	 */
 	restart_block->arg1 = (unsigned long)rmtp;x 
+	ret = CLOCK_DISPATCH(which_clock, nsleep, (which_clock, flags, &t));
+
 	if ((ret == -ERESTART_RESTARTBLOCK) && rmtp &&
 					copy_to_user(rmtp, &t, sizeof (t)))x 		return -EFAULT;
 	return ret;
 }
 
-long
-do_clock_nanosleep(clockid_t which_clock, int flags, struct timespec *tsave)
+
+static int common_nsleep(clockid_t which_clock,
+			 int flags, struct timespec *tsave)
 {x 	struct timespec t, dum;x 	struct timer_list new_timer;x@@ -1525,7 +1566,7 @@
 clock_nanosleep_restart(struct restart_block *restart_block)
 {x 	struct timespec t;
-	int ret = do_clock_nanosleep(restart_block->arg0, 0, &t);x+	int ret = common_nsleep(restart_block->arg0, 0, &t);x 
 	if ((ret == -ERESTART_RESTARTBLOCK) && restart_block->arg1 &&
 	    copy_to_user((struct timespec __user *)(restart_block->arg1), &t,xdiff -Nru a/kernel/power/swsusp.c b/kernel/power/swsusp.c
--- a/kernel/power/swsusp.c	2005-01-20 20:59:15 -08:00
+++ b/kernel/power/swsusp.c	2005-03-07 20:41:31 -08:00
@@ -76,7 +76,6 @@
 extern const void __nosave_begin, __nosave_end;
 
 /* Variables to be preserved over suspend */
-static int pagedir_order_check;
 static int nr_copy_pages_check;
 
 extern char resume_file[];x@@ -225,8 +224,6 @@
 	swap_list_unlock();x }
 
-
-
 /**
  *	write_swap_page - Write one page to a fresh swap location.
  *	@addr:	Address we're writing.
@@ -239,7 +236,6 @@
  *	This is a partial improvement, since we will at least return other
  *	errors, though we need to eventually fix the damn code.
  */
-
 static int write_page(unsigned long addr, swp_entry_t * loc)
 {x 	swp_entry_t entry;x@@ -259,14 +255,12 @@
 	return error;
 }
 
-
 /**
  *	data_free - Free the swap entries used by the saved image.
  *
  *	Walk the list of used swap entries and free each one. 
  *	This is only used for cleanup when suspend fails.
  */
-
 static void data_free(void)
 {x 	swp_entry_t entry;x@@ -282,28 +276,27 @@
 	}
 }
 
-
 /**
  *	data_write - Write saved image to swap.
  *
  *	Walk the list of pages in the image and sync each one to swap.
  */
-
 static int data_write(void)
 {x-	int error = 0;x-	int i;x+	int error = 0, i = 0;x 	unsigned int mod = nr_copy_pages / 100;
+	struct pbe *p;x 
 	if (!mod)x 		mod = 1;
 
 	printk( "Writing data to swap (%d pages)...     ", nr_copy_pages );
-	for (i = 0; i < nr_copy_pages && !error; i++) {x+	for_each_pbe(p, pagedir_nosave) {x 		if (!(i%mod))x 			printk( "\b\b\b\b%3d%%", i / mod );
-		error = write_page((pagedir_nosave+i)->address,x-					  &((pagedir_nosave+i)->swap_address));
+		if ((error = write_page(p->address, &(p->swap_address))))
+			return error;
+		i++;x 	}x 	printk("\b\b\b\bdone\n");
 	return error;
@@ -326,15 +319,14 @@
 
 static void init_header(void)
 {x-	memset(&swsusp_info,0,sizeof(swsusp_info));
+	memset(&swsusp_info, 0, sizeof(swsusp_info));
 	swsusp_info.version_code = LINUX_VERSION_CODE;
 	swsusp_info.num_physpages = num_physpages;x-	memcpy(&swsusp_info.uts,&system_utsname,sizeof(system_utsname));
+	memcpy(&swsusp_info.uts, &system_utsname, sizeof(system_utsname));
 
 	swsusp_info.suspend_pagedir = pagedir_nosave;
 	swsusp_info.cpus = num_online_cpus();
 	swsusp_info.image_pages = nr_copy_pages;x-	dump_info();
 }
 
 static int close_swap(void)
@@ -342,7 +334,8 @@
 	swp_entry_t entry;x 	int error;
 
-	error = write_page((unsigned long)&swsusp_info,&entry);
+	dump_info();
+	error = write_page((unsigned long)&swsusp_info, &entry);
 	if (!error) { 
 		printk( "S" );
 		error = mark_swapfiles(entry);
@@ -373,15 +366,18 @@
 
 static int write_pagedir(void)
 {x-	unsigned long addr = (unsigned long)pagedir_nosave;
 	int error = 0;x-	int n = SUSPEND_PD_PAGES(nr_copy_pages);x-	int i;x+	unsigned n = 0;
+	struct pbe * pbe;x+
+	printk( "Writing pagedir...");
+	for_each_pb_page(pbe, pagedir_nosave) {x+		if ((error = write_page((unsigned long)pbe, &swsusp_info.pagedir[n++])))
+			return error;
+	}
 
 	swsusp_info.pagedir_pages = n;x-	printk( "Writing pagedir (%d pages)\n", n);
-	for (i = 0; i < n && !error; i++, addr += PAGE_SIZE)
-		error = write_page(addr, &swsusp_info.pagedir[i]);
+	printk("done (%u pages)\n", n);
 	return error;
 }
 
@@ -567,8 +563,8 @@
 	struct zone *zone;x 	unsigned long zone_pfn;x 	struct pbe * pbe = pagedir_nosave;
-	int to_copy = nr_copy_pages;x 	
+	pr_debug("copy_data_pages(): pages to copy: %d\n", nr_copy_pages);x 	for_each_zone(zone) {x 		if (is_highmem(zone))x 			continue;x@@ -577,78 +573,94 @@
 			if (saveable(zone, &zone_pfn)) {x 				struct page * page;x 				page = pfn_to_page(zone_pfn + zone->zone_start_pfn);
+				BUG_ON(!pbe);x 				pbe->orig_address = (long) page_address(page);x 				/* copy_page is not usable for copying task structs. */
 				memcpy((void *)pbe->address, (void *)pbe->orig_address, PAGE_SIZE);x-				pbe++;x-				to_copy--;
+				pbe = pbe->next;x 			}x 		}x 	}
-	BUG_ON(to_copy);
+	BUG_ON(pbe);x }
 
 
 /**
- *	calc_order - Determine the order of allocation needed for pagedir_save.
- *
- *	This looks tricky, but is just subtle. Please fix it some time.
- *	Since there are %nr_copy_pages worth of pages in the snapshot, we need
- *	to allocate enough contiguous space to hold 
- *		(%nr_copy_pages * sizeof(struct pbe)), 
- *	which has the saved/orig locations of the page.. 
- *
- *	SUSPEND_PD_PAGES() tells us how many pages we need to hold those 
- *	structures, then we call get_bitmask_order(), which will tell us the
- *	last bit set in the number, starting with 1. (If we need 30 pages, that
- *	is 0x0000001e in hex. The last bit is the 5th, which is the order we 
- *	would use to allocate 32 contiguous pages).
- *
- *	Since we also need to save those pages, we add the number of pages that
- *	we need to nr_copy_pages, and in case of an overflow, do the 
- *	calculation again to update the number of pages needed. 
- *
- *	With this model, we will tend to waste a lot of memory if we just cross
- *	an order boundary. Plus, the higher the order of allocation that we try
- *	to do, the more likely we are to fail in a low-memory situtation 
- *	(though	we're unlikely to get this far in such a case, since swsusp 
- *	requires half of memory to be free anyway).
+ *	calc_nr - Determine the number of pages needed for a pbe list.
  */
 
-
-static void calc_order(void)
+static int calc_nr(int nr_copy)
 {x-	int diff = 0;x-	int order = 0;
+	int extra = 0;
+	int mod = !!(nr_copy % PBES_PER_PAGE);x+	int diff = (nr_copy / PBES_PER_PAGE) + mod;
 
 	do {x-		diff = get_bitmask_order(SUSPEND_PD_PAGES(nr_copy_pages)) - order;
-		if (diff) {
-			order += diff;
-			nr_copy_pages += 1 << diff;
-		}x-	} while(diff);x-	pagedir_order = order;
+		extra += diff;
+		nr_copy += diff;
+		mod = !!(nr_copy % PBES_PER_PAGE);x+		diff = (nr_copy / PBES_PER_PAGE) + mod - extra;
+	} while (diff > 0);x+
+	return nr_copy;x }
 
+/**
+ *	free_pagedir - free pages allocated with alloc_pagedir()
+ */
+
+static inline void free_pagedir(struct pbe *pblist)
+{x+	struct pbe *pbe;x+
+	while (pblist) {x+		pbe = (pblist + PB_PAGE_SKIP)->next;x+		free_page((unsigned long)pblist);
+		pblist = pbe;x+	}x+}x 
 /**
  *	alloc_pagedir - Allocate the page directory.
  *
- *	First, determine exactly how many contiguous pages we need andx+ *	First, determine exactly how many pages we need andx  *	allocate them.
- */
-
-static int alloc_pagedir(void)
-{
-	calc_order();x-	pagedir_save = (suspend_pagedir_t *)__get_free_pages(GFP_ATOMIC | __GFP_COLD,x-							     pagedir_order);x-	if (!pagedir_save)x-		return -ENOMEM;x-	memset(pagedir_save, 0, (1 << pagedir_order) * PAGE_SIZE);x-	pagedir_nosave = pagedir_save;
-	return 0;x+ *
+ *	We arrange the pages in a chain: each page is an array of PBES_PER_PAGE
+ *	struct pbe elements (pbes) and the last element in the page points
+ *	to the next page.x+ *
+ *	On each page we set up a list of struct_pbe elements.
+ */
+
+static struct pbe * alloc_pagedir(unsigned nr_pages)
+{x+	unsigned num;x+	struct pbe *pblist, *pbe, *p;x+x+	if (!nr_pages)
+		return NULL;
+
+	pr_debug("alloc_pagedir(): nr_pages = %d\n", nr_pages);x+	pblist = (struct pbe *)get_zeroed_page(GFP_ATOMIC | __GFP_COLD);
+	for (pbe = pblist, num = PBES_PER_PAGE; pbe && num < nr_pages;x+        		pbe = pbe->next, num += PBES_PER_PAGE) {x+		p = pbe;x+		pbe += PB_PAGE_SKIP;x+		do
+			p->next = p + 1;
+		while (p++ < pbe);x+		pbe->next = (struct pbe *)get_zeroed_page(GFP_ATOMIC | __GFP_COLD);
+	}x+	if (pbe) {x+		for (num -= PBES_PER_PAGE - 1, p = pbe; num < nr_pages; p++, num++)
+			p->next = p + 1;
+	} else { /* get_zeroed_page() failed */
+		free_pagedir(pblist);
+		pblist = NULL;
+        }
+	pr_debug("alloc_pagedir(): allocated %d PBEs\n", num);x+	return pblist;x }
 
 /**
@@ -658,10 +670,8 @@
 static void free_image_pages(void)
 {x 	struct pbe * p;x-	int i;x x-	p = pagedir_save;
-	for (i = 0, p = pagedir_save; i < nr_copy_pages; i++, p++) {x+	for_each_pbe(p, pagedir_save) {x 		if (p->address) {x 			ClearPageNosave(virt_to_page(p->address));x 			free_page(p->address);x@@ -672,15 +682,13 @@
 
 /**
  *	alloc_image_pages - Allocate pages for the snapshot.
- *
  */
 
 static int alloc_image_pages(void)
 {x 	struct pbe * p;x-	int i;x x-	for (i = 0, p = pagedir_save; i < nr_copy_pages; i++, p++) {x+	for_each_pbe(p, pagedir_save) {x 		p->address = get_zeroed_page(GFP_ATOMIC | __GFP_COLD);
 		if (!p->address)
 			return -ENOMEM;x@@ -694,7 +702,7 @@
 	BUG_ON(PageNosave(virt_to_page(pagedir_save)));x 	BUG_ON(PageNosaveFree(virt_to_page(pagedir_save)));x 	free_image_pages();
-	free_pages((unsigned long) pagedir_save, pagedir_order);x+	free_pagedir(pagedir_save);x }
 
 
@@ -752,10 +760,13 @@
 	if (!enough_swap())x 		return -ENOSPC;
 
-	if ((error = alloc_pagedir())) {x+	nr_copy_pages = calc_nr(nr_copy_pages);x+x+	if (!(pagedir_save = alloc_pagedir(nr_copy_pages))) {
 		printk(KERN_ERR "suspend: Allocating pagedir failed.\n");
-		return error;
+		return -ENOMEM;x 	}x+	pagedir_nosave = pagedir_save;
 	if ((error = alloc_image_pages())) {
 		printk(KERN_ERR "suspend: Allocating image pages failed.\n");
 		swsusp_free();x@@ -763,7 +774,6 @@
 	}
 
 	nr_copy_pages_check = nr_copy_pages;x-	pagedir_order_check = pagedir_order;
 	return 0;x }
 
@@ -780,7 +790,7 @@
 x 	drain_local_pages();
 	count_data_pages();x-	printk("swsusp: Need to copy %u pages\n",nr_copy_pages);x+	printk("swsusp: Need to copy %u pages\n", nr_copy_pages);x 
 	error = swsusp_alloc();
 	if (error)
@@ -867,7 +877,6 @@
 asmlinkage int swsusp_restore(void)
 {x 	BUG_ON (nr_copy_pages_check != nr_copy_pages);x-	BUG_ON (pagedir_order_check != pagedir_order);x 	
 	/* Even mappings of "global" things (vmalloc) need to be fixed */
 	__flush_tlb_global();xdiff -Nru a/kernel/printk.c b/kernel/printk.c
--- a/kernel/printk.c	2005-02-10 22:57:43 -08:00
+++ b/kernel/printk.c	2005-03-07 20:41:40 -08:00
@@ -499,6 +499,22 @@
 	init_MUTEX(&console_sem);x }
 
+#if defined(CONFIG_PRINTK_TIME)
+static int printk_time = 1;
+#else
+static int printk_time = 0;x+#endif
+
+static int __init printk_time_setup(char *str)x+{x+	if (*str)x+		return 0;x+	printk_time = 1;
+	return 1;x+}x+
+__setup("time", printk_time_setup);
+
 /*
  * This is printk.  It can be called from any context.  We want it to work.
  * x@@ -547,10 +563,44 @@
 	 */x 	for (p = printk_buf; *p; p++) {x 		if (log_level_unknown) {
-			if (p[0] != '<' || p[1] < '0' || p[1] > '7' || p[2] != '>') {
-				emit_log_char('<');x-				emit_log_char(default_message_loglevel + '0');x-				emit_log_char('>');
+                        /* log_level_unknown signals the start of a new line */
+			if (printk_time) {x+				int loglev_char;
+				char tbuf[50], *tp;
+				unsigned tlen;
+				unsigned long long t;
+				unsigned long nanosec_rem;x+x+				/*
+				 * force the log level token to be
+				 * before the time output.
+				 */x+				if (p[0] == '<' && p[1] >='0' &&
+				   p[1] <= '7' && p[2] == '>') {
+					loglev_char = p[1];
+					p += 3;
+				} else {
+					loglev_char = default_message_loglevel
+						+ '0';
+				}
+				t = sched_clock();
+				nanosec_rem = do_div(t, 1000000000);
+				tlen = sprintf(tbuf,
+						"<%c>[%5lu.%06lu] ",
+						loglev_char,
+						(unsigned long)t,
+						nanosec_rem/1000);
+
+				for (tp = tbuf; tp< tbuf + tlen; tp++)
+					emit_log_char (*tp);
+			} else {
+				if (p[0] != '<' || p[1] < '0' ||
+				   p[1] > '7' || p[2] != '>') {
+					emit_log_char('<');x+					emit_log_char(default_message_loglevel
+						+ '0');x+					emit_log_char('>');
+				}x 			}x 			log_level_unknown = 0;x 		}xdiff -Nru a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c	2005-02-07 18:25:10 -08:00
+++ b/kernel/sched.c	2005-03-07 20:41:53 -08:00
@@ -45,6 +45,7 @@
 #include <linux/seq_file.h>
 #include <linux/syscalls.h>
 #include <linux/times.h>
+#include <linux/acct.h>
 #include <asm/tlb.h>
 
 #include <asm/unistd.h>
@@ -2241,6 +2242,32 @@
 EXPORT_PER_CPU_SYMBOL(kstat);
 
 /*
+ * This is called on clock ticks and on context switches.
+ * Bank in p->sched_time the ns elapsed since the last tick or switch.
+ */
+static inline void update_cpu_clock(task_t *p, runqueue_t *rq,
+				    unsigned long long now)
+{x+	unsigned long long last = max(p->timestamp, rq->timestamp_last_tick);x+	p->sched_time += now - last;x+}x+
+/*
+ * Return current->sched_time plus any more ns on the sched_clock
+ * that have not yet been banked.
+ */
+unsigned long long current_sched_time(const task_t *tsk)
+{x+	unsigned long long ns;x+	unsigned long flags;x+	local_irq_save(flags);
+	ns = max(tsk->timestamp, task_rq(tsk)->timestamp_last_tick);x+	ns = tsk->sched_time + (sched_clock() - ns);
+	local_irq_restore(flags);
+	return ns;x+}x+
+/*
  * We place interactive tasks back into the active array, if possible.
  *
  * To guarantee that this does not starve expired tasks we ignore thex@@ -2257,70 +2284,6 @@
 			((rq)->curr->static_prio > (rq)->best_expired_prio))x 
 /*
- * Do the virtual cpu time signal calculations.
- * @p: the process that the cpu time gets accounted to
- * @cputime: the cpu time spent in user space since the last update
- */
-static inline void account_it_virt(struct task_struct * p, cputime_t cputime)
-{
-	cputime_t it_virt = p->it_virt_value;x-x-	if (cputime_gt(it_virt, cputime_zero) &&
-	    cputime_gt(cputime, cputime_zero)) {
-		if (cputime_ge(cputime, it_virt)) {
-			it_virt = cputime_add(it_virt, p->it_virt_incr);x-			send_sig(SIGVTALRM, p, 1);
-		}x-		it_virt = cputime_sub(it_virt, cputime);
-		p->it_virt_value = it_virt;
-	}
-}x-x-/*
- * Do the virtual profiling signal calculations.
- * @p: the process that the cpu time gets accounted to
- * @cputime: the cpu time spent in user and kernel space since the last update
- */
-static void account_it_prof(struct task_struct *p, cputime_t cputime)
-{
-	cputime_t it_prof = p->it_prof_value;x-x-	if (cputime_gt(it_prof, cputime_zero) &&
-	    cputime_gt(cputime, cputime_zero)) {
-		if (cputime_ge(cputime, it_prof)) {
-			it_prof = cputime_add(it_prof, p->it_prof_incr);x-			send_sig(SIGPROF, p, 1);
-		}x-		it_prof = cputime_sub(it_prof, cputime);
-		p->it_prof_value = it_prof;
-	}
-}x-x-/*
- * Check if the process went over its cputime resource limit after
- * some cpu time got added to utime/stime.
- * @p: the process that the cpu time gets accounted to
- * @cputime: the cpu time spent in user and kernel space since the last update
- */
-static void check_rlimit(struct task_struct *p, cputime_t cputime)
-{
-	cputime_t total, tmp;x-	unsigned long secs;x-x-	total = cputime_add(p->utime, p->stime);
-	secs = cputime_to_secs(total);x-	if (unlikely(secs >= p->signal->rlim[RLIMIT_CPU].rlim_cur)) {
-		/* Send SIGXCPU every second. */
-		tmp = cputime_sub(total, cputime);
-		if (cputime_to_secs(tmp) < secs)x-			send_sig(SIGXCPU, p, 1);
-		/* and SIGKILL when we go over max.. */
-		if (secs >= p->signal->rlim[RLIMIT_CPU].rlim_max)x-			send_sig(SIGKILL, p, 1);
-	}
-}x-x-/*
  * Account user cpu time to a process.
  * @p: the process that the cpu time gets accounted to
  * @hardirq_offset: the offset to subtract from hardirq_count()
@@ -2333,11 +2296,6 @@
 x 	p->utime = cputime_add(p->utime, cputime);
 
-	/* Check for signals (SIGVTALRM, SIGPROF, SIGXCPU & SIGKILL). */
-	check_rlimit(p, cputime);
-	account_it_virt(p, cputime);
-	account_it_prof(p, cputime);
-
 	/* Add user time to cpustat. */
 	tmp = cputime_to_cputime64(cputime);
 	if (TASK_NICE(p) > 0)
@@ -2361,12 +2319,6 @@
 x 	p->stime = cputime_add(p->stime, cputime);
 
-	/* Check for signals (SIGPROF, SIGXCPU & SIGKILL). */
-	if (likely(p->signal && p->exit_state < EXIT_ZOMBIE)) {
-		check_rlimit(p, cputime);
-		account_it_prof(p, cputime);
-	}
-
 	/* Add system time to cpustat. */
 	tmp = cputime_to_cputime64(cputime);
 	if (hardirq_count() - hardirq_offset)
@@ -2379,6 +2331,10 @@
 		cpustat->iowait = cputime64_add(cpustat->iowait, tmp);
 	else
 		cpustat->idle = cputime64_add(cpustat->idle, tmp);
+	/* Account for system time used */x+	acct_update_integrals(p);
+	/* Update rss highwater mark */
+	update_mem_hiwater(p);
 }
 
 /*
@@ -2414,8 +2370,11 @@
 	int cpu = smp_processor_id();
 	runqueue_t *rq = this_rq();
 	task_t *p = current;x+	unsigned long long now = sched_clock();
 x-	rq->timestamp_last_tick = sched_clock();
+	update_cpu_clock(p, rq, now);x+
+	rq->timestamp_last_tick = now;
 
 	if (p == rq->idle) {x 		if (wake_priority_sleeper(rq))x@@ -2799,6 +2758,8 @@
 	clear_tsk_need_resched(prev);
 	rcu_qsctr_inc(task_cpu(prev));x 
+	update_cpu_clock(prev, rq, now);x+
 	prev->sleep_avg -= run_time;
 	if ((long)prev->sleep_avg <= 0)x 		prev->sleep_avg = 0;x@@ -4058,6 +4019,7 @@
 	idle->array = NULL;
 	idle->prio = MAX_PRIO;
 	idle->state = TASK_RUNNING;x+	idle->cpus_allowed = cpumask_of_cpu(cpu);
 	set_task_cpu(idle, cpu);
 
 	spin_lock_irqsave(&rq->lock, flags);
diff -Nru a/kernel/seccomp.c b/kernel/seccomp.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/kernel/seccomp.c	2005-03-07 20:41:40 -08:00
@@ -0,0 +1,74 @@
+/*
+ * linux/kernel/seccomp.c
+ *
+ * Copyright 2004-2005  Andrea Arcangeli <andrea@cpushare.com>
+ *
+ * This defines a simple but solid secure-computing mode.
+ */
+
+#include <linux/seccomp.h>
+#include <linux/sched.h>
+#include <asm/unistd.h>
+#ifdef TIF_IA32
+#include <asm/ia32_unistd.h>
+#endif
+
+/* #define SECCOMP_DEBUG 1 */
+
+/*
+ * Secure computing mode 1 allows only read/write/exit/sigreturn.
+ * To be fully secure this must be combined with rlimit
+ * to limit the stack allocations too.
+ */
+static int mode1_syscalls[] = {x+	__NR_read, __NR_write, __NR_exit,
+	/*
+	 * Allow either sigreturn or rt_sigreturn, newer archs
+	 * like x86-64 only defines __NR_rt_sigreturn.
+	 */
+#ifdef __NR_sigreturnx+	__NR_sigreturn,
+#else
+	__NR_rt_sigreturn,
+#endif
+	0, /* null terminated */
+};
+
+#ifdef TIF_IA32
+static int mode1_syscalls_32bit[] = {x+	__NR_ia32_read, __NR_ia32_write, __NR_ia32_exit,
+	/*
+	 * Allow either sigreturn or rt_sigreturn, newer archs
+	 * like x86-64 only defines __NR_rt_sigreturn.
+	 */
+	__NR_ia32_sigreturn,
+	0, /* null terminated */
+};
+#endif
+
+void __secure_computing(int this_syscall)x+{x+	int mode = current->seccomp.mode;x+	int * syscall;x+
+	switch (mode) {
+	case 1:
+		syscall = mode1_syscalls;
+#ifdef TIF_IA32
+		if (test_thread_flag(TIF_IA32))
+			syscall = mode1_syscalls_32bit;
+#endif
+		do {x+			if (*syscall == this_syscall)x+				return;
+		} while (*++syscall);
+		break;x+	default:
+		BUG();
+	}x+
+#ifdef SECCOMP_DEBUG
+	dump_stack();
+#endif
+	do_exit(SIGKILL);x+}xdiff -Nru a/kernel/signal.c b/kernel/signal.c
--- a/kernel/signal.c	2005-01-30 22:33:46 -08:00
+++ b/kernel/signal.c	2005-03-07 20:41:53 -08:00
@@ -22,6 +22,7 @@
 #include <linux/security.h>
 #include <linux/syscalls.h>
 #include <linux/ptrace.h>
+#include <linux/posix-timers.h>
 #include <asm/param.h>
 #include <asm/uaccess.h>
 #include <asm/unistd.h>
@@ -260,19 +261,23 @@
 	return sig;
 }
 
-static struct sigqueue *__sigqueue_alloc(struct task_struct *t, int flags)
+static struct sigqueue *__sigqueue_alloc(struct task_struct *t, int flags,
+					 int override_rlimit)
 {x 	struct sigqueue *q = NULL;
 
-	if (atomic_read(&t->user->sigpending) <x+	atomic_inc(&t->user->sigpending);x+	if (override_rlimit ||
+	    atomic_read(&t->user->sigpending) <=
 			t->signal->rlim[RLIMIT_SIGPENDING].rlim_cur)
 		q = kmem_cache_alloc(sigqueue_cachep, flags);
-	if (q) {
+	if (unlikely(q == NULL)) {
+		atomic_dec(&t->user->sigpending);x+	} else {
 		INIT_LIST_HEAD(&q->list);
 		q->flags = 0;x 		q->lock = NULL;
 		q->user = get_uid(t->user);
-		atomic_inc(&q->user->sigpending);x 	}x 	return(q);x }
@@ -347,7 +352,9 @@
 	if (!atomic_read(&sig->count))x 		BUG();
 	spin_lock(&sighand->siglock);x+	posix_cpu_timers_exit(tsk);
 	if (atomic_dec_and_test(&sig->count)) {x+		posix_cpu_timers_exit_group(tsk);
 		if (tsk == sig->curr_target)
 			sig->curr_target = next_thread(tsk);
 		tsk->signal = NULL;
@@ -381,6 +388,7 @@
 		sig->maj_flt += tsk->maj_flt;
 		sig->nvcsw += tsk->nvcsw;
 		sig->nivcsw += tsk->nivcsw;
+		sig->sched_time += tsk->sched_time;
 		spin_unlock(&sighand->siglock);x 		sig = NULL;	/* Marker for below.  */
 	}
@@ -564,7 +572,15 @@
 	if ( signr &&
 	     ((info->si_code & __SI_MASK) == __SI_TIMER) &&
 	     info->si_sys_private){x+		/*
+		 * Release the siglock to ensure proper locking order
+		 * of timer locks outside of siglocks.  Note, we leave
+		 * irqs disabled here, since the posix-timers code is
+		 * about to disable them again anyway.
+		 */x+		spin_unlock(&tsk->sighand->siglock);x 		do_schedule_next_timer(info);x+		spin_lock(&tsk->sighand->siglock);x 	}
 	return signr;x }
@@ -793,7 +809,9 @@
 	   make sure at least one signal gets delivered and don't
 	   pass on the info struct.  */
 
-	q = __sigqueue_alloc(t, GFP_ATOMIC);x+	q = __sigqueue_alloc(t, GFP_ATOMIC, (sig < SIGRTMIN &&
+					     ((unsigned long) info < 2 ||
+					      info->si_code >= 0)));
 	if (q) {x 		list_add_tail(&q->list, &signals->list);
 		switch ((unsigned long) info) {x@@ -1036,7 +1054,7 @@
 	return;
 }
 
-static intx+int
 __group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
 {x 	int ret = 0;x@@ -1316,7 +1334,7 @@
 {x 	struct sigqueue *q;
 
-	if ((q = __sigqueue_alloc(current, GFP_KERNEL)))x+	if ((q = __sigqueue_alloc(current, GFP_KERNEL, 0)))
 		q->flags |= SIGQUEUE_PREALLOC;x 	return(q);x }
diff -Nru a/kernel/softirq.c b/kernel/softirq.c
--- a/kernel/softirq.c	2005-01-11 16:42:35 -08:00
+++ b/kernel/softirq.c	2005-03-07 20:41:40 -08:00
@@ -355,8 +355,12 @@
 	set_current_state(TASK_INTERRUPTIBLE);
 
 	while (!kthread_should_stop()) {
-		if (!local_softirq_pending())
+		preempt_disable();
+		if (!local_softirq_pending()) {x+			preempt_enable_no_resched();x 			schedule();
+			preempt_disable();
+		}
 
 		__set_current_state(TASK_RUNNING);x 
@@ -364,14 +368,14 @@
 			/* Preempt disable stops cpu going offline.
 			   If already offline, we'll be on wrong CPU:
 			   don't process */
-			preempt_disable();
 			if (cpu_is_offline((long)__bind_cpu))
 				goto wait_to_die;x 			do_softirq();x-			preempt_enable();
+			preempt_enable_no_resched();x 			cond_resched();x+			preempt_disable();
 		}
-
+		preempt_enable();
 		set_current_state(TASK_INTERRUPTIBLE);
 	}
 	__set_current_state(TASK_RUNNING);xdiff -Nru a/kernel/sys.c b/kernel/sys.c
--- a/kernel/sys.c	2005-01-11 16:42:35 -08:00
+++ b/kernel/sys.c	2005-03-07 20:41:53 -08:00
@@ -20,6 +20,7 @@
 #include <linux/device.h>
 #include <linux/key.h>
 #include <linux/times.h>
+#include <linux/posix-timers.h>
 #include <linux/security.h>
 #include <linux/dcookies.h>
 #include <linux/suspend.h>
@@ -216,12 +217,13 @@
 }
 
 EXPORT_SYMBOL(unregister_reboot_notifier);x+
 static int set_one_prio(struct task_struct *p, int niceval, int error)
 {x 	int no_nice;
 
 	if (p->uid != current->euid &&
-		p->uid != current->uid && !capable(CAP_SYS_NICE)) {x+		p->euid != current->euid && !capable(CAP_SYS_NICE)) {x 		error = -EPERM;
 		goto out;
 	}
@@ -1501,6 +1503,20 @@
 	task_lock(current->group_leader);
 	*old_rlim = new_rlim;
 	task_unlock(current->group_leader);
+x+	if (resource == RLIMIT_CPU && new_rlim.rlim_cur != RLIM_INFINITY &&
+	    (cputime_eq(current->signal->it_prof_expires, cputime_zero) ||
+	     new_rlim.rlim_cur <= cputime_to_secs(
+		     current->signal->it_prof_expires))) {x+		cputime_t cputime = secs_to_cputime(new_rlim.rlim_cur);
+		read_lock(&tasklist_lock);x+		spin_lock_irq(&current->sighand->siglock);x+		set_process_cpu_timer(current, CPUCLOCK_PROF,
+				      &cputime, NULL);
+		spin_unlock_irq(&current->sighand->siglock);x+		read_unlock(&tasklist_lock);x+	}x+
 	return 0;x }
 
diff -Nru a/kernel/sysctl.c b/kernel/sysctl.c
--- a/kernel/sysctl.c	2005-02-18 01:23:31 -08:00
+++ b/kernel/sysctl.c	2005-03-04 22:41:14 -08:00
@@ -121,6 +121,8 @@
 extern int acct_parm[];x #endif
 x+int randomize_va_space = 1;
+
 static int parse_table(int __user *, int, void __user *, size_t __user *, void __user *, size_t,x 		       ctl_table *, void **);
 static int proc_doutsstring(ctl_table *table, int write, struct file *filp,
@@ -632,6 +634,15 @@
 		.proc_handler	= &proc_dointvec,x 	},x #endif
+	{x+		.ctl_name	= KERN_RANDOMIZE,
+		.procname	= "randomize_va_space",
+		.data		= &randomize_va_space,
+		.maxlen		= sizeof(int),
+		.mode		= 0644,
+		.proc_handler	= &proc_dointvec,x+	},x+
 	{ .ctl_name = 0 }
 };
 
diff -Nru a/kernel/timer.c b/kernel/timer.c
--- a/kernel/timer.c	2005-01-20 21:00:21 -08:00
+++ b/kernel/timer.c	2005-03-07 20:41:52 -08:00
@@ -30,6 +30,7 @@
 #include <linux/thread_info.h>
 #include <linux/time.h>
 #include <linux/jiffies.h>
+#include <linux/posix-timers.h>
 #include <linux/cpu.h>
 #include <linux/syscalls.h>
 x@@ -48,8 +49,9 @@
 /*
  * per-CPU timer vector definitions:
  */
-#define TVN_BITS 6
-#define TVR_BITS 8x+
+#define TVN_BITS (CONFIG_BASE_SMALL ? 4 : 6)
+#define TVR_BITS (CONFIG_BASE_SMALL ? 6 : 8)
 #define TVN_SIZE (1 << TVN_BITS)
 #define TVR_SIZE (1 << TVR_BITS)
 #define TVN_MASK (TVN_SIZE - 1)
@@ -824,6 +826,7 @@
 	if (rcu_pending(cpu))
 		rcu_check_callbacks(cpu, user_tick);x 	scheduler_tick();x+ 	run_posix_cpu_timers(p);
 }
 
 /*
@@ -843,6 +846,8 @@
  * Requires xtime_lock to access.
  */
 unsigned long avenrun[3];
+x+EXPORT_SYMBOL(avenrun);
 
 /*
  * calc_load - given tick count, update the avenrun load estimates.
diff -Nru a/kernel/user.c b/kernel/user.c
--- a/kernel/user.c	2005-01-07 21:44:13 -08:00
+++ b/kernel/user.c	2005-03-07 20:41:45 -08:00
@@ -18,7 +18,8 @@
  * UID task count cache, to get fast user lookup in "alloc_uid"
  * when changing user ID's (ie setuid() and friends).
  */
-#define UIDHASH_BITS		8x+
+#define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 8)
 #define UIDHASH_SZ		(1 << UIDHASH_BITS)
 #define UIDHASH_MASK		(UIDHASH_SZ - 1)
 #define __uidhashfn(uid)	(((uid >> UIDHASH_BITS) + uid) & UIDHASH_MASK)
diff -Nru a/kernel/workqueue.c b/kernel/workqueue.c
--- a/kernel/workqueue.c	2005-02-16 10:51:24 -08:00
+++ b/kernel/workqueue.c	2005-02-22 19:23:08 -08:00
@@ -423,6 +423,30 @@
 	flush_workqueue(keventd_wq);x }
 
+/**
+ * cancel_rearming_delayed_workqueue - reliably kill off a delayed
+ *			work whose handler rearms the delayed work.
+ * @wq:   the controlling workqueue structure
+ * @work: the delayed work struct
+ */
+static void cancel_rearming_delayed_workqueue(struct workqueue_struct *wq,
+					struct work_struct *work)x+{x+	while (!cancel_delayed_work(work))
+		flush_workqueue(wq);x+}x+
+/**
+ * cancel_rearming_delayed_work - reliably kill off a delayed keventd
+ *			work whose handler rearms the delayed work.
+ * @work: the delayed work struct
+ */
+void cancel_rearming_delayed_work(struct work_struct *work)x+{x+	cancel_rearming_delayed_workqueue(keventd_wq, work);x+}x+EXPORT_SYMBOL(cancel_rearming_delayed_work);x+
 int keventd_up(void)
 {x 	return keventd_wq != NULL;
diff -Nru a/lib/Kconfig.debug b/lib/Kconfig.debug
--- a/lib/Kconfig.debug	2005-01-20 21:00:21 -08:00
+++ b/lib/Kconfig.debug	2005-03-07 20:41:40 -08:00
@@ -27,6 +27,15 @@
 	  Enables console device to interpret special characters as
 	  commands to dump state information.
 
+config PRINTK_TIMEx+	bool "Show timing information on printks"x+	help
+	  Selecting this option causes timing information to be
+	  included in printk output.  This allows you to measure
+	  the interval between kernel operations, including bootup
+	  operations.  This is useful for identifying long delays
+	  in kernel startup.x+
 config SCHEDSTATS
 	bool "Collect scheduler statistics"x 	depends on DEBUG_KERNEL && PROC_FS
diff -Nru a/lib/Makefile b/lib/Makefile
--- a/lib/Makefile	2005-01-04 18:48:19 -08:00
+++ b/lib/Makefile	2005-03-07 20:41:51 -08:00
@@ -4,8 +4,11 @@
 
 lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \
 	 bust_spinlocks.o rbtree.o radix-tree.o dump_stack.o \
-	 kobject.o kref.o idr.o div64.o parser.o int_sqrt.o \
-	 bitmap.o extable.o kobject_uevent.o prio_tree.o
+	 kobject.o kref.o idr.o div64.o int_sqrt.o \
+	 bitmap.o extable.o kobject_uevent.o prio_tree.o sha1.o \
+	 halfmd4.o
+
+obj-y += sort.o parser.o
 
 ifeq ($(CONFIG_DEBUG_KOBJECT),y)
 CFLAGS_kobject.o += -DDEBUG
diff -Nru a/lib/extable.c b/lib/extable.c
--- a/lib/extable.c	2004-01-20 17:58:55 -08:00
+++ b/lib/extable.c	2005-03-07 20:41:46 -08:00
@@ -13,6 +13,7 @@
 #include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <linux/sort.h>
 #include <asm/uaccess.h>
 
 extern struct exception_table_entry __start___ex_table[];x@@ -25,26 +26,17 @@
  * This is used both for the kernel exception table and for
  * the exception tables of modules that get loaded.
  */
+static int cmp_ex(const void *a, const void *b)x+{x+	const struct exception_table_entry *x = a, *y = b;
+	return x->insn - y->insn;x+}x+
 void sort_extable(struct exception_table_entry *start,x 		  struct exception_table_entry *finish)
 {x-	struct exception_table_entry el, *p, *q;
-
-	/* insertion sort */
-	for (p = start + 1; p < finish; ++p) {
-		/* start .. p-1 is sorted */
-		if (p[0].insn < p[-1].insn) {
-			/* move element p down to its right place */
-			el = *p;x-			q = p;x-			do {x-				/* el comes before q[-1], move q[-1] up one */
-				q[0] = q[-1];x-				--q;x-			} while (q > start && el.insn < q[-1].insn);x-			*q = el;
-		}x-	}
+	sort(start, finish - start, sizeof(struct exception_table_entry),
+	     cmp_ex, NULL);
 }
 #endif
 xdiff -Nru a/lib/halfmd4.c b/lib/halfmd4.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/lib/halfmd4.c	2005-03-07 20:41:51 -08:00
@@ -0,0 +1,66 @@
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/cryptohash.h>
+
+/* F, G and H are basic MD4 functions: selection, majority, parity */
+#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
+#define G(x, y, z) (((x) & (y)) + (((x) ^ (y)) & (z)))
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+
+/*
+ * The generic round function.  The application is so specific that
+ * we don't bother protecting all the arguments with parens, as is generally
+ * good macro practice, in favor of extra legibility.
+ * Rotation is separate from addition to prevent recomputation
+ */
+#define ROUND(f, a, b, c, d, x, s)	\
+	(a += f(b, c, d) + x, a = (a << s) | (a >> (32 - s)))
+#define K1 0
+#define K2 013240474631UL
+#define K3 015666365641UL
+
+/*
+ * Basic cut-down MD4 transform.  Returns only 32 bits of result.
+ */
+__u32 half_md4_transform(__u32 buf[4], __u32 const in[8])x+{x+	__u32 a = buf[0], b = buf[1], c = buf[2], d = buf[3];
+x+	/* Round 1 */
+	ROUND(F, a, b, c, d, in[0] + K1,  3);x+	ROUND(F, d, a, b, c, in[1] + K1,  7);x+	ROUND(F, c, d, a, b, in[2] + K1, 11);x+	ROUND(F, b, c, d, a, in[3] + K1, 19);x+	ROUND(F, a, b, c, d, in[4] + K1,  3);x+	ROUND(F, d, a, b, c, in[5] + K1,  7);x+	ROUND(F, c, d, a, b, in[6] + K1, 11);x+	ROUND(F, b, c, d, a, in[7] + K1, 19);x+x+	/* Round 2 */
+	ROUND(G, a, b, c, d, in[1] + K2,  3);x+	ROUND(G, d, a, b, c, in[3] + K2,  5);x+	ROUND(G, c, d, a, b, in[5] + K2,  9);x+	ROUND(G, b, c, d, a, in[7] + K2, 13);x+	ROUND(G, a, b, c, d, in[0] + K2,  3);x+	ROUND(G, d, a, b, c, in[2] + K2,  5);x+	ROUND(G, c, d, a, b, in[4] + K2,  9);x+	ROUND(G, b, c, d, a, in[6] + K2, 13);x+x+	/* Round 3 */
+	ROUND(H, a, b, c, d, in[3] + K3,  3);x+	ROUND(H, d, a, b, c, in[7] + K3,  9);x+	ROUND(H, c, d, a, b, in[2] + K3, 11);x+	ROUND(H, b, c, d, a, in[6] + K3, 15);x+	ROUND(H, a, b, c, d, in[1] + K3,  3);x+	ROUND(H, d, a, b, c, in[5] + K3,  9);x+	ROUND(H, c, d, a, b, in[0] + K3, 11);x+	ROUND(H, b, c, d, a, in[4] + K3, 15);x+x+	buf[0] += a;
+	buf[1] += b;
+	buf[2] += c;
+	buf[3] += d;x+
+	return buf[1]; /* "most hashed" word */
+}x+EXPORT_SYMBOL(half_md4_transform);
diff -Nru a/lib/kobject.c b/lib/kobject.c
--- a/lib/kobject.c	2004-11-18 07:06:26 -08:00
+++ b/lib/kobject.c	2005-03-09 09:04:09 -08:00
@@ -140,9 +140,9 @@
 static void unlink(struct kobject * kobj)
 {x 	if (kobj->kset) {x-		down_write(&kobj->kset->subsys->rwsem);x+		spin_lock(&kobj->kset->list_lock);x 		list_del_init(&kobj->entry);
-		up_write(&kobj->kset->subsys->rwsem);x+		spin_unlock(&kobj->kset->list_lock);x 	}
 	kobject_put(kobj);x }
@@ -168,13 +168,13 @@
 		 kobj->kset ? kobj->kset->kobj.name : "<NULL>" );
 x 	if (kobj->kset) {x-		down_write(&kobj->kset->subsys->rwsem);x+		spin_lock(&kobj->kset->list_lock);x 
 		if (!parent)
 			parent = kobject_get(&kobj->kset->kobj);x x 		list_add_tail(&kobj->entry,&kobj->kset->list);
-		up_write(&kobj->kset->subsys->rwsem);x+		spin_unlock(&kobj->kset->list_lock);x 	}
 	kobj->parent = parent;x 
@@ -380,6 +380,7 @@
 {x 	kobject_init(&k->kobj);x 	INIT_LIST_HEAD(&k->list);
+	spin_lock_init(&k->list_lock);x }
 
 
@@ -444,7 +445,7 @@
 	struct list_head * entry;x 	struct kobject * ret = NULL;
 
-	down_read(&kset->subsys->rwsem);x+	spin_lock(&kset->list_lock);x 	list_for_each(entry,&kset->list) {x 		struct kobject * k = to_kobj(entry);
 		if (kobject_name(k) && !strcmp(kobject_name(k),name)) {x@@ -452,7 +453,7 @@
 			break;x 		}x 	}
-	up_read(&kset->subsys->rwsem);x+	spin_unlock(&kset->list_lock);x 	return ret;
 }
 
@@ -524,7 +525,6 @@
 	}
 }
 
-EXPORT_SYMBOL(kobject_get_path);x EXPORT_SYMBOL(kobject_init);x EXPORT_SYMBOL(kobject_register);x EXPORT_SYMBOL(kobject_unregister);x@@ -532,7 +532,6 @@
 EXPORT_SYMBOL(kobject_put);x EXPORT_SYMBOL(kobject_add);x EXPORT_SYMBOL(kobject_del);
-EXPORT_SYMBOL(kobject_rename);
 
 EXPORT_SYMBOL(kset_register);x EXPORT_SYMBOL(kset_unregister);xdiff -Nru a/lib/kref.c b/lib/kref.c
--- a/lib/kref.c	2004-08-23 13:16:09 -07:00
+++ b/lib/kref.c	2005-03-09 09:03:24 -08:00
@@ -42,14 +42,21 @@
  *	     in as this function.
  *
  * Decrement the refcount, and if 0, call release().
+ * Return 1 if the object was removed, otherwise return 0.  Beware, if this
+ * function returns 0, you still can not count on the kref from remaining in
+ * memory.  Only use the return value if you want to see if the kref is now
+ * gone, not present.
  */
-void kref_put(struct kref *kref, void (*release) (struct kref *kref))
+int kref_put(struct kref *kref, void (*release)(struct kref *kref))
 {x 	WARN_ON(release == NULL);x 	WARN_ON(release == (void (*)(struct kref *))kfree);
 
-	if (atomic_dec_and_test(&kref->refcount))x+	if (atomic_dec_and_test(&kref->refcount)) {x 		release(kref);
+		return 1;
+	}x+	return 0;x }
 
 EXPORT_SYMBOL(kref_init);xdiff -Nru a/lib/rwsem-spinlock.c b/lib/rwsem-spinlock.c
--- a/lib/rwsem-spinlock.c	2004-06-20 18:23:45 -07:00
+++ b/lib/rwsem-spinlock.c	2005-03-09 02:43:47 -08:00
@@ -140,12 +140,12 @@
 x 	rwsemtrace(sem, "Entering __down_read");
 
-	spin_lock(&sem->wait_lock);x+	spin_lock_irq(&sem->wait_lock);x x 	if (sem->activity >= 0 && list_empty(&sem->wait_list)) {x 		/* granted */
 		sem->activity++;x-		spin_unlock(&sem->wait_lock);x+		spin_unlock_irq(&sem->wait_lock);x 		goto out;
 	}
 
@@ -160,7 +160,7 @@
 	list_add_tail(&waiter.list, &sem->wait_list);x x 	/* we don't need to touch the semaphore struct anymore */
-	spin_unlock(&sem->wait_lock);x+	spin_unlock_irq(&sem->wait_lock);x x 	/* wait to be given the lock */x 	for (;;) {x@@ -181,10 +181,12 @@
  */
 int fastcall __down_read_trylock(struct rw_semaphore *sem)
 {x+	unsigned long flags;x 	int ret = 0;x+x 	rwsemtrace(sem, "Entering __down_read_trylock");
 
-	spin_lock(&sem->wait_lock);x+	spin_lock_irqsave(&sem->wait_lock, flags);
 x 	if (sem->activity >= 0 && list_empty(&sem->wait_list)) {x 		/* granted */
@@ -192,7 +194,7 @@
 		ret = 1;
 	}
 
-	spin_unlock(&sem->wait_lock);x+	spin_unlock_irqrestore(&sem->wait_lock, flags);
 x 	rwsemtrace(sem, "Leaving __down_read_trylock");
 	return ret;
@@ -209,12 +211,12 @@
 x 	rwsemtrace(sem, "Entering __down_write");
 
-	spin_lock(&sem->wait_lock);x+	spin_lock_irq(&sem->wait_lock);x x 	if (sem->activity == 0 && list_empty(&sem->wait_list)) {x 		/* granted */
 		sem->activity = -1;x-		spin_unlock(&sem->wait_lock);x+		spin_unlock_irq(&sem->wait_lock);x 		goto out;
 	}
 
@@ -229,7 +231,7 @@
 	list_add_tail(&waiter.list, &sem->wait_list);x x 	/* we don't need to touch the semaphore struct anymore */
-	spin_unlock(&sem->wait_lock);x+	spin_unlock_irq(&sem->wait_lock);x x 	/* wait to be given the lock */x 	for (;;) {x@@ -250,10 +252,12 @@
  */
 int fastcall __down_write_trylock(struct rw_semaphore *sem)
 {x+	unsigned long flags;x 	int ret = 0;x+x 	rwsemtrace(sem, "Entering __down_write_trylock");
 
-	spin_lock(&sem->wait_lock);x+	spin_lock_irqsave(&sem->wait_lock, flags);
 x 	if (sem->activity == 0 && list_empty(&sem->wait_list)) {x 		/* granted */
@@ -261,7 +265,7 @@
 		ret = 1;
 	}
 
-	spin_unlock(&sem->wait_lock);x+	spin_unlock_irqrestore(&sem->wait_lock, flags);
 x 	rwsemtrace(sem, "Leaving __down_write_trylock");
 	return ret;
@@ -272,14 +276,16 @@
  */
 void fastcall __up_read(struct rw_semaphore *sem)
 {x+	unsigned long flags;x+x 	rwsemtrace(sem, "Entering __up_read");
 
-	spin_lock(&sem->wait_lock);x+	spin_lock_irqsave(&sem->wait_lock, flags);
 x 	if (--sem->activity == 0 && !list_empty(&sem->wait_list))
 		sem = __rwsem_wake_one_writer(sem);x 
-	spin_unlock(&sem->wait_lock);x+	spin_unlock_irqrestore(&sem->wait_lock, flags);
 x 	rwsemtrace(sem, "Leaving __up_read");
 }
@@ -289,15 +295,17 @@
  */
 void fastcall __up_write(struct rw_semaphore *sem)
 {x+	unsigned long flags;x+x 	rwsemtrace(sem, "Entering __up_write");
 
-	spin_lock(&sem->wait_lock);x+	spin_lock_irqsave(&sem->wait_lock, flags);
 x 	sem->activity = 0;
 	if (!list_empty(&sem->wait_list))
 		sem = __rwsem_do_wake(sem, 1);x 
-	spin_unlock(&sem->wait_lock);x+	spin_unlock_irqrestore(&sem->wait_lock, flags);
 x 	rwsemtrace(sem, "Leaving __up_write");
 }
@@ -308,15 +316,17 @@
  */
 void fastcall __downgrade_write(struct rw_semaphore *sem)
 {x+	unsigned long flags;x+x 	rwsemtrace(sem, "Entering __downgrade_write");
 
-	spin_lock(&sem->wait_lock);x+	spin_lock_irqsave(&sem->wait_lock, flags);
 x 	sem->activity = 1;
 	if (!list_empty(&sem->wait_list))
 		sem = __rwsem_do_wake(sem, 0);x 
-	spin_unlock(&sem->wait_lock);x+	spin_unlock_irqrestore(&sem->wait_lock, flags);
 x 	rwsemtrace(sem, "Leaving __downgrade_write");
 }xdiff -Nru a/lib/rwsem.c b/lib/rwsem.c
--- a/lib/rwsem.c	2004-09-07 23:32:52 -07:00
+++ b/lib/rwsem.c	2005-03-09 02:45:16 -08:00
@@ -150,7 +150,7 @@
 	set_task_state(tsk, TASK_UNINTERRUPTIBLE);
 
 	/* set up my own style of waitqueue */
-	spin_lock(&sem->wait_lock);x+	spin_lock_irq(&sem->wait_lock);x 	waiter->task = tsk;x 	get_task_struct(tsk);
 
@@ -163,7 +163,7 @@
 	if (!(count & RWSEM_ACTIVE_MASK))
 		sem = __rwsem_do_wake(sem, 0);x 
-	spin_unlock(&sem->wait_lock);x+	spin_unlock_irq(&sem->wait_lock);x x 	/* wait to be given the lock */x 	for (;;) {x@@ -219,15 +219,17 @@
  */
 struct rw_semaphore fastcall *rwsem_wake(struct rw_semaphore *sem)
 {x+	unsigned long flags;x+x 	rwsemtrace(sem, "Entering rwsem_wake");
 
-	spin_lock(&sem->wait_lock);x+	spin_lock_irqsave(&sem->wait_lock, flags);
 x 	/* do nothing if list empty */x 	if (!list_empty(&sem->wait_list))
 		sem = __rwsem_do_wake(sem, 0);x 
-	spin_unlock(&sem->wait_lock);x+	spin_unlock_irqrestore(&sem->wait_lock, flags);
 x 	rwsemtrace(sem, "Leaving rwsem_wake");
 
@@ -241,15 +243,17 @@
  */
 struct rw_semaphore fastcall *rwsem_downgrade_wake(struct rw_semaphore *sem)
 {x+	unsigned long flags;x+x 	rwsemtrace(sem, "Entering rwsem_downgrade_wake");
 
-	spin_lock(&sem->wait_lock);x+	spin_lock_irqsave(&sem->wait_lock, flags);
 x 	/* do nothing if list empty */x 	if (!list_empty(&sem->wait_list))
 		sem = __rwsem_do_wake(sem, 1);x 
-	spin_unlock(&sem->wait_lock);x+	spin_unlock_irqrestore(&sem->wait_lock, flags);
 x 	rwsemtrace(sem, "Leaving rwsem_downgrade_wake");
 	return sem;xdiff -Nru a/lib/sha1.c b/lib/sha1.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/lib/sha1.c	2005-03-07 20:41:50 -08:00
@@ -0,0 +1,96 @@
+/*
+ * SHA transform algorithm, originally taken from code written by
+ * Peter Gutmann, and placed in the public domain.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/cryptohash.h>
+
+/* The SHA f()-functions.  */
+
+#define f1(x,y,z)   (z ^ (x & (y ^ z)))		/* x ? y : z */
+#define f2(x,y,z)   (x ^ y ^ z)			/* XOR */
+#define f3(x,y,z)   ((x & y) + (z & (x ^ y)))	/* majority */
+
+/* The SHA Mysterious Constants */
+
+#define K1  0x5A827999L			/* Rounds  0-19: sqrt(2) * 2^30 */
+#define K2  0x6ED9EBA1L			/* Rounds 20-39: sqrt(3) * 2^30 */
+#define K3  0x8F1BBCDCL			/* Rounds 40-59: sqrt(5) * 2^30 */
+#define K4  0xCA62C1D6L			/* Rounds 60-79: sqrt(10) * 2^30 */
+
+/*
+ * sha_transform: single block SHA1 transform
+ *
+ * @digest: 160 bit digest to update
+ * @data:   512 bits of data to hash
+ * @W:      80 words of workspace (see note)
+ *
+ * This function generates a SHA1 digest for a single 512-bit block.
+ * Be warned, it does not handle padding and message digest, do not
+ * confuse it with the full FIPS 180-1 digest algorithm for variable
+ * length messages.
+ *
+ * Note: If the hash is security sensitive, the caller should be sure
+ * to clear the workspace. This is left to the caller to avoid
+ * unnecessary clears between chained hashing operations.
+ */
+void sha_transform(__u32 *digest, const char *in, __u32 *W)x+{x+	__u32 a, b, c, d, e, t, i;x+
+	for (i = 0; i < 16; i++)
+		W[i] = be32_to_cpu(((const __u32 *)in)[i]);x+
+	for (i = 0; i < 64; i++)
+		W[i+16] = rol32(W[i+13] ^ W[i+8] ^ W[i+2] ^ W[i], 1);x+
+	a = digest[0];
+	b = digest[1];
+	c = digest[2];
+	d = digest[3];
+	e = digest[4];x+
+	for (i = 0; i < 20; i++) {x+		t = f1(b, c, d) + K1 + rol32(a, 5) + e + W[i];x+		e = d; d = c; c = rol32(b, 30); b = a; a = t;
+	}x+
+	for (; i < 40; i ++) {x+		t = f2(b, c, d) + K2 + rol32(a, 5) + e + W[i];x+		e = d; d = c; c = rol32(b, 30); b = a; a = t;
+	}x+
+	for (; i < 60; i ++) {x+		t = f3(b, c, d) + K3 + rol32(a, 5) + e + W[i];x+		e = d; d = c; c = rol32(b, 30); b = a; a = t;
+	}x+
+	for (; i < 80; i ++) {x+		t = f2(b, c, d) + K4 + rol32(a, 5) + e + W[i];x+		e = d; d = c; c = rol32(b, 30); b = a; a = t;
+	}x+
+	digest[0] += a;
+	digest[1] += b;
+	digest[2] += c;
+	digest[3] += d;x+	digest[4] += e;x+}x+EXPORT_SYMBOL(sha_transform);x+
+/*
+ * sha_init: initialize the vectors for a SHA1 digest
+ *
+ * @buf: vector to initialize
+ */
+void sha_init(__u32 *buf)x+{x+	buf[0] = 0x67452301;
+	buf[1] = 0xefcdab89;
+	buf[2] = 0x98badcfe;
+	buf[3] = 0x10325476;
+	buf[4] = 0xc3d2e1f0;x+}x+
diff -Nru a/lib/sort.c b/lib/sort.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/lib/sort.c	2005-03-07 20:41:45 -08:00
@@ -0,0 +1,119 @@
+/*
+ * A fast, small, non-recursive O(nlog n) sort for the Linux kernel
+ *
+ * Jan 23 2005  Matt Mackall <mpm@selenic.com>
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+void u32_swap(void *a, void *b, int size)
+{x+	u32 t = *(u32 *)a;
+	*(u32 *)a = *(u32 *)b;
+	*(u32 *)b = t;
+}
+
+void generic_swap(void *a, void *b, int size)
+{x+	char t;x+
+	do {x+		t = *(char *)a;
+		*(char *)a++ = *(char *)b;
+		*(char *)b++ = t;
+	} while (--size > 0);x+}x+
+/*
+ * sort - sort an array of elements
+ * @base: pointer to data to sort
+ * @num: number of elements
+ * @size: size of each element
+ * @cmp: pointer to comparison function
+ * @swap: pointer to swap function or NULL
+ *
+ * This function does a heapsort on the given array. You may provide a
+ * swap function optimized to your element type.
+ *
+ * Sorting time is O(n log n) both on average and worst-case. While
+ * qsort is about 20% faster on average, it suffers from exploitable
+ * O(n*n) worst-case behavior and extra memory requirements that make
+ * it less suitable for kernel use.
+ */
+
+void sort(void *base, size_t num, size_t size,
+	  int (*cmp)(const void *, const void *),
+	  void (*swap)(void *, void *, int size))
+{x+	/* pre-scale counters for performance */
+	int i = (num/2) * size, n = num * size, c, r;
+x+	if (!swap)x+		swap = (size == 4 ? u32_swap : generic_swap);x+x+	/* heapify */
+	for ( ; i >= 0; i -= size) {x+		for (r = i; r * 2 < n; r  = c) {x+			c = r * 2;x+			if (c < n - size && cmp(base + c, base + c + size) < 0)x+				c += size;x+			if (cmp(base + r, base + c) >= 0)x+				break;x+			swap(base + r, base + c, size);
+		}
+	}x+
+	/* sort */
+	for (i = n - size; i >= 0; i -= size) {x+		swap(base, base + i, size);
+		for (r = 0; r * 2 < i; r = c) {x+			c = r * 2;x+			if (c < i - size && cmp(base + c, base + c + size) < 0)x+				c += size;x+			if (cmp(base + r, base + c) >= 0)x+				break;x+			swap(base + r, base + c, size);
+		}
+	}x+}
+x+EXPORT_SYMBOL(sort);
+
+#if 0
+/* a simple boot-time regression test */
+
+int cmpint(const void *a, const void *b)x+{x+	return *(int *)a - *(int *)b;x+}x+
+static int sort_test(void)
+{x+	int *a, i, r = 0;x+x+	a = kmalloc(1000 * sizeof(int), GFP_KERNEL);
+	BUG_ON(!a);x+x+	printk("testing sort()\n");x+
+	for (i = 0; i < 1000; i++) {x+		r = (r * 725861) % 6599;
+		a[i] = r;
+	}x+
+	sort(a, 1000, sizeof(int), cmpint, NULL);
+
+	for (i = 0; i < 999; i++)
+		if (a[i] > a[i+1]) {x+			printk("sort() failed!\n");x+			break;x+		}x+
+	kfree(a);x+x+	return 0;x+}x+
+module_init(sort_test);
+#endif
diff -Nru a/mm/filemap.c b/mm/filemap.c
--- a/mm/filemap.c	2005-02-14 10:31:41 -08:00
+++ b/mm/filemap.c	2005-03-07 20:41:23 -08:00
@@ -126,9 +126,9 @@
 	if (unlikely(!PageLocked(page)))
 		PAGE_BUG(page);
 
-	spin_lock_irq(&mapping->tree_lock);x+	write_lock_irq(&mapping->tree_lock);x 	__remove_from_page_cache(page);
-	spin_unlock_irq(&mapping->tree_lock);x+	write_unlock_irq(&mapping->tree_lock);x }
 
 static int sync_page(void *word)
@@ -336,6 +336,22 @@
 	return retval;x }
 
+int filemap_write_and_wait_range(struct address_space *mapping,
+				 loff_t lstart, loff_t lend)
+{x+	int retval = 0;x+x+	if (mapping->nrpages) {x+		retval = __filemap_fdatawrite_range(mapping, lstart, lend,
+						    WB_SYNC_ALL);
+		if (retval == 0)x+			retval = wait_on_page_writeback_range(mapping,
+						    lstart >> PAGE_CACHE_SHIFT,
+						    lend >> PAGE_CACHE_SHIFT);
+	}x+	return retval;x+}x+
 /*
  * This function is used to add newly allocated pagecache pages:
  * the page is new, so we can just run SetPageLocked() against it.
@@ -349,7 +365,7 @@
 	int error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
 x 	if (error == 0) {x-		spin_lock_irq(&mapping->tree_lock);x+		write_lock_irq(&mapping->tree_lock);x 		error = radix_tree_insert(&mapping->page_tree, offset, page);
 		if (!error) {x 			page_cache_get(page);
@@ -359,7 +375,7 @@
 			mapping->nrpages++;x 			pagecache_acct(1);
 		}
-		spin_unlock_irq(&mapping->tree_lock);x+		write_unlock_irq(&mapping->tree_lock);x 		radix_tree_preload_end();x 	}
 	return error;x@@ -472,11 +488,11 @@
 {x 	struct page *page;
 
-	spin_lock_irq(&mapping->tree_lock);x+	read_lock_irq(&mapping->tree_lock);x 	page = radix_tree_lookup(&mapping->page_tree, offset);
 	if (page)x 		page_cache_get(page);
-	spin_unlock_irq(&mapping->tree_lock);x+	read_unlock_irq(&mapping->tree_lock);x 	return page;
 }
 x@@ -489,11 +505,11 @@
 {x 	struct page *page;
 
-	spin_lock_irq(&mapping->tree_lock);x+	read_lock_irq(&mapping->tree_lock);x 	page = radix_tree_lookup(&mapping->page_tree, offset);
 	if (page && TestSetPageLocked(page))x 		page = NULL;
-	spin_unlock_irq(&mapping->tree_lock);x+	read_unlock_irq(&mapping->tree_lock);x 	return page;
 }
 x@@ -515,15 +531,15 @@
 {x 	struct page *page;
 
-	spin_lock_irq(&mapping->tree_lock);x+	read_lock_irq(&mapping->tree_lock);x repeat:x 	page = radix_tree_lookup(&mapping->page_tree, offset);
 	if (page) {x 		page_cache_get(page);
 		if (TestSetPageLocked(page)) {x-			spin_unlock_irq(&mapping->tree_lock);x+			read_unlock_irq(&mapping->tree_lock);x 			lock_page(page);
-			spin_lock_irq(&mapping->tree_lock);x+			read_lock_irq(&mapping->tree_lock);x 
 			/* Has the page been truncated while we slept? */
 			if (page->mapping != mapping || page->index != offset) {x@@ -533,7 +549,7 @@
 			}x 		}x 	}
-	spin_unlock_irq(&mapping->tree_lock);x+	read_unlock_irq(&mapping->tree_lock);x 	return page;
 }
 x@@ -607,12 +623,12 @@
 	unsigned int i;
 	unsigned int ret;
 
-	spin_lock_irq(&mapping->tree_lock);x+	read_lock_irq(&mapping->tree_lock);x 	ret = radix_tree_gang_lookup(&mapping->page_tree,
 				(void **)pages, start, nr_pages);x 	for (i = 0; i < ret; i++)
 		page_cache_get(pages[i]);x-	spin_unlock_irq(&mapping->tree_lock);x+	read_unlock_irq(&mapping->tree_lock);x 	return ret;
 }
 
@@ -626,14 +642,14 @@
 	unsigned int i;
 	unsigned int ret;
 
-	spin_lock_irq(&mapping->tree_lock);x+	read_lock_irq(&mapping->tree_lock);x 	ret = radix_tree_gang_lookup_tag(&mapping->page_tree,
 				(void **)pages, *index, nr_pages, tag);x 	for (i = 0; i < ret; i++)
 		page_cache_get(pages[i]);x 	if (ret)
 		*index = pages[ret - 1]->index + 1;x-	spin_unlock_irq(&mapping->tree_lock);x+	read_unlock_irq(&mapping->tree_lock);x 	return ret;
 }
 
@@ -691,7 +707,7 @@
 	unsigned long index;
 	unsigned long end_index;
 	unsigned long offset;x-	unsigned long req_size;x+	unsigned long last_index;
 	unsigned long next_index;
 	unsigned long prev_index;
 	loff_t isize;x@@ -703,7 +719,7 @@
 	index = *ppos >> PAGE_CACHE_SHIFT;
 	next_index = index;
 	prev_index = ra.prev_page;
-	req_size = (desc->count + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
+	last_index = (*ppos + desc->count + PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT;
 	offset = *ppos & ~PAGE_CACHE_MASK;
 x 	isize = i_size_read(inode);x@@ -713,7 +729,7 @@
 	end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
 	for (;;) {x 		struct page *page;
-		unsigned long ret_size, nr, ret;
+		unsigned long nr, ret;
 x 		/* nr is the maximum number of bytes to copy from this page */
 		nr = PAGE_CACHE_SIZE;x@@ -728,12 +744,9 @@
 		nr = nr - offset;x x 		cond_resched();x-		if (index == next_index && req_size) {x-			ret_size = page_cache_readahead(mapping, &ra,x-					filp, index, req_size);
-			next_index += ret_size;x-			req_size -= ret_size;x-		}
+		if (index == next_index)x+			next_index = page_cache_readahead(mapping, &ra, filp,
+					index, last_index - index);x 
 find_page:x 		page = find_get_page(mapping, index);x@@ -2269,21 +2282,28 @@
 	struct file *file = iocb->ki_filp;x 	struct address_space *mapping = file->f_mapping;x 	ssize_t retval;x+	size_t write_len = 0;
 x 	/*
 	 * If it's a write, unmap all mmappings of the file up-front.  This
 	 * will cause any pte dirty bits to be propagated into the pageframes
 	 * for the subsequent filemap_write_and_wait().
 	 */
-	if (rw == WRITE && mapping_mapped(mapping))x-		unmap_mapping_range(mapping, 0, -1, 0);x+	if (rw == WRITE) {x+		write_len = iov_length(iov, nr_segs);
+	       	if (mapping_mapped(mapping))x+			unmap_mapping_range(mapping, offset, write_len, 0);x+	}
 
 	retval = filemap_write_and_wait(mapping);x 	if (retval == 0) {x 		retval = mapping->a_ops->direct_IO(rw, iocb, iov,
 						offset, nr_segs);
 		if (rw == WRITE && mapping->nrpages) {x-			int err = invalidate_inode_pages2(mapping);x+			pgoff_t end = (offset + write_len - 1)
+						>> PAGE_CACHE_SHIFT;
+			int err = invalidate_inode_pages2_range(mapping,
+					offset >> PAGE_CACHE_SHIFT, end);
 			if (err)
 				retval = err;
 		}
diff -Nru a/mm/fremap.c b/mm/fremap.c
--- a/mm/fremap.c	2004-12-22 01:31:46 -08:00
+++ b/mm/fremap.c	2005-03-06 16:55:23 -08:00
@@ -30,7 +30,7 @@
 	if (pte_present(pte)) {x 		unsigned long pfn = pte_pfn(pte);
 
-		flush_cache_page(vma, addr);
+		flush_cache_page(vma, addr, pfn);
 		pte = ptep_clear_flush(vma, addr, ptep);
 		if (pfn_valid(pfn)) {x 			struct page *page = pfn_to_page(pfn);
@@ -45,7 +45,7 @@
 	} else {
 		if (!pte_file(pte))x 			free_swap_and_cache(pte_to_swp_entry(pte));x-		pte_clear(ptep);
+		pte_clear(mm, addr, ptep);
 	}
 }
 
@@ -94,7 +94,7 @@
 
 	mm->rss++;x 	flush_icache_page(vma, page);
-	set_pte(pte, mk_pte(page, prot));x+	set_pte_at(mm, addr, pte, mk_pte(page, prot));x 	page_add_file_rmap(page);
 	pte_val = *pte;
 	pte_unmap(pte);
@@ -139,7 +139,7 @@
 
 	zap_pte(mm, vma, addr, pte);
 
-	set_pte(pte, pgoff_to_pte(pgoff));x+	set_pte_at(mm, addr, pte, pgoff_to_pte(pgoff));x 	pte_val = *pte;
 	pte_unmap(pte);
 	update_mmu_cache(vma, addr, pte_val);xdiff -Nru a/mm/highmem.c b/mm/highmem.c
--- a/mm/highmem.c	2005-02-28 09:40:57 -08:00
+++ b/mm/highmem.c	2005-03-01 15:04:37 -08:00
@@ -90,7 +90,8 @@
 		 * So no dangers, even with speculative execution.
 		 */x 		page = pte_page(pkmap_page_table[i]);x-		pte_clear(&pkmap_page_table[i]);x+		pte_clear(&init_mm, (unsigned long)page_address(page),
+			  &pkmap_page_table[i]);x 
 		set_page_address(page, NULL);
 	}
@@ -138,7 +139,8 @@
 		}x 	}
 	vaddr = PKMAP_ADDR(last_pkmap_nr);
-	set_pte(&(pkmap_page_table[last_pkmap_nr]), mk_pte(page, kmap_prot));x+	set_pte_at(&init_mm, vaddr,
+		   &(pkmap_page_table[last_pkmap_nr]), mk_pte(page, kmap_prot));x 
 	pkmap_count[last_pkmap_nr] = 1;
 	set_page_address(page, (void *)vaddr);
diff -Nru a/mm/memory.c b/mm/memory.c
--- a/mm/memory.c	2005-02-15 18:45:11 -08:00
+++ b/mm/memory.c	2005-03-07 20:41:22 -08:00
@@ -46,7 +46,6 @@
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
 #include <linux/rmap.h>
-#include <linux/acct.h>
 #include <linux/module.h>
 #include <linux/init.h>
 
@@ -278,7 +277,7 @@
 	/* pte contains position in swap, so copy. */x 	if (!pte_present(pte)) {x 		copy_swap_pte(dst_mm, src_mm, pte);
-		set_pte(dst_pte, pte);x+		set_pte_at(dst_mm, addr, dst_pte, pte);x 		return;
 	}
 	pfn = pte_pfn(pte);
@@ -292,7 +291,7 @@
 		page = pfn_to_page(pfn);
 x 	if (!page || PageReserved(page)) {x-		set_pte(dst_pte, pte);x+		set_pte_at(dst_mm, addr, dst_pte, pte);x 		return;
 	}
 
@@ -301,7 +300,7 @@
 	 * in the parent and the child
 	 */
 	if ((vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE) {x-		ptep_set_wrprotect(src_pte);x+		ptep_set_wrprotect(src_mm, addr, src_pte);x 		pte = *src_pte;
 	}
 
@@ -316,7 +315,7 @@
 	dst_mm->rss++;x 	if (PageAnon(page))x 		dst_mm->anon_rss++;x-	set_pte(dst_pte, pte);x+	set_pte_at(dst_mm, addr, dst_pte, pte);x 	page_dup_rmap(page);
 }
 
@@ -328,21 +327,33 @@
 	pte_t *s, *d;
 	unsigned long vm_flags = vma->vm_flags;
 x+again:x 	d = dst_pte = pte_alloc_map(dst_mm, dst_pmd, addr);
 	if (!dst_pte)x 		return -ENOMEM;
 x 	spin_lock(&src_mm->page_table_lock);x 	s = src_pte = pte_offset_map_nested(src_pmd, addr);
-	for (; addr < end; addr += PAGE_SIZE, s++, d++) {x-		if (pte_none(*s))x-			continue;x-		copy_one_pte(dst_mm, src_mm, d, s, vm_flags, addr);
+	for (; addr < end; s++, d++) {x+		if (!pte_none(*s))x+			copy_one_pte(dst_mm, src_mm, d, s, vm_flags, addr);
+		addr += PAGE_SIZE;
+		/*
+		 * We are holding two locks at this point - either of them
+		 * could generate latencies in another task on another CPU.
+		 */x+		if (need_resched() ||
+		    need_lockbreak(&src_mm->page_table_lock) ||
+		    need_lockbreak(&dst_mm->page_table_lock))x+			break;x 	}
 	pte_unmap_nested(src_pte);
 	pte_unmap(dst_pte);x 	spin_unlock(&src_mm->page_table_lock);x+x 	cond_resched_lock(&dst_mm->page_table_lock);x+	if (addr < end)x+		goto again;
 	return 0;x }
 
@@ -502,14 +513,15 @@
 				     page->index > details->last_index))x 					continue;x 			}x-			pte = ptep_get_and_clear(ptep);
+			pte = ptep_get_and_clear(tlb->mm, address+offset, ptep);
 			tlb_remove_tlb_entry(tlb, ptep, address+offset);
 			if (unlikely(!page))x 				continue;x 			if (unlikely(details) && details->nonlinear_vmax 			    && linear_page_index(details->nonlinear_vma,
 					address+offset) != page->index)x-				set_pte(ptep, pgoff_to_pte(page->index));
+				set_pte_at(tlb->mm, address+offset,
+					   ptep, pgoff_to_pte(page->index));
 			if (pte_dirty(pte))x 				set_page_dirty(page);
 			if (PageAnon(page))x@@ -529,7 +541,7 @@
 			continue;x 		if (!pte_file(pte))x 			free_swap_and_cache(pte_to_swp_entry(pte));x-		pte_clear(ptep);
+		pte_clear(tlb->mm, address+offset, ptep);
 	}
 	pte_unmap(ptep-1);
 }
@@ -735,7 +747,6 @@
 	tlb = tlb_gather_mmu(mm, 0);
 	unmap_vmas(&tlb, mm, vma, address, end, &nr_accounted, details);
 	tlb_finish_mmu(tlb, address, end);x-	acct_update_integrals();x 	spin_unlock(&mm->page_table_lock);x }
 
@@ -987,19 +998,21 @@
 
 EXPORT_SYMBOL(get_user_pages);x 
-static void zeromap_pte_range(pte_t * pte, unsigned long address,
-                                     unsigned long size, pgprot_t prot)
+static void zeromap_pte_range(struct mm_struct *mm, pte_t * pte,
+			      unsigned long address,
+			      unsigned long size, pgprot_t prot)
 {x-	unsigned long end;x+	unsigned long base, end;x 
+	base = address & PMD_MASK;
 	address &= ~PMD_MASK;
 	end = address + size;x 	if (end > PMD_SIZE)x 		end = PMD_SIZE;x 	do {x-		pte_t zero_pte = pte_wrprotect(mk_pte(ZERO_PAGE(address), prot));x+		pte_t zero_pte = pte_wrprotect(mk_pte(ZERO_PAGE(base+address), prot));x 		BUG_ON(!pte_none(*pte));x-		set_pte(pte, zero_pte);x+		set_pte_at(mm, base+address, pte, zero_pte);x 		address += PAGE_SIZE;
 		pte++;x 	} while (address && (address < end));
@@ -1019,7 +1032,7 @@
 		pte_t * pte = pte_alloc_map(mm, pmd, base + address);x 		if (!pte)x 			return -ENOMEM;
-		zeromap_pte_range(pte, base + address, end - address, prot);x+		zeromap_pte_range(mm, pte, base + address, end - address, prot);x 		pte_unmap(pte);
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;x@@ -1100,11 +1113,13 @@
  * in null mappings (currently treated as "copy-on-access")
  */
 static inline void
-remap_pte_range(pte_t * pte, unsigned long address, unsigned long size,
+remap_pte_range(struct mm_struct *mm, pte_t * pte,
+		unsigned long address, unsigned long size,
 		unsigned long pfn, pgprot_t prot)
 {x-	unsigned long end;x+	unsigned long base, end;x 
+	base = address & PMD_MASK;
 	address &= ~PMD_MASK;
 	end = address + size;x 	if (end > PMD_SIZE)x@@ -1112,7 +1127,7 @@
 	do {x 		BUG_ON(!pte_none(*pte));x 		if (!pfn_valid(pfn) || PageReserved(pfn_to_page(pfn)))x- 			set_pte(pte, pfn_pte(pfn, prot));x+			set_pte_at(mm, base+address, pte, pfn_pte(pfn, prot));x 		address += PAGE_SIZE;
 		pfn++;x 		pte++;x@@ -1135,7 +1150,7 @@
 		pte_t * pte = pte_alloc_map(mm, pmd, base + address);x 		if (!pte)x 			return -ENOMEM;
-		remap_pte_range(pte, base + address, end - address,x+		remap_pte_range(mm, pte, base + address, end - address,
 				(address >> PAGE_SHIFT) + pfn, prot);x 		pte_unmap(pte);
 		address = (address + PMD_SIZE) & PMD_MASK;
@@ -1247,7 +1262,6 @@
 {
 	pte_t entry;x 
-	flush_cache_page(vma, address);x 	entry = maybe_mkwrite(pte_mkdirty(mk_pte(new_page, vma->vm_page_prot)),x 			      vma);
 	ptep_establish(vma, address, page_table, entry);
@@ -1299,7 +1313,7 @@
 		int reuse = can_share_swap_page(old_page);
 		unlock_page(old_page);
 		if (reuse) {x-			flush_cache_page(vma, address);x+			flush_cache_page(vma, address, pfn);
 			entry = maybe_mkwrite(pte_mkyoung(pte_mkdirty(pte)),
 					      vma);
 			ptep_set_access_flags(vma, address, page_table, entry, 1);x@@ -1338,12 +1352,11 @@
 	if (likely(pte_same(*page_table, pte))) {
 		if (PageAnon(old_page))x 			mm->anon_rss--;x-		if (PageReserved(old_page)) {x+		if (PageReserved(old_page))x 			++mm->rss;x-			acct_update_integrals();x-			update_mem_hiwater();x-		} elsex+		elsex 			page_remove_rmap(old_page);
+		flush_cache_page(vma, address, pfn);
 		break_cow(vma, new_page, address, page_table);x 		lru_cache_add_active(new_page);x 		page_add_anon_rmap(new_page, vma, address);x@@ -1747,9 +1760,6 @@
 		remove_exclusive_swap_page(page);
 
 	mm->rss++;x-	acct_update_integrals();x-	update_mem_hiwater();x-
 	pte = mk_pte(page, vma->vm_page_prot);x 	if (write_access && can_share_swap_page(page)) {x 		pte = maybe_mkwrite(pte_mkdirty(pte), vma);
@@ -1758,7 +1768,7 @@
 	unlock_page(page);
 x 	flush_icache_page(vma, page);
-	set_pte(page_table, pte);x+	set_pte_at(mm, address, page_table, pte);x 	page_add_anon_rmap(page, vma, address);x x 	if (write_access) {x@@ -1814,8 +1824,6 @@
 			goto out;
 		}x 		mm->rss++;x-		acct_update_integrals();x-		update_mem_hiwater();x 		entry = maybe_mkwrite(pte_mkdirty(mk_pte(page,
 							 vma->vm_page_prot)),x 				      vma);
@@ -1824,7 +1832,7 @@
 		page_add_anon_rmap(page, vma, addr);
 	}
 
-	set_pte(page_table, entry);
+	set_pte_at(mm, addr, page_table, entry);
 	pte_unmap(page_table);x 
 	/* No need to invalidate - it was non-present before */
@@ -1932,14 +1940,12 @@
 	if (pte_none(*page_table)) {
 		if (!PageReserved(new_page))x 			++mm->rss;x-		acct_update_integrals();x-		update_mem_hiwater();x x 		flush_icache_page(vma, new_page);x 		entry = mk_pte(new_page, vma->vm_page_prot);
 		if (write_access)
 			entry = maybe_mkwrite(pte_mkdirty(entry), vma);
-		set_pte(page_table, entry);
+		set_pte_at(mm, address, page_table, entry);
 		if (anon) {x 			lru_cache_add_active(new_page);x 			page_add_anon_rmap(new_page, vma, address);x@@ -1983,7 +1989,7 @@
 	 */x 	if (!vma->vm_ops || !vma->vm_ops->populate || x 			(write_access && !(vma->vm_flags & VM_SHARED))) {x-		pte_clear(pte);
+		pte_clear(mm, address, pte);x 		return do_no_page(mm, vma, address, write_access, pte, pmd);
 	}
 
@@ -2253,10 +2259,8 @@
  * update_mem_hiwater
  *	- update per process rss and vm high water data
  */
-void update_mem_hiwater(void)
+void update_mem_hiwater(struct task_struct *tsk)
 {x-	struct task_struct *tsk = current;x-
 	if (tsk->mm) {
 		if (tsk->mm->hiwater_rss < tsk->mm->rss)
 			tsk->mm->hiwater_rss = tsk->mm->rss;
diff -Nru a/mm/mempool.c b/mm/mempool.c
--- a/mm/mempool.c	2004-08-26 23:31:37 -07:00
+++ b/mm/mempool.c	2005-03-07 20:41:22 -08:00
@@ -114,8 +114,8 @@
 	BUG_ON(new_min_nr <= 0);x 
 	spin_lock_irqsave(&pool->lock, flags);
-	if (new_min_nr < pool->min_nr) {x-		while (pool->curr_nr > new_min_nr) {x+	if (new_min_nr <= pool->min_nr) {x+		while (new_min_nr < pool->curr_nr) {x 			element = remove_element(pool);x 			spin_unlock_irqrestore(&pool->lock, flags);
 			pool->free(element, pool->pool_data);x@@ -132,6 +132,12 @@
 		return -ENOMEM;
 x 	spin_lock_irqsave(&pool->lock, flags);
+	if (unlikely(new_min_nr <= pool->min_nr)) {x+		/* Raced, other resize will do our work */x+		spin_unlock_irqrestore(&pool->lock, flags);
+		kfree(new_elements);
+		goto out;
+	}
 	memcpy(new_elements, pool->elements,
 			pool->curr_nr * sizeof(*new_elements));
 	kfree(pool->elements);x@@ -149,7 +155,7 @@
 		} else {
 			spin_unlock_irqrestore(&pool->lock, flags);
 			pool->free(element, pool->pool_data);	/* Raced */
-			spin_lock_irqsave(&pool->lock, flags);
+			goto out;
 		}x 	}x out_unlock:
diff -Nru a/mm/mincore.c b/mm/mincore.c
--- a/mm/mincore.c	2005-02-11 10:44:26 -08:00
+++ b/mm/mincore.c	2005-03-07 20:41:22 -08:00
@@ -97,8 +97,7 @@
  * return values:
  *  zero    - success
  *  -EFAULT - vec points to an illegal address
- *  -EINVAL - addr is not a multiple of PAGE_CACHE_SIZE,
- *		or len has a nonpositive value
+ *  -EINVAL - addr is not a multiple of PAGE_CACHE_SIZE
  *  -ENOMEM - Addresses in the range [addr, addr + len] are
  *		invalid for the address space of this process, or
  *		specify one or more pages which are not currently
@@ -126,10 +125,13 @@
 	if (start >= limit)
 		goto enomem;x x+	if (!len)
+		return 0;x+x 	max = limit - start;
 	len = PAGE_CACHE_ALIGN(len);
-	if (len > max)x-		goto einval;
+	if (len > max || !len)
+		goto enomem;x x 	end = start + len;x xdiff -Nru a/mm/mmap.c b/mm/mmap.c
--- a/mm/mmap.c	2005-02-11 11:07:35 -08:00
+++ b/mm/mmap.c	2005-03-07 20:41:22 -08:00
@@ -21,7 +21,6 @@
 #include <linux/hugetlb.h>
 #include <linux/profile.h>
 #include <linux/module.h>
-#include <linux/acct.h>
 #include <linux/mount.h>
 #include <linux/mempolicy.h>
 #include <linux/rmap.h>
@@ -1121,8 +1120,6 @@
 					pgoff, flags & MAP_NONBLOCK);
 		down_write(&mm->mmap_sem);x 	}x-	acct_update_integrals();x-	update_mem_hiwater();x 	return addr;x x unmap_and_free_vma:
@@ -1221,19 +1218,14 @@
 			  const unsigned long len, const unsigned long pgoff,
 			  const unsigned long flags)
 {x-	struct vm_area_struct *vma, *prev_vma;
+	struct vm_area_struct *vma;x 	struct mm_struct *mm = current->mm;x-	unsigned long base = mm->mmap_base, addr = addr0;
-	int first_time = 1;
+	unsigned long addr = addr0;
 
 	/* requested length too big for entire address space */x 	if (len > TASK_SIZE)x 		return -ENOMEM;
 x-	/* dont allow allocations above current base */
-	if (mm->free_area_cache > base)x-		mm->free_area_cache = base;x-
 	/* requesting a specific address */x 	if (addr) {
 		addr = PAGE_ALIGN(addr);
@@ -1243,48 +1235,34 @@
 			return addr;x 	}
 
-try_again:x+	/* either no address requested or can't fit in requested address hole */
+	addr = mm->free_area_cache;x+x 	/* make sure it can fit in the remaining address space */x-	if (mm->free_area_cache < len)
-		goto fail;x+	if (addr >= len) {x+		vma = find_vma(mm, addr-len);
+		if (!vma || addr <= vma->vm_start)x+			/* remember the address as a hint for next time */x+			return (mm->free_area_cache = addr-len);
+	}x+
+	addr = mm->mmap_base-len;x x-	/* either no address requested or cant fit in requested address hole */
-	addr = (mm->free_area_cache - len) & PAGE_MASK;
 	do {x 		/*
 		 * Lookup failure means no vma is above this address,
-		 * i.e. return with success:
-		 */x- 	 	if (!(vma = find_vma_prev(mm, addr, &prev_vma)))x-			return addr;x-x-		/*
-		 * new region fits between prev_vma->vm_end and
-		 * vma->vm_start, use it:
+		 * else if new region fits below vma->vm_start,
+		 * return with success:
 		 */x-		if (addr+len <= vma->vm_start &&x-				(!prev_vma || (addr >= prev_vma->vm_end)))x+		vma = find_vma(mm, addr);
+		if (!vma || addr+len <= vma->vm_start)
 			/* remember the address as a hint for next time */x 			return (mm->free_area_cache = addr);
-		elsex-			/* pull free_area_cache down to the first hole */
-			if (mm->free_area_cache == vma->vm_end)x-				mm->free_area_cache = vma->vm_start;
 x 		/* try just below the current vma->vm_start */x 		addr = vma->vm_start-len;x 	} while (len <= vma->vm_start);x x-fail:x-	/*x-	 * if hint left us with no space for the requestedx-	 * mapping then try again:x-	 */
-	if (first_time) {x-		mm->free_area_cache = base;x-		first_time = 0;
-		goto try_again;
-	}x 	/*
 	 * A failed mmap() very likely causes application failure,
 	 * so fall back to the bottom-up function here. This scenario
@@ -1296,7 +1274,7 @@
 	/*
 	 * Restore the topdown base:
 	 */
-	mm->free_area_cache = base;x+	mm->free_area_cache = mm->mmap_base;
 
 	return addr;x }
@@ -1309,6 +1287,10 @@
 	 */x 	if (area->vm_end > area->vm_mm->free_area_cache)
 		area->vm_mm->free_area_cache = area->vm_end;x+x+	/* dont allow allocations above current base */
+	if (area->vm_mm->free_area_cache > area->vm_mm->mmap_base)x+		area->vm_mm->free_area_cache = area->vm_mm->mmap_base;
 }x x unsigned longx@@ -1463,8 +1445,6 @@
 	if (vma->vm_flags & VM_LOCKED)x 		mm->locked_vm += grow;x 	__vm_stat_account(mm, vma->vm_flags, vma->vm_file, grow);x-	acct_update_integrals();x-	update_mem_hiwater();x 	return 0;x }
 
@@ -1968,8 +1948,6 @@
 		mm->locked_vm += len >> PAGE_SHIFT;
 		make_pages_present(addr, addr + len);x 	}x-	acct_update_integrals();x-	update_mem_hiwater();x 	return addr;x }x xdiff -Nru a/mm/mprotect.c b/mm/mprotect.c
--- a/mm/mprotect.c	2004-12-22 01:31:46 -08:00
+++ b/mm/mprotect.c	2005-02-26 20:50:16 -08:00
@@ -26,11 +26,11 @@
 #include <asm/tlbflush.h>
 
 static inline void
-change_pte_range(pmd_t *pmd, unsigned long address,
+change_pte_range(struct mm_struct *mm, pmd_t *pmd, unsigned long address,
 		unsigned long size, pgprot_t newprot)
 {x 	pte_t * pte;x-	unsigned long end;x+	unsigned long base, end;x 
 	if (pmd_none(*pmd))x 		return;
@@ -40,6 +40,7 @@
 		return;
 	}
 	pte = pte_offset_map(pmd, address);x+	base = address & PMD_MASK;
 	address &= ~PMD_MASK;
 	end = address + size;x 	if (end > PMD_SIZE)x@@ -52,8 +53,8 @@
 			 * bits by wiping the pte and then setting the new pte
 			 * into place.
 			 */
-			entry = ptep_get_and_clear(pte);
-			set_pte(pte, pte_modify(entry, newprot));
+			entry = ptep_get_and_clear(mm, base + address, pte);
+			set_pte_at(mm, base + address, pte, pte_modify(entry, newprot));
 		}x 		address += PAGE_SIZE;
 		pte++;x@@ -62,11 +63,11 @@
 }
 
 static inline void
-change_pmd_range(pud_t *pud, unsigned long address,
-		unsigned long size, pgprot_t newprot)
+change_pmd_range(struct mm_struct *mm, pud_t *pud, unsigned long address,
+		 unsigned long size, pgprot_t newprot)
 {x 	pmd_t * pmd;x-	unsigned long end;x+	unsigned long base, end;x 
 	if (pud_none(*pud))x 		return;
@@ -76,23 +77,24 @@
 		return;
 	}
 	pmd = pmd_offset(pud, address);x+	base = address & PUD_MASK;
 	address &= ~PUD_MASK;
 	end = address + size;x 	if (end > PUD_SIZE)x 		end = PUD_SIZE;x 	do {x-		change_pte_range(pmd, address, end - address, newprot);
+		change_pte_range(mm, pmd, base + address, end - address, newprot);
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;x 	} while (address && (address < end));
 }
 
 static inline void
-change_pud_range(pgd_t *pgd, unsigned long address,
-		unsigned long size, pgprot_t newprot)
+change_pud_range(struct mm_struct *mm, pgd_t *pgd, unsigned long address,
+		 unsigned long size, pgprot_t newprot)
 {x 	pud_t * pud;x-	unsigned long end;x+	unsigned long base, end;x 
 	if (pgd_none(*pgd))x 		return;
@@ -102,12 +104,13 @@
 		return;
 	}
 	pud = pud_offset(pgd, address);x+	base = address & PGDIR_MASK;
 	address &= ~PGDIR_MASK;
 	end = address + size;x 	if (end > PGDIR_SIZE)x 		end = PGDIR_SIZE;x 	do {x-		change_pmd_range(pud, address, end - address, newprot);
+		change_pmd_range(mm, pud, base + address, end - address, newprot);
 		address = (address + PUD_SIZE) & PUD_MASK;
 		pud++;x 	} while (address && (address < end));
@@ -130,7 +133,7 @@
 		next = (start + PGDIR_SIZE) & PGDIR_MASK;
 		if (next <= start || next > end)x 			next = end;x-		change_pud_range(pgd, start, next - start, newprot);
+		change_pud_range(mm, pgd, start, next - start, newprot);
 		start = next;
 		pgd++;x 	}xdiff -Nru a/mm/mremap.c b/mm/mremap.c
--- a/mm/mremap.c	2005-01-07 21:44:05 -08:00
+++ b/mm/mremap.c	2005-03-05 20:47:57 -08:00
@@ -16,7 +16,6 @@
 #include <linux/fs.h>
 #include <linux/highmem.h>
 #include <linux/security.h>
-#include <linux/acct.h>
 #include <linux/syscalls.h>
 
 #include <asm/uaccess.h>
@@ -150,7 +149,7 @@
 			if (dst) {x 				pte_t pte;
 				pte = ptep_clear_flush(vma, old_addr, src);
-				set_pte(dst, pte);
+				set_pte_at(mm, new_addr, dst, pte);x 			} elsex 				error = -ENOMEM;
 			pte_unmap_nested(src);
@@ -255,9 +254,6 @@
 					   new_addr + new_len);x 	}x x-	acct_update_integrals();x-	update_mem_hiwater();x-
 	return new_addr;
 }
 
@@ -394,8 +390,6 @@
 				make_pages_present(addr + old_len,
 						   addr + new_len);x 			}x-			acct_update_integrals();x-			update_mem_hiwater();x 			ret = addr;
 			goto out;
 		}xdiff -Nru a/mm/nommu.c b/mm/nommu.c
--- a/mm/nommu.c	2005-02-08 05:54:19 -08:00
+++ b/mm/nommu.c	2005-03-04 22:41:14 -08:00
@@ -959,10 +959,8 @@
 {
 }
 
-void update_mem_hiwater(void)
+void update_mem_hiwater(struct task_struct *tsk)
 {x-	struct task_struct *tsk = current;x-
 	if (likely(tsk->mm)) {
 		if (tsk->mm->hiwater_rss < tsk->mm->rss)
 			tsk->mm->hiwater_rss = tsk->mm->rss;
diff -Nru a/mm/page-writeback.c b/mm/page-writeback.c
--- a/mm/page-writeback.c	2005-01-25 13:50:13 -08:00
+++ b/mm/page-writeback.c	2005-03-07 20:41:21 -08:00
@@ -289,6 +289,28 @@
 }
 EXPORT_SYMBOL(balance_dirty_pages_ratelimited);
 
+void throttle_vm_writeout(void)
+{x+	struct writeback_state wbs;
+	long background_thresh;
+	long dirty_thresh;
+
+        for ( ; ; ) {x+		get_dirty_limits(&wbs, &background_thresh, &dirty_thresh, NULL);
+
+                /*
+                 * Boost the allowable dirty threshold a bit for page
+                 * allocators so they don't get DoS'ed by heavy writers
+                 */
+                dirty_thresh += dirty_thresh / 10;      /* wheeee... */
+
+                if (wbs.nr_unstable + wbs.nr_writeback <= dirty_thresh)
+                        break;x+                blk_congestion_wait(WRITE, HZ/10);x+        }x+}
+x+
 /*
  * writeback at least _min_pages, and keep writing until the amount of dirty
  * memory is less than the background threshold, or until we're all clean.x@@ -601,7 +623,7 @@
 		struct address_space *mapping2;
 x 		if (mapping) {x-			spin_lock_irq(&mapping->tree_lock);x+			write_lock_irq(&mapping->tree_lock);x 			mapping2 = page_mapping(page);
 			if (mapping2) { /* Race with truncate? */
 				BUG_ON(mapping2 != mapping);
@@ -610,7 +632,7 @@
 				radix_tree_tag_set(&mapping->page_tree,
 					page_index(page), PAGECACHE_TAG_DIRTY);x 			}x-			spin_unlock_irq(&mapping->tree_lock);x+			write_unlock_irq(&mapping->tree_lock);x 			if (mapping->host) {x 				/* !PageAnon && !swapper_space */x 				__mark_inode_dirty(mapping->host,
@@ -685,17 +707,17 @@
 	unsigned long flags;
 x 	if (mapping) {x-		spin_lock_irqsave(&mapping->tree_lock, flags);
+		write_lock_irqsave(&mapping->tree_lock, flags);
 		if (TestClearPageDirty(page)) {x 			radix_tree_tag_clear(&mapping->page_tree,
 						page_index(page),
 						PAGECACHE_TAG_DIRTY);x-			spin_unlock_irqrestore(&mapping->tree_lock, flags);
+			write_unlock_irqrestore(&mapping->tree_lock, flags);
 			if (!mapping->backing_dev_info->memory_backed)x 				dec_page_state(nr_dirty);x 			return 1;
 		}
-		spin_unlock_irqrestore(&mapping->tree_lock, flags);
+		write_unlock_irqrestore(&mapping->tree_lock, flags);
 		return 0;x 	}
 	return TestClearPageDirty(page);
@@ -742,15 +764,15 @@
 	if (mapping) {x 		unsigned long flags;
 x-		spin_lock_irqsave(&mapping->tree_lock, flags);
+		write_lock_irqsave(&mapping->tree_lock, flags);
 		if (TestClearPageDirty(page)) {x 			radix_tree_tag_clear(&mapping->page_tree,
 						page_index(page),
 						PAGECACHE_TAG_DIRTY);x-			spin_unlock_irqrestore(&mapping->tree_lock, flags);
+			write_unlock_irqrestore(&mapping->tree_lock, flags);
 			return 1;
 		}
-		spin_unlock_irqrestore(&mapping->tree_lock, flags);
+		write_unlock_irqrestore(&mapping->tree_lock, flags);
 		return 0;x 	}
 	return TestClearPageDirty(page);
@@ -764,13 +786,13 @@
 	if (mapping) {x 		unsigned long flags;
 x-		spin_lock_irqsave(&mapping->tree_lock, flags);
+		write_lock_irqsave(&mapping->tree_lock, flags);
 		ret = TestClearPageWriteback(page);
 		if (ret)
 			radix_tree_tag_clear(&mapping->page_tree,
 						page_index(page),
 						PAGECACHE_TAG_WRITEBACK);
-		spin_unlock_irqrestore(&mapping->tree_lock, flags);
+		write_unlock_irqrestore(&mapping->tree_lock, flags);
 	} else {
 		ret = TestClearPageWriteback(page);
 	}
@@ -785,7 +807,7 @@
 	if (mapping) {x 		unsigned long flags;
 x-		spin_lock_irqsave(&mapping->tree_lock, flags);
+		write_lock_irqsave(&mapping->tree_lock, flags);
 		ret = TestSetPageWriteback(page);
 		if (!ret)
 			radix_tree_tag_set(&mapping->page_tree,
@@ -795,7 +817,7 @@
 			radix_tree_tag_clear(&mapping->page_tree,
 						page_index(page),
 						PAGECACHE_TAG_DIRTY);x-		spin_unlock_irqrestore(&mapping->tree_lock, flags);
+		write_unlock_irqrestore(&mapping->tree_lock, flags);
 	} else {
 		ret = TestSetPageWriteback(page);
 	}
@@ -813,9 +835,9 @@
 	unsigned long flags;
 	int ret;
 
-	spin_lock_irqsave(&mapping->tree_lock, flags);
+	read_lock_irqsave(&mapping->tree_lock, flags);
 	ret = radix_tree_tagged(&mapping->page_tree, tag);x-	spin_unlock_irqrestore(&mapping->tree_lock, flags);
+	read_unlock_irqrestore(&mapping->tree_lock, flags);
 	return ret;
 }
 EXPORT_SYMBOL(mapping_tagged);
diff -Nru a/mm/page_alloc.c b/mm/page_alloc.c
--- a/mm/page_alloc.c	2005-01-30 22:20:14 -08:00
+++ b/mm/page_alloc.c	2005-03-07 20:41:24 -08:00
@@ -191,6 +191,37 @@
 }
 
 /*
+ * Locate the struct page for both the matching buddy in our
+ * pair (buddy1) and the combined O(n+1) page they form (page).
+ *
+ * 1) Any buddy B1 will have an order O twin B2 which satisfies
+ * the following equation:
+ *     B2 = B1 ^ (1 << O)
+ * For example, if the starting buddy (buddy2) is #8 its order
+ * 1 buddy is #10:
+ *     B2 = 8 ^ (1 << 1) = 8 ^ 2 = 10
+ *
+ * 2) Any buddy B will have an order O+1 parent P which
+ * satisfies the following equation:
+ *     P = B & ~(1 << O)
+ *
+ * Assumption: *_mem_map is contigious at least up to MAX_ORDER
+ */
+static inline struct page *
+__page_find_buddy(struct page *page, unsigned long page_idx, unsigned int order)
+{x+	unsigned long buddy_idx = page_idx ^ (1 << order);x+x+	return page + (buddy_idx - page_idx);x+}x+
+static inline unsigned longx+__find_combined_index(unsigned long page_idx, unsigned int order)
+{x+	return (page_idx & ~(1 << order));x+}x+
+/*
  * This function checks whether a page is free && is the buddy
  * we can do coalesce a page and its buddy if
  * (a) the buddy is free &&
@@ -233,50 +264,49 @@
  * -- wli
  */
 
-static inline void __free_pages_bulk (struct page *page, struct page *base,
+static inline void __free_pages_bulk (struct page *page,
 		struct zone *zone, unsigned int order)
 {
 	unsigned long page_idx;x-	struct page *coalesced;
 	int order_size = 1 << order;
 x 	if (unlikely(order))
 		destroy_compound_page(page, order);x 
-	page_idx = page - base;x+	page_idx = page_to_pfn(page) & ((1 << MAX_ORDER) - 1);
 x 	BUG_ON(page_idx & (order_size - 1));
 	BUG_ON(bad_range(zone, page));
 x 	zone->free_pages += order_size;
 	while (order < MAX_ORDER-1) {
+		unsigned long combined_idx;
 		struct free_area *area;x 		struct page *buddy;x-		int buddy_idx;
 x-		buddy_idx = (page_idx ^ (1 << order));x-		buddy = base + buddy_idx;
+		combined_idx = __find_combined_index(page_idx, order);x+		buddy = __page_find_buddy(page, page_idx, order);x+
 		if (bad_range(zone, buddy))x 			break;x 		if (!page_is_buddy(buddy, order))x-			break;x-		/* Move the buddy up one level. */x+			break;		/* Move the buddy up one level. */x 		list_del(&buddy->lru);
 		area = zone->free_area + order;
 		area->nr_free--;x 		rmv_page_order(buddy);x-		page_idx &= buddy_idx;
+		page = page + (combined_idx - page_idx);x+		page_idx = combined_idx;
 		order++;x 	}x-	coalesced = base + page_idx;x-	set_page_order(coalesced, order);x-	list_add(&coalesced->lru, &zone->free_area[order].free_list);
+	set_page_order(page, order);x+	list_add(&page->lru, &zone->free_area[order].free_list);
 	zone->free_area[order].nr_free++;x }
 
 static inline void free_pages_check(const char *function, struct page *page)x {
-	if (	page_mapped(page) ||
+	if (	page_mapcount(page) ||
 		page->mapping != NULL ||
 		page_count(page) != 0 ||
 		(page->flags & (
@@ -309,10 +339,9 @@
 		struct list_head *list, unsigned int order)
 {
 	unsigned long flags;
-	struct page *base, *page = NULL;
+	struct page *page = NULL;
 	int ret = 0;
 x-	base = zone->zone_mem_map;x 	spin_lock_irqsave(&zone->lock, flags);
 	zone->all_unreclaimable = 0;
 	zone->pages_scanned = 0;
@@ -320,7 +349,7 @@
 		page = list_entry(list->prev, struct page, lru);
 		/* have to delete it as __free_pages_bulk list manipulates */x 		list_del(&page->lru);x-		__free_pages_bulk(page, base, zone, order);x+		__free_pages_bulk(page, zone, order);x 		ret++;x 	}x 	spin_unlock_irqrestore(&zone->lock, flags);
@@ -404,7 +433,7 @@
  */
 static void prep_new_page(struct page *page, int order)
 {
-	if (page->mapping || page_mapped(page) ||
+	if (page->mapping || page_mapcount(page) ||
 	    (page->flags & (
 			1 << PG_private	|
 			1 << PG_locked	|
diff -Nru a/mm/readahead.c b/mm/readahead.c
--- a/mm/readahead.c	2005-01-11 16:42:34 -08:00
+++ b/mm/readahead.c	2005-03-07 20:41:23 -08:00
@@ -55,7 +55,7 @@
 {
 	ra->start = 0;
 	ra->flags = 0;
-	ra->size = -1;
+	ra->size = 0;
 	ra->ahead_start = 0;
 	ra->ahead_size = 0;
 	return;
@@ -85,14 +85,16 @@
  * not for each call to readahead.  If a cache miss occured, reduce next I/O
  * size, else increase depending on how close to max we are.
  */
-static unsigned long get_next_ra_size(unsigned long cur, unsigned long max,x-				unsigned long min, unsigned long * flags)
+static inline unsigned long get_next_ra_size(struct file_ra_state *ra)
 {
+	unsigned long max = get_max_readahead(ra);x+	unsigned long min = get_min_readahead(ra);x+	unsigned long cur = ra->size;
 	unsigned long newsize;
 
-	if (*flags & RA_FLAG_MISS) {x+	if (ra->flags & RA_FLAG_MISS) {x+		ra->flags &= ~RA_FLAG_MISS;
 		newsize = max((cur - 2), min);
-		*flags &= ~RA_FLAG_MISS;
 	} else if (cur < max / 16) {x 		newsize = 4 * cur;
 	} else {
@@ -190,18 +192,16 @@
  * size:	Number of pages in that read
  *              Together, these form the "current window".
  *              Together, start and size represent the `readahead window'.
- * next_size:   The number of pages to read on the next readahead miss.
- *              Has the magical value -1UL if readahead has been disabled.
  * prev_page:   The page which the readahead algorithm most-recently inspected.
- *              prev_page is mainly an optimisation: if page_cache_readahead
- *		sees that it is again being called for a page which it just
- *		looked at, it can return immediately without making any state
- *		changes.
+ *              It is mainly used to detect sequential file reading.
+ *              If page_cache_readahead sees that it is again being called for
+ *              a page which it just looked at, it can return immediately without
+ *              making any state changes.
  * ahead_start,
  * ahead_size:  Together, these form the "ahead window".
  * ra_pages:	The externally controlled max readahead for this fd.
  *
- * When readahead is in the off state (size == -1UL), readahead is disabled.
+ * When readahead is in the off state (size == 0), readahead is disabled.
  * In this state, prev_page is used to detect the resumption of sequential I/O.
  *
  * The readahead code manages two windows - the "current" and the "ahead"
@@ -222,7 +222,7 @@
  *           ahead window.
  *
  * A `readahead hit' occurs when a read request is made against a page which is
- * the next sequential page. Ahead windowe calculations are done only when it
+ * the next sequential page. Ahead window calculations are done only when it
  * is time to submit a new IO.  The code ramps up the size agressively at first,
  * but slow down as it approaches max_readhead.
  *
@@ -233,12 +233,9 @@
  * read happens to be the first page of the file, it is assumed that a linear
  * read is about to happen and the window is immediately set to the initial size
  * based on I/O request size and the max_readahead.
- * 
- * A page request at (start + size) is not a miss at all - it's just a part of
- * sequential file reading.
  *
  * This function is to be called for every read request, rather than when
- * it is time to perform readahead.  It is called only oce for the entire I/O
+ * it is time to perform readahead.  It is called only once for the entire I/O
  * regardless of size unless readahead is unable to start enough I/O to satisfy
  * the request (I/O request > max_readahead).
  */
@@ -274,7 +271,7 @@
 	/*
 	 * Preallocate as many pages as we will need.
 	 */
-	spin_lock_irq(&mapping->tree_lock);x+	read_lock_irq(&mapping->tree_lock);x 	for (page_idx = 0; page_idx < nr_to_read; page_idx++) {x 		unsigned long page_offset = offset + page_idx;x 		
@@ -285,16 +282,16 @@
 		if (page)
 			continue;x x-		spin_unlock_irq(&mapping->tree_lock);x+		read_unlock_irq(&mapping->tree_lock);x 		page = page_cache_alloc_cold(mapping);x-		spin_lock_irq(&mapping->tree_lock);x+		read_lock_irq(&mapping->tree_lock);x 		if (!page)x 			break;x 		page->index = page_offset;x 		list_add(&page->lru, &page_pool);x 		ret++;x 	}x-	spin_unlock_irq(&mapping->tree_lock);x+	read_unlock_irq(&mapping->tree_lock);x 
 	/*
 	 * Now start the IO.  We ignore I/O errors - if the page is not
@@ -346,8 +343,8 @@
  * readahead isn't helping.
  *
  */
-int check_ra_success(struct file_ra_state *ra, unsigned long nr_to_read,x-				 unsigned long actual)
+static inline int check_ra_success(struct file_ra_state *ra,x+			unsigned long nr_to_read, unsigned long actual)
 {x 	if (actual == 0) {
 		ra->cache_hit += nr_to_read;
@@ -392,18 +389,46 @@
 {
 	int actual;
 
-	if (block) {x-		actual = __do_page_cache_readahead(mapping, filp,x-						offset, nr_to_read);x-	} else {
-		actual = do_page_cache_readahead(mapping, filp,x-						offset, nr_to_read);x-		if (actual == -1)x-			return 0;
-	}x+	if (!block && bdi_read_congested(mapping->backing_dev_info))
+		return 0;x+x+	actual = __do_page_cache_readahead(mapping, filp, offset, nr_to_read);x+
 	return check_ra_success(ra, nr_to_read, actual);x }
 
+static int make_ahead_window(struct address_space *mapping, struct file *filp,x+				struct file_ra_state *ra, int force)
+{x+	int block, ret;
+
+	ra->ahead_size = get_next_ra_size(ra);x+	ra->ahead_start = ra->start + ra->size;
+
+	block = force || (ra->prev_page >= ra->ahead_start);x+	ret = blockable_page_cache_readahead(mapping, filp,x+			ra->ahead_start, ra->ahead_size, ra, block);x+x+	if (!ret && !force) {x+		/* A read failure in blocking mode, implies pages are
+		 * all cached. So we can safely assume we have taken
+		 * care of all the pages requested in this call.
+		 * A read failure in non-blocking mode, implies we are
+		 * reading more pages than requested in this call.  So
+		 * we safely assume we have taken care of all the pages
+		 * requested in this call.
+		 *
+		 * Just reset the ahead window in case we failed due to
+		 * congestion.  The ahead window will any way be closed
+		 * in case we failed due to excessive page cache hits.
+		 */x+		ra->ahead_start = 0;
+		ra->ahead_size = 0;
+	}x+
+	return ret;
+}x+
 /*
  * page_cache_readahead is the main function.  If performs the adaptive
  * readahead window size management and submits the readahead I/O.
@@ -413,37 +438,35 @@
 		     struct file *filp, unsigned long offset,
 		     unsigned long req_size)
 {x-	unsigned long max, min;x-	unsigned long newsize = req_size;x-	unsigned long block;
+	unsigned long max, newsize;
+	int sequential;x 
 	/*
-	 * Here we detect the case where the application is performing
-	 * sub-page sized reads.  We avoid doing extra work and bogusly
-	 * perturbing the readahead window expansion logic.
-	 * If size is zero, there is no read ahead window so we need one
+	 * We avoid doing extra work and bogusly perturbing the readahead
+	 * window expansion logic.
 	 */
-	if (offset == ra->prev_page && req_size == 1 && ra->size != 0)
-		goto out;
+	if (offset == ra->prev_page && --req_size)
+		++offset;x+x+	/* Note that prev_page == -1 if it is a first read */x+	sequential = (offset == ra->prev_page + 1);
+	ra->prev_page = offset;x x 	max = get_max_readahead(ra);x-	min = get_min_readahead(ra);x 	newsize = min(req_size, max);
 
-	if (newsize == 0 || (ra->flags & RA_FLAG_INCACHE)) {x-		newsize = 1;
-		ra->prev_page = offset;x-		goto out;	/* No readahead or file already in cache */
-	}x+	/* No readahead or sub-page sized read or file already in cache */
+	if (newsize == 0 || (ra->flags & RA_FLAG_INCACHE))
+		goto out;
+
+	ra->prev_page += newsize - 1;
+
 	/*
-	 * Special case - first read.  We'll assume it's a whole-file read if
-	 * at start of file, and grow the window fast.  Or detect first
+	 * Special case - first read at start of file. We'll assume it's
+	 * a whole-file read and grow the window fast.  Or detect first
 	 * sequential access
 	 */
-	if ((ra->size == 0 && offset == 0)	/* first io and start of file */
-	    || (ra->size == -1 && ra->prev_page == offset - 1)) {x-		/* First sequential */
-		ra->prev_page  = offset + newsize - 1;
+	if (sequential && ra->size == 0) {
 		ra->size = get_init_ra_size(newsize, max);
 		ra->start = offset;x 		if (!blockable_page_cache_readahead(mapping, filp, offset,
@@ -458,13 +481,9 @@
 		 * IOs,* thus preventing stalls. so issue the ahead window
 		 * immediately.
 		 */x-		if (req_size >= max) {x-			ra->ahead_size = get_next_ra_size(ra->size, max, min,x-							  &ra->flags);x-			ra->ahead_start = ra->start + ra->size;
-			blockable_page_cache_readahead(mapping, filp,x-				 ra->ahead_start, ra->ahead_size, ra, 1);x-		}
+		if (req_size >= max)x+			make_ahead_window(mapping, filp, ra, 1);x+
 		goto out;
 	}
 
@@ -473,9 +492,8 @@
 	 * partial page reads and first access were handled above,
 	 * so this must be the next page otherwise it is random
 	 */
-	if ((offset != (ra->prev_page+1) || (ra->size == 0))) {x+	if (!sequential) {
 		ra_off(ra);x-		ra->prev_page  = offset + newsize - 1;
 		blockable_page_cache_readahead(mapping, filp, offset,
 				 newsize, ra, 1);x 		goto out;
@@ -487,28 +505,8 @@
 	 */
 x 	if (ra->ahead_start == 0) {	 /* no ahead window yet */
-		ra->ahead_size = get_next_ra_size(ra->size, max, min,x-						  &ra->flags);x-		ra->ahead_start = ra->start + ra->size;
-		block = ((offset + newsize -1) >= ra->ahead_start);x-		if (!blockable_page_cache_readahead(mapping, filp,
-		    ra->ahead_start, ra->ahead_size, ra, block)) {x-			/* A read failure in blocking mode, implies pages are
-			 * all cached. So we can safely assume we have taken
-			 * care of all the pages requested in this call. A read
-			 * failure in non-blocking mode, implies we are reading
-			 * more pages than requested in this call.  So we safely
-			 * assume we have taken care of all the pages requestedx-			 * in this call.
-			 *x-			 * Just reset the ahead window in case we failed due to
-			 * congestion.  The ahead window will any way be closed
-			 * in case we failed due to exessive page cache hits.
-			 */
-			ra->ahead_start = 0;
-			ra->ahead_size = 0;
+		if (!make_ahead_window(mapping, filp, ra, 0))x 			goto out;
-		}x 	}x 	/*
 	 * Already have an ahead window, check if we crossed into it.
@@ -517,35 +515,14 @@
 	 * we get called back on the first page of the ahead window which
 	 * will allow us to submit more IO.
 	 */
-	if ((offset + newsize - 1) >= ra->ahead_start) {x+	if (ra->prev_page >= ra->ahead_start) {
 		ra->start = ra->ahead_start;
 		ra->size = ra->ahead_size;x-		ra->ahead_start = ra->ahead_start + ra->ahead_size;x-		ra->ahead_size = get_next_ra_size(ra->ahead_size,x-						  max, min, &ra->flags);x-		block = ((offset + newsize - 1) >= ra->ahead_start);x-		if (!blockable_page_cache_readahead(mapping, filp,
-			ra->ahead_start, ra->ahead_size, ra, block)) {x-			/* A read failure in blocking mode, implies pages are
-			 * all cached. So we can safely assume we have taken
-			 * care of all the pages requested in this call.
-			 * A read failure in non-blocking mode, implies we are
-			 * reading more pages than requested in this call.  So
-			 * we safely assume we have taken care of all the pages
-			 * requested in this call.
-			 *x-			 * Just reset the ahead window in case we failed due to
-			 * congestion.  The ahead window will any way be closed
-			 * in case we failed due to excessive page cache hits.
-			 */
-			ra->ahead_start = 0;
-			ra->ahead_size = 0;
-		}
+		make_ahead_window(mapping, filp, ra, 0);
 	}
 
 out:
-	ra->prev_page = offset + newsize - 1;
-	return(newsize);x+	return ra->prev_page + 1;
 }
 
 /*
diff -Nru a/mm/rmap.c b/mm/rmap.c
--- a/mm/rmap.c	2005-01-07 21:44:05 -08:00
+++ b/mm/rmap.c	2005-03-06 16:55:23 -08:00
@@ -51,7 +51,6 @@
 #include <linux/swapops.h>
 #include <linux/slab.h>
 #include <linux/init.h>
-#include <linux/acct.h>
 #include <linux/rmap.h>
 #include <linux/rcupdate.h>
 
@@ -574,7 +573,7 @@
 	}x 
 	/* Nuke the page table entry. */
-	flush_cache_page(vma, address);x+	flush_cache_page(vma, address, page_to_pfn(page));
 	pteval = ptep_clear_flush(vma, address, pte);x 
 	/* Move the dirty bit to the physical page now the pte is gone. */
@@ -594,13 +593,12 @@
 			list_add(&mm->mmlist, &init_mm.mmlist);x 			spin_unlock(&mmlist_lock);x 		}
-		set_pte(pte, swp_entry_to_pte(entry));
+		set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
 		BUG_ON(pte_file(*pte));
 		mm->anon_rss--;x 	}
 
 	mm->rss--;x-	acct_update_integrals();x 	page_remove_rmap(page);x 	page_cache_release(page);
 x@@ -692,12 +690,12 @@
 			continue;x x 		/* Nuke the page table entry. */
-		flush_cache_page(vma, address);x+		flush_cache_page(vma, address, pfn);x 		pteval = ptep_clear_flush(vma, address, pte);x 
 		/* If nonlinear, store the file page offset in the pte. */x 		if (page->index != linear_page_index(vma, address))
-			set_pte(pte, pgoff_to_pte(page->index));
+			set_pte_at(mm, address, pte, pgoff_to_pte(page->index));
 
 		/* Move the dirty bit to the physical page now the pte is gone. */
 		if (pte_dirty(pteval))x@@ -705,7 +703,6 @@
 
 		page_remove_rmap(page);x 		page_cache_release(page);
-		acct_update_integrals();x 		mm->rss--;x 		(*mapcount)--;x 	}
diff -Nru a/mm/swap_state.c b/mm/swap_state.c
--- a/mm/swap_state.c	2005-01-30 22:19:53 -08:00
+++ b/mm/swap_state.c	2005-03-07 20:41:23 -08:00
@@ -35,7 +35,7 @@
 
 struct address_space swapper_space = {
 	.page_tree	= RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN),
-	.tree_lock	= SPIN_LOCK_UNLOCKED,x+	.tree_lock	= RW_LOCK_UNLOCKED,x 	.a_ops		= &swap_aops,x 	.i_mmap_nonlinear = LIST_HEAD_INIT(swapper_space.i_mmap_nonlinear),
 	.backing_dev_info = &swap_backing_dev_info,
@@ -76,7 +76,7 @@
 	BUG_ON(PagePrivate(page));
 	error = radix_tree_preload(gfp_mask);x 	if (!error) {x-		spin_lock_irq(&swapper_space.tree_lock);x+		write_lock_irq(&swapper_space.tree_lock);x 		error = radix_tree_insert(&swapper_space.page_tree,
 						entry.val, page);x 		if (!error) {x@@ -87,7 +87,7 @@
 			total_swapcache_pages++;x 			pagecache_acct(1);
 		}
-		spin_unlock_irq(&swapper_space.tree_lock);x+		write_unlock_irq(&swapper_space.tree_lock);x 		radix_tree_preload_end();x 	}
 	return error;
@@ -214,9 +214,9 @@
   x 	entry.val = page->private;
 
-	spin_lock_irq(&swapper_space.tree_lock);x+	write_lock_irq(&swapper_space.tree_lock);x 	__delete_from_swap_cache(page);
-	spin_unlock_irq(&swapper_space.tree_lock);x+	write_unlock_irq(&swapper_space.tree_lock);x x 	swap_free(entry);x 	page_cache_release(page);
@@ -315,13 +315,11 @@
 {
 	struct page *page;
 
-	spin_lock_irq(&swapper_space.tree_lock);x-	page = radix_tree_lookup(&swapper_space.page_tree, entry.val);
-	if (page) {x-		page_cache_get(page);
+	page = find_get_page(&swapper_space, entry.val);
+
+	if (page)x 		INC_CACHE_INFO(find_success);x-	}
-	spin_unlock_irq(&swapper_space.tree_lock);x+x 	INC_CACHE_INFO(find_total);
 	return page;
 }
@@ -344,12 +342,7 @@
 		 * called after lookup_swap_cache() failed, re-calling
 		 * that would confuse statistics.
 		 */x-		spin_lock_irq(&swapper_space.tree_lock);x-		found_page = radix_tree_lookup(&swapper_space.page_tree,x-						entry.val);
-		if (found_page)
-			page_cache_get(found_page);
-		spin_unlock_irq(&swapper_space.tree_lock);x+		found_page = find_get_page(&swapper_space, entry.val);
 		if (found_page)
 			break;x 
diff -Nru a/mm/swapfile.c b/mm/swapfile.c
--- a/mm/swapfile.c	2005-01-11 16:42:36 -08:00
+++ b/mm/swapfile.c	2005-03-07 20:41:23 -08:00
@@ -24,7 +24,6 @@
 #include <linux/module.h>
 #include <linux/rmap.h>
 #include <linux/security.h>
-#include <linux/acct.h>
 #include <linux/backing-dev.h>
 #include <linux/syscalls.h>
 
@@ -292,10 +291,10 @@
 		/* Is the only swap cache user the cache itself? */
 		if (p->swap_map[swp_offset(entry)] == 1) {x 			/* Recheck the page count with the swapcache lock held.. */
-			spin_lock_irq(&swapper_space.tree_lock);x+			write_lock_irq(&swapper_space.tree_lock);x 			if (page_count(page) == 2)x 				retval = 1;x-			spin_unlock_irq(&swapper_space.tree_lock);x+			write_unlock_irq(&swapper_space.tree_lock);x 		}x 		swap_info_put(p);
 	}
@@ -363,13 +362,13 @@
 	retval = 0;x 	if (p->swap_map[swp_offset(entry)] == 1) {x 		/* Recheck the page count with the swapcache lock held.. */
-		spin_lock_irq(&swapper_space.tree_lock);x+		write_lock_irq(&swapper_space.tree_lock);x 		if ((page_count(page) == 2) && !PageWriteback(page)) {x 			__delete_from_swap_cache(page);
 			SetPageDirty(page);
 			retval = 1;x 		}
-		spin_unlock_irq(&swapper_space.tree_lock);x+		write_unlock_irq(&swapper_space.tree_lock);x 	}x 	swap_info_put(p);
 
@@ -392,14 +391,8 @@
 x 	p = swap_info_get(entry);x 	if (p) {x-		if (swap_entry_free(p, swp_offset(entry)) == 1) {x-			spin_lock_irq(&swapper_space.tree_lock);x-			page = radix_tree_lookup(&swapper_space.page_tree,x-				entry.val);
-			if (page && TestSetPageLocked(page))x-				page = NULL;
-			spin_unlock_irq(&swapper_space.tree_lock);x-		}
+		if (swap_entry_free(p, swp_offset(entry)) == 1)x+			page = find_trylock_page(&swapper_space, entry.val);
 		swap_info_put(p);
 	}
 	if (page) {x@@ -434,11 +427,10 @@
 {x 	vma->vm_mm->rss++;x 	get_page(page);
-	set_pte(dir, pte_mkold(mk_pte(page, vma->vm_page_prot)));
+	set_pte_at(vma->vm_mm, address, dir,
+		   pte_mkold(mk_pte(page, vma->vm_page_prot)));
 	page_add_anon_rmap(page, vma, address);x 	swap_free(entry);x-	acct_update_integrals();x-	update_mem_hiwater();x }
 
 /* vma->vm_mm->page_table_lock is held */
diff -Nru a/mm/truncate.c b/mm/truncate.c
--- a/mm/truncate.c	2005-02-05 12:51:43 -08:00
+++ b/mm/truncate.c	2005-03-04 22:41:15 -08:00
@@ -76,15 +76,15 @@
 	if (PagePrivate(page) && !try_to_release_page(page, 0))x 		return 0;
 x-	spin_lock_irq(&mapping->tree_lock);x+	write_lock_irq(&mapping->tree_lock);x 	if (PageDirty(page)) {x-		spin_unlock_irq(&mapping->tree_lock);x+		write_unlock_irq(&mapping->tree_lock);x 		return 0;x 	}
 
 	BUG_ON(PagePrivate(page));
 	__remove_from_page_cache(page);
-	spin_unlock_irq(&mapping->tree_lock);x+	write_unlock_irq(&mapping->tree_lock);x 	ClearPageUptodate(page);x 	page_cache_release(page);	/* pagecache ref */
 	return 1;
@@ -241,54 +241,62 @@
 EXPORT_SYMBOL(invalidate_inode_pages);x x /**
- * invalidate_inode_pages2 - remove all pages from an address_space
+ * invalidate_inode_pages2_range - remove range of pages from an address_space
  * @mapping - the address_space
+ * @start: the page offset 'from' which to invalidate
+ * @end: the page offset 'to' which to invalidate (inclusive)
  *
  * Any pages which are found to be mapped into pagetables are unmapped prior to
  * invalidation.
  *
  * Returns -EIO if any pages could not be invalidated.
  */
-int invalidate_inode_pages2(struct address_space *mapping)x+int invalidate_inode_pages2_range(struct address_space *mapping,x+				  pgoff_t start, pgoff_t end)x {
 	struct pagevec pvec;x-	pgoff_t next = 0;
+	pgoff_t next;
 	int i;
 	int ret = 0;
-	int did_full_unmap = 0;
+	int did_range_unmap = 0;
+	int wrapped = 0;
 x 	pagevec_init(&pvec, 0);
-	while (!ret && pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) {x+	next = start;
+	while (next <= end && !ret && !wrapped &&x+		pagevec_lookup(&pvec, mapping, next,x+			min(end - next, (pgoff_t)PAGEVEC_SIZE - 1) + 1)) {x 		for (i = 0; !ret && i < pagevec_count(&pvec); i++) {x 			struct page *page = pvec.pages[i];x 			int was_dirty;
 
 			lock_page(page);
-			if (page->mapping != mapping) {	/* truncate race? */
+			if (page->mapping != mapping || page->index > end) {x 				unlock_page(page);
 				continue;x 			}x 			wait_on_page_writeback(page);
 			next = page->index + 1;
+			if (next == 0)x+				wrapped = 1;x 			while (page_mapped(page)) {x-				if (!did_full_unmap) {x+				if (!did_range_unmap) {x 					/*
 					 * Zap the rest of the file in one hit.x-					 * FIXME: invalidate_inode_pages2()x-					 * should take start/end offsets.
 					 */
 					unmap_mapping_range(mapping,x-						page->index << PAGE_CACHE_SHIFT,x-					  	-1, 0);
-					did_full_unmap = 1;
+					    page->index << PAGE_CACHE_SHIFT,x+					    (end - page->index + 1)x+							<< PAGE_CACHE_SHIFT,x+					    0);
+					did_range_unmap = 1;x 				} else {
 					/*
 					 * Just zap this page
 					 */
 					unmap_mapping_range(mapping,x 					  page->index << PAGE_CACHE_SHIFT,x-					  (page->index << PAGE_CACHE_SHIFT)+1,x-					  0);
+					  PAGE_CACHE_SIZE, 0);
 				}x 			}x 			was_dirty = test_clear_page_dirty(page);
@@ -303,5 +311,20 @@
 		cond_resched();x 	}
 	return ret;
+}x+EXPORT_SYMBOL_GPL(invalidate_inode_pages2_range);
+
+/**
+ * invalidate_inode_pages2 - remove all pages from an address_space
+ * @mapping - the address_space
+ *
+ * Any pages which are found to be mapped into pagetables are unmapped prior to
+ * invalidation.
+ *
+ * Returns -EIO if any pages could not be invalidated.
+ */
+int invalidate_inode_pages2(struct address_space *mapping)x+{x+	return invalidate_inode_pages2_range(mapping, 0, -1);
 }
 EXPORT_SYMBOL_GPL(invalidate_inode_pages2);
diff -Nru a/mm/vmalloc.c b/mm/vmalloc.c
--- a/mm/vmalloc.c	2005-02-11 17:33:28 -08:00
+++ b/mm/vmalloc.c	2005-03-07 20:41:30 -08:00
@@ -26,7 +26,7 @@
 static void unmap_area_pte(pmd_t *pmd, unsigned long address,
 				  unsigned long size)
 {x-	unsigned long end;x+	unsigned long base, end;x 	pte_t *pte;
 
 	if (pmd_none(*pmd))x@@ -38,6 +38,7 @@
 	}x 
 	pte = pte_offset_kernel(pmd, address);x+	base = address & PMD_MASK;
 	address &= ~PMD_MASK;
 	end = address + size;x 	if (end > PMD_SIZE)
@@ -45,7 +46,7 @@
 
 	do {x 		pte_t page;
-		page = ptep_get_and_clear(pte);
+		page = ptep_get_and_clear(&init_mm, base + address, pte);x 		address += PAGE_SIZE;x 		pte++;x 		if (pte_none(page))x@@ -59,7 +60,7 @@
 static void unmap_area_pmd(pud_t *pud, unsigned long address,
 				  unsigned long size)
 {x-	unsigned long end;x+	unsigned long base, end;x 	pmd_t *pmd;
 
 	if (pud_none(*pud))x@@ -71,13 +72,14 @@
 	}x 
 	pmd = pmd_offset(pud, address);x+	base = address & PUD_MASK;
 	address &= ~PUD_MASK;
 	end = address + size;x 	if (end > PUD_SIZE)x 		end = PUD_SIZE;
 
 	do {x-		unmap_area_pte(pmd, address, end - address);
+		unmap_area_pte(pmd, base + address, end - address);
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;x 	} while (address < end);x@@ -87,7 +89,7 @@
 			   unsigned long size)
 {x 	pud_t *pud;x-	unsigned long end;x+	unsigned long base, end;x 
 	if (pgd_none(*pgd))x 		return;
@@ -98,13 +100,14 @@
 	}x 
 	pud = pud_offset(pgd, address);x+	base = address & PGDIR_MASK;
 	address &= ~PGDIR_MASK;
 	end = address + size;x 	if (end > PGDIR_SIZE)x 		end = PGDIR_SIZE;x 
 	do {x-		unmap_area_pmd(pud, address, end - address);
+		unmap_area_pmd(pud, base + address, end - address);
 		address = (address + PUD_SIZE) & PUD_MASK;
 		pud++;x 	} while (address && (address < end));
@@ -114,8 +117,9 @@
 			       unsigned long size, pgprot_t prot,
 			       struct page ***pages)
 {x-	unsigned long end;x+	unsigned long base, end;x x+	base = address & PMD_MASK;
 	address &= ~PMD_MASK;
 	end = address + size;x 	if (end > PMD_SIZE)
@@ -127,7 +131,7 @@
 		if (!page)x 			return -ENOMEM;
 
-		set_pte(pte, mk_pte(page, prot));
+		set_pte_at(&init_mm, base + address, pte, mk_pte(page, prot));
 		address += PAGE_SIZE;x 		pte++;x 		(*pages)++;x@@ -151,7 +155,7 @@
 		pte_t * pte = pte_alloc_kernel(&init_mm, pmd, base + address);x 		if (!pte)x 			return -ENOMEM;
-		if (map_area_pte(pte, address, end - address, prot, pages))
+		if (map_area_pte(pte, base + address, end - address, prot, pages))
 			return -ENOMEM;
 		address = (address + PMD_SIZE) & PMD_MASK;
 		pmd++;x@@ -252,20 +256,22 @@
 		align = 1ul << bit;
 	}
 	addr = ALIGN(start, align);
+	size = PAGE_ALIGN(size);x 
 	area = kmalloc(sizeof(*area), GFP_KERNEL);x 	if (unlikely(!area))x 		return NULL;
 
-	/*
-	 * We always allocate a guard page.
-	 */
-	size += PAGE_SIZE;x 	if (unlikely(!size)) {x 		kfree (area);x 		return NULL;
 	}x 
+	/*
+	 * We always allocate a guard page.
+	 */x+	size += PAGE_SIZE;x+x 	write_lock(&vmlist_lock);x 	for (p = &vmlist; (tmp = *p) != NULL ;p = &tmp->next) {
 		if ((unsigned long)tmp->addr < addr) {x@@ -345,6 +351,11 @@
 	unmap_vm_area(tmp);x 	*p = tmp->next;x 	write_unlock(&vmlist_lock);x+
+	/*
+	 * Remove the guard page.
+	 */x+	tmp->size -= PAGE_SIZE;x 	return tmp;x }
 
diff -Nru a/mm/vmscan.c b/mm/vmscan.c
--- a/mm/vmscan.c	2005-02-03 16:53:32 -08:00
+++ b/mm/vmscan.c	2005-03-07 20:41:24 -08:00
@@ -72,6 +72,12 @@
 	unsigned int gfp_mask;x 
 	int may_writepage;
+x+	/* This context's SWAP_CLUSTER_MAX. If freeing memory for
+	 * suspend, we effectively ignore SWAP_CLUSTER_MAX.
+	 * In this context, it doesn't matter that we scan the
+	 * whole list at once. */x+	int swap_cluster_max;x };x x /*x@@ -137,7 +143,7 @@
 	        shrinker->seeks = seeks;
 	        shrinker->nr = 0;x 	        down_write(&shrinker_rwsem);
-	        list_add(&shrinker->list, &shrinker_list);
+	        list_add_tail(&shrinker->list, &shrinker_list);
 	        up_write(&shrinker_rwsem);
 	}
 	return shrinker;
@@ -475,7 +481,7 @@
 		if (!mapping)x 			goto keep_locked;	/* truncate got there first */
 
-		spin_lock_irq(&mapping->tree_lock);x+		write_lock_irq(&mapping->tree_lock);x x 		/*
 		 * The non-racy check for busy page.  It is critical to check
@@ -483,7 +489,7 @@
 		 * not in use by anybody. 	(pagecache + us == 2)x 		 */x 		if (page_count(page) != 2 || PageDirty(page)) {x-			spin_unlock_irq(&mapping->tree_lock);x+			write_unlock_irq(&mapping->tree_lock);x 			goto keep_locked;x 		}x 
@@ -491,7 +497,7 @@
 		if (PageSwapCache(page)) {x 			swp_entry_t swap = { .val = page->private };x 			__delete_from_swap_cache(page);
-			spin_unlock_irq(&mapping->tree_lock);x+			write_unlock_irq(&mapping->tree_lock);x 			swap_free(swap);x 			__put_page(page);	/* The pagecache ref */
 			goto free_it;
@@ -499,7 +505,7 @@
 #endif /* CONFIG_SWAP */
 x 		__remove_from_page_cache(page);
-		spin_unlock_irq(&mapping->tree_lock);x+		write_unlock_irq(&mapping->tree_lock);x 		__put_page(page);
 x free_it:
@@ -552,7 +558,7 @@
 		int nr_scan = 0;x 		int nr_freed;
 
-		while (nr_scan++ < SWAP_CLUSTER_MAX &&x+		while (nr_scan++ < sc->swap_cluster_max &&x 				!list_empty(&zone->inactive_list)) {x 			page = lru_to_page(&zone->inactive_list);
 
@@ -797,37 +803,39 @@
 	 */
 	zone->nr_scan_active += (zone->nr_active >> sc->priority) + 1;
 	nr_active = zone->nr_scan_active;
-	if (nr_active >= SWAP_CLUSTER_MAX)
+	if (nr_active >= sc->swap_cluster_max)x 		zone->nr_scan_active = 0;x 	elsex 		nr_active = 0;x 
 	zone->nr_scan_inactive += (zone->nr_inactive >> sc->priority) + 1;
 	nr_inactive = zone->nr_scan_inactive;
-	if (nr_inactive >= SWAP_CLUSTER_MAX)
+	if (nr_inactive >= sc->swap_cluster_max)x 		zone->nr_scan_inactive = 0;x 	elsex 		nr_inactive = 0;x 
-	sc->nr_to_reclaim = SWAP_CLUSTER_MAX;
+	sc->nr_to_reclaim = sc->swap_cluster_max;x 
 	while (nr_active || nr_inactive) {
 		if (nr_active) {x 			sc->nr_to_scan = min(nr_active,x-					(unsigned long)SWAP_CLUSTER_MAX);
+					(unsigned long)sc->swap_cluster_max);
 			nr_active -= sc->nr_to_scan;
 			refill_inactive_zone(zone, sc);x 		}x 
 		if (nr_inactive) {
 			sc->nr_to_scan = min(nr_inactive,x-					(unsigned long)SWAP_CLUSTER_MAX);
+					(unsigned long)sc->swap_cluster_max);
 			nr_inactive -= sc->nr_to_scan;
 			shrink_cache(zone, sc);x 			if (sc->nr_to_reclaim <= 0)x 				break;x 		}x 	}x+x+	throttle_vm_writeout();x }
 
 /*
@@ -909,18 +917,19 @@
 		sc.nr_scanned = 0;
 		sc.nr_reclaimed = 0;
 		sc.priority = priority;
+		sc.swap_cluster_max = SWAP_CLUSTER_MAX;
 		shrink_caches(zones, &sc);x 		shrink_slab(sc.nr_scanned, gfp_mask, lru_pages);x 		if (reclaim_state) {
 			sc.nr_reclaimed += reclaim_state->reclaimed_slab;
 			reclaim_state->reclaimed_slab = 0;
 		}x-		if (sc.nr_reclaimed >= SWAP_CLUSTER_MAX) {x+		total_scanned += sc.nr_scanned;x+		total_reclaimed += sc.nr_reclaimed;
+		if (total_reclaimed >= sc.swap_cluster_max) {
 			ret = 1;x 			goto out;
 		}x-		total_scanned += sc.nr_scanned;x-		total_reclaimed += sc.nr_reclaimed;
 x 		/*
 		 * Try to write back as many pages as we just scanned.  This
@@ -929,7 +938,7 @@
 		 * that's undesirable in laptop mode, where we *want* lumpy
 		 * writeout.  So in laptop mode, write out the whole world.
 		 */x-		if (total_scanned > SWAP_CLUSTER_MAX + SWAP_CLUSTER_MAX/2) {x+		if (total_scanned > sc.swap_cluster_max + sc.swap_cluster_max/2) {x 			wakeup_bdflush(laptop_mode ? 0 : total_scanned);x 			sc.may_writepage = 1;x 		}
@@ -1061,6 +1070,7 @@
 			sc.nr_scanned = 0;
 			sc.nr_reclaimed = 0;
 			sc.priority = priority;
+			sc.swap_cluster_max = nr_pages? nr_pages : SWAP_CLUSTER_MAX;
 			shrink_zone(zone, &sc);x 			reclaim_state->reclaimed_slab = 0;
 			shrink_slab(sc.nr_scanned, GFP_KERNEL, lru_pages);x@@ -1098,7 +1108,7 @@
 		 * matches the direct reclaim path behaviour in terms of impact
 		 * on zone->*_priority.
 		 */x-		if (total_reclaimed >= SWAP_CLUSTER_MAX)x+		if ((total_reclaimed >= SWAP_CLUSTER_MAX) && (!nr_pages))x 			break;x 	}
 out:
diff -Nru a/net/appletalk/ddp.c b/net/appletalk/ddp.c
--- a/net/appletalk/ddp.c	2005-01-13 21:05:06 -08:00
+++ b/net/appletalk/ddp.c	2005-01-20 14:32:26 -08:00
@@ -1022,7 +1022,6 @@
 static int atalk_create(struct socket *sock, int protocol)x {
 	struct sock *sk;
-	struct atalk_sock *at;
 	int rc = -ESOCKTNOSUPPORT;x 
 	/*
@@ -1032,13 +1031,10 @@
 	if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
 		goto out;
 	rc = -ENOMEM;
-	sk = sk_alloc(PF_APPLETALK, GFP_KERNEL, 1, NULL);
+	sk = sk_alloc(PF_APPLETALK, GFP_KERNEL,
+		      sizeof(struct atalk_sock), NULL);
 	if (!sk)
 		goto out;
-	at = sk->sk_protinfo = kmalloc(sizeof(*at), GFP_KERNEL);x-	if (!at)x-		goto outsk;
-	memset(at, 0, sizeof(*at));
 	rc = 0;
 	sock->ops = &atalk_dgram_ops;
 	sock_init_data(sock, sk);x@@ -1048,9 +1044,6 @@
 	sk->sk_zapped = 1;x out:
 	return rc;x-outsk:
-	sk_free(sk);x-	goto out;
 }
 
 /* Free a socket. No work needed */
diff -Nru a/net/atm/atm_misc.c b/net/atm/atm_misc.c
--- a/net/atm/atm_misc.c	2003-10-08 09:11:34 -07:00
+++ b/net/atm/atm_misc.c	2005-01-20 18:17:39 -08:00
@@ -16,7 +16,7 @@
 int atm_charge(struct atm_vcc *vcc,int truesize)
 {x 	atm_force_charge(vcc,truesize);x-	if (atomic_read(&vcc->sk->sk_rmem_alloc) <= vcc->sk->sk_rcvbuf)
+	if (atomic_read(&sk_atm(vcc)->sk_rmem_alloc) <= sk_atm(vcc)->sk_rcvbuf)
 		return 1;x 	atm_return(vcc,truesize);x 	atomic_inc(&vcc->stats->rx_drop);x@@ -27,15 +27,16 @@
 struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,x     int gfp_flags)
 {x+	struct sock *sk = sk_atm(vcc);
 	int guess = atm_guess_pdu2truesize(pdu_size);x 
 	atm_force_charge(vcc,guess);x-	if (atomic_read(&vcc->sk->sk_rmem_alloc) <= vcc->sk->sk_rcvbuf) {x+	if (atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf) {x 		struct sk_buff *skb = alloc_skb(pdu_size,gfp_flags);x 
 		if (skb) {x 			atomic_add(skb->truesize-guess,x-				   &vcc->sk->sk_rmem_alloc);x+				   &sk->sk_rmem_alloc);x 			return skb;x 		}x 	}xdiff -Nru a/net/atm/br2684.c b/net/atm/br2684.c
--- a/net/atm/br2684.c	2005-01-13 20:41:04 -08:00
+++ b/net/atm/br2684.c	2005-01-20 18:17:39 -08:00
@@ -190,7 +190,7 @@
 		dev_kfree_skb(skb);x 		return 0;x 		}x-	atomic_add(skb->truesize, &atmvcc->sk->sk_wmem_alloc);x+	atomic_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc);x 	ATM_SKB(skb)->atm_options = atmvcc->atm_options;x 	brdev->stats.tx_packets++;x 	brdev->stats.tx_bytes += skb->len;
@@ -557,7 +557,7 @@
 	barrier();x 	atmvcc->push = br2684_push;
 	skb_queue_head_init(&copy);x-	skb_migrate(&atmvcc->sk->sk_receive_queue, &copy);x+	skb_migrate(&sk_atm(atmvcc)->sk_receive_queue, &copy);x 	while ((skb = skb_dequeue(&copy)) != NULL) {x 		BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
 		BRPRIV(skb->dev)->stats.rx_packets--;xdiff -Nru a/net/atm/clip.c b/net/atm/clip.c
--- a/net/atm/clip.c	2005-01-20 13:24:32 -08:00
+++ b/net/atm/clip.c	2005-02-08 20:09:15 -08:00
@@ -58,6 +58,7 @@
 
 static int to_atmarpd(enum atmarp_ctrl_type type,int itf,unsigned long ip)
 {x+	struct sock *sk;
 	struct atmarp_ctrl *ctrl;
 	struct sk_buff *skb;
 
@@ -70,8 +71,10 @@
 	ctrl->itf_num = itf;
 	ctrl->ip = ip;
 	atm_force_charge(atmarpd,skb->truesize);x-	skb_queue_tail(&atmarpd->sk->sk_receive_queue, skb);x-	atmarpd->sk->sk_data_ready(atmarpd->sk, skb->len);x+
+	sk = sk_atm(atmarpd);x+	skb_queue_tail(&sk->sk_receive_queue, skb);x+	sk->sk_data_ready(sk, skb->len);x 	return 0;x }x 
@@ -434,7 +437,7 @@
 		memcpy(here,llc_oui,sizeof(llc_oui));
 		((u16 *) here)[3] = skb->protocol;x 	}x-	atomic_add(skb->truesize, &vcc->sk->sk_wmem_alloc);x+	atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);x 	ATM_SKB(skb)->atm_options = vcc->atm_options;x 	entry->vccs->last_use = jiffies;x 	DPRINTK("atm_skb(%p)->vcc(%p)->dev(%p)\n",skb,vcc,vcc->dev);
@@ -493,7 +496,7 @@
 	vcc->push = clip_push;
 	vcc->pop = clip_pop;
 	skb_queue_head_init(&copy);x-	skb_migrate(&vcc->sk->sk_receive_queue, &copy);x+	skb_migrate(&sk_atm(vcc)->sk_receive_queue, &copy);x 	/* re-process everything received between connection setup and MKIP */
 	while ((skb = skb_dequeue(&copy)) != NULL)
 		if (!clip_devs) {x@@ -686,10 +689,10 @@
 	barrier();x 	unregister_inetaddr_notifier(&clip_inet_notifier);x 	unregister_netdevice_notifier(&clip_dev_notifier);x-	if (skb_peek(&vcc->sk->sk_receive_queue))
+	if (skb_peek(&sk_atm(vcc)->sk_receive_queue))x 		printk(KERN_ERR "atmarpd_close: closing with requests "
 		    "pending\n");x-	skb_queue_purge(&vcc->sk->sk_receive_queue);x+	skb_queue_purge(&sk_atm(vcc)->sk_receive_queue);x 	DPRINTK("(done)\n");x 	module_put(THIS_MODULE);
 }
@@ -723,7 +726,7 @@
 	set_bit(ATM_VF_READY,&vcc->flags);x 	    /* allow replies and avoid getting closed if signaling dies */
 	vcc->dev = &atmarpd_dev;x-	vcc_insert_socket(vcc->sk);x+	vcc_insert_socket(sk_atm(vcc));
 	vcc->push = NULL;
 	vcc->pop = NULL; /* crash */
 	vcc->push_oam = NULL; /* crash */
@@ -822,7 +825,7 @@
 	int svc, llc, off;x x 	svc = ((clip_vcc == SEQ_NO_VCC_TOKEN) ||
-	       (clip_vcc->vcc->sk->sk_family == AF_ATMSVC));
+	       (sk_atm(clip_vcc->vcc)->sk_family == AF_ATMSVC));
 x 	llc = ((clip_vcc == SEQ_NO_VCC_TOKEN) ||
 	       clip_vcc->encap);xdiff -Nru a/net/atm/common.c b/net/atm/common.c
--- a/net/atm/common.c	2005-01-13 20:41:04 -08:00
+++ b/net/atm/common.c	2005-01-20 18:17:39 -08:00
@@ -68,17 +68,18 @@
 static struct sk_buff *alloc_tx(struct atm_vcc *vcc,unsigned int size)
 {x 	struct sk_buff *skb;
+	struct sock *sk = sk_atm(vcc);
 x-	if (atomic_read(&vcc->sk->sk_wmem_alloc) && !atm_may_send(vcc, size)) {x+	if (atomic_read(&sk->sk_wmem_alloc) && !atm_may_send(vcc, size)) {x 		DPRINTK("Sorry: wmem_alloc = %d, size = %d, sndbuf = %d\n",x-			atomic_read(&vcc->sk->sk_wmem_alloc), size,x-			vcc->sk->sk_sndbuf);x+			atomic_read(&sk->sk_wmem_alloc), size,x+			sk->sk_sndbuf);x 		return NULL;
 	}x 	while (!(skb = alloc_skb(size,GFP_KERNEL))) schedule();x-	DPRINTK("AlTx %d += %d\n", atomic_read(&vcc->sk->sk_wmem_alloc),x+	DPRINTK("AlTx %d += %d\n", atomic_read(&sk->sk_wmem_alloc),x 		skb->truesize);x-	atomic_add(skb->truesize, &vcc->sk->sk_wmem_alloc);x+	atomic_add(skb->truesize, &sk->sk_wmem_alloc);x 	return skb;x }x 
@@ -89,15 +90,11 @@
 
 static void vcc_sock_destruct(struct sock *sk)
 {x-	struct atm_vcc *vcc = atm_sk(sk);x-x-	if (atomic_read(&vcc->sk->sk_rmem_alloc))x+	if (atomic_read(&sk->sk_rmem_alloc))x 		printk(KERN_DEBUG "vcc_sock_destruct: rmem leakage (%d bytes) detected.\n", atomic_read(&sk->sk_rmem_alloc));
 x-	if (atomic_read(&vcc->sk->sk_wmem_alloc))x+	if (atomic_read(&sk->sk_wmem_alloc))x 		printk(KERN_DEBUG "vcc_sock_destruct: wmem leakage (%d bytes) detected.\n", atomic_read(&sk->sk_wmem_alloc));
-x-	kfree(sk->sk_protinfo);x }
 
 static void vcc_def_wakeup(struct sock *sk)
@@ -139,7 +136,7 @@
 	sock->sk = NULL;
 	if (sock->type == SOCK_STREAM)
 		return -EINVAL;
-	sk = sk_alloc(family, GFP_KERNEL, 1, NULL);
+	sk = sk_alloc(family, GFP_KERNEL, sizeof(struct atm_vcc), NULL);
 	if (!sk)
 		return -ENOMEM;
 	sock_init_data(sock, sk);x@@ -147,20 +144,13 @@
 	sk->sk_state_change = vcc_def_wakeup;
 	sk->sk_write_space = vcc_write_space;
 x-	vcc = sk->sk_protinfo = kmalloc(sizeof(*vcc), GFP_KERNEL);x-	if (!vcc) {x-		sk_free(sk);x-		return -ENOMEM;
-	}
-x-	memset(vcc, 0, sizeof(*vcc));
-	vcc->sk = sk;x+	vcc = atm_sk(sk);x 	vcc->dev = NULL;
 	memset(&vcc->local,0,sizeof(struct sockaddr_atmsvc));
 	memset(&vcc->remote,0,sizeof(struct sockaddr_atmsvc));
 	vcc->qos.txtp.max_sdu = 1 << 16; /* for meta VCs */x-	atomic_set(&vcc->sk->sk_wmem_alloc, 0);
-	atomic_set(&vcc->sk->sk_rmem_alloc, 0);
+	atomic_set(&sk->sk_wmem_alloc, 0);
+	atomic_set(&sk->sk_rmem_alloc, 0);
 	vcc->push = NULL;
 	vcc->pop = NULL;
 	vcc->push_oam = NULL;x@@ -187,7 +177,7 @@
 
 		vcc_remove_socket(sk);	/* no more receive */
 
-		while ((skb = skb_dequeue(&vcc->sk->sk_receive_queue)) != NULL) {x+		while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {x 			atm_return(vcc,skb->truesize);x 			kfree_skb(skb);x 		}
@@ -215,11 +205,13 @@
 
 void vcc_release_async(struct atm_vcc *vcc, int reply)
 {x+	struct sock *sk = sk_atm(vcc);
+
 	set_bit(ATM_VF_CLOSE, &vcc->flags);x-	vcc->sk->sk_shutdown |= RCV_SHUTDOWN;x-	vcc->sk->sk_err = -reply;x+	sk->sk_shutdown |= RCV_SHUTDOWN;x+	sk->sk_err = -reply;x 	clear_bit(ATM_VF_WAITING, &vcc->flags);x-	vcc->sk->sk_state_change(vcc->sk);x+	sk->sk_state_change(sk);x }
 
 x@@ -328,6 +320,7 @@
 static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi,
 			 int vci)
 {x+	struct sock *sk = sk_atm(vcc);
 	int error;
 
 	if ((vpi != ATM_VPI_UNSPEC && vpi != ATM_VPI_ANY &&x@@ -347,7 +340,7 @@
 	}x 	vcc->vpi = vpi;
 	vcc->vci = vci;x-	__vcc_insert_socket(vcc->sk);x+	__vcc_insert_socket(sk);x 	write_unlock_irq(&vcc_sklist_lock);x 	switch (vcc->qos.aal) {
 		case ATM_AAL0:x@@ -386,7 +379,7 @@
 	return 0;
 x fail:x-	vcc_remove_socket(vcc->sk);x+	vcc_remove_socket(sk);x fail_module_put:x 	module_put(dev->ops->owner);x 	/* ensure we get dev module ref count correct */
@@ -495,7 +488,7 @@
         if (error)
                 return error;
         sock_recv_timestamp(msg, sk, skb);x-        DPRINTK("RcvM %d -= %d\n", atomic_read(&vcc->sk->rmem_alloc), skb->truesize);x+        DPRINTK("RcvM %d -= %d\n", atomic_read(&sk->rmem_alloc), skb->truesize);x         atm_return(vcc, skb->truesize);x         skb_free_datagram(sk, skb);x         return copied;
@@ -615,7 +608,7 @@
 		return mask;x 
 	if (vcc->qos.txtp.traffic_class != ATM_NONE &&x-	    vcc_writable(vcc->sk))
+	    vcc_writable(sk))
 		mask |= POLLOUT | POLLWRNORM | POLLWRBAND;x 
 	return mask;x@@ -638,7 +631,7 @@
 	if (!error) error = adjust_tp(&qos->rxtp,qos->aal);
 	if (error) return error;
 	if (!vcc->dev->ops->change_qos) return -EOPNOTSUPP;x-	if (vcc->sk->sk_family == AF_ATMPVC)
+	if (sk_atm(vcc)->sk_family == AF_ATMPVC)
 		return vcc->dev->ops->change_qos(vcc,qos,ATM_MF_SET);x 	return svc_change_qos(vcc,qos);x }
diff -Nru a/net/atm/ioctl.c b/net/atm/ioctl.c
--- a/net/atm/ioctl.c	2004-06-03 16:43:54 -07:00
+++ b/net/atm/ioctl.c	2005-01-20 18:17:39 -08:00
@@ -46,6 +46,7 @@
 
 int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {x+	struct sock *sk = sock->sk;
 	struct atm_vcc *vcc;
 	int error;
 	struct list_head * pos;x@@ -59,8 +60,8 @@
 				error =  -EINVAL;
 				goto done;x 			}x-			error = put_user(vcc->sk->sk_sndbuf -x-					 atomic_read(&vcc->sk->sk_wmem_alloc),x+			error = put_user(sk->sk_sndbuf -x+					 atomic_read(&sk->sk_wmem_alloc),x 					 (int __user *) argp) ? -EFAULT : 0;
 			goto done;x 		case SIOCINQ:x@@ -71,13 +72,13 @@
 					error = -EINVAL;
 					goto done;x 				}x-				skb = skb_peek(&vcc->sk->sk_receive_queue);x+				skb = skb_peek(&sk->sk_receive_queue);x 				error = put_user(skb ? skb->len : 0,x 					 	 (int __user *)argp) ? -EFAULT : 0;
 				goto done;x 			}x 		case SIOCGSTAMP: /* borrowed from IP */
-			error = sock_get_timestamp(vcc->sk, argp);x+			error = sock_get_timestamp(sk, argp);x 			goto done;x 		case ATM_SETSC:x 			printk(KERN_WARNING "ATM_SETSC is obsolete\n");xdiff -Nru a/net/atm/lec.c b/net/atm/lec.c
--- a/net/atm/lec.c	2005-01-26 21:53:23 -08:00
+++ b/net/atm/lec.c	2005-02-08 20:09:15 -08:00
@@ -122,6 +122,7 @@
         eth = (struct ethhdr *)skb->data;x         buff = skb->data + skb->dev->hard_header_len;
         if (*buff++ == 0x42 && *buff++ == 0x42 && *buff++ == 0x03) {x+		struct sock *sk;
                 struct sk_buff *skb2;
                 struct atmlec_msg *mesg;
 
@@ -135,8 +136,9 @@
 
                 priv = (struct lec_priv *)dev->priv;
                 atm_force_charge(priv->lecd, skb2->truesize);x-                skb_queue_tail(&priv->lecd->sk->sk_receive_queue, skb2);x-                priv->lecd->sk->sk_data_ready(priv->lecd->sk, skb2->len);x+		sk = sk_atm(priv->lecd);x+                skb_queue_tail(&sk->sk_receive_queue, skb2);x+                sk->sk_data_ready(sk, skb2->len);x         }
 
         return;
@@ -214,7 +216,7 @@
 	ATM_SKB(skb)->vcc = vcc;
 	ATM_SKB(skb)->atm_options = vcc->atm_options;x x-	atomic_add(skb->truesize, &vcc->sk->sk_wmem_alloc);x+	atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);x 	if (vcc->send(vcc, skb) < 0) {x 		priv->stats.tx_dropped++;x 		return;
@@ -430,7 +432,7 @@
         int i;
         char *tmp; /* FIXME */
 
-	atomic_sub(skb->truesize, &vcc->sk->sk_wmem_alloc);x+	atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);x         mesg = (struct atmlec_msg *)skb->data;x         tmp = skb->data;x         tmp += sizeof(struct atmlec_msg);x@@ -528,6 +530,7 @@
                     f->dst->state == BR_STATE_FORWARDING) {x                                 /* hit from bridge table, send LE_ARP_RESPONSE */
                         struct sk_buff *skb2;
+			struct sock *sk;
 
                         DPRINTK("%s: entry found, responding to zeppelin\n", dev->name);x                         skb2 = alloc_skb(sizeof(struct atmlec_msg), GFP_ATOMIC);x@@ -538,8 +541,9 @@
                         skb2->len = sizeof(struct atmlec_msg);x                         memcpy(skb2->data, mesg, sizeof(struct atmlec_msg));x                         atm_force_charge(priv->lecd, skb2->truesize);x-                        skb_queue_tail(&priv->lecd->sk->sk_receive_queue, skb2);x-                        priv->lecd->sk->sk_data_ready(priv->lecd->sk, skb2->len);x+			sk = sk_atm(priv->lecd);x+                        skb_queue_tail(&sk->sk_receive_queue, skb2);x+                        sk->sk_data_ready(sk, skb2->len);x                 }
                 if (f != NULL) br_fdb_put_hook(f);x #endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
@@ -567,10 +571,10 @@
         netif_stop_queue(dev);
         lec_arp_destroy(priv);
 x-        if (skb_peek(&vcc->sk->sk_receive_queue))
+        if (skb_peek(&sk_atm(vcc)->sk_receive_queue))x 		printk("%s lec_atm_close: closing with messages pending\n",x                        dev->name);x-        while ((skb = skb_dequeue(&vcc->sk->sk_receive_queue)) != NULL) {x+        while ((skb = skb_dequeue(&sk_atm(vcc)->sk_receive_queue)) != NULL) {x                 atm_return(vcc, skb->truesize);x 		dev_kfree_skb(skb);x         }
@@ -600,6 +604,7 @@
              unsigned char *mac_addr, unsigned char *atm_addr,
              struct sk_buff *data)
 {x+	struct sock *sk;
 	struct sk_buff *skb;
 	struct atmlec_msg *mesg;
 
@@ -623,14 +628,15 @@
 		memcpy(&mesg->content.normal.atm_addr, atm_addr, ATM_ESA_LEN);
 
         atm_force_charge(priv->lecd, skb->truesize);x-	skb_queue_tail(&priv->lecd->sk->sk_receive_queue, skb);x-        priv->lecd->sk->sk_data_ready(priv->lecd->sk, skb->len);x+	sk = sk_atm(priv->lecd);x+	skb_queue_tail(&sk->sk_receive_queue, skb);x+        sk->sk_data_ready(sk, skb->len);x 
         if (data != NULL) {x                 DPRINTK("lec: about to send %d bytes of data\n", data->len);x                 atm_force_charge(priv->lecd, data->truesize);x-                skb_queue_tail(&priv->lecd->sk->sk_receive_queue, data);x-                priv->lecd->sk->sk_data_ready(priv->lecd->sk, skb->len);x+                skb_queue_tail(&sk->sk_receive_queue, data);x+                sk->sk_data_ready(sk, skb->len);x         }
 
         return 0;
@@ -711,9 +717,11 @@
                 printk("%s...\n",buf);x #endif /* DUMP_PACKETS > 0 */
         if (memcmp(skb->data, lec_ctrl_magic, 4) ==0) { /* Control frame, to daemon*/
+		struct sock *sk = sk_atm(vcc);
+
                 DPRINTK("%s: To daemon\n",dev->name);x-                skb_queue_tail(&vcc->sk->sk_receive_queue, skb);x-                vcc->sk->sk_data_ready(vcc->sk, skb->len);x+                skb_queue_tail(&sk->sk_receive_queue, skb);x+                sk->sk_data_ready(sk, skb->len);x         } else { /* Data frame, queue to protocol handlers */
                 unsigned char *dst;
 
@@ -866,7 +874,7 @@
 	priv->itfnum = i;  /* LANE2 addition */
         priv->lecd = vcc;
         vcc->dev = &lecatm_dev;x-        vcc_insert_socket(vcc->sk);x+        vcc_insert_socket(sk_atm(vcc));
         
         vcc->proto_data = dev_lec[i];x 	set_bit(ATM_VF_META,&vcc->flags);xdiff -Nru a/net/atm/mpc.c b/net/atm/mpc.c
--- a/net/atm/mpc.c	2004-11-23 23:43:55 -08:00
+++ b/net/atm/mpc.c	2005-01-20 18:17:39 -08:00
@@ -522,7 +522,7 @@
 		memcpy(skb->data, &llc_snap_mpoa_data, sizeof(struct llc_snap_hdr));
 	}
 x-	atomic_add(skb->truesize, &entry->shortcut->sk->sk_wmem_alloc);x+	atomic_add(skb->truesize, &sk_atm(entry->shortcut)->sk_wmem_alloc);x 	ATM_SKB(skb)->atm_options = entry->shortcut->atm_options;x 	entry->shortcut->send(entry->shortcut, skb);x 	entry->packets_fwded++;x@@ -665,10 +665,12 @@
 	
 	skb->dev = dev;x 	if (memcmp(skb->data, &llc_snap_mpoa_ctrl, sizeof(struct llc_snap_hdr)) == 0) {x+		struct sock *sk = sk_atm(vcc);
+
 		dprintk("mpoa: (%s) mpc_push: control packet arrived\n", dev->name);x 		/* Pass control packets to daemon */
-		skb_queue_tail(&vcc->sk->sk_receive_queue, skb);x-		vcc->sk->sk_data_ready(vcc->sk, skb->len);x+		skb_queue_tail(&sk->sk_receive_queue, skb);x+		sk->sk_data_ready(sk, skb->len);x 		return;
 	}x 
@@ -794,7 +796,7 @@
 
 	mpc->mpoad_vcc = vcc;
 	vcc->dev = &mpc_dev;x-	vcc_insert_socket(vcc->sk);x+	vcc_insert_socket(sk_atm(vcc));
 	set_bit(ATM_VF_META,&vcc->flags);x 	set_bit(ATM_VF_READY,&vcc->flags);x 
@@ -853,7 +855,7 @@
 	mpc->in_ops->destroy_cache(mpc);
 	mpc->eg_ops->destroy_cache(mpc);
 
-	while ((skb = skb_dequeue(&vcc->sk->sk_receive_queue))) {x+	while ((skb = skb_dequeue(&sk_atm(vcc)->sk_receive_queue))) {x 		atm_return(vcc, skb->truesize);x 		kfree_skb(skb);x 	}x@@ -873,7 +875,7 @@
 	
 	struct mpoa_client *mpc = find_mpc_by_vcc(vcc);
 	struct k_message *mesg = (struct k_message*)skb->data;x-	atomic_sub(skb->truesize, &vcc->sk->sk_wmem_alloc);x+	atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);x 	x 	if (mpc == NULL) {x 		printk("mpoa: msg_from_mpoad: no mpc found\n");x@@ -938,6 +940,7 @@
 int msg_to_mpoad(struct k_message *mesg, struct mpoa_client *mpc)
 {x 	struct sk_buff *skb;
+	struct sock *sk;x 
 	if (mpc == NULL || !mpc->mpoad_vcc) {x 		printk("mpoa: msg_to_mpoad: mesg %d to a non-existent mpoad\n", mesg->type);x@@ -950,8 +953,10 @@
 	skb_put(skb, sizeof(struct k_message));
 	memcpy(skb->data, mesg, sizeof(struct k_message));
 	atm_force_charge(mpc->mpoad_vcc, skb->truesize);x-	skb_queue_tail(&mpc->mpoad_vcc->sk->sk_receive_queue, skb);x-	mpc->mpoad_vcc->sk->sk_data_ready(mpc->mpoad_vcc->sk, skb->len);x+	x+	sk = sk_atm(mpc->mpoad_vcc);x+	skb_queue_tail(&sk->sk_receive_queue, skb);x+	sk->sk_data_ready(sk, skb->len);x x 	return 0;x }x@@ -1206,6 +1211,7 @@
 
 static void purge_egress_shortcut(struct atm_vcc *vcc, eg_cache_entry *entry)
 {x+	struct sock *sk;
 	struct k_message *purge_msg;
 	struct sk_buff *skb;
 
@@ -1229,8 +1235,10 @@
 		purge_msg->content.eg_info = entry->ctrl_info;x 
 	atm_force_charge(vcc, skb->truesize);x-	skb_queue_tail(&vcc->sk->sk_receive_queue, skb);x-	vcc->sk->sk_data_ready(vcc->sk, skb->len);x+x+	sk = sk_atm(vcc);x+	skb_queue_tail(&sk->sk_receive_queue, skb);x+	sk->sk_data_ready(sk, skb->len);x 	dprintk("mpoa: purge_egress_shortcut: exiting:\n");x x 	return;xdiff -Nru a/net/atm/pppoatm.c b/net/atm/pppoatm.c
--- a/net/atm/pppoatm.c	2004-07-21 16:08:38 -07:00
+++ b/net/atm/pppoatm.c	2005-01-20 18:17:39 -08:00
@@ -233,7 +233,8 @@
 		kfree_skb(skb);x 		return 1;x 	}x-	atomic_add(skb->truesize, &ATM_SKB(skb)->vcc->sk->sk_wmem_alloc);x+x+	atomic_add(skb->truesize, &sk_atm(ATM_SKB(skb)->vcc)->sk_wmem_alloc);x 	ATM_SKB(skb)->atm_options = ATM_SKB(skb)->vcc->atm_options;x 	DPRINTK("(unit %d): atm_skb(%p)->vcc(%p)->dev(%p)\n",
 	    pvcc->chan.unit, skb, ATM_SKB(skb)->vcc,xdiff -Nru a/net/atm/proc.c b/net/atm/proc.c
--- a/net/atm/proc.c	2004-06-03 16:43:12 -07:00
+++ b/net/atm/proc.c	2005-01-20 18:17:39 -08:00
@@ -71,9 +71,7 @@
 
 static inline int compare_family(struct sock *sk, int family)
 {x-	struct atm_vcc *vcc = atm_sk(sk);x-x-	return !family || (vcc->sk->sk_family == family);x+	return !family || (sk->sk_family == family);x }
 
 static int __vcc_walk(struct sock **sock, int family, int *bucket, loff_t l)
@@ -203,13 +201,15 @@
 
 static void vcc_info(struct seq_file *seq, struct atm_vcc *vcc)
 {x+	struct sock *sk = sk_atm(vcc);
+
 	seq_printf(seq, "%p ", vcc);
 	if (!vcc->dev)x 		seq_printf(seq, "Unassigned    ");x 	else x 		seq_printf(seq, "%3d %3d %5d ", vcc->dev->number, vcc->vpi,
 			vcc->vci);x-	switch (vcc->sk->sk_family) {x+	switch (sk->sk_family) {x 		case AF_ATMPVC:x 			seq_printf(seq, "PVC");x 			break;x@@ -217,12 +217,12 @@
 			seq_printf(seq, "SVC");x 			break;x 		default:
-			seq_printf(seq, "%3d", vcc->sk->sk_family);x+			seq_printf(seq, "%3d", sk->sk_family);x 	}x-	seq_printf(seq, " %04lx  %5d %7d/%7d %7d/%7d [%d]\n", vcc->flags, vcc->sk->sk_err,x-		atomic_read(&vcc->sk->sk_wmem_alloc),vcc->sk->sk_sndbuf,x-		atomic_read(&vcc->sk->sk_rmem_alloc),vcc->sk->sk_rcvbuf,x-		atomic_read(&vcc->sk->sk_refcnt));
+	seq_printf(seq, " %04lx  %5d %7d/%7d %7d/%7d [%d]\n", vcc->flags, sk->sk_err,x+		  atomic_read(&sk->sk_wmem_alloc), sk->sk_sndbuf,x+		  atomic_read(&sk->sk_rmem_alloc), sk->sk_rcvbuf,x+		  atomic_read(&sk->sk_refcnt));
 }
 
 static void svc_info(struct seq_file *seq, struct atm_vcc *vcc)
diff -Nru a/net/atm/raw.c b/net/atm/raw.c
--- a/net/atm/raw.c	2003-07-15 22:00:12 -07:00
+++ b/net/atm/raw.c	2005-01-20 18:17:39 -08:00
@@ -28,19 +28,23 @@
 void atm_push_raw(struct atm_vcc *vcc,struct sk_buff *skb)
 {x 	if (skb) {x-		skb_queue_tail(&vcc->sk->sk_receive_queue, skb);x-		vcc->sk->sk_data_ready(vcc->sk, skb->len);x+		struct sock *sk = sk_atm(vcc);
+
+		skb_queue_tail(&sk->sk_receive_queue, skb);x+		sk->sk_data_ready(sk, skb->len);x 	}x }
 
 x static void atm_pop_raw(struct atm_vcc *vcc,struct sk_buff *skb)
 {x-	DPRINTK("APopR (%d) %d -= %d\n", vcc->vci, vcc->sk->sk_wmem_alloc,x+	struct sock *sk = sk_atm(vcc);
+
+	DPRINTK("APopR (%d) %d -= %d\n", vcc->vci, sk->sk_wmem_alloc,x 		skb->truesize);x-	atomic_sub(skb->truesize, &vcc->sk->sk_wmem_alloc);x+	atomic_sub(skb->truesize, &sk->sk_wmem_alloc);x 	dev_kfree_skb_any(skb);x-	vcc->sk->sk_write_space(vcc->sk);x+	sk->sk_write_space(sk);x }
 
 xdiff -Nru a/net/atm/signaling.c b/net/atm/signaling.c
--- a/net/atm/signaling.c	2004-10-27 14:35:08 -07:00
+++ b/net/atm/signaling.c	2005-01-20 18:17:39 -08:00
@@ -62,8 +62,8 @@
 	}x #endif
 	atm_force_charge(sigd,skb->truesize);x-	skb_queue_tail(&sigd->sk->sk_receive_queue,skb);x-	sigd->sk->sk_data_ready(sigd->sk, skb->len);x+	skb_queue_tail(&sk_atm(sigd)->sk_receive_queue,skb);x+	sk_atm(sigd)->sk_data_ready(sk_atm(sigd), skb->len);x }
 
 x@@ -97,15 +97,18 @@
 {
 	struct atmsvc_msg *msg;
 	struct atm_vcc *session_vcc;
+	struct sock *sk;x 
 	msg = (struct atmsvc_msg *) skb->data;x-	atomic_sub(skb->truesize, &vcc->sk->sk_wmem_alloc);x+	atomic_sub(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);x 	DPRINTK("sigd_send %d (0x%lx)\n",(int) msg->type,
 	  (unsigned long) msg->vcc);
 	vcc = *(struct atm_vcc **) &msg->vcc;x+	sk = sk_atm(vcc);x+x 	switch (msg->type) {x 		case as_okay:x-			vcc->sk->sk_err = -msg->reply;x+			sk->sk_err = -msg->reply;x 			clear_bit(ATM_VF_WAITING, &vcc->flags);x 			if (!*vcc->local.sas_addr.prv &&x 			    !*vcc->local.sas_addr.pub) {x@@ -126,25 +129,25 @@
 		case as_error:x 			clear_bit(ATM_VF_REGIS,&vcc->flags);x 			clear_bit(ATM_VF_READY,&vcc->flags);x-			vcc->sk->sk_err = -msg->reply;x+			sk->sk_err = -msg->reply;x 			clear_bit(ATM_VF_WAITING, &vcc->flags);x 			break;x 		case as_indicate:
 			vcc = *(struct atm_vcc **) &msg->listen_vcc;
 			DPRINTK("as_indicate!!!\n");x-			lock_sock(vcc->sk);x-			if (vcc->sk->sk_ack_backlog ==x-			    vcc->sk->sk_max_ack_backlog) {x+			lock_sock(sk);x+			if (sk->sk_ack_backlog ==x+			    sk->sk_max_ack_backlog) {x 				sigd_enq(NULL,as_reject,vcc,NULL,NULL);
 				dev_kfree_skb(skb);x 				goto as_indicate_complete;x 			}x-			vcc->sk->sk_ack_backlog++;x-			skb_queue_tail(&vcc->sk->sk_receive_queue, skb);x-			DPRINTK("waking vcc->sk->sk_sleep 0x%p\n", vcc->sk->sk_sleep);x-			vcc->sk->sk_state_change(vcc->sk);x+			sk->sk_ack_backlog++;x+			skb_queue_tail(&sk->sk_receive_queue, skb);x+			DPRINTK("waking sk->sk_sleep 0x%p\n", sk->sk_sleep);x+			sk->sk_state_change(sk);x as_indicate_complete:x-			release_sock(vcc->sk);x+			release_sock(sk);x 			return 0;x 		case as_close:
 			set_bit(ATM_VF_RELEASED,&vcc->flags);x@@ -155,7 +158,7 @@
 			break;x 		case as_addparty:x 		case as_dropparty:x-			vcc->sk->sk_err_soft = msg->reply;	/* < 0 failure, otherwise ep_ref */
+			sk->sk_err_soft = msg->reply;	/* < 0 failure, otherwise ep_ref */
 			clear_bit(ATM_VF_WAITING, &vcc->flags);x 			break;x 		default:
@@ -163,7 +166,7 @@
 			    (int) msg->type);x 			return -EINVAL;
 	}x-	vcc->sk->sk_state_change(vcc->sk);x+	sk->sk_state_change(sk);x out:
 	dev_kfree_skb(skb);x 	return 0;
@@ -213,7 +216,7 @@
 
 static void purge_vcc(struct atm_vcc *vcc)
 {x-	if (vcc->sk->sk_family == PF_ATMSVC &&x+	if (sk_atm(vcc)->sk_family == PF_ATMSVC &&x 	    !test_bit(ATM_VF_META,&vcc->flags)) {x 		set_bit(ATM_VF_RELEASED,&vcc->flags);x 		vcc_release_async(vcc, -EUNATCH);x@@ -229,9 +232,9 @@
 
 	DPRINTK("sigd_close\n");x 	sigd = NULL;x-	if (skb_peek(&vcc->sk->sk_receive_queue))
+	if (skb_peek(&sk_atm(vcc)->sk_receive_queue))x 		printk(KERN_ERR "sigd_close: closing with requests pending\n");x-	skb_queue_purge(&vcc->sk->sk_receive_queue);x+	skb_queue_purge(&sk_atm(vcc)->sk_receive_queue);x x 	read_lock(&vcc_sklist_lock);x 	for(i = 0; i < VCC_HTABLE_SIZE; ++i) {x@@ -268,7 +271,7 @@
 	DPRINTK("sigd_attach\n");x 	sigd = vcc;
 	vcc->dev = &sigd_dev;x-	vcc_insert_socket(vcc->sk);x+	vcc_insert_socket(sk_atm(vcc));
 	set_bit(ATM_VF_META,&vcc->flags);x 	set_bit(ATM_VF_READY,&vcc->flags);x #ifdef WAIT_FOR_DEMONxdiff -Nru a/net/atm/svc.c b/net/atm/svc.c
--- a/net/atm/svc.c	2005-01-26 23:04:07 -08:00
+++ b/net/atm/svc.c	2005-02-08 20:17:29 -08:00
@@ -53,20 +53,21 @@
 {
 	DEFINE_WAIT(wait);x 	struct sk_buff *skb;
+	struct sock *sk = sk_atm(vcc);
 x 	DPRINTK("svc_disconnect %p\n",vcc);
 	if (test_bit(ATM_VF_REGIS,&vcc->flags)) {x-		prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
 		sigd_enq(vcc,as_close,NULL,NULL,NULL);
 		while (!test_bit(ATM_VF_RELEASED,&vcc->flags) && sigd) {
 			schedule();x-			prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
+			prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
 		}x-		finish_wait(vcc->sk->sk_sleep, &wait);
+		finish_wait(sk->sk_sleep, &wait);
 	}x 	/* beware - socket is still in use by atmsigd until the lastx 	   as_indicate has been answered */
-	while ((skb = skb_dequeue(&vcc->sk->sk_receive_queue)) != NULL) {x+	while ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {x 		atm_return(vcc, skb->truesize);x 		DPRINTK("LISTEN REL\n");x 		sigd_enq2(NULL,as_reject,vcc,NULL,NULL,&vcc->qos,0);x@@ -318,8 +319,7 @@
 		goto out;
 	}x 	set_bit(ATM_VF_LISTEN,&vcc->flags);x-	vcc->sk->sk_max_ack_backlog = backlog > 0 ? backlog :x-						    ATM_BACKLOG_DEFAULT;x+	sk->sk_max_ack_backlog = backlog > 0 ? backlog : ATM_BACKLOG_DEFAULT;x 	error = -sk->sk_err;x out:
 	release_sock(sk);x@@ -348,8 +348,8 @@
 	while (1) {x 		DEFINE_WAIT(wait);x x-		prepare_to_wait(old_vcc->sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
-		while (!(skb = skb_dequeue(&old_vcc->sk->sk_receive_queue)) &&x+		prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
+		while (!(skb = skb_dequeue(&sk->sk_receive_queue)) &&x 		       sigd) {
 			if (test_bit(ATM_VF_RELEASED,&old_vcc->flags)) break;x 			if (test_bit(ATM_VF_CLOSE,&old_vcc->flags)) {x@@ -367,9 +367,9 @@
 				error = -ERESTARTSYS;x 				break;x 			}x-			prepare_to_wait(old_vcc->sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
+			prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
 		}x-		finish_wait(old_vcc->sk->sk_sleep, &wait);
+		finish_wait(sk->sk_sleep, &wait);
 		if (error)
 			goto out;
 		if (!skb) {x@@ -385,7 +385,7 @@
 		error = vcc_connect(newsock, msg->pvc.sap_addr.itf,x 				    msg->pvc.sap_addr.vpi, msg->pvc.sap_addr.vci);x 		dev_kfree_skb(skb);x-		old_vcc->sk->sk_ack_backlog--;x+		sk->sk_ack_backlog--;x 		if (error) {
 			sigd_enq2(NULL,as_reject,old_vcc,NULL,NULL,
 			    &old_vcc->qos,error);x@@ -394,23 +394,23 @@
 		}x 		/* wait should be short, so we ignore the non-blocking flag */
 		set_bit(ATM_VF_WAITING, &new_vcc->flags);x-		prepare_to_wait(new_vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(sk_atm(new_vcc)->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
 		sigd_enq(new_vcc,as_accept,old_vcc,NULL,NULL);
 		while (test_bit(ATM_VF_WAITING, &new_vcc->flags) && sigd) {
 			release_sock(sk);x 			schedule();x 			lock_sock(sk);x-			prepare_to_wait(new_vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
+			prepare_to_wait(sk_atm(new_vcc)->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
 		}x-		finish_wait(new_vcc->sk->sk_sleep, &wait);
+		finish_wait(sk_atm(new_vcc)->sk_sleep, &wait);
 		if (!sigd) {
 			error = -EUNATCH;x 			goto out;
 		}x-		if (!new_vcc->sk->sk_err)x+		if (!sk_atm(new_vcc)->sk_err)x 			break;x-		if (new_vcc->sk->sk_err != ERESTARTSYS) {x-			error = -new_vcc->sk->sk_err;
+		if (sk_atm(new_vcc)->sk_err != ERESTARTSYS) {x+			error = -sk_atm(new_vcc)->sk_err;x 			goto out;
 		}x 	}x@@ -436,19 +436,20 @@
 
 int svc_change_qos(struct atm_vcc *vcc,struct atm_qos *qos)
 {x+	struct sock *sk = sk_atm(vcc);
 	DEFINE_WAIT(wait);x x 	set_bit(ATM_VF_WAITING, &vcc->flags);x-	prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
+	prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
 	sigd_enq2(vcc,as_modify,NULL,NULL,&vcc->local,qos,0);x 	while (test_bit(ATM_VF_WAITING, &vcc->flags) &&
 	       !test_bit(ATM_VF_RELEASED, &vcc->flags) && sigd) {
 		schedule();x-		prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(sk->sk_sleep, &wait, TASK_UNINTERRUPTIBLE);
 	}x-	finish_wait(vcc->sk->sk_sleep, &wait);
+	finish_wait(sk->sk_sleep, &wait);
 	if (!sigd) return -EUNATCH;x-	return -vcc->sk->sk_err;
+	return -sk->sk_err;x }
 
 x@@ -533,28 +534,29 @@
 			int sockaddr_len, int flags)
 {x 	DEFINE_WAIT(wait);x+	struct sock *sk = sock->sk;
 	struct atm_vcc *vcc = ATM_SD(sock);
 	int error;
 
-	lock_sock(vcc->sk);x+	lock_sock(sk);x 	set_bit(ATM_VF_WAITING, &vcc->flags);x-	prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
+	prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
 	sigd_enq(vcc, as_addparty, NULL, NULL,
 	         (struct sockaddr_atmsvc *) sockaddr);
 	if (flags & O_NONBLOCK) {x-		finish_wait(vcc->sk->sk_sleep, &wait);
+		finish_wait(sk->sk_sleep, &wait);
 		error = -EINPROGRESS;x 		goto out;
 	}x 	DPRINTK("svc_addparty added wait queue\n");x 	while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) {
 		schedule();x-		prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
+		prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
 	}x-	finish_wait(vcc->sk->sk_sleep, &wait);
-	error = xchg(&vcc->sk->sk_err_soft, 0);
+	finish_wait(sk->sk_sleep, &wait);
+	error = xchg(&sk->sk_err_soft, 0);
 out:
-	release_sock(vcc->sk);x+	release_sock(sk);x 	return error;
 }x 
@@ -562,25 +564,26 @@
 static int svc_dropparty(struct socket *sock, int ep_ref)
 {x 	DEFINE_WAIT(wait);x+	struct sock *sk = sock->sk;
 	struct atm_vcc *vcc = ATM_SD(sock);
 	int error;
 
-	lock_sock(vcc->sk);x+	lock_sock(sk);x 	set_bit(ATM_VF_WAITING, &vcc->flags);x-	prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
+	prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
 	sigd_enq2(vcc, as_dropparty, NULL, NULL, NULL, NULL, ep_ref);x 	while (test_bit(ATM_VF_WAITING, &vcc->flags) && sigd) {
 		schedule();x-		prepare_to_wait(vcc->sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
+		prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
 	}x-	finish_wait(vcc->sk->sk_sleep, &wait);
+	finish_wait(sk->sk_sleep, &wait);
 	if (!sigd) {
 		error = -EUNATCH;x 		goto out;
 	}x-	error = xchg(&vcc->sk->sk_err_soft, 0);
+	error = xchg(&sk->sk_err_soft, 0);
 out:
-	release_sock(vcc->sk);x+	release_sock(sk);x 	return error;
 }x 
diff -Nru a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
--- a/net/bluetooth/hci_conn.c	2005-01-29 17:26:20 -08:00
+++ b/net/bluetooth/hci_conn.c	2005-03-05 05:08:48 -08:00
@@ -348,6 +348,24 @@
 }x EXPORT_SYMBOL(hci_conn_change_link_key);x 
+/* Switch role */
+int hci_conn_switch_role(struct hci_conn *conn, uint8_t role)x+{x+	BT_DBG("conn %p", conn);
+
+	if (!role && conn->link_mode & HCI_LM_MASTER)x+		return 1;x+
+	if (!test_and_set_bit(HCI_CONN_RSWITCH_PEND, &conn->pend)) {x+		struct hci_cp_switch_role cp;
+		bacpy(&cp.bdaddr, &conn->dst);
+		cp.role = role;
+		hci_send_cmd(conn->hdev, OGF_LINK_POLICY, OCF_SWITCH_ROLE, sizeof(cp), &cp);x+	}
+	return 0;x+}
+EXPORT_SYMBOL(hci_conn_switch_role);x+x /* Drop all connection on the device */
 void hci_conn_hash_flush(struct hci_dev *hdev)x {
diff -Nru a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
--- a/net/bluetooth/hci_event.c	2005-01-28 18:18:05 -08:00
+++ b/net/bluetooth/hci_event.c	2005-03-05 05:08:45 -08:00
@@ -718,17 +718,20 @@
 
 	BT_DBG("%s status %d", hdev->name, ev->status);
 x-	if (ev->status)x-		return;x-x 	hci_dev_lock(hdev);
 x 	conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
 	if (conn) {x-		if (ev->role)x-			conn->link_mode &= ~HCI_LM_MASTER;x-		elsex-			conn->link_mode |= HCI_LM_MASTER;x+		if (!ev->status) {x+			if (ev->role)x+				conn->link_mode &= ~HCI_LM_MASTER;x+			elsex+				conn->link_mode |= HCI_LM_MASTER;x+		}
+
+		clear_bit(HCI_CONN_RSWITCH_PEND, &conn->pend);
+
+		hci_role_switch_cfm(conn, ev->status, ev->role);x 	}x 
 	hci_dev_unlock(hdev);
@@ -749,6 +752,7 @@
 	if (conn) {x 		if (!ev->status)
 			conn->link_mode |= HCI_LM_AUTH;
+
 		clear_bit(HCI_CONN_AUTH_PEND, &conn->pend);
 x 		hci_auth_cfm(conn, ev->status);
@@ -790,6 +794,7 @@
 			elsex 				conn->link_mode &= ~HCI_LM_ENCRYPT;
 		}x+
 		clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->pend);
 x 		hci_encrypt_cfm(conn, ev->status, ev->encrypt);
@@ -801,6 +806,25 @@
 /* Change Connection Link Key Complete */
 static inline void hci_change_conn_link_key_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
 {x+	struct hci_ev_change_conn_link_key_complete *ev = (struct hci_ev_change_conn_link_key_complete *) skb->data;x+	struct hci_conn *conn = NULL;x+	__u16 handle = __le16_to_cpu(ev->handle);
+
+	BT_DBG("%s status %d", hdev->name, ev->status);
+
+	hci_dev_lock(hdev);
+
+	conn = hci_conn_hash_lookup_handle(hdev, handle);
+	if (conn) {x+		if (!ev->status)x+			conn->link_mode |= HCI_LM_SECURE;
+
+		clear_bit(HCI_CONN_AUTH_PEND, &conn->pend);
+
+		hci_key_change_cfm(conn, ev->status);
+	}
+
+	hci_dev_unlock(hdev);
 }
 
 /* Pin Code Request*/
diff -Nru a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
--- a/net/bluetooth/hci_sysfs.c	2004-12-06 00:16:21 -08:00
+++ b/net/bluetooth/hci_sysfs.c	2005-03-05 04:43:03 -08:00
@@ -55,7 +55,7 @@
 				batostr(&bdaddr),x 				data->pscan_rep_mode, data->pscan_period_mode, data->pscan_mode,x 				data->dev_class[2], data->dev_class[1], data->dev_class[0],x-				data->clock_offset, data->rssi, e->timestamp);x+				__le16_to_cpu(data->clock_offset), data->rssi, e->timestamp);x 	}x 
 	hci_dev_unlock_bh(hdev);
diff -Nru a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c	2005-02-08 16:20:02 -08:00
+++ b/net/core/dev.c	2005-02-10 21:54:32 -08:00
@@ -2300,6 +2300,21 @@
 	return err;
 }
 
+int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)x+{x+	int err;x+
+	if (!dev->set_mac_address)x+		return -EOPNOTSUPP;x+	if (sa->sa_family != dev->type)x+		return -EINVAL;
+	if (!netif_device_present(dev))x+		return -ENODEV;
+	err = dev->set_mac_address(dev, sa);
+	if (!err)x+		notifier_call_chain(&netdev_chain, NETDEV_CHANGEADDR, dev);x+	return err;x+}
 
 /*
  *	Perform the SIOCxIFxxx calls.
@@ -2346,17 +2361,7 @@
 			return 0;
 x 		case SIOCSIFHWADDR:x-			if (!dev->set_mac_address)x-				return -EOPNOTSUPP;x-			if (ifr->ifr_hwaddr.sa_family != dev->type)x-				return -EINVAL;
-			if (!netif_device_present(dev))x-				return -ENODEV;
-			err = dev->set_mac_address(dev, &ifr->ifr_hwaddr);x-			if (!err)x-				notifier_call_chain(&netdev_chain,x-						    NETDEV_CHANGEADDR, dev);x-			return err;
+			return dev_set_mac_address(dev, &ifr->ifr_hwaddr);x x 		case SIOCSIFHWBROADCAST:x 			if (ifr->ifr_hwaddr.sa_family != dev->type)x@@ -3322,6 +3327,7 @@
 EXPORT_SYMBOL(dev_set_promiscuity);x EXPORT_SYMBOL(dev_change_flags);x EXPORT_SYMBOL(dev_set_mtu);x+EXPORT_SYMBOL(dev_set_mac_address);x EXPORT_SYMBOL(free_netdev);x EXPORT_SYMBOL(netdev_boot_setup_check);
 EXPORT_SYMBOL(netdev_set_master);
diff -Nru a/net/core/netfilter.c b/net/core/netfilter.c
--- a/net/core/netfilter.c	2005-01-13 20:41:04 -08:00
+++ b/net/core/netfilter.c	2005-02-08 20:02:09 -08:00
@@ -678,7 +678,6 @@
 int skb_ip_make_writable(struct sk_buff **pskb, unsigned int writable_len)
 {x 	struct sk_buff *nskb;
-	unsigned int iplen;
 
 	if (writable_len > (*pskb)->len)x 		return 0;
@@ -687,35 +686,7 @@
 	if (skb_shared(*pskb) || skb_cloned(*pskb))x 		goto copy_skb;
 
-	/* Alexey says IP hdr is always modifiable and linear, so ok. */
-	if (writable_len <= (*pskb)->nh.iph->ihl*4)x-		return 1;x-x-	iplen = writable_len - (*pskb)->nh.iph->ihl*4;x-x-	/* DaveM says protocol headers are also modifiable. */
-	switch ((*pskb)->nh.iph->protocol) {x-	case IPPROTO_TCP: {x-		struct tcphdr _hdr, *hp;x-		hp = skb_header_pointer(*pskb, (*pskb)->nh.iph->ihl*4,x-					sizeof(_hdr), &_hdr);x-		if (hp == NULL)x-			goto copy_skb;
-		if (writable_len <= (*pskb)->nh.iph->ihl*4 + hp->doff*4)x-			goto pull_skb;
-		goto copy_skb;
-	}x-	case IPPROTO_UDP:
-		if (writable_len<=(*pskb)->nh.iph->ihl*4+sizeof(struct udphdr))x-			goto pull_skb;
-		goto copy_skb;
-	case IPPROTO_ICMP:
-		if (writable_len
-		    <= (*pskb)->nh.iph->ihl*4 + sizeof(struct icmphdr))x-			goto pull_skb;
-		goto copy_skb;
-	/* Insert other cases here as desired */
-	}
+	return pskb_may_pull(*pskb, writable_len);
 
 copy_skb:x 	nskb = skb_copy(*pskb, GFP_ATOMIC);x@@ -730,9 +701,6 @@
 	kfree_skb(*pskb);x 	*pskb = nskb;
 	return 1;x-x-pull_skb:x-	return pskb_may_pull(*pskb, writable_len);
 }x EXPORT_SYMBOL(skb_ip_make_writable);x #endif /*CONFIG_INET*/
diff -Nru a/net/core/skbuff.c b/net/core/skbuff.c
--- a/net/core/skbuff.c	2004-12-01 21:49:52 -08:00
+++ b/net/core/skbuff.c	2005-02-23 19:16:58 -08:00
@@ -241,7 +241,8 @@
 void skb_release_data(struct sk_buff *skb)
 {x 	if (!skb->cloned ||x-	    atomic_dec_and_test(&(skb_shinfo(skb)->dataref))) {x+	    !atomic_sub_return(skb->nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1,x+			       &skb_shinfo(skb)->dataref)) {x 		if (skb_shinfo(skb)->nr_frags) {
 			int i;x 			for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)x@@ -353,6 +354,7 @@
 	C(csum);x 	C(local_df);x 	n->cloned = 1;x+	n->nohdr = 0;x 	C(pkt_type);x 	C(ip_summed);x 	C(priority);x@@ -604,6 +606,7 @@
 	skb->h.raw   += off;
 	skb->nh.raw  += off;
 	skb->cloned   = 0;x+	skb->nohdr    = 0;x 	atomic_set(&skb_shinfo(skb)->dataref, 1);x 	return 0;
 
diff -Nru a/net/core/sock.c b/net/core/sock.c
--- a/net/core/sock.c	2005-02-10 19:20:16 -08:00
+++ b/net/core/sock.c	2005-02-15 11:54:29 -08:00
@@ -621,9 +621,17 @@
 {
 	struct sock *sk = NULL;
 x-	if (!slab)x+	/*
+	 * Transitional, this test will be removed when sk_cachep is killed
+	 */x+	if (slab == NULL && zero_it == 1)x 		slab = sk_cachep;
-	sk = kmem_cache_alloc(slab, priority);x+x+	if (slab != NULL)x+		sk = kmem_cache_alloc(slab, priority);x+	elsex+		sk = kmalloc(zero_it, priority);x+x 	if (sk) {x 		if (zero_it) {
 			memset(sk, 0,x@@ -662,7 +670,10 @@
 		       __FUNCTION__, atomic_read(&sk->sk_omem_alloc));x x 	security_sk_free(sk);x-	kmem_cache_free(sk->sk_slab, sk);x+	if (sk->sk_slab != NULL)x+		kmem_cache_free(sk->sk_slab, sk);x+	elsex+		kfree(sk);x 	module_put(owner);x }x 
diff -Nru a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c
--- a/net/decnet/af_decnet.c	2005-01-13 21:03:01 -08:00
+++ b/net/decnet/af_decnet.c	2005-01-20 14:35:54 -08:00
@@ -456,8 +456,6 @@
 	if  (!sk)x 		goto out;
 
-	sk->sk_protinfo = scp = (struct dn_scp *)(sk + 1);x-x 	if (sock)x 		sock->ops = &dn_proto_ops;
 	sock_init_data(sock, sk);x@@ -471,6 +469,7 @@
 	sk->sk_allocation  = gfp;x x 	/* Initialization of DECnet Session Control Port		*/x+	scp = DN_SK(sk);x 	scp->state	= DN_O;		/* Open			*/x 	scp->numdat	= 1;		/* Next data seg to tx	*/x 	scp->numoth	= 1;		/* Next oth data to tx  */
diff -Nru a/net/econet/af_econet.c b/net/econet/af_econet.c
--- a/net/econet/af_econet.c	2005-01-13 20:41:05 -08:00
+++ b/net/econet/af_econet.c	2005-01-20 14:44:43 -08:00
@@ -184,7 +184,7 @@
 {
 	struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr;
 	struct sock *sk=sock->sk;
-	struct econet_opt *eo = ec_sk(sk);x+	struct econet_sock *eo = ec_sk(sk);x 	x 	/*
 	 *	Check legality
@@ -284,7 +284,7 @@
 	 */
 	 
 	if (saddr == NULL) {x-		struct econet_opt *eo = ec_sk(sk);x+		struct econet_sock *eo = ec_sk(sk);x x 		addr.station = eo->station;x 		addr.net     = eo->net;x@@ -485,7 +485,7 @@
 			  int *uaddr_len, int peer)
 {
 	struct sock *sk = sock->sk;
-	struct econet_opt *eo = ec_sk(sk);x+	struct econet_sock *eo = ec_sk(sk);x 	struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr;
 
 	if (peer)
@@ -562,7 +562,7 @@
 static int econet_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct econet_opt *eo;x+	struct econet_sock *eo;
 	int err;x x 	/* Econet only provides datagram services. */
@@ -572,7 +572,8 @@
 	sock->state = SS_UNCONNECTED;x 
 	err = -ENOBUFS;
-	sk = sk_alloc(PF_ECONET, GFP_KERNEL, 1, NULL);x+	sk = sk_alloc(PF_ECONET, GFP_KERNEL,x+		      sizeof(struct econet_sock), NULL);x 	if (sk == NULL)x 		goto out;
 
@@ -581,19 +582,13 @@
 	sock_init_data(sock,sk);x 	sk_set_owner(sk, THIS_MODULE);
 
-	eo = sk->sk_protinfo = kmalloc(sizeof(*eo), GFP_KERNEL);x-	if (!eo)
-		goto out_free;x-	memset(eo, 0, sizeof(*eo));x+	eo = ec_sk(sk);x 	sk->sk_zapped = 0;x 	sk->sk_family = PF_ECONET;x 	eo->num = protocol;x 
 	econet_insert_socket(&econet_sklist, sk);x 	return(0);x-x-out_free:
-	sk_free(sk);x out:
 	return err;
 }
@@ -735,7 +730,7 @@
 	struct hlist_node *node;x x 	sk_for_each(sk, node, &econet_sklist) {x-		struct econet_opt *opt = ec_sk(sk);x+		struct econet_sock *opt = ec_sk(sk);x 		if ((opt->port == port || opt->port == 0) && 
 		    (opt->station == station || opt->station == 0) &&x 		    (opt->net == net || opt->net == 0))
diff -Nru a/net/ipv4/ah4.c b/net/ipv4/ah4.c
--- a/net/ipv4/ah4.c	2005-01-25 21:53:19 -08:00
+++ b/net/ipv4/ah4.c	2005-02-08 20:26:16 -08:00
@@ -53,11 +53,9 @@
 	return 0;x }x 
-static int ah_output(struct sk_buff *skb)
+static int ah_output(struct xfrm_state *x, struct sk_buff *skb)
 {x 	int err;x-	struct dst_entry *dst = skb->dst;
-	struct xfrm_state *x  = dst->xfrm;x 	struct iphdr *iph, *top_iph;x 	struct ip_auth_hdr *ah;x 	struct ah_data *ahp;
diff -Nru a/net/ipv4/devinet.c b/net/ipv4/devinet.c
--- a/net/ipv4/devinet.c	2005-01-10 13:43:25 -08:00
+++ b/net/ipv4/devinet.c	2005-02-15 14:09:16 -08:00
@@ -187,6 +187,10 @@
 x 	ASSERT_RTNL();x 
+	dev = in_dev->dev;x+	if (dev == &loopback_dev)x+		return;x+x 	in_dev->dead = 1;x 
 	ip_mc_destroy_dev(in_dev);x@@ -200,7 +204,6 @@
 	devinet_sysctl_unregister(&in_dev->cnf);x #endif
 
-	dev = in_dev->dev;x 	dev->ip_ptr = NULL;
 x #ifdef CONFIG_SYSCTLx@@ -943,8 +946,16 @@
 x 	ASSERT_RTNL();x 
-	if (!in_dev)
+	if (!in_dev) {x+		if (event == NETDEV_REGISTER && dev == &loopback_dev) {x+			in_dev = inetdev_init(dev);x+			if (!in_dev)
+				panic("devinet: Failed to create loopback\n");x+			in_dev->cnf.no_xfrm = 1;x+			in_dev->cnf.no_policy = 1;x+		}x 		goto out;
+	}x 
 	switch (event) {
 	case NETDEV_REGISTER:
@@ -967,8 +978,6 @@
 				memcpy(ifa->ifa_label, dev->name, IFNAMSIZ);x 				inet_insert_ifa(ifa);x 			}x-			in_dev->cnf.no_xfrm = 1;x-			in_dev->cnf.no_policy = 1;x 		}x 		ip_mc_up(in_dev);x 		break;xdiff -Nru a/net/ipv4/esp4.c b/net/ipv4/esp4.c
--- a/net/ipv4/esp4.c	2005-01-26 22:15:55 -08:00
+++ b/net/ipv4/esp4.c	2005-02-08 20:26:16 -08:00
@@ -17,11 +17,9 @@
 	__u8		proto;x };x 
-static int esp_output(struct sk_buff *skb)
+static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
 {x 	int err;x-	struct dst_entry *dst = skb->dst;
-	struct xfrm_state *x  = dst->xfrm;x 	struct iphdr *top_iph;x 	struct ip_esp_hdr *esph;x 	struct crypto_tfm *tfm;xdiff -Nru a/net/ipv4/ipcomp.c b/net/ipv4/ipcomp.c
--- a/net/ipv4/ipcomp.c	2005-01-25 21:53:19 -08:00
+++ b/net/ipv4/ipcomp.c	2005-02-08 20:26:16 -08:00
@@ -154,11 +154,9 @@
 	return err;
 }
 
-static int ipcomp_output(struct sk_buff *skb)
+static int ipcomp_output(struct xfrm_state *x, struct sk_buff *skb)
 {x 	int err;x-	struct dst_entry *dst = skb->dst;
-	struct xfrm_state *x = dst->xfrm;x 	struct iphdr *iph;x 	struct ip_comp_hdr *ipch;x 	struct ipcomp_data *ipcd = x->data;xdiff -Nru a/net/ipv4/ipvs/ip_vs_ctl.c b/net/ipv4/ipvs/ip_vs_ctl.c
--- a/net/ipv4/ipvs/ip_vs_ctl.c	2005-01-13 20:41:05 -08:00
+++ b/net/ipv4/ipvs/ip_vs_ctl.c	2005-02-15 13:58:35 -08:00
@@ -26,7 +26,7 @@
 #include <linux/fs.h>
 #include <linux/sysctl.h>
 #include <linux/proc_fs.h>
-#include <linux/timer.h>
+#include <linux/workqueue.h>
 #include <linux/swap.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
@@ -90,7 +90,7 @@
 #endif
 
 /*
- *	update_defense_level is called from timer bh and from sysctl.
+ *	update_defense_level is called from keventd and from sysctl.
  */
 static void update_defense_level(void)
 {x@@ -212,19 +212,19 @@
 /*
  *	Timer for checking the defense
  */
-static struct timer_list defense_timer;x #define DEFENSE_TIMER_PERIOD	1*HZ
+static void defense_work_handler(void *data);
+static DECLARE_WORK(defense_work, defense_work_handler, NULL);x 
-static void defense_timer_handler(unsigned long data)
+static void defense_work_handler(void *data)
 {x 	update_defense_level();x 	if (atomic_read(&ip_vs_dropentry))x 		ip_vs_random_dropentry();x 
-	mod_timer(&defense_timer, jiffies + DEFENSE_TIMER_PERIOD);x+	schedule_delayed_work(&defense_work, DEFENSE_TIMER_PERIOD);x }
 
-
 int
 ip_vs_use_count_inc(void)
 {x@@ -2370,10 +2370,7 @@
 	ip_vs_new_estimator(&ip_vs_stats);x x 	/* Hook the defense timer */
-	init_timer(&defense_timer);x-	defense_timer.function = defense_timer_handler;x-	defense_timer.expires = jiffies + DEFENSE_TIMER_PERIOD;x-	add_timer(&defense_timer);x+	schedule_delayed_work(&defense_work, DEFENSE_TIMER_PERIOD);x x 	LeaveFunction(2);x 	return 0;
@@ -2384,7 +2381,7 @@
 {
 	EnterFunction(2);x 	ip_vs_trash_cleanup();x-	del_timer_sync(&defense_timer);x+	cancel_rearming_delayed_work(&defense_work);x 	ip_vs_kill_estimator(&ip_vs_stats);x 	unregister_sysctl_table(sysctl_header);x 	proc_net_remove("ip_vs_stats");xdiff -Nru a/net/ipv4/netfilter/ipt_hashlimit.c b/net/ipv4/netfilter/ipt_hashlimit.c
--- a/net/ipv4/netfilter/ipt_hashlimit.c	2005-02-23 19:49:42 -08:00
+++ b/net/ipv4/netfilter/ipt_hashlimit.c	2005-02-23 19:57:13 -08:00
@@ -33,11 +33,7 @@
 #include <linux/sctp.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
-
-#define ASSERT_READ_LOCK(x) 
-#define ASSERT_WRITE_LOCK(x) 
-#include <linux/netfilter_ipv4/lockhelp.h>
-#include <linux/netfilter_ipv4/listhelp.h>
+#include <linux/list.h>
 
 #include <linux/netfilter_ipv4/ip_tables.h>
 #include <linux/netfilter_ipv4/ipt_hashlimit.h>
@@ -67,7 +63,7 @@
 
 struct dsthash_ent {x 	/* static / read-only parts in the beginning */
-	struct list_head list;x+	struct hlist_node node;x 	struct dsthash_dst dst;
 
 	/* modified structure members in the end */
@@ -80,7 +76,7 @@
 };x 
 struct ipt_hashlimit_htable {x-	struct list_head list;		/* global list of all htables */x+	struct hlist_node node;		/* global list of all htables */x 	atomic_t use;x x 	struct hashlimit_cfg cfg;	/* config */
@@ -94,12 +90,12 @@
 	/* seq_file stuff */x 	struct proc_dir_entry *pde;x x-	struct list_head hash[0];	/* hashtable itself */x+	struct hlist_head hash[0];	/* hashtable itself */x };x 
-static DECLARE_RWLOCK(hashlimit_lock);	/* protects htables list */x+static DECLARE_LOCK(hashlimit_lock);	/* protects htables list */x static DECLARE_MUTEX(hlimit_mutex);	/* additional checkentry protection */
-static LIST_HEAD(hashlimit_htables);
+static HLIST_HEAD(hashlimit_htables);
 static kmem_cache_t *hashlimit_cachep;
 
 static inline int dst_cmp(const struct dsthash_ent *ent, struct dsthash_dst *b)x@@ -120,9 +116,17 @@
 static inline struct dsthash_ent *
 __dsthash_find(const struct ipt_hashlimit_htable *ht, struct dsthash_dst *dst)
 {x-	struct dsthash_ent *ent;x+	struct dsthash_ent *ent = NULL;x+	struct hlist_node *pos;
 	u_int32_t hash = hash_dst(ht, dst);
-	ent = LIST_FIND(&ht->hash[hash], dst_cmp, struct dsthash_ent *, dst);
+
+	if (!hlist_empty(&ht->hash[hash]))x+		hlist_for_each_entry(ent, pos, &ht->hash[hash], node) {x+			if (dst_cmp(ent, dst)) {x+				break;x+			}x+		}
+	
 	return ent;x }x 
@@ -162,7 +166,7 @@
 	ent->dst.src_ip = dst->src_ip;
 	ent->dst.src_port = dst->src_port;
 
-	list_add(&ent->list, &ht->hash[hash_dst(ht, dst)]);x+	hlist_add_head(&ent->node, &ht->hash[hash_dst(ht, dst)]);x 
 	return ent;x }x@@ -170,7 +174,7 @@
 static inline void 
 __dsthash_free(struct ipt_hashlimit_htable *ht, struct dsthash_ent *ent)
 {x-	list_del(&ent->list);x+	hlist_del(&ent->node);
 	kmem_cache_free(hashlimit_cachep, ent);x 	atomic_dec(&ht->count);x }x@@ -210,7 +214,7 @@
 		hinfo->cfg.max = hinfo->cfg.size;x 
 	for (i = 0; i < hinfo->cfg.size; i++)x-		INIT_LIST_HEAD(&hinfo->hash[i]);x+		INIT_HLIST_HEAD(&hinfo->hash[i]);x x 	atomic_set(&hinfo->count, 0);
 	atomic_set(&hinfo->use, 1);x@@ -230,9 +234,9 @@
 	hinfo->timer.function = htable_gc;
 	add_timer(&hinfo->timer);x 
-	WRITE_LOCK(&hashlimit_lock);
-	list_add(&hinfo->list, &hashlimit_htables);
-	WRITE_UNLOCK(&hashlimit_lock);
+	LOCK_BH(&hashlimit_lock);
+	hlist_add_head(&hinfo->node, &hashlimit_htables);
+	UNLOCK_BH(&hashlimit_lock);
 x 	return 0;x }x@@ -258,8 +262,9 @@
 	/* lock hash table and iterate over it */x 	spin_lock_bh(&ht->lock);x 	for (i = 0; i < ht->cfg.size; i++) {x-		struct dsthash_ent *dh, *n;x-		list_for_each_entry_safe(dh, n, &ht->hash[i], list) {x+		struct dsthash_ent *dh;x+		struct hlist_node *pos, *n;x+		hlist_for_each_entry_safe(dh, pos, n, &ht->hash[i], node) {x 			if ((*select)(ht, dh))x 				__dsthash_free(ht, dh);x 		}x@@ -295,16 +300,17 @@
 static struct ipt_hashlimit_htable *htable_find_get(char *name)
 {
 	struct ipt_hashlimit_htable *hinfo;x+	struct hlist_node *pos;
 x-	READ_LOCK(&hashlimit_lock);
-	list_for_each_entry(hinfo, &hashlimit_htables, list) {x+	LOCK_BH(&hashlimit_lock);
+	hlist_for_each_entry(hinfo, pos, &hashlimit_htables, node) {x 		if (!strcmp(name, hinfo->pde->name)) {x 			atomic_inc(&hinfo->use);x-			READ_UNLOCK(&hashlimit_lock);
+			UNLOCK_BH(&hashlimit_lock);
 			return hinfo;x 		}x 	}x-	READ_UNLOCK(&hashlimit_lock);
+	UNLOCK_BH(&hashlimit_lock);
 x 	return NULL;
 }x@@ -312,9 +318,9 @@
 static void htable_put(struct ipt_hashlimit_htable *hinfo)
 {x 	if (atomic_dec_and_test(&hinfo->use)) {x-		WRITE_LOCK(&hashlimit_lock);
-		list_del(&hinfo->list);
-		WRITE_UNLOCK(&hashlimit_lock);
+		LOCK_BH(&hashlimit_lock);
+		hlist_del(&hinfo->node);
+		UNLOCK_BH(&hashlimit_lock);
 		htable_destroy(hinfo);x 	}x }
@@ -631,12 +637,17 @@
 	struct proc_dir_entry *pde = s->private;
 	struct ipt_hashlimit_htable *htable = pde->data;x 	unsigned int *bucket = (unsigned int *)v;x+	struct dsthash_ent *ent;x+	struct hlist_node *pos;
 x-	if (LIST_FIND_W(&htable->hash[*bucket], dl_seq_real_show,
-		      struct dsthash_ent *, s)) {x-		/* buffer was filled and unable to print that tuple */
-		return 1;x-	}
+	if (!hlist_empty(&htable->hash[*bucket]))x+		hlist_for_each_entry(ent, pos, &htable->hash[*bucket], node) {x+			if (dl_seq_real_show(ent, s)) {x+				/* buffer was filled and unable to print that tuple */
+				return 1;x+			}x+		}
+	
 	return 0;x }x 
diff -Nru a/net/ipv4/route.c b/net/ipv4/route.c
--- a/net/ipv4/route.c	2005-02-18 01:54:18 -08:00
+++ b/net/ipv4/route.c	2005-03-05 20:43:44 -08:00
@@ -104,6 +104,9 @@
 #include <linux/sysctl.h>
 #endif
 
+#define RT_FL_TOS(oldflp) \
+    ((u32)(oldflp->fl4_tos & (IPTOS_RT_MASK | RTO_ONLINK)))x+x #define IP_MAX_MTU	0xFFF0
 
 #define RT_GC_TIMEOUT (300*HZ)x@@ -144,6 +147,7 @@
 static void		 ipv4_link_failure(struct sk_buff *skb);
 static void		 ip_rt_update_pmtu(struct dst_entry *dst, u32 mtu);x static int rt_garbage_collect(void);
+static inline int compare_keys(struct flowi *fl1, struct flowi *fl2);
 x 
 static struct dst_ops ipv4_dst_ops = {x@@ -1535,6 +1539,169 @@
 	return -EINVAL;
 }
 
+
+static void ip_handle_martian_source(struct net_device *dev,
+				     struct in_device *in_dev,
+				     struct sk_buff *skb,
+				     u32 daddr,
+				     u32 saddr) x+{x+	RT_CACHE_STAT_INC(in_martian_src);x+#ifdef CONFIG_IP_ROUTE_VERBOSE
+	if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) {x+		/*
+		 *	RFC1812 recommendation, if source is martian,
+		 *	the only hint is MAC header.
+		 */
+		printk(KERN_WARNING "martian source %u.%u.%u.%u from "
+			"%u.%u.%u.%u, on dev %s\n",
+			NIPQUAD(daddr), NIPQUAD(saddr), dev->name);x+		if (dev->hard_header_len) {x+			int i;x+			unsigned char *p = skb->mac.raw;
+			printk(KERN_WARNING "ll header: ");x+			for (i = 0; i < dev->hard_header_len; i++, p++) {x+				printk("%02x", *p);x+				if (i < (dev->hard_header_len - 1))
+					printk(":");x+			}
+			printk("\n");x+		}
+	}
+#endif
+}
+
+static inline int __mkroute_input(struct sk_buff *skb, 
+				  struct fib_result* res, 
+				  struct in_device *in_dev, 
+				  u32 daddr, u32 saddr, u32 tos, 
+				  struct rtable **result) x+{x+x+	struct rtable *rth;x+	int err;x+	struct in_device *out_dev;x+	unsigned flags = 0;x+	u32 spec_dst, itag;
+
+	/* get a working reference to the output device */
+	out_dev = in_dev_get(FIB_RES_DEV(*res));x+	if (out_dev == NULL) {x+		if (net_ratelimit())
+			printk(KERN_CRIT "Bug in ip_route_input" \
+			       "_slow(). Please, report\n");x+		return -EINVAL;
+	}
+
+
+	err = fib_validate_source(saddr, daddr, tos, FIB_RES_OIF(*res), 
+				  in_dev->dev, &spec_dst, &itag);x+	if (err < 0) {x+		ip_handle_martian_source(in_dev->dev, in_dev, skb, daddr, 
+					 saddr);x+		x+		err = -EINVAL;
+		goto cleanup;
+	}
+
+	if (err)
+		flags |= RTCF_DIRECTSRC;
+
+	if (out_dev == in_dev && err && !(flags & (RTCF_NAT | RTCF_MASQ)) &&x+	    (IN_DEV_SHARED_MEDIA(out_dev) ||x+	     inet_addr_onlink(out_dev, saddr, FIB_RES_GW(*res))))
+		flags |= RTCF_DOREDIRECT;x+x+	if (skb->protocol != htons(ETH_P_IP)) {x+		/* Not IP (i.e. ARP). Do not create route, if it is
+		 * invalid for proxy arp. DNAT routes are always valid.
+		 */
+		if (out_dev == in_dev && !(flags & RTCF_DNAT)) {x+			err = -EINVAL;
+			goto cleanup;
+		}
+	}
+x+x+	rth = dst_alloc(&ipv4_dst_ops);
+	if (!rth) {x+		err = -ENOBUFS;
+		goto cleanup;
+	}
+
+	rth->u.dst.flags= DST_HOST;
+	if (in_dev->cnf.no_policy)x+		rth->u.dst.flags |= DST_NOPOLICY;
+	if (in_dev->cnf.no_xfrm)x+		rth->u.dst.flags |= DST_NOXFRM;
+	rth->fl.fl4_dst	= daddr;
+	rth->rt_dst	= daddr;
+	rth->fl.fl4_tos	= tos;
+#ifdef CONFIG_IP_ROUTE_FWMARK
+	rth->fl.fl4_fwmark= skb->nfmark;
+#endif
+	rth->fl.fl4_src	= saddr;
+	rth->rt_src	= saddr;
+	rth->rt_gateway	= daddr;
+	rth->rt_iif 	=x+		rth->fl.iif	= in_dev->dev->ifindex;
+	rth->u.dst.dev	= (out_dev)->dev;x+	dev_hold(rth->u.dst.dev);
+	rth->idev	= in_dev_get(rth->u.dst.dev);
+	rth->fl.oif 	= 0;x+	rth->rt_spec_dst= spec_dst;
+
+	rth->u.dst.input = ip_forward;
+	rth->u.dst.output = ip_output;
+
+	rt_set_nexthop(rth, res, itag);x+x+	rth->rt_flags = flags;x+x+	*result = rth;x+	err = 0;x+ cleanup:
+	/* release the working reference to the output device */
+	in_dev_put(out_dev);x+	return err;x+}						
+
+static inline int ip_mkroute_input_def(struct sk_buff *skb, 
+				       struct fib_result* res, 
+				       const struct flowi *fl,
+				       struct in_device *in_dev,
+				       u32 daddr, u32 saddr, u32 tos)x+{x+	struct rtable* rth;x+	int err;x+	unsigned hash;x+x+#ifdef CONFIG_IP_ROUTE_MULTIPATH
+	if (res->fi->fib_nhs > 1 && fl->oif == 0)
+		fib_select_multipath(fl, res);
+#endif
+
+	/* create a routing cache entry */x+	err = __mkroute_input(skb, res, in_dev, daddr, saddr, tos, &rth);
+	if (err)
+		return err;
+	atomic_set(&rth->u.dst.__refcnt, 1);
+
+	/* put it into the cache */x+	hash = rt_hash_code(daddr, saddr ^ (fl->iif << 5), tos);x+	return rt_intern_hash(hash, rth, (struct rtable**)&skb->dst);	
+}
+
+static inline int ip_mkroute_input(struct sk_buff *skb, 
+				   struct fib_result* res, 
+				   const struct flowi *fl,
+				   struct in_device *in_dev,
+				   u32 daddr, u32 saddr, u32 tos)x+{x+	return ip_mkroute_input_def(skb, res, fl, in_dev, daddr, saddr, tos);
+}
+
+
 /*
  *	NOTE. We drop all the packets that has local source
  *	addresses, because every properly looped back packet
@@ -1546,11 +1713,10 @@
  */x x static int ip_route_input_slow(struct sk_buff *skb, u32 daddr, u32 saddr,x-			u8 tos, struct net_device *dev)
+			       u8 tos, struct net_device *dev)
 {
 	struct fib_result res;
 	struct in_device *in_dev = in_dev_get(dev);x-	struct in_device *out_dev = NULL;
 	struct flowi fl = { .nl_u = { .ip4_u =x 				      { .daddr = daddr,
 					.saddr = saddr,x@@ -1574,8 +1740,6 @@
 	if (!in_dev)
 		goto out;
 
-	hash = rt_hash_code(daddr, saddr ^ (fl.iif << 5), tos);x-
 	/* Check for the most weird martians, which can be not detected
 	   by fib_lookup.
 	 */
@@ -1628,79 +1792,14 @@
 	if (res.type != RTN_UNICAST)
 		goto martian_destination;x 
-#ifdef CONFIG_IP_ROUTE_MULTIPATH
-	if (res.fi->fib_nhs > 1 && fl.oif == 0)
-		fib_select_multipath(&fl, &res);
-#endif
-	out_dev = in_dev_get(FIB_RES_DEV(res));x-	if (out_dev == NULL) {x-		if (net_ratelimit())
-			printk(KERN_CRIT "Bug in ip_route_input_slow(). "x-					 "Please, report\n");x-		goto e_inval;
-	}x-x-	err = fib_validate_source(saddr, daddr, tos, FIB_RES_OIF(res), dev,
-				  &spec_dst, &itag);x-	if (err < 0)x-		goto martian_source;x-x-	if (err)
-		flags |= RTCF_DIRECTSRC;
-x-	if (out_dev == in_dev && err && !(flags & (RTCF_NAT | RTCF_MASQ)) &&x-	    (IN_DEV_SHARED_MEDIA(out_dev) ||x-	     inet_addr_onlink(out_dev, saddr, FIB_RES_GW(res))))
-		flags |= RTCF_DOREDIRECT;x-x-	if (skb->protocol != htons(ETH_P_IP)) {x-		/* Not IP (i.e. ARP). Do not create route, if it is
-		 * invalid for proxy arp. DNAT routes are always valid.
-		 */
-		if (out_dev == in_dev && !(flags & RTCF_DNAT))x-			goto e_inval;
-	}x-x-	rth = dst_alloc(&ipv4_dst_ops);
-	if (!rth)x+	err = ip_mkroute_input(skb, &res, &fl, in_dev, daddr, saddr, tos);
+	if (err == -ENOBUFS)
 		goto e_nobufs;x-x-	atomic_set(&rth->u.dst.__refcnt, 1);
-	rth->u.dst.flags= DST_HOST;
-	if (in_dev->cnf.no_policy)x-		rth->u.dst.flags |= DST_NOPOLICY;
-	if (in_dev->cnf.no_xfrm)x-		rth->u.dst.flags |= DST_NOXFRM;
-	rth->fl.fl4_dst	= daddr;
-	rth->rt_dst	= daddr;
-	rth->fl.fl4_tos	= tos;
-#ifdef CONFIG_IP_ROUTE_FWMARK
-	rth->fl.fl4_fwmark= skb->nfmark;
-#endif
-	rth->fl.fl4_src	= saddr;
-	rth->rt_src	= saddr;
-	rth->rt_gateway	= daddr;
-	rth->rt_iif 	=x-	rth->fl.iif	= dev->ifindex;
-	rth->u.dst.dev	= out_dev->dev;x-	dev_hold(rth->u.dst.dev);
-	rth->idev	= in_dev_get(rth->u.dst.dev);
-	rth->fl.oif 	= 0;x-	rth->rt_spec_dst= spec_dst;
-
-	rth->u.dst.input = ip_forward;
-	rth->u.dst.output = ip_output;
-
-	rt_set_nexthop(rth, &res, itag);x-x-	rth->rt_flags = flags;x-x-intern:x-	err = rt_intern_hash(hash, rth, (struct rtable**)&skb->dst);
+	if (err == -EINVAL)
+		goto e_inval;
+	
 done:x 	in_dev_put(in_dev);x-	if (out_dev)x-		in_dev_put(out_dev);x 	if (free_res)
 		fib_res_put(&res);
 out:	return err;
@@ -1760,7 +1859,9 @@
 		rth->rt_flags 	&= ~RTCF_LOCAL;
 	}x 	rth->rt_type	= res.type;x-	goto intern;x+	hash = rt_hash_code(daddr, saddr ^ (fl.iif << 5), tos);x+	err = rt_intern_hash(hash, rth, (struct rtable**)&skb->dst);
+	goto done;
 x no_route:x 	RT_CACHE_STAT_INC(in_no_route);
@@ -1788,30 +1889,7 @@
 	goto done;
 x martian_source:x-x-	RT_CACHE_STAT_INC(in_martian_src);x-#ifdef CONFIG_IP_ROUTE_VERBOSE
-	if (IN_DEV_LOG_MARTIANS(in_dev) && net_ratelimit()) {x-		/*
-		 *	RFC1812 recommendation, if source is martian,
-		 *	the only hint is MAC header.
-		 */
-		printk(KERN_WARNING "martian source %u.%u.%u.%u from "
-			"%u.%u.%u.%u, on dev %s\n",
-			NIPQUAD(daddr), NIPQUAD(saddr), dev->name);x-		if (dev->hard_header_len) {x-			int i;x-			unsigned char *p = skb->mac.raw;
-			printk(KERN_WARNING "ll header: ");x-			for (i = 0; i < dev->hard_header_len; i++, p++) {x-				printk("%02x", *p);x-				if (i < (dev->hard_header_len - 1))
-					printk(":");x-			}x-			printk("\n");x-		}x-	}
-#endif
+	ip_handle_martian_source(dev, in_dev, skb, daddr, saddr);
 	goto e_inval;
 }x 
@@ -1882,13 +1960,166 @@
 	return ip_route_input_slow(skb, daddr, saddr, tos, dev);
 }
 
+static inline int __mkroute_output(struct rtable **result,
+				   struct fib_result* res, 
+				   const struct flowi *fl,
+				   const struct flowi *oldflp, 
+				   struct net_device *dev_out, 
+				   unsigned flags) x+{x+	struct rtable *rth;x+	struct in_device *in_dev;x+	u32 tos = RT_FL_TOS(oldflp);x+	int err = 0;x+
+	if (LOOPBACK(fl->fl4_src) && !(dev_out->flags&IFF_LOOPBACK))x+		return -EINVAL;
+
+	if (fl->fl4_dst == 0xFFFFFFFF)x+		res->type = RTN_BROADCAST;x+	else if (MULTICAST(fl->fl4_dst))x+		res->type = RTN_MULTICAST;x+	else if (BADCLASS(fl->fl4_dst) || ZERONET(fl->fl4_dst))x+		return -EINVAL;
+
+	if (dev_out->flags & IFF_LOOPBACK)
+		flags |= RTCF_LOCAL;
+
+	/* get work reference to inet device */
+	in_dev = in_dev_get(dev_out);
+	if (!in_dev)
+		return -EINVAL;
+
+	if (res->type == RTN_BROADCAST) {x+		flags |= RTCF_BROADCAST | RTCF_LOCAL;
+		if (res->fi) {x+			fib_info_put(res->fi);
+			res->fi = NULL;x+		}
+	} else if (res->type == RTN_MULTICAST) {x+		flags |= RTCF_MULTICAST|RTCF_LOCAL;
+		if (!ip_check_mc(in_dev, oldflp->fl4_dst, oldflp->fl4_src, 
+				 oldflp->proto))
+			flags &= ~RTCF_LOCAL;
+		/* If multicast route do not exist usex+		   default one, but do not gateway in this case.x+		   Yes, it is hack.
+		 */
+		if (res->fi && res->prefixlen < 4) {x+			fib_info_put(res->fi);
+			res->fi = NULL;x+		}
+	}
+x+x+	rth = dst_alloc(&ipv4_dst_ops);
+	if (!rth) {x+		err = -ENOBUFS;
+		goto cleanup;
+	}		
+
+	rth->u.dst.flags= DST_HOST;
+	if (in_dev->cnf.no_xfrm)x+		rth->u.dst.flags |= DST_NOXFRM;
+	if (in_dev->cnf.no_policy)x+		rth->u.dst.flags |= DST_NOPOLICY;
+
+	rth->fl.fl4_dst	= oldflp->fl4_dst;
+	rth->fl.fl4_tos	= tos;
+	rth->fl.fl4_src	= oldflp->fl4_src;
+	rth->fl.oif	= oldflp->oif;
+#ifdef CONFIG_IP_ROUTE_FWMARK
+	rth->fl.fl4_fwmark= oldflp->fl4_fwmark;
+#endif
+	rth->rt_dst	= fl->fl4_dst;
+	rth->rt_src	= fl->fl4_src;
+	rth->rt_iif	= oldflp->oif ? : dev_out->ifindex;
+	/* get references to the devices that are to be hold by the routing x+	   cache entry */x+	rth->u.dst.dev	= dev_out;x+	dev_hold(dev_out);
+	rth->idev	= in_dev_get(dev_out);
+	rth->rt_gateway = fl->fl4_dst;
+	rth->rt_spec_dst= fl->fl4_src;
+
+	rth->u.dst.output=ip_output;
+
+	RT_CACHE_STAT_INC(out_slow_tot);
+
+	if (flags & RTCF_LOCAL) {x+		rth->u.dst.input = ip_local_deliver;
+		rth->rt_spec_dst = fl->fl4_dst;
+	}
+	if (flags & (RTCF_BROADCAST | RTCF_MULTICAST)) {x+		rth->rt_spec_dst = fl->fl4_src;
+		if (flags & RTCF_LOCAL && 
+		    !(dev_out->flags & IFF_LOOPBACK)) {x+			rth->u.dst.output = ip_mc_output;
+			RT_CACHE_STAT_INC(out_slow_mc);x+		}
+#ifdef CONFIG_IP_MROUTE
+		if (res->type == RTN_MULTICAST) {x+			if (IN_DEV_MFORWARD(in_dev) &&
+			    !LOCAL_MCAST(oldflp->fl4_dst)) {x+				rth->u.dst.input = ip_mr_input;x+				rth->u.dst.output = ip_mc_output;
+			}x+		}
+#endif
+	}
+
+	rt_set_nexthop(rth, res, 0);x+x+	rth->rt_flags = flags;x+x+	*result = rth;x+ cleanup:
+	/* release work reference to inet device */
+	in_dev_put(in_dev);x+x+	return err;x+}
+
+static inline int ip_mkroute_output_def(struct rtable **rp,
+					struct fib_result* res,
+					const struct flowi *fl,
+					const struct flowi *oldflp,
+					struct net_device *dev_out,
+					unsigned flags)x+{x+	struct rtable *rth;x+	int err = __mkroute_output(&rth, res, fl, oldflp, dev_out, flags);x+	unsigned hash;x+	if (err == 0) {x+		u32 tos = RT_FL_TOS(oldflp);x+x+		atomic_set(&rth->u.dst.__refcnt, 1);
+		x+		hash = rt_hash_code(oldflp->fl4_dst, 
+				    oldflp->fl4_src ^ (oldflp->oif << 5), tos);x+		err = rt_intern_hash(hash, rth, rp);x+	}
+	x+	return err;x+}
+
+static inline int ip_mkroute_output(struct rtable** rp,
+				    struct fib_result* res,
+				    const struct flowi *fl,
+				    const struct flowi *oldflp,
+				    struct net_device *dev_out,
+				    unsigned flags)x+{x+	return ip_mkroute_output_def(rp, res, fl, oldflp, dev_out, flags);x+}
+
 /*
  * Major route resolver routine.
  */x x static int ip_route_output_slow(struct rtable **rp, const struct flowi *oldflp)
 {x-	u32 tos	= oldflp->fl4_tos & (IPTOS_RT_MASK | RTO_ONLINK);x+	u32 tos	= RT_FL_TOS(oldflp);x 	struct flowi fl = { .nl_u = { .ip4_u =x 				      { .daddr = oldflp->fl4_dst,
 					.saddr = oldflp->fl4_src,
@@ -1904,10 +2135,7 @@
 			    .oif = oldflp->oif };
 	struct fib_result res;
 	unsigned flags = 0;x-	struct rtable *rth;x 	struct net_device *dev_out = NULL;x-	struct in_device *in_dev = NULL;x-	unsigned hash;x 	int free_res = 0;x 	int err;x x@@ -2067,116 +2295,13 @@
 	fl.oif = dev_out->ifindex;
 x make_route:x-	if (LOOPBACK(fl.fl4_src) && !(dev_out->flags&IFF_LOOPBACK))x-		goto e_inval;
+	err = ip_mkroute_output(rp, &res, &fl, oldflp, dev_out, flags);x x-	if (fl.fl4_dst == 0xFFFFFFFF)x-		res.type = RTN_BROADCAST;x-	else if (MULTICAST(fl.fl4_dst))x-		res.type = RTN_MULTICAST;x-	else if (BADCLASS(fl.fl4_dst) || ZERONET(fl.fl4_dst))x-		goto e_inval;
-x-	if (dev_out->flags & IFF_LOOPBACK)
-		flags |= RTCF_LOCAL;
-x-	in_dev = in_dev_get(dev_out);
-	if (!in_dev)
-		goto e_inval;
-x-	if (res.type == RTN_BROADCAST) {x-		flags |= RTCF_BROADCAST | RTCF_LOCAL;
-		if (res.fi) {x-			fib_info_put(res.fi);
-			res.fi = NULL;x-		}x-	} else if (res.type == RTN_MULTICAST) {x-		flags |= RTCF_MULTICAST|RTCF_LOCAL;
-		if (!ip_check_mc(in_dev, oldflp->fl4_dst, oldflp->fl4_src, oldflp->proto))
-			flags &= ~RTCF_LOCAL;
-		/* If multicast route do not exist usex-		   default one, but do not gateway in this case.x-		   Yes, it is hack.
-		 */
-		if (res.fi && res.prefixlen < 4) {x-			fib_info_put(res.fi);
-			res.fi = NULL;x-		}x-	}x-x-	rth = dst_alloc(&ipv4_dst_ops);
-	if (!rth)x-		goto e_nobufs;x-x-	atomic_set(&rth->u.dst.__refcnt, 1);
-	rth->u.dst.flags= DST_HOST;
-	if (in_dev->cnf.no_xfrm)x-		rth->u.dst.flags |= DST_NOXFRM;
-	if (in_dev->cnf.no_policy)x-		rth->u.dst.flags |= DST_NOPOLICY;
-	rth->fl.fl4_dst	= oldflp->fl4_dst;
-	rth->fl.fl4_tos	= tos;
-	rth->fl.fl4_src	= oldflp->fl4_src;
-	rth->fl.oif	= oldflp->oif;
-#ifdef CONFIG_IP_ROUTE_FWMARK
-	rth->fl.fl4_fwmark= oldflp->fl4_fwmark;
-#endif
-	rth->rt_dst	= fl.fl4_dst;
-	rth->rt_src	= fl.fl4_src;
-	rth->rt_iif	= oldflp->oif ? : dev_out->ifindex;
-	rth->u.dst.dev	= dev_out;x-	dev_hold(dev_out);
-	rth->idev	= in_dev_get(dev_out);
-	rth->rt_gateway = fl.fl4_dst;
-	rth->rt_spec_dst= fl.fl4_src;
-
-	rth->u.dst.output=ip_output;
-
-	RT_CACHE_STAT_INC(out_slow_tot);
-x-	if (flags & RTCF_LOCAL) {x-		rth->u.dst.input = ip_local_deliver;
-		rth->rt_spec_dst = fl.fl4_dst;
-	}x-	if (flags & (RTCF_BROADCAST | RTCF_MULTICAST)) {x-		rth->rt_spec_dst = fl.fl4_src;
-		if (flags & RTCF_LOCAL && !(dev_out->flags & IFF_LOOPBACK)) {x-			rth->u.dst.output = ip_mc_output;
-			RT_CACHE_STAT_INC(out_slow_mc);x-		}x-#ifdef CONFIG_IP_MROUTE
-		if (res.type == RTN_MULTICAST) {x-			if (IN_DEV_MFORWARD(in_dev) &&
-			    !LOCAL_MCAST(oldflp->fl4_dst)) {x-				rth->u.dst.input = ip_mr_input;x-				rth->u.dst.output = ip_mc_output;
-			}x-		}x-#endif
-	}
-
-	rt_set_nexthop(rth, &res, 0);x-	x-x-	rth->rt_flags = flags;x-x-	hash = rt_hash_code(oldflp->fl4_dst, oldflp->fl4_src ^ (oldflp->oif << 5), tos);x-	err = rt_intern_hash(hash, rth, rp);x-done:x 	if (free_res)
 		fib_res_put(&res);
 	if (dev_out)
 		dev_put(dev_out);
-	if (in_dev)
-		in_dev_put(in_dev);x out:	return err;
-x-e_inval:x-	err = -EINVAL;
-	goto done;
-e_nobufs:x-	err = -ENOBUFS;
-	goto done;
 }x 
 int __ip_route_output_key(struct rtable **rp, const struct flowi *flp)
diff -Nru a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
--- a/net/ipv4/syncookies.c	2004-12-28 10:22:40 -08:00
+++ b/net/ipv4/syncookies.c	2005-03-07 20:41:51 -08:00
@@ -17,10 +17,87 @@
 #include <linux/tcp.h>
 #include <linux/slab.h>
 #include <linux/random.h>
+#include <linux/cryptohash.h>
 #include <linux/kernel.h>
 #include <net/tcp.h>
 
 extern int sysctl_tcp_syncookies;
+
+static __u32 syncookie_secret[2][16-3+SHA_DIGEST_WORDS];
+
+static __init int init_syncookies(void)
+{x+	get_random_bytes(syncookie_secret, sizeof(syncookie_secret));x+	return 0;x+}
+module_init(init_syncookies);x+x+#define COOKIEBITS 24	/* Upper bits store count */
+#define COOKIEMASK (((__u32)1 << COOKIEBITS) - 1)
+
+static u32 cookie_hash(u32 saddr, u32 daddr, u32 sport, u32 dport,x+		       u32 count, int c)
+{x+	__u32 tmp[16 + 5 + SHA_WORKSPACE_WORDS];
+
+	memcpy(tmp + 3, syncookie_secret[c], sizeof(syncookie_secret[c]));x+	tmp[0] = saddr;
+	tmp[1] = daddr;
+	tmp[2] = (sport << 16) + dport;
+	tmp[3] = count;x+	sha_transform(tmp + 16, (__u8 *)tmp, tmp + 16 + 5);x+x+	return tmp[17];x+}
+
+static __u32 secure_tcp_syn_cookie(__u32 saddr, __u32 daddr, __u16 sport,x+				   __u16 dport, __u32 sseq, __u32 count,x+				   __u32 data)
+{x+	/*
+	 * Compute the secure sequence number.
+	 * The output should be:x+   	 *   HASH(sec1,saddr,sport,daddr,dport,sec1) + sseq + (count * 2^24)
+	 *      + (HASH(sec2,saddr,sport,daddr,dport,count,sec2) % 2^24).
+	 * Where sseq is their sequence number and count increases every
+	 * minute by 1.
+	 * As an extra hack, we add a small "data" value that encodes the
+	 * MSS into the second hash value.
+	 */x+x+	return (cookie_hash(saddr, daddr, sport, dport, 0, 0) +x+		sseq + (count << COOKIEBITS) +x+		((cookie_hash(saddr, daddr, sport, dport, count, 1) + data)
+		 & COOKIEMASK));
+}
+
+/*
+ * This retrieves the small "data" value from the syncookie.
+ * If the syncookie is bad, the data returned will be out of
+ * range.  This must be checked by the caller.
+ *
+ * The count value used to generate the cookie must be within
+ * "maxdiff" if the current (passed-in) "count".  The return value
+ * is (__u32)-1 if this test fails.
+ */
+static __u32 check_tcp_syn_cookie(__u32 cookie, __u32 saddr, __u32 daddr,x+				  __u16 sport, __u16 dport, __u32 sseq,x+				  __u32 count, __u32 maxdiff)
+{x+	__u32 diff;
+
+	/* Strip away the layers from the cookie */
+	cookie -= cookie_hash(saddr, daddr, sport, dport, 0, 0) + sseq;
+
+	/* Cookie is now reduced to (count * 2^24) ^ (hash % 2^24) */
+	diff = (count - (cookie >> COOKIEBITS)) & ((__u32) - 1 >> COOKIEBITS);x+	if (diff >= maxdiff)
+		return (__u32)-1;x+x+	return (cookie -
+		cookie_hash(saddr, daddr, sport, dport, count - diff, 1))
+		& COOKIEMASK;	/* Leaving the data behind */
+}
 
 /* 
  * This table has to be sorted and terminated with (__u16)-1.
diff -Nru a/net/ipv4/tcp.c b/net/ipv4/tcp.c
--- a/net/ipv4/tcp.c	2005-02-22 10:45:31 -08:00
+++ b/net/ipv4/tcp.c	2005-02-23 19:16:58 -08:00
@@ -598,6 +598,7 @@
 	TCP_SKB_CB(skb)->end_seq = tp->write_seq;
 	TCP_SKB_CB(skb)->flags = TCPCB_FLAG_ACK;
 	TCP_SKB_CB(skb)->sacked = 0;x+	skb_header_release(skb);
 	__skb_queue_tail(&sk->sk_write_queue, skb);x 	sk_charge_skb(sk, skb);x 	if (!sk->sk_send_head)
diff -Nru a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
--- a/net/ipv4/tcp_ipv4.c	2005-02-22 10:45:31 -08:00
+++ b/net/ipv4/tcp_ipv4.c	2005-03-07 09:32:09 -08:00
@@ -831,7 +831,6 @@
 	/* OK, now commit destination to socket.  */x 	__sk_dst_set(sk, &rt->u.dst);x 	tcp_v4_setup_caps(sk, &rt->u.dst);x-	tp->ext2_header_len = rt->u.dst.header_len;
 
 	if (!tp->write_seq)
 		tp->write_seq = secure_tcp_sequence_number(inet->saddr,x@@ -941,10 +940,10 @@
 	/* Something is about to be wrong... Remember soft error
 	 * for the case, if this connection will not able to recover.
 	 */
-	if (mtu < dst_pmtu(dst) && ip_dont_fragment(sk, dst))x+	if (mtu < dst_mtu(dst) && ip_dont_fragment(sk, dst))x 		sk->sk_err_soft = EMSGSIZE;x 
-	mtu = dst_pmtu(dst);x+	mtu = dst_mtu(dst);x 
 	if (inet->pmtudisc != IP_PMTUDISC_DONT &&x 	    tp->pmtu_cookie > mtu) {x@@ -1578,10 +1577,9 @@
 	newtp->ext_header_len = 0;x 	if (newinet->opt)
 		newtp->ext_header_len = newinet->opt->optlen;
-	newtp->ext2_header_len = dst->header_len;
 	newinet->id = newtp->write_seq ^ jiffies;x 
-	tcp_sync_mss(newsk, dst_pmtu(dst));x+	tcp_sync_mss(newsk, dst_mtu(dst));x 	newtp->advmss = dst_metric(dst, RTAX_ADVMSS);x 	tcp_initialize_rcv_mss(newsk);x 
@@ -1877,7 +1875,6 @@
 x 	__sk_dst_set(sk, &rt->u.dst);x 	tcp_v4_setup_caps(sk, &rt->u.dst);x-	tcp_sk(sk)->ext2_header_len = rt->u.dst.header_len;
 
 	new_saddr = rt->rt_src;x 
@@ -1937,7 +1934,6 @@
 	if (!err) {x 		__sk_dst_set(sk, &rt->u.dst);x 		tcp_v4_setup_caps(sk, &rt->u.dst);x-		tcp_sk(sk)->ext2_header_len = rt->u.dst.header_len;
 		return 0;x 	}x 
@@ -2663,4 +2659,5 @@
 EXPORT_SYMBOL(sysctl_local_port_range);x EXPORT_SYMBOL(sysctl_max_syn_backlog);x EXPORT_SYMBOL(sysctl_tcp_low_latency);x+EXPORT_SYMBOL(sysctl_tcp_tw_reuse);x 
diff -Nru a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
--- a/net/ipv4/tcp_output.c	2005-02-22 10:45:32 -08:00
+++ b/net/ipv4/tcp_output.c	2005-03-07 09:32:09 -08:00
@@ -400,6 +400,7 @@
 
 	/* Advance write_seq and place onto the write_queue. */x 	tp->write_seq = TCP_SKB_CB(skb)->end_seq;x+	skb_header_release(skb);
 	__skb_queue_tail(&sk->sk_write_queue, skb);x 	sk_charge_skb(sk, skb);x 
@@ -631,12 +632,8 @@
 unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu)
 {
 	struct tcp_sock *tp = tcp_sk(sk);x-	struct dst_entry *dst = __sk_dst_get(sk);x 	int mss_now;x x-	if (dst && dst->ops->get_mss)
-		pmtu = dst->ops->get_mss(dst, pmtu);x-
 	/* Calculate base mss without TCP options:x 	   It is MMS_S - sizeof(tcphdr) of rfc1122
 	 */
@@ -647,7 +644,7 @@
 		mss_now = tp->rx_opt.mss_clamp;
 
 	/* Now subtract optional transport overhead */
-	mss_now -= tp->ext_header_len + tp->ext2_header_len;x+	mss_now -= tp->ext_header_len;
 
 	/* Then reserve room for full set of TCP options and 8 bytes of data */
 	if (mss_now < 48)x@@ -683,9 +680,8 @@
 
 	mss_now = tp->mss_cache_std;
 	if (dst) {x-		u32 mtu = dst_pmtu(dst);x-		if (mtu != tp->pmtu_cookie ||x-		    tp->ext2_header_len != dst->header_len)x+		u32 mtu = dst_mtu(dst);x+		if (mtu != tp->pmtu_cookie)x 			mss_now = tcp_sync_mss(sk, mtu);x 	}x 
@@ -697,8 +693,7 @@
 		unsigned int large_mss, factor, limit;
 
 		large_mss = 65535 - tp->af_specific->net_header_len -
-			tp->ext_header_len - tp->ext2_header_len -
-			tp->tcp_header_len;x+			tp->ext_header_len - tp->tcp_header_len;x x 		if (tp->max_window && large_mss > (tp->max_window>>1))x 			large_mss = max((tp->max_window>>1),
@@ -1340,6 +1335,7 @@
 			if (nskb == NULL)
 				return -ENOMEM;
 			__skb_unlink(skb, &sk->sk_write_queue);
+			skb_header_release(nskb);x 			__skb_queue_head(&sk->sk_write_queue, nskb);x 			sk_stream_free_skb(sk, skb);x 			sk_charge_skb(sk, nskb);x@@ -1442,7 +1438,7 @@
 	if (tp->rx_opt.user_mss)
 		tp->rx_opt.mss_clamp = tp->rx_opt.user_mss;x 	tp->max_window = 0;x-	tcp_sync_mss(sk, dst_pmtu(dst));x+	tcp_sync_mss(sk, dst_mtu(dst));x 
 	if (!tp->window_clamp)
 		tp->window_clamp = dst_metric(dst, RTAX_WINDOW);x@@ -1506,6 +1502,7 @@
 	/* Send it off. */x 	TCP_SKB_CB(buff)->when = tcp_time_stamp;
 	tp->retrans_stamp = TCP_SKB_CB(buff)->when;x+	skb_header_release(buff);
 	__skb_queue_tail(&sk->sk_write_queue, buff);
 	sk_charge_skb(sk, buff);
 	tp->packets_out += tcp_skb_pcount(buff);
diff -Nru a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
--- a/net/ipv4/tcp_timer.c	2005-02-22 10:45:32 -08:00
+++ b/net/ipv4/tcp_timer.c	2005-03-02 21:36:38 -08:00
@@ -38,6 +38,7 @@
 x #ifdef TCP_DEBUG
 const char tcp_timer_bug_msg[] = KERN_DEBUG "tcpbug: unknown timer value\n";x+EXPORT_SYMBOL(tcp_timer_bug_msg);
 #endif
 
 /*
diff -Nru a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
--- a/net/ipv4/xfrm4_output.c	2004-10-25 16:10:25 -07:00
+++ b/net/ipv4/xfrm4_output.c	2005-03-06 21:33:59 -08:00
@@ -82,7 +82,7 @@
 		goto out;
 
 	dst = skb->dst;
-	mtu = dst_pmtu(dst) - dst->header_len - dst->trailer_len;x+	mtu = dst_mtu(dst);x 	if (skb->len > mtu) {x 		icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));x 		ret = -EMSGSIZE;x@@ -116,7 +116,7 @@
 
 	xfrm4_encap(skb);
 x-	err = x->type->output(skb);
+	err = x->type->output(x, skb);x 	if (err)
 		goto error;x 
diff -Nru a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
--- a/net/ipv4/xfrm4_policy.c	2004-12-27 19:49:58 -08:00
+++ b/net/ipv4/xfrm4_policy.c	2005-03-06 21:36:27 -08:00
@@ -22,26 +22,6 @@
 	return __ip_route_output_key((struct rtable**)dst, fl);x }
 
-/* Check that the bundle accepts the flow and its components are
- * still valid.
- */
-
-static int __xfrm4_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl)
-{x-	do {x-		if (xdst->u.dst.ops != &xfrm4_dst_ops)
-			return 1;x-
-		if (!xfrm_selector_match(&xdst->u.dst.xfrm->sel, fl, AF_INET))x-			return 0;x-		if (xdst->u.dst.xfrm->km.state != XFRM_STATE_VALID ||x-		    xdst->u.dst.path->obsolete > 0)x-			return 0;x-		xdst = (struct xfrm_dst*)xdst->u.dst.child;
-	} while (xdst);
-	return 0;x-}
-
 static struct dst_entry *
 __xfrm4_find_bundle(struct flowi *fl, struct xfrm_policy *policy)x {x@@ -53,7 +33,7 @@
 		if (xdst->u.rt.fl.oif == fl->oif &&	/*XXX*/x 		    xdst->u.rt.fl.fl4_dst == fl->fl4_dst &&x 	    	    xdst->u.rt.fl.fl4_src == fl->fl4_src &&
-		    __xfrm4_bundle_ok(xdst, fl)) {x+		    xfrm_bundle_ok(xdst, fl, AF_INET)) {x 			dst_clone(dst);x 			break;x 		}x@@ -75,18 +55,29 @@
 	struct rtable *rt = rt0;x 	u32 remote = fl->fl4_dst;
 	u32 local  = fl->fl4_src;
+	struct flowi fl_tunnel = {x+		.nl_u = {
+			.ip4_u = {x+				.saddr = local,x+				.daddr = remotex+			}x+		}
+	};x 	int i;x 	int err;x 	int header_len = 0;x 	int trailer_len = 0;x 
 	dst = dst_prev = NULL;x+	dst_hold(&rt->u.dst);x x 	for (i = 0; i < nx; i++) {x 		struct dst_entry *dst1 = dst_alloc(&xfrm4_dst_ops);x+		struct xfrm_dst *xdst;x x 		if (unlikely(dst1 == NULL)) {x 			err = -ENOBUFS;
+			dst_release(&rt->u.dst);x 			goto error;x 		}x 
@@ -97,6 +88,11 @@
 			dst1->flags |= DST_NOHASH;x 			dst_clone(dst1);x 		}x+x+		xdst = (struct xfrm_dst *)dst1;x+		xdst->route = &rt->u.dst;x+x+		dst1->next = dst_prev;x 		dst_prev = dst1;x 		if (xfrm[i]->props.mode) {x 			remote = xfrm[i]->id.daddr.a4;
@@ -104,23 +100,27 @@
 		}
 		header_len += xfrm[i]->props.header_len;
 		trailer_len += xfrm[i]->props.trailer_len;x-	}x 
-	if (remote != fl->fl4_dst) {x-		struct flowi fl_tunnel = { .nl_u = { .ip4_u =x-						     { .daddr = remote,x-						       .saddr = local }x-					           }
-				         };x-		err = xfrm_dst_lookup((struct xfrm_dst**)&rt, &fl_tunnel, AF_INET);x-		if (err)
-			goto error;x-	} else {x-		dst_hold(&rt->u.dst);x+		if (remote != fl_tunnel.fl4_dst) {x+			fl_tunnel.fl4_src = local;x+			fl_tunnel.fl4_dst = remote;x+			err = xfrm_dst_lookup((struct xfrm_dst **)&rt,
+					      &fl_tunnel, AF_INET);x+			if (err)
+				goto error;x+		} else
+			dst_hold(&rt->u.dst);x 	}x+x 	dst_prev->child = &rt->u.dst;x+	dst->path = &rt->u.dst;x+x+	*dst_p = dst;x+	dst = dst_prev;x+x+	dst_prev = *dst_p;x 	i = 0;x-	for (dst_prev = dst; dst_prev != &rt->u.dst; dst_prev = dst_prev->child) {x+	for (; dst_prev != &rt->u.dst; dst_prev = dst_prev->child) {x 		struct xfrm_dst *x = (struct xfrm_dst*)dst_prev;x 		x->u.rt.fl = *fl;x 
@@ -133,8 +133,7 @@
 		dst_prev->lastuse	= jiffies;x 		dst_prev->header_len	= header_len;
 		dst_prev->trailer_len	= trailer_len;x-		memcpy(&dst_prev->metrics, &rt->u.dst.metrics, sizeof(dst_prev->metrics));x-		dst_prev->path		= &rt->u.dst;x+		memcpy(&dst_prev->metrics, &x->route->metrics, sizeof(dst_prev->metrics));x x 		/* Copy neighbout for reachability confirmation */
 		dst_prev->neighbour	= neigh_clone(rt->u.dst.neighbour);x@@ -154,7 +153,8 @@
 		header_len -= x->u.dst.xfrm->props.header_len;
 		trailer_len -= x->u.dst.xfrm->props.trailer_len;x 	}x-	*dst_p = dst;x+x+	xfrm_init_pmtu(dst);x 	return 0;x 
 error:x@@ -235,10 +235,8 @@
 
 static void xfrm4_update_pmtu(struct dst_entry *dst, u32 mtu)
 {x-	struct dst_entry *path = dst->path;
-x-	if (mtu < 68 + dst->header_len)x-		return;
+	struct xfrm_dst *xdst = (struct xfrm_dst *)dst;x+	struct dst_entry *path = xdst->route;x x 	path->ops->update_pmtu(path, mtu);x }
diff -Nru a/net/ipv4/xfrm4_tunnel.c b/net/ipv4/xfrm4_tunnel.c
--- a/net/ipv4/xfrm4_tunnel.c	2004-08-20 13:54:06 -07:00
+++ b/net/ipv4/xfrm4_tunnel.c	2005-02-08 20:26:16 -08:00
@@ -9,7 +9,7 @@
 #include <net/ip.h>
 #include <net/protocol.h>
 
-static int ipip_output(struct sk_buff *skb)
+static int ipip_output(struct xfrm_state *x, struct sk_buff *skb)
 {
 	struct iphdr *iph;x 	
diff -Nru a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
--- a/net/ipv6/addrconf.c	2005-02-23 19:44:37 -08:00
+++ b/net/ipv6/addrconf.c	2005-02-23 19:51:43 -08:00
@@ -1924,6 +1924,11 @@
 	struct inet6_dev *idev = __in6_dev_get(dev);x x 	switch(event) {x+	case NETDEV_REGISTER:x+		if (dev == &loopback_dev && !ipv6_find_idev(dev))
+			panic("addrconf: Failed to create loopback\n");x+		break;x+x 	case NETDEV_UP:x 		switch(dev->type) {x 		case ARPHRD_SIT:x@@ -2008,6 +2013,9 @@
 x 	ASSERT_RTNL();x x+	if (dev == &loopback_dev)x+		how = 0;x+x 	rt6_ifdown(dev);x 	neigh_ifdown(&nd_tbl, dev);
 
@@ -3459,8 +3467,6 @@
 	 */
 	rtnl_lock();
 	addrconf_notify(&ipv6_dev_notf, NETDEV_REGISTER, &loopback_dev);
-	if (loopback_dev.flags & IFF_UP)x-		addrconf_notify(&ipv6_dev_notf, NETDEV_UP, &loopback_dev);
 	rtnl_unlock();
 x 	register_netdevice_notifier(&ipv6_dev_notf);
diff -Nru a/net/ipv6/ah6.c b/net/ipv6/ah6.c
--- a/net/ipv6/ah6.c	2005-01-25 21:53:19 -08:00
+++ b/net/ipv6/ah6.c	2005-02-08 20:26:16 -08:00
@@ -154,12 +154,10 @@
 	return 0;x }x 
-static int ah6_output(struct sk_buff *skb)
+static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
 {
 	int err;x 	int extlen;x-	struct dst_entry *dst = skb->dst;
-	struct xfrm_state *x  = dst->xfrm;
 	struct ipv6hdr *top_iph;
 	struct ip_auth_hdr *ah;
 	struct ah_data *ahp;
diff -Nru a/net/ipv6/esp6.c b/net/ipv6/esp6.c
--- a/net/ipv6/esp6.c	2005-01-26 22:15:55 -08:00
+++ b/net/ipv6/esp6.c	2005-02-08 20:26:16 -08:00
@@ -37,12 +37,10 @@
 #include <net/ipv6.h>
 #include <linux/icmpv6.h>
 
-static int esp6_output(struct sk_buff *skb)
+static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
 {
 	int err;x 	int hdr_len;x-	struct dst_entry *dst = skb->dst;
-	struct xfrm_state *x  = dst->xfrm;
 	struct ipv6hdr *top_iph;
 	struct ipv6_esp_hdr *esph;
 	struct crypto_tfm *tfm;
diff -Nru a/net/ipv6/ipcomp6.c b/net/ipv6/ipcomp6.c
--- a/net/ipv6/ipcomp6.c	2005-01-25 21:53:19 -08:00
+++ b/net/ipv6/ipcomp6.c	2005-02-08 20:26:16 -08:00
@@ -139,11 +139,9 @@
 	return err;
 }x 
-static int ipcomp6_output(struct sk_buff *skb)
+static int ipcomp6_output(struct xfrm_state *x, struct sk_buff *skb)
 {
 	int err;x-	struct dst_entry *dst = skb->dst;
-	struct xfrm_state *x = dst->xfrm;
 	struct ipv6hdr *top_iph;
 	int hdr_len;x 	struct ipv6_comp_hdr *ipch;
diff -Nru a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
--- a/net/ipv6/tcp_ipv6.c	2005-02-22 10:45:32 -08:00
+++ b/net/ipv6/tcp_ipv6.c	2005-03-07 09:32:09 -08:00
@@ -441,21 +441,22 @@
 	}
 }x 
-static int tcp_v6_check_established(struct sock *sk)
+static int __tcp_v6_check_established(struct sock *sk, __u16 lport,x+				      struct tcp_tw_bucket **twp)
 {
 	struct inet_sock *inet = inet_sk(sk);x 	struct ipv6_pinfo *np = inet6_sk(sk);x 	struct in6_addr *daddr = &np->rcv_saddr;
 	struct in6_addr *saddr = &np->daddr;
 	int dif = sk->sk_bound_dev_if;
-	u32 ports = TCP_COMBINED_PORTS(inet->dport, inet->num);x+	u32 ports = TCP_COMBINED_PORTS(inet->dport, lport);x 	int hash = tcp_v6_hashfn(daddr, inet->num, saddr, inet->dport);x 	struct tcp_ehash_bucket *head = &tcp_ehash[hash];x 	struct sock *sk2;x 	struct hlist_node *node;x 	struct tcp_tw_bucket *tw;x x-	write_lock_bh(&head->lock);x+	write_lock(&head->lock);x 
 	/* Check TIME-WAIT sockets first. */
 	sk_for_each(sk2, node, &(head + tcp_ehash_size)->chain) {x@@ -468,7 +469,10 @@
 		   sk2->sk_bound_dev_if == sk->sk_bound_dev_if) {x 			struct tcp_sock *tp = tcp_sk(sk);x x-			if (tw->tw_ts_recent_stamp) {x+			if (tw->tw_ts_recent_stamp &&
+			    (!twp || (sysctl_tcp_tw_reuse &&
+				      xtime.tv_sec - 
+				      tw->tw_ts_recent_stamp > 1))) {x 				/* See comment in tcp_ipv4.c */
 				tp->write_seq = tw->tw_snd_nxt + 65535 + 2;x 				if (!tp->write_seq)
@@ -494,40 +498,113 @@
 	__sk_add_node(sk, &head->chain);
 	sk->sk_hashent = hash;x 	sock_prot_inc_use(sk->sk_prot);
-	write_unlock_bh(&head->lock);x+	write_unlock(&head->lock);x 
-	if (tw) {x+	if (twp) {x+		*twp = tw;x+		NET_INC_STATS_BH(LINUX_MIB_TIMEWAITRECYCLED);x+	} else if (tw) {x 		/* Silly. Should hash-dance instead... */
-		local_bh_disable();x 		tcp_tw_deschedule(tw);x 		NET_INC_STATS_BH(LINUX_MIB_TIMEWAITRECYCLED);x-		local_bh_enable();x x 		tcp_tw_put(tw);x 	}x 	return 0;x 
 not_unique:x-	write_unlock_bh(&head->lock);x+	write_unlock(&head->lock);x 	return -EADDRNOTAVAIL;
 }
 
+static inline u32 tcpv6_port_offset(const struct sock *sk)
+{x+	const struct inet_sock *inet = inet_sk(sk);x+	const struct ipv6_pinfo *np = inet6_sk(sk);x+x+	return secure_tcpv6_port_ephemeral(np->rcv_saddr.s6_addr32,
+					   np->daddr.s6_addr32,
+					   inet->dport);x+}
+
 static int tcp_v6_hash_connect(struct sock *sk)
 {x-	struct tcp_bind_hashbucket *head;x-	struct tcp_bind_bucket *tb;x+	unsigned short snum = inet_sk(sk)->num;x+ 	struct tcp_bind_hashbucket *head;x+ 	struct tcp_bind_bucket *tb;x+	int ret;x 
-	/* XXX */
-	if (inet_sk(sk)->num == 0) { 
-		int err = tcp_v6_get_port(sk, inet_sk(sk)->num);x-		if (err)
-			return err;
-		inet_sk(sk)->sport = htons(inet_sk(sk)->num);x-	}x+ 	if (!snum) {x+ 		int low = sysctl_local_port_range[0];x+ 		int high = sysctl_local_port_range[1];x+		int range = high - low;x+ 		int i;x+		int port;
+		static u32 hint;x+		u32 offset = hint + tcpv6_port_offset(sk);x+		struct hlist_node *node;x+ 		struct tcp_tw_bucket *tw = NULL;x+x+ 		local_bh_disable();x+		for (i = 1; i <= range; i++) {x+			port = low + (i + offset) % range;x+ 			head = &tcp_bhash[tcp_bhashfn(port)];x+ 			spin_lock(&head->lock);x+x+ 			/* Does not bother with rcv_saddr checks,
+ 			 * because the established check is already
+ 			 * unique enough.
+ 			 */x+			tb_for_each(tb, node, &head->chain) {x+ 				if (tb->port == port) {x+ 					BUG_TRAP(!hlist_empty(&tb->owners));x+ 					if (tb->fastreuse >= 0)
+ 						goto next_port;
+ 					if (!__tcp_v6_check_established(sk,
+									port,
+									&tw))
+ 						goto ok;
+ 					goto next_port;
+ 				}
+ 			}x+x+ 			tb = tcp_bucket_create(head, port);x+ 			if (!tb) {x+ 				spin_unlock(&head->lock);x+ 				break;x+ 			}
+ 			tb->fastreuse = -1;x+ 			goto ok;
+x+ 		next_port:x+ 			spin_unlock(&head->lock);x+ 		}x+ 		local_bh_enable();x+x+ 		return -EADDRNOTAVAIL;
+x+ok:x+		hint += i;x+x+ 		/* Head lock still held and bh's disabled */
+ 		tcp_bind_hash(sk, tb, port);x+		if (sk_unhashed(sk)) {x+ 			inet_sk(sk)->sport = htons(port);x+ 			__tcp_v6_hash(sk);x+ 		}x+ 		spin_unlock(&head->lock);x+x+ 		if (tw) {x+ 			tcp_tw_deschedule(tw);x+ 			tcp_tw_put(tw);x+ 		}x 
-	head = &tcp_bhash[tcp_bhashfn(inet_sk(sk)->num)];x-	tb = tb_head(head);x+		ret = 0;
+		goto out;x+ 	}x 
+ 	head  = &tcp_bhash[tcp_bhashfn(snum)];x+ 	tb  = tcp_sk(sk)->bind_hash;x 	spin_lock_bh(&head->lock);x x 	if (sk_head(&tb->owners) == sk && !sk->sk_bind_node.next) {x@@ -535,8 +612,12 @@
 		spin_unlock_bh(&head->lock);x 		return 0;x 	} else {x-		spin_unlock_bh(&head->lock);x-		return tcp_v6_check_established(sk);x+		spin_unlock(&head->lock);x+		/* No definite answer... Walk to established hash table */x+		ret = __tcp_v6_check_established(sk, snum, NULL);x+out:x+		local_bh_enable();x+		return ret;x 	}
 }x 
@@ -701,7 +782,6 @@
 	tp->ext_header_len = 0;x 	if (np->opt)
 		tp->ext_header_len = np->opt->opt_flen + np->opt->opt_nflen;x-	tp->ext2_header_len = dst->header_len;
 
 	tp->rx_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr);
 
@@ -813,8 +893,8 @@
 		} else
 			dst_hold(dst);x x-		if (tp->pmtu_cookie > dst_pmtu(dst)) {x-			tcp_sync_mss(sk, dst_pmtu(dst));x+		if (tp->pmtu_cookie > dst_mtu(dst)) {x+			tcp_sync_mss(sk, dst_mtu(dst));x 			tcp_simple_retransmit(sk);x 		} /* else let the usual retransmit timer handle it */
 		dst_release(dst);x@@ -1443,9 +1523,8 @@
 	if (newnp->opt)
 		newtp->ext_header_len = newnp->opt->opt_nflen +
 					newnp->opt->opt_flen;
-	newtp->ext2_header_len = dst->header_len;
 
-	tcp_sync_mss(newsk, dst_pmtu(dst));x+	tcp_sync_mss(newsk, dst_mtu(dst));x 	newtp->advmss = dst_metric(dst, RTAX_ADVMSS);x 	tcp_initialize_rcv_mss(newsk);x 
@@ -1792,7 +1871,6 @@
 		ip6_dst_store(sk, dst, NULL);x 		sk->sk_route_caps = dst->dev->features &
 			~(NETIF_F_IP_CSUM | NETIF_F_TSO);x-		tcp_sk(sk)->ext2_header_len = dst->header_len;
 	}
 x 	return 0;x@@ -1846,7 +1924,6 @@
 		ip6_dst_store(sk, dst, NULL);x 		sk->sk_route_caps = dst->dev->features &
 			~(NETIF_F_IP_CSUM | NETIF_F_TSO);x-		tcp_sk(sk)->ext2_header_len = dst->header_len;
 	}
 x 	skb->dst = dst_clone(dst);xdiff -Nru a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
--- a/net/ipv6/xfrm6_output.c	2004-11-15 18:52:34 -08:00
+++ b/net/ipv6/xfrm6_output.c	2005-03-06 21:33:59 -08:00
@@ -79,7 +79,7 @@
 	int mtu, ret = 0;x 	struct dst_entry *dst = skb->dst;
 
-	mtu = dst_pmtu(dst) - dst->header_len - dst->trailer_len;x+	mtu = dst_mtu(dst);x 	if (mtu < IPV6_MIN_MTU)
 		mtu = IPV6_MIN_MTU;x 
@@ -116,7 +116,7 @@
 
 	xfrm6_encap(skb);
 x-	err = x->type->output(skb);
+	err = x->type->output(x, skb);x 	if (err)
 		goto error;x 
diff -Nru a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
--- a/net/ipv6/xfrm6_policy.c	2004-11-09 22:57:03 -08:00
+++ b/net/ipv6/xfrm6_policy.c	2005-03-06 21:36:27 -08:00
@@ -31,26 +31,6 @@
 	return err;
 }x 
-/* Check that the bundle accepts the flow and its components are
- * still valid.
- */
-
-static int __xfrm6_bundle_ok(struct xfrm_dst *xdst, struct flowi *fl)
-{x-	do {x-		if (xdst->u.dst.ops != &xfrm6_dst_ops)
-			return 1;x-
-		if (!xfrm_selector_match(&xdst->u.dst.xfrm->sel, fl, AF_INET6))x-			return 0;x-		if (xdst->u.dst.xfrm->km.state != XFRM_STATE_VALID ||x-		    xdst->u.dst.path->obsolete > 0)x-			return 0;x-		xdst = (struct xfrm_dst*)xdst->u.dst.child;
-	} while (xdst);
-	return 0;x-}
-
 static struct dst_entry *
 __xfrm6_find_bundle(struct flowi *fl, struct xfrm_policy *policy)x {x@@ -70,7 +50,7 @@
 				 xdst->u.rt6.rt6i_src.plen);x 		if (ipv6_addr_equal(&xdst->u.rt6.rt6i_dst.addr, &fl_dst_prefix) &&x 		    ipv6_addr_equal(&xdst->u.rt6.rt6i_src.addr, &fl_src_prefix) &&x-		    __xfrm6_bundle_ok(xdst, fl)) {x+		    xfrm_bundle_ok(xdst, fl, AF_INET6)) {x 			dst_clone(dst);x 			break;x 		}x@@ -92,18 +72,29 @@
 	struct rt6_info *rt  = rt0;x 	struct in6_addr *remote = &fl->fl6_dst;
 	struct in6_addr *local  = &fl->fl6_src;
+	struct flowi fl_tunnel = {x+		.nl_u = {
+			.ip6_u = {x+				.saddr = *local,x+				.daddr = *remotex+			}x+		}
+	};x 	int i;x 	int err = 0;x 	int header_len = 0;x 	int trailer_len = 0;x 
 	dst = dst_prev = NULL;x+	dst_hold(&rt->u.dst);x x 	for (i = 0; i < nx; i++) {x 		struct dst_entry *dst1 = dst_alloc(&xfrm6_dst_ops);x+		struct xfrm_dst *xdst;x x 		if (unlikely(dst1 == NULL)) {x 			err = -ENOBUFS;
+			dst_release(&rt->u.dst);x 			goto error;x 		}x 
@@ -114,6 +105,11 @@
 			dst1->flags |= DST_NOHASH;x 			dst_clone(dst1);x 		}x+x+		xdst = (struct xfrm_dst *)dst1;x+		xdst->route = &rt->u.dst;x+x+		dst1->next = dst_prev;x 		dst_prev = dst1;x 		if (xfrm[i]->props.mode) {x 			remote = (struct in6_addr*)&xfrm[i]->id.daddr;x@@ -121,25 +117,27 @@
 		}
 		header_len += xfrm[i]->props.header_len;
 		trailer_len += xfrm[i]->props.trailer_len;x-	}x-
-	if (!ipv6_addr_equal(remote, &fl->fl6_dst)) {x-		struct flowi fl_tunnel;x x-		memset(&fl_tunnel, 0, sizeof(fl_tunnel));x-		ipv6_addr_copy(&fl_tunnel.fl6_dst, remote);x-		ipv6_addr_copy(&fl_tunnel.fl6_src, local);
-x-		err = xfrm_dst_lookup((struct xfrm_dst **) &rt,
-				      &fl_tunnel, AF_INET6);x-		if (err)
-			goto error;x-	} else {x-		dst_hold(&rt->u.dst);x+		if (!ipv6_addr_equal(remote, &fl_tunnel.fl6_dst)) {x+			ipv6_addr_copy(&fl_tunnel.fl6_dst, remote);x+			ipv6_addr_copy(&fl_tunnel.fl6_src, local);
+			err = xfrm_dst_lookup((struct xfrm_dst **) &rt,
+					      &fl_tunnel, AF_INET6);x+			if (err)
+				goto error;x+		} else
+			dst_hold(&rt->u.dst);x 	}x+x 	dst_prev->child = &rt->u.dst;x+	dst->path = &rt->u.dst;x+x+	*dst_p = dst;x+	dst = dst_prev;x+x+	dst_prev = *dst_p;x 	i = 0;x-	for (dst_prev = dst; dst_prev != &rt->u.dst; dst_prev = dst_prev->child) {x+	for (; dst_prev != &rt->u.dst; dst_prev = dst_prev->child) {x 		struct xfrm_dst *x = (struct xfrm_dst*)dst_prev;x 
 		dst_prev->xfrm = xfrm[i++];x@@ -151,8 +149,7 @@
 		dst_prev->lastuse	= jiffies;x 		dst_prev->header_len	= header_len;
 		dst_prev->trailer_len	= trailer_len;x-		memcpy(&dst_prev->metrics, &rt->u.dst.metrics, sizeof(dst_prev->metrics));x-		dst_prev->path		= &rt->u.dst;x+		memcpy(&dst_prev->metrics, &x->route->metrics, sizeof(dst_prev->metrics));x x 		/* Copy neighbour for reachability confirmation */
 		dst_prev->neighbour	= neigh_clone(rt->u.dst.neighbour);x@@ -170,7 +167,8 @@
 		header_len -= x->u.dst.xfrm->props.header_len;
 		trailer_len -= x->u.dst.xfrm->props.trailer_len;x 	}x-	*dst_p = dst;x+x+	xfrm_init_pmtu(dst);x 	return 0;x 
 error:x@@ -245,12 +243,10 @@
 
 static void xfrm6_update_pmtu(struct dst_entry *dst, u32 mtu)
 {x-	struct dst_entry *path = dst->path;
+	struct xfrm_dst *xdst = (struct xfrm_dst *)dst;x+	struct dst_entry *path = xdst->route;x x-	if (mtu >= IPV6_MIN_MTU && mtu < dst_pmtu(dst))
-		path->ops->update_pmtu(path, mtu);x-	x-	return;
+	path->ops->update_pmtu(path, mtu);x }
 
 static struct dst_ops xfrm6_dst_ops = {xdiff -Nru a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c
--- a/net/ipv6/xfrm6_tunnel.c	2005-01-13 20:41:06 -08:00
+++ b/net/ipv6/xfrm6_tunnel.c	2005-02-08 20:26:16 -08:00
@@ -343,7 +343,7 @@
 
 EXPORT_SYMBOL(xfrm6_tunnel_free_spi);
 x-static int xfrm6_tunnel_output(struct sk_buff *skb)
+static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
 {
 	struct ipv6hdr *top_iph;
 xdiff -Nru a/net/irda/af_irda.c b/net/irda/af_irda.c
--- a/net/irda/af_irda.c	2004-12-27 20:44:25 -08:00
+++ b/net/irda/af_irda.c	2005-01-20 15:21:35 -08:00
@@ -87,10 +87,10 @@
 
 	IRDA_DEBUG(3, "%s()\n", __FUNCTION__);
 x-	self = (struct irda_sock *) instance;x+	self = instance;x 	ASSERT(self != NULL, return -1;);
 x-	sk = self->sk;x+	sk = instance;x 	ASSERT(sk != NULL, return -1;);
 x 	err = sock_queue_rcv_skb(sk, skb);x@@ -117,7 +117,7 @@
 	struct irda_sock *self;x 	struct sock *sk;
 x-	self = (struct irda_sock *) instance;x+	self = instance;x 
 	IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);x 
@@ -125,7 +125,7 @@
 	if(skb)
 		dev_kfree_skb(skb);
 x-	sk = self->sk;x+	sk = instance;x 	if (sk == NULL) {x 		IRDA_DEBUG(0, "%s(%p) : BUG : sk is NULL\n",
 			   __FUNCTION__, self);x@@ -183,11 +183,11 @@
 	struct irda_sock *self;x 	struct sock *sk;
 x-	self = (struct irda_sock *) instance;x+	self = instance;x 
 	IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);x 
-	sk = self->sk;x+	sk = instance;x 	if (sk == NULL) {x 		dev_kfree_skb(skb);
 		return;
@@ -245,11 +245,11 @@
 	struct irda_sock *self;x 	struct sock *sk;
 x-	self = (struct irda_sock *) instance;x+	self = instance;x 
 	IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self);x 
-	sk = self->sk;x+	sk = instance;x 	if (sk == NULL) {x 		dev_kfree_skb(skb);
 		return;
@@ -332,10 +332,10 @@
 
 	IRDA_DEBUG(2, "%s()\n", __FUNCTION__);
 x-	self = (struct irda_sock *) instance;x+	self = instance;x 	ASSERT(self != NULL, return;);
 x-	sk = self->sk;x+	sk = instance;x 	ASSERT(sk != NULL, return;);x x 	switch (flow) {x@@ -1082,17 +1082,12 @@
 	}
 
 	/* Allocate networking socket */
-	if ((sk = sk_alloc(PF_IRDA, GFP_ATOMIC, 1, NULL)) == NULL)
+	sk = sk_alloc(PF_IRDA, GFP_ATOMIC,x+		      sizeof(struct irda_sock), NULL);x+	if (sk == NULL)
 		return -ENOMEM;
 
-	/* Allocate IrDA socket */
-	self = sk->sk_protinfo = kmalloc(sizeof(struct irda_sock), GFP_ATOMIC);
-	if (self == NULL) {x-		sk_free(sk);x-		return -ENOMEM;
-	}x-	memset(self, 0, sizeof(struct irda_sock));
-x+	self = irda_sk(sk);x 	IRDA_DEBUG(2, "%s() : self is %p\n", __FUNCTION__, self);x 
 	init_waitqueue_head(&self->query_wait);x@@ -1102,8 +1097,6 @@
 	sk_set_owner(sk, THIS_MODULE);
 	sk->sk_family = PF_IRDA;
 	sk->sk_protocol = protocol;
-	/* Link networking socket and IrDA socket structs together */
-	self->sk = sk;x x 	switch (sock->type) {x 	case SOCK_STREAM:x@@ -1187,7 +1180,6 @@
 		self->lsap = NULL;x 	}
 #endif /* CONFIG_IRDA_ULTRA */
-	kfree(self);x }
 
 /*
@@ -1208,8 +1200,6 @@
 x 	/* Destroy IrDA socket */
 	irda_destroy_socket(irda_sk(sk));
-	/* Prevent sock_def_destruct() to create havoc */
-	sk->sk_protinfo = NULL;x x 	sock_orphan(sk);x 	sock->sk   = NULL;xdiff -Nru a/net/key/af_key.c b/net/key/af_key.c
--- a/net/key/af_key.c	2005-01-25 21:53:19 -08:00
+++ b/net/key/af_key.c	2005-02-08 20:09:15 -08:00
@@ -42,11 +42,17 @@
 
 static atomic_t pfkey_socks_nr = ATOMIC_INIT(0);
 x-struct pfkey_opt {x-	int	registered;
-	int	promisc;
+struct pfkey_sock {x+	/* struct sock must be the first member of struct pfkey_sock */x+	struct sock	sk;x+	int		registered;
+	int		promisc;
 };x-#define pfkey_sk(__sk) ((struct pfkey_opt *)(__sk)->sk_protinfo)
+
+static inline struct pfkey_sock *pfkey_sk(struct sock *sk)
+{x+	return (struct pfkey_sock *)sk;x+}
 
 static void pfkey_sock_destruct(struct sock *sk)
 {x@@ -60,8 +66,6 @@
 	BUG_TRAP(!atomic_read(&sk->sk_rmem_alloc));x 	BUG_TRAP(!atomic_read(&sk->sk_wmem_alloc));x 
-	kfree(pfkey_sk(sk));
-x 	atomic_dec(&pfkey_socks_nr);x }
 
@@ -128,7 +132,6 @@
 static int pfkey_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct pfkey_opt *pfk;x 	int err;x 
 	if (!capable(CAP_NET_ADMIN))
@@ -139,7 +142,7 @@
 		return -EPROTONOSUPPORT;
 x 	err = -ENOMEM;
-	sk = sk_alloc(PF_KEY, GFP_KERNEL, 1, NULL);
+	sk = sk_alloc(PF_KEY, GFP_KERNEL, sizeof(struct pfkey_sock), NULL);x 	if (sk == NULL)
 		goto out;
 	x@@ -147,14 +150,6 @@
 	sock_init_data(sock, sk);x 	sk_set_owner(sk, THIS_MODULE);
 x-	err = -ENOMEM;
-	pfk = sk->sk_protinfo = kmalloc(sizeof(*pfk), GFP_KERNEL);
-	if (!pfk) {x-		sk_free(sk);x-		goto out;
-	}x-	memset(pfk, 0, sizeof(*pfk));
-x 	sk->sk_family = PF_KEY;
 	sk->sk_destruct = pfkey_sock_destruct;x 
@@ -233,7 +228,7 @@
 x 	pfkey_lock_table();x 	sk_for_each(sk, node, &pfkey_table) {x-		struct pfkey_opt *pfk = pfkey_sk(sk);x+		struct pfkey_sock *pfk = pfkey_sk(sk);x 		int err2;x x 		/* Yes, it means that if you are meant to receive thisx@@ -1418,7 +1413,7 @@
 
 static int pfkey_register(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs)
 {x-	struct pfkey_opt *pfk = pfkey_sk(sk);x+	struct pfkey_sock *pfk = pfkey_sk(sk);x 	struct sk_buff *supp_skb;x 
 	if (hdr->sadb_msg_satype > SADB_SATYPE_MAX)x@@ -1514,7 +1509,7 @@
 
 static int pfkey_promisc(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hdr, void **ext_hdrs)
 {x-	struct pfkey_opt *pfk = pfkey_sk(sk);x+	struct pfkey_sock *pfk = pfkey_sk(sk);x 	int satype = hdr->sadb_msg_satype;x 
 	if (hdr->sadb_msg_len == (sizeof(*hdr) / sizeof(uint64_t))) {xdiff -Nru a/net/llc/af_llc.c b/net/llc/af_llc.c
--- a/net/llc/af_llc.c	2004-09-21 08:58:23 -07:00
+++ b/net/llc/af_llc.c	2005-01-20 15:17:39 -08:00
@@ -113,7 +113,7 @@
  */
 static int llc_ui_send_data(struct sock* sk, struct sk_buff *skb, int noblock)
 {x-	struct llc_opt* llc = llc_sk(sk);x+	struct llc_sock* llc = llc_sk(sk);x 	int rc = 0;x 
 	if (llc_data_accept_state(llc->state) || llc->p_flag) {x@@ -169,7 +169,7 @@
 static int llc_ui_release(struct socket *sock)
 {
 	struct sock *sk = sock->sk;x-	struct llc_opt *llc;x+	struct llc_sock *llc;x x 	if (!sk)
 		goto out;
@@ -244,7 +244,7 @@
 static int llc_ui_autobind(struct socket *sock, struct sockaddr_llc *addr)
 {
 	struct sock *sk = sock->sk;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct llc_sap *sap;x 	int rc = -EINVAL;
 
@@ -293,7 +293,7 @@
 {
 	struct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr;
 	struct sock *sk = sock->sk;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct llc_sap *sap;x 	int rc = -EINVAL;
 
@@ -394,7 +394,7 @@
 			  int addrlen, int flags)
 {
 	struct sock *sk = sock->sk;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct sockaddr_llc *addr = (struct sockaddr_llc *)uaddr;
 	struct net_device *dev;x 	int rc = -EINVAL;
@@ -571,7 +571,7 @@
 static int llc_ui_wait_for_busy_core(struct sock *sk, int timeout)
 {
 	DECLARE_WAITQUEUE(wait, current);x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	int rc;x x 	add_wait_queue_exclusive(sk->sk_sleep, &wait);x@@ -612,7 +612,7 @@
 static int llc_ui_accept(struct socket *sock, struct socket *newsock, int flags)
 {
 	struct sock *sk = sock->sk, *newsk;x-	struct llc_opt *llc, *newllc;x+	struct llc_sock *llc, *newllc;x 	struct sk_buff *skb;x 	int rc = -EOPNOTSUPP;
 
@@ -728,7 +728,7 @@
 			  struct msghdr *msg, size_t len)x {
 	struct sock *sk = sock->sk;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct sockaddr_llc *addr = (struct sockaddr_llc *)msg->msg_name;x 	int flags = msg->msg_flags;x 	int noblock = flags & MSG_DONTWAIT;
@@ -819,7 +819,7 @@
 {
 	struct sockaddr_llc sllc;x 	struct sock *sk = sock->sk;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	int rc = 0;x 
 	lock_sock(sk);x@@ -883,7 +883,7 @@
 			     char __user *optval, int optlen)x {
 	struct sock *sk = sock->sk;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	int rc = -EINVAL, opt;x 
 	lock_sock(sk);x@@ -958,7 +958,7 @@
 			     char __user *optval, int __user *optlen)x {
 	struct sock *sk = sock->sk;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	int val = 0, len = 0, rc = -EINVAL;
 
 	lock_sock(sk);xdiff -Nru a/net/llc/llc_c_ac.c b/net/llc/llc_c_ac.c
--- a/net/llc/llc_c_ac.c	2004-12-27 20:46:22 -08:00
+++ b/net/llc/llc_c_ac.c	2005-01-20 15:17:39 -08:00
@@ -44,7 +44,7 @@
 
 int llc_conn_ac_clear_remote_busy(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (llc->remote_busy_flag) {x 		u8 nr;x@@ -68,7 +68,7 @@
 	sap = llc_sap_find(dsap);x 	if (sap) {x 		struct llc_conn_state_ev *ev = llc_conn_ev(skb);
-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 
 		llc_pdu_decode_sa(skb, llc->daddr.mac);x 		llc_pdu_decode_da(skb, llc->laddr.mac);x@@ -146,7 +146,7 @@
 	int rc = 1;x 	struct llc_conn_state_ev *ev = llc_conn_ev(skb);
 	struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb);
-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	switch (ev->type) {x 	case LLC_CONN_EV_TYPE_PDU:x@@ -207,7 +207,7 @@
 int llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2(struct sock *sk,
 					       struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (llc->data_flag == 2)
 		del_timer(&llc->rej_sent_timer.timer);x@@ -220,7 +220,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -246,7 +246,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 		u8 f_bit;x 
@@ -273,7 +273,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 		u8 f_bit = 1;x 
@@ -299,7 +299,7 @@
 	int rc = -ENOBUFS;
 	struct sk_buff *nskb;
 	struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	llc->rx_pdu_hdr = *((u32 *)pdu);x 	if (LLC_PDU_IS_CMD(pdu))
@@ -334,7 +334,7 @@
 
 	if (nskb) {x 		u8 f_bit = 0;x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 		struct llc_pdu_sn *pdu = (struct llc_pdu_sn *)&llc->rx_pdu_hdr;
 
@@ -364,7 +364,7 @@
 	llc_pdu_decode_pf_bit(skb, &f_bit);x 	nskb = llc_alloc_frame();x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 		struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
 
@@ -388,7 +388,7 @@
 int llc_conn_ac_send_i_cmd_p_set_1(struct sock *sk, struct sk_buff *skb)
 {x 	int rc;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct llc_sap *sap = llc->sap;
 
 	llc_pdu_header_init(skb, LLC_PDU_TYPE_I, sap->laddr.lsap,
@@ -405,7 +405,7 @@
 static int llc_conn_ac_send_i_cmd_p_set_0(struct sock *sk, struct sk_buff *skb)
 {x 	int rc;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct llc_sap *sap = llc->sap;
 
 	llc_pdu_header_init(skb, LLC_PDU_TYPE_I, sap->laddr.lsap,
@@ -422,7 +422,7 @@
 int llc_conn_ac_send_i_xxx_x_set_0(struct sock *sk, struct sk_buff *skb)
 {x 	int rc;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct llc_sap *sap = llc->sap;
 
 	llc_pdu_header_init(skb, LLC_PDU_TYPE_I, sap->laddr.lsap,
@@ -454,7 +454,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -490,7 +490,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -516,7 +516,7 @@
 
 	if (nskb) {x 		u8 f_bit = 1;x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -541,7 +541,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 		u8 f_bit = 0;
 
@@ -567,7 +567,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -592,7 +592,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 		u8 f_bit = 1;x 
@@ -619,7 +619,7 @@
 
 	if (nskb) {x 		u8 f_bit = 0;x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -640,7 +640,7 @@
 
 int llc_conn_ac_set_remote_busy(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (!llc->remote_busy_flag) {x 		llc->remote_busy_flag = 1;x@@ -656,7 +656,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -681,7 +681,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -706,7 +706,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 		u8 f_bit = 1;x 
@@ -732,7 +732,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 		u8 f_bit = 1;x 
@@ -758,7 +758,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -783,7 +783,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -816,7 +816,7 @@
 {
 	int rc = -ENOBUFS;
 	struct sk_buff *nskb = llc_alloc_frame();x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (nskb) {x 		struct llc_sap *sap = llc->sap;
@@ -849,7 +849,7 @@
 
 	llc_pdu_decode_pf_bit(skb, &f_bit);x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -882,7 +882,7 @@
 
 int llc_conn_ac_start_p_timer(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	llc_conn_set_p_flag(sk, 1);x 	mod_timer(&llc->pf_cycle_timer.timer,
@@ -903,7 +903,7 @@
 int llc_conn_ac_send_ack_if_needed(struct sock *sk, struct sk_buff *skb)
 {x 	u8 pf_bit;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	llc_pdu_decode_pf_bit(skb, &pf_bit);x 	llc->ack_pf |= pf_bit & 1;x@@ -950,7 +950,7 @@
 					      struct sk_buff *skb)
 {x 	int rc;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct llc_sap *sap = llc->sap;
 
 	llc_pdu_header_init(skb, LLC_PDU_TYPE_I, sap->laddr.lsap,
@@ -976,7 +976,7 @@
  */
 int llc_conn_ac_send_i_as_ack(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (llc->ack_must_be_send) {x 		llc_conn_ac_send_i_rsp_f_set_ackpf(sk, skb);x@@ -1004,7 +1004,7 @@
 	struct sk_buff *nskb = llc_alloc_frame();x x 	if (nskb) {x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		nskb->dev = llc->dev;
@@ -1035,7 +1035,7 @@
  */
 static int llc_conn_ac_inc_npta_value(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (!llc->inc_cntr) {x 		llc->dec_step = 0;x@@ -1058,7 +1058,7 @@
  */
 int llc_conn_ac_adjust_npta_by_rr(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (!llc->connect_step && !llc->remote_busy_flag) {x 		if (!llc->dec_step) {x@@ -1084,7 +1084,7 @@
  */
 int llc_conn_ac_adjust_npta_by_rnr(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (llc->remote_busy_flag)x 		if (!llc->dec_step) {x@@ -1109,7 +1109,7 @@
  */
 int llc_conn_ac_dec_tx_win_size(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	u8 unacked_pdu = skb_queue_len(&llc->pdu_unack_q);x 
 	llc->k -= unacked_pdu;x@@ -1128,7 +1128,7 @@
  */
 int llc_conn_ac_inc_tx_win_size(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	llc->k += 1;x 	if (llc->k > 128)
@@ -1138,7 +1138,7 @@
 
 int llc_conn_ac_stop_all_timers(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	del_timer(&llc->pf_cycle_timer.timer);x 	del_timer(&llc->ack_timer.timer);x@@ -1151,7 +1151,7 @@
 
 int llc_conn_ac_stop_other_timers(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	del_timer(&llc->rej_sent_timer.timer);x 	del_timer(&llc->pf_cycle_timer.timer);x@@ -1163,7 +1163,7 @@
 
 int llc_conn_ac_start_ack_timer(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	mod_timer(&llc->ack_timer.timer, jiffies + llc->ack_timer.expire * HZ);x 	return 0;x@@ -1171,7 +1171,7 @@
 
 int llc_conn_ac_start_rej_timer(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	mod_timer(&llc->rej_sent_timer.timer,x 		  jiffies + llc->rej_sent_timer.expire * HZ);x@@ -1181,7 +1181,7 @@
 int llc_conn_ac_start_ack_tmr_if_not_running(struct sock *sk,
 					     struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (!timer_pending(&llc->ack_timer.timer))
 		mod_timer(&llc->ack_timer.timer,x@@ -1197,7 +1197,7 @@
 
 int llc_conn_ac_stop_p_timer(struct sock *sk, struct sk_buff *skb)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	del_timer(&llc->pf_cycle_timer.timer);x 	llc_conn_set_p_flag(sk, 0);x@@ -1215,7 +1215,7 @@
 	int acked;x 	u16 unacked = 0;x 	struct llc_pdu_sn *pdu = llc_pdu_sn_hdr(skb);
-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	llc->last_nr = PDU_SUPV_GET_Nr(pdu);x 	acked = llc_conn_remove_acked_pdus(sk, llc->last_nr, &unacked);xdiff -Nru a/net/llc/llc_c_ev.c b/net/llc/llc_c_ev.c
--- a/net/llc/llc_c_ev.c	2004-12-27 20:46:22 -08:00
+++ b/net/llc/llc_c_ev.c	2005-01-20 15:17:39 -08:00
@@ -78,7 +78,7 @@
 	u8 nr1, nr2;x 	struct sk_buff *skb;x 	struct llc_pdu_sn *pdu;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	int rc = 0;x 
 	if (llc->dev->flags & IFF_LOOPBACK)xdiff -Nru a/net/llc/llc_conn.c b/net/llc/llc_conn.c
--- a/net/llc/llc_conn.c	2004-12-27 20:46:22 -08:00
+++ b/net/llc/llc_conn.c	2005-01-20 15:17:39 -08:00
@@ -53,7 +53,7 @@
 int llc_conn_state_process(struct sock *sk, struct sk_buff *skb)
 {x 	int rc;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct llc_conn_state_ev *ev = llc_conn_ev(skb);
 x 	/*x@@ -221,7 +221,7 @@
 	struct sk_buff *skb;x 	struct llc_pdu_sn *pdu;x 	u16 nbr_unack_pdus;x-	struct llc_opt *llc;x+	struct llc_sock *llc;x 	u8 howmany_resend = 0;x 
 	llc_conn_remove_acked_pdus(sk, nr, &nbr_unack_pdus);x@@ -263,7 +263,7 @@
 {
 	struct sk_buff *skb;x 	u16 nbr_unack_pdus;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	u8 howmany_resend = 0;x 
 	llc_conn_remove_acked_pdus(sk, nr, &nbr_unack_pdus);x@@ -305,7 +305,7 @@
 	struct sk_buff *skb;x 	struct llc_pdu_sn *pdu;x 	int nbr_acked = 0;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	int q_len = skb_queue_len(&llc->pdu_unack_q);x 
 	if (!q_len)
@@ -366,7 +366,7 @@
 static int llc_conn_service(struct sock *sk, struct sk_buff *skb)
 {x 	int rc = 1;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct llc_conn_state_trans *trans;x 
 	if (llc->state > NBR_CONN_STATES)
@@ -399,7 +399,7 @@
 	struct llc_conn_state_trans **next_trans;x 	llc_conn_ev_qfyr_t *next_qualifier;x 	struct llc_conn_state_ev *ev = llc_conn_ev(skb);
-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct llc_conn_state *curr_state =
 					&llc_conn_state_table[llc->state - 1];x 
@@ -478,7 +478,7 @@
 x 	read_lock_bh(&sap->sk_list.lock);x 	sk_for_each(rc, node, &sap->sk_list.list) {x-		struct llc_opt *llc = llc_sk(rc);x+		struct llc_sock *llc = llc_sk(rc);x x 		if (llc->laddr.lsap == laddr->lsap &&x 		    llc->daddr.lsap == daddr->lsap &&x@@ -511,7 +511,7 @@
 x 	read_lock_bh(&sap->sk_list.lock);x 	sk_for_each(rc, node, &sap->sk_list.list) {x-		struct llc_opt *llc = llc_sk(rc);x+		struct llc_sock *llc = llc_sk(rc);x x 		if (rc->sk_type == SOCK_STREAM && rc->sk_state == TCP_LISTEN &&x 		    llc->laddr.lsap == laddr->lsap &&x@@ -650,7 +650,7 @@
 static int llc_conn_rcv(struct sock* sk, struct sk_buff *skb)x {
 	struct llc_conn_state_ev *ev = llc_conn_ev(skb);
-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (!llc->dev)x 		llc->dev = skb->dev;
@@ -675,7 +675,7 @@
 		 * Didn't find an active connection; verify if there
 		 * is a listening socket for this llc addr
 		 */x-		struct llc_opt *llc;x+		struct llc_sock *llc;x 		struct sock *parent = llc_lookup_listener(sap, &daddr);x x 		if (!parent) {x@@ -756,7 +756,7 @@
 static int llc_backlog_rcv(struct sock *sk, struct sk_buff *skb)
 {x 	int rc = 0;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (llc_backlog_type(skb) == LLC_PACKET) {x 		if (llc->state > 1) /* not closed */
@@ -786,17 +786,10 @@
  *
  *     Initializes a socket with default llc values.
  */
-static int llc_sk_init(struct sock* sk)
+static void llc_sk_init(struct sock* sk)
 {x-	struct llc_opt *llc = kmalloc(sizeof(*llc), GFP_ATOMIC);
-	int rc = -ENOMEM;
+	struct llc_sock *llc = llc_sk(sk);x 
-	if (!llc)x-		goto out;
-	memset(llc, 0, sizeof(*llc));
-	rc = 0;x-
-	llc->sk	      = sk;x 	llc->state    = LLC_CONN_STATE_ADM;x 	llc->inc_cntr = llc->dec_cntr = 2;x 	llc->dec_step = llc->connect_step = 1;x@@ -827,9 +820,6 @@
 		        * tx_win of remote LLC) */
 	skb_queue_head_init(&llc->pdu_unack_q);x 	sk->sk_backlog_rcv = llc_backlog_rcv;
-	sk->sk_protinfo = llc;x-out:x-	return rc;x }
 
 /**
@@ -842,12 +832,12 @@
  */
 struct sock *llc_sk_alloc(int family, int priority)
 {x-	struct sock *sk = sk_alloc(family, priority, 1, NULL);
+	struct sock *sk = sk_alloc(family, priority,
+				   sizeof(struct llc_sock), NULL);x x 	if (!sk)
 		goto out;
-	if (llc_sk_init(sk))x-		goto outsk;x+	llc_sk_init(sk);
 	sock_init_data(NULL, sk);x 	sk_set_owner(sk, THIS_MODULE);
 #ifdef LLC_REFCNT_DEBUG
@@ -857,10 +847,6 @@
 #endif
 out:x 	return sk;x-outsk:
-	sk_free(sk);x-	sk = NULL;x-	goto out;
 }
 
 /**
@@ -871,7 +857,7 @@
  */
 void llc_sk_free(struct sock *sk)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	llc->state = LLC_CONN_OUT_OF_SVC;x 	/* Stop all (possibly) running timers */
@@ -908,7 +894,7 @@
  */
 void llc_sk_reset(struct sock *sk)
 {x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	llc_conn_ac_stop_all_timers(sk, NULL);x 	skb_queue_purge(&sk->sk_write_queue);xdiff -Nru a/net/llc/llc_if.c b/net/llc/llc_if.c
--- a/net/llc/llc_if.c	2004-12-27 20:46:22 -08:00
+++ b/net/llc/llc_if.c	2005-01-20 15:17:39 -08:00
@@ -45,7 +45,7 @@
 {
 	struct llc_conn_state_ev *ev;x 	int rc = -ECONNABORTED;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 
 	if (llc->state == LLC_CONN_STATE_ADM)
 		goto out;
@@ -86,7 +86,7 @@
 	int rc = -EISCONN;x 	struct llc_addr laddr, daddr;
 	struct sk_buff *skb;x-	struct llc_opt *llc = llc_sk(sk);x+	struct llc_sock *llc = llc_sk(sk);x 	struct sock *existing;x 
 	laddr.lsap = llc->sap->laddr.lsap;xdiff -Nru a/net/llc/llc_proc.c b/net/llc/llc_proc.c
--- a/net/llc/llc_proc.c	2004-12-27 20:46:22 -08:00
+++ b/net/llc/llc_proc.c	2005-01-20 15:17:39 -08:00
@@ -65,7 +65,7 @@
 static void *llc_seq_next(struct seq_file *seq, void *v, loff_t *pos)x {
 	struct sock* sk, *next;x-	struct llc_opt *llc;x+	struct llc_sock *llc;x 	struct llc_sap *sap;x x 	++*pos;x@@ -102,7 +102,7 @@
 {
 	if (v && v != SEQ_START_TOKEN) {x 		struct sock *sk = v;x-		struct llc_opt *llc = llc_sk(sk);x+		struct llc_sock *llc = llc_sk(sk);x 		struct llc_sap *sap = llc->sap;
 
 		read_unlock_bh(&sap->sk_list.lock);x@@ -113,7 +113,7 @@
 static int llc_seq_socket_show(struct seq_file *seq, void *v)x {
 	struct sock* sk;x-	struct llc_opt *llc;x+	struct llc_sock *llc;x x 	if (v == SEQ_START_TOKEN) {x 		seq_puts(seq, "SKt Mc local_mac_sap        remote_mac_sap   "x@@ -160,7 +160,7 @@
 static int llc_seq_core_show(struct seq_file *seq, void *v)x {
 	struct sock* sk;x-	struct llc_opt *llc;x+	struct llc_sock *llc;x x 	if (v == SEQ_START_TOKEN) {x 		seq_puts(seq, "Connection list:\n"xdiff -Nru a/net/llc/llc_sap.c b/net/llc/llc_sap.c
--- a/net/llc/llc_sap.c	2004-12-27 20:46:22 -08:00
+++ b/net/llc/llc_sap.c	2005-01-20 15:17:39 -08:00
@@ -283,7 +283,7 @@
 x 	read_lock_bh(&sap->sk_list.lock);x 	sk_for_each(rc, node, &sap->sk_list.list) {x-		struct llc_opt *llc = llc_sk(rc);x+		struct llc_sock *llc = llc_sk(rc);x x 		if (rc->sk_type == SOCK_DGRAM &&x 		    llc->laddr.lsap == laddr->lsap &&xdiff -Nru a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
--- a/net/netlink/af_netlink.c	2005-01-21 12:25:32 -08:00
+++ b/net/netlink/af_netlink.c	2005-02-08 20:09:15 -08:00
@@ -59,8 +59,9 @@
 #define NL_EMULATE_DEV
 #endif
 x-struct netlink_opt
-{x+struct netlink_sock {x+	/* struct sock has to be the first member of netlink_sock */x+	struct sock		sk;x 	u32			pid;x 	unsigned int		groups;x 	u32			dst_pid;x@@ -73,7 +74,10 @@
 	void			(*data_ready)(struct sock *sk, int bytes);
 };x x-#define nlk_sk(__sk) ((struct netlink_opt *)(__sk)->sk_protinfo)
+static inline struct netlink_sock *nlk_sk(struct sock *sk)
+{x+	return (struct netlink_sock *)sk;x+}
 
 struct nl_pid_hash {
 	struct hlist_head *table;x@@ -122,8 +126,6 @@
 	BUG_TRAP(!atomic_read(&sk->sk_rmem_alloc));x 	BUG_TRAP(!atomic_read(&sk->sk_wmem_alloc));x 	BUG_TRAP(!nlk_sk(sk)->cb);
-x-	kfree(nlk_sk(sk));x }
 
 /* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on SMP.
@@ -327,7 +329,7 @@
 static int netlink_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct netlink_opt *nlk;x+	struct netlink_sock *nlk;x x 	sock->state = SS_UNCONNECTED;x 
@@ -339,19 +341,15 @@
 x 	sock->ops = &netlink_ops;
 x-	sk = sk_alloc(PF_NETLINK, GFP_KERNEL, 1, NULL);
+	sk = sk_alloc(PF_NETLINK, GFP_KERNEL,x+		      sizeof(struct netlink_sock), NULL);x 	if (!sk)
 		return -ENOMEM;
 
 	sock_init_data(sock,sk);x 	sk_set_owner(sk, THIS_MODULE);
 x-	nlk = sk->sk_protinfo = kmalloc(sizeof(*nlk), GFP_KERNEL);
-	if (!nlk) {x-		sk_free(sk);x-		return -ENOMEM;
-	}x-	memset(nlk, 0, sizeof(*nlk));
+	nlk = nlk_sk(sk);
 
 	spin_lock_init(&nlk->cb_lock);x 	init_waitqueue_head(&nlk->wait);x@@ -364,7 +362,7 @@
 static int netlink_release(struct socket *sock)
 {
 	struct sock *sk = sock->sk;x-	struct netlink_opt *nlk;x+	struct netlink_sock *nlk;x x 	if (!sk)
 		return 0;x@@ -445,7 +443,7 @@
 static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len)x {
 	struct sock *sk = sock->sk;x-	struct netlink_opt *nlk = nlk_sk(sk);
+	struct netlink_sock *nlk = nlk_sk(sk);
 	struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr;
 	int err;x 	x@@ -486,7 +484,7 @@
 {x 	int err = 0;x 	struct sock *sk = sock->sk;x-	struct netlink_opt *nlk = nlk_sk(sk);
+	struct netlink_sock *nlk = nlk_sk(sk);
 	struct sockaddr_nl *nladdr=(struct sockaddr_nl*)addr;
 x 	if (addr->sa_family == AF_UNSPEC) {x@@ -517,7 +515,7 @@
 static int netlink_getname(struct socket *sock, struct sockaddr *addr, int *addr_len, int peer)x {
 	struct sock *sk = sock->sk;x-	struct netlink_opt *nlk = nlk_sk(sk);
+	struct netlink_sock *nlk = nlk_sk(sk);
 	struct sockaddr_nl *nladdr=(struct sockaddr_nl *)addr;
 	x 	nladdr->nl_family = AF_NETLINK;
@@ -546,7 +544,7 @@
 {x 	int protocol = ssk->sk_protocol;x 	struct sock *sock;
-	struct netlink_opt *nlk;x+	struct netlink_sock *nlk;x x 	sock = netlink_lookup(protocol, pid);x 	if (!sock)
@@ -592,7 +590,7 @@
  */
 int netlink_attachskb(struct sock *sk, struct sk_buff *skb, int nonblock, long timeo)
 {x-	struct netlink_opt *nlk;x+	struct netlink_sock *nlk;x x 	nlk = nlk_sk(sk);
 
@@ -635,7 +633,7 @@
 
 int netlink_sendskb(struct sock *sk, struct sk_buff *skb, int protocol)
 {
-	struct netlink_opt *nlk;x+	struct netlink_sock *nlk;x 	int len = skb->len;x x 	nlk = nlk_sk(sk);
@@ -710,7 +708,7 @@
 
 static __inline__ int netlink_broadcast_deliver(struct sock *sk, struct sk_buff *skb)
 {x-	struct netlink_opt *nlk = nlk_sk(sk);
+	struct netlink_sock *nlk = nlk_sk(sk);
 #ifdef NL_EMULATE_DEV
 	if (nlk->handler) {x 		nlk->handler(sk->sk_protocol, skb);x@@ -741,7 +739,7 @@
 static inline int do_one_broadcast(struct sock *sk,
 				   struct netlink_broadcast_data *p)
 {x-	struct netlink_opt *nlk = nlk_sk(sk);
+	struct netlink_sock *nlk = nlk_sk(sk);
 	int val;
 x 	if (p->exclude_sk == sk)
@@ -833,7 +831,7 @@
 static inline int do_one_set_err(struct sock *sk,
 				 struct netlink_set_err_data *p)
 {x-	struct netlink_opt *nlk = nlk_sk(sk);
+	struct netlink_sock *nlk = nlk_sk(sk);
 x 	if (sk == p->exclude_sk)
 		goto out;
@@ -868,7 +866,7 @@
 
 static inline void netlink_rcv_wake(struct sock *sk)
 {x-	struct netlink_opt *nlk = nlk_sk(sk);
+	struct netlink_sock *nlk = nlk_sk(sk);
 x 	if (!skb_queue_len(&sk->sk_receive_queue))
 		clear_bit(0, &nlk->state);x@@ -881,7 +879,7 @@
 {
 	struct sock_iocb *siocb = kiocb_to_siocb(kiocb);x 	struct sock *sk = sock->sk;x-	struct netlink_opt *nlk = nlk_sk(sk);
+	struct netlink_sock *nlk = nlk_sk(sk);
 	struct sockaddr_nl *addr=msg->msg_name;x 	u32 dst_pid;x 	u32 dst_groups;x@@ -965,7 +963,7 @@
 	struct sock_iocb *siocb = kiocb_to_siocb(kiocb);x 	struct scm_cookie scm;x 	struct sock *sk = sock->sk;x-	struct netlink_opt *nlk = nlk_sk(sk);
+	struct netlink_sock *nlk = nlk_sk(sk);
 	int noblock = flags&MSG_DONTWAIT;
 	size_t copied;x 	struct sk_buff *skb;x@@ -1019,7 +1017,7 @@
 
 static void netlink_data_ready(struct sock *sk, int len)x {
-	struct netlink_opt *nlk = nlk_sk(sk);
+	struct netlink_sock *nlk = nlk_sk(sk);
 x 	if (nlk->data_ready)x 		nlk->data_ready(sk, len);x@@ -1083,7 +1081,7 @@
 
 static int netlink_dump(struct sock *sk)
 {x-	struct netlink_opt *nlk = nlk_sk(sk);
+	struct netlink_sock *nlk = nlk_sk(sk);
 	struct netlink_callback *cb;x 	struct sk_buff *skb;x 	struct nlmsghdr *nlh;x@@ -1133,7 +1131,7 @@
 {
 	struct netlink_callback *cb;x 	struct sock *sk;
-	struct netlink_opt *nlk;x+	struct netlink_sock *nlk;x x 	cb = kmalloc(sizeof(*cb), GFP_KERNEL);
 	if (cb == NULL)
@@ -1290,7 +1288,7 @@
 			 "Rmem     Wmem     Dump     Locks\n");
 	else {x 		struct sock *s = v;x-		struct netlink_opt *nlk = nlk_sk(s);x+		struct netlink_sock *nlk = nlk_sk(s);x x 		seq_printf(seq, "%p %-3d %-6d %08x %-8d %-8d %p %d\n",
 			   s,xdiff -Nru a/net/packet/af_packet.c b/net/packet/af_packet.c
--- a/net/packet/af_packet.c	2005-01-13 20:41:06 -08:00
+++ b/net/packet/af_packet.c	2005-01-20 14:41:21 -08:00
@@ -170,8 +170,9 @@
 
 static void packet_flush_mclist(struct sock *sk);
 x-struct packet_opt
-{x+struct packet_sock {x+	/* struct sock has to be the first member of packet_sock */x+	struct sock		sk;x 	struct tpacket_stats	stats;
 #ifdef CONFIG_PACKET_MMAPx 	char *			*pg_vec;x@@ -199,7 +200,7 @@
 
 #ifdef CONFIG_PACKET_MMAPx 
-static inline char *packet_lookup_frame(struct packet_opt *po, unsigned int position)
+static inline char *packet_lookup_frame(struct packet_sock *po, unsigned int position)
 {x 	unsigned int pg_vec_pos, frame_offset;x 	char *frame;x@@ -213,7 +214,10 @@
 }
 #endif
 x-#define pkt_sk(__sk) ((struct packet_opt *)(__sk)->sk_protinfo)
+static inline struct packet_sock *pkt_sk(struct sock *sk)
+{x+	return (struct packet_sock *)sk;x+}
 
 static void packet_sock_destruct(struct sock *sk)
 {x@@ -225,8 +229,6 @@
 		return;
 	}
 
-	if (pkt_sk(sk))x-		kfree(pkt_sk(sk));x 	atomic_dec(&packet_socks_nr);x #ifdef PACKET_REFCNT_DEBUG
 	printk(KERN_DEBUG "PACKET socket %p is free, %d are alive\n", sk, atomic_read(&packet_socks_nr));x@@ -440,7 +442,7 @@
 {
 	struct sock *sk;
 	struct sockaddr_ll *sll;
-	struct packet_opt *po;x+	struct packet_sock *po;x 	u8 * skb_head = skb->data;x 	int skb_len = skb->len;x 	unsigned snaplen;x@@ -541,7 +543,7 @@
 static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,  struct packet_type *pt)
 {
 	struct sock *sk;
-	struct packet_opt *po;x+	struct packet_sock *po;x 	struct sockaddr_ll *sll;
 	struct tpacket_hdr *h;x 	u8 * skb_head = skb->data;x@@ -699,7 +701,7 @@
 	 */
 	 x 	if (saddr == NULL) {x-		struct packet_opt *po = pkt_sk(sk);x+		struct packet_sock *po = pkt_sk(sk);x x 		ifindex	= po->ifindex;x 		proto	= po->num;
@@ -786,7 +788,7 @@
 static int packet_release(struct socket *sock)
 {
 	struct sock *sk = sock->sk;x-	struct packet_opt *po;x+	struct packet_sock *po;x x 	if (!sk)
 		return 0;x@@ -844,7 +846,7 @@
 
 static int packet_do_bind(struct sock *sk, struct net_device *dev, int protocol)
 {
-	struct packet_opt *po = pkt_sk(sk);x+	struct packet_sock *po = pkt_sk(sk);x 	/*x 	 *	Detach an existing hook if present.
 	 */
@@ -961,7 +963,7 @@
 static int packet_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct packet_opt *po;x+	struct packet_sock *po;x 	int err;x 
 	if (!capable(CAP_NET_RAW))
@@ -976,7 +978,8 @@
 	sock->state = SS_UNCONNECTED;x 
 	err = -ENOBUFS;
-	sk = sk_alloc(PF_PACKET, GFP_KERNEL, 1, NULL);
+	sk = sk_alloc(PF_PACKET, GFP_KERNEL,x+		      sizeof(struct packet_sock), NULL);x 	if (sk == NULL)
 		goto out;
 
@@ -988,10 +991,7 @@
 	sock_init_data(sock,sk);x 	sk_set_owner(sk, THIS_MODULE);
 x-	po = sk->sk_protinfo = kmalloc(sizeof(*po), GFP_KERNEL);
-	if (!po)x-		goto out_free;
-	memset(po, 0, sizeof(*po));
+	po = pkt_sk(sk);x 	sk->sk_family = PF_PACKET;x 	po->num = protocol;
 x@@ -1021,9 +1021,6 @@
 	sk_add_node(sk, &packet_sklist);x 	write_unlock_bh(&packet_sklist_lock);x 	return(0);
-x-out_free:
-	sk_free(sk);x out:x 	return err;x }x@@ -1141,7 +1138,7 @@
 {
 	struct net_device *dev;x 	struct sock *sk = sock->sk;x-	struct packet_opt *po = pkt_sk(sk);x+	struct packet_sock *po = pkt_sk(sk);x 	struct sockaddr_ll *sll = (struct sockaddr_ll*)uaddr;
 x 	if (peer)x@@ -1195,7 +1192,7 @@
 
 static int packet_mc_add(struct sock *sk, struct packet_mreq *mreq)
 {
-	struct packet_opt *po = pkt_sk(sk);x+	struct packet_sock *po = pkt_sk(sk);x 	struct packet_mclist *ml, *i;
 	struct net_device *dev;x 	int err;x@@ -1274,7 +1271,7 @@
 
 static void packet_flush_mclist(struct sock *sk)
 {
-	struct packet_opt *po = pkt_sk(sk);x+	struct packet_sock *po = pkt_sk(sk);x 	struct packet_mclist *ml;x 
 	if (!po->mclist)
@@ -1355,7 +1352,7 @@
 {x 	int len;x 	struct sock *sk = sock->sk;x-	struct packet_opt *po = pkt_sk(sk);x+	struct packet_sock *po = pkt_sk(sk);x 
 	if (level != SOL_PACKET)
 		return -ENOPROTOOPT;x@@ -1401,7 +1398,7 @@
 x 	read_lock(&packet_sklist_lock);x 	sk_for_each(sk, node, &packet_sklist) {x-		struct packet_opt *po = pkt_sk(sk);x+		struct packet_sock *po = pkt_sk(sk);x x 		switch (msg) {x 		case NETDEV_UNREGISTER:x@@ -1504,7 +1501,7 @@
 				poll_table *wait)
 {
 	struct sock *sk = sock->sk;x-	struct packet_opt *po = pkt_sk(sk);x+	struct packet_sock *po = pkt_sk(sk);x 	unsigned int mask = datagram_poll(file, sock, wait);x 
 	spin_lock_bh(&sk->sk_receive_queue.lock);x@@ -1579,7 +1576,7 @@
 static int packet_set_ring(struct sock *sk, struct tpacket_req *req, int closing)
 {
 	char **pg_vec = NULL;x-	struct packet_opt *po = pkt_sk(sk);x+	struct packet_sock *po = pkt_sk(sk);x 	int was_running, num, order = 0;x 	int err = 0;x 	
@@ -1709,7 +1706,7 @@
 static int packet_mmap(struct file *file, struct socket *sock, struct vm_area_struct *vma)
 {
 	struct sock *sk = sock->sk;x-	struct packet_opt *po = pkt_sk(sk);x+	struct packet_sock *po = pkt_sk(sk);x 	unsigned long size;x 	unsigned long start;x 	int err = -EINVAL;
@@ -1839,7 +1836,7 @@
 		seq_puts(seq, "sk       RefCnt Type Proto  Iface R Rmem   User   Inode\n");
 	else {x 		struct sock *s = v;x-		const struct packet_opt *po = pkt_sk(s);x+		const struct packet_sock *po = pkt_sk(s);x x 		seq_printf(seq,
 			   "%p %-6d %-4d %04x   %-5d %1d %-6u %-6u %-6lu\n",
diff -Nru a/net/rxrpc/main.c b/net/rxrpc/main.c
--- a/net/rxrpc/main.c	2004-09-21 20:06:16 -07:00
+++ b/net/rxrpc/main.c	2005-03-08 16:53:44 -08:00
@@ -22,12 +22,6 @@
 #include <rxrpc/message.h>
 #include "internal.h"x 
-static int rxrpc_initialise(void);
-static void rxrpc_cleanup(void);
-
-module_init(rxrpc_initialise);
-module_exit(rxrpc_cleanup);
-
 MODULE_DESCRIPTION("Rx RPC implementation");
 MODULE_AUTHOR("Red Hat, Inc.");
 MODULE_LICENSE("GPL");x@@ -38,7 +32,7 @@
 /*
  * initialise the Rx module
  */
-static int rxrpc_initialise(void)
+static int __init rxrpc_initialise(void)
 {x 	int ret;
 
@@ -93,6 +87,8 @@
 	return ret;
 } /* end rxrpc_initialise() */
 
+module_init(rxrpc_initialise);
+
 /*****************************************************************************/
 /*
  * clean up the Rx module
@@ -135,6 +131,8 @@
 x 	kleave("");
 } /* end rxrpc_cleanup() */
+
+module_exit(rxrpc_cleanup);
 
 /*****************************************************************************/
 /*
diff -Nru a/net/sched/Kconfig b/net/sched/Kconfig
--- a/net/sched/Kconfig	2005-01-10 13:32:31 -08:00
+++ b/net/sched/Kconfig	2005-02-15 12:20:47 -08:00
@@ -269,6 +269,16 @@
 	  Documentation and software is at
 	  <http://diffserv.sourceforge.net/>.
 
+config NET_CLS_BASICx+	tristate "Basic classifier"x+	depends on NET_CLSx+	---help---x+	  Say Y here if you want to be able to classify packets usingx+	  only extended matches and actions.
+
+	  To compile this code as a module, choose M here: the
+	  module will be called cls_basic.
+
 config NET_CLS_TCINDEX
 	tristate "TC index classifier"x 	depends on NET_CLSx@@ -374,6 +384,70 @@
 x 	  To compile this code as a module, choose M here: the
 	  module will be called cls_rsvp6.
+
+config NET_EMATCH
+	bool "Extended Matches"x+	depends on NET_CLSx+	---help---x+	  Say Y here if you want to use extended matches on top of classifiersx+	  and select the extended matches below.
+
+	  Extended matches are small classification helpers not worth writingx+	  a separate classifier.
+
+	  You must have a recent version of the iproute2 tools in order to use
+	  extended matches.
+
+config NET_EMATCH_STACK
+	int "Stack size"x+	depends on NET_EMATCH
+	default "32"x+	---help---x+	  Size of the local stack variable used while evaluating the tree of
+	  ematches. Limits the depth of the tree, i.e. the number of
+	  encapsulated precedences. Every level requires 4 bytes of addtional
+	  stack space.
+
+config NET_EMATCH_CMPx+	tristate "Simple packet data comparison"x+	depends on NET_EMATCH
+	---help---x+	  Say Y here if you want to be able to classify packets based on
+	  simple packet data comparisons for 8, 16, and 32bit values.
+
+	  To compile this code as a module, choose M here: the
+	  module will be called em_cmp.
+
+config NET_EMATCH_NBYTEx+	tristate "Multi byte comparison"x+	depends on NET_EMATCH
+	---help---x+	  Say Y here if you want to be able to classify packets based on
+	  multiple byte comparisons mainly useful for IPv6 address comparisons.
+
+	  To compile this code as a module, choose M here: the
+	  module will be called em_nbyte.
+
+config NET_EMATCH_U32x+	tristate "U32 hashing key"x+	depends on NET_EMATCH
+	---help---x+	  Say Y here if you want to be able to classify packets usingx+	  the famous u32 key in combination with logic relations.
+
+	  To compile this code as a module, choose M here: the
+	  module will be called em_u32.
+
+config NET_EMATCH_METAx+	tristate "Metadata"x+	depends on NET_EMATCH
+	---help---x+	  Say Y here if you want to be ablt to classify packets based on
+	  metadata such as load average, netfilter attributes, socketx+	  attributes and routing decisions.
+
+	  To compile this code as a module, choose M here: the
+	  module will be called em_meta.
 
 config NET_CLS_ACT
 	bool "Packet ACTION"
diff -Nru a/net/sched/Makefile b/net/sched/Makefile
--- a/net/sched/Makefile	2004-11-05 16:33:12 -08:00
+++ b/net/sched/Makefile	2005-02-15 12:20:47 -08:00
@@ -33,3 +33,9 @@
 obj-$(CONFIG_NET_CLS_RSVP)	+= cls_rsvp.o
 obj-$(CONFIG_NET_CLS_TCINDEX)	+= cls_tcindex.o
 obj-$(CONFIG_NET_CLS_RSVP6)	+= cls_rsvp6.o
+obj-$(CONFIG_NET_CLS_BASIC)	+= cls_basic.o
+obj-$(CONFIG_NET_EMATCH)	+= ematch.o
+obj-$(CONFIG_NET_EMATCH_CMP)	+= em_cmp.o
+obj-$(CONFIG_NET_EMATCH_NBYTE)	+= em_nbyte.o
+obj-$(CONFIG_NET_EMATCH_U32)	+= em_u32.o
+obj-$(CONFIG_NET_EMATCH_META)	+= em_meta.o
diff -Nru a/net/sched/cls_basic.c b/net/sched/cls_basic.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/net/sched/cls_basic.c	2005-02-15 12:20:45 -08:00
@@ -0,0 +1,303 @@
+/*
+ * net/sched/cls_basic.c	Basic Packet Classifier.
+ *
+ *		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.
+ *
+ * Authors:	Thomas Graf <tgraf@suug.ch>
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/errno.h>
+#include <linux/rtnetlink.h>
+#include <linux/skbuff.h>
+#include <net/act_api.h>
+#include <net/pkt_cls.h>
+x+struct basic_head
+{x+	u32			hgenerator;x+	struct list_head	flist;x+};
+x+struct basic_filter
+{x+	u32			handle;x+	struct tcf_exts		exts;x+	struct tcf_ematch_tree	ematches;x+	struct tcf_result	res;x+	struct list_head	link;x+};
+x+static struct tcf_ext_map basic_ext_map = {x+	.action = TCA_BASIC_ACT,x+	.police = TCA_BASIC_POLICEx+};
+x+static int basic_classify(struct sk_buff *skb, struct tcf_proto *tp,
+			  struct tcf_result *res)
+{x+	int r;x+	struct basic_head *head = (struct basic_head *) tp->root;x+	struct basic_filter *f;
+x+	list_for_each_entry(f, &head->flist, link) {x+		if (!tcf_em_tree_match(skb, &f->ematches, NULL))
+			continue;x+		*res = f->res;x+		r = tcf_exts_exec(skb, &f->exts, res);x+		if (r < 0)
+			continue;x+		return r;x+	}x+	return -1;x+}
+x+static unsigned long basic_get(struct tcf_proto *tp, u32 handle)
+{x+	unsigned long l = 0UL;x+	struct basic_head *head = (struct basic_head *) tp->root;x+	struct basic_filter *f;
+x+	if (head == NULL)
+		return 0UL;x+x+	list_for_each_entry(f, &head->flist, link)x+		if (f->handle == handle)
+			l = (unsigned long) f;
+x+	return l;x+}
+x+static void basic_put(struct tcf_proto *tp, unsigned long f)
+{x+}
+x+static int basic_init(struct tcf_proto *tp)
+{x+	return 0;x+}
+x+static inline void basic_delete_filter(struct tcf_proto *tp,
+				       struct basic_filter *f)
+{x+	tcf_unbind_filter(tp, &f->res);x+	tcf_exts_destroy(tp, &f->exts);x+	tcf_em_tree_destroy(tp, &f->ematches);x+	kfree(f);x+}
+x+static void basic_destroy(struct tcf_proto *tp)
+{x+	struct basic_head *head = (struct basic_head *) xchg(&tp->root, NULL);
+	struct basic_filter *f, *n;
+	x+	list_for_each_entry_safe(f, n, &head->flist, link) {x+		list_del(&f->link);x+		basic_delete_filter(tp, f);x+	}x+}
+x+static int basic_delete(struct tcf_proto *tp, unsigned long arg)
+{x+	struct basic_head *head = (struct basic_head *) tp->root;x+	struct basic_filter *t, *f = (struct basic_filter *) arg;x+x+	list_for_each_entry(t, &head->flist, link)x+		if (t == f) {x+			tcf_tree_lock(tp);x+			list_del(&t->link);x+			tcf_tree_unlock(tp);x+			basic_delete_filter(tp, t);x+			return 0;x+		}
+x+	return -ENOENT;x+}
+x+static inline int basic_set_parms(struct tcf_proto *tp, struct basic_filter *f,
+				  unsigned long base, struct rtattr **tb,
+				  struct rtattr *est)
+{x+	int err = -EINVAL;
+	struct tcf_exts e;x+	struct tcf_ematch_tree t;
+x+	if (tb[TCA_BASIC_CLASSID-1])x+		if (RTA_PAYLOAD(tb[TCA_BASIC_CLASSID-1]) < sizeof(u32))
+			return err;x+x+	err = tcf_exts_validate(tp, tb, est, &e, &basic_ext_map);x+	if (err < 0)
+		return err;x+x+	err = tcf_em_tree_validate(tp, tb[TCA_BASIC_EMATCHES-1], &t);x+	if (err < 0)
+		goto errout;
+x+	if (tb[TCA_BASIC_CLASSID-1]) {x+		f->res.classid = *(u32*)RTA_DATA(tb[TCA_BASIC_CLASSID-1]);x+		tcf_bind_filter(tp, &f->res, base);x+	}x+x+	tcf_exts_change(tp, &f->exts, &e);x+	tcf_em_tree_change(tp, &f->ematches, &t);x+x+	return 0;x+errout:x+	tcf_exts_destroy(tp, &e);x+	return err;x+}
+x+static int basic_change(struct tcf_proto *tp, unsigned long base, u32 handle,x+		        struct rtattr **tca, unsigned long *arg)
+{x+	int err = -EINVAL;
+	struct basic_head *head = (struct basic_head *) tp->root;x+	struct rtattr *tb[TCA_BASIC_MAX];
+	struct basic_filter *f = (struct basic_filter *) *arg;x+x+	if (tca[TCA_OPTIONS-1] == NULL)
+		return -EINVAL;
+x+	if (rtattr_parse_nested(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS-1]) < 0)
+		return -EINVAL;
+x+	if (f != NULL) {x+		if (handle && f->handle != handle)
+			return -EINVAL;
+		return basic_set_parms(tp, f, base, tb, tca[TCA_RATE-1]);x+	}x+x+	err = -ENOBUFS;
+	if (head == NULL) {x+		head = kmalloc(sizeof(*head), GFP_KERNEL);
+		if (head == NULL)
+			goto errout;
+x+		memset(head, 0, sizeof(*head));
+		INIT_LIST_HEAD(&head->flist);x+		tp->root = head;x+	}x+x+	f = kmalloc(sizeof(*f), GFP_KERNEL);
+	if (f == NULL)
+		goto errout;
+	memset(f, 0, sizeof(*f));x+x+	err = -EINVAL;
+	if (handle)x+		f->handle = handle;x+	else {x+		int i = 0x80000000;x+		do {x+			if (++head->hgenerator == 0x7FFFFFFF)
+				head->hgenerator = 1;x+		} while (--i > 0 && basic_get(tp, head->hgenerator));x+x+		if (i <= 0) {x+			printk(KERN_ERR "Insufficient number of handles\n");
+			goto errout;
+		}
+x+		f->handle = head->hgenerator;x+	}x+x+	err = basic_set_parms(tp, f, base, tb, tca[TCA_RATE-1]);x+	if (err < 0)
+		goto errout;
+x+	tcf_tree_lock(tp);x+	list_add(&f->link, &head->flist);x+	tcf_tree_unlock(tp);x+	*arg = (unsigned long) f;
+x+	return 0;x+errout:x+	if (*arg == 0UL && f)
+		kfree(f);x+x+	return err;x+}
+x+static void basic_walk(struct tcf_proto *tp, struct tcf_walker *arg)
+{x+	struct basic_head *head = (struct basic_head *) tp->root;x+	struct basic_filter *f;
+x+	list_for_each_entry(f, &head->flist, link) {x+		if (arg->count < arg->skip)
+			goto skip;x+x+		if (arg->fn(tp, (unsigned long) f, arg) < 0) {x+			arg->stop = 1;x+			break;
+		}
+skip:x+		arg->count++;x+	}x+}
+x+static int basic_dump(struct tcf_proto *tp, unsigned long fh,x+		      struct sk_buff *skb, struct tcmsg *t)
+{x+	struct basic_filter *f = (struct basic_filter *) fh;x+	unsigned char *b = skb->tail;x+	struct rtattr *rta;x+
+	if (f == NULL)
+		return skb->len;x+x+	t->tcm_handle = f->handle;x+x+	rta = (struct rtattr *) b;x+	RTA_PUT(skb, TCA_OPTIONS, 0, NULL);
+x+	if (tcf_exts_dump(skb, &f->exts, &basic_ext_map) < 0 ||
+	    tcf_em_tree_dump(skb, &f->ematches, TCA_BASIC_EMATCHES) < 0)
+		goto rtattr_failure;x+x+	rta->rta_len = (skb->tail - b);x+	return skb->len;x+x+rtattr_failure:
+	skb_trim(skb, b - skb->data);x+	return -1;x+}
+x+static struct tcf_proto_ops cls_basic_ops = {x+	.kind		=	"basic",x+	.classify	=	basic_classify,x+	.init		=	basic_init,x+	.destroy	=	basic_destroy,x+	.get		=	basic_get,x+	.put		=	basic_put,x+	.change		=	basic_change,x+	.delete		=	basic_delete,x+	.walk		=	basic_walk,x+	.dump		=	basic_dump,x+	.owner		=	THIS_MODULE,x+};
+x+static int __init init_basic(void)
+{x+	return register_tcf_proto_ops(&cls_basic_ops);x+}
+x+static void __exit exit_basic(void) 
+{x+	unregister_tcf_proto_ops(&cls_basic_ops);x+}
+x+module_init(init_basic)
+module_exit(exit_basic)
+MODULE_LICENSE("GPL");x+
diff -Nru a/net/sched/em_cmp.c b/net/sched/em_cmp.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/net/sched/em_cmp.c	2005-02-15 12:13:56 -08:00
@@ -0,0 +1,101 @@
+/*
+ * net/sched/em_cmp.c	Simple packet data comparison ematch
+ *
+ *		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.
+ *
+ * Authors:	Thomas Graf <tgraf@suug.ch>
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/skbuff.h>
+#include <linux/tc_ematch/tc_em_cmp.h>
+#include <net/pkt_cls.h>
+x+static inline int cmp_needs_transformation(struct tcf_em_cmp *cmp)
+{x+	return unlikely(cmp->flags & TCF_EM_CMP_TRANS);x+}
+x+static int em_cmp_match(struct sk_buff *skb, struct tcf_ematch *em,
+			struct tcf_pkt_info *info)
+{x+	struct tcf_em_cmp *cmp = (struct tcf_em_cmp *) em->data;x+	unsigned char *ptr = tcf_get_base_ptr(skb, cmp->layer) + cmp->off;x+	u32 val = 0;x+x+	if (!tcf_valid_offset(skb, ptr, cmp->align))
+		return 0;x+x+	switch (cmp->align) {x+		case TCF_EM_ALIGN_U8:x+			val = *ptr;x+			break;
+x+		case TCF_EM_ALIGN_U16:x+			val = *ptr << 8;x+			val |= *(ptr+1);x+x+			if (cmp_needs_transformation(cmp))
+				val = be16_to_cpu(val);x+			break;
+x+		case TCF_EM_ALIGN_U32:x+			/* Worth checking boundries? The branching seems
+			 * to get worse. Visit again. */x+			val = *ptr << 24;x+			val |= *(ptr+1) << 16;x+			val |= *(ptr+2) << 8;x+			val |= *(ptr+3);x+x+			if (cmp_needs_transformation(cmp))
+				val = be32_to_cpu(val);x+			break;
+x+		default:x+			return 0;x+	}x+x+	if (cmp->mask)
+		val &= cmp->mask;x+x+	switch (cmp->opnd) {x+		case TCF_EM_OPND_EQ:x+			return val == cmp->val;
+		case TCF_EM_OPND_LT:x+			return val < cmp->val;
+		case TCF_EM_OPND_GT:x+			return val > cmp->val;
+	}
+x+	return 0;x+}
+x+static struct tcf_ematch_ops em_cmp_ops = {x+	.kind	  = TCF_EM_CMP,x+	.datalen  = sizeof(struct tcf_em_cmp),x+	.match	  = em_cmp_match,x+	.owner	  = THIS_MODULE,x+	.link	  = LIST_HEAD_INIT(em_cmp_ops.link)x+};
+x+static int __init init_em_cmp(void)
+{x+	return tcf_em_register(&em_cmp_ops);x+}
+x+static void __exit exit_em_cmp(void) 
+{x+	tcf_em_unregister(&em_cmp_ops);x+}
+x+MODULE_LICENSE("GPL");x+
+module_init(init_em_cmp);
+module_exit(exit_em_cmp);
+
diff -Nru a/net/sched/em_meta.c b/net/sched/em_meta.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/net/sched/em_meta.c	2005-02-15 12:19:25 -08:00
@@ -0,0 +1,661 @@
+/*
+ * net/sched/em_meta.c	Metadata ematch
+ *
+ *		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.
+ *
+ * Authors:	Thomas Graf <tgraf@suug.ch>
+ *
+ * ==========================================================================
+ * 
+ * 	The metadata ematch compares two meta objects where each object
+ * 	represents either a meta value stored in the kernel or a static
+ * 	value provided by userspace. The objects are not provided by
+ * 	userspace itself but rather a definition providing the information
+ * 	to build them. Every object is of a certain type which must be
+ * 	equal to the object it is being compared to.
+ *
+ * 	The definition of a objects conists of the type (meta type), a
+ * 	identifier (meta id) and additional type specific information.
+ * 	The meta id is either TCF_META_TYPE_VALUE for values provided by
+ * 	userspace or a index to the meta operations table consisting of
+ * 	function pointers to type specific meta data collectors returningx+ * 	the value of the requested meta value.
+ *
+ * 	         lvalue                                   rvalue
+ * 	      +-----------+                           +-----------+
+ * 	      | type: INT |                           | type: INT |
+ * 	 def  | id: INDEV |                           | id: VALUE |
+ * 	      | data:     |                           | data: 3   |
+ * 	      +-----------+                           +-----------+
+ * 	            |                                       |
+ * 	            ---> meta_ops[INT][INDEV](...)          |
+ *                            |                            |
+ * 	            -----------                             |
+ * 	            V                                       V
+ * 	      +-----------+                           +-----------+
+ * 	      | type: INT |                           | type: INT |
+ * 	 obj  | id: INDEV |                           | id: VALUE |
+ * 	      | data: 2   |<--data got filled out     | data: 3   |
+ * 	      +-----------+                           +-----------+
+ * 	            |                                         |
+ * 	            --------------> 2  equals 3 <--------------
+ *
+ * 	This is a simplified schema, the complexity varies dependingx+ * 	on the meta type. Obviously, the length of the data must alsox+ * 	be provided for non-numeric types.
+ *
+ * 	Additionaly, type dependant modifiers such as shift operatorsx+ * 	or mask may be applied to extend the functionaliy. As of now,x+ * 	the variable length type supports shifting the byte string tox+ * 	the right, eating up any number of octets and thus supportingx+ * 	wildcard interface name comparisons such as "ppp%" matchingx+ * 	ppp0..9.
+ *
+ * 	NOTE: Certain meta values depend on other subsystems and are
+ * 	      only available if that subsytem is enabled in the kernel.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/string.h>
+#include <linux/skbuff.h>
+#include <linux/random.h>
+#include <linux/tc_ematch/tc_em_meta.h>
+#include <net/dst.h>
+#include <net/route.h>
+#include <net/pkt_cls.h>
+x+struct meta_obj
+{x+	unsigned long		value;x+	unsigned int		len;x+};
+x+struct meta_value
+{x+	struct tcf_meta_val	hdr;x+	unsigned long		val;x+	unsigned int		len;x+};
+x+struct meta_match
+{x+	struct meta_value	lvalue;x+	struct meta_value	rvalue;x+};
+x+static inline int meta_id(struct meta_value *v)x+{x+	return TCF_META_ID(v->hdr.kind);x+}
+x+static inline int meta_type(struct meta_value *v)x+{x+	return TCF_META_TYPE(v->hdr.kind);x+}
+x+#define META_COLLECTOR(FUNC) static void meta_##FUNC(struct sk_buff *skb, \x+	struct tcf_pkt_info *info, struct meta_value *v, \x+	struct meta_obj *dst, int *err)
+x+/**************************************************************************
+ * System status & misc
+ **************************************************************************/
+x+META_COLLECTOR(int_random)x+{x+	get_random_bytes(&dst->value, sizeof(dst->value));x+}
+x+static inline unsigned long fixed_loadavg(int load)
+{x+	int rnd_load = load + (FIXED_1/200);x+	int rnd_frac = ((rnd_load & (FIXED_1-1)) * 100) >> FSHIFT;x+x+	return ((rnd_load >> FSHIFT) * 100) + rnd_frac;x+}
+x+META_COLLECTOR(int_loadavg_0)
+{x+	dst->value = fixed_loadavg(avenrun[0]);x+}
+x+META_COLLECTOR(int_loadavg_1)
+{x+	dst->value = fixed_loadavg(avenrun[1]);x+}
+x+META_COLLECTOR(int_loadavg_2)
+{x+	dst->value = fixed_loadavg(avenrun[2]);x+}
+x+/**************************************************************************
+ * Device names & indices
+ **************************************************************************/
+x+static inline int int_dev(struct net_device *dev, struct meta_obj *dst)
+{x+	if (unlikely(dev == NULL))
+		return -1;x+x+	dst->value = dev->ifindex;x+	return 0;x+}
+x+static inline int var_dev(struct net_device *dev, struct meta_obj *dst)
+{x+	if (unlikely(dev == NULL))
+		return -1;x+x+	dst->value = (unsigned long) dev->name;x+	dst->len = strlen(dev->name);x+	return 0;x+}
+x+META_COLLECTOR(int_dev)
+{x+	*err = int_dev(skb->dev, dst);x+}
+x+META_COLLECTOR(var_dev)
+{x+	*err = var_dev(skb->dev, dst);x+}
+x+META_COLLECTOR(int_indev)
+{x+	*err = int_dev(skb->input_dev, dst);x+}
+x+META_COLLECTOR(var_indev)
+{x+	*err = var_dev(skb->input_dev, dst);x+}
+x+META_COLLECTOR(int_realdev)
+{x+	*err = int_dev(skb->real_dev, dst);x+}
+x+META_COLLECTOR(var_realdev)
+{x+	*err = var_dev(skb->real_dev, dst);x+}
+x+/**************************************************************************
+ * skb attributes
+ **************************************************************************/
+x+META_COLLECTOR(int_priority)
+{x+	dst->value = skb->priority;x+}
+x+META_COLLECTOR(int_protocol)
+{x+	/* Let userspace take care of the byte ordering */x+	dst->value = skb->protocol;
+}
+x+META_COLLECTOR(int_security)
+{x+	dst->value = skb->security;x+}
+x+META_COLLECTOR(int_pkttype)
+{x+	dst->value = skb->pkt_type;x+}
+x+META_COLLECTOR(int_pktlen)x+{x+	dst->value = skb->len;x+}
+x+META_COLLECTOR(int_datalen)x+{x+	dst->value = skb->data_len;x+}
+x+META_COLLECTOR(int_maclen)x+{x+	dst->value = skb->mac_len;x+}
+x+/**************************************************************************
+ * Netfilter
+ **************************************************************************/
+x+#ifdef CONFIG_NETFILTERx+META_COLLECTOR(int_nfmark)x+{x+	dst->value = skb->nfmark;x+}
+#endif
+x+/**************************************************************************
+ * Traffic Control
+ **************************************************************************/
+x+META_COLLECTOR(int_tcindex)x+{x+	dst->value = skb->tc_index;x+}
+x+#ifdef CONFIG_NET_CLS_ACT
+META_COLLECTOR(int_tcverd)x+{x+	dst->value = skb->tc_verd;x+}
+x+META_COLLECTOR(int_tcclassid)x+{x+	dst->value = skb->tc_classid;x+}
+#endif
+x+/**************************************************************************
+ * Routing
+ **************************************************************************/
+x+#ifdef CONFIG_NET_CLS_ROUTEx+META_COLLECTOR(int_rtclassid)x+{x+	if (unlikely(skb->dst == NULL))
+		*err = -1;x+	elsex+		dst->value = skb->dst->tclassid;x+}
+#endif
+x+META_COLLECTOR(int_rtiif)x+{x+	if (unlikely(skb->dst == NULL))
+		*err = -1;x+	elsex+		dst->value = ((struct rtable*) skb->dst)->fl.iif;x+}
+x+/**************************************************************************
+ * Meta value collectors assignment table
+ **************************************************************************/
+x+struct meta_opsx+{x+	void		(*get)(struct sk_buff *, struct tcf_pkt_info *,
+			       struct meta_value *, struct meta_obj *, int *);x+};
+x+/* Meta value operations table listing all meta value collectors and
+ * assigns them to a type and meta id. */x+static struct meta_ops __meta_ops[TCF_META_TYPE_MAX+1][TCF_META_ID_MAX+1] = {x+	[TCF_META_TYPE_VAR] = {x+		[TCF_META_ID_DEV]	= { .get = meta_var_dev },x+		[TCF_META_ID_INDEV]	= { .get = meta_var_indev },x+		[TCF_META_ID_REALDEV]	= { .get = meta_var_realdev }x+	},x+	[TCF_META_TYPE_INT] = {x+		[TCF_META_ID_RANDOM]	= { .get = meta_int_random },x+		[TCF_META_ID_LOADAVG_0]	= { .get = meta_int_loadavg_0 },x+		[TCF_META_ID_LOADAVG_1]	= { .get = meta_int_loadavg_1 },x+		[TCF_META_ID_LOADAVG_2]	= { .get = meta_int_loadavg_2 },x+		[TCF_META_ID_DEV]	= { .get = meta_int_dev },x+		[TCF_META_ID_INDEV]	= { .get = meta_int_indev },x+		[TCF_META_ID_REALDEV]	= { .get = meta_int_realdev },x+		[TCF_META_ID_PRIORITY]	= { .get = meta_int_priority },x+		[TCF_META_ID_PROTOCOL]	= { .get = meta_int_protocol },x+		[TCF_META_ID_SECURITY]	= { .get = meta_int_security },x+		[TCF_META_ID_PKTTYPE]	= { .get = meta_int_pkttype },x+		[TCF_META_ID_PKTLEN]	= { .get = meta_int_pktlen },x+		[TCF_META_ID_DATALEN]	= { .get = meta_int_datalen },x+		[TCF_META_ID_MACLEN]	= { .get = meta_int_maclen },x+#ifdef CONFIG_NETFILTERx+		[TCF_META_ID_NFMARK]	= { .get = meta_int_nfmark },x+#endif
+		[TCF_META_ID_TCINDEX]	= { .get = meta_int_tcindex },x+#ifdef CONFIG_NET_CLS_ACT
+		[TCF_META_ID_TCVERDICT]	= { .get = meta_int_tcverd },x+		[TCF_META_ID_TCCLASSID]	= { .get = meta_int_tcclassid },x+#endif
+#ifdef CONFIG_NET_CLS_ROUTEx+		[TCF_META_ID_RTCLASSID]	= { .get = meta_int_rtclassid },x+#endif
+		[TCF_META_ID_RTIIF]	= { .get = meta_int_rtiif }x+	}x+};
+x+static inline struct meta_ops * meta_ops(struct meta_value *val)x+{x+	return &__meta_ops[meta_type(val)][meta_id(val)];x+}
+x+/**************************************************************************
+ * Type specific operations for TCF_META_TYPE_VAR
+ **************************************************************************/
+x+static int meta_var_compare(struct meta_obj *a, struct meta_obj *b)
+{x+	int r = a->len - b->len;x+x+	if (r == 0)x+		r = memcmp((void *) a->value, (void *) b->value, a->len);x+x+	return r;x+}
+x+static int meta_var_change(struct meta_value *dst, struct rtattr *rta)
+{x+	int len = RTA_PAYLOAD(rta);x+x+	dst->val = (unsigned long) kmalloc(len, GFP_KERNEL);
+	if (dst->val == 0UL)
+		return -ENOMEM;
+	memcpy((void *) dst->val, RTA_DATA(rta), len);x+	dst->len = len;x+	return 0;x+}
+x+static void meta_var_destroy(struct meta_value *v)x+{x+	if (v->val)
+		kfree((void *) v->val);x+}
+x+static void meta_var_apply_extras(struct meta_value *v,
+				  struct meta_obj *dst)
+{x+	int shift = v->hdr.shift;x+x+	if (shift && shift < dst->len)x+		dst->len -= shift;x+}
+x+static int meta_var_dump(struct sk_buff *skb, struct meta_value *v, int tlv)x+{x+	if (v->val && v->len)x+		RTA_PUT(skb, tlv, v->len, (void *) v->val);x+	return 0;x+x+rtattr_failure:
+	return -1;x+}
+x+/**************************************************************************
+ * Type specific operations for TCF_META_TYPE_INT
+ **************************************************************************/
+x+static int meta_int_compare(struct meta_obj *a, struct meta_obj *b)
+{x+	/* Let gcc optimize it, the unlikely is not really based on
+	 * some numbers but jump free code for mismatches seems
+	 * more logical. */x+	if (unlikely(a == b))
+		return 0;x+	else if (a < b)
+		return -1;x+	elsex+		return 1;x+}
+x+static int meta_int_change(struct meta_value *dst, struct rtattr *rta)
+{x+	if (RTA_PAYLOAD(rta) >= sizeof(unsigned long)) {x+		dst->val = *(unsigned long *) RTA_DATA(rta);x+		dst->len = sizeof(unsigned long);
+	} else if (RTA_PAYLOAD(rta) == sizeof(u32)) {x+		dst->val = *(u32 *) RTA_DATA(rta);x+		dst->len = sizeof(u32);
+	} else
+		return -EINVAL;
+x+	return 0;x+}
+x+static void meta_int_apply_extras(struct meta_value *v,
+				  struct meta_obj *dst)
+{x+	if (v->hdr.shift)x+		dst->value >>= v->hdr.shift;x+x+	if (v->val)
+		dst->value &= v->val;x+}
+x+static int meta_int_dump(struct sk_buff *skb, struct meta_value *v, int tlv)x+{x+	if (v->len == sizeof(unsigned long))x+		RTA_PUT(skb, tlv, sizeof(unsigned long), &v->val);x+	else if (v->len == sizeof(u32)) {x+		u32 d = v->val;x+		RTA_PUT(skb, tlv, sizeof(d), &d);
+	}
+x+	return 0;x+x+rtattr_failure:
+	return -1;x+}
+x+/**************************************************************************
+ * Type specific operations table
+ **************************************************************************/
+x+struct meta_type_opsx+{x+	void	(*destroy)(struct meta_value *);x+	int	(*compare)(struct meta_obj *, struct meta_obj *);x+	int	(*change)(struct meta_value *, struct rtattr *);x+	void	(*apply_extras)(struct meta_value *, struct meta_obj *);x+	int	(*dump)(struct sk_buff *, struct meta_value *, int);x+};
+x+static struct meta_type_ops __meta_type_ops[TCF_META_TYPE_MAX+1] = {x+	[TCF_META_TYPE_VAR] = {x+		.destroy = meta_var_destroy,x+		.compare = meta_var_compare,x+		.change = meta_var_change,x+		.apply_extras = meta_var_apply_extras,x+		.dump = meta_var_dumpx+	},x+	[TCF_META_TYPE_INT] = {x+		.compare = meta_int_compare,x+		.change = meta_int_change,x+		.apply_extras = meta_int_apply_extras,x+		.dump = meta_int_dumpx+	}x+};
+x+static inline struct meta_type_ops * meta_type_ops(struct meta_value *v)x+{x+	return &__meta_type_ops[meta_type(v)];x+}
+x+/**************************************************************************
+ * Core
+ **************************************************************************/
+x+static inline int meta_get(struct sk_buff *skb, struct tcf_pkt_info *info, 
+			   struct meta_value *v, struct meta_obj *dst)
+{x+	int err = 0;x+x+	if (meta_id(v) == TCF_META_ID_VALUE) {x+		dst->value = v->val;x+		dst->len = v->len;x+		return 0;x+	}x+x+	meta_ops(v)->get(skb, info, v, dst, &err);x+	if (err < 0)
+		return err;x+x+	if (meta_type_ops(v)->apply_extras)
+	    meta_type_ops(v)->apply_extras(v, dst);x+x+	return 0;x+}
+x+static int em_meta_match(struct sk_buff *skb, struct tcf_ematch *m,
+			 struct tcf_pkt_info *info)
+{x+	int r;x+	struct meta_match *meta = (struct meta_match *) m->data;x+	struct meta_obj l_value, r_value;x+x+	if (meta_get(skb, info, &meta->lvalue, &l_value) < 0 ||
+	    meta_get(skb, info, &meta->rvalue, &r_value) < 0)
+		return 0;x+x+	r = meta_type_ops(&meta->lvalue)->compare(&l_value, &r_value);x+x+	switch (meta->lvalue.hdr.op) {x+		case TCF_EM_OPND_EQ:x+			return !r;
+		case TCF_EM_OPND_LT:x+			return r < 0;
+		case TCF_EM_OPND_GT:x+			return r > 0;
+	}
+x+	return 0;x+}
+x+static inline void meta_delete(struct meta_match *meta)
+{x+	struct meta_type_ops *ops = meta_type_ops(&meta->lvalue);x+x+	if (ops && ops->destroy) {x+		ops->destroy(&meta->lvalue);x+		ops->destroy(&meta->rvalue);x+	}
+x+	kfree(meta);x+}
+x+static inline int meta_change_data(struct meta_value *dst, struct rtattr *rta)
+{x+	if (rta) {x+		if (RTA_PAYLOAD(rta) == 0)
+			return -EINVAL;
+
+		return meta_type_ops(dst)->change(dst, rta);x+	}
+x+	return 0;x+}
+x+static inline int meta_is_supported(struct meta_value *val)x+{x+	return (!meta_id(val) || meta_ops(val)->get);x+}
+x+static int em_meta_change(struct tcf_proto *tp, void *data, int len,
+			  struct tcf_ematch *m)
+{x+	int err = -EINVAL;
+	struct rtattr *tb[TCA_EM_META_MAX];
+	struct tcf_meta_hdr *hdr;x+	struct meta_match *meta = NULL;x+	x+	if (rtattr_parse(tb, TCA_EM_META_MAX, data, len) < 0)
+		goto errout;
+x+	if (tb[TCA_EM_META_HDR-1] == NULL ||
+	    RTA_PAYLOAD(tb[TCA_EM_META_HDR-1]) < sizeof(*hdr))
+		goto errout;
+	hdr = RTA_DATA(tb[TCA_EM_META_HDR-1]);
+x+	if (TCF_META_TYPE(hdr->left.kind) != TCF_META_TYPE(hdr->right.kind) ||
+	    TCF_META_TYPE(hdr->left.kind) > TCF_META_TYPE_MAX ||
+	    TCF_META_ID(hdr->left.kind) > TCF_META_ID_MAX ||
+	    TCF_META_ID(hdr->right.kind) > TCF_META_ID_MAX)
+		goto errout;
+x+	meta = kmalloc(sizeof(*meta), GFP_KERNEL);
+	if (meta == NULL)
+		goto errout;
+	memset(meta, 0, sizeof(*meta));
+x+	memcpy(&meta->lvalue.hdr, &hdr->left, sizeof(hdr->left));
+	memcpy(&meta->rvalue.hdr, &hdr->right, sizeof(hdr->right));
+x+	if (!meta_is_supported(&meta->lvalue) ||
+	    !meta_is_supported(&meta->rvalue)) {x+		err = -EOPNOTSUPP;
+		goto errout;
+	}x+x+	if (meta_change_data(&meta->lvalue, tb[TCA_EM_META_LVALUE-1]) < 0 ||
+	    meta_change_data(&meta->rvalue, tb[TCA_EM_META_RVALUE-1]) < 0)
+		goto errout;
+x+	m->datalen = sizeof(*meta);x+	m->data = (unsigned long) meta;x+x+	err = 0;x+errout:x+	if (err && meta)
+		meta_delete(meta);x+	return err;x+}
+x+static void em_meta_destroy(struct tcf_proto *tp, struct tcf_ematch *m)
+{x+	if (m)
+		meta_delete((struct meta_match *) m->data);x+}
+x+static int em_meta_dump(struct sk_buff *skb, struct tcf_ematch *em)
+{x+	struct meta_match *meta = (struct meta_match *) em->data;x+	struct tcf_meta_hdr hdr;x+	struct meta_type_ops *ops;
+x+	memset(&hdr, 0, sizeof(hdr));
+	memcpy(&hdr.left, &meta->lvalue.hdr, sizeof(hdr.left));
+	memcpy(&hdr.right, &meta->rvalue.hdr, sizeof(hdr.right));
+x+	RTA_PUT(skb, TCA_EM_META_HDR, sizeof(hdr), &hdr);
+x+	ops = meta_type_ops(&meta->lvalue);x+	if (ops->dump(skb, &meta->lvalue, TCA_EM_META_LVALUE) < 0 ||
+	    ops->dump(skb, &meta->rvalue, TCA_EM_META_RVALUE) < 0)
+		goto rtattr_failure;x+x+	return 0;x+x+rtattr_failure:
+	return -1;x+}		
+x+static struct tcf_ematch_ops em_meta_ops = {x+	.kind	  = TCF_EM_META,x+	.change	  = em_meta_change,x+	.match	  = em_meta_match,x+	.destroy  = em_meta_destroy,x+	.dump	  = em_meta_dump,x+	.owner	  = THIS_MODULE,x+	.link	  = LIST_HEAD_INIT(em_meta_ops.link)x+};
+x+static int __init init_em_meta(void)
+{x+	return tcf_em_register(&em_meta_ops);x+}
+x+static void __exit exit_em_meta(void) 
+{x+	tcf_em_unregister(&em_meta_ops);x+}
+x+MODULE_LICENSE("GPL");x+
+module_init(init_em_meta);x+module_exit(exit_em_meta);xdiff -Nru a/net/sched/em_nbyte.c b/net/sched/em_nbyte.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/net/sched/em_nbyte.c	2005-02-15 12:15:35 -08:00
@@ -0,0 +1,82 @@
+/*
+ * net/sched/em_nbyte.c	N-Byte ematch
+ *
+ *		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.
+ *
+ * Authors:	Thomas Graf <tgraf@suug.ch>
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/string.h>
+#include <linux/skbuff.h>
+#include <linux/tc_ematch/tc_em_nbyte.h>
+#include <net/pkt_cls.h>
+x+struct nbyte_data
+{x+	struct tcf_em_nbyte	hdr;x+	char			pattern[0];x+};
+	x+static int em_nbyte_change(struct tcf_proto *tp, void *data, int data_len,
+			   struct tcf_ematch *em)
+{x+	struct tcf_em_nbyte *nbyte = data;x+
+	if (data_len < sizeof(*nbyte) ||
+	    data_len < (sizeof(*nbyte) + nbyte->len))
+		return -EINVAL;
+x+	em->datalen = sizeof(*nbyte) + nbyte->len;x+	em->data = (unsigned long) kmalloc(em->datalen, GFP_KERNEL);
+	if (em->data == 0UL)
+		return -ENOBUFS;
+
+	memcpy((void *) em->data, data, em->datalen);x+x+	return 0;x+}
+x+static int em_nbyte_match(struct sk_buff *skb, struct tcf_ematch *em,
+			  struct tcf_pkt_info *info)
+{x+	struct nbyte_data *nbyte = (struct nbyte_data *) em->data;x+	unsigned char *ptr = tcf_get_base_ptr(skb, nbyte->hdr.layer);x+x+	ptr += nbyte->hdr.off;x+x+	if (!tcf_valid_offset(skb, ptr, nbyte->hdr.len))
+		return 0;x+x+	return !memcmp(ptr + nbyte->hdr.off, nbyte->pattern, nbyte->hdr.len);x+}
+x+static struct tcf_ematch_ops em_nbyte_ops = {x+	.kind	  = TCF_EM_NBYTE,x+	.change	  = em_nbyte_change,x+	.match	  = em_nbyte_match,x+	.owner	  = THIS_MODULE,x+	.link	  = LIST_HEAD_INIT(em_nbyte_ops.link)x+};
+x+static int __init init_em_nbyte(void)
+{x+	return tcf_em_register(&em_nbyte_ops);x+}
+x+static void __exit exit_em_nbyte(void) 
+{x+	tcf_em_unregister(&em_nbyte_ops);x+}
+x+MODULE_LICENSE("GPL");x+
+module_init(init_em_nbyte);x+module_exit(exit_em_nbyte);xdiff -Nru a/net/sched/em_u32.c b/net/sched/em_u32.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/net/sched/em_u32.c	2005-02-15 12:17:19 -08:00
@@ -0,0 +1,63 @@
+/*
+ * net/sched/em_u32.c	U32 Ematch
+ *
+ *		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.
+ *
+ * Authors:	Thomas Graf <tgraf@suug.ch>
+ *		Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
+ *
+ * Based on net/sched/cls_u32.c
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/skbuff.h>
+#include <net/pkt_cls.h>
+x+static int em_u32_match(struct sk_buff *skb, struct tcf_ematch *em,
+			struct tcf_pkt_info *info)
+{x+	struct tc_u32_key *key = (struct tc_u32_key *) em->data;x+	unsigned char *ptr = skb->nh.raw;x+	x+	if (info) {x+		if (info->ptr)
+			ptr = info->ptr;
+		ptr += (info->nexthdr & key->offmask);
+	}x+x+	ptr += key->off;x+x+	if (!tcf_valid_offset(skb, ptr, sizeof(u32)))
+		return 0;x+	x+	return !(((*(u32*) ptr)  ^ key->val) & key->mask);
+}
+x+static struct tcf_ematch_ops em_u32_ops = {x+	.kind	  = TCF_EM_U32,x+	.datalen  = sizeof(struct tc_u32_key),x+	.match	  = em_u32_match,x+	.owner	  = THIS_MODULE,x+	.link	  = LIST_HEAD_INIT(em_u32_ops.link)x+};
+x+static int __init init_em_u32(void)
+{x+	return tcf_em_register(&em_u32_ops);x+}
+x+static void __exit exit_em_u32(void) 
+{x+	tcf_em_unregister(&em_u32_ops);x+}
+x+MODULE_LICENSE("GPL");x+
+module_init(init_em_u32);
+module_exit(exit_em_u32);
diff -Nru a/net/sched/ematch.c b/net/sched/ematch.c
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/net/sched/ematch.c	2005-02-15 12:12:33 -08:00
@@ -0,0 +1,524 @@
+/*
+ * net/sched/ematch.c		Extended Match API
+ *
+ *		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.
+ *
+ * Authors:	Thomas Graf <tgraf@suug.ch>
+ *
+ * ==========================================================================
+ *
+ * An extended match (ematch) is a small classification tool not worth
+ * writing a full classifier for. Ematches can be interconnected to form
+ * a logic expression and get attached to classifiers to extend their
+ * functionatlity.
+ *
+ * The userspace part transforms the logic expressions into an array
+ * consisting of multiple sequences of interconnected ematches separated
+ * by markers. Precedence is implemented by a special ematch kind
+ * referencing a sequence beyond the marker of the current sequence
+ * causing the current position in the sequence to be pushed onto a stack
+ * to allow the current position to be overwritten by the position referenced
+ * in the special ematch. Matching continues in the new sequence until a
+ * marker is reached causing the position to be restored from the stack.
+ *
+ * Example:
+ *          A AND (B1 OR B2) AND C AND D
+ *
+ *              ------->-PUSH-------
+ *    -->--    /         -->--      \   -->--
+ *   /     \  /         /     \      \ /     \
+ * +-------+-------+-------+-------+-------+--------+
+ * | A AND | B AND | C AND | D END | B1 OR | B2 END |
+ * +-------+-------+-------+-------+-------+--------+
+ *                    \                      /
+ *                     --------<-POP---------
+ *
+ * where B is a virtual ematch referencing to sequence starting with B1.
+ * 
+ * ==========================================================================
+ *
+ * How to write an ematch in 60 secondsx+ * ------------------------------------
+ * 
+ *   1) Provide a matcher function:
+ *      static int my_match(struct sk_buff *skb, struct tcf_ematch *m,
+ *                          struct tcf_pkt_info *info)
+ *      {
+ *      	struct mydata *d = (struct mydata *) m->data;x+ *
+ *      	if (...matching goes here...)
+ *      		return 1;x+ *      	else
+ *      		return 0;x+ *      }x+ *
+ *   2) Fill out a struct tcf_ematch_ops:
+ *      static struct tcf_ematch_ops my_ops = {x+ *      	.kind = unique id,x+ *      	.datalen = sizeof(struct mydata),x+ *      	.match = my_match,x+ *      	.owner = THIS_MODULE,x+ *      };x+ *
+ *   3) Register/Unregister your ematch:
+ *      static int __init init_my_ematch(void)
+ *      {
+ *      	return tcf_em_register(&my_ops);x+ *      }x+ *
+ *      static void __exit exit_my_ematch(void)
+ *      {
+ *      	return tcf_em_unregister(&my_ops);x+ *      }x+ *
+ *      module_init(init_my_ematch);x+ *      module_exit(exit_my_ematch);x+ *x+ *   4) By now you should have two more seconds left, barely enough tox+ *      open up a beer to watch the compilation going.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <linux/errno.h>
+#include <linux/interrupt.h>
+#include <linux/rtnetlink.h>
+#include <linux/skbuff.h>
+#include <net/pkt_cls.h>
+#include <config/net/ematch/stack.h>
+x+static LIST_HEAD(ematch_ops);x+static DEFINE_RWLOCK(ematch_mod_lock);
+x+static inline struct tcf_ematch_ops * tcf_em_lookup(u16 kind)
+{x+	struct tcf_ematch_ops *e = NULL;x+x+	read_lock(&ematch_mod_lock);
+	list_for_each_entry(e, &ematch_ops, link) {x+		if (kind == e->kind) {x+			if (!try_module_get(e->owner))
+				e = NULL;x+			read_unlock(&ematch_mod_lock);
+			return e;
+		}
+	}
+	read_unlock(&ematch_mod_lock);
+x+	return NULL;x+}
+x+/**
+ * tcf_em_register - register an extended match
+ * 
+ * @ops: ematch operations lookup table
+ *
+ * This function must be called by ematches to announce their presence.
+ * The given @ops must have kind set to a unique identifier and the
+ * callback match() must be implemented. All other callbacks are optional
+ * and a fallback implementation is used instead.
+ *
+ * Returns -EEXISTS if an ematch of the same kind has already registered.
+ */
+int tcf_em_register(struct tcf_ematch_ops *ops)
+{x+	int err = -EEXIST;x+	struct tcf_ematch_ops *e;x+x+	if (ops->match == NULL)
+		return -EINVAL;
+x+	write_lock(&ematch_mod_lock);
+	list_for_each_entry(e, &ematch_ops, link)x+		if (ops->kind == e->kind)
+			goto errout;
+x+	list_add_tail(&ops->link, &ematch_ops);x+	err = 0;x+errout:x+	write_unlock(&ematch_mod_lock);
+	return err;x+}
+x+/**
+ * tcf_em_unregister - unregster and extended match
+ *
+ * @ops: ematch operations lookup table
+ *
+ * This function must be called by ematches to announce their disappearance
+ * for examples when the module gets unloaded. The @ops parameter must be
+ * the same as the one used for registration.
+ *
+ * Returns -ENOENT if no matching ematch was found.
+ */
+int tcf_em_unregister(struct tcf_ematch_ops *ops)
+{x+	int err = 0;x+	struct tcf_ematch_ops *e;x+x+	write_lock(&ematch_mod_lock);
+	list_for_each_entry(e, &ematch_ops, link) {x+		if (e == ops) {x+			list_del(&e->link);
+			goto out;
+		}
+	}x+x+	err = -ENOENT;
+out:x+	write_unlock(&ematch_mod_lock);
+	return err;x+}
+x+static inline struct tcf_ematch * tcf_em_get_match(struct tcf_ematch_tree *tree,
+						   int index)x+{x+	return &tree->matches[index];x+}
+x+x+static int tcf_em_validate(struct tcf_proto *tp,
+			   struct tcf_ematch_tree_hdr *tree_hdr,
+			   struct tcf_ematch *em, struct rtattr *rta, int idx)
+{x+	int err = -EINVAL;
+	struct tcf_ematch_hdr *em_hdr = RTA_DATA(rta);x+	int data_len = RTA_PAYLOAD(rta) - sizeof(*em_hdr);x+	void *data = (void *) em_hdr + sizeof(*em_hdr);x+x+	if (!TCF_EM_REL_VALID(em_hdr->flags))
+		goto errout;
+x+	if (em_hdr->kind == TCF_EM_CONTAINER) {x+		/* Special ematch called "container", carries an indexx+		 * referencing an external ematch sequence. */x+		u32 ref;x+x+		if (data_len < sizeof(ref))
+			goto errout;
+		ref = *(u32 *) data;x+
+		if (ref >= tree_hdr->nmatches)
+			goto errout;
+x+		/* We do not allow backward jumps to avoid loops and jumpsx+		 * to our own position are of course illegal. */x+		if (ref <= idx)
+			goto errout;
+x+		x+		em->data = ref;x+	} else {x+		/* Note: This lookup will increase the module refcntx+		 * of the ematch module referenced. In case of a failure,x+		 * a destroy function is called by the underlying layerx+		 * which automatically releases the reference again, therefore
+		 * the module MUST not be given back under any circumstances
+		 * here. Be aware, the destroy function assumes that the
+		 * module is held if the ops field is non zero. */x+		em->ops = tcf_em_lookup(em_hdr->kind);x+
+		if (em->ops == NULL) {x+			err = -ENOENT;
+			goto errout;
+		}
+x+		/* ematch module provides expected length of data, so we
+		 * can do a basic sanity check. */x+		if (em->ops->datalen && data_len < em->ops->datalen)
+			goto errout;
+x+		if (em->ops->change) {x+			err = em->ops->change(tp, data, data_len, em);
+			if (err < 0)
+				goto errout;
+		} else if (data_len > 0) {x+			/* ematch module doesn't provide an own change
+			 * procedure and expects us to allocate and copy
+			 * the ematch data.
+			 *
+			 * TCF_EM_SIMPLE may be specified stating that the
+			 * data only consists of a u32 integer and the module
+			 * does not expected a memory reference but rather
+			 * the value carried. */x+			if (em_hdr->flags & TCF_EM_SIMPLE) {x+				if (data_len < sizeof(u32))
+					goto errout;
+				em->data = *(u32 *) data;x+			} else {x+				void *v = kmalloc(data_len, GFP_KERNEL);
+				if (v == NULL) {x+					err = -ENOBUFS;
+					goto errout;
+				}
+				memcpy(v, data, data_len);
+				em->data = (unsigned long) v;x+			}
+		}
+	}x+x+	em->matchid = em_hdr->matchid;x+	em->flags = em_hdr->flags;x+	em->datalen = data_len;x+x+	err = 0;x+errout:x+	return err;x+}
+x+/**
+ * tcf_em_tree_validate - validate ematch config TLV and build ematch tree
+ *
+ * @tp: classifier kind handle
+ * @rta: ematch tree configuration TLV
+ * @tree: destination ematch tree variable to store the resultingx+ *        ematch tree.
+ *
+ * This function validates the given configuration TLV @rta and builds an
+ * ematch tree in @tree. The resulting tree must later be copied into
+ * the private classifier data using tcf_em_tree_change(). You MUST NOT
+ * provide the ematch tree variable of the private classifier data directly,
+ * the changes would not be locked properly.
+ *
+ * Returns a negative error code if the configuration TLV contains errors.
+ */
+int tcf_em_tree_validate(struct tcf_proto *tp, struct rtattr *rta,
+			 struct tcf_ematch_tree *tree)
+{x+	int idx, list_len, matches_len, err = -EINVAL;
+	struct rtattr *tb[TCA_EMATCH_TREE_MAX];
+	struct rtattr *rt_match, *rt_hdr, *rt_list;
+	struct tcf_ematch_tree_hdr *tree_hdr;
+	struct tcf_ematch *em;x+x+	if (rtattr_parse_nested(tb, TCA_EMATCH_TREE_MAX, rta) < 0)
+		goto errout;
+x+	rt_hdr = tb[TCA_EMATCH_TREE_HDR-1];x+	rt_list = tb[TCA_EMATCH_TREE_LIST-1];x+x+	if (rt_hdr == NULL || rt_list == NULL)
+		goto errout;
+x+	if (RTA_PAYLOAD(rt_hdr) < sizeof(*tree_hdr) ||
+	    RTA_PAYLOAD(rt_list) < sizeof(*rt_match))
+		goto errout;
+x+	tree_hdr = RTA_DATA(rt_hdr);x+	memcpy(&tree->hdr, tree_hdr, sizeof(*tree_hdr));
+x+	rt_match = RTA_DATA(rt_list);
+	list_len = RTA_PAYLOAD(rt_list);
+	matches_len = tree_hdr->nmatches * sizeof(*em);
+x+	tree->matches = kmalloc(matches_len, GFP_KERNEL);
+	if (tree->matches == NULL)
+		goto errout;
+	memset(tree->matches, 0, matches_len);
+x+	/* We do not use rtattr_parse_nested here because the maximum
+	 * number of attributes is unknown. This saves us the allocation
+	 * for a tb buffer which would serve no purpose at all.
+	 * 
+	 * The array of rt attributes is parsed in the order as they are
+	 * provided, their type must be incremental from 1 to n. Even
+	 * if it does not serve any real purpose, a failure of stickingx+	 * to this policy will result in parsing failure. */x+	for (idx = 0; RTA_OK(rt_match, list_len); idx++) {x+		err = -EINVAL;
+
+		if (rt_match->rta_type != (idx + 1))
+			goto errout_abort;
+x+		if (idx >= tree_hdr->nmatches)
+			goto errout_abort;
+x+		if (RTA_PAYLOAD(rt_match) < sizeof(struct tcf_ematch_hdr))
+			goto errout_abort;
+x+		em = tcf_em_get_match(tree, idx);
+x+		err = tcf_em_validate(tp, tree_hdr, em, rt_match, idx);
+		if (err < 0)
+			goto errout_abort;
+x+		rt_match = RTA_NEXT(rt_match, list_len);
+	}x+x+	/* Check if the number of matches provided by userspace actuallyx+	 * complies with the array of matches. The number was used forx+	 * the validation of references and a mismatch could lead tox+	 * undefined references during the matching process. */x+	if (idx != tree_hdr->nmatches) {x+		err = -EINVAL;
+		goto errout_abort;
+	}x+x+	err = 0;x+errout:x+	return err;x+x+errout_abort:x+	tcf_em_tree_destroy(tp, tree);
+	return err;x+}
+x+/**
+ * tcf_em_tree_destroy - destroy an ematch tree
+ *
+ * @tp: classifier kind handle
+ * @tree: ematch tree to be deleted
+ *
+ * This functions destroys an ematch tree previously created by
+ * tcf_em_tree_validate()/tcf_em_tree_change(). You must ensure that
+ * the ematch tree is not in use before calling this function.
+ */
+void tcf_em_tree_destroy(struct tcf_proto *tp, struct tcf_ematch_tree *tree)
+{x+	int i;
+x+	if (tree->matches == NULL)
+		return;
+x+	for (i = 0; i < tree->hdr.nmatches; i++) {x+		struct tcf_ematch *em = tcf_em_get_match(tree, i);x+
+		if (em->ops) {x+			if (em->ops->destroy)
+				em->ops->destroy(tp, em);
+			else if (!tcf_em_is_simple(em) && em->data)
+				kfree((void *) em->data);x+			module_put(em->ops->owner);
+		}
+	}
+	x+	tree->hdr.nmatches = 0;x+	kfree(tree->matches);x+}
+x+/**
+ * tcf_em_tree_dump - dump ematch tree into a rtnl message
+ *
+ * @skb: skb holding the rtnl message
+ * @t: ematch tree to be dumped
+ * @tlv: TLV type to be used to encapsulate the tree
+ *
+ * This function dumps a ematch tree into a rtnl message. It is valid tox+ * call this function while the ematch tree is in use.
+ *
+ * Returns -1 if the skb tailroom is insufficient.
+ */
+int tcf_em_tree_dump(struct sk_buff *skb, struct tcf_ematch_tree *tree, int tlv)x+{x+	int i;
+	struct rtattr * top_start = (struct rtattr*) skb->tail;
+	struct rtattr * list_start;
+x+	RTA_PUT(skb, tlv, 0, NULL);x+	RTA_PUT(skb, TCA_EMATCH_TREE_HDR, sizeof(tree->hdr), &tree->hdr);
+x+	list_start = (struct rtattr *) skb->tail;
+	RTA_PUT(skb, TCA_EMATCH_TREE_LIST, 0, NULL);x+x+	for (i = 0; i < tree->hdr.nmatches; i++) {x+		struct rtattr *match_start = (struct rtattr*) skb->tail;
+		struct tcf_ematch *em = tcf_em_get_match(tree, i);x+		struct tcf_ematch_hdr em_hdr = {x+			.kind = em->ops ? em->ops->kind : TCF_EM_CONTAINER,
+			.matchid = em->matchid,
+			.flags = em->flags
+		};x+
+		RTA_PUT(skb, i+1, sizeof(em_hdr), &em_hdr);x+x+		if (em->ops && em->ops->dump) {x+			if (em->ops->dump(skb, em) < 0)
+				goto rtattr_failure;x+		} else if (tcf_em_is_container(em) || tcf_em_is_simple(em)) {x+			u32 u = em->data;x+			RTA_PUT_NOHDR(skb, sizeof(u), &u);x+		} else if (em->datalen > 0)
+			RTA_PUT_NOHDR(skb, em->datalen, (void *) em->data);x+
+		match_start->rta_len = skb->tail - (u8*) match_start;
+	}x+x+	list_start->rta_len = skb->tail - (u8 *) list_start;
+	top_start->rta_len = skb->tail - (u8 *) top_start;
+x+	return 0;x+x+rtattr_failure:
+	return -1;x+}
+x+static inline int tcf_em_match(struct sk_buff *skb, struct tcf_ematch *em,
+			       struct tcf_pkt_info *info)
+{x+	int r = em->ops->match(skb, em, info);
+	return tcf_em_is_inverted(em) ? !r : r;x+}
+x+/* Do not use this function directly, use tcf_em_tree_match instead */
+int __tcf_em_tree_match(struct sk_buff *skb, struct tcf_ematch_tree *tree,
+			struct tcf_pkt_info *info)
+{x+	int stackp = 0, match_idx = 0, res = 0;x+	struct tcf_ematch *cur_match;x+	int stack[CONFIG_NET_EMATCH_STACK];x+x+proceed:x+	while (match_idx < tree->hdr.nmatches) {x+		cur_match = tcf_em_get_match(tree, match_idx);x+x+		if (tcf_em_is_container(cur_match)) {x+			if (unlikely(stackp >= CONFIG_NET_EMATCH_STACK))
+				goto stack_overflow;x+x+			stack[stackp++] = match_idx;x+			match_idx = cur_match->data;x+			goto proceed;
+		}
+x+		res = tcf_em_match(skb, cur_match, info);
+x+		if (tcf_em_early_end(cur_match, res))
+			break;x+
+		match_idx++;
+	}x+x+pop_stack:x+	if (stackp > 0) {x+		match_idx = stack[--stackp];x+		cur_match = tcf_em_get_match(tree, match_idx);x+x+		if (tcf_em_early_end(cur_match, res))
+			goto pop_stack;x+		else {x+			match_idx++;
+			goto proceed;
+		}
+	}
+x+	return res;
+x+stack_overflow:x+	if (net_ratelimit())
+		printk("Local stack overflow, increase NET_EMATCH_STACK\n");
+	return -1;x+}
+x+EXPORT_SYMBOL(tcf_em_register);
+EXPORT_SYMBOL(tcf_em_unregister);
+EXPORT_SYMBOL(tcf_em_tree_validate);
+EXPORT_SYMBOL(tcf_em_tree_destroy);
+EXPORT_SYMBOL(tcf_em_tree_dump);
+EXPORT_SYMBOL(__tcf_em_tree_match);
diff -Nru a/net/sched/sch_atm.c b/net/sched/sch_atm.c
--- a/net/sched/sch_atm.c	2005-01-11 11:24:00 -08:00
+++ b/net/sched/sch_atm.c	2005-01-20 18:17:39 -08:00
@@ -519,7 +519,7 @@
 			memcpy(skb_push(skb,flow->hdr_len),flow->hdr,
 			    flow->hdr_len);
 			atomic_add(skb->truesize,
-				   &flow->vcc->sk->sk_wmem_alloc);
+				   &sk_atm(flow->vcc)->sk_wmem_alloc);
 			/* atm.atm_options are already set by atm_tc_enqueue */
 			(void) flow->vcc->send(flow->vcc,skb);
 		}
diff -Nru a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
--- a/net/sunrpc/auth_gss/svcauth_gss.c	2005-01-04 18:48:25 -08:00
+++ b/net/sunrpc/auth_gss/svcauth_gss.c	2005-03-04 22:32:49 -08:00
@@ -730,6 +730,19 @@
 	struct rsc			*rsci;
 };x x+static intx+svcauth_gss_set_client(struct svc_rqst *rqstp)
+{x+	struct gss_svc_data *svcdata = rqstp->rq_auth_data;x+	struct rsc *rsci = svcdata->rsci;
+	struct rpc_gss_wire_cred *gc = &svcdata->clcred;
+x+	rqstp->rq_client = find_gss_auth_domain(rsci->mechctx, gc->gc_svc);
+	if (rqstp->rq_client == NULL)
+		return SVC_DENIED;
+	return SVC_OK;x+}
+x /*
  * Accept an rpcsec packet.
  * If context establishment, punt to user space
@@ -893,11 +906,6 @@
 		svc_putu32(resv, rpc_success);
 		goto complete;
 	case RPC_GSS_PROC_DATA:
-		*authp = rpc_autherr_badcred;
-		rqstp->rq_client =
-			find_gss_auth_domain(rsci->mechctx, gc->gc_svc);
-		if (rqstp->rq_client == NULL)
-			goto auth_err;x 		*authp = rpcsec_gsserr_ctxproblem;x 		if (gss_write_verf(rqstp, rsci->mechctx, gc->gc_seq))
 			goto auth_err;x@@ -911,8 +919,6 @@
 			if (unwrap_integ_data(&rqstp->rq_arg,
 					gc->gc_seq, rsci->mechctx))
 				goto auth_err;x-			svcdata->rsci = rsci;
-			cache_get(&rsci->h);
 			/* placeholders for length and seq. number: */
 			svcdata->body_start = resv->iov_base + resv->iov_len;x 			svc_putu32(resv, 0);x@@ -923,6 +929,8 @@
 		default:
 			goto auth_err;x 		}
+		svcdata->rsci = rsci;
+		cache_get(&rsci->h);
 		ret = SVC_OK;x 		goto out;
 	}
@@ -1052,6 +1060,7 @@
 	.accept		= svcauth_gss_accept,
 	.release	= svcauth_gss_release,
 	.domain_release = svcauth_gss_domain_release,x+	.set_client	= svcauth_gss_set_client,
 };x x intxdiff -Nru a/net/sunrpc/cache.c b/net/sunrpc/cache.c
--- a/net/sunrpc/cache.c	2005-01-13 20:41:07 -08:00
+++ b/net/sunrpc/cache.c	2005-03-04 22:32:50 -08:00
@@ -321,12 +321,10 @@
 			if (test_and_clear_bit(CACHE_PENDING, &ch->flags))
 				queue_loose(current_detail, ch);
 
-			if (!atomic_read(&ch->refcnt))
+			if (atomic_read(&ch->refcnt) == 1)
 				break;x 		}
 		if (ch) {
-			cache_get(ch);
-			clear_bit(CACHE_HASHED, &ch->flags);x 			*cp = ch->next;x 			ch->next = NULL;x 			current_detail->entries--;xdiff -Nru a/net/sunrpc/sunrpc_syms.c b/net/sunrpc/sunrpc_syms.c
--- a/net/sunrpc/sunrpc_syms.c	2004-12-27 18:29:16 -08:00
+++ b/net/sunrpc/sunrpc_syms.c	2005-03-04 22:32:49 -08:00
@@ -90,6 +90,7 @@
 EXPORT_SYMBOL(svc_auth_register);
 EXPORT_SYMBOL(auth_domain_lookup);
 EXPORT_SYMBOL(svc_authenticate);
+EXPORT_SYMBOL(svc_set_client);
 
 /* RPC statistics */
 #ifdef CONFIG_PROC_FSxdiff -Nru a/net/sunrpc/svc.c b/net/sunrpc/svc.c
--- a/net/sunrpc/svc.c	2004-07-18 21:12:00 -07:00
+++ b/net/sunrpc/svc.c	2005-03-04 22:32:49 -08:00
@@ -264,6 +264,7 @@
 	u32			dir, prog, vers, proc,
 				auth_stat, rpc_stat;x 	int			auth_res;
+	u32			*accept_statp;
 
 	rpc_stat = rpc_success;
 
@@ -299,6 +300,9 @@
 	if (vers != 2)		/* RPC version number */
 		goto err_bad_rpc;x x+	/* Save position in case we later decide to reject: */x+	accept_statp = resv->iov_base + resv->iov_len;x+
 	svc_putu32(resv, xdr_zero);		/* ACCEPT */
 
 	rqstp->rq_prog = prog = ntohl(svc_getu32(argv));	/* program number */
@@ -311,10 +315,12 @@
 	 * We do this before anything else in order to get a decent
 	 * auth verifier.
 	 */
-	if (progp->pg_authenticate != NULL)
-		auth_res = progp->pg_authenticate(rqstp, &auth_stat);
-	else
-		auth_res = svc_authenticate(rqstp, &auth_stat);
+	auth_res = svc_authenticate(rqstp, &auth_stat);
+	/* Also give the program a chance to reject this call: */x+	if (auth_res == SVC_OK) {x+		auth_stat = rpc_autherr_badcred;
+		auth_res = progp->pg_authenticate(rqstp);
+	}x 	switch (auth_res) {x 	case SVC_OK:
 		break;x@@ -437,7 +443,8 @@
 err_bad_auth:
 	dprintk("svc: authentication failed (%d)\n", ntohl(auth_stat));x 	serv->sv_stats->rpcbadauth++;
-	resv->iov_len -= 4;
+	/* Restore write pointer to location of accept status: */x+	xdr_ressize_check(rqstp, accept_statp);x 	svc_putu32(resv, xdr_one);	/* REJECT */
 	svc_putu32(resv, xdr_one);	/* AUTH_ERROR */
 	svc_putu32(resv, auth_stat);	/* status */
diff -Nru a/net/sunrpc/svcauth.c b/net/sunrpc/svcauth.c
--- a/net/sunrpc/svcauth.c	2005-01-13 20:41:07 -08:00
+++ b/net/sunrpc/svcauth.c	2005-03-04 22:32:50 -08:00
@@ -59,6 +59,11 @@
 	return aops->accept(rqstp, authp);x }x x+int svc_set_client(struct svc_rqst *rqstp)
+{x+	return rqstp->rq_authop->set_client(rqstp);
+}
+x /* A request, which was authenticated, has now executed.
  * Time to finalise the the credentials and verifier
  * and release and resources
@@ -173,12 +178,12 @@
 		tmp = container_of(*hp, struct auth_domain, h);x 		if (!auth_domain_match(tmp, item))
 			continue;
-		cache_get(&tmp->h);
-		if (!set)x+		if (!set) {x+			cache_get(&tmp->h);
 			goto out_noset;
+		}
 		*hp = tmp->h.next;x 		tmp->h.next = NULL;x-		clear_bit(CACHE_HASHED, &tmp->h.flags);x 		auth_domain_drop(&tmp->h, &auth_domain_cache);x 		goto out_set;
 	}
@@ -187,9 +192,9 @@
 		goto out_nada;
 	auth_domain_cache.entries++;
 out_set:
-	set_bit(CACHE_HASHED, &item->h.flags);x 	item->h.next = *head;x 	*head = &item->h;x+	cache_get(&item->h);x 	write_unlock(&auth_domain_cache.hash_lock);
 	cache_fresh(&auth_domain_cache, &item->h, item->h.expiry_time);
 	cache_get(&item->h);xdiff -Nru a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
--- a/net/sunrpc/svcauth_unix.c	2005-01-04 18:48:25 -08:00
+++ b/net/sunrpc/svcauth_unix.c	2005-03-04 22:32:49 -08:00
@@ -368,7 +368,6 @@
 	struct kvec	*argv = &rqstp->rq_arg.head[0];x 	struct kvec	*resv = &rqstp->rq_res.head[0];x 	struct svc_cred	*cred = &rqstp->rq_cred;
-	int		rv=0;
 
 	cred->cr_group_info = NULL;x 	rqstp->rq_client = NULL;x@@ -394,19 +393,11 @@
 	if (cred->cr_group_info == NULL)
 		return SVC_DROP; /* kmalloc failure - client must retry */
 
-	rv = svcauth_unix_set_client(rqstp);
-	if (rv == SVC_DENIED)
-		goto badcred;
-
 	/* Put NULL verifier */
 	svc_putu32(resv, RPC_AUTH_NULL);x 	svc_putu32(resv, 0);x 
-	return rv;
-
-badcred:
-	*authp = rpc_autherr_badcred;
-	return SVC_DENIED;
+	return SVC_OK;x }x x static intx@@ -429,6 +420,7 @@
 	.flavour	= RPC_AUTH_NULL,
 	.accept 	= svcauth_null_accept,
 	.release	= svcauth_null_release,x+	.set_client	= svcauth_unix_set_client,
 };x x x@@ -440,7 +432,6 @@
 	struct svc_cred	*cred = &rqstp->rq_cred;
 	u32		slen, i;x 	int		len   = argv->iov_len;x-	int		rv=0;
 
 	cred->cr_group_info = NULL;x 	rqstp->rq_client = NULL;x@@ -472,15 +463,11 @@
 		return SVC_DENIED;
 	}
 
-	rv = svcauth_unix_set_client(rqstp);
-	if (rv == SVC_DENIED)
-		goto badcred;
-
 	/* Put NULL verifier */
 	svc_putu32(resv, RPC_AUTH_NULL);x 	svc_putu32(resv, 0);x 
-	return rv;
+	return SVC_OK;x 
 badcred:
 	*authp = rpc_autherr_badcred;
@@ -510,5 +497,6 @@
 	.accept 	= svcauth_unix_accept,
 	.release	= svcauth_unix_release,
 	.domain_release	= svcauth_unix_domain_release,x+	.set_client	= svcauth_unix_set_client,
 };x xdiff -Nru a/net/x25/af_x25.c b/net/x25/af_x25.c
--- a/net/x25/af_x25.c	2005-01-13 20:41:07 -08:00
+++ b/net/x25/af_x25.c	2005-01-20 14:58:55 -08:00
@@ -444,33 +444,23 @@
 x static struct sock *x25_alloc_socket(void)
 {
-	struct x25_opt *x25;
-	struct sock *sk = sk_alloc(AF_X25, GFP_ATOMIC, 1, NULL);x+	struct x25_sock *x25;x+	struct sock *sk = sk_alloc(AF_X25, GFP_ATOMIC,
+				   sizeof(struct x25_sock), NULL);x 
 	if (!sk)x 		goto out;
 
-	x25 = sk->sk_protinfo = kmalloc(sizeof(*x25), GFP_ATOMIC);
-	if (!x25)
-		goto frees;
-
-	memset(x25, 0, sizeof(*x25));
-
-	x25->sk = sk;
-
 	sock_init_data(NULL, sk);
 	sk_set_owner(sk, THIS_MODULE);x x+	x25 = x25_sk(sk);
 	skb_queue_head_init(&x25->ack_queue);
 	skb_queue_head_init(&x25->fragment_queue);
 	skb_queue_head_init(&x25->interrupt_in_queue);
 	skb_queue_head_init(&x25->interrupt_out_queue);
 out:x 	return sk;
-frees:
-	sk_free(sk);
-	sk = NULL;x-	goto out;
 }x x void x25_init_timers(struct sock *sk);x@@ -478,7 +468,7 @@
 static int x25_create(struct socket *sock, int protocol)
 {
 	struct sock *sk;
-	struct x25_opt *x25;
+	struct x25_sock *x25;x 	int rc = -ESOCKTNOSUPPORT;x 
 	if (sock->type != SOCK_SEQPACKET || protocol)
@@ -519,7 +509,7 @@
 static struct sock *x25_make_new(struct sock *osk)x {
 	struct sock *sk = NULL;x-	struct x25_opt *x25, *ox25;
+	struct x25_sock *x25, *ox25;
 
 	if (osk->sk_type != SOCK_SEQPACKET)x 		goto out;
@@ -557,7 +547,7 @@
 static int x25_release(struct socket *sock)x {
 	struct sock *sk = sock->sk;
-	struct x25_opt *x25;
+	struct x25_sock *x25;x 
 	if (!sk)x 		goto out;
@@ -644,7 +634,7 @@
 		       int addr_len, int flags)x {
 	struct sock *sk = sock->sk;
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	struct sockaddr_x25 *addr = (struct sockaddr_x25 *)uaddr;
 	struct x25_route *rt;x 	int rc = 0;
@@ -802,7 +792,7 @@
 {
 	struct sockaddr_x25 *sx25 = (struct sockaddr_x25 *)uaddr;
 	struct sock *sk = sock->sk;
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	if (peer) {x 		if (sk->sk_state != TCP_ESTABLISHED)
@@ -822,7 +812,7 @@
 {
 	struct sock *sk;
 	struct sock *make;
-	struct x25_opt *makex25;
+	struct x25_sock *makex25;
 	struct x25_address source_addr, dest_addr;
 	struct x25_facilities facilities;
 	struct x25_calluserdata calluserdata;x@@ -935,7 +925,7 @@
 		       struct msghdr *msg, size_t len)x {
 	struct sock *sk = sock->sk;
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	struct sockaddr_x25 *usx25 = (struct sockaddr_x25 *)msg->msg_name;
 	struct sockaddr_x25 sx25;
 	struct sk_buff *skb;x@@ -1112,7 +1102,7 @@
 		       int flags)x {
 	struct sock *sk = sock->sk;
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	struct sockaddr_x25 *sx25 = (struct sockaddr_x25 *)msg->msg_name;
 	size_t copied;x 	int qbit;
@@ -1201,7 +1191,7 @@
 static int x25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)x {
 	struct sock *sk = sock->sk;
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	void __user *argp = (void __user *)arg;x 	int rc;x xdiff -Nru a/net/x25/x25_facilities.c b/net/x25/x25_facilities.c
--- a/net/x25/x25_facilities.c	2004-11-23 23:56:41 -08:00
+++ b/net/x25/x25_facilities.c	2005-01-20 14:58:55 -08:00
@@ -158,7 +158,7 @@
 int x25_negotiate_facilities(struct sk_buff *skb, struct sock *sk,
 			     struct x25_facilities *new)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	struct x25_facilities *ours = &x25->facilities;
 	struct x25_facilities theirs;x 	int len;xdiff -Nru a/net/x25/x25_in.c b/net/x25/x25_in.c
--- a/net/x25/x25_in.c	2004-11-23 23:56:41 -08:00
+++ b/net/x25/x25_in.c	2005-01-20 14:58:55 -08:00
@@ -34,7 +34,7 @@
 static int x25_queue_rx_frame(struct sock *sk, struct sk_buff *skb, int more)x {
 	struct sk_buff *skbo, *skbn = skb;
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	if (more) {x 		x25->fraglen += skb->len;x@@ -89,7 +89,7 @@
 x 	switch (frametype) {x 		case X25_CALL_ACCEPTED: {
-			struct x25_opt *x25 = x25_sk(sk);
+			struct x25_sock *x25 = x25_sk(sk);
 
 			x25_stop_timer(sk);
 			x25->condition = 0x00;
@@ -165,7 +165,7 @@
 {
 	int queued = 0;
 	int modulus;
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	
 	modulus = (x25->neighbour->extended) ? X25_EMODULUS : X25_SMODULUS;
 
@@ -295,7 +295,7 @@
 		case X25_RESET_REQUEST:
 			x25_write_internal(sk, X25_RESET_CONFIRMATION);
 		case X25_RESET_CONFIRMATION: {
-			struct x25_opt *x25 = x25_sk(sk);
+			struct x25_sock *x25 = x25_sk(sk);
 
 			x25_stop_timer(sk);
 			x25->condition = 0x00;
@@ -322,7 +322,7 @@
 /* Higher level upcall for a LAPB frame */
 int x25_process_rx_frame(struct sock *sk, struct sk_buff *skb)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	int queued = 0, frametype, ns, nr, q, d, m;
 
 	if (x25->state == X25_STATE_0)xdiff -Nru a/net/x25/x25_out.c b/net/x25/x25_out.c
--- a/net/x25/x25_out.c	2004-11-23 23:56:41 -08:00
+++ b/net/x25/x25_out.c	2005-01-20 14:58:55 -08:00
@@ -54,7 +54,7 @@
 	unsigned char header[X25_EXT_MIN_LEN];
 	int err, frontlen, len;x 	int sent=0, noblock = X25_SKB_CB(skb)->flags & MSG_DONTWAIT;
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	int header_len = x25->neighbour->extended ? X25_EXT_MIN_LEN :
 						    X25_STD_MIN_LEN;
 	int max_len = x25_pacsize_to_bytes(x25->facilities.pacsize_out);x@@ -116,7 +116,7 @@
  */
 static void x25_send_iframe(struct sock *sk, struct sk_buff *skb)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	if (!skb)
 		return;x@@ -139,7 +139,7 @@
 	struct sk_buff *skb, *skbn;
 	unsigned short start, end;
 	int modulus;
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	if (x25->state != X25_STATE_3)
 		return;x@@ -212,7 +212,7 @@
 x void x25_enquiry_response(struct sock *sk)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	if (x25->condition & X25_COND_OWN_RX_BUSY)x 		x25_write_internal(sk, X25_RNR);xdiff -Nru a/net/x25/x25_proc.c b/net/x25/x25_proc.c
--- a/net/x25/x25_proc.c	2004-12-27 18:32:03 -08:00
+++ b/net/x25/x25_proc.c	2005-01-20 14:58:55 -08:00
@@ -134,7 +134,7 @@
 static int x25_seq_socket_show(struct seq_file *seq, void *v)x {
 	struct sock *s;
-	struct x25_opt *x25;
+	struct x25_sock *x25;x 	struct net_device *dev;
 	const char *devname;
 xdiff -Nru a/net/x25/x25_subr.c b/net/x25/x25_subr.c
--- a/net/x25/x25_subr.c	2004-11-23 23:56:41 -08:00
+++ b/net/x25/x25_subr.c	2005-01-20 14:58:55 -08:00
@@ -33,7 +33,7 @@
  */
 void x25_clear_queues(struct sock *sk)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	skb_queue_purge(&sk->sk_write_queue);
 	skb_queue_purge(&x25->ack_queue);
@@ -51,7 +51,7 @@
 void x25_frames_acked(struct sock *sk, unsigned short nr)x {
 	struct sk_buff *skb;
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	int modulus = x25->neighbour->extended ? X25_EMODULUS : X25_SMODULUS;
 
 	/*x@@ -89,7 +89,7 @@
  */
 int x25_validate_nr(struct sock *sk, unsigned short nr)x {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	unsigned short vc = x25->va;
 	int modulus = x25->neighbour->extended ? X25_EMODULUS : X25_SMODULUS;
 
@@ -108,7 +108,7 @@
  */
 void x25_write_internal(struct sock *sk, int frametype)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	struct sk_buff *skb;
 	unsigned char  *dptr;
 	unsigned char  facilities[X25_MAX_FAC_LEN];
@@ -248,7 +248,7 @@
 int x25_decode(struct sock *sk, struct sk_buff *skb, int *ns, int *nr, int *q,
 	       int *d, int *m)x {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 	unsigned char *frame = skb->data;x 
 	*ns = *nr = *q = *d = *m = 0;
@@ -315,7 +315,7 @@
 void x25_disconnect(struct sock *sk, int reason, unsigned char cause,
 		    unsigned char diagnostic)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	x25_clear_queues(sk);
 	x25_stop_timer(sk);
@@ -342,7 +342,7 @@
  */
 void x25_check_rbuf(struct sock *sk)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	if (atomic_read(&sk->sk_rmem_alloc) < (sk->sk_rcvbuf / 2) &&
 	    (x25->condition & X25_COND_OWN_RX_BUSY)) {xdiff -Nru a/net/x25/x25_timer.c b/net/x25/x25_timer.c
--- a/net/x25/x25_timer.c	2004-11-23 23:56:41 -08:00
+++ b/net/x25/x25_timer.c	2005-01-20 14:58:55 -08:00
@@ -31,7 +31,7 @@
 x void x25_init_timers(struct sock *sk)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	init_timer(&x25->timer);
 	x25->timer.data     = (unsigned long)sk;x@@ -54,28 +54,28 @@
 x void x25_start_t2timer(struct sock *sk)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	mod_timer(&x25->timer, jiffies + x25->t2);
 }x x void x25_start_t21timer(struct sock *sk)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	mod_timer(&x25->timer, jiffies + x25->t21);
 }x x void x25_start_t22timer(struct sock *sk)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	mod_timer(&x25->timer, jiffies + x25->t22);
 }x x void x25_start_t23timer(struct sock *sk)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	mod_timer(&x25->timer, jiffies + x25->t23);
 }x@@ -87,7 +87,7 @@
 x unsigned long x25_display_timer(struct sock *sk)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	if (!timer_pending(&x25->timer))
 		return 0;
@@ -138,7 +138,7 @@
  */
 static inline void x25_do_timer_expiry(struct sock * sk)
 {
-	struct x25_opt *x25 = x25_sk(sk);
+	struct x25_sock *x25 = x25_sk(sk);
 
 	switch (x25->state) {x xdiff -Nru a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
--- a/net/xfrm/xfrm_policy.c	2005-02-15 14:23:11 -08:00
+++ b/net/xfrm/xfrm_policy.c	2005-03-07 09:34:47 -08:00
@@ -1021,22 +1021,15 @@
 x static int stale_bundle(struct dst_entry *dst)
 {
-	struct dst_entry *child = dst;
-
-	while (child) {
-		if (child->obsolete > 0 ||
-		    (child->dev && !netif_running(child->dev)) ||
-		    (child->xfrm && child->xfrm->km.state != XFRM_STATE_VALID)) {
-			return 1;x-		}
-		child = child->child;x-	}
-
-	return 0;x+	return !xfrm_bundle_ok((struct xfrm_dst *)dst, NULL, AF_UNSPEC);x }x x static void xfrm_dst_destroy(struct dst_entry *dst)
 {
+	struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
+x+	dst_release(xdst->route);x+
 	if (!dst->xfrm)
 		return;x 	xfrm_state_put(dst->xfrm);x@@ -1120,6 +1113,94 @@
 	xfrm_prune_bundles(stale_bundle);
 	return 0;x }
+x+void xfrm_init_pmtu(struct dst_entry *dst)
+{x+	do {x+		struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
+		u32 pmtu, route_mtu_cached;
+x+		pmtu = dst_pmtu(dst->child);
+		xdst->child_mtu_cached = pmtu;
+x+		pmtu = xfrm_state_mtu(dst->xfrm, pmtu);x+x+		route_mtu_cached = dst_pmtu(xdst->route);x+		xdst->route_mtu_cached = route_mtu_cached;
+x+		if (pmtu > route_mtu_cached)
+			pmtu = route_mtu_cached;
+x+		dst->metrics[RTAX_MTU-1] = pmtu;
+	} while ((dst = dst->next));x+}
+x+EXPORT_SYMBOL(xfrm_init_pmtu);x+x+/* Check that the bundle accepts the flow and its components are
+ * still valid.
+ */
+
+int xfrm_bundle_ok(struct xfrm_dst *first, struct flowi *fl, int family)
+{x+	struct dst_entry *dst = &first->u.dst;
+	struct xfrm_dst *last;
+	u32 mtu;
+x+	if (!dst_check(dst->path, 0) ||
+	    (dst->dev && !netif_running(dst->dev)))
+		return 0;
+x+	last = NULL;x+x+	do {x+		struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
+x+		if (fl && !xfrm_selector_match(&dst->xfrm->sel, fl, family))
+			return 0;
+		if (dst->xfrm->km.state != XFRM_STATE_VALID)
+			return 0;
+x+		mtu = dst_pmtu(dst->child);
+		if (xdst->child_mtu_cached != mtu) {x+			last = xdst;
+			xdst->child_mtu_cached = mtu;
+		}
+x+		if (!dst_check(xdst->route, 0))
+			return 0;
+		mtu = dst_pmtu(xdst->route);x+		if (xdst->route_mtu_cached != mtu) {x+			last = xdst;
+			xdst->route_mtu_cached = mtu;
+		}
+x+		dst = dst->child;x+	} while (dst->xfrm);x+x+	if (likely(!last))
+		return 1;x+x+	mtu = last->child_mtu_cached;x+	for (;;) {x+		dst = &last->u.dst;
+
+		mtu = xfrm_state_mtu(dst->xfrm, mtu);x+		if (mtu > last->route_mtu_cached)
+			mtu = last->route_mtu_cached;
+		dst->metrics[RTAX_MTU-1] = mtu;
+x+		if (last == first)
+			break;x+
+		last = last->u.next;x+		last->child_mtu_cached = mtu;
+	}
+x+	return 1;x+}
+x+EXPORT_SYMBOL(xfrm_bundle_ok);
 
 /* Well... that's _TASK_. We need to scan through transformation
  * list and figure out what mss tcp should generate in order toxdiff -Nru a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
--- a/net/xfrm/xfrm_state.c	2005-02-08 16:17:47 -08:00
+++ b/net/xfrm/xfrm_state.c	2005-03-06 21:23:53 -08:00
@@ -966,6 +966,36 @@
 }
 EXPORT_SYMBOL(xfrm_state_delete_tunnel);x x+int xfrm_state_mtu(struct xfrm_state *x, int mtu)
+{x+	int res = mtu;
+x+	res -= x->props.header_len;x+x+	for (;;) {x+		int m = res;
+x+		if (m < 68)
+			return 68;
+x+		spin_lock_bh(&x->lock);
+		if (x->km.state == XFRM_STATE_VALID &&
+		    x->type && x->type->get_max_size)
+			m = x->type->get_max_size(x, m);
+		else
+			m += x->props.header_len;x+		spin_unlock_bh(&x->lock);
+x+		if (m <= mtu)
+			break;x+		res -= (m - mtu);x+	}
+x+	return res;
+}
+x+EXPORT_SYMBOL(xfrm_state_mtu);x+ x void __init xfrm_state_init(void)
 {
 	int i;
diff -Nru a/scripts/checkstack.pl b/scripts/checkstack.pl
--- a/scripts/checkstack.pl	2004-10-25 12:47:49 -07:00
+++ b/scripts/checkstack.pl	2005-03-07 20:41:26 -08:00
@@ -9,6 +9,7 @@
 #	Mips port by Juan Quintela <quintela@mandrakesoft.com>
 #	IA64 port via Andreas Dilger
 #	Arm port by Holger Schurig
+#	sh64 port by Paul Mundt
 #	Random bits by Matt Mackall <mpm@selenic.com>
 #	M68k port by Geert Uytterhoeven and Andreas Schwab
 #
@@ -64,6 +65,12 @@
 	} elsif ($arch =~ /^s390x?$/) {x 		#   11160:       a7 fb ff 60             aghi   %r15,-160x 		$re = qr/.*ag?hi.*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})/o;x+	} elsif ($arch =~ /^sh64$/) {x+		#XXX: we only check for the immediate case presently,
+		#     though we will want to check for the movi/sub
+		#     pair for larger users. -- PFM.
+		#a00048e0:       d4fc40f0        addi.l  r15,-240,r15
+		$re = qr/.*addi\.l.*r15,-(([0-9]{2}|[3-9])[0-9]{2}),r15/o;x 	} else {x 		print("wrong or unknown architecture\n");
 		exit
diff -Nru a/scripts/lxdialog/checklist.c b/scripts/lxdialog/checklist.c
--- a/scripts/lxdialog/checklist.c	2004-02-03 21:37:27 -08:00
+++ b/scripts/lxdialog/checklist.c	2005-03-07 20:41:42 -08:00
@@ -269,7 +269,7 @@
 				    status[scroll + max_choice - 1],
 				    max_choice - 1, FALSE);
 			scrollok (list, TRUE);
-			scroll (list);
+			wscrl (list, 1);
 			scrollok (list, FALSE);
 		    }
 		    scroll++;
diff -Nru a/scripts/lxdialog/colors.h b/scripts/lxdialog/colors.h
--- a/scripts/lxdialog/colors.h	2002-02-05 09:40:36 -08:00
+++ b/scripts/lxdialog/colors.h	2005-03-07 20:41:42 -08:00
@@ -152,10 +152,4 @@
  * Global variables
  */
 
-typedef struct {
-    char name[COLOR_NAME_LEN];
-    int value;
-} color_names_st;
-
-extern color_names_st color_names[];
 extern int color_table[][3];
diff -Nru a/scripts/lxdialog/lxdialog.c b/scripts/lxdialog/lxdialog.c
--- a/scripts/lxdialog/lxdialog.c	2002-02-05 09:40:36 -08:00
+++ b/scripts/lxdialog/lxdialog.c	2005-03-07 20:41:42 -08:00
@@ -56,7 +56,7 @@
 int
 main (int argc, const char * const * argv)
 {
-    int offset = 0, clear_screen = 0, end_common_opts = 0, retval;x+    int offset = 0, opt_clear = 0, end_common_opts = 0, retval;x     const char *title = NULL;x 
 #ifdef LOCALEx@@ -89,7 +89,7 @@
                 offset += 2;
             }x 	} else if (!strcmp (argv[offset + 1], "--clear")) {
-	    if (clear_screen) {	/* Hey, "--clear" can't appear twice! */x+	    if (opt_clear) {		/* Hey, "--clear" can't appear twice! */x 		Usage (argv[0]);
 		exit (-1);
 	    } else if (argc == 2) {	/* we only want to clear the screen */
@@ -98,7 +98,7 @@
 		end_dialog ();
 		return 0;x 	    } else {x-		clear_screen = 1;
+		opt_clear = 1;
 		offset++;
 	    }x 	} else			/* no more common options */
@@ -127,7 +127,7 @@
     init_dialog ();
     retval = (*(modePtr->jumper)) (title, argc - offset, argv + offset);x 
-    if (clear_screen) {		/* clear screen before exit */x+    if (opt_clear) {		/* clear screen before exit */x 	attr_clear (stdscr, LINES, COLS, screen_attr);
 	refresh ();
     }
diff -Nru a/scripts/lxdialog/menubox.c b/scripts/lxdialog/menubox.c
--- a/scripts/lxdialog/menubox.c	2005-01-04 13:34:29 -08:00
+++ b/scripts/lxdialog/menubox.c	2005-03-07 20:41:42 -08:00
@@ -327,7 +327,7 @@
                    ) {x 		    /* Scroll menu up */x 		    scrollok (menu, TRUE);
-                    scroll (menu);
+		    wscrl (menu, 1);
                     scrollok (menu, FALSE);
 
                     scroll++;
@@ -357,7 +357,7 @@
                 for (i=0; (i < max_choice); i++) {x                     if (scroll+max_choice < item_no) {x 			scrollok (menu, TRUE);
-			scroll(menu);
+			wscrl (menu, 1);
 			scrollok (menu, FALSE);
                 	scroll++;
                 	print_item (menu, items[(scroll+max_choice-1)*2+1],
diff -Nru a/scripts/show_delta b/scripts/show_delta
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/scripts/show_delta	2005-03-07 20:41:40 -08:00
@@ -0,0 +1,129 @@
+#!/usr/bin/env python
+#
+# show_deltas: Read list of printk messages instrumented with
+# time data, and format with time deltas.
+#
+# Also, you can show the times relative to a fixed point.
+#
+# Copyright 2003 Sony Corporation
+#
+# GPL 2.0 applies.
+
+import sys
+import stringx+
+def usage():x+	print """usage: show_delta [<options>] <filename>x+
+This program parses the output from a set of printk message lines which
+have time data prefixed because the CONFIG_PRINTK_TIME option is set, orx+the kernel command line option "time" is specified. When run with no
+options, the time information is converted to show the time delta between
+each printk line and the next.  When run with the '-b' option, all times
+are relative to a single (base) point in time.
+
+Options:x+  -h            Show this usage help.x+  -b <base>	Specify a base for time references.
+		<base> can be a number or a string.
+		If it is a string, the first message line
+		which matches (at the beginning of thex+		line) is used as the time reference.
+
+ex: $ dmesg >timefilex+    $ show_delta -b NET4 timefilex+
+will show times relative to the line in the kernel outputx+starting with "NET4".
+"""
+	sys.exit(1)x+
+# returns a tuple containing the seconds and text for each message line
+# seconds is returned as a float
+# raise an exception if no timing data was found
+def get_time(line):x+	if line[0]!="[":x+		raise ValueErrorx+x+	# split on closing bracketx+	(time_str, rest) = string.split(line[1:],']',1)x+	time = string.atof(time_str)x+x+	#print "time=", timex+	return (time, rest)x+x+
+# average line looks like:
+# [    0.084282] VFS: Mounted root (romfs filesystem) readonly
+# time data is expressed in seconds.useconds,
+# convert_line adds a delta for each line
+last_time = 0.0
+def convert_line(line, base_time):x+	global last_time
+x+	try:x+		(time, rest) = get_time(line)x+	except:
+		# if any problem parsing time, don't convert anything
+		return line
+x+	if base_time:
+		# show time from base
+		delta = time - base_timex+	else:
+		# just show time from last line
+		delta = time - last_time
+		last_time = time
+x+	return ("[%5.6f < %5.6f >]" % (time, delta)) + restx+
+def main():x+	base_str = ""
+	filein = ""
+	for arg in sys.argv[1:]:x+		if arg=="-b":x+			base_str = sys.argv[sys.argv.index("-b")+1]
+		elif arg=="-h":x+			usage()
+		else:x+			filein = arg
+x+	if not filein:x+		usage()
+x+	try:x+		lines = open(filein,"r").readlines()x+	except:
+		print "Problem opening file: %s" % fileinx+		sys.exit(1)x+
+	if base_str:
+		print 'base= "%s"' % base_str
+		# assume a numeric base.  If that fails, try searching
+		# for a matching line.
+		try:x+			base_time = float(base_str)
+		except:
+			# search for line matching <base> stringx+			found = 0x+			for line in lines:
+				try:x+					(time, rest) = get_time(line)x+				except:
+					continue
+				if string.find(rest, base_str)==1:
+					base_time = time
+					found = 1
+					# stop at first match
+					break
+			if not found:
+				print 'Couldn\'t find line matching base pattern "%s"' % base_str
+				sys.exit(1)x+	else:x+		base_time = 0.0
+
+	for line in lines:
+		print convert_line(line, base_time),
+
+main()
+
diff -Nru a/security/selinux/hooks.c b/security/selinux/hooks.c
--- a/security/selinux/hooks.c	2005-02-04 17:22:47 -08:00
+++ b/security/selinux/hooks.c	2005-03-07 20:41:53 -08:00
@@ -589,7 +589,8 @@
 		spin_unlock(&sbsec->isec_lock);
 		inode = igrab(inode);x 		if (inode) {
-			inode_doinit(inode);x+			if (!IS_PRIVATE (inode))x+				inode_doinit(inode);x 			iput(inode);x 		}
 		spin_lock(&sbsec->isec_lock);
@@ -1854,6 +1855,13 @@
 			rlim = current->signal->rlim + i;x 			initrlim = init_task.signal->rlim+i;x 			rlim->rlim_cur = min(rlim->rlim_max,initrlim->rlim_cur);
+		}
+		if (current->signal->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {x+			/*
+			 * This will cause RLIMIT_CPU calculations
+			 * to be refigured.
+			 */x+			current->it_prof_expires = jiffies_to_cputime(1);x 		}
 	}x xdiff -Nru a/sound/oss/ac97_codec.c b/sound/oss/ac97_codec.c
--- a/sound/oss/ac97_codec.c	2005-01-30 22:33:41 -08:00
+++ b/sound/oss/ac97_codec.c	2005-03-07 20:41:36 -08:00
@@ -71,6 +71,7 @@
 static int wolfson_init04(struct ac97_codec * codec);x static int wolfson_init05(struct ac97_codec * codec);x static int wolfson_init11(struct ac97_codec * codec);x+static int wolfson_init13(struct ac97_codec * codec);x static int tritech_init(struct ac97_codec * codec);x static int tritech_maestro_init(struct ac97_codec * codec);x static int sigmatel_9708_init(struct ac97_codec *codec);x@@ -107,6 +108,7 @@
 static struct ac97_ops wolfson_ops04 = { wolfson_init04, NULL, NULL };
 static struct ac97_ops wolfson_ops05 = { wolfson_init05, NULL, NULL };
 static struct ac97_ops wolfson_ops11 = { wolfson_init11, NULL, NULL };
+static struct ac97_ops wolfson_ops13 = { wolfson_init13, NULL, NULL };
 static struct ac97_ops tritech_ops = { tritech_init, NULL, NULL };
 static struct ac97_ops tritech_m_ops = { tritech_maestro_init, NULL, NULL };
 static struct ac97_ops sigmatel_9708_ops = { sigmatel_9708_init, NULL, NULL };
@@ -171,6 +173,7 @@
 	{0x574D4C05, "Wolfson WM9705/WM9710",   &wolfson_ops05},
 	{0x574D4C09, "Wolfson WM9709",		&null_ops},
 	{0x574D4C12, "Wolfson WM9711/9712",	&wolfson_ops11},
+	{0x574D4C13, "Wolfson WM9713",	&wolfson_ops13, AC97_DEFAULT_POWER_OFF},
 	{0x83847600, "SigmaTel STAC????",	&null_ops},
 	{0x83847604, "SigmaTel STAC9701/3/4/5", &null_ops},
 	{0x83847605, "SigmaTel STAC9704",	&null_ops},
@@ -798,6 +801,9 @@
  *	Currently codec_wait is used to wait for AC97 codec
  *	reset to complete. 
  *
+ *     Some codecs will power down when a register reset is
+ *     performed. We now check for such codecs.
+ *
  *	Returns 1 (true) on success, or 0 (false) on failure.
  */
  
@@ -811,34 +817,17 @@
 	struct list_head *l;
 	struct ac97_driver *d;
 	
-	/* probing AC97 codec, AC97 2.0 says that bit 15 of register 0x00 (reset) should 
-	 * be read zero.
-	 *
-	 * FIXME: is the following comment outdated?  -jgarzik 
-	 * Probing of AC97 in this way is not reliable, it is not even SAFE !!
-	 */
-	codec->codec_write(codec, AC97_RESET, 0L);
-
-	/* also according to spec, we wait for codec-ready state */	
+	/* wait for codec-ready state */
 	if (codec->codec_wait)
 		codec->codec_wait(codec);x 	else
 		udelay(10);x 
-	if ((audio = codec->codec_read(codec, AC97_RESET)) & 0x8000) {
-		printk(KERN_ERR "ac97_codec: %s ac97 codec not present\n",
-		       (codec->id & 0x2) ? (codec->id&1 ? "4th" : "Tertiary") 
-		       : (codec->id&1 ? "Secondary":  "Primary"));
-		return 0;x-	}
-
-	/* probe for Modem Codec */
-	codec->modem = ac97_check_modem(codec);x-	codec->name = NULL;x-	codec->codec_ops = &default_ops;
-
+	/* will the codec power down if register reset ? */
 	id1 = codec->codec_read(codec, AC97_VENDOR_ID1);x 	id2 = codec->codec_read(codec, AC97_VENDOR_ID2);
+	codec->name = NULL;x+	codec->codec_ops = &null_ops;x 	for (i = 0; i < ARRAY_SIZE(ac97_codec_ids); i++) {x 		if (ac97_codec_ids[i].id == ((id1 << 16) | id2)) {x 			codec->type = ac97_codec_ids[i].id;x@@ -850,9 +839,34 @@
 	}
 
 	codec->model = (id1 << 16) | id2;
+	if ((codec->flags & AC97_DEFAULT_POWER_OFF) == 0) {x+		/* reset codec and wait for the ready bit before we continue */x+		codec->codec_write(codec, AC97_RESET, 0L);
+		if (codec->codec_wait)
+			codec->codec_wait(codec);x+		else
+			udelay(10);x+	}
+x+	/* probing AC97 codec, AC97 2.0 says that bit 15 of register 0x00 (reset) shouldx+	 * be read zero.
+	 *x+	 * FIXME: is the following comment outdated?  -jgarzikx+	 * Probing of AC97 in this way is not reliable, it is not even SAFE !!
+	 */x+	if ((audio = codec->codec_read(codec, AC97_RESET)) & 0x8000) {
+		printk(KERN_ERR "ac97_codec: %s ac97 codec not present\n",
+		       (codec->id & 0x2) ? (codec->id&1 ? "4th" : "Tertiary")
+		       : (codec->id&1 ? "Secondary":  "Primary"));
+		return 0;
+	}
 	x+	/* probe for Modem Codec */
+	codec->modem = ac97_check_modem(codec);x+x+	/* enable SPDIF */
 	f = codec->codec_read(codec, AC97_EXTENDED_STATUS);
-	if(f & 4)x+	if((codec->codec_ops == &null_ops) && (f & 4))
 		codec->codec_ops = &default_digital_ops;x 	
 	/* A device which thinks its a modem but isnt */
@@ -921,11 +935,6 @@
 	codec->recmask_io = ac97_recmask_io;
 	codec->mixer_ioctl = ac97_mixer_ioctl;x 
-	/* codec specific initialization for 4-6 channel output or secondary codec stuff */
-	if (codec->codec_ops->init != NULL) {x-		codec->codec_ops->init(codec);x-	}
-
 	/* initialize mixer channel volumes */
 	for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {x 		struct mixer_defaults *md = &mixer_defaults[i];x@@ -936,6 +945,11 @@
 		ac97_set_mixer(codec, md->mixer, md->value);
 	}
 
+	/* codec specific initialization for 4-6 channel output or secondary codec stuff */
+	if (codec->codec_ops->init != NULL) {x+		codec->codec_ops->init(codec);x+	}
+x 	/*x 	 *	Volume is MUTE only on this device. We have to initialise
 	 *	it but its useless beyond that.
@@ -1088,6 +1102,19 @@
 x 	/* set out3 volume */
 	codec->codec_write(codec, AC97_WM9711_OUT3VOL, 0x0808);x+	return 0;
+}
+x+/* WM9713 */
+static int wolfson_init13(struct ac97_codec * codec)
+{x+	codec->codec_write(codec, AC97_RECORD_GAIN, 0x00a0);x+	codec->codec_write(codec, AC97_POWER_CONTROL, 0x0000);x+	codec->codec_write(codec, AC97_EXTENDED_MODEM_ID, 0xDA00);x+	codec->codec_write(codec, AC97_EXTEND_MODEM_STAT, 0x3810);x+	codec->codec_write(codec, AC97_PHONE_VOL, 0x0808);x+	codec->codec_write(codec, AC97_PCBEEP_VOL, 0x0808);x+
 	return 0;x }
 xdiff -Nru a/sound/oss/cmpci.c b/sound/oss/cmpci.c
--- a/sound/oss/cmpci.c	2005-01-07 21:44:33 -08:00
+++ b/sound/oss/cmpci.c	2005-03-07 20:41:44 -08:00
@@ -2925,7 +2925,7 @@
 static struct initvol {
 	int mixch;
 	int vol;
-} initvol[] __initdata = {x+} initvol[] __devinitdata = {x 	{ SOUND_MIXER_WRITE_CD, 0x4f4f },
 	{ SOUND_MIXER_WRITE_LINE, 0x4f4f },
 	{ SOUND_MIXER_WRITE_MIC, 0x4f4f },
diff -Nru a/sound/oss/cs4281/cs4281m.c b/sound/oss/cs4281/cs4281m.c
--- a/sound/oss/cs4281/cs4281m.c	2005-01-07 21:44:37 -08:00
+++ b/sound/oss/cs4281/cs4281m.c	2005-03-07 20:41:44 -08:00
@@ -4096,7 +4096,7 @@
 static struct initvol {
 	int mixch;
 	int vol;
-} initvol[] __initdata = {x+} initvol[] __devinitdata = {x 
 	{
 	SOUND_MIXER_WRITE_VOLUME, 0x4040}, {xdiff -Nru a/sound/oss/dmasound/dac3550a.c b/sound/oss/dmasound/dac3550a.c
--- a/sound/oss/dmasound/dac3550a.c	2004-05-18 09:55:43 -07:00
+++ b/sound/oss/dmasound/dac3550a.c	2005-03-02 10:00:56 -08:00
@@ -40,9 +40,6 @@
 static int daca_detect_client(struct i2c_adapter *adapter, int address);x static int daca_detach_client(struct i2c_client *client);
 
-/* Unique ID allocation */
-static int daca_id;
-
 struct i2c_driver daca_driver = {  
 	.owner			= THIS_MODULE,
 	.name			= "DAC3550A driver  V " DACA_VERSION,
@@ -176,7 +173,6 @@
 	new_client->driver = &daca_driver;
 	new_client->flags = 0;
 	strcpy(new_client->name, client_name);x-	new_client->id = daca_id++; /* racy... */
 
 	if (daca_init_client(new_client))x 		goto bail;xdiff -Nru a/sound/oss/es1370.c b/sound/oss/es1370.c
--- a/sound/oss/es1370.c	2005-01-07 21:44:25 -08:00
+++ b/sound/oss/es1370.c	2005-03-07 20:41:44 -08:00
@@ -2540,7 +2540,7 @@
 static struct initvol {
 	int mixch;
 	int vol;
-} initvol[] __initdata = {x+} initvol[] __devinitdata = {x 	{ SOUND_MIXER_WRITE_VOLUME, 0x4040 },
 	{ SOUND_MIXER_WRITE_PCM, 0x4040 },
 	{ SOUND_MIXER_WRITE_SYNTH, 0x4040 },
diff -Nru a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c
--- a/sound/oss/esssolo1.c	2004-10-20 01:37:07 -07:00
+++ b/sound/oss/esssolo1.c	2005-03-07 20:41:44 -08:00
@@ -2193,7 +2193,7 @@
 static struct initvol {
 	int mixch;
 	int vol;
-} initvol[] __initdata = {x+} initvol[] __devinitdata = {x 	{ SOUND_MIXER_WRITE_VOLUME, 0x4040 },
 	{ SOUND_MIXER_WRITE_PCM, 0x4040 },
 	{ SOUND_MIXER_WRITE_SYNTH, 0x4040 },
diff -Nru a/sound/oss/harmony.c b/sound/oss/harmony.c
--- a/sound/oss/harmony.c	2004-08-24 02:09:07 -07:00
+++ b/sound/oss/harmony.c	2005-03-08 11:16:26 -08:00
@@ -310,7 +310,7 @@
 	case 32000:	newrate = HARMONY_SR_32KHZ;	break; 
 	case 48000:	newrate = HARMONY_SR_48KHZ;	break; 
 	case 9600:	newrate = HARMONY_SR_9KHZ;	break; 
-	case 5125:	newrate = HARMONY_SR_5KHZ;	break; 
+	case 5512:	newrate = HARMONY_SR_5KHZ;	break; 
 	case 11025:	newrate = HARMONY_SR_11KHZ;	break; 
 	case 18900:	newrate = HARMONY_SR_18KHZ;	break; 
 	case 22050:	newrate = HARMONY_SR_22KHZ;	break; 
diff -Nru a/sound/oss/nm256_audio.c b/sound/oss/nm256_audio.c
--- a/sound/oss/nm256_audio.c	2005-01-07 21:44:37 -08:00
+++ b/sound/oss/nm256_audio.c	2005-03-07 20:41:44 -08:00
@@ -1047,7 +1047,7 @@
  * VERSTR is a human-readable version string.
  */
 
-static int __init
+static int __devinit
 nm256_install(struct pci_dev *pcidev, enum nm256rev rev, char *verstr)x {
     struct nm256_info *card;xdiff -Nru a/sound/oss/pss.c b/sound/oss/pss.c
--- a/sound/oss/pss.c	2005-01-20 21:02:09 -08:00
+++ b/sound/oss/pss.c	2005-03-07 20:41:44 -08:00
@@ -1149,7 +1149,7 @@
 static int mss_dma __initdata	= -1;x static int mpu_io __initdata	= -1;x static int mpu_irq __initdata	= -1;x-static int pss_no_sound __initdata = 0;	/* Just configure non-sound components */
+static int pss_no_sound = 0;	/* Just configure non-sound components */
 static int pss_keep_settings  = 1;	/* Keep hardware settings at module exit */x static char *pss_firmware = "/etc/sound/pss_synth";
 xdiff -Nru a/sound/oss/sscape.c b/sound/oss/sscape.c
--- a/sound/oss/sscape.c	2005-01-07 21:44:25 -08:00
+++ b/sound/oss/sscape.c	2005-03-07 20:41:44 -08:00
@@ -1393,7 +1393,7 @@
 static struct address_info cfg_mpu;
 x static int __initdata spea = -1;x-static int __initdata mss = 0;
+static int mss = 0;
 static int __initdata dma = -1;x static int __initdata irq = -1;x static int __initdata io = -1;xdiff -Nru a/sound/parisc/Kconfig b/sound/parisc/Kconfig
--- a/sound/parisc/Kconfig	2004-10-23 01:26:24 -07:00
+++ b/sound/parisc/Kconfig	2005-03-02 03:26:01 -08:00
@@ -1,6 +1,6 @@
 # ALSA PA-RISC drivers
 
-menu "ALSA GSC devices"
+menu "GSC devices"
 	depends on SND!=n && GSC
 x config SND_HARMONYxdiff -Nru a/sound/parisc/harmony.c b/sound/parisc/harmony.c
--- a/sound/parisc/harmony.c	2004-10-23 01:26:42 -07:00
+++ b/sound/parisc/harmony.c	2005-03-08 11:37:40 -08:00
@@ -1,264 +1,88 @@
-/*
- *  Harmony chipset driverx+/* Hewlett-Packard Harmony audio driverx  *
- *	This is a sound driver for ASP's and Lasi's Harmony sound chip
- *	and is unlikely to be used for anything other than on a HP PA-RISC.
+ *   This is a driver for the Harmony audio chipset found
+ *   on the LASI ASIC of various early HP PA-RISC workstations.x  *
- *	Harmony is found in HP 712s, 715/new and many other GSC based machines.
- *	On older 715 machines you'll find the technically identical chip 
- *	called 'Vivace'. Both Harmony and Vivace are supported by this driver.
+ *   Copyright (C) 2004, Kyle McMartin <kyle@{debian.org,parisc-linux.org}>x  *
- *  this ALSA driver is based on OSS driver by:
- *	Copyright 2000 (c) Linuxcare Canada, Alex deVries <alex@linuxcare.com>
- *	Copyright 2000-2002 (c) Helge Deller <deller@gmx.de>
- *	Copyright 2001 (c) Matthieu Delahaye <delahaym@esiee.fr>
+ *     Based on the previous Harmony incarnations by,
+ *       Copyright 2000 (c) Linuxcare Canada, Alex deVries
+ *       Copyright 2000-2003 (c) Helge Deller
+ *       Copyright 2001 (c) Matthieu Delahaye
+ *       Copyright 2001 (c) Jean-Christophe Vaugeois
+ *       Copyright 2003 (c) Laurent Canetx+ *       Copyright 2004 (c) Stuart Bradyx  *
- * TODO:
- * - use generic DMA interface and ioremap()/iounmap()
- * - capture is still untested (and probaby non-working)
- * - spin locks
- * - implement non-consistent DMA pages
- * - implement gain meter
- * - module parameters
- * - correct cleaning sequence
- * - better error checkingx- * - try to have a better quality.
- *   
- */
-
-/*
- * Harmony chipset 'modus operandi'.x- * - This chipset is found in some HP 32bit workstations, like 712, or B132 class.
- * most of controls are done through registers. Register are found at a fixed offset
- * from the hard physical adress, given in struct dev by register_parisc_driver.
+ *   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.x  *
- * Playback and recording use 4kb pages (dma or not, depending on the machine).
+ *   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 thex+ *   GNU General Public License for more details.x  *
- * Most of PCM playback & capture is done through interrupt. When harmony needs
- * a new buffer to put recorded data or read played PCM, it sends an interrupt.
- * Bits 2 and 10 of DSTATUS register are '1' when harmony needs respectively
- * a new page for recording and playing. 
- * Interrupt are disabled/enabled by writing to bit 32 of DSTATUS. 
- * Adresses of next page to be played is put in PNXTADD register, next page
- * to be recorded is put in RNXTADD. There is 2 read-only registers, PCURADD and 
- * RCURADD that provides adress of current page.
- * 
- * Harmony has no way to control full duplex or half duplex mode. It means
- * that we always need to provide adresses of playback and capture data, even
- * when this is not needed. That's why we statically alloc one graveyard
- * buffer (to put recorded data in play-only mode) and a silence buffer.
- * 
- * Bitrate, number of channels and data format are controlled with
- * the CNTL register.
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.x  *
- * Mixer work is done through one register (GAINCTL). Only input gain,
- * output attenuation and general attenuation control is provided. There is
- * also controls for enabling/disabling internal speaker and line
- * input.
+ * Notes:
+ *   - graveyard and silence buffers last for lifetime of
+ *     the driver. playback and capture buffers are allocated
+ *     per _open()/_close().
+ * 
+ * TODO:
  *
- * Buffers used by this driver are all DMA consistent.
  */
 
-#include <linux/delay.h>
-#include <sound/driver.h>
 #include <linux/init.h>
-#include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/time.h>
 #include <linux/wait.h>
-#include <linux/moduleparam.h>
+#include <linux/delay.h>
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/spinlock.h>
+#include <linux/dma-mapping.h>x+
+#include <sound/driver.h>
 #include <sound/core.h>
-#include <sound/control.h>
 #include <sound/pcm.h>
+#include <sound/control.h>
 #include <sound/rawmidi.h>
 #include <sound/initval.h>
 #include <sound/info.h>
-#include <asm/hardware.h>x+
 #include <asm/io.h>
+#include <asm/hardware.h>x #include <asm/parisc-device.h>x 
-MODULE_AUTHOR("Laurent Canet <canetl@esiee.fr>");
-MODULE_DESCRIPTION("ALSA Harmony sound driver");
-MODULE_LICENSE("GPL");
-MODULE_SUPPORTED_DEVICE("{{ALSA,Harmony soundcard}}");
-
-#undef DEBUG
-#ifdef DEBUG
-# define DPRINTK printk 
-#else
-# define DPRINTK(x,...)
-#endif
-
-#define PFX	"harmony: "
-
-#define MAX_PCM_DEVICES		1
-#define MAX_PCM_SUBSTREAMS	4
-#define MAX_MIDI_DEVICES	0
-
-#define HARMONY_BUF_SIZE	4096
-#define MAX_BUFS		10
-#define MAX_BUFFER_SIZE		(MAX_BUFS * HARMONY_BUF_SIZE)
-
-/* number of silence & graveyard buffers */
-#define GRAVEYARD_BUFS		3
-#define SILENCE_BUFS		3
-
-#define HARMONY_CNTL_C		0x80000000
-
-#define HARMONY_DSTATUS_PN	0x00000200
-#define HARMONY_DSTATUS_RN	0x00000002
-#define HARMONY_DSTATUS_IE	0x80000000
-
-#define HARMONY_DF_16BIT_LINEAR	0x00000000
-#define HARMONY_DF_8BIT_ULAW	0x00000001
-#define HARMONY_DF_8BIT_ALAW	0x00000002
-
-#define HARMONY_SS_MONO		0x00000000
-#define HARMONY_SS_STEREO	0x00000001
-
-/*
- * Channels Mask in mixer register
- * try some "reasonable" default gain values
- */
-
-#define HARMONY_GAIN_TOTAL_SILENCE 0x00F00FFF
-
-/* the following should be enough (mixer is 
- * very sensible on harmony)
- */
-#define HARMONY_GAIN_DEFAULT       0x0F2FF082
-
-
-/* useless since only one card is supported ATM */
-static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
-static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
-static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;
-
-module_param_array(index, int, NULL, 0444);
-MODULE_PARM_DESC(index, "Index value for Harmony device.");
-module_param_array(id, charp, NULL, 0444);
-MODULE_PARM_DESC(id, "ID string for Harmony device.");
-module_param_array(enable, bool, NULL, 0444);
-MODULE_PARM_DESC(enable, "Enable Harmony device.");
-
-/* Register offset (from base hpa) */
-#define REG_ID		0x00
-#define REG_RESET	0x04
-#define REG_CNTL	0x08
-#define REG_GAINCTL	0x0C
-#define REG_PNXTADD	0x10
-#define REG_PCURADD	0x14
-#define REG_RNXTADD	0x18
-#define REG_RCURADD	0x1C
-#define REG_DSTATUS	0x20
-#define REG_OV		0x24
-#define REG_PIO		0x28
-#define REG_DIAG	0x3C
-
-/*
- * main harmony structure
- */
+#include "harmony.h"
 
-typedef struct snd_card_harmony {
-
-	/* spinlocks (To be done) */
-	spinlock_t mixer_lock;
-	spinlock_t control_lock;
-
-	/* parameters */	
-	int irq;
-	unsigned long hpa;
-	int id;
-	int rev;
-	
-	u32 current_gain;
-	int data_format;		/* HARMONY_DF_xx_BIT_xxx */
-	int sample_rate;		/* HARMONY_SR_xx_KHZ */
-	int stereo_select;	/* HARMONY_SS_MONO or HARMONY_SS_STEREO */
-	int format_initialized;
-	
-	unsigned long ply_buffer;
-	int ply_buf;
-	int ply_count;
-	int ply_size;
-	int ply_stopped;
-	int ply_total;x-	
-	unsigned long cap_buffer;
-	int cap_buf;
-	int cap_count;
-	int cap_size;
-	int cap_stopped;
-	int cap_total;x-
-	struct parisc_device *pa_dev;x-
-	struct snd_dma_device dma_dev;
-
-	/* the graveyard buffer is used as recording buffer when playback, 
-	 * because harmony always want a buffer to put recorded data */
-	struct snd_dma_buffer graveyard_dma;
-	int graveyard_count;
-	
-	/* same thing for silence buffer */
-	struct snd_dma_buffer silence_dma;
-	int silence_count;
-
-	/* alsa stuff */
-	snd_card_t *card;x-	snd_pcm_t *pcm;x-	snd_pcm_substream_t *playback_substream;x-	snd_pcm_substream_t *capture_substream;x-	snd_info_entry_t *proc_entry;
-} snd_card_harmony_t;
-
-static snd_card_t *snd_harmony_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
-
-/* wait to be out of control mode */
-static inline void snd_harmony_wait_cntl(snd_card_harmony_t *harmony)
-{
-	int timeout = 5000;
+static struct parisc_device_id snd_harmony_devtable[] = {x+	/* bushmaster / flounder */
+	{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007A }, 
+	/* 712 / 715 */
+	{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007B }, 
+	/* pace */
+	{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007E }, 
+	/* outfield / coral II */
+	{ HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007F },
+	{ 0, }
+};x 
-	while ( (gsc_readl(harmony->hpa+REG_CNTL) & HARMONY_CNTL_C) && --timeout)
-	{x-		/* Wait */ ;	x-	}
-	if (timeout == 0) DPRINTK(KERN_DEBUG PFX "Error: wait cntl timeouted\n");
-}
+MODULE_DEVICE_TABLE(parisc, snd_harmony_devtable);x x+#define NAME "harmony"x+#define PFX  NAME ": "
 
-/*
- * sample rate routines 
- */
-static unsigned int snd_card_harmony_rates[] = {x-	5125, 6615, 8000, 9600,
+static unsigned int snd_harmony_rates[] = {x+	5512, 6615, 8000, 9600,
 	11025, 16000, 18900, 22050,
 	27428, 32000, 33075, 37800,
 	44100, 48000
 };x 
-static snd_pcm_hw_constraint_list_t hw_constraint_rates = {x-	.count = ARRAY_SIZE(snd_card_harmony_rates),
-	.list = snd_card_harmony_rates,
-	.mask = 0,
-};
-
-#define HARMONY_SR_8KHZ		0x08
-#define HARMONY_SR_16KHZ	0x09
-#define HARMONY_SR_27KHZ	0x0A
-#define HARMONY_SR_32KHZ	0x0B
-#define HARMONY_SR_48KHZ	0x0E
-#define HARMONY_SR_9KHZ		0x0F
-#define HARMONY_SR_5KHZ		0x10
-#define HARMONY_SR_11KHZ	0x11
-#define HARMONY_SR_18KHZ	0x12
-#define HARMONY_SR_22KHZ	0x13
-#define HARMONY_SR_37KHZ	0x14
-#define HARMONY_SR_44KHZ	0x15
-#define HARMONY_SR_33KHZ	0x16
-#define HARMONY_SR_6KHZ		0x17
-
-/* bits corresponding to the entries of snd_card_harmony_rates */x static unsigned int rate_bits[14] = {x 	HARMONY_SR_5KHZ, HARMONY_SR_6KHZ, HARMONY_SR_8KHZ,x 	HARMONY_SR_9KHZ, HARMONY_SR_11KHZ, HARMONY_SR_16KHZ,
@@ -267,642 +91,627 @@
 	HARMONY_SR_44KHZ, HARMONY_SR_48KHZ
 };x 
-/* snd_card_harmony_rate_bits
- * @rate:	index of current data rate in list
- * returns: harmony hex code for registers
- */
-static unsigned int snd_card_harmony_rate_bits(int rate)
+static snd_pcm_hw_constraint_list_t hw_constraint_rates = {x+	.count = ARRAY_SIZE(snd_harmony_rates),
+	.list = snd_harmony_rates,
+	.mask = 0,
+};x+
+inline unsigned long
+harmony_read(harmony_t *h, unsigned r)
 {
-	unsigned int idx;
-	
-	for (idx = 0; idx < ARRAY_SIZE(snd_card_harmony_rates); idx++)
-		if (snd_card_harmony_rates[idx] == rate)
-			return rate_bits[idx];
-	return HARMONY_SR_44KHZ; /* fallback */
+	return __raw_readl(h->iobase + r);x }x x-/*
- * update controls (data format, sample rate, number of channels)
- * according to value supplied in data structure
- */
-void snd_harmony_update_control(snd_card_harmony_t *harmony) 
+inline void
+harmony_write(harmony_t *h, unsigned r, unsigned long v)
 {
-	u32 default_cntl;
-	
-	/* Set CNTL */
-	default_cntl = (HARMONY_CNTL_C |  	/* The C bit */
-		(harmony->data_format << 6) |	/* Set the data format */
-		(harmony->stereo_select << 5) |	/* Stereo select */
-		(harmony->sample_rate));		/* Set sample rate */
-	
-	/* initialize CNTL */
- 	snd_harmony_wait_cntl(harmony);
-	
-	gsc_writel(default_cntl, harmony->hpa+REG_CNTL);
-	
+	__raw_writel(v, h->iobase + r);x }x x-/*
- * interruption controls routines
- */
+static void
+harmony_wait_for_control(harmony_t *h)
+{x+	while (harmony_read(h, HARMONY_CNTL) & HARMONY_CNTL_C) ;
+}
 
-static void snd_harmony_disable_interrupts(snd_card_harmony_t *chip) 
+inline void
+harmony_reset(harmony_t *h)
 {
- 	snd_harmony_wait_cntl(chip);
-	gsc_writel(0, chip->hpa+REG_DSTATUS); 
+	harmony_write(h, HARMONY_RESET, 1);x+	mdelay(50);x+	harmony_write(h, HARMONY_RESET, 0);x }x x-static void snd_harmony_enable_interrupts(snd_card_harmony_t *chip) 
+static void
+harmony_disable_interrupts(harmony_t *h)
 {
- 	snd_harmony_wait_cntl(chip);
-	gsc_writel(HARMONY_DSTATUS_IE, chip->hpa+REG_DSTATUS); 
+	u32 dstatus;x+	harmony_wait_for_control(h);x+	dstatus = harmony_read(h, HARMONY_DSTATUS);x+	dstatus &= ~HARMONY_DSTATUS_IE;x+	harmony_write(h, HARMONY_DSTATUS, dstatus);x }x x-/*
- * interruption routine:
- * The interrupt routine must provide adresse of next physical pages 
- * used by harmony
- */
-static int snd_card_harmony_interrupt(int irq, void *dev, struct pt_regs *regs)
+static void
+harmony_enable_interrupts(harmony_t *h)
 {
-	snd_card_harmony_t *harmony = (snd_card_harmony_t *)dev;
-	u32 dstatus = 0;
-	unsigned long hpa = harmony->hpa;
-	
-	/* Turn off interrupts */
-	snd_harmony_disable_interrupts(harmony);
-	
-	/* wait for control to free */
- 	snd_harmony_wait_cntl(harmony);
-	
-	/* Read dstatus and pcuradd (the current address) */
-	dstatus = gsc_readl(hpa+REG_DSTATUS);
-	
-	/* Check if this is a request to get the next play buffer */
+	u32 dstatus;x+	harmony_wait_for_control(h);x+	dstatus = harmony_read(h, HARMONY_DSTATUS);x+	dstatus |= HARMONY_DSTATUS_IE;x+	harmony_write(h, HARMONY_DSTATUS, dstatus);x+}
+x+static void
+harmony_mute(harmony_t *h)
+{x+	unsigned long flags;x+x+	spin_lock_irqsave(&h->mixer_lock, flags);x+	harmony_wait_for_control(h);x+	harmony_write(h, HARMONY_GAINCTL, HARMONY_GAIN_SILENCE);x+	spin_unlock_irqrestore(&h->mixer_lock, flags);x+}
+x+static void
+harmony_unmute(harmony_t *h)
+{x+	unsigned long flags;x+x+	spin_lock_irqsave(&h->mixer_lock, flags);x+	harmony_wait_for_control(h);x+	harmony_write(h, HARMONY_GAINCTL, h->st.gain);x+	spin_unlock_irqrestore(&h->mixer_lock, flags);x+}
+x+static void
+harmony_set_control(harmony_t *h)
+{x+	u32 ctrl;x+	unsigned long flags;x+x+	spin_lock_irqsave(&h->lock, flags);x+
+	ctrl = (HARMONY_CNTL_C      |x+		(h->st.format << 6) |x+		(h->st.stereo << 5) |x+		(h->st.rate));x+
+	harmony_wait_for_control(h);x+	harmony_write(h, HARMONY_CNTL, ctrl);x+x+	spin_unlock_irqrestore(&h->lock, flags);x+}
+x+static irqreturn_t
+snd_harmony_interrupt(int irq, void *dev, struct pt_regs *regs)
+{
+	u32 dstatus;x+	harmony_t *h = dev;
+x+	spin_lock(&h->lock);x+	harmony_disable_interrupts(h);x+	harmony_wait_for_control(h);x+	dstatus = harmony_read(h, HARMONY_DSTATUS);x+	spin_unlock(&h->lock);x+
 	if (dstatus & HARMONY_DSTATUS_PN) {x-		if (harmony->playback_substream) {
-			harmony->ply_buf += harmony->ply_count;
-			harmony->ply_buf %= harmony->ply_size;
-		
-			gsc_writel(harmony->ply_buffer + harmony->ply_buf,
-					hpa+REG_PNXTADD);
-		
-			snd_pcm_period_elapsed(harmony->playback_substream);
-			harmony->ply_total++;
+		if (h->psubs) {x+			spin_lock(&h->lock);x+			h->pbuf.buf += h->pbuf.count; /* PAGE_SIZE */x+			h->pbuf.buf %= h->pbuf.size; /* MAX_BUFS*PAGE_SIZE */x+x+			harmony_write(h, HARMONY_PNXTADD, 
+				      h->pbuf.addr + h->pbuf.buf);x+			h->stats.play_intr++;
+			spin_unlock(&h->lock);x+                        snd_pcm_period_elapsed(h->psubs);x 		} else {x-			gsc_writel(harmony->silence_dma.addr + 
-				   (HARMONY_BUF_SIZE*harmony->silence_count),
-				   hpa+REG_PNXTADD);
-			harmony->silence_count++;
-			harmony->silence_count %= SILENCE_BUFS;x+			spin_lock(&h->lock);x+			harmony_write(h, HARMONY_PNXTADD, h->sdma.addr);x+			h->stats.silence_intr++;
+			spin_unlock(&h->lock);x 		}
 	}x-	
-	/* Check if we're being asked to fill in a recording buffer */x+x 	if (dstatus & HARMONY_DSTATUS_RN) {x-		if (harmony->capture_substream) {
-			harmony->cap_buf += harmony->cap_count;
-			harmony->cap_buf %= harmony->cap_size;
-		
-			gsc_writel(harmony->cap_buffer + harmony->cap_buf,
-					hpa+REG_RNXTADD);
-		
-			snd_pcm_period_elapsed(harmony->capture_substream);
-			harmony->cap_total++;
+		if (h->csubs) {x+			spin_lock(&h->lock);x+			h->cbuf.buf += h->cbuf.count;x+			h->cbuf.buf %= h->cbuf.size;
+x+			harmony_write(h, HARMONY_RNXTADD,
+				      h->cbuf.addr + h->cbuf.buf);x+			h->stats.rec_intr++;
+			spin_unlock(&h->lock);x+                        snd_pcm_period_elapsed(h->csubs);x 		} else {x-			/* graveyard buffer */
-			gsc_writel(harmony->graveyard_dma.addr +
-				   (HARMONY_BUF_SIZE*harmony->graveyard_count),
-				   hpa+REG_RNXTADD);
-			harmony->graveyard_count++;
-			harmony->graveyard_count %= GRAVEYARD_BUFS;x+			spin_lock(&h->lock);x+			harmony_write(h, HARMONY_RNXTADD, h->gdma.addr);x+			h->stats.graveyard_intr++;
+			spin_unlock(&h->lock);x 		}
 	}x-	snd_harmony_enable_interrupts(harmony);
+x+	spin_lock(&h->lock);x+	harmony_enable_interrupts(h);x+	spin_unlock(&h->lock);x 
 	return IRQ_HANDLED;x }x x-/* 
- * proc entry
- * this proc file will give some debugging info
- */
-
-static void snd_harmony_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
+static unsigned int 
+snd_harmony_rate_bits(int rate)
 {
-	snd_card_harmony_t *harmony = (snd_card_harmony_t *)entry->private_data;x-
-	snd_iprintf(buffer, "LASI Harmony driver\nLaurent Canet <canetl@esiee.fr>\n\n");
-	snd_iprintf(buffer, "IRQ %d, hpa %lx, id %d rev %d\n",
-			harmony->irq, harmony->hpa,
-			harmony->id, harmony->rev);
-	snd_iprintf(buffer, "Current gain %lx\n", (unsigned long) harmony->current_gain);
-	snd_iprintf(buffer, "\tsample rate=%d\n", harmony->sample_rate);
-	snd_iprintf(buffer, "\tstereo select=%d\n", harmony->stereo_select);
-	snd_iprintf(buffer, "\tbitperchan=%d\n\n", harmony->data_format);
-	
-	snd_iprintf(buffer, "Play status:\n");
-	snd_iprintf(buffer, "\tstopped %d\n", harmony->ply_stopped);
-	snd_iprintf(buffer, "\tbuffer %lx, count %d\n", harmony->ply_buffer, harmony->ply_count);
-	snd_iprintf(buffer, "\tbuf %d size %d\n\n", harmony->ply_buf, harmony->ply_size);
-	
-	snd_iprintf(buffer, "Capture status:\n");
-	snd_iprintf(buffer, "\tstopped %d\n", harmony->cap_stopped);
-	snd_iprintf(buffer, "\tbuffer %lx, count %d\n", harmony->cap_buffer, harmony->cap_count);
-	snd_iprintf(buffer, "\tbuf %d, size %d\n\n", harmony->cap_buf, harmony->cap_size);x-
-	snd_iprintf(buffer, "Funny stats: total played=%d, recorded=%d\n\n", harmony->ply_total, harmony->cap_total);
-		
-	snd_iprintf(buffer, "Register:\n");
-	snd_iprintf(buffer, "\tgainctl: %lx\n", (unsigned long) gsc_readl(harmony->hpa+REG_GAINCTL));
-	snd_iprintf(buffer, "\tcntl: %lx\n", (unsigned long) gsc_readl(harmony->hpa+REG_CNTL));
-	snd_iprintf(buffer, "\tid: %lx\n", (unsigned long) gsc_readl(harmony->hpa+REG_ID));
-	snd_iprintf(buffer, "\tpcuradd: %lx\n", (unsigned long) gsc_readl(harmony->hpa+REG_PCURADD));
-	snd_iprintf(buffer, "\trcuradd: %lx\n", (unsigned long) gsc_readl(harmony->hpa+REG_RCURADD));
-	snd_iprintf(buffer, "\tpnxtadd: %lx\n", (unsigned long) gsc_readl(harmony->hpa+REG_PNXTADD));
-	snd_iprintf(buffer, "\trnxtadd: %lx\n", (unsigned long) gsc_readl(harmony->hpa+REG_RNXTADD));
-	snd_iprintf(buffer, "\tdstatus: %lx\n", (unsigned long) gsc_readl(harmony->hpa+REG_DSTATUS));
-	snd_iprintf(buffer, "\tov: %lx\n\n", (unsigned long) gsc_readl(harmony->hpa+REG_OV));
+	unsigned int i;
 	
-}
+	for (i = 0; i < ARRAY_SIZE(snd_harmony_rates); i++)
+		if (snd_harmony_rates[i] == rate)
+			return rate_bits[i];
+x+	return HARMONY_SR_44KHZ;x+}
+x+static snd_pcm_hardware_t snd_harmony_playback =
+{
+	.info =	(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 
+		 SNDRV_PCM_INFO_JOINT_DUPLEX | SNDRV_PCM_INFO_MMAP_VALID |x+		 SNDRV_PCM_INFO_BLOCK_TRANSFER),
+	.formats = (SNDRV_PCM_FMTBIT_S16_BE | SNDRV_PCM_FMTBIT_MU_LAW |x+		    SNDRV_PCM_FMTBIT_A_LAW),
+	.rates = (SNDRV_PCM_RATE_5512 | SNDRV_PCM_RATE_8000_48000 |x+		  SNDRV_PCM_RATE_KNOT),
+	.rate_min = 5512,
+	.rate_max = 48000,
+	.channels_min =	1,
+	.channels_max =	2,
+	.buffer_bytes_max = MAX_BUF_SIZE,
+	.period_bytes_min = BUF_SIZE,
+	.period_bytes_max = BUF_SIZE,
+	.periods_min = 1,
+	.periods_max = MAX_BUFS,
+	.fifo_size = 0,
+};x x-static void __devinit snd_harmony_proc_init(snd_card_harmony_t *harmony)
+static snd_pcm_hardware_t snd_harmony_capture =
 {
-	snd_info_entry_t *entry;
-	
-	if (! snd_card_proc_new(harmony->card, "harmony", &entry))
-		snd_info_set_text_ops(entry, harmony, 2048, snd_harmony_proc_read);
-}
-x-/* 
- * PCM Stuff
- */
+        .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |x+                 SNDRV_PCM_INFO_JOINT_DUPLEX | SNDRV_PCM_INFO_MMAP_VALID |x+                 SNDRV_PCM_INFO_BLOCK_TRANSFER),
+        .formats = (SNDRV_PCM_FMTBIT_S16_BE | SNDRV_PCM_FMTBIT_MU_LAW |x+                    SNDRV_PCM_FMTBIT_A_LAW),
+        .rates = (SNDRV_PCM_RATE_5512 | SNDRV_PCM_RATE_8000_48000 |x+		  SNDRV_PCM_RATE_KNOT),
+        .rate_min = 5512,
+        .rate_max = 48000,
+        .channels_min = 1,
+        .channels_max = 2,
+        .buffer_bytes_max = MAX_BUF_SIZE,
+        .period_bytes_min = BUF_SIZE,
+        .period_bytes_max = BUF_SIZE,
+        .periods_min = 1,
+        .periods_max = MAX_BUFS,
+        .fifo_size = 0,
+};x x-static int snd_card_harmony_playback_ioctl(snd_pcm_substream_t * substream,
-				         unsigned int cmd,
-				         void *arg)
+static int
+snd_harmony_playback_trigger(snd_pcm_substream_t *ss, int cmd)
 {
-	return snd_pcm_lib_ioctl(substream, cmd, arg);
-}
+	harmony_t *h = snd_pcm_substream_chip(ss);x+	unsigned long flags;x x-static int snd_card_harmony_capture_ioctl(snd_pcm_substream_t * substream,
-					unsigned int cmd,
-					void *arg)
-{
-	return snd_pcm_lib_ioctl(substream, cmd, arg);
-}
+	if (h->st.capturing)
+		return -EBUSY;x x-static int snd_card_harmony_playback_trigger(snd_pcm_substream_t * substream,
-					   int cmd)
-{
-	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
-	x+	spin_lock_irqsave(&h->lock, flags);x 	switch (cmd) {x-		case SNDRV_PCM_TRIGGER_STOP:
-			if (harmony->ply_stopped) 
-				return -EBUSY;x-			harmony->ply_stopped = 1;
-			snd_harmony_disable_interrupts(harmony);
-			break;x-		case SNDRV_PCM_TRIGGER_START:
-			if (!harmony->ply_stopped)
-				return -EBUSY;x-			harmony->ply_stopped = 0;x-			/* write the location of the first buffer to play */
-			gsc_writel(harmony->ply_buffer, harmony->hpa+REG_PNXTADD);
-			snd_harmony_enable_interrupts(harmony);
-			break;x-		case SNDRV_PCM_TRIGGER_PAUSE_PUSH:x-		case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:x-		case SNDRV_PCM_TRIGGER_SUSPEND:
-			DPRINTK(KERN_INFO PFX "received unimplemented trigger: %d\n", cmd);x-		default:
-			return -EINVAL;
+	case SNDRV_PCM_TRIGGER_START:
+		h->st.playing = 1;
+		harmony_write(h, HARMONY_PNXTADD, h->pbuf.addr);
+		harmony_write(h, HARMONY_RNXTADD, h->gdma.addr);x+		harmony_unmute(h);x+		harmony_enable_interrupts(h);x+		break;x+	case SNDRV_PCM_TRIGGER_STOP:
+		h->st.playing = 0;x+		harmony_mute(h);x+		harmony_disable_interrupts(h);x+		break;x+	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:x+	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:x+	case SNDRV_PCM_TRIGGER_SUSPEND:
+	default:
+		spin_unlock_irqrestore(&h->lock, flags);x+		snd_BUG();
+		return -EINVAL;
 	}x+	spin_unlock_irqrestore(&h->lock, flags);x+	
 	return 0;x }
 x-static int snd_card_harmony_capture_trigger(snd_pcm_substream_t * substream,
-					  int cmd)
+static int
+snd_harmony_capture_trigger(snd_pcm_substream_t *ss, int cmd)
 {
-	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
-	x-	switch (cmd) {x-		case SNDRV_PCM_TRIGGER_STOP:
-			if (harmony->cap_stopped) 
-				return -EBUSY;x-			harmony->cap_stopped = 1;
-			snd_harmony_disable_interrupts(harmony);
-			break;x-		case SNDRV_PCM_TRIGGER_START:
-			if (!harmony->cap_stopped)
-				return -EBUSY;x-			harmony->cap_stopped = 0;
-			snd_harmony_enable_interrupts(harmony);
-			break;x-		case SNDRV_PCM_TRIGGER_PAUSE_PUSH:x-		case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:x-		case SNDRV_PCM_TRIGGER_SUSPEND:
-			DPRINTK(KERN_INFO PFX "Received unimplemented trigger: %d\n", cmd);x-		default:
-			return -EINVAL;
-	}
-	return 0;
+        harmony_t *h = snd_pcm_substream_chip(ss);x+	unsigned long flags;x+
+	if (h->st.playing)
+		return -EBUSY;x+x+	spin_lock_irqsave(&h->lock, flags);x+        switch (cmd) {x+        case SNDRV_PCM_TRIGGER_START:
+		h->st.capturing = 1;
+                harmony_write(h, HARMONY_PNXTADD, h->sdma.addr);x+                harmony_write(h, HARMONY_RNXTADD, h->cbuf.addr);
+		harmony_unmute(h);x+                harmony_enable_interrupts(h);x+		break;x+        case SNDRV_PCM_TRIGGER_STOP:
+		h->st.capturing = 0;x+                harmony_mute(h);x+                harmony_disable_interrupts(h);x+		break;x+        case SNDRV_PCM_TRIGGER_PAUSE_PUSH:x+        case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:x+        case SNDRV_PCM_TRIGGER_SUSPEND:
+	default:
+		spin_unlock_irqrestore(&h->lock, flags);x+		snd_BUG();
+                return -EINVAL;
+        }x+	spin_unlock_irqrestore(&h->lock, flags);x+		
+        return 0;x }
 x-/* set data format */
-static int snd_harmony_set_data_format(snd_card_harmony_t *harmony, int pcm_format)
+static int
+snd_harmony_set_data_format(harmony_t *h, int fmt, int force)
 {
-	int old_format = harmony->data_format;
-	int new_format = old_format;x-	switch (pcm_format) {x+	int o = h->st.format;x+	int n;x+x+	switch(fmt) {x 	case SNDRV_PCM_FORMAT_S16_BE:
-		new_format = HARMONY_DF_16BIT_LINEAR;x+		n = HARMONY_DF_16BIT_LINEAR;x 		break;x 	case SNDRV_PCM_FORMAT_A_LAW:
-		new_format = HARMONY_DF_8BIT_ALAW;x+		n = HARMONY_DF_8BIT_ALAW;x 		break;x 	case SNDRV_PCM_FORMAT_MU_LAW:
-		new_format = HARMONY_DF_8BIT_ULAW;x+		n = HARMONY_DF_8BIT_ULAW;x+		break;x+	default:
+		n = HARMONY_DF_16BIT_LINEAR;x 		break;x 	}
-	/* re-initialize silence buffer if needed */
-	if (old_format != new_format)
-		snd_pcm_format_set_silence(pcm_format, harmony->silence_dma.area,
-					   (HARMONY_BUF_SIZE * SILENCE_BUFS * 8) / snd_pcm_format_width(pcm_format));
 
-	return new_format;
+	if (force || o != n) {x+		snd_pcm_format_set_silence(fmt, h->sdma.area,
+					   SILENCE_BUFSZ / 
+					   (snd_pcm_format_physical_width(fmt) / 8));x+	}
+x+	return n;x }
 x-static int snd_card_harmony_playback_prepare(snd_pcm_substream_t * substream)
+static int
+snd_harmony_playback_prepare(snd_pcm_substream_t *ss)
 {
-	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
-	snd_pcm_runtime_t *runtime = substream->runtime;
+	harmony_t *h = snd_pcm_substream_chip(ss);x+	snd_pcm_runtime_t *rt = ss->runtime;
 	
-	harmony->ply_size 			= snd_pcm_lib_buffer_bytes(substream);
-	harmony->ply_count 			= snd_pcm_lib_period_bytes(substream);
-	harmony->ply_buf			= 0;
-	harmony->ply_stopped		= 1;
+	if (h->st.capturing)
+		return -EBUSY;x 	
-	/* initialize given sample rate */
-	harmony->sample_rate = snd_card_harmony_rate_bits(runtime->rate);
+	h->pbuf.size = snd_pcm_lib_buffer_bytes(ss);
+	h->pbuf.count = snd_pcm_lib_period_bytes(ss);
+	h->pbuf.buf = 0;x+	h->st.playing = 0;x 
-	/* data format */
-	harmony->data_format = snd_harmony_set_data_format(harmony, runtime->format);
-
-	/* number of channels */
-	if (runtime->channels == 2)
-		harmony->stereo_select = HARMONY_SS_STEREO;
-	else
-		harmony->stereo_select = HARMONY_SS_MONO;
-	x-	DPRINTK(KERN_INFO PFX "Playback_prepare, sr=%d(%x), df=%x, ss=%x hpa=%lx\n", runtime->rate,
-				harmony->sample_rate, harmony->data_format, harmony->stereo_select, harmony->hpa);
-	snd_harmony_update_control(harmony);
-	harmony->format_initialized = 1;
-	harmony->ply_buffer = runtime->dma_addr;x+	h->st.rate = snd_harmony_rate_bits(rt->rate);
+	h->st.format = snd_harmony_set_data_format(h, rt->format, 0);x 	
+	if (rt->channels == 2)
+		h->st.stereo = HARMONY_SS_STEREO;
+	else
+		h->st.stereo = HARMONY_SS_MONO;
+
+	harmony_set_control(h);x+
+	h->pbuf.addr = rt->dma_addr;x+
 	return 0;x }
 x-static int snd_card_harmony_capture_prepare(snd_pcm_substream_t * substream)
+static int
+snd_harmony_capture_prepare(snd_pcm_substream_t *ss)
 {
-	snd_pcm_runtime_t *runtime = substream->runtime;
-	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
-	x-	harmony->cap_size 			= snd_pcm_lib_buffer_bytes(substream);
-	harmony->cap_count 			= snd_pcm_lib_period_bytes(substream);
-	harmony->cap_count			= 0;
-	harmony->cap_stopped		= 1;
-
-	/* initialize given sample rate */
-	harmony->sample_rate = snd_card_harmony_rate_bits(runtime->rate);
-	
-	/* data format */
-	harmony->data_format = snd_harmony_set_data_format(harmony, runtime->format);
-	
-	/* number of channels */
-	if (runtime->channels == 1)
-		harmony->stereo_select = HARMONY_SS_MONO;
-	else if (runtime->channels == 2)
-		harmony->stereo_select = HARMONY_SS_STEREO;
-		
-	snd_harmony_update_control(harmony);
-	harmony->format_initialized = 1;
-	
-	harmony->cap_buffer = runtime->dma_addr;x+        harmony_t *h = snd_pcm_substream_chip(ss);x+        snd_pcm_runtime_t *rt = ss->runtime;
 
-	return 0;
+	if (h->st.playing)
+		return -EBUSY;x+x+        h->cbuf.size = snd_pcm_lib_buffer_bytes(ss);
+        h->cbuf.count = snd_pcm_lib_period_bytes(ss);
+        h->cbuf.buf = 0;x+	h->st.capturing = 0;x+
+        h->st.rate = snd_harmony_rate_bits(rt->rate);
+        h->st.format = snd_harmony_set_data_format(h, rt->format, 0);x+
+        if (rt->channels == 2)
+                h->st.stereo = HARMONY_SS_STEREO;
+        else
+                h->st.stereo = HARMONY_SS_MONO;
+
+        harmony_set_control(h);x+
+        h->cbuf.addr = rt->dma_addr;x+
+        return 0;x }
 x-static snd_pcm_uframes_t snd_card_harmony_capture_pointer(snd_pcm_substream_t * substream)
+static snd_pcm_uframes_t 
+snd_harmony_playback_pointer(snd_pcm_substream_t *ss)
 {
-	snd_pcm_runtime_t *runtime = substream->runtime;
-	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
-	unsigned long rcuradd;
-	int recorded;
-	
-	if (harmony->cap_stopped) return 0;x-	if (harmony->capture_substream == NULL) return 0;x-
-	rcuradd = gsc_readl(harmony->hpa+REG_RCURADD);
-	recorded = (rcuradd - harmony->cap_buffer);
-	recorded %= harmony->cap_size;
-		
-	return bytes_to_frames(runtime, recorded);
-}
+	snd_pcm_runtime_t *rt = ss->runtime;
+	harmony_t *h = snd_pcm_substream_chip(ss);x+	unsigned long pcuradd;
+	unsigned long played;x x-/*
- */
+	if (!(h->st.playing) || (h->psubs == NULL)) 
+		return 0;
 x-static snd_pcm_uframes_t snd_card_harmony_playback_pointer(snd_pcm_substream_t * substream)
-{
-	snd_pcm_runtime_t *runtime = substream->runtime;
-	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
-	int played;x-	long int pcuradd = gsc_readl(harmony->hpa+REG_PCURADD);
-	x-	if ((harmony->ply_stopped) || (harmony->playback_substream == NULL)) return 0;x-	if ((harmony->ply_buffer == 0) || (harmony->ply_size == 0)) return 0;x-	x-	played = (pcuradd - harmony->ply_buffer);
-	x-	printk(KERN_DEBUG PFX "Pointer is %lx-%lx = %d\n", pcuradd, harmony->ply_buffer, played);	x-x-	if (pcuradd > harmony->ply_buffer + harmony->ply_size) return 0;x-	x-	return bytes_to_frames(runtime, played);
-}
-x-static snd_pcm_hardware_t snd_card_harmony_playback =
-{
-	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 
-					SNDRV_PCM_INFO_JOINT_DUPLEX | 
-					SNDRV_PCM_INFO_MMAP_VALID |x-					SNDRV_PCM_INFO_BLOCK_TRANSFER),
-	.formats =		(SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_BE | x-					SNDRV_PCM_FMTBIT_A_LAW | SNDRV_PCM_FMTBIT_MU_LAW),
-	.rates =		SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
-	.rate_min =		5500,
-	.rate_max =		48000,
-	.channels_min =		1,
-	.channels_max =		2,
-	.buffer_bytes_max =	MAX_BUFFER_SIZE,
-	.period_bytes_min =	HARMONY_BUF_SIZE,
-	.period_bytes_max =	HARMONY_BUF_SIZE,
-	.periods_min =		1,
-	.periods_max =		MAX_BUFS,
-	.fifo_size =		0,
-};
+	if ((h->pbuf.addr == 0) || (h->pbuf.size == 0))
+		return 0;
+	
+	pcuradd = harmony_read(h, HARMONY_PCURADD);
+	played = pcuradd - h->pbuf.addr;x+
+#ifdef HARMONY_DEBUG
+	printk(KERN_DEBUG PFX "playback_pointer is 0x%lx-0x%lx = %d bytes\n", 
+	       pcuradd, h->pbuf.addr, played);	x+#endif
+
+	if (pcuradd > h->pbuf.addr + h->pbuf.size) {
+		return 0;
+	}
+x+	return bytes_to_frames(rt, played);
+}
 x-static snd_pcm_hardware_t snd_card_harmony_capture =
+static snd_pcm_uframes_t
+snd_harmony_capture_pointer(snd_pcm_substream_t *ss)
 {
-	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 
-					SNDRV_PCM_INFO_JOINT_DUPLEX | 
-					SNDRV_PCM_INFO_MMAP_VALID |x-					SNDRV_PCM_INFO_BLOCK_TRANSFER),
-	.formats =		(SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_BE | x-					SNDRV_PCM_FMTBIT_A_LAW | SNDRV_PCM_FMTBIT_MU_LAW),
-	.rates =		SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
-	.rate_min =		5500,
-	.rate_max =		48000,
-	.channels_min =		1,
-	.channels_max =		2,
-	.buffer_bytes_max =	MAX_BUFFER_SIZE,
-	.period_bytes_min =	HARMONY_BUF_SIZE,
-	.period_bytes_max =	HARMONY_BUF_SIZE,
-	.periods_min =		1,
-	.periods_max =		MAX_BUFS,
-	.fifo_size =		0,
-};
+        snd_pcm_runtime_t *rt = ss->runtime;
+        harmony_t *h = snd_pcm_substream_chip(ss);x+        unsigned long rcuradd;
+        unsigned long caught;x+
+        if (!(h->st.capturing) || (h->csubs == NULL))
+                return 0;x+
+        if ((h->cbuf.addr == 0) || (h->cbuf.size == 0))
+                return 0;x+
+        rcuradd = harmony_read(h, HARMONY_RCURADD);
+        caught = rcuradd - h->cbuf.addr;x+
+#ifdef HARMONY_DEBUG
+        printk(KERN_DEBUG PFX "capture_pointer is 0x%lx-0x%lx = %d bytes\n",
+               rcuradd, h->cbuf.addr, caught);
+#endif
+
+        if (rcuradd > h->cbuf.addr + h->cbuf.size) {
+		return 0;
+	}
+x+        return bytes_to_frames(rt, caught);
+}
 x-static int snd_card_harmony_playback_open(snd_pcm_substream_t * substream)
+static int 
+snd_harmony_playback_open(snd_pcm_substream_t *ss)
 {
-	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
-	snd_pcm_runtime_t *runtime = substream->runtime;
+	harmony_t *h = snd_pcm_substream_chip(ss);x+	snd_pcm_runtime_t *rt = ss->runtime;
 	int err;
 	
-	harmony->playback_substream = substream;x-	runtime->hw = snd_card_harmony_playback;
-	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraint_rates);
+	h->psubs = ss;
+	rt->hw = snd_harmony_playback;
+	snd_pcm_hw_constraint_list(rt, 0, SNDRV_PCM_HW_PARAM_RATE, 
+				   &hw_constraint_rates);
 	x-	if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
+	err = snd_pcm_hw_constraint_integer(rt, SNDRV_PCM_HW_PARAM_PERIODS);
+	if (err < 0)
 		return err;
 	
 	return 0;x }
 x-static int snd_card_harmony_capture_open(snd_pcm_substream_t * substream)
+static int
+snd_harmony_capture_open(snd_pcm_substream_t *ss)
 {
-	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
-	snd_pcm_runtime_t *runtime = substream->runtime;
-	int err;
-	
-	harmony->capture_substream = substream;x-	runtime->hw = snd_card_harmony_capture;
-	snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraint_rates);
-	if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
-		return err;
-	return 0;
+        harmony_t *h = snd_pcm_substream_chip(ss);x+        snd_pcm_runtime_t *rt = ss->runtime;
+        int err;
+
+        h->csubs = ss;
+        rt->hw = snd_harmony_capture;
+        snd_pcm_hw_constraint_list(rt, 0, SNDRV_PCM_HW_PARAM_RATE,x+                                   &hw_constraint_rates);
 
+        err = snd_pcm_hw_constraint_integer(rt, SNDRV_PCM_HW_PARAM_PERIODS);
+        if (err < 0)
+                return err;
+
+        return 0;x }
 x-static int snd_card_harmony_playback_close(snd_pcm_substream_t * substream)
+static int 
+snd_harmony_playback_close(snd_pcm_substream_t *ss)
 {
-	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
-	
-	harmony->playback_substream = NULL;
-	harmony->ply_size 			= 0;
-	harmony->ply_buf			= 0;
-	harmony->ply_buffer			= 0;
-	harmony->ply_count			= 0;
-	harmony->ply_stopped		= 1;
-	harmony->format_initialized = 0;
-	x+	harmony_t *h = snd_pcm_substream_chip(ss);x+	h->psubs = NULL;
 	return 0;x }
 x-static int snd_card_harmony_capture_close(snd_pcm_substream_t * substream)
+static int
+snd_harmony_capture_close(snd_pcm_substream_t *ss)
 {
-	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
-	
-	harmony->capture_substream = NULL;
-	harmony->cap_size 			= 0;
-	harmony->cap_buf			= 0;
-	harmony->cap_buffer			= 0;
-	harmony->cap_count			= 0;
-	harmony->cap_stopped		= 1;
-	harmony->format_initialized = 0;
-	x-	return 0;
+        harmony_t *h = snd_pcm_substream_chip(ss);x+        h->csubs = NULL;
+        return 0;x }
 x-static int snd_card_harmony_hw_params(snd_pcm_substream_t *substream, 
-	                   snd_pcm_hw_params_t * hw_params)
+static int 
+snd_harmony_hw_params(snd_pcm_substream_t *ss,
+		      snd_pcm_hw_params_t *hw)
 {
 	int err;
-	snd_card_harmony_t *harmony = snd_pcm_substream_chip(substream);
+	harmony_t *h = snd_pcm_substream_chip(ss);x+	
+	err = snd_pcm_lib_malloc_pages(ss, params_buffer_bytes(hw));
+	if (err > 0 && h->dma.type == SNDRV_DMA_TYPE_CONTINUOUS)
+		ss->runtime->dma_addr = __pa(ss->runtime->dma_area);
 	x-	err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
-	if (err > 0 && harmony->dma_dev.type == SNDRV_DMA_TYPE_CONTINUOUS)
-		substream->runtime->dma_addr = __pa(substream->runtime->dma_area);
-	DPRINTK(KERN_INFO PFX "HW Params returned %d, dma_addr %lx\n", err,
-			(unsigned long)substream->runtime->dma_addr);
 	return err;
 }
 x-static int snd_card_harmony_hw_free(snd_pcm_substream_t *substream) 
+static int 
+snd_harmony_hw_free(snd_pcm_substream_t *ss) 
 {
-	snd_pcm_lib_free_pages(substream);		
-	return 0;
+	return snd_pcm_lib_free_pages(ss);x }
 x-static snd_pcm_ops_t snd_card_harmony_playback_ops = {x-	.open =			snd_card_harmony_playback_open,
-	.close =		snd_card_harmony_playback_close,
-	.ioctl =		snd_card_harmony_playback_ioctl,
-	.hw_params = 	snd_card_harmony_hw_params,
-	.hw_free = 		snd_card_harmony_hw_free,
-	.prepare =		snd_card_harmony_playback_prepare,
-	.trigger =		snd_card_harmony_playback_trigger,
- 	.pointer =		snd_card_harmony_playback_pointer,
+static snd_pcm_ops_t snd_harmony_playback_ops = {x+	.open =	snd_harmony_playback_open,
+	.close = snd_harmony_playback_close,
+	.ioctl = snd_pcm_lib_ioctl,
+	.hw_params = snd_harmony_hw_params,
+	.hw_free = snd_harmony_hw_free,
+	.prepare = snd_harmony_playback_prepare,
+	.trigger = snd_harmony_playback_trigger,x+ 	.pointer = snd_harmony_playback_pointer,
 };x 
-static snd_pcm_ops_t snd_card_harmony_capture_ops = {x-	.open =			snd_card_harmony_capture_open,
-	.close =		snd_card_harmony_capture_close,
-	.ioctl =		snd_card_harmony_capture_ioctl,
-	.hw_params = 	snd_card_harmony_hw_params,
-	.hw_free = 		snd_card_harmony_hw_free,
-	.prepare =		snd_card_harmony_capture_prepare,
-	.trigger =		snd_card_harmony_capture_trigger,
-	.pointer =		snd_card_harmony_capture_pointer,
+static snd_pcm_ops_t snd_harmony_capture_ops = {x+        .open = snd_harmony_capture_open,
+        .close = snd_harmony_capture_close,
+        .ioctl = snd_pcm_lib_ioctl,
+        .hw_params = snd_harmony_hw_params,
+        .hw_free = snd_harmony_hw_free,
+        .prepare = snd_harmony_capture_prepare,
+        .trigger = snd_harmony_capture_trigger,
+        .pointer = snd_harmony_capture_pointer,
 };x x-static int snd_card_harmony_pcm_init(snd_card_harmony_t *harmony)
+static int 
+snd_harmony_pcm_init(harmony_t *h)
 {
 	snd_pcm_t *pcm;x 	int err;
 
-	/* Request that IRQ */
-	if (request_irq(harmony->irq, snd_card_harmony_interrupt, 0 ,"harmony", harmony)) {x-		printk(KERN_ERR PFX "Error requesting irq %d.\n", harmony->irq);x-		return -EFAULT;
-	}
+	harmony_disable_interrupts(h);x 	
-	snd_harmony_disable_interrupts(harmony);
-	
-   	if ((err = snd_pcm_new(harmony->card, "Harmony", 0, 1, 1, &pcm)) < 0)
+   	err = snd_pcm_new(h->card, "harmony", 0, 1, 1, &pcm);
+	if (err < 0)
 		return err;
 	
-	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_harmony_playback_ops);
- 	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_harmony_capture_ops); 
-	x-	pcm->private_data = harmony;
+	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, 
+			&snd_harmony_playback_ops);
+	snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
+			&snd_harmony_capture_ops);
+x+	pcm->private_data = h;
 	pcm->info_flags = 0;
-	strcpy(pcm->name, "Harmony");
-	harmony->pcm = pcm;
+	strcpy(pcm->name, "harmony");
+	h->pcm = pcm;
+x+	h->psubs = NULL;
+	h->csubs = NULL;
 	
 	/* initialize graveyard buffer */
-	harmony->dma_dev.type = SNDRV_DMA_TYPE_DEV;
-	harmony->dma_dev.dev = &harmony->pa_dev->dev;
-	err = snd_dma_alloc_pages(harmony->dma_dev.type,
-				  harmony->dma_dev.dev,
-				  HARMONY_BUF_SIZE*GRAVEYARD_BUFS,
-				  &harmony->graveyard_dma);
-	if (err == -ENOMEM) {x-		/* use continuous buffers */
-		harmony->dma_dev.type = SNDRV_DMA_TYPE_CONTINUOUS;
-		harmony->dma_dev.dev = snd_dma_continuous_data(GFP_KERNEL);
-		err = snd_dma_alloc_pages(harmony->dma_dev.type,
-					  harmony->dma_dev.dev,
-					  HARMONY_BUF_SIZE*GRAVEYARD_BUFS,
-					  &harmony->graveyard_dma);
-	}
+	h->dma.type = SNDRV_DMA_TYPE_DEV;
+	h->dma.dev = &h->dev->dev;
+	err = snd_dma_alloc_pages(h->dma.type,
+				  h->dma.dev,
+				  BUF_SIZE*GRAVEYARD_BUFS,
+				  &h->gdma);x 	if (err < 0) {x-		printk(KERN_ERR PFX "can't allocate graveyard buffer\n");
+		printk(KERN_ERR PFX "cannot allocate graveyard buffer!\n");
 		return err;
 	}
-	harmony->graveyard_count = 0;x 	
 	/* initialize silence buffers */
-	err = snd_dma_alloc_pages(harmony->dma_dev.type,
-				  harmony->dma_dev.dev,
-				  HARMONY_BUF_SIZE*SILENCE_BUFS,
-				  &harmony->silence_dma);
+	err = snd_dma_alloc_pages(h->dma.type,
+				  h->dma.dev,
+				  BUF_SIZE*SILENCE_BUFS,
+				  &h->sdma);x 	if (err < 0) {x-		printk(KERN_ERR PFX "can't allocate silence buffer\n");
+		printk(KERN_ERR PFX "cannot allocate silence buffer!\n");
 		return err;
 	}
-	harmony->silence_count = 0;x 
-	if (harmony->dma_dev.type == SNDRV_DMA_TYPE_CONTINUOUS) {x-		harmony->graveyard_dma.addr = __pa(harmony->graveyard_dma.area);
-		harmony->silence_dma.addr = __pa(harmony->silence_dma.area);
-	}
-
-	harmony->ply_stopped = harmony->cap_stopped = 1;
-	
-	harmony->playback_substream = NULL;
-	harmony->capture_substream = NULL;
-	harmony->graveyard_count = 0;x-x-	err = snd_pcm_lib_preallocate_pages_for_all(pcm, harmony->dma_dev.type,
-						    harmony->dma_dev.dev,
-						    MAX_BUFFER_SIZE, MAX_BUFFER_SIZE);
+	/* pre-allocate space for DMA */
+	err = snd_pcm_lib_preallocate_pages_for_all(pcm, h->dma.type,
+						    h->dma.dev,
+						    MAX_BUF_SIZE, 
+						    MAX_BUF_SIZE);x 	if (err < 0) {x-		printk(KERN_ERR PFX "buffer allocation error %d\n", err);
-		// return err;
+		printk(KERN_ERR PFX "buffer allocation error: %d\n", err);
+		return err;
 	}
 
+	h->st.format = snd_harmony_set_data_format(h,
+		SNDRV_PCM_FORMAT_S16_BE, 1);x+
 	return 0;x }
 x-/*
- * mixer routines
- */
-
-static void snd_harmony_set_new_gain(snd_card_harmony_t *harmony)
+static void 
+snd_harmony_set_new_gain(harmony_t *h)
 {
-	DPRINTK(KERN_INFO PFX "Setting new gain %x at %lx\n", harmony->current_gain, harmony->hpa+REG_GAINCTL);
-	/* Wait until we're out of control mode */
- 	snd_harmony_wait_cntl(harmony);
-	
-	gsc_writel(harmony->current_gain, harmony->hpa+REG_GAINCTL);
+ 	harmony_wait_for_control(h);x+	harmony_write(h, HARMONY_GAINCTL, h->st.gain);x }
 x-#define HARMONY_VOLUME(xname, left_shift, right_shift, mask, invert) \
-{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
-  .info = snd_harmony_mixercontrol_info, \
-  .get = snd_harmony_volume_get, .put = snd_harmony_volume_put, \
-  .private_value = ((left_shift) | ((right_shift) << 8) | ((mask) << 16) | ((invert) << 24)) }
-x-static int snd_harmony_mixercontrol_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo)
-{
-	int mask = (kcontrol->private_value >> 16) & 0xff;
-	int left_shift = (kcontrol->private_value) & 0xff;
-	int right_shift = (kcontrol->private_value >> 8) & 0xff;
+static int 
+snd_harmony_mixercontrol_info(snd_kcontrol_t *kc, 
+			      snd_ctl_elem_info_t *uinfo)
+{x+	int mask = (kc->private_value >> 16) & 0xff;
+	int left_shift = (kc->private_value) & 0xff;
+	int right_shift = (kc->private_value >> 8) & 0xff;
 	
-	uinfo->type = (mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER);
-	uinfo->count = (left_shift == right_shift) ? 1 : 2;
+	uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : 
+		       SNDRV_CTL_ELEM_TYPE_INTEGER;
+	uinfo->count = left_shift == right_shift ? 1 : 2;
 	uinfo->value.integer.min = 0;
 	uinfo->value.integer.max = mask;x+
 	return 0;x }
- x-static int snd_harmony_volume_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
-{
-	snd_card_harmony_t *harmony = snd_kcontrol_chip(kcontrol);
-	int shift_left = (kcontrol->private_value) & 0xff;
-	int shift_right = (kcontrol->private_value >> 8) & 0xff;
-	int mask = (kcontrol->private_value >> 16) & 0xff;
-	int invert = (kcontrol->private_value >> 24) & 0xff;
-	unsigned long flags;x+
+static int 
+snd_harmony_volume_get(snd_kcontrol_t *kc, 
+		       snd_ctl_elem_value_t *ucontrol)
+{x+	harmony_t *h = snd_kcontrol_chip(kc);
+	int shift_left = (kc->private_value) & 0xff;
+	int shift_right = (kc->private_value >> 8) & 0xff;
+	int mask = (kc->private_value >> 16) & 0xff;
+	int invert = (kc->private_value >> 24) & 0xff;
 	int left, right;x+	unsigned long flags;x 	
-	spin_lock_irqsave(&harmony->mixer_lock, flags);x-	left = (harmony->current_gain >> shift_left) & mask;x-	right = (harmony->current_gain >> shift_right) & mask;x+	spin_lock_irqsave(&h->mixer_lock, flags);x+x+	left = (h->st.gain >> shift_left) & mask;x+	right = (h->st.gain >> shift_right) & mask;x x 	if (invert) {
 		left = mask - left;
@@ -910,21 +719,24 @@
 	}
 	ucontrol->value.integer.value[0] = left;
 	ucontrol->value.integer.value[1] = right;x-	spin_unlock_irqrestore(&harmony->mixer_lock, flags);x+x+	spin_unlock_irqrestore(&h->mixer_lock, flags);x 
 	return 0;x }  
 x-static int snd_harmony_volume_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
-{
-	snd_card_harmony_t *harmony = snd_kcontrol_chip(kcontrol);
-	int shift_left = (kcontrol->private_value) & 0xff;
-	int shift_right = (kcontrol->private_value >> 8) & 0xff;
-	int mask = (kcontrol->private_value >> 16) & 0xff;
-	int invert = (kcontrol->private_value >> 24) & 0xff;
-	unsigned long flags;x+static int 
+snd_harmony_volume_put(snd_kcontrol_t *kc, 
+		       snd_ctl_elem_value_t *ucontrol)
+{x+	harmony_t *h = snd_kcontrol_chip(kc);
+	int shift_left = (kc->private_value) & 0xff;
+	int shift_right = (kc->private_value >> 8) & 0xff;
+	int mask = (kc->private_value >> 16) & 0xff;
+	int invert = (kc->private_value >> 24) & 0xff;
 	int left, right;x-	int old_gain = harmony->current_gain;
+	int old_gain = h->st.gain;x+	unsigned long flags;x 	
 	left = ucontrol->value.integer.value[0] & mask;x 	right = ucontrol->value.integer.value[1] & mask;x@@ -933,213 +745,249 @@
 		right = mask - right;x 	}
 	
-	spin_lock_irqsave(&harmony->mixer_lock, flags);x-	harmony->current_gain = harmony->current_gain & ~( (mask << shift_right) | (mask << shift_left));
- 	harmony->current_gain = harmony->current_gain | ((left << shift_left) | (right << shift_right) );
-	snd_harmony_set_new_gain(harmony);x-	spin_unlock_irqrestore(&harmony->mixer_lock, flags);x+	spin_lock_irqsave(&h->mixer_lock, flags);x+x+	h->st.gain &= ~( (mask << shift_right) | (mask << shift_left) );
+ 	h->st.gain |=  ( (left << shift_left) | (right << shift_right) );
+	snd_harmony_set_new_gain(h);x+x+	spin_unlock_irqrestore(&h->mixer_lock, flags);x 	
-	return (old_gain - harmony->current_gain);
+	return (old_gain - h->st.gain);x }
 x-#define HARMONY_CONTROLS (sizeof(snd_harmony_controls)/sizeof(snd_kcontrol_new_t))
+#define HARMONY_CONTROLS (sizeof(snd_harmony_controls)/ \x+                          sizeof(snd_kcontrol_new_t))
+
+#define HARMONY_VOLUME(xname, left_shift, right_shift, mask, invert) \
+{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname,                \x+  .info = snd_harmony_mixercontrol_info,                             \x+  .get = snd_harmony_volume_get, .put = snd_harmony_volume_put,      \x+  .private_value = ((left_shift) | ((right_shift) << 8) |            \x+                   ((mask) << 16) | ((invert) << 24)) }
 
 static snd_kcontrol_new_t snd_harmony_controls[] = {x-HARMONY_VOLUME("PCM Capture Volume", 12, 16, 0x0f, 0),x-HARMONY_VOLUME("Master Volume", 20, 20, 0x0f, 1),x-HARMONY_VOLUME("PCM Playback Volume", 6, 0, 0x3f, 1),x+	HARMONY_VOLUME("Playback Volume", HARMONY_GAIN_LO_SHIFT, 
+		       HARMONY_GAIN_RO_SHIFT, HARMONY_GAIN_OUT, 1),x+	HARMONY_VOLUME("Capture Volume", HARMONY_GAIN_LI_SHIFT,
+		       HARMONY_GAIN_RI_SHIFT, HARMONY_GAIN_IN, 0),x };x x-static void __init snd_harmony_reset_codec(snd_card_harmony_t *harmony)
-{
- 	snd_harmony_wait_cntl(harmony);
-	gsc_writel(1, harmony->hpa+REG_RESET);
-	mdelay(50);		/* wait 50 ms */
-	gsc_writel(0, harmony->hpa+REG_RESET);
-}
-x-/*
- * Mute all the output and reset Harmony.
- */
-
-static void __init snd_harmony_mixer_reset(snd_card_harmony_t *harmony)
+static void __init 
+snd_harmony_mixer_reset(harmony_t *h)
 {
-	harmony->current_gain = HARMONY_GAIN_TOTAL_SILENCE;
-	snd_harmony_set_new_gain(harmony);x-	snd_harmony_reset_codec(harmony);
-	harmony->current_gain = HARMONY_GAIN_DEFAULT;
-	snd_harmony_set_new_gain(harmony);x+	harmony_mute(h);x+	harmony_reset(h);x+	h->st.gain = HARMONY_GAIN_DEFAULT;
+	harmony_unmute(h);x }
 x-x-static int __init snd_card_harmony_mixer_init(snd_card_harmony_t *harmony)
+static int __init 
+snd_harmony_mixer_init(harmony_t *h)
 {
-	snd_card_t *card = harmony->card;
+	snd_card_t *card = h->card;
 	int idx, err;
 
-	snd_assert(harmony != NULL, return -EINVAL);
+	snd_assert(h != NULL, return -EINVAL);
 	strcpy(card->mixername, "Harmony Gain control interface");x 
 	for (idx = 0; idx < HARMONY_CONTROLS; idx++) {x-		if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_harmony_controls[idx], harmony))) < 0)
+		err = snd_ctl_add(card, 
+				  snd_ctl_new1(&snd_harmony_controls[idx], h));
+		if (err < 0)
 			return err;
 	}
 	
-	snd_harmony_mixer_reset(harmony);
+	snd_harmony_mixer_reset(h);x 
 	return 0;x }
 x-static int snd_card_harmony_create(snd_card_t *card, struct parisc_device *pa_dev, snd_card_harmony_t *harmony)
+static int
+snd_harmony_free(harmony_t *h)
 {
-	u32	cntl;
-	
-	harmony->card = card;
-	
-	harmony->pa_dev = pa_dev;
+        if (h->gdma.addr)x+                snd_dma_free_pages(&h->gdma);x+        if (h->sdma.addr)x+                snd_dma_free_pages(&h->sdma);x 
-	/* Set the HPA of harmony */
-	harmony->hpa = pa_dev->hpa;
-	
-	harmony->irq = pa_dev->irq;
-	if (!harmony->irq) {x-		printk(KERN_ERR PFX "no irq found\n");
-		return -ENODEV;
-	}
+	if (h->irq >= 0)
+		free_irq(h->irq, h);x 
-	/* Grab the ID and revision from the device */
-	harmony->id = (gsc_readl(harmony->hpa+REG_ID)&0x00ff0000) >> 16;x-	if ((harmony->id | 1) != 0x15) {x-		printk(KERN_WARNING PFX "wrong harmony id 0x%02x\n", harmony->id);
-		return -EBUSY;x-	}
-	cntl = gsc_readl(harmony->hpa+REG_CNTL);
-	harmony->rev = (cntl>>20) & 0xff;
+	if (h->iobase)
+		iounmap(h->iobase);x 
-	printk(KERN_INFO "Lasi Harmony Audio driver h/w id %i, rev. %i at 0x%lx, IRQ %i\n",	harmony->id, harmony->rev, pa_dev->hpa, harmony->irq);x-	
-	/* Make sure the control bit isn't set, although I don't think it 
-	   ever is. */
-	if (cntl & HARMONY_CNTL_C) {x-		printk(KERN_WARNING PFX "CNTL busy\n");
-		harmony->hpa = 0;
-		return -EBUSY;x+	parisc_set_drvdata(h->dev, NULL);x+x+	kfree(h);
+	return 0;x+}
+x+static int
+snd_harmony_dev_free(snd_device_t *dev)
+{x+	harmony_t *h = dev->device_data;
+	return snd_harmony_free(h);x+}
+x+static int __devinit
+snd_harmony_create(snd_card_t *card, 
+		   struct parisc_device *padev, 
+		   harmony_t **rchip)
+{x+	int err;
+	harmony_t *h;
+	static snd_device_ops_t ops = {x+		.dev_free = snd_harmony_dev_free,
+	};x+x+	*rchip = NULL;
+
+	h = kmalloc(sizeof(*h), GFP_KERNEL);
+	if (h == NULL)
+		return -ENOMEM;
+
+	memset(&h->st, 0, sizeof(h->st));
+	memset(&h->stats, 0, sizeof(h->stats));
+	memset(&h->pbuf, 0, sizeof(h->pbuf));
+	memset(&h->cbuf, 0, sizeof(h->cbuf));
+x+	h->hpa = padev->hpa;
+	h->card = card;
+	h->dev = padev;
+	h->irq = padev->irq;
+	h->iobase = ioremap_nocache(padev->hpa, HARMONY_SIZE);
+	if (h->iobase == NULL) {
+		printk(KERN_ERR PFX "unable to remap hpa 0x%lx\n",
+		       padev->hpa);
+		err = -EBUSY;x+		goto free_and_ret;
 	}
-	x+		
+	err = request_irq(h->irq, snd_harmony_interrupt, 0,
+			  "harmony", h);
+	if (err) {
+		printk(KERN_ERR PFX "could not obtain interrupt %d",
+		       h->irq);x+		goto free_and_ret;
+	}
+x+	spin_lock_init(&h->mixer_lock);x+	spin_lock_init(&h->lock);x+
+        if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL,x+                                  h, &ops)) < 0) {x+                goto free_and_ret;
+        }x+x+	*rchip = h;x+
 	return 0;x+x+free_and_ret:
+	snd_harmony_free(h);
+	return err;
 }
-	
-static int __init snd_card_harmony_probe(struct parisc_device *pa_dev)
+x+static int __devinit
+snd_harmony_probe(struct parisc_device *padev)
 {x+	int err;
 	static int dev;
-	snd_card_harmony_t *chip;
 	snd_card_t *card;
-	int err;
-	
-	if (dev >= SNDRV_CARDS)
+	harmony_t *h;
+	static int index = SNDRV_DEFAULT_IDX1;
+	static char *id = SNDRV_DEFAULT_STR1;
+
+	h = parisc_get_drvdata(padev);
+	if (h != NULL) {
 		return -ENODEV;
-	if (!enable[dev]) {x-		dev++;
-		return -ENOENT;
 	}
-	x-	snd_harmony_cards[dev] = snd_card_new(index[dev], id[dev], THIS_MODULE,
-			    sizeof(snd_card_harmony_t));
-	card = snd_harmony_cards[dev];
-				
+
+	card = snd_card_new(index, id, THIS_MODULE, 0);x 	if (card == NULL)
 		return -ENOMEM;
-	chip = (struct snd_card_harmony *)card->private_data;
-	spin_lock_init(&chip->control_lock);x-	spin_lock_init(&chip->mixer_lock);x-	x-	if ((err = snd_card_harmony_create(card, pa_dev, chip)) < 0) {x-		printk(KERN_ERR PFX "Creation failed\n");
-		snd_card_free(card);
-		return err;
+
+	err = snd_harmony_create(card, padev, &h);
+	if (err < 0) {
+		goto free_and_ret;
 	}
-	if ((err = snd_card_harmony_pcm_init(chip)) < 0) {x-		printk(KERN_ERR PFX "PCM Init failed\n");
-		snd_card_free(card);
-		return err;
+
+	err = snd_harmony_pcm_init(h);
+	if (err < 0) {
+		goto free_and_ret;
 	}
-	if ((err = snd_card_harmony_mixer_init(chip)) < 0) {x-		printk(KERN_ERR PFX "Mixer init failed\n");
-		snd_card_free(card);
-		return err;
+
+	err = snd_harmony_mixer_init(h);
+	if (err < 0) {
+		goto free_and_ret;
 	}
-	x-	snd_harmony_proc_init(chip);
-	x-	strcpy(card->driver, "Harmony");
-	strcpy(card->shortname, "ALSA driver for LASI Harmony");
-	sprintf(card->longname, "%s at h/w, id %i, rev. %i hpa 0x%lx, IRQ %i\n",card->shortname, chip->id, chip->rev, pa_dev->hpa, chip->irq);x 
-	if ((err = snd_card_register(card)) < 0) {x-		snd_card_free(card);
-		return err;
+	strcpy(card->driver, "harmony");
+	strcpy(card->shortname, "Harmony");
+	sprintf(card->longname, "%s at 0x%lx, irq %i",
+		card->shortname, h->hpa, h->irq);x+
+	err = snd_card_register(card);
+	if (err < 0) {
+		goto free_and_ret;
 	}
 x-	printk(KERN_DEBUG PFX "Successfully registered harmony pcm backend & mixer %d\n", dev);
 	dev++;
-	return 0;x-}x+	parisc_set_drvdata(padev, h);x 
-static struct parisc_device_id snd_card_harmony_devicetbl[] = {x- { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007A }, /* Bushmaster/Flounder */
- { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007B }, /* 712/715 Audio */
- { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007E }, /* Pace Audio */
- { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0007F }, /* Outfield / Coral II */
- { 0, }
-};
+	return 0;
 x-MODULE_DEVICE_TABLE(parisc, snd_card_harmony_devicetbl);
+free_and_ret:
+	snd_card_free(card);
+	return err;
+}
 x-/*
- * bloc device parisc. c'est une structure qui definit un device
- * que l'on trouve sur parisc. 
- * On y trouve les differents numeros HVERSION correspondant au device
- * en question (ce qui permet a l'inventory de l'identifier) et la fonction
- * d'initialisation du chose 
- */
+static int __devexit
+snd_harmony_remove(struct parisc_device *padev)
+{x+	harmony_t *h = parisc_get_drvdata(padev);
+	snd_card_free(h->card);
+	return 0;x+}
 
-static struct parisc_driver snd_card_harmony_driver = {x-	.name		= "Lasi ALSA Harmony",
-	.id_table	= snd_card_harmony_devicetbl,
-	.probe		= snd_card_harmony_probe,
+static struct parisc_driver snd_harmony_driver = {x+	.name = "harmony",
+	.id_table = snd_harmony_devtable,
+	.probe = snd_harmony_probe,
+	.remove = snd_harmony_remove,
 };x x-static int __init alsa_card_harmony_init(void)
+static int __init 
+alsa_harmony_init(void)
 {
 	int err;
-	
-	if ((err = register_parisc_driver(&snd_card_harmony_driver)) < 0) {x-		printk(KERN_ERR "Harmony soundcard not found or device busy\n");
+
+	err = register_parisc_driver(&snd_harmony_driver);
+	if (err < 0) {
+		printk(KERN_ERR PFX "device not found\n");
 		return err;
 	}
 
 	return 0;x }
 x-static void __exit alsa_card_harmony_exit(void)
+static void __exit
+alsa_harmony_fini(void)
 {
-	int idx;
-	snd_card_harmony_t *harmony;x+	int err;
+
+	err = unregister_parisc_driver(&snd_harmony_driver);
+	if (err < 0) {
+		printk(KERN_ERR PFX "failed to unregister\n");
+	}
 	
-	for (idx = 0; idx < SNDRV_CARDS; idx++)
-	{x-		if (snd_harmony_cards[idx] != NULL)x-		{	
-			DPRINTK(KERN_INFO PFX "Freeing card %d\n", idx);
-			harmony = snd_harmony_cards[idx]->private_data;
-			free_irq(harmony->irq, harmony);
-			printk(KERN_INFO PFX "Card unloaded %d, irq=%d\n", idx, harmony->irq);x-			snd_card_free(snd_harmony_cards[idx]);x-		}
-	}	
-	if (unregister_parisc_driver(&snd_card_harmony_driver) < 0)
-		printk(KERN_ERR PFX "Failed to unregister Harmony driver\n");
+	return;x }
 x-module_init(alsa_card_harmony_init)x-module_exit(alsa_card_harmony_exit)
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Kyle McMartin <kyle@parisc-linux.org>");
+MODULE_DESCRIPTION("Harmony sound driver");
+
+module_init(alsa_harmony_init);
+module_exit(alsa_harmony_fini);
diff -Nru a/sound/parisc/harmony.h b/sound/parisc/harmony.h
--- /dev/null	Wed Dec 31 16:00:00 196900
+++ b/sound/parisc/harmony.h	2005-03-02 03:25:14 -08:00x@@ -0,0 +1,151 @@
+/* Hewlett-Packard Harmony audio driver
+ * Copyright (C) 2004, Kyle McMartin <kyle@parisc-linux.org>
+ */x+
+#ifndef __HARMONY_H__
+#define __HARMONY_H__
+
+struct harmony_buffer {
+        unsigned long addr;x+        int buf;x+        int count;x+        int size;
+        int coherent;x+};
+
+typedef struct snd_card_harmony {
+        int irq;
+
+        unsigned long hpa; /* hard physical address */x+        void __iomem *iobase; /* remapped io address */x+
+        struct parisc_device *dev;
+
+        struct {x+                u32 gain;x+                u32 rate;x+                u32 format;x+                u32 stereo;
+		int playing;
+		int capturing;
+        } st;
+
+        struct snd_dma_device dma; /* playback/capture */x+        struct harmony_buffer pbuf;x+	struct harmony_buffer cbuf;x+
+        struct snd_dma_buffer gdma; /* graveyard */x+        struct snd_dma_buffer sdma; /* silence */x+
+        struct {x+                unsigned long play_intr;
+	        unsigned long rec_intr;
+                unsigned long graveyard_intr;
+                unsigned long silence_intr;
+        } stats;x+
+        snd_pcm_t *pcm;x+        snd_card_t *card;
+        snd_pcm_substream_t *psubs;
+	snd_pcm_substream_t *csubs;
+        snd_info_entry_t *proc;x+
+        spinlock_t lock;
+        spinlock_t mixer_lock;x+} harmony_t;
+
+#define MAX_PCM_DEVICES     1
+#define MAX_PCM_SUBSTREAMS  4
+#define MAX_MIDI_DEVICES    0
+
+#define HARMONY_SIZE       64
+
+#define BUF_SIZE     PAGE_SIZE
+#define MAX_BUFS     10
+#define MAX_BUF_SIZE (MAX_BUFS * BUF_SIZE)
+
+#define PLAYBACK_BUFS    MAX_BUFS
+#define RECORD_BUFS      MAX_BUFS
+#define GRAVEYARD_BUFS   1
+#define GRAVEYARD_BUFSZ  (GRAVEYARD_BUFS*BUF_SIZE)
+#define SILENCE_BUFS     1
+#define SILENCE_BUFSZ    (SILENCE_BUFS*BUF_SIZE)
+
+#define HARMONY_ID       0x000
+#define HARMONY_RESET    0x004
+#define HARMONY_CNTL     0x008
+#define HARMONY_GAINCTL  0x00c
+#define HARMONY_PNXTADD  0x010
+#define HARMONY_PCURADD  0x014
+#define HARMONY_RNXTADD  0x018
+#define HARMONY_RCURADD  0x01c
+#define HARMONY_DSTATUS  0x020
+#define HARMONY_OV       0x024
+#define HARMONY_PIO      0x028
+#define HARMONY_DIAG     0x03c
+
+#define HARMONY_CNTL_C          0x80000000
+#define HARMONY_CNTL_ST         0x00000020
+#define HARMONY_CNTL_44100      0x00000015      /* HARMONY_SR_44KHZ */x+#define HARMONY_CNTL_8000       0x00000008      /* HARMONY_SR_8KHZ */x+
+#define HARMONY_DSTATUS_ID      0x00000000 /* interrupts off */x+#define HARMONY_DSTATUS_PN      0x00000200 /* playback fill */x+#define HARMONY_DSTATUS_RN      0x00000002 /* record fill */x+#define HARMONY_DSTATUS_IE      0x80000000 /* interrupts on */x+
+#define HARMONY_DF_16BIT_LINEAR 0x00000000
+#define HARMONY_DF_8BIT_ULAW    0x00000001
+#define HARMONY_DF_8BIT_ALAW    0x00000002
+
+#define HARMONY_SS_MONO         0x00000000
+#define HARMONY_SS_STEREO       0x00000001
+
+#define HARMONY_GAIN_SILENCE    0x00F00FFF
+#define HARMONY_GAIN_DEFAULT    0x0FF00000
+
+#define HARMONY_GAIN_HE_SHIFT   27
+#define HARMONY_GAIN_HE_MASK    (1 << HARMONY_GAIN_HE_SHIFT)
+#define HARMONY_GAIN_LE_SHIFT   26
+#define HARMONY_GAIN_LE_MASK    (1 << HARMONY_GAIN_LE_SHIFT)
+#define HARMONY_GAIN_SE_SHIFT   25
+#define HARMONY_GAIN_SE_MASK    (1 << HARMONY_GAIN_SE_SHIFT)
+#define HARMONY_GAIN_IS_SHIFT   24
+#define HARMONY_GAIN_IS_MASK    (1 << HARMONY_GAIN_IS_SHIFT)
+
+#define HARMONY_GAIN_MA         0x0f
+#define HARMONY_GAIN_MA_SHIFT   20
+#define HARMONY_GAIN_MA_MASK    (HARMONY_GAIN_MA << HARMONY_GAIN_MA_SHIFT)
+
+#define HARMONY_GAIN_IN         0x0f
+#define HARMONY_GAIN_LI_SHIFT   16
+#define HARMONY_GAIN_LI_MASK    (HARMONY_GAIN_IN << HARMONY_GAIN_LI_SHIFT)
+#define HARMONY_GAIN_RI_SHIFT   12
+#define HARMONY_GAIN_RI_MASK    (HARMONY_GAIN_IN << HARMONY_GAIN_RI_SHIFT)
+
+#define HARMONY_GAIN_OUT        0x3f
+#define HARMONY_GAIN_LO_SHIFT   6
+#define HARMONY_GAIN_LO_MASK    (HARMONY_GAIN_OUT << HARMONY_GAIN_LO_SHIFT)
+#define HARMONY_GAIN_RO_SHIFT   0
+#define HARMONY_GAIN_RO_MASK    (HARMONY_GAIN_OUT << HARMONY_GAIN_RO_SHIFT)
+
+#define HARMONY_MAX_OUT (HARMONY_GAIN_RO_MASK >> HARMONY_GAIN_RO_SHIFT)
+#define HARMONY_MAX_IN  (HARMONY_GAIN_RI_MASK >> HARMONY_GAIN_RI_SHIFT)
+#define HARMONY_MAX_MON (HARMONY_GAIN_MA_MASK >> HARMONY_GAIN_MA_SHIFT)
+
+#define HARMONY_SR_8KHZ         0x08
+#define HARMONY_SR_16KHZ        0x09
+#define HARMONY_SR_27KHZ        0x0A
+#define HARMONY_SR_32KHZ        0x0B
+#define HARMONY_SR_48KHZ        0x0E
+#define HARMONY_SR_9KHZ         0x0F
+#define HARMONY_SR_5KHZ         0x10
+#define HARMONY_SR_11KHZ        0x11
+#define HARMONY_SR_18KHZ        0x12
+#define HARMONY_SR_22KHZ        0x13
+#define HARMONY_SR_37KHZ        0x14
+#define HARMONY_SR_44KHZ        0x15
+#define HARMONY_SR_33KHZ        0x16
+#define HARMONY_SR_6KHZ         0x17
+
+#endif /* __HARMONY_H__ */xdiff -Nru a/sound/ppc/keywest.c b/sound/ppc/keywest.c
--- a/sound/ppc/keywest.c	2004-04-23 00:18:25 -07:00
+++ b/sound/ppc/keywest.c	2005-03-02 10:00:56 -08:00x@@ -76,8 +76,6 @@
 	new_client->flags = 0;
 
 	strcpy(i2c_device_name(new_client), keywest_ctx->name);x-x-	new_client->id = keywest_ctx->id++; /* Automatically unique */x 	keywest_ctx->client = new_client;x 	
 	/* Tell the i2c layer a new client has arrived */xdiff -Nru a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
--- a/sound/usb/usbmixer.c	2005-01-07 14:22:57 -08:00x+++ b/sound/usb/usbmixer.c	2005-03-07 20:44:59 -08:00x@@ -305,7 +305,7 @@
 				    request,
 				    USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
 				    validx, cval->ctrlif | (cval->id << 8),
-				    buf, val_len, HZ / 10) >= 0) {
+				    buf, val_len, 100) >= 0) {
 			*value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len));
 			return 0;x 		}
@@ -343,7 +343,7 @@
 				    request,
 				    USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
 				    validx, cval->ctrlif | (cval->id << 8),
-				    buf, val_len, HZ / 10) >= 0)
+				    buf, val_len, 100) >= 0)
 			return 0;x 	snd_printdd(KERN_ERR "cannot set ctl value: req = 0x%x, wValue = 0x%x, wIndex = 0x%x, type = %d, data = 0x%x/0x%x\n", request, validx, cval->ctrlif | (cval->id << 8), cval->val_type, buf[0], buf[1]);
 	return -EINVAL;xdiff -Nru a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
--- a/sound/usb/usx2y/usX2Yhwdep.c	2005-01-07 14:22:57 -08:00x+++ b/sound/usb/usx2y/usX2Yhwdep.c	2005-03-07 20:44:55 -08:00x@@ -226,7 +226,7 @@
 		if (err)
 			snd_printk("usb_set_interface error \n");
 		else
-			err = usb_bulk_msg(dev, usb_sndbulkpipe(dev, 2), buf, dsp->length, &lret, 6*HZ);x+			err = usb_bulk_msg(dev, usb_sndbulkpipe(dev, 2), buf, dsp->length, &lret, 6000);
 		kfree(buf);
 	}
 	if (err)
